@athenaintel/react 0.20.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +74 -0
- package/dist/assets/use-asset-embed.cjs +8 -0
- package/dist/assets/use-asset-embed.cjs.map +1 -1
- package/dist/assets/use-asset-embed.js +8 -0
- package/dist/assets/use-asset-embed.js.map +1 -1
- package/dist/chat/StatewireApprovalCard.cjs +22 -4
- package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
- package/dist/chat/StatewireApprovalCard.d.ts +14 -0
- package/dist/chat/StatewireApprovalCard.js +23 -5
- package/dist/chat/StatewireApprovalCard.js.map +1 -1
- package/dist/chat/StatewireClientToolBridge.cjs +2 -1
- package/dist/chat/StatewireClientToolBridge.cjs.map +1 -1
- package/dist/chat/StatewireClientToolBridge.js +2 -1
- package/dist/chat/StatewireClientToolBridge.js.map +1 -1
- package/dist/chat/StatewireQueuedMessages.cjs +2 -1
- package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
- package/dist/chat/StatewireQueuedMessages.js +2 -1
- package/dist/chat/StatewireQueuedMessages.js.map +1 -1
- package/dist/chat/athena-citation-links.cjs +17 -1
- package/dist/chat/athena-citation-links.cjs.map +1 -1
- package/dist/chat/athena-citation-links.js +17 -1
- package/dist/chat/athena-citation-links.js.map +1 -1
- package/dist/chat/statewire-client-tools.cjs +2 -1
- package/dist/chat/statewire-client-tools.cjs.map +1 -1
- package/dist/chat/statewire-client-tools.js +2 -1
- package/dist/chat/statewire-client-tools.js.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingCard.cjs +69 -187
- package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingCard.d.ts +10 -6
- package/dist/chat/super-grouping/SuperGroupingCard.js +73 -191
- package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -1
- package/dist/chat/super-grouping/ToolTimeline.cjs +131 -0
- package/dist/chat/super-grouping/ToolTimeline.cjs.map +1 -0
- package/dist/chat/super-grouping/ToolTimeline.d.ts +16 -0
- package/dist/chat/super-grouping/ToolTimeline.js +131 -0
- package/dist/chat/super-grouping/ToolTimeline.js.map +1 -0
- package/dist/chat/super-grouping/activity-timeline.cjs +14 -8
- package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.d.ts +3 -0
- package/dist/chat/super-grouping/activity-timeline.js +14 -8
- package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
- package/dist/chat/super-grouping/timeline-step.cjs +65 -0
- package/dist/chat/super-grouping/timeline-step.cjs.map +1 -0
- package/dist/chat/super-grouping/timeline-step.d.ts +17 -0
- package/dist/chat/super-grouping/timeline-step.js +65 -0
- package/dist/chat/super-grouping/timeline-step.js.map +1 -0
- package/dist/chat/tiptap-text.cjs +8 -8
- package/dist/chat/tiptap-text.cjs.map +1 -1
- package/dist/chat/use-athena-run-live.cjs +2 -1
- package/dist/chat/use-athena-run-live.cjs.map +1 -1
- package/dist/chat/use-athena-run-live.js +2 -1
- package/dist/chat/use-athena-run-live.js.map +1 -1
- package/dist/chat/use-statewire-approval-request.cjs +7 -2
- package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
- package/dist/chat/use-statewire-approval-request.d.ts +12 -2
- package/dist/chat/use-statewire-approval-request.js +8 -3
- package/dist/chat/use-statewire-approval-request.js.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.cjs +24 -65
- package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.js +24 -65
- package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
- package/dist/chat-ui/index.cjs +2 -1
- package/dist/chat-ui/index.cjs.map +1 -1
- package/dist/chat-ui/index.js +2 -1
- package/dist/chat-ui/index.js.map +1 -1
- package/dist/chat-ui/mentions/mention-chip.cjs +49 -4
- package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
- package/dist/chat-ui/mentions/mention-chip.d.ts +11 -0
- package/dist/chat-ui/mentions/mention-chip.js +50 -5
- package/dist/chat-ui/mentions/mention-chip.js.map +1 -1
- package/dist/chat-ui/mentions/mention-extension.cjs +18 -6
- package/dist/chat-ui/mentions/mention-extension.cjs.map +1 -1
- package/dist/chat-ui/mentions/mention-extension.d.ts +2 -0
- package/dist/chat-ui/mentions/mention-extension.js +18 -6
- package/dist/chat-ui/mentions/mention-extension.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.cjs +1 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.js +1 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/menu-item.cjs +9 -6
- package/dist/chat-ui/mentions/suggestions/components/menu-item.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/menu-item.d.ts +2 -2
- package/dist/chat-ui/mentions/suggestions/components/menu-item.js +10 -7
- package/dist/chat-ui/mentions/suggestions/components/menu-item.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/menu-list.cjs +2 -2
- package/dist/chat-ui/mentions/suggestions/components/menu-list.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/menu-list.d.ts +2 -2
- package/dist/chat-ui/mentions/suggestions/components/menu-list.js +2 -2
- package/dist/chat-ui/mentions/suggestions/components/menu-list.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/api-client.cjs +2 -1
- package/dist/chat-ui/mentions/suggestions/data/api-client.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/api-client.d.ts +3 -2
- package/dist/chat-ui/mentions/suggestions/data/api-client.js +2 -1
- package/dist/chat-ui/mentions/suggestions/data/api-client.js.map +1 -1
- package/dist/chat-ui/messages/message-components.cjs +6 -29
- package/dist/chat-ui/messages/message-components.cjs.map +1 -1
- package/dist/chat-ui/messages/message-components.d.ts +1 -13
- package/dist/chat-ui/messages/message-components.js +8 -31
- package/dist/chat-ui/messages/message-components.js.map +1 -1
- package/dist/chat-ui/messages/runtime-message.cjs +3 -2
- package/dist/chat-ui/messages/runtime-message.cjs.map +1 -1
- package/dist/chat-ui/messages/runtime-message.js +3 -2
- package/dist/chat-ui/messages/runtime-message.js.map +1 -1
- package/dist/chat-ui/messages/statewire-continue-run.cjs +23 -8
- package/dist/chat-ui/messages/statewire-continue-run.cjs.map +1 -1
- package/dist/chat-ui/messages/statewire-continue-run.d.ts +14 -4
- package/dist/chat-ui/messages/statewire-continue-run.js +23 -8
- package/dist/chat-ui/messages/statewire-continue-run.js.map +1 -1
- package/dist/chat-ui/messages/user-edit-composer.cjs +2 -1
- package/dist/chat-ui/messages/user-edit-composer.cjs.map +1 -1
- package/dist/chat-ui/messages/user-edit-composer.js +2 -1
- package/dist/chat-ui/messages/user-edit-composer.js.map +1 -1
- package/dist/chat-ui/rich-text/chat-message-body.cjs +76 -0
- package/dist/chat-ui/rich-text/chat-message-body.cjs.map +1 -0
- package/dist/chat-ui/rich-text/chat-message-body.d.ts +5 -0
- package/dist/chat-ui/rich-text/chat-message-body.js +76 -0
- package/dist/chat-ui/rich-text/chat-message-body.js.map +1 -0
- package/dist/chat-ui/rich-text/chat-node-views.cjs +51 -0
- package/dist/chat-ui/rich-text/chat-node-views.cjs.map +1 -0
- package/dist/chat-ui/rich-text/chat-node-views.d.ts +13 -0
- package/dist/chat-ui/rich-text/chat-node-views.js +51 -0
- package/dist/chat-ui/rich-text/chat-node-views.js.map +1 -0
- package/dist/chat-ui/rich-text/chat-text-schema.cjs +70 -0
- package/dist/chat-ui/rich-text/chat-text-schema.cjs.map +1 -0
- package/dist/chat-ui/rich-text/chat-text-schema.d.ts +7 -0
- package/dist/chat-ui/rich-text/chat-text-schema.js +70 -0
- package/dist/chat-ui/rich-text/chat-text-schema.js.map +1 -0
- package/dist/chat-ui/rich-text/dom-output-spec.cjs +83 -0
- package/dist/chat-ui/rich-text/dom-output-spec.cjs.map +1 -0
- package/dist/chat-ui/rich-text/dom-output-spec.d.ts +11 -0
- package/dist/chat-ui/rich-text/dom-output-spec.js +83 -0
- package/dist/chat-ui/rich-text/dom-output-spec.js.map +1 -0
- package/dist/chat-ui/statewire.cjs +2 -1
- package/dist/chat-ui/statewire.cjs.map +1 -1
- package/dist/chat-ui/statewire.js +2 -1
- package/dist/chat-ui/statewire.js.map +1 -1
- package/dist/chat-ui/thread/statewire-history-edge.cjs +2 -1
- package/dist/chat-ui/thread/statewire-history-edge.cjs.map +1 -1
- package/dist/chat-ui/thread/statewire-history-edge.js +2 -1
- package/dist/chat-ui/thread/statewire-history-edge.js.map +1 -1
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/node_modules/qrcode-generator/dist/qrcode.cjs +32 -0
- package/dist/node_modules/qrcode-generator/dist/qrcode.cjs.map +1 -0
- package/dist/node_modules/qrcode-generator/dist/qrcode.js +31 -0
- package/dist/node_modules/qrcode-generator/dist/qrcode.js.map +1 -0
- package/dist/node_modules/zod/v4/classic/errors.cjs +44 -0
- package/dist/node_modules/zod/v4/classic/errors.cjs.map +1 -0
- package/dist/node_modules/zod/v4/classic/errors.js +44 -0
- package/dist/node_modules/zod/v4/classic/errors.js.map +1 -0
- package/dist/node_modules/zod/v4/classic/iso.cjs +43 -0
- package/dist/node_modules/zod/v4/classic/iso.cjs.map +1 -0
- package/dist/node_modules/zod/v4/classic/iso.js +43 -0
- package/dist/node_modules/zod/v4/classic/iso.js.map +1 -0
- package/dist/node_modules/zod/v4/classic/parse.cjs +29 -0
- package/dist/node_modules/zod/v4/classic/parse.cjs.map +1 -0
- package/dist/node_modules/zod/v4/classic/parse.js +29 -0
- package/dist/node_modules/zod/v4/classic/parse.js.map +1 -0
- package/dist/node_modules/zod/v4/classic/schemas.cjs +871 -0
- package/dist/node_modules/zod/v4/classic/schemas.cjs.map +1 -0
- package/dist/node_modules/zod/v4/classic/schemas.js +871 -0
- package/dist/node_modules/zod/v4/classic/schemas.js.map +1 -0
- package/dist/node_modules/zod/v4/core/api.cjs +570 -0
- package/dist/node_modules/zod/v4/core/api.cjs.map +1 -0
- package/dist/node_modules/zod/v4/core/api.js +570 -0
- package/dist/node_modules/zod/v4/core/api.js.map +1 -0
- package/dist/node_modules/zod/v4/core/checks.cjs +411 -0
- package/dist/node_modules/zod/v4/core/checks.cjs.map +1 -0
- package/dist/node_modules/zod/v4/core/checks.js +411 -0
- package/dist/node_modules/zod/v4/core/checks.js.map +1 -0
- package/dist/node_modules/zod/v4/core/core.cjs +77 -0
- package/dist/node_modules/zod/v4/core/core.cjs.map +1 -0
- package/dist/node_modules/zod/v4/core/core.js +77 -0
- package/dist/node_modules/zod/v4/core/core.js.map +1 -0
- package/dist/node_modules/zod/v4/core/doc.cjs +38 -0
- package/dist/node_modules/zod/v4/core/doc.cjs.map +1 -0
- package/dist/node_modules/zod/v4/core/doc.js +38 -0
- package/dist/node_modules/zod/v4/core/doc.js.map +1 -0
- package/dist/node_modules/zod/v4/core/errors.cjs +76 -0
- package/dist/node_modules/zod/v4/core/errors.cjs.map +1 -0
- package/dist/node_modules/zod/v4/core/errors.js +76 -0
- package/dist/node_modules/zod/v4/core/errors.js.map +1 -0
- package/dist/node_modules/zod/v4/core/json-schema-processors.cjs +312 -0
- package/dist/node_modules/zod/v4/core/json-schema-processors.cjs.map +1 -0
- package/dist/node_modules/zod/v4/core/json-schema-processors.js +312 -0
- package/dist/node_modules/zod/v4/core/json-schema-processors.js.map +1 -0
- package/dist/node_modules/zod/v4/core/parse.cjs +96 -0
- package/dist/node_modules/zod/v4/core/parse.cjs.map +1 -0
- package/dist/node_modules/zod/v4/core/parse.js +96 -0
- package/dist/node_modules/zod/v4/core/parse.js.map +1 -0
- package/dist/node_modules/zod/v4/core/regexes.cjs +86 -0
- package/dist/node_modules/zod/v4/core/regexes.cjs.map +1 -0
- package/dist/node_modules/zod/v4/core/regexes.js +86 -0
- package/dist/node_modules/zod/v4/core/regexes.js.map +1 -0
- package/dist/node_modules/zod/v4/core/registries.cjs +52 -0
- package/dist/node_modules/zod/v4/core/registries.cjs.map +1 -0
- package/dist/node_modules/zod/v4/core/registries.js +52 -0
- package/dist/node_modules/zod/v4/core/registries.js.map +1 -0
- package/dist/node_modules/zod/v4/core/schemas.cjs +1412 -0
- package/dist/node_modules/zod/v4/core/schemas.cjs.map +1 -0
- package/dist/node_modules/zod/v4/core/schemas.js +1413 -0
- package/dist/node_modules/zod/v4/core/schemas.js.map +1 -0
- package/dist/node_modules/zod/v4/core/to-json-schema.cjs +370 -0
- package/dist/node_modules/zod/v4/core/to-json-schema.cjs.map +1 -0
- package/dist/node_modules/zod/v4/core/to-json-schema.js +370 -0
- package/dist/node_modules/zod/v4/core/to-json-schema.js.map +1 -0
- package/dist/node_modules/zod/v4/core/util.cjs +444 -0
- package/dist/node_modules/zod/v4/core/util.cjs.map +1 -0
- package/dist/node_modules/zod/v4/core/util.js +444 -0
- package/dist/node_modules/zod/v4/core/util.js.map +1 -0
- package/dist/node_modules/zod/v4/core/versions.cjs +9 -0
- package/dist/node_modules/zod/v4/core/versions.cjs.map +1 -0
- package/dist/node_modules/zod/v4/core/versions.js +9 -0
- package/dist/node_modules/zod/v4/core/versions.js.map +1 -0
- package/dist/packages/agent-runtime/src/client-tool-bridge.cjs +7 -1
- package/dist/packages/agent-runtime/src/client-tool-bridge.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/client-tool-bridge.js +7 -1
- package/dist/packages/agent-runtime/src/client-tool-bridge.js.map +1 -1
- package/dist/packages/agent-runtime/src/conversation-list.cjs +4 -0
- package/dist/packages/agent-runtime/src/conversation-list.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/conversation-list.js +4 -0
- package/dist/packages/agent-runtime/src/conversation-list.js.map +1 -1
- package/dist/packages/agent-runtime/src/edit-command.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/edit-command.js.map +1 -1
- package/dist/packages/agent-runtime/src/generated/runconfig-contract.cjs +2 -0
- package/dist/packages/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/generated/runconfig-contract.js +2 -0
- package/dist/packages/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
- package/dist/packages/agent-runtime/src/interrupts.cjs +31 -7
- package/dist/packages/agent-runtime/src/interrupts.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/interrupts.js +31 -7
- package/dist/packages/agent-runtime/src/interrupts.js.map +1 -1
- package/dist/packages/agent-runtime/src/messages.cjs +35 -5
- package/dist/packages/agent-runtime/src/messages.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/messages.js +35 -5
- package/dist/packages/agent-runtime/src/messages.js.map +1 -1
- package/dist/packages/agent-runtime/src/protocol.cjs +4 -6
- package/dist/packages/agent-runtime/src/protocol.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/protocol.js +4 -6
- package/dist/packages/agent-runtime/src/protocol.js.map +1 -1
- package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.cjs +296 -14
- package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.js +293 -11
- package/dist/packages/agent-runtime/src/quota-safe-local-storage-session.js.map +1 -1
- package/dist/packages/agent-runtime/src/screen-point.cjs +68 -0
- package/dist/packages/agent-runtime/src/screen-point.cjs.map +1 -0
- package/dist/packages/agent-runtime/src/screen-point.js +68 -0
- package/dist/packages/agent-runtime/src/screen-point.js.map +1 -0
- package/dist/packages/agent-runtime/src/statewire-transport.cjs +6 -1
- package/dist/packages/agent-runtime/src/statewire-transport.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/statewire-transport.js +6 -1
- package/dist/packages/agent-runtime/src/statewire-transport.js.map +1 -1
- package/dist/packages/agent-runtime/src/thread-handoff.cjs +85 -0
- package/dist/packages/agent-runtime/src/thread-handoff.cjs.map +1 -0
- package/dist/packages/agent-runtime/src/thread-handoff.js +85 -0
- package/dist/packages/agent-runtime/src/thread-handoff.js.map +1 -0
- package/dist/packages/agent-runtime/src/thread-snapshot-cache.cjs +1 -1
- package/dist/packages/agent-runtime/src/thread-snapshot-cache.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/thread-snapshot-cache.js +1 -1
- package/dist/packages/agent-runtime/src/thread-snapshot-cache.js.map +1 -1
- package/dist/packages/agent-runtime/src/tool-metadata.cjs +0 -8
- package/dist/packages/agent-runtime/src/tool-metadata.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/tool-metadata.js +0 -8
- package/dist/packages/agent-runtime/src/tool-metadata.js.map +1 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-config.cjs +14 -0
- package/dist/packages/agent-runtime/src/use-deep-agent-config.cjs.map +1 -0
- package/dist/packages/agent-runtime/src/use-deep-agent-config.js +14 -0
- package/dist/packages/agent-runtime/src/use-deep-agent-config.js.map +1 -0
- package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.cjs +21 -5
- package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.js +21 -5
- package/dist/packages/agent-runtime/src/use-deep-agent-edit-submit.js.map +1 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-runtime.cjs +13 -3
- package/dist/packages/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-runtime.js +14 -4
- package/dist/packages/agent-runtime/src/use-deep-agent-runtime.js.map +1 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-thread.cjs +35 -15
- package/dist/packages/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/use-deep-agent-thread.js +35 -15
- package/dist/packages/agent-runtime/src/use-deep-agent-thread.js.map +1 -1
- package/dist/packages/agent-runtime/src/voice-presentation.cjs.map +1 -1
- package/dist/packages/agent-runtime/src/voice-presentation.js.map +1 -1
- package/dist/packages/react/package.json.cjs +1 -1
- package/dist/packages/react/package.json.js +1 -1
- package/dist/provider/AthenaProvider.cjs +2 -1
- package/dist/provider/AthenaProvider.cjs.map +1 -1
- package/dist/provider/AthenaProvider.js +2 -1
- package/dist/provider/AthenaProvider.js.map +1 -1
- package/dist/runtime/statewire-lifecycle.cjs +2 -1
- package/dist/runtime/statewire-lifecycle.cjs.map +1 -1
- package/dist/runtime/statewire-lifecycle.js +2 -1
- package/dist/runtime/statewire-lifecycle.js.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.cjs +2 -1
- package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.js +2 -1
- package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/threads/conversation-list-fetcher.cjs +4 -0
- package/dist/threads/conversation-list-fetcher.cjs.map +1 -1
- package/dist/threads/conversation-list-fetcher.js +4 -0
- package/dist/threads/conversation-list-fetcher.js.map +1 -1
- package/dist/threads/statewire-thread-list.cjs +2 -1
- package/dist/threads/statewire-thread-list.cjs.map +1 -1
- package/dist/threads/statewire-thread-list.js +2 -1
- package/dist/threads/statewire-thread-list.js.map +1 -1
- package/dist/threads/use-rest-conversation-history.cjs +2 -1
- package/dist/threads/use-rest-conversation-history.cjs.map +1 -1
- package/dist/threads/use-rest-conversation-history.js +2 -1
- package/dist/threads/use-rest-conversation-history.js.map +1 -1
- package/dist/threads/use-statewire-conversation-history.cjs +2 -1
- package/dist/threads/use-statewire-conversation-history.cjs.map +1 -1
- package/dist/threads/use-statewire-conversation-history.d.ts +1 -0
- package/dist/threads/use-statewire-conversation-history.js +2 -1
- package/dist/threads/use-statewire-conversation-history.js.map +1 -1
- package/dist/tools/index.cjs +2 -1
- package/dist/tools/index.cjs.map +1 -1
- package/dist/tools/index.js +2 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/misc-tool-uis.cjs +2 -1
- package/dist/tools/misc-tool-uis.cjs.map +1 -1
- package/dist/tools/misc-tool-uis.js +2 -1
- package/dist/tools/misc-tool-uis.js.map +1 -1
- package/dist/tools/primitives.cjs +2 -1
- package/dist/tools/primitives.cjs.map +1 -1
- package/dist/tools/primitives.js +2 -1
- package/dist/tools/primitives.js.map +1 -1
- package/dist/tools/tool-fallback.cjs +2 -1
- package/dist/tools/tool-fallback.cjs.map +1 -1
- package/dist/tools/tool-fallback.js +2 -1
- package/dist/tools/tool-fallback.js.map +1 -1
- package/dist/tools/voice-update-tool-ui.cjs +2 -1
- package/dist/tools/voice-update-tool-ui.cjs.map +1 -1
- package/dist/tools/voice-update-tool-ui.js +2 -1
- package/dist/tools/voice-update-tool-ui.js.map +1 -1
- package/dist/voice/index.cjs +6 -0
- package/dist/voice/index.cjs.map +1 -0
- package/dist/voice/index.d.ts +2 -0
- package/dist/voice/index.js +6 -0
- package/dist/voice/index.js.map +1 -0
- package/dist/voice/use-athena-voice-session.cjs +315 -0
- package/dist/voice/use-athena-voice-session.cjs.map +1 -0
- package/dist/voice/use-athena-voice-session.d.ts +145 -0
- package/dist/voice/use-athena-voice-session.js +315 -0
- package/dist/voice/use-athena-voice-session.js.map +1 -0
- package/package.json +17 -3
|
@@ -0,0 +1,1412 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const checks = require("./checks.cjs");
|
|
4
|
+
const core = require("./core.cjs");
|
|
5
|
+
const doc = require("./doc.cjs");
|
|
6
|
+
const parse = require("./parse.cjs");
|
|
7
|
+
const regexes = require("./regexes.cjs");
|
|
8
|
+
const util = require("./util.cjs");
|
|
9
|
+
const versions = require("./versions.cjs");
|
|
10
|
+
const $ZodType = /* @__PURE__ */ core.$constructor("$ZodType", (inst, def) => {
|
|
11
|
+
var _a2;
|
|
12
|
+
var _a;
|
|
13
|
+
inst ?? (inst = {});
|
|
14
|
+
inst._zod.def = def;
|
|
15
|
+
inst._zod.bag = inst._zod.bag || {};
|
|
16
|
+
inst._zod.version = versions.version;
|
|
17
|
+
const checks2 = [...inst._zod.def.checks ?? []];
|
|
18
|
+
if (inst._zod.traits.has("$ZodCheck")) {
|
|
19
|
+
checks2.unshift(inst);
|
|
20
|
+
}
|
|
21
|
+
for (const ch of checks2) {
|
|
22
|
+
for (const fn of ch._zod.onattach) {
|
|
23
|
+
fn(inst);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (checks2.length === 0) {
|
|
27
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
28
|
+
(_a2 = inst._zod.deferred) == null ? void 0 : _a2.push(() => {
|
|
29
|
+
inst._zod.run = inst._zod.parse;
|
|
30
|
+
});
|
|
31
|
+
} else {
|
|
32
|
+
const runChecks = (payload, checks3, ctx) => {
|
|
33
|
+
let isAborted = util.aborted(payload);
|
|
34
|
+
let asyncResult;
|
|
35
|
+
for (const ch of checks3) {
|
|
36
|
+
if (ch._zod.def.when) {
|
|
37
|
+
if (util.explicitlyAborted(payload))
|
|
38
|
+
continue;
|
|
39
|
+
const shouldRun = ch._zod.def.when(payload);
|
|
40
|
+
if (!shouldRun)
|
|
41
|
+
continue;
|
|
42
|
+
} else if (isAborted) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
const currLen = payload.issues.length;
|
|
46
|
+
const _ = ch._zod.check(payload);
|
|
47
|
+
if (_ instanceof Promise && (ctx == null ? void 0 : ctx.async) === false) {
|
|
48
|
+
throw new core.$ZodAsyncError();
|
|
49
|
+
}
|
|
50
|
+
if (asyncResult || _ instanceof Promise) {
|
|
51
|
+
asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
52
|
+
await _;
|
|
53
|
+
const nextLen = payload.issues.length;
|
|
54
|
+
if (nextLen === currLen)
|
|
55
|
+
return;
|
|
56
|
+
if (!isAborted)
|
|
57
|
+
isAborted = util.aborted(payload, currLen);
|
|
58
|
+
});
|
|
59
|
+
} else {
|
|
60
|
+
const nextLen = payload.issues.length;
|
|
61
|
+
if (nextLen === currLen)
|
|
62
|
+
continue;
|
|
63
|
+
if (!isAborted)
|
|
64
|
+
isAborted = util.aborted(payload, currLen);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (asyncResult) {
|
|
68
|
+
return asyncResult.then(() => {
|
|
69
|
+
return payload;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
return payload;
|
|
73
|
+
};
|
|
74
|
+
const handleCanaryResult = (canary, payload, ctx) => {
|
|
75
|
+
if (util.aborted(canary)) {
|
|
76
|
+
canary.aborted = true;
|
|
77
|
+
return canary;
|
|
78
|
+
}
|
|
79
|
+
const checkResult = runChecks(payload, checks2, ctx);
|
|
80
|
+
if (checkResult instanceof Promise) {
|
|
81
|
+
if (ctx.async === false)
|
|
82
|
+
throw new core.$ZodAsyncError();
|
|
83
|
+
return checkResult.then((checkResult2) => inst._zod.parse(checkResult2, ctx));
|
|
84
|
+
}
|
|
85
|
+
return inst._zod.parse(checkResult, ctx);
|
|
86
|
+
};
|
|
87
|
+
inst._zod.run = (payload, ctx) => {
|
|
88
|
+
if (ctx.skipChecks) {
|
|
89
|
+
return inst._zod.parse(payload, ctx);
|
|
90
|
+
}
|
|
91
|
+
if (ctx.direction === "backward") {
|
|
92
|
+
const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
|
|
93
|
+
if (canary instanceof Promise) {
|
|
94
|
+
return canary.then((canary2) => {
|
|
95
|
+
return handleCanaryResult(canary2, payload, ctx);
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
return handleCanaryResult(canary, payload, ctx);
|
|
99
|
+
}
|
|
100
|
+
const result = inst._zod.parse(payload, ctx);
|
|
101
|
+
if (result instanceof Promise) {
|
|
102
|
+
if (ctx.async === false)
|
|
103
|
+
throw new core.$ZodAsyncError();
|
|
104
|
+
return result.then((result2) => runChecks(result2, checks2, ctx));
|
|
105
|
+
}
|
|
106
|
+
return runChecks(result, checks2, ctx);
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
util.defineLazy(inst, "~standard", () => ({
|
|
110
|
+
validate: (value) => {
|
|
111
|
+
var _a3;
|
|
112
|
+
try {
|
|
113
|
+
const r = parse.safeParse(inst, value);
|
|
114
|
+
return r.success ? { value: r.data } : { issues: (_a3 = r.error) == null ? void 0 : _a3.issues };
|
|
115
|
+
} catch (_) {
|
|
116
|
+
return parse.safeParseAsync(inst, value).then((r) => {
|
|
117
|
+
var _a4;
|
|
118
|
+
return r.success ? { value: r.data } : { issues: (_a4 = r.error) == null ? void 0 : _a4.issues };
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
vendor: "zod",
|
|
123
|
+
version: 1
|
|
124
|
+
}));
|
|
125
|
+
});
|
|
126
|
+
const $ZodString = /* @__PURE__ */ core.$constructor("$ZodString", (inst, def) => {
|
|
127
|
+
var _a;
|
|
128
|
+
$ZodType.init(inst, def);
|
|
129
|
+
inst._zod.pattern = [...((_a = inst == null ? void 0 : inst._zod.bag) == null ? void 0 : _a.patterns) ?? []].pop() ?? regexes.string(inst._zod.bag);
|
|
130
|
+
inst._zod.parse = (payload, _) => {
|
|
131
|
+
if (def.coerce)
|
|
132
|
+
try {
|
|
133
|
+
payload.value = String(payload.value);
|
|
134
|
+
} catch (_2) {
|
|
135
|
+
}
|
|
136
|
+
if (typeof payload.value === "string")
|
|
137
|
+
return payload;
|
|
138
|
+
payload.issues.push({
|
|
139
|
+
expected: "string",
|
|
140
|
+
code: "invalid_type",
|
|
141
|
+
input: payload.value,
|
|
142
|
+
inst
|
|
143
|
+
});
|
|
144
|
+
return payload;
|
|
145
|
+
};
|
|
146
|
+
});
|
|
147
|
+
const $ZodStringFormat = /* @__PURE__ */ core.$constructor("$ZodStringFormat", (inst, def) => {
|
|
148
|
+
checks.$ZodCheckStringFormat.init(inst, def);
|
|
149
|
+
$ZodString.init(inst, def);
|
|
150
|
+
});
|
|
151
|
+
const $ZodGUID = /* @__PURE__ */ core.$constructor("$ZodGUID", (inst, def) => {
|
|
152
|
+
def.pattern ?? (def.pattern = regexes.guid);
|
|
153
|
+
$ZodStringFormat.init(inst, def);
|
|
154
|
+
});
|
|
155
|
+
const $ZodUUID = /* @__PURE__ */ core.$constructor("$ZodUUID", (inst, def) => {
|
|
156
|
+
if (def.version) {
|
|
157
|
+
const versionMap = {
|
|
158
|
+
v1: 1,
|
|
159
|
+
v2: 2,
|
|
160
|
+
v3: 3,
|
|
161
|
+
v4: 4,
|
|
162
|
+
v5: 5,
|
|
163
|
+
v6: 6,
|
|
164
|
+
v7: 7,
|
|
165
|
+
v8: 8
|
|
166
|
+
};
|
|
167
|
+
const v = versionMap[def.version];
|
|
168
|
+
if (v === void 0)
|
|
169
|
+
throw new Error(`Invalid UUID version: "${def.version}"`);
|
|
170
|
+
def.pattern ?? (def.pattern = regexes.uuid(v));
|
|
171
|
+
} else
|
|
172
|
+
def.pattern ?? (def.pattern = regexes.uuid());
|
|
173
|
+
$ZodStringFormat.init(inst, def);
|
|
174
|
+
});
|
|
175
|
+
const $ZodEmail = /* @__PURE__ */ core.$constructor("$ZodEmail", (inst, def) => {
|
|
176
|
+
def.pattern ?? (def.pattern = regexes.email);
|
|
177
|
+
$ZodStringFormat.init(inst, def);
|
|
178
|
+
});
|
|
179
|
+
const $ZodURL = /* @__PURE__ */ core.$constructor("$ZodURL", (inst, def) => {
|
|
180
|
+
$ZodStringFormat.init(inst, def);
|
|
181
|
+
inst._zod.check = (payload) => {
|
|
182
|
+
var _a;
|
|
183
|
+
try {
|
|
184
|
+
const trimmed = payload.value.trim();
|
|
185
|
+
if (!def.normalize && ((_a = def.protocol) == null ? void 0 : _a.source) === regexes.httpProtocol.source) {
|
|
186
|
+
if (!/^https?:\/\//i.test(trimmed)) {
|
|
187
|
+
payload.issues.push({
|
|
188
|
+
code: "invalid_format",
|
|
189
|
+
format: "url",
|
|
190
|
+
note: "Invalid URL format",
|
|
191
|
+
input: payload.value,
|
|
192
|
+
inst,
|
|
193
|
+
continue: !def.abort
|
|
194
|
+
});
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
const url = new URL(trimmed);
|
|
199
|
+
if (def.hostname) {
|
|
200
|
+
def.hostname.lastIndex = 0;
|
|
201
|
+
if (!def.hostname.test(url.hostname)) {
|
|
202
|
+
payload.issues.push({
|
|
203
|
+
code: "invalid_format",
|
|
204
|
+
format: "url",
|
|
205
|
+
note: "Invalid hostname",
|
|
206
|
+
pattern: def.hostname.source,
|
|
207
|
+
input: payload.value,
|
|
208
|
+
inst,
|
|
209
|
+
continue: !def.abort
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
if (def.protocol) {
|
|
214
|
+
def.protocol.lastIndex = 0;
|
|
215
|
+
if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) {
|
|
216
|
+
payload.issues.push({
|
|
217
|
+
code: "invalid_format",
|
|
218
|
+
format: "url",
|
|
219
|
+
note: "Invalid protocol",
|
|
220
|
+
pattern: def.protocol.source,
|
|
221
|
+
input: payload.value,
|
|
222
|
+
inst,
|
|
223
|
+
continue: !def.abort
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
if (def.normalize) {
|
|
228
|
+
payload.value = url.href;
|
|
229
|
+
} else {
|
|
230
|
+
payload.value = trimmed;
|
|
231
|
+
}
|
|
232
|
+
return;
|
|
233
|
+
} catch (_) {
|
|
234
|
+
payload.issues.push({
|
|
235
|
+
code: "invalid_format",
|
|
236
|
+
format: "url",
|
|
237
|
+
input: payload.value,
|
|
238
|
+
inst,
|
|
239
|
+
continue: !def.abort
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
});
|
|
244
|
+
const $ZodEmoji = /* @__PURE__ */ core.$constructor("$ZodEmoji", (inst, def) => {
|
|
245
|
+
def.pattern ?? (def.pattern = regexes.emoji());
|
|
246
|
+
$ZodStringFormat.init(inst, def);
|
|
247
|
+
});
|
|
248
|
+
const $ZodNanoID = /* @__PURE__ */ core.$constructor("$ZodNanoID", (inst, def) => {
|
|
249
|
+
def.pattern ?? (def.pattern = regexes.nanoid);
|
|
250
|
+
$ZodStringFormat.init(inst, def);
|
|
251
|
+
});
|
|
252
|
+
const $ZodCUID = /* @__PURE__ */ core.$constructor("$ZodCUID", (inst, def) => {
|
|
253
|
+
def.pattern ?? (def.pattern = regexes.cuid);
|
|
254
|
+
$ZodStringFormat.init(inst, def);
|
|
255
|
+
});
|
|
256
|
+
const $ZodCUID2 = /* @__PURE__ */ core.$constructor("$ZodCUID2", (inst, def) => {
|
|
257
|
+
def.pattern ?? (def.pattern = regexes.cuid2);
|
|
258
|
+
$ZodStringFormat.init(inst, def);
|
|
259
|
+
});
|
|
260
|
+
const $ZodULID = /* @__PURE__ */ core.$constructor("$ZodULID", (inst, def) => {
|
|
261
|
+
def.pattern ?? (def.pattern = regexes.ulid);
|
|
262
|
+
$ZodStringFormat.init(inst, def);
|
|
263
|
+
});
|
|
264
|
+
const $ZodXID = /* @__PURE__ */ core.$constructor("$ZodXID", (inst, def) => {
|
|
265
|
+
def.pattern ?? (def.pattern = regexes.xid);
|
|
266
|
+
$ZodStringFormat.init(inst, def);
|
|
267
|
+
});
|
|
268
|
+
const $ZodKSUID = /* @__PURE__ */ core.$constructor("$ZodKSUID", (inst, def) => {
|
|
269
|
+
def.pattern ?? (def.pattern = regexes.ksuid);
|
|
270
|
+
$ZodStringFormat.init(inst, def);
|
|
271
|
+
});
|
|
272
|
+
const $ZodISODateTime = /* @__PURE__ */ core.$constructor("$ZodISODateTime", (inst, def) => {
|
|
273
|
+
def.pattern ?? (def.pattern = regexes.datetime(def));
|
|
274
|
+
$ZodStringFormat.init(inst, def);
|
|
275
|
+
});
|
|
276
|
+
const $ZodISODate = /* @__PURE__ */ core.$constructor("$ZodISODate", (inst, def) => {
|
|
277
|
+
def.pattern ?? (def.pattern = regexes.date);
|
|
278
|
+
$ZodStringFormat.init(inst, def);
|
|
279
|
+
});
|
|
280
|
+
const $ZodISOTime = /* @__PURE__ */ core.$constructor("$ZodISOTime", (inst, def) => {
|
|
281
|
+
def.pattern ?? (def.pattern = regexes.time(def));
|
|
282
|
+
$ZodStringFormat.init(inst, def);
|
|
283
|
+
});
|
|
284
|
+
const $ZodISODuration = /* @__PURE__ */ core.$constructor("$ZodISODuration", (inst, def) => {
|
|
285
|
+
def.pattern ?? (def.pattern = regexes.duration);
|
|
286
|
+
$ZodStringFormat.init(inst, def);
|
|
287
|
+
});
|
|
288
|
+
const $ZodIPv4 = /* @__PURE__ */ core.$constructor("$ZodIPv4", (inst, def) => {
|
|
289
|
+
def.pattern ?? (def.pattern = regexes.ipv4);
|
|
290
|
+
$ZodStringFormat.init(inst, def);
|
|
291
|
+
inst._zod.bag.format = `ipv4`;
|
|
292
|
+
});
|
|
293
|
+
const $ZodIPv6 = /* @__PURE__ */ core.$constructor("$ZodIPv6", (inst, def) => {
|
|
294
|
+
def.pattern ?? (def.pattern = regexes.ipv6);
|
|
295
|
+
$ZodStringFormat.init(inst, def);
|
|
296
|
+
inst._zod.bag.format = `ipv6`;
|
|
297
|
+
inst._zod.check = (payload) => {
|
|
298
|
+
try {
|
|
299
|
+
new URL(`http://[${payload.value}]`);
|
|
300
|
+
} catch {
|
|
301
|
+
payload.issues.push({
|
|
302
|
+
code: "invalid_format",
|
|
303
|
+
format: "ipv6",
|
|
304
|
+
input: payload.value,
|
|
305
|
+
inst,
|
|
306
|
+
continue: !def.abort
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
};
|
|
310
|
+
});
|
|
311
|
+
const $ZodCIDRv4 = /* @__PURE__ */ core.$constructor("$ZodCIDRv4", (inst, def) => {
|
|
312
|
+
def.pattern ?? (def.pattern = regexes.cidrv4);
|
|
313
|
+
$ZodStringFormat.init(inst, def);
|
|
314
|
+
});
|
|
315
|
+
const $ZodCIDRv6 = /* @__PURE__ */ core.$constructor("$ZodCIDRv6", (inst, def) => {
|
|
316
|
+
def.pattern ?? (def.pattern = regexes.cidrv6);
|
|
317
|
+
$ZodStringFormat.init(inst, def);
|
|
318
|
+
inst._zod.check = (payload) => {
|
|
319
|
+
const parts = payload.value.split("/");
|
|
320
|
+
try {
|
|
321
|
+
if (parts.length !== 2)
|
|
322
|
+
throw new Error();
|
|
323
|
+
const [address, prefix] = parts;
|
|
324
|
+
if (!prefix)
|
|
325
|
+
throw new Error();
|
|
326
|
+
const prefixNum = Number(prefix);
|
|
327
|
+
if (`${prefixNum}` !== prefix)
|
|
328
|
+
throw new Error();
|
|
329
|
+
if (prefixNum < 0 || prefixNum > 128)
|
|
330
|
+
throw new Error();
|
|
331
|
+
new URL(`http://[${address}]`);
|
|
332
|
+
} catch {
|
|
333
|
+
payload.issues.push({
|
|
334
|
+
code: "invalid_format",
|
|
335
|
+
format: "cidrv6",
|
|
336
|
+
input: payload.value,
|
|
337
|
+
inst,
|
|
338
|
+
continue: !def.abort
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
});
|
|
343
|
+
function isValidBase64(data) {
|
|
344
|
+
if (data === "")
|
|
345
|
+
return true;
|
|
346
|
+
if (/\s/.test(data))
|
|
347
|
+
return false;
|
|
348
|
+
if (data.length % 4 !== 0)
|
|
349
|
+
return false;
|
|
350
|
+
try {
|
|
351
|
+
atob(data);
|
|
352
|
+
return true;
|
|
353
|
+
} catch {
|
|
354
|
+
return false;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
const $ZodBase64 = /* @__PURE__ */ core.$constructor("$ZodBase64", (inst, def) => {
|
|
358
|
+
def.pattern ?? (def.pattern = regexes.base64);
|
|
359
|
+
$ZodStringFormat.init(inst, def);
|
|
360
|
+
inst._zod.bag.contentEncoding = "base64";
|
|
361
|
+
inst._zod.check = (payload) => {
|
|
362
|
+
if (isValidBase64(payload.value))
|
|
363
|
+
return;
|
|
364
|
+
payload.issues.push({
|
|
365
|
+
code: "invalid_format",
|
|
366
|
+
format: "base64",
|
|
367
|
+
input: payload.value,
|
|
368
|
+
inst,
|
|
369
|
+
continue: !def.abort
|
|
370
|
+
});
|
|
371
|
+
};
|
|
372
|
+
});
|
|
373
|
+
function isValidBase64URL(data) {
|
|
374
|
+
if (!regexes.base64url.test(data))
|
|
375
|
+
return false;
|
|
376
|
+
const base64 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
377
|
+
const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
|
|
378
|
+
return isValidBase64(padded);
|
|
379
|
+
}
|
|
380
|
+
const $ZodBase64URL = /* @__PURE__ */ core.$constructor("$ZodBase64URL", (inst, def) => {
|
|
381
|
+
def.pattern ?? (def.pattern = regexes.base64url);
|
|
382
|
+
$ZodStringFormat.init(inst, def);
|
|
383
|
+
inst._zod.bag.contentEncoding = "base64url";
|
|
384
|
+
inst._zod.check = (payload) => {
|
|
385
|
+
if (isValidBase64URL(payload.value))
|
|
386
|
+
return;
|
|
387
|
+
payload.issues.push({
|
|
388
|
+
code: "invalid_format",
|
|
389
|
+
format: "base64url",
|
|
390
|
+
input: payload.value,
|
|
391
|
+
inst,
|
|
392
|
+
continue: !def.abort
|
|
393
|
+
});
|
|
394
|
+
};
|
|
395
|
+
});
|
|
396
|
+
const $ZodE164 = /* @__PURE__ */ core.$constructor("$ZodE164", (inst, def) => {
|
|
397
|
+
def.pattern ?? (def.pattern = regexes.e164);
|
|
398
|
+
$ZodStringFormat.init(inst, def);
|
|
399
|
+
});
|
|
400
|
+
function isValidJWT(token, algorithm = null) {
|
|
401
|
+
try {
|
|
402
|
+
const tokensParts = token.split(".");
|
|
403
|
+
if (tokensParts.length !== 3)
|
|
404
|
+
return false;
|
|
405
|
+
const [header] = tokensParts;
|
|
406
|
+
if (!header)
|
|
407
|
+
return false;
|
|
408
|
+
const parsedHeader = JSON.parse(atob(header));
|
|
409
|
+
if ("typ" in parsedHeader && (parsedHeader == null ? void 0 : parsedHeader.typ) !== "JWT")
|
|
410
|
+
return false;
|
|
411
|
+
if (!parsedHeader.alg)
|
|
412
|
+
return false;
|
|
413
|
+
if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm))
|
|
414
|
+
return false;
|
|
415
|
+
return true;
|
|
416
|
+
} catch {
|
|
417
|
+
return false;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
const $ZodJWT = /* @__PURE__ */ core.$constructor("$ZodJWT", (inst, def) => {
|
|
421
|
+
$ZodStringFormat.init(inst, def);
|
|
422
|
+
inst._zod.check = (payload) => {
|
|
423
|
+
if (isValidJWT(payload.value, def.alg))
|
|
424
|
+
return;
|
|
425
|
+
payload.issues.push({
|
|
426
|
+
code: "invalid_format",
|
|
427
|
+
format: "jwt",
|
|
428
|
+
input: payload.value,
|
|
429
|
+
inst,
|
|
430
|
+
continue: !def.abort
|
|
431
|
+
});
|
|
432
|
+
};
|
|
433
|
+
});
|
|
434
|
+
const $ZodNumber = /* @__PURE__ */ core.$constructor("$ZodNumber", (inst, def) => {
|
|
435
|
+
$ZodType.init(inst, def);
|
|
436
|
+
inst._zod.pattern = inst._zod.bag.pattern ?? regexes.number;
|
|
437
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
438
|
+
if (def.coerce)
|
|
439
|
+
try {
|
|
440
|
+
payload.value = Number(payload.value);
|
|
441
|
+
} catch (_) {
|
|
442
|
+
}
|
|
443
|
+
const input = payload.value;
|
|
444
|
+
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
|
|
445
|
+
return payload;
|
|
446
|
+
}
|
|
447
|
+
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
|
|
448
|
+
payload.issues.push({
|
|
449
|
+
expected: "number",
|
|
450
|
+
code: "invalid_type",
|
|
451
|
+
input,
|
|
452
|
+
inst,
|
|
453
|
+
...received ? { received } : {}
|
|
454
|
+
});
|
|
455
|
+
return payload;
|
|
456
|
+
};
|
|
457
|
+
});
|
|
458
|
+
const $ZodNumberFormat = /* @__PURE__ */ core.$constructor("$ZodNumberFormat", (inst, def) => {
|
|
459
|
+
checks.$ZodCheckNumberFormat.init(inst, def);
|
|
460
|
+
$ZodNumber.init(inst, def);
|
|
461
|
+
});
|
|
462
|
+
const $ZodBoolean = /* @__PURE__ */ core.$constructor("$ZodBoolean", (inst, def) => {
|
|
463
|
+
$ZodType.init(inst, def);
|
|
464
|
+
inst._zod.pattern = regexes.boolean;
|
|
465
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
466
|
+
if (def.coerce)
|
|
467
|
+
try {
|
|
468
|
+
payload.value = Boolean(payload.value);
|
|
469
|
+
} catch (_) {
|
|
470
|
+
}
|
|
471
|
+
const input = payload.value;
|
|
472
|
+
if (typeof input === "boolean")
|
|
473
|
+
return payload;
|
|
474
|
+
payload.issues.push({
|
|
475
|
+
expected: "boolean",
|
|
476
|
+
code: "invalid_type",
|
|
477
|
+
input,
|
|
478
|
+
inst
|
|
479
|
+
});
|
|
480
|
+
return payload;
|
|
481
|
+
};
|
|
482
|
+
});
|
|
483
|
+
const $ZodUnknown = /* @__PURE__ */ core.$constructor("$ZodUnknown", (inst, def) => {
|
|
484
|
+
$ZodType.init(inst, def);
|
|
485
|
+
inst._zod.parse = (payload) => payload;
|
|
486
|
+
});
|
|
487
|
+
const $ZodNever = /* @__PURE__ */ core.$constructor("$ZodNever", (inst, def) => {
|
|
488
|
+
$ZodType.init(inst, def);
|
|
489
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
490
|
+
payload.issues.push({
|
|
491
|
+
expected: "never",
|
|
492
|
+
code: "invalid_type",
|
|
493
|
+
input: payload.value,
|
|
494
|
+
inst
|
|
495
|
+
});
|
|
496
|
+
return payload;
|
|
497
|
+
};
|
|
498
|
+
});
|
|
499
|
+
function handleArrayResult(result, final, index) {
|
|
500
|
+
if (result.issues.length) {
|
|
501
|
+
final.issues.push(...util.prefixIssues(index, result.issues));
|
|
502
|
+
}
|
|
503
|
+
final.value[index] = result.value;
|
|
504
|
+
}
|
|
505
|
+
const $ZodArray = /* @__PURE__ */ core.$constructor("$ZodArray", (inst, def) => {
|
|
506
|
+
$ZodType.init(inst, def);
|
|
507
|
+
inst._zod.parse = (payload, ctx) => {
|
|
508
|
+
const input = payload.value;
|
|
509
|
+
if (!Array.isArray(input)) {
|
|
510
|
+
payload.issues.push({
|
|
511
|
+
expected: "array",
|
|
512
|
+
code: "invalid_type",
|
|
513
|
+
input,
|
|
514
|
+
inst
|
|
515
|
+
});
|
|
516
|
+
return payload;
|
|
517
|
+
}
|
|
518
|
+
payload.value = Array(input.length);
|
|
519
|
+
const proms = [];
|
|
520
|
+
for (let i = 0; i < input.length; i++) {
|
|
521
|
+
const item = input[i];
|
|
522
|
+
const result = def.element._zod.run({
|
|
523
|
+
value: item,
|
|
524
|
+
issues: []
|
|
525
|
+
}, ctx);
|
|
526
|
+
if (result instanceof Promise) {
|
|
527
|
+
proms.push(result.then((result2) => handleArrayResult(result2, payload, i)));
|
|
528
|
+
} else {
|
|
529
|
+
handleArrayResult(result, payload, i);
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
if (proms.length) {
|
|
533
|
+
return Promise.all(proms).then(() => payload);
|
|
534
|
+
}
|
|
535
|
+
return payload;
|
|
536
|
+
};
|
|
537
|
+
});
|
|
538
|
+
function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
|
|
539
|
+
const isPresent = key in input;
|
|
540
|
+
if (result.issues.length) {
|
|
541
|
+
if (isOptionalIn && isOptionalOut && !isPresent) {
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
544
|
+
final.issues.push(...util.prefixIssues(key, result.issues));
|
|
545
|
+
}
|
|
546
|
+
if (!isPresent && !isOptionalIn) {
|
|
547
|
+
if (!result.issues.length) {
|
|
548
|
+
final.issues.push({
|
|
549
|
+
code: "invalid_type",
|
|
550
|
+
expected: "nonoptional",
|
|
551
|
+
input: void 0,
|
|
552
|
+
path: [key]
|
|
553
|
+
});
|
|
554
|
+
}
|
|
555
|
+
return;
|
|
556
|
+
}
|
|
557
|
+
if (result.value === void 0) {
|
|
558
|
+
if (isPresent) {
|
|
559
|
+
final.value[key] = void 0;
|
|
560
|
+
}
|
|
561
|
+
} else {
|
|
562
|
+
final.value[key] = result.value;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
function normalizeDef(def) {
|
|
566
|
+
var _a, _b, _c, _d;
|
|
567
|
+
const keys = Object.keys(def.shape);
|
|
568
|
+
for (const k of keys) {
|
|
569
|
+
if (!((_d = (_c = (_b = (_a = def.shape) == null ? void 0 : _a[k]) == null ? void 0 : _b._zod) == null ? void 0 : _c.traits) == null ? void 0 : _d.has("$ZodType"))) {
|
|
570
|
+
throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
const okeys = util.optionalKeys(def.shape);
|
|
574
|
+
return {
|
|
575
|
+
...def,
|
|
576
|
+
keys,
|
|
577
|
+
keySet: new Set(keys),
|
|
578
|
+
numKeys: keys.length,
|
|
579
|
+
optionalKeys: new Set(okeys)
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
583
|
+
const unrecognized = [];
|
|
584
|
+
const keySet = def.keySet;
|
|
585
|
+
const _catchall = def.catchall._zod;
|
|
586
|
+
const t = _catchall.def.type;
|
|
587
|
+
const isOptionalIn = _catchall.optin === "optional";
|
|
588
|
+
const isOptionalOut = _catchall.optout === "optional";
|
|
589
|
+
for (const key in input) {
|
|
590
|
+
if (key === "__proto__")
|
|
591
|
+
continue;
|
|
592
|
+
if (keySet.has(key))
|
|
593
|
+
continue;
|
|
594
|
+
if (t === "never") {
|
|
595
|
+
unrecognized.push(key);
|
|
596
|
+
continue;
|
|
597
|
+
}
|
|
598
|
+
const r = _catchall.run({ value: input[key], issues: [] }, ctx);
|
|
599
|
+
if (r instanceof Promise) {
|
|
600
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
|
|
601
|
+
} else {
|
|
602
|
+
handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
if (unrecognized.length) {
|
|
606
|
+
payload.issues.push({
|
|
607
|
+
code: "unrecognized_keys",
|
|
608
|
+
keys: unrecognized,
|
|
609
|
+
input,
|
|
610
|
+
inst
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
if (!proms.length)
|
|
614
|
+
return payload;
|
|
615
|
+
return Promise.all(proms).then(() => {
|
|
616
|
+
return payload;
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
const $ZodObject = /* @__PURE__ */ core.$constructor("$ZodObject", (inst, def) => {
|
|
620
|
+
$ZodType.init(inst, def);
|
|
621
|
+
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
622
|
+
if (!(desc == null ? void 0 : desc.get)) {
|
|
623
|
+
const sh = def.shape;
|
|
624
|
+
Object.defineProperty(def, "shape", {
|
|
625
|
+
get: () => {
|
|
626
|
+
const newSh = { ...sh };
|
|
627
|
+
Object.defineProperty(def, "shape", {
|
|
628
|
+
value: newSh
|
|
629
|
+
});
|
|
630
|
+
return newSh;
|
|
631
|
+
}
|
|
632
|
+
});
|
|
633
|
+
}
|
|
634
|
+
const _normalized = util.cached(() => normalizeDef(def));
|
|
635
|
+
util.defineLazy(inst._zod, "propValues", () => {
|
|
636
|
+
const shape = def.shape;
|
|
637
|
+
const propValues = {};
|
|
638
|
+
for (const key in shape) {
|
|
639
|
+
const field = shape[key]._zod;
|
|
640
|
+
if (field.values) {
|
|
641
|
+
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
642
|
+
for (const v of field.values)
|
|
643
|
+
propValues[key].add(v);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
return propValues;
|
|
647
|
+
});
|
|
648
|
+
const isObject = util.isObject;
|
|
649
|
+
const catchall = def.catchall;
|
|
650
|
+
let value;
|
|
651
|
+
inst._zod.parse = (payload, ctx) => {
|
|
652
|
+
value ?? (value = _normalized.value);
|
|
653
|
+
const input = payload.value;
|
|
654
|
+
if (!isObject(input)) {
|
|
655
|
+
payload.issues.push({
|
|
656
|
+
expected: "object",
|
|
657
|
+
code: "invalid_type",
|
|
658
|
+
input,
|
|
659
|
+
inst
|
|
660
|
+
});
|
|
661
|
+
return payload;
|
|
662
|
+
}
|
|
663
|
+
payload.value = {};
|
|
664
|
+
const proms = [];
|
|
665
|
+
const shape = value.shape;
|
|
666
|
+
for (const key of value.keys) {
|
|
667
|
+
const el = shape[key];
|
|
668
|
+
const isOptionalIn = el._zod.optin === "optional";
|
|
669
|
+
const isOptionalOut = el._zod.optout === "optional";
|
|
670
|
+
const r = el._zod.run({ value: input[key], issues: [] }, ctx);
|
|
671
|
+
if (r instanceof Promise) {
|
|
672
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
|
|
673
|
+
} else {
|
|
674
|
+
handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
if (!catchall) {
|
|
678
|
+
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
679
|
+
}
|
|
680
|
+
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
681
|
+
};
|
|
682
|
+
});
|
|
683
|
+
const $ZodObjectJIT = /* @__PURE__ */ core.$constructor("$ZodObjectJIT", (inst, def) => {
|
|
684
|
+
$ZodObject.init(inst, def);
|
|
685
|
+
const superParse = inst._zod.parse;
|
|
686
|
+
const _normalized = util.cached(() => normalizeDef(def));
|
|
687
|
+
const generateFastpass = (shape) => {
|
|
688
|
+
var _a, _b;
|
|
689
|
+
const doc$1 = new doc.Doc(["shape", "payload", "ctx"]);
|
|
690
|
+
const normalized = _normalized.value;
|
|
691
|
+
const parseStr = (key) => {
|
|
692
|
+
const k = util.esc(key);
|
|
693
|
+
return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
694
|
+
};
|
|
695
|
+
doc$1.write(`const input = payload.value;`);
|
|
696
|
+
const ids = /* @__PURE__ */ Object.create(null);
|
|
697
|
+
let counter = 0;
|
|
698
|
+
for (const key of normalized.keys) {
|
|
699
|
+
ids[key] = `key_${counter++}`;
|
|
700
|
+
}
|
|
701
|
+
doc$1.write(`const newResult = {};`);
|
|
702
|
+
for (const key of normalized.keys) {
|
|
703
|
+
const id = ids[key];
|
|
704
|
+
const k = util.esc(key);
|
|
705
|
+
const schema = shape[key];
|
|
706
|
+
const isOptionalIn = ((_a = schema == null ? void 0 : schema._zod) == null ? void 0 : _a.optin) === "optional";
|
|
707
|
+
const isOptionalOut = ((_b = schema == null ? void 0 : schema._zod) == null ? void 0 : _b.optout) === "optional";
|
|
708
|
+
doc$1.write(`const ${id} = ${parseStr(key)};`);
|
|
709
|
+
if (isOptionalIn && isOptionalOut) {
|
|
710
|
+
doc$1.write(`
|
|
711
|
+
if (${id}.issues.length) {
|
|
712
|
+
if (${k} in input) {
|
|
713
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
714
|
+
...iss,
|
|
715
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
716
|
+
})));
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
if (${id}.value === undefined) {
|
|
721
|
+
if (${k} in input) {
|
|
722
|
+
newResult[${k}] = undefined;
|
|
723
|
+
}
|
|
724
|
+
} else {
|
|
725
|
+
newResult[${k}] = ${id}.value;
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
`);
|
|
729
|
+
} else if (!isOptionalIn) {
|
|
730
|
+
doc$1.write(`
|
|
731
|
+
const ${id}_present = ${k} in input;
|
|
732
|
+
if (${id}.issues.length) {
|
|
733
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
734
|
+
...iss,
|
|
735
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
736
|
+
})));
|
|
737
|
+
}
|
|
738
|
+
if (!${id}_present && !${id}.issues.length) {
|
|
739
|
+
payload.issues.push({
|
|
740
|
+
code: "invalid_type",
|
|
741
|
+
expected: "nonoptional",
|
|
742
|
+
input: undefined,
|
|
743
|
+
path: [${k}]
|
|
744
|
+
});
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
if (${id}_present) {
|
|
748
|
+
if (${id}.value === undefined) {
|
|
749
|
+
newResult[${k}] = undefined;
|
|
750
|
+
} else {
|
|
751
|
+
newResult[${k}] = ${id}.value;
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
`);
|
|
756
|
+
} else {
|
|
757
|
+
doc$1.write(`
|
|
758
|
+
if (${id}.issues.length) {
|
|
759
|
+
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
760
|
+
...iss,
|
|
761
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
762
|
+
})));
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
if (${id}.value === undefined) {
|
|
766
|
+
if (${k} in input) {
|
|
767
|
+
newResult[${k}] = undefined;
|
|
768
|
+
}
|
|
769
|
+
} else {
|
|
770
|
+
newResult[${k}] = ${id}.value;
|
|
771
|
+
}
|
|
772
|
+
|
|
773
|
+
`);
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
doc$1.write(`payload.value = newResult;`);
|
|
777
|
+
doc$1.write(`return payload;`);
|
|
778
|
+
const fn = doc$1.compile();
|
|
779
|
+
return (payload, ctx) => fn(shape, payload, ctx);
|
|
780
|
+
};
|
|
781
|
+
let fastpass;
|
|
782
|
+
const isObject = util.isObject;
|
|
783
|
+
const jit = !core.globalConfig.jitless;
|
|
784
|
+
const allowsEval = util.allowsEval;
|
|
785
|
+
const fastEnabled = jit && allowsEval.value;
|
|
786
|
+
const catchall = def.catchall;
|
|
787
|
+
let value;
|
|
788
|
+
inst._zod.parse = (payload, ctx) => {
|
|
789
|
+
value ?? (value = _normalized.value);
|
|
790
|
+
const input = payload.value;
|
|
791
|
+
if (!isObject(input)) {
|
|
792
|
+
payload.issues.push({
|
|
793
|
+
expected: "object",
|
|
794
|
+
code: "invalid_type",
|
|
795
|
+
input,
|
|
796
|
+
inst
|
|
797
|
+
});
|
|
798
|
+
return payload;
|
|
799
|
+
}
|
|
800
|
+
if (jit && fastEnabled && (ctx == null ? void 0 : ctx.async) === false && ctx.jitless !== true) {
|
|
801
|
+
if (!fastpass)
|
|
802
|
+
fastpass = generateFastpass(def.shape);
|
|
803
|
+
payload = fastpass(payload, ctx);
|
|
804
|
+
if (!catchall)
|
|
805
|
+
return payload;
|
|
806
|
+
return handleCatchall([], input, payload, ctx, value, inst);
|
|
807
|
+
}
|
|
808
|
+
return superParse(payload, ctx);
|
|
809
|
+
};
|
|
810
|
+
});
|
|
811
|
+
function handleUnionResults(results, final, inst, ctx) {
|
|
812
|
+
for (const result of results) {
|
|
813
|
+
if (result.issues.length === 0) {
|
|
814
|
+
final.value = result.value;
|
|
815
|
+
return final;
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
const nonaborted = results.filter((r) => !util.aborted(r));
|
|
819
|
+
if (nonaborted.length === 1) {
|
|
820
|
+
final.value = nonaborted[0].value;
|
|
821
|
+
return nonaborted[0];
|
|
822
|
+
}
|
|
823
|
+
final.issues.push({
|
|
824
|
+
code: "invalid_union",
|
|
825
|
+
input: final.value,
|
|
826
|
+
inst,
|
|
827
|
+
errors: results.map((result) => result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())))
|
|
828
|
+
});
|
|
829
|
+
return final;
|
|
830
|
+
}
|
|
831
|
+
const $ZodUnion = /* @__PURE__ */ core.$constructor("$ZodUnion", (inst, def) => {
|
|
832
|
+
$ZodType.init(inst, def);
|
|
833
|
+
util.defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
|
|
834
|
+
util.defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
|
|
835
|
+
util.defineLazy(inst._zod, "values", () => {
|
|
836
|
+
if (def.options.every((o) => o._zod.values)) {
|
|
837
|
+
return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
838
|
+
}
|
|
839
|
+
return void 0;
|
|
840
|
+
});
|
|
841
|
+
util.defineLazy(inst._zod, "pattern", () => {
|
|
842
|
+
if (def.options.every((o) => o._zod.pattern)) {
|
|
843
|
+
const patterns = def.options.map((o) => o._zod.pattern);
|
|
844
|
+
return new RegExp(`^(${patterns.map((p) => util.cleanRegex(p.source)).join("|")})$`);
|
|
845
|
+
}
|
|
846
|
+
return void 0;
|
|
847
|
+
});
|
|
848
|
+
const first = def.options.length === 1 ? def.options[0]._zod.run : null;
|
|
849
|
+
inst._zod.parse = (payload, ctx) => {
|
|
850
|
+
if (first) {
|
|
851
|
+
return first(payload, ctx);
|
|
852
|
+
}
|
|
853
|
+
let async = false;
|
|
854
|
+
const results = [];
|
|
855
|
+
for (const option of def.options) {
|
|
856
|
+
const result = option._zod.run({
|
|
857
|
+
value: payload.value,
|
|
858
|
+
issues: []
|
|
859
|
+
}, ctx);
|
|
860
|
+
if (result instanceof Promise) {
|
|
861
|
+
results.push(result);
|
|
862
|
+
async = true;
|
|
863
|
+
} else {
|
|
864
|
+
if (result.issues.length === 0)
|
|
865
|
+
return result;
|
|
866
|
+
results.push(result);
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
if (!async)
|
|
870
|
+
return handleUnionResults(results, payload, inst, ctx);
|
|
871
|
+
return Promise.all(results).then((results2) => {
|
|
872
|
+
return handleUnionResults(results2, payload, inst, ctx);
|
|
873
|
+
});
|
|
874
|
+
};
|
|
875
|
+
});
|
|
876
|
+
const $ZodDiscriminatedUnion = /* @__PURE__ */ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
877
|
+
def.inclusive = false;
|
|
878
|
+
$ZodUnion.init(inst, def);
|
|
879
|
+
const _super = inst._zod.parse;
|
|
880
|
+
util.defineLazy(inst._zod, "propValues", () => {
|
|
881
|
+
const propValues = {};
|
|
882
|
+
for (const option of def.options) {
|
|
883
|
+
const pv = option._zod.propValues;
|
|
884
|
+
if (!pv || Object.keys(pv).length === 0)
|
|
885
|
+
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
886
|
+
for (const [k, v] of Object.entries(pv)) {
|
|
887
|
+
if (!propValues[k])
|
|
888
|
+
propValues[k] = /* @__PURE__ */ new Set();
|
|
889
|
+
for (const val of v) {
|
|
890
|
+
propValues[k].add(val);
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
return propValues;
|
|
895
|
+
});
|
|
896
|
+
const disc = util.cached(() => {
|
|
897
|
+
var _a;
|
|
898
|
+
const opts = def.options;
|
|
899
|
+
const map = /* @__PURE__ */ new Map();
|
|
900
|
+
for (const o of opts) {
|
|
901
|
+
const values = (_a = o._zod.propValues) == null ? void 0 : _a[def.discriminator];
|
|
902
|
+
if (!values || values.size === 0)
|
|
903
|
+
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
|
|
904
|
+
for (const v of values) {
|
|
905
|
+
if (map.has(v)) {
|
|
906
|
+
throw new Error(`Duplicate discriminator value "${String(v)}"`);
|
|
907
|
+
}
|
|
908
|
+
map.set(v, o);
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
return map;
|
|
912
|
+
});
|
|
913
|
+
inst._zod.parse = (payload, ctx) => {
|
|
914
|
+
const input = payload.value;
|
|
915
|
+
if (!util.isObject(input)) {
|
|
916
|
+
payload.issues.push({
|
|
917
|
+
code: "invalid_type",
|
|
918
|
+
expected: "object",
|
|
919
|
+
input,
|
|
920
|
+
inst
|
|
921
|
+
});
|
|
922
|
+
return payload;
|
|
923
|
+
}
|
|
924
|
+
const opt = disc.value.get(input == null ? void 0 : input[def.discriminator]);
|
|
925
|
+
if (opt) {
|
|
926
|
+
return opt._zod.run(payload, ctx);
|
|
927
|
+
}
|
|
928
|
+
if (def.unionFallback || ctx.direction === "backward") {
|
|
929
|
+
return _super(payload, ctx);
|
|
930
|
+
}
|
|
931
|
+
payload.issues.push({
|
|
932
|
+
code: "invalid_union",
|
|
933
|
+
errors: [],
|
|
934
|
+
note: "No matching discriminator",
|
|
935
|
+
discriminator: def.discriminator,
|
|
936
|
+
options: Array.from(disc.value.keys()),
|
|
937
|
+
input,
|
|
938
|
+
path: [def.discriminator],
|
|
939
|
+
inst
|
|
940
|
+
});
|
|
941
|
+
return payload;
|
|
942
|
+
};
|
|
943
|
+
});
|
|
944
|
+
const $ZodIntersection = /* @__PURE__ */ core.$constructor("$ZodIntersection", (inst, def) => {
|
|
945
|
+
$ZodType.init(inst, def);
|
|
946
|
+
inst._zod.parse = (payload, ctx) => {
|
|
947
|
+
const input = payload.value;
|
|
948
|
+
const left = def.left._zod.run({ value: input, issues: [] }, ctx);
|
|
949
|
+
const right = def.right._zod.run({ value: input, issues: [] }, ctx);
|
|
950
|
+
const async = left instanceof Promise || right instanceof Promise;
|
|
951
|
+
if (async) {
|
|
952
|
+
return Promise.all([left, right]).then(([left2, right2]) => {
|
|
953
|
+
return handleIntersectionResults(payload, left2, right2);
|
|
954
|
+
});
|
|
955
|
+
}
|
|
956
|
+
return handleIntersectionResults(payload, left, right);
|
|
957
|
+
};
|
|
958
|
+
});
|
|
959
|
+
function mergeValues(a, b) {
|
|
960
|
+
if (a === b) {
|
|
961
|
+
return { valid: true, data: a };
|
|
962
|
+
}
|
|
963
|
+
if (a instanceof Date && b instanceof Date && +a === +b) {
|
|
964
|
+
return { valid: true, data: a };
|
|
965
|
+
}
|
|
966
|
+
if (util.isPlainObject(a) && util.isPlainObject(b)) {
|
|
967
|
+
const bKeys = Object.keys(b);
|
|
968
|
+
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
969
|
+
const newObj = { ...a, ...b };
|
|
970
|
+
for (const key of sharedKeys) {
|
|
971
|
+
const sharedValue = mergeValues(a[key], b[key]);
|
|
972
|
+
if (!sharedValue.valid) {
|
|
973
|
+
return {
|
|
974
|
+
valid: false,
|
|
975
|
+
mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
|
|
976
|
+
};
|
|
977
|
+
}
|
|
978
|
+
newObj[key] = sharedValue.data;
|
|
979
|
+
}
|
|
980
|
+
return { valid: true, data: newObj };
|
|
981
|
+
}
|
|
982
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
983
|
+
if (a.length !== b.length) {
|
|
984
|
+
return { valid: false, mergeErrorPath: [] };
|
|
985
|
+
}
|
|
986
|
+
const newArray = [];
|
|
987
|
+
for (let index = 0; index < a.length; index++) {
|
|
988
|
+
const itemA = a[index];
|
|
989
|
+
const itemB = b[index];
|
|
990
|
+
const sharedValue = mergeValues(itemA, itemB);
|
|
991
|
+
if (!sharedValue.valid) {
|
|
992
|
+
return {
|
|
993
|
+
valid: false,
|
|
994
|
+
mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
|
|
995
|
+
};
|
|
996
|
+
}
|
|
997
|
+
newArray.push(sharedValue.data);
|
|
998
|
+
}
|
|
999
|
+
return { valid: true, data: newArray };
|
|
1000
|
+
}
|
|
1001
|
+
return { valid: false, mergeErrorPath: [] };
|
|
1002
|
+
}
|
|
1003
|
+
function handleIntersectionResults(result, left, right) {
|
|
1004
|
+
const unrecKeys = /* @__PURE__ */ new Map();
|
|
1005
|
+
let unrecIssue;
|
|
1006
|
+
for (const iss of left.issues) {
|
|
1007
|
+
if (iss.code === "unrecognized_keys") {
|
|
1008
|
+
unrecIssue ?? (unrecIssue = iss);
|
|
1009
|
+
for (const k of iss.keys) {
|
|
1010
|
+
if (!unrecKeys.has(k))
|
|
1011
|
+
unrecKeys.set(k, {});
|
|
1012
|
+
unrecKeys.get(k).l = true;
|
|
1013
|
+
}
|
|
1014
|
+
} else {
|
|
1015
|
+
result.issues.push(iss);
|
|
1016
|
+
}
|
|
1017
|
+
}
|
|
1018
|
+
for (const iss of right.issues) {
|
|
1019
|
+
if (iss.code === "unrecognized_keys") {
|
|
1020
|
+
for (const k of iss.keys) {
|
|
1021
|
+
if (!unrecKeys.has(k))
|
|
1022
|
+
unrecKeys.set(k, {});
|
|
1023
|
+
unrecKeys.get(k).r = true;
|
|
1024
|
+
}
|
|
1025
|
+
} else {
|
|
1026
|
+
result.issues.push(iss);
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
1030
|
+
if (bothKeys.length && unrecIssue) {
|
|
1031
|
+
result.issues.push({ ...unrecIssue, keys: bothKeys });
|
|
1032
|
+
}
|
|
1033
|
+
if (util.aborted(result))
|
|
1034
|
+
return result;
|
|
1035
|
+
const merged = mergeValues(left.value, right.value);
|
|
1036
|
+
if (!merged.valid) {
|
|
1037
|
+
throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
|
|
1038
|
+
}
|
|
1039
|
+
result.value = merged.data;
|
|
1040
|
+
return result;
|
|
1041
|
+
}
|
|
1042
|
+
const $ZodEnum = /* @__PURE__ */ core.$constructor("$ZodEnum", (inst, def) => {
|
|
1043
|
+
$ZodType.init(inst, def);
|
|
1044
|
+
const values = util.getEnumValues(def.entries);
|
|
1045
|
+
const valuesSet = new Set(values);
|
|
1046
|
+
inst._zod.values = valuesSet;
|
|
1047
|
+
inst._zod.pattern = new RegExp(`^(${values.filter((k) => util.propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? util.escapeRegex(o) : o.toString()).join("|")})$`);
|
|
1048
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1049
|
+
const input = payload.value;
|
|
1050
|
+
if (valuesSet.has(input)) {
|
|
1051
|
+
return payload;
|
|
1052
|
+
}
|
|
1053
|
+
payload.issues.push({
|
|
1054
|
+
code: "invalid_value",
|
|
1055
|
+
values,
|
|
1056
|
+
input,
|
|
1057
|
+
inst
|
|
1058
|
+
});
|
|
1059
|
+
return payload;
|
|
1060
|
+
};
|
|
1061
|
+
});
|
|
1062
|
+
const $ZodLiteral = /* @__PURE__ */ core.$constructor("$ZodLiteral", (inst, def) => {
|
|
1063
|
+
$ZodType.init(inst, def);
|
|
1064
|
+
if (def.values.length === 0) {
|
|
1065
|
+
throw new Error("Cannot create literal schema with no valid values");
|
|
1066
|
+
}
|
|
1067
|
+
const values = new Set(def.values);
|
|
1068
|
+
inst._zod.values = values;
|
|
1069
|
+
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? util.escapeRegex(o) : o ? util.escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
1070
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1071
|
+
const input = payload.value;
|
|
1072
|
+
if (values.has(input)) {
|
|
1073
|
+
return payload;
|
|
1074
|
+
}
|
|
1075
|
+
payload.issues.push({
|
|
1076
|
+
code: "invalid_value",
|
|
1077
|
+
values: def.values,
|
|
1078
|
+
input,
|
|
1079
|
+
inst
|
|
1080
|
+
});
|
|
1081
|
+
return payload;
|
|
1082
|
+
};
|
|
1083
|
+
});
|
|
1084
|
+
const $ZodTransform = /* @__PURE__ */ core.$constructor("$ZodTransform", (inst, def) => {
|
|
1085
|
+
$ZodType.init(inst, def);
|
|
1086
|
+
inst._zod.optin = "optional";
|
|
1087
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1088
|
+
if (ctx.direction === "backward") {
|
|
1089
|
+
throw new core.$ZodEncodeError(inst.constructor.name);
|
|
1090
|
+
}
|
|
1091
|
+
const _out = def.transform(payload.value, payload);
|
|
1092
|
+
if (ctx.async) {
|
|
1093
|
+
const output = _out instanceof Promise ? _out : Promise.resolve(_out);
|
|
1094
|
+
return output.then((output2) => {
|
|
1095
|
+
payload.value = output2;
|
|
1096
|
+
payload.fallback = true;
|
|
1097
|
+
return payload;
|
|
1098
|
+
});
|
|
1099
|
+
}
|
|
1100
|
+
if (_out instanceof Promise) {
|
|
1101
|
+
throw new core.$ZodAsyncError();
|
|
1102
|
+
}
|
|
1103
|
+
payload.value = _out;
|
|
1104
|
+
payload.fallback = true;
|
|
1105
|
+
return payload;
|
|
1106
|
+
};
|
|
1107
|
+
});
|
|
1108
|
+
function handleOptionalResult(result, input) {
|
|
1109
|
+
if (input === void 0 && (result.issues.length || result.fallback)) {
|
|
1110
|
+
return { issues: [], value: void 0 };
|
|
1111
|
+
}
|
|
1112
|
+
return result;
|
|
1113
|
+
}
|
|
1114
|
+
const $ZodOptional = /* @__PURE__ */ core.$constructor("$ZodOptional", (inst, def) => {
|
|
1115
|
+
$ZodType.init(inst, def);
|
|
1116
|
+
inst._zod.optin = "optional";
|
|
1117
|
+
inst._zod.optout = "optional";
|
|
1118
|
+
util.defineLazy(inst._zod, "values", () => {
|
|
1119
|
+
return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, void 0]) : void 0;
|
|
1120
|
+
});
|
|
1121
|
+
util.defineLazy(inst._zod, "pattern", () => {
|
|
1122
|
+
const pattern = def.innerType._zod.pattern;
|
|
1123
|
+
return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)})?$`) : void 0;
|
|
1124
|
+
});
|
|
1125
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1126
|
+
if (def.innerType._zod.optin === "optional") {
|
|
1127
|
+
const input = payload.value;
|
|
1128
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
1129
|
+
if (result instanceof Promise)
|
|
1130
|
+
return result.then((r) => handleOptionalResult(r, input));
|
|
1131
|
+
return handleOptionalResult(result, input);
|
|
1132
|
+
}
|
|
1133
|
+
if (payload.value === void 0) {
|
|
1134
|
+
return payload;
|
|
1135
|
+
}
|
|
1136
|
+
return def.innerType._zod.run(payload, ctx);
|
|
1137
|
+
};
|
|
1138
|
+
});
|
|
1139
|
+
const $ZodExactOptional = /* @__PURE__ */ core.$constructor("$ZodExactOptional", (inst, def) => {
|
|
1140
|
+
$ZodOptional.init(inst, def);
|
|
1141
|
+
util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1142
|
+
util.defineLazy(inst._zod, "pattern", () => def.innerType._zod.pattern);
|
|
1143
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1144
|
+
return def.innerType._zod.run(payload, ctx);
|
|
1145
|
+
};
|
|
1146
|
+
});
|
|
1147
|
+
const $ZodNullable = /* @__PURE__ */ core.$constructor("$ZodNullable", (inst, def) => {
|
|
1148
|
+
$ZodType.init(inst, def);
|
|
1149
|
+
util.defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
1150
|
+
util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
1151
|
+
util.defineLazy(inst._zod, "pattern", () => {
|
|
1152
|
+
const pattern = def.innerType._zod.pattern;
|
|
1153
|
+
return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)}|null)$`) : void 0;
|
|
1154
|
+
});
|
|
1155
|
+
util.defineLazy(inst._zod, "values", () => {
|
|
1156
|
+
return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
|
|
1157
|
+
});
|
|
1158
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1159
|
+
if (payload.value === null)
|
|
1160
|
+
return payload;
|
|
1161
|
+
return def.innerType._zod.run(payload, ctx);
|
|
1162
|
+
};
|
|
1163
|
+
});
|
|
1164
|
+
const $ZodDefault = /* @__PURE__ */ core.$constructor("$ZodDefault", (inst, def) => {
|
|
1165
|
+
$ZodType.init(inst, def);
|
|
1166
|
+
inst._zod.optin = "optional";
|
|
1167
|
+
util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1168
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1169
|
+
if (ctx.direction === "backward") {
|
|
1170
|
+
return def.innerType._zod.run(payload, ctx);
|
|
1171
|
+
}
|
|
1172
|
+
if (payload.value === void 0) {
|
|
1173
|
+
payload.value = def.defaultValue;
|
|
1174
|
+
return payload;
|
|
1175
|
+
}
|
|
1176
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
1177
|
+
if (result instanceof Promise) {
|
|
1178
|
+
return result.then((result2) => handleDefaultResult(result2, def));
|
|
1179
|
+
}
|
|
1180
|
+
return handleDefaultResult(result, def);
|
|
1181
|
+
};
|
|
1182
|
+
});
|
|
1183
|
+
function handleDefaultResult(payload, def) {
|
|
1184
|
+
if (payload.value === void 0) {
|
|
1185
|
+
payload.value = def.defaultValue;
|
|
1186
|
+
}
|
|
1187
|
+
return payload;
|
|
1188
|
+
}
|
|
1189
|
+
const $ZodPrefault = /* @__PURE__ */ core.$constructor("$ZodPrefault", (inst, def) => {
|
|
1190
|
+
$ZodType.init(inst, def);
|
|
1191
|
+
inst._zod.optin = "optional";
|
|
1192
|
+
util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1193
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1194
|
+
if (ctx.direction === "backward") {
|
|
1195
|
+
return def.innerType._zod.run(payload, ctx);
|
|
1196
|
+
}
|
|
1197
|
+
if (payload.value === void 0) {
|
|
1198
|
+
payload.value = def.defaultValue;
|
|
1199
|
+
}
|
|
1200
|
+
return def.innerType._zod.run(payload, ctx);
|
|
1201
|
+
};
|
|
1202
|
+
});
|
|
1203
|
+
const $ZodNonOptional = /* @__PURE__ */ core.$constructor("$ZodNonOptional", (inst, def) => {
|
|
1204
|
+
$ZodType.init(inst, def);
|
|
1205
|
+
util.defineLazy(inst._zod, "values", () => {
|
|
1206
|
+
const v = def.innerType._zod.values;
|
|
1207
|
+
return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
|
|
1208
|
+
});
|
|
1209
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1210
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
1211
|
+
if (result instanceof Promise) {
|
|
1212
|
+
return result.then((result2) => handleNonOptionalResult(result2, inst));
|
|
1213
|
+
}
|
|
1214
|
+
return handleNonOptionalResult(result, inst);
|
|
1215
|
+
};
|
|
1216
|
+
});
|
|
1217
|
+
function handleNonOptionalResult(payload, inst) {
|
|
1218
|
+
if (!payload.issues.length && payload.value === void 0) {
|
|
1219
|
+
payload.issues.push({
|
|
1220
|
+
code: "invalid_type",
|
|
1221
|
+
expected: "nonoptional",
|
|
1222
|
+
input: payload.value,
|
|
1223
|
+
inst
|
|
1224
|
+
});
|
|
1225
|
+
}
|
|
1226
|
+
return payload;
|
|
1227
|
+
}
|
|
1228
|
+
const $ZodCatch = /* @__PURE__ */ core.$constructor("$ZodCatch", (inst, def) => {
|
|
1229
|
+
$ZodType.init(inst, def);
|
|
1230
|
+
inst._zod.optin = "optional";
|
|
1231
|
+
util.defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
1232
|
+
util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1233
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1234
|
+
if (ctx.direction === "backward") {
|
|
1235
|
+
return def.innerType._zod.run(payload, ctx);
|
|
1236
|
+
}
|
|
1237
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
1238
|
+
if (result instanceof Promise) {
|
|
1239
|
+
return result.then((result2) => {
|
|
1240
|
+
payload.value = result2.value;
|
|
1241
|
+
if (result2.issues.length) {
|
|
1242
|
+
payload.value = def.catchValue({
|
|
1243
|
+
...payload,
|
|
1244
|
+
error: {
|
|
1245
|
+
issues: result2.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config()))
|
|
1246
|
+
},
|
|
1247
|
+
input: payload.value
|
|
1248
|
+
});
|
|
1249
|
+
payload.issues = [];
|
|
1250
|
+
payload.fallback = true;
|
|
1251
|
+
}
|
|
1252
|
+
return payload;
|
|
1253
|
+
});
|
|
1254
|
+
}
|
|
1255
|
+
payload.value = result.value;
|
|
1256
|
+
if (result.issues.length) {
|
|
1257
|
+
payload.value = def.catchValue({
|
|
1258
|
+
...payload,
|
|
1259
|
+
error: {
|
|
1260
|
+
issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config()))
|
|
1261
|
+
},
|
|
1262
|
+
input: payload.value
|
|
1263
|
+
});
|
|
1264
|
+
payload.issues = [];
|
|
1265
|
+
payload.fallback = true;
|
|
1266
|
+
}
|
|
1267
|
+
return payload;
|
|
1268
|
+
};
|
|
1269
|
+
});
|
|
1270
|
+
const $ZodPipe = /* @__PURE__ */ core.$constructor("$ZodPipe", (inst, def) => {
|
|
1271
|
+
$ZodType.init(inst, def);
|
|
1272
|
+
util.defineLazy(inst._zod, "values", () => def.in._zod.values);
|
|
1273
|
+
util.defineLazy(inst._zod, "optin", () => def.in._zod.optin);
|
|
1274
|
+
util.defineLazy(inst._zod, "optout", () => def.out._zod.optout);
|
|
1275
|
+
util.defineLazy(inst._zod, "propValues", () => def.in._zod.propValues);
|
|
1276
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1277
|
+
if (ctx.direction === "backward") {
|
|
1278
|
+
const right = def.out._zod.run(payload, ctx);
|
|
1279
|
+
if (right instanceof Promise) {
|
|
1280
|
+
return right.then((right2) => handlePipeResult(right2, def.in, ctx));
|
|
1281
|
+
}
|
|
1282
|
+
return handlePipeResult(right, def.in, ctx);
|
|
1283
|
+
}
|
|
1284
|
+
const left = def.in._zod.run(payload, ctx);
|
|
1285
|
+
if (left instanceof Promise) {
|
|
1286
|
+
return left.then((left2) => handlePipeResult(left2, def.out, ctx));
|
|
1287
|
+
}
|
|
1288
|
+
return handlePipeResult(left, def.out, ctx);
|
|
1289
|
+
};
|
|
1290
|
+
});
|
|
1291
|
+
function handlePipeResult(left, next, ctx) {
|
|
1292
|
+
if (left.issues.length) {
|
|
1293
|
+
left.aborted = true;
|
|
1294
|
+
return left;
|
|
1295
|
+
}
|
|
1296
|
+
return next._zod.run({ value: left.value, issues: left.issues, fallback: left.fallback }, ctx);
|
|
1297
|
+
}
|
|
1298
|
+
const $ZodReadonly = /* @__PURE__ */ core.$constructor("$ZodReadonly", (inst, def) => {
|
|
1299
|
+
$ZodType.init(inst, def);
|
|
1300
|
+
util.defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
1301
|
+
util.defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1302
|
+
util.defineLazy(inst._zod, "optin", () => {
|
|
1303
|
+
var _a, _b;
|
|
1304
|
+
return (_b = (_a = def.innerType) == null ? void 0 : _a._zod) == null ? void 0 : _b.optin;
|
|
1305
|
+
});
|
|
1306
|
+
util.defineLazy(inst._zod, "optout", () => {
|
|
1307
|
+
var _a, _b;
|
|
1308
|
+
return (_b = (_a = def.innerType) == null ? void 0 : _a._zod) == null ? void 0 : _b.optout;
|
|
1309
|
+
});
|
|
1310
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1311
|
+
if (ctx.direction === "backward") {
|
|
1312
|
+
return def.innerType._zod.run(payload, ctx);
|
|
1313
|
+
}
|
|
1314
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
1315
|
+
if (result instanceof Promise) {
|
|
1316
|
+
return result.then(handleReadonlyResult);
|
|
1317
|
+
}
|
|
1318
|
+
return handleReadonlyResult(result);
|
|
1319
|
+
};
|
|
1320
|
+
});
|
|
1321
|
+
function handleReadonlyResult(payload) {
|
|
1322
|
+
payload.value = Object.freeze(payload.value);
|
|
1323
|
+
return payload;
|
|
1324
|
+
}
|
|
1325
|
+
const $ZodCustom = /* @__PURE__ */ core.$constructor("$ZodCustom", (inst, def) => {
|
|
1326
|
+
checks.$ZodCheck.init(inst, def);
|
|
1327
|
+
$ZodType.init(inst, def);
|
|
1328
|
+
inst._zod.parse = (payload, _) => {
|
|
1329
|
+
return payload;
|
|
1330
|
+
};
|
|
1331
|
+
inst._zod.check = (payload) => {
|
|
1332
|
+
const input = payload.value;
|
|
1333
|
+
const r = def.fn(input);
|
|
1334
|
+
if (r instanceof Promise) {
|
|
1335
|
+
return r.then((r2) => handleRefineResult(r2, payload, input, inst));
|
|
1336
|
+
}
|
|
1337
|
+
handleRefineResult(r, payload, input, inst);
|
|
1338
|
+
return;
|
|
1339
|
+
};
|
|
1340
|
+
});
|
|
1341
|
+
function handleRefineResult(result, payload, input, inst) {
|
|
1342
|
+
if (!result) {
|
|
1343
|
+
const _iss = {
|
|
1344
|
+
code: "custom",
|
|
1345
|
+
input,
|
|
1346
|
+
inst,
|
|
1347
|
+
// incorporates params.error into issue reporting
|
|
1348
|
+
path: [...inst._zod.def.path ?? []],
|
|
1349
|
+
// incorporates params.error into issue reporting
|
|
1350
|
+
continue: !inst._zod.def.abort
|
|
1351
|
+
// params: inst._zod.def.params,
|
|
1352
|
+
};
|
|
1353
|
+
if (inst._zod.def.params)
|
|
1354
|
+
_iss.params = inst._zod.def.params;
|
|
1355
|
+
payload.issues.push(util.issue(_iss));
|
|
1356
|
+
}
|
|
1357
|
+
}
|
|
1358
|
+
exports.clone = util.clone;
|
|
1359
|
+
exports.$ZodArray = $ZodArray;
|
|
1360
|
+
exports.$ZodBase64 = $ZodBase64;
|
|
1361
|
+
exports.$ZodBase64URL = $ZodBase64URL;
|
|
1362
|
+
exports.$ZodBoolean = $ZodBoolean;
|
|
1363
|
+
exports.$ZodCIDRv4 = $ZodCIDRv4;
|
|
1364
|
+
exports.$ZodCIDRv6 = $ZodCIDRv6;
|
|
1365
|
+
exports.$ZodCUID = $ZodCUID;
|
|
1366
|
+
exports.$ZodCUID2 = $ZodCUID2;
|
|
1367
|
+
exports.$ZodCatch = $ZodCatch;
|
|
1368
|
+
exports.$ZodCustom = $ZodCustom;
|
|
1369
|
+
exports.$ZodDefault = $ZodDefault;
|
|
1370
|
+
exports.$ZodDiscriminatedUnion = $ZodDiscriminatedUnion;
|
|
1371
|
+
exports.$ZodE164 = $ZodE164;
|
|
1372
|
+
exports.$ZodEmail = $ZodEmail;
|
|
1373
|
+
exports.$ZodEmoji = $ZodEmoji;
|
|
1374
|
+
exports.$ZodEnum = $ZodEnum;
|
|
1375
|
+
exports.$ZodExactOptional = $ZodExactOptional;
|
|
1376
|
+
exports.$ZodGUID = $ZodGUID;
|
|
1377
|
+
exports.$ZodIPv4 = $ZodIPv4;
|
|
1378
|
+
exports.$ZodIPv6 = $ZodIPv6;
|
|
1379
|
+
exports.$ZodISODate = $ZodISODate;
|
|
1380
|
+
exports.$ZodISODateTime = $ZodISODateTime;
|
|
1381
|
+
exports.$ZodISODuration = $ZodISODuration;
|
|
1382
|
+
exports.$ZodISOTime = $ZodISOTime;
|
|
1383
|
+
exports.$ZodIntersection = $ZodIntersection;
|
|
1384
|
+
exports.$ZodJWT = $ZodJWT;
|
|
1385
|
+
exports.$ZodKSUID = $ZodKSUID;
|
|
1386
|
+
exports.$ZodLiteral = $ZodLiteral;
|
|
1387
|
+
exports.$ZodNanoID = $ZodNanoID;
|
|
1388
|
+
exports.$ZodNever = $ZodNever;
|
|
1389
|
+
exports.$ZodNonOptional = $ZodNonOptional;
|
|
1390
|
+
exports.$ZodNullable = $ZodNullable;
|
|
1391
|
+
exports.$ZodNumber = $ZodNumber;
|
|
1392
|
+
exports.$ZodNumberFormat = $ZodNumberFormat;
|
|
1393
|
+
exports.$ZodObject = $ZodObject;
|
|
1394
|
+
exports.$ZodObjectJIT = $ZodObjectJIT;
|
|
1395
|
+
exports.$ZodOptional = $ZodOptional;
|
|
1396
|
+
exports.$ZodPipe = $ZodPipe;
|
|
1397
|
+
exports.$ZodPrefault = $ZodPrefault;
|
|
1398
|
+
exports.$ZodReadonly = $ZodReadonly;
|
|
1399
|
+
exports.$ZodString = $ZodString;
|
|
1400
|
+
exports.$ZodStringFormat = $ZodStringFormat;
|
|
1401
|
+
exports.$ZodTransform = $ZodTransform;
|
|
1402
|
+
exports.$ZodType = $ZodType;
|
|
1403
|
+
exports.$ZodULID = $ZodULID;
|
|
1404
|
+
exports.$ZodURL = $ZodURL;
|
|
1405
|
+
exports.$ZodUUID = $ZodUUID;
|
|
1406
|
+
exports.$ZodUnion = $ZodUnion;
|
|
1407
|
+
exports.$ZodUnknown = $ZodUnknown;
|
|
1408
|
+
exports.$ZodXID = $ZodXID;
|
|
1409
|
+
exports.isValidBase64 = isValidBase64;
|
|
1410
|
+
exports.isValidBase64URL = isValidBase64URL;
|
|
1411
|
+
exports.isValidJWT = isValidJWT;
|
|
1412
|
+
//# sourceMappingURL=schemas.cjs.map
|