diff --git a/.gitattributes b/.gitattributes index 7e01350e1c39d1e24e9d1a438c9f94218fefd08a..5e9a6acb22a5311aa47b4282ce66966599ed606a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -91,3 +91,13 @@ tools/ui/node_modules/@img/sharp-libvips-linux-x64/lib/libvips-cpp.so.8.18.3 fil tools/ui/node_modules/@img/sharp-libvips-linuxmusl-x64/lib/libvips-cpp.so.8.18.3 filter=lfs diff=lfs merge=lfs -text tools/ui/node_modules/@img/sharp-linux-x64/lib/sharp-linux-x64-0.35.3.node filter=lfs diff=lfs merge=lfs -text tools/ui/node_modules/@img/sharp-linuxmusl-x64/lib/sharp-linuxmusl-x64-0.35.3.node filter=lfs diff=lfs merge=lfs -text +tools/ui/node_modules/@napi-rs/canvas-linux-x64-gnu/skia.linux-x64-gnu.node filter=lfs diff=lfs merge=lfs -text +tools/ui/node_modules/@napi-rs/canvas-linux-x64-musl/skia.linux-x64-musl.node filter=lfs diff=lfs merge=lfs -text +tools/ui/node_modules/@oxc-parser/binding-linux-x64-gnu/parser.linux-x64-gnu.node filter=lfs diff=lfs merge=lfs -text +tools/ui/node_modules/@oxc-parser/binding-linux-x64-musl/parser.linux-x64-musl.node filter=lfs diff=lfs merge=lfs -text +tools/ui/node_modules/@oxc-resolver/binding-linux-x64-gnu/resolver.linux-x64-gnu.node filter=lfs diff=lfs merge=lfs -text +tools/ui/node_modules/@oxc-resolver/binding-linux-x64-musl/resolver.linux-x64-musl.node filter=lfs diff=lfs merge=lfs -text +tools/ui/node_modules/@parcel/watcher-linux-x64-glibc/watcher.node filter=lfs diff=lfs merge=lfs -text +tools/ui/node_modules/@parcel/watcher-linux-x64-musl/watcher.node filter=lfs diff=lfs merge=lfs -text +tools/ui/node_modules/@rollup/rollup-linux-x64-gnu/rollup.linux-x64-gnu.node filter=lfs diff=lfs merge=lfs -text +tools/ui/node_modules/@rollup/rollup-linux-x64-musl/rollup.linux-x64-musl.node filter=lfs diff=lfs merge=lfs -text diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/shared/inMemoryEventStore.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/shared/inMemoryEventStore.js new file mode 100644 index 0000000000000000000000000000000000000000..35f6dbb7c3f7bd3123a1d91dc1fef1e71a8bc29c --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/shared/inMemoryEventStore.js @@ -0,0 +1,65 @@ +/** + * Simple in-memory implementation of the EventStore interface for resumability + * This is primarily intended for examples and testing, not for production use + * where a persistent storage solution would be more appropriate. + */ +export class InMemoryEventStore { + constructor() { + this.events = new Map(); + } + /** + * Generates a unique event ID for a given stream ID + */ + generateEventId(streamId) { + return `${streamId}_${Date.now()}_${Math.random().toString(36).substring(2, 10)}`; + } + /** + * Extracts the stream ID from an event ID + */ + getStreamIdFromEventId(eventId) { + const parts = eventId.split('_'); + return parts.length > 0 ? parts[0] : ''; + } + /** + * Stores an event with a generated event ID + * Implements EventStore.storeEvent + */ + async storeEvent(streamId, message) { + const eventId = this.generateEventId(streamId); + this.events.set(eventId, { streamId, message }); + return eventId; + } + /** + * Replays events that occurred after a specific event ID + * Implements EventStore.replayEventsAfter + */ + async replayEventsAfter(lastEventId, { send }) { + if (!lastEventId || !this.events.has(lastEventId)) { + return ''; + } + // Extract the stream ID from the event ID + const streamId = this.getStreamIdFromEventId(lastEventId); + if (!streamId) { + return ''; + } + let foundLastEvent = false; + // Sort events by eventId for chronological ordering + const sortedEvents = [...this.events.entries()].sort((a, b) => a[0].localeCompare(b[0])); + for (const [eventId, { streamId: eventStreamId, message }] of sortedEvents) { + // Only include events from the same stream + if (eventStreamId !== streamId) { + continue; + } + // Start sending events after we find the lastEventId + if (eventId === lastEventId) { + foundLastEvent = true; + continue; + } + if (foundLastEvent) { + await send(eventId, message); + } + } + return streamId; + } +} +//# sourceMappingURL=inMemoryEventStore.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/shared/inMemoryEventStore.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/shared/inMemoryEventStore.js.map new file mode 100644 index 0000000000000000000000000000000000000000..b9e6af66aa3b0d6ca8e01b049ba6e9094beaeed1 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/examples/shared/inMemoryEventStore.js.map @@ -0,0 +1 @@ +{"version":3,"file":"inMemoryEventStore.js","sourceRoot":"","sources":["../../../../src/examples/shared/inMemoryEventStore.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,OAAO,kBAAkB;IAA/B;QACY,WAAM,GAA+D,IAAI,GAAG,EAAE,CAAC;IAoE3F,CAAC;IAlEG;;OAEG;IACK,eAAe,CAAC,QAAgB;QACpC,OAAO,GAAG,QAAQ,IAAI,IAAI,CAAC,GAAG,EAAE,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;IACtF,CAAC;IAED;;OAEG;IACK,sBAAsB,CAAC,OAAe;QAC1C,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACjC,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5C,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,UAAU,CAAC,QAAgB,EAAE,OAAuB;QACtD,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QAC/C,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;QAChD,OAAO,OAAO,CAAC;IACnB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,iBAAiB,CACnB,WAAmB,EACnB,EAAE,IAAI,EAAyE;QAE/E,IAAI,CAAC,WAAW,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE,CAAC;YAChD,OAAO,EAAE,CAAC;QACd,CAAC;QAED,0CAA0C;QAC1C,MAAM,QAAQ,GAAG,IAAI,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAC;QAC1D,IAAI,CAAC,QAAQ,EAAE,CAAC;YACZ,OAAO,EAAE,CAAC;QACd,CAAC;QAED,IAAI,cAAc,GAAG,KAAK,CAAC;QAE3B,oDAAoD;QACpD,MAAM,YAAY,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAEzF,KAAK,MAAM,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,IAAI,YAAY,EAAE,CAAC;YACzE,2CAA2C;YAC3C,IAAI,aAAa,KAAK,QAAQ,EAAE,CAAC;gBAC7B,SAAS;YACb,CAAC;YAED,qDAAqD;YACrD,IAAI,OAAO,KAAK,WAAW,EAAE,CAAC;gBAC1B,cAAc,GAAG,IAAI,CAAC;gBACtB,SAAS;YACb,CAAC;YAED,IAAI,cAAc,EAAE,CAAC;gBACjB,MAAM,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACjC,CAAC;QACL,CAAC;QACD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/index.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2a8633553a9ef6906064c9e0717886d68f72241f --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/index.d.ts @@ -0,0 +1,13 @@ +/** + * Experimental MCP SDK features. + * WARNING: These APIs are experimental and may change without notice. + * + * Import experimental features from this module: + * ```typescript + * import { TaskStore, InMemoryTaskStore } from '@modelcontextprotocol/sdk/experimental'; + * ``` + * + * @experimental + */ +export * from './tasks/index.js'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/index.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..410892aa411801bf4e83783d57c3fdda69307cf0 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/experimental/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,kBAAkB,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/index.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/index.js new file mode 100644 index 0000000000000000000000000000000000000000..650f4e478a587c9529abfad21fd2c7ab9548fd2f --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/index.js @@ -0,0 +1,13 @@ +/** + * Experimental MCP SDK features. + * WARNING: These APIs are experimental and may change without notice. + * + * Import experimental features from this module: + * ```typescript + * import { TaskStore, InMemoryTaskStore } from '@modelcontextprotocol/sdk/experimental'; + * ``` + * + * @experimental + */ +export * from './tasks/index.js'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/index.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..3639685bd5b59d6bf96151610cd24666b37d88e0 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/experimental/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,cAAc,kBAAkB,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9c7a92834b7c642eb962812299efece97f3d0f31 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.d.ts @@ -0,0 +1,121 @@ +/** + * Experimental client task features for MCP SDK. + * WARNING: These APIs are experimental and may change without notice. + * + * @experimental + */ +import type { Client } from '../../client/index.js'; +import type { RequestOptions } from '../../shared/protocol.js'; +import type { ResponseMessage } from '../../shared/responseMessage.js'; +import type { AnyObjectSchema, SchemaOutput } from '../../server/zod-compat.js'; +import type { CallToolRequest, ClientRequest, Notification, Request, Result } from '../../types.js'; +import { CallToolResultSchema, type CompatibilityCallToolResultSchema } from '../../types.js'; +import type { GetTaskResult, ListTasksResult, CancelTaskResult } from './types.js'; +/** + * Experimental task features for MCP clients. + * + * Access via `client.experimental.tasks`: + * ```typescript + * const stream = client.experimental.tasks.callToolStream({ name: 'tool', arguments: {} }); + * const task = await client.experimental.tasks.getTask(taskId); + * ``` + * + * @experimental + */ +export declare class ExperimentalClientTasks { + private readonly _client; + constructor(_client: Client); + /** + * Calls a tool and returns an AsyncGenerator that yields response messages. + * The generator is guaranteed to end with either a 'result' or 'error' message. + * + * This method provides streaming access to tool execution, allowing you to + * observe intermediate task status updates for long-running tool calls. + * Automatically validates structured output if the tool has an outputSchema. + * + * @example + * ```typescript + * const stream = client.experimental.tasks.callToolStream({ name: 'myTool', arguments: {} }); + * for await (const message of stream) { + * switch (message.type) { + * case 'taskCreated': + * console.log('Tool execution started:', message.task.taskId); + * break; + * case 'taskStatus': + * console.log('Tool status:', message.task.status); + * break; + * case 'result': + * console.log('Tool result:', message.result); + * break; + * case 'error': + * console.error('Tool error:', message.error); + * break; + * } + * } + * ``` + * + * @param params - Tool call parameters (name and arguments) + * @param resultSchema - Zod schema for validating the result (defaults to CallToolResultSchema) + * @param options - Optional request options (timeout, signal, task creation params, etc.) + * @returns AsyncGenerator that yields ResponseMessage objects + * + * @experimental + */ + callToolStream(params: CallToolRequest['params'], resultSchema?: T, options?: RequestOptions): AsyncGenerator>, void, void>; + /** + * Gets the current status of a task. + * + * @param taskId - The task identifier + * @param options - Optional request options + * @returns The task status + * + * @experimental + */ + getTask(taskId: string, options?: RequestOptions): Promise; + /** + * Retrieves the result of a completed task. + * + * @param taskId - The task identifier + * @param resultSchema - Zod schema for validating the result + * @param options - Optional request options + * @returns The task result + * + * @experimental + */ + getTaskResult(taskId: string, resultSchema?: T, options?: RequestOptions): Promise>; + /** + * Lists tasks with optional pagination. + * + * @param cursor - Optional pagination cursor + * @param options - Optional request options + * @returns List of tasks with optional next cursor + * + * @experimental + */ + listTasks(cursor?: string, options?: RequestOptions): Promise; + /** + * Cancels a running task. + * + * @param taskId - The task identifier + * @param options - Optional request options + * + * @experimental + */ + cancelTask(taskId: string, options?: RequestOptions): Promise; + /** + * Sends a request and returns an AsyncGenerator that yields response messages. + * The generator is guaranteed to end with either a 'result' or 'error' message. + * + * This method provides streaming access to request processing, allowing you to + * observe intermediate task status updates for task-augmented requests. + * + * @param request - The request to send + * @param resultSchema - Zod schema for validating the result + * @param options - Optional request options (timeout, signal, task creation params, etc.) + * @returns AsyncGenerator that yields ResponseMessage objects + * + * @experimental + */ + requestStream(request: ClientRequest | RequestT, resultSchema: T, options?: RequestOptions): AsyncGenerator>, void, void>; +} +//# sourceMappingURL=client.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..e54158d6533a03c2f588ec140db950757e852d49 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/experimental/tasks/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAChF,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACpG,OAAO,EAAE,oBAAoB,EAAE,KAAK,iCAAiC,EAAuB,MAAM,gBAAgB,CAAC;AAEnH,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAgBnF;;;;;;;;;;GAUG;AACH,qBAAa,uBAAuB,CAChC,QAAQ,SAAS,OAAO,GAAG,OAAO,EAClC,aAAa,SAAS,YAAY,GAAG,YAAY,EACjD,OAAO,SAAS,MAAM,GAAG,MAAM;IAEnB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,OAAO,CAAC;IAE9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACI,cAAc,CAAC,CAAC,SAAS,OAAO,oBAAoB,GAAG,OAAO,iCAAiC,EAClG,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,EACjC,YAAY,GAAE,CAA6B,EAC3C,OAAO,CAAC,EAAE,cAAc,GACzB,cAAc,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;IAyE/D;;;;;;;;OAQG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAM/E;;;;;;;;;OASG;IACG,aAAa,CAAC,CAAC,SAAS,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAapI;;;;;;;;OAQG;IACG,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IASpF;;;;;;;OAOG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;IASrF;;;;;;;;;;;;;OAaG;IACH,aAAa,CAAC,CAAC,SAAS,eAAe,EACnC,OAAO,EAAE,aAAa,GAAG,QAAQ,EACjC,YAAY,EAAE,CAAC,EACf,OAAO,CAAC,EAAE,cAAc,GACzB,cAAc,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;CAWlE"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js new file mode 100644 index 0000000000000000000000000000000000000000..0c1d8af7235a51571a373c4bba5aeeb6df9e834a --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js @@ -0,0 +1,184 @@ +/** + * Experimental client task features for MCP SDK. + * WARNING: These APIs are experimental and may change without notice. + * + * @experimental + */ +import { CallToolResultSchema, McpError, ErrorCode } from '../../types.js'; +/** + * Experimental task features for MCP clients. + * + * Access via `client.experimental.tasks`: + * ```typescript + * const stream = client.experimental.tasks.callToolStream({ name: 'tool', arguments: {} }); + * const task = await client.experimental.tasks.getTask(taskId); + * ``` + * + * @experimental + */ +export class ExperimentalClientTasks { + constructor(_client) { + this._client = _client; + } + /** + * Calls a tool and returns an AsyncGenerator that yields response messages. + * The generator is guaranteed to end with either a 'result' or 'error' message. + * + * This method provides streaming access to tool execution, allowing you to + * observe intermediate task status updates for long-running tool calls. + * Automatically validates structured output if the tool has an outputSchema. + * + * @example + * ```typescript + * const stream = client.experimental.tasks.callToolStream({ name: 'myTool', arguments: {} }); + * for await (const message of stream) { + * switch (message.type) { + * case 'taskCreated': + * console.log('Tool execution started:', message.task.taskId); + * break; + * case 'taskStatus': + * console.log('Tool status:', message.task.status); + * break; + * case 'result': + * console.log('Tool result:', message.result); + * break; + * case 'error': + * console.error('Tool error:', message.error); + * break; + * } + * } + * ``` + * + * @param params - Tool call parameters (name and arguments) + * @param resultSchema - Zod schema for validating the result (defaults to CallToolResultSchema) + * @param options - Optional request options (timeout, signal, task creation params, etc.) + * @returns AsyncGenerator that yields ResponseMessage objects + * + * @experimental + */ + async *callToolStream(params, resultSchema = CallToolResultSchema, options) { + // Access Client's internal methods + const clientInternal = this._client; + // Add task creation parameters if server supports it and not explicitly provided + const optionsWithTask = { + ...options, + // We check if the tool is known to be a task during auto-configuration, but assume + // the caller knows what they're doing if they pass this explicitly + task: options?.task ?? (clientInternal.isToolTask(params.name) ? {} : undefined) + }; + const stream = clientInternal.requestStream({ method: 'tools/call', params }, resultSchema, optionsWithTask); + // Get the validator for this tool (if it has an output schema) + const validator = clientInternal.getToolOutputValidator(params.name); + // Iterate through the stream and validate the final result if needed + for await (const message of stream) { + // If this is a result message and the tool has an output schema, validate it + if (message.type === 'result' && validator) { + const result = message.result; + // If tool has outputSchema, it MUST return structuredContent (unless it's an error) + if (!result.structuredContent && !result.isError) { + yield { + type: 'error', + error: new McpError(ErrorCode.InvalidRequest, `Tool ${params.name} has an output schema but did not return structured content`) + }; + return; + } + // Only validate structured content if present (not when there's an error) + if (result.structuredContent) { + try { + // Validate the structured content against the schema + const validationResult = validator(result.structuredContent); + if (!validationResult.valid) { + yield { + type: 'error', + error: new McpError(ErrorCode.InvalidParams, `Structured content does not match the tool's output schema: ${validationResult.errorMessage}`) + }; + return; + } + } + catch (error) { + if (error instanceof McpError) { + yield { type: 'error', error }; + return; + } + yield { + type: 'error', + error: new McpError(ErrorCode.InvalidParams, `Failed to validate structured content: ${error instanceof Error ? error.message : String(error)}`) + }; + return; + } + } + } + // Yield the message (either validated result or any other message type) + yield message; + } + } + /** + * Gets the current status of a task. + * + * @param taskId - The task identifier + * @param options - Optional request options + * @returns The task status + * + * @experimental + */ + async getTask(taskId, options) { + return this._client.getTask({ taskId }, options); + } + /** + * Retrieves the result of a completed task. + * + * @param taskId - The task identifier + * @param resultSchema - Zod schema for validating the result + * @param options - Optional request options + * @returns The task result + * + * @experimental + */ + async getTaskResult(taskId, resultSchema, options) { + // Delegate to the client's underlying Protocol method + return this._client.getTaskResult({ taskId }, resultSchema, options); + } + /** + * Lists tasks with optional pagination. + * + * @param cursor - Optional pagination cursor + * @param options - Optional request options + * @returns List of tasks with optional next cursor + * + * @experimental + */ + async listTasks(cursor, options) { + // Delegate to the client's underlying Protocol method + return this._client.listTasks(cursor ? { cursor } : undefined, options); + } + /** + * Cancels a running task. + * + * @param taskId - The task identifier + * @param options - Optional request options + * + * @experimental + */ + async cancelTask(taskId, options) { + // Delegate to the client's underlying Protocol method + return this._client.cancelTask({ taskId }, options); + } + /** + * Sends a request and returns an AsyncGenerator that yields response messages. + * The generator is guaranteed to end with either a 'result' or 'error' message. + * + * This method provides streaming access to request processing, allowing you to + * observe intermediate task status updates for task-augmented requests. + * + * @param request - The request to send + * @param resultSchema - Zod schema for validating the result + * @param options - Optional request options (timeout, signal, task creation params, etc.) + * @returns AsyncGenerator that yields ResponseMessage objects + * + * @experimental + */ + requestStream(request, resultSchema, options) { + return this._client.requestStream(request, resultSchema, options); + } +} +//# sourceMappingURL=client.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ae79ccfdce33dd76e5472618619b55e8a6ca0ea7 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/client.js.map @@ -0,0 +1 @@ +{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../../src/experimental/tasks/client.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,OAAO,EAAE,oBAAoB,EAA0C,QAAQ,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAkBnH;;;;;;;;;;GAUG;AACH,MAAM,OAAO,uBAAuB;IAKhC,YAA6B,OAAiD;QAAjD,YAAO,GAAP,OAAO,CAA0C;IAAG,CAAC;IAElF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,KAAK,CAAC,CAAC,cAAc,CACjB,MAAiC,EACjC,eAAkB,oBAAyB,EAC3C,OAAwB;QAExB,mCAAmC;QACnC,MAAM,cAAc,GAAG,IAAI,CAAC,OAA8C,CAAC;QAE3E,iFAAiF;QACjF,MAAM,eAAe,GAAG;YACpB,GAAG,OAAO;YACV,mFAAmF;YACnF,mEAAmE;YACnE,IAAI,EAAE,OAAO,EAAE,IAAI,IAAI,CAAC,cAAc,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;SACnF,CAAC;QAEF,MAAM,MAAM,GAAG,cAAc,CAAC,aAAa,CAAC,EAAE,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C,aAAa,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;IAC9G,CAAC;CACJ"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..f5e505f816496f0abebe62215e50a1c3d0f48a32 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.d.ts @@ -0,0 +1,47 @@ +/** + * Experimental task capability assertion helpers. + * WARNING: These APIs are experimental and may change without notice. + * + * @experimental + */ +/** + * Type representing the task requests capability structure. + * This is derived from ClientTasksCapability.requests and ServerTasksCapability.requests. + */ +interface TaskRequestsCapability { + tools?: { + call?: object; + }; + sampling?: { + createMessage?: object; + }; + elicitation?: { + create?: object; + }; +} +/** + * Asserts that task creation is supported for tools/call. + * Used by Client.assertTaskCapability and Server.assertTaskHandlerCapability. + * + * @param requests - The task requests capability object + * @param method - The method being checked + * @param entityName - 'Server' or 'Client' for error messages + * @throws Error if the capability is not supported + * + * @experimental + */ +export declare function assertToolsCallTaskCapability(requests: TaskRequestsCapability | undefined, method: string, entityName: 'Server' | 'Client'): void; +/** + * Asserts that task creation is supported for sampling/createMessage or elicitation/create. + * Used by Server.assertTaskCapability and Client.assertTaskHandlerCapability. + * + * @param requests - The task requests capability object + * @param method - The method being checked + * @param entityName - 'Server' or 'Client' for error messages + * @throws Error if the capability is not supported + * + * @experimental + */ +export declare function assertClientRequestTaskCapability(requests: TaskRequestsCapability | undefined, method: string, entityName: 'Server' | 'Client'): void; +export {}; +//# sourceMappingURL=helpers.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..99dc903432a37d62d2211357bca0b117a60b8d96 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../src/experimental/tasks/helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,UAAU,sBAAsB;IAC5B,KAAK,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACtC,WAAW,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACrC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,6BAA6B,CACzC,QAAQ,EAAE,sBAAsB,GAAG,SAAS,EAC5C,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,QAAQ,GAAG,QAAQ,GAChC,IAAI,CAgBN;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iCAAiC,CAC7C,QAAQ,EAAE,sBAAsB,GAAG,SAAS,EAC5C,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,QAAQ,GAAG,QAAQ,GAChC,IAAI,CAsBN"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js new file mode 100644 index 0000000000000000000000000000000000000000..38800311d910c9b6737c3fd87676857f9111c9c6 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js @@ -0,0 +1,64 @@ +/** + * Experimental task capability assertion helpers. + * WARNING: These APIs are experimental and may change without notice. + * + * @experimental + */ +/** + * Asserts that task creation is supported for tools/call. + * Used by Client.assertTaskCapability and Server.assertTaskHandlerCapability. + * + * @param requests - The task requests capability object + * @param method - The method being checked + * @param entityName - 'Server' or 'Client' for error messages + * @throws Error if the capability is not supported + * + * @experimental + */ +export function assertToolsCallTaskCapability(requests, method, entityName) { + if (!requests) { + throw new Error(`${entityName} does not support task creation (required for ${method})`); + } + switch (method) { + case 'tools/call': + if (!requests.tools?.call) { + throw new Error(`${entityName} does not support task creation for tools/call (required for ${method})`); + } + break; + default: + // Method doesn't support tasks, which is fine - no error + break; + } +} +/** + * Asserts that task creation is supported for sampling/createMessage or elicitation/create. + * Used by Server.assertTaskCapability and Client.assertTaskHandlerCapability. + * + * @param requests - The task requests capability object + * @param method - The method being checked + * @param entityName - 'Server' or 'Client' for error messages + * @throws Error if the capability is not supported + * + * @experimental + */ +export function assertClientRequestTaskCapability(requests, method, entityName) { + if (!requests) { + throw new Error(`${entityName} does not support task creation (required for ${method})`); + } + switch (method) { + case 'sampling/createMessage': + if (!requests.sampling?.createMessage) { + throw new Error(`${entityName} does not support task creation for sampling/createMessage (required for ${method})`); + } + break; + case 'elicitation/create': + if (!requests.elicitation?.create) { + throw new Error(`${entityName} does not support task creation for elicitation/create (required for ${method})`); + } + break; + default: + // Method doesn't support tasks, which is fine - no error + break; + } +} +//# sourceMappingURL=helpers.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js.map new file mode 100644 index 0000000000000000000000000000000000000000..0cb1d79d3ccd824d0fa0e5737c9f408d48ccda50 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../../../src/experimental/tasks/helpers.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAYH;;;;;;;;;;GAUG;AACH,MAAM,UAAU,6BAA6B,CACzC,QAA4C,EAC5C,MAAc,EACd,UAA+B;IAE/B,IAAI,CAAC,QAAQ,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,GAAG,UAAU,iDAAiD,MAAM,GAAG,CAAC,CAAC;IAC7F,CAAC;IAED,QAAQ,MAAM,EAAE,CAAC;QACb,KAAK,YAAY;YACb,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC;gBACxB,MAAM,IAAI,KAAK,CAAC,GAAG,UAAU,gEAAgE,MAAM,GAAG,CAAC,CAAC;YAC5G,CAAC;YACD,MAAM;QAEV;YACI,yDAAyD;YACzD,MAAM;IACd,CAAC;AACL,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iCAAiC,CAC7C,QAA4C,EAC5C,MAAc,EACd,UAA+B;IAE/B,IAAI,CAAC,QAAQ,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,GAAG,UAAU,iDAAiD,MAAM,GAAG,CAAC,CAAC;IAC7F,CAAC;IAED,QAAQ,MAAM,EAAE,CAAC;QACb,KAAK,wBAAwB;YACzB,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,aAAa,EAAE,CAAC;gBACpC,MAAM,IAAI,KAAK,CAAC,GAAG,UAAU,4EAA4E,MAAM,GAAG,CAAC,CAAC;YACxH,CAAC;YACD,MAAM;QAEV,KAAK,oBAAoB;YACrB,IAAI,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,CAAC;gBAChC,MAAM,IAAI,KAAK,CAAC,GAAG,UAAU,wEAAwE,MAAM,GAAG,CAAC,CAAC;YACpH,CAAC;YACD,MAAM;QAEV;YACI,yDAAyD;YACzD,MAAM;IACd,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/index.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..33ab7916936bd78b0913cc6e04a7ec0a4be9dbc7 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/index.d.ts @@ -0,0 +1,16 @@ +/** + * Experimental task features for MCP SDK. + * WARNING: These APIs are experimental and may change without notice. + * + * @experimental + */ +export * from './types.js'; +export * from './interfaces.js'; +export * from './helpers.js'; +export * from './client.js'; +export * from './server.js'; +export * from './mcp-server.js'; +export * from './stores/in-memory.js'; +export type { ResponseMessage, TaskStatusMessage, TaskCreatedMessage, ResultMessage, ErrorMessage, BaseResponseMessage } from '../../shared/responseMessage.js'; +export { takeResult, toArrayAsync } from '../../shared/responseMessage.js'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/index.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..cf117ed5fbdf77e3345daab312698c9946d4ef25 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/experimental/tasks/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,YAAY,CAAC;AAG3B,cAAc,iBAAiB,CAAC;AAGhC,cAAc,cAAc,CAAC;AAG7B,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAGhC,cAAc,uBAAuB,CAAC;AAGtC,YAAY,EACR,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,aAAa,EACb,YAAY,EACZ,mBAAmB,EACtB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/index.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/index.js new file mode 100644 index 0000000000000000000000000000000000000000..aaa84f511847ad7586c8779c6a80eb94f6951ab0 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/index.js @@ -0,0 +1,20 @@ +/** + * Experimental task features for MCP SDK. + * WARNING: These APIs are experimental and may change without notice. + * + * @experimental + */ +// Re-export spec types for convenience +export * from './types.js'; +// SDK implementation interfaces +export * from './interfaces.js'; +// Assertion helpers +export * from './helpers.js'; +// Wrapper classes +export * from './client.js'; +export * from './server.js'; +export * from './mcp-server.js'; +// Store implementations +export * from './stores/in-memory.js'; +export { takeResult, toArrayAsync } from '../../shared/responseMessage.js'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/index.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a01409c78798e05c5534fbb75f21776aa58c112a --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/experimental/tasks/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,uCAAuC;AACvC,cAAc,YAAY,CAAC;AAE3B,gCAAgC;AAChC,cAAc,iBAAiB,CAAC;AAEhC,oBAAoB;AACpB,cAAc,cAAc,CAAC;AAE7B,kBAAkB;AAClB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAEhC,wBAAwB;AACxB,cAAc,uBAAuB,CAAC;AAWtC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b0bb9895caf1e40cec519a238a392a1047583931 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.d.ts @@ -0,0 +1,232 @@ +/** + * Experimental task interfaces for MCP SDK. + * WARNING: These APIs are experimental and may change without notice. + */ +import { Task, RequestId, Result, JSONRPCRequest, JSONRPCNotification, JSONRPCResultResponse, JSONRPCErrorResponse, ServerRequest, ServerNotification, CallToolResult, GetTaskResult, ToolExecution, Request } from '../../types.js'; +import { CreateTaskResult } from './types.js'; +import type { RequestHandlerExtra, RequestTaskStore } from '../../shared/protocol.js'; +import type { ZodRawShapeCompat, AnySchema, ShapeOutput } from '../../server/zod-compat.js'; +/** + * Extended handler extra with task store for task creation. + * @experimental + */ +export interface CreateTaskRequestHandlerExtra extends RequestHandlerExtra { + taskStore: RequestTaskStore; +} +/** + * Extended handler extra with task ID and store for task operations. + * @experimental + */ +export interface TaskRequestHandlerExtra extends RequestHandlerExtra { + taskId: string; + taskStore: RequestTaskStore; +} +/** + * Base callback type for tool handlers. + * @experimental + */ +export type BaseToolCallback, Args extends undefined | ZodRawShapeCompat | AnySchema = undefined> = Args extends ZodRawShapeCompat ? (args: ShapeOutput, extra: ExtraT) => SendResultT | Promise : Args extends AnySchema ? (args: unknown, extra: ExtraT) => SendResultT | Promise : (extra: ExtraT) => SendResultT | Promise; +/** + * Handler for creating a task. + * @experimental + */ +export type CreateTaskRequestHandler = BaseToolCallback; +/** + * Handler for task operations (get, getResult). + * @experimental + */ +export type TaskRequestHandler = BaseToolCallback; +/** + * Interface for task-based tool handlers. + * @experimental + */ +export interface ToolTaskHandler { + createTask: CreateTaskRequestHandler; + getTask: TaskRequestHandler; + getTaskResult: TaskRequestHandler; +} +/** + * Task-specific execution configuration. + * taskSupport cannot be 'forbidden' for task-based tools. + * @experimental + */ +export type TaskToolExecution = Omit & { + taskSupport: TaskSupport extends 'forbidden' | undefined ? never : TaskSupport; +}; +/** + * Represents a message queued for side-channel delivery via tasks/result. + * + * This is a serializable data structure that can be stored in external systems. + * All fields are JSON-serializable. + */ +export type QueuedMessage = QueuedRequest | QueuedNotification | QueuedResponse | QueuedError; +export interface BaseQueuedMessage { + /** Type of message */ + type: string; + /** When the message was queued (milliseconds since epoch) */ + timestamp: number; +} +export interface QueuedRequest extends BaseQueuedMessage { + type: 'request'; + /** The actual JSONRPC request */ + message: JSONRPCRequest; +} +export interface QueuedNotification extends BaseQueuedMessage { + type: 'notification'; + /** The actual JSONRPC notification */ + message: JSONRPCNotification; +} +export interface QueuedResponse extends BaseQueuedMessage { + type: 'response'; + /** The actual JSONRPC response */ + message: JSONRPCResultResponse; +} +export interface QueuedError extends BaseQueuedMessage { + type: 'error'; + /** The actual JSONRPC error */ + message: JSONRPCErrorResponse; +} +/** + * Interface for managing per-task FIFO message queues. + * + * Similar to TaskStore, this allows pluggable queue implementations + * (in-memory, Redis, other distributed queues, etc.). + * + * Each method accepts taskId and optional sessionId parameters to enable + * a single queue instance to manage messages for multiple tasks, with + * isolation based on task ID and session ID. + * + * All methods are async to support external storage implementations. + * All data in QueuedMessage must be JSON-serializable. + * + * @experimental + */ +export interface TaskMessageQueue { + /** + * Adds a message to the end of the queue for a specific task. + * Atomically checks queue size and throws if maxSize would be exceeded. + * @param taskId The task identifier + * @param message The message to enqueue + * @param sessionId Optional session ID for binding the operation to a specific session + * @param maxSize Optional maximum queue size - if specified and queue is full, throws an error + * @throws Error if maxSize is specified and would be exceeded + */ + enqueue(taskId: string, message: QueuedMessage, sessionId?: string, maxSize?: number): Promise; + /** + * Removes and returns the first message from the queue for a specific task. + * @param taskId The task identifier + * @param sessionId Optional session ID for binding the query to a specific session + * @returns The first message, or undefined if the queue is empty + */ + dequeue(taskId: string, sessionId?: string): Promise; + /** + * Removes and returns all messages from the queue for a specific task. + * Used when tasks are cancelled or failed to clean up pending messages. + * @param taskId The task identifier + * @param sessionId Optional session ID for binding the query to a specific session + * @returns Array of all messages that were in the queue + */ + dequeueAll(taskId: string, sessionId?: string): Promise; +} +/** + * Task creation options. + * @experimental + */ +export interface CreateTaskOptions { + /** + * Time in milliseconds to keep task results available after completion. + * If null, the task has unlimited lifetime until manually cleaned up. + */ + ttl?: number | null; + /** + * Time in milliseconds to wait between task status requests. + */ + pollInterval?: number; + /** + * Additional context to pass to the task store. + */ + context?: Record; +} +/** + * Interface for storing and retrieving task state and results. + * + * Similar to Transport, this allows pluggable task storage implementations + * (in-memory, database, distributed cache, etc.). + * + * @experimental + */ +export interface TaskStore { + /** + * Creates a new task with the given creation parameters and original request. + * The implementation must generate a unique taskId and createdAt timestamp. + * + * TTL Management: + * - The implementation receives the TTL suggested by the requestor via taskParams.ttl + * - The implementation MAY override the requested TTL (e.g., to enforce limits) + * - The actual TTL used MUST be returned in the Task object + * - Null TTL indicates unlimited task lifetime (no automatic cleanup) + * - Cleanup SHOULD occur automatically after TTL expires, regardless of task status + * + * @param taskParams - The task creation parameters from the request (ttl, pollInterval) + * @param requestId - The JSON-RPC request ID + * @param request - The original request that triggered task creation + * @param sessionId - Optional session ID for binding the task to a specific session + * @returns The created task object + */ + createTask(taskParams: CreateTaskOptions, requestId: RequestId, request: Request, sessionId?: string): Promise; + /** + * Gets the current status of a task. + * + * @param taskId - The task identifier + * @param sessionId - Optional session ID for binding the query to a specific session + * @returns The task object, or null if it does not exist + */ + getTask(taskId: string, sessionId?: string): Promise; + /** + * Stores the result of a task and sets its final status. + * + * @param taskId - The task identifier + * @param status - The final status: 'completed' for success, 'failed' for errors + * @param result - The result to store + * @param sessionId - Optional session ID for binding the operation to a specific session + */ + storeTaskResult(taskId: string, status: 'completed' | 'failed', result: Result, sessionId?: string): Promise; + /** + * Retrieves the stored result of a task. + * + * @param taskId - The task identifier + * @param sessionId - Optional session ID for binding the query to a specific session + * @returns The stored result + */ + getTaskResult(taskId: string, sessionId?: string): Promise; + /** + * Updates a task's status (e.g., to 'cancelled', 'failed', 'completed'). + * + * @param taskId - The task identifier + * @param status - The new status + * @param statusMessage - Optional diagnostic message for failed tasks or other status information + * @param sessionId - Optional session ID for binding the operation to a specific session + */ + updateTaskStatus(taskId: string, status: Task['status'], statusMessage?: string, sessionId?: string): Promise; + /** + * Lists tasks, optionally starting from a pagination cursor. + * + * @param cursor - Optional cursor for pagination + * @param sessionId - Optional session ID for binding the query to a specific session + * @returns An object containing the tasks array and an optional nextCursor + */ + listTasks(cursor?: string, sessionId?: string): Promise<{ + tasks: Task[]; + nextCursor?: string; + }>; +} +/** + * Checks if a task status represents a terminal state. + * Terminal states are those where the task has finished and will not change. + * + * @param status - The task status to check + * @returns True if the status is terminal (completed, failed, or cancelled) + * @experimental + */ +export declare function isTerminal(status: Task['status']): boolean; +//# sourceMappingURL=interfaces.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..afd1d70b06997f4d96a334b28e94fc9c7c321a29 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../src/experimental/tasks/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACH,IAAI,EACJ,SAAS,EACT,MAAM,EACN,cAAc,EACd,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,aAAa,EACb,OAAO,EACV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB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AAW,GAAG,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEnH;;;;;;OAMG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAEnE;;;;;;;OAOG;IACH,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEpH;;;;;;OAMG;IACH,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACnG;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,OAAO,CAE1D"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js new file mode 100644 index 0000000000000000000000000000000000000000..d4949de6563da7c5369835a67e5460f2c53f9a27 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js @@ -0,0 +1,16 @@ +/** + * Experimental task interfaces for MCP SDK. + * WARNING: These APIs are experimental and may change without notice. + */ +/** + * Checks if a task status represents a terminal state. + * Terminal states are those where the task has finished and will not change. + * + * @param status - The task status to check + * @returns True if the status is terminal (completed, failed, or cancelled) + * @experimental + */ +export function isTerminal(status) { + return status === 'completed' || status === 'failed' || status === 'cancelled'; +} +//# sourceMappingURL=interfaces.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js.map new file mode 100644 index 0000000000000000000000000000000000000000..c298990296f93bf0f64817bf2010309122047f51 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js.map @@ -0,0 +1 @@ +{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../src/experimental/tasks/interfaces.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAmRH;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAC,MAAsB;IAC7C,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,WAAW,CAAC;AACnF,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b3244f9d6811cdc419ac94013ea5754a55b22d43 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.d.ts @@ -0,0 +1,77 @@ +/** + * Experimental McpServer task features for MCP SDK. + * WARNING: These APIs are experimental and may change without notice. + * + * @experimental + */ +import type { McpServer, RegisteredTool } from '../../server/mcp.js'; +import type { ZodRawShapeCompat, AnySchema } from '../../server/zod-compat.js'; +import type { ToolAnnotations } from '../../types.js'; +import type { ToolTaskHandler, TaskToolExecution } from './interfaces.js'; +/** + * Experimental task features for McpServer. + * + * Access via `server.experimental.tasks`: + * ```typescript + * server.experimental.tasks.registerToolTask('long-running', config, handler); + * ``` + * + * @experimental + */ +export declare class ExperimentalMcpServerTasks { + private readonly _mcpServer; + constructor(_mcpServer: McpServer); + /** + * Registers a task-based tool with a config object and handler. + * + * Task-based tools support long-running operations that can be polled for status + * and results. The handler must implement `createTask`, `getTask`, and `getTaskResult` + * methods. + * + * @example + * ```typescript + * server.experimental.tasks.registerToolTask('long-computation', { + * description: 'Performs a long computation', + * inputSchema: { input: z.string() }, + * execution: { taskSupport: 'required' } + * }, { + * createTask: async (args, extra) => { + * const task = await extra.taskStore.createTask({ ttl: 300000 }); + * startBackgroundWork(task.taskId, args); + * return { task }; + * }, + * getTask: async (args, extra) => { + * return extra.taskStore.getTask(extra.taskId); + * }, + * getTaskResult: async (args, extra) => { + * return extra.taskStore.getTaskResult(extra.taskId); + * } + * }); + * ``` + * + * @param name - The tool name + * @param config - Tool configuration (description, schemas, etc.) + * @param handler - Task handler with createTask, getTask, getTaskResult methods + * @returns RegisteredTool for managing the tool's lifecycle + * + * @experimental + */ + registerToolTask(name: string, config: { + title?: string; + description?: string; + outputSchema?: OutputArgs; + annotations?: ToolAnnotations; + execution?: TaskToolExecution; + _meta?: Record; + }, handler: ToolTaskHandler): RegisteredTool; + registerToolTask(name: string, config: { + title?: string; + description?: string; + inputSchema: InputArgs; + outputSchema?: OutputArgs; + annotations?: ToolAnnotations; + execution?: TaskToolExecution; + _meta?: Record; + }, handler: ToolTaskHandler): RegisteredTool; +} +//# sourceMappingURL=mcp-server.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..84ee9e08d18c277525f2c8635582130457083814 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../../../../src/experimental/tasks/mcp-server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAA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AM,EAAE,OAAO,CAAC,CAAC;KACnC,EACD,OAAO,EAAE,eAAe,CAAC,SAAS,CAAC,GACpC,cAAc;CAsCpB"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js new file mode 100644 index 0000000000000000000000000000000000000000..39b9d10823e1a288513acfabe4f31a39a757720b --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js @@ -0,0 +1,32 @@ +/** + * Experimental McpServer task features for MCP SDK. + * WARNING: These APIs are experimental and may change without notice. + * + * @experimental + */ +/** + * Experimental task features for McpServer. + * + * Access via `server.experimental.tasks`: + * ```typescript + * server.experimental.tasks.registerToolTask('long-running', config, handler); + * ``` + * + * @experimental + */ +export class ExperimentalMcpServerTasks { + constructor(_mcpServer) { + this._mcpServer = _mcpServer; + } + registerToolTask(name, config, handler) { + // Validate that taskSupport is not 'forbidden' for task-based tools + const execution = { taskSupport: 'required', ...config.execution }; + if (execution.taskSupport === 'forbidden') { + throw new Error(`Cannot register task-based tool '${name}' with taskSupport 'forbidden'. Use registerTool() instead.`); + } + // Access McpServer's internal _createRegisteredTool method + const mcpServerInternal = this._mcpServer; + return mcpServerInternal._createRegisteredTool(name, config.title, config.description, config.inputSchema, config.outputSchema, config.annotations, execution, config._meta, handler); + } +} +//# sourceMappingURL=mcp-server.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js.map new file mode 100644 index 0000000000000000000000000000000000000000..c01a314c96fd354c98f9330d84ace94db749faff --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../../../../src/experimental/tasks/mcp-server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAyBH;;;;;;;;;GASG;AACH,MAAM,OAAO,0BAA0B;IACnC,YAA6B,UAAqB;QAArB,eAAU,GAAV,UAAU,CAAW;IAAG,CAAC;IAgEtD,gBAAgB,CAIZ,IAAY,EACZ,MAQC,EACD,OAAmC;QAEnC,oEAAoE;QACpE,MAAM,SAAS,GAAkB,EAAE,WAAW,EAAE,UAAU,EAAE,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;QAClF,IAAI,SAAS,CAAC,WAAW,KAAK,WAAW,EAAE,CAAC;YACxC,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,6DAA6D,CAAC,CAAC;QAC3H,CAAC;QAED,2DAA2D;QAC3D,MAAM,iBAAiB,GAAG,IAAI,CAAC,UAA0C,CAAC;QAC1E,OAAO,iBAAiB,CAAC,qBAAqB,CAC1C,IAAI,EACJ,MAAM,CAAC,KAAK,EACZ,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,WAAW,EAClB,MAAM,CAAC,YAAY,EACnB,MAAM,CAAC,WAAW,EAClB,SAAS,EACT,MAAM,CAAC,KAAK,EACZ,OAAwD,CAC3D,CAAC;IACN,CAAC;CACJ"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..45ac3d65e0c9547599dd7c78116fa97d5da29f94 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.d.ts @@ -0,0 +1,170 @@ +/** + * Experimental server task features for MCP SDK. + * WARNING: These APIs are experimental and may change without notice. + * + * @experimental + */ +import type { Server } from '../../server/index.js'; +import type { RequestOptions } from '../../shared/protocol.js'; +import type { ResponseMessage } from '../../shared/responseMessage.js'; +import type { AnySchema, SchemaOutput } from '../../server/zod-compat.js'; +import type { ServerRequest, Notification, Request, Result, GetTaskResult, ListTasksResult, CancelTaskResult, CreateMessageRequestParams, CreateMessageResult, ElicitRequestFormParams, ElicitRequestURLParams, ElicitResult } from '../../types.js'; +/** + * Experimental task features for low-level MCP servers. + * + * Access via `server.experimental.tasks`: + * ```typescript + * const stream = server.experimental.tasks.requestStream(request, schema, options); + * ``` + * + * For high-level server usage with task-based tools, use `McpServer.experimental.tasks` instead. + * + * @experimental + */ +export declare class ExperimentalServerTasks { + private readonly _server; + constructor(_server: Server); + /** + * Sends a request and returns an AsyncGenerator that yields response messages. + * The generator is guaranteed to end with either a 'result' or 'error' message. + * + * This method provides streaming access to request processing, allowing you to + * observe intermediate task status updates for task-augmented requests. + * + * @param request - The request to send + * @param resultSchema - Zod schema for validating the result + * @param options - Optional request options (timeout, signal, task creation params, etc.) + * @returns AsyncGenerator that yields ResponseMessage objects + * + * @experimental + */ + requestStream(request: ServerRequest | RequestT, resultSchema: T, options?: RequestOptions): AsyncGenerator>, void, void>; + /** + * Sends a sampling request and returns an AsyncGenerator that yields response messages. + * The generator is guaranteed to end with either a 'result' or 'error' message. + * + * For task-augmented requests, yields 'taskCreated' and 'taskStatus' messages + * before the final result. + * + * @example + * ```typescript + * const stream = server.experimental.tasks.createMessageStream({ + * messages: [{ role: 'user', content: { type: 'text', text: 'Hello' } }], + * maxTokens: 100 + * }, { + * onprogress: (progress) => { + * // Handle streaming tokens via progress notifications + * console.log('Progress:', progress.message); + * } + * }); + * + * for await (const message of stream) { + * switch (message.type) { + * case 'taskCreated': + * console.log('Task created:', message.task.taskId); + * break; + * case 'taskStatus': + * console.log('Task status:', message.task.status); + * break; + * case 'result': + * console.log('Final result:', message.result); + * break; + * case 'error': + * console.error('Error:', message.error); + * break; + * } + * } + * ``` + * + * @param params - The sampling request parameters + * @param options - Optional request options (timeout, signal, task creation params, onprogress, etc.) + * @returns AsyncGenerator that yields ResponseMessage objects + * + * @experimental + */ + createMessageStream(params: CreateMessageRequestParams, options?: RequestOptions): AsyncGenerator, void, void>; + /** + * Sends an elicitation request and returns an AsyncGenerator that yields response messages. + * The generator is guaranteed to end with either a 'result' or 'error' message. + * + * For task-augmented requests (especially URL-based elicitation), yields 'taskCreated' + * and 'taskStatus' messages before the final result. + * + * @example + * ```typescript + * const stream = server.experimental.tasks.elicitInputStream({ + * mode: 'url', + * message: 'Please authenticate', + * elicitationId: 'auth-123', + * url: 'https://example.com/auth' + * }, { + * task: { ttl: 300000 } // Task-augmented for long-running auth flow + * }); + * + * for await (const message of stream) { + * switch (message.type) { + * case 'taskCreated': + * console.log('Task created:', message.task.taskId); + * break; + * case 'taskStatus': + * console.log('Task status:', message.task.status); + * break; + * case 'result': + * console.log('User action:', message.result.action); + * break; + * case 'error': + * console.error('Error:', message.error); + * break; + * } + * } + * ``` + * + * @param params - The elicitation request parameters + * @param options - Optional request options (timeout, signal, task creation params, etc.) + * @returns AsyncGenerator that yields ResponseMessage objects + * + * @experimental + */ + elicitInputStream(params: ElicitRequestFormParams | ElicitRequestURLParams, options?: RequestOptions): AsyncGenerator, void, void>; + /** + * Gets the current status of a task. + * + * @param taskId - The task identifier + * @param options - Optional request options + * @returns The task status + * + * @experimental + */ + getTask(taskId: string, options?: RequestOptions): Promise; + /** + * Retrieves the result of a completed task. + * + * @param taskId - The task identifier + * @param resultSchema - Zod schema for validating the result + * @param options - Optional request options + * @returns The task result + * + * @experimental + */ + getTaskResult(taskId: string, resultSchema?: T, options?: RequestOptions): Promise>; + /** + * Lists tasks with optional pagination. + * + * @param cursor - Optional pagination cursor + * @param options - Optional request options + * @returns List of tasks with optional next cursor + * + * @experimental + */ + listTasks(cursor?: string, options?: RequestOptions): Promise; + /** + * Cancels a running task. + * + * @param taskId - The task identifier + * @param options - Optional request options + * + * @experimental + */ + cancelTask(taskId: string, options?: RequestOptions): Promise; +} +//# sourceMappingURL=server.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..48c996bf2e55de748fa884717f822eb2cda70e2b --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../../src/experimental/tasks/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,KAAK,EACR,aAAa,EACb,YAAY,EACZ,OAAO,EACP,MAAM,EACN,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,0BAA0B,EAC1B,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,YAAY,EACf,MAAM,gBAAgB,CAAC;AAGxB;;;;;;;;;;;GAWG;AACH,qBAAa,uBAAuB,CAChC,QAAQ,SAAS,OAAO,GAAG,OAAO,EAClC,aAAa,SAAS,YAAY,GAAG,YAAY,EACjD,OAAO,SAAS,MAAM,GAAG,MAAM;IAEnB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,MAAM,CAAC,QAAQ,EAAE,aAAa,EAAE,OAAO,CAAC;IAE9E;;;;;;;;;;;;;OAaG;IACH,aAAa,CAAC,CAAC,SAAS,SAAS,EAC7B,OAAO,EAAE,aAAa,GAAG,QAAQ,EACjC,YAAY,EAAE,CAAC,EACf,OAAO,CAAC,EAAE,cAAc,GACzB,cAAc,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;IAY/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0CG;IACH,mBAAmB,CACf,MAAM,EAAE,0BAA0B,EAClC,OAAO,CAAC,EAAE,cAAc,GACzB,cAAc,CAAC,eAAe,CAAC,mBAAmB,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;IAuDnE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAyCG;IACH,iBAAiB,CACb,MAAM,EAAE,uBAAuB,GAAG,sBAAsB,EACxD,OAAO,CAAC,EAAE,cAAc,GACzB,cAAc,CAAC,eAAe,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC;IAoC5D;;;;;;;;OAQG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;IAK/E;;;;;;;;;OASG;IACG,aAAa,CAAC,CAAC,SAAS,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IAY9H;;;;;;;;OAQG;IACG,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IAQpF;;;;;;;OAOG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAOxF"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js new file mode 100644 index 0000000000000000000000000000000000000000..059ab7b172c3586582c67c6a2e826056a01a640d --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js @@ -0,0 +1,246 @@ +/** + * Experimental server task features for MCP SDK. + * WARNING: These APIs are experimental and may change without notice. + * + * @experimental + */ +import { CreateMessageResultSchema, ElicitResultSchema } from '../../types.js'; +/** + * Experimental task features for low-level MCP servers. + * + * Access via `server.experimental.tasks`: + * ```typescript + * const stream = server.experimental.tasks.requestStream(request, schema, options); + * ``` + * + * For high-level server usage with task-based tools, use `McpServer.experimental.tasks` instead. + * + * @experimental + */ +export class ExperimentalServerTasks { + constructor(_server) { + this._server = _server; + } + /** + * Sends a request and returns an AsyncGenerator that yields response messages. + * The generator is guaranteed to end with either a 'result' or 'error' message. + * + * This method provides streaming access to request processing, allowing you to + * observe intermediate task status updates for task-augmented requests. + * + * @param request - The request to send + * @param resultSchema - Zod schema for validating the result + * @param options - Optional request options (timeout, signal, task creation params, etc.) + * @returns AsyncGenerator that yields ResponseMessage objects + * + * @experimental + */ + requestStream(request, resultSchema, options) { + return this._server.requestStream(request, resultSchema, options); + } + /** + * Sends a sampling request and returns an AsyncGenerator that yields response messages. + * The generator is guaranteed to end with either a 'result' or 'error' message. + * + * For task-augmented requests, yields 'taskCreated' and 'taskStatus' messages + * before the final result. + * + * @example + * ```typescript + * const stream = server.experimental.tasks.createMessageStream({ + * messages: [{ role: 'user', content: { type: 'text', text: 'Hello' } }], + * maxTokens: 100 + * }, { + * onprogress: (progress) => { + * // Handle streaming tokens via progress notifications + * console.log('Progress:', progress.message); + * } + * }); + * + * for await (const message of stream) { + * switch (message.type) { + * case 'taskCreated': + * console.log('Task created:', message.task.taskId); + * break; + * case 'taskStatus': + * console.log('Task status:', message.task.status); + * break; + * case 'result': + * console.log('Final result:', message.result); + * break; + * case 'error': + * console.error('Error:', message.error); + * break; + * } + * } + * ``` + * + * @param params - The sampling request parameters + * @param options - Optional request options (timeout, signal, task creation params, onprogress, etc.) + * @returns AsyncGenerator that yields ResponseMessage objects + * + * @experimental + */ + createMessageStream(params, options) { + // Access client capabilities via the server + const clientCapabilities = this._server.getClientCapabilities(); + // Capability check - only required when tools/toolChoice are provided + if ((params.tools || params.toolChoice) && !clientCapabilities?.sampling?.tools) { + throw new Error('Client does not support sampling tools capability.'); + } + // Message structure validation - always validate tool_use/tool_result pairs. + // These may appear even without tools/toolChoice in the current request when + // a previous sampling request returned tool_use and this is a follow-up with results. + if (params.messages.length > 0) { + const lastMessage = params.messages[params.messages.length - 1]; + const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content]; + const hasToolResults = lastContent.some(c => c.type === 'tool_result'); + const previousMessage = params.messages.length > 1 ? params.messages[params.messages.length - 2] : undefined; + const previousContent = previousMessage + ? Array.isArray(previousMessage.content) + ? previousMessage.content + : [previousMessage.content] + : []; + const hasPreviousToolUse = previousContent.some(c => c.type === 'tool_use'); + if (hasToolResults) { + if (lastContent.some(c => c.type !== 'tool_result')) { + throw new Error('The last message must contain only tool_result content if any is present'); + } + if (!hasPreviousToolUse) { + throw new Error('tool_result blocks are not matching any tool_use from the previous message'); + } + } + if (hasPreviousToolUse) { + // Extract tool_use IDs from previous message and tool_result IDs from current message + const toolUseIds = new Set(previousContent.filter(c => c.type === 'tool_use').map(c => c.id)); + const toolResultIds = new Set(lastContent.filter(c => c.type === 'tool_result').map(c => c.toolUseId)); + if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every(id => toolResultIds.has(id))) { + throw new Error('ids of tool_result blocks and tool_use blocks from previous message do not match'); + } + } + } + return this.requestStream({ + method: 'sampling/createMessage', + params + }, CreateMessageResultSchema, options); + } + /** + * Sends an elicitation request and returns an AsyncGenerator that yields response messages. + * The generator is guaranteed to end with either a 'result' or 'error' message. + * + * For task-augmented requests (especially URL-based elicitation), yields 'taskCreated' + * and 'taskStatus' messages before the final result. + * + * @example + * ```typescript + * const stream = server.experimental.tasks.elicitInputStream({ + * mode: 'url', + * message: 'Please authenticate', + * elicitationId: 'auth-123', + * url: 'https://example.com/auth' + * }, { + * task: { ttl: 300000 } // Task-augmented for long-running auth flow + * }); + * + * for await (const message of stream) { + * switch (message.type) { + * case 'taskCreated': + * console.log('Task created:', message.task.taskId); + * break; + * case 'taskStatus': + * console.log('Task status:', message.task.status); + * break; + * case 'result': + * console.log('User action:', message.result.action); + * break; + * case 'error': + * console.error('Error:', message.error); + * break; + * } + * } + * ``` + * + * @param params - The elicitation request parameters + * @param options - Optional request options (timeout, signal, task creation params, etc.) + * @returns AsyncGenerator that yields ResponseMessage objects + * + * @experimental + */ + elicitInputStream(params, options) { + // Access client capabilities via the server + const clientCapabilities = this._server.getClientCapabilities(); + const mode = params.mode ?? 'form'; + // Capability check based on mode + switch (mode) { + case 'url': { + if (!clientCapabilities?.elicitation?.url) { + throw new Error('Client does not support url elicitation.'); + } + break; + } + case 'form': { + if (!clientCapabilities?.elicitation?.form) { + throw new Error('Client does not support form elicitation.'); + } + break; + } + } + // Normalize params to ensure mode is set for form mode (defaults to 'form' per spec) + const normalizedParams = mode === 'form' && params.mode === undefined ? { ...params, mode: 'form' } : params; + // Cast to ServerRequest needed because TypeScript can't narrow the union type + // based on the discriminated 'method' field when constructing the object literal + return this.requestStream({ + method: 'elicitation/create', + params: normalizedParams + }, ElicitResultSchema, options); + } + /** + * Gets the current status of a task. + * + * @param taskId - The task identifier + * @param options - Optional request options + * @returns The task status + * + * @experimental + */ + async getTask(taskId, options) { + return this._server.getTask({ taskId }, options); + } + /** + * Retrieves the result of a completed task. + * + * @param taskId - The task identifier + * @param resultSchema - Zod schema for validating the result + * @param options - Optional request options + * @returns The task result + * + * @experimental + */ + async getTaskResult(taskId, resultSchema, options) { + return this._server.getTaskResult({ taskId }, resultSchema, options); + } + /** + * Lists tasks with optional pagination. + * + * @param cursor - Optional pagination cursor + * @param options - Optional request options + * @returns List of tasks with optional next cursor + * + * @experimental + */ + async listTasks(cursor, options) { + return this._server.listTasks(cursor ? { cursor } : undefined, options); + } + /** + * Cancels a running task. + * + * @param taskId - The task identifier + * @param options - Optional request options + * + * @experimental + */ + async cancelTask(taskId, options) { + return this._server.cancelTask({ taskId }, options); + } +} +//# sourceMappingURL=server.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js.map new file mode 100644 index 0000000000000000000000000000000000000000..b38b163ecb5ed4b782b3bf06f61825499e80e4cc --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js.map @@ -0,0 +1 @@ +{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../../src/experimental/tasks/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAoBH,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAE/E;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,uBAAuB;IAKhC,YAA6B,OAAiD;QAAjD,YAAO,GAAP,OAAO,CAA0C;IAAG,CAAC;IAElF;;;;;;;;;;;;;OAaG;IACH,aAAa,CACT,OAAiC,EACjC,YAAe,EACf,OAAwB;QAUxB,OAAQ,IAAI,CAAC,OAA8C,CAAC,aAAa,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;IAC9G,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA0CG;IACH,mBAAmB,CACf,MAAkC,EAClC,OAAwB;QAExB,4CAA4C;QAC5C,MAAM,kBAAkB,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,CAAC;QAEhE,sEAAsE;QACtE,IAAI,CAAC,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,kBAAkB,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;YAC9E,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;QAC1E,CAAC;QAED,6EAA6E;QAC7E,6EAA6E;QAC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CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC1D,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,UAAU,CAAC,MAAc,EAAE,OAAwB;QACrD,OACI,IAAI,CAAC,OAGR,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;IACtC,CAAC;CACJ"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..d30795e30cb4cfad41070493871347652a2ebe98 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.d.ts @@ -0,0 +1,94 @@ +/** + * In-memory implementations of TaskStore and TaskMessageQueue. + * WARNING: These APIs are experimental and may change without notice. + * + * @experimental + */ +import { Task, RequestId, Result, Request } from '../../../types.js'; +import { TaskStore, TaskMessageQueue, QueuedMessage, CreateTaskOptions } from '../interfaces.js'; +/** + * A simple in-memory implementation of TaskStore for demonstration purposes. + * + * This implementation stores all tasks in memory and provides automatic cleanup + * based on the ttl duration specified in the task creation parameters. + * + * Note: This is not suitable for production use as all data is lost on restart. + * For production, consider implementing TaskStore with a database or distributed cache. + * + * @experimental + */ +export declare class InMemoryTaskStore implements TaskStore { + private tasks; + private cleanupTimers; + /** + * Generates a unique task ID. + * Uses 16 bytes of random data encoded as hex (32 characters). + */ + private generateTaskId; + createTask(taskParams: CreateTaskOptions, requestId: RequestId, request: Request, _sessionId?: string): Promise; + getTask(taskId: string, _sessionId?: string): Promise; + storeTaskResult(taskId: string, status: 'completed' | 'failed', result: Result, _sessionId?: string): Promise; + getTaskResult(taskId: string, _sessionId?: string): Promise; + updateTaskStatus(taskId: string, status: Task['status'], statusMessage?: string, _sessionId?: string): Promise; + listTasks(cursor?: string, _sessionId?: string): Promise<{ + tasks: Task[]; + nextCursor?: string; + }>; + /** + * Cleanup all timers (useful for testing or graceful shutdown) + */ + cleanup(): void; + /** + * Get all tasks (useful for debugging) + */ + getAllTasks(): Task[]; +} +/** + * A simple in-memory implementation of TaskMessageQueue for demonstration purposes. + * + * This implementation stores messages in memory, organized by task ID and optional session ID. + * Messages are stored in FIFO queues per task. + * + * Note: This is not suitable for production use in distributed systems. + * For production, consider implementing TaskMessageQueue with Redis or other distributed queues. + * + * @experimental + */ +export declare class InMemoryTaskMessageQueue implements TaskMessageQueue { + private queues; + /** + * Generates a queue key from taskId. + * SessionId is intentionally ignored because taskIds are globally unique + * and tasks need to be accessible across HTTP requests/sessions. + */ + private getQueueKey; + /** + * Gets or creates a queue for the given task and session. + */ + private getQueue; + /** + * Adds a message to the end of the queue for a specific task. + * Atomically checks queue size and throws if maxSize would be exceeded. + * @param taskId The task identifier + * @param message The message to enqueue + * @param sessionId Optional session ID for binding the operation to a specific session + * @param maxSize Optional maximum queue size - if specified and queue is full, throws an error + * @throws Error if maxSize is specified and would be exceeded + */ + enqueue(taskId: string, message: QueuedMessage, sessionId?: string, maxSize?: number): Promise; + /** + * Removes and returns the first message from the queue for a specific task. + * @param taskId The task identifier + * @param sessionId Optional session ID for binding the query to a specific session + * @returns The first message, or undefined if the queue is empty + */ + dequeue(taskId: string, sessionId?: string): Promise; + /** + * Removes and returns all messages from the queue for a specific task. + * @param taskId The task identifier + * @param sessionId Optional session ID for binding the query to a specific session + * @returns Array of all messages that were in the queue + */ + dequeueAll(taskId: string, sessionId?: string): Promise; +} +//# sourceMappingURL=in-memory.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..1825e8751d930035b9da182b51f26872a09bcecb --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"in-memory.d.ts","sourceRoot":"","sources":["../../../../../src/experimental/tasks/stores/in-memory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,SAAS,EAAc,gBAAgB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAU7G;;;;;;;;;;GAUG;AACH,qBAAa,iBAAkB,YAAW,SAAS;IAC/C,OAAO,CAAC,KAAK,CAAiC;IAC9C,OAAO,CAAC,aAAa,CAAoD;IAEzE;;;OAGG;IACH,OAAO,CAAC,cAAc;IAIhB,UAAU,CAAC,UAAU,EAAE,iBAAiB,EAAE,SAAS,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IA0CrH,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IAKlE,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,GAAG,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAiCnH,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAanE,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,EAAE,aAAa,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAoCpH,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IA0BtG;;OAEG;IACH,OAAO,IAAI,IAAI;IAQf;;OAEG;IACH,WAAW,IAAI,IAAI,EAAE;CAGxB;AAED;;;;;;;;;;GAUG;AACH,qBAAa,wBAAyB,YAAW,gBAAgB;IAC7D,OAAO,CAAC,MAAM,CAAsC;IAEpD;;;;OAIG;IACH,OAAO,CAAC,WAAW;IAInB;;OAEG;IACH,OAAO,CAAC,QAAQ;IAUhB;;;;;;;;OAQG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAW1G;;;;;OAKG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IAKrF;;;;;OAKG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;CAMjF"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.js new file mode 100644 index 0000000000000000000000000000000000000000..6458ec52ff74ca836c4d9caa3e29938ec7ac871a --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.js @@ -0,0 +1,246 @@ +/** + * In-memory implementations of TaskStore and TaskMessageQueue. + * WARNING: These APIs are experimental and may change without notice. + * + * @experimental + */ +import { isTerminal } from '../interfaces.js'; +import { randomBytes } from 'node:crypto'; +/** + * A simple in-memory implementation of TaskStore for demonstration purposes. + * + * This implementation stores all tasks in memory and provides automatic cleanup + * based on the ttl duration specified in the task creation parameters. + * + * Note: This is not suitable for production use as all data is lost on restart. + * For production, consider implementing TaskStore with a database or distributed cache. + * + * @experimental + */ +export class InMemoryTaskStore { + constructor() { + this.tasks = new Map(); + this.cleanupTimers = new Map(); + } + /** + * Generates a unique task ID. + * Uses 16 bytes of random data encoded as hex (32 characters). + */ + generateTaskId() { + return randomBytes(16).toString('hex'); + } + async createTask(taskParams, requestId, request, _sessionId) { + // Generate a unique task ID + const taskId = this.generateTaskId(); + // Ensure uniqueness + if (this.tasks.has(taskId)) { + throw new Error(`Task with ID ${taskId} already exists`); + } + const actualTtl = taskParams.ttl ?? null; + // Create task with generated ID and timestamps + const createdAt = new Date().toISOString(); + const task = { + taskId, + status: 'working', + ttl: actualTtl, + createdAt, + lastUpdatedAt: createdAt, + pollInterval: taskParams.pollInterval ?? 1000 + }; + this.tasks.set(taskId, { + task, + request, + requestId + }); + // Schedule cleanup if ttl is specified + // Cleanup occurs regardless of task status + if (actualTtl) { + const timer = setTimeout(() => { + this.tasks.delete(taskId); + this.cleanupTimers.delete(taskId); + }, actualTtl); + this.cleanupTimers.set(taskId, timer); + } + return task; + } + async getTask(taskId, _sessionId) { + const stored = this.tasks.get(taskId); + return stored ? { ...stored.task } : null; + } + async storeTaskResult(taskId, status, result, _sessionId) { + const stored = this.tasks.get(taskId); + if (!stored) { + throw new Error(`Task with ID ${taskId} not found`); + } + // Don't allow storing results for tasks already in terminal state + if (isTerminal(stored.task.status)) { + throw new Error(`Cannot store result for task ${taskId} in terminal status '${stored.task.status}'. Task results can only be stored once.`); + } + stored.result = result; + stored.task.status = status; + stored.task.lastUpdatedAt = new Date().toISOString(); + // Reset cleanup timer to start from now (if ttl is set) + if (stored.task.ttl) { + const existingTimer = this.cleanupTimers.get(taskId); + if (existingTimer) { + clearTimeout(existingTimer); + } + const timer = setTimeout(() => { + this.tasks.delete(taskId); + this.cleanupTimers.delete(taskId); + }, stored.task.ttl); + this.cleanupTimers.set(taskId, timer); + } + } + async getTaskResult(taskId, _sessionId) { + const stored = this.tasks.get(taskId); + if (!stored) { + throw new Error(`Task with ID ${taskId} not found`); + } + if (!stored.result) { + throw new Error(`Task ${taskId} has no result stored`); + } + return stored.result; + } + async updateTaskStatus(taskId, status, statusMessage, _sessionId) { + const stored = this.tasks.get(taskId); + if (!stored) { + throw new Error(`Task with ID ${taskId} not found`); + } + // Don't allow transitions from terminal states + if (isTerminal(stored.task.status)) { + throw new Error(`Cannot update task ${taskId} from terminal status '${stored.task.status}' to '${status}'. Terminal states (completed, failed, cancelled) cannot transition to other states.`); + } + stored.task.status = status; + if (statusMessage) { + stored.task.statusMessage = statusMessage; + } + stored.task.lastUpdatedAt = new Date().toISOString(); + // If task is in a terminal state and has ttl, start cleanup timer + if (isTerminal(status) && stored.task.ttl) { + const existingTimer = this.cleanupTimers.get(taskId); + if (existingTimer) { + clearTimeout(existingTimer); + } + const timer = setTimeout(() => { + this.tasks.delete(taskId); + this.cleanupTimers.delete(taskId); + }, stored.task.ttl); + this.cleanupTimers.set(taskId, timer); + } + } + async listTasks(cursor, _sessionId) { + const PAGE_SIZE = 10; + const allTaskIds = Array.from(this.tasks.keys()); + let startIndex = 0; + if (cursor) { + const cursorIndex = allTaskIds.indexOf(cursor); + if (cursorIndex >= 0) { + startIndex = cursorIndex + 1; + } + else { + // Invalid cursor - throw error + throw new Error(`Invalid cursor: ${cursor}`); + } + } + const pageTaskIds = allTaskIds.slice(startIndex, startIndex + PAGE_SIZE); + const tasks = pageTaskIds.map(taskId => { + const stored = this.tasks.get(taskId); + return { ...stored.task }; + }); + const nextCursor = startIndex + PAGE_SIZE < allTaskIds.length ? pageTaskIds[pageTaskIds.length - 1] : undefined; + return { tasks, nextCursor }; + } + /** + * Cleanup all timers (useful for testing or graceful shutdown) + */ + cleanup() { + for (const timer of this.cleanupTimers.values()) { + clearTimeout(timer); + } + this.cleanupTimers.clear(); + this.tasks.clear(); + } + /** + * Get all tasks (useful for debugging) + */ + getAllTasks() { + return Array.from(this.tasks.values()).map(stored => ({ ...stored.task })); + } +} +/** + * A simple in-memory implementation of TaskMessageQueue for demonstration purposes. + * + * This implementation stores messages in memory, organized by task ID and optional session ID. + * Messages are stored in FIFO queues per task. + * + * Note: This is not suitable for production use in distributed systems. + * For production, consider implementing TaskMessageQueue with Redis or other distributed queues. + * + * @experimental + */ +export class InMemoryTaskMessageQueue { + constructor() { + this.queues = new Map(); + } + /** + * Generates a queue key from taskId. + * SessionId is intentionally ignored because taskIds are globally unique + * and tasks need to be accessible across HTTP requests/sessions. + */ + getQueueKey(taskId, _sessionId) { + return taskId; + } + /** + * Gets or creates a queue for the given task and session. + */ + getQueue(taskId, sessionId) { + const key = this.getQueueKey(taskId, sessionId); + let queue = this.queues.get(key); + if (!queue) { + queue = []; + this.queues.set(key, queue); + } + return queue; + } + /** + * Adds a message to the end of the queue for a specific task. + * Atomically checks queue size and throws if maxSize would be exceeded. + * @param taskId The task identifier + * @param message The message to enqueue + * @param sessionId Optional session ID for binding the operation to a specific session + * @param maxSize Optional maximum queue size - if specified and queue is full, throws an error + * @throws Error if maxSize is specified and would be exceeded + */ + async enqueue(taskId, message, sessionId, maxSize) { + const queue = this.getQueue(taskId, sessionId); + // Atomically check size and enqueue + if (maxSize !== undefined && queue.length >= maxSize) { + throw new Error(`Task message queue overflow: queue size (${queue.length}) exceeds maximum (${maxSize})`); + } + queue.push(message); + } + /** + * Removes and returns the first message from the queue for a specific task. + * @param taskId The task identifier + * @param sessionId Optional session ID for binding the query to a specific session + * @returns The first message, or undefined if the queue is empty + */ + async dequeue(taskId, sessionId) { + const queue = this.getQueue(taskId, sessionId); + return queue.shift(); + } + /** + * Removes and returns all messages from the queue for a specific task. + * @param taskId The task identifier + * @param sessionId Optional session ID for binding the query to a specific session + * @returns Array of all messages that were in the queue + */ + async dequeueAll(taskId, sessionId) { + const key = this.getQueueKey(taskId, sessionId); + const queue = this.queues.get(key) ?? []; + this.queues.delete(key); + return queue; + } +} +//# sourceMappingURL=in-memory.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.js.map new file mode 100644 index 0000000000000000000000000000000000000000..12d754521f3f895c3879813960f90d394957855e --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/stores/in-memory.js.map @@ -0,0 +1 @@ +{"version":3,"file":"in-memory.js","sourceRoot":"","sources":["../../../../../src/experimental/tasks/stores/in-memory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAa,UAAU,EAAsD,MAAM,kBAAkB,CAAC;AAC7G,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAS1C;;;;;;;;;;GAUG;AACH,MAAM,OAAO,iBAAiB;IAA9B;QACY,UAAK,GAAG,IAAI,GAAG,EAAsB,CAAC;QACtC,kBAAa,GAAG,IAAI,GAAG,EAAyC,CAAC;IAsL7E,CAAC;IApLG;;;OAGG;IACK,cAAc;QAClB,OAAO,WAAW,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,UAA6B,EAAE,SAAoB,EAAE,OAAgB,EAAE,UAAmB;QACvG,4BAA4B;QAC5B,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,EAAE,CAAC;QAErC,oBAAoB;QACpB,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,gBAAgB,MAAM,iBAAiB,CAAC,CAAC;QAC7D,CAAC;QAED,MAAM,SAAS,GAAG,UAAU,CAAC,GAAG,IAAI,IA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AAI,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAE/C,oCAAoC;QACpC,IAAI,OAAO,KAAK,SAAS,IAAI,KAAK,CAAC,MAAM,IAAI,OAAO,EAAE,CAAC;YACnD,MAAM,IAAI,KAAK,CAAC,4CAA4C,KAAK,CAAC,MAAM,sBAAsB,OAAO,GAAG,CAAC,CAAC;QAC9G,CAAC;QAED,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACxB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,OAAO,CAAC,MAAc,EAAE,SAAkB;QAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAC/C,OAAO,KAAK,CAAC,KAAK,EAAE,CAAC;IACzB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,UAAU,CAAC,MAAc,EAAE,SAAkB;QAC/C,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QAChD,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QACzC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACxB,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/types.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..6022e19b27627032390f74cc65587fa26d5eaf7f --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/types.d.ts @@ -0,0 +1,10 @@ +/** + * Re-exports of task-related types from the MCP protocol spec. + * WARNING: These APIs are experimental and may change without notice. + * + * These types are defined in types.ts (matching the protocol spec) and + * re-exported here for convenience when working with experimental task features. + */ +export { TaskCreationParamsSchema, RelatedTaskMetadataSchema, TaskSchema, CreateTaskResultSchema, TaskStatusNotificationParamsSchema, TaskStatusNotificationSchema, GetTaskRequestSchema, GetTaskResultSchema, GetTaskPayloadRequestSchema, ListTasksRequestSchema, ListTasksResultSchema, CancelTaskRequestSchema, CancelTaskResultSchema, ClientTasksCapabilitySchema, ServerTasksCapabilitySchema } from '../../types.js'; +export type { Task, TaskCreationParams, RelatedTaskMetadata, CreateTaskResult, TaskStatusNotificationParams, TaskStatusNotification, GetTaskRequest, GetTaskResult, GetTaskPayloadRequest, ListTasksRequest, ListTasksResult, CancelTaskRequest, CancelTaskResult } from '../../types.js'; +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/types.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/types.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..f7b9ead05f5b06209e37b122aecf44d75b777af2 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/types.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/experimental/tasks/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EACH,wBAAwB,EACxB,yBAAyB,EACzB,UAAU,EACV,sBAAsB,EACtB,kCAAkC,EAClC,4BAA4B,EAC5B,oBAAoB,EACpB,mBAAmB,EACnB,2BAA2B,EAC3B,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAC9B,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACR,IAAI,EACJ,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,4BAA4B,EAC5B,sBAAsB,EACtB,cAAc,EACd,aAAa,EACb,qBAAqB,EACrB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EACnB,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/types.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/types.js new file mode 100644 index 0000000000000000000000000000000000000000..2162c093a871b77b30617cd508196085db787408 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/types.js @@ -0,0 +1,10 @@ +/** + * Re-exports of task-related types from the MCP protocol spec. + * WARNING: These APIs are experimental and may change without notice. + * + * These types are defined in types.ts (matching the protocol spec) and + * re-exported here for convenience when working with experimental task features. + */ +// Task schemas (Zod) +export { TaskCreationParamsSchema, RelatedTaskMetadataSchema, TaskSchema, CreateTaskResultSchema, TaskStatusNotificationParamsSchema, TaskStatusNotificationSchema, GetTaskRequestSchema, GetTaskResultSchema, GetTaskPayloadRequestSchema, ListTasksRequestSchema, ListTasksResultSchema, CancelTaskRequestSchema, CancelTaskResultSchema, ClientTasksCapabilitySchema, ServerTasksCapabilitySchema } from '../../types.js'; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/types.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/types.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f52e75e09484b16db649b79723e183ffed338251 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/experimental/tasks/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,qBAAqB;AACrB,OAAO,EACH,wBAAwB,EACxB,yBAAyB,EACzB,UAAU,EACV,sBAAsB,EACtB,kCAAkC,EAClC,4BAA4B,EAC5B,oBAAoB,EACpB,mBAAmB,EACnB,2BAA2B,EAC3B,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,2BAA2B,EAC3B,2BAA2B,EAC9B,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/inMemory.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/inMemory.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..32a931a8636db7e1bbe7530a07335df266812d06 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/inMemory.d.ts @@ -0,0 +1,31 @@ +import { Transport } from './shared/transport.js'; +import { JSONRPCMessage, RequestId } from './types.js'; +import { AuthInfo } from './server/auth/types.js'; +/** + * In-memory transport for creating clients and servers that talk to each other within the same process. + */ +export declare class InMemoryTransport implements Transport { + private _otherTransport?; + private _messageQueue; + onclose?: () => void; + onerror?: (error: Error) => void; + onmessage?: (message: JSONRPCMessage, extra?: { + authInfo?: AuthInfo; + }) => void; + sessionId?: string; + /** + * Creates a pair of linked in-memory transports that can communicate with each other. One should be passed to a Client and one to a Server. + */ + static createLinkedPair(): [InMemoryTransport, InMemoryTransport]; + start(): Promise; + close(): Promise; + /** + * Sends a message with optional auth info. + * This is useful for testing authentication scenarios. + */ + send(message: JSONRPCMessage, options?: { + relatedRequestId?: RequestId; + authInfo?: AuthInfo; + }): Promise; +} +//# sourceMappingURL=inMemory.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/inMemory.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/inMemory.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..46bc74be1794c252b30af9a064ada512cb212e51 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/inMemory.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"inMemory.d.ts","sourceRoot":"","sources":["../../src/inMemory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAOlD;;GAEG;AACH,qBAAa,iBAAkB,YAAW,SAAS;IAC/C,OAAO,CAAC,eAAe,CAAC,CAAoB;IAC5C,OAAO,CAAC,aAAa,CAAuB;IAE5C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,QAAQ,CAAA;KAAE,KAAK,IAAI,CAAC;IAC/E,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,MAAM,CAAC,gBAAgB,IAAI,CAAC,iBAAiB,EAAE,iBAAiB,CAAC;IAQ3D,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAQtB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAO5B;;;OAGG;IACG,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE;QAAE,gBAAgB,CAAC,EAAE,SAAS,CAAC;QAAC,QAAQ,CAAC,EAAE,QAAQ,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAWtH"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/inMemory.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/inMemory.js new file mode 100644 index 0000000000000000000000000000000000000000..62d86a29144aa897a0d85e3a969bbc1e991b468a --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/inMemory.js @@ -0,0 +1,47 @@ +/** + * In-memory transport for creating clients and servers that talk to each other within the same process. + */ +export class InMemoryTransport { + constructor() { + this._messageQueue = []; + } + /** + * Creates a pair of linked in-memory transports that can communicate with each other. One should be passed to a Client and one to a Server. + */ + static createLinkedPair() { + const clientTransport = new InMemoryTransport(); + const serverTransport = new InMemoryTransport(); + clientTransport._otherTransport = serverTransport; + serverTransport._otherTransport = clientTransport; + return [clientTransport, serverTransport]; + } + async start() { + // Process any messages that were queued before start was called + while (this._messageQueue.length > 0) { + const queuedMessage = this._messageQueue.shift(); + this.onmessage?.(queuedMessage.message, queuedMessage.extra); + } + } + async close() { + const other = this._otherTransport; + this._otherTransport = undefined; + await other?.close(); + this.onclose?.(); + } + /** + * Sends a message with optional auth info. + * This is useful for testing authentication scenarios. + */ + async send(message, options) { + if (!this._otherTransport) { + throw new Error('Not connected'); + } + if (this._otherTransport.onmessage) { + this._otherTransport.onmessage(message, { authInfo: options?.authInfo }); + } + else { + this._otherTransport._messageQueue.push({ message, extra: { authInfo: options?.authInfo } }); + } + } +} +//# sourceMappingURL=inMemory.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/inMemory.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/inMemory.js.map new file mode 100644 index 0000000000000000000000000000000000000000..60ededddab6c7d0f2c7caf5aa2f80d6e6688dfaf --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/inMemory.js.map @@ -0,0 +1 @@ +{"version":3,"file":"inMemory.js","sourceRoot":"","sources":["../../src/inMemory.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,MAAM,OAAO,iBAAiB;IAA9B;QAEY,kBAAa,GAAoB,EAAE,CAAC;IAgDhD,CAAC;IAzCG;;OAEG;IACH,MAAM,CAAC,gBAAgB;QACnB,MAAM,eAAe,GAAG,IAAI,iBAAiB,EAAE,CAAC;QAChD,MAAM,eAAe,GAAG,IAAI,iBAAiB,EAAE,CAAC;QAChD,eAAe,CAAC,eAAe,GAAG,eAAe,CAAC;QAClD,eAAe,CAAC,eAAe,GAAG,eAAe,CAAC;QAClD,OAAO,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,KAAK;QACP,gEAAgE;QAChE,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACnC,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,EAAG,CAAC;YAClD,IAAI,CAAC,SAAS,EAAE,CAAC,aAAa,CAAC,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;QACjE,CAAC;IACL,CAAC;IAED,KAAK,CAAC,KAAK;QACP,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,CAAC;QACnC,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;QACjC,MAAM,KAAK,EAAE,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;IACrB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,IAAI,CAAC,OAAuB,EAAE,OAA+D;QAC/F,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;QACrC,CAAC;QAED,IAAI,IAAI,CAAC,eAAe,CAAC,SAAS,EAAE,CAAC;YACjC,IAAI,CAAC,eAAe,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAC,CAAC;QAC7E,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,eAAe,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;QACjG,CAAC;IACL,CAAC;CACJ"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/package.json b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/package.json new file mode 100644 index 0000000000000000000000000000000000000000..6990891ff35dd464b19df096e6089004b0e31825 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/package.json @@ -0,0 +1 @@ +{"type": "module"} diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/clients.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/clients.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..be6899a198cacbb5c88e991884c7218b58ac4edc --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/clients.d.ts @@ -0,0 +1,19 @@ +import { OAuthClientInformationFull } from '../../shared/auth.js'; +/** + * Stores information about registered OAuth clients for this server. + */ +export interface OAuthRegisteredClientsStore { + /** + * Returns information about a registered client, based on its ID. + */ + getClient(clientId: string): OAuthClientInformationFull | undefined | Promise; + /** + * Registers a new client with the server. The client ID and secret will be automatically generated by the library. A modified version of the client information can be returned to reflect specific values enforced by the server. + * + * NOTE: Implementations should NOT delete expired client secrets in-place. Auth middleware provided by this library will automatically check the `client_secret_expires_at` field and reject requests with expired secrets. Any custom logic for authenticating clients should check the `client_secret_expires_at` field as well. + * + * If unimplemented, dynamic client registration is unsupported. + */ + registerClient?(client: Omit): OAuthClientInformationFull | Promise; +} +//# sourceMappingURL=clients.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/clients.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/clients.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..ab3851db35974587a2ea2a262e34b034d26e69b5 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/clients.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"clients.d.ts","sourceRoot":"","sources":["../../../../src/server/auth/clients.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,sBAAsB,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,2BAA2B;IACxC;;OAEG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,0BAA0B,GAAG,SAAS,GAAG,OAAO,CAAC,0BAA0B,GAAG,SAAS,CAAC,CAAC;IAEtH;;;;;;OAMG;IACH,cAAc,CAAC,CACX,MAAM,EAAE,IAAI,CAAC,0BAA0B,EAAE,WAAW,GAAG,qBAAqB,CAAC,GAC9E,0BAA0B,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;CACvE"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/clients.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/clients.js new file mode 100644 index 0000000000000000000000000000000000000000..6181a5709dfa56a588b37be1cda442bb81fc91b8 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/clients.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=clients.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/clients.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/clients.js.map new file mode 100644 index 0000000000000000000000000000000000000000..02101044221db6c3f382512c33f94592d157c748 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/clients.js.map @@ -0,0 +1 @@ +{"version":3,"file":"clients.js","sourceRoot":"","sources":["../../../../src/server/auth/clients.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7fddf954cf66a216654e1f407de13375f29438a7 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.d.ts @@ -0,0 +1,148 @@ +import { OAuthErrorResponse } from '../../shared/auth.js'; +/** + * Base class for all OAuth errors + */ +export declare class OAuthError extends Error { + readonly errorUri?: string | undefined; + static errorCode: string; + constructor(message: string, errorUri?: string | undefined); + /** + * Converts the error to a standard OAuth error response object + */ + toResponseObject(): OAuthErrorResponse; + get errorCode(): string; +} +/** + * Invalid request error - The request is missing a required parameter, + * includes an invalid parameter value, includes a parameter more than once, + * or is otherwise malformed. + */ +export declare class InvalidRequestError extends OAuthError { + static errorCode: string; +} +/** + * Invalid client error - Client authentication failed (e.g., unknown client, no client + * authentication included, or unsupported authentication method). + */ +export declare class InvalidClientError extends OAuthError { + static errorCode: string; +} +/** + * Invalid grant error - The provided authorization grant or refresh token is + * invalid, expired, revoked, does not match the redirection URI used in the + * authorization request, or was issued to another client. + */ +export declare class InvalidGrantError extends OAuthError { + static errorCode: string; +} +/** + * Unauthorized client error - The authenticated client is not authorized to use + * this authorization grant type. + */ +export declare class UnauthorizedClientError extends OAuthError { + static errorCode: string; +} +/** + * Unsupported grant type error - The authorization grant type is not supported + * by the authorization server. + */ +export declare class UnsupportedGrantTypeError extends OAuthError { + static errorCode: string; +} +/** + * Invalid scope error - The requested scope is invalid, unknown, malformed, or + * exceeds the scope granted by the resource owner. + */ +export declare class InvalidScopeError extends OAuthError { + static errorCode: string; +} +/** + * Access denied error - The resource owner or authorization server denied the request. + */ +export declare class AccessDeniedError extends OAuthError { + static errorCode: string; +} +/** + * Server error - The authorization server encountered an unexpected condition + * that prevented it from fulfilling the request. + */ +export declare class ServerError extends OAuthError { + static errorCode: string; +} +/** + * Temporarily unavailable error - The authorization server is currently unable to + * handle the request due to a temporary overloading or maintenance of the server. + */ +export declare class TemporarilyUnavailableError extends OAuthError { + static errorCode: string; +} +/** + * Unsupported response type error - The authorization server does not support + * obtaining an authorization code using this method. + */ +export declare class UnsupportedResponseTypeError extends OAuthError { + static errorCode: string; +} +/** + * Unsupported token type error - The authorization server does not support + * the requested token type. + */ +export declare class UnsupportedTokenTypeError extends OAuthError { + static errorCode: string; +} +/** + * Invalid token error - The access token provided is expired, revoked, malformed, + * or invalid for other reasons. + */ +export declare class InvalidTokenError extends OAuthError { + static errorCode: string; +} +/** + * Method not allowed error - The HTTP method used is not allowed for this endpoint. + * (Custom, non-standard error) + */ +export declare class MethodNotAllowedError extends OAuthError { + static errorCode: string; +} +/** + * Too many requests error - Rate limit exceeded. + * (Custom, non-standard error based on RFC 6585) + */ +export declare class TooManyRequestsError extends OAuthError { + static errorCode: string; +} +/** + * Invalid client metadata error - The client metadata is invalid. + * (Custom error for dynamic client registration - RFC 7591) + */ +export declare class InvalidClientMetadataError extends OAuthError { + static errorCode: string; +} +/** + * Insufficient scope error - The request requires higher privileges than provided by the access token. + */ +export declare class InsufficientScopeError extends OAuthError { + static errorCode: string; +} +/** + * Invalid target error - The requested resource is invalid, missing, unknown, or malformed. + * (Custom error for resource indicators - RFC 8707) + */ +export declare class InvalidTargetError extends OAuthError { + static errorCode: string; +} +/** + * A utility class for defining one-off error codes + */ +export declare class CustomOAuthError extends OAuthError { + private readonly customErrorCode; + constructor(customErrorCode: string, message: string, errorUri?: string); + get errorCode(): string; +} +/** + * A full list of all OAuthErrors, enabling parsing from error responses + */ +export declare const OAUTH_ERRORS: { + readonly [x: string]: typeof InvalidRequestError; +}; +//# sourceMappingURL=errors.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..5c0e99202519bd00ce7cb567c1997c5c79f62a26 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/server/auth/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,C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,iBAAkB,SAAQ,UAAU;IAC7C,MAAM,CAAC,SAAS,SAAmB;CACtC;AAED;;;GAGG;AACH,qBAAa,qBAAsB,SAAQ,UAAU;IACjD,MAAM,CAAC,SAAS,SAAwB;CAC3C;AAED;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,UAAU;IAChD,MAAM,CAAC,SAAS,SAAuB;CAC1C;AAED;;;GAGG;AACH,qBAAa,0BAA2B,SAAQ,UAAU;IACtD,MAAM,CAAC,SAAS,SAA6B;CAChD;AAED;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,UAAU;IAClD,MAAM,CAAC,SAAS,SAAwB;CAC3C;AAED;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,UAAU;IAC9C,MAAM,CAAC,SAAS,SAAoB;CACvC;AAED;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,UAAU;IAExC,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAAf,eAAe,EAAE,MAAM,EACxC,OAAO,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM;IAKrB,IAAI,SAAS,IAAI,MAAM,CAEtB;CACJ;AAED;;GAEG;AACH,eAAO,MAAM,YAAY;;CAkBf,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js new file mode 100644 index 0000000000000000000000000000000000000000..7106ab98a3fe2f8aba93f928bec19144e0116114 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js @@ -0,0 +1,180 @@ +/** + * Base class for all OAuth errors + */ +export class OAuthError extends Error { + constructor(message, errorUri) { + super(message); + this.errorUri = errorUri; + this.name = this.constructor.name; + } + /** + * Converts the error to a standard OAuth error response object + */ + toResponseObject() { + const response = { + error: this.errorCode, + error_description: this.message + }; + if (this.errorUri) { + response.error_uri = this.errorUri; + } + return response; + } + get errorCode() { + return this.constructor.errorCode; + } +} +/** + * Invalid request error - The request is missing a required parameter, + * includes an invalid parameter value, includes a parameter more than once, + * or is otherwise malformed. + */ +export class InvalidRequestError extends OAuthError { +} +InvalidRequestError.errorCode = 'invalid_request'; +/** + * Invalid client error - Client authentication failed (e.g., unknown client, no client + * authentication included, or unsupported authentication method). + */ +export class InvalidClientError extends OAuthError { +} +InvalidClientError.errorCode = 'invalid_client'; +/** + * Invalid grant error - The provided authorization grant or refresh token is + * invalid, expired, revoked, does not match the redirection URI used in the + * authorization request, or was issued to another client. + */ +export class InvalidGrantError extends OAuthError { +} +InvalidGrantError.errorCode = 'invalid_grant'; +/** + * Unauthorized client error - The authenticated client is not authorized to use + * this authorization grant type. + */ +export class UnauthorizedClientError extends OAuthError { +} +UnauthorizedClientError.errorCode = 'unauthorized_client'; +/** + * Unsupported grant type error - The authorization grant type is not supported + * by the authorization server. + */ +export class UnsupportedGrantTypeError extends OAuthError { +} +UnsupportedGrantTypeError.errorCode = 'unsupported_grant_type'; +/** + * Invalid scope error - The requested scope is invalid, unknown, malformed, or + * exceeds the scope granted by the resource owner. + */ +export class InvalidScopeError extends OAuthError { +} +InvalidScopeError.errorCode = 'invalid_scope'; +/** + * Access denied error - The resource owner or authorization server denied the request. + */ +export class AccessDeniedError extends OAuthError { +} +AccessDeniedError.errorCode = 'access_denied'; +/** + * Server error - The authorization server encountered an unexpected condition + * that prevented it from fulfilling the request. + */ +export class ServerError extends OAuthError { +} +ServerError.errorCode = 'server_error'; +/** + * Temporarily unavailable error - The authorization server is currently unable to + * handle the request due to a temporary overloading or maintenance of the server. + */ +export class TemporarilyUnavailableError extends OAuthError { +} +TemporarilyUnavailableError.errorCode = 'temporarily_unavailable'; +/** + * Unsupported response type error - The authorization server does not support + * obtaining an authorization code using this method. + */ +export class UnsupportedResponseTypeError extends OAuthError { +} +UnsupportedResponseTypeError.errorCode = 'unsupported_response_type'; +/** + * Unsupported token type error - The authorization server does not support + * the requested token type. + */ +export class UnsupportedTokenTypeError extends OAuthError { +} +UnsupportedTokenTypeError.errorCode = 'unsupported_token_type'; +/** + * Invalid token error - The access token provided is expired, revoked, malformed, + * or invalid for other reasons. + */ +export class InvalidTokenError extends OAuthError { +} +InvalidTokenError.errorCode = 'invalid_token'; +/** + * Method not allowed error - The HTTP method used is not allowed for this endpoint. + * (Custom, non-standard error) + */ +export class MethodNotAllowedError extends OAuthError { +} +MethodNotAllowedError.errorCode = 'method_not_allowed'; +/** + * Too many requests error - Rate limit exceeded. + * (Custom, non-standard error based on RFC 6585) + */ +export class TooManyRequestsError extends OAuthError { +} +TooManyRequestsError.errorCode = 'too_many_requests'; +/** + * Invalid client metadata error - The client metadata is invalid. + * (Custom error for dynamic client registration - RFC 7591) + */ +export class InvalidClientMetadataError extends OAuthError { +} +InvalidClientMetadataError.errorCode = 'invalid_client_metadata'; +/** + * Insufficient scope error - The request requires higher privileges than provided by the access token. + */ +export class InsufficientScopeError extends OAuthError { +} +InsufficientScopeError.errorCode = 'insufficient_scope'; +/** + * Invalid target error - The requested resource is invalid, missing, unknown, or malformed. + * (Custom error for resource indicators - RFC 8707) + */ +export class InvalidTargetError extends OAuthError { +} +InvalidTargetError.errorCode = 'invalid_target'; +/** + * A utility class for defining one-off error codes + */ +export class CustomOAuthError extends OAuthError { + constructor(customErrorCode, message, errorUri) { + super(message, errorUri); + this.customErrorCode = customErrorCode; + } + get errorCode() { + return this.customErrorCode; + } +} +/** + * A full list of all OAuthErrors, enabling parsing from error responses + */ +export const OAUTH_ERRORS = { + [InvalidRequestError.errorCode]: InvalidRequestError, + [InvalidClientError.errorCode]: InvalidClientError, + [InvalidGrantError.errorCode]: InvalidGrantError, + [UnauthorizedClientError.errorCode]: UnauthorizedClientError, + [UnsupportedGrantTypeError.errorCode]: UnsupportedGrantTypeError, + [InvalidScopeError.errorCode]: InvalidScopeError, + [AccessDeniedError.errorCode]: AccessDeniedError, + [ServerError.errorCode]: ServerError, + [TemporarilyUnavailableError.errorCode]: TemporarilyUnavailableError, + [UnsupportedResponseTypeError.errorCode]: UnsupportedResponseTypeError, + [UnsupportedTokenTypeError.errorCode]: UnsupportedTokenTypeError, + [InvalidTokenError.errorCode]: InvalidTokenError, + [MethodNotAllowedError.errorCode]: MethodNotAllowedError, + [TooManyRequestsError.errorCode]: TooManyRequestsError, + [InvalidClientMetadataError.errorCode]: InvalidClientMetadataError, + [InsufficientScopeError.errorCode]: InsufficientScopeError, + [InvalidTargetError.errorCode]: InvalidTargetError +}; +//# sourceMappingURL=errors.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js.map new file mode 100644 index 0000000000000000000000000000000000000000..1461367c68b69e4579bdf184d0d4b8d25ea959da --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/errors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/server/auth/errors.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,KAAK;IAGjC,YACI,OAAe,EACC,QAAiB;QAEjC,KAAK,CAAC,OAAO,CAAC,CAAC;QAFC,aAAQ,GAAR,QAAQ,CAAS;QAGjC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;IACtC,CAAC;IAED;;OAEG;IACH,gBAAgB;QACZ,MAAM,QAAQ,GAAuB;YACjC,KAAK,EAAE,IAAI,CAAC,SAAS;YACrB,iBAAiB,EAAE,IAAI,CAAC,OAAO;SAClC,CAAC;QAEF,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChB,QAAQ,CAAC,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC;QACvC,CAAC;QAED,OAAO,QAAQ,CAAC;IACpB,CAAC;IAED,IAAI,SAAS;QACT,OAAQ,IAAI,CAAC,WAAiC,CAAC,SAAS,CAAC;IAC7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D,CAAC,qBAAqB,CAAC,SAAS,CAAC,EAAE,qBAAqB;IACxD,CAAC,oBAAoB,CAAC,SAAS,CAAC,EAAE,oBAAoB;IACtD,CAAC,0BAA0B,CAAC,SAAS,CAAC,EAAE,0BAA0B;IAClE,CAAC,sBAAsB,CAAC,SAAS,CAAC,EAAE,sBAAsB;IAC1D,CAAC,kBAAkB,CAAC,SAAS,CAAC,EAAE,kBAAkB;CAC5C,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/authorize.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/authorize.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e2da8f07853c4336a5f5f1cc9c208700e5ffa63a --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/authorize.d.ts @@ -0,0 +1,24 @@ +import { RequestHandler } from 'express'; +import { OAuthServerProvider } from '../provider.js'; +import { Options as RateLimitOptions } from 'express-rate-limit'; +export type AuthorizationHandlerOptions = { + provider: OAuthServerProvider; + /** + * Rate limiting configuration for the authorization endpoint. + * Set to false to disable rate limiting for this endpoint. + */ + rateLimit?: Partial | false; +}; +/** + * Validates a requested redirect_uri against a registered one. + * + * Per RFC 8252 §7.3 (OAuth 2.0 for Native Apps), authorization servers MUST + * allow any port for loopback redirect URIs (localhost, 127.0.0.1, [::1]) to + * accommodate native clients that obtain an ephemeral port from the OS. For + * non-loopback URIs, exact match is required. + * + * @see https://datatracker.ietf.org/doc/html/rfc8252#section-7.3 + */ +export declare function redirectUriMatches(requested: string, registered: string): boolean; +export declare function authorizationHandler({ provider, rateLimit: rateLimitConfig }: AuthorizationHandlerOptions): RequestHandler; +//# sourceMappingURL=authorize.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/authorize.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/authorize.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..b0e06313f41089cbbfd14bf786b6cdbb15976a2b --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/authorize.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"authorize.d.ts","sourceRoot":"","sources":["../../../../../src/server/auth/handlers/authorize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAa,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAI5E,MAAM,MAAM,2BAA2B,GAAG;IACtC,QAAQ,EAAE,mBAAmB,CAAC;IAC9B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC;CACjD,CAAC;AAIF;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAmBjF;AAqBD,wBAAgB,oBAAoB,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,EAAE,2BAA2B,GAAG,cAAc,CAiH1H"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/authorize.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/authorize.js new file mode 100644 index 0000000000000000000000000000000000000000..091b55f5e6a273dbcc7c0c6be8fecee8db83a34f --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/authorize.js @@ -0,0 +1,171 @@ +import * as z from 'zod/v4'; +import express from 'express'; +import { rateLimit } from 'express-rate-limit'; +import { allowedMethods } from '../middleware/allowedMethods.js'; +import { InvalidRequestError, InvalidClientError, ServerError, TooManyRequestsError, OAuthError } from '../errors.js'; +const LOOPBACK_HOSTS = new Set(['localhost', '127.0.0.1', '[::1]']); +/** + * Validates a requested redirect_uri against a registered one. + * + * Per RFC 8252 §7.3 (OAuth 2.0 for Native Apps), authorization servers MUST + * allow any port for loopback redirect URIs (localhost, 127.0.0.1, [::1]) to + * accommodate native clients that obtain an ephemeral port from the OS. For + * non-loopback URIs, exact match is required. + * + * @see https://datatracker.ietf.org/doc/html/rfc8252#section-7.3 + */ +export function redirectUriMatches(requested, registered) { + if (requested === registered) { + return true; + } + let req, reg; + try { + req = new URL(requested); + reg = new URL(registered); + } + catch { + return false; + } + // Port relaxation only applies when both URIs target a loopback host. + if (!LOOPBACK_HOSTS.has(req.hostname) || !LOOPBACK_HOSTS.has(reg.hostname)) { + return false; + } + // RFC 8252 relaxes the port only — scheme, host, path, and query must + // still match exactly. Note: hostname must match exactly too (the RFC + // does not allow localhost↔127.0.0.1 cross-matching). + return req.protocol === reg.protocol && req.hostname === reg.hostname && req.pathname === reg.pathname && req.search === reg.search; +} +// Parameters that must be validated in order to issue redirects. +const ClientAuthorizationParamsSchema = z.object({ + client_id: z.string(), + redirect_uri: z + .string() + .optional() + .refine(value => value === undefined || URL.canParse(value), { message: 'redirect_uri must be a valid URL' }) +}); +// Parameters that must be validated for a successful authorization request. Failure can be reported to the redirect URI. +const RequestAuthorizationParamsSchema = z.object({ + response_type: z.literal('code'), + code_challenge: z.string(), + code_challenge_method: z.literal('S256'), + scope: z.string().optional(), + state: z.string().optional(), + resource: z.string().url().optional() +}); +export function authorizationHandler({ provider, rateLimit: rateLimitConfig }) { + // Create a router to apply middleware + const router = express.Router(); + router.use(allowedMethods(['GET', 'POST'])); + router.use(express.urlencoded({ extended: false })); + // Apply rate limiting unless explicitly disabled + if (rateLimitConfig !== false) { + router.use(rateLimit({ + windowMs: 15 * 60 * 1000, // 15 minutes + max: 100, // 100 requests per windowMs + standardHeaders: true, + legacyHeaders: false, + message: new TooManyRequestsError('You have exceeded the rate limit for authorization requests').toResponseObject(), + ...rateLimitConfig + })); + } + router.all('/', async (req, res) => { + res.setHeader('Cache-Control', 'no-store'); + // In the authorization flow, errors are split into two categories: + // 1. Pre-redirect errors (direct response with 400) + // 2. Post-redirect errors (redirect with error parameters) + // Phase 1: Validate client_id and redirect_uri. Any errors here must be direct responses. + let client_id, redirect_uri, client; + try { + const result = ClientAuthorizationParamsSchema.safeParse(req.method === 'POST' ? req.body : req.query); + if (!result.success) { + throw new InvalidRequestError(result.error.message); + } + client_id = result.data.client_id; + redirect_uri = result.data.redirect_uri; + client = await provider.clientsStore.getClient(client_id); + if (!client) { + throw new InvalidClientError('Invalid client_id'); + } + if (redirect_uri !== undefined) { + const requested = redirect_uri; + if (!client.redirect_uris.some(registered => redirectUriMatches(requested, registered))) { + throw new InvalidRequestError('Unregistered redirect_uri'); + } + } + else if (client.redirect_uris.length === 1) { + redirect_uri = client.redirect_uris[0]; + } + else { + throw new InvalidRequestError('redirect_uri must be specified when client has multiple registered URIs'); + } + } + catch (error) { + // Pre-redirect errors - return direct response + // + // These don't need to be JSON encoded, as they'll be displayed in a user + // agent, but OTOH they all represent exceptional situations (arguably, + // "programmer error"), so presenting a nice HTML page doesn't help the + // user anyway. + if (error instanceof OAuthError) { + const status = error instanceof ServerError ? 500 : 400; + res.status(status).json(error.toResponseObject()); + } + else { + const serverError = new ServerError('Internal Server Error'); + res.status(500).json(serverError.toResponseObject()); + } + return; + } + // Phase 2: Validate other parameters. Any errors here should go into redirect responses. + let state; + try { + // Parse and validate authorization parameters + const parseResult = RequestAuthorizationParamsSchema.safeParse(req.method === 'POST' ? req.body : req.query); + if (!parseResult.success) { + throw new InvalidRequestError(parseResult.error.message); + } + const { scope, code_challenge, resource } = parseResult.data; + state = parseResult.data.state; + // Validate scopes + let requestedScopes = []; + if (scope !== undefined) { + requestedScopes = scope.split(' '); + } + // All validation passed, proceed with authorization + await provider.authorize(client, { + state, + scopes: requestedScopes, + redirectUri: redirect_uri, + codeChallenge: code_challenge, + resource: resource ? new URL(resource) : undefined + }, res); + } + catch (error) { + // Post-redirect errors - redirect with error parameters + if (error instanceof OAuthError) { + res.redirect(302, createErrorRedirect(redirect_uri, error, state)); + } + else { + const serverError = new ServerError('Internal Server Error'); + res.redirect(302, createErrorRedirect(redirect_uri, serverError, state)); + } + } + }); + return router; +} +/** + * Helper function to create redirect URL with error parameters + */ +function createErrorRedirect(redirectUri, error, state) { + const errorUrl = new URL(redirectUri); + errorUrl.searchParams.set('error', error.errorCode); + errorUrl.searchParams.set('error_description', error.message); + if (error.errorUri) { + errorUrl.searchParams.set('error_uri', error.errorUri); + } + if (state) { + errorUrl.searchParams.set('state', state); + } + return errorUrl.href; +} +//# sourceMappingURL=authorize.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/authorize.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/authorize.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ddb3d2c7680328764dd2164638737302964295bc --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/authorize.js.map @@ -0,0 +1 @@ +{"version":3,"file":"authorize.js","sourceRoot":"","sources":["../../../../../src/server/auth/handlers/authorize.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,SAAS,EAA+B,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,WAAW,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAWtH,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;AAEpE;;;;;;;;;GASG;AACH,MAAM,UAAU,kBAAkB,C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;QACR,QAAQ,CAAC,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,QAAQ,CAAC,IAAI,CAAC;AACzB,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/metadata.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/metadata.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4d03286170723c4f1573293daab027f14e50dd97 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/metadata.d.ts @@ -0,0 +1,4 @@ +import { RequestHandler } from 'express'; +import { OAuthMetadata, OAuthProtectedResourceMetadata } from '../../../shared/auth.js'; +export declare function metadataHandler(metadata: OAuthMetadata | OAuthProtectedResourceMetadata): RequestHandler; +//# sourceMappingURL=metadata.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/metadata.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/metadata.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..55e3a50dc113e476be14a526bdc6a46cc8e6b312 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/metadata.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../../../../src/server/auth/handlers/metadata.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AAIxF,wBAAgB,eAAe,CAAC,QAAQ,EAAE,aAAa,GAAG,8BAA8B,GAAG,cAAc,CAaxG"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/metadata.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/metadata.js new file mode 100644 index 0000000000000000000000000000000000000000..94dadb709e2c5bfc16a6cc4002acae8fb81d2fca --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/metadata.js @@ -0,0 +1,15 @@ +import express from 'express'; +import cors from 'cors'; +import { allowedMethods } from '../middleware/allowedMethods.js'; +export function metadataHandler(metadata) { + // Nested router so we can configure middleware and restrict HTTP method + const router = express.Router(); + // Configure CORS to allow any origin, to make accessible to web-based MCP clients + router.use(cors()); + router.use(allowedMethods(['GET', 'OPTIONS'])); + router.get('/', (req, res) => { + res.status(200).json(metadata); + }); + return router; +} +//# sourceMappingURL=metadata.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/metadata.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/metadata.js.map new file mode 100644 index 0000000000000000000000000000000000000000..625ed947d2484255f25a267022744a2476990f19 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/metadata.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadata.js","sourceRoot":"","sources":["../../../../../src/server/auth/handlers/metadata.ts"],"names":[],"mappings":"AAAA,OAAO,OAA2B,MAAM,SAAS,CAAC;AAElD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjE,MAAM,UAAU,eAAe,CAAC,QAAwD;IACpF,wEAAwE;IACxE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAEhC,kFAAkF;IAClF,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IAEnB,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IAC/C,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;QACzB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAClB,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/register.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/register.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e9add28458baa5053a396e087e469ac06daeccfb --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/register.d.ts @@ -0,0 +1,29 @@ +import { RequestHandler } from 'express'; +import { OAuthRegisteredClientsStore } from '../clients.js'; +import { Options as RateLimitOptions } from 'express-rate-limit'; +export type ClientRegistrationHandlerOptions = { + /** + * A store used to save information about dynamically registered OAuth clients. + */ + clientsStore: OAuthRegisteredClientsStore; + /** + * The number of seconds after which to expire issued client secrets, or 0 to prevent expiration of client secrets (not recommended). + * + * If not set, defaults to 30 days. + */ + clientSecretExpirySeconds?: number; + /** + * Rate limiting configuration for the client registration endpoint. + * Set to false to disable rate limiting for this endpoint. + * Registration endpoints are particularly sensitive to abuse and should be rate limited. + */ + rateLimit?: Partial | false; + /** + * Whether to generate a client ID before calling the client registration endpoint. + * + * If not set, defaults to true. + */ + clientIdGeneration?: boolean; +}; +export declare function clientRegistrationHandler({ clientsStore, clientSecretExpirySeconds, rateLimit: rateLimitConfig, clientIdGeneration }: ClientRegistrationHandlerOptions): RequestHandler; +//# sourceMappingURL=register.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/register.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/register.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..a38ebdb89e28201057c791c5e152ec5096fca958 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/register.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../../../../src/server/auth/handlers/register.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAIlD,OAAO,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAa,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAI5E,MAAM,MAAM,gCAAgC,GAAG;IAC3C;;OAEG;IACH,YAAY,EAAE,2BAA2B,CAAC;IAE1C;;;;OAIG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAC;IAEnC;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC;IAE9C;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAChC,CAAC;AAIF,wBAAgB,yBAAyB,CAAC,EACtC,YAAY,EACZ,yBAAgE,EAChE,SAAS,EAAE,eAAe,EAC1B,kBAAyB,EAC5B,EAAE,gCAAgC,GAAG,cAAc,CA0EnD"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/register.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/register.js new file mode 100644 index 0000000000000000000000000000000000000000..ef6c44d51858b3467e3abb3cb6ff66fff8c64272 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/register.js @@ -0,0 +1,71 @@ +import express from 'express'; +import { OAuthClientMetadataSchema } from '../../../shared/auth.js'; +import crypto from 'node:crypto'; +import cors from 'cors'; +import { rateLimit } from 'express-rate-limit'; +import { allowedMethods } from '../middleware/allowedMethods.js'; +import { InvalidClientMetadataError, ServerError, TooManyRequestsError, OAuthError } from '../errors.js'; +const DEFAULT_CLIENT_SECRET_EXPIRY_SECONDS = 30 * 24 * 60 * 60; // 30 days +export function clientRegistrationHandler({ clientsStore, clientSecretExpirySeconds = DEFAULT_CLIENT_SECRET_EXPIRY_SECONDS, rateLimit: rateLimitConfig, clientIdGeneration = true }) { + if (!clientsStore.registerClient) { + throw new Error('Client registration store does not support registering clients'); + } + // Nested router so we can configure middleware and restrict HTTP method + const router = express.Router(); + // Configure CORS to allow any origin, to make accessible to web-based MCP clients + router.use(cors()); + router.use(allowedMethods(['POST'])); + router.use(express.json()); + // Apply rate limiting unless explicitly disabled - stricter limits for registration + if (rateLimitConfig !== false) { + router.use(rateLimit({ + windowMs: 60 * 60 * 1000, // 1 hour + max: 20, // 20 requests per hour - stricter as registration is sensitive + standardHeaders: true, + legacyHeaders: false, + message: new TooManyRequestsError('You have exceeded the rate limit for client registration requests').toResponseObject(), + ...rateLimitConfig + })); + } + router.post('/', async (req, res) => { + res.setHeader('Cache-Control', 'no-store'); + try { + const parseResult = OAuthClientMetadataSchema.safeParse(req.body); + if (!parseResult.success) { + throw new InvalidClientMetadataError(parseResult.error.message); + } + const clientMetadata = parseResult.data; + const isPublicClient = clientMetadata.token_endpoint_auth_method === 'none'; + // Generate client credentials + const clientSecret = isPublicClient ? undefined : crypto.randomBytes(32).toString('hex'); + const clientIdIssuedAt = Math.floor(Date.now() / 1000); + // Calculate client secret expiry time + const clientsDoExpire = clientSecretExpirySeconds > 0; + const secretExpiryTime = clientsDoExpire ? clientIdIssuedAt + clientSecretExpirySeconds : 0; + const clientSecretExpiresAt = isPublicClient ? undefined : secretExpiryTime; + let clientInfo = { + ...clientMetadata, + client_secret: clientSecret, + client_secret_expires_at: clientSecretExpiresAt + }; + if (clientIdGeneration) { + clientInfo.client_id = crypto.randomUUID(); + clientInfo.client_id_issued_at = clientIdIssuedAt; + } + clientInfo = await clientsStore.registerClient(clientInfo); + res.status(201).json(clientInfo); + } + catch (error) { + if (error instanceof OAuthError) { + const status = error instanceof ServerError ? 500 : 400; + res.status(status).json(error.toResponseObject()); + } + else { + const serverError = new ServerError('Internal Server Error'); + res.status(500).json(serverError.toResponseObject()); + } + } + }); + return router; +} +//# sourceMappingURL=register.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/register.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/register.js.map new file mode 100644 index 0000000000000000000000000000000000000000..3f4c082f042bb6cfb448d3b7804485cf69cccccb --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/register.js.map @@ -0,0 +1 @@ +{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../../../src/server/auth/handlers/register.ts"],"names":[],"mappings":"AAAA,OAAO,OAA2B,MAAM,SAAS,CAAC;AAClD,OAAO,EAA8B,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AAChG,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,SAAS,EAA+B,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,WAAW,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AA8BzG,MAAM,oCAAoC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,UAAU;AAE1E,MAAM,UAAU,yBAAyB,CAAC,EACtC,YAAY,EACZ,yBAAyB,GAAG,oCAAoC,EAChE,SAAS,EAAE,eAAe,EAC1B,kBAAkB,GAAG,IAAI,EACM;IAC/B,IAAI,CAAC,YAAY,CAAC,cAAc,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;IACtF,CAAC;IAED,wEAAwE;IACxE,MAAM,MAAM,GAAG,O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,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAC,CAAC;YACzD,CAAC;QACL,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAClB,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/revoke.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/revoke.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2be32bb3cad62143e2c5acf3780732272eac9cb1 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/revoke.d.ts @@ -0,0 +1,13 @@ +import { OAuthServerProvider } from '../provider.js'; +import { RequestHandler } from 'express'; +import { Options as RateLimitOptions } from 'express-rate-limit'; +export type RevocationHandlerOptions = { + provider: OAuthServerProvider; + /** + * Rate limiting configuration for the token revocation endpoint. + * Set to false to disable rate limiting for this endpoint. + */ + rateLimit?: Partial | false; +}; +export declare function revocationHandler({ provider, rateLimit: rateLimitConfig }: RevocationHandlerOptions): RequestHandler; +//# sourceMappingURL=revoke.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/revoke.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/revoke.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..fb13cf19fe4de5b1ebb44ebc2c6ddbaf2c144c3a --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/revoke.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"revoke.d.ts","sourceRoot":"","sources":["../../../../../src/server/auth/handlers/revoke.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAIlD,OAAO,EAAa,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAI5E,MAAM,MAAM,wBAAwB,GAAG;IACnC,QAAQ,EAAE,mBAAmB,CAAC;IAC9B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC;CACjD,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,EAAE,wBAAwB,GAAG,cAAc,CA4DpH"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/revoke.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/revoke.js new file mode 100644 index 0000000000000000000000000000000000000000..68f5284dd40b3defff947cf8994951a2f764a079 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/revoke.js @@ -0,0 +1,59 @@ +import express from 'express'; +import cors from 'cors'; +import { authenticateClient } from '../middleware/clientAuth.js'; +import { OAuthTokenRevocationRequestSchema } from '../../../shared/auth.js'; +import { rateLimit } from 'express-rate-limit'; +import { allowedMethods } from '../middleware/allowedMethods.js'; +import { InvalidRequestError, ServerError, TooManyRequestsError, OAuthError } from '../errors.js'; +export function revocationHandler({ provider, rateLimit: rateLimitConfig }) { + if (!provider.revokeToken) { + throw new Error('Auth provider does not support revoking tokens'); + } + // Nested router so we can configure middleware and restrict HTTP method + const router = express.Router(); + // Configure CORS to allow any origin, to make accessible to web-based MCP clients + router.use(cors()); + router.use(allowedMethods(['POST'])); + router.use(express.urlencoded({ extended: false })); + // Apply rate limiting unless explicitly disabled + if (rateLimitConfig !== false) { + router.use(rateLimit({ + windowMs: 15 * 60 * 1000, // 15 minutes + max: 50, // 50 requests per windowMs + standardHeaders: true, + legacyHeaders: false, + message: new TooManyRequestsError('You have exceeded the rate limit for token revocation requests').toResponseObject(), + ...rateLimitConfig + })); + } + // Authenticate and extract client details + router.use(authenticateClient({ clientsStore: provider.clientsStore })); + router.post('/', async (req, res) => { + res.setHeader('Cache-Control', 'no-store'); + try { + const parseResult = OAuthTokenRevocationRequestSchema.safeParse(req.body); + if (!parseResult.success) { + throw new InvalidRequestError(parseResult.error.message); + } + const client = req.client; + if (!client) { + // This should never happen + throw new ServerError('Internal Server Error'); + } + await provider.revokeToken(client, parseResult.data); + res.status(200).json({}); + } + catch (error) { + if (error instanceof OAuthError) { + const status = error instanceof ServerError ? 500 : 400; + res.status(status).json(error.toResponseObject()); + } + else { + const serverError = new ServerError('Internal Server Error'); + res.status(500).json(serverError.toResponseObject()); + } + } + }); + return router; +} +//# sourceMappingURL=revoke.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/revoke.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/revoke.js.map new file mode 100644 index 0000000000000000000000000000000000000000..e1a0b1db985b9d63c57f068d99d50596cd2d9c9c --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/revoke.js.map @@ -0,0 +1 @@ +{"version":3,"file":"revoke.js","sourceRoot":"","sources":["../../../../../src/server/auth/handlers/revoke.ts"],"names":[],"mappings":"AACA,OAAO,OAA2B,MAAM,SAAS,CAAC;AAClD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,iCAAiC,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAAE,SAAS,EAA+B,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAWlG,MAAM,UAAU,iBAAiB,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAA4B;IA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,mBAAmB,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC7D,CAAC;YAED,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC;YAC1B,IAAI,CAAC,MAAM,EAAE,CAAC;gBACV,2BAA2B;gBAC3B,MAAM,IAAI,WAAW,CAAC,uBAAuB,CAAC,CAAC;YACnD,CAAC;YAED,MAAM,QAAQ,CAAC,WAAY,CAAC,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC;YACtD,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC7B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,IAAI,KAAK,YAAY,UAAU,EAAE,CAAC;gBAC9B,MAAM,MAAM,GAAG,KAAK,YAAY,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;gBACxD,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC,CAAC;YACtD,CAAC;iBAAM,CAAC;gBACJ,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,uBAAuB,CAAC,CAAC;gBAC7D,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAC,CAAC;YACzD,CAAC;QACL,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAClB,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/token.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/token.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..24d1c8783bdfec00a9511af88bdf9c38f0929e9c --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/token.d.ts @@ -0,0 +1,13 @@ +import { RequestHandler } from 'express'; +import { OAuthServerProvider } from '../provider.js'; +import { Options as RateLimitOptions } from 'express-rate-limit'; +export type TokenHandlerOptions = { + provider: OAuthServerProvider; + /** + * Rate limiting configuration for the token endpoint. + * Set to false to disable rate limiting for this endpoint. + */ + rateLimit?: Partial | false; +}; +export declare function tokenHandler({ provider, rateLimit: rateLimitConfig }: TokenHandlerOptions): RequestHandler; +//# sourceMappingURL=token.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/token.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/token.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..68189b0b210bf3110a9256f97fe5efd3f84a507e --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/token.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../../../src/server/auth/handlers/token.ts"],"names":[],"mappings":"AACA,OAAgB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAIrD,OAAO,EAAa,OAAO,IAAI,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAW5E,MAAM,MAAM,mBAAmB,GAAG;IAC9B,QAAQ,EAAE,mBAAmB,CAAC;IAC9B;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC;CACjD,CAAC;AAmBF,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,eAAe,EAAE,EAAE,mBAAmB,GAAG,cAAc,CA+G1G"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/token.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/token.js new file mode 100644 index 0000000000000000000000000000000000000000..b413c499e43558917339f3c2d81553cccbbc5160 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/token.js @@ -0,0 +1,107 @@ +import * as z from 'zod/v4'; +import express from 'express'; +import cors from 'cors'; +import { verifyChallenge } from 'pkce-challenge'; +import { authenticateClient } from '../middleware/clientAuth.js'; +import { rateLimit } from 'express-rate-limit'; +import { allowedMethods } from '../middleware/allowedMethods.js'; +import { InvalidRequestError, InvalidGrantError, UnsupportedGrantTypeError, ServerError, TooManyRequestsError, OAuthError } from '../errors.js'; +const TokenRequestSchema = z.object({ + grant_type: z.string() +}); +const AuthorizationCodeGrantSchema = z.object({ + code: z.string(), + code_verifier: z.string(), + redirect_uri: z.string().optional(), + resource: z.string().url().optional() +}); +const RefreshTokenGrantSchema = z.object({ + refresh_token: z.string(), + scope: z.string().optional(), + resource: z.string().url().optional() +}); +export function tokenHandler({ provider, rateLimit: rateLimitConfig }) { + // Nested router so we can configure middleware and restrict HTTP method + const router = express.Router(); + // Configure CORS to allow any origin, to make accessible to web-based MCP clients + router.use(cors()); + router.use(allowedMethods(['POST'])); + router.use(express.urlencoded({ extended: false })); + // Apply rate limiting unless explicitly disabled + if (rateLimitConfig !== false) { + router.use(rateLimit({ + windowMs: 15 * 60 * 1000, // 15 minutes + max: 50, // 50 requests per windowMs + standardHeaders: true, + legacyHeaders: false, + message: new TooManyRequestsError('You have exceeded the rate limit for token requests').toResponseObject(), + ...rateLimitConfig + })); + } + // Authenticate and extract client details + router.use(authenticateClient({ clientsStore: provider.clientsStore })); + router.post('/', async (req, res) => { + res.setHeader('Cache-Control', 'no-store'); + try { + const parseResult = TokenRequestSchema.safeParse(req.body); + if (!parseResult.success) { + throw new InvalidRequestError(parseResult.error.message); + } + const { grant_type } = parseResult.data; + const client = req.client; + if (!client) { + // This should never happen + throw new ServerError('Internal Server Error'); + } + switch (grant_type) { + case 'authorization_code': { + const parseResult = AuthorizationCodeGrantSchema.safeParse(req.body); + if (!parseResult.success) { + throw new InvalidRequestError(parseResult.error.message); + } + const { code, code_verifier, redirect_uri, resource } = parseResult.data; + const skipLocalPkceValidation = provider.skipLocalPkceValidation; + // Perform local PKCE validation unless explicitly skipped + // (e.g. to validate code_verifier in upstream server) + if (!skipLocalPkceValidation) { + const codeChallenge = await provider.challengeForAuthorizationCode(client, code); + if (!(await verifyChallenge(code_verifier, codeChallenge))) { + throw new InvalidGrantError('code_verifier does not match the challenge'); + } + } + // Passes the code_verifier to the provider if PKCE validation didn't occur locally + const tokens = await provider.exchangeAuthorizationCode(client, code, skipLocalPkceValidation ? code_verifier : undefined, redirect_uri, resource ? new URL(resource) : undefined); + res.status(200).json(tokens); + break; + } + case 'refresh_token': { + const parseResult = RefreshTokenGrantSchema.safeParse(req.body); + if (!parseResult.success) { + throw new InvalidRequestError(parseResult.error.message); + } + const { refresh_token, scope, resource } = parseResult.data; + const scopes = scope?.split(' '); + const tokens = await provider.exchangeRefreshToken(client, refresh_token, scopes, resource ? new URL(resource) : undefined); + res.status(200).json(tokens); + break; + } + // Additional auth methods will not be added on the server side of the SDK. + case 'client_credentials': + default: + throw new UnsupportedGrantTypeError('The grant type is not supported by this authorization server.'); + } + } + catch (error) { + if (error instanceof OAuthError) { + const status = error instanceof ServerError ? 500 : 400; + res.status(status).json(error.toResponseObject()); + } + else { + const serverError = new ServerError('Internal Server Error'); + res.status(500).json(serverError.toResponseObject()); + } + } + }); + return router; +} +//# sourceMappingURL=token.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/token.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/token.js.map new file mode 100644 index 0000000000000000000000000000000000000000..07f182a252e2b202a565b119365e703b4ca0d7d2 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/handlers/token.js.map @@ -0,0 +1 @@ +{"version":3,"file":"token.js","sourceRoot":"","sources":["../../../../../src/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WAAW,CAAC,uBAAuB,CAAC,CAAC;gBAC7D,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAC,CAAC;YACzD,CAAC;QACL,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAClB,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/allowedMethods.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/allowedMethods.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ee6037e0deb31f4e2e9a0d4866149e37a4fc042f --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/allowedMethods.d.ts @@ -0,0 +1,9 @@ +import { RequestHandler } from 'express'; +/** + * Middleware to handle unsupported HTTP methods with a 405 Method Not Allowed response. + * + * @param allowedMethods Array of allowed HTTP methods for this endpoint (e.g., ['GET', 'POST']) + * @returns Express middleware that returns a 405 error if method not in allowed list + */ +export declare function allowedMethods(allowedMethods: string[]): RequestHandler; +//# sourceMappingURL=allowedMethods.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/allowedMethods.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/allowedMethods.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..d3de93e242ef131e56c893d461648477e2c44768 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/allowedMethods.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"allowedMethods.d.ts","sourceRoot":"","sources":["../../../../../src/server/auth/middleware/allowedMethods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAGzC;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,cAAc,EAAE,MAAM,EAAE,GAAG,cAAc,CAUvE"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/allowedMethods.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/allowedMethods.js new file mode 100644 index 0000000000000000000000000000000000000000..af2ba08923f404ecb1693b010727bcc49ed2fd7a --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/allowedMethods.js @@ -0,0 +1,18 @@ +import { MethodNotAllowedError } from '../errors.js'; +/** + * Middleware to handle unsupported HTTP methods with a 405 Method Not Allowed response. + * + * @param allowedMethods Array of allowed HTTP methods for this endpoint (e.g., ['GET', 'POST']) + * @returns Express middleware that returns a 405 error if method not in allowed list + */ +export function allowedMethods(allowedMethods) { + return (req, res, next) => { + if (allowedMethods.includes(req.method)) { + next(); + return; + } + const error = new MethodNotAllowedError(`The method ${req.method} is not allowed for this endpoint`); + res.status(405).set('Allow', allowedMethods.join(', ')).json(error.toResponseObject()); + }; +} +//# sourceMappingURL=allowedMethods.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/allowedMethods.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/allowedMethods.js.map new file mode 100644 index 0000000000000000000000000000000000000000..c4109798684d84ba8e7c354b07cb5b800e36a4f3 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/allowedMethods.js.map @@ -0,0 +1 @@ +{"version":3,"file":"allowedMethods.js","sourceRoot":"","sources":["../../../../../src/server/auth/middleware/allowedMethods.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,cAAwB;IACnD,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QACtB,IAAI,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;YACtC,IAAI,EAAE,CAAC;YACP,OAAO;QACX,CAAC;QAED,MAAM,KAAK,GAAG,IAAI,qBAAqB,CAAC,cAAc,GAAG,CAAC,MAAM,mCAAmC,CAAC,CAAC;QACrG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC3F,CAAC,CAAC;AACN,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/bearerAuth.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/bearerAuth.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..10730758bce4ee06bcf85a5c5fdb36575830790e --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/bearerAuth.d.ts @@ -0,0 +1,35 @@ +import { RequestHandler } from 'express'; +import { OAuthTokenVerifier } from '../provider.js'; +import { AuthInfo } from '../types.js'; +export type BearerAuthMiddlewareOptions = { + /** + * A provider used to verify tokens. + */ + verifier: OAuthTokenVerifier; + /** + * Optional scopes that the token must have. + */ + requiredScopes?: string[]; + /** + * Optional resource metadata URL to include in WWW-Authenticate header. + */ + resourceMetadataUrl?: string; +}; +declare module 'express-serve-static-core' { + interface Request { + /** + * Information about the validated access token, if the `requireBearerAuth` middleware was used. + */ + auth?: AuthInfo; + } +} +/** + * Middleware that requires a valid Bearer token in the Authorization header. + * + * This will validate the token with the auth provider and add the resulting auth info to the request object. + * + * If resourceMetadataUrl is provided, it will be included in the WWW-Authenticate header + * for 401 responses as per the OAuth 2.0 Protected Resource Metadata spec. + */ +export declare function requireBearerAuth({ verifier, requiredScopes, resourceMetadataUrl }: BearerAuthMiddlewareOptions): RequestHandler; +//# sourceMappingURL=bearerAuth.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/bearerAuth.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/bearerAuth.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..c9d939f3b7329178370a7dda7649414dc5c734df --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/bearerAuth.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bearerAuth.d.ts","sourceRoot":"","sources":["../../../../../src/server/auth/middleware/bearerAuth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,MAAM,2BAA2B,GAAG;IACtC;;OAEG;IACH,QAAQ,EAAE,kBAAkB,CAAC;IAE7B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAE1B;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF,OAAO,QAAQ,2BAA2B,CAAC;IACvC,UAAU,OAAO;QACb;;WAEG;QACH,IAAI,CAAC,EAAE,QAAQ,CAAC;KACnB;CACJ;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,QAAQ,EAAE,cAAmB,EAAE,mBAAmB,EAAE,EAAE,2BAA2B,GAAG,cAAc,CA8DrI"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/bearerAuth.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/bearerAuth.js new file mode 100644 index 0000000000000000000000000000000000000000..0c527b4f423464f8af14987c0420d8b4e0525178 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/bearerAuth.js @@ -0,0 +1,72 @@ +import { InsufficientScopeError, InvalidTokenError, OAuthError, ServerError } from '../errors.js'; +/** + * Middleware that requires a valid Bearer token in the Authorization header. + * + * This will validate the token with the auth provider and add the resulting auth info to the request object. + * + * If resourceMetadataUrl is provided, it will be included in the WWW-Authenticate header + * for 401 responses as per the OAuth 2.0 Protected Resource Metadata spec. + */ +export function requireBearerAuth({ verifier, requiredScopes = [], resourceMetadataUrl }) { + return async (req, res, next) => { + try { + const authHeader = req.headers.authorization; + if (!authHeader) { + throw new InvalidTokenError('Missing Authorization header'); + } + const [type, token] = authHeader.split(' '); + if (type.toLowerCase() !== 'bearer' || !token) { + throw new InvalidTokenError("Invalid Authorization header format, expected 'Bearer TOKEN'"); + } + const authInfo = await verifier.verifyAccessToken(token); + // Check if token has the required scopes (if any) + if (requiredScopes.length > 0) { + const hasAllScopes = requiredScopes.every(scope => authInfo.scopes.includes(scope)); + if (!hasAllScopes) { + throw new InsufficientScopeError('Insufficient scope'); + } + } + // Check if the token is set to expire or if it is expired + if (typeof authInfo.expiresAt !== 'number' || isNaN(authInfo.expiresAt)) { + throw new InvalidTokenError('Token has no expiration time'); + } + else if (authInfo.expiresAt < Date.now() / 1000) { + throw new InvalidTokenError('Token has expired'); + } + req.auth = authInfo; + next(); + } + catch (error) { + // Build WWW-Authenticate header parts + const buildWwwAuthHeader = (errorCode, message) => { + let header = `Bearer error="${errorCode}", error_description="${message}"`; + if (requiredScopes.length > 0) { + header += `, scope="${requiredScopes.join(' ')}"`; + } + if (resourceMetadataUrl) { + header += `, resource_metadata="${resourceMetadataUrl}"`; + } + return header; + }; + if (error instanceof InvalidTokenError) { + res.set('WWW-Authenticate', buildWwwAuthHeader(error.errorCode, error.message)); + res.status(401).json(error.toResponseObject()); + } + else if (error instanceof InsufficientScopeError) { + res.set('WWW-Authenticate', buildWwwAuthHeader(error.errorCode, error.message)); + res.status(403).json(error.toResponseObject()); + } + else if (error instanceof ServerError) { + res.status(500).json(error.toResponseObject()); + } + else if (error instanceof OAuthError) { + res.status(400).json(error.toResponseObject()); + } + else { + const serverError = new ServerError('Internal Server Error'); + res.status(500).json(serverError.toResponseObject()); + } + } + }; +} +//# sourceMappingURL=bearerAuth.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/bearerAuth.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/bearerAuth.js.map new file mode 100644 index 0000000000000000000000000000000000000000..d8d0179b76ba1698ac498ffc01064791b6a93207 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/bearerAuth.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bearerAuth.js","sourceRoot":"","sources":["../../../../../src/server/auth/middleware/bearerAuth.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,iBAAiB,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AA8BlG;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAAE,QAAQ,EAAE,cAAc,GAAG,EAAE,EAAE,mBAAmB,EAA+B;IACjH,OAAO,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAC5B,IAAI,CAAC;YACD,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC;YAC7C,IAAI,CAAC,UAAU,EAAE,CAAC;gBACd,MAAM,IAAI,iBAAiB,CAAC,8BAA8B,CAAC,CAAC;YAChE,CAAC;YAED,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC5C,IAAI,IAAI,CAAC,WAAW,EAAE,KAAK,QAAQ,IAAI,CAAC,KAAK,EAAE,CAAC;gBAC5C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extprotocol/sdk/dist/esm/server/auth/middleware/clientAuth.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/clientAuth.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..837f95fd2925472d8493ab3d1f064d2111cc20da --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/clientAuth.d.ts @@ -0,0 +1,19 @@ +import { RequestHandler } from 'express'; +import { OAuthRegisteredClientsStore } from '../clients.js'; +import { OAuthClientInformationFull } from '../../../shared/auth.js'; +export type ClientAuthenticationMiddlewareOptions = { + /** + * A store used to read information about registered OAuth clients. + */ + clientsStore: OAuthRegisteredClientsStore; +}; +declare module 'express-serve-static-core' { + interface Request { + /** + * The authenticated client for this request, if the `authenticateClient` middleware was used. + */ + client?: OAuthClientInformationFull; + } +} +export declare function authenticateClient({ clientsStore }: ClientAuthenticationMiddlewareOptions): RequestHandler; +//# sourceMappingURL=clientAuth.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/clientAuth.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/clientAuth.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..5455132c9f9e31001d246ce7b08b36257afebd71 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/clientAuth.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"clientAuth.d.ts","sourceRoot":"","sources":["../../../../../src/server/auth/middleware/clientAuth.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAGrE,MAAM,MAAM,qCAAqC,GAAG;IAChD;;OAEG;IACH,YAAY,EAAE,2BAA2B,CAAC;CAC7C,CAAC;AAOF,OAAO,QAAQ,2BAA2B,CAAC;IACvC,UAAU,OAAO;QACb;;WAEG;QACH,MAAM,CAAC,EAAE,0BAA0B,CAAC;KACvC;CACJ;AAED,wBAAgB,kBAAkB,CAAC,EAAE,YAAY,EAAE,EAAE,qCAAqC,GAAG,cAAc,CAoC1G"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/clientAuth.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/clientAuth.js new file mode 100644 index 0000000000000000000000000000000000000000..cce72a2d2e360ca9b6fb6a154fc845ada1453785 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/clientAuth.js @@ -0,0 +1,45 @@ +import * as z from 'zod/v4'; +import { InvalidRequestError, InvalidClientError, ServerError, OAuthError } from '../errors.js'; +const ClientAuthenticatedRequestSchema = z.object({ + client_id: z.string(), + client_secret: z.string().optional() +}); +export function authenticateClient({ clientsStore }) { + return async (req, res, next) => { + try { + const result = ClientAuthenticatedRequestSchema.safeParse(req.body); + if (!result.success) { + throw new InvalidRequestError(String(result.error)); + } + const { client_id, client_secret } = result.data; + const client = await clientsStore.getClient(client_id); + if (!client) { + throw new InvalidClientError('Invalid client_id'); + } + if (client.client_secret) { + if (!client_secret) { + throw new InvalidClientError('Client secret is required'); + } + if (client.client_secret !== client_secret) { + throw new InvalidClientError('Invalid client_secret'); + } + if (client.client_secret_expires_at && client.client_secret_expires_at < Math.floor(Date.now() / 1000)) { + throw new InvalidClientError('Client secret has expired'); + } + } + req.client = client; + next(); + } + catch (error) { + if (error instanceof OAuthError) { + const status = error instanceof ServerError ? 500 : 400; + res.status(status).json(error.toResponseObject()); + } + else { + const serverError = new ServerError('Internal Server Error'); + res.status(500).json(serverError.toResponseObject()); + } + } + }; +} +//# sourceMappingURL=clientAuth.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/clientAuth.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/clientAuth.js.map new file mode 100644 index 0000000000000000000000000000000000000000..5023c023b14f3ed729c5ff3ee12c1ac08e7ffd37 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/middleware/clientAuth.js.map @@ -0,0 +1 @@ +{"version":3,"file":"clientAuth.js","sourceRoot":"","sources":["../../../../../src/server/auth/middleware/clientAuth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAI5B,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAShG,MAAM,gCAAgC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACvC,CAAC,CAAC;AAWH,MAAM,UAAU,kBAAkB,CAAC,EAAE,YAAY,EAAyC;IACtF,OAAO,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;QAC5B,IAAI,CAAC;YACD,MAAM,MAAM,GAAG,gCAAgC,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACpE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;gBAClB,MAAM,IAAI,mBAAmB,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YACxD,CAAC;YACD,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,MAAM,CAAC,IAAI,CAAC;YACjD,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;YACvD,IAAI,CAAC,MAAM,EAAE,CAAC;gBACV,MAAM,IAAI,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;YACtD,CAAC;YACD,IAAI,MAAM,CAAC,aAAa,EAAE,CAAC;gBACvB,IAAI,CAAC,aAAa,EAAE,CAAC;oBACjB,MAAM,IAAI,kBAAkB,CAAC,2BAA2B,CAAC,CAAC;gBAC9D,CAAC;gBACD,IAAI,MAAM,CAAC,aAAa,KAAK,aAAa,EAAE,CAAC;oBACzC,MAAM,IAAI,kBAAkB,CAAC,uBAAuB,CAAC,CAAC;gBAC1D,CAAC;gBACD,IAAI,MAAM,CAAC,wBAAwB,IAAI,MAAM,CAAC,wBAAwB,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;oBACrG,MAAM,IAAI,kBAAkB,CAAC,2BAA2B,CAAC,CAAC;gBAC9D,CAAC;YACL,CAAC;YAED,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC;YACpB,IAAI,EAAE,CAAC;QACX,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,IAAI,KAAK,YAAY,UAAU,EAAE,CAAC;gBAC9B,MAAM,MAAM,GAAG,KAAK,YAAY,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;gBACxD,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,CAAC,CAAC;YACtD,CAAC;iBAAM,CAAC;gBACJ,MAAM,WAAW,GAAG,IAAI,WAAW,CAAC,uBAAuB,CAAC,CAAC;gBAC7D,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAC,CAAC;YACzD,CAAC;QACL,CAAC;IACL,CAAC,CAAC;AACN,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/provider.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/provider.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3e4eca392c7fc7e85a1c62a9bcff7983469ece78 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/provider.d.ts @@ -0,0 +1,68 @@ +import { Response } from 'express'; +import { OAuthRegisteredClientsStore } from './clients.js'; +import { OAuthClientInformationFull, OAuthTokenRevocationRequest, OAuthTokens } from '../../shared/auth.js'; +import { AuthInfo } from './types.js'; +export type AuthorizationParams = { + state?: string; + scopes?: string[]; + codeChallenge: string; + redirectUri: string; + resource?: URL; +}; +/** + * Implements an end-to-end OAuth server. + */ +export interface OAuthServerProvider { + /** + * A store used to read information about registered OAuth clients. + */ + get clientsStore(): OAuthRegisteredClientsStore; + /** + * Begins the authorization flow, which can either be implemented by this server itself or via redirection to a separate authorization server. + * + * This server must eventually issue a redirect with an authorization response or an error response to the given redirect URI. Per OAuth 2.1: + * - In the successful case, the redirect MUST include the `code` and `state` (if present) query parameters. + * - In the error case, the redirect MUST include the `error` query parameter, and MAY include an optional `error_description` query parameter. + */ + authorize(client: OAuthClientInformationFull, params: AuthorizationParams, res: Response): Promise; + /** + * Returns the `codeChallenge` that was used when the indicated authorization began. + */ + challengeForAuthorizationCode(client: OAuthClientInformationFull, authorizationCode: string): Promise; + /** + * Exchanges an authorization code for an access token. + */ + exchangeAuthorizationCode(client: OAuthClientInformationFull, authorizationCode: string, codeVerifier?: string, redirectUri?: string, resource?: URL): Promise; + /** + * Exchanges a refresh token for an access token. + */ + exchangeRefreshToken(client: OAuthClientInformationFull, refreshToken: string, scopes?: string[], resource?: URL): Promise; + /** + * Verifies an access token and returns information about it. + */ + verifyAccessToken(token: string): Promise; + /** + * Revokes an access or refresh token. If unimplemented, token revocation is not supported (not recommended). + * + * If the given token is invalid or already revoked, this method should do nothing. + */ + revokeToken?(client: OAuthClientInformationFull, request: OAuthTokenRevocationRequest): Promise; + /** + * Whether to skip local PKCE validation. + * + * If true, the server will not perform PKCE validation locally and will pass the code_verifier to the upstream server. + * + * NOTE: This should only be true if the upstream server is performing the actual PKCE validation. + */ + skipLocalPkceValidation?: boolean; +} +/** + * Slim implementation useful for token verification + */ +export interface OAuthTokenVerifier { + /** + * Verifies an access token and returns information about it. + */ + verifyAccessToken(token: string): Promise; +} +//# sourceMappingURL=provider.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/provider.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/provider.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..d1a4bfff0bf702d518c84d9212ffcf4385c0d311 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/provider.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../src/server/auth/provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,2BAA2B,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC5G,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,MAAM,mBAAmB,GAAG;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,GAAG,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC;;OAEG;IACH,IAAI,YAAY,IAAI,2BAA2B,CAAC;IAEhD;;;;;;OAMG;IACH,SAAS,CAAC,MAAM,EAAE,0BAA0B,EAAE,MAAM,EAAE,mBAAmB,EAAE,GAAG,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzG;;OAEG;IACH,6BAA6B,CAAC,MAAM,EAAE,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE9G;;OAEG;IACH,yBAAyB,CACrB,MAAM,EAAE,0BAA0B,EAClC,iBAAiB,EAAE,MAAM,EACzB,YAAY,CAAC,EAAE,MAAM,EACrB,WAAW,CAAC,EAAE,MAAM,EACpB,QAAQ,CAAC,EAAE,GAAG,GACf,OAAO,CAAC,WAAW,CAAC,CAAC;IAExB;;OAEG;IACH,oBAAoB,CAAC,MAAM,EAAE,0BAA0B,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,QAAQ,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAExI;;OAEG;IACH,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAEpD;;;;OAIG;IACH,WAAW,CAAC,CAAC,MAAM,EAAE,0BAA0B,EAAE,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEtG;;;;;;OAMG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACrC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IAC/B;;OAEG;IACH,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACvD"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/provider.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/provider.js new file mode 100644 index 0000000000000000000000000000000000000000..be31058cd57e7fd29fd577e1e442eaf9caed5124 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/provider.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=provider.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/provider.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/provider.js.map new file mode 100644 index 0000000000000000000000000000000000000000..b968414aa96f6731ef6f6b37f3a47d745f603c8a --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/provider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../../src/server/auth/provider.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/providers/proxyProvider.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/providers/proxyProvider.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ee6f3508172eaedfec4e3dde4f0101836b1172a6 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/providers/proxyProvider.d.ts @@ -0,0 +1,49 @@ +import { Response } from 'express'; +import { OAuthRegisteredClientsStore } from '../clients.js'; +import { OAuthClientInformationFull, OAuthTokenRevocationRequest, OAuthTokens } from '../../../shared/auth.js'; +import { AuthInfo } from '../types.js'; +import { AuthorizationParams, OAuthServerProvider } from '../provider.js'; +import { FetchLike } from '../../../shared/transport.js'; +export type ProxyEndpoints = { + authorizationUrl: string; + tokenUrl: string; + revocationUrl?: string; + registrationUrl?: string; +}; +export type ProxyOptions = { + /** + * Individual endpoint URLs for proxying specific OAuth operations + */ + endpoints: ProxyEndpoints; + /** + * Function to verify access tokens and return auth info + */ + verifyAccessToken: (token: string) => Promise; + /** + * Function to fetch client information from the upstream server + */ + getClient: (clientId: string) => Promise; + /** + * Custom fetch implementation used for all network requests. + */ + fetch?: FetchLike; +}; +/** + * Implements an OAuth server that proxies requests to another OAuth server. + */ +export declare class ProxyOAuthServerProvider implements OAuthServerProvider { + protected readonly _endpoints: ProxyEndpoints; + protected readonly _verifyAccessToken: (token: string) => Promise; + protected readonly _getClient: (clientId: string) => Promise; + protected readonly _fetch?: FetchLike; + skipLocalPkceValidation: boolean; + revokeToken?: (client: OAuthClientInformationFull, request: OAuthTokenRevocationRequest) => Promise; + constructor(options: ProxyOptions); + get clientsStore(): OAuthRegisteredClientsStore; + authorize(client: OAuthClientInformationFull, params: AuthorizationParams, res: Response): Promise; + challengeForAuthorizationCode(_client: OAuthClientInformationFull, _authorizationCode: string): Promise; + exchangeAuthorizationCode(client: OAuthClientInformationFull, authorizationCode: string, codeVerifier?: string, redirectUri?: string, resource?: URL): Promise; + exchangeRefreshToken(client: OAuthClientInformationFull, refreshToken: string, scopes?: string[], resource?: URL): Promise; + verifyAccessToken(token: string): Promise; +} +//# sourceMappingURL=proxyProvider.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/providers/proxyProvider.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/providers/proxyProvider.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..124c105fab50e41d996bf7dd19e0cbc1dba462d2 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/providers/proxyProvider.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"proxyProvider.d.ts","sourceRoot":"","sources":["../../../../../src/server/auth/providers/proxyProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EACH,0BAA0B,EAE1B,2BAA2B,EAC3B,WAAW,EAEd,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1E,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAEzD,MAAM,MAAM,cAAc,GAAG;IAC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AAE,0BAA0B,EAAE,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAM/G,yBAAyB,CAC3B,MAAM,EAAE,0BAA0B,EAClC,iBAAiB,EAAE,MAAM,EACzB,YAAY,CAAC,EAAE,MAAM,EACrB,WAAW,CAAC,EAAE,MAAM,EACpB,QAAQ,CAAC,EAAE,GAAG,GACf,OAAO,CAAC,WAAW,CAAC;IAwCjB,oBAAoB,CACtB,MAAM,EAAE,0BAA0B,EAClC,YAAY,EAAE,MAAM,EACpB,MAAM,CAAC,EAAE,MAAM,EAAE,EACjB,QAAQ,CAAC,EAAE,GAAG,GACf,OAAO,CAAC,WAAW,CAAC;IAoCjB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;CAG5D"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/providers/proxyProvider.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/providers/proxyProvider.js new file mode 100644 index 0000000000000000000000000000000000000000..fef1ff5baa27c921dd399ab8b0de982ebe48427f --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/providers/proxyProvider.js @@ -0,0 +1,155 @@ +import { OAuthClientInformationFullSchema, OAuthTokensSchema } from '../../../shared/auth.js'; +import { ServerError } from '../errors.js'; +/** + * Implements an OAuth server that proxies requests to another OAuth server. + */ +export class ProxyOAuthServerProvider { + constructor(options) { + this.skipLocalPkceValidation = true; + this._endpoints = options.endpoints; + this._verifyAccessToken = options.verifyAccessToken; + this._getClient = options.getClient; + this._fetch = options.fetch; + if (options.endpoints?.revocationUrl) { + this.revokeToken = async (client, request) => { + const revocationUrl = this._endpoints.revocationUrl; + if (!revocationUrl) { + throw new Error('No revocation endpoint configured'); + } + const params = new URLSearchParams(); + params.set('token', request.token); + params.set('client_id', client.client_id); + if (client.client_secret) { + params.set('client_secret', client.client_secret); + } + if (request.token_type_hint) { + params.set('token_type_hint', request.token_type_hint); + } + const response = await (this._fetch ?? fetch)(revocationUrl, { + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded' + }, + body: params.toString() + }); + await response.body?.cancel(); + if (!response.ok) { + throw new ServerError(`Token revocation failed: ${response.status}`); + } + }; + } + } + get clientsStore() { + const registrationUrl = this._endpoints.registrationUrl; + return { + getClient: this._getClient, + ...(registrationUrl && { + registerClient: async (client) => { + const response = await (this._fetch ?? fetch)(registrationUrl, { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(client) + }); + if (!response.ok) { + await response.body?.cancel(); + throw new ServerError(`Client registration failed: ${response.status}`); + } + const data = await response.json(); + return OAuthClientInformationFullSchema.parse(data); + } + }) + }; + } + async authorize(client, params, res) { + // Start with required OAuth parameters + const targetUrl = new URL(this._endpoints.authorizationUrl); + const searchParams = new URLSearchParams({ + client_id: client.client_id, + response_type: 'code', + redirect_uri: params.redirectUri, + code_challenge: params.codeChallenge, + code_challenge_method: 'S256' + }); + // Add optional standard OAuth parameters + if (params.state) + searchParams.set('state', params.state); + if (params.scopes?.length) + searchParams.set('scope', params.scopes.join(' ')); + if (params.resource) + searchParams.set('resource', params.resource.href); + targetUrl.search = searchParams.toString(); + res.redirect(targetUrl.toString()); + } + async challengeForAuthorizationCode(_client, _authorizationCode) { + // In a proxy setup, we don't store the code challenge ourselves + // Instead, we proxy the token request and let the upstream server validate it + return ''; + } + async exchangeAuthorizationCode(client, authorizationCode, codeVerifier, redirectUri, resource) { + const params = new URLSearchParams({ + grant_type: 'authorization_code', + client_id: client.client_id, + code: authorizationCode + }); + if (client.client_secret) { + params.append('client_secret', client.client_secret); + } + if (codeVerifier) { + params.append('code_verifier', codeVerifier); + } + if (redirectUri) { + params.append('redirect_uri', redirectUri); + } + if (resource) { + params.append('resource', resource.href); + } + const response = await (this._fetch ?? fetch)(this._endpoints.tokenUrl, { + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded' + }, + body: params.toString() + }); + if (!response.ok) { + await response.body?.cancel(); + throw new ServerError(`Token exchange failed: ${response.status}`); + } + const data = await response.json(); + return OAuthTokensSchema.parse(data); + } + async exchangeRefreshToken(client, refreshToken, scopes, resource) { + const params = new URLSearchParams({ + grant_type: 'refresh_token', + client_id: client.client_id, + refresh_token: refreshToken + }); + if (client.client_secret) { + params.set('client_secret', client.client_secret); + } + if (scopes?.length) { + params.set('scope', scopes.join(' ')); + } + if (resource) { + params.set('resource', resource.href); + } + const response = await (this._fetch ?? fetch)(this._endpoints.tokenUrl, { + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded' + }, + body: params.toString() + }); + if (!response.ok) { + await response.body?.cancel(); + throw new ServerError(`Token refresh failed: ${response.status}`); + } + const data = await response.json(); + return OAuthTokensSchema.parse(data); + } + async verifyAccessToken(token) { + return this._verifyAccessToken(token); + } +} +//# sourceMappingURL=proxyProvider.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/providers/proxyProvider.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/providers/proxyProvider.js.map new file mode 100644 index 0000000000000000000000000000000000000000..b77ac30873d6ec0bfd2e5770010fadc2494a22a1 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/providers/proxyProvider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"proxyProvider.js","sourceRoot":"","sources":["../../../../../src/server/auth/providers/proxyProvider.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,gCAAgC,EAGhC,iBAAiB,EACpB,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAgC3C;;GAEG;AACH,MAAM,OAAO,wBAAwB;IAUjC,YAAY,OAAqB;QAJjC,4BAAuB,GAAG,IAAI,CAAC;QAK3B,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,SAAS,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AAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;QAC1C,CAAC;QAED,IAAI,QAAQ,EAAE,CAAC;YACX,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC1C,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE;YACpE,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACL,cAAc,EAAE,mCAAmC;aACtD;YACD,IAAI,EAAE,MAAM,CAAC,QAAQ,EAAE;SAC1B,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACf,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;YAC9B,MAAM,IAAI,WAAW,CAAC,yBAAyB,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;QACtE,CAAC;QAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;QACnC,OAAO,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,iBAAiB,CAAC,KAAa;QACjC,OAAO,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;IAC1C,CAAC;CACJ"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/router.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/router.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..43dabde7d298a3e44aa93d84758047409d1b4134 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/router.d.ts @@ -0,0 +1,101 @@ +import express, { RequestHandler } from 'express'; +import { ClientRegistrationHandlerOptions } from './handlers/register.js'; +import { TokenHandlerOptions } from './handlers/token.js'; +import { AuthorizationHandlerOptions } from './handlers/authorize.js'; +import { RevocationHandlerOptions } from './handlers/revoke.js'; +import { OAuthServerProvider } from './provider.js'; +import { OAuthMetadata } from '../../shared/auth.js'; +export type AuthRouterOptions = { + /** + * A provider implementing the actual authorization logic for this router. + */ + provider: OAuthServerProvider; + /** + * The authorization server's issuer identifier, which is a URL that uses the "https" scheme and has no query or fragment components. + */ + issuerUrl: URL; + /** + * The base URL of the authorization server to use for the metadata endpoints. + * + * If not provided, the issuer URL will be used as the base URL. + */ + baseUrl?: URL; + /** + * An optional URL of a page containing human-readable information that developers might want or need to know when using the authorization server. + */ + serviceDocumentationUrl?: URL; + /** + * An optional list of scopes supported by this authorization server + */ + scopesSupported?: string[]; + /** + * The resource name to be displayed in protected resource metadata + */ + resourceName?: string; + /** + * The URL of the protected resource (RS) whose metadata we advertise. + * If not provided, falls back to `baseUrl` and then to `issuerUrl` (AS=RS). + */ + resourceServerUrl?: URL; + authorizationOptions?: Omit; + clientRegistrationOptions?: Omit; + revocationOptions?: Omit; + tokenOptions?: Omit; +}; +export declare const createOAuthMetadata: (options: { + provider: OAuthServerProvider; + issuerUrl: URL; + baseUrl?: URL; + serviceDocumentationUrl?: URL; + scopesSupported?: string[]; +}) => OAuthMetadata; +/** + * Installs standard MCP authorization server endpoints, including dynamic client registration and token revocation (if supported). + * Also advertises standard authorization server metadata, for easier discovery of supported configurations by clients. + * Note: if your MCP server is only a resource server and not an authorization server, use mcpAuthMetadataRouter instead. + * + * By default, rate limiting is applied to all endpoints to prevent abuse. + * + * This router MUST be installed at the application root, like so: + * + * const app = express(); + * app.use(mcpAuthRouter(...)); + */ +export declare function mcpAuthRouter(options: AuthRouterOptions): RequestHandler; +export type AuthMetadataOptions = { + /** + * OAuth Metadata as would be returned from the authorization server + * this MCP server relies on + */ + oauthMetadata: OAuthMetadata; + /** + * The url of the MCP server, for use in protected resource metadata + */ + resourceServerUrl: URL; + /** + * The url for documentation for the MCP server + */ + serviceDocumentationUrl?: URL; + /** + * An optional list of scopes supported by this MCP server + */ + scopesSupported?: string[]; + /** + * An optional resource name to display in resource metadata + */ + resourceName?: string; +}; +export declare function mcpAuthMetadataRouter(options: AuthMetadataOptions): express.Router; +/** + * Helper function to construct the OAuth 2.0 Protected Resource Metadata URL + * from a given server URL. This replaces the path with the standard metadata endpoint. + * + * @param serverUrl - The base URL of the protected resource server + * @returns The URL for the OAuth protected resource metadata endpoint + * + * @example + * getOAuthProtectedResourceMetadataUrl(new URL('https://api.example.com/mcp')) + * // Returns: 'https://api.example.com/.well-known/oauth-protected-resource/mcp' + */ +export declare function getOAuthProtectedResourceMetadataUrl(serverUrl: URL): string; +//# sourceMappingURL=router.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/router.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/router.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..615cb964b8a1d6d83e894910d42666cbbc9535e6 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/router.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../../src/server/auth/router.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAA6B,gCAAgC,EAAE,MAAM,wBAAwB,CAAC;AACrG,OAAO,EAAgB,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAwB,2BAA2B,EAAE,MAAM,yBAAyB,CAAC;AAC5F,OAAO,EAAqB,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,aAAa,EAAkC,MAAM,sBAAsB,CAAC;AAUrF,MAAM,MAAM,iBAAiB,GAAG;IAC5B;;OAEG;IACH,QAAQ,EAAE,mBAAmB,CAAC;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qBAAqB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAuBlF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oCAAoC,CAAC,SAAS,EAAE,GAAG,GAAG,MAAM,CAI3E"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/router.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/router.js new file mode 100644 index 0000000000000000000000000000000000000000..c33a542fca0891d627864fc0fefbce44b4eb32d2 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/router.js @@ -0,0 +1,118 @@ +import express from 'express'; +import { clientRegistrationHandler } from './handlers/register.js'; +import { tokenHandler } from './handlers/token.js'; +import { authorizationHandler } from './handlers/authorize.js'; +import { revocationHandler } from './handlers/revoke.js'; +import { metadataHandler } from './handlers/metadata.js'; +// Check for dev mode flag that allows HTTP issuer URLs (for development/testing only) +const allowInsecureIssuerUrl = process.env.MCP_DANGEROUSLY_ALLOW_INSECURE_ISSUER_URL === 'true' || process.env.MCP_DANGEROUSLY_ALLOW_INSECURE_ISSUER_URL === '1'; +if (allowInsecureIssuerUrl) { + // eslint-disable-next-line no-console + console.warn('MCP_DANGEROUSLY_ALLOW_INSECURE_ISSUER_URL is enabled - HTTP issuer URLs are allowed. Do not use in production.'); +} +const checkIssuerUrl = (issuer) => { + // Technically RFC 8414 does not permit a localhost HTTPS exemption, but this will be necessary for ease of testing + if (issuer.protocol !== 'https:' && issuer.hostname !== 'localhost' && issuer.hostname !== '127.0.0.1' && !allowInsecureIssuerUrl) { + throw new Error('Issuer URL must be HTTPS'); + } + if (issuer.hash) { + throw new Error(`Issuer URL must not have a fragment: ${issuer}`); + } + if (issuer.search) { + throw new Error(`Issuer URL must not have a query string: ${issuer}`); + } +}; +export const createOAuthMetadata = (options) => { + const issuer = options.issuerUrl; + const baseUrl = options.baseUrl; + checkIssuerUrl(issuer); + const authorization_endpoint = '/authorize'; + const token_endpoint = '/token'; + const registration_endpoint = options.provider.clientsStore.registerClient ? '/register' : undefined; + const revocation_endpoint = options.provider.revokeToken ? '/revoke' : undefined; + const metadata = { + issuer: issuer.href, + service_documentation: options.serviceDocumentationUrl?.href, + authorization_endpoint: new URL(authorization_endpoint, baseUrl || issuer).href, + response_types_supported: ['code'], + code_challenge_methods_supported: ['S256'], + token_endpoint: new URL(token_endpoint, baseUrl || issuer).href, + token_endpoint_auth_methods_supported: ['client_secret_post', 'none'], + grant_types_supported: ['authorization_code', 'refresh_token'], + scopes_supported: options.scopesSupported, + revocation_endpoint: revocation_endpoint ? new URL(revocation_endpoint, baseUrl || issuer).href : undefined, + revocation_endpoint_auth_methods_supported: revocation_endpoint ? ['client_secret_post'] : undefined, + registration_endpoint: registration_endpoint ? new URL(registration_endpoint, baseUrl || issuer).href : undefined + }; + return metadata; +}; +/** + * Installs standard MCP authorization server endpoints, including dynamic client registration and token revocation (if supported). + * Also advertises standard authorization server metadata, for easier discovery of supported configurations by clients. + * Note: if your MCP server is only a resource server and not an authorization server, use mcpAuthMetadataRouter instead. + * + * By default, rate limiting is applied to all endpoints to prevent abuse. + * + * This router MUST be installed at the application root, like so: + * + * const app = express(); + * app.use(mcpAuthRouter(...)); + */ +export function mcpAuthRouter(options) { + const oauthMetadata = createOAuthMetadata(options); + const router = express.Router(); + router.use(new URL(oauthMetadata.authorization_endpoint).pathname, authorizationHandler({ provider: options.provider, ...options.authorizationOptions })); + router.use(new URL(oauthMetadata.token_endpoint).pathname, tokenHandler({ provider: options.provider, ...options.tokenOptions })); + router.use(mcpAuthMetadataRouter({ + oauthMetadata, + // Prefer explicit RS; otherwise fall back to AS baseUrl, then to issuer (back-compat) + resourceServerUrl: options.resourceServerUrl ?? options.baseUrl ?? new URL(oauthMetadata.issuer), + serviceDocumentationUrl: options.serviceDocumentationUrl, + scopesSupported: options.scopesSupported, + resourceName: options.resourceName + })); + if (oauthMetadata.registration_endpoint) { + router.use(new URL(oauthMetadata.registration_endpoint).pathname, clientRegistrationHandler({ + clientsStore: options.provider.clientsStore, + ...options.clientRegistrationOptions + })); + } + if (oauthMetadata.revocation_endpoint) { + router.use(new URL(oauthMetadata.revocation_endpoint).pathname, revocationHandler({ provider: options.provider, ...options.revocationOptions })); + } + return router; +} +export function mcpAuthMetadataRouter(options) { + checkIssuerUrl(new URL(options.oauthMetadata.issuer)); + const router = express.Router(); + const protectedResourceMetadata = { + resource: options.resourceServerUrl.href, + authorization_servers: [options.oauthMetadata.issuer], + scopes_supported: options.scopesSupported, + resource_name: options.resourceName, + resource_documentation: options.serviceDocumentationUrl?.href + }; + // Serve PRM at the path-specific URL per RFC 9728 + const rsPath = new URL(options.resourceServerUrl.href).pathname; + router.use(`/.well-known/oauth-protected-resource${rsPath === '/' ? '' : rsPath}`, metadataHandler(protectedResourceMetadata)); + // Always add this for OAuth Authorization Server metadata per RFC 8414 + router.use('/.well-known/oauth-authorization-server', metadataHandler(options.oauthMetadata)); + return router; +} +/** + * Helper function to construct the OAuth 2.0 Protected Resource Metadata URL + * from a given server URL. This replaces the path with the standard metadata endpoint. + * + * @param serverUrl - The base URL of the protected resource server + * @returns The URL for the OAuth protected resource metadata endpoint + * + * @example + * getOAuthProtectedResourceMetadataUrl(new URL('https://api.example.com/mcp')) + * // Returns: 'https://api.example.com/.well-known/oauth-protected-resource/mcp' + */ +export function getOAuthProtectedResourceMetadataUrl(serverUrl) { + const u = new URL(serverUrl.href); + const rsPath = u.pathname && u.pathname !== '/' ? u.pathname : ''; + return new URL(`/.well-known/oauth-protected-resource${rsPath}`, u).href; +} +//# sourceMappingURL=router.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/router.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/router.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6487fb0f45561727d4e26be7bf2162bfec51c948 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/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AC,CAAC,CAAC;IAE9F,OAAO,MAAM,CAAC;AAClB,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,oCAAoC,CAAC,SAAc;IAC/D,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,MAAM,GAAG,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,QAAQ,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IAClE,OAAO,IAAI,GAAG,CAAC,wCAAwC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7E,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/types.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..05ec8485a59b38233a2179681c9c6a81554b5d50 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/types.d.ts @@ -0,0 +1,32 @@ +/** + * Information about a validated access token, provided to request handlers. + */ +export interface AuthInfo { + /** + * The access token. + */ + token: string; + /** + * The client ID associated with this token. + */ + clientId: string; + /** + * Scopes associated with this token. + */ + scopes: string[]; + /** + * When the token expires (in seconds since epoch). + */ + expiresAt?: number; + /** + * The RFC 8707 resource server identifier for which this token is valid. + * If set, this MUST match the MCP server's resource identifier (minus hash fragment). + */ + resource?: URL; + /** + * Additional data associated with the token. + * This field should be used for any additional data that needs to be attached to the auth info. + */ + extra?: Record; +} +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/types.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/types.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..021e947401d30d4c55954c34b9e210d03ceddf31 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/types.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/server/auth/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,QAAQ;IACrB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,MAAM,EAAE,MAAM,EAAE,CAAC;IAEjB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,QAAQ,CAAC,EAAE,GAAG,CAAC;IAEf;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/types.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/types.js new file mode 100644 index 0000000000000000000000000000000000000000..718fd38ae40c67ea23b242517cf9919f602c5a3e --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/types.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/types.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/types.js.map new file mode 100644 index 0000000000000000000000000000000000000000..0d8063dee456d17f8719e9954f76b5dca11da627 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/auth/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/server/auth/types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1b3159ac8f2e593ac24633b5e2681c0bf994d8a8 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.d.ts @@ -0,0 +1,38 @@ +import { AnySchema, SchemaInput } from './zod-compat.js'; +export declare const COMPLETABLE_SYMBOL: unique symbol; +export type CompleteCallback = (value: SchemaInput, context?: { + arguments?: Record; +}) => SchemaInput[] | Promise[]>; +export type CompletableMeta = { + complete: CompleteCallback; +}; +export type CompletableSchema = T & { + [COMPLETABLE_SYMBOL]: CompletableMeta; +}; +/** + * Wraps a Zod type to provide autocompletion capabilities. Useful for, e.g., prompt arguments in MCP. + * Works with both Zod v3 and v4 schemas. + */ +export declare function completable(schema: T, complete: CompleteCallback): CompletableSchema; +/** + * Checks if a schema is completable (has completion metadata). + */ +export declare function isCompletable(schema: unknown): schema is CompletableSchema; +/** + * Gets the completer callback from a completable schema, if it exists. + */ +export declare function getCompleter(schema: T): CompleteCallback | undefined; +/** + * Unwraps a completable schema to get the underlying schema. + * For backward compatibility with code that called `.unwrap()`. + */ +export declare function unwrapCompletable(schema: CompletableSchema): T; +export declare enum McpZodTypeKind { + Completable = "McpCompletable" +} +export interface CompletableDef { + type: T; + complete: CompleteCallback; + typeName: McpZodTypeKind.Completable; +} +//# sourceMappingURL=completable.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..83ea2f1e2704457a90ed761f77a6b49f6d8b6285 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"completable.d.ts","sourceRoot":"","sources":["../../../src/server/completable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,WAAW,EA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,MAAM,WAAW,cAAc,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS;IAC3D,IAAI,EAAE,CAAC,CAAC;IACR,QAAQ,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAC9B,QAAQ,EAAE,cAAc,CAAC,WAAW,CAAC;CACxC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js new file mode 100644 index 0000000000000000000000000000000000000000..827f7d41992d116298af0c6680adfe9de11ab28d --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js @@ -0,0 +1,41 @@ +export const COMPLETABLE_SYMBOL = Symbol.for('mcp.completable'); +/** + * Wraps a Zod type to provide autocompletion capabilities. Useful for, e.g., prompt arguments in MCP. + * Works with both Zod v3 and v4 schemas. + */ +export function completable(schema, complete) { + Object.defineProperty(schema, COMPLETABLE_SYMBOL, { + value: { complete }, + enumerable: false, + writable: false, + configurable: false + }); + return schema; +} +/** + * Checks if a schema is completable (has completion metadata). + */ +export function isCompletable(schema) { + return !!schema && typeof schema === 'object' && COMPLETABLE_SYMBOL in schema; +} +/** + * Gets the completer callback from a completable schema, if it exists. + */ +export function getCompleter(schema) { + const meta = schema[COMPLETABLE_SYMBOL]; + return meta?.complete; +} +/** + * Unwraps a completable schema to get the underlying schema. + * For backward compatibility with code that called `.unwrap()`. + */ +export function unwrapCompletable(schema) { + return schema; +} +// Legacy exports for backward compatibility +// These types are deprecated but kept for existing code +export var McpZodTypeKind; +(function (McpZodTypeKind) { + McpZodTypeKind["Completable"] = "McpCompletable"; +})(McpZodTypeKind || (McpZodTypeKind = {})); +//# sourceMappingURL=completable.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js.map new file mode 100644 index 0000000000000000000000000000000000000000..a5ae859b1c8e0e0a73307c3113a3b239431e9a5e --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js.map @@ -0,0 +1 @@ +{"version":3,"file":"completable.js","sourceRoot":"","sources":["../../../src/server/completable.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,kBAAkB,GAAkB,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;AAiB/E;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAsB,MAAS,EAAE,QAA6B;IACrF,MAAM,CAAC,cAAc,CAAC,MAAgB,EAAE,kBAAkB,EAAE;QACxD,KAAK,EAAE,EAAE,QAAQ,EAAwB;QACzC,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,KAAK;QACf,YAAY,EAAE,KAAK;KACtB,CAAC,CAAC;IACH,OAAO,MAA8B,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,MAAe;IACzC,OAAO,CAAC,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,kBAAkB,IAAK,MAAiB,CAAC;AAC9F,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAsB,MAAS;IACvD,MAAM,IAAI,GAAI,MAAmE,CAAC,kBAAkB,CAAC,CAAC;IACtG,OAAO,IAAI,EAAE,QAA2C,CAAC;AAC7D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAsB,MAA4B;IAC/E,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,4CAA4C;AAC5C,wDAAwD;AACxD,MAAM,CAAN,IAAY,cAEX;AAFD,WAAY,cAAc;IACtB,gDAA8B,CAAA;AAClC,CAAC,EAFW,cAAc,KAAd,cAAc,QAEzB"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/express.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/express.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7746e823b08213b390effe89cd0597256bb15ea8 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/express.d.ts @@ -0,0 +1,45 @@ +import { Express } from 'express'; +/** + * Options for creating an MCP Express application. + */ +export interface CreateMcpExpressAppOptions { + /** + * The hostname to bind to. Defaults to '127.0.0.1'. + * When set to '127.0.0.1', 'localhost', or '::1', DNS rebinding protection is automatically enabled. + */ + host?: string; + /** + * List of allowed hostnames for DNS rebinding protection. + * If provided, host header validation will be applied using this list. + * For IPv6, provide addresses with brackets (e.g., '[::1]'). + * + * This is useful when binding to '0.0.0.0' or '::' but still wanting + * to restrict which hostnames are allowed. + */ + allowedHosts?: string[]; +} +/** + * Creates an Express application pre-configured for MCP servers. + * + * When the host is '127.0.0.1', 'localhost', or '::1' (the default is '127.0.0.1'), + * DNS rebinding protection middleware is automatically applied to protect against + * DNS rebinding attacks on localhost servers. + * + * @param options - Configuration options + * @returns A configured Express application + * + * @example + * ```typescript + * // Basic usage - defaults to 127.0.0.1 with DNS rebinding protection + * const app = createMcpExpressApp(); + * + * // Custom host - DNS rebinding protection only applied for localhost hosts + * const app = createMcpExpressApp({ host: '0.0.0.0' }); // No automatic DNS rebinding protection + * const app = createMcpExpressApp({ host: 'localhost' }); // DNS rebinding protection enabled + * + * // Custom allowed hosts for non-localhost binding + * const app = createMcpExpressApp({ host: '0.0.0.0', allowedHosts: ['myapp.local', 'localhost'] }); + * ``` + */ +export declare function createMcpExpressApp(options?: CreateMcpExpressAppOptions): Express; +//# sourceMappingURL=express.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/express.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/express.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..5f607a9a972c762cd36693a36b18942acc2d373a --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/express.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"express.d.ts","sourceRoot":"","sources":["../../../src/server/express.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAG3C;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACvC;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;;;;OAOG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,GAAE,0BAA+B,GAAG,OAAO,CA0BrF"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/express.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/express.js new file mode 100644 index 0000000000000000000000000000000000000000..a23a57bf72126f2535da5d7e5423883ed1ca45c4 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/express.js @@ -0,0 +1,50 @@ +import express from 'express'; +import { hostHeaderValidation, localhostHostValidation } from './middleware/hostHeaderValidation.js'; +/** + * Creates an Express application pre-configured for MCP servers. + * + * When the host is '127.0.0.1', 'localhost', or '::1' (the default is '127.0.0.1'), + * DNS rebinding protection middleware is automatically applied to protect against + * DNS rebinding attacks on localhost servers. + * + * @param options - Configuration options + * @returns A configured Express application + * + * @example + * ```typescript + * // Basic usage - defaults to 127.0.0.1 with DNS rebinding protection + * const app = createMcpExpressApp(); + * + * // Custom host - DNS rebinding protection only applied for localhost hosts + * const app = createMcpExpressApp({ host: '0.0.0.0' }); // No automatic DNS rebinding protection + * const app = createMcpExpressApp({ host: 'localhost' }); // DNS rebinding protection enabled + * + * // Custom allowed hosts for non-localhost binding + * const app = createMcpExpressApp({ host: '0.0.0.0', allowedHosts: ['myapp.local', 'localhost'] }); + * ``` + */ +export function createMcpExpressApp(options = {}) { + const { host = '127.0.0.1', allowedHosts } = options; + const app = express(); + app.use(express.json()); + // If allowedHosts is explicitly provided, use that for validation + if (allowedHosts) { + app.use(hostHeaderValidation(allowedHosts)); + } + else { + // Apply DNS rebinding protection automatically for localhost hosts + const localhostHosts = ['127.0.0.1', 'localhost', '::1']; + if (localhostHosts.includes(host)) { + app.use(localhostHostValidation()); + } + else if (host === '0.0.0.0' || host === '::') { + // Warn when binding to all interfaces without DNS rebinding protection + // eslint-disable-next-line no-console + console.warn(`Warning: Server is binding to ${host} without DNS rebinding protection. ` + + 'Consider using the allowedHosts option to restrict allowed hosts, ' + + 'or use authentication to protect your server.'); + } + } + return app; +} +//# sourceMappingURL=express.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/express.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/express.js.map new file mode 100644 index 0000000000000000000000000000000000000000..0ebc4c88c032a7be62286306c97792c8253372fa --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/express.js.map @@ -0,0 +1 @@ +{"version":3,"file":"express.js","sourceRoot":"","sources":["../../../src/server/express.ts"],"names":[],"mappings":"AAAA,OAAO,OAAoB,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAuBrG;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,mBAAmB,CAAC,UAAsC,EAAE;IACxE,MAAM,EAAE,IAAI,GAAG,WAAW,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC;IAErD,MAAM,GAAG,GAAG,OAAO,EAAE,CAAC;IACtB,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC;IAExB,kEAAkE;IAClE,IAAI,YAAY,EAAE,CAAC;QACf,GAAG,CAAC,GAAG,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC,CAAC;IAChD,CAAC;SAAM,CAAC;QACJ,mEAAmE;QACnE,MAAM,cAAc,GAAG,CAAC,WAAW,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;QACzD,IAAI,cAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAChC,GAAG,CAAC,GAAG,CAAC,uBAAuB,EAAE,CAAC,CAAC;QACvC,CAAC;aAAM,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAC7C,uEAAuE;YACvE,sCAAsC;YACtC,OAAO,CAAC,IAAI,CACR,iCAAiC,IAAI,qCAAqC;gBACtE,oEAAoE;gBACpE,+CAA+C,CACtD,CAAC;QACN,CAAC;IACL,CAAC;IAED,OAAO,GAAG,CAAC;AACf,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cfa236eb0fd090cb5a015009cf2b245fbbdb74d3 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.d.ts @@ -0,0 +1,196 @@ +import { Protocol, type NotificationOptions, type ProtocolOptions, type RequestOptions } from '../shared/protocol.js'; +import { type ClientCapabilities, type CreateMessageRequest, type CreateMessageResult, type CreateMessageResultWithTools, type CreateMessageRequestParamsBase, type CreateMessageRequestParamsWithTools, type ElicitRequestFormParams, type ElicitRequestURLParams, type ElicitResult, type Implementation, type ListRootsRequest, type LoggingMessageNotification, type ResourceUpdatedNotification, type ServerCapabilities, type ServerNotification, type ServerRequest, type ServerResult, type Request, type Notification, type Result } from '../types.js'; +import type { jsonSchemaValidator } from '../validation/types.js'; +import { AnyObjectSchema, SchemaOutput } from './zod-compat.js'; +import { RequestHandlerExtra } from '../shared/protocol.js'; +import { ExperimentalServerTasks } from '../experimental/tasks/server.js'; +export type ServerOptions = ProtocolOptions & { + /** + * Capabilities to advertise as being supported by this server. + */ + capabilities?: ServerCapabilities; + /** + * Optional instructions describing how to use the server and its features. + */ + instructions?: string; + /** + * JSON Schema validator for elicitation response validation. + * + * The validator is used to validate user input returned from elicitation + * requests against the requested schema. + * + * @default AjvJsonSchemaValidator + * + * @example + * ```typescript + * // ajv (default) + * const server = new Server( + * { name: 'my-server', version: '1.0.0' }, + * { + * capabilities: {} + * jsonSchemaValidator: new AjvJsonSchemaValidator() + * } + * ); + * + * // @cfworker/json-schema + * const server = new Server( + * { name: 'my-server', version: '1.0.0' }, + * { + * capabilities: {}, + * jsonSchemaValidator: new CfWorkerJsonSchemaValidator() + * } + * ); + * ``` + */ + jsonSchemaValidator?: jsonSchemaValidator; +}; +/** + * An MCP server on top of a pluggable transport. + * + * This server will automatically respond to the initialization flow as initiated from the client. + * + * To use with custom types, extend the base Request/Notification/Result types and pass them as type parameters: + * + * ```typescript + * // Custom schemas + * const CustomRequestSchema = RequestSchema.extend({...}) + * const CustomNotificationSchema = NotificationSchema.extend({...}) + * const CustomResultSchema = ResultSchema.extend({...}) + * + * // Type aliases + * type CustomRequest = z.infer + * type CustomNotification = z.infer + * type CustomResult = z.infer + * + * // Create typed server + * const server = new Server({ + * name: "CustomServer", + * version: "1.0.0" + * }) + * ``` + * @deprecated Use `McpServer` instead for the high-level API. Only use `Server` for advanced use cases. + */ +export declare class Server extends Protocol { + private _serverInfo; + private _clientCapabilities?; + private _clientVersion?; + private _capabilities; + private _instructions?; + private _jsonSchemaValidator; + private _experimental?; + /** + * Callback for when initialization has fully completed (i.e., the client has sent an `initialized` notification). + */ + oninitialized?: () => void; + /** + * Initializes this server with the given name and version information. + */ + constructor(_serverInfo: Implementation, options?: ServerOptions); + /** + * Access experimental features. + * + * WARNING: These APIs are experimental and may change without notice. + * + * @experimental + */ + get experimental(): { + tasks: ExperimentalServerTasks; + }; + private _loggingLevels; + private readonly LOG_LEVEL_SEVERITY; + private isMessageIgnored; + /** + * Registers new capabilities. This can only be called before connecting to a transport. + * + * The new capabilities will be merged with any existing capabilities previously given (e.g., at initialization). + */ + registerCapabilities(capabilities: ServerCapabilities): void; + /** + * Override request handler registration to enforce server-side validation for tools/call. + */ + setRequestHandler(requestSchema: T, handler: (request: SchemaOutput, extra: RequestHandlerExtra) => ServerResult | ResultT | Promise): void; + protected assertCapabilityForMethod(method: RequestT['method']): void; + protected assertNotificationCapability(method: (ServerNotification | NotificationT)['method']): void; + protected assertRequestHandlerCapability(method: string): void; + protected assertTaskCapability(method: string): void; + protected assertTaskHandlerCapability(method: string): void; + private _oninitialize; + /** + * After initialization has completed, this will be populated with the client's reported capabilities. + */ + getClientCapabilities(): ClientCapabilities | undefined; + /** + * After initialization has completed, this will be populated with information about the client's name and version. + */ + getClientVersion(): Implementation | undefined; + private getCapabilities; + ping(): Promise<{ + _meta?: { + [x: string]: unknown; + progressToken?: string | number | undefined; + "io.modelcontextprotocol/related-task"?: { + taskId: string; + } | undefined; + } | undefined; + }>; + /** + * Request LLM sampling from the client (without tools). + * Returns single content block for backwards compatibility. + */ + createMessage(params: CreateMessageRequestParamsBase, options?: RequestOptions): Promise; + /** + * Request LLM sampling from the client with tool support. + * Returns content that may be a single block or array (for parallel tool calls). + */ + createMessage(params: CreateMessageRequestParamsWithTools, options?: RequestOptions): Promise; + /** + * Request LLM sampling from the client. + * When tools may or may not be present, returns the union type. + */ + createMessage(params: CreateMessageRequest['params'], options?: RequestOptions): Promise; + /** + * Creates an elicitation request for the given parameters. + * For backwards compatibility, `mode` may be omitted for form requests and will default to `'form'`. + * @param params The parameters for the elicitation request. + * @param options Optional request options. + * @returns The result of the elicitation request. + */ + elicitInput(params: ElicitRequestFormParams | ElicitRequestURLParams, options?: RequestOptions): Promise; + /** + * Creates a reusable callback that, when invoked, will send a `notifications/elicitation/complete` + * notification for the specified elicitation ID. + * + * @param elicitationId The ID of the elicitation to mark as complete. + * @param options Optional notification options. Useful when the completion notification should be related to a prior request. + * @returns A function that emits the completion notification when awaited. + */ + createElicitationCompletionNotifier(elicitationId: string, options?: NotificationOptions): () => Promise; + listRoots(params?: ListRootsRequest['params'], options?: RequestOptions): Promise<{ + [x: string]: unknown; + roots: { + uri: string; + name?: string | undefined; + _meta?: Record | undefined; + }[]; + _meta?: { + [x: string]: unknown; + progressToken?: string | number | undefined; + "io.modelcontextprotocol/related-task"?: { + taskId: string; + } | undefined; + } | undefined; + }>; + /** + * Sends a logging message to the client, if connected. + * Note: You only need to send the parameters object, not the entire JSON RPC message + * @see LoggingMessageNotification + * @param params + * @param sessionId optional for stateless and backward compatibility + */ + sendLoggingMessage(params: LoggingMessageNotification['params'], sessionId?: string): Promise; + sendResourceUpdated(params: ResourceUpdatedNotification['params']): Promise; + sendResourceListChanged(): Promise; + sendToolListChanged(): Promise; + sendPromptListChanged(): Promise; +} +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..925131d36693e2d1269d96b208452a1c06506955 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,QAAQ,EAAE,KAAK,mBAAmB,EAAE,KAAK,eAAe,EAAE,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACzI,OAAO,EACH,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EAExB,KAAK,4BAA4B,EAEjC,KAAK,8BAA8B,EACnC,KAAK,mCAAmC,EACxC,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EAIjB,KAAK,cAAc,EAMnB,KAAK,gBAAgB,EAIrB,KAAK,0BAA0B,EAE/B,KAAK,2BAA2B,EAChC,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,E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AAC,EAAE,cAAc,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAEnH;;;OAGG;IACG,aAAa,CAAC,MAAM,EAAE,mCAAmC,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,4BAA4B,CAAC;IAEjI;;;OAGG;IACG,aAAa,CACf,MAAM,EAAE,oBAAoB,CAAC,QAAQ,CAAC,EACtC,OAAO,CAAC,EAAE,cAAc,GACzB,OAAO,CAAC,mBAAmB,GAAG,4BAA4B,CAAC;IAwD9D;;;;;;OAMG;IACG,WAAW,CAAC,MAAM,EAAE,uBAAuB,GAAG,sBAAsB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;IAgD5H;;;;;;;OAOG;IACH,mCAAmC,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,mBAAmB,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC;IAiBxG,SAAS,CAAC,MAAM,CAAC,EAAE,gBAAgB,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,EAAE,cAAc;;;;;;;;;;;;;;;IAI7E;;;;;;OAMG;IACG,kBAAkB,CAAC,MAAM,EAAE,0BAA0B,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,EAAE,MAAM;IAQnF,mBAAmB,CAAC,MAAM,EAAE,2BAA2B,CAAC,QAAQ,CAAC;IAOjE,uBAAuB;IAMvB,mBAAmB;IAInB,qBAAqB;CAG9B"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js new file mode 100644 index 0000000000000000000000000000000000000000..2f09afe1d4861f3f627f5ea356edbf2a8e379bf9 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js @@ -0,0 +1,429 @@ +import { mergeCapabilities, Protocol } from '../shared/protocol.js'; +import { CreateMessageResultSchema, CreateMessageResultWithToolsSchema, ElicitResultSchema, EmptyResultSchema, ErrorCode, InitializedNotificationSchema, InitializeRequestSchema, LATEST_PROTOCOL_VERSION, ListRootsResultSchema, LoggingLevelSchema, McpError, SetLevelRequestSchema, SUPPORTED_PROTOCOL_VERSIONS, CallToolRequestSchema, CallToolResultSchema, CreateTaskResultSchema } from '../types.js'; +import { AjvJsonSchemaValidator } from '../validation/ajv-provider.js'; +import { getLiteralValue, getObjectShape, safeParse } from './zod-compat.js'; +import { ExperimentalServerTasks } from '../experimental/tasks/server.js'; +import { assertToolsCallTaskCapability, assertClientRequestTaskCapability } from '../experimental/tasks/helpers.js'; +/** + * An MCP server on top of a pluggable transport. + * + * This server will automatically respond to the initialization flow as initiated from the client. + * + * To use with custom types, extend the base Request/Notification/Result types and pass them as type parameters: + * + * ```typescript + * // Custom schemas + * const CustomRequestSchema = RequestSchema.extend({...}) + * const CustomNotificationSchema = NotificationSchema.extend({...}) + * const CustomResultSchema = ResultSchema.extend({...}) + * + * // Type aliases + * type CustomRequest = z.infer + * type CustomNotification = z.infer + * type CustomResult = z.infer + * + * // Create typed server + * const server = new Server({ + * name: "CustomServer", + * version: "1.0.0" + * }) + * ``` + * @deprecated Use `McpServer` instead for the high-level API. Only use `Server` for advanced use cases. + */ +export class Server extends Protocol { + /** + * Initializes this server with the given name and version information. + */ + constructor(_serverInfo, options) { + super(options); + this._serverInfo = _serverInfo; + // Map log levels by session id + this._loggingLevels = new Map(); + // Map LogLevelSchema to severity index + this.LOG_LEVEL_SEVERITY = new Map(LoggingLevelSchema.options.map((level, index) => [level, index])); + // Is a message with the given level ignored in the log level set for the given session id? + this.isMessageIgnored = (level, sessionId) => { + const currentLevel = this._loggingLevels.get(sessionId); + return currentLevel ? this.LOG_LEVEL_SEVERITY.get(level) < this.LOG_LEVEL_SEVERITY.get(currentLevel) : false; + }; + this._capabilities = options?.capabilities ?? {}; + this._instructions = options?.instructions; + this._jsonSchemaValidator = options?.jsonSchemaValidator ?? new AjvJsonSchemaValidator(); + this.setRequestHandler(InitializeRequestSchema, request => this._oninitialize(request)); + this.setNotificationHandler(InitializedNotificationSchema, () => this.oninitialized?.()); + if (this._capabilities.logging) { + this.setRequestHandler(SetLevelRequestSchema, async (request, extra) => { + const transportSessionId = extra.sessionId || extra.requestInfo?.headers['mcp-session-id'] || undefined; + const { level } = request.params; + const parseResult = LoggingLevelSchema.safeParse(level); + if (parseResult.success) { + this._loggingLevels.set(transportSessionId, parseResult.data); + } + return {}; + }); + } + } + /** + * Access experimental features. + * + * WARNING: These APIs are experimental and may change without notice. + * + * @experimental + */ + get experimental() { + if (!this._experimental) { + this._experimental = { + tasks: new ExperimentalServerTasks(this) + }; + } + return this._experimental; + } + /** + * Registers new capabilities. This can only be called before connecting to a transport. + * + * The new capabilities will be merged with any existing capabilities previously given (e.g., at initialization). + */ + registerCapabilities(capabilities) { + if (this.transport) { + throw new Error('Cannot register capabilities after connecting to transport'); + } + this._capabilities = mergeCapabilities(this._capabilities, capabilities); + } + /** + * Override request handler registration to enforce server-side validation for tools/call. + */ + setRequestHandler(requestSchema, handler) { + const shape = getObjectShape(requestSchema); + const methodSchema = shape?.method; + if (!methodSchema) { + throw new Error('Schema is missing a method literal'); + } + const methodValue = getLiteralValue(methodSchema); + if (typeof methodValue !== 'string') { + throw new Error('Schema method literal must be a string'); + } + const method = methodValue; + if (method === 'tools/call') { + const wrappedHandler = async (request, extra) => { + const validatedRequest = safeParse(CallToolRequestSchema, request); + if (!validatedRequest.success) { + const errorMessage = validatedRequest.error instanceof Error ? validatedRequest.error.message : String(validatedRequest.error); + throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call request: ${errorMessage}`); + } + const { params } = validatedRequest.data; + const result = await Promise.resolve(handler(request, extra)); + // When task creation is requested, validate and return CreateTaskResult + if (params.task) { + const taskValidationResult = safeParse(CreateTaskResultSchema, result); + if (!taskValidationResult.success) { + const errorMessage = taskValidationResult.error instanceof Error + ? taskValidationResult.error.message + : String(taskValidationResult.error); + throw new McpError(ErrorCode.InvalidParams, `Invalid task creation result: ${errorMessage}`); + } + return taskValidationResult.data; + } + // For non-task requests, validate against CallToolResultSchema + const validationResult = safeParse(CallToolResultSchema, result); + if (!validationResult.success) { + const errorMessage = validationResult.error instanceof Error ? validationResult.error.message : String(validationResult.error); + throw new McpError(ErrorCode.InvalidParams, `Invalid tools/call result: ${errorMessage}`); + } + return validationResult.data; + }; + // Install the wrapped handler + return super.setRequestHandler(requestSchema, wrappedHandler); + } + // Other handlers use default behavior + return super.setRequestHandler(requestSchema, handler); + } + assertCapabilityForMethod(method) { + switch (method) { + case 'sampling/createMessage': + if (!this._clientCapabilities?.sampling) { + throw new Error(`Client does not support sampling (required for ${method})`); + } + break; + case 'elicitation/create': + if (!this._clientCapabilities?.elicitation) { + throw new Error(`Client does not support elicitation (required for ${method})`); + } + break; + case 'roots/list': + if (!this._clientCapabilities?.roots) { + throw new Error(`Client does not support listing roots (required for ${method})`); + } + break; + case 'ping': + // No specific capability required for ping + break; + } + } + assertNotificationCapability(method) { + switch (method) { + case 'notifications/message': + if (!this._capabilities.logging) { + throw new Error(`Server does not support logging (required for ${method})`); + } + break; + case 'notifications/resources/updated': + case 'notifications/resources/list_changed': + if (!this._capabilities.resources) { + throw new Error(`Server does not support notifying about resources (required for ${method})`); + } + break; + case 'notifications/tools/list_changed': + if (!this._capabilities.tools) { + throw new Error(`Server does not support notifying of tool list changes (required for ${method})`); + } + break; + case 'notifications/prompts/list_changed': + if (!this._capabilities.prompts) { + throw new Error(`Server does not support notifying of prompt list changes (required for ${method})`); + } + break; + case 'notifications/elicitation/complete': + if (!this._clientCapabilities?.elicitation?.url) { + throw new Error(`Client does not support URL elicitation (required for ${method})`); + } + break; + case 'notifications/cancelled': + // Cancellation notifications are always allowed + break; + case 'notifications/progress': + // Progress notifications are always allowed + break; + } + } + assertRequestHandlerCapability(method) { + // Task handlers are registered in Protocol constructor before _capabilities is initialized + // Skip capability check for task methods during initialization + if (!this._capabilities) { + return; + } + switch (method) { + case 'completion/complete': + if (!this._capabilities.completions) { + throw new Error(`Server does not support completions (required for ${method})`); + } + break; + case 'logging/setLevel': + if (!this._capabilities.logging) { + throw new Error(`Server does not support logging (required for ${method})`); + } + break; + case 'prompts/get': + case 'prompts/list': + if (!this._capabilities.prompts) { + throw new Error(`Server does not support prompts (required for ${method})`); + } + break; + case 'resources/list': + case 'resources/templates/list': + case 'resources/read': + if (!this._capabilities.resources) { + throw new Error(`Server does not support resources (required for ${method})`); + } + break; + case 'tools/call': + case 'tools/list': + if (!this._capabilities.tools) { + throw new Error(`Server does not support tools (required for ${method})`); + } + break; + case 'tasks/get': + case 'tasks/list': + case 'tasks/result': + case 'tasks/cancel': + if (!this._capabilities.tasks) { + throw new Error(`Server does not support tasks capability (required for ${method})`); + } + break; + case 'ping': + case 'initialize': + // No specific capability required for these methods + break; + } + } + assertTaskCapability(method) { + assertClientRequestTaskCapability(this._clientCapabilities?.tasks?.requests, method, 'Client'); + } + assertTaskHandlerCapability(method) { + // Task handlers are registered in Protocol constructor before _capabilities is initialized + // Skip capability check for task methods during initialization + if (!this._capabilities) { + return; + } + assertToolsCallTaskCapability(this._capabilities.tasks?.requests, method, 'Server'); + } + async _oninitialize(request) { + const requestedVersion = request.params.protocolVersion; + this._clientCapabilities = request.params.capabilities; + this._clientVersion = request.params.clientInfo; + const protocolVersion = SUPPORTED_PROTOCOL_VERSIONS.includes(requestedVersion) ? requestedVersion : LATEST_PROTOCOL_VERSION; + return { + protocolVersion, + capabilities: this.getCapabilities(), + serverInfo: this._serverInfo, + ...(this._instructions && { instructions: this._instructions }) + }; + } + /** + * After initialization has completed, this will be populated with the client's reported capabilities. + */ + getClientCapabilities() { + return this._clientCapabilities; + } + /** + * After initialization has completed, this will be populated with information about the client's name and version. + */ + getClientVersion() { + return this._clientVersion; + } + getCapabilities() { + return this._capabilities; + } + async ping() { + return this.request({ method: 'ping' }, EmptyResultSchema); + } + // Implementation + async createMessage(params, options) { + // Capability check - only required when tools/toolChoice are provided + if (params.tools || params.toolChoice) { + if (!this._clientCapabilities?.sampling?.tools) { + throw new Error('Client does not support sampling tools capability.'); + } + } + // Message structure validation - always validate tool_use/tool_result pairs. + // These may appear even without tools/toolChoice in the current request when + // a previous sampling request returned tool_use and this is a follow-up with results. + if (params.messages.length > 0) { + const lastMessage = params.messages[params.messages.length - 1]; + const lastContent = Array.isArray(lastMessage.content) ? lastMessage.content : [lastMessage.content]; + const hasToolResults = lastContent.some(c => c.type === 'tool_result'); + const previousMessage = params.messages.length > 1 ? params.messages[params.messages.length - 2] : undefined; + const previousContent = previousMessage + ? Array.isArray(previousMessage.content) + ? previousMessage.content + : [previousMessage.content] + : []; + const hasPreviousToolUse = previousContent.some(c => c.type === 'tool_use'); + if (hasToolResults) { + if (lastContent.some(c => c.type !== 'tool_result')) { + throw new Error('The last message must contain only tool_result content if any is present'); + } + if (!hasPreviousToolUse) { + throw new Error('tool_result blocks are not matching any tool_use from the previous message'); + } + } + if (hasPreviousToolUse) { + const toolUseIds = new Set(previousContent.filter(c => c.type === 'tool_use').map(c => c.id)); + const toolResultIds = new Set(lastContent.filter(c => c.type === 'tool_result').map(c => c.toolUseId)); + if (toolUseIds.size !== toolResultIds.size || ![...toolUseIds].every(id => toolResultIds.has(id))) { + throw new Error('ids of tool_result blocks and tool_use blocks from previous message do not match'); + } + } + } + // Use different schemas based on whether tools are provided + if (params.tools) { + return this.request({ method: 'sampling/createMessage', params }, CreateMessageResultWithToolsSchema, options); + } + return this.request({ method: 'sampling/createMessage', params }, CreateMessageResultSchema, options); + } + /** + * Creates an elicitation request for the given parameters. + * For backwards compatibility, `mode` may be omitted for form requests and will default to `'form'`. + * @param params The parameters for the elicitation request. + * @param options Optional request options. + * @returns The result of the elicitation request. + */ + async elicitInput(params, options) { + const mode = (params.mode ?? 'form'); + switch (mode) { + case 'url': { + if (!this._clientCapabilities?.elicitation?.url) { + throw new Error('Client does not support url elicitation.'); + } + const urlParams = params; + return this.request({ method: 'elicitation/create', params: urlParams }, ElicitResultSchema, options); + } + case 'form': { + if (!this._clientCapabilities?.elicitation?.form) { + throw new Error('Client does not support form elicitation.'); + } + const formParams = params.mode === 'form' ? params : { ...params, mode: 'form' }; + const result = await this.request({ method: 'elicitation/create', params: formParams }, ElicitResultSchema, options); + if (result.action === 'accept' && result.content && formParams.requestedSchema) { + try { + const validator = this._jsonSchemaValidator.getValidator(formParams.requestedSchema); + const validationResult = validator(result.content); + if (!validationResult.valid) { + throw new McpError(ErrorCode.InvalidParams, `Elicitation response content does not match requested schema: ${validationResult.errorMessage}`); + } + } + catch (error) { + if (error instanceof McpError) { + throw error; + } + throw new McpError(ErrorCode.InternalError, `Error validating elicitation response: ${error instanceof Error ? error.message : String(error)}`); + } + } + return result; + } + } + } + /** + * Creates a reusable callback that, when invoked, will send a `notifications/elicitation/complete` + * notification for the specified elicitation ID. + * + * @param elicitationId The ID of the elicitation to mark as complete. + * @param options Optional notification options. Useful when the completion notification should be related to a prior request. + * @returns A function that emits the completion notification when awaited. + */ + createElicitationCompletionNotifier(elicitationId, options) { + if (!this._clientCapabilities?.elicitation?.url) { + throw new Error('Client does not support URL elicitation (required for notifications/elicitation/complete)'); + } + return () => this.notification({ + method: 'notifications/elicitation/complete', + params: { + elicitationId + } + }, options); + } + async listRoots(params, options) { + return this.request({ method: 'roots/list', params }, ListRootsResultSchema, options); + } + /** + * Sends a logging message to the client, if connected. + * Note: You only need to send the parameters object, not the entire JSON RPC message + * @see LoggingMessageNotification + * @param params + * @param sessionId optional for stateless and backward compatibility + */ + async sendLoggingMessage(params, sessionId) { + if (this._capabilities.logging) { + if (!this.isMessageIgnored(params.level, sessionId)) { + return this.notification({ method: 'notifications/message', params }); + } + } + } + async sendResourceUpdated(params) { + return this.notification({ + method: 'notifications/resources/updated', + params + }); + } + async sendResourceListChanged() { + return this.notification({ + method: 'notifications/resources/list_changed' + }); + } + async sendToolListChanged() { + return this.notification({ method: 'notifications/tools/list_changed' }); + } + async sendPromptListChanged() { + return this.notification({ method: 'notifications/prompts/list_changed' }); + } +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..212d2bb4fe1176dee8992c6f088bf41ff0325bcf --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,QAAQ,EAAuE,MAAM,uBAAuB,CAAC;AACzI,OAAO,EAIH,yBAAyB,EAEzB,kCAAkC,EAMlC,kBAAkB,EAClB,iBAAiB,EACjB,SAAS,EAET,6BAA6B,EAE7B,uBAAuB,EAEvB,uBAAuB,EAEvB,qBAAqB,EAErB,kBAAkB,EAElB,QAAQ,EAMR,qBAAqB,EACrB,2BAA2B,EAG3B,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EAIzB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEvE,OAAO,EAAmB,eAAe,EAAE,cAAc,EAAE,SAAS,EAAgB,MAAM,iBAAiB,CAAC;AAE5G,OAAO,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,6BAA6B,EAAE,iCAAiC,EAAE,MAAM,kCAAkC,CAAC;AA6CpH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,OAAO,MAIX,SAAQ,QAA8F;IAapG;;OAEG;IACH,YACY,WAA2B,EACnC,OAAuB;QAEvB,KAAK,CAAC,OAAO,CAAC,CAAC;QAHP,gBAAW,GAAX,WAAW,CAAgB;QAyCvC,+BAA+B;QACvB,mBAAc,GAAG,IAAI,GAAG,EAAoC,CAAC;QAErE,uCAAuC;QACtB,uBAAkB,GAAG,I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/@modelcontextprotocol/sdk/dist/esm/server/mcp.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1bc0c68298e388a0ec505fa2bfa84dbe44820b35 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.d.ts @@ -0,0 +1,364 @@ +import { Server, ServerOptions } from './index.js'; +import { AnySchema, AnyObjectSchema, ZodRawShapeCompat, SchemaOutput, ShapeOutput } from './zod-compat.js'; +import { Implementation, CallToolResult, Resource, ListResourcesResult, GetPromptResult, ReadResourceResult, ServerRequest, ServerNotification, ToolAnnotations, LoggingMessageNotification, Result, ToolExecution } from '../types.js'; +import { UriTemplate, Variables } from '../shared/uriTemplate.js'; +import { RequestHandlerExtra } from '../shared/protocol.js'; +import { Transport } from '../shared/transport.js'; +import { ExperimentalMcpServerTasks } from '../experimental/tasks/mcp-server.js'; +import type { ToolTaskHandler } from '../experimental/tasks/interfaces.js'; +/** + * High-level MCP server that provides a simpler API for working with resources, tools, and prompts. + * For advanced usage (like sending notifications or setting custom request handlers), use the underlying + * Server instance available via the `server` property. + */ +export declare class McpServer { + /** + * The underlying Server instance, useful for advanced operations like sending notifications. + */ + readonly server: Server; + private _registeredResources; + private _registeredResourceTemplates; + private _registeredTools; + private _registeredPrompts; + private _experimental?; + constructor(serverInfo: Implementation, options?: ServerOptions); + /** + * Access experimental features. + * + * WARNING: These APIs are experimental and may change without notice. + * + * @experimental + */ + get experimental(): { + tasks: ExperimentalMcpServerTasks; + }; + /** + * Attaches to the given transport, starts it, and starts listening for messages. + * + * The `server` object assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward. + */ + connect(transport: Transport): Promise; + /** + * Closes the connection. + */ + close(): Promise; + private _toolHandlersInitialized; + private setToolRequestHandlers; + /** + * Creates a tool error result. + * + * @param errorMessage - The error message. + * @returns The tool error result. + */ + private createToolError; + /** + * Validates tool input arguments against the tool's input schema. + */ + private validateToolInput; + /** + * Validates tool output against the tool's output schema. + */ + private validateToolOutput; + /** + * Executes a tool handler (either regular or task-based). + */ + private executeToolHandler; + /** + * Handles automatic task polling for tools with taskSupport 'optional'. + */ + private handleAutomaticTaskPolling; + private _completionHandlerInitialized; + private setCompletionRequestHandler; + private handlePromptCompletion; + private handleResourceCompletion; + private _resourceHandlersInitialized; + private setResourceRequestHandlers; + private _promptHandlersInitialized; + private setPromptRequestHandlers; + /** + * Registers a resource `name` at a fixed URI, which will use the given callback to respond to read requests. + * @deprecated Use `registerResource` instead. + */ + resource(name: string, uri: string, readCallback: ReadResourceCallback): RegisteredResource; + /** + * Registers a resource `name` at a fixed URI with metadata, which will use the given callback to respond to read requests. + * @deprecated Use `registerResource` instead. + */ + resource(name: string, uri: string, metadata: ResourceMetadata, readCallback: ReadResourceCallback): RegisteredResource; + /** + * Registers a resource `name` with a template pattern, which will use the given callback to respond to read requests. + * @deprecated Use `registerResource` instead. + */ + resource(name: string, template: ResourceTemplate, readCallback: ReadResourceTemplateCallback): RegisteredResourceTemplate; + /** + * Registers a resource `name` with a template pattern and metadata, which will use the given callback to respond to read requests. + * @deprecated Use `registerResource` instead. + */ + resource(name: string, template: ResourceTemplate, metadata: ResourceMetadata, readCallback: ReadResourceTemplateCallback): RegisteredResourceTemplate; + /** + * Registers a resource with a config object and callback. + * For static resources, use a URI string. For dynamic resources, use a ResourceTemplate. + */ + registerResource(name: string, uriOrTemplate: string, config: ResourceMetadata, readCallback: ReadResourceCallback): RegisteredResource; + registerResource(name: string, uriOrTemplate: ResourceTemplate, config: ResourceMetadata, readCallback: ReadResourceTemplateCallback): RegisteredResourceTemplate; + private _createRegisteredResource; + private _createRegisteredResourceTemplate; + private _createRegisteredPrompt; + private _createRegisteredTool; + /** + * Registers a zero-argument tool `name`, which will run the given function when the client calls it. + * @deprecated Use `registerTool` instead. + */ + tool(name: string, cb: ToolCallback): RegisteredTool; + /** + * Registers a zero-argument tool `name` (with a description) which will run the given function when the client calls it. + * @deprecated Use `registerTool` instead. + */ + tool(name: string, description: string, cb: ToolCallback): RegisteredTool; + /** + * Registers a tool taking either a parameter schema for validation or annotations for additional metadata. + * This unified overload handles both `tool(name, paramsSchema, cb)` and `tool(name, annotations, cb)` cases. + * + * Note: We use a union type for the second parameter because TypeScript cannot reliably disambiguate + * between ToolAnnotations and ZodRawShapeCompat during overload resolution, as both are plain object types. + * @deprecated Use `registerTool` instead. + */ + tool(name: string, paramsSchemaOrAnnotations: Args | ToolAnnotations, cb: ToolCallback): RegisteredTool; + /** + * Registers a tool `name` (with a description) taking either parameter schema or annotations. + * This unified overload handles both `tool(name, description, paramsSchema, cb)` and + * `tool(name, description, annotations, cb)` cases. + * + * Note: We use a union type for the third parameter because TypeScript cannot reliably disambiguate + * between ToolAnnotations and ZodRawShapeCompat during overload resolution, as both are plain object types. + * @deprecated Use `registerTool` instead. + */ + tool(name: string, description: string, paramsSchemaOrAnnotations: Args | ToolAnnotations, cb: ToolCallback): RegisteredTool; + /** + * Registers a tool with both parameter schema and annotations. + * @deprecated Use `registerTool` instead. + */ + tool(name: string, paramsSchema: Args, annotations: ToolAnnotations, cb: ToolCallback): RegisteredTool; + /** + * Registers a tool with description, parameter schema, and annotations. + * @deprecated Use `registerTool` instead. + */ + tool(name: string, description: string, paramsSchema: Args, annotations: ToolAnnotations, cb: ToolCallback): RegisteredTool; + /** + * Registers a tool with a config object and callback. + */ + registerTool(name: string, config: { + title?: string; + description?: string; + inputSchema?: InputArgs; + outputSchema?: OutputArgs; + annotations?: ToolAnnotations; + _meta?: Record; + }, cb: ToolCallback): RegisteredTool; + /** + * Registers a zero-argument prompt `name`, which will run the given function when the client calls it. + * @deprecated Use `registerPrompt` instead. + */ + prompt(name: string, cb: PromptCallback): RegisteredPrompt; + /** + * Registers a zero-argument prompt `name` (with a description) which will run the given function when the client calls it. + * @deprecated Use `registerPrompt` instead. + */ + prompt(name: string, description: string, cb: PromptCallback): RegisteredPrompt; + /** + * Registers a prompt `name` accepting the given arguments, which must be an object containing named properties associated with Zod schemas. When the client calls it, the function will be run with the parsed and validated arguments. + * @deprecated Use `registerPrompt` instead. + */ + prompt(name: string, argsSchema: Args, cb: PromptCallback): RegisteredPrompt; + /** + * Registers a prompt `name` (with a description) accepting the given arguments, which must be an object containing named properties associated with Zod schemas. When the client calls it, the function will be run with the parsed and validated arguments. + * @deprecated Use `registerPrompt` instead. + */ + prompt(name: string, description: string, argsSchema: Args, cb: PromptCallback): RegisteredPrompt; + /** + * Registers a prompt with a config object and callback. + */ + registerPrompt(name: string, config: { + title?: string; + description?: string; + argsSchema?: Args; + }, cb: PromptCallback): RegisteredPrompt; + /** + * Checks if the server is connected to a transport. + * @returns True if the server is connected + */ + isConnected(): boolean; + /** + * Sends a logging message to the client, if connected. + * Note: You only need to send the parameters object, not the entire JSON RPC message + * @see LoggingMessageNotification + * @param params + * @param sessionId optional for stateless and backward compatibility + */ + sendLoggingMessage(params: LoggingMessageNotification['params'], sessionId?: string): Promise; + /** + * Sends a resource list changed event to the client, if connected. + */ + sendResourceListChanged(): void; + /** + * Sends a tool list changed event to the client, if connected. + */ + sendToolListChanged(): void; + /** + * Sends a prompt list changed event to the client, if connected. + */ + sendPromptListChanged(): void; +} +/** + * A callback to complete one variable within a resource template's URI template. + */ +export type CompleteResourceTemplateCallback = (value: string, context?: { + arguments?: Record; +}) => string[] | Promise; +/** + * A resource template combines a URI pattern with optional functionality to enumerate + * all resources matching that pattern. + */ +export declare class ResourceTemplate { + private _callbacks; + private _uriTemplate; + constructor(uriTemplate: string | UriTemplate, _callbacks: { + /** + * A callback to list all resources matching this template. This is required to specified, even if `undefined`, to avoid accidentally forgetting resource listing. + */ + list: ListResourcesCallback | undefined; + /** + * An optional callback to autocomplete variables within the URI template. Useful for clients and users to discover possible values. + */ + complete?: { + [variable: string]: CompleteResourceTemplateCallback; + }; + }); + /** + * Gets the URI template pattern. + */ + get uriTemplate(): UriTemplate; + /** + * Gets the list callback, if one was provided. + */ + get listCallback(): ListResourcesCallback | undefined; + /** + * Gets the callback for completing a specific URI template variable, if one was provided. + */ + completeCallback(variable: string): CompleteResourceTemplateCallback | undefined; +} +export type BaseToolCallback, Args extends undefined | ZodRawShapeCompat | AnySchema> = Args extends ZodRawShapeCompat ? (args: ShapeOutput, extra: Extra) => SendResultT | Promise : Args extends AnySchema ? (args: SchemaOutput, extra: Extra) => SendResultT | Promise : (extra: Extra) => SendResultT | Promise; +/** + * Callback for a tool handler registered with Server.tool(). + * + * Parameters will include tool arguments, if applicable, as well as other request handler context. + * + * The callback should return: + * - `structuredContent` if the tool has an outputSchema defined + * - `content` if the tool does not have an outputSchema + * - Both fields are optional but typically one should be provided + */ +export type ToolCallback = BaseToolCallback, Args>; +/** + * Supertype that can handle both regular tools (simple callback) and task-based tools (task handler object). + */ +export type AnyToolHandler = ToolCallback | ToolTaskHandler; +export type RegisteredTool = { + title?: string; + description?: string; + inputSchema?: AnySchema; + outputSchema?: AnySchema; + annotations?: ToolAnnotations; + execution?: ToolExecution; + _meta?: Record; + handler: AnyToolHandler; + enabled: boolean; + enable(): void; + disable(): void; + update(updates: { + name?: string | null; + title?: string; + description?: string; + paramsSchema?: InputArgs; + outputSchema?: OutputArgs; + annotations?: ToolAnnotations; + _meta?: Record; + callback?: ToolCallback; + enabled?: boolean; + }): void; + remove(): void; +}; +/** + * Additional, optional information for annotating a resource. + */ +export type ResourceMetadata = Omit; +/** + * Callback to list all resources matching a given template. + */ +export type ListResourcesCallback = (extra: RequestHandlerExtra) => ListResourcesResult | Promise; +/** + * Callback to read a resource at a given URI. + */ +export type ReadResourceCallback = (uri: URL, extra: RequestHandlerExtra) => ReadResourceResult | Promise; +export type RegisteredResource = { + name: string; + title?: string; + metadata?: ResourceMetadata; + readCallback: ReadResourceCallback; + enabled: boolean; + enable(): void; + disable(): void; + update(updates: { + name?: string; + title?: string; + uri?: string | null; + metadata?: ResourceMetadata; + callback?: ReadResourceCallback; + enabled?: boolean; + }): void; + remove(): void; +}; +/** + * Callback to read a resource at a given URI, following a filled-in URI template. + */ +export type ReadResourceTemplateCallback = (uri: URL, variables: Variables, extra: RequestHandlerExtra) => ReadResourceResult | Promise; +export type RegisteredResourceTemplate = { + resourceTemplate: ResourceTemplate; + title?: string; + metadata?: ResourceMetadata; + readCallback: ReadResourceTemplateCallback; + enabled: boolean; + enable(): void; + disable(): void; + update(updates: { + name?: string | null; + title?: string; + template?: ResourceTemplate; + metadata?: ResourceMetadata; + callback?: ReadResourceTemplateCallback; + enabled?: boolean; + }): void; + remove(): void; +}; +type PromptArgsRawShape = ZodRawShapeCompat; +export type PromptCallback = Args extends PromptArgsRawShape ? (args: ShapeOutput, extra: RequestHandlerExtra) => GetPromptResult | Promise : (extra: RequestHandlerExtra) => GetPromptResult | Promise; +export type RegisteredPrompt = { + title?: string; + description?: string; + argsSchema?: AnyObjectSchema; + callback: PromptCallback; + enabled: boolean; + enable(): void; + disable(): void; + update(updates: { + name?: string | null; + title?: string; + description?: string; + argsSchema?: Args; + callback?: PromptCallback; + enabled?: boolean; + }): void; + remove(): void; +}; +export {}; +//# sourceMappingURL=mcp.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..d5eff6c48056ac1dcce1a6555b934a5ca93ffba5 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../../src/server/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EACH,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,WAAW,EASd,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACH,cAAc,EAGd,cAAc,EAOd,QAAQ,EACR,mBAAmB,EAYnB,eAAe,EACf,kBA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;IACjB,MAAM,IAAI,IAAI,CAAC;IACf,OAAO,IAAI,IAAI,CAAC;IAChB,MAAM,CAAC,IAAI,SAAS,kBAAkB,EAAE,OAAO,EAAE;QAC7C,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,IAAI,CAAC;QAClB,QAAQ,CAAC,EAAE,cAAc,CAAC,IAAI,CAAC,CAAC;QAChC,OAAO,CAAC,EAAE,OAAO,CAAC;KACrB,GAAG,IAAI,CAAC;IACT,MAAM,IAAI,IAAI,CAAC;CAClB,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js new file mode 100644 index 0000000000000000000000000000000000000000..2314d881d39d3cf26d17d1fb585f53a737c9d145 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js @@ -0,0 +1,917 @@ +import { Server } from './index.js'; +import { normalizeObjectSchema, safeParseAsync, getObjectShape, objectFromShape, getParseErrorMessage, getSchemaDescription, isSchemaOptional, getLiteralValue } from './zod-compat.js'; +import { toJsonSchemaCompat } from './zod-json-schema-compat.js'; +import { McpError, ErrorCode, ListResourceTemplatesRequestSchema, ReadResourceRequestSchema, ListToolsRequestSchema, CallToolRequestSchema, ListResourcesRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, CompleteRequestSchema, assertCompleteRequestPrompt, assertCompleteRequestResourceTemplate } from '../types.js'; +import { isCompletable, getCompleter } from './completable.js'; +import { UriTemplate } from '../shared/uriTemplate.js'; +import { validateAndWarnToolName } from '../shared/toolNameValidation.js'; +import { ExperimentalMcpServerTasks } from '../experimental/tasks/mcp-server.js'; +import { ZodOptional } from 'zod'; +/** + * High-level MCP server that provides a simpler API for working with resources, tools, and prompts. + * For advanced usage (like sending notifications or setting custom request handlers), use the underlying + * Server instance available via the `server` property. + */ +export class McpServer { + constructor(serverInfo, options) { + this._registeredResources = {}; + this._registeredResourceTemplates = {}; + this._registeredTools = {}; + this._registeredPrompts = {}; + this._toolHandlersInitialized = false; + this._completionHandlerInitialized = false; + this._resourceHandlersInitialized = false; + this._promptHandlersInitialized = false; + this.server = new Server(serverInfo, options); + } + /** + * Access experimental features. + * + * WARNING: These APIs are experimental and may change without notice. + * + * @experimental + */ + get experimental() { + if (!this._experimental) { + this._experimental = { + tasks: new ExperimentalMcpServerTasks(this) + }; + } + return this._experimental; + } + /** + * Attaches to the given transport, starts it, and starts listening for messages. + * + * The `server` object assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward. + */ + async connect(transport) { + return await this.server.connect(transport); + } + /** + * Closes the connection. + */ + async close() { + await this.server.close(); + } + setToolRequestHandlers() { + if (this._toolHandlersInitialized) { + return; + } + this.server.assertCanSetRequestHandler(getMethodValue(ListToolsRequestSchema)); + this.server.assertCanSetRequestHandler(getMethodValue(CallToolRequestSchema)); + this.server.registerCapabilities({ + tools: { + listChanged: true + } + }); + this.server.setRequestHandler(ListToolsRequestSchema, () => ({ + tools: Object.entries(this._registeredTools) + .filter(([, tool]) => tool.enabled) + .map(([name, tool]) => { + const toolDefinition = { + name, + title: tool.title, + description: tool.description, + inputSchema: (() => { + const obj = normalizeObjectSchema(tool.inputSchema); + return obj + ? toJsonSchemaCompat(obj, { + strictUnions: true, + pipeStrategy: 'input' + }) + : EMPTY_OBJECT_JSON_SCHEMA; + })(), + annotations: tool.annotations, + execution: tool.execution, + _meta: tool._meta + }; + if (tool.outputSchema) { + const obj = normalizeObjectSchema(tool.outputSchema); + if (obj) { + toolDefinition.outputSchema = toJsonSchemaCompat(obj, { + strictUnions: true, + pipeStrategy: 'output' + }); + } + } + return toolDefinition; + }) + })); + this.server.setRequestHandler(CallToolRequestSchema, async (request, extra) => { + try { + const tool = this._registeredTools[request.params.name]; + if (!tool) { + throw new McpError(ErrorCode.InvalidParams, `Tool ${request.params.name} not found`); + } + if (!tool.enabled) { + throw new McpError(ErrorCode.InvalidParams, `Tool ${request.params.name} disabled`); + } + const isTaskRequest = !!request.params.task; + const taskSupport = tool.execution?.taskSupport; + const isTaskHandler = 'createTask' in tool.handler; + // Validate task hint configuration + if ((taskSupport === 'required' || taskSupport === 'optional') && !isTaskHandler) { + throw new McpError(ErrorCode.InternalError, `Tool ${request.params.name} has taskSupport '${taskSupport}' but was not registered with registerToolTask`); + } + // Handle taskSupport 'required' without task augmentation + if (taskSupport === 'required' && !isTaskRequest) { + throw new McpError(ErrorCode.MethodNotFound, `Tool ${request.params.name} requires task augmentation (taskSupport: 'required')`); + } + // Handle taskSupport 'optional' without task augmentation - automatic polling + if (taskSupport === 'optional' && !isTaskRequest && isTaskHandler) { + return await this.handleAutomaticTaskPolling(tool, request, extra); + } + // Normal execution path + const args = await this.validateToolInput(tool, request.params.arguments, request.params.name); + const result = await this.executeToolHandler(tool, args, extra); + // Return CreateTaskResult immediately for task requests + if (isTaskRequest) { + return result; + } + // Validate output schema for non-task requests + await this.validateToolOutput(tool, result, request.params.name); + return result; + } + catch (error) { + if (error instanceof McpError) { + if (error.code === ErrorCode.UrlElicitationRequired) { + throw error; // Return the error to the caller without wrapping in CallToolResult + } + } + return this.createToolError(error instanceof Error ? error.message : String(error)); + } + }); + this._toolHandlersInitialized = true; + } + /** + * Creates a tool error result. + * + * @param errorMessage - The error message. + * @returns The tool error result. + */ + createToolError(errorMessage) { + return { + content: [ + { + type: 'text', + text: errorMessage + } + ], + isError: true + }; + } + /** + * Validates tool input arguments against the tool's input schema. + */ + async validateToolInput(tool, args, toolName) { + if (!tool.inputSchema) { + return undefined; + } + // Try to normalize to object schema first (for raw shapes and object schemas) + // If that fails, use the schema directly (for union/intersection/etc) + const inputObj = normalizeObjectSchema(tool.inputSchema); + const schemaToParse = inputObj ?? tool.inputSchema; + const parseResult = await safeParseAsync(schemaToParse, args); + if (!parseResult.success) { + const error = 'error' in parseResult ? parseResult.error : 'Unknown error'; + const errorMessage = getParseErrorMessage(error); + throw new McpError(ErrorCode.InvalidParams, `Input validation error: Invalid arguments for tool ${toolName}: ${errorMessage}`); + } + return parseResult.data; + } + /** + * Validates tool output against the tool's output schema. + */ + async validateToolOutput(tool, result, toolName) { + if (!tool.outputSchema) { + return; + } + // Only validate CallToolResult, not CreateTaskResult + if (!('content' in result)) { + return; + } + if (result.isError) { + return; + } + if (!result.structuredContent) { + throw new McpError(ErrorCode.InvalidParams, `Output validation error: Tool ${toolName} has an output schema but no structured content was provided`); + } + // if the tool has an output schema, validate structured content + const outputObj = normalizeObjectSchema(tool.outputSchema); + const parseResult = await safeParseAsync(outputObj, result.structuredContent); + if (!parseResult.success) { + const error = 'error' in parseResult ? parseResult.error : 'Unknown error'; + const errorMessage = getParseErrorMessage(error); + throw new McpError(ErrorCode.InvalidParams, `Output validation error: Invalid structured content for tool ${toolName}: ${errorMessage}`); + } + } + /** + * Executes a tool handler (either regular or task-based). + */ + async executeToolHandler(tool, args, extra) { + const handler = tool.handler; + const isTaskHandler = 'createTask' in handler; + if (isTaskHandler) { + if (!extra.taskStore) { + throw new Error('No task store provided.'); + } + const taskExtra = { ...extra, taskStore: extra.taskStore }; + if (tool.inputSchema) { + const typedHandler = handler; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return await Promise.resolve(typedHandler.createTask(args, taskExtra)); + } + else { + const typedHandler = handler; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return await Promise.resolve(typedHandler.createTask(taskExtra)); + } + } + if (tool.inputSchema) { + const typedHandler = handler; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return await Promise.resolve(typedHandler(args, extra)); + } + else { + const typedHandler = handler; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return await Promise.resolve(typedHandler(extra)); + } + } + /** + * Handles automatic task polling for tools with taskSupport 'optional'. + */ + async handleAutomaticTaskPolling(tool, request, extra) { + if (!extra.taskStore) { + throw new Error('No task store provided for task-capable tool.'); + } + // Validate input and create task + const args = await this.validateToolInput(tool, request.params.arguments, request.params.name); + const handler = tool.handler; + const taskExtra = { ...extra, taskStore: extra.taskStore }; + const createTaskResult = args // undefined only if tool.inputSchema is undefined + ? await Promise.resolve(handler.createTask(args, taskExtra)) + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + await Promise.resolve(handler.createTask(taskExtra)); + // Poll until completion + const taskId = createTaskResult.task.taskId; + let task = createTaskResult.task; + const pollInterval = task.pollInterval ?? 5000; + while (task.status !== 'completed' && task.status !== 'failed' && task.status !== 'cancelled') { + await new Promise(resolve => setTimeout(resolve, pollInterval)); + const updatedTask = await extra.taskStore.getTask(taskId); + if (!updatedTask) { + throw new McpError(ErrorCode.InternalError, `Task ${taskId} not found during polling`); + } + task = updatedTask; + } + // Return the final result + return (await extra.taskStore.getTaskResult(taskId)); + } + setCompletionRequestHandler() { + if (this._completionHandlerInitialized) { + return; + } + this.server.assertCanSetRequestHandler(getMethodValue(CompleteRequestSchema)); + this.server.registerCapabilities({ + completions: {} + }); + this.server.setRequestHandler(CompleteRequestSchema, async (request) => { + switch (request.params.ref.type) { + case 'ref/prompt': + assertCompleteRequestPrompt(request); + return this.handlePromptCompletion(request, request.params.ref); + case 'ref/resource': + assertCompleteRequestResourceTemplate(request); + return this.handleResourceCompletion(request, request.params.ref); + default: + throw new McpError(ErrorCode.InvalidParams, `Invalid completion reference: ${request.params.ref}`); + } + }); + this._completionHandlerInitialized = true; + } + async handlePromptCompletion(request, ref) { + const prompt = this._registeredPrompts[ref.name]; + if (!prompt) { + throw new McpError(ErrorCode.InvalidParams, `Prompt ${ref.name} not found`); + } + if (!prompt.enabled) { + throw new McpError(ErrorCode.InvalidParams, `Prompt ${ref.name} disabled`); + } + if (!prompt.argsSchema) { + return EMPTY_COMPLETION_RESULT; + } + const promptShape = getObjectShape(prompt.argsSchema); + const field = promptShape?.[request.params.argument.name]; + if (!isCompletable(field)) { + return EMPTY_COMPLETION_RESULT; + } + const completer = getCompleter(field); + if (!completer) { + return EMPTY_COMPLETION_RESULT; + } + const suggestions = await completer(request.params.argument.value, request.params.context); + return createCompletionResult(suggestions); + } + async handleResourceCompletion(request, ref) { + const template = Object.values(this._registeredResourceTemplates).find(t => t.resourceTemplate.uriTemplate.toString() === ref.uri); + if (!template) { + if (this._registeredResources[ref.uri]) { + // Attempting to autocomplete a fixed resource URI is not an error in the spec (but probably should be). + return EMPTY_COMPLETION_RESULT; + } + throw new McpError(ErrorCode.InvalidParams, `Resource template ${request.params.ref.uri} not found`); + } + const completer = template.resourceTemplate.completeCallback(request.params.argument.name); + if (!completer) { + return EMPTY_COMPLETION_RESULT; + } + const suggestions = await completer(request.params.argument.value, request.params.context); + return createCompletionResult(suggestions); + } + setResourceRequestHandlers() { + if (this._resourceHandlersInitialized) { + return; + } + this.server.assertCanSetRequestHandler(getMethodValue(ListResourcesRequestSchema)); + this.server.assertCanSetRequestHandler(getMethodValue(ListResourceTemplatesRequestSchema)); + this.server.assertCanSetRequestHandler(getMethodValue(ReadResourceRequestSchema)); + this.server.registerCapabilities({ + resources: { + listChanged: true + } + }); + this.server.setRequestHandler(ListResourcesRequestSchema, async (request, extra) => { + const resources = Object.entries(this._registeredResources) + .filter(([_, resource]) => resource.enabled) + .map(([uri, resource]) => ({ + uri, + name: resource.name, + ...resource.metadata + })); + const templateResources = []; + for (const template of Object.values(this._registeredResourceTemplates)) { + if (!template.resourceTemplate.listCallback) { + continue; + } + const result = await template.resourceTemplate.listCallback(extra); + for (const resource of result.resources) { + templateResources.push({ + ...template.metadata, + // the defined resource metadata should override the template metadata if present + ...resource + }); + } + } + return { resources: [...resources, ...templateResources] }; + }); + this.server.setRequestHandler(ListResourceTemplatesRequestSchema, async () => { + const resourceTemplates = Object.entries(this._registeredResourceTemplates).map(([name, template]) => ({ + name, + uriTemplate: template.resourceTemplate.uriTemplate.toString(), + ...template.metadata + })); + return { resourceTemplates }; + }); + this.server.setRequestHandler(ReadResourceRequestSchema, async (request, extra) => { + const uri = new URL(request.params.uri); + // First check for exact resource match + const resource = this._registeredResources[uri.toString()]; + if (resource) { + if (!resource.enabled) { + throw new McpError(ErrorCode.InvalidParams, `Resource ${uri} disabled`); + } + return resource.readCallback(uri, extra); + } + // Then check templates + for (const template of Object.values(this._registeredResourceTemplates)) { + const variables = template.resourceTemplate.uriTemplate.match(uri.toString()); + if (variables) { + return template.readCallback(uri, variables, extra); + } + } + throw new McpError(ErrorCode.InvalidParams, `Resource ${uri} not found`); + }); + this._resourceHandlersInitialized = true; + } + setPromptRequestHandlers() { + if (this._promptHandlersInitialized) { + return; + } + this.server.assertCanSetRequestHandler(getMethodValue(ListPromptsRequestSchema)); + this.server.assertCanSetRequestHandler(getMethodValue(GetPromptRequestSchema)); + this.server.registerCapabilities({ + prompts: { + listChanged: true + } + }); + this.server.setRequestHandler(ListPromptsRequestSchema, () => ({ + prompts: Object.entries(this._registeredPrompts) + .filter(([, prompt]) => prompt.enabled) + .map(([name, prompt]) => { + return { + name, + title: prompt.title, + description: prompt.description, + arguments: prompt.argsSchema ? promptArgumentsFromSchema(prompt.argsSchema) : undefined + }; + }) + })); + this.server.setRequestHandler(GetPromptRequestSchema, async (request, extra) => { + const prompt = this._registeredPrompts[request.params.name]; + if (!prompt) { + throw new McpError(ErrorCode.InvalidParams, `Prompt ${request.params.name} not found`); + } + if (!prompt.enabled) { + throw new McpError(ErrorCode.InvalidParams, `Prompt ${request.params.name} disabled`); + } + if (prompt.argsSchema) { + const argsObj = normalizeObjectSchema(prompt.argsSchema); + const parseResult = await safeParseAsync(argsObj, request.params.arguments); + if (!parseResult.success) { + const error = 'error' in parseResult ? parseResult.error : 'Unknown error'; + const errorMessage = getParseErrorMessage(error); + throw new McpError(ErrorCode.InvalidParams, `Invalid arguments for prompt ${request.params.name}: ${errorMessage}`); + } + const args = parseResult.data; + const cb = prompt.callback; + return await Promise.resolve(cb(args, extra)); + } + else { + const cb = prompt.callback; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return await Promise.resolve(cb(extra)); + } + }); + this._promptHandlersInitialized = true; + } + resource(name, uriOrTemplate, ...rest) { + let metadata; + if (typeof rest[0] === 'object') { + metadata = rest.shift(); + } + const readCallback = rest[0]; + if (typeof uriOrTemplate === 'string') { + if (this._registeredResources[uriOrTemplate]) { + throw new Error(`Resource ${uriOrTemplate} is already registered`); + } + const registeredResource = this._createRegisteredResource(name, undefined, uriOrTemplate, metadata, readCallback); + this.setResourceRequestHandlers(); + this.sendResourceListChanged(); + return registeredResource; + } + else { + if (this._registeredResourceTemplates[name]) { + throw new Error(`Resource template ${name} is already registered`); + } + const registeredResourceTemplate = this._createRegisteredResourceTemplate(name, undefined, uriOrTemplate, metadata, readCallback); + this.setResourceRequestHandlers(); + this.sendResourceListChanged(); + return registeredResourceTemplate; + } + } + registerResource(name, uriOrTemplate, config, readCallback) { + if (typeof uriOrTemplate === 'string') { + if (this._registeredResources[uriOrTemplate]) { + throw new Error(`Resource ${uriOrTemplate} is already registered`); + } + const registeredResource = this._createRegisteredResource(name, config.title, uriOrTemplate, config, readCallback); + this.setResourceRequestHandlers(); + this.sendResourceListChanged(); + return registeredResource; + } + else { + if (this._registeredResourceTemplates[name]) { + throw new Error(`Resource template ${name} is already registered`); + } + const registeredResourceTemplate = this._createRegisteredResourceTemplate(name, config.title, uriOrTemplate, config, readCallback); + this.setResourceRequestHandlers(); + this.sendResourceListChanged(); + return registeredResourceTemplate; + } + } + _createRegisteredResource(name, title, uri, metadata, readCallback) { + const registeredResource = { + name, + title, + metadata, + readCallback, + enabled: true, + disable: () => registeredResource.update({ enabled: false }), + enable: () => registeredResource.update({ enabled: true }), + remove: () => registeredResource.update({ uri: null }), + update: updates => { + if (typeof updates.uri !== 'undefined' && updates.uri !== uri) { + delete this._registeredResources[uri]; + if (updates.uri) + this._registeredResources[updates.uri] = registeredResource; + } + if (typeof updates.name !== 'undefined') + registeredResource.name = updates.name; + if (typeof updates.title !== 'undefined') + registeredResource.title = updates.title; + if (typeof updates.metadata !== 'undefined') + registeredResource.metadata = updates.metadata; + if (typeof updates.callback !== 'undefined') + registeredResource.readCallback = updates.callback; + if (typeof updates.enabled !== 'undefined') + registeredResource.enabled = updates.enabled; + this.sendResourceListChanged(); + } + }; + this._registeredResources[uri] = registeredResource; + return registeredResource; + } + _createRegisteredResourceTemplate(name, title, template, metadata, readCallback) { + const registeredResourceTemplate = { + resourceTemplate: template, + title, + metadata, + readCallback, + enabled: true, + disable: () => registeredResourceTemplate.update({ enabled: false }), + enable: () => registeredResourceTemplate.update({ enabled: true }), + remove: () => registeredResourceTemplate.update({ name: null }), + update: updates => { + if (typeof updates.name !== 'undefined' && updates.name !== name) { + delete this._registeredResourceTemplates[name]; + if (updates.name) + this._registeredResourceTemplates[updates.name] = registeredResourceTemplate; + } + if (typeof updates.title !== 'undefined') + registeredResourceTemplate.title = updates.title; + if (typeof updates.template !== 'undefined') + registeredResourceTemplate.resourceTemplate = updates.template; + if (typeof updates.metadata !== 'undefined') + registeredResourceTemplate.metadata = updates.metadata; + if (typeof updates.callback !== 'undefined') + registeredResourceTemplate.readCallback = updates.callback; + if (typeof updates.enabled !== 'undefined') + registeredResourceTemplate.enabled = updates.enabled; + this.sendResourceListChanged(); + } + }; + this._registeredResourceTemplates[name] = registeredResourceTemplate; + // If the resource template has any completion callbacks, enable completions capability + const variableNames = template.uriTemplate.variableNames; + const hasCompleter = Array.isArray(variableNames) && variableNames.some(v => !!template.completeCallback(v)); + if (hasCompleter) { + this.setCompletionRequestHandler(); + } + return registeredResourceTemplate; + } + _createRegisteredPrompt(name, title, description, argsSchema, callback) { + const registeredPrompt = { + title, + description, + argsSchema: argsSchema === undefined ? undefined : objectFromShape(argsSchema), + callback, + enabled: true, + disable: () => registeredPrompt.update({ enabled: false }), + enable: () => registeredPrompt.update({ enabled: true }), + remove: () => registeredPrompt.update({ name: null }), + update: updates => { + if (typeof updates.name !== 'undefined' && updates.name !== name) { + delete this._registeredPrompts[name]; + if (updates.name) + this._registeredPrompts[updates.name] = registeredPrompt; + } + if (typeof updates.title !== 'undefined') + registeredPrompt.title = updates.title; + if (typeof updates.description !== 'undefined') + registeredPrompt.description = updates.description; + if (typeof updates.argsSchema !== 'undefined') + registeredPrompt.argsSchema = objectFromShape(updates.argsSchema); + if (typeof updates.callback !== 'undefined') + registeredPrompt.callback = updates.callback; + if (typeof updates.enabled !== 'undefined') + registeredPrompt.enabled = updates.enabled; + this.sendPromptListChanged(); + } + }; + this._registeredPrompts[name] = registeredPrompt; + // If any argument uses a Completable schema, enable completions capability + if (argsSchema) { + const hasCompletable = Object.values(argsSchema).some(field => { + const inner = field instanceof ZodOptional ? field._def?.innerType : field; + return isCompletable(inner); + }); + if (hasCompletable) { + this.setCompletionRequestHandler(); + } + } + return registeredPrompt; + } + _createRegisteredTool(name, title, description, inputSchema, outputSchema, annotations, execution, _meta, handler) { + // Validate tool name according to SEP specification + validateAndWarnToolName(name); + const registeredTool = { + title, + description, + inputSchema: getZodSchemaObject(inputSchema), + outputSchema: getZodSchemaObject(outputSchema), + annotations, + execution, + _meta, + handler: handler, + enabled: true, + disable: () => registeredTool.update({ enabled: false }), + enable: () => registeredTool.update({ enabled: true }), + remove: () => registeredTool.update({ name: null }), + update: updates => { + if (typeof updates.name !== 'undefined' && updates.name !== name) { + if (typeof updates.name === 'string') { + validateAndWarnToolName(updates.name); + } + delete this._registeredTools[name]; + if (updates.name) + this._registeredTools[updates.name] = registeredTool; + } + if (typeof updates.title !== 'undefined') + registeredTool.title = updates.title; + if (typeof updates.description !== 'undefined') + registeredTool.description = updates.description; + if (typeof updates.paramsSchema !== 'undefined') + registeredTool.inputSchema = objectFromShape(updates.paramsSchema); + if (typeof updates.outputSchema !== 'undefined') + registeredTool.outputSchema = objectFromShape(updates.outputSchema); + if (typeof updates.callback !== 'undefined') + registeredTool.handler = updates.callback; + if (typeof updates.annotations !== 'undefined') + registeredTool.annotations = updates.annotations; + if (typeof updates._meta !== 'undefined') + registeredTool._meta = updates._meta; + if (typeof updates.enabled !== 'undefined') + registeredTool.enabled = updates.enabled; + this.sendToolListChanged(); + } + }; + this._registeredTools[name] = registeredTool; + this.setToolRequestHandlers(); + this.sendToolListChanged(); + return registeredTool; + } + /** + * tool() implementation. Parses arguments passed to overrides defined above. + */ + tool(name, ...rest) { + if (this._registeredTools[name]) { + throw new Error(`Tool ${name} is already registered`); + } + let description; + let inputSchema; + let outputSchema; + let annotations; + // Tool properties are passed as separate arguments, with omissions allowed. + // Support for this style is frozen as of protocol version 2025-03-26. Future additions + // to tool definition should *NOT* be added. + if (typeof rest[0] === 'string') { + description = rest.shift(); + } + // Handle the different overload combinations + if (rest.length > 1) { + // We have at least one more arg before the callback + const firstArg = rest[0]; + if (isZodRawShapeCompat(firstArg)) { + // We have a params schema as the first arg + inputSchema = rest.shift(); + // Check if the next arg is potentially annotations + if (rest.length > 1 && typeof rest[0] === 'object' && rest[0] !== null && !isZodRawShapeCompat(rest[0])) { + // Case: tool(name, paramsSchema, annotations, cb) + // Or: tool(name, description, paramsSchema, annotations, cb) + annotations = rest.shift(); + } + } + else if (typeof firstArg === 'object' && firstArg !== null) { + // ToolAnnotations values are primitives. Nested objects indicate a misplaced schema + if (Object.values(firstArg).some(v => typeof v === 'object' && v !== null)) { + throw new Error(`Tool ${name} expected a Zod schema or ToolAnnotations, but received an unrecognized object`); + } + annotations = rest.shift(); + } + } + const callback = rest[0]; + return this._createRegisteredTool(name, undefined, description, inputSchema, outputSchema, annotations, { taskSupport: 'forbidden' }, undefined, callback); + } + /** + * Registers a tool with a config object and callback. + */ + registerTool(name, config, cb) { + if (this._registeredTools[name]) { + throw new Error(`Tool ${name} is already registered`); + } + const { title, description, inputSchema, outputSchema, annotations, _meta } = config; + return this._createRegisteredTool(name, title, description, inputSchema, outputSchema, annotations, { taskSupport: 'forbidden' }, _meta, cb); + } + prompt(name, ...rest) { + if (this._registeredPrompts[name]) { + throw new Error(`Prompt ${name} is already registered`); + } + let description; + if (typeof rest[0] === 'string') { + description = rest.shift(); + } + let argsSchema; + if (rest.length > 1) { + argsSchema = rest.shift(); + } + const cb = rest[0]; + const registeredPrompt = this._createRegisteredPrompt(name, undefined, description, argsSchema, cb); + this.setPromptRequestHandlers(); + this.sendPromptListChanged(); + return registeredPrompt; + } + /** + * Registers a prompt with a config object and callback. + */ + registerPrompt(name, config, cb) { + if (this._registeredPrompts[name]) { + throw new Error(`Prompt ${name} is already registered`); + } + const { title, description, argsSchema } = config; + const registeredPrompt = this._createRegisteredPrompt(name, title, description, argsSchema, cb); + this.setPromptRequestHandlers(); + this.sendPromptListChanged(); + return registeredPrompt; + } + /** + * Checks if the server is connected to a transport. + * @returns True if the server is connected + */ + isConnected() { + return this.server.transport !== undefined; + } + /** + * Sends a logging message to the client, if connected. + * Note: You only need to send the parameters object, not the entire JSON RPC message + * @see LoggingMessageNotification + * @param params + * @param sessionId optional for stateless and backward compatibility + */ + async sendLoggingMessage(params, sessionId) { + return this.server.sendLoggingMessage(params, sessionId); + } + /** + * Sends a resource list changed event to the client, if connected. + */ + sendResourceListChanged() { + if (this.isConnected()) { + this.server.sendResourceListChanged(); + } + } + /** + * Sends a tool list changed event to the client, if connected. + */ + sendToolListChanged() { + if (this.isConnected()) { + this.server.sendToolListChanged(); + } + } + /** + * Sends a prompt list changed event to the client, if connected. + */ + sendPromptListChanged() { + if (this.isConnected()) { + this.server.sendPromptListChanged(); + } + } +} +/** + * A resource template combines a URI pattern with optional functionality to enumerate + * all resources matching that pattern. + */ +export class ResourceTemplate { + constructor(uriTemplate, _callbacks) { + this._callbacks = _callbacks; + this._uriTemplate = typeof uriTemplate === 'string' ? new UriTemplate(uriTemplate) : uriTemplate; + } + /** + * Gets the URI template pattern. + */ + get uriTemplate() { + return this._uriTemplate; + } + /** + * Gets the list callback, if one was provided. + */ + get listCallback() { + return this._callbacks.list; + } + /** + * Gets the callback for completing a specific URI template variable, if one was provided. + */ + completeCallback(variable) { + return this._callbacks.complete?.[variable]; + } +} +const EMPTY_OBJECT_JSON_SCHEMA = { + type: 'object', + properties: {} +}; +/** + * Checks if a value looks like a Zod schema by checking for parse/safeParse methods. + */ +function isZodTypeLike(value) { + return (value !== null && + typeof value === 'object' && + 'parse' in value && + typeof value.parse === 'function' && + 'safeParse' in value && + typeof value.safeParse === 'function'); +} +/** + * Checks if an object is a Zod schema instance (v3 or v4). + * + * Zod schemas have internal markers: + * - v3: `_def` property + * - v4: `_zod` property + * + * This includes transformed schemas like z.preprocess(), z.transform(), z.pipe(). + */ +function isZodSchemaInstance(obj) { + return '_def' in obj || '_zod' in obj || isZodTypeLike(obj); +} +/** + * Checks if an object is a "raw shape" - a plain object where values are Zod schemas. + * + * Raw shapes are used as shorthand: `{ name: z.string() }` instead of `z.object({ name: z.string() })`. + * + * IMPORTANT: This must NOT match actual Zod schema instances (like z.preprocess, z.pipe), + * which have internal properties that could be mistaken for schema values. + */ +function isZodRawShapeCompat(obj) { + if (typeof obj !== 'object' || obj === null) { + return false; + } + // If it's already a Zod schema instance, it's NOT a raw shape + if (isZodSchemaInstance(obj)) { + return false; + } + // Empty objects are valid raw shapes (tools with no parameters) + if (Object.keys(obj).length === 0) { + return true; + } + // A raw shape has at least one property that is a Zod schema + return Object.values(obj).some(isZodTypeLike); +} +/** + * Converts a provided Zod schema to a Zod object if it is a ZodRawShapeCompat, + * otherwise returns the schema as is. Throws if the value is not a valid Zod schema. + */ +function getZodSchemaObject(schema) { + if (!schema) { + return undefined; + } + if (isZodRawShapeCompat(schema)) { + return objectFromShape(schema); + } + if (!isZodSchemaInstance(schema)) { + throw new Error('inputSchema must be a Zod schema or raw shape, received an unrecognized object'); + } + return schema; +} +function promptArgumentsFromSchema(schema) { + const shape = getObjectShape(schema); + if (!shape) + return []; + return Object.entries(shape).map(([name, field]) => { + // Get description - works for both v3 and v4 + const description = getSchemaDescription(field); + // Check if optional - works for both v3 and v4 + const isOptional = isSchemaOptional(field); + return { + name, + description, + required: !isOptional + }; + }); +} +function getMethodValue(schema) { + const shape = getObjectShape(schema); + const methodSchema = shape?.method; + if (!methodSchema) { + throw new Error('Schema is missing a method literal'); + } + // Extract literal value - works for both v3 and v4 + const value = getLiteralValue(methodSchema); + if (typeof value === 'string') { + return value; + } + throw new Error('Schema method literal must be a string'); +} +function createCompletionResult(suggestions) { + return { + completion: { + values: suggestions.slice(0, 100), + total: suggestions.length, + hasMore: suggestions.length > 100 + } + }; +} +const EMPTY_COMPLETION_RESULT = { + completion: { + values: [], + hasMore: false + } +}; +//# sourceMappingURL=mcp.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js.map new file mode 100644 index 0000000000000000000000000000000000000000..0b8bc7a0030761d799050cb2808f7e5e25ef0aac --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mcp.js","sourceRoot":"","sources":["../../../src/server/mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAiB,MAAM,YAAY,CAAC;AACnD,OAAO,EAMH,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAKH,QAAQ,EACR,SAAS,EAOT,kCAAkC,EAClC,yBAAyB,EACzB,sBAAsB,EACtB,qBAAqB,EACrB,0BAA0B,EAC1B,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EAcrB,2BAA2B,EAC3B,qCAAqC,EAGxC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAa,MAAM,0BAA0B,CAAC;AAIlE,OAAO,EAAE,uBA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MAAM,CAAC,CAAC;IACrC,MAAM,YAAY,GAAG,KAAK,EAAE,MAA+B,CAAC;IAC5D,IAAI,CAAC,YAAY,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;IAC1D,CAAC;IAED,mDAAmD;IACnD,MAAM,KAAK,GAAG,eAAe,CAAC,YAAY,CAAC,CAAC;IAC5C,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;AAC9D,CAAC;AAED,SAAS,sBAAsB,CAAC,WAAqB;IACjD,OAAO;QACH,UAAU,EAAE;YACR,MAAM,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;YACjC,KAAK,EAAE,WAAW,CAAC,MAAM;YACzB,OAAO,EAAE,WAAW,CAAC,MAAM,GAAG,GAAG;SACpC;KACJ,CAAC;AACN,CAAC;AAED,MAAM,uBAAuB,GAAmB;IAC5C,UAAU,EAAE;QACR,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,KAAK;KACjB;CACJ,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/middleware/hostHeaderValidation.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/middleware/hostHeaderValidation.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cb526d8fa0518fd29a4a84cd2db23013e203f557 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/middleware/hostHeaderValidation.d.ts @@ -0,0 +1,32 @@ +import { RequestHandler } from 'express'; +/** + * Express middleware for DNS rebinding protection. + * Validates Host header hostname (port-agnostic) against an allowed list. + * + * This is particularly important for servers without authorization or HTTPS, + * such as localhost servers or development servers. DNS rebinding attacks can + * bypass same-origin policy by manipulating DNS to point a domain to a + * localhost address, allowing malicious websites to access your local server. + * + * @param allowedHostnames - List of allowed hostnames (without ports). + * For IPv6, provide the address with brackets (e.g., '[::1]'). + * @returns Express middleware function + * + * @example + * ```typescript + * const middleware = hostHeaderValidation(['localhost', '127.0.0.1', '[::1]']); + * app.use(middleware); + * ``` + */ +export declare function hostHeaderValidation(allowedHostnames: string[]): RequestHandler; +/** + * Convenience middleware for localhost DNS rebinding protection. + * Allows only localhost, 127.0.0.1, and [::1] (IPv6 localhost) hostnames. + * + * @example + * ```typescript + * app.use(localhostHostValidation()); + * ``` + */ +export declare function localhostHostValidation(): RequestHandler; +//# sourceMappingURL=hostHeaderValidation.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/middleware/hostHeaderValidation.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/middleware/hostHeaderValidation.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..c550324ec48b1d52129e5f7e0d2a010a7d44d828 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/middleware/hostHeaderValidation.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"hostHeaderValidation.d.ts","sourceRoot":"","sources":["../../../../src/server/middleware/hostHeaderValidation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,cAAc,EAAE,MAAM,SAAS,CAAC;AAE1E;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAAC,gBAAgB,EAAE,MAAM,EAAE,GAAG,cAAc,CA4C/E;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,IAAI,cAAc,CAExD"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/middleware/hostHeaderValidation.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/middleware/hostHeaderValidation.js new file mode 100644 index 0000000000000000000000000000000000000000..79922a27b8f04afbdaa8ec3e62dcf6b200e710c2 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/middleware/hostHeaderValidation.js @@ -0,0 +1,76 @@ +/** + * Express middleware for DNS rebinding protection. + * Validates Host header hostname (port-agnostic) against an allowed list. + * + * This is particularly important for servers without authorization or HTTPS, + * such as localhost servers or development servers. DNS rebinding attacks can + * bypass same-origin policy by manipulating DNS to point a domain to a + * localhost address, allowing malicious websites to access your local server. + * + * @param allowedHostnames - List of allowed hostnames (without ports). + * For IPv6, provide the address with brackets (e.g., '[::1]'). + * @returns Express middleware function + * + * @example + * ```typescript + * const middleware = hostHeaderValidation(['localhost', '127.0.0.1', '[::1]']); + * app.use(middleware); + * ``` + */ +export function hostHeaderValidation(allowedHostnames) { + return (req, res, next) => { + const hostHeader = req.headers.host; + if (!hostHeader) { + res.status(403).json({ + jsonrpc: '2.0', + error: { + code: -32000, + message: 'Missing Host header' + }, + id: null + }); + return; + } + // Use URL API to parse hostname (handles IPv4, IPv6, and regular hostnames) + let hostname; + try { + hostname = new URL(`http://${hostHeader}`).hostname; + } + catch { + res.status(403).json({ + jsonrpc: '2.0', + error: { + code: -32000, + message: `Invalid Host header: ${hostHeader}` + }, + id: null + }); + return; + } + if (!allowedHostnames.includes(hostname)) { + res.status(403).json({ + jsonrpc: '2.0', + error: { + code: -32000, + message: `Invalid Host: ${hostname}` + }, + id: null + }); + return; + } + next(); + }; +} +/** + * Convenience middleware for localhost DNS rebinding protection. + * Allows only localhost, 127.0.0.1, and [::1] (IPv6 localhost) hostnames. + * + * @example + * ```typescript + * app.use(localhostHostValidation()); + * ``` + */ +export function localhostHostValidation() { + return hostHeaderValidation(['localhost', '127.0.0.1', '[::1]']); +} +//# sourceMappingURL=hostHeaderValidation.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/middleware/hostHeaderValidation.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/middleware/hostHeaderValidation.js.map new file mode 100644 index 0000000000000000000000000000000000000000..f04fdfd1db40cd6910379a02a0d4f184a2efee17 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/middleware/hostHeaderValidation.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hostHeaderValidation.js","sourceRoot":"","sources":["../../../../src/server/middleware/hostHeaderValidation.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,oBAAoB,CAAC,gBAA0B;IAC3D,OAAO,CAAC,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE;QACvD,MAAM,UAAU,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC;QACpC,IAAI,CAAC,UAAU,EAAE,CAAC;YACd,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBACjB,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE;oBACH,IAAI,EAAE,CAAC,KAAK;oBACZ,OAAO,EAAE,qBAAqB;iBACjC;gBACD,EAAE,EAAE,IAAI;aACX,CAAC,CAAC;YACH,OAAO;QACX,CAAC;QAED,4EAA4E;QAC5E,IAAI,QAAgB,CAAC;QACrB,IAAI,CAAC;YACD,QAAQ,GAAG,IAAI,GAAG,CAAC,UAAU,UAAU,EAAE,CAAC,CAAC,QAAQ,CAAC;QACxD,CAAC;QAAC,MAAM,CAAC;YACL,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBACjB,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE;oBACH,IAAI,EAAE,CAAC,KAAK;oBACZ,OAAO,EAAE,wBAAwB,UAAU,EAAE;iBAChD;gBACD,EAAE,EAAE,IAAI;aACX,CAAC,CAAC;YACH,OAAO;QACX,CAAC;QAED,IAAI,CAAC,gBAAgB,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;YACvC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;gBACjB,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE;oBACH,IAAI,EAAE,CAAC,KAAK;oBACZ,OAAO,EAAE,iBAAiB,QAAQ,EAAE;iBACvC;gBACD,EAAE,EAAE,IAAI;aACX,CAAC,CAAC;YACH,OAAO;QACX,CAAC;QACD,IAAI,EAAE,CAAC;IACX,CAAC,CAAC;AACN,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,uBAAuB;IACnC,OAAO,oBAAoB,CAAC,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;AACrE,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sse.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sse.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7fa42a58f10fa7cbcf6fa7fc1f616a8ceae966ab --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sse.d.ts @@ -0,0 +1,82 @@ +import { IncomingMessage, ServerResponse } from 'node:http'; +import { Transport } from '../shared/transport.js'; +import { JSONRPCMessage, MessageExtraInfo } from '../types.js'; +import { AuthInfo } from './auth/types.js'; +/** + * Configuration options for SSEServerTransport. + */ +export interface SSEServerTransportOptions { + /** + * List of allowed host header values for DNS rebinding protection. + * If not specified, host validation is disabled. + * @deprecated Use the `hostHeaderValidation` middleware from `@modelcontextprotocol/sdk/server/middleware/hostHeaderValidation.js` instead, + * or use `createMcpExpressApp` from `@modelcontextprotocol/sdk/server/express.js` which includes localhost protection by default. + */ + allowedHosts?: string[]; + /** + * List of allowed origin header values for DNS rebinding protection. + * If not specified, origin validation is disabled. + * @deprecated Use the `hostHeaderValidation` middleware from `@modelcontextprotocol/sdk/server/middleware/hostHeaderValidation.js` instead, + * or use `createMcpExpressApp` from `@modelcontextprotocol/sdk/server/express.js` which includes localhost protection by default. + */ + allowedOrigins?: string[]; + /** + * Enable DNS rebinding protection (requires allowedHosts and/or allowedOrigins to be configured). + * Default is false for backwards compatibility. + * @deprecated Use the `hostHeaderValidation` middleware from `@modelcontextprotocol/sdk/server/middleware/hostHeaderValidation.js` instead, + * or use `createMcpExpressApp` from `@modelcontextprotocol/sdk/server/express.js` which includes localhost protection by default. + */ + enableDnsRebindingProtection?: boolean; +} +/** + * Server transport for SSE: this will send messages over an SSE connection and receive messages from HTTP POST requests. + * + * This transport is only available in Node.js environments. + * @deprecated SSEServerTransport is deprecated. Use StreamableHTTPServerTransport instead. + */ +export declare class SSEServerTransport implements Transport { + private _endpoint; + private res; + private _sseResponse?; + private _sessionId; + private _options; + onclose?: () => void; + onerror?: (error: Error) => void; + onmessage?: (message: JSONRPCMessage, extra?: MessageExtraInfo) => void; + /** + * Creates a new SSE server transport, which will direct the client to POST messages to the relative or absolute URL identified by `_endpoint`. + */ + constructor(_endpoint: string, res: ServerResponse, options?: SSEServerTransportOptions); + /** + * Validates request headers for DNS rebinding protection. + * @returns Error message if validation fails, undefined if validation passes. + */ + private validateRequestHeaders; + /** + * Handles the initial SSE connection request. + * + * This should be called when a GET request is made to establish the SSE stream. + */ + start(): Promise; + /** + * Handles incoming POST messages. + * + * This should be called when a POST request is made to send a message to the server. + */ + handlePostMessage(req: IncomingMessage & { + auth?: AuthInfo; + }, res: ServerResponse, parsedBody?: unknown): Promise; + /** + * Handle a client message, regardless of how it arrived. This can be used to inform the server of messages that arrive via a means different than HTTP POST. + */ + handleMessage(message: unknown, extra?: MessageExtraInfo): Promise; + close(): Promise; + send(message: JSONRPCMessage): Promise; + /** + * Returns the session ID for this transport. + * + * This can be used to route incoming POST requests. + */ + get sessionId(): string; +} +//# sourceMappingURL=sse.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sse.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sse.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..56b4cb8ad3e7b9e0b7261dacbdc335e824ad5f10 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sse.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"sse.d.ts","sourceRoot":"","sources":["../../../src/server/sse.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAwB,gBAAgB,EAAe,MAAM,aAAa,CAAC;AAGlG,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAK3C;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACtC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IAExB;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAE1B;;;;;OAKG;IACH,4BAA4B,CAAC,EAAE,OAAO,CAAC;CAC1C;AAED;;;;;GAKG;AACH,qBAAa,kBAAmB,YAAW,SAAS;IAY5C,OAAO,CAAC,SAAS;IACjB,OAAO,CAAC,GAAG;IAZf,OAAO,CAAC,YAAY,CAAC,CAAiB;IACtC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,QAAQ,CAA4B;IAC5C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAExE;;OAEG;gBAES,SAAS,EAAE,MAAM,EACjB,GAAG,EAAE,cAAc,EAC3B,OAAO,CAAC,EAAE,yBAAyB;IAMvC;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IAyB9B;;;;OAIG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IA8B5B;;;;OAIG;IACG,iBAAiB,CAAC,GAAG,EAAE,eAAe,GAAG;QAAE,IAAI,CAAC,EAAE,QAAQ,CAAA;KAAE,EAAE,GAAG,EAAE,cAAc,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAuD7H;;OAEG;IACG,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;IAYxE,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAMtB,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAQlD;;;;OAIG;IACH,IAAI,SAAS,IAAI,MAAM,CAEtB;CACJ"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sse.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sse.js new file mode 100644 index 0000000000000000000000000000000000000000..f0e05765ef67ab609499b104d359e73c7290a074 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sse.js @@ -0,0 +1,165 @@ +import { randomUUID } from 'node:crypto'; +import { TLSSocket } from 'node:tls'; +import { JSONRPCMessageSchema } from '../types.js'; +import getRawBody from 'raw-body'; +import contentType from 'content-type'; +import { URL } from 'node:url'; +const MAXIMUM_MESSAGE_SIZE = '4mb'; +/** + * Server transport for SSE: this will send messages over an SSE connection and receive messages from HTTP POST requests. + * + * This transport is only available in Node.js environments. + * @deprecated SSEServerTransport is deprecated. Use StreamableHTTPServerTransport instead. + */ +export class SSEServerTransport { + /** + * Creates a new SSE server transport, which will direct the client to POST messages to the relative or absolute URL identified by `_endpoint`. + */ + constructor(_endpoint, res, options) { + this._endpoint = _endpoint; + this.res = res; + this._sessionId = randomUUID(); + this._options = options || { enableDnsRebindingProtection: false }; + } + /** + * Validates request headers for DNS rebinding protection. + * @returns Error message if validation fails, undefined if validation passes. + */ + validateRequestHeaders(req) { + // Skip validation if protection is not enabled + if (!this._options.enableDnsRebindingProtection) { + return undefined; + } + // Validate Host header if allowedHosts is configured + if (this._options.allowedHosts && this._options.allowedHosts.length > 0) { + const hostHeader = req.headers.host; + if (!hostHeader || !this._options.allowedHosts.includes(hostHeader)) { + return `Invalid Host header: ${hostHeader}`; + } + } + // Validate Origin header if allowedOrigins is configured + if (this._options.allowedOrigins && this._options.allowedOrigins.length > 0) { + const originHeader = req.headers.origin; + if (originHeader && !this._options.allowedOrigins.includes(originHeader)) { + return `Invalid Origin header: ${originHeader}`; + } + } + return undefined; + } + /** + * Handles the initial SSE connection request. + * + * This should be called when a GET request is made to establish the SSE stream. + */ + async start() { + if (this._sseResponse) { + throw new Error('SSEServerTransport already started! If using Server class, note that connect() calls start() automatically.'); + } + this.res.writeHead(200, { + 'Content-Type': 'text/event-stream', + 'Cache-Control': 'no-cache, no-transform', + Connection: 'keep-alive' + }); + // Send the endpoint event + // Use a dummy base URL because this._endpoint is relative. + // This allows using URL/URLSearchParams for robust parameter handling. + const dummyBase = 'http://localhost'; // Any valid base works + const endpointUrl = new URL(this._endpoint, dummyBase); + endpointUrl.searchParams.set('sessionId', this._sessionId); + // Reconstruct the relative URL string (pathname + search + hash) + const relativeUrlWithSession = endpointUrl.pathname + endpointUrl.search + endpointUrl.hash; + this.res.write(`event: endpoint\ndata: ${relativeUrlWithSession}\n\n`); + this._sseResponse = this.res; + this.res.on('close', () => { + this._sseResponse = undefined; + this.onclose?.(); + }); + } + /** + * Handles incoming POST messages. + * + * This should be called when a POST request is made to send a message to the server. + */ + async handlePostMessage(req, res, parsedBody) { + if (!this._sseResponse) { + const message = 'SSE connection not established'; + res.writeHead(500).end(message); + throw new Error(message); + } + // Validate request headers for DNS rebinding protection + const validationError = this.validateRequestHeaders(req); + if (validationError) { + res.writeHead(403).end(validationError); + this.onerror?.(new Error(validationError)); + return; + } + const authInfo = req.auth; + const host = req.headers.host; + const protocol = req.socket instanceof TLSSocket ? 'https' : 'http'; + const fullUrl = host && req.url ? new URL(req.url, `${protocol}://${host}`) : undefined; + const requestInfo = { + headers: req.headers, + url: fullUrl + }; + let body; + try { + const ct = contentType.parse(req.headers['content-type'] ?? ''); + if (ct.type !== 'application/json') { + throw new Error(`Unsupported content-type: ${ct.type}`); + } + body = + parsedBody ?? + (await getRawBody(req, { + limit: MAXIMUM_MESSAGE_SIZE, + encoding: ct.parameters.charset ?? 'utf-8' + })); + } + catch (error) { + res.writeHead(400).end(String(error)); + this.onerror?.(error); + return; + } + try { + await this.handleMessage(typeof body === 'string' ? JSON.parse(body) : body, { requestInfo, authInfo }); + } + catch { + res.writeHead(400).end(`Invalid message: ${body}`); + return; + } + res.writeHead(202).end('Accepted'); + } + /** + * Handle a client message, regardless of how it arrived. This can be used to inform the server of messages that arrive via a means different than HTTP POST. + */ + async handleMessage(message, extra) { + let parsedMessage; + try { + parsedMessage = JSONRPCMessageSchema.parse(message); + } + catch (error) { + this.onerror?.(error); + throw error; + } + this.onmessage?.(parsedMessage, extra); + } + async close() { + this._sseResponse?.end(); + this._sseResponse = undefined; + this.onclose?.(); + } + async send(message) { + if (!this._sseResponse) { + throw new Error('Not connected'); + } + this._sseResponse.write(`event: message\ndata: ${JSON.stringify(message)}\n\n`); + } + /** + * Returns the session ID for this transport. + * + * This can be used to route incoming POST requests. + */ + get sessionId() { + return this._sessionId; + } +} +//# sourceMappingURL=sse.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sse.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sse.js.map new file mode 100644 index 0000000000000000000000000000000000000000..8e9c4ef5490f2d532325c22b92e6d38b47f5974d --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sse.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sse.js","sourceRoot":"","sources":["../../../src/server/sse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,SA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,EAAE,CAAC,KAAc,CAAC,CAAC;YAC/B,MAAM,KAAK,CAAC;QAChB,CAAC;QAED,IAAI,CAAC,SAAS,EAAE,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,KAAK;QACP,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,YAAY,GAAG,SAAS,CAAC;QAC9B,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;IACrB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,OAAuB;QAC9B,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;QACrC,CAAC;QAED,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,yBAAyB,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACpF,CAAC;IAED;;;;OAIG;IACH,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;CACJ"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..27a3f4fe9c3cd569214279a7d644a6adc0b832a7 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.d.ts @@ -0,0 +1,5 @@ +/** Default interval between SSE keep-alive comment frames. */ +export declare const DEFAULT_SSE_KEEP_ALIVE_MS = 15000; +/** Arms an unref'd timer, or disables keep-alive for invalid delays. */ +export declare function armSseKeepAlive(intervalMs: number, onTick: () => void): ReturnType | undefined; +//# sourceMappingURL=sseKeepAlive.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..2b904a2e98261d69d625eb0dc01fe3ebbf7274aa --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"sseKeepAlive.d.ts","sourceRoot":"","sources":["../../../src/server/sseKeepAlive.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,eAAO,MAAM,yBAAyB,QAAS,CAAC;AAIhD,wEAAwE;AACxE,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,GAAG,SAAS,CAQlH"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.js new file mode 100644 index 0000000000000000000000000000000000000000..0be11aecd07cd613422917183b64c49608a02006 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.js @@ -0,0 +1,13 @@ +/** Default interval between SSE keep-alive comment frames. */ +export const DEFAULT_SSE_KEEP_ALIVE_MS = 15000; +const MAX_TIMER_DELAY_MS = 2 ** 31 - 1; +/** Arms an unref'd timer, or disables keep-alive for invalid delays. */ +export function armSseKeepAlive(intervalMs, onTick) { + if (!Number.isFinite(intervalMs) || intervalMs < 1) { + return undefined; + } + const timer = setInterval(onTick, Math.min(intervalMs, MAX_TIMER_DELAY_MS)); + timer.unref?.(); + return timer; +} +//# sourceMappingURL=sseKeepAlive.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.js.map new file mode 100644 index 0000000000000000000000000000000000000000..90160c8c923c696d538d6598b3dfe5940b0552c9 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/sseKeepAlive.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sseKeepAlive.js","sourceRoot":"","sources":["../../../src/server/sseKeepAlive.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,MAAM,CAAC,MAAM,yBAAyB,GAAG,KAAM,CAAC;AAEhD,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAEvC,wEAAwE;AACxE,MAAM,UAAU,eAAe,CAAC,UAAkB,EAAE,MAAkB;IAClE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,UAAU,GAAG,CAAC,EAAE,CAAC;QACjD,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,MAAM,KAAK,GAAG,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC,CAAC;IAC3E,KAAgC,CAAC,KAAK,EAAE,EAAE,CAAC;IAC5C,OAAO,KAAK,CAAC;AACjB,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c59fdd0fc044f8ff6d0ce7eb2d26210e6425927e --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.d.ts @@ -0,0 +1,36 @@ +import { Readable, Writable } from 'node:stream'; +import { JSONRPCMessage } from '../types.js'; +import { Transport } from '../shared/transport.js'; +/** + * Server transport for stdio: this communicates with an MCP client by reading from the current process' stdin and writing to stdout. + * + * This transport is only available in Node.js environments. + */ +export declare class StdioServerTransport implements Transport { + private _stdin; + private _stdout; + private _readBuffer; + private _started; + constructor(_stdin?: Readable, _stdout?: Writable, options?: { + /** + * Maximum size of the read buffer in bytes. If a single message exceeds + * this size the transport will emit an error and close. + * + * Defaults to 10 MB. + */ + maxBufferSize?: number; + }); + onclose?: () => void; + onerror?: (error: Error) => void; + onmessage?: (message: JSONRPCMessage) => void; + _ondata: (chunk: Buffer) => void; + _onerror: (error: Error) => void; + /** + * Starts listening for messages on stdin. + */ + start(): Promise; + private processReadBuffer; + close(): Promise; + send(message: JSONRPCMessage): Promise; +} +//# sourceMappingURL=stdio.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..e44a4a0e91c381540897e701ee1cb9c4aeeb005c --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../../../src/server/stdio.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEjD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD;;;;GAIG;AACH,qBAAa,oBAAqB,YAAW,SAAS;IAK9C,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,OAAO;IALnB,OAAO,CAAC,WAAW,CAAa;IAChC,OAAO,CAAC,QAAQ,CAAS;gBAGb,MAAM,GAAE,QAAwB,EAChC,OAAO,GAAE,QAAyB,EAC1C,OAAO,CAAC,EAAE;QACN;;;;;WAKG;QACH,aAAa,CAAC,EAAE,MAAM,CAAC;KAC1B;IAKL,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACjC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,IAAI,CAAC;IAG9C,OAAO,UAAW,MAAM,UAQtB;IACF,QAAQ,UAAW,KAAK,UAEtB;IAEF;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAY5B,OAAO,CAAC,iBAAiB;IAenB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAkB5B,IAAI,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAU/C"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js new file mode 100644 index 0000000000000000000000000000000000000000..76e877ede5f84d172e1ced16be24845112fc152c --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js @@ -0,0 +1,81 @@ +import process from 'node:process'; +import { ReadBuffer, serializeMessage } from '../shared/stdio.js'; +/** + * Server transport for stdio: this communicates with an MCP client by reading from the current process' stdin and writing to stdout. + * + * This transport is only available in Node.js environments. + */ +export class StdioServerTransport { + constructor(_stdin = process.stdin, _stdout = process.stdout, options) { + this._stdin = _stdin; + this._stdout = _stdout; + this._started = false; + // Arrow functions to bind `this` properly, while maintaining function identity. + this._ondata = (chunk) => { + try { + this._readBuffer.append(chunk); + this.processReadBuffer(); + } + catch (error) { + this.onerror?.(error); + this.close().catch(() => { }); + } + }; + this._onerror = (error) => { + this.onerror?.(error); + }; + this._readBuffer = new ReadBuffer({ maxBufferSize: options?.maxBufferSize }); + } + /** + * Starts listening for messages on stdin. + */ + async start() { + if (this._started) { + throw new Error('StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.'); + } + this._started = true; + this._stdin.on('data', this._ondata); + this._stdin.on('error', this._onerror); + } + processReadBuffer() { + while (true) { + try { + const message = this._readBuffer.readMessage(); + if (message === null) { + break; + } + this.onmessage?.(message); + } + catch (error) { + this.onerror?.(error); + } + } + } + async close() { + // Remove our event listeners first + this._stdin.off('data', this._ondata); + this._stdin.off('error', this._onerror); + // Check if we were the only data listener + const remainingDataListeners = this._stdin.listenerCount('data'); + if (remainingDataListeners === 0) { + // Only pause stdin if we were the only listener + // This prevents interfering with other parts of the application that might be using stdin + this._stdin.pause(); + } + // Clear the buffer and notify closure + this._readBuffer.clear(); + this.onclose?.(); + } + send(message) { + return new Promise(resolve => { + const json = serializeMessage(message); + if (this._stdout.write(json)) { + resolve(); + } + else { + this._stdout.once('drain', resolve); + } + }); + } +} +//# sourceMappingURL=stdio.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js.map new file mode 100644 index 0000000000000000000000000000000000000000..6cd62ed897972277abf5fd37eebecb7f7ff7944c --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js.map @@ -0,0 +1 @@ +{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../../../src/server/stdio.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAIlE;;;;GAIG;AACH,MAAM,OAAO,oBAAoB;IAI7B,YACY,SAAmB,OAAO,CAAC,KAAK,EAChC,UAAoB,OAAO,CAAC,MAAM,EAC1C,OAQC;QAVO,WAAM,GAAN,MAAM,CAA0B;QAChC,YAAO,GAAP,OAAO,CAA2B;QAJtC,aAAQ,GAAG,KAAK,CAAC;QAsBzB,gFAAgF;QAChF,YAAO,GAAG,CAAC,KAAa,EAAE,EAAE;YACxB,IAAI,CAAC;gBACD,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBAC/B,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC7B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACb,IAA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I,CAAC,OAAO,CAAC,CAAC;QACtC,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;QAExC,0CAA0C;QAC1C,MAAM,sBAAsB,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QACjE,IAAI,sBAAsB,KAAK,CAAC,EAAE,CAAC;YAC/B,gDAAgD;YAChD,0FAA0F;YAC1F,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACxB,CAAC;QAED,sCAAsC;QACtC,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;QACzB,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;IACrB,CAAC;IAED,IAAI,CAAC,OAAuB;QACxB,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;YACzB,MAAM,IAAI,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;YACvC,IAAI,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBAC3B,OAAO,EAAE,CAAC;YACd,CAAC;iBAAM,CAAC;gBACJ,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YACxC,CAAC;QACL,CAAC,CAAC,CAAC;IACP,CAAC;CACJ"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/streamableHttp.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/streamableHttp.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5d5564bd11a519ce6f4aa02d5d9907f3b10139c2 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/streamableHttp.d.ts @@ -0,0 +1,122 @@ +/** + * Node.js HTTP Streamable HTTP Server Transport + * + * This is a thin wrapper around `WebStandardStreamableHTTPServerTransport` that provides + * compatibility with Node.js HTTP server (IncomingMessage/ServerResponse). + * + * For web-standard environments (Cloudflare Workers, Deno, Bun), use `WebStandardStreamableHTTPServerTransport` directly. + */ +import { IncomingMessage, ServerResponse } from 'node:http'; +import { Transport } from '../shared/transport.js'; +import { AuthInfo } from './auth/types.js'; +import { MessageExtraInfo, JSONRPCMessage, RequestId } from '../types.js'; +import { WebStandardStreamableHTTPServerTransportOptions, EventStore, StreamId, EventId } from './webStandardStreamableHttp.js'; +export type { EventStore, StreamId, EventId }; +/** + * Configuration options for StreamableHTTPServerTransport + * + * This is an alias for WebStandardStreamableHTTPServerTransportOptions for backward compatibility. + */ +export type StreamableHTTPServerTransportOptions = WebStandardStreamableHTTPServerTransportOptions; +/** + * Server transport for Streamable HTTP: this implements the MCP Streamable HTTP transport specification. + * It supports both SSE streaming and direct HTTP responses. + * + * This is a wrapper around `WebStandardStreamableHTTPServerTransport` that provides Node.js HTTP compatibility. + * It uses the `@hono/node-server` library to convert between Node.js HTTP and Web Standard APIs. + * + * Usage example: + * + * ```typescript + * // Stateful mode - server sets the session ID + * const statefulTransport = new StreamableHTTPServerTransport({ + * sessionIdGenerator: () => randomUUID(), + * }); + * + * // Stateless mode - explicitly set session ID to undefined + * const statelessTransport = new StreamableHTTPServerTransport({ + * sessionIdGenerator: undefined, + * }); + * + * // Using with pre-parsed request body + * app.post('/mcp', (req, res) => { + * transport.handleRequest(req, res, req.body); + * }); + * ``` + * + * In stateful mode: + * - Session ID is generated and included in response headers + * - Session ID is always included in initialization responses + * - Requests with invalid session IDs are rejected with 404 Not Found + * - Non-initialization requests without a session ID are rejected with 400 Bad Request + * - State is maintained in-memory (connections, message history) + * + * In stateless mode: + * - No Session ID is included in any responses + * - No session validation is performed + */ +export declare class StreamableHTTPServerTransport implements Transport { + private _webStandardTransport; + private _requestListener; + private _requestContext; + constructor(options?: StreamableHTTPServerTransportOptions); + /** + * Gets the session ID for this transport instance. + */ + get sessionId(): string | undefined; + /** + * Sets callback for when the transport is closed. + */ + set onclose(handler: (() => void) | undefined); + get onclose(): (() => void) | undefined; + /** + * Sets callback for transport errors. + */ + set onerror(handler: ((error: Error) => void) | undefined); + get onerror(): ((error: Error) => void) | undefined; + /** + * Sets callback for incoming messages. + */ + set onmessage(handler: ((message: JSONRPCMessage, extra?: MessageExtraInfo) => void) | undefined); + get onmessage(): ((message: JSONRPCMessage, extra?: MessageExtraInfo) => void) | undefined; + /** + * Starts the transport. This is required by the Transport interface but is a no-op + * for the Streamable HTTP transport as connections are managed per-request. + */ + start(): Promise; + /** + * Closes the transport and all active connections. + */ + close(): Promise; + /** + * Sends a JSON-RPC message through the transport. + */ + send(message: JSONRPCMessage, options?: { + relatedRequestId?: RequestId; + }): Promise; + /** + * Handles an incoming HTTP request, whether GET or POST. + * + * This method converts Node.js HTTP objects to Web Standard Request/Response + * and delegates to the underlying WebStandardStreamableHTTPServerTransport. + * + * @param req - Node.js IncomingMessage, optionally with auth property from middleware + * @param res - Node.js ServerResponse + * @param parsedBody - Optional pre-parsed body from body-parser middleware + */ + handleRequest(req: IncomingMessage & { + auth?: AuthInfo; + }, res: ServerResponse, parsedBody?: unknown): Promise; + /** + * Close an SSE stream for a specific request, triggering client reconnection. + * Use this to implement polling behavior during long-running operations - + * client will reconnect after the retry interval specified in the priming event. + */ + closeSSEStream(requestId: RequestId): void; + /** + * Close the standalone GET SSE stream, triggering client reconnection. + * Use this to implement polling behavior for server-initiated notifications. + */ + closeStandaloneSSEStream(): void; +} +//# sourceMappingURL=streamableHttp.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/streamableHttp.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/streamableHttp.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..f9e54b43e826d51d10c9ad77f8415d09955ca6a3 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/streamableHttp.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"streamableHttp.d.ts","sourceRoot":"","sources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,KAAK,CAAC,EAAE,gBAAgB,KAAK,IAAI,CAAC,GAAG,SAAS,EAE/F;IAED,IAAI,SAAS,IAAI,CAAC,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,CAAC,EAAE,gBAAgB,KAAK,IAAI,CAAC,GAAG,SAAS,CAEzF;IAED;;;OAGG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAI5B;;OAEG;IACG,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE;QAAE,gBAAgB,CAAC,EAAE,SAAS,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9F;;;;;;;;;OASG;IACG,aAAa,CAAC,GAAG,EAAE,eAAe,GAAG;QAAE,IAAI,CAAC,EAAE,QAAQ,CAAA;KAAE,EAAE,GAAG,EAAE,cAAc,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAuBzH;;;;OAIG;IACH,cAAc,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAI1C;;;OAGG;IACH,wBAAwB,IAAI,IAAI;CAGnC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/streamableHttp.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/streamableHttp.js new file mode 100644 index 0000000000000000000000000000000000000000..143ee17c11167531f4e21c29e37937940ca6ab03 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/streamableHttp.js @@ -0,0 +1,161 @@ +/** + * Node.js HTTP Streamable HTTP Server Transport + * + * This is a thin wrapper around `WebStandardStreamableHTTPServerTransport` that provides + * compatibility with Node.js HTTP server (IncomingMessage/ServerResponse). + * + * For web-standard environments (Cloudflare Workers, Deno, Bun), use `WebStandardStreamableHTTPServerTransport` directly. + */ +import { getRequestListener } from '@hono/node-server'; +import { WebStandardStreamableHTTPServerTransport } from './webStandardStreamableHttp.js'; +/** + * Server transport for Streamable HTTP: this implements the MCP Streamable HTTP transport specification. + * It supports both SSE streaming and direct HTTP responses. + * + * This is a wrapper around `WebStandardStreamableHTTPServerTransport` that provides Node.js HTTP compatibility. + * It uses the `@hono/node-server` library to convert between Node.js HTTP and Web Standard APIs. + * + * Usage example: + * + * ```typescript + * // Stateful mode - server sets the session ID + * const statefulTransport = new StreamableHTTPServerTransport({ + * sessionIdGenerator: () => randomUUID(), + * }); + * + * // Stateless mode - explicitly set session ID to undefined + * const statelessTransport = new StreamableHTTPServerTransport({ + * sessionIdGenerator: undefined, + * }); + * + * // Using with pre-parsed request body + * app.post('/mcp', (req, res) => { + * transport.handleRequest(req, res, req.body); + * }); + * ``` + * + * In stateful mode: + * - Session ID is generated and included in response headers + * - Session ID is always included in initialization responses + * - Requests with invalid session IDs are rejected with 404 Not Found + * - Non-initialization requests without a session ID are rejected with 400 Bad Request + * - State is maintained in-memory (connections, message history) + * + * In stateless mode: + * - No Session ID is included in any responses + * - No session validation is performed + */ +export class StreamableHTTPServerTransport { + constructor(options = {}) { + // Store auth and parsedBody per request for passing through to handleRequest + this._requestContext = new WeakMap(); + this._webStandardTransport = new WebStandardStreamableHTTPServerTransport(options); + // Create a request listener that wraps the web standard transport + // getRequestListener converts Node.js HTTP to Web Standard and properly handles SSE streaming + // overrideGlobalObjects: false prevents Hono from overwriting global Response, which would + // break frameworks like Next.js whose response classes extend the native Response + this._requestListener = getRequestListener(async (webRequest) => { + // Get context if available (set during handleRequest) + const context = this._requestContext.get(webRequest); + return this._webStandardTransport.handleRequest(webRequest, { + authInfo: context?.authInfo, + parsedBody: context?.parsedBody + }); + }, { overrideGlobalObjects: false }); + } + /** + * Gets the session ID for this transport instance. + */ + get sessionId() { + return this._webStandardTransport.sessionId; + } + /** + * Sets callback for when the transport is closed. + */ + set onclose(handler) { + this._webStandardTransport.onclose = handler; + } + get onclose() { + return this._webStandardTransport.onclose; + } + /** + * Sets callback for transport errors. + */ + set onerror(handler) { + this._webStandardTransport.onerror = handler; + } + get onerror() { + return this._webStandardTransport.onerror; + } + /** + * Sets callback for incoming messages. + */ + set onmessage(handler) { + this._webStandardTransport.onmessage = handler; + } + get onmessage() { + return this._webStandardTransport.onmessage; + } + /** + * Starts the transport. This is required by the Transport interface but is a no-op + * for the Streamable HTTP transport as connections are managed per-request. + */ + async start() { + return this._webStandardTransport.start(); + } + /** + * Closes the transport and all active connections. + */ + async close() { + return this._webStandardTransport.close(); + } + /** + * Sends a JSON-RPC message through the transport. + */ + async send(message, options) { + return this._webStandardTransport.send(message, options); + } + /** + * Handles an incoming HTTP request, whether GET or POST. + * + * This method converts Node.js HTTP objects to Web Standard Request/Response + * and delegates to the underlying WebStandardStreamableHTTPServerTransport. + * + * @param req - Node.js IncomingMessage, optionally with auth property from middleware + * @param res - Node.js ServerResponse + * @param parsedBody - Optional pre-parsed body from body-parser middleware + */ + async handleRequest(req, res, parsedBody) { + // Store context for this request to pass through auth and parsedBody + // We need to intercept the request creation to attach this context + const authInfo = req.auth; + // Create a custom handler that includes our context + // overrideGlobalObjects: false prevents Hono from overwriting global Response, which would + // break frameworks like Next.js whose response classes extend the native Response + const handler = getRequestListener(async (webRequest) => { + return this._webStandardTransport.handleRequest(webRequest, { + authInfo, + parsedBody + }); + }, { overrideGlobalObjects: false }); + // Delegate to the request listener which handles all the Node.js <-> Web Standard conversion + // including proper SSE streaming support + await handler(req, res); + } + /** + * Close an SSE stream for a specific request, triggering client reconnection. + * Use this to implement polling behavior during long-running operations - + * client will reconnect after the retry interval specified in the priming event. + */ + closeSSEStream(requestId) { + this._webStandardTransport.closeSSEStream(requestId); + } + /** + * Close the standalone GET SSE stream, triggering client reconnection. + * Use this to implement polling behavior for server-initiated notifications. + */ + closeStandaloneSSEStream() { + this._webStandardTransport.closeStandaloneSSEStream(); + } +} +//# sourceMappingURL=streamableHttp.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/streamableHttp.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/streamableHttp.js.map new file mode 100644 index 0000000000000000000000000000000000000000..b03f1f2a173d10bc8cb9a86c62f59a302de1e1ae --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/streamableHttp.js.map @@ -0,0 +1 @@ +{"version":3,"file":"streamableHttp.js","sourceRoot":"","sources":["../../../src/server/streamableHttp.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAIvD,OAAO,EACH,wCAAwC,EAK3C,MAAM,gCAAgC,CAAC;AAYxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,OAAO,6BAA6B;IAMtC,YAAY,UAAgD,EAAE;QAH9D,6EAA6E;QACrE,oBAAe,GAAoE,IAAI,OAAO,EAAE,CAAC;QAGrG,IAAI,CAAC,qBAAqB,GAAG,IAAI,wCAAwC,CAAC,OAAO,CAAC,CAAC;QAEnF,kEAAkE;QAClE,8FAA8F;QAC9F,2FAA2F;QAC3F,kFAAkF;QAClF,IAAI,CAAC,gBAAgB,GAAG,kBAAkB,CACtC,KAAK,EAAE,UAAmB,EAAE,EAAE;YAC1B,sDAAsD;YACtD,MAAM,OAAO,GAAG,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YACrD,OAAO,IAAI,CAAC,qBAAqB,CAAC,aAAa,CAAC,UAAU,EAAE;gBACxD,QAAQ,EAAE,OAAO,EAAE,QAAQ;gBAC3B,UAAU,EAAE,OAAO,EAAE,UAAU;aAClC,CAAC,CAAC;QACP,CAAC,EACD,EAAE,qBAAqB,EAAE,KAAK,EAAE,CACnC,CAAC;IACN,CAAC;IAED;;OAEG;IACH,IAAI,SAAS;QACT,OAAO,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC;IAChD,CAAC;IAED;;O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AAqB,CAAC,aAAa,CAAC,UAAU,EAAE;gBACxD,QAAQ;gBACR,UAAU;aACb,CAAC,CAAC;QACP,CAAC,EACD,EAAE,qBAAqB,EAAE,KAAK,EAAE,CACnC,CAAC;QAEF,6FAA6F;QAC7F,yCAAyC;QACzC,MAAM,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACH,cAAc,CAAC,SAAoB;QAC/B,IAAI,CAAC,qBAAqB,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;IACzD,CAAC;IAED;;;OAGG;IACH,wBAAwB;QACpB,IAAI,CAAC,qBAAqB,CAAC,wBAAwB,EAAE,CAAC;IAC1D,CAAC;CACJ"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..56131888004df0e88bb0782ffd68b97f6ee1eae1 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.d.ts @@ -0,0 +1,289 @@ +/** + * Web Standards Streamable HTTP Server Transport + * + * This is the core transport implementation using Web Standard APIs (Request, Response, ReadableStream). + * It can run on any runtime that supports Web Standards: Node.js 18+, Cloudflare Workers, Deno, Bun, etc. + * + * For Node.js Express/HTTP compatibility, use `StreamableHTTPServerTransport` which wraps this transport. + */ +import { Transport } from '../shared/transport.js'; +import { AuthInfo } from './auth/types.js'; +import { MessageExtraInfo, JSONRPCMessage, RequestId } from '../types.js'; +export type StreamId = string; +export type EventId = string; +/** + * Interface for resumability support via event storage + */ +export interface EventStore { + /** + * Stores an event for later retrieval + * @param streamId ID of the stream the event belongs to + * @param message The JSON-RPC message to store + * @returns The generated event ID for the stored event + */ + storeEvent(streamId: StreamId, message: JSONRPCMessage): Promise; + /** + * Get the stream ID associated with a given event ID. + * @param eventId The event ID to look up + * @returns The stream ID, or undefined if not found + * + * Optional: If not provided, the SDK will use the streamId returned by + * replayEventsAfter for stream mapping. + */ + getStreamIdForEventId?(eventId: EventId): Promise; + replayEventsAfter(lastEventId: EventId, { send }: { + send: (eventId: EventId, message: JSONRPCMessage) => Promise; + }): Promise; +} +/** + * Configuration options for WebStandardStreamableHTTPServerTransport + */ +export interface WebStandardStreamableHTTPServerTransportOptions { + /** + * Function that generates a session ID for the transport. + * The session ID SHOULD be globally unique and cryptographically secure (e.g., a securely generated UUID, a JWT, or a cryptographic hash) + * + * If not provided, session management is disabled (stateless mode). + */ + sessionIdGenerator?: () => string; + /** + * A callback for session initialization events + * This is called when the server initializes a new session. + * Useful in cases when you need to register multiple mcp sessions + * and need to keep track of them. + * @param sessionId The generated session ID + */ + onsessioninitialized?: (sessionId: string) => void | Promise; + /** + * A callback for session close events + * This is called when the server closes a session due to a DELETE request. + * Useful in cases when you need to clean up resources associated with the session. + * Note that this is different from the transport closing, if you are handling + * HTTP requests from multiple nodes you might want to close each + * WebStandardStreamableHTTPServerTransport after a request is completed while still keeping the + * session open/running. + * @param sessionId The session ID that was closed + */ + onsessionclosed?: (sessionId: string) => void | Promise; + /** + * If true, the server will return JSON responses instead of starting an SSE stream. + * This can be useful for simple request/response scenarios without streaming. + * Default is false (SSE streams are preferred). + */ + enableJsonResponse?: boolean; + /** + * Event store for resumability support + * If provided, resumability will be enabled, allowing clients to reconnect and resume messages + */ + eventStore?: EventStore; + /** + * List of allowed host header values for DNS rebinding protection. + * If not specified, host validation is disabled. + * @deprecated Use external middleware for host validation instead. + */ + allowedHosts?: string[]; + /** + * List of allowed origin header values for DNS rebinding protection. + * If not specified, origin validation is disabled. + * @deprecated Use external middleware for origin validation instead. + */ + allowedOrigins?: string[]; + /** + * Enable DNS rebinding protection (requires allowedHosts and/or allowedOrigins to be configured). + * Default is false for backwards compatibility. + * @deprecated Use external middleware for DNS rebinding protection instead. + */ + enableDnsRebindingProtection?: boolean; + /** + * Retry interval in milliseconds to suggest to clients in SSE retry field. + * When set, the server will send a retry field in SSE priming events to control + * client reconnection timing for polling behavior. + */ + retryInterval?: number; + /** + * Interval in milliseconds between SSE keep-alive comment frames. + * Defaults to `15000`; values below 1 (including `0`) disable keep-alive. + */ + keepAliveMs?: number; +} +/** + * Options for handling a request + */ +export interface HandleRequestOptions { + /** + * Pre-parsed request body. If provided, the transport will use this instead of parsing req.json(). + * Useful when using body-parser middleware that has already parsed the body. + */ + parsedBody?: unknown; + /** + * Authentication info from middleware. If provided, will be passed to message handlers. + */ + authInfo?: AuthInfo; +} +/** + * Server transport for Web Standards Streamable HTTP: this implements the MCP Streamable HTTP transport specification + * using Web Standard APIs (Request, Response, ReadableStream). + * + * This transport works on any runtime that supports Web Standards: Node.js 18+, Cloudflare Workers, Deno, Bun, etc. + * + * Usage example: + * + * ```typescript + * // Stateful mode - server sets the session ID + * const statefulTransport = new WebStandardStreamableHTTPServerTransport({ + * sessionIdGenerator: () => crypto.randomUUID(), + * }); + * + * // Stateless mode - explicitly set session ID to undefined + * const statelessTransport = new WebStandardStreamableHTTPServerTransport({ + * sessionIdGenerator: undefined, + * }); + * + * // Hono.js usage + * app.all('/mcp', async (c) => { + * return transport.handleRequest(c.req.raw); + * }); + * + * // Cloudflare Workers usage + * export default { + * async fetch(request: Request): Promise { + * return transport.handleRequest(request); + * } + * }; + * ``` + * + * In stateful mode: + * - Session ID is generated and included in response headers + * - Session ID is always included in initialization responses + * - Requests with invalid session IDs are rejected with 404 Not Found + * - Non-initialization requests without a session ID are rejected with 400 Bad Request + * - State is maintained in-memory (connections, message history) + * + * In stateless mode: + * - No Session ID is included in any responses + * - No session validation is performed + */ +export declare class WebStandardStreamableHTTPServerTransport implements Transport { + private sessionIdGenerator; + private _started; + private _hasHandledRequest; + private _streamMapping; + private _requestToStreamMapping; + /** + * Request streams whose client holds a Last-Event-ID cursor (at least one + * id-bearing event was delivered on them), so a stored response can be + * replayed on resume. + */ + private _resumableStreams; + private _requestResponseMap; + private _initialized; + private _enableJsonResponse; + private _standaloneSseStreamId; + private _eventStore?; + private _onsessioninitialized?; + private _onsessionclosed?; + private _allowedHosts?; + private _allowedOrigins?; + private _enableDnsRebindingProtection; + private _retryInterval?; + private _keepAliveMs; + private _closed; + sessionId?: string; + onclose?: () => void; + onerror?: (error: Error) => void; + onmessage?: (message: JSONRPCMessage, extra?: MessageExtraInfo) => void; + constructor(options?: WebStandardStreamableHTTPServerTransportOptions); + /** + * Arms a keep-alive interval for an SSE stream that periodically writes an SSE + * comment frame so intermediaries and idle timeouts don't kill the connection. + * The returned timer is owned by the stream it was armed for: the stream's + * cancel/cleanup callbacks must clear it. The interval clears itself if a + * write fails (stream already closed/cancelled). + */ + private startKeepAlive; + /** + * Starts the transport. This is required by the Transport interface but is a no-op + * for the Streamable HTTP transport as connections are managed per-request. + */ + start(): Promise; + /** + * Helper to create a JSON error response + */ + private createJsonErrorResponse; + /** + * Validates request headers for DNS rebinding protection. + * @returns Error response if validation fails, undefined if validation passes. + */ + private validateRequestHeaders; + /** + * Handles an incoming HTTP request, whether GET, POST, or DELETE + * Returns a Response object (Web Standard) + */ + handleRequest(req: Request, options?: HandleRequestOptions): Promise; + /** + * Writes a priming event to establish resumption capability. + * Only sends if eventStore is configured (opt-in for resumability) and + * the client's protocol version supports empty SSE data (>= 2025-11-25). + */ + private writePrimingEvent; + /** + * Handles GET requests for SSE stream + */ + private handleGetRequest; + /** + * Replays events that would have been sent after the specified event ID + * Only used when resumability is enabled + */ + private replayEvents; + /** + * Writes an event to an SSE stream via controller with proper formatting + */ + private writeSSEEvent; + /** + * Handles unsupported requests (PUT, PATCH, etc.) + */ + private handleUnsupportedRequest; + /** + * Handles POST requests containing JSON-RPC messages + */ + private handlePostRequest; + /** + * Handles DELETE requests to terminate sessions + */ + private handleDeleteRequest; + /** + * Validates session ID for non-initialization requests. + * Returns Response error if invalid, undefined otherwise + */ + private validateSession; + /** + * Validates the MCP-Protocol-Version header on incoming requests. + * + * For initialization: Version negotiation handles unknown versions gracefully + * (server responds with its supported version). + * + * For subsequent requests with MCP-Protocol-Version header: + * - Accept if in supported list + * - 400 if unsupported + * + * For HTTP requests without the MCP-Protocol-Version header: + * - Accept and default to the version negotiated at initialization + */ + private validateProtocolVersion; + close(): Promise; + /** + * Close an SSE stream for a specific request, triggering client reconnection. + * Use this to implement polling behavior during long-running operations - + * client will reconnect after the retry interval specified in the priming event. + */ + closeSSEStream(requestId: RequestId): void; + /** + * Close the standalone GET SSE stream, triggering client reconnection. + * Use this to implement polling behavior for server-initiated notifications. + */ + closeStandaloneSSEStream(): void; + send(message: JSONRPCMessage, options?: { + relatedRequestId?: RequestId; + }): Promise; +} +//# sourceMappingURL=webStandardStreamableHttp.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..26b6dcc722f4af7de0c7ad2532881084541c0813 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"webStandardStreamableHttp.d.ts","sourceRoot":"","sources":["../../../src/server/webStandardStreamableHttp.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAO,EACH,gBAAgB,EAMhB,cAAc,EAEd,SAAS,EAGZ,MAAM,aAAa,CAAC;AAErB,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAC9B,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC;AAE7B;;GAEG;AACH,MAAM,WAAW,UAAU;IACvB;;;;;OAKG;IACH,UAAU,CAAC,QAAQ,EAAE,QAAQ,EA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B;;;OAGG;IACG,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,QAAQ,CAAC;IA8BpF;;;;OAIG;YACW,iBAAiB;IA2B/B;;OAEG;YACW,gBAAgB;IA2F9B;;;OAGG;YACW,YAAY;IA4H1B;;OAEG;IACH,OAAO,CAAC,aAAa;IAqBrB;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAqBhC;;OAEG;YACW,iBAAiB;IAwQ/B;;OAEG;YACW,mBAAmB;IAkBjC;;;OAGG;IACH,OAAO,CAAC,eAAe;IA6BvB;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,uBAAuB;IAmBzB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAoB5B;;;;OAIG;IACH,cAAc,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI;IAU1C;;;OAGG;IACH,wBAAwB,IAAI,IAAI;IAO1B,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE;QAAE,gBAAgB,CAAC,EAAE,SAAS,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAqJjG"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js new file mode 100644 index 0000000000000000000000000000000000000000..469abcff61f56c535f7e0c1da8fd637958e39f96 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js @@ -0,0 +1,949 @@ +/** + * Web Standards Streamable HTTP Server Transport + * + * This is the core transport implementation using Web Standard APIs (Request, Response, ReadableStream). + * It can run on any runtime that supports Web Standards: Node.js 18+, Cloudflare Workers, Deno, Bun, etc. + * + * For Node.js Express/HTTP compatibility, use `StreamableHTTPServerTransport` which wraps this transport. + */ +import { isJsonContentType } from '../shared/mediaType.js'; +import { armSseKeepAlive, DEFAULT_SSE_KEEP_ALIVE_MS } from './sseKeepAlive.js'; +import { isInitializeRequest, isJSONRPCErrorResponse, isJSONRPCRequest, isJSONRPCResultResponse, JSONRPCMessageSchema, SUPPORTED_PROTOCOL_VERSIONS, DEFAULT_NEGOTIATED_PROTOCOL_VERSION } from '../types.js'; +/** + * Server transport for Web Standards Streamable HTTP: this implements the MCP Streamable HTTP transport specification + * using Web Standard APIs (Request, Response, ReadableStream). + * + * This transport works on any runtime that supports Web Standards: Node.js 18+, Cloudflare Workers, Deno, Bun, etc. + * + * Usage example: + * + * ```typescript + * // Stateful mode - server sets the session ID + * const statefulTransport = new WebStandardStreamableHTTPServerTransport({ + * sessionIdGenerator: () => crypto.randomUUID(), + * }); + * + * // Stateless mode - explicitly set session ID to undefined + * const statelessTransport = new WebStandardStreamableHTTPServerTransport({ + * sessionIdGenerator: undefined, + * }); + * + * // Hono.js usage + * app.all('/mcp', async (c) => { + * return transport.handleRequest(c.req.raw); + * }); + * + * // Cloudflare Workers usage + * export default { + * async fetch(request: Request): Promise { + * return transport.handleRequest(request); + * } + * }; + * ``` + * + * In stateful mode: + * - Session ID is generated and included in response headers + * - Session ID is always included in initialization responses + * - Requests with invalid session IDs are rejected with 404 Not Found + * - Non-initialization requests without a session ID are rejected with 400 Bad Request + * - State is maintained in-memory (connections, message history) + * + * In stateless mode: + * - No Session ID is included in any responses + * - No session validation is performed + */ +export class WebStandardStreamableHTTPServerTransport { + constructor(options = {}) { + this._started = false; + this._hasHandledRequest = false; + this._streamMapping = new Map(); + this._requestToStreamMapping = new Map(); + /** + * Request streams whose client holds a Last-Event-ID cursor (at least one + * id-bearing event was delivered on them), so a stored response can be + * replayed on resume. + */ + this._resumableStreams = new Set(); + this._requestResponseMap = new Map(); + this._initialized = false; + this._enableJsonResponse = false; + this._standaloneSseStreamId = '_GET_stream'; + this._closed = false; + this.sessionIdGenerator = options.sessionIdGenerator; + this._enableJsonResponse = options.enableJsonResponse ?? false; + this._eventStore = options.eventStore; + this._onsessioninitialized = options.onsessioninitialized; + this._onsessionclosed = options.onsessionclosed; + this._allowedHosts = options.allowedHosts; + this._allowedOrigins = options.allowedOrigins; + this._enableDnsRebindingProtection = options.enableDnsRebindingProtection ?? false; + this._retryInterval = options.retryInterval; + this._keepAliveMs = options.keepAliveMs ?? DEFAULT_SSE_KEEP_ALIVE_MS; + } + /** + * Arms a keep-alive interval for an SSE stream that periodically writes an SSE + * comment frame so intermediaries and idle timeouts don't kill the connection. + * The returned timer is owned by the stream it was armed for: the stream's + * cancel/cleanup callbacks must clear it. The interval clears itself if a + * write fails (stream already closed/cancelled). + */ + startKeepAlive(controller, encoder) { + // After close() nothing may arm: the stream cleanups have already run. + if (this._closed) + return undefined; + const timer = armSseKeepAlive(this._keepAliveMs, () => { + try { + controller.enqueue(encoder.encode(': keepalive\n\n')); + } + catch { + if (timer !== undefined) + clearInterval(timer); + } + }); + return timer; + } + /** + * Starts the transport. This is required by the Transport interface but is a no-op + * for the Streamable HTTP transport as connections are managed per-request. + */ + async start() { + if (this._started) { + throw new Error('Transport already started'); + } + this._started = true; + } + /** + * Helper to create a JSON error response + */ + createJsonErrorResponse(status, code, message, options) { + const error = { code, message }; + if (options?.data !== undefined) { + error.data = options.data; + } + return new Response(JSON.stringify({ + jsonrpc: '2.0', + error, + id: null + }), { + status, + headers: { + 'Content-Type': 'application/json', + ...options?.headers + } + }); + } + /** + * Validates request headers for DNS rebinding protection. + * @returns Error response if validation fails, undefined if validation passes. + */ + validateRequestHeaders(req) { + // Skip validation if protection is not enabled + if (!this._enableDnsRebindingProtection) { + return undefined; + } + // Validate Host header if allowedHosts is configured + if (this._allowedHosts && this._allowedHosts.length > 0) { + const hostHeader = req.headers.get('host'); + if (!hostHeader || !this._allowedHosts.includes(hostHeader)) { + const error = `Invalid Host header: ${hostHeader}`; + this.onerror?.(new Error(error)); + return this.createJsonErrorResponse(403, -32000, error); + } + } + // Validate Origin header if allowedOrigins is configured + if (this._allowedOrigins && this._allowedOrigins.length > 0) { + const originHeader = req.headers.get('origin'); + if (originHeader && !this._allowedOrigins.includes(originHeader)) { + const error = `Invalid Origin header: ${originHeader}`; + this.onerror?.(new Error(error)); + return this.createJsonErrorResponse(403, -32000, error); + } + } + return undefined; + } + /** + * Handles an incoming HTTP request, whether GET, POST, or DELETE + * Returns a Response object (Web Standard) + */ + async handleRequest(req, options) { + if (this._closed) { + return this.createJsonErrorResponse(404, -32001, 'Session not found'); + } + // In stateless mode (no sessionIdGenerator), each request must use a fresh transport. + // Reusing a stateless transport causes message ID collisions between clients. + if (!this.sessionIdGenerator && this._hasHandledRequest) { + throw new Error('Stateless transport cannot be reused across requests. Create a new transport per request.'); + } + this._hasHandledRequest = true; + // Validate request headers for DNS rebinding protection + const validationError = this.validateRequestHeaders(req); + if (validationError) { + return validationError; + } + switch (req.method) { + case 'POST': + return this.handlePostRequest(req, options); + case 'GET': + return this.handleGetRequest(req); + case 'DELETE': + return this.handleDeleteRequest(req); + default: + return this.handleUnsupportedRequest(); + } + } + /** + * Writes a priming event to establish resumption capability. + * Only sends if eventStore is configured (opt-in for resumability) and + * the client's protocol version supports empty SSE data (>= 2025-11-25). + */ + async writePrimingEvent(controller, encoder, streamId, protocolVersion) { + if (!this._eventStore) { + return; + } + // Priming events have empty data which older clients cannot handle. + // Only send priming events to clients with protocol version >= 2025-11-25 + // which includes the fix for handling empty SSE data. + if (protocolVersion < '2025-11-25') { + return; + } + const primingEventId = await this._eventStore.storeEvent(streamId, {}); + let primingEvent = `id: ${primingEventId}\ndata: \n\n`; + if (this._retryInterval !== undefined) { + primingEvent = `id: ${primingEventId}\nretry: ${this._retryInterval}\ndata: \n\n`; + } + controller.enqueue(encoder.encode(primingEvent)); + this._resumableStreams.add(streamId); + } + /** + * Handles GET requests for SSE stream + */ + async handleGetRequest(req) { + // The client MUST include an Accept header, listing text/event-stream as a supported content type. + const acceptHeader = req.headers.get('accept'); + if (!acceptHeader?.includes('text/event-stream')) { + this.onerror?.(new Error('Not Acceptable: Client must accept text/event-stream')); + return this.createJsonErrorResponse(406, -32000, 'Not Acceptable: Client must accept text/event-stream'); + } + // If an Mcp-Session-Id is returned by the server during initialization, + // clients using the Streamable HTTP transport MUST include it + // in the Mcp-Session-Id header on all of their subsequent HTTP requests. + const sessionError = this.validateSession(req); + if (sessionError) { + return sessionError; + } + const protocolError = this.validateProtocolVersion(req); + if (protocolError) { + return protocolError; + } + // Handle resumability: check for Last-Event-ID header + if (this._eventStore) { + const lastEventId = req.headers.get('last-event-id'); + if (lastEventId) { + return this.replayEvents(lastEventId); + } + } + // Check if there's already an active standalone SSE stream for this session + if (this._streamMapping.get(this._standaloneSseStreamId) !== undefined) { + // Only one GET SSE stream is allowed per session + this.onerror?.(new Error('Conflict: Only one SSE stream is allowed per session')); + return this.createJsonErrorResponse(409, -32000, 'Conflict: Only one SSE stream is allowed per session'); + } + const encoder = new TextEncoder(); + let streamController; + let keepAliveTimer = undefined; + // Create a ReadableStream with a controller we can use to push SSE events + const readable = new ReadableStream({ + start: controller => { + streamController = controller; + }, + cancel: () => { + // Stream was cancelled by client. Only tear down the mapping if it + // still points at this stream — a stale cancel arriving after a + // reconnect re-registered the id must not tear down the successor. + if (keepAliveTimer !== undefined) { + clearInterval(keepAliveTimer); + } + if (this._streamMapping.get(this._standaloneSseStreamId)?.controller === streamController) { + this._streamMapping.delete(this._standaloneSseStreamId); + } + } + }); + const headers = { + 'Content-Type': 'text/event-stream', + 'Cache-Control': 'no-cache, no-transform', + Connection: 'keep-alive', + 'X-Accel-Buffering': 'no' + }; + // After initialization, always include the session ID if we have one + if (this.sessionId !== undefined) { + headers['mcp-session-id'] = this.sessionId; + } + // Store the stream mapping with the controller for pushing data + this._streamMapping.set(this._standaloneSseStreamId, { + controller: streamController, + encoder, + cleanup: () => { + if (keepAliveTimer !== undefined) { + clearInterval(keepAliveTimer); + } + this._streamMapping.delete(this._standaloneSseStreamId); + try { + streamController.close(); + } + catch { + // Controller might already be closed + } + } + }); + keepAliveTimer = this.startKeepAlive(streamController, encoder); + return new Response(readable, { headers }); + } + /** + * Replays events that would have been sent after the specified event ID + * Only used when resumability is enabled + */ + async replayEvents(lastEventId) { + if (!this._eventStore) { + this.onerror?.(new Error('Event store not configured')); + return this.createJsonErrorResponse(400, -32000, 'Event store not configured'); + } + try { + // If getStreamIdForEventId is available, use it for conflict checking + let streamId; + if (this._eventStore.getStreamIdForEventId) { + streamId = await this._eventStore.getStreamIdForEventId(lastEventId); + if (!streamId) { + this.onerror?.(new Error('Invalid event ID format')); + return this.createJsonErrorResponse(400, -32000, 'Invalid event ID format'); + } + // Check conflict with the SAME streamId we'll use for mapping + if (this._streamMapping.get(streamId) !== undefined) { + this.onerror?.(new Error('Conflict: Stream already has an active connection')); + return this.createJsonErrorResponse(409, -32000, 'Conflict: Stream already has an active connection'); + } + } + const headers = { + 'Content-Type': 'text/event-stream', + 'Cache-Control': 'no-cache, no-transform', + Connection: 'keep-alive', + 'X-Accel-Buffering': 'no' + }; + if (this.sessionId !== undefined) { + headers['mcp-session-id'] = this.sessionId; + } + // Create a ReadableStream with controller for SSE + const encoder = new TextEncoder(); + let streamController; + let keepAliveTimer = undefined; + let replayedStreamId = undefined; + let cancelled = false; + const readable = new ReadableStream({ + start: controller => { + streamController = controller; + }, + cancel: () => { + // Stream was cancelled by client. Only tear down the mapping if + // it still points at this stream — a stale cancel must not tear + // down a successor registered by a later resume. + cancelled = true; + if (keepAliveTimer !== undefined) { + clearInterval(keepAliveTimer); + } + if (replayedStreamId !== undefined && this._streamMapping.get(replayedStreamId)?.controller === streamController) { + this._streamMapping.delete(replayedStreamId); + } + } + }); + // Replay events - returns the streamId for backwards compatibility + const replayedEventIds = new Set(); + replayedStreamId = await this._eventStore.replayEventsAfter(lastEventId, { + send: async (eventId, message) => { + const success = this.writeSSEEvent(streamController, encoder, message, eventId); + if (!success) { + this.onerror?.(new Error('Failed replay events')); + try { + streamController.close(); + } + catch { + // Controller might already be closed + } + } + else { + replayedEventIds.add(eventId); + } + } + }); + // close() may have run, or the stream may have been cancelled, while + // the event store was replaying: don't hand out or register a stream + // that nothing can ever clean up again. + if (this._closed || cancelled) { + try { + streamController.close(); + } + catch { + // Controller might already be closed + } + return this.createJsonErrorResponse(404, -32001, 'Session not found'); + } + // A reconnect re-registers the same stream id: close the predecessor + // stream cleanly (clearing its keep-alive timer) instead of leaving it + // registered nowhere with its timer still running. + this._streamMapping.get(replayedStreamId)?.cleanup(); + this._streamMapping.set(replayedStreamId, { + controller: streamController, + encoder, + replayedEventIds, + cleanup: () => { + if (keepAliveTimer !== undefined) { + clearInterval(keepAliveTimer); + } + this._streamMapping.delete(replayedStreamId); + try { + streamController.close(); + } + catch { + // Controller might already be closed + } + } + }); + // The resume itself proves the client holds a Last-Event-ID cursor + this._resumableStreams.add(replayedStreamId); + keepAliveTimer = this.startKeepAlive(streamController, encoder); + return new Response(readable, { headers }); + } + catch (error) { + this.onerror?.(error); + return this.createJsonErrorResponse(500, -32000, 'Error replaying events'); + } + } + /** + * Writes an event to an SSE stream via controller with proper formatting + */ + writeSSEEvent(controller, encoder, message, eventId) { + try { + let eventData = `event: message\n`; + // Include event ID if provided - this is important for resumability + if (eventId) { + eventData += `id: ${eventId}\n`; + } + eventData += `data: ${JSON.stringify(message)}\n\n`; + controller.enqueue(encoder.encode(eventData)); + return true; + } + catch (error) { + this.onerror?.(error); + return false; + } + } + /** + * Handles unsupported requests (PUT, PATCH, etc.) + */ + handleUnsupportedRequest() { + this.onerror?.(new Error('Method not allowed.')); + return new Response(JSON.stringify({ + jsonrpc: '2.0', + error: { + code: -32000, + message: 'Method not allowed.' + }, + id: null + }), { + status: 405, + headers: { + Allow: 'GET, POST, DELETE', + 'Content-Type': 'application/json' + } + }); + } + /** + * Handles POST requests containing JSON-RPC messages + */ + async handlePostRequest(req, options) { + try { + // Validate the Accept header + const acceptHeader = req.headers.get('accept'); + // The client MUST include an Accept header, listing both application/json and text/event-stream as supported content types. + // Accept is a comma-separated list, so a substring check is the intended semantics here (unlike Content-Type below). + // eslint-disable-next-line no-restricted-syntax + if (!acceptHeader?.includes('application/json') || !acceptHeader.includes('text/event-stream')) { + this.onerror?.(new Error('Not Acceptable: Client must accept both application/json and text/event-stream')); + return this.createJsonErrorResponse(406, -32000, 'Not Acceptable: Client must accept both application/json and text/event-stream'); + } + // Parsed media type, never a substring match — see isJsonContentType. + const ct = req.headers.get('content-type'); + if (!isJsonContentType(ct)) { + this.onerror?.(new Error('Unsupported Media Type: Content-Type must be application/json')); + return this.createJsonErrorResponse(415, -32000, 'Unsupported Media Type: Content-Type must be application/json'); + } + // Build request info from headers and URL + const requestInfo = { + headers: Object.fromEntries(req.headers.entries()), + url: new URL(req.url) + }; + let rawMessage; + if (options?.parsedBody !== undefined) { + rawMessage = options.parsedBody; + } + else { + try { + rawMessage = await req.json(); + } + catch { + this.onerror?.(new Error('Parse error: Invalid JSON')); + return this.createJsonErrorResponse(400, -32700, 'Parse error: Invalid JSON'); + } + } + let messages; + // handle batch and single messages + try { + if (Array.isArray(rawMessage)) { + messages = rawMessage.map(msg => JSONRPCMessageSchema.parse(msg)); + } + else { + messages = [JSONRPCMessageSchema.parse(rawMessage)]; + } + } + catch { + this.onerror?.(new Error('Parse error: Invalid JSON-RPC message')); + return this.createJsonErrorResponse(400, -32700, 'Parse error: Invalid JSON-RPC message'); + } + // close() may have run while awaiting the request body above: don't + // initialize a session (or fire onsessioninitialized) on a transport + // whose cleanups have already run. + if (this._closed) { + return this.createJsonErrorResponse(404, -32001, 'Session not found'); + } + // Check if this is an initialization request + // https://spec.modelcontextprotocol.io/specification/2025-03-26/basic/lifecycle/ + const isInitializationRequest = messages.some(isInitializeRequest); + if (isInitializationRequest) { + // If it's a server with session management and the session ID is already set we should reject the request + // to avoid re-initialization. + if (this._initialized && this.sessionId !== undefined) { + this.onerror?.(new Error('Invalid Request: Server already initialized')); + return this.createJsonErrorResponse(400, -32600, 'Invalid Request: Server already initialized'); + } + if (messages.length > 1) { + this.onerror?.(new Error('Invalid Request: Only one initialization request is allowed')); + return this.createJsonErrorResponse(400, -32600, 'Invalid Request: Only one initialization request is allowed'); + } + this.sessionId = this.sessionIdGenerator?.(); + this._initialized = true; + // If we have a session ID and an onsessioninitialized handler, call it immediately + // This is needed in cases where the server needs to keep track of multiple sessions + if (this.sessionId && this._onsessioninitialized) { + await Promise.resolve(this._onsessioninitialized(this.sessionId)); + } + } + if (!isInitializationRequest) { + // If an Mcp-Session-Id is returned by the server during initialization, + // clients using the Streamable HTTP transport MUST include it + // in the Mcp-Session-Id header on all of their subsequent HTTP requests. + const sessionError = this.validateSession(req); + if (sessionError) { + return sessionError; + } + // Mcp-Protocol-Version header is required for all requests after initialization. + const protocolError = this.validateProtocolVersion(req); + if (protocolError) { + return protocolError; + } + } + // close() may have run while awaiting the request body or the session + // initialization callback above: don't register streams into maps the + // close sweep has already cleared, or hand out a stream that nothing + // will ever write to. + if (this._closed) { + return this.createJsonErrorResponse(404, -32001, 'Session not found'); + } + // check if it contains requests + const hasRequests = messages.some(isJSONRPCRequest); + if (!hasRequests) { + // if it only contains notifications or responses, return 202 + for (const message of messages) { + this.onmessage?.(message, { authInfo: options?.authInfo, requestInfo }); + } + return new Response(null, { status: 202 }); + } + // The default behavior is to use SSE streaming + // but in some cases server will return JSON responses + const streamId = crypto.randomUUID(); + // Extract protocol version for priming event decision. + // For initialize requests, get from request params. + // For other requests, get from header (already validated). + const initRequest = messages.find(m => isInitializeRequest(m)); + const clientProtocolVersion = initRequest + ? initRequest.params.protocolVersion + : (req.headers.get('mcp-protocol-version') ?? DEFAULT_NEGOTIATED_PROTOCOL_VERSION); + if (this._enableJsonResponse) { + // For JSON response mode, return a Promise that resolves when all responses are ready + return new Promise(resolve => { + this._streamMapping.set(streamId, { + resolveJson: resolve, + cleanup: () => { + this._streamMapping.delete(streamId); + } + }); + for (const message of messages) { + if (isJSONRPCRequest(message)) { + this._requestToStreamMapping.set(message.id, streamId); + } + } + for (const message of messages) { + this.onmessage?.(message, { authInfo: options?.authInfo, requestInfo }); + } + }); + } + // SSE streaming mode - use ReadableStream with controller for more reliable data pushing + const encoder = new TextEncoder(); + let streamController; + let keepAliveTimer = undefined; + const readable = new ReadableStream({ + start: controller => { + streamController = controller; + }, + cancel: () => { + // Stream was cancelled by client. Only tear down the mapping if + // it still points at this stream — a stale cancel arriving after + // a resume re-registered the id must not tear down the successor. + if (keepAliveTimer !== undefined) { + clearInterval(keepAliveTimer); + } + if (this._streamMapping.get(streamId)?.controller === streamController) { + this._streamMapping.delete(streamId); + } + } + }); + const headers = { + 'Content-Type': 'text/event-stream', + 'Cache-Control': 'no-cache, no-transform', + Connection: 'keep-alive', + 'X-Accel-Buffering': 'no' + }; + // After initialization, always include the session ID if we have one + if (this.sessionId !== undefined) { + headers['mcp-session-id'] = this.sessionId; + } + // Store the response for this request to send messages back through this connection + // We need to track by request ID to maintain the connection + for (const message of messages) { + if (isJSONRPCRequest(message)) { + this._streamMapping.set(streamId, { + controller: streamController, + encoder, + cleanup: () => { + if (keepAliveTimer !== undefined) { + clearInterval(keepAliveTimer); + } + this._streamMapping.delete(streamId); + try { + streamController.close(); + } + catch { + // Controller might already be closed + } + } + }); + this._requestToStreamMapping.set(message.id, streamId); + } + } + try { + // Write priming event if event store is configured (after mapping is set up) + await this.writePrimingEvent(streamController, encoder, streamId, clientProtocolVersion); + // handle each message + for (const message of messages) { + // Build closeSSEStream callback for requests when eventStore is configured + // AND client supports resumability (protocol version >= 2025-11-25). + // Old clients can't resume if the stream is closed early because they + // didn't receive a priming event with an event ID. + let closeSSEStream; + let closeStandaloneSSEStream; + if (isJSONRPCRequest(message) && this._eventStore && clientProtocolVersion >= '2025-11-25') { + closeSSEStream = () => { + this.closeSSEStream(message.id); + }; + closeStandaloneSSEStream = () => { + this.closeStandaloneSSEStream(); + }; + } + this.onmessage?.(message, { authInfo: options?.authInfo, requestInfo, closeSSEStream, closeStandaloneSSEStream }); + } + } + catch (error) { + // Failing before the Response is handed out means nothing can ever + // cancel this stream: release it and its request correlations here. + this._streamMapping.get(streamId)?.cleanup(); + this._resumableStreams.delete(streamId); + for (const message of messages) { + if (isJSONRPCRequest(message)) { + this._requestToStreamMapping.delete(message.id); + } + } + throw error; + } + // The server SHOULD NOT close the SSE stream before sending all JSON-RPC responses + // This will be handled by the send() method when responses are ready + // Arm keep-alive only after the fallible awaits above: an error path + // returns 400 and discards the Response, so nothing could ever cancel + // the stream and clear an already-armed timer. Skip if the responses + // already completed and cleaned the stream up. + if (this._streamMapping.get(streamId)?.controller === streamController) { + keepAliveTimer = this.startKeepAlive(streamController, encoder); + } + return new Response(readable, { status: 200, headers }); + } + catch (error) { + // return JSON-RPC formatted error + this.onerror?.(error); + return this.createJsonErrorResponse(400, -32700, 'Parse error', { data: String(error) }); + } + } + /** + * Handles DELETE requests to terminate sessions + */ + async handleDeleteRequest(req) { + const sessionError = this.validateSession(req); + if (sessionError) { + return sessionError; + } + const protocolError = this.validateProtocolVersion(req); + if (protocolError) { + return protocolError; + } + try { + await Promise.resolve(this._onsessionclosed?.(this.sessionId)); + return new Response(null, { status: 200 }); + } + finally { + await this.close(); + } + } + /** + * Validates session ID for non-initialization requests. + * Returns Response error if invalid, undefined otherwise + */ + validateSession(req) { + if (this.sessionIdGenerator === undefined) { + // If the sessionIdGenerator ID is not set, the session management is disabled + // and we don't need to validate the session ID + return undefined; + } + if (!this._initialized) { + // If the server has not been initialized yet, reject all requests + this.onerror?.(new Error('Bad Request: Server not initialized')); + return this.createJsonErrorResponse(400, -32000, 'Bad Request: Server not initialized'); + } + const sessionId = req.headers.get('mcp-session-id'); + if (!sessionId) { + // Non-initialization requests without a session ID should return 400 Bad Request + this.onerror?.(new Error('Bad Request: Mcp-Session-Id header is required')); + return this.createJsonErrorResponse(400, -32000, 'Bad Request: Mcp-Session-Id header is required'); + } + if (sessionId !== this.sessionId) { + // Reject requests with invalid session ID with 404 Not Found + this.onerror?.(new Error('Session not found')); + return this.createJsonErrorResponse(404, -32001, 'Session not found'); + } + return undefined; + } + /** + * Validates the MCP-Protocol-Version header on incoming requests. + * + * For initialization: Version negotiation handles unknown versions gracefully + * (server responds with its supported version). + * + * For subsequent requests with MCP-Protocol-Version header: + * - Accept if in supported list + * - 400 if unsupported + * + * For HTTP requests without the MCP-Protocol-Version header: + * - Accept and default to the version negotiated at initialization + */ + validateProtocolVersion(req) { + const protocolVersion = req.headers.get('mcp-protocol-version'); + if (protocolVersion !== null && !SUPPORTED_PROTOCOL_VERSIONS.includes(protocolVersion)) { + this.onerror?.(new Error(`Bad Request: Unsupported protocol version: ${protocolVersion}` + + ` (supported versions: ${SUPPORTED_PROTOCOL_VERSIONS.join(', ')})`)); + return this.createJsonErrorResponse(400, -32000, `Bad Request: Unsupported protocol version: ${protocolVersion} (supported versions: ${SUPPORTED_PROTOCOL_VERSIONS.join(', ')})`); + } + return undefined; + } + async close() { + if (this._closed) { + return; + } + // Stop any deferred keep-alive arm (e.g. a replay await resolving after + // close) from creating a timer nothing can clear. + this._closed = true; + // Close all SSE connections (each cleanup clears its own keep-alive timer) + this._streamMapping.forEach(({ cleanup }) => { + cleanup(); + }); + this._streamMapping.clear(); + // Clear any pending responses + this._requestResponseMap.clear(); + this._resumableStreams.clear(); + this.onclose?.(); + } + /** + * Close an SSE stream for a specific request, triggering client reconnection. + * Use this to implement polling behavior during long-running operations - + * client will reconnect after the retry interval specified in the priming event. + */ + closeSSEStream(requestId) { + const streamId = this._requestToStreamMapping.get(requestId); + if (!streamId) + return; + const stream = this._streamMapping.get(streamId); + if (stream) { + stream.cleanup(); + } + } + /** + * Close the standalone GET SSE stream, triggering client reconnection. + * Use this to implement polling behavior for server-initiated notifications. + */ + closeStandaloneSSEStream() { + const stream = this._streamMapping.get(this._standaloneSseStreamId); + if (stream) { + stream.cleanup(); + } + } + async send(message, options) { + let requestId = options?.relatedRequestId; + if (isJSONRPCResultResponse(message) || isJSONRPCErrorResponse(message)) { + // If the message is a response, use the request ID from the message + requestId = message.id; + } + // Check if this message should be sent on the standalone SSE stream (no request ID) + // Ignore notifications from tools (which have relatedRequestId set) + // Those will be sent via dedicated response SSE streams + if (requestId === undefined) { + // For standalone SSE streams, we can only send requests and notifications + if (isJSONRPCResultResponse(message) || isJSONRPCErrorResponse(message)) { + throw new Error('Cannot send a response on a standalone SSE stream unless resuming a previous client request'); + } + // Generate and store event ID if event store is provided + // Store even if stream is disconnected so events can be replayed on reconnect + let eventId; + if (this._eventStore) { + // Stores the event and gets the generated event ID + eventId = await this._eventStore.storeEvent(this._standaloneSseStreamId, message); + } + const standaloneSse = this._streamMapping.get(this._standaloneSseStreamId); + if (standaloneSse === undefined) { + // Stream is disconnected - event is stored for replay, nothing more to do + return; + } + // Send the message to the standalone SSE stream, unless this stream + // was registered by a replay that already delivered this event (the + // store made it visible before this call resumed). + if (standaloneSse.controller && + standaloneSse.encoder && + (eventId === undefined || !standaloneSse.replayedEventIds?.has(eventId))) { + this.writeSSEEvent(standaloneSse.controller, standaloneSse.encoder, message, eventId); + } + return; + } + // Get the response for this request + const streamId = this._requestToStreamMapping.get(requestId); + if (!streamId) { + throw new Error(`No connection established for request ID: ${String(requestId)}`); + } + let stream = this._streamMapping.get(streamId); + if (!this._enableJsonResponse) { + // Store the event even if the stream is disconnected (e.g. after + // closeSSEStream switched the client to polling), so it can be + // replayed on reconnect — mirroring the standalone stream path. + let eventId; + if (this._eventStore) { + eventId = await this._eventStore.storeEvent(streamId, message); + // Re-fetch after the await: a resume completing meanwhile replaces + // this stream's registration with a successor, and the message + // must go to the live stream, not the evicted one. + stream = this._streamMapping.get(streamId); + } + // Skip the write if the stream was registered by a replay that + // already delivered this event (the store made it visible before + // this call resumed). + if (stream?.controller && stream?.encoder && (eventId === undefined || !stream.replayedEventIds?.has(eventId))) { + const written = this.writeSSEEvent(stream.controller, stream.encoder, message, eventId); + // The client now holds a Last-Event-ID cursor for this stream + if (written && eventId !== undefined) { + this._resumableStreams.add(streamId); + } + } + } + if (isJSONRPCResultResponse(message) || isJSONRPCErrorResponse(message)) { + this._requestResponseMap.set(requestId, message); + const relatedIds = Array.from(this._requestToStreamMapping.entries()) + .filter(([_, sid]) => sid === streamId) + .map(([id]) => id); + // Check if we have responses for all requests using this connection + const allResponsesReady = relatedIds.every(id => this._requestResponseMap.has(id)); + if (allResponsesReady) { + if (!stream) { + // close() ran while the event store write above was awaiting: + // release the entries this call re-created after the sweep, + // then treat the late completion as a no-op. + if (this._closed) { + for (const id of relatedIds) { + this._requestResponseMap.delete(id); + this._requestToStreamMapping.delete(id); + } + return; + } + if (!this._enableJsonResponse && this._eventStore && this._resumableStreams.has(streamId)) { + // The stream went away (client disconnect, or + // closeSSEStream switched the client to polling), but the + // response was stored above and will be replayed on + // resume — release the correlations rather than throwing. + for (const id of relatedIds) { + this._requestResponseMap.delete(id); + this._requestToStreamMapping.delete(id); + } + this._resumableStreams.delete(streamId); + return; + } + // Without resumability (or in JSON response mode, where the + // pending HTTP response can never be settled by a replay), + // a missing stream means the response cannot be delivered. + // Release the correlations so the entries don't outlive the + // undeliverable response. + for (const id of relatedIds) { + this._requestResponseMap.delete(id); + this._requestToStreamMapping.delete(id); + } + throw new Error(`No connection established for request ID: ${String(requestId)}`); + } + if (this._enableJsonResponse && stream.resolveJson) { + // All responses ready, send as JSON + const headers = { + 'Content-Type': 'application/json' + }; + if (this.sessionId !== undefined) { + headers['mcp-session-id'] = this.sessionId; + } + const responses = relatedIds.map(id => this._requestResponseMap.get(id)); + if (responses.length === 1) { + stream.resolveJson(new Response(JSON.stringify(responses[0]), { status: 200, headers })); + } + else { + stream.resolveJson(new Response(JSON.stringify(responses), { status: 200, headers })); + } + } + else { + // End the SSE stream + stream.cleanup(); + } + // Clean up + for (const id of relatedIds) { + this._requestResponseMap.delete(id); + this._requestToStreamMapping.delete(id); + } + this._resumableStreams.delete(streamId); + } + } + } +} +//# sourceMappingURL=webStandardStreamableHttp.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js.map new file mode 100644 index 0000000000000000000000000000000000000000..212618f05df9b91f4547fb554f01b78081333a21 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/webStandardStreamableHttp.js.map @@ -0,0 +1 @@ +{"version":3,"file":"webStandardStreamableHttp.js","sourceRoot":"","sources":["../../../src/server/webStandardStreamableHttp.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG3D,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC/E,OAAO,EAGH,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAChB,uBAAuB,EAEvB,oBAAoB,EAEpB,2BAA2B,EAC3B,mCAAmC,EACtC,MAAM,aAAa,CAAC;AA0JrB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,MAAM,OAAO,wCAAwC;IAgCjD,YAAY,UAA2D,EAAE;QA7BjE,aAAQ,GAAY,KAAK,CAAC;QAC1B,uBAAkB,GAAY,KAAK,CAAC;QACpC,mBAAc,GAA+B,IAAI,GAAG,EAAE,CAAC;QACvD,4BAAuB,GAA2B,IAAI,GAAG,EAAE,CAAC;QACpE;;;;WAIG;QACK,sBAAiB,GAAgB,IAAI,GAAG,EAAE,CAAC;QAC3C,wBAAmB,GAAmC,IAAI,GAAG,EAAE,CAAC;QAChE,iBAAY,GAAY,KAAK,CAAC;QAC9B,wBAAmB,GAAY,KAAK,CAAC;QACrC,2BAAsB,GAAW,aAAa,CAAC;QAS/C,YAAO,GAAG,KAAK,CAAC;QAQpB,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAC;QACrD,IAAI,CAAC,mBAAmB,GAAG,OAAO,CAAC,kBAAkB,IAAI,KAAK,CAAC;QAC/D,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,U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C,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;oBAC1F,CAAC;gBACL,CAAC;qBAAM,CAAC;oBACJ,qBAAqB;oBACrB,MAAM,CAAC,OAAO,EAAE,CAAC;gBACrB,CAAC;gBACD,WAAW;gBACX,KAAK,MAAM,EAAE,IAAI,UAAU,EAAE,CAAC;oBAC1B,IAAI,CAAC,mBAAmB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;oBACpC,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;gBAC5C,CAAC;gBACD,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC5C,CAAC;QACL,CAAC;IACL,CAAC;CACJ"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c3a5b60ee4d0e077bbb52cb6c655e3e709a30e93 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.d.ts @@ -0,0 +1,84 @@ +import type * as z3 from 'zod/v3'; +import type * as z4 from 'zod/v4/core'; +export type AnySchema = z3.ZodTypeAny | z4.$ZodType; +export type AnyObjectSchema = z3.AnyZodObject | z4.$ZodObject | AnySchema; +export type ZodRawShapeCompat = Record; +export interface ZodV3Internal { + _def?: { + typeName?: string; + value?: unknown; + values?: unknown[]; + shape?: Record | (() => Record); + description?: string; + }; + shape?: Record | (() => Record); + value?: unknown; +} +export interface ZodV4Internal { + _zod?: { + def?: { + type?: string; + value?: unknown; + values?: unknown[]; + shape?: Record | (() => Record); + }; + }; + value?: unknown; +} +export type SchemaOutput = S extends z3.ZodTypeAny ? z3.infer : S extends z4.$ZodType ? z4.output : never; +export type SchemaInput = S extends z3.ZodTypeAny ? z3.input : S extends z4.$ZodType ? z4.input : never; +/** + * Infers the output type from a ZodRawShapeCompat (raw shape object). + * Maps over each key in the shape and infers the output type from each schema. + */ +export type ShapeOutput = { + [K in keyof Shape]: SchemaOutput; +}; +export declare function isZ4Schema(s: AnySchema): s is z4.$ZodType; +export declare function objectFromShape(shape: ZodRawShapeCompat): AnyObjectSchema; +export declare function safeParse(schema: S, data: unknown): { + success: true; + data: SchemaOutput; +} | { + success: false; + error: unknown; +}; +export declare function safeParseAsync(schema: S, data: unknown): Promise<{ + success: true; + data: SchemaOutput; +} | { + success: false; + error: unknown; +}>; +export declare function getObjectShape(schema: AnyObjectSchema | undefined): Record | undefined; +/** + * Normalizes a schema to an object schema. Handles both: + * - Already-constructed object schemas (v3 or v4) + * - Raw shapes that need to be wrapped into object schemas + */ +export declare function normalizeObjectSchema(schema: AnySchema | ZodRawShapeCompat | undefined): AnyObjectSchema | undefined; +/** + * Safely extracts an error message from a parse result error. + * Zod errors can have different structures, so we handle various cases. + */ +export declare function getParseErrorMessage(error: unknown): string; +/** + * Gets the description from a schema, if available. + * Works with both Zod v3 and v4. + * + * Both versions expose a `.description` getter that returns the description + * from their respective internal storage (v3: _def, v4: globalRegistry). + */ +export declare function getSchemaDescription(schema: AnySchema): string | undefined; +/** + * Checks if a schema is optional. + * Works with both Zod v3 and v4. + */ +export declare function isSchemaOptional(schema: AnySchema): boolean; +/** + * Gets the literal value from a schema, if it's a literal schema. + * Works with both Zod v3 and v4. + * Returns undefined if the schema is not a literal or the value cannot be determined. + */ +export declare function getLiteralValue(schema: AnySchema): unknown; +//# sourceMappingURL=zod-compat.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..34fb518657a329828253ffdf71a8d3c402e35e53 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprot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OAAO,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,CAAC,CASxF;AAGD,wBAAgB,cAAc,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,SAAS,CAyBzG;AAGD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,GAAG,iBAAiB,GAAG,SAAS,GAAG,eAAe,GAAG,SAAS,CAiDpH;AAkBD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAyB3D;AAGD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAE1E;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAW3D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAwB1D"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js new file mode 100644 index 0000000000000000000000000000000000000000..8a50d9fe9b496bf872e44d27c7691c5d49ddf03d --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js @@ -0,0 +1,228 @@ +// zod-compat.ts +// ---------------------------------------------------- +// Unified types + helpers to accept Zod v3 and v4 (Mini) +// ---------------------------------------------------- +import * as z3rt from 'zod/v3'; +import * as z4mini from 'zod/v4-mini'; +// --- Runtime detection --- +export function isZ4Schema(s) { + // Present on Zod 4 (Classic & Mini) schemas; absent on Zod 3 + const schema = s; + return !!schema._zod; +} +// --- Schema construction --- +export function objectFromShape(shape) { + const values = Object.values(shape); + if (values.length === 0) + return z4mini.object({}); // default to v4 Mini + const allV4 = values.every(isZ4Schema); + const allV3 = values.every(s => !isZ4Schema(s)); + if (allV4) + return z4mini.object(shape); + if (allV3) + return z3rt.object(shape); + throw new Error('Mixed Zod versions detected in object shape.'); +} +// --- Unified parsing --- +export function safeParse(schema, data) { + if (isZ4Schema(schema)) { + // Mini exposes top-level safeParse + const result = z4mini.safeParse(schema, data); + return result; + } + const v3Schema = schema; + const result = v3Schema.safeParse(data); + return result; +} +export async function safeParseAsync(schema, data) { + if (isZ4Schema(schema)) { + // Mini exposes top-level safeParseAsync + const result = await z4mini.safeParseAsync(schema, data); + return result; + } + const v3Schema = schema; + const result = await v3Schema.safeParseAsync(data); + return result; +} +// --- Shape extraction --- +export function getObjectShape(schema) { + if (!schema) + return undefined; + // Zod v3 exposes `.shape`; Zod v4 keeps the shape on `_zod.def.shape` + let rawShape; + if (isZ4Schema(schema)) { + const v4Schema = schema; + rawShape = v4Schema._zod?.def?.shape; + } + else { + const v3Schema = schema; + rawShape = v3Schema.shape; + } + if (!rawShape) + return undefined; + if (typeof rawShape === 'function') { + try { + return rawShape(); + } + catch { + return undefined; + } + } + return rawShape; +} +// --- Schema normalization --- +/** + * Normalizes a schema to an object schema. Handles both: + * - Already-constructed object schemas (v3 or v4) + * - Raw shapes that need to be wrapped into object schemas + */ +export function normalizeObjectSchema(schema) { + if (!schema) + return undefined; + // First check if it's a raw shape (Record) + // Raw shapes don't have _def or _zod properties and aren't schemas themselves + if (typeof schema === 'object') { + // Check if it's actually a ZodRawShapeCompat (not a schema instance) + // by checking if it lacks schema-like internal properties + const asV3 = schema; + const asV4 = schema; + // If it's not a schema instance (no _def or _zod), it might be a raw shape + if (!asV3._def && !asV4._zod) { + // Check if all values are schemas (heuristic to confirm it's a raw shape) + const values = Object.values(schema); + if (values.length > 0 && + values.every(v => typeof v === 'object' && + v !== null && + (v._def !== undefined || + v._zod !== undefined || + typeof v.parse === 'function'))) { + return objectFromShape(schema); + } + } + } + // If we get here, it should be an AnySchema (not a raw shape) + // Check if it's already an object schema + if (isZ4Schema(schema)) { + // Check if it's a v4 object + const v4Schema = schema; + const def = v4Schema._zod?.def; + if (def && (def.type === 'object' || def.shape !== undefined)) { + return schema; + } + } + else { + // Check if it's a v3 object + const v3Schema = schema; + if (v3Schema.shape !== undefined) { + return schema; + } + } + return undefined; +} +function getDotPath(path) { + if (path.length === 0) { + return 'object root'; + } + return path.reduce((acc, seg, index) => { + if (index === 0) { + return String(seg); + } + if (typeof seg === 'number') { + return `${acc}[${seg}]`; + } + return `${acc}.${seg}`; + }, ''); +} +// --- Error message extraction --- +/** + * Safely extracts an error message from a parse result error. + * Zod errors can have different structures, so we handle various cases. + */ +export function getParseErrorMessage(error) { + if (error && typeof error === 'object') { + // When present, prioritize zod issues and format as a message and path + if ('issues' in error && Array.isArray(error.issues) && error.issues.length > 0) { + return error.issues + .map((i) => { + if (!i.path?.length) { + return i.message; + } + return `${i.message} at ${getDotPath(i.path)}`; + }) + .join('\n'); + } + // Try common error structures + if ('message' in error && typeof error.message === 'string') { + return error.message; + } + // Fallback: try to stringify the error + try { + return JSON.stringify(error); + } + catch { + return String(error); + } + } + return String(error); +} +// --- Schema metadata access --- +/** + * Gets the description from a schema, if available. + * Works with both Zod v3 and v4. + * + * Both versions expose a `.description` getter that returns the description + * from their respective internal storage (v3: _def, v4: globalRegistry). + */ +export function getSchemaDescription(schema) { + return schema.description; +} +/** + * Checks if a schema is optional. + * Works with both Zod v3 and v4. + */ +export function isSchemaOptional(schema) { + if (isZ4Schema(schema)) { + const v4Schema = schema; + return v4Schema._zod?.def?.type === 'optional'; + } + const v3Schema = schema; + // v3 has isOptional() method + if (typeof schema.isOptional === 'function') { + return schema.isOptional(); + } + return v3Schema._def?.typeName === 'ZodOptional'; +} +/** + * Gets the literal value from a schema, if it's a literal schema. + * Works with both Zod v3 and v4. + * Returns undefined if the schema is not a literal or the value cannot be determined. + */ +export function getLiteralValue(schema) { + if (isZ4Schema(schema)) { + const v4Schema = schema; + const def = v4Schema._zod?.def; + if (def) { + // Try various ways to get the literal value + if (def.value !== undefined) + return def.value; + if (Array.isArray(def.values) && def.values.length > 0) { + return def.values[0]; + } + } + } + const v3Schema = schema; + const def = v3Schema._def; + if (def) { + if (def.value !== undefined) + return def.value; + if (Array.isArray(def.values) && def.values.length > 0) { + return def.values[0]; + } + } + // Fallback: check for direct value property (some Zod versions) + const directValue = schema.value; + if (directValue !== undefined) + return directValue; + return undefined; +} +//# sourceMappingURL=zod-compat.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js.map new file mode 100644 index 0000000000000000000000000000000000000000..5d807d4471bd83293f28e2922329c88429de7f7f --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js.map @@ -0,0 +1 @@ +{"version":3,"file":"zod-compat.js","sourceRoot":"","sources":["../../../src/server/zod-compat.ts"],"names":[],"mappings":"AAAA,gBAAgB;AAChB,uDAAuD;AACvD,yDAAyD;AACzD,uDAAuD;AAKvD,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC;AAC/B,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AA8CtC,4BAA4B;AAC5B,MAAM,UAAU,UAAU,CAAC,CAAY;IACnC,6DAA6D;IAC7D,MAAM,MAAM,GAAG,CAA6B,CAAC;IAC7C,OAAO,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;AACzB,CAAC;AAED,8BAA8B;AAC9B,MAAM,UAAU,eAAe,CAAC,KAAwB;IACpD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,qB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,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACrD,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QACzB,CAAC;IACL,CAAC;IACD,gEAAgE;IAChE,MAAM,WAAW,GAAI,MAA8B,CAAC,KAAK,CAAC;IAC1D,IAAI,WAAW,KAAK,SAAS;QAAE,OAAO,WAAW,CAAC;IAClD,OAAO,SAAS,CAAC;AACrB,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3a04452b476412d65622cbcd9e91a7f252473740 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.d.ts @@ -0,0 +1,12 @@ +import { AnySchema, AnyObjectSchema } from './zod-compat.js'; +type JsonSchema = Record; +type CommonOpts = { + strictUnions?: boolean; + pipeStrategy?: 'input' | 'output'; + target?: 'jsonSchema7' | 'draft-7' | 'jsonSchema2019-09' | 'draft-2020-12'; +}; +export declare function toJsonSchemaCompat(schema: AnyObjectSchema, opts?: CommonOpts): JsonSchema; +export declare function getMethodLiteral(schema: AnyObjectSchema): string; +export declare function parseWithCompat(schema: AnySchema, data: unknown): unknown; +export {}; +//# sourceMappingURL=zod-json-schema-compat.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..0b851bf50ec9eac2d7d6f391657bd6f4c88bac70 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"zod-json-schema-compat.d.ts","sourceRoot":"","sources":["../../../src/server/zod-json-schema-compat.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,SAAS,EAAE,eAAe,EAA0D,MAAM,iBAAiB,CAAC;AAGrH,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAG1C,KAAK,UAAU,GAAG;IACd,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,YAAY,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAClC,MAAM,CAAC,EAAE,aAAa,GAAG,SAAS,GAAG,mBAAmB,GAAG,eAAe,CAAC;CAC9E,CAAC;AASF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,eAAe,EAAE,IAAI,CAAC,EAAE,UAAU,GAAG,UAAU,CAczF;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAahE;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAMzE"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js new file mode 100644 index 0000000000000000000000000000000000000000..62f7fd0ef1a323d674f003a305bfa359e6e744e5 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js @@ -0,0 +1,51 @@ +// zod-json-schema-compat.ts +// ---------------------------------------------------- +// JSON Schema conversion for both Zod v3 and Zod v4 (Mini) +// v3 uses your vendored converter; v4 uses Mini's toJSONSchema +// ---------------------------------------------------- +import * as z4mini from 'zod/v4-mini'; +import { getObjectShape, safeParse, isZ4Schema, getLiteralValue } from './zod-compat.js'; +import { zodToJsonSchema } from 'zod-to-json-schema'; +function mapMiniTarget(t) { + if (!t) + return 'draft-7'; + if (t === 'jsonSchema7' || t === 'draft-7') + return 'draft-7'; + if (t === 'jsonSchema2019-09' || t === 'draft-2020-12') + return 'draft-2020-12'; + return 'draft-7'; // fallback +} +export function toJsonSchemaCompat(schema, opts) { + if (isZ4Schema(schema)) { + // v4 branch — use Mini's built-in toJSONSchema + return z4mini.toJSONSchema(schema, { + target: mapMiniTarget(opts?.target), + io: opts?.pipeStrategy ?? 'input' + }); + } + // v3 branch — use vendored converter + return zodToJsonSchema(schema, { + strictUnions: opts?.strictUnions ?? true, + pipeStrategy: opts?.pipeStrategy ?? 'input' + }); +} +export function getMethodLiteral(schema) { + const shape = getObjectShape(schema); + const methodSchema = shape?.method; + if (!methodSchema) { + throw new Error('Schema is missing a method literal'); + } + const value = getLiteralValue(methodSchema); + if (typeof value !== 'string') { + throw new Error('Schema method literal must be a string'); + } + return value; +} +export function parseWithCompat(schema, data) { + const result = safeParse(schema, data); + if (!result.success) { + throw result.error; + } + return result.data; +} +//# sourceMappingURL=zod-json-schema-compat.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js.map new file mode 100644 index 0000000000000000000000000000000000000000..70169ff252aa135c1073dbfb80fef74a2104e0b1 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js.map @@ -0,0 +1 @@ +{"version":3,"file":"zod-json-schema-compat.js","sourceRoot":"","sources":["../../../src/server/zod-json-schema-compat.ts"],"names":[],"mappings":"AAAA,4BAA4B;AAC5B,uDAAuD;AACvD,2DAA2D;AAC3D,+DAA+D;AAC/D,uDAAuD;AAKvD,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,OAAO,EAA8B,cAAc,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACrH,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;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AAe,CAAC,MAAiB,EAAE,IAAa;IAC5D,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACvC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QAClB,MAAM,MAAM,CAAC,KAAK,CAAC;IACvB,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,CAAC;AACvB,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c966e30e7410c6b4137d05c0672d26b43c5d6133 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.d.ts @@ -0,0 +1,23 @@ +/** + * Utilities for handling OAuth resource URIs. + */ +/** + * Converts a server URL to a resource URL by removing the fragment. + * RFC 8707 section 2 states that resource URIs "MUST NOT include a fragment component". + * Keeps everything else unchanged (scheme, domain, port, path, query). + */ +export declare function resourceUrlFromServerUrl(url: URL | string): URL; +/** + * Checks if a requested resource URL matches a configured resource URL. + * A requested resource matches if it has the same scheme, domain, port, + * and its path starts with the configured resource's path. + * + * @param requestedResource The resource URL being requested + * @param configuredResource The resource URL that has been configured + * @returns true if the requested resource matches the configured resource, false otherwise + */ +export declare function checkResourceAllowed({ requestedResource, configuredResource }: { + requestedResource: URL | string; + configuredResource: URL | string; +}): boolean; +//# sourceMappingURL=auth-utils.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..30873de552ad2d0a2cd36f6f969eaa1a4343399f --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"auth-utils.d.ts","sourceRoot":"","sources":["../../../src/shared/auth-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,GAAG,GAAG,CAI/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,EACjC,iBAAiB,EACjB,kBAAkB,EACrB,EAAE;IACC,iBAAiB,EAAE,GAAG,GAAG,MAAM,CAAC;IAChC,kBAAkB,EAAE,GAAG,GAAG,MAAM,CAAC;CACpC,GAAG,OAAO,CAwBV"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js new file mode 100644 index 0000000000000000000000000000000000000000..1883885e406491c6142127fd8d7a00f2d5d229a3 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js @@ -0,0 +1,44 @@ +/** + * Utilities for handling OAuth resource URIs. + */ +/** + * Converts a server URL to a resource URL by removing the fragment. + * RFC 8707 section 2 states that resource URIs "MUST NOT include a fragment component". + * Keeps everything else unchanged (scheme, domain, port, path, query). + */ +export function resourceUrlFromServerUrl(url) { + const resourceURL = typeof url === 'string' ? new URL(url) : new URL(url.href); + resourceURL.hash = ''; // Remove fragment + return resourceURL; +} +/** + * Checks if a requested resource URL matches a configured resource URL. + * A requested resource matches if it has the same scheme, domain, port, + * and its path starts with the configured resource's path. + * + * @param requestedResource The resource URL being requested + * @param configuredResource The resource URL that has been configured + * @returns true if the requested resource matches the configured resource, false otherwise + */ +export function checkResourceAllowed({ requestedResource, configuredResource }) { + const requested = typeof requestedResource === 'string' ? new URL(requestedResource) : new URL(requestedResource.href); + const configured = typeof configuredResource === 'string' ? new URL(configuredResource) : new URL(configuredResource.href); + // Compare the origin (scheme, domain, and port) + if (requested.origin !== configured.origin) { + return false; + } + // Handle cases like requested=/foo and configured=/foo/ + if (requested.pathname.length < configured.pathname.length) { + return false; + } + // Check if the requested path starts with the configured path + // Ensure both paths end with / for proper comparison + // This ensures that if we have paths like "/api" and "/api/users", + // we properly detect that "/api/users" is a subpath of "/api" + // By adding a trailing slash if missing, we avoid false positives + // where paths like "/api123" would incorrectly match "/api" + const requestedPath = requested.pathname.endsWith('/') ? requested.pathname : requested.pathname + '/'; + const configuredPath = configured.pathname.endsWith('/') ? configured.pathname : configured.pathname + '/'; + return requestedPath.startsWith(configuredPath); +} +//# sourceMappingURL=auth-utils.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js.map new file mode 100644 index 0000000000000000000000000000000000000000..3ced5af4078d507aaf2e1b7b23dfa7585e28d8b1 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth-utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"auth-utils.js","sourceRoot":"","sources":["../../../src/shared/auth-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,GAAiB;IACtD,MAAM,WAAW,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC/E,WAAW,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,kBAAkB;IACzC,OAAO,WAAW,CAAC;AACvB,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,oBAAoB,CAAC,EACjC,iBAAiB,EACjB,kBAAkB,EAIrB;IACG,MAAM,SAAS,GAAG,OAAO,iBAAiB,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;IACvH,MAAM,UAAU,GAAG,OAAO,kBAAkB,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;IAE3H,gDAAgD;IAChD,IAAI,SAAS,CAAC,MAAM,KAAK,UAAU,CAAC,MAAM,EAAE,CAAC;QACzC,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,wDAAwD;IACxD,IAAI,SAAS,CAAC,QAAQ,CAAC,MAAM,GAAG,UAAU,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC;QACzD,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,8DAA8D;IAC9D,qDAAqD;IACrD,mEAAmE;IACnE,8DAA8D;IAC9D,kEAAkE;IAClE,4DAA4D;IAC5D,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,QAAQ,GAAG,GAAG,CAAC;IACvG,MAAM,cAAc,GAAG,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,GAAG,GAAG,CAAC;IAE3G,OAAO,aAAa,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;AACpD,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..4e47be12ba07405288fef24712eb1ccaff9e3050 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.d.ts @@ -0,0 +1,240 @@ +import * as z from 'zod/v4'; +/** + * Reusable URL validation that disallows javascript: scheme + */ +export declare const SafeUrlSchema: z.ZodURL; +/** + * RFC 9728 OAuth Protected Resource Metadata + */ +export declare const OAuthProtectedResourceMetadataSchema: z.ZodObject<{ + resource: z.ZodString; + authorization_servers: z.ZodOptional>; + jwks_uri: z.ZodOptional; + scopes_supported: z.ZodOptional>; + bearer_methods_supported: z.ZodOptional>; + resource_signing_alg_values_supported: z.ZodOptional>; + resource_name: z.ZodOptional; + resource_documentation: z.ZodOptional; + resource_policy_uri: z.ZodOptional; + resource_tos_uri: z.ZodOptional; + tls_client_certificate_bound_access_tokens: z.ZodOptional; + authorization_details_types_supported: z.ZodOptional>; + dpop_signing_alg_values_supported: z.ZodOptional>; + dpop_bound_access_tokens_required: z.ZodOptional; +}, z.core.$loose>; +/** + * RFC 8414 OAuth 2.0 Authorization Server Metadata + */ +export declare const OAuthMetadataSchema: z.ZodObject<{ + issuer: z.ZodString; + authorization_endpoint: z.ZodURL; + token_endpoint: z.ZodURL; + registration_endpoint: z.ZodOptional; + scopes_supported: z.ZodOptional>; + response_types_supported: z.ZodArray; + response_modes_supported: z.ZodOptional>; + grant_types_supported: z.ZodOptional>; + token_endpoint_auth_methods_supported: z.ZodOptional>; + token_endpoint_auth_signing_alg_values_supported: z.ZodOptional>; + service_documentation: z.ZodOptional; + revocation_endpoint: z.ZodOptional; + revocation_endpoint_auth_methods_supported: z.ZodOptional>; + revocation_endpoint_auth_signing_alg_values_supported: z.ZodOptional>; + introspection_endpoint: z.ZodOptional; + introspection_endpoint_auth_methods_supported: z.ZodOptional>; + introspection_endpoint_auth_signing_alg_values_supported: z.ZodOptional>; + code_challenge_methods_supported: z.ZodOptional>; + client_id_metadata_document_supported: z.ZodOptional; +}, z.core.$loose>; +/** + * OpenID Connect Discovery 1.0 Provider Metadata + * see: https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata + */ +export declare const OpenIdProviderMetadataSchema: z.ZodObject<{ + issuer: z.ZodString; + authorization_endpoint: z.ZodURL; + token_endpoint: z.ZodURL; + userinfo_endpoint: z.ZodOptional; + jwks_uri: z.ZodURL; + registration_endpoint: z.ZodOptional; + scopes_supported: z.ZodOptional>; + response_types_supported: z.ZodArray; + response_modes_supported: z.ZodOptional>; + grant_types_supported: z.ZodOptional>; + acr_values_supported: z.ZodOptional>; + subject_types_supported: z.ZodArray; + id_token_signing_alg_values_supported: z.ZodArray; + id_token_encryption_alg_values_supported: z.ZodOptional>; + id_token_encryption_enc_values_supported: z.ZodOptional>; + userinfo_signing_alg_values_supported: z.ZodOptional>; + userinfo_encryption_alg_values_supported: z.ZodOptional>; + userinfo_encryption_enc_values_supported: z.ZodOptional>; + request_object_signing_alg_values_supported: z.ZodOptional>; + request_object_encryption_alg_values_supported: z.ZodOptional>; + request_object_encryption_enc_values_supported: z.ZodOptional>; + token_endpoint_auth_methods_supported: z.ZodOptional>; + token_endpoint_auth_signing_alg_values_supported: z.ZodOptional>; + display_values_supported: z.ZodOptional>; + claim_types_supported: z.ZodOptional>; + claims_supported: z.ZodOptional>; + service_documentation: z.ZodOptional; + claims_locales_supported: z.ZodOptional>; + ui_locales_supported: z.ZodOptional>; + claims_parameter_supported: z.ZodOptional; + request_parameter_supported: z.ZodOptional; + request_uri_parameter_supported: z.ZodOptional; + require_request_uri_registration: z.ZodOptional; + op_policy_uri: z.ZodOptional; + op_tos_uri: z.ZodOptional; + client_id_metadata_document_supported: z.ZodOptional; +}, z.core.$loose>; +/** + * OpenID Connect Discovery metadata that may include OAuth 2.0 fields + * This schema represents the real-world scenario where OIDC providers + * return a mix of OpenID Connect and OAuth 2.0 metadata fields + */ +export declare const OpenIdProviderDiscoveryMetadataSchema: z.ZodObject<{ + code_challenge_methods_supported: z.ZodOptional>; + issuer: z.ZodString; + authorization_endpoint: z.ZodURL; + token_endpoint: z.ZodURL; + userinfo_endpoint: z.ZodOptional; + jwks_uri: z.ZodURL; + registration_endpoint: z.ZodOptional; + scopes_supported: z.ZodOptional>; + response_types_supported: z.ZodArray; + response_modes_supported: z.ZodOptional>; + grant_types_supported: z.ZodOptional>; + acr_values_supported: z.ZodOptional>; + subject_types_supported: z.ZodArray; + id_token_signing_alg_values_supported: z.ZodArray; + id_token_encryption_alg_values_supported: z.ZodOptional>; + id_token_encryption_enc_values_supported: z.ZodOptional>; + userinfo_signing_alg_values_supported: z.ZodOptional>; + userinfo_encryption_alg_values_supported: z.ZodOptional>; + userinfo_encryption_enc_values_supported: z.ZodOptional>; + request_object_signing_alg_values_supported: z.ZodOptional>; + request_object_encryption_alg_values_supported: z.ZodOptional>; + request_object_encryption_enc_values_supported: z.ZodOptional>; + token_endpoint_auth_methods_supported: z.ZodOptional>; + token_endpoint_auth_signing_alg_values_supported: z.ZodOptional>; + display_values_supported: z.ZodOptional>; + claim_types_supported: z.ZodOptional>; + claims_supported: z.ZodOptional>; + service_documentation: z.ZodOptional; + claims_locales_supported: z.ZodOptional>; + ui_locales_supported: z.ZodOptional>; + claims_parameter_supported: z.ZodOptional; + request_parameter_supported: z.ZodOptional; + request_uri_parameter_supported: z.ZodOptional; + require_request_uri_registration: z.ZodOptional; + op_policy_uri: z.ZodOptional; + op_tos_uri: z.ZodOptional; + client_id_metadata_document_supported: z.ZodOptional; +}, z.core.$strip>; +/** + * OAuth 2.1 token response + */ +export declare const OAuthTokensSchema: z.ZodObject<{ + access_token: z.ZodString; + id_token: z.ZodOptional; + token_type: z.ZodString; + expires_in: z.ZodOptional>; + scope: z.ZodOptional; + refresh_token: z.ZodOptional; +}, z.core.$strip>; +/** + * OAuth 2.1 error response + */ +export declare const OAuthErrorResponseSchema: z.ZodObject<{ + error: z.ZodString; + error_description: z.ZodOptional; + error_uri: z.ZodOptional; +}, z.core.$strip>; +/** + * Optional version of SafeUrlSchema that allows empty string for retrocompatibility on tos_uri and logo_uri + */ +export declare const OptionalSafeUrlSchema: z.ZodUnion<[z.ZodOptional, z.ZodPipe, z.ZodTransform>]>; +/** + * RFC 7591 OAuth 2.0 Dynamic Client Registration metadata + */ +export declare const OAuthClientMetadataSchema: z.ZodObject<{ + redirect_uris: z.ZodArray; + token_endpoint_auth_method: z.ZodOptional; + grant_types: z.ZodOptional>; + response_types: z.ZodOptional>; + client_name: z.ZodOptional; + client_uri: z.ZodOptional; + logo_uri: z.ZodUnion<[z.ZodOptional, z.ZodPipe, z.ZodTransform>]>; + scope: z.ZodOptional; + contacts: z.ZodOptional>; + tos_uri: z.ZodUnion<[z.ZodOptional, z.ZodPipe, z.ZodTransform>]>; + policy_uri: z.ZodOptional; + jwks_uri: z.ZodOptional; + jwks: z.ZodOptional; + software_id: z.ZodOptional; + software_version: z.ZodOptional; + software_statement: z.ZodOptional; +}, z.core.$strip>; +/** + * RFC 7591 OAuth 2.0 Dynamic Client Registration client information + */ +export declare const OAuthClientInformationSchema: z.ZodObject<{ + client_id: z.ZodString; + client_secret: z.ZodOptional; + client_id_issued_at: z.ZodOptional; + client_secret_expires_at: z.ZodOptional; +}, z.core.$strip>; +/** + * RFC 7591 OAuth 2.0 Dynamic Client Registration full response (client information plus metadata) + */ +export declare const OAuthClientInformationFullSchema: z.ZodObject<{ + redirect_uris: z.ZodArray; + token_endpoint_auth_method: z.ZodOptional; + grant_types: z.ZodOptional>; + response_types: z.ZodOptional>; + client_name: z.ZodOptional; + client_uri: z.ZodOptional; + logo_uri: z.ZodUnion<[z.ZodOptional, z.ZodPipe, z.ZodTransform>]>; + scope: z.ZodOptional; + contacts: z.ZodOptional>; + tos_uri: z.ZodUnion<[z.ZodOptional, z.ZodPipe, z.ZodTransform>]>; + policy_uri: z.ZodOptional; + jwks_uri: z.ZodOptional; + jwks: z.ZodOptional; + software_id: z.ZodOptional; + software_version: z.ZodOptional; + software_statement: z.ZodOptional; + client_id: z.ZodString; + client_secret: z.ZodOptional; + client_id_issued_at: z.ZodOptional; + client_secret_expires_at: z.ZodOptional; +}, z.core.$strip>; +/** + * RFC 7591 OAuth 2.0 Dynamic Client Registration error response + */ +export declare const OAuthClientRegistrationErrorSchema: z.ZodObject<{ + error: z.ZodString; + error_description: z.ZodOptional; +}, z.core.$strip>; +/** + * RFC 7009 OAuth 2.0 Token Revocation request + */ +export declare const OAuthTokenRevocationRequestSchema: z.ZodObject<{ + token: z.ZodString; + token_type_hint: z.ZodOptional; +}, z.core.$strip>; +export type OAuthMetadata = z.infer; +export type OpenIdProviderMetadata = z.infer; +export type OpenIdProviderDiscoveryMetadata = z.infer; +export type OAuthTokens = z.infer; +export type OAuthErrorResponse = z.infer; +export type OAuthClientMetadata = z.infer; +export type OAuthClientInformation = z.infer; +export type OAuthClientInformationFull = z.infer; +export type OAuthClientInformationMixed = OAuthClientInformation | OAuthClientInformationFull; +export type OAuthClientRegistrationError = z.infer; +export type OAuthTokenRevocationRequest = z.infer; +export type OAuthProtectedResourceMetadata = z.infer; +export type AuthorizationServerMetadata = OAuthMetadata | OpenIdProviderDiscoveryMetadata; +//# sourceMappingURL=auth.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..031a88fb9239cbb3c6b271ddfa20ef2a1eda148d --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/shared/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B;;GAEG;AACH,eAAO,MAAM,aAAa,UAmBrB,CAAC;AAEN;;GAEG;AACH,eAAO,MAAM,oCAAoC;;;;;;;;;;;;;;;iBAe/C,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;iBAoB9B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,4B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C;AAClF,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAC1F,MAAM,MAAM,2BAA2B,GAAG,sBAAsB,GAAG,0BAA0B,CAAC;AAC9F,MAAM,MAAM,4BAA4B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kCAAkC,CAAC,CAAC;AAC9F,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAC;AAC5F,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC;AAGlG,MAAM,MAAM,2BAA2B,GAAG,aAAa,GAAG,+BAA+B,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js new file mode 100644 index 0000000000000000000000000000000000000000..04f38eb882495a5ea053eb5ff4ef1d38d4d37c55 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js @@ -0,0 +1,198 @@ +import * as z from 'zod/v4'; +/** + * Reusable URL validation that disallows javascript: scheme + */ +export const SafeUrlSchema = z + .url() + .superRefine((val, ctx) => { + if (!URL.canParse(val)) { + ctx.addIssue({ + code: z.ZodIssueCode.custom, + message: 'URL must be parseable', + fatal: true + }); + return z.NEVER; + } +}) + .refine(url => { + const u = new URL(url); + return u.protocol !== 'javascript:' && u.protocol !== 'data:' && u.protocol !== 'vbscript:'; +}, { message: 'URL cannot use javascript:, data:, or vbscript: scheme' }); +/** + * RFC 9728 OAuth Protected Resource Metadata + */ +export const OAuthProtectedResourceMetadataSchema = z.looseObject({ + resource: z.string().url(), + authorization_servers: z.array(SafeUrlSchema).optional(), + jwks_uri: z.string().url().optional(), + scopes_supported: z.array(z.string()).optional(), + bearer_methods_supported: z.array(z.string()).optional(), + resource_signing_alg_values_supported: z.array(z.string()).optional(), + resource_name: z.string().optional(), + resource_documentation: z.string().optional(), + resource_policy_uri: z.string().url().optional(), + resource_tos_uri: z.string().url().optional(), + tls_client_certificate_bound_access_tokens: z.boolean().optional(), + authorization_details_types_supported: z.array(z.string()).optional(), + dpop_signing_alg_values_supported: z.array(z.string()).optional(), + dpop_bound_access_tokens_required: z.boolean().optional() +}); +/** + * RFC 8414 OAuth 2.0 Authorization Server Metadata + */ +export const OAuthMetadataSchema = z.looseObject({ + issuer: z.string(), + authorization_endpoint: SafeUrlSchema, + token_endpoint: SafeUrlSchema, + registration_endpoint: SafeUrlSchema.optional(), + scopes_supported: z.array(z.string()).optional(), + response_types_supported: z.array(z.string()), + response_modes_supported: z.array(z.string()).optional(), + grant_types_supported: z.array(z.string()).optional(), + token_endpoint_auth_methods_supported: z.array(z.string()).optional(), + token_endpoint_auth_signing_alg_values_supported: z.array(z.string()).optional(), + service_documentation: SafeUrlSchema.optional(), + revocation_endpoint: SafeUrlSchema.optional(), + revocation_endpoint_auth_methods_supported: z.array(z.string()).optional(), + revocation_endpoint_auth_signing_alg_values_supported: z.array(z.string()).optional(), + introspection_endpoint: z.string().optional(), + introspection_endpoint_auth_methods_supported: z.array(z.string()).optional(), + introspection_endpoint_auth_signing_alg_values_supported: z.array(z.string()).optional(), + code_challenge_methods_supported: z.array(z.string()).optional(), + client_id_metadata_document_supported: z.boolean().optional() +}); +/** + * OpenID Connect Discovery 1.0 Provider Metadata + * see: https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata + */ +export const OpenIdProviderMetadataSchema = z.looseObject({ + issuer: z.string(), + authorization_endpoint: SafeUrlSchema, + token_endpoint: SafeUrlSchema, + userinfo_endpoint: SafeUrlSchema.optional(), + jwks_uri: SafeUrlSchema, + registration_endpoint: SafeUrlSchema.optional(), + scopes_supported: z.array(z.string()).optional(), + response_types_supported: z.array(z.string()), + response_modes_supported: z.array(z.string()).optional(), + grant_types_supported: z.array(z.string()).optional(), + acr_values_supported: z.array(z.string()).optional(), + subject_types_supported: z.array(z.string()), + id_token_signing_alg_values_supported: z.array(z.string()), + id_token_encryption_alg_values_supported: z.array(z.string()).optional(), + id_token_encryption_enc_values_supported: z.array(z.string()).optional(), + userinfo_signing_alg_values_supported: z.array(z.string()).optional(), + userinfo_encryption_alg_values_supported: z.array(z.string()).optional(), + userinfo_encryption_enc_values_supported: z.array(z.string()).optional(), + request_object_signing_alg_values_supported: z.array(z.string()).optional(), + request_object_encryption_alg_values_supported: z.array(z.string()).optional(), + request_object_encryption_enc_values_supported: z.array(z.string()).optional(), + token_endpoint_auth_methods_supported: z.array(z.string()).optional(), + token_endpoint_auth_signing_alg_values_supported: z.array(z.string()).optional(), + display_values_supported: z.array(z.string()).optional(), + claim_types_supported: z.array(z.string()).optional(), + claims_supported: z.array(z.string()).optional(), + service_documentation: z.string().optional(), + claims_locales_supported: z.array(z.string()).optional(), + ui_locales_supported: z.array(z.string()).optional(), + claims_parameter_supported: z.boolean().optional(), + request_parameter_supported: z.boolean().optional(), + request_uri_parameter_supported: z.boolean().optional(), + require_request_uri_registration: z.boolean().optional(), + op_policy_uri: SafeUrlSchema.optional(), + op_tos_uri: SafeUrlSchema.optional(), + client_id_metadata_document_supported: z.boolean().optional() +}); +/** + * OpenID Connect Discovery metadata that may include OAuth 2.0 fields + * This schema represents the real-world scenario where OIDC providers + * return a mix of OpenID Connect and OAuth 2.0 metadata fields + */ +export const OpenIdProviderDiscoveryMetadataSchema = z.object({ + ...OpenIdProviderMetadataSchema.shape, + ...OAuthMetadataSchema.pick({ + code_challenge_methods_supported: true + }).shape +}); +/** + * OAuth 2.1 token response + */ +export const OAuthTokensSchema = z + .object({ + access_token: z.string(), + id_token: z.string().optional(), // Optional for OAuth 2.1, but necessary in OpenID Connect + token_type: z.string(), + expires_in: z.coerce.number().optional(), + scope: z.string().optional(), + refresh_token: z.string().optional() +}) + .strip(); +/** + * OAuth 2.1 error response + */ +export const OAuthErrorResponseSchema = z.object({ + error: z.string(), + error_description: z.string().optional(), + error_uri: z.string().optional() +}); +/** + * Optional version of SafeUrlSchema that allows empty string for retrocompatibility on tos_uri and logo_uri + */ +export const OptionalSafeUrlSchema = SafeUrlSchema.optional().or(z.literal('').transform(() => undefined)); +/** + * RFC 7591 OAuth 2.0 Dynamic Client Registration metadata + */ +export const OAuthClientMetadataSchema = z + .object({ + redirect_uris: z.array(SafeUrlSchema), + token_endpoint_auth_method: z.string().optional(), + grant_types: z.array(z.string()).optional(), + response_types: z.array(z.string()).optional(), + client_name: z.string().optional(), + client_uri: SafeUrlSchema.optional(), + logo_uri: OptionalSafeUrlSchema, + scope: z.string().optional(), + contacts: z.array(z.string()).optional(), + tos_uri: OptionalSafeUrlSchema, + policy_uri: z.string().optional(), + jwks_uri: SafeUrlSchema.optional(), + jwks: z.any().optional(), + software_id: z.string().optional(), + software_version: z.string().optional(), + software_statement: z.string().optional() +}) + .strip(); +/** + * RFC 7591 OAuth 2.0 Dynamic Client Registration client information + */ +export const OAuthClientInformationSchema = z + .object({ + client_id: z.string(), + client_secret: z.string().optional(), + client_id_issued_at: z.number().optional(), + client_secret_expires_at: z.number().optional() +}) + .strip(); +/** + * RFC 7591 OAuth 2.0 Dynamic Client Registration full response (client information plus metadata) + */ +export const OAuthClientInformationFullSchema = OAuthClientMetadataSchema.merge(OAuthClientInformationSchema); +/** + * RFC 7591 OAuth 2.0 Dynamic Client Registration error response + */ +export const OAuthClientRegistrationErrorSchema = z + .object({ + error: z.string(), + error_description: z.string().optional() +}) + .strip(); +/** + * RFC 7009 OAuth 2.0 Token Revocation request + */ +export const OAuthTokenRevocationRequestSchema = z + .object({ + token: z.string(), + token_type_hint: z.string().optional() +}) + .strip(); +//# sourceMappingURL=auth.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js.map new file mode 100644 index 0000000000000000000000000000000000000000..d529c24a6da61066394df13d9ad26c473faf3eaf --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/auth.js.map @@ -0,0 +1 @@ +{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../../src/shared/auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAE5B;;GAEG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC;KACzB,GAAG,EAAE;KACL,WAAW,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE;IACtB,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACrB,GAAG,CAAC,QAAQ,CAAC;YACT,IAAI,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM;YAC3B,OAAO,EAAE,uBAAuB;YAChC,KAAK,EAAE,IAAI;SACd,CAAC,CAAC;QAEH,OAAO,CAAC,CAAC,KAAK,CAAC;IACnB,CAAC;AACL,CAAC,CAAC;KACD,MAAM,CACH,GAAG,CAAC,EAAE;IACF,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;IACvB,OAAO,CAAC,CAAC,QAAQ,KAAK,aAAa,IAAI,CAAC,CAAC,QAAQ,KAAK,OAAO,IAAI,CAAC,CAAC,QAAQ,KAAK,WAAW,CAAC;AAChG,CAAC,EACD,EAAE,OAAO,EAAE,wDAAwD,EAAE,CACxE,CAAC;AAEN;;GAEG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,CAAC,WAAW,CAAC;IAC9D,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IAC1B,qBAAqB,EAAE,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,QAAQ,EAAE;IACxD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACrC,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,CAA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B,GAAG,CAAC;KACxC,MAAM,CAAC;IACJ,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;IACrB,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACpC,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1C,wBAAwB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClD,CAAC;KACD,KAAK,EAAE,CAAC;AAEb;;GAEG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAG,yBAAyB,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;AAE9G;;GAEG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC;KAC9C,MAAM,CAAC;IACJ,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC3C,CAAC;KACD,KAAK,EAAE,CAAC;AAEb;;GAEG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,CAAC;KAC7C,MAAM,CAAC;IACJ,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACzC,CAAC;KACD,KAAK,EAAE,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..19d1b35bfa98175dbf3f64dbfc0045ce72e1daaa --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.d.ts @@ -0,0 +1,32 @@ +/** + * Extracts the media type (the lowercased `type/subtype` pair, without + * parameters) from a raw `Content-Type` header value, or `undefined` when the + * header is missing or empty. + * + * Content-Type comparisons must use the parsed media type, never a substring + * search of the raw header: a value like `text/plain; a=application/json` + * contains the substring `application/json` but its media type is + * `text/plain`, and case variants or parameters make naive string comparison + * wrong in both directions. + * + * "Essence" is the WHATWG MIME Sniffing standard's term for the bare + * `type/subtype` pair (https://mimesniff.spec.whatwg.org/#mime-type-essence); + * the Fetch standard's request classification is defined against it + * (https://fetch.spec.whatwg.org/#cors-safelisted-request-header). + * + * Parsing is RFC 9110 (`content-type` package) first. When the parameter + * section is malformed (`application/json;`, `application/json; charset=`), + * browsers and most HTTP stacks still derive the media type from the segment + * before the first `;` — the fallback matches that widely-implemented + * behavior, so a header whose media type is unambiguous is not rejected for + * a sloppy parameter section. + */ +export declare function mediaTypeEssence(header: string | null | undefined): string | undefined; +/** + * Whether a raw `Content-Type` header value denotes `application/json`. + * Parameters (for example `charset=utf-8`) are allowed and ignored; malformed + * parameter sections do not reject a header whose media type is unambiguously + * `application/json` (see `mediaTypeEssence` for the exact grammar). + */ +export declare function isJsonContentType(header: string | null | undefined): boolean; +//# sourceMappingURL=mediaType.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..45f7446099a6fac00bc1d954736c572b7bd0a1ed --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mediaType.d.ts","sourceRoot":"","sources":["../../../src/shared/mediaType.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAiBtF;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAM5E"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js new file mode 100644 index 0000000000000000000000000000000000000000..833b4c53b691326d81da56d9b48505cc7d6d6ba0 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js @@ -0,0 +1,57 @@ +import contentType from 'content-type'; +/** + * Extracts the media type (the lowercased `type/subtype` pair, without + * parameters) from a raw `Content-Type` header value, or `undefined` when the + * header is missing or empty. + * + * Content-Type comparisons must use the parsed media type, never a substring + * search of the raw header: a value like `text/plain; a=application/json` + * contains the substring `application/json` but its media type is + * `text/plain`, and case variants or parameters make naive string comparison + * wrong in both directions. + * + * "Essence" is the WHATWG MIME Sniffing standard's term for the bare + * `type/subtype` pair (https://mimesniff.spec.whatwg.org/#mime-type-essence); + * the Fetch standard's request classification is defined against it + * (https://fetch.spec.whatwg.org/#cors-safelisted-request-header). + * + * Parsing is RFC 9110 (`content-type` package) first. When the parameter + * section is malformed (`application/json;`, `application/json; charset=`), + * browsers and most HTTP stacks still derive the media type from the segment + * before the first `;` — the fallback matches that widely-implemented + * behavior, so a header whose media type is unambiguous is not rejected for + * a sloppy parameter section. + */ +export function mediaTypeEssence(header) { + if (!header) { + return undefined; + } + try { + return contentType.parse(header).type; + } + catch { + const essence = (header.split(';', 1)[0] ?? '').trim().toLowerCase(); + // A comma in the parameter tail of an unparseable value indicates + // joined duplicate headers — ambiguous, so no essence at all (keeps + // duplicate-header handling uniform whether or not the first copy + // carries parameters). + if (essence === '' || header.slice(essence.length).includes(',')) { + return undefined; + } + return essence; + } +} +/** + * Whether a raw `Content-Type` header value denotes `application/json`. + * Parameters (for example `charset=utf-8`) are allowed and ignored; malformed + * parameter sections do not reject a header whose media type is unambiguously + * `application/json` (see `mediaTypeEssence` for the exact grammar). + */ +export function isJsonContentType(header) { + // Fast path: the exact literal is what SDK clients send on every POST. + if (header === 'application/json') { + return true; + } + return mediaTypeEssence(header) === 'application/json'; +} +//# sourceMappingURL=mediaType.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js.map new file mode 100644 index 0000000000000000000000000000000000000000..68e24ae2f80f6815c262017a427a6a3e16c35017 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/mediaType.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mediaType.js","sourceRoot":"","sources":["../../../src/shared/mediaType.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,cAAc,CAAC;AAEvC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAiC;IAC9D,IAAI,CAAC,MAAM,EAAE,CAAC;QACV,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,IAAI,CAAC;QACD,OAAO,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;IAC1C,CAAC;IAAC,MAAM,CAAC;QACL,MAAM,OAAO,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QACrE,kEAAkE;QAClE,oEAAoE;QACpE,kEAAkE;QAClE,uBAAuB;QACvB,IAAI,OAAO,KAAK,EAAE,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC/D,OAAO,SAAS,CAAC;QACrB,CAAC;QACD,OAAO,OAAO,CAAC;IACnB,CAAC;AACL,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAiC;IAC/D,uEAAuE;IACvE,IAAI,MAAM,KAAK,kBAAkB,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,OAAO,gBAAgB,CAAC,MAAM,CAAC,KAAK,kBAAkB,CAAC;AAC3D,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/metadataUtils.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/metadataUtils.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9dff76daeae774467c413bded03a8c02df84d10b --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/metadataUtils.d.ts @@ -0,0 +1,16 @@ +import { BaseMetadata } from '../types.js'; +/** + * Utilities for working with BaseMetadata objects. + */ +/** + * Gets the display name for an object with BaseMetadata. + * For tools, the precedence is: title → annotations.title → name + * For other objects: title → name + * This implements the spec requirement: "if no title is provided, name should be used for display purposes" + */ +export declare function getDisplayName(metadata: BaseMetadata | (BaseMetadata & { + annotations?: { + title?: string; + }; +})): string; +//# sourceMappingURL=metadataUtils.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/metadataUtils.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/metadataUtils.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..9d9929c540e14f0208309694059bf0bb934cfaa1 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/metadataUtils.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"metadataUtils.d.ts","sourceRoot":"","sources":["../../../src/shared/metadataUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C;;GAEG;AAEH;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,YAAY,GAAG,CAAC,YAAY,GAAG;IAAE,WAAW,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC,GAAG,MAAM,CAarH"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/metadataUtils.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/metadataUtils.js new file mode 100644 index 0000000000000000000000000000000000000000..6d450c0894f8d3c3fbb99027cbfc93d3087dc3d2 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/metadataUtils.js @@ -0,0 +1,22 @@ +/** + * Utilities for working with BaseMetadata objects. + */ +/** + * Gets the display name for an object with BaseMetadata. + * For tools, the precedence is: title → annotations.title → name + * For other objects: title → name + * This implements the spec requirement: "if no title is provided, name should be used for display purposes" + */ +export function getDisplayName(metadata) { + // First check for title (not undefined and not empty string) + if (metadata.title !== undefined && metadata.title !== '') { + return metadata.title; + } + // Then check for annotations.title (only present in Tool objects) + if ('annotations' in metadata && metadata.annotations?.title) { + return metadata.annotations.title; + } + // Finally fall back to name + return metadata.name; +} +//# sourceMappingURL=metadataUtils.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/metadataUtils.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/metadataUtils.js.map new file mode 100644 index 0000000000000000000000000000000000000000..d78868ebb159f8f7a49dad325c2d75d81a904e4d --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/metadataUtils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"metadataUtils.js","sourceRoot":"","sources":["../../../src/shared/metadataUtils.ts"],"names":[],"mappings":"AAEA;;GAEG;AAEH;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,QAA8E;IACzG,6DAA6D;IAC7D,IAAI,QAAQ,CAAC,KAAK,KAAK,SAAS,IAAI,QAAQ,CAAC,KAAK,KAAK,EAAE,EAAE,CAAC;QACxD,OAAO,QAAQ,CAAC,KAAK,CAAC;IAC1B,CAAC;IAED,kEAAkE;IAClE,IAAI,aAAa,IAAI,QAAQ,IAAI,QAAQ,CAAC,WAAW,EAAE,KAAK,EAAE,CAAC;QAC3D,OAAO,QAAQ,CAAC,WAAW,CAAC,KAAK,CAAC;IACtC,CAAC;IAED,4BAA4B;IAC5B,OAAO,QAAQ,CAAC,IAAI,CAAC;AACzB,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..a91048d8b96121c46b29821bd86425ef3c3dfc72 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.d.ts @@ -0,0 +1,443 @@ +import { AnySchema, AnyObjectSchema, SchemaOutput } from '../server/zod-compat.js'; +import { ClientCapabilities, GetTaskRequest, GetTaskPayloadRequest, ListTasksResultSchema, CancelTaskResultSchema, JSONRPCRequest, Progress, RequestId, Result, ServerCapabilities, RequestMeta, RequestInfo, GetTaskResult, TaskCreationParams, RelatedTaskMetadata, Task, Request, Notification } from '../types.js'; +import { Transport, TransportSendOptions } from './transport.js'; +import { AuthInfo } from '../server/auth/types.js'; +import { TaskStore, TaskMessageQueue, CreateTaskOptions } from '../experimental/tasks/interfaces.js'; +import { ResponseMessage } from './responseMessage.js'; +/** + * Callback for progress notifications. + */ +export type ProgressCallback = (progress: Progress) => void; +/** + * Additional initialization options. + */ +export type ProtocolOptions = { + /** + * Whether to restrict emitted requests to only those that the remote side has indicated that they can handle, through their advertised capabilities. + * + * Note that this DOES NOT affect checking of _local_ side capabilities, as it is considered a logic error to mis-specify those. + * + * Currently this defaults to false, for backwards compatibility with SDK versions that did not advertise capabilities correctly. In future, this will default to true. + */ + enforceStrictCapabilities?: boolean; + /** + * An array of notification method names that should be automatically debounced. + * Any notifications with a method in this list will be coalesced if they + * occur in the same tick of the event loop. + * e.g., ['notifications/tools/list_changed'] + */ + debouncedNotificationMethods?: string[]; + /** + * Optional task storage implementation. If provided, enables task-related request handlers + * and provides task storage capabilities to request handlers. + */ + taskStore?: TaskStore; + /** + * Optional task message queue implementation for managing server-initiated messages + * that will be delivered through the tasks/result response stream. + */ + taskMessageQueue?: TaskMessageQueue; + /** + * Default polling interval (in milliseconds) for task status checks when no pollInterval + * is provided by the server. Defaults to 5000ms if not specified. + */ + defaultTaskPollInterval?: number; + /** + * Maximum number of messages that can be queued per task for side-channel delivery. + * If undefined, the queue size is unbounded. + * When the limit is exceeded, the TaskMessageQueue implementation's enqueue() method + * will throw an error. It's the implementation's responsibility to handle overflow + * appropriately (e.g., by failing the task, dropping messages, etc.). + */ + maxTaskQueueSize?: number; +}; +/** + * The default request timeout, in miliseconds. + */ +export declare const DEFAULT_REQUEST_TIMEOUT_MSEC = 60000; +/** + * Options that can be given per request. + */ +export type RequestOptions = { + /** + * If set, requests progress notifications from the remote end (if supported). When progress notifications are received, this callback will be invoked. + * + * For task-augmented requests: progress notifications continue after CreateTaskResult is returned and stop automatically when the task reaches a terminal status. + */ + onprogress?: ProgressCallback; + /** + * Can be used to cancel an in-flight request. This will cause an AbortError to be raised from request(). + */ + signal?: AbortSignal; + /** + * A timeout (in milliseconds) for this request. If exceeded, an McpError with code `RequestTimeout` will be raised from request(). + * + * If not specified, `DEFAULT_REQUEST_TIMEOUT_MSEC` will be used as the timeout. + */ + timeout?: number; + /** + * If true, receiving a progress notification will reset the request timeout. + * This is useful for long-running operations that send periodic progress updates. + * Default: false + */ + resetTimeoutOnProgress?: boolean; + /** + * Maximum total time (in milliseconds) to wait for a response. + * If exceeded, an McpError with code `RequestTimeout` will be raised, regardless of progress notifications. + * If not specified, there is no maximum total timeout. + */ + maxTotalTimeout?: number; + /** + * If provided, augments the request with task creation parameters to enable call-now, fetch-later execution patterns. + */ + task?: TaskCreationParams; + /** + * If provided, associates this request with a related task. + */ + relatedTask?: RelatedTaskMetadata; +} & TransportSendOptions; +/** + * Options that can be given per notification. + */ +export type NotificationOptions = { + /** + * May be used to indicate to the transport which incoming request to associate this outgoing notification with. + */ + relatedRequestId?: RequestId; + /** + * If provided, associates this notification with a related task. + */ + relatedTask?: RelatedTaskMetadata; +}; +/** + * Options that can be given per request. + */ +export type TaskRequestOptions = Omit; +/** + * Request-scoped TaskStore interface. + */ +export interface RequestTaskStore { + /** + * Creates a new task with the given creation parameters. + * The implementation generates a unique taskId and createdAt timestamp. + * + * @param taskParams - The task creation parameters from the request + * @returns The created task object + */ + createTask(taskParams: CreateTaskOptions): Promise; + /** + * Gets the current status of a task. + * + * @param taskId - The task identifier + * @returns The task object + * @throws If the task does not exist + */ + getTask(taskId: string): Promise; + /** + * Stores the result of a task and sets its final status. + * + * @param taskId - The task identifier + * @param status - The final status: 'completed' for success, 'failed' for errors + * @param result - The result to store + */ + storeTaskResult(taskId: string, status: 'completed' | 'failed', result: Result): Promise; + /** + * Retrieves the stored result of a task. + * + * @param taskId - The task identifier + * @returns The stored result + */ + getTaskResult(taskId: string): Promise; + /** + * Updates a task's status (e.g., to 'cancelled', 'failed', 'completed'). + * + * @param taskId - The task identifier + * @param status - The new status + * @param statusMessage - Optional diagnostic message for failed tasks or other status information + */ + updateTaskStatus(taskId: string, status: Task['status'], statusMessage?: string): Promise; + /** + * Lists tasks, optionally starting from a pagination cursor. + * + * @param cursor - Optional cursor for pagination + * @returns An object containing the tasks array and an optional nextCursor + */ + listTasks(cursor?: string): Promise<{ + tasks: Task[]; + nextCursor?: string; + }>; +} +/** + * Extra data given to request handlers. + */ +export type RequestHandlerExtra = { + /** + * An abort signal used to communicate if the request was cancelled from the sender's side. + */ + signal: AbortSignal; + /** + * Information about a validated access token, provided to request handlers. + */ + authInfo?: AuthInfo; + /** + * The session ID from the transport, if available. + */ + sessionId?: string; + /** + * Metadata from the original request. + */ + _meta?: RequestMeta; + /** + * The JSON-RPC ID of the request being handled. + * This can be useful for tracking or logging purposes. + */ + requestId: RequestId; + taskId?: string; + taskStore?: RequestTaskStore; + taskRequestedTtl?: number; + /** + * The original HTTP request. + */ + requestInfo?: RequestInfo; + /** + * Sends a notification that relates to the current request being handled. + * + * This is used by certain transports to correctly associate related messages. + */ + sendNotification: (notification: SendNotificationT) => Promise; + /** + * Sends a request that relates to the current request being handled. + * + * This is used by certain transports to correctly associate related messages. + */ + sendRequest: (request: SendRequestT, resultSchema: U, options?: TaskRequestOptions) => Promise>; + /** + * Closes the SSE stream for this request, triggering client reconnection. + * Only available when using StreamableHTTPServerTransport with eventStore configured. + * Use this to implement polling behavior during long-running operations. + */ + closeSSEStream?: () => void; + /** + * Closes the standalone GET SSE stream, triggering client reconnection. + * Only available when using StreamableHTTPServerTransport with eventStore configured. + * Use this to implement polling behavior for server-initiated notifications. + */ + closeStandaloneSSEStream?: () => void; +}; +/** + * Implements MCP protocol framing on top of a pluggable transport, including + * features like request/response linking, notifications, and progress. + */ +export declare abstract class Protocol { + private _options?; + private _transport?; + private _requestMessageId; + private _requestHandlers; + private _requestHandlerAbortControllers; + private _notificationHandlers; + private _responseHandlers; + private _progressHandlers; + private _timeoutInfo; + private _pendingDebouncedNotifications; + private _taskProgressTokens; + private _taskStore?; + private _taskMessageQueue?; + private _requestResolvers; + /** + * Callback for when the connection is closed for any reason. + * + * This is invoked when close() is called as well. + */ + onclose?: () => void; + /** + * Callback for when an error occurs. + * + * Note that errors are not necessarily fatal; they are used for reporting any kind of exceptional condition out of band. + */ + onerror?: (error: Error) => void; + /** + * A handler to invoke for any request types that do not have their own handler installed. + */ + fallbackRequestHandler?: (request: JSONRPCRequest, extra: RequestHandlerExtra) => Promise; + /** + * A handler to invoke for any notification types that do not have their own handler installed. + */ + fallbackNotificationHandler?: (notification: Notification) => Promise; + constructor(_options?: ProtocolOptions | undefined); + private _oncancel; + private _setupTimeout; + private _resetTimeout; + private _cleanupTimeout; + /** + * Attaches to the given transport, starts it, and starts listening for messages. + * + * The Protocol object assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward. + */ + connect(transport: Transport): Promise; + private _onclose; + private _onerror; + private _onnotification; + private _onrequest; + private _onprogress; + private _onresponse; + get transport(): Transport | undefined; + /** + * Closes the connection. + */ + close(): Promise; + /** + * A method to check if a capability is supported by the remote side, for the given method to be called. + * + * This should be implemented by subclasses. + */ + protected abstract assertCapabilityForMethod(method: SendRequestT['method']): void; + /** + * A method to check if a notification is supported by the local side, for the given method to be sent. + * + * This should be implemented by subclasses. + */ + protected abstract assertNotificationCapability(method: SendNotificationT['method']): void; + /** + * A method to check if a request handler is supported by the local side, for the given method to be handled. + * + * This should be implemented by subclasses. + */ + protected abstract assertRequestHandlerCapability(method: string): void; + /** + * A method to check if task creation is supported for the given request method. + * + * This should be implemented by subclasses. + */ + protected abstract assertTaskCapability(method: string): void; + /** + * A method to check if task handler is supported by the local side, for the given method to be handled. + * + * This should be implemented by subclasses. + */ + protected abstract assertTaskHandlerCapability(method: string): void; + /** + * Sends a request and returns an AsyncGenerator that yields response messages. + * The generator is guaranteed to end with either a 'result' or 'error' message. + * + * @example + * ```typescript + * const stream = protocol.requestStream(request, resultSchema, options); + * for await (const message of stream) { + * switch (message.type) { + * case 'taskCreated': + * console.log('Task created:', message.task.taskId); + * break; + * case 'taskStatus': + * console.log('Task status:', message.task.status); + * break; + * case 'result': + * console.log('Final result:', message.result); + * break; + * case 'error': + * console.error('Error:', message.error); + * break; + * } + * } + * ``` + * + * @experimental Use `client.experimental.tasks.requestStream()` to access this method. + */ + protected requestStream(request: SendRequestT, resultSchema: T, options?: RequestOptions): AsyncGenerator>, void, void>; + /** + * Sends a request and waits for a response. + * + * Do not use this method to emit notifications! Use notification() instead. + */ + request(request: SendRequestT, resultSchema: T, options?: RequestOptions): Promise>; + /** + * Gets the current status of a task. + * + * @experimental Use `client.experimental.tasks.getTask()` to access this method. + */ + protected getTask(params: GetTaskRequest['params'], options?: RequestOptions): Promise; + /** + * Retrieves the result of a completed task. + * + * @experimental Use `client.experimental.tasks.getTaskResult()` to access this method. + */ + protected getTaskResult(params: GetTaskPayloadRequest['params'], resultSchema: T, options?: RequestOptions): Promise>; + /** + * Lists tasks, optionally starting from a pagination cursor. + * + * @experimental Use `client.experimental.tasks.listTasks()` to access this method. + */ + protected listTasks(params?: { + cursor?: string; + }, options?: RequestOptions): Promise>; + /** + * Cancels a specific task. + * + * @experimental Use `client.experimental.tasks.cancelTask()` to access this method. + */ + protected cancelTask(params: { + taskId: string; + }, options?: RequestOptions): Promise>; + /** + * Emits a notification, which is a one-way message that does not expect a response. + */ + notification(notification: SendNotificationT, options?: NotificationOptions): Promise; + /** + * Registers a handler to invoke when this protocol object receives a request with the given method. + * + * Note that this will replace any previous request handler for the same method. + */ + setRequestHandler(requestSchema: T, handler: (request: SchemaOutput, extra: RequestHandlerExtra) => SendResultT | Promise): void; + /** + * Removes the request handler for the given method. + */ + removeRequestHandler(method: string): void; + /** + * Asserts that a request handler has not already been set for the given method, in preparation for a new one being automatically installed. + */ + assertCanSetRequestHandler(method: string): void; + /** + * Registers a handler to invoke when this protocol object receives a notification with the given method. + * + * Note that this will replace any previous notification handler for the same method. + */ + setNotificationHandler(notificationSchema: T, handler: (notification: SchemaOutput) => void | Promise): void; + /** + * Removes the notification handler for the given method. + */ + removeNotificationHandler(method: string): void; + /** + * Cleans up the progress handler associated with a task. + * This should be called when a task reaches a terminal status. + */ + private _cleanupTaskProgressHandler; + /** + * Enqueues a task-related message for side-channel delivery via tasks/result. + * @param taskId The task ID to associate the message with + * @param message The message to enqueue + * @param sessionId Optional session ID for binding the operation to a specific session + * @throws Error if taskStore is not configured or if enqueue fails (e.g., queue overflow) + * + * Note: If enqueue fails, it's the TaskMessageQueue implementation's responsibility to handle + * the error appropriately (e.g., by failing the task, logging, etc.). The Protocol layer + * simply propagates the error. + */ + private _enqueueTaskMessage; + /** + * Clears the message queue for a task and rejects any pending request resolvers. + * @param taskId The task ID whose queue should be cleared + * @param sessionId Optional session ID for binding the operation to a specific session + */ + private _clearTaskQueue; + /** + * Waits for a task update (new messages or status change) with abort signal support. + * Uses polling to check for updates at the task's configured poll interval. + * @param taskId The task ID to wait for + * @param signal Abort signal to cancel the wait + * @returns Promise that resolves when an update occurs or rejects if aborted + */ + private _waitForTaskUpdate; + private requestTaskStore; +} +export declare function mergeCapabilities(base: ServerCapabilities, additional: Partial): ServerCapabilities; +export declare function mergeCapabilities(base: ClientCapabilities, additional: Partial): ClientCapabilities; +//# sourceMappingURL=protocol.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..79d3fbd1071d326afb64d603513214fff7f08cd7 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../../src/shared/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,YAAY,EAAa,MAAM,yBAAyB,CAAC;AAC9F,OAAO,EAEH,kBAAkB,EAGlB,cAAc,EAGd,qBAAqB,EAGrB,qBAAqB,EAErB,sBAAsB,EAOtB,cAAc,EAId,QAAQ,EAIR,SAAS,EACT,MAAM,EACN,kBAAkB,EAClB,WAAW,EAEX,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,mBAAmB,EAEnB,IAAI,EAGJ,OAAO,EACP,YAAY,EAGf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAc,SAAS,EAAE,gBAAgB,EAAiB,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAEhI,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD;;GAE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Aa,EAAE,CAAC,EAChB,OAAO,EAAE,CACL,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EACxB,KAAK,EAAE,mBAAmB,CAAC,YAAY,EAAE,iBAAiB,CAAC,KAC1D,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,GACxC,IAAI;IAUP;;OAEG;IACH,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI1C;;OAEG;IACH,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAMhD;;;;OAIG;IACH,sBAAsB,CAAC,CAAC,SAAS,eAAe,EAC5C,kBAAkB,EAAE,CAAC,EACrB,OAAO,EAAE,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GACjE,IAAI;IAQP;;OAEG;IACH,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI/C;;;OAGG;IACH,OAAO,CAAC,2BAA2B;IAQnC;;;;;;;;;;OAUG;YACW,mBAAmB;IAUjC;;;;OAIG;YACW,eAAe;IAqB7B;;;;;;OAMG;YACW,kBAAkB;IAiChC,OAAO,CAAC,gBAAgB;CAwF3B;AAMD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,kBAAkB,EAAE,UAAU,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,kBAAkB,CAAC;AACzH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,kBAAkB,EAAE,UAAU,EAAE,OAAO,CAAC,kBAAkB,CAAC,GAAG,kBAAkB,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js new file mode 100644 index 0000000000000000000000000000000000000000..bfa2b7120a0f50c569364ea5264e6f811076f44f --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js @@ -0,0 +1,1107 @@ +import { safeParse } from '../server/zod-compat.js'; +import { CancelledNotificationSchema, CreateTaskResultSchema, ErrorCode, GetTaskRequestSchema, GetTaskResultSchema, GetTaskPayloadRequestSchema, ListTasksRequestSchema, ListTasksResultSchema, CancelTaskRequestSchema, CancelTaskResultSchema, isJSONRPCErrorResponse, isJSONRPCRequest, isJSONRPCResultResponse, isJSONRPCNotification, McpError, PingRequestSchema, ProgressNotificationSchema, RELATED_TASK_META_KEY, TaskStatusNotificationSchema, isTaskAugmentedRequestParams } from '../types.js'; +import { isTerminal } from '../experimental/tasks/interfaces.js'; +import { getMethodLiteral, parseWithCompat } from '../server/zod-json-schema-compat.js'; +/** + * The default request timeout, in miliseconds. + */ +export const DEFAULT_REQUEST_TIMEOUT_MSEC = 60000; +/** + * Implements MCP protocol framing on top of a pluggable transport, including + * features like request/response linking, notifications, and progress. + */ +export class Protocol { + constructor(_options) { + this._options = _options; + this._requestMessageId = 0; + this._requestHandlers = new Map(); + this._requestHandlerAbortControllers = new Map(); + this._notificationHandlers = new Map(); + this._responseHandlers = new Map(); + this._progressHandlers = new Map(); + this._timeoutInfo = new Map(); + this._pendingDebouncedNotifications = new Set(); + // Maps task IDs to progress tokens to keep handlers alive after CreateTaskResult + this._taskProgressTokens = new Map(); + this._requestResolvers = new Map(); + this.setNotificationHandler(CancelledNotificationSchema, notification => { + this._oncancel(notification); + }); + this.setNotificationHandler(ProgressNotificationSchema, notification => { + this._onprogress(notification); + }); + this.setRequestHandler(PingRequestSchema, + // Automatic pong by default. + _request => ({})); + // Install task handlers if TaskStore is provided + this._taskStore = _options?.taskStore; + this._taskMessageQueue = _options?.taskMessageQueue; + if (this._taskStore) { + this.setRequestHandler(GetTaskRequestSchema, async (request, extra) => { + const task = await this._taskStore.getTask(request.params.taskId, extra.sessionId); + if (!task) { + throw new McpError(ErrorCode.InvalidParams, 'Failed to retrieve task: Task not found'); + } + // Per spec: tasks/get responses SHALL NOT include related-task metadata + // as the taskId parameter is the source of truth + // @ts-expect-error SendResultT cannot contain GetTaskResult, but we include it in our derived types everywhere else + return { + ...task + }; + }); + this.setRequestHandler(GetTaskPayloadRequestSchema, async (request, extra) => { + const handleTaskResult = async () => { + const taskId = request.params.taskId; + // Deliver queued messages + if (this._taskMessageQueue) { + let queuedMessage; + while ((queuedMessage = await this._taskMessageQueue.dequeue(taskId, extra.sessionId))) { + // Handle response and error messages by routing them to the appropriate resolver + if (queuedMessage.type === 'response' || queuedMessage.type === 'error') { + const message = queuedMessage.message; + const requestId = message.id; + // Lookup resolver in _requestResolvers map + const resolver = this._requestResolvers.get(requestId); + if (resolver) { + // Remove resolver from map after invocation + this._requestResolvers.delete(requestId); + // Invoke resolver with response or error + if (queuedMessage.type === 'response') { + resolver(message); + } + else { + // Convert JSONRPCError to McpError + const errorMessage = message; + const error = new McpError(errorMessage.error.code, errorMessage.error.message, errorMessage.error.data); + resolver(error); + } + } + else { + // Handle missing resolver gracefully with error logging + const messageType = queuedMessage.type === 'response' ? 'Response' : 'Error'; + this._onerror(new Error(`${messageType} handler missing for request ${requestId}`)); + } + // Continue to next message + continue; + } + // Send the message on the response stream by passing the relatedRequestId + // This tells the transport to write the message to the tasks/result response stream + await this._transport?.send(queuedMessage.message, { relatedRequestId: extra.requestId }); + } + } + // Now check task status + const task = await this._taskStore.getTask(taskId, extra.sessionId); + if (!task) { + throw new McpError(ErrorCode.InvalidParams, `Task not found: ${taskId}`); + } + // Block if task is not terminal (we've already delivered all queued messages above) + if (!isTerminal(task.status)) { + // Wait for status change or new messages + await this._waitForTaskUpdate(taskId, extra.signal); + // After waking up, recursively call to deliver any new messages or result + return await handleTaskResult(); + } + // If task is terminal, return the result + if (isTerminal(task.status)) { + const result = await this._taskStore.getTaskResult(taskId, extra.sessionId); + this._clearTaskQueue(taskId); + return { + ...result, + _meta: { + ...result._meta, + [RELATED_TASK_META_KEY]: { + taskId: taskId + } + } + }; + } + return await handleTaskResult(); + }; + return await handleTaskResult(); + }); + this.setRequestHandler(ListTasksRequestSchema, async (request, extra) => { + try { + const { tasks, nextCursor } = await this._taskStore.listTasks(request.params?.cursor, extra.sessionId); + // @ts-expect-error SendResultT cannot contain ListTasksResult, but we include it in our derived types everywhere else + return { + tasks, + nextCursor, + _meta: {} + }; + } + catch (error) { + throw new McpError(ErrorCode.InvalidParams, `Failed to list tasks: ${error instanceof Error ? error.message : String(error)}`); + } + }); + this.setRequestHandler(CancelTaskRequestSchema, async (request, extra) => { + try { + // Get the current task to check if it's in a terminal state, in case the implementation is not atomic + const task = await this._taskStore.getTask(request.params.taskId, extra.sessionId); + if (!task) { + throw new McpError(ErrorCode.InvalidParams, `Task not found: ${request.params.taskId}`); + } + // Reject cancellation of terminal tasks + if (isTerminal(task.status)) { + throw new McpError(ErrorCode.InvalidParams, `Cannot cancel task in terminal status: ${task.status}`); + } + await this._taskStore.updateTaskStatus(request.params.taskId, 'cancelled', 'Client cancelled task execution.', extra.sessionId); + this._clearTaskQueue(request.params.taskId); + const cancelledTask = await this._taskStore.getTask(request.params.taskId, extra.sessionId); + if (!cancelledTask) { + // Task was deleted during cancellation (e.g., cleanup happened) + throw new McpError(ErrorCode.InvalidParams, `Task not found after cancellation: ${request.params.taskId}`); + } + return { + _meta: {}, + ...cancelledTask + }; + } + catch (error) { + // Re-throw McpError as-is + if (error instanceof McpError) { + throw error; + } + throw new McpError(ErrorCode.InvalidRequest, `Failed to cancel task: ${error instanceof Error ? error.message : String(error)}`); + } + }); + } + } + async _oncancel(notification) { + if (!notification.params.requestId) { + return; + } + // Handle request cancellation + const controller = this._requestHandlerAbortControllers.get(notification.params.requestId); + controller?.abort(notification.params.reason); + } + _setupTimeout(messageId, timeout, maxTotalTimeout, onTimeout, resetTimeoutOnProgress = false) { + this._timeoutInfo.set(messageId, { + timeoutId: setTimeout(onTimeout, timeout), + startTime: Date.now(), + timeout, + maxTotalTimeout, + resetTimeoutOnProgress, + onTimeout + }); + } + _resetTimeout(messageId) { + const info = this._timeoutInfo.get(messageId); + if (!info) + return false; + const totalElapsed = Date.now() - info.startTime; + if (info.maxTotalTimeout && totalElapsed >= info.maxTotalTimeout) { + this._timeoutInfo.delete(messageId); + throw McpError.fromError(ErrorCode.RequestTimeout, 'Maximum total timeout exceeded', { + maxTotalTimeout: info.maxTotalTimeout, + totalElapsed + }); + } + clearTimeout(info.timeoutId); + info.timeoutId = setTimeout(info.onTimeout, info.timeout); + return true; + } + _cleanupTimeout(messageId) { + const info = this._timeoutInfo.get(messageId); + if (info) { + clearTimeout(info.timeoutId); + this._timeoutInfo.delete(messageId); + } + } + /** + * Attaches to the given transport, starts it, and starts listening for messages. + * + * The Protocol object assumes ownership of the Transport, replacing any callbacks that have already been set, and expects that it is the only user of the Transport instance going forward. + */ + async connect(transport) { + if (this._transport) { + throw new Error('Already connected to a transport. Call close() before connecting to a new transport, or use a separate Protocol instance per connection.'); + } + this._transport = transport; + const _onclose = this.transport?.onclose; + this._transport.onclose = () => { + _onclose?.(); + this._onclose(); + }; + const _onerror = this.transport?.onerror; + this._transport.onerror = (error) => { + _onerror?.(error); + this._onerror(error); + }; + const _onmessage = this._transport?.onmessage; + this._transport.onmessage = (message, extra) => { + _onmessage?.(message, extra); + if (isJSONRPCResultResponse(message) || isJSONRPCErrorResponse(message)) { + this._onresponse(message); + } + else if (isJSONRPCRequest(message)) { + this._onrequest(message, extra); + } + else if (isJSONRPCNotification(message)) { + this._onnotification(message); + } + else { + this._onerror(new Error(`Unknown message type: ${JSON.stringify(message)}`)); + } + }; + await this._transport.start(); + } + _onclose() { + const responseHandlers = this._responseHandlers; + this._responseHandlers = new Map(); + this._progressHandlers.clear(); + this._taskProgressTokens.clear(); + this._pendingDebouncedNotifications.clear(); + for (const info of this._timeoutInfo.values()) { + clearTimeout(info.timeoutId); + } + this._timeoutInfo.clear(); + // Abort all in-flight request handlers so they stop sending messages + for (const controller of this._requestHandlerAbortControllers.values()) { + controller.abort(); + } + this._requestHandlerAbortControllers.clear(); + const error = McpError.fromError(ErrorCode.ConnectionClosed, 'Connection closed'); + this._transport = undefined; + this.onclose?.(); + for (const handler of responseHandlers.values()) { + handler(error); + } + } + _onerror(error) { + this.onerror?.(error); + } + _onnotification(notification) { + const handler = this._notificationHandlers.get(notification.method) ?? this.fallbackNotificationHandler; + // Ignore notifications not being subscribed to. + if (handler === undefined) { + return; + } + // Starting with Promise.resolve() puts any synchronous errors into the monad as well. + Promise.resolve() + .then(() => handler(notification)) + .catch(error => this._onerror(new Error(`Uncaught error in notification handler: ${error}`))); + } + _onrequest(request, extra) { + const handler = this._requestHandlers.get(request.method) ?? this.fallbackRequestHandler; + // Capture the current transport at request time to ensure responses go to the correct client + const capturedTransport = this._transport; + // Extract taskId from request metadata if present (needed early for method not found case) + const relatedTaskId = request.params?._meta?.[RELATED_TASK_META_KEY]?.taskId; + if (handler === undefined) { + const errorResponse = { + jsonrpc: '2.0', + id: request.id, + error: { + code: ErrorCode.MethodNotFound, + message: 'Method not found' + } + }; + // Queue or send the error response based on whether this is a task-related request + if (relatedTaskId && this._taskMessageQueue) { + this._enqueueTaskMessage(relatedTaskId, { + type: 'error', + message: errorResponse, + timestamp: Date.now() + }, capturedTransport?.sessionId).catch(error => this._onerror(new Error(`Failed to enqueue error response: ${error}`))); + } + else { + capturedTransport + ?.send(errorResponse) + .catch(error => this._onerror(new Error(`Failed to send an error response: ${error}`))); + } + return; + } + const abortController = new AbortController(); + this._requestHandlerAbortControllers.set(request.id, abortController); + const taskCreationParams = isTaskAugmentedRequestParams(request.params) ? request.params.task : undefined; + const taskStore = this._taskStore ? this.requestTaskStore(request, capturedTransport?.sessionId) : undefined; + const fullExtra = { + signal: abortController.signal, + sessionId: capturedTransport?.sessionId, + _meta: request.params?._meta, + sendNotification: async (notification) => { + if (abortController.signal.aborted) + return; + // Include related-task metadata if this request is part of a task + const notificationOptions = { relatedRequestId: request.id }; + if (relatedTaskId) { + notificationOptions.relatedTask = { taskId: relatedTaskId }; + } + await this.notification(notification, notificationOptions); + }, + sendRequest: async (r, resultSchema, options) => { + if (abortController.signal.aborted) { + throw new McpError(ErrorCode.ConnectionClosed, 'Request was cancelled'); + } + // Include related-task metadata if this request is part of a task + const requestOptions = { ...options, relatedRequestId: request.id }; + if (relatedTaskId && !requestOptions.relatedTask) { + requestOptions.relatedTask = { taskId: relatedTaskId }; + } + // Set task status to input_required when sending a request within a task context + // Use the taskId from options (explicit) or fall back to relatedTaskId (inherited) + const effectiveTaskId = requestOptions.relatedTask?.taskId ?? relatedTaskId; + if (effectiveTaskId && taskStore) { + await taskStore.updateTaskStatus(effectiveTaskId, 'input_required'); + } + return await this.request(r, resultSchema, requestOptions); + }, + authInfo: extra?.authInfo, + requestId: request.id, + requestInfo: extra?.requestInfo, + taskId: relatedTaskId, + taskStore: taskStore, + taskRequestedTtl: taskCreationParams?.ttl, + closeSSEStream: extra?.closeSSEStream, + closeStandaloneSSEStream: extra?.closeStandaloneSSEStream + }; + // Starting with Promise.resolve() puts any synchronous errors into the monad as well. + Promise.resolve() + .then(() => { + // If this request asked for task creation, check capability first + if (taskCreationParams) { + // Check if the request method supports task creation + this.assertTaskHandlerCapability(request.method); + } + }) + .then(() => handler(request, fullExtra)) + .then(async (result) => { + if (abortController.signal.aborted) { + // Request was cancelled + return; + } + const response = { + result, + jsonrpc: '2.0', + id: request.id + }; + // Queue or send the response based on whether this is a task-related request + if (relatedTaskId && this._taskMessageQueue) { + await this._enqueueTaskMessage(relatedTaskId, { + type: 'response', + message: response, + timestamp: Date.now() + }, capturedTransport?.sessionId); + } + else { + await capturedTransport?.send(response); + } + }, async (error) => { + if (abortController.signal.aborted) { + // Request was cancelled + return; + } + const errorResponse = { + jsonrpc: '2.0', + id: request.id, + error: { + code: Number.isSafeInteger(error['code']) ? error['code'] : ErrorCode.InternalError, + message: error.message ?? 'Internal error', + ...(error['data'] !== undefined && { data: error['data'] }) + } + }; + // Queue or send the error response based on whether this is a task-related request + if (relatedTaskId && this._taskMessageQueue) { + await this._enqueueTaskMessage(relatedTaskId, { + type: 'error', + message: errorResponse, + timestamp: Date.now() + }, capturedTransport?.sessionId); + } + else { + await capturedTransport?.send(errorResponse); + } + }) + .catch(error => this._onerror(new Error(`Failed to send response: ${error}`))) + .finally(() => { + // Only delete if the stored controller is still ours; after close()+connect(), + // a new connection may have reused the same request ID with a different controller. + if (this._requestHandlerAbortControllers.get(request.id) === abortController) { + this._requestHandlerAbortControllers.delete(request.id); + } + }); + } + _onprogress(notification) { + const { progressToken, ...params } = notification.params; + const messageId = Number(progressToken); + const handler = this._progressHandlers.get(messageId); + if (!handler) { + this._onerror(new Error(`Received a progress notification for an unknown token: ${JSON.stringify(notification)}`)); + return; + } + const responseHandler = this._responseHandlers.get(messageId); + const timeoutInfo = this._timeoutInfo.get(messageId); + if (timeoutInfo && responseHandler && timeoutInfo.resetTimeoutOnProgress) { + try { + this._resetTimeout(messageId); + } + catch (error) { + // Clean up if maxTotalTimeout was exceeded + this._responseHandlers.delete(messageId); + this._progressHandlers.delete(messageId); + this._cleanupTimeout(messageId); + responseHandler(error); + return; + } + } + handler(params); + } + _onresponse(response) { + const messageId = Number(response.id); + // Check if this is a response to a queued request + const resolver = this._requestResolvers.get(messageId); + if (resolver) { + this._requestResolvers.delete(messageId); + if (isJSONRPCResultResponse(response)) { + resolver(response); + } + else { + const error = new McpError(response.error.code, response.error.message, response.error.data); + resolver(error); + } + return; + } + const handler = this._responseHandlers.get(messageId); + if (handler === undefined) { + this._onerror(new Error(`Received a response for an unknown message ID: ${JSON.stringify(response)}`)); + return; + } + this._responseHandlers.delete(messageId); + this._cleanupTimeout(messageId); + // Keep progress handler alive for CreateTaskResult responses + let isTaskResponse = false; + if (isJSONRPCResultResponse(response) && response.result && typeof response.result === 'object') { + const result = response.result; + if (result.task && typeof result.task === 'object') { + const task = result.task; + if (typeof task.taskId === 'string') { + isTaskResponse = true; + this._taskProgressTokens.set(task.taskId, messageId); + } + } + } + if (!isTaskResponse) { + this._progressHandlers.delete(messageId); + } + if (isJSONRPCResultResponse(response)) { + handler(response); + } + else { + const error = McpError.fromError(response.error.code, response.error.message, response.error.data); + handler(error); + } + } + get transport() { + return this._transport; + } + /** + * Closes the connection. + */ + async close() { + await this._transport?.close(); + } + /** + * Sends a request and returns an AsyncGenerator that yields response messages. + * The generator is guaranteed to end with either a 'result' or 'error' message. + * + * @example + * ```typescript + * const stream = protocol.requestStream(request, resultSchema, options); + * for await (const message of stream) { + * switch (message.type) { + * case 'taskCreated': + * console.log('Task created:', message.task.taskId); + * break; + * case 'taskStatus': + * console.log('Task status:', message.task.status); + * break; + * case 'result': + * console.log('Final result:', message.result); + * break; + * case 'error': + * console.error('Error:', message.error); + * break; + * } + * } + * ``` + * + * @experimental Use `client.experimental.tasks.requestStream()` to access this method. + */ + async *requestStream(request, resultSchema, options) { + const { task } = options ?? {}; + // For non-task requests, just yield the result + if (!task) { + try { + const result = await this.request(request, resultSchema, options); + yield { type: 'result', result }; + } + catch (error) { + yield { + type: 'error', + error: error instanceof McpError ? error : new McpError(ErrorCode.InternalError, String(error)) + }; + } + return; + } + // For task-augmented requests, we need to poll for status + // First, make the request to create the task + let taskId; + try { + // Send the request and get the CreateTaskResult + const createResult = await this.request(request, CreateTaskResultSchema, options); + // Extract taskId from the result + if (createResult.task) { + taskId = createResult.task.taskId; + yield { type: 'taskCreated', task: createResult.task }; + } + else { + throw new McpError(ErrorCode.InternalError, 'Task creation did not return a task'); + } + // Poll for task completion + while (true) { + // Get current task status + const task = await this.getTask({ taskId }, options); + yield { type: 'taskStatus', task }; + // Check if task is terminal + if (isTerminal(task.status)) { + if (task.status === 'completed') { + // Get the final result + const result = await this.getTaskResult({ taskId }, resultSchema, options); + yield { type: 'result', result }; + } + else if (task.status === 'failed') { + yield { + type: 'error', + error: new McpError(ErrorCode.InternalError, `Task ${taskId} failed`) + }; + } + else if (task.status === 'cancelled') { + yield { + type: 'error', + error: new McpError(ErrorCode.InternalError, `Task ${taskId} was cancelled`) + }; + } + return; + } + // When input_required, call tasks/result to deliver queued messages + // (elicitation, sampling) via SSE and block until terminal + if (task.status === 'input_required') { + const result = await this.getTaskResult({ taskId }, resultSchema, options); + yield { type: 'result', result }; + return; + } + // Wait before polling again + const pollInterval = task.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1000; + await new Promise(resolve => setTimeout(resolve, pollInterval)); + // Check if cancelled + options?.signal?.throwIfAborted(); + } + } + catch (error) { + yield { + type: 'error', + error: error instanceof McpError ? error : new McpError(ErrorCode.InternalError, String(error)) + }; + } + } + /** + * Sends a request and waits for a response. + * + * Do not use this method to emit notifications! Use notification() instead. + */ + request(request, resultSchema, options) { + const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {}; + // Send the request + return new Promise((resolve, reject) => { + const earlyReject = (error) => { + reject(error); + }; + if (!this._transport) { + earlyReject(new Error('Not connected')); + return; + } + if (this._options?.enforceStrictCapabilities === true) { + try { + this.assertCapabilityForMethod(request.method); + // If task creation is requested, also check task capabilities + if (task) { + this.assertTaskCapability(request.method); + } + } + catch (e) { + earlyReject(e); + return; + } + } + options?.signal?.throwIfAborted(); + const messageId = this._requestMessageId++; + const jsonrpcRequest = { + ...request, + jsonrpc: '2.0', + id: messageId + }; + if (options?.onprogress) { + this._progressHandlers.set(messageId, options.onprogress); + jsonrpcRequest.params = { + ...request.params, + _meta: { + ...(request.params?._meta || {}), + progressToken: messageId + } + }; + } + // Augment with task creation parameters if provided + if (task) { + jsonrpcRequest.params = { + ...jsonrpcRequest.params, + task: task + }; + } + // Augment with related task metadata if relatedTask is provided + if (relatedTask) { + jsonrpcRequest.params = { + ...jsonrpcRequest.params, + _meta: { + ...(jsonrpcRequest.params?._meta || {}), + [RELATED_TASK_META_KEY]: relatedTask + } + }; + } + const cancel = (reason) => { + this._responseHandlers.delete(messageId); + this._progressHandlers.delete(messageId); + this._cleanupTimeout(messageId); + this._transport + ?.send({ + jsonrpc: '2.0', + method: 'notifications/cancelled', + params: { + requestId: messageId, + reason: String(reason) + } + }, { relatedRequestId, resumptionToken, onresumptiontoken }) + .catch(error => this._onerror(new Error(`Failed to send cancellation: ${error}`))); + // Wrap the reason in an McpError if it isn't already + const error = reason instanceof McpError ? reason : new McpError(ErrorCode.RequestTimeout, String(reason)); + reject(error); + }; + this._responseHandlers.set(messageId, response => { + if (options?.signal?.aborted) { + return; + } + if (response instanceof Error) { + return reject(response); + } + try { + const parseResult = safeParse(resultSchema, response.result); + if (!parseResult.success) { + // Type guard: if success is false, error is guaranteed to exist + reject(parseResult.error); + } + else { + resolve(parseResult.data); + } + } + catch (error) { + reject(error); + } + }); + options?.signal?.addEventListener('abort', () => { + cancel(options?.signal?.reason); + }); + const timeout = options?.timeout ?? DEFAULT_REQUEST_TIMEOUT_MSEC; + const timeoutHandler = () => cancel(McpError.fromError(ErrorCode.RequestTimeout, 'Request timed out', { timeout })); + this._setupTimeout(messageId, timeout, options?.maxTotalTimeout, timeoutHandler, options?.resetTimeoutOnProgress ?? false); + // Queue request if related to a task + const relatedTaskId = relatedTask?.taskId; + if (relatedTaskId) { + // Store the response resolver for this request so responses can be routed back + const responseResolver = (response) => { + const handler = this._responseHandlers.get(messageId); + if (handler) { + handler(response); + } + else { + // Log error when resolver is missing, but don't fail + this._onerror(new Error(`Response handler missing for side-channeled request ${messageId}`)); + } + }; + this._requestResolvers.set(messageId, responseResolver); + this._enqueueTaskMessage(relatedTaskId, { + type: 'request', + message: jsonrpcRequest, + timestamp: Date.now() + }).catch(error => { + this._cleanupTimeout(messageId); + reject(error); + }); + // Don't send through transport - queued messages are delivered via tasks/result only + // This prevents duplicate delivery for bidirectional transports + } + else { + // No related task - send through transport normally + this._transport.send(jsonrpcRequest, { relatedRequestId, resumptionToken, onresumptiontoken }).catch(error => { + this._cleanupTimeout(messageId); + reject(error); + }); + } + }); + } + /** + * Gets the current status of a task. + * + * @experimental Use `client.experimental.tasks.getTask()` to access this method. + */ + async getTask(params, options) { + // @ts-expect-error SendRequestT cannot directly contain GetTaskRequest, but we ensure all type instantiations contain it anyways + return this.request({ method: 'tasks/get', params }, GetTaskResultSchema, options); + } + /** + * Retrieves the result of a completed task. + * + * @experimental Use `client.experimental.tasks.getTaskResult()` to access this method. + */ + async getTaskResult(params, resultSchema, options) { + // @ts-expect-error SendRequestT cannot directly contain GetTaskPayloadRequest, but we ensure all type instantiations contain it anyways + return this.request({ method: 'tasks/result', params }, resultSchema, options); + } + /** + * Lists tasks, optionally starting from a pagination cursor. + * + * @experimental Use `client.experimental.tasks.listTasks()` to access this method. + */ + async listTasks(params, options) { + // @ts-expect-error SendRequestT cannot directly contain ListTasksRequest, but we ensure all type instantiations contain it anyways + return this.request({ method: 'tasks/list', params }, ListTasksResultSchema, options); + } + /** + * Cancels a specific task. + * + * @experimental Use `client.experimental.tasks.cancelTask()` to access this method. + */ + async cancelTask(params, options) { + // @ts-expect-error SendRequestT cannot directly contain CancelTaskRequest, but we ensure all type instantiations contain it anyways + return this.request({ method: 'tasks/cancel', params }, CancelTaskResultSchema, options); + } + /** + * Emits a notification, which is a one-way message that does not expect a response. + */ + async notification(notification, options) { + if (!this._transport) { + throw new Error('Not connected'); + } + this.assertNotificationCapability(notification.method); + // Queue notification if related to a task + const relatedTaskId = options?.relatedTask?.taskId; + if (relatedTaskId) { + // Build the JSONRPC notification with metadata + const jsonrpcNotification = { + ...notification, + jsonrpc: '2.0', + params: { + ...notification.params, + _meta: { + ...(notification.params?._meta || {}), + [RELATED_TASK_META_KEY]: options.relatedTask + } + } + }; + await this._enqueueTaskMessage(relatedTaskId, { + type: 'notification', + message: jsonrpcNotification, + timestamp: Date.now() + }); + // Don't send through transport - queued messages are delivered via tasks/result only + // This prevents duplicate delivery for bidirectional transports + return; + } + const debouncedMethods = this._options?.debouncedNotificationMethods ?? []; + // A notification can only be debounced if it's in the list AND it's "simple" + // (i.e., has no parameters and no related request ID or related task that could be lost). + const canDebounce = debouncedMethods.includes(notification.method) && !notification.params && !options?.relatedRequestId && !options?.relatedTask; + if (canDebounce) { + // If a notification of this type is already scheduled, do nothing. + if (this._pendingDebouncedNotifications.has(notification.method)) { + return; + } + // Mark this notification type as pending. + this._pendingDebouncedNotifications.add(notification.method); + // Schedule the actual send to happen in the next microtask. + // This allows all synchronous calls in the current event loop tick to be coalesced. + Promise.resolve().then(() => { + // Un-mark the notification so the next one can be scheduled. + this._pendingDebouncedNotifications.delete(notification.method); + // SAFETY CHECK: If the connection was closed while this was pending, abort. + if (!this._transport) { + return; + } + let jsonrpcNotification = { + ...notification, + jsonrpc: '2.0' + }; + // Augment with related task metadata if relatedTask is provided + if (options?.relatedTask) { + jsonrpcNotification = { + ...jsonrpcNotification, + params: { + ...jsonrpcNotification.params, + _meta: { + ...(jsonrpcNotification.params?._meta || {}), + [RELATED_TASK_META_KEY]: options.relatedTask + } + } + }; + } + // Send the notification, but don't await it here to avoid blocking. + // Handle potential errors with a .catch(). + this._transport?.send(jsonrpcNotification, options).catch(error => this._onerror(error)); + }); + // Return immediately. + return; + } + let jsonrpcNotification = { + ...notification, + jsonrpc: '2.0' + }; + // Augment with related task metadata if relatedTask is provided + if (options?.relatedTask) { + jsonrpcNotification = { + ...jsonrpcNotification, + params: { + ...jsonrpcNotification.params, + _meta: { + ...(jsonrpcNotification.params?._meta || {}), + [RELATED_TASK_META_KEY]: options.relatedTask + } + } + }; + } + await this._transport.send(jsonrpcNotification, options); + } + /** + * Registers a handler to invoke when this protocol object receives a request with the given method. + * + * Note that this will replace any previous request handler for the same method. + */ + setRequestHandler(requestSchema, handler) { + const method = getMethodLiteral(requestSchema); + this.assertRequestHandlerCapability(method); + this._requestHandlers.set(method, (request, extra) => { + const parsed = parseWithCompat(requestSchema, request); + return Promise.resolve(handler(parsed, extra)); + }); + } + /** + * Removes the request handler for the given method. + */ + removeRequestHandler(method) { + this._requestHandlers.delete(method); + } + /** + * Asserts that a request handler has not already been set for the given method, in preparation for a new one being automatically installed. + */ + assertCanSetRequestHandler(method) { + if (this._requestHandlers.has(method)) { + throw new Error(`A request handler for ${method} already exists, which would be overridden`); + } + } + /** + * Registers a handler to invoke when this protocol object receives a notification with the given method. + * + * Note that this will replace any previous notification handler for the same method. + */ + setNotificationHandler(notificationSchema, handler) { + const method = getMethodLiteral(notificationSchema); + this._notificationHandlers.set(method, notification => { + const parsed = parseWithCompat(notificationSchema, notification); + return Promise.resolve(handler(parsed)); + }); + } + /** + * Removes the notification handler for the given method. + */ + removeNotificationHandler(method) { + this._notificationHandlers.delete(method); + } + /** + * Cleans up the progress handler associated with a task. + * This should be called when a task reaches a terminal status. + */ + _cleanupTaskProgressHandler(taskId) { + const progressToken = this._taskProgressTokens.get(taskId); + if (progressToken !== undefined) { + this._progressHandlers.delete(progressToken); + this._taskProgressTokens.delete(taskId); + } + } + /** + * Enqueues a task-related message for side-channel delivery via tasks/result. + * @param taskId The task ID to associate the message with + * @param message The message to enqueue + * @param sessionId Optional session ID for binding the operation to a specific session + * @throws Error if taskStore is not configured or if enqueue fails (e.g., queue overflow) + * + * Note: If enqueue fails, it's the TaskMessageQueue implementation's responsibility to handle + * the error appropriately (e.g., by failing the task, logging, etc.). The Protocol layer + * simply propagates the error. + */ + async _enqueueTaskMessage(taskId, message, sessionId) { + // Task message queues are only used when taskStore is configured + if (!this._taskStore || !this._taskMessageQueue) { + throw new Error('Cannot enqueue task message: taskStore and taskMessageQueue are not configured'); + } + const maxQueueSize = this._options?.maxTaskQueueSize; + await this._taskMessageQueue.enqueue(taskId, message, sessionId, maxQueueSize); + } + /** + * Clears the message queue for a task and rejects any pending request resolvers. + * @param taskId The task ID whose queue should be cleared + * @param sessionId Optional session ID for binding the operation to a specific session + */ + async _clearTaskQueue(taskId, sessionId) { + if (this._taskMessageQueue) { + // Reject any pending request resolvers + const messages = await this._taskMessageQueue.dequeueAll(taskId, sessionId); + for (const message of messages) { + if (message.type === 'request' && isJSONRPCRequest(message.message)) { + // Extract request ID from the message + const requestId = message.message.id; + const resolver = this._requestResolvers.get(requestId); + if (resolver) { + resolver(new McpError(ErrorCode.InternalError, 'Task cancelled or completed')); + this._requestResolvers.delete(requestId); + } + else { + // Log error when resolver is missing during cleanup for better observability + this._onerror(new Error(`Resolver missing for request ${requestId} during task ${taskId} cleanup`)); + } + } + } + } + } + /** + * Waits for a task update (new messages or status change) with abort signal support. + * Uses polling to check for updates at the task's configured poll interval. + * @param taskId The task ID to wait for + * @param signal Abort signal to cancel the wait + * @returns Promise that resolves when an update occurs or rejects if aborted + */ + async _waitForTaskUpdate(taskId, signal) { + // Get the task's poll interval, falling back to default + let interval = this._options?.defaultTaskPollInterval ?? 1000; + try { + const task = await this._taskStore?.getTask(taskId); + if (task?.pollInterval) { + interval = task.pollInterval; + } + } + catch { + // Use default interval if task lookup fails + } + return new Promise((resolve, reject) => { + if (signal.aborted) { + reject(new McpError(ErrorCode.InvalidRequest, 'Request cancelled')); + return; + } + // Wait for the poll interval, then resolve so caller can check for updates + const timeoutId = setTimeout(resolve, interval); + // Clean up timeout and reject if aborted + signal.addEventListener('abort', () => { + clearTimeout(timeoutId); + reject(new McpError(ErrorCode.InvalidRequest, 'Request cancelled')); + }, { once: true }); + }); + } + requestTaskStore(request, sessionId) { + const taskStore = this._taskStore; + if (!taskStore) { + throw new Error('No task store configured'); + } + return { + createTask: async (taskParams) => { + if (!request) { + throw new Error('No request provided'); + } + return await taskStore.createTask(taskParams, request.id, { + method: request.method, + params: request.params + }, sessionId); + }, + getTask: async (taskId) => { + const task = await taskStore.getTask(taskId, sessionId); + if (!task) { + throw new McpError(ErrorCode.InvalidParams, 'Failed to retrieve task: Task not found'); + } + return task; + }, + storeTaskResult: async (taskId, status, result) => { + await taskStore.storeTaskResult(taskId, status, result, sessionId); + // Get updated task state and send notification + const task = await taskStore.getTask(taskId, sessionId); + if (task) { + const notification = TaskStatusNotificationSchema.parse({ + method: 'notifications/tasks/status', + params: task + }); + await this.notification(notification); + if (isTerminal(task.status)) { + this._cleanupTaskProgressHandler(taskId); + // Don't clear queue here - it will be cleared after delivery via tasks/result + } + } + }, + getTaskResult: taskId => { + return taskStore.getTaskResult(taskId, sessionId); + }, + updateTaskStatus: async (taskId, status, statusMessage) => { + // Check if task exists + const task = await taskStore.getTask(taskId, sessionId); + if (!task) { + throw new McpError(ErrorCode.InvalidParams, `Task "${taskId}" not found - it may have been cleaned up`); + } + // Don't allow transitions from terminal states + if (isTerminal(task.status)) { + throw new McpError(ErrorCode.InvalidParams, `Cannot update task "${taskId}" from terminal status "${task.status}" to "${status}". Terminal states (completed, failed, cancelled) cannot transition to other states.`); + } + await taskStore.updateTaskStatus(taskId, status, statusMessage, sessionId); + // Get updated task state and send notification + const updatedTask = await taskStore.getTask(taskId, sessionId); + if (updatedTask) { + const notification = TaskStatusNotificationSchema.parse({ + method: 'notifications/tasks/status', + params: updatedTask + }); + await this.notification(notification); + if (isTerminal(updatedTask.status)) { + this._cleanupTaskProgressHandler(taskId); + // Don't clear queue here - it will be cleared after delivery via tasks/result + } + } + }, + listTasks: cursor => { + return taskStore.listTasks(cursor, sessionId); + } + }; + } +} +function isPlainObject(value) { + return value !== null && typeof value === 'object' && !Array.isArray(value); +} +export function mergeCapabilities(base, additional) { + const result = { ...base }; + for (const key in additional) { + const k = key; + const addValue = additional[k]; + if (addValue === undefined) + continue; + const baseValue = result[k]; + if (isPlainObject(baseValue) && isPlainObject(addValue)) { + result[k] = { ...baseValue, ...addValue }; + } + else { + result[k] = addValue; + } + } + return result; +} +//# sourceMappingURL=protocol.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js.map new file mode 100644 index 0000000000000000000000000000000000000000..2b631ed407cbf9523f6fad19ce765807d96f58b1 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js.map @@ -0,0 +1 @@ +{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../src/shared/protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC9F,OAAO,EACH,2BAA2B,EAE3B,sBAAsB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G,UAAU,CAAC,CAAC,CAAC,CAAC;QAC/B,IAAI,QAAQ,KAAK,SAAS;YAAE,SAAS;QACrC,MAAM,SAAS,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;QAC5B,IAAI,aAAa,CAAC,SAAS,CAAC,IAAI,aAAa,CAAC,QAAQ,CAAC,EAAE,CAAC;YACtD,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,GAAI,SAAqC,EAAE,GAAI,QAAoC,EAAiB,CAAC;QACvH,CAAC;aAAM,CAAC;YACJ,MAAM,CAAC,CAAC,CAAC,GAAG,QAAuB,CAAC;QACxC,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/responseMessage.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/responseMessage.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..84354bdb75325de8d23e41fcda1f1dba30eff8f4 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/responseMessage.d.ts @@ -0,0 +1,45 @@ +import { Result, Task, McpError } from '../types.js'; +/** + * Base message type + */ +export interface BaseResponseMessage { + type: string; +} +/** + * Task status update message + */ +export interface TaskStatusMessage extends BaseResponseMessage { + type: 'taskStatus'; + task: Task; +} +/** + * Task created message (first message for task-augmented requests) + */ +export interface TaskCreatedMessage extends BaseResponseMessage { + type: 'taskCreated'; + task: Task; +} +/** + * Final result message (terminal) + */ +export interface ResultMessage extends BaseResponseMessage { + type: 'result'; + result: T; +} +/** + * Error message (terminal) + */ +export interface ErrorMessage extends BaseResponseMessage { + type: 'error'; + error: McpError; +} +/** + * Union type representing all possible messages that can be yielded during request processing. + * Note: Progress notifications are handled through the existing onprogress callback mechanism. + * Side-channeled messages (server requests/notifications) are handled through registered handlers. + */ +export type ResponseMessage = TaskStatusMessage | TaskCreatedMessage | ResultMessage | ErrorMessage; +export type AsyncGeneratorValue = T extends AsyncGenerator ? U : never; +export declare function toArrayAsync>(it: T): Promise[]>; +export declare function takeResult>>(it: U): Promise; +//# sourceMappingURL=responseMessage.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/responseMessage.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/responseMessage.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..65d93bb50e14f999fbbb38c2df4d7953a4588713 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/responseMessage.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"responseMessage.d.ts","sourceRoot":"","sources":["../../../src/shared/responseMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,mBAAmB;IAC1D,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,IAAI,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,mBAAmB;IAC3D,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI,EAAE,IAAI,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,MAAM,CAAE,SAAQ,mBAAmB;IACxE,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,CAAC,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,YAAa,SAAQ,mBAAmB;IACrD,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,QAAQ,CAAC;CACnB;AAED;;;;GAIG;AACH,MAAM,MAAM,eAAe,CAAC,CAAC,SAAS,MAAM,IAAI,iBAAiB,GAAG,kBAAkB,GAAG,aAAa,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC;AAEzH,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CAAC,SAAS,cAAc,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAEnF,wBAAsB,YAAY,CAAC,CAAC,SAAS,cAAc,CAAC,OAAO,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,EAAE,CAAC,CAO9G;AAED,wBAAsB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,cAAc,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAUlH"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/responseMessage.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/responseMessage.js new file mode 100644 index 0000000000000000000000000000000000000000..d29e8a4505230742f71c865a1e1ca00c8a461243 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/responseMessage.js @@ -0,0 +1,19 @@ +export async function toArrayAsync(it) { + const arr = []; + for await (const o of it) { + arr.push(o); + } + return arr; +} +export async function takeResult(it) { + for await (const o of it) { + if (o.type === 'result') { + return o.result; + } + else if (o.type === 'error') { + throw o.error; + } + } + throw new Error('No result in stream.'); +} +//# sourceMappingURL=responseMessage.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/responseMessage.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/responseMessage.js.map new file mode 100644 index 0000000000000000000000000000000000000000..eca1ceccb77aa45064de4ff46e524b538ae6d6ca --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/responseMessage.js.map @@ -0,0 +1 @@ +{"version":3,"file":"responseMessage.js","sourceRoot":"","sources":["../../../src/shared/responseMessage.ts"],"names":[],"mappings":"AAkDA,MAAM,CAAC,KAAK,UAAU,YAAY,CAAoC,EAAK;IACvE,MAAM,GAAG,GAA6B,EAAE,CAAC;IACzC,IAAI,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;QACvB,GAAG,CAAC,IAAI,CAAC,CAA2B,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,GAAG,CAAC;AACf,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAAiE,EAAK;IAClG,IAAI,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;QACvB,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACtB,OAAO,CAAC,CAAC,MAAM,CAAC;QACpB,CAAC;aAAM,IAAI,CAAC,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;YAC5B,MAAM,CAAC,CAAC,KAAK,CAAC;QAClB,CAAC;IACL,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;AAC5C,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7ec09089d11d100e81de7ad3fada60c3f9e82e9e --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.d.ts @@ -0,0 +1,18 @@ +import { JSONRPCMessage } from '../types.js'; +export declare const STDIO_DEFAULT_MAX_BUFFER_SIZE: number; +/** + * Buffers a continuous stdio stream into discrete JSON-RPC messages. + */ +export declare class ReadBuffer { + private _buffer?; + private _maxBufferSize; + constructor(options?: { + maxBufferSize?: number; + }); + append(chunk: Buffer): void; + readMessage(): JSONRPCMessage | null; + clear(): void; +} +export declare function deserializeMessage(line: string): JSONRPCMessage; +export declare function serializeMessage(message: JSONRPCMessage): string; +//# sourceMappingURL=stdio.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..6042f6d1ac293bbf12ff3f6da098aa8ed960b312 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../../../src/shared/stdio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAwB,MAAM,aAAa,CAAC;AAEnE,eAAO,MAAM,6BAA6B,QAAmB,CAAC;AAE9D;;GAEG;AACH,qBAAa,UAAU;IACnB,OAAO,CAAC,OAAO,CAAC,CAAS;IACzB,OAAO,CAAC,cAAc,CAAS;gBAEnB,OAAO,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAA;KAAE;IAIhD,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAS3B,WAAW,IAAI,cAAc,GAAG,IAAI;IAepC,KAAK,IAAI,IAAI;CAGhB;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAE/D;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,cAAc,GAAG,MAAM,CAEhE"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js new file mode 100644 index 0000000000000000000000000000000000000000..cf20e652c2f8fb6444559e8dae7dc259b310acd6 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js @@ -0,0 +1,40 @@ +import { JSONRPCMessageSchema } from '../types.js'; +export const STDIO_DEFAULT_MAX_BUFFER_SIZE = 10 * 1024 * 1024; +/** + * Buffers a continuous stdio stream into discrete JSON-RPC messages. + */ +export class ReadBuffer { + constructor(options) { + this._maxBufferSize = options?.maxBufferSize ?? STDIO_DEFAULT_MAX_BUFFER_SIZE; + } + append(chunk) { + const newSize = (this._buffer?.length ?? 0) + chunk.length; + if (newSize > this._maxBufferSize) { + this.clear(); + throw new Error(`ReadBuffer exceeded maximum size of ${this._maxBufferSize} bytes`); + } + this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk; + } + readMessage() { + if (!this._buffer) { + return null; + } + const index = this._buffer.indexOf('\n'); + if (index === -1) { + return null; + } + const line = this._buffer.toString('utf8', 0, index).replace(/\r$/, ''); + this._buffer = this._buffer.subarray(index + 1); + return deserializeMessage(line); + } + clear() { + this._buffer = undefined; + } +} +export function deserializeMessage(line) { + return JSONRPCMessageSchema.parse(JSON.parse(line)); +} +export function serializeMessage(message) { + return JSON.stringify(message) + '\n'; +} +//# sourceMappingURL=stdio.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js.map new file mode 100644 index 0000000000000000000000000000000000000000..bf332f878759e18db787490957369d5370440a08 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js.map @@ -0,0 +1 @@ +{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../../../src/shared/stdio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEnE,MAAM,CAAC,MAAM,6BAA6B,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAE9D;;GAEG;AACH,MAAM,OAAO,UAAU;IAInB,YAAY,OAAoC;QAC5C,IAAI,CAAC,cAAc,GAAG,OAAO,EAAE,aAAa,IAAI,6BAA6B,CAAC;IAClF,CAAC;IAED,MAAM,CAAC,KAAa;QAChB,MAAM,OAAO,GAAG,CAAC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AuB;IACpD,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC;AAC1C,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3cf94bf78e4c8e493f08d03634e0c068224f1f1e --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.d.ts @@ -0,0 +1,31 @@ +/** + * Tool name validation utilities according to SEP: Specify Format for Tool Names + * + * Tool names SHOULD be between 1 and 128 characters in length (inclusive). + * Tool names are case-sensitive. + * Allowed characters: uppercase and lowercase ASCII letters (A-Z, a-z), digits + * (0-9), underscore (_), dash (-), and dot (.). + * Tool names SHOULD NOT contain spaces, commas, or other special characters. + */ +/** + * Validates a tool name according to the SEP specification + * @param name - The tool name to validate + * @returns An object containing validation result and any warnings + */ +export declare function validateToolName(name: string): { + isValid: boolean; + warnings: string[]; +}; +/** + * Issues warnings for non-conforming tool names + * @param name - The tool name that triggered the warnings + * @param warnings - Array of warning messages + */ +export declare function issueToolNameWarning(name: string, warnings: string[]): void; +/** + * Validates a tool name and issues warnings for non-conforming names + * @param name - The tool name to validate + * @returns true if the name is valid, false otherwise + */ +export declare function validateAndWarnToolName(name: string): boolean; +//# sourceMappingURL=toolNameValidation.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..d81f0156e68cc90915cf47958243c42b31ea52de --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"toolNameValidation.d.ts","sourceRoot":"","sources":["../../../src/shared/toolNameValidation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG;IAC5C,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,EAAE,CAAC;CACtB,CA0DA;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAY3E;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAO7D"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js new file mode 100644 index 0000000000000000000000000000000000000000..34b6d19c565093222b149980fc8f260f2187c57d --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js @@ -0,0 +1,92 @@ +/** + * Tool name validation utilities according to SEP: Specify Format for Tool Names + * + * Tool names SHOULD be between 1 and 128 characters in length (inclusive). + * Tool names are case-sensitive. + * Allowed characters: uppercase and lowercase ASCII letters (A-Z, a-z), digits + * (0-9), underscore (_), dash (-), and dot (.). + * Tool names SHOULD NOT contain spaces, commas, or other special characters. + */ +/** + * Regular expression for valid tool names according to SEP-986 specification + */ +const TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/; +/** + * Validates a tool name according to the SEP specification + * @param name - The tool name to validate + * @returns An object containing validation result and any warnings + */ +export function validateToolName(name) { + const warnings = []; + // Check length + if (name.length === 0) { + return { + isValid: false, + warnings: ['Tool name cannot be empty'] + }; + } + if (name.length > 128) { + return { + isValid: false, + warnings: [`Tool name exceeds maximum length of 128 characters (current: ${name.length})`] + }; + } + // Check for specific problematic patterns (these are warnings, not validation failures) + if (name.includes(' ')) { + warnings.push('Tool name contains spaces, which may cause parsing issues'); + } + if (name.includes(',')) { + warnings.push('Tool name contains commas, which may cause parsing issues'); + } + // Check for potentially confusing patterns (leading/trailing dashes, dots, slashes) + if (name.startsWith('-') || name.endsWith('-')) { + warnings.push('Tool name starts or ends with a dash, which may cause parsing issues in some contexts'); + } + if (name.startsWith('.') || name.endsWith('.')) { + warnings.push('Tool name starts or ends with a dot, which may cause parsing issues in some contexts'); + } + // Check for invalid characters + if (!TOOL_NAME_REGEX.test(name)) { + const invalidChars = name + .split('') + .filter(char => !/[A-Za-z0-9._-]/.test(char)) + .filter((char, index, arr) => arr.indexOf(char) === index); // Remove duplicates + warnings.push(`Tool name contains invalid characters: ${invalidChars.map(c => `"${c}"`).join(', ')}`, 'Allowed characters are: A-Z, a-z, 0-9, underscore (_), dash (-), and dot (.)'); + return { + isValid: false, + warnings + }; + } + return { + isValid: true, + warnings + }; +} +/** + * Issues warnings for non-conforming tool names + * @param name - The tool name that triggered the warnings + * @param warnings - Array of warning messages + */ +export function issueToolNameWarning(name, warnings) { + if (warnings.length > 0) { + console.warn(`Tool name validation warning for "${name}":`); + for (const warning of warnings) { + console.warn(` - ${warning}`); + } + console.warn('Tool registration will proceed, but this may cause compatibility issues.'); + console.warn('Consider updating the tool name to conform to the MCP tool naming standard.'); + console.warn('See SEP: Specify Format for Tool Names (https://github.com/modelcontextprotocol/modelcontextprotocol/issues/986) for more details.'); + } +} +/** + * Validates a tool name and issues warnings for non-conforming names + * @param name - The tool name to validate + * @returns true if the name is valid, false otherwise + */ +export function validateAndWarnToolName(name) { + const result = validateToolName(name); + // Always issue warnings for any validation issues (both invalid names and warnings) + issueToolNameWarning(name, result.warnings); + return result.isValid; +} +//# sourceMappingURL=toolNameValidation.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js.map new file mode 100644 index 0000000000000000000000000000000000000000..9fdfcea843305c232570c4a97864d01ab53d6717 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js.map @@ -0,0 +1 @@ +{"version":3,"file":"toolNameValidation.js","sourceRoot":"","sources":["../../../src/shared/toolNameValidation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;GAEG;AACH,MAAM,eAAe,GAAG,yBAAyB,CAAC;AAElD;;;;GAIG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAIzC,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,eAAe;IACf,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpB,OAAO;YACH,OAAO,EAAE,KAAK;YACd,QAAQ,EAAE,CAAC,2BAA2B,CAAC;SAC1C,CAAC;IACN,CAAC;IAED,IAAI,IAAI,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;QACpB,OAAO;YACH,OAAO,EAAE,KAAK;YACd,QAAQ,EAAE,CAAC,gEAAgE,IAAI,CAAC,MAAM,GAAG,CAAC;SAC7F,CAAC;IACN,CAAC;IAED,wFAAwF;IACxF,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACrB,QAAQ,CAAC,IAAI,CAAC,2DAA2D,CAAC,CAAC;IAC/E,CAAC;IAED,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACrB,QAAQ,CAAC,IAAI,CAAC,2DAA2D,CAAC,CAAC;IAC/E,CAAC;IAED,oFAAoF;IACpF,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7C,QAAQ,CAAC,IAAI,CAAC,uFAAuF,CAAC,CAAC;IAC3G,CAAC;IAED,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,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oIAAoI,CACvI,CAAC;IACN,CAAC;AACL,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAAY;IAChD,MAAM,MAAM,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAEtC,oFAAoF;IACpF,oBAAoB,CAAC,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;IAE5C,OAAO,MAAM,CAAC,OAAO,CAAC;AAC1B,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..1bd95efb41fcfd1ae09712ca968c57d828e0acaf --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.d.ts @@ -0,0 +1,89 @@ +import { JSONRPCMessage, MessageExtraInfo, RequestId } from '../types.js'; +export type FetchLike = (url: string | URL, init?: RequestInit) => Promise; +/** + * Normalizes HeadersInit to a plain Record for manipulation. + * Handles Headers objects, arrays of tuples, and plain objects. + */ +export declare function normalizeHeaders(headers: HeadersInit | undefined): Record; +/** + * Creates a fetch function that includes base RequestInit options. + * This ensures requests inherit settings like credentials, mode, headers, etc. from the base init. + * + * @param baseFetch - The base fetch function to wrap (defaults to global fetch) + * @param baseInit - The base RequestInit to merge with each request + * @returns A wrapped fetch function that merges base options with call-specific options + */ +export declare function createFetchWithInit(baseFetch?: FetchLike, baseInit?: RequestInit): FetchLike; +/** + * Options for sending a JSON-RPC message. + */ +export type TransportSendOptions = { + /** + * If present, `relatedRequestId` is used to indicate to the transport which incoming request to associate this outgoing message with. + */ + relatedRequestId?: RequestId; + /** + * The resumption token used to continue long-running requests that were interrupted. + * + * This allows clients to reconnect and continue from where they left off, if supported by the transport. + */ + resumptionToken?: string; + /** + * A callback that is invoked when the resumption token changes, if supported by the transport. + * + * This allows clients to persist the latest token for potential reconnection. + */ + onresumptiontoken?: (token: string) => void; +}; +/** + * Describes the minimal contract for an MCP transport that a client or server can communicate over. + */ +export interface Transport { + /** + * Starts processing messages on the transport, including any connection steps that might need to be taken. + * + * This method should only be called after callbacks are installed, or else messages may be lost. + * + * NOTE: This method should not be called explicitly when using Client, Server, or Protocol classes, as they will implicitly call start(). + */ + start(): Promise; + /** + * Sends a JSON-RPC message (request or response). + * + * If present, `relatedRequestId` is used to indicate to the transport which incoming request to associate this outgoing message with. + */ + send(message: JSONRPCMessage, options?: TransportSendOptions): Promise; + /** + * Closes the connection. + */ + close(): Promise; + /** + * Callback for when the connection is closed for any reason. + * + * This should be invoked when close() is called as well. + */ + onclose?: () => void; + /** + * Callback for when an error occurs. + * + * Note that errors are not necessarily fatal; they are used for reporting any kind of exceptional condition out of band. + */ + onerror?: (error: Error) => void; + /** + * Callback for when a message (request or response) is received over the connection. + * + * Includes the requestInfo and authInfo if the transport is authenticated. + * + * The requestInfo can be used to get the original request information (headers, etc.) + */ + onmessage?: (message: T, extra?: MessageExtraInfo) => void; + /** + * The session ID generated for this connection. + */ + sessionId?: string; + /** + * Sets the protocol version used for the connection (called when the initialize response is received). + */ + setProtocolVersion?: (version: string) => void; +} +//# sourceMappingURL=transport.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..7a3d837df8eefaf7a735b7a4a14ae3b69683f625 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../../src/shared/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE1E,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EA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AE,MAAM,KAAK,IAAI,CAAC;CAClD"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js new file mode 100644 index 0000000000000000000000000000000000000000..ce25e23c26c48eac9e5beac59514460e0d8f8e3a --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js @@ -0,0 +1,39 @@ +/** + * Normalizes HeadersInit to a plain Record for manipulation. + * Handles Headers objects, arrays of tuples, and plain objects. + */ +export function normalizeHeaders(headers) { + if (!headers) + return {}; + if (headers instanceof Headers) { + return Object.fromEntries(headers.entries()); + } + if (Array.isArray(headers)) { + return Object.fromEntries(headers); + } + return { ...headers }; +} +/** + * Creates a fetch function that includes base RequestInit options. + * This ensures requests inherit settings like credentials, mode, headers, etc. from the base init. + * + * @param baseFetch - The base fetch function to wrap (defaults to global fetch) + * @param baseInit - The base RequestInit to merge with each request + * @returns A wrapped fetch function that merges base options with call-specific options + */ +export function createFetchWithInit(baseFetch = fetch, baseInit) { + if (!baseInit) { + return baseFetch; + } + // Return a wrapped fetch that merges base RequestInit with call-specific init + return async (url, init) => { + const mergedInit = { + ...baseInit, + ...init, + // Headers need special handling - merge instead of replace + headers: init?.headers ? { ...normalizeHeaders(baseInit.headers), ...normalizeHeaders(init.headers) } : baseInit.headers + }; + return baseFetch(url, mergedInit); + }; +} +//# sourceMappingURL=transport.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js.map new file mode 100644 index 0000000000000000000000000000000000000000..790e11d8aa5a495cc623c1cba71376820ae13f26 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js.map @@ -0,0 +1 @@ +{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../../src/shared/transport.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAgC;IAC7D,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IAExB,IAAI,OAAO,YAAY,OAAO,EAAE,CAAC;QAC7B,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IACjD,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QACzB,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,EAAE,GAAI,OAAkC,EAAE,CAAC;AACtD,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,mBAAmB,CAAC,YAAuB,KAAK,EAAE,QAAsB;IACpF,IAAI,CAAC,QAAQ,EAAE,CAAC;QACZ,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,8EAA8E;IAC9E,OAAO,KAAK,EAAE,GAAiB,EAAE,IAAkB,EAAqB,EAAE;QACtE,MAAM,UAAU,GAAgB;YAC5B,GAAG,QAAQ;YACX,GAAG,IAAI;YACP,2DAA2D;YAC3D,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,GAAG,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO;SAC3H,CAAC;QACF,OAAO,SAAS,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IACtC,CAAC,CAAC;AACN,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..175e329b666b19b1cfbb0cd34eb1ab962acdcaac --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.d.ts @@ -0,0 +1,25 @@ +export type Variables = Record; +export declare class UriTemplate { + /** + * Returns true if the given string contains any URI template expressions. + * A template expression is a sequence of characters enclosed in curly braces, + * like {foo} or {?bar}. + */ + static isTemplate(str: string): boolean; + private static validateLength; + private readonly template; + private readonly parts; + get variableNames(): string[]; + constructor(template: string); + toString(): string; + private parse; + private getOperator; + private getNames; + private encodeValue; + private expandPart; + expand(variables: Variables): string; + private escapeRegExp; + private partToRegExp; + match(uri: string): Variables | null; +} +//# sourceMappingURL=uriTemplate.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..052e91851e8225fbe9c40755f34300b76baf9d86 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"uriTemplate.d.ts","sourceRoot":"","sources":["../../../src/shared/uriTemplate.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;AAO1D,qBAAa,WAAW;IACpB;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAMvC,OAAO,CAAC,MAAM,CAAC,cAAc;IAK7B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAyF;IAE/G,IAAI,aAAa,IAAI,MAAM,EAAE,CAE5B;gBAEW,QAAQ,EAAE,MAAM;IAM5B,QAAQ,IAAI,MAAM;IAIlB,OAAO,CAAC,KAAK;IA8Cb,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,QAAQ;IAShB,OAAO,CAAC,WAAW;IAQnB,OAAO,CAAC,UAAU;IAsDlB,MAAM,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM;IA4BpC,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,YAAY;IAkDpB,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;CAuCvC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.js new file mode 100644 index 0000000000000000000000000000000000000000..8247f631e51fe9c40ef3c662d3e0f9e099aec0c3 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.js @@ -0,0 +1,239 @@ +// Claude-authored implementation of RFC 6570 URI Templates +const MAX_TEMPLATE_LENGTH = 1000000; // 1MB +const MAX_VARIABLE_LENGTH = 1000000; // 1MB +const MAX_TEMPLATE_EXPRESSIONS = 10000; +const MAX_REGEX_LENGTH = 1000000; // 1MB +export class UriTemplate { + /** + * Returns true if the given string contains any URI template expressions. + * A template expression is a sequence of characters enclosed in curly braces, + * like {foo} or {?bar}. + */ + static isTemplate(str) { + // Look for any sequence of characters between curly braces + // that isn't just whitespace + return /\{[^}\s]+\}/.test(str); + } + static validateLength(str, max, context) { + if (str.length > max) { + throw new Error(`${context} exceeds maximum length of ${max} characters (got ${str.length})`); + } + } + get variableNames() { + return this.parts.flatMap(part => (typeof part === 'string' ? [] : part.names)); + } + constructor(template) { + UriTemplate.validateLength(template, MAX_TEMPLATE_LENGTH, 'Template'); + this.template = template; + this.parts = this.parse(template); + } + toString() { + return this.template; + } + parse(template) { + const parts = []; + let currentText = ''; + let i = 0; + let expressionCount = 0; + while (i < template.length) { + if (template[i] === '{') { + if (currentText) { + parts.push(currentText); + currentText = ''; + } + const end = template.indexOf('}', i); + if (end === -1) + throw new Error('Unclosed template expression'); + expressionCount++; + if (expressionCount > MAX_TEMPLATE_EXPRESSIONS) { + throw new Error(`Template contains too many expressions (max ${MAX_TEMPLATE_EXPRESSIONS})`); + } + const expr = template.slice(i + 1, end); + const operator = this.getOperator(expr); + const exploded = expr.includes('*'); + const names = this.getNames(expr); + const name = names[0]; + // Validate variable name length + for (const name of names) { + UriTemplate.validateLength(name, MAX_VARIABLE_LENGTH, 'Variable name'); + } + parts.push({ name, operator, names, exploded }); + i = end + 1; + } + else { + currentText += template[i]; + i++; + } + } + if (currentText) { + parts.push(currentText); + } + return parts; + } + getOperator(expr) { + const operators = ['+', '#', '.', '/', '?', '&']; + return operators.find(op => expr.startsWith(op)) || ''; + } + getNames(expr) { + const operator = this.getOperator(expr); + return expr + .slice(operator.length) + .split(',') + .map(name => name.replace('*', '').trim()) + .filter(name => name.length > 0); + } + encodeValue(value, operator) { + UriTemplate.validateLength(value, MAX_VARIABLE_LENGTH, 'Variable value'); + if (operator === '+' || operator === '#') { + return encodeURI(value); + } + return encodeURIComponent(value); + } + expandPart(part, variables) { + if (part.operator === '?' || part.operator === '&') { + const pairs = part.names + .map(name => { + const value = variables[name]; + if (value === undefined) + return ''; + const encoded = Array.isArray(value) + ? value.map(v => this.encodeValue(v, part.operator)).join(',') + : this.encodeValue(value.toString(), part.operator); + return `${name}=${encoded}`; + }) + .filter(pair => pair.length > 0); + if (pairs.length === 0) + return ''; + const separator = part.operator === '?' ? '?' : '&'; + return separator + pairs.join('&'); + } + if (part.names.length > 1) { + const values = part.names.map(name => variables[name]).filter(v => v !== undefined); + if (values.length === 0) + return ''; + return values.map(v => (Array.isArray(v) ? v[0] : v)).join(','); + } + const value = variables[part.name]; + if (value === undefined) + return ''; + const values = Array.isArray(value) ? value : [value]; + const encoded = values.map(v => this.encodeValue(v, part.operator)); + switch (part.operator) { + case '': + return encoded.join(','); + case '+': + return encoded.join(','); + case '#': + return '#' + encoded.join(','); + case '.': + return '.' + encoded.join('.'); + case '/': + return '/' + encoded.join('/'); + default: + return encoded.join(','); + } + } + expand(variables) { + let result = ''; + let hasQueryParam = false; + for (const part of this.parts) { + if (typeof part === 'string') { + result += part; + continue; + } + const expanded = this.expandPart(part, variables); + if (!expanded) + continue; + // Convert ? to & if we already have a query parameter + if ((part.operator === '?' || part.operator === '&') && hasQueryParam) { + result += expanded.replace('?', '&'); + } + else { + result += expanded; + } + if (part.operator === '?' || part.operator === '&') { + hasQueryParam = true; + } + } + return result; + } + escapeRegExp(str) { + return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); + } + partToRegExp(part) { + const patterns = []; + // Validate variable name length for matching + for (const name of part.names) { + UriTemplate.validateLength(name, MAX_VARIABLE_LENGTH, 'Variable name'); + } + if (part.operator === '?' || part.operator === '&') { + for (let i = 0; i < part.names.length; i++) { + const name = part.names[i]; + const prefix = i === 0 ? '\\' + part.operator : '&'; + patterns.push({ + pattern: prefix + this.escapeRegExp(name) + '=([^&]+)', + name + }); + } + return patterns; + } + let pattern; + const name = part.name; + switch (part.operator) { + case '': + pattern = part.exploded ? '([^/,]+(?:,[^/,]+)*)' : '([^/,]+)'; + break; + case '+': + case '#': + pattern = '(.+)'; + break; + case '.': + pattern = '\\.([^/,]+)'; + break; + case '/': + pattern = '/' + (part.exploded ? '([^/,]+(?:,[^/,]+)*)' : '([^/,]+)'); + break; + default: + pattern = '([^/]+)'; + } + patterns.push({ pattern, name }); + return patterns; + } + match(uri) { + UriTemplate.validateLength(uri, MAX_TEMPLATE_LENGTH, 'URI'); + let pattern = '^'; + const names = []; + for (const part of this.parts) { + if (typeof part === 'string') { + pattern += this.escapeRegExp(part); + } + else { + const patterns = this.partToRegExp(part); + for (const { pattern: partPattern, name } of patterns) { + pattern += partPattern; + names.push({ name, exploded: part.exploded }); + } + } + } + pattern += '$'; + UriTemplate.validateLength(pattern, MAX_REGEX_LENGTH, 'Generated regex pattern'); + const regex = new RegExp(pattern); + const match = uri.match(regex); + if (!match) + return null; + const result = {}; + for (let i = 0; i < names.length; i++) { + const { name, exploded } = names[i]; + const value = match[i + 1]; + const cleanName = name.replace('*', ''); + if (exploded && value.includes(',')) { + result[cleanName] = value.split(','); + } + else { + result[cleanName] = value; + } + } + return result; + } +} +//# sourceMappingURL=uriTemplate.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.js.map new file mode 100644 index 0000000000000000000000000000000000000000..d47e01ba8d2c544e6ed95e858ec792f96b5dd677 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/uriTemplate.js.map @@ -0,0 +1 @@ +{"version":3,"file":"uriTemplate.js","sourceRoot":"","sources":["../../../src/shared/uriTemplate.ts"],"names":[],"mappings":"AAAA,2DAA2D;AAI3D,MAAM,mBAAmB,GAAG,OAAO,CAAC,CAAC,MAAM;AAC3C,MAAM,mBAAmB,GAAG,OAAO,CAAC,CAAC,MAAM;AAC3C,MAAM,wBAAwB,GAAG,KAAK,CAAC;AACvC,MAAM,gBAAgB,GAAG,OAAO,CAAC,CAAC,MAAM;AAExC,MAAM,OAAO,WAAW;IACpB;;;;OAIG;IACH,MAAM,CAAC,UAAU,CAAC,GAAW;QACzB,2DAA2D;QAC3D,6BAA6B;QAC7B,OAAO,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnC,CAAC;IAEO,MAAM,CAAC,cAAc,CAAC,GAAW,EAAE,GAAW,EAAE,OAAe;QACnE,IAAI,GAAG,CAAC,MAAM,GAAG,GAAG,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,GAAG,OAAO,8BAA8B,GAAG,oBAAoB,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;QAClG,CAAC;IACL,CAAC;IAID,IAAI,aAAa;QACb,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAA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AAC;QAED,OAAO,IAAI,GAAG,CAAC;QACf,WAAW,CAAC,cAAc,CAAC,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,CAAC,CAAC;QACjF,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;QAClC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAE/B,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC;QAExB,MAAM,MAAM,GAAc,EAAE,CAAC;QAC7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACpC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACpC,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YAC3B,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YAExC,IAAI,QAAQ,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;gBAClC,MAAM,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YACzC,CAAC;iBAAM,CAAC;gBACJ,MAAM,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC;YAC9B,CAAC;QACL,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/spec.types.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/spec.types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..486a755682e67f5f67fd993125f4b44a4d1a0d21 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/spec.types.d.ts @@ -0,0 +1,2311 @@ +/** + * This file is automatically generated from the Model Context Protocol specification. + * + * Source: https://github.com/modelcontextprotocol/modelcontextprotocol + * Pulled from: https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/main/schema/draft/schema.ts + * Last updated from commit: 35fa160caf287a9c48696e3ae452c0645c713669 + * + * DO NOT EDIT THIS FILE MANUALLY. Changes will be overwritten by automated updates. + * To update this file, run: npm run fetch:spec-types + */ +/** + * Refers to any valid JSON-RPC object that can be decoded off the wire, or encoded to be sent. + * + * @category JSON-RPC + */ +export type JSONRPCMessage = JSONRPCRequest | JSONRPCNotification | JSONRPCResponse; +/** @internal */ +export declare const LATEST_PROTOCOL_VERSION = "DRAFT-2026-v1"; +/** @internal */ +export declare const JSONRPC_VERSION = "2.0"; +/** + * A progress token, used to associate progress notifications with the original request. + * + * @category Common Types + */ +export type ProgressToken = string | number; +/** + * An opaque token used to represent a cursor for pagination. + * + * @category Common Types + */ +export type Cursor = string; +/** + * Common params for any task-augmented request. + * + * @internal + */ +export interface TaskAugmentedRequestParams extends RequestParams { + /** + * If specified, the caller is requesting task-augmented execution for this request. + * The request will return a CreateTaskResult immediately, and the actual result can be + * retrieved later via tasks/result. + * + * Task augmentation is subject to capability negotiation - receivers MUST declare support + * for task augmentation of specific request types in their capabilities. + */ + task?: TaskMetadata; +} +/** + * Common params for any request. + * + * @internal + */ +export interface RequestParams { + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { + /** + * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications. + */ + progressToken?: ProgressToken; + [key: string]: unknown; + }; +} +/** @internal */ +export interface Request { + method: string; + params?: { + [key: string]: any; + }; +} +/** @internal */ +export interface NotificationParams { + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { + [key: string]: unknown; + }; +} +/** @internal */ +export interface Notification { + method: string; + params?: { + [key: string]: any; + }; +} +/** + * @category Common Types + */ +export interface Result { + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { + [key: string]: unknown; + }; + [key: string]: unknown; +} +/** + * @category Common Types + */ +export interface Error { + /** + * The error type that occurred. + */ + code: number; + /** + * A short description of the error. The message SHOULD be limited to a concise single sentence. + */ + message: string; + /** + * Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.). + */ + data?: unknown; +} +/** + * A uniquely identifying ID for a request in JSON-RPC. + * + * @category Common Types + */ +export type RequestId = string | number; +/** + * A request that expects a response. + * + * @category JSON-RPC + */ +export interface JSONRPCRequest extends Request { + jsonrpc: typeof JSONRPC_VERSION; + id: RequestId; +} +/** + * A notification which does not expect a response. + * + * @category JSON-RPC + */ +export interface JSONRPCNotification extends Notification { + jsonrpc: typeof JSONRPC_VERSION; +} +/** + * A successful (non-error) response to a request. + * + * @category JSON-RPC + */ +export interface JSONRPCResultResponse { + jsonrpc: typeof JSONRPC_VERSION; + id: RequestId; + result: Result; +} +/** + * A response to a request that indicates an error occurred. + * + * @category JSON-RPC + */ +export interface JSONRPCErrorResponse { + jsonrpc: typeof JSONRPC_VERSION; + id?: RequestId; + error: Error; +} +/** + * A response to a request, containing either the result or error. + */ +export type JSONRPCResponse = JSONRPCResultResponse | JSONRPCErrorResponse; +export declare const PARSE_ERROR = -32700; +export declare const INVALID_REQUEST = -32600; +export declare const METHOD_NOT_FOUND = -32601; +export declare const INVALID_PARAMS = -32602; +export declare const INTERNAL_ERROR = -32603; +/** @internal */ +export declare const URL_ELICITATION_REQUIRED = -32042; +/** + * An error response that indicates that the server requires the client to provide additional information via an elicitation request. + * + * @internal + */ +export interface URLElicitationRequiredError extends Omit { + error: Error & { + code: typeof URL_ELICITATION_REQUIRED; + data: { + elicitations: ElicitRequestURLParams[]; + [key: string]: unknown; + }; + }; +} +/** + * A response that indicates success but carries no data. + * + * @category Common Types + */ +export type EmptyResult = Result; +/** + * Parameters for a `notifications/cancelled` notification. + * + * @category `notifications/cancelled` + */ +export interface CancelledNotificationParams extends NotificationParams { + /** + * The ID of the request to cancel. + * + * This MUST correspond to the ID of a request previously issued in the same direction. + * This MUST be provided for cancelling non-task requests. + * This MUST NOT be used for cancelling tasks (use the `tasks/cancel` request instead). + */ + requestId?: RequestId; + /** + * An optional string describing the reason for the cancellation. This MAY be logged or presented to the user. + */ + reason?: string; +} +/** + * This notification can be sent by either side to indicate that it is cancelling a previously-issued request. + * + * The request SHOULD still be in-flight, but due to communication latency, it is always possible that this notification MAY arrive after the request has already finished. + * + * This notification indicates that the result will be unused, so any associated processing SHOULD cease. + * + * A client MUST NOT attempt to cancel its `initialize` request. + * + * For task cancellation, use the `tasks/cancel` request instead of this notification. + * + * @category `notifications/cancelled` + */ +export interface CancelledNotification extends JSONRPCNotification { + method: "notifications/cancelled"; + params: CancelledNotificationParams; +} +/** + * Parameters for an `initialize` request. + * + * @category `initialize` + */ +export interface InitializeRequestParams extends RequestParams { + /** + * The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well. + */ + protocolVersion: string; + capabilities: ClientCapabilities; + clientInfo: Implementation; +} +/** + * This request is sent from the client to the server when it first connects, asking it to begin initialization. + * + * @category `initialize` + */ +export interface InitializeRequest extends JSONRPCRequest { + method: "initialize"; + params: InitializeRequestParams; +} +/** + * After receiving an initialize request from the client, the server sends this response. + * + * @category `initialize` + */ +export interface InitializeResult extends Result { + /** + * The version of the Model Context Protocol that the server wants to use. This may not match the version that the client requested. If the client cannot support this version, it MUST disconnect. + */ + protocolVersion: string; + capabilities: ServerCapabilities; + serverInfo: Implementation; + /** + * Instructions describing how to use the server and its features. + * + * This can be used by clients to improve the LLM's understanding of available tools, resources, etc. It can be thought of like a "hint" to the model. For example, this information MAY be added to the system prompt. + */ + instructions?: string; +} +/** + * This notification is sent from the client to the server after initialization has finished. + * + * @category `notifications/initialized` + */ +export interface InitializedNotification extends JSONRPCNotification { + method: "notifications/initialized"; + params?: NotificationParams; +} +/** + * Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities. + * + * @category `initialize` + */ +export interface ClientCapabilities { + /** + * Experimental, non-standard capabilities that the client supports. + */ + experimental?: { + [key: string]: object; + }; + /** + * Present if the client supports listing roots. + */ + roots?: { + /** + * Whether the client supports notifications for changes to the roots list. + */ + listChanged?: boolean; + }; + /** + * Present if the client supports sampling from an LLM. + */ + sampling?: { + /** + * Whether the client supports context inclusion via includeContext parameter. + * If not declared, servers SHOULD only use `includeContext: "none"` (or omit it). + */ + context?: object; + /** + * Whether the client supports tool use via tools and toolChoice parameters. + */ + tools?: object; + }; + /** + * Present if the client supports elicitation from the server. + */ + elicitation?: { + form?: object; + url?: object; + }; + /** + * Present if the client supports task-augmented requests. + */ + tasks?: { + /** + * Whether this client supports tasks/list. + */ + list?: object; + /** + * Whether this client supports tasks/cancel. + */ + cancel?: object; + /** + * Specifies which request types can be augmented with tasks. + */ + requests?: { + /** + * Task support for sampling-related requests. + */ + sampling?: { + /** + * Whether the client supports task-augmented sampling/createMessage requests. + */ + createMessage?: object; + }; + /** + * Task support for elicitation-related requests. + */ + elicitation?: { + /** + * Whether the client supports task-augmented elicitation/create requests. + */ + create?: object; + }; + }; + }; + /** + * Extensions that the client supports. Keys are extension identifiers (vendor-prefix/extension-name). + */ + extensions?: { + [key: string]: object; + }; +} +/** + * Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities. + * + * @category `initialize` + */ +export interface ServerCapabilities { + /** + * Experimental, non-standard capabilities that the server supports. + */ + experimental?: { + [key: string]: object; + }; + /** + * Present if the server supports sending log messages to the client. + */ + logging?: object; + /** + * Present if the server supports argument autocompletion suggestions. + */ + completions?: object; + /** + * Present if the server offers any prompt templates. + */ + prompts?: { + /** + * Whether this server supports notifications for changes to the prompt list. + */ + listChanged?: boolean; + }; + /** + * Present if the server offers any resources to read. + */ + resources?: { + /** + * Whether this server supports subscribing to resource updates. + */ + subscribe?: boolean; + /** + * Whether this server supports notifications for changes to the resource list. + */ + listChanged?: boolean; + }; + /** + * Present if the server offers any tools to call. + */ + tools?: { + /** + * Whether this server supports notifications for changes to the tool list. + */ + listChanged?: boolean; + }; + /** + * Present if the server supports task-augmented requests. + */ + tasks?: { + /** + * Whether this server supports tasks/list. + */ + list?: object; + /** + * Whether this server supports tasks/cancel. + */ + cancel?: object; + /** + * Specifies which request types can be augmented with tasks. + */ + requests?: { + /** + * Task support for tool-related requests. + */ + tools?: { + /** + * Whether the server supports task-augmented tools/call requests. + */ + call?: object; + }; + }; + }; + /** + * Extensions that the server supports. Keys are extension identifiers (vendor-prefix/extension-name). + */ + extensions?: { + [key: string]: object; + }; +} +/** + * An optionally-sized icon that can be displayed in a user interface. + * + * @category Common Types + */ +export interface Icon { + /** + * A standard URI pointing to an icon resource. May be an HTTP/HTTPS URL or a + * `data:` URI with Base64-encoded image data. + * + * Consumers SHOULD takes steps to ensure URLs serving icons are from the + * same domain as the client/server or a trusted domain. + * + * Consumers SHOULD take appropriate precautions when consuming SVGs as they can contain + * executable JavaScript. + * + * @format uri + */ + src: string; + /** + * Optional MIME type override if the source MIME type is missing or generic. + * For example: `"image/png"`, `"image/jpeg"`, or `"image/svg+xml"`. + */ + mimeType?: string; + /** + * Optional array of strings that specify sizes at which the icon can be used. + * Each string should be in WxH format (e.g., `"48x48"`, `"96x96"`) or `"any"` for scalable formats like SVG. + * + * If not provided, the client should assume that the icon can be used at any size. + */ + sizes?: string[]; + /** + * Optional specifier for the theme this icon is designed for. `light` indicates + * the icon is designed to be used with a light background, and `dark` indicates + * the icon is designed to be used with a dark background. + * + * If not provided, the client should assume the icon can be used with any theme. + */ + theme?: "light" | "dark"; +} +/** + * Base interface to add `icons` property. + * + * @internal + */ +export interface Icons { + /** + * Optional set of sized icons that the client can display in a user interface. + * + * Clients that support rendering icons MUST support at least the following MIME types: + * - `image/png` - PNG images (safe, universal compatibility) + * - `image/jpeg` (and `image/jpg`) - JPEG images (safe, universal compatibility) + * + * Clients that support rendering icons SHOULD also support: + * - `image/svg+xml` - SVG images (scalable but requires security precautions) + * - `image/webp` - WebP images (modern, efficient format) + */ + icons?: Icon[]; +} +/** + * Base interface for metadata with name (identifier) and title (display name) properties. + * + * @internal + */ +export interface BaseMetadata { + /** + * Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn't present). + */ + name: string; + /** + * Intended for UI and end-user contexts — optimized to be human-readable and easily understood, + * even by those unfamiliar with domain-specific terminology. + * + * If not provided, the name should be used for display (except for Tool, + * where `annotations.title` should be given precedence over using `name`, + * if present). + */ + title?: string; +} +/** + * Describes the MCP implementation. + * + * @category `initialize` + */ +export interface Implementation extends BaseMetadata, Icons { + version: string; + /** + * An optional human-readable description of what this implementation does. + * + * This can be used by clients or servers to provide context about their purpose + * and capabilities. For example, a server might describe the types of resources + * or tools it provides, while a client might describe its intended use case. + */ + description?: string; + /** + * An optional URL of the website for this implementation. + * + * @format uri + */ + websiteUrl?: string; +} +/** + * A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected. + * + * @category `ping` + */ +export interface PingRequest extends JSONRPCRequest { + method: "ping"; + params?: RequestParams; +} +/** + * Parameters for a `notifications/progress` notification. + * + * @category `notifications/progress` + */ +export interface ProgressNotificationParams extends NotificationParams { + /** + * The progress token which was given in the initial request, used to associate this notification with the request that is proceeding. + */ + progressToken: ProgressToken; + /** + * The progress thus far. This should increase every time progress is made, even if the total is unknown. + * + * @TJS-type number + */ + progress: number; + /** + * Total number of items to process (or total progress required), if known. + * + * @TJS-type number + */ + total?: number; + /** + * An optional message describing the current progress. + */ + message?: string; +} +/** + * An out-of-band notification used to inform the receiver of a progress update for a long-running request. + * + * @category `notifications/progress` + */ +export interface ProgressNotification extends JSONRPCNotification { + method: "notifications/progress"; + params: ProgressNotificationParams; +} +/** + * Common parameters for paginated requests. + * + * @internal + */ +export interface PaginatedRequestParams extends RequestParams { + /** + * An opaque token representing the current pagination position. + * If provided, the server should return results starting after this cursor. + */ + cursor?: Cursor; +} +/** @internal */ +export interface PaginatedRequest extends JSONRPCRequest { + params?: PaginatedRequestParams; +} +/** @internal */ +export interface PaginatedResult extends Result { + /** + * An opaque token representing the pagination position after the last returned result. + * If present, there may be more results available. + */ + nextCursor?: Cursor; +} +/** + * Sent from the client to request a list of resources the server has. + * + * @category `resources/list` + */ +export interface ListResourcesRequest extends PaginatedRequest { + method: "resources/list"; +} +/** + * The server's response to a resources/list request from the client. + * + * @category `resources/list` + */ +export interface ListResourcesResult extends PaginatedResult { + resources: Resource[]; +} +/** + * Sent from the client to request a list of resource templates the server has. + * + * @category `resources/templates/list` + */ +export interface ListResourceTemplatesRequest extends PaginatedRequest { + method: "resources/templates/list"; +} +/** + * The server's response to a resources/templates/list request from the client. + * + * @category `resources/templates/list` + */ +export interface ListResourceTemplatesResult extends PaginatedResult { + resourceTemplates: ResourceTemplate[]; +} +/** + * Common parameters when working with resources. + * + * @internal + */ +export interface ResourceRequestParams extends RequestParams { + /** + * The URI of the resource. The URI can use any protocol; it is up to the server how to interpret it. + * + * @format uri + */ + uri: string; +} +/** + * Parameters for a `resources/read` request. + * + * @category `resources/read` + */ +export interface ReadResourceRequestParams extends ResourceRequestParams { +} +/** + * Sent from the client to the server, to read a specific resource URI. + * + * @category `resources/read` + */ +export interface ReadResourceRequest extends JSONRPCRequest { + method: "resources/read"; + params: ReadResourceRequestParams; +} +/** + * The server's response to a resources/read request from the client. + * + * @category `resources/read` + */ +export interface ReadResourceResult extends Result { + contents: (TextResourceContents | BlobResourceContents)[]; +} +/** + * An optional notification from the server to the client, informing it that the list of resources it can read from has changed. This may be issued by servers without any previous subscription from the client. + * + * @category `notifications/resources/list_changed` + */ +export interface ResourceListChangedNotification extends JSONRPCNotification { + method: "notifications/resources/list_changed"; + params?: NotificationParams; +} +/** + * Parameters for a `resources/subscribe` request. + * + * @category `resources/subscribe` + */ +export interface SubscribeRequestParams extends ResourceRequestParams { +} +/** + * Sent from the client to request resources/updated notifications from the server whenever a particular resource changes. + * + * @category `resources/subscribe` + */ +export interface SubscribeRequest extends JSONRPCRequest { + method: "resources/subscribe"; + params: SubscribeRequestParams; +} +/** + * Parameters for a `resources/unsubscribe` request. + * + * @category `resources/unsubscribe` + */ +export interface UnsubscribeRequestParams extends ResourceRequestParams { +} +/** + * Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request. + * + * @category `resources/unsubscribe` + */ +export interface UnsubscribeRequest extends JSONRPCRequest { + method: "resources/unsubscribe"; + params: UnsubscribeRequestParams; +} +/** + * Parameters for a `notifications/resources/updated` notification. + * + * @category `notifications/resources/updated` + */ +export interface ResourceUpdatedNotificationParams extends NotificationParams { + /** + * The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to. + * + * @format uri + */ + uri: string; +} +/** + * A notification from the server to the client, informing it that a resource has changed and may need to be read again. This should only be sent if the client previously sent a resources/subscribe request. + * + * @category `notifications/resources/updated` + */ +export interface ResourceUpdatedNotification extends JSONRPCNotification { + method: "notifications/resources/updated"; + params: ResourceUpdatedNotificationParams; +} +/** + * A known resource that the server is capable of reading. + * + * @category `resources/list` + */ +export interface Resource extends BaseMetadata, Icons { + /** + * The URI of this resource. + * + * @format uri + */ + uri: string; + /** + * A description of what this resource represents. + * + * This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model. + */ + description?: string; + /** + * The MIME type of this resource, if known. + */ + mimeType?: string; + /** + * Optional annotations for the client. + */ + annotations?: Annotations; + /** + * The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known. + * + * This can be used by Hosts to display file sizes and estimate context window usage. + */ + size?: number; + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { + [key: string]: unknown; + }; +} +/** + * A template description for resources available on the server. + * + * @category `resources/templates/list` + */ +export interface ResourceTemplate extends BaseMetadata, Icons { + /** + * A URI template (according to RFC 6570) that can be used to construct resource URIs. + * + * @format uri-template + */ + uriTemplate: string; + /** + * A description of what this template is for. + * + * This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model. + */ + description?: string; + /** + * The MIME type for all resources that match this template. This should only be included if all resources matching this template have the same type. + */ + mimeType?: string; + /** + * Optional annotations for the client. + */ + annotations?: Annotations; + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { + [key: string]: unknown; + }; +} +/** + * The contents of a specific resource or sub-resource. + * + * @internal + */ +export interface ResourceContents { + /** + * The URI of this resource. + * + * @format uri + */ + uri: string; + /** + * The MIME type of this resource, if known. + */ + mimeType?: string; + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { + [key: string]: unknown; + }; +} +/** + * @category Content + */ +export interface TextResourceContents extends ResourceContents { + /** + * The text of the item. This must only be set if the item can actually be represented as text (not binary data). + */ + text: string; +} +/** + * @category Content + */ +export interface BlobResourceContents extends ResourceContents { + /** + * A base64-encoded string representing the binary data of the item. + * + * @format byte + */ + blob: string; +} +/** + * Sent from the client to request a list of prompts and prompt templates the server has. + * + * @category `prompts/list` + */ +export interface ListPromptsRequest extends PaginatedRequest { + method: "prompts/list"; +} +/** + * The server's response to a prompts/list request from the client. + * + * @category `prompts/list` + */ +export interface ListPromptsResult extends PaginatedResult { + prompts: Prompt[]; +} +/** + * Parameters for a `prompts/get` request. + * + * @category `prompts/get` + */ +export interface GetPromptRequestParams extends RequestParams { + /** + * The name of the prompt or prompt template. + */ + name: string; + /** + * Arguments to use for templating the prompt. + */ + arguments?: { + [key: string]: string; + }; +} +/** + * Used by the client to get a prompt provided by the server. + * + * @category `prompts/get` + */ +export interface GetPromptRequest extends JSONRPCRequest { + method: "prompts/get"; + params: GetPromptRequestParams; +} +/** + * The server's response to a prompts/get request from the client. + * + * @category `prompts/get` + */ +export interface GetPromptResult extends Result { + /** + * An optional description for the prompt. + */ + description?: string; + messages: PromptMessage[]; +} +/** + * A prompt or prompt template that the server offers. + * + * @category `prompts/list` + */ +export interface Prompt extends BaseMetadata, Icons { + /** + * An optional description of what this prompt provides + */ + description?: string; + /** + * A list of arguments to use for templating the prompt. + */ + arguments?: PromptArgument[]; + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { + [key: string]: unknown; + }; +} +/** + * Describes an argument that a prompt can accept. + * + * @category `prompts/list` + */ +export interface PromptArgument extends BaseMetadata { + /** + * A human-readable description of the argument. + */ + description?: string; + /** + * Whether this argument must be provided. + */ + required?: boolean; +} +/** + * The sender or recipient of messages and data in a conversation. + * + * @category Common Types + */ +export type Role = "user" | "assistant"; +/** + * Describes a message returned as part of a prompt. + * + * This is similar to `SamplingMessage`, but also supports the embedding of + * resources from the MCP server. + * + * @category `prompts/get` + */ +export interface PromptMessage { + role: Role; + content: ContentBlock; +} +/** + * A resource that the server is capable of reading, included in a prompt or tool call result. + * + * Note: resource links returned by tools are not guaranteed to appear in the results of `resources/list` requests. + * + * @category Content + */ +export interface ResourceLink extends Resource { + type: "resource_link"; +} +/** + * The contents of a resource, embedded into a prompt or tool call result. + * + * It is up to the client how best to render embedded resources for the benefit + * of the LLM and/or the user. + * + * @category Content + */ +export interface EmbeddedResource { + type: "resource"; + resource: TextResourceContents | BlobResourceContents; + /** + * Optional annotations for the client. + */ + annotations?: Annotations; + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { + [key: string]: unknown; + }; +} +/** + * An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client. + * + * @category `notifications/prompts/list_changed` + */ +export interface PromptListChangedNotification extends JSONRPCNotification { + method: "notifications/prompts/list_changed"; + params?: NotificationParams; +} +/** + * Sent from the client to request a list of tools the server has. + * + * @category `tools/list` + */ +export interface ListToolsRequest extends PaginatedRequest { + method: "tools/list"; +} +/** + * The server's response to a tools/list request from the client. + * + * @category `tools/list` + */ +export interface ListToolsResult extends PaginatedResult { + tools: Tool[]; +} +/** + * The server's response to a tool call. + * + * @category `tools/call` + */ +export interface CallToolResult extends Result { + /** + * A list of content objects that represent the unstructured result of the tool call. + */ + content: ContentBlock[]; + /** + * An optional JSON object that represents the structured result of the tool call. + */ + structuredContent?: { + [key: string]: unknown; + }; + /** + * Whether the tool call ended in an error. + * + * If not set, this is assumed to be false (the call was successful). + * + * Any errors that originate from the tool SHOULD be reported inside the result + * object, with `isError` set to true, _not_ as an MCP protocol-level error + * response. Otherwise, the LLM would not be able to see that an error occurred + * and self-correct. + * + * However, any errors in _finding_ the tool, an error indicating that the + * server does not support tool calls, or any other exceptional conditions, + * should be reported as an MCP error response. + */ + isError?: boolean; +} +/** + * Parameters for a `tools/call` request. + * + * @category `tools/call` + */ +export interface CallToolRequestParams extends TaskAugmentedRequestParams { + /** + * The name of the tool. + */ + name: string; + /** + * Arguments to use for the tool call. + */ + arguments?: { + [key: string]: unknown; + }; +} +/** + * Used by the client to invoke a tool provided by the server. + * + * @category `tools/call` + */ +export interface CallToolRequest extends JSONRPCRequest { + method: "tools/call"; + params: CallToolRequestParams; +} +/** + * An optional notification from the server to the client, informing it that the list of tools it offers has changed. This may be issued by servers without any previous subscription from the client. + * + * @category `notifications/tools/list_changed` + */ +export interface ToolListChangedNotification extends JSONRPCNotification { + method: "notifications/tools/list_changed"; + params?: NotificationParams; +} +/** + * Additional properties describing a Tool to clients. + * + * NOTE: all properties in ToolAnnotations are **hints**. + * They are not guaranteed to provide a faithful description of + * tool behavior (including descriptive properties like `title`). + * + * Clients should never make tool use decisions based on ToolAnnotations + * received from untrusted servers. + * + * @category `tools/list` + */ +export interface ToolAnnotations { + /** + * A human-readable title for the tool. + */ + title?: string; + /** + * If true, the tool does not modify its environment. + * + * Default: false + */ + readOnlyHint?: boolean; + /** + * If true, the tool may perform destructive updates to its environment. + * If false, the tool performs only additive updates. + * + * (This property is meaningful only when `readOnlyHint == false`) + * + * Default: true + */ + destructiveHint?: boolean; + /** + * If true, calling the tool repeatedly with the same arguments + * will have no additional effect on its environment. + * + * (This property is meaningful only when `readOnlyHint == false`) + * + * Default: false + */ + idempotentHint?: boolean; + /** + * If true, this tool may interact with an "open world" of external + * entities. If false, the tool's domain of interaction is closed. + * For example, the world of a web search tool is open, whereas that + * of a memory tool is not. + * + * Default: true + */ + openWorldHint?: boolean; +} +/** + * Execution-related properties for a tool. + * + * @category `tools/list` + */ +export interface ToolExecution { + /** + * Indicates whether this tool supports task-augmented execution. + * This allows clients to handle long-running operations through polling + * the task system. + * + * - "forbidden": Tool does not support task-augmented execution (default when absent) + * - "optional": Tool may support task-augmented execution + * - "required": Tool requires task-augmented execution + * + * Default: "forbidden" + */ + taskSupport?: "forbidden" | "optional" | "required"; +} +/** + * Definition for a tool the client can call. + * + * @category `tools/list` + */ +export interface Tool extends BaseMetadata, Icons { + /** + * A human-readable description of the tool. + * + * This can be used by clients to improve the LLM's understanding of available tools. It can be thought of like a "hint" to the model. + */ + description?: string; + /** + * A JSON Schema object defining the expected parameters for the tool. + */ + inputSchema: { + $schema?: string; + type: "object"; + properties?: { + [key: string]: object; + }; + required?: string[]; + }; + /** + * Execution-related properties for this tool. + */ + execution?: ToolExecution; + /** + * An optional JSON Schema object defining the structure of the tool's output returned in + * the structuredContent field of a CallToolResult. + * + * Defaults to JSON Schema 2020-12 when no explicit $schema is provided. + * Currently restricted to type: "object" at the root level. + */ + outputSchema?: { + $schema?: string; + type: "object"; + properties?: { + [key: string]: object; + }; + required?: string[]; + }; + /** + * Optional additional tool information. + * + * Display name precedence order is: title, annotations.title, then name. + */ + annotations?: ToolAnnotations; + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { + [key: string]: unknown; + }; +} +/** + * The status of a task. + * + * @category `tasks` + */ +export type TaskStatus = "working" | "input_required" | "completed" | "failed" | "cancelled"; +/** + * Metadata for augmenting a request with task execution. + * Include this in the `task` field of the request parameters. + * + * @category `tasks` + */ +export interface TaskMetadata { + /** + * Requested duration in milliseconds to retain task from creation. + */ + ttl?: number; +} +/** + * Metadata for associating messages with a task. + * Include this in the `_meta` field under the key `io.modelcontextprotocol/related-task`. + * + * @category `tasks` + */ +export interface RelatedTaskMetadata { + /** + * The task identifier this message is associated with. + */ + taskId: string; +} +/** + * Data associated with a task. + * + * @category `tasks` + */ +export interface Task { + /** + * The task identifier. + */ + taskId: string; + /** + * Current task state. + */ + status: TaskStatus; + /** + * Optional human-readable message describing the current task state. + * This can provide context for any status, including: + * - Reasons for "cancelled" status + * - Summaries for "completed" status + * - Diagnostic information for "failed" status (e.g., error details, what went wrong) + */ + statusMessage?: string; + /** + * ISO 8601 timestamp when the task was created. + */ + createdAt: string; + /** + * ISO 8601 timestamp when the task was last updated. + */ + lastUpdatedAt: string; + /** + * Actual retention duration from creation in milliseconds, null for unlimited. + */ + ttl: number | null; + /** + * Suggested polling interval in milliseconds. + */ + pollInterval?: number; +} +/** + * A response to a task-augmented request. + * + * @category `tasks` + */ +export interface CreateTaskResult extends Result { + task: Task; +} +/** + * A request to retrieve the state of a task. + * + * @category `tasks/get` + */ +export interface GetTaskRequest extends JSONRPCRequest { + method: "tasks/get"; + params: { + /** + * The task identifier to query. + */ + taskId: string; + }; +} +/** + * The response to a tasks/get request. + * + * @category `tasks/get` + */ +export type GetTaskResult = Result & Task; +/** + * A request to retrieve the result of a completed task. + * + * @category `tasks/result` + */ +export interface GetTaskPayloadRequest extends JSONRPCRequest { + method: "tasks/result"; + params: { + /** + * The task identifier to retrieve results for. + */ + taskId: string; + }; +} +/** + * The response to a tasks/result request. + * The structure matches the result type of the original request. + * For example, a tools/call task would return the CallToolResult structure. + * + * @category `tasks/result` + */ +export interface GetTaskPayloadResult extends Result { + [key: string]: unknown; +} +/** + * A request to cancel a task. + * + * @category `tasks/cancel` + */ +export interface CancelTaskRequest extends JSONRPCRequest { + method: "tasks/cancel"; + params: { + /** + * The task identifier to cancel. + */ + taskId: string; + }; +} +/** + * The response to a tasks/cancel request. + * + * @category `tasks/cancel` + */ +export type CancelTaskResult = Result & Task; +/** + * A request to retrieve a list of tasks. + * + * @category `tasks/list` + */ +export interface ListTasksRequest extends PaginatedRequest { + method: "tasks/list"; +} +/** + * The response to a tasks/list request. + * + * @category `tasks/list` + */ +export interface ListTasksResult extends PaginatedResult { + tasks: Task[]; +} +/** + * Parameters for a `notifications/tasks/status` notification. + * + * @category `notifications/tasks/status` + */ +export type TaskStatusNotificationParams = NotificationParams & Task; +/** + * An optional notification from the receiver to the requestor, informing them that a task's status has changed. Receivers are not required to send these notifications. + * + * @category `notifications/tasks/status` + */ +export interface TaskStatusNotification extends JSONRPCNotification { + method: "notifications/tasks/status"; + params: TaskStatusNotificationParams; +} +/** + * Parameters for a `logging/setLevel` request. + * + * @category `logging/setLevel` + */ +export interface SetLevelRequestParams extends RequestParams { + /** + * The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/message. + */ + level: LoggingLevel; +} +/** + * A request from the client to the server, to enable or adjust logging. + * + * @category `logging/setLevel` + */ +export interface SetLevelRequest extends JSONRPCRequest { + method: "logging/setLevel"; + params: SetLevelRequestParams; +} +/** + * Parameters for a `notifications/message` notification. + * + * @category `notifications/message` + */ +export interface LoggingMessageNotificationParams extends NotificationParams { + /** + * The severity of this log message. + */ + level: LoggingLevel; + /** + * An optional name of the logger issuing this message. + */ + logger?: string; + /** + * The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here. + */ + data: unknown; +} +/** + * JSONRPCNotification of a log message passed from server to client. If no logging/setLevel request has been sent from the client, the server MAY decide which messages to send automatically. + * + * @category `notifications/message` + */ +export interface LoggingMessageNotification extends JSONRPCNotification { + method: "notifications/message"; + params: LoggingMessageNotificationParams; +} +/** + * The severity of a log message. + * + * These map to syslog message severities, as specified in RFC-5424: + * https://datatracker.ietf.org/doc/html/rfc5424#section-6.2.1 + * + * @category Common Types + */ +export type LoggingLevel = "debug" | "info" | "notice" | "warning" | "error" | "critical" | "alert" | "emergency"; +/** + * Parameters for a `sampling/createMessage` request. + * + * @category `sampling/createMessage` + */ +export interface CreateMessageRequestParams extends TaskAugmentedRequestParams { + messages: SamplingMessage[]; + /** + * The server's preferences for which model to select. The client MAY ignore these preferences. + */ + modelPreferences?: ModelPreferences; + /** + * An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt. + */ + systemPrompt?: string; + /** + * A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. + * The client MAY ignore this request. + * + * Default is "none". Values "thisServer" and "allServers" are soft-deprecated. Servers SHOULD only use these values if the client + * declares ClientCapabilities.sampling.context. These values may be removed in future spec releases. + */ + includeContext?: "none" | "thisServer" | "allServers"; + /** + * @TJS-type number + */ + temperature?: number; + /** + * The requested maximum number of tokens to sample (to prevent runaway completions). + * + * The client MAY choose to sample fewer tokens than the requested maximum. + */ + maxTokens: number; + stopSequences?: string[]; + /** + * Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific. + */ + metadata?: object; + /** + * Tools that the model may use during generation. + * The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared. + */ + tools?: Tool[]; + /** + * Controls how the model uses tools. + * The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared. + * Default is `{ mode: "auto" }`. + */ + toolChoice?: ToolChoice; +} +/** + * Controls tool selection behavior for sampling requests. + * + * @category `sampling/createMessage` + */ +export interface ToolChoice { + /** + * Controls the tool use ability of the model: + * - "auto": Model decides whether to use tools (default) + * - "required": Model MUST use at least one tool before completing + * - "none": Model MUST NOT use any tools + */ + mode?: "auto" | "required" | "none"; +} +/** + * A request from the server to sample an LLM via the client. The client has full discretion over which model to select. The client should also inform the user before beginning sampling, to allow them to inspect the request (human in the loop) and decide whether to approve it. + * + * @category `sampling/createMessage` + */ +export interface CreateMessageRequest extends JSONRPCRequest { + method: "sampling/createMessage"; + params: CreateMessageRequestParams; +} +/** + * The client's response to a sampling/createMessage request from the server. + * The client should inform the user before returning the sampled message, to allow them + * to inspect the response (human in the loop) and decide whether to allow the server to see it. + * + * @category `sampling/createMessage` + */ +export interface CreateMessageResult extends Result, SamplingMessage { + /** + * The name of the model that generated the message. + */ + model: string; + /** + * The reason why sampling stopped, if known. + * + * Standard values: + * - "endTurn": Natural end of the assistant's turn + * - "stopSequence": A stop sequence was encountered + * - "maxTokens": Maximum token limit was reached + * - "toolUse": The model wants to use one or more tools + * + * This field is an open string to allow for provider-specific stop reasons. + */ + stopReason?: "endTurn" | "stopSequence" | "maxTokens" | "toolUse" | string; +} +/** + * Describes a message issued to or received from an LLM API. + * + * @category `sampling/createMessage` + */ +export interface SamplingMessage { + role: Role; + content: SamplingMessageContentBlock | SamplingMessageContentBlock[]; + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { + [key: string]: unknown; + }; +} +export type SamplingMessageContentBlock = TextContent | ImageContent | AudioContent | ToolUseContent | ToolResultContent; +/** + * Optional annotations for the client. The client can use annotations to inform how objects are used or displayed + * + * @category Common Types + */ +export interface Annotations { + /** + * Describes who the intended audience of this object or data is. + * + * It can include multiple entries to indicate content useful for multiple audiences (e.g., `["user", "assistant"]`). + */ + audience?: Role[]; + /** + * Describes how important this data is for operating the server. + * + * A value of 1 means "most important," and indicates that the data is + * effectively required, while 0 means "least important," and indicates that + * the data is entirely optional. + * + * @TJS-type number + * @minimum 0 + * @maximum 1 + */ + priority?: number; + /** + * The moment the resource was last modified, as an ISO 8601 formatted string. + * + * Should be an ISO 8601 formatted string (e.g., "2025-01-12T15:00:58Z"). + * + * Examples: last activity timestamp in an open file, timestamp when the resource + * was attached, etc. + */ + lastModified?: string; +} +/** + * @category Content + */ +export type ContentBlock = TextContent | ImageContent | AudioContent | ResourceLink | EmbeddedResource; +/** + * Text provided to or from an LLM. + * + * @category Content + */ +export interface TextContent { + type: "text"; + /** + * The text content of the message. + */ + text: string; + /** + * Optional annotations for the client. + */ + annotations?: Annotations; + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { + [key: string]: unknown; + }; +} +/** + * An image provided to or from an LLM. + * + * @category Content + */ +export interface ImageContent { + type: "image"; + /** + * The base64-encoded image data. + * + * @format byte + */ + data: string; + /** + * The MIME type of the image. Different providers may support different image types. + */ + mimeType: string; + /** + * Optional annotations for the client. + */ + annotations?: Annotations; + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { + [key: string]: unknown; + }; +} +/** + * Audio provided to or from an LLM. + * + * @category Content + */ +export interface AudioContent { + type: "audio"; + /** + * The base64-encoded audio data. + * + * @format byte + */ + data: string; + /** + * The MIME type of the audio. Different providers may support different audio types. + */ + mimeType: string; + /** + * Optional annotations for the client. + */ + annotations?: Annotations; + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { + [key: string]: unknown; + }; +} +/** + * A request from the assistant to call a tool. + * + * @category `sampling/createMessage` + */ +export interface ToolUseContent { + type: "tool_use"; + /** + * A unique identifier for this tool use. + * + * This ID is used to match tool results to their corresponding tool uses. + */ + id: string; + /** + * The name of the tool to call. + */ + name: string; + /** + * The arguments to pass to the tool, conforming to the tool's input schema. + */ + input: { + [key: string]: unknown; + }; + /** + * Optional metadata about the tool use. Clients SHOULD preserve this field when + * including tool uses in subsequent sampling requests to enable caching optimizations. + * + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { + [key: string]: unknown; + }; +} +/** + * The result of a tool use, provided by the user back to the assistant. + * + * @category `sampling/createMessage` + */ +export interface ToolResultContent { + type: "tool_result"; + /** + * The ID of the tool use this result corresponds to. + * + * This MUST match the ID from a previous ToolUseContent. + */ + toolUseId: string; + /** + * The unstructured result content of the tool use. + * + * This has the same format as CallToolResult.content and can include text, images, + * audio, resource links, and embedded resources. + */ + content: ContentBlock[]; + /** + * An optional structured result object. + * + * If the tool defined an outputSchema, this SHOULD conform to that schema. + */ + structuredContent?: { + [key: string]: unknown; + }; + /** + * Whether the tool use resulted in an error. + * + * If true, the content typically describes the error that occurred. + * Default: false + */ + isError?: boolean; + /** + * Optional metadata about the tool result. Clients SHOULD preserve this field when + * including tool results in subsequent sampling requests to enable caching optimizations. + * + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { + [key: string]: unknown; + }; +} +/** + * The server's preferences for model selection, requested of the client during sampling. + * + * Because LLMs can vary along multiple dimensions, choosing the "best" model is + * rarely straightforward. Different models excel in different areas—some are + * faster but less capable, others are more capable but more expensive, and so + * on. This interface allows servers to express their priorities across multiple + * dimensions to help clients make an appropriate selection for their use case. + * + * These preferences are always advisory. The client MAY ignore them. It is also + * up to the client to decide how to interpret these preferences and how to + * balance them against other considerations. + * + * @category `sampling/createMessage` + */ +export interface ModelPreferences { + /** + * Optional hints to use for model selection. + * + * If multiple hints are specified, the client MUST evaluate them in order + * (such that the first match is taken). + * + * The client SHOULD prioritize these hints over the numeric priorities, but + * MAY still use the priorities to select from ambiguous matches. + */ + hints?: ModelHint[]; + /** + * How much to prioritize cost when selecting a model. A value of 0 means cost + * is not important, while a value of 1 means cost is the most important + * factor. + * + * @TJS-type number + * @minimum 0 + * @maximum 1 + */ + costPriority?: number; + /** + * How much to prioritize sampling speed (latency) when selecting a model. A + * value of 0 means speed is not important, while a value of 1 means speed is + * the most important factor. + * + * @TJS-type number + * @minimum 0 + * @maximum 1 + */ + speedPriority?: number; + /** + * How much to prioritize intelligence and capabilities when selecting a + * model. A value of 0 means intelligence is not important, while a value of 1 + * means intelligence is the most important factor. + * + * @TJS-type number + * @minimum 0 + * @maximum 1 + */ + intelligencePriority?: number; +} +/** + * Hints to use for model selection. + * + * Keys not declared here are currently left unspecified by the spec and are up + * to the client to interpret. + * + * @category `sampling/createMessage` + */ +export interface ModelHint { + /** + * A hint for a model name. + * + * The client SHOULD treat this as a substring of a model name; for example: + * - `claude-3-5-sonnet` should match `claude-3-5-sonnet-20241022` + * - `sonnet` should match `claude-3-5-sonnet-20241022`, `claude-3-sonnet-20240229`, etc. + * - `claude` should match any Claude model + * + * The client MAY also map the string to a different provider's model name or a different model family, as long as it fills a similar niche; for example: + * - `gemini-1.5-flash` could match `claude-3-haiku-20240307` + */ + name?: string; +} +/** + * Parameters for a `completion/complete` request. + * + * @category `completion/complete` + */ +export interface CompleteRequestParams extends RequestParams { + ref: PromptReference | ResourceTemplateReference; + /** + * The argument's information + */ + argument: { + /** + * The name of the argument + */ + name: string; + /** + * The value of the argument to use for completion matching. + */ + value: string; + }; + /** + * Additional, optional context for completions + */ + context?: { + /** + * Previously-resolved variables in a URI template or prompt. + */ + arguments?: { + [key: string]: string; + }; + }; +} +/** + * A request from the client to the server, to ask for completion options. + * + * @category `completion/complete` + */ +export interface CompleteRequest extends JSONRPCRequest { + method: "completion/complete"; + params: CompleteRequestParams; +} +/** + * The server's response to a completion/complete request + * + * @category `completion/complete` + */ +export interface CompleteResult extends Result { + completion: { + /** + * An array of completion values. Must not exceed 100 items. + */ + values: string[]; + /** + * The total number of completion options available. This can exceed the number of values actually sent in the response. + */ + total?: number; + /** + * Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown. + */ + hasMore?: boolean; + }; +} +/** + * A reference to a resource or resource template definition. + * + * @category `completion/complete` + */ +export interface ResourceTemplateReference { + type: "ref/resource"; + /** + * The URI or URI template of the resource. + * + * @format uri-template + */ + uri: string; +} +/** + * Identifies a prompt. + * + * @category `completion/complete` + */ +export interface PromptReference extends BaseMetadata { + type: "ref/prompt"; +} +/** + * Sent from the server to request a list of root URIs from the client. Roots allow + * servers to ask for specific directories or files to operate on. A common example + * for roots is providing a set of repositories or directories a server should operate + * on. + * + * This request is typically used when the server needs to understand the file system + * structure or access specific locations that the client has permission to read from. + * + * @category `roots/list` + */ +export interface ListRootsRequest extends JSONRPCRequest { + method: "roots/list"; + params?: RequestParams; +} +/** + * The client's response to a roots/list request from the server. + * This result contains an array of Root objects, each representing a root directory + * or file that the server can operate on. + * + * @category `roots/list` + */ +export interface ListRootsResult extends Result { + roots: Root[]; +} +/** + * Represents a root directory or file that the server can operate on. + * + * @category `roots/list` + */ +export interface Root { + /** + * The URI identifying the root. This *must* start with file:// for now. + * This restriction may be relaxed in future versions of the protocol to allow + * other URI schemes. + * + * @format uri + */ + uri: string; + /** + * An optional name for the root. This can be used to provide a human-readable + * identifier for the root, which may be useful for display purposes or for + * referencing the root in other parts of the application. + */ + name?: string; + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta?: { + [key: string]: unknown; + }; +} +/** + * A notification from the client to the server, informing it that the list of roots has changed. + * This notification should be sent whenever the client adds, removes, or modifies any root. + * The server should then request an updated list of roots using the ListRootsRequest. + * + * @category `notifications/roots/list_changed` + */ +export interface RootsListChangedNotification extends JSONRPCNotification { + method: "notifications/roots/list_changed"; + params?: NotificationParams; +} +/** + * The parameters for a request to elicit non-sensitive information from the user via a form in the client. + * + * @category `elicitation/create` + */ +export interface ElicitRequestFormParams extends TaskAugmentedRequestParams { + /** + * The elicitation mode. + */ + mode?: "form"; + /** + * The message to present to the user describing what information is being requested. + */ + message: string; + /** + * A restricted subset of JSON Schema. + * Only top-level properties are allowed, without nesting. + */ + requestedSchema: { + $schema?: string; + type: "object"; + properties: { + [key: string]: PrimitiveSchemaDefinition; + }; + required?: string[]; + }; +} +/** + * The parameters for a request to elicit information from the user via a URL in the client. + * + * @category `elicitation/create` + */ +export interface ElicitRequestURLParams extends TaskAugmentedRequestParams { + /** + * The elicitation mode. + */ + mode: "url"; + /** + * The message to present to the user explaining why the interaction is needed. + */ + message: string; + /** + * The ID of the elicitation, which must be unique within the context of the server. + * The client MUST treat this ID as an opaque value. + */ + elicitationId: string; + /** + * The URL that the user should navigate to. + * + * @format uri + */ + url: string; +} +/** + * The parameters for a request to elicit additional information from the user via the client. + * + * @category `elicitation/create` + */ +export type ElicitRequestParams = ElicitRequestFormParams | ElicitRequestURLParams; +/** + * A request from the server to elicit additional information from the user via the client. + * + * @category `elicitation/create` + */ +export interface ElicitRequest extends JSONRPCRequest { + method: "elicitation/create"; + params: ElicitRequestParams; +} +/** + * Restricted schema definitions that only allow primitive types + * without nested objects or arrays. + * + * @category `elicitation/create` + */ +export type PrimitiveSchemaDefinition = StringSchema | NumberSchema | BooleanSchema | EnumSchema; +/** + * @category `elicitation/create` + */ +export interface StringSchema { + type: "string"; + title?: string; + description?: string; + minLength?: number; + maxLength?: number; + format?: "email" | "uri" | "date" | "date-time"; + default?: string; +} +/** + * @category `elicitation/create` + */ +export interface NumberSchema { + type: "number" | "integer"; + title?: string; + description?: string; + minimum?: number; + maximum?: number; + default?: number; +} +/** + * @category `elicitation/create` + */ +export interface BooleanSchema { + type: "boolean"; + title?: string; + description?: string; + default?: boolean; +} +/** + * Schema for single-selection enumeration without display titles for options. + * + * @category `elicitation/create` + */ +export interface UntitledSingleSelectEnumSchema { + type: "string"; + /** + * Optional title for the enum field. + */ + title?: string; + /** + * Optional description for the enum field. + */ + description?: string; + /** + * Array of enum values to choose from. + */ + enum: string[]; + /** + * Optional default value. + */ + default?: string; +} +/** + * Schema for single-selection enumeration with display titles for each option. + * + * @category `elicitation/create` + */ +export interface TitledSingleSelectEnumSchema { + type: "string"; + /** + * Optional title for the enum field. + */ + title?: string; + /** + * Optional description for the enum field. + */ + description?: string; + /** + * Array of enum options with values and display labels. + */ + oneOf: Array<{ + /** + * The enum value. + */ + const: string; + /** + * Display label for this option. + */ + title: string; + }>; + /** + * Optional default value. + */ + default?: string; +} +/** + * @category `elicitation/create` + */ +export type SingleSelectEnumSchema = UntitledSingleSelectEnumSchema | TitledSingleSelectEnumSchema; +/** + * Schema for multiple-selection enumeration without display titles for options. + * + * @category `elicitation/create` + */ +export interface UntitledMultiSelectEnumSchema { + type: "array"; + /** + * Optional title for the enum field. + */ + title?: string; + /** + * Optional description for the enum field. + */ + description?: string; + /** + * Minimum number of items to select. + */ + minItems?: number; + /** + * Maximum number of items to select. + */ + maxItems?: number; + /** + * Schema for the array items. + */ + items: { + type: "string"; + /** + * Array of enum values to choose from. + */ + enum: string[]; + }; + /** + * Optional default value. + */ + default?: string[]; +} +/** + * Schema for multiple-selection enumeration with display titles for each option. + * + * @category `elicitation/create` + */ +export interface TitledMultiSelectEnumSchema { + type: "array"; + /** + * Optional title for the enum field. + */ + title?: string; + /** + * Optional description for the enum field. + */ + description?: string; + /** + * Minimum number of items to select. + */ + minItems?: number; + /** + * Maximum number of items to select. + */ + maxItems?: number; + /** + * Schema for array items with enum options and display labels. + */ + items: { + /** + * Array of enum options with values and display labels. + */ + anyOf: Array<{ + /** + * The constant enum value. + */ + const: string; + /** + * Display title for this option. + */ + title: string; + }>; + }; + /** + * Optional default value. + */ + default?: string[]; +} +/** + * @category `elicitation/create` + */ +export type MultiSelectEnumSchema = UntitledMultiSelectEnumSchema | TitledMultiSelectEnumSchema; +/** + * Use TitledSingleSelectEnumSchema instead. + * This interface will be removed in a future version. + * + * @category `elicitation/create` + */ +export interface LegacyTitledEnumSchema { + type: "string"; + title?: string; + description?: string; + enum: string[]; + /** + * (Legacy) Display names for enum values. + * Non-standard according to JSON schema 2020-12. + */ + enumNames?: string[]; + default?: string; +} +/** + * @category `elicitation/create` + */ +export type EnumSchema = SingleSelectEnumSchema | MultiSelectEnumSchema | LegacyTitledEnumSchema; +/** + * The client's response to an elicitation request. + * + * @category `elicitation/create` + */ +export interface ElicitResult extends Result { + /** + * The user action in response to the elicitation. + * - "accept": User submitted the form/confirmed the action + * - "decline": User explicitly decline the action + * - "cancel": User dismissed without making an explicit choice + */ + action: "accept" | "decline" | "cancel"; + /** + * The submitted form data, only present when action is "accept" and mode was "form". + * Contains values matching the requested schema. + * Omitted for out-of-band mode responses. + */ + content?: { + [key: string]: string | number | boolean | string[]; + }; +} +/** + * An optional notification from the server to the client, informing it of a completion of a out-of-band elicitation request. + * + * @category `notifications/elicitation/complete` + */ +export interface ElicitationCompleteNotification extends JSONRPCNotification { + method: "notifications/elicitation/complete"; + params: { + /** + * The ID of the elicitation that completed. + */ + elicitationId: string; + }; +} +/** @internal */ +export type ClientRequest = PingRequest | InitializeRequest | CompleteRequest | SetLevelRequest | GetPromptRequest | ListPromptsRequest | ListResourcesRequest | ListResourceTemplatesRequest | ReadResourceRequest | SubscribeRequest | UnsubscribeRequest | CallToolRequest | ListToolsRequest | GetTaskRequest | GetTaskPayloadRequest | ListTasksRequest | CancelTaskRequest; +/** @internal */ +export type ClientNotification = CancelledNotification | ProgressNotification | InitializedNotification | RootsListChangedNotification | TaskStatusNotification; +/** @internal */ +export type ClientResult = EmptyResult | CreateMessageResult | ListRootsResult | ElicitResult | GetTaskResult | GetTaskPayloadResult | ListTasksResult | CancelTaskResult; +/** @internal */ +export type ServerRequest = PingRequest | CreateMessageRequest | ListRootsRequest | ElicitRequest | GetTaskRequest | GetTaskPayloadRequest | ListTasksRequest | CancelTaskRequest; +/** @internal */ +export type ServerNotification = CancelledNotification | ProgressNotification | LoggingMessageNotification | ResourceUpdatedNotification | ResourceListChangedNotification | ToolListChangedNotification | PromptListChangedNotification | ElicitationCompleteNotification | TaskStatusNotification; +/** @internal */ +export type ServerResult = EmptyResult | InitializeResult | CompleteResult | GetPromptResult | ListPromptsResult | ListResourceTemplatesResult | ListResourcesResult | ReadResourceResult | CallToolResult | ListToolsResult | GetTaskResult | GetTaskPayloadResult | ListTasksResult | CancelTaskResult; +//# sourceMappingURL=spec.types.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/spec.types.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/spec.types.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..e962a522d358207f7726e9f70064ca8798083d79 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/spec.types.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"spec.types.d.ts","sourceRoot":"","sources":["../../src/spec.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;GAIG;AACH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oB,GACpB,4BAA4B,GAC5B,mBAAmB,GACnB,gBAAgB,GAChB,kBAAkB,GAClB,eAAe,GACf,gBAAgB,GAChB,cAAc,GACd,qBAAqB,GACrB,gBAAgB,GAChB,iBAAiB,CAAC;AAEtB,gBAAgB;AAChB,MAAM,MAAM,kBAAkB,GAC1B,qBAAqB,GACrB,oBAAoB,GACpB,uBAAuB,GACvB,4BAA4B,GAC5B,sBAAsB,CAAC;AAE3B,gBAAgB;AAChB,MAAM,MAAM,YAAY,GACpB,WAAW,GACX,mBAAmB,GACnB,eAAe,GACf,YAAY,GACZ,aAAa,GACb,oBAAoB,GACpB,eAAe,GACf,gBAAgB,CAAC;AAGrB,gBAAgB;AAChB,MAAM,MAAM,aAAa,GACrB,WAAW,GACX,oBAAoB,GACpB,gBAAgB,GAChB,aAAa,GACb,cAAc,GACd,qBAAqB,GACrB,gBAAgB,GAChB,iBAAiB,CAAC;AAEtB,gBAAgB;AAChB,MAAM,MAAM,kBAAkB,GAC1B,qBAAqB,GACrB,oBAAoB,GACpB,0BAA0B,GAC1B,2BAA2B,GAC3B,+BAA+B,GAC/B,2BAA2B,GAC3B,6BAA6B,GAC7B,+BAA+B,GAC/B,sBAAsB,CAAC;AAE3B,gBAAgB;AAChB,MAAM,MAAM,YAAY,GACpB,WAAW,GACX,gBAAgB,GAChB,cAAc,GACd,eAAe,GACf,iBAAiB,GACjB,2BAA2B,GAC3B,mBAAmB,GACnB,kBAAkB,GAClB,cAAc,GACd,eAAe,GACf,aAAa,GACb,oBAAoB,GACpB,eAAe,GACf,gBAAgB,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/spec.types.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/spec.types.js new file mode 100644 index 0000000000000000000000000000000000000000..7d0bd05529f5df0da21fd5b3b561130d30299456 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/spec.types.js @@ -0,0 +1,24 @@ +/** + * This file is automatically generated from the Model Context Protocol specification. + * + * Source: https://github.com/modelcontextprotocol/modelcontextprotocol + * Pulled from: https://raw.githubusercontent.com/modelcontextprotocol/modelcontextprotocol/main/schema/draft/schema.ts + * Last updated from commit: 35fa160caf287a9c48696e3ae452c0645c713669 + * + * DO NOT EDIT THIS FILE MANUALLY. Changes will be overwritten by automated updates. + * To update this file, run: npm run fetch:spec-types + */ /* JSON-RPC types */ +/** @internal */ +export const LATEST_PROTOCOL_VERSION = "DRAFT-2026-v1"; +/** @internal */ +export const JSONRPC_VERSION = "2.0"; +// Standard JSON-RPC error codes +export const PARSE_ERROR = -32700; +export const INVALID_REQUEST = -32600; +export const METHOD_NOT_FOUND = -32601; +export const INVALID_PARAMS = -32602; +export const INTERNAL_ERROR = -32603; +// Implementation-specific JSON-RPC error codes [-32000, -32099] +/** @internal */ +export const URL_ELICITATION_REQUIRED = -32042; +//# sourceMappingURL=spec.types.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/spec.types.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/spec.types.js.map new file mode 100644 index 0000000000000000000000000000000000000000..02dadb912836829aa178fd3299bceae0f82a5139 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/spec.types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"spec.types.js","sourceRoot":"","sources":["../../src/spec.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG,CAAA,oBAAoB;AAYvB,gBAAgB;AAChB,MAAM,CAAC,MAAM,uBAAuB,GAAG,eAAe,CAAC;AACvD,gBAAgB;AAChB,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC;AA4JrC,gCAAgC;AAChC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,KAAK,CAAC;AAClC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAK,CAAC;AACtC,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAK,CAAC;AACvC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAK,CAAC;AACrC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAK,CAAC;AAErC,gEAAgE;AAChE,gBAAgB;AAChB,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,KAAK,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/types.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..742adf4421a74acbf38b7dfe3a26e2a825237a01 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/types.d.ts @@ -0,0 +1,8168 @@ +import * as z from 'zod/v4'; +import { AuthInfo } from './server/auth/types.js'; +export declare const LATEST_PROTOCOL_VERSION = "2025-11-25"; +export declare const DEFAULT_NEGOTIATED_PROTOCOL_VERSION = "2025-03-26"; +export declare const SUPPORTED_PROTOCOL_VERSIONS: string[]; +export declare const RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task"; +export declare const JSONRPC_VERSION = "2.0"; +/** + * Utility types + */ +type ExpandRecursively = T extends object ? (T extends infer O ? { + [K in keyof O]: ExpandRecursively; +} : never) : T; +/** + * A progress token, used to associate progress notifications with the original request. + */ +export declare const ProgressTokenSchema: z.ZodUnion; +/** + * An opaque token used to represent a cursor for pagination. + */ +export declare const CursorSchema: z.ZodString; +/** + * Task creation parameters, used to ask that the server create a task to represent a request. + */ +export declare const TaskCreationParamsSchema: z.ZodObject<{ + /** + * Requested duration in milliseconds to retain task from creation. + */ + ttl: z.ZodOptional; + /** + * Time in milliseconds to wait between task status requests. + */ + pollInterval: z.ZodOptional; +}, z.core.$loose>; +export declare const TaskMetadataSchema: z.ZodObject<{ + ttl: z.ZodOptional; +}, z.core.$strip>; +/** + * Metadata for associating messages with a task. + * Include this in the `_meta` field under the key `io.modelcontextprotocol/related-task`. + */ +export declare const RelatedTaskMetadataSchema: z.ZodObject<{ + taskId: z.ZodString; +}, z.core.$strip>; +declare const RequestMetaSchema: z.ZodObject<{ + /** + * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications. + */ + progressToken: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; +}, z.core.$loose>; +/** + * Common params for any request. + */ +declare const BaseRequestParamsSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; +}, z.core.$strip>; +/** + * Common params for any task-augmented request. + */ +export declare const TaskAugmentedRequestParamsSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + task: z.ZodOptional; + }, z.core.$strip>>; +}, z.core.$strip>; +/** + * Checks if a value is a valid TaskAugmentedRequestParams. + * @param value - The value to check. + * + * @returns True if the value is a valid TaskAugmentedRequestParams, false otherwise. + */ +export declare const isTaskAugmentedRequestParams: (value: unknown) => value is TaskAugmentedRequestParams; +export declare const RequestSchema: z.ZodObject<{ + method: z.ZodString; + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$loose>>; +}, z.core.$strip>; +declare const NotificationsParamsSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; +}, z.core.$strip>; +export declare const NotificationSchema: z.ZodObject<{ + method: z.ZodString; + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$loose>>; +}, z.core.$strip>; +export declare const ResultSchema: z.ZodObject<{ + /** + * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) + * for notes on _meta usage. + */ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; +}, z.core.$loose>; +/** + * A uniquely identifying ID for a request in JSON-RPC. + */ +export declare const RequestIdSchema: z.ZodUnion; +/** + * A request that expects a response. + */ +export declare const JSONRPCRequestSchema: z.ZodObject<{ + method: z.ZodString; + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$loose>>; + jsonrpc: z.ZodLiteral<"2.0">; + id: z.ZodUnion; +}, z.core.$strict>; +export declare const isJSONRPCRequest: (value: unknown) => value is JSONRPCRequest; +/** + * A notification which does not expect a response. + */ +export declare const JSONRPCNotificationSchema: z.ZodObject<{ + method: z.ZodString; + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$loose>>; + jsonrpc: z.ZodLiteral<"2.0">; +}, z.core.$strict>; +export declare const isJSONRPCNotification: (value: unknown) => value is JSONRPCNotification; +/** + * A successful (non-error) response to a request. + */ +export declare const JSONRPCResultResponseSchema: z.ZodObject<{ + jsonrpc: z.ZodLiteral<"2.0">; + id: z.ZodUnion; + result: z.ZodObject<{ + /** + * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) + * for notes on _meta usage. + */ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$loose>; +}, z.core.$strict>; +/** + * Checks if a value is a valid JSONRPCResultResponse. + * @param value - The value to check. + * + * @returns True if the value is a valid JSONRPCResultResponse, false otherwise. + */ +export declare const isJSONRPCResultResponse: (value: unknown) => value is JSONRPCResultResponse; +/** + * @deprecated Use {@link isJSONRPCResultResponse} instead. + * + * Please note that {@link JSONRPCResponse} is a union of {@link JSONRPCResultResponse} and {@link JSONRPCErrorResponse} as per the updated JSON-RPC specification. (was previously just {@link JSONRPCResultResponse}) + */ +export declare const isJSONRPCResponse: (value: unknown) => value is JSONRPCResultResponse; +/** + * Error codes defined by the JSON-RPC specification. + */ +export declare enum ErrorCode { + ConnectionClosed = -32000, + RequestTimeout = -32001, + ParseError = -32700, + InvalidRequest = -32600, + MethodNotFound = -32601, + InvalidParams = -32602, + InternalError = -32603, + UrlElicitationRequired = -32042 +} +/** + * A response to a request that indicates an error occurred. + */ +export declare const JSONRPCErrorResponseSchema: z.ZodObject<{ + jsonrpc: z.ZodLiteral<"2.0">; + id: z.ZodOptional>; + error: z.ZodObject<{ + code: z.ZodNumber; + message: z.ZodString; + data: z.ZodOptional; + }, z.core.$strip>; +}, z.core.$strict>; +/** + * @deprecated Use {@link JSONRPCErrorResponseSchema} instead. + */ +export declare const JSONRPCErrorSchema: z.ZodObject<{ + jsonrpc: z.ZodLiteral<"2.0">; + id: z.ZodOptional>; + error: z.ZodObject<{ + code: z.ZodNumber; + message: z.ZodString; + data: z.ZodOptional; + }, z.core.$strip>; +}, z.core.$strict>; +/** + * Checks if a value is a valid JSONRPCErrorResponse. + * @param value - The value to check. + * + * @returns True if the value is a valid JSONRPCErrorResponse, false otherwise. + */ +export declare const isJSONRPCErrorResponse: (value: unknown) => value is JSONRPCErrorResponse; +/** + * @deprecated Use {@link isJSONRPCErrorResponse} instead. + */ +export declare const isJSONRPCError: (value: unknown) => value is JSONRPCErrorResponse; +export declare const JSONRPCMessageSchema: z.ZodUnion>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$loose>>; + jsonrpc: z.ZodLiteral<"2.0">; + id: z.ZodUnion; +}, z.core.$strict>, z.ZodObject<{ + method: z.ZodString; + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$loose>>; + jsonrpc: z.ZodLiteral<"2.0">; +}, z.core.$strict>, z.ZodObject<{ + jsonrpc: z.ZodLiteral<"2.0">; + id: z.ZodUnion; + result: z.ZodObject<{ + /** + * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) + * for notes on _meta usage. + */ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$loose>; +}, z.core.$strict>, z.ZodObject<{ + jsonrpc: z.ZodLiteral<"2.0">; + id: z.ZodOptional>; + error: z.ZodObject<{ + code: z.ZodNumber; + message: z.ZodString; + data: z.ZodOptional; + }, z.core.$strip>; +}, z.core.$strict>]>; +export declare const JSONRPCResponseSchema: z.ZodUnion; + id: z.ZodUnion; + result: z.ZodObject<{ + /** + * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) + * for notes on _meta usage. + */ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$loose>; +}, z.core.$strict>, z.ZodObject<{ + jsonrpc: z.ZodLiteral<"2.0">; + id: z.ZodOptional>; + error: z.ZodObject<{ + code: z.ZodNumber; + message: z.ZodString; + data: z.ZodOptional; + }, z.core.$strip>; +}, z.core.$strict>]>; +/** + * A response that indicates success but carries no data. + */ +export declare const EmptyResultSchema: z.ZodObject<{ + /** + * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) + * for notes on _meta usage. + */ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; +}, z.core.$strict>; +export declare const CancelledNotificationParamsSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + requestId: z.ZodOptional>; + reason: z.ZodOptional; +}, z.core.$strip>; +/** + * This notification can be sent by either side to indicate that it is cancelling a previously-issued request. + * + * The request SHOULD still be in-flight, but due to communication latency, it is always possible that this notification MAY arrive after the request has already finished. + * + * This notification indicates that the result will be unused, so any associated processing SHOULD cease. + * + * A client MUST NOT attempt to cancel its `initialize` request. + */ +export declare const CancelledNotificationSchema: z.ZodObject<{ + method: z.ZodLiteral<"notifications/cancelled">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + requestId: z.ZodOptional>; + reason: z.ZodOptional; + }, z.core.$strip>; +}, z.core.$strip>; +/** + * Icon schema for use in tools, prompts, resources, and implementations. + */ +export declare const IconSchema: z.ZodObject<{ + src: z.ZodString; + mimeType: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; +}, z.core.$strip>; +/** + * Base schema to add `icons` property. + * + */ +export declare const IconsSchema: z.ZodObject<{ + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; +}, z.core.$strip>; +/** + * Base metadata interface for common properties across resources, tools, prompts, and implementations. + */ +export declare const BaseMetadataSchema: z.ZodObject<{ + name: z.ZodString; + title: z.ZodOptional; +}, z.core.$strip>; +/** + * Describes the name and version of an MCP implementation. + */ +export declare const ImplementationSchema: z.ZodObject<{ + version: z.ZodString; + websiteUrl: z.ZodOptional; + description: z.ZodOptional; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; +}, z.core.$strip>; +/** + * Task capabilities for clients, indicating which request types support task creation. + */ +export declare const ClientTasksCapabilitySchema: z.ZodObject<{ + /** + * Present if the client supports listing tasks. + */ + list: z.ZodOptional>; + /** + * Present if the client supports cancelling tasks. + */ + cancel: z.ZodOptional>; + /** + * Capabilities for task creation on specific request types. + */ + requests: z.ZodOptional>; + }, z.core.$loose>>; + /** + * Task support for elicitation requests. + */ + elicitation: z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$loose>>; +}, z.core.$loose>; +/** + * Task capabilities for servers, indicating which request types support task creation. + */ +export declare const ServerTasksCapabilitySchema: z.ZodObject<{ + /** + * Present if the server supports listing tasks. + */ + list: z.ZodOptional>; + /** + * Present if the server supports cancelling tasks. + */ + cancel: z.ZodOptional>; + /** + * Capabilities for task creation on specific request types. + */ + requests: z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$loose>>; +}, z.core.$loose>; +/** + * Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities. + */ +export declare const ClientCapabilitiesSchema: z.ZodObject<{ + experimental: z.ZodOptional>>; + sampling: z.ZodOptional>; + tools: z.ZodOptional>; + }, z.core.$strip>>; + elicitation: z.ZodOptional, z.ZodIntersection; + }, z.core.$strip>, z.ZodRecord>>; + url: z.ZodOptional>; + }, z.core.$strip>, z.ZodOptional>>>>; + roots: z.ZodOptional; + }, z.core.$strip>>; + tasks: z.ZodOptional>; + /** + * Present if the client supports cancelling tasks. + */ + cancel: z.ZodOptional>; + /** + * Capabilities for task creation on specific request types. + */ + requests: z.ZodOptional>; + }, z.core.$loose>>; + /** + * Task support for elicitation requests. + */ + elicitation: z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$loose>>; + }, z.core.$loose>>; + extensions: z.ZodOptional>>; +}, z.core.$strip>; +export declare const InitializeRequestParamsSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + protocolVersion: z.ZodString; + capabilities: z.ZodObject<{ + experimental: z.ZodOptional>>; + sampling: z.ZodOptional>; + tools: z.ZodOptional>; + }, z.core.$strip>>; + elicitation: z.ZodOptional, z.ZodIntersection; + }, z.core.$strip>, z.ZodRecord>>; + url: z.ZodOptional>; + }, z.core.$strip>, z.ZodOptional>>>>; + roots: z.ZodOptional; + }, z.core.$strip>>; + tasks: z.ZodOptional>; + /** + * Present if the client supports cancelling tasks. + */ + cancel: z.ZodOptional>; + /** + * Capabilities for task creation on specific request types. + */ + requests: z.ZodOptional>; + }, z.core.$loose>>; + /** + * Task support for elicitation requests. + */ + elicitation: z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$loose>>; + }, z.core.$loose>>; + extensions: z.ZodOptional>>; + }, z.core.$strip>; + clientInfo: z.ZodObject<{ + version: z.ZodString; + websiteUrl: z.ZodOptional; + description: z.ZodOptional; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + }, z.core.$strip>; +}, z.core.$strip>; +/** + * This request is sent from the client to the server when it first connects, asking it to begin initialization. + */ +export declare const InitializeRequestSchema: z.ZodObject<{ + method: z.ZodLiteral<"initialize">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + protocolVersion: z.ZodString; + capabilities: z.ZodObject<{ + experimental: z.ZodOptional>>; + sampling: z.ZodOptional>; + tools: z.ZodOptional>; + }, z.core.$strip>>; + elicitation: z.ZodOptional, z.ZodIntersection; + }, z.core.$strip>, z.ZodRecord>>; + url: z.ZodOptional>; + }, z.core.$strip>, z.ZodOptional>>>>; + roots: z.ZodOptional; + }, z.core.$strip>>; + tasks: z.ZodOptional>; + /** + * Present if the client supports cancelling tasks. + */ + cancel: z.ZodOptional>; + /** + * Capabilities for task creation on specific request types. + */ + requests: z.ZodOptional>; + }, z.core.$loose>>; + /** + * Task support for elicitation requests. + */ + elicitation: z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$loose>>; + }, z.core.$loose>>; + extensions: z.ZodOptional>>; + }, z.core.$strip>; + clientInfo: z.ZodObject<{ + version: z.ZodString; + websiteUrl: z.ZodOptional; + description: z.ZodOptional; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + }, z.core.$strip>; + }, z.core.$strip>; +}, z.core.$strip>; +export declare const isInitializeRequest: (value: unknown) => value is InitializeRequest; +/** + * Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities. + */ +export declare const ServerCapabilitiesSchema: z.ZodObject<{ + experimental: z.ZodOptional>>; + logging: z.ZodOptional>; + completions: z.ZodOptional>; + prompts: z.ZodOptional; + }, z.core.$strip>>; + resources: z.ZodOptional; + listChanged: z.ZodOptional; + }, z.core.$strip>>; + tools: z.ZodOptional; + }, z.core.$strip>>; + tasks: z.ZodOptional>; + /** + * Present if the server supports cancelling tasks. + */ + cancel: z.ZodOptional>; + /** + * Capabilities for task creation on specific request types. + */ + requests: z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$loose>>; + }, z.core.$loose>>; + extensions: z.ZodOptional>>; +}, z.core.$strip>; +/** + * After receiving an initialize request from the client, the server sends this response. + */ +export declare const InitializeResultSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + protocolVersion: z.ZodString; + capabilities: z.ZodObject<{ + experimental: z.ZodOptional>>; + logging: z.ZodOptional>; + completions: z.ZodOptional>; + prompts: z.ZodOptional; + }, z.core.$strip>>; + resources: z.ZodOptional; + listChanged: z.ZodOptional; + }, z.core.$strip>>; + tools: z.ZodOptional; + }, z.core.$strip>>; + tasks: z.ZodOptional>; + /** + * Present if the server supports cancelling tasks. + */ + cancel: z.ZodOptional>; + /** + * Capabilities for task creation on specific request types. + */ + requests: z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$loose>>; + }, z.core.$loose>>; + extensions: z.ZodOptional>>; + }, z.core.$strip>; + serverInfo: z.ZodObject<{ + version: z.ZodString; + websiteUrl: z.ZodOptional; + description: z.ZodOptional; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + }, z.core.$strip>; + instructions: z.ZodOptional; +}, z.core.$loose>; +/** + * This notification is sent from the client to the server after initialization has finished. + */ +export declare const InitializedNotificationSchema: z.ZodObject<{ + method: z.ZodLiteral<"notifications/initialized">; + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$strip>>; +}, z.core.$strip>; +export declare const isInitializedNotification: (value: unknown) => value is InitializedNotification; +/** + * A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected. + */ +export declare const PingRequestSchema: z.ZodObject<{ + method: z.ZodLiteral<"ping">; + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$strip>>; +}, z.core.$strip>; +export declare const ProgressSchema: z.ZodObject<{ + progress: z.ZodNumber; + total: z.ZodOptional; + message: z.ZodOptional; +}, z.core.$strip>; +export declare const ProgressNotificationParamsSchema: z.ZodObject<{ + progressToken: z.ZodUnion; + progress: z.ZodNumber; + total: z.ZodOptional; + message: z.ZodOptional; + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; +}, z.core.$strip>; +/** + * An out-of-band notification used to inform the receiver of a progress update for a long-running request. + * + * @category notifications/progress + */ +export declare const ProgressNotificationSchema: z.ZodObject<{ + method: z.ZodLiteral<"notifications/progress">; + params: z.ZodObject<{ + progressToken: z.ZodUnion; + progress: z.ZodNumber; + total: z.ZodOptional; + message: z.ZodOptional; + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$strip>; +}, z.core.$strip>; +export declare const PaginatedRequestParamsSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + cursor: z.ZodOptional; +}, z.core.$strip>; +export declare const PaginatedRequestSchema: z.ZodObject<{ + method: z.ZodString; + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + cursor: z.ZodOptional; + }, z.core.$strip>>; +}, z.core.$strip>; +export declare const PaginatedResultSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + nextCursor: z.ZodOptional; +}, z.core.$loose>; +/** + * The status of a task. + * */ +export declare const TaskStatusSchema: z.ZodEnum<{ + working: "working"; + input_required: "input_required"; + completed: "completed"; + failed: "failed"; + cancelled: "cancelled"; +}>; +/** + * A pollable state object associated with a request. + */ +export declare const TaskSchema: z.ZodObject<{ + taskId: z.ZodString; + status: z.ZodEnum<{ + working: "working"; + input_required: "input_required"; + completed: "completed"; + failed: "failed"; + cancelled: "cancelled"; + }>; + ttl: z.ZodUnion; + createdAt: z.ZodString; + lastUpdatedAt: z.ZodString; + pollInterval: z.ZodOptional; + statusMessage: z.ZodOptional; +}, z.core.$strip>; +/** + * Result returned when a task is created, containing the task data wrapped in a task field. + */ +export declare const CreateTaskResultSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + task: z.ZodObject<{ + taskId: z.ZodString; + status: z.ZodEnum<{ + working: "working"; + input_required: "input_required"; + completed: "completed"; + failed: "failed"; + cancelled: "cancelled"; + }>; + ttl: z.ZodUnion; + createdAt: z.ZodString; + lastUpdatedAt: z.ZodString; + pollInterval: z.ZodOptional; + statusMessage: z.ZodOptional; + }, z.core.$strip>; +}, z.core.$loose>; +/** + * Parameters for task status notification. + */ +export declare const TaskStatusNotificationParamsSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + taskId: z.ZodString; + status: z.ZodEnum<{ + working: "working"; + input_required: "input_required"; + completed: "completed"; + failed: "failed"; + cancelled: "cancelled"; + }>; + ttl: z.ZodUnion; + createdAt: z.ZodString; + lastUpdatedAt: z.ZodString; + pollInterval: z.ZodOptional; + statusMessage: z.ZodOptional; +}, z.core.$strip>; +/** + * A notification sent when a task's status changes. + */ +export declare const TaskStatusNotificationSchema: z.ZodObject<{ + method: z.ZodLiteral<"notifications/tasks/status">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + taskId: z.ZodString; + status: z.ZodEnum<{ + working: "working"; + input_required: "input_required"; + completed: "completed"; + failed: "failed"; + cancelled: "cancelled"; + }>; + ttl: z.ZodUnion; + createdAt: z.ZodString; + lastUpdatedAt: z.ZodString; + pollInterval: z.ZodOptional; + statusMessage: z.ZodOptional; + }, z.core.$strip>; +}, z.core.$strip>; +/** + * A request to get the state of a specific task. + */ +export declare const GetTaskRequestSchema: z.ZodObject<{ + method: z.ZodLiteral<"tasks/get">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + taskId: z.ZodString; + }, z.core.$strip>; +}, z.core.$strip>; +/** + * The response to a tasks/get request. + */ +export declare const GetTaskResultSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + taskId: z.ZodString; + status: z.ZodEnum<{ + working: "working"; + input_required: "input_required"; + completed: "completed"; + failed: "failed"; + cancelled: "cancelled"; + }>; + ttl: z.ZodUnion; + createdAt: z.ZodString; + lastUpdatedAt: z.ZodString; + pollInterval: z.ZodOptional; + statusMessage: z.ZodOptional; +}, z.core.$strip>; +/** + * A request to get the result of a specific task. + */ +export declare const GetTaskPayloadRequestSchema: z.ZodObject<{ + method: z.ZodLiteral<"tasks/result">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + taskId: z.ZodString; + }, z.core.$strip>; +}, z.core.$strip>; +/** + * The response to a tasks/result request. + * The structure matches the result type of the original request. + * For example, a tools/call task would return the CallToolResult structure. + * + */ +export declare const GetTaskPayloadResultSchema: z.ZodObject<{ + /** + * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) + * for notes on _meta usage. + */ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; +}, z.core.$loose>; +/** + * A request to list tasks. + */ +export declare const ListTasksRequestSchema: z.ZodObject<{ + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + cursor: z.ZodOptional; + }, z.core.$strip>>; + method: z.ZodLiteral<"tasks/list">; +}, z.core.$strip>; +/** + * The response to a tasks/list request. + */ +export declare const ListTasksResultSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + nextCursor: z.ZodOptional; + tasks: z.ZodArray; + ttl: z.ZodUnion; + createdAt: z.ZodString; + lastUpdatedAt: z.ZodString; + pollInterval: z.ZodOptional; + statusMessage: z.ZodOptional; + }, z.core.$strip>>; +}, z.core.$loose>; +/** + * A request to cancel a specific task. + */ +export declare const CancelTaskRequestSchema: z.ZodObject<{ + method: z.ZodLiteral<"tasks/cancel">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + taskId: z.ZodString; + }, z.core.$strip>; +}, z.core.$strip>; +/** + * The response to a tasks/cancel request. + */ +export declare const CancelTaskResultSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + taskId: z.ZodString; + status: z.ZodEnum<{ + working: "working"; + input_required: "input_required"; + completed: "completed"; + failed: "failed"; + cancelled: "cancelled"; + }>; + ttl: z.ZodUnion; + createdAt: z.ZodString; + lastUpdatedAt: z.ZodString; + pollInterval: z.ZodOptional; + statusMessage: z.ZodOptional; +}, z.core.$strip>; +/** + * The contents of a specific resource or sub-resource. + */ +export declare const ResourceContentsSchema: z.ZodObject<{ + uri: z.ZodString; + mimeType: z.ZodOptional; + _meta: z.ZodOptional>; +}, z.core.$strip>; +export declare const TextResourceContentsSchema: z.ZodObject<{ + uri: z.ZodString; + mimeType: z.ZodOptional; + _meta: z.ZodOptional>; + text: z.ZodString; +}, z.core.$strip>; +export declare const BlobResourceContentsSchema: z.ZodObject<{ + uri: z.ZodString; + mimeType: z.ZodOptional; + _meta: z.ZodOptional>; + blob: z.ZodString; +}, z.core.$strip>; +/** + * The sender or recipient of messages and data in a conversation. + */ +export declare const RoleSchema: z.ZodEnum<{ + user: "user"; + assistant: "assistant"; +}>; +/** + * Optional annotations providing clients additional context about a resource. + */ +export declare const AnnotationsSchema: z.ZodObject<{ + audience: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; +}, z.core.$strip>; +/** + * A known resource that the server is capable of reading. + */ +export declare const ResourceSchema: z.ZodObject<{ + uri: z.ZodString; + description: z.ZodOptional; + mimeType: z.ZodOptional; + size: z.ZodOptional; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; +}, z.core.$strip>; +/** + * A template description for resources available on the server. + */ +export declare const ResourceTemplateSchema: z.ZodObject<{ + uriTemplate: z.ZodString; + description: z.ZodOptional; + mimeType: z.ZodOptional; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; +}, z.core.$strip>; +/** + * Sent from the client to request a list of resources the server has. + */ +export declare const ListResourcesRequestSchema: z.ZodObject<{ + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + cursor: z.ZodOptional; + }, z.core.$strip>>; + method: z.ZodLiteral<"resources/list">; +}, z.core.$strip>; +/** + * The server's response to a resources/list request from the client. + */ +export declare const ListResourcesResultSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + nextCursor: z.ZodOptional; + resources: z.ZodArray; + mimeType: z.ZodOptional; + size: z.ZodOptional; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + }, z.core.$strip>>; +}, z.core.$loose>; +/** + * Sent from the client to request a list of resource templates the server has. + */ +export declare const ListResourceTemplatesRequestSchema: z.ZodObject<{ + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + cursor: z.ZodOptional; + }, z.core.$strip>>; + method: z.ZodLiteral<"resources/templates/list">; +}, z.core.$strip>; +/** + * The server's response to a resources/templates/list request from the client. + */ +export declare const ListResourceTemplatesResultSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + nextCursor: z.ZodOptional; + resourceTemplates: z.ZodArray; + mimeType: z.ZodOptional; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + }, z.core.$strip>>; +}, z.core.$loose>; +export declare const ResourceRequestParamsSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + uri: z.ZodString; +}, z.core.$strip>; +/** + * Parameters for a `resources/read` request. + */ +export declare const ReadResourceRequestParamsSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + uri: z.ZodString; +}, z.core.$strip>; +/** + * Sent from the client to the server, to read a specific resource URI. + */ +export declare const ReadResourceRequestSchema: z.ZodObject<{ + method: z.ZodLiteral<"resources/read">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + uri: z.ZodString; + }, z.core.$strip>; +}, z.core.$strip>; +/** + * The server's response to a resources/read request from the client. + */ +export declare const ReadResourceResultSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + contents: z.ZodArray; + _meta: z.ZodOptional>; + text: z.ZodString; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + mimeType: z.ZodOptional; + _meta: z.ZodOptional>; + blob: z.ZodString; + }, z.core.$strip>]>>; +}, z.core.$loose>; +/** + * An optional notification from the server to the client, informing it that the list of resources it can read from has changed. This may be issued by servers without any previous subscription from the client. + */ +export declare const ResourceListChangedNotificationSchema: z.ZodObject<{ + method: z.ZodLiteral<"notifications/resources/list_changed">; + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$strip>>; +}, z.core.$strip>; +export declare const SubscribeRequestParamsSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + uri: z.ZodString; +}, z.core.$strip>; +/** + * Sent from the client to request resources/updated notifications from the server whenever a particular resource changes. + */ +export declare const SubscribeRequestSchema: z.ZodObject<{ + method: z.ZodLiteral<"resources/subscribe">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + uri: z.ZodString; + }, z.core.$strip>; +}, z.core.$strip>; +export declare const UnsubscribeRequestParamsSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + uri: z.ZodString; +}, z.core.$strip>; +/** + * Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request. + */ +export declare const UnsubscribeRequestSchema: z.ZodObject<{ + method: z.ZodLiteral<"resources/unsubscribe">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + uri: z.ZodString; + }, z.core.$strip>; +}, z.core.$strip>; +/** + * Parameters for a `notifications/resources/updated` notification. + */ +export declare const ResourceUpdatedNotificationParamsSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + uri: z.ZodString; +}, z.core.$strip>; +/** + * A notification from the server to the client, informing it that a resource has changed and may need to be read again. This should only be sent if the client previously sent a resources/subscribe request. + */ +export declare const ResourceUpdatedNotificationSchema: z.ZodObject<{ + method: z.ZodLiteral<"notifications/resources/updated">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + uri: z.ZodString; + }, z.core.$strip>; +}, z.core.$strip>; +/** + * Describes an argument that a prompt can accept. + */ +export declare const PromptArgumentSchema: z.ZodObject<{ + name: z.ZodString; + description: z.ZodOptional; + required: z.ZodOptional; +}, z.core.$strip>; +/** + * A prompt or prompt template that the server offers. + */ +export declare const PromptSchema: z.ZodObject<{ + description: z.ZodOptional; + arguments: z.ZodOptional; + required: z.ZodOptional; + }, z.core.$strip>>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; +}, z.core.$strip>; +/** + * Sent from the client to request a list of prompts and prompt templates the server has. + */ +export declare const ListPromptsRequestSchema: z.ZodObject<{ + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + cursor: z.ZodOptional; + }, z.core.$strip>>; + method: z.ZodLiteral<"prompts/list">; +}, z.core.$strip>; +/** + * The server's response to a prompts/list request from the client. + */ +export declare const ListPromptsResultSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + nextCursor: z.ZodOptional; + prompts: z.ZodArray; + arguments: z.ZodOptional; + required: z.ZodOptional; + }, z.core.$strip>>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + }, z.core.$strip>>; +}, z.core.$loose>; +/** + * Parameters for a `prompts/get` request. + */ +export declare const GetPromptRequestParamsSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + name: z.ZodString; + arguments: z.ZodOptional>; +}, z.core.$strip>; +/** + * Used by the client to get a prompt provided by the server. + */ +export declare const GetPromptRequestSchema: z.ZodObject<{ + method: z.ZodLiteral<"prompts/get">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + name: z.ZodString; + arguments: z.ZodOptional>; + }, z.core.$strip>; +}, z.core.$strip>; +/** + * Text provided to or from an LLM. + */ +export declare const TextContentSchema: z.ZodObject<{ + type: z.ZodLiteral<"text">; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; +}, z.core.$strip>; +/** + * An image provided to or from an LLM. + */ +export declare const ImageContentSchema: z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; +}, z.core.$strip>; +/** + * An Audio provided to or from an LLM. + */ +export declare const AudioContentSchema: z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; +}, z.core.$strip>; +/** + * A tool call request from an assistant (LLM). + * Represents the assistant's request to use a tool. + */ +export declare const ToolUseContentSchema: z.ZodObject<{ + type: z.ZodLiteral<"tool_use">; + name: z.ZodString; + id: z.ZodString; + input: z.ZodRecord; + _meta: z.ZodOptional>; +}, z.core.$strip>; +/** + * The contents of a resource, embedded into a prompt or tool call result. + */ +export declare const EmbeddedResourceSchema: z.ZodObject<{ + type: z.ZodLiteral<"resource">; + resource: z.ZodUnion; + _meta: z.ZodOptional>; + text: z.ZodString; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + mimeType: z.ZodOptional; + _meta: z.ZodOptional>; + blob: z.ZodString; + }, z.core.$strip>]>; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; +}, z.core.$strip>; +/** + * A resource that the server is capable of reading, included in a prompt or tool call result. + * + * Note: resource links returned by tools are not guaranteed to appear in the results of `resources/list` requests. + */ +export declare const ResourceLinkSchema: z.ZodObject<{ + uri: z.ZodString; + description: z.ZodOptional; + mimeType: z.ZodOptional; + size: z.ZodOptional; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + type: z.ZodLiteral<"resource_link">; +}, z.core.$strip>; +/** + * A content block that can be used in prompts and tool results. + */ +export declare const ContentBlockSchema: z.ZodUnion; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; +}, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; +}, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; +}, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + description: z.ZodOptional; + mimeType: z.ZodOptional; + size: z.ZodOptional; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + type: z.ZodLiteral<"resource_link">; +}, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"resource">; + resource: z.ZodUnion; + _meta: z.ZodOptional>; + text: z.ZodString; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + mimeType: z.ZodOptional; + _meta: z.ZodOptional>; + blob: z.ZodString; + }, z.core.$strip>]>; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; +}, z.core.$strip>]>; +/** + * Describes a message returned as part of a prompt. + */ +export declare const PromptMessageSchema: z.ZodObject<{ + role: z.ZodEnum<{ + user: "user"; + assistant: "assistant"; + }>; + content: z.ZodUnion; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + description: z.ZodOptional; + mimeType: z.ZodOptional; + size: z.ZodOptional; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + type: z.ZodLiteral<"resource_link">; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"resource">; + resource: z.ZodUnion; + _meta: z.ZodOptional>; + text: z.ZodString; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + mimeType: z.ZodOptional; + _meta: z.ZodOptional>; + blob: z.ZodString; + }, z.core.$strip>]>; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>]>; +}, z.core.$strip>; +/** + * The server's response to a prompts/get request from the client. + */ +export declare const GetPromptResultSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + description: z.ZodOptional; + messages: z.ZodArray; + content: z.ZodUnion; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + description: z.ZodOptional; + mimeType: z.ZodOptional; + size: z.ZodOptional; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + type: z.ZodLiteral<"resource_link">; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"resource">; + resource: z.ZodUnion; + _meta: z.ZodOptional>; + text: z.ZodString; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + mimeType: z.ZodOptional; + _meta: z.ZodOptional>; + blob: z.ZodString; + }, z.core.$strip>]>; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>]>; + }, z.core.$strip>>; +}, z.core.$loose>; +/** + * An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client. + */ +export declare const PromptListChangedNotificationSchema: z.ZodObject<{ + method: z.ZodLiteral<"notifications/prompts/list_changed">; + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$strip>>; +}, z.core.$strip>; +/** + * Additional properties describing a Tool to clients. + * + * NOTE: all properties in ToolAnnotations are **hints**. + * They are not guaranteed to provide a faithful description of + * tool behavior (including descriptive properties like `title`). + * + * Clients should never make tool use decisions based on ToolAnnotations + * received from untrusted servers. + */ +export declare const ToolAnnotationsSchema: z.ZodObject<{ + title: z.ZodOptional; + readOnlyHint: z.ZodOptional; + destructiveHint: z.ZodOptional; + idempotentHint: z.ZodOptional; + openWorldHint: z.ZodOptional; +}, z.core.$strip>; +/** + * Execution-related properties for a tool. + */ +export declare const ToolExecutionSchema: z.ZodObject<{ + taskSupport: z.ZodOptional>; +}, z.core.$strip>; +/** + * Definition for a tool the client can call. + */ +export declare const ToolSchema: z.ZodObject<{ + description: z.ZodOptional; + inputSchema: z.ZodObject<{ + type: z.ZodLiteral<"object">; + properties: z.ZodOptional>>; + required: z.ZodOptional>; + }, z.core.$catchall>; + outputSchema: z.ZodOptional; + properties: z.ZodOptional>>; + required: z.ZodOptional>; + }, z.core.$catchall>>; + annotations: z.ZodOptional; + readOnlyHint: z.ZodOptional; + destructiveHint: z.ZodOptional; + idempotentHint: z.ZodOptional; + openWorldHint: z.ZodOptional; + }, z.core.$strip>>; + execution: z.ZodOptional>; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; +}, z.core.$strip>; +/** + * Sent from the client to request a list of tools the server has. + */ +export declare const ListToolsRequestSchema: z.ZodObject<{ + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + cursor: z.ZodOptional; + }, z.core.$strip>>; + method: z.ZodLiteral<"tools/list">; +}, z.core.$strip>; +/** + * The server's response to a tools/list request from the client. + */ +export declare const ListToolsResultSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + nextCursor: z.ZodOptional; + tools: z.ZodArray; + inputSchema: z.ZodObject<{ + type: z.ZodLiteral<"object">; + properties: z.ZodOptional>>; + required: z.ZodOptional>; + }, z.core.$catchall>; + outputSchema: z.ZodOptional; + properties: z.ZodOptional>>; + required: z.ZodOptional>; + }, z.core.$catchall>>; + annotations: z.ZodOptional; + readOnlyHint: z.ZodOptional; + destructiveHint: z.ZodOptional; + idempotentHint: z.ZodOptional; + openWorldHint: z.ZodOptional; + }, z.core.$strip>>; + execution: z.ZodOptional>; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + }, z.core.$strip>>; +}, z.core.$loose>; +/** + * The server's response to a tool call. + */ +export declare const CallToolResultSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + content: z.ZodDefault; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + description: z.ZodOptional; + mimeType: z.ZodOptional; + size: z.ZodOptional; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + type: z.ZodLiteral<"resource_link">; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"resource">; + resource: z.ZodUnion; + _meta: z.ZodOptional>; + text: z.ZodString; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + mimeType: z.ZodOptional; + _meta: z.ZodOptional>; + blob: z.ZodString; + }, z.core.$strip>]>; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>]>>>; + structuredContent: z.ZodOptional>; + isError: z.ZodOptional; +}, z.core.$loose>; +/** + * CallToolResultSchema extended with backwards compatibility to protocol version 2024-10-07. + */ +export declare const CompatibilityCallToolResultSchema: z.ZodUnion<[z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + content: z.ZodDefault; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + description: z.ZodOptional; + mimeType: z.ZodOptional; + size: z.ZodOptional; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + type: z.ZodLiteral<"resource_link">; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"resource">; + resource: z.ZodUnion; + _meta: z.ZodOptional>; + text: z.ZodString; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + mimeType: z.ZodOptional; + _meta: z.ZodOptional>; + blob: z.ZodString; + }, z.core.$strip>]>; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>]>>>; + structuredContent: z.ZodOptional>; + isError: z.ZodOptional; +}, z.core.$loose>, z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + toolResult: z.ZodUnknown; +}, z.core.$loose>]>; +/** + * Parameters for a `tools/call` request. + */ +export declare const CallToolRequestParamsSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + task: z.ZodOptional; + }, z.core.$strip>>; + name: z.ZodString; + arguments: z.ZodOptional>; +}, z.core.$strip>; +/** + * Used by the client to invoke a tool provided by the server. + */ +export declare const CallToolRequestSchema: z.ZodObject<{ + method: z.ZodLiteral<"tools/call">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + task: z.ZodOptional; + }, z.core.$strip>>; + name: z.ZodString; + arguments: z.ZodOptional>; + }, z.core.$strip>; +}, z.core.$strip>; +/** + * An optional notification from the server to the client, informing it that the list of tools it offers has changed. This may be issued by servers without any previous subscription from the client. + */ +export declare const ToolListChangedNotificationSchema: z.ZodObject<{ + method: z.ZodLiteral<"notifications/tools/list_changed">; + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$strip>>; +}, z.core.$strip>; +/** + * Callback type for list changed notifications. + */ +export type ListChangedCallback = (error: Error | null, items: T[] | null) => void; +/** + * Base schema for list changed subscription options (without callback). + * Used internally for Zod validation of autoRefresh and debounceMs. + */ +export declare const ListChangedOptionsBaseSchema: z.ZodObject<{ + autoRefresh: z.ZodDefault; + debounceMs: z.ZodDefault; +}, z.core.$strip>; +/** + * Options for subscribing to list changed notifications. + * + * @typeParam T - The type of items in the list (Tool, Prompt, or Resource) + */ +export type ListChangedOptions = { + /** + * If true, the list will be refreshed automatically when a list changed notification is received. + * @default true + */ + autoRefresh?: boolean; + /** + * Debounce time in milliseconds. Set to 0 to disable. + * @default 300 + */ + debounceMs?: number; + /** + * Callback invoked when the list changes. + * + * If autoRefresh is true, items contains the updated list. + * If autoRefresh is false, items is null (caller should refresh manually). + */ + onChanged: ListChangedCallback; +}; +/** + * Configuration for list changed notification handlers. + * + * Use this to configure handlers for tools, prompts, and resources list changes + * when creating a client. + * + * Note: Handlers are only activated if the server advertises the corresponding + * `listChanged` capability (e.g., `tools.listChanged: true`). If the server + * doesn't advertise this capability, the handler will not be set up. + */ +export type ListChangedHandlers = { + /** + * Handler for tool list changes. + */ + tools?: ListChangedOptions; + /** + * Handler for prompt list changes. + */ + prompts?: ListChangedOptions; + /** + * Handler for resource list changes. + */ + resources?: ListChangedOptions; +}; +/** + * The severity of a log message. + */ +export declare const LoggingLevelSchema: z.ZodEnum<{ + error: "error"; + debug: "debug"; + info: "info"; + notice: "notice"; + warning: "warning"; + critical: "critical"; + alert: "alert"; + emergency: "emergency"; +}>; +/** + * Parameters for a `logging/setLevel` request. + */ +export declare const SetLevelRequestParamsSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + level: z.ZodEnum<{ + error: "error"; + debug: "debug"; + info: "info"; + notice: "notice"; + warning: "warning"; + critical: "critical"; + alert: "alert"; + emergency: "emergency"; + }>; +}, z.core.$strip>; +/** + * A request from the client to the server, to enable or adjust logging. + */ +export declare const SetLevelRequestSchema: z.ZodObject<{ + method: z.ZodLiteral<"logging/setLevel">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + level: z.ZodEnum<{ + error: "error"; + debug: "debug"; + info: "info"; + notice: "notice"; + warning: "warning"; + critical: "critical"; + alert: "alert"; + emergency: "emergency"; + }>; + }, z.core.$strip>; +}, z.core.$strip>; +/** + * Parameters for a `notifications/message` notification. + */ +export declare const LoggingMessageNotificationParamsSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + level: z.ZodEnum<{ + error: "error"; + debug: "debug"; + info: "info"; + notice: "notice"; + warning: "warning"; + critical: "critical"; + alert: "alert"; + emergency: "emergency"; + }>; + logger: z.ZodOptional; + data: z.ZodUnknown; +}, z.core.$strip>; +/** + * Notification of a log message passed from server to client. If no logging/setLevel request has been sent from the client, the server MAY decide which messages to send automatically. + */ +export declare const LoggingMessageNotificationSchema: z.ZodObject<{ + method: z.ZodLiteral<"notifications/message">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + level: z.ZodEnum<{ + error: "error"; + debug: "debug"; + info: "info"; + notice: "notice"; + warning: "warning"; + critical: "critical"; + alert: "alert"; + emergency: "emergency"; + }>; + logger: z.ZodOptional; + data: z.ZodUnknown; + }, z.core.$strip>; +}, z.core.$strip>; +/** + * Hints to use for model selection. + */ +export declare const ModelHintSchema: z.ZodObject<{ + name: z.ZodOptional; +}, z.core.$strip>; +/** + * The server's preferences for model selection, requested of the client during sampling. + */ +export declare const ModelPreferencesSchema: z.ZodObject<{ + hints: z.ZodOptional; + }, z.core.$strip>>>; + costPriority: z.ZodOptional; + speedPriority: z.ZodOptional; + intelligencePriority: z.ZodOptional; +}, z.core.$strip>; +/** + * Controls tool usage behavior in sampling requests. + */ +export declare const ToolChoiceSchema: z.ZodObject<{ + mode: z.ZodOptional>; +}, z.core.$strip>; +/** + * The result of a tool execution, provided by the user (server). + * Represents the outcome of invoking a tool requested via ToolUseContent. + */ +export declare const ToolResultContentSchema: z.ZodObject<{ + type: z.ZodLiteral<"tool_result">; + toolUseId: z.ZodString; + content: z.ZodDefault; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + description: z.ZodOptional; + mimeType: z.ZodOptional; + size: z.ZodOptional; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + type: z.ZodLiteral<"resource_link">; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"resource">; + resource: z.ZodUnion; + _meta: z.ZodOptional>; + text: z.ZodString; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + mimeType: z.ZodOptional; + _meta: z.ZodOptional>; + blob: z.ZodString; + }, z.core.$strip>]>; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>]>>>; + structuredContent: z.ZodOptional>; + isError: z.ZodOptional; + _meta: z.ZodOptional>; +}, z.core.$strip>; +/** + * Basic content types for sampling responses (without tool use). + * Used for backwards-compatible CreateMessageResult when tools are not used. + */ +export declare const SamplingContentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ + type: z.ZodLiteral<"text">; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; +}, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; +}, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; +}, z.core.$strip>]>; +/** + * Content block types allowed in sampling messages. + * This includes text, image, audio, tool use requests, and tool results. + */ +export declare const SamplingMessageContentBlockSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{ + type: z.ZodLiteral<"text">; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; +}, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; +}, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; +}, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"tool_use">; + name: z.ZodString; + id: z.ZodString; + input: z.ZodRecord; + _meta: z.ZodOptional>; +}, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"tool_result">; + toolUseId: z.ZodString; + content: z.ZodDefault; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + description: z.ZodOptional; + mimeType: z.ZodOptional; + size: z.ZodOptional; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + type: z.ZodLiteral<"resource_link">; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"resource">; + resource: z.ZodUnion; + _meta: z.ZodOptional>; + text: z.ZodString; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + mimeType: z.ZodOptional; + _meta: z.ZodOptional>; + blob: z.ZodString; + }, z.core.$strip>]>; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>]>>>; + structuredContent: z.ZodOptional>; + isError: z.ZodOptional; + _meta: z.ZodOptional>; +}, z.core.$strip>]>; +/** + * Describes a message issued to or received from an LLM API. + */ +export declare const SamplingMessageSchema: z.ZodObject<{ + role: z.ZodEnum<{ + user: "user"; + assistant: "assistant"; + }>; + content: z.ZodUnion; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"tool_use">; + name: z.ZodString; + id: z.ZodString; + input: z.ZodRecord; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"tool_result">; + toolUseId: z.ZodString; + content: z.ZodDefault; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + description: z.ZodOptional; + mimeType: z.ZodOptional; + size: z.ZodOptional; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + type: z.ZodLiteral<"resource_link">; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"resource">; + resource: z.ZodUnion; + _meta: z.ZodOptional>; + text: z.ZodString; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + mimeType: z.ZodOptional; + _meta: z.ZodOptional>; + blob: z.ZodString; + }, z.core.$strip>]>; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>]>>>; + structuredContent: z.ZodOptional>; + isError: z.ZodOptional; + _meta: z.ZodOptional>; + }, z.core.$strip>]>, z.ZodArray; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"tool_use">; + name: z.ZodString; + id: z.ZodString; + input: z.ZodRecord; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"tool_result">; + toolUseId: z.ZodString; + content: z.ZodDefault; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + description: z.ZodOptional; + mimeType: z.ZodOptional; + size: z.ZodOptional; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + type: z.ZodLiteral<"resource_link">; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"resource">; + resource: z.ZodUnion; + _meta: z.ZodOptional>; + text: z.ZodString; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + mimeType: z.ZodOptional; + _meta: z.ZodOptional>; + blob: z.ZodString; + }, z.core.$strip>]>; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>]>>>; + structuredContent: z.ZodOptional>; + isError: z.ZodOptional; + _meta: z.ZodOptional>; + }, z.core.$strip>]>>]>; + _meta: z.ZodOptional>; +}, z.core.$strip>; +/** + * Parameters for a `sampling/createMessage` request. + */ +export declare const CreateMessageRequestParamsSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + task: z.ZodOptional; + }, z.core.$strip>>; + messages: z.ZodArray; + content: z.ZodUnion; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"tool_use">; + name: z.ZodString; + id: z.ZodString; + input: z.ZodRecord; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"tool_result">; + toolUseId: z.ZodString; + content: z.ZodDefault; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + description: z.ZodOptional; + mimeType: z.ZodOptional; + size: z.ZodOptional; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + type: z.ZodLiteral<"resource_link">; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"resource">; + resource: z.ZodUnion; + _meta: z.ZodOptional>; + text: z.ZodString; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + mimeType: z.ZodOptional; + _meta: z.ZodOptional>; + blob: z.ZodString; + }, z.core.$strip>]>; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>]>>>; + structuredContent: z.ZodOptional>; + isError: z.ZodOptional; + _meta: z.ZodOptional>; + }, z.core.$strip>]>, z.ZodArray; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"tool_use">; + name: z.ZodString; + id: z.ZodString; + input: z.ZodRecord; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"tool_result">; + toolUseId: z.ZodString; + content: z.ZodDefault; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + description: z.ZodOptional; + mimeType: z.ZodOptional; + size: z.ZodOptional; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + type: z.ZodLiteral<"resource_link">; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"resource">; + resource: z.ZodUnion; + _meta: z.ZodOptional>; + text: z.ZodString; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + mimeType: z.ZodOptional; + _meta: z.ZodOptional>; + blob: z.ZodString; + }, z.core.$strip>]>; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>]>>>; + structuredContent: z.ZodOptional>; + isError: z.ZodOptional; + _meta: z.ZodOptional>; + }, z.core.$strip>]>>]>; + _meta: z.ZodOptional>; + }, z.core.$strip>>; + modelPreferences: z.ZodOptional; + }, z.core.$strip>>>; + costPriority: z.ZodOptional; + speedPriority: z.ZodOptional; + intelligencePriority: z.ZodOptional; + }, z.core.$strip>>; + systemPrompt: z.ZodOptional; + includeContext: z.ZodOptional>; + temperature: z.ZodOptional; + maxTokens: z.ZodNumber; + stopSequences: z.ZodOptional>; + metadata: z.ZodOptional>; + tools: z.ZodOptional; + inputSchema: z.ZodObject<{ + type: z.ZodLiteral<"object">; + properties: z.ZodOptional>>; + required: z.ZodOptional>; + }, z.core.$catchall>; + outputSchema: z.ZodOptional; + properties: z.ZodOptional>>; + required: z.ZodOptional>; + }, z.core.$catchall>>; + annotations: z.ZodOptional; + readOnlyHint: z.ZodOptional; + destructiveHint: z.ZodOptional; + idempotentHint: z.ZodOptional; + openWorldHint: z.ZodOptional; + }, z.core.$strip>>; + execution: z.ZodOptional>; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + }, z.core.$strip>>>; + toolChoice: z.ZodOptional>; + }, z.core.$strip>>; +}, z.core.$strip>; +/** + * A request from the server to sample an LLM via the client. The client has full discretion over which model to select. The client should also inform the user before beginning sampling, to allow them to inspect the request (human in the loop) and decide whether to approve it. + */ +export declare const CreateMessageRequestSchema: z.ZodObject<{ + method: z.ZodLiteral<"sampling/createMessage">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + task: z.ZodOptional; + }, z.core.$strip>>; + messages: z.ZodArray; + content: z.ZodUnion; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"tool_use">; + name: z.ZodString; + id: z.ZodString; + input: z.ZodRecord; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"tool_result">; + toolUseId: z.ZodString; + content: z.ZodDefault; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + description: z.ZodOptional; + mimeType: z.ZodOptional; + size: z.ZodOptional; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + type: z.ZodLiteral<"resource_link">; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"resource">; + resource: z.ZodUnion; + _meta: z.ZodOptional>; + text: z.ZodString; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + mimeType: z.ZodOptional; + _meta: z.ZodOptional>; + blob: z.ZodString; + }, z.core.$strip>]>; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>]>>>; + structuredContent: z.ZodOptional>; + isError: z.ZodOptional; + _meta: z.ZodOptional>; + }, z.core.$strip>]>, z.ZodArray; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"tool_use">; + name: z.ZodString; + id: z.ZodString; + input: z.ZodRecord; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"tool_result">; + toolUseId: z.ZodString; + content: z.ZodDefault; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + description: z.ZodOptional; + mimeType: z.ZodOptional; + size: z.ZodOptional; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + type: z.ZodLiteral<"resource_link">; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"resource">; + resource: z.ZodUnion; + _meta: z.ZodOptional>; + text: z.ZodString; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + mimeType: z.ZodOptional; + _meta: z.ZodOptional>; + blob: z.ZodString; + }, z.core.$strip>]>; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>]>>>; + structuredContent: z.ZodOptional>; + isError: z.ZodOptional; + _meta: z.ZodOptional>; + }, z.core.$strip>]>>]>; + _meta: z.ZodOptional>; + }, z.core.$strip>>; + modelPreferences: z.ZodOptional; + }, z.core.$strip>>>; + costPriority: z.ZodOptional; + speedPriority: z.ZodOptional; + intelligencePriority: z.ZodOptional; + }, z.core.$strip>>; + systemPrompt: z.ZodOptional; + includeContext: z.ZodOptional>; + temperature: z.ZodOptional; + maxTokens: z.ZodNumber; + stopSequences: z.ZodOptional>; + metadata: z.ZodOptional>; + tools: z.ZodOptional; + inputSchema: z.ZodObject<{ + type: z.ZodLiteral<"object">; + properties: z.ZodOptional>>; + required: z.ZodOptional>; + }, z.core.$catchall>; + outputSchema: z.ZodOptional; + properties: z.ZodOptional>>; + required: z.ZodOptional>; + }, z.core.$catchall>>; + annotations: z.ZodOptional; + readOnlyHint: z.ZodOptional; + destructiveHint: z.ZodOptional; + idempotentHint: z.ZodOptional; + openWorldHint: z.ZodOptional; + }, z.core.$strip>>; + execution: z.ZodOptional>; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + }, z.core.$strip>>>; + toolChoice: z.ZodOptional>; + }, z.core.$strip>>; + }, z.core.$strip>; +}, z.core.$strip>; +/** + * The client's response to a sampling/create_message request from the server. + * This is the backwards-compatible version that returns single content (no arrays). + * Used when the request does not include tools. + */ +export declare const CreateMessageResultSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + model: z.ZodString; + stopReason: z.ZodOptional, z.ZodString]>>; + role: z.ZodEnum<{ + user: "user"; + assistant: "assistant"; + }>; + content: z.ZodDiscriminatedUnion<[z.ZodObject<{ + type: z.ZodLiteral<"text">; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>]>; +}, z.core.$loose>; +/** + * The client's response to a sampling/create_message request when tools were provided. + * This version supports array content for tool use flows. + */ +export declare const CreateMessageResultWithToolsSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + model: z.ZodString; + stopReason: z.ZodOptional, z.ZodString]>>; + role: z.ZodEnum<{ + user: "user"; + assistant: "assistant"; + }>; + content: z.ZodUnion; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"tool_use">; + name: z.ZodString; + id: z.ZodString; + input: z.ZodRecord; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"tool_result">; + toolUseId: z.ZodString; + content: z.ZodDefault; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + description: z.ZodOptional; + mimeType: z.ZodOptional; + size: z.ZodOptional; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + type: z.ZodLiteral<"resource_link">; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"resource">; + resource: z.ZodUnion; + _meta: z.ZodOptional>; + text: z.ZodString; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + mimeType: z.ZodOptional; + _meta: z.ZodOptional>; + blob: z.ZodString; + }, z.core.$strip>]>; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>]>>>; + structuredContent: z.ZodOptional>; + isError: z.ZodOptional; + _meta: z.ZodOptional>; + }, z.core.$strip>]>, z.ZodArray; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"tool_use">; + name: z.ZodString; + id: z.ZodString; + input: z.ZodRecord; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"tool_result">; + toolUseId: z.ZodString; + content: z.ZodDefault; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + description: z.ZodOptional; + mimeType: z.ZodOptional; + size: z.ZodOptional; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + type: z.ZodLiteral<"resource_link">; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"resource">; + resource: z.ZodUnion; + _meta: z.ZodOptional>; + text: z.ZodString; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + mimeType: z.ZodOptional; + _meta: z.ZodOptional>; + blob: z.ZodString; + }, z.core.$strip>]>; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>]>>>; + structuredContent: z.ZodOptional>; + isError: z.ZodOptional; + _meta: z.ZodOptional>; + }, z.core.$strip>]>>]>; +}, z.core.$loose>; +/** + * Primitive schema definition for boolean fields. + */ +export declare const BooleanSchemaSchema: z.ZodObject<{ + type: z.ZodLiteral<"boolean">; + title: z.ZodOptional; + description: z.ZodOptional; + default: z.ZodOptional; +}, z.core.$strip>; +/** + * Primitive schema definition for string fields. + */ +export declare const StringSchemaSchema: z.ZodObject<{ + type: z.ZodLiteral<"string">; + title: z.ZodOptional; + description: z.ZodOptional; + minLength: z.ZodOptional; + maxLength: z.ZodOptional; + format: z.ZodOptional>; + default: z.ZodOptional; +}, z.core.$strip>; +/** + * Primitive schema definition for number fields. + */ +export declare const NumberSchemaSchema: z.ZodObject<{ + type: z.ZodEnum<{ + number: "number"; + integer: "integer"; + }>; + title: z.ZodOptional; + description: z.ZodOptional; + minimum: z.ZodOptional; + maximum: z.ZodOptional; + default: z.ZodOptional; +}, z.core.$strip>; +/** + * Schema for single-selection enumeration without display titles for options. + */ +export declare const UntitledSingleSelectEnumSchemaSchema: z.ZodObject<{ + type: z.ZodLiteral<"string">; + title: z.ZodOptional; + description: z.ZodOptional; + enum: z.ZodArray; + default: z.ZodOptional; +}, z.core.$strip>; +/** + * Schema for single-selection enumeration with display titles for each option. + */ +export declare const TitledSingleSelectEnumSchemaSchema: z.ZodObject<{ + type: z.ZodLiteral<"string">; + title: z.ZodOptional; + description: z.ZodOptional; + oneOf: z.ZodArray>; + default: z.ZodOptional; +}, z.core.$strip>; +/** + * Use TitledSingleSelectEnumSchema instead. + * This interface will be removed in a future version. + */ +export declare const LegacyTitledEnumSchemaSchema: z.ZodObject<{ + type: z.ZodLiteral<"string">; + title: z.ZodOptional; + description: z.ZodOptional; + enum: z.ZodArray; + enumNames: z.ZodOptional>; + default: z.ZodOptional; +}, z.core.$strip>; +export declare const SingleSelectEnumSchemaSchema: z.ZodUnion; + title: z.ZodOptional; + description: z.ZodOptional; + enum: z.ZodArray; + default: z.ZodOptional; +}, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"string">; + title: z.ZodOptional; + description: z.ZodOptional; + oneOf: z.ZodArray>; + default: z.ZodOptional; +}, z.core.$strip>]>; +/** + * Schema for multiple-selection enumeration without display titles for options. + */ +export declare const UntitledMultiSelectEnumSchemaSchema: z.ZodObject<{ + type: z.ZodLiteral<"array">; + title: z.ZodOptional; + description: z.ZodOptional; + minItems: z.ZodOptional; + maxItems: z.ZodOptional; + items: z.ZodObject<{ + type: z.ZodLiteral<"string">; + enum: z.ZodArray; + }, z.core.$strip>; + default: z.ZodOptional>; +}, z.core.$strip>; +/** + * Schema for multiple-selection enumeration with display titles for each option. + */ +export declare const TitledMultiSelectEnumSchemaSchema: z.ZodObject<{ + type: z.ZodLiteral<"array">; + title: z.ZodOptional; + description: z.ZodOptional; + minItems: z.ZodOptional; + maxItems: z.ZodOptional; + items: z.ZodObject<{ + anyOf: z.ZodArray>; + }, z.core.$strip>; + default: z.ZodOptional>; +}, z.core.$strip>; +/** + * Combined schema for multiple-selection enumeration + */ +export declare const MultiSelectEnumSchemaSchema: z.ZodUnion; + title: z.ZodOptional; + description: z.ZodOptional; + minItems: z.ZodOptional; + maxItems: z.ZodOptional; + items: z.ZodObject<{ + type: z.ZodLiteral<"string">; + enum: z.ZodArray; + }, z.core.$strip>; + default: z.ZodOptional>; +}, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"array">; + title: z.ZodOptional; + description: z.ZodOptional; + minItems: z.ZodOptional; + maxItems: z.ZodOptional; + items: z.ZodObject<{ + anyOf: z.ZodArray>; + }, z.core.$strip>; + default: z.ZodOptional>; +}, z.core.$strip>]>; +/** + * Primitive schema definition for enum fields. + */ +export declare const EnumSchemaSchema: z.ZodUnion; + title: z.ZodOptional; + description: z.ZodOptional; + enum: z.ZodArray; + enumNames: z.ZodOptional>; + default: z.ZodOptional; +}, z.core.$strip>, z.ZodUnion; + title: z.ZodOptional; + description: z.ZodOptional; + enum: z.ZodArray; + default: z.ZodOptional; +}, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"string">; + title: z.ZodOptional; + description: z.ZodOptional; + oneOf: z.ZodArray>; + default: z.ZodOptional; +}, z.core.$strip>]>, z.ZodUnion; + title: z.ZodOptional; + description: z.ZodOptional; + minItems: z.ZodOptional; + maxItems: z.ZodOptional; + items: z.ZodObject<{ + type: z.ZodLiteral<"string">; + enum: z.ZodArray; + }, z.core.$strip>; + default: z.ZodOptional>; +}, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"array">; + title: z.ZodOptional; + description: z.ZodOptional; + minItems: z.ZodOptional; + maxItems: z.ZodOptional; + items: z.ZodObject<{ + anyOf: z.ZodArray>; + }, z.core.$strip>; + default: z.ZodOptional>; +}, z.core.$strip>]>]>; +/** + * Union of all primitive schema definitions. + */ +export declare const PrimitiveSchemaDefinitionSchema: z.ZodUnion; + title: z.ZodOptional; + description: z.ZodOptional; + enum: z.ZodArray; + enumNames: z.ZodOptional>; + default: z.ZodOptional; +}, z.core.$strip>, z.ZodUnion; + title: z.ZodOptional; + description: z.ZodOptional; + enum: z.ZodArray; + default: z.ZodOptional; +}, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"string">; + title: z.ZodOptional; + description: z.ZodOptional; + oneOf: z.ZodArray>; + default: z.ZodOptional; +}, z.core.$strip>]>, z.ZodUnion; + title: z.ZodOptional; + description: z.ZodOptional; + minItems: z.ZodOptional; + maxItems: z.ZodOptional; + items: z.ZodObject<{ + type: z.ZodLiteral<"string">; + enum: z.ZodArray; + }, z.core.$strip>; + default: z.ZodOptional>; +}, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"array">; + title: z.ZodOptional; + description: z.ZodOptional; + minItems: z.ZodOptional; + maxItems: z.ZodOptional; + items: z.ZodObject<{ + anyOf: z.ZodArray>; + }, z.core.$strip>; + default: z.ZodOptional>; +}, z.core.$strip>]>]>, z.ZodObject<{ + type: z.ZodLiteral<"boolean">; + title: z.ZodOptional; + description: z.ZodOptional; + default: z.ZodOptional; +}, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"string">; + title: z.ZodOptional; + description: z.ZodOptional; + minLength: z.ZodOptional; + maxLength: z.ZodOptional; + format: z.ZodOptional>; + default: z.ZodOptional; +}, z.core.$strip>, z.ZodObject<{ + type: z.ZodEnum<{ + number: "number"; + integer: "integer"; + }>; + title: z.ZodOptional; + description: z.ZodOptional; + minimum: z.ZodOptional; + maximum: z.ZodOptional; + default: z.ZodOptional; +}, z.core.$strip>]>; +/** + * Parameters for an `elicitation/create` request for form-based elicitation. + */ +export declare const ElicitRequestFormParamsSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + task: z.ZodOptional; + }, z.core.$strip>>; + mode: z.ZodOptional>; + message: z.ZodString; + requestedSchema: z.ZodObject<{ + type: z.ZodLiteral<"object">; + properties: z.ZodRecord; + title: z.ZodOptional; + description: z.ZodOptional; + enum: z.ZodArray; + enumNames: z.ZodOptional>; + default: z.ZodOptional; + }, z.core.$strip>, z.ZodUnion; + title: z.ZodOptional; + description: z.ZodOptional; + enum: z.ZodArray; + default: z.ZodOptional; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"string">; + title: z.ZodOptional; + description: z.ZodOptional; + oneOf: z.ZodArray>; + default: z.ZodOptional; + }, z.core.$strip>]>, z.ZodUnion; + title: z.ZodOptional; + description: z.ZodOptional; + minItems: z.ZodOptional; + maxItems: z.ZodOptional; + items: z.ZodObject<{ + type: z.ZodLiteral<"string">; + enum: z.ZodArray; + }, z.core.$strip>; + default: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"array">; + title: z.ZodOptional; + description: z.ZodOptional; + minItems: z.ZodOptional; + maxItems: z.ZodOptional; + items: z.ZodObject<{ + anyOf: z.ZodArray>; + }, z.core.$strip>; + default: z.ZodOptional>; + }, z.core.$strip>]>]>, z.ZodObject<{ + type: z.ZodLiteral<"boolean">; + title: z.ZodOptional; + description: z.ZodOptional; + default: z.ZodOptional; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"string">; + title: z.ZodOptional; + description: z.ZodOptional; + minLength: z.ZodOptional; + maxLength: z.ZodOptional; + format: z.ZodOptional>; + default: z.ZodOptional; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodEnum<{ + number: "number"; + integer: "integer"; + }>; + title: z.ZodOptional; + description: z.ZodOptional; + minimum: z.ZodOptional; + maximum: z.ZodOptional; + default: z.ZodOptional; + }, z.core.$strip>]>>; + required: z.ZodOptional>; + }, z.core.$strip>; +}, z.core.$strip>; +/** + * Parameters for an `elicitation/create` request for URL-based elicitation. + */ +export declare const ElicitRequestURLParamsSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + task: z.ZodOptional; + }, z.core.$strip>>; + mode: z.ZodLiteral<"url">; + message: z.ZodString; + elicitationId: z.ZodString; + url: z.ZodString; +}, z.core.$strip>; +/** + * The parameters for a request to elicit additional information from the user via the client. + */ +export declare const ElicitRequestParamsSchema: z.ZodUnion>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + task: z.ZodOptional; + }, z.core.$strip>>; + mode: z.ZodOptional>; + message: z.ZodString; + requestedSchema: z.ZodObject<{ + type: z.ZodLiteral<"object">; + properties: z.ZodRecord; + title: z.ZodOptional; + description: z.ZodOptional; + enum: z.ZodArray; + enumNames: z.ZodOptional>; + default: z.ZodOptional; + }, z.core.$strip>, z.ZodUnion; + title: z.ZodOptional; + description: z.ZodOptional; + enum: z.ZodArray; + default: z.ZodOptional; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"string">; + title: z.ZodOptional; + description: z.ZodOptional; + oneOf: z.ZodArray>; + default: z.ZodOptional; + }, z.core.$strip>]>, z.ZodUnion; + title: z.ZodOptional; + description: z.ZodOptional; + minItems: z.ZodOptional; + maxItems: z.ZodOptional; + items: z.ZodObject<{ + type: z.ZodLiteral<"string">; + enum: z.ZodArray; + }, z.core.$strip>; + default: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"array">; + title: z.ZodOptional; + description: z.ZodOptional; + minItems: z.ZodOptional; + maxItems: z.ZodOptional; + items: z.ZodObject<{ + anyOf: z.ZodArray>; + }, z.core.$strip>; + default: z.ZodOptional>; + }, z.core.$strip>]>]>, z.ZodObject<{ + type: z.ZodLiteral<"boolean">; + title: z.ZodOptional; + description: z.ZodOptional; + default: z.ZodOptional; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"string">; + title: z.ZodOptional; + description: z.ZodOptional; + minLength: z.ZodOptional; + maxLength: z.ZodOptional; + format: z.ZodOptional>; + default: z.ZodOptional; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodEnum<{ + number: "number"; + integer: "integer"; + }>; + title: z.ZodOptional; + description: z.ZodOptional; + minimum: z.ZodOptional; + maximum: z.ZodOptional; + default: z.ZodOptional; + }, z.core.$strip>]>>; + required: z.ZodOptional>; + }, z.core.$strip>; +}, z.core.$strip>, z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + task: z.ZodOptional; + }, z.core.$strip>>; + mode: z.ZodLiteral<"url">; + message: z.ZodString; + elicitationId: z.ZodString; + url: z.ZodString; +}, z.core.$strip>]>; +/** + * A request from the server to elicit user input via the client. + * The client should present the message and form fields to the user (form mode) + * or navigate to a URL (URL mode). + */ +export declare const ElicitRequestSchema: z.ZodObject<{ + method: z.ZodLiteral<"elicitation/create">; + params: z.ZodUnion>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + task: z.ZodOptional; + }, z.core.$strip>>; + mode: z.ZodOptional>; + message: z.ZodString; + requestedSchema: z.ZodObject<{ + type: z.ZodLiteral<"object">; + properties: z.ZodRecord; + title: z.ZodOptional; + description: z.ZodOptional; + enum: z.ZodArray; + enumNames: z.ZodOptional>; + default: z.ZodOptional; + }, z.core.$strip>, z.ZodUnion; + title: z.ZodOptional; + description: z.ZodOptional; + enum: z.ZodArray; + default: z.ZodOptional; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"string">; + title: z.ZodOptional; + description: z.ZodOptional; + oneOf: z.ZodArray>; + default: z.ZodOptional; + }, z.core.$strip>]>, z.ZodUnion; + title: z.ZodOptional; + description: z.ZodOptional; + minItems: z.ZodOptional; + maxItems: z.ZodOptional; + items: z.ZodObject<{ + type: z.ZodLiteral<"string">; + enum: z.ZodArray; + }, z.core.$strip>; + default: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"array">; + title: z.ZodOptional; + description: z.ZodOptional; + minItems: z.ZodOptional; + maxItems: z.ZodOptional; + items: z.ZodObject<{ + anyOf: z.ZodArray>; + }, z.core.$strip>; + default: z.ZodOptional>; + }, z.core.$strip>]>]>, z.ZodObject<{ + type: z.ZodLiteral<"boolean">; + title: z.ZodOptional; + description: z.ZodOptional; + default: z.ZodOptional; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"string">; + title: z.ZodOptional; + description: z.ZodOptional; + minLength: z.ZodOptional; + maxLength: z.ZodOptional; + format: z.ZodOptional>; + default: z.ZodOptional; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodEnum<{ + number: "number"; + integer: "integer"; + }>; + title: z.ZodOptional; + description: z.ZodOptional; + minimum: z.ZodOptional; + maximum: z.ZodOptional; + default: z.ZodOptional; + }, z.core.$strip>]>>; + required: z.ZodOptional>; + }, z.core.$strip>; + }, z.core.$strip>, z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + task: z.ZodOptional; + }, z.core.$strip>>; + mode: z.ZodLiteral<"url">; + message: z.ZodString; + elicitationId: z.ZodString; + url: z.ZodString; + }, z.core.$strip>]>; +}, z.core.$strip>; +/** + * Parameters for a `notifications/elicitation/complete` notification. + * + * @category notifications/elicitation/complete + */ +export declare const ElicitationCompleteNotificationParamsSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + elicitationId: z.ZodString; +}, z.core.$strip>; +/** + * A notification from the server to the client, informing it of a completion of an out-of-band elicitation request. + * + * @category notifications/elicitation/complete + */ +export declare const ElicitationCompleteNotificationSchema: z.ZodObject<{ + method: z.ZodLiteral<"notifications/elicitation/complete">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + elicitationId: z.ZodString; + }, z.core.$strip>; +}, z.core.$strip>; +/** + * The client's response to an elicitation/create request from the server. + */ +export declare const ElicitResultSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + action: z.ZodEnum<{ + cancel: "cancel"; + accept: "accept"; + decline: "decline"; + }>; + content: z.ZodPipe, z.ZodOptional]>>>>; +}, z.core.$loose>; +/** + * A reference to a resource or resource template definition. + */ +export declare const ResourceTemplateReferenceSchema: z.ZodObject<{ + type: z.ZodLiteral<"ref/resource">; + uri: z.ZodString; +}, z.core.$strip>; +/** + * @deprecated Use ResourceTemplateReferenceSchema instead + */ +export declare const ResourceReferenceSchema: z.ZodObject<{ + type: z.ZodLiteral<"ref/resource">; + uri: z.ZodString; +}, z.core.$strip>; +/** + * Identifies a prompt. + */ +export declare const PromptReferenceSchema: z.ZodObject<{ + type: z.ZodLiteral<"ref/prompt">; + name: z.ZodString; +}, z.core.$strip>; +/** + * Parameters for a `completion/complete` request. + */ +export declare const CompleteRequestParamsSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + ref: z.ZodUnion; + name: z.ZodString; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"ref/resource">; + uri: z.ZodString; + }, z.core.$strip>]>; + argument: z.ZodObject<{ + name: z.ZodString; + value: z.ZodString; + }, z.core.$strip>; + context: z.ZodOptional>; + }, z.core.$strip>>; +}, z.core.$strip>; +/** + * A request from the client to the server, to ask for completion options. + */ +export declare const CompleteRequestSchema: z.ZodObject<{ + method: z.ZodLiteral<"completion/complete">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + ref: z.ZodUnion; + name: z.ZodString; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"ref/resource">; + uri: z.ZodString; + }, z.core.$strip>]>; + argument: z.ZodObject<{ + name: z.ZodString; + value: z.ZodString; + }, z.core.$strip>; + context: z.ZodOptional>; + }, z.core.$strip>>; + }, z.core.$strip>; +}, z.core.$strip>; +export declare function assertCompleteRequestPrompt(request: CompleteRequest): asserts request is CompleteRequestPrompt; +export declare function assertCompleteRequestResourceTemplate(request: CompleteRequest): asserts request is CompleteRequestResourceTemplate; +/** + * The server's response to a completion/complete request + */ +export declare const CompleteResultSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + completion: z.ZodObject<{ + /** + * An array of completion values. Must not exceed 100 items. + */ + values: z.ZodArray; + /** + * The total number of completion options available. This can exceed the number of values actually sent in the response. + */ + total: z.ZodOptional; + /** + * Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown. + */ + hasMore: z.ZodOptional; + }, z.core.$loose>; +}, z.core.$loose>; +/** + * Represents a root directory or file that the server can operate on. + */ +export declare const RootSchema: z.ZodObject<{ + uri: z.ZodString; + name: z.ZodOptional; + _meta: z.ZodOptional>; +}, z.core.$strip>; +/** + * Sent from the server to request a list of root URIs from the client. + */ +export declare const ListRootsRequestSchema: z.ZodObject<{ + method: z.ZodLiteral<"roots/list">; + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$strip>>; +}, z.core.$strip>; +/** + * The client's response to a roots/list request from the server. + */ +export declare const ListRootsResultSchema: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + roots: z.ZodArray; + _meta: z.ZodOptional>; + }, z.core.$strip>>; +}, z.core.$loose>; +/** + * A notification from the client to the server, informing it that the list of roots has changed. + */ +export declare const RootsListChangedNotificationSchema: z.ZodObject<{ + method: z.ZodLiteral<"notifications/roots/list_changed">; + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$strip>>; +}, z.core.$strip>; +export declare const ClientRequestSchema: z.ZodUnion; + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$strip>>; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"initialize">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + protocolVersion: z.ZodString; + capabilities: z.ZodObject<{ + experimental: z.ZodOptional>>; + sampling: z.ZodOptional>; + tools: z.ZodOptional>; + }, z.core.$strip>>; + elicitation: z.ZodOptional, z.ZodIntersection; + }, z.core.$strip>, z.ZodRecord>>; + url: z.ZodOptional>; + }, z.core.$strip>, z.ZodOptional>>>>; + roots: z.ZodOptional; + }, z.core.$strip>>; + tasks: z.ZodOptional>; + /** + * Present if the client supports cancelling tasks. + */ + cancel: z.ZodOptional>; + /** + * Capabilities for task creation on specific request types. + */ + requests: z.ZodOptional>; + }, z.core.$loose>>; + /** + * Task support for elicitation requests. + */ + elicitation: z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$loose>>; + }, z.core.$loose>>; + extensions: z.ZodOptional>>; + }, z.core.$strip>; + clientInfo: z.ZodObject<{ + version: z.ZodString; + websiteUrl: z.ZodOptional; + description: z.ZodOptional; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + }, z.core.$strip>; + }, z.core.$strip>; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"completion/complete">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + ref: z.ZodUnion; + name: z.ZodString; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"ref/resource">; + uri: z.ZodString; + }, z.core.$strip>]>; + argument: z.ZodObject<{ + name: z.ZodString; + value: z.ZodString; + }, z.core.$strip>; + context: z.ZodOptional>; + }, z.core.$strip>>; + }, z.core.$strip>; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"logging/setLevel">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + level: z.ZodEnum<{ + error: "error"; + debug: "debug"; + info: "info"; + notice: "notice"; + warning: "warning"; + critical: "critical"; + alert: "alert"; + emergency: "emergency"; + }>; + }, z.core.$strip>; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"prompts/get">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + name: z.ZodString; + arguments: z.ZodOptional>; + }, z.core.$strip>; +}, z.core.$strip>, z.ZodObject<{ + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + cursor: z.ZodOptional; + }, z.core.$strip>>; + method: z.ZodLiteral<"prompts/list">; +}, z.core.$strip>, z.ZodObject<{ + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + cursor: z.ZodOptional; + }, z.core.$strip>>; + method: z.ZodLiteral<"resources/list">; +}, z.core.$strip>, z.ZodObject<{ + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + cursor: z.ZodOptional; + }, z.core.$strip>>; + method: z.ZodLiteral<"resources/templates/list">; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"resources/read">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + uri: z.ZodString; + }, z.core.$strip>; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"resources/subscribe">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + uri: z.ZodString; + }, z.core.$strip>; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"resources/unsubscribe">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + uri: z.ZodString; + }, z.core.$strip>; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"tools/call">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + task: z.ZodOptional; + }, z.core.$strip>>; + name: z.ZodString; + arguments: z.ZodOptional>; + }, z.core.$strip>; +}, z.core.$strip>, z.ZodObject<{ + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + cursor: z.ZodOptional; + }, z.core.$strip>>; + method: z.ZodLiteral<"tools/list">; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"tasks/get">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + taskId: z.ZodString; + }, z.core.$strip>; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"tasks/result">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + taskId: z.ZodString; + }, z.core.$strip>; +}, z.core.$strip>, z.ZodObject<{ + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + cursor: z.ZodOptional; + }, z.core.$strip>>; + method: z.ZodLiteral<"tasks/list">; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"tasks/cancel">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + taskId: z.ZodString; + }, z.core.$strip>; +}, z.core.$strip>]>; +export declare const ClientNotificationSchema: z.ZodUnion; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + requestId: z.ZodOptional>; + reason: z.ZodOptional; + }, z.core.$strip>; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"notifications/progress">; + params: z.ZodObject<{ + progressToken: z.ZodUnion; + progress: z.ZodNumber; + total: z.ZodOptional; + message: z.ZodOptional; + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$strip>; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"notifications/initialized">; + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$strip>>; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"notifications/roots/list_changed">; + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$strip>>; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"notifications/tasks/status">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + taskId: z.ZodString; + status: z.ZodEnum<{ + working: "working"; + input_required: "input_required"; + completed: "completed"; + failed: "failed"; + cancelled: "cancelled"; + }>; + ttl: z.ZodUnion; + createdAt: z.ZodString; + lastUpdatedAt: z.ZodString; + pollInterval: z.ZodOptional; + statusMessage: z.ZodOptional; + }, z.core.$strip>; +}, z.core.$strip>]>; +export declare const ClientResultSchema: z.ZodUnion>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; +}, z.core.$strict>, z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + model: z.ZodString; + stopReason: z.ZodOptional, z.ZodString]>>; + role: z.ZodEnum<{ + user: "user"; + assistant: "assistant"; + }>; + content: z.ZodDiscriminatedUnion<[z.ZodObject<{ + type: z.ZodLiteral<"text">; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>]>; +}, z.core.$loose>, z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + model: z.ZodString; + stopReason: z.ZodOptional, z.ZodString]>>; + role: z.ZodEnum<{ + user: "user"; + assistant: "assistant"; + }>; + content: z.ZodUnion; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"tool_use">; + name: z.ZodString; + id: z.ZodString; + input: z.ZodRecord; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"tool_result">; + toolUseId: z.ZodString; + content: z.ZodDefault; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + description: z.ZodOptional; + mimeType: z.ZodOptional; + size: z.ZodOptional; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + type: z.ZodLiteral<"resource_link">; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"resource">; + resource: z.ZodUnion; + _meta: z.ZodOptional>; + text: z.ZodString; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + mimeType: z.ZodOptional; + _meta: z.ZodOptional>; + blob: z.ZodString; + }, z.core.$strip>]>; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>]>>>; + structuredContent: z.ZodOptional>; + isError: z.ZodOptional; + _meta: z.ZodOptional>; + }, z.core.$strip>]>, z.ZodArray; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"tool_use">; + name: z.ZodString; + id: z.ZodString; + input: z.ZodRecord; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"tool_result">; + toolUseId: z.ZodString; + content: z.ZodDefault; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + description: z.ZodOptional; + mimeType: z.ZodOptional; + size: z.ZodOptional; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + type: z.ZodLiteral<"resource_link">; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"resource">; + resource: z.ZodUnion; + _meta: z.ZodOptional>; + text: z.ZodString; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + mimeType: z.ZodOptional; + _meta: z.ZodOptional>; + blob: z.ZodString; + }, z.core.$strip>]>; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>]>>>; + structuredContent: z.ZodOptional>; + isError: z.ZodOptional; + _meta: z.ZodOptional>; + }, z.core.$strip>]>>]>; +}, z.core.$loose>, z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + action: z.ZodEnum<{ + cancel: "cancel"; + accept: "accept"; + decline: "decline"; + }>; + content: z.ZodPipe, z.ZodOptional]>>>>; +}, z.core.$loose>, z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + roots: z.ZodArray; + _meta: z.ZodOptional>; + }, z.core.$strip>>; +}, z.core.$loose>, z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + taskId: z.ZodString; + status: z.ZodEnum<{ + working: "working"; + input_required: "input_required"; + completed: "completed"; + failed: "failed"; + cancelled: "cancelled"; + }>; + ttl: z.ZodUnion; + createdAt: z.ZodString; + lastUpdatedAt: z.ZodString; + pollInterval: z.ZodOptional; + statusMessage: z.ZodOptional; +}, z.core.$strip>, z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + nextCursor: z.ZodOptional; + tasks: z.ZodArray; + ttl: z.ZodUnion; + createdAt: z.ZodString; + lastUpdatedAt: z.ZodString; + pollInterval: z.ZodOptional; + statusMessage: z.ZodOptional; + }, z.core.$strip>>; +}, z.core.$loose>, z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + task: z.ZodObject<{ + taskId: z.ZodString; + status: z.ZodEnum<{ + working: "working"; + input_required: "input_required"; + completed: "completed"; + failed: "failed"; + cancelled: "cancelled"; + }>; + ttl: z.ZodUnion; + createdAt: z.ZodString; + lastUpdatedAt: z.ZodString; + pollInterval: z.ZodOptional; + statusMessage: z.ZodOptional; + }, z.core.$strip>; +}, z.core.$loose>]>; +export declare const ServerRequestSchema: z.ZodUnion; + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$strip>>; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"sampling/createMessage">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + task: z.ZodOptional; + }, z.core.$strip>>; + messages: z.ZodArray; + content: z.ZodUnion; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"tool_use">; + name: z.ZodString; + id: z.ZodString; + input: z.ZodRecord; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"tool_result">; + toolUseId: z.ZodString; + content: z.ZodDefault; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + description: z.ZodOptional; + mimeType: z.ZodOptional; + size: z.ZodOptional; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + type: z.ZodLiteral<"resource_link">; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"resource">; + resource: z.ZodUnion; + _meta: z.ZodOptional>; + text: z.ZodString; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + mimeType: z.ZodOptional; + _meta: z.ZodOptional>; + blob: z.ZodString; + }, z.core.$strip>]>; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>]>>>; + structuredContent: z.ZodOptional>; + isError: z.ZodOptional; + _meta: z.ZodOptional>; + }, z.core.$strip>]>, z.ZodArray; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"tool_use">; + name: z.ZodString; + id: z.ZodString; + input: z.ZodRecord; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"tool_result">; + toolUseId: z.ZodString; + content: z.ZodDefault; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + description: z.ZodOptional; + mimeType: z.ZodOptional; + size: z.ZodOptional; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + type: z.ZodLiteral<"resource_link">; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"resource">; + resource: z.ZodUnion; + _meta: z.ZodOptional>; + text: z.ZodString; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + mimeType: z.ZodOptional; + _meta: z.ZodOptional>; + blob: z.ZodString; + }, z.core.$strip>]>; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>]>>>; + structuredContent: z.ZodOptional>; + isError: z.ZodOptional; + _meta: z.ZodOptional>; + }, z.core.$strip>]>>]>; + _meta: z.ZodOptional>; + }, z.core.$strip>>; + modelPreferences: z.ZodOptional; + }, z.core.$strip>>>; + costPriority: z.ZodOptional; + speedPriority: z.ZodOptional; + intelligencePriority: z.ZodOptional; + }, z.core.$strip>>; + systemPrompt: z.ZodOptional; + includeContext: z.ZodOptional>; + temperature: z.ZodOptional; + maxTokens: z.ZodNumber; + stopSequences: z.ZodOptional>; + metadata: z.ZodOptional>; + tools: z.ZodOptional; + inputSchema: z.ZodObject<{ + type: z.ZodLiteral<"object">; + properties: z.ZodOptional>>; + required: z.ZodOptional>; + }, z.core.$catchall>; + outputSchema: z.ZodOptional; + properties: z.ZodOptional>>; + required: z.ZodOptional>; + }, z.core.$catchall>>; + annotations: z.ZodOptional; + readOnlyHint: z.ZodOptional; + destructiveHint: z.ZodOptional; + idempotentHint: z.ZodOptional; + openWorldHint: z.ZodOptional; + }, z.core.$strip>>; + execution: z.ZodOptional>; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + }, z.core.$strip>>>; + toolChoice: z.ZodOptional>; + }, z.core.$strip>>; + }, z.core.$strip>; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"elicitation/create">; + params: z.ZodUnion>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + task: z.ZodOptional; + }, z.core.$strip>>; + mode: z.ZodOptional>; + message: z.ZodString; + requestedSchema: z.ZodObject<{ + type: z.ZodLiteral<"object">; + properties: z.ZodRecord; + title: z.ZodOptional; + description: z.ZodOptional; + enum: z.ZodArray; + enumNames: z.ZodOptional>; + default: z.ZodOptional; + }, z.core.$strip>, z.ZodUnion; + title: z.ZodOptional; + description: z.ZodOptional; + enum: z.ZodArray; + default: z.ZodOptional; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"string">; + title: z.ZodOptional; + description: z.ZodOptional; + oneOf: z.ZodArray>; + default: z.ZodOptional; + }, z.core.$strip>]>, z.ZodUnion; + title: z.ZodOptional; + description: z.ZodOptional; + minItems: z.ZodOptional; + maxItems: z.ZodOptional; + items: z.ZodObject<{ + type: z.ZodLiteral<"string">; + enum: z.ZodArray; + }, z.core.$strip>; + default: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"array">; + title: z.ZodOptional; + description: z.ZodOptional; + minItems: z.ZodOptional; + maxItems: z.ZodOptional; + items: z.ZodObject<{ + anyOf: z.ZodArray>; + }, z.core.$strip>; + default: z.ZodOptional>; + }, z.core.$strip>]>]>, z.ZodObject<{ + type: z.ZodLiteral<"boolean">; + title: z.ZodOptional; + description: z.ZodOptional; + default: z.ZodOptional; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"string">; + title: z.ZodOptional; + description: z.ZodOptional; + minLength: z.ZodOptional; + maxLength: z.ZodOptional; + format: z.ZodOptional>; + default: z.ZodOptional; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodEnum<{ + number: "number"; + integer: "integer"; + }>; + title: z.ZodOptional; + description: z.ZodOptional; + minimum: z.ZodOptional; + maximum: z.ZodOptional; + default: z.ZodOptional; + }, z.core.$strip>]>>; + required: z.ZodOptional>; + }, z.core.$strip>; + }, z.core.$strip>, z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + task: z.ZodOptional; + }, z.core.$strip>>; + mode: z.ZodLiteral<"url">; + message: z.ZodString; + elicitationId: z.ZodString; + url: z.ZodString; + }, z.core.$strip>]>; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"roots/list">; + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$strip>>; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"tasks/get">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + taskId: z.ZodString; + }, z.core.$strip>; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"tasks/result">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + taskId: z.ZodString; + }, z.core.$strip>; +}, z.core.$strip>, z.ZodObject<{ + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + cursor: z.ZodOptional; + }, z.core.$strip>>; + method: z.ZodLiteral<"tasks/list">; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"tasks/cancel">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + taskId: z.ZodString; + }, z.core.$strip>; +}, z.core.$strip>]>; +export declare const ServerNotificationSchema: z.ZodUnion; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + requestId: z.ZodOptional>; + reason: z.ZodOptional; + }, z.core.$strip>; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"notifications/progress">; + params: z.ZodObject<{ + progressToken: z.ZodUnion; + progress: z.ZodNumber; + total: z.ZodOptional; + message: z.ZodOptional; + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$strip>; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"notifications/message">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + level: z.ZodEnum<{ + error: "error"; + debug: "debug"; + info: "info"; + notice: "notice"; + warning: "warning"; + critical: "critical"; + alert: "alert"; + emergency: "emergency"; + }>; + logger: z.ZodOptional; + data: z.ZodUnknown; + }, z.core.$strip>; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"notifications/resources/updated">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + uri: z.ZodString; + }, z.core.$strip>; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"notifications/resources/list_changed">; + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$strip>>; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"notifications/tools/list_changed">; + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$strip>>; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"notifications/prompts/list_changed">; + params: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$strip>>; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"notifications/tasks/status">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + taskId: z.ZodString; + status: z.ZodEnum<{ + working: "working"; + input_required: "input_required"; + completed: "completed"; + failed: "failed"; + cancelled: "cancelled"; + }>; + ttl: z.ZodUnion; + createdAt: z.ZodString; + lastUpdatedAt: z.ZodString; + pollInterval: z.ZodOptional; + statusMessage: z.ZodOptional; + }, z.core.$strip>; +}, z.core.$strip>, z.ZodObject<{ + method: z.ZodLiteral<"notifications/elicitation/complete">; + params: z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + elicitationId: z.ZodString; + }, z.core.$strip>; +}, z.core.$strip>]>; +export declare const ServerResultSchema: z.ZodUnion>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; +}, z.core.$strict>, z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + protocolVersion: z.ZodString; + capabilities: z.ZodObject<{ + experimental: z.ZodOptional>>; + logging: z.ZodOptional>; + completions: z.ZodOptional>; + prompts: z.ZodOptional; + }, z.core.$strip>>; + resources: z.ZodOptional; + listChanged: z.ZodOptional; + }, z.core.$strip>>; + tools: z.ZodOptional; + }, z.core.$strip>>; + tasks: z.ZodOptional>; + /** + * Present if the server supports cancelling tasks. + */ + cancel: z.ZodOptional>; + /** + * Capabilities for task creation on specific request types. + */ + requests: z.ZodOptional>; + }, z.core.$loose>>; + }, z.core.$loose>>; + }, z.core.$loose>>; + extensions: z.ZodOptional>>; + }, z.core.$strip>; + serverInfo: z.ZodObject<{ + version: z.ZodString; + websiteUrl: z.ZodOptional; + description: z.ZodOptional; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + }, z.core.$strip>; + instructions: z.ZodOptional; +}, z.core.$loose>, z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + completion: z.ZodObject<{ + /** + * An array of completion values. Must not exceed 100 items. + */ + values: z.ZodArray; + /** + * The total number of completion options available. This can exceed the number of values actually sent in the response. + */ + total: z.ZodOptional; + /** + * Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown. + */ + hasMore: z.ZodOptional; + }, z.core.$loose>; +}, z.core.$loose>, z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + description: z.ZodOptional; + messages: z.ZodArray; + content: z.ZodUnion; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + description: z.ZodOptional; + mimeType: z.ZodOptional; + size: z.ZodOptional; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + type: z.ZodLiteral<"resource_link">; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"resource">; + resource: z.ZodUnion; + _meta: z.ZodOptional>; + text: z.ZodString; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + mimeType: z.ZodOptional; + _meta: z.ZodOptional>; + blob: z.ZodString; + }, z.core.$strip>]>; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>]>; + }, z.core.$strip>>; +}, z.core.$loose>, z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + nextCursor: z.ZodOptional; + prompts: z.ZodArray; + arguments: z.ZodOptional; + required: z.ZodOptional; + }, z.core.$strip>>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + }, z.core.$strip>>; +}, z.core.$loose>, z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + nextCursor: z.ZodOptional; + resources: z.ZodArray; + mimeType: z.ZodOptional; + size: z.ZodOptional; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + }, z.core.$strip>>; +}, z.core.$loose>, z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + nextCursor: z.ZodOptional; + resourceTemplates: z.ZodArray; + mimeType: z.ZodOptional; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + }, z.core.$strip>>; +}, z.core.$loose>, z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + contents: z.ZodArray; + _meta: z.ZodOptional>; + text: z.ZodString; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + mimeType: z.ZodOptional; + _meta: z.ZodOptional>; + blob: z.ZodString; + }, z.core.$strip>]>>; +}, z.core.$loose>, z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + content: z.ZodDefault; + text: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"image">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"audio">; + data: z.ZodString; + mimeType: z.ZodString; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + description: z.ZodOptional; + mimeType: z.ZodOptional; + size: z.ZodOptional; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + type: z.ZodLiteral<"resource_link">; + }, z.core.$strip>, z.ZodObject<{ + type: z.ZodLiteral<"resource">; + resource: z.ZodUnion; + _meta: z.ZodOptional>; + text: z.ZodString; + }, z.core.$strip>, z.ZodObject<{ + uri: z.ZodString; + mimeType: z.ZodOptional; + _meta: z.ZodOptional>; + blob: z.ZodString; + }, z.core.$strip>]>; + annotations: z.ZodOptional>>; + priority: z.ZodOptional; + lastModified: z.ZodOptional; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + }, z.core.$strip>]>>>; + structuredContent: z.ZodOptional>; + isError: z.ZodOptional; +}, z.core.$loose>, z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + nextCursor: z.ZodOptional; + tools: z.ZodArray; + inputSchema: z.ZodObject<{ + type: z.ZodLiteral<"object">; + properties: z.ZodOptional>>; + required: z.ZodOptional>; + }, z.core.$catchall>; + outputSchema: z.ZodOptional; + properties: z.ZodOptional>>; + required: z.ZodOptional>; + }, z.core.$catchall>>; + annotations: z.ZodOptional; + readOnlyHint: z.ZodOptional; + destructiveHint: z.ZodOptional; + idempotentHint: z.ZodOptional; + openWorldHint: z.ZodOptional; + }, z.core.$strip>>; + execution: z.ZodOptional>; + }, z.core.$strip>>; + _meta: z.ZodOptional>; + icons: z.ZodOptional; + sizes: z.ZodOptional>; + theme: z.ZodOptional>; + }, z.core.$strip>>>; + name: z.ZodString; + title: z.ZodOptional; + }, z.core.$strip>>; +}, z.core.$loose>, z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + taskId: z.ZodString; + status: z.ZodEnum<{ + working: "working"; + input_required: "input_required"; + completed: "completed"; + failed: "failed"; + cancelled: "cancelled"; + }>; + ttl: z.ZodUnion; + createdAt: z.ZodString; + lastUpdatedAt: z.ZodString; + pollInterval: z.ZodOptional; + statusMessage: z.ZodOptional; +}, z.core.$strip>, z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + nextCursor: z.ZodOptional; + tasks: z.ZodArray; + ttl: z.ZodUnion; + createdAt: z.ZodString; + lastUpdatedAt: z.ZodString; + pollInterval: z.ZodOptional; + statusMessage: z.ZodOptional; + }, z.core.$strip>>; +}, z.core.$loose>, z.ZodObject<{ + _meta: z.ZodOptional>; + /** + * If specified, this request is related to the provided task. + */ + "io.modelcontextprotocol/related-task": z.ZodOptional>; + }, z.core.$loose>>; + task: z.ZodObject<{ + taskId: z.ZodString; + status: z.ZodEnum<{ + working: "working"; + input_required: "input_required"; + completed: "completed"; + failed: "failed"; + cancelled: "cancelled"; + }>; + ttl: z.ZodUnion; + createdAt: z.ZodString; + lastUpdatedAt: z.ZodString; + pollInterval: z.ZodOptional; + statusMessage: z.ZodOptional; + }, z.core.$strip>; +}, z.core.$loose>]>; +export declare class McpError extends Error { + readonly code: number; + readonly data?: unknown; + constructor(code: number, message: string, data?: unknown); + /** + * Factory method to create the appropriate error type based on the error code and data + */ + static fromError(code: number, message: string, data?: unknown): McpError; +} +/** + * Specialized error type when a tool requires a URL mode elicitation. + * This makes it nicer for the client to handle since there is specific data to work with instead of just a code to check against. + */ +export declare class UrlElicitationRequiredError extends McpError { + constructor(elicitations: ElicitRequestURLParams[], message?: string); + get elicitations(): ElicitRequestURLParams[]; +} +type Primitive = string | number | boolean | bigint | null | undefined; +type Flatten = T extends Primitive ? T : T extends Array ? Array> : T extends Set ? Set> : T extends Map ? Map, Flatten> : T extends object ? { + [K in keyof T]: Flatten; +} : T; +type Infer = Flatten>; +/** + * Headers that are compatible with both Node.js and the browser. + */ +export type IsomorphicHeaders = Record; +/** + * Information about the incoming request. + */ +export interface RequestInfo { + /** + * The headers of the request. + */ + headers: IsomorphicHeaders; + /** + * The full URL of the request. + */ + url?: URL; +} +/** + * Extra information about a message. + */ +export interface MessageExtraInfo { + /** + * The request information. + */ + requestInfo?: RequestInfo; + /** + * The authentication information. + */ + authInfo?: AuthInfo; + /** + * Callback to close the SSE stream for this request, triggering client reconnection. + * Only available when using StreamableHTTPServerTransport with eventStore configured. + */ + closeSSEStream?: () => void; + /** + * Callback to close the standalone GET SSE stream, triggering client reconnection. + * Only available when using StreamableHTTPServerTransport with eventStore configured. + */ + closeStandaloneSSEStream?: () => void; +} +export type ProgressToken = Infer; +export type Cursor = Infer; +export type Request = Infer; +export type TaskAugmentedRequestParams = Infer; +export type RequestMeta = Infer; +export type Notification = Infer; +export type Result = Infer; +export type RequestId = Infer; +export type JSONRPCRequest = Infer; +export type JSONRPCNotification = Infer; +export type JSONRPCResponse = Infer; +export type JSONRPCErrorResponse = Infer; +/** + * @deprecated Use {@link JSONRPCErrorResponse} instead. + * + * Please note that spec types have renamed {@link JSONRPCError} to {@link JSONRPCErrorResponse} as per the updated JSON-RPC specification. (was previously just {@link JSONRPCError}) and future versions will remove {@link JSONRPCError}. + */ +export type JSONRPCError = JSONRPCErrorResponse; +export type JSONRPCResultResponse = Infer; +export type JSONRPCMessage = Infer; +export type RequestParams = Infer; +export type NotificationParams = Infer; +export type EmptyResult = Infer; +export type CancelledNotificationParams = Infer; +export type CancelledNotification = Infer; +export type Icon = Infer; +export type Icons = Infer; +export type BaseMetadata = Infer; +export type Annotations = Infer; +export type Role = Infer; +export type Implementation = Infer; +export type ClientCapabilities = Infer; +export type InitializeRequestParams = Infer; +export type InitializeRequest = Infer; +export type ServerCapabilities = Infer; +export type InitializeResult = Infer; +export type InitializedNotification = Infer; +export type PingRequest = Infer; +export type Progress = Infer; +export type ProgressNotificationParams = Infer; +export type ProgressNotification = Infer; +export type Task = Infer; +export type TaskStatus = Infer; +export type TaskCreationParams = Infer; +export type TaskMetadata = Infer; +export type RelatedTaskMetadata = Infer; +export type CreateTaskResult = Infer; +export type TaskStatusNotificationParams = Infer; +export type TaskStatusNotification = Infer; +export type GetTaskRequest = Infer; +export type GetTaskResult = Infer; +export type GetTaskPayloadRequest = Infer; +export type ListTasksRequest = Infer; +export type ListTasksResult = Infer; +export type CancelTaskRequest = Infer; +export type CancelTaskResult = Infer; +export type GetTaskPayloadResult = Infer; +export type PaginatedRequestParams = Infer; +export type PaginatedRequest = Infer; +export type PaginatedResult = Infer; +export type ResourceContents = Infer; +export type TextResourceContents = Infer; +export type BlobResourceContents = Infer; +export type Resource = Infer; +export type ResourceTemplate = Infer; +export type ListResourcesRequest = Infer; +export type ListResourcesResult = Infer; +export type ListResourceTemplatesRequest = Infer; +export type ListResourceTemplatesResult = Infer; +export type ResourceRequestParams = Infer; +export type ReadResourceRequestParams = Infer; +export type ReadResourceRequest = Infer; +export type ReadResourceResult = Infer; +export type ResourceListChangedNotification = Infer; +export type SubscribeRequestParams = Infer; +export type SubscribeRequest = Infer; +export type UnsubscribeRequestParams = Infer; +export type UnsubscribeRequest = Infer; +export type ResourceUpdatedNotificationParams = Infer; +export type ResourceUpdatedNotification = Infer; +export type PromptArgument = Infer; +export type Prompt = Infer; +export type ListPromptsRequest = Infer; +export type ListPromptsResult = Infer; +export type GetPromptRequestParams = Infer; +export type GetPromptRequest = Infer; +export type TextContent = Infer; +export type ImageContent = Infer; +export type AudioContent = Infer; +export type ToolUseContent = Infer; +export type ToolResultContent = Infer; +export type EmbeddedResource = Infer; +export type ResourceLink = Infer; +export type ContentBlock = Infer; +export type PromptMessage = Infer; +export type GetPromptResult = Infer; +export type PromptListChangedNotification = Infer; +export type ToolAnnotations = Infer; +export type ToolExecution = Infer; +export type Tool = Infer; +export type ListToolsRequest = Infer; +export type ListToolsResult = Infer; +export type CallToolRequestParams = Infer; +export type CallToolResult = Infer; +export type CompatibilityCallToolResult = Infer; +export type CallToolRequest = Infer; +export type ToolListChangedNotification = Infer; +export type LoggingLevel = Infer; +export type SetLevelRequestParams = Infer; +export type SetLevelRequest = Infer; +export type LoggingMessageNotificationParams = Infer; +export type LoggingMessageNotification = Infer; +export type ToolChoice = Infer; +export type ModelHint = Infer; +export type ModelPreferences = Infer; +export type SamplingContent = Infer; +export type SamplingMessageContentBlock = Infer; +export type SamplingMessage = Infer; +export type CreateMessageRequestParams = Infer; +export type CreateMessageRequest = Infer; +export type CreateMessageResult = Infer; +export type CreateMessageResultWithTools = Infer; +/** + * CreateMessageRequestParams without tools - for backwards-compatible overload. + * Excludes tools/toolChoice to indicate they should not be provided. + */ +export type CreateMessageRequestParamsBase = Omit; +/** + * CreateMessageRequestParams with required tools - for tool-enabled overload. + */ +export interface CreateMessageRequestParamsWithTools extends CreateMessageRequestParams { + tools: Tool[]; +} +export type BooleanSchema = Infer; +export type StringSchema = Infer; +export type NumberSchema = Infer; +export type EnumSchema = Infer; +export type UntitledSingleSelectEnumSchema = Infer; +export type TitledSingleSelectEnumSchema = Infer; +export type LegacyTitledEnumSchema = Infer; +export type UntitledMultiSelectEnumSchema = Infer; +export type TitledMultiSelectEnumSchema = Infer; +export type SingleSelectEnumSchema = Infer; +export type MultiSelectEnumSchema = Infer; +export type PrimitiveSchemaDefinition = Infer; +export type ElicitRequestParams = Infer; +export type ElicitRequestFormParams = Infer; +export type ElicitRequestURLParams = Infer; +export type ElicitRequest = Infer; +export type ElicitationCompleteNotificationParams = Infer; +export type ElicitationCompleteNotification = Infer; +export type ElicitResult = Infer; +export type ResourceTemplateReference = Infer; +/** + * @deprecated Use ResourceTemplateReference instead + */ +export type ResourceReference = ResourceTemplateReference; +export type PromptReference = Infer; +export type CompleteRequestParams = Infer; +export type CompleteRequest = Infer; +export type CompleteRequestResourceTemplate = ExpandRecursively; +export type CompleteRequestPrompt = ExpandRecursively; +export type CompleteResult = Infer; +export type Root = Infer; +export type ListRootsRequest = Infer; +export type ListRootsResult = Infer; +export type RootsListChangedNotification = Infer; +export type ClientRequest = Infer; +export type ClientNotification = Infer; +export type ClientResult = Infer; +export type ServerRequest = Infer; +export type ServerNotification = Infer; +export type ServerResult = Infer; +export {}; +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/types.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/types.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..116e46004f6c945e35e734e00350fc82602c0d7d --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/types.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,eAAO,MAAM,uBAAuB,eAAe,CAAC;AACpD,eAAO,MAAM,mCAAmC,eAAe,CAAC;AAChE,eAAO,MAAM,2BAA2B,UAAoF,CAAC;AAE7H,eAAO,MAAM,qBAAqB,yCAAyC,CAAC;AAG5E,eAAO,MAAM,eAAe,QAAQ,CAAC;AAErC;;GAEG;AACH,KAAK,iBAAiB,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;AAO7H;;GAEG;AACH,eAAO,MAAM,mBAAmB,iDAA0C,CAAC;AAE3E;;GAEG;AACH,eAAO,MAAM,YAAY,aAAa,CAAC;AAEvC;;GAEG;AACH,eAAO,MAAM,wBAAwB;IACjC;;OAEG;;IAGH;;OAEG;;iBAEL,CAAC;AAEH,eAAO,MAAM,kBAAkB;;iBAE7B,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,yBAAyB;;iBAEpC,CAAC;AAEH,QAAA,MAAM,iBAAiB;IACnB;;OAEG;;IAEH;;OAEG;;;;iBAEL,CAAC;AAEH;;GAEG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,kBAAkB,CAAC,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js new file mode 100644 index 0000000000000000000000000000000000000000..866da3e68ca0ace1c524e8dcbd9d1370a9e39b84 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js @@ -0,0 +1,2065 @@ +import * as z from 'zod/v4'; +export const LATEST_PROTOCOL_VERSION = '2025-11-25'; +export const DEFAULT_NEGOTIATED_PROTOCOL_VERSION = '2025-03-26'; +export const SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, '2025-06-18', '2025-03-26', '2024-11-05', '2024-10-07']; +export const RELATED_TASK_META_KEY = 'io.modelcontextprotocol/related-task'; +/* JSON-RPC types */ +export const JSONRPC_VERSION = '2.0'; +/** + * Assert 'object' type schema. + * + * @internal + */ +const AssertObjectSchema = z.custom((v) => v !== null && (typeof v === 'object' || typeof v === 'function')); +/** + * A progress token, used to associate progress notifications with the original request. + */ +export const ProgressTokenSchema = z.union([z.string(), z.number().int()]); +/** + * An opaque token used to represent a cursor for pagination. + */ +export const CursorSchema = z.string(); +/** + * Task creation parameters, used to ask that the server create a task to represent a request. + */ +export const TaskCreationParamsSchema = z.looseObject({ + /** + * Requested duration in milliseconds to retain task from creation. + */ + ttl: z.number().optional(), + /** + * Time in milliseconds to wait between task status requests. + */ + pollInterval: z.number().optional() +}); +export const TaskMetadataSchema = z.object({ + ttl: z.number().optional() +}); +/** + * Metadata for associating messages with a task. + * Include this in the `_meta` field under the key `io.modelcontextprotocol/related-task`. + */ +export const RelatedTaskMetadataSchema = z.object({ + taskId: z.string() +}); +const RequestMetaSchema = z.looseObject({ + /** + * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications. + */ + progressToken: ProgressTokenSchema.optional(), + /** + * If specified, this request is related to the provided task. + */ + [RELATED_TASK_META_KEY]: RelatedTaskMetadataSchema.optional() +}); +/** + * Common params for any request. + */ +const BaseRequestParamsSchema = z.object({ + /** + * See [General fields: `_meta`](/specification/draft/basic/index#meta) for notes on `_meta` usage. + */ + _meta: RequestMetaSchema.optional() +}); +/** + * Common params for any task-augmented request. + */ +export const TaskAugmentedRequestParamsSchema = BaseRequestParamsSchema.extend({ + /** + * If specified, the caller is requesting task-augmented execution for this request. + * The request will return a CreateTaskResult immediately, and the actual result can be + * retrieved later via tasks/result. + * + * Task augmentation is subject to capability negotiation - receivers MUST declare support + * for task augmentation of specific request types in their capabilities. + */ + task: TaskMetadataSchema.optional() +}); +/** + * Checks if a value is a valid TaskAugmentedRequestParams. + * @param value - The value to check. + * + * @returns True if the value is a valid TaskAugmentedRequestParams, false otherwise. + */ +export const isTaskAugmentedRequestParams = (value) => TaskAugmentedRequestParamsSchema.safeParse(value).success; +export const RequestSchema = z.object({ + method: z.string(), + params: BaseRequestParamsSchema.loose().optional() +}); +const NotificationsParamsSchema = z.object({ + /** + * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) + * for notes on _meta usage. + */ + _meta: RequestMetaSchema.optional() +}); +export const NotificationSchema = z.object({ + method: z.string(), + params: NotificationsParamsSchema.loose().optional() +}); +export const ResultSchema = z.looseObject({ + /** + * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) + * for notes on _meta usage. + */ + _meta: RequestMetaSchema.optional() +}); +/** + * A uniquely identifying ID for a request in JSON-RPC. + */ +export const RequestIdSchema = z.union([z.string(), z.number().int()]); +/** + * A request that expects a response. + */ +export const JSONRPCRequestSchema = z + .object({ + jsonrpc: z.literal(JSONRPC_VERSION), + id: RequestIdSchema, + ...RequestSchema.shape +}) + .strict(); +export const isJSONRPCRequest = (value) => JSONRPCRequestSchema.safeParse(value).success; +/** + * A notification which does not expect a response. + */ +export const JSONRPCNotificationSchema = z + .object({ + jsonrpc: z.literal(JSONRPC_VERSION), + ...NotificationSchema.shape +}) + .strict(); +export const isJSONRPCNotification = (value) => JSONRPCNotificationSchema.safeParse(value).success; +/** + * A successful (non-error) response to a request. + */ +export const JSONRPCResultResponseSchema = z + .object({ + jsonrpc: z.literal(JSONRPC_VERSION), + id: RequestIdSchema, + result: ResultSchema +}) + .strict(); +/** + * Checks if a value is a valid JSONRPCResultResponse. + * @param value - The value to check. + * + * @returns True if the value is a valid JSONRPCResultResponse, false otherwise. + */ +export const isJSONRPCResultResponse = (value) => JSONRPCResultResponseSchema.safeParse(value).success; +/** + * @deprecated Use {@link isJSONRPCResultResponse} instead. + * + * Please note that {@link JSONRPCResponse} is a union of {@link JSONRPCResultResponse} and {@link JSONRPCErrorResponse} as per the updated JSON-RPC specification. (was previously just {@link JSONRPCResultResponse}) + */ +export const isJSONRPCResponse = isJSONRPCResultResponse; +/** + * Error codes defined by the JSON-RPC specification. + */ +export var ErrorCode; +(function (ErrorCode) { + // SDK error codes + ErrorCode[ErrorCode["ConnectionClosed"] = -32000] = "ConnectionClosed"; + ErrorCode[ErrorCode["RequestTimeout"] = -32001] = "RequestTimeout"; + // Standard JSON-RPC error codes + ErrorCode[ErrorCode["ParseError"] = -32700] = "ParseError"; + ErrorCode[ErrorCode["InvalidRequest"] = -32600] = "InvalidRequest"; + ErrorCode[ErrorCode["MethodNotFound"] = -32601] = "MethodNotFound"; + ErrorCode[ErrorCode["InvalidParams"] = -32602] = "InvalidParams"; + ErrorCode[ErrorCode["InternalError"] = -32603] = "InternalError"; + // MCP-specific error codes + ErrorCode[ErrorCode["UrlElicitationRequired"] = -32042] = "UrlElicitationRequired"; +})(ErrorCode || (ErrorCode = {})); +/** + * A response to a request that indicates an error occurred. + */ +export const JSONRPCErrorResponseSchema = z + .object({ + jsonrpc: z.literal(JSONRPC_VERSION), + id: RequestIdSchema.optional(), + error: z.object({ + /** + * The error type that occurred. + */ + code: z.number().int(), + /** + * A short description of the error. The message SHOULD be limited to a concise single sentence. + */ + message: z.string(), + /** + * Additional information about the error. The value of this member is defined by the sender (e.g. detailed error information, nested errors etc.). + */ + data: z.unknown().optional() + }) +}) + .strict(); +/** + * @deprecated Use {@link JSONRPCErrorResponseSchema} instead. + */ +export const JSONRPCErrorSchema = JSONRPCErrorResponseSchema; +/** + * Checks if a value is a valid JSONRPCErrorResponse. + * @param value - The value to check. + * + * @returns True if the value is a valid JSONRPCErrorResponse, false otherwise. + */ +export const isJSONRPCErrorResponse = (value) => JSONRPCErrorResponseSchema.safeParse(value).success; +/** + * @deprecated Use {@link isJSONRPCErrorResponse} instead. + */ +export const isJSONRPCError = isJSONRPCErrorResponse; +export const JSONRPCMessageSchema = z.union([ + JSONRPCRequestSchema, + JSONRPCNotificationSchema, + JSONRPCResultResponseSchema, + JSONRPCErrorResponseSchema +]); +export const JSONRPCResponseSchema = z.union([JSONRPCResultResponseSchema, JSONRPCErrorResponseSchema]); +/* Empty result */ +/** + * A response that indicates success but carries no data. + */ +export const EmptyResultSchema = ResultSchema.strict(); +export const CancelledNotificationParamsSchema = NotificationsParamsSchema.extend({ + /** + * The ID of the request to cancel. + * + * This MUST correspond to the ID of a request previously issued in the same direction. + */ + requestId: RequestIdSchema.optional(), + /** + * An optional string describing the reason for the cancellation. This MAY be logged or presented to the user. + */ + reason: z.string().optional() +}); +/* Cancellation */ +/** + * This notification can be sent by either side to indicate that it is cancelling a previously-issued request. + * + * The request SHOULD still be in-flight, but due to communication latency, it is always possible that this notification MAY arrive after the request has already finished. + * + * This notification indicates that the result will be unused, so any associated processing SHOULD cease. + * + * A client MUST NOT attempt to cancel its `initialize` request. + */ +export const CancelledNotificationSchema = NotificationSchema.extend({ + method: z.literal('notifications/cancelled'), + params: CancelledNotificationParamsSchema +}); +/* Base Metadata */ +/** + * Icon schema for use in tools, prompts, resources, and implementations. + */ +export const IconSchema = z.object({ + /** + * URL or data URI for the icon. + */ + src: z.string(), + /** + * Optional MIME type for the icon. + */ + mimeType: z.string().optional(), + /** + * Optional array of strings that specify sizes at which the icon can be used. + * Each string should be in WxH format (e.g., `"48x48"`, `"96x96"`) or `"any"` for scalable formats like SVG. + * + * If not provided, the client should assume that the icon can be used at any size. + */ + sizes: z.array(z.string()).optional(), + /** + * Optional specifier for the theme this icon is designed for. `light` indicates + * the icon is designed to be used with a light background, and `dark` indicates + * the icon is designed to be used with a dark background. + * + * If not provided, the client should assume the icon can be used with any theme. + */ + theme: z.enum(['light', 'dark']).optional() +}); +/** + * Base schema to add `icons` property. + * + */ +export const IconsSchema = z.object({ + /** + * Optional set of sized icons that the client can display in a user interface. + * + * Clients that support rendering icons MUST support at least the following MIME types: + * - `image/png` - PNG images (safe, universal compatibility) + * - `image/jpeg` (and `image/jpg`) - JPEG images (safe, universal compatibility) + * + * Clients that support rendering icons SHOULD also support: + * - `image/svg+xml` - SVG images (scalable but requires security precautions) + * - `image/webp` - WebP images (modern, efficient format) + */ + icons: z.array(IconSchema).optional() +}); +/** + * Base metadata interface for common properties across resources, tools, prompts, and implementations. + */ +export const BaseMetadataSchema = z.object({ + /** Intended for programmatic or logical use, but used as a display name in past specs or fallback */ + name: z.string(), + /** + * Intended for UI and end-user contexts — optimized to be human-readable and easily understood, + * even by those unfamiliar with domain-specific terminology. + * + * If not provided, the name should be used for display (except for Tool, + * where `annotations.title` should be given precedence over using `name`, + * if present). + */ + title: z.string().optional() +}); +/* Initialization */ +/** + * Describes the name and version of an MCP implementation. + */ +export const ImplementationSchema = BaseMetadataSchema.extend({ + ...BaseMetadataSchema.shape, + ...IconsSchema.shape, + version: z.string(), + /** + * An optional URL of the website for this implementation. + */ + websiteUrl: z.string().optional(), + /** + * An optional human-readable description of what this implementation does. + * + * This can be used by clients or servers to provide context about their purpose + * and capabilities. For example, a server might describe the types of resources + * or tools it provides, while a client might describe its intended use case. + */ + description: z.string().optional() +}); +const FormElicitationCapabilitySchema = z.intersection(z.object({ + applyDefaults: z.boolean().optional() +}), z.record(z.string(), z.unknown())); +const ElicitationCapabilitySchema = z.preprocess(value => { + if (value && typeof value === 'object' && !Array.isArray(value)) { + if (Object.keys(value).length === 0) { + return { form: {} }; + } + } + return value; +}, z.intersection(z.object({ + form: FormElicitationCapabilitySchema.optional(), + url: AssertObjectSchema.optional() +}), z.record(z.string(), z.unknown()).optional())); +/** + * Task capabilities for clients, indicating which request types support task creation. + */ +export const ClientTasksCapabilitySchema = z.looseObject({ + /** + * Present if the client supports listing tasks. + */ + list: AssertObjectSchema.optional(), + /** + * Present if the client supports cancelling tasks. + */ + cancel: AssertObjectSchema.optional(), + /** + * Capabilities for task creation on specific request types. + */ + requests: z + .looseObject({ + /** + * Task support for sampling requests. + */ + sampling: z + .looseObject({ + createMessage: AssertObjectSchema.optional() + }) + .optional(), + /** + * Task support for elicitation requests. + */ + elicitation: z + .looseObject({ + create: AssertObjectSchema.optional() + }) + .optional() + }) + .optional() +}); +/** + * Task capabilities for servers, indicating which request types support task creation. + */ +export const ServerTasksCapabilitySchema = z.looseObject({ + /** + * Present if the server supports listing tasks. + */ + list: AssertObjectSchema.optional(), + /** + * Present if the server supports cancelling tasks. + */ + cancel: AssertObjectSchema.optional(), + /** + * Capabilities for task creation on specific request types. + */ + requests: z + .looseObject({ + /** + * Task support for tool requests. + */ + tools: z + .looseObject({ + call: AssertObjectSchema.optional() + }) + .optional() + }) + .optional() +}); +/** + * Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities. + */ +export const ClientCapabilitiesSchema = z.object({ + /** + * Experimental, non-standard capabilities that the client supports. + */ + experimental: z.record(z.string(), AssertObjectSchema).optional(), + /** + * Present if the client supports sampling from an LLM. + */ + sampling: z + .object({ + /** + * Present if the client supports context inclusion via includeContext parameter. + * If not declared, servers SHOULD only use `includeContext: "none"` (or omit it). + */ + context: AssertObjectSchema.optional(), + /** + * Present if the client supports tool use via tools and toolChoice parameters. + */ + tools: AssertObjectSchema.optional() + }) + .optional(), + /** + * Present if the client supports eliciting user input. + */ + elicitation: ElicitationCapabilitySchema.optional(), + /** + * Present if the client supports listing roots. + */ + roots: z + .object({ + /** + * Whether the client supports issuing notifications for changes to the roots list. + */ + listChanged: z.boolean().optional() + }) + .optional(), + /** + * Present if the client supports task creation. + */ + tasks: ClientTasksCapabilitySchema.optional(), + /** + * Extensions that the client supports. Keys are extension identifiers (vendor-prefix/extension-name). + */ + extensions: z.record(z.string(), AssertObjectSchema).optional() +}); +export const InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({ + /** + * The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well. + */ + protocolVersion: z.string(), + capabilities: ClientCapabilitiesSchema, + clientInfo: ImplementationSchema +}); +/** + * This request is sent from the client to the server when it first connects, asking it to begin initialization. + */ +export const InitializeRequestSchema = RequestSchema.extend({ + method: z.literal('initialize'), + params: InitializeRequestParamsSchema +}); +export const isInitializeRequest = (value) => InitializeRequestSchema.safeParse(value).success; +/** + * Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities. + */ +export const ServerCapabilitiesSchema = z.object({ + /** + * Experimental, non-standard capabilities that the server supports. + */ + experimental: z.record(z.string(), AssertObjectSchema).optional(), + /** + * Present if the server supports sending log messages to the client. + */ + logging: AssertObjectSchema.optional(), + /** + * Present if the server supports sending completions to the client. + */ + completions: AssertObjectSchema.optional(), + /** + * Present if the server offers any prompt templates. + */ + prompts: z + .object({ + /** + * Whether this server supports issuing notifications for changes to the prompt list. + */ + listChanged: z.boolean().optional() + }) + .optional(), + /** + * Present if the server offers any resources to read. + */ + resources: z + .object({ + /** + * Whether this server supports clients subscribing to resource updates. + */ + subscribe: z.boolean().optional(), + /** + * Whether this server supports issuing notifications for changes to the resource list. + */ + listChanged: z.boolean().optional() + }) + .optional(), + /** + * Present if the server offers any tools to call. + */ + tools: z + .object({ + /** + * Whether this server supports issuing notifications for changes to the tool list. + */ + listChanged: z.boolean().optional() + }) + .optional(), + /** + * Present if the server supports task creation. + */ + tasks: ServerTasksCapabilitySchema.optional(), + /** + * Extensions that the server supports. Keys are extension identifiers (vendor-prefix/extension-name). + */ + extensions: z.record(z.string(), AssertObjectSchema).optional() +}); +/** + * After receiving an initialize request from the client, the server sends this response. + */ +export const InitializeResultSchema = ResultSchema.extend({ + /** + * The version of the Model Context Protocol that the server wants to use. This may not match the version that the client requested. If the client cannot support this version, it MUST disconnect. + */ + protocolVersion: z.string(), + capabilities: ServerCapabilitiesSchema, + serverInfo: ImplementationSchema, + /** + * Instructions describing how to use the server and its features. + * + * This can be used by clients to improve the LLM's understanding of available tools, resources, etc. It can be thought of like a "hint" to the model. For example, this information MAY be added to the system prompt. + */ + instructions: z.string().optional() +}); +/** + * This notification is sent from the client to the server after initialization has finished. + */ +export const InitializedNotificationSchema = NotificationSchema.extend({ + method: z.literal('notifications/initialized'), + params: NotificationsParamsSchema.optional() +}); +export const isInitializedNotification = (value) => InitializedNotificationSchema.safeParse(value).success; +/* Ping */ +/** + * A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected. + */ +export const PingRequestSchema = RequestSchema.extend({ + method: z.literal('ping'), + params: BaseRequestParamsSchema.optional() +}); +/* Progress notifications */ +export const ProgressSchema = z.object({ + /** + * The progress thus far. This should increase every time progress is made, even if the total is unknown. + */ + progress: z.number(), + /** + * Total number of items to process (or total progress required), if known. + */ + total: z.optional(z.number()), + /** + * An optional message describing the current progress. + */ + message: z.optional(z.string()) +}); +export const ProgressNotificationParamsSchema = z.object({ + ...NotificationsParamsSchema.shape, + ...ProgressSchema.shape, + /** + * The progress token which was given in the initial request, used to associate this notification with the request that is proceeding. + */ + progressToken: ProgressTokenSchema +}); +/** + * An out-of-band notification used to inform the receiver of a progress update for a long-running request. + * + * @category notifications/progress + */ +export const ProgressNotificationSchema = NotificationSchema.extend({ + method: z.literal('notifications/progress'), + params: ProgressNotificationParamsSchema +}); +export const PaginatedRequestParamsSchema = BaseRequestParamsSchema.extend({ + /** + * An opaque token representing the current pagination position. + * If provided, the server should return results starting after this cursor. + */ + cursor: CursorSchema.optional() +}); +/* Pagination */ +export const PaginatedRequestSchema = RequestSchema.extend({ + params: PaginatedRequestParamsSchema.optional() +}); +export const PaginatedResultSchema = ResultSchema.extend({ + /** + * An opaque token representing the pagination position after the last returned result. + * If present, there may be more results available. + */ + nextCursor: CursorSchema.optional() +}); +/** + * The status of a task. + * */ +export const TaskStatusSchema = z.enum(['working', 'input_required', 'completed', 'failed', 'cancelled']); +/* Tasks */ +/** + * A pollable state object associated with a request. + */ +export const TaskSchema = z.object({ + taskId: z.string(), + status: TaskStatusSchema, + /** + * Time in milliseconds to keep task results available after completion. + * If null, the task has unlimited lifetime until manually cleaned up. + */ + ttl: z.union([z.number(), z.null()]), + /** + * ISO 8601 timestamp when the task was created. + */ + createdAt: z.string(), + /** + * ISO 8601 timestamp when the task was last updated. + */ + lastUpdatedAt: z.string(), + pollInterval: z.optional(z.number()), + /** + * Optional diagnostic message for failed tasks or other status information. + */ + statusMessage: z.optional(z.string()) +}); +/** + * Result returned when a task is created, containing the task data wrapped in a task field. + */ +export const CreateTaskResultSchema = ResultSchema.extend({ + task: TaskSchema +}); +/** + * Parameters for task status notification. + */ +export const TaskStatusNotificationParamsSchema = NotificationsParamsSchema.merge(TaskSchema); +/** + * A notification sent when a task's status changes. + */ +export const TaskStatusNotificationSchema = NotificationSchema.extend({ + method: z.literal('notifications/tasks/status'), + params: TaskStatusNotificationParamsSchema +}); +/** + * A request to get the state of a specific task. + */ +export const GetTaskRequestSchema = RequestSchema.extend({ + method: z.literal('tasks/get'), + params: BaseRequestParamsSchema.extend({ + taskId: z.string() + }) +}); +/** + * The response to a tasks/get request. + */ +export const GetTaskResultSchema = ResultSchema.merge(TaskSchema); +/** + * A request to get the result of a specific task. + */ +export const GetTaskPayloadRequestSchema = RequestSchema.extend({ + method: z.literal('tasks/result'), + params: BaseRequestParamsSchema.extend({ + taskId: z.string() + }) +}); +/** + * The response to a tasks/result request. + * The structure matches the result type of the original request. + * For example, a tools/call task would return the CallToolResult structure. + * + */ +export const GetTaskPayloadResultSchema = ResultSchema.loose(); +/** + * A request to list tasks. + */ +export const ListTasksRequestSchema = PaginatedRequestSchema.extend({ + method: z.literal('tasks/list') +}); +/** + * The response to a tasks/list request. + */ +export const ListTasksResultSchema = PaginatedResultSchema.extend({ + tasks: z.array(TaskSchema) +}); +/** + * A request to cancel a specific task. + */ +export const CancelTaskRequestSchema = RequestSchema.extend({ + method: z.literal('tasks/cancel'), + params: BaseRequestParamsSchema.extend({ + taskId: z.string() + }) +}); +/** + * The response to a tasks/cancel request. + */ +export const CancelTaskResultSchema = ResultSchema.merge(TaskSchema); +/* Resources */ +/** + * The contents of a specific resource or sub-resource. + */ +export const ResourceContentsSchema = z.object({ + /** + * The URI of this resource. + */ + uri: z.string(), + /** + * The MIME type of this resource, if known. + */ + mimeType: z.optional(z.string()), + /** + * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) + * for notes on _meta usage. + */ + _meta: z.record(z.string(), z.unknown()).optional() +}); +export const TextResourceContentsSchema = ResourceContentsSchema.extend({ + /** + * The text of the item. This must only be set if the item can actually be represented as text (not binary data). + */ + text: z.string() +}); +/** + * A Zod schema for validating Base64 strings that is more performant and + * robust for very large inputs than the default regex-based check. It avoids + * stack overflows by using the native `atob` function for validation. + */ +const Base64Schema = z.string().refine(val => { + try { + // atob throws a DOMException if the string contains characters + // that are not part of the Base64 character set. + atob(val); + return true; + } + catch { + return false; + } +}, { message: 'Invalid Base64 string' }); +export const BlobResourceContentsSchema = ResourceContentsSchema.extend({ + /** + * A base64-encoded string representing the binary data of the item. + */ + blob: Base64Schema +}); +/** + * The sender or recipient of messages and data in a conversation. + */ +export const RoleSchema = z.enum(['user', 'assistant']); +/** + * Optional annotations providing clients additional context about a resource. + */ +export const AnnotationsSchema = z.object({ + /** + * Intended audience(s) for the resource. + */ + audience: z.array(RoleSchema).optional(), + /** + * Importance hint for the resource, from 0 (least) to 1 (most). + */ + priority: z.number().min(0).max(1).optional(), + /** + * ISO 8601 timestamp for the most recent modification. + */ + lastModified: z.iso.datetime({ offset: true }).optional() +}); +/** + * A known resource that the server is capable of reading. + */ +export const ResourceSchema = z.object({ + ...BaseMetadataSchema.shape, + ...IconsSchema.shape, + /** + * The URI of this resource. + */ + uri: z.string(), + /** + * A description of what this resource represents. + * + * This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model. + */ + description: z.optional(z.string()), + /** + * The MIME type of this resource, if known. + */ + mimeType: z.optional(z.string()), + /** + * The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known. + * + * This can be used by Hosts to display file sizes and estimate context window usage. + */ + size: z.optional(z.number()), + /** + * Optional annotations for the client. + */ + annotations: AnnotationsSchema.optional(), + /** + * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) + * for notes on _meta usage. + */ + _meta: z.optional(z.looseObject({})) +}); +/** + * A template description for resources available on the server. + */ +export const ResourceTemplateSchema = z.object({ + ...BaseMetadataSchema.shape, + ...IconsSchema.shape, + /** + * A URI template (according to RFC 6570) that can be used to construct resource URIs. + */ + uriTemplate: z.string(), + /** + * A description of what this template is for. + * + * This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model. + */ + description: z.optional(z.string()), + /** + * The MIME type for all resources that match this template. This should only be included if all resources matching this template have the same type. + */ + mimeType: z.optional(z.string()), + /** + * Optional annotations for the client. + */ + annotations: AnnotationsSchema.optional(), + /** + * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) + * for notes on _meta usage. + */ + _meta: z.optional(z.looseObject({})) +}); +/** + * Sent from the client to request a list of resources the server has. + */ +export const ListResourcesRequestSchema = PaginatedRequestSchema.extend({ + method: z.literal('resources/list') +}); +/** + * The server's response to a resources/list request from the client. + */ +export const ListResourcesResultSchema = PaginatedResultSchema.extend({ + resources: z.array(ResourceSchema) +}); +/** + * Sent from the client to request a list of resource templates the server has. + */ +export const ListResourceTemplatesRequestSchema = PaginatedRequestSchema.extend({ + method: z.literal('resources/templates/list') +}); +/** + * The server's response to a resources/templates/list request from the client. + */ +export const ListResourceTemplatesResultSchema = PaginatedResultSchema.extend({ + resourceTemplates: z.array(ResourceTemplateSchema) +}); +export const ResourceRequestParamsSchema = BaseRequestParamsSchema.extend({ + /** + * The URI of the resource to read. The URI can use any protocol; it is up to the server how to interpret it. + * + * @format uri + */ + uri: z.string() +}); +/** + * Parameters for a `resources/read` request. + */ +export const ReadResourceRequestParamsSchema = ResourceRequestParamsSchema; +/** + * Sent from the client to the server, to read a specific resource URI. + */ +export const ReadResourceRequestSchema = RequestSchema.extend({ + method: z.literal('resources/read'), + params: ReadResourceRequestParamsSchema +}); +/** + * The server's response to a resources/read request from the client. + */ +export const ReadResourceResultSchema = ResultSchema.extend({ + contents: z.array(z.union([TextResourceContentsSchema, BlobResourceContentsSchema])) +}); +/** + * An optional notification from the server to the client, informing it that the list of resources it can read from has changed. This may be issued by servers without any previous subscription from the client. + */ +export const ResourceListChangedNotificationSchema = NotificationSchema.extend({ + method: z.literal('notifications/resources/list_changed'), + params: NotificationsParamsSchema.optional() +}); +export const SubscribeRequestParamsSchema = ResourceRequestParamsSchema; +/** + * Sent from the client to request resources/updated notifications from the server whenever a particular resource changes. + */ +export const SubscribeRequestSchema = RequestSchema.extend({ + method: z.literal('resources/subscribe'), + params: SubscribeRequestParamsSchema +}); +export const UnsubscribeRequestParamsSchema = ResourceRequestParamsSchema; +/** + * Sent from the client to request cancellation of resources/updated notifications from the server. This should follow a previous resources/subscribe request. + */ +export const UnsubscribeRequestSchema = RequestSchema.extend({ + method: z.literal('resources/unsubscribe'), + params: UnsubscribeRequestParamsSchema +}); +/** + * Parameters for a `notifications/resources/updated` notification. + */ +export const ResourceUpdatedNotificationParamsSchema = NotificationsParamsSchema.extend({ + /** + * The URI of the resource that has been updated. This might be a sub-resource of the one that the client actually subscribed to. + */ + uri: z.string() +}); +/** + * A notification from the server to the client, informing it that a resource has changed and may need to be read again. This should only be sent if the client previously sent a resources/subscribe request. + */ +export const ResourceUpdatedNotificationSchema = NotificationSchema.extend({ + method: z.literal('notifications/resources/updated'), + params: ResourceUpdatedNotificationParamsSchema +}); +/* Prompts */ +/** + * Describes an argument that a prompt can accept. + */ +export const PromptArgumentSchema = z.object({ + /** + * The name of the argument. + */ + name: z.string(), + /** + * A human-readable description of the argument. + */ + description: z.optional(z.string()), + /** + * Whether this argument must be provided. + */ + required: z.optional(z.boolean()) +}); +/** + * A prompt or prompt template that the server offers. + */ +export const PromptSchema = z.object({ + ...BaseMetadataSchema.shape, + ...IconsSchema.shape, + /** + * An optional description of what this prompt provides + */ + description: z.optional(z.string()), + /** + * A list of arguments to use for templating the prompt. + */ + arguments: z.optional(z.array(PromptArgumentSchema)), + /** + * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) + * for notes on _meta usage. + */ + _meta: z.optional(z.looseObject({})) +}); +/** + * Sent from the client to request a list of prompts and prompt templates the server has. + */ +export const ListPromptsRequestSchema = PaginatedRequestSchema.extend({ + method: z.literal('prompts/list') +}); +/** + * The server's response to a prompts/list request from the client. + */ +export const ListPromptsResultSchema = PaginatedResultSchema.extend({ + prompts: z.array(PromptSchema) +}); +/** + * Parameters for a `prompts/get` request. + */ +export const GetPromptRequestParamsSchema = BaseRequestParamsSchema.extend({ + /** + * The name of the prompt or prompt template. + */ + name: z.string(), + /** + * Arguments to use for templating the prompt. + */ + arguments: z.record(z.string(), z.string()).optional() +}); +/** + * Used by the client to get a prompt provided by the server. + */ +export const GetPromptRequestSchema = RequestSchema.extend({ + method: z.literal('prompts/get'), + params: GetPromptRequestParamsSchema +}); +/** + * Text provided to or from an LLM. + */ +export const TextContentSchema = z.object({ + type: z.literal('text'), + /** + * The text content of the message. + */ + text: z.string(), + /** + * Optional annotations for the client. + */ + annotations: AnnotationsSchema.optional(), + /** + * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) + * for notes on _meta usage. + */ + _meta: z.record(z.string(), z.unknown()).optional() +}); +/** + * An image provided to or from an LLM. + */ +export const ImageContentSchema = z.object({ + type: z.literal('image'), + /** + * The base64-encoded image data. + */ + data: Base64Schema, + /** + * The MIME type of the image. Different providers may support different image types. + */ + mimeType: z.string(), + /** + * Optional annotations for the client. + */ + annotations: AnnotationsSchema.optional(), + /** + * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) + * for notes on _meta usage. + */ + _meta: z.record(z.string(), z.unknown()).optional() +}); +/** + * An Audio provided to or from an LLM. + */ +export const AudioContentSchema = z.object({ + type: z.literal('audio'), + /** + * The base64-encoded audio data. + */ + data: Base64Schema, + /** + * The MIME type of the audio. Different providers may support different audio types. + */ + mimeType: z.string(), + /** + * Optional annotations for the client. + */ + annotations: AnnotationsSchema.optional(), + /** + * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) + * for notes on _meta usage. + */ + _meta: z.record(z.string(), z.unknown()).optional() +}); +/** + * A tool call request from an assistant (LLM). + * Represents the assistant's request to use a tool. + */ +export const ToolUseContentSchema = z.object({ + type: z.literal('tool_use'), + /** + * The name of the tool to invoke. + * Must match a tool name from the request's tools array. + */ + name: z.string(), + /** + * Unique identifier for this tool call. + * Used to correlate with ToolResultContent in subsequent messages. + */ + id: z.string(), + /** + * Arguments to pass to the tool. + * Must conform to the tool's inputSchema. + */ + input: z.record(z.string(), z.unknown()), + /** + * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) + * for notes on _meta usage. + */ + _meta: z.record(z.string(), z.unknown()).optional() +}); +/** + * The contents of a resource, embedded into a prompt or tool call result. + */ +export const EmbeddedResourceSchema = z.object({ + type: z.literal('resource'), + resource: z.union([TextResourceContentsSchema, BlobResourceContentsSchema]), + /** + * Optional annotations for the client. + */ + annotations: AnnotationsSchema.optional(), + /** + * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) + * for notes on _meta usage. + */ + _meta: z.record(z.string(), z.unknown()).optional() +}); +/** + * A resource that the server is capable of reading, included in a prompt or tool call result. + * + * Note: resource links returned by tools are not guaranteed to appear in the results of `resources/list` requests. + */ +export const ResourceLinkSchema = ResourceSchema.extend({ + type: z.literal('resource_link') +}); +/** + * A content block that can be used in prompts and tool results. + */ +export const ContentBlockSchema = z.union([ + TextContentSchema, + ImageContentSchema, + AudioContentSchema, + ResourceLinkSchema, + EmbeddedResourceSchema +]); +/** + * Describes a message returned as part of a prompt. + */ +export const PromptMessageSchema = z.object({ + role: RoleSchema, + content: ContentBlockSchema +}); +/** + * The server's response to a prompts/get request from the client. + */ +export const GetPromptResultSchema = ResultSchema.extend({ + /** + * An optional description for the prompt. + */ + description: z.string().optional(), + messages: z.array(PromptMessageSchema) +}); +/** + * An optional notification from the server to the client, informing it that the list of prompts it offers has changed. This may be issued by servers without any previous subscription from the client. + */ +export const PromptListChangedNotificationSchema = NotificationSchema.extend({ + method: z.literal('notifications/prompts/list_changed'), + params: NotificationsParamsSchema.optional() +}); +/* Tools */ +/** + * Additional properties describing a Tool to clients. + * + * NOTE: all properties in ToolAnnotations are **hints**. + * They are not guaranteed to provide a faithful description of + * tool behavior (including descriptive properties like `title`). + * + * Clients should never make tool use decisions based on ToolAnnotations + * received from untrusted servers. + */ +export const ToolAnnotationsSchema = z.object({ + /** + * A human-readable title for the tool. + */ + title: z.string().optional(), + /** + * If true, the tool does not modify its environment. + * + * Default: false + */ + readOnlyHint: z.boolean().optional(), + /** + * If true, the tool may perform destructive updates to its environment. + * If false, the tool performs only additive updates. + * + * (This property is meaningful only when `readOnlyHint == false`) + * + * Default: true + */ + destructiveHint: z.boolean().optional(), + /** + * If true, calling the tool repeatedly with the same arguments + * will have no additional effect on the its environment. + * + * (This property is meaningful only when `readOnlyHint == false`) + * + * Default: false + */ + idempotentHint: z.boolean().optional(), + /** + * If true, this tool may interact with an "open world" of external + * entities. If false, the tool's domain of interaction is closed. + * For example, the world of a web search tool is open, whereas that + * of a memory tool is not. + * + * Default: true + */ + openWorldHint: z.boolean().optional() +}); +/** + * Execution-related properties for a tool. + */ +export const ToolExecutionSchema = z.object({ + /** + * Indicates the tool's preference for task-augmented execution. + * - "required": Clients MUST invoke the tool as a task + * - "optional": Clients MAY invoke the tool as a task or normal request + * - "forbidden": Clients MUST NOT attempt to invoke the tool as a task + * + * If not present, defaults to "forbidden". + */ + taskSupport: z.enum(['required', 'optional', 'forbidden']).optional() +}); +/** + * Definition for a tool the client can call. + */ +export const ToolSchema = z.object({ + ...BaseMetadataSchema.shape, + ...IconsSchema.shape, + /** + * A human-readable description of the tool. + */ + description: z.string().optional(), + /** + * A JSON Schema 2020-12 object defining the expected parameters for the tool. + * Must have type: 'object' at the root level per MCP spec. + */ + inputSchema: z + .object({ + type: z.literal('object'), + properties: z.record(z.string(), AssertObjectSchema).optional(), + required: z.array(z.string()).optional() + }) + .catchall(z.unknown()), + /** + * An optional JSON Schema 2020-12 object defining the structure of the tool's output + * returned in the structuredContent field of a CallToolResult. + * Must have type: 'object' at the root level per MCP spec. + */ + outputSchema: z + .object({ + type: z.literal('object'), + properties: z.record(z.string(), AssertObjectSchema).optional(), + required: z.array(z.string()).optional() + }) + .catchall(z.unknown()) + .optional(), + /** + * Optional additional tool information. + */ + annotations: ToolAnnotationsSchema.optional(), + /** + * Execution-related properties for this tool. + */ + execution: ToolExecutionSchema.optional(), + /** + * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) + * for notes on _meta usage. + */ + _meta: z.record(z.string(), z.unknown()).optional() +}); +/** + * Sent from the client to request a list of tools the server has. + */ +export const ListToolsRequestSchema = PaginatedRequestSchema.extend({ + method: z.literal('tools/list') +}); +/** + * The server's response to a tools/list request from the client. + */ +export const ListToolsResultSchema = PaginatedResultSchema.extend({ + tools: z.array(ToolSchema) +}); +/** + * The server's response to a tool call. + */ +export const CallToolResultSchema = ResultSchema.extend({ + /** + * A list of content objects that represent the result of the tool call. + * + * If the Tool does not define an outputSchema, this field MUST be present in the result. + * For backwards compatibility, this field is always present, but it may be empty. + */ + content: z.array(ContentBlockSchema).default([]), + /** + * An object containing structured tool output. + * + * If the Tool defines an outputSchema, this field MUST be present in the result, and contain a JSON object that matches the schema. + */ + structuredContent: z.record(z.string(), z.unknown()).optional(), + /** + * Whether the tool call ended in an error. + * + * If not set, this is assumed to be false (the call was successful). + * + * Any errors that originate from the tool SHOULD be reported inside the result + * object, with `isError` set to true, _not_ as an MCP protocol-level error + * response. Otherwise, the LLM would not be able to see that an error occurred + * and self-correct. + * + * However, any errors in _finding_ the tool, an error indicating that the + * server does not support tool calls, or any other exceptional conditions, + * should be reported as an MCP error response. + */ + isError: z.boolean().optional() +}); +/** + * CallToolResultSchema extended with backwards compatibility to protocol version 2024-10-07. + */ +export const CompatibilityCallToolResultSchema = CallToolResultSchema.or(ResultSchema.extend({ + toolResult: z.unknown() +})); +/** + * Parameters for a `tools/call` request. + */ +export const CallToolRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({ + /** + * The name of the tool to call. + */ + name: z.string(), + /** + * Arguments to pass to the tool. + */ + arguments: z.record(z.string(), z.unknown()).optional() +}); +/** + * Used by the client to invoke a tool provided by the server. + */ +export const CallToolRequestSchema = RequestSchema.extend({ + method: z.literal('tools/call'), + params: CallToolRequestParamsSchema +}); +/** + * An optional notification from the server to the client, informing it that the list of tools it offers has changed. This may be issued by servers without any previous subscription from the client. + */ +export const ToolListChangedNotificationSchema = NotificationSchema.extend({ + method: z.literal('notifications/tools/list_changed'), + params: NotificationsParamsSchema.optional() +}); +/** + * Base schema for list changed subscription options (without callback). + * Used internally for Zod validation of autoRefresh and debounceMs. + */ +export const ListChangedOptionsBaseSchema = z.object({ + /** + * If true, the list will be refreshed automatically when a list changed notification is received. + * The callback will be called with the updated list. + * + * If false, the callback will be called with null items, allowing manual refresh. + * + * @default true + */ + autoRefresh: z.boolean().default(true), + /** + * Debounce time in milliseconds for list changed notification processing. + * + * Multiple notifications received within this timeframe will only trigger one refresh. + * Set to 0 to disable debouncing. + * + * @default 300 + */ + debounceMs: z.number().int().nonnegative().default(300) +}); +/* Logging */ +/** + * The severity of a log message. + */ +export const LoggingLevelSchema = z.enum(['debug', 'info', 'notice', 'warning', 'error', 'critical', 'alert', 'emergency']); +/** + * Parameters for a `logging/setLevel` request. + */ +export const SetLevelRequestParamsSchema = BaseRequestParamsSchema.extend({ + /** + * The level of logging that the client wants to receive from the server. The server should send all logs at this level and higher (i.e., more severe) to the client as notifications/logging/message. + */ + level: LoggingLevelSchema +}); +/** + * A request from the client to the server, to enable or adjust logging. + */ +export const SetLevelRequestSchema = RequestSchema.extend({ + method: z.literal('logging/setLevel'), + params: SetLevelRequestParamsSchema +}); +/** + * Parameters for a `notifications/message` notification. + */ +export const LoggingMessageNotificationParamsSchema = NotificationsParamsSchema.extend({ + /** + * The severity of this log message. + */ + level: LoggingLevelSchema, + /** + * An optional name of the logger issuing this message. + */ + logger: z.string().optional(), + /** + * The data to be logged, such as a string message or an object. Any JSON serializable type is allowed here. + */ + data: z.unknown() +}); +/** + * Notification of a log message passed from server to client. If no logging/setLevel request has been sent from the client, the server MAY decide which messages to send automatically. + */ +export const LoggingMessageNotificationSchema = NotificationSchema.extend({ + method: z.literal('notifications/message'), + params: LoggingMessageNotificationParamsSchema +}); +/* Sampling */ +/** + * Hints to use for model selection. + */ +export const ModelHintSchema = z.object({ + /** + * A hint for a model name. + */ + name: z.string().optional() +}); +/** + * The server's preferences for model selection, requested of the client during sampling. + */ +export const ModelPreferencesSchema = z.object({ + /** + * Optional hints to use for model selection. + */ + hints: z.array(ModelHintSchema).optional(), + /** + * How much to prioritize cost when selecting a model. + */ + costPriority: z.number().min(0).max(1).optional(), + /** + * How much to prioritize sampling speed (latency) when selecting a model. + */ + speedPriority: z.number().min(0).max(1).optional(), + /** + * How much to prioritize intelligence and capabilities when selecting a model. + */ + intelligencePriority: z.number().min(0).max(1).optional() +}); +/** + * Controls tool usage behavior in sampling requests. + */ +export const ToolChoiceSchema = z.object({ + /** + * Controls when tools are used: + * - "auto": Model decides whether to use tools (default) + * - "required": Model MUST use at least one tool before completing + * - "none": Model MUST NOT use any tools + */ + mode: z.enum(['auto', 'required', 'none']).optional() +}); +/** + * The result of a tool execution, provided by the user (server). + * Represents the outcome of invoking a tool requested via ToolUseContent. + */ +export const ToolResultContentSchema = z.object({ + type: z.literal('tool_result'), + toolUseId: z.string().describe('The unique identifier for the corresponding tool call.'), + content: z.array(ContentBlockSchema).default([]), + structuredContent: z.object({}).loose().optional(), + isError: z.boolean().optional(), + /** + * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) + * for notes on _meta usage. + */ + _meta: z.record(z.string(), z.unknown()).optional() +}); +/** + * Basic content types for sampling responses (without tool use). + * Used for backwards-compatible CreateMessageResult when tools are not used. + */ +export const SamplingContentSchema = z.discriminatedUnion('type', [TextContentSchema, ImageContentSchema, AudioContentSchema]); +/** + * Content block types allowed in sampling messages. + * This includes text, image, audio, tool use requests, and tool results. + */ +export const SamplingMessageContentBlockSchema = z.discriminatedUnion('type', [ + TextContentSchema, + ImageContentSchema, + AudioContentSchema, + ToolUseContentSchema, + ToolResultContentSchema +]); +/** + * Describes a message issued to or received from an LLM API. + */ +export const SamplingMessageSchema = z.object({ + role: RoleSchema, + content: z.union([SamplingMessageContentBlockSchema, z.array(SamplingMessageContentBlockSchema)]), + /** + * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) + * for notes on _meta usage. + */ + _meta: z.record(z.string(), z.unknown()).optional() +}); +/** + * Parameters for a `sampling/createMessage` request. + */ +export const CreateMessageRequestParamsSchema = TaskAugmentedRequestParamsSchema.extend({ + messages: z.array(SamplingMessageSchema), + /** + * The server's preferences for which model to select. The client MAY modify or omit this request. + */ + modelPreferences: ModelPreferencesSchema.optional(), + /** + * An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt. + */ + systemPrompt: z.string().optional(), + /** + * A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. + * The client MAY ignore this request. + * + * Default is "none". Values "thisServer" and "allServers" are soft-deprecated. Servers SHOULD only use these values if the client + * declares ClientCapabilities.sampling.context. These values may be removed in future spec releases. + */ + includeContext: z.enum(['none', 'thisServer', 'allServers']).optional(), + temperature: z.number().optional(), + /** + * The requested maximum number of tokens to sample (to prevent runaway completions). + * + * The client MAY choose to sample fewer tokens than the requested maximum. + */ + maxTokens: z.number().int(), + stopSequences: z.array(z.string()).optional(), + /** + * Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific. + */ + metadata: AssertObjectSchema.optional(), + /** + * Tools that the model may use during generation. + * The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared. + */ + tools: z.array(ToolSchema).optional(), + /** + * Controls how the model uses tools. + * The client MUST return an error if this field is provided but ClientCapabilities.sampling.tools is not declared. + * Default is `{ mode: "auto" }`. + */ + toolChoice: ToolChoiceSchema.optional() +}); +/** + * A request from the server to sample an LLM via the client. The client has full discretion over which model to select. The client should also inform the user before beginning sampling, to allow them to inspect the request (human in the loop) and decide whether to approve it. + */ +export const CreateMessageRequestSchema = RequestSchema.extend({ + method: z.literal('sampling/createMessage'), + params: CreateMessageRequestParamsSchema +}); +/** + * The client's response to a sampling/create_message request from the server. + * This is the backwards-compatible version that returns single content (no arrays). + * Used when the request does not include tools. + */ +export const CreateMessageResultSchema = ResultSchema.extend({ + /** + * The name of the model that generated the message. + */ + model: z.string(), + /** + * The reason why sampling stopped, if known. + * + * Standard values: + * - "endTurn": Natural end of the assistant's turn + * - "stopSequence": A stop sequence was encountered + * - "maxTokens": Maximum token limit was reached + * + * This field is an open string to allow for provider-specific stop reasons. + */ + stopReason: z.optional(z.enum(['endTurn', 'stopSequence', 'maxTokens']).or(z.string())), + role: RoleSchema, + /** + * Response content. Single content block (text, image, or audio). + */ + content: SamplingContentSchema +}); +/** + * The client's response to a sampling/create_message request when tools were provided. + * This version supports array content for tool use flows. + */ +export const CreateMessageResultWithToolsSchema = ResultSchema.extend({ + /** + * The name of the model that generated the message. + */ + model: z.string(), + /** + * The reason why sampling stopped, if known. + * + * Standard values: + * - "endTurn": Natural end of the assistant's turn + * - "stopSequence": A stop sequence was encountered + * - "maxTokens": Maximum token limit was reached + * - "toolUse": The model wants to use one or more tools + * + * This field is an open string to allow for provider-specific stop reasons. + */ + stopReason: z.optional(z.enum(['endTurn', 'stopSequence', 'maxTokens', 'toolUse']).or(z.string())), + role: RoleSchema, + /** + * Response content. May be a single block or array. May include ToolUseContent if stopReason is "toolUse". + */ + content: z.union([SamplingMessageContentBlockSchema, z.array(SamplingMessageContentBlockSchema)]) +}); +/* Elicitation */ +/** + * Primitive schema definition for boolean fields. + */ +export const BooleanSchemaSchema = z.object({ + type: z.literal('boolean'), + title: z.string().optional(), + description: z.string().optional(), + default: z.boolean().optional() +}); +/** + * Primitive schema definition for string fields. + */ +export const StringSchemaSchema = z.object({ + type: z.literal('string'), + title: z.string().optional(), + description: z.string().optional(), + minLength: z.number().optional(), + maxLength: z.number().optional(), + format: z.enum(['email', 'uri', 'date', 'date-time']).optional(), + default: z.string().optional() +}); +/** + * Primitive schema definition for number fields. + */ +export const NumberSchemaSchema = z.object({ + type: z.enum(['number', 'integer']), + title: z.string().optional(), + description: z.string().optional(), + minimum: z.number().optional(), + maximum: z.number().optional(), + default: z.number().optional() +}); +/** + * Schema for single-selection enumeration without display titles for options. + */ +export const UntitledSingleSelectEnumSchemaSchema = z.object({ + type: z.literal('string'), + title: z.string().optional(), + description: z.string().optional(), + enum: z.array(z.string()), + default: z.string().optional() +}); +/** + * Schema for single-selection enumeration with display titles for each option. + */ +export const TitledSingleSelectEnumSchemaSchema = z.object({ + type: z.literal('string'), + title: z.string().optional(), + description: z.string().optional(), + oneOf: z.array(z.object({ + const: z.string(), + title: z.string() + })), + default: z.string().optional() +}); +/** + * Use TitledSingleSelectEnumSchema instead. + * This interface will be removed in a future version. + */ +export const LegacyTitledEnumSchemaSchema = z.object({ + type: z.literal('string'), + title: z.string().optional(), + description: z.string().optional(), + enum: z.array(z.string()), + enumNames: z.array(z.string()).optional(), + default: z.string().optional() +}); +// Combined single selection enumeration +export const SingleSelectEnumSchemaSchema = z.union([UntitledSingleSelectEnumSchemaSchema, TitledSingleSelectEnumSchemaSchema]); +/** + * Schema for multiple-selection enumeration without display titles for options. + */ +export const UntitledMultiSelectEnumSchemaSchema = z.object({ + type: z.literal('array'), + title: z.string().optional(), + description: z.string().optional(), + minItems: z.number().optional(), + maxItems: z.number().optional(), + items: z.object({ + type: z.literal('string'), + enum: z.array(z.string()) + }), + default: z.array(z.string()).optional() +}); +/** + * Schema for multiple-selection enumeration with display titles for each option. + */ +export const TitledMultiSelectEnumSchemaSchema = z.object({ + type: z.literal('array'), + title: z.string().optional(), + description: z.string().optional(), + minItems: z.number().optional(), + maxItems: z.number().optional(), + items: z.object({ + anyOf: z.array(z.object({ + const: z.string(), + title: z.string() + })) + }), + default: z.array(z.string()).optional() +}); +/** + * Combined schema for multiple-selection enumeration + */ +export const MultiSelectEnumSchemaSchema = z.union([UntitledMultiSelectEnumSchemaSchema, TitledMultiSelectEnumSchemaSchema]); +/** + * Primitive schema definition for enum fields. + */ +export const EnumSchemaSchema = z.union([LegacyTitledEnumSchemaSchema, SingleSelectEnumSchemaSchema, MultiSelectEnumSchemaSchema]); +/** + * Union of all primitive schema definitions. + */ +export const PrimitiveSchemaDefinitionSchema = z.union([EnumSchemaSchema, BooleanSchemaSchema, StringSchemaSchema, NumberSchemaSchema]); +/** + * Parameters for an `elicitation/create` request for form-based elicitation. + */ +export const ElicitRequestFormParamsSchema = TaskAugmentedRequestParamsSchema.extend({ + /** + * The elicitation mode. + * + * Optional for backward compatibility. Clients MUST treat missing mode as "form". + */ + mode: z.literal('form').optional(), + /** + * The message to present to the user describing what information is being requested. + */ + message: z.string(), + /** + * A restricted subset of JSON Schema. + * Only top-level properties are allowed, without nesting. + */ + requestedSchema: z.object({ + type: z.literal('object'), + properties: z.record(z.string(), PrimitiveSchemaDefinitionSchema), + required: z.array(z.string()).optional() + }) +}); +/** + * Parameters for an `elicitation/create` request for URL-based elicitation. + */ +export const ElicitRequestURLParamsSchema = TaskAugmentedRequestParamsSchema.extend({ + /** + * The elicitation mode. + */ + mode: z.literal('url'), + /** + * The message to present to the user explaining why the interaction is needed. + */ + message: z.string(), + /** + * The ID of the elicitation, which must be unique within the context of the server. + * The client MUST treat this ID as an opaque value. + */ + elicitationId: z.string(), + /** + * The URL that the user should navigate to. + */ + url: z.string().url() +}); +/** + * The parameters for a request to elicit additional information from the user via the client. + */ +export const ElicitRequestParamsSchema = z.union([ElicitRequestFormParamsSchema, ElicitRequestURLParamsSchema]); +/** + * A request from the server to elicit user input via the client. + * The client should present the message and form fields to the user (form mode) + * or navigate to a URL (URL mode). + */ +export const ElicitRequestSchema = RequestSchema.extend({ + method: z.literal('elicitation/create'), + params: ElicitRequestParamsSchema +}); +/** + * Parameters for a `notifications/elicitation/complete` notification. + * + * @category notifications/elicitation/complete + */ +export const ElicitationCompleteNotificationParamsSchema = NotificationsParamsSchema.extend({ + /** + * The ID of the elicitation that completed. + */ + elicitationId: z.string() +}); +/** + * A notification from the server to the client, informing it of a completion of an out-of-band elicitation request. + * + * @category notifications/elicitation/complete + */ +export const ElicitationCompleteNotificationSchema = NotificationSchema.extend({ + method: z.literal('notifications/elicitation/complete'), + params: ElicitationCompleteNotificationParamsSchema +}); +/** + * The client's response to an elicitation/create request from the server. + */ +export const ElicitResultSchema = ResultSchema.extend({ + /** + * The user action in response to the elicitation. + * - "accept": User submitted the form/confirmed the action + * - "decline": User explicitly decline the action + * - "cancel": User dismissed without making an explicit choice + */ + action: z.enum(['accept', 'decline', 'cancel']), + /** + * The submitted form data, only present when action is "accept". + * Contains values matching the requested schema. + * Per MCP spec, content is "typically omitted" for decline/cancel actions. + * We normalize null to undefined for leniency while maintaining type compatibility. + */ + content: z.preprocess(val => (val === null ? undefined : val), z.record(z.string(), z.union([z.string(), z.number(), z.boolean(), z.array(z.string())])).optional()) +}); +/* Autocomplete */ +/** + * A reference to a resource or resource template definition. + */ +export const ResourceTemplateReferenceSchema = z.object({ + type: z.literal('ref/resource'), + /** + * The URI or URI template of the resource. + */ + uri: z.string() +}); +/** + * @deprecated Use ResourceTemplateReferenceSchema instead + */ +export const ResourceReferenceSchema = ResourceTemplateReferenceSchema; +/** + * Identifies a prompt. + */ +export const PromptReferenceSchema = z.object({ + type: z.literal('ref/prompt'), + /** + * The name of the prompt or prompt template + */ + name: z.string() +}); +/** + * Parameters for a `completion/complete` request. + */ +export const CompleteRequestParamsSchema = BaseRequestParamsSchema.extend({ + ref: z.union([PromptReferenceSchema, ResourceTemplateReferenceSchema]), + /** + * The argument's information + */ + argument: z.object({ + /** + * The name of the argument + */ + name: z.string(), + /** + * The value of the argument to use for completion matching. + */ + value: z.string() + }), + context: z + .object({ + /** + * Previously-resolved variables in a URI template or prompt. + */ + arguments: z.record(z.string(), z.string()).optional() + }) + .optional() +}); +/** + * A request from the client to the server, to ask for completion options. + */ +export const CompleteRequestSchema = RequestSchema.extend({ + method: z.literal('completion/complete'), + params: CompleteRequestParamsSchema +}); +export function assertCompleteRequestPrompt(request) { + if (request.params.ref.type !== 'ref/prompt') { + throw new TypeError(`Expected CompleteRequestPrompt, but got ${request.params.ref.type}`); + } + void request; +} +export function assertCompleteRequestResourceTemplate(request) { + if (request.params.ref.type !== 'ref/resource') { + throw new TypeError(`Expected CompleteRequestResourceTemplate, but got ${request.params.ref.type}`); + } + void request; +} +/** + * The server's response to a completion/complete request + */ +export const CompleteResultSchema = ResultSchema.extend({ + completion: z.looseObject({ + /** + * An array of completion values. Must not exceed 100 items. + */ + values: z.array(z.string()).max(100), + /** + * The total number of completion options available. This can exceed the number of values actually sent in the response. + */ + total: z.optional(z.number().int()), + /** + * Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown. + */ + hasMore: z.optional(z.boolean()) + }) +}); +/* Roots */ +/** + * Represents a root directory or file that the server can operate on. + */ +export const RootSchema = z.object({ + /** + * The URI identifying the root. This *must* start with file:// for now. + */ + uri: z.string().startsWith('file://'), + /** + * An optional name for the root. + */ + name: z.string().optional(), + /** + * See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields) + * for notes on _meta usage. + */ + _meta: z.record(z.string(), z.unknown()).optional() +}); +/** + * Sent from the server to request a list of root URIs from the client. + */ +export const ListRootsRequestSchema = RequestSchema.extend({ + method: z.literal('roots/list'), + params: BaseRequestParamsSchema.optional() +}); +/** + * The client's response to a roots/list request from the server. + */ +export const ListRootsResultSchema = ResultSchema.extend({ + roots: z.array(RootSchema) +}); +/** + * A notification from the client to the server, informing it that the list of roots has changed. + */ +export const RootsListChangedNotificationSchema = NotificationSchema.extend({ + method: z.literal('notifications/roots/list_changed'), + params: NotificationsParamsSchema.optional() +}); +/* Client messages */ +export const ClientRequestSchema = z.union([ + PingRequestSchema, + InitializeRequestSchema, + CompleteRequestSchema, + SetLevelRequestSchema, + GetPromptRequestSchema, + ListPromptsRequestSchema, + ListResourcesRequestSchema, + ListResourceTemplatesRequestSchema, + ReadResourceRequestSchema, + SubscribeRequestSchema, + UnsubscribeRequestSchema, + CallToolRequestSchema, + ListToolsRequestSchema, + GetTaskRequestSchema, + GetTaskPayloadRequestSchema, + ListTasksRequestSchema, + CancelTaskRequestSchema +]); +export const ClientNotificationSchema = z.union([ + CancelledNotificationSchema, + ProgressNotificationSchema, + InitializedNotificationSchema, + RootsListChangedNotificationSchema, + TaskStatusNotificationSchema +]); +export const ClientResultSchema = z.union([ + EmptyResultSchema, + CreateMessageResultSchema, + CreateMessageResultWithToolsSchema, + ElicitResultSchema, + ListRootsResultSchema, + GetTaskResultSchema, + ListTasksResultSchema, + CreateTaskResultSchema +]); +/* Server messages */ +export const ServerRequestSchema = z.union([ + PingRequestSchema, + CreateMessageRequestSchema, + ElicitRequestSchema, + ListRootsRequestSchema, + GetTaskRequestSchema, + GetTaskPayloadRequestSchema, + ListTasksRequestSchema, + CancelTaskRequestSchema +]); +export const ServerNotificationSchema = z.union([ + CancelledNotificationSchema, + ProgressNotificationSchema, + LoggingMessageNotificationSchema, + ResourceUpdatedNotificationSchema, + ResourceListChangedNotificationSchema, + ToolListChangedNotificationSchema, + PromptListChangedNotificationSchema, + TaskStatusNotificationSchema, + ElicitationCompleteNotificationSchema +]); +export const ServerResultSchema = z.union([ + EmptyResultSchema, + InitializeResultSchema, + CompleteResultSchema, + GetPromptResultSchema, + ListPromptsResultSchema, + ListResourcesResultSchema, + ListResourceTemplatesResultSchema, + ReadResourceResultSchema, + CallToolResultSchema, + ListToolsResultSchema, + GetTaskResultSchema, + ListTasksResultSchema, + CreateTaskResultSchema +]); +export class McpError extends Error { + constructor(code, message, data) { + super(`MCP error ${code}: ${message}`); + this.code = code; + this.data = data; + this.name = 'McpError'; + } + /** + * Factory method to create the appropriate error type based on the error code and data + */ + static fromError(code, message, data) { + // Check for specific error types + if (code === ErrorCode.UrlElicitationRequired && data) { + const errorData = data; + if (errorData.elicitations) { + return new UrlElicitationRequiredError(errorData.elicitations, message); + } + } + // Default to generic McpError + return new McpError(code, message, data); + } +} +/** + * Specialized error type when a tool requires a URL mode elicitation. + * This makes it nicer for the client to handle since there is specific data to work with instead of just a code to check against. + */ +export class UrlElicitationRequiredError extends McpError { + constructor(elicitations, message = `URL elicitation${elicitations.length > 1 ? 's' : ''} required`) { + super(ErrorCode.UrlElicitationRequired, message, { + elicitations: elicitations + }); + } + get elicitations() { + return this.data?.elicitations ?? []; + } +} +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js.map new file mode 100644 index 0000000000000000000000000000000000000000..15afe12bcb9bd97be0937c7a952cba538acd6e6a --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,QAAQ,CAAC;AAG5B,MAAM,CAAC,MAAM,uBAAuB,GAAG,YAAY,CAAC;AACpD,MAAM,CAAC,MAAM,mCAAmC,GAAG,YAAY,CAAC;AAChE,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,uBAAuB,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;AAE7H,MAAM,CAAC,MAAM,qBAAqB,GAAG,sCAAsC,CAAC;AAE5E,oBAAoB;AACpB,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC;AAMrC;;;;GAIG;AACH,MAAM,kB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AAO,IAAI,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IAC7C,CAAC;CACJ;AAED;;;GAGG;AACH,MAAM,OAAO,2BAA4B,SAAQ,QAAQ;IACrD,YAAY,YAAsC,EAAE,UAAkB,kBAAkB,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,WAAW;QACjI,KAAK,CAAC,SAAS,CAAC,sBAAsB,EAAE,OAAO,EAAE;YAC7C,YAAY,EAAE,YAAY;SAC7B,CAAC,CAAC;IACP,CAAC;IAED,IAAI,YAAY;QACZ,OAAQ,IAAI,CAAC,IAAmD,EAAE,YAAY,IAAI,EAAE,CAAC;IACzF,CAAC;CACJ"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..952ee68dfcb764ca6e88dd05ea61fff24c919d69 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.d.ts @@ -0,0 +1,53 @@ +/** + * AJV-based JSON Schema validator provider + */ +import Ajv from 'ajv'; +import type { JsonSchemaType, JsonSchemaValidator, jsonSchemaValidator } from './types.js'; +/** + * @example + * ```typescript + * // Use with default AJV instance (recommended) + * import { AjvJsonSchemaValidator } from '@modelcontextprotocol/sdk/validation/ajv'; + * const validator = new AjvJsonSchemaValidator(); + * + * // Use with custom AJV instance + * import { Ajv } from 'ajv'; + * const ajv = new Ajv({ strict: true, allErrors: true }); + * const validator = new AjvJsonSchemaValidator(ajv); + * ``` + */ +export declare class AjvJsonSchemaValidator implements jsonSchemaValidator { + private _ajv; + /** + * Create an AJV validator + * + * @param ajv - Optional pre-configured AJV instance. If not provided, a default instance will be created. + * + * @example + * ```typescript + * // Use default configuration (recommended for most cases) + * import { AjvJsonSchemaValidator } from '@modelcontextprotocol/sdk/validation/ajv'; + * const validator = new AjvJsonSchemaValidator(); + * + * // Or provide custom AJV instance for advanced configuration + * import { Ajv } from 'ajv'; + * import addFormats from 'ajv-formats'; + * + * const ajv = new Ajv({ validateFormats: true }); + * addFormats(ajv); + * const validator = new AjvJsonSchemaValidator(ajv); + * ``` + */ + constructor(ajv?: Ajv); + /** + * Create a validator for the given JSON Schema + * + * The validator is compiled once and can be reused multiple times. + * If the schema has an $id, it will be cached by AJV automatically. + * + * @param schema - Standard JSON Schema object + * @returns A validator function that validates input data + */ + getValidator(schema: JsonSchemaType): JsonSchemaValidator; +} +//# sourceMappingURL=ajv-provider.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..6704c4d927d9b3480cd8b4c59015f8f2c03c436b --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ajv-provider.d.ts","sourceRoot":"","sources":["../../../src/validation/ajv-provider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,GAAG,MAAM,KAAK,CAAC;AAEtB,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAA6B,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAgBtH;;;;;;;;;;;;GAYG;AACH,qBAAa,sBAAuB,YAAW,mBAAmB;IAC9D,OAAO,CAAC,IAAI,CAAM;IAElB;;;;;;;;;;;;;;;;;;;OAmBG;gBACS,GAAG,CAAC,EAAE,GAAG;IAIrB;;;;;;;;OAQG;IACH,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,cAAc,GAAG,mBAAmB,CAAC,CAAC,CAAC;CAyBlE"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js new file mode 100644 index 0000000000000000000000000000000000000000..a0ab067407957383f8431aa98e5cdc7f17b007a3 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js @@ -0,0 +1,87 @@ +/** + * AJV-based JSON Schema validator provider + */ +import Ajv from 'ajv'; +import _addFormats from 'ajv-formats'; +function createDefaultAjvInstance() { + const ajv = new Ajv({ + strict: false, + validateFormats: true, + validateSchema: false, + allErrors: true + }); + const addFormats = _addFormats; + addFormats(ajv); + return ajv; +} +/** + * @example + * ```typescript + * // Use with default AJV instance (recommended) + * import { AjvJsonSchemaValidator } from '@modelcontextprotocol/sdk/validation/ajv'; + * const validator = new AjvJsonSchemaValidator(); + * + * // Use with custom AJV instance + * import { Ajv } from 'ajv'; + * const ajv = new Ajv({ strict: true, allErrors: true }); + * const validator = new AjvJsonSchemaValidator(ajv); + * ``` + */ +export class AjvJsonSchemaValidator { + /** + * Create an AJV validator + * + * @param ajv - Optional pre-configured AJV instance. If not provided, a default instance will be created. + * + * @example + * ```typescript + * // Use default configuration (recommended for most cases) + * import { AjvJsonSchemaValidator } from '@modelcontextprotocol/sdk/validation/ajv'; + * const validator = new AjvJsonSchemaValidator(); + * + * // Or provide custom AJV instance for advanced configuration + * import { Ajv } from 'ajv'; + * import addFormats from 'ajv-formats'; + * + * const ajv = new Ajv({ validateFormats: true }); + * addFormats(ajv); + * const validator = new AjvJsonSchemaValidator(ajv); + * ``` + */ + constructor(ajv) { + this._ajv = ajv ?? createDefaultAjvInstance(); + } + /** + * Create a validator for the given JSON Schema + * + * The validator is compiled once and can be reused multiple times. + * If the schema has an $id, it will be cached by AJV automatically. + * + * @param schema - Standard JSON Schema object + * @returns A validator function that validates input data + */ + getValidator(schema) { + // Check if schema has $id and is already compiled/cached + const ajvValidator = '$id' in schema && typeof schema.$id === 'string' + ? (this._ajv.getSchema(schema.$id) ?? this._ajv.compile(schema)) + : this._ajv.compile(schema); + return (input) => { + const valid = ajvValidator(input); + if (valid) { + return { + valid: true, + data: input, + errorMessage: undefined + }; + } + else { + return { + valid: false, + data: undefined, + errorMessage: this._ajv.errorsText(ajvValidator.errors) + }; + } + }; + } +} +//# sourceMappingURL=ajv-provider.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js.map new file mode 100644 index 0000000000000000000000000000000000000000..7b01905975b15cae1cce15f29f43084aabf21537 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ajv-provider.js","sourceRoot":"","sources":["../../../src/validation/ajv-provider.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,WAAW,MAAM,aAAa,CAAC;AAGtC,SAAS,wBAAwB;IAC7B,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC;QAChB,MAAM,EAAE,KAAK;QACb,eAAe,EAAE,IAAI;QACrB,cAAc,EAAE,KAAK;QACrB,SAAS,EAAE,IAAI;KAClB,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,WAAoD,CAAC;IACxE,UAAU,CAAC,GAAG,CAAC,CAAC;IAEhB,OAAO,GAAG,CAAC;AACf,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,sBAAsB;IAG/B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,YAAY,GAAS;QACjB,IAAI,CAAC,IAAI,GAAG,GAAG,IAAI,wBAAwB,EAAE,CAAC;IAClD,CAAC;IAED;;;;;;;;OAQG;IACH,YAAY,CAAI,MAAsB;QAClC,yDAAyD;QACzD,MAAM,YAAY,GACd,KAAK,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,GAAG,KAAK,QAAQ;YAC7C,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;YAChE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAEpC,OAAO,CAAC,KAAc,EAAgC,EAAE;YACpD,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;YAElC,IAAI,KAAK,EAAE,CAAC;gBACR,OAAO;oBACH,KAAK,EAAE,IAAI;oBACX,IAAI,EAAE,KAAU;oBAChB,YAAY,EAAE,SAAS;iBAC1B,CAAC;YACN,CAAC;iBAAM,CAAC;gBACJ,OAAO;oBACH,KAAK,EAAE,KAAK;oBACZ,IAAI,EAAE,SAAS;oBACf,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC;iBAC1D,CAAC;YACN,CAAC;QACL,CAAC,CAAC;IACN,CAAC;CACJ"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/cfworker-provider.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/cfworker-provider.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..89c244a609434abb1c62cd97adc54636460d34a8 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/cfworker-provider.d.ts @@ -0,0 +1,51 @@ +/** + * Cloudflare Worker-compatible JSON Schema validator provider + * + * This provider uses @cfworker/json-schema for validation without code generation, + * making it compatible with edge runtimes like Cloudflare Workers that restrict + * eval and new Function. + */ +import type { JsonSchemaType, JsonSchemaValidator, jsonSchemaValidator } from './types.js'; +/** + * JSON Schema draft version supported by @cfworker/json-schema + */ +export type CfWorkerSchemaDraft = '4' | '7' | '2019-09' | '2020-12'; +/** + * + * @example + * ```typescript + * // Use with default configuration (2020-12, shortcircuit) + * const validator = new CfWorkerJsonSchemaValidator(); + * + * // Use with custom configuration + * const validator = new CfWorkerJsonSchemaValidator({ + * draft: '2020-12', + * shortcircuit: false // Report all errors + * }); + * ``` + */ +export declare class CfWorkerJsonSchemaValidator implements jsonSchemaValidator { + private shortcircuit; + private draft; + /** + * Create a validator + * + * @param options - Configuration options + * @param options.shortcircuit - If true, stop validation after first error (default: true) + * @param options.draft - JSON Schema draft version to use (default: '2020-12') + */ + constructor(options?: { + shortcircuit?: boolean; + draft?: CfWorkerSchemaDraft; + }); + /** + * Create a validator for the given JSON Schema + * + * Unlike AJV, this validator is not cached internally + * + * @param schema - Standard JSON Schema object + * @returns A validator function that validates input data + */ + getValidator(schema: JsonSchemaType): JsonSchemaValidator; +} +//# sourceMappingURL=cfworker-provider.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/cfworker-provider.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/cfworker-provider.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..ce404d92fcadb2cfaebcde5af67fdf4240fce4c1 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/cfworker-provider.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"cfworker-provider.d.ts","sourceRoot":"","sources":["../../../src/validation/cfworker-provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAA6B,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtH;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,GAAG,GAAG,GAAG,GAAG,SAAS,GAAG,SAAS,CAAC;AAEpE;;;;;;;;;;;;;GAaG;AACH,qBAAa,2BAA4B,YAAW,mBAAmB;IACnE,OAAO,CAAC,YAAY,CAAU;IAC9B,OAAO,CAAC,KAAK,CAAsB;IAEnC;;;;;;OAMG;gBACS,OAAO,CAAC,EAAE;QAAE,YAAY,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,mBAAmB,CAAA;KAAE;IAK7E;;;;;;;OAOG;IACH,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,cAAc,GAAG,mBAAmB,CAAC,CAAC,CAAC;CAsBlE"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/cfworker-provider.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/cfworker-provider.js new file mode 100644 index 0000000000000000000000000000000000000000..576491494ba5c3f8d5a89f382f23dfcc6c4cd97a --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/cfworker-provider.js @@ -0,0 +1,65 @@ +/** + * Cloudflare Worker-compatible JSON Schema validator provider + * + * This provider uses @cfworker/json-schema for validation without code generation, + * making it compatible with edge runtimes like Cloudflare Workers that restrict + * eval and new Function. + */ +import { Validator } from '@cfworker/json-schema'; +/** + * + * @example + * ```typescript + * // Use with default configuration (2020-12, shortcircuit) + * const validator = new CfWorkerJsonSchemaValidator(); + * + * // Use with custom configuration + * const validator = new CfWorkerJsonSchemaValidator({ + * draft: '2020-12', + * shortcircuit: false // Report all errors + * }); + * ``` + */ +export class CfWorkerJsonSchemaValidator { + /** + * Create a validator + * + * @param options - Configuration options + * @param options.shortcircuit - If true, stop validation after first error (default: true) + * @param options.draft - JSON Schema draft version to use (default: '2020-12') + */ + constructor(options) { + this.shortcircuit = options?.shortcircuit ?? true; + this.draft = options?.draft ?? '2020-12'; + } + /** + * Create a validator for the given JSON Schema + * + * Unlike AJV, this validator is not cached internally + * + * @param schema - Standard JSON Schema object + * @returns A validator function that validates input data + */ + getValidator(schema) { + // Cast to the cfworker Schema type - our JsonSchemaType is structurally compatible + const validator = new Validator(schema, this.draft, this.shortcircuit); + return (input) => { + const result = validator.validate(input); + if (result.valid) { + return { + valid: true, + data: input, + errorMessage: undefined + }; + } + else { + return { + valid: false, + data: undefined, + errorMessage: result.errors.map(err => `${err.instanceLocation}: ${err.error}`).join('; ') + }; + } + }; + } +} +//# sourceMappingURL=cfworker-provider.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/cfworker-provider.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/cfworker-provider.js.map new file mode 100644 index 0000000000000000000000000000000000000000..21c014ab774d83be82b35736ca2b160ef487a50e --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/cfworker-provider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"cfworker-provider.js","sourceRoot":"","sources":["../../../src/validation/cfworker-provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAQlD;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,2BAA2B;IAIpC;;;;;;OAMG;IACH,YAAY,OAAiE;QACzE,IAAI,CAAC,YAAY,GAAG,OAAO,EAAE,YAAY,IAAI,IAAI,CAAC;QAClD,IAAI,CAAC,KAAK,GAAG,OAAO,EAAE,KAAK,IAAI,SAAS,CAAC;IAC7C,CAAC;IAED;;;;;;;OAOG;IACH,YAAY,CAAI,MAAsB;QAClC,mFAAmF;QACnF,MAAM,SAAS,GAAG,IAAI,SAAS,CAAC,MAAoD,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;QAErH,OAAO,CAAC,KAAc,EAAgC,EAAE;YACpD,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YAEzC,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;gBACf,OAAO;oBACH,KAAK,EAAE,IAAI;oBACX,IAAI,EAAE,KAAU;oBAChB,YAAY,EAAE,SAAS;iBAC1B,CAAC;YACN,CAAC;iBAAM,CAAC;gBACJ,OAAO;oBACH,KAAK,EAAE,KAAK;oBACZ,IAAI,EAAE,SAAS;oBACf,YAAY,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,gBAAgB,KAAK,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;iBAC7F,CAAC;YACN,CAAC;QACL,CAAC,CAAC;IACN,CAAC;CACJ"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/index.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..99e993967ff5721a7cccbeab8faecf813cb95d67 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/index.d.ts @@ -0,0 +1,29 @@ +/** + * JSON Schema validation + * + * This module provides configurable JSON Schema validation for the MCP SDK. + * Choose a validator based on your runtime environment: + * + * - AjvJsonSchemaValidator: Best for Node.js (default, fastest) + * Import from: @modelcontextprotocol/sdk/validation/ajv + * Requires peer dependencies: ajv, ajv-formats + * + * - CfWorkerJsonSchemaValidator: Best for edge runtimes + * Import from: @modelcontextprotocol/sdk/validation/cfworker + * Requires peer dependency: @cfworker/json-schema + * + * @example + * ```typescript + * // For Node.js with AJV + * import { AjvJsonSchemaValidator } from '@modelcontextprotocol/sdk/validation/ajv'; + * const validator = new AjvJsonSchemaValidator(); + * + * // For Cloudflare Workers + * import { CfWorkerJsonSchemaValidator } from '@modelcontextprotocol/sdk/validation/cfworker'; + * const validator = new CfWorkerJsonSchemaValidator(); + * ``` + * + * @module validation + */ +export type { JsonSchemaType, JsonSchemaValidator, JsonSchemaValidatorResult, jsonSchemaValidator } from './types.js'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/index.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/index.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..a8845b96e78da2c7d666b7171908ef6da2670ff0 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/validation/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAGH,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/index.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/index.js new file mode 100644 index 0000000000000000000000000000000000000000..685b1fd45fa9fa191d10181434a5b29916853508 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/index.js @@ -0,0 +1,29 @@ +/** + * JSON Schema validation + * + * This module provides configurable JSON Schema validation for the MCP SDK. + * Choose a validator based on your runtime environment: + * + * - AjvJsonSchemaValidator: Best for Node.js (default, fastest) + * Import from: @modelcontextprotocol/sdk/validation/ajv + * Requires peer dependencies: ajv, ajv-formats + * + * - CfWorkerJsonSchemaValidator: Best for edge runtimes + * Import from: @modelcontextprotocol/sdk/validation/cfworker + * Requires peer dependency: @cfworker/json-schema + * + * @example + * ```typescript + * // For Node.js with AJV + * import { AjvJsonSchemaValidator } from '@modelcontextprotocol/sdk/validation/ajv'; + * const validator = new AjvJsonSchemaValidator(); + * + * // For Cloudflare Workers + * import { CfWorkerJsonSchemaValidator } from '@modelcontextprotocol/sdk/validation/cfworker'; + * const validator = new CfWorkerJsonSchemaValidator(); + * ``` + * + * @module validation + */ +export {}; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/index.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/index.js.map new file mode 100644 index 0000000000000000000000000000000000000000..ed2b9fc2346b4f9b5f4a9d5a7d1bf71bf5bfbb7a --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/validation/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/types.d.ts b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..9fa92226c8781ea09b09bfdf1cce055f0ce1a7df --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/types.d.ts @@ -0,0 +1,65 @@ +import type { JSONSchema } from 'json-schema-typed'; +/** + * JSON Schema type definition (JSON Schema Draft 2020-12) + * + * This uses the object form of JSON Schema (excluding boolean schemas). + * While `true` and `false` are valid JSON Schemas, this SDK uses the + * object form for practical type safety. + * + * Re-exported from json-schema-typed for convenience. + * @see https://json-schema.org/draft/2020-12/json-schema-core.html + */ +export type JsonSchemaType = JSONSchema.Interface; +/** + * Result of a JSON Schema validation operation + */ +export type JsonSchemaValidatorResult = { + valid: true; + data: T; + errorMessage: undefined; +} | { + valid: false; + data: undefined; + errorMessage: string; +}; +/** + * A validator function that validates data against a JSON Schema + */ +export type JsonSchemaValidator = (input: unknown) => JsonSchemaValidatorResult; +/** + * Provider interface for creating validators from JSON Schemas + * + * This is the main extension point for custom validator implementations. + * Implementations should: + * - Support JSON Schema Draft 2020-12 (or be compatible with it) + * - Return validator functions that can be called multiple times + * - Handle schema compilation/caching internally + * - Provide clear error messages on validation failure + * + * @example + * ```typescript + * class MyValidatorProvider implements jsonSchemaValidator { + * getValidator(schema: JsonSchemaType): JsonSchemaValidator { + * // Compile/cache validator from schema + * return (input: unknown) => { + * // Validate input against schema + * if (valid) { + * return { valid: true, data: input as T, errorMessage: undefined }; + * } else { + * return { valid: false, data: undefined, errorMessage: 'Error details' }; + * } + * }; + * } + * } + * ``` + */ +export interface jsonSchemaValidator { + /** + * Create a validator for the given JSON Schema + * + * @param schema - Standard JSON Schema object + * @returns A validator function that can be called multiple times + */ + getValidator(schema: JsonSchemaType): JsonSchemaValidator; +} +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/types.d.ts.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/types.d.ts.map new file mode 100644 index 0000000000000000000000000000000000000000..52aa0ef423bb6a0b8b1dd0567b71d91ed15381cc --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/types.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/validation/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD;;;;;;;;;GASG;AACH,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,SAAS,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,yBAAyB,CAAC,CAAC,IACjC;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,CAAC,CAAC;IAAC,YAAY,EAAE,SAAS,CAAA;CAAE,GACjD;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,KAAK,yBAAyB,CAAC,CAAC,CAAC,CAAC;AAEtF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,WAAW,mBAAmB;IAChC;;;;;OAKG;IACH,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,cAAc,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAAC;CACnE"} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/types.js b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/types.js new file mode 100644 index 0000000000000000000000000000000000000000..718fd38ae40c67ea23b242517cf9919f602c5a3e --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/types.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/types.js.map b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/types.js.map new file mode 100644 index 0000000000000000000000000000000000000000..51361cf6a48effaf63dfded7ab648735b41fdbc4 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/validation/types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/tools/ui/node_modules/@modelcontextprotocol/sdk/package.json b/tools/ui/node_modules/@modelcontextprotocol/sdk/package.json new file mode 100644 index 0000000000000000000000000000000000000000..355e0705bfec79caf9e0cc8d21d7c615c79f8655 --- /dev/null +++ b/tools/ui/node_modules/@modelcontextprotocol/sdk/package.json @@ -0,0 +1,165 @@ +{ + "name": "@modelcontextprotocol/sdk", + "version": "1.30.0", + "description": "Model Context Protocol implementation for TypeScript", + "license": "MIT", + "author": "Anthropic, PBC (https://anthropic.com)", + "homepage": "https://modelcontextprotocol.io", + "bugs": "https://github.com/modelcontextprotocol/typescript-sdk/issues", + "type": "module", + "repository": { + "type": "git", + "url": "git+https://github.com/modelcontextprotocol/typescript-sdk.git" + }, + "engines": { + "node": ">=18" + }, + "keywords": [ + "modelcontextprotocol", + "mcp" + ], + "exports": { + ".": { + "types": "./dist/esm/index.d.ts", + "import": "./dist/esm/index.js", + "require": "./dist/cjs/index.js" + }, + "./client": { + "types": "./dist/esm/client/index.d.ts", + "import": "./dist/esm/client/index.js", + "require": "./dist/cjs/client/index.js" + }, + "./server": { + "types": "./dist/esm/server/index.d.ts", + "import": "./dist/esm/server/index.js", + "require": "./dist/cjs/server/index.js" + }, + "./validation": { + "types": "./dist/esm/validation/index.d.ts", + "import": "./dist/esm/validation/index.js", + "require": "./dist/cjs/validation/index.js" + }, + "./validation/ajv": { + "types": "./dist/esm/validation/ajv-provider.d.ts", + "import": "./dist/esm/validation/ajv-provider.js", + "require": "./dist/cjs/validation/ajv-provider.js" + }, + "./validation/cfworker": { + "types": "./dist/esm/validation/cfworker-provider.d.ts", + "import": "./dist/esm/validation/cfworker-provider.js", + "require": "./dist/cjs/validation/cfworker-provider.js" + }, + "./experimental": { + "types": "./dist/esm/experimental/index.d.ts", + "import": "./dist/esm/experimental/index.js", + "require": "./dist/cjs/experimental/index.js" + }, + "./experimental/tasks": { + "types": "./dist/esm/experimental/tasks/index.d.ts", + "import": "./dist/esm/experimental/tasks/index.js", + "require": "./dist/cjs/experimental/tasks/index.js" + }, + "./*": { + "types": "./dist/esm/*.d.ts", + "import": "./dist/esm/*", + "require": "./dist/cjs/*" + } + }, + "typesVersions": { + "*": { + "*": [ + "./dist/esm/*" + ] + } + }, + "files": [ + "dist" + ], + "scripts": { + "fetch:spec-types": "tsx scripts/fetch-spec-types.ts", + "typecheck": "tsgo --noEmit", + "build": "npm run build:esm && npm run build:cjs", + "build:esm": "mkdir -p dist/esm && echo '{\"type\": \"module\"}' > dist/esm/package.json && tsc -p tsconfig.prod.json", + "build:esm:w": "npm run build:esm -- -w", + "build:cjs": "mkdir -p dist/cjs && echo '{\"type\": \"commonjs\"}' > dist/cjs/package.json && tsc -p tsconfig.cjs.json", + "build:cjs:w": "npm run build:cjs -- -w", + "examples:simple-server:w": "tsx --watch src/examples/server/simpleStreamableHttp.ts --oauth", + "prepack": "npm run build:esm && npm run build:cjs", + "lint": "eslint src/ && prettier --check .", + "lint:fix": "eslint src/ --fix && prettier --write .", + "check": "npm run typecheck && npm run lint", + "test": "vitest run --exclude \"test/e2e/**\"", + "test:e2e": "vitest run test/e2e", + "test:watch": "vitest", + "start": "npm run server", + "server": "tsx watch --clear-screen=false scripts/cli.ts server", + "client": "tsx scripts/cli.ts client", + "test:conformance:server": "test/conformance/scripts/run-server-conformance.sh --expected-failures test/conformance/conformance-baseline.yml", + "test:conformance:server:all": "test/conformance/scripts/run-server-conformance.sh --suite all --expected-failures test/conformance/conformance-baseline.yml", + "test:conformance:server:run": "npx tsx test/conformance/src/everythingServer.ts", + "test:conformance:client": "npx @modelcontextprotocol/conformance client --command 'npx tsx test/conformance/src/everythingClient.ts' --expected-failures test/conformance/conformance-baseline.yml", + "test:conformance:client:all": "npx @modelcontextprotocol/conformance client --command 'npx tsx test/conformance/src/everythingClient.ts' --suite all --expected-failures test/conformance/conformance-baseline.yml" + }, + "dependencies": { + "@hono/node-server": "^1.19.9 || ^2.0.5", + "ajv": "^8.17.1", + "ajv-formats": "^3.0.1", + "content-type": "^1.0.5", + "cors": "^2.8.5", + "cross-spawn": "^7.0.5", + "eventsource": "^3.0.2", + "eventsource-parser": "^3.0.0", + "express": "^5.2.1", + "express-rate-limit": "^8.2.1", + "hono": "^4.11.4", + "jose": "^6.1.3", + "json-schema-typed": "^8.0.2", + "pkce-challenge": "^5.0.0", + "raw-body": "^3.0.0", + "zod": "^3.25 || ^4.0", + "zod-to-json-schema": "^3.25.1" + }, + "peerDependencies": { + "@cfworker/json-schema": "^4.1.1", + "zod": "^3.25 || ^4.0" + }, + "peerDependenciesMeta": { + "@cfworker/json-schema": { + "optional": true + }, + "zod": { + "optional": false + } + }, + "devDependencies": { + "@cfworker/json-schema": "^4.1.1", + "@eslint/js": "^9.39.1", + "@modelcontextprotocol/conformance": "^0.1.14", + "@types/content-type": "^1.1.8", + "@types/cors": "^2.8.17", + "@types/cross-spawn": "^6.0.6", + "@types/eventsource": "^1.1.15", + "@types/express": "^5.0.0", + "@types/express-serve-static-core": "^5.1.0", + "@types/node": "^22.12.0", + "@types/supertest": "^6.0.2", + "@types/ws": "^8.5.12", + "@typescript/native-preview": "^7.0.0-dev.20251103.1", + "eslint": "^9.8.0", + "eslint-config-prettier": "^10.1.8", + "eslint-plugin-n": "^17.23.1", + "prettier": "3.6.2", + "supertest": "^7.0.0", + "tsx": "^4.16.5", + "typescript": "^5.5.4", + "typescript-eslint": "^8.48.1", + "vitest": "^4.0.8", + "ws": "^8.18.0" + }, + "resolutions": { + "strip-ansi": "6.0.1" + }, + "overrides": { + "qs": "6.14.1" + } +} diff --git a/tools/ui/node_modules/@napi-rs/canvas-linux-x64-gnu/README.md b/tools/ui/node_modules/@napi-rs/canvas-linux-x64-gnu/README.md new file mode 100644 index 0000000000000000000000000000000000000000..01202461390ab066cf1975f3b191e092e31b1805 --- /dev/null +++ b/tools/ui/node_modules/@napi-rs/canvas-linux-x64-gnu/README.md @@ -0,0 +1,3 @@ +# `@napi-rs/canvas-linux-x64-gnu` + +This is the **x86_64-unknown-linux-gnu** binary for `@napi-rs/canvas` diff --git a/tools/ui/node_modules/@napi-rs/canvas-linux-x64-gnu/package.json b/tools/ui/node_modules/@napi-rs/canvas-linux-x64-gnu/package.json new file mode 100644 index 0000000000000000000000000000000000000000..055d52360dcee4ab57e9749bb4dc7d705b99f72f --- /dev/null +++ b/tools/ui/node_modules/@napi-rs/canvas-linux-x64-gnu/package.json @@ -0,0 +1,47 @@ +{ + "name": "@napi-rs/canvas-linux-x64-gnu", + "version": "0.1.100", + "os": [ + "linux" + ], + "cpu": [ + "x64" + ], + "main": "skia.linux-x64-gnu.node", + "files": [ + "skia.linux-x64-gnu.node" + ], + "description": "Canvas for Node.js with skia backend", + "keywords": [ + "napi-rs", + "NAPI", + "N-API", + "Rust", + "node-addon", + "node-addon-api", + "canvas", + "image", + "pdf", + "svg", + "skia" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + }, + "publishConfig": { + "registry": "https://registry.npmjs.org/", + "access": "public" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Brooooooklyn/canvas.git" + }, + "libc": [ + "glibc" + ], + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/@napi-rs/canvas-linux-x64-gnu/skia.linux-x64-gnu.node b/tools/ui/node_modules/@napi-rs/canvas-linux-x64-gnu/skia.linux-x64-gnu.node new file mode 100644 index 0000000000000000000000000000000000000000..eafcedd53909fae6c951066d36c9ae1ec1900485 --- /dev/null +++ b/tools/ui/node_modules/@napi-rs/canvas-linux-x64-gnu/skia.linux-x64-gnu.node @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:059a0873c1114a8a59195f6c4bc76eab9c4e928251003cd501b59bc8aaaf3fa0 +size 33393024 diff --git a/tools/ui/node_modules/@napi-rs/canvas-linux-x64-musl/README.md b/tools/ui/node_modules/@napi-rs/canvas-linux-x64-musl/README.md new file mode 100644 index 0000000000000000000000000000000000000000..8908007f4d2176e73ccd3f0eed6c87140f21fa25 --- /dev/null +++ b/tools/ui/node_modules/@napi-rs/canvas-linux-x64-musl/README.md @@ -0,0 +1,3 @@ +# `@napi-rs/canvas-linux-x64-musl` + +This is the **x86_64-unknown-linux-musl** binary for `@napi-rs/canvas` diff --git a/tools/ui/node_modules/@napi-rs/canvas-linux-x64-musl/package.json b/tools/ui/node_modules/@napi-rs/canvas-linux-x64-musl/package.json new file mode 100644 index 0000000000000000000000000000000000000000..34fb0f027827e971c103b18c263dd792a9fc585b --- /dev/null +++ b/tools/ui/node_modules/@napi-rs/canvas-linux-x64-musl/package.json @@ -0,0 +1,47 @@ +{ + "name": "@napi-rs/canvas-linux-x64-musl", + "version": "0.1.100", + "os": [ + "linux" + ], + "cpu": [ + "x64" + ], + "main": "skia.linux-x64-musl.node", + "files": [ + "skia.linux-x64-musl.node" + ], + "description": "Canvas for Node.js with skia backend", + "keywords": [ + "napi-rs", + "NAPI", + "N-API", + "Rust", + "node-addon", + "node-addon-api", + "canvas", + "image", + "pdf", + "svg", + "skia" + ], + "license": "MIT", + "engines": { + "node": ">= 10" + }, + "publishConfig": { + "registry": "https://registry.npmjs.org/", + "access": "public" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/Brooooooklyn/canvas.git" + }, + "libc": [ + "musl" + ], + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/@napi-rs/canvas-linux-x64-musl/skia.linux-x64-musl.node b/tools/ui/node_modules/@napi-rs/canvas-linux-x64-musl/skia.linux-x64-musl.node new file mode 100644 index 0000000000000000000000000000000000000000..d4e3b56adbeab4488859993c0bf3d28eb30e47f8 --- /dev/null +++ b/tools/ui/node_modules/@napi-rs/canvas-linux-x64-musl/skia.linux-x64-musl.node @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:0396e3f0d1cec95684ace216b2fe397532901ed628ab5572f511a1786cbe361c +size 29754136 diff --git a/tools/ui/node_modules/@napi-rs/canvas/LICENSE b/tools/ui/node_modules/@napi-rs/canvas/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..e0024071be828a07166aef9825c50a1912f652ac --- /dev/null +++ b/tools/ui/node_modules/@napi-rs/canvas/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 lynweklm@gmail.com + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/tools/ui/node_modules/@napi-rs/canvas/README.md b/tools/ui/node_modules/@napi-rs/canvas/README.md new file mode 100644 index 0000000000000000000000000000000000000000..ecf2612abcfd8e13b53f218f851e3667deefc14d --- /dev/null +++ b/tools/ui/node_modules/@napi-rs/canvas/README.md @@ -0,0 +1,448 @@ +# `skr canvas` + +[![CI](https://github.com/Brooooooklyn/canvas/actions/workflows/CI.yaml/badge.svg)](https://github.com/Brooooooklyn/canvas/actions/workflows/CI.yaml) +![Skia Version](https://img.shields.io/badge/Skia-chrome%2Fm148-hotpink) +[![install size](https://packagephobia.com/badge?p=@napi-rs/canvas)](https://packagephobia.com/result?p=@napi-rs/canvas) +[![Downloads](https://img.shields.io/npm/dm/@napi-rs/canvas.svg?sanitize=true)](https://npmcharts.com/compare/@napi-rs/canvas?minimal=true) + +> 🚀 Help me to become a full-time open-source developer by [sponsoring me on Github](https://github.com/sponsors/Brooooooklyn) + +Google Skia binding to Node.js via [Node-API](https://napi.rs), **0 System dependencies!** + +⚠️ This project is in pre-release stage. And there may be some bugs.
+For details on planned features and future direction please refer to the [Roadmap](https://github.com/Brooooooklyn/canvas/issues/113). + +[中文文档](./README-zh.md) + +# Install + +```bash +yarn add @napi-rs/canvas +npm install @napi-rs/canvas +``` + +# Support matrix + +## System requirement + +### `arm64` + +[**_cortex-a57_**](https://en.wikipedia.org/wiki/ARM_Cortex-A57) or newer CPU architecture on **Linux**. + +All Apple M chips on **macOS**. + +### `armv7` + +[**_cortex-a7_**](https://en.wikipedia.org/wiki/ARM_Cortex-A7) or newer CPU architecture. + +### glibc + +Since Skia relies on the [glibc](https://www.gnu.org/software/libc/) 2.18 API, you need to have at least glibc version >= 2.18 on your system. + +## AWS Lambda usage + +To use this library on Lambda you will need to use a Lambda layer. + +You can simply attach a lambda layer by getting an ARN from [Canvas-Lambda-Layer](https://github.com/ShivamJoker/Canvas-Lambda-Layer) + +> Make sure to exclude `@napi-rs/canvas` while bundling your Lambda. + +# Usage + +```js +const { promises } = require('node:fs') +const { join } = require('node:path') +const { createCanvas, loadImage } = require('@napi-rs/canvas') + +const canvas = createCanvas(300, 320) +const ctx = canvas.getContext('2d') + +ctx.lineWidth = 10 +ctx.strokeStyle = '#03a9f4' +ctx.fillStyle = '#03a9f4' + +// Wall +ctx.strokeRect(75, 140, 150, 110) + +// Door +ctx.fillRect(130, 190, 40, 60) + +// Roof +ctx.beginPath() +ctx.moveTo(50, 140) +ctx.lineTo(150, 60) +ctx.lineTo(250, 140) +ctx.closePath() +ctx.stroke() + +async function main() { + // load images from disk or from a URL + const catImage = await loadImage('path/to/cat.png') + const dogImage = await loadImage('https://example.com/path/to/dog.jpg') + + ctx.drawImage(catImage, 0, 0, catImage.width, catImage.height) + + ctx.drawImage(dogImage, canvas.width / 2, canvas.height / 2, dogImage.width, dogImage.height) + + // export canvas as image + const pngData = await canvas.encode('png') // JPEG, AVIF and WebP are also supported + // encoding in libuv thread pool, non-blocking + await promises.writeFile(join(__dirname, 'simple.png'), pngData) +} + +main() +``` + +![](./example/simple.png) + +## Emoji text + +```js +const { writeFileSync } = require('fs') +const { join } = require('path') + +const { createCanvas, GlobalFonts } = require('@napi-rs/canvas') + +GlobalFonts.registerFromPath(join(__dirname, '..', 'fonts', 'AppleColorEmoji@2x.ttf'), 'Apple Emoji') +GlobalFonts.registerFromPath(join(__dirname, '..', '__test__', 'fonts', 'COLRv1.ttf'), 'COLRv1') + +console.info(GlobalFonts.families) + +const canvas = createCanvas(760, 360) +const ctx = canvas.getContext('2d') + +ctx.font = '50px Apple Emoji' +ctx.strokeText('😀😃😄😁😆😅😂🤣☺️😊😊😇', 50, 150) + +ctx.font = '100px COLRv1' +ctx.fillText('abc', 50, 300) + +const b = canvas.toBuffer('image/png') + +writeFileSync(join(__dirname, 'draw-emoji.png'), b) +``` + +![](./example/draw-emoji.png) + +# Performance + +See [benchmark](./benchmark) for benchmark code. + +Hardware info: + +``` + ,MMMM. Host - xxxxxxxxxxxxxxxxxxxxxxx + .MMMMMM Machine - Mac15,9 + MMMMM, Kernel - 24.0.0 + .;MMMMM:' MMMMMMMMMM;. OS - macOS 15.0.1 Sequoia + MMMMMMMMMMMMNWMMMMMMMMMMM: DE - Aqua + .MMMMMMMMMMMMMMMMMMMMMMMMWM. WM - Quartz Compositor + MMMMMMMMMMMMMMMMMMMMMMMMM. Packages - 194 (Homebrew), 32 (cargo) + ;MMMMMMMMMMMMMMMMMMMMMMMM: Shell - zsh + :MMMMMMMMMMMMMMMMMMMMMMMM: Terminal - warpterminal (Version v0.2024.10.23.14.49.stable_00) + .MMMMMMMMMMMMMMMMMMMMMMMMM. Resolution - 5120x2880@160fps (as 2560x1440) + MMMMMMMMMMMMMMMMMMMMMMMMMMM. 2992x1934@120fps (as 1496x967) + .MMMMMMMMMMMMMMMMMMMMMMMMMM. 2232x1512@60fps (as 1116x756) + MMMMMMMMMMMMMMMMMMMMMMMM Uptime - 1d 2h 32m + ;MMMMMMMMMMMMMMMMMMMM. CPU - Apple M3 Max (16) + .MMMM,. .MMMM,. CPU Load - 16% + Memory - 50.1 GB / 134.2 GB + Battery - 78% & Discharging + Disk Space - 624.0 GB / 994.7 GB +``` + +``` +❯ yarn bench +Draw a House and export to PNG +┌─────────┬─────────────────┬───────────────────────┬──────────────────────────┬────────────────────────────┬───────────────────────────┬─────────┐ +│ (index) │ Task name │ Latency average (ns) │ Latency median (ns) │ Throughput average (ops/s) │ Throughput median (ops/s) │ Samples │ +├─────────┼─────────────────┼───────────────────────┼──────────────────────────┼────────────────────────────┼───────────────────────────┼─────────┤ +│ 0 │ '@napi-rs/skia' │ '14676992.14 ± 0.68%' │ '14602333.00' │ '68 ± 0.59%' │ '68' │ 69 │ +│ 1 │ 'skia-canvas' │ '21167809.17 ± 2.05%' │ '20960021.00 ± 13646.00' │ '47 ± 1.31%' │ '48' │ 64 │ +│ 2 │ 'node-canvas' │ '16552027.42 ± 0.70%' │ '16451291.50 ± 2208.50' │ '60 ± 0.62%' │ '61' │ 64 │ +└─────────┴─────────────────┴───────────────────────┴──────────────────────────┴────────────────────────────┴───────────────────────────┴─────────┘ +Draw Gradient and export to PNG +┌─────────┬─────────────────┬───────────────────────┬─────────────────────────┬────────────────────────────┬───────────────────────────┬─────────┐ +│ (index) │ Task name │ Latency average (ns) │ Latency median (ns) │ Throughput average (ops/s) │ Throughput median (ops/s) │ Samples │ +├─────────┼─────────────────┼───────────────────────┼─────────────────────────┼────────────────────────────┼───────────────────────────┼─────────┤ +│ 0 │ '@napi-rs/skia' │ '15228495.58 ± 0.53%' │ '15146312.50 ± 1187.50' │ '66 ± 0.48%' │ '66' │ 66 │ +│ 1 │ 'skia-canvas' │ '21725564.41 ± 2.20%' │ '21412520.50 ± 2104.50' │ '46 ± 1.39%' │ '47' │ 64 │ +│ 2 │ 'node-canvas' │ '17976022.14 ± 1.53%' │ '17563479.50 ± 5104.50' │ '56 ± 1.38%' │ '57' │ 64 │ +└─────────┴─────────────────┴───────────────────────┴─────────────────────────┴────────────────────────────┴───────────────────────────┴─────────┘ +``` + +# Features + +## Path2D + +```typescript +new Path2D() +new Path2D(path: Path2D) +// new Path2D('M108.956,403.826c0,0,0.178,3.344-1.276,3.311 c-1.455-0.033-30.507-84.917-66.752-80.957C40.928,326.18,72.326,313.197,108.956,403.826z') +new Path2D(path: string) +``` + +```typescript +export interface DOMMatrix2DInit { + a: number + b: number + c: number + d: number + e: number + f: number +} + +export class Path2D { + constructor(path?: Path2D | string) + + addPath(path: Path2D, transform?: DOMMatrix2DInit): void + arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void + arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void + bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void + closePath(): void + ellipse( + x: number, + y: number, + radiusX: number, + radiusY: number, + rotation: number, + startAngle: number, + endAngle: number, + anticlockwise?: boolean, + ): void + lineTo(x: number, y: number): void + moveTo(x: number, y: number): void + quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void + rect(x: number, y: number, w: number, h: number): void + + // PathKit methods + op(path: Path2D, operation: PathOp): Path2D + toSVGString(): string + getFillType(): FillType + getFillTypeString(): string + setFillType(type: FillType): void + simplify(): Path2D + asWinding(): Path2D + stroke(stroke?: StrokeOptions): Path2D + transform(transform: DOMMatrix2DInit): Path2D + getBounds(): [left: number, top: number, right: number, bottom: number] + computeTightBounds(): [left: number, top: number, right: number, bottom: number] + trim(start: number, end: number, isComplement?: boolean): Path2D + round(radius: number): Path2D + equals(path: Path2D): boolean +} +``` + +## PathKit + +`PathKit` is a toolset for manipulating Path in `Skia`, supporting **_quadratic beziers_**, **_cubic beziers_** and **_conics_**. +The main features are. + +### Path Operation + +`.op(path, PathOp)` + +```js +const pathOne = new Path2D( + 'M8 50H92C96.4183 50 100 53.5817 100 58V142C100 146.418 96.4183 150 92 150H8C3.58172 150 0 146.418 0 142V58C0 53.5817 3.58172 50 8 50Z', +) +const pathTwo = new Path2D( + '"M58 0H142C146.418 0 150 3.58172 150 8V92C150 96.4183 146.418 100 142 100H58C53.5817 100 50 96.4183 50 92V8C50 3.58172 53.5817 0 58 0Z', +) + +pathOne.op(pathTwo, PathOp.Intersect).toSVGString() +// => "M100 100L58 100C53.5817 100 50 96.4183 50 92L50 50L92 50C96.4183 50 100 53.5817 100 58L100 100Z" +``` + +- **Union**, subtract the op path from the first path +- **Difference**, intersect the two paths +- **ReverseDifference**, union (inclusive-or) the two paths +- **Intersect**, exclusive-or the two paths +- **XOR**, subtract the first path from the op path + +![boolean-operations](./docs/imgs/boolean-operations.svg) + +### Covert `FillType` in **_Path_** + +`.asWinding()` + +You can convert `fill-rule="evenodd"` to `fill-rule="nonzero"` in SVG. +This is useful for **OpenType** font-related tools, as `fill-rule="nonzero"` is only supported in **OpenType** fonts. + +![SVG fill-rule](./docs/imgs/asWinding@2x.png) + +```js +const pathCircle = new Path2D( + 'M24.2979 13.6364H129.394V40.9091H24.2979L14.6278 27.2727L24.2979 13.6364ZM21.9592 0C19.0246 0 16.2716 1.42436 14.571 3.82251L1.67756 22.0043C-0.559186 25.1585 -0.559186 29.387 1.67756 32.5411L14.571 50.7227C16.2716 53.1209 19.0246 54.5455 21.9592 54.5455H70.4673V68.1818H16.073C11.0661 68.1818 7.00728 72.2518 7.00728 77.2727V113.636C7.00728 118.657 11.0661 122.727 16.073 122.727H70.4673V150H84.0658V122.727H128.041C130.975 122.727 133.729 121.303 135.429 118.905L148.323 100.723C150.559 97.5686 150.559 93.3405 148.323 90.1864L135.429 72.0045C133.729 69.6064 130.975 68.1818 128.041 68.1818H84.0658V54.5455H133.927C138.934 54.5455 142.993 50.4755 142.993 45.4545V9.09091C142.993 4.07014 138.934 0 133.927 0H21.9592ZM125.702 109.091H20.6058V81.8182H125.702L135.372 95.4545L125.702 109.091Z', +) +pathCircle.setFillType(FillType.EvenOdd) +pathCircle.asWinding().toSVGString() +// => "M24.2979 13.6364L129.394 13.6364L129.394 40.9091L24.2979 40.9091L14.6278 27.2727L24.2979 13.6364ZM21.9592 0C19.0246 0 16.2716 1.42436 14.571 3.82251L1.67756 22.0043C-0.559186 25.1585 -0.559186 29.387 1.67756 32.5411L14.571 50.7227C16.2716 53.1209 19.0246 54.5455 21.9592 54.5455L70.4673 54.5455L70.4673 68.1818L16.073 68.1818C11.0661 68.1818 7.00728 72.2518 7.00728 77.2727L7.00728 113.636C7.00728 118.657 11.0661 122.727 16.073 122.727L70.4673 122.727L70.4673 150L84.0658 150L84.0658 122.727L128.041 122.727C130.975 122.727 133.729 121.303 135.429 118.905L148.323 100.723C150.559 97.5686 150.559 93.3405 148.323 90.1864L135.429 72.0045C133.729 69.6064 130.975 68.1818 128.041 68.1818L84.0658 68.1818L84.0658 54.5455L133.927 54.5455C138.934 54.5455 142.993 50.4755 142.993 45.4545L142.993 9.09091C142.993 4.07014 138.934 0 133.927 0L21.9592 0ZM125.702 109.091L20.6058 109.091L20.6058 81.8182L125.702 81.8182L135.372 95.4545L125.702 109.091Z" +``` + +### Simplify **_Path_** + +`.simplify()` + +Set the path to the same non-overlapping contour as the original path area, which means that it can also remove overlapping paths. + + + +[SVG with overlapping paths](./docs/imgs/overlapping-path.svg) (Left) + +```js +const path = + 'M2.933,89.89 L89.005,3.818 Q90.412,2.411 92.249,1.65 Q94.087,0.889 96.076,0.889 Q98.065,0.889 99.903,1.65 Q101.741,2.411 103.147,3.818 L189.22,89.89 Q190.626,91.296 191.387,93.134 Q192.148,94.972 192.148,96.961 Q192.148,98.95 191.387,100.788 Q190.626,102.625 189.219,104.032 Q187.813,105.439 185.975,106.2 Q184.138,106.961 182.148,106.961 Q180.159,106.961 178.322,106.2 Q176.484,105.439 175.077,104.032 L89.005,17.96 L96.076,10.889 L103.147,17.96 L17.075,104.032 Q15.668,105.439 13.831,106.2 Q11.993,106.961 10.004,106.961 Q8.015,106.961 6.177,106.2 Q4.339,105.439 2.933,104.032 Q1.526,102.625 0.765,100.788 Q0.004,98.95 0.004,96.961 Q0.004,94.972 0.765,93.134 Q1.526,91.296 2.933,89.89 Z' + +path.simplify().toSVGString() +// => "M89.005 3.818L2.933 89.89Q1.526 91.296 0.765 93.134Q0.004 94.972 0.004 96.961Q0.004 98.95 0.765 100.788Q1.526 102.625 2.933 104.032Q4.339 105.439 6.177 106.2Q8.015 106.961 10.004 106.961Q11.993 106.961 13.831 106.2Q15.668 105.439 17.075 104.032L96.076 25.031L175.077 104.032Q176.484 105.439 178.322 106.2Q180.159 106.961 182.148 106.961Q184.138 106.961 185.975 106.2Q187.813 105.439 189.219 104.032Q190.626 102.625 191.387 100.788Q192.148 98.95 192.148 96.961Q192.148 94.972 191.387 93.134Q190.626 91.296 189.22 89.89L103.147 3.818Q101.741 2.411 99.903 1.65Q98.065 0.889 96.076 0.889Q94.087 0.889 92.249 1.65Q90.412 2.411 89.005 3.818Z" +``` + +## Lottie Animation + +Render [Lottie](https://airbnb.io/lottie/) animations using Skia's [Skottie](https://skia.org/docs/user/modules/skottie/) module. + +### Load Animation + +```js +const { LottieAnimation } = require('@napi-rs/canvas') + +// Load from file +const animation = LottieAnimation.loadFromFile('animation.json') + +// Load from JSON string with resource path for external assets +const animation = LottieAnimation.loadFromData(jsonString, { + resourcePath: '/path/to/assets', +}) +``` + +### Animation Properties + +```js +animation.duration // Total duration in seconds +animation.fps // Frames per second +animation.frames // Total frame count +animation.width // Animation width +animation.height // Animation height +animation.version // Lottie format version +``` + +### Playback Control + +```js +animation.seekFrame(30) // Seek to frame 30 +animation.seek(1.5) // Seek to 1.5 seconds +``` + +### Render to Canvas + +```js +const { createCanvas, LottieAnimation } = require('@napi-rs/canvas') + +const animation = LottieAnimation.loadFromFile('animation.json') +const canvas = createCanvas(animation.width, animation.height) +const ctx = canvas.getContext('2d') + +// Render at original size +animation.render(ctx) + +// Render with custom destination rect +animation.render(ctx, { x: 0, y: 0, width: 800, height: 600 }) +``` + +### Supported Features + +- **Embedded images** - Base64-encoded images (`data:image/png;base64,...`) +- **Embedded fonts** - Vector glyph paths for text rendering without system fonts +- **External assets** - Load images from `resourcePath` directory +- **dotLottie format** - Extract `.lottie` ZIP files at runtime (see example) + +### Example: Encode Lottie to Video + +See [`example/lottie-to-video.ts`](./example/lottie-to-video.ts) for encoding Lottie animations to MP4 using [`@napi-rs/webcodecs`](https://github.com/Brooooooklyn/webcodecs-node). + +```js +import { createCanvas, LottieAnimation } from '@napi-rs/canvas' +import { + VideoEncoder, + VideoFrame, + Mp4Muxer, + type EncodedVideoChunk, + type EncodedVideoChunkMetadata, +} from '@napi-rs/webcodecs' + +const animation = LottieAnimation.loadFromFile('animation.json') +const canvas = createCanvas(animation.width, animation.height) +const ctx = canvas.getContext('2d') + +for (let frame = 0; frame < animation.frames; frame++) { + animation.seekFrame(frame) + ctx.fillStyle = '#ffffff' + ctx.fillRect(0, 0, canvas.width, canvas.height) + animation.render(ctx) + // Encode frame to video... +} +``` + +# [Example](./example/tiger.js) + +> The tiger.json was serialized from [gojs/samples/tiger](https://github.com/NorthwoodsSoftware/GoJS/blob/master/samples/tiger.html) + + + +```shell +node example/anime-girl.js +``` + +| SVG | PNG | +| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +|
[CC-BY-SA 3.0](https://creativecommons.org/licenses/by/3.0) by [Niabot](https://commons.wikimedia.org/wiki/User:Niabot) |
[CC-BY-SA 3.0](https://creativecommons.org/licenses/by/3.0) by [Niabot](https://commons.wikimedia.org/wiki/User:Niabot) | + +# Building + +## Build skia from source + +You can build this project from source, the system requirements are here: https://skia.org/docs/user/build + +```sh +# Clone the code: +$ git clone --recurse-submodules https://github.com/Brooooooklyn/canvas.git +$ cd canvas + +# Build Skia: +$ node scripts/build-skia.js + +# Install NPM packages, build the Node.js addon: +$ npm install -g yarn +$ yarn install --mode=skip-build # Here are modules that are used for benchmarking and are hard to install, you can skip it by specifying `--mode=skip-build` +$ sudo dnf install clang # https://fedora.pkgs.org/34/fedora-x86_64/clang-12.0.0-0.3.rc1.fc34.x86_64.rpm.html +$ yarn build + +# All done! Run test cases or examples now: +$ yarn test +$ node example/tiger.js +``` + +## Pull pre-build skia binary from GitHub + +You can pull skia pre-build binaries if you just care the `Rust` part: + +```sh +# Clone the code: +$ git clone --recurse-submodules https://github.com/Brooooooklyn/canvas.git +$ cd canvas + +# Download Skia binaries: +# It will pull the binaries match the git hash in `./skia` submodule +$ node scripts/release-skia-binary.mjs --download + +# Install NPM packages, build the Node.js addon: +$ npm install -g yarn +$ yarn install --mode=skip-build +$ sudo dnf install clang # https://fedora.pkgs.org/34/fedora-x86_64/clang-12.0.0-0.3.rc1.fc34.x86_64.rpm.html +$ yarn build + +# All done! Run test cases or examples now: +$ yarn test +$ node example/tiger.js +``` diff --git a/tools/ui/node_modules/@napi-rs/canvas/geometry.js b/tools/ui/node_modules/@napi-rs/canvas/geometry.js new file mode 100644 index 0000000000000000000000000000000000000000..04152acda4581b2562e4f79feb6a07c80e5be15f --- /dev/null +++ b/tools/ui/node_modules/@napi-rs/canvas/geometry.js @@ -0,0 +1,873 @@ +const { inspect } = require('util') +/* + * vendored in order to fix its dependence on the window global [cds 2020/08/04] + * otherwise unchanged from https://github.com/jarek-foksa/geometry-polyfill/tree/f36bbc8f4bc43539d980687904ce46c8e915543d + */ + +// @info +// DOMPoint polyfill +// @src +// https://drafts.fxtf.org/geometry/#DOMPoint +// https://github.com/chromium/chromium/blob/master/third_party/blink/renderer/core/geometry/dom_point_read_only.cc +class DOMPoint { + constructor(x = 0, y = 0, z = 0, w = 1) { + this.x = x + this.y = y + this.z = z + this.w = w + } + + static fromPoint(otherPoint) { + return new DOMPoint( + otherPoint.x, + otherPoint.y, + otherPoint.z !== undefined ? otherPoint.z : 0, + otherPoint.w !== undefined ? otherPoint.w : 1, + ) + } + + matrixTransform(matrix) { + if ((matrix.is2D || matrix instanceof SVGMatrix) && this.z === 0 && this.w === 1) { + return new DOMPoint( + this.x * matrix.a + this.y * matrix.c + matrix.e, + this.x * matrix.b + this.y * matrix.d + matrix.f, + 0, + 1, + ) + } else { + return new DOMPoint( + this.x * matrix.m11 + this.y * matrix.m21 + this.z * matrix.m31 + this.w * matrix.m41, + this.x * matrix.m12 + this.y * matrix.m22 + this.z * matrix.m32 + this.w * matrix.m42, + this.x * matrix.m13 + this.y * matrix.m23 + this.z * matrix.m33 + this.w * matrix.m43, + this.x * matrix.m14 + this.y * matrix.m24 + this.z * matrix.m34 + this.w * matrix.m44, + ) + } + } + + toJSON() { + return { + x: this.x, + y: this.y, + z: this.z, + w: this.w, + } + } +} + +// @info +// DOMRect polyfill +// @src +// https://drafts.fxtf.org/geometry/#DOMRect +// https://github.com/chromium/chromium/blob/master/third_party/blink/renderer/core/geometry/dom_rect_read_only.cc + +class DOMRect { + constructor(x = 0, y = 0, width = 0, height = 0) { + this.x = x + this.y = y + this.width = width + this.height = height + } + + static fromRect(otherRect) { + return new DOMRect(otherRect.x, otherRect.y, otherRect.width, otherRect.height) + } + + get top() { + return this.y + } + + get left() { + return this.x + } + + get right() { + return this.x + this.width + } + + get bottom() { + return this.y + this.height + } + + toJSON() { + return { + x: this.x, + y: this.y, + width: this.width, + height: this.height, + top: this.top, + left: this.left, + right: this.right, + bottom: this.bottom, + } + } +} + +for (const propertyName of ['top', 'right', 'bottom', 'left']) { + const propertyDescriptor = Object.getOwnPropertyDescriptor(DOMRect.prototype, propertyName) + propertyDescriptor.enumerable = true + Object.defineProperty(DOMRect.prototype, propertyName, propertyDescriptor) +} + +// @info +// DOMMatrix polyfill (SVG 2) +// @src +// https://github.com/chromium/chromium/blob/master/third_party/blink/renderer/core/geometry/dom_matrix_read_only.cc +// https://github.com/tocharomera/generativecanvas/blob/master/node-canvas/lib/DOMMatrix.js + +const M11 = 0, + M12 = 1, + M13 = 2, + M14 = 3 +const M21 = 4, + M22 = 5, + M23 = 6, + M24 = 7 +const M31 = 8, + M32 = 9, + M33 = 10, + M34 = 11 +const M41 = 12, + M42 = 13, + M43 = 14, + M44 = 15 + +const A = M11, + B = M12 +const C = M21, + D = M22 +const E = M41, + F = M42 + +const DEGREE_PER_RAD = 180 / Math.PI +const RAD_PER_DEGREE = Math.PI / 180 + +const VALUES = Symbol('values') +const IS_2D = Symbol('is2D') + +function parseMatrix(init) { + let parsed = init.replace(/matrix\(/, '').split(/,/, 7) + + if (parsed.length !== 6) { + throw new Error(`Failed to parse ${init}`) + } + + parsed = parsed.map(parseFloat) + + return [parsed[0], parsed[1], 0, 0, parsed[2], parsed[3], 0, 0, 0, 0, 1, 0, parsed[4], parsed[5], 0, 1] +} + +function parseMatrix3d(init) { + const parsed = init.replace(/matrix3d\(/, '').split(/,/, 17) + + if (parsed.length !== 16) { + throw new Error(`Failed to parse ${init}`) + } + + return parsed.map(parseFloat) +} + +function parseTransform(tform) { + const type = tform.split(/\(/, 1)[0] + + if (type === 'matrix') { + return parseMatrix(tform) + } else if (type === 'matrix3d') { + return parseMatrix3d(tform) + } else { + throw new Error(`${type} parsing not implemented`) + } +} + +const setNumber2D = (receiver, index, value) => { + if (typeof value !== 'number') { + throw new TypeError('Expected number') + } + + receiver[VALUES][index] = value +} + +const setNumber3D = (receiver, index, value) => { + if (typeof value !== 'number') { + throw new TypeError('Expected number') + } + + if (index === M33 || index === M44) { + if (value !== 1) { + receiver[IS_2D] = false + } + } else if (value !== 0) { + receiver[IS_2D] = false + } + + receiver[VALUES][index] = value +} + +const newInstance = (values) => { + const instance = Object.create(DOMMatrix.prototype) + instance.constructor = DOMMatrix + instance[IS_2D] = true + instance[VALUES] = values + + return instance +} + +const multiply = (first, second) => { + const dest = new Float64Array(16) + + for (let i = 0; i < 4; i++) { + for (let j = 0; j < 4; j++) { + let sum = 0 + + for (let k = 0; k < 4; k++) { + sum += first[i * 4 + k] * second[k * 4 + j] + } + + dest[i * 4 + j] = sum + } + } + + return dest +} + +class DOMMatrix { + get m11() { + return this[VALUES][M11] + } + set m11(value) { + setNumber2D(this, M11, value) + } + get m12() { + return this[VALUES][M12] + } + set m12(value) { + setNumber2D(this, M12, value) + } + get m13() { + return this[VALUES][M13] + } + set m13(value) { + setNumber3D(this, M13, value) + } + get m14() { + return this[VALUES][M14] + } + set m14(value) { + setNumber3D(this, M14, value) + } + get m21() { + return this[VALUES][M21] + } + set m21(value) { + setNumber2D(this, M21, value) + } + get m22() { + return this[VALUES][M22] + } + set m22(value) { + setNumber2D(this, M22, value) + } + get m23() { + return this[VALUES][M23] + } + set m23(value) { + setNumber3D(this, M23, value) + } + get m24() { + return this[VALUES][M24] + } + set m24(value) { + setNumber3D(this, M24, value) + } + get m31() { + return this[VALUES][M31] + } + set m31(value) { + setNumber3D(this, M31, value) + } + get m32() { + return this[VALUES][M32] + } + set m32(value) { + setNumber3D(this, M32, value) + } + get m33() { + return this[VALUES][M33] + } + set m33(value) { + setNumber3D(this, M33, value) + } + get m34() { + return this[VALUES][M34] + } + set m34(value) { + setNumber3D(this, M34, value) + } + get m41() { + return this[VALUES][M41] + } + set m41(value) { + setNumber2D(this, M41, value) + } + get m42() { + return this[VALUES][M42] + } + set m42(value) { + setNumber2D(this, M42, value) + } + get m43() { + return this[VALUES][M43] + } + set m43(value) { + setNumber3D(this, M43, value) + } + get m44() { + return this[VALUES][M44] + } + set m44(value) { + setNumber3D(this, M44, value) + } + + get a() { + return this[VALUES][A] + } + set a(value) { + setNumber2D(this, A, value) + } + get b() { + return this[VALUES][B] + } + set b(value) { + setNumber2D(this, B, value) + } + get c() { + return this[VALUES][C] + } + set c(value) { + setNumber2D(this, C, value) + } + get d() { + return this[VALUES][D] + } + set d(value) { + setNumber2D(this, D, value) + } + get e() { + return this[VALUES][E] + } + set e(value) { + setNumber2D(this, E, value) + } + get f() { + return this[VALUES][F] + } + set f(value) { + setNumber2D(this, F, value) + } + + get is2D() { + return this[IS_2D] + } + + get isIdentity() { + const values = this[VALUES] + + return ( + values[M11] === 1 && + values[M12] === 0 && + values[M13] === 0 && + values[M14] === 0 && + values[M21] === 0 && + values[M22] === 1 && + values[M23] === 0 && + values[M24] === 0 && + values[M31] === 0 && + values[M32] === 0 && + values[M33] === 1 && + values[M34] === 0 && + values[M41] === 0 && + values[M42] === 0 && + values[M43] === 0 && + values[M44] === 1 + ) + } + + static fromMatrix(init) { + if (init instanceof DOMMatrix) { + return new DOMMatrix(init[VALUES]) + } else if (init instanceof SVGMatrix) { + return new DOMMatrix([init.a, init.b, init.c, init.d, init.e, init.f]) + } else { + throw new TypeError('Expected DOMMatrix') + } + } + + static fromFloat32Array(init) { + if (!(init instanceof Float32Array)) throw new TypeError('Expected Float32Array') + return new DOMMatrix(init) + } + + static fromFloat64Array(init) { + if (!(init instanceof Float64Array)) throw new TypeError('Expected Float64Array') + return new DOMMatrix(init) + } + + // @type + // (Float64Array) => void + constructor(init) { + this[IS_2D] = true + + this[VALUES] = new Float64Array([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]) + + // Parse CSS transformList + if (typeof init === 'string') { + if (init === '') { + return + } else { + const tforms = init.split(/\)\s+/, 20).map(parseTransform) + + if (tforms.length === 0) { + return + } + + init = tforms[0] + + for (let i = 1; i < tforms.length; i++) { + init = multiply(tforms[i], init) + } + } + } + + let i = 0 + + if (init && init.length === 6) { + setNumber2D(this, A, init[i++]) + setNumber2D(this, B, init[i++]) + setNumber2D(this, C, init[i++]) + setNumber2D(this, D, init[i++]) + setNumber2D(this, E, init[i++]) + setNumber2D(this, F, init[i++]) + } else if (init && init.length === 16) { + setNumber2D(this, M11, init[i++]) + setNumber2D(this, M12, init[i++]) + setNumber3D(this, M13, init[i++]) + setNumber3D(this, M14, init[i++]) + setNumber2D(this, M21, init[i++]) + setNumber2D(this, M22, init[i++]) + setNumber3D(this, M23, init[i++]) + setNumber3D(this, M24, init[i++]) + setNumber3D(this, M31, init[i++]) + setNumber3D(this, M32, init[i++]) + setNumber3D(this, M33, init[i++]) + setNumber3D(this, M34, init[i++]) + setNumber2D(this, M41, init[i++]) + setNumber2D(this, M42, init[i++]) + setNumber3D(this, M43, init[i++]) + setNumber3D(this, M44, init[i]) + } else if (init !== undefined) { + throw new TypeError('Expected string or array.') + } + } + + dump() { + const mat = this[VALUES] + console.info([mat.slice(0, 4), mat.slice(4, 8), mat.slice(8, 12), mat.slice(12, 16)]) + } + + [inspect.custom](depth) { + if (depth < 0) return '[DOMMatrix]' + + const { a, b, c, d, e, f, is2D, isIdentity } = this + if (this.is2D) { + return `DOMMatrix ${inspect({ a, b, c, d, e, f, is2D, isIdentity }, { colors: true })}` + } else { + const { m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44, is2D, isIdentity } = this + return `DOMMatrix ${inspect( + { + a, + b, + c, + d, + e, + f, + m11, + m12, + m13, + m14, + m21, + m22, + m23, + m24, + m31, + m32, + m33, + m34, + m41, + m42, + m43, + m44, + is2D, + isIdentity, + }, + { colors: true }, + )}` + } + } + + multiply(other) { + return newInstance(this[VALUES]).multiplySelf(other) + } + + multiplySelf(other) { + this[VALUES] = multiply(other[VALUES], this[VALUES]) + + if (!other.is2D) { + this[IS_2D] = false + } + + return this + } + + preMultiplySelf(other) { + this[VALUES] = multiply(this[VALUES], other[VALUES]) + + if (!other.is2D) { + this[IS_2D] = false + } + + return this + } + + translate(tx, ty, tz) { + return newInstance(this[VALUES]).translateSelf(tx, ty, tz) + } + + translateSelf(tx = 0, ty = 0, tz = 0) { + this[VALUES] = multiply([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, tx, ty, tz, 1], this[VALUES]) + + if (tz !== 0) { + this[IS_2D] = false + } + + return this + } + + scale(scaleX, scaleY, scaleZ, originX, originY, originZ) { + return newInstance(this[VALUES]).scaleSelf(scaleX, scaleY, scaleZ, originX, originY, originZ) + } + + scale3d(scale, originX, originY, originZ) { + return newInstance(this[VALUES]).scale3dSelf(scale, originX, originY, originZ) + } + + scale3dSelf(scale, originX, originY, originZ) { + return this.scaleSelf(scale, scale, scale, originX, originY, originZ) + } + + scaleSelf(scaleX, scaleY, scaleZ, originX, originY, originZ) { + // Not redundant with translate's checks because we need to negate the values later. + if (typeof originX !== 'number') originX = 0 + if (typeof originY !== 'number') originY = 0 + if (typeof originZ !== 'number') originZ = 0 + + this.translateSelf(originX, originY, originZ) + + if (typeof scaleX !== 'number') scaleX = 1 + if (typeof scaleY !== 'number') scaleY = scaleX + if (typeof scaleZ !== 'number') scaleZ = 1 + + this[VALUES] = multiply([scaleX, 0, 0, 0, 0, scaleY, 0, 0, 0, 0, scaleZ, 0, 0, 0, 0, 1], this[VALUES]) + + this.translateSelf(-originX, -originY, -originZ) + + if (scaleZ !== 1 || originZ !== 0) { + this[IS_2D] = false + } + + return this + } + + rotateFromVector(x, y) { + return newInstance(this[VALUES]).rotateFromVectorSelf(x, y) + } + + rotateFromVectorSelf(x = 0, y = 0) { + const theta = x === 0 && y === 0 ? 0 : Math.atan2(y, x) * DEGREE_PER_RAD + return this.rotateSelf(theta) + } + + rotate(rotX, rotY, rotZ) { + return newInstance(this[VALUES]).rotateSelf(rotX, rotY, rotZ) + } + + rotateSelf(rotX, rotY, rotZ) { + if (rotY === undefined && rotZ === undefined) { + rotZ = rotX + rotX = rotY = 0 + } + + if (typeof rotY !== 'number') rotY = 0 + if (typeof rotZ !== 'number') rotZ = 0 + + if (rotX !== 0 || rotY !== 0) { + this[IS_2D] = false + } + + rotX *= RAD_PER_DEGREE + rotY *= RAD_PER_DEGREE + rotZ *= RAD_PER_DEGREE + + let c = Math.cos(rotZ) + let s = Math.sin(rotZ) + + this[VALUES] = multiply([c, s, 0, 0, -s, c, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], this[VALUES]) + + c = Math.cos(rotY) + s = Math.sin(rotY) + + this[VALUES] = multiply([c, 0, -s, 0, 0, 1, 0, 0, s, 0, c, 0, 0, 0, 0, 1], this[VALUES]) + + c = Math.cos(rotX) + s = Math.sin(rotX) + + this[VALUES] = multiply([1, 0, 0, 0, 0, c, s, 0, 0, -s, c, 0, 0, 0, 0, 1], this[VALUES]) + + return this + } + + rotateAxisAngle(x, y, z, angle) { + return newInstance(this[VALUES]).rotateAxisAngleSelf(x, y, z, angle) + } + + rotateAxisAngleSelf(x = 0, y = 0, z = 0, angle = 0) { + const length = Math.sqrt(x * x + y * y + z * z) + + if (length === 0) { + return this + } + + if (length !== 1) { + x /= length + y /= length + z /= length + } + + angle *= RAD_PER_DEGREE + + const c = Math.cos(angle) + const s = Math.sin(angle) + const t = 1 - c + const tx = t * x + const ty = t * y + + this[VALUES] = multiply( + [ + tx * x + c, + tx * y + s * z, + tx * z - s * y, + 0, + tx * y - s * z, + ty * y + c, + ty * z + s * x, + 0, + tx * z + s * y, + ty * z - s * x, + t * z * z + c, + 0, + 0, + 0, + 0, + 1, + ], + this[VALUES], + ) + + if (x !== 0 || y !== 0) { + this[IS_2D] = false + } + + return this + } + + skewX(sx) { + return newInstance(this[VALUES]).skewXSelf(sx) + } + + skewXSelf(sx) { + if (typeof sx !== 'number') { + return this + } + + const t = Math.tan(sx * RAD_PER_DEGREE) + + this[VALUES] = multiply([1, 0, 0, 0, t, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], this[VALUES]) + + return this + } + + skewY(sy) { + return newInstance(this[VALUES]).skewYSelf(sy) + } + + skewYSelf(sy) { + if (typeof sy !== 'number') { + return this + } + + const t = Math.tan(sy * RAD_PER_DEGREE) + + this[VALUES] = multiply([1, t, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], this[VALUES]) + + return this + } + + flipX() { + return newInstance(multiply([-1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], this[VALUES])) + } + + flipY() { + return newInstance(multiply([1, 0, 0, 0, 0, -1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], this[VALUES])) + } + + inverse() { + return newInstance(this[VALUES].slice()).invertSelf() + } + + invertSelf() { + if (this[IS_2D]) { + const det = this[VALUES][A] * this[VALUES][D] - this[VALUES][B] * this[VALUES][C] + + // Invertable + if (det !== 0) { + const newA = this[VALUES][D] / det + const newB = -this[VALUES][B] / det + const newC = -this[VALUES][C] / det + const newD = this[VALUES][A] / det + const newE = (this[VALUES][C] * this[VALUES][F] - this[VALUES][D] * this[VALUES][E]) / det + const newF = (this[VALUES][B] * this[VALUES][E] - this[VALUES][A] * this[VALUES][F]) / det + + this.a = newA + this.b = newB + this.c = newC + this.d = newD + this.e = newE + this.f = newF + + return this + } + + // Not invertable + else { + this[IS_2D] = false + + this[VALUES] = [NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN, NaN] + + return this + } + } else { + throw new Error('3D matrix inversion is not implemented.') + } + } + + setMatrixValue(transformList) { + const temp = new DOMMatrix(transformList) + + this[VALUES] = temp[VALUES] + this[IS_2D] = temp[IS_2D] + + return this + } + + transformPoint(point) { + const x = point.x || 0 + const y = point.y || 0 + const z = point.z || 0 + const w = point.w || 1 + + const values = this[VALUES] + + const nx = values[M11] * x + values[M21] * y + values[M31] * z + values[M41] * w + const ny = values[M12] * x + values[M22] * y + values[M32] * z + values[M42] * w + const nz = values[M13] * x + values[M23] * y + values[M33] * z + values[M43] * w + const nw = values[M14] * x + values[M24] * y + values[M34] * z + values[M44] * w + + return new DOMPoint(nx, ny, nz, nw) + } + + toFloat32Array() { + return Float32Array.from(this[VALUES]) + } + + toFloat64Array() { + return this[VALUES].slice(0) + } + + toJSON() { + return { + a: this.a, + b: this.b, + c: this.c, + d: this.d, + e: this.e, + f: this.f, + m11: this.m11, + m12: this.m12, + m13: this.m13, + m14: this.m14, + m21: this.m21, + m22: this.m22, + m23: this.m23, + m24: this.m24, + m31: this.m31, + m32: this.m32, + m33: this.m33, + m34: this.m34, + m41: this.m41, + m42: this.m42, + m43: this.m43, + m44: this.m44, + is2D: this.is2D, + isIdentity: this.isIdentity, + } + } + + toString() { + if (this.is2D) { + return `matrix(${this.a}, ${this.b}, ${this.c}, ${this.d}, ${this.e}, ${this.f})` + } else { + return `matrix3d(${this[VALUES].join(', ')})` + } + } +} + +for (const propertyName of [ + 'a', + 'b', + 'c', + 'd', + 'e', + 'f', + 'm11', + 'm12', + 'm13', + 'm14', + 'm21', + 'm22', + 'm23', + 'm24', + 'm31', + 'm32', + 'm33', + 'm34', + 'm41', + 'm42', + 'm43', + 'm44', + 'is2D', + 'isIdentity', +]) { + const propertyDescriptor = Object.getOwnPropertyDescriptor(DOMMatrix.prototype, propertyName) + propertyDescriptor.enumerable = true + Object.defineProperty(DOMMatrix.prototype, propertyName, propertyDescriptor) +} + +module.exports = { DOMPoint, DOMMatrix, DOMRect } diff --git a/tools/ui/node_modules/@napi-rs/canvas/index.d.ts b/tools/ui/node_modules/@napi-rs/canvas/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..352e4c9ccce79674f602f4a0d8131766af6bfc38 --- /dev/null +++ b/tools/ui/node_modules/@napi-rs/canvas/index.d.ts @@ -0,0 +1,1097 @@ +import { ReadableStream } from 'node:stream/web' + +// Clear all type of caches in Skia +export function clearAllCache(): void + +interface CanvasRenderingContext2D + extends CanvasCompositing, + CanvasDrawPath, + CanvasFillStrokeStyles, + CanvasFilters, + CanvasImageData, + CanvasImageSmoothing, + CanvasPath, + CanvasPathDrawingStyles, + CanvasRect, + CanvasSettings, + CanvasShadowStyles, + CanvasState, + CanvasText, + CanvasTextDrawingStyles, + CanvasTransform, + CanvasPDFAnnotations { } + +interface CanvasState { + isContextLost(): boolean + reset(): void + restore(): void + save(): void +} +interface CanvasShadowStyles { + shadowBlur: number + shadowColor: string + shadowOffsetX: number + shadowOffsetY: number +} +interface CanvasRenderingContext2DSettings { + alpha?: boolean + colorSpace?: PredefinedColorSpace + desynchronized?: boolean + willReadFrequently?: boolean +} +interface CanvasSettings { + getContextAttributes(): CanvasRenderingContext2DSettings +} + +interface CanvasRect { + clearRect(x: number, y: number, w: number, h: number): void + fillRect(x: number, y: number, w: number, h: number): void + strokeRect(x: number, y: number, w: number, h: number): void +} + +interface TextMetrics { + readonly actualBoundingBoxAscent: number + readonly actualBoundingBoxDescent: number + readonly actualBoundingBoxLeft: number + readonly actualBoundingBoxRight: number + readonly alphabeticBaseline: number + readonly emHeightAscent: number + readonly emHeightDescent: number + readonly fontBoundingBoxAscent: number + readonly fontBoundingBoxDescent: number + readonly hangingBaseline: number + readonly ideographicBaseline: number + readonly width: number +} + +interface CanvasText { + fillText(text: string, x: number, y: number, maxWidth?: number): void + measureText(text: string): TextMetrics + strokeText(text: string, x: number, y: number, maxWidth?: number): void +} + +type CanvasLineCap = 'butt' | 'round' | 'square' +type CanvasLineJoin = 'bevel' | 'miter' | 'round' + +interface CanvasPathDrawingStyles { + lineCap: CanvasLineCap + lineDashOffset: number + lineJoin: CanvasLineJoin + lineWidth: number + miterLimit: number + getLineDash(): number[] + setLineDash(segments: number[]): void +} + +interface CanvasPath { + arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void + arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void + bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void + closePath(): void + ellipse( + x: number, + y: number, + radiusX: number, + radiusY: number, + rotation: number, + startAngle: number, + endAngle: number, + counterclockwise?: boolean, + ): void + lineTo(x: number, y: number): void + moveTo(x: number, y: number): void + quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void + rect(x: number, y: number, w: number, h: number): void + roundRect(x: number, y: number, w: number, h: number, radii?: number | DOMPointInit | (number | DOMPointInit)[]): void +} + +type ImageSmoothingQuality = 'high' | 'low' | 'medium' + +interface CanvasImageSmoothing { + imageSmoothingEnabled: boolean + imageSmoothingQuality: ImageSmoothingQuality +} + +interface CanvasTransform { + resetTransform(): void + rotate(angle: number): void + scale(x: number, y: number): void + setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void + setTransform(transform?: DOMMatrix2DInit): void + transform(a: number, b: number, c: number, d: number, e: number, f: number): void + translate(x: number, y: number): void +} + +interface CanvasPDFAnnotations { + /** + * Create a clickable URL link annotation in a PDF document. + * This is only effective when used with PDF documents. + * @param left - Left coordinate of the link rectangle + * @param top - Top coordinate of the link rectangle + * @param right - Right coordinate of the link rectangle + * @param bottom - Bottom coordinate of the link rectangle + * @param url - The URL to link to + */ + annotateLinkUrl(left: number, top: number, right: number, bottom: number, url: string): void + + /** + * Create a named destination at a specific point in a PDF document. + * This destination can be used as a target for internal links. + * @param x - X coordinate of the destination point + * @param y - Y coordinate of the destination point + * @param name - Name identifier for the destination + */ + annotateNamedDestination(x: number, y: number, name: string): void + + /** + * Create a link to a named destination within the PDF document. + * This is only effective when used with PDF documents. + * @param left - Left coordinate of the link rectangle + * @param top - Top coordinate of the link rectangle + * @param right - Right coordinate of the link rectangle + * @param bottom - Bottom coordinate of the link rectangle + * @param name - Name of the destination to link to + */ + annotateLinkToDestination(left: number, top: number, right: number, bottom: number, name: string): void +} + +type PredefinedColorSpace = 'display-p3' | 'srgb' + +interface ImageDataSettings { + colorSpace?: PredefinedColorSpace +} +interface CanvasImageData { + createImageData(sw: number, sh: number, settings?: ImageDataSettings): ImageData + createImageData(imagedata: ImageData): ImageData + getImageData(sx: number, sy: number, sw: number, sh: number, settings?: ImageDataSettings): ImageData + putImageData(imagedata: ImageData, dx: number, dy: number): void + putImageData( + imagedata: ImageData, + dx: number, + dy: number, + dirtyX: number, + dirtyY: number, + dirtyWidth: number, + dirtyHeight: number, + ): void +} + +type CanvasDirection = 'inherit' | 'ltr' | 'rtl' +type CanvasFontKerning = 'auto' | 'none' | 'normal' +type CanvasFontStretch = + | 'condensed' + | 'expanded' + | 'extra-condensed' + | 'extra-expanded' + | 'normal' + | 'semi-condensed' + | 'semi-expanded' + | 'ultra-condensed' + | 'ultra-expanded' +type CanvasFontVariantCaps = + | 'all-petite-caps' + | 'all-small-caps' + | 'normal' + | 'petite-caps' + | 'small-caps' + | 'titling-caps' + | 'unicase' +type CanvasTextAlign = 'center' | 'end' | 'left' | 'right' | 'start' +type CanvasTextBaseline = 'alphabetic' | 'bottom' | 'hanging' | 'ideographic' | 'middle' | 'top' +type CanvasTextRendering = 'auto' | 'geometricPrecision' | 'optimizeLegibility' | 'optimizeSpeed' + +interface CanvasTextDrawingStyles { + direction: CanvasDirection + font: string + fontKerning: CanvasFontKerning + fontStretch: CanvasFontStretch + fontVariantCaps: CanvasFontVariantCaps + letterSpacing: string + textAlign: CanvasTextAlign + textBaseline: CanvasTextBaseline + textRendering: CanvasTextRendering + wordSpacing: string + fontVariationSettings: string + lang: string +} + +interface CanvasFilters { + filter: string +} + +interface CanvasFillStrokeStyles { + fillStyle: string | CanvasGradient | CanvasPattern + strokeStyle: string | CanvasGradient | CanvasPattern + createConicGradient(startAngle: number, x: number, y: number): CanvasGradient + createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient + createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient +} + +type CanvasFillRule = 'evenodd' | 'nonzero' + +interface CanvasDrawPath { + beginPath(): void + clip(fillRule?: CanvasFillRule): void + clip(path: Path2D, fillRule?: CanvasFillRule): void + fill(fillRule?: CanvasFillRule): void + fill(path: Path2D, fillRule?: CanvasFillRule): void + isPointInPath(x: number, y: number, fillRule?: CanvasFillRule): boolean + isPointInPath(path: Path2D, x: number, y: number, fillRule?: CanvasFillRule): boolean + isPointInStroke(x: number, y: number): boolean + isPointInStroke(path: Path2D, x: number, y: number): boolean + stroke(): void + stroke(path: Path2D): void +} + +type GlobalCompositeOperation = + | 'color' + | 'color-burn' + | 'color-dodge' + | 'copy' + | 'darken' + | 'destination-atop' + | 'destination-in' + | 'destination-out' + | 'destination-over' + | 'difference' + | 'exclusion' + | 'hard-light' + | 'hue' + | 'lighten' + | 'lighter' + | 'luminosity' + | 'multiply' + | 'overlay' + | 'saturation' + | 'screen' + | 'soft-light' + | 'source-atop' + | 'source-in' + | 'source-out' + | 'source-over' + | 'xor' + +interface CanvasCompositing { + globalAlpha: number + globalCompositeOperation: GlobalCompositeOperation +} + +interface DOMPointInit { + w?: number + x?: number + y?: number + z?: number +} +interface CanvasPattern { + setTransform(transform?: DOMMatrix2DInit): void +} + +interface CanvasGradient { + addColorStop(offset: number, color: string): void +} + +interface DOMRectInit { + height?: number + width?: number + x?: number + y?: number +} + +interface DOMMatrixInit extends DOMMatrix2DInit { + is2D?: boolean + m13?: number + m14?: number + m23?: number + m24?: number + m31?: number + m32?: number + m33?: number + m34?: number + m43?: number + m44?: number +} + +// ----------- added types + +export interface DOMMatrix2DInit { + a: number + b: number + c: number + d: number + e: number + f: number +} + +interface DOMMatrixReadOnly { + readonly a: number + readonly b: number + readonly c: number + readonly d: number + readonly e: number + readonly f: number + readonly is2D: boolean + readonly isIdentity: boolean + readonly m11: number + readonly m12: number + readonly m13: number + readonly m14: number + readonly m21: number + readonly m22: number + readonly m23: number + readonly m24: number + readonly m31: number + readonly m32: number + readonly m33: number + readonly m34: number + readonly m41: number + readonly m42: number + readonly m43: number + readonly m44: number + flipX(): DOMMatrix + flipY(): DOMMatrix + inverse(): DOMMatrix + multiply(other?: DOMMatrixInit): DOMMatrix + rotate(rotX?: number, rotY?: number, rotZ?: number): DOMMatrix + rotateAxisAngle(x?: number, y?: number, z?: number, angle?: number): DOMMatrix + rotateFromVector(x?: number, y?: number): DOMMatrix + scale( + scaleX?: number, + scaleY?: number, + scaleZ?: number, + originX?: number, + originY?: number, + originZ?: number, + ): DOMMatrix + scale3d(scale?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix + skewX(sx?: number): DOMMatrix + skewY(sy?: number): DOMMatrix + toFloat32Array(): Float32Array + toFloat64Array(): Float64Array + transformPoint(point?: DOMPointInit): DOMPoint + translate(tx?: number, ty?: number, tz?: number): DOMMatrix + toString(): string +} + +export interface DOMMatrix extends DOMMatrixReadOnly { + a: number + b: number + c: number + d: number + e: number + f: number + m11: number + m12: number + m13: number + m14: number + m21: number + m22: number + m23: number + m24: number + m31: number + m32: number + m33: number + m34: number + m41: number + m42: number + m43: number + m44: number + invertSelf(): DOMMatrix + multiplySelf(other?: DOMMatrixInit): DOMMatrix + preMultiplySelf(other?: DOMMatrixInit): DOMMatrix + rotateAxisAngleSelf(x?: number, y?: number, z?: number, angle?: number): DOMMatrix + rotateFromVectorSelf(x?: number, y?: number): DOMMatrix + rotateSelf(rotX?: number, rotY?: number, rotZ?: number): DOMMatrix + scale3dSelf(scale?: number, originX?: number, originY?: number, originZ?: number): DOMMatrix + scaleSelf( + scaleX?: number, + scaleY?: number, + scaleZ?: number, + originX?: number, + originY?: number, + originZ?: number, + ): DOMMatrix + setMatrixValue(transformList: string): DOMMatrix + skewXSelf(sx?: number): DOMMatrix + skewYSelf(sy?: number): DOMMatrix + translateSelf(tx?: number, ty?: number, tz?: number): DOMMatrix + toJSON(): { [K in OmitNeverOfMatrix]: DOMMatrix[K] } +} + +type OmitMatrixMethod = { [K in keyof DOMMatrix]: DOMMatrix[K] extends (...args: any[]) => any ? never : K } + +type OmitNeverOfMatrix = OmitMatrixMethod[keyof OmitMatrixMethod] + +export const DOMMatrix: { + prototype: DOMMatrix + new(init?: string | number[]): DOMMatrix + fromFloat32Array(array32: Float32Array): DOMMatrix + fromFloat64Array(array64: Float64Array): DOMMatrix + fromMatrix(other?: DOMMatrixInit): DOMMatrix +} + +interface DOMRectReadOnly { + readonly bottom: number + readonly height: number + readonly left: number + readonly right: number + readonly top: number + readonly width: number + readonly x: number + readonly y: number +} + +export interface DOMRect extends DOMRectReadOnly { + height: number + width: number + x: number + y: number + toJSON(): Omit +} + +export const DOMRect: { + prototype: DOMRect + new(x?: number, y?: number, width?: number, height?: number): DOMRect + fromRect(other?: DOMRectInit): DOMRect +} + +interface DOMPointReadOnly { + readonly w: number + readonly x: number + readonly y: number + readonly z: number + matrixTransform(matrix?: DOMMatrixInit): DOMPoint +} + +export interface DOMPoint extends DOMPointReadOnly { + w: number + x: number + y: number + z: number + toJSON(): Omit +} + +export const DOMPoint: { + prototype: DOMPoint + new(x?: number, y?: number, z?: number, w?: number): DOMPoint + fromPoint(other?: DOMPointInit): DOMPoint +} + +export class ImageData { + /** + * Returns the one-dimensional array containing the data in RGBA order, as integers in the range 0 to 255. + */ + readonly data: Uint8ClampedArray + /** + * Returns the actual dimensions of the data in the ImageData object, in pixels. + */ + readonly height: number + /** + * Returns the actual dimensions of the data in the ImageData object, in pixels. + */ + readonly width: number + + constructor(sw: number, sh: number, attr?: { colorSpace?: ColorSpace }) + constructor(imageData: ImageData, attr?: { colorSpace?: ColorSpace }) + constructor(data: Uint8ClampedArray | Uint16Array | Float16Array | Float32Array, sw: number, sh?: number) +} + +export class Image { + constructor() + // attrs only affects SVG + constructor(width: number, height: number, attrs?: { colorSpace?: ColorSpace }) + width: number + height: number + readonly naturalWidth: number + readonly naturalHeight: number + readonly complete: boolean + readonly currentSrc: string | null + alt: string + // the src can be a Uint8Array or a string + // if it's a string, it can be a file path, a data URL, a remote URL, or a SVG string + src: Uint8Array | string + onload?(): void + onerror?(err: Error): void + decode(): Promise +} + +export class Path2D { + constructor(path?: Path2D | string) + + addPath(path: Path2D, transform?: DOMMatrix2DInit): void + arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void + arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void + bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void + closePath(): void + ellipse( + x: number, + y: number, + radiusX: number, + radiusY: number, + rotation: number, + startAngle: number, + endAngle: number, + anticlockwise?: boolean, + ): void + lineTo(x: number, y: number): void + moveTo(x: number, y: number): void + quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void + rect(x: number, y: number, w: number, h: number): void + roundRect(x: number, y: number, w: number, h: number, radii?: number | number[]): void + + // PathKit methods + op(path: Path2D, operation: PathOp): Path2D + toSVGString(): string + getFillType(): FillType + getFillTypeString(): string + setFillType(type: FillType): void + simplify(): Path2D + asWinding(): Path2D + stroke(stroke?: StrokeOptions): Path2D + transform(transform: DOMMatrix2DInit): Path2D + getBounds(): [left: number, top: number, right: number, bottom: number] + computeTightBounds(): [left: number, top: number, right: number, bottom: number] + trim(start: number, end: number, isComplement?: boolean): Path2D + dash(on: number, off: number, phase: number): Path2D + round(radius: number): Path2D + equals(path: Path2D): boolean +} + +export interface StrokeOptions { + width?: number + miterLimit?: number + cap?: StrokeCap + join?: StrokeJoin +} + +export interface SKRSContext2D extends CanvasRenderingContext2D { + canvas: Canvas + /** + * @param startAngle The angle at which to begin the gradient, in radians. Angle measurements start vertically above the centre and move around clockwise. + * @param x The x-axis coordinate of the centre of the gradient. + * @param y The y-axis coordinate of the centre of the gradient. + */ + createConicGradient(startAngle: number, x: number, y: number): CanvasGradient + drawImage(image: Image | Canvas, dx: number, dy: number): void + drawImage(image: Image | Canvas, dx: number, dy: number, dw: number, dh: number): void + drawImage( + image: Image | Canvas, + sx: number, + sy: number, + sw: number, + sh: number, + dx: number, + dy: number, + dw: number, + dh: number, + ): void + /** + * Draw another canvas, preserving vector graphics when possible. + * When the source canvas has recorded operations, this method preserves the + * SkPicture representation without rasterization, which can be faster than + * drawImage. Falls back to bitmap rendering if no picture is available. + */ + drawCanvas(canvas: Canvas, dx: number, dy: number): void + drawCanvas(canvas: Canvas, dx: number, dy: number, dWidth: number, dHeight: number): void + drawCanvas( + canvas: Canvas, + sx: number, + sy: number, + sWidth: number, + sHeight: number, + dx: number, + dy: number, + dWidth: number, + dHeight: number, + ): void + createPattern( + image: Image | ImageData | Canvas | SvgCanvas, + repeat: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat' | null, + ): CanvasPattern + getContextAttributes(): { alpha: boolean; desynchronized: boolean } + getTransform(): DOMMatrix + + letterSpacing: string + wordSpacing: string +} + +export type ColorSpace = 'srgb' | 'display-p3' + +export interface ContextAttributes { + alpha?: boolean + colorSpace?: ColorSpace +} + +export interface SvgCanvas { + width: number + height: number + getContext(contextType: '2d', contextAttributes?: ContextAttributes): SKRSContext2D + + getContent(): Buffer +} + +export interface AvifConfig { + /** 0-100 scale, 100 is lossless */ + quality?: number + /** 0-100 scale */ + alphaQuality?: number + /** rav1e preset 1 (slow) 10 (fast but crappy), default is 4 */ + speed?: number + /** How many threads should be used (0 = match core count) */ + threads?: number + /** set to '4:2:0' to use chroma subsampling, default '4:4:4' */ + chromaSubsampling?: ChromaSubsampling +} + +/** GIF encoding configuration for single-frame encoding */ +export interface GifConfig { + /** + * Quality for NeuQuant color quantization (1-30, lower = slower but better quality) + * @default 10 + */ + quality?: number +} + +/** Configuration for the GIF encoder (animated GIFs) */ +export interface GifEncoderConfig { + /** + * Loop count: 0 = infinite loop, positive number = finite loops + * @default 0 (infinite) + */ + repeat?: number + /** + * Quality for NeuQuant color quantization (1-30, lower = slower but better quality) + * @default 10 + */ + quality?: number +} + +/** Configuration for individual GIF frames */ +export interface GifFrameConfig { + /** + * Frame delay in milliseconds + * @default 100 + */ + delay?: number + /** Disposal method for this frame */ + disposal?: GifDisposal + /** Transparent color index (0-255), if the frame has transparency */ + transparent?: number + /** X offset of this frame within the canvas */ + left?: number + /** Y offset of this frame within the canvas */ + top?: number +} + +/** GIF frame disposal method */ +export enum GifDisposal { + /** Keep the frame visible (default) */ + Keep = 0, + /** Clear the frame area to the background color */ + Background = 1, + /** Restore to the previous frame */ + Previous = 2, +} + +/** + * GIF Encoder for creating animated GIFs. + * Implements `Disposable` interface for use with the `using` keyword (ES2024). + * + * @example + * ```typescript + * // Basic usage + * const encoder = new GifEncoder(100, 100, { repeat: 0, quality: 10 }); + * encoder.addFrame(rgbaData, 100, 100, { delay: 100 }); + * encoder.addFrame(rgbaData2, 100, 100, { delay: 100 }); + * const buffer = encoder.finish(); + * + * // With `using` keyword (automatic cleanup) + * { + * using encoder = new GifEncoder(100, 100); + * encoder.addFrame(frame1, 100, 100, { delay: 100 }); + * const buffer = encoder.finish(); + * } // encoder automatically disposed + * ``` + */ +export class GifEncoder implements Disposable { + /** + * Create a new GIF encoder with the specified dimensions + * @param width - Width of the GIF canvas in pixels + * @param height - Height of the GIF canvas in pixels + * @param config - Optional encoder configuration + */ + constructor(width: number, height: number, config?: GifEncoderConfig) + + /** Width of the GIF canvas */ + readonly width: number + /** Height of the GIF canvas */ + readonly height: number + /** Number of frames added so far */ + readonly frameCount: number + + /** + * Add a frame from RGBA pixel data + * @param data - RGBA pixel data (must be width * height * 4 bytes) + * @param width - Width of the frame in pixels + * @param height - Height of the frame in pixels + * @param config - Optional frame configuration + */ + addFrame(data: Uint8Array, width: number, height: number, config?: GifFrameConfig): void + + /** + * Finish encoding and return the GIF data. + * Clears all accumulated frames after encoding. + * @throws Error if no frames have been added + */ + finish(): Buffer + + /** + * Dispose of the encoder, clearing all accumulated frames without encoding. + * Called automatically when using the `using` keyword. + */ + dispose(): void + + /** + * Symbol.dispose implementation for ES2024 Explicit Resource Management. + * Allows using `using encoder = new GifEncoder(...)` syntax. + */ + [Symbol.dispose](): void +} +/** + * https://en.wikipedia.org/wiki/Chroma_subsampling#Types_of_sampling_and_subsampling + * https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Video_concepts + */ +export enum ChromaSubsampling { + /** + * Each of the three Y'CbCr components has the same sample rate, thus there is no chroma subsampling. This scheme is sometimes used in high-end film scanners and cinematic post-production. + * Note that "4:4:4" may instead be wrongly referring to R'G'B' color space, which implicitly also does not have any chroma subsampling (except in JPEG R'G'B' can be subsampled). + * Formats such as HDCAM SR can record 4:4:4 R'G'B' over dual-link HD-SDI. + */ + Yuv444 = 0, + /** + * The two chroma components are sampled at half the horizontal sample rate of luma: the horizontal chroma resolution is halved. This reduces the bandwidth of an uncompressed video signal by one-third. + * Many high-end digital video formats and interfaces use this scheme: + * - [AVC-Intra 100](https://en.wikipedia.org/wiki/AVC-Intra) + * - [Digital Betacam](https://en.wikipedia.org/wiki/Betacam#Digital_Betacam) + * - [Betacam SX](https://en.wikipedia.org/wiki/Betacam#Betacam_SX) + * - [DVCPRO50](https://en.wikipedia.org/wiki/DV#DVCPRO) and [DVCPRO HD](https://en.wikipedia.org/wiki/DV#DVCPRO_HD) + * - [Digital-S](https://en.wikipedia.org/wiki/Digital-S) + * - [CCIR 601](https://en.wikipedia.org/wiki/Rec._601) / [Serial Digital Interface](https://en.wikipedia.org/wiki/Serial_digital_interface) / [D1](https://en.wikipedia.org/wiki/D-1_(Sony)) + * - [ProRes (HQ, 422, LT, and Proxy)](https://en.wikipedia.org/wiki/Apple_ProRes) + * - [XDCAM HD422](https://en.wikipedia.org/wiki/XDCAM) + * - [Canon MXF HD422](https://en.wikipedia.org/wiki/Canon_XF-300) + */ + Yuv422 = 1, + /** + * n 4:2:0, the horizontal sampling is doubled compared to 4:1:1, + * but as the **Cb** and **Cr** channels are only sampled on each alternate line in this scheme, the vertical resolution is halved. + * The data rate is thus the same. + * This fits reasonably well with the PAL color encoding system, since this has only half the vertical chrominance resolution of [NTSC](https://en.wikipedia.org/wiki/NTSC). + * It would also fit extremely well with the [SECAM](https://en.wikipedia.org/wiki/SECAM) color encoding system, + * since like that format, 4:2:0 only stores and transmits one color channel per line (the other channel being recovered from the previous line). + * However, little equipment has actually been produced that outputs a SECAM analogue video signal. + * In general, SECAM territories either have to use a PAL-capable display or a [transcoder](https://en.wikipedia.org/wiki/Transcoding) to convert the PAL signal to SECAM for display. + */ + Yuv420 = 2, + /** + * What if the chroma subsampling model is 4:0:0? + * That says to use every pixel of luma data, but that each row has 0 chroma samples applied to it. The resulting image, then, is comprised solely of the luminance data—a greyscale image. + */ + Yuv400 = 3, +} + +export interface ConvertToBlobOptions { + mime?: string + quality?: number +} + +export class Canvas { + constructor(width: number, height: number, flag?: SvgExportFlag) + + width: number + height: number + getContext(contextType: '2d', contextAttributes?: ContextAttributes): SKRSContext2D + encodeSync(format: 'webp' | 'jpeg', quality?: number): Buffer + encodeSync(format: 'png'): Buffer + encodeSync(format: 'avif', cfg?: AvifConfig): Buffer + encodeSync(format: 'gif', quality?: number): Buffer + encode(format: 'webp' | 'jpeg', quality?: number): Promise + encode(format: 'png'): Promise + encode(format: 'avif', cfg?: AvifConfig): Promise + encode(format: 'gif', quality?: number): Promise + encodeStream(format: 'webp' | 'jpeg', quality?: number): ReadableStream + encodeStream(format: 'png'): ReadableStream + toBuffer(mime: 'image/png'): Buffer + toBuffer(mime: 'image/jpeg' | 'image/webp', quality?: number): Buffer + toBuffer(mime: 'image/avif', cfg?: AvifConfig): Buffer + toBuffer(mime: 'image/gif', quality?: number): Buffer + // raw pixels + data(): Buffer + toDataURL(mime?: 'image/png'): string + toDataURL(mime: 'image/jpeg' | 'image/webp', quality?: number): string + toDataURL(mime: 'image/gif', quality?: number): string + toDataURL(mime?: 'image/jpeg' | 'image/webp' | 'image/png' | 'image/gif', quality?: number): string + toDataURL(mime?: 'image/avif', cfg?: AvifConfig): string + + toDataURLAsync(mime?: 'image/png'): Promise + toDataURLAsync(mime: 'image/jpeg' | 'image/webp', quality?: number): Promise + toDataURLAsync(mime: 'image/gif', quality?: number): Promise + toDataURLAsync(mime?: 'image/jpeg' | 'image/webp' | 'image/png' | 'image/gif', quality?: number): Promise + toDataURLAsync(mime?: 'image/avif', cfg?: AvifConfig): Promise + + toBlob(callback: (blob: Blob | null) => void, mime?: string, quality?: number): void + convertToBlob(options?: ConvertToBlobOptions): Promise +} + +export function createCanvas(width: number, height: number): Canvas + +export function createCanvas(width: number, height: number, svgExportFlag: SvgExportFlag): SvgCanvas + +export declare class FontKey { + // make it a unique type + private readonly key: symbol + readonly typefaceId: number +} + +export interface FontVariationAxis { + /** OpenType tag as a 32-bit integer (e.g., 0x77676874 for 'wght') */ + tag: number + /** Current value for this axis */ + value: number + /** Minimum value for this axis */ + min: number + /** Maximum value for this axis */ + max: number + /** Default value for this axis */ + def: number + /** Whether this axis should be hidden from UI */ + hidden: boolean +} + +interface IGlobalFonts { + readonly families: { family: string; styles: { weight: number; width: string; style: string }[] }[] + // return FontKey if succeeded, null if failed + register(font: Buffer, nameAlias?: string): FontKey | null + // absolute path - returns FontKey if succeeded, null if failed + registerFromPath(path: string, nameAlias?: string): FontKey | null + has(name: string): boolean + loadFontsFromDir(path: string): number + /** + * Set an alias for a font family. + * @param fontName The original font family name + * @param alias The alias name to set + * @returns true if the alias was set successfully, false if the font family doesn't exist + */ + setAlias(fontName: string, alias: string): boolean + remove(key: FontKey): boolean + /** + * Remove multiple fonts by their keys in a single operation. + * More efficient than calling remove() multiple times as it triggers only one rebuild. + * @param fontKeys Array of FontKey objects to remove + * @returns Number of fonts successfully removed + */ + removeBatch(fontKeys: FontKey[]): number + /** + * Remove ALL registered fonts. + * @returns Number of fonts removed + */ + removeAll(): number + /** + * Get variation axes for a specific font instance + * @param familyName The font family name + * @param weight Font weight (100-900) + * @param width Font width/stretch value + * @param slant Font slant (0 = upright, 1 = italic, 2 = oblique) + * @returns Array of variation axes or empty array if not a variable font + */ + getVariationAxes(familyName: string, weight: number, width: number, slant: number): FontVariationAxis[] + /** + * Check if a font has variable font capabilities + * @param familyName The font family name + * @param weight Font weight (100-900) + * @param width Font width/stretch value + * @param slant Font slant (0 = upright, 1 = italic, 2 = oblique) + * @returns true if the font is a variable font + */ + hasVariations(familyName: string, weight: number, width: number, slant: number): boolean +} + +export const GlobalFonts: IGlobalFonts + +export enum PathOp { + Difference = 0, // subtract the op path from the first path + Intersect = 1, // intersect the two paths + Union = 2, // union (inclusive-or) the two paths + Xor = 3, // exclusive-or the two paths + ReverseDifference = 4, // subtract the first path from the op path +} + +export enum FillType { + Winding = 0, + EvenOdd = 1, + InverseWinding = 2, + InverseEvenOdd = 3, +} + +export enum StrokeJoin { + Miter = 0, + Round = 1, + Bevel = 2, +} + +export enum StrokeCap { + Butt = 0, + Round = 1, + Square = 2, +} + +export enum SvgExportFlag { + ConvertTextToPaths = 0x01, + NoPrettyXML = 0x02, + RelativePathEncoding = 0x04, +} + +export function convertSVGTextToPath(svg: Buffer | string): Buffer + +export interface LoadImageOptions { + alt?: string + maxRedirects?: number + requestOptions?: import('http').RequestOptions +} + +export function loadImage( + source: string | URL | Buffer | ArrayBufferLike | Uint8Array | Image | import('stream').Readable, + options?: LoadImageOptions, +): Promise + +export interface PDFMetadata { + /// The document's title + title?: string + /// The name of the person who created the document + author?: string + /// The subject of the document + subject?: string + /// Keywords associated with the document + keywords?: string + /// The product that created the original document + creator?: string + /// The product that is converting this document to PDF (defaults to "Skia/PDF") + producer?: string + /// The DPI for rasterization (default: 72.0) + rasterDPI?: number + /// Encoding quality: 0-100 for lossy JPEG, 101 for lossless (default: 101) + encodingQuality?: number + /// Whether to conform to PDF/A-2b standard (default: false) + pdfa?: boolean + /// Compression level: -1 (default), 0 (none), 1 (low/fast), 6 (average), 9 (high/slow) + compressionLevel?: number +} + +export interface Rect { + left: number + top: number + right: number + bottom: number +} + +export declare class PDFDocument { + constructor(metadata?: PDFMetadata | undefined | null) + beginPage(width: number, height: number, rect?: Rect | undefined | null): CanvasRenderingContext2D + endPage(): void + close(): Buffer +} + +export interface LottieAnimationOptions { + /** Base path for resolving external resources (images, fonts) */ + resourcePath?: string +} + +export interface LottieRenderRect { + x: number + y: number + width: number + height: number +} + +/** + * Lottie animation class for loading and rendering Lottie JSON files. + * + * @example + * ```typescript + * import { LottieAnimation, createCanvas } from '@napi-rs/canvas' + * + * const animation = LottieAnimation.loadFromFile('./animation.json') + * const canvas = createCanvas(animation.width, animation.height) + * const ctx = canvas.getContext('2d') + * + * // Render frame 0 + * animation.seekFrame(0) + * animation.render(ctx) + * + * // Save to PNG + * const buffer = canvas.toBuffer('image/png') + * ``` + */ +export declare class LottieAnimation { + /** + * Load animation from JSON string or Buffer + * @param data - JSON string or Buffer containing Lottie animation data + * @param options - Optional configuration + */ + static loadFromData(data: string | Buffer, options?: LottieAnimationOptions): LottieAnimation + + /** + * Load animation from file path + * External assets are resolved relative to the file's directory + * @param path - Path to the Lottie JSON file + */ + static loadFromFile(path: string): LottieAnimation + + /** Animation duration in seconds */ + readonly duration: number + + /** Frame rate (frames per second) */ + readonly fps: number + + /** Total frame count */ + readonly frames: number + + /** Animation width in pixels */ + readonly width: number + + /** Animation height in pixels */ + readonly height: number + + /** Lottie format version string */ + readonly version: string + + /** Animation in-point (start frame) */ + readonly inPoint: number + + /** Animation out-point (end frame) */ + readonly outPoint: number + + /** + * Seek to normalized position + * @param t - Position between 0.0 (start) and 1.0 (end) + */ + seek(t: number): void + + /** + * Seek to specific frame index + * @param frame - Frame index (0 = first frame) + */ + seekFrame(frame: number): void + + /** + * Seek to specific time in seconds + * @param seconds - Time in seconds from start + */ + seekTime(seconds: number): void + + /** + * Render current frame to canvas context + * @param ctx - Canvas 2D rendering context + * @param dst - Optional destination rectangle for scaling/positioning + */ + render(ctx: CanvasRenderingContext2D, dst?: LottieRenderRect): void +} diff --git a/tools/ui/node_modules/@napi-rs/canvas/index.js b/tools/ui/node_modules/@napi-rs/canvas/index.js new file mode 100644 index 0000000000000000000000000000000000000000..c7773c8dbd8bb20473fd3bae5560e516b788f555 --- /dev/null +++ b/tools/ui/node_modules/@napi-rs/canvas/index.js @@ -0,0 +1,196 @@ +const { platform, homedir } = require('os') +const { join } = require('path') + +const { + clearAllCache, + CanvasRenderingContext2D, + CanvasElement, + SVGCanvas, + Path: Path2D, + ImageData, + Image, + FontKey, + GlobalFonts, + PathOp, + FillType, + StrokeJoin, + StrokeCap, + convertSVGTextToPath, + PdfDocument, + GifEncoder, + GifDisposal, + LottieAnimation, +} = require('./js-binding') + +const { DOMPoint, DOMMatrix, DOMRect } = require('./geometry') + +const loadImage = require('./load-image') + +// Add Symbol.dispose support for GifEncoder (ECMAScript 2024 Explicit Resource Management) +if (GifEncoder && typeof Symbol.dispose !== 'undefined') { + GifEncoder.prototype[Symbol.dispose] = function () { + this.dispose() + } +} + +const SvgExportFlag = { + ConvertTextToPaths: 0x01, + NoPrettyXML: 0x02, + RelativePathEncoding: 0x04, +} + +if (!('families' in GlobalFonts)) { + Object.defineProperty(GlobalFonts, 'families', { + get: function () { + return JSON.parse(GlobalFonts.getFamilies().toString()) + }, + }) +} + +if (!('has' in GlobalFonts)) { + Object.defineProperty(GlobalFonts, 'has', { + value: function has(name) { + return !!JSON.parse(GlobalFonts.getFamilies().toString()).find(({ family }) => family === name) + }, + configurable: false, + enumerable: false, + writable: false, + }) +} + +const _toBlob = CanvasElement.prototype.toBlob +const _convertToBlob = CanvasElement.prototype.convertToBlob +if ('Blob' in globalThis) { + CanvasElement.prototype.toBlob = function toBlob(callback, mimeType, quality) { + _toBlob.call( + this, + function (/** @type {Uint8Array} */ imageBuffer) { + const blob = new Blob([imageBuffer.buffer], { type: mimeType }) + callback(blob) + }, + mimeType, + quality, + ) + } + CanvasElement.prototype.convertToBlob = function convertToBlob(options) { + return _convertToBlob.call(this, options).then((/** @type {Uint8Array} */ imageBuffer) => { + const blob = new Blob([imageBuffer.buffer], { type: options?.mime || 'image/png' }) + return blob + }) + } +} else { + // oxlint-disable-next-line no-unused-vars + CanvasElement.prototype.toBlob = function toBlob(callback, mimeType, quality) { + callback(null) + } + // oxlint-disable-next-line no-unused-vars + CanvasElement.prototype.convertToBlob = function convertToBlob(options) { + return Promise.reject(new Error('Blob is not supported in this environment')) + } +} + +const _getTransform = CanvasRenderingContext2D.prototype.getTransform + +CanvasRenderingContext2D.prototype.getTransform = function getTransform() { + const transform = _getTransform.apply(this, arguments) + // monkey patched, skip + if (transform instanceof DOMMatrix) { + return transform + } + const { a, b, c, d, e, f } = transform + return new DOMMatrix([a, b, c, d, e, f]) +} + +// Workaround for webpack bundling issue with drawImage +// Store the original drawImage method +const _drawImage = CanvasRenderingContext2D.prototype.drawImage + +// Override drawImage to ensure proper type recognition in bundled environments +CanvasRenderingContext2D.prototype.drawImage = function drawImage(image, ...args) { + // If the image is a Canvas-like object but not recognized due to bundling, + // we need to ensure it's properly identified + if (image && typeof image === 'object') { + // First check if it's a wrapped canvas object + if (image.canvas instanceof CanvasElement || image.canvas instanceof SVGCanvas) { + image = image.canvas + } else if (image._canvas instanceof CanvasElement || image._canvas instanceof SVGCanvas) { + image = image._canvas + } + // Then check if it's a Canvas-like object by checking for getContext method + else if (typeof image.getContext === 'function' && image.width && image.height) { + // If it has canvas properties but isn't recognized as CanvasElement or SVGCanvas, + // try to correct the prototype chain + if (!(image instanceof CanvasElement) && !(image instanceof SVGCanvas)) { + // Try to create a proper CanvasElement from the canvas-like object + // This helps when webpack has transformed the prototype chain + Object.setPrototypeOf(image, CanvasElement.prototype) + } + } + } + + // Call the original drawImage with the potentially corrected image + return _drawImage.apply(this, [image, ...args]) +} + +function createCanvas(width, height, flag) { + const isSvgBackend = typeof flag !== 'undefined' + return isSvgBackend ? new SVGCanvas(width, height, flag) : new CanvasElement(width, height) +} + +class Canvas { + constructor(width, height, flag) { + return createCanvas(width, height, flag) + } + + static [Symbol.hasInstance](instance) { + return instance instanceof CanvasElement || instance instanceof SVGCanvas + } +} + +if (!process.env.DISABLE_SYSTEM_FONTS_LOAD) { + GlobalFonts.loadSystemFonts() + const platformName = platform() + const homedirPath = homedir() + switch (platformName) { + case 'win32': + GlobalFonts.loadFontsFromDir(join(homedirPath, 'AppData', 'Local', 'Microsoft', 'Windows', 'Fonts')) + break + case 'darwin': + GlobalFonts.loadFontsFromDir(join(homedirPath, 'Library', 'Fonts')) + break + case 'linux': + GlobalFonts.loadFontsFromDir(join('usr', 'local', 'share', 'fonts')) + GlobalFonts.loadFontsFromDir(join(homedirPath, '.fonts')) + break + } +} + +module.exports = { + clearAllCache, + Canvas, + createCanvas, + Path2D, + ImageData, + Image, + PathOp, + FillType, + StrokeCap, + StrokeJoin, + SvgExportFlag, + GlobalFonts: GlobalFonts, + convertSVGTextToPath, + DOMPoint, + DOMMatrix, + DOMRect, + loadImage, + FontKey, + // Export these for better webpack compatibility + CanvasElement, + SVGCanvas, + PDFDocument: PdfDocument, + // GIF encoding + GifEncoder, + GifDisposal, + // Lottie animation + LottieAnimation, +} diff --git a/tools/ui/node_modules/@napi-rs/canvas/js-binding.js b/tools/ui/node_modules/@napi-rs/canvas/js-binding.js new file mode 100644 index 0000000000000000000000000000000000000000..1152c6853742681cc7a812bacf4954896582d83d --- /dev/null +++ b/tools/ui/node_modules/@napi-rs/canvas/js-binding.js @@ -0,0 +1,464 @@ +// prettier-ignore +/* eslint-disable */ +// @ts-nocheck +/* auto-generated by NAPI-RS */ + +const { readFileSync } = require('fs') +let nativeBinding = null +const loadErrors = [] + +const isMusl = () => { + let musl = false + if (process.platform === 'linux') { + musl = isMuslFromFilesystem() + if (musl === null) { + musl = isMuslFromReport() + } + if (musl === null) { + musl = isMuslFromChildProcess() + } + } + return musl +} + +const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-') + +const isMuslFromFilesystem = () => { + try { + return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl') + } catch { + return null + } +} + +const isMuslFromReport = () => { + let report = null + if (typeof process.report?.getReport === 'function') { + process.report.excludeNetwork = true + report = process.report.getReport() + } + if (!report) { + return null + } + if (report.header && report.header.glibcVersionRuntime) { + return false + } + if (Array.isArray(report.sharedObjects)) { + if (report.sharedObjects.some(isFileMusl)) { + return true + } + } + return false +} + +const isMuslFromChildProcess = () => { + try { + return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl') + } catch (e) { + // If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false + return false + } +} + +function requireNative() { + if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) { + try { + return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH) + } catch (err) { + loadErrors.push(err) + } + } else if (process.platform === 'android') { + if (process.arch === 'arm64') { + try { + return require('./skia.android-arm64.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@napi-rs/canvas-android-arm64') + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 'arm') { + try { + return require('./skia.android-arm-eabi.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@napi-rs/canvas-android-arm-eabi') + } catch (e) { + loadErrors.push(e) + } + } else { + loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`)) + } + } else if (process.platform === 'win32') { + if (process.arch === 'x64') { + if ( + process.config?.variables?.shlib_suffix === 'dll.a' || + process.config?.variables?.node_target_type === 'shared_library' + ) { + try { + return require('./skia.win32-x64-gnu.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@napi-rs/canvas-win32-x64-gnu') + } catch (e) { + loadErrors.push(e) + } + } else { + try { + return require('./skia.win32-x64-msvc.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@napi-rs/canvas-win32-x64-msvc') + } catch (e) { + loadErrors.push(e) + } + } + } else if (process.arch === 'ia32') { + try { + return require('./skia.win32-ia32-msvc.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@napi-rs/canvas-win32-ia32-msvc') + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 'arm64') { + try { + return require('./skia.win32-arm64-msvc.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@napi-rs/canvas-win32-arm64-msvc') + } catch (e) { + loadErrors.push(e) + } + } else { + loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`)) + } + } else if (process.platform === 'darwin') { + try { + return require('./skia.darwin-universal.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@napi-rs/canvas-darwin-universal') + } catch (e) { + loadErrors.push(e) + } + if (process.arch === 'x64') { + try { + return require('./skia.darwin-x64.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@napi-rs/canvas-darwin-x64') + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 'arm64') { + try { + return require('./skia.darwin-arm64.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@napi-rs/canvas-darwin-arm64') + } catch (e) { + loadErrors.push(e) + } + } else { + loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`)) + } + } else if (process.platform === 'freebsd') { + if (process.arch === 'x64') { + try { + return require('./skia.freebsd-x64.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@napi-rs/canvas-freebsd-x64') + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 'arm64') { + try { + return require('./skia.freebsd-arm64.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@napi-rs/canvas-freebsd-arm64') + } catch (e) { + loadErrors.push(e) + } + } else { + loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`)) + } + } else if (process.platform === 'linux') { + if (process.arch === 'x64') { + if (isMusl()) { + try { + return require('./skia.linux-x64-musl.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@napi-rs/canvas-linux-x64-musl') + } catch (e) { + loadErrors.push(e) + } + } else { + try { + return require('./skia.linux-x64-gnu.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@napi-rs/canvas-linux-x64-gnu') + } catch (e) { + loadErrors.push(e) + } + } + } else if (process.arch === 'arm64') { + if (isMusl()) { + try { + return require('./skia.linux-arm64-musl.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@napi-rs/canvas-linux-arm64-musl') + } catch (e) { + loadErrors.push(e) + } + } else { + try { + return require('./skia.linux-arm64-gnu.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@napi-rs/canvas-linux-arm64-gnu') + } catch (e) { + loadErrors.push(e) + } + } + } else if (process.arch === 'arm') { + if (isMusl()) { + try { + return require('./skia.linux-arm-musleabihf.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@napi-rs/canvas-linux-arm-musleabihf') + } catch (e) { + loadErrors.push(e) + } + } else { + try { + return require('./skia.linux-arm-gnueabihf.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@napi-rs/canvas-linux-arm-gnueabihf') + } catch (e) { + loadErrors.push(e) + } + } + } else if (process.arch === 'loong64') { + if (isMusl()) { + try { + return require('./skia.linux-loong64-musl.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@napi-rs/canvas-linux-loong64-musl') + } catch (e) { + loadErrors.push(e) + } + } else { + try { + return require('./skia.linux-loong64-gnu.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@napi-rs/canvas-linux-loong64-gnu') + } catch (e) { + loadErrors.push(e) + } + } + } else if (process.arch === 'riscv64') { + if (isMusl()) { + try { + return require('./skia.linux-riscv64-musl.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@napi-rs/canvas-linux-riscv64-musl') + } catch (e) { + loadErrors.push(e) + } + } else { + try { + return require('./skia.linux-riscv64-gnu.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@napi-rs/canvas-linux-riscv64-gnu') + } catch (e) { + loadErrors.push(e) + } + } + } else if (process.arch === 'ppc64') { + try { + return require('./skia.linux-ppc64-gnu.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@napi-rs/canvas-linux-ppc64-gnu') + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 's390x') { + try { + return require('./skia.linux-s390x-gnu.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@napi-rs/canvas-linux-s390x-gnu') + } catch (e) { + loadErrors.push(e) + } + } else { + loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`)) + } + } else if (process.platform === 'openharmony') { + if (process.arch === 'arm64') { + try { + return require('./skia.openharmony-arm64.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@napi-rs/canvas-openharmony-arm64') + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 'x64') { + try { + return require('./skia.openharmony-x64.node') + } catch (e) { + loadErrors.push(e) + } + try { + return require('@napi-rs/canvas-openharmony-x64') + } catch (e) { + loadErrors.push(e) + } + } else if (process.arch === 'arm') { + try { + return require('./skia.openharmony-arm.node') + } catch (e) { + loadErrors.push(e) + } + try { + const binding = require('@napi-rs/canvas-openharmony-arm') + return binding + } catch (e) { + loadErrors.push(e) + } + } else { + loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`)) + } + } else { + loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`)) + } +} + +nativeBinding = requireNative() + +if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) { + let wasiBinding = null + let wasiBindingError = null + try { + wasiBinding = require('./skia.wasi.cjs') + nativeBinding = wasiBinding + } catch (err) { + if (process.env.NAPI_RS_FORCE_WASI) { + wasiBindingError = err + } + } + if (!nativeBinding) { + try { + wasiBinding = require('@napi-rs/canvas-wasm32-wasi') + nativeBinding = wasiBinding + } catch (err) { + if (process.env.NAPI_RS_FORCE_WASI) { + wasiBindingError.cause = err + loadErrors.push(err) + } + } + } +} + +if (!nativeBinding) { + if (loadErrors.length > 0) { + throw new Error( + `Cannot find native binding. ` + + `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` + + 'Please try `npm i` again after removing both package-lock.json and node_modules directory.', + { + cause: loadErrors.reduce((err, cur) => { + cur.cause = err + return cur + }), + }, + ) + } + throw new Error(`Failed to load native binding`) +} + +module.exports = nativeBinding +module.exports.GlobalFonts = nativeBinding.GlobalFonts +module.exports.CanvasElement = nativeBinding.CanvasElement +module.exports.CanvasGradient = nativeBinding.CanvasGradient +module.exports.CanvasPattern = nativeBinding.CanvasPattern +module.exports.CanvasRenderingContext2D = nativeBinding.CanvasRenderingContext2D +module.exports.FontKey = nativeBinding.FontKey +module.exports.Image = nativeBinding.Image +module.exports.ImageData = nativeBinding.ImageData +module.exports.Path = nativeBinding.Path +module.exports.PdfDocument = nativeBinding.PdfDocument +module.exports.SVGCanvas = nativeBinding.SVGCanvas +module.exports.ChromaSubsampling = nativeBinding.ChromaSubsampling +module.exports.clearAllCache = nativeBinding.clearAllCache +module.exports.convertSVGTextToPath = nativeBinding.convertSVGTextToPath +module.exports.FillType = nativeBinding.FillType +module.exports.PathOp = nativeBinding.PathOp +module.exports.StrokeCap = nativeBinding.StrokeCap +module.exports.StrokeJoin = nativeBinding.StrokeJoin +module.exports.SvgExportFlag = nativeBinding.SvgExportFlag +module.exports.GifEncoder = nativeBinding.GifEncoder +module.exports.GifDisposal = nativeBinding.GifDisposal diff --git a/tools/ui/node_modules/@napi-rs/canvas/load-image.js b/tools/ui/node_modules/@napi-rs/canvas/load-image.js new file mode 100644 index 0000000000000000000000000000000000000000..a8ae707d26c8e7dbaf8075ee85924fc331c616ce --- /dev/null +++ b/tools/ui/node_modules/@napi-rs/canvas/load-image.js @@ -0,0 +1,156 @@ +const fs = require('fs') +const { Readable } = require('stream') +const { URL } = require('url') + +const { Image } = require('./js-binding') + +let http, https + +const MAX_REDIRECTS = 20 +const REDIRECT_STATUSES = new Set([301, 302]) + +/** + * Loads the given source into canvas Image + * @param {string|URL|Image|Buffer} source The image source to be loaded + * @param {object} options Options passed to the loader + */ +module.exports = async function loadImage(source, options = {}) { + // use the same buffer without copying if the source is a buffer + if (Buffer.isBuffer(source) || source instanceof Uint8Array) return createImage(source, options.alt) + // load readable stream as image + if (source instanceof Readable) return createImage(await consumeStream(source), options.alt) + // construct a Uint8Array if the source is ArrayBuffer or SharedArrayBuffer + if (source instanceof ArrayBuffer || source instanceof SharedArrayBuffer) + return createImage(new Uint8Array(source), options.alt) + // construct a buffer if the source is buffer-like + if (isBufferLike(source)) return createImage(Buffer.from(source), options.alt) + // if the source is Image instance, copy the image src to new image + if (source instanceof Image) return createImage(source.src, options.alt) + // if source is string and in data uri format, construct image using data uri + if (typeof source === 'string' && source.trimStart().startsWith('data:')) { + const commaIdx = source.indexOf(',') + const encoding = source.lastIndexOf('base64', commaIdx) < 0 ? 'utf-8' : 'base64' + const data = Buffer.from(source.slice(commaIdx + 1), encoding) + // Empty payload would silently complete on Image (HTML spec) and the loadImage + // promise would never settle; reject upfront instead. + // See https://github.com/Brooooooklyn/canvas/issues/1255 + if (data.length === 0) throw new Error(`Invalid data URI: empty payload in ${source.slice(0, 64)}`) + return createImage(data, options.alt) + } + // if source is a string or URL instance + if (typeof source === 'string') { + // if the source exists as a file, construct image from that file + if (!source.startsWith('http') && !source.startsWith('https') && (await exists(source))) { + return createImage(source, options.alt) + } else { + // the source is a remote url here + source = new URL(source) + // attempt to download the remote source and construct image + const data = await new Promise((resolve, reject) => + makeRequest( + source, + resolve, + reject, + typeof options.maxRedirects === 'number' && options.maxRedirects >= 0 ? options.maxRedirects : MAX_REDIRECTS, + options.requestOptions, + ), + ) + return createImage(data, options.alt) + } + } + + if (source instanceof URL) { + if (source.protocol === 'file:') { + // remove the leading slash on windows + return createImage(process.platform === 'win32' ? source.pathname.substring(1) : source.pathname, options.alt) + } else { + const data = await new Promise((resolve, reject) => + makeRequest( + source, + resolve, + reject, + typeof options.maxRedirects === 'number' && options.maxRedirects >= 0 ? options.maxRedirects : MAX_REDIRECTS, + options.requestOptions, + ), + ) + return createImage(data, options.alt) + } + } + + // throw error as don't support that source + throw new TypeError('unsupported image source') +} + +function makeRequest(url, resolve, reject, redirectCount, requestOptions) { + const isHttps = url.protocol === 'https:' + // lazy load the lib + const lib = isHttps ? (!https ? (https = require('https')) : https) : !http ? (http = require('http')) : http + + lib + .get(url.toString(), requestOptions || {}, (res) => { + try { + const shouldRedirect = REDIRECT_STATUSES.has(res.statusCode) && typeof res.headers.location === 'string' + if (shouldRedirect && redirectCount > 0) + return makeRequest( + new URL(res.headers.location, url.origin), + resolve, + reject, + redirectCount - 1, + requestOptions, + ) + if (typeof res.statusCode === 'number' && (res.statusCode < 200 || res.statusCode >= 300)) { + return reject(new Error(`remote source rejected with status code ${res.statusCode}`)) + } + + consumeStream(res).then(resolve, reject) + } catch (err) { + reject(err) + } + }) + .on('error', reject) +} + +// use stream/consumers in the future? +function consumeStream(res) { + return new Promise((resolve, reject) => { + const chunks = [] + + res.on('data', (chunk) => chunks.push(chunk)) + res.on('end', () => resolve(Buffer.concat(chunks))) + res.on('error', reject) + }) +} + +async function createImage(src, alt) { + // Empty Buffer / Uint8Array: Image follows the HTML spec (silent completion, + // no events) so the promise below would hang. Reject upfront. + // See https://github.com/Brooooooklyn/canvas/issues/1255 + if ((Buffer.isBuffer(src) || src instanceof Uint8Array) && src.length === 0) { + throw new Error('loadImage: empty image data') + } + + const image = new Image() + if (typeof alt === 'string') image.alt = alt + + return new Promise((resolve, reject) => { + image.onload = () => { + // Wait for bitmap decode before resolving + image.decode().then(() => resolve(image), reject) + } + image.onerror = (e) => reject(e) + image.src = src + }) +} + +function isBufferLike(src) { + return (src && src.type === 'Buffer') || Array.isArray(src) +} + +async function exists(path) { + try { + await fs.promises.access(path, fs.constants.F_OK) + return true + } catch { + return false + } +} diff --git a/tools/ui/node_modules/@napi-rs/canvas/node-canvas.d.ts b/tools/ui/node_modules/@napi-rs/canvas/node-canvas.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2837cd3cdf95030b20b1fe234bac255026fd970a --- /dev/null +++ b/tools/ui/node_modules/@napi-rs/canvas/node-canvas.d.ts @@ -0,0 +1,216 @@ +/** + * node-canvas compatibility layer for @napi-rs/canvas. + * + * Provides a drop-in replacement API matching the `canvas` (node-canvas) npm package. + * Quality values for JPEG/WebP use the node-canvas 0-1 scale and are automatically + * converted to @napi-rs/canvas's 0-100 scale internally. + * + * @example + * ```typescript + * // Drop-in replacement: change this import + * // import { createCanvas, registerFont, loadImage } from 'canvas' + * // to this: + * import { createCanvas, registerFont, loadImage } from '@napi-rs/canvas/node-canvas' + * ``` + */ + +import { Readable } from 'node:stream' + +// Re-export types from @napi-rs/canvas that are API-compatible +import { + Image as NapiImage, + ImageData as NapiImageData, + Path2D as NapiPath2D, + DOMPoint as NapiDOMPoint, + DOMMatrix as NapiDOMMatrix, + DOMRect as NapiDOMRect, + SKRSContext2D, + Canvas as NapiCanvas, + SvgCanvas, + SvgExportFlag, + IGlobalFonts, + PDFDocument, +} from './index' + +// --------------------------------------------------------------------------- +// Config interfaces (node-canvas conventions) +// --------------------------------------------------------------------------- + +export interface PngConfig { + /** ZLIB compression level (0-9). Accepted for compatibility; Skia uses its own encoder. */ + compressionLevel?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 + /** PNG filter flags. Accepted for compatibility; Skia uses its own encoder. */ + filters?: number + /** Palette for indexed PNGs. Not supported by Skia backend. */ + palette?: Uint8ClampedArray + /** Background color index for indexed PNGs. Not supported by Skia backend. */ + backgroundIndex?: number + /** Pixels per inch. Accepted for compatibility. */ + resolution?: number +} + +export interface JpegConfig { + /** Quality between 0 and 1. Defaults to 0.75. Converted to 0-100 for Skia. */ + quality?: number + /** Progressive encoding. Accepted for compatibility; not supported by Skia backend. */ + progressive?: boolean + /** 2x2 chroma subsampling. Accepted for compatibility; not supported by Skia backend. */ + chromaSubsampling?: boolean +} + +// --------------------------------------------------------------------------- +// Canvas class (with node-canvas compatible methods) +// --------------------------------------------------------------------------- + +export interface Canvas extends Omit { + /** + * Encode the canvas as a PNG and return a Node.js Readable stream. + * @param config PNG encoding options (accepted for compatibility) + */ + createPNGStream(config?: PngConfig): PNGStream + + /** + * Encode the canvas as a JPEG and return a Node.js Readable stream. + * @param config JPEG encoding options. Quality is 0-1 (default 0.75). + */ + createJPEGStream(config?: JpegConfig): JPEGStream + + // --- toBuffer overloads (node-canvas conventions) --- + + /** Encode as PNG (default). */ + toBuffer(): Buffer + toBuffer(mimeType: 'image/png', config?: PngConfig): Buffer + /** Encode as JPEG. Quality in config is 0-1 (default 0.75). */ + toBuffer(mimeType: 'image/jpeg', config?: JpegConfig): Buffer + /** Get raw unencoded pixel data. */ + toBuffer(mimeType: 'raw'): Buffer + + /** Async: encode as PNG (default) via callback. */ + toBuffer(cb: (err: Error | null, result: Buffer) => void): void + toBuffer(cb: (err: Error | null, result: Buffer) => void, mimeType: 'image/png', config?: PngConfig): void + /** Async: encode as JPEG via callback. Quality in config is 0-1 (default 0.75). */ + toBuffer(cb: (err: Error | null, result: Buffer) => void, mimeType: 'image/jpeg', config?: JpegConfig): void + + // --- toDataURL overloads (node-canvas conventions) --- + + /** Encode as PNG data URL (default). */ + toDataURL(): string + toDataURL(mimeType: 'image/png'): string + /** Encode as JPEG data URL. Quality is 0-1. */ + toDataURL(mimeType: 'image/jpeg', quality?: number): string + /** Async: encode as data URL via callback. */ + toDataURL(cb: (err: Error | null, result: string) => void): void + toDataURL(mimeType: 'image/png', cb: (err: Error | null, result: string) => void): void + toDataURL(mimeType: 'image/jpeg', cb: (err: Error | null, result: string) => void): void + toDataURL(mimeType: 'image/jpeg', quality: number, cb: (err: Error | null, result: string) => void): void +} + +// --------------------------------------------------------------------------- +// Stream classes +// --------------------------------------------------------------------------- + +/** Readable stream that emits PNG-encoded data. */ +export class PNGStream extends Readable {} + +/** Readable stream that emits JPEG-encoded data. */ +export class JPEGStream extends Readable {} + +// --------------------------------------------------------------------------- +// Factory functions +// --------------------------------------------------------------------------- + +/** + * Create a new canvas with node-canvas compatible API. + * Canvas instances created through this function have `createPNGStream()`, + * `createJPEGStream()`, and node-canvas compatible `toBuffer()` overloads. + * + * When `type` is `'svg'`, returns a `SvgCanvas` which produces vector output + * via `getContent()` instead of raster encoding methods. + * + * @param width Canvas width in pixels + * @param height Canvas height in pixels + * @param type Canvas type: 'image' (default) or 'svg' + */ +export function createCanvas(width: number, height: number, type: 'svg'): SvgCanvas +export function createCanvas(width: number, height: number, type?: 'image'): Canvas + +/** + * Create an ImageData instance. + * @param data Pixel data array + * @param width Width in pixels + * @param height Height in pixels (calculated from data length if omitted) + */ +export function createImageData(data: Uint8ClampedArray, width: number, height?: number): NapiImageData +export function createImageData(width: number, height: number): NapiImageData + +/** + * Load an image from a file path, URL, Buffer, or other source. + * Returns a Promise that resolves to an Image instance. + */ +export function loadImage( + source: string | URL | Buffer | ArrayBufferLike | Uint8Array | NapiImage | import('stream').Readable, + options?: { alt?: string; maxRedirects?: number; requestOptions?: import('http').RequestOptions }, +): Promise + +// --------------------------------------------------------------------------- +// Font registration (node-canvas convention) +// --------------------------------------------------------------------------- + +/** + * Register a font file for use in canvas text rendering. + * Compatible with node-canvas's `registerFont()`. + * + * Note: @napi-rs/canvas auto-detects weight and style from font file metadata + * (matching browser behavior). The `weight` and `style` properties in fontFace + * are accepted for API compatibility. + * + * @param path Absolute path to the font file (.ttf, .otf, etc.) + * @param fontFace Font face properties matching CSS @font-face descriptors + */ +export function registerFont(path: string, fontFace: { family: string; weight?: string; style?: string }): void + +/** + * Deregister all previously registered fonts. + * Compatible with node-canvas's `deregisterAllFonts()`. + */ +export function deregisterAllFonts(): void + +// --------------------------------------------------------------------------- +// Re-exported classes & values +// --------------------------------------------------------------------------- + +// Canvas is exported both as a type (the compat interface above) and as a +// value (constructor that returns compat Canvas instances at runtime). +export declare const Canvas: { + new (width: number, height: number): Canvas + new (width: number, height: number, flag: SvgExportFlag): SvgCanvas + prototype: NapiCanvas +} + +export { NapiImage as Image } +export { NapiImageData as ImageData } +export { NapiPath2D as Path2D } +export { NapiDOMPoint as DOMPoint } +export { NapiDOMMatrix as DOMMatrix } +export { NapiDOMRect as DOMRect } + +// SKRSContext2D is an interface in index.d.ts but a class value at runtime. +// Declare as const to export the value for instanceof checks and re-export the type. +export type CanvasRenderingContext2D = SKRSContext2D +export declare const CanvasRenderingContext2D: { prototype: SKRSContext2D } +/** Legacy alias for CanvasRenderingContext2D. */ +export type Context2d = SKRSContext2D +export declare const Context2d: { prototype: SKRSContext2D } + +// --------------------------------------------------------------------------- +// @napi-rs/canvas extras (not part of node-canvas, but useful) +// --------------------------------------------------------------------------- + +export { IGlobalFonts } +export declare const GlobalFonts: IGlobalFonts & { + /** Reload system fonts. Available at runtime but not declared in IGlobalFonts. */ + loadSystemFonts(): number +} +export { PDFDocument } +export { NapiCanvas as CanvasElement } +export { SvgCanvas as SVGCanvas } diff --git a/tools/ui/node_modules/@napi-rs/canvas/node-canvas.js b/tools/ui/node_modules/@napi-rs/canvas/node-canvas.js new file mode 100644 index 0000000000000000000000000000000000000000..6715f0d3d01210137997c4d08e5bd37f77529013 --- /dev/null +++ b/tools/ui/node_modules/@napi-rs/canvas/node-canvas.js @@ -0,0 +1,379 @@ +'use strict' + +const { Readable } = require('node:stream') + +const { + createCanvas: _createCanvas, + Canvas, + CanvasElement, + SVGCanvas, + GlobalFonts, + Image, + ImageData, + Path2D, + DOMPoint, + DOMMatrix, + DOMRect, + loadImage, + PDFDocument, + SvgExportFlag, +} = require('./index.js') + +// CanvasRenderingContext2D is not re-exported by index.js, grab from native bindings +const { CanvasRenderingContext2D } = require('./js-binding') + +// node-canvas defaults JPEG quality to 0.75 across all paths. +// @napi-rs/canvas native default is 0.92 (matching Blink/Chrome). +const NODE_CANVAS_DEFAULT_QUALITY = 0.75 + +// --------------------------------------------------------------------------- +// Stream classes (node-canvas returns Node.js Readable streams) +// --------------------------------------------------------------------------- + +class PNGStream extends Readable { + constructor(canvas, options) { + super() + this._canvas = canvas + this._options = options || {} + this._done = false + } + + _read() { + if (this._done) return + this._done = true + this._canvas + .encode('png') + .then((buf) => { + this.push(buf) + this.push(null) + }) + .catch((err) => { + this.destroy(err) + }) + } +} + +class JPEGStream extends Readable { + constructor(canvas, options) { + super() + this._canvas = canvas + const opts = options || {} + // node-canvas quality: 0-1 (default 0.75), encode() expects 0-100 + this._quality = Math.round((opts.quality != null ? opts.quality : NODE_CANVAS_DEFAULT_QUALITY) * 100) + this._done = false + } + + _read() { + if (this._done) return + this._done = true + this._canvas + .encode('jpeg', this._quality) + .then((buf) => { + this.push(buf) + this.push(null) + }) + .catch((err) => { + this.destroy(err) + }) + } +} + +// --------------------------------------------------------------------------- +// Quality normalization helpers +// --------------------------------------------------------------------------- + +const MIME_FORMAT_MAP = { + 'image/png': 'png', + 'image/jpeg': 'jpeg', + 'image/webp': 'webp', + 'image/avif': 'avif', + 'image/gif': 'gif', +} + +/** + * Extract quality from a node-canvas config object or number. + * Returns the raw 0-1 quality value, defaulting to NODE_CANVAS_DEFAULT_QUALITY + * for JPEG/WebP when not specified. + * + * @param {string} mime + * @param {number|object|undefined} configOrQuality + * @returns {number|undefined} 0-1 scale for JPEG/WebP, undefined for other mimes + */ +function _extractQuality(mime, configOrQuality) { + if (mime !== 'image/jpeg' && mime !== 'image/webp') return undefined + if (configOrQuality == null) return NODE_CANVAS_DEFAULT_QUALITY + if (typeof configOrQuality === 'number') return configOrQuality + if (typeof configOrQuality === 'object' && configOrQuality.quality != null) { + return configOrQuality.quality + } + return NODE_CANVAS_DEFAULT_QUALITY +} + +// --------------------------------------------------------------------------- +// Compat methods added to each canvas instance created via this module +// --------------------------------------------------------------------------- + +// Keep references to the original prototype methods +const _origToBuffer = CanvasElement.prototype.toBuffer +const _origToDataURL = CanvasElement.prototype.toDataURL + +function _compatCreatePNGStream(options) { + return new PNGStream(this, options) +} + +function _compatCreateJPEGStream(options) { + return new JPEGStream(this, options) +} + +/** + * node-canvas compatible toBuffer: + * - toBuffer() → PNG (sync) + * - toBuffer('image/png', config?) → PNG (sync) + * - toBuffer('image/jpeg', config?) → JPEG (sync, quality 0-1) + * - toBuffer('raw') → raw pixel data (sync) + * - toBuffer(callback) → PNG (async) + * - toBuffer(callback, mime, config?) → specified format (async) + */ +function _compatToBuffer(mimeOrCallback, configOrQuality) { + // Callback form: toBuffer(callback) or toBuffer(callback, mime, config) + if (typeof mimeOrCallback === 'function') { + const callback = mimeOrCallback + const mime = typeof configOrQuality === 'string' ? configOrQuality : 'image/png' + const config = arguments[2] + + if (mime === 'raw') { + let buf + try { + buf = this.data() + } catch (err) { + callback(err) + return + } + callback(null, buf) + return + } + + const format = MIME_FORMAT_MAP[mime] + if (!format) { + callback(new TypeError(`Unsupported MIME type "${mime}". Supported: ${Object.keys(MIME_FORMAT_MAP).join(', ')}`)) + return + } + const q = _extractQuality(mime, config) + this.encode(format, q != null ? Math.round(q * 100) : undefined).then( + (buf) => callback(null, buf), + (err) => callback(err), + ) + return + } + + // Sync: no args → PNG + if (mimeOrCallback === undefined) { + return _origToBuffer.call(this, 'image/png') + } + + // Sync: raw pixel data + if (mimeOrCallback === 'raw') { + return this.data() + } + + // Sync: extract quality (0-1) and scale to 0-100 for native toBuffer + const q = _extractQuality(mimeOrCallback, configOrQuality) + return _origToBuffer.call(this, mimeOrCallback, q != null ? Math.round(q * 100) : undefined) +} + +/** + * node-canvas compatible toDataURL: + * - toDataURL() → PNG data URL (sync) + * - toDataURL('image/jpeg', quality) → JPEG data URL, quality 0-1 (sync) + * - toDataURL(callback) → PNG data URL (async) + * - toDataURL(mime, callback) → data URL (async) + * - toDataURL(mime, quality, callback) → data URL with quality (async) + */ +function _compatToDataURL(mimeOrCallback, qualityOrCallback) { + // toDataURL(callback) + if (typeof mimeOrCallback === 'function') { + this.toDataURLAsync('image/png').then( + (url) => mimeOrCallback(null, url), + (err) => mimeOrCallback(err), + ) + return + } + // toDataURL(mime, callback) + if (typeof qualityOrCallback === 'function') { + this.toDataURLAsync(mimeOrCallback, _extractQuality(mimeOrCallback, undefined)).then( + (url) => qualityOrCallback(null, url), + (err) => qualityOrCallback(err), + ) + return + } + // toDataURL(mime, quality, callback) + const cb = arguments[2] + if (typeof cb === 'function') { + // Native toDataURLAsync expects 0-1 (f64) — pass quality through as-is + const quality = _extractQuality(mimeOrCallback, qualityOrCallback) + this.toDataURLAsync(mimeOrCallback, quality).then( + (url) => cb(null, url), + (err) => cb(err), + ) + return + } + + // Sync form: native toDataURL expects 0-1 (f64) — pass quality through as-is + const quality = _extractQuality(mimeOrCallback, qualityOrCallback) + return _origToDataURL.call(this, mimeOrCallback, quality) +} + +/** + * Attach node-canvas compatible methods to a CanvasElement instance. + */ +function _addCompatMethods(canvas) { + canvas.createPNGStream = _compatCreatePNGStream + canvas.createJPEGStream = _compatCreateJPEGStream + canvas.toBuffer = _compatToBuffer + canvas.toDataURL = _compatToDataURL + return canvas +} + +// --------------------------------------------------------------------------- +// Public API: registerFont / deregisterAllFonts +// --------------------------------------------------------------------------- + +// Track FontKeys from registerFont() so deregisterAllFonts() can remove +// only user-registered fonts (matching node-canvas behavior which leaves +// system fonts untouched). +const _registeredFontKeys = [] + +/** + * Register a font file with the specified font face properties. + * Compatible with node-canvas's registerFont(path, { family, weight?, style? }). + * + * Note: @napi-rs/canvas auto-detects weight and style from font file metadata + * (matching browser behavior). The weight and style properties in fontFace are + * accepted for API compatibility but the actual values are read from the font. + * + * @param {string} path Absolute path to the font file (.ttf, .otf, etc.) + * @param {{ family: string, weight?: string, style?: string }} fontFace + */ +function registerFont(path, fontFace) { + if (!fontFace || typeof fontFace.family !== 'string') { + throw new TypeError('registerFont requires a fontFace with a "family" property') + } + const key = GlobalFonts.registerFromPath(path, fontFace.family) + if (!key) { + throw new Error(`Failed to register font from "${path}" with family "${fontFace.family}"`) + } + _registeredFontKeys.push(key) +} + +/** + * Deregister all fonts previously registered via registerFont(). + * Compatible with node-canvas's deregisterAllFonts() which only removes + * user-registered fonts and leaves system fonts untouched. + */ +function deregisterAllFonts() { + if (_registeredFontKeys.length > 0) { + GlobalFonts.removeBatch(_registeredFontKeys) + _registeredFontKeys.length = 0 + } +} + +// --------------------------------------------------------------------------- +// Public API: createCanvas / createImageData +// --------------------------------------------------------------------------- + +/** + * Create a new canvas instance with node-canvas compatible API. + * + * @param {number} width + * @param {number} height + * @param {'image'|'svg'} [type='image'] + * @returns {Canvas} + */ +function createCanvas(width, height, type) { + if (type === 'svg') { + // SvgExportFlag enum requires a valid variant; NoPrettyXML (0x02) is the + // least impactful on rendering behavior (only affects XML whitespace). + return _createCanvas(width, height, SvgExportFlag.NoPrettyXML) + } + if (type === 'pdf') { + throw new Error( + 'createCanvas with type "pdf" is not supported. Use the PDFDocument class from @napi-rs/canvas directly.', + ) + } + if (type != null && type !== 'image') { + throw new TypeError(`createCanvas: unknown type "${type}". Supported types: "image", "svg".`) + } + return _addCompatMethods(_createCanvas(width, height)) +} + +/** + * Create an ImageData instance. + * Compatible with node-canvas's createImageData(). + * + * @param {Uint8ClampedArray|number} dataOrWidth + * @param {number} widthOrHeight + * @param {number} [height] + * @returns {ImageData} + */ +function createImageData(dataOrWidth, widthOrHeight, height) { + if (typeof dataOrWidth === 'number') { + return new ImageData(dataOrWidth, widthOrHeight) + } + if (height != null) { + return new ImageData(dataOrWidth, widthOrHeight, height) + } + return new ImageData(dataOrWidth, widthOrHeight) +} + +// --------------------------------------------------------------------------- +// Canvas constructor wrapper +// --------------------------------------------------------------------------- + +// In node-canvas, `new Canvas(w, h)` and `createCanvas(w, h)` produce +// equivalent canvases. Wrap the native Canvas constructor so that +// `new Canvas(w, h)` also gets compat methods, without polluting the +// prototype (which would affect @napi-rs/canvas users who don't use +// this compat layer). +const CompatCanvas = new Proxy(Canvas, { + construct(target, args) { + const canvas = new target(...args) + if (canvas instanceof CanvasElement) { + return _addCompatMethods(canvas) + } + return canvas + }, +}) + +// --------------------------------------------------------------------------- +// Exports (matches node-canvas export shape) +// --------------------------------------------------------------------------- + +module.exports = { + // Factory functions + Canvas: CompatCanvas, + createCanvas, + createImageData, + loadImage, + registerFont, + deregisterAllFonts, + + // Classes + Image, + ImageData, + CanvasRenderingContext2D, + Context2d: CanvasRenderingContext2D, + PNGStream, + JPEGStream, + Path2D, + + // Geometry + DOMPoint, + DOMMatrix, + DOMRect, + + // @napi-rs/canvas extras (available but not part of node-canvas) + GlobalFonts, + PDFDocument, + CanvasElement, + SVGCanvas, +} diff --git a/tools/ui/node_modules/@napi-rs/canvas/package.json b/tools/ui/node_modules/@napi-rs/canvas/package.json new file mode 100644 index 0000000000000000000000000000000000000000..49a901616941d103b1bac7a5af9e0842c087b821 --- /dev/null +++ b/tools/ui/node_modules/@napi-rs/canvas/package.json @@ -0,0 +1,176 @@ +{ + "name": "@napi-rs/canvas", + "version": "0.1.100", + "description": "Canvas for Node.js with skia backend", + "main": "index.js", + "repository": { + "type": "git", + "url": "git+https://github.com/Brooooooklyn/canvas.git" + }, + "workspaces": [ + "e2e/*" + ], + "license": "MIT", + "keywords": [ + "napi-rs", + "NAPI", + "N-API", + "Rust", + "node-addon", + "node-addon-api", + "canvas", + "image", + "pdf", + "svg", + "skia" + ], + "files": [ + "index.d.ts", + "index.js", + "geometry.js", + "js-binding.js", + "load-image.js", + "node-canvas.js", + "node-canvas.d.ts" + ], + "napi": { + "binaryName": "skia", + "targets": [ + "x86_64-unknown-linux-gnu", + "x86_64-apple-darwin", + "x86_64-pc-windows-msvc", + "aarch64-pc-windows-msvc", + "armv7-unknown-linux-gnueabihf", + "x86_64-unknown-linux-musl", + "aarch64-unknown-linux-gnu", + "aarch64-unknown-linux-musl", + "aarch64-apple-darwin", + "aarch64-linux-android", + "riscv64-unknown-linux-gnu" + ] + }, + "engines": { + "node": ">= 10" + }, + "publishConfig": { + "registry": "https://registry.npmjs.org/", + "access": "public" + }, + "scripts": { + "artifacts": "napi artifacts", + "bench": "node --import @oxc-node/core/register benchmark/bench.ts", + "build": "napi build --platform --release --js js-binding.js", + "build:debug": "napi build --platform --js js-binding.js", + "example-lottie": "yarn oxnode ./example/lottie-to-video.ts", + "format": "run-p format:source format:rs format:toml", + "format:rs": "cargo fmt", + "format:source": "prettier . -w", + "format:toml": "taplo format", + "lint": "oxlint", + "prepublishOnly": "pinst --disable && napi prepublish -t npm", + "postpublish": "pinst --enable", + "test:ci": "ava -c 1", + "test": "ava", + "e2e": "yarn workspace @napi-rs/canvas-e2e-webpack test", + "version": "napi version && conventional-changelog -p angular -i CHANGELOG.md -s && git add ." + }, + "devDependencies": { + "@jimp/core": "^1.6.0", + "@jimp/custom": "^0.22.12", + "@jimp/jpeg": "^0.22.12", + "@jimp/png": "^0.22.12", + "@napi-rs/cli": "^3.5.0", + "@napi-rs/webcodecs": "^1.1.1", + "@octokit/rest": "^22.0.1", + "@oxc-node/cli": "^0.1.0", + "@oxc-node/core": "^0.1.0", + "@taplo/cli": "^0.7.0", + "@types/lodash": "^4.17.21", + "@types/node": "^25.0.3", + "@types/semver": "^7", + "ava": "^7.0.0", + "canvas": "^3.2.0", + "canvaskit-wasm": "^0.41.0", + "colorette": "^2.0.20", + "conventional-changelog-cli": "^5.0.0", + "core-js": "^3.47.0", + "echarts": "^6.0.0", + "electron": "^41.0.0", + "husky": "^9.1.7", + "lint-staged": "^16.2.7", + "lodash": "^4.17.21", + "npm-run-all2": "^8.0.4", + "oxlint": "^1.34.0", + "oxlint-tsgolint": "^0.22.0", + "pinst": "^3.0.0", + "png.js": "^0.2.1", + "prettier": "^3.7.4", + "pretty-bytes": "^7.1.0", + "semver": "^7.7.3", + "skia-canvas": "^3.0.8", + "table": "^6.9.0", + "tinybench": "^6.0.0", + "typescript": "^6.0.0" + }, + "lint-staged": { + "*.@(js|ts|tsx|yml|yaml|md|json|html)": [ + "prettier --write" + ], + "*.@(js|ts|tsx)": [ + "oxlint --fix" + ] + }, + "ava": { + "nodeArguments": [ + "--import=@oxc-node/core/register", + "--import=core-js/proposals/promise-with-resolvers.js" + ], + "extensions": { + "ts": "module" + }, + "files": [ + "__test__/**/*.spec.ts", + "scripts/__test__/**/*.spec.ts" + ], + "workerThreads": false, + "cache": false, + "timeout": "3m", + "environmentVariables": { + "SWC_NODE_PROJECT": "./tsconfig.json", + "NODE_ENV": "ava" + } + }, + "prettier": { + "printWidth": 120, + "semi": false, + "trailingComma": "all", + "singleQuote": true, + "arrowParens": "always" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" + }, + "packageManager": "yarn@4.14.1", + "dependenciesMeta": { + "canvas": { + "built": true + }, + "skia-canvas": { + "built": true + } + }, + "optionalDependencies": { + "@napi-rs/canvas-linux-x64-gnu": "0.1.100", + "@napi-rs/canvas-darwin-x64": "0.1.100", + "@napi-rs/canvas-win32-x64-msvc": "0.1.100", + "@napi-rs/canvas-win32-arm64-msvc": "0.1.100", + "@napi-rs/canvas-linux-arm-gnueabihf": "0.1.100", + "@napi-rs/canvas-linux-x64-musl": "0.1.100", + "@napi-rs/canvas-linux-arm64-gnu": "0.1.100", + "@napi-rs/canvas-linux-arm64-musl": "0.1.100", + "@napi-rs/canvas-darwin-arm64": "0.1.100", + "@napi-rs/canvas-android-arm64": "0.1.100", + "@napi-rs/canvas-linux-riscv64-gnu": "0.1.100" + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/@neoconfetti/react/README.md b/tools/ui/node_modules/@neoconfetti/react/README.md new file mode 100644 index 0000000000000000000000000000000000000000..cbb74f61adc8afe7512371bdb69a256170fda7fa --- /dev/null +++ b/tools/ui/node_modules/@neoconfetti/react/README.md @@ -0,0 +1,202 @@ +# @neoconfetti/react + +Let's party 🎊🎊 with React! `@neoconfetti/react` allows you to show an awesome confetti explosion on your page, with React/Preact/Million! + +## Features + +- 🤏 Tiny - 1.61KB min+br. +- 🐇 Simple - Quite simple to use, and effectively no-config required! +- 🗃️ Customizable - Offers tons of options that you can modify to get different behaviors. +- 🖥️ SSR friendly - Works seamlessly in NextJS/Remix/Gatsby/Redwood and other Server Side Rendering environments! + + + + +## Installing + +```bash +# pnpm +pnpm add @neoconfetti/react + +# bun +bun install @neoconfetti/react + +# npm +npm install @neoconfetti/react +``` + +## Usage + +Basic usage: + +```tsx +import { Confetti } from '@neoconfetti/react'; + +; +``` + +Customizing behavior with options: + +```tsx + +``` + +## Props + +There's tons of options available for this package. All of them are already documented within the code itself, so you'll never have to leave the code editor. + +### particleCount + +Number of confetti particles to create. + +**type:** `number` + +**Default value:** 150 + +**Example:** + +```tsx + +``` + +### particleSize + +Size of the confetti particles in pixels + +**type:** `number` + +**Default value:** 12 + +**Example:** + +```tsx + +``` + +### particleShape + +Shape of particles to use. Can be `mix`, `circles` or `rectangles` + +`mix` will use both circles and rectangles +`circles` will use only circles +`rectangles` will use only rectangles + +**type:** `'mix' | 'circles' | 'rectangles'` + +**Default value:** `'mix'` + +**Example:** + +```tsx + +``` + +### duration + +Duration of the animation in milliseconds + +**type:** `number` + +**Default value:** 3500 + +**Example:** + +```tsx + +``` + +### colors + +Colors to use for the confetti particles. Pass string array of colors. Can use hex colors, named colors, CSS Variables, literally anything valid in plain CSS. + +**type:** `Array` + +**Default value:** `['#FFC700', '#FF0000', '#2E3191', '#41BBC7']` + +**Example:** + +```tsx + +``` + +### force + +Force of the confetti particles. Between 0 and 1. 0 is no force, 1 is maximum force. Will error out if you pass a value outside of this range. + +**type:** `number` + +**Default value:** 0.5 + +**Example:** + +```tsx + +``` + +### stageHeight + +Height of the stage in pixels. Confetti will only fall within this height. + +**type:** `number` + +**Default value:** 800 + +**Example:** + +```tsx + +``` + +### stageWidth + +Width of the stage in pixels. Confetti will only fall within this width. + +**type:** `number` + +**Default value:** 1600 + +**Example:** + +```tsx + +``` + +### destroyAfterDone + +Whether or not destroy all confetti nodes after the `duration` period has passed. By default it destroys all nodes, to free up memory. + +**type:** `boolean` + +**Default value:** `true` + +**Example:** + +```tsx + +``` + + + + + + +## Fine-grained reactivity + +Changing the options will destroy the existing confetti mid-flight, and create a new one with the new options. Exception: If `particlesCount` isn't changed, and properties like `colors` or `particleShape` is changed, the confetti particles will change their colors or shape mid-flight. + +## Performance + +This library functions by creating 2 DOM nodes for every single confetti. By default, if the `particlesCount` is set to 150, it will create 300 nodes. This is a lot of nodes. For most devices, these many nodes are not a big issue, but I recommend checking your target devices' performance if you choose to go with a higher number, like 400 or 500. + +Also, after the specified `duration`, all the confetti DOM nodes will be destroyed. This is to free up memory. If you wish to keep them around, set `destroyAfterDone` to `false`. + +## Credits + +This library is the port of the amazing [react-confetti-explosion](https://www.npmjs.com/package//react-confetti-explosion) package, just **10X** smaller and faster. All the logic is from that package only, optimisation and Svelte code are mine 😉 + +## License + +MIT License +© [Puru Vijay](https://twitter.com/puruvjdev) diff --git a/tools/ui/node_modules/@neoconfetti/react/dist/index.d.ts b/tools/ui/node_modules/@neoconfetti/react/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..b8b4e4fc8f2f89c0f25b1d9d8516a975c8fe67ff --- /dev/null +++ b/tools/ui/node_modules/@neoconfetti/react/dist/index.d.ts @@ -0,0 +1,80 @@ +import * as react from 'react'; + +type ParticleShape = 'mix' | 'circles' | 'rectangles'; +type ConfettiOptions = { + /** + * Number of confetti particles to create + * + * @default 150 + */ + particleCount?: number; + /** + * Shape of particles to use. Can be `mix`, `circles` or `rectangles` + * + * `mix` will use both circles and rectangles + * `circles` will use only circles + * `rectangles` will use only rectangles + * + * @default 'mix' + */ + particleShape?: ParticleShape; + /** + * Size of the confetti particles in pixels + * + * @default 12 + */ + particleSize?: number; + /** + * Class to apply to each confetti particle + * + * @default undefined + */ + particleClass?: string; + /** + * Duration of the animation in milliseconds + * + * @default 3500 + */ + duration?: number; + /** + * Colors to use for the confetti particles. Pass string array of colors. Can use hex colors, named colors, + * CSS Variables, literally anything valid in plain CSS. + * + * @default ['#FFC700', '#FF0000', '#2E3191', '#41BBC7'] + */ + colors?: string[]; + /** + * Force of the confetti particles. Between 0 and 1. 0 is no force, 1 is maximum force. + * + * @default 0.5 + */ + force?: number; + /** + * Height of the stage in pixels. Confetti will only fall within this height. + * + * @default 800 + */ + stageHeight?: number; + /** + * Width of the stage in pixels. Confetti will only fall within this width. + * + * @default 1600 + */ + stageWidth?: number; + /** + * Whether or not destroy all confetti nodes after the `duration` period has passed. By default it destroys all nodes, to preserve memory. + * + * @default true + */ + destroyAfterDone?: boolean; +}; + +interface ConfettiProps extends ConfettiOptions { + class?: string; +} +declare function Confetti({ class: className, ...options }: ConfettiProps): react.DetailedReactHTMLElement<{ + ref: react.RefObject; + className: string | undefined; +}, HTMLElement>; + +export { Confetti, type ParticleShape as ConfettiParticleShape, type ConfettiProps }; diff --git a/tools/ui/node_modules/@neoconfetti/react/dist/index.js b/tools/ui/node_modules/@neoconfetti/react/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..380040d666344bb47f330277645a79b98e9ee025 --- /dev/null +++ b/tools/ui/node_modules/@neoconfetti/react/dist/index.js @@ -0,0 +1,232 @@ +"use client"; + +// ../core/dist/index.js +var style_module_default = '@keyframes Bc2PgW_ya{to{translate:0 var(--sh)}}@keyframes Bc2PgW_xa{to{translate:var(--xlp)0}}@keyframes Bc2PgW_r{50%{rotate:var(--hr)180deg}to{rotate:var(--r)360deg}}.Bc2PgW_c{z-index:1200;width:0;height:0;position:relative;overflow:visible}.Bc2PgW_p{animation:xa var(--dc)forwards cubic-bezier(var(--x1),var(--x2),var(--x3),var(--x4));animation-name:Bc2PgW_xa}.Bc2PgW_p>div{animation:ya var(--dc)forwards cubic-bezier(var(--y1),var(--y2),var(--y3),var(--y4));width:var(--w);height:var(--h);animation-name:Bc2PgW_ya;position:absolute;top:0;left:0}.Bc2PgW_p>div:before{content:"";background-color:var(--bgc);animation:r var(--rd)infinite linear;border-radius:var(--br);width:100%;height:100%;animation-name:Bc2PgW_r;display:block}'; +var p = "Bc2PgW_p"; +var c = "Bc2PgW_c"; +var DEFAULT_COLORS = ["#FFC700", "#FF0000", "#2E3191", "#41BBC7"]; +var DEFAULT_DURATION = 3500; +var DEFAULT_FORCE = 0.5; +var DEFAULT_PARTICLE_COUNT = 150; +var DEFAULT_PARTICLE_SHAPE = "mix"; +var DEFAULT_PARTICLE_SIZE = 12; +var DEFAULT_PARTICLE_CLASS = ""; +var DEFAULT_DESTROY_AFTER_DONE = true; +var DEFAULT_STAGE_HEIGHT = 800; +var DEFAULT_STAGE_WIDTH = 1600; +function confetti(container, options = {}) { + let { + colors = DEFAULT_COLORS, + duration = DEFAULT_DURATION, + force = DEFAULT_FORCE, + particleCount = DEFAULT_PARTICLE_COUNT, + particleShape = DEFAULT_PARTICLE_SHAPE, + particleSize = DEFAULT_PARTICLE_SIZE, + particleClass = DEFAULT_PARTICLE_CLASS, + destroyAfterDone = DEFAULT_DESTROY_AFTER_DONE, + stageHeight = DEFAULT_STAGE_HEIGHT, + stageWidth = DEFAULT_STAGE_WIDTH + } = options; + append_styles(style_module_default); + container.classList.add(c); + container.style.setProperty("--sh", stageHeight + "px"); + let particles = []; + let nodes = []; + const calc_rotation_transform = () => math_round(random() * (POSSIBLE_ROTATION_TRANSFORMS - 1)); + const get_is_circle = (particle_shape, rotation_transform) => particleShape !== "rectangles" && (particle_shape === "circles" || should_be_circle(rotation_transform)); + function confetti_styles(node, degree) { + const rotation_transform = calc_rotation_transform(); + const is_circle = get_is_circle(particleShape, rotation_transform); + const set_css_var = (key, val) => node.style.setProperty(key, val + ""); + set_css_var( + // x landing point + "--xlp", + map_range(abs(rotate(degree, 90) - 180), 0, 180, -stageWidth / 2, stageWidth / 2) + "px" + ); + set_css_var( + // duration chaos + "--dc", + duration - math_round(random() * 1e3) + "ms" + ); + const x1 = random() < CRAZY_PARTICLES_FREQUENCY ? round(random() * CRAZY_PARTICLE_CRAZINESS, 2) : 0; + set_css_var("--x1", x1); + set_css_var("--x2", x1 * -1); + set_css_var("--x3", x1); + set_css_var("--x4", round(abs(map_range(abs(rotate(degree, 90) - 180), 0, 180, -1, 1)), 4)); + set_css_var("--y1", round(random() * BEZIER_MEDIAN, 4)); + set_css_var("--y2", round(random() * force * (coin_flip() ? 1 : -1), 4)); + set_css_var("--y3", BEZIER_MEDIAN); + set_css_var("--y4", round(max(map_range(abs(degree - 180), 0, 180, force, -force), 0), 4)); + set_css_var( + // --width + "--w", + (is_circle ? particleSize : math_round(random() * 4) + particleSize / 2) + "px" + ); + set_css_var( + // --height + "--h", + (is_circle ? particleSize : math_round(random() * 2) + particleSize) + "px" + ); + const rotation = rotation_transform.toString(2).padStart(3, "0").split(""); + set_css_var( + // --half-rotation + "--hr", + rotation.map((n) => +n / 2 + "").join(" ") + ); + set_css_var( + // --rotation + "--r", + rotation.join(" ") + ); + set_css_var( + // --rotation-duration + "--rd", + round(random() * (ROTATION_SPEED_MAX - ROTATION_SPEED_MIN) + ROTATION_SPEED_MIN) + "ms" + ); + set_css_var( + // --border-radius + "--br", + is_circle ? "50%" : 0 + ); + } + let timer; + function scratch() { + container.innerHTML = ""; + clearTimeout(timer); + particles = create_particles(particleCount, colors); + nodes = create_particle_nodes(container, particles, particleClass); + for (const [i, node] of object_entries(nodes)) + confetti_styles(node, particles[+i].degree); + timer = setTimeout(() => { + if (destroyAfterDone) + container.innerHTML = ""; + }, duration); + } + scratch(); + return { + update(new_options) { + const new_particle_count = new_options.particleCount ?? DEFAULT_PARTICLE_COUNT; + const new_particle_shape = new_options.particleShape ?? DEFAULT_PARTICLE_SHAPE; + const new_particle_size = new_options.particleSize ?? DEFAULT_PARTICLE_SIZE; + const new_particle_class = new_options.particleClass ?? DEFAULT_PARTICLE_CLASS; + const new_colors = new_options.colors ?? DEFAULT_COLORS; + const new_stage_height = new_options.stageHeight ?? DEFAULT_STAGE_HEIGHT; + const new_duration = new_options.duration ?? DEFAULT_DURATION; + const new_force = new_options.force ?? DEFAULT_FORCE; + const new_stage_width = new_options.stageWidth ?? DEFAULT_STAGE_WIDTH; + const new_destroy_after_done = new_options.destroyAfterDone ?? DEFAULT_DESTROY_AFTER_DONE; + particles = create_particles(new_particle_count, new_colors); + let start_from_scratch = false; + if (new_particle_count === particleCount) { + nodes = Array.from(container.querySelectorAll(`.${p}`)); + for (const [i, { color }] of object_entries(particles)) { + const node = nodes[+i]; + if (JSON.stringify(colors) !== JSON.stringify(new_colors)) { + node.style.setProperty("--bgc", color); + } + if (new_particle_shape !== particleShape) { + node.style.setProperty( + // --border-radius + "--br", + get_is_circle(new_particle_shape, calc_rotation_transform()) ? "50%" : "0" + ); + } + if (new_particle_class !== particleClass) { + if (particleClass) + node.classList.remove(particleClass); + if (new_particle_class) + node.classList.add(new_particle_class); + } + } + } else { + start_from_scratch = true; + } + if (destroyAfterDone && !new_destroy_after_done) { + clearTimeout(timer); + } + container.style.setProperty("--sh", new_stage_height + "px"); + duration = new_duration; + colors = new_colors; + force = new_force; + particleCount = new_particle_count; + particleShape = new_particle_shape; + particleSize = new_particle_size; + particleClass = new_particle_class; + destroyAfterDone = new_destroy_after_done; + stageHeight = new_stage_height; + stageWidth = new_stage_width; + if (start_from_scratch) + scratch(); + }, + destroy() { + container.innerHTML = ""; + clearTimeout(timer); + } + }; +} +function append_styles(styles) { + if (document.querySelector(`style[data-neoconfetti]`)) + return; + const style = element("style"); + style.dataset.neoconfetti = ""; + style.textContent = styles; + append_child(document.head, style); +} +function create_particle_nodes(container, particles = [], particleClass) { + const particle_nodes = []; + for (const { color } of particles) { + const particle_node = element("div"); + particle_node.className = `${p} ${particleClass}`; + particle_node.style.setProperty("--bgc", color); + const inner_particle = element("div"); + append_child(particle_node, inner_particle); + append_child(container, particle_node); + particle_nodes.push(particle_node); + } + return particle_nodes; +} +var ROTATION_SPEED_MIN = 200; +var ROTATION_SPEED_MAX = 800; +var CRAZY_PARTICLES_FREQUENCY = 0.1; +var CRAZY_PARTICLE_CRAZINESS = 0.3; +var BEZIER_MEDIAN = 0.5; +var abs = Math.abs; +var random = Math.random; +var math_round = Math.round; +var max = Math.max; +var element = (name) => document.createElement(name); +var append_child = (parent, child) => parent.appendChild(child); +var create_particles = (count, colors) => Array.from({ length: count }, (_, i) => ({ + color: colors[i % colors.length], + degree: i * 360 / count +})); +var round = (num, precision = 2) => math_round((num + Number.EPSILON) * 10 ** precision) / 10 ** precision; +var map_range = (value, x1, y1, x2, y2) => (value - x1) * (y2 - x2) / (y1 - x1) + x2; +var rotate = (degree, amount) => degree + amount > 360 ? degree + amount - 360 : degree + amount; +var coin_flip = () => random() > 0.5; +var object_entries = Object.entries; +var POSSIBLE_ROTATION_TRANSFORMS = 6; +var should_be_circle = (rotation_transform) => rotation_transform !== 1 && coin_flip(); + +// src/index.ts +import { createElement, useEffect, useRef } from "react"; +function Confetti({ class: className, ...options }) { + const target_ref = useRef(null); + const instance_ref = useRef(); + useEffect(() => { + if (typeof window === "undefined") + return; + if (!target_ref.current) + return; + if (!instance_ref.current) { + instance_ref.current = confetti(target_ref.current, options); + return; + } + instance_ref.current.update(options); + return instance_ref.current.destroy; + }, [options]); + return createElement("div", { ref: target_ref, className }); +} +export { + Confetti +}; diff --git a/tools/ui/node_modules/@neoconfetti/react/dist/min/index.js b/tools/ui/node_modules/@neoconfetti/react/dist/min/index.js new file mode 100644 index 0000000000000000000000000000000000000000..29220cb4f780c72fa0d6fe830ce9bb078cfab73a --- /dev/null +++ b/tools/ui/node_modules/@neoconfetti/react/dist/min/index.js @@ -0,0 +1 @@ +var e='@keyframes Bc2PgW_ya{to{translate:0 var(--sh)}}@keyframes Bc2PgW_xa{to{translate:var(--xlp)0}}@keyframes Bc2PgW_r{50%{rotate:var(--hr)180deg}to{rotate:var(--r)360deg}}.Bc2PgW_c{z-index:1200;width:0;height:0;position:relative;overflow:visible}.Bc2PgW_p{animation:xa var(--dc)forwards cubic-bezier(var(--x1),var(--x2),var(--x3),var(--x4));animation-name:Bc2PgW_xa}.Bc2PgW_p>div{animation:ya var(--dc)forwards cubic-bezier(var(--y1),var(--y2),var(--y3),var(--y4));width:var(--w);height:var(--h);animation-name:Bc2PgW_ya;position:absolute;top:0;left:0}.Bc2PgW_p>div:before{content:"";background-color:var(--bgc);animation:r var(--rd)infinite linear;border-radius:var(--br);width:100%;height:100%;animation-name:Bc2PgW_r;display:block}',t="Bc2PgW_p",r="Bc2PgW_c",a=["#FFC700","#FF0000","#2E3191","#41BBC7"],o=3500,n=.5,i=150,c="mix",s=12,l="",d=!0,p=800,u=1600;function y(y,z={}){let{colors:A=a,duration:H=o,force:F=n,particleCount:O=i,particleShape:j=c,particleSize:E=s,particleClass:$=l,destroyAfterDone:q=d,stageHeight:D=p,stageWidth:J=u}=z;!function(e){if(document.querySelector("style[data-neoconfetti]"))return;const t=W("style");t.dataset.neoconfetti="",t.textContent=e,_(document.head,t)}(e),y.classList.add(r),y.style.setProperty("--sh",D+"px");let I=[],G=[];const K=()=>P(b()*(N-1)),Q=(e,t)=>"rectangles"!==j&&("circles"===e||k(t));function R(e,t){const r=K(),a=Q(j,r),o=(t,r)=>e.style.setProperty(t,r+"");o("--xlp",C(x(L(t,90)-180),0,180,-J/2,J/2)+"px"),o("--dc",H-P(1e3*b())+"ms");const n=b()+e/2+"")).join(" ")),o("--r",i.join(" ")),o("--rd",w(b()*(g-f)+f)+"ms"),o("--br",a?"50%":0)}let U;function V(){y.innerHTML="",clearTimeout(U),I=S(O,A),G=function(e,r=[],a){const o=[];for(const{color:n}of r){const r=W("div");r.className=`${t} ${a}`,r.style.setProperty("--bgc",n);const i=W("div");_(r,i),_(e,r),o.push(r)}return o}(y,I,$);for(const[e,t]of T(G))R(t,I[+e].degree);U=setTimeout((()=>{q&&(y.innerHTML="")}),H)}return V(),{update(e){const r=e.particleCount??i,f=e.particleShape??c,g=e.particleSize??s,m=e.particleClass??l,h=e.colors??a,v=e.stageHeight??p,x=e.duration??o,b=e.force??n,P=e.stageWidth??u,B=e.destroyAfterDone??d;I=S(r,h);let W=!1;if(r===O){G=Array.from(y.querySelectorAll(`.${t}`));for(const[e,{color:t}]of T(I)){const r=G[+e];JSON.stringify(A)!==JSON.stringify(h)&&r.style.setProperty("--bgc",t),f!==j&&r.style.setProperty("--br",Q(f,K())?"50%":"0"),m!==$&&($&&r.classList.remove($),m&&r.classList.add(m))}}else W=!0;q&&!B&&clearTimeout(U),y.style.setProperty("--sh",v+"px"),H=x,A=h,F=b,O=r,j=f,E=g,$=m,q=B,D=v,J=P,W&&V()},destroy(){y.innerHTML="",clearTimeout(U)}}}var f=200,g=800,m=.1,h=.3,v=.5,x=Math.abs,b=Math.random,P=Math.round,B=Math.max,W=e=>document.createElement(e),_=(e,t)=>e.appendChild(t),S=(e,t)=>Array.from({length:e},((r,a)=>({color:t[a%t.length],degree:360*a/e}))),w=(e,t=2)=>P((e+Number.EPSILON)*10**t)/10**t,C=(e,t,r,a,o)=>(e-t)*(o-a)/(r-t)+a,L=(e,t)=>e+t>360?e+t-360:e+t,M=()=>b()>.5,T=Object.entries,N=6,k=e=>1!==e&&M();import{createElement as z,useEffect as A,useRef as H}from"react";function F({class:e,...t}){const r=H(null),a=H();return A((()=>{if("undefined"!=typeof window&&r.current){if(a.current)return a.current.update(t),a.current.destroy;a.current=y(r.current,t)}}),[t]),z("div",{ref:r,className:e})}export{F as Confetti}; \ No newline at end of file diff --git a/tools/ui/node_modules/@neoconfetti/react/package.json b/tools/ui/node_modules/@neoconfetti/react/package.json new file mode 100644 index 0000000000000000000000000000000000000000..a77cd590d76c02cd43262c7e2bb09292aafd373c --- /dev/null +++ b/tools/ui/node_modules/@neoconfetti/react/package.json @@ -0,0 +1,59 @@ +{ + "name": "@neoconfetti/react", + "version": "1.0.0", + "description": "Confetti explosion in React 🎉🎊", + "author": "Puru Vijay", + "license": "MIT", + "bugs": { + "url": "https://github.com/puruvj/neoconfetti/issues" + }, + "homepage": "https://github.com/puruvj/neoconfetti/tree/main/packages/react#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/puruvj/neoconfetti.git" + }, + "keywords": [ + "confetti", + "party", + "fun", + "badass", + "badassery", + "svelte", + "sveltekit", + "small", + "tiny", + "performant", + "react", + "nextjs", + "remix" + ], + "main": "./dist/index.js", + "module": "./dist/index.js", + "type": "module", + "types": "./dist/index.d.ts", + "files": [ + "dist/*" + ], + "sideEffects": false, + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": { + "production": "./dist/min/index.js", + "development": "./dist/index.js" + }, + "default": "./dist/min/index.js" + }, + "./package.json": "./package.json" + }, + "devDependencies": { + "@neoconfetti/core": "2.2.1" + }, + "scripts": { + "compile:watch": "tsup --watch", + "compile": "tsup", + "size": "echo 'React size:' && brotli-size dist/min/index.js", + "pub": "pnpm compile && pnpm publish --no-git-checks --access public", + "pub:dry": "pnpm compile && pnpm publish --dry-run --no-git-checks --access public" + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/@oxc-parser/binding-linux-x64-gnu/README.md b/tools/ui/node_modules/@oxc-parser/binding-linux-x64-gnu/README.md new file mode 100644 index 0000000000000000000000000000000000000000..f7ff24739b713c7c1745288711acc1f90ace216c --- /dev/null +++ b/tools/ui/node_modules/@oxc-parser/binding-linux-x64-gnu/README.md @@ -0,0 +1,3 @@ +# `@oxc-parser/binding-linux-x64-gnu` + +This is the **x86_64-unknown-linux-gnu** binary for `@oxc-parser/binding` diff --git a/tools/ui/node_modules/@oxc-parser/binding-linux-x64-gnu/package.json b/tools/ui/node_modules/@oxc-parser/binding-linux-x64-gnu/package.json new file mode 100644 index 0000000000000000000000000000000000000000..4884f097d9310900c33e9c5b4bc4ee156a96d356 --- /dev/null +++ b/tools/ui/node_modules/@oxc-parser/binding-linux-x64-gnu/package.json @@ -0,0 +1,42 @@ +{ + "name": "@oxc-parser/binding-linux-x64-gnu", + "version": "0.127.0", + "cpu": [ + "x64" + ], + "main": "parser.linux-x64-gnu.node", + "files": [ + "parser.linux-x64-gnu.node" + ], + "description": "Oxc Parser Node API", + "keywords": [ + "ast", + "estree", + "javascript", + "oxc", + "parser", + "typescript" + ], + "author": "Boshen and oxc contributors", + "homepage": "https://oxc.rs/docs/guide/usage/parser", + "license": "MIT", + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/oxc-project/oxc.git", + "directory": "napi/parser" + }, + "bugs": "https://github.com/oxc-project/oxc/issues", + "publishConfig": { + "registry": "https://registry.npmjs.org/", + "access": "public" + }, + "os": [ + "linux" + ], + "libc": [ + "glibc" + ] +} \ No newline at end of file diff --git a/tools/ui/node_modules/@oxc-parser/binding-linux-x64-gnu/parser.linux-x64-gnu.node b/tools/ui/node_modules/@oxc-parser/binding-linux-x64-gnu/parser.linux-x64-gnu.node new file mode 100644 index 0000000000000000000000000000000000000000..c1c03ea6035b9fd0fa5185628992abd1e7d54f74 --- /dev/null +++ b/tools/ui/node_modules/@oxc-parser/binding-linux-x64-gnu/parser.linux-x64-gnu.node @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:81e15bcf0e7afad538a73e0e2a07cf36fcfcaf5d09797bb036e95ae9f1f13dd8 +size 2592520 diff --git a/tools/ui/node_modules/@oxc-parser/binding-linux-x64-musl/README.md b/tools/ui/node_modules/@oxc-parser/binding-linux-x64-musl/README.md new file mode 100644 index 0000000000000000000000000000000000000000..b85576f10a94383209dc91b08ef3bac6d09ca48b --- /dev/null +++ b/tools/ui/node_modules/@oxc-parser/binding-linux-x64-musl/README.md @@ -0,0 +1,3 @@ +# `@oxc-parser/binding-linux-x64-musl` + +This is the **x86_64-unknown-linux-musl** binary for `@oxc-parser/binding` diff --git a/tools/ui/node_modules/@oxc-parser/binding-linux-x64-musl/package.json b/tools/ui/node_modules/@oxc-parser/binding-linux-x64-musl/package.json new file mode 100644 index 0000000000000000000000000000000000000000..a4d5c6a2e313375624786a15d93946b76d0c4c9c --- /dev/null +++ b/tools/ui/node_modules/@oxc-parser/binding-linux-x64-musl/package.json @@ -0,0 +1,42 @@ +{ + "name": "@oxc-parser/binding-linux-x64-musl", + "version": "0.127.0", + "cpu": [ + "x64" + ], + "main": "parser.linux-x64-musl.node", + "files": [ + "parser.linux-x64-musl.node" + ], + "description": "Oxc Parser Node API", + "keywords": [ + "ast", + "estree", + "javascript", + "oxc", + "parser", + "typescript" + ], + "author": "Boshen and oxc contributors", + "homepage": "https://oxc.rs/docs/guide/usage/parser", + "license": "MIT", + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/oxc-project/oxc.git", + "directory": "napi/parser" + }, + "bugs": "https://github.com/oxc-project/oxc/issues", + "publishConfig": { + "registry": "https://registry.npmjs.org/", + "access": "public" + }, + "os": [ + "linux" + ], + "libc": [ + "musl" + ] +} \ No newline at end of file diff --git a/tools/ui/node_modules/@oxc-parser/binding-linux-x64-musl/parser.linux-x64-musl.node b/tools/ui/node_modules/@oxc-parser/binding-linux-x64-musl/parser.linux-x64-musl.node new file mode 100644 index 0000000000000000000000000000000000000000..5fe1ffbfa789f14a36dd6ff9a5bee92d2db50767 --- /dev/null +++ b/tools/ui/node_modules/@oxc-parser/binding-linux-x64-musl/parser.linux-x64-musl.node @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:19460d59e393c51c59dc53ce40ac844cbc09fafbb155cfacd254877b6b8af0f1 +size 2580624 diff --git a/tools/ui/node_modules/@oxc-project/types/LICENSE b/tools/ui/node_modules/@oxc-project/types/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..444bffc00e5190817c0092e5e6fde787102977d2 --- /dev/null +++ b/tools/ui/node_modules/@oxc-project/types/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2024-present VoidZero Inc. & Contributors +Copyright (c) 2023 Boshen + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/tools/ui/node_modules/@oxc-project/types/README.md b/tools/ui/node_modules/@oxc-project/types/README.md new file mode 100644 index 0000000000000000000000000000000000000000..d5b248ac3fc1e8673b6fc55bda1c04e9a0464d02 --- /dev/null +++ b/tools/ui/node_modules/@oxc-project/types/README.md @@ -0,0 +1,3 @@ +# Oxc Types + +Typescript definitions for Oxc AST nodes. diff --git a/tools/ui/node_modules/@oxc-project/types/package.json b/tools/ui/node_modules/@oxc-project/types/package.json new file mode 100644 index 0000000000000000000000000000000000000000..f181226507da4a88116b0bd9b6e110235c823059 --- /dev/null +++ b/tools/ui/node_modules/@oxc-project/types/package.json @@ -0,0 +1,26 @@ +{ + "name": "@oxc-project/types", + "version": "0.127.0", + "description": "Types for Oxc AST nodes", + "keywords": [ + "AST", + "Parser" + ], + "homepage": "https://oxc.rs", + "bugs": "https://github.com/oxc-project/oxc/issues", + "license": "MIT", + "author": "Boshen and oxc contributors", + "repository": { + "type": "git", + "url": "git+https://github.com/oxc-project/oxc.git", + "directory": "npm/oxc-types" + }, + "funding": { + "url": "https://github.com/sponsors/Boshen" + }, + "files": [ + "types.d.ts" + ], + "type": "module", + "types": "types.d.ts" +} \ No newline at end of file diff --git a/tools/ui/node_modules/@oxc-project/types/types.d.ts b/tools/ui/node_modules/@oxc-project/types/types.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c94c1159e6302de98254582d9f3aeea5514bdd71 --- /dev/null +++ b/tools/ui/node_modules/@oxc-project/types/types.d.ts @@ -0,0 +1,1912 @@ +// Auto-generated code, DO NOT EDIT DIRECTLY! +// To edit this generated file you have to edit `tasks/ast_tools/src/generators/typescript.rs`. + +export interface Program extends Span { + type: "Program"; + body: Array; + sourceType: ModuleKind; + hashbang: Hashbang | null; + parent?: null; +} + +export type Expression = + | BooleanLiteral + | NullLiteral + | NumericLiteral + | BigIntLiteral + | RegExpLiteral + | StringLiteral + | TemplateLiteral + | IdentifierReference + | MetaProperty + | Super + | ArrayExpression + | ArrowFunctionExpression + | AssignmentExpression + | AwaitExpression + | BinaryExpression + | CallExpression + | ChainExpression + | Class + | ConditionalExpression + | Function + | ImportExpression + | LogicalExpression + | NewExpression + | ObjectExpression + | ParenthesizedExpression + | SequenceExpression + | TaggedTemplateExpression + | ThisExpression + | UnaryExpression + | UpdateExpression + | YieldExpression + | PrivateInExpression + | JSXElement + | JSXFragment + | TSAsExpression + | TSSatisfiesExpression + | TSTypeAssertion + | TSNonNullExpression + | TSInstantiationExpression + | V8IntrinsicExpression + | MemberExpression; + +export interface IdentifierName extends Span { + type: "Identifier"; + decorators?: []; + name: string; + optional?: false; + typeAnnotation?: null; + parent?: Node; +} + +export interface IdentifierReference extends Span { + type: "Identifier"; + decorators?: []; + name: string; + optional?: false; + typeAnnotation?: null; + parent?: Node; +} + +export interface BindingIdentifier extends Span { + type: "Identifier"; + decorators?: []; + name: string; + optional?: false; + typeAnnotation?: null; + parent?: Node; +} + +export interface LabelIdentifier extends Span { + type: "Identifier"; + decorators?: []; + name: string; + optional?: false; + typeAnnotation?: null; + parent?: Node; +} + +export interface ThisExpression extends Span { + type: "ThisExpression"; + parent?: Node; +} + +export interface ArrayExpression extends Span { + type: "ArrayExpression"; + elements: Array; + parent?: Node; +} + +export type ArrayExpressionElement = SpreadElement | null | Expression; + +export interface ObjectExpression extends Span { + type: "ObjectExpression"; + properties: Array; + parent?: Node; +} + +export type ObjectPropertyKind = ObjectProperty | SpreadElement; + +export interface ObjectProperty extends Span { + type: "Property"; + kind: PropertyKind; + key: PropertyKey; + value: Expression; + method: boolean; + shorthand: boolean; + computed: boolean; + optional?: false; + parent?: Node; +} + +export type PropertyKey = IdentifierName | PrivateIdentifier | Expression; + +export type PropertyKind = "init" | "get" | "set"; + +export interface TemplateLiteral extends Span { + type: "TemplateLiteral"; + quasis: Array; + expressions: Array; + parent?: Node; +} + +export interface TaggedTemplateExpression extends Span { + type: "TaggedTemplateExpression"; + tag: Expression; + typeArguments?: TSTypeParameterInstantiation | null; + quasi: TemplateLiteral; + parent?: Node; +} + +export interface TemplateElement extends Span { + type: "TemplateElement"; + value: TemplateElementValue; + tail: boolean; + parent?: Node; +} + +export interface TemplateElementValue { + raw: string; + cooked: string | null; +} + +export type MemberExpression = + | ComputedMemberExpression + | StaticMemberExpression + | PrivateFieldExpression; + +export interface ComputedMemberExpression extends Span { + type: "MemberExpression"; + object: Expression; + property: Expression; + optional: boolean; + computed: true; + parent?: Node; +} + +export interface StaticMemberExpression extends Span { + type: "MemberExpression"; + object: Expression; + property: IdentifierName; + optional: boolean; + computed: false; + parent?: Node; +} + +export interface PrivateFieldExpression extends Span { + type: "MemberExpression"; + object: Expression; + property: PrivateIdentifier; + optional: boolean; + computed: false; + parent?: Node; +} + +export interface CallExpression extends Span { + type: "CallExpression"; + callee: Expression; + typeArguments?: TSTypeParameterInstantiation | null; + arguments: Array; + optional: boolean; + parent?: Node; +} + +export interface NewExpression extends Span { + type: "NewExpression"; + callee: Expression; + typeArguments?: TSTypeParameterInstantiation | null; + arguments: Array; + parent?: Node; +} + +export interface MetaProperty extends Span { + type: "MetaProperty"; + meta: IdentifierName; + property: IdentifierName; + parent?: Node; +} + +export interface SpreadElement extends Span { + type: "SpreadElement"; + argument: Expression; + parent?: Node; +} + +export type Argument = SpreadElement | Expression; + +export interface UpdateExpression extends Span { + type: "UpdateExpression"; + operator: UpdateOperator; + prefix: boolean; + argument: SimpleAssignmentTarget; + parent?: Node; +} + +export interface UnaryExpression extends Span { + type: "UnaryExpression"; + operator: UnaryOperator; + argument: Expression; + prefix: true; + parent?: Node; +} + +export interface BinaryExpression extends Span { + type: "BinaryExpression"; + left: Expression; + operator: BinaryOperator; + right: Expression; + parent?: Node; +} + +export interface PrivateInExpression extends Span { + type: "BinaryExpression"; + left: PrivateIdentifier; + operator: "in"; + right: Expression; + parent?: Node; +} + +export interface LogicalExpression extends Span { + type: "LogicalExpression"; + left: Expression; + operator: LogicalOperator; + right: Expression; + parent?: Node; +} + +export interface ConditionalExpression extends Span { + type: "ConditionalExpression"; + test: Expression; + consequent: Expression; + alternate: Expression; + parent?: Node; +} + +export interface AssignmentExpression extends Span { + type: "AssignmentExpression"; + operator: AssignmentOperator; + left: AssignmentTarget; + right: Expression; + parent?: Node; +} + +export type AssignmentTarget = SimpleAssignmentTarget | AssignmentTargetPattern; + +export type SimpleAssignmentTarget = + | IdentifierReference + | TSAsExpression + | TSSatisfiesExpression + | TSNonNullExpression + | TSTypeAssertion + | MemberExpression; + +export type AssignmentTargetPattern = ArrayAssignmentTarget | ObjectAssignmentTarget; + +export interface ArrayAssignmentTarget extends Span { + type: "ArrayPattern"; + decorators?: []; + elements: Array; + optional?: false; + typeAnnotation?: null; + parent?: Node; +} + +export interface ObjectAssignmentTarget extends Span { + type: "ObjectPattern"; + decorators?: []; + properties: Array; + optional?: false; + typeAnnotation?: null; + parent?: Node; +} + +export interface AssignmentTargetRest extends Span { + type: "RestElement"; + decorators?: []; + argument: AssignmentTarget; + optional?: false; + typeAnnotation?: null; + value?: null; + parent?: Node; +} + +export type AssignmentTargetMaybeDefault = AssignmentTargetWithDefault | AssignmentTarget; + +export interface AssignmentTargetWithDefault extends Span { + type: "AssignmentPattern"; + decorators?: []; + left: AssignmentTarget; + right: Expression; + optional?: false; + typeAnnotation?: null; + parent?: Node; +} + +export type AssignmentTargetProperty = + | AssignmentTargetPropertyIdentifier + | AssignmentTargetPropertyProperty; + +export interface AssignmentTargetPropertyIdentifier extends Span { + type: "Property"; + kind: "init"; + key: IdentifierReference; + value: IdentifierReference | AssignmentTargetWithDefault; + method: false; + shorthand: true; + computed: false; + optional?: false; + parent?: Node; +} + +export interface AssignmentTargetPropertyProperty extends Span { + type: "Property"; + kind: "init"; + key: PropertyKey; + value: AssignmentTargetMaybeDefault; + method: false; + shorthand: false; + computed: boolean; + optional?: false; + parent?: Node; +} + +export interface SequenceExpression extends Span { + type: "SequenceExpression"; + expressions: Array; + parent?: Node; +} + +export interface Super extends Span { + type: "Super"; + parent?: Node; +} + +export interface AwaitExpression extends Span { + type: "AwaitExpression"; + argument: Expression; + parent?: Node; +} + +export interface ChainExpression extends Span { + type: "ChainExpression"; + expression: ChainElement; + parent?: Node; +} + +export type ChainElement = CallExpression | TSNonNullExpression | MemberExpression; + +export interface ParenthesizedExpression extends Span { + type: "ParenthesizedExpression"; + expression: Expression; + parent?: Node; +} + +export type Statement = + | BlockStatement + | BreakStatement + | ContinueStatement + | DebuggerStatement + | DoWhileStatement + | EmptyStatement + | ExpressionStatement + | ForInStatement + | ForOfStatement + | ForStatement + | IfStatement + | LabeledStatement + | ReturnStatement + | SwitchStatement + | ThrowStatement + | TryStatement + | WhileStatement + | WithStatement + | Declaration + | ModuleDeclaration; + +export interface Directive extends Span { + type: "ExpressionStatement"; + expression: StringLiteral; + directive: string; + parent?: Node; +} + +export interface Hashbang extends Span { + type: "Hashbang"; + value: string; + parent?: Node; +} + +export interface BlockStatement extends Span { + type: "BlockStatement"; + body: Array; + parent?: Node; +} + +export type Declaration = + | VariableDeclaration + | Function + | Class + | TSTypeAliasDeclaration + | TSInterfaceDeclaration + | TSEnumDeclaration + | TSModuleDeclaration + | TSGlobalDeclaration + | TSImportEqualsDeclaration; + +export interface VariableDeclaration extends Span { + type: "VariableDeclaration"; + kind: VariableDeclarationKind; + declarations: Array; + declare?: boolean; + parent?: Node; +} + +export type VariableDeclarationKind = "var" | "let" | "const" | "using" | "await using"; + +export interface VariableDeclarator extends Span { + type: "VariableDeclarator"; + id: BindingPattern; + init: Expression | null; + definite?: boolean; + parent?: Node; +} + +export interface EmptyStatement extends Span { + type: "EmptyStatement"; + parent?: Node; +} + +export interface ExpressionStatement extends Span { + type: "ExpressionStatement"; + expression: Expression; + directive?: string | null; + parent?: Node; +} + +export interface IfStatement extends Span { + type: "IfStatement"; + test: Expression; + consequent: Statement; + alternate: Statement | null; + parent?: Node; +} + +export interface DoWhileStatement extends Span { + type: "DoWhileStatement"; + body: Statement; + test: Expression; + parent?: Node; +} + +export interface WhileStatement extends Span { + type: "WhileStatement"; + test: Expression; + body: Statement; + parent?: Node; +} + +export interface ForStatement extends Span { + type: "ForStatement"; + init: ForStatementInit | null; + test: Expression | null; + update: Expression | null; + body: Statement; + parent?: Node; +} + +export type ForStatementInit = VariableDeclaration | Expression; + +export interface ForInStatement extends Span { + type: "ForInStatement"; + left: ForStatementLeft; + right: Expression; + body: Statement; + parent?: Node; +} + +export type ForStatementLeft = VariableDeclaration | AssignmentTarget; + +export interface ForOfStatement extends Span { + type: "ForOfStatement"; + await: boolean; + left: ForStatementLeft; + right: Expression; + body: Statement; + parent?: Node; +} + +export interface ContinueStatement extends Span { + type: "ContinueStatement"; + label: LabelIdentifier | null; + parent?: Node; +} + +export interface BreakStatement extends Span { + type: "BreakStatement"; + label: LabelIdentifier | null; + parent?: Node; +} + +export interface ReturnStatement extends Span { + type: "ReturnStatement"; + argument: Expression | null; + parent?: Node; +} + +export interface WithStatement extends Span { + type: "WithStatement"; + object: Expression; + body: Statement; + parent?: Node; +} + +export interface SwitchStatement extends Span { + type: "SwitchStatement"; + discriminant: Expression; + cases: Array; + parent?: Node; +} + +export interface SwitchCase extends Span { + type: "SwitchCase"; + test: Expression | null; + consequent: Array; + parent?: Node; +} + +export interface LabeledStatement extends Span { + type: "LabeledStatement"; + label: LabelIdentifier; + body: Statement; + parent?: Node; +} + +export interface ThrowStatement extends Span { + type: "ThrowStatement"; + argument: Expression; + parent?: Node; +} + +export interface TryStatement extends Span { + type: "TryStatement"; + block: BlockStatement; + handler: CatchClause | null; + finalizer: BlockStatement | null; + parent?: Node; +} + +export interface CatchClause extends Span { + type: "CatchClause"; + param: BindingPattern | null; + body: BlockStatement; + parent?: Node; +} + +export interface DebuggerStatement extends Span { + type: "DebuggerStatement"; + parent?: Node; +} + +export type BindingPattern = BindingIdentifier | ObjectPattern | ArrayPattern | AssignmentPattern; + +export interface AssignmentPattern extends Span { + type: "AssignmentPattern"; + decorators?: []; + left: BindingPattern; + right: Expression; + optional?: false; + typeAnnotation?: null; + parent?: Node; +} + +export interface ObjectPattern extends Span { + type: "ObjectPattern"; + decorators?: []; + properties: Array; + optional?: false; + typeAnnotation?: null; + parent?: Node; +} + +export interface BindingProperty extends Span { + type: "Property"; + kind: "init"; + key: PropertyKey; + value: BindingPattern; + method: false; + shorthand: boolean; + computed: boolean; + optional?: false; + parent?: Node; +} + +export interface ArrayPattern extends Span { + type: "ArrayPattern"; + decorators?: []; + elements: Array; + optional?: false; + typeAnnotation?: null; + parent?: Node; +} + +export interface BindingRestElement extends Span { + type: "RestElement"; + decorators?: []; + argument: BindingPattern; + optional?: false; + typeAnnotation?: null; + value?: null; + parent?: Node; +} + +export interface Function extends Span { + type: FunctionType; + id: BindingIdentifier | null; + generator: boolean; + async: boolean; + declare?: boolean; + typeParameters?: TSTypeParameterDeclaration | null; + params: ParamPattern[]; + returnType?: TSTypeAnnotation | null; + body: FunctionBody | null; + expression: false; + parent?: Node; +} + +export type ParamPattern = FormalParameter | TSParameterProperty | FormalParameterRest; + +export type FunctionType = + | "FunctionDeclaration" + | "FunctionExpression" + | "TSDeclareFunction" + | "TSEmptyBodyFunctionExpression"; + +export interface FormalParameterRest extends Span { + type: "RestElement"; + argument: BindingPattern; + decorators?: []; + optional?: boolean; + typeAnnotation?: TSTypeAnnotation | null; + value?: null; + parent?: Node; +} + +export type FormalParameter = { + decorators?: Array; +} & BindingPattern; + +export interface TSParameterProperty extends Span { + type: "TSParameterProperty"; + accessibility: TSAccessibility | null; + decorators: Array; + override: boolean; + parameter: FormalParameter; + readonly: boolean; + static: boolean; + parent?: Node; +} + +export interface FunctionBody extends Span { + type: "BlockStatement"; + body: Array; + parent?: Node; +} + +export interface ArrowFunctionExpression extends Span { + type: "ArrowFunctionExpression"; + expression: boolean; + async: boolean; + typeParameters?: TSTypeParameterDeclaration | null; + params: ParamPattern[]; + returnType?: TSTypeAnnotation | null; + body: FunctionBody | Expression; + id: null; + generator: false; + parent?: Node; +} + +export interface YieldExpression extends Span { + type: "YieldExpression"; + delegate: boolean; + argument: Expression | null; + parent?: Node; +} + +export interface Class extends Span { + type: ClassType; + decorators: Array; + id: BindingIdentifier | null; + typeParameters?: TSTypeParameterDeclaration | null; + superClass: Expression | null; + superTypeArguments?: TSTypeParameterInstantiation | null; + implements?: Array; + body: ClassBody; + abstract?: boolean; + declare?: boolean; + parent?: Node; +} + +export type ClassType = "ClassDeclaration" | "ClassExpression"; + +export interface ClassBody extends Span { + type: "ClassBody"; + body: Array; + parent?: Node; +} + +export type ClassElement = + | StaticBlock + | MethodDefinition + | PropertyDefinition + | AccessorProperty + | TSIndexSignature; + +export interface MethodDefinition extends Span { + type: MethodDefinitionType; + decorators: Array; + key: PropertyKey; + value: Function; + kind: MethodDefinitionKind; + computed: boolean; + static: boolean; + override?: boolean; + optional?: boolean; + accessibility?: TSAccessibility | null; + parent?: Node; +} + +export type MethodDefinitionType = "MethodDefinition" | "TSAbstractMethodDefinition"; + +export interface PropertyDefinition extends Span { + type: PropertyDefinitionType; + decorators: Array; + key: PropertyKey; + typeAnnotation?: TSTypeAnnotation | null; + value: Expression | null; + computed: boolean; + static: boolean; + declare?: boolean; + override?: boolean; + optional?: boolean; + definite?: boolean; + readonly?: boolean; + accessibility?: TSAccessibility | null; + parent?: Node; +} + +export type PropertyDefinitionType = "PropertyDefinition" | "TSAbstractPropertyDefinition"; + +export type MethodDefinitionKind = "constructor" | "method" | "get" | "set"; + +export interface PrivateIdentifier extends Span { + type: "PrivateIdentifier"; + name: string; + parent?: Node; +} + +export interface StaticBlock extends Span { + type: "StaticBlock"; + body: Array; + parent?: Node; +} + +export type ModuleDeclaration = + | ImportDeclaration + | ExportAllDeclaration + | ExportDefaultDeclaration + | ExportNamedDeclaration + | TSExportAssignment + | TSNamespaceExportDeclaration; + +export type AccessorPropertyType = "AccessorProperty" | "TSAbstractAccessorProperty"; + +export interface AccessorProperty extends Span { + type: AccessorPropertyType; + decorators: Array; + key: PropertyKey; + typeAnnotation?: TSTypeAnnotation | null; + value: Expression | null; + computed: boolean; + static: boolean; + override?: boolean; + definite?: boolean; + accessibility?: TSAccessibility | null; + declare?: false; + optional?: false; + readonly?: false; + parent?: Node; +} + +export interface ImportExpression extends Span { + type: "ImportExpression"; + source: Expression; + options: Expression | null; + phase: ImportPhase | null; + parent?: Node; +} + +export interface ImportDeclaration extends Span { + type: "ImportDeclaration"; + specifiers: Array; + source: StringLiteral; + phase: ImportPhase | null; + attributes: Array; + importKind?: ImportOrExportKind; + parent?: Node; +} + +export type ImportPhase = "source" | "defer"; + +export type ImportDeclarationSpecifier = + | ImportSpecifier + | ImportDefaultSpecifier + | ImportNamespaceSpecifier; + +export interface ImportSpecifier extends Span { + type: "ImportSpecifier"; + imported: ModuleExportName; + local: BindingIdentifier; + importKind?: ImportOrExportKind; + parent?: Node; +} + +export interface ImportDefaultSpecifier extends Span { + type: "ImportDefaultSpecifier"; + local: BindingIdentifier; + parent?: Node; +} + +export interface ImportNamespaceSpecifier extends Span { + type: "ImportNamespaceSpecifier"; + local: BindingIdentifier; + parent?: Node; +} + +export interface ImportAttribute extends Span { + type: "ImportAttribute"; + key: ImportAttributeKey; + value: StringLiteral; + parent?: Node; +} + +export type ImportAttributeKey = IdentifierName | StringLiteral; + +export interface ExportNamedDeclaration extends Span { + type: "ExportNamedDeclaration"; + declaration: Declaration | null; + specifiers: Array; + source: StringLiteral | null; + exportKind?: ImportOrExportKind; + attributes: Array; + parent?: Node; +} + +export interface ExportDefaultDeclaration extends Span { + type: "ExportDefaultDeclaration"; + declaration: ExportDefaultDeclarationKind; + exportKind?: "value"; + parent?: Node; +} + +export interface ExportAllDeclaration extends Span { + type: "ExportAllDeclaration"; + exported: ModuleExportName | null; + source: StringLiteral; + attributes: Array; + exportKind?: ImportOrExportKind; + parent?: Node; +} + +export interface ExportSpecifier extends Span { + type: "ExportSpecifier"; + local: ModuleExportName; + exported: ModuleExportName; + exportKind?: ImportOrExportKind; + parent?: Node; +} + +export type ExportDefaultDeclarationKind = Function | Class | TSInterfaceDeclaration | Expression; + +export type ModuleExportName = IdentifierName | IdentifierReference | StringLiteral; + +export interface V8IntrinsicExpression extends Span { + type: "V8IntrinsicExpression"; + name: IdentifierName; + arguments: Array; + parent?: Node; +} + +export interface BooleanLiteral extends Span { + type: "Literal"; + value: boolean; + raw: string | null; + parent?: Node; +} + +export interface NullLiteral extends Span { + type: "Literal"; + value: null; + raw: "null" | null; + parent?: Node; +} + +export interface NumericLiteral extends Span { + type: "Literal"; + value: number; + raw: string | null; + parent?: Node; +} + +export interface StringLiteral extends Span { + type: "Literal"; + value: string; + raw: string | null; + parent?: Node; +} + +export interface BigIntLiteral extends Span { + type: "Literal"; + value: bigint; + raw: string | null; + bigint: string; + parent?: Node; +} + +export interface RegExpLiteral extends Span { + type: "Literal"; + value: RegExp | null; + raw: string | null; + regex: { pattern: string; flags: string }; + parent?: Node; +} + +export interface JSXElement extends Span { + type: "JSXElement"; + openingElement: JSXOpeningElement; + children: Array; + closingElement: JSXClosingElement | null; + parent?: Node; +} + +export interface JSXOpeningElement extends Span { + type: "JSXOpeningElement"; + name: JSXElementName; + typeArguments?: TSTypeParameterInstantiation | null; + attributes: Array; + selfClosing: boolean; + parent?: Node; +} + +export interface JSXClosingElement extends Span { + type: "JSXClosingElement"; + name: JSXElementName; + parent?: Node; +} + +export interface JSXFragment extends Span { + type: "JSXFragment"; + openingFragment: JSXOpeningFragment; + children: Array; + closingFragment: JSXClosingFragment; + parent?: Node; +} + +export interface JSXOpeningFragment extends Span { + type: "JSXOpeningFragment"; + attributes?: []; + selfClosing?: false; + parent?: Node; +} + +export interface JSXClosingFragment extends Span { + type: "JSXClosingFragment"; + parent?: Node; +} + +export type JSXElementName = JSXIdentifier | JSXNamespacedName | JSXMemberExpression; + +export interface JSXNamespacedName extends Span { + type: "JSXNamespacedName"; + namespace: JSXIdentifier; + name: JSXIdentifier; + parent?: Node; +} + +export interface JSXMemberExpression extends Span { + type: "JSXMemberExpression"; + object: JSXMemberExpressionObject; + property: JSXIdentifier; + parent?: Node; +} + +export type JSXMemberExpressionObject = JSXIdentifier | JSXMemberExpression; + +export interface JSXExpressionContainer extends Span { + type: "JSXExpressionContainer"; + expression: JSXExpression; + parent?: Node; +} + +export type JSXExpression = JSXEmptyExpression | Expression; + +export interface JSXEmptyExpression extends Span { + type: "JSXEmptyExpression"; + parent?: Node; +} + +export type JSXAttributeItem = JSXAttribute | JSXSpreadAttribute; + +export interface JSXAttribute extends Span { + type: "JSXAttribute"; + name: JSXAttributeName; + value: JSXAttributeValue | null; + parent?: Node; +} + +export interface JSXSpreadAttribute extends Span { + type: "JSXSpreadAttribute"; + argument: Expression; + parent?: Node; +} + +export type JSXAttributeName = JSXIdentifier | JSXNamespacedName; + +export type JSXAttributeValue = StringLiteral | JSXExpressionContainer | JSXElement | JSXFragment; + +export interface JSXIdentifier extends Span { + type: "JSXIdentifier"; + name: string; + parent?: Node; +} + +export type JSXChild = JSXText | JSXElement | JSXFragment | JSXExpressionContainer | JSXSpreadChild; + +export interface JSXSpreadChild extends Span { + type: "JSXSpreadChild"; + expression: Expression; + parent?: Node; +} + +export interface JSXText extends Span { + type: "JSXText"; + value: string; + raw: string | null; + parent?: Node; +} + +export interface TSThisParameter extends Span { + type: "Identifier"; + decorators: []; + name: "this"; + optional: false; + typeAnnotation: TSTypeAnnotation | null; + parent?: Node; +} + +export interface TSEnumDeclaration extends Span { + type: "TSEnumDeclaration"; + id: BindingIdentifier; + body: TSEnumBody; + const: boolean; + declare: boolean; + parent?: Node; +} + +export interface TSEnumBody extends Span { + type: "TSEnumBody"; + members: Array; + parent?: Node; +} + +export interface TSEnumMember extends Span { + type: "TSEnumMember"; + id: TSEnumMemberName; + initializer: Expression | null; + computed: boolean; + parent?: Node; +} + +export type TSEnumMemberName = IdentifierName | StringLiteral | TemplateLiteral; + +export interface TSTypeAnnotation extends Span { + type: "TSTypeAnnotation"; + typeAnnotation: TSType; + parent?: Node; +} + +export interface TSLiteralType extends Span { + type: "TSLiteralType"; + literal: TSLiteral; + parent?: Node; +} + +export type TSLiteral = + | BooleanLiteral + | NumericLiteral + | BigIntLiteral + | StringLiteral + | TemplateLiteral + | UnaryExpression; + +export type TSType = + | TSAnyKeyword + | TSBigIntKeyword + | TSBooleanKeyword + | TSIntrinsicKeyword + | TSNeverKeyword + | TSNullKeyword + | TSNumberKeyword + | TSObjectKeyword + | TSStringKeyword + | TSSymbolKeyword + | TSUndefinedKeyword + | TSUnknownKeyword + | TSVoidKeyword + | TSArrayType + | TSConditionalType + | TSConstructorType + | TSFunctionType + | TSImportType + | TSIndexedAccessType + | TSInferType + | TSIntersectionType + | TSLiteralType + | TSMappedType + | TSNamedTupleMember + | TSTemplateLiteralType + | TSThisType + | TSTupleType + | TSTypeLiteral + | TSTypeOperator + | TSTypePredicate + | TSTypeQuery + | TSTypeReference + | TSUnionType + | TSParenthesizedType + | JSDocNullableType + | JSDocNonNullableType + | JSDocUnknownType; + +export interface TSConditionalType extends Span { + type: "TSConditionalType"; + checkType: TSType; + extendsType: TSType; + trueType: TSType; + falseType: TSType; + parent?: Node; +} + +export interface TSUnionType extends Span { + type: "TSUnionType"; + types: Array; + parent?: Node; +} + +export interface TSIntersectionType extends Span { + type: "TSIntersectionType"; + types: Array; + parent?: Node; +} + +export interface TSParenthesizedType extends Span { + type: "TSParenthesizedType"; + typeAnnotation: TSType; + parent?: Node; +} + +export interface TSTypeOperator extends Span { + type: "TSTypeOperator"; + operator: TSTypeOperatorOperator; + typeAnnotation: TSType; + parent?: Node; +} + +export type TSTypeOperatorOperator = "keyof" | "unique" | "readonly"; + +export interface TSArrayType extends Span { + type: "TSArrayType"; + elementType: TSType; + parent?: Node; +} + +export interface TSIndexedAccessType extends Span { + type: "TSIndexedAccessType"; + objectType: TSType; + indexType: TSType; + parent?: Node; +} + +export interface TSTupleType extends Span { + type: "TSTupleType"; + elementTypes: Array; + parent?: Node; +} + +export interface TSNamedTupleMember extends Span { + type: "TSNamedTupleMember"; + label: IdentifierName; + elementType: TSTupleElement; + optional: boolean; + parent?: Node; +} + +export interface TSOptionalType extends Span { + type: "TSOptionalType"; + typeAnnotation: TSType; + parent?: Node; +} + +export interface TSRestType extends Span { + type: "TSRestType"; + typeAnnotation: TSType; + parent?: Node; +} + +export type TSTupleElement = TSOptionalType | TSRestType | TSType; + +export interface TSAnyKeyword extends Span { + type: "TSAnyKeyword"; + parent?: Node; +} + +export interface TSStringKeyword extends Span { + type: "TSStringKeyword"; + parent?: Node; +} + +export interface TSBooleanKeyword extends Span { + type: "TSBooleanKeyword"; + parent?: Node; +} + +export interface TSNumberKeyword extends Span { + type: "TSNumberKeyword"; + parent?: Node; +} + +export interface TSNeverKeyword extends Span { + type: "TSNeverKeyword"; + parent?: Node; +} + +export interface TSIntrinsicKeyword extends Span { + type: "TSIntrinsicKeyword"; + parent?: Node; +} + +export interface TSUnknownKeyword extends Span { + type: "TSUnknownKeyword"; + parent?: Node; +} + +export interface TSNullKeyword extends Span { + type: "TSNullKeyword"; + parent?: Node; +} + +export interface TSUndefinedKeyword extends Span { + type: "TSUndefinedKeyword"; + parent?: Node; +} + +export interface TSVoidKeyword extends Span { + type: "TSVoidKeyword"; + parent?: Node; +} + +export interface TSSymbolKeyword extends Span { + type: "TSSymbolKeyword"; + parent?: Node; +} + +export interface TSThisType extends Span { + type: "TSThisType"; + parent?: Node; +} + +export interface TSObjectKeyword extends Span { + type: "TSObjectKeyword"; + parent?: Node; +} + +export interface TSBigIntKeyword extends Span { + type: "TSBigIntKeyword"; + parent?: Node; +} + +export interface TSTypeReference extends Span { + type: "TSTypeReference"; + typeName: TSTypeName; + typeArguments: TSTypeParameterInstantiation | null; + parent?: Node; +} + +export type TSTypeName = IdentifierReference | TSQualifiedName | ThisExpression; + +export interface TSQualifiedName extends Span { + type: "TSQualifiedName"; + left: TSTypeName; + right: IdentifierName; + parent?: Node; +} + +export interface TSTypeParameterInstantiation extends Span { + type: "TSTypeParameterInstantiation"; + params: Array; + parent?: Node; +} + +export interface TSTypeParameter extends Span { + type: "TSTypeParameter"; + name: BindingIdentifier; + constraint: TSType | null; + default: TSType | null; + in: boolean; + out: boolean; + const: boolean; + parent?: Node; +} + +export interface TSTypeParameterDeclaration extends Span { + type: "TSTypeParameterDeclaration"; + params: Array; + parent?: Node; +} + +export interface TSTypeAliasDeclaration extends Span { + type: "TSTypeAliasDeclaration"; + id: BindingIdentifier; + typeParameters: TSTypeParameterDeclaration | null; + typeAnnotation: TSType; + declare: boolean; + parent?: Node; +} + +export type TSAccessibility = "private" | "protected" | "public"; + +export interface TSClassImplements extends Span { + type: "TSClassImplements"; + expression: IdentifierReference | ThisExpression | MemberExpression; + typeArguments: TSTypeParameterInstantiation | null; + parent?: Node; +} + +export interface TSInterfaceDeclaration extends Span { + type: "TSInterfaceDeclaration"; + id: BindingIdentifier; + typeParameters: TSTypeParameterDeclaration | null; + extends: Array; + body: TSInterfaceBody; + declare: boolean; + parent?: Node; +} + +export interface TSInterfaceBody extends Span { + type: "TSInterfaceBody"; + body: Array; + parent?: Node; +} + +export interface TSPropertySignature extends Span { + type: "TSPropertySignature"; + computed: boolean; + optional: boolean; + readonly: boolean; + key: PropertyKey; + typeAnnotation: TSTypeAnnotation | null; + accessibility: null; + static: false; + parent?: Node; +} + +export type TSSignature = + | TSIndexSignature + | TSPropertySignature + | TSCallSignatureDeclaration + | TSConstructSignatureDeclaration + | TSMethodSignature; + +export interface TSIndexSignature extends Span { + type: "TSIndexSignature"; + parameters: Array; + typeAnnotation: TSTypeAnnotation; + readonly: boolean; + static: boolean; + accessibility: null; + parent?: Node; +} + +export interface TSCallSignatureDeclaration extends Span { + type: "TSCallSignatureDeclaration"; + typeParameters: TSTypeParameterDeclaration | null; + params: ParamPattern[]; + returnType: TSTypeAnnotation | null; + parent?: Node; +} + +export type TSMethodSignatureKind = "method" | "get" | "set"; + +export interface TSMethodSignature extends Span { + type: "TSMethodSignature"; + key: PropertyKey; + computed: boolean; + optional: boolean; + kind: TSMethodSignatureKind; + typeParameters: TSTypeParameterDeclaration | null; + params: ParamPattern[]; + returnType: TSTypeAnnotation | null; + accessibility: null; + readonly: false; + static: false; + parent?: Node; +} + +export interface TSConstructSignatureDeclaration extends Span { + type: "TSConstructSignatureDeclaration"; + typeParameters: TSTypeParameterDeclaration | null; + params: ParamPattern[]; + returnType: TSTypeAnnotation | null; + parent?: Node; +} + +export interface TSIndexSignatureName extends Span { + type: "Identifier"; + decorators: []; + name: string; + optional: false; + typeAnnotation: TSTypeAnnotation; + parent?: Node; +} + +export interface TSInterfaceHeritage extends Span { + type: "TSInterfaceHeritage"; + expression: Expression; + typeArguments: TSTypeParameterInstantiation | null; + parent?: Node; +} + +export interface TSTypePredicate extends Span { + type: "TSTypePredicate"; + parameterName: TSTypePredicateName; + asserts: boolean; + typeAnnotation: TSTypeAnnotation | null; + parent?: Node; +} + +export type TSTypePredicateName = IdentifierName | TSThisType; + +export interface TSModuleDeclaration extends Span { + type: "TSModuleDeclaration"; + id: BindingIdentifier | StringLiteral | TSQualifiedName; + body: TSModuleBlock | null; + kind: TSModuleDeclarationKind; + declare: boolean; + global: false; + parent?: Node; +} + +export type TSModuleDeclarationKind = "module" | "namespace"; + +export interface TSGlobalDeclaration extends Span { + type: "TSModuleDeclaration"; + id: IdentifierName; + body: TSModuleBlock; + kind: "global"; + declare: boolean; + global: true; + parent?: Node; +} + +export interface TSModuleBlock extends Span { + type: "TSModuleBlock"; + body: Array; + parent?: Node; +} + +export interface TSTypeLiteral extends Span { + type: "TSTypeLiteral"; + members: Array; + parent?: Node; +} + +export interface TSInferType extends Span { + type: "TSInferType"; + typeParameter: TSTypeParameter; + parent?: Node; +} + +export interface TSTypeQuery extends Span { + type: "TSTypeQuery"; + exprName: TSTypeQueryExprName; + typeArguments: TSTypeParameterInstantiation | null; + parent?: Node; +} + +export type TSTypeQueryExprName = TSImportType | TSTypeName; + +export interface TSImportType extends Span { + type: "TSImportType"; + source: StringLiteral; + options: ObjectExpression | null; + qualifier: TSImportTypeQualifier | null; + typeArguments: TSTypeParameterInstantiation | null; + parent?: Node; +} + +export type TSImportTypeQualifier = IdentifierName | TSImportTypeQualifiedName; + +export interface TSImportTypeQualifiedName extends Span { + type: "TSQualifiedName"; + left: TSImportTypeQualifier; + right: IdentifierName; + parent?: Node; +} + +export interface TSFunctionType extends Span { + type: "TSFunctionType"; + typeParameters: TSTypeParameterDeclaration | null; + params: ParamPattern[]; + returnType: TSTypeAnnotation; + parent?: Node; +} + +export interface TSConstructorType extends Span { + type: "TSConstructorType"; + abstract: boolean; + typeParameters: TSTypeParameterDeclaration | null; + params: ParamPattern[]; + returnType: TSTypeAnnotation; + parent?: Node; +} + +export interface TSMappedType extends Span { + type: "TSMappedType"; + key: BindingIdentifier; + constraint: TSType; + nameType: TSType | null; + typeAnnotation: TSType | null; + optional: TSMappedTypeModifierOperator | false; + readonly: TSMappedTypeModifierOperator | null; + parent?: Node; +} + +export type TSMappedTypeModifierOperator = true | "+" | "-"; + +export interface TSTemplateLiteralType extends Span { + type: "TSTemplateLiteralType"; + quasis: Array; + types: Array; + parent?: Node; +} + +export interface TSAsExpression extends Span { + type: "TSAsExpression"; + expression: Expression; + typeAnnotation: TSType; + parent?: Node; +} + +export interface TSSatisfiesExpression extends Span { + type: "TSSatisfiesExpression"; + expression: Expression; + typeAnnotation: TSType; + parent?: Node; +} + +export interface TSTypeAssertion extends Span { + type: "TSTypeAssertion"; + typeAnnotation: TSType; + expression: Expression; + parent?: Node; +} + +export interface TSImportEqualsDeclaration extends Span { + type: "TSImportEqualsDeclaration"; + id: BindingIdentifier; + moduleReference: TSModuleReference; + importKind: ImportOrExportKind; + parent?: Node; +} + +export type TSModuleReference = TSExternalModuleReference | IdentifierReference | TSQualifiedName; + +export interface TSExternalModuleReference extends Span { + type: "TSExternalModuleReference"; + expression: StringLiteral; + parent?: Node; +} + +export interface TSNonNullExpression extends Span { + type: "TSNonNullExpression"; + expression: Expression; + parent?: Node; +} + +export interface Decorator extends Span { + type: "Decorator"; + expression: Expression; + parent?: Node; +} + +export interface TSExportAssignment extends Span { + type: "TSExportAssignment"; + expression: Expression; + parent?: Node; +} + +export interface TSNamespaceExportDeclaration extends Span { + type: "TSNamespaceExportDeclaration"; + id: IdentifierName; + parent?: Node; +} + +export interface TSInstantiationExpression extends Span { + type: "TSInstantiationExpression"; + expression: Expression; + typeArguments: TSTypeParameterInstantiation; + parent?: Node; +} + +export type ImportOrExportKind = "value" | "type"; + +export interface JSDocNullableType extends Span { + type: "TSJSDocNullableType"; + typeAnnotation: TSType; + postfix: boolean; + parent?: Node; +} + +export interface JSDocNonNullableType extends Span { + type: "TSJSDocNonNullableType"; + typeAnnotation: TSType; + postfix: boolean; + parent?: Node; +} + +export interface JSDocUnknownType extends Span { + type: "TSJSDocUnknownType"; + parent?: Node; +} + +export type ModuleKind = "script" | "module" | "commonjs"; + +export interface Span { + start: number; + end: number; + range?: [number, number]; +} + +export type AssignmentOperator = + | "=" + | "+=" + | "-=" + | "*=" + | "/=" + | "%=" + | "**=" + | "<<=" + | ">>=" + | ">>>=" + | "|=" + | "^=" + | "&=" + | "||=" + | "&&=" + | "??="; + +export type BinaryOperator = + | "==" + | "!=" + | "===" + | "!==" + | "<" + | "<=" + | ">" + | ">=" + | "+" + | "-" + | "*" + | "/" + | "%" + | "**" + | "<<" + | ">>" + | ">>>" + | "|" + | "^" + | "&" + | "in" + | "instanceof"; + +export type LogicalOperator = "||" | "&&" | "??"; + +export type UnaryOperator = "+" | "-" | "!" | "~" | "typeof" | "void" | "delete"; + +export type UpdateOperator = "++" | "--"; + +export type Node = + | Program + | IdentifierName + | IdentifierReference + | BindingIdentifier + | LabelIdentifier + | ThisExpression + | ArrayExpression + | ObjectExpression + | ObjectProperty + | TemplateLiteral + | TaggedTemplateExpression + | TemplateElement + | ComputedMemberExpression + | StaticMemberExpression + | PrivateFieldExpression + | CallExpression + | NewExpression + | MetaProperty + | SpreadElement + | UpdateExpression + | UnaryExpression + | BinaryExpression + | PrivateInExpression + | LogicalExpression + | ConditionalExpression + | AssignmentExpression + | ArrayAssignmentTarget + | ObjectAssignmentTarget + | AssignmentTargetRest + | AssignmentTargetWithDefault + | AssignmentTargetPropertyIdentifier + | AssignmentTargetPropertyProperty + | SequenceExpression + | Super + | AwaitExpression + | ChainExpression + | ParenthesizedExpression + | Directive + | Hashbang + | BlockStatement + | VariableDeclaration + | VariableDeclarator + | EmptyStatement + | ExpressionStatement + | IfStatement + | DoWhileStatement + | WhileStatement + | ForStatement + | ForInStatement + | ForOfStatement + | ContinueStatement + | BreakStatement + | ReturnStatement + | WithStatement + | SwitchStatement + | SwitchCase + | LabeledStatement + | ThrowStatement + | TryStatement + | CatchClause + | DebuggerStatement + | AssignmentPattern + | ObjectPattern + | BindingProperty + | ArrayPattern + | BindingRestElement + | Function + | FunctionBody + | ArrowFunctionExpression + | YieldExpression + | Class + | ClassBody + | MethodDefinition + | PropertyDefinition + | PrivateIdentifier + | StaticBlock + | AccessorProperty + | ImportExpression + | ImportDeclaration + | ImportSpecifier + | ImportDefaultSpecifier + | ImportNamespaceSpecifier + | ImportAttribute + | ExportNamedDeclaration + | ExportDefaultDeclaration + | ExportAllDeclaration + | ExportSpecifier + | V8IntrinsicExpression + | BooleanLiteral + | NullLiteral + | NumericLiteral + | StringLiteral + | BigIntLiteral + | RegExpLiteral + | JSXElement + | JSXOpeningElement + | JSXClosingElement + | JSXFragment + | JSXOpeningFragment + | JSXClosingFragment + | JSXNamespacedName + | JSXMemberExpression + | JSXExpressionContainer + | JSXEmptyExpression + | JSXAttribute + | JSXSpreadAttribute + | JSXIdentifier + | JSXSpreadChild + | JSXText + | TSThisParameter + | TSEnumDeclaration + | TSEnumBody + | TSEnumMember + | TSTypeAnnotation + | TSLiteralType + | TSConditionalType + | TSUnionType + | TSIntersectionType + | TSParenthesizedType + | TSTypeOperator + | TSArrayType + | TSIndexedAccessType + | TSTupleType + | TSNamedTupleMember + | TSOptionalType + | TSRestType + | TSAnyKeyword + | TSStringKeyword + | TSBooleanKeyword + | TSNumberKeyword + | TSNeverKeyword + | TSIntrinsicKeyword + | TSUnknownKeyword + | TSNullKeyword + | TSUndefinedKeyword + | TSVoidKeyword + | TSSymbolKeyword + | TSThisType + | TSObjectKeyword + | TSBigIntKeyword + | TSTypeReference + | TSQualifiedName + | TSTypeParameterInstantiation + | TSTypeParameter + | TSTypeParameterDeclaration + | TSTypeAliasDeclaration + | TSClassImplements + | TSInterfaceDeclaration + | TSInterfaceBody + | TSPropertySignature + | TSIndexSignature + | TSCallSignatureDeclaration + | TSMethodSignature + | TSConstructSignatureDeclaration + | TSIndexSignatureName + | TSInterfaceHeritage + | TSTypePredicate + | TSModuleDeclaration + | TSGlobalDeclaration + | TSModuleBlock + | TSTypeLiteral + | TSInferType + | TSTypeQuery + | TSImportType + | TSImportTypeQualifiedName + | TSFunctionType + | TSConstructorType + | TSMappedType + | TSTemplateLiteralType + | TSAsExpression + | TSSatisfiesExpression + | TSTypeAssertion + | TSImportEqualsDeclaration + | TSExternalModuleReference + | TSNonNullExpression + | Decorator + | TSExportAssignment + | TSNamespaceExportDeclaration + | TSInstantiationExpression + | JSDocNullableType + | JSDocNonNullableType + | JSDocUnknownType + | ParamPattern; diff --git a/tools/ui/node_modules/@oxc-resolver/binding-linux-x64-gnu/README.md b/tools/ui/node_modules/@oxc-resolver/binding-linux-x64-gnu/README.md new file mode 100644 index 0000000000000000000000000000000000000000..5e2b7cce40bbfdeabdf9089f93f7be28100eba53 --- /dev/null +++ b/tools/ui/node_modules/@oxc-resolver/binding-linux-x64-gnu/README.md @@ -0,0 +1,3 @@ +# `@oxc-resolver/binding-linux-x64-gnu` + +This is the **x86_64-unknown-linux-gnu** binary for `@oxc-resolver/binding` diff --git a/tools/ui/node_modules/@oxc-resolver/binding-linux-x64-gnu/package.json b/tools/ui/node_modules/@oxc-resolver/binding-linux-x64-gnu/package.json new file mode 100644 index 0000000000000000000000000000000000000000..21580bfe3244463b28ff6e5d7c0a957765552147 --- /dev/null +++ b/tools/ui/node_modules/@oxc-resolver/binding-linux-x64-gnu/package.json @@ -0,0 +1,28 @@ +{ + "name": "@oxc-resolver/binding-linux-x64-gnu", + "version": "11.20.0", + "cpu": [ + "x64" + ], + "main": "resolver.linux-x64-gnu.node", + "files": [ + "resolver.linux-x64-gnu.node" + ], + "description": "Oxc Resolver Node API", + "homepage": "https://oxc.rs", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/oxc-project/oxc-resolver.git" + }, + "publishConfig": { + "registry": "https://registry.npmjs.org/", + "access": "public" + }, + "os": [ + "linux" + ], + "libc": [ + "glibc" + ] +} \ No newline at end of file diff --git a/tools/ui/node_modules/@oxc-resolver/binding-linux-x64-gnu/resolver.linux-x64-gnu.node b/tools/ui/node_modules/@oxc-resolver/binding-linux-x64-gnu/resolver.linux-x64-gnu.node new file mode 100644 index 0000000000000000000000000000000000000000..a7e1f4c1576c4dc08f48cfddbba42842905bd05c --- /dev/null +++ b/tools/ui/node_modules/@oxc-resolver/binding-linux-x64-gnu/resolver.linux-x64-gnu.node @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:27bf4b0da5a0431fab60327035d79857b9d42bef95f70288f3de10c591864ad1 +size 2342208 diff --git a/tools/ui/node_modules/@oxc-resolver/binding-linux-x64-musl/README.md b/tools/ui/node_modules/@oxc-resolver/binding-linux-x64-musl/README.md new file mode 100644 index 0000000000000000000000000000000000000000..699dd2adb8f095fba5c5353670533f6ba335f246 --- /dev/null +++ b/tools/ui/node_modules/@oxc-resolver/binding-linux-x64-musl/README.md @@ -0,0 +1,3 @@ +# `@oxc-resolver/binding-linux-x64-musl` + +This is the **x86_64-unknown-linux-musl** binary for `@oxc-resolver/binding` diff --git a/tools/ui/node_modules/@oxc-resolver/binding-linux-x64-musl/package.json b/tools/ui/node_modules/@oxc-resolver/binding-linux-x64-musl/package.json new file mode 100644 index 0000000000000000000000000000000000000000..9e7242a6d288b6a340d587fa14f9cad7e719b2e4 --- /dev/null +++ b/tools/ui/node_modules/@oxc-resolver/binding-linux-x64-musl/package.json @@ -0,0 +1,28 @@ +{ + "name": "@oxc-resolver/binding-linux-x64-musl", + "version": "11.20.0", + "cpu": [ + "x64" + ], + "main": "resolver.linux-x64-musl.node", + "files": [ + "resolver.linux-x64-musl.node" + ], + "description": "Oxc Resolver Node API", + "homepage": "https://oxc.rs", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/oxc-project/oxc-resolver.git" + }, + "publishConfig": { + "registry": "https://registry.npmjs.org/", + "access": "public" + }, + "os": [ + "linux" + ], + "libc": [ + "musl" + ] +} \ No newline at end of file diff --git a/tools/ui/node_modules/@oxc-resolver/binding-linux-x64-musl/resolver.linux-x64-musl.node b/tools/ui/node_modules/@oxc-resolver/binding-linux-x64-musl/resolver.linux-x64-musl.node new file mode 100644 index 0000000000000000000000000000000000000000..766535cf7e9a00fff0d4b36b4a3227ef403b37ac --- /dev/null +++ b/tools/ui/node_modules/@oxc-resolver/binding-linux-x64-musl/resolver.linux-x64-musl.node @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cf8d580afa8772a21f986e66c7925b3ca78fe1bd7d5d7a50999b372990c4db3b +size 2330448 diff --git a/tools/ui/node_modules/@parcel/watcher-linux-x64-glibc/LICENSE b/tools/ui/node_modules/@parcel/watcher-linux-x64-glibc/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..7fb9bc953e90740cb60a6401b25dc36d5a19cdfd --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher-linux-x64-glibc/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017-present Devon Govett + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/tools/ui/node_modules/@parcel/watcher-linux-x64-glibc/README.md b/tools/ui/node_modules/@parcel/watcher-linux-x64-glibc/README.md new file mode 100644 index 0000000000000000000000000000000000000000..0214354c6c5e970fd8e23804a9cfcc915814ad3e --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher-linux-x64-glibc/README.md @@ -0,0 +1 @@ +This is the linux-x64-glibc build of @parcel/watcher. See https://github.com/parcel-bundler/watcher for details. \ No newline at end of file diff --git a/tools/ui/node_modules/@parcel/watcher-linux-x64-glibc/package.json b/tools/ui/node_modules/@parcel/watcher-linux-x64-glibc/package.json new file mode 100644 index 0000000000000000000000000000000000000000..4549903af10d24693f3be566a0573314a846c892 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher-linux-x64-glibc/package.json @@ -0,0 +1,33 @@ +{ + "name": "@parcel/watcher-linux-x64-glibc", + "version": "2.5.6", + "main": "watcher.node", + "repository": { + "type": "git", + "url": "https://github.com/parcel-bundler/watcher.git" + }, + "description": "A native C++ Node module for querying and subscribing to filesystem events. Used by Parcel 2.", + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "files": [ + "watcher.node" + ], + "engines": { + "node": ">= 10.0.0" + }, + "os": [ + "linux" + ], + "cpu": [ + "x64" + ], + "libc": [ + "glibc" + ] +} diff --git a/tools/ui/node_modules/@parcel/watcher-linux-x64-glibc/watcher.node b/tools/ui/node_modules/@parcel/watcher-linux-x64-glibc/watcher.node new file mode 100644 index 0000000000000000000000000000000000000000..45621d36606e2f9d283cc1e27982a9d2157181dd --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher-linux-x64-glibc/watcher.node @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f5a86a5231fb33c6c1830649eafd2c9e72647edb45aad753148d08cee6a42dea +size 523152 diff --git a/tools/ui/node_modules/@parcel/watcher-linux-x64-musl/LICENSE b/tools/ui/node_modules/@parcel/watcher-linux-x64-musl/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..7fb9bc953e90740cb60a6401b25dc36d5a19cdfd --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher-linux-x64-musl/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017-present Devon Govett + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/tools/ui/node_modules/@parcel/watcher-linux-x64-musl/README.md b/tools/ui/node_modules/@parcel/watcher-linux-x64-musl/README.md new file mode 100644 index 0000000000000000000000000000000000000000..6c3b0df0a603c38aecf029c8029faed4e292f4f4 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher-linux-x64-musl/README.md @@ -0,0 +1 @@ +This is the linux-x64-musl build of @parcel/watcher. See https://github.com/parcel-bundler/watcher for details. \ No newline at end of file diff --git a/tools/ui/node_modules/@parcel/watcher-linux-x64-musl/package.json b/tools/ui/node_modules/@parcel/watcher-linux-x64-musl/package.json new file mode 100644 index 0000000000000000000000000000000000000000..b707881fb98e07aa7e7ff4c76ac4354b2dc3243d --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher-linux-x64-musl/package.json @@ -0,0 +1,33 @@ +{ + "name": "@parcel/watcher-linux-x64-musl", + "version": "2.5.6", + "main": "watcher.node", + "repository": { + "type": "git", + "url": "https://github.com/parcel-bundler/watcher.git" + }, + "description": "A native C++ Node module for querying and subscribing to filesystem events. Used by Parcel 2.", + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "files": [ + "watcher.node" + ], + "engines": { + "node": ">= 10.0.0" + }, + "os": [ + "linux" + ], + "cpu": [ + "x64" + ], + "libc": [ + "musl" + ] +} diff --git a/tools/ui/node_modules/@parcel/watcher-linux-x64-musl/watcher.node b/tools/ui/node_modules/@parcel/watcher-linux-x64-musl/watcher.node new file mode 100644 index 0000000000000000000000000000000000000000..1123e0d8ae27cc6cc97686553980abda57e06663 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher-linux-x64-musl/watcher.node @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fea0cee2d578a5aa62c6cdceb61bc4392031d5a3c37a75afb4a3e109a99061f6 +size 511160 diff --git a/tools/ui/node_modules/@parcel/watcher/LICENSE b/tools/ui/node_modules/@parcel/watcher/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..7fb9bc953e90740cb60a6401b25dc36d5a19cdfd --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017-present Devon Govett + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/tools/ui/node_modules/@parcel/watcher/README.md b/tools/ui/node_modules/@parcel/watcher/README.md new file mode 100644 index 0000000000000000000000000000000000000000..28e74f063e3c7b7a235de31fe642a3f6e622b7fd --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/README.md @@ -0,0 +1,136 @@ +# @parcel/watcher + +A native C++ Node module for querying and subscribing to filesystem events. Used by [Parcel 2](https://github.com/parcel-bundler/parcel). + +## Features + +- **Watch** - subscribe to realtime recursive directory change notifications when files or directories are created, updated, or deleted. +- **Query** - performantly query for historical change events in a directory, even when your program is not running. +- **Native** - implemented in C++ for performance and low-level integration with the operating system. +- **Cross platform** - includes backends for macOS, Linux, Windows, FreeBSD, and Watchman. +- **Performant** - events are throttled in C++ so the JavaScript thread is not overwhelmed during large filesystem changes (e.g. `git checkout` or `npm install`). +- **Scalable** - tens of thousands of files can be watched or queried at once with good performance. + +## Example + +```javascript +const watcher = require('@parcel/watcher'); +const path = require('path'); + +// Subscribe to events +let subscription = await watcher.subscribe(process.cwd(), (err, events) => { + console.log(events); +}); + +// later on... +await subscription.unsubscribe(); + +// Get events since some saved snapshot in the past +let snapshotPath = path.join(process.cwd(), 'snapshot.txt'); +let events = await watcher.getEventsSince(process.cwd(), snapshotPath); + +// Save a snapshot for later +await watcher.writeSnapshot(process.cwd(), snapshotPath); +``` + +## Watching + +`@parcel/watcher` supports subscribing to realtime notifications of changes in a directory. It works recursively, so changes in sub-directories will also be emitted. + +Events are throttled and coalesced for performance during large changes like `git checkout` or `npm install`, and a single notification will be emitted with all of the events at the end. + +Only one notification will be emitted per file. For example, if a file was both created and updated since the last event, you'll get only a `create` event. If a file is both created and deleted, you will not be notifed of that file. Renames cause two events: a `delete` for the old name, and a `create` for the new name. + +```javascript +let subscription = await watcher.subscribe(process.cwd(), (err, events) => { + console.log(events); +}); +``` + +Events have two properties: + +- `type` - the event type: `create`, `update`, or `delete`. +- `path` - the absolute path to the file or directory. + +To unsubscribe from change notifications, call the `unsubscribe` method on the returned subscription object. + +```javascript +await subscription.unsubscribe(); +``` + +`@parcel/watcher` has the following watcher backends, listed in priority order: + +- [FSEvents](https://developer.apple.com/documentation/coreservices/file_system_events) on macOS +- [Watchman](https://facebook.github.io/watchman/) if installed +- [inotify](http://man7.org/linux/man-pages/man7/inotify.7.html) on Linux +- [ReadDirectoryChangesW](https://msdn.microsoft.com/en-us/library/windows/desktop/aa365465%28v%3Dvs.85%29.aspx) on Windows +- [kqueue](https://man.freebsd.org/cgi/man.cgi?kqueue) on FreeBSD, or as an alternative to FSEvents on macOS + +You can specify the exact backend you wish to use by passing the `backend` option. If that backend is not available on the current platform, the default backend will be used instead. See below for the list of backend names that can be passed to the options. + +## Querying + +`@parcel/watcher` also supports querying for historical changes made in a directory, even when your program is not running. This makes it easy to invalidate a cache and re-build only the files that have changed, for example. It can be **significantly** faster than traversing the entire filesystem to determine what files changed, depending on the platform. + +In order to query for historical changes, you first need a previous snapshot to compare to. This can be saved to a file with the `writeSnapshot` function, e.g. just before your program exits. + +```javascript +await watcher.writeSnapshot(dirPath, snapshotPath); +``` + +When your program starts up, you can query for changes that have occurred since that snapshot using the `getEventsSince` function. + +```javascript +let events = await watcher.getEventsSince(dirPath, snapshotPath); +``` + +The events returned are exactly the same as the events that would be passed to the `subscribe` callback (see above). + +`@parcel/watcher` has the following watcher backends, listed in priority order: + +- [FSEvents](https://developer.apple.com/documentation/coreservices/file_system_events) on macOS +- [Watchman](https://facebook.github.io/watchman/) if installed +- [fts](http://man7.org/linux/man-pages/man3/fts.3.html) (brute force) on Linux and FreeBSD +- [FindFirstFile](https://docs.microsoft.com/en-us/windows/desktop/api/fileapi/nf-fileapi-findfirstfilea) (brute force) on Windows + +The FSEvents (macOS) and Watchman backends are significantly more performant than the brute force backends used by default on Linux and Windows, for example returning results in miliseconds instead of seconds for large directory trees. This is because a background daemon monitoring filesystem changes on those platforms allows us to query cached data rather than traversing the filesystem manually (brute force). + +macOS has good performance with FSEvents by default. For the best performance on other platforms, install [Watchman](https://facebook.github.io/watchman/) and it will be used by `@parcel/watcher` automatically. + +You can specify the exact backend you wish to use by passing the `backend` option. If that backend is not available on the current platform, the default backend will be used instead. See below for the list of backend names that can be passed to the options. + +## Options + +All of the APIs in `@parcel/watcher` support the following options, which are passed as an object as the last function argument. + +- `ignore` - an array of paths or glob patterns to ignore. uses [`is-glob`](https://github.com/micromatch/is-glob) to distinguish paths from globs. glob patterns are parsed with [`picomatch`](https://github.com/micromatch/picomatch) (see [features](https://github.com/micromatch/picomatch#globbing-features)). + - paths can be relative or absolute and can either be files or directories. No events will be emitted about these files or directories or their children. + - glob patterns match on relative paths from the root that is watched. No events will be emitted for matching paths. +- `backend` - the name of an explicitly chosen backend to use. Allowed options are `"fs-events"`, `"watchman"`, `"inotify"`, `"kqueue"`, `"windows"`, or `"brute-force"` (only for querying). If the specified backend is not available on the current platform, the default backend will be used instead. + +## WASM + +The `@parcel/watcher-wasm` package can be used in place of `@parcel/watcher` on unsupported platforms. It relies on the Node `fs` module, so in non-Node environments such as browsers, an `fs` polyfill will be needed. + +**Note**: the WASM implementation is significantly less efficient than the native implementations because it must crawl the file system to watch each directory individually. Use the native `@parcel/watcher` package wherever possible. + +```js +import {subscribe} from '@parcel/watcher-wasm'; + +// Use the module as documented above. +subscribe(/* ... */); +``` + +## Who is using this? + +- [Parcel 2](https://parceljs.org/) +- [VSCode](https://code.visualstudio.com/updates/v1_62#_file-watching-changes) +- [Tailwind CSS Intellisense](https://github.com/tailwindlabs/tailwindcss-intellisense) +- [Gatsby Cloud](https://twitter.com/chatsidhartha/status/1435647412828196867) +- [Nx](https://nx.dev) +- [Nuxt](https://nuxt.com) +- [Meteor](https://github.com/meteor/meteor) + +## License + +MIT diff --git a/tools/ui/node_modules/@parcel/watcher/binding.gyp b/tools/ui/node_modules/@parcel/watcher/binding.gyp new file mode 100644 index 0000000000000000000000000000000000000000..3c12d52322e448cb9e978cdb8eb485cead35f5ae --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/binding.gyp @@ -0,0 +1,109 @@ +{ + "targets": [ + { + "target_name": "watcher", + "defines": [ "NAPI_DISABLE_CPP_EXCEPTIONS" ], + "sources": [ "src/binding.cc", "src/Watcher.cc", "src/Backend.cc", "src/DirTree.cc", "src/Glob.cc", "src/Debounce.cc" ], + "include_dirs" : [" unknown; + export interface AsyncSubscription { + unsubscribe(): Promise; + } + export interface Event { + path: FilePath; + type: EventType; + } + export function getEventsSince( + dir: FilePath, + snapshot: FilePath, + opts?: Options + ): Promise; + export function subscribe( + dir: FilePath, + fn: SubscribeCallback, + opts?: Options + ): Promise; + export function unsubscribe( + dir: FilePath, + fn: SubscribeCallback, + opts?: Options + ): Promise; + export function writeSnapshot( + dir: FilePath, + snapshot: FilePath, + opts?: Options + ): Promise; +} + +export = ParcelWatcher; \ No newline at end of file diff --git a/tools/ui/node_modules/@parcel/watcher/index.js b/tools/ui/node_modules/@parcel/watcher/index.js new file mode 100644 index 0000000000000000000000000000000000000000..31aba4f9a6cb2637342fe745c5a452be25cd79f8 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/index.js @@ -0,0 +1,42 @@ +const {createWrapper} = require('./wrapper'); + +let name = `@parcel/watcher-${process.platform}-${process.arch}`; +if (process.platform === 'linux') { + const { MUSL, familySync } = require('detect-libc'); + const family = familySync(); + if (family === MUSL) { + name += '-musl'; + } else { + name += '-glibc'; + } +} + +let binding; +try { + binding = require(name); +} catch (err) { + handleError(err); + try { + binding = require('./build/Release/watcher.node'); + } catch (err) { + handleError(err); + try { + binding = require('./build/Debug/watcher.node'); + } catch (err) { + handleError(err); + throw new Error(`No prebuild or local build of @parcel/watcher found. Tried ${name}. Please ensure it is installed (don't use --no-optional when installing with npm). Otherwise it is possible we don't support your platform yet. If this is the case, please report an issue to https://github.com/parcel-bundler/watcher.`); + } + } +} + +function handleError(err) { + if (err?.code !== 'MODULE_NOT_FOUND') { + throw err; + } +} + +const wrapper = createWrapper(binding); +exports.writeSnapshot = wrapper.writeSnapshot; +exports.getEventsSince = wrapper.getEventsSince; +exports.subscribe = wrapper.subscribe; +exports.unsubscribe = wrapper.unsubscribe; diff --git a/tools/ui/node_modules/@parcel/watcher/index.js.flow b/tools/ui/node_modules/@parcel/watcher/index.js.flow new file mode 100644 index 0000000000000000000000000000000000000000..d75da93d70619fd9123ad852c8c2a3dc033b2616 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/index.js.flow @@ -0,0 +1,48 @@ +// @flow +declare type FilePath = string; +declare type GlobPattern = string; + +export type BackendType = + | 'fs-events' + | 'watchman' + | 'inotify' + | 'windows' + | 'brute-force'; +export type EventType = 'create' | 'update' | 'delete'; +export interface Options { + ignore?: Array, + backend?: BackendType +} +export type SubscribeCallback = ( + err: ?Error, + events: Array +) => mixed; +export interface AsyncSubscription { + unsubscribe(): Promise +} +export interface Event { + path: FilePath, + type: EventType +} +declare module.exports: { + getEventsSince( + dir: FilePath, + snapshot: FilePath, + opts?: Options + ): Promise>, + subscribe( + dir: FilePath, + fn: SubscribeCallback, + opts?: Options + ): Promise, + unsubscribe( + dir: FilePath, + fn: SubscribeCallback, + opts?: Options + ): Promise, + writeSnapshot( + dir: FilePath, + snapshot: FilePath, + opts?: Options + ): Promise +} \ No newline at end of file diff --git a/tools/ui/node_modules/@parcel/watcher/package.json b/tools/ui/node_modules/@parcel/watcher/package.json new file mode 100644 index 0000000000000000000000000000000000000000..995149df584a4efc92cb33348771288ca14dd465 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/package.json @@ -0,0 +1,88 @@ +{ + "name": "@parcel/watcher", + "version": "2.5.6", + "main": "index.js", + "types": "index.d.ts", + "repository": { + "type": "git", + "url": "https://github.com/parcel-bundler/watcher.git" + }, + "description": "A native C++ Node module for querying and subscribing to filesystem events. Used by Parcel 2.", + "license": "MIT", + "publishConfig": { + "access": "public" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "files": [ + "index.js", + "index.js.flow", + "index.d.ts", + "wrapper.js", + "package.json", + "README.md", + "LICENSE", + "src", + "scripts/build-from-source.js", + "binding.gyp" + ], + "scripts": { + "prebuild": "prebuildify --napi --strip --tag-libc", + "format": "prettier --write \"./**/*.{js,json,md}\"", + "build": "node-gyp rebuild", + "install": "node scripts/build-from-source.js", + "test": "mocha" + }, + "engines": { + "node": ">= 10.0.0" + }, + "husky": { + "hooks": { + "pre-commit": "lint-staged" + } + }, + "lint-staged": { + "*.{js,json,md}": [ + "prettier --write", + "git add" + ] + }, + "dependencies": { + "detect-libc": "^2.0.3", + "is-glob": "^4.0.3", + "node-addon-api": "^7.0.0", + "picomatch": "^4.0.3" + }, + "devDependencies": { + "esbuild": "^0.19.8", + "fs-extra": "^10.0.0", + "husky": "^7.0.2", + "lint-staged": "^11.1.2", + "mocha": "^9.1.1", + "napi-wasm": "^1.1.0", + "prebuildify": "^6.0.1", + "prettier": "^2.3.2" + }, + "binary": { + "napi_versions": [ + 3 + ] + }, + "optionalDependencies": { + "@parcel/watcher-darwin-x64": "2.5.6", + "@parcel/watcher-darwin-arm64": "2.5.6", + "@parcel/watcher-win32-x64": "2.5.6", + "@parcel/watcher-win32-arm64": "2.5.6", + "@parcel/watcher-win32-ia32": "2.5.6", + "@parcel/watcher-linux-x64-glibc": "2.5.6", + "@parcel/watcher-linux-x64-musl": "2.5.6", + "@parcel/watcher-linux-arm64-glibc": "2.5.6", + "@parcel/watcher-linux-arm64-musl": "2.5.6", + "@parcel/watcher-linux-arm-glibc": "2.5.6", + "@parcel/watcher-linux-arm-musl": "2.5.6", + "@parcel/watcher-android-arm64": "2.5.6", + "@parcel/watcher-freebsd-x64": "2.5.6" + } +} diff --git a/tools/ui/node_modules/@parcel/watcher/scripts/build-from-source.js b/tools/ui/node_modules/@parcel/watcher/scripts/build-from-source.js new file mode 100644 index 0000000000000000000000000000000000000000..4602008ba893a6053f8147b416b6037a35960ccb --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/scripts/build-from-source.js @@ -0,0 +1,13 @@ +#!/usr/bin/env node + +const {spawn} = require('child_process'); + +if (process.env.npm_config_build_from_source === 'true') { + build(); +} + +function build() { + spawn('node-gyp', ['rebuild'], { stdio: 'inherit', shell: true }).on('exit', function (code) { + process.exit(code); + }); +} diff --git a/tools/ui/node_modules/@parcel/watcher/src/Backend.cc b/tools/ui/node_modules/@parcel/watcher/src/Backend.cc new file mode 100644 index 0000000000000000000000000000000000000000..09a53d54b06a048a2066da9db07d7c10c89e3b81 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/Backend.cc @@ -0,0 +1,186 @@ +#ifdef FS_EVENTS +#include "macos/FSEventsBackend.hh" +#endif +#ifdef WATCHMAN +#include "watchman/WatchmanBackend.hh" +#endif +#ifdef WINDOWS +#include "windows/WindowsBackend.hh" +#endif +#ifdef INOTIFY +#include "linux/InotifyBackend.hh" +#endif +#ifdef KQUEUE +#include "kqueue/KqueueBackend.hh" +#endif +#ifdef __wasm32__ +#include "wasm/WasmBackend.hh" +#endif +#include "shared/BruteForceBackend.hh" + +#include "Backend.hh" +#include + +static std::unordered_map>& getSharedBackends() { + static std::unordered_map>* sharedBackends = + new std::unordered_map>(); + return *sharedBackends; +} + +std::shared_ptr getBackend(std::string backend) { + // Use FSEvents on macOS by default. + // Use watchman by default if available on other platforms. + // Fall back to brute force. + #ifdef FS_EVENTS + if (backend == "fs-events" || backend == "default") { + return std::make_shared(); + } + #endif + #ifdef WATCHMAN + if ((backend == "watchman" || backend == "default") && WatchmanBackend::checkAvailable()) { + return std::make_shared(); + } + #endif + #ifdef WINDOWS + if (backend == "windows" || backend == "default") { + return std::make_shared(); + } + #endif + #ifdef INOTIFY + if (backend == "inotify" || backend == "default") { + return std::make_shared(); + } + #endif + #ifdef KQUEUE + if (backend == "kqueue" || backend == "default") { + return std::make_shared(); + } + #endif + #ifdef __wasm32__ + if (backend == "wasm" || backend == "default") { + return std::make_shared(); + } + #endif + if (backend == "brute-force" || backend == "default") { + return std::make_shared(); + } + + return nullptr; +} + +std::shared_ptr Backend::getShared(std::string backend) { + auto found = getSharedBackends().find(backend); + if (found != getSharedBackends().end()) { + return found->second; + } + + auto result = getBackend(backend); + if (!result) { + return getShared("default"); + } + + result->run(); + getSharedBackends().emplace(backend, result); + return result; +} + +void removeShared(Backend *backend) { + for (auto it = getSharedBackends().begin(); it != getSharedBackends().end(); it++) { + if (it->second.get() == backend) { + getSharedBackends().erase(it); + break; + } + } + + // Free up memory. + if (getSharedBackends().size() == 0) { + getSharedBackends().rehash(0); + } +} + +void Backend::run() { + #ifndef __wasm32__ + mThread = std::thread([this] () { + try { + start(); + } catch (std::exception &err) { + handleError(err); + } + }); + + if (mThread.joinable()) { + mStartedSignal.wait(); + } + #else + try { + start(); + } catch (std::exception &err) { + handleError(err); + } + #endif +} + +void Backend::notifyStarted() { + mStartedSignal.notify(); +} + +void Backend::start() { + notifyStarted(); +} + +Backend::~Backend() { + #ifndef __wasm32__ + // Wait for thread to stop + if (mThread.joinable()) { + // If the backend is being destroyed from the thread itself, detach, otherwise join. + if (mThread.get_id() == std::this_thread::get_id()) { + mThread.detach(); + } else { + mThread.join(); + } + } + #endif +} + +void Backend::watch(WatcherRef watcher) { + std::unique_lock lock(mMutex); + auto res = mSubscriptions.find(watcher); + if (res == mSubscriptions.end()) { + try { + this->subscribe(watcher); + mSubscriptions.insert(watcher); + } catch (std::exception&) { + unref(); + throw; + } + } +} + +void Backend::unwatch(WatcherRef watcher) { + std::unique_lock lock(mMutex); + size_t deleted = mSubscriptions.erase(watcher); + if (deleted > 0) { + this->unsubscribe(watcher); + unref(); + } +} + +void Backend::unref() { + if (mSubscriptions.size() == 0) { + removeShared(this); + } +} + +void Backend::handleWatcherError(WatcherError &err) { + unwatch(err.mWatcher); + err.mWatcher->notifyError(err); +} + +void Backend::handleError(std::exception &err) { + std::unique_lock lock(mMutex); + for (auto it = mSubscriptions.begin(); it != mSubscriptions.end(); it++) { + (*it)->notifyError(err); + } + + removeShared(this); +} diff --git a/tools/ui/node_modules/@parcel/watcher/src/Backend.hh b/tools/ui/node_modules/@parcel/watcher/src/Backend.hh new file mode 100644 index 0000000000000000000000000000000000000000..d673bd1a19a7f6115245a8223bf3b15462ed1de2 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/Backend.hh @@ -0,0 +1,37 @@ +#ifndef BACKEND_H +#define BACKEND_H + +#include "Event.hh" +#include "Watcher.hh" +#include "Signal.hh" +#include + +class Backend { +public: + virtual ~Backend(); + void run(); + void notifyStarted(); + + virtual void start(); + virtual void writeSnapshot(WatcherRef watcher, std::string *snapshotPath) = 0; + virtual void getEventsSince(WatcherRef watcher, std::string *snapshotPath) = 0; + virtual void subscribe(WatcherRef watcher) = 0; + virtual void unsubscribe(WatcherRef watcher) = 0; + + static std::shared_ptr getShared(std::string backend); + + void watch(WatcherRef watcher); + void unwatch(WatcherRef watcher); + void unref(); + void handleWatcherError(WatcherError &err); + + std::mutex mMutex; + std::thread mThread; +private: + std::unordered_set mSubscriptions; + Signal mStartedSignal; + + void handleError(std::exception &err); +}; + +#endif diff --git a/tools/ui/node_modules/@parcel/watcher/src/Debounce.cc b/tools/ui/node_modules/@parcel/watcher/src/Debounce.cc new file mode 100644 index 0000000000000000000000000000000000000000..be07e782845b072fc632d8e7e663362fbb028876 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/Debounce.cc @@ -0,0 +1,113 @@ +#include "Debounce.hh" + +#ifdef __wasm32__ +extern "C" void on_timeout(void *ctx) { + Debounce *debounce = (Debounce *)ctx; + debounce->notify(); +} +#endif + +std::shared_ptr Debounce::getShared() { + static std::weak_ptr sharedInstance; + std::shared_ptr shared = sharedInstance.lock(); + if (!shared) { + shared = std::make_shared(); + sharedInstance = shared; + } + + return shared; +} + +Debounce::Debounce() { + mRunning = true; + #ifndef __wasm32__ + mThread = std::thread([this] () { + loop(); + }); + #endif +} + +Debounce::~Debounce() { + mRunning = false; + #ifndef __wasm32__ + mWaitSignal.notify(); + mThread.join(); + #endif +} + +void Debounce::add(void *key, std::function cb) { + std::unique_lock lock(mMutex); + mCallbacks.emplace(key, cb); +} + +void Debounce::remove(void *key) { + std::unique_lock lock(mMutex); + mCallbacks.erase(key); +} + +void Debounce::trigger() { + std::unique_lock lock(mMutex); + #ifdef __wasm32__ + notifyIfReady(); + #else + mWaitSignal.notify(); + #endif +} + +#ifndef __wasm32__ +void Debounce::loop() { + while (mRunning) { + mWaitSignal.wait(); + if (!mRunning) { + break; + } + + notifyIfReady(); + } +} +#endif + +void Debounce::notifyIfReady() { + if (!mRunning) { + return; + } + + // If we haven't seen an event in more than the maximum wait time, notify callbacks immediately + // to ensure that we don't wait forever. Otherwise, wait for the minimum wait time and batch + // subsequent fast changes. This also means the first file change in a batch is notified immediately, + // separately from the rest of the batch. This seems like an acceptable tradeoff if the common case + // is that only a single file was updated at a time. + auto time = std::chrono::steady_clock::now(); + if ((time - mLastTime) > std::chrono::milliseconds(MAX_WAIT_TIME)) { + mLastTime = time; + notify(); + } else { + wait(); + } +} + +void Debounce::wait() { + #ifdef __wasm32__ + clear_timeout(mTimeout); + mTimeout = set_timeout(MIN_WAIT_TIME, this); + #else + auto status = mWaitSignal.waitFor(std::chrono::milliseconds(MIN_WAIT_TIME)); + if (mRunning && (status == std::cv_status::timeout)) { + notify(); + } + #endif +} + +void Debounce::notify() { + std::unique_lock lock(mMutex); + + mLastTime = std::chrono::steady_clock::now(); + for (auto it = mCallbacks.begin(); it != mCallbacks.end(); it++) { + auto cb = it->second; + cb(); + } + + #ifndef __wasm32__ + mWaitSignal.reset(); + #endif +} diff --git a/tools/ui/node_modules/@parcel/watcher/src/Debounce.hh b/tools/ui/node_modules/@parcel/watcher/src/Debounce.hh new file mode 100644 index 0000000000000000000000000000000000000000..a17fdef7b8c9611bc0b5a6c71268af1d0a5cbe3d --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/Debounce.hh @@ -0,0 +1,49 @@ +#ifndef DEBOUNCE_H +#define DEBOUNCE_H + +#include +#include +#include +#include "Signal.hh" + +#define MIN_WAIT_TIME 50 +#define MAX_WAIT_TIME 500 + +#ifdef __wasm32__ +extern "C" { + int set_timeout(int ms, void *ctx); + void clear_timeout(int timeout); + void on_timeout(void *ctx); +}; +#endif + +class Debounce { +public: + static std::shared_ptr getShared(); + + Debounce(); + ~Debounce(); + + void add(void *key, std::function cb); + void remove(void *key); + void trigger(); + void notify(); + +private: + bool mRunning; + std::mutex mMutex; + #ifdef __wasm32__ + int mTimeout; + #else + Signal mWaitSignal; + std::thread mThread; + #endif + std::unordered_map> mCallbacks; + std::chrono::time_point mLastTime; + + void loop(); + void notifyIfReady(); + void wait(); +}; + +#endif diff --git a/tools/ui/node_modules/@parcel/watcher/src/DirTree.cc b/tools/ui/node_modules/@parcel/watcher/src/DirTree.cc new file mode 100644 index 0000000000000000000000000000000000000000..b7eddd8cd659b7447c37724ec50066e7ef66bc4f --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/DirTree.cc @@ -0,0 +1,164 @@ +#include "DirTree.hh" +#include + +// "Meyer's singleton", construction is ordered by use, likewise (reverse) for destruction. +// https://stackoverflow.com/a/17713799 +// https://laristra.github.io/flecsi/src/developer-guide/patterns/meyers_singleton.html +static std::mutex& mDirCacheMutex() { + static std::mutex mutex; + return mutex; +} + +static std::unordered_map>& dirTreeCache() { + static std::unordered_map> cache; + return cache; +} + +struct DirTreeDeleter { + void operator()(DirTree *tree) { + std::lock_guard lock(mDirCacheMutex()); + std::unordered_map> &cache = dirTreeCache(); + cache.erase(tree->root); + delete tree; + + // Free up memory. + if (cache.size() == 0) { + cache.rehash(0); + } + } +}; + +std::shared_ptr DirTree::getCached(std::string root) { + std::lock_guard lock(mDirCacheMutex()); + std::unordered_map> &cache = dirTreeCache(); + + auto found = cache.find(root); + std::shared_ptr tree; + + // Use cached tree, or create an empty one. + if (found != cache.end()) { + tree = found->second.lock(); + } else { + tree = std::shared_ptr(new DirTree(root), DirTreeDeleter()); + cache.emplace(root, tree); + } + + return tree; +} + +DirTree::DirTree(std::string root, FILE *f) : root(root), isComplete(true) { + size_t size; + if (fscanf(f, "%zu", &size)) { + for (size_t i = 0; i < size; i++) { + DirEntry entry(f); + entries.emplace(entry.path, entry); + } + } +} + +// Internal find method that has no lock +DirEntry *DirTree::_find(std::string path) { + auto found = entries.find(path); + if (found == entries.end()) { + return NULL; + } + + return &found->second; +} + +DirEntry *DirTree::add(std::string path, uint64_t mtime, bool isDir) { + std::lock_guard lock(mDirCacheMutex()); + + DirEntry entry(path, mtime, isDir); + auto it = entries.emplace(entry.path, entry); + return &it.first->second; +} + +DirEntry *DirTree::find(std::string path) { + std::lock_guard lock(mDirCacheMutex()); + return _find(path); +} + +DirEntry *DirTree::update(std::string path, uint64_t mtime) { + std::lock_guard lock(mDirCacheMutex()); + + DirEntry *found = _find(path); + if (found) { + found->mtime = mtime; + } + + return found; +} + +void DirTree::remove(std::string path) { + std::lock_guard lock(mDirCacheMutex()); + + DirEntry *found = _find(path); + + // Remove all sub-entries if this is a directory + if (found && found->isDir) { + std::string pathStart = path + DIR_SEP; + for (auto it = entries.begin(); it != entries.end();) { + if (it->first.rfind(pathStart, 0) == 0) { + it = entries.erase(it); + } else { + it++; + } + } + } + + entries.erase(path); +} + +void DirTree::write(FILE *f) { + std::lock_guard lock(mDirCacheMutex()); + + fprintf(f, "%zu\n", entries.size()); + for (auto it = entries.begin(); it != entries.end(); it++) { + it->second.write(f); + } +} + +void DirTree::getChanges(DirTree *snapshot, EventList &events) { + std::lock_guard lock(mDirCacheMutex()); + std::lock_guard snapshotLock(snapshot->mMutex); + + for (auto it = entries.begin(); it != entries.end(); it++) { + auto found = snapshot->entries.find(it->first); + if (found == snapshot->entries.end()) { + events.create(it->second.path); + } else if (found->second.mtime != it->second.mtime && !found->second.isDir && !it->second.isDir) { + events.update(it->second.path); + } + } + + for (auto it = snapshot->entries.begin(); it != snapshot->entries.end(); it++) { + size_t count = entries.count(it->first); + if (count == 0) { + events.remove(it->second.path); + } + } +} + +DirEntry::DirEntry(std::string p, uint64_t t, bool d) { + path = p; + mtime = t; + isDir = d; + state = NULL; +} + +DirEntry::DirEntry(FILE *f) { + size_t size; + if (fscanf(f, "%zu", &size)) { + path.resize(size); + if (fread(&path[0], sizeof(char), size, f)) { + int d = 0; + fscanf(f, "%" PRIu64 " %d\n", &mtime, &d); + isDir = d == 1; + } + } +} + +void DirEntry::write(FILE *f) const { + fprintf(f, "%zu%s%" PRIu64 " %d\n", path.size(), path.c_str(), mtime, isDir); +} diff --git a/tools/ui/node_modules/@parcel/watcher/src/DirTree.hh b/tools/ui/node_modules/@parcel/watcher/src/DirTree.hh new file mode 100644 index 0000000000000000000000000000000000000000..328f469965d3bc248c99e8a50752c549c631e20a --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/DirTree.hh @@ -0,0 +1,50 @@ +#ifndef DIR_TREE_H +#define DIR_TREE_H + +#include +#include +#include +#include "Event.hh" + +#ifdef _WIN32 +#define DIR_SEP "\\" +#else +#define DIR_SEP "/" +#endif + +struct DirEntry { + std::string path; + uint64_t mtime; + bool isDir; + mutable void *state; + + DirEntry(std::string p, uint64_t t, bool d); + DirEntry(FILE *f); + void write(FILE *f) const; + bool operator==(const DirEntry &other) const { + return path == other.path; + } +}; + +class DirTree { +public: + static std::shared_ptr getCached(std::string root); + DirTree(std::string root) : root(root), isComplete(false) {} + DirTree(std::string root, FILE *f); + DirEntry *add(std::string path, uint64_t mtime, bool isDir); + DirEntry *find(std::string path); + DirEntry *update(std::string path, uint64_t mtime); + void remove(std::string path); + void write(FILE *f); + void getChanges(DirTree *snapshot, EventList &events); + + std::mutex mMutex; + std::string root; + bool isComplete; + std::unordered_map entries; + +private: + DirEntry *_find(std::string path); +}; + +#endif diff --git a/tools/ui/node_modules/@parcel/watcher/src/Event.hh b/tools/ui/node_modules/@parcel/watcher/src/Event.hh new file mode 100644 index 0000000000000000000000000000000000000000..8d09712e5032cee44450f6ed2de10f6df1b113d6 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/Event.hh @@ -0,0 +1,109 @@ +#ifndef EVENT_H +#define EVENT_H + +#include +#include +#include "wasm/include.h" +#include +#include +#include +#include + +using namespace Napi; + +struct Event { + std::string path; + bool isCreated; + bool isDeleted; + Event(std::string path) : path(path), isCreated(false), isDeleted(false) {} + + Value toJS(const Env& env) { + EscapableHandleScope scope(env); + Object res = Object::New(env); + std::string type = isCreated ? "create" : isDeleted ? "delete" : "update"; + res.Set(String::New(env, "path"), String::New(env, path.c_str())); + res.Set(String::New(env, "type"), String::New(env, type.c_str())); + return scope.Escape(res); + } +}; + +class EventList { +public: + void create(std::string path) { + std::lock_guard l(mMutex); + Event *event = internalUpdate(path); + if (event->isDeleted) { + // Assume update event when rapidly removed and created + // https://github.com/parcel-bundler/watcher/issues/72 + event->isDeleted = false; + } else { + event->isCreated = true; + } + } + + Event *update(std::string path) { + std::lock_guard l(mMutex); + return internalUpdate(path); + } + + void remove(std::string path) { + std::lock_guard l(mMutex); + Event *event = internalUpdate(path); + event->isDeleted = true; + } + + size_t size() { + std::lock_guard l(mMutex); + return mEvents.size(); + } + + std::vector getEvents() { + std::lock_guard l(mMutex); + std::vector eventsCloneVector; + for(auto it = mEvents.begin(); it != mEvents.end(); ++it) { + if (!(it->second.isCreated && it->second.isDeleted)) { + eventsCloneVector.push_back(it->second); + } + } + return eventsCloneVector; + } + + void clear() { + std::lock_guard l(mMutex); + mEvents.clear(); + mError.reset(); + } + + void error(std::string err) { + std::lock_guard l(mMutex); + if (!mError.has_value()) { + mError.emplace(err); + } + } + + bool hasError() { + std::lock_guard l(mMutex); + return mError.has_value(); + } + + std::string getError() { + std::lock_guard l(mMutex); + return mError.value_or(""); + } + +private: + mutable std::mutex mMutex; + std::map mEvents; + std::optional mError; + Event *internalUpdate(std::string path) { + auto found = mEvents.find(path); + if (found == mEvents.end()) { + auto it = mEvents.emplace(path, Event(path)); + return &it.first->second; + } + + return &found->second; + } +}; + +#endif diff --git a/tools/ui/node_modules/@parcel/watcher/src/Glob.cc b/tools/ui/node_modules/@parcel/watcher/src/Glob.cc new file mode 100644 index 0000000000000000000000000000000000000000..a4a1722495a90eda1736eb07e876091cda4ec140 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/Glob.cc @@ -0,0 +1,22 @@ +#include "Glob.hh" + +#ifdef __wasm32__ +extern "C" bool wasm_regex_match(const char *s, const char *regex); +#endif + +Glob::Glob(std::string raw) { + mRaw = raw; + mHash = std::hash()(raw); + #ifndef __wasm32__ + mRegex = std::regex(raw); + #endif +} + +bool Glob::isIgnored(std::string relative_path) const { + // Use native JS regex engine for wasm to reduce binary size. + #ifdef __wasm32__ + return wasm_regex_match(relative_path.c_str(), mRaw.c_str()); + #else + return std::regex_match(relative_path, mRegex); + #endif +} diff --git a/tools/ui/node_modules/@parcel/watcher/src/Glob.hh b/tools/ui/node_modules/@parcel/watcher/src/Glob.hh new file mode 100644 index 0000000000000000000000000000000000000000..b5fc3759fc9afbcf2ca34ac8e3b4563e5cd58f06 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/Glob.hh @@ -0,0 +1,34 @@ +#ifndef GLOB_H +#define GLOB_H + +#include +#include + +struct Glob { + std::size_t mHash; + std::string mRaw; + #ifndef __wasm32__ + std::regex mRegex; + #endif + + Glob(std::string raw); + + bool operator==(const Glob &other) const { + return mHash == other.mHash && mRaw == other.mRaw; + } + + bool isIgnored(std::string relative_path) const; +}; + +namespace std +{ + template <> + struct hash + { + size_t operator()(const Glob& g) const { + return g.mHash; + } + }; +} + +#endif diff --git a/tools/ui/node_modules/@parcel/watcher/src/PromiseRunner.hh b/tools/ui/node_modules/@parcel/watcher/src/PromiseRunner.hh new file mode 100644 index 0000000000000000000000000000000000000000..4ca3bb66cb0970f09dff7c595818234f2157efa6 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/PromiseRunner.hh @@ -0,0 +1,101 @@ +#ifndef PROMISE_RUNNER_H +#define PROMISE_RUNNER_H + +#include +#include "wasm/include.h" +#include + +using namespace Napi; + +class PromiseRunner { +public: + const Env env; + Promise::Deferred deferred; + + PromiseRunner(Env env) : env(env), deferred(Promise::Deferred::New(env)) { + napi_status status = napi_create_async_work(env, nullptr, env.Undefined(), + onExecute, onWorkComplete, this, &work); + if (status != napi_ok) { + work = nullptr; + const napi_extended_error_info *error_info = 0; + napi_get_last_error_info(env, &error_info); + if (error_info->error_message) { + Error::New(env, error_info->error_message).ThrowAsJavaScriptException(); + } else { + Error::New(env).ThrowAsJavaScriptException(); + } + } + } + + virtual ~PromiseRunner() {} + + Value queue() { + if (work) { + napi_status status = napi_queue_async_work(env, work); + if (status != napi_ok) { + onError(Error::New(env)); + } + } + + return deferred.Promise(); + } + +private: + napi_async_work work; + std::string error; + + static void onExecute(napi_env env, void *this_pointer) { + PromiseRunner* self = (PromiseRunner*) this_pointer; + try { + self->execute(); + } catch (std::exception &err) { + self->error = err.what(); + } + } + + static void onWorkComplete(napi_env env, napi_status status, void *this_pointer) { + PromiseRunner* self = (PromiseRunner*) this_pointer; + if (status != napi_cancelled) { + HandleScope scope(self->env); + if (status == napi_ok) { + status = napi_delete_async_work(self->env, self->work); + if (status == napi_ok) { + if (self->error.size() == 0) { + self->onOK(); + } else { + self->onError(Error::New(self->env, self->error)); + } + delete self; + return; + } + } + } + + // fallthrough for error handling + const napi_extended_error_info *error_info = 0; + napi_get_last_error_info(env, &error_info); + if (error_info->error_message){ + self->onError(Error::New(env, error_info->error_message)); + } else { + self->onError(Error::New(env)); + } + delete self; + } + + virtual void execute() {} + virtual Value getResult() { + return env.Null(); + } + + void onOK() { + HandleScope scope(env); + Value result = getResult(); + deferred.Resolve(result); + } + + void onError(const Error &e) { + deferred.Reject(e.Value()); + } +}; + +#endif diff --git a/tools/ui/node_modules/@parcel/watcher/src/Signal.hh b/tools/ui/node_modules/@parcel/watcher/src/Signal.hh new file mode 100644 index 0000000000000000000000000000000000000000..e577319d4f88d895f0040871efeb32c522520012 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/Signal.hh @@ -0,0 +1,46 @@ +#ifndef SIGNAL_H +#define SIGNAL_H + +#include +#include + +class Signal { +public: + Signal() : mFlag(false), mWaiting(false) {} + void wait() { + std::unique_lock lock(mMutex); + while (!mFlag) { + mWaiting = true; + mCond.wait(lock); + } + } + + std::cv_status waitFor(std::chrono::milliseconds ms) { + std::unique_lock lock(mMutex); + return mCond.wait_for(lock, ms); + } + + void notify() { + std::unique_lock lock(mMutex); + mFlag = true; + mCond.notify_all(); + } + + void reset() { + std::unique_lock lock(mMutex); + mFlag = false; + mWaiting = false; + } + + bool isWaiting() { + return mWaiting; + } + +private: + bool mFlag; + bool mWaiting; + std::mutex mMutex; + std::condition_variable mCond; +}; + +#endif diff --git a/tools/ui/node_modules/@parcel/watcher/src/Watcher.cc b/tools/ui/node_modules/@parcel/watcher/src/Watcher.cc new file mode 100644 index 0000000000000000000000000000000000000000..a58ff3722d0d4a85dbef822f7cd4a078cb4278ff --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/Watcher.cc @@ -0,0 +1,241 @@ +#include "Watcher.hh" +#include + +using namespace Napi; + +struct WatcherHash { + std::size_t operator() (WatcherRef const &k) const { + return std::hash()(k->mDir); + } +}; + +struct WatcherCompare { + size_t operator() (WatcherRef const &a, WatcherRef const &b) const { + return *a == *b; + } +}; + +static std::unordered_set& getSharedWatchers() { + static std::unordered_set* sharedWatchers = + new std::unordered_set(); + return *sharedWatchers; +} + +WatcherRef Watcher::getShared(std::string dir, std::unordered_set ignorePaths, std::unordered_set ignoreGlobs) { + WatcherRef watcher = std::make_shared(dir, ignorePaths, ignoreGlobs); + auto found = getSharedWatchers().find(watcher); + if (found != getSharedWatchers().end()) { + return *found; + } + + getSharedWatchers().insert(watcher); + return watcher; +} + +void removeShared(Watcher *watcher) { + for (auto it = getSharedWatchers().begin(); it != getSharedWatchers().end(); it++) { + if (it->get() == watcher) { + getSharedWatchers().erase(it); + break; + } + } + + // Free up memory. + if (getSharedWatchers().size() == 0) { + getSharedWatchers().rehash(0); + } +} + +Watcher::Watcher(std::string dir, std::unordered_set ignorePaths, std::unordered_set ignoreGlobs) + : mDir(dir), + mIgnorePaths(ignorePaths), + mIgnoreGlobs(ignoreGlobs) { + mDebounce = Debounce::getShared(); + mDebounce->add(this, [this] () { + triggerCallbacks(); + }); + } + +Watcher::~Watcher() { + mDebounce->remove(this); +} + +void Watcher::wait() { + std::unique_lock lk(mMutex); + mCond.wait(lk); +} + +void Watcher::notify() { + std::unique_lock lk(mMutex); + mCond.notify_all(); + + if (mCallbacks.size() > 0 && mEvents.size() > 0) { + // We must release our lock before calling into the debouncer + // to avoid a deadlock: the debouncer thread itself will require + // our lock from its thread when calling into `triggerCallbacks` + // while holding its own debouncer lock. + lk.unlock(); + mDebounce->trigger(); + } +} + +struct CallbackData { + std::string error; + std::vector events; + CallbackData(std::string error, std::vector events) : error(error), events(events) {} +}; + +Value callbackEventsToJS(const Env &env, std::vector &events) { + EscapableHandleScope scope(env); + Array arr = Array::New(env, events.size()); + uint32_t currentEventIndex = 0; + for (auto eventIterator = events.begin(); eventIterator != events.end(); eventIterator++) { + arr.Set(currentEventIndex++, eventIterator->toJS(env)); + } + return scope.Escape(arr); +} + +void callJSFunction(Napi::Env env, Function jsCallback, CallbackData *data) { + HandleScope scope(env); + auto err = data->error.size() > 0 ? Error::New(env, data->error).Value() : env.Null(); + auto events = callbackEventsToJS(env, data->events); + jsCallback.Call({err, events}); + delete data; + + // Throw errors from the callback as fatal exceptions + // If we don't handle these node segfaults... + if (env.IsExceptionPending()) { + Napi::Error err = env.GetAndClearPendingException(); + napi_fatal_exception(env, err.Value()); + } +} + +void Watcher::notifyError(std::exception &err) { + std::unique_lock lk(mMutex); + for (auto it = mCallbacks.begin(); it != mCallbacks.end(); it++) { + CallbackData *data = new CallbackData(err.what(), {}); + it->tsfn.BlockingCall(data, callJSFunction); + } + + clearCallbacks(); +} + +// This function is called from the debounce thread. +void Watcher::triggerCallbacks() { + std::unique_lock lk(mMutex); + if (mCallbacks.size() > 0 && (mEvents.size() > 0 || mEvents.hasError())) { + auto error = mEvents.getError(); + auto events = mEvents.getEvents(); + mEvents.clear(); + + for (auto it = mCallbacks.begin(); it != mCallbacks.end(); it++) { + it->tsfn.BlockingCall(new CallbackData(error, events), callJSFunction); + } + } +} + +// This should be called from the JavaScript thread. +bool Watcher::watch(Function callback) { + std::unique_lock lk(mMutex); + + auto it = findCallback(callback); + if (it != mCallbacks.end()) { + return false; + } + + auto tsfn = ThreadSafeFunction::New( + callback.Env(), + callback, + "Watcher callback", + 0, // Unlimited queue + 1 // Initial thread count + ); + + mCallbacks.push_back(Callback { + tsfn, + Napi::Persistent(callback), + std::this_thread::get_id() + }); + + return true; +} + +// This should be called from the JavaScript thread. +std::vector::iterator Watcher::findCallback(Function callback) { + for (auto it = mCallbacks.begin(); it != mCallbacks.end(); it++) { + // Only consider callbacks created by the same thread, or V8 will panic. + if (it->threadId == std::this_thread::get_id() && it->ref.Value() == callback) { + return it; + } + } + + return mCallbacks.end(); +} + +// This should be called from the JavaScript thread. +bool Watcher::unwatch(Function callback) { + std::unique_lock lk(mMutex); + + bool removed = false; + auto it = findCallback(callback); + if (it != mCallbacks.end()) { + it->tsfn.Release(); + it->ref.Unref(); + mCallbacks.erase(it); + removed = true; + } + + if (removed && mCallbacks.size() == 0) { + unref(); + return true; + } + + return false; +} + +void Watcher::unref() { + if (mCallbacks.size() == 0) { + removeShared(this); + } +} + +void Watcher::destroy() { + std::unique_lock lk(mMutex); + clearCallbacks(); +} + +// Private because it doesn't lock. +void Watcher::clearCallbacks() { + for (auto it = mCallbacks.begin(); it != mCallbacks.end(); it++) { + it->tsfn.Release(); + it->ref.Unref(); + } + + mCallbacks.clear(); + unref(); +} + +bool Watcher::isIgnored(std::string path) { + for (auto it = mIgnorePaths.begin(); it != mIgnorePaths.end(); it++) { + auto dir = *it + DIR_SEP; + if (*it == path || path.compare(0, dir.size(), dir) == 0) { + return true; + } + } + + auto basePath = mDir + DIR_SEP; + + if (path.rfind(basePath, 0) != 0) { + return false; + } + + auto relativePath = path.substr(basePath.size()); + + for (auto it = mIgnoreGlobs.begin(); it != mIgnoreGlobs.end(); it++) { + if (it->isIgnored(relativePath)) { + return true; + } + } + + return false; +} diff --git a/tools/ui/node_modules/@parcel/watcher/src/Watcher.hh b/tools/ui/node_modules/@parcel/watcher/src/Watcher.hh new file mode 100644 index 0000000000000000000000000000000000000000..f89e9f5dca4531b5c7cdf524252973dc2c568d6a --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/Watcher.hh @@ -0,0 +1,73 @@ +#ifndef WATCHER_H +#define WATCHER_H + +#include +#include +#include +#include +#include "Glob.hh" +#include "Event.hh" +#include "Debounce.hh" +#include "DirTree.hh" +#include "Signal.hh" + +using namespace Napi; + +struct Watcher; +using WatcherRef = std::shared_ptr; + +struct Callback { + Napi::ThreadSafeFunction tsfn; + Napi::FunctionReference ref; + std::thread::id threadId; +}; + +class WatcherState { +public: + virtual ~WatcherState() = default; +}; + +struct Watcher { + std::string mDir; + std::unordered_set mIgnorePaths; + std::unordered_set mIgnoreGlobs; + EventList mEvents; + std::shared_ptr state; + + Watcher(std::string dir, std::unordered_set ignorePaths, std::unordered_set ignoreGlobs); + ~Watcher(); + + bool operator==(const Watcher &other) const { + return mDir == other.mDir && mIgnorePaths == other.mIgnorePaths && mIgnoreGlobs == other.mIgnoreGlobs; + } + + void wait(); + void notify(); + void notifyError(std::exception &err); + bool watch(Function callback); + bool unwatch(Function callback); + void unref(); + bool isIgnored(std::string path); + void destroy(); + + static WatcherRef getShared(std::string dir, std::unordered_set ignorePaths, std::unordered_set ignoreGlobs); + +private: + std::mutex mMutex; + std::condition_variable mCond; + std::vector mCallbacks; + std::shared_ptr mDebounce; + + std::vector::iterator findCallback(Function callback); + void clearCallbacks(); + void triggerCallbacks(); +}; + +class WatcherError : public std::runtime_error { +public: + WatcherRef mWatcher; + WatcherError(std::string msg, WatcherRef watcher) : std::runtime_error(msg), mWatcher(watcher) {} + WatcherError(const char *msg, WatcherRef watcher) : std::runtime_error(msg), mWatcher(watcher) {} +}; + +#endif diff --git a/tools/ui/node_modules/@parcel/watcher/src/binding.cc b/tools/ui/node_modules/@parcel/watcher/src/binding.cc new file mode 100644 index 0000000000000000000000000000000000000000..057b61b83385793a2f13c7adc8c2e983bef67538 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/binding.cc @@ -0,0 +1,268 @@ +#include +#include +#include "wasm/include.h" +#include +#include "Glob.hh" +#include "Event.hh" +#include "Backend.hh" +#include "Watcher.hh" +#include "PromiseRunner.hh" + +using namespace Napi; + +std::unordered_set getIgnorePaths(Env env, Value opts) { + std::unordered_set result; + + if (opts.IsObject()) { + Value v = opts.As().Get(String::New(env, "ignorePaths")); + if (v.IsArray()) { + Array items = v.As(); + for (size_t i = 0; i < items.Length(); i++) { + Value item = items.Get(Number::New(env, static_cast(i))); + if (item.IsString()) { + result.insert(std::string(item.As().Utf8Value().c_str())); + } + } + } + } + + return result; +} + +std::unordered_set getIgnoreGlobs(Env env, Value opts) { + std::unordered_set result; + + if (opts.IsObject()) { + Value v = opts.As().Get(String::New(env, "ignoreGlobs")); + if (v.IsArray()) { + Array items = v.As(); + for (size_t i = 0; i < items.Length(); i++) { + Value item = items.Get(Number::New(env, static_cast(i))); + if (item.IsString()) { + auto key = item.As().Utf8Value(); + try { + result.emplace(key); + } catch (const std::regex_error& e) { + Error::New(env, e.what()).ThrowAsJavaScriptException(); + } + } + } + } + } + + return result; +} + +std::shared_ptr getBackend(Env env, Value opts) { + Value b = opts.As().Get(String::New(env, "backend")); + std::string backendName; + if (b.IsString()) { + backendName = std::string(b.As().Utf8Value().c_str()); + } + + return Backend::getShared(backendName); +} + +class WriteSnapshotRunner : public PromiseRunner { +public: + WriteSnapshotRunner(Env env, Value dir, Value snap, Value opts) + : PromiseRunner(env), + snapshotPath(std::string(snap.As().Utf8Value().c_str())) { + watcher = Watcher::getShared( + std::string(dir.As().Utf8Value().c_str()), + getIgnorePaths(env, opts), + getIgnoreGlobs(env, opts) + ); + + backend = getBackend(env, opts); + } + + ~WriteSnapshotRunner() { + watcher->unref(); + backend->unref(); + } +private: + std::shared_ptr backend; + WatcherRef watcher; + std::string snapshotPath; + + void execute() override { + backend->writeSnapshot(watcher, &snapshotPath); + } +}; + +class GetEventsSinceRunner : public PromiseRunner { +public: + GetEventsSinceRunner(Env env, Value dir, Value snap, Value opts) + : PromiseRunner(env), + snapshotPath(std::string(snap.As().Utf8Value().c_str())) { + watcher = std::make_shared( + std::string(dir.As().Utf8Value().c_str()), + getIgnorePaths(env, opts), + getIgnoreGlobs(env, opts) + ); + + backend = getBackend(env, opts); + } + + ~GetEventsSinceRunner() { + watcher->unref(); + backend->unref(); + } +private: + std::shared_ptr backend; + WatcherRef watcher; + std::string snapshotPath; + + void execute() override { + backend->getEventsSince(watcher, &snapshotPath); + if (watcher->mEvents.hasError()) { + throw std::runtime_error(watcher->mEvents.getError()); + } + } + + Value getResult() override { + std::vector events = watcher->mEvents.getEvents(); + Array eventsArray = Array::New(env, events.size()); + uint32_t i = 0; + for (auto it = events.begin(); it != events.end(); it++) { + eventsArray.Set(i++, it->toJS(env)); + } + return eventsArray; + } +}; + +template +Value queueSnapshotWork(const CallbackInfo& info) { + Env env = info.Env(); + if (info.Length() < 1 || !info[0].IsString()) { + TypeError::New(env, "Expected a string").ThrowAsJavaScriptException(); + return env.Null(); + } + + if (info.Length() < 2 || !info[1].IsString()) { + TypeError::New(env, "Expected a string").ThrowAsJavaScriptException(); + return env.Null(); + } + + if (info.Length() >= 3 && !info[2].IsObject()) { + TypeError::New(env, "Expected an object").ThrowAsJavaScriptException(); + return env.Null(); + } + + Runner *runner = new Runner(info.Env(), info[0], info[1], info[2]); + return runner->queue(); +} + +Value writeSnapshot(const CallbackInfo& info) { + return queueSnapshotWork(info); +} + +Value getEventsSince(const CallbackInfo& info) { + return queueSnapshotWork(info); +} + +class SubscribeRunner : public PromiseRunner { +public: + SubscribeRunner(Env env, Value dir, Value fn, Value opts) : PromiseRunner(env) { + watcher = Watcher::getShared( + std::string(dir.As().Utf8Value().c_str()), + getIgnorePaths(env, opts), + getIgnoreGlobs(env, opts) + ); + + backend = getBackend(env, opts); + watcher->watch(fn.As()); + } + +private: + WatcherRef watcher; + std::shared_ptr backend; + FunctionReference callback; + + void execute() override { + try { + backend->watch(watcher); + } catch (std::exception&) { + watcher->destroy(); + throw; + } + } +}; + +class UnsubscribeRunner : public PromiseRunner { +public: + UnsubscribeRunner(Env env, Value dir, Value fn, Value opts) : PromiseRunner(env) { + watcher = Watcher::getShared( + std::string(dir.As().Utf8Value().c_str()), + getIgnorePaths(env, opts), + getIgnoreGlobs(env, opts) + ); + + backend = getBackend(env, opts); + shouldUnwatch = watcher->unwatch(fn.As()); + } + +private: + WatcherRef watcher; + std::shared_ptr backend; + bool shouldUnwatch; + + void execute() override { + if (shouldUnwatch) { + backend->unwatch(watcher); + } + } +}; + +template +Value queueSubscriptionWork(const CallbackInfo& info) { + Env env = info.Env(); + if (info.Length() < 1 || !info[0].IsString()) { + TypeError::New(env, "Expected a string").ThrowAsJavaScriptException(); + return env.Null(); + } + + if (info.Length() < 2 || !info[1].IsFunction()) { + TypeError::New(env, "Expected a function").ThrowAsJavaScriptException(); + return env.Null(); + } + + if (info.Length() >= 3 && !info[2].IsObject()) { + TypeError::New(env, "Expected an object").ThrowAsJavaScriptException(); + return env.Null(); + } + + Runner *runner = new Runner(info.Env(), info[0], info[1], info[2]); + return runner->queue(); +} + +Value subscribe(const CallbackInfo& info) { + return queueSubscriptionWork(info); +} + +Value unsubscribe(const CallbackInfo& info) { + return queueSubscriptionWork(info); +} + +Object Init(Env env, Object exports) { + exports.Set( + String::New(env, "writeSnapshot"), + Function::New(env, writeSnapshot) + ); + exports.Set( + String::New(env, "getEventsSince"), + Function::New(env, getEventsSince) + ); + exports.Set( + String::New(env, "subscribe"), + Function::New(env, subscribe) + ); + exports.Set( + String::New(env, "unsubscribe"), + Function::New(env, unsubscribe) + ); + return exports; +} + +NODE_API_MODULE(watcher, Init) diff --git a/tools/ui/node_modules/@parcel/watcher/src/kqueue/KqueueBackend.cc b/tools/ui/node_modules/@parcel/watcher/src/kqueue/KqueueBackend.cc new file mode 100644 index 0000000000000000000000000000000000000000..2991c32fa320cd61d5b575a49ace19cb8a940d03 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/kqueue/KqueueBackend.cc @@ -0,0 +1,306 @@ +#include +#include +#include +#include +#include +#include +#include +#include "KqueueBackend.hh" + +#if __APPLE__ +#define st_mtim st_mtimespec +#endif + +#if !defined(O_EVTONLY) +#define O_EVTONLY O_RDONLY +#endif + +#define CONVERT_TIME(ts) ((uint64_t)ts.tv_sec * 1000000000 + ts.tv_nsec) + +void KqueueBackend::start() { + if ((mKqueue = kqueue()) < 0) { + throw std::runtime_error(std::string("Unable to open kqueue: ") + strerror(errno)); + } + + // Create a pipe that we will write to when we want to end the thread. + int err = pipe(mPipe); + if (err == -1) { + throw std::runtime_error(std::string("Unable to open pipe: ") + strerror(errno)); + } + + // Subscribe kqueue to this pipe. + struct kevent ev; + EV_SET( + &ev, + mPipe[0], + EVFILT_READ, + EV_ADD | EV_CLEAR, + 0, + 0, + 0 + ); + + if (kevent(mKqueue, &ev, 1, NULL, 0, 0)) { + close(mPipe[0]); + close(mPipe[1]); + throw std::runtime_error(std::string("Unable to watch pipe: ") + strerror(errno)); + } + + notifyStarted(); + + struct kevent events[128]; + + while (true) { + int event_count = kevent(mKqueue, NULL, 0, events, 128, 0); + if (event_count < 0 || events[0].flags == EV_ERROR) { + throw std::runtime_error(std::string("kevent error: ") + strerror(errno)); + } + + // Track all of the watchers that are touched so we can notify them at the end of the events. + std::unordered_set watchers; + + for (int i = 0; i < event_count; i++) { + int flags = events[i].fflags; + int fd = events[i].ident; + if (fd == mPipe[0]) { + // pipe was written to. break out of the loop. + goto done; + } + + auto it = mFdToEntry.find(fd); + if (it == mFdToEntry.end()) { + // If fd wasn't in our map, we may have already stopped watching it. Ignore the event. + continue; + } + + DirEntry *entry = it->second; + + if (flags & NOTE_WRITE && entry && entry->isDir) { + // If a write occurred on a directory, we have to diff the contents of that + // directory to determine what file was added/deleted. + compareDir(fd, entry->path, watchers); + } else { + std::vector subs = findSubscriptions(entry->path); + for (auto it = subs.begin(); it != subs.end(); it++) { + KqueueSubscription *sub = *it; + watchers.insert(sub->watcher); + if (flags & (NOTE_DELETE | NOTE_RENAME | NOTE_REVOKE)) { + sub->watcher->mEvents.remove(sub->path); + sub->tree->remove(sub->path); + mFdToEntry.erase((int)(size_t)entry->state); + mSubscriptions.erase(sub->path); + } else if (flags & (NOTE_WRITE | NOTE_ATTRIB | NOTE_EXTEND)) { + struct stat st; + lstat(sub->path.c_str(), &st); + if (entry->mtime != CONVERT_TIME(st.st_mtim)) { + entry->mtime = CONVERT_TIME(st.st_mtim); + sub->watcher->mEvents.update(sub->path); + } + } + } + } + } + + for (auto it = watchers.begin(); it != watchers.end(); it++) { + (*it)->notify(); + } + } + +done: + close(mPipe[0]); + close(mPipe[1]); + mEndedSignal.notify(); +} + +KqueueBackend::~KqueueBackend() { + write(mPipe[1], "X", 1); + mEndedSignal.wait(); +} + +void KqueueBackend::subscribe(WatcherRef watcher) { + // Build a full directory tree recursively, and watch each directory. + std::shared_ptr tree = getTree(watcher); + + for (auto it = tree->entries.begin(); it != tree->entries.end(); it++) { + bool success = watchDir(watcher, it->second.path, tree); + if (!success) { + throw WatcherError(std::string("error watching " + watcher->mDir + ": " + strerror(errno)), watcher); + } + } +} + +bool KqueueBackend::watchDir(WatcherRef watcher, std::string path, std::shared_ptr tree) { + if (watcher->isIgnored(path)) { + return false; + } + + DirEntry *entry = tree->find(path); + if (!entry) { + return false; + } + + KqueueSubscription sub = { + .watcher = watcher, + .path = path, + .tree = tree + }; + + if (!entry->state) { + int fd = open(path.c_str(), O_EVTONLY); + if (fd <= 0) { + return false; + } + + struct kevent event; + EV_SET( + &event, + fd, + EVFILT_VNODE, + EV_ADD | EV_CLEAR | EV_ENABLE, + NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_ATTRIB | NOTE_RENAME | NOTE_REVOKE, + 0, + 0 + ); + + if (kevent(mKqueue, &event, 1, NULL, 0, 0)) { + close(fd); + return false; + } + + entry->state = (void *)(size_t)fd; + mFdToEntry.emplace(fd, entry); + } + + sub.fd = (int)(size_t)entry->state; + mSubscriptions.emplace(path, sub); + return true; +} + +std::vector KqueueBackend::findSubscriptions(std::string &path) { + // Find the subscriptions affected by this path. + // Copy pointers to them into a vector so that modifying mSubscriptions doesn't invalidate the iterator. + auto range = mSubscriptions.equal_range(path); + std::vector subs; + for (auto it = range.first; it != range.second; it++) { + subs.push_back(&it->second); + } + + return subs; +} + +bool KqueueBackend::compareDir(int fd, std::string &path, std::unordered_set &watchers) { + // macOS doesn't support fdclosedir, so we have to duplicate the file descriptor + // to ensure the closedir doesn't also stop watching. + #if __APPLE__ + fd = dup(fd); + #endif + + DIR *dir = fdopendir(fd); + if (dir == NULL) { + return false; + } + + // fdopendir doesn't rewind to the beginning. + rewinddir(dir); + + std::vector subs = findSubscriptions(path); + std::string dirStart = path + DIR_SEP; + + std::unordered_set> trees; + for (auto it = subs.begin(); it != subs.end(); it++) { + trees.emplace((*it)->tree); + } + + std::unordered_set entries; + struct dirent *entry; + while ((entry = readdir(dir))) { + if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) { + continue; + } + + std::string fullpath = dirStart + entry->d_name; + entries.emplace(fullpath); + + for (auto it = trees.begin(); it != trees.end(); it++) { + std::shared_ptr tree = *it; + if (!tree->find(fullpath)) { + struct stat st; + fstatat(fd, entry->d_name, &st, AT_SYMLINK_NOFOLLOW); + tree->add(fullpath, CONVERT_TIME(st.st_mtim), S_ISDIR(st.st_mode)); + + // Notify all watchers with the same tree. + for (auto i = subs.begin(); i != subs.end(); i++) { + KqueueSubscription *sub = *i; + if (sub->tree == tree) { + if (sub->watcher->isIgnored(fullpath)) { + continue; + } + + sub->watcher->mEvents.create(fullpath); + watchers.emplace(sub->watcher); + + bool success = watchDir(sub->watcher, fullpath, sub->tree); + if (!success) { + sub->tree->remove(fullpath); + return false; + } + } + } + } + } + } + + for (auto it = trees.begin(); it != trees.end(); it++) { + std::shared_ptr tree = *it; + for (auto entry = tree->entries.begin(); entry != tree->entries.end();) { + + if ( + entry->first.rfind(dirStart, 0) == 0 && + entry->first.find(DIR_SEP, dirStart.length()) == std::string::npos && + entries.count(entry->first) == 0 + ) { + // Notify all watchers with the same tree. + for (auto i = subs.begin(); i != subs.end(); i++) { + if ((*i)->tree == tree) { + KqueueSubscription *sub = *i; + if (!sub->watcher->isIgnored(entry->first)) { + sub->watcher->mEvents.remove(entry->first); + watchers.emplace(sub->watcher); + } + } + } + + mFdToEntry.erase((int)(size_t)entry->second.state); + mSubscriptions.erase(entry->first); + entry = tree->entries.erase(entry); + } else { + entry++; + } + } + } + + #if __APPLE__ + closedir(dir); + #else + fdclosedir(dir); + #endif + + return true; +} + +void KqueueBackend::unsubscribe(WatcherRef watcher) { + // Find any subscriptions pointing to this watcher, and remove them. + for (auto it = mSubscriptions.begin(); it != mSubscriptions.end();) { + if (it->second.watcher.get() == watcher.get()) { + if (mSubscriptions.count(it->first) == 1) { + // Closing the file descriptor automatically unwatches it in the kqueue. + close(it->second.fd); + mFdToEntry.erase(it->second.fd); + } + + it = mSubscriptions.erase(it); + } else { + it++; + } + } +} diff --git a/tools/ui/node_modules/@parcel/watcher/src/kqueue/KqueueBackend.hh b/tools/ui/node_modules/@parcel/watcher/src/kqueue/KqueueBackend.hh new file mode 100644 index 0000000000000000000000000000000000000000..3c6a9cdd5c1de26b0eb5c5f2835409098fb601ae --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/kqueue/KqueueBackend.hh @@ -0,0 +1,35 @@ +#ifndef KQUEUE_H +#define KQUEUE_H + +#include +#include +#include "../shared/BruteForceBackend.hh" +#include "../DirTree.hh" +#include "../Signal.hh" + +struct KqueueSubscription { + WatcherRef watcher; + std::string path; + std::shared_ptr tree; + int fd; +}; + +class KqueueBackend : public BruteForceBackend { +public: + void start() override; + ~KqueueBackend(); + void subscribe(WatcherRef watcher) override; + void unsubscribe(WatcherRef watcher) override; +private: + int mKqueue; + int mPipe[2]; + std::unordered_multimap mSubscriptions; + std::unordered_map mFdToEntry; + Signal mEndedSignal; + + bool watchDir(WatcherRef watcher, std::string path, std::shared_ptr tree); + bool compareDir(int fd, std::string &dir, std::unordered_set &watchers); + std::vector findSubscriptions(std::string &path); +}; + +#endif diff --git a/tools/ui/node_modules/@parcel/watcher/src/linux/InotifyBackend.cc b/tools/ui/node_modules/@parcel/watcher/src/linux/InotifyBackend.cc new file mode 100644 index 0000000000000000000000000000000000000000..949f49853befb3325eaddaac59c84a441247c13d --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/linux/InotifyBackend.cc @@ -0,0 +1,236 @@ +#include +#include +#include +#include +#include +#include "InotifyBackend.hh" + +#define INOTIFY_MASK \ + IN_ATTRIB | IN_CREATE | IN_DELETE | \ + IN_DELETE_SELF | IN_MODIFY | IN_MOVE_SELF | IN_MOVED_FROM | \ + IN_MOVED_TO | IN_DONT_FOLLOW | IN_ONLYDIR | IN_EXCL_UNLINK +#define BUFFER_SIZE 8192 +#define CONVERT_TIME(ts) ((uint64_t)ts.tv_sec * 1000000000 + ts.tv_nsec) + +void InotifyBackend::start() { + // Create a pipe that we will write to when we want to end the thread. + int err = pipe2(mPipe, O_CLOEXEC | O_NONBLOCK); + if (err == -1) { + throw std::runtime_error(std::string("Unable to open pipe: ") + strerror(errno)); + } + + // Init inotify file descriptor. + mInotify = inotify_init1(IN_NONBLOCK | IN_CLOEXEC); + if (mInotify == -1) { + throw std::runtime_error(std::string("Unable to initialize inotify: ") + strerror(errno)); + } + + pollfd pollfds[2]; + pollfds[0].fd = mPipe[0]; + pollfds[0].events = POLLIN; + pollfds[0].revents = 0; + pollfds[1].fd = mInotify; + pollfds[1].events = POLLIN; + pollfds[1].revents = 0; + + notifyStarted(); + + // Loop until we get an event from the pipe. + while (true) { + int result = poll(pollfds, 2, 500); + if (result < 0) { + throw std::runtime_error(std::string("Unable to poll: ") + strerror(errno)); + } + + if (pollfds[0].revents) { + break; + } + + if (pollfds[1].revents) { + handleEvents(); + } + } + + close(mPipe[0]); + close(mPipe[1]); + close(mInotify); + + mEndedSignal.notify(); +} + +InotifyBackend::~InotifyBackend() { + write(mPipe[1], "X", 1); + mEndedSignal.wait(); +} + +// This function is called by Backend::watch which takes a lock on mMutex +void InotifyBackend::subscribe(WatcherRef watcher) { + // Build a full directory tree recursively, and watch each directory. + std::shared_ptr tree = getTree(watcher); + + for (auto it = tree->entries.begin(); it != tree->entries.end(); it++) { + if (it->second.isDir) { + bool success = watchDir(watcher, it->second.path, tree); + if (!success) { + throw WatcherError(std::string("inotify_add_watch on '") + it->second.path + std::string("' failed: ") + strerror(errno), watcher); + } + } + } +} + +bool InotifyBackend::watchDir(WatcherRef watcher, std::string path, std::shared_ptr tree) { + int wd = inotify_add_watch(mInotify, path.c_str(), INOTIFY_MASK); + if (wd == -1) { + return false; + } + + std::shared_ptr sub = std::make_shared(); + sub->tree = tree; + sub->path = path; + sub->watcher = watcher; + mSubscriptions.emplace(wd, sub); + + return true; +} + +void InotifyBackend::handleEvents() { + char buf[BUFFER_SIZE] __attribute__ ((aligned(__alignof__(struct inotify_event))));; + struct inotify_event *event; + + // Track all of the watchers that are touched so we can notify them at the end of the events. + std::unordered_set watchers; + + while (true) { + int n = read(mInotify, &buf, BUFFER_SIZE); + if (n < 0) { + if (errno == EAGAIN || errno == EWOULDBLOCK) { + break; + } + + throw std::runtime_error(std::string("Error reading from inotify: ") + strerror(errno)); + } + + if (n == 0) { + break; + } + + for (char *ptr = buf; ptr < buf + n; ptr += sizeof(*event) + event->len) { + event = (struct inotify_event *)ptr; + + if ((event->mask & IN_Q_OVERFLOW) == IN_Q_OVERFLOW) { + // overflow + continue; + } + + handleEvent(event, watchers); + } + } + + for (auto it = watchers.begin(); it != watchers.end(); it++) { + (*it)->notify(); + } +} + +void InotifyBackend::handleEvent(struct inotify_event *event, std::unordered_set &watchers) { + std::unique_lock lock(mMutex); + + // Find the subscriptions for this watch descriptor + auto range = mSubscriptions.equal_range(event->wd); + std::unordered_set> set; + for (auto it = range.first; it != range.second; it++) { + set.insert(it->second); + } + + for (auto it = set.begin(); it != set.end(); it++) { + if (handleSubscription(event, *it)) { + watchers.insert((*it)->watcher); + } + } +} + +bool InotifyBackend::handleSubscription(struct inotify_event *event, std::shared_ptr sub) { + // Build full path and check if its in our ignore list. + std::shared_ptr watcher = sub->watcher; + std::string path = std::string(sub->path); + bool isDir = event->mask & IN_ISDIR; + + if (event->len > 0) { + path += "/" + std::string(event->name); + } + + if (watcher->isIgnored(path)) { + return false; + } + + // If this is a create, check if it's a directory and start watching if it is. + // In any case, keep the directory tree up to date. + if (event->mask & (IN_CREATE | IN_MOVED_TO)) { + watcher->mEvents.create(path); + + struct stat st; + // Use lstat to avoid resolving symbolic links that we cannot watch anyway + // https://github.com/parcel-bundler/watcher/issues/76 + if (lstat(path.c_str(), &st) != 0) { + return false; + } + DirEntry *entry = sub->tree->add(path, CONVERT_TIME(st.st_mtim), S_ISDIR(st.st_mode)); + + if (entry->isDir) { + bool success = watchDir(watcher, path, sub->tree); + if (!success) { + sub->tree->remove(path); + return false; + } + } + } else if (event->mask & (IN_MODIFY | IN_ATTRIB)) { + watcher->mEvents.update(path); + + struct stat st; + if (stat(path.c_str(), &st) != 0) { + return false; + } + sub->tree->update(path, CONVERT_TIME(st.st_mtim)); + } else if (event->mask & (IN_DELETE | IN_DELETE_SELF | IN_MOVED_FROM | IN_MOVE_SELF)) { + bool isSelfEvent = (event->mask & (IN_DELETE_SELF | IN_MOVE_SELF)); + // Ignore delete/move self events unless this is the recursive watch root + if (isSelfEvent && path != watcher->mDir) { + return false; + } + + // If the entry being deleted/moved is a directory, remove it from the list of subscriptions + // XXX: self events don't have the IN_ISDIR mask + if (isSelfEvent || isDir) { + for (auto it = mSubscriptions.begin(); it != mSubscriptions.end();) { + if (it->second->path == path) { + it = mSubscriptions.erase(it); + } else { + ++it; + } + } + } + + watcher->mEvents.remove(path); + sub->tree->remove(path); + } + + return true; +} + +// This function is called by Backend::unwatch which takes a lock on mMutex +void InotifyBackend::unsubscribe(WatcherRef watcher) { + // Find any subscriptions pointing to this watcher, and remove them. + for (auto it = mSubscriptions.begin(); it != mSubscriptions.end();) { + if (it->second->watcher.get() == watcher.get()) { + if (mSubscriptions.count(it->first) == 1) { + int err = inotify_rm_watch(mInotify, it->first); + if (err == -1) { + throw WatcherError(std::string("Unable to remove watcher: ") + strerror(errno), watcher); + } + } + + it = mSubscriptions.erase(it); + } else { + it++; + } + } +} diff --git a/tools/ui/node_modules/@parcel/watcher/src/linux/InotifyBackend.hh b/tools/ui/node_modules/@parcel/watcher/src/linux/InotifyBackend.hh new file mode 100644 index 0000000000000000000000000000000000000000..f34cd1f00702a70c21b3c7fe8362b3acc258d206 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/linux/InotifyBackend.hh @@ -0,0 +1,34 @@ +#ifndef INOTIFY_H +#define INOTIFY_H + +#include +#include +#include "../shared/BruteForceBackend.hh" +#include "../DirTree.hh" +#include "../Signal.hh" + +struct InotifySubscription { + std::shared_ptr tree; + std::string path; + WatcherRef watcher; +}; + +class InotifyBackend : public BruteForceBackend { +public: + void start() override; + ~InotifyBackend(); + void subscribe(WatcherRef watcher) override; + void unsubscribe(WatcherRef watcher) override; +private: + int mPipe[2]; + int mInotify; + std::unordered_multimap> mSubscriptions; + Signal mEndedSignal; + + bool watchDir(WatcherRef watcher, std::string path, std::shared_ptr tree); + void handleEvents(); + void handleEvent(struct inotify_event *event, std::unordered_set &watchers); + bool handleSubscription(struct inotify_event *event, std::shared_ptr sub); +}; + +#endif diff --git a/tools/ui/node_modules/@parcel/watcher/src/macos/FSEventsBackend.cc b/tools/ui/node_modules/@parcel/watcher/src/macos/FSEventsBackend.cc new file mode 100644 index 0000000000000000000000000000000000000000..cfda9625fc7d9beb00a0014d87333bf97c130c84 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/macos/FSEventsBackend.cc @@ -0,0 +1,338 @@ +#include +#include +#include +#include +#include +#include "../Event.hh" +#include "../Backend.hh" +#include "./FSEventsBackend.hh" +#include "../Watcher.hh" + +#define CONVERT_TIME(ts) ((uint64_t)ts.tv_sec * 1000000000 + ts.tv_nsec) +#define IGNORED_FLAGS (kFSEventStreamEventFlagItemIsHardlink | kFSEventStreamEventFlagItemIsLastHardlink | kFSEventStreamEventFlagItemIsSymlink | kFSEventStreamEventFlagItemIsDir | kFSEventStreamEventFlagItemIsFile) + +void stopStream(FSEventStreamRef stream, CFRunLoopRef runLoop) { + FSEventStreamStop(stream); + FSEventStreamUnscheduleFromRunLoop(stream, runLoop, kCFRunLoopDefaultMode); + FSEventStreamInvalidate(stream); + FSEventStreamRelease(stream); +} + +// macOS has a case insensitive file system by default. In order to detect +// file renames that only affect case, we need to get the canonical path +// and compare it with the input path to determine if a file was created or deleted. +bool pathExists(char *path) { + int fd = open(path, O_RDONLY | O_SYMLINK); + if (fd == -1) { + return false; + } + + char buf[PATH_MAX]; + if (fcntl(fd, F_GETPATH, buf) == -1) { + close(fd); + return false; + } + + bool res = strncmp(path, buf, PATH_MAX) == 0; + close(fd); + return res; +} + +class State: public WatcherState { +public: + FSEventStreamRef stream; + std::shared_ptr tree; + uint64_t since; +}; + +void FSEventsCallback( + ConstFSEventStreamRef streamRef, + void *clientCallBackInfo, + size_t numEvents, + void *eventPaths, + const FSEventStreamEventFlags eventFlags[], + const FSEventStreamEventId eventIds[] +) { + char **paths = (char **)eventPaths; + std::shared_ptr& watcher = *static_cast *>(clientCallBackInfo); + + EventList& list = watcher->mEvents; + if (watcher->state == nullptr) { + return; + } + + auto stateGuard = watcher->state; + auto* state = static_cast(stateGuard.get()); + uint64_t since = state->since; + bool deletedRoot = false; + + for (size_t i = 0; i < numEvents; ++i) { + bool isCreated = (eventFlags[i] & kFSEventStreamEventFlagItemCreated) == kFSEventStreamEventFlagItemCreated; + bool isRemoved = (eventFlags[i] & kFSEventStreamEventFlagItemRemoved) == kFSEventStreamEventFlagItemRemoved; + bool isModified = (eventFlags[i] & kFSEventStreamEventFlagItemModified) == kFSEventStreamEventFlagItemModified || + (eventFlags[i] & kFSEventStreamEventFlagItemInodeMetaMod) == kFSEventStreamEventFlagItemInodeMetaMod || + (eventFlags[i] & kFSEventStreamEventFlagItemFinderInfoMod) == kFSEventStreamEventFlagItemFinderInfoMod || + (eventFlags[i] & kFSEventStreamEventFlagItemChangeOwner) == kFSEventStreamEventFlagItemChangeOwner || + (eventFlags[i] & kFSEventStreamEventFlagItemXattrMod) == kFSEventStreamEventFlagItemXattrMod; + bool isRenamed = (eventFlags[i] & kFSEventStreamEventFlagItemRenamed) == kFSEventStreamEventFlagItemRenamed; + bool isDone = (eventFlags[i] & kFSEventStreamEventFlagHistoryDone) == kFSEventStreamEventFlagHistoryDone; + bool isDir = (eventFlags[i] & kFSEventStreamEventFlagItemIsDir) == kFSEventStreamEventFlagItemIsDir; + + + if (eventFlags[i] & kFSEventStreamEventFlagMustScanSubDirs) { + if (eventFlags[i] & kFSEventStreamEventFlagUserDropped) { + list.error("Events were dropped by the FSEvents client. File system must be re-scanned."); + } else if (eventFlags[i] & kFSEventStreamEventFlagKernelDropped) { + list.error("Events were dropped by the kernel. File system must be re-scanned."); + } else { + list.error("Too many events. File system must be re-scanned."); + } + } + + if (isDone) { + watcher->notify(); + break; + } + + auto ignoredFlags = IGNORED_FLAGS; + if (__builtin_available(macOS 10.13, *)) { + ignoredFlags |= kFSEventStreamEventFlagItemCloned; + } + + // If we don't care about any of the flags that are set, ignore this event. + if ((eventFlags[i] & ~ignoredFlags) == 0) { + continue; + } + + // FSEvents exclusion paths only apply to files, not directories. + if (watcher->isIgnored(paths[i])) { + continue; + } + + // Handle unambiguous events first + if (isCreated && !(isRemoved || isModified || isRenamed)) { + state->tree->add(paths[i], 0, isDir); + list.create(paths[i]); + } else if (isRemoved && !(isCreated || isModified || isRenamed)) { + state->tree->remove(paths[i]); + list.remove(paths[i]); + if (paths[i] == watcher->mDir) { + deletedRoot = true; + } + } else if (isModified && !(isCreated || isRemoved || isRenamed)) { + struct stat file; + if (stat(paths[i], &file)) { + continue; + } + + // Ignore if mtime is the same as the last event. + // This prevents duplicate events from being emitted. + // If tv_nsec is zero, the file system probably only has second-level + // granularity so allow the even through in that case. + uint64_t mtime = CONVERT_TIME(file.st_mtimespec); + DirEntry *entry = state->tree->find(paths[i]); + if (entry && mtime == entry->mtime && file.st_mtimespec.tv_nsec != 0) { + continue; + } + + if (entry) { + // Update mtime. + entry->mtime = mtime; + } else { + // Add to tree if this path has not been discovered yet. + state->tree->add(paths[i], mtime, S_ISDIR(file.st_mode)); + } + + list.update(paths[i]); + } else { + // If multiple flags were set, then we need to call `stat` to determine if the file really exists. + // This helps disambiguate creates, updates, and deletes. + struct stat file; + if (stat(paths[i], &file) || !pathExists(paths[i])) { + // File does not exist, so we have to assume it was removed. This is not exact since the + // flags set by fsevents get coalesced together (e.g. created & deleted), so there is no way to + // know whether the create and delete both happened since our snapshot (in which case + // we'd rather ignore this event completely). This will result in some extra delete events + // being emitted for files we don't know about, but that is the best we can do. + state->tree->remove(paths[i]); + list.remove(paths[i]); + if (paths[i] == watcher->mDir) { + deletedRoot = true; + } + continue; + } + + // If the file was modified, and existed before, then this is an update, otherwise a create. + uint64_t ctime = CONVERT_TIME(file.st_birthtimespec); + uint64_t mtime = CONVERT_TIME(file.st_mtimespec); + DirEntry *entry = !since ? state->tree->find(paths[i]) : NULL; + if (entry && entry->mtime == mtime && file.st_mtimespec.tv_nsec != 0) { + continue; + } + + // Some mounted file systems report a creation time of 0/unix epoch which we special case. + if (isModified && (entry || (ctime <= since && ctime != 0))) { + state->tree->update(paths[i], mtime); + list.update(paths[i]); + } else { + state->tree->add(paths[i], mtime, S_ISDIR(file.st_mode)); + list.create(paths[i]); + } + } + } + + if (!since) { + watcher->notify(); + } + + // Stop watching if the root directory was deleted. + if (deletedRoot) { + stopStream((FSEventStreamRef)streamRef, CFRunLoopGetCurrent()); + watcher->state = nullptr; + } +} + +void checkWatcher(WatcherRef watcher) { + struct stat file; + if (stat(watcher->mDir.c_str(), &file)) { + throw WatcherError(strerror(errno), watcher); + } + + if (!S_ISDIR(file.st_mode)) { + throw WatcherError(strerror(ENOTDIR), watcher); + } +} + +void FSEventsBackend::startStream(WatcherRef watcher, FSEventStreamEventId id) { + checkWatcher(watcher); + + CFAbsoluteTime latency = 0.001; + CFStringRef fileWatchPath = CFStringCreateWithCString( + NULL, + watcher->mDir.c_str(), + kCFStringEncodingUTF8 + ); + + CFArrayRef pathsToWatch = CFArrayCreate( + NULL, + (const void **)&fileWatchPath, + 1, + NULL + ); + + // Make a watcher reference we can pass into the callback. This ensures bumped ref-count. + std::shared_ptr* callbackWatcher = new std::shared_ptr (watcher); + FSEventStreamContext callbackInfo {0, static_cast (callbackWatcher), nullptr, nullptr, nullptr}; + FSEventStreamRef stream = FSEventStreamCreate( + NULL, + &FSEventsCallback, + &callbackInfo, + pathsToWatch, + id, + latency, + kFSEventStreamCreateFlagFileEvents + ); + + CFMutableArrayRef exclusions = CFArrayCreateMutable(NULL, watcher->mIgnorePaths.size(), NULL); + for (auto it = watcher->mIgnorePaths.begin(); it != watcher->mIgnorePaths.end(); it++) { + CFStringRef path = CFStringCreateWithCString( + NULL, + it->c_str(), + kCFStringEncodingUTF8 + ); + + CFArrayAppendValue(exclusions, (const void *)path); + } + + FSEventStreamSetExclusionPaths(stream, exclusions); + + FSEventStreamScheduleWithRunLoop(stream, mRunLoop, kCFRunLoopDefaultMode); + bool started = FSEventStreamStart(stream); + + CFRelease(pathsToWatch); + CFRelease(fileWatchPath); + + if (!started) { + FSEventStreamRelease(stream); + throw WatcherError("Error starting FSEvents stream", watcher); + } + + auto stateGuard = watcher->state; + State* s = static_cast(stateGuard.get()); + s->tree = std::make_shared(watcher->mDir); + s->stream = stream; +} + +void FSEventsBackend::start() { + mRunLoop = CFRunLoopGetCurrent(); + CFRetain(mRunLoop); + + // Unlock once run loop has started. + CFRunLoopPerformBlock(mRunLoop, kCFRunLoopDefaultMode, ^ { + notifyStarted(); + }); + + CFRunLoopWakeUp(mRunLoop); + CFRunLoopRun(); +} + +FSEventsBackend::~FSEventsBackend() { + std::unique_lock lock(mMutex); + CFRunLoopStop(mRunLoop); + CFRelease(mRunLoop); +} + +void FSEventsBackend::writeSnapshot(WatcherRef watcher, std::string *snapshotPath) { + std::unique_lock lock(mMutex); + checkWatcher(watcher); + + FSEventStreamEventId id = FSEventsGetCurrentEventId(); + std::ofstream ofs(*snapshotPath); + ofs << id; + ofs << "\n"; + + struct timespec now; + clock_gettime(CLOCK_REALTIME, &now); + ofs << CONVERT_TIME(now); +} + +void FSEventsBackend::getEventsSince(WatcherRef watcher, std::string *snapshotPath) { + std::unique_lock lock(mMutex); + std::ifstream ifs(*snapshotPath); + if (ifs.fail()) { + return; + } + + FSEventStreamEventId id; + uint64_t since; + ifs >> id; + ifs >> since; + + auto s = std::make_shared(); + s->since = since; + watcher->state = s; + + startStream(watcher, id); + watcher->wait(); + stopStream(s->stream, mRunLoop); + + watcher->state = nullptr; +} + +// This function is called by Backend::watch which takes a lock on mMutex +void FSEventsBackend::subscribe(WatcherRef watcher) { + auto s = std::make_shared(); + s->since = 0; + watcher->state = s; + startStream(watcher, kFSEventStreamEventIdSinceNow); +} + +// This function is called by Backend::unwatch which takes a lock on mMutex +void FSEventsBackend::unsubscribe(WatcherRef watcher) { + auto stateGuard = watcher->state; + State* s = static_cast(stateGuard.get()); + if (s != nullptr) { + stopStream(s->stream, mRunLoop); + watcher->state = nullptr; + } +} diff --git a/tools/ui/node_modules/@parcel/watcher/src/macos/FSEventsBackend.hh b/tools/ui/node_modules/@parcel/watcher/src/macos/FSEventsBackend.hh new file mode 100644 index 0000000000000000000000000000000000000000..57ded666b3ffde3ad86994bdd45d14eab04bd2a7 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/macos/FSEventsBackend.hh @@ -0,0 +1,20 @@ +#ifndef FS_EVENTS_H +#define FS_EVENTS_H + +#include +#include "../Backend.hh" + +class FSEventsBackend : public Backend { +public: + void start() override; + ~FSEventsBackend(); + void writeSnapshot(WatcherRef watcher, std::string *snapshotPath) override; + void getEventsSince(WatcherRef watcher, std::string *snapshotPath) override; + void subscribe(WatcherRef watcher) override; + void unsubscribe(WatcherRef watcher) override; +private: + void startStream(WatcherRef watcher, FSEventStreamEventId id); + CFRunLoopRef mRunLoop; +}; + +#endif diff --git a/tools/ui/node_modules/@parcel/watcher/src/shared/BruteForceBackend.cc b/tools/ui/node_modules/@parcel/watcher/src/shared/BruteForceBackend.cc new file mode 100644 index 0000000000000000000000000000000000000000..0e9b84f0aaf00328289286f8a0d405174073875d --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/shared/BruteForceBackend.cc @@ -0,0 +1,41 @@ +#include +#include "../DirTree.hh" +#include "../Event.hh" +#include "./BruteForceBackend.hh" + +std::shared_ptr BruteForceBackend::getTree(WatcherRef watcher, bool shouldRead) { + auto tree = DirTree::getCached(watcher->mDir); + + // If the tree is not complete, read it if needed. + if (!tree->isComplete && shouldRead) { + readTree(watcher, tree); + tree->isComplete = true; + } + + return tree; +} + +void BruteForceBackend::writeSnapshot(WatcherRef watcher, std::string *snapshotPath) { + std::unique_lock lock(mMutex); + auto tree = getTree(watcher); + FILE *f = fopen(snapshotPath->c_str(), "w"); + if (!f) { + throw std::runtime_error(std::string("Unable to open snapshot file: ") + strerror(errno)); + } + + tree->write(f); + fclose(f); +} + +void BruteForceBackend::getEventsSince(WatcherRef watcher, std::string *snapshotPath) { + std::unique_lock lock(mMutex); + FILE *f = fopen(snapshotPath->c_str(), "r"); + if (!f) { + throw std::runtime_error(std::string("Unable to open snapshot file: ") + strerror(errno)); + } + + DirTree snapshot{watcher->mDir, f}; + auto now = getTree(watcher); + now->getChanges(&snapshot, watcher->mEvents); + fclose(f); +} diff --git a/tools/ui/node_modules/@parcel/watcher/src/shared/BruteForceBackend.hh b/tools/ui/node_modules/@parcel/watcher/src/shared/BruteForceBackend.hh new file mode 100644 index 0000000000000000000000000000000000000000..de7a73d1e9549300408fbb56dec837720eed80d1 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/shared/BruteForceBackend.hh @@ -0,0 +1,25 @@ +#ifndef BRUTE_FORCE_H +#define BRUTE_FORCE_H + +#include "../Backend.hh" +#include "../DirTree.hh" +#include "../Watcher.hh" + +class BruteForceBackend : public Backend { +public: + void writeSnapshot(WatcherRef watcher, std::string *snapshotPath) override; + void getEventsSince(WatcherRef watcher, std::string *snapshotPath) override; + void subscribe(WatcherRef watcher) override { + throw "Brute force backend doesn't support subscriptions."; + } + + void unsubscribe(WatcherRef watcher) override { + throw "Brute force backend doesn't support subscriptions."; + } + + std::shared_ptr getTree(WatcherRef watcher, bool shouldRead = true); +private: + void readTree(WatcherRef watcher, std::shared_ptr tree); +}; + +#endif diff --git a/tools/ui/node_modules/@parcel/watcher/src/unix/fts.cc b/tools/ui/node_modules/@parcel/watcher/src/unix/fts.cc new file mode 100644 index 0000000000000000000000000000000000000000..d50c3e4931eb29a408ea29c1394a3fc977349455 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/unix/fts.cc @@ -0,0 +1,50 @@ +#include + +// weird error on linux +#ifdef __THROW +#undef __THROW +#endif +#define __THROW + +#include +#include +#include "../DirTree.hh" +#include "../shared/BruteForceBackend.hh" + +#define CONVERT_TIME(ts) ((uint64_t)ts.tv_sec * 1000000000 + ts.tv_nsec) +#if __APPLE__ +#define st_mtim st_mtimespec +#endif + +void BruteForceBackend::readTree(WatcherRef watcher, std::shared_ptr tree) { + char *paths[2] {(char *)watcher->mDir.c_str(), NULL}; + FTS *fts = fts_open(paths, FTS_NOCHDIR | FTS_PHYSICAL, NULL); + if (!fts) { + throw WatcherError(strerror(errno), watcher); + } + + FTSENT *node; + bool isRoot = true; + + while ((node = fts_read(fts)) != NULL) { + if (node->fts_errno) { + fts_close(fts); + throw WatcherError(strerror(node->fts_errno), watcher); + } + + if (isRoot && !(node->fts_info & FTS_D)) { + fts_close(fts); + throw WatcherError(strerror(ENOTDIR), watcher); + } + + if (watcher->isIgnored(std::string(node->fts_path))) { + fts_set(fts, node, FTS_SKIP); + continue; + } + + tree->add(node->fts_path, CONVERT_TIME(node->fts_statp->st_mtim), (node->fts_info & FTS_D) == FTS_D); + isRoot = false; + } + + fts_close(fts); +} diff --git a/tools/ui/node_modules/@parcel/watcher/src/unix/legacy.cc b/tools/ui/node_modules/@parcel/watcher/src/unix/legacy.cc new file mode 100644 index 0000000000000000000000000000000000000000..60490c637c4cabfc2825ec3ec970d9eab53252e7 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/unix/legacy.cc @@ -0,0 +1,77 @@ +#include + +// weird error on linux +#ifdef __THROW +#undef __THROW +#endif +#define __THROW + +#ifdef _LIBC +# include +#else +# include +#endif +#include +#include +#include + +#include "../DirTree.hh" +#include "../shared/BruteForceBackend.hh" + +#define CONVERT_TIME(ts) ((uint64_t)ts.tv_sec * 1000000000 + ts.tv_nsec) +#if __APPLE__ +#define st_mtim st_mtimespec +#endif +#define ISDOT(a) (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2]))) + +void iterateDir(WatcherRef watcher, const std::shared_ptr tree, const char *relative, int parent_fd, const std::string &dirname) { + int open_flags = (O_RDONLY | O_CLOEXEC | O_DIRECTORY | O_NOCTTY | O_NONBLOCK | O_NOFOLLOW); + int new_fd = openat(parent_fd, relative, open_flags); + if (new_fd == -1) { + if (errno == EACCES) { + return; // ignore insufficient permissions + } + + throw WatcherError(strerror(errno), watcher); + } + + struct stat rootAttributes; + fstatat(new_fd, ".", &rootAttributes, AT_SYMLINK_NOFOLLOW); + tree->add(dirname, CONVERT_TIME(rootAttributes.st_mtim), true); + + if (DIR *dir = fdopendir(new_fd)) { + while (struct dirent *ent = (errno = 0, readdir(dir))) { + if (ISDOT(ent->d_name)) continue; + + std::string fullPath = dirname + "/" + ent->d_name; + + if (!watcher->isIgnored(fullPath)) { + struct stat attrib; + fstatat(new_fd, ent->d_name, &attrib, AT_SYMLINK_NOFOLLOW); + bool isDir = ent->d_type == DT_DIR; + + if (isDir) { + iterateDir(watcher, tree, ent->d_name, new_fd, fullPath); + } else { + tree->add(fullPath, CONVERT_TIME(attrib.st_mtim), isDir); + } + } + } + + closedir(dir); + } else { + close(new_fd); + } + + if (errno) { + throw WatcherError(strerror(errno), watcher); + } +} + +void BruteForceBackend::readTree(WatcherRef watcher, std::shared_ptr tree) { + int fd = open(watcher->mDir.c_str(), O_RDONLY); + if (fd) { + iterateDir(watcher, tree, ".", fd, watcher->mDir); + close(fd); + } +} diff --git a/tools/ui/node_modules/@parcel/watcher/src/wasm/WasmBackend.cc b/tools/ui/node_modules/@parcel/watcher/src/wasm/WasmBackend.cc new file mode 100644 index 0000000000000000000000000000000000000000..9514109cf25f1f534759699bf52def8a111576d1 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/wasm/WasmBackend.cc @@ -0,0 +1,132 @@ +#include +#include "WasmBackend.hh" + +#define CONVERT_TIME(ts) ((uint64_t)ts.tv_sec * 1000000000 + ts.tv_nsec) + +void WasmBackend::start() { + notifyStarted(); +} + +void WasmBackend::subscribe(WatcherRef watcher) { + // Build a full directory tree recursively, and watch each directory. + std::shared_ptr tree = getTree(watcher); + + for (auto it = tree->entries.begin(); it != tree->entries.end(); it++) { + if (it->second.isDir) { + watchDir(watcher, it->second.path, tree); + } + } +} + +void WasmBackend::watchDir(WatcherRef watcher, std::string path, std::shared_ptr tree) { + int wd = wasm_backend_add_watch(path.c_str(), (void *)this); + std::shared_ptr sub = std::make_shared(); + sub->tree = tree; + sub->path = path; + sub->watcher = watcher; + mSubscriptions.emplace(wd, sub); +} + +extern "C" void wasm_backend_event_handler(void *backend, int wd, int type, char *filename) { + WasmBackend *b = (WasmBackend *)(backend); + b->handleEvent(wd, type, filename); +} + +void WasmBackend::handleEvent(int wd, int type, char *filename) { + // Find the subscriptions for this watch descriptor + auto range = mSubscriptions.equal_range(wd); + std::unordered_set> set; + for (auto it = range.first; it != range.second; it++) { + set.insert(it->second); + } + + for (auto it = set.begin(); it != set.end(); it++) { + if (handleSubscription(type, filename, *it)) { + (*it)->watcher->notify(); + } + } +} + +bool WasmBackend::handleSubscription(int type, char *filename, std::shared_ptr sub) { + // Build full path and check if its in our ignore list. + WatcherRef watcher = sub->watcher; + std::string path = std::string(sub->path); + + if (filename[0] != '\0') { + path += "/" + std::string(filename); + } + + if (watcher->isIgnored(path)) { + return false; + } + + if (type == 1) { + struct stat st; + stat(path.c_str(), &st); + sub->tree->update(path, CONVERT_TIME(st.st_mtim)); + watcher->mEvents.update(path); + } else if (type == 2) { + // Determine if this is a create or delete depending on if the file exists or not. + struct stat st; + if (lstat(path.c_str(), &st)) { + // If the entry being deleted/moved is a directory, remove it from the list of subscriptions + DirEntry *entry = sub->tree->find(path); + if (!entry) { + return false; + } + + if (entry->isDir) { + std::string pathStart = path + DIR_SEP; + for (auto it = mSubscriptions.begin(); it != mSubscriptions.end();) { + if (it->second->path == path || it->second->path.rfind(pathStart, 0) == 0) { + wasm_backend_remove_watch(it->first); + it = mSubscriptions.erase(it); + } else { + ++it; + } + } + + // Remove all sub-entries + for (auto it = sub->tree->entries.begin(); it != sub->tree->entries.end();) { + if (it->first.rfind(pathStart, 0) == 0) { + watcher->mEvents.remove(it->first); + it = sub->tree->entries.erase(it); + } else { + it++; + } + } + } + + watcher->mEvents.remove(path); + sub->tree->remove(path); + } else if (sub->tree->find(path)) { + sub->tree->update(path, CONVERT_TIME(st.st_mtim)); + watcher->mEvents.update(path); + } else { + watcher->mEvents.create(path); + + // If this is a create, check if it's a directory and start watching if it is. + DirEntry *entry = sub->tree->add(path, CONVERT_TIME(st.st_mtim), S_ISDIR(st.st_mode)); + if (entry->isDir) { + watchDir(watcher, path, sub->tree); + } + } + } + + return true; +} + +void WasmBackend::unsubscribe(WatcherRef watcher) { + // Find any subscriptions pointing to this watcher, and remove them. + for (auto it = mSubscriptions.begin(); it != mSubscriptions.end();) { + if (it->second->watcher.get() == watcher.get()) { + if (mSubscriptions.count(it->first) == 1) { + wasm_backend_remove_watch(it->first); + } + + it = mSubscriptions.erase(it); + } else { + it++; + } + } +} diff --git a/tools/ui/node_modules/@parcel/watcher/src/wasm/WasmBackend.hh b/tools/ui/node_modules/@parcel/watcher/src/wasm/WasmBackend.hh new file mode 100644 index 0000000000000000000000000000000000000000..9facac855069d61fe5f2cd2420472c668cc38e51 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/wasm/WasmBackend.hh @@ -0,0 +1,34 @@ +#ifndef WASM_H +#define WASM_H + +#include +#include "../shared/BruteForceBackend.hh" +#include "../DirTree.hh" + +extern "C" { + int wasm_backend_add_watch(const char *filename, void *backend); + void wasm_backend_remove_watch(int wd); + void wasm_backend_event_handler(void *backend, int wd, int type, char *filename); +}; + +struct WasmSubscription { + std::shared_ptr tree; + std::string path; + WatcherRef watcher; +}; + +class WasmBackend : public BruteForceBackend { +public: + void start() override; + void subscribe(WatcherRef watcher) override; + void unsubscribe(WatcherRef watcher) override; + void handleEvent(int wd, int type, char *filename); +private: + int mWasm; + std::unordered_multimap> mSubscriptions; + + void watchDir(WatcherRef watcher, std::string path, std::shared_ptr tree); + bool handleSubscription(int type, char *filename, std::shared_ptr sub); +}; + +#endif diff --git a/tools/ui/node_modules/@parcel/watcher/src/wasm/include.h b/tools/ui/node_modules/@parcel/watcher/src/wasm/include.h new file mode 100644 index 0000000000000000000000000000000000000000..60e4d65763ffdd50ff8b8c0bdcf657f53c2e3ca5 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/wasm/include.h @@ -0,0 +1,74 @@ +/* +Copyright Node.js contributors. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to +deal in the Software without restriction, including without limitation the +rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +sell copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. +*/ + +// Node does not include the headers for these functions when compiling for WASM, so add them here. +#ifdef __wasm32__ +extern "C" { +NAPI_EXTERN napi_status NAPI_CDECL +napi_create_threadsafe_function(napi_env env, + napi_value func, + napi_value async_resource, + napi_value async_resource_name, + size_t max_queue_size, + size_t initial_thread_count, + void* thread_finalize_data, + napi_finalize thread_finalize_cb, + void* context, + napi_threadsafe_function_call_js call_js_cb, + napi_threadsafe_function* result); + +NAPI_EXTERN napi_status NAPI_CDECL napi_get_threadsafe_function_context( + napi_threadsafe_function func, void** result); + +NAPI_EXTERN napi_status NAPI_CDECL +napi_call_threadsafe_function(napi_threadsafe_function func, + void* data, + napi_threadsafe_function_call_mode is_blocking); + +NAPI_EXTERN napi_status NAPI_CDECL +napi_acquire_threadsafe_function(napi_threadsafe_function func); + +NAPI_EXTERN napi_status NAPI_CDECL napi_release_threadsafe_function( + napi_threadsafe_function func, napi_threadsafe_function_release_mode mode); + +NAPI_EXTERN napi_status NAPI_CDECL +napi_unref_threadsafe_function(napi_env env, napi_threadsafe_function func); + +NAPI_EXTERN napi_status NAPI_CDECL +napi_ref_threadsafe_function(napi_env env, napi_threadsafe_function func); + +NAPI_EXTERN napi_status NAPI_CDECL +napi_create_async_work(napi_env env, + napi_value async_resource, + napi_value async_resource_name, + napi_async_execute_callback execute, + napi_async_complete_callback complete, + void* data, + napi_async_work* result); +NAPI_EXTERN napi_status NAPI_CDECL napi_delete_async_work(napi_env env, + napi_async_work work); +NAPI_EXTERN napi_status NAPI_CDECL napi_queue_async_work(napi_env env, + napi_async_work work); +NAPI_EXTERN napi_status NAPI_CDECL napi_cancel_async_work(napi_env env, + napi_async_work work); +} +#endif diff --git a/tools/ui/node_modules/@parcel/watcher/src/watchman/BSER.cc b/tools/ui/node_modules/@parcel/watcher/src/watchman/BSER.cc new file mode 100644 index 0000000000000000000000000000000000000000..82390dd8b8ea78c2f5632b3db0fc75521b66c3fa --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/watchman/BSER.cc @@ -0,0 +1,302 @@ +#include +#include "./BSER.hh" + +BSERType decodeType(std::istream &iss) { + int8_t type; + iss.read(reinterpret_cast(&type), sizeof(type)); + return (BSERType) type; +} + +void expectType(std::istream &iss, BSERType expected) { + BSERType got = decodeType(iss); + if (got != expected) { + throw std::runtime_error("Unexpected BSER type"); + } +} + +void encodeType(std::ostream &oss, BSERType type) { + int8_t t = (int8_t)type; + oss.write(reinterpret_cast(&t), sizeof(t)); +} + +template +class Value : public BSERValue { +public: + T value; + Value(T val) { + value = val; + } + + Value() {} +}; + +class BSERInteger : public Value { +public: + BSERInteger(int64_t value) : Value(value) {} + BSERInteger(std::istream &iss) { + int8_t int8; + int16_t int16; + int32_t int32; + int64_t int64; + + BSERType type = decodeType(iss); + + switch (type) { + case BSER_INT8: + iss.read(reinterpret_cast(&int8), sizeof(int8)); + value = int8; + break; + case BSER_INT16: + iss.read(reinterpret_cast(&int16), sizeof(int16)); + value = int16; + break; + case BSER_INT32: + iss.read(reinterpret_cast(&int32), sizeof(int32)); + value = int32; + break; + case BSER_INT64: + iss.read(reinterpret_cast(&int64), sizeof(int64)); + value = int64; + break; + default: + throw std::runtime_error("Invalid BSER int type"); + } + } + + int64_t intValue() override { + return value; + } + + void encode(std::ostream &oss) override { + if (value <= INT8_MAX) { + encodeType(oss, BSER_INT8); + int8_t v = (int8_t)value; + oss.write(reinterpret_cast(&v), sizeof(v)); + } else if (value <= INT16_MAX) { + encodeType(oss, BSER_INT16); + int16_t v = (int16_t)value; + oss.write(reinterpret_cast(&v), sizeof(v)); + } else if (value <= INT32_MAX) { + encodeType(oss, BSER_INT32); + int32_t v = (int32_t)value; + oss.write(reinterpret_cast(&v), sizeof(v)); + } else { + encodeType(oss, BSER_INT64); + oss.write(reinterpret_cast(&value), sizeof(value)); + } + } +}; + +class BSERArray : public Value { +public: + BSERArray() : Value() {} + BSERArray(BSER::Array value) : Value(value) {} + BSERArray(std::istream &iss) { + expectType(iss, BSER_ARRAY); + int64_t len = BSERInteger(iss).intValue(); + for (int64_t i = 0; i < len; i++) { + value.push_back(BSER(iss)); + } + } + + BSER::Array arrayValue() override { + return value; + } + + void encode(std::ostream &oss) override { + encodeType(oss, BSER_ARRAY); + BSERInteger(value.size()).encode(oss); + for (auto it = value.begin(); it != value.end(); it++) { + it->encode(oss); + } + } +}; + +class BSERString : public Value { +public: + BSERString(std::string value) : Value(value) {} + BSERString(std::istream &iss) { + expectType(iss, BSER_STRING); + int64_t len = BSERInteger(iss).intValue(); + value.resize(len); + iss.read(&value[0], len); + } + + std::string stringValue() override { + return value; + } + + void encode(std::ostream &oss) override { + encodeType(oss, BSER_STRING); + BSERInteger(value.size()).encode(oss); + oss << value; + } +}; + +class BSERObject : public Value { +public: + BSERObject() : Value() {} + BSERObject(BSER::Object value) : Value(value) {} + BSERObject(std::istream &iss) { + expectType(iss, BSER_OBJECT); + int64_t len = BSERInteger(iss).intValue(); + for (int64_t i = 0; i < len; i++) { + auto key = BSERString(iss).stringValue(); + auto val = BSER(iss); + value.emplace(key, val); + } + } + + BSER::Object objectValue() override { + return value; + } + + void encode(std::ostream &oss) override { + encodeType(oss, BSER_OBJECT); + BSERInteger(value.size()).encode(oss); + for (auto it = value.begin(); it != value.end(); it++) { + BSERString(it->first).encode(oss); + it->second.encode(oss); + } + } +}; + +class BSERDouble : public Value { +public: + BSERDouble(double value) : Value(value) {} + BSERDouble(std::istream &iss) { + expectType(iss, BSER_REAL); + iss.read(reinterpret_cast(&value), sizeof(value)); + } + + double doubleValue() override { + return value; + } + + void encode(std::ostream &oss) override { + encodeType(oss, BSER_REAL); + oss.write(reinterpret_cast(&value), sizeof(value)); + } +}; + +class BSERBoolean : public Value { +public: + BSERBoolean(bool value) : Value(value) {} + bool boolValue() override { return value; } + void encode(std::ostream &oss) override { + int8_t t = value == true ? static_cast(BSER_BOOL_TRUE) : static_cast(BSER_BOOL_FALSE); + oss.write(reinterpret_cast(&t), sizeof(t)); + } +}; + +class BSERNull : public Value { +public: + BSERNull() : Value(false) {} + void encode(std::ostream &oss) override { + encodeType(oss, BSER_NULL); + } +}; + +std::shared_ptr decodeTemplate(std::istream &iss) { + expectType(iss, BSER_TEMPLATE); + auto keys = BSERArray(iss).arrayValue(); + auto len = BSERInteger(iss).intValue(); + std::shared_ptr arr = std::make_shared(); + for (int64_t i = 0; i < len; i++) { + BSER::Object obj; + for (auto it = keys.begin(); it != keys.end(); it++) { + if (iss.peek() == 0x0c) { + iss.ignore(1); + continue; + } + + auto val = BSER(iss); + obj.emplace(it->stringValue(), val); + } + arr->value.push_back(obj); + } + return arr; +} + +BSER::BSER(std::istream &iss) { + BSERType type = decodeType(iss); + iss.unget(); + + switch (type) { + case BSER_ARRAY: + m_ptr = std::make_shared(iss); + break; + case BSER_OBJECT: + m_ptr = std::make_shared(iss); + break; + case BSER_STRING: + m_ptr = std::make_shared(iss); + break; + case BSER_INT8: + case BSER_INT16: + case BSER_INT32: + case BSER_INT64: + m_ptr = std::make_shared(iss); + break; + case BSER_REAL: + m_ptr = std::make_shared(iss); + break; + case BSER_BOOL_TRUE: + iss.ignore(1); + m_ptr = std::make_shared(true); + break; + case BSER_BOOL_FALSE: + iss.ignore(1); + m_ptr = std::make_shared(false); + break; + case BSER_NULL: + iss.ignore(1); + m_ptr = std::make_shared(); + break; + case BSER_TEMPLATE: + m_ptr = decodeTemplate(iss); + break; + default: + throw std::runtime_error("unknown BSER type"); + } +} + +BSER::BSER() : m_ptr(std::make_shared()) {} +BSER::BSER(BSER::Array value) : m_ptr(std::make_shared(value)) {} +BSER::BSER(BSER::Object value) : m_ptr(std::make_shared(value)) {} +BSER::BSER(const char *value) : m_ptr(std::make_shared(value)) {} +BSER::BSER(std::string value) : m_ptr(std::make_shared(value)) {} +BSER::BSER(int64_t value) : m_ptr(std::make_shared(value)) {} +BSER::BSER(double value) : m_ptr(std::make_shared(value)) {} +BSER::BSER(bool value) : m_ptr(std::make_shared(value)) {} + +BSER::Array BSER::arrayValue() { return m_ptr->arrayValue(); } +BSER::Object BSER::objectValue() { return m_ptr->objectValue(); } +std::string BSER::stringValue() { return m_ptr->stringValue(); } +int64_t BSER::intValue() { return m_ptr->intValue(); } +double BSER::doubleValue() { return m_ptr->doubleValue(); } +bool BSER::boolValue() { return m_ptr->boolValue(); } +void BSER::encode(std::ostream &oss) { + m_ptr->encode(oss); +} + +int64_t BSER::decodeLength(std::istream &iss) { + char pdu[2]; + if (!iss.read(pdu, 2) || pdu[0] != 0 || pdu[1] != 1) { + throw std::runtime_error("Invalid BSER"); + } + + return BSERInteger(iss).intValue(); +} + +std::string BSER::encode() { + std::ostringstream oss(std::ios_base::binary); + encode(oss); + + std::ostringstream res(std::ios_base::binary); + res.write("\x00\x01", 2); + + BSERInteger(oss.str().size()).encode(res); + res << oss.str(); + return res.str(); +} diff --git a/tools/ui/node_modules/@parcel/watcher/src/watchman/BSER.hh b/tools/ui/node_modules/@parcel/watcher/src/watchman/BSER.hh new file mode 100644 index 0000000000000000000000000000000000000000..6bd202542bd570d4563f4469a7bf21faa12ef4e5 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/watchman/BSER.hh @@ -0,0 +1,69 @@ +#ifndef BSER_H +#define BSER_H + +#include +#include +#include +#include +#include + +enum BSERType { + BSER_ARRAY = 0x00, + BSER_OBJECT = 0x01, + BSER_STRING = 0x02, + BSER_INT8 = 0x03, + BSER_INT16 = 0x04, + BSER_INT32 = 0x05, + BSER_INT64 = 0x06, + BSER_REAL = 0x07, + BSER_BOOL_TRUE = 0x08, + BSER_BOOL_FALSE = 0x09, + BSER_NULL = 0x0a, + BSER_TEMPLATE = 0x0b +}; + +class BSERValue; + +class BSER { +public: + typedef std::vector Array; + typedef std::unordered_map Object; + + BSER(); + BSER(BSER::Array value); + BSER(BSER::Object value); + BSER(std::string value); + BSER(const char *value); + BSER(int64_t value); + BSER(double value); + BSER(bool value); + BSER(std::istream &iss); + + BSER::Array arrayValue(); + BSER::Object objectValue(); + std::string stringValue(); + int64_t intValue(); + double doubleValue(); + bool boolValue(); + void encode(std::ostream &oss); + + static int64_t decodeLength(std::istream &iss); + std::string encode(); +private: + std::shared_ptr m_ptr; +}; + +class BSERValue { +protected: + friend class BSER; + virtual BSER::Array arrayValue() { return BSER::Array(); } + virtual BSER::Object objectValue() { return BSER::Object(); } + virtual std::string stringValue() { return std::string(); } + virtual int64_t intValue() { return 0; } + virtual double doubleValue() { return 0; } + virtual bool boolValue() { return false; } + virtual void encode(std::ostream &oss) {} + virtual ~BSERValue() {} +}; + +#endif diff --git a/tools/ui/node_modules/@parcel/watcher/src/watchman/IPC.hh b/tools/ui/node_modules/@parcel/watcher/src/watchman/IPC.hh new file mode 100644 index 0000000000000000000000000000000000000000..94aa62fb1262cfb19c6b17a94e6bc09ea43c946f --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/watchman/IPC.hh @@ -0,0 +1,175 @@ +#ifndef IPC_H +#define IPC_H + +#include +#include + +#ifdef _WIN32 +#include +#include +#else +#include +#include +#include +#endif + +class IPC { +public: + IPC(std::string path) { + mStopped = false; + #ifdef _WIN32 + while (true) { + mPipe = CreateFile( + path.data(), // pipe name + GENERIC_READ | GENERIC_WRITE, // read and write access + 0, // no sharing + NULL, // default security attributes + OPEN_EXISTING, // opens existing pipe + FILE_FLAG_OVERLAPPED, // attributes + NULL // no template file + ); + + if (mPipe != INVALID_HANDLE_VALUE) { + break; + } + + if (GetLastError() != ERROR_PIPE_BUSY) { + throw std::runtime_error("Could not open pipe"); + } + + // Wait for pipe to become available if it is busy + if (!WaitNamedPipe(path.data(), 30000)) { + throw std::runtime_error("Error waiting for pipe"); + } + } + + mReader = CreateEvent(NULL, true, false, NULL); + mWriter = CreateEvent(NULL, true, false, NULL); + #else + struct sockaddr_un addr; + memset(&addr, 0, sizeof(addr)); + addr.sun_family = AF_UNIX; + strncpy(addr.sun_path, path.c_str(), sizeof(addr.sun_path) - 1); + + mSock = socket(AF_UNIX, SOCK_STREAM, 0); + if (connect(mSock, (struct sockaddr *) &addr, sizeof(struct sockaddr_un))) { + throw std::runtime_error("Error connecting to socket"); + } + #endif + } + + ~IPC() { + mStopped = true; + #ifdef _WIN32 + CancelIo(mPipe); + CloseHandle(mPipe); + CloseHandle(mReader); + CloseHandle(mWriter); + #else + shutdown(mSock, SHUT_RDWR); + #endif + } + + void write(std::string buf) { + #ifdef _WIN32 + OVERLAPPED overlapped; + overlapped.hEvent = mWriter; + bool success = WriteFile( + mPipe, // pipe handle + buf.data(), // message + static_cast(buf.size()), // message length + NULL, // bytes written + &overlapped // overlapped + ); + + if (mStopped) { + return; + } + + if (!success) { + if (GetLastError() != ERROR_IO_PENDING) { + throw std::runtime_error("Write error"); + } + } + + DWORD written; + success = GetOverlappedResult(mPipe, &overlapped, &written, true); + if (!success) { + throw std::runtime_error("GetOverlappedResult failed"); + } + + if (written != buf.size()) { + throw std::runtime_error("Wrong number of bytes written"); + } + #else + int r = 0; + for (unsigned int i = 0; i != buf.size(); i += r) { + r = ::write(mSock, &buf[i], buf.size() - i); + if (r == -1) { + if (errno == EAGAIN) { + r = 0; + } else if (mStopped) { + return; + } else { + throw std::runtime_error("Write error"); + } + } + } + #endif + } + + int read(char *buf, size_t len) { + #ifdef _WIN32 + OVERLAPPED overlapped; + overlapped.hEvent = mReader; + bool success = ReadFile( + mPipe, // pipe handle + buf, // buffer to receive reply + static_cast(len), // size of buffer + NULL, // number of bytes read + &overlapped // overlapped + ); + + if (!success && !mStopped) { + if (GetLastError() != ERROR_IO_PENDING) { + throw std::runtime_error("Read error"); + } + } + + DWORD read = 0; + success = GetOverlappedResult(mPipe, &overlapped, &read, true); + if (!success && !mStopped) { + throw std::runtime_error("GetOverlappedResult failed"); + } + + return read; + #else + int r = ::read(mSock, buf, len); + if (r == 0 && !mStopped) { + throw std::runtime_error("Socket ended unexpectedly"); + } + + if (r < 0) { + if (mStopped) { + return 0; + } + + throw std::runtime_error(strerror(errno)); + } + + return r; + #endif + } + +private: + bool mStopped; + #ifdef _WIN32 + HANDLE mPipe; + HANDLE mReader; + HANDLE mWriter; + #else + int mSock; + #endif +}; + +#endif diff --git a/tools/ui/node_modules/@parcel/watcher/src/watchman/WatchmanBackend.cc b/tools/ui/node_modules/@parcel/watcher/src/watchman/WatchmanBackend.cc new file mode 100644 index 0000000000000000000000000000000000000000..a442f160b9494eb9b666ff46384ffe8041dc6fe7 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/watchman/WatchmanBackend.cc @@ -0,0 +1,342 @@ +#include +#include +#include +#include +#include "../DirTree.hh" +#include "../Event.hh" +#include "./BSER.hh" +#include "./WatchmanBackend.hh" + +#ifdef _WIN32 +#include "../windows/win_utils.hh" +#define S_ISDIR(mode) ((mode & _S_IFDIR) == _S_IFDIR) +#define popen _popen +#define pclose _pclose +#else +#include +#define normalizePath(dir) dir +#endif + +template +BSER readBSER(T &&do_read) { + std::stringstream oss; + char buffer[256]; + size_t r; + int64_t len = -1; + do { + // Start by reading a minimal amount of data in order to decode the length. + // After that, attempt to read the remaining length, up to the buffer size. + r = do_read(buffer, len == -1 ? 20 : (len < 256 ? len : 256)); + oss << std::string(buffer, r); + + if (len == -1) { + uint64_t l = BSER::decodeLength(oss); + len = l + oss.tellg(); + } + + len -= r; + } while (len > 0); + + return BSER(oss); +} + +std::string getSockPath() { + auto var = getenv("WATCHMAN_SOCK"); + if (var && *var) { + return std::string(var); + } + +#ifdef _WIN32 + FILE *fp = popen("watchman --output-encoding=bser get-sockname", "r"); +#else + FILE *fp = popen("watchman --output-encoding=bser get-sockname 2>/dev/null", "r"); +#endif + if (fp == NULL || errno == ECHILD) { + throw std::runtime_error("Failed to execute watchman"); + } + + BSER b = readBSER([fp] (char *buf, size_t len) { + return fread(buf, sizeof(char), len, fp); + }); + + pclose(fp); + + auto objValue = b.objectValue(); + auto foundSockname = objValue.find("sockname"); + if (foundSockname == objValue.end()) { + throw std::runtime_error("sockname not found"); + } + return foundSockname->second.stringValue(); +} + +std::unique_ptr watchmanConnect() { + std::string path = getSockPath(); + return std::unique_ptr(new IPC(path)); +} + +BSER watchmanRead(IPC *ipc) { + return readBSER([ipc] (char *buf, size_t len) { + return ipc->read(buf, len); + }); +} + +BSER::Object WatchmanBackend::watchmanRequest(BSER b) { + std::string cmd = b.encode(); + mIPC->write(cmd); + mRequestSignal.notify(); + + mResponseSignal.wait(); + mResponseSignal.reset(); + + if (!mError.empty()) { + std::runtime_error err = std::runtime_error(mError); + mError = std::string(); + throw err; + } + + return mResponse; +} + +void WatchmanBackend::watchmanWatch(std::string dir) { + std::vector cmd; + cmd.push_back("watch"); + cmd.push_back(normalizePath(dir)); + watchmanRequest(cmd); +} + +bool WatchmanBackend::checkAvailable() { + try { + watchmanConnect(); + return true; + } catch (std::exception&) { + return false; + } +} + +void handleFiles(WatcherRef watcher, BSER::Object obj) { + auto found = obj.find("files"); + if (found == obj.end()) { + throw WatcherError("Error reading changes from watchman", watcher); + } + + auto files = found->second.arrayValue(); + for (auto it = files.begin(); it != files.end(); it++) { + auto file = it->objectValue(); + auto name = file.find("name")->second.stringValue(); + #ifdef _WIN32 + std::replace(name.begin(), name.end(), '/', '\\'); + #endif + auto mode = file.find("mode")->second.intValue(); + auto isNew = file.find("new")->second.boolValue(); + auto exists = file.find("exists")->second.boolValue(); + auto path = watcher->mDir + DIR_SEP + name; + if (watcher->isIgnored(path)) { + continue; + } + + if (isNew && exists) { + watcher->mEvents.create(path); + } else if (exists && !S_ISDIR(mode)) { + watcher->mEvents.update(path); + } else if (!isNew && !exists) { + watcher->mEvents.remove(path); + } + } +} + +void WatchmanBackend::handleSubscription(BSER::Object obj) { + std::unique_lock lock(mMutex); + auto subscription = obj.find("subscription")->second.stringValue(); + auto it = mSubscriptions.find(subscription); + if (it == mSubscriptions.end()) { + return; + } + + auto watcher = it->second; + try { + handleFiles(watcher, obj); + watcher->notify(); + } catch (WatcherError &err) { + handleWatcherError(err); + } +} + +void WatchmanBackend::start() { + mIPC = watchmanConnect(); + notifyStarted(); + + while (true) { + // If there are no subscriptions we are reading, wait for a request. + if (mSubscriptions.size() == 0) { + mRequestSignal.wait(); + mRequestSignal.reset(); + } + + // Break out of loop if we are stopped. + if (mStopped) { + break; + } + + // Attempt to read from the socket. + // If there is an error and we are stopped, break. + BSER b; + try { + b = watchmanRead(&*mIPC); + } catch (std::exception &err) { + if (mStopped) { + break; + } else if (mResponseSignal.isWaiting()) { + mError = err.what(); + mResponseSignal.notify(); + } else { + // Throwing causes the backend to be destroyed, but we never reach the code below to notify the signal + mEndedSignal.notify(); + throw; + } + } + + auto obj = b.objectValue(); + auto error = obj.find("error"); + if (error != obj.end()) { + mError = error->second.stringValue(); + mResponseSignal.notify(); + continue; + } + + // If this message is for a subscription, handle it, otherwise notify the request. + auto subscription = obj.find("subscription"); + if (subscription != obj.end()) { + handleSubscription(obj); + } else { + mResponse = obj; + mResponseSignal.notify(); + } + } + + mEndedSignal.notify(); +} + +WatchmanBackend::~WatchmanBackend() { + // Mark the watcher as stopped, close the socket, and trigger the lock. + // This will cause the read loop to be broken and the thread to exit. + mStopped = true; + mIPC.reset(); + mRequestSignal.notify(); + + // If not ended yet, wait. + mEndedSignal.wait(); +} + +std::string WatchmanBackend::clock(WatcherRef watcher) { + BSER::Array cmd; + cmd.push_back("clock"); + cmd.push_back(normalizePath(watcher->mDir)); + + BSER::Object obj = watchmanRequest(cmd); + auto found = obj.find("clock"); + if (found == obj.end()) { + throw WatcherError("Error reading clock from watchman", watcher); + } + + return found->second.stringValue(); +} + +void WatchmanBackend::writeSnapshot(WatcherRef watcher, std::string *snapshotPath) { + std::unique_lock lock(mMutex); + watchmanWatch(watcher->mDir); + + std::ofstream ofs(*snapshotPath); + ofs << clock(watcher); +} + +void WatchmanBackend::getEventsSince(WatcherRef watcher, std::string *snapshotPath) { + std::unique_lock lock(mMutex); + std::ifstream ifs(*snapshotPath); + if (ifs.fail()) { + return; + } + + watchmanWatch(watcher->mDir); + + std::string clock; + ifs >> clock; + + BSER::Array cmd; + cmd.push_back("since"); + cmd.push_back(normalizePath(watcher->mDir)); + cmd.push_back(clock); + + BSER::Object obj = watchmanRequest(cmd); + handleFiles(watcher, obj); +} + +std::string getId(WatcherRef watcher) { + std::ostringstream id; + id << "parcel-"; + id << static_cast(watcher.get()); + return id.str(); +} + +// This function is called by Backend::watch which takes a lock on mMutex +void WatchmanBackend::subscribe(WatcherRef watcher) { + watchmanWatch(watcher->mDir); + + std::string id = getId(watcher); + BSER::Array cmd; + cmd.push_back("subscribe"); + cmd.push_back(normalizePath(watcher->mDir)); + cmd.push_back(id); + + BSER::Array fields; + fields.push_back("name"); + fields.push_back("mode"); + fields.push_back("exists"); + fields.push_back("new"); + + BSER::Object opts; + opts.emplace("fields", fields); + opts.emplace("since", clock(watcher)); + + if (watcher->mIgnorePaths.size() > 0) { + BSER::Array ignore; + BSER::Array anyOf; + anyOf.push_back("anyof"); + + for (auto it = watcher->mIgnorePaths.begin(); it != watcher->mIgnorePaths.end(); it++) { + std::string pathStart = watcher->mDir + DIR_SEP; + if (it->rfind(pathStart, 0) == 0) { + auto relative = it->substr(pathStart.size()); + BSER::Array dirname; + dirname.push_back("dirname"); + dirname.push_back(relative); + anyOf.push_back(dirname); + } + } + + ignore.push_back("not"); + ignore.push_back(anyOf); + + opts.emplace("expression", ignore); + } + + cmd.push_back(opts); + watchmanRequest(cmd); + + mSubscriptions.emplace(id, watcher); + mRequestSignal.notify(); +} + +// This function is called by Backend::unwatch which takes a lock on mMutex +void WatchmanBackend::unsubscribe(WatcherRef watcher) { + std::string id = getId(watcher); + auto erased = mSubscriptions.erase(id); + + if (erased) { + BSER::Array cmd; + cmd.push_back("unsubscribe"); + cmd.push_back(normalizePath(watcher->mDir)); + cmd.push_back(id); + + watchmanRequest(cmd); + } +} diff --git a/tools/ui/node_modules/@parcel/watcher/src/watchman/WatchmanBackend.hh b/tools/ui/node_modules/@parcel/watcher/src/watchman/WatchmanBackend.hh new file mode 100644 index 0000000000000000000000000000000000000000..699cded9c82ea9cef9330f6e666781537f3c88c7 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/watchman/WatchmanBackend.hh @@ -0,0 +1,35 @@ +#ifndef WATCHMAN_H +#define WATCHMAN_H + +#include "../Backend.hh" +#include "./BSER.hh" +#include "../Signal.hh" +#include "./IPC.hh" + +class WatchmanBackend : public Backend { +public: + static bool checkAvailable(); + void start() override; + WatchmanBackend() : mStopped(false) {}; + ~WatchmanBackend(); + void writeSnapshot(WatcherRef watcher, std::string *snapshotPath) override; + void getEventsSince(WatcherRef watcher, std::string *snapshotPath) override; + void subscribe(WatcherRef watcher) override; + void unsubscribe(WatcherRef watcher) override; +private: + std::unique_ptr mIPC; + Signal mRequestSignal; + Signal mResponseSignal; + BSER::Object mResponse; + std::string mError; + std::unordered_map mSubscriptions; + bool mStopped; + Signal mEndedSignal; + + std::string clock(WatcherRef watcher); + void watchmanWatch(std::string dir); + BSER::Object watchmanRequest(BSER cmd); + void handleSubscription(BSER::Object obj); +}; + +#endif diff --git a/tools/ui/node_modules/@parcel/watcher/src/windows/WindowsBackend.cc b/tools/ui/node_modules/@parcel/watcher/src/windows/WindowsBackend.cc new file mode 100644 index 0000000000000000000000000000000000000000..eabce1e06dcb7e50ff01024d0b90fd6cea5ff113 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/windows/WindowsBackend.cc @@ -0,0 +1,282 @@ +#include +#include +#include "../DirTree.hh" +#include "../shared/BruteForceBackend.hh" +#include "./WindowsBackend.hh" +#include "./win_utils.hh" + +#define DEFAULT_BUF_SIZE 1024 * 1024 +#define NETWORK_BUF_SIZE 64 * 1024 +#define CONVERT_TIME(ft) ULARGE_INTEGER{ft.dwLowDateTime, ft.dwHighDateTime}.QuadPart + +void BruteForceBackend::readTree(WatcherRef watcher, std::shared_ptr tree) { + std::stack directories; + + directories.push(watcher->mDir); + + while (!directories.empty()) { + HANDLE hFind = INVALID_HANDLE_VALUE; + + std::string path = directories.top(); + std::string spec = path + "\\*"; + directories.pop(); + + WIN32_FIND_DATA ffd; + hFind = FindFirstFile(spec.c_str(), &ffd); + + if (hFind == INVALID_HANDLE_VALUE) { + if (path == watcher->mDir) { + FindClose(hFind); + throw WatcherError("Error opening directory", watcher); + } + + tree->remove(path); + continue; + } + + do { + if (strcmp(ffd.cFileName, ".") != 0 && strcmp(ffd.cFileName, "..") != 0) { + std::string fullPath = path + "\\" + ffd.cFileName; + if (watcher->isIgnored(fullPath)) { + continue; + } + + tree->add(fullPath, CONVERT_TIME(ffd.ftLastWriteTime), ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY); + if (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + directories.push(fullPath); + } + } + } while (FindNextFile(hFind, &ffd) != 0); + + FindClose(hFind); + } +} + +void WindowsBackend::start() { + mRunning = true; + notifyStarted(); + + while (mRunning) { + SleepEx(INFINITE, true); + } +} + +WindowsBackend::~WindowsBackend() { + // Mark as stopped, and queue a noop function in the thread to break the loop + mRunning = false; + QueueUserAPC([](__in ULONG_PTR) {}, mThread.native_handle(), (ULONG_PTR)this); +} + +class Subscription: public WatcherState { +public: + Subscription(WindowsBackend *backend, WatcherRef watcher, std::shared_ptr tree) { + mRunning = true; + mBackend = backend; + mWatcher = watcher; + mTree = tree; + ZeroMemory(&mOverlapped, sizeof(OVERLAPPED)); + mOverlapped.hEvent = this; + mReadBuffer.resize(DEFAULT_BUF_SIZE); + mWriteBuffer.resize(DEFAULT_BUF_SIZE); + + mDirectoryHandle = CreateFileW( + utf8ToUtf16(watcher->mDir).data(), + FILE_LIST_DIRECTORY, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, + NULL + ); + + if (mDirectoryHandle == INVALID_HANDLE_VALUE) { + throw WatcherError("Invalid handle", mWatcher); + } + + // Ensure that the path is a directory + BY_HANDLE_FILE_INFORMATION info; + bool success = GetFileInformationByHandle( + mDirectoryHandle, + &info + ); + + if (!success) { + throw WatcherError("Could not get file information", mWatcher); + } + + if (!(info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { + throw WatcherError("Not a directory", mWatcher); + } + } + + virtual ~Subscription() { + stop(); + } + + void run() { + try { + poll(); + } catch (WatcherError &err) { + mBackend->handleWatcherError(err); + } + } + + void stop() { + if (mRunning) { + mRunning = false; + CancelIo(mDirectoryHandle); + CloseHandle(mDirectoryHandle); + } + } + + void poll() { + if (!mRunning) { + return; + } + + // Asynchronously wait for changes. + int success = ReadDirectoryChangesW( + mDirectoryHandle, + mWriteBuffer.data(), + static_cast(mWriteBuffer.size()), + TRUE, // recursive + FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_DIR_NAME | FILE_NOTIFY_CHANGE_ATTRIBUTES + | FILE_NOTIFY_CHANGE_SIZE | FILE_NOTIFY_CHANGE_LAST_WRITE, + NULL, + &mOverlapped, + [](DWORD errorCode, DWORD numBytes, LPOVERLAPPED overlapped) { + auto subscription = reinterpret_cast(overlapped->hEvent); + try { + subscription->processEvents(errorCode); + } catch (WatcherError &err) { + subscription->mBackend->handleWatcherError(err); + } + } + ); + + if (!success) { + throw WatcherError("Failed to read changes", mWatcher); + } + } + + void processEvents(DWORD errorCode) { + if (!mRunning) { + return; + } + + switch (errorCode) { + case ERROR_OPERATION_ABORTED: + return; + case ERROR_INVALID_PARAMETER: + // resize buffers to network size (64kb), and try again + mReadBuffer.resize(NETWORK_BUF_SIZE); + mWriteBuffer.resize(NETWORK_BUF_SIZE); + poll(); + return; + case ERROR_NOTIFY_ENUM_DIR: + throw WatcherError("Buffer overflow. Some events may have been lost.", mWatcher); + case ERROR_ACCESS_DENIED: { + // This can happen if the watched directory is deleted. Check if that is the case, + // and if so emit a delete event. Otherwise, fall through to default error case. + DWORD attrs = GetFileAttributesW(utf8ToUtf16(mWatcher->mDir).data()); + bool isDir = attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY); + if (!isDir) { + mWatcher->mEvents.remove(mWatcher->mDir); + mTree->remove(mWatcher->mDir); + mWatcher->notify(); + stop(); + return; + } + } + default: + if (errorCode != ERROR_SUCCESS) { + throw WatcherError("Unknown error", mWatcher); + } + } + + // Swap read and write buffers, and poll again + std::swap(mWriteBuffer, mReadBuffer); + poll(); + + // Read change events + BYTE *base = mReadBuffer.data(); + while (true) { + PFILE_NOTIFY_INFORMATION info = (PFILE_NOTIFY_INFORMATION)base; + processEvent(info); + + if (info->NextEntryOffset == 0) { + break; + } + + base += info->NextEntryOffset; + } + + mWatcher->notify(); + } + + void processEvent(PFILE_NOTIFY_INFORMATION info) { + std::string path = mWatcher->mDir + "\\" + utf16ToUtf8(info->FileName, info->FileNameLength / sizeof(WCHAR)); + if (mWatcher->isIgnored(path)) { + return; + } + + switch (info->Action) { + case FILE_ACTION_ADDED: + case FILE_ACTION_RENAMED_NEW_NAME: { + WIN32_FILE_ATTRIBUTE_DATA data; + if (GetFileAttributesExW(utf8ToUtf16(path).data(), GetFileExInfoStandard, &data)) { + mWatcher->mEvents.create(path); + mTree->add(path, CONVERT_TIME(data.ftLastWriteTime), data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY); + } + break; + } + case FILE_ACTION_MODIFIED: { + WIN32_FILE_ATTRIBUTE_DATA data; + if (GetFileAttributesExW(utf8ToUtf16(path).data(), GetFileExInfoStandard, &data)) { + mTree->update(path, CONVERT_TIME(data.ftLastWriteTime)); + if (!(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { + mWatcher->mEvents.update(path); + } + } + break; + } + case FILE_ACTION_REMOVED: + case FILE_ACTION_RENAMED_OLD_NAME: + mWatcher->mEvents.remove(path); + mTree->remove(path); + break; + } + } + +private: + WindowsBackend *mBackend; + std::shared_ptr mWatcher; + std::shared_ptr mTree; + bool mRunning; + HANDLE mDirectoryHandle; + std::vector mReadBuffer; + std::vector mWriteBuffer; + OVERLAPPED mOverlapped; +}; + +// This function is called by Backend::watch which takes a lock on mMutex +void WindowsBackend::subscribe(WatcherRef watcher) { + // Create a subscription for this watcher + auto sub = std::make_shared(this, watcher, getTree(watcher, false)); + watcher->state = sub; + + // Queue polling for this subscription in the correct thread. + bool success = QueueUserAPC([](__in ULONG_PTR ptr) { + Subscription *sub = (Subscription *)ptr; + sub->run(); + }, mThread.native_handle(), (ULONG_PTR)sub.get()); + + if (!success) { + throw std::runtime_error("Unable to queue APC"); + } +} + +// This function is called by Backend::unwatch which takes a lock on mMutex +void WindowsBackend::unsubscribe(WatcherRef watcher) { + watcher->state = nullptr; +} diff --git a/tools/ui/node_modules/@parcel/watcher/src/windows/WindowsBackend.hh b/tools/ui/node_modules/@parcel/watcher/src/windows/WindowsBackend.hh new file mode 100644 index 0000000000000000000000000000000000000000..d679782827a18745bd562aae85ab44e671673fda --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/windows/WindowsBackend.hh @@ -0,0 +1,18 @@ +#ifndef WINDOWS_H +#define WINDOWS_H + +#include +#include +#include "../shared/BruteForceBackend.hh" + +class WindowsBackend : public BruteForceBackend { +public: + void start() override; + ~WindowsBackend(); + void subscribe(WatcherRef watcher) override; + void unsubscribe(WatcherRef watcher) override; +private: + bool mRunning; +}; + +#endif diff --git a/tools/ui/node_modules/@parcel/watcher/src/windows/win_utils.cc b/tools/ui/node_modules/@parcel/watcher/src/windows/win_utils.cc new file mode 100644 index 0000000000000000000000000000000000000000..62a1e59a32a71f341efa644a7d4a85f482f95a9a --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/windows/win_utils.cc @@ -0,0 +1,44 @@ +#include "./win_utils.hh" + +std::wstring utf8ToUtf16(std::string input) { + unsigned int len = MultiByteToWideChar(CP_UTF8, 0, input.c_str(), -1, NULL, 0); + WCHAR *output = new WCHAR[len]; + MultiByteToWideChar(CP_UTF8, 0, input.c_str(), -1, output, len); + std::wstring res(output); + delete[] output; + return res; +} + +std::string utf16ToUtf8(const WCHAR *input, DWORD length) { + unsigned int len = WideCharToMultiByte(CP_UTF8, 0, input, length, NULL, 0, NULL, NULL); + char *output = new char[len + 1]; + WideCharToMultiByte(CP_UTF8, 0, input, length, output, len, NULL, NULL); + output[len] = '\0'; + std::string res(output); + delete[] output; + return res; +} + +std::string normalizePath(std::string path) { + // Prevent truncation to MAX_PATH characters by adding the \\?\ prefix + std::wstring p = utf8ToUtf16("\\\\?\\" + path); + + // Get the required length for the output + DWORD len = GetLongPathNameW(p.data(), NULL, 0); + if (!len) { + return path; + } + + // Allocate output array and get long path + WCHAR *output = new WCHAR[len]; + len = GetLongPathNameW(p.data(), output, len); + if (!len) { + delete[] output; + return path; + } + + // Convert back to utf8 + std::string res = utf16ToUtf8(output + 4, len - 4); + delete[] output; + return res; +} diff --git a/tools/ui/node_modules/@parcel/watcher/src/windows/win_utils.hh b/tools/ui/node_modules/@parcel/watcher/src/windows/win_utils.hh new file mode 100644 index 0000000000000000000000000000000000000000..9178d1b29e456c2c2bc726730a208ae4fb22c20b --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/src/windows/win_utils.hh @@ -0,0 +1,11 @@ +#ifndef WIN_UTILS_H +#define WIN_UTILS_H + +#include +#include + +std::wstring utf8ToUtf16(std::string input); +std::string utf16ToUtf8(const WCHAR *input, DWORD length); +std::string normalizePath(std::string path); + +#endif diff --git a/tools/ui/node_modules/@parcel/watcher/wrapper.js b/tools/ui/node_modules/@parcel/watcher/wrapper.js new file mode 100644 index 0000000000000000000000000000000000000000..3b475184684f3dfea5f5d71c71d26730cd3d5272 --- /dev/null +++ b/tools/ui/node_modules/@parcel/watcher/wrapper.js @@ -0,0 +1,74 @@ +const path = require('path'); +const picomatch = require('picomatch'); +const isGlob = require('is-glob'); + +function normalizeOptions(dir, opts = {}) { + const { ignore, ...rest } = opts; + + if (Array.isArray(ignore)) { + opts = { ...rest }; + + for (const value of ignore) { + if (isGlob(value)) { + if (!opts.ignoreGlobs) { + opts.ignoreGlobs = []; + } + + const regex = picomatch.makeRe(value, { + // We set `dot: true` to workaround an issue with the + // regular expression on Linux where the resulting + // negative lookahead `(?!(\\/|^)` was never matching + // in some cases. See also https://bit.ly/3UZlQDm + dot: true, + windows: process.platform === 'win32', + }); + opts.ignoreGlobs.push(regex.source); + } else { + if (!opts.ignorePaths) { + opts.ignorePaths = []; + } + + opts.ignorePaths.push(path.resolve(dir, value)); + } + } + } + + return opts; +} + +exports.createWrapper = (binding) => { + return { + writeSnapshot(dir, snapshot, opts) { + return binding.writeSnapshot( + path.resolve(dir), + path.resolve(snapshot), + normalizeOptions(dir, opts), + ); + }, + getEventsSince(dir, snapshot, opts) { + return binding.getEventsSince( + path.resolve(dir), + path.resolve(snapshot), + normalizeOptions(dir, opts), + ); + }, + async subscribe(dir, fn, opts) { + dir = path.resolve(dir); + opts = normalizeOptions(dir, opts); + await binding.subscribe(dir, fn, opts); + + return { + unsubscribe() { + return binding.unsubscribe(dir, fn, opts); + }, + }; + }, + unsubscribe(dir, fn, opts) { + return binding.unsubscribe( + path.resolve(dir), + fn, + normalizeOptions(dir, opts), + ); + } + }; +}; diff --git a/tools/ui/node_modules/@playwright/test/LICENSE b/tools/ui/node_modules/@playwright/test/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..df112373eb2e23e459bf93ec412be1764dc5a38b --- /dev/null +++ b/tools/ui/node_modules/@playwright/test/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Portions Copyright (c) Microsoft Corporation. + Portions Copyright 2017 Google Inc. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/tools/ui/node_modules/@playwright/test/NOTICE b/tools/ui/node_modules/@playwright/test/NOTICE new file mode 100644 index 0000000000000000000000000000000000000000..814ec1696f7ad36c1b524fb6adeef14b4b367fec --- /dev/null +++ b/tools/ui/node_modules/@playwright/test/NOTICE @@ -0,0 +1,5 @@ +Playwright +Copyright (c) Microsoft Corporation + +This software contains code derived from the Puppeteer project (https://github.com/puppeteer/puppeteer), +available under the Apache 2.0 license (https://github.com/puppeteer/puppeteer/blob/master/LICENSE). diff --git a/tools/ui/node_modules/@playwright/test/README.md b/tools/ui/node_modules/@playwright/test/README.md new file mode 100644 index 0000000000000000000000000000000000000000..2c176f164f0c3e6f3abac3643295769b2f4a92a0 --- /dev/null +++ b/tools/ui/node_modules/@playwright/test/README.md @@ -0,0 +1,168 @@ +# 🎭 Playwright + +[![npm version](https://img.shields.io/npm/v/playwright.svg)](https://www.npmjs.com/package/playwright) [![Chromium version](https://img.shields.io/badge/chromium-141.0.7390.37-blue.svg?logo=google-chrome)](https://www.chromium.org/Home) [![Firefox version](https://img.shields.io/badge/firefox-142.0.1-blue.svg?logo=firefoxbrowser)](https://www.mozilla.org/en-US/firefox/new/) [![WebKit version](https://img.shields.io/badge/webkit-26.0-blue.svg?logo=safari)](https://webkit.org/) [![Join Discord](https://img.shields.io/badge/join-discord-informational)](https://aka.ms/playwright/discord) + +## [Documentation](https://playwright.dev) | [API reference](https://playwright.dev/docs/api/class-playwright) + +Playwright is a framework for Web Testing and Automation. It allows testing [Chromium](https://www.chromium.org/Home), [Firefox](https://www.mozilla.org/en-US/firefox/new/) and [WebKit](https://webkit.org/) with a single API. Playwright is built to enable cross-browser web automation that is **ever-green**, **capable**, **reliable** and **fast**. + +| | Linux | macOS | Windows | +| :--- | :---: | :---: | :---: | +| Chromium 141.0.7390.37 | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| WebKit 26.0 | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| Firefox 142.0.1 | :white_check_mark: | :white_check_mark: | :white_check_mark: | + +Headless execution is supported for all browsers on all platforms. Check out [system requirements](https://playwright.dev/docs/intro#system-requirements) for details. + +Looking for Playwright for [Python](https://playwright.dev/python/docs/intro), [.NET](https://playwright.dev/dotnet/docs/intro), or [Java](https://playwright.dev/java/docs/intro)? + +## Installation + +Playwright has its own test runner for end-to-end tests, we call it Playwright Test. + +### Using init command + +The easiest way to get started with Playwright Test is to run the init command. + +```Shell +# Run from your project's root directory +npm init playwright@latest +# Or create a new project +npm init playwright@latest new-project +``` + +This will create a configuration file, optionally add examples, a GitHub Action workflow and a first test example.spec.ts. You can now jump directly to writing assertions section. + +### Manually + +Add dependency and install browsers. + +```Shell +npm i -D @playwright/test +# install supported browsers +npx playwright install +``` + +You can optionally install only selected browsers, see [install browsers](https://playwright.dev/docs/cli#install-browsers) for more details. Or you can install no browsers at all and use existing [browser channels](https://playwright.dev/docs/browsers). + +* [Getting started](https://playwright.dev/docs/intro) +* [API reference](https://playwright.dev/docs/api/class-playwright) + +## Capabilities + +### Resilient • No flaky tests + +**Auto-wait**. Playwright waits for elements to be actionable prior to performing actions. It also has a rich set of introspection events. The combination of the two eliminates the need for artificial timeouts - a primary cause of flaky tests. + +**Web-first assertions**. Playwright assertions are created specifically for the dynamic web. Checks are automatically retried until the necessary conditions are met. + +**Tracing**. Configure test retry strategy, capture execution trace, videos and screenshots to eliminate flakes. + +### No trade-offs • No limits + +Browsers run web content belonging to different origins in different processes. Playwright is aligned with the architecture of the modern browsers and runs tests out-of-process. This makes Playwright free of the typical in-process test runner limitations. + +**Multiple everything**. Test scenarios that span multiple tabs, multiple origins and multiple users. Create scenarios with different contexts for different users and run them against your server, all in one test. + +**Trusted events**. Hover elements, interact with dynamic controls and produce trusted events. Playwright uses real browser input pipeline indistinguishable from the real user. + +Test frames, pierce Shadow DOM. Playwright selectors pierce shadow DOM and allow entering frames seamlessly. + +### Full isolation • Fast execution + +**Browser contexts**. Playwright creates a browser context for each test. Browser context is equivalent to a brand new browser profile. This delivers full test isolation with zero overhead. Creating a new browser context only takes a handful of milliseconds. + +**Log in once**. Save the authentication state of the context and reuse it in all the tests. This bypasses repetitive log-in operations in each test, yet delivers full isolation of independent tests. + +### Powerful Tooling + +**[Codegen](https://playwright.dev/docs/codegen)**. Generate tests by recording your actions. Save them into any language. + +**[Playwright inspector](https://playwright.dev/docs/inspector)**. Inspect page, generate selectors, step through the test execution, see click points and explore execution logs. + +**[Trace Viewer](https://playwright.dev/docs/trace-viewer)**. Capture all the information to investigate the test failure. Playwright trace contains test execution screencast, live DOM snapshots, action explorer, test source and many more. + +Looking for Playwright for [TypeScript](https://playwright.dev/docs/intro), [JavaScript](https://playwright.dev/docs/intro), [Python](https://playwright.dev/python/docs/intro), [.NET](https://playwright.dev/dotnet/docs/intro), or [Java](https://playwright.dev/java/docs/intro)? + +## Examples + +To learn how to run these Playwright Test examples, check out our [getting started docs](https://playwright.dev/docs/intro). + +#### Page screenshot + +This code snippet navigates to Playwright homepage and saves a screenshot. + +```TypeScript +import { test } from '@playwright/test'; + +test('Page Screenshot', async ({ page }) => { + await page.goto('https://playwright.dev/'); + await page.screenshot({ path: `example.png` }); +}); +``` + +#### Mobile and geolocation + +This snippet emulates Mobile Safari on a device at given geolocation, navigates to maps.google.com, performs the action and takes a screenshot. + +```TypeScript +import { test, devices } from '@playwright/test'; + +test.use({ + ...devices['iPhone 13 Pro'], + locale: 'en-US', + geolocation: { longitude: 12.492507, latitude: 41.889938 }, + permissions: ['geolocation'], +}) + +test('Mobile and geolocation', async ({ page }) => { + await page.goto('https://maps.google.com'); + await page.getByText('Your location').click(); + await page.waitForRequest(/.*preview\/pwa/); + await page.screenshot({ path: 'colosseum-iphone.png' }); +}); +``` + +#### Evaluate in browser context + +This code snippet navigates to example.com, and executes a script in the page context. + +```TypeScript +import { test } from '@playwright/test'; + +test('Evaluate in browser context', async ({ page }) => { + await page.goto('https://www.example.com/'); + const dimensions = await page.evaluate(() => { + return { + width: document.documentElement.clientWidth, + height: document.documentElement.clientHeight, + deviceScaleFactor: window.devicePixelRatio + } + }); + console.log(dimensions); +}); +``` + +#### Intercept network requests + +This code snippet sets up request routing for a page to log all network requests. + +```TypeScript +import { test } from '@playwright/test'; + +test('Intercept network requests', async ({ page }) => { + // Log and continue all network requests + await page.route('**', route => { + console.log(route.request().url()); + route.continue(); + }); + await page.goto('http://todomvc.com'); +}); +``` + +## Resources + +* [Documentation](https://playwright.dev) +* [API reference](https://playwright.dev/docs/api/class-playwright/) +* [Contribution guide](CONTRIBUTING.md) +* [Changelog](https://github.com/microsoft/playwright/releases) diff --git a/tools/ui/node_modules/@playwright/test/cli.js b/tools/ui/node_modules/@playwright/test/cli.js new file mode 100644 index 0000000000000000000000000000000000000000..e42facb076f4b05f009186346d05d39c2d9b784d --- /dev/null +++ b/tools/ui/node_modules/@playwright/test/cli.js @@ -0,0 +1,19 @@ +#!/usr/bin/env node +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +const { program } = require('playwright/lib/program'); +program.parse(process.argv); diff --git a/tools/ui/node_modules/@playwright/test/index.d.ts b/tools/ui/node_modules/@playwright/test/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..8d99c91500c65b4b9d762b900dedf5e6000cf257 --- /dev/null +++ b/tools/ui/node_modules/@playwright/test/index.d.ts @@ -0,0 +1,18 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from 'playwright/test'; +export { default } from 'playwright/test'; diff --git a/tools/ui/node_modules/@playwright/test/index.js b/tools/ui/node_modules/@playwright/test/index.js new file mode 100644 index 0000000000000000000000000000000000000000..8536f063904ffa04a91240061ce1cf2c4c855b79 --- /dev/null +++ b/tools/ui/node_modules/@playwright/test/index.js @@ -0,0 +1,17 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +module.exports = require('playwright/test'); diff --git a/tools/ui/node_modules/@playwright/test/index.mjs b/tools/ui/node_modules/@playwright/test/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..8d99c91500c65b4b9d762b900dedf5e6000cf257 --- /dev/null +++ b/tools/ui/node_modules/@playwright/test/index.mjs @@ -0,0 +1,18 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from 'playwright/test'; +export { default } from 'playwright/test'; diff --git a/tools/ui/node_modules/@playwright/test/package.json b/tools/ui/node_modules/@playwright/test/package.json new file mode 100644 index 0000000000000000000000000000000000000000..8342893d8aae1c23d81fa7819d0157e0451ac43b --- /dev/null +++ b/tools/ui/node_modules/@playwright/test/package.json @@ -0,0 +1,35 @@ +{ + "name": "@playwright/test", + "version": "1.56.1", + "description": "A high-level API to automate web browsers", + "repository": { + "type": "git", + "url": "git+https://github.com/microsoft/playwright.git" + }, + "homepage": "https://playwright.dev", + "engines": { + "node": ">=18" + }, + "author": { + "name": "Microsoft Corporation" + }, + "license": "Apache-2.0", + "exports": { + ".": { + "types": "./index.d.ts", + "import": "./index.mjs", + "require": "./index.js", + "default": "./index.js" + }, + "./cli": "./cli.js", + "./package.json": "./package.json", + "./reporter": "./reporter.js" + }, + "bin": { + "playwright": "cli.js" + }, + "scripts": {}, + "dependencies": { + "playwright": "1.56.1" + } +} diff --git a/tools/ui/node_modules/@playwright/test/reporter.d.ts b/tools/ui/node_modules/@playwright/test/reporter.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..806d13fb09e73f0dc1f4e129a2889b9e6bac3a8d --- /dev/null +++ b/tools/ui/node_modules/@playwright/test/reporter.d.ts @@ -0,0 +1,17 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export * from 'playwright/types/testReporter'; diff --git a/tools/ui/node_modules/@playwright/test/reporter.js b/tools/ui/node_modules/@playwright/test/reporter.js new file mode 100644 index 0000000000000000000000000000000000000000..485e880a66229eb7290fd274e35b8acf4a4a8ecd --- /dev/null +++ b/tools/ui/node_modules/@playwright/test/reporter.js @@ -0,0 +1,17 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// We only export types in reporter.d.ts. diff --git a/tools/ui/node_modules/@playwright/test/reporter.mjs b/tools/ui/node_modules/@playwright/test/reporter.mjs new file mode 100644 index 0000000000000000000000000000000000000000..485e880a66229eb7290fd274e35b8acf4a4a8ecd --- /dev/null +++ b/tools/ui/node_modules/@playwright/test/reporter.mjs @@ -0,0 +1,17 @@ +/** + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// We only export types in reporter.d.ts. diff --git a/tools/ui/node_modules/@polka/url/build.js b/tools/ui/node_modules/@polka/url/build.js new file mode 100644 index 0000000000000000000000000000000000000000..a945343214b16fdb462ba64c01331c8080c846c4 --- /dev/null +++ b/tools/ui/node_modules/@polka/url/build.js @@ -0,0 +1,49 @@ +const qs = require('querystring'); + +/** + * @typedef ParsedURL + * @type {import('.').ParsedURL} + */ + +/** + * @typedef Request + * @property {string} url + * @property {ParsedURL} _parsedUrl + */ + +/** + * @param {Request} req + * @returns {ParsedURL|void} + */ +function parse(req) { + let raw = req.url; + if (raw == null) return; + + let prev = req._parsedUrl; + if (prev && prev.raw === raw) return prev; + + let pathname=raw, search='', query, hash; + + if (raw.length > 1) { + let idx = raw.indexOf('#', 1); + + if (idx !== -1) { + hash = raw.substring(idx); + pathname = raw.substring(0, idx); + } + + idx = pathname.indexOf('?', 1); + + if (idx !== -1) { + search = pathname.substring(idx); + pathname = pathname.substring(0, idx); + if (search.length > 1) { + query = qs.parse(search.substring(1)); + } + } + } + + return req._parsedUrl = { pathname, search, query, hash, raw }; +} + +exports.parse = parse; \ No newline at end of file diff --git a/tools/ui/node_modules/@polka/url/build.mjs b/tools/ui/node_modules/@polka/url/build.mjs new file mode 100644 index 0000000000000000000000000000000000000000..48ccfaae6e102dd3d266de2c05d65eff66c45169 --- /dev/null +++ b/tools/ui/node_modules/@polka/url/build.mjs @@ -0,0 +1,47 @@ +import * as qs from 'node:querystring'; + +/** + * @typedef ParsedURL + * @type {import('.').ParsedURL} + */ + +/** + * @typedef Request + * @property {string} url + * @property {ParsedURL} _parsedUrl + */ + +/** + * @param {Request} req + * @returns {ParsedURL|void} + */ +export function parse(req) { + let raw = req.url; + if (raw == null) return; + + let prev = req._parsedUrl; + if (prev && prev.raw === raw) return prev; + + let pathname=raw, search='', query, hash; + + if (raw.length > 1) { + let idx = raw.indexOf('#', 1); + + if (idx !== -1) { + hash = raw.substring(idx); + pathname = raw.substring(0, idx); + } + + idx = pathname.indexOf('?', 1); + + if (idx !== -1) { + search = pathname.substring(idx); + pathname = pathname.substring(0, idx); + if (search.length > 1) { + query = qs.parse(search.substring(1)); + } + } + } + + return req._parsedUrl = { pathname, search, query, hash, raw }; +} diff --git a/tools/ui/node_modules/@polka/url/index.d.ts b/tools/ui/node_modules/@polka/url/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..46ecac2bb265363aabf6ed2f413cfbb8348bd2f5 --- /dev/null +++ b/tools/ui/node_modules/@polka/url/index.d.ts @@ -0,0 +1,11 @@ +import type { IncomingMessage } from 'http'; + +export interface ParsedURL { + pathname: string; + search: string; + query: Record | undefined; + hash: string | undefined; + raw: string; +} + +export function parse(req: IncomingMessage): ParsedURL; diff --git a/tools/ui/node_modules/@polka/url/package.json b/tools/ui/node_modules/@polka/url/package.json new file mode 100644 index 0000000000000000000000000000000000000000..d594ee77947f2f132fdcef7c00433142d41771d1 --- /dev/null +++ b/tools/ui/node_modules/@polka/url/package.json @@ -0,0 +1,30 @@ +{ + "version": "1.0.0-next.29", + "name": "@polka/url", + "repository": "lukeed/polka", + "description": "Super fast, memoized `req.url` parser", + "module": "build.mjs", + "types": "index.d.ts", + "main": "build.js", + "license": "MIT", + "exports": { + ".": { + "types": "./index.d.ts", + "import": "./build.mjs", + "require": "./build.js" + }, + "./package.json": "./package.json" + }, + "files": [ + "build.*", + "index.d.*" + ], + "author": { + "name": "Luke Edwards", + "email": "luke@lukeed.com", + "url": "https://lukeed.com" + }, + "publishConfig": { + "access": "public" + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/@polka/url/readme.md b/tools/ui/node_modules/@polka/url/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..e47645ce49177a6e979b2d414e3dc09681bda80c --- /dev/null +++ b/tools/ui/node_modules/@polka/url/readme.md @@ -0,0 +1,68 @@ +# @polka/url [![npm](https://badgen.now.sh/npm/v/@polka/url)](https://npmjs.org/package/@polka/url) [![licenses](https://licenses.dev/b/npm/%40polka%2Furl)](https://licenses.dev/npm/%40polka%2Furl) + +> Super fast, memoized `req.url` parser; _not_ limited to [Polka][polka]! + +Parses the `url` from a [`IncomingMessage`](https://nodejs.org/api/http.html#http_class_http_incomingmessage) request. The returned object will always only contain the following keys: `search`, `query`, `pathname`, and `raw`. + +> **Note:** This library does not process `protocol`, `hostname`, `port`, etc.
This is because the incoming `req.url` value only begins with the path information. + +Parsed requests will be mutated with a `_parsedUrl` key, containing the returned output. This is used for future memoization, avoiding the need to fully parse the same `url` value multiple times. + +## Install + +``` +$ npm install --save @polka/url +``` + +## Usage + +```js +const parse = require('@polka/url'); + +let req = { + url: '/foo/bar?fizz=buzz' +}; +let output = parse(req); +//=> { +//=> pathname: '/foo/bar', +//=> raw: '/foo/bar?fizz=buzz', +//=> search: '?fizz=buzz', +//=> query: { +//=> fizz: 'buzz' +//=> }, +//=> } + +// Attaches result for future memoization +assert.deepEqual(output, req._parsedUrl); //=> true +``` + +## API + +### url(req) +Returns: `Object` or `undefined` + +> **Important:** The `req` must have a `url` key, otherwise `undefined` will be returned.
If no input is provided at all, a `TypeError` will be thrown. + +#### req +Type: `IncomingMessage` or `{ url: string }` + +The incoming HTTP request (`req`) or a plain `Object` with a `url` key. + +> **Note:** In Node.js servers, the [`req.url`](https://nodejs.org/api/http.html#http_message_url) begins with a pathname & does not include a `hash`. + + +## Benchmarks + +Check out the [`bench`](/bench) directory for in-depth benchmark results and comparisons. + + +## Support + +Any issues or questions can be sent to the [Polka][polka] repository.
However, please specify that your inquiry is about `@polka/url` specifically. + + +## License + +MIT © [Luke Edwards](https://lukeed.com) + +[polka]: https://github.com/lukeed/polka diff --git a/tools/ui/node_modules/@quansync/fs/LICENSE b/tools/ui/node_modules/@quansync/fs/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..8701f9fe69eb9e01d8a4ade1c51bc5b8a4a7e315 --- /dev/null +++ b/tools/ui/node_modules/@quansync/fs/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright © 2025-PRESENT Kevin Deng (https://github.com/sxzz) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/tools/ui/node_modules/@quansync/fs/README.md b/tools/ui/node_modules/@quansync/fs/README.md new file mode 100644 index 0000000000000000000000000000000000000000..a69b4cca3391b00a8259a3618697c90f276d43cc --- /dev/null +++ b/tools/ui/node_modules/@quansync/fs/README.md @@ -0,0 +1,50 @@ +# @quansync/fs + +[![npm version][npm-version-src]][npm-version-href] +[![npm downloads][npm-downloads-src]][npm-downloads-href] +[![Unit Test][unit-test-src]][unit-test-href] + +Filesystem utilities for [quansync](https://github.com/quansync-dev/quansync). + +## Install + +```bash +npm i @quansync/fs +``` + +## Usage + +```ts +import { readFile } from '@quansync/fs' +import { quansync } from 'quansync' + +const resultAsync = await readFile('/path', 'utf8') +const resultSync = readFile.sync('/path', 'utf8') + +const readFileTrimmed = quansync(function* (id: string) { + const text = yield* readFile(id, 'utf8').trim() + return text +}) +const readFileTrimmedSync = readFileTrimmed.sync +``` + +## Sponsors + +

+ + + +

+ +## License + +[MIT](./LICENSE) License © 2025-PRESENT [Kevin Deng](https://github.com/sxzz) + + + +[npm-version-src]: https://img.shields.io/npm/v/@quansync/fs.svg +[npm-version-href]: https://npmjs.com/package/@quansync/fs +[npm-downloads-src]: https://img.shields.io/npm/dm/@quansync/fs +[npm-downloads-href]: https://www.npmcharts.com/compare/@quansync/fs?interval=30 +[unit-test-src]: https://github.com/quansync-dev/fs/actions/workflows/unit-test.yml/badge.svg +[unit-test-href]: https://github.com/quansync-dev/fs/actions/workflows/unit-test.yml diff --git a/tools/ui/node_modules/@quansync/fs/dist/index.d.mts b/tools/ui/node_modules/@quansync/fs/dist/index.d.mts new file mode 100644 index 0000000000000000000000000000000000000000..fa931ab2db028ad4b1bbf811c21ea7201c00b790 --- /dev/null +++ b/tools/ui/node_modules/@quansync/fs/dist/index.d.mts @@ -0,0 +1,116 @@ +import { BigIntStats, BufferEncodingOption, Dirent, MakeDirectoryOptions, Mode, ObjectEncodingOptions, PathLike, RmOptions, StatOptions, Stats, TimeLike, WriteFileOptions, symlink as symlink$1 } from "node:fs"; +import { QuansyncFn } from "quansync"; +import { Buffer } from "node:buffer"; + +//#region src/index.d.ts + +/** +* @link https://nodejs.org/api/fs.html#fspromisesreadfilepath-options +*/ +declare const readFile: QuansyncFn & QuansyncFn; +/** +* @link https://nodejs.org/api/fs.html#fspromiseswritefilefile-data-options +*/ +declare const writeFile: QuansyncFn, options?: WriteFileOptions | undefined]>; +/** +* @link https://nodejs.org/api/fs.html#fspromisesunlinkpath +*/ +declare const unlink: QuansyncFn; +/** +* @link https://nodejs.org/api/fs.html#fspromisesaccesspath-mode +*/ +declare const access: QuansyncFn; +/** +* @link https://nodejs.org/api/fs.html#fspromisesstatpath-options +*/ +declare const stat: QuansyncFn & QuansyncFn & QuansyncFn; +declare const lstat: typeof stat; +/** +* @link https://nodejs.org/api/fs.html#fspromisescpsrc-dest-options +*/ +declare const cp: QuansyncFn; +/** +* @link https://nodejs.org/api/fs.html#fspromisesrmpath-options +*/ +declare const rm: QuansyncFn; +/** +* @link https://nodejs.org/api/fs.html#fspromisesmkdirpath-options +*/ +declare const mkdir: QuansyncFn & QuansyncFn; +/** +* @link https://nodejs.org/api/fs.html#fspromisesrenameoldpath-newpath +*/ +declare const rename: QuansyncFn; +/** +* @link https://nodejs.org/api/fs.html#fspromisesreaddirpath-options +*/ +declare const readdir: QuansyncFn & QuansyncFn & QuansyncFn & QuansyncFn & QuansyncFn[], [path: PathLike, options: { + encoding: "buffer"; + withFileTypes: true; + recursive?: boolean | undefined; +}]>; +/** +* @link https://nodejs.org/api/fs.html#fspromisesrealpathpath-options +*/ +declare const realpath: QuansyncFn & QuansyncFn & QuansyncFn; +/** +* @link https://nodejs.org/api/fs.html#fspromisesreadlinkpath-options +*/ +declare const readlink: QuansyncFn & QuansyncFn & QuansyncFn; +/** +* @link https://nodejs.org/api/fs.html#fspromisessymlinktarget-path-type +*/ +declare const symlink: QuansyncFn; +/** +* @link https://nodejs.org/api/fs.html#fspromiseschownpath-uid-gid +*/ +declare const chown: QuansyncFn; +/** +* @link https://nodejs.org/api/fs.html#fspromiseslchownpath-uid-gid +*/ +declare const lchown: QuansyncFn; +/** +* @link https://nodejs.org/api/fs.html#fspromiseschmodpath-mode +*/ +declare const chmod: QuansyncFn; +/** +* @link https://nodejs.org/api/fs.html#fspromisesutimespath-atime-mtime +*/ +declare const utimes: QuansyncFn; +/** +* @link https://nodejs.org/api/fs.html#fspromiseslutimespath-atime-mtime +*/ +declare const lutimes: QuansyncFn; +/** +* @link https://nodejs.org/api/fs.html#fspromisesmkdtempprefix-options +*/ +declare const mkdtemp: QuansyncFn & QuansyncFn & QuansyncFn; +//#endregion +export { access, chmod, chown, cp, lchown, lstat, lutimes, mkdir, mkdtemp, readFile, readdir, readlink, realpath, rename, rm, stat, symlink, unlink, utimes, writeFile }; \ No newline at end of file diff --git a/tools/ui/node_modules/@quansync/fs/dist/index.mjs b/tools/ui/node_modules/@quansync/fs/dist/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..21df491bfbfceb5f4e5dbb860303857678b73f31 --- /dev/null +++ b/tools/ui/node_modules/@quansync/fs/dist/index.mjs @@ -0,0 +1,144 @@ +import fs from "node:fs"; +import { quansync } from "quansync"; + +//#region src/index.ts +/** +* @link https://nodejs.org/api/fs.html#fspromisesreadfilepath-options +*/ +const readFile = quansync({ + sync: fs.readFileSync, + async: fs.promises.readFile +}); +/** +* @link https://nodejs.org/api/fs.html#fspromiseswritefilefile-data-options +*/ +const writeFile = quansync({ + sync: fs.writeFileSync, + async: fs.promises.writeFile +}); +/** +* @link https://nodejs.org/api/fs.html#fspromisesunlinkpath +*/ +const unlink = quansync({ + sync: fs.unlinkSync, + async: fs.promises.unlink +}); +/** +* @link https://nodejs.org/api/fs.html#fspromisesaccesspath-mode +*/ +const access = quansync({ + sync: fs.accessSync, + async: fs.promises.access +}); +/** +* @link https://nodejs.org/api/fs.html#fspromisesstatpath-options +*/ +const stat = quansync({ + sync: fs.statSync, + async: fs.promises.stat +}); +const lstat = quansync({ + sync: fs.lstatSync, + async: fs.promises.lstat +}); +/** +* @link https://nodejs.org/api/fs.html#fspromisescpsrc-dest-options +*/ +const cp = quansync({ + sync: fs.copyFileSync, + async: fs.promises.copyFile +}); +/** +* @link https://nodejs.org/api/fs.html#fspromisesrmpath-options +*/ +const rm = quansync({ + sync: fs.rmSync, + async: fs.promises.rm +}); +/** +* @link https://nodejs.org/api/fs.html#fspromisesmkdirpath-options +*/ +const mkdir = quansync({ + sync: fs.mkdirSync, + async: fs.promises.mkdir +}); +/** +* @link https://nodejs.org/api/fs.html#fspromisesrenameoldpath-newpath +*/ +const rename = quansync({ + sync: fs.renameSync, + async: fs.promises.rename +}); +/** +* @link https://nodejs.org/api/fs.html#fspromisesreaddirpath-options +*/ +const readdir = quansync({ + sync: fs.readdirSync, + async: fs.promises.readdir +}); +/** +* @link https://nodejs.org/api/fs.html#fspromisesrealpathpath-options +*/ +const realpath = quansync({ + sync: fs.realpathSync, + async: fs.promises.realpath +}); +/** +* @link https://nodejs.org/api/fs.html#fspromisesreadlinkpath-options +*/ +const readlink = quansync({ + sync: fs.readlinkSync, + async: fs.promises.readlink +}); +/** +* @link https://nodejs.org/api/fs.html#fspromisessymlinktarget-path-type +*/ +const symlink = quansync({ + sync: fs.symlinkSync, + async: fs.promises.symlink +}); +/** +* @link https://nodejs.org/api/fs.html#fspromiseschownpath-uid-gid +*/ +const chown = quansync({ + sync: fs.chownSync, + async: fs.promises.chown +}); +/** +* @link https://nodejs.org/api/fs.html#fspromiseslchownpath-uid-gid +*/ +const lchown = quansync({ + sync: fs.lchownSync, + async: fs.promises.lchown +}); +/** +* @link https://nodejs.org/api/fs.html#fspromiseschmodpath-mode +*/ +const chmod = quansync({ + sync: fs.chmodSync, + async: fs.promises.chmod +}); +/** +* @link https://nodejs.org/api/fs.html#fspromisesutimespath-atime-mtime +*/ +const utimes = quansync({ + sync: fs.utimesSync, + async: fs.promises.utimes +}); +/** +* @link https://nodejs.org/api/fs.html#fspromiseslutimespath-atime-mtime +*/ +const lutimes = quansync({ + sync: fs.lutimesSync, + async: fs.promises.lutimes +}); +/** +* @link https://nodejs.org/api/fs.html#fspromisesmkdtempprefix-options +*/ +const mkdtemp = quansync({ + sync: fs.mkdtempSync, + async: fs.promises.mkdtemp +}); + +//#endregion +export { access, chmod, chown, cp, lchown, lstat, lutimes, mkdir, mkdtemp, readFile, readdir, readlink, realpath, rename, rm, stat, symlink, unlink, utimes, writeFile }; \ No newline at end of file diff --git a/tools/ui/node_modules/@quansync/fs/package.json b/tools/ui/node_modules/@quansync/fs/package.json new file mode 100644 index 0000000000000000000000000000000000000000..b30200071601bdb7159fef5536d077d5799231bd --- /dev/null +++ b/tools/ui/node_modules/@quansync/fs/package.json @@ -0,0 +1,57 @@ +{ + "name": "@quansync/fs", + "type": "module", + "version": "1.0.0", + "description": "Filesystem utilities for Quansync", + "author": "Kevin Deng ", + "license": "MIT", + "funding": "https://github.com/sponsors/sxzz", + "homepage": "https://github.com/quansync-dev/fs#readme", + "repository": { + "type": "git", + "url": "git+https://github.com/quansync-dev/fs.git" + }, + "bugs": { + "url": "https://github.com/quansync-dev/fs/issues" + }, + "exports": { + ".": "./dist/index.mjs", + "./package.json": "./package.json" + }, + "main": "./dist/index.mjs", + "module": "./dist/index.mjs", + "types": "./dist/index.d.mts", + "files": [ + "dist" + ], + "publishConfig": { + "access": "public" + }, + "dependencies": { + "quansync": "^1.0.0" + }, + "devDependencies": { + "@sxzz/eslint-config": "^7.4.1", + "@sxzz/prettier-config": "^2.2.6", + "@types/node": "^24.10.1", + "@typescript/native-preview": "7.0.0-dev.20251202.1", + "bumpp": "^10.3.2", + "eslint": "^9.39.1", + "prettier": "^3.7.3", + "tsdown": "^0.17.0-beta.5", + "tsx": "^4.21.0", + "typescript": "^5.9.3", + "vitest": "^4.0.15" + }, + "prettier": "@sxzz/prettier-config", + "scripts": { + "lint": "eslint --cache .", + "lint:fix": "pnpm run lint --fix", + "build": "tsdown", + "dev": "tsdown --watch", + "test": "vitest", + "typecheck": "tsgo --noEmit", + "format": "prettier --cache --write .", + "release": "bumpp" + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/@rollup/plugin-babel/LICENSE b/tools/ui/node_modules/@rollup/plugin-babel/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..5e46702cbdea74f8a8139094f5a1ff1f0e486f45 --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-babel/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019 RollupJS Plugin Contributors (https://github.com/rollup/plugins/graphs/contributors) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/tools/ui/node_modules/@rollup/plugin-babel/README.md b/tools/ui/node_modules/@rollup/plugin-babel/README.md new file mode 100644 index 0000000000000000000000000000000000000000..3b573fbec342ae0960fee6ba22d10e874137dda7 --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-babel/README.md @@ -0,0 +1,404 @@ +[npm]: https://img.shields.io/npm/v/@rollup/plugin-babel +[npm-url]: https://www.npmjs.com/package/@rollup/plugin-babel +[size]: https://packagephobia.now.sh/badge?p=@rollup/plugin-babel +[size-url]: https://packagephobia.now.sh/result?p=@rollup/plugin-babel + +[![npm][npm]][npm-url] +[![size][size]][size-url] +[![libera manifesto](https://img.shields.io/badge/libera-manifesto-lightgrey.svg)](https://liberamanifesto.com) + +# @rollup/plugin-babel + +🍣 A Rollup plugin for seamless integration between Rollup and Babel. + +## Why? + +If you're using Babel to transpile your ES6/7 code and Rollup to generate a standalone bundle, you have a couple of options: + +- run the code through Babel first, being careful to exclude the module transformer, or +- run the code through Rollup first, and _then_ pass it to Babel. + +Both approaches have disadvantages – in the first case, on top of the additional configuration complexity, you may end up with Babel's helpers (like `classCallCheck`) repeated throughout your code (once for each module where the helpers are used). In the second case, transpiling is likely to be slower, because transpiling a large bundle is much more work for Babel than transpiling a set of small files. + +Either way, you have to worry about a place to put the intermediate files, and getting sourcemaps to behave becomes a royal pain. + +Using Rollup with `@rollup/plugin-babel` makes the process far easier. + +## Requirements + +This plugin requires an [LTS](https://github.com/nodejs/Release) Node version (v14.0.0+) and Rollup v1.20.0+. + +## Install + +```bash +npm install @rollup/plugin-babel --save-dev +``` + +## Usage + +Create a `rollup.config.js` [configuration file](https://www.rollupjs.org/guide/en/#configuration-files) and import the plugin: + +```js +import { babel } from '@rollup/plugin-babel'; + +const config = { + input: 'src/index.js', + output: { + dir: 'output', + format: 'es' + }, + plugins: [babel({ babelHelpers: 'bundled' })] +}; + +export default config; +``` + +Then call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#command-line-reference) or the [API](https://www.rollupjs.org/guide/en/#javascript-api). + +### Using With `@rollup/plugin-commonjs` + +When using `@rollup/plugin-babel` with `@rollup/plugin-commonjs` in the same Rollup configuration, it's important to note that `@rollup/plugin-commonjs` _must_ be placed before this plugin in the `plugins` array for the two to work together properly. e.g. + +```js +import { babel } from '@rollup/plugin-babel'; +import commonjs from '@rollup/plugin-commonjs'; + +const config = { + ... + plugins: [ + commonjs(), + babel({ babelHelpers: 'bundled' }) + ], +}; +``` + +## Options + +This plugin respects Babel [configuration files](https://babeljs.io/docs/en/configuration) by default and they are generally the best place to put your configuration. + +You can also run Babel on the generated chunks instead of the input files. Even though this is slower, it is the only way to transpile Rollup's auto-generated wrapper code to lower compatibility targets than ES5, see [Running Babel on the generated code](#running-babel-on-the-generated-code) for details. + +All options are as per the [Babel documentation](https://babeljs.io/docs/en/options), plus the following: + +### `exclude` + +Type: `String | RegExp | Array[...String|RegExp]`
+ +A [picomatch pattern](https://github.com/micromatch/picomatch), or array of patterns, which specifies the files in the build the plugin should _ignore_. When relying on Babel configuration files you can only exclude additional files with this option, you cannot override what you have configured for Babel itself. + +### `include` + +Type: `String | RegExp | Array[...String|RegExp]`
+ +A [picomatch pattern](https://github.com/micromatch/picomatch), or array of patterns, which specifies the files in the build the plugin should operate on. When relying on Babel configuration files you cannot include files already excluded there. + +### `filter` + +Type: (id: string) => boolean
+ +Custom [filter function](https://github.com/rollup/plugins/tree/master/packages/pluginutils#createfilter) can be used to determine whether or not certain modules should be operated upon. + +Usage: + +```js +import { createFilter } from '@rollup/pluginutils'; +const include = 'include/**.js'; +const exclude = 'exclude/**.js'; +const filter = createFilter(include, exclude, {}); +``` + +### `extensions` + +Type: `Array[...String]`
+Default: `['.js', '.jsx', '.es6', '.es', '.mjs']` + +An array of file extensions that Babel should transpile. If you want to transpile TypeScript files with this plugin it's essential to include `.ts` and `.tsx` in this option. + +### `babelHelpers` + +Type: `'bundled' | 'runtime' | 'inline' | 'external'`
+Default: `'bundled'` + +It is recommended to configure this option explicitly (even if with its default value) so an informed decision is taken on how those babel helpers are inserted into the code. + +We recommend to follow these guidelines to determine the most appropriate value for your project: + +- `'runtime'` - you should use this especially when building libraries with Rollup. It has to be used in combination with `@babel/plugin-transform-runtime` and you should also specify `@babel/runtime` as dependency of your package. Don't forget to tell Rollup to treat the helpers imported from within the `@babel/runtime` module as external dependencies when bundling for `cjs` & `es` formats. This can be accomplished via regex (`external: [/@babel\/runtime/]`) or a function (`external: id => id.includes('@babel/runtime')`). It's important to not only specify `external: ['@babel/runtime']` since the helpers are imported from nested paths (e.g `@babel/runtime/helpers/get`) and [Rollup will only exclude modules that match strings exactly](https://rollupjs.org/guide/en/#peer-dependencies). +- `'bundled'` - you should use this if you want your resulting bundle to contain those helpers (at most one copy of each). Useful especially if you bundle an application code. +- `'external'` - use this only if you know what you are doing. It will reference helpers on **global** `babelHelpers` object. Used in combination with `@babel/plugin-external-helpers`. +- `'inline'` - this is not recommended. Helpers will be inserted in each file using this option. This can cause serious code duplication. This is the default Babel behavior as Babel operates on isolated files - however, as Rollup is a bundler and is project-aware (and therefore likely operating across multiple input files), the default of this plugin is `"bundled"`. + +### `skipPreflightCheck` + +Type: `Boolean`
+Default: `false` + +Before transpiling your input files this plugin also transpile a short piece of code **for each** input file. This is used to validate some misconfiguration errors, but for sufficiently big projects it can slow your build times so if you are confident about your configuration then you might disable those checks with this option. + +### External dependencies + +Ideally, you should only be transforming your source code, rather than running all of your external dependencies through Babel (to ignore external dependencies from being handled by this plugin you might use `exclude: 'node_modules/**'` option). If you have a dependency that exposes untranspiled ES6 source code that doesn't run in your target environment, then you may need to break this rule, but it often causes problems with unusual `.babelrc` files or mismatched versions of Babel. + +We encourage library authors not to distribute code that uses untranspiled ES6 features (other than modules) for this reason. Consumers of your library should _not_ have to transpile your ES6 code, any more than they should have to transpile your CoffeeScript, ClojureScript or TypeScript. + +Use `babelrc: false` to prevent Babel from using local (i.e. to your external dependencies) `.babelrc` files, relying instead on the configuration you pass in. + +### Helpers + +In some cases Babel uses _helpers_ to avoid repeating chunks of code – for example, if you use the `class` keyword, it will use a `classCallCheck` function to ensure that the class is instantiated correctly. + +By default, those helpers will be inserted at the top of the file being transformed, which can lead to duplication. This rollup plugin automatically deduplicates those helpers, keeping only one copy of each one used in the output bundle. Rollup will combine the helpers in a single block at the top of your bundle. + +You can customize how those helpers are being inserted into the transformed file with [`babelHelpers`](#babelhelpers) option. + +### Modules + +This is not needed since Babel 7 - it knows automatically that Rollup understands ES modules & that it shouldn't use any module transform with it. Unless you forcefully include a module transform in your Babel configuration. + +If you have been pointed to this section by an error thrown by this plugin, please check your Babel configuration files and disable any module transforms when running Rollup builds. + +## Running Babel on the generated code + +You can run `@rollup/plugin-babel` on the output files instead of the input files by using `getBabelOutputPlugin(...)`. This can be used to perform code transformations on the resulting chunks and is the only way to transform Rollup's auto-generated code. By default, the plugin will be applied to all outputs: + +```js +// rollup.config.js +import { getBabelOutputPlugin } from '@rollup/plugin-babel'; + +export default { + input: 'main.js', + plugins: [ + getBabelOutputPlugin({ + presets: ['@babel/preset-env'] + }) + ], + output: [ + { file: 'bundle.cjs.js', format: 'cjs' }, + { file: 'bundle.es.js', format: 'es' } + ] +}; +``` + +If you only want to apply it to specific outputs, you can use it as an output plugin (requires at least Rollup v1.27.0): + +```js +// rollup.config.js +import { getBabelOutputPlugin } from '@rollup/plugin-babel'; + +export default { + input: 'main.js', + output: [ + { file: 'bundle.js', format: 'es' }, + { + file: 'bundle.es5.js', + format: 'es', + plugins: [getBabelOutputPlugin({ presets: ['@babel/preset-env'] })] + } + ] +}; +``` + +The `include`, `exclude` and `extensions` options are ignored when using `getBabelOutputPlugin` and `createBabelOutputPluginFactory` will produce warnings, and there are a few more points to note that users should be aware of. + +When transforming generated code, you can instead control which chunks are processed by matching their manual chunk names via the `includeChunks`/`excludeChunks` options. These patterns are matched against `chunk.name` as provided to Rollup's `renderChunk` hook and are especially useful to skip already-transpiled/minified vendor chunks: + +```js +// rollup.config.js +import { getBabelOutputPlugin } from '@rollup/plugin-babel'; + +export default { + input: 'main.js', + manualChunks(id) { + if (id.includes('big-library')) return 'vendor'; + }, + output: { + format: 'es', + plugins: [ + getBabelOutputPlugin({ + presets: ['@babel/preset-env'], + // Do not transform the 'vendor' manual chunk + excludeChunks: ['vendor'] + }) + ] + } +}; +``` + +You can also run the plugin twice on the code, once when processing the input files to transpile special syntax to JavaScript and once on the output to transpile to a lower compatibility target: + +```js +// rollup.config.js +import babel, { getBabelOutputPlugin } from '@rollup/plugin-babel'; + +export default { + input: 'main.js', + plugins: [babel({ presets: ['@babel/preset-react'] })], + output: [ + { + file: 'bundle.js', + format: 'es', + plugins: [getBabelOutputPlugin({ presets: ['@babel/preset-env'] })] + } + ] +}; +``` + +### Babel configuration files + +Unlike the regular `babel` plugin, `getBabelOutputPlugin(...)` will **not** automatically search for [Babel configuration files](https://babeljs.io/docs/en/config-files). Besides passing in Babel options directly, however, you can specify a configuration file manually via Babel's [`configFile`](https://babeljs.io/docs/en/options#configfile) option: + +```js +getBabelOutputPlugin({ + configFile: path.resolve(__dirname, 'babel.config.js') +}); +``` + +### Using formats other than ES modules or CommonJS + +As `getBabelOutputPlugin(...)` will run _after_ Rollup has done all its transformations, it needs to make sure it preserves the semantics of Rollup's output format. This is especially important for Babel plugins that add, modify or remove imports or exports, but also for other transformations that add new variables as they can accidentally become global variables depending on the format. Therefore it is recommended that for formats other than `es` or `cjs`, you set Rollup to use the `es` output format and let Babel handle the transformation to another format, e.g. via + +``` +presets: [['@babel/preset-env', { modules: 'umd' }], ...] +``` + +to create a UMD/IIFE compatible output. If you want to use `getBabelOutputPlugin(...)` with other formats, you need to specify `allowAllFormats: true` as plugin option: + +```js +rollup.rollup({...}) +.then(bundle => bundle.generate({ + format: 'iife', + plugins: [getBabelOutputPlugin({ + allowAllFormats: true, + // ... + })] +})) +``` + +### Injected helpers + +By default, helpers e.g. when transpiling classes will be inserted at the top of each chunk. In contrast to when applying this plugin on the input files, helpers will not be deduplicated across chunks. + +Alternatively, you can use imported runtime helpers by adding the `@babel/transform-runtime` plugin. This will make `@babel/runtime` an external dependency of your project, see [@babel/plugin-transform-runtime](https://babeljs.io/docs/en/babel-plugin-transform-runtime) for details. + +Note that this will only work for `es` and `cjs` formats, and you need to make sure to set the `useESModules` option of `@babel/plugin-transform-runtime` to `true` if you create ES output: + +```js +rollup.rollup({...}) +.then(bundle => bundle.generate({ + format: 'es', + plugins: [getBabelOutputPlugin({ + presets: ['@babel/preset-env'], + plugins: [['@babel/plugin-transform-runtime', { useESModules: true }]] + })] +})) +``` + +```js +// input +export default class Foo {} + +// output +import _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck'; + +var Foo = function Foo() { + _classCallCheck(this, Foo); +}; + +export default Foo; +``` + +And for CommonJS: + +```js +rollup.rollup({...}) +.then(bundle => bundle.generate({ + format: 'cjs', + plugins: [getBabelOutputPlugin({ + presets: ['@babel/preset-env'], + plugins: [['@babel/plugin-transform-runtime', { useESModules: false }]] + })] +})) +``` + +```js +// input +export default class Foo {} + +// output +('use strict'); + +var _classCallCheck = require('@babel/runtime/helpers/classCallCheck'); + +var Foo = function Foo() { + _classCallCheck(this, Foo); +}; + +module.exports = Foo; +``` + +Another option is to use `@babel/plugin-external-helpers`, which will reference the global `babelHelpers` object. It is your responsibility to make sure this global variable exists. + +## Custom plugin builder + +`@rollup/plugin-babel` exposes a plugin-builder utility that allows users to add custom handling of Babel's configuration for each file that it processes. + +`createBabelInputPluginFactory` accepts a callback that will be called with the loader's instance of `babel` so that tooling can ensure that it using exactly the same `@babel/core` instance as the loader itself. + +It's main purpose is to allow other tools for configuration of transpilation without forcing people to add extra configuration but still allow for using their own babelrc / babel config files. + +### Example + +```js +import { createBabelInputPluginFactory } from '@rollup/plugin-babel'; + +export default createBabelInputPluginFactory((babelCore) => { + function myPlugin() { + return { + visitor: {} + }; + } + + return { + // Passed the plugin options. + options({ opt1, opt2, ...pluginOptions }) { + return { + // Pull out any custom options that the plugin might have. + customOptions: { opt1, opt2 }, + + // Pass the options back with the two custom options removed. + pluginOptions + }; + }, + + config(cfg /* Passed Babel's 'PartialConfig' object. */, { code, customOptions }) { + if (cfg.hasFilesystemConfig()) { + // Use the normal config + return cfg.options; + } + + return { + ...cfg.options, + plugins: [ + ...(cfg.options.plugins || []), + + // Include a custom plugin in the options. + myPlugin + ] + }; + }, + + result(result, { code, customOptions, config, transformOptions }) { + return { + ...result, + code: result.code + '\n// Generated by some custom plugin' + }; + } + }; +}); +``` + +## Meta + +[CONTRIBUTING](/.github/CONTRIBUTING.md) + +[LICENSE (MIT)](/LICENSE) diff --git a/tools/ui/node_modules/@rollup/plugin-babel/dist/cjs/index.js b/tools/ui/node_modules/@rollup/plugin-babel/dist/cjs/index.js new file mode 100644 index 0000000000000000000000000000000000000000..74ccef64283429fb90069f234ebf2b9c9a4ebac7 --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-babel/dist/cjs/index.js @@ -0,0 +1,410 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var babel = require('@babel/core'); +var pluginutils = require('@rollup/pluginutils'); +var helperModuleImports = require('@babel/helper-module-imports'); + +function _interopNamespaceDefault(e) { + var n = Object.create(null); + if (e) { + Object.keys(e).forEach(function (k) { + if (k !== 'default') { + var d = Object.getOwnPropertyDescriptor(e, k); + Object.defineProperty(n, k, d.get ? d : { + enumerable: true, + get: function () { return e[k]; } + }); + } + }); + } + n.default = e; + return Object.freeze(n); +} + +var babel__namespace = /*#__PURE__*/_interopNamespaceDefault(babel); + +const BUNDLED = 'bundled'; +const INLINE = 'inline'; +const RUNTIME = 'runtime'; +const EXTERNAL = 'external'; + +// NOTE: DO NOT REMOVE the null character `\0` as it may be used by other plugins +// e.g. https://github.com/rollup/rollup-plugin-node-resolve/blob/313a3e32f432f9eb18cc4c231cc7aac6df317a51/src/index.js#L74 +const HELPERS = '\0rollupPluginBabelHelpers.js'; + +function importHelperPlugin({ + types: t +}) { + return { + pre(file) { + const cachedHelpers = {}; + file.set('helperGenerator', name => { + if (!file.availableHelper(name)) { + return null; + } + if (cachedHelpers[name]) { + return t.cloneNode(cachedHelpers[name]); + } + return cachedHelpers[name] = helperModuleImports.addNamed(file.path, name, HELPERS); + }); + } + }; +} + +const addBabelPlugin = (options, plugin) => { + return { + ...options, + plugins: options.plugins.concat(plugin) + }; +}; +const warned = {}; +function warnOnce(ctx, msg) { + if (warned[msg]) return; + warned[msg] = true; + ctx.warn(msg); +} +const regExpCharactersRegExp = /[\\^$.*+?()[\]{}|]/g; +const escapeRegExpCharacters = str => str.replace(regExpCharactersRegExp, '\\$&'); +function stripQuery(id) { + // strip query params from import + const [bareId, query] = id.split('?'); + const suffix = `${query ? `?${query}` : ''}`; + return { + bareId, + query, + suffix + }; +} + +const MODULE_ERROR = 'Rollup requires that your Babel configuration keeps ES6 module syntax intact. ' + 'Unfortunately it looks like your configuration specifies a module transformer ' + 'to replace ES6 modules with another module format. To continue you have to disable it.' + '\n\n' + "Most commonly it's a CommonJS transform added by @babel/preset-env - " + 'in such case you should disable it by adding `modules: false` option to that preset ' + '(described in more detail here - https://github.com/rollup/plugins/tree/master/packages/babel#modules ).'; +const UNEXPECTED_ERROR = 'An unexpected situation arose. Please raise an issue at ' + 'https://github.com/rollup/plugins/issues. Thanks!'; +const PREFLIGHT_TEST_STRING = '__ROLLUP__PREFLIGHT_CHECK_DO_NOT_TOUCH__'; +const PREFLIGHT_INPUT = `export default "${PREFLIGHT_TEST_STRING}";`; +function helpersTestTransform() { + return { + visitor: { + StringLiteral(path, state) { + if (path.node.value === PREFLIGHT_TEST_STRING) { + path.replaceWith(state.file.addHelper('inherits')); + } + } + } + }; +} +const mismatchError = (actual, expected, filename) => `You have declared using "${expected}" babelHelpers, but transforming ${filename} resulted in "${actual}". Please check your configuration.`; + +// Revert to /\/helpers\/(esm\/)?inherits/ when Babel 8 gets released, this was fixed in https://github.com/babel/babel/issues/14185 +const inheritsHelperRe = /[\\/]+helpers[\\/]+(esm[\\/]+)?inherits/; +async function preflightCheck(ctx, babelHelpers, transformOptions) { + const finalOptions = addBabelPlugin(transformOptions, helpersTestTransform); + const check = (await babel__namespace.transformAsync(PREFLIGHT_INPUT, finalOptions)).code; + + // Babel sometimes splits ExportDefaultDeclaration into 2 statements, so we also check for ExportNamedDeclaration + if (!/export (d|{)/.test(check)) { + ctx.error(MODULE_ERROR); + } + if (inheritsHelperRe.test(check)) { + if (babelHelpers === RUNTIME) { + return; + } + ctx.error(mismatchError(RUNTIME, babelHelpers, transformOptions.filename)); + } + if (check.includes('babelHelpers.inherits')) { + if (babelHelpers === EXTERNAL) { + return; + } + ctx.error(mismatchError(EXTERNAL, babelHelpers, transformOptions.filename)); + } + + // test unminifiable string content + if (check.includes('Super expression must either be null or a function')) { + if (babelHelpers === INLINE || babelHelpers === BUNDLED) { + return; + } + if (babelHelpers === RUNTIME && !transformOptions.plugins.length) { + ctx.error(`You must use the \`@babel/plugin-transform-runtime\` plugin when \`babelHelpers\` is "${RUNTIME}".\n`); + } + ctx.error(mismatchError(INLINE, babelHelpers, transformOptions.filename)); + } + ctx.error(UNEXPECTED_ERROR); +} + +async function transformCode(inputCode, babelOptions, overrides, customOptions, ctx, finalizeOptions) { + // loadPartialConfigAsync has become available in @babel/core@7.8.0 + const config = await (babel__namespace.loadPartialConfigAsync || babel__namespace.loadPartialConfig)(babelOptions); + + // file is ignored by babel + if (!config) { + return null; + } + let transformOptions = !overrides.config ? config.options : await overrides.config.call(ctx, config, { + code: inputCode, + customOptions + }); + if (finalizeOptions) { + transformOptions = await finalizeOptions(transformOptions); + } + if (!overrides.result) { + const { + code, + map + } = await babel__namespace.transformAsync(inputCode, transformOptions); + return { + code, + map + }; + } + const result = await babel__namespace.transformAsync(inputCode, transformOptions); + const { + code, + map + } = await overrides.result.call(ctx, result, { + code: inputCode, + customOptions, + config, + transformOptions + }); + return { + code, + map + }; +} + +const unpackOptions = ({ + extensions = babel__namespace.DEFAULT_EXTENSIONS, + // rollup uses sourcemap, babel uses sourceMaps + // just normalize them here so people don't have to worry about it + sourcemap = true, + sourcemaps = true, + sourceMap = true, + sourceMaps = true, + ...rest +} = {}) => { + return { + extensions, + plugins: [], + sourceMaps: sourcemap && sourcemaps && sourceMap && sourceMaps, + ...rest, + caller: { + name: '@rollup/plugin-babel', + ...rest.caller + } + }; +}; +const warnAboutDeprecatedHelpersOption = ({ + deprecatedOption, + suggestion +}) => { + // eslint-disable-next-line no-console + console.warn(`\`${deprecatedOption}\` has been removed in favor a \`babelHelpers\` option. Try changing your configuration to \`${suggestion}\`. ` + `Refer to the documentation to learn more: https://github.com/rollup/plugins/tree/master/packages/babel#babelhelpers`); +}; +const unpackInputPluginOptions = ({ + skipPreflightCheck = false, + ...rest +}, rollupVersion) => { + if ('runtimeHelpers' in rest) { + warnAboutDeprecatedHelpersOption({ + deprecatedOption: 'runtimeHelpers', + suggestion: `babelHelpers: 'runtime'` + }); + } else if ('externalHelpers' in rest) { + warnAboutDeprecatedHelpersOption({ + deprecatedOption: 'externalHelpers', + suggestion: `babelHelpers: 'external'` + }); + } else if (!rest.babelHelpers) { + // eslint-disable-next-line no-console + console.warn("babelHelpers: 'bundled' option was used by default. It is recommended to configure this option explicitly, read more here: " + 'https://github.com/rollup/plugins/tree/master/packages/babel#babelhelpers'); + } + return unpackOptions({ + ...rest, + skipPreflightCheck, + babelHelpers: rest.babelHelpers || BUNDLED, + caller: { + supportsStaticESM: true, + supportsDynamicImport: true, + supportsTopLevelAwait: true, + // todo: remove version checks for 1.20 - 1.25 when we bump peer deps + supportsExportNamespaceFrom: !rollupVersion.match(/^1\.2[0-5]\./), + ...rest.caller + } + }); +}; +const unpackOutputPluginOptions = (options, { + format +}) => unpackOptions({ + configFile: false, + sourceType: format === 'es' ? 'module' : 'script', + ...options, + caller: { + supportsStaticESM: format === 'es', + ...options.caller + } +}); +function getOptionsWithOverrides(pluginOptions = {}, overrides = {}) { + if (!overrides.options) return { + customOptions: null, + pluginOptionsWithOverrides: pluginOptions + }; + const overridden = overrides.options(pluginOptions); + if (typeof overridden.then === 'function') { + throw new Error(".options hook can't be asynchronous. It should return `{ customOptions, pluginsOptions }` synchronously."); + } + return { + customOptions: overridden.customOptions || null, + pluginOptionsWithOverrides: overridden.pluginOptions || pluginOptions + }; +} +const returnObject = () => { + return {}; +}; +function createBabelInputPluginFactory(customCallback = returnObject) { + const overrides = customCallback(babel__namespace); + return pluginOptions => { + const { + customOptions, + pluginOptionsWithOverrides + } = getOptionsWithOverrides(pluginOptions, overrides); + let babelHelpers; + let babelOptions; + let filter; + let skipPreflightCheck; + return { + name: 'babel', + options() { + // todo: remove options hook and hoist declarations when version checks are removed + let exclude; + let include; + let extensions; + let customFilter; + ({ + exclude, + extensions, + babelHelpers, + include, + filter: customFilter, + skipPreflightCheck, + ...babelOptions + } = unpackInputPluginOptions(pluginOptionsWithOverrides, this.meta.rollupVersion)); + const extensionRegExp = new RegExp(`(${extensions.map(escapeRegExpCharacters).join('|')})$`); + if (customFilter && (include || exclude)) { + throw new Error('Could not handle include or exclude with custom filter together'); + } + const userDefinedFilter = typeof customFilter === 'function' ? customFilter : pluginutils.createFilter(include, exclude); + filter = id => extensionRegExp.test(stripQuery(id).bareId) && userDefinedFilter(id); + return null; + }, + resolveId(id) { + if (id !== HELPERS) { + return null; + } + return id; + }, + load(id) { + if (id !== HELPERS) { + return null; + } + return babel__namespace.buildExternalHelpers(null, 'module'); + }, + transform(code, filename) { + if (!filter(filename)) return null; + if (filename === HELPERS) return null; + return transformCode(code, { + ...babelOptions, + filename + }, overrides, customOptions, this, async transformOptions => { + if (!skipPreflightCheck) { + await preflightCheck(this, babelHelpers, transformOptions); + } + return babelHelpers === BUNDLED ? addBabelPlugin(transformOptions, importHelperPlugin) : transformOptions; + }); + } + }; + }; +} +function getRecommendedFormat(rollupFormat) { + switch (rollupFormat) { + case 'amd': + return 'amd'; + case 'iife': + case 'umd': + return 'umd'; + case 'system': + return 'systemjs'; + default: + return ''; + } +} +function createBabelOutputPluginFactory(customCallback = returnObject) { + const overrides = customCallback(babel__namespace); + return pluginOptions => { + const { + customOptions, + pluginOptionsWithOverrides + } = getOptionsWithOverrides(pluginOptions, overrides); + + // cache for chunk name filter (includeChunks/excludeChunks) + let chunkNameFilter; + return { + name: 'babel', + renderStart(outputOptions) { + const { + extensions, + include, + exclude, + allowAllFormats + } = pluginOptionsWithOverrides; + if (extensions || include || exclude) { + warnOnce(this, 'The "include", "exclude" and "extensions" options are ignored when transforming the output.'); + } + if (!allowAllFormats && outputOptions.format !== 'es' && outputOptions.format !== 'cjs') { + this.error(`Using Babel on the generated chunks is strongly discouraged for formats other than "esm" or "cjs" as it can easily break wrapper code and lead to accidentally created global variables. Instead, you should set "output.format" to "esm" and use Babel to transform to another format, e.g. by adding "presets: [['@babel/env', { modules: '${getRecommendedFormat(outputOptions.format)}' }]]" to your Babel options. If you still want to proceed, add "allowAllFormats: true" to your plugin options.`); + } + }, + renderChunk(code, chunk, outputOptions) { + /* eslint-disable no-unused-vars */ + const { + allowAllFormats, + includeChunks, + excludeChunks, + exclude, + extensions, + externalHelpers, + externalHelpersWhitelist, + include, + runtimeHelpers, + ...babelOptions + } = unpackOutputPluginOptions(pluginOptionsWithOverrides, outputOptions); + /* eslint-enable no-unused-vars */ + // If includeChunks/excludeChunks are specified, filter by chunk.name + if (includeChunks != null || excludeChunks != null) { + if (!chunkNameFilter) { + chunkNameFilter = pluginutils.createFilter(includeChunks, excludeChunks, { + resolve: false + }); + } + if (!chunkNameFilter(chunk.name)) { + // Skip transforming this chunk + return null; + } + } + return transformCode(code, babelOptions, overrides, customOptions, this); + } + }; + }; +} + +// export this for symmetry with output-related exports +const getBabelInputPlugin = createBabelInputPluginFactory(); +const getBabelOutputPlugin = createBabelOutputPluginFactory(); + +exports.babel = getBabelInputPlugin; +exports.createBabelInputPluginFactory = createBabelInputPluginFactory; +exports.createBabelOutputPluginFactory = createBabelOutputPluginFactory; +exports.default = getBabelInputPlugin; +exports.getBabelInputPlugin = getBabelInputPlugin; +exports.getBabelOutputPlugin = getBabelOutputPlugin; +module.exports = Object.assign(exports.default, exports); +//# sourceMappingURL=index.js.map diff --git a/tools/ui/node_modules/@rollup/plugin-babel/dist/es/index.js b/tools/ui/node_modules/@rollup/plugin-babel/dist/es/index.js new file mode 100644 index 0000000000000000000000000000000000000000..b3c715e7eb00d8dfa8453825749cd8068f1fd420 --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-babel/dist/es/index.js @@ -0,0 +1,381 @@ +import * as babel from '@babel/core'; +import { createFilter } from '@rollup/pluginutils'; +import { addNamed } from '@babel/helper-module-imports'; + +const BUNDLED = 'bundled'; +const INLINE = 'inline'; +const RUNTIME = 'runtime'; +const EXTERNAL = 'external'; + +// NOTE: DO NOT REMOVE the null character `\0` as it may be used by other plugins +// e.g. https://github.com/rollup/rollup-plugin-node-resolve/blob/313a3e32f432f9eb18cc4c231cc7aac6df317a51/src/index.js#L74 +const HELPERS = '\0rollupPluginBabelHelpers.js'; + +function importHelperPlugin({ + types: t +}) { + return { + pre(file) { + const cachedHelpers = {}; + file.set('helperGenerator', name => { + if (!file.availableHelper(name)) { + return null; + } + if (cachedHelpers[name]) { + return t.cloneNode(cachedHelpers[name]); + } + return cachedHelpers[name] = addNamed(file.path, name, HELPERS); + }); + } + }; +} + +const addBabelPlugin = (options, plugin) => { + return { + ...options, + plugins: options.plugins.concat(plugin) + }; +}; +const warned = {}; +function warnOnce(ctx, msg) { + if (warned[msg]) return; + warned[msg] = true; + ctx.warn(msg); +} +const regExpCharactersRegExp = /[\\^$.*+?()[\]{}|]/g; +const escapeRegExpCharacters = str => str.replace(regExpCharactersRegExp, '\\$&'); +function stripQuery(id) { + // strip query params from import + const [bareId, query] = id.split('?'); + const suffix = `${query ? `?${query}` : ''}`; + return { + bareId, + query, + suffix + }; +} + +const MODULE_ERROR = 'Rollup requires that your Babel configuration keeps ES6 module syntax intact. ' + 'Unfortunately it looks like your configuration specifies a module transformer ' + 'to replace ES6 modules with another module format. To continue you have to disable it.' + '\n\n' + "Most commonly it's a CommonJS transform added by @babel/preset-env - " + 'in such case you should disable it by adding `modules: false` option to that preset ' + '(described in more detail here - https://github.com/rollup/plugins/tree/master/packages/babel#modules ).'; +const UNEXPECTED_ERROR = 'An unexpected situation arose. Please raise an issue at ' + 'https://github.com/rollup/plugins/issues. Thanks!'; +const PREFLIGHT_TEST_STRING = '__ROLLUP__PREFLIGHT_CHECK_DO_NOT_TOUCH__'; +const PREFLIGHT_INPUT = `export default "${PREFLIGHT_TEST_STRING}";`; +function helpersTestTransform() { + return { + visitor: { + StringLiteral(path, state) { + if (path.node.value === PREFLIGHT_TEST_STRING) { + path.replaceWith(state.file.addHelper('inherits')); + } + } + } + }; +} +const mismatchError = (actual, expected, filename) => `You have declared using "${expected}" babelHelpers, but transforming ${filename} resulted in "${actual}". Please check your configuration.`; + +// Revert to /\/helpers\/(esm\/)?inherits/ when Babel 8 gets released, this was fixed in https://github.com/babel/babel/issues/14185 +const inheritsHelperRe = /[\\/]+helpers[\\/]+(esm[\\/]+)?inherits/; +async function preflightCheck(ctx, babelHelpers, transformOptions) { + const finalOptions = addBabelPlugin(transformOptions, helpersTestTransform); + const check = (await babel.transformAsync(PREFLIGHT_INPUT, finalOptions)).code; + + // Babel sometimes splits ExportDefaultDeclaration into 2 statements, so we also check for ExportNamedDeclaration + if (!/export (d|{)/.test(check)) { + ctx.error(MODULE_ERROR); + } + if (inheritsHelperRe.test(check)) { + if (babelHelpers === RUNTIME) { + return; + } + ctx.error(mismatchError(RUNTIME, babelHelpers, transformOptions.filename)); + } + if (check.includes('babelHelpers.inherits')) { + if (babelHelpers === EXTERNAL) { + return; + } + ctx.error(mismatchError(EXTERNAL, babelHelpers, transformOptions.filename)); + } + + // test unminifiable string content + if (check.includes('Super expression must either be null or a function')) { + if (babelHelpers === INLINE || babelHelpers === BUNDLED) { + return; + } + if (babelHelpers === RUNTIME && !transformOptions.plugins.length) { + ctx.error(`You must use the \`@babel/plugin-transform-runtime\` plugin when \`babelHelpers\` is "${RUNTIME}".\n`); + } + ctx.error(mismatchError(INLINE, babelHelpers, transformOptions.filename)); + } + ctx.error(UNEXPECTED_ERROR); +} + +async function transformCode(inputCode, babelOptions, overrides, customOptions, ctx, finalizeOptions) { + // loadPartialConfigAsync has become available in @babel/core@7.8.0 + const config = await (babel.loadPartialConfigAsync || babel.loadPartialConfig)(babelOptions); + + // file is ignored by babel + if (!config) { + return null; + } + let transformOptions = !overrides.config ? config.options : await overrides.config.call(ctx, config, { + code: inputCode, + customOptions + }); + if (finalizeOptions) { + transformOptions = await finalizeOptions(transformOptions); + } + if (!overrides.result) { + const { + code, + map + } = await babel.transformAsync(inputCode, transformOptions); + return { + code, + map + }; + } + const result = await babel.transformAsync(inputCode, transformOptions); + const { + code, + map + } = await overrides.result.call(ctx, result, { + code: inputCode, + customOptions, + config, + transformOptions + }); + return { + code, + map + }; +} + +const unpackOptions = ({ + extensions = babel.DEFAULT_EXTENSIONS, + // rollup uses sourcemap, babel uses sourceMaps + // just normalize them here so people don't have to worry about it + sourcemap = true, + sourcemaps = true, + sourceMap = true, + sourceMaps = true, + ...rest +} = {}) => { + return { + extensions, + plugins: [], + sourceMaps: sourcemap && sourcemaps && sourceMap && sourceMaps, + ...rest, + caller: { + name: '@rollup/plugin-babel', + ...rest.caller + } + }; +}; +const warnAboutDeprecatedHelpersOption = ({ + deprecatedOption, + suggestion +}) => { + // eslint-disable-next-line no-console + console.warn(`\`${deprecatedOption}\` has been removed in favor a \`babelHelpers\` option. Try changing your configuration to \`${suggestion}\`. ` + `Refer to the documentation to learn more: https://github.com/rollup/plugins/tree/master/packages/babel#babelhelpers`); +}; +const unpackInputPluginOptions = ({ + skipPreflightCheck = false, + ...rest +}, rollupVersion) => { + if ('runtimeHelpers' in rest) { + warnAboutDeprecatedHelpersOption({ + deprecatedOption: 'runtimeHelpers', + suggestion: `babelHelpers: 'runtime'` + }); + } else if ('externalHelpers' in rest) { + warnAboutDeprecatedHelpersOption({ + deprecatedOption: 'externalHelpers', + suggestion: `babelHelpers: 'external'` + }); + } else if (!rest.babelHelpers) { + // eslint-disable-next-line no-console + console.warn("babelHelpers: 'bundled' option was used by default. It is recommended to configure this option explicitly, read more here: " + 'https://github.com/rollup/plugins/tree/master/packages/babel#babelhelpers'); + } + return unpackOptions({ + ...rest, + skipPreflightCheck, + babelHelpers: rest.babelHelpers || BUNDLED, + caller: { + supportsStaticESM: true, + supportsDynamicImport: true, + supportsTopLevelAwait: true, + // todo: remove version checks for 1.20 - 1.25 when we bump peer deps + supportsExportNamespaceFrom: !rollupVersion.match(/^1\.2[0-5]\./), + ...rest.caller + } + }); +}; +const unpackOutputPluginOptions = (options, { + format +}) => unpackOptions({ + configFile: false, + sourceType: format === 'es' ? 'module' : 'script', + ...options, + caller: { + supportsStaticESM: format === 'es', + ...options.caller + } +}); +function getOptionsWithOverrides(pluginOptions = {}, overrides = {}) { + if (!overrides.options) return { + customOptions: null, + pluginOptionsWithOverrides: pluginOptions + }; + const overridden = overrides.options(pluginOptions); + if (typeof overridden.then === 'function') { + throw new Error(".options hook can't be asynchronous. It should return `{ customOptions, pluginsOptions }` synchronously."); + } + return { + customOptions: overridden.customOptions || null, + pluginOptionsWithOverrides: overridden.pluginOptions || pluginOptions + }; +} +const returnObject = () => { + return {}; +}; +function createBabelInputPluginFactory(customCallback = returnObject) { + const overrides = customCallback(babel); + return pluginOptions => { + const { + customOptions, + pluginOptionsWithOverrides + } = getOptionsWithOverrides(pluginOptions, overrides); + let babelHelpers; + let babelOptions; + let filter; + let skipPreflightCheck; + return { + name: 'babel', + options() { + // todo: remove options hook and hoist declarations when version checks are removed + let exclude; + let include; + let extensions; + let customFilter; + ({ + exclude, + extensions, + babelHelpers, + include, + filter: customFilter, + skipPreflightCheck, + ...babelOptions + } = unpackInputPluginOptions(pluginOptionsWithOverrides, this.meta.rollupVersion)); + const extensionRegExp = new RegExp(`(${extensions.map(escapeRegExpCharacters).join('|')})$`); + if (customFilter && (include || exclude)) { + throw new Error('Could not handle include or exclude with custom filter together'); + } + const userDefinedFilter = typeof customFilter === 'function' ? customFilter : createFilter(include, exclude); + filter = id => extensionRegExp.test(stripQuery(id).bareId) && userDefinedFilter(id); + return null; + }, + resolveId(id) { + if (id !== HELPERS) { + return null; + } + return id; + }, + load(id) { + if (id !== HELPERS) { + return null; + } + return babel.buildExternalHelpers(null, 'module'); + }, + transform(code, filename) { + if (!filter(filename)) return null; + if (filename === HELPERS) return null; + return transformCode(code, { + ...babelOptions, + filename + }, overrides, customOptions, this, async transformOptions => { + if (!skipPreflightCheck) { + await preflightCheck(this, babelHelpers, transformOptions); + } + return babelHelpers === BUNDLED ? addBabelPlugin(transformOptions, importHelperPlugin) : transformOptions; + }); + } + }; + }; +} +function getRecommendedFormat(rollupFormat) { + switch (rollupFormat) { + case 'amd': + return 'amd'; + case 'iife': + case 'umd': + return 'umd'; + case 'system': + return 'systemjs'; + default: + return ''; + } +} +function createBabelOutputPluginFactory(customCallback = returnObject) { + const overrides = customCallback(babel); + return pluginOptions => { + const { + customOptions, + pluginOptionsWithOverrides + } = getOptionsWithOverrides(pluginOptions, overrides); + + // cache for chunk name filter (includeChunks/excludeChunks) + let chunkNameFilter; + return { + name: 'babel', + renderStart(outputOptions) { + const { + extensions, + include, + exclude, + allowAllFormats + } = pluginOptionsWithOverrides; + if (extensions || include || exclude) { + warnOnce(this, 'The "include", "exclude" and "extensions" options are ignored when transforming the output.'); + } + if (!allowAllFormats && outputOptions.format !== 'es' && outputOptions.format !== 'cjs') { + this.error(`Using Babel on the generated chunks is strongly discouraged for formats other than "esm" or "cjs" as it can easily break wrapper code and lead to accidentally created global variables. Instead, you should set "output.format" to "esm" and use Babel to transform to another format, e.g. by adding "presets: [['@babel/env', { modules: '${getRecommendedFormat(outputOptions.format)}' }]]" to your Babel options. If you still want to proceed, add "allowAllFormats: true" to your plugin options.`); + } + }, + renderChunk(code, chunk, outputOptions) { + /* eslint-disable no-unused-vars */ + const { + allowAllFormats, + includeChunks, + excludeChunks, + exclude, + extensions, + externalHelpers, + externalHelpersWhitelist, + include, + runtimeHelpers, + ...babelOptions + } = unpackOutputPluginOptions(pluginOptionsWithOverrides, outputOptions); + /* eslint-enable no-unused-vars */ + // If includeChunks/excludeChunks are specified, filter by chunk.name + if (includeChunks != null || excludeChunks != null) { + if (!chunkNameFilter) { + chunkNameFilter = createFilter(includeChunks, excludeChunks, { + resolve: false + }); + } + if (!chunkNameFilter(chunk.name)) { + // Skip transforming this chunk + return null; + } + } + return transformCode(code, babelOptions, overrides, customOptions, this); + } + }; + }; +} + +// export this for symmetry with output-related exports +const getBabelInputPlugin = createBabelInputPluginFactory(); +const getBabelOutputPlugin = createBabelOutputPluginFactory(); + +export { getBabelInputPlugin as babel, createBabelInputPluginFactory, createBabelOutputPluginFactory, getBabelInputPlugin as default, getBabelInputPlugin, getBabelOutputPlugin }; +//# sourceMappingURL=index.js.map diff --git a/tools/ui/node_modules/@rollup/plugin-babel/dist/es/package.json b/tools/ui/node_modules/@rollup/plugin-babel/dist/es/package.json new file mode 100644 index 0000000000000000000000000000000000000000..7c34deb5837d8d5e168b54f95f7872b2c50eca13 --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-babel/dist/es/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tools/ui/node_modules/@rollup/plugin-babel/package.json b/tools/ui/node_modules/@rollup/plugin-babel/package.json new file mode 100644 index 0000000000000000000000000000000000000000..5c4924a9ab2f53b65aa20013445c3300fa868a83 --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-babel/package.json @@ -0,0 +1,97 @@ +{ + "name": "@rollup/plugin-babel", + "version": "6.1.0", + "publishConfig": { + "access": "public" + }, + "description": "Seamless integration between Rollup and Babel.", + "license": "MIT", + "repository": { + "url": "rollup/plugins", + "directory": "packages/babel" + }, + "author": "Rich Harris", + "homepage": "https://github.com/rollup/plugins/tree/master/packages/babel#readme", + "bugs": "https://github.com/rollup/plugins/issues", + "main": "./dist/cjs/index.js", + "module": "./dist/es/index.js", + "exports": { + "types": "./types/index.d.ts", + "import": "./dist/es/index.js", + "default": "./dist/cjs/index.js" + }, + "engines": { + "node": ">=14.0.0" + }, + "files": [ + "dist", + "!dist/**/*.map", + "types", + "README.md", + "LICENSE" + ], + "keywords": [ + "rollup", + "plugin", + "rollup-plugin", + "babel", + "es2015", + "es6" + ], + "peerDependencies": { + "@babel/core": "^7.0.0", + "@types/babel__core": "^7.1.9", + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + }, + "@types/babel__core": { + "optional": true + } + }, + "dependencies": { + "@babel/helper-module-imports": "^7.18.6", + "@rollup/pluginutils": "^5.0.1" + }, + "devDependencies": { + "@babel/core": "^7.19.1", + "@babel/plugin-external-helpers": "^7.18.6", + "@babel/plugin-proposal-decorators": "^7.19.1", + "@babel/plugin-syntax-dynamic-import": "^7.8.3", + "@babel/plugin-transform-runtime": "^7.19.1", + "@babel/preset-env": "^7.19.1", + "@rollup/plugin-json": "^5.0.0", + "@rollup/plugin-node-resolve": "^15.0.0", + "@types/babel__core": "^7.1.9", + "rollup": "^4.0.0-24", + "source-map": "^0.7.4" + }, + "types": "./types/index.d.ts", + "ava": { + "files": [ + "!**/fixtures/**", + "!**/helpers/**", + "!**/recipes/**", + "!**/types.ts" + ] + }, + "contributors": [ + "Bogdan Chadkin ", + "Mateusz Burzyński (https://github.com/Andarist)" + ], + "scripts": { + "build": "rollup -c", + "ci:coverage": "nyc pnpm test && nyc report --reporter=text-lcov > coverage.lcov", + "ci:lint": "pnpm build && pnpm lint", + "ci:lint:commits": "commitlint --from=${CIRCLE_BRANCH} --to=${CIRCLE_SHA1}", + "ci:test": "pnpm test -- --verbose", + "prebuild": "del-cli dist", + "prerelease": "pnpm build", + "pretest": "pnpm build", + "release": "pnpm --workspace-root package:release $(pwd)", + "test": "ava", + "test:ts": "tsc types/index.d.ts test/types.ts --noEmit" + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/@rollup/plugin-babel/types/index.d.ts b/tools/ui/node_modules/@rollup/plugin-babel/types/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..20288d8a0a462e551bcc697d19b98c79d41c669a --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-babel/types/index.d.ts @@ -0,0 +1,143 @@ +import type { Plugin, PluginContext, TransformPluginContext } from 'rollup'; +import type { FilterPattern, CreateFilter } from '@rollup/pluginutils'; +import type * as babelCore from '@babel/core'; + +export interface RollupBabelInputPluginOptions + extends Omit { + /** + * A picomatch pattern, or array of patterns, which specifies the files in the build the plugin should operate on. When relying on Babel configuration files you cannot include files already excluded there. + * @default undefined; + */ + include?: FilterPattern; + /** + * A picomatch pattern, or array of patterns, which specifies the files in the build the plugin should ignore. When relaying on Babel configuration files you can only exclude additional files with this option, you cannot override what you have configured for Babel itself. + * @default undefined; + */ + exclude?: FilterPattern; + /** + * Custom filter function can be used to determine whether or not certain modules should be operated upon. + * Example: + * import { createFilter } from '@rollup/pluginutils'; + * const include = 'include/**.js'; + * const exclude = 'exclude/**.js'; + * const filter = createFilter(include, exclude, {}); + * @default undefined; + */ + filter?: ReturnType; + /** + * An array of file extensions that Babel should transpile. If you want to transpile TypeScript files with this plugin it's essential to include .ts and .tsx in this option. + * @default ['.js', '.jsx', '.es6', '.es', '.mjs'] + */ + extensions?: string[]; + /** + * It is recommended to configure this option explicitly (even if with its default value) so an informed decision is taken on how those babel helpers are inserted into the code. + * @default 'bundled' + */ + babelHelpers?: 'bundled' | 'runtime' | 'inline' | 'external'; + /** + * Before transpiling your input files this plugin also transpile a short piece of code for each input file. This is used to validate some misconfiguration errors, but for sufficiently big projects it can slow your build times so if you are confident about your configuration then you might disable those checks with this option. + * @default false + */ + skipPreflightCheck?: boolean; +} + +export interface RollupBabelOutputPluginOptions + extends Omit { + /** + * Use with other formats than UMD/IIFE. + * @default false + */ + allowAllFormats?: boolean; + /** + * Limit transforming of generated code to specific manual chunks by name. + * These patterns are matched against the `chunk.name` value in Rollup's `renderChunk` hook. + */ + includeChunks?: FilterPattern; + /** + * Exclude specific manual chunks by name from transforming the generated code. + * These patterns are matched against the `chunk.name` value in Rollup's `renderChunk` hook. + */ + excludeChunks?: FilterPattern; +} + +export type RollupBabelCustomInputPluginOptions = ( + options: RollupBabelInputPluginOptions & Record +) => { + customOptions: Record; + pluginOptions: RollupBabelInputPluginOptions; +}; +export type RollupBabelCustomOutputPluginOptions = ( + options: RollupBabelOutputPluginOptions & Record +) => { + customOptions: Record; + pluginOptions: RollupBabelOutputPluginOptions; +}; +export interface RollupBabelCustomPluginConfigOptions { + code: string; + customOptions: Record; +} +export interface RollupBabelCustomPluginResultOptions { + code: string; + customOptions: Record; + config: babelCore.PartialConfig; + transformOptions: babelCore.TransformOptions; +} +export type RollupBabelCustomInputPluginConfig = ( + this: TransformPluginContext, + cfg: babelCore.PartialConfig, + options: RollupBabelCustomPluginConfigOptions +) => babelCore.TransformOptions; +export type RollupBabelCustomInputPluginResult = ( + this: TransformPluginContext, + result: babelCore.BabelFileResult, + options: RollupBabelCustomPluginResultOptions +) => babelCore.BabelFileResult; +export type RollupBabelCustomOutputPluginConfig = ( + this: PluginContext, + cfg: babelCore.PartialConfig, + options: RollupBabelCustomPluginConfigOptions +) => babelCore.TransformOptions; +export type RollupBabelCustomOutputPluginResult = ( + this: PluginContext, + result: babelCore.BabelFileResult, + options: RollupBabelCustomPluginResultOptions +) => babelCore.BabelFileResult; +export interface RollupBabelCustomInputPlugin { + options?: RollupBabelCustomInputPluginOptions; + config?: RollupBabelCustomInputPluginConfig; + result?: RollupBabelCustomInputPluginResult; +} +export interface RollupBabelCustomOutputPlugin { + options?: RollupBabelCustomOutputPluginOptions; + config?: RollupBabelCustomOutputPluginConfig; + result?: RollupBabelCustomOutputPluginResult; +} +export type RollupBabelCustomInputPluginBuilder = ( + babel: typeof babelCore +) => RollupBabelCustomInputPlugin; +export type RollupBabelCustomOutputPluginBuilder = ( + babel: typeof babelCore +) => RollupBabelCustomOutputPlugin; + +/** + * A Rollup plugin for seamless integration between Rollup and Babel. + * @param options - Plugin options. + * @returns Plugin instance. + */ +export function getBabelInputPlugin(options?: RollupBabelInputPluginOptions): Plugin; +export function getBabelOutputPlugin(options?: RollupBabelOutputPluginOptions): Plugin; + +export function createBabelInputPluginFactory( + customCallback?: RollupBabelCustomInputPluginBuilder +): typeof getBabelInputPlugin; +export function createBabelOutputPluginFactory( + customCallback?: RollupBabelCustomOutputPluginBuilder +): typeof getBabelOutputPlugin; + +/** + * A Rollup plugin for seamless integration between Rollup and Babel. + * @param options - Plugin options. + * @returns Plugin instance. + */ +export function babel(options?: RollupBabelInputPluginOptions): Plugin; +export default babel; diff --git a/tools/ui/node_modules/@rollup/plugin-node-resolve/LICENSE b/tools/ui/node_modules/@rollup/plugin-node-resolve/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..5e46702cbdea74f8a8139094f5a1ff1f0e486f45 --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-node-resolve/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019 RollupJS Plugin Contributors (https://github.com/rollup/plugins/graphs/contributors) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/tools/ui/node_modules/@rollup/plugin-node-resolve/README.md b/tools/ui/node_modules/@rollup/plugin-node-resolve/README.md new file mode 100644 index 0000000000000000000000000000000000000000..bf3987e2ff66c680b70cef6aee107055a5fc61d7 --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-node-resolve/README.md @@ -0,0 +1,296 @@ +[npm]: https://img.shields.io/npm/v/@rollup/plugin-node-resolve +[npm-url]: https://www.npmjs.com/package/@rollup/plugin-node-resolve +[size]: https://packagephobia.now.sh/badge?p=@rollup/plugin-node-resolve +[size-url]: https://packagephobia.now.sh/result?p=@rollup/plugin-node-resolve + +[![npm][npm]][npm-url] +[![size][size]][size-url] +[![libera manifesto](https://img.shields.io/badge/libera-manifesto-lightgrey.svg)](https://liberamanifesto.com) + +# @rollup/plugin-node-resolve + +🍣 A Rollup plugin which locates modules using the [Node resolution algorithm](https://nodejs.org/api/modules.html#modules_all_together), for using third party modules in `node_modules` + +## Requirements + +This plugin requires an [LTS](https://github.com/nodejs/Release) Node version (v14.0.0+) and Rollup v2.78.0+. + +## Install + +Using npm: + +```console +npm install @rollup/plugin-node-resolve --save-dev +``` + +## Usage + +Create a `rollup.config.js` [configuration file](https://www.rollupjs.org/guide/en/#configuration-files) and import the plugin: + +```js +import { nodeResolve } from '@rollup/plugin-node-resolve'; + +export default { + input: 'src/index.js', + output: { + dir: 'output', + format: 'cjs' + }, + plugins: [nodeResolve()] +}; +``` + +Then call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#command-line-reference) or the [API](https://www.rollupjs.org/guide/en/#javascript-api). + +## Package entrypoints + +This plugin supports the package entrypoints feature from node js, specified in the `exports` or `imports` field of a package. Check the [official documentation](https://nodejs.org/api/packages.html#packages_package_entry_points) for more information on how this works. This is the default behavior. In the abscence of these fields, the fields in `mainFields` will be the ones to be used. + +## Options + +### `exportConditions` + +Type: `Array[...String]`
+Default: `[]` + +Additional conditions of the package.json exports field to match when resolving modules. By default, this plugin looks for the `['default', 'module', 'import', 'development|production']` conditions when resolving imports. If neither the `development` or `production` conditions are provided it will default to `production` - or `development` if `NODE_ENV` is set to a value other than `production`. + +When using `@rollup/plugin-commonjs` v16 or higher, this plugin will use the `['default', 'module', 'require']` conditions when resolving require statements. + +Setting this option will add extra conditions on top of the default conditions. See https://nodejs.org/api/packages.html#packages_conditional_exports for more information. + +In order to get the [resolution behavior of Node.js](https://nodejs.org/api/packages.html#packages_conditional_exports), set this to `['node']`. + +### `browser` + +Type: `Boolean`
+Default: `false` + +If `true`, instructs the plugin to use the browser module resolutions in `package.json` and adds `'browser'` to `exportConditions` if it is not present so browser conditionals in `exports` are applied. If `false`, any browser properties in package files will be ignored. Alternatively, a value of `'browser'` can be added to both the `mainFields` and `exportConditions` options, however this option takes precedence over `mainFields`. + +> This option does not work when a package is using [package entrypoints](https://nodejs.org/api/packages.html#packages_package_entry_points) + +### `moduleDirectories` + +Type: `Array[...String]`
+Default: `['node_modules']` + +A list of directory names in which to recursively look for modules. + +### `modulePaths` + +Type: `Array[...String]`
+Default: `[]` + +A list of absolute paths to additional locations to search for modules. [This is analogous to setting the `NODE_PATH` environment variable for node](https://nodejs.org/api/modules.html#loading-from-the-global-folders). + +### `dedupe` + +Type: `Array[...String]`
+Default: `[]` + +An `Array` of modules names, which instructs the plugin to force resolving for the specified modules to the root `node_modules`. Helps to prevent bundling the same package multiple times if package is imported from dependencies. + +```js +dedupe: ['my-package', '@namespace/my-package']; +``` + +This will deduplicate bare imports such as: + +```js +import 'my-package'; +import '@namespace/my-package'; +``` + +And it will deduplicate deep imports such as: + +```js +import 'my-package/foo.js'; +import '@namespace/my-package/bar.js'; +``` + +### `extensions` + +Type: `Array[...String]`
+Default: `['.mjs', '.js', '.json', '.node']` + +Specifies the extensions of files that the plugin will operate on. + +### `jail` + +Type: `String`
+Default: `'/'` + +Locks the module search within specified path (e.g. chroot). Modules defined outside this path will be ignored by this plugin. + +### `mainFields` + +Type: `Array[...String]`
+Default: `['module', 'main']`
+Valid values: `['browser', 'jsnext:main', 'module', 'main']` + +Specifies the properties to scan within a `package.json`, used to determine the bundle entry point. The order of property names is significant, as the first-found property is used as the resolved entry point. If the array contains `'browser'`, key/values specified in the `package.json` `browser` property will be used. + +### `preferBuiltins` + +Type: `Boolean | (module: string) => boolean`
+Default: `true` (with warnings if a builtin module is used over a local version. Set to `true` to disable warning.) + +If `true`, the plugin will prefer built-in modules (e.g. `fs`, `path`). If `false`, the plugin will look for locally installed modules of the same name. + +Alternatively, you may pass in a function that returns a boolean to confirm whether the plugin should prefer built-in modules. e.g. + +```js +preferBuiltins: (module) => module !== 'punycode'; +``` + +will not treat `punycode` as a built-in module + +### `modulesOnly` + +Type: `Boolean`
+Default: `false` + +If `true`, inspect resolved files to assert that they are ES2015 modules. + +### `resolveOnly` + +Type: `Array[...String|RegExp] | (module: string) => boolean`
+Default: `null` + +An `Array` which instructs the plugin to limit module resolution to those whose names match patterns in the array. _Note: Modules not matching any patterns will be marked as external._ + +Alternatively, you may pass in a function that returns a boolean to confirm whether the module should be included or not. + +Examples: + +- `resolveOnly: ['batman', /^@batcave\/.*$/]` +- `resolveOnly: module => !module.includes('joker')` + +### `rootDir` + +Type: `String`
+Default: `process.cwd()` + +Specifies the root directory from which to resolve modules. Typically used when resolving entry-point imports, and when resolving deduplicated modules. Useful when executing rollup in a package of a mono-repository. + +``` +// Set the root directory to be the parent folder +rootDir: path.join(process.cwd(), '..') +``` + +### `ignoreSideEffectsForRoot` + +Type: `Boolean`
+Default: `false` + +If you use the `sideEffects` property in the package.json, by default this is respected for files in the root package. Set to `true` to ignore the `sideEffects` configuration for the root package. + +### `allowExportsFolderMapping` + +Older Node versions supported exports mappings of folders like + +```json +{ + "exports": { + "./foo/": "./dist/foo/" + } +} +``` + +This was deprecated with Node 14 and removed in Node 17, instead it is recommended to use exports patterns like + +```json +{ + "exports": { + "./foo/*": "./dist/foo/*" + } +} +``` + +But for backwards compatibility this behavior is still supported by enabling the `allowExportsFolderMapping` (defaults to `true`). +The default value might change in a futur major release. + +## Preserving symlinks + +This plugin honours the rollup [`preserveSymlinks`](https://rollupjs.org/guide/en/#preservesymlinks) option. + +## Using with @rollup/plugin-commonjs + +Since most packages in your node_modules folder are probably legacy CommonJS rather than JavaScript modules, you may need to use [@rollup/plugin-commonjs](https://github.com/rollup/plugins/tree/master/packages/commonjs): + +```js +// rollup.config.js +import { nodeResolve } from '@rollup/plugin-node-resolve'; +import commonjs from '@rollup/plugin-commonjs'; + +export default { + input: 'main.js', + output: { + file: 'bundle.js', + format: 'iife', + name: 'MyModule' + }, + plugins: [nodeResolve(), commonjs()] +}; +``` + +## Resolving Built-Ins (like `fs`) + +By default this plugin will prefer built-ins over local modules, marking them as external. + +See [`preferBuiltins`](#preferbuiltins). + +To provide stubbed versions of Node built-ins, use a plugin like [rollup-plugin-node-polyfills](https://github.com/ionic-team/rollup-plugin-node-polyfills) and set `preferBuiltins` to `false`. e.g. + +```js +import { nodeResolve } from '@rollup/plugin-node-resolve'; +import nodePolyfills from 'rollup-plugin-node-polyfills'; +export default ({ + input: ..., + plugins: [ + nodePolyfills(), + nodeResolve({ preferBuiltins: false }) + ], + external: builtins, + output: ... +}) +``` + +## Resolving Require Statements + +According to [NodeJS module resolution](https://nodejs.org/api/packages.html#packages_package_entry_points) `require` statements should resolve using the `require` condition in the package exports field, while es modules should use the `import` condition. + +The node resolve plugin uses `import` by default, you can opt into using the `require` semantics by passing an extra option to the resolve function: + +```js +this.resolve(importee, importer, { + skipSelf: true, + custom: { 'node-resolve': { isRequire: true } } +}); +``` + +## Resolve Options + +After this plugin resolved an import id to its target file in `node_modules`, it will invoke `this.resolve` again with the resolved id. It will pass the following information in the resolve options: + +```js +this.resolve(resolved.id, importer, { + custom: { + 'node-resolve': { + resolved, // the object with information from node.js resolve + importee // the original import id + } + } +}); +``` + +Your plugin can use the `importee` information to map an original import to its resolved file in `node_modules`, in a plugin hook such as `resolveId`. + +The `resolved` object contains the resolved id, which is passed as the first parameter. It also has a property `moduleSideEffects`, which may contain the value from the npm `package.json` field `sideEffects` or `null`. + +## Meta + +[CONTRIBUTING](/.github/CONTRIBUTING.md) + +[LICENSE (MIT)](/LICENSE) diff --git a/tools/ui/node_modules/@rollup/plugin-node-resolve/dist/cjs/index.js b/tools/ui/node_modules/@rollup/plugin-node-resolve/dist/cjs/index.js new file mode 100644 index 0000000000000000000000000000000000000000..4047435046a30bede18b1b88a86310bf6180f24f --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-node-resolve/dist/cjs/index.js @@ -0,0 +1,1397 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var path = require('path'); +var module$1 = require('module'); +var deepMerge = require('deepmerge'); +var isModule = require('is-module'); +var fs = require('fs'); +var util = require('util'); +var url = require('url'); +var resolve = require('resolve'); +var pluginutils = require('@rollup/pluginutils'); + +var version = "16.0.3"; +var peerDependencies = { + rollup: "^2.78.0||^3.0.0||^4.0.0" +}; + +util.promisify(fs.access); +const readFile$1 = util.promisify(fs.readFile); +const realpath = util.promisify(fs.realpath); +const stat = util.promisify(fs.stat); +async function fileExists(filePath) { + try { + const res = await stat(filePath); + return res.isFile(); + } + catch { + return false; + } +} +async function resolveSymlink(path) { + return (await fileExists(path)) ? realpath(path) : path; +} + +const onError = (error) => { + if (error.code === 'ENOENT') { + return false; + } + throw error; +}; + +const makeCache = (fn) => { + const cache = new Map(); + const wrapped = async (param, done) => { + if (cache.has(param) === false) { + cache.set( + param, + fn(param).catch((err) => { + cache.delete(param); + throw err; + }) + ); + } + + try { + const result = cache.get(param); + const value = await result; + return done(null, value); + } catch (error) { + return done(error); + } + }; + + wrapped.clear = () => cache.clear(); + + return wrapped; +}; + +const isDirCached = makeCache(async (file) => { + try { + const stats = await stat(file); + return stats.isDirectory(); + } catch (error) { + return onError(error); + } +}); + +const isFileCached = makeCache(async (file) => { + try { + const stats = await stat(file); + return stats.isFile(); + } catch (error) { + return onError(error); + } +}); + +const readCachedFile = makeCache(readFile$1); + +function handleDeprecatedOptions(opts) { + const warnings = []; + + if (opts.customResolveOptions) { + const { customResolveOptions } = opts; + if (customResolveOptions.moduleDirectory) { + // eslint-disable-next-line no-param-reassign + opts.moduleDirectories = Array.isArray(customResolveOptions.moduleDirectory) + ? customResolveOptions.moduleDirectory + : [customResolveOptions.moduleDirectory]; + + warnings.push( + 'node-resolve: The `customResolveOptions.moduleDirectory` option has been deprecated. Use `moduleDirectories`, which must be an array.' + ); + } + + if (customResolveOptions.preserveSymlinks) { + throw new Error( + 'node-resolve: `customResolveOptions.preserveSymlinks` is no longer an option. We now always use the rollup `preserveSymlinks` option.' + ); + } + + [ + 'basedir', + 'package', + 'extensions', + 'includeCoreModules', + 'readFile', + 'isFile', + 'isDirectory', + 'realpath', + 'packageFilter', + 'pathFilter', + 'paths', + 'packageIterator' + ].forEach((resolveOption) => { + if (customResolveOptions[resolveOption]) { + throw new Error( + `node-resolve: \`customResolveOptions.${resolveOption}\` is no longer an option. If you need this, please open an issue.` + ); + } + }); + } + + return { warnings }; +} + +// returns the imported package name for bare module imports +function getPackageName(id) { + if (id.startsWith('.') || id.startsWith('/')) { + return null; + } + + const split = id.split('/'); + + // @my-scope/my-package/foo.js -> @my-scope/my-package + // @my-scope/my-package -> @my-scope/my-package + if (split[0][0] === '@') { + return `${split[0]}/${split[1]}`; + } + + // my-package/foo.js -> my-package + // my-package -> my-package + return split[0]; +} + +function getMainFields(options) { + let mainFields; + if (options.mainFields) { + ({ mainFields } = options); + } else { + mainFields = ['module', 'main']; + } + if (options.browser && mainFields.indexOf('browser') === -1) { + return ['browser'].concat(mainFields); + } + if (!mainFields.length) { + throw new Error('Please ensure at least one `mainFields` value is specified'); + } + return mainFields; +} + +function getPackageInfo(options) { + const { + cache, + extensions, + pkg, + mainFields, + preserveSymlinks, + useBrowserOverrides, + rootDir, + ignoreSideEffectsForRoot + } = options; + let { pkgPath } = options; + + if (cache.has(pkgPath)) { + return cache.get(pkgPath); + } + + // browserify/resolve doesn't realpath paths returned in its packageFilter callback + if (!preserveSymlinks) { + pkgPath = fs.realpathSync(pkgPath); + } + + const pkgRoot = path.dirname(pkgPath); + + const packageInfo = { + // copy as we are about to munge the `main` field of `pkg`. + packageJson: { ...pkg }, + + // path to package.json file + packageJsonPath: pkgPath, + + // directory containing the package.json + root: pkgRoot, + + // which main field was used during resolution of this module (main, module, or browser) + resolvedMainField: 'main', + + // whether the browser map was used to resolve the entry point to this module + browserMappedMain: false, + + // the entry point of the module with respect to the selected main field and any + // relevant browser mappings. + resolvedEntryPoint: '' + }; + + let overriddenMain = false; + for (let i = 0; i < mainFields.length; i++) { + const field = mainFields[i]; + if (typeof pkg[field] === 'string') { + pkg.main = pkg[field]; + packageInfo.resolvedMainField = field; + overriddenMain = true; + break; + } + } + + const internalPackageInfo = { + cachedPkg: pkg, + hasModuleSideEffects: () => null, + hasPackageEntry: overriddenMain !== false || mainFields.indexOf('main') !== -1, + packageBrowserField: + useBrowserOverrides && + typeof pkg.browser === 'object' && + Object.keys(pkg.browser).reduce((browser, key) => { + let resolved = pkg.browser[key]; + if (resolved && resolved[0] === '.') { + resolved = path.resolve(pkgRoot, resolved); + } + /* eslint-disable no-param-reassign */ + browser[key] = resolved; + if (key[0] === '.') { + const absoluteKey = path.resolve(pkgRoot, key); + browser[absoluteKey] = resolved; + if (!path.extname(key)) { + extensions.reduce((subBrowser, ext) => { + subBrowser[absoluteKey + ext] = subBrowser[key]; + return subBrowser; + }, browser); + } + } + return browser; + }, {}), + packageInfo + }; + + const browserMap = internalPackageInfo.packageBrowserField; + if ( + useBrowserOverrides && + typeof pkg.browser === 'object' && + // eslint-disable-next-line no-prototype-builtins + browserMap.hasOwnProperty(pkg.main) + ) { + packageInfo.resolvedEntryPoint = browserMap[pkg.main]; + packageInfo.browserMappedMain = true; + } else { + // index.node is technically a valid default entrypoint as well... + packageInfo.resolvedEntryPoint = path.resolve(pkgRoot, pkg.main || 'index.js'); + packageInfo.browserMappedMain = false; + } + + if (!ignoreSideEffectsForRoot || rootDir !== pkgRoot) { + const packageSideEffects = pkg.sideEffects; + if (typeof packageSideEffects === 'boolean') { + internalPackageInfo.hasModuleSideEffects = () => packageSideEffects; + } else if (Array.isArray(packageSideEffects)) { + const finalPackageSideEffects = packageSideEffects.map((sideEffect) => { + /* + * The array accepts simple glob patterns to the relevant files... Patterns like .css, which do not include a /, will be treated like **\/.css. + * https://webpack.js.org/guides/tree-shaking/ + */ + if (sideEffect.includes('/')) { + return sideEffect; + } + return `**/${sideEffect}`; + }); + internalPackageInfo.hasModuleSideEffects = pluginutils.createFilter(finalPackageSideEffects, null, { + resolve: pkgRoot + }); + } + } + + cache.set(pkgPath, internalPackageInfo); + return internalPackageInfo; +} + +function normalizeInput(input) { + if (Array.isArray(input)) { + return input; + } else if (typeof input === 'object') { + return Object.values(input); + } + + // otherwise it's a string + return [input]; +} + +/* eslint-disable no-await-in-loop */ +function isModuleDir(current, moduleDirs) { + return moduleDirs.some((dir) => current.endsWith(dir)); +} +async function findPackageJson(base, moduleDirs) { + const { root } = path.parse(base); + let current = base; + while (current !== root && !isModuleDir(current, moduleDirs)) { + const pkgJsonPath = path.join(current, 'package.json'); + if (await fileExists(pkgJsonPath)) { + const pkgJsonString = fs.readFileSync(pkgJsonPath, 'utf-8'); + return { pkgJson: JSON.parse(pkgJsonString), pkgPath: current, pkgJsonPath }; + } + current = path.resolve(current, '..'); + } + return null; +} +function isUrl(str) { + try { + return !!new URL(str); + } + catch (_) { + return false; + } +} +/** + * Conditions is an export object where all keys are conditions like 'node' (aka do not with '.') + */ +function isConditions(exports) { + return typeof exports === 'object' && Object.keys(exports).every((k) => !k.startsWith('.')); +} +/** + * Mappings is an export object where all keys start with '. + */ +function isMappings(exports) { + return typeof exports === 'object' && !isConditions(exports); +} +/** + * Check for mixed exports, which are exports where some keys start with '.' and some do not + */ +function isMixedExports(exports) { + const keys = Object.keys(exports); + return keys.some((k) => k.startsWith('.')) && keys.some((k) => !k.startsWith('.')); +} +function createBaseErrorMsg(importSpecifier, importer) { + return `Could not resolve import "${importSpecifier}" in ${importer}`; +} +function createErrorMsg(context, reason, isImports) { + const { importSpecifier, importer, pkgJsonPath } = context; + const base = createBaseErrorMsg(importSpecifier, importer); + const field = isImports ? 'imports' : 'exports'; + return `${base} using ${field} defined in ${pkgJsonPath}.${reason ? ` ${reason}` : ''}`; +} +class ResolveError extends Error { +} +class InvalidConfigurationError extends ResolveError { + constructor(context, reason) { + super(createErrorMsg(context, `Invalid "exports" field. ${reason}`)); + } +} +class InvalidModuleSpecifierError extends ResolveError { + constructor(context, isImports, reason) { + super(createErrorMsg(context, reason, isImports)); + } +} +class InvalidPackageTargetError extends ResolveError { + constructor(context, reason) { + super(createErrorMsg(context, reason)); + } +} + +/* eslint-disable no-await-in-loop, no-undefined */ +/** + * Check for invalid path segments + */ +function includesInvalidSegments(pathSegments, moduleDirs) { + const invalidSegments = ['', '.', '..', ...moduleDirs]; + // contains any "", ".", "..", or "node_modules" segments, including percent encoded variants + return pathSegments.some((v) => invalidSegments.includes(v) || invalidSegments.includes(decodeURI(v))); +} +async function resolvePackageTarget(context, { target, patternMatch, isImports }) { + // If target is a String, then + if (typeof target === 'string') { + // If target does not start with "./", then + if (!target.startsWith('./')) { + // If isImports is false, or if target starts with "../" or "/", or if target is a valid URL, then + if (!isImports || ['/', '../'].some((p) => target.startsWith(p)) || isUrl(target)) { + // Throw an Invalid Package Target error. + throw new InvalidPackageTargetError(context, `Invalid mapping: "${target}".`); + } + // If patternMatch is a String, then + if (typeof patternMatch === 'string') { + // Return PACKAGE_RESOLVE(target with every instance of "*" replaced by patternMatch, packageURL + "/") + const result = await context.resolveId(target.replace(/\*/g, patternMatch), context.pkgURL.href); + return result ? url.pathToFileURL(result.location).href : null; + } + // Return PACKAGE_RESOLVE(target, packageURL + "/"). + const result = await context.resolveId(target, context.pkgURL.href); + return result ? url.pathToFileURL(result.location).href : null; + } + // TODO: Drop if we do not support Node <= 16 anymore + // This behavior was removed in Node 17 (deprecated in Node 14), see DEP0148 + if (context.allowExportsFolderMapping) { + target = target.replace(/\/$/, '/*'); + } + // If target split on "/" or "\" + { + const pathSegments = target.split(/\/|\\/); + // after the first "." segment + const firstDot = pathSegments.indexOf('.'); + firstDot !== -1 && pathSegments.slice(firstDot); + if (firstDot !== -1 && + firstDot < pathSegments.length - 1 && + includesInvalidSegments(pathSegments.slice(firstDot + 1), context.moduleDirs)) { + throw new InvalidPackageTargetError(context, `Invalid mapping: "${target}".`); + } + } + // Let resolvedTarget be the URL resolution of the concatenation of packageURL and target. + const resolvedTarget = new URL(target, context.pkgURL); + // Assert: resolvedTarget is contained in packageURL. + if (!resolvedTarget.href.startsWith(context.pkgURL.href)) { + throw new InvalidPackageTargetError(context, `Resolved to ${resolvedTarget.href} which is outside package ${context.pkgURL.href}`); + } + // If patternMatch is null, then + if (!patternMatch) { + // Return resolvedTarget. + return resolvedTarget; + } + // If patternMatch split on "/" or "\" contains invalid segments + if (includesInvalidSegments(patternMatch.split(/\/|\\/), context.moduleDirs)) { + // throw an Invalid Module Specifier error. + throw new InvalidModuleSpecifierError(context); + } + // Return the URL resolution of resolvedTarget with every instance of "*" replaced with patternMatch. + return resolvedTarget.href.replace(/\*/g, patternMatch); + } + // Otherwise, if target is an Array, then + if (Array.isArray(target)) { + // If _target.length is zero, return null. + if (target.length === 0) { + return null; + } + let lastError = null; + // For each item in target, do + for (const item of target) { + // Let resolved be the result of PACKAGE_TARGET_RESOLVE of the item + // continuing the loop on any Invalid Package Target error. + try { + const resolved = await resolvePackageTarget(context, { + target: item, + patternMatch, + isImports + }); + // If resolved is undefined, continue the loop. + // Else Return resolved. + if (resolved !== undefined) { + return resolved; + } + } + catch (error) { + if (!(error instanceof InvalidPackageTargetError)) { + throw error; + } + else { + lastError = error; + } + } + } + // Return or throw the last fallback resolution null return or error + if (lastError) { + throw lastError; + } + return null; + } + // Otherwise, if target is a non-null Object, then + if (target && typeof target === 'object') { + // For each property of target + for (const [key, value] of Object.entries(target)) { + // If exports contains any index property keys, as defined in ECMA-262 6.1.7 Array Index, throw an Invalid Package Configuration error. + // TODO: We do not check if the key is a number here... + // If key equals "default" or conditions contains an entry for the key, then + if (key === 'default' || context.conditions.includes(key)) { + // Let targetValue be the value of the property in target. + // Let resolved be the result of PACKAGE_TARGET_RESOLVE of the targetValue + const resolved = await resolvePackageTarget(context, { + target: value, + patternMatch, + isImports + }); + // If resolved is equal to undefined, continue the loop. + // Return resolved. + if (resolved !== undefined) { + return resolved; + } + } + } + // Return undefined. + return undefined; + } + // Otherwise, if target is null, return null. + if (target === null) { + return null; + } + // Otherwise throw an Invalid Package Target error. + throw new InvalidPackageTargetError(context, `Invalid exports field.`); +} + +/* eslint-disable no-await-in-loop */ +/** + * Implementation of Node's `PATTERN_KEY_COMPARE` function + */ +function nodePatternKeyCompare(keyA, keyB) { + // Let baseLengthA be the index of "*" in keyA plus one, if keyA contains "*", or the length of keyA otherwise. + const baseLengthA = keyA.includes('*') ? keyA.indexOf('*') + 1 : keyA.length; + // Let baseLengthB be the index of "*" in keyB plus one, if keyB contains "*", or the length of keyB otherwise. + const baseLengthB = keyB.includes('*') ? keyB.indexOf('*') + 1 : keyB.length; + // if baseLengthA is greater, return -1, if lower 1 + const rval = baseLengthB - baseLengthA; + if (rval !== 0) + return rval; + // If keyA does not contain "*", return 1. + if (!keyA.includes('*')) + return 1; + // If keyB does not contain "*", return -1. + if (!keyB.includes('*')) + return -1; + // If the length of keyA is greater than the length of keyB, return -1. + // If the length of keyB is greater than the length of keyA, return 1. + // Else Return 0. + return keyB.length - keyA.length; +} +async function resolvePackageImportsExports(context, { matchKey, matchObj, isImports }) { + // If matchKey is a key of matchObj and does not contain "*", then + if (!matchKey.includes('*') && matchKey in matchObj) { + // Let target be the value of matchObj[matchKey]. + const target = matchObj[matchKey]; + // Return the result of PACKAGE_TARGET_RESOLVE(packageURL, target, null, isImports, conditions). + const resolved = await resolvePackageTarget(context, { target, patternMatch: '', isImports }); + return resolved; + } + // Let expansionKeys be the list of keys of matchObj containing only a single "*" + const expansionKeys = Object.keys(matchObj) + // Assert: ends with "/" or contains only a single "*". + .filter((k) => k.endsWith('/') || k.includes('*')) + // sorted by the sorting function PATTERN_KEY_COMPARE which orders in descending order of specificity. + .sort(nodePatternKeyCompare); + // For each key expansionKey in expansionKeys, do + for (const expansionKey of expansionKeys) { + const indexOfAsterisk = expansionKey.indexOf('*'); + // Let patternBase be the substring of expansionKey up to but excluding the first "*" character. + const patternBase = indexOfAsterisk === -1 ? expansionKey : expansionKey.substring(0, indexOfAsterisk); + // If matchKey starts with but is not equal to patternBase, then + if (matchKey.startsWith(patternBase) && matchKey !== patternBase) { + // Let patternTrailer be the substring of expansionKey from the index after the first "*" character. + const patternTrailer = indexOfAsterisk !== -1 ? expansionKey.substring(indexOfAsterisk + 1) : ''; + // If patternTrailer has zero length, + if (patternTrailer.length === 0 || + // or if matchKey ends with patternTrailer and the length of matchKey is greater than or equal to the length of expansionKey, then + (matchKey.endsWith(patternTrailer) && matchKey.length >= expansionKey.length)) { + // Let target be the value of matchObj[expansionKey]. + const target = matchObj[expansionKey]; + // Let patternMatch be the substring of matchKey starting at the index of the length of patternBase up to the length + // of matchKey minus the length of patternTrailer. + const patternMatch = matchKey.substring(patternBase.length, matchKey.length - patternTrailer.length); + // Return the result of PACKAGE_TARGET_RESOLVE + const resolved = await resolvePackageTarget(context, { + target, + patternMatch, + isImports + }); + return resolved; + } + } + } + throw new InvalidModuleSpecifierError(context, isImports); +} + +/** + * Implementation of PACKAGE_EXPORTS_RESOLVE + */ +async function resolvePackageExports(context, subpath, exports) { + // If exports is an Object with both a key starting with "." and a key not starting with "." + if (isMixedExports(exports)) { + // throw an Invalid Package Configuration error. + throw new InvalidConfigurationError(context, 'All keys must either start with ./, or without one.'); + } + // If subpath is equal to ".", then + if (subpath === '.') { + // Let mainExport be undefined. + let mainExport; + // If exports is a String or Array, or an Object containing no keys starting with ".", then + if (typeof exports === 'string' || Array.isArray(exports) || isConditions(exports)) { + // Set mainExport to exports + mainExport = exports; + // Otherwise if exports is an Object containing a "." property, then + } + else if (isMappings(exports)) { + // Set mainExport to exports["."] + mainExport = exports['.']; + } + // If mainExport is not undefined, then + if (mainExport) { + // Let resolved be the result of PACKAGE_TARGET_RESOLVE with target = mainExport + const resolved = await resolvePackageTarget(context, { + target: mainExport, + patternMatch: '', + isImports: false + }); + // If resolved is not null or undefined, return resolved. + if (resolved) { + return resolved; + } + } + // Otherwise, if exports is an Object and all keys of exports start with ".", then + } + else if (isMappings(exports)) { + // Let resolved be the result of PACKAGE_IMPORTS_EXPORTS_RESOLVE + const resolvedMatch = await resolvePackageImportsExports(context, { + matchKey: subpath, + matchObj: exports, + isImports: false + }); + // If resolved is not null or undefined, return resolved. + if (resolvedMatch) { + return resolvedMatch; + } + } + // Throw a Package Path Not Exported error. + throw new InvalidModuleSpecifierError(context); +} + +async function resolvePackageImports({ importSpecifier, importer, moduleDirs, conditions, resolveId }) { + const result = await findPackageJson(importer, moduleDirs); + if (!result) { + throw new Error(`${createBaseErrorMsg(importSpecifier, importer)}. Could not find a parent package.json.`); + } + const { pkgPath, pkgJsonPath, pkgJson } = result; + const pkgURL = url.pathToFileURL(`${pkgPath}/`); + const context = { + importer, + importSpecifier, + moduleDirs, + pkgURL, + pkgJsonPath, + conditions, + resolveId + }; + // Assert: specifier begins with "#". + if (!importSpecifier.startsWith('#')) { + throw new InvalidModuleSpecifierError(context, true, 'Invalid import specifier.'); + } + // If specifier is exactly equal to "#" or starts with "#/", then + if (importSpecifier === '#' || importSpecifier.startsWith('#/')) { + // Throw an Invalid Module Specifier error. + throw new InvalidModuleSpecifierError(context, true, 'Invalid import specifier.'); + } + const { imports } = pkgJson; + if (!imports) { + throw new InvalidModuleSpecifierError(context, true); + } + // Let packageURL be the result of LOOKUP_PACKAGE_SCOPE(parentURL). + // If packageURL is not null, then + return resolvePackageImportsExports(context, { + matchKey: importSpecifier, + matchObj: imports, + isImports: true + }); +} + +const resolveImportPath = util.promisify(resolve); +const readFile = util.promisify(fs.readFile); + +async function getPackageJson(importer, pkgName, resolveOptions, moduleDirectories) { + if (importer) { + const selfPackageJsonResult = await findPackageJson(importer, moduleDirectories); + if (selfPackageJsonResult && selfPackageJsonResult.pkgJson.name === pkgName) { + // the referenced package name is the current package + return selfPackageJsonResult; + } + } + + try { + const pkgJsonPath = await resolveImportPath(`${pkgName}/package.json`, resolveOptions); + const pkgJson = JSON.parse(await readFile(pkgJsonPath, 'utf-8')); + return { pkgJsonPath, pkgJson, pkgPath: path.dirname(pkgJsonPath) }; + } catch (_) { + return null; + } +} + +async function resolveIdClassic({ + importSpecifier, + packageInfoCache, + extensions, + mainFields, + preserveSymlinks, + useBrowserOverrides, + baseDir, + moduleDirectories, + modulePaths, + rootDir, + ignoreSideEffectsForRoot +}) { + let hasModuleSideEffects = () => null; + let hasPackageEntry = true; + let packageBrowserField = false; + let packageInfo; + + const filter = (pkg, pkgPath) => { + const info = getPackageInfo({ + cache: packageInfoCache, + extensions, + pkg, + pkgPath, + mainFields, + preserveSymlinks, + useBrowserOverrides, + rootDir, + ignoreSideEffectsForRoot + }); + + ({ packageInfo, hasModuleSideEffects, hasPackageEntry, packageBrowserField } = info); + + return info.cachedPkg; + }; + + const resolveOptions = { + basedir: baseDir, + readFile: readCachedFile, + isFile: isFileCached, + isDirectory: isDirCached, + extensions, + includeCoreModules: false, + moduleDirectory: moduleDirectories, + paths: modulePaths, + preserveSymlinks, + packageFilter: filter + }; + + let location; + try { + location = await resolveImportPath(importSpecifier, resolveOptions); + } catch (error) { + if (error.code !== 'MODULE_NOT_FOUND') { + throw error; + } + return null; + } + + return { + location: preserveSymlinks ? location : await resolveSymlink(location), + hasModuleSideEffects, + hasPackageEntry, + packageBrowserField, + packageInfo + }; +} + +async function resolveWithExportMap({ + importer, + importSpecifier, + exportConditions, + packageInfoCache, + extensions, + mainFields, + preserveSymlinks, + useBrowserOverrides, + baseDir, + moduleDirectories, + modulePaths, + rootDir, + ignoreSideEffectsForRoot, + allowExportsFolderMapping +}) { + if (importSpecifier.startsWith('#')) { + // this is a package internal import, resolve using package imports field + const resolveResult = await resolvePackageImports({ + importSpecifier, + importer, + moduleDirs: moduleDirectories, + conditions: exportConditions, + // Resolve targets of "imports" mappings using the same algorithm + // we use for normal specifiers: try export maps first and then + // fall back to classic resolution. This is important for cases + // like "#foo/*": "@scope/pkg/*" where the target package relies + // on "exports" to expose subpaths. Using the classic resolver + // alone would fail to find those subpaths. + resolveId(id /* , parent*/) { + return resolveImportSpecifiers({ + importer, + importSpecifierList: [id], + exportConditions, + // pass-through of the rest of the context + packageInfoCache, + extensions, + mainFields, + preserveSymlinks, + useBrowserOverrides, + baseDir, + moduleDirectories, + modulePaths, + rootDir, + ignoreSideEffectsForRoot, + allowExportsFolderMapping + }); + } + }); + + if (resolveResult == null) { + // When the target of an "imports" mapping cannot be resolved, + // surface a proper resolve error instead of throwing from + // fileURLToPath(null). + throw new ResolveError( + `Could not resolve import "${importSpecifier}" in ${importer} using imports.` + ); + } + const location = url.fileURLToPath(resolveResult); + return { + location: preserveSymlinks ? location : await resolveSymlink(location), + hasModuleSideEffects: () => null, + hasPackageEntry: true, + packageBrowserField: false, + // eslint-disable-next-line no-undefined + packageInfo: undefined + }; + } + + const pkgName = getPackageName(importSpecifier); + if (pkgName) { + // it's a bare import, find the package.json and resolve using package exports if available + let hasModuleSideEffects = () => null; + let hasPackageEntry = true; + let packageBrowserField = false; + let packageInfo; + + const filter = (pkg, pkgPath) => { + const info = getPackageInfo({ + cache: packageInfoCache, + extensions, + pkg, + pkgPath, + mainFields, + preserveSymlinks, + useBrowserOverrides, + rootDir, + ignoreSideEffectsForRoot + }); + + ({ packageInfo, hasModuleSideEffects, hasPackageEntry, packageBrowserField } = info); + + return info.cachedPkg; + }; + + const resolveOptions = { + basedir: baseDir, + readFile: readCachedFile, + isFile: isFileCached, + isDirectory: isDirCached, + extensions, + includeCoreModules: false, + moduleDirectory: moduleDirectories, + paths: modulePaths, + preserveSymlinks, + packageFilter: filter + }; + + const result = await getPackageJson(importer, pkgName, resolveOptions, moduleDirectories); + + if (result && result.pkgJson.exports) { + const { pkgJson, pkgJsonPath } = result; + const subpath = + pkgName === importSpecifier ? '.' : `.${importSpecifier.substring(pkgName.length)}`; + const pkgDr = pkgJsonPath.replace('package.json', ''); + const pkgURL = url.pathToFileURL(pkgDr); + + const context = { + importer, + importSpecifier, + moduleDirs: moduleDirectories, + pkgURL, + pkgJsonPath, + allowExportsFolderMapping, + conditions: exportConditions + }; + const resolvedPackageExport = await resolvePackageExports(context, subpath, pkgJson.exports); + const location = url.fileURLToPath(resolvedPackageExport); + if (location) { + return { + location: preserveSymlinks ? location : await resolveSymlink(location), + hasModuleSideEffects, + hasPackageEntry, + packageBrowserField, + packageInfo + }; + } + } + } + + return null; +} + +async function resolveWithClassic({ + importer, + importSpecifierList, + exportConditions, + warn, + packageInfoCache, + extensions, + mainFields, + preserveSymlinks, + useBrowserOverrides, + baseDir, + moduleDirectories, + modulePaths, + rootDir, + ignoreSideEffectsForRoot +}) { + for (let i = 0; i < importSpecifierList.length; i++) { + // eslint-disable-next-line no-await-in-loop + const result = await resolveIdClassic({ + importer, + importSpecifier: importSpecifierList[i], + exportConditions, + warn, + packageInfoCache, + extensions, + mainFields, + preserveSymlinks, + useBrowserOverrides, + baseDir, + moduleDirectories, + modulePaths, + rootDir, + ignoreSideEffectsForRoot + }); + + if (result) { + return result; + } + } + + return null; +} + +// Resolves to the module if found or `null`. +// The first import specifier will first be attempted with the exports algorithm. +// If this is unsuccessful because export maps are not being used, then all of `importSpecifierList` +// will be tried with the classic resolution algorithm +async function resolveImportSpecifiers({ + importer, + importSpecifierList, + exportConditions, + warn, + packageInfoCache, + extensions, + mainFields, + preserveSymlinks, + useBrowserOverrides, + baseDir, + moduleDirectories, + modulePaths, + rootDir, + ignoreSideEffectsForRoot, + allowExportsFolderMapping +}) { + try { + const exportMapRes = await resolveWithExportMap({ + importer, + importSpecifier: importSpecifierList[0], + exportConditions, + packageInfoCache, + extensions, + mainFields, + preserveSymlinks, + useBrowserOverrides, + baseDir, + moduleDirectories, + modulePaths, + rootDir, + ignoreSideEffectsForRoot, + allowExportsFolderMapping + }); + if (exportMapRes) return exportMapRes; + } catch (error) { + if (error instanceof ResolveError) { + warn(error); + return null; + } + throw error; + } + + // package has no imports or exports, use classic node resolve + return resolveWithClassic({ + importer, + importSpecifierList, + exportConditions, + warn, + packageInfoCache, + extensions, + mainFields, + preserveSymlinks, + useBrowserOverrides, + baseDir, + moduleDirectories, + modulePaths, + rootDir, + ignoreSideEffectsForRoot + }); +} + +const versionRegexp = /\^(\d+\.\d+\.\d+)/g; + +function validateVersion(actualVersion, peerDependencyVersion) { + let minMajor = Infinity; + let minMinor = Infinity; + let minPatch = Infinity; + let foundVersion; + // eslint-disable-next-line no-cond-assign + while ((foundVersion = versionRegexp.exec(peerDependencyVersion))) { + const [foundMajor, foundMinor, foundPatch] = foundVersion[1].split('.').map(Number); + if (foundMajor < minMajor) { + minMajor = foundMajor; + minMinor = foundMinor; + minPatch = foundPatch; + } + } + if (!actualVersion) { + throw new Error( + `Insufficient Rollup version: "@rollup/plugin-node-resolve" requires at least rollup@${minMajor}.${minMinor}.${minPatch}.` + ); + } + const [major, minor, patch] = actualVersion.split('.').map(Number); + if ( + major < minMajor || + (major === minMajor && (minor < minMinor || (minor === minMinor && patch < minPatch))) + ) { + throw new Error( + `Insufficient rollup version: "@rollup/plugin-node-resolve" requires at least rollup@${minMajor}.${minMinor}.${minPatch} but found rollup@${actualVersion}.` + ); + } +} + +/* eslint-disable no-param-reassign, no-shadow, no-undefined */ + +const ES6_BROWSER_EMPTY = '\0node-resolve:empty.js'; +const deepFreeze = (object) => { + Object.freeze(object); + + for (const value of Object.values(object)) { + if (typeof value === 'object' && !Object.isFrozen(value)) { + deepFreeze(value); + } + } + + return object; +}; + +const baseConditions = ['default', 'module']; +const baseConditionsEsm = [...baseConditions, 'import']; +const baseConditionsCjs = [...baseConditions, 'require']; +const defaults = { + dedupe: [], + // It's important that .mjs is listed before .js so that Rollup will interpret npm modules + // which deploy both ESM .mjs and CommonJS .js files as ESM. + extensions: ['.mjs', '.js', '.json', '.node'], + resolveOnly: [], + moduleDirectories: ['node_modules'], + modulePaths: [], + ignoreSideEffectsForRoot: false, + // TODO: set to false in next major release or remove + allowExportsFolderMapping: true +}; +const nodeImportPrefix = /^node:/; + +const DEFAULTS = deepFreeze(deepMerge({}, defaults)); + +function nodeResolve(opts = {}) { + const { warnings } = handleDeprecatedOptions(opts); + + const options = { ...defaults, ...opts }; + const { extensions, jail, moduleDirectories, modulePaths, ignoreSideEffectsForRoot } = options; + const exportConditions = options.exportConditions || []; + const devProdCondition = + exportConditions.includes('development') || exportConditions.includes('production') + ? [] + : [ + process.env.NODE_ENV && process.env.NODE_ENV !== 'production' + ? 'development' + : 'production' + ]; + const conditionsEsm = [...baseConditionsEsm, ...exportConditions, ...devProdCondition]; + const conditionsCjs = [...baseConditionsCjs, ...exportConditions, ...devProdCondition]; + const packageInfoCache = new Map(); + const idToPackageInfo = new Map(); + const mainFields = getMainFields(options); + const useBrowserOverrides = mainFields.indexOf('browser') !== -1; + const isPreferBuiltinsSet = Object.prototype.hasOwnProperty.call(options, 'preferBuiltins'); + const preferBuiltins = isPreferBuiltinsSet ? options.preferBuiltins : true; + const rootDir = path.resolve(options.rootDir || process.cwd()); + let { dedupe } = options; + let rollupOptions; + + if (moduleDirectories.some((name) => name.includes('/'))) { + throw new Error( + '`moduleDirectories` option must only contain directory names. If you want to load modules from somewhere not supported by the default module resolution algorithm, see `modulePaths`.' + ); + } + + if (typeof dedupe !== 'function') { + dedupe = (importee) => + options.dedupe.includes(importee) || options.dedupe.includes(getPackageName(importee)); + } + + // creates a function from the patterns to test if a particular module should be bundled. + const allowPatterns = (patterns) => { + const regexPatterns = patterns.map((pattern) => { + if (pattern instanceof RegExp) { + return pattern; + } + const normalized = pattern.replace(/[\\^$*+?.()|[\]{}]/g, '\\$&'); + return new RegExp(`^${normalized}$`); + }); + return (id) => !regexPatterns.length || regexPatterns.some((pattern) => pattern.test(id)); + }; + + const resolveOnly = + typeof options.resolveOnly === 'function' + ? options.resolveOnly + : allowPatterns(options.resolveOnly); + + const browserMapCache = new Map(); + let preserveSymlinks; + + const resolveLikeNode = async (context, importee, importer, custom) => { + // strip query params from import + const [importPath, params] = importee.split('?'); + const importSuffix = `${params ? `?${params}` : ''}`; + importee = importPath; + + const baseDir = !importer || dedupe(importee) ? rootDir : path.dirname(importer); + + // https://github.com/defunctzombie/package-browser-field-spec + const browser = browserMapCache.get(importer); + if (useBrowserOverrides && browser) { + const resolvedImportee = path.resolve(baseDir, importee); + if (browser[importee] === false || browser[resolvedImportee] === false) { + return { id: ES6_BROWSER_EMPTY }; + } + const browserImportee = + (importee[0] !== '.' && browser[importee]) || + browser[resolvedImportee] || + browser[`${resolvedImportee}.js`] || + browser[`${resolvedImportee}.json`]; + if (browserImportee) { + importee = browserImportee; + } + } + + const parts = importee.split(/[/\\]/); + let id = parts.shift(); + let isRelativeImport = false; + + if (id[0] === '@' && parts.length > 0) { + // scoped packages + id += `/${parts.shift()}`; + } else if (id[0] === '.') { + // an import relative to the parent dir of the importer + id = path.resolve(baseDir, importee); + isRelativeImport = true; + } + + // if it's not a relative import, and it's not requested, reject it. + if (!isRelativeImport && !resolveOnly(id)) { + if (normalizeInput(rollupOptions.input).includes(importee)) { + return null; + } + return false; + } + + const importSpecifierList = [importee]; + + if (importer === undefined && importee[0] && !importee[0].match(/^\.?\.?\//)) { + // For module graph roots (i.e. when importer is undefined), we + // need to handle 'path fragments` like `foo/bar` that are commonly + // found in rollup config files. If importee doesn't look like a + // relative or absolute path, we make it relative and attempt to + // resolve it. + importSpecifierList.push(`./${importee}`); + } + + // TypeScript files may import '.mjs' or '.cjs' to refer to either '.mts' or '.cts'. + // They may also import .js to refer to either .ts or .tsx, and .jsx to refer to .tsx. + if (importer && /\.(ts|mts|cts|tsx)$/.test(importer)) { + for (const [importeeExt, resolvedExt] of [ + ['.js', '.ts'], + ['.js', '.tsx'], + ['.jsx', '.tsx'], + ['.mjs', '.mts'], + ['.cjs', '.cts'] + ]) { + if (importee.endsWith(importeeExt) && extensions.includes(resolvedExt)) { + importSpecifierList.push(importee.slice(0, -importeeExt.length) + resolvedExt); + } + } + } + + const warn = (...args) => context.warn(...args); + const isRequire = custom && custom['node-resolve'] && custom['node-resolve'].isRequire; + const exportConditions = isRequire ? conditionsCjs : conditionsEsm; + if (useBrowserOverrides && !exportConditions.includes('browser')) + exportConditions.push('browser'); + + const resolvedWithoutBuiltins = await resolveImportSpecifiers({ + importer, + importSpecifierList, + exportConditions, + warn, + packageInfoCache, + extensions, + mainFields, + preserveSymlinks, + useBrowserOverrides, + baseDir, + moduleDirectories, + modulePaths, + rootDir, + ignoreSideEffectsForRoot, + allowExportsFolderMapping: options.allowExportsFolderMapping + }); + + const importeeIsBuiltin = module$1.builtinModules.includes(importee.replace(nodeImportPrefix, '')); + const preferImporteeIsBuiltin = + typeof preferBuiltins === 'function' ? preferBuiltins(importee) : preferBuiltins; + const resolved = + importeeIsBuiltin && preferImporteeIsBuiltin + ? { + packageInfo: undefined, + hasModuleSideEffects: () => null, + hasPackageEntry: true, + packageBrowserField: false + } + : resolvedWithoutBuiltins; + if (!resolved) { + return null; + } + + const { packageInfo, hasModuleSideEffects, hasPackageEntry, packageBrowserField } = resolved; + let { location } = resolved; + if (packageBrowserField) { + if (Object.prototype.hasOwnProperty.call(packageBrowserField, location)) { + if (!packageBrowserField[location]) { + browserMapCache.set(location, packageBrowserField); + return { id: ES6_BROWSER_EMPTY }; + } + location = packageBrowserField[location]; + } + browserMapCache.set(location, packageBrowserField); + } + + if (hasPackageEntry && !preserveSymlinks) { + const exists = await fileExists(location); + if (exists) { + location = await realpath(location); + } + } + + idToPackageInfo.set(location, packageInfo); + + if (hasPackageEntry) { + if (importeeIsBuiltin && preferImporteeIsBuiltin) { + if (!isPreferBuiltinsSet && resolvedWithoutBuiltins && resolved !== importee) { + context.warn({ + message: + `preferring built-in module '${importee}' over local alternative at '${resolvedWithoutBuiltins.location}', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning.` + + `or passing a function to 'preferBuiltins' to provide more fine-grained control over which built-in modules to prefer.`, + pluginCode: 'PREFER_BUILTINS' + }); + } + return false; + } else if (jail && location.indexOf(path.normalize(jail.trim(path.sep))) !== 0) { + return null; + } + } + + if (options.modulesOnly && (await fileExists(location))) { + const code = await readFile$1(location, 'utf-8'); + if (isModule(code)) { + return { + id: `${location}${importSuffix}`, + moduleSideEffects: hasModuleSideEffects(location) + }; + } + return null; + } + return { + id: `${location}${importSuffix}`, + moduleSideEffects: hasModuleSideEffects(location) + }; + }; + + return { + name: 'node-resolve', + + version, + + buildStart(buildOptions) { + validateVersion(this.meta.rollupVersion, peerDependencies.rollup); + rollupOptions = buildOptions; + + for (const warning of warnings) { + this.warn(warning); + } + + ({ preserveSymlinks } = buildOptions); + }, + + generateBundle() { + readCachedFile.clear(); + isFileCached.clear(); + isDirCached.clear(); + }, + + resolveId: { + order: 'post', + async handler(importee, importer, resolveOptions) { + if (importee === ES6_BROWSER_EMPTY) { + return importee; + } + // ignore IDs with null character, these belong to other plugins + if (importee && importee.includes('\0')) return null; + + const { custom = {} } = resolveOptions; + const { 'node-resolve': { resolved: alreadyResolved } = {} } = custom; + if (alreadyResolved) { + return alreadyResolved; + } + + if (importer && importer.includes('\0')) { + importer = undefined; + } + + const resolved = await resolveLikeNode(this, importee, importer, custom); + if (resolved) { + // This way, plugins may attach additional meta information to the + // resolved id or make it external. We do not skip node-resolve here + // because another plugin might again use `this.resolve` in its + // `resolveId` hook, in which case we want to add the correct + // `moduleSideEffects` information. + const resolvedResolved = await this.resolve(resolved.id, importer, { + ...resolveOptions, + skipSelf: false, + custom: { ...custom, 'node-resolve': { ...custom['node-resolve'], resolved, importee } } + }); + if (resolvedResolved) { + // Handle plugins that manually make the result external + if (resolvedResolved.external) { + return false; + } + // Allow other plugins to take over resolution. Rollup core will not + // change the id if it corresponds to an existing file + if (resolvedResolved.id !== resolved.id) { + return resolvedResolved; + } + // Pass on meta information added by other plugins + return { ...resolved, meta: resolvedResolved.meta }; + } + } + return resolved; + } + }, + + load(importee) { + if (importee === ES6_BROWSER_EMPTY) { + return 'export default {};'; + } + return null; + }, + + getPackageInfoForId(id) { + return idToPackageInfo.get(id); + } + }; +} + +exports.DEFAULTS = DEFAULTS; +exports.default = nodeResolve; +exports.nodeResolve = nodeResolve; +module.exports = Object.assign(exports.default, exports); +//# sourceMappingURL=index.js.map diff --git a/tools/ui/node_modules/@rollup/plugin-node-resolve/dist/es/index.js b/tools/ui/node_modules/@rollup/plugin-node-resolve/dist/es/index.js new file mode 100644 index 0000000000000000000000000000000000000000..6c22eb316dfa46659051b84baca173ba8609081e --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-node-resolve/dist/es/index.js @@ -0,0 +1,1390 @@ +import path, { dirname, resolve, extname, normalize, sep } from 'path'; +import { builtinModules } from 'module'; +import deepMerge from 'deepmerge'; +import isModule from 'is-module'; +import fs, { realpathSync } from 'fs'; +import { promisify } from 'util'; +import { pathToFileURL, fileURLToPath } from 'url'; +import resolve$1 from 'resolve'; +import { createFilter } from '@rollup/pluginutils'; + +var version = "16.0.3"; +var peerDependencies = { + rollup: "^2.78.0||^3.0.0||^4.0.0" +}; + +promisify(fs.access); +const readFile$1 = promisify(fs.readFile); +const realpath = promisify(fs.realpath); +const stat = promisify(fs.stat); +async function fileExists(filePath) { + try { + const res = await stat(filePath); + return res.isFile(); + } + catch { + return false; + } +} +async function resolveSymlink(path) { + return (await fileExists(path)) ? realpath(path) : path; +} + +const onError = (error) => { + if (error.code === 'ENOENT') { + return false; + } + throw error; +}; + +const makeCache = (fn) => { + const cache = new Map(); + const wrapped = async (param, done) => { + if (cache.has(param) === false) { + cache.set( + param, + fn(param).catch((err) => { + cache.delete(param); + throw err; + }) + ); + } + + try { + const result = cache.get(param); + const value = await result; + return done(null, value); + } catch (error) { + return done(error); + } + }; + + wrapped.clear = () => cache.clear(); + + return wrapped; +}; + +const isDirCached = makeCache(async (file) => { + try { + const stats = await stat(file); + return stats.isDirectory(); + } catch (error) { + return onError(error); + } +}); + +const isFileCached = makeCache(async (file) => { + try { + const stats = await stat(file); + return stats.isFile(); + } catch (error) { + return onError(error); + } +}); + +const readCachedFile = makeCache(readFile$1); + +function handleDeprecatedOptions(opts) { + const warnings = []; + + if (opts.customResolveOptions) { + const { customResolveOptions } = opts; + if (customResolveOptions.moduleDirectory) { + // eslint-disable-next-line no-param-reassign + opts.moduleDirectories = Array.isArray(customResolveOptions.moduleDirectory) + ? customResolveOptions.moduleDirectory + : [customResolveOptions.moduleDirectory]; + + warnings.push( + 'node-resolve: The `customResolveOptions.moduleDirectory` option has been deprecated. Use `moduleDirectories`, which must be an array.' + ); + } + + if (customResolveOptions.preserveSymlinks) { + throw new Error( + 'node-resolve: `customResolveOptions.preserveSymlinks` is no longer an option. We now always use the rollup `preserveSymlinks` option.' + ); + } + + [ + 'basedir', + 'package', + 'extensions', + 'includeCoreModules', + 'readFile', + 'isFile', + 'isDirectory', + 'realpath', + 'packageFilter', + 'pathFilter', + 'paths', + 'packageIterator' + ].forEach((resolveOption) => { + if (customResolveOptions[resolveOption]) { + throw new Error( + `node-resolve: \`customResolveOptions.${resolveOption}\` is no longer an option. If you need this, please open an issue.` + ); + } + }); + } + + return { warnings }; +} + +// returns the imported package name for bare module imports +function getPackageName(id) { + if (id.startsWith('.') || id.startsWith('/')) { + return null; + } + + const split = id.split('/'); + + // @my-scope/my-package/foo.js -> @my-scope/my-package + // @my-scope/my-package -> @my-scope/my-package + if (split[0][0] === '@') { + return `${split[0]}/${split[1]}`; + } + + // my-package/foo.js -> my-package + // my-package -> my-package + return split[0]; +} + +function getMainFields(options) { + let mainFields; + if (options.mainFields) { + ({ mainFields } = options); + } else { + mainFields = ['module', 'main']; + } + if (options.browser && mainFields.indexOf('browser') === -1) { + return ['browser'].concat(mainFields); + } + if (!mainFields.length) { + throw new Error('Please ensure at least one `mainFields` value is specified'); + } + return mainFields; +} + +function getPackageInfo(options) { + const { + cache, + extensions, + pkg, + mainFields, + preserveSymlinks, + useBrowserOverrides, + rootDir, + ignoreSideEffectsForRoot + } = options; + let { pkgPath } = options; + + if (cache.has(pkgPath)) { + return cache.get(pkgPath); + } + + // browserify/resolve doesn't realpath paths returned in its packageFilter callback + if (!preserveSymlinks) { + pkgPath = realpathSync(pkgPath); + } + + const pkgRoot = dirname(pkgPath); + + const packageInfo = { + // copy as we are about to munge the `main` field of `pkg`. + packageJson: { ...pkg }, + + // path to package.json file + packageJsonPath: pkgPath, + + // directory containing the package.json + root: pkgRoot, + + // which main field was used during resolution of this module (main, module, or browser) + resolvedMainField: 'main', + + // whether the browser map was used to resolve the entry point to this module + browserMappedMain: false, + + // the entry point of the module with respect to the selected main field and any + // relevant browser mappings. + resolvedEntryPoint: '' + }; + + let overriddenMain = false; + for (let i = 0; i < mainFields.length; i++) { + const field = mainFields[i]; + if (typeof pkg[field] === 'string') { + pkg.main = pkg[field]; + packageInfo.resolvedMainField = field; + overriddenMain = true; + break; + } + } + + const internalPackageInfo = { + cachedPkg: pkg, + hasModuleSideEffects: () => null, + hasPackageEntry: overriddenMain !== false || mainFields.indexOf('main') !== -1, + packageBrowserField: + useBrowserOverrides && + typeof pkg.browser === 'object' && + Object.keys(pkg.browser).reduce((browser, key) => { + let resolved = pkg.browser[key]; + if (resolved && resolved[0] === '.') { + resolved = resolve(pkgRoot, resolved); + } + /* eslint-disable no-param-reassign */ + browser[key] = resolved; + if (key[0] === '.') { + const absoluteKey = resolve(pkgRoot, key); + browser[absoluteKey] = resolved; + if (!extname(key)) { + extensions.reduce((subBrowser, ext) => { + subBrowser[absoluteKey + ext] = subBrowser[key]; + return subBrowser; + }, browser); + } + } + return browser; + }, {}), + packageInfo + }; + + const browserMap = internalPackageInfo.packageBrowserField; + if ( + useBrowserOverrides && + typeof pkg.browser === 'object' && + // eslint-disable-next-line no-prototype-builtins + browserMap.hasOwnProperty(pkg.main) + ) { + packageInfo.resolvedEntryPoint = browserMap[pkg.main]; + packageInfo.browserMappedMain = true; + } else { + // index.node is technically a valid default entrypoint as well... + packageInfo.resolvedEntryPoint = resolve(pkgRoot, pkg.main || 'index.js'); + packageInfo.browserMappedMain = false; + } + + if (!ignoreSideEffectsForRoot || rootDir !== pkgRoot) { + const packageSideEffects = pkg.sideEffects; + if (typeof packageSideEffects === 'boolean') { + internalPackageInfo.hasModuleSideEffects = () => packageSideEffects; + } else if (Array.isArray(packageSideEffects)) { + const finalPackageSideEffects = packageSideEffects.map((sideEffect) => { + /* + * The array accepts simple glob patterns to the relevant files... Patterns like .css, which do not include a /, will be treated like **\/.css. + * https://webpack.js.org/guides/tree-shaking/ + */ + if (sideEffect.includes('/')) { + return sideEffect; + } + return `**/${sideEffect}`; + }); + internalPackageInfo.hasModuleSideEffects = createFilter(finalPackageSideEffects, null, { + resolve: pkgRoot + }); + } + } + + cache.set(pkgPath, internalPackageInfo); + return internalPackageInfo; +} + +function normalizeInput(input) { + if (Array.isArray(input)) { + return input; + } else if (typeof input === 'object') { + return Object.values(input); + } + + // otherwise it's a string + return [input]; +} + +/* eslint-disable no-await-in-loop */ +function isModuleDir(current, moduleDirs) { + return moduleDirs.some((dir) => current.endsWith(dir)); +} +async function findPackageJson(base, moduleDirs) { + const { root } = path.parse(base); + let current = base; + while (current !== root && !isModuleDir(current, moduleDirs)) { + const pkgJsonPath = path.join(current, 'package.json'); + if (await fileExists(pkgJsonPath)) { + const pkgJsonString = fs.readFileSync(pkgJsonPath, 'utf-8'); + return { pkgJson: JSON.parse(pkgJsonString), pkgPath: current, pkgJsonPath }; + } + current = path.resolve(current, '..'); + } + return null; +} +function isUrl(str) { + try { + return !!new URL(str); + } + catch (_) { + return false; + } +} +/** + * Conditions is an export object where all keys are conditions like 'node' (aka do not with '.') + */ +function isConditions(exports) { + return typeof exports === 'object' && Object.keys(exports).every((k) => !k.startsWith('.')); +} +/** + * Mappings is an export object where all keys start with '. + */ +function isMappings(exports) { + return typeof exports === 'object' && !isConditions(exports); +} +/** + * Check for mixed exports, which are exports where some keys start with '.' and some do not + */ +function isMixedExports(exports) { + const keys = Object.keys(exports); + return keys.some((k) => k.startsWith('.')) && keys.some((k) => !k.startsWith('.')); +} +function createBaseErrorMsg(importSpecifier, importer) { + return `Could not resolve import "${importSpecifier}" in ${importer}`; +} +function createErrorMsg(context, reason, isImports) { + const { importSpecifier, importer, pkgJsonPath } = context; + const base = createBaseErrorMsg(importSpecifier, importer); + const field = isImports ? 'imports' : 'exports'; + return `${base} using ${field} defined in ${pkgJsonPath}.${reason ? ` ${reason}` : ''}`; +} +class ResolveError extends Error { +} +class InvalidConfigurationError extends ResolveError { + constructor(context, reason) { + super(createErrorMsg(context, `Invalid "exports" field. ${reason}`)); + } +} +class InvalidModuleSpecifierError extends ResolveError { + constructor(context, isImports, reason) { + super(createErrorMsg(context, reason, isImports)); + } +} +class InvalidPackageTargetError extends ResolveError { + constructor(context, reason) { + super(createErrorMsg(context, reason)); + } +} + +/* eslint-disable no-await-in-loop, no-undefined */ +/** + * Check for invalid path segments + */ +function includesInvalidSegments(pathSegments, moduleDirs) { + const invalidSegments = ['', '.', '..', ...moduleDirs]; + // contains any "", ".", "..", or "node_modules" segments, including percent encoded variants + return pathSegments.some((v) => invalidSegments.includes(v) || invalidSegments.includes(decodeURI(v))); +} +async function resolvePackageTarget(context, { target, patternMatch, isImports }) { + // If target is a String, then + if (typeof target === 'string') { + // If target does not start with "./", then + if (!target.startsWith('./')) { + // If isImports is false, or if target starts with "../" or "/", or if target is a valid URL, then + if (!isImports || ['/', '../'].some((p) => target.startsWith(p)) || isUrl(target)) { + // Throw an Invalid Package Target error. + throw new InvalidPackageTargetError(context, `Invalid mapping: "${target}".`); + } + // If patternMatch is a String, then + if (typeof patternMatch === 'string') { + // Return PACKAGE_RESOLVE(target with every instance of "*" replaced by patternMatch, packageURL + "/") + const result = await context.resolveId(target.replace(/\*/g, patternMatch), context.pkgURL.href); + return result ? pathToFileURL(result.location).href : null; + } + // Return PACKAGE_RESOLVE(target, packageURL + "/"). + const result = await context.resolveId(target, context.pkgURL.href); + return result ? pathToFileURL(result.location).href : null; + } + // TODO: Drop if we do not support Node <= 16 anymore + // This behavior was removed in Node 17 (deprecated in Node 14), see DEP0148 + if (context.allowExportsFolderMapping) { + target = target.replace(/\/$/, '/*'); + } + // If target split on "/" or "\" + { + const pathSegments = target.split(/\/|\\/); + // after the first "." segment + const firstDot = pathSegments.indexOf('.'); + firstDot !== -1 && pathSegments.slice(firstDot); + if (firstDot !== -1 && + firstDot < pathSegments.length - 1 && + includesInvalidSegments(pathSegments.slice(firstDot + 1), context.moduleDirs)) { + throw new InvalidPackageTargetError(context, `Invalid mapping: "${target}".`); + } + } + // Let resolvedTarget be the URL resolution of the concatenation of packageURL and target. + const resolvedTarget = new URL(target, context.pkgURL); + // Assert: resolvedTarget is contained in packageURL. + if (!resolvedTarget.href.startsWith(context.pkgURL.href)) { + throw new InvalidPackageTargetError(context, `Resolved to ${resolvedTarget.href} which is outside package ${context.pkgURL.href}`); + } + // If patternMatch is null, then + if (!patternMatch) { + // Return resolvedTarget. + return resolvedTarget; + } + // If patternMatch split on "/" or "\" contains invalid segments + if (includesInvalidSegments(patternMatch.split(/\/|\\/), context.moduleDirs)) { + // throw an Invalid Module Specifier error. + throw new InvalidModuleSpecifierError(context); + } + // Return the URL resolution of resolvedTarget with every instance of "*" replaced with patternMatch. + return resolvedTarget.href.replace(/\*/g, patternMatch); + } + // Otherwise, if target is an Array, then + if (Array.isArray(target)) { + // If _target.length is zero, return null. + if (target.length === 0) { + return null; + } + let lastError = null; + // For each item in target, do + for (const item of target) { + // Let resolved be the result of PACKAGE_TARGET_RESOLVE of the item + // continuing the loop on any Invalid Package Target error. + try { + const resolved = await resolvePackageTarget(context, { + target: item, + patternMatch, + isImports + }); + // If resolved is undefined, continue the loop. + // Else Return resolved. + if (resolved !== undefined) { + return resolved; + } + } + catch (error) { + if (!(error instanceof InvalidPackageTargetError)) { + throw error; + } + else { + lastError = error; + } + } + } + // Return or throw the last fallback resolution null return or error + if (lastError) { + throw lastError; + } + return null; + } + // Otherwise, if target is a non-null Object, then + if (target && typeof target === 'object') { + // For each property of target + for (const [key, value] of Object.entries(target)) { + // If exports contains any index property keys, as defined in ECMA-262 6.1.7 Array Index, throw an Invalid Package Configuration error. + // TODO: We do not check if the key is a number here... + // If key equals "default" or conditions contains an entry for the key, then + if (key === 'default' || context.conditions.includes(key)) { + // Let targetValue be the value of the property in target. + // Let resolved be the result of PACKAGE_TARGET_RESOLVE of the targetValue + const resolved = await resolvePackageTarget(context, { + target: value, + patternMatch, + isImports + }); + // If resolved is equal to undefined, continue the loop. + // Return resolved. + if (resolved !== undefined) { + return resolved; + } + } + } + // Return undefined. + return undefined; + } + // Otherwise, if target is null, return null. + if (target === null) { + return null; + } + // Otherwise throw an Invalid Package Target error. + throw new InvalidPackageTargetError(context, `Invalid exports field.`); +} + +/* eslint-disable no-await-in-loop */ +/** + * Implementation of Node's `PATTERN_KEY_COMPARE` function + */ +function nodePatternKeyCompare(keyA, keyB) { + // Let baseLengthA be the index of "*" in keyA plus one, if keyA contains "*", or the length of keyA otherwise. + const baseLengthA = keyA.includes('*') ? keyA.indexOf('*') + 1 : keyA.length; + // Let baseLengthB be the index of "*" in keyB plus one, if keyB contains "*", or the length of keyB otherwise. + const baseLengthB = keyB.includes('*') ? keyB.indexOf('*') + 1 : keyB.length; + // if baseLengthA is greater, return -1, if lower 1 + const rval = baseLengthB - baseLengthA; + if (rval !== 0) + return rval; + // If keyA does not contain "*", return 1. + if (!keyA.includes('*')) + return 1; + // If keyB does not contain "*", return -1. + if (!keyB.includes('*')) + return -1; + // If the length of keyA is greater than the length of keyB, return -1. + // If the length of keyB is greater than the length of keyA, return 1. + // Else Return 0. + return keyB.length - keyA.length; +} +async function resolvePackageImportsExports(context, { matchKey, matchObj, isImports }) { + // If matchKey is a key of matchObj and does not contain "*", then + if (!matchKey.includes('*') && matchKey in matchObj) { + // Let target be the value of matchObj[matchKey]. + const target = matchObj[matchKey]; + // Return the result of PACKAGE_TARGET_RESOLVE(packageURL, target, null, isImports, conditions). + const resolved = await resolvePackageTarget(context, { target, patternMatch: '', isImports }); + return resolved; + } + // Let expansionKeys be the list of keys of matchObj containing only a single "*" + const expansionKeys = Object.keys(matchObj) + // Assert: ends with "/" or contains only a single "*". + .filter((k) => k.endsWith('/') || k.includes('*')) + // sorted by the sorting function PATTERN_KEY_COMPARE which orders in descending order of specificity. + .sort(nodePatternKeyCompare); + // For each key expansionKey in expansionKeys, do + for (const expansionKey of expansionKeys) { + const indexOfAsterisk = expansionKey.indexOf('*'); + // Let patternBase be the substring of expansionKey up to but excluding the first "*" character. + const patternBase = indexOfAsterisk === -1 ? expansionKey : expansionKey.substring(0, indexOfAsterisk); + // If matchKey starts with but is not equal to patternBase, then + if (matchKey.startsWith(patternBase) && matchKey !== patternBase) { + // Let patternTrailer be the substring of expansionKey from the index after the first "*" character. + const patternTrailer = indexOfAsterisk !== -1 ? expansionKey.substring(indexOfAsterisk + 1) : ''; + // If patternTrailer has zero length, + if (patternTrailer.length === 0 || + // or if matchKey ends with patternTrailer and the length of matchKey is greater than or equal to the length of expansionKey, then + (matchKey.endsWith(patternTrailer) && matchKey.length >= expansionKey.length)) { + // Let target be the value of matchObj[expansionKey]. + const target = matchObj[expansionKey]; + // Let patternMatch be the substring of matchKey starting at the index of the length of patternBase up to the length + // of matchKey minus the length of patternTrailer. + const patternMatch = matchKey.substring(patternBase.length, matchKey.length - patternTrailer.length); + // Return the result of PACKAGE_TARGET_RESOLVE + const resolved = await resolvePackageTarget(context, { + target, + patternMatch, + isImports + }); + return resolved; + } + } + } + throw new InvalidModuleSpecifierError(context, isImports); +} + +/** + * Implementation of PACKAGE_EXPORTS_RESOLVE + */ +async function resolvePackageExports(context, subpath, exports) { + // If exports is an Object with both a key starting with "." and a key not starting with "." + if (isMixedExports(exports)) { + // throw an Invalid Package Configuration error. + throw new InvalidConfigurationError(context, 'All keys must either start with ./, or without one.'); + } + // If subpath is equal to ".", then + if (subpath === '.') { + // Let mainExport be undefined. + let mainExport; + // If exports is a String or Array, or an Object containing no keys starting with ".", then + if (typeof exports === 'string' || Array.isArray(exports) || isConditions(exports)) { + // Set mainExport to exports + mainExport = exports; + // Otherwise if exports is an Object containing a "." property, then + } + else if (isMappings(exports)) { + // Set mainExport to exports["."] + mainExport = exports['.']; + } + // If mainExport is not undefined, then + if (mainExport) { + // Let resolved be the result of PACKAGE_TARGET_RESOLVE with target = mainExport + const resolved = await resolvePackageTarget(context, { + target: mainExport, + patternMatch: '', + isImports: false + }); + // If resolved is not null or undefined, return resolved. + if (resolved) { + return resolved; + } + } + // Otherwise, if exports is an Object and all keys of exports start with ".", then + } + else if (isMappings(exports)) { + // Let resolved be the result of PACKAGE_IMPORTS_EXPORTS_RESOLVE + const resolvedMatch = await resolvePackageImportsExports(context, { + matchKey: subpath, + matchObj: exports, + isImports: false + }); + // If resolved is not null or undefined, return resolved. + if (resolvedMatch) { + return resolvedMatch; + } + } + // Throw a Package Path Not Exported error. + throw new InvalidModuleSpecifierError(context); +} + +async function resolvePackageImports({ importSpecifier, importer, moduleDirs, conditions, resolveId }) { + const result = await findPackageJson(importer, moduleDirs); + if (!result) { + throw new Error(`${createBaseErrorMsg(importSpecifier, importer)}. Could not find a parent package.json.`); + } + const { pkgPath, pkgJsonPath, pkgJson } = result; + const pkgURL = pathToFileURL(`${pkgPath}/`); + const context = { + importer, + importSpecifier, + moduleDirs, + pkgURL, + pkgJsonPath, + conditions, + resolveId + }; + // Assert: specifier begins with "#". + if (!importSpecifier.startsWith('#')) { + throw new InvalidModuleSpecifierError(context, true, 'Invalid import specifier.'); + } + // If specifier is exactly equal to "#" or starts with "#/", then + if (importSpecifier === '#' || importSpecifier.startsWith('#/')) { + // Throw an Invalid Module Specifier error. + throw new InvalidModuleSpecifierError(context, true, 'Invalid import specifier.'); + } + const { imports } = pkgJson; + if (!imports) { + throw new InvalidModuleSpecifierError(context, true); + } + // Let packageURL be the result of LOOKUP_PACKAGE_SCOPE(parentURL). + // If packageURL is not null, then + return resolvePackageImportsExports(context, { + matchKey: importSpecifier, + matchObj: imports, + isImports: true + }); +} + +const resolveImportPath = promisify(resolve$1); +const readFile = promisify(fs.readFile); + +async function getPackageJson(importer, pkgName, resolveOptions, moduleDirectories) { + if (importer) { + const selfPackageJsonResult = await findPackageJson(importer, moduleDirectories); + if (selfPackageJsonResult && selfPackageJsonResult.pkgJson.name === pkgName) { + // the referenced package name is the current package + return selfPackageJsonResult; + } + } + + try { + const pkgJsonPath = await resolveImportPath(`${pkgName}/package.json`, resolveOptions); + const pkgJson = JSON.parse(await readFile(pkgJsonPath, 'utf-8')); + return { pkgJsonPath, pkgJson, pkgPath: dirname(pkgJsonPath) }; + } catch (_) { + return null; + } +} + +async function resolveIdClassic({ + importSpecifier, + packageInfoCache, + extensions, + mainFields, + preserveSymlinks, + useBrowserOverrides, + baseDir, + moduleDirectories, + modulePaths, + rootDir, + ignoreSideEffectsForRoot +}) { + let hasModuleSideEffects = () => null; + let hasPackageEntry = true; + let packageBrowserField = false; + let packageInfo; + + const filter = (pkg, pkgPath) => { + const info = getPackageInfo({ + cache: packageInfoCache, + extensions, + pkg, + pkgPath, + mainFields, + preserveSymlinks, + useBrowserOverrides, + rootDir, + ignoreSideEffectsForRoot + }); + + ({ packageInfo, hasModuleSideEffects, hasPackageEntry, packageBrowserField } = info); + + return info.cachedPkg; + }; + + const resolveOptions = { + basedir: baseDir, + readFile: readCachedFile, + isFile: isFileCached, + isDirectory: isDirCached, + extensions, + includeCoreModules: false, + moduleDirectory: moduleDirectories, + paths: modulePaths, + preserveSymlinks, + packageFilter: filter + }; + + let location; + try { + location = await resolveImportPath(importSpecifier, resolveOptions); + } catch (error) { + if (error.code !== 'MODULE_NOT_FOUND') { + throw error; + } + return null; + } + + return { + location: preserveSymlinks ? location : await resolveSymlink(location), + hasModuleSideEffects, + hasPackageEntry, + packageBrowserField, + packageInfo + }; +} + +async function resolveWithExportMap({ + importer, + importSpecifier, + exportConditions, + packageInfoCache, + extensions, + mainFields, + preserveSymlinks, + useBrowserOverrides, + baseDir, + moduleDirectories, + modulePaths, + rootDir, + ignoreSideEffectsForRoot, + allowExportsFolderMapping +}) { + if (importSpecifier.startsWith('#')) { + // this is a package internal import, resolve using package imports field + const resolveResult = await resolvePackageImports({ + importSpecifier, + importer, + moduleDirs: moduleDirectories, + conditions: exportConditions, + // Resolve targets of "imports" mappings using the same algorithm + // we use for normal specifiers: try export maps first and then + // fall back to classic resolution. This is important for cases + // like "#foo/*": "@scope/pkg/*" where the target package relies + // on "exports" to expose subpaths. Using the classic resolver + // alone would fail to find those subpaths. + resolveId(id /* , parent*/) { + return resolveImportSpecifiers({ + importer, + importSpecifierList: [id], + exportConditions, + // pass-through of the rest of the context + packageInfoCache, + extensions, + mainFields, + preserveSymlinks, + useBrowserOverrides, + baseDir, + moduleDirectories, + modulePaths, + rootDir, + ignoreSideEffectsForRoot, + allowExportsFolderMapping + }); + } + }); + + if (resolveResult == null) { + // When the target of an "imports" mapping cannot be resolved, + // surface a proper resolve error instead of throwing from + // fileURLToPath(null). + throw new ResolveError( + `Could not resolve import "${importSpecifier}" in ${importer} using imports.` + ); + } + const location = fileURLToPath(resolveResult); + return { + location: preserveSymlinks ? location : await resolveSymlink(location), + hasModuleSideEffects: () => null, + hasPackageEntry: true, + packageBrowserField: false, + // eslint-disable-next-line no-undefined + packageInfo: undefined + }; + } + + const pkgName = getPackageName(importSpecifier); + if (pkgName) { + // it's a bare import, find the package.json and resolve using package exports if available + let hasModuleSideEffects = () => null; + let hasPackageEntry = true; + let packageBrowserField = false; + let packageInfo; + + const filter = (pkg, pkgPath) => { + const info = getPackageInfo({ + cache: packageInfoCache, + extensions, + pkg, + pkgPath, + mainFields, + preserveSymlinks, + useBrowserOverrides, + rootDir, + ignoreSideEffectsForRoot + }); + + ({ packageInfo, hasModuleSideEffects, hasPackageEntry, packageBrowserField } = info); + + return info.cachedPkg; + }; + + const resolveOptions = { + basedir: baseDir, + readFile: readCachedFile, + isFile: isFileCached, + isDirectory: isDirCached, + extensions, + includeCoreModules: false, + moduleDirectory: moduleDirectories, + paths: modulePaths, + preserveSymlinks, + packageFilter: filter + }; + + const result = await getPackageJson(importer, pkgName, resolveOptions, moduleDirectories); + + if (result && result.pkgJson.exports) { + const { pkgJson, pkgJsonPath } = result; + const subpath = + pkgName === importSpecifier ? '.' : `.${importSpecifier.substring(pkgName.length)}`; + const pkgDr = pkgJsonPath.replace('package.json', ''); + const pkgURL = pathToFileURL(pkgDr); + + const context = { + importer, + importSpecifier, + moduleDirs: moduleDirectories, + pkgURL, + pkgJsonPath, + allowExportsFolderMapping, + conditions: exportConditions + }; + const resolvedPackageExport = await resolvePackageExports(context, subpath, pkgJson.exports); + const location = fileURLToPath(resolvedPackageExport); + if (location) { + return { + location: preserveSymlinks ? location : await resolveSymlink(location), + hasModuleSideEffects, + hasPackageEntry, + packageBrowserField, + packageInfo + }; + } + } + } + + return null; +} + +async function resolveWithClassic({ + importer, + importSpecifierList, + exportConditions, + warn, + packageInfoCache, + extensions, + mainFields, + preserveSymlinks, + useBrowserOverrides, + baseDir, + moduleDirectories, + modulePaths, + rootDir, + ignoreSideEffectsForRoot +}) { + for (let i = 0; i < importSpecifierList.length; i++) { + // eslint-disable-next-line no-await-in-loop + const result = await resolveIdClassic({ + importer, + importSpecifier: importSpecifierList[i], + exportConditions, + warn, + packageInfoCache, + extensions, + mainFields, + preserveSymlinks, + useBrowserOverrides, + baseDir, + moduleDirectories, + modulePaths, + rootDir, + ignoreSideEffectsForRoot + }); + + if (result) { + return result; + } + } + + return null; +} + +// Resolves to the module if found or `null`. +// The first import specifier will first be attempted with the exports algorithm. +// If this is unsuccessful because export maps are not being used, then all of `importSpecifierList` +// will be tried with the classic resolution algorithm +async function resolveImportSpecifiers({ + importer, + importSpecifierList, + exportConditions, + warn, + packageInfoCache, + extensions, + mainFields, + preserveSymlinks, + useBrowserOverrides, + baseDir, + moduleDirectories, + modulePaths, + rootDir, + ignoreSideEffectsForRoot, + allowExportsFolderMapping +}) { + try { + const exportMapRes = await resolveWithExportMap({ + importer, + importSpecifier: importSpecifierList[0], + exportConditions, + packageInfoCache, + extensions, + mainFields, + preserveSymlinks, + useBrowserOverrides, + baseDir, + moduleDirectories, + modulePaths, + rootDir, + ignoreSideEffectsForRoot, + allowExportsFolderMapping + }); + if (exportMapRes) return exportMapRes; + } catch (error) { + if (error instanceof ResolveError) { + warn(error); + return null; + } + throw error; + } + + // package has no imports or exports, use classic node resolve + return resolveWithClassic({ + importer, + importSpecifierList, + exportConditions, + warn, + packageInfoCache, + extensions, + mainFields, + preserveSymlinks, + useBrowserOverrides, + baseDir, + moduleDirectories, + modulePaths, + rootDir, + ignoreSideEffectsForRoot + }); +} + +const versionRegexp = /\^(\d+\.\d+\.\d+)/g; + +function validateVersion(actualVersion, peerDependencyVersion) { + let minMajor = Infinity; + let minMinor = Infinity; + let minPatch = Infinity; + let foundVersion; + // eslint-disable-next-line no-cond-assign + while ((foundVersion = versionRegexp.exec(peerDependencyVersion))) { + const [foundMajor, foundMinor, foundPatch] = foundVersion[1].split('.').map(Number); + if (foundMajor < minMajor) { + minMajor = foundMajor; + minMinor = foundMinor; + minPatch = foundPatch; + } + } + if (!actualVersion) { + throw new Error( + `Insufficient Rollup version: "@rollup/plugin-node-resolve" requires at least rollup@${minMajor}.${minMinor}.${minPatch}.` + ); + } + const [major, minor, patch] = actualVersion.split('.').map(Number); + if ( + major < minMajor || + (major === minMajor && (minor < minMinor || (minor === minMinor && patch < minPatch))) + ) { + throw new Error( + `Insufficient rollup version: "@rollup/plugin-node-resolve" requires at least rollup@${minMajor}.${minMinor}.${minPatch} but found rollup@${actualVersion}.` + ); + } +} + +/* eslint-disable no-param-reassign, no-shadow, no-undefined */ + +const ES6_BROWSER_EMPTY = '\0node-resolve:empty.js'; +const deepFreeze = (object) => { + Object.freeze(object); + + for (const value of Object.values(object)) { + if (typeof value === 'object' && !Object.isFrozen(value)) { + deepFreeze(value); + } + } + + return object; +}; + +const baseConditions = ['default', 'module']; +const baseConditionsEsm = [...baseConditions, 'import']; +const baseConditionsCjs = [...baseConditions, 'require']; +const defaults = { + dedupe: [], + // It's important that .mjs is listed before .js so that Rollup will interpret npm modules + // which deploy both ESM .mjs and CommonJS .js files as ESM. + extensions: ['.mjs', '.js', '.json', '.node'], + resolveOnly: [], + moduleDirectories: ['node_modules'], + modulePaths: [], + ignoreSideEffectsForRoot: false, + // TODO: set to false in next major release or remove + allowExportsFolderMapping: true +}; +const nodeImportPrefix = /^node:/; + +const DEFAULTS = deepFreeze(deepMerge({}, defaults)); + +function nodeResolve(opts = {}) { + const { warnings } = handleDeprecatedOptions(opts); + + const options = { ...defaults, ...opts }; + const { extensions, jail, moduleDirectories, modulePaths, ignoreSideEffectsForRoot } = options; + const exportConditions = options.exportConditions || []; + const devProdCondition = + exportConditions.includes('development') || exportConditions.includes('production') + ? [] + : [ + process.env.NODE_ENV && process.env.NODE_ENV !== 'production' + ? 'development' + : 'production' + ]; + const conditionsEsm = [...baseConditionsEsm, ...exportConditions, ...devProdCondition]; + const conditionsCjs = [...baseConditionsCjs, ...exportConditions, ...devProdCondition]; + const packageInfoCache = new Map(); + const idToPackageInfo = new Map(); + const mainFields = getMainFields(options); + const useBrowserOverrides = mainFields.indexOf('browser') !== -1; + const isPreferBuiltinsSet = Object.prototype.hasOwnProperty.call(options, 'preferBuiltins'); + const preferBuiltins = isPreferBuiltinsSet ? options.preferBuiltins : true; + const rootDir = resolve(options.rootDir || process.cwd()); + let { dedupe } = options; + let rollupOptions; + + if (moduleDirectories.some((name) => name.includes('/'))) { + throw new Error( + '`moduleDirectories` option must only contain directory names. If you want to load modules from somewhere not supported by the default module resolution algorithm, see `modulePaths`.' + ); + } + + if (typeof dedupe !== 'function') { + dedupe = (importee) => + options.dedupe.includes(importee) || options.dedupe.includes(getPackageName(importee)); + } + + // creates a function from the patterns to test if a particular module should be bundled. + const allowPatterns = (patterns) => { + const regexPatterns = patterns.map((pattern) => { + if (pattern instanceof RegExp) { + return pattern; + } + const normalized = pattern.replace(/[\\^$*+?.()|[\]{}]/g, '\\$&'); + return new RegExp(`^${normalized}$`); + }); + return (id) => !regexPatterns.length || regexPatterns.some((pattern) => pattern.test(id)); + }; + + const resolveOnly = + typeof options.resolveOnly === 'function' + ? options.resolveOnly + : allowPatterns(options.resolveOnly); + + const browserMapCache = new Map(); + let preserveSymlinks; + + const resolveLikeNode = async (context, importee, importer, custom) => { + // strip query params from import + const [importPath, params] = importee.split('?'); + const importSuffix = `${params ? `?${params}` : ''}`; + importee = importPath; + + const baseDir = !importer || dedupe(importee) ? rootDir : dirname(importer); + + // https://github.com/defunctzombie/package-browser-field-spec + const browser = browserMapCache.get(importer); + if (useBrowserOverrides && browser) { + const resolvedImportee = resolve(baseDir, importee); + if (browser[importee] === false || browser[resolvedImportee] === false) { + return { id: ES6_BROWSER_EMPTY }; + } + const browserImportee = + (importee[0] !== '.' && browser[importee]) || + browser[resolvedImportee] || + browser[`${resolvedImportee}.js`] || + browser[`${resolvedImportee}.json`]; + if (browserImportee) { + importee = browserImportee; + } + } + + const parts = importee.split(/[/\\]/); + let id = parts.shift(); + let isRelativeImport = false; + + if (id[0] === '@' && parts.length > 0) { + // scoped packages + id += `/${parts.shift()}`; + } else if (id[0] === '.') { + // an import relative to the parent dir of the importer + id = resolve(baseDir, importee); + isRelativeImport = true; + } + + // if it's not a relative import, and it's not requested, reject it. + if (!isRelativeImport && !resolveOnly(id)) { + if (normalizeInput(rollupOptions.input).includes(importee)) { + return null; + } + return false; + } + + const importSpecifierList = [importee]; + + if (importer === undefined && importee[0] && !importee[0].match(/^\.?\.?\//)) { + // For module graph roots (i.e. when importer is undefined), we + // need to handle 'path fragments` like `foo/bar` that are commonly + // found in rollup config files. If importee doesn't look like a + // relative or absolute path, we make it relative and attempt to + // resolve it. + importSpecifierList.push(`./${importee}`); + } + + // TypeScript files may import '.mjs' or '.cjs' to refer to either '.mts' or '.cts'. + // They may also import .js to refer to either .ts or .tsx, and .jsx to refer to .tsx. + if (importer && /\.(ts|mts|cts|tsx)$/.test(importer)) { + for (const [importeeExt, resolvedExt] of [ + ['.js', '.ts'], + ['.js', '.tsx'], + ['.jsx', '.tsx'], + ['.mjs', '.mts'], + ['.cjs', '.cts'] + ]) { + if (importee.endsWith(importeeExt) && extensions.includes(resolvedExt)) { + importSpecifierList.push(importee.slice(0, -importeeExt.length) + resolvedExt); + } + } + } + + const warn = (...args) => context.warn(...args); + const isRequire = custom && custom['node-resolve'] && custom['node-resolve'].isRequire; + const exportConditions = isRequire ? conditionsCjs : conditionsEsm; + if (useBrowserOverrides && !exportConditions.includes('browser')) + exportConditions.push('browser'); + + const resolvedWithoutBuiltins = await resolveImportSpecifiers({ + importer, + importSpecifierList, + exportConditions, + warn, + packageInfoCache, + extensions, + mainFields, + preserveSymlinks, + useBrowserOverrides, + baseDir, + moduleDirectories, + modulePaths, + rootDir, + ignoreSideEffectsForRoot, + allowExportsFolderMapping: options.allowExportsFolderMapping + }); + + const importeeIsBuiltin = builtinModules.includes(importee.replace(nodeImportPrefix, '')); + const preferImporteeIsBuiltin = + typeof preferBuiltins === 'function' ? preferBuiltins(importee) : preferBuiltins; + const resolved = + importeeIsBuiltin && preferImporteeIsBuiltin + ? { + packageInfo: undefined, + hasModuleSideEffects: () => null, + hasPackageEntry: true, + packageBrowserField: false + } + : resolvedWithoutBuiltins; + if (!resolved) { + return null; + } + + const { packageInfo, hasModuleSideEffects, hasPackageEntry, packageBrowserField } = resolved; + let { location } = resolved; + if (packageBrowserField) { + if (Object.prototype.hasOwnProperty.call(packageBrowserField, location)) { + if (!packageBrowserField[location]) { + browserMapCache.set(location, packageBrowserField); + return { id: ES6_BROWSER_EMPTY }; + } + location = packageBrowserField[location]; + } + browserMapCache.set(location, packageBrowserField); + } + + if (hasPackageEntry && !preserveSymlinks) { + const exists = await fileExists(location); + if (exists) { + location = await realpath(location); + } + } + + idToPackageInfo.set(location, packageInfo); + + if (hasPackageEntry) { + if (importeeIsBuiltin && preferImporteeIsBuiltin) { + if (!isPreferBuiltinsSet && resolvedWithoutBuiltins && resolved !== importee) { + context.warn({ + message: + `preferring built-in module '${importee}' over local alternative at '${resolvedWithoutBuiltins.location}', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning.` + + `or passing a function to 'preferBuiltins' to provide more fine-grained control over which built-in modules to prefer.`, + pluginCode: 'PREFER_BUILTINS' + }); + } + return false; + } else if (jail && location.indexOf(normalize(jail.trim(sep))) !== 0) { + return null; + } + } + + if (options.modulesOnly && (await fileExists(location))) { + const code = await readFile$1(location, 'utf-8'); + if (isModule(code)) { + return { + id: `${location}${importSuffix}`, + moduleSideEffects: hasModuleSideEffects(location) + }; + } + return null; + } + return { + id: `${location}${importSuffix}`, + moduleSideEffects: hasModuleSideEffects(location) + }; + }; + + return { + name: 'node-resolve', + + version, + + buildStart(buildOptions) { + validateVersion(this.meta.rollupVersion, peerDependencies.rollup); + rollupOptions = buildOptions; + + for (const warning of warnings) { + this.warn(warning); + } + + ({ preserveSymlinks } = buildOptions); + }, + + generateBundle() { + readCachedFile.clear(); + isFileCached.clear(); + isDirCached.clear(); + }, + + resolveId: { + order: 'post', + async handler(importee, importer, resolveOptions) { + if (importee === ES6_BROWSER_EMPTY) { + return importee; + } + // ignore IDs with null character, these belong to other plugins + if (importee && importee.includes('\0')) return null; + + const { custom = {} } = resolveOptions; + const { 'node-resolve': { resolved: alreadyResolved } = {} } = custom; + if (alreadyResolved) { + return alreadyResolved; + } + + if (importer && importer.includes('\0')) { + importer = undefined; + } + + const resolved = await resolveLikeNode(this, importee, importer, custom); + if (resolved) { + // This way, plugins may attach additional meta information to the + // resolved id or make it external. We do not skip node-resolve here + // because another plugin might again use `this.resolve` in its + // `resolveId` hook, in which case we want to add the correct + // `moduleSideEffects` information. + const resolvedResolved = await this.resolve(resolved.id, importer, { + ...resolveOptions, + skipSelf: false, + custom: { ...custom, 'node-resolve': { ...custom['node-resolve'], resolved, importee } } + }); + if (resolvedResolved) { + // Handle plugins that manually make the result external + if (resolvedResolved.external) { + return false; + } + // Allow other plugins to take over resolution. Rollup core will not + // change the id if it corresponds to an existing file + if (resolvedResolved.id !== resolved.id) { + return resolvedResolved; + } + // Pass on meta information added by other plugins + return { ...resolved, meta: resolvedResolved.meta }; + } + } + return resolved; + } + }, + + load(importee) { + if (importee === ES6_BROWSER_EMPTY) { + return 'export default {};'; + } + return null; + }, + + getPackageInfoForId(id) { + return idToPackageInfo.get(id); + } + }; +} + +export { DEFAULTS, nodeResolve as default, nodeResolve }; +//# sourceMappingURL=index.js.map diff --git a/tools/ui/node_modules/@rollup/plugin-node-resolve/dist/es/package.json b/tools/ui/node_modules/@rollup/plugin-node-resolve/dist/es/package.json new file mode 100644 index 0000000000000000000000000000000000000000..7c34deb5837d8d5e168b54f95f7872b2c50eca13 --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-node-resolve/dist/es/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tools/ui/node_modules/@rollup/plugin-node-resolve/package.json b/tools/ui/node_modules/@rollup/plugin-node-resolve/package.json new file mode 100644 index 0000000000000000000000000000000000000000..714bdd2c0ee3a3d393205bba59fdbed1b2db4712 --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-node-resolve/package.json @@ -0,0 +1,89 @@ +{ + "name": "@rollup/plugin-node-resolve", + "version": "16.0.3", + "publishConfig": { + "access": "public" + }, + "description": "Locate and bundle third-party dependencies in node_modules", + "license": "MIT", + "repository": { + "url": "rollup/plugins", + "directory": "packages/node-resolve" + }, + "author": "Rich Harris ", + "homepage": "https://github.com/rollup/plugins/tree/master/packages/node-resolve/#readme", + "bugs": "https://github.com/rollup/plugins/issues", + "main": "./dist/cjs/index.js", + "module": "./dist/es/index.js", + "exports": { + "types": "./types/index.d.ts", + "import": "./dist/es/index.js", + "default": "./dist/cjs/index.js" + }, + "engines": { + "node": ">=14.0.0" + }, + "files": [ + "dist", + "!dist/**/*.map", + "types", + "README.md", + "LICENSE" + ], + "keywords": [ + "rollup", + "plugin", + "es2015", + "npm", + "modules" + ], + "peerDependencies": { + "rollup": "^2.78.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + }, + "dependencies": { + "@rollup/pluginutils": "^5.0.1", + "@types/resolve": "1.20.2", + "deepmerge": "^4.2.2", + "is-module": "^1.0.0", + "resolve": "^1.22.1" + }, + "devDependencies": { + "@babel/core": "^7.19.1", + "@babel/plugin-transform-typescript": "^7.10.5", + "@rollup/plugin-babel": "^6.0.0", + "@rollup/plugin-commonjs": "^23.0.0", + "@rollup/plugin-json": "^5.0.0", + "es5-ext": "^0.10.62", + "rollup": "^4.0.0-24", + "source-map": "^0.7.4", + "string-capitalize": "^1.0.1" + }, + "types": "./types/index.d.ts", + "ava": { + "workerThreads": false, + "files": [ + "!**/fixtures/**", + "!**/helpers/**", + "!**/recipes/**", + "!**/types.ts" + ] + }, + "scripts": { + "build": "rollup -c", + "ci:coverage": "nyc pnpm test && nyc report --reporter=text-lcov > coverage.lcov", + "ci:lint": "pnpm build && pnpm lint", + "ci:lint:commits": "commitlint --from=${CIRCLE_BRANCH} --to=${CIRCLE_SHA1}", + "ci:test": "pnpm test -- --verbose", + "prebuild": "del-cli dist", + "prerelease": "pnpm build", + "pretest": "pnpm build", + "release": "pnpm --workspace-root package:release $(pwd)", + "test": "pnpm test:ts && ava", + "test:ts": "tsc types/index.d.ts test/types.ts --noEmit" + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/@rollup/plugin-node-resolve/types/index.d.ts b/tools/ui/node_modules/@rollup/plugin-node-resolve/types/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c1f88c965838de04154cfbe31c5ec059f155dc71 --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-node-resolve/types/index.d.ts @@ -0,0 +1,122 @@ +import type { Plugin } from 'rollup'; + +export const DEFAULTS: { + customResolveOptions: {}; + dedupe: []; + extensions: ['.mjs', '.js', '.json', '.node']; + resolveOnly: []; +}; + +export interface RollupNodeResolveOptions { + /** + * Additional conditions of the package.json exports field to match when resolving modules. + * By default, this plugin looks for the `'default', 'module', 'import']` conditions when resolving imports. + * + * When using `@rollup/plugin-commonjs` v16 or higher, this plugin will use the + * `['default', 'module', 'import']` conditions when resolving require statements. + * + * Setting this option will add extra conditions on top of the default conditions. + * See https://nodejs.org/api/packages.html#packages_conditional_exports for more information. + */ + exportConditions?: string[]; + + /** + * If `true`, instructs the plugin to use the `"browser"` property in `package.json` + * files to specify alternative files to load for bundling. This is useful when + * bundling for a browser environment. Alternatively, a value of `'browser'` can be + * added to the `mainFields` option. If `false`, any `"browser"` properties in + * package files will be ignored. This option takes precedence over `mainFields`. + * @default false + */ + browser?: boolean; + + /** + * A list of directory names in which to recursively look for modules. + * @default ['node_modules'] + */ + moduleDirectories?: string[]; + + /** + * A list of absolute paths to additional locations to search for modules. + * This is analogous to setting the `NODE_PATH` environment variable for node. + * @default [] + */ + modulePaths?: string[]; + + /** + * An `Array` of modules names, which instructs the plugin to force resolving for the + * specified modules to the root `node_modules`. Helps to prevent bundling the same + * package multiple times if package is imported from dependencies. + */ + dedupe?: string[] | ((importee: string) => boolean); + + /** + * Specifies the extensions of files that the plugin will operate on. + * @default [ '.mjs', '.js', '.json', '.node' ] + */ + extensions?: readonly string[]; + + /** + * Locks the module search within specified path (e.g. chroot). Modules defined + * outside this path will be marked as external. + * @default '/' + */ + jail?: string; + + /** + * Specifies the properties to scan within a `package.json`, used to determine the + * bundle entry point. + * @default ['module', 'main'] + */ + mainFields?: readonly string[]; + + /** + * If `true`, inspect resolved files to assert that they are ES2015 modules. + * @default false + */ + modulesOnly?: boolean; + + /** + * If `true`, the plugin will prefer built-in modules (e.g. `fs`, `path`). If `false`, + * the plugin will look for locally installed modules of the same name. + * + * If a function is provided, it will be called to determine whether to prefer built-ins. + * @default true + */ + preferBuiltins?: boolean | ((module: string) => boolean); + + /** + * An `Array` which instructs the plugin to limit module resolution to those whose + * names match patterns in the array. + * @default [] + */ + resolveOnly?: ReadonlyArray | null | ((module: string) => boolean); + + /** + * Specifies the root directory from which to resolve modules. Typically used when + * resolving entry-point imports, and when resolving deduplicated modules. + * @default process.cwd() + */ + rootDir?: string; + + /** + * If you use the `sideEffects` property in the package.json, by default this is respected for files in the root package. Set to `true` to ignore the `sideEffects` configuration for the root package. + * + * @default false + */ + ignoreSideEffectsForRoot?: boolean; + + /** + * Allow folder mappings in package exports (trailing /) + * This was deprecated in Node 14 and removed with Node 17, see DEP0148. + * So this option might be changed to default to `false` in a future release. + * @default true + */ + allowExportsFolderMapping?: boolean; +} + +/** + * Locate modules using the Node resolution algorithm, for using third party modules in node_modules + */ +export function nodeResolve(options?: RollupNodeResolveOptions): Plugin; +export default nodeResolve; diff --git a/tools/ui/node_modules/@rollup/plugin-replace/LICENSE b/tools/ui/node_modules/@rollup/plugin-replace/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..5e46702cbdea74f8a8139094f5a1ff1f0e486f45 --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-replace/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019 RollupJS Plugin Contributors (https://github.com/rollup/plugins/graphs/contributors) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/tools/ui/node_modules/@rollup/plugin-replace/README.md b/tools/ui/node_modules/@rollup/plugin-replace/README.md new file mode 100644 index 0000000000000000000000000000000000000000..d787d73e827a804c9470940020ced4c7770fd5ac --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-replace/README.md @@ -0,0 +1,240 @@ +[npm]: https://img.shields.io/npm/v/@rollup/plugin-replace +[npm-url]: https://www.npmjs.com/package/@rollup/plugin-replace +[size]: https://packagephobia.now.sh/badge?p=@rollup/plugin-replace +[size-url]: https://packagephobia.now.sh/result?p=@rollup/plugin-replace + +[![npm][npm]][npm-url] +[![size][size]][size-url] +[![libera manifesto](https://img.shields.io/badge/libera-manifesto-lightgrey.svg)](https://liberamanifesto.com) + +# @rollup/plugin-replace + +🍣 A Rollup plugin which replaces targeted strings in files while bundling. + +## Requirements + +This plugin requires an [LTS](https://github.com/nodejs/Release) Node version (v14.0.0+) and Rollup v1.20.0+. + +## Install + +Using npm: + +```console +npm install @rollup/plugin-replace --save-dev +``` + +## Usage + +Create a `rollup.config.js` [configuration file](https://www.rollupjs.org/guide/en/#configuration-files) and import the plugin: + +```js +import replace from '@rollup/plugin-replace'; + +export default { + input: 'src/index.js', + output: { + dir: 'output', + format: 'cjs' + }, + plugins: [ + replace({ + 'process.env.NODE_ENV': JSON.stringify('production'), + __buildDate__: () => JSON.stringify(new Date()), + __buildVersion: 15 + }) + ] +}; +``` + +Then call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#command-line-reference) or the [API](https://www.rollupjs.org/guide/en/#javascript-api). + +The configuration above will replace every instance of `process.env.NODE_ENV` with `"production"` and `__buildDate__` with the result of the given function in any file included in the build. + +_Note: Values must be either primitives (e.g. string, number) or `function` that returns a string. For complex values, use `JSON.stringify`. To replace a target with a value that will be evaluated as a string, set the value to a quoted string (e.g. `"test"`) or use `JSON.stringify` to preprocess the target string safely._ + +Typically, `@rollup/plugin-replace` should be placed in `plugins` _before_ other plugins so that they may apply optimizations, such as dead code removal. + +## Options + +In addition to the properties and values specified for replacement, users may also specify the options below. + +### `delimiters` + +Type: `Array[String, String]`
+Default: `['(? +Default: `false` + +When replacing dot-separated object properties like `process.env.NODE_ENV`, will also replace `typeof process` object guard +checks against the objects with the string `"object"`. + +For example: + +```js +replace({ + values: { + 'process.env.NODE_ENV': '"production"' + } +}); +``` + +```js +// Input +if (typeof process !== 'undefined' && process.env.NODE_ENV === 'production') { + console.log('production'); +} +// Without `objectGuards` +if (typeof process !== 'undefined' && 'production' === 'production') { + console.log('production'); +} +// With `objectGuards` +if ('object' !== 'undefined' && 'production' === 'production') { + console.log('production'); +} +``` + +### `preventAssignment` + +Type: `Boolean`
+Default: `false` + +Prevents replacing strings where they are followed by a single equals sign. For example, where the plugin is called as follows: + +```js +replace({ + values: { + 'process.env.DEBUG': 'false' + } +}); +``` + +Observe the following code: + +```js +// Input +process.env.DEBUG = false; +if (process.env.DEBUG == true) { + // +} +// Without `preventAssignment` +false = false; // this throws an error because false cannot be assigned to +if (false == true) { + // +} +// With `preventAssignment` +process.env.DEBUG = false; +if (false == true) { + // +} +``` + +### `exclude` + +Type: `String` | `Array[...String]`
+Default: `null` + +A [picomatch pattern](https://github.com/micromatch/picomatch), or array of patterns, which specifies the files in the build the plugin should _ignore_. By default no files are ignored. + +### `include` + +Type: `String` | `Array[...String]`
+Default: `null` + +A [picomatch pattern](https://github.com/micromatch/picomatch), or array of patterns, which specifies the files in the build the plugin should operate on. By default all files are targeted. + +### `sourceMap` or `sourcemap` + +Type: `Boolean`
+Default: `false` + +Enables generating sourcemaps for the bundled code. For example, where the plugin is called as follows: + +```js +replace({ + sourcemap: true +}); +``` + +### `values` + +Type: `{ [key: String]: Replacement }`, where `Replacement` is either a string or a `function` that returns a string. +Default: `{}` + +To avoid mixing replacement strings with the other options, you can specify replacements in the `values` option. For example, the following signature: + +```js +replace({ + include: ['src/**/*.js'], + changed: 'replaced' +}); +``` + +Can be replaced with: + +```js +replace({ + include: ['src/**/*.js'], + values: { + changed: 'replaced' + } +}); +``` + +## Word Boundaries + +By default, values will only match if they are surrounded by _word boundaries_ that respect JavaScript's rules for valid identifiers (including `$` and `_` as valid identifier characters). + +Consider the following options and build file: + +```js +module.exports = { + ... + plugins: [replace({ changed: 'replaced' })] +}; +``` + +```js +// file.js +console.log('changed'); +console.log('unchanged'); +``` + +The result would be: + +```js +// file.js +console.log('replaced'); +console.log('unchanged'); +``` + +To ignore word boundaries and replace every instance of the string, wherever it may be, specify empty strings as delimiters: + +```js +export default { + ... + plugins: [ + replace({ + changed: 'replaced', + delimiters: ['', ''] + }) + ] +}; +``` + +## Meta + +[CONTRIBUTING](/.github/CONTRIBUTING.md) + +[LICENSE (MIT)](/LICENSE) diff --git a/tools/ui/node_modules/@rollup/plugin-replace/dist/cjs/index.js b/tools/ui/node_modules/@rollup/plugin-replace/dist/cjs/index.js new file mode 100644 index 0000000000000000000000000000000000000000..33e74ef4c79e3fe3eb075892d117a68d52351f71 --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-replace/dist/cjs/index.js @@ -0,0 +1,139 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var MagicString = require('magic-string'); +var pluginutils = require('@rollup/pluginutils'); + +function escape(str) { + return str.replace(/[-[\]/{}()*+?.\\^$|]/g, '\\$&'); +} + +function ensureFunction(functionOrValue) { + if (typeof functionOrValue === 'function') { return functionOrValue; } + return function () { return functionOrValue; }; +} + +function longest(a, b) { + return b.length - a.length; +} + +function getReplacements(options) { + if (options.values) { + return Object.assign({}, options.values); + } + var values = Object.assign({}, options); + delete values.delimiters; + delete values.include; + delete values.exclude; + delete values.sourcemap; + delete values.sourceMap; + delete values.objectGuards; + delete values.preventAssignment; + return values; +} + +function mapToFunctions(object) { + return Object.keys(object).reduce(function (fns, key) { + var functions = Object.assign({}, fns); + functions[key] = ensureFunction(object[key]); + return functions; + }, {}); +} + +var objKeyRegEx = + /^([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)(\.([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*))+$/; +function expandTypeofReplacements(replacements) { + Object.keys(replacements).forEach(function (key) { + var objMatch = key.match(objKeyRegEx); + if (!objMatch) { return; } + var dotIndex = objMatch[1].length; + do { + // eslint-disable-next-line no-param-reassign + replacements[("typeof " + (key.slice(0, dotIndex)))] = '"object"'; + dotIndex = key.indexOf('.', dotIndex + 1); + } while (dotIndex !== -1); + }); +} + +function replace(options) { + if ( options === void 0 ) options = {}; + + var filter = pluginutils.createFilter(options.include, options.exclude); + var delimiters = options.delimiters; if ( delimiters === void 0 ) delimiters = ['(?", + "homepage": "https://github.com/rollup/plugins/tree/master/packages/replace#readme", + "bugs": "https://github.com/rollup/plugins/issues", + "main": "dist/cjs/index.js", + "module": "dist/es/index.js", + "exports": { + "types": "./types/index.d.ts", + "import": "./dist/es/index.js", + "default": "./dist/cjs/index.js" + }, + "engines": { + "node": ">=14.0.0" + }, + "files": [ + "dist", + "!dist/**/*.map", + "src", + "types", + "README.md" + ], + "keywords": [ + "rollup", + "plugin", + "replace", + "es2015", + "npm", + "modules" + ], + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + }, + "dependencies": { + "@rollup/pluginutils": "^5.0.1", + "magic-string": "^0.30.3" + }, + "devDependencies": { + "@rollup/plugin-buble": "^1.0.0", + "del-cli": "^5.0.0", + "locate-character": "^2.0.5", + "rollup": "^4.0.0-24", + "source-map": "^0.7.4", + "typescript": "^4.8.3" + }, + "types": "./types/index.d.ts", + "ava": { + "workerThreads": false, + "files": [ + "!**/fixtures/**", + "!**/helpers/**", + "!**/recipes/**", + "!**/types.ts" + ] + }, + "scripts": { + "build": "rollup -c", + "ci:coverage": "nyc pnpm test && nyc report --reporter=text-lcov > coverage.lcov", + "ci:lint": "pnpm build && pnpm lint", + "ci:lint:commits": "commitlint --from=${CIRCLE_BRANCH} --to=${CIRCLE_SHA1}", + "ci:test": "pnpm test -- --verbose && pnpm test:ts", + "prebuild": "del-cli dist", + "prerelease": "pnpm build", + "pretest": "pnpm build", + "release": "pnpm --workspace-root package:release $(pwd)", + "test": "ava", + "test:ts": "tsc types/index.d.ts test/types.ts --noEmit" + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/@rollup/plugin-replace/src/index.js b/tools/ui/node_modules/@rollup/plugin-replace/src/index.js new file mode 100644 index 0000000000000000000000000000000000000000..1b17e812918012e4ac98b8871bf724af5cefc9fa --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-replace/src/index.js @@ -0,0 +1,131 @@ +import MagicString from 'magic-string'; +import { createFilter } from '@rollup/pluginutils'; + +function escape(str) { + return str.replace(/[-[\]/{}()*+?.\\^$|]/g, '\\$&'); +} + +function ensureFunction(functionOrValue) { + if (typeof functionOrValue === 'function') return functionOrValue; + return () => functionOrValue; +} + +function longest(a, b) { + return b.length - a.length; +} + +function getReplacements(options) { + if (options.values) { + return Object.assign({}, options.values); + } + const values = Object.assign({}, options); + delete values.delimiters; + delete values.include; + delete values.exclude; + delete values.sourcemap; + delete values.sourceMap; + delete values.objectGuards; + delete values.preventAssignment; + return values; +} + +function mapToFunctions(object) { + return Object.keys(object).reduce((fns, key) => { + const functions = Object.assign({}, fns); + functions[key] = ensureFunction(object[key]); + return functions; + }, {}); +} + +const objKeyRegEx = + /^([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)(\.([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*))+$/; +function expandTypeofReplacements(replacements) { + Object.keys(replacements).forEach((key) => { + const objMatch = key.match(objKeyRegEx); + if (!objMatch) return; + let dotIndex = objMatch[1].length; + do { + // eslint-disable-next-line no-param-reassign + replacements[`typeof ${key.slice(0, dotIndex)}`] = '"object"'; + dotIndex = key.indexOf('.', dotIndex + 1); + } while (dotIndex !== -1); + }); +} + +export default function replace(options = {}) { + const filter = createFilter(options.include, options.exclude); + const { + delimiters = ['(? string); + +export interface RollupReplaceOptions { + /** + * All other options are treated as `string: replacement` replacers, + * or `string: (id) => replacement` functions. + */ + [str: string]: + | Replacement + | RollupReplaceOptions['include'] + | RollupReplaceOptions['values'] + | RollupReplaceOptions['objectGuards'] + | RollupReplaceOptions['preventAssignment']; + + /** + * A picomatch pattern, or array of patterns, of files that should be + * processed by this plugin (if omitted, all files are included by default) + */ + include?: FilterPattern; + /** + * Files that should be excluded, if `include` is otherwise too permissive. + */ + exclude?: FilterPattern; + /** + * If false, skips source map generation. This will improve performance. + * @default true + */ + sourceMap?: boolean; + /** + * To replace every occurrence of `<@foo@>` instead of every occurrence + * of `foo`, supply delimiters + */ + delimiters?: [string, string]; + /** + * When replacing dot-separated object properties like `process.env.NODE_ENV`, + * will also replace `typeof process` object guard checks against the objects + * with the string `"object"`. + */ + objectGuards?: boolean; + /** + * Prevents replacing strings where they are followed by a single equals + * sign. + */ + preventAssignment?: boolean; + /** + * You can separate values to replace from other options. + */ + values?: { [str: string]: Replacement }; +} + +/** + * Replace strings in files while bundling them. + */ +export default function replace(options?: RollupReplaceOptions): Plugin; diff --git a/tools/ui/node_modules/@rollup/plugin-terser/LICENSE b/tools/ui/node_modules/@rollup/plugin-terser/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..5e46702cbdea74f8a8139094f5a1ff1f0e486f45 --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-terser/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019 RollupJS Plugin Contributors (https://github.com/rollup/plugins/graphs/contributors) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/tools/ui/node_modules/@rollup/plugin-terser/README.md b/tools/ui/node_modules/@rollup/plugin-terser/README.md new file mode 100644 index 0000000000000000000000000000000000000000..bcc387ed8a637321437637876c097799f09b2534 --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-terser/README.md @@ -0,0 +1,80 @@ +[npm]: https://img.shields.io/npm/v/@rollup/plugin-terser +[npm-url]: https://www.npmjs.com/package/@rollup/plugin-terser +[size]: https://packagephobia.now.sh/badge?p=@rollup/plugin-terser +[size-url]: https://packagephobia.now.sh/result?p=@rollup/plugin-terser + +[![npm][npm]][npm-url] +[![size][size]][size-url] +[![libera manifesto](https://img.shields.io/badge/libera-manifesto-lightgrey.svg)](https://liberamanifesto.com) + +# @rollup/plugin-terser + +🍣 A Rollup plugin to generate a minified bundle with terser. + +## Requirements + +This plugin requires an [LTS](https://github.com/nodejs/Release) Node version (v14.0.0+) and Rollup v2.0+. + +## Install + +Using npm: + +```console +npm install @rollup/plugin-terser --save-dev +``` + +## Usage + +Create a `rollup.config.js` [configuration file](https://www.rollupjs.org/guide/en/#configuration-files) and import the plugin: + +```typescript +import terser from '@rollup/plugin-terser'; + +export default { + input: 'src/index.js', + output: { + dir: 'output', + format: 'cjs' + }, + plugins: [terser()] +}; +``` + +Then call `rollup` either via the [CLI](https://www.rollupjs.org/guide/en/#command-line-reference) or the [API](https://www.rollupjs.org/guide/en/#javascript-api). + +## Options + +The plugin accepts a terser [Options](https://github.com/terser/terser#minify-options) object as input parameter, +to modify the default behaviour. + +In addition to the `terser` options, it is also possible to provide the following options: + +### `maxWorkers` + +Type: `Number`
+Default: `undefined` + +Instructs the plugin to use a specific amount of cpu threads. + +```typescript +import terser from '@rollup/plugin-terser'; + +export default { + input: 'src/index.js', + output: { + dir: 'output', + format: 'cjs' + }, + plugins: [ + terser({ + maxWorkers: 4 + }) + ] +}; +``` + +## Meta + +[CONTRIBUTING](/.github/CONTRIBUTING.md) + +[LICENSE (MIT)](/LICENSE) diff --git a/tools/ui/node_modules/@rollup/plugin-terser/dist/cjs/index.js b/tools/ui/node_modules/@rollup/plugin-terser/dist/cjs/index.js new file mode 100644 index 0000000000000000000000000000000000000000..599b4b0cb6dbe03e4ce5e4e3690d52c78e86fd97 --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-terser/dist/cjs/index.js @@ -0,0 +1,232 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var worker_threads = require('worker_threads'); +var smob = require('smob'); +var terser$1 = require('terser'); +var url = require('url'); +var async_hooks = require('async_hooks'); +var os = require('os'); +var events = require('events'); +var serializeJavascript = require('serialize-javascript'); + +var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null; +const taskInfo = Symbol('taskInfo'); +const freeWorker = Symbol('freeWorker'); +const workerPoolWorkerFlag = 'WorkerPoolWorker'; + +/** + * Duck typing worker context. + * + * @param input + */ +function isWorkerContextSerialized(input) { + return (smob.isObject(input) && + smob.hasOwnProperty(input, 'code') && + typeof input.code === 'string' && + smob.hasOwnProperty(input, 'options') && + typeof input.options === 'string'); +} +function runWorker() { + if (worker_threads.isMainThread || !worker_threads.parentPort || worker_threads.workerData !== workerPoolWorkerFlag) { + return; + } + // eslint-disable-next-line no-eval + const eval2 = eval; + worker_threads.parentPort.on('message', async (data) => { + if (!isWorkerContextSerialized(data)) { + return; + } + const options = eval2(`(${data.options})`); + const result = await terser$1.minify(data.code, options); + const output = { + code: result.code || data.code, + nameCache: options.nameCache + }; + if (typeof result.map === 'string') { + output.sourceMap = JSON.parse(result.map); + } + if (smob.isObject(result.map)) { + output.sourceMap = result.map; + } + worker_threads.parentPort === null || worker_threads.parentPort === void 0 ? void 0 : worker_threads.parentPort.postMessage(output); + }); +} + +class WorkerPoolTaskInfo extends async_hooks.AsyncResource { + constructor(callback) { + super('WorkerPoolTaskInfo'); + this.callback = callback; + } + done(err, result) { + this.runInAsyncScope(this.callback, null, err, result); + this.emitDestroy(); + } +} +class WorkerPool extends events.EventEmitter { + constructor(options) { + super(); + this.tasks = []; + this.workers = []; + this.freeWorkers = []; + this.maxInstances = options.maxWorkers || os.cpus().length; + this.filePath = options.filePath; + this.on(freeWorker, () => { + if (this.tasks.length > 0) { + const { context, cb } = this.tasks.shift(); + this.runTask(context, cb); + } + }); + } + get numWorkers() { + return this.workers.length; + } + addAsync(context) { + return new Promise((resolve, reject) => { + this.runTask(context, (err, output) => { + if (err) { + reject(err); + return; + } + if (!output) { + reject(new Error('The output is empty')); + return; + } + resolve(output); + }); + }); + } + close() { + for (let i = 0; i < this.workers.length; i++) { + const worker = this.workers[i]; + worker.terminate(); + } + } + addNewWorker() { + const worker = new worker_threads.Worker(this.filePath, { + workerData: workerPoolWorkerFlag + }); + worker.on('message', (result) => { + var _a; + (_a = worker[taskInfo]) === null || _a === void 0 ? void 0 : _a.done(null, result); + worker[taskInfo] = null; + this.freeWorkers.push(worker); + this.emit(freeWorker); + }); + worker.on('error', (err) => { + if (worker[taskInfo]) { + worker[taskInfo].done(err, null); + } + else { + this.emit('error', err); + } + this.workers.splice(this.workers.indexOf(worker), 1); + this.addNewWorker(); + }); + this.workers.push(worker); + this.freeWorkers.push(worker); + this.emit(freeWorker); + } + runTask(context, cb) { + if (this.freeWorkers.length === 0) { + this.tasks.push({ context, cb }); + if (this.numWorkers < this.maxInstances) { + this.addNewWorker(); + } + return; + } + const worker = this.freeWorkers.pop(); + if (worker) { + worker[taskInfo] = new WorkerPoolTaskInfo(cb); + worker.postMessage({ + code: context.code, + options: serializeJavascript(context.options) + }); + } + } +} + +function terser(input = {}) { + const { maxWorkers, ...options } = input; + let workerPool; + let numOfChunks = 0; + let numOfWorkersUsed = 0; + return { + name: 'terser', + async renderChunk(code, chunk, outputOptions) { + if (!workerPool) { + workerPool = new WorkerPool({ + filePath: url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.js', document.baseURI).href))), + maxWorkers + }); + } + numOfChunks += 1; + const defaultOptions = { + sourceMap: outputOptions.sourcemap === true || typeof outputOptions.sourcemap === 'string' + }; + if (outputOptions.format === 'es') { + defaultOptions.module = true; + } + if (outputOptions.format === 'cjs') { + defaultOptions.toplevel = true; + } + try { + const { code: result, nameCache, sourceMap } = await workerPool.addAsync({ + code, + options: smob.merge({}, options || {}, defaultOptions) + }); + if (options.nameCache && nameCache) { + let vars = { + props: {} + }; + if (smob.hasOwnProperty(options.nameCache, 'vars') && smob.isObject(options.nameCache.vars)) { + vars = smob.merge({}, options.nameCache.vars || {}, vars); + } + if (smob.hasOwnProperty(nameCache, 'vars') && smob.isObject(nameCache.vars)) { + vars = smob.merge({}, nameCache.vars, vars); + } + // eslint-disable-next-line no-param-reassign + options.nameCache.vars = vars; + let props = {}; + if (smob.hasOwnProperty(options.nameCache, 'props') && smob.isObject(options.nameCache.props)) { + // eslint-disable-next-line prefer-destructuring + props = options.nameCache.props; + } + if (smob.hasOwnProperty(nameCache, 'props') && smob.isObject(nameCache.props)) { + props = smob.merge({}, nameCache.props, props); + } + // eslint-disable-next-line no-param-reassign + options.nameCache.props = props; + } + if ((!!defaultOptions.sourceMap || !!options.sourceMap) && smob.isObject(sourceMap)) { + return { + code: result, + map: sourceMap + }; + } + return result; + } + catch (e) { + return Promise.reject(e); + } + finally { + numOfChunks -= 1; + if (numOfChunks === 0) { + numOfWorkersUsed = workerPool.numWorkers; + workerPool.close(); + workerPool = null; + } + } + }, + get numOfWorkersUsed() { + return numOfWorkersUsed; + } + }; +} + +runWorker(); + +exports.default = terser; +module.exports = Object.assign(exports.default, exports); +//# sourceMappingURL=index.js.map diff --git a/tools/ui/node_modules/@rollup/plugin-terser/dist/es/index.js b/tools/ui/node_modules/@rollup/plugin-terser/dist/es/index.js new file mode 100644 index 0000000000000000000000000000000000000000..7296e677e6b2b38df9522b196fee24feec996793 --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-terser/dist/es/index.js @@ -0,0 +1,226 @@ +import { isMainThread, parentPort, workerData, Worker } from 'worker_threads'; +import { isObject, hasOwnProperty, merge } from 'smob'; +import { minify } from 'terser'; +import { fileURLToPath } from 'url'; +import { AsyncResource } from 'async_hooks'; +import { cpus } from 'os'; +import { EventEmitter } from 'events'; +import serializeJavascript from 'serialize-javascript'; + +const taskInfo = Symbol('taskInfo'); +const freeWorker = Symbol('freeWorker'); +const workerPoolWorkerFlag = 'WorkerPoolWorker'; + +/** + * Duck typing worker context. + * + * @param input + */ +function isWorkerContextSerialized(input) { + return (isObject(input) && + hasOwnProperty(input, 'code') && + typeof input.code === 'string' && + hasOwnProperty(input, 'options') && + typeof input.options === 'string'); +} +function runWorker() { + if (isMainThread || !parentPort || workerData !== workerPoolWorkerFlag) { + return; + } + // eslint-disable-next-line no-eval + const eval2 = eval; + parentPort.on('message', async (data) => { + if (!isWorkerContextSerialized(data)) { + return; + } + const options = eval2(`(${data.options})`); + const result = await minify(data.code, options); + const output = { + code: result.code || data.code, + nameCache: options.nameCache + }; + if (typeof result.map === 'string') { + output.sourceMap = JSON.parse(result.map); + } + if (isObject(result.map)) { + output.sourceMap = result.map; + } + parentPort === null || parentPort === void 0 ? void 0 : parentPort.postMessage(output); + }); +} + +class WorkerPoolTaskInfo extends AsyncResource { + constructor(callback) { + super('WorkerPoolTaskInfo'); + this.callback = callback; + } + done(err, result) { + this.runInAsyncScope(this.callback, null, err, result); + this.emitDestroy(); + } +} +class WorkerPool extends EventEmitter { + constructor(options) { + super(); + this.tasks = []; + this.workers = []; + this.freeWorkers = []; + this.maxInstances = options.maxWorkers || cpus().length; + this.filePath = options.filePath; + this.on(freeWorker, () => { + if (this.tasks.length > 0) { + const { context, cb } = this.tasks.shift(); + this.runTask(context, cb); + } + }); + } + get numWorkers() { + return this.workers.length; + } + addAsync(context) { + return new Promise((resolve, reject) => { + this.runTask(context, (err, output) => { + if (err) { + reject(err); + return; + } + if (!output) { + reject(new Error('The output is empty')); + return; + } + resolve(output); + }); + }); + } + close() { + for (let i = 0; i < this.workers.length; i++) { + const worker = this.workers[i]; + worker.terminate(); + } + } + addNewWorker() { + const worker = new Worker(this.filePath, { + workerData: workerPoolWorkerFlag + }); + worker.on('message', (result) => { + var _a; + (_a = worker[taskInfo]) === null || _a === void 0 ? void 0 : _a.done(null, result); + worker[taskInfo] = null; + this.freeWorkers.push(worker); + this.emit(freeWorker); + }); + worker.on('error', (err) => { + if (worker[taskInfo]) { + worker[taskInfo].done(err, null); + } + else { + this.emit('error', err); + } + this.workers.splice(this.workers.indexOf(worker), 1); + this.addNewWorker(); + }); + this.workers.push(worker); + this.freeWorkers.push(worker); + this.emit(freeWorker); + } + runTask(context, cb) { + if (this.freeWorkers.length === 0) { + this.tasks.push({ context, cb }); + if (this.numWorkers < this.maxInstances) { + this.addNewWorker(); + } + return; + } + const worker = this.freeWorkers.pop(); + if (worker) { + worker[taskInfo] = new WorkerPoolTaskInfo(cb); + worker.postMessage({ + code: context.code, + options: serializeJavascript(context.options) + }); + } + } +} + +function terser(input = {}) { + const { maxWorkers, ...options } = input; + let workerPool; + let numOfChunks = 0; + let numOfWorkersUsed = 0; + return { + name: 'terser', + async renderChunk(code, chunk, outputOptions) { + if (!workerPool) { + workerPool = new WorkerPool({ + filePath: fileURLToPath(import.meta.url), + maxWorkers + }); + } + numOfChunks += 1; + const defaultOptions = { + sourceMap: outputOptions.sourcemap === true || typeof outputOptions.sourcemap === 'string' + }; + if (outputOptions.format === 'es') { + defaultOptions.module = true; + } + if (outputOptions.format === 'cjs') { + defaultOptions.toplevel = true; + } + try { + const { code: result, nameCache, sourceMap } = await workerPool.addAsync({ + code, + options: merge({}, options || {}, defaultOptions) + }); + if (options.nameCache && nameCache) { + let vars = { + props: {} + }; + if (hasOwnProperty(options.nameCache, 'vars') && isObject(options.nameCache.vars)) { + vars = merge({}, options.nameCache.vars || {}, vars); + } + if (hasOwnProperty(nameCache, 'vars') && isObject(nameCache.vars)) { + vars = merge({}, nameCache.vars, vars); + } + // eslint-disable-next-line no-param-reassign + options.nameCache.vars = vars; + let props = {}; + if (hasOwnProperty(options.nameCache, 'props') && isObject(options.nameCache.props)) { + // eslint-disable-next-line prefer-destructuring + props = options.nameCache.props; + } + if (hasOwnProperty(nameCache, 'props') && isObject(nameCache.props)) { + props = merge({}, nameCache.props, props); + } + // eslint-disable-next-line no-param-reassign + options.nameCache.props = props; + } + if ((!!defaultOptions.sourceMap || !!options.sourceMap) && isObject(sourceMap)) { + return { + code: result, + map: sourceMap + }; + } + return result; + } + catch (e) { + return Promise.reject(e); + } + finally { + numOfChunks -= 1; + if (numOfChunks === 0) { + numOfWorkersUsed = workerPool.numWorkers; + workerPool.close(); + workerPool = null; + } + } + }, + get numOfWorkersUsed() { + return numOfWorkersUsed; + } + }; +} + +runWorker(); + +export { terser as default }; +//# sourceMappingURL=index.js.map diff --git a/tools/ui/node_modules/@rollup/plugin-terser/dist/es/package.json b/tools/ui/node_modules/@rollup/plugin-terser/dist/es/package.json new file mode 100644 index 0000000000000000000000000000000000000000..7c34deb5837d8d5e168b54f95f7872b2c50eca13 --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-terser/dist/es/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tools/ui/node_modules/@rollup/plugin-terser/package.json b/tools/ui/node_modules/@rollup/plugin-terser/package.json new file mode 100644 index 0000000000000000000000000000000000000000..0dac9c103c67e6d64631de7a86fc47f2e4be368d --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-terser/package.json @@ -0,0 +1,73 @@ +{ + "name": "@rollup/plugin-terser", + "version": "1.0.0", + "publishConfig": { + "access": "public" + }, + "description": "Generate minified bundle", + "license": "MIT", + "repository": { + "url": "rollup/plugins", + "directory": "packages/terser" + }, + "author": "Peter Placzek ", + "homepage": "https://github.com/rollup/plugins/tree/master/packages/terser#readme", + "bugs": "https://github.com/rollup/plugins/issues", + "main": "dist/cjs/index.js", + "module": "dist/es/index.js", + "exports": { + "types": "./types/index.d.ts", + "import": "./dist/es/index.js", + "default": "./dist/cjs/index.js" + }, + "engines": { + "node": ">=20.0.0" + }, + "files": [ + "dist", + "!dist/**/*.map", + "src", + "types", + "README.md" + ], + "keywords": [ + "rollup", + "plugin", + "terser", + "minify", + "npm", + "modules" + ], + "peerDependencies": { + "rollup": "^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + }, + "dependencies": { + "serialize-javascript": "^7.0.3", + "smob": "^1.0.0", + "terser": "^5.17.4" + }, + "devDependencies": { + "@types/serialize-javascript": "^5.0.4", + "rollup": "^4.0.0-24", + "typescript": "^4.8.3" + }, + "types": "./types/index.d.ts", + "scripts": { + "build": "rollup -c", + "ci:coverage": "nyc pnpm test && nyc report --reporter=text-lcov > coverage.lcov", + "ci:lint": "pnpm build && pnpm lint", + "ci:lint:commits": "commitlint --from=${CIRCLE_BRANCH} --to=${CIRCLE_SHA1}", + "ci:test": "pnpm test -- --verbose && pnpm test:ts", + "prebuild": "del-cli dist", + "prerelease": "pnpm build", + "pretest": "pnpm build", + "release": "pnpm --workspace-root package:release $(pwd)", + "test": "ava", + "test:ts": "tsc types/index.d.ts test/types.ts --noEmit" + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/@rollup/plugin-terser/src/constants.ts b/tools/ui/node_modules/@rollup/plugin-terser/src/constants.ts new file mode 100644 index 0000000000000000000000000000000000000000..205d46dc0238d2c12574f5add42cf119345227f0 --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-terser/src/constants.ts @@ -0,0 +1,3 @@ +export const taskInfo = Symbol('taskInfo'); +export const freeWorker = Symbol('freeWorker'); +export const workerPoolWorkerFlag = 'WorkerPoolWorker'; diff --git a/tools/ui/node_modules/@rollup/plugin-terser/src/index.ts b/tools/ui/node_modules/@rollup/plugin-terser/src/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..76a880f5aa2b199d6576ca98503f4b12284a3f9e --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-terser/src/index.ts @@ -0,0 +1,8 @@ +import { runWorker } from './worker'; +import terser from './module'; + +runWorker(); + +export * from './type'; + +export default terser; diff --git a/tools/ui/node_modules/@rollup/plugin-terser/src/module.ts b/tools/ui/node_modules/@rollup/plugin-terser/src/module.ts new file mode 100644 index 0000000000000000000000000000000000000000..2877a6e49ff1b0775ea030252669b386ef929247 --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-terser/src/module.ts @@ -0,0 +1,105 @@ +import { fileURLToPath } from 'url'; + +import type { NormalizedOutputOptions, RenderedChunk } from 'rollup'; +import { hasOwnProperty, isObject, merge } from 'smob'; + +import type { Options } from './type'; +import { WorkerPool } from './worker-pool'; + +export default function terser(input: Options = {}) { + const { maxWorkers, ...options } = input; + + let workerPool: WorkerPool | null | undefined; + let numOfChunks = 0; + let numOfWorkersUsed = 0; + + return { + name: 'terser', + + async renderChunk(code: string, chunk: RenderedChunk, outputOptions: NormalizedOutputOptions) { + if (!workerPool) { + workerPool = new WorkerPool({ + filePath: fileURLToPath(import.meta.url), + maxWorkers + }); + } + + numOfChunks += 1; + + const defaultOptions: Options = { + sourceMap: outputOptions.sourcemap === true || typeof outputOptions.sourcemap === 'string' + }; + + if (outputOptions.format === 'es') { + defaultOptions.module = true; + } + + if (outputOptions.format === 'cjs') { + defaultOptions.toplevel = true; + } + + try { + const { + code: result, + nameCache, + sourceMap + } = await workerPool.addAsync({ + code, + options: merge({}, options || {}, defaultOptions) + }); + + if (options.nameCache && nameCache) { + let vars: Record = { + props: {} + }; + + if (hasOwnProperty(options.nameCache, 'vars') && isObject(options.nameCache.vars)) { + vars = merge({}, options.nameCache.vars || {}, vars); + } + + if (hasOwnProperty(nameCache, 'vars') && isObject(nameCache.vars)) { + vars = merge({}, nameCache.vars, vars); + } + + // eslint-disable-next-line no-param-reassign + options.nameCache.vars = vars; + + let props: Record = {}; + + if (hasOwnProperty(options.nameCache, 'props') && isObject(options.nameCache.props)) { + // eslint-disable-next-line prefer-destructuring + props = options.nameCache.props; + } + + if (hasOwnProperty(nameCache, 'props') && isObject(nameCache.props)) { + props = merge({}, nameCache.props, props); + } + + // eslint-disable-next-line no-param-reassign + options.nameCache.props = props; + } + + if ((!!defaultOptions.sourceMap || !!options.sourceMap) && isObject(sourceMap)) { + return { + code: result, + map: sourceMap + }; + } + return result; + } catch (e) { + return Promise.reject(e); + } finally { + numOfChunks -= 1; + if (numOfChunks === 0) { + numOfWorkersUsed = workerPool.numWorkers; + workerPool.close(); + workerPool = null; + } + } + }, + + get numOfWorkersUsed() { + return numOfWorkersUsed; + } + }; +} diff --git a/tools/ui/node_modules/@rollup/plugin-terser/src/type.ts b/tools/ui/node_modules/@rollup/plugin-terser/src/type.ts new file mode 100644 index 0000000000000000000000000000000000000000..0866af55f0d981e69c9c2bd9f0d69835e19e744a --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-terser/src/type.ts @@ -0,0 +1,45 @@ +import type { AsyncResource } from 'async_hooks'; +import type { Worker } from 'worker_threads'; + +import type { MinifyOptions } from 'terser'; + +import type { taskInfo } from './constants'; + +export interface Options extends MinifyOptions { + nameCache?: Record; + maxWorkers?: number; +} + +export interface WorkerContext { + code: string; + options: Options; +} + +export type WorkerCallback = (err: Error | null, output?: WorkerOutput) => void; + +interface WorkerPoolTaskInfo extends AsyncResource { + done(err: Error | null, result: any): void; +} + +export type WorkerWithTaskInfo = Worker & { [taskInfo]?: WorkerPoolTaskInfo | null }; + +export interface WorkerContextSerialized { + code: string; + options: string; +} + +export interface WorkerOutput { + code: string; + nameCache?: Options['nameCache']; + sourceMap?: Record; +} + +export interface WorkerPoolOptions { + filePath: string; + maxWorkers?: number; +} + +export interface WorkerPoolTask { + context: WorkerContext; + cb: WorkerCallback; +} diff --git a/tools/ui/node_modules/@rollup/plugin-terser/src/worker-pool.ts b/tools/ui/node_modules/@rollup/plugin-terser/src/worker-pool.ts new file mode 100644 index 0000000000000000000000000000000000000000..92d6902c4ed976cb4a17a895726eb592138f9a36 --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-terser/src/worker-pool.ts @@ -0,0 +1,128 @@ +import { AsyncResource } from 'async_hooks'; +import { Worker } from 'worker_threads'; +import { cpus } from 'os'; +import { EventEmitter } from 'events'; + +import serializeJavascript from 'serialize-javascript'; + +import { freeWorker, taskInfo, workerPoolWorkerFlag } from './constants'; + +import type { + WorkerCallback, + WorkerContext, + WorkerOutput, + WorkerPoolOptions, + WorkerPoolTask, + WorkerWithTaskInfo +} from './type'; + +class WorkerPoolTaskInfo extends AsyncResource { + constructor(private callback: WorkerCallback) { + super('WorkerPoolTaskInfo'); + } + + done(err: Error | null, result: any) { + this.runInAsyncScope(this.callback, null, err, result); + this.emitDestroy(); + } +} + +export class WorkerPool extends EventEmitter { + protected maxInstances: number; + + protected filePath: string; + + protected tasks: WorkerPoolTask[] = []; + + protected workers: WorkerWithTaskInfo[] = []; + protected freeWorkers: WorkerWithTaskInfo[] = []; + + constructor(options: WorkerPoolOptions) { + super(); + + this.maxInstances = options.maxWorkers || cpus().length; + this.filePath = options.filePath; + + this.on(freeWorker, () => { + if (this.tasks.length > 0) { + const { context, cb } = this.tasks.shift()!; + this.runTask(context, cb); + } + }); + } + + get numWorkers(): number { + return this.workers.length; + } + + addAsync(context: WorkerContext): Promise { + return new Promise((resolve, reject) => { + this.runTask(context, (err, output) => { + if (err) { + reject(err); + return; + } + + if (!output) { + reject(new Error('The output is empty')); + return; + } + + resolve(output); + }); + }); + } + + close() { + for (let i = 0; i < this.workers.length; i++) { + const worker = this.workers[i]; + worker.terminate(); + } + } + + private addNewWorker() { + const worker: WorkerWithTaskInfo = new Worker(this.filePath, { + workerData: workerPoolWorkerFlag + }); + + worker.on('message', (result) => { + worker[taskInfo]?.done(null, result); + worker[taskInfo] = null; + this.freeWorkers.push(worker); + this.emit(freeWorker); + }); + + worker.on('error', (err) => { + if (worker[taskInfo]) { + worker[taskInfo].done(err, null); + } else { + this.emit('error', err); + } + this.workers.splice(this.workers.indexOf(worker), 1); + this.addNewWorker(); + }); + + this.workers.push(worker); + this.freeWorkers.push(worker); + this.emit(freeWorker); + } + + private runTask(context: WorkerContext, cb: WorkerCallback) { + if (this.freeWorkers.length === 0) { + this.tasks.push({ context, cb }); + if (this.numWorkers < this.maxInstances) { + this.addNewWorker(); + } + return; + } + + const worker = this.freeWorkers.pop(); + if (worker) { + worker[taskInfo] = new WorkerPoolTaskInfo(cb); + worker.postMessage({ + code: context.code, + options: serializeJavascript(context.options) + }); + } + } +} diff --git a/tools/ui/node_modules/@rollup/plugin-terser/src/worker.ts b/tools/ui/node_modules/@rollup/plugin-terser/src/worker.ts new file mode 100644 index 0000000000000000000000000000000000000000..ea904b9fd77938776057e8d63c1cf290ffd0b3c9 --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-terser/src/worker.ts @@ -0,0 +1,58 @@ +import { isMainThread, parentPort, workerData } from 'worker_threads'; + +import { hasOwnProperty, isObject } from 'smob'; + +import { minify } from 'terser'; + +import { workerPoolWorkerFlag } from './constants'; + +import type { WorkerContextSerialized, WorkerOutput } from './type'; + +/** + * Duck typing worker context. + * + * @param input + */ +function isWorkerContextSerialized(input: unknown): input is WorkerContextSerialized { + return ( + isObject(input) && + hasOwnProperty(input, 'code') && + typeof input.code === 'string' && + hasOwnProperty(input, 'options') && + typeof input.options === 'string' + ); +} + +export function runWorker() { + if (isMainThread || !parentPort || workerData !== workerPoolWorkerFlag) { + return; + } + + // eslint-disable-next-line no-eval + const eval2 = eval; + + parentPort.on('message', async (data: WorkerContextSerialized) => { + if (!isWorkerContextSerialized(data)) { + return; + } + + const options = eval2(`(${data.options})`); + + const result = await minify(data.code, options); + + const output: WorkerOutput = { + code: result.code || data.code, + nameCache: options.nameCache + }; + + if (typeof result.map === 'string') { + output.sourceMap = JSON.parse(result.map); + } + + if (isObject(result.map)) { + output.sourceMap = result.map; + } + + parentPort?.postMessage(output); + }); +} diff --git a/tools/ui/node_modules/@rollup/plugin-terser/types/index.d.ts b/tools/ui/node_modules/@rollup/plugin-terser/types/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..0147eafa05475553541a66cccf31817098339031 --- /dev/null +++ b/tools/ui/node_modules/@rollup/plugin-terser/types/index.d.ts @@ -0,0 +1,15 @@ +import type { Plugin } from 'rollup'; +import type { MinifyOptions } from 'terser'; + +export interface Options extends MinifyOptions { + nameCache?: Record; + maxWorkers?: number; +} + +/** + * A Rollup plugin to generate a minified output bundle. + * + * @param options - Plugin options. + * @returns Plugin instance. + */ +export default function terser(options?: Options): Plugin; diff --git a/tools/ui/node_modules/@rollup/pluginutils/LICENSE b/tools/ui/node_modules/@rollup/pluginutils/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..5e46702cbdea74f8a8139094f5a1ff1f0e486f45 --- /dev/null +++ b/tools/ui/node_modules/@rollup/pluginutils/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2019 RollupJS Plugin Contributors (https://github.com/rollup/plugins/graphs/contributors) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/tools/ui/node_modules/@rollup/pluginutils/README.md b/tools/ui/node_modules/@rollup/pluginutils/README.md new file mode 100644 index 0000000000000000000000000000000000000000..8c43672ec084d6ad8b29756933681807767be77c --- /dev/null +++ b/tools/ui/node_modules/@rollup/pluginutils/README.md @@ -0,0 +1,313 @@ +[npm]: https://img.shields.io/npm/v/@rollup/pluginutils +[npm-url]: https://www.npmjs.com/package/@rollup/pluginutils +[size]: https://packagephobia.now.sh/badge?p=@rollup/pluginutils +[size-url]: https://packagephobia.now.sh/result?p=@rollup/pluginutils + +[![npm][npm]][npm-url] +[![size][size]][size-url] +[![libera manifesto](https://img.shields.io/badge/libera-manifesto-lightgrey.svg)](https://liberamanifesto.com) + +# @rollup/pluginutils + +A set of utility functions commonly used by 🍣 Rollup plugins. + +## Requirements + +The plugin utils require an [LTS](https://github.com/nodejs/Release) Node version (v14.0.0+) and Rollup v1.20.0+. + +## Install + +Using npm: + +```console +npm install @rollup/pluginutils --save-dev +``` + +## Usage + +```js +import utils from '@rollup/pluginutils'; +//... +``` + +## API + +Available utility functions are listed below: + +_Note: Parameter names immediately followed by a `?` indicate that the parameter is optional._ + +### addExtension + +Adds an extension to a module ID if one does not exist. + +Parameters: `(filename: String, ext?: String)`
+Returns: `String` + +```js +import { addExtension } from '@rollup/pluginutils'; + +export default function myPlugin(options = {}) { + return { + resolveId(code, id) { + // only adds an extension if there isn't one already + id = addExtension(id); // `foo` -> `foo.js`, `foo.js` -> `foo.js` + id = addExtension(id, '.myext'); // `foo` -> `foo.myext`, `foo.js` -> `foo.js` + } + }; +} +``` + +### attachScopes + +Attaches `Scope` objects to the relevant nodes of an AST. Each `Scope` object has a `scope.contains(name)` method that returns `true` if a given name is defined in the current scope or a parent scope. + +Parameters: `(ast: Node, propertyName?: String)`
+Returns: `Object` + +See [@rollup/plugin-inject](https://github.com/rollup/plugins/tree/master/packages/inject) or [@rollup/plugin-commonjs](https://github.com/rollup/plugins/tree/master/packages/commonjs) for an example of usage. + +```js +import { attachScopes } from '@rollup/pluginutils'; +import { walk } from 'estree-walker'; + +export default function myPlugin(options = {}) { + return { + transform(code) { + const ast = this.parse(code); + + let scope = attachScopes(ast, 'scope'); + + walk(ast, { + enter(node) { + if (node.scope) scope = node.scope; + + if (!scope.contains('foo')) { + // `foo` is not defined, so if we encounter it, + // we assume it's a global + } + }, + leave(node) { + if (node.scope) scope = scope.parent; + } + }); + } + }; +} +``` + +### createFilter + +Constructs a filter function which can be used to determine whether or not certain modules should be operated upon. + +Parameters: `(include?: , exclude?: , options?: Object)`
+Returns: `(id: string | unknown) => boolean` + +#### `include` and `exclude` + +Type: `String | RegExp | Array[...String|RegExp]`
+ +A valid [`picomatch`](https://github.com/micromatch/picomatch#globbing-features) pattern, or array of patterns. If `options.include` is omitted or has zero length, filter will return `true` by default. Otherwise, an ID must match one or more of the `picomatch` patterns, and must not match any of the `options.exclude` patterns. + +Note that `picomatch` patterns are very similar to [`minimatch`](https://github.com/isaacs/minimatch#readme) patterns, and in most use cases, they are interchangeable. If you have more specific pattern matching needs, you can view [this comparison table](https://github.com/micromatch/picomatch#library-comparisons) to learn more about where the libraries differ. + +#### `options` + +##### `resolve` + +Type: `String | Boolean | null` + +Optionally resolves the patterns against a directory other than `process.cwd()`. If a `String` is specified, then the value will be used as the base directory. Relative paths will be resolved against `process.cwd()` first. If `false`, then the patterns will not be resolved against any directory. This can be useful if you want to create a filter for virtual module names. + +#### Usage + +```js +import { createFilter } from '@rollup/pluginutils'; + +export default function myPlugin(options = {}) { + // assume that the myPlugin accepts options of `options.include` and `options.exclude` + var filter = createFilter(options.include, options.exclude, { + resolve: '/my/base/dir' + }); + + return { + transform(code, id) { + if (!filter(id)) return; + + // proceed with the transformation... + } + }; +} +``` + +### dataToEsm + +Transforms objects into tree-shakable ES Module imports. + +Parameters: `(data: Object, options: DataToEsmOptions)`
+Returns: `String` + +#### `data` + +Type: `Object` + +An object to transform into an ES module. + +#### `options` + +Type: `DataToEsmOptions` + +_Note: Please see the TypeScript definition for complete documentation of these options_ + +#### Usage + +```js +import { dataToEsm } from '@rollup/pluginutils'; + +const esModuleSource = dataToEsm( + { + custom: 'data', + to: ['treeshake'] + }, + { + compact: false, + indent: '\t', + preferConst: true, + objectShorthand: true, + namedExports: true, + includeArbitraryNames: false + } +); +/* +Outputs the string ES module source: + export const custom = 'data'; + export const to = ['treeshake']; + export default { custom, to }; +*/ +``` + +### extractAssignedNames + +Extracts the names of all assignment targets based upon specified patterns. + +Parameters: `(param: Node)`
+Returns: `Array[...String]` + +#### `param` + +Type: `Node` + +An `acorn` AST Node. + +#### Usage + +```js +import { extractAssignedNames } from '@rollup/pluginutils'; +import { walk } from 'estree-walker'; + +export default function myPlugin(options = {}) { + return { + transform(code) { + const ast = this.parse(code); + + walk(ast, { + enter(node) { + if (node.type === 'VariableDeclarator') { + const declaredNames = extractAssignedNames(node.id); + // do something with the declared names + // e.g. for `const {x, y: z} = ...` => declaredNames = ['x', 'z'] + } + } + }); + } + }; +} +``` + +### exactRegex + +Constructs a RegExp that matches the exact string specified. This is useful for plugin hook filters. + +Parameters: `(str: String | Array[...String], flags?: String)`
+Returns: `RegExp` + +#### Usage + +```js +import { exactRegex } from '@rollup/pluginutils'; + +exactRegex('foobar'); // /^foobar$/ +exactRegex(['foo', 'bar']); // /^(?:foo|bar)$/ +exactRegex('foo(bar)', 'i'); // /^foo\(bar\)$/i +``` + +### makeLegalIdentifier + +Constructs a bundle-safe identifier from a `String`. + +Parameters: `(str: String)`
+Returns: `String` + +#### Usage + +```js +import { makeLegalIdentifier } from '@rollup/pluginutils'; + +makeLegalIdentifier('foo-bar'); // 'foo_bar' +makeLegalIdentifier('typeof'); // '_typeof' +``` + +### normalizePath + +Converts path separators to forward slash. + +Parameters: `(filename: String)`
+Returns: `String` + +#### Usage + +```js +import { normalizePath } from '@rollup/pluginutils'; + +normalizePath('foo\\bar'); // 'foo/bar' +normalizePath('foo/bar'); // 'foo/bar' +``` + +### prefixRegex + +Constructs a RegExp that matches a value that has the specified prefix. This is useful for plugin hook filters. + +Parameters: `(str: String | Array[...String], flags?: String)`
+Returns: `RegExp` + +#### Usage + +```js +import { prefixRegex } from '@rollup/pluginutils'; + +prefixRegex('foobar'); // /^foobar/ +prefixRegex(['foo', 'bar']); // /^(?:foo|bar)/ +prefixRegex('foo(bar)', 'i'); // /^foo\(bar\)/i +``` + +### suffixRegex + +Constructs a RegExp that matches a value that has the specified suffix. This is useful for plugin hook filters. + +Parameters: `(str: String | Array[...String], flags?: String)`
+Returns: `RegExp` + +#### Usage + +```js +import { suffixRegex } from '@rollup/pluginutils'; + +suffixRegex('foobar'); // /foobar$/ +suffixRegex(['foo', 'bar']); // /(?:foo|bar)$/ +suffixRegex('foo(bar)', 'i'); // /foo\(bar\)$/i +``` + +## Meta + +[CONTRIBUTING](/.github/CONTRIBUTING.md) + +[LICENSE (MIT)](/LICENSE) diff --git a/tools/ui/node_modules/@rollup/pluginutils/dist/cjs/index.js b/tools/ui/node_modules/@rollup/pluginutils/dist/cjs/index.js new file mode 100644 index 0000000000000000000000000000000000000000..525e32db5b49e714939fd5cccb165cc44d568d9f --- /dev/null +++ b/tools/ui/node_modules/@rollup/pluginutils/dist/cjs/index.js @@ -0,0 +1,422 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var path = require('path'); +var estreeWalker = require('estree-walker'); +var pm = require('picomatch'); + +const addExtension = function addExtension(filename, ext = '.js') { + let result = `${filename}`; + if (!path.extname(filename)) + result += ext; + return result; +}; + +const extractors = { + ArrayPattern(names, param) { + for (const element of param.elements) { + if (element) + extractors[element.type](names, element); + } + }, + AssignmentPattern(names, param) { + extractors[param.left.type](names, param.left); + }, + Identifier(names, param) { + names.push(param.name); + }, + MemberExpression() { }, + ObjectPattern(names, param) { + for (const prop of param.properties) { + // @ts-ignore Typescript reports that this is not a valid type + if (prop.type === 'RestElement') { + extractors.RestElement(names, prop); + } + else { + extractors[prop.value.type](names, prop.value); + } + } + }, + RestElement(names, param) { + extractors[param.argument.type](names, param.argument); + } +}; +const extractAssignedNames = function extractAssignedNames(param) { + const names = []; + extractors[param.type](names, param); + return names; +}; + +const blockDeclarations = { + const: true, + let: true +}; +class Scope { + constructor(options = {}) { + this.parent = options.parent; + this.isBlockScope = !!options.block; + this.declarations = Object.create(null); + if (options.params) { + options.params.forEach((param) => { + extractAssignedNames(param).forEach((name) => { + this.declarations[name] = true; + }); + }); + } + } + addDeclaration(node, isBlockDeclaration, isVar) { + if (!isBlockDeclaration && this.isBlockScope) { + // it's a `var` or function node, and this + // is a block scope, so we need to go up + this.parent.addDeclaration(node, isBlockDeclaration, isVar); + } + else if (node.id) { + extractAssignedNames(node.id).forEach((name) => { + this.declarations[name] = true; + }); + } + } + contains(name) { + return this.declarations[name] || (this.parent ? this.parent.contains(name) : false); + } +} +const attachScopes = function attachScopes(ast, propertyName = 'scope') { + let scope = new Scope(); + estreeWalker.walk(ast, { + enter(n, parent) { + const node = n; + // function foo () {...} + // class Foo {...} + if (/(?:Function|Class)Declaration/.test(node.type)) { + scope.addDeclaration(node, false, false); + } + // var foo = 1 + if (node.type === 'VariableDeclaration') { + const { kind } = node; + const isBlockDeclaration = blockDeclarations[kind]; + node.declarations.forEach((declaration) => { + scope.addDeclaration(declaration, isBlockDeclaration, true); + }); + } + let newScope; + // create new function scope + if (node.type.includes('Function')) { + const func = node; + newScope = new Scope({ + parent: scope, + block: false, + params: func.params + }); + // named function expressions - the name is considered + // part of the function's scope + if (func.type === 'FunctionExpression' && func.id) { + newScope.addDeclaration(func, false, false); + } + } + // create new for scope + if (/For(?:In|Of)?Statement/.test(node.type)) { + newScope = new Scope({ + parent: scope, + block: true + }); + } + // create new block scope + if (node.type === 'BlockStatement' && !parent.type.includes('Function')) { + newScope = new Scope({ + parent: scope, + block: true + }); + } + // catch clause has its own block scope + if (node.type === 'CatchClause') { + newScope = new Scope({ + parent: scope, + params: node.param ? [node.param] : [], + block: true + }); + } + if (newScope) { + Object.defineProperty(node, propertyName, { + value: newScope, + configurable: true + }); + scope = newScope; + } + }, + leave(n) { + const node = n; + if (node[propertyName]) + scope = scope.parent; + } + }); + return scope; +}; + +// Helper since Typescript can't detect readonly arrays with Array.isArray +function isArray(arg) { + return Array.isArray(arg); +} +function ensureArray(thing) { + if (isArray(thing)) + return thing; + if (thing == null) + return []; + return [thing]; +} + +const normalizePathRegExp = new RegExp(`\\${path.win32.sep}`, 'g'); +const normalizePath = function normalizePath(filename) { + return filename.replace(normalizePathRegExp, path.posix.sep); +}; + +function getMatcherString(id, resolutionBase) { + if (resolutionBase === false || path.isAbsolute(id) || id.startsWith('**')) { + return normalizePath(id); + } + // resolve('') is valid and will default to process.cwd() + const basePath = normalizePath(path.resolve(resolutionBase || '')) + // escape all possible (posix + win) path characters that might interfere with regex + .replace(/[-^$*+?.()|[\]{}]/g, '\\$&'); + // Note that we use posix.join because: + // 1. the basePath has been normalized to use / + // 2. the incoming glob (id) matcher, also uses / + // otherwise Node will force backslash (\) on windows + return path.posix.join(basePath, normalizePath(id)); +} +const createFilter = function createFilter(include, exclude, options) { + const resolutionBase = options && options.resolve; + const getMatcher = (id) => id instanceof RegExp + ? id + : { + test: (what) => { + // this refactor is a tad overly verbose but makes for easy debugging + const pattern = getMatcherString(id, resolutionBase); + const fn = pm(pattern, { dot: true }); + const result = fn(what); + return result; + } + }; + const includeMatchers = ensureArray(include).map(getMatcher); + const excludeMatchers = ensureArray(exclude).map(getMatcher); + if (!includeMatchers.length && !excludeMatchers.length) + return (id) => typeof id === 'string' && !id.includes('\0'); + return function result(id) { + if (typeof id !== 'string') + return false; + if (id.includes('\0')) + return false; + const pathId = normalizePath(id); + for (let i = 0; i < excludeMatchers.length; ++i) { + const matcher = excludeMatchers[i]; + if (matcher instanceof RegExp) { + matcher.lastIndex = 0; + } + if (matcher.test(pathId)) + return false; + } + for (let i = 0; i < includeMatchers.length; ++i) { + const matcher = includeMatchers[i]; + if (matcher instanceof RegExp) { + matcher.lastIndex = 0; + } + if (matcher.test(pathId)) + return true; + } + return !includeMatchers.length; + }; +}; + +const reservedWords = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public'; +const builtins = 'arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl'; +const forbiddenIdentifiers = new Set(`${reservedWords} ${builtins}`.split(' ')); +forbiddenIdentifiers.add(''); +const makeLegalIdentifier = function makeLegalIdentifier(str) { + let identifier = str + .replace(/-(\w)/g, (_, letter) => letter.toUpperCase()) + .replace(/[^$_a-zA-Z0-9]/g, '_'); + if (/\d/.test(identifier[0]) || forbiddenIdentifiers.has(identifier)) { + identifier = `_${identifier}`; + } + return identifier || '_'; +}; + +function stringify(obj) { + return (JSON.stringify(obj) || 'undefined').replace(/[\u2028\u2029]/g, (char) => `\\u${`000${char.charCodeAt(0).toString(16)}`.slice(-4)}`); +} +function serializeArray(arr, indent, baseIndent) { + let output = '['; + const separator = indent ? `\n${baseIndent}${indent}` : ''; + for (let i = 0; i < arr.length; i++) { + const key = arr[i]; + output += `${i > 0 ? ',' : ''}${separator}${serialize(key, indent, baseIndent + indent)}`; + } + return `${output}${indent ? `\n${baseIndent}` : ''}]`; +} +function serializeObject(obj, indent, baseIndent) { + let output = '{'; + const separator = indent ? `\n${baseIndent}${indent}` : ''; + const entries = Object.entries(obj); + for (let i = 0; i < entries.length; i++) { + const [key, value] = entries[i]; + const stringKey = makeLegalIdentifier(key) === key ? key : stringify(key); + output += `${i > 0 ? ',' : ''}${separator}${stringKey}:${indent ? ' ' : ''}${serialize(value, indent, baseIndent + indent)}`; + } + return `${output}${indent ? `\n${baseIndent}` : ''}}`; +} +function serialize(obj, indent, baseIndent) { + if (typeof obj === 'object' && obj !== null) { + if (Array.isArray(obj)) + return serializeArray(obj, indent, baseIndent); + if (obj instanceof Date) + return `new Date(${obj.getTime()})`; + if (obj instanceof RegExp) + return obj.toString(); + return serializeObject(obj, indent, baseIndent); + } + if (typeof obj === 'number') { + if (obj === Infinity) + return 'Infinity'; + if (obj === -Infinity) + return '-Infinity'; + if (obj === 0) + return 1 / obj === Infinity ? '0' : '-0'; + if (obj !== obj) + return 'NaN'; // eslint-disable-line no-self-compare + } + if (typeof obj === 'symbol') { + const key = Symbol.keyFor(obj); + // eslint-disable-next-line no-undefined + if (key !== undefined) + return `Symbol.for(${stringify(key)})`; + } + if (typeof obj === 'bigint') + return `${obj}n`; + return stringify(obj); +} +// isWellFormed exists from Node.js 20 +const hasStringIsWellFormed = 'isWellFormed' in String.prototype; +function isWellFormedString(input) { + // @ts-expect-error String::isWellFormed exists from ES2024. tsconfig lib is set to ES6 + if (hasStringIsWellFormed) + return input.isWellFormed(); + // https://github.com/tc39/proposal-is-usv-string/blob/main/README.md#algorithm + return !/\p{Surrogate}/u.test(input); +} +// Matches the ECMAScript `IdentifierName` grammar, which (unlike a binding +// identifier) also accepts reserved words such as `switch`/`await`. Such names +// can be re-exported with the `export { _x as switch }` form, valid since ES2015. +const identifierNameRE = /^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u; +const dataToEsm = function dataToEsm(data, options = {}) { + var _a, _b; + const t = options.compact ? '' : 'indent' in options ? options.indent : '\t'; + const _ = options.compact ? '' : ' '; + const n = options.compact ? '' : '\n'; + const declarationType = options.preferConst ? 'const' : 'var'; + if (options.namedExports === false || + typeof data !== 'object' || + Array.isArray(data) || + data instanceof Date || + data instanceof RegExp || + data === null) { + const code = serialize(data, options.compact ? null : t, ''); + const magic = _ || (/^[{[\-\/]/.test(code) ? '' : ' '); // eslint-disable-line no-useless-escape + return `export default${magic}${code};`; + } + let maxUnderbarPrefixLength = 0; + for (const key of Object.keys(data)) { + const underbarPrefixLength = (_b = (_a = /^(_+)/.exec(key)) === null || _a === void 0 ? void 0 : _a[0].length) !== null && _b !== void 0 ? _b : 0; + if (underbarPrefixLength > maxUnderbarPrefixLength) { + maxUnderbarPrefixLength = underbarPrefixLength; + } + } + const arbitraryNamePrefix = `${'_'.repeat(maxUnderbarPrefixLength + 1)}arbitrary`; + let namedExportCode = ''; + const defaultExportRows = []; + const arbitraryNameExportRows = []; + for (const [key, value] of Object.entries(data)) { + if (key === makeLegalIdentifier(key)) { + if (options.objectShorthand) + defaultExportRows.push(key); + else + defaultExportRows.push(`${key}:${_}${key}`); + namedExportCode += `export ${declarationType} ${key}${_}=${_}${serialize(value, options.compact ? null : t, '')};${n}`; + } + else { + defaultExportRows.push(`${stringify(key)}:${_}${serialize(value, options.compact ? null : t, '')}`); + // A `default` key is exposed only through the default export object: a + // `... as default` re-export would clash with the trailing `export default` + // and produce a duplicate default export (a SyntaxError). + if (key !== 'default') { + // A valid `IdentifierName` that is not a legal binding identifier (a + // reserved word or global, e.g. `switch`, `await`) is re-exported with the + // unquoted `export { _x as switch }` form, valid since ES2015. Any other + // key needs the quoted arbitrary-namespace form (ES2022+), which remains + // opt-in via `includeArbitraryNames`. + const isIdentifierName = identifierNameRE.test(key); + if (isIdentifierName || (options.includeArbitraryNames && isWellFormedString(key))) { + const variableName = `${arbitraryNamePrefix}${arbitraryNameExportRows.length}`; + namedExportCode += `${declarationType} ${variableName}${_}=${_}${serialize(value, options.compact ? null : t, '')};${n}`; + arbitraryNameExportRows.push(`${variableName} as ${isIdentifierName ? key : JSON.stringify(key)}`); + } + } + } + } + const arbitraryExportCode = arbitraryNameExportRows.length > 0 + ? `export${_}{${n}${t}${arbitraryNameExportRows.join(`,${n}${t}`)}${n}};${n}` + : ''; + const defaultExportCode = `export default${_}{${n}${t}${defaultExportRows.join(`,${n}${t}`)}${n}};${n}`; + return `${namedExportCode}${arbitraryExportCode}${defaultExportCode}`; +}; + +function exactRegex(str, flags) { + return new RegExp(`^${combineMultipleStrings(str)}$`, flags); +} +function prefixRegex(str, flags) { + return new RegExp(`^${combineMultipleStrings(str)}`, flags); +} +function suffixRegex(str, flags) { + return new RegExp(`${combineMultipleStrings(str)}$`, flags); +} +const escapeRegexRE = /[-/\\^$*+?.()|[\]{}]/g; +function escapeRegex(str) { + return str.replace(escapeRegexRE, '\\$&'); +} +function combineMultipleStrings(str) { + if (Array.isArray(str)) { + const escapeStr = str.map(escapeRegex).join('|'); + if (escapeStr && str.length > 1) { + return `(?:${escapeStr})`; + } + return escapeStr; + } + return escapeRegex(str); +} + +// TODO: remove this in next major +var index = { + addExtension, + attachScopes, + createFilter, + dataToEsm, + exactRegex, + extractAssignedNames, + makeLegalIdentifier, + normalizePath, + prefixRegex, + suffixRegex +}; + +exports.addExtension = addExtension; +exports.attachScopes = attachScopes; +exports.createFilter = createFilter; +exports.dataToEsm = dataToEsm; +exports.default = index; +exports.exactRegex = exactRegex; +exports.extractAssignedNames = extractAssignedNames; +exports.makeLegalIdentifier = makeLegalIdentifier; +exports.normalizePath = normalizePath; +exports.prefixRegex = prefixRegex; +exports.suffixRegex = suffixRegex; +module.exports = Object.assign(exports.default, exports); +//# sourceMappingURL=index.js.map diff --git a/tools/ui/node_modules/@rollup/pluginutils/dist/es/index.js b/tools/ui/node_modules/@rollup/pluginutils/dist/es/index.js new file mode 100644 index 0000000000000000000000000000000000000000..38996b0549709db2203e70db32bd4c3ac7e4db88 --- /dev/null +++ b/tools/ui/node_modules/@rollup/pluginutils/dist/es/index.js @@ -0,0 +1,407 @@ +import { extname, win32, posix, isAbsolute, resolve } from 'path'; +import { walk } from 'estree-walker'; +import pm from 'picomatch'; + +const addExtension = function addExtension(filename, ext = '.js') { + let result = `${filename}`; + if (!extname(filename)) + result += ext; + return result; +}; + +const extractors = { + ArrayPattern(names, param) { + for (const element of param.elements) { + if (element) + extractors[element.type](names, element); + } + }, + AssignmentPattern(names, param) { + extractors[param.left.type](names, param.left); + }, + Identifier(names, param) { + names.push(param.name); + }, + MemberExpression() { }, + ObjectPattern(names, param) { + for (const prop of param.properties) { + // @ts-ignore Typescript reports that this is not a valid type + if (prop.type === 'RestElement') { + extractors.RestElement(names, prop); + } + else { + extractors[prop.value.type](names, prop.value); + } + } + }, + RestElement(names, param) { + extractors[param.argument.type](names, param.argument); + } +}; +const extractAssignedNames = function extractAssignedNames(param) { + const names = []; + extractors[param.type](names, param); + return names; +}; + +const blockDeclarations = { + const: true, + let: true +}; +class Scope { + constructor(options = {}) { + this.parent = options.parent; + this.isBlockScope = !!options.block; + this.declarations = Object.create(null); + if (options.params) { + options.params.forEach((param) => { + extractAssignedNames(param).forEach((name) => { + this.declarations[name] = true; + }); + }); + } + } + addDeclaration(node, isBlockDeclaration, isVar) { + if (!isBlockDeclaration && this.isBlockScope) { + // it's a `var` or function node, and this + // is a block scope, so we need to go up + this.parent.addDeclaration(node, isBlockDeclaration, isVar); + } + else if (node.id) { + extractAssignedNames(node.id).forEach((name) => { + this.declarations[name] = true; + }); + } + } + contains(name) { + return this.declarations[name] || (this.parent ? this.parent.contains(name) : false); + } +} +const attachScopes = function attachScopes(ast, propertyName = 'scope') { + let scope = new Scope(); + walk(ast, { + enter(n, parent) { + const node = n; + // function foo () {...} + // class Foo {...} + if (/(?:Function|Class)Declaration/.test(node.type)) { + scope.addDeclaration(node, false, false); + } + // var foo = 1 + if (node.type === 'VariableDeclaration') { + const { kind } = node; + const isBlockDeclaration = blockDeclarations[kind]; + node.declarations.forEach((declaration) => { + scope.addDeclaration(declaration, isBlockDeclaration, true); + }); + } + let newScope; + // create new function scope + if (node.type.includes('Function')) { + const func = node; + newScope = new Scope({ + parent: scope, + block: false, + params: func.params + }); + // named function expressions - the name is considered + // part of the function's scope + if (func.type === 'FunctionExpression' && func.id) { + newScope.addDeclaration(func, false, false); + } + } + // create new for scope + if (/For(?:In|Of)?Statement/.test(node.type)) { + newScope = new Scope({ + parent: scope, + block: true + }); + } + // create new block scope + if (node.type === 'BlockStatement' && !parent.type.includes('Function')) { + newScope = new Scope({ + parent: scope, + block: true + }); + } + // catch clause has its own block scope + if (node.type === 'CatchClause') { + newScope = new Scope({ + parent: scope, + params: node.param ? [node.param] : [], + block: true + }); + } + if (newScope) { + Object.defineProperty(node, propertyName, { + value: newScope, + configurable: true + }); + scope = newScope; + } + }, + leave(n) { + const node = n; + if (node[propertyName]) + scope = scope.parent; + } + }); + return scope; +}; + +// Helper since Typescript can't detect readonly arrays with Array.isArray +function isArray(arg) { + return Array.isArray(arg); +} +function ensureArray(thing) { + if (isArray(thing)) + return thing; + if (thing == null) + return []; + return [thing]; +} + +const normalizePathRegExp = new RegExp(`\\${win32.sep}`, 'g'); +const normalizePath = function normalizePath(filename) { + return filename.replace(normalizePathRegExp, posix.sep); +}; + +function getMatcherString(id, resolutionBase) { + if (resolutionBase === false || isAbsolute(id) || id.startsWith('**')) { + return normalizePath(id); + } + // resolve('') is valid and will default to process.cwd() + const basePath = normalizePath(resolve(resolutionBase || '')) + // escape all possible (posix + win) path characters that might interfere with regex + .replace(/[-^$*+?.()|[\]{}]/g, '\\$&'); + // Note that we use posix.join because: + // 1. the basePath has been normalized to use / + // 2. the incoming glob (id) matcher, also uses / + // otherwise Node will force backslash (\) on windows + return posix.join(basePath, normalizePath(id)); +} +const createFilter = function createFilter(include, exclude, options) { + const resolutionBase = options && options.resolve; + const getMatcher = (id) => id instanceof RegExp + ? id + : { + test: (what) => { + // this refactor is a tad overly verbose but makes for easy debugging + const pattern = getMatcherString(id, resolutionBase); + const fn = pm(pattern, { dot: true }); + const result = fn(what); + return result; + } + }; + const includeMatchers = ensureArray(include).map(getMatcher); + const excludeMatchers = ensureArray(exclude).map(getMatcher); + if (!includeMatchers.length && !excludeMatchers.length) + return (id) => typeof id === 'string' && !id.includes('\0'); + return function result(id) { + if (typeof id !== 'string') + return false; + if (id.includes('\0')) + return false; + const pathId = normalizePath(id); + for (let i = 0; i < excludeMatchers.length; ++i) { + const matcher = excludeMatchers[i]; + if (matcher instanceof RegExp) { + matcher.lastIndex = 0; + } + if (matcher.test(pathId)) + return false; + } + for (let i = 0; i < includeMatchers.length; ++i) { + const matcher = includeMatchers[i]; + if (matcher instanceof RegExp) { + matcher.lastIndex = 0; + } + if (matcher.test(pathId)) + return true; + } + return !includeMatchers.length; + }; +}; + +const reservedWords = 'break case class catch const continue debugger default delete do else export extends finally for function if import in instanceof let new return super switch this throw try typeof var void while with yield enum await implements package protected static interface private public'; +const builtins = 'arguments Infinity NaN undefined null true false eval uneval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Symbol Error EvalError InternalError RangeError ReferenceError SyntaxError TypeError URIError Number Math Date String RegExp Array Int8Array Uint8Array Uint8ClampedArray Int16Array Uint16Array Int32Array Uint32Array Float32Array Float64Array Map Set WeakMap WeakSet SIMD ArrayBuffer DataView JSON Promise Generator GeneratorFunction Reflect Proxy Intl'; +const forbiddenIdentifiers = new Set(`${reservedWords} ${builtins}`.split(' ')); +forbiddenIdentifiers.add(''); +const makeLegalIdentifier = function makeLegalIdentifier(str) { + let identifier = str + .replace(/-(\w)/g, (_, letter) => letter.toUpperCase()) + .replace(/[^$_a-zA-Z0-9]/g, '_'); + if (/\d/.test(identifier[0]) || forbiddenIdentifiers.has(identifier)) { + identifier = `_${identifier}`; + } + return identifier || '_'; +}; + +function stringify(obj) { + return (JSON.stringify(obj) || 'undefined').replace(/[\u2028\u2029]/g, (char) => `\\u${`000${char.charCodeAt(0).toString(16)}`.slice(-4)}`); +} +function serializeArray(arr, indent, baseIndent) { + let output = '['; + const separator = indent ? `\n${baseIndent}${indent}` : ''; + for (let i = 0; i < arr.length; i++) { + const key = arr[i]; + output += `${i > 0 ? ',' : ''}${separator}${serialize(key, indent, baseIndent + indent)}`; + } + return `${output}${indent ? `\n${baseIndent}` : ''}]`; +} +function serializeObject(obj, indent, baseIndent) { + let output = '{'; + const separator = indent ? `\n${baseIndent}${indent}` : ''; + const entries = Object.entries(obj); + for (let i = 0; i < entries.length; i++) { + const [key, value] = entries[i]; + const stringKey = makeLegalIdentifier(key) === key ? key : stringify(key); + output += `${i > 0 ? ',' : ''}${separator}${stringKey}:${indent ? ' ' : ''}${serialize(value, indent, baseIndent + indent)}`; + } + return `${output}${indent ? `\n${baseIndent}` : ''}}`; +} +function serialize(obj, indent, baseIndent) { + if (typeof obj === 'object' && obj !== null) { + if (Array.isArray(obj)) + return serializeArray(obj, indent, baseIndent); + if (obj instanceof Date) + return `new Date(${obj.getTime()})`; + if (obj instanceof RegExp) + return obj.toString(); + return serializeObject(obj, indent, baseIndent); + } + if (typeof obj === 'number') { + if (obj === Infinity) + return 'Infinity'; + if (obj === -Infinity) + return '-Infinity'; + if (obj === 0) + return 1 / obj === Infinity ? '0' : '-0'; + if (obj !== obj) + return 'NaN'; // eslint-disable-line no-self-compare + } + if (typeof obj === 'symbol') { + const key = Symbol.keyFor(obj); + // eslint-disable-next-line no-undefined + if (key !== undefined) + return `Symbol.for(${stringify(key)})`; + } + if (typeof obj === 'bigint') + return `${obj}n`; + return stringify(obj); +} +// isWellFormed exists from Node.js 20 +const hasStringIsWellFormed = 'isWellFormed' in String.prototype; +function isWellFormedString(input) { + // @ts-expect-error String::isWellFormed exists from ES2024. tsconfig lib is set to ES6 + if (hasStringIsWellFormed) + return input.isWellFormed(); + // https://github.com/tc39/proposal-is-usv-string/blob/main/README.md#algorithm + return !/\p{Surrogate}/u.test(input); +} +// Matches the ECMAScript `IdentifierName` grammar, which (unlike a binding +// identifier) also accepts reserved words such as `switch`/`await`. Such names +// can be re-exported with the `export { _x as switch }` form, valid since ES2015. +const identifierNameRE = /^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u; +const dataToEsm = function dataToEsm(data, options = {}) { + var _a, _b; + const t = options.compact ? '' : 'indent' in options ? options.indent : '\t'; + const _ = options.compact ? '' : ' '; + const n = options.compact ? '' : '\n'; + const declarationType = options.preferConst ? 'const' : 'var'; + if (options.namedExports === false || + typeof data !== 'object' || + Array.isArray(data) || + data instanceof Date || + data instanceof RegExp || + data === null) { + const code = serialize(data, options.compact ? null : t, ''); + const magic = _ || (/^[{[\-\/]/.test(code) ? '' : ' '); // eslint-disable-line no-useless-escape + return `export default${magic}${code};`; + } + let maxUnderbarPrefixLength = 0; + for (const key of Object.keys(data)) { + const underbarPrefixLength = (_b = (_a = /^(_+)/.exec(key)) === null || _a === void 0 ? void 0 : _a[0].length) !== null && _b !== void 0 ? _b : 0; + if (underbarPrefixLength > maxUnderbarPrefixLength) { + maxUnderbarPrefixLength = underbarPrefixLength; + } + } + const arbitraryNamePrefix = `${'_'.repeat(maxUnderbarPrefixLength + 1)}arbitrary`; + let namedExportCode = ''; + const defaultExportRows = []; + const arbitraryNameExportRows = []; + for (const [key, value] of Object.entries(data)) { + if (key === makeLegalIdentifier(key)) { + if (options.objectShorthand) + defaultExportRows.push(key); + else + defaultExportRows.push(`${key}:${_}${key}`); + namedExportCode += `export ${declarationType} ${key}${_}=${_}${serialize(value, options.compact ? null : t, '')};${n}`; + } + else { + defaultExportRows.push(`${stringify(key)}:${_}${serialize(value, options.compact ? null : t, '')}`); + // A `default` key is exposed only through the default export object: a + // `... as default` re-export would clash with the trailing `export default` + // and produce a duplicate default export (a SyntaxError). + if (key !== 'default') { + // A valid `IdentifierName` that is not a legal binding identifier (a + // reserved word or global, e.g. `switch`, `await`) is re-exported with the + // unquoted `export { _x as switch }` form, valid since ES2015. Any other + // key needs the quoted arbitrary-namespace form (ES2022+), which remains + // opt-in via `includeArbitraryNames`. + const isIdentifierName = identifierNameRE.test(key); + if (isIdentifierName || (options.includeArbitraryNames && isWellFormedString(key))) { + const variableName = `${arbitraryNamePrefix}${arbitraryNameExportRows.length}`; + namedExportCode += `${declarationType} ${variableName}${_}=${_}${serialize(value, options.compact ? null : t, '')};${n}`; + arbitraryNameExportRows.push(`${variableName} as ${isIdentifierName ? key : JSON.stringify(key)}`); + } + } + } + } + const arbitraryExportCode = arbitraryNameExportRows.length > 0 + ? `export${_}{${n}${t}${arbitraryNameExportRows.join(`,${n}${t}`)}${n}};${n}` + : ''; + const defaultExportCode = `export default${_}{${n}${t}${defaultExportRows.join(`,${n}${t}`)}${n}};${n}`; + return `${namedExportCode}${arbitraryExportCode}${defaultExportCode}`; +}; + +function exactRegex(str, flags) { + return new RegExp(`^${combineMultipleStrings(str)}$`, flags); +} +function prefixRegex(str, flags) { + return new RegExp(`^${combineMultipleStrings(str)}`, flags); +} +function suffixRegex(str, flags) { + return new RegExp(`${combineMultipleStrings(str)}$`, flags); +} +const escapeRegexRE = /[-/\\^$*+?.()|[\]{}]/g; +function escapeRegex(str) { + return str.replace(escapeRegexRE, '\\$&'); +} +function combineMultipleStrings(str) { + if (Array.isArray(str)) { + const escapeStr = str.map(escapeRegex).join('|'); + if (escapeStr && str.length > 1) { + return `(?:${escapeStr})`; + } + return escapeStr; + } + return escapeRegex(str); +} + +// TODO: remove this in next major +var index = { + addExtension, + attachScopes, + createFilter, + dataToEsm, + exactRegex, + extractAssignedNames, + makeLegalIdentifier, + normalizePath, + prefixRegex, + suffixRegex +}; + +export { addExtension, attachScopes, createFilter, dataToEsm, index as default, exactRegex, extractAssignedNames, makeLegalIdentifier, normalizePath, prefixRegex, suffixRegex }; +//# sourceMappingURL=index.js.map diff --git a/tools/ui/node_modules/@rollup/pluginutils/dist/es/package.json b/tools/ui/node_modules/@rollup/pluginutils/dist/es/package.json new file mode 100644 index 0000000000000000000000000000000000000000..7c34deb5837d8d5e168b54f95f7872b2c50eca13 --- /dev/null +++ b/tools/ui/node_modules/@rollup/pluginutils/dist/es/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/CHANGELOG.md b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..20e8c7eac55ecaa0e7795fac89c2eb5a087b3208 --- /dev/null +++ b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/CHANGELOG.md @@ -0,0 +1,92 @@ +# changelog + +## 2.0.2 + +* Internal tidying up (change test runner, convert to JS) + +## 2.0.1 + +* Robustify `this.remove()`, pass current index to walker functions ([#18](https://github.com/Rich-Harris/estree-walker/pull/18)) + +## 2.0.0 + +* Add an `asyncWalk` export ([#20](https://github.com/Rich-Harris/estree-walker/pull/20)) +* Internal rewrite + +## 1.0.1 + +* Relax node type to `BaseNode` ([#17](https://github.com/Rich-Harris/estree-walker/pull/17)) + +## 1.0.0 + +* Don't cache child keys + +## 0.9.0 + +* Add `this.remove()` method + +## 0.8.1 + +* Fix pkg.files + +## 0.8.0 + +* Adopt `estree` types + +## 0.7.0 + +* Add a `this.replace(node)` method + +## 0.6.1 + +* Only traverse nodes that exist and have a type ([#9](https://github.com/Rich-Harris/estree-walker/pull/9)) +* Only cache keys for nodes with a type ([#8](https://github.com/Rich-Harris/estree-walker/pull/8)) + +## 0.6.0 + +* Fix walker context type +* Update deps, remove unncessary Bublé transformation + +## 0.5.2 + +* Add types to package + +## 0.5.1 + +* Prevent context corruption when `walk()` is called during a walk + +## 0.5.0 + +* Export `childKeys`, for manually fixing in case of malformed ASTs + +## 0.4.0 + +* Add TypeScript typings ([#3](https://github.com/Rich-Harris/estree-walker/pull/3)) + +## 0.3.1 + +* Include `pkg.repository` ([#2](https://github.com/Rich-Harris/estree-walker/pull/2)) + +## 0.3.0 + +* More predictable ordering + +## 0.2.1 + +* Keep `context` shape + +## 0.2.0 + +* Add ES6 build + +## 0.1.3 + +* npm snafu + +## 0.1.2 + +* Pass current prop and index to `enter`/`leave` callbacks + +## 0.1.1 + +* First release diff --git a/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/LICENSE b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..63b62098eea9e1031659a145b1c6d752486ec0fe --- /dev/null +++ b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) 2015-20 [these people](https://github.com/Rich-Harris/estree-walker/graphs/contributors) + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/README.md b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/README.md new file mode 100644 index 0000000000000000000000000000000000000000..d877af36d496b85410e4e965b0c9be5218b5a3e5 --- /dev/null +++ b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/README.md @@ -0,0 +1,48 @@ +# estree-walker + +Simple utility for walking an [ESTree](https://github.com/estree/estree)-compliant AST, such as one generated by [acorn](https://github.com/marijnh/acorn). + + +## Installation + +```bash +npm i estree-walker +``` + + +## Usage + +```js +var walk = require( 'estree-walker' ).walk; +var acorn = require( 'acorn' ); + +ast = acorn.parse( sourceCode, options ); // https://github.com/acornjs/acorn + +walk( ast, { + enter: function ( node, parent, prop, index ) { + // some code happens + }, + leave: function ( node, parent, prop, index ) { + // some code happens + } +}); +``` + +Inside the `enter` function, calling `this.skip()` will prevent the node's children being walked, or the `leave` function (which is optional) being called. + +Call `this.replace(new_node)` in either `enter` or `leave` to replace the current node with a new one. + +Call `this.remove()` in either `enter` or `leave` to remove the current node. + +## Why not use estraverse? + +The ESTree spec is evolving to accommodate ES6/7. I've had a couple of experiences where [estraverse](https://github.com/estools/estraverse) was unable to handle an AST generated by recent versions of acorn, because it hard-codes visitor keys. + +estree-walker, by contrast, simply enumerates a node's properties to find child nodes (and child lists of nodes), and is therefore resistant to spec changes. It's also much smaller. (The performance, if you're wondering, is basically identical.) + +None of which should be taken as criticism of estraverse, which has more features and has been battle-tested in many more situations, and for which I'm very grateful. + + +## License + +MIT diff --git a/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/dist/esm/estree-walker.js b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/dist/esm/estree-walker.js new file mode 100644 index 0000000000000000000000000000000000000000..a0beeeb42c3f011315763cbc7a496399e0fba8d6 --- /dev/null +++ b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/dist/esm/estree-walker.js @@ -0,0 +1,333 @@ +// @ts-check +/** @typedef { import('estree').BaseNode} BaseNode */ + +/** @typedef {{ + skip: () => void; + remove: () => void; + replace: (node: BaseNode) => void; +}} WalkerContext */ + +class WalkerBase { + constructor() { + /** @type {boolean} */ + this.should_skip = false; + + /** @type {boolean} */ + this.should_remove = false; + + /** @type {BaseNode | null} */ + this.replacement = null; + + /** @type {WalkerContext} */ + this.context = { + skip: () => (this.should_skip = true), + remove: () => (this.should_remove = true), + replace: (node) => (this.replacement = node) + }; + } + + /** + * + * @param {any} parent + * @param {string} prop + * @param {number} index + * @param {BaseNode} node + */ + replace(parent, prop, index, node) { + if (parent) { + if (index !== null) { + parent[prop][index] = node; + } else { + parent[prop] = node; + } + } + } + + /** + * + * @param {any} parent + * @param {string} prop + * @param {number} index + */ + remove(parent, prop, index) { + if (parent) { + if (index !== null) { + parent[prop].splice(index, 1); + } else { + delete parent[prop]; + } + } + } +} + +// @ts-check + +/** @typedef { import('estree').BaseNode} BaseNode */ +/** @typedef { import('./walker.js').WalkerContext} WalkerContext */ + +/** @typedef {( + * this: WalkerContext, + * node: BaseNode, + * parent: BaseNode, + * key: string, + * index: number + * ) => void} SyncHandler */ + +class SyncWalker extends WalkerBase { + /** + * + * @param {SyncHandler} enter + * @param {SyncHandler} leave + */ + constructor(enter, leave) { + super(); + + /** @type {SyncHandler} */ + this.enter = enter; + + /** @type {SyncHandler} */ + this.leave = leave; + } + + /** + * + * @param {BaseNode} node + * @param {BaseNode} parent + * @param {string} [prop] + * @param {number} [index] + * @returns {BaseNode} + */ + visit(node, parent, prop, index) { + if (node) { + if (this.enter) { + const _should_skip = this.should_skip; + const _should_remove = this.should_remove; + const _replacement = this.replacement; + this.should_skip = false; + this.should_remove = false; + this.replacement = null; + + this.enter.call(this.context, node, parent, prop, index); + + if (this.replacement) { + node = this.replacement; + this.replace(parent, prop, index, node); + } + + if (this.should_remove) { + this.remove(parent, prop, index); + } + + const skipped = this.should_skip; + const removed = this.should_remove; + + this.should_skip = _should_skip; + this.should_remove = _should_remove; + this.replacement = _replacement; + + if (skipped) return node; + if (removed) return null; + } + + for (const key in node) { + const value = node[key]; + + if (typeof value !== "object") { + continue; + } else if (Array.isArray(value)) { + for (let i = 0; i < value.length; i += 1) { + if (value[i] !== null && typeof value[i].type === 'string') { + if (!this.visit(value[i], node, key, i)) { + // removed + i--; + } + } + } + } else if (value !== null && typeof value.type === "string") { + this.visit(value, node, key, null); + } + } + + if (this.leave) { + const _replacement = this.replacement; + const _should_remove = this.should_remove; + this.replacement = null; + this.should_remove = false; + + this.leave.call(this.context, node, parent, prop, index); + + if (this.replacement) { + node = this.replacement; + this.replace(parent, prop, index, node); + } + + if (this.should_remove) { + this.remove(parent, prop, index); + } + + const removed = this.should_remove; + + this.replacement = _replacement; + this.should_remove = _should_remove; + + if (removed) return null; + } + } + + return node; + } +} + +// @ts-check + +/** @typedef { import('estree').BaseNode} BaseNode */ +/** @typedef { import('./walker').WalkerContext} WalkerContext */ + +/** @typedef {( + * this: WalkerContext, + * node: BaseNode, + * parent: BaseNode, + * key: string, + * index: number + * ) => Promise} AsyncHandler */ + +class AsyncWalker extends WalkerBase { + /** + * + * @param {AsyncHandler} enter + * @param {AsyncHandler} leave + */ + constructor(enter, leave) { + super(); + + /** @type {AsyncHandler} */ + this.enter = enter; + + /** @type {AsyncHandler} */ + this.leave = leave; + } + + /** + * + * @param {BaseNode} node + * @param {BaseNode} parent + * @param {string} [prop] + * @param {number} [index] + * @returns {Promise} + */ + async visit(node, parent, prop, index) { + if (node) { + if (this.enter) { + const _should_skip = this.should_skip; + const _should_remove = this.should_remove; + const _replacement = this.replacement; + this.should_skip = false; + this.should_remove = false; + this.replacement = null; + + await this.enter.call(this.context, node, parent, prop, index); + + if (this.replacement) { + node = this.replacement; + this.replace(parent, prop, index, node); + } + + if (this.should_remove) { + this.remove(parent, prop, index); + } + + const skipped = this.should_skip; + const removed = this.should_remove; + + this.should_skip = _should_skip; + this.should_remove = _should_remove; + this.replacement = _replacement; + + if (skipped) return node; + if (removed) return null; + } + + for (const key in node) { + const value = node[key]; + + if (typeof value !== "object") { + continue; + } else if (Array.isArray(value)) { + for (let i = 0; i < value.length; i += 1) { + if (value[i] !== null && typeof value[i].type === 'string') { + if (!(await this.visit(value[i], node, key, i))) { + // removed + i--; + } + } + } + } else if (value !== null && typeof value.type === "string") { + await this.visit(value, node, key, null); + } + } + + if (this.leave) { + const _replacement = this.replacement; + const _should_remove = this.should_remove; + this.replacement = null; + this.should_remove = false; + + await this.leave.call(this.context, node, parent, prop, index); + + if (this.replacement) { + node = this.replacement; + this.replace(parent, prop, index, node); + } + + if (this.should_remove) { + this.remove(parent, prop, index); + } + + const removed = this.should_remove; + + this.replacement = _replacement; + this.should_remove = _should_remove; + + if (removed) return null; + } + } + + return node; + } +} + +// @ts-check + +/** @typedef { import('estree').BaseNode} BaseNode */ +/** @typedef { import('./sync.js').SyncHandler} SyncHandler */ +/** @typedef { import('./async.js').AsyncHandler} AsyncHandler */ + +/** + * + * @param {BaseNode} ast + * @param {{ + * enter?: SyncHandler + * leave?: SyncHandler + * }} walker + * @returns {BaseNode} + */ +function walk(ast, { enter, leave }) { + const instance = new SyncWalker(enter, leave); + return instance.visit(ast, null); +} + +/** + * + * @param {BaseNode} ast + * @param {{ + * enter?: AsyncHandler + * leave?: AsyncHandler + * }} walker + * @returns {Promise} + */ +async function asyncWalk(ast, { enter, leave }) { + const instance = new AsyncWalker(enter, leave); + return await instance.visit(ast, null); +} + +export { asyncWalk, walk }; diff --git a/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/dist/esm/package.json b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/dist/esm/package.json new file mode 100644 index 0000000000000000000000000000000000000000..7c34deb5837d8d5e168b54f95f7872b2c50eca13 --- /dev/null +++ b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/dist/esm/package.json @@ -0,0 +1 @@ +{"type":"module"} \ No newline at end of file diff --git a/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/dist/umd/estree-walker.js b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/dist/umd/estree-walker.js new file mode 100644 index 0000000000000000000000000000000000000000..46fed0f99acea53b0123d0bf552684f07936da8c --- /dev/null +++ b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/dist/umd/estree-walker.js @@ -0,0 +1,344 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (global = global || self, factory(global.estreeWalker = {})); +}(this, (function (exports) { 'use strict'; + + // @ts-check + /** @typedef { import('estree').BaseNode} BaseNode */ + + /** @typedef {{ + skip: () => void; + remove: () => void; + replace: (node: BaseNode) => void; + }} WalkerContext */ + + class WalkerBase { + constructor() { + /** @type {boolean} */ + this.should_skip = false; + + /** @type {boolean} */ + this.should_remove = false; + + /** @type {BaseNode | null} */ + this.replacement = null; + + /** @type {WalkerContext} */ + this.context = { + skip: () => (this.should_skip = true), + remove: () => (this.should_remove = true), + replace: (node) => (this.replacement = node) + }; + } + + /** + * + * @param {any} parent + * @param {string} prop + * @param {number} index + * @param {BaseNode} node + */ + replace(parent, prop, index, node) { + if (parent) { + if (index !== null) { + parent[prop][index] = node; + } else { + parent[prop] = node; + } + } + } + + /** + * + * @param {any} parent + * @param {string} prop + * @param {number} index + */ + remove(parent, prop, index) { + if (parent) { + if (index !== null) { + parent[prop].splice(index, 1); + } else { + delete parent[prop]; + } + } + } + } + + // @ts-check + + /** @typedef { import('estree').BaseNode} BaseNode */ + /** @typedef { import('./walker.js').WalkerContext} WalkerContext */ + + /** @typedef {( + * this: WalkerContext, + * node: BaseNode, + * parent: BaseNode, + * key: string, + * index: number + * ) => void} SyncHandler */ + + class SyncWalker extends WalkerBase { + /** + * + * @param {SyncHandler} enter + * @param {SyncHandler} leave + */ + constructor(enter, leave) { + super(); + + /** @type {SyncHandler} */ + this.enter = enter; + + /** @type {SyncHandler} */ + this.leave = leave; + } + + /** + * + * @param {BaseNode} node + * @param {BaseNode} parent + * @param {string} [prop] + * @param {number} [index] + * @returns {BaseNode} + */ + visit(node, parent, prop, index) { + if (node) { + if (this.enter) { + const _should_skip = this.should_skip; + const _should_remove = this.should_remove; + const _replacement = this.replacement; + this.should_skip = false; + this.should_remove = false; + this.replacement = null; + + this.enter.call(this.context, node, parent, prop, index); + + if (this.replacement) { + node = this.replacement; + this.replace(parent, prop, index, node); + } + + if (this.should_remove) { + this.remove(parent, prop, index); + } + + const skipped = this.should_skip; + const removed = this.should_remove; + + this.should_skip = _should_skip; + this.should_remove = _should_remove; + this.replacement = _replacement; + + if (skipped) return node; + if (removed) return null; + } + + for (const key in node) { + const value = node[key]; + + if (typeof value !== "object") { + continue; + } else if (Array.isArray(value)) { + for (let i = 0; i < value.length; i += 1) { + if (value[i] !== null && typeof value[i].type === 'string') { + if (!this.visit(value[i], node, key, i)) { + // removed + i--; + } + } + } + } else if (value !== null && typeof value.type === "string") { + this.visit(value, node, key, null); + } + } + + if (this.leave) { + const _replacement = this.replacement; + const _should_remove = this.should_remove; + this.replacement = null; + this.should_remove = false; + + this.leave.call(this.context, node, parent, prop, index); + + if (this.replacement) { + node = this.replacement; + this.replace(parent, prop, index, node); + } + + if (this.should_remove) { + this.remove(parent, prop, index); + } + + const removed = this.should_remove; + + this.replacement = _replacement; + this.should_remove = _should_remove; + + if (removed) return null; + } + } + + return node; + } + } + + // @ts-check + + /** @typedef { import('estree').BaseNode} BaseNode */ + /** @typedef { import('./walker').WalkerContext} WalkerContext */ + + /** @typedef {( + * this: WalkerContext, + * node: BaseNode, + * parent: BaseNode, + * key: string, + * index: number + * ) => Promise} AsyncHandler */ + + class AsyncWalker extends WalkerBase { + /** + * + * @param {AsyncHandler} enter + * @param {AsyncHandler} leave + */ + constructor(enter, leave) { + super(); + + /** @type {AsyncHandler} */ + this.enter = enter; + + /** @type {AsyncHandler} */ + this.leave = leave; + } + + /** + * + * @param {BaseNode} node + * @param {BaseNode} parent + * @param {string} [prop] + * @param {number} [index] + * @returns {Promise} + */ + async visit(node, parent, prop, index) { + if (node) { + if (this.enter) { + const _should_skip = this.should_skip; + const _should_remove = this.should_remove; + const _replacement = this.replacement; + this.should_skip = false; + this.should_remove = false; + this.replacement = null; + + await this.enter.call(this.context, node, parent, prop, index); + + if (this.replacement) { + node = this.replacement; + this.replace(parent, prop, index, node); + } + + if (this.should_remove) { + this.remove(parent, prop, index); + } + + const skipped = this.should_skip; + const removed = this.should_remove; + + this.should_skip = _should_skip; + this.should_remove = _should_remove; + this.replacement = _replacement; + + if (skipped) return node; + if (removed) return null; + } + + for (const key in node) { + const value = node[key]; + + if (typeof value !== "object") { + continue; + } else if (Array.isArray(value)) { + for (let i = 0; i < value.length; i += 1) { + if (value[i] !== null && typeof value[i].type === 'string') { + if (!(await this.visit(value[i], node, key, i))) { + // removed + i--; + } + } + } + } else if (value !== null && typeof value.type === "string") { + await this.visit(value, node, key, null); + } + } + + if (this.leave) { + const _replacement = this.replacement; + const _should_remove = this.should_remove; + this.replacement = null; + this.should_remove = false; + + await this.leave.call(this.context, node, parent, prop, index); + + if (this.replacement) { + node = this.replacement; + this.replace(parent, prop, index, node); + } + + if (this.should_remove) { + this.remove(parent, prop, index); + } + + const removed = this.should_remove; + + this.replacement = _replacement; + this.should_remove = _should_remove; + + if (removed) return null; + } + } + + return node; + } + } + + // @ts-check + + /** @typedef { import('estree').BaseNode} BaseNode */ + /** @typedef { import('./sync.js').SyncHandler} SyncHandler */ + /** @typedef { import('./async.js').AsyncHandler} AsyncHandler */ + + /** + * + * @param {BaseNode} ast + * @param {{ + * enter?: SyncHandler + * leave?: SyncHandler + * }} walker + * @returns {BaseNode} + */ + function walk(ast, { enter, leave }) { + const instance = new SyncWalker(enter, leave); + return instance.visit(ast, null); + } + + /** + * + * @param {BaseNode} ast + * @param {{ + * enter?: AsyncHandler + * leave?: AsyncHandler + * }} walker + * @returns {Promise} + */ + async function asyncWalk(ast, { enter, leave }) { + const instance = new AsyncWalker(enter, leave); + return await instance.visit(ast, null); + } + + exports.asyncWalk = asyncWalk; + exports.walk = walk; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); diff --git a/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/package.json b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/package.json new file mode 100644 index 0000000000000000000000000000000000000000..f646eb546b5f4293b7e5d28f3eddcf598ed4a887 --- /dev/null +++ b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/package.json @@ -0,0 +1,37 @@ +{ + "name": "estree-walker", + "description": "Traverse an ESTree-compliant AST", + "version": "2.0.2", + "private": false, + "author": "Rich Harris", + "license": "MIT", + "repository": { + "type": "git", + "url": "https://github.com/Rich-Harris/estree-walker" + }, + "type": "commonjs", + "main": "./dist/umd/estree-walker.js", + "module": "./dist/esm/estree-walker.js", + "exports": { + "require": "./dist/umd/estree-walker.js", + "import": "./dist/esm/estree-walker.js" + }, + "types": "types/index.d.ts", + "scripts": { + "prepublishOnly": "npm run build && npm test", + "build": "tsc && rollup -c", + "test": "uvu test" + }, + "devDependencies": { + "@types/estree": "0.0.42", + "rollup": "^2.10.9", + "typescript": "^3.7.5", + "uvu": "^0.5.1" + }, + "files": [ + "src", + "dist", + "types", + "README.md" + ] +} diff --git a/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/src/async.js b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/src/async.js new file mode 100644 index 0000000000000000000000000000000000000000..54276b51f188f9f59a66f2fd358eea08d6fab774 --- /dev/null +++ b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/src/async.js @@ -0,0 +1,118 @@ +// @ts-check +import { WalkerBase } from './walker.js'; + +/** @typedef { import('estree').BaseNode} BaseNode */ +/** @typedef { import('./walker').WalkerContext} WalkerContext */ + +/** @typedef {( + * this: WalkerContext, + * node: BaseNode, + * parent: BaseNode, + * key: string, + * index: number + * ) => Promise} AsyncHandler */ + +export class AsyncWalker extends WalkerBase { + /** + * + * @param {AsyncHandler} enter + * @param {AsyncHandler} leave + */ + constructor(enter, leave) { + super(); + + /** @type {AsyncHandler} */ + this.enter = enter; + + /** @type {AsyncHandler} */ + this.leave = leave; + } + + /** + * + * @param {BaseNode} node + * @param {BaseNode} parent + * @param {string} [prop] + * @param {number} [index] + * @returns {Promise} + */ + async visit(node, parent, prop, index) { + if (node) { + if (this.enter) { + const _should_skip = this.should_skip; + const _should_remove = this.should_remove; + const _replacement = this.replacement; + this.should_skip = false; + this.should_remove = false; + this.replacement = null; + + await this.enter.call(this.context, node, parent, prop, index); + + if (this.replacement) { + node = this.replacement; + this.replace(parent, prop, index, node); + } + + if (this.should_remove) { + this.remove(parent, prop, index); + } + + const skipped = this.should_skip; + const removed = this.should_remove; + + this.should_skip = _should_skip; + this.should_remove = _should_remove; + this.replacement = _replacement; + + if (skipped) return node; + if (removed) return null; + } + + for (const key in node) { + const value = node[key]; + + if (typeof value !== "object") { + continue; + } else if (Array.isArray(value)) { + for (let i = 0; i < value.length; i += 1) { + if (value[i] !== null && typeof value[i].type === 'string') { + if (!(await this.visit(value[i], node, key, i))) { + // removed + i--; + } + } + } + } else if (value !== null && typeof value.type === "string") { + await this.visit(value, node, key, null); + } + } + + if (this.leave) { + const _replacement = this.replacement; + const _should_remove = this.should_remove; + this.replacement = null; + this.should_remove = false; + + await this.leave.call(this.context, node, parent, prop, index); + + if (this.replacement) { + node = this.replacement; + this.replace(parent, prop, index, node); + } + + if (this.should_remove) { + this.remove(parent, prop, index); + } + + const removed = this.should_remove; + + this.replacement = _replacement; + this.should_remove = _should_remove; + + if (removed) return null; + } + } + + return node; + } +} diff --git a/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/src/index.js b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/src/index.js new file mode 100644 index 0000000000000000000000000000000000000000..dcf4c7205cf3d8e602d168063ab100d26052c838 --- /dev/null +++ b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/src/index.js @@ -0,0 +1,35 @@ +// @ts-check +import { SyncWalker } from './sync.js'; +import { AsyncWalker } from './async.js'; + +/** @typedef { import('estree').BaseNode} BaseNode */ +/** @typedef { import('./sync.js').SyncHandler} SyncHandler */ +/** @typedef { import('./async.js').AsyncHandler} AsyncHandler */ + +/** + * + * @param {BaseNode} ast + * @param {{ + * enter?: SyncHandler + * leave?: SyncHandler + * }} walker + * @returns {BaseNode} + */ +export function walk(ast, { enter, leave }) { + const instance = new SyncWalker(enter, leave); + return instance.visit(ast, null); +} + +/** + * + * @param {BaseNode} ast + * @param {{ + * enter?: AsyncHandler + * leave?: AsyncHandler + * }} walker + * @returns {Promise} + */ +export async function asyncWalk(ast, { enter, leave }) { + const instance = new AsyncWalker(enter, leave); + return await instance.visit(ast, null); +} diff --git a/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/src/package.json b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/src/package.json new file mode 100644 index 0000000000000000000000000000000000000000..1632c2c4df6894a83b70fa949fb32a9d4881adf9 --- /dev/null +++ b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/src/package.json @@ -0,0 +1 @@ +{"type": "module"} \ No newline at end of file diff --git a/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/src/sync.js b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/src/sync.js new file mode 100644 index 0000000000000000000000000000000000000000..b3cea40aeb336f28c187278973361692159f85c1 --- /dev/null +++ b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/src/sync.js @@ -0,0 +1,118 @@ +// @ts-check +import { WalkerBase } from './walker.js'; + +/** @typedef { import('estree').BaseNode} BaseNode */ +/** @typedef { import('./walker.js').WalkerContext} WalkerContext */ + +/** @typedef {( + * this: WalkerContext, + * node: BaseNode, + * parent: BaseNode, + * key: string, + * index: number + * ) => void} SyncHandler */ + +export class SyncWalker extends WalkerBase { + /** + * + * @param {SyncHandler} enter + * @param {SyncHandler} leave + */ + constructor(enter, leave) { + super(); + + /** @type {SyncHandler} */ + this.enter = enter; + + /** @type {SyncHandler} */ + this.leave = leave; + } + + /** + * + * @param {BaseNode} node + * @param {BaseNode} parent + * @param {string} [prop] + * @param {number} [index] + * @returns {BaseNode} + */ + visit(node, parent, prop, index) { + if (node) { + if (this.enter) { + const _should_skip = this.should_skip; + const _should_remove = this.should_remove; + const _replacement = this.replacement; + this.should_skip = false; + this.should_remove = false; + this.replacement = null; + + this.enter.call(this.context, node, parent, prop, index); + + if (this.replacement) { + node = this.replacement; + this.replace(parent, prop, index, node); + } + + if (this.should_remove) { + this.remove(parent, prop, index); + } + + const skipped = this.should_skip; + const removed = this.should_remove; + + this.should_skip = _should_skip; + this.should_remove = _should_remove; + this.replacement = _replacement; + + if (skipped) return node; + if (removed) return null; + } + + for (const key in node) { + const value = node[key]; + + if (typeof value !== "object") { + continue; + } else if (Array.isArray(value)) { + for (let i = 0; i < value.length; i += 1) { + if (value[i] !== null && typeof value[i].type === 'string') { + if (!this.visit(value[i], node, key, i)) { + // removed + i--; + } + } + } + } else if (value !== null && typeof value.type === "string") { + this.visit(value, node, key, null); + } + } + + if (this.leave) { + const _replacement = this.replacement; + const _should_remove = this.should_remove; + this.replacement = null; + this.should_remove = false; + + this.leave.call(this.context, node, parent, prop, index); + + if (this.replacement) { + node = this.replacement; + this.replace(parent, prop, index, node); + } + + if (this.should_remove) { + this.remove(parent, prop, index); + } + + const removed = this.should_remove; + + this.replacement = _replacement; + this.should_remove = _should_remove; + + if (removed) return null; + } + } + + return node; + } +} diff --git a/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/src/walker.js b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/src/walker.js new file mode 100644 index 0000000000000000000000000000000000000000..3555d88a4e2da094242f30a1aae1f6d319dc0c40 --- /dev/null +++ b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/src/walker.js @@ -0,0 +1,61 @@ +// @ts-check +/** @typedef { import('estree').BaseNode} BaseNode */ + +/** @typedef {{ + skip: () => void; + remove: () => void; + replace: (node: BaseNode) => void; +}} WalkerContext */ + +export class WalkerBase { + constructor() { + /** @type {boolean} */ + this.should_skip = false; + + /** @type {boolean} */ + this.should_remove = false; + + /** @type {BaseNode | null} */ + this.replacement = null; + + /** @type {WalkerContext} */ + this.context = { + skip: () => (this.should_skip = true), + remove: () => (this.should_remove = true), + replace: (node) => (this.replacement = node) + }; + } + + /** + * + * @param {any} parent + * @param {string} prop + * @param {number} index + * @param {BaseNode} node + */ + replace(parent, prop, index, node) { + if (parent) { + if (index !== null) { + parent[prop][index] = node; + } else { + parent[prop] = node; + } + } + } + + /** + * + * @param {any} parent + * @param {string} prop + * @param {number} index + */ + remove(parent, prop, index) { + if (parent) { + if (index !== null) { + parent[prop].splice(index, 1); + } else { + delete parent[prop]; + } + } + } +} diff --git a/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/types/async.d.ts b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/types/async.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c85bfdc5f933eb1543e6170e78e1d0f7ea218082 --- /dev/null +++ b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/types/async.d.ts @@ -0,0 +1,53 @@ +/** @typedef { import('estree').BaseNode} BaseNode */ +/** @typedef { import('./walker').WalkerContext} WalkerContext */ +/** @typedef {( + * this: WalkerContext, + * node: BaseNode, + * parent: BaseNode, + * key: string, + * index: number + * ) => Promise} AsyncHandler */ +export class AsyncWalker extends WalkerBase { + /** + * + * @param {AsyncHandler} enter + * @param {AsyncHandler} leave + */ + constructor(enter: (this: { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; + }, node: import("estree").BaseNode, parent: import("estree").BaseNode, key: string, index: number) => Promise, leave: (this: { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; + }, node: import("estree").BaseNode, parent: import("estree").BaseNode, key: string, index: number) => Promise); + /** @type {AsyncHandler} */ + enter: AsyncHandler; + /** @type {AsyncHandler} */ + leave: AsyncHandler; + /** + * + * @param {BaseNode} node + * @param {BaseNode} parent + * @param {string} [prop] + * @param {number} [index] + * @returns {Promise} + */ + visit(node: import("estree").BaseNode, parent: import("estree").BaseNode, prop?: string, index?: number): Promise; + should_skip: any; + should_remove: any; + replacement: any; +} +export type BaseNode = import("estree").BaseNode; +export type WalkerContext = { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; +}; +export type AsyncHandler = (this: { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; +}, node: import("estree").BaseNode, parent: import("estree").BaseNode, key: string, index: number) => Promise; +import { WalkerBase } from "./walker.js"; diff --git a/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/types/index.d.ts b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/types/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..dfc3277d538dc0d7f45fa5134705e6acfbe2fc0e --- /dev/null +++ b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/types/index.d.ts @@ -0,0 +1,56 @@ +/** @typedef { import('estree').BaseNode} BaseNode */ +/** @typedef { import('./sync.js').SyncHandler} SyncHandler */ +/** @typedef { import('./async.js').AsyncHandler} AsyncHandler */ +/** + * + * @param {BaseNode} ast + * @param {{ + * enter?: SyncHandler + * leave?: SyncHandler + * }} walker + * @returns {BaseNode} + */ +export function walk(ast: import("estree").BaseNode, { enter, leave }: { + enter?: (this: { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; + }, node: import("estree").BaseNode, parent: import("estree").BaseNode, key: string, index: number) => void; + leave?: (this: { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; + }, node: import("estree").BaseNode, parent: import("estree").BaseNode, key: string, index: number) => void; +}): import("estree").BaseNode; +/** + * + * @param {BaseNode} ast + * @param {{ + * enter?: AsyncHandler + * leave?: AsyncHandler + * }} walker + * @returns {Promise} + */ +export function asyncWalk(ast: import("estree").BaseNode, { enter, leave }: { + enter?: (this: { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; + }, node: import("estree").BaseNode, parent: import("estree").BaseNode, key: string, index: number) => Promise; + leave?: (this: { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; + }, node: import("estree").BaseNode, parent: import("estree").BaseNode, key: string, index: number) => Promise; +}): Promise; +export type BaseNode = import("estree").BaseNode; +export type SyncHandler = (this: { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; +}, node: import("estree").BaseNode, parent: import("estree").BaseNode, key: string, index: number) => void; +export type AsyncHandler = (this: { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; +}, node: import("estree").BaseNode, parent: import("estree").BaseNode, key: string, index: number) => Promise; diff --git a/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/types/sync.d.ts b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/types/sync.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..e9e4cc1ecc60a5696e703a29a338baa2d60ac91b --- /dev/null +++ b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/types/sync.d.ts @@ -0,0 +1,53 @@ +/** @typedef { import('estree').BaseNode} BaseNode */ +/** @typedef { import('./walker.js').WalkerContext} WalkerContext */ +/** @typedef {( + * this: WalkerContext, + * node: BaseNode, + * parent: BaseNode, + * key: string, + * index: number + * ) => void} SyncHandler */ +export class SyncWalker extends WalkerBase { + /** + * + * @param {SyncHandler} enter + * @param {SyncHandler} leave + */ + constructor(enter: (this: { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; + }, node: import("estree").BaseNode, parent: import("estree").BaseNode, key: string, index: number) => void, leave: (this: { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; + }, node: import("estree").BaseNode, parent: import("estree").BaseNode, key: string, index: number) => void); + /** @type {SyncHandler} */ + enter: SyncHandler; + /** @type {SyncHandler} */ + leave: SyncHandler; + /** + * + * @param {BaseNode} node + * @param {BaseNode} parent + * @param {string} [prop] + * @param {number} [index] + * @returns {BaseNode} + */ + visit(node: import("estree").BaseNode, parent: import("estree").BaseNode, prop?: string, index?: number): import("estree").BaseNode; + should_skip: any; + should_remove: any; + replacement: any; +} +export type BaseNode = import("estree").BaseNode; +export type WalkerContext = { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; +}; +export type SyncHandler = (this: { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; +}, node: import("estree").BaseNode, parent: import("estree").BaseNode, key: string, index: number) => void; +import { WalkerBase } from "./walker.js"; diff --git a/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/types/tsconfig.tsbuildinfo b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/types/tsconfig.tsbuildinfo new file mode 100644 index 0000000000000000000000000000000000000000..799022fa1d0df25128f25a7a715887d5e582e74e --- /dev/null +++ b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/types/tsconfig.tsbuildinfo @@ -0,0 +1,345 @@ +{ + "program": { + "fileInfos": { + "../node_modules/typescript/lib/lib.es5.d.ts": { + "version": "fc43680ad3a1a4ec8c7b8d908af1ec9ddff87845346de5f02c735c9171fa98ea", + "signature": "fc43680ad3a1a4ec8c7b8d908af1ec9ddff87845346de5f02c735c9171fa98ea" + }, + "../node_modules/typescript/lib/lib.es2015.d.ts": { + "version": "7994d44005046d1413ea31d046577cdda33b8b2470f30281fd9c8b3c99fe2d96", + "signature": "7994d44005046d1413ea31d046577cdda33b8b2470f30281fd9c8b3c99fe2d96" + }, + "../node_modules/typescript/lib/lib.es2016.d.ts": { + "version": "5f217838d25704474d9ef93774f04164889169ca31475fe423a9de6758f058d1", + "signature": "5f217838d25704474d9ef93774f04164889169ca31475fe423a9de6758f058d1" + }, + "../node_modules/typescript/lib/lib.es2017.d.ts": { + "version": "459097c7bdd88fc5731367e56591e4f465f2c9de81a35427a7bd473165c34743", + "signature": "459097c7bdd88fc5731367e56591e4f465f2c9de81a35427a7bd473165c34743" + }, + "../node_modules/typescript/lib/lib.dom.d.ts": { + "version": "d93de5e8a7275cb9d47481410e13b3b1debb997e216490954b5d106e37e086de", + "signature": "d93de5e8a7275cb9d47481410e13b3b1debb997e216490954b5d106e37e086de" + }, + "../node_modules/typescript/lib/lib.dom.iterable.d.ts": { + "version": "8329c3401aa8708426c7760f14219170f69a2cb77e4519758cec6f5027270faf", + "signature": "8329c3401aa8708426c7760f14219170f69a2cb77e4519758cec6f5027270faf" + }, + "../node_modules/typescript/lib/lib.webworker.importscripts.d.ts": { + "version": "fe4e59403e34c7ff747abe4ff6abbc7718229556d7c1a5b93473fb53156c913b", + "signature": "fe4e59403e34c7ff747abe4ff6abbc7718229556d7c1a5b93473fb53156c913b" + }, + "../node_modules/typescript/lib/lib.scripthost.d.ts": { + "version": "b9faa17292f17d2ad75e34fac77dd63a6403af1dba02d39cd0cbb9ffdf3de8b9", + "signature": "b9faa17292f17d2ad75e34fac77dd63a6403af1dba02d39cd0cbb9ffdf3de8b9" + }, + "../node_modules/typescript/lib/lib.es2015.core.d.ts": { + "version": "734ddc145e147fbcd55f07d034f50ccff1086f5a880107665ec326fb368876f6", + "signature": "734ddc145e147fbcd55f07d034f50ccff1086f5a880107665ec326fb368876f6" + }, + "../node_modules/typescript/lib/lib.es2015.collection.d.ts": { + "version": "4a0862a21f4700de873db3b916f70e41570e2f558da77d2087c9490f5a0615d8", + "signature": "4a0862a21f4700de873db3b916f70e41570e2f558da77d2087c9490f5a0615d8" + }, + "../node_modules/typescript/lib/lib.es2015.generator.d.ts": { + "version": "765e0e9c9d74cf4d031ca8b0bdb269a853e7d81eda6354c8510218d03db12122", + "signature": "765e0e9c9d74cf4d031ca8b0bdb269a853e7d81eda6354c8510218d03db12122" + }, + "../node_modules/typescript/lib/lib.es2015.iterable.d.ts": { + "version": "285958e7699f1babd76d595830207f18d719662a0c30fac7baca7df7162a9210", + "signature": "285958e7699f1babd76d595830207f18d719662a0c30fac7baca7df7162a9210" + }, + "../node_modules/typescript/lib/lib.es2015.promise.d.ts": { + "version": "d4deaafbb18680e3143e8b471acd650ed6f72a408a33137f0a0dd104fbe7f8ca", + "signature": "d4deaafbb18680e3143e8b471acd650ed6f72a408a33137f0a0dd104fbe7f8ca" + }, + "../node_modules/typescript/lib/lib.es2015.proxy.d.ts": { + "version": "5e72f949a89717db444e3bd9433468890068bb21a5638d8ab15a1359e05e54fe", + "signature": "5e72f949a89717db444e3bd9433468890068bb21a5638d8ab15a1359e05e54fe" + }, + "../node_modules/typescript/lib/lib.es2015.reflect.d.ts": { + "version": "f5b242136ae9bfb1cc99a5971cccc44e99947ae6b5ef6fd8aa54b5ade553b976", + "signature": "f5b242136ae9bfb1cc99a5971cccc44e99947ae6b5ef6fd8aa54b5ade553b976" + }, + "../node_modules/typescript/lib/lib.es2015.symbol.d.ts": { + "version": "9ae2860252d6b5f16e2026d8a2c2069db7b2a3295e98b6031d01337b96437230", + "signature": "9ae2860252d6b5f16e2026d8a2c2069db7b2a3295e98b6031d01337b96437230" + }, + "../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts": { + "version": "3e0a459888f32b42138d5a39f706ff2d55d500ab1031e0988b5568b0f67c2303", + "signature": "3e0a459888f32b42138d5a39f706ff2d55d500ab1031e0988b5568b0f67c2303" + }, + "../node_modules/typescript/lib/lib.es2016.array.include.d.ts": { + "version": "3f96f1e570aedbd97bf818c246727151e873125d0512e4ae904330286c721bc0", + "signature": "3f96f1e570aedbd97bf818c246727151e873125d0512e4ae904330286c721bc0" + }, + "../node_modules/typescript/lib/lib.es2017.object.d.ts": { + "version": "c2d60b2e558d44384e4704b00e6b3d154334721a911f094d3133c35f0917b408", + "signature": "c2d60b2e558d44384e4704b00e6b3d154334721a911f094d3133c35f0917b408" + }, + "../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts": { + "version": "b8667586a618c5cf64523d4e500ae39e781428abfb28f3de441fc66b56144b6f", + "signature": "b8667586a618c5cf64523d4e500ae39e781428abfb28f3de441fc66b56144b6f" + }, + "../node_modules/typescript/lib/lib.es2017.string.d.ts": { + "version": "21df2e0059f14dcb4c3a0e125859f6b6ff01332ee24b0065a741d121250bc71c", + "signature": "21df2e0059f14dcb4c3a0e125859f6b6ff01332ee24b0065a741d121250bc71c" + }, + "../node_modules/typescript/lib/lib.es2017.intl.d.ts": { + "version": "c1759cb171c7619af0d2234f2f8fb2a871ee88e956e2ed91bb61778e41f272c6", + "signature": "c1759cb171c7619af0d2234f2f8fb2a871ee88e956e2ed91bb61778e41f272c6" + }, + "../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts": { + "version": "28569d59e07d4378cb3d54979c4c60f9f06305c9bb6999ffe6cab758957adc46", + "signature": "28569d59e07d4378cb3d54979c4c60f9f06305c9bb6999ffe6cab758957adc46" + }, + "../node_modules/typescript/lib/lib.es2017.full.d.ts": { + "version": "873c09f1c309389742d98b7b67419a8e0a5fa6f10ce59fd5149ecd31a2818594", + "signature": "873c09f1c309389742d98b7b67419a8e0a5fa6f10ce59fd5149ecd31a2818594" + }, + "../node_modules/@types/estree/index.d.ts": { + "version": "c2efad8a2f2d7fb931ff15c7959fb45340e74684cd665ddf0cbf9b3977be1644", + "signature": "c2efad8a2f2d7fb931ff15c7959fb45340e74684cd665ddf0cbf9b3977be1644" + }, + "../src/walker.js": { + "version": "4cc9d0e334d83a4cebeeac502de37a1aeeb953f6d4145a886d9eecea1f2142a7", + "signature": "075872468ccc19c83b03fd717fc9305b5f8ec09592210cf60279cb13eca2bd70" + }, + "../src/async.js": { + "version": "904efd145090ac40c3c98f29cc928332898a62ab642dd5921db2ae249bfe014a", + "signature": "da428f781d6dc6dfd4f4afd0dd5f25a780897dc8b57e5b30462491b7d08f32c0" + }, + "../src/sync.js": { + "version": "85bb22b85042f0a3717d8fac2fc8f62af16894652be34d1e08eb3e63785535f5", + "signature": "5b131a727db18c956611a5e33d08217df96d0f2e0f26d98b804d1ec2407e59ae" + }, + "../src/index.js": { + "version": "99128f4c6cb79cb1e3abf3f2ba96faedd2b820aab4fd7f743aab0b8d710a73af", + "signature": "c52be5c79280bfcfcf359c084c6f2f70f405b0ad14dde96b6703dbc5ef2261f5" + } + }, + "options": { + "allowJs": true, + "target": 4, + "module": 99, + "types": [ + "estree" + ], + "declaration": true, + "declarationDir": "./", + "emitDeclarationOnly": true, + "outDir": "./", + "newLine": 1, + "noImplicitAny": true, + "noImplicitThis": true, + "incremental": true, + "configFilePath": "../tsconfig.json" + }, + "referencedMap": { + "../src/walker.js": [ + "../node_modules/@types/estree/index.d.ts" + ], + "../src/async.js": [ + "../src/walker.js", + "../node_modules/@types/estree/index.d.ts" + ], + "../src/sync.js": [ + "../src/walker.js", + "../node_modules/@types/estree/index.d.ts" + ], + "../src/index.js": [ + "../src/sync.js", + "../src/async.js", + "../node_modules/@types/estree/index.d.ts" + ] + }, + "exportedModulesMap": { + "../src/walker.js": [ + "../node_modules/@types/estree/index.d.ts" + ], + "../src/async.js": [ + "../node_modules/@types/estree/index.d.ts" + ], + "../src/sync.js": [ + "../node_modules/@types/estree/index.d.ts" + ], + "../src/index.js": [ + "../node_modules/@types/estree/index.d.ts" + ] + }, + "semanticDiagnosticsPerFile": [ + "../node_modules/typescript/lib/lib.es5.d.ts", + "../node_modules/typescript/lib/lib.es2015.d.ts", + "../node_modules/typescript/lib/lib.es2016.d.ts", + "../node_modules/typescript/lib/lib.es2017.d.ts", + "../node_modules/typescript/lib/lib.dom.d.ts", + "../node_modules/typescript/lib/lib.dom.iterable.d.ts", + "../node_modules/typescript/lib/lib.webworker.importscripts.d.ts", + "../node_modules/typescript/lib/lib.scripthost.d.ts", + "../node_modules/typescript/lib/lib.es2015.core.d.ts", + "../node_modules/typescript/lib/lib.es2015.collection.d.ts", + "../node_modules/typescript/lib/lib.es2015.generator.d.ts", + "../node_modules/typescript/lib/lib.es2015.iterable.d.ts", + "../node_modules/typescript/lib/lib.es2015.promise.d.ts", + "../node_modules/typescript/lib/lib.es2015.proxy.d.ts", + "../node_modules/typescript/lib/lib.es2015.reflect.d.ts", + "../node_modules/typescript/lib/lib.es2015.symbol.d.ts", + "../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts", + "../node_modules/typescript/lib/lib.es2016.array.include.d.ts", + "../node_modules/typescript/lib/lib.es2017.object.d.ts", + "../node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts", + "../node_modules/typescript/lib/lib.es2017.string.d.ts", + "../node_modules/typescript/lib/lib.es2017.intl.d.ts", + "../node_modules/typescript/lib/lib.es2017.typedarrays.d.ts", + "../node_modules/typescript/lib/lib.es2017.full.d.ts", + "../node_modules/@types/estree/index.d.ts", + "../src/walker.js", + [ + "../src/async.js", + [ + { + "file": "../src/async.js", + "start": 864, + "length": 12, + "messageText": "'_should_skip' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.", + "category": 1, + "code": 7022 + }, + { + "file": "../src/async.js", + "start": 907, + "length": 14, + "messageText": "'_should_remove' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.", + "category": 1, + "code": 7022 + }, + { + "file": "../src/async.js", + "start": 954, + "length": 12, + "messageText": "'_replacement' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.", + "category": 1, + "code": 7022 + }, + { + "file": "../src/async.js", + "start": 991, + "length": 24, + "messageText": "'should_skip' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.", + "category": 1, + "code": 7022 + }, + { + "file": "../src/async.js", + "start": 1021, + "length": 26, + "messageText": "'should_remove' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.", + "category": 1, + "code": 7022 + }, + { + "file": "../src/async.js", + "start": 1053, + "length": 23, + "messageText": "'replacement' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.", + "category": 1, + "code": 7022 + }, + { + "file": "../src/async.js", + "start": 1643, + "length": 9, + "code": 7053, + "category": 1, + "messageText": { + "messageText": "Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'BaseNode'.", + "category": 1, + "code": 7053, + "next": [ + { + "messageText": "No index signature with a parameter of type 'string' was found on type 'BaseNode'.", + "category": 1, + "code": 7054 + } + ] + } + } + ] + ], + [ + "../src/sync.js", + [ + { + "file": "../src/sync.js", + "start": 837, + "length": 12, + "messageText": "'_should_skip' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.", + "category": 1, + "code": 7022 + }, + { + "file": "../src/sync.js", + "start": 880, + "length": 14, + "messageText": "'_should_remove' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.", + "category": 1, + "code": 7022 + }, + { + "file": "../src/sync.js", + "start": 927, + "length": 12, + "messageText": "'_replacement' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.", + "category": 1, + "code": 7022 + }, + { + "file": "../src/sync.js", + "start": 964, + "length": 24, + "messageText": "'should_skip' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.", + "category": 1, + "code": 7022 + }, + { + "file": "../src/sync.js", + "start": 994, + "length": 26, + "messageText": "'should_remove' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.", + "category": 1, + "code": 7022 + }, + { + "file": "../src/sync.js", + "start": 1026, + "length": 23, + "messageText": "'replacement' implicitly has type 'any' because it does not have a type annotation and is referenced directly or indirectly in its own initializer.", + "category": 1, + "code": 7022 + }, + { + "file": "../src/sync.js", + "start": 1610, + "length": 9, + "code": 7053, + "category": 1, + "messageText": { + "messageText": "Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'BaseNode'.", + "category": 1, + "code": 7053, + "next": [ + { + "messageText": "No index signature with a parameter of type 'string' was found on type 'BaseNode'.", + "category": 1, + "code": 7054 + } + ] + } + } + ] + ], + "../src/index.js" + ] + }, + "version": "3.7.5" +} \ No newline at end of file diff --git a/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/types/walker.d.ts b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/types/walker.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..49d84416c6c014d45aa2ce59b36bf4750a6154a5 --- /dev/null +++ b/tools/ui/node_modules/@rollup/pluginutils/node_modules/estree-walker/types/walker.d.ts @@ -0,0 +1,37 @@ +/** @typedef { import('estree').BaseNode} BaseNode */ +/** @typedef {{ + skip: () => void; + remove: () => void; + replace: (node: BaseNode) => void; +}} WalkerContext */ +export class WalkerBase { + /** @type {boolean} */ + should_skip: boolean; + /** @type {boolean} */ + should_remove: boolean; + /** @type {BaseNode | null} */ + replacement: BaseNode | null; + /** @type {WalkerContext} */ + context: WalkerContext; + /** + * + * @param {any} parent + * @param {string} prop + * @param {number} index + * @param {BaseNode} node + */ + replace(parent: any, prop: string, index: number, node: import("estree").BaseNode): void; + /** + * + * @param {any} parent + * @param {string} prop + * @param {number} index + */ + remove(parent: any, prop: string, index: number): void; +} +export type BaseNode = import("estree").BaseNode; +export type WalkerContext = { + skip: () => void; + remove: () => void; + replace: (node: import("estree").BaseNode) => void; +}; diff --git a/tools/ui/node_modules/@rollup/pluginutils/package.json b/tools/ui/node_modules/@rollup/pluginutils/package.json new file mode 100644 index 0000000000000000000000000000000000000000..5b795ddc2617f8b62eb93fb663dbeb6726cd6bd2 --- /dev/null +++ b/tools/ui/node_modules/@rollup/pluginutils/package.json @@ -0,0 +1,84 @@ +{ + "name": "@rollup/pluginutils", + "version": "5.4.0", + "publishConfig": { + "access": "public" + }, + "description": "A set of utility functions commonly used by Rollup plugins", + "license": "MIT", + "repository": { + "url": "rollup/plugins", + "directory": "packages/pluginutils" + }, + "author": "Rich Harris ", + "homepage": "https://github.com/rollup/plugins/tree/master/packages/pluginutils#readme", + "bugs": { + "url": "https://github.com/rollup/plugins/issues" + }, + "main": "./dist/cjs/index.js", + "module": "./dist/es/index.js", + "type": "commonjs", + "exports": { + "types": "./types/index.d.ts", + "import": "./dist/es/index.js", + "default": "./dist/cjs/index.js" + }, + "engines": { + "node": ">=14.0.0" + }, + "files": [ + "dist", + "!dist/**/*.map", + "types", + "README.md", + "LICENSE" + ], + "keywords": [ + "rollup", + "plugin", + "utils" + ], + "peerDependencies": { + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" + }, + "peerDependenciesMeta": { + "rollup": { + "optional": true + } + }, + "dependencies": { + "@types/estree": "^1.0.0", + "estree-walker": "^2.0.2", + "picomatch": "^4.0.2" + }, + "devDependencies": { + "@rollup/plugin-commonjs": "^23.0.0", + "@rollup/plugin-node-resolve": "^15.0.0", + "@rollup/plugin-typescript": "^9.0.1", + "@types/node": "^14.18.30", + "@types/picomatch": "^2.3.0", + "acorn": "^8.8.0", + "rollup": "^4.0.0-24", + "typescript": "^4.8.3" + }, + "types": "./types/index.d.ts", + "nyc": { + "extension": [ + ".js", + ".ts" + ] + }, + "scripts": { + "build": "rollup -c", + "ci:coverage": "nyc pnpm test && nyc report --reporter=text-lcov > coverage.lcov", + "ci:lint": "pnpm build && pnpm lint", + "ci:lint:commits": "commitlint --from=${CIRCLE_BRANCH} --to=${CIRCLE_SHA1}", + "ci:test": "pnpm test -- --reporter=verbose", + "prebuild": "del-cli dist", + "prerelease": "pnpm build", + "pretest": "pnpm build --sourcemap", + "release": "pnpm --workspace-root package:release $(pwd)", + "test": "vitest --config ../../.config/vitest.config.mts run", + "test:ts": "tsc --noEmit" + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/@rollup/pluginutils/types/index.d.ts b/tools/ui/node_modules/@rollup/pluginutils/types/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..ed3c8fdb32116043cf537a2316c42b86ade1f6d7 --- /dev/null +++ b/tools/ui/node_modules/@rollup/pluginutils/types/index.d.ts @@ -0,0 +1,125 @@ +import type { BaseNode } from 'estree'; + +export interface AttachedScope { + parent?: AttachedScope; + isBlockScope: boolean; + declarations: { [key: string]: boolean }; + addDeclaration(node: BaseNode, isBlockDeclaration: boolean, isVar: boolean): void; + contains(name: string): boolean; +} + +export interface DataToEsmOptions { + compact?: boolean; + /** + * @desc When this option is set, dataToEsm will generate a named export for keys that + * are not a valid identifier, by leveraging the "Arbitrary Module Namespace Identifier + * Names" feature. See: https://github.com/tc39/ecma262/pull/2154 + */ + includeArbitraryNames?: boolean; + indent?: string; + namedExports?: boolean; + objectShorthand?: boolean; + preferConst?: boolean; +} + +/** + * A valid `picomatch` glob pattern, or array of patterns. + */ +export type FilterPattern = ReadonlyArray | string | RegExp | null; + +/** + * Adds an extension to a module ID if one does not exist. + */ +export function addExtension(filename: string, ext?: string): string; + +/** + * Attaches `Scope` objects to the relevant nodes of an AST. + * Each `Scope` object has a `scope.contains(name)` method that returns `true` + * if a given name is defined in the current scope or a parent scope. + */ +export function attachScopes(ast: BaseNode, propertyName?: string): AttachedScope; + +/** + * Constructs a filter function which can be used to determine whether or not + * certain modules should be operated upon. + * @param include If `include` is omitted or has zero length, filter will return `true` by default. + * @param exclude ID must not match any of the `exclude` patterns. + * @param options Optionally resolves the patterns against a directory other than `process.cwd()`. + * If a `string` is specified, then the value will be used as the base directory. + * Relative paths will be resolved against `process.cwd()` first. + * If `false`, then the patterns will not be resolved against any directory. + * This can be useful if you want to create a filter for virtual module names. + */ +export function createFilter( + include?: FilterPattern, + exclude?: FilterPattern, + options?: { resolve?: string | false | null } +): (id: string | unknown) => boolean; + +/** + * Transforms objects into tree-shakable ES Module imports. + * @param data An object to transform into an ES module. + */ +export function dataToEsm(data: unknown, options?: DataToEsmOptions): string; + +/** + * Constructs a RegExp that matches the exact string specified. + * @param str the string to match. + * @param flags flags for the RegExp. + */ +export function exactRegex(str: string | string[], flags?: string): RegExp; + +/** + * Extracts the names of all assignment targets based upon specified patterns. + * @param param An `acorn` AST Node. + */ +export function extractAssignedNames(param: BaseNode): string[]; + +/** + * Constructs a bundle-safe identifier from a `string`. + */ +export function makeLegalIdentifier(str: string): string; + +/** + * Converts path separators to forward slash. + */ +export function normalizePath(filename: string): string; + +/** + * Constructs a RegExp that matches a value that has the specified prefix. + * @param str the string to match. + * @param flags flags for the RegExp. + */ +export function prefixRegex(str: string | string[], flags?: string): RegExp; + +/** + * Constructs a RegExp that matches a value that has the specified suffix. + * @param str the string to match. + * @param flags flags for the RegExp. + */ +export function suffixRegex(str: string | string[], flags?: string): RegExp; + +export type AddExtension = typeof addExtension; +export type AttachScopes = typeof attachScopes; +export type CreateFilter = typeof createFilter; +export type ExactRegex = typeof exactRegex; +export type ExtractAssignedNames = typeof extractAssignedNames; +export type MakeLegalIdentifier = typeof makeLegalIdentifier; +export type NormalizePath = typeof normalizePath; +export type DataToEsm = typeof dataToEsm; +export type PrefixRegex = typeof prefixRegex; +export type SuffixRegex = typeof suffixRegex; + +declare const defaultExport: { + addExtension: AddExtension; + attachScopes: AttachScopes; + createFilter: CreateFilter; + dataToEsm: DataToEsm; + exactRegex: ExactRegex; + extractAssignedNames: ExtractAssignedNames; + makeLegalIdentifier: MakeLegalIdentifier; + normalizePath: NormalizePath; + prefixRegex: PrefixRegex; + suffixRegex: SuffixRegex; +}; +export default defaultExport; diff --git a/tools/ui/node_modules/@rollup/rollup-linux-x64-gnu/README.md b/tools/ui/node_modules/@rollup/rollup-linux-x64-gnu/README.md new file mode 100644 index 0000000000000000000000000000000000000000..cabe280f1a216371e99f7833ba24429ce931dd77 --- /dev/null +++ b/tools/ui/node_modules/@rollup/rollup-linux-x64-gnu/README.md @@ -0,0 +1,3 @@ +# `@rollup/rollup-linux-x64-gnu` + +This is the **x86_64-unknown-linux-gnu** binary for `rollup` diff --git a/tools/ui/node_modules/@rollup/rollup-linux-x64-gnu/package.json b/tools/ui/node_modules/@rollup/rollup-linux-x64-gnu/package.json new file mode 100644 index 0000000000000000000000000000000000000000..a18ad247b32a53e7dac34861bffbb6021e6f3fdd --- /dev/null +++ b/tools/ui/node_modules/@rollup/rollup-linux-x64-gnu/package.json @@ -0,0 +1,25 @@ +{ + "name": "@rollup/rollup-linux-x64-gnu", + "version": "4.61.1", + "os": [ + "linux" + ], + "cpu": [ + "x64" + ], + "files": [ + "rollup.linux-x64-gnu.node" + ], + "description": "Native bindings for Rollup", + "author": "Lukas Taegert-Atkinson", + "homepage": "https://rollupjs.org/", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/rollup/rollup.git" + }, + "libc": [ + "glibc" + ], + "main": "./rollup.linux-x64-gnu.node" +} \ No newline at end of file diff --git a/tools/ui/node_modules/@rollup/rollup-linux-x64-gnu/rollup.linux-x64-gnu.node b/tools/ui/node_modules/@rollup/rollup-linux-x64-gnu/rollup.linux-x64-gnu.node new file mode 100644 index 0000000000000000000000000000000000000000..87121b40552989db87fef70a9127c4101e995af2 --- /dev/null +++ b/tools/ui/node_modules/@rollup/rollup-linux-x64-gnu/rollup.linux-x64-gnu.node @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:db3560ef0ef6bab41b836339f51c8d7f38e3c0177114a685dc582a2b78a3b1b1 +size 2067608 diff --git a/tools/ui/node_modules/@rollup/rollup-linux-x64-musl/README.md b/tools/ui/node_modules/@rollup/rollup-linux-x64-musl/README.md new file mode 100644 index 0000000000000000000000000000000000000000..5848a6c6e367b335a2818b7e65cd5620b4ffd203 --- /dev/null +++ b/tools/ui/node_modules/@rollup/rollup-linux-x64-musl/README.md @@ -0,0 +1,3 @@ +# `@rollup/rollup-linux-x64-musl` + +This is the **x86_64-unknown-linux-musl** binary for `rollup` diff --git a/tools/ui/node_modules/@rollup/rollup-linux-x64-musl/package.json b/tools/ui/node_modules/@rollup/rollup-linux-x64-musl/package.json new file mode 100644 index 0000000000000000000000000000000000000000..c24c20ed06ec42d2e0a6ddab764158c504645241 --- /dev/null +++ b/tools/ui/node_modules/@rollup/rollup-linux-x64-musl/package.json @@ -0,0 +1,25 @@ +{ + "name": "@rollup/rollup-linux-x64-musl", + "version": "4.61.1", + "os": [ + "linux" + ], + "cpu": [ + "x64" + ], + "files": [ + "rollup.linux-x64-musl.node" + ], + "description": "Native bindings for Rollup", + "author": "Lukas Taegert-Atkinson", + "homepage": "https://rollupjs.org/", + "license": "MIT", + "repository": { + "type": "git", + "url": "git+https://github.com/rollup/rollup.git" + }, + "libc": [ + "musl" + ], + "main": "./rollup.linux-x64-musl.node" +} \ No newline at end of file diff --git a/tools/ui/node_modules/@rollup/rollup-linux-x64-musl/rollup.linux-x64-musl.node b/tools/ui/node_modules/@rollup/rollup-linux-x64-musl/rollup.linux-x64-musl.node new file mode 100644 index 0000000000000000000000000000000000000000..6a929235855dade36713b31bb7b37144a247c101 --- /dev/null +++ b/tools/ui/node_modules/@rollup/rollup-linux-x64-musl/rollup.linux-x64-musl.node @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dfb7335516bc7e30c44bec22b3ae33775c4e6ab14f01d6f9438b6673942b48b8 +size 2097200 diff --git a/tools/ui/node_modules/@standard-schema/spec/LICENSE b/tools/ui/node_modules/@standard-schema/spec/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..ea54e0ddad405b2ee635d687a876613214160ba2 --- /dev/null +++ b/tools/ui/node_modules/@standard-schema/spec/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Colin McDonnell + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/tools/ui/node_modules/@standard-schema/spec/README.md b/tools/ui/node_modules/@standard-schema/spec/README.md new file mode 100644 index 0000000000000000000000000000000000000000..f9813ffa878e7914dc2928ab13db856850e8d83e --- /dev/null +++ b/tools/ui/node_modules/@standard-schema/spec/README.md @@ -0,0 +1,198 @@ +

+ Standard Schema fire logo +
+ Standard Schema

+

+ A family of specs for interoperable TypeScript +
+ standardschema.dev +

+
+ + + +The Standard Schema project is a set of interfaces that standardize the provision and consumption of shared functionality in the TypeScript ecosystem. + +Its goal is to allow tools to accept a single input that includes all the types and capabilities they need— no library-specific adapters, no extra dependencies. The result is an ecosystem that's fair for implementers, friendly for consumers, and open for end users. + +## The specifications + +The specifications can be found below in their entirety. Libraries wishing to implement a spec can copy/paste the code block below into their codebase. They're also available at `@standard-schema/spec` on [npm](https://www.npmjs.com/package/@standard-schema/spec) and [JSR](https://jsr.io/@standard-schema/spec). + +```ts +// ######################### +// ### Standard Typed ### +// ######################### + +/** The Standard Typed interface. This is a base type extended by other specs. */ +export interface StandardTypedV1 { + /** The Standard properties. */ + readonly "~standard": StandardTypedV1.Props; +} + +export declare namespace StandardTypedV1 { + /** The Standard Typed properties interface. */ + export interface Props { + /** The version number of the standard. */ + readonly version: 1; + /** The vendor name of the schema library. */ + readonly vendor: string; + /** Inferred types associated with the schema. */ + readonly types?: Types | undefined; + } + + /** The Standard Typed types interface. */ + export interface Types { + /** The input type of the schema. */ + readonly input: Input; + /** The output type of the schema. */ + readonly output: Output; + } + + /** Infers the input type of a Standard Typed. */ + export type InferInput = NonNullable< + Schema["~standard"]["types"] + >["input"]; + + /** Infers the output type of a Standard Typed. */ + export type InferOutput = NonNullable< + Schema["~standard"]["types"] + >["output"]; +} + +// ########################## +// ### Standard Schema ### +// ########################## + +/** The Standard Schema interface. */ +export interface StandardSchemaV1 { + /** The Standard Schema properties. */ + readonly "~standard": StandardSchemaV1.Props; +} + +export declare namespace StandardSchemaV1 { + /** The Standard Schema properties interface. */ + export interface Props + extends StandardTypedV1.Props { + /** Validates unknown input values. */ + readonly validate: ( + value: unknown, + options?: StandardSchemaV1.Options | undefined + ) => Result | Promise>; + } + + /** The result interface of the validate function. */ + export type Result = SuccessResult | FailureResult; + + /** The result interface if validation succeeds. */ + export interface SuccessResult { + /** The typed output value. */ + readonly value: Output; + /** A falsy value for `issues` indicates success. */ + readonly issues?: undefined; + } + + export interface Options { + /** Explicit support for additional vendor-specific parameters, if needed. */ + readonly libraryOptions?: Record | undefined; + } + + /** The result interface if validation fails. */ + export interface FailureResult { + /** The issues of failed validation. */ + readonly issues: ReadonlyArray; + } + + /** The issue interface of the failure output. */ + export interface Issue { + /** The error message of the issue. */ + readonly message: string; + /** The path of the issue, if any. */ + readonly path?: ReadonlyArray | undefined; + } + + /** The path segment interface of the issue. */ + export interface PathSegment { + /** The key representing a path segment. */ + readonly key: PropertyKey; + } + + /** The Standard types interface. */ + export interface Types + extends StandardTypedV1.Types {} + + /** Infers the input type of a Standard. */ + export type InferInput = + StandardTypedV1.InferInput; + + /** Infers the output type of a Standard. */ + export type InferOutput = + StandardTypedV1.InferOutput; +} + +// ############################### +// ### Standard JSON Schema ### +// ############################### + +/** The Standard JSON Schema interface. */ +export interface StandardJSONSchemaV1 { + /** The Standard JSON Schema properties. */ + readonly "~standard": StandardJSONSchemaV1.Props; +} + +export declare namespace StandardJSONSchemaV1 { + /** The Standard JSON Schema properties interface. */ + export interface Props + extends StandardTypedV1.Props { + /** Methods for generating the input/output JSON Schema. */ + readonly jsonSchema: StandardJSONSchemaV1.Converter; + } + + /** The Standard JSON Schema converter interface. */ + export interface Converter { + /** Converts the input type to JSON Schema. May throw if conversion is not supported. */ + readonly input: ( + options: StandardJSONSchemaV1.Options + ) => Record; + /** Converts the output type to JSON Schema. May throw if conversion is not supported. */ + readonly output: ( + options: StandardJSONSchemaV1.Options + ) => Record; + } + + /** + * The target version of the generated JSON Schema. + * + * It is *strongly recommended* that implementers support `"draft-2020-12"` and `"draft-07"`, as they are both in wide use. All other targets can be implemented on a best-effort basis. Libraries should throw if they don't support a specified target. + * + * The `"openapi-3.0"` target is intended as a standardized specifier for OpenAPI 3.0 which is a superset of JSON Schema `"draft-04"`. + */ + export type Target = + | "draft-2020-12" + | "draft-07" + | "openapi-3.0" + // Accepts any string for future targets while preserving autocomplete + | ({} & string); + + /** The options for the input/output methods. */ + export interface Options { + /** Specifies the target version of the generated JSON Schema. Support for all versions is on a best-effort basis. If a given version is not supported, the library should throw. */ + readonly target: Target; + + /** Explicit support for additional vendor-specific parameters, if needed. */ + readonly libraryOptions?: Record | undefined; + } + + /** The Standard types interface. */ + export interface Types + extends StandardTypedV1.Types {} + + /** Infers the input type of a Standard. */ + export type InferInput = + StandardTypedV1.InferInput; + + /** Infers the output type of a Standard. */ + export type InferOutput = + StandardTypedV1.InferOutput; +} +``` diff --git a/tools/ui/node_modules/@standard-schema/spec/dist/index.cjs b/tools/ui/node_modules/@standard-schema/spec/dist/index.cjs new file mode 100644 index 0000000000000000000000000000000000000000..321666eb3e061c8fa6e38f0d5ce040591cd19da4 --- /dev/null +++ b/tools/ui/node_modules/@standard-schema/spec/dist/index.cjs @@ -0,0 +1,18 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/index.ts +var src_exports = {}; +module.exports = __toCommonJS(src_exports); diff --git a/tools/ui/node_modules/@standard-schema/spec/dist/index.d.cts b/tools/ui/node_modules/@standard-schema/spec/dist/index.d.cts new file mode 100644 index 0000000000000000000000000000000000000000..5e4acaad22d61471cc675bd4a1c776eb96b38ce1 --- /dev/null +++ b/tools/ui/node_modules/@standard-schema/spec/dist/index.d.cts @@ -0,0 +1,119 @@ +/** The Standard Typed interface. This is a base type extended by other specs. */ +interface StandardTypedV1 { + /** The Standard properties. */ + readonly "~standard": StandardTypedV1.Props; +} +declare namespace StandardTypedV1 { + /** The Standard Typed properties interface. */ + interface Props { + /** The version number of the standard. */ + readonly version: 1; + /** The vendor name of the schema library. */ + readonly vendor: string; + /** Inferred types associated with the schema. */ + readonly types?: Types | undefined; + } + /** The Standard Typed types interface. */ + interface Types { + /** The input type of the schema. */ + readonly input: Input; + /** The output type of the schema. */ + readonly output: Output; + } + /** Infers the input type of a Standard Typed. */ + type InferInput = NonNullable["input"]; + /** Infers the output type of a Standard Typed. */ + type InferOutput = NonNullable["output"]; +} +/** The Standard Schema interface. */ +interface StandardSchemaV1 { + /** The Standard Schema properties. */ + readonly "~standard": StandardSchemaV1.Props; +} +declare namespace StandardSchemaV1 { + /** The Standard Schema properties interface. */ + interface Props extends StandardTypedV1.Props { + /** Validates unknown input values. */ + readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result | Promise>; + } + /** The result interface of the validate function. */ + type Result = SuccessResult | FailureResult; + /** The result interface if validation succeeds. */ + interface SuccessResult { + /** The typed output value. */ + readonly value: Output; + /** A falsy value for `issues` indicates success. */ + readonly issues?: undefined; + } + interface Options { + /** Explicit support for additional vendor-specific parameters, if needed. */ + readonly libraryOptions?: Record | undefined; + } + /** The result interface if validation fails. */ + interface FailureResult { + /** The issues of failed validation. */ + readonly issues: ReadonlyArray; + } + /** The issue interface of the failure output. */ + interface Issue { + /** The error message of the issue. */ + readonly message: string; + /** The path of the issue, if any. */ + readonly path?: ReadonlyArray | undefined; + } + /** The path segment interface of the issue. */ + interface PathSegment { + /** The key representing a path segment. */ + readonly key: PropertyKey; + } + /** The Standard types interface. */ + interface Types extends StandardTypedV1.Types { + } + /** Infers the input type of a Standard. */ + type InferInput = StandardTypedV1.InferInput; + /** Infers the output type of a Standard. */ + type InferOutput = StandardTypedV1.InferOutput; +} +/** The Standard JSON Schema interface. */ +interface StandardJSONSchemaV1 { + /** The Standard JSON Schema properties. */ + readonly "~standard": StandardJSONSchemaV1.Props; +} +declare namespace StandardJSONSchemaV1 { + /** The Standard JSON Schema properties interface. */ + interface Props extends StandardTypedV1.Props { + /** Methods for generating the input/output JSON Schema. */ + readonly jsonSchema: StandardJSONSchemaV1.Converter; + } + /** The Standard JSON Schema converter interface. */ + interface Converter { + /** Converts the input type to JSON Schema. May throw if conversion is not supported. */ + readonly input: (options: StandardJSONSchemaV1.Options) => Record; + /** Converts the output type to JSON Schema. May throw if conversion is not supported. */ + readonly output: (options: StandardJSONSchemaV1.Options) => Record; + } + /** + * The target version of the generated JSON Schema. + * + * It is *strongly recommended* that implementers support `"draft-2020-12"` and `"draft-07"`, as they are both in wide use. All other targets can be implemented on a best-effort basis. Libraries should throw if they don't support a specified target. + * + * The `"openapi-3.0"` target is intended as a standardized specifier for OpenAPI 3.0 which is a superset of JSON Schema `"draft-04"`. + */ + type Target = "draft-2020-12" | "draft-07" | "openapi-3.0" | ({} & string); + /** The options for the input/output methods. */ + interface Options { + /** Specifies the target version of the generated JSON Schema. Support for all versions is on a best-effort basis. If a given version is not supported, the library should throw. */ + readonly target: Target; + /** Explicit support for additional vendor-specific parameters, if needed. */ + readonly libraryOptions?: Record | undefined; + } + /** The Standard types interface. */ + interface Types extends StandardTypedV1.Types { + } + /** Infers the input type of a Standard. */ + type InferInput = StandardTypedV1.InferInput; + /** Infers the output type of a Standard. */ + type InferOutput = StandardTypedV1.InferOutput; +} + +export { StandardJSONSchemaV1, StandardSchemaV1, StandardTypedV1 }; diff --git a/tools/ui/node_modules/@standard-schema/spec/dist/index.d.ts b/tools/ui/node_modules/@standard-schema/spec/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..5e4acaad22d61471cc675bd4a1c776eb96b38ce1 --- /dev/null +++ b/tools/ui/node_modules/@standard-schema/spec/dist/index.d.ts @@ -0,0 +1,119 @@ +/** The Standard Typed interface. This is a base type extended by other specs. */ +interface StandardTypedV1 { + /** The Standard properties. */ + readonly "~standard": StandardTypedV1.Props; +} +declare namespace StandardTypedV1 { + /** The Standard Typed properties interface. */ + interface Props { + /** The version number of the standard. */ + readonly version: 1; + /** The vendor name of the schema library. */ + readonly vendor: string; + /** Inferred types associated with the schema. */ + readonly types?: Types | undefined; + } + /** The Standard Typed types interface. */ + interface Types { + /** The input type of the schema. */ + readonly input: Input; + /** The output type of the schema. */ + readonly output: Output; + } + /** Infers the input type of a Standard Typed. */ + type InferInput = NonNullable["input"]; + /** Infers the output type of a Standard Typed. */ + type InferOutput = NonNullable["output"]; +} +/** The Standard Schema interface. */ +interface StandardSchemaV1 { + /** The Standard Schema properties. */ + readonly "~standard": StandardSchemaV1.Props; +} +declare namespace StandardSchemaV1 { + /** The Standard Schema properties interface. */ + interface Props extends StandardTypedV1.Props { + /** Validates unknown input values. */ + readonly validate: (value: unknown, options?: StandardSchemaV1.Options | undefined) => Result | Promise>; + } + /** The result interface of the validate function. */ + type Result = SuccessResult | FailureResult; + /** The result interface if validation succeeds. */ + interface SuccessResult { + /** The typed output value. */ + readonly value: Output; + /** A falsy value for `issues` indicates success. */ + readonly issues?: undefined; + } + interface Options { + /** Explicit support for additional vendor-specific parameters, if needed. */ + readonly libraryOptions?: Record | undefined; + } + /** The result interface if validation fails. */ + interface FailureResult { + /** The issues of failed validation. */ + readonly issues: ReadonlyArray; + } + /** The issue interface of the failure output. */ + interface Issue { + /** The error message of the issue. */ + readonly message: string; + /** The path of the issue, if any. */ + readonly path?: ReadonlyArray | undefined; + } + /** The path segment interface of the issue. */ + interface PathSegment { + /** The key representing a path segment. */ + readonly key: PropertyKey; + } + /** The Standard types interface. */ + interface Types extends StandardTypedV1.Types { + } + /** Infers the input type of a Standard. */ + type InferInput = StandardTypedV1.InferInput; + /** Infers the output type of a Standard. */ + type InferOutput = StandardTypedV1.InferOutput; +} +/** The Standard JSON Schema interface. */ +interface StandardJSONSchemaV1 { + /** The Standard JSON Schema properties. */ + readonly "~standard": StandardJSONSchemaV1.Props; +} +declare namespace StandardJSONSchemaV1 { + /** The Standard JSON Schema properties interface. */ + interface Props extends StandardTypedV1.Props { + /** Methods for generating the input/output JSON Schema. */ + readonly jsonSchema: StandardJSONSchemaV1.Converter; + } + /** The Standard JSON Schema converter interface. */ + interface Converter { + /** Converts the input type to JSON Schema. May throw if conversion is not supported. */ + readonly input: (options: StandardJSONSchemaV1.Options) => Record; + /** Converts the output type to JSON Schema. May throw if conversion is not supported. */ + readonly output: (options: StandardJSONSchemaV1.Options) => Record; + } + /** + * The target version of the generated JSON Schema. + * + * It is *strongly recommended* that implementers support `"draft-2020-12"` and `"draft-07"`, as they are both in wide use. All other targets can be implemented on a best-effort basis. Libraries should throw if they don't support a specified target. + * + * The `"openapi-3.0"` target is intended as a standardized specifier for OpenAPI 3.0 which is a superset of JSON Schema `"draft-04"`. + */ + type Target = "draft-2020-12" | "draft-07" | "openapi-3.0" | ({} & string); + /** The options for the input/output methods. */ + interface Options { + /** Specifies the target version of the generated JSON Schema. Support for all versions is on a best-effort basis. If a given version is not supported, the library should throw. */ + readonly target: Target; + /** Explicit support for additional vendor-specific parameters, if needed. */ + readonly libraryOptions?: Record | undefined; + } + /** The Standard types interface. */ + interface Types extends StandardTypedV1.Types { + } + /** Infers the input type of a Standard. */ + type InferInput = StandardTypedV1.InferInput; + /** Infers the output type of a Standard. */ + type InferOutput = StandardTypedV1.InferOutput; +} + +export { StandardJSONSchemaV1, StandardSchemaV1, StandardTypedV1 }; diff --git a/tools/ui/node_modules/@standard-schema/spec/dist/index.js b/tools/ui/node_modules/@standard-schema/spec/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/tools/ui/node_modules/@standard-schema/spec/package.json b/tools/ui/node_modules/@standard-schema/spec/package.json new file mode 100644 index 0000000000000000000000000000000000000000..62bb5518706bf743a2140f03aa5271507ae9bcdf --- /dev/null +++ b/tools/ui/node_modules/@standard-schema/spec/package.json @@ -0,0 +1,52 @@ +{ + "name": "@standard-schema/spec", + "description": "A family of specs for interoperable TypeScript", + "version": "1.1.0", + "license": "MIT", + "author": "Colin McDonnell", + "homepage": "https://standardschema.dev", + "repository": { + "type": "git", + "url": "https://github.com/standard-schema/standard-schema" + }, + "keywords": [ + "typescript", + "schema", + "validation", + "standard", + "interface" + ], + "type": "module", + "main": "./dist/index.js", + "types": "./dist/index.d.ts", + "exports": { + ".": { + "standard-schema-spec": "./src/index.ts", + "import": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "require": { + "types": "./dist/index.d.cts", + "default": "./dist/index.cjs" + } + } + }, + "sideEffects": false, + "files": [ + "dist" + ], + "publishConfig": { + "access": "public" + }, + "devDependencies": { + "tsup": "^8.3.0", + "typescript": "^5.6.2" + }, + "scripts": { + "lint": "pnpm biome lint ./src", + "format": "pnpm biome format --write ./src", + "check": "pnpm biome check ./src", + "build": "tsup" + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/@storybook/addon-a11y/README.md b/tools/ui/node_modules/@storybook/addon-a11y/README.md new file mode 100644 index 0000000000000000000000000000000000000000..deb43df6f3d2c7f763d7570fd7bdad23916ba1b6 --- /dev/null +++ b/tools/ui/node_modules/@storybook/addon-a11y/README.md @@ -0,0 +1,15 @@ +# Storybook Accessibility Addon + +The @storybook/addon-a11y package provides accessibility testing for Storybook stories. It uses axe-core to run the tests. + +## Getting Started + +### Add the addon to an existing Storybook + +```bash +npx storybook add @storybook/addon-a11y +``` + +[More on getting started with the accessibility addon](https://storybook.js.org/docs/writing-tests/accessibility-testing#accessibility-checks-with-a11y-addon?ref=readme) + +Learn more about Storybook at [storybook.js.org](https://storybook.js.org/?ref=readme). diff --git a/tools/ui/node_modules/@storybook/addon-a11y/dist/_browser-chunks/chunk-4BE7D4DS.js b/tools/ui/node_modules/@storybook/addon-a11y/dist/_browser-chunks/chunk-4BE7D4DS.js new file mode 100644 index 0000000000000000000000000000000000000000..bb44e6e612b9969eaee09b7ba70fbdc61056d5f9 --- /dev/null +++ b/tools/ui/node_modules/@storybook/addon-a11y/dist/_browser-chunks/chunk-4BE7D4DS.js @@ -0,0 +1,9 @@ +var __defProp = Object.defineProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: !0 }); +}; + +export { + __export +}; diff --git a/tools/ui/node_modules/@storybook/addon-a11y/dist/_browser-chunks/chunk-7OPMK7TU.js b/tools/ui/node_modules/@storybook/addon-a11y/dist/_browser-chunks/chunk-7OPMK7TU.js new file mode 100644 index 0000000000000000000000000000000000000000..367cd04a6444dd9552b22b014cb8dbd49255a981 --- /dev/null +++ b/tools/ui/node_modules/@storybook/addon-a11y/dist/_browser-chunks/chunk-7OPMK7TU.js @@ -0,0 +1,116 @@ +// src/constants.ts +var ADDON_ID = "storybook/a11y", PANEL_ID = `${ADDON_ID}/panel`, PARAM_KEY = "a11y", VISION_GLOBAL_KEY = "vision", UI_STATE_ID = `${ADDON_ID}/ui`, RESULT = `${ADDON_ID}/result`, REQUEST = `${ADDON_ID}/request`, RUNNING = `${ADDON_ID}/running`, ERROR = `${ADDON_ID}/error`, MANUAL = `${ADDON_ID}/manual`, SELECT = `${ADDON_ID}/select`, DOCUMENTATION_LINK = "writing-tests/accessibility-testing", DOCUMENTATION_DISCREPANCY_LINK = `${DOCUMENTATION_LINK}#why-are-my-tests-failing-in-different-environments`; +var EVENTS = { RESULT, REQUEST, RUNNING, ERROR, MANUAL, SELECT }, STATUS_TYPE_ID_COMPONENT_TEST = "storybook/component-test", STATUS_TYPE_ID_A11Y = "storybook/a11y"; + +// src/visionSimulatorFilters.ts +var filters = { + blurred: { + label: "Blurred vision", + filter: "blur(2px)", + percentage: 22.9 + }, + deuteranomaly: { + label: "Deuteranomaly", + filter: 'url("#storybook-a11y-vision-deuteranomaly")', + percentage: 2.7 + }, + deuteranopia: { + label: "Deuteranopia", + filter: 'url("#storybook-a11y-vision-deuteranopia")', + percentage: 0.56 + }, + protanomaly: { + label: "Protanomaly", + filter: 'url("#storybook-a11y-vision-protanomaly")', + percentage: 0.66 + }, + protanopia: { + label: "Protanopia", + filter: 'url("#storybook-a11y-vision-protanopia")', + percentage: 0.59 + }, + tritanomaly: { + label: "Tritanomaly", + filter: 'url("#storybook-a11y-vision-tritanomaly")', + percentage: 0.01 + }, + tritanopia: { + label: "Tritanopia", + filter: 'url("#storybook-a11y-vision-tritanopia")', + percentage: 0.016 + }, + achromatopsia: { + label: "Achromatopsia", + filter: 'url("#storybook-a11y-vision-achromatopsia")', + percentage: 1e-4 + }, + grayscale: { + label: "Grayscale", + filter: "grayscale(100%)" + } +}, filterDefs = ` + + + + + + + + + + + + + + + + + + + + + + + +`; + +export { + ADDON_ID, + PANEL_ID, + PARAM_KEY, + VISION_GLOBAL_KEY, + DOCUMENTATION_DISCREPANCY_LINK, + EVENTS, + STATUS_TYPE_ID_COMPONENT_TEST, + STATUS_TYPE_ID_A11Y, + filters, + filterDefs +}; diff --git a/tools/ui/node_modules/@storybook/addon-a11y/dist/_browser-chunks/chunk-P5J2FJ2Z.js b/tools/ui/node_modules/@storybook/addon-a11y/dist/_browser-chunks/chunk-P5J2FJ2Z.js new file mode 100644 index 0000000000000000000000000000000000000000..da772ad2807531d02bfe730188a2ce93b83ffb0e --- /dev/null +++ b/tools/ui/node_modules/@storybook/addon-a11y/dist/_browser-chunks/chunk-P5J2FJ2Z.js @@ -0,0 +1,196 @@ +import { + EVENTS, + PANEL_ID, + filterDefs, + filters +} from "./chunk-7OPMK7TU.js"; +import { + __export +} from "./chunk-4BE7D4DS.js"; + +// src/preview.tsx +var preview_exports = {}; +__export(preview_exports, { + afterEach: () => afterEach, + decorators: () => decorators, + initialGlobals: () => initialGlobals, + parameters: () => parameters +}); +import { expect } from "storybook/test"; + +// src/a11yRunner.ts +import { ElementA11yParameterError } from "storybook/internal/preview-errors"; +import { global as global2 } from "@storybook/global"; +import { addons, waitForAnimations } from "storybook/preview-api"; + +// src/a11yRunnerUtils.ts +import { global } from "@storybook/global"; +var { document: document2 } = global, withLinkPaths = (results, storyId) => { + let pathname = document2.location.pathname.replace(/iframe\.html$/, ""), enhancedResults = { ...results }; + return ["incomplete", "passes", "violations"].forEach((key) => { + Array.isArray(results[key]) && (enhancedResults[key] = results[key].map((result) => ({ + ...result, + nodes: result.nodes.map((node, index) => { + let id = `${key}.${result.id}.${index + 1}`, linkPath = `${pathname}?path=/story/${storyId}&addonPanel=${PANEL_ID}&a11ySelection=${id}`; + return { id, ...node, linkPath }; + }) + }))); + }), enhancedResults; +}; + +// src/a11yRunner.ts +var { document: document3 } = global2, channel = addons.getChannel(), DEFAULT_PARAMETERS = { config: {}, options: {} }, DISABLED_RULES = [ + // In component testing, landmarks are not always present + // and the rule check can cause false positives + "region" +], getDisabledRules = (rules = []) => { + let disabledRules = {}; + for (let { id, enabled } of rules) + !id || typeof enabled != "boolean" || (enabled ? delete disabledRules[id] : disabledRules[id] = { enabled: !1 }); + return disabledRules; +}, mergeDisabledRulesIntoRunOptions = (options, config) => { + if (!options.runOnly) + return options; + let disabledRules = getDisabledRules(config.rules); + return Object.keys(disabledRules).length === 0 ? options : { + ...options, + rules: { + ...disabledRules, + ...options.rules + } + }; +}, queue = [], isRunning = !1, runNext = async () => { + if (queue.length === 0) { + isRunning = !1; + return; + } + isRunning = !0; + let next = queue.shift(); + next && await next(), runNext(); +}, run = async (input = DEFAULT_PARAMETERS, storyId) => { + let axe = (await import("axe-core"))?.default || globalThis.axe, { config = {}, options = {} } = input; + if (input.element) + throw new ElementA11yParameterError(); + let context = { + include: document3?.body, + exclude: [".sb-wrapper", "#storybook-docs", "#storybook-highlights-root"] + // Internal Storybook elements that are always in the document + }; + if (input.context) { + let hasInclude = typeof input.context == "object" && "include" in input.context && input.context.include !== void 0, hasExclude = typeof input.context == "object" && "exclude" in input.context && input.context.exclude !== void 0; + hasInclude ? context.include = input.context.include : !hasInclude && !hasExclude && (context.include = input.context), hasExclude && (context.exclude = context.exclude.concat(input.context.exclude)); + } + axe.reset(); + let configWithDefault = { + ...config, + rules: [...DISABLED_RULES.map((id) => ({ id, enabled: !1 })), ...config?.rules ?? []] + }; + axe.configure(configWithDefault); + let optionsWithDisabledRules = mergeDisabledRulesIntoRunOptions(options, configWithDefault); + return new Promise((resolve, reject) => { + let highlightsRoot = document3?.getElementById("storybook-highlights-root"); + highlightsRoot && (highlightsRoot.style.display = "none"); + let task = async () => { + try { + let result = await axe.run(context, optionsWithDisabledRules), resultWithLinks = withLinkPaths(result, storyId); + resolve(resultWithLinks); + } catch (error) { + reject(error); + } + }; + queue.push(task), isRunning || runNext(), highlightsRoot && (highlightsRoot.style.display = ""); + }); +}; +channel.on(EVENTS.MANUAL, async (storyId, input = DEFAULT_PARAMETERS) => { + try { + await waitForAnimations(); + let result = await run(input, storyId), resultJson = JSON.parse(JSON.stringify(result)); + channel.emit(EVENTS.RESULT, resultJson, storyId); + } catch (error) { + channel.emit(EVENTS.ERROR, error); + } +}); + +// src/utils.ts +function getIsVitestStandaloneRun() { + try { + return import.meta.env.VITEST_STORYBOOK === "false"; + } catch { + return !1; + } +} + +// src/withVisionSimulator.ts +import { useCallback, useEffect } from "storybook/preview-api"; +var knownFilters = Object.values(filters).map((f) => f.filter), knownFiltersRegExp = new RegExp(`\\b(${knownFilters.join("|")})\\b`, "g"), withVisionSimulator = (StoryFn, { globals }) => { + let { vision } = globals, applyVisionFilter = useCallback(() => { + let existingFilters = document.body.style.filter.replaceAll(knownFiltersRegExp, "").trim(), visionFilter = filters[vision]?.filter; + return visionFilter && document.body.classList.contains("sb-show-main") ? !existingFilters || existingFilters === "none" ? document.body.style.filter = visionFilter : document.body.style.filter = `${existingFilters} ${visionFilter}` : document.body.style.filter = existingFilters || "none", () => document.body.style.filter = existingFilters || "none"; + }, [vision]); + return useEffect(() => { + let cleanup = applyVisionFilter(), observer = new MutationObserver(() => applyVisionFilter()); + return observer.observe(document.body, { attributeFilter: ["class"] }), () => { + cleanup(), observer.disconnect(); + }; + }, [applyVisionFilter]), useEffect(() => (document.body.insertAdjacentHTML("beforeend", filterDefs), () => { + let filterDefsElement = document.getElementById("storybook-a11y-vision-filters"); + filterDefsElement?.parentElement?.removeChild(filterDefsElement); + }), []), StoryFn(); +}; + +// src/preview.tsx +var vitestMatchersExtended = !1, decorators = [withVisionSimulator], afterEach = async ({ + id: storyId, + reporting, + parameters: parameters2, + globals, + viewMode +}) => { + let a11yParameter = parameters2.a11y, a11yGlobals = globals.a11y, shouldRunEnvironmentIndependent = !!!globals.ghostStories && a11yParameter?.disable !== !0 && a11yParameter?.test !== "off" && a11yGlobals?.manual !== !0, getMode = () => a11yParameter?.test === "todo" ? "warning" : "failed"; + if (shouldRunEnvironmentIndependent && viewMode === "story") + try { + let result = await run(a11yParameter, storyId); + if (result) { + let hasViolations = (result?.violations.length ?? 0) > 0; + if (reporting.addReport({ + type: "a11y", + version: 1, + result, + status: hasViolations ? getMode() : "passed" + }), getIsVitestStandaloneRun() && hasViolations && getMode() === "failed") { + if (!vitestMatchersExtended) { + let { toHaveNoViolations } = await import("./matchers-JIUQ3HVY.js"); + expect.extend({ toHaveNoViolations }), vitestMatchersExtended = !0; + } + expect(result).toHaveNoViolations(); + } + } + } catch (e) { + if (reporting.addReport({ + type: "a11y", + version: 1, + result: { + error: e + }, + status: "failed" + }), getIsVitestStandaloneRun()) + throw e; + } +}, initialGlobals = { + a11y: { + manual: !1 + }, + vision: void 0 +}, parameters = { + a11y: { + test: "todo" + } +}; + +export { + decorators, + afterEach, + initialGlobals, + parameters, + preview_exports +}; diff --git a/tools/ui/node_modules/@storybook/addon-a11y/dist/_browser-chunks/matchers-JIUQ3HVY.js b/tools/ui/node_modules/@storybook/addon-a11y/dist/_browser-chunks/matchers-JIUQ3HVY.js new file mode 100644 index 0000000000000000000000000000000000000000..929107b459f9727a8b53a1e13ffa939e51cee832 --- /dev/null +++ b/tools/ui/node_modules/@storybook/addon-a11y/dist/_browser-chunks/matchers-JIUQ3HVY.js @@ -0,0 +1,1263 @@ +import "./chunk-4BE7D4DS.js"; + +// ../../../node_modules/vitest-axe/node_modules/chalk/source/vendor/ansi-styles/index.js +var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`, wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`, wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`, styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + overline: [53, 55], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + // Bright color + blackBright: [90, 39], + gray: [90, 39], + // Alias of `blackBright` + grey: [90, 39], + // Alias of `blackBright` + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39] + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + // Bright color + bgBlackBright: [100, 49], + bgGray: [100, 49], + // Alias of `bgBlackBright` + bgGrey: [100, 49], + // Alias of `bgBlackBright` + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49] + } +}, modifierNames = Object.keys(styles.modifier), foregroundColorNames = Object.keys(styles.color), backgroundColorNames = Object.keys(styles.bgColor), colorNames = [...foregroundColorNames, ...backgroundColorNames]; +function assembleStyles() { + let codes = /* @__PURE__ */ new Map(); + for (let [groupName, group] of Object.entries(styles)) { + for (let [styleName, style] of Object.entries(group)) + styles[styleName] = { + open: `\x1B[${style[0]}m`, + close: `\x1B[${style[1]}m` + }, group[styleName] = styles[styleName], codes.set(style[0], style[1]); + Object.defineProperty(styles, groupName, { + value: group, + enumerable: !1 + }); + } + return Object.defineProperty(styles, "codes", { + value: codes, + enumerable: !1 + }), styles.color.close = "\x1B[39m", styles.bgColor.close = "\x1B[49m", styles.color.ansi = wrapAnsi16(), styles.color.ansi256 = wrapAnsi256(), styles.color.ansi16m = wrapAnsi16m(), styles.bgColor.ansi = wrapAnsi16(10), styles.bgColor.ansi256 = wrapAnsi256(10), styles.bgColor.ansi16m = wrapAnsi16m(10), Object.defineProperties(styles, { + rgbToAnsi256: { + value(red, green, blue) { + return red === green && green === blue ? red < 8 ? 16 : red > 248 ? 231 : Math.round((red - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5); + }, + enumerable: !1 + }, + hexToRgb: { + value(hex) { + let matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16)); + if (!matches) + return [0, 0, 0]; + let [colorString] = matches; + colorString.length === 3 && (colorString = [...colorString].map((character) => character + character).join("")); + let integer = Number.parseInt(colorString, 16); + return [ + /* eslint-disable no-bitwise */ + integer >> 16 & 255, + integer >> 8 & 255, + integer & 255 + /* eslint-enable no-bitwise */ + ]; + }, + enumerable: !1 + }, + hexToAnsi256: { + value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)), + enumerable: !1 + }, + ansi256ToAnsi: { + value(code) { + if (code < 8) + return 30 + code; + if (code < 16) + return 90 + (code - 8); + let red, green, blue; + if (code >= 232) + red = ((code - 232) * 10 + 8) / 255, green = red, blue = red; + else { + code -= 16; + let remainder = code % 36; + red = Math.floor(code / 36) / 5, green = Math.floor(remainder / 6) / 5, blue = remainder % 6 / 5; + } + let value = Math.max(red, green, blue) * 2; + if (value === 0) + return 30; + let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red)); + return value === 2 && (result += 60), result; + }, + enumerable: !1 + }, + rgbToAnsi: { + value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)), + enumerable: !1 + }, + hexToAnsi: { + value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)), + enumerable: !1 + } + }), styles; +} +var ansiStyles = assembleStyles(), ansi_styles_default = ansiStyles; + +// ../../../node_modules/vitest-axe/node_modules/chalk/source/vendor/supports-color/browser.js +var level = (() => { + if (!("navigator" in globalThis)) + return 0; + if (globalThis.navigator.userAgentData) { + let brand = navigator.userAgentData.brands.find(({ brand: brand2 }) => brand2 === "Chromium"); + if (brand && brand.version > 93) + return 3; + } + return /\b(Chrome|Chromium)\//.test(globalThis.navigator.userAgent) ? 1 : 0; +})(), colorSupport = level !== 0 && { + level, + hasBasic: !0, + has256: level >= 2, + has16m: level >= 3 +}, supportsColor = { + stdout: colorSupport, + stderr: colorSupport +}, browser_default = supportsColor; + +// ../../../node_modules/vitest-axe/node_modules/chalk/source/utilities.js +function stringReplaceAll(string, substring, replacer) { + let index = string.indexOf(substring); + if (index === -1) + return string; + let substringLength = substring.length, endIndex = 0, returnValue = ""; + do + returnValue += string.slice(endIndex, index) + substring + replacer, endIndex = index + substringLength, index = string.indexOf(substring, endIndex); + while (index !== -1); + return returnValue += string.slice(endIndex), returnValue; +} +function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) { + let endIndex = 0, returnValue = ""; + do { + let gotCR = string[index - 1] === "\r"; + returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? `\r +` : ` +`) + postfix, endIndex = index + 1, index = string.indexOf(` +`, endIndex); + } while (index !== -1); + return returnValue += string.slice(endIndex), returnValue; +} + +// ../../../node_modules/vitest-axe/node_modules/chalk/source/index.js +var { stdout: stdoutColor, stderr: stderrColor } = browser_default, GENERATOR = /* @__PURE__ */ Symbol("GENERATOR"), STYLER = /* @__PURE__ */ Symbol("STYLER"), IS_EMPTY = /* @__PURE__ */ Symbol("IS_EMPTY"), levelMapping = [ + "ansi", + "ansi", + "ansi256", + "ansi16m" +], styles2 = /* @__PURE__ */ Object.create(null), applyOptions = (object, options = {}) => { + if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) + throw new Error("The `level` option should be an integer from 0 to 3"); + let colorLevel = stdoutColor ? stdoutColor.level : 0; + object.level = options.level === void 0 ? colorLevel : options.level; +}; +var chalkFactory = (options) => { + let chalk2 = (...strings) => strings.join(" "); + return applyOptions(chalk2, options), Object.setPrototypeOf(chalk2, createChalk.prototype), chalk2; +}; +function createChalk(options) { + return chalkFactory(options); +} +Object.setPrototypeOf(createChalk.prototype, Function.prototype); +for (let [styleName, style] of Object.entries(ansi_styles_default)) + styles2[styleName] = { + get() { + let builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]); + return Object.defineProperty(this, styleName, { value: builder }), builder; + } + }; +styles2.visible = { + get() { + let builder = createBuilder(this, this[STYLER], !0); + return Object.defineProperty(this, "visible", { value: builder }), builder; + } +}; +var getModelAnsi = (model, level2, type, ...arguments_) => model === "rgb" ? level2 === "ansi16m" ? ansi_styles_default[type].ansi16m(...arguments_) : level2 === "ansi256" ? ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_)) : ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_)) : model === "hex" ? getModelAnsi("rgb", level2, type, ...ansi_styles_default.hexToRgb(...arguments_)) : ansi_styles_default[type][model](...arguments_), usedModels = ["rgb", "hex", "ansi256"]; +for (let model of usedModels) { + styles2[model] = { + get() { + let { level: level2 } = this; + return function(...arguments_) { + let styler = createStyler(getModelAnsi(model, levelMapping[level2], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]); + return createBuilder(this, styler, this[IS_EMPTY]); + }; + } + }; + let bgModel = "bg" + model[0].toUpperCase() + model.slice(1); + styles2[bgModel] = { + get() { + let { level: level2 } = this; + return function(...arguments_) { + let styler = createStyler(getModelAnsi(model, levelMapping[level2], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]); + return createBuilder(this, styler, this[IS_EMPTY]); + }; + } + }; +} +var proto = Object.defineProperties(() => { +}, { + ...styles2, + level: { + enumerable: !0, + get() { + return this[GENERATOR].level; + }, + set(level2) { + this[GENERATOR].level = level2; + } + } +}), createStyler = (open, close, parent) => { + let openAll, closeAll; + return parent === void 0 ? (openAll = open, closeAll = close) : (openAll = parent.openAll + open, closeAll = close + parent.closeAll), { + open, + close, + openAll, + closeAll, + parent + }; +}, createBuilder = (self, _styler, _isEmpty) => { + let builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" ")); + return Object.setPrototypeOf(builder, proto), builder[GENERATOR] = self, builder[STYLER] = _styler, builder[IS_EMPTY] = _isEmpty, builder; +}, applyStyle = (self, string) => { + if (self.level <= 0 || !string) + return self[IS_EMPTY] ? "" : string; + let styler = self[STYLER]; + if (styler === void 0) + return string; + let { openAll, closeAll } = styler; + if (string.includes("\x1B")) + for (; styler !== void 0; ) + string = stringReplaceAll(string, styler.close, styler.open), styler = styler.parent; + let lfIndex = string.indexOf(` +`); + return lfIndex !== -1 && (string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex)), openAll + string + closeAll; +}; +Object.defineProperties(createChalk.prototype, styles2); +var chalk = createChalk(), chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 }); +var source_default = chalk; + +// ../../../node_modules/vitest-axe/dist/chunk-X4FZIUYL.js +var __create = Object.create, __defProp = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __getOwnPropNames = Object.getOwnPropertyNames, __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty, __commonJS = (cb, mod) => function() { + return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; +}, __copyProps = (to, from, except, desc) => { + if (from && typeof from == "object" || typeof from == "function") + for (let key of __getOwnPropNames(from)) + !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + return to; +}, __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target, mod)), require_ansi_styles = __commonJS({ + "node_modules/pretty-format/node_modules/ansi-styles/index.js"(exports, module) { + "use strict"; + var ANSI_BACKGROUND_OFFSET = 10, wrapAnsi2562 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`, wrapAnsi16m2 = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`; + function assembleStyles2() { + let codes = /* @__PURE__ */ new Map(), styles3 = { + modifier: { + reset: [0, 0], + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + overline: [53, 55], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + blackBright: [90, 39], + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39] + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + bgBlackBright: [100, 49], + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49] + } + }; + styles3.color.gray = styles3.color.blackBright, styles3.bgColor.bgGray = styles3.bgColor.bgBlackBright, styles3.color.grey = styles3.color.blackBright, styles3.bgColor.bgGrey = styles3.bgColor.bgBlackBright; + for (let [groupName, group] of Object.entries(styles3)) { + for (let [styleName, style] of Object.entries(group)) + styles3[styleName] = { + open: `\x1B[${style[0]}m`, + close: `\x1B[${style[1]}m` + }, group[styleName] = styles3[styleName], codes.set(style[0], style[1]); + Object.defineProperty(styles3, groupName, { + value: group, + enumerable: !1 + }); + } + return Object.defineProperty(styles3, "codes", { + value: codes, + enumerable: !1 + }), styles3.color.close = "\x1B[39m", styles3.bgColor.close = "\x1B[49m", styles3.color.ansi256 = wrapAnsi2562(), styles3.color.ansi16m = wrapAnsi16m2(), styles3.bgColor.ansi256 = wrapAnsi2562(ANSI_BACKGROUND_OFFSET), styles3.bgColor.ansi16m = wrapAnsi16m2(ANSI_BACKGROUND_OFFSET), Object.defineProperties(styles3, { + rgbToAnsi256: { + value: (red, green, blue) => red === green && green === blue ? red < 8 ? 16 : red > 248 ? 231 : Math.round((red - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5), + enumerable: !1 + }, + hexToRgb: { + value: (hex) => { + let matches = /(?[a-f\d]{6}|[a-f\d]{3})/i.exec(hex.toString(16)); + if (!matches) + return [0, 0, 0]; + let { colorString } = matches.groups; + colorString.length === 3 && (colorString = colorString.split("").map((character) => character + character).join("")); + let integer = Number.parseInt(colorString, 16); + return [ + integer >> 16 & 255, + integer >> 8 & 255, + integer & 255 + ]; + }, + enumerable: !1 + }, + hexToAnsi256: { + value: (hex) => styles3.rgbToAnsi256(...styles3.hexToRgb(hex)), + enumerable: !1 + } + }), styles3; + } + Object.defineProperty(module, "exports", { + enumerable: !0, + get: assembleStyles2 + }); + } +}), require_collections = __commonJS({ + "node_modules/pretty-format/build/collections.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.printIteratorEntries = printIteratorEntries, exports.printIteratorValues = printIteratorValues, exports.printListItems = printListItems, exports.printObjectProperties = printObjectProperties; + var getKeysOfEnumerableProperties = (object, compareKeys) => { + let keys = Object.keys(object).sort(compareKeys); + return Object.getOwnPropertySymbols && Object.getOwnPropertySymbols(object).forEach((symbol) => { + Object.getOwnPropertyDescriptor(object, symbol).enumerable && keys.push(symbol); + }), keys; + }; + function printIteratorEntries(iterator, config, indentation, depth, refs, printer, separator = ": ") { + let result = "", width = 0, current = iterator.next(); + if (!current.done) { + result += config.spacingOuter; + let indentationNext = indentation + config.indent; + for (; !current.done; ) { + if (result += indentationNext, width++ === config.maxWidth) { + result += "\u2026"; + break; + } + let name = printer(current.value[0], config, indentationNext, depth, refs), value = printer(current.value[1], config, indentationNext, depth, refs); + result += name + separator + value, current = iterator.next(), current.done ? config.min || (result += ",") : result += `,${config.spacingInner}`; + } + result += config.spacingOuter + indentation; + } + return result; + } + function printIteratorValues(iterator, config, indentation, depth, refs, printer) { + let result = "", width = 0, current = iterator.next(); + if (!current.done) { + result += config.spacingOuter; + let indentationNext = indentation + config.indent; + for (; !current.done; ) { + if (result += indentationNext, width++ === config.maxWidth) { + result += "\u2026"; + break; + } + result += printer(current.value, config, indentationNext, depth, refs), current = iterator.next(), current.done ? config.min || (result += ",") : result += `,${config.spacingInner}`; + } + result += config.spacingOuter + indentation; + } + return result; + } + function printListItems(list, config, indentation, depth, refs, printer) { + let result = ""; + if (list.length) { + result += config.spacingOuter; + let indentationNext = indentation + config.indent; + for (let i = 0; i < list.length; i++) { + if (result += indentationNext, i === config.maxWidth) { + result += "\u2026"; + break; + } + i in list && (result += printer(list[i], config, indentationNext, depth, refs)), i < list.length - 1 ? result += `,${config.spacingInner}` : config.min || (result += ","); + } + result += config.spacingOuter + indentation; + } + return result; + } + function printObjectProperties(val, config, indentation, depth, refs, printer) { + let result = "", keys = getKeysOfEnumerableProperties(val, config.compareKeys); + if (keys.length) { + result += config.spacingOuter; + let indentationNext = indentation + config.indent; + for (let i = 0; i < keys.length; i++) { + let key = keys[i], name = printer(key, config, indentationNext, depth, refs), value = printer(val[key], config, indentationNext, depth, refs); + result += `${indentationNext + name}: ${value}`, i < keys.length - 1 ? result += `,${config.spacingInner}` : config.min || (result += ","); + } + result += config.spacingOuter + indentation; + } + return result; + } + } +}), require_AsymmetricMatcher = __commonJS({ + "node_modules/pretty-format/build/plugins/AsymmetricMatcher.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.test = exports.serialize = exports.default = void 0; + var _collections = require_collections(), Symbol2 = globalThis["jest-symbol-do-not-touch"] || globalThis.Symbol, asymmetricMatcher = typeof Symbol2 == "function" && Symbol2.for ? Symbol2.for("jest.asymmetricMatcher") : 1267621, SPACE = " ", serialize = (val, config, indentation, depth, refs, printer) => { + let stringedValue = val.toString(); + if (stringedValue === "ArrayContaining" || stringedValue === "ArrayNotContaining") + return ++depth > config.maxDepth ? `[${stringedValue}]` : `${stringedValue + SPACE}[${(0, _collections.printListItems)(val.sample, config, indentation, depth, refs, printer)}]`; + if (stringedValue === "ObjectContaining" || stringedValue === "ObjectNotContaining") + return ++depth > config.maxDepth ? `[${stringedValue}]` : `${stringedValue + SPACE}{${(0, _collections.printObjectProperties)(val.sample, config, indentation, depth, refs, printer)}}`; + if (stringedValue === "StringMatching" || stringedValue === "StringNotMatching" || stringedValue === "StringContaining" || stringedValue === "StringNotContaining") + return stringedValue + SPACE + printer(val.sample, config, indentation, depth, refs); + if (typeof val.toAsymmetricMatcher != "function") + throw new Error(`Asymmetric matcher ${val.constructor.name} does not implement toAsymmetricMatcher()`); + return val.toAsymmetricMatcher(); + }; + exports.serialize = serialize; + var test = (val) => val && val.$$typeof === asymmetricMatcher; + exports.test = test; + var plugin = { + serialize, + test + }, _default = plugin; + exports.default = _default; + } +}), require_ansi_regex = __commonJS({ + "node_modules/ansi-regex/index.js"(exports, module) { + "use strict"; + module.exports = ({ onlyFirst = !1 } = {}) => { + let pattern = [ + "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", + "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))" + ].join("|"); + return new RegExp(pattern, onlyFirst ? void 0 : "g"); + }; + } +}), require_ConvertAnsi = __commonJS({ + "node_modules/pretty-format/build/plugins/ConvertAnsi.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.test = exports.serialize = exports.default = void 0; + var _ansiRegex = _interopRequireDefault(require_ansi_regex()), _ansiStyles = _interopRequireDefault(require_ansi_styles()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + var toHumanReadableAnsi = (text) => text.replace((0, _ansiRegex.default)(), (match) => { + switch (match) { + case _ansiStyles.default.red.close: + case _ansiStyles.default.green.close: + case _ansiStyles.default.cyan.close: + case _ansiStyles.default.gray.close: + case _ansiStyles.default.white.close: + case _ansiStyles.default.yellow.close: + case _ansiStyles.default.bgRed.close: + case _ansiStyles.default.bgGreen.close: + case _ansiStyles.default.bgYellow.close: + case _ansiStyles.default.inverse.close: + case _ansiStyles.default.dim.close: + case _ansiStyles.default.bold.close: + case _ansiStyles.default.reset.open: + case _ansiStyles.default.reset.close: + return ""; + case _ansiStyles.default.red.open: + return ""; + case _ansiStyles.default.green.open: + return ""; + case _ansiStyles.default.cyan.open: + return ""; + case _ansiStyles.default.gray.open: + return ""; + case _ansiStyles.default.white.open: + return ""; + case _ansiStyles.default.yellow.open: + return ""; + case _ansiStyles.default.bgRed.open: + return ""; + case _ansiStyles.default.bgGreen.open: + return ""; + case _ansiStyles.default.bgYellow.open: + return ""; + case _ansiStyles.default.inverse.open: + return ""; + case _ansiStyles.default.dim.open: + return ""; + case _ansiStyles.default.bold.open: + return ""; + default: + return ""; + } + }), test = (val) => typeof val == "string" && !!val.match((0, _ansiRegex.default)()); + exports.test = test; + var serialize = (val, config, indentation, depth, refs, printer) => printer(toHumanReadableAnsi(val), config, indentation, depth, refs); + exports.serialize = serialize; + var plugin = { + serialize, + test + }, _default = plugin; + exports.default = _default; + } +}), require_DOMCollection = __commonJS({ + "node_modules/pretty-format/build/plugins/DOMCollection.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.test = exports.serialize = exports.default = void 0; + var _collections = require_collections(), SPACE = " ", OBJECT_NAMES = ["DOMStringMap", "NamedNodeMap"], ARRAY_REGEXP = /^(HTML\w*Collection|NodeList)$/, testName = (name) => OBJECT_NAMES.indexOf(name) !== -1 || ARRAY_REGEXP.test(name), test = (val) => val && val.constructor && !!val.constructor.name && testName(val.constructor.name); + exports.test = test; + var isNamedNodeMap = (collection) => collection.constructor.name === "NamedNodeMap", serialize = (collection, config, indentation, depth, refs, printer) => { + let name = collection.constructor.name; + return ++depth > config.maxDepth ? `[${name}]` : (config.min ? "" : name + SPACE) + (OBJECT_NAMES.indexOf(name) !== -1 ? `{${(0, _collections.printObjectProperties)(isNamedNodeMap(collection) ? Array.from(collection).reduce((props, attribute) => (props[attribute.name] = attribute.value, props), {}) : { ...collection }, config, indentation, depth, refs, printer)}}` : `[${(0, _collections.printListItems)(Array.from(collection), config, indentation, depth, refs, printer)}]`); + }; + exports.serialize = serialize; + var plugin = { + serialize, + test + }, _default = plugin; + exports.default = _default; + } +}), require_escapeHTML = __commonJS({ + "node_modules/pretty-format/build/plugins/lib/escapeHTML.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.default = escapeHTML; + function escapeHTML(str) { + return str.replace(//g, ">"); + } + } +}), require_markup = __commonJS({ + "node_modules/pretty-format/build/plugins/lib/markup.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.printText = exports.printProps = exports.printElementAsLeaf = exports.printElement = exports.printComment = exports.printChildren = void 0; + var _escapeHTML = _interopRequireDefault(require_escapeHTML()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + var printProps = (keys, props, config, indentation, depth, refs, printer) => { + let indentationNext = indentation + config.indent, colors = config.colors; + return keys.map((key) => { + let value = props[key], printed = printer(value, config, indentationNext, depth, refs); + return typeof value != "string" && (printed.indexOf(` +`) !== -1 && (printed = config.spacingOuter + indentationNext + printed + config.spacingOuter + indentation), printed = `{${printed}}`), `${config.spacingInner + indentation + colors.prop.open + key + colors.prop.close}=${colors.value.open}${printed}${colors.value.close}`; + }).join(""); + }; + exports.printProps = printProps; + var printChildren = (children, config, indentation, depth, refs, printer) => children.map((child) => config.spacingOuter + indentation + (typeof child == "string" ? printText(child, config) : printer(child, config, indentation, depth, refs))).join(""); + exports.printChildren = printChildren; + var printText = (text, config) => { + let contentColor = config.colors.content; + return contentColor.open + (0, _escapeHTML.default)(text) + contentColor.close; + }; + exports.printText = printText; + var printComment = (comment, config) => { + let commentColor = config.colors.comment; + return `${commentColor.open}${commentColor.close}`; + }; + exports.printComment = printComment; + var printElement = (type, printedProps, printedChildren, config, indentation) => { + let tagColor = config.colors.tag; + return `${tagColor.open}<${type}${printedProps && tagColor.close + printedProps + config.spacingOuter + indentation + tagColor.open}${printedChildren ? `>${tagColor.close}${printedChildren}${config.spacingOuter}${indentation}${tagColor.open}${tagColor.close}`; + }; + exports.printElement = printElement; + var printElementAsLeaf = (type, config) => { + let tagColor = config.colors.tag; + return `${tagColor.open}<${type}${tagColor.close} \u2026${tagColor.open} />${tagColor.close}`; + }; + exports.printElementAsLeaf = printElementAsLeaf; + } +}), require_DOMElement = __commonJS({ + "node_modules/pretty-format/build/plugins/DOMElement.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.test = exports.serialize = exports.default = void 0; + var _markup = require_markup(), ELEMENT_NODE = 1, TEXT_NODE = 3, COMMENT_NODE = 8, FRAGMENT_NODE = 11, ELEMENT_REGEXP = /^((HTML|SVG)\w*)?Element$/, testHasAttribute = (val) => { + try { + return typeof val.hasAttribute == "function" && val.hasAttribute("is"); + } catch { + return !1; + } + }, testNode = (val) => { + let constructorName = val.constructor.name, { nodeType, tagName } = val, isCustomElement = typeof tagName == "string" && tagName.includes("-") || testHasAttribute(val); + return nodeType === ELEMENT_NODE && (ELEMENT_REGEXP.test(constructorName) || isCustomElement) || nodeType === TEXT_NODE && constructorName === "Text" || nodeType === COMMENT_NODE && constructorName === "Comment" || nodeType === FRAGMENT_NODE && constructorName === "DocumentFragment"; + }, test = (val) => { + var _val$constructor; + return (val == null || (_val$constructor = val.constructor) === null || _val$constructor === void 0 ? void 0 : _val$constructor.name) && testNode(val); + }; + exports.test = test; + function nodeIsText(node) { + return node.nodeType === TEXT_NODE; + } + function nodeIsComment(node) { + return node.nodeType === COMMENT_NODE; + } + function nodeIsFragment(node) { + return node.nodeType === FRAGMENT_NODE; + } + var serialize = (node, config, indentation, depth, refs, printer) => { + if (nodeIsText(node)) + return (0, _markup.printText)(node.data, config); + if (nodeIsComment(node)) + return (0, _markup.printComment)(node.data, config); + let type = nodeIsFragment(node) ? "DocumentFragment" : node.tagName.toLowerCase(); + return ++depth > config.maxDepth ? (0, _markup.printElementAsLeaf)(type, config) : (0, _markup.printElement)(type, (0, _markup.printProps)(nodeIsFragment(node) ? [] : Array.from(node.attributes).map((attr) => attr.name).sort(), nodeIsFragment(node) ? {} : Array.from(node.attributes).reduce((props, attribute) => (props[attribute.name] = attribute.value, props), {}), config, indentation + config.indent, depth, refs, printer), (0, _markup.printChildren)(Array.prototype.slice.call(node.childNodes || node.children), config, indentation + config.indent, depth, refs, printer), config, indentation); + }; + exports.serialize = serialize; + var plugin = { + serialize, + test + }, _default = plugin; + exports.default = _default; + } +}), require_Immutable = __commonJS({ + "node_modules/pretty-format/build/plugins/Immutable.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.test = exports.serialize = exports.default = void 0; + var _collections = require_collections(), IS_ITERABLE_SENTINEL = "@@__IMMUTABLE_ITERABLE__@@", IS_LIST_SENTINEL = "@@__IMMUTABLE_LIST__@@", IS_KEYED_SENTINEL = "@@__IMMUTABLE_KEYED__@@", IS_MAP_SENTINEL = "@@__IMMUTABLE_MAP__@@", IS_ORDERED_SENTINEL = "@@__IMMUTABLE_ORDERED__@@", IS_RECORD_SENTINEL = "@@__IMMUTABLE_RECORD__@@", IS_SEQ_SENTINEL = "@@__IMMUTABLE_SEQ__@@", IS_SET_SENTINEL = "@@__IMMUTABLE_SET__@@", IS_STACK_SENTINEL = "@@__IMMUTABLE_STACK__@@", getImmutableName = (name) => `Immutable.${name}`, printAsLeaf = (name) => `[${name}]`, SPACE = " ", LAZY = "\u2026", printImmutableEntries = (val, config, indentation, depth, refs, printer, type) => ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : `${getImmutableName(type) + SPACE}{${(0, _collections.printIteratorEntries)(val.entries(), config, indentation, depth, refs, printer)}}`; + function getRecordEntries(val) { + let i = 0; + return { + next() { + if (i < val._keys.length) { + let key = val._keys[i++]; + return { + done: !1, + value: [key, val.get(key)] + }; + } + return { + done: !0, + value: void 0 + }; + } + }; + } + var printImmutableRecord = (val, config, indentation, depth, refs, printer) => { + let name = getImmutableName(val._name || "Record"); + return ++depth > config.maxDepth ? printAsLeaf(name) : `${name + SPACE}{${(0, _collections.printIteratorEntries)(getRecordEntries(val), config, indentation, depth, refs, printer)}}`; + }, printImmutableSeq = (val, config, indentation, depth, refs, printer) => { + let name = getImmutableName("Seq"); + return ++depth > config.maxDepth ? printAsLeaf(name) : val[IS_KEYED_SENTINEL] ? `${name + SPACE}{${val._iter || val._object ? (0, _collections.printIteratorEntries)(val.entries(), config, indentation, depth, refs, printer) : LAZY}}` : `${name + SPACE}[${val._iter || val._array || val._collection || val._iterable ? (0, _collections.printIteratorValues)(val.values(), config, indentation, depth, refs, printer) : LAZY}]`; + }, printImmutableValues = (val, config, indentation, depth, refs, printer, type) => ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : `${getImmutableName(type) + SPACE}[${(0, _collections.printIteratorValues)(val.values(), config, indentation, depth, refs, printer)}]`, serialize = (val, config, indentation, depth, refs, printer) => val[IS_MAP_SENTINEL] ? printImmutableEntries(val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL] ? "OrderedMap" : "Map") : val[IS_LIST_SENTINEL] ? printImmutableValues(val, config, indentation, depth, refs, printer, "List") : val[IS_SET_SENTINEL] ? printImmutableValues(val, config, indentation, depth, refs, printer, val[IS_ORDERED_SENTINEL] ? "OrderedSet" : "Set") : val[IS_STACK_SENTINEL] ? printImmutableValues(val, config, indentation, depth, refs, printer, "Stack") : val[IS_SEQ_SENTINEL] ? printImmutableSeq(val, config, indentation, depth, refs, printer) : printImmutableRecord(val, config, indentation, depth, refs, printer); + exports.serialize = serialize; + var test = (val) => val && (val[IS_ITERABLE_SENTINEL] === !0 || val[IS_RECORD_SENTINEL] === !0); + exports.test = test; + var plugin = { + serialize, + test + }, _default = plugin; + exports.default = _default; + } +}), require_react_is_production_min = __commonJS({ + "node_modules/react-is/cjs/react-is.production.min.js"(exports) { + "use strict"; + var b = /* @__PURE__ */ Symbol.for("react.element"), c = /* @__PURE__ */ Symbol.for("react.portal"), d = /* @__PURE__ */ Symbol.for("react.fragment"), e = /* @__PURE__ */ Symbol.for("react.strict_mode"), f = /* @__PURE__ */ Symbol.for("react.profiler"), g = /* @__PURE__ */ Symbol.for("react.provider"), h = /* @__PURE__ */ Symbol.for("react.context"), k = /* @__PURE__ */ Symbol.for("react.server_context"), l = /* @__PURE__ */ Symbol.for("react.forward_ref"), m = /* @__PURE__ */ Symbol.for("react.suspense"), n = /* @__PURE__ */ Symbol.for("react.suspense_list"), p = /* @__PURE__ */ Symbol.for("react.memo"), q = /* @__PURE__ */ Symbol.for("react.lazy"), t = /* @__PURE__ */ Symbol.for("react.offscreen"), u; + u = /* @__PURE__ */ Symbol.for("react.module.reference"); + function v(a) { + if (typeof a == "object" && a !== null) { + var r = a.$$typeof; + switch (r) { + case b: + switch (a = a.type, a) { + case d: + case f: + case e: + case m: + case n: + return a; + default: + switch (a = a && a.$$typeof, a) { + case k: + case h: + case l: + case q: + case p: + case g: + return a; + default: + return r; + } + } + case c: + return r; + } + } + } + exports.ContextConsumer = h, exports.ContextProvider = g, exports.Element = b, exports.ForwardRef = l, exports.Fragment = d, exports.Lazy = q, exports.Memo = p, exports.Portal = c, exports.Profiler = f, exports.StrictMode = e, exports.Suspense = m, exports.SuspenseList = n, exports.isAsyncMode = function() { + return !1; + }, exports.isConcurrentMode = function() { + return !1; + }, exports.isContextConsumer = function(a) { + return v(a) === h; + }, exports.isContextProvider = function(a) { + return v(a) === g; + }, exports.isElement = function(a) { + return typeof a == "object" && a !== null && a.$$typeof === b; + }, exports.isForwardRef = function(a) { + return v(a) === l; + }, exports.isFragment = function(a) { + return v(a) === d; + }, exports.isLazy = function(a) { + return v(a) === q; + }, exports.isMemo = function(a) { + return v(a) === p; + }, exports.isPortal = function(a) { + return v(a) === c; + }, exports.isProfiler = function(a) { + return v(a) === f; + }, exports.isStrictMode = function(a) { + return v(a) === e; + }, exports.isSuspense = function(a) { + return v(a) === m; + }, exports.isSuspenseList = function(a) { + return v(a) === n; + }, exports.isValidElementType = function(a) { + return typeof a == "string" || typeof a == "function" || a === d || a === f || a === e || a === m || a === n || a === t || typeof a == "object" && a !== null && (a.$$typeof === q || a.$$typeof === p || a.$$typeof === g || a.$$typeof === h || a.$$typeof === l || a.$$typeof === u || a.getModuleId !== void 0); + }, exports.typeOf = v; + } +}), require_react_is_development = __commonJS({ + "node_modules/react-is/cjs/react-is.development.js"(exports) { + "use strict"; + process.env.NODE_ENV !== "production" && (function() { + "use strict"; + var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.element"), REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler"), REACT_PROVIDER_TYPE = /* @__PURE__ */ Symbol.for("react.provider"), REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context"), REACT_SERVER_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.server_context"), REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo"), REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"), REACT_OFFSCREEN_TYPE = /* @__PURE__ */ Symbol.for("react.offscreen"), enableScopeAPI = !1, enableCacheElement = !1, enableTransitionTracing = !1, enableLegacyHidden = !1, enableDebugTracing = !1, REACT_MODULE_REFERENCE; + REACT_MODULE_REFERENCE = /* @__PURE__ */ Symbol.for("react.module.reference"); + function isValidElementType(type) { + return !!(typeof type == "string" || typeof type == "function" || type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || enableDebugTracing || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || enableLegacyHidden || type === REACT_OFFSCREEN_TYPE || enableScopeAPI || enableCacheElement || enableTransitionTracing || typeof type == "object" && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_MODULE_REFERENCE || type.getModuleId !== void 0)); + } + function typeOf(object) { + if (typeof object == "object" && object !== null) { + var $$typeof = object.$$typeof; + switch ($$typeof) { + case REACT_ELEMENT_TYPE: + var type = object.type; + switch (type) { + case REACT_FRAGMENT_TYPE: + case REACT_PROFILER_TYPE: + case REACT_STRICT_MODE_TYPE: + case REACT_SUSPENSE_TYPE: + case REACT_SUSPENSE_LIST_TYPE: + return type; + default: + var $$typeofType = type && type.$$typeof; + switch ($$typeofType) { + case REACT_SERVER_CONTEXT_TYPE: + case REACT_CONTEXT_TYPE: + case REACT_FORWARD_REF_TYPE: + case REACT_LAZY_TYPE: + case REACT_MEMO_TYPE: + case REACT_PROVIDER_TYPE: + return $$typeofType; + default: + return $$typeof; + } + } + case REACT_PORTAL_TYPE: + return $$typeof; + } + } + } + var ContextConsumer = REACT_CONTEXT_TYPE, ContextProvider = REACT_PROVIDER_TYPE, Element = REACT_ELEMENT_TYPE, ForwardRef = REACT_FORWARD_REF_TYPE, Fragment = REACT_FRAGMENT_TYPE, Lazy = REACT_LAZY_TYPE, Memo = REACT_MEMO_TYPE, Portal = REACT_PORTAL_TYPE, Profiler = REACT_PROFILER_TYPE, StrictMode = REACT_STRICT_MODE_TYPE, Suspense = REACT_SUSPENSE_TYPE, SuspenseList = REACT_SUSPENSE_LIST_TYPE, hasWarnedAboutDeprecatedIsAsyncMode = !1, hasWarnedAboutDeprecatedIsConcurrentMode = !1; + function isAsyncMode(object) { + return hasWarnedAboutDeprecatedIsAsyncMode || (hasWarnedAboutDeprecatedIsAsyncMode = !0, console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 18+.")), !1; + } + function isConcurrentMode(object) { + return hasWarnedAboutDeprecatedIsConcurrentMode || (hasWarnedAboutDeprecatedIsConcurrentMode = !0, console.warn("The ReactIs.isConcurrentMode() alias has been deprecated, and will be removed in React 18+.")), !1; + } + function isContextConsumer(object) { + return typeOf(object) === REACT_CONTEXT_TYPE; + } + function isContextProvider(object) { + return typeOf(object) === REACT_PROVIDER_TYPE; + } + function isElement(object) { + return typeof object == "object" && object !== null && object.$$typeof === REACT_ELEMENT_TYPE; + } + function isForwardRef(object) { + return typeOf(object) === REACT_FORWARD_REF_TYPE; + } + function isFragment(object) { + return typeOf(object) === REACT_FRAGMENT_TYPE; + } + function isLazy(object) { + return typeOf(object) === REACT_LAZY_TYPE; + } + function isMemo(object) { + return typeOf(object) === REACT_MEMO_TYPE; + } + function isPortal(object) { + return typeOf(object) === REACT_PORTAL_TYPE; + } + function isProfiler(object) { + return typeOf(object) === REACT_PROFILER_TYPE; + } + function isStrictMode(object) { + return typeOf(object) === REACT_STRICT_MODE_TYPE; + } + function isSuspense(object) { + return typeOf(object) === REACT_SUSPENSE_TYPE; + } + function isSuspenseList(object) { + return typeOf(object) === REACT_SUSPENSE_LIST_TYPE; + } + exports.ContextConsumer = ContextConsumer, exports.ContextProvider = ContextProvider, exports.Element = Element, exports.ForwardRef = ForwardRef, exports.Fragment = Fragment, exports.Lazy = Lazy, exports.Memo = Memo, exports.Portal = Portal, exports.Profiler = Profiler, exports.StrictMode = StrictMode, exports.Suspense = Suspense, exports.SuspenseList = SuspenseList, exports.isAsyncMode = isAsyncMode, exports.isConcurrentMode = isConcurrentMode, exports.isContextConsumer = isContextConsumer, exports.isContextProvider = isContextProvider, exports.isElement = isElement, exports.isForwardRef = isForwardRef, exports.isFragment = isFragment, exports.isLazy = isLazy, exports.isMemo = isMemo, exports.isPortal = isPortal, exports.isProfiler = isProfiler, exports.isStrictMode = isStrictMode, exports.isSuspense = isSuspense, exports.isSuspenseList = isSuspenseList, exports.isValidElementType = isValidElementType, exports.typeOf = typeOf; + })(); + } +}), require_react_is = __commonJS({ + "node_modules/react-is/index.js"(exports, module) { + "use strict"; + process.env.NODE_ENV === "production" ? module.exports = require_react_is_production_min() : module.exports = require_react_is_development(); + } +}), require_ReactElement = __commonJS({ + "node_modules/pretty-format/build/plugins/ReactElement.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.test = exports.serialize = exports.default = void 0; + var ReactIs = _interopRequireWildcard(require_react_is()), _markup = require_markup(); + function _getRequireWildcardCache(nodeInterop) { + if (typeof WeakMap != "function") + return null; + var cacheBabelInterop = /* @__PURE__ */ new WeakMap(), cacheNodeInterop = /* @__PURE__ */ new WeakMap(); + return (_getRequireWildcardCache = function(nodeInterop2) { + return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop; + })(nodeInterop); + } + function _interopRequireWildcard(obj, nodeInterop) { + if (!nodeInterop && obj && obj.__esModule) + return obj; + if (obj === null || typeof obj != "object" && typeof obj != "function") + return { default: obj }; + var cache = _getRequireWildcardCache(nodeInterop); + if (cache && cache.has(obj)) + return cache.get(obj); + var newObj = {}, hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; + for (var key in obj) + if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { + var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; + desc && (desc.get || desc.set) ? Object.defineProperty(newObj, key, desc) : newObj[key] = obj[key]; + } + return newObj.default = obj, cache && cache.set(obj, newObj), newObj; + } + var getChildren = (arg, children = []) => (Array.isArray(arg) ? arg.forEach((item) => { + getChildren(item, children); + }) : arg != null && arg !== !1 && children.push(arg), children), getType = (element) => { + let type = element.type; + if (typeof type == "string") + return type; + if (typeof type == "function") + return type.displayName || type.name || "Unknown"; + if (ReactIs.isFragment(element)) + return "React.Fragment"; + if (ReactIs.isSuspense(element)) + return "React.Suspense"; + if (typeof type == "object" && type !== null) { + if (ReactIs.isContextProvider(element)) + return "Context.Provider"; + if (ReactIs.isContextConsumer(element)) + return "Context.Consumer"; + if (ReactIs.isForwardRef(element)) { + if (type.displayName) + return type.displayName; + let functionName = type.render.displayName || type.render.name || ""; + return functionName !== "" ? `ForwardRef(${functionName})` : "ForwardRef"; + } + if (ReactIs.isMemo(element)) { + let functionName = type.displayName || type.type.displayName || type.type.name || ""; + return functionName !== "" ? `Memo(${functionName})` : "Memo"; + } + } + return "UNDEFINED"; + }, getPropKeys = (element) => { + let { props } = element; + return Object.keys(props).filter((key) => key !== "children" && props[key] !== void 0).sort(); + }, serialize = (element, config, indentation, depth, refs, printer) => ++depth > config.maxDepth ? (0, _markup.printElementAsLeaf)(getType(element), config) : (0, _markup.printElement)(getType(element), (0, _markup.printProps)(getPropKeys(element), element.props, config, indentation + config.indent, depth, refs, printer), (0, _markup.printChildren)(getChildren(element.props.children), config, indentation + config.indent, depth, refs, printer), config, indentation); + exports.serialize = serialize; + var test = (val) => val != null && ReactIs.isElement(val); + exports.test = test; + var plugin = { + serialize, + test + }, _default = plugin; + exports.default = _default; + } +}), require_ReactTestComponent = __commonJS({ + "node_modules/pretty-format/build/plugins/ReactTestComponent.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.test = exports.serialize = exports.default = void 0; + var _markup = require_markup(), Symbol2 = globalThis["jest-symbol-do-not-touch"] || globalThis.Symbol, testSymbol = typeof Symbol2 == "function" && Symbol2.for ? Symbol2.for("react.test.json") : 245830487, getPropKeys = (object) => { + let { props } = object; + return props ? Object.keys(props).filter((key) => props[key] !== void 0).sort() : []; + }, serialize = (object, config, indentation, depth, refs, printer) => ++depth > config.maxDepth ? (0, _markup.printElementAsLeaf)(object.type, config) : (0, _markup.printElement)(object.type, object.props ? (0, _markup.printProps)(getPropKeys(object), object.props, config, indentation + config.indent, depth, refs, printer) : "", object.children ? (0, _markup.printChildren)(object.children, config, indentation + config.indent, depth, refs, printer) : "", config, indentation); + exports.serialize = serialize; + var test = (val) => val && val.$$typeof === testSymbol; + exports.test = test; + var plugin = { + serialize, + test + }, _default = plugin; + exports.default = _default; + } +}), require_build = __commonJS({ + "node_modules/pretty-format/build/index.js"(exports) { + "use strict"; + Object.defineProperty(exports, "__esModule", { + value: !0 + }), exports.default = exports.DEFAULT_OPTIONS = void 0, exports.format = format, exports.plugins = void 0; + var _ansiStyles = _interopRequireDefault(require_ansi_styles()), _collections = require_collections(), _AsymmetricMatcher = _interopRequireDefault(require_AsymmetricMatcher()), _ConvertAnsi = _interopRequireDefault(require_ConvertAnsi()), _DOMCollection = _interopRequireDefault(require_DOMCollection()), _DOMElement = _interopRequireDefault(require_DOMElement()), _Immutable = _interopRequireDefault(require_Immutable()), _ReactElement = _interopRequireDefault(require_ReactElement()), _ReactTestComponent = _interopRequireDefault(require_ReactTestComponent()); + function _interopRequireDefault(obj) { + return obj && obj.__esModule ? obj : { default: obj }; + } + var toString = Object.prototype.toString, toISOString = Date.prototype.toISOString, errorToString = Error.prototype.toString, regExpToString = RegExp.prototype.toString, getConstructorName = (val) => typeof val.constructor == "function" && val.constructor.name || "Object", isWindow = (val) => typeof window < "u" && val === window, SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/, NEWLINE_REGEXP = /\n/gi, PrettyFormatPluginError = class extends Error { + constructor(message, stack) { + super(message), this.stack = stack, this.name = this.constructor.name; + } + }; + function isToStringedArrayType(toStringed) { + return toStringed === "[object Array]" || toStringed === "[object ArrayBuffer]" || toStringed === "[object DataView]" || toStringed === "[object Float32Array]" || toStringed === "[object Float64Array]" || toStringed === "[object Int8Array]" || toStringed === "[object Int16Array]" || toStringed === "[object Int32Array]" || toStringed === "[object Uint8Array]" || toStringed === "[object Uint8ClampedArray]" || toStringed === "[object Uint16Array]" || toStringed === "[object Uint32Array]"; + } + function printNumber(val) { + return Object.is(val, -0) ? "-0" : String(val); + } + function printBigInt(val) { + return `${val}n`; + } + function printFunction(val, printFunctionName) { + return printFunctionName ? `[Function ${val.name || "anonymous"}]` : "[Function]"; + } + function printSymbol(val) { + return String(val).replace(SYMBOL_REGEXP, "Symbol($1)"); + } + function printError(val) { + return `[${errorToString.call(val)}]`; + } + function printBasicValue(val, printFunctionName, escapeRegex, escapeString) { + if (val === !0 || val === !1) + return `${val}`; + if (val === void 0) + return "undefined"; + if (val === null) + return "null"; + let typeOf = typeof val; + if (typeOf === "number") + return printNumber(val); + if (typeOf === "bigint") + return printBigInt(val); + if (typeOf === "string") + return escapeString ? `"${val.replace(/"|\\/g, "\\$&")}"` : `"${val}"`; + if (typeOf === "function") + return printFunction(val, printFunctionName); + if (typeOf === "symbol") + return printSymbol(val); + let toStringed = toString.call(val); + return toStringed === "[object WeakMap]" ? "WeakMap {}" : toStringed === "[object WeakSet]" ? "WeakSet {}" : toStringed === "[object Function]" || toStringed === "[object GeneratorFunction]" ? printFunction(val, printFunctionName) : toStringed === "[object Symbol]" ? printSymbol(val) : toStringed === "[object Date]" ? isNaN(+val) ? "Date { NaN }" : toISOString.call(val) : toStringed === "[object Error]" ? printError(val) : toStringed === "[object RegExp]" ? escapeRegex ? regExpToString.call(val).replace(/[\\^$*+?.()|[\]{}]/g, "\\$&") : regExpToString.call(val) : val instanceof Error ? printError(val) : null; + } + function printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON) { + if (refs.indexOf(val) !== -1) + return "[Circular]"; + refs = refs.slice(), refs.push(val); + let hitMaxDepth = ++depth > config.maxDepth, min = config.min; + if (config.callToJSON && !hitMaxDepth && val.toJSON && typeof val.toJSON == "function" && !hasCalledToJSON) + return printer(val.toJSON(), config, indentation, depth, refs, !0); + let toStringed = toString.call(val); + return toStringed === "[object Arguments]" ? hitMaxDepth ? "[Arguments]" : `${min ? "" : "Arguments "}[${(0, _collections.printListItems)(val, config, indentation, depth, refs, printer)}]` : isToStringedArrayType(toStringed) ? hitMaxDepth ? `[${val.constructor.name}]` : `${min || !config.printBasicPrototype && val.constructor.name === "Array" ? "" : `${val.constructor.name} `}[${(0, _collections.printListItems)(val, config, indentation, depth, refs, printer)}]` : toStringed === "[object Map]" ? hitMaxDepth ? "[Map]" : `Map {${(0, _collections.printIteratorEntries)(val.entries(), config, indentation, depth, refs, printer, " => ")}}` : toStringed === "[object Set]" ? hitMaxDepth ? "[Set]" : `Set {${(0, _collections.printIteratorValues)(val.values(), config, indentation, depth, refs, printer)}}` : hitMaxDepth || isWindow(val) ? `[${getConstructorName(val)}]` : `${min || !config.printBasicPrototype && getConstructorName(val) === "Object" ? "" : `${getConstructorName(val)} `}{${(0, _collections.printObjectProperties)(val, config, indentation, depth, refs, printer)}}`; + } + function isNewPlugin(plugin) { + return plugin.serialize != null; + } + function printPlugin(plugin, val, config, indentation, depth, refs) { + let printed; + try { + printed = isNewPlugin(plugin) ? plugin.serialize(val, config, indentation, depth, refs, printer) : plugin.print(val, (valChild) => printer(valChild, config, indentation, depth, refs), (str) => { + let indentationNext = indentation + config.indent; + return indentationNext + str.replace(NEWLINE_REGEXP, ` +${indentationNext}`); + }, { + edgeSpacing: config.spacingOuter, + min: config.min, + spacing: config.spacingInner + }, config.colors); + } catch (error) { + throw new PrettyFormatPluginError(error.message, error.stack); + } + if (typeof printed != "string") + throw new Error(`pretty-format: Plugin must return type "string" but instead returned "${typeof printed}".`); + return printed; + } + function findPlugin(plugins2, val) { + for (let p = 0; p < plugins2.length; p++) + try { + if (plugins2[p].test(val)) + return plugins2[p]; + } catch (error) { + throw new PrettyFormatPluginError(error.message, error.stack); + } + return null; + } + function printer(val, config, indentation, depth, refs, hasCalledToJSON) { + let plugin = findPlugin(config.plugins, val); + if (plugin !== null) + return printPlugin(plugin, val, config, indentation, depth, refs); + let basicResult = printBasicValue(val, config.printFunctionName, config.escapeRegex, config.escapeString); + return basicResult !== null ? basicResult : printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON); + } + var DEFAULT_THEME = { + comment: "gray", + content: "reset", + prop: "yellow", + tag: "cyan", + value: "green" + }, DEFAULT_THEME_KEYS = Object.keys(DEFAULT_THEME), DEFAULT_OPTIONS = { + callToJSON: !0, + compareKeys: void 0, + escapeRegex: !1, + escapeString: !0, + highlight: !1, + indent: 2, + maxDepth: 1 / 0, + maxWidth: 1 / 0, + min: !1, + plugins: [], + printBasicPrototype: !0, + printFunctionName: !0, + theme: DEFAULT_THEME + }; + exports.DEFAULT_OPTIONS = DEFAULT_OPTIONS; + function validateOptions(options) { + if (Object.keys(options).forEach((key) => { + if (!Object.prototype.hasOwnProperty.call(DEFAULT_OPTIONS, key)) + throw new Error(`pretty-format: Unknown option "${key}".`); + }), options.min && options.indent !== void 0 && options.indent !== 0) + throw new Error('pretty-format: Options "min" and "indent" cannot be used together.'); + if (options.theme !== void 0) { + if (options.theme === null) + throw new Error('pretty-format: Option "theme" must not be null.'); + if (typeof options.theme != "object") + throw new Error(`pretty-format: Option "theme" must be of type "object" but instead received "${typeof options.theme}".`); + } + } + var getColorsHighlight = (options) => DEFAULT_THEME_KEYS.reduce((colors, key) => { + let value = options.theme && options.theme[key] !== void 0 ? options.theme[key] : DEFAULT_THEME[key], color = value && _ansiStyles.default[value]; + if (color && typeof color.close == "string" && typeof color.open == "string") + colors[key] = color; + else + throw new Error(`pretty-format: Option "theme" has a key "${key}" whose value "${value}" is undefined in ansi-styles.`); + return colors; + }, /* @__PURE__ */ Object.create(null)), getColorsEmpty = () => DEFAULT_THEME_KEYS.reduce((colors, key) => (colors[key] = { + close: "", + open: "" + }, colors), /* @__PURE__ */ Object.create(null)), getPrintFunctionName = (options) => { + var _options$printFunctio; + return (_options$printFunctio = options?.printFunctionName) !== null && _options$printFunctio !== void 0 ? _options$printFunctio : DEFAULT_OPTIONS.printFunctionName; + }, getEscapeRegex = (options) => { + var _options$escapeRegex; + return (_options$escapeRegex = options?.escapeRegex) !== null && _options$escapeRegex !== void 0 ? _options$escapeRegex : DEFAULT_OPTIONS.escapeRegex; + }, getEscapeString = (options) => { + var _options$escapeString; + return (_options$escapeString = options?.escapeString) !== null && _options$escapeString !== void 0 ? _options$escapeString : DEFAULT_OPTIONS.escapeString; + }, getConfig = (options) => { + var _options$callToJSON, _options$indent, _options$maxDepth, _options$maxWidth, _options$min, _options$plugins, _options$printBasicPr; + return { + callToJSON: (_options$callToJSON = options?.callToJSON) !== null && _options$callToJSON !== void 0 ? _options$callToJSON : DEFAULT_OPTIONS.callToJSON, + colors: options != null && options.highlight ? getColorsHighlight(options) : getColorsEmpty(), + compareKeys: typeof options?.compareKeys == "function" ? options.compareKeys : DEFAULT_OPTIONS.compareKeys, + escapeRegex: getEscapeRegex(options), + escapeString: getEscapeString(options), + indent: options != null && options.min ? "" : createIndent((_options$indent = options?.indent) !== null && _options$indent !== void 0 ? _options$indent : DEFAULT_OPTIONS.indent), + maxDepth: (_options$maxDepth = options?.maxDepth) !== null && _options$maxDepth !== void 0 ? _options$maxDepth : DEFAULT_OPTIONS.maxDepth, + maxWidth: (_options$maxWidth = options?.maxWidth) !== null && _options$maxWidth !== void 0 ? _options$maxWidth : DEFAULT_OPTIONS.maxWidth, + min: (_options$min = options?.min) !== null && _options$min !== void 0 ? _options$min : DEFAULT_OPTIONS.min, + plugins: (_options$plugins = options?.plugins) !== null && _options$plugins !== void 0 ? _options$plugins : DEFAULT_OPTIONS.plugins, + printBasicPrototype: (_options$printBasicPr = options?.printBasicPrototype) !== null && _options$printBasicPr !== void 0 ? _options$printBasicPr : !0, + printFunctionName: getPrintFunctionName(options), + spacingInner: options != null && options.min ? " " : ` +`, + spacingOuter: options != null && options.min ? "" : ` +` + }; + }; + function createIndent(indent) { + return new Array(indent + 1).join(" "); + } + function format(val, options) { + if (options && (validateOptions(options), options.plugins)) { + let plugin = findPlugin(options.plugins, val); + if (plugin !== null) + return printPlugin(plugin, val, getConfig(options), "", 0, []); + } + let basicResult = printBasicValue(val, getPrintFunctionName(options), getEscapeRegex(options), getEscapeString(options)); + return basicResult !== null ? basicResult : printComplexValue(val, getConfig(options), "", 0, []); + } + var plugins = { + AsymmetricMatcher: _AsymmetricMatcher.default, + ConvertAnsi: _ConvertAnsi.default, + DOMCollection: _DOMCollection.default, + DOMElement: _DOMElement.default, + Immutable: _Immutable.default, + ReactElement: _ReactElement.default, + ReactTestComponent: _ReactTestComponent.default + }; + exports.plugins = plugins; + var _default = format; + exports.default = _default; + } +}), import_pretty_format = __toESM(require_build(), 1), { + AsymmetricMatcher, + DOMCollection, + DOMElement, + Immutable, + ReactElement, + ReactTestComponent +} = import_pretty_format.plugins, PLUGINS = [ + ReactTestComponent, + ReactElement, + DOMElement, + DOMCollection, + Immutable, + AsymmetricMatcher +], DIM_COLOR = source_default.dim, EXPECTED_COLOR = source_default.green, RECEIVED_COLOR = source_default.red, SPACE_SYMBOL = "\xB7"; +function stringify(object, maxDepth = 10, maxWidth = 10) { + let MAX_LENGTH = 1e4, result; + try { + result = (0, import_pretty_format.format)(object, { + maxDepth, + maxWidth, + min: !0, + plugins: PLUGINS + }); + } catch { + result = (0, import_pretty_format.format)(object, { + callToJSON: !1, + maxDepth, + maxWidth, + min: !0, + plugins: PLUGINS + }); + } + return result.length >= MAX_LENGTH && maxDepth > 1 ? stringify(object, Math.floor(maxDepth / 2), maxWidth) : result.length >= MAX_LENGTH && maxWidth > 1 ? stringify(object, maxDepth, Math.floor(maxWidth / 2)) : result; +} +function replaceTrailingSpaces(text) { + return text.replace(/\s+$/gm, (spaces) => SPACE_SYMBOL.repeat(spaces.length)); +} +function printReceived(object) { + return RECEIVED_COLOR(replaceTrailingSpaces(stringify(object))); +} +function matcherHint(matcherName, received = "received", expected = "expected", options = {}) { + let { + comment = "", + expectedColor = EXPECTED_COLOR, + isDirectExpectCall = !1, + isNot = !1, + promise = "", + receivedColor = RECEIVED_COLOR, + secondArgument = "", + secondArgumentColor = EXPECTED_COLOR + } = options, hint = "", dimString = "expect"; + return !isDirectExpectCall && received !== "" && (hint += DIM_COLOR(`${dimString}(`) + receivedColor(received), dimString = ")"), promise !== "" && (hint += DIM_COLOR(`${dimString}.`) + promise, dimString = ""), isNot && (hint += `${DIM_COLOR(`${dimString}.`)}not`, dimString = ""), matcherName.includes(".") ? dimString += matcherName : (hint += DIM_COLOR(`${dimString}.`) + matcherName, dimString = ""), expected === "" ? dimString += "()" : (hint += DIM_COLOR(`${dimString}(`) + expectedColor(expected), secondArgument && (hint += DIM_COLOR(", ") + secondArgumentColor(secondArgument)), dimString = ")"), comment !== "" && (dimString += ` // ${comment}`), dimString !== "" && (hint += DIM_COLOR(dimString)), hint; +} + +// ../../../node_modules/vitest-axe/dist/matchers.js +function toHaveNoViolations(results) { + if (typeof results.violations > "u") + throw new Error("No violations found in aXe results object"); + let violations = filterViolations(results.violations, results.toolOptions ? results.toolOptions.impactLevels : []); + function reporter(violations2) { + if (violations2.length === 0) + return []; + let lineBreak = ` + +`; + return violations2.map((violation) => violation.nodes.map((node) => `Expected the HTML found at $('${node.target.join(", ")}') to have no violations:` + lineBreak + source_default.grey(node.html) + lineBreak + "Received:" + lineBreak + printReceived(`${violation.help} (${violation.id})`) + lineBreak + source_default.yellow(node.failureSummary) + lineBreak + (violation.helpUrl ? `You can find more information on this issue here: +${source_default.blue(violation.helpUrl)}` : "")).join(lineBreak)).join(lineBreak + "\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500" + lineBreak); + } + let formatedViolations = reporter(violations), pass = formatedViolations.length === 0; + function message() { + if (!pass) + return matcherHint(".toHaveNoViolations") + ` + +${formatedViolations}`; + } + return { actual: violations, message, pass }; +} +function filterViolations(violations, impactLevels) { + return impactLevels && impactLevels.length > 0 ? violations.filter((v) => impactLevels.includes(v.impact)) : violations; +} +export { + toHaveNoViolations +}; diff --git a/tools/ui/node_modules/@storybook/addon-a11y/dist/index.d.ts b/tools/ui/node_modules/@storybook/addon-a11y/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..7b03469973eaa6b559d84c4e43c0cd0622efc004 --- /dev/null +++ b/tools/ui/node_modules/@storybook/addon-a11y/dist/index.d.ts @@ -0,0 +1,87 @@ +import * as storybook_internal_csf from 'storybook/internal/csf'; +import { Selector, SelectorList, RunOptions, Spec, AxeResults, Result, NodeResult } from 'axe-core'; + +type SelectorWithoutNode = Omit | Omit; +type ContextObjectWithoutNode = { + include: SelectorWithoutNode; + exclude?: SelectorWithoutNode; +} | { + exclude: SelectorWithoutNode; + include?: SelectorWithoutNode; +}; +type ContextSpecWithoutNode = SelectorWithoutNode | ContextObjectWithoutNode; +type A11yTest = 'off' | 'todo' | 'error'; +interface A11yParameters$1 { + /** + * Context parameter for axe-core's run function, except without support for passing Nodes and + * NodeLists directly. + * + * @see https://github.com/dequelabs/axe-core/blob/develop/doc/context.md + */ + context?: ContextSpecWithoutNode; + /** + * Options for running axe-core. + * + * @see https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#options-parameter + */ + options?: RunOptions; + /** + * Configuration object for axe-core. + * + * @see https://github.com/dequelabs/axe-core/blob/develop/doc/API.md#api-name-axeconfigure + */ + config?: Spec; + /** Whether to disable accessibility tests. */ + disable?: boolean; + /** Defines how accessibility violations should be handled: 'off', 'todo', or 'error'. */ + test?: A11yTest; +} + +type A11yReport = EnhancedResults | { + error: Error; +}; +interface A11yParameters { + /** + * Accessibility configuration + * + * @see https://storybook.js.org/docs/writing-tests/accessibility-testing + */ + a11y?: A11yParameters$1; +} +interface A11yGlobals { + /** + * Accessibility configuration + * + * @see https://storybook.js.org/docs/writing-tests/accessibility-testing + */ + a11y?: { + /** + * Prevent the addon from executing automated accessibility checks upon visiting a story. You + * can still trigger the checks from the addon panel. + * + * @see https://storybook.js.org/docs/writing-tests/accessibility-testing#disable-automated-checks + */ + manual?: boolean; + }; +} +type EnhancedNodeResult = NodeResult & { + linkPath: string; +}; +type EnhancedResult = Omit & { + nodes: EnhancedNodeResult[]; +}; +type EnhancedResults = Omit & { + incomplete: EnhancedResult[]; + passes: EnhancedResult[]; + violations: EnhancedResult[]; +}; +interface A11yTypes { + parameters: A11yParameters; + globals: A11yGlobals; +} + +declare const PARAM_KEY = "a11y"; + +declare const _default: () => storybook_internal_csf.PreviewAddon; + +export { type A11yGlobals, type A11yParameters$1 as A11yParameters, type A11yReport, type A11yTypes, type ContextObjectWithoutNode, type ContextSpecWithoutNode, PARAM_KEY, type SelectorWithoutNode, _default as default }; diff --git a/tools/ui/node_modules/@storybook/addon-a11y/dist/index.js b/tools/ui/node_modules/@storybook/addon-a11y/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..03de63d5c019466caa0eef0723ff984ce1ac38af --- /dev/null +++ b/tools/ui/node_modules/@storybook/addon-a11y/dist/index.js @@ -0,0 +1,15 @@ +import { + preview_exports +} from "./_browser-chunks/chunk-P5J2FJ2Z.js"; +import { + PARAM_KEY +} from "./_browser-chunks/chunk-7OPMK7TU.js"; +import "./_browser-chunks/chunk-4BE7D4DS.js"; + +// src/index.ts +import { definePreviewAddon } from "storybook/internal/csf"; +var index_default = () => definePreviewAddon(preview_exports); +export { + PARAM_KEY, + index_default as default +}; diff --git a/tools/ui/node_modules/@storybook/addon-a11y/dist/manager.js b/tools/ui/node_modules/@storybook/addon-a11y/dist/manager.js new file mode 100644 index 0000000000000000000000000000000000000000..791d05e75e2343c0f3f1c5ab36751979ecf78af0 --- /dev/null +++ b/tools/ui/node_modules/@storybook/addon-a11y/dist/manager.js @@ -0,0 +1,2198 @@ +import { + ADDON_ID, + DOCUMENTATION_DISCREPANCY_LINK, + EVENTS, + PANEL_ID, + PARAM_KEY, + STATUS_TYPE_ID_A11Y, + STATUS_TYPE_ID_COMPONENT_TEST, + VISION_GLOBAL_KEY, + filterDefs, + filters +} from "./_browser-chunks/chunk-7OPMK7TU.js"; +import "./_browser-chunks/chunk-4BE7D4DS.js"; + +// src/manager.tsx +import React8 from "react"; +import { Badge as Badge3 } from "storybook/internal/components"; +import { addons, types, useAddonState as useAddonState2, useStorybookApi as useStorybookApi3 } from "storybook/manager-api"; + +// src/components/A11YPanel.tsx +import React6, { useMemo as useMemo3 } from "react"; +import { Badge as Badge2, Button as Button4 } from "storybook/internal/components"; +import { SyncIcon as SyncIcon2 } from "@storybook/icons"; +import { styled as styled5 } from "storybook/theming"; + +// src/types.ts +var RuleType = { + VIOLATION: "violations", + PASS: "passes", + INCOMPLETION: "incomplete" +}; + +// src/components/A11yContext.tsx +import React, { + createContext, + useCallback, + useContext, + useEffect, + useMemo, + useRef, + useState +} from "react"; +import { + STORY_CHANGED, + STORY_FINISHED, + STORY_HOT_UPDATED, + STORY_RENDER_PHASE_CHANGED +} from "storybook/internal/core-events"; +import { HIGHLIGHT, REMOVE_HIGHLIGHT, SCROLL_INTO_VIEW } from "storybook/highlight"; +import { + experimental_getStatusStore, + experimental_useStatusStore, + useAddonState, + useChannel, + useGlobals, + useParameter, + useStorybookApi, + useStorybookState +} from "storybook/manager-api"; +import { convert, themes } from "storybook/theming"; + +// src/AccessibilityRuleMaps.ts +var axeRuleMapping_wcag_2_0_a_aa = { + "area-alt": { + title: " alt text", + axeSummary: "Ensure elements of image maps have alternative text", + friendlySummary: "Add alt text to all elements of image maps." + }, + "aria-allowed-attr": { + title: "Supported ARIA attributes", + axeSummary: "Ensure an element's role supports its ARIA attributes", + friendlySummary: "Only use ARIA attributes that are permitted for the element's role." + }, + "aria-braille-equivalent": { + title: "Braille equivalent", + axeSummary: "Ensure aria-braillelabel and aria-brailleroledescription have a non-braille equivalent", + friendlySummary: "If you use braille ARIA labels, also provide a matching non-braille label." + }, + "aria-command-name": { + title: "ARIA command name", + axeSummary: "Ensure every ARIA button, link and menuitem has an accessible name", + friendlySummary: "Every ARIA button, link, or menuitem needs a label or accessible name." + }, + "aria-conditional-attr": { + title: "ARIA attribute valid for role", + axeSummary: "Ensure ARIA attributes are used as described in the specification of the element's role", + friendlySummary: "Follow the element role's specification when using ARIA attributes." + }, + "aria-deprecated-role": { + title: "Deprecated ARIA role", + axeSummary: "Ensure elements do not use deprecated roles", + friendlySummary: "Don't use deprecated ARIA roles on elements." + }, + "aria-hidden-body": { + title: "Hidden body", + axeSummary: 'Ensure aria-hidden="true" is not present on the document ', + friendlySummary: 'Never set aria-hidden="true" on the element.' + }, + "aria-hidden-focus": { + title: "Hidden element focus", + axeSummary: "Ensure aria-hidden elements are not focusable nor contain focusable elements", + friendlySummary: "Elements marked hidden (aria-hidden) should not be focusable or contain focusable items." + }, + "aria-input-field-name": { + title: "ARIA input field name", + axeSummary: "Ensure every ARIA input field has an accessible name", + friendlySummary: "Give each ARIA text input or field a label or accessible name." + }, + "aria-meter-name": { + title: "ARIA meter name", + axeSummary: "Ensure every ARIA meter node has an accessible name", + friendlySummary: 'Give each element with role="meter" a label or accessible name.' + }, + "aria-progressbar-name": { + title: "ARIA progressbar name", + axeSummary: "Ensure every ARIA progressbar node has an accessible name", + friendlySummary: 'Give each element with role="progressbar" a label or accessible name.' + }, + "aria-prohibited-attr": { + title: "ARIA prohibited attributes", + axeSummary: "Ensure ARIA attributes are not prohibited for an element's role", + friendlySummary: "Don't use ARIA attributes that are forbidden for that element's role." + }, + "aria-required-attr": { + title: "ARIA required attributes", + axeSummary: "Ensure elements with ARIA roles have all required ARIA attributes", + friendlySummary: "Include all required ARIA attributes for elements with that ARIA role." + }, + "aria-required-children": { + title: "ARIA required children", + axeSummary: "Ensure elements with an ARIA role that require child roles contain them", + friendlySummary: "If an ARIA role requires specific child roles, include those child elements." + }, + "aria-required-parent": { + title: "ARIA required parent", + axeSummary: "Ensure elements with an ARIA role that require parent roles are contained by them", + friendlySummary: "Place elements with certain ARIA roles inside the required parent role element." + }, + "aria-roles": { + title: "ARIA role value", + axeSummary: "Ensure all elements with a role attribute use a valid value", + friendlySummary: "Use only valid values in the role attribute (no typos or invalid roles)." + }, + "aria-toggle-field-name": { + title: "ARIA toggle field name", + axeSummary: "Ensure every ARIA toggle field has an accessible name", + friendlySummary: "Every ARIA toggle field (elements with the checkbox, radio, or switch roles) needs an accessible name." + }, + "aria-tooltip-name": { + title: "ARIA tooltip name", + axeSummary: "Ensure every ARIA tooltip node has an accessible name", + friendlySummary: 'Give each element with role="tooltip" a descriptive accessible name.' + }, + "aria-valid-attr-value": { + title: "ARIA attribute values valid", + axeSummary: "Ensure all ARIA attributes have valid values", + friendlySummary: "Use only valid values for ARIA attributes (no typos or invalid values)." + }, + "aria-valid-attr": { + title: "ARIA attribute valid", + axeSummary: "Ensure attributes that begin with aria- are valid ARIA attributes", + friendlySummary: "Use only valid aria-* attributes (make sure the attribute name is correct)." + }, + blink: { + title: " element", + axeSummary: "Ensure elements are not used", + friendlySummary: "Don't use the deprecated element." + }, + "button-name": { + title: "Button name", + axeSummary: "Ensure buttons have discernible text", + friendlySummary: "Every ; +export const emoji = () => ; +``` + +💎 **Simple.** Writing component "stories" is as easy as exporting ES6 functions using a clean, widely-used format. + +🚚 **Non-proprietary.** CSF doesn't require any vendor-specific libraries. Component stories are easily consumed anywhere ES6 modules live, including your favourite testing tools like Jest and Cypress. + +☝️ **Declarative.** The declarative syntax is isomorphic to higher-level formats like MDX, enabling clean, verifiable transformations. + +🔥 **Optimized.** Component stories don't need any libraries other than your components. And because they're ES6 modules, they're even tree-shakeable! + +### Who uses CSF? + +**Tools:** [Storybook](https://storybook.js.org), [WebComponents.dev](https://webcomponents.dev), [Components.studio](https://components.studio), [RedwoodJS](https://redwoodjs.com/), [UXPin](https://www.uxpin.com/) + +**Compatible with:** [Jest](https://jestjs.io/), [Enzyme](https://enzymejs.github.io/enzyme), [Testing Library](https://testing-library.com), [Cypress](https://www.cypress.io/), [Playwright](https://playwright.dev/), [Mocha](https://mochajs.org), etc. + + +## CSF utilities + +A minimal set of utility functions for dealing with [Component Story Format (CSF)](https://storybook.js.org/docs/formats/component-story-format/). + + +### Install + +```sh +yarn add @storybook/csf +``` + +### API + +See package source for function definitions and types: + +- `storyNameFromExport(key)` - Enhance export name (`key`) of the story. Implemented to have parity with [startCase](https://lodash.com/docs/4.17.11#startCase). + +- `isExportStory(key, { includeStories, excludeStories })` - Does a named export match CSF inclusion/exclusion options? + +- `parseKind(kind, { rootSeparator, groupSeparator })` - Parse out the component/kind name from a path, using the given separator config. + +- `sanitize(string)` - Remove punctuation and illegal characters from a story ID. + +- `toId(kind, name)` - Generate a storybook ID from a component/kind and story name. + +## Contributing + +If you have any suggestions, please open an issue or a PR. + +All contributions are welcome! + +### run tests: + +```sh +yarn test +``` diff --git a/tools/ui/node_modules/@storybook/csf/dist/index.d.ts b/tools/ui/node_modules/@storybook/csf/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..c7790a70a13c8c9c74d250497b1290c648cf0f35 --- /dev/null +++ b/tools/ui/node_modules/@storybook/csf/dist/index.d.ts @@ -0,0 +1,541 @@ +import { Simplify, RemoveIndexSignature, UnionToIntersection } from 'type-fest'; + +interface SBBaseType { + required?: boolean; + raw?: string; +} +type SBScalarType = SBBaseType & { + name: 'boolean' | 'string' | 'number' | 'function' | 'symbol'; +}; +type SBArrayType = SBBaseType & { + name: 'array'; + value: SBType; +}; +type SBObjectType = SBBaseType & { + name: 'object'; + value: Record; +}; +type SBEnumType = SBBaseType & { + name: 'enum'; + value: (string | number)[]; +}; +type SBIntersectionType = SBBaseType & { + name: 'intersection'; + value: SBType[]; +}; +type SBUnionType = SBBaseType & { + name: 'union'; + value: SBType[]; +}; +type SBOtherType = SBBaseType & { + name: 'other'; + value: string; +}; +type SBType = SBScalarType | SBEnumType | SBArrayType | SBObjectType | SBIntersectionType | SBUnionType | SBOtherType; + +type StoryId = string; +type ComponentId = string; +type ComponentTitle = string; +type StoryName = string; +/** @deprecated */ +type StoryKind = ComponentTitle; +type Tag = string; +interface StoryIdentifier { + componentId: ComponentId; + title: ComponentTitle; + /** @deprecated */ + kind: ComponentTitle; + id: StoryId; + name: StoryName; + /** @deprecated */ + story: StoryName; + tags: Tag[]; +} +interface Parameters { + [name: string]: any; +} +interface StrictParameters { + [name: string]: unknown; +} +type ControlType = 'object' | 'boolean' | 'check' | 'inline-check' | 'radio' | 'inline-radio' | 'select' | 'multi-select' | 'number' | 'range' | 'file' | 'color' | 'date' | 'text'; +type ConditionalTest = { + truthy?: boolean; +} | { + exists: boolean; +} | { + eq: any; +} | { + neq: any; +}; +type ConditionalValue = { + arg: string; +} | { + global: string; +}; +type Conditional = ConditionalValue & ConditionalTest; +interface ControlBase { + [key: string]: any; + /** + * @see https://storybook.js.org/docs/api/arg-types#controltype + */ + type?: ControlType; + disable?: boolean; +} +interface Report { + type: string; + version?: number; + result: unknown; + status: 'failed' | 'passed' | 'warning'; +} +interface ReportingAPI { + reports: Report[]; + addReport: (report: Report) => void; +} +type Control = ControlType | false | (ControlBase & (ControlBase | { + type: 'color'; + /** + * @see https://storybook.js.org/docs/api/arg-types#controlpresetcolors + */ + presetColors?: string[]; +} | { + type: 'file'; + /** + * @see https://storybook.js.org/docs/api/arg-types#controlaccept + */ + accept?: string; +} | { + type: 'inline-check' | 'radio' | 'inline-radio' | 'select' | 'multi-select'; + /** + * @see https://storybook.js.org/docs/api/arg-types#controllabels + */ + labels?: { + [options: string]: string; + }; +} | { + type: 'number' | 'range'; + /** + * @see https://storybook.js.org/docs/api/arg-types#controlmax + */ + max?: number; + /** + * @see https://storybook.js.org/docs/api/arg-types#controlmin + */ + min?: number; + /** + * @see https://storybook.js.org/docs/api/arg-types#controlstep + */ + step?: number; +})); +interface InputType { + /** + * @see https://storybook.js.org/docs/api/arg-types#control + */ + control?: Control; + /** + * @see https://storybook.js.org/docs/api/arg-types#description + */ + description?: string; + /** + * @see https://storybook.js.org/docs/api/arg-types#if + */ + if?: Conditional; + /** + * @see https://storybook.js.org/docs/api/arg-types#mapping + */ + mapping?: { + [key: string]: any; + }; + /** + * @see https://storybook.js.org/docs/api/arg-types#name + */ + name?: string; + /** + * @see https://storybook.js.org/docs/api/arg-types#options + */ + options?: readonly any[]; + /** + * @see https://storybook.js.org/docs/api/arg-types#table + */ + table?: { + [key: string]: unknown; + /** + * @see https://storybook.js.org/docs/api/arg-types#tablecategory + */ + category?: string; + /** + * @see https://storybook.js.org/docs/api/arg-types#tabledefaultvalue + */ + defaultValue?: { + summary?: string; + detail?: string; + }; + /** + * @see https://storybook.js.org/docs/api/arg-types#tabledisable + */ + disable?: boolean; + /** + * @see https://storybook.js.org/docs/api/arg-types#tablesubcategory + */ + subcategory?: string; + /** + * @see https://storybook.js.org/docs/api/arg-types#tabletype + */ + type?: { + summary?: string; + detail?: string; + }; + }; + /** + * @see https://storybook.js.org/docs/api/arg-types#type + */ + type?: SBType | SBScalarType['name']; + /** + * @see https://storybook.js.org/docs/api/arg-types#defaultvalue + * + * @deprecated Use `table.defaultValue.summary` instead. + */ + defaultValue?: any; + [key: string]: any; +} +interface StrictInputType extends InputType { + name: string; + type?: SBType; +} +interface Args { + [name: string]: any; +} +interface StrictArgs { + [name: string]: unknown; +} +/** + * @see https://storybook.js.org/docs/api/arg-types#argtypes + */ +type ArgTypes = { + [name in keyof TArgs]: InputType; +}; +type StrictArgTypes = { + [name in keyof TArgs]: StrictInputType; +}; +interface Globals { + [name: string]: any; +} +interface GlobalTypes { + [name: string]: InputType; +} +interface StrictGlobalTypes { + [name: string]: StrictInputType; +} +interface Renderer { + /** What is the type of the `component` annotation in this renderer? */ + component: unknown; + /** What does the story function return in this renderer? */ + storyResult: unknown; + /** What type of element does this renderer render to? */ + canvasElement: unknown; + mount(): Promise; + T?: unknown; +} +/** @deprecated - use `Renderer` */ +type AnyFramework = Renderer; +interface StoryContextForEnhancers extends StoryIdentifier { + component?: (TRenderer & { + T: any; + })['component']; + subcomponents?: Record; + parameters: Parameters; + initialArgs: TArgs; + argTypes: StrictArgTypes; +} +type ArgsEnhancer = (context: StoryContextForEnhancers) => TArgs; +type ArgTypesEnhancer = ((context: StoryContextForEnhancers) => StrictArgTypes) & { + secondPass?: boolean; +}; +interface StoryContextUpdate { + args?: TArgs; + globals?: Globals; + [key: string]: any; +} +type ViewMode = 'story' | 'docs'; +type LoaderFunction = (context: StoryContextForLoaders) => Promise | void> | Record | void; +type Awaitable = T | PromiseLike; +type CleanupCallback = () => Awaitable; +type BeforeAll = () => Awaitable; +type BeforeEach = (context: StoryContext) => Awaitable; +type AfterEach = (context: StoryContext) => Awaitable; +interface Canvas { +} +interface StoryContext extends StoryContextForEnhancers, Required> { + loaded: Record; + abortSignal: AbortSignal; + canvasElement: TRenderer['canvasElement']; + hooks: unknown; + originalStoryFn: StoryFn; + viewMode: ViewMode; + step: StepFunction; + context: this; + canvas: Canvas; + mount: TRenderer['mount']; + reporting: ReportingAPI; +} +/** @deprecated Use {@link StoryContext} instead. */ +interface StoryContextForLoaders extends StoryContext { +} +/** @deprecated Use {@link StoryContext} instead. */ +interface PlayFunctionContext extends StoryContext { +} +type StepLabel = string; +type StepFunction = (label: StepLabel, play: PlayFunction) => Promise | void; +type PlayFunction = (context: PlayFunctionContext) => Promise | void; +type PartialStoryFn = (update?: StoryContextUpdate>) => TRenderer['storyResult']; +type LegacyStoryFn = (context: StoryContext) => TRenderer['storyResult']; +type ArgsStoryFn = (args: TArgs, context: StoryContext) => (TRenderer & { + T: TArgs; +})['storyResult']; +type StoryFn = LegacyStoryFn | ArgsStoryFn; +type DecoratorFunction = (fn: PartialStoryFn, c: StoryContext) => TRenderer['storyResult']; +type DecoratorApplicator = (storyFn: LegacyStoryFn, decorators: DecoratorFunction[]) => LegacyStoryFn; +type StepRunner = (label: StepLabel, play: PlayFunction, context: StoryContext) => Promise; +interface BaseAnnotations { + /** + * Wrapper components or Storybook decorators that wrap a story. + * + * Decorators defined in Meta will be applied to every story variation. + * @see [Decorators](https://storybook.js.org/docs/writing-stories/decorators) + */ + decorators?: DecoratorFunction>[] | DecoratorFunction>; + /** + * Custom metadata for a story. + * @see [Parameters](https://storybook.js.org/docs/writing-stories/parameters) + */ + parameters?: Parameters; + /** + * Dynamic data that are provided (and possibly updated by) Storybook and its addons. + * @see [Args](https://storybook.js.org/docs/writing-stories/args) + */ + args?: Partial; + /** + * ArgTypes encode basic metadata for args, such as `name`, `description`, `defaultValue` for an arg. These get automatically filled in by Storybook Docs. + * @see [ArgTypes](https://storybook.js.org/docs/api/arg-types) + */ + argTypes?: Partial>; + /** + * Asynchronous functions which provide data for a story. + * @see [Loaders](https://storybook.js.org/docs/writing-stories/loaders) + */ + loaders?: LoaderFunction[] | LoaderFunction; + /** + * Function to be called before each story. When the function is async, it will be awaited. + * + * `beforeEach` can be added to preview, the default export and to a specific story. + * They are run (and awaited) in the order: preview, default export, story + * + * A cleanup function can be returned. + */ + beforeEach?: BeforeEach[] | BeforeEach; + /** + * Function to be called after each play function for post-test assertions. + * Don't use this function for cleaning up state. + * You can use the return callback of `beforeEach` for that, which is run when switching stories. + * When the function is async, it will be awaited. + * + * `afterEach` can be added to preview, the default export and to a specific story. + * They are run (and awaited) reverse order: preview, default export, story + */ + experimental_afterEach?: AfterEach[] | AfterEach; + /** + * Define a custom render function for the story(ies). If not passed, a default render function by the renderer will be used. + */ + render?: ArgsStoryFn; + /** + * Named tags for a story, used to filter stories in different contexts. + */ + tags?: Tag[]; + mount?: (context: StoryContext) => TRenderer['mount']; +} +interface ProjectAnnotations extends BaseAnnotations { + argsEnhancers?: ArgsEnhancer[]; + argTypesEnhancers?: ArgTypesEnhancer[]; + /** + * Lifecycle hook which runs once, before any loaders, decorators or stories, and may rerun when configuration changes or when reinitializing (e.g. between test runs). + * The function may be synchronous or asynchronous, and may return a cleanup function which may also be synchronous or asynchronous. + * The cleanup function is not guaranteed to run (e.g. when the browser closes), but runs when configuration changes or when reinitializing. + * This hook may only be defined globally (i.e. not on component or story level). + * When multiple hooks are specified, they are to be executed sequentially (and awaited) in the following order: + * - Addon hooks (in order of addons array in e.g. .storybook/main.js) + * - Annotation hooks (in order of previewAnnotations array in e.g. .storybook/main.js) + * - Preview hook (via e.g. .storybook/preview.js) + * Cleanup functions are executed sequentially in reverse order of initialization. + */ + beforeAll?: BeforeAll; + /** + * @deprecated Project `globals` renamed to `initiaGlobals` + */ + globals?: Globals; + initialGlobals?: Globals; + globalTypes?: GlobalTypes; + applyDecorators?: DecoratorApplicator; + runStep?: StepRunner; +} +type StoryDescriptor$1 = string[] | RegExp; +interface ComponentAnnotations extends BaseAnnotations { + /** + * Title of the component which will be presented in the navigation. **Should be unique.** + * + * Components can be organized in a nested structure using "/" as a separator. + * + * Since CSF 3.0 this property is optional -- it can be inferred from the filesystem path + * + * @example + * export default { + * ... + * title: 'Design System/Atoms/Button' + * } + * + * @see [Story Hierarchy](https://storybook.js.org/docs/writing-stories/naming-components-and-hierarchy#structure-and-hierarchy) + */ + title?: ComponentTitle; + /** + * Id of the component (prefix of the story id) which is used for URLs. + * + * By default is inferred from sanitizing the title + * + * @see [Permalink to stories](https://storybook.js.org/docs/configure/sidebar-and-urls#permalink-to-stories) + */ + id?: ComponentId; + /** + * Used to only include certain named exports as stories. Useful when you want to have non-story exports such as mock data or ignore a few stories. + * @example + * includeStories: ['SimpleStory', 'ComplexStory'] + * includeStories: /.*Story$/ + * + * @see [Non-story exports](https://storybook.js.org/docs/api/csf#non-story-exports) + */ + includeStories?: StoryDescriptor$1; + /** + * Used to exclude certain named exports. Useful when you want to have non-story exports such as mock data or ignore a few stories. + * @example + * excludeStories: ['simpleData', 'complexData'] + * excludeStories: /.*Data$/ + * + * @see [Non-story exports](https://storybook.js.org/docs/api/csf#non-story-exports) + */ + excludeStories?: StoryDescriptor$1; + /** + * The primary component for your story. + * + * Used by addons for automatic prop table generation and display of other component metadata. + */ + component?: (TRenderer & { + T: Record extends Required ? any : TArgs; + })['component']; + /** + * Auxiliary subcomponents that are part of the stories. + * + * Used by addons for automatic prop table generation and display of other component metadata. + * + * @example + * import { Button, ButtonGroup } from './components'; + * + * export default { + * ... + * subcomponents: { Button, ButtonGroup } + * } + * + * By defining them each component will have its tab in the args table. + */ + subcomponents?: Record; + /** + * Function that is executed after the story is rendered. + */ + play?: PlayFunction; + /** + * Override the globals values for all stories in this component + */ + globals?: Globals; +} +type StoryAnnotations> = BaseAnnotations & { + /** + * Override the display name in the UI (CSF v3) + */ + name?: StoryName; + /** + * Override the display name in the UI (CSF v2) + */ + storyName?: StoryName; + /** + * Function that is executed after the story is rendered. + */ + play?: PlayFunction; + /** + * Override the globals values for this story + */ + globals?: Globals; + /** @deprecated */ + story?: Omit, 'story'>; +} & ({} extends TRequiredArgs ? { + args?: TRequiredArgs; +} : { + args: TRequiredArgs; +}); +type LegacyAnnotatedStoryFn = StoryFn & StoryAnnotations; +type LegacyStoryAnnotationsOrFn = LegacyAnnotatedStoryFn | StoryAnnotations; +type AnnotatedStoryFn = ArgsStoryFn & StoryAnnotations; +type StoryAnnotationsOrFn = AnnotatedStoryFn | StoryAnnotations; +type ArgsFromMeta = Meta extends { + render?: ArgsStoryFn; + loaders?: (infer Loaders)[] | infer Loaders; + decorators?: (infer Decorators)[] | infer Decorators; +} ? Simplify & LoaderArgs>> : unknown; +type DecoratorsArgs = UnionToIntersection ? TArgs : unknown>; +type LoaderArgs = UnionToIntersection ? TArgs : unknown>; + +/** + * Helper function to include/exclude an arg based on the value of other other args + * aka "conditional args" + */ +declare const includeConditionalArg: (argType: InputType, args: Args, globals: Globals) => any; + +/** + * Remove punctuation and illegal characters from a story ID. + * + * See https://gist.github.com/davidjrice/9d2af51100e41c6c4b4a + */ +declare const sanitize: (string: string) => string; +/** + * Generate a storybook ID from a component/kind and story name. + */ +declare const toId: (kind: string, name?: string) => string; +/** + * Transform a CSF named export into a readable story name + */ +declare const storyNameFromExport: (key: string) => string; +type StoryDescriptor = string[] | RegExp; +interface IncludeExcludeOptions { + includeStories?: StoryDescriptor; + excludeStories?: StoryDescriptor; +} +/** + * Does a named export match CSF inclusion/exclusion options? + */ +declare function isExportStory(key: string, { includeStories, excludeStories }: IncludeExcludeOptions): boolean | null; +interface SeparatorOptions { + rootSeparator: string | RegExp; + groupSeparator: string | RegExp; +} +/** + * Parse out the component/kind name from a path, using the given separator config. + */ +declare const parseKind: (kind: string, { rootSeparator, groupSeparator }: SeparatorOptions) => { + root: string | null; + groups: string[]; +}; +/** + * Combine a set of project / meta / story tags, removing duplicates and handling negations. + */ +declare const combineTags: (...tags: string[]) => string[]; + +export { AfterEach, AnnotatedStoryFn, AnyFramework, ArgTypes, ArgTypesEnhancer, Args, ArgsEnhancer, ArgsFromMeta, ArgsStoryFn, BaseAnnotations, BeforeAll, BeforeEach, Canvas, CleanupCallback, ComponentAnnotations, ComponentId, ComponentTitle, Conditional, DecoratorApplicator, DecoratorFunction, GlobalTypes, Globals, IncludeExcludeOptions, InputType, LegacyAnnotatedStoryFn, LegacyStoryAnnotationsOrFn, LegacyStoryFn, LoaderFunction, Parameters, PartialStoryFn, PlayFunction, PlayFunctionContext, ProjectAnnotations, Renderer, SBArrayType, SBEnumType, SBIntersectionType, SBObjectType, SBOtherType, SBScalarType, SBType, SBUnionType, SeparatorOptions, StepFunction, StepLabel, StepRunner, StoryAnnotations, StoryAnnotationsOrFn, StoryContext, StoryContextForEnhancers, StoryContextForLoaders, StoryContextUpdate, StoryFn, StoryId, StoryIdentifier, StoryKind, StoryName, StrictArgTypes, StrictArgs, StrictGlobalTypes, StrictInputType, StrictParameters, Tag, ViewMode, combineTags, includeConditionalArg, isExportStory, parseKind, sanitize, storyNameFromExport, toId }; diff --git a/tools/ui/node_modules/@storybook/csf/dist/index.js b/tools/ui/node_modules/@storybook/csf/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..36875029f137c238eb55a517f24d105f756b13a3 --- /dev/null +++ b/tools/ui/node_modules/@storybook/csf/dist/index.js @@ -0,0 +1,11 @@ +'use strict'; + +var C=Object.create;var u=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var E=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var v=(r,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of F(e))!w.call(r,a)&&a!==n&&u(r,a,{get:()=>e[a],enumerable:!(t=B(e,a))||t.enumerable});return r};var I=(r,e,n)=>(n=r!=null?C(h(r)):{},v(e||!r||!r.__esModule?u(n,"default",{value:r,enumerable:!0}):n,r));var x=E(T=>{Object.defineProperty(T,"__esModule",{value:!0}),T.isEqual=function(){var r=Object.prototype.toString,e=Object.getPrototypeOf,n=Object.getOwnPropertySymbols?function(t){return Object.keys(t).concat(Object.getOwnPropertySymbols(t))}:Object.keys;return function(t,a){return function i(o,s,p){var g,y,d,c=r.call(o),b=r.call(s);if(o===s)return !0;if(o==null||s==null)return !1;if(p.indexOf(o)>-1&&p.indexOf(s)>-1)return !0;if(p.push(o,s),c!=b||(g=n(o),y=n(s),g.length!=y.length||g.some(function(A){return !i(o[A],s[A],p)})))return !1;switch(c.slice(8,-1)){case"Symbol":return o.valueOf()==s.valueOf();case"Date":case"Number":return +o==+s||+o!=+o&&+s!=+s;case"RegExp":case"Function":case"String":case"Boolean":return ""+o==""+s;case"Set":case"Map":g=o.entries(),y=s.entries();do if(!i((d=g.next()).value,y.next().value,p))return !1;while(!d.done);return !0;case"ArrayBuffer":o=new Uint8Array(o),s=new Uint8Array(s);case"DataView":o=new Uint8Array(o.buffer),s=new Uint8Array(s.buffer);case"Float32Array":case"Float64Array":case"Int8Array":case"Int16Array":case"Int32Array":case"Uint8Array":case"Uint16Array":case"Uint32Array":case"Uint8ClampedArray":case"Arguments":case"Array":if(o.length!=s.length)return !1;for(d=0;d`${n} ${t}${a}`).replace(/([a-z])([A-Z])/g,(e,n,t)=>`${n} ${t}`).replace(/([a-z])([0-9])/gi,(e,n,t)=>`${n} ${t}`).replace(/([0-9])([a-z])/gi,(e,n,t)=>`${n} ${t}`).replace(/(\s|^)(\w)/g,(e,n,t)=>`${n}${t.toUpperCase()}`).replace(/ +/g," ").trim()}var l=I(x()),S=r=>r.map(e=>typeof e<"u").filter(Boolean).length,k=(r,e)=>{let{exists:n,eq:t,neq:a,truthy:i}=r;if(S([n,t,a,i])>1)throw new Error(`Invalid conditional test ${JSON.stringify({exists:n,eq:t,neq:a})}`);if(typeof t<"u")return (0, l.isEqual)(e,t);if(typeof a<"u")return !(0, l.isEqual)(e,a);if(typeof n<"u"){let s=typeof e<"u";return n?s:!s}return (typeof i>"u"?!0:i)?!!e:!e},P=(r,e,n)=>{if(!r.if)return !0;let{arg:t,global:a}=r.if;if(S([t,a])!==1)throw new Error(`Invalid conditional value ${JSON.stringify({arg:t,global:a})}`);let i=t?e[t]:n[a];return k(r.if,i)};var O=r=>r.toLowerCase().replace(/[ ’–—―′¿'`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi,"-").replace(/-+/g,"-").replace(/^-+/,"").replace(/-+$/,""),f=(r,e)=>{let n=O(r);if(n==="")throw new Error(`Invalid ${e} '${r}', must include alphanumeric characters`);return n},G=(r,e)=>`${f(r,"kind")}${e?`--${f(e,"name")}`:""}`,N=r=>R(r);function m(r,e){return Array.isArray(e)?e.includes(r):r.match(e)}function M(r,{includeStories:e,excludeStories:n}){return r!=="__esModule"&&(!e||m(r,e))&&(!n||!m(r,n))}var V=(r,{rootSeparator:e,groupSeparator:n})=>{let[t,a]=r.split(e,2),i=(a||r).split(n).filter(o=>!!o);return {root:a?t:null,groups:i}},z=(...r)=>{let e=r.reduce((n,t)=>(t.startsWith("!")?n.delete(t.slice(1)):n.add(t),n),new Set);return Array.from(e)}; + +exports.combineTags = z; +exports.includeConditionalArg = P; +exports.isExportStory = M; +exports.parseKind = V; +exports.sanitize = O; +exports.storyNameFromExport = N; +exports.toId = G; diff --git a/tools/ui/node_modules/@storybook/csf/dist/index.mjs b/tools/ui/node_modules/@storybook/csf/dist/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..fdf9da551bfb8aa1227a66d4c46c5ba6116c4d45 --- /dev/null +++ b/tools/ui/node_modules/@storybook/csf/dist/index.mjs @@ -0,0 +1,3 @@ +var C=Object.create;var u=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var h=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var E=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var v=(r,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of F(e))!w.call(r,a)&&a!==n&&u(r,a,{get:()=>e[a],enumerable:!(t=B(e,a))||t.enumerable});return r};var I=(r,e,n)=>(n=r!=null?C(h(r)):{},v(e||!r||!r.__esModule?u(n,"default",{value:r,enumerable:!0}):n,r));var x=E(T=>{Object.defineProperty(T,"__esModule",{value:!0}),T.isEqual=function(){var r=Object.prototype.toString,e=Object.getPrototypeOf,n=Object.getOwnPropertySymbols?function(t){return Object.keys(t).concat(Object.getOwnPropertySymbols(t))}:Object.keys;return function(t,a){return function i(o,s,p){var g,y,d,c=r.call(o),b=r.call(s);if(o===s)return !0;if(o==null||s==null)return !1;if(p.indexOf(o)>-1&&p.indexOf(s)>-1)return !0;if(p.push(o,s),c!=b||(g=n(o),y=n(s),g.length!=y.length||g.some(function(A){return !i(o[A],s[A],p)})))return !1;switch(c.slice(8,-1)){case"Symbol":return o.valueOf()==s.valueOf();case"Date":case"Number":return +o==+s||+o!=+o&&+s!=+s;case"RegExp":case"Function":case"String":case"Boolean":return ""+o==""+s;case"Set":case"Map":g=o.entries(),y=s.entries();do if(!i((d=g.next()).value,y.next().value,p))return !1;while(!d.done);return !0;case"ArrayBuffer":o=new Uint8Array(o),s=new Uint8Array(s);case"DataView":o=new Uint8Array(o.buffer),s=new Uint8Array(s.buffer);case"Float32Array":case"Float64Array":case"Int8Array":case"Int16Array":case"Int32Array":case"Uint8Array":case"Uint16Array":case"Uint32Array":case"Uint8ClampedArray":case"Arguments":case"Array":if(o.length!=s.length)return !1;for(d=0;d`${n} ${t}${a}`).replace(/([a-z])([A-Z])/g,(e,n,t)=>`${n} ${t}`).replace(/([a-z])([0-9])/gi,(e,n,t)=>`${n} ${t}`).replace(/([0-9])([a-z])/gi,(e,n,t)=>`${n} ${t}`).replace(/(\s|^)(\w)/g,(e,n,t)=>`${n}${t.toUpperCase()}`).replace(/ +/g," ").trim()}var l=I(x()),S=r=>r.map(e=>typeof e<"u").filter(Boolean).length,k=(r,e)=>{let{exists:n,eq:t,neq:a,truthy:i}=r;if(S([n,t,a,i])>1)throw new Error(`Invalid conditional test ${JSON.stringify({exists:n,eq:t,neq:a})}`);if(typeof t<"u")return (0, l.isEqual)(e,t);if(typeof a<"u")return !(0, l.isEqual)(e,a);if(typeof n<"u"){let s=typeof e<"u";return n?s:!s}return (typeof i>"u"?!0:i)?!!e:!e},P=(r,e,n)=>{if(!r.if)return !0;let{arg:t,global:a}=r.if;if(S([t,a])!==1)throw new Error(`Invalid conditional value ${JSON.stringify({arg:t,global:a})}`);let i=t?e[t]:n[a];return k(r.if,i)};var O=r=>r.toLowerCase().replace(/[ ’–—―′¿'`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi,"-").replace(/-+/g,"-").replace(/^-+/,"").replace(/-+$/,""),f=(r,e)=>{let n=O(r);if(n==="")throw new Error(`Invalid ${e} '${r}', must include alphanumeric characters`);return n},G=(r,e)=>`${f(r,"kind")}${e?`--${f(e,"name")}`:""}`,N=r=>R(r);function m(r,e){return Array.isArray(e)?e.includes(r):r.match(e)}function M(r,{includeStories:e,excludeStories:n}){return r!=="__esModule"&&(!e||m(r,e))&&(!n||!m(r,n))}var V=(r,{rootSeparator:e,groupSeparator:n})=>{let[t,a]=r.split(e,2),i=(a||r).split(n).filter(o=>!!o);return {root:a?t:null,groups:i}},z=(...r)=>{let e=r.reduce((n,t)=>(t.startsWith("!")?n.delete(t.slice(1)):n.add(t),n),new Set);return Array.from(e)}; + +export { z as combineTags, P as includeConditionalArg, M as isExportStory, V as parseKind, O as sanitize, N as storyNameFromExport, G as toId }; diff --git a/tools/ui/node_modules/@storybook/csf/package.json b/tools/ui/node_modules/@storybook/csf/package.json new file mode 100644 index 0000000000000000000000000000000000000000..74855a8fc5522a5bd87589ba0304b3f59f347221 --- /dev/null +++ b/tools/ui/node_modules/@storybook/csf/package.json @@ -0,0 +1,136 @@ +{ + "name": "@storybook/csf", + "version": "0.1.13", + "description": "Component Story Format (CSF) utilities", + "keywords": [ + "storybook", + "component story format", + "csf", + "stories" + ], + "homepage": "https://github.com/ComponentDriven/csf", + "bugs": { + "url": "https://github.com/ComponentDriven/csf/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/ComponentDriven/csf.git" + }, + "author": "Storybook Bot ", + "license": "MIT", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.mjs", + "require": "./dist/index.js", + "browser": "./dist/index.mjs", + "node": "./dist/index.js" + } + }, + "main": "dist/index.js", + "module": "dist/index.mjs", + "types": "dist/index.d.ts", + "files": [ + "dist/**/*", + "README.md", + "*.js", + "*.d.ts" + ], + "scripts": { + "build": "tsup ./src/index.ts --format esm,cjs --dts --treeshake --minify", + "check": "tsc", + "lint": "eslint src --ext .ts", + "release": "yarn build && auto shipit", + "test": "NODE_NO_WARNINGS=1 NODE_OPTIONS=--experimental-vm-modules jest" + }, + "prettier": "@storybook/linter-config/prettier.config", + "eslintConfig": { + "parserOptions": { + "project": [ + "./tsconfig.json" + ] + }, + "settings": { + "import/resolver": { + "typescript": { + "project": [ + "./tsconfig.json" + ] + } + } + }, + "extends": [ + "@storybook/eslint-config-storybook" + ], + "rules": { + "@typescript-eslint/no-empty-interface": "off", + "import/no-unresolved": "error", + "jest/expect-expect": [ + "warn", + { + "assertFunctionNames": [ + "expect", + "expectTypeOf" + ] + } + ] + } + }, + "jest": { + "extensionsToTreatAsEsm": [ + ".ts" + ], + "moduleNameMapper": { + "^(\\.{1,2}/.*)\\.js$": "$1" + }, + "preset": "ts-jest/presets/default-esm", + "roots": [ + "/src" + ], + "testEnvironment": "node", + "transform": { + "^.+\\.tsx?$": [ + "ts-jest", + { + "useESM": true + } + ] + } + }, + "dependencies": { + "type-fest": "^2.19.0" + }, + "devDependencies": { + "@auto-it/released": "^11.1.1", + "@ngard/tiny-isequal": "^1.1.0", + "@storybook/eslint-config-storybook": "^3.1.2", + "@types/jest": "^29.2.0", + "@types/node": "^18.11.0", + "@typescript-eslint/eslint-plugin": "^5.42.1", + "@typescript-eslint/parser": "^5.42.1", + "auto": "^11.1.1", + "common-tags": "^1.8.0", + "eslint": "^8.27.0", + "eslint-import-resolver-typescript": "^3.5.2", + "eslint-plugin-import": "^2.26.0", + "eslint-plugin-jest": "^27.1.4", + "expect-type": "^0.14.2", + "jest": "^29.3.1", + "lodash": "^4.17.21", + "@types/lodash": "^4.14.191", + "prettier": "^2.7.1", + "ts-jest": "^29.0.3", + "tsup": "^6.4.0", + "typescript": "^4.8.4" + }, + "publishConfig": { + "access": "public" + }, + "auto": { + "plugins": [ + "npm", + "released" + ] + }, + "packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e" +} diff --git a/tools/ui/node_modules/@storybook/global/LICENSE b/tools/ui/node_modules/@storybook/global/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..7ae945ef11d23b7852658f4796aa636a2e3623fa --- /dev/null +++ b/tools/ui/node_modules/@storybook/global/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2022 Norbert de Langen. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/tools/ui/node_modules/@storybook/global/README.md b/tools/ui/node_modules/@storybook/global/README.md new file mode 100644 index 0000000000000000000000000000000000000000..9d7b9a76c786a617981eb7d45dd16c244a91fb3f --- /dev/null +++ b/tools/ui/node_modules/@storybook/global/README.md @@ -0,0 +1,13 @@ +# global + +Require global variables + +## Example + +```js +import { global } from "global"; +``` + +## Installation + +`yarn add @storybook/global` diff --git a/tools/ui/node_modules/@storybook/global/dist/index.d.ts b/tools/ui/node_modules/@storybook/global/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..2672d980ee80bd21c48f89cbfcc103b1414de0e2 --- /dev/null +++ b/tools/ui/node_modules/@storybook/global/dist/index.d.ts @@ -0,0 +1,3 @@ +declare const scope: typeof globalThis; + +export { scope as global }; diff --git a/tools/ui/node_modules/@storybook/global/dist/index.js b/tools/ui/node_modules/@storybook/global/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..e66746c67d60fc9ffdcb6042b61fdb151cd2dd11 --- /dev/null +++ b/tools/ui/node_modules/@storybook/global/dist/index.js @@ -0,0 +1,44 @@ +"use strict"; +var __defProp = Object.defineProperty; +var __getOwnPropDesc = Object.getOwnPropertyDescriptor; +var __getOwnPropNames = Object.getOwnPropertyNames; +var __hasOwnProp = Object.prototype.hasOwnProperty; +var __export = (target, all) => { + for (var name in all) + __defProp(target, name, { get: all[name], enumerable: true }); +}; +var __copyProps = (to, from, except, desc) => { + if (from && typeof from === "object" || typeof from === "function") { + for (let key of __getOwnPropNames(from)) + if (!__hasOwnProp.call(to, key) && key !== except) + __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); + } + return to; +}; +var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); + +// src/index.ts +var src_exports = {}; +__export(src_exports, { + global: () => scope +}); +module.exports = __toCommonJS(src_exports); +var scope = (() => { + let win; + if (typeof window !== "undefined") { + win = window; + } else if (typeof globalThis !== "undefined") { + win = globalThis; + } else if (typeof global !== "undefined") { + win = global; + } else if (typeof self !== "undefined") { + win = self; + } else { + win = {}; + } + return win; +})(); +// Annotate the CommonJS export names for ESM import in node: +0 && (module.exports = { + global +}); diff --git a/tools/ui/node_modules/@storybook/global/dist/index.mjs b/tools/ui/node_modules/@storybook/global/dist/index.mjs new file mode 100644 index 0000000000000000000000000000000000000000..b9c4573842c6fc980e980e94a2d9639f17282016 --- /dev/null +++ b/tools/ui/node_modules/@storybook/global/dist/index.mjs @@ -0,0 +1,19 @@ +// src/index.ts +var scope = (() => { + let win; + if (typeof window !== "undefined") { + win = window; + } else if (typeof globalThis !== "undefined") { + win = globalThis; + } else if (typeof global !== "undefined") { + win = global; + } else if (typeof self !== "undefined") { + win = self; + } else { + win = {}; + } + return win; +})(); +export { + scope as global +}; diff --git a/tools/ui/node_modules/@storybook/global/package.json b/tools/ui/node_modules/@storybook/global/package.json new file mode 100644 index 0000000000000000000000000000000000000000..1e3900f44d1434bbc3d2e991c979563fb4e8443f --- /dev/null +++ b/tools/ui/node_modules/@storybook/global/package.json @@ -0,0 +1,45 @@ +{ + "name": "@storybook/global", + "version": "5.0.0", + "description": "Require global variables", + "keywords": [], + "homepage": "https://github.com/storybookjs/global", + "repository": "git://github.com/storybookjs/global.git", + "license": "MIT", + "author": "Norbert ", + "sideEffects": false, + "exports": { + ".": { + "require": "./dist/index.js", + "import": "./dist/index.mjs", + "types": "./dist/index.d.ts" + }, + "./package.json": "./package.json" + }, + "main": "dist/index.js", + "module": "dist/index.mjs", + "types": "dist/index.d.ts", + "files": [ + "dist/**/*", + "README.md", + "*.js", + "*.d.ts" + ], + "scripts": { + "prep": "tsup ./src/index.ts " + }, + "devDependencies": { + "@types/node": "^18.11.10", + "@typescript-eslint/eslint-plugin": "^5.45.0", + "@typescript-eslint/parser": "^5.45.0", + "eslint": "^8.29.0", + "eslint-config-prettier": "^8.5.0", + "eslint-plugin-prettier": "^4.2.1", + "prettier": "^2.8.0", + "tsup": "^6.5.0", + "typescript": "^4.9.3" + }, + "publishConfig": { + "access": "public" + } +} diff --git a/tools/ui/node_modules/@storybook/icons/LICENSE.md b/tools/ui/node_modules/@storybook/icons/LICENSE.md new file mode 100644 index 0000000000000000000000000000000000000000..a855494d1120b4a2e0b034bd120c1b5b35eae68a --- /dev/null +++ b/tools/ui/node_modules/@storybook/icons/LICENSE.md @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2022 Tim Mikeladze + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/tools/ui/node_modules/@storybook/icons/README.md b/tools/ui/node_modules/@storybook/icons/README.md new file mode 100644 index 0000000000000000000000000000000000000000..eef140ad31583b6a2f85ef09dbc9fffe33999d2d --- /dev/null +++ b/tools/ui/node_modules/@storybook/icons/README.md @@ -0,0 +1,64 @@ +# Icons + + + +This library contains the icons used in Storybook and Chromatic apps and marketing sites. They are 14x14. To view the list of all available icons, please go to https://main--64b56e737c0aeefed9d5e675.chromatic.com/ + +## Install + +npm: + +```console +npm install @storybook/icons +``` + +yarn: + +```console +yarn add @storybook/icons +``` + +pnpm: + +```console +pnpm add @storybook/icons +``` + +## To Do + +- [x] Export every single icon instead of a single component +- [x] Add stories for each component + +## Generating new icons from Figma + +First, set local environment variables: + +```console +FIGMA_API_TOKEN= +FIGMA_FILE_ID= +FIGMA_CANVAS=Icons +``` + +Then, fetch all icons from Figma locally and create React components + stories automatically: + +```console +pnpm generate-icons +``` + +Inspired by [this article](https://blog.certa.dev/generating-react-icon-components-from-figma). + +## Developing + +Watch and rebuild code with `tsup` and run Storybook to preview your UI during development: + +```console +pnpm storybook +``` + +## Building + +Build package with `tsup` for production: + +```console +pnpm build +``` diff --git a/tools/ui/node_modules/@storybook/icons/dist/index.d.ts b/tools/ui/node_modules/@storybook/icons/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..43cf25ed9acc3b10e0ba32d26b14200fdcff2a2c --- /dev/null +++ b/tools/ui/node_modules/@storybook/icons/dist/index.d.ts @@ -0,0 +1,525 @@ +import * as React from 'react'; +import React__default from 'react'; + +declare const iconList: { + name: string; + icons: string[]; +}[]; + +interface IconProps extends React__default.SVGAttributes { + children?: never; + color?: string; + size?: number; +} + +declare const PhotoIcon: React.ForwardRefExoticComponent>; + +declare const ComponentIcon: React.ForwardRefExoticComponent>; + +declare const GridIcon: React.ForwardRefExoticComponent>; + +declare const OutlineIcon: React.ForwardRefExoticComponent>; + +declare const PhotoDragIcon: React.ForwardRefExoticComponent>; + +declare const PhotoStabilizeIcon: React.ForwardRefExoticComponent>; + +declare const CameraStabilizeIcon: React.ForwardRefExoticComponent>; + +declare const GridAltIcon: React.ForwardRefExoticComponent>; + +declare const SearchIcon: React.ForwardRefExoticComponent>; + +declare const ZoomIcon: React.ForwardRefExoticComponent>; + +declare const ZoomOutIcon: React.ForwardRefExoticComponent>; + +declare const ZoomResetIcon: React.ForwardRefExoticComponent>; + +declare const EyeIcon: React.ForwardRefExoticComponent>; + +declare const EyeCloseIcon: React.ForwardRefExoticComponent>; + +declare const LightningIcon: React.ForwardRefExoticComponent>; + +declare const LightningOffIcon: React.ForwardRefExoticComponent>; + +declare const MirrorIcon: React.ForwardRefExoticComponent>; + +declare const GrowIcon: React.ForwardRefExoticComponent>; + +declare const ContrastIcon: React.ForwardRefExoticComponent>; + +declare const SwitchAltIcon: React.ForwardRefExoticComponent>; + +declare const ContrastIgnoredIcon: React.ForwardRefExoticComponent>; + +declare const PaintBrushIcon: React.ForwardRefExoticComponent>; + +declare const PaintBrushAltIcon: React.ForwardRefExoticComponent>; + +declare const RulerIcon: React.ForwardRefExoticComponent>; + +declare const CameraIcon: React.ForwardRefExoticComponent>; + +declare const VideoIcon: React.ForwardRefExoticComponent>; + +declare const SpeakerIcon: React.ForwardRefExoticComponent>; + +declare const PlayIcon: React.ForwardRefExoticComponent>; + +declare const PlayBackIcon: React.ForwardRefExoticComponent>; + +declare const PlayNextIcon: React.ForwardRefExoticComponent>; + +declare const RewindIcon: React.ForwardRefExoticComponent>; + +declare const FastForwardIcon: React.ForwardRefExoticComponent>; + +declare const StopAltIcon: React.ForwardRefExoticComponent>; + +declare const SunIcon: React.ForwardRefExoticComponent>; + +declare const MoonIcon: React.ForwardRefExoticComponent>; + +declare const StopAltHollowIcon: React.ForwardRefExoticComponent>; + +declare const PlayHollowIcon: React.ForwardRefExoticComponent>; + +declare const PlayAllHollowIcon: React.ForwardRefExoticComponent>; + +declare const StopIcon: React.ForwardRefExoticComponent>; + +declare const SideBySideIcon: React.ForwardRefExoticComponent>; + +declare const StackedIcon: React.ForwardRefExoticComponent>; + +declare const BookIcon: React.ForwardRefExoticComponent>; + +declare const DocumentIcon: React.ForwardRefExoticComponent>; + +declare const CopyIcon: React.ForwardRefExoticComponent>; + +declare const FilesIcon: React.ForwardRefExoticComponent>; + +declare const CategoryIcon: React.ForwardRefExoticComponent>; + +declare const FolderIcon: React.ForwardRefExoticComponent>; + +declare const PrintIcon: React.ForwardRefExoticComponent>; + +declare const GraphLineIcon: React.ForwardRefExoticComponent>; + +declare const CalendarIcon: React.ForwardRefExoticComponent>; + +declare const GraphBarIcon: React.ForwardRefExoticComponent>; + +declare const AlignLeftIcon: React.ForwardRefExoticComponent>; + +declare const AlignRightIcon: React.ForwardRefExoticComponent>; + +declare const FilterIcon: React.ForwardRefExoticComponent>; + +declare const DocChartIcon: React.ForwardRefExoticComponent>; + +declare const DocListIcon: React.ForwardRefExoticComponent>; + +declare const DragIcon: React.ForwardRefExoticComponent>; + +declare const MenuIcon: React.ForwardRefExoticComponent>; + +declare const MarkupIcon: React.ForwardRefExoticComponent>; + +declare const BoldIcon: React.ForwardRefExoticComponent>; + +declare const ItalicIcon: React.ForwardRefExoticComponent>; + +declare const PaperClipIcon: React.ForwardRefExoticComponent>; + +declare const ListOrderedIcon: React.ForwardRefExoticComponent>; + +declare const ListUnorderedIcon: React.ForwardRefExoticComponent>; + +declare const ChecklistIcon: React.ForwardRefExoticComponent>; + +declare const ParagraphIcon: React.ForwardRefExoticComponent>; + +declare const MarkdownIcon: React.ForwardRefExoticComponent>; + +declare const RepoIcon: React.ForwardRefExoticComponent>; + +declare const CommitIcon: React.ForwardRefExoticComponent>; + +declare const BranchIcon: React.ForwardRefExoticComponent>; + +declare const PullRequestIcon: React.ForwardRefExoticComponent>; + +declare const MergeIcon: React.ForwardRefExoticComponent>; + +declare const AppleIcon: React.ForwardRefExoticComponent>; + +declare const LinuxIcon: React.ForwardRefExoticComponent>; + +declare const UbuntuIcon: React.ForwardRefExoticComponent>; + +declare const WindowsIcon: React.ForwardRefExoticComponent>; + +declare const ChromeIcon: React.ForwardRefExoticComponent>; + +declare const StorybookIcon: React.ForwardRefExoticComponent>; + +declare const AzureDevOpsIcon: React.ForwardRefExoticComponent>; + +declare const BitbucketIcon: React.ForwardRefExoticComponent>; + +declare const ChromaticIcon: React.ForwardRefExoticComponent>; + +declare const ComponentDrivenIcon: React.ForwardRefExoticComponent>; + +declare const DiscordIcon: React.ForwardRefExoticComponent>; + +declare const FacebookIcon: React.ForwardRefExoticComponent>; + +declare const FigmaIcon: React.ForwardRefExoticComponent>; + +declare const GDriveIcon: React.ForwardRefExoticComponent>; + +declare const GithubIcon: React.ForwardRefExoticComponent>; + +declare const GitlabIcon: React.ForwardRefExoticComponent>; + +declare const GoogleIcon: React.ForwardRefExoticComponent>; + +declare const GraphqlIcon: React.ForwardRefExoticComponent>; + +declare const MediumIcon: React.ForwardRefExoticComponent>; + +declare const ReduxIcon: React.ForwardRefExoticComponent>; + +declare const TwitterIcon: React.ForwardRefExoticComponent>; + +declare const YoutubeIcon: React.ForwardRefExoticComponent>; + +declare const VSCodeIcon: React.ForwardRefExoticComponent>; + +declare const LinkedinIcon: React.ForwardRefExoticComponent>; + +declare const XIcon: React.ForwardRefExoticComponent>; + +declare const BrowserIcon: React.ForwardRefExoticComponent>; + +declare const TabletIcon: React.ForwardRefExoticComponent>; + +declare const MobileIcon: React.ForwardRefExoticComponent>; + +declare const WatchIcon: React.ForwardRefExoticComponent>; + +declare const SidebarIcon: React.ForwardRefExoticComponent>; + +declare const SidebarAltIcon: React.ForwardRefExoticComponent>; + +declare const SidebarAltToggleIcon: React.ForwardRefExoticComponent>; + +declare const SidebarToggleIcon: React.ForwardRefExoticComponent>; + +declare const BottomBarIcon: React.ForwardRefExoticComponent>; + +declare const BottomBarToggleIcon: React.ForwardRefExoticComponent>; + +declare const CPUIcon: React.ForwardRefExoticComponent>; + +declare const DatabaseIcon: React.ForwardRefExoticComponent>; + +declare const MemoryIcon: React.ForwardRefExoticComponent>; + +declare const StructureIcon: React.ForwardRefExoticComponent>; + +declare const BoxIcon: React.ForwardRefExoticComponent>; + +declare const PowerIcon: React.ForwardRefExoticComponent>; + +declare const EditIcon: React.ForwardRefExoticComponent>; + +declare const CogIcon: React.ForwardRefExoticComponent>; + +declare const NutIcon: React.ForwardRefExoticComponent>; + +declare const WrenchIcon: React.ForwardRefExoticComponent>; + +declare const EllipsisIcon: React.ForwardRefExoticComponent>; + +declare const WandIcon: React.ForwardRefExoticComponent>; + +declare const SweepIcon: React.ForwardRefExoticComponent>; + +declare const CheckIcon: React.ForwardRefExoticComponent>; + +declare const FormIcon: React.ForwardRefExoticComponent>; + +declare const BatchDenyIcon: React.ForwardRefExoticComponent>; + +declare const BatchAcceptIcon: React.ForwardRefExoticComponent>; + +declare const ControlsIcon: React.ForwardRefExoticComponent>; + +declare const PlusIcon: React.ForwardRefExoticComponent>; + +declare const CloseAltIcon: React.ForwardRefExoticComponent>; + +declare const CrossIcon: React.ForwardRefExoticComponent>; + +declare const TrashIcon: React.ForwardRefExoticComponent>; + +declare const PinAltIcon: React.ForwardRefExoticComponent>; + +declare const UnpinIcon: React.ForwardRefExoticComponent>; + +declare const AddIcon: React.ForwardRefExoticComponent>; + +declare const SubtractIcon: React.ForwardRefExoticComponent>; + +declare const CloseIcon: React.ForwardRefExoticComponent>; + +declare const DeleteIcon: React.ForwardRefExoticComponent>; + +declare const PassedIcon: React.ForwardRefExoticComponent>; + +declare const ChangedIcon: React.ForwardRefExoticComponent>; + +declare const FailedIcon: React.ForwardRefExoticComponent>; + +declare const ClearIcon: React.ForwardRefExoticComponent>; + +declare const CommentIcon: React.ForwardRefExoticComponent>; + +declare const CommentAddIcon: React.ForwardRefExoticComponent>; + +declare const RequestChangeIcon: React.ForwardRefExoticComponent>; + +declare const CommentsIcon: React.ForwardRefExoticComponent>; + +declare const ChatIcon: React.ForwardRefExoticComponent>; + +declare const LockIcon: React.ForwardRefExoticComponent>; + +declare const UnlockIcon: React.ForwardRefExoticComponent>; + +declare const KeyIcon: React.ForwardRefExoticComponent>; + +declare const OutboxIcon: React.ForwardRefExoticComponent>; + +declare const CreditIcon: React.ForwardRefExoticComponent>; + +declare const ButtonIcon: React.ForwardRefExoticComponent>; + +declare const TypeIcon: React.ForwardRefExoticComponent>; + +declare const PointerDefaultIcon: React.ForwardRefExoticComponent>; + +declare const PointerHandIcon: React.ForwardRefExoticComponent>; + +declare const CommandIcon: React.ForwardRefExoticComponent>; + +declare const SaveIcon: React.ForwardRefExoticComponent>; + +declare const SortDownIcon: React.ForwardRefExoticComponent>; + +declare const SortUpIcon: React.ForwardRefExoticComponent>; + +declare const BugIcon: React.ForwardRefExoticComponent>; + +declare const EditorIcon: React.ForwardRefExoticComponent>; + +declare const InfoIcon: React.ForwardRefExoticComponent>; + +declare const QuestionIcon: React.ForwardRefExoticComponent>; + +declare const SupportIcon: React.ForwardRefExoticComponent>; + +declare const AlertIcon: React.ForwardRefExoticComponent>; + +declare const AlertAltIcon: React.ForwardRefExoticComponent>; + +declare const EmailIcon: React.ForwardRefExoticComponent>; + +declare const PhoneIcon: React.ForwardRefExoticComponent>; + +declare const LinkIcon: React.ForwardRefExoticComponent>; + +declare const LinkBrokenIcon: React.ForwardRefExoticComponent>; + +declare const BellIcon: React.ForwardRefExoticComponent>; + +declare const RSSIcon: React.ForwardRefExoticComponent>; + +declare const ShareAltIcon: React.ForwardRefExoticComponent>; + +declare const ShareIcon: React.ForwardRefExoticComponent>; + +declare const JumpToIcon: React.ForwardRefExoticComponent>; + +declare const CircleHollowIcon: React.ForwardRefExoticComponent>; + +declare const CircleIcon: React.ForwardRefExoticComponent>; + +declare const BookmarkHollowIcon: React.ForwardRefExoticComponent>; + +declare const BookmarkIcon: React.ForwardRefExoticComponent>; + +declare const DiamondIcon: React.ForwardRefExoticComponent>; + +declare const HeartHollowIcon: React.ForwardRefExoticComponent>; + +declare const HeartIcon: React.ForwardRefExoticComponent>; + +declare const StarHollowIcon: React.ForwardRefExoticComponent>; + +declare const StarIcon: React.ForwardRefExoticComponent>; + +declare const CertificateIcon: React.ForwardRefExoticComponent>; + +declare const VerifiedIcon: React.ForwardRefExoticComponent>; + +declare const ThumbsUpIcon: React.ForwardRefExoticComponent>; + +declare const ShieldIcon: React.ForwardRefExoticComponent>; + +declare const BasketIcon: React.ForwardRefExoticComponent>; + +declare const BeakerIcon: React.ForwardRefExoticComponent>; + +declare const HourglassIcon: React.ForwardRefExoticComponent>; + +declare const FlagIcon: React.ForwardRefExoticComponent>; + +declare const CloudHollowIcon: React.ForwardRefExoticComponent>; + +declare const CloudIcon: React.ForwardRefExoticComponent>; + +declare const StickerIcon: React.ForwardRefExoticComponent>; + +declare const StatusFailIcon: React.ForwardRefExoticComponent>; + +declare const StatusIcon: React.ForwardRefExoticComponent>; + +declare const StatusWarnIcon: React.ForwardRefExoticComponent>; + +declare const StatusPassIcon: React.ForwardRefExoticComponent>; + +declare const GiftIcon: React.ForwardRefExoticComponent>; + +declare const StatusNewIcon: React.ForwardRefExoticComponent>; + +declare const PopOutIcon: React.ForwardRefExoticComponent>; + +declare const ChevronUpIcon: React.ForwardRefExoticComponent>; + +declare const ChevronDownIcon: React.ForwardRefExoticComponent>; + +declare const ChevronLeftIcon: React.ForwardRefExoticComponent>; + +declare const ChevronRightIcon: React.ForwardRefExoticComponent>; + +declare const ChevronSmallUpIcon: React.ForwardRefExoticComponent>; + +declare const ChevronSmallDownIcon: React.ForwardRefExoticComponent>; + +declare const ChevronSmallLeftIcon: React.ForwardRefExoticComponent>; + +declare const ChevronSmallRightIcon: React.ForwardRefExoticComponent>; + +declare const ArrowUpIcon: React.ForwardRefExoticComponent>; + +declare const ArrowDownIcon: React.ForwardRefExoticComponent>; + +declare const ArrowLeftIcon: React.ForwardRefExoticComponent>; + +declare const ArrowRightIcon: React.ForwardRefExoticComponent>; + +declare const ArrowTopLeftIcon: React.ForwardRefExoticComponent>; + +declare const ArrowTopRightIcon: React.ForwardRefExoticComponent>; + +declare const ArrowBottomLeftIcon: React.ForwardRefExoticComponent>; + +declare const ArrowBottomRightIcon: React.ForwardRefExoticComponent>; + +declare const ArrowSolidUpIcon: React.ForwardRefExoticComponent>; + +declare const ArrowSolidDownIcon: React.ForwardRefExoticComponent>; + +declare const ArrowSolidLeftIcon: React.ForwardRefExoticComponent>; + +declare const ArrowSolidRightIcon: React.ForwardRefExoticComponent>; + +declare const ExpandAltIcon: React.ForwardRefExoticComponent>; + +declare const CollapseIcon: React.ForwardRefExoticComponent>; + +declare const ExpandIcon: React.ForwardRefExoticComponent>; + +declare const UnfoldIcon: React.ForwardRefExoticComponent>; + +declare const TransferIcon: React.ForwardRefExoticComponent>; + +declare const RedirectIcon: React.ForwardRefExoticComponent>; + +declare const UndoIcon: React.ForwardRefExoticComponent>; + +declare const ReplyIcon: React.ForwardRefExoticComponent>; + +declare const SyncIcon: React.ForwardRefExoticComponent>; + +declare const UploadIcon: React.ForwardRefExoticComponent>; + +declare const DownloadIcon: React.ForwardRefExoticComponent>; + +declare const BackIcon: React.ForwardRefExoticComponent>; + +declare const ProceedIcon: React.ForwardRefExoticComponent>; + +declare const RefreshIcon: React.ForwardRefExoticComponent>; + +declare const GlobeIcon: React.ForwardRefExoticComponent>; + +declare const CompassIcon: React.ForwardRefExoticComponent>; + +declare const LocationIcon: React.ForwardRefExoticComponent>; + +declare const PinIcon: React.ForwardRefExoticComponent>; + +declare const TimeIcon: React.ForwardRefExoticComponent>; + +declare const DashboardIcon: React.ForwardRefExoticComponent>; + +declare const TimerIcon: React.ForwardRefExoticComponent>; + +declare const HomeIcon: React.ForwardRefExoticComponent>; + +declare const AdminIcon: React.ForwardRefExoticComponent>; + +declare const DirectionIcon: React.ForwardRefExoticComponent>; + +declare const UserIcon: React.ForwardRefExoticComponent>; + +declare const UserAltIcon: React.ForwardRefExoticComponent>; + +declare const UserAddIcon: React.ForwardRefExoticComponent>; + +declare const UsersIcon: React.ForwardRefExoticComponent>; + +declare const ProfileIcon: React.ForwardRefExoticComponent>; + +declare const FaceHappyIcon: React.ForwardRefExoticComponent>; + +declare const FaceNeutralIcon: React.ForwardRefExoticComponent>; + +declare const FaceSadIcon: React.ForwardRefExoticComponent>; + +declare const AccessibilityIcon: React.ForwardRefExoticComponent>; + +declare const AccessibilityAltIcon: React.ForwardRefExoticComponent>; + +declare const AccessibilityIgnoredIcon: React.ForwardRefExoticComponent>; + +export { AccessibilityAltIcon, AccessibilityIcon, AccessibilityIgnoredIcon, AddIcon, AdminIcon, AlertAltIcon, AlertIcon, AlignLeftIcon, AlignRightIcon, AppleIcon, ArrowBottomLeftIcon, ArrowBottomRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowSolidDownIcon, ArrowSolidLeftIcon, ArrowSolidRightIcon, ArrowSolidUpIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowUpIcon, AzureDevOpsIcon, BackIcon, BasketIcon, BatchAcceptIcon, BatchDenyIcon, BeakerIcon, BellIcon, BitbucketIcon, BoldIcon, BookIcon, BookmarkHollowIcon, BookmarkIcon, BottomBarIcon, BottomBarToggleIcon, BoxIcon, BranchIcon, BrowserIcon, BugIcon, ButtonIcon, CPUIcon, CalendarIcon, CameraIcon, CameraStabilizeIcon, CategoryIcon, CertificateIcon, ChangedIcon, ChatIcon, CheckIcon, ChecklistIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronSmallDownIcon, ChevronSmallLeftIcon, ChevronSmallRightIcon, ChevronSmallUpIcon, ChevronUpIcon, ChromaticIcon, ChromeIcon, CircleHollowIcon, CircleIcon, ClearIcon, CloseAltIcon, CloseIcon, CloudHollowIcon, CloudIcon, CogIcon, CollapseIcon, CommandIcon, CommentAddIcon, CommentIcon, CommentsIcon, CommitIcon, CompassIcon, ComponentDrivenIcon, ComponentIcon, ContrastIcon, ContrastIgnoredIcon, ControlsIcon, CopyIcon, CreditIcon, CrossIcon, DashboardIcon, DatabaseIcon, DeleteIcon, DiamondIcon, DirectionIcon, DiscordIcon, DocChartIcon, DocListIcon, DocumentIcon, DownloadIcon, DragIcon, EditIcon, EditorIcon, EllipsisIcon, EmailIcon, ExpandAltIcon, ExpandIcon, EyeCloseIcon, EyeIcon, FaceHappyIcon, FaceNeutralIcon, FaceSadIcon, FacebookIcon, FailedIcon, FastForwardIcon, FigmaIcon, FilesIcon, FilterIcon, FlagIcon, FolderIcon, FormIcon, GDriveIcon, GiftIcon, GithubIcon, GitlabIcon, GlobeIcon, GoogleIcon, GraphBarIcon, GraphLineIcon, GraphqlIcon, GridAltIcon, GridIcon, GrowIcon, HeartHollowIcon, HeartIcon, HomeIcon, HourglassIcon, InfoIcon, ItalicIcon, JumpToIcon, KeyIcon, LightningIcon, LightningOffIcon, LinkBrokenIcon, LinkIcon, LinkedinIcon, LinuxIcon, ListOrderedIcon, ListUnorderedIcon, LocationIcon, LockIcon, MarkdownIcon, MarkupIcon, MediumIcon, MemoryIcon, MenuIcon, MergeIcon, MirrorIcon, MobileIcon, MoonIcon, NutIcon, OutboxIcon, OutlineIcon, PaintBrushAltIcon, PaintBrushIcon, PaperClipIcon, ParagraphIcon, PassedIcon, PhoneIcon, PhotoDragIcon, PhotoIcon, PhotoStabilizeIcon, PinAltIcon, PinIcon, PlayAllHollowIcon, PlayBackIcon, PlayHollowIcon, PlayIcon, PlayNextIcon, PlusIcon, PointerDefaultIcon, PointerHandIcon, PopOutIcon, PowerIcon, PrintIcon, ProceedIcon, ProfileIcon, PullRequestIcon, QuestionIcon, RSSIcon, RedirectIcon, ReduxIcon, RefreshIcon, ReplyIcon, RepoIcon, RequestChangeIcon, RewindIcon, RulerIcon, SaveIcon, SearchIcon, ShareAltIcon, ShareIcon, ShieldIcon, SideBySideIcon, SidebarAltIcon, SidebarAltToggleIcon, SidebarIcon, SidebarToggleIcon, SortDownIcon, SortUpIcon, SpeakerIcon, StackedIcon, StarHollowIcon, StarIcon, StatusFailIcon, StatusIcon, StatusNewIcon, StatusPassIcon, StatusWarnIcon, StickerIcon, StopAltHollowIcon, StopAltIcon, StopIcon, StorybookIcon, StructureIcon, SubtractIcon, SunIcon, SupportIcon, SweepIcon, SwitchAltIcon, SyncIcon, TabletIcon, ThumbsUpIcon, TimeIcon, TimerIcon, TransferIcon, TrashIcon, TwitterIcon, TypeIcon, UbuntuIcon, UndoIcon, UnfoldIcon, UnlockIcon, UnpinIcon, UploadIcon, UserAddIcon, UserAltIcon, UserIcon, UsersIcon, VSCodeIcon, VerifiedIcon, VideoIcon, WandIcon, WatchIcon, WindowsIcon, WrenchIcon, XIcon, YoutubeIcon, ZoomIcon, ZoomOutIcon, ZoomResetIcon, iconList }; diff --git a/tools/ui/node_modules/@storybook/icons/dist/index.js b/tools/ui/node_modules/@storybook/icons/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..d93ef0e9f29342667da7757369d5b4fead0bb8c9 --- /dev/null +++ b/tools/ui/node_modules/@storybook/icons/dist/index.js @@ -0,0 +1,6563 @@ +import * as React255 from 'react'; + +// src/iconList.tsx +var iconList = [ + { + name: "Images", + icons: [ + "PhotoIcon", + "ComponentIcon", + "GridIcon", + "OutlineIcon", + "PhotoDragIcon", + "PhotoStabilizeIcon", + "CameraStabilizeIcon", + "GridAltIcon", + "SearchIcon", + "ZoomIcon", + "ZoomOutIcon", + "ZoomResetIcon", + "EyeIcon", + "EyeCloseIcon", + "LightningIcon", + "LightningOffIcon", + "MirrorIcon", + "GrowIcon", + "ContrastIcon", + "SwitchAltIcon", + "ContrastIgnoredIcon", + "PaintBrushIcon", + "PaintBrushAltIcon", + "RulerIcon", + "CameraIcon", + "VideoIcon", + "SpeakerIcon", + "PlayIcon", + "PlayBackIcon", + "PlayNextIcon", + "RewindIcon", + "FastForwardIcon", + "StopAltIcon", + "SunIcon", + "MoonIcon", + "StopAltHollowIcon", + "PlayHollowIcon", + "PlayAllHollowIcon", + "StopIcon", + "SideBySideIcon", + "StackedIcon" + ] + }, + { + name: "Documents", + icons: [ + "BookIcon", + "DocumentIcon", + "CopyIcon", + "FilesIcon", + "CategoryIcon", + "FolderIcon", + "PrintIcon", + "GraphLineIcon", + "CalendarIcon", + "GraphBarIcon", + "AlignLeftIcon", + "AlignRightIcon", + "FilterIcon", + "DocChartIcon", + "DocListIcon", + "DragIcon", + "MenuIcon" + ] + }, + { + name: "Editing", + icons: [ + "MarkupIcon", + "BoldIcon", + "ItalicIcon", + "PaperClipIcon", + "ListOrderedIcon", + "ListUnorderedIcon", + "ChecklistIcon", + "ParagraphIcon", + "MarkdownIcon" + ] + }, + { + name: "Git", + icons: [ + "RepoIcon", + "CommitIcon", + "BranchIcon", + "PullRequestIcon", + "MergeIcon" + ] + }, + { + name: "OS", + icons: [ + "AppleIcon", + "LinuxIcon", + "UbuntuIcon", + "WindowsIcon", + "ChromeIcon" + ] + }, + { + name: "Logos", + icons: [ + "StorybookIcon", + "AzureDevOpsIcon", + "BitbucketIcon", + "ChromaticIcon", + "ComponentDrivenIcon", + "DiscordIcon", + "FacebookIcon", + "FigmaIcon", + "GDriveIcon", + "GithubIcon", + "GitlabIcon", + "GoogleIcon", + "GraphqlIcon", + "MediumIcon", + "ReduxIcon", + "TwitterIcon", + "YoutubeIcon", + "VSCodeIcon", + "LinkedinIcon", + "XIcon" + ] + }, + { + name: "Devices", + icons: [ + "BrowserIcon", + "TabletIcon", + "MobileIcon", + "WatchIcon", + "SidebarIcon", + "SidebarAltIcon", + "SidebarAltToggleIcon", + "SidebarToggleIcon", + "BottomBarIcon", + "BottomBarToggleIcon", + "CPUIcon", + "DatabaseIcon", + "MemoryIcon", + "StructureIcon", + "BoxIcon", + "PowerIcon" + ] + }, + { + name: "CRUD", + icons: [ + "EditIcon", + "CogIcon", + "NutIcon", + "WrenchIcon", + "EllipsisIcon", + "WandIcon", + "SweepIcon", + "CheckIcon", + "FormIcon", + "BatchDenyIcon", + "BatchAcceptIcon", + "ControlsIcon", + "PlusIcon", + "CloseAltIcon", + "CrossIcon", + "TrashIcon", + "PinAltIcon", + "UnpinIcon", + "AddIcon", + "SubtractIcon", + "CloseIcon", + "DeleteIcon", + "PassedIcon", + "ChangedIcon", + "FailedIcon", + "ClearIcon", + "CommentIcon", + "CommentAddIcon", + "RequestChangeIcon", + "CommentsIcon", + "ChatIcon", + "LockIcon", + "UnlockIcon", + "KeyIcon", + "OutboxIcon", + "CreditIcon", + "ButtonIcon", + "TypeIcon", + "PointerDefaultIcon", + "PointerHandIcon", + "CommandIcon", + "SaveIcon", + "SortDownIcon", + "SortUpIcon", + "BugIcon", + "EditorIcon" + ] + }, + { + name: "Communicate", + icons: [ + "InfoIcon", + "QuestionIcon", + "SupportIcon", + "AlertIcon", + "AlertAltIcon", + "EmailIcon", + "PhoneIcon", + "LinkIcon", + "LinkBrokenIcon", + "BellIcon", + "RSSIcon", + "ShareAltIcon", + "ShareIcon", + "JumpToIcon", + "CircleHollowIcon", + "CircleIcon", + "BookmarkHollowIcon", + "BookmarkIcon", + "DiamondIcon", + "HeartHollowIcon", + "HeartIcon", + "StarHollowIcon", + "StarIcon", + "CertificateIcon", + "VerifiedIcon", + "ThumbsUpIcon", + "ShieldIcon", + "BasketIcon", + "BeakerIcon", + "HourglassIcon", + "FlagIcon", + "CloudHollowIcon", + "CloudIcon", + "StickerIcon", + "StatusFailIcon", + "StatusIcon", + "StatusWarnIcon", + "StatusPassIcon", + "GiftIcon", + "StatusNewIcon", + "PopOutIcon" + ] + }, + { + name: "Wayfinding", + icons: [ + "ChevronUpIcon", + "ChevronDownIcon", + "ChevronLeftIcon", + "ChevronRightIcon", + "ChevronSmallUpIcon", + "ChevronSmallDownIcon", + "ChevronSmallLeftIcon", + "ChevronSmallRightIcon", + "ArrowUpIcon", + "ArrowDownIcon", + "ArrowLeftIcon", + "ArrowRightIcon", + "ArrowTopLeftIcon", + "ArrowTopRightIcon", + "ArrowBottomLeftIcon", + "ArrowBottomRightIcon", + "ArrowSolidUpIcon", + "ArrowSolidDownIcon", + "ArrowSolidLeftIcon", + "ArrowSolidRightIcon", + "ExpandAltIcon", + "CollapseIcon", + "ExpandIcon", + "UnfoldIcon", + "TransferIcon", + "RedirectIcon", + "UndoIcon", + "ReplyIcon", + "SyncIcon", + "UploadIcon", + "DownloadIcon", + "BackIcon", + "ProceedIcon", + "RefreshIcon", + "GlobeIcon", + "CompassIcon", + "LocationIcon", + "PinIcon", + "TimeIcon", + "DashboardIcon", + "TimerIcon", + "HomeIcon", + "AdminIcon", + "DirectionIcon" + ] + }, + { + name: "People", + icons: [ + "UserIcon", + "UserAltIcon", + "UserAddIcon", + "UsersIcon", + "ProfileIcon", + "FaceHappyIcon", + "FaceNeutralIcon", + "FaceSadIcon", + "AccessibilityIcon", + "AccessibilityAltIcon", + "AccessibilityIgnoredIcon" + ] + } +]; +var PhotoIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M6.25 4.254a1.25 1.25 0 11-2.5 0 1.25 1.25 0 012.5 0zm-.5 0a.75.75 0 11-1.5 0 .75.75 0 011.5 0z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M13 1.504v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-11a.5.5 0 01.5-.5h11a.5.5 0 01.5.5zM2 9.297V2.004h10v5.293L9.854 5.15a.5.5 0 00-.708 0L6.5 7.797 5.354 6.65a.5.5 0 00-.708 0L2 9.297zM9.5 6.21l2.5 2.5v3.293H2V10.71l3-3 3.146 3.146a.5.5 0 00.708-.707L7.207 8.504 9.5 6.21z", + fill: color + } + ) + ); +}); +var ComponentIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M3.5 1.004a2.5 2.5 0 00-2.5 2.5v7a2.5 2.5 0 002.5 2.5h7a2.5 2.5 0 002.5-2.5v-7a2.5 2.5 0 00-2.5-2.5h-7zm8.5 5.5H7.5v-4.5h3a1.5 1.5 0 011.5 1.5v3zm0 1v3a1.5 1.5 0 01-1.5 1.5h-3v-4.5H12zm-5.5 4.5v-4.5H2v3a1.5 1.5 0 001.5 1.5h3zM2 6.504h4.5v-4.5h-3a1.5 1.5 0 00-1.5 1.5v3z", + fill: color + } + ) + ); +}); +var GridIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M1 1.504a.5.5 0 01.5-.5H6a.5.5 0 01.5.5v4.5a.5.5 0 01-.5.5H1.5a.5.5 0 01-.5-.5v-4.5zm1 4v-3.5h3.5v3.5H2zM7.5 1.504a.5.5 0 01.5-.5h4.5a.5.5 0 01.5.5v4.5a.5.5 0 01-.5.5H8a.5.5 0 01-.5-.5v-4.5zm1 4v-3.5H12v3.5H8.5zM1.5 7.504a.5.5 0 00-.5.5v4.5a.5.5 0 00.5.5H6a.5.5 0 00.5-.5v-4.5a.5.5 0 00-.5-.5H1.5zm.5 1v3.5h3.5v-3.5H2zM7.5 8.004a.5.5 0 01.5-.5h4.5a.5.5 0 01.5.5v4.5a.5.5 0 01-.5.5H8a.5.5 0 01-.5-.5v-4.5zm1 4v-3.5H12v3.5H8.5z", + fill: color + } + ) + ); +}); +var OutlineIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M2 2.004v2H1v-2.5a.5.5 0 01.5-.5H4v1H2zM1 9.004v-4h1v4H1zM1 10.004v2.5a.5.5 0 00.5.5H4v-1H2v-2H1zM10 13.004h2.5a.5.5 0 00.5-.5v-2.5h-1v2h-2v1zM12 4.004h1v-2.5a.5.5 0 00-.5-.5H10v1h2v2zM9 12.004v1H5v-1h4zM9 1.004v1H5v-1h4zM13 9.004h-1v-4h1v4zM7 8.004a1 1 0 100-2 1 1 0 000 2z", + fill: color + } + ) + ); +}); +var PhotoDragIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 15", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M8.25 3.254a1.25 1.25 0 11-2.5 0 1.25 1.25 0 012.5 0zm-.5 0a.75.75 0 11-1.5 0 .75.75 0 011.5 0z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M14 7.003v-6.5a.5.5 0 00-.5-.5h-10a.5.5 0 00-.5.5v2.5H.5a.5.5 0 00-.5.5v2.5h1v-2h2v6.5a.5.5 0 00.5.5H10v2H8v1h2.5a.5.5 0 00.5-.5v-2.5h2.5a.5.5 0 00.5-.5v-3.5zm-10-6v5.794L5.646 5.15a.5.5 0 01.708 0L7.5 6.297l2.646-2.647a.5.5 0 01.708 0L13 5.797V1.004H4zm9 6.208l-2.5-2.5-2.293 2.293L9.354 8.15a.5.5 0 11-.708.707L6 6.211l-2 2v1.793h9V7.21z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M0 10.004v-3h1v3H0zM0 13.504v-2.5h1v2h2v1H.5a.5.5 0 01-.5-.5zM7 14.004H4v-1h3v1z", + fill: color + } + ) + ); +}); +var PhotoStabilizeIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M6 4a1.25 1.25 0 110 2.5A1.25 1.25 0 016 4zm0 .5A.75.75 0 106 6a.75.75 0 000-1.5z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M11.5 2a.5.5 0 01.5.5v9a.5.5 0 01-.5.5h-9a.5.5 0 01-.5-.5v-9a.5.5 0 01.5-.5h9zM7.207 9l.647.646a.5.5 0 01-.708.707L5 8.207l-2 2V11h8V8.207l-1.5-1.5L7.207 9zM3 8.793l1.646-1.647.079-.064a.5.5 0 01.629.064L6.5 8.293l2.646-2.647.079-.064a.5.5 0 01.629.064L11 6.793V3H3v5.793z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M0 3.5v-1A2.5 2.5 0 012.5 0h1a.5.5 0 010 1h-1A1.5 1.5 0 001 2.5v1a.5.5 0 01-1 0zM10.5 0h1A2.5 2.5 0 0114 2.5v1a.5.5 0 01-1 0v-1A1.5 1.5 0 0011.5 1h-1a.5.5 0 010-1zM0 10.5v1A2.5 2.5 0 002.5 14h1a.5.5 0 000-1h-1A1.5 1.5 0 011 11.5v-1a.5.5 0 00-1 0zM10.5 14h1a2.5 2.5 0 002.5-2.5v-1a.5.5 0 00-1 0v1a1.5 1.5 0 01-1.5 1.5h-1a.5.5 0 000 1z", + fill: color + } + ) + ); +}); +var CameraStabilizeIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement("g", { clipPath: "url(#prefix__clip0_2484_400)", fill: color }, /* @__PURE__ */ React255.createElement("path", { d: "M2.5 1A1.5 1.5 0 001 2.5v1a.5.5 0 01-1 0v-1A2.5 2.5 0 012.5 0h1a.5.5 0 010 1h-1zM8 7a1 1 0 11-2 0 1 1 0 012 0z" }), /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M5.852 2.223A.5.5 0 016.268 2h1.464a.5.5 0 01.416.223L9.333 4H11.5a.5.5 0 01.5.5v5a.5.5 0 01-.5.5h-9a.5.5 0 01-.5-.5v-5a.5.5 0 01.5-.5h2.167l1.185-1.777zM9 7a2 2 0 11-4 0 2 2 0 014 0z" + } + ), /* @__PURE__ */ React255.createElement("path", { d: "M11.5 1A1.5 1.5 0 0113 2.5v1a.5.5 0 001 0v-1A2.5 2.5 0 0011.5 0h-1a.5.5 0 000 1h1zM2.5 13A1.5 1.5 0 011 11.5v-1a.5.5 0 00-1 0v1A2.5 2.5 0 002.5 14h1a.5.5 0 000-1h-1zM11.5 13a1.5 1.5 0 001.5-1.5v-1a.5.5 0 011 0v1a2.5 2.5 0 01-2.5 2.5h-1a.5.5 0 010-1h1z" })), + /* @__PURE__ */ React255.createElement("defs", null, /* @__PURE__ */ React255.createElement("clipPath", { id: "prefix__clip0_2484_400" }, /* @__PURE__ */ React255.createElement("path", { fill: "#fff", d: "M0 0h14v14H0z" }))) + ); +}); +var GridAltIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M4 3V1h1v2H4zM4 6v2h1V6H4zM4 11v2h1v-2H4zM9 11v2h1v-2H9zM9 8V6h1v2H9zM9 1v2h1V1H9zM13 5h-2V4h2v1zM11 10h2V9h-2v1zM3 10H1V9h2v1zM1 5h2V4H1v1zM8 5H6V4h2v1zM6 10h2V9H6v1zM4 4h1v1H4V4zM10 4H9v1h1V4zM9 9h1v1H9V9zM5 9H4v1h1V9z", + fill: color + } + ) + ); +}); +var SearchIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M9.544 10.206a5.5 5.5 0 11.662-.662.5.5 0 01.148.102l3 3a.5.5 0 01-.708.708l-3-3a.5.5 0 01-.102-.148zM10.5 6a4.5 4.5 0 11-9 0 4.5 4.5 0 019 0z", + fill: color + } + ) + ); +}); +var ZoomIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M6 3.5a.5.5 0 01.5.5v1.5H8a.5.5 0 010 1H6.5V8a.5.5 0 01-1 0V6.5H4a.5.5 0 010-1h1.5V4a.5.5 0 01.5-.5z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M9.544 10.206a5.5 5.5 0 11.662-.662.5.5 0 01.148.102l3 3a.5.5 0 01-.708.708l-3-3a.5.5 0 01-.102-.148zM10.5 6a4.5 4.5 0 11-9 0 4.5 4.5 0 019 0z", + fill: color + } + ) + ); +}); +var ZoomOutIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement("path", { d: "M4 5.5a.5.5 0 000 1h4a.5.5 0 000-1H4z", fill: color }), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M6 11.5c1.35 0 2.587-.487 3.544-1.294a.5.5 0 00.102.148l3 3a.5.5 0 00.708-.708l-3-3a.5.5 0 00-.148-.102A5.5 5.5 0 106 11.5zm0-1a4.5 4.5 0 100-9 4.5 4.5 0 000 9z", + fill: color + } + ) + ); +}); +var ZoomResetIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M1.5 2.837V1.5a.5.5 0 00-1 0V4a.5.5 0 00.5.5h2.5a.5.5 0 000-1H2.258a4.5 4.5 0 11-.496 4.016.5.5 0 10-.942.337 5.502 5.502 0 008.724 2.353.5.5 0 00.102.148l3 3a.5.5 0 00.708-.708l-3-3a.5.5 0 00-.148-.102A5.5 5.5 0 101.5 2.837z", + fill: color + } + ) + ); +}); +var EyeIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement("path", { d: "M7 9.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5z", fill: color }), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M14 7l-.21.293C13.669 7.465 10.739 11.5 7 11.5S.332 7.465.21 7.293L0 7l.21-.293C.331 6.536 3.261 2.5 7 2.5s6.668 4.036 6.79 4.207L14 7zM2.896 5.302A12.725 12.725 0 001.245 7c.296.37.874 1.04 1.65 1.698C4.043 9.67 5.482 10.5 7 10.5c1.518 0 2.958-.83 4.104-1.802A12.72 12.72 0 0012.755 7c-.297-.37-.875-1.04-1.65-1.698C9.957 4.33 8.517 3.5 7 3.5c-1.519 0-2.958.83-4.104 1.802z", + fill: color + } + ) + ); +}); +var EyeCloseIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M1.854 1.146a.5.5 0 10-.708.708l11 11a.5.5 0 00.708-.708l-11-11zM11.104 8.698c-.177.15-.362.298-.553.439l.714.714a13.25 13.25 0 002.526-2.558L14 7l-.21-.293C13.669 6.536 10.739 2.5 7 2.5c-.89 0-1.735.229-2.506.58l.764.763A4.859 4.859 0 017 3.5c1.518 0 2.958.83 4.104 1.802A12.724 12.724 0 0112.755 7a12.72 12.72 0 01-1.65 1.698zM.21 6.707c.069-.096 1.03-1.42 2.525-2.558l.714.714c-.191.141-.376.288-.553.439A12.725 12.725 0 001.245 7c.296.37.874 1.04 1.65 1.698C4.043 9.67 5.482 10.5 7 10.5a4.86 4.86 0 001.742-.344l.764.764c-.772.351-1.616.58-2.506.58C3.262 11.5.332 7.465.21 7.293L0 7l.21-.293z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M4.5 7c0-.322.061-.63.172-.914l3.242 3.242A2.5 2.5 0 014.5 7zM9.328 7.914L6.086 4.672a2.5 2.5 0 013.241 3.241z", + fill: color + } + ) + ); +}); +var LightningIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M2.522 6.6a.566.566 0 00-.176.544.534.534 0 00.382.41l2.781.721-1.493 5.013a.563.563 0 00.216.627.496.496 0 00.63-.06l6.637-6.453a.568.568 0 00.151-.54.534.534 0 00-.377-.396l-2.705-.708 2.22-4.976a.568.568 0 00-.15-.666.497.497 0 00-.648.008L2.522 6.6zm7.72.63l-3.067-.804L9.02 2.29 3.814 6.803l2.95.764-1.277 4.285 4.754-4.622zM4.51 13.435l.037.011-.037-.011z", + fill: color + } + ) + ); +}); +var LightningOffIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M10.139 8.725l1.36-1.323a.568.568 0 00.151-.54.534.534 0 00-.377-.396l-2.705-.708 2.22-4.976a.568.568 0 00-.15-.666.497.497 0 00-.648.008L5.464 4.05l.708.71 2.848-2.47-1.64 3.677.697.697 2.164.567-.81.787.708.708zM2.523 6.6a.566.566 0 00-.177.544.534.534 0 00.382.41l2.782.721-1.494 5.013a.563.563 0 00.217.627.496.496 0 00.629-.06l3.843-3.736-.708-.707-2.51 2.44 1.137-3.814-.685-.685-2.125-.55.844-.731-.71-.71L2.524 6.6zM1.854 1.146a.5.5 0 10-.708.708l11 11a.5.5 0 00.708-.708l-11-11z", + fill: color + } + ) + ); +}); +var MirrorIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M1 1.504a.5.5 0 01.5-.5h11a.5.5 0 01.5.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-11zm1 10.5h10v-10l-10 10z", + fill: color + } + ) + ); +}); +var GrowIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M1.5 1.004a.5.5 0 100 1H12v10.5a.5.5 0 001 0v-10.5a1 1 0 00-1-1H1.5z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M1 3.504a.5.5 0 01.5-.5H10a1 1 0 011 1v8.5a.5.5 0 01-1 0v-8.5H1.5a.5.5 0 01-.5-.5z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M1.5 5.004a.5.5 0 00-.5.5v7a.5.5 0 00.5.5h7a.5.5 0 00.5-.5v-7a.5.5 0 00-.5-.5h-7zm.5 1v6h6v-6H2z", + fill: color + } + ) + ); +}); +var ContrastIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 15", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M3 3.004H.5a.5.5 0 00-.5.5v10a.5.5 0 00.5.5h10a.5.5 0 00.5-.5v-2.5h2.5a.5.5 0 00.5-.5v-10a.5.5 0 00-.5-.5h-10a.5.5 0 00-.5.5v2.5zm1 1v2.293l2.293-2.293H4zm-1 0v6.5a.499.499 0 00.497.5H10v2H1v-9h2zm1-1h6.5a.499.499 0 01.5.5v6.5h2v-9H4v2zm6 7V7.71l-2.293 2.293H10zm0-3.707V4.71l-5.293 5.293h1.586L10 6.297zm-.707-2.293H7.707L4 7.71v1.586l5.293-5.293z", + fill: color + } + ) + ); +}); +var SwitchAltIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 15", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M3 3.004v-2.5a.5.5 0 01.5-.5h10a.5.5 0 01.5.5v10a.5.5 0 01-.5.5H11v2.5a.5.5 0 01-.5.5H.5a.5.5 0 01-.5-.5v-10a.5.5 0 01.5-.5H3zm1 0v-2h9v9h-2v-6.5a.5.5 0 00-.5-.5H4zm6 8v2H1v-9h2v6.5a.5.5 0 00.5.5H10zm0-1H4v-6h6v6z", + fill: color + } + ) + ); +}); +var ContrastIgnoredIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "g", + { + clipPath: "url(#prefix__clip0_2359_559)", + fillRule: "evenodd", + clipRule: "evenodd", + fill: color + }, + /* @__PURE__ */ React255.createElement("path", { d: "M3 3.004H.5a.5.5 0 00-.5.5v10a.5.5 0 00.5.5h7.176a4.526 4.526 0 01-.916-1H1v-9h2v6.5a.499.499 0 00.497.5h2.531a4.548 4.548 0 01-.001-1h-1.32l2.16-2.16c.274-.374.603-.703.977-.977L10 4.711v1.316a4.552 4.552 0 011 0V3.504a.48.48 0 00-.038-.191.5.5 0 00-.462-.31H4v-2h9v5.755c.378.253.715.561 1 .913V.504a.5.5 0 00-.5-.5h-10a.5.5 0 00-.5.5v2.5zm1 1v2.293l2.293-2.293H4zm5.293 0H7.707L4 7.71v1.586l5.293-5.293z" }), + /* @__PURE__ */ React255.createElement("path", { d: "M14 10.5a3.5 3.5 0 11-7 0 3.5 3.5 0 017 0zm-5.5 0A.5.5 0 019 10h3a.5.5 0 010 1H9a.5.5 0 01-.5-.5z" }) + ), + /* @__PURE__ */ React255.createElement("defs", null, /* @__PURE__ */ React255.createElement("clipPath", { id: "prefix__clip0_2359_559" }, /* @__PURE__ */ React255.createElement("path", { fill: "#fff", d: "M0 0h14v14H0z" }))) + ); +}); +var PaintBrushIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M11.854.146a.5.5 0 00-.708 0L2.983 8.31a2.24 2.24 0 00-1.074.6C.677 10.14.24 11.902.085 12.997 0 13.6 0 14 0 14s.4 0 1.002-.085c1.095-.155 2.857-.592 4.089-1.824a2.24 2.24 0 00.6-1.074l8.163-8.163a.5.5 0 000-.708l-2-2zM5.6 9.692l.942-.942L5.25 7.457l-.942.943A2.242 2.242 0 015.6 9.692zm1.649-1.65L12.793 2.5 11.5 1.207 5.957 6.75 7.25 8.043zM4.384 9.617a1.25 1.25 0 010 1.768c-.767.766-1.832 1.185-2.78 1.403-.17.04-.335.072-.49.098.027-.154.06-.318.099-.49.219-.947.637-2.012 1.403-2.779a1.25 1.25 0 011.768 0z", + fill: color + } + ) + ); +}); +var PaintBrushAltIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M10.027.271a.752.752 0 01.947 0l.057.052 2.646 2.647.052.056a.752.752 0 010 .948l-.052.056-4.47 4.47 1.147 1.146.293-.293a.5.5 0 01.707 0l2.293 2.293a.5.5 0 010 .707l-1.293 1.293-.078.065a.502.502 0 01-.55 0l-.08-.065-2.292-2.293a.5.5 0 010-.707l.293-.293L8.324 9.03a.75.75 0 010-1.06l4.47-4.47L10.5 1.207l-.647.646.086.086a1.5 1.5 0 010 2.122L4.5 9.5l-.177.183C2.592 11.53 4 12.03 4 13a1 1 0 01-2 0c0-1 1.464-1.537 0-3l.003-.004-.063-.057-.879-.879a1.5 1.5 0 01-.103-2.006l.103-.115L6.94 1.061a1.5 1.5 0 012.121 0l.086.085.823-.823.057-.052zM10.415 11L12 12.586l.585-.586-1.585-1.586-.586.586zM8.354 1.768a.5.5 0 00-.629-.064l-.078.064L2.32 7.094c.782.138 2.263-.097 3.52-.349l3.393-3.392.063-.078a.501.501 0 000-.55l-.063-.079-.879-.878z", + fill: color + } + ) + ); +}); +var RulerIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M1.5 1.004a.5.5 0 01.5.5v.5h10v-.5a.5.5 0 011 0v2a.5.5 0 01-1 0v-.5H2v.5a.5.5 0 01-1 0v-2a.5.5 0 01.5-.5z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M1.5 6a.5.5 0 00-.5.5v6a.5.5 0 00.5.5h11a.5.5 0 00.5-.5v-6a.5.5 0 00-.5-.5h-11zM2 7v5h10V7h-1v2.5a.5.5 0 01-1 0V7h-.75v1a.5.5 0 01-1 0V7H7.5v2.5a.5.5 0 01-1 0V7h-.75v1a.5.5 0 01-1 0V7H4v2.5a.5.5 0 01-1 0V7H2z", + fill: color + } + ) + ); +}); +var CameraIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M10 7a3 3 0 11-6 0 3 3 0 016 0zM9 7a2 2 0 11-4 0 2 2 0 014 0z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M2.5 1a.5.5 0 00-.5.5v.504H.5a.5.5 0 00-.5.5v9a.5.5 0 00.5.5h13a.5.5 0 00.5-.5v-9a.5.5 0 00-.5-.5H6V1.5a.5.5 0 00-.5-.5h-3zM1 3.004v8h12v-8H1z", + fill: color + } + ) + ); +}); +var VideoIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement("path", { d: "M2.5 10a.5.5 0 100-1 .5.5 0 000 1z", fill: color }), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M0 4a2 2 0 012-2h6a2 2 0 012 2v.5l3.189-2.391A.5.5 0 0114 2.5v9a.5.5 0 01-.804.397L10 9.5v.5a2 2 0 01-2 2H2a2 2 0 01-2-2V4zm9 0v1.5a.5.5 0 00.8.4L13 3.5v7L9.8 8.1a.5.5 0 00-.8.4V10a1 1 0 01-1 1H2a1 1 0 01-1-1V4a1 1 0 011-1h6a1 1 0 011 1z", + fill: color + } + ) + ); +}); +var SpeakerIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M1 4.5v5a.5.5 0 00.5.5H4l3.17 2.775a.5.5 0 00.83-.377V1.602a.5.5 0 00-.83-.376L4 4H1.5a.5.5 0 00-.5.5zM4 9V5H2v4h2zm.998.545A.504.504 0 005 9.5v-5c0-.015 0-.03-.002-.044L7 2.704v8.592L4.998 9.545z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M10.15 1.752a.5.5 0 00-.3.954 4.502 4.502 0 010 8.588.5.5 0 00.3.954 5.502 5.502 0 000-10.496z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M10.25 3.969a.5.5 0 00-.5.865 2.499 2.499 0 010 4.332.5.5 0 10.5.866 3.499 3.499 0 000-6.063z", + fill: color + } + ) + ); +}); +var PlayIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M12.813 7.425l-9.05 5.603A.5.5 0 013 12.603V1.398a.5.5 0 01.763-.425l9.05 5.602a.5.5 0 010 .85z", + fill: color + } + ) + ); +}); +var PlayBackIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M11.24 12.035L3.697 7.427A.494.494 0 013.5 7.2v4.05a.75.75 0 01-1.5 0v-8.5a.75.75 0 011.5 0V6.8a.494.494 0 01.198-.227l7.541-4.608A.5.5 0 0112 2.39v9.217a.5.5 0 01-.76.427z", + fill: color + } + ) + ); +}); +var PlayNextIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M2.76 12.035l7.542-4.608A.495.495 0 0010.5 7.2v4.05a.75.75 0 001.5 0v-8.5a.75.75 0 00-1.5 0V6.8a.495.495 0 00-.198-.227L2.76 1.965A.5.5 0 002 2.39v9.217a.5.5 0 00.76.427z", + fill: color + } + ) + ); +}); +var RewindIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M9 2.42v2.315l4.228-2.736a.5.5 0 01.772.42v9.162a.5.5 0 01-.772.42L9 9.263v2.317a.5.5 0 01-.772.42L1.5 7.647v3.603a.75.75 0 01-1.5 0v-8.5a.75.75 0 011.5 0v3.603L8.228 2A.5.5 0 019 2.42z", + fill: color + } + ) + ); +}); +var FastForwardIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M5 2.42v2.315L.772 1.999a.5.5 0 00-.772.42v9.162a.5.5 0 00.772.42L5 9.263v2.317a.5.5 0 00.772.42L12.5 7.647v3.603a.75.75 0 001.5 0v-8.5a.75.75 0 00-1.5 0v3.603L5.772 2A.5.5 0 005 2.42z", + fill: color + } + ) + ); +}); +var StopAltIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M1 1.504a.5.5 0 01.5-.5h11a.5.5 0 01.5.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-11z", + fill: color + } + ) + ); +}); +var SunIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement("g", { clipPath: "url(#prefix__clip0_1107_3492)", fill: color }, /* @__PURE__ */ React255.createElement("path", { d: "M7.5.5a.5.5 0 00-1 0V2a.5.5 0 001 0V.5z" }), /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M7 10a3 3 0 100-6 3 3 0 000 6zm0-1a2 2 0 100-4 2 2 0 000 4z" + } + ), /* @__PURE__ */ React255.createElement("path", { d: "M7 11.5a.5.5 0 01.5.5v1.5a.5.5 0 01-1 0V12a.5.5 0 01.5-.5zM11.5 7a.5.5 0 01.5-.5h1.5a.5.5 0 010 1H12a.5.5 0 01-.5-.5zM.5 6.5a.5.5 0 000 1H2a.5.5 0 000-1H.5zM3.818 10.182a.5.5 0 010 .707l-1.06 1.06a.5.5 0 11-.708-.706l1.06-1.06a.5.5 0 01.708 0zM11.95 2.757a.5.5 0 10-.707-.707l-1.061 1.061a.5.5 0 10.707.707l1.06-1.06zM10.182 10.182a.5.5 0 01.707 0l1.06 1.06a.5.5 0 11-.706.708l-1.061-1.06a.5.5 0 010-.708zM2.757 2.05a.5.5 0 10-.707.707l1.06 1.061a.5.5 0 00.708-.707l-1.06-1.06z" })), + /* @__PURE__ */ React255.createElement("defs", null, /* @__PURE__ */ React255.createElement("clipPath", { id: "prefix__clip0_1107_3492" }, /* @__PURE__ */ React255.createElement("path", { fill: "#fff", d: "M0 0h14v14H0z" }))) + ); +}); +var MoonIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement("g", { clipPath: "url(#prefix__clip0_1107_3493)" }, /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M7.78.044A6.968 6.968 0 003.5.94a6.999 6.999 0 107 12.122 6.97 6.97 0 002.87-3.16c.098-.213-.144-.417-.359-.322a4.976 4.976 0 01-2.01.42A5 5 0 018.542.645C8.747.53 8.73.214 8.5.164a7.042 7.042 0 00-.72-.12zm-1.268.975a6 6 0 004.98 9.96 6 6 0 11-4.98-9.96z", + fill: color + } + )), + /* @__PURE__ */ React255.createElement("defs", null, /* @__PURE__ */ React255.createElement("clipPath", { id: "prefix__clip0_1107_3493" }, /* @__PURE__ */ React255.createElement("path", { fill: "#fff", d: "M0 0h14v14H0z" }))) + ); +}); +var StopAltHollowIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M2.2 2.204v9.6h9.6v-9.6H2.2zm-.7-1.2a.5.5 0 00-.5.5v11a.5.5 0 00.5.5h11a.5.5 0 00.5-.5v-11a.5.5 0 00-.5-.5h-11z", + fill: color + } + ) + ); +}); +var PlayHollowIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M4.2 10.88L10.668 7 4.2 3.12v7.76zM3 2.414v9.174a.8.8 0 001.212.686l7.645-4.587a.8.8 0 000-1.372L4.212 1.727A.8.8 0 003 2.413z", + fill: color + } + ) + ); +}); +var PlayAllHollowIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M5.2 10.88L11.668 7 5.2 3.12v7.76zM4 2.414v9.174a.8.8 0 001.212.686l7.645-4.587a.8.8 0 000-1.372L5.212 1.727A.8.8 0 004 2.413zM1.5 1.6a.6.6 0 01.6.6v9.6a.6.6 0 11-1.2 0V2.2a.6.6 0 01.6-.6z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M.963 1.932a.6.6 0 01.805-.268l1 .5a.6.6 0 01-.536 1.073l-1-.5a.6.6 0 01-.269-.805zM3.037 11.132a.6.6 0 01-.269.805l-1 .5a.6.6 0 01-.536-1.073l1-.5a.6.6 0 01.805.268z", + fill: color + } + ) + ); +}); +var StopIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M4.5 4a.5.5 0 00-.5.5v5a.5.5 0 00.5.5h5a.5.5 0 00.5-.5v-5a.5.5 0 00-.5-.5h-5z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M14 7A7 7 0 110 7a7 7 0 0114 0zm-1 0A6 6 0 111 7a6 6 0 0112 0z", + fill: color + } + ) + ); +}); +var SideBySideIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M1 1.504a.5.5 0 01.5-.5h11a.5.5 0 01.5.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-11zm1 10.5v-10h5v10H2z", + fill: color + } + ) + ); +}); +var StackedIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M12.5 1.004a.5.5 0 01.5.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-11a.5.5 0 01.5-.5h11zm-10.5 1h10v5H2v-5z", + fill: color + } + ) + ); +}); +var BookIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M13 2a2 2 0 00-2-2H1.5a.5.5 0 00-.5.5v13a.5.5 0 00.5.5H11a2 2 0 002-2V2zM3 13h8a1 1 0 001-1V2a1 1 0 00-1-1H7v6.004a.5.5 0 01-.856.352l-.002-.002L5.5 6.71l-.645.647A.5.5 0 014 7.009V1H3v12zM5 1v4.793l.146-.146a.5.5 0 01.743.039l.111.11V1H5z", + fill: color + } + ) + ); +}); +var DocumentIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M4 5.5a.5.5 0 01.5-.5h5a.5.5 0 010 1h-5a.5.5 0 01-.5-.5zM4.5 7.5a.5.5 0 000 1h5a.5.5 0 000-1h-5zM4 10.5a.5.5 0 01.5-.5h5a.5.5 0 010 1h-5a.5.5 0 01-.5-.5z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M1.5 0a.5.5 0 00-.5.5v13a.5.5 0 00.5.5h11a.5.5 0 00.5-.5V3.207a.5.5 0 00-.146-.353L10.146.146A.5.5 0 009.793 0H1.5zM2 1h7.5v2a.5.5 0 00.5.5h2V13H2V1z", + fill: color + } + ) + ); +}); +var CopyIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 15", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M11.746.07A.5.5 0 0011.5.003h-6a.5.5 0 00-.5.5v2.5H.5a.5.5 0 00-.5.5v10a.5.5 0 00.5.5h8a.5.5 0 00.5-.5v-2.5h4.5a.5.5 0 00.5-.5v-8a.498.498 0 00-.15-.357L11.857.154a.506.506 0 00-.11-.085zM9 10.003h4v-7h-1.5a.5.5 0 01-.5-.5v-1.5H6v2h.5a.5.5 0 01.357.15L8.85 5.147c.093.09.15.217.15.357v4.5zm-8-6v9h7v-7H6.5a.5.5 0 01-.5-.5v-1.5H1z", + fill: color + } + ) + ); +}); +var FilesIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 15", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M6.5 11a.5.5 0 010 1h-4a.5.5 0 010-1h4zM4.5 5a.5.5 0 01.5.5V7h1.5a.5.5 0 010 1H5v1.5a.5.5 0 01-1 0V8H2.5a.5.5 0 010-1H4V5.5a.5.5 0 01.5-.5z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M11.5.004a.5.5 0 01.357.15l1.993 1.993a.5.5 0 01.15.358v8a.5.5 0 01-.5.5H9v2.499a.5.5 0 01-.5.5h-8a.5.5 0 01-.5-.5v-10a.5.5 0 01.5-.5H5v-2.5a.5.5 0 01.5-.5h6zm-10.5 13h7v-7l-2-2H1v9zm5-10h.5a.5.5 0 01.357.15L8.85 5.146a.5.5 0 01.15.358v4.5h4v-7l-2-2H6v2z", + fill: color + } + ) + ); +}); +var CategoryIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M3 1.5a.5.5 0 01.5-.5h7a.5.5 0 010 1h-7a.5.5 0 01-.5-.5zM2 3.504a.5.5 0 01.5-.5h9a.5.5 0 010 1h-9a.5.5 0 01-.5-.5z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M1 5.5a.5.5 0 01.5-.5h11a.5.5 0 01.5.5v7a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-7zM2 12V6h10v6H2z", + fill: color + } + ) + ); +}); +var FolderIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M6.586 3.504l-1.5-1.5H1v9h12v-7.5H6.586zm.414-1L5.793 1.297a1 1 0 00-.707-.293H.5a.5.5 0 00-.5.5v10a.5.5 0 00.5.5h13a.5.5 0 00.5-.5v-8.5a.5.5 0 00-.5-.5H7z", + fill: color + } + ) + ); +}); +var PrintIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M4.5 8.004a.5.5 0 100 1h5a.5.5 0 000-1h-5zM4.5 10.004a.5.5 0 000 1h5a.5.5 0 000-1h-5z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M2 1.504a.5.5 0 01.5-.5h8a.498.498 0 01.357.15l.993.993c.093.09.15.217.15.357v1.5h1.5a.5.5 0 01.5.5v5a.5.5 0 01-.5.5H12v2.5a.5.5 0 01-.5.5h-9a.5.5 0 01-.5-.5v-2.5H.5a.5.5 0 01-.5-.5v-5a.5.5 0 01.5-.5H2v-2.5zm11 7.5h-1v-2.5a.5.5 0 00-.5-.5h-9a.5.5 0 00-.5.5v2.5H1v-4h12v4zm-2-6v1H3v-2h7v.5a.5.5 0 00.5.5h.5zm-8 9h8v-5H3v5z", + fill: color + } + ) + ); +}); +var GraphLineIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M5.146 6.15a.5.5 0 01.708 0L7 7.297 9.146 5.15a.5.5 0 01.708 0l1 1a.5.5 0 01-.708.707L9.5 6.211 7.354 8.357a.5.5 0 01-.708 0L5.5 7.211 3.854 8.857a.5.5 0 11-.708-.707l2-2z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M1.5 1.004a.5.5 0 00-.5.5v11a.5.5 0 00.5.5h11a.5.5 0 00.5-.5v-11a.5.5 0 00-.5-.5h-11zm.5 1v10h10v-10H2z", + fill: color + } + ) + ); +}); +var CalendarIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M3.5 0a.5.5 0 01.5.5V1h6V.5a.5.5 0 011 0V1h1.5a.5.5 0 01.5.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-11a.5.5 0 01.5-.5H3V.5a.5.5 0 01.5-.5zM2 4v2.3h3V4H2zm0 5.2V6.8h3v2.4H2zm0 .5V12h3V9.7H2zm3.5 0V12h3V9.7h-3zm3.5 0V12h3V9.7H9zm3-.5H9V6.8h3v2.4zm-3.5 0h-3V6.8h3v2.4zM9 4v2.3h3V4H9zM5.5 6.3h3V4h-3v2.3z", + fill: color + } + ) + ); +}); +var GraphBarIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M12 2.5a.5.5 0 00-1 0v10a.5.5 0 001 0v-10zM9 4.5a.5.5 0 00-1 0v8a.5.5 0 001 0v-8zM5.5 7a.5.5 0 01.5.5v5a.5.5 0 01-1 0v-5a.5.5 0 01.5-.5zM3 10.5a.5.5 0 00-1 0v2a.5.5 0 001 0v-2z", + fill: color + } + ) + ); +}); +var AlignLeftIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M13 2a.5.5 0 010 1H1a.5.5 0 010-1h12zM10 5a.5.5 0 010 1H1a.5.5 0 010-1h9zM11.5 8.5A.5.5 0 0011 8H1a.5.5 0 000 1h10a.5.5 0 00.5-.5zM7.5 11a.5.5 0 010 1H1a.5.5 0 010-1h6.5z", + fill: color + } + ) + ); +}); +var AlignRightIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M1 2a.5.5 0 000 1h12a.5.5 0 000-1H1zM4 5a.5.5 0 000 1h9a.5.5 0 000-1H4zM2.5 8.5A.5.5 0 013 8h10a.5.5 0 010 1H3a.5.5 0 01-.5-.5zM6.5 11a.5.5 0 000 1H13a.5.5 0 000-1H6.5z", + fill: color + } + ) + ); +}); +var FilterIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M1 2a.5.5 0 000 1h12a.5.5 0 000-1H1zM3 5a.5.5 0 000 1h8a.5.5 0 000-1H3zM4.5 8.5A.5.5 0 015 8h4a.5.5 0 010 1H5a.5.5 0 01-.5-.5zM6.5 11a.5.5 0 000 1h1a.5.5 0 000-1h-1z", + fill: color + } + ) + ); +}); +var DocChartIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M1 1.5a.5.5 0 01.5-.5h11a.5.5 0 01.5.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-11zM2 4v2.3h3V4H2zm0 5.2V6.8h3v2.4H2zm0 .5V12h3V9.7H2zm3.5 0V12h3V9.7h-3zm3.5 0V12h3V9.7H9zm3-.5H9V6.8h3v2.4zm-3.5 0h-3V6.8h3v2.4zM9 6.3h3V4H9v2.3zm-3.5 0h3V4h-3v2.3z", + fill: color + } + ) + ); +}); +var DocListIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M3.5 6.5A.5.5 0 014 6h6a.5.5 0 010 1H4a.5.5 0 01-.5-.5zM4 9a.5.5 0 000 1h6a.5.5 0 000-1H4z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M1 1.5a.5.5 0 01.5-.5h11a.5.5 0 01.5.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-11zM2 4v8h10V4H2z", + fill: color + } + ) + ); +}); +var DragIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M13 4a.5.5 0 010 1H1a.5.5 0 010-1h12zM13.5 9.5A.5.5 0 0013 9H1a.5.5 0 000 1h12a.5.5 0 00.5-.5z", + fill: color + } + ) + ); +}); +var MenuIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M13 3.5a.5.5 0 010 1H1a.5.5 0 010-1h12zM13.5 10a.5.5 0 00-.5-.5H1a.5.5 0 000 1h12a.5.5 0 00.5-.5zM13 6.5a.5.5 0 010 1H1a.5.5 0 010-1h12z", + fill: color + } + ) + ); +}); +var MarkupIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M8.982 1.632a.5.5 0 00-.964-.263l-3 11a.5.5 0 10.964.263l3-11zM3.32 3.616a.5.5 0 01.064.704L1.151 7l2.233 2.68a.5.5 0 11-.768.64l-2.5-3a.5.5 0 010-.64l2.5-3a.5.5 0 01.704-.064zM10.68 3.616a.5.5 0 00-.064.704L12.849 7l-2.233 2.68a.5.5 0 00.768.64l2.5-3a.5.5 0 000-.64l-2.5-3a.5.5 0 00-.704-.064z", + fill: color + } + ) + ); +}); +var BoldIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M3 2v1.5h1v7H3V12h5a3 3 0 001.791-5.407A2.75 2.75 0 008 2.011V2H3zm5 5.5H5.5v3H8a1.5 1.5 0 100-3zm-.25-4H5.5V6h2.25a1.25 1.25 0 100-2.5z", + fill: color + } + ) + ); +}); +var ItalicIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement("path", { d: "M5 2h6v1H8.5l-2 8H9v1H3v-1h2.5l2-8H5V2z", fill: color }) + ); +}); +var PaperClipIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M10.553 2.268a1.5 1.5 0 00-2.12 0L2.774 7.925a2.5 2.5 0 003.536 3.535l3.535-3.535a.5.5 0 11.707.707l-3.535 3.536-.002.002a3.5 3.5 0 01-4.959-4.941l.011-.011L7.725 1.56l.007-.008a2.5 2.5 0 013.53 3.541l-.002.002-5.656 5.657-.003.003a1.5 1.5 0 01-2.119-2.124l3.536-3.536a.5.5 0 11.707.707L4.189 9.34a.5.5 0 00.707.707l5.657-5.657a1.5 1.5 0 000-2.121z", + fill: color + } + ) + ); +}); +var ListOrderedIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M5 2.5a.5.5 0 01.5-.5h7a.5.5 0 010 1h-7a.5.5 0 01-.5-.5zM5 7a.5.5 0 01.5-.5h7a.5.5 0 010 1h-7A.5.5 0 015 7zM5.5 11a.5.5 0 000 1h7a.5.5 0 000-1h-7zM2.5 2H1v1h1v3h1V2.5a.5.5 0 00-.5-.5zM3 8.5v1a.5.5 0 01-1 0V9h-.5a.5.5 0 010-1h1a.5.5 0 01.5.5zM2 10.5a.5.5 0 00-1 0V12h2v-1H2v-.5z", + fill: color + } + ) + ); +}); +var ListUnorderedIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M2.75 2.5a.75.75 0 11-1.5 0 .75.75 0 011.5 0zM5.5 2a.5.5 0 000 1h7a.5.5 0 000-1h-7zM5.5 11a.5.5 0 000 1h7a.5.5 0 000-1h-7zM2 12.25a.75.75 0 100-1.5.75.75 0 000 1.5zM5 7a.5.5 0 01.5-.5h7a.5.5 0 010 1h-7A.5.5 0 015 7zM2 7.75a.75.75 0 100-1.5.75.75 0 000 1.5z", + fill: color + } + ) + ); +}); +var ChecklistIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M3.5 10a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 01-.5-.5v-2a.5.5 0 01.5-.5h2zM2 12h1v-1H2v1z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M12.5 11a.5.5 0 110 1h-7a.5.5 0 010-1h7zM3.146 5.646a.5.5 0 11.708.707L3.207 7l.647.646a.5.5 0 11-.708.707L2.5 7.707l-.646.646a.5.5 0 01-.708-.707L1.793 7l-.647-.647a.5.5 0 11.708-.707l.646.647.646-.647zM12.5 6.5a.5.5 0 010 1h-7a.5.5 0 010-1h7zM4.146 1.146a.5.5 0 11.708.707l-2 2-.079.065a.498.498 0 01-.629-.065l-1-1a.5.5 0 11.708-.707l.646.647 1.646-1.647zM12.5 2a.5.5 0 010 1h-7a.5.5 0 010-1h7z", + fill: color + } + ) + ); +}); +var ParagraphIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M6 7a3 3 0 110-6h5.5a.5.5 0 010 1H10v10.5a.5.5 0 01-1 0V2H7v10.5a.5.5 0 01-1 0V7z", + fill: color + } + ) + ); +}); +var MarkdownIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M2 4.5h1.5L5 6.375 6.5 4.5H8v5H6.5V7L5 8.875 3.5 7v2.5H2v-5zM9.75 4.5h1.5V7h1.25l-2 2.5-2-2.5h1.25V4.5z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M.5 2a.5.5 0 00-.5.5v9a.5.5 0 00.5.5h13a.5.5 0 00.5-.5v-9a.5.5 0 00-.5-.5H.5zM1 3v8h12V3H1z", + fill: color + } + ) + ); +}); +var RepoIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M5 2.5a.5.5 0 11-1 0 .5.5 0 011 0zM4.5 5a.5.5 0 100-1 .5.5 0 000 1zM5 6.5a.5.5 0 11-1 0 .5.5 0 011 0z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M11 0a2 2 0 012 2v10a2 2 0 01-2 2H1.5a.5.5 0 01-.5-.5V.5a.5.5 0 01.5-.5H11zm0 1H3v12h8a1 1 0 001-1V2a1 1 0 00-1-1z", + fill: color + } + ) + ); +}); +var CommitIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M3.031 7.5a4 4 0 007.938 0H13.5a.5.5 0 000-1h-2.53a4 4 0 00-7.94 0H.501a.5.5 0 000 1h2.531zM7 10a3 3 0 100-6 3 3 0 000 6z", + fill: color + } + ) + ); +}); +var BranchIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M6 2.5a1.5 1.5 0 01-1 1.415v4.053C5.554 7.4 6.367 7 7.5 7c.89 0 1.453-.252 1.812-.557.218-.184.374-.4.482-.62a1.5 1.5 0 111.026.143c-.155.423-.425.87-.86 1.24C9.394 7.685 8.59 8 7.5 8c-1.037 0-1.637.42-1.994.917a2.81 2.81 0 00-.472 1.18A1.5 1.5 0 114 10.086v-6.17A1.5 1.5 0 116 2.5zm-2 9a.5.5 0 111 0 .5.5 0 01-1 0zm1-9a.5.5 0 11-1 0 .5.5 0 011 0zm6 2a.5.5 0 11-1 0 .5.5 0 011 0z", + fill: color + } + ) + ); +}); +var PullRequestIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M8.354 1.354L7.707 2H8.5A2.5 2.5 0 0111 4.5v5.585a1.5 1.5 0 11-1 0V4.5A1.5 1.5 0 008.5 3h-.793l.647.646a.5.5 0 11-.708.708l-1.5-1.5a.5.5 0 010-.708l1.5-1.5a.5.5 0 11.708.708zM11 11.5a.5.5 0 11-1 0 .5.5 0 011 0zM4 3.915a1.5 1.5 0 10-1 0v6.17a1.5 1.5 0 101 0v-6.17zM3.5 11a.5.5 0 100 1 .5.5 0 000-1zm0-8a.5.5 0 100-1 .5.5 0 000 1z", + fill: color + } + ) + ); +}); +var MergeIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M4.108 3.872A1.5 1.5 0 103 3.915v6.17a1.5 1.5 0 101 0V6.41c.263.41.573.77.926 1.083 1.108.98 2.579 1.433 4.156 1.5A1.5 1.5 0 109.09 7.99c-1.405-.065-2.62-.468-3.5-1.248-.723-.64-1.262-1.569-1.481-2.871zM3.5 11a.5.5 0 100 1 .5.5 0 000-1zM4 2.5a.5.5 0 11-1 0 .5.5 0 011 0zm7 6a.5.5 0 11-1 0 .5.5 0 011 0z", + fill: color + } + ) + ); +}); +var AppleIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M11.03 8.103a3.044 3.044 0 01-.202-1.744 2.697 2.697 0 011.4-1.935c-.749-1.18-1.967-1.363-2.35-1.403-.835-.086-2.01.56-2.648.57h-.016c-.639-.01-1.814-.656-2.649-.57-.415.044-1.741.319-2.541 1.593-.281.447-.498 1.018-.586 1.744a6.361 6.361 0 00-.044.85c.005.305.028.604.07.895.09.62.259 1.207.477 1.744.242.595.543 1.13.865 1.585.712 1.008 1.517 1.59 1.971 1.6.934.021 1.746-.61 2.416-.594.006.002.014.003.02.002h.017c.007 0 .014 0 .021-.002.67-.017 1.481.615 2.416.595.453-.011 1.26-.593 1.971-1.6a7.95 7.95 0 00.97-1.856c-.697-.217-1.27-.762-1.578-1.474zm-2.168-5.97c.717-.848.69-2.07.624-2.125-.065-.055-1.25.163-1.985.984-.735.82-.69 2.071-.624 2.125.064.055 1.268-.135 1.985-.984z", + fill: color + } + ) + ); +}); +var LinuxIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M7 0a3 3 0 013 3v1.24c.129.132.25.27.362.415.113.111.283.247.515.433l.194.155c.325.261.711.582 1.095.966.765.765 1.545 1.806 1.823 3.186a.501.501 0 01-.338.581 3.395 3.395 0 01-1.338.134 2.886 2.886 0 01-1.049-.304 5.535 5.535 0 01-.17.519 2 2 0 11-2.892 2.55A5.507 5.507 0 017 13c-.439 0-.838-.044-1.201-.125a2 2 0 11-2.892-2.55 5.553 5.553 0 01-.171-.519c-.349.182-.714.27-1.05.304A3.395 3.395 0 01.35 9.977a.497.497 0 01-.338-.582c.278-1.38 1.058-2.42 1.823-3.186.384-.384.77-.705 1.095-.966l.194-.155c.232-.186.402-.322.515-.433.112-.145.233-.283.362-.414V3a3 3 0 013-3zm1.003 11.895a2 2 0 012.141-1.89c.246-.618.356-1.322.356-2.005 0-.514-.101-1.07-.301-1.599l-.027-.017a6.387 6.387 0 00-.857-.42 6.715 6.715 0 00-1.013-.315l-.852.638a.75.75 0 01-.9 0l-.852-.638a6.716 6.716 0 00-1.693.634 4.342 4.342 0 00-.177.101l-.027.017A4.6 4.6 0 003.501 8c0 .683.109 1.387.355 2.005a2 2 0 012.142 1.89c.295.067.627.105 1.002.105s.707-.038 1.003-.105zM5 12a1 1 0 11-2 0 1 1 0 012 0zm6 0a1 1 0 11-2 0 1 1 0 012 0zM6.1 4.3a1.5 1.5 0 011.8 0l.267.2L7 5.375 5.833 4.5l.267-.2zM8.5 2a.5.5 0 01.5.5V3a.5.5 0 01-1 0v-.5a.5.5 0 01.5-.5zM6 2.5a.5.5 0 00-1 0V3a.5.5 0 001 0v-.5z", + fill: color + } + ) + ); +}); +var UbuntuIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement("g", { clipPath: "url(#prefix__clip0_1107_3497)", fill: color }, /* @__PURE__ */ React255.createElement("path", { d: "M12.261 2.067c0 1.142-.89 2.068-1.988 2.068-1.099 0-1.99-.926-1.99-2.068C8.283.926 9.174 0 10.273 0c1.098 0 1.989.926 1.989 2.067zM3.978 6.6c0 1.142-.89 2.068-1.989 2.068C.891 8.668 0 7.742 0 6.601c0-1.142.89-2.068 1.989-2.068 1.099 0 1.989.926 1.989 2.068zM6.475 11.921A4.761 4.761 0 014.539 11a4.993 4.993 0 01-1.367-1.696 2.765 2.765 0 01-1.701.217 6.725 6.725 0 001.844 2.635 6.379 6.379 0 004.23 1.577 3.033 3.033 0 01-.582-1.728 4.767 4.767 0 01-.488-.083zM11.813 11.933c0 1.141-.89 2.067-1.989 2.067-1.098 0-1.989-.926-1.989-2.067 0-1.142.891-2.068 1.99-2.068 1.098 0 1.989.926 1.989 2.068zM12.592 11.173a6.926 6.926 0 001.402-3.913 6.964 6.964 0 00-1.076-4.023A2.952 2.952 0 0111.8 4.6c.398.78.592 1.656.564 2.539a5.213 5.213 0 01-.724 2.495c.466.396.8.935.952 1.54zM1.987 3.631c-.05 0-.101.002-.151.004C3.073 1.365 5.504.024 8.005.23a3.07 3.07 0 00-.603 1.676 4.707 4.707 0 00-2.206.596 4.919 4.919 0 00-1.7 1.576 2.79 2.79 0 00-1.509-.447z" })), + /* @__PURE__ */ React255.createElement("defs", null, /* @__PURE__ */ React255.createElement("clipPath", { id: "prefix__clip0_1107_3497" }, /* @__PURE__ */ React255.createElement("path", { fill: "#fff", d: "M0 0h14v14H0z" }))) + ); +}); +var WindowsIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M6.5 1H1v5.5h5.5V1zM13 1H7.5v5.5H13V1zM7.5 7.5H13V13H7.5V7.5zM6.5 7.5H1V13h5.5V7.5z", + fill: color + } + ) + ); +}); +var ChromeIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement("g", { clipPath: "url(#prefix__clip0_1107_3496)" }, /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M13.023 3.431a.115.115 0 01-.099.174H7.296A3.408 3.408 0 003.7 6.148a.115.115 0 01-.21.028l-1.97-3.413a.115.115 0 01.01-.129A6.97 6.97 0 017 0a6.995 6.995 0 016.023 3.431zM7 9.615A2.619 2.619 0 014.384 7 2.62 2.62 0 017 4.383 2.619 2.619 0 019.616 7 2.619 2.619 0 017 9.615zm1.034.71a.115.115 0 00-.121-.041 3.4 3.4 0 01-.913.124 3.426 3.426 0 01-3.091-1.973L1.098 3.567a.115.115 0 00-.2.001 7.004 7.004 0 005.058 10.354l.017.001c.04 0 .078-.021.099-.057l1.971-3.414a.115.115 0 00-.009-.128zm1.43-5.954h3.947c.047 0 .09.028.107.072.32.815.481 1.675.481 2.557a6.957 6.957 0 01-2.024 4.923A6.957 6.957 0 017.08 14h-.001a.115.115 0 01-.1-.172L9.794 8.95A3.384 3.384 0 0010.408 7c0-.921-.364-1.785-1.024-2.433a.115.115 0 01.08-.196z", + fill: color + } + )), + /* @__PURE__ */ React255.createElement("defs", null, /* @__PURE__ */ React255.createElement("clipPath", { id: "prefix__clip0_1107_3496" }, /* @__PURE__ */ React255.createElement("path", { fill: "#fff", d: "M0 0h14v14H0z" }))) + ); +}); +var StorybookIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M2.042.616a.704.704 0 00-.66.729L1.816 12.9c.014.367.306.66.672.677l9.395.422h.032a.704.704 0 00.704-.703V.704c0-.015 0-.03-.002-.044a.704.704 0 00-.746-.659l-.773.049.057 1.615a.105.105 0 01-.17.086l-.52-.41-.617.468a.105.105 0 01-.168-.088L9.746.134 2.042.616zm8.003 4.747c-.247.192-2.092.324-2.092.05.04-1.045-.429-1.091-.689-1.091-.247 0-.662.075-.662.634 0 .57.607.893 1.32 1.27 1.014.538 2.24 1.188 2.24 2.823 0 1.568-1.273 2.433-2.898 2.433-1.676 0-3.141-.678-2.976-3.03.065-.275 2.197-.21 2.197 0-.026.971.195 1.256.753 1.256.43 0 .624-.236.624-.634 0-.602-.633-.958-1.361-1.367-.987-.554-2.148-1.205-2.148-2.7 0-1.494 1.027-2.489 2.86-2.489 1.832 0 2.832.98 2.832 2.845z", + fill: color + } + ) + ); +}); +var AzureDevOpsIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement("g", { clipPath: "url(#prefix__clip0_1107_3503)" }, /* @__PURE__ */ React255.createElement( + "path", + { + d: "M0 5.176l1.31-1.73 4.902-1.994V.014l4.299 3.144-8.78 1.706v4.8L0 9.162V5.176zm14-2.595v8.548l-3.355 2.857-5.425-1.783v1.783L1.73 9.661l8.784 1.047v-7.55L14 2.581z", + fill: color + } + )), + /* @__PURE__ */ React255.createElement("defs", null, /* @__PURE__ */ React255.createElement("clipPath", { id: "prefix__clip0_1107_3503" }, /* @__PURE__ */ React255.createElement("path", { fill: "#fff", d: "M0 0h14v14H0z" }))) + ); +}); +var BitbucketIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M1 1.522a.411.411 0 00-.412.476l1.746 10.597a.56.56 0 00.547.466h8.373a.411.411 0 00.412-.345l1.017-6.248h-3.87L8.35 9.18H5.677l-.724-3.781h7.904L13.412 2A.411.411 0 0013 1.524L1 1.522z", + fill: color + } + ) + ); +}); +var ChromaticIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M0 7a7 7 0 1014 0A7 7 0 000 7zm5.215-3.869a1.967 1.967 0 013.747.834v1.283l-3.346-1.93a2.486 2.486 0 00-.401-.187zm3.484 2.58l-3.346-1.93a1.968 1.968 0 00-2.685.72 1.954 1.954 0 00.09 2.106 2.45 2.45 0 01.362-.254l1.514-.873a.27.27 0 01.268 0l2.1 1.21 1.697-.978zm-.323 4.972L6.86 9.81a.268.268 0 01-.134-.231V7.155l-1.698-.98v3.86a1.968 1.968 0 003.747.835 2.488 2.488 0 01-.4-.187zm.268-.464a1.967 1.967 0 002.685-.719 1.952 1.952 0 00-.09-2.106c-.112.094-.233.18-.361.253L7.53 9.577l1.113.642zm-4.106.257a1.974 1.974 0 01-1.87-.975A1.95 1.95 0 012.47 8.01c.136-.507.461-.93.916-1.193L4.5 6.175v3.86c0 .148.013.295.039.44zM11.329 4.5a1.973 1.973 0 00-1.87-.976c.025.145.039.292.039.44v1.747a.268.268 0 01-.135.232l-2.1 1.211v1.96l3.346-1.931a1.966 1.966 0 00.72-2.683z", + fill: color + } + ) + ); +}); +var ComponentDrivenIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M10.847 2.181L8.867.201a.685.685 0 00-.97 0l-4.81 4.81a.685.685 0 000 .969l2.466 2.465-2.405 2.404a.685.685 0 000 .97l1.98 1.98a.685.685 0 00.97 0l4.81-4.81a.685.685 0 000-.969L8.441 5.555l2.405-2.404a.685.685 0 000-.97z", + fill: color + } + ) + ); +}); +var DiscordIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M11.852 2.885c-.893-.41-1.85-.712-2.85-.884a.043.043 0 00-.046.021c-.123.22-.26.505-.355.73a10.658 10.658 0 00-3.2 0 7.377 7.377 0 00-.36-.73.045.045 0 00-.046-.021c-1 .172-1.957.474-2.85.884a.04.04 0 00-.019.016C.311 5.612-.186 8.257.058 10.869a.048.048 0 00.018.033 11.608 11.608 0 003.496 1.767.045.045 0 00.049-.016c.27-.368.51-.755.715-1.163a.044.044 0 00-.024-.062 7.661 7.661 0 01-1.092-.52.045.045 0 01-.005-.075c.074-.055.147-.112.217-.17a.043.043 0 01.046-.006c2.29 1.046 4.771 1.046 7.035 0a.043.043 0 01.046.006c.07.057.144.115.218.17a.045.045 0 01-.004.075 7.186 7.186 0 01-1.093.52.045.045 0 00-.024.062c.21.407.45.795.715 1.162.011.016.03.023.05.017a11.57 11.57 0 003.5-1.767.045.045 0 00.019-.032c.292-3.02-.49-5.643-2.07-7.969a.036.036 0 00-.018-.016zM4.678 9.279c-.69 0-1.258-.634-1.258-1.411 0-.778.558-1.411 1.258-1.411.707 0 1.27.639 1.259 1.41 0 .778-.558 1.412-1.259 1.412zm4.652 0c-.69 0-1.258-.634-1.258-1.411 0-.778.557-1.411 1.258-1.411.707 0 1.27.639 1.258 1.41 0 .778-.551 1.412-1.258 1.412z", + fill: color + } + ) + ); +}); +var FacebookIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M7.399 14H5.06V7H3.5V4.588l1.56-.001-.002-1.421C5.058 1.197 5.533 0 7.6 0h1.721v2.413H8.246c-.805 0-.844.337-.844.966l-.003 1.208h1.934l-.228 2.412L7.401 7l-.002 7z", + fill: color + } + ) + ); +}); +var FigmaIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M9.2 0H4.803A2.603 2.603 0 003.41 4.802a2.603 2.603 0 000 4.396 2.602 2.602 0 103.998 2.199v-2.51a2.603 2.603 0 103.187-4.085A2.604 2.604 0 009.2 0zM7.407 7a1.793 1.793 0 103.586 0 1.793 1.793 0 00-3.586 0zm-.81 2.603H4.803a1.793 1.793 0 101.794 1.794V9.603zM4.803 4.397h1.794V.81H4.803a1.793 1.793 0 000 3.587zm0 .81a1.793 1.793 0 000 3.586h1.794V5.207H4.803zm4.397-.81H7.407V.81H9.2a1.794 1.794 0 010 3.587z", + fill: color + } + ) + ); +}); +var GDriveIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M6.37 8.768l-2.042 3.537h6.755l2.042-3.537H6.37zm6.177-1.003l-3.505-6.07H4.96l3.504 6.07h4.084zM4.378 2.7L.875 8.77l2.042 3.536L6.42 6.236 4.378 2.7z", + fill: color + } + ) + ); +}); +var GithubIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M7 0C3.132 0 0 3.132 0 7a6.996 6.996 0 004.786 6.641c.35.062.482-.149.482-.332 0-.166-.01-.718-.01-1.304-1.758.324-2.213-.429-2.353-.823-.079-.2-.42-.822-.717-.988-.246-.132-.596-.455-.01-.464.552-.009.946.508 1.077.717.63 1.06 1.636.762 2.039.578.061-.455.245-.761.446-.936-1.558-.175-3.185-.779-3.185-3.457 0-.76.271-1.39.717-1.88-.07-.176-.314-.893.07-1.856 0 0 .587-.183 1.925.718a6.495 6.495 0 011.75-.236c.595 0 1.19.078 1.75.236 1.34-.91 1.926-.718 1.926-.718.385.963.14 1.68.07 1.855.446.49.717 1.111.717 1.881 0 2.687-1.636 3.282-3.194 3.457.254.218.473.638.473 1.295 0 .936-.009 1.688-.009 1.925 0 .184.131.402.481.332A7.012 7.012 0 0014 7c0-3.868-3.133-7-7-7z", + fill: color + } + ) + ); +}); +var GitlabIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M1.068 5.583l1.487-4.557a.256.256 0 01.487 0L4.53 5.583H1.068L7 13.15 4.53 5.583h4.941l-2.47 7.565 5.931-7.565H9.471l1.488-4.557a.256.256 0 01.486 0l1.488 4.557.75 2.3a.508.508 0 01-.185.568L7 13.148v.001H7L.503 8.452a.508.508 0 01-.186-.57l.75-2.299z", + fill: color + } + ) + ); +}); +var GoogleIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M10.925 1.094H7.262c-1.643 0-3.189 1.244-3.189 2.685 0 1.473 1.12 2.661 2.791 2.661.116 0 .23-.002.34-.01a1.49 1.49 0 00-.186.684c0 .41.22.741.498 1.012-.21 0-.413.006-.635.006-2.034 0-3.6 1.296-3.6 2.64 0 1.323 1.717 2.15 3.75 2.15 2.32 0 3.6-1.315 3.6-2.639 0-1.06-.313-1.696-1.28-2.38-.331-.235-.965-.805-.965-1.14 0-.392.112-.586.703-1.047.606-.474 1.035-1.14 1.035-1.914 0-.92-.41-1.819-1.18-2.115h1.161l.82-.593zm-1.335 8.96c.03.124.045.25.045.378 0 1.07-.688 1.905-2.665 1.905-1.406 0-2.421-.89-2.421-1.96 0-1.047 1.259-1.92 2.665-1.904.328.004.634.057.911.146.764.531 1.311.832 1.465 1.436zM7.34 6.068c-.944-.028-1.841-1.055-2.005-2.295-.162-1.24.47-2.188 1.415-2.16.943.029 1.84 1.023 2.003 2.262.163 1.24-.47 2.222-1.414 2.193z", + fill: color + } + ) + ); +}); +var GraphqlIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M7.873 11.608a1.167 1.167 0 00-1.707-.027L3.46 10.018l.01-.04h7.072l.022.076-2.69 1.554zM6.166 2.42l.031.03-3.535 6.124a1.265 1.265 0 00-.043-.012V5.438a1.166 1.166 0 00.84-1.456L6.167 2.42zm4.387 1.562a1.165 1.165 0 00.84 1.456v3.124l-.043.012-3.536-6.123a1.2 1.2 0 00.033-.032l2.706 1.563zM3.473 9.42a1.168 1.168 0 00-.327-.568L6.68 2.73a1.17 1.17 0 00.652 0l3.536 6.123a1.169 1.169 0 00-.327.567H3.473zm8.79-.736a1.169 1.169 0 00-.311-.124V5.44a1.17 1.17 0 10-1.122-1.942L8.13 1.938a1.168 1.168 0 00-1.122-1.5 1.17 1.17 0 00-1.121 1.5l-2.702 1.56a1.168 1.168 0 00-1.86.22 1.17 1.17 0 00.739 1.722v3.12a1.168 1.168 0 00-.74 1.721 1.17 1.17 0 001.861.221l2.701 1.56a1.169 1.169 0 102.233-.035l2.687-1.552a1.168 1.168 0 101.457-1.791z", + fill: color + } + ) + ); +}); +var MediumIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M0 0v14h14V0H0zm11.63 3.317l-.75.72a.22.22 0 00-.083.212v-.001 5.289a.22.22 0 00.083.21l.733.72v.159H7.925v-.158l.76-.738c.074-.074.074-.096.074-.21V5.244l-2.112 5.364h-.285l-2.46-5.364V8.84a.494.494 0 00.136.413h.001l.988 1.198v.158H2.226v-.158l.988-1.198a.477.477 0 00.126-.416v.003-4.157a.363.363 0 00-.118-.307l-.878-1.058v-.158h2.727l2.107 4.622L9.031 3.16h2.6v.158z", + fill: color + } + ) + ); +}); +var ReduxIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M4.06 9.689c.016.49.423.88.912.88h.032a.911.911 0 00.88-.945.916.916 0 00-.912-.88h-.033c-.033 0-.08 0-.113.016-.669-1.108-.946-2.314-.848-3.618.065-.978.391-1.825.961-2.526.473-.603 1.386-.896 2.005-.913 1.728-.032 2.461 2.119 2.51 2.983.212.049.57.163.815.244C10.073 2.29 8.444.92 6.88.92c-1.467 0-2.82 1.06-3.357 2.625-.75 2.086-.261 4.09.651 5.671a.74.74 0 00-.114.473zm8.279-2.298c-1.239-1.45-3.064-2.249-5.15-2.249h-.261a.896.896 0 00-.798-.489h-.033A.912.912 0 006.13 6.48h.031a.919.919 0 00.8-.554h.293c1.239 0 2.412.358 3.472 1.059.814.538 1.401 1.238 1.727 2.086.277.684.261 1.353-.033 1.923-.456.864-1.222 1.337-2.232 1.337a4.16 4.16 0 01-1.597-.343 9.58 9.58 0 01-.734.587c.7.326 1.418.505 2.102.505 1.565 0 2.722-.863 3.162-1.727.473-.946.44-2.575-.782-3.961zm-7.433 5.51a4.005 4.005 0 01-.977.113c-1.206 0-2.298-.505-2.836-1.32C.376 10.603.13 8.289 2.494 6.577c.05.261.147.62.212.832-.31.228-.798.685-1.108 1.303-.44.864-.391 1.729.13 2.527.359.537.93.864 1.663.962.896.114 1.793-.05 2.657-.505 1.271-.669 2.119-1.467 2.672-2.56a.944.944 0 01-.26-.603.913.913 0 01.88-.945h.033a.915.915 0 01.098 1.825c-.897 1.842-2.478 3.08-4.565 3.488z", + fill: color + } + ) + ); +}); +var TwitterIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M14 2.547a5.632 5.632 0 01-1.65.464 2.946 2.946 0 001.263-1.63 5.67 5.67 0 01-1.823.715 2.837 2.837 0 00-2.097-.93c-1.586 0-2.872 1.319-2.872 2.946 0 .23.025.456.074.67C4.508 4.66 2.392 3.488.975 1.706c-.247.435-.389.941-.389 1.481 0 1.022.507 1.923 1.278 2.452a2.806 2.806 0 01-1.3-.368l-.001.037c0 1.427.99 2.617 2.303 2.888a2.82 2.82 0 01-1.297.05c.366 1.17 1.427 2.022 2.683 2.045A5.671 5.671 0 010 11.51a7.985 7.985 0 004.403 1.323c5.283 0 8.172-4.488 8.172-8.38 0-.128-.003-.255-.009-.38A5.926 5.926 0 0014 2.546z", + fill: color + } + ) + ); +}); +var YoutubeIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M13.99 8.172c.005-.281.007-.672.007-1.172 0-.5-.002-.89-.007-1.172a14.952 14.952 0 00-.066-1.066 9.638 9.638 0 00-.169-1.153c-.083-.38-.264-.7-.542-.96a1.667 1.667 0 00-.972-.454C11.084 2.065 9.337 2 6.999 2s-4.085.065-5.241.195a1.65 1.65 0 00-.969.453c-.276.26-.455.58-.539.961a8.648 8.648 0 00-.176 1.153c-.039.43-.061.785-.066 1.066C.002 6.11 0 6.5 0 7c0 .5.002.89.008 1.172.005.281.027.637.066 1.067.04.43.095.813.168 1.152.084.38.265.7.543.96.279.261.603.412.973.453 1.156.13 2.902.196 5.24.196 2.34 0 4.087-.065 5.243-.196a1.65 1.65 0 00.967-.453c.276-.26.456-.58.54-.96.077-.339.136-.722.175-1.152.04-.43.062-.786.067-1.067zM9.762 6.578A.45.45 0 019.997 7a.45.45 0 01-.235.422l-3.998 2.5a.442.442 0 01-.266.078.538.538 0 01-.242-.063.465.465 0 01-.258-.437v-5c0-.197.086-.343.258-.437a.471.471 0 01.508.016l3.998 2.5z", + fill: color + } + ) + ); +}); +var VSCodeIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M10.243.04a.87.87 0 01.38.087l2.881 1.386a.874.874 0 01.496.79V11.713a.875.875 0 01-.496.775l-2.882 1.386a.872.872 0 01-.994-.17L4.11 8.674l-2.404 1.823a.583.583 0 01-.744-.034l-.771-.7a.583.583 0 010-.862L2.274 7 .19 5.1a.583.583 0 010-.862l.772-.701a.583.583 0 01.744-.033L4.11 5.327 9.628.296a.871.871 0 01.615-.255zm.259 3.784L6.315 7l4.187 3.176V3.824z", + fill: color + } + ) + ); +}); +var LinkedinIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M11.667 13H2.333A1.333 1.333 0 011 11.667V2.333C1 1.597 1.597 1 2.333 1h9.334C12.403 1 13 1.597 13 2.333v9.334c0 .736-.597 1.333-1.333 1.333zm-2.114-1.667h1.78V7.675c0-1.548-.877-2.296-2.102-2.296-1.226 0-1.742.955-1.742.955v-.778H5.773v5.777h1.716V8.3c0-.812.374-1.296 1.09-1.296.658 0 .974.465.974 1.296v3.033zm-6.886-7.6c0 .589.474 1.066 1.058 1.066.585 0 1.058-.477 1.058-1.066 0-.589-.473-1.066-1.058-1.066-.584 0-1.058.477-1.058 1.066zm1.962 7.6h-1.79V5.556h1.79v5.777z", + fill: color + } + ) + ); +}); +var XIcon = /* @__PURE__ */ React255.forwardRef( + ({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M11.02.446h2.137L8.49 5.816l5.51 7.28H9.67L6.298 8.683l-3.88 4.413H.282l5.004-5.735L0 .446h4.442l3.064 4.048L11.02.446zm-.759 11.357h1.18L3.796 1.655H2.502l7.759 10.148z", + fill: color + } + ) + ); + } +); +var BrowserIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M.5 13.004a.5.5 0 01-.5-.5v-11a.5.5 0 01.5-.5h13a.5.5 0 01.5.5v11a.5.5 0 01-.5.5H.5zm.5-1v-8h12v8H1zm1-9.5a.5.5 0 11-1 0 .5.5 0 011 0zm2 0a.5.5 0 11-1 0 .5.5 0 011 0zm2 0a.5.5 0 11-1 0 .5.5 0 011 0z", + fill: color + } + ) + ); +}); +var TabletIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 15", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M3.5.004a1.5 1.5 0 00-1.5 1.5v11a1.5 1.5 0 001.5 1.5h7a1.5 1.5 0 001.5-1.5v-11a1.5 1.5 0 00-1.5-1.5h-7zm0 1h7a.5.5 0 01.5.5v9.5H3v-9.5a.5.5 0 01.5-.5zm2.5 11a.5.5 0 000 1h2a.5.5 0 000-1H6z", + fill: color + } + ) + ); +}); +var MobileIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 15", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M3 1.504a1.5 1.5 0 011.5-1.5h5a1.5 1.5 0 011.5 1.5v11a1.5 1.5 0 01-1.5 1.5h-5a1.5 1.5 0 01-1.5-1.5v-11zm1 10.5v-10h6v10H4z", + fill: color + } + ) + ); +}); +var WatchIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 15", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M4 .504a.5.5 0 01.5-.5h5a.5.5 0 010 1h-5a.5.5 0 01-.5-.5zm5.5 2.5h-5a.5.5 0 00-.5.5v7a.5.5 0 00.5.5h5a.5.5 0 00.5-.5v-7a.5.5 0 00-.5-.5zm-5-1a1.5 1.5 0 00-1.5 1.5v7a1.5 1.5 0 001.5 1.5h5a1.5 1.5 0 001.5-1.5v-7a1.5 1.5 0 00-1.5-1.5h-5zm2.5 2a.5.5 0 01.5.5v2h1a.5.5 0 110 1H7a.5.5 0 01-.5-.5v-2.5a.5.5 0 01.5-.5zm-2.5 9a.5.5 0 000 1h5a.5.5 0 000-1h-5z", + fill: color + } + ) + ); +}); +var SidebarIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M2.5 4.504a.5.5 0 01.5-.5h1a.5.5 0 110 1H3a.5.5 0 01-.5-.5zM3 6.004a.5.5 0 100 1h1a.5.5 0 000-1H3zM2.5 8.504a.5.5 0 01.5-.5h1a.5.5 0 110 1H3a.5.5 0 01-.5-.5z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M1.5 13.004a.5.5 0 01-.5-.5v-11a.5.5 0 01.5-.5h11a.5.5 0 01.5.5v11a.5.5 0 01-.5.5h-11zm.5-1v-10h3v10H2zm4-10h6v10H6v-10z", + fill: color + } + ) + ); +}); +var SidebarAltIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M9.5 4.504a.5.5 0 01.5-.5h1a.5.5 0 010 1h-1a.5.5 0 01-.5-.5zM10 6.004a.5.5 0 100 1h1a.5.5 0 000-1h-1zM9.5 8.504a.5.5 0 01.5-.5h1a.5.5 0 010 1h-1a.5.5 0 01-.5-.5z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M1.5 13.004a.5.5 0 01-.5-.5v-11a.5.5 0 01.5-.5h11a.5.5 0 01.5.5v11a.5.5 0 01-.5.5h-11zm.5-1v-10h6v10H2zm7-10h3v10H9v-10z", + fill: color + } + ) + ); +}); +var SidebarAltToggleIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M11.5 4.504a.5.5 0 00-.5-.5h-1a.5.5 0 100 1h1a.5.5 0 00.5-.5zM11 6.004a.5.5 0 010 1h-1a.5.5 0 010-1h1zM11.5 8.504a.5.5 0 00-.5-.5h-1a.5.5 0 100 1h1a.5.5 0 00.5-.5z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M1.5 13.004a.5.5 0 01-.5-.5v-11a.5.5 0 01.5-.5h11a.5.5 0 01.5.5v11a.5.5 0 01-.5.5h-11zm7.5-1h3v-10H9v10zm-1 0H2v-10h6v4.5H5.207l.65-.65a.5.5 0 10-.707-.708L3.646 6.65a.5.5 0 000 .707l1.497 1.497a.5.5 0 10.707-.708l-.643-.642H8v4.5z", + fill: color + } + ) + ); +}); +var SidebarToggleIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M1.5 4.504a.5.5 0 01.5-.5h1a.5.5 0 110 1H2a.5.5 0 01-.5-.5zM2 6.004a.5.5 0 100 1h1a.5.5 0 000-1H2zM1.5 8.504a.5.5 0 01.5-.5h1a.5.5 0 110 1H2a.5.5 0 01-.5-.5z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M.5 13.004a.5.5 0 01-.5-.5v-11a.5.5 0 01.5-.5h11a.5.5 0 01.5.5v11a.5.5 0 01-.5.5H.5zm.5-1v-10h3v10H1zm4 0v-4.5h2.793l-.643.642a.5.5 0 10.707.708l1.497-1.497a.5.5 0 000-.707L7.85 5.146a.5.5 0 10-.707.708l.65.65H5v-4.5h6v10H5z", + fill: color + } + ) + ); +}); +var BottomBarIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M3 10.504a.5.5 0 01.5-.5h1a.5.5 0 010 1h-1a.5.5 0 01-.5-.5zM6.5 10.004a.5.5 0 000 1h1a.5.5 0 000-1h-1zM9 10.504a.5.5 0 01.5-.5h1a.5.5 0 010 1h-1a.5.5 0 01-.5-.5z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M1 1.504a.5.5 0 01.5-.5h11a.5.5 0 01.5.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-11zm1 6.5v-6h10v6H2zm10 1v3H2v-3h10z", + fill: color + } + ) + ); +}); +var BottomBarToggleIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M3.5 10.004a.5.5 0 000 1h1a.5.5 0 000-1h-1zM6 10.504a.5.5 0 01.5-.5h1a.5.5 0 010 1h-1a.5.5 0 01-.5-.5zM9.5 10.004a.5.5 0 000 1h1a.5.5 0 000-1h-1z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M1 12.504v-11a.5.5 0 01.5-.5h11a.5.5 0 01.5.5v11a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5zm1-.5v-3h10v3H2zm4.5-4H2v-6h10v6H7.5V5.21l.646.646a.5.5 0 10.708-.707l-1.5-1.5a.5.5 0 00-.708 0l-1.5 1.5a.5.5 0 10.708.707l.646-.646v2.793z", + fill: color + } + ) + ); +}); +var CPUIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 15", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M5 5.504a.5.5 0 01.5-.5h3a.5.5 0 01.5.5v3a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5v-3zm1 2.5v-2h2v2H6z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M5.5.004a.5.5 0 01.5.5v1.5h2v-1.5a.5.5 0 011 0v1.5h2.5a.5.5 0 01.5.5v2.5h1.5a.5.5 0 010 1H12v2h1.5a.5.5 0 010 1H12v2.5a.5.5 0 01-.5.5H9v1.5a.5.5 0 01-1 0v-1.5H6v1.5a.5.5 0 01-1 0v-1.5H2.5a.5.5 0 01-.5-.5v-2.5H.5a.5.5 0 010-1H2v-2H.5a.5.5 0 010-1H2v-2.5a.5.5 0 01.5-.5H5v-1.5a.5.5 0 01.5-.5zm5.5 3H3v8h8v-8z", + fill: color + } + ) + ); +}); +var DatabaseIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M12 3c0-1.105-2.239-2-5-2s-5 .895-5 2v8c0 .426.26.752.544.977.29.228.68.413 1.116.558.878.293 2.059.465 3.34.465 1.281 0 2.462-.172 3.34-.465.436-.145.825-.33 1.116-.558.285-.225.544-.551.544-.977V3zm-1.03 0a.787.787 0 00-.05-.052c-.13-.123-.373-.28-.756-.434C9.404 2.21 8.286 2 7 2c-1.286 0-2.404.21-3.164.514-.383.153-.625.31-.756.434A.756.756 0 003.03 3a.756.756 0 00.05.052c.13.123.373.28.756.434C4.596 3.79 5.714 4 7 4c1.286 0 2.404-.21 3.164-.514.383-.153.625-.31.756-.434A.787.787 0 0010.97 3zM11 5.75V4.2c-.912.486-2.364.8-4 .8-1.636 0-3.088-.314-4-.8v1.55l.002.008a.147.147 0 00.016.033.618.618 0 00.145.15c.165.13.435.27.813.395.751.25 1.82.414 3.024.414s2.273-.163 3.024-.414c.378-.126.648-.265.813-.395a.62.62 0 00.146-.15.149.149 0 00.015-.033A.03.03 0 0011 5.75zM3 7.013c.2.103.423.193.66.272.878.293 2.059.465 3.34.465 1.281 0 2.462-.172 3.34-.465.237-.079.46-.17.66-.272V8.5l-.002.008a.149.149 0 01-.015.033.62.62 0 01-.146.15c-.165.13-.435.27-.813.395-.751.25-1.82.414-3.024.414s-2.273-.163-3.024-.414c-.378-.126-.648-.265-.813-.395a.618.618 0 01-.145-.15.147.147 0 01-.016-.033A.027.027 0 013 8.5V7.013zm0 2.75V11l.002.008a.147.147 0 00.016.033.617.617 0 00.145.15c.165.13.435.27.813.395.751.25 1.82.414 3.024.414s2.273-.163 3.024-.414c.378-.126.648-.265.813-.395a.619.619 0 00.146-.15.148.148 0 00.015-.033L11 11V9.763c-.2.103-.423.193-.66.272-.878.293-2.059.465-3.34.465-1.281 0-2.462-.172-3.34-.465A4.767 4.767 0 013 9.763z", + fill: color + } + ) + ); +}); +var MemoryIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 15", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M5 3a.5.5 0 00-1 0v3a.5.5 0 001 0V3zM7 2.5a.5.5 0 01.5.5v3a.5.5 0 01-1 0V3a.5.5 0 01.5-.5zM10 4.504a.5.5 0 10-1 0V6a.5.5 0 001 0V4.504z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M12 3.54l-.001-.002a.499.499 0 00-.145-.388l-3-3a.499.499 0 00-.388-.145L8.464.004H2.5a.5.5 0 00-.5.5v13a.5.5 0 00.5.5h9a.5.5 0 00.5-.5V3.54zM3 1.004h5.293L11 3.71v5.293H3v-8zm0 9v3h8v-3H3z", + fill: color + } + ) + ); +}); +var StructureIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M8.164 3.446a1.5 1.5 0 10-2.328 0L1.81 10.032A1.503 1.503 0 000 11.5a1.5 1.5 0 002.915.5h8.17a1.5 1.5 0 101.104-1.968L8.164 3.446zm-1.475.522a1.506 1.506 0 00.622 0l4.025 6.586a1.495 1.495 0 00-.25.446H2.914a1.497 1.497 0 00-.25-.446l4.024-6.586z", + fill: color + } + ) + ); +}); +var BoxIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M7.21.046l6.485 2.994A.5.5 0 0114 3.51v6.977a.495.495 0 01-.23.432.481.481 0 01-.071.038L7.23 13.944a.499.499 0 01-.46 0L.3 10.958a.498.498 0 01-.3-.47V3.511a.497.497 0 01.308-.473L6.78.051a.499.499 0 01.43-.005zM1 4.282v5.898l5.5 2.538V6.82L1 4.282zm6.5 8.436L13 10.18V4.282L7.5 6.82v5.898zM12.307 3.5L7 5.95 1.693 3.5 7 1.05l5.307 2.45z", + fill: color + } + ) + ); +}); +var PowerIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement("path", { d: "M7.5.5a.5.5 0 00-1 0v6a.5.5 0 001 0v-6z", fill: color }), + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M4.273 2.808a.5.5 0 00-.546-.837 6 6 0 106.546 0 .5.5 0 00-.546.837 5 5 0 11-5.454 0z", + fill: color + } + ) + ); +}); +var EditIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M13.854 2.146l-2-2a.5.5 0 00-.708 0l-1.5 1.5-8.995 8.995a.499.499 0 00-.143.268L.012 13.39a.495.495 0 00.135.463.5.5 0 00.462.134l2.482-.496a.495.495 0 00.267-.143l8.995-8.995 1.5-1.5a.5.5 0 000-.708zM12 3.293l.793-.793L11.5 1.207 10.707 2 12 3.293zm-2-.586L1.707 11 3 12.293 11.293 4 10 2.707zM1.137 12.863l.17-.849.679.679-.849.17z", + fill: color + } + ) + ); +}); +var CogIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M5.586 5.586A2 2 0 018.862 7.73a.5.5 0 10.931.365 3 3 0 10-1.697 1.697.5.5 0 10-.365-.93 2 2 0 01-2.145-3.277z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M.939 6.527c.127.128.19.297.185.464a.635.635 0 01-.185.465L0 8.395a7.099 7.099 0 001.067 2.572h1.32c.182 0 .345.076.46.197a.635.635 0 01.198.46v1.317A7.097 7.097 0 005.602 14l.94-.94a.634.634 0 01.45-.186H7.021c.163 0 .326.061.45.186l.939.938a7.098 7.098 0 002.547-1.057V11.61c0-.181.075-.344.197-.46a.634.634 0 01.46-.197h1.33c.507-.76.871-1.622 1.056-2.55l-.946-.946a.635.635 0 01-.186-.465.635.635 0 01.186-.464l.943-.944a7.099 7.099 0 00-1.044-2.522h-1.34a.635.635 0 01-.46-.197.635.635 0 01-.196-.46V1.057A7.096 7.096 0 008.413.002l-.942.942a.634.634 0 01-.45.186H6.992a.634.634 0 01-.45-.186L5.598 0a7.097 7.097 0 00-2.553 1.058v1.33c0 .182-.076.345-.197.46a.635.635 0 01-.46.198h-1.33A7.098 7.098 0 00.003 5.591l.936.936zm.707 1.636c.324-.324.482-.752.479-1.172a1.634 1.634 0 00-.48-1.171l-.538-.539c.126-.433.299-.847.513-1.235h.768c.459 0 .873-.19 1.167-.49.3-.295.49-.708.49-1.167v-.77c.39-.215.807-.388 1.243-.515l.547.547c.32.32.742.48 1.157.48l.015-.001h.014c.415 0 .836-.158 1.157-.479l.545-.544c.433.126.846.299 1.234.512v.784c0 .46.19.874.49 1.168.294.3.708.49 1.167.49h.776c.209.382.378.788.502 1.213l-.545.546a1.635 1.635 0 00-.48 1.17c-.003.421.155.849.48 1.173l.549.55c-.126.434-.3.85-.513 1.239h-.77c-.458 0-.872.19-1.166.49-.3.294-.49.708-.49 1.167v.77a6.09 6.09 0 01-1.238.514l-.54-.54a1.636 1.636 0 00-1.158-.48H6.992c-.415 0-.837.159-1.157.48l-.543.543a6.091 6.091 0 01-1.247-.516v-.756c0-.459-.19-.873-.49-1.167-.294-.3-.708-.49-1.167-.49h-.761a6.094 6.094 0 01-.523-1.262l.542-.542z", + fill: color + } + ) + ); +}); +var NutIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M5.585 8.414a2 2 0 113.277-.683.5.5 0 10.931.365 3 3 0 10-1.697 1.697.5.5 0 00-.365-.93 2 2 0 01-2.146-.449z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M6.5.289a1 1 0 011 0l5.062 2.922a1 1 0 01.5.866v5.846a1 1 0 01-.5.866L7.5 13.71a1 1 0 01-1 0L1.437 10.79a1 1 0 01-.5-.866V4.077a1 1 0 01.5-.866L6.5.29zm.5.866l5.062 2.922v5.846L7 12.845 1.937 9.923V4.077L7 1.155z", + fill: color + } + ) + ); +}); +var WrenchIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M10.5 1c.441 0 .564.521.252.833l-.806.807a.51.51 0 000 .72l.694.694a.51.51 0 00.72 0l.807-.806c.312-.312.833-.19.833.252a2.5 2.5 0 01-3.414 2.328l-6.879 6.88a1 1 0 01-1.414-1.415l6.88-6.88A2.5 2.5 0 0110.5 1zM2 12.5a.5.5 0 100-1 .5.5 0 000 1z", + fill: color + } + ) + ); +}); +var EllipsisIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M4 7a1.5 1.5 0 11-3 0 1.5 1.5 0 013 0zM13 7a1.5 1.5 0 11-3 0 1.5 1.5 0 013 0zM7 8.5a1.5 1.5 0 100-3 1.5 1.5 0 000 3z", + fill: color + } + ) + ); +}); +var WandIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 15", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M5.903.112a.107.107 0 01.194 0l.233.505.552.066c.091.01.128.123.06.185l-.408.377.109.546a.107.107 0 01-.158.114L6 1.633l-.486.272a.107.107 0 01-.157-.114l.108-.546-.408-.377a.107.107 0 01.06-.185L5.67.617l.233-.505zM2.194.224a.214.214 0 00-.389 0l-.466 1.01-1.104.13a.214.214 0 00-.12.371l.816.755-.217 1.091a.214.214 0 00.315.23L2 3.266l.971.543c.16.09.35-.05.315-.229l-.217-1.09.817-.756a.214.214 0 00-.12-.37L2.66 1.234 2.194.224zM12.194 8.224a.214.214 0 00-.389 0l-.466 1.01-1.104.13a.214.214 0 00-.12.371l.816.755-.217 1.091a.214.214 0 00.315.23l.97-.544.971.543c.16.09.35-.05.315-.229l-.217-1.09.817-.756a.214.214 0 00-.12-.37l-1.105-.131-.466-1.01z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M.147 11.857a.5.5 0 010-.707l11-11a.5.5 0 01.706 0l2 2a.5.5 0 010 .708l-11 11a.5.5 0 01-.706 0l-2-2zm2.353.94l-1.293-1.293 6.758-6.758L9.258 6.04 2.5 12.797zm7.465-7.465l2.828-2.828L11.5 1.211 8.672 4.039l1.293 1.293z", + fill: color + } + ) + ); +}); +var SweepIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M9.621 3.914l.379.379 3.146-3.147a.5.5 0 01.708.708L10.707 5l.379.379a3 3 0 010 4.242l-.707.707-.005.005-.008.008-.012.013-1.733 1.732a3 3 0 01-4.242 0L.146 7.854a.5.5 0 01.708-.707.915.915 0 001.292 0L4.64 4.654a.52.52 0 01.007-.008l.733-.732a3 3 0 014.242 0zm-4.26 1.432l.139-.139 3.146 3.147a.5.5 0 10.708-.707L6.212 4.505a2 2 0 012.702.116l.731.731.001.002h.002l.73.732a2 2 0 010 2.828l-.706.707-.012.013a.503.503 0 00-.014.013l-1.732 1.732a2 2 0 01-2.828 0L3.354 9.647a2.489 2.489 0 001.414-.708l1.086-1.085a.5.5 0 10-.708-.707L4.061 8.232a1.5 1.5 0 01-2.01.102c.294-.088.57-.248.803-.48l2.5-2.5a.475.475 0 00.007-.008z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M2 5.004a1 1 0 11-2 0 1 1 0 012 0zM4 3.25a.75.75 0 11-1.5 0 .75.75 0 011.5 0z", + fill: color + } + ) + ); +}); +var CheckIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M13.854 3.354a.5.5 0 00-.708-.708L5 10.793.854 6.646a.5.5 0 10-.708.708l4.5 4.5a.5.5 0 00.708 0l8.5-8.5z", + fill: color + } + ) + ); +}); +var FormIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M2 1.004a1 1 0 00-1 1v10a1 1 0 001 1h10a1 1 0 001-1V6.393a.5.5 0 00-1 0v5.61H2v-10h7.5a.5.5 0 000-1H2z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M6.354 9.857l7.5-7.5a.5.5 0 00-.708-.707L6 8.797 3.854 6.65a.5.5 0 10-.708.707l2.5 2.5a.5.5 0 00.708 0z", + fill: color + } + ) + ); +}); +var BatchDenyIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M11.5 2a.5.5 0 000 1h2a.5.5 0 000-1h-2zM8.854 2.646a.5.5 0 010 .708L5.207 7l3.647 3.646a.5.5 0 01-.708.708L4.5 7.707.854 11.354a.5.5 0 01-.708-.708L3.793 7 .146 3.354a.5.5 0 11.708-.708L4.5 6.293l3.646-3.647a.5.5 0 01.708 0zM11 7a.5.5 0 01.5-.5h2a.5.5 0 010 1h-2A.5.5 0 0111 7zM11.5 11a.5.5 0 000 1h2a.5.5 0 000-1h-2z", + fill: color + } + ) + ); +}); +var BatchAcceptIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M11.5 2a.5.5 0 000 1h2a.5.5 0 000-1h-2zM9.3 2.6a.5.5 0 01.1.7l-5.995 7.993a.505.505 0 01-.37.206.5.5 0 01-.395-.152L.146 8.854a.5.5 0 11.708-.708l2.092 2.093L8.6 2.7a.5.5 0 01.7-.1zM11 7a.5.5 0 01.5-.5h2a.5.5 0 010 1h-2A.5.5 0 0111 7zM11.5 11a.5.5 0 000 1h2a.5.5 0 000-1h-2z", + fill: color + } + ) + ); +}); +var ControlsIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M10.5 1a.5.5 0 01.5.5V2h1.5a.5.5 0 010 1H11v.5a.5.5 0 01-1 0V3H1.5a.5.5 0 010-1H10v-.5a.5.5 0 01.5-.5zM1.5 11a.5.5 0 000 1H10v.5a.5.5 0 001 0V12h1.5a.5.5 0 000-1H11v-.5a.5.5 0 00-1 0v.5H1.5zM1 7a.5.5 0 01.5-.5H3V6a.5.5 0 011 0v.5h8.5a.5.5 0 010 1H4V8a.5.5 0 01-1 0v-.5H1.5A.5.5 0 011 7z", + fill: color + } + ) + ); +}); +var PlusIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M7 1a.5.5 0 01.5.5v5h5a.5.5 0 010 1h-5v5a.5.5 0 01-1 0v-5h-5a.5.5 0 010-1h5v-5A.5.5 0 017 1z", + fill: color + } + ) + ); +}); +var CloseAltIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M2.03.97A.75.75 0 00.97 2.03L5.94 7 .97 11.97a.75.75 0 101.06 1.06L7 8.06l4.97 4.97a.75.75 0 101.06-1.06L8.06 7l4.97-4.97A.75.75 0 0011.97.97L7 5.94 2.03.97z", + fill: color + } + ) + ); +}); +var CrossIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M11.146 2.146a.5.5 0 11.707.707L7.708 7l4.147 4.146a.5.5 0 11-.707.707L7 7.708l-4.146 4.147a.5.5 0 01-.707-.708L6.293 7 2.147 2.853a.5.5 0 11.707-.707L7 6.293l4.146-4.147z", + fill: color + } + ) + ); +}); +var TrashIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M5.5 4.5A.5.5 0 016 5v5a.5.5 0 01-1 0V5a.5.5 0 01.5-.5zM9 5a.5.5 0 00-1 0v5a.5.5 0 001 0V5z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M4.5.5A.5.5 0 015 0h4a.5.5 0 01.5.5V2h3a.5.5 0 010 1H12v8a2 2 0 01-2 2H4a2 2 0 01-2-2V3h-.5a.5.5 0 010-1h3V.5zM3 3v8a1 1 0 001 1h6a1 1 0 001-1V3H3zm2.5-2h3v1h-3V1z", + fill: color + } + ) + ); +}); +var PinAltIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement("g", { clipPath: "url(#prefix__clip0_1107_3502)" }, /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M13.44 4.44L9.56.56a1.5 1.5 0 00-2.12 0L7 1a1.415 1.415 0 000 2L5 5H3.657A4 4 0 00.828 6.17l-.474.475a.5.5 0 000 .707l2.793 2.793-3 3a.5.5 0 00.707.708l3-3 2.792 2.792a.5.5 0 00.708 0l.474-.475A4 4 0 009 10.343V9l2-2a1.414 1.414 0 002 0l.44-.44a1.5 1.5 0 000-2.12zM11 5.585l-3 3v1.757a3 3 0 01-.879 2.121L7 12.586 1.414 7l.122-.122A3 3 0 013.656 6h1.758l3-3-.707-.707a.414.414 0 010-.586l.44-.44a.5.5 0 01.707 0l3.878 3.88a.5.5 0 010 .706l-.44.44a.414.414 0 01-.585 0L11 5.586z", + fill: color + } + )), + /* @__PURE__ */ React255.createElement("defs", null, /* @__PURE__ */ React255.createElement("clipPath", { id: "prefix__clip0_1107_3502" }, /* @__PURE__ */ React255.createElement("path", { fill: "#fff", d: "M0 0h14v14H0z" }))) + ); +}); +var UnpinIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement("g", { clipPath: "url(#prefix__clip0_1107_3501)", fill: color }, /* @__PURE__ */ React255.createElement("path", { d: "M13.44 4.44L9.56.56a1.5 1.5 0 00-2.12 0L7 1a1.415 1.415 0 000 2L5.707 4.293 6.414 5l2-2-.707-.707a.414.414 0 010-.586l.44-.44a.5.5 0 01.707 0l3.878 3.88a.5.5 0 010 .706l-.44.44a.414.414 0 01-.585 0L11 5.586l-2 2 .707.707L11 7a1.414 1.414 0 002 0l.44-.44a1.5 1.5 0 000-2.12zM.828 6.171a4 4 0 012.758-1.17l1 .999h-.93a3 3 0 00-2.12.878L1.414 7 7 12.586l.121-.122A3 3 0 008 10.343v-.929l1 1a4 4 0 01-1.172 2.757l-.474.475a.5.5 0 01-.708 0l-2.792-2.792-3 3a.5.5 0 01-.708-.708l3-3L.355 7.353a.5.5 0 010-.707l.474-.475zM1.854 1.146a.5.5 0 10-.708.708l11 11a.5.5 0 00.708-.708l-11-11z" })), + /* @__PURE__ */ React255.createElement("defs", null, /* @__PURE__ */ React255.createElement("clipPath", { id: "prefix__clip0_1107_3501" }, /* @__PURE__ */ React255.createElement("path", { fill: "#fff", d: "M0 0h14v14H0z" }))) + ); +}); +var AddIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M7 3a.5.5 0 01.5.5v3h3a.5.5 0 010 1h-3v3a.5.5 0 01-1 0v-3h-3a.5.5 0 010-1h3v-3A.5.5 0 017 3z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M7 14A7 7 0 107 0a7 7 0 000 14zm0-1A6 6 0 107 1a6 6 0 000 12z", + fill: color + } + ) + ); +}); +var SubtractIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement("path", { d: "M3.5 6.5a.5.5 0 000 1h7a.5.5 0 000-1h-7z", fill: color }), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M14 7A7 7 0 110 7a7 7 0 0114 0zm-1 0A6 6 0 111 7a6 6 0 0112 0z", + fill: color + } + ) + ); +}); +var CloseIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M9.854 4.146a.5.5 0 010 .708L7.707 7l2.147 2.146a.5.5 0 01-.708.708L7 7.707 4.854 9.854a.5.5 0 01-.708-.708L6.293 7 4.146 4.854a.5.5 0 11.708-.708L7 6.293l2.146-2.147a.5.5 0 01.708 0z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M7 14A7 7 0 107 0a7 7 0 000 14zm0-1A6 6 0 107 1a6 6 0 000 12z", + fill: color + } + ) + ); +}); +var DeleteIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M14 7A7 7 0 110 7a7 7 0 0114 0zm-1 0a6 6 0 01-9.874 4.582l8.456-8.456A5.976 5.976 0 0113 7zM2.418 10.874l8.456-8.456a6 6 0 00-8.456 8.456z", + fill: color + } + ) + ); +}); +var PassedIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M7 14A7 7 0 107 0a7 7 0 000 14zm3.854-9.354a.5.5 0 010 .708l-4.5 4.5a.5.5 0 01-.708 0l-2.5-2.5a.5.5 0 11.708-.708L6 8.793l4.146-4.147a.5.5 0 01.708 0z", + fill: color + } + ) + ); +}); +var ChangedIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M7 14A7 7 0 107 0a7 7 0 000 14zM3.5 6.5a.5.5 0 000 1h7a.5.5 0 000-1h-7z", + fill: color + } + ) + ); +}); +var FailedIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M7 14A7 7 0 107 0a7 7 0 000 14zm2.854-9.854a.5.5 0 010 .708L7.707 7l2.147 2.146a.5.5 0 01-.708.708L7 7.707 4.854 9.854a.5.5 0 01-.708-.708L6.293 7 4.146 4.854a.5.5 0 11.708-.708L7 6.293l2.146-2.147a.5.5 0 01.708 0z", + fill: color + } + ) + ); +}); +var ClearIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M5 2h7a2 2 0 012 2v6a2 2 0 01-2 2H5a1.994 1.994 0 01-1.414-.586l-3-3a2 2 0 010-2.828l3-3A1.994 1.994 0 015 2zm1.146 3.146a.5.5 0 01.708 0L8 6.293l1.146-1.147a.5.5 0 11.708.708L8.707 7l1.147 1.146a.5.5 0 01-.708.708L8 7.707 6.854 8.854a.5.5 0 11-.708-.708L7.293 7 6.146 5.854a.5.5 0 010-.708z", + fill: color + } + ) + ); +}); +var CommentIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 15", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M3.5 5.004a.5.5 0 100 1h7a.5.5 0 000-1h-7zM3 8.504a.5.5 0 01.5-.5h7a.5.5 0 010 1h-7a.5.5 0 01-.5-.5z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M12.5 12.004H5.707l-1.853 1.854a.5.5 0 01-.351.146h-.006a.499.499 0 01-.497-.5v-1.5H1.5a.5.5 0 01-.5-.5v-9a.5.5 0 01.5-.5h11a.5.5 0 01.5.5v9a.5.5 0 01-.5.5zm-10.5-1v-8h10v8H2z", + fill: color + } + ) + ); +}); +var CommentAddIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 15", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M7.5 5.004a.5.5 0 10-1 0v1.5H5a.5.5 0 100 1h1.5v1.5a.5.5 0 001 0v-1.5H9a.5.5 0 000-1H7.5v-1.5z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M3.691 13.966a.498.498 0 01-.188.038h-.006a.499.499 0 01-.497-.5v-1.5H1.5a.5.5 0 01-.5-.5v-9a.5.5 0 01.5-.5h11a.5.5 0 01.5.5v9a.5.5 0 01-.5.5H5.707l-1.853 1.854a.5.5 0 01-.163.108zM2 3.004v8h10v-8H2z", + fill: color + } + ) + ); +}); +var RequestChangeIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 15", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M9.854 6.65a.5.5 0 010 .707l-2 2a.5.5 0 11-.708-.707l1.15-1.15-3.796.004a.5.5 0 010-1L8.29 6.5 7.145 5.357a.5.5 0 11.708-.707l2 2z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M3.691 13.966a.498.498 0 01-.188.038h-.006a.499.499 0 01-.497-.5v-1.5H1.5a.5.5 0 01-.5-.5v-9a.5.5 0 01.5-.5h11a.5.5 0 01.5.5v9a.5.5 0 01-.5.5H5.707l-1.853 1.854a.5.5 0 01-.163.108zM2 3.004v8h10v-8H2z", + fill: color + } + ) + ); +}); +var CommentsIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 15", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M8.5 7.004a.5.5 0 000-1h-5a.5.5 0 100 1h5zM9 8.504a.5.5 0 01-.5.5h-5a.5.5 0 010-1h5a.5.5 0 01.5.5z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M12 11.504v-1.5h1.5a.5.5 0 00.5-.5v-8a.5.5 0 00-.5-.5h-11a.5.5 0 00-.5.5v1.5H.5a.5.5 0 00-.5.5v8a.5.5 0 00.5.5H2v1.5a.499.499 0 00.497.5h.006a.498.498 0 00.35-.146l1.854-1.854H11.5a.5.5 0 00.5-.5zm-9-8.5v-1h10v7h-1v-5.5a.5.5 0 00-.5-.5H3zm-2 8v-7h10v7H1z", + fill: color + } + ) + ); +}); +var ChatIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M1 2a2 2 0 012-2h8a2 2 0 012 2v8a2 2 0 01-2 2H6.986a.444.444 0 01-.124.103l-3.219 1.84A.43.43 0 013 13.569V12a2 2 0 01-2-2V2zm3.42 4.78a.921.921 0 110-1.843.921.921 0 010 1.842zm1.658-.922a.921.921 0 101.843 0 .921.921 0 00-1.843 0zm2.58 0a.921.921 0 101.842 0 .921.921 0 00-1.843 0z", + fill: color + } + ) + ); +}); +var LockIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 15", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M8 8.004a1 1 0 01-.5.866v1.634a.5.5 0 01-1 0V8.87A1 1 0 118 8.004z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M3 4.004a4 4 0 118 0v1h1.5a.5.5 0 01.5.5v8a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-8a.5.5 0 01.5-.5H3v-1zm7 1v-1a3 3 0 10-6 0v1h6zm2 1H2v7h10v-7z", + fill: color + } + ) + ); +}); +var UnlockIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement("g", { clipPath: "url(#prefix__clip0_1107_3614)", fill: color }, /* @__PURE__ */ React255.createElement("path", { d: "M6.5 8.87a1 1 0 111 0v1.634a.5.5 0 01-1 0V8.87z" }), /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M7 1a3 3 0 00-3 3v1.004h8.5a.5.5 0 01.5.5v8a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5v-8a.5.5 0 01.5-.5H3V4a4 4 0 017.755-1.381.5.5 0 01-.939.345A3.001 3.001 0 007 1zM2 6.004h10v7H2v-7z" + } + )), + /* @__PURE__ */ React255.createElement("defs", null, /* @__PURE__ */ React255.createElement("clipPath", { id: "prefix__clip0_1107_3614" }, /* @__PURE__ */ React255.createElement("path", { fill: "#fff", d: "M0 0h14v14H0z" }))) + ); +}); +var KeyIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement("path", { d: "M11 4a1 1 0 11-2 0 1 1 0 012 0z", fill: color }), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M7.5 8.532V9.5a.5.5 0 01-.5.5H5.5v1.5a.5.5 0 01-.5.5H3.5v1.5a.5.5 0 01-.5.5H.5a.5.5 0 01-.5-.5v-2a.5.5 0 01.155-.362l5.11-5.11A4.5 4.5 0 117.5 8.532zM6 4.5a3.5 3.5 0 111.5 2.873c-.29-.203-1-.373-1 .481V9H5a.5.5 0 00-.5.5V11H3a.5.5 0 00-.5.5V13H1v-1.293l5.193-5.193a.552.552 0 00.099-.613A3.473 3.473 0 016 4.5z", + fill: color + } + ) + ); +}); +var OutboxIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M7.354.15a.5.5 0 00-.708 0l-2 2a.5.5 0 10.708.707L6.5 1.711v6.793a.5.5 0 001 0V1.71l1.146 1.146a.5.5 0 10.708-.707l-2-2z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M2 7.504a.5.5 0 10-1 0v5a.5.5 0 00.5.5h11a.5.5 0 00.5-.5v-5a.5.5 0 00-1 0v4.5H2v-4.5z", + fill: color + } + ) + ); +}); +var CreditIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement("path", { d: "M2.5 8.004a.5.5 0 100 1h3a.5.5 0 000-1h-3z", fill: color }), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M0 11.504a.5.5 0 00.5.5h13a.5.5 0 00.5-.5v-9a.5.5 0 00-.5-.5H.5a.5.5 0 00-.5.5v9zm1-8.5v1h12v-1H1zm0 8h12v-5H1v5z", + fill: color + } + ) + ); +}); +var ButtonIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M1 3.004a1 1 0 00-1 1v5a1 1 0 001 1h3.5a.5.5 0 100-1H1v-5h12v5h-1a.5.5 0 000 1h1a1 1 0 001-1v-5a1 1 0 00-1-1H1z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M6.45 7.006a.498.498 0 01.31.07L10.225 9.1a.5.5 0 01-.002.873l-1.074.621.75 1.3a.75.75 0 01-1.3.75l-.75-1.3-1.074.62a.497.497 0 01-.663-.135.498.498 0 01-.095-.3L6 7.515a.497.497 0 01.45-.509z", + fill: color + } + ) + ); +}); +var TypeIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M4 1.504a.5.5 0 01.5-.5h5a.5.5 0 110 1h-2v10h2a.5.5 0 010 1h-5a.5.5 0 010-1h2v-10h-2a.5.5 0 01-.5-.5z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M0 4.504a.5.5 0 01.5-.5h4a.5.5 0 110 1H1v4h3.5a.5.5 0 110 1h-4a.5.5 0 01-.5-.5v-5zM9.5 4.004a.5.5 0 100 1H13v4H9.5a.5.5 0 100 1h4a.5.5 0 00.5-.5v-5a.5.5 0 00-.5-.5h-4z", + fill: color + } + ) + ); +}); +var PointerDefaultIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M5.943 12.457a.27.27 0 00.248-.149L7.77 9.151l2.54 2.54a.257.257 0 00.188.073c.082 0 .158-.03.21-.077l.788-.79a.27.27 0 000-.392L8.891 7.9l3.416-1.708a.29.29 0 00.117-.106.222.222 0 00.033-.134.332.332 0 00-.053-.161.174.174 0 00-.092-.072l-.02-.007-10.377-4.15a.274.274 0 00-.355.354l4.15 10.372a.275.275 0 00.233.169zm-.036 1l-.02-.002c-.462-.03-.912-.31-1.106-.796L.632 2.287A1.274 1.274 0 012.286.633l10.358 4.143c.516.182.782.657.81 1.114a1.25 1.25 0 01-.7 1.197L10.58 8.174l1.624 1.624a1.27 1.27 0 010 1.807l-.8.801-.008.007c-.491.46-1.298.48-1.792-.014l-1.56-1.56-.957 1.916a1.27 1.27 0 01-1.142.702h-.037z", + fill: color + } + ) + ); +}); +var PointerHandIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M11.87 6.008a.505.505 0 00-.003-.028v-.002c-.026-.27-.225-.48-.467-.498a.5.5 0 00-.53.5v1.41c0 .25-.22.47-.47.47a.48.48 0 01-.47-.47V5.17a.6.6 0 00-.002-.05c-.023-.268-.223-.49-.468-.5a.5.5 0 00-.52.5v1.65a.486.486 0 01-.47.47.48.48 0 01-.47-.47V4.62a.602.602 0 00-.002-.05v-.002c-.023-.266-.224-.48-.468-.498a.5.5 0 00-.53.5v2.2c0 .25-.22.47-.47.47a.49.49 0 01-.47-.47V1.8c0-.017 0-.034-.002-.05-.022-.268-.214-.49-.468-.5a.5.5 0 00-.52.5v6.78c0 .25-.22.47-.47.47a.48.48 0 01-.47-.47l.001-.1c.001-.053.002-.104 0-.155a.775.775 0 00-.06-.315.65.65 0 00-.16-.22 29.67 29.67 0 01-.21-.189c-.2-.182-.4-.365-.617-.532l-.003-.003A6.366 6.366 0 003.06 7l-.01-.007c-.433-.331-.621-.243-.69-.193-.26.14-.29.5-.13.74l1.73 2.6v.01h-.016l-.035.023.05-.023s1.21 2.6 3.57 2.6c3.54 0 4.2-1.9 4.31-4.42.039-.591.036-1.189.032-1.783l-.002-.507v-.032zm.969 2.376c-.057 1.285-.254 2.667-1.082 3.72-.88 1.118-2.283 1.646-4.227 1.646-1.574 0-2.714-.87-3.406-1.623a6.958 6.958 0 01-1.046-1.504l-.006-.012-1.674-2.516a1.593 1.593 0 01-.25-1.107 1.44 1.44 0 01.69-1.041c.195-.124.485-.232.856-.186.357.044.681.219.976.446.137.106.272.22.4.331V1.75A1.5 1.5 0 015.63.25c.93.036 1.431.856 1.431 1.55v1.335a1.5 1.5 0 01.53-.063h.017c.512.04.915.326 1.153.71a1.5 1.5 0 01.74-.161c.659.025 1.115.458 1.316.964a1.493 1.493 0 01.644-.103h.017c.856.067 1.393.814 1.393 1.558l.002.48c.004.596.007 1.237-.033 1.864z", + fill: color + } + ) + ); +}); +var CommandIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M3.5 6A2.5 2.5 0 116 3.5V5h2V3.5A2.5 2.5 0 1110.5 6H9v2h1.5A2.5 2.5 0 118 10.5V9H6v1.5A2.5 2.5 0 113.5 8H5V6H3.5zM2 3.5a1.5 1.5 0 113 0V5H3.5A1.5 1.5 0 012 3.5zM6 6v2h2V6H6zm3-1h1.5A1.5 1.5 0 109 3.5V5zM3.5 9H5v1.5A1.5 1.5 0 113.5 9zM9 9v1.5A1.5 1.5 0 1010.5 9H9z", + fill: color + } + ) + ); +}); +var SaveIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M8.896 1c.2 0 .39.08.53.22l3.354 3.353c.14.14.22.332.22.53V11a2 2 0 01-2 2H3a2 2 0 01-2-2V3a2 2 0 012-2h5.896zM3 2a1 1 0 00-1 1v8a1 1 0 001 1h1V8.5a.5.5 0 01.5-.5h5a.5.5 0 01.5.5V12h1a1 1 0 001-1V5.207L8.793 2H5v2h3.5a.5.5 0 010 1h-4a.5.5 0 01-.5-.5V2H3zm2 10h4V9H5v3z", + fill: color + } + ) + ); +}); +var SortDownIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M4.5 2a.5.5 0 01.5.5v8.293l2.146-2.147a.5.5 0 11.708.708L4.86 12.346l-.007.008a.499.499 0 01-.351.146h-.006a.5.5 0 01-.35-.146l-3-3a.5.5 0 11.707-.708L4 10.793V2.5a.5.5 0 01.5-.5zM7 2.5a.5.5 0 01.5-.5h5a.5.5 0 010 1h-5a.5.5 0 01-.5-.5zM7 5.5a.5.5 0 01.5-.5h5a.5.5 0 010 1h-5a.5.5 0 01-.5-.5zM10.5 8a.5.5 0 000 1h2a.5.5 0 000-1h-2zM8 11.5a.5.5 0 01.5-.5h4a.5.5 0 010 1h-4a.5.5 0 01-.5-.5z", + fill: color + } + ) + ); +}); +var SortUpIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M4.308 1.538a.496.496 0 00-.162.108l-3 3a.5.5 0 10.708.707L4 3.207V11.5a.5.5 0 001 0V3.207l2.146 2.147a.5.5 0 10.708-.708l-3-3a.5.5 0 00-.546-.108zM8 2.5a.5.5 0 01.5-.5h4a.5.5 0 010 1h-4a.5.5 0 01-.5-.5zM10.5 5a.5.5 0 000 1h2a.5.5 0 000-1h-2zM13 8.5a.5.5 0 01-.5.5h-5a.5.5 0 010-1h5a.5.5 0 01.5.5zM7 11.5a.5.5 0 01.5-.5h5a.5.5 0 010 1h-5a.5.5 0 01-.5-.5z", + fill: color + } + ) + ); +}); +var BugIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M11 0a.5.5 0 010 1 2 2 0 00-1.987 1.78C9.618 3.33 10 4.12 10 5a3 3 0 003-3 .5.5 0 011 0 4.002 4.002 0 01-3 3.874V7h2.5a.5.5 0 010 1H11v.626c1.725.444 3 2.01 3 3.874a.5.5 0 01-1 0 3 3 0 00-2.055-2.846 4 4 0 01-7.891 0A3 3 0 001 12.5a.5.5 0 01-1 0 4.002 4.002 0 013-3.874V8H.5a.5.5 0 010-1H3V5.874A4.002 4.002 0 010 2a.5.5 0 011 0 3 3 0 003 3c0-.88.382-1.67.986-2.22A1.999 1.999 0 003 1a.5.5 0 010-1c1.384 0 2.545.938 2.892 2.213a2.99 2.99 0 012.215 0A2.999 2.999 0 0111 0zM4 9a3 3 0 002.5 2.958V6H4v3zm3.5 2.958A3 3 0 0010 9V6H7.5v5.958zM7 3a2 2 0 00-2 2h4a2 2 0 00-2-2z", + fill: color + } + ) + ); +}); +var EditorIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M7.536 5.314a.5.5 0 01.928.372l-2 5a.5.5 0 01-.928-.371l2-5zM3.646 6.146a.5.5 0 01.708.708L3.207 8l1.147 1.146a.5.5 0 01-.708.708l-1.5-1.5a.5.5 0 01-.063-.63l.063-.078 1.5-1.5zM9.646 6.146a.5.5 0 01.707 0l1.5 1.5.065.079a.497.497 0 01-.064.629l-1.5 1.5a.5.5 0 01-.708-.708L10.793 8 9.646 6.854a.5.5 0 010-.708z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M13.5 1.004a.5.5 0 01.5.5v11l-.01.1a.501.501 0 01-.39.39l-.1.01H.5l-.1-.01a.501.501 0 01-.39-.39l-.01-.1v-11a.5.5 0 01.5-.5h13zm-12.5 11h12v-8H1v8zm.5-10a.5.5 0 100 1 .5.5 0 000-1zm2 0a.5.5 0 100 1 .5.5 0 000-1zm2 0a.5.5 0 100 1 .5.5 0 000-1z", + fill: color + } + ) + ); +}); +var InfoIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M7 13A6 6 0 107 1a6 6 0 000 12zm0 1A7 7 0 107 0a7 7 0 000 14z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M7 5.5a.5.5 0 01.5.5v4.5a.5.5 0 01-1 0V6a.5.5 0 01.5-.5z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement("path", { d: "M7.75 3.75a.75.75 0 11-1.5 0 .75.75 0 011.5 0z", fill: color }) + ); +}); +var QuestionIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M5.25 5.25A1.75 1.75 0 117 7a.5.5 0 00-.5.5V9a.5.5 0 001 0V7.955A2.75 2.75 0 104.25 5.25a.5.5 0 001 0zM7 11.5A.75.75 0 107 10a.75.75 0 000 1.5z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M14 7A7 7 0 110 7a7 7 0 0114 0zm-1 0A6 6 0 111 7a6 6 0 0112 0z", + fill: color + } + ) + ); +}); +var SupportIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M14 7A7 7 0 110 7a7 7 0 0114 0zm-3.524 4.89A5.972 5.972 0 017 13a5.972 5.972 0 01-3.477-1.11l1.445-1.444C5.564 10.798 6.258 11 7 11s1.436-.202 2.032-.554l1.444 1.445zm-.03-2.858l1.445 1.444A5.972 5.972 0 0013 7c0-1.296-.41-2.496-1.11-3.477l-1.444 1.445C10.798 5.564 11 6.258 11 7s-.202 1.436-.554 2.032zM9.032 3.554l1.444-1.445A5.972 5.972 0 007 1c-1.296 0-2.496.41-3.477 1.11l1.445 1.444A3.981 3.981 0 017 3c.742 0 1.436.202 2.032.554zM3.554 4.968L2.109 3.523A5.973 5.973 0 001 7c0 1.296.41 2.496 1.11 3.476l1.444-1.444A3.981 3.981 0 013 7c0-.742.202-1.436.554-2.032zM10 7a3 3 0 11-6 0 3 3 0 016 0z", + fill: color + } + ) + ); +}); +var AlertIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M7 4.5a.5.5 0 01.5.5v3.5a.5.5 0 11-1 0V5a.5.5 0 01.5-.5zM7.75 10.5a.75.75 0 11-1.5 0 .75.75 0 011.5 0z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M7.206 1.045a.498.498 0 01.23.209l6.494 10.992a.5.5 0 01-.438.754H.508a.497.497 0 01-.506-.452.498.498 0 01.072-.31l6.49-10.984a.497.497 0 01.642-.21zM7 2.483L1.376 12h11.248L7 2.483z", + fill: color + } + ) + ); +}); +var AlertAltIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M14 7A7 7 0 110 7a7 7 0 0114 0zM6.5 8a.5.5 0 001 0V4a.5.5 0 00-1 0v4zm-.25 2.25a.75.75 0 111.5 0 .75.75 0 01-1.5 0z", + fill: color + } + ) + ); +}); +var EmailIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M0 2.504a.5.5 0 01.5-.5h13a.5.5 0 01.5.5v9a.5.5 0 01-.5.5H.5a.5.5 0 01-.5-.5v-9zm1 1.012v7.488h12V3.519L7.313 7.894a.496.496 0 01-.526.062.497.497 0 01-.1-.062L1 3.516zm11.03-.512H1.974L7 6.874l5.03-3.87z", + fill: color + } + ) + ); +}); +var PhoneIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M7.76 8.134l-.05.05a.2.2 0 01-.28.03 6.76 6.76 0 01-1.63-1.65.21.21 0 01.04-.27l.05-.05c.23-.2.54-.47.71-.96.17-.47-.02-1.04-.66-1.94-.26-.38-.72-.96-1.22-1.46-.68-.69-1.2-1-1.65-1a.98.98 0 00-.51.13A3.23 3.23 0 00.9 3.424c-.13 1.1.26 2.37 1.17 3.78a16.679 16.679 0 004.55 4.6 6.57 6.57 0 003.53 1.32 3.2 3.2 0 002.85-1.66c.14-.24.24-.64-.07-1.18a7.803 7.803 0 00-1.73-1.81c-.64-.5-1.52-1.11-2.13-1.11a.97.97 0 00-.34.06c-.472.164-.74.458-.947.685l-.023.025zm4.32 2.678a6.801 6.801 0 00-1.482-1.54l-.007-.005-.006-.005a8.418 8.418 0 00-.957-.662 2.7 2.7 0 00-.4-.193.683.683 0 00-.157-.043l-.004.002-.009.003c-.224.078-.343.202-.56.44l-.014.016-.046.045a1.2 1.2 0 01-1.602.149A7.76 7.76 0 014.98 7.134l-.013-.019-.013-.02a1.21 1.21 0 01.195-1.522l.06-.06.026-.024c.219-.19.345-.312.422-.533l.003-.01v-.008a.518.518 0 00-.032-.142c-.06-.178-.203-.453-.502-.872l-.005-.008-.005-.007A10.18 10.18 0 004.013 2.59l-.005-.005c-.31-.314-.543-.5-.716-.605-.147-.088-.214-.096-.222-.097h-.016l-.006.003-.01.006a2.23 2.23 0 00-1.145 1.656c-.09.776.175 1.806 1.014 3.108a15.68 15.68 0 004.274 4.32l.022.014.022.016a5.57 5.57 0 002.964 1.117 2.2 2.2 0 001.935-1.141l.006-.012.004-.007a.182.182 0 00-.007-.038.574.574 0 00-.047-.114z", + fill: color + } + ) + ); +}); +var LinkIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M11.841 2.159a2.25 2.25 0 00-3.182 0l-2.5 2.5a2.25 2.25 0 000 3.182.5.5 0 01-.707.707 3.25 3.25 0 010-4.596l2.5-2.5a3.25 3.25 0 014.596 4.596l-2.063 2.063a4.27 4.27 0 00-.094-1.32l1.45-1.45a2.25 2.25 0 000-3.182z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M3.61 7.21c-.1-.434-.132-.88-.095-1.321L1.452 7.952a3.25 3.25 0 104.596 4.596l2.5-2.5a3.25 3.25 0 000-4.596.5.5 0 00-.707.707 2.25 2.25 0 010 3.182l-2.5 2.5A2.25 2.25 0 112.159 8.66l1.45-1.45z", + fill: color + } + ) + ); +}); +var LinkBrokenIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M1.452 7.952l1.305-1.305.708.707-1.306 1.305a2.25 2.25 0 103.182 3.182l1.306-1.305.707.707-1.306 1.305a3.25 3.25 0 01-4.596-4.596zM12.548 6.048l-1.305 1.306-.707-.708 1.305-1.305a2.25 2.25 0 10-3.182-3.182L7.354 3.464l-.708-.707 1.306-1.305a3.25 3.25 0 014.596 4.596zM1.854 1.146a.5.5 0 10-.708.708l11 11a.5.5 0 00.707-.707l-11-11z", + fill: color + } + ) + ); +}); +var BellIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M7.994 1.11a1 1 0 10-1.988 0A4.502 4.502 0 002.5 5.5v3.882l-.943 1.885a.497.497 0 00-.053.295.5.5 0 00.506.438h3.575a1.5 1.5 0 102.83 0h3.575a.5.5 0 00.453-.733L11.5 9.382V5.5a4.502 4.502 0 00-3.506-4.39zM2.81 11h8.382l-.5-1H3.31l-.5 1zM10.5 9V5.5a3.5 3.5 0 10-7 0V9h7zm-4 3.5a.5.5 0 111 0 .5.5 0 01-1 0z", + fill: color + } + ) + ); +}); +var RSSIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M1.5.5A.5.5 0 012 0c6.627 0 12 5.373 12 12a.5.5 0 01-1 0C13 5.925 8.075 1 2 1a.5.5 0 01-.5-.5z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M1.5 4.5A.5.5 0 012 4a8 8 0 018 8 .5.5 0 01-1 0 7 7 0 00-7-7 .5.5 0 01-.5-.5z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M5 11a2 2 0 11-4 0 2 2 0 014 0zm-1 0a1 1 0 11-2 0 1 1 0 012 0z", + fill: color + } + ) + ); +}); +var ShareAltIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M2 1.004a1 1 0 00-1 1v10a1 1 0 001 1h10a1 1 0 001-1v-4.5a.5.5 0 00-1 0v4.5H2v-10h4.5a.5.5 0 000-1H2z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M7.354 7.357L12 2.711v1.793a.5.5 0 001 0v-3a.5.5 0 00-.5-.5h-3a.5.5 0 100 1h1.793L6.646 6.65a.5.5 0 10.708.707z", + fill: color + } + ) + ); +}); +var ShareIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M6.646.15a.5.5 0 01.708 0l2 2a.5.5 0 11-.708.707L7.5 1.711v6.793a.5.5 0 01-1 0V1.71L5.354 2.857a.5.5 0 11-.708-.707l2-2z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M2 4.004a1 1 0 00-1 1v7a1 1 0 001 1h10a1 1 0 001-1v-7a1 1 0 00-1-1H9.5a.5.5 0 100 1H12v7H2v-7h2.5a.5.5 0 000-1H2z", + fill: color + } + ) + ); +}); +var JumpToIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M13.854 6.646a.5.5 0 010 .708l-2 2a.5.5 0 01-.708-.708L12.293 7.5H5.5a.5.5 0 010-1h6.793l-1.147-1.146a.5.5 0 01.708-.708l2 2z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M10 2a1 1 0 00-1-1H2a1 1 0 00-1 1v10a1 1 0 001 1h7a1 1 0 001-1V9.5a.5.5 0 00-1 0V12H2V2h7v2.5a.5.5 0 001 0V2z", + fill: color + } + ) + ); +}); +var CircleHollowIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M7 13A6 6 0 107 1a6 6 0 000 12zm0 1A7 7 0 107 0a7 7 0 000 14z", + fill: color + } + ) + ); +}); +var CircleIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement("path", { d: "M14 7A7 7 0 110 7a7 7 0 0114 0z", fill: color }) + ); +}); +var BookmarkHollowIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 15", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M3.5 0h7a.5.5 0 01.5.5v13a.5.5 0 01-.454.498.462.462 0 01-.371-.118L7 11.159l-3.175 2.72a.46.46 0 01-.379.118A.5.5 0 013 13.5V.5a.5.5 0 01.5-.5zM4 12.413l2.664-2.284a.454.454 0 01.377-.128.498.498 0 01.284.12L10 12.412V1H4v11.413z", + fill: color + } + ) + ); +}); +var BookmarkIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 15", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M3.5 0h7a.5.5 0 01.5.5v13a.5.5 0 01-.454.498.462.462 0 01-.371-.118L7 11.159l-3.175 2.72a.46.46 0 01-.379.118A.5.5 0 013 13.5V.5a.5.5 0 01.5-.5z", + fill: color + } + ) + ); +}); +var DiamondIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement("g", { clipPath: "url(#prefix__clip0_1449_588)" }, /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M8.414 1.586a2 2 0 00-2.828 0l-4 4a2 2 0 000 2.828l4 4a2 2 0 002.828 0l4-4a2 2 0 000-2.828l-4-4zm.707-.707a3 3 0 00-4.242 0l-4 4a3 3 0 000 4.242l4 4a3 3 0 004.242 0l4-4a3 3 0 000-4.242l-4-4z", + fill: color + } + )), + /* @__PURE__ */ React255.createElement("defs", null, /* @__PURE__ */ React255.createElement("clipPath", { id: "prefix__clip0_1449_588" }, /* @__PURE__ */ React255.createElement("path", { fill: "#fff", d: "M0 0h14v14H0z" }))) + ); +}); +var HeartHollowIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M12.814 1.846c.06.05.116.101.171.154l.001.002a3.254 3.254 0 01.755 1.168c.171.461.259.974.259 1.538 0 .332-.046.656-.143.976a4.546 4.546 0 01-.397.937c-.169.302-.36.589-.58.864a7.627 7.627 0 01-.674.746l-4.78 4.596a.585.585 0 01-.427.173.669.669 0 01-.44-.173L1.78 8.217a7.838 7.838 0 01-.677-.748 6.124 6.124 0 01-.572-.855 4.975 4.975 0 01-.388-.931A3.432 3.432 0 010 4.708C0 4.144.09 3.63.265 3.17c.176-.459.429-.85.757-1.168a3.432 3.432 0 011.193-.74c.467-.176.99-.262 1.57-.262.304 0 .608.044.907.137.301.092.586.215.855.367.27.148.526.321.771.512.244.193.471.386.682.584.202-.198.427-.391.678-.584.248-.19.507-.364.78-.512a4.65 4.65 0 01.845-.367c.294-.093.594-.137.9-.137.585 0 1.115.086 1.585.262.392.146.734.34 1.026.584zM1.2 3.526c.128-.333.304-.598.52-.806.218-.212.497-.389.849-.522m-1.37 1.328A3.324 3.324 0 001 4.708c0 .225.032.452.101.686.082.265.183.513.307.737.135.246.294.484.479.716.188.237.386.454.59.652l.001.002 4.514 4.355 4.519-4.344c.2-.193.398-.41.585-.648l.003-.003c.184-.23.345-.472.486-.726l.004-.007c.131-.23.232-.474.31-.732v-.002c.068-.224.101-.45.101-.686 0-.457-.07-.849-.195-1.185a2.177 2.177 0 00-.515-.802l.007-.012-.008.009a2.383 2.383 0 00-.85-.518l-.003-.001C11.1 2.072 10.692 2 10.203 2c-.21 0-.406.03-.597.09h-.001c-.22.07-.443.167-.663.289l-.007.003c-.22.12-.434.262-.647.426-.226.174-.42.341-.588.505l-.684.672-.7-.656a9.967 9.967 0 00-.615-.527 4.82 4.82 0 00-.635-.422l-.01-.005a3.289 3.289 0 00-.656-.281l-.008-.003A2.014 2.014 0 003.785 2c-.481 0-.881.071-1.217.198", + fill: color + } + ) + ); +}); +var HeartIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M12.814 1.846c.06.05.116.101.171.154l.001.002a3.254 3.254 0 01.755 1.168c.171.461.259.974.259 1.538 0 .332-.046.656-.143.976a4.546 4.546 0 01-.397.937c-.169.302-.36.589-.58.864a7.627 7.627 0 01-.674.746l-4.78 4.596a.585.585 0 01-.427.173.669.669 0 01-.44-.173L1.78 8.217a7.838 7.838 0 01-.677-.748 6.124 6.124 0 01-.572-.855 4.975 4.975 0 01-.388-.931A3.432 3.432 0 010 4.708C0 4.144.09 3.63.265 3.17c.176-.459.429-.85.757-1.168a3.432 3.432 0 011.193-.74c.467-.176.99-.262 1.57-.262.304 0 .608.044.907.137.301.092.586.215.855.367.27.148.526.321.771.512.244.193.471.386.682.584.202-.198.427-.391.678-.584.248-.19.507-.364.78-.512a4.65 4.65 0 01.845-.367c.294-.093.594-.137.9-.137.585 0 1.115.086 1.585.262.392.146.734.34 1.026.584z", + fill: color + } + ) + ); +}); +var StarHollowIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M6.319.783a.75.75 0 011.362 0l1.63 3.535 3.867.458a.75.75 0 01.42 1.296L10.74 8.715l.76 3.819a.75.75 0 01-1.103.8L7 11.434l-3.398 1.902a.75.75 0 01-1.101-.801l.758-3.819L.401 6.072a.75.75 0 01.42-1.296l3.867-.458L6.318.783zm.68.91l-1.461 3.17a.75.75 0 01-.593.431l-3.467.412 2.563 2.37a.75.75 0 01.226.697l-.68 3.424 3.046-1.705a.75.75 0 01.733 0l3.047 1.705-.68-3.424a.75.75 0 01.226-.697l2.563-2.37-3.467-.412a.75.75 0 01-.593-.43L7 1.694z", + fill: color + } + ) + ); +}); +var StarIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M7.68.783a.75.75 0 00-1.361 0l-1.63 3.535-3.867.458A.75.75 0 00.4 6.072l2.858 2.643-.758 3.819a.75.75 0 001.101.8L7 11.434l3.397 1.902a.75.75 0 001.102-.801l-.759-3.819L13.6 6.072a.75.75 0 00-.421-1.296l-3.866-.458L7.68.783z", + fill: color + } + ) + ); +}); +var CertificateIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M10 7.854a4.5 4.5 0 10-6 0V13a.5.5 0 00.497.5h.006c.127 0 .254-.05.35-.146L7 11.207l2.146 2.147A.5.5 0 0010 13V7.854zM7 8a3.5 3.5 0 100-7 3.5 3.5 0 000 7zm-.354 2.146a.5.5 0 01.708 0L9 11.793v-3.26C8.398 8.831 7.718 9 7 9a4.481 4.481 0 01-2-.468v3.26l1.646-1.646z", + fill: color + } + ) + ); +}); +var VerifiedIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M6.565 13.123a.991.991 0 01.87 0l.987.482a.991.991 0 001.31-.426l.515-.97a.991.991 0 01.704-.511l1.082-.19a.99.99 0 00.81-1.115l-.154-1.087a.991.991 0 01.269-.828l.763-.789a.991.991 0 000-1.378l-.763-.79a.991.991 0 01-.27-.827l.155-1.087a.99.99 0 00-.81-1.115l-1.082-.19a.991.991 0 01-.704-.511L9.732.82a.99.99 0 00-1.31-.426l-.987.482a.991.991 0 01-.87 0L5.578.395a.99.99 0 00-1.31.426l-.515.97a.99.99 0 01-.704.511l-1.082.19a.99.99 0 00-.81 1.115l.154 1.087a.99.99 0 01-.269.828L.28 6.31a.99.99 0 000 1.378l.763.79a.99.99 0 01.27.827l-.155 1.087a.99.99 0 00.81 1.115l1.082.19a.99.99 0 01.704.511l.515.97c.25.473.83.661 1.31.426l.987-.482zm4.289-8.477a.5.5 0 010 .708l-4.5 4.5a.5.5 0 01-.708 0l-2.5-2.5a.5.5 0 11.708-.708L6 8.793l4.146-4.147a.5.5 0 01.708 0z", + fill: color + } + ) + ); +}); +var ThumbsUpIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M11 12.02c-.4.37-.91.56-1.56.56h-.88a5.493 5.493 0 01-1.3-.16c-.42-.1-.91-.25-1.47-.45a5.056 5.056 0 00-.95-.27H2.88a.84.84 0 01-.62-.26.84.84 0 01-.26-.61V6.45c0-.24.09-.45.26-.62a.84.84 0 01.62-.25h1.87c.16-.11.47-.47.93-1.06.27-.35.51-.64.74-.88.1-.11.19-.3.24-.58.05-.28.12-.57.2-.87.1-.3.24-.55.43-.74a.87.87 0 01.62-.25c.38 0 .72.07 1.03.22.3.15.54.38.7.7.15.31.23.73.23 1.27a3 3 0 01-.32 1.31h1.2c.47 0 .88.17 1.23.52s.52.8.52 1.22c0 .29-.04.66-.34 1.12.05.15.07.3.07.47 0 .35-.09.68-.26.98a2.05 2.05 0 01-.4 1.51 1.9 1.9 0 01-.57 1.5zm.473-5.33a.965.965 0 00.027-.25.742.742 0 00-.227-.513.683.683 0 00-.523-.227H7.927l.73-1.45a2 2 0 00.213-.867c0-.444-.068-.695-.127-.822a.53.53 0 00-.245-.244 1.296 1.296 0 00-.539-.116.989.989 0 00-.141.28 9.544 9.544 0 00-.174.755c-.069.387-.213.779-.484 1.077l-.009.01-.009.01c-.195.202-.41.46-.67.798l-.003.004c-.235.3-.44.555-.613.753-.151.173-.343.381-.54.516l-.255.176H5v4.133l.018.003c.384.07.76.176 1.122.318.532.189.98.325 1.352.413l.007.002a4.5 4.5 0 001.063.131h.878c.429 0 .683-.115.871-.285a.9.9 0 00.262-.702l-.028-.377.229-.3a1.05 1.05 0 00.205-.774l-.044-.333.165-.292a.969.969 0 00.13-.487.457.457 0 00-.019-.154l-.152-.458.263-.404a1.08 1.08 0 00.152-.325zM3.5 10.8a.5.5 0 100-1 .5.5 0 000 1z", + fill: color + } + ) + ); +}); +var ShieldIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M11.765 2.076A.5.5 0 0112 2.5v6.009a.497.497 0 01-.17.366L7.337 12.87a.497.497 0 01-.674 0L2.17 8.875l-.009-.007a.498.498 0 01-.16-.358L2 8.5v-6a.5.5 0 01.235-.424l.018-.011c.016-.01.037-.024.065-.04.056-.032.136-.077.24-.128a6.97 6.97 0 01.909-.371C4.265 1.26 5.443 1 7 1s2.735.26 3.533.526c.399.133.702.267.91.37a4.263 4.263 0 01.304.169l.018.01zM3 2.793v5.482l1.068.95 6.588-6.588a6.752 6.752 0 00-.44-.163C9.517 2.24 8.444 2 7 2c-1.443 0-2.515.24-3.217.474-.351.117-.61.233-.778.317L3 2.793zm4 9.038l-2.183-1.94L11 3.706v4.568l-4 3.556z", + fill: color + } + ) + ); +}); +var BasketIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M10.354 2.854a.5.5 0 10-.708-.708l-3 3a.5.5 0 10.708.708l3-3z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M2.09 6H4.5a.5.5 0 000-1H1.795a.75.75 0 00-.74.873l.813 4.874A1.5 1.5 0 003.348 12h7.305a1.5 1.5 0 001.48-1.253l.812-4.874a.75.75 0 00-.74-.873H10a.5.5 0 000 1h1.91l-.764 4.582a.5.5 0 01-.493.418H3.347a.5.5 0 01-.493-.418L2.09 6z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M4.5 7a.5.5 0 01.5.5v2a.5.5 0 01-1 0v-2a.5.5 0 01.5-.5zM10 7.5a.5.5 0 00-1 0v2a.5.5 0 001 0v-2zM6.5 9.5v-2a.5.5 0 011 0v2a.5.5 0 01-1 0z", + fill: color + } + ) + ); +}); +var BeakerIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M4.5 2h.75v3.866l-3.034 5.26A1.25 1.25 0 003.299 13H10.7a1.25 1.25 0 001.083-1.875L8.75 5.866V2h.75a.5.5 0 100-1h-5a.5.5 0 000 1zm1.75 0h1.5v4.134L8.827 8H5.173L6.25 6.134V2zM4.597 9l-1.515 2.625A.25.25 0 003.3 12H10.7a.25.25 0 00.217-.375L9.404 9H4.597z", + fill: color + } + ) + ); +}); +var HourglassIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement("path", { d: "M7.5 10.5a.5.5 0 11-1 0 .5.5 0 011 0z", fill: color }), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M3.5 1a.5.5 0 00-.5.5c0 1.063.137 1.892.678 2.974.346.692.858 1.489 1.598 2.526-.89 1.247-1.455 2.152-1.798 2.956-.377.886-.477 1.631-.478 2.537v.007a.5.5 0 00.5.5h7c.017 0 .034 0 .051-.003A.5.5 0 0011 12.5v-.007c0-.906-.1-1.65-.478-2.537-.343-.804-.909-1.709-1.798-2.956.74-1.037 1.252-1.834 1.598-2.526C10.863 3.392 11 2.563 11 1.5a.5.5 0 00-.5-.5h-7zm6.487 11a4.675 4.675 0 00-.385-1.652c-.277-.648-.735-1.407-1.499-2.494-.216.294-.448.606-.696.937a.497.497 0 01-.195.162.5.5 0 01-.619-.162c-.248-.331-.48-.643-.696-.937-.764 1.087-1.222 1.846-1.499 2.494A4.675 4.675 0 004.013 12h5.974zM6.304 6.716c.212.293.443.609.696.948a90.058 90.058 0 00.709-.965c.48-.664.86-1.218 1.163-1.699H5.128a32.672 32.672 0 001.176 1.716zM4.559 4h4.882c.364-.735.505-1.312.546-2H4.013c.04.688.182 1.265.546 2z", + fill: color + } + ) + ); +}); +var FlagIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M11.5 1h-9a.5.5 0 00-.5.5v11a.5.5 0 001 0V8h8.5a.5.5 0 00.354-.854L9.207 4.5l2.647-2.646A.499.499 0 0011.5 1zM8.146 4.146L10.293 2H3v5h7.293L8.146 4.854a.5.5 0 010-.708z", + fill: color + } + ) + ); +}); +var CloudHollowIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M10 7V6a3 3 0 00-5.91-.736l-.17.676-.692.075A2.5 2.5 0 003.5 11h3c.063 0 .125-.002.187-.007l.076-.005.076.006c.053.004.106.006.161.006h4a2 2 0 100-4h-1zM3.12 5.02A3.5 3.5 0 003.5 12h3c.087 0 .174-.003.26-.01.079.007.16.01.24.01h4a3 3 0 100-6 4 4 0 00-7.88-.98z", + fill: color + } + ) + ); +}); +var CloudIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M7 2a4 4 0 014 4 3 3 0 110 6H7c-.08 0-.161-.003-.24-.01-.086.007-.173.01-.26.01h-3a3.5 3.5 0 01-.38-6.98A4.002 4.002 0 017 2z", + fill: color + } + ) + ); +}); +var StickerIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M11 7a4 4 0 11-8 0 4 4 0 018 0zm-1 0a3 3 0 11-6 0 3 3 0 016 0z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M4.268 13.18c.25.472.83.66 1.31.425l.987-.482a.991.991 0 01.87 0l.987.482a.991.991 0 001.31-.426l.515-.97a.991.991 0 01.704-.511l1.082-.19a.99.99 0 00.81-1.115l-.154-1.087a.991.991 0 01.269-.828l.763-.789a.991.991 0 000-1.378l-.763-.79a.991.991 0 01-.27-.827l.155-1.087a.99.99 0 00-.81-1.115l-1.082-.19a.991.991 0 01-.704-.511L9.732.82a.99.99 0 00-1.31-.426l-.987.482a.991.991 0 01-.87 0L5.578.395a.99.99 0 00-1.31.426l-.515.97a.99.99 0 01-.704.511l-1.082.19a.99.99 0 00-.81 1.115l.154 1.087a.99.99 0 01-.269.828L.28 6.31a.99.99 0 000 1.378l.763.79a.99.99 0 01.27.827l-.155 1.087a.99.99 0 00.81 1.115l1.082.19a.99.99 0 01.704.511l.515.97zm5.096-1.44l-.511.963-.979-.478a1.99 1.99 0 00-1.748 0l-.979.478-.51-.962a1.991 1.991 0 00-1.415-1.028l-1.073-.188.152-1.079a1.991 1.991 0 00-.54-1.663L1.004 7l.757-.783a1.991 1.991 0 00.54-1.663L2.15 3.475l1.073-.188A1.991 1.991 0 004.636 2.26l.511-.962.979.478a1.99 1.99 0 001.748 0l.979-.478.51.962c.288.543.81.922 1.415 1.028l1.073.188-.152 1.079a1.99 1.99 0 00.54 1.663l.757.783-.757.783a1.99 1.99 0 00-.54 1.663l.152 1.079-1.073.188a1.991 1.991 0 00-1.414 1.028z", + fill: color + } + ) + ); +}); +var StatusFailIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M9.147 4.146a.5.5 0 11.707.707L7.707 7l2.147 2.146a.5.5 0 11-.707.707L7 7.707 4.854 9.853a.5.5 0 01-.707-.707L6.293 7 4.147 4.853a.5.5 0 11.707-.707L7 6.293l2.147-2.147z", + fill: color + } + ) + ); +}); +var StatusIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement("circle", { cx: 7, cy: 7, r: 3, fill: color }) + ); +}); +var StatusWarnIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M7.206 3.044a.498.498 0 01.23.212l3.492 5.985a.494.494 0 01.006.507.497.497 0 01-.443.252H3.51a.499.499 0 01-.437-.76l3.492-5.984a.497.497 0 01.642-.212zM7 4.492L4.37 9h5.26L7 4.492z", + fill: color + } + ) + ); +}); +var StatusPassIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M10.854 4.146a.5.5 0 010 .708l-5 5a.5.5 0 01-.708 0l-2-2a.5.5 0 11.708-.708L5.5 8.793l4.646-4.647a.5.5 0 01.708 0z", + fill: color + } + ) + ); +}); +var GiftIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M9 0a2.5 2.5 0 011.997 4H12.5A1.5 1.5 0 0114 5.5v1c0 .653-.418 1.206-1 1.412V11.5a1.5 1.5 0 01-1.5 1.5h-9A1.5 1.5 0 011 11.5V7.912c-.582-.206-1-.76-1-1.412v-1A1.5 1.5 0 011.5 4h1.883A2.234 2.234 0 013 2.75c0-.6.208-1.142.597-1.535.39-.394.93-.607 1.533-.607.637 0 1.197.349 1.602.843A2.498 2.498 0 019 0zM7.5 12h4a.5.5 0 00.5-.5V8H7.5v4zM2 11.5a.5.5 0 00.5.5h4V8H2v3.5zM7.5 7h5a.5.5 0 00.5-.5v-1a.5.5 0 00-.5-.5h-5v2zm-6-2a.5.5 0 00-.5.5v1a.5.5 0 00.5.5h5V5h-5zm3.63-3.392c-.363 0-.639.125-.822.31-.184.187-.308.466-.308.832C4 3.44 4.56 4 5.25 4H6.5v-.25c0-.648-.197-1.203-.477-1.585-.283-.388-.616-.557-.893-.557zM9 1a1.5 1.5 0 00-1.5 1.5V4H9a1.5 1.5 0 100-3z", + fill: color + } + ) + ); +}); +var StatusNewIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M7.052 3.004c.01 0 .02 0 .03.002.004 0 .01.003.015.004a.493.493 0 01.051.013l.043.015a.497.497 0 01.089.049l.03.023c.015.012.029.023.042.036.012.012.023.026.035.04l.023.03c.01.015.019.03.027.047.008.014.016.028.022.043.006.014.01.028.015.043.005.017.01.034.013.051l.005.017.03.182A3.5 3.5 0 0010.4 6.476l.182.03c.005 0 .01.003.016.004a.494.494 0 01.051.013l.043.015a.503.503 0 01.089.049l.03.023c.015.012.029.023.042.036.012.012.023.026.035.04l.023.03c.01.015.019.03.027.047.008.014.016.028.022.043l.014.04.014.054.005.017c.002.01 0 .019.001.028.002.018.004.036.004.054 0 .018-.002.035-.004.053v.03l-.006.015a.479.479 0 01-.013.051l-.015.043a.507.507 0 01-.049.089l-.023.03-.035.042-.042.035-.03.023a.503.503 0 01-.046.027c-.014.008-.028.016-.043.022-.014.006-.028.01-.043.015a.491.491 0 01-.051.013l-.016.005-.182.03A3.5 3.5 0 007.522 10.4l-.03.182c0 .005-.004.01-.005.016a.491.491 0 01-.013.051l-.015.043a.503.503 0 01-.049.089l-.023.03-.035.042-.041.035-.03.023a.507.507 0 01-.047.027c-.014.008-.028.016-.043.022-.014.006-.028.01-.043.015a.479.479 0 01-.051.013l-.016.005c-.01.002-.02 0-.03.001-.017.002-.034.004-.052.004-.018 0-.036-.002-.054-.004h-.028c-.006-.002-.011-.005-.017-.006a.503.503 0 01-.051-.013l-.043-.015a.505.505 0 01-.089-.049l-.03-.023c-.015-.012-.029-.023-.041-.035-.013-.013-.024-.027-.036-.042l-.023-.03a.503.503 0 01-.027-.046c-.008-.014-.016-.028-.022-.043-.006-.014-.01-.028-.015-.043a.494.494 0 01-.013-.051l-.004-.016-.03-.182a3.5 3.5 0 00-2.877-2.877l-.182-.03c-.006 0-.011-.004-.017-.005a.493.493 0 01-.051-.013l-.043-.015a.492.492 0 01-.089-.049l-.03-.023c-.015-.012-.029-.023-.041-.035-.013-.013-.024-.027-.036-.041l-.023-.03a.497.497 0 01-.027-.047c-.008-.014-.016-.028-.022-.043-.006-.013-.01-.028-.015-.043a.493.493 0 01-.013-.051l-.004-.016c-.002-.01-.001-.02-.002-.03C3.002 7.035 3 7.018 3 7c0-.018.002-.036.004-.054 0-.009 0-.019.002-.028 0-.006.003-.011.004-.017l.015-.054.013-.04a.498.498 0 01.049-.089l.023-.03.026-.032.02-.02.03-.025.03-.023a.498.498 0 01.047-.027c.014-.008.028-.016.043-.022.014-.006.028-.01.043-.015A.493.493 0 013.4 6.51l.017-.004.182-.03a3.5 3.5 0 002.877-2.877l.03-.182c0-.006.003-.011.004-.017a.493.493 0 01.013-.051l.015-.043a.498.498 0 01.049-.089l.023-.03.026-.032.02-.02.03-.025.03-.023a.498.498 0 01.047-.027c.014-.008.028-.016.043-.022.014-.006.028-.01.043-.015A.493.493 0 016.9 3.01l.017-.004c.01-.002.019-.001.028-.002C6.963 3.002 6.981 3 7 3c.018 0 .035.002.053.004z", + fill: color + } + ) + ); +}); +var PopOutIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement("g", { clipPath: "url(#prefix__clip0_3002_502)", fill: color }, /* @__PURE__ */ React255.createElement("path", { d: "M10.5 12a.5.5 0 01.5.5v.504a1 1 0 01-1 1H8.5a.5.5 0 010-1H10V12.5a.5.5 0 01.5-.5zM.498 11a.5.5 0 01.5.5v1.502H2.5a.5.5 0 110 1H.998a1 1 0 01-1-1V11.5a.5.5 0 01.5-.5zM6.5 13a.5.5 0 010 1h-2a.5.5 0 010-1h2zM10.501 3.004h.006a.495.495 0 01.232.063c.04.022.08.049.115.083a.497.497 0 01.077.104.493.493 0 01.06.151l.003.038c.003.02.006.04.006.06V6.5a.5.5 0 01-1 0V4.71L6.857 7.855a.5.5 0 11-.707-.708l3.144-3.144L7.499 4a.5.5 0 01.002-1l3 .004z" }), /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M13.6.014a.5.5 0 01.4.49v10l-.01.1a.501.501 0 01-.39.39l-.1.01h-10a.5.5 0 01-.49-.4l-.01-.1v-10a.5.5 0 01.5-.5h10l.1.01zM4 10.004h9v-9H4v9z" + } + ), /* @__PURE__ */ React255.createElement("path", { d: "M.5 7a.5.5 0 01.5.5v2a.5.5 0 01-1 0v-2A.5.5 0 01.5 7zM1.5 3.002a.5.5 0 010 1H.998L1 5.499a.5.5 0 01-1 .002l-.002-1.498a1 1 0 011-1.001H1.5z" })), + /* @__PURE__ */ React255.createElement("defs", null, /* @__PURE__ */ React255.createElement("clipPath", { id: "prefix__clip0_3002_502" }, /* @__PURE__ */ React255.createElement("path", { fill: "#fff", d: "M0 0h14v14H0z" }))) + ); +}); +var ChevronUpIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M7.354 3.896l5.5 5.5a.5.5 0 01-.708.708L7 4.957l-5.146 5.147a.5.5 0 01-.708-.708l5.5-5.5a.5.5 0 01.708 0z", + fill: color + } + ) + ); +}); +var ChevronDownIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M1.146 4.604l5.5 5.5a.5.5 0 00.708 0l5.5-5.5a.5.5 0 00-.708-.708L7 9.043 1.854 3.896a.5.5 0 10-.708.708z", + fill: color + } + ) + ); +}); +var ChevronLeftIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M2.76 7.096a.498.498 0 00.136.258l5.5 5.5a.5.5 0 00.707-.708L3.958 7l5.147-5.146a.5.5 0 10-.708-.708l-5.5 5.5a.5.5 0 00-.137.45z", + fill: color + } + ) + ); +}); +var ChevronRightIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M11.104 7.354l-5.5 5.5a.5.5 0 01-.708-.708L10.043 7 4.896 1.854a.5.5 0 11.708-.708l5.5 5.5a.5.5 0 010 .708z", + fill: color + } + ) + ); +}); +var ChevronSmallUpIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M3.854 9.104a.5.5 0 11-.708-.708l3.5-3.5a.5.5 0 01.708 0l3.5 3.5a.5.5 0 01-.708.708L7 5.957 3.854 9.104z", + fill: color + } + ) + ); +}); +var ChevronSmallDownIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M3.854 4.896a.5.5 0 10-.708.708l3.5 3.5a.5.5 0 00.708 0l3.5-3.5a.5.5 0 00-.708-.708L7 8.043 3.854 4.896z", + fill: color + } + ) + ); +}); +var ChevronSmallLeftIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M9.104 10.146a.5.5 0 01-.708.708l-3.5-3.5a.5.5 0 010-.708l3.5-3.5a.5.5 0 11.708.708L5.957 7l3.147 3.146z", + fill: color + } + ) + ); +}); +var ChevronSmallRightIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M4.896 10.146a.5.5 0 00.708.708l3.5-3.5a.5.5 0 000-.708l-3.5-3.5a.5.5 0 10-.708.708L8.043 7l-3.147 3.146z", + fill: color + } + ) + ); +}); +var ArrowUpIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M11.854 4.646l-4.5-4.5a.5.5 0 00-.708 0l-4.5 4.5a.5.5 0 10.708.708L6.5 1.707V13.5a.5.5 0 001 0V1.707l3.646 3.647a.5.5 0 00.708-.708z", + fill: color + } + ) + ); +}); +var ArrowDownIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M7.5.5a.5.5 0 00-1 0v11.793L2.854 8.646a.5.5 0 10-.708.708l4.5 4.5a.5.5 0 00.351.146h.006c.127 0 .254-.05.35-.146l4.5-4.5a.5.5 0 00-.707-.708L7.5 12.293V.5z", + fill: color + } + ) + ); +}); +var ArrowLeftIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M5.354 2.146a.5.5 0 010 .708L1.707 6.5H13.5a.5.5 0 010 1H1.707l3.647 3.646a.5.5 0 01-.708.708l-4.5-4.5a.5.5 0 010-.708l4.5-4.5a.5.5 0 01.708 0z", + fill: color + } + ) + ); +}); +var ArrowRightIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M8.646 2.146a.5.5 0 01.708 0l4.5 4.5a.5.5 0 010 .708l-4.5 4.5a.5.5 0 01-.708-.708L12.293 7.5H.5a.5.5 0 010-1h11.793L8.646 2.854a.5.5 0 010-.708z", + fill: color + } + ) + ); +}); +var ArrowTopLeftIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M1.904 8.768V2.404a.5.5 0 01.5-.5h6.364a.5.5 0 110 1H3.61l8.339 8.339a.5.5 0 01-.707.707l-8.34-8.34v5.158a.5.5 0 01-1 0z", + fill: color + } + ) + ); +}); +var ArrowTopRightIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M12.096 8.768V2.404a.5.5 0 00-.5-.5H5.232a.5.5 0 100 1h5.157L2.05 11.243a.5.5 0 10.707.707l8.34-8.34v5.158a.5.5 0 101 0z", + fill: color + } + ) + ); +}); +var ArrowBottomLeftIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M1.904 5.232v6.364a.5.5 0 00.5.5h6.364a.5.5 0 000-1H3.61l8.339-8.339a.5.5 0 00-.707-.707l-8.34 8.34V5.231a.5.5 0 00-1 0z", + fill: color + } + ) + ); +}); +var ArrowBottomRightIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M12.096 5.232v6.364a.5.5 0 01-.5.5H5.232a.5.5 0 010-1h5.157L2.05 2.757a.5.5 0 01.707-.707l8.34 8.34V5.231a.5.5 0 111 0z", + fill: color + } + ) + ); +}); +var ArrowSolidUpIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M6.772 3.59c.126-.12.33-.12.456 0l5.677 5.387c.203.193.06.523-.228.523H1.323c-.287 0-.431-.33-.228-.523L6.772 3.59z", + fill: color + } + ) + ); +}); +var ArrowSolidDownIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M7.228 10.41a.335.335 0 01-.456 0L1.095 5.023c-.203-.193-.06-.523.228-.523h11.354c.287 0 .431.33.228.523L7.228 10.41z", + fill: color + } + ) + ); +}); +var ArrowSolidLeftIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M3.712 7.212a.3.3 0 010-.424l5.276-5.276a.3.3 0 01.512.212v10.552a.3.3 0 01-.512.212L3.712 7.212z", + fill: color + } + ) + ); +}); +var ArrowSolidRightIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M10.288 7.212a.3.3 0 000-.424L5.012 1.512a.3.3 0 00-.512.212v10.552a.3.3 0 00.512.212l5.276-5.276z", + fill: color + } + ) + ); +}); +var ExpandAltIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M7.354.146l4 4a.5.5 0 01-.708.708L7 1.207 3.354 4.854a.5.5 0 11-.708-.708l4-4a.5.5 0 01.708 0zM11.354 9.146a.5.5 0 010 .708l-4 4a.5.5 0 01-.708 0l-4-4a.5.5 0 11.708-.708L7 12.793l3.646-3.647a.5.5 0 01.708 0z", + fill: color + } + ) + ); +}); +var CollapseIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M3.354.146a.5.5 0 10-.708.708l4 4a.5.5 0 00.708 0l4-4a.5.5 0 00-.708-.708L7 3.793 3.354.146zM6.646 9.146a.5.5 0 01.708 0l4 4a.5.5 0 01-.708.708L7 10.207l-3.646 3.647a.5.5 0 01-.708-.708l4-4z", + fill: color + } + ) + ); +}); +var ExpandIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M1.5 1h2a.5.5 0 010 1h-.793l3.147 3.146a.5.5 0 11-.708.708L2 2.707V3.5a.5.5 0 01-1 0v-2a.5.5 0 01.5-.5zM10 1.5a.5.5 0 01.5-.5h2a.5.5 0 01.5.5v2a.5.5 0 01-1 0v-.793L8.854 5.854a.5.5 0 11-.708-.708L11.293 2H10.5a.5.5 0 01-.5-.5zM12.5 10a.5.5 0 01.5.5v2a.5.5 0 01-.5.5h-2a.5.5 0 010-1h.793L8.146 8.854a.5.5 0 11.708-.708L12 11.293V10.5a.5.5 0 01.5-.5zM2 11.293V10.5a.5.5 0 00-1 0v2a.5.5 0 00.5.5h2a.5.5 0 000-1h-.793l3.147-3.146a.5.5 0 10-.708-.708L2 11.293z", + fill: color + } + ) + ); +}); +var UnfoldIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M6.646.147l-1.5 1.5a.5.5 0 10.708.707l.646-.647V5a.5.5 0 001 0V1.707l.646.647a.5.5 0 10.708-.707l-1.5-1.5a.5.5 0 00-.708 0z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M1.309 4.038a.498.498 0 00-.16.106l-.005.005a.498.498 0 00.002.705L3.293 7 1.146 9.146A.498.498 0 001.5 10h3a.5.5 0 000-1H2.707l1.5-1.5h5.586l2.353 2.354a.5.5 0 00.708-.708L10.707 7l2.146-2.146.11-.545-.107.542A.499.499 0 0013 4.503v-.006a.5.5 0 00-.144-.348l-.005-.005A.498.498 0 0012.5 4h-3a.5.5 0 000 1h1.793l-1.5 1.5H4.207L2.707 5H4.5a.5.5 0 000-1h-3a.498.498 0 00-.191.038z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M7 8.5a.5.5 0 01.5.5v3.293l.646-.647a.5.5 0 01.708.708l-1.5 1.5a.5.5 0 01-.708 0l-1.5-1.5a.5.5 0 01.708-.708l.646.647V9a.5.5 0 01.5-.5zM9 9.5a.5.5 0 01.5-.5h3a.5.5 0 010 1h-3a.5.5 0 01-.5-.5z", + fill: color + } + ) + ); +}); +var TransferIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M10.646 2.646a.5.5 0 01.708 0l1.5 1.5a.5.5 0 010 .708l-1.5 1.5a.5.5 0 01-.708-.708L11.293 5H1.5a.5.5 0 010-1h9.793l-.647-.646a.5.5 0 010-.708zM3.354 8.354L2.707 9H12.5a.5.5 0 010 1H2.707l.647.646a.5.5 0 01-.708.708l-1.5-1.5a.5.5 0 010-.708l1.5-1.5a.5.5 0 11.708.708z", + fill: color + } + ) + ); +}); +var RedirectIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M1.5 1a.5.5 0 01.5.5V10a2 2 0 004 0V4a3 3 0 016 0v7.793l1.146-1.147a.5.5 0 01.708.708l-2 2a.5.5 0 01-.708 0l-2-2a.5.5 0 01.708-.708L11 11.793V4a2 2 0 10-4 0v6.002a3 3 0 01-6 0V1.5a.5.5 0 01.5-.5z", + fill: color + } + ) + ); +}); +var UndoIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M1.146 3.854a.5.5 0 010-.708l2-2a.5.5 0 11.708.708L2.707 3h6.295A4 4 0 019 11H3a.5.5 0 010-1h6a3 3 0 100-6H2.707l1.147 1.146a.5.5 0 11-.708.708l-2-2z", + fill: color + } + ) + ); +}); +var ReplyIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M4.354 2.146a.5.5 0 010 .708L1.707 5.5H9.5A4.5 4.5 0 0114 10v1.5a.5.5 0 01-1 0V10a3.5 3.5 0 00-3.5-3.5H1.707l2.647 2.646a.5.5 0 11-.708.708l-3.5-3.5a.5.5 0 010-.708l3.5-3.5a.5.5 0 01.708 0z", + fill: color + } + ) + ); +}); +var SyncIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M5.5 1A.5.5 0 005 .5H2a.5.5 0 000 1h1.535a6.502 6.502 0 002.383 11.91.5.5 0 10.165-.986A5.502 5.502 0 014.5 2.1V4a.5.5 0 001 0V1.353a.5.5 0 000-.023V1zM7.507 1a.5.5 0 01.576-.41 6.502 6.502 0 012.383 11.91H12a.5.5 0 010 1H9a.5.5 0 01-.5-.5v-3a.5.5 0 011 0v1.9A5.5 5.5 0 007.917 1.576.5.5 0 017.507 1z", + fill: color + } + ) + ); +}); +var UploadIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M8.646 5.854L7.5 4.707V10.5a.5.5 0 01-1 0V4.707L5.354 5.854a.5.5 0 11-.708-.708l2-2a.5.5 0 01.708 0l2 2a.5.5 0 11-.708.708z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M14 7A7 7 0 110 7a7 7 0 0114 0zm-1 0A6 6 0 111 7a6 6 0 0112 0z", + fill: color + } + ) + ); +}); +var DownloadIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M5.354 8.146L6.5 9.293V3.5a.5.5 0 011 0v5.793l1.146-1.147a.5.5 0 11.708.708l-2 2a.5.5 0 01-.708 0l-2-2a.5.5 0 11.708-.708z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M0 7a7 7 0 1114 0A7 7 0 010 7zm1 0a6 6 0 1112 0A6 6 0 011 7z", + fill: color + } + ) + ); +}); +var BackIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M5.854 5.354L4.707 6.5H10.5a.5.5 0 010 1H4.707l1.147 1.146a.5.5 0 11-.708.708l-2-2a.5.5 0 010-.708l2-2a.5.5 0 11.708.708z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M7 0a7 7 0 110 14A7 7 0 017 0zm0 1a6 6 0 110 12A6 6 0 017 1z", + fill: color + } + ) + ); +}); +var ProceedIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M3.5 6.5h5.793L8.146 5.354a.5.5 0 11.708-.708l2 2a.5.5 0 010 .708l-2 2a.5.5 0 11-.708-.708L9.293 7.5H3.5a.5.5 0 010-1z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M7 14A7 7 0 117 0a7 7 0 010 14zm0-1A6 6 0 117 1a6 6 0 010 12z", + fill: color + } + ) + ); +}); +var RefreshIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M7.092.5H7a6.5 6.5 0 106.41 7.583.5.5 0 10-.986-.166A5.495 5.495 0 017 12.5a5.5 5.5 0 010-11h.006a5.5 5.5 0 014.894 3H10a.5.5 0 000 1h3a.5.5 0 00.5-.5V2a.5.5 0 00-1 0v1.535A6.495 6.495 0 007.092.5z", + fill: color + } + ) + ); +}); +var GlobeIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M14 7A7 7 0 100 7a7 7 0 0014 0zm-6.535 5.738c-.233.23-.389.262-.465.262-.076 0-.232-.032-.465-.262-.238-.234-.497-.623-.737-1.182-.434-1.012-.738-2.433-.79-4.056h3.984c-.052 1.623-.356 3.043-.79 4.056-.24.56-.5.948-.737 1.182zM8.992 6.5H5.008c.052-1.623.356-3.044.79-4.056.24-.56.5-.948.737-1.182C6.768 1.032 6.924 1 7 1c.076 0 .232.032.465.262.238.234.497.623.737 1.182.434 1.012.738 2.433.79 4.056zm1 1c-.065 2.176-.558 4.078-1.282 5.253A6.005 6.005 0 0012.98 7.5H9.992zm2.987-1H9.992c-.065-2.176-.558-4.078-1.282-5.253A6.005 6.005 0 0112.98 6.5zm-8.971 0c.065-2.176.558-4.078 1.282-5.253A6.005 6.005 0 001.02 6.5h2.988zm-2.987 1a6.005 6.005 0 004.27 5.253C4.565 11.578 4.072 9.676 4.007 7.5H1.02z", + fill: color + } + ) + ); +}); +var CompassIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M10.087 3.397L5.95 5.793a.374.374 0 00-.109.095.377.377 0 00-.036.052l-2.407 4.147a.374.374 0 00-.004.384c.104.179.334.24.513.136l4.142-2.404a.373.373 0 00.148-.143l2.406-4.146a.373.373 0 00-.037-.443.373.373 0 00-.478-.074zM4.75 9.25l2.847-1.652-1.195-1.195L4.75 9.25z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M14 7A7 7 0 110 7a7 7 0 0114 0zm-1 0A6 6 0 111 7a6 6 0 0112 0z", + fill: color + } + ) + ); +}); +var LocationIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M0 7a7 7 0 1114 0A7 7 0 010 7zm6.5 3.5v2.48A6.001 6.001 0 011.02 7.5H3.5a.5.5 0 000-1H1.02A6.001 6.001 0 016.5 1.02V3.5a.5.5 0 001 0V1.02a6.001 6.001 0 015.48 5.48H10.5a.5.5 0 000 1h2.48a6.002 6.002 0 01-5.48 5.48V10.5a.5.5 0 00-1 0z", + fill: color + } + ) + ); +}); +var PinIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M9 5a2 2 0 11-4 0 2 2 0 014 0zM8 5a1 1 0 11-2 0 1 1 0 012 0z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M12 5A5 5 0 002 5c0 2.633 2.273 6.154 4.65 8.643.192.2.508.2.7 0C9.726 11.153 12 7.633 12 5zM7 1a4 4 0 014 4c0 1.062-.471 2.42-1.303 3.88-.729 1.282-1.69 2.562-2.697 3.67-1.008-1.108-1.968-2.388-2.697-3.67C3.47 7.42 3 6.063 3 5a4 4 0 014-4z", + fill: color + } + ) + ); +}); +var TimeIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M7 2a.5.5 0 01.5.5v4H10a.5.5 0 010 1H7a.5.5 0 01-.5-.5V2.5A.5.5 0 017 2z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M7 14A7 7 0 107 0a7 7 0 000 14zm0-1A6 6 0 107 1a6 6 0 000 12z", + fill: color + } + ) + ); +}); +var DashboardIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M9.79 4.093a.5.5 0 01.117.698L7.91 7.586a1 1 0 11-.814-.581l1.997-2.796a.5.5 0 01.698-.116z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M2.069 12.968a7 7 0 119.863 0A12.962 12.962 0 007 12c-1.746 0-3.41.344-4.931.968zm9.582-1.177a6 6 0 10-9.301 0A13.98 13.98 0 017 11c1.629 0 3.194.279 4.65.791z", + fill: color + } + ) + ); +}); +var TimerIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement("path", { d: "M7.5 4.5a.5.5 0 00-1 0v2.634a1 1 0 101 0V4.5z", fill: color }), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M5.5.5A.5.5 0 016 0h2a.5.5 0 010 1h-.5v1.02a5.973 5.973 0 013.374 1.398l.772-.772a.5.5 0 01.708.708l-.772.772A6 6 0 116.5 2.02V1H6a.5.5 0 01-.5-.5zM7 3a5 5 0 100 10A5 5 0 007 3z", + fill: color + } + ) + ); +}); +var HomeIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M7.354 1.146l5.5 5.5a.5.5 0 01-.708.708L12 7.207V12.5a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V9H6v3.5a.5.5 0 01-.5.5h-3a.5.5 0 01-.5-.5V7.207l-.146.147a.5.5 0 11-.708-.708l1-1 4.5-4.5a.5.5 0 01.708 0zM3 6.207V12h2V8.5a.5.5 0 01.5-.5h3a.5.5 0 01.5.5V12h2V6.207l-4-4-4 4z", + fill: color + } + ) + ); +}); +var AdminIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M1.213 4.094a.5.5 0 01.056-.034l5.484-2.995a.498.498 0 01.494 0L12.73 4.06a.507.507 0 01.266.389.498.498 0 01-.507.555H1.51a.5.5 0 01-.297-.91zm2.246-.09h7.082L7 2.07 3.459 4.004z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M4 6a.5.5 0 00-1 0v5a.5.5 0 001 0V6zM11 6a.5.5 0 00-1 0v5a.5.5 0 001 0V6zM5.75 5.5a.5.5 0 01.5.5v5a.5.5 0 01-1 0V6a.5.5 0 01.5-.5zM8.75 6a.5.5 0 00-1 0v5a.5.5 0 001 0V6zM1.5 12.504a.5.5 0 01.5-.5h10a.5.5 0 010 1H2a.5.5 0 01-.5-.5z", + fill: color + } + ) + ); +}); +var DirectionIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement("g", { clipPath: "url(#prefix__clip0_1107_3594)" }, /* @__PURE__ */ React255.createElement( + "path", + { + d: "M11.451.537l.01 12.922L7.61 8.946a1.078 1.078 0 00-.731-.374L.965 8.087 11.45.537z", + stroke: color, + strokeWidth: 1.077 + } + )), + /* @__PURE__ */ React255.createElement("defs", null, /* @__PURE__ */ React255.createElement("clipPath", { id: "prefix__clip0_1107_3594" }, /* @__PURE__ */ React255.createElement("path", { fill: "#fff", d: "M0 0h14v14H0z" }))) + ); +}); +var UserIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M14 7A7 7 0 110 7a7 7 0 0114 0zM2.671 11.155c.696-1.006 2.602-1.816 3.194-1.91.226-.036.232-.658.232-.658s-.665-.658-.81-1.544c-.39 0-.63-.94-.241-1.272a2.578 2.578 0 00-.012-.13c-.066-.607-.28-2.606 1.965-2.606 2.246 0 2.031 2 1.966 2.606l-.012.13c.39.331.149 1.272-.24 1.272-.146.886-.81 1.544-.81 1.544s.004.622.23.658c.593.094 2.5.904 3.195 1.91a6 6 0 10-8.657 0z", + fill: color + } + ) + ); +}); +var UserAltIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M7.275 13.16a11.388 11.388 0 005.175-1.232v-.25c0-1.566-3.237-2.994-4.104-3.132-.27-.043-.276-.783-.276-.783s.791-.783.964-1.836c.463 0 .75-1.119.286-1.513C9.34 4 9.916 1.16 6.997 1.16c-2.92 0-2.343 2.84-2.324 3.254-.463.394-.177 1.513.287 1.513.172 1.053.963 1.836.963 1.836s-.006.74-.275.783c-.858.136-4.036 1.536-4.103 3.082a11.388 11.388 0 005.73 1.532z", + fill: color + } + ) + ); +}); +var UserAddIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M1.183 11.906a10.645 10.645 0 01-1.181-.589c.062-1.439 3.02-2.74 3.818-2.868.25-.04.256-.728.256-.728s-.736-.729-.896-1.709c-.432 0-.698-1.041-.267-1.408A2.853 2.853 0 002.9 4.46c-.072-.672-.31-2.884 2.175-2.884 2.486 0 2.248 2.212 2.176 2.884-.007.062-.012.112-.014.144.432.367.165 1.408-.266 1.408-.16.98-.896 1.709-.896 1.709s.005.688.256.728c.807.129 3.82 1.457 3.82 2.915v.233a10.598 10.598 0 01-4.816 1.146c-1.441 0-2.838-.282-4.152-.837zM11.5 2.16a.5.5 0 01.5.5v1.5h1.5a.5.5 0 010 1H12v1.5a.5.5 0 01-1 0v-1.5H9.5a.5.5 0 110-1H11v-1.5a.5.5 0 01.5-.5z", + fill: color + } + ) + ); +}); +var UsersIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M9.21 11.623a10.586 10.586 0 01-4.031.787A10.585 10.585 0 010 11.07c.06-1.354 2.933-2.578 3.708-2.697.243-.038.249-.685.249-.685s-.715-.685-.87-1.607c-.42 0-.679-.979-.26-1.323a2.589 2.589 0 00-.013-.136c-.07-.632-.3-2.712 2.113-2.712 2.414 0 2.183 2.08 2.113 2.712-.007.059-.012.105-.013.136.419.344.16 1.323-.259 1.323-.156.922-.87 1.607-.87 1.607s.005.647.248.685c.784.12 3.71 1.37 3.71 2.74v.22c-.212.103-.427.2-.646.29z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M8.81 8.417a9.643 9.643 0 00-.736-.398c.61-.42 1.396-.71 1.7-.757.167-.026.171-.471.171-.471s-.491-.471-.598-1.104c-.288 0-.466-.674-.178-.91-.001-.022-.005-.053-.01-.094-.048-.434-.206-1.864 1.453-1.864 1.66 0 1.5 1.43 1.453 1.864l-.01.094c.289.236.11.91-.178.91-.107.633-.598 1.104-.598 1.104s.004.445.171.47c.539.084 2.55.942 2.55 1.884v.628a10.604 10.604 0 01-3.302.553 2.974 2.974 0 00-.576-.879c-.375-.408-.853-.754-1.312-1.03z", + fill: color + } + ) + ); +}); +var ProfileIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M9.106 7.354c-.627.265-1.295.4-1.983.4a5.062 5.062 0 01-2.547-.681c.03-.688 1.443-1.31 1.824-1.37.12-.02.122-.348.122-.348s-.351-.348-.428-.816c-.206 0-.333-.498-.127-.673 0-.016-.003-.04-.007-.07C5.926 3.477 5.812 2.42 7 2.42c1.187 0 1.073 1.057 1.039 1.378l-.007.069c.207.175.08.673-.127.673-.076.468-.428.816-.428.816s.003.329.122.348c.386.06 1.825.696 1.825 1.392v.111c-.104.053-.21.102-.318.148zM3.75 11.25A.25.25 0 014 11h6a.25.25 0 110 .5H4a.25.25 0 01-.25-.25zM4 9a.25.25 0 000 .5h6a.25.25 0 100-.5H4z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M1 .5a.5.5 0 01.5-.5h11a.5.5 0 01.5.5v13a.5.5 0 01-.5.5h-11a.5.5 0 01-.5-.5V.5zM2 13V1h10v12H2z", + fill: color + } + ) + ); +}); +var FaceHappyIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M3.968 8.75a.5.5 0 00-.866.5A4.498 4.498 0 007 11.5c1.666 0 3.12-.906 3.898-2.25a.5.5 0 10-.866-.5A3.498 3.498 0 017 10.5a3.498 3.498 0 01-3.032-1.75zM5.5 5a1 1 0 11-2 0 1 1 0 012 0zM9.5 6a1 1 0 100-2 1 1 0 000 2z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M14 7A7 7 0 110 7a7 7 0 0114 0zm-1 0A6 6 0 111 7a6 6 0 0112 0z", + fill: color + } + ) + ); +}); +var FaceNeutralIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M4.5 9a.5.5 0 000 1h5a.5.5 0 000-1h-5zM5.5 5a1 1 0 11-2 0 1 1 0 012 0zM9.5 6a1 1 0 100-2 1 1 0 000 2z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M14 7A7 7 0 110 7a7 7 0 0114 0zm-1 0A6 6 0 111 7a6 6 0 0112 0z", + fill: color + } + ) + ); +}); +var FaceSadIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M3.968 10.25a.5.5 0 01-.866-.5A4.498 4.498 0 017 7.5c1.666 0 3.12.906 3.898 2.25a.5.5 0 11-.866.5A3.498 3.498 0 007 8.5a3.498 3.498 0 00-3.032 1.75zM5.5 5a1 1 0 11-2 0 1 1 0 012 0zM9.5 6a1 1 0 100-2 1 1 0 000 2z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M14 7A7 7 0 110 7a7 7 0 0114 0zm-1 0A6 6 0 111 7a6 6 0 0112 0z", + fill: color + } + ) + ); +}); +var AccessibilityIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + d: "M3.526 4.842a.5.5 0 01.632-.316l2.051.684a2.5 2.5 0 001.582 0l2.05-.684a.5.5 0 01.317.948l-2.453.818a.3.3 0 00-.205.285v.243a4.5 4.5 0 00.475 2.012l.972 1.944a.5.5 0 11-.894.448L7 9.118l-1.053 2.106a.5.5 0 11-.894-.447l.972-1.945A4.5 4.5 0 006.5 6.82v-.243a.3.3 0 00-.205-.285l-2.453-.818a.5.5 0 01-.316-.632z", + fill: color + } + ), + /* @__PURE__ */ React255.createElement("path", { d: "M7 4.5a1 1 0 100-2 1 1 0 000 2z", fill: color }), + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M7 14A7 7 0 107 0a7 7 0 000 14zm0-1A6 6 0 107 1a6 6 0 000 12z", + fill: color + } + ) + ); +}); +var AccessibilityAltIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M7 14A7 7 0 107 0a7 7 0 000 14zM8 3.5a1 1 0 11-2 0 1 1 0 012 0zM3.526 4.842a.5.5 0 01.632-.316l2.051.684a2.5 2.5 0 001.582 0l2.05-.684a.5.5 0 01.317.948l-2.453.818a.3.3 0 00-.205.285v.243a4.5 4.5 0 00.475 2.012l.972 1.944a.5.5 0 11-.894.448L7 9.118l-1.053 2.106a.5.5 0 11-.894-.447l.972-1.945A4.5 4.5 0 006.5 6.82v-.243a.3.3 0 00-.205-.285l-2.453-.818a.5.5 0 01-.316-.632z", + fill: color + } + ) + ); +}); +var AccessibilityIgnoredIcon = /* @__PURE__ */ React255.forwardRef(({ color = "currentColor", size = 14, ...props }, forwardedRef) => { + return /* @__PURE__ */ React255.createElement( + "svg", + { + width: size, + height: size, + viewBox: "0 0 14 14", + fill: "none", + xmlns: "http://www.w3.org/2000/svg", + ref: forwardedRef, + ...props + }, + /* @__PURE__ */ React255.createElement("g", { clipPath: "url(#prefix__clip0_2359_558)", fill: color }, /* @__PURE__ */ React255.createElement("path", { d: "M7.636 13.972a7 7 0 116.335-6.335c-.28-.34-.609-.637-.976-.883a6 6 0 10-6.24 6.241c.245.367.542.696.881.977z" }), /* @__PURE__ */ React255.createElement("path", { d: "M7.511 7.136a4.489 4.489 0 00-1.478 3.915l-.086.173a.5.5 0 11-.894-.447l.972-1.945A4.5 4.5 0 006.5 6.82v-.243a.3.3 0 00-.205-.285l-2.453-.818a.5.5 0 01.316-.948l2.051.684a2.5 2.5 0 001.582 0l2.05-.684a.5.5 0 01.317.948l-2.453.818a.3.3 0 00-.205.285v.243c0 .105.004.21.011.316z" }), /* @__PURE__ */ React255.createElement("path", { d: "M8 3.5a1 1 0 11-2 0 1 1 0 012 0z" }), /* @__PURE__ */ React255.createElement( + "path", + { + fillRule: "evenodd", + clipRule: "evenodd", + d: "M14 10.5a3.5 3.5 0 11-7 0 3.5 3.5 0 017 0zm-5.5 0A.5.5 0 019 10h3a.5.5 0 010 1H9a.5.5 0 01-.5-.5z" + } + )), + /* @__PURE__ */ React255.createElement("defs", null, /* @__PURE__ */ React255.createElement("clipPath", { id: "prefix__clip0_2359_558" }, /* @__PURE__ */ React255.createElement("path", { fill: "#fff", d: "M0 0h14v14H0z" }))) + ); +}); + +export { AccessibilityAltIcon, AccessibilityIcon, AccessibilityIgnoredIcon, AddIcon, AdminIcon, AlertAltIcon, AlertIcon, AlignLeftIcon, AlignRightIcon, AppleIcon, ArrowBottomLeftIcon, ArrowBottomRightIcon, ArrowDownIcon, ArrowLeftIcon, ArrowRightIcon, ArrowSolidDownIcon, ArrowSolidLeftIcon, ArrowSolidRightIcon, ArrowSolidUpIcon, ArrowTopLeftIcon, ArrowTopRightIcon, ArrowUpIcon, AzureDevOpsIcon, BackIcon, BasketIcon, BatchAcceptIcon, BatchDenyIcon, BeakerIcon, BellIcon, BitbucketIcon, BoldIcon, BookIcon, BookmarkHollowIcon, BookmarkIcon, BottomBarIcon, BottomBarToggleIcon, BoxIcon, BranchIcon, BrowserIcon, BugIcon, ButtonIcon, CPUIcon, CalendarIcon, CameraIcon, CameraStabilizeIcon, CategoryIcon, CertificateIcon, ChangedIcon, ChatIcon, CheckIcon, ChecklistIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, ChevronSmallDownIcon, ChevronSmallLeftIcon, ChevronSmallRightIcon, ChevronSmallUpIcon, ChevronUpIcon, ChromaticIcon, ChromeIcon, CircleHollowIcon, CircleIcon, ClearIcon, CloseAltIcon, CloseIcon, CloudHollowIcon, CloudIcon, CogIcon, CollapseIcon, CommandIcon, CommentAddIcon, CommentIcon, CommentsIcon, CommitIcon, CompassIcon, ComponentDrivenIcon, ComponentIcon, ContrastIcon, ContrastIgnoredIcon, ControlsIcon, CopyIcon, CreditIcon, CrossIcon, DashboardIcon, DatabaseIcon, DeleteIcon, DiamondIcon, DirectionIcon, DiscordIcon, DocChartIcon, DocListIcon, DocumentIcon, DownloadIcon, DragIcon, EditIcon, EditorIcon, EllipsisIcon, EmailIcon, ExpandAltIcon, ExpandIcon, EyeCloseIcon, EyeIcon, FaceHappyIcon, FaceNeutralIcon, FaceSadIcon, FacebookIcon, FailedIcon, FastForwardIcon, FigmaIcon, FilesIcon, FilterIcon, FlagIcon, FolderIcon, FormIcon, GDriveIcon, GiftIcon, GithubIcon, GitlabIcon, GlobeIcon, GoogleIcon, GraphBarIcon, GraphLineIcon, GraphqlIcon, GridAltIcon, GridIcon, GrowIcon, HeartHollowIcon, HeartIcon, HomeIcon, HourglassIcon, InfoIcon, ItalicIcon, JumpToIcon, KeyIcon, LightningIcon, LightningOffIcon, LinkBrokenIcon, LinkIcon, LinkedinIcon, LinuxIcon, ListOrderedIcon, ListUnorderedIcon, LocationIcon, LockIcon, MarkdownIcon, MarkupIcon, MediumIcon, MemoryIcon, MenuIcon, MergeIcon, MirrorIcon, MobileIcon, MoonIcon, NutIcon, OutboxIcon, OutlineIcon, PaintBrushAltIcon, PaintBrushIcon, PaperClipIcon, ParagraphIcon, PassedIcon, PhoneIcon, PhotoDragIcon, PhotoIcon, PhotoStabilizeIcon, PinAltIcon, PinIcon, PlayAllHollowIcon, PlayBackIcon, PlayHollowIcon, PlayIcon, PlayNextIcon, PlusIcon, PointerDefaultIcon, PointerHandIcon, PopOutIcon, PowerIcon, PrintIcon, ProceedIcon, ProfileIcon, PullRequestIcon, QuestionIcon, RSSIcon, RedirectIcon, ReduxIcon, RefreshIcon, ReplyIcon, RepoIcon, RequestChangeIcon, RewindIcon, RulerIcon, SaveIcon, SearchIcon, ShareAltIcon, ShareIcon, ShieldIcon, SideBySideIcon, SidebarAltIcon, SidebarAltToggleIcon, SidebarIcon, SidebarToggleIcon, SortDownIcon, SortUpIcon, SpeakerIcon, StackedIcon, StarHollowIcon, StarIcon, StatusFailIcon, StatusIcon, StatusNewIcon, StatusPassIcon, StatusWarnIcon, StickerIcon, StopAltHollowIcon, StopAltIcon, StopIcon, StorybookIcon, StructureIcon, SubtractIcon, SunIcon, SupportIcon, SweepIcon, SwitchAltIcon, SyncIcon, TabletIcon, ThumbsUpIcon, TimeIcon, TimerIcon, TransferIcon, TrashIcon, TwitterIcon, TypeIcon, UbuntuIcon, UndoIcon, UnfoldIcon, UnlockIcon, UnpinIcon, UploadIcon, UserAddIcon, UserAltIcon, UserIcon, UsersIcon, VSCodeIcon, VerifiedIcon, VideoIcon, WandIcon, WatchIcon, WindowsIcon, WrenchIcon, XIcon, YoutubeIcon, ZoomIcon, ZoomOutIcon, ZoomResetIcon, iconList }; diff --git a/tools/ui/node_modules/@storybook/icons/dist/public/cover.jpg b/tools/ui/node_modules/@storybook/icons/dist/public/cover.jpg new file mode 100644 index 0000000000000000000000000000000000000000..0b04f6d62e8ba0e3de16f6162a205b3e59421418 --- /dev/null +++ b/tools/ui/node_modules/@storybook/icons/dist/public/cover.jpg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:77501af33ecbd04940a9067f44608c165add65d4e7d677550a7179375abd45a9 +size 52498 diff --git a/tools/ui/node_modules/@storybook/icons/dist/public/logo.png b/tools/ui/node_modules/@storybook/icons/dist/public/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..e801adf02c4b773c2e1d74f5fc5e687e9eac1701 --- /dev/null +++ b/tools/ui/node_modules/@storybook/icons/dist/public/logo.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:fe93bf275cd589c3a980cef9b5b162db41bd8c278f6cd4921756301206234a7a +size 3071 diff --git a/tools/ui/node_modules/@storybook/icons/package.json b/tools/ui/node_modules/@storybook/icons/package.json new file mode 100644 index 0000000000000000000000000000000000000000..ff8daf3607c1cf92053d5ffb2683a8aee8c2b04f --- /dev/null +++ b/tools/ui/node_modules/@storybook/icons/package.json @@ -0,0 +1,87 @@ +{ + "name": "@storybook/icons", + "version": "2.0.2", + "description": "Icon library from the Storybook team", + "homepage": "https://github.com/storybookjs/icons#readme", + "bugs": { + "url": "https://github.com/storybookjs/icons/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/storybookjs/icons.git" + }, + "license": "MIT", + "author": { + "name": "cdedreuille", + "email": "charles@chromatic.com" + }, + "sideEffects": false, + "type": "module", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + } + }, + "files": [ + "dist" + ], + "lint-staged": { + "*": "prettier --write" + }, + "devDependencies": { + "@changesets/changelog-github": "^0.5.1", + "@changesets/cli": "^2.29.6", + "@chromatic-com/storybook": "^4.1.1", + "@storybook/addon-a11y": "10.2.0-beta.4", + "@storybook/addon-docs": "10.2.0-beta.4", + "@storybook/react-vite": "10.2.0-beta.4", + "@svgr/core": "5.5.0", + "@svgr/plugin-prettier": "5.5.0", + "@svgr/plugin-svgo": "5.5.0", + "@types/node": "^22.12.0", + "@types/react": "^18.2.14", + "@types/react-dom": "^18.0.11", + "@vitejs/plugin-react": "^5.1.0", + "axios": "^1.13.2", + "chromatic": "^13.3.3", + "concurrently": "^9.2.1", + "dotenv": "^17.2.3", + "figma-api-exporter": "0.0.2", + "figma-js": "1.16.0", + "figma-transformer": "2.1.0", + "jiti": "^2.6.1", + "lint-staged": "^16.2.6", + "oxlint": "^1.28.0", + "picocolors": "^1.1.1", + "pkg-pr-new": "^0.0.57", + "prettier": "^3.6.2", + "react": "^18.2.0", + "react-dom": "^18.2.0", + "storybook": "10.2.0-beta.4", + "tsup": "^8.5.0", + "typescript": "^5.9.3", + "vite": "^7.2.2" + }, + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", + "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + }, + "publishConfig": { + "access": "public", + "registry": "https://registry.npmjs.org" + }, + "scripts": { + "build": "tsup --onSuccess \"cp -a public/. dist/public\"", + "build-storybook": "storybook build", + "changeset": "changeset", + "chromatic": "npx chromatic --project-token=chpt_d0c5927e55681dd", + "dev": "concurrently -n \"Build,SB\" \"pnpm build --watch\" \"pnpm storybook\" ", + "format": "prettier --write .", + "generate-icons": "jiti ./src/generate.ts", + "lint": "oxlint", + "release": "pnpm build && pnpm changeset publish", + "storybook": "storybook dev -p 6006", + "type-check": "tsc" + } +} \ No newline at end of file diff --git a/tools/ui/node_modules/@storybook/mcp/LICENSE b/tools/ui/node_modules/@storybook/mcp/LICENSE new file mode 100644 index 0000000000000000000000000000000000000000..5544b96bfb3071ee54113447ccd6ab2e570afad9 --- /dev/null +++ b/tools/ui/node_modules/@storybook/mcp/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Storybook contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/tools/ui/node_modules/@storybook/mcp/README.md b/tools/ui/node_modules/@storybook/mcp/README.md new file mode 100644 index 0000000000000000000000000000000000000000..63d4d4f7339d7b8a22f0ec82ad7afcc0304bbadd --- /dev/null +++ b/tools/ui/node_modules/@storybook/mcp/README.md @@ -0,0 +1,364 @@ +# Storybook MCP + +Reusable MCP package for Storybook component and docs knowledge. + +Learn more about Storybook at [storybook.js.org](https://storybook.js.org/?ref=readme). + +## Self-hosting `@storybook/mcp` + +### Prerequisites + +- Node.js 20+ +- A [manifests](https://storybook.js.org/docs/next/ai/manifests) source containing: + - `components.json` (required) + - `docs.json` (optional) + +### Example implementation + +Reference implementation: [apps/self-host-mcp/server.ts](../../apps/self-host-mcp/server.ts) + +The example repo demonstrates self-hosting patterns for both a Node.js process and a Netlify Function. + +#### Minimal implementation + +```ts +import { createStorybookMcpHandler } from '@storybook/mcp'; + +const storybookMcpHandler = await createStorybookMcpHandler(); + +export async function handleRequest(request: Request): Promise { + if (new URL(request.url).pathname === '/mcp') { + return storybookMcpHandler(request); + } + + return new Response('Not found', { status: 404 }); +} +``` + +#### With custom manifest source + +Use `manifestProvider` when your manifests are not available from the same origin/path layout: + +```ts +const storybookMcpHandler = await createStorybookMcpHandler({ + manifestProvider: async (_request, path) => { + return asyncReadManifestFromSomewhere(path); + }, +}); +``` + +### API reference + +#### `createStorybookMcpHandler` + +Type: + +```ts +(options?: StorybookMcpHandlerOptions) => Promise; + +type Handler = (req: Request, context?: StorybookContext) => Promise; +``` + +Creates and configures an MCP HTTP handler with all built-in docs tools registered. + +##### Parameters + +###### `options` + +Type: [`StorybookMcpHandlerOptions`](#handler-options-and-request-context) + +Default: `{}` + +Server-level configuration. The handler uses this at creation time and as a fallback for per-request context. + +##### Returns + +Type: `Promise` + +A fetch-compatible request handler for your `/mcp` endpoint. + +##### Behavior + +- Registers these MCP tools: + - [`list-all-documentation`](https://storybook.js.org/docs/next/ai/mcp/overview/#list-all-documentation) + - [`get-documentation`](https://storybook.js.org/docs/next/ai/mcp/overview/#get-documentation) + - [`get-documentation-for-story`](https://storybook.js.org/docs/next/ai/mcp/overview/#get-documentation-for-story) +- Uses HTTP transport from [`@tmcp/transport-http`](https://github.com/paoloricciuti/tmcp/). +- For each request, the handler always passes the current `Request` as `context.request`. +- Per-request `context` overrides handler-level `options` for: + - [`manifestProvider`](#manifestprovider) + - [`onListAllDocumentation`](#onlistalldocumentation) + - [`onGetDocumentation`](#ongetdocumentation) + +> Note: [`onSessionInitialize`](#handler-options-and-request-context) can only be set at handler creation time (in `options`). + +##### Example + +```ts +import { createStorybookMcpHandler } from '@storybook/mcp'; + +const mcp = await createStorybookMcpHandler({ + manifestProvider: async (_request, path) => { + return await fetchManifest(path); + }, +}); + +export async function handleRequest(request: Request) { + if (new URL(request.url).pathname !== '/mcp') { + return new Response('Not found', { status: 404 }); + } + + return mcp(request); +} +``` + +#### Handler options and request context + +`@storybook/mcp` uses the same core fields in two places: + +- Handler creation (`createStorybookMcpHandler(options)`) +- Per-request override (`handler(request, context)`) + +Type: + +```ts +type StorybookContext = { + request?: Request; + manifestProvider?: ( + request: Request | undefined, + path: string, + source?: Source, + ) => Promise; + sources?: Source[]; + onListAllDocumentation?: (params: { + context: StorybookContext; + manifests: AllManifests; + resultText: string; + sources?: SourceManifests[]; + }) => void | Promise; + onGetDocumentation?: ( + params: + | { + context: StorybookContext; + input: { id: string; storybookId?: string }; + foundDocumentation: ComponentManifest | Doc; + resultText: string; + } + | { + context: StorybookContext; + input: { id: string; storybookId?: string }; + }, + ) => void | Promise; +}; + +type StorybookMcpHandlerOptions = StorybookContext & { + onSessionInitialize?: (initializeRequestParams: InitializeRequestParams) => void | Promise; +}; +``` + +> [!NOTE] +> `onSessionInitialize` is only used when provided at handler creation time (`createStorybookMcpHandler(options)`). It is ignored in per-request `context`. +> +> `InitializeRequestParams` is the [`tmcp`](https://github.com/paoloricciuti/tmcp/) initialize payload type, and its exact structure may change in patch versions. Prefer treating it as an opaque protocol payload unless you need specific fields. + +##### `manifestProvider` + +Type: + +```ts +(request: Request | undefined, path: string, source?: Source) => Promise; +``` + +Primary extension point for production setups. + +Use this when manifests are not available at the default same-origin paths. Your function returns the raw JSON string for each requested manifest path. + +For a real customization example (switching between HTTP and filesystem-backed manifest loading), see the [Example implementation](#example-implementation) section above. + +Manifest paths requested by built-in tools: + +- `./manifests/components.json` (required) +- `./manifests/docs.json` (optional) + +##### `request` + +Type: `Request` + +The incoming HTTP request for the current call, as a Web Fetch API (`WHATWG`) `Request`. + +This is **not** a Node.js `http.IncomingMessage`. In Node runtimes, pass a fetch-compatible `Request` (for example, Node's global `Request` from Undici in modern Node versions), or convert your server's native request object before calling the handler. + +`createStorybookMcpHandler` automatically sets this field when you invoke the returned handler with `(request, context?)`. + +##### `onListAllDocumentation` + +Type: + +```ts +(params: { + context: StorybookContext; + manifests: AllManifests; + resultText: string; + sources?: SourceManifests[]; +}) => void | Promise +``` + +Optional callback after `list-all-documentation` resolves successfully. + +##### `onGetDocumentation` + +Type: + +```ts +( + params: + | { + context: StorybookContext; + input: { id: string; storybookId?: string }; + foundDocumentation: ComponentManifest | Doc; + resultText: string; + } + | { + context: StorybookContext; + input: { id: string; storybookId?: string }; + }, +) => void | Promise +``` + +Optional callback after `get-documentation` runs: + +- When a component/docs entry is found, receives `foundDocumentation` and `resultText`. +- When not found, receives only `context` and `input`. + +##### `sources` + +Type: `Source[]` + +Optional multi-source configuration for composing multiple Storybook MCP sources. This is supported but relatively uncommon for most user setups. + +#### `Source` + +Type: + +```ts +type Source = { + id: string; + title: string; + url?: string; +}; +``` + +Represents one Storybook source in multi-source mode. + +#### `SourceManifests` + +Type: + +```ts +type SourceManifests = { + source: Source; + componentManifest: ComponentManifestMap; + docsManifest?: DocsManifestMap; + error?: string; + notice?: RequiresOwnMcpNotice; +}; +``` + +Represents fetched manifests, an error, or non-error routing guidance for a single source. + +#### `RequiresOwnMcpNotice` + +Type: + +```ts +type RequiresOwnMcpNotice = { + kind: 'requires-own-mcp'; + endpoint: string; +}; +``` + +Indicates that a composed Storybook source cannot be read through the local MCP proxy and should be accessed through its own MCP endpoint instead. + +#### Tool registration exports + +Use these when you want to build your own [`tmcp`](https://github.com/paoloricciuti/tmcp/) server instead of using `createStorybookMcpHandler`, while still reusing Storybook's docs tools. + +This approach is useful when you need to: + +- register Storybook tools alongside your own custom tools, +- customize transport/session setup yourself, +- or conditionally enable tools based on your own server context. + +> [!IMPORTANT] +> These composition helpers are built for `tmcp`'s `McpServer` and **cannot** be directly composed into a server built with the [official MCP TypeScript SDK (`@modelcontextprotocol/sdk`)](https://github.com/modelcontextprotocol/typescript-sdk). + +Minimal composition example: + +```ts +import { McpServer } from 'tmcp'; +import { ValibotJsonSchemaAdapter } from '@tmcp/adapter-valibot'; +import { + addGetStoryDocumentationTool, + addGetDocumentationTool, + addListAllDocumentationTool, + type StorybookContext, +} from '@storybook/mcp'; + +const adapter = new ValibotJsonSchemaAdapter(); +const server = new McpServer( + { name: 'custom-mcp', version: '1.0.0' }, + { + adapter, + capabilities: { + tools: { listChanged: true }, + }, + }, +).withContext(); + +await addListAllDocumentationTool(server); +await addGetDocumentationTool(server); +await addGetStoryDocumentationTool(server); +``` + +After registration, wire your own transport and pass `StorybookContext` per request so tools can resolve manifests (`request`, `manifestProvider`, and optional `sources`). + +#### `addListAllDocumentationTool` + +Type: + +```ts +(server: McpServer, enabled?: () => boolean | Promise) => + Promise; +``` + +Registers the [list tool](https://storybook.js.org/docs/next/ai/mcp/overview/#list-all-documentation) that returns all component/docs IDs from manifests. + +#### `addGetDocumentationTool` + +Type: + +```ts +( + server: McpServer, + enabled?: () => boolean | Promise, + options?: { multiSource?: boolean }, +) => Promise; +``` + +Registers [documentation lookup](https://storybook.js.org/docs/next/ai/mcp/overview/#get-documentation) by component/docs `id`. + +When `options.multiSource` is `true`, the tool schema requires `storybookId` input. + +#### `addGetStoryDocumentationTool` + +Type: + +```ts +( + server: McpServer, + enabled?: () => boolean | Promise, + options?: { multiSource?: boolean }, +) => Promise; +``` + +Registers [story-level documentation lookup](https://storybook.js.org/docs/next/ai/mcp/overview/#get-documentation-for-story) for a specific story variant by `componentId` and `storyName`. diff --git a/tools/ui/node_modules/@storybook/mcp/dist/index.d.ts b/tools/ui/node_modules/@storybook/mcp/dist/index.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..62b44fdc3b951fcaa94bc0a3b8c77e920f5a421e --- /dev/null +++ b/tools/ui/node_modules/@storybook/mcp/dist/index.d.ts @@ -0,0 +1,619 @@ +import { t as instructions_default } from "./instructions-CiOmp0JI.js"; +import { McpServer } from "tmcp"; +import * as v from "valibot"; + +//#region src/types.d.ts +/** + * Represents a single Storybook source (local or remote). + */ +type Source = { + /** Unique identifier for this source (e.g., 'local', 'tetra') */id: string; /** Human-readable title (e.g., 'Local', 'Tetra Design System') */ + title: string; /** Remote URL, undefined for local source */ + url?: string; +}; +type RequiresOwnMcpNotice = { + kind: 'requires-own-mcp'; + endpoint: string; +}; +/** + * All manifests for a single source. + */ +type SourceManifests = { + source: Source; + componentManifest: ComponentManifestMap; + docsManifest?: DocsManifestMap; /** Error message if fetching this source failed */ + error?: string; /** Non-error guidance for sources that must be accessed through their own MCP endpoint */ + notice?: RequiresOwnMcpNotice; +}; +/** + * Custom context passed to MCP server and tools. + * Contains the request object and optional manifest provider. + */ +type StorybookContext = { + /** + * The incoming HTTP request being processed. + */ + request?: Request; + /** + * Optional function to provide custom manifest retrieval logic. + * If provided, this function will be called instead of the default fetch-based provider. + * The function receives the request object, a path to the manifest file, and optionally + * a source (in multi-source mode). + * The default provider requires a request object and constructs the manifest URL from the request origin, + * using the top-level manifest path such as /manifests/components.json. + * Custom providers can use the request parameter to determine the manifest source, or ignore it entirely. + */ + manifestProvider?: (request: Request | undefined, path: string, source?: Source) => Promise; + /** + * Sources configuration for multi-source mode. + * When provided, tools will fetch and display manifests grouped by source. + */ + sources?: Source[]; + /** + * Optional handler called when list-all-documentation tool is invoked. + * Receives the context and the component manifest. + */ + onListAllDocumentation?: (params: { + context: StorybookContext; + manifests: AllManifests; + resultText: string; /** Present in multi-source mode — all source manifests including errors */ + sources?: SourceManifests[]; + }) => void | Promise; + /** + * Optional handler called when get-documentation tool is invoked. + * Receives the context, input parameters, and the found component (if any). + */ + onGetDocumentation?: (params: { + context: StorybookContext; + input: { + id: string; + storybookId?: string; + }; + } & ({ + foundDocumentation: ComponentManifest | Doc; + resultText: string; + } | { + foundDocumentation?: never; + resultText?: never; + })) => void | Promise; + /** + * Optional in-process resolver for a single component or docs entry, used in + * Storybook's dev server when `experimentalDocgenServer` is enabled. When set, + * single-entry tools (`get-documentation`, `get-documentation-for-story`) call + * this instead of fetching the (potentially all-component) manifest index, so a + * single lookup never triggers docgen extraction for every component. + * + * Returns the fully-resolved component or doc in `@storybook/mcp`'s internal + * shape (already adapted from the open-service payloads), or `undefined` when the + * id is unknown. + */ + resolveEntry?: (id: string, source?: Source) => Promise; +}; +/** + * Result of resolving a single id via {@link StorybookContext.resolveEntry}: either a + * fully-resolved component manifest or a standalone docs entry. + */ +type ResolvedEntry = { + kind: 'component'; + component: ComponentManifest; +} | { + kind: 'doc'; + doc: Doc; +}; +declare const Story: v.ObjectSchema<{ + readonly id: v.OptionalSchema, undefined>; + readonly snippet: v.OptionalSchema, undefined>; + readonly summary: v.OptionalSchema, undefined>; + readonly name: v.StringSchema; + readonly description: v.OptionalSchema, undefined>; + readonly jsDocTags: v.OptionalSchema, v.ArraySchema, undefined>, undefined>, undefined>; + readonly error: v.OptionalSchema; + readonly message: v.StringSchema; + }, undefined>, undefined>; +}, undefined>; +type Story = v.InferOutput; +/** Inline (v0) docs entry: the full MDX `content` is embedded. */ +declare const DocV0: v.ObjectSchema<{ + readonly id: v.StringSchema; + readonly name: v.StringSchema; + readonly title: v.OptionalSchema, undefined>; + readonly path: v.OptionalSchema, undefined>; + readonly content: v.OptionalSchema, undefined>; + readonly summary: v.OptionalSchema, undefined>; + readonly error: v.OptionalSchema; + readonly message: v.StringSchema; + }, undefined>, undefined>; +}, undefined>; +type DocV0 = v.InferOutput; +/** Inline (v0) component: docgen, stories and attached docs are all embedded. */ +declare const ComponentManifestV0: v.ObjectSchema<{ + readonly id: v.StringSchema; + readonly stories: v.OptionalSchema, undefined>; + readonly snippet: v.OptionalSchema, undefined>; + readonly summary: v.OptionalSchema, undefined>; + readonly name: v.StringSchema; + readonly description: v.OptionalSchema, undefined>; + readonly jsDocTags: v.OptionalSchema, v.ArraySchema, undefined>, undefined>, undefined>; + readonly error: v.OptionalSchema; + readonly message: v.StringSchema; + }, undefined>, undefined>; + }, undefined>, undefined>, undefined>; + readonly subcomponents: v.OptionalSchema, v.ObjectSchema<{ + readonly path: v.OptionalSchema, undefined>; + readonly summary: v.OptionalSchema, undefined>; + readonly import: v.OptionalSchema, undefined>; + readonly reactDocgen: v.OptionalSchema; + readonly reactDocgenTypescript: v.OptionalSchema; + readonly reactComponentMeta: v.OptionalSchema; + readonly name: v.StringSchema; + readonly description: v.OptionalSchema, undefined>; + readonly jsDocTags: v.OptionalSchema, v.ArraySchema, undefined>, undefined>, undefined>; + readonly error: v.OptionalSchema; + readonly message: v.StringSchema; + }, undefined>, undefined>; + }, undefined>, undefined>, undefined>; + readonly docs: v.OptionalSchema, v.ObjectSchema<{ + readonly id: v.StringSchema; + readonly name: v.StringSchema; + readonly title: v.OptionalSchema, undefined>; + readonly path: v.OptionalSchema, undefined>; + readonly content: v.OptionalSchema, undefined>; + readonly summary: v.OptionalSchema, undefined>; + readonly error: v.OptionalSchema; + readonly message: v.StringSchema; + }, undefined>, undefined>; + }, undefined>, undefined>, undefined>; + readonly path: v.OptionalSchema, undefined>; + readonly summary: v.OptionalSchema, undefined>; + readonly import: v.OptionalSchema, undefined>; + readonly reactDocgen: v.OptionalSchema; + readonly reactDocgenTypescript: v.OptionalSchema; + readonly reactComponentMeta: v.OptionalSchema; + readonly name: v.StringSchema; + readonly description: v.OptionalSchema, undefined>; + readonly jsDocTags: v.OptionalSchema, v.ArraySchema, undefined>, undefined>, undefined>; + readonly error: v.OptionalSchema; + readonly message: v.StringSchema; + }, undefined>, undefined>; +}, undefined>; +type ComponentManifestV0 = v.InferOutput; +/** + * Shallow (v1) docs entry. The full MDX payload (title/path/content) lives behind + * `mdx.$ref`; `mdx` is optional because Storybook's in-process dev index omits it + * (those entries are resolved in-process via {@link StorybookContext.resolveEntry}). + */ +declare const DocV1: v.ObjectSchema<{ + readonly id: v.StringSchema; + readonly name: v.StringSchema; + readonly summary: v.OptionalSchema, undefined>; + readonly mdx: v.OptionalSchema; + }, undefined>, undefined>; + readonly error: v.OptionalSchema; + readonly message: v.StringSchema; + }, undefined>, undefined>; +}, undefined>; +type DocV1 = v.InferOutput; +/** + * Shallow (v1) component index row. Identity + summary are inlined for cheap + * listing; docgen and story-docs live behind `$ref`s, attached docs behind nested + * `mdx.$ref`s. `docgen`/`stories` are optional (the in-process dev index omits + * `docgen`, and docs-only components have neither). + */ +declare const ComponentManifestV1: v.ObjectSchema<{ + readonly id: v.StringSchema; + readonly name: v.StringSchema; + readonly description: v.OptionalSchema, undefined>; + readonly summary: v.OptionalSchema, undefined>; + readonly error: v.OptionalSchema; + readonly message: v.StringSchema; + }, undefined>, undefined>; + readonly docgen: v.OptionalSchema; + }, undefined>, undefined>; + readonly stories: v.OptionalSchema; + }, undefined>, undefined>; + readonly docs: v.OptionalSchema, v.ObjectSchema<{ + readonly id: v.StringSchema; + readonly name: v.StringSchema; + readonly summary: v.OptionalSchema, undefined>; + readonly mdx: v.OptionalSchema; + }, undefined>, undefined>; + readonly error: v.OptionalSchema; + readonly message: v.StringSchema; + }, undefined>, undefined>; + }, undefined>, undefined>, undefined>; +}, undefined>; +type ComponentManifestV1 = v.InferOutput; +/** `components.json`, discriminated on `v` (0 = inline, 1 = split/ref). */ +declare const ComponentManifestMap: v.VariantSchema<"v", [v.ObjectSchema<{ + readonly v: v.LiteralSchema<0, undefined>; + readonly components: v.RecordSchema, v.ObjectSchema<{ + readonly id: v.StringSchema; + readonly stories: v.OptionalSchema, undefined>; + readonly snippet: v.OptionalSchema, undefined>; + readonly summary: v.OptionalSchema, undefined>; + readonly name: v.StringSchema; + readonly description: v.OptionalSchema, undefined>; + readonly jsDocTags: v.OptionalSchema, v.ArraySchema, undefined>, undefined>, undefined>; + readonly error: v.OptionalSchema; + readonly message: v.StringSchema; + }, undefined>, undefined>; + }, undefined>, undefined>, undefined>; + readonly subcomponents: v.OptionalSchema, v.ObjectSchema<{ + readonly path: v.OptionalSchema, undefined>; + readonly summary: v.OptionalSchema, undefined>; + readonly import: v.OptionalSchema, undefined>; + readonly reactDocgen: v.OptionalSchema; + readonly reactDocgenTypescript: v.OptionalSchema; + readonly reactComponentMeta: v.OptionalSchema; + readonly name: v.StringSchema; + readonly description: v.OptionalSchema, undefined>; + readonly jsDocTags: v.OptionalSchema, v.ArraySchema, undefined>, undefined>, undefined>; + readonly error: v.OptionalSchema; + readonly message: v.StringSchema; + }, undefined>, undefined>; + }, undefined>, undefined>, undefined>; + readonly docs: v.OptionalSchema, v.ObjectSchema<{ + readonly id: v.StringSchema; + readonly name: v.StringSchema; + readonly title: v.OptionalSchema, undefined>; + readonly path: v.OptionalSchema, undefined>; + readonly content: v.OptionalSchema, undefined>; + readonly summary: v.OptionalSchema, undefined>; + readonly error: v.OptionalSchema; + readonly message: v.StringSchema; + }, undefined>, undefined>; + }, undefined>, undefined>, undefined>; + readonly path: v.OptionalSchema, undefined>; + readonly summary: v.OptionalSchema, undefined>; + readonly import: v.OptionalSchema, undefined>; + readonly reactDocgen: v.OptionalSchema; + readonly reactDocgenTypescript: v.OptionalSchema; + readonly reactComponentMeta: v.OptionalSchema; + readonly name: v.StringSchema; + readonly description: v.OptionalSchema, undefined>; + readonly jsDocTags: v.OptionalSchema, v.ArraySchema, undefined>, undefined>, undefined>; + readonly error: v.OptionalSchema; + readonly message: v.StringSchema; + }, undefined>, undefined>; + }, undefined>, undefined>; +}, undefined>, v.ObjectSchema<{ + readonly v: v.LiteralSchema<1, undefined>; + readonly components: v.RecordSchema, v.ObjectSchema<{ + readonly id: v.StringSchema; + readonly name: v.StringSchema; + readonly description: v.OptionalSchema, undefined>; + readonly summary: v.OptionalSchema, undefined>; + readonly error: v.OptionalSchema; + readonly message: v.StringSchema; + }, undefined>, undefined>; + readonly docgen: v.OptionalSchema; + }, undefined>, undefined>; + readonly stories: v.OptionalSchema; + }, undefined>, undefined>; + readonly docs: v.OptionalSchema, v.ObjectSchema<{ + readonly id: v.StringSchema; + readonly name: v.StringSchema; + readonly summary: v.OptionalSchema, undefined>; + readonly mdx: v.OptionalSchema; + }, undefined>, undefined>; + readonly error: v.OptionalSchema; + readonly message: v.StringSchema; + }, undefined>, undefined>; + }, undefined>, undefined>, undefined>; + }, undefined>, undefined>; +}, undefined>], undefined>; +type ComponentManifestMap = v.InferOutput; +/** + * `docs.json` for unattached/standalone documentation entries (served at + * `/manifests/docs.json`), discriminated on `v`. + */ +declare const DocsManifestMap: v.VariantSchema<"v", [v.ObjectSchema<{ + readonly v: v.LiteralSchema<0, undefined>; + readonly docs: v.RecordSchema, v.ObjectSchema<{ + readonly id: v.StringSchema; + readonly name: v.StringSchema; + readonly title: v.OptionalSchema, undefined>; + readonly path: v.OptionalSchema, undefined>; + readonly content: v.OptionalSchema, undefined>; + readonly summary: v.OptionalSchema, undefined>; + readonly error: v.OptionalSchema; + readonly message: v.StringSchema; + }, undefined>, undefined>; + }, undefined>, undefined>; +}, undefined>, v.ObjectSchema<{ + readonly v: v.LiteralSchema<1, undefined>; + readonly docs: v.RecordSchema, v.ObjectSchema<{ + readonly id: v.StringSchema; + readonly name: v.StringSchema; + readonly summary: v.OptionalSchema, undefined>; + readonly mdx: v.OptionalSchema; + }, undefined>, undefined>; + readonly error: v.OptionalSchema; + readonly message: v.StringSchema; + }, undefined>, undefined>; + }, undefined>, undefined>; +}, undefined>], undefined>; +type DocsManifestMap = v.InferOutput; +/** + * A component index row as it appears in either format: inline (v0) or shallow + * ref (v1). This is what {@link resolveComponentEntry} consumes before following any + * `$ref`s. + */ +type ComponentManifestEntry = ComponentManifestV0 | ComponentManifestV1; +/** A docs index row as it appears in either format: inline (v0) or shallow ref (v1). */ +type DocEntry = DocV0 | DocV1; +/** + * A fully-resolved component, as consumed by the tools and formatters: inline shape + * (stories as an array, attached docs with `content`, docgen inlined). Identical to + * the v0 shape — v1 rows are resolved into it by following their `$ref`s + * (`resolveComponentEntry`) or built in-process (`adaptCoreComponent`). + */ +type ComponentManifest = ComponentManifestV0; +/** A fully-resolved docs entry (inline `content`), as consumed by tools and formatters. */ +type Doc = DocV0; +type AllManifests = { + componentManifest: ComponentManifestMap; + docsManifest?: DocsManifestMap; +}; +/** + * Open-service payload contracts (the "core format") that Storybook's + * `experimentalDocgenServer` mode produces. `@storybook/mcp` adapts these into its + * internal {@link ComponentManifest}/{@link Doc} shapes in one place + * (`adaptCoreComponent`/`adaptCoreDoc`). Defined structurally (not as schemas) so + * the addon can build them in-process without importing Storybook core. + */ +/** One story snippet from the `core/story-docs` service. */ +type CoreStoryDoc = { + id: string; + name: string; + snippet?: string; + description?: string; + summary?: string; + error?: { + name: string; + message: string; + }; +}; +/** One MDX doc from the `addon-docs/mdx` service. */ +type CoreMdxDoc = { + id: string; + name: string; + path?: string; + title?: string; + content?: string; + summary?: string; + error?: { + name: string; + message: string; + }; +}; +/** + * Payload returned by the `addon-docs/mdx` service for a component or standalone + * docs entry. + */ +type CoreMdxPayload = { + id: string; + name: string; + docs: Record; +}; +/** Payload returned by the `core/story-docs` service for one component. */ +type CoreStoryDocsPayload = { + id: string; + name: string; + path: string; + import?: string; + stories: Record; + error?: { + name: string; + message: string; + }; +}; +/** + * Payload returned by the `core/docgen` service for one component. `argTypes` (a + * UI-normalized view) is intentionally ignored by the adapter; prop types come + * from `reactComponentMeta`/`react*` fields. + */ +type CoreDocgenPayload = { + id: string; + name: string; + path?: string; + description?: string; + summary?: string; + jsDocTags?: Record; + import?: string; + reactComponentMeta?: unknown; + reactDocgen?: unknown; + reactDocgenTypescript?: unknown; + subcomponents?: Record; + error?: { + name: string; + message: string; + }; + [key: string]: unknown; +}; +/** + * A component assembled from the `core/docgen` payload plus the `core/story-docs` + * stories and resolved attached MDX docs. + */ +type CoreDocgenComponent = CoreDocgenPayload & { + import?: string; /** Story snippets, either as a story-docs record or an already-resolved array. */ + stories?: Record | Story[]; /** Attached docs keyed by doc id (resolved MDX payloads). */ + docs?: Record; +}; +//#endregion +//#region src/tools/list-all-documentation.d.ts +declare const LIST_TOOL_NAME = "list-all-documentation"; +declare function getListAllDocumentationToolMetadata(): { + name: string; + title: string; + description: string; + schema: v.ObjectSchema<{ + readonly withStoryIds: v.OptionalSchema, v.DescriptionAction]>, false>; + }, undefined>; +}; +declare function addListAllDocumentationTool(server: McpServer, enabled?: Parameters['tool']>[0]['enabled']): Promise; +//#endregion +//#region src/tools/get-documentation.d.ts +declare const GET_TOOL_NAME = "get-documentation"; +declare function getDocumentationToolMetadata(options?: { + multiSource?: boolean; +}): { + name: string; + title: string; + description: string; + schema: v.ObjectSchema<{ + readonly storybookId: v.SchemaWithPipe, v.DescriptionAction]>; + readonly id: v.SchemaWithPipe, v.DescriptionAction]>; + }, undefined> | v.ObjectSchema<{ + id: v.SchemaWithPipe, v.DescriptionAction]>; + }, undefined>; +}; +declare function addGetDocumentationTool(server: McpServer, enabled?: Parameters['tool']>[0]['enabled'], options?: { + multiSource?: boolean; +}): Promise; +//#endregion +//#region src/tools/get-documentation-for-story.d.ts +declare const GET_STORY_TOOL_NAME = "get-documentation-for-story"; +declare function getStoryDocumentationToolMetadata(options?: { + multiSource?: boolean; +}): { + name: string; + title: string; + description: string; + schema: v.ObjectSchema<{ + readonly storybookId: v.SchemaWithPipe, v.DescriptionAction]>; + readonly componentId: v.StringSchema; + readonly storyName: v.StringSchema; + }, undefined> | v.ObjectSchema<{ + componentId: v.StringSchema; + storyName: v.StringSchema; + }, undefined>; +}; +declare function addGetStoryDocumentationTool(server: McpServer, enabled?: Parameters['tool']>[0]['enabled'], options?: { + multiSource?: boolean; +}): Promise; +//#endregion +//#region src/utils/get-manifest.d.ts +type SourceWithUrl = Source & { + url: string; +}; +type ManifestProvider = (request: Request | undefined, path: string, source?: Source) => Promise; +/** + * The paths to the manifest files relative to the Storybook build + */ +declare const COMPONENT_MANIFEST_PATH = "./manifests/components.json"; +declare const DOCS_MANIFEST_PATH = "./manifests/docs.json"; +declare class RequiresOwnMcpError extends Error { + readonly source: SourceWithUrl; + readonly endpoint: string; + constructor(source: SourceWithUrl); +} +/** + * Resolves a component index entry into a full component manifest by following any + * `$ref`s it carries (docgen, story-docs, attached MDX docs), then adapting the + * core-format payloads into `@storybook/mcp`'s internal shape. + * + * Refs are read verbatim from the entry — never fabricated from an id — so a + * provider is only ever asked for top-level manifest paths or paths a manifest + * already pointed at. Components without any `$ref` (inline/v0 format, or entries + * already resolved in-process) are returned unchanged. + */ +declare function resolveComponentEntry(component: ComponentManifestEntry, request?: Request, manifestProvider?: ManifestProvider, source?: Source): Promise; +/** + * Resolves only a component's stories `$ref` (story-docs payload) into a `Story[]`, + * leaving docgen/docs refs untouched. Used by `list-all-documentation` when story + * ids are requested, so listing doesn't pay for docgen/MDX resolution it won't show. + */ +declare function resolveComponentStories(component: ComponentManifestEntry, request?: Request, manifestProvider?: ManifestProvider, source?: Source): Promise; +/** + * Resolves a standalone docs entry, following its `mdx.$ref` when present. + * Inline docs (v0) are returned unchanged. + */ +declare function resolveDoc(doc: DocEntry, request?: Request, manifestProvider?: ManifestProvider, source?: Source): Promise; +/** + * Gets manifests from multiple sources. + * Returns an array of source manifests, each containing the source info and its manifests. + * Failures for individual sources are captured as errors rather than failing the entire request. + * + * @param sources - Array of source configurations + * @param request - The HTTP request (used for local source) + * @param manifestProvider - Function to fetch manifests, receives source as third parameter + * @returns Promise resolving to array of source manifests + * @throws {ManifestGetError} If no sources could be fetched successfully + */ +declare function getMultiSourceManifests(sources: Source[], request?: Request, manifestProvider?: (request: Request | undefined, path: string, source?: Source) => Promise): Promise; +//#endregion +//#region src/utils/adapt-core-manifest.d.ts +/** Converts the story-docs `stories` record (or an already-resolved array) into `Story[]`. */ +declare function adaptCoreStories(stories: CoreDocgenComponent['stories']): Story[] | undefined; +/** Adapts one MDX service payload into a {@link Doc}. */ +declare function adaptCoreDoc(doc: CoreMdxDoc): Doc; +/** Adapts a core-format component (docgen + story-docs + attached MDX) into a {@link ComponentManifest}. */ +declare function adaptCoreComponent(core: CoreDocgenComponent): ComponentManifest; +//#endregion +//#region src/index.d.ts +type InitializeRequestParams = { + protocolVersion: string; + capabilities: { + experimental?: {} | undefined; + sampling?: {} | undefined; + elicitation?: {} | undefined; + roots?: { + listChanged?: boolean | undefined; + } | undefined; + }; + clientInfo: { + icons?: { + src: string; + mimeType?: string | undefined; + sizes?: string[] | undefined; + }[] | undefined; + version: string; + websiteUrl?: string | undefined; + name: string; + title?: string | undefined; + }; +}; +/** + * Options for creating a Storybook MCP handler. + * Extends StorybookContext with server-level configuration. + */ +interface StorybookMcpHandlerOptions extends StorybookContext { + /** + * Optional handler called when an MCP session is initialized. + * This is only valid at the handler creation level, not per-request. + * Receives the initialize request parameters from the MCP protocol. + */ + onSessionInitialize?: (initializeRequestParams: InitializeRequestParams) => void | Promise; +} +type Handler = (req: Request, context?: StorybookContext) => Promise; +declare const createStorybookMcpHandler: (options?: StorybookMcpHandlerOptions) => Promise; +//#endregion +export { COMPONENT_MANIFEST_PATH, type ComponentManifest, ComponentManifestMap, type CoreDocgenComponent, type CoreDocgenPayload, type CoreMdxDoc, type CoreMdxPayload, type CoreStoryDoc, type CoreStoryDocsPayload, DOCS_MANIFEST_PATH, type Doc, DocsManifestMap, GET_STORY_TOOL_NAME, GET_TOOL_NAME, LIST_TOOL_NAME, RequiresOwnMcpError, type RequiresOwnMcpNotice, type ResolvedEntry, instructions_default as STORYBOOK_MCP_INSTRUCTIONS, type Source, type SourceManifests, type Story, type StorybookContext, StorybookMcpHandlerOptions, adaptCoreComponent, adaptCoreDoc, adaptCoreStories, addGetDocumentationTool, addGetStoryDocumentationTool, addListAllDocumentationTool, createStorybookMcpHandler, getDocumentationToolMetadata, getListAllDocumentationToolMetadata, getMultiSourceManifests, getStoryDocumentationToolMetadata, resolveComponentEntry, resolveComponentStories, resolveDoc }; \ No newline at end of file diff --git a/tools/ui/node_modules/@storybook/mcp/dist/index.js b/tools/ui/node_modules/@storybook/mcp/dist/index.js new file mode 100644 index 0000000000000000000000000000000000000000..c7b6f4344e0e2d5c397b095d85e428e8edcc19db --- /dev/null +++ b/tools/ui/node_modules/@storybook/mcp/dist/index.js @@ -0,0 +1,1168 @@ +import { t as instructions_default } from "./instructions-CiOmp0JI.js"; +import { McpServer } from "tmcp"; +import { ValibotJsonSchemaAdapter } from "@tmcp/adapter-valibot"; +import { HttpTransport } from "@tmcp/transport-http"; +import * as v from "valibot"; + +//#region package.json +var name = "@storybook/mcp"; +var version = "0.8.0"; +var description = "MCP server that serves knowledge about your components based on your Storybook stories and documentation"; + +//#endregion +//#region src/types.ts +const JSDocTag = v.record(v.string(), v.array(v.string())); +const ManifestError = v.object({ + name: v.string(), + message: v.string() +}); +const BaseManifest = v.object({ + name: v.string(), + description: v.optional(v.string()), + jsDocTags: v.optional(JSDocTag), + error: v.optional(ManifestError) +}); +const Story = v.object({ + ...BaseManifest.entries, + id: v.optional(v.string()), + snippet: v.optional(v.string()), + summary: v.optional(v.string()) +}); +/** +* A JSON Reference (`{ $ref }`) pointing at a value in another manifest document. +* Used by the v1 (split/ref) manifest format for docgen, story-docs and MDX payloads. +*/ +const JsonRef = v.object({ $ref: v.string() }); +/** Inline (v0) docs entry: the full MDX `content` is embedded. */ +const DocV0 = v.object({ + id: v.string(), + name: v.string(), + title: v.optional(v.string()), + path: v.optional(v.string()), + content: v.optional(v.string()), + summary: v.optional(v.string()), + error: v.optional(ManifestError) +}); +const BaseInlineComponentProperties = v.object({ + ...BaseManifest.entries, + path: v.optional(v.string()), + summary: v.optional(v.string()), + import: v.optional(v.string()), + reactDocgen: v.optional(v.any()), + reactDocgenTypescript: v.optional(v.any()), + reactComponentMeta: v.optional(v.any()) +}); +const SubcomponentManifest = v.object({ ...BaseInlineComponentProperties.entries }); +/** Inline (v0) component: docgen, stories and attached docs are all embedded. */ +const ComponentManifestV0 = v.object({ + ...BaseInlineComponentProperties.entries, + id: v.string(), + stories: v.optional(v.array(Story)), + subcomponents: v.optional(v.record(v.string(), SubcomponentManifest)), + docs: v.optional(v.record(v.string(), DocV0)) +}); +const ComponentManifestMapV0 = v.object({ + v: v.literal(0), + components: v.record(v.string(), ComponentManifestV0) +}); +const DocsManifestMapV0 = v.object({ + v: v.literal(0), + docs: v.record(v.string(), DocV0) +}); +/** +* Shallow (v1) docs entry. The full MDX payload (title/path/content) lives behind +* `mdx.$ref`; `mdx` is optional because Storybook's in-process dev index omits it +* (those entries are resolved in-process via {@link StorybookContext.resolveEntry}). +*/ +const DocV1 = v.object({ + id: v.string(), + name: v.string(), + summary: v.optional(v.string()), + mdx: v.optional(JsonRef), + error: v.optional(ManifestError) +}); +/** +* Shallow (v1) component index row. Identity + summary are inlined for cheap +* listing; docgen and story-docs live behind `$ref`s, attached docs behind nested +* `mdx.$ref`s. `docgen`/`stories` are optional (the in-process dev index omits +* `docgen`, and docs-only components have neither). +*/ +const ComponentManifestV1 = v.object({ + id: v.string(), + name: v.string(), + description: v.optional(v.string()), + summary: v.optional(v.string()), + error: v.optional(ManifestError), + docgen: v.optional(JsonRef), + stories: v.optional(JsonRef), + docs: v.optional(v.record(v.string(), DocV1)) +}); +const ComponentManifestMapV1 = v.object({ + v: v.literal(1), + components: v.record(v.string(), ComponentManifestV1) +}); +const DocsManifestMapV1 = v.object({ + v: v.literal(1), + docs: v.record(v.string(), DocV1) +}); +/** `components.json`, discriminated on `v` (0 = inline, 1 = split/ref). */ +const ComponentManifestMap = v.variant("v", [ComponentManifestMapV0, ComponentManifestMapV1]); +/** +* `docs.json` for unattached/standalone documentation entries (served at +* `/manifests/docs.json`), discriminated on `v`. +*/ +const DocsManifestMap = v.variant("v", [DocsManifestMapV0, DocsManifestMapV1]); +/** +* Shared Valibot field for the storybookId input, used in multi-source mode. +* Reused across tools that support source selection. +*/ +const StorybookIdField = { storybookId: v.pipe(v.string(), v.description("The Storybook source ID (e.g., \"local\", \"tetra\"). Required when multiple Storybooks are composed. See list-all-documentation for available sources.")) }; + +//#endregion +//#region src/utils/adapt-core-manifest.ts +/** +* Adapts Storybook's `experimentalDocgenServer` open-service payloads (the "core +* format") into `@storybook/mcp`'s internal {@link ComponentManifest}/{@link Doc} +* shapes. This is the single place that bridges the two formats, used by both the +* ref-resolution path (built/static/remote manifests) and the addon's in-process +* `resolveEntry` hook (dev). +* +* Only `argTypes` is dropped: prop types still come from `reactComponentMeta` and +* the `react*` docgen-engine fields, which are passed through unchanged. +*/ +const ARG_TYPES_KEY = "argTypes"; +/** Converts the story-docs `stories` record (or an already-resolved array) into `Story[]`. */ +function adaptCoreStories(stories) { + if (!stories) return; + if (Array.isArray(stories)) return stories; + return Object.values(stories); +} +/** Adapts one MDX service payload into a {@link Doc}. */ +function adaptCoreDoc(doc) { + return { ...doc }; +} +/** Adapts a core-format component (docgen + story-docs + attached MDX) into a {@link ComponentManifest}. */ +function adaptCoreComponent(core) { + const { stories, docs, [ARG_TYPES_KEY]: _argTypes, ...rest } = core; + const component = { ...rest }; + const adaptedStories = adaptCoreStories(stories); + if (adaptedStories) component.stories = adaptedStories; + if (docs) component.docs = Object.fromEntries(Object.entries(docs).map(([id, doc]) => [id, adaptCoreDoc(doc)])); + return component; +} + +//#endregion +//#region src/utils/requires-own-mcp.ts +function getSourceMcpEndpoint(source) { + const base = new URL(source.url); + base.pathname = `${base.pathname.replace(/\/$/, "")}/`; + return new URL("mcp", base).toString(); +} +function formatRequiresOwnMcpNotice(source, endpoint, options = {}) { + const parts = []; + if (options.includeHeader ?? true) { + parts.push(`# ${source.title}`); + parts.push(`id: ${source.id}`); + parts.push(""); + } + parts.push("This composed Storybook is private and cannot be read through the local Storybook MCP proxy."); + parts.push(""); + parts.push("Use this source's own MCP endpoint instead:"); + parts.push(endpoint); + return parts.join("\n"); +} + +//#endregion +//#region src/utils/get-manifest.ts +/** +* The paths to the manifest files relative to the Storybook build +*/ +const COMPONENT_MANIFEST_PATH = "./manifests/components.json"; +const DOCS_MANIFEST_PATH = "./manifests/docs.json"; +/** Empty placeholder manifest used for sources that errored or need their own MCP endpoint. */ +const EMPTY_COMPONENT_MANIFEST = { + v: 1, + components: {} +}; +/** +* Error thrown when getting or parsing a manifest fails +*/ +var ManifestGetError = class extends Error { + url; + cause; + constructor(message, url, cause) { + super(message); + this.name = "ManifestGetError"; + this.url = url ?? "No source URL provided"; + this.cause = cause; + } +}; +var RequiresOwnMcpError = class extends Error { + source; + endpoint; + constructor(source) { + const endpoint = getSourceMcpEndpoint(source); + super(`Composed Storybook "${source.title}" requires its own MCP endpoint: ${endpoint}`); + this.name = "RequiresOwnMcpError"; + this.source = source; + this.endpoint = endpoint; + } +}; +/** +* Converts an error to MCP-compatible content format +* +* @param error - The error to convert (can be any type) +* @returns A tool result with error content and isError flag +*/ +const errorToMCPContent = (error) => { + if (error instanceof RequiresOwnMcpError) return { content: [{ + type: "text", + text: formatRequiresOwnMcpNotice(error.source, error.endpoint) + }] }; + let fullMessage = `${error instanceof ManifestGetError ? "Error getting manifest" : "Unexpected error"}: ${error instanceof Error ? error.message : String(error)}`; + if (error instanceof ManifestGetError && error.cause) { + const causeMessage = error.cause instanceof Error ? error.cause.message : String(error.cause); + fullMessage += `\nCaused by: ${causeMessage}`; + } + return { + content: [{ + type: "text", + text: fullMessage + }], + isError: true + }; +}; +/** +* Parses a JSON string and validates it against a Valibot schema +*/ +function parseManifest({ jsonString, schema, name, url }) { + try { + return v.parse(v.pipe(v.string(), v.parseJson(), schema), jsonString); + } catch (error) { + throw new ManifestGetError(`Failed to parse ${name} manifest: +${error instanceof v.ValiError ? error.issues.map((i) => i.message).join("\n") : String(error)}`, url); + } +} +/** +* Gets component and docs manifest from a request or using a custom provider +* +* @param request - The HTTP request to get the manifest for (optional when using custom manifestProvider) +* @param manifestProvider - Optional custom function to get the manifest +* @param source - Optional source for multi-source mode +* @returns A promise that resolves to the parsed ComponentManifestMap +* @throws {ManifestGetError} If getting the manifest fails or the response is invalid +*/ +async function getManifests(request, manifestProvider, source) { + const provider = manifestProvider ?? defaultManifestProvider; + const [componentResult, docsResult] = await Promise.allSettled([provider(request, COMPONENT_MANIFEST_PATH, source), provider(request, DOCS_MANIFEST_PATH, source)]); + const getUrl = (path) => request ? getManifestUrlFromRequest(request, path) : "Unknown manifest source"; + if (componentResult.status === "rejected") { + const reason = componentResult.reason; + if (reason instanceof RequiresOwnMcpError) throw reason; + const hint = reason instanceof ManifestGetError && reason.message.includes("404") ? `\nHint: The Storybook at this URL may not have the component manifest enabled. Add \`features: { componentsManifest: true }\` (or \`features: { experimentalComponentsManifest: true }\` for older Storybook versions) to its main.ts config.` : ""; + throw new ManifestGetError(`Failed to get component manifest: ${reason instanceof Error ? reason.message : String(reason)}${hint}`, getUrl(COMPONENT_MANIFEST_PATH), reason instanceof Error ? reason : void 0); + } + const componentManifest = parseManifest({ + jsonString: componentResult.value, + schema: ComponentManifestMap, + name: "component", + url: getUrl(COMPONENT_MANIFEST_PATH) + }); + if (Object.keys(componentManifest.components).length === 0) throw new ManifestGetError(`No components found in the manifest`, getUrl(COMPONENT_MANIFEST_PATH)); + if (docsResult.status === "rejected") return { componentManifest }; + return { + componentManifest, + docsManifest: parseManifest({ + jsonString: docsResult.value, + schema: DocsManifestMap, + name: "docs", + url: getUrl(DOCS_MANIFEST_PATH) + }) + }; +} +/** +* Resolves a `$ref` into the provider path of the referenced file and the +* JSON-pointer segments into it. +* +* The `$ref` file path is relative to the component manifest's location, e.g. +* `"../services/core/docgen/button.json#/components/button"` from +* `./manifests/components.json` resolves to `./services/core/docgen/button.json` +* with pointer `["components", "button"]`. The same base (`manifests/`) applies to +* docgen, story-docs and MDX refs. +*/ +function parseManifestRef(ref) { + const [filePath = "", hash = ""] = ref.split("#"); + const manifestDir = COMPONENT_MANIFEST_PATH.replace(/^\.\//, "").replace(/[^/]+$/, ""); + const resolved = new URL(filePath, `https://localhost/${manifestDir}`).pathname.replace(/^\//, ""); + const pointer = hash.split("/").filter(Boolean).map((segment) => segment.replace(/~1/g, "/").replace(/~0/g, "~")); + return { + path: `./${resolved}`, + pointer + }; +} +/** +* Fetches the file a `$ref` points at (verbatim — never a fabricated path) and +* walks its JSON pointer, returning the pointed-to value. +*/ +async function fetchRefValue(ref, request, provider, source) { + const { path, pointer } = parseManifestRef(ref); + const jsonString = await provider(request, path, source); + let target; + try { + target = JSON.parse(jsonString); + } catch (error) { + throw new ManifestGetError(`Failed to parse externalized payload referenced by "${ref}"`, path, error instanceof Error ? error : void 0); + } + for (const key of pointer) if (target && typeof target === "object" && key in target) target = target[key]; + else throw new ManifestGetError(`Reference "${ref}" could not be resolved: missing "${key}".`, path); + return target; +} +/** +* Resolves a component index entry into a full component manifest by following any +* `$ref`s it carries (docgen, story-docs, attached MDX docs), then adapting the +* core-format payloads into `@storybook/mcp`'s internal shape. +* +* Refs are read verbatim from the entry — never fabricated from an id — so a +* provider is only ever asked for top-level manifest paths or paths a manifest +* already pointed at. Components without any `$ref` (inline/v0 format, or entries +* already resolved in-process) are returned unchanged. +*/ +async function resolveComponentEntry(component, request, manifestProvider, source) { + const docgenRef = "docgen" in component ? component.docgen?.$ref : void 0; + const storiesRef = component.stories && !Array.isArray(component.stories) ? component.stories.$ref : void 0; + const docEntries = component.docs ? Object.entries(component.docs) : []; + const docRefs = docEntries.filter(([, doc]) => "mdx" in doc && !!doc.mdx?.$ref); + if (!docgenRef && !storiesRef && docRefs.length === 0) return component; + const provider = manifestProvider ?? defaultManifestProvider; + let core = { + id: component.id, + name: component.name, + ...component.description !== void 0 ? { description: component.description } : {}, + ...component.summary !== void 0 ? { summary: component.summary } : {}, + ...component.error !== void 0 ? { error: component.error } : {} + }; + if (docgenRef) { + const payload = await fetchRefValue(docgenRef, request, provider, source); + core = { + ...core, + ...payload, + id: component.id, + name: component.name, + ...component.description !== void 0 ? { description: component.description } : {}, + ...component.summary !== void 0 ? { summary: component.summary } : {}, + ...component.error !== void 0 ? { error: component.error } : {} + }; + } + if (Array.isArray(component.stories)) core.stories = component.stories; + if (storiesRef) { + const storyDocs = await fetchRefValue(storiesRef, request, provider, source); + if (storyDocs?.stories) core.stories = storyDocs.stories; + if (storyDocs?.import) core.import = storyDocs.import; + } + if (docEntries.length > 0) { + const docs = {}; + for (const [docId, doc] of docEntries) { + const mdxRef = "mdx" in doc ? doc.mdx?.$ref : void 0; + docs[docId] = mdxRef ? await fetchRefValue(mdxRef, request, provider, source) : doc; + } + core.docs = docs; + } + return adaptCoreComponent(core); +} +/** +* Resolves only a component's stories `$ref` (story-docs payload) into a `Story[]`, +* leaving docgen/docs refs untouched. Used by `list-all-documentation` when story +* ids are requested, so listing doesn't pay for docgen/MDX resolution it won't show. +*/ +async function resolveComponentStories(component, request, manifestProvider, source) { + if (!component.stories || Array.isArray(component.stories)) return component; + const provider = manifestProvider ?? defaultManifestProvider; + const storyDocs = await fetchRefValue(component.stories.$ref, request, provider, source); + return { + ...component, + stories: storyDocs?.stories ? adaptCoreStories(storyDocs.stories) : [] + }; +} +/** +* Resolves a standalone docs entry, following its `mdx.$ref` when present. +* Inline docs (v0) are returned unchanged. +*/ +async function resolveDoc(doc, request, manifestProvider, source) { + const ref = "mdx" in doc ? doc.mdx?.$ref : void 0; + if (!ref) return doc; + const payload = await fetchRefValue(ref, request, manifestProvider ?? defaultManifestProvider, source); + return adaptCoreDoc({ + ...payload, + id: payload.id ?? doc.id, + name: payload.name ?? doc.name + }); +} +/** +* Constructs the manifest URL from the request origin and the top-level manifest path. +*/ +function getManifestUrlFromRequest(request, path) { + const normalizedPath = path.replace(/^\.\//, ""); + return new URL(`/${normalizedPath}`, request.url).toString(); +} +/** +* Default manifest provider that fetches from the same origin as the request, +* using Storybook's top-level manifest path. +*/ +async function defaultManifestProvider(request, path) { + if (!request) throw new ManifestGetError("Request is required when using the default manifest provider. You must either pass the original request forward to the server context, or set a custom manifestProvider that doesn't need the request."); + const manifestUrl = getManifestUrlFromRequest(request, path); + const response = await fetch(manifestUrl); + if (!response.ok) throw new ManifestGetError(`Failed to fetch manifest: ${response.status} ${response.statusText}`, manifestUrl); + const contentType = response.headers.get("content-type"); + if (!contentType?.includes("application/json")) throw new ManifestGetError(`Invalid content type: expected application/json, got ${contentType}`, manifestUrl); + return response.text(); +} +/** +* Gets manifests from multiple sources. +* Returns an array of source manifests, each containing the source info and its manifests. +* Failures for individual sources are captured as errors rather than failing the entire request. +* +* @param sources - Array of source configurations +* @param request - The HTTP request (used for local source) +* @param manifestProvider - Function to fetch manifests, receives source as third parameter +* @returns Promise resolving to array of source manifests +* @throws {ManifestGetError} If no sources could be fetched successfully +*/ +async function getMultiSourceManifests(sources, request, manifestProvider) { + const results = await Promise.all(sources.map(async (source) => { + try { + const manifests = await getManifests(request, manifestProvider, source); + return { + source, + componentManifest: manifests.componentManifest, + docsManifest: manifests.docsManifest + }; + } catch (error) { + if (error instanceof RequiresOwnMcpError) return { + source, + componentManifest: EMPTY_COMPONENT_MANIFEST, + notice: { + kind: "requires-own-mcp", + endpoint: error.endpoint + } + }; + return { + source, + componentManifest: EMPTY_COMPONENT_MANIFEST, + error: error instanceof Error ? error.message : String(error) + }; + } + })); + const successCount = results.filter((r) => !r.error && !r.notice).length; + const noticeCount = results.filter((r) => r.notice).length; + if (successCount === 0 && noticeCount === 0) throw new ManifestGetError(`Failed to fetch manifests from any source. Errors:\n${results.map((r) => `- ${r.source.title}: ${r.error}`).join("\n")}`); + return results; +} + +//#endregion +//#region src/utils/map-with-concurrency.ts +/** +* Maps `items` with at most `limit` concurrent in-flight `fn` calls. +*/ +async function mapWithConcurrency(items, limit, fn) { + if (items.length === 0) return []; + const safeLimit = Number.isFinite(limit) ? limit : items.length; + const concurrency = Math.max(1, Math.min(safeLimit, items.length)); + const results = Array(items.length); + let nextIndex = 0; + async function worker() { + while (nextIndex < items.length) { + const index = nextIndex++; + results[index] = await fn(items[index], index); + } + } + await Promise.all(Array.from({ length: concurrency }, () => worker())); + return results; +} + +//#endregion +//#region src/utils/parse-react-docgen.ts +function serializeTsType(tsType) { + if (!tsType) return void 0; + if ("raw" in tsType && typeof tsType.raw === "string" && tsType.raw.trim().length > 0) return tsType.raw; + if (!tsType.name) return void 0; + if ("elements" in tsType) { + const serializeElements = () => (tsType.elements ?? []).map((el) => serializeTsType(el) ?? "unknown"); + switch (tsType.name) { + case "union": return serializeElements().join(" | "); + case "intersection": return serializeElements().join(" & "); + case "Array": return `${serializeTsType((tsType.elements ?? [])[0]) ?? "unknown"}[]`; + case "tuple": return `[${serializeElements().join(", ")}]`; + } + } + if ("value" in tsType && tsType.name === "literal") return tsType.value; + if ("signature" in tsType && tsType.name === "signature") { + if (tsType.type === "function") { + const args = (tsType.signature?.arguments ?? []).map((a) => { + const argType = serializeTsType(a.type) ?? "any"; + return `${a.name}: ${argType}`; + }); + const ret = serializeTsType(tsType.signature?.return) ?? "void"; + return `(${args.join(", ")}) => ${ret}`; + } + if (tsType.type === "object") return `{ ${(tsType.signature?.properties ?? []).map((p) => { + const req = Boolean(p.value?.required); + const propType = serializeTsType(p.value) ?? "any"; + return `${p.key}${req ? "" : "?"}: ${propType}`; + }).join("; ")} }`; + return "unknown"; + } + if ("elements" in tsType) { + const inner = (tsType.elements ?? []).map((el) => serializeTsType(el) ?? "unknown"); + if (inner.length > 0) return `${tsType.name}<${inner.join(", ")}>`; + } + return tsType.name; +} +const parseReactDocgen = (reactDocgen) => { + const props = reactDocgen?.props ?? {}; + return { props: Object.fromEntries(Object.entries(props).map(([propName, prop]) => [propName, { + description: prop.description, + type: serializeTsType(prop.tsType ?? prop.type), + defaultValue: prop.defaultValue?.value, + required: prop.required + }])) }; +}; +/** +* Parse react-docgen-typescript output into the same simplified ParsedDocgen format. +* RDT uses flat type strings (prop.type.name / prop.type.raw) instead of react-docgen's +* nested tsType structure, so no serialization is needed. +*/ +const parseComponentDocLike = (componentDoc) => { + const props = componentDoc.props ?? {}; + return { props: Object.fromEntries(Object.entries(props).map(([propName, prop]) => [propName, { + description: prop.description || void 0, + type: prop.type?.raw ?? prop.type?.name, + defaultValue: prop.defaultValue?.value, + required: prop.required + }])) }; +}; +const parseReactDocgenTypescript = (reactDocgenTypescript) => parseComponentDocLike(reactDocgenTypescript); +const parseReactComponentMeta = (reactComponentMeta) => parseComponentDocLike(reactComponentMeta); + +//#endregion +//#region src/utils/dedent.ts +/** +* Copied from https://github.com/tamino-martinius/node-ts-dedent/blob/18c4736c79806d7fe78bdaaaf5ae307b79f9574a/src/index.ts +* +* Rationale for vendoring instead of using the ts-dedent package: +* 1. The package has a broken ESM distribution - the IDE auto-imports as +* `import dedent from 'ts-dedent'` but that breaks at runtime, requiring +* manual changes to named imports. See: +* - https://github.com/tamino-martinius/node-ts-dedent/issues/42 +* - https://github.com/tamino-martinius/node-ts-dedent/pull/41 +* 2. Keeps bundle size smaller for such a simple utility (avoid "is-even" syndrome) +*/ +function dedent(templ, ...values) { + let strings = Array.from(typeof templ === "string" ? [templ] : templ); + strings[strings.length - 1] = strings.at(-1).replace(/\r?\n([\t ]*)$/, ""); + const indentLengths = strings.reduce((arr, str) => { + const matches = str.match(/\n([\t ]+|(?!\s).)/g); + if (matches) return arr.concat(matches.map((match) => match.match(/[\t ]/g)?.length ?? 0)); + return arr; + }, []); + if (indentLengths.length) { + const pattern = new RegExp(`\n[\t ]{${Math.min(...indentLengths)}}`, "g"); + strings = strings.map((str) => str.replace(pattern, "\n")); + } + strings[0] = strings[0].replace(/^\r?\n/, ""); + let string = strings[0]; + values.forEach((value, i) => { + const endentations = string.match(/(?:^|\n)( *)$/); + const endentation = endentations ? endentations[1] : ""; + let indentedValue = value; + if (typeof value === "string" && value.includes("\n")) indentedValue = String(value).split("\n").map((str, i) => { + return i === 0 ? str : `${endentation}${str}`; + }).join("\n"); + string += `${String(indentedValue)}${strings[i + 1]}`; + }); + return string; +} + +//#endregion +//#region src/utils/manifest-formatter/extract-docs-summary.ts +/** +* Maximum length for a summary before truncation. +*/ +const MAX_SUMMARY_LENGTH = 90; +/** +* Extracts a summary from MDX content. +* The summary is created by: +* 1. Removing import statements +* 2. Removing JSX/MDX expressions +* 3. Extracting only text content from JSX/HTML elements +* 4. Truncating to MAX_SUMMARY_LENGTH characters if needed +* +* @param content - The MDX content string +* @returns A summary string, or undefined if no meaningful text content is found +*/ +function extractDocsSummary(content) { + let result = content; + result = result.replace(/^\s*import\s+(?:[\s\S]*?from\s+)?['"][^'"]+['"];?\s*$/gm, ""); + let prevResult = ""; + while (prevResult !== result) { + prevResult = result; + result = result.replace(/\{[^{}]*\}/g, ""); + } + result = result.replace(/<[^>]+\/>/g, ""); + prevResult = ""; + while (prevResult !== result) { + prevResult = result; + result = result.replace(/<(\w+)[^>]*>([\s\S]*?)<\/\1>/g, "$2"); + } + result = result.replace(/<[^>]+>/g, ""); + result = result.replace(/\s+/g, " ").trim(); + if (!result) return; + if (result.length > MAX_SUMMARY_LENGTH) return `${result.slice(0, MAX_SUMMARY_LENGTH)}...`; + return result; +} + +//#endregion +//#region src/utils/manifest-formatter/markdown.ts +/** +* Maximum number of stories to show in full detail in component manifests. +* Remaining stories will be shown as names only. +*/ +const MAX_STORIES_TO_SHOW = 3; +function formatComponentLine(component) { + const summary = component.summary ?? (component.description ? component.description.length > MAX_SUMMARY_LENGTH ? `${component.description.slice(0, MAX_SUMMARY_LENGTH)}...` : component.description : void 0); + if (summary) return `- ${component.name} (${component.id}): ${summary}`; + return `- ${component.name} (${component.id})`; +} +function formatDocLine(doc) { + const title = "title" in doc ? doc.title : void 0; + const content = "content" in doc ? doc.content : void 0; + const summary = doc.summary ?? extractDocsSummary(content ?? ""); + return `- ${title ?? doc.name} (${doc.id})${summary ? `: ${summary}` : ""}`; +} +function formatStorySubLine(story) { + return ` - ${story.name}` + (story.id ? ` (${story.id})` : ""); +} +/** +* Extracts a summary from an object with optional summary and description fields. +* Prefers summary if available, otherwise truncates description to maxLength. +*/ +function extractSummary(item, maxLength = MAX_SUMMARY_LENGTH) { + if (item.summary) return item.summary; + if (item.description) return item.description.length > maxLength ? `${item.description.slice(0, maxLength)}...` : item.description; +} +/** +* Extract parsed docgen from a component manifest, preferring reactDocgen over +* reactDocgenTypescript over reactComponentMeta. +*/ +function getParsedDocgen(componentManifest) { + if (componentManifest.reactDocgen) return parseReactDocgen(componentManifest.reactDocgen); + if (componentManifest.reactDocgenTypescript) return parseReactDocgenTypescript(componentManifest.reactDocgenTypescript); + if (componentManifest.reactComponentMeta) return parseReactComponentMeta(componentManifest.reactComponentMeta); +} +/** +* Formats a story's content (description + code snippet) into markdown. +* Reusable helper for both formatComponentManifest and formatStoryDocumentation. +*/ +function formatStoryContent(story, importStatement) { + const parts = []; + if (story.description) { + parts.push(story.description); + parts.push(""); + } + parts.push("```"); + if (importStatement) { + parts.push(importStatement); + parts.push(""); + } + parts.push(story.snippet ?? ""); + parts.push("```"); + return parts; +} +function formatPropsSection(parsedDocgen, options = {}) { + const propEntries = parsedDocgen ? Object.entries(parsedDocgen.props) : []; + if (propEntries.length === 0) return []; + const title = options.title ?? "## Props"; + const typeName = options.typeName ?? "Props"; + const parts = []; + parts.push(title); + parts.push(""); + parts.push("```"); + parts.push(`export type ${typeName} = {`); + for (const [propName, propInfo] of propEntries) { + const type = propInfo.type ?? "any"; + const isRequired = propInfo.required ?? true; + const hasDefault = propInfo.defaultValue !== void 0; + if (propInfo.description !== void 0) { + parts.push(" /**"); + parts.push(` ${propInfo.description}`); + parts.push(" */"); + } + let propLine = ` ${propName}`; + if (!isRequired) propLine += "?"; + propLine += `: ${type}`; + if (hasDefault) propLine += ` = ${propInfo.defaultValue}`; + propLine += ";"; + parts.push(propLine); + } + parts.push("}"); + parts.push("```"); + parts.push(""); + return parts; +} +function formatSubcomponentsSection(subcomponents) { + if (!subcomponents || Object.keys(subcomponents).length === 0) return []; + const parts = []; + parts.push("## Subcomponents"); + parts.push(""); + for (const [key, subcomponent] of Object.entries(subcomponents)) { + parts.push(`### ${subcomponent.name || key}`); + parts.push(""); + if (subcomponent.summary) { + parts.push(subcomponent.summary); + parts.push(""); + } + if (subcomponent.description) { + parts.push(subcomponent.description); + parts.push(""); + } + if (subcomponent.import) { + parts.push("```"); + parts.push(subcomponent.import); + parts.push("```"); + parts.push(""); + } + if (subcomponent.error) { + parts.push(`Error: ${subcomponent.error.name}`); + parts.push(""); + parts.push("```"); + parts.push(subcomponent.error.message); + parts.push("```"); + parts.push(""); + continue; + } + const parsedDocgen = getParsedDocgen(subcomponent); + const typeName = `${(subcomponent.name || key).replace(/\W+/g, "")}Props`; + parts.push(...formatPropsSection(parsedDocgen, { + title: "#### Props", + typeName + })); + } + return parts; +} +/** +* Format a single component manifest into markdown. +*/ +function formatComponentManifest(componentManifest) { + const parts = []; + parts.push(`# ${componentManifest.name}`); + parts.push(""); + parts.push(`ID: ${componentManifest.id}`); + parts.push(""); + if (componentManifest.description) { + parts.push(componentManifest.description); + parts.push(""); + } + parts.push(...formatSubcomponentsSection(componentManifest.subcomponents)); + const parsedDocgen = getParsedDocgen(componentManifest); + const stories = Array.isArray(componentManifest.stories) ? componentManifest.stories : []; + if (stories.length > 0) { + parts.push("## Stories"); + parts.push(""); + const storiesWithSnippets = stories.filter((s) => s.snippet); + const hasProps = parsedDocgen && Object.keys(parsedDocgen.props).length > 0; + const storiesToShow = hasProps ? storiesWithSnippets.slice(0, MAX_STORIES_TO_SHOW) : storiesWithSnippets; + const remainingStories = hasProps ? storiesWithSnippets.slice(MAX_STORIES_TO_SHOW) : []; + for (const story of storiesToShow) { + parts.push(`### ${story.name}`); + parts.push(""); + if (story.id) { + parts.push(`Story ID: ${story.id}`); + parts.push(""); + } + parts.push(...formatStoryContent(story, componentManifest.import)); + parts.push(""); + } + if (remainingStories.length > 0) { + if (storiesToShow.length > 0) parts.push("### Other Stories"); + parts.push(""); + for (const story of remainingStories) { + const summary = extractSummary(story); + const summaryPart = summary ? `: ${summary}` : ""; + const storyLabel = story.id ? `${story.name} (${story.id})` : story.name; + parts.push(`- ${storyLabel}${summaryPart}`); + } + parts.push(""); + } + } + parts.push(...formatPropsSection(parsedDocgen)); + if (componentManifest.docs && Object.keys(componentManifest.docs).length > 0) { + const docsWithContent = Object.values(componentManifest.docs).filter((doc) => (doc.content ?? "").trim().length > 0); + if (docsWithContent.length > 0) { + parts.push("## Docs"); + parts.push(""); + for (const doc of docsWithContent) { + parts.push(`### ${doc.name}`); + parts.push(""); + parts.push(doc.content ?? ""); + parts.push(""); + } + } + } + return parts.join("\n").trim(); +} +/** +* Format a single doc manifest into markdown. +*/ +function formatDocsManifest(doc) { + return dedent`# ${doc.title ?? doc.name} + + ${doc.content ?? ""}`; +} +/** +* Format a component manifest map into a markdown list. +* @param manifest - The component manifest map to format +* @returns Formatted string representation of the component list +*/ +function formatManifestsToLists(manifests, options = {}) { + const parts = []; + parts.push("# Components"); + parts.push(""); + for (const component of Object.values(manifests.componentManifest.components)) { + parts.push(formatComponentLine(component)); + if (options.withStoryIds && Array.isArray(component.stories)) for (const story of component.stories) parts.push(formatStorySubLine(story)); + } + parts.push(""); + if (!manifests.docsManifest) return parts.join("\n").trim(); + parts.push("# Docs"); + parts.push(""); + for (const doc of Object.values(manifests.docsManifest.docs)) parts.push(formatDocLine(doc)); + return parts.join("\n").trim(); +} +function formatMultiSourceManifestsToLists(manifests, options = {}) { + const parts = []; + for (const { source, componentManifest, docsManifest, error, notice } of manifests) { + parts.push(`# ${source.title}`); + parts.push(`id: ${source.id}`); + parts.push(""); + if (error) { + parts.push(`error: ${error}`); + parts.push(""); + continue; + } + if (notice) { + parts.push(formatRequiresOwnMcpNotice(source, notice.endpoint, { includeHeader: false })); + parts.push(""); + continue; + } + const components = Object.values(componentManifest.components); + if (components.length > 0) { + parts.push("## Components"); + parts.push(""); + for (const component of components) { + parts.push(formatComponentLine(component)); + if (options.withStoryIds && Array.isArray(component.stories)) for (const story of component.stories) parts.push(formatStorySubLine(story)); + } + parts.push(""); + } + if (docsManifest && Object.keys(docsManifest.docs).length > 0) { + parts.push("## Docs"); + parts.push(""); + for (const doc of Object.values(docsManifest.docs)) parts.push(formatDocLine(doc)); + parts.push(""); + } + } + return parts.join("\n").trim(); +} +/** +* Format a single story's documentation. +*/ +function formatStoryDocumentation(componentManifest, storyName) { + const story = Array.isArray(componentManifest.stories) ? componentManifest.stories.find((s) => s.name === storyName) : void 0; + if (!story || !story.snippet) return ""; + const parts = []; + parts.push(`# ${componentManifest.name} - ${story.name}`); + parts.push(""); + parts.push(...formatStoryContent(story, componentManifest.import)); + return parts.join("\n").trim(); +} + +//#endregion +//#region src/tools/list-all-documentation.ts +const LIST_TOOL_NAME = "list-all-documentation"; +const ListAllDocumentationInput = v.object({ withStoryIds: v.optional(v.pipe(v.boolean(), v.description("When true, includes story sub-bullets under each component with story name and story ID. Use this to discover IDs for downstream story-focused workflows without filesystem lookup.")), false) }); +function getListAllDocumentationToolMetadata() { + return { + name: LIST_TOOL_NAME, + title: "List All Documentation", + description: "List all available UI components and documentation entries from the Storybook, returning the IDs the other documentation tools take as input. Call this first for any UI task — before writing a new component, check what the design system already provides and build on it instead of hand-rolling a duplicate; before answering any question about props, API, or usage, discover the relevant IDs here rather than reading component source. Then fetch the entries with get-documentation, referencing only IDs returned here — never guess IDs. When multiple Storybook sources are configured, entries from every source are included; scope follow-up calls to one source via their `storybookId` input. Pass `withStoryIds: true` when you need story IDs for other tools.", + schema: ListAllDocumentationInput + }; +} +async function addListAllDocumentationTool(server, enabled) { + server.tool({ + ...getListAllDocumentationToolMetadata(), + enabled + }, async (input) => { + try { + const ctx = server.ctx.custom; + const withStoryIds = input.withStoryIds ?? false; + if (ctx?.sources?.some((s) => s.url)) { + const multiSourceManifests = await getMultiSourceManifests(ctx.sources, ctx.request, ctx.manifestProvider); + if (withStoryIds) await Promise.all(multiSourceManifests.map(async (sourceManifest) => { + if (sourceManifest.error || sourceManifest.notice) return; + try { + const components = sourceManifest.componentManifest.components; + const resolved = await mapWithConcurrency(Object.entries(components), 16, async ([id, component]) => { + return [id, await resolveComponentStories(component, ctx.request, ctx.manifestProvider, sourceManifest.source)]; + }); + for (const [id, component] of resolved) components[id] = component; + } catch {} + })); + const lists = formatMultiSourceManifestsToLists(multiSourceManifests, { withStoryIds }); + const firstSuccess = multiSourceManifests.find((m) => !m.error && !m.notice); + if (firstSuccess) await ctx.onListAllDocumentation?.({ + context: ctx, + manifests: { + componentManifest: firstSuccess.componentManifest, + docsManifest: firstSuccess.docsManifest + }, + resultText: lists, + sources: multiSourceManifests + }); + return { content: [{ + type: "text", + text: lists + }] }; + } + const manifests = await getManifests(ctx?.request, ctx?.manifestProvider); + if (withStoryIds) { + const components = manifests.componentManifest.components; + const resolved = await mapWithConcurrency(Object.entries(components), 16, async ([id, component]) => { + return [id, await resolveComponentStories(component, ctx?.request, ctx?.manifestProvider)]; + }); + for (const [id, component] of resolved) components[id] = component; + } + const lists = formatManifestsToLists(manifests, { withStoryIds }); + await ctx?.onListAllDocumentation?.({ + context: ctx, + manifests, + resultText: lists + }); + return { content: [{ + type: "text", + text: lists + }] }; + } catch (error) { + return errorToMCPContent(error); + } + }); +} + +//#endregion +//#region src/tools/get-documentation-for-story.ts +const GET_STORY_TOOL_NAME = "get-documentation-for-story"; +const GET_STORY_DOCUMENTATION_TOOL_DESCRIPTION = "Get detailed documentation for a specific story variant of a UI component. Use this when you need to see more usage examples of a component, via the stories written for it."; +const BaseInput$1 = { + componentId: v.string(), + storyName: v.string() +}; +function getStoryDocumentationToolSchema(options) { + return options?.multiSource ? v.object({ + ...BaseInput$1, + ...StorybookIdField + }) : v.object(BaseInput$1); +} +function getStoryDocumentationToolMetadata(options) { + return { + name: GET_STORY_TOOL_NAME, + title: "Get Documentation for Story", + description: GET_STORY_DOCUMENTATION_TOOL_DESCRIPTION, + schema: getStoryDocumentationToolSchema(options) + }; +} +async function addGetStoryDocumentationTool(server, enabled, options) { + server.tool({ + ...getStoryDocumentationToolMetadata(options), + enabled + }, async (input) => { + try { + const ctx = server.ctx.custom; + const { componentId, storyName, storybookId } = input; + const sources = ctx?.sources; + const isMultiSource = sources && sources.some((s) => s.url); + let source; + if (isMultiSource) { + if (!storybookId) return { + content: [{ + type: "text", + text: `storybookId is required. Available sources: ${sources.map((s) => s.id).join(", ")}. Use the ${LIST_TOOL_NAME} tool to see available sources.` + }], + isError: true + }; + source = sources.find((s) => s.id === storybookId); + if (!source) return { + content: [{ + type: "text", + text: `Storybook source not found: "${storybookId}". Available sources: ${sources.map((s) => s.id).join(", ")}. Use the ${LIST_TOOL_NAME} tool to see available sources.` + }], + isError: true + }; + } + let component; + if (ctx?.resolveEntry && !source?.url) { + const resolved = await ctx.resolveEntry(componentId, source); + if (resolved?.kind === "component") component = resolved.component; + } else { + const componentEntry = (await getManifests(ctx?.request, ctx?.manifestProvider, source)).componentManifest?.components[componentId]; + if (componentEntry) component = await resolveComponentEntry(componentEntry, ctx?.request, ctx?.manifestProvider, source); + } + if (!component) return { + content: [{ + type: "text", + text: `Component not found: "${componentId}". Use the list-all-documentation tool to see available components.` + }], + isError: true + }; + if (!(Array.isArray(component.stories) ? component.stories.find((s) => s.name === storyName) : void 0)) return { + content: [{ + type: "text", + text: `Story "${storyName}" not found for component "${componentId}". Available stories: ${Array.isArray(component.stories) ? component.stories.map((s) => s.name).join(", ") : "none"}` + }], + isError: true + }; + return { content: [{ + type: "text", + text: formatStoryDocumentation(component, storyName) + }] }; + } catch (error) { + return errorToMCPContent(error); + } + }); +} + +//#endregion +//#region src/tools/get-documentation.ts +const GET_TOOL_NAME = "get-documentation"; +const BaseInput = { id: v.pipe(v.string(), v.description("The component or docs entry ID (e.g., \"button\")")) }; +const GET_DOCUMENTATION_TOOL_DESCRIPTION = `Get documentation for a UI component or docs entry. + +Returns the first ${MAX_STORIES_TO_SHOW} stories (including story IDs) with code snippets showing how props are used, plus TypeScript prop definitions. Call this before using a component to avoid hallucinating prop names, types, or valid combinations, and to answer any question about a component's props, API, or usage — reading or grepping the component source is not a substitute. Stories reveal real prop usage patterns, interactions, and edge cases that type definitions alone don't show. If the example stories don't show the prop you need, use the ${GET_STORY_TOOL_NAME} tool to fetch the story documentation for the specific story variant you need. + +Example: id="button" returns Primary, Secondary, Large stories with code like