@novu/framework 0.24.3-alpha.5 → 0.24.3-alpha.7
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 +1 -0
- package/dist/express.d.ts +2 -2
- package/dist/express.js +15 -18
- package/dist/h3.d.ts +2 -2
- package/dist/h3.js +15 -18
- package/dist/{handler-58kccf2b.d.ts → handler-VweGZ1Z4.d.ts} +228 -40
- package/dist/index.d.ts +4 -4
- package/dist/index.js +19 -22
- package/dist/next.d.ts +2 -2
- package/dist/next.js +15 -18
- package/dist/nuxt.d.ts +2 -2
- package/dist/nuxt.js +15 -18
- package/dist/remix.d.ts +2 -2
- package/dist/remix.js +15 -18
- package/dist/sveltekit.d.ts +2 -2
- package/dist/sveltekit.js +15 -18
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -1,28 +1,25 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var Me = require('ajv');
|
|
4
|
-
var Ue = require('ajv-formats');
|
|
5
|
-
var qe = require('better-ajv-errors');
|
|
6
3
|
var jsonSchemaFaker = require('json-schema-faker');
|
|
7
|
-
var
|
|
8
|
-
var
|
|
4
|
+
var xi = require('ora');
|
|
5
|
+
var Ce = require('chalk');
|
|
6
|
+
var vr = require('ajv');
|
|
7
|
+
var br = require('ajv-formats');
|
|
9
8
|
var liquidjs = require('liquidjs');
|
|
10
9
|
var crypto = require('crypto');
|
|
11
10
|
|
|
12
11
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
12
|
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var v__default = /*#__PURE__*/_interopDefault(v);
|
|
13
|
+
var xi__default = /*#__PURE__*/_interopDefault(xi);
|
|
14
|
+
var Ce__default = /*#__PURE__*/_interopDefault(Ce);
|
|
15
|
+
var vr__default = /*#__PURE__*/_interopDefault(vr);
|
|
16
|
+
var br__default = /*#__PURE__*/_interopDefault(br);
|
|
19
17
|
|
|
20
|
-
var $=(n=>(n.EXECUTE="execute",n.PREVIEW="preview",n.SYNC="sync",n.DIFF="diff",n))($||{}),M=(i=>(i.DISCOVER="discover",i.HEALTH_CHECK="health-check",i.CODE="code",i))(M||{});var ue="https://api.novu.co";var y=(c=>(c.WORKFLOW_NOT_FOUND_ERROR="WorkflowNotFoundError",c.WORKFLOW_ALREADY_EXISTS_ERROR="WorkflowAlreadyExistsError",c.WORKFLOW_EXECUTION_FAILED_ERROR="WorkflowExecutionFailedError",c.EXECUTION_STATE_OUTPUT_INVALID_ERROR="ExecutionStateOutputInvalidError",c.EXECUTION_STATE_RESULT_INVALID_ERROR="ExecutionStateResultInvalidError",c.EXECUTION_PROVIDER_OUTPUT_INVALID_ERROR="ExecutionProviderOutputInvalidError",c.PROVIDER_NOT_FOUND_ERROR="ProviderNotFoundError",c.PROVIDER_EXECUTION_FAILED_ERROR="ProviderExecutionFailedError",c.STEP_NOT_FOUND_ERROR="StepNotFoundError",c.STEP_ALREADY_EXISTS_ERROR="StepAlreadyExistsError",c.STEP_EXECUTION_FAILED_ERROR="StepExecutionFailedError",c.EXECUTION_STATE_CORRUPT_ERROR="ExecutionStateCorruptError",c.EXECUTION_EVENT_DATA_INVALID_ERROR="ExecutionEventDataInvalidError",c.EXECUTION_EVENT_INPUT_INVALID_ERROR="ExecutionEventInputInvalidError",c.EXECUTION_STATE_INPUT_INVALID_ERROR="ExecutionStateInputInvalidError",c.METHOD_NOT_ALLOWED_ERROR="MethodNotAllowedError",c.INVALID_ACTION_ERROR="InvalidActionError",c.MISSING_API_KEY_ERROR="MissingApiKeyError",c.SIGNATURE_MISMATCH_ERROR="SignatureMismatchError",c.SIGNATURE_NOT_FOUND_ERROR="SignatureNotFoundError",c.SIGNATURE_INVALID_ERROR="SignatureInvalidError",c.SIGNATURE_EXPIRED_ERROR="SignatureExpiredError",c.SIGNING_KEY_NOT_FOUND_ERROR="SigningKeyNotFoundError",c.PLATFORM_ERROR="PlatformError",c.SIGNATURE_VERSION_INVALID_ERROR="SignatureVersionInvalidError",c))(y||{});var S=(i=>(i.POST="POST",i.GET="GET",i.OPTIONS="OPTIONS",i))(S||{});var g=class extends Error{data},U=class extends g{statusCode=404},f=class extends g{statusCode=400},b=class extends g{statusCode=401},T=class extends g{statusCode=500},q=class extends g{statusCode=409};var L=class extends f{code="ExecutionStateCorruptError";constructor(e,t){super(`Workflow with id: \`${e}\` has a corrupt state. Step with id: \`${t}\` does not exist. Please provide the missing state.`),this.data={workflowId:e,stepId:t};}},F=class extends f{code="ExecutionEventDataInvalidError";constructor(e,t){super(`Workflow with id: \`${e}\` has invalid \`data\`. Please provide the correct event data.`),this.data=t;}},A=class extends f{code="ExecutionEventInputInvalidError";constructor(e,t){super(`Workflow with id: \`${e}\` has invalid \`inputs\`. Please provide the correct event inputs.`),this.data=t;}},W=class extends f{code="ExecutionStateInputInvalidError";constructor(e,t,i){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid input. Please provide the correct step input.`),this.data=i;}},Y=class extends f{code="ExecutionStateOutputInvalidError";constructor(e,t,i){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid output. Please provide the correct step output.`),this.data=i;}},V=class extends f{code="ExecutionStateResultInvalidError";constructor(e,t,i){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid result. Please provide the correct step result.`),this.data=i;}},B=class extends f{code="ExecutionProviderOutputInvalidError";constructor(e,t,i,n){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` and provider with id: \`${i}\` has invalid output. Please provide the correct provider output.`),this.data=n;}};var l={info:o=>v__default.default.blue(o),warning:o=>v__default.default.yellow(o),error:o=>v__default.default.red(o),success:o=>v__default.default.green(o),underline:o=>v__default.default.underline(o),bold:o=>v__default.default.bold(o)},d={SUCCESS:l.success("\u2714"),ERROR:l.error("\u2717"),WARNING:l.warning("\u26A0"),INFO:l.info("\u2139"),ARROW:l.bold("\u2192"),MOCK:l.info("\u25CB"),HYDRATED:l.bold(l.info("\u2192")),STEP:l.info("\u03C3"),ACTION:l.info("\u03B1"),DURATION:l.info("\u0394"),PROVIDER:l.info("\u2699"),OUTPUT:l.info("\u21E2"),INPUT:l.info("\u21E0"),WORKFLOW:l.info("\u03C9"),STATE:l.info("\u03C3"),EXECUTE:l.info("\u03B5"),PREVIEW:l.info("\u03C1")};var le=o=>Object.values(o).map(e=>`\`${e}\``).join(", "),G=o=>o.replaceAll(/(\w)(\w*)/g,(e,t,i)=>t.toUpperCase()+i.toLowerCase()).replaceAll(/[\s-]+/g,"");var K=class extends g{code="MethodNotAllowedError";statusCode=405;message=`Method not allowed. Please use one of ${le(S)}`},P=class extends f{code="InvalidActionError";constructor(e,t){super(`Invalid query string: \`action\`=\`${e}\`. Please use one of ${le(t)}`);}},C=class extends f{code="MissingApiKeyError";constructor(){super("API Key is missing. Please add the API Key during Client initialization.");}};var X=class extends T{code="PlatformError";message="Something went wrong. Please try again later."};var R=class extends q{constructor(e,t){super(`${G(e)} with id: \`${t}\` already exists. Please use a different id.`);}},w=class extends U{constructor(e,t){super(`${G(e)} with id: \`${t}\` does not exist. Please provide a valid id.`);}},E=class extends T{constructor(e,t){super(`Failed to execute ${G(e)} with id: \`${t}\`. Please try again later.`);}};var z=class extends w{code="ProviderNotFoundError";constructor(e){super("provider",e);}},J=class extends E{code="ProviderExecutionFailedError";constructor(e){super("workflow",e);}};var Q=class extends b{code="SignatureMismatchError";constructor(){super("Signature does not match the expected signature. Please ensure the signature provided in the `x-novu-signature` header is correct and try again.");}},Z=class extends b{code="SignatureNotFoundError";constructor(){super("Signature not found. Please provide a signature in the `x-novu-signature` header");}},H=class extends b{code="SignatureInvalidError";constructor(){super("Signature is invalid. Please provide a valid signature in the `x-novu-signature` header");}},ee=class extends b{code="SignatureExpiredError";constructor(){super(`Signature expired. Please provide a signature with a timestamp no older than ${5} minutes in the \`x-novu-signature\` header`);}},te=class extends b{code="SigningKeyNotFoundError";constructor(){super("Signature key not found. Please provide a valid key in the Client constructor `config.apiKey`");}};var ie=class extends w{code="StepNotFoundError";constructor(e){super("step",e);}},ne=class extends R{code="StepAlreadyExistsError";constructor(e){super("step",e);}};var D=class extends w{code="WorkflowNotFoundError";constructor(e){super("workflow",e);}},oe=class extends R{code="WorkflowAlreadyExistsError";constructor(e){super("workflow",e);}};var ge={name:"@novu/framework",version:"0.24.3-alpha.5",description:"The Code-First Notifications Workflow SDK.",main:"./dist/index.js",types:"./dist/index.d.ts",publishConfig:{registry:"https://registry.npmjs.org",access:"public"},private:!1,repository:{type:"git",url:"git+https://github.com/novuhq/novu.git"},files:["dist","README.md"],scripts:{preinstall:"npx only-allow pnpm",test:"vitest","test:watch":"vitest --watch",lint:"eslint src --ext .ts","lint:fix":"eslint src --ext .ts --fix",format:"prettier --check --ignore-path .gitignore .","format:fix":"prettier --write --ignore-path .gitignore .",build:"tsup","build:watch":"tsup --watch","$comment:bump:prerelease":"This is a workaround to support `npm version prerelease` with lerna","bump:prerelease":"npm version prerelease --preid=alpha & PID=$!; (sleep 1 && kill -9 $PID) & wait $PID","release:alpha":"pnpm bump:prerelease || pnpm build && npm publish --dry-run"},keywords:["novu","code-first","workflows","durable","sdk","notifications","email","sms","push","webhooks","next","nuxt","h3","express"],author:"Novu",license:"MIT",exports:{".":{require:"./dist/index.js",import:"./dist/index.js",types:"./dist/index.d.ts"},"./express":{require:"./dist/express.js",import:"./dist/express.js",types:"./dist/express.d.ts"},"./next":{require:"./dist/next.js",import:"./dist/next.js",types:"./dist/next.d.ts"},"./nuxt":{require:"./dist/nuxt.js",import:"./dist/nuxt.js",types:"./dist/nuxt.d.ts"},"./h3":{require:"./dist/h3.js",import:"./dist/h3.js",types:"./dist/h3.d.ts"},"./sveltekit":{require:"./dist/sveltekit.js",import:"./dist/sveltekit.js",types:"./dist/sveltekit.d.ts"},"./remix":{require:"./dist/remix.js",import:"./dist/remix.js",types:"./dist/remix.d.ts"}},devDependencies:{"@sveltejs/kit":"^2.5.10","@types/express":"^4.17.13","@types/json-schema":"^7.0.15","@types/node":"^20.11.20","@vercel/node":"^2.15.9",express:"^4.18.2",h3:"^1.11.1",next:"^13.5.4",prettier:"^3.2.5","ts-node":"^10.9.2",tsup:"^8.0.2",typescript:"^5.3.3",vitest:"^1.2.1"},dependencies:{ajv:"^8.12.0","ajv-formats":"^2.1.1","better-ajv-errors":"^1.2.0",chalk:"^4.1.2","cross-fetch":"^4.0.0","json-schema-faker":"^0.5.6","json-schema-to-ts":"^3.0.0",liquidjs:"^10.13.1",ora:"^5.4.1"}};var ce=ge.version;jsonSchemaFaker.JSONSchemaFaker.option({useDefaultValue:!0,alwaysFakeOptionals:!0});var N=class{discoveredWorkflows=[];ajv;templateEngine=new liquidjs.Liquid;apiUrl;apiKey;version=ce;strictAuthentication;static NOVU_SIGNATURE_HEADER="x-novu-signature";constructor(e){let t=this.buildOptions(e);this.apiKey=t.apiKey,this.apiUrl=t.apiUrl,this.strictAuthentication=t.strictAuthentication;let i=new Me__default.default({useDefaults:!0});Ue__default.default(i),this.ajv=i;}buildOptions(e){let t={apiKey:void 0,apiUrl:ue,strictAuthentication:!0};return e?.apiKey!==void 0?t.apiKey=e.apiKey:process.env.NOVU_API_KEY!==void 0&&(t.apiKey=process.env.NOVU_API_KEY),e?.apiUrl!==void 0?t.apiUrl=e.apiUrl:process.env.NOVU_API_URL!==void 0&&(t.apiUrl=process.env.NOVU_API_URL),e?.strictAuthentication!==void 0?t.strictAuthentication=e.strictAuthentication:process.env.NOVU_STRICT_AUTHENTICATION!==void 0&&(t.strictAuthentication=process.env.NOVU_STRICT_AUTHENTICATION==="true"),t}addWorkflows(e){for(let t of e){if(this.discoveredWorkflows.some(i=>i.workflowId===t.workflowId))throw new oe(t.workflowId);this.discoveredWorkflows.push(t);}}healthCheck(){let e=this.discoveredWorkflows.length,t=this.discoveredWorkflows.reduce((i,n)=>i+n.steps.length,0);return {status:"ok",version:ce,discovered:{workflows:e,steps:t}}}getWorkflow(e){let t=this.discoveredWorkflows.find(i=>i.workflowId===e);if(t)return t;throw new D(e)}getStep(e,t){let n=this.getWorkflow(e).steps.find(s=>s.stepId===t);if(n)return n;throw new ie(t)}getRegisteredWorkflows(){return this.discoveredWorkflows}discover(){return {workflows:this.getRegisteredWorkflows()}}getHeaders(e){let t={"content-type":"application/json",authorization:`ApiKey ${this.apiKey}`};return e&&(t["x-novu-anonymous"]=e),t}async diff(e,t){let i=this.discover()?.workflows||[];return (await fetch(this.apiUrl+"/v1/bridge/diff",{method:"POST",headers:this.getHeaders(t),body:JSON.stringify({workflows:i,bridgeUrl:e})})).json()}async sync(e,t,i){let{workflows:n}=this.discover();return (await fetch(`${this.apiUrl}/v1/bridge/sync?source=${i||"sdk"}`,{method:"POST",headers:this.getHeaders(t),body:JSON.stringify({workflows:n,bridgeUrl:e})})).json()}mock(e){return jsonSchemaFaker.JSONSchemaFaker.generate(e)}validate(e,t,i,n,s,a,r,h){if(!t(e)){let u=qe__default.default(i,e,t.errors||[]);switch(console.error(`
|
|
21
|
-
${
|
|
22
|
-
${
|
|
23
|
-
|
|
24
|
-
`)
|
|
25
|
-
${s.message}`)}}async executeStep(e,t){if(e.stepId===t.stepId){let i=se__default.default({indent:1}).start(`Executing stepId: \`${t.stepId}\``);try{let n=this.createStepInputs(t,e),s=await this.compileInputs(n,e),a=await t.resolve(s);this.validate(a,t.outputs.validate,t.outputs.schema,"step","output",e.workflowId,t.stepId);let r=await this.executeProviders(e,t);return i.succeed(`Executed stepId: \`${t.stepId}\``),{outputs:a,providers:r}}catch(n){throw i.stopAndPersist({prefixText:"",symbol:d.ERROR,text:`Failed to execute stepId: \`${t.stepId}\``}),n}}else {let i=se__default.default({indent:1}).start(`Hydrating stepId: \`${t.stepId}\``);try{let n=e.state.find(s=>s.stepId===t.stepId);if(n)return this.validate(n.outputs,t.results.validate,t.results.schema,"step","result",e.workflowId,t.stepId),i.stopAndPersist({symbol:d.HYDRATED,text:`Hydrated stepId: \`${t.stepId}\``}),{outputs:n.outputs,providers:await this.executeProviders(e,t)};throw new L(e.workflowId,t.stepId)}catch(n){throw i.stopAndPersist({symbol:d.ERROR,text:`Failed to hydrate stepId: \`${t.stepId}\``}),n}}}async compileInputs(e,t){let i=this.templateEngine.parse(JSON.stringify(e)),n=await this.templateEngine.render(i,{...t.data,subscriber:t.subscriber});return JSON.parse(n)}createStepInputs(e,t){let i=t.inputs;return this.validate(i,e.inputs.validate,e.inputs.schema,"step","input",t.workflowId,e.stepId),i}async previewStep(e,t){let i=se__default.default({indent:1}).start(`Previewing stepId: \`${t.stepId}\``);try{if(e.stepId===t.stepId){let n=this.createStepInputs(t,e),s=await t.resolve(n);return this.validate(s,t.outputs.validate,t.outputs.schema,"step","output",e.workflowId,t.stepId),i.stopAndPersist({symbol:d.MOCK,text:`Mocked stepId: \`${t.stepId}\``}),{outputs:s,providers:await this.executeProviders(e,t)}}else {let n=this.mock(t.results.schema);return i.stopAndPersist({symbol:d.MOCK,text:`Mocked stepId: \`${t.stepId}\``}),{outputs:n,providers:await this.executeProviders(e,t)}}}catch(n){throw i.stopAndPersist({symbol:d.ERROR,text:`Failed to preview stepId: \`${t.stepId}\``}),n}}getStepCode(e,t){return {code:this.getStep(e,t).resolve.toString()}}getWorkflowCode(e){return {code:this.getWorkflow(e).execute.toString()}}getCode(e,t){let i;if(e)t?i=this.getStepCode(e,t):i=this.getWorkflowCode(e);else throw new D(e);return i}};function Fe(o){return JSON.parse(JSON.stringify(o))}var We=(p=>(p.PENDING="pending",p.QUEUED="queued",p.RUNNING="running",p.COMPLETED="completed",p.FAILED="failed",p.DELAYED="delayed",p.CANCELED="canceled",p.MERGED="merged",p.SKIPPED="skipped",p))(We||{});var pe=class{frameworkName;handler;client;hmacEnabled;constructor(e){this.handler=e.handler,this.client=e.client?e.client:new N,this.client.addWorkflows(e.workflows),this.frameworkName=e.frameworkName,this.hmacEnabled=this.client.strictAuthentication;}createHandler(){return async(...e)=>{let t=await this.handler(...e),i=await this.handleAction({actions:t});return t.transformResponse(i)}}getStaticHeaders(){let e=`novu-framework:v${this.client.version}`;return {"content-type":"application/json","access-control-allow-origin":"*","access-control-allow-methods":"GET, POST","access-control-allow-headers":"*","access-control-max-age":"604800","x-novu-framework":this.frameworkName,"user-agent":e,"x-novu-sdk":e}}createResponse(e,t,i={}){return {status:e,body:JSON.stringify(t),headers:{...this.getStaticHeaders(),...i}}}createError(e){return {status:e.statusCode,body:JSON.stringify({message:e.message,data:e.data,code:e.code}),headers:this.getStaticHeaders()}}async handleAction({actions:e}){let t=await e.url(),i=await e.method(),n=t.searchParams.get("action")||"",s=t.searchParams.get("workflowId")||"",a=t.searchParams.get("stepId")||"",r=await e.headers("x-novu-signature")||"",h=await e.headers("x-novu-anonymous")||"",p=t.searchParams.get("source")||"",u={};try{i==="POST"&&(u=await e.body());}catch{}try{n!=="health-check"&&this.validateHmac(u,r);let m=this.getPostActionMap(u,s,a,n,h,p),I=this.getGetActionMap(s,a);if(i==="POST")return await this.handlePostAction(n,m);if(i==="GET")return await this.handleGetAction(n,I);if(i==="OPTIONS")return this.createResponse(200,{},{...this.getStaticHeaders()})}catch(m){return this.handleError(m)}return this.createError(new K(i))}getPostActionMap(e,t,i,n,s,a){return {execute:async()=>{let r=await this.client.executeWorkflow({...e,workflowId:t,stepId:i,action:n});return this.createResponse(200,r,{"x-novu-execution-duration":r.metadata.duration.toString()})},preview:async()=>{let r=await this.client.executeWorkflow({...e,workflowId:t,stepId:i,action:n});return this.createResponse(200,r,{"x-novu-execution-duration":r.metadata.duration.toString()})},sync:async()=>{if(!this.client.apiKey)throw new C;let r=await this.client.sync(e.bridgeUrl,s,a);return this.createResponse(200,r)},diff:async()=>{if(!this.client.apiKey)throw new C;let r=await this.client.diff(e.bridgeUrl,s);return this.createResponse(200,r)}}}getGetActionMap(e,t){return {discover:async()=>{let i=await this.client.discover();return this.createResponse(200,i)},"health-check":async()=>{let i=await this.client.healthCheck();return this.createResponse(200,i)},code:async()=>{let i=await this.client.getCode(e,t);return this.createResponse(200,i)}}}async handlePostAction(e,t){if(Object.values($).includes(e)){let i=t[e];return i()}else throw new P(e,$)}async handleGetAction(e,t){if(Object.values(M).includes(e)){let i=t[e];return i()}else throw new P(e,M)}isClientError(e){return Object.values(y).includes(e.code)}handleError(e){return this.isClientError(e)?(e.statusCode===500&&console.error(e),this.createError(e)):(console.error(e),this.createError(new X))}validateHmac(e,t){if(!this.hmacEnabled)return;if(!t)throw new Z;if(!this.client.apiKey)throw new te;let[i,n]=t.split(",");if(!i||!n)throw new H;let[s,a]=i.split("="),[r,h]=n.split("=");if(Number(s)<Date.now()-1500)throw new ee;if(!(this.hashHmac(this.client.apiKey,`${a}.${JSON.stringify(e)}`)===h))throw new Q}hashHmac(e,t){return crypto.createHmac("sha256",e).update(t).digest("hex")}};var Be={type:"object",properties:{webhookUrl:{type:"string",format:"uri"},text:{type:"string"},blocks:{type:"array",items:{type:"object",properties:{type:{enum:["image","context","actions","divider","section","input","file","header","video","rich_text"]}},required:["type"],additionalProperties:!0,allOf:[{if:{properties:{type:{const:"image"}}},then:{$ref:"#/definitions/ImageBlock"}},{if:{properties:{type:{const:"context"}}},then:{$ref:"#/definitions/ContextBlock"}},{if:{properties:{type:{const:"actions"}}},then:{$ref:"#/definitions/ActionsBlock"}},{if:{properties:{type:{const:"divider"}}},then:{$ref:"#/definitions/DividerBlock"}},{if:{properties:{type:{const:"section"}}},then:{$ref:"#/definitions/SectionBlock"}},{if:{properties:{type:{const:"Input"}}},then:{$ref:"#/definitions/InputBlock"}},{if:{properties:{type:{const:"Video"}}},then:{$ref:"#/definitions/VideoBlock"}},{if:{properties:{type:{const:"rich_text"}}},then:{$ref:"#/definitions/RichTextBlock"}}]}}},definitions:{KnownBlock:{oneOf:[{$ref:"#/definitions/ImageBlock"},{$ref:"#/definitions/ContextBlock"},{$ref:"#/definitions/ActionsBlock"},{$ref:"#/definitions/DividerBlock"},{$ref:"#/definitions/SectionBlock"},{$ref:"#/definitions/InputBlock"},{$ref:"#/definitions/FileBlock"},{$ref:"#/definitions/HeaderBlock"},{$ref:"#/definitions/VideoBlock"},{$ref:"#/definitions/RichTextBlock"}]},ImageBlock:{type:"object",properties:{type:{type:"string",const:"image",description:"The type of block. For an image block, `type` is always `image`."},block_id:{type:"string"},image_url:{type:"string",description:"The URL of the image to be displayed. Maximum length for this field is 3000 characters."},alt_text:{type:"string",description:`A plain-text summary of the image. This should not contain any markup.
|
|
18
|
+
var g=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var Rt=g(B=>{Object.defineProperty(B,"__esModule",{value:!0});B.getDefaultOptions=B.defaultOptions=B.ignoreOverride=void 0;B.ignoreOverride=Symbol("Let zodToJsonSchema decide on which parser to use");B.defaultOptions={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",definitionPath:"definitions",target:"jsonSchema7",strictUnions:!1,definitions:{},errorMessages:!1,markdownDescription:!1,patternStrategy:"escape",emailStrategy:"format:email",base64Strategy:"contentEncoding:base64"};var xr=i=>typeof i=="string"?{...B.defaultOptions,name:i}:{...B.defaultOptions,...i};B.getDefaultOptions=xr;});var Ti=g(At=>{Object.defineProperty(At,"__esModule",{value:!0});At.getRefs=void 0;var wr=Rt(),Tr=i=>{let e=(0, wr.getDefaultOptions)(i),t=e.name!==void 0?[...e.basePath,e.definitionPath,e.name]:e.basePath;return {...e,currentPath:t,propertyPath:void 0,seen:new Map(Object.entries(e.definitions).map(([n,r])=>[r._def,{def:r._def,path:[...e.basePath,e.definitionPath,n],jsonSchema:void 0}]))}};At.getRefs=Tr;});var re=g(Me=>{Object.defineProperty(Me,"__esModule",{value:!0});Me.setResponseValueAndErrors=Me.addErrorMessage=void 0;function gn(i,e,t,n){n?.errorMessages&&t&&(i.errorMessage={...i.errorMessage,[e]:t});}Me.addErrorMessage=gn;function kr(i,e,t,n,r){i[e]=t,gn(i,e,n,r);}Me.setResponseValueAndErrors=kr;});var Ge=g(k=>{Object.defineProperty(k,"__esModule",{value:!0});k.getParsedType=k.ZodParsedType=k.objectUtil=k.util=void 0;var _n;(function(i){i.assertEqual=r=>r;function e(r){}i.assertIs=e;function t(r){throw new Error}i.assertNever=t,i.arrayToEnum=r=>{let s={};for(let o of r)s[o]=o;return s},i.getValidEnumValues=r=>{let s=i.objectKeys(r).filter(c=>typeof r[r[c]]!="number"),o={};for(let c of s)o[c]=r[c];return i.objectValues(o)},i.objectValues=r=>i.objectKeys(r).map(function(s){return r[s]}),i.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let s=[];for(let o in r)Object.prototype.hasOwnProperty.call(r,o)&&s.push(o);return s},i.find=(r,s)=>{for(let o of r)if(s(o))return o},i.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&isFinite(r)&&Math.floor(r)===r;function n(r,s=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(s)}i.joinValues=n,i.jsonStringifyReplacer=(r,s)=>typeof s=="bigint"?s.toString():s;})(_n=k.util||(k.util={}));(function(i){i.mergeShapes=(e,t)=>({...e,...t});})(k.objectUtil||(k.objectUtil={}));k.ZodParsedType=_n.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]);var Pr=i=>{switch(typeof i){case"undefined":return k.ZodParsedType.undefined;case"string":return k.ZodParsedType.string;case"number":return isNaN(i)?k.ZodParsedType.nan:k.ZodParsedType.number;case"boolean":return k.ZodParsedType.boolean;case"function":return k.ZodParsedType.function;case"bigint":return k.ZodParsedType.bigint;case"symbol":return k.ZodParsedType.symbol;case"object":return Array.isArray(i)?k.ZodParsedType.array:i===null?k.ZodParsedType.null:i.then&&typeof i.then=="function"&&i.catch&&typeof i.catch=="function"?k.ZodParsedType.promise:typeof Map<"u"&&i instanceof Map?k.ZodParsedType.map:typeof Set<"u"&&i instanceof Set?k.ZodParsedType.set:typeof Date<"u"&&i instanceof Date?k.ZodParsedType.date:k.ZodParsedType.object;default:return k.ZodParsedType.unknown}};k.getParsedType=Pr;});var Dt=g(se=>{Object.defineProperty(se,"__esModule",{value:!0});se.ZodError=se.quotelessJson=se.ZodIssueCode=void 0;var vn=Ge();se.ZodIssueCode=vn.util.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);var Sr=i=>JSON.stringify(i,null,2).replace(/"([^"]+)":/g,"$1:");se.quotelessJson=Sr;var Xe=class i extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n];},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n];};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e;}get errors(){return this.issues}format(e){let t=e||function(s){return s.message},n={_errors:[]},r=s=>{for(let o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)n._errors.push(t(o));else {let c=n,d=0;for(;d<o.path.length;){let u=o.path[d];d===o.path.length-1?(c[u]=c[u]||{_errors:[]},c[u]._errors.push(t(o))):c[u]=c[u]||{_errors:[]},c=c[u],d++;}}};return r(this),n}static assert(e){if(!(e instanceof i))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,vn.util.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return {formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};se.ZodError=Xe;Xe.create=i=>new Xe(i);});var Ii=g(ki=>{Object.defineProperty(ki,"__esModule",{value:!0});var pe=Ge(),R=Dt(),Or=(i,e)=>{let t;switch(i.code){case R.ZodIssueCode.invalid_type:i.received===pe.ZodParsedType.undefined?t="Required":t=`Expected ${i.expected}, received ${i.received}`;break;case R.ZodIssueCode.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(i.expected,pe.util.jsonStringifyReplacer)}`;break;case R.ZodIssueCode.unrecognized_keys:t=`Unrecognized key(s) in object: ${pe.util.joinValues(i.keys,", ")}`;break;case R.ZodIssueCode.invalid_union:t="Invalid input";break;case R.ZodIssueCode.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${pe.util.joinValues(i.options)}`;break;case R.ZodIssueCode.invalid_enum_value:t=`Invalid enum value. Expected ${pe.util.joinValues(i.options)}, received '${i.received}'`;break;case R.ZodIssueCode.invalid_arguments:t="Invalid function arguments";break;case R.ZodIssueCode.invalid_return_type:t="Invalid function return type";break;case R.ZodIssueCode.invalid_date:t="Invalid date";break;case R.ZodIssueCode.invalid_string:typeof i.validation=="object"?"includes"in i.validation?(t=`Invalid input: must include "${i.validation.includes}"`,typeof i.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${i.validation.position}`)):"startsWith"in i.validation?t=`Invalid input: must start with "${i.validation.startsWith}"`:"endsWith"in i.validation?t=`Invalid input: must end with "${i.validation.endsWith}"`:pe.util.assertNever(i.validation):i.validation!=="regex"?t=`Invalid ${i.validation}`:t="Invalid";break;case R.ZodIssueCode.too_small:i.type==="array"?t=`Array must contain ${i.exact?"exactly":i.inclusive?"at least":"more than"} ${i.minimum} element(s)`:i.type==="string"?t=`String must contain ${i.exact?"exactly":i.inclusive?"at least":"over"} ${i.minimum} character(s)`:i.type==="number"?t=`Number must be ${i.exact?"exactly equal to ":i.inclusive?"greater than or equal to ":"greater than "}${i.minimum}`:i.type==="date"?t=`Date must be ${i.exact?"exactly equal to ":i.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(i.minimum))}`:t="Invalid input";break;case R.ZodIssueCode.too_big:i.type==="array"?t=`Array must contain ${i.exact?"exactly":i.inclusive?"at most":"less than"} ${i.maximum} element(s)`:i.type==="string"?t=`String must contain ${i.exact?"exactly":i.inclusive?"at most":"under"} ${i.maximum} character(s)`:i.type==="number"?t=`Number must be ${i.exact?"exactly":i.inclusive?"less than or equal to":"less than"} ${i.maximum}`:i.type==="bigint"?t=`BigInt must be ${i.exact?"exactly":i.inclusive?"less than or equal to":"less than"} ${i.maximum}`:i.type==="date"?t=`Date must be ${i.exact?"exactly":i.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(i.maximum))}`:t="Invalid input";break;case R.ZodIssueCode.custom:t="Invalid input";break;case R.ZodIssueCode.invalid_intersection_types:t="Intersection results could not be merged";break;case R.ZodIssueCode.not_multiple_of:t=`Number must be a multiple of ${i.multipleOf}`;break;case R.ZodIssueCode.not_finite:t="Number must be finite";break;default:t=e.defaultError,pe.util.assertNever(i);}return {message:t}};ki.default=Or;});var Ct=g(K=>{var Er=K&&K.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(K,"__esModule",{value:!0});K.getErrorMap=K.setErrorMap=K.defaultErrorMap=void 0;var bn=Er(Ii());K.defaultErrorMap=bn.default;var xn=bn.default;function Rr(i){xn=i;}K.setErrorMap=Rr;function Ar(){return xn}K.getErrorMap=Ar;});var Si=g(T=>{var Dr=T&&T.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(T,"__esModule",{value:!0});T.isAsync=T.isValid=T.isDirty=T.isAborted=T.OK=T.DIRTY=T.INVALID=T.ParseStatus=T.addIssueToContext=T.EMPTY_PATH=T.makeIssue=void 0;var Cr=Ct(),wn=Dr(Ii()),jr=i=>{let{data:e,path:t,errorMaps:n,issueData:r}=i,s=[...t,...r.path||[]],o={...r,path:s};if(r.message!==void 0)return {...r,path:s,message:r.message};let c="",d=n.filter(u=>!!u).slice().reverse();for(let u of d)c=u(o,{data:e,defaultError:c}).message;return {...r,path:s,message:c}};T.makeIssue=jr;T.EMPTY_PATH=[];function Nr(i,e){let t=(0, Cr.getErrorMap)(),n=(0, T.makeIssue)({issueData:e,data:i.data,path:i.path,errorMaps:[i.common.contextualErrorMap,i.schemaErrorMap,t,t===wn.default?void 0:wn.default].filter(r=>!!r)});i.common.issues.push(n);}T.addIssueToContext=Nr;var Pi=class i{constructor(){this.value="valid";}dirty(){this.value==="valid"&&(this.value="dirty");}abort(){this.value!=="aborted"&&(this.value="aborted");}static mergeArray(e,t){let n=[];for(let r of t){if(r.status==="aborted")return T.INVALID;r.status==="dirty"&&e.dirty(),n.push(r.value);}return {status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let r of t){let s=await r.key,o=await r.value;n.push({key:s,value:o});}return i.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let r of t){let{key:s,value:o}=r;if(s.status==="aborted"||o.status==="aborted")return T.INVALID;s.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),s.value!=="__proto__"&&(typeof o.value<"u"||r.alwaysSet)&&(n[s.value]=o.value);}return {status:e.value,value:n}}};T.ParseStatus=Pi;T.INVALID=Object.freeze({status:"aborted"});var Mr=i=>({status:"dirty",value:i});T.DIRTY=Mr;var Zr=i=>({status:"valid",value:i});T.OK=Zr;var $r=i=>i.status==="aborted";T.isAborted=$r;var Ur=i=>i.status==="dirty";T.isDirty=Ur;var qr=i=>i.status==="valid";T.isValid=qr;var Lr=i=>typeof Promise<"u"&&i instanceof Promise;T.isAsync=Lr;});var kn=g(Tn=>{Object.defineProperty(Tn,"__esModule",{value:!0});});var In=g(Je=>{Object.defineProperty(Je,"__esModule",{value:!0});Je.errorUtil=void 0;(function(i){i.errToObj=e=>typeof e=="string"?{message:e}:e||{},i.toString=e=>typeof e=="string"?e:e?.message;})(Je.errorUtil||(Je.errorUtil={}));});var Zn=g(a=>{var Nt=a&&a.__classPrivateFieldGet||function(i,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(i):n?n.value:e.get(i)},Sn=a&&a.__classPrivateFieldSet||function(i,e,t,n,r){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?r.call(i,t):r?r.value=t:e.set(i,t),t},Qe,He;Object.defineProperty(a,"__esModule",{value:!0});a.boolean=a.bigint=a.array=a.any=a.coerce=a.ZodFirstPartyTypeKind=a.late=a.ZodSchema=a.Schema=a.custom=a.ZodReadonly=a.ZodPipeline=a.ZodBranded=a.BRAND=a.ZodNaN=a.ZodCatch=a.ZodDefault=a.ZodNullable=a.ZodOptional=a.ZodTransformer=a.ZodEffects=a.ZodPromise=a.ZodNativeEnum=a.ZodEnum=a.ZodLiteral=a.ZodLazy=a.ZodFunction=a.ZodSet=a.ZodMap=a.ZodRecord=a.ZodTuple=a.ZodIntersection=a.ZodDiscriminatedUnion=a.ZodUnion=a.ZodObject=a.ZodArray=a.ZodVoid=a.ZodNever=a.ZodUnknown=a.ZodAny=a.ZodNull=a.ZodUndefined=a.ZodSymbol=a.ZodDate=a.ZodBoolean=a.ZodBigInt=a.ZodNumber=a.ZodString=a.datetimeRegex=a.ZodType=void 0;a.NEVER=a.void=a.unknown=a.union=a.undefined=a.tuple=a.transformer=a.symbol=a.string=a.strictObject=a.set=a.record=a.promise=a.preprocess=a.pipeline=a.ostring=a.optional=a.onumber=a.oboolean=a.object=a.number=a.nullable=a.null=a.never=a.nativeEnum=a.nan=a.map=a.literal=a.lazy=a.intersection=a.instanceof=a.function=a.enum=a.effect=a.discriminatedUnion=a.date=void 0;var jt=Ct(),m=In(),l=Si(),h=Ge(),p=Dt(),$=class{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r;}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Pn=(i,e)=>{if((0, l.isValid)(e))return {success:!0,data:e.value};if(!i.common.issues.length)throw new Error("Validation failed but no issues detected.");return {success:!1,get error(){if(this._error)return this._error;let t=new p.ZodError(i.common.issues);return this._error=t,this._error}}};function _(i){if(!i)return {};let{errorMap:e,invalid_type_error:t,required_error:n,description:r}=i;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(o,c)=>{var d,u;let{message:f}=i;return o.code==="invalid_enum_value"?{message:f??c.defaultError}:typeof c.data>"u"?{message:(d=f??n)!==null&&d!==void 0?d:c.defaultError}:o.code!=="invalid_type"?{message:c.defaultError}:{message:(u=f??t)!==null&&u!==void 0?u:c.defaultError}},description:r}}var v=class{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this);}get description(){return this._def.description}_getType(e){return (0, h.getParsedType)(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:(0, h.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return {status:new l.ParseStatus,ctx:{common:e.parent.common,data:e.data,parsedType:(0, h.getParsedType)(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if((0, l.isAsync)(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;let r={common:{issues:[],async:(n=t?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0, h.getParsedType)(e)},s=this._parseSync({data:e,path:r.path,parent:r});return Pn(r,s)}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:(0, h.getParsedType)(e)},r=this._parse({data:e,path:n.path,parent:n}),s=await((0, l.isAsync)(r)?r:Promise.resolve(r));return Pn(n,s)}refine(e,t){let n=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,s)=>{let o=e(r),c=()=>s.addIssue({code:p.ZodIssueCode.custom,...n(r)});return typeof Promise<"u"&&o instanceof Promise?o.then(d=>d?!0:(c(),!1)):o?!0:(c(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t=="function"?t(n,r):t),!1))}_refinement(e){return new j({schema:this,typeName:y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return Z.create(this,this._def)}nullable(){return Y.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return H.create(this,this._def)}promise(){return ce.create(this,this._def)}or(e){return ve.create([this,e],this._def)}and(e){return be.create(this,e,this._def)}transform(e){return new j({..._(this._def),schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new Ie({..._(this._def),innerType:this,defaultValue:t,typeName:y.ZodDefault})}brand(){return new et({typeName:y.ZodBranded,type:this,..._(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Pe({..._(this._def),innerType:this,catchValue:t,typeName:y.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return tt.create(this,e)}readonly(){return Se.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};a.ZodType=v;a.Schema=v;a.ZodSchema=v;var Fr=/^c[^\s-]{8,}$/i,Wr=/^[0-9a-z]+$/,Br=/^[0-9A-HJKMNP-TV-Z]{26}$/,Kr=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,zr=/^[a-z0-9_-]{21}$/i,Yr=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Gr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Xr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Oi,Jr=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Qr=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,Hr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,On="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",es=new RegExp(`^${On}$`);function En(i){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return i.precision?e=`${e}\\.\\d{${i.precision}}`:i.precision==null&&(e=`${e}(\\.\\d+)?`),e}function ts(i){return new RegExp(`^${En(i)}$`)}function Rn(i){let e=`${On}T${En(i)}`,t=[];return t.push(i.local?"Z?":"Z"),i.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}a.datetimeRegex=Rn;function is(i,e){return !!((e==="v4"||!e)&&Jr.test(i)||(e==="v6"||!e)&&Qr.test(i))}var oe=class i extends v{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==h.ZodParsedType.string){let s=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.string,received:s.parsedType}),l.INVALID}let n=new l.ParseStatus,r;for(let s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:p.ZodIssueCode.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:p.ZodIssueCode.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){let o=e.data.length>s.value,c=e.data.length<s.value;(o||c)&&(r=this._getOrReturnCtx(e,r),o?(0, l.addIssueToContext)(r,{code:p.ZodIssueCode.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):c&&(0, l.addIssueToContext)(r,{code:p.ZodIssueCode.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty());}else if(s.kind==="email")Gr.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"email",code:p.ZodIssueCode.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Oi||(Oi=new RegExp(Xr,"u")),Oi.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"emoji",code:p.ZodIssueCode.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")Kr.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"uuid",code:p.ZodIssueCode.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")zr.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"nanoid",code:p.ZodIssueCode.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")Fr.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"cuid",code:p.ZodIssueCode.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")Wr.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"cuid2",code:p.ZodIssueCode.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")Br.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"ulid",code:p.ZodIssueCode.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data);}catch{r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"url",code:p.ZodIssueCode.invalid_string,message:s.message}),n.dirty();}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"regex",code:p.ZodIssueCode.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Rn(s).test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?es.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?ts(s).test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:p.ZodIssueCode.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?Yr.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"duration",code:p.ZodIssueCode.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?is(e.data,s.version)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"ip",code:p.ZodIssueCode.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?Hr.test(e.data)||(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{validation:"base64",code:p.ZodIssueCode.invalid_string,message:s.message}),n.dirty()):h.util.assertNever(s);return {status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(r=>e.test(r),{validation:t,code:p.ZodIssueCode.invalid_string,...m.errorUtil.errToObj(n)})}_addCheck(e){return new i({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...m.errorUtil.errToObj(e)})}url(e){return this._addCheck({kind:"url",...m.errorUtil.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...m.errorUtil.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...m.errorUtil.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...m.errorUtil.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...m.errorUtil.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...m.errorUtil.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...m.errorUtil.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...m.errorUtil.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...m.errorUtil.errToObj(e)})}datetime(e){var t,n;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(t=e?.offset)!==null&&t!==void 0?t:!1,local:(n=e?.local)!==null&&n!==void 0?n:!1,...m.errorUtil.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...m.errorUtil.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...m.errorUtil.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...m.errorUtil.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...m.errorUtil.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...m.errorUtil.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...m.errorUtil.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...m.errorUtil.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...m.errorUtil.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...m.errorUtil.errToObj(t)})}nonempty(e){return this.min(1,m.errorUtil.errToObj(e))}trim(){return new i({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new i({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new i({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return !!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return !!this._def.checks.find(e=>e.kind==="date")}get isTime(){return !!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return !!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return !!this._def.checks.find(e=>e.kind==="email")}get isURL(){return !!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return !!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return !!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return !!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return !!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return !!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return !!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return !!this._def.checks.find(e=>e.kind==="ip")}get isBase64(){return !!this._def.checks.find(e=>e.kind==="base64")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};a.ZodString=oe;oe.create=i=>{var e;return new oe({checks:[],typeName:y.ZodString,coerce:(e=i?.coerce)!==null&&e!==void 0?e:!1,..._(i)})};function ns(i,e){let t=(i.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,r=t>n?t:n,s=parseInt(i.toFixed(r).replace(".","")),o=parseInt(e.toFixed(r).replace(".",""));return s%o/Math.pow(10,r)}var he=class i extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf;}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==h.ZodParsedType.number){let s=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.number,received:s.parsedType}),l.INVALID}let n,r=new l.ParseStatus;for(let s of this._def.checks)s.kind==="int"?h.util.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),(0, l.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),(0, l.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),(0, l.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="multipleOf"?ns(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),(0, l.addIssueToContext)(n,{code:p.ZodIssueCode.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),(0, l.addIssueToContext)(n,{code:p.ZodIssueCode.not_finite,message:s.message}),r.dirty()):h.util.assertNever(s);return {status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,m.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.errorUtil.toString(t))}setLimit(e,t,n,r){return new i({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:m.errorUtil.toString(r)}]})}_addCheck(e){return new i({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:m.errorUtil.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:m.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:m.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:m.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:m.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.errorUtil.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:m.errorUtil.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:m.errorUtil.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:m.errorUtil.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return !!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&h.util.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return !0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);}return Number.isFinite(t)&&Number.isFinite(e)}};a.ZodNumber=he;he.create=i=>new he({checks:[],typeName:y.ZodNumber,coerce:i?.coerce||!1,..._(i)});var fe=class i extends v{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte;}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==h.ZodParsedType.bigint){let s=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.bigint,received:s.parsedType}),l.INVALID}let n,r=new l.ParseStatus;for(let s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),(0, l.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),(0, l.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),(0, l.addIssueToContext)(n,{code:p.ZodIssueCode.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):h.util.assertNever(s);return {status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,m.errorUtil.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.errorUtil.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.errorUtil.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.errorUtil.toString(t))}setLimit(e,t,n,r){return new i({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:m.errorUtil.toString(r)}]})}_addCheck(e){return new i({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:m.errorUtil.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:m.errorUtil.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:m.errorUtil.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:m.errorUtil.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.errorUtil.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};a.ZodBigInt=fe;fe.create=i=>{var e;return new fe({checks:[],typeName:y.ZodBigInt,coerce:(e=i?.coerce)!==null&&e!==void 0?e:!1,..._(i)})};var me=class extends v{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==h.ZodParsedType.boolean){let n=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.boolean,received:n.parsedType}),l.INVALID}return (0, l.OK)(e.data)}};a.ZodBoolean=me;me.create=i=>new me({typeName:y.ZodBoolean,coerce:i?.coerce||!1,..._(i)});var ye=class i extends v{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==h.ZodParsedType.date){let s=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.date,received:s.parsedType}),l.INVALID}if(isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(s,{code:p.ZodIssueCode.invalid_date}),l.INVALID}let n=new l.ParseStatus,r;for(let s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:p.ZodIssueCode.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(r=this._getOrReturnCtx(e,r),(0, l.addIssueToContext)(r,{code:p.ZodIssueCode.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):h.util.assertNever(s);return {status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new i({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:m.errorUtil.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:m.errorUtil.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};a.ZodDate=ye;ye.create=i=>new ye({checks:[],coerce:i?.coerce||!1,typeName:y.ZodDate,..._(i)});var $e=class extends v{_parse(e){if(this._getType(e)!==h.ZodParsedType.symbol){let n=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.symbol,received:n.parsedType}),l.INVALID}return (0, l.OK)(e.data)}};a.ZodSymbol=$e;$e.create=i=>new $e({typeName:y.ZodSymbol,..._(i)});var ge=class extends v{_parse(e){if(this._getType(e)!==h.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.undefined,received:n.parsedType}),l.INVALID}return (0, l.OK)(e.data)}};a.ZodUndefined=ge;ge.create=i=>new ge({typeName:y.ZodUndefined,..._(i)});var _e=class extends v{_parse(e){if(this._getType(e)!==h.ZodParsedType.null){let n=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.null,received:n.parsedType}),l.INVALID}return (0, l.OK)(e.data)}};a.ZodNull=_e;_e.create=i=>new _e({typeName:y.ZodNull,..._(i)});var ae=class extends v{constructor(){super(...arguments),this._any=!0;}_parse(e){return (0, l.OK)(e.data)}};a.ZodAny=ae;ae.create=i=>new ae({typeName:y.ZodAny,..._(i)});var Q=class extends v{constructor(){super(...arguments),this._unknown=!0;}_parse(e){return (0, l.OK)(e.data)}};a.ZodUnknown=Q;Q.create=i=>new Q({typeName:y.ZodUnknown,..._(i)});var L=class extends v{_parse(e){let t=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(t,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.never,received:t.parsedType}),l.INVALID}};a.ZodNever=L;L.create=i=>new L({typeName:y.ZodNever,..._(i)});var Ue=class extends v{_parse(e){if(this._getType(e)!==h.ZodParsedType.undefined){let n=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.void,received:n.parsedType}),l.INVALID}return (0, l.OK)(e.data)}};a.ZodVoid=Ue;Ue.create=i=>new Ue({typeName:y.ZodVoid,..._(i)});var H=class i extends v{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==h.ZodParsedType.array)return (0, l.addIssueToContext)(t,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.array,received:t.parsedType}),l.INVALID;if(r.exactLength!==null){let o=t.data.length>r.exactLength.value,c=t.data.length<r.exactLength.value;(o||c)&&((0, l.addIssueToContext)(t,{code:o?p.ZodIssueCode.too_big:p.ZodIssueCode.too_small,minimum:c?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty());}if(r.minLength!==null&&t.data.length<r.minLength.value&&((0, l.addIssueToContext)(t,{code:p.ZodIssueCode.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&((0, l.addIssueToContext)(t,{code:p.ZodIssueCode.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((o,c)=>r.type._parseAsync(new $(t,o,t.path,c)))).then(o=>l.ParseStatus.mergeArray(n,o));let s=[...t.data].map((o,c)=>r.type._parseSync(new $(t,o,t.path,c)));return l.ParseStatus.mergeArray(n,s)}get element(){return this._def.type}min(e,t){return new i({...this._def,minLength:{value:e,message:m.errorUtil.toString(t)}})}max(e,t){return new i({...this._def,maxLength:{value:e,message:m.errorUtil.toString(t)}})}length(e,t){return new i({...this._def,exactLength:{value:e,message:m.errorUtil.toString(t)}})}nonempty(e){return this.min(1,e)}};a.ZodArray=H;H.create=(i,e)=>new H({type:i,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray,..._(e)});function Ze(i){if(i instanceof A){let e={};for(let t in i.shape){let n=i.shape[t];e[t]=Z.create(Ze(n));}return new A({...i._def,shape:()=>e})}else return i instanceof H?new H({...i._def,type:Ze(i.element)}):i instanceof Z?Z.create(Ze(i.unwrap())):i instanceof Y?Y.create(Ze(i.unwrap())):i instanceof z?z.create(i.items.map(e=>Ze(e))):i}var A=class i extends v{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend;}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=h.util.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==h.ZodParsedType.object){let u=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(u,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:u.parsedType}),l.INVALID}let{status:n,ctx:r}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),c=[];if(!(this._def.catchall instanceof L&&this._def.unknownKeys==="strip"))for(let u in r.data)o.includes(u)||c.push(u);let d=[];for(let u of o){let f=s[u],P=r.data[u];d.push({key:{status:"valid",value:u},value:f._parse(new $(r,P,r.path,u)),alwaysSet:u in r.data});}if(this._def.catchall instanceof L){let u=this._def.unknownKeys;if(u==="passthrough")for(let f of c)d.push({key:{status:"valid",value:f},value:{status:"valid",value:r.data[f]}});else if(u==="strict")c.length>0&&((0, l.addIssueToContext)(r,{code:p.ZodIssueCode.unrecognized_keys,keys:c}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else {let u=this._def.catchall;for(let f of c){let P=r.data[f];d.push({key:{status:"valid",value:f},value:u._parse(new $(r,P,r.path,f)),alwaysSet:f in r.data});}}return r.common.async?Promise.resolve().then(async()=>{let u=[];for(let f of d){let P=await f.key,ee=await f.value;u.push({key:P,value:ee,alwaysSet:f.alwaysSet});}return u}).then(u=>l.ParseStatus.mergeObjectSync(n,u)):l.ParseStatus.mergeObjectSync(n,d)}get shape(){return this._def.shape()}strict(e){return m.errorUtil.errToObj,new i({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var r,s,o,c;let d=(o=(s=(r=this._def).errorMap)===null||s===void 0?void 0:s.call(r,t,n).message)!==null&&o!==void 0?o:n.defaultError;return t.code==="unrecognized_keys"?{message:(c=m.errorUtil.errToObj(e).message)!==null&&c!==void 0?c:d}:{message:d}}}:{}})}strip(){return new i({...this._def,unknownKeys:"strip"})}passthrough(){return new i({...this._def,unknownKeys:"passthrough"})}extend(e){return new i({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new i({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:y.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new i({...this._def,catchall:e})}pick(e){let t={};return h.util.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n]);}),new i({...this._def,shape:()=>t})}omit(e){let t={};return h.util.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n]);}),new i({...this._def,shape:()=>t})}deepPartial(){return Ze(this)}partial(e){let t={};return h.util.objectKeys(this.shape).forEach(n=>{let r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional();}),new i({...this._def,shape:()=>t})}required(e){let t={};return h.util.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else {let s=this.shape[n];for(;s instanceof Z;)s=s._def.innerType;t[n]=s;}}),new i({...this._def,shape:()=>t})}keyof(){return An(h.util.objectKeys(this.shape))}};a.ZodObject=A;A.create=(i,e)=>new A({shape:()=>i,unknownKeys:"strip",catchall:L.create(),typeName:y.ZodObject,..._(e)});A.strictCreate=(i,e)=>new A({shape:()=>i,unknownKeys:"strict",catchall:L.create(),typeName:y.ZodObject,..._(e)});A.lazycreate=(i,e)=>new A({shape:i,unknownKeys:"strip",catchall:L.create(),typeName:y.ZodObject,..._(e)});var ve=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function r(s){for(let c of s)if(c.result.status==="valid")return c.result;for(let c of s)if(c.result.status==="dirty")return t.common.issues.push(...c.ctx.common.issues),c.result;let o=s.map(c=>new p.ZodError(c.ctx.common.issues));return (0, l.addIssueToContext)(t,{code:p.ZodIssueCode.invalid_union,unionErrors:o}),l.INVALID}if(t.common.async)return Promise.all(n.map(async s=>{let o={...t,common:{...t.common,issues:[]},parent:null};return {result:await s._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(r);{let s,o=[];for(let d of n){let u={...t,common:{...t.common,issues:[]},parent:null},f=d._parseSync({data:t.data,path:t.path,parent:u});if(f.status==="valid")return f;f.status==="dirty"&&!s&&(s={result:f,ctx:u}),u.common.issues.length&&o.push(u.common.issues);}if(s)return t.common.issues.push(...s.ctx.common.issues),s.result;let c=o.map(d=>new p.ZodError(d));return (0, l.addIssueToContext)(t,{code:p.ZodIssueCode.invalid_union,unionErrors:c}),l.INVALID}}get options(){return this._def.options}};a.ZodUnion=ve;ve.create=(i,e)=>new ve({options:i,typeName:y.ZodUnion,..._(e)});var J=i=>i instanceof xe?J(i.schema):i instanceof j?J(i.innerType()):i instanceof we?[i.value]:i instanceof Te?i.options:i instanceof ke?h.util.objectValues(i.enum):i instanceof Ie?J(i._def.innerType):i instanceof ge?[void 0]:i instanceof _e?[null]:i instanceof Z?[void 0,...J(i.unwrap())]:i instanceof Y?[null,...J(i.unwrap())]:i instanceof et||i instanceof Se?J(i.unwrap()):i instanceof Pe?J(i._def.innerType):[],Mt=class i extends v{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.ZodParsedType.object)return (0, l.addIssueToContext)(t,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:t.parsedType}),l.INVALID;let n=this.discriminator,r=t.data[n],s=this.optionsMap.get(r);return s?t.common.async?s._parseAsync({data:t.data,path:t.path,parent:t}):s._parseSync({data:t.data,path:t.path,parent:t}):((0, l.addIssueToContext)(t,{code:p.ZodIssueCode.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),l.INVALID)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let r=new Map;for(let s of t){let o=J(s.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let c of o){if(r.has(c))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(c)}`);r.set(c,s);}}return new i({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r,..._(n)})}};a.ZodDiscriminatedUnion=Mt;function Ei(i,e){let t=(0, h.getParsedType)(i),n=(0, h.getParsedType)(e);if(i===e)return {valid:!0,data:i};if(t===h.ZodParsedType.object&&n===h.ZodParsedType.object){let r=h.util.objectKeys(e),s=h.util.objectKeys(i).filter(c=>r.indexOf(c)!==-1),o={...i,...e};for(let c of s){let d=Ei(i[c],e[c]);if(!d.valid)return {valid:!1};o[c]=d.data;}return {valid:!0,data:o}}else if(t===h.ZodParsedType.array&&n===h.ZodParsedType.array){if(i.length!==e.length)return {valid:!1};let r=[];for(let s=0;s<i.length;s++){let o=i[s],c=e[s],d=Ei(o,c);if(!d.valid)return {valid:!1};r.push(d.data);}return {valid:!0,data:r}}else return t===h.ZodParsedType.date&&n===h.ZodParsedType.date&&+i==+e?{valid:!0,data:i}:{valid:!1}}var be=class extends v{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=(s,o)=>{if((0, l.isAborted)(s)||(0, l.isAborted)(o))return l.INVALID;let c=Ei(s.value,o.value);return c.valid?(((0, l.isDirty)(s)||(0, l.isDirty)(o))&&t.dirty(),{status:t.value,value:c.data}):((0, l.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_intersection_types}),l.INVALID)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([s,o])=>r(s,o)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};a.ZodIntersection=be;be.create=(i,e,t)=>new be({left:i,right:e,typeName:y.ZodIntersection,..._(t)});var z=class i extends v{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.ZodParsedType.array)return (0, l.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.array,received:n.parsedType}),l.INVALID;if(n.data.length<this._def.items.length)return (0, l.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),l.INVALID;!this._def.rest&&n.data.length>this._def.items.length&&((0, l.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let s=[...n.data].map((o,c)=>{let d=this._def.items[c]||this._def.rest;return d?d._parse(new $(n,o,n.path,c)):null}).filter(o=>!!o);return n.common.async?Promise.all(s).then(o=>l.ParseStatus.mergeArray(t,o)):l.ParseStatus.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new i({...this._def,rest:e})}};a.ZodTuple=z;z.create=(i,e)=>{if(!Array.isArray(i))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new z({items:i,typeName:y.ZodTuple,rest:null,..._(e)})};var Zt=class i extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.ZodParsedType.object)return (0, l.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.object,received:n.parsedType}),l.INVALID;let r=[],s=this._def.keyType,o=this._def.valueType;for(let c in n.data)r.push({key:s._parse(new $(n,c,n.path,c)),value:o._parse(new $(n,n.data[c],n.path,c)),alwaysSet:c in n.data});return n.common.async?l.ParseStatus.mergeObjectAsync(t,r):l.ParseStatus.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof v?new i({keyType:e,valueType:t,typeName:y.ZodRecord,..._(n)}):new i({keyType:oe.create(),valueType:e,typeName:y.ZodRecord,..._(t)})}};a.ZodRecord=Zt;var qe=class extends v{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.ZodParsedType.map)return (0, l.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.map,received:n.parsedType}),l.INVALID;let r=this._def.keyType,s=this._def.valueType,o=[...n.data.entries()].map(([c,d],u)=>({key:r._parse(new $(n,c,n.path,[u,"key"])),value:s._parse(new $(n,d,n.path,[u,"value"]))}));if(n.common.async){let c=new Map;return Promise.resolve().then(async()=>{for(let d of o){let u=await d.key,f=await d.value;if(u.status==="aborted"||f.status==="aborted")return l.INVALID;(u.status==="dirty"||f.status==="dirty")&&t.dirty(),c.set(u.value,f.value);}return {status:t.value,value:c}})}else {let c=new Map;for(let d of o){let u=d.key,f=d.value;if(u.status==="aborted"||f.status==="aborted")return l.INVALID;(u.status==="dirty"||f.status==="dirty")&&t.dirty(),c.set(u.value,f.value);}return {status:t.value,value:c}}}};a.ZodMap=qe;qe.create=(i,e,t)=>new qe({valueType:e,keyType:i,typeName:y.ZodMap,..._(t)});var Le=class i extends v{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==h.ZodParsedType.set)return (0, l.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.set,received:n.parsedType}),l.INVALID;let r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&((0, l.addIssueToContext)(n,{code:p.ZodIssueCode.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&((0, l.addIssueToContext)(n,{code:p.ZodIssueCode.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());let s=this._def.valueType;function o(d){let u=new Set;for(let f of d){if(f.status==="aborted")return l.INVALID;f.status==="dirty"&&t.dirty(),u.add(f.value);}return {status:t.value,value:u}}let c=[...n.data.values()].map((d,u)=>s._parse(new $(n,d,n.path,u)));return n.common.async?Promise.all(c).then(d=>o(d)):o(c)}min(e,t){return new i({...this._def,minSize:{value:e,message:m.errorUtil.toString(t)}})}max(e,t){return new i({...this._def,maxSize:{value:e,message:m.errorUtil.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};a.ZodSet=Le;Le.create=(i,e)=>new Le({valueType:i,minSize:null,maxSize:null,typeName:y.ZodSet,..._(e)});var $t=class i extends v{constructor(){super(...arguments),this.validate=this.implement;}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.ZodParsedType.function)return (0, l.addIssueToContext)(t,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.function,received:t.parsedType}),l.INVALID;function n(c,d){return (0, l.makeIssue)({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0, jt.getErrorMap)(),jt.defaultErrorMap].filter(u=>!!u),issueData:{code:p.ZodIssueCode.invalid_arguments,argumentsError:d}})}function r(c,d){return (0, l.makeIssue)({data:c,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,(0, jt.getErrorMap)(),jt.defaultErrorMap].filter(u=>!!u),issueData:{code:p.ZodIssueCode.invalid_return_type,returnTypeError:d}})}let s={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof ce){let c=this;return (0, l.OK)(async function(...d){let u=new p.ZodError([]),f=await c._def.args.parseAsync(d,s).catch(te=>{throw u.addIssue(n(d,te)),u}),P=await Reflect.apply(o,this,f);return await c._def.returns._def.type.parseAsync(P,s).catch(te=>{throw u.addIssue(r(P,te)),u})})}else {let c=this;return (0, l.OK)(function(...d){let u=c._def.args.safeParse(d,s);if(!u.success)throw new p.ZodError([n(d,u.error)]);let f=Reflect.apply(o,this,u.data),P=c._def.returns.safeParse(f,s);if(!P.success)throw new p.ZodError([r(f,P.error)]);return P.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new i({...this._def,args:z.create(e).rest(Q.create())})}returns(e){return new i({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new i({args:e||z.create([]).rest(Q.create()),returns:t||Q.create(),typeName:y.ZodFunction,..._(n)})}};a.ZodFunction=$t;var xe=class extends v{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};a.ZodLazy=xe;xe.create=(i,e)=>new xe({getter:i,typeName:y.ZodLazy,..._(e)});var we=class extends v{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(t,{received:t.data,code:p.ZodIssueCode.invalid_literal,expected:this._def.value}),l.INVALID}return {status:"valid",value:e.data}}get value(){return this._def.value}};a.ZodLiteral=we;we.create=(i,e)=>new we({value:i,typeName:y.ZodLiteral,..._(e)});function An(i,e){return new Te({values:i,typeName:y.ZodEnum,..._(e)})}var Te=class i extends v{constructor(){super(...arguments),Qe.set(this,void 0);}_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return (0, l.addIssueToContext)(t,{expected:h.util.joinValues(n),received:t.parsedType,code:p.ZodIssueCode.invalid_type}),l.INVALID}if(Nt(this,Qe,"f")||Sn(this,Qe,new Set(this._def.values),"f"),!Nt(this,Qe,"f").has(e.data)){let t=this._getOrReturnCtx(e),n=this._def.values;return (0, l.addIssueToContext)(t,{received:t.data,code:p.ZodIssueCode.invalid_enum_value,options:n}),l.INVALID}return (0, l.OK)(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return i.create(e,{...this._def,...t})}exclude(e,t=this._def){return i.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}};a.ZodEnum=Te;Qe=new WeakMap;Te.create=An;var ke=class extends v{constructor(){super(...arguments),He.set(this,void 0);}_parse(e){let t=h.util.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==h.ZodParsedType.string&&n.parsedType!==h.ZodParsedType.number){let r=h.util.objectValues(t);return (0, l.addIssueToContext)(n,{expected:h.util.joinValues(r),received:n.parsedType,code:p.ZodIssueCode.invalid_type}),l.INVALID}if(Nt(this,He,"f")||Sn(this,He,new Set(h.util.getValidEnumValues(this._def.values)),"f"),!Nt(this,He,"f").has(e.data)){let r=h.util.objectValues(t);return (0, l.addIssueToContext)(n,{received:n.data,code:p.ZodIssueCode.invalid_enum_value,options:r}),l.INVALID}return (0, l.OK)(e.data)}get enum(){return this._def.values}};a.ZodNativeEnum=ke;He=new WeakMap;ke.create=(i,e)=>new ke({values:i,typeName:y.ZodNativeEnum,..._(e)});var ce=class extends v{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.ZodParsedType.promise&&t.common.async===!1)return (0, l.addIssueToContext)(t,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.promise,received:t.parsedType}),l.INVALID;let n=t.parsedType===h.ZodParsedType.promise?t.data:Promise.resolve(t.data);return (0, l.OK)(n.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}};a.ZodPromise=ce;ce.create=(i,e)=>new ce({type:i,typeName:y.ZodPromise,..._(e)});var j=class extends v{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,s={addIssue:o=>{(0, l.addIssueToContext)(n,o),o.fatal?t.abort():t.dirty();},get path(){return n.path}};if(s.addIssue=s.addIssue.bind(s),r.type==="preprocess"){let o=r.transform(n.data,s);if(n.common.async)return Promise.resolve(o).then(async c=>{if(t.value==="aborted")return l.INVALID;let d=await this._def.schema._parseAsync({data:c,path:n.path,parent:n});return d.status==="aborted"?l.INVALID:d.status==="dirty"||t.value==="dirty"?(0, l.DIRTY)(d.value):d});{if(t.value==="aborted")return l.INVALID;let c=this._def.schema._parseSync({data:o,path:n.path,parent:n});return c.status==="aborted"?l.INVALID:c.status==="dirty"||t.value==="dirty"?(0, l.DIRTY)(c.value):c}}if(r.type==="refinement"){let o=c=>{let d=r.refinement(c,s);if(n.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(n.common.async===!1){let c=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return c.status==="aborted"?l.INVALID:(c.status==="dirty"&&t.dirty(),o(c.value),{status:t.value,value:c.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(c=>c.status==="aborted"?l.INVALID:(c.status==="dirty"&&t.dirty(),o(c.value).then(()=>({status:t.value,value:c.value}))))}if(r.type==="transform")if(n.common.async===!1){let o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!(0, l.isValid)(o))return o;let c=r.transform(o.value,s);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return {status:t.value,value:c}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>(0, l.isValid)(o)?Promise.resolve(r.transform(o.value,s)).then(c=>({status:t.value,value:c})):o);h.util.assertNever(r);}};a.ZodEffects=j;a.ZodTransformer=j;j.create=(i,e,t)=>new j({schema:i,typeName:y.ZodEffects,effect:e,..._(t)});j.createWithPreprocess=(i,e,t)=>new j({schema:e,effect:{type:"preprocess",transform:i},typeName:y.ZodEffects,..._(t)});var Z=class extends v{_parse(e){return this._getType(e)===h.ZodParsedType.undefined?(0, l.OK)(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};a.ZodOptional=Z;Z.create=(i,e)=>new Z({innerType:i,typeName:y.ZodOptional,..._(e)});var Y=class extends v{_parse(e){return this._getType(e)===h.ZodParsedType.null?(0, l.OK)(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};a.ZodNullable=Y;Y.create=(i,e)=>new Y({innerType:i,typeName:y.ZodNullable,..._(e)});var Ie=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===h.ZodParsedType.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};a.ZodDefault=Ie;Ie.create=(i,e)=>new Ie({innerType:i,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var Pe=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return (0, l.isAsync)(r)?r.then(s=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new p.ZodError(n.common.issues)},input:n.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new p.ZodError(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};a.ZodCatch=Pe;Pe.create=(i,e)=>new Pe({innerType:i,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});var Ve=class extends v{_parse(e){if(this._getType(e)!==h.ZodParsedType.nan){let n=this._getOrReturnCtx(e);return (0, l.addIssueToContext)(n,{code:p.ZodIssueCode.invalid_type,expected:h.ZodParsedType.nan,received:n.parsedType}),l.INVALID}return {status:"valid",value:e.data}}};a.ZodNaN=Ve;Ve.create=i=>new Ve({typeName:y.ZodNaN,..._(i)});a.BRAND=Symbol("zod_brand");var et=class extends v{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}};a.ZodBranded=et;var tt=class i extends v{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return (async()=>{let s=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?l.INVALID:s.status==="dirty"?(t.dirty(),(0, l.DIRTY)(s.value)):this._def.out._parseAsync({data:s.value,path:n.path,parent:n})})();{let r=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?l.INVALID:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:n.path,parent:n})}}static create(e,t){return new i({in:e,out:t,typeName:y.ZodPipeline})}};a.ZodPipeline=tt;var Se=class extends v{_parse(e){let t=this._def.innerType._parse(e),n=r=>((0, l.isValid)(r)&&(r.value=Object.freeze(r.value)),r);return (0, l.isAsync)(t)?t.then(r=>n(r)):n(t)}unwrap(){return this._def.innerType}};a.ZodReadonly=Se;Se.create=(i,e)=>new Se({innerType:i,typeName:y.ZodReadonly,..._(e)});function Dn(i,e={},t){return i?ae.create().superRefine((n,r)=>{var s,o;if(!i(n)){let c=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,d=(o=(s=c.fatal)!==null&&s!==void 0?s:t)!==null&&o!==void 0?o:!0,u=typeof c=="string"?{message:c}:c;r.addIssue({code:"custom",...u,fatal:d});}}):ae.create()}a.custom=Dn;a.late={object:A.lazycreate};var y;(function(i){i.ZodString="ZodString",i.ZodNumber="ZodNumber",i.ZodNaN="ZodNaN",i.ZodBigInt="ZodBigInt",i.ZodBoolean="ZodBoolean",i.ZodDate="ZodDate",i.ZodSymbol="ZodSymbol",i.ZodUndefined="ZodUndefined",i.ZodNull="ZodNull",i.ZodAny="ZodAny",i.ZodUnknown="ZodUnknown",i.ZodNever="ZodNever",i.ZodVoid="ZodVoid",i.ZodArray="ZodArray",i.ZodObject="ZodObject",i.ZodUnion="ZodUnion",i.ZodDiscriminatedUnion="ZodDiscriminatedUnion",i.ZodIntersection="ZodIntersection",i.ZodTuple="ZodTuple",i.ZodRecord="ZodRecord",i.ZodMap="ZodMap",i.ZodSet="ZodSet",i.ZodFunction="ZodFunction",i.ZodLazy="ZodLazy",i.ZodLiteral="ZodLiteral",i.ZodEnum="ZodEnum",i.ZodEffects="ZodEffects",i.ZodNativeEnum="ZodNativeEnum",i.ZodOptional="ZodOptional",i.ZodNullable="ZodNullable",i.ZodDefault="ZodDefault",i.ZodCatch="ZodCatch",i.ZodPromise="ZodPromise",i.ZodBranded="ZodBranded",i.ZodPipeline="ZodPipeline",i.ZodReadonly="ZodReadonly";})(y=a.ZodFirstPartyTypeKind||(a.ZodFirstPartyTypeKind={}));var rs=(i,e={message:`Input not instance of ${i.name}`})=>Dn(t=>t instanceof i,e);a.instanceof=rs;var Cn=oe.create;a.string=Cn;var jn=he.create;a.number=jn;var ss=Ve.create;a.nan=ss;var os=fe.create;a.bigint=os;var Nn=me.create;a.boolean=Nn;var as=ye.create;a.date=as;var cs=$e.create;a.symbol=cs;var ls=ge.create;a.undefined=ls;var ds=_e.create;a.null=ds;var us=ae.create;a.any=us;var ps=Q.create;a.unknown=ps;var hs=L.create;a.never=hs;var fs=Ue.create;a.void=fs;var ms=H.create;a.array=ms;var ys=A.create;a.object=ys;var gs=A.strictCreate;a.strictObject=gs;var _s=ve.create;a.union=_s;var vs=Mt.create;a.discriminatedUnion=vs;var bs=be.create;a.intersection=bs;var xs=z.create;a.tuple=xs;var ws=Zt.create;a.record=ws;var Ts=qe.create;a.map=Ts;var ks=Le.create;a.set=ks;var Is=$t.create;a.function=Is;var Ps=xe.create;a.lazy=Ps;var Ss=we.create;a.literal=Ss;var Os=Te.create;a.enum=Os;var Es=ke.create;a.nativeEnum=Es;var Rs=ce.create;a.promise=Rs;var Mn=j.create;a.effect=Mn;a.transformer=Mn;var As=Z.create;a.optional=As;var Ds=Y.create;a.nullable=Ds;var Cs=j.createWithPreprocess;a.preprocess=Cs;var js=tt.create;a.pipeline=js;var Ns=()=>Cn().optional();a.ostring=Ns;var Ms=()=>jn().optional();a.onumber=Ms;var Zs=()=>Nn().optional();a.oboolean=Zs;a.coerce={string:i=>oe.create({...i,coerce:!0}),number:i=>he.create({...i,coerce:!0}),boolean:i=>me.create({...i,coerce:!0}),bigint:i=>fe.create({...i,coerce:!0}),date:i=>ye.create({...i,coerce:!0})};a.NEVER=l.INVALID;});var Ri=g(U=>{var $s=U&&U.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t),Object.defineProperty(i,n,{enumerable:!0,get:function(){return e[t]}});}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t];}),Fe=U&&U.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&$s(e,i,t);};Object.defineProperty(U,"__esModule",{value:!0});Fe(Ct(),U);Fe(Si(),U);Fe(kn(),U);Fe(Ge(),U);Fe(Zn(),U);Fe(Dt(),U);});var Ut=g(D=>{var $n=D&&D.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t),Object.defineProperty(i,n,{enumerable:!0,get:function(){return e[t]}});}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t];}),Us=D&&D.__setModuleDefault||(Object.create?function(i,e){Object.defineProperty(i,"default",{enumerable:!0,value:e});}:function(i,e){i.default=e;}),qs=D&&D.__importStar||function(i){if(i&&i.__esModule)return i;var e={};if(i!=null)for(var t in i)t!=="default"&&Object.prototype.hasOwnProperty.call(i,t)&&$n(e,i,t);return Us(e,i),e},Ls=D&&D.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&$n(e,i,t);};Object.defineProperty(D,"__esModule",{value:!0});D.z=void 0;var Un=qs(Ri());D.z=Un;Ls(Ri(),D);D.default=Un;});var Ai=g(qt=>{Object.defineProperty(qt,"__esModule",{value:!0});qt.parseAnyDef=void 0;function Vs(){return {}}qt.parseAnyDef=Vs;});var Di=g(Vt=>{Object.defineProperty(Vt,"__esModule",{value:!0});Vt.parseArrayDef=void 0;var Fs=Ut(),Lt=re(),Ws=E();function Bs(i,e){let t={type:"array"};return i.type?._def?.typeName!==Fs.ZodFirstPartyTypeKind.ZodAny&&(t.items=(0, Ws.parseDef)(i.type._def,{...e,currentPath:[...e.currentPath,"items"]})),i.minLength&&(0, Lt.setResponseValueAndErrors)(t,"minItems",i.minLength.value,i.minLength.message,e),i.maxLength&&(0, Lt.setResponseValueAndErrors)(t,"maxItems",i.maxLength.value,i.maxLength.message,e),i.exactLength&&((0, Lt.setResponseValueAndErrors)(t,"minItems",i.exactLength.value,i.exactLength.message,e),(0, Lt.setResponseValueAndErrors)(t,"maxItems",i.exactLength.value,i.exactLength.message,e)),t}Vt.parseArrayDef=Bs;});var Ci=g(Ft=>{Object.defineProperty(Ft,"__esModule",{value:!0});Ft.parseBigintDef=void 0;var Oe=re();function Ks(i,e){let t={type:"integer",format:"int64"};if(!i.checks)return t;for(let n of i.checks)switch(n.kind){case"min":e.target==="jsonSchema7"?n.inclusive?(0, Oe.setResponseValueAndErrors)(t,"minimum",n.value,n.message,e):(0, Oe.setResponseValueAndErrors)(t,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(t.exclusiveMinimum=!0),(0, Oe.setResponseValueAndErrors)(t,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0, Oe.setResponseValueAndErrors)(t,"maximum",n.value,n.message,e):(0, Oe.setResponseValueAndErrors)(t,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(t.exclusiveMaximum=!0),(0, Oe.setResponseValueAndErrors)(t,"maximum",n.value,n.message,e));break;case"multipleOf":(0, Oe.setResponseValueAndErrors)(t,"multipleOf",n.value,n.message,e);break}return t}Ft.parseBigintDef=Ks;});var ji=g(Wt=>{Object.defineProperty(Wt,"__esModule",{value:!0});Wt.parseBooleanDef=void 0;function zs(){return {type:"boolean"}}Wt.parseBooleanDef=zs;});var Ni=g(Bt=>{Object.defineProperty(Bt,"__esModule",{value:!0});Bt.parseBrandedDef=void 0;var Ys=E();function Gs(i,e){return (0, Ys.parseDef)(i.type._def,e)}Bt.parseBrandedDef=Gs;});var Mi=g(Kt=>{Object.defineProperty(Kt,"__esModule",{value:!0});Kt.parseCatchDef=void 0;var Xs=E(),Js=(i,e)=>(0, Xs.parseDef)(i.innerType._def,e);Kt.parseCatchDef=Js;});var Zi=g(zt=>{Object.defineProperty(zt,"__esModule",{value:!0});zt.parseDateDef=void 0;var qn=re();function Ln(i,e,t){let n=t??e.dateStrategy;if(Array.isArray(n))return {anyOf:n.map((r,s)=>Ln(i,e,r))};switch(n){case"string":case"format:date-time":return {type:"string",format:"date-time"};case"format:date":return {type:"string",format:"date"};case"integer":return Qs(i,e)}}zt.parseDateDef=Ln;var Qs=(i,e)=>{let t={type:"integer",format:"unix-time"};if(e.target==="openApi3")return t;for(let n of i.checks)switch(n.kind){case"min":(0, qn.setResponseValueAndErrors)(t,"minimum",n.value,n.message,e);break;case"max":(0, qn.setResponseValueAndErrors)(t,"maximum",n.value,n.message,e);break}return t};});var $i=g(Yt=>{Object.defineProperty(Yt,"__esModule",{value:!0});Yt.parseDefaultDef=void 0;var Hs=E();function eo(i,e){return {...(0, Hs.parseDef)(i.innerType._def,e),default:i.defaultValue()}}Yt.parseDefaultDef=eo;});var Ui=g(Gt=>{Object.defineProperty(Gt,"__esModule",{value:!0});Gt.parseEffectsDef=void 0;var to=E();function io(i,e){return e.effectStrategy==="input"?(0, to.parseDef)(i.schema._def,e):{}}Gt.parseEffectsDef=io;});var qi=g(Xt=>{Object.defineProperty(Xt,"__esModule",{value:!0});Xt.parseEnumDef=void 0;function no(i){return {type:"string",enum:i.values}}Xt.parseEnumDef=no;});var Li=g(Jt=>{Object.defineProperty(Jt,"__esModule",{value:!0});Jt.parseIntersectionDef=void 0;var Vn=E(),ro=i=>"type"in i&&i.type==="string"?!1:"allOf"in i;function so(i,e){let t=[(0, Vn.parseDef)(i.left._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),(0, Vn.parseDef)(i.right._def,{...e,currentPath:[...e.currentPath,"allOf","1"]})].filter(s=>!!s),n=e.target==="jsonSchema2019-09"?{unevaluatedProperties:!1}:void 0,r=[];return t.forEach(s=>{if(ro(s))r.push(...s.allOf),s.unevaluatedProperties===void 0&&(n=void 0);else {let o=s;if("additionalProperties"in s&&s.additionalProperties===!1){let{additionalProperties:c,...d}=s;o=d;}else n=void 0;r.push(o);}}),r.length?{allOf:r,...n}:void 0}Jt.parseIntersectionDef=so;});var Vi=g(Qt=>{Object.defineProperty(Qt,"__esModule",{value:!0});Qt.parseLiteralDef=void 0;function oo(i,e){let t=typeof i.value;return t!=="bigint"&&t!=="number"&&t!=="boolean"&&t!=="string"?{type:Array.isArray(i.value)?"array":"object"}:e.target==="openApi3"?{type:t==="bigint"?"integer":t,enum:[i.value]}:{type:t==="bigint"?"integer":t,const:i.value}}Qt.parseLiteralDef=oo;});var Ht=g(N=>{Object.defineProperty(N,"__esModule",{value:!0});N.parseStringDef=N.zodPatterns=void 0;var Ee=re();N.zodPatterns={cuid:"^[cC][^\\s-]{8,}$",cuid2:"^[a-z][a-z0-9]*$",ulid:"^[0-9A-HJKMNP-TV-Z]{26}$",email:"^(?!\\.)(?!.*\\.\\.)([a-zA-Z0-9_+-\\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\\-]*\\.)+[a-zA-Z]{2,}$",emoji:"^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",uuid:"^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$",ipv4:"^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$",ipv6:"^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$",base64:"^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$",nanoid:"^[a-zA-Z0-9_-]{21}$"};function ao(i,e){let t={type:"string"};function n(r){return e.patternStrategy==="escape"?co(r):r}if(i.checks)for(let r of i.checks)switch(r.kind){case"min":(0, Ee.setResponseValueAndErrors)(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,r.value):r.value,r.message,e);break;case"max":(0, Ee.setResponseValueAndErrors)(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,r.value):r.value,r.message,e);break;case"email":switch(e.emailStrategy){case"format:email":V(t,"email",r.message,e);break;case"format:idn-email":V(t,"idn-email",r.message,e);break;case"pattern:zod":F(t,N.zodPatterns.email,r.message,e);break}break;case"url":V(t,"uri",r.message,e);break;case"uuid":V(t,"uuid",r.message,e);break;case"regex":F(t,r.regex.source,r.message,e);break;case"cuid":F(t,N.zodPatterns.cuid,r.message,e);break;case"cuid2":F(t,N.zodPatterns.cuid2,r.message,e);break;case"startsWith":F(t,"^"+n(r.value),r.message,e);break;case"endsWith":F(t,n(r.value)+"$",r.message,e);break;case"datetime":V(t,"date-time",r.message,e);break;case"date":V(t,"date",r.message,e);break;case"time":V(t,"time",r.message,e);break;case"duration":V(t,"duration",r.message,e);break;case"length":(0, Ee.setResponseValueAndErrors)(t,"minLength",typeof t.minLength=="number"?Math.max(t.minLength,r.value):r.value,r.message,e),(0, Ee.setResponseValueAndErrors)(t,"maxLength",typeof t.maxLength=="number"?Math.min(t.maxLength,r.value):r.value,r.message,e);break;case"includes":{F(t,n(r.value),r.message,e);break}case"ip":{r.version!=="v6"&&V(t,"ipv4",r.message,e),r.version!=="v4"&&V(t,"ipv6",r.message,e);break}case"emoji":F(t,N.zodPatterns.emoji,r.message,e);break;case"ulid":{F(t,N.zodPatterns.ulid,r.message,e);break}case"base64":{switch(e.base64Strategy){case"format:binary":{V(t,"binary",r.message,e);break}case"contentEncoding:base64":{(0, Ee.setResponseValueAndErrors)(t,"contentEncoding","base64",r.message,e);break}case"pattern:zod":{F(t,N.zodPatterns.base64,r.message,e);break}}break}case"nanoid":F(t,N.zodPatterns.nanoid,r.message,e);}return t}N.parseStringDef=ao;var co=i=>Array.from(i).map(e=>/[a-zA-Z0-9]/.test(e)?e:`\\${e}`).join(""),V=(i,e,t,n)=>{i.format||i.anyOf?.some(r=>r.format)?(i.anyOf||(i.anyOf=[]),i.format&&(i.anyOf.push({format:i.format,...i.errorMessage&&n.errorMessages&&{errorMessage:{format:i.errorMessage.format}}}),delete i.format,i.errorMessage&&(delete i.errorMessage.format,Object.keys(i.errorMessage).length===0&&delete i.errorMessage)),i.anyOf.push({format:e,...t&&n.errorMessages&&{errorMessage:{format:t}}})):(0, Ee.setResponseValueAndErrors)(i,"format",e,t,n);},F=(i,e,t,n)=>{i.pattern||i.allOf?.some(r=>r.pattern)?(i.allOf||(i.allOf=[]),i.pattern&&(i.allOf.push({pattern:i.pattern,...i.errorMessage&&n.errorMessages&&{errorMessage:{pattern:i.errorMessage.pattern}}}),delete i.pattern,i.errorMessage&&(delete i.errorMessage.pattern,Object.keys(i.errorMessage).length===0&&delete i.errorMessage)),i.allOf.push({pattern:e,...t&&n.errorMessages&&{errorMessage:{pattern:t}}})):(0, Ee.setResponseValueAndErrors)(i,"pattern",e,t,n);};});var ti=g(ei=>{Object.defineProperty(ei,"__esModule",{value:!0});ei.parseRecordDef=void 0;var Fi=Ut(),Fn=E(),lo=Ht();function uo(i,e){if(e.target==="openApi3"&&i.keyType?._def.typeName===Fi.ZodFirstPartyTypeKind.ZodEnum)return {type:"object",required:i.keyType._def.values,properties:i.keyType._def.values.reduce((n,r)=>({...n,[r]:(0, Fn.parseDef)(i.valueType._def,{...e,currentPath:[...e.currentPath,"properties",r]})??{}}),{}),additionalProperties:!1};let t={type:"object",additionalProperties:(0, Fn.parseDef)(i.valueType._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??{}};if(e.target==="openApi3")return t;if(i.keyType?._def.typeName===Fi.ZodFirstPartyTypeKind.ZodString&&i.keyType._def.checks?.length){let n=Object.entries((0, lo.parseStringDef)(i.keyType._def,e)).reduce((r,[s,o])=>s==="type"?r:{...r,[s]:o},{});return {...t,propertyNames:n}}else if(i.keyType?._def.typeName===Fi.ZodFirstPartyTypeKind.ZodEnum)return {...t,propertyNames:{enum:i.keyType._def.values}};return t}ei.parseRecordDef=uo;});var Wi=g(ii=>{Object.defineProperty(ii,"__esModule",{value:!0});ii.parseMapDef=void 0;var Wn=E(),po=ti();function ho(i,e){if(e.mapStrategy==="record")return (0, po.parseRecordDef)(i,e);let t=(0, Wn.parseDef)(i.keyType._def,{...e,currentPath:[...e.currentPath,"items","items","0"]})||{},n=(0, Wn.parseDef)(i.valueType._def,{...e,currentPath:[...e.currentPath,"items","items","1"]})||{};return {type:"array",maxItems:125,items:{type:"array",items:[t,n],minItems:2,maxItems:2}}}ii.parseMapDef=ho;});var Bi=g(ni=>{Object.defineProperty(ni,"__esModule",{value:!0});ni.parseNativeEnumDef=void 0;function fo(i){let e=i.values,n=Object.keys(i.values).filter(s=>typeof e[e[s]]!="number").map(s=>e[s]),r=Array.from(new Set(n.map(s=>typeof s)));return {type:r.length===1?r[0]==="string"?"string":"number":["string","number"],enum:n}}ni.parseNativeEnumDef=fo;});var Ki=g(ri=>{Object.defineProperty(ri,"__esModule",{value:!0});ri.parseNeverDef=void 0;function mo(){return {not:{}}}ri.parseNeverDef=mo;});var zi=g(si=>{Object.defineProperty(si,"__esModule",{value:!0});si.parseNullDef=void 0;function yo(i){return i.target==="openApi3"?{enum:["null"],nullable:!0}:{type:"null"}}si.parseNullDef=yo;});var oi=g(le=>{Object.defineProperty(le,"__esModule",{value:!0});le.parseUnionDef=le.primitiveMappings=void 0;var go=E();le.primitiveMappings={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function _o(i,e){if(e.target==="openApi3")return Bn(i,e);let t=i.options instanceof Map?Array.from(i.options.values()):i.options;if(t.every(n=>n._def.typeName in le.primitiveMappings&&(!n._def.checks||!n._def.checks.length))){let n=t.reduce((r,s)=>{let o=le.primitiveMappings[s._def.typeName];return o&&!r.includes(o)?[...r,o]:r},[]);return {type:n.length>1?n:n[0]}}else if(t.every(n=>n._def.typeName==="ZodLiteral"&&!n.description)){let n=t.reduce((r,s)=>{let o=typeof s._def.value;switch(o){case"string":case"number":case"boolean":return [...r,o];case"bigint":return [...r,"integer"];case"object":if(s._def.value===null)return [...r,"null"];case"symbol":case"undefined":case"function":default:return r}},[]);if(n.length===t.length){let r=n.filter((s,o,c)=>c.indexOf(s)===o);return {type:r.length>1?r:r[0],enum:t.reduce((s,o)=>s.includes(o._def.value)?s:[...s,o._def.value],[])}}}else if(t.every(n=>n._def.typeName==="ZodEnum"))return {type:"string",enum:t.reduce((n,r)=>[...n,...r._def.values.filter(s=>!n.includes(s))],[])};return Bn(i,e)}le.parseUnionDef=_o;var Bn=(i,e)=>{let t=(i.options instanceof Map?Array.from(i.options.values()):i.options).map((n,r)=>(0, go.parseDef)(n._def,{...e,currentPath:[...e.currentPath,"anyOf",`${r}`]})).filter(n=>!!n&&(!e.strictUnions||typeof n=="object"&&Object.keys(n).length>0));return t.length?{anyOf:t}:void 0};});var Yi=g(ai=>{Object.defineProperty(ai,"__esModule",{value:!0});ai.parseNullableDef=void 0;var Kn=E(),zn=oi();function vo(i,e){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(i.innerType._def.typeName)&&(!i.innerType._def.checks||!i.innerType._def.checks.length))return e.target==="openApi3"?{type:zn.primitiveMappings[i.innerType._def.typeName],nullable:!0}:{type:[zn.primitiveMappings[i.innerType._def.typeName],"null"]};if(e.target==="openApi3"){let n=(0, Kn.parseDef)(i.innerType._def,{...e,currentPath:[...e.currentPath]});return n&&"$ref"in n?{allOf:[n],nullable:!0}:n&&{...n,nullable:!0}}let t=(0, Kn.parseDef)(i.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","0"]});return t&&{anyOf:[t,{type:"null"}]}}ai.parseNullableDef=vo;});var Gi=g(ci=>{Object.defineProperty(ci,"__esModule",{value:!0});ci.parseNumberDef=void 0;var de=re();function bo(i,e){let t={type:"number"};if(!i.checks)return t;for(let n of i.checks)switch(n.kind){case"int":t.type="integer",(0, de.addErrorMessage)(t,"type",n.message,e);break;case"min":e.target==="jsonSchema7"?n.inclusive?(0, de.setResponseValueAndErrors)(t,"minimum",n.value,n.message,e):(0, de.setResponseValueAndErrors)(t,"exclusiveMinimum",n.value,n.message,e):(n.inclusive||(t.exclusiveMinimum=!0),(0, de.setResponseValueAndErrors)(t,"minimum",n.value,n.message,e));break;case"max":e.target==="jsonSchema7"?n.inclusive?(0, de.setResponseValueAndErrors)(t,"maximum",n.value,n.message,e):(0, de.setResponseValueAndErrors)(t,"exclusiveMaximum",n.value,n.message,e):(n.inclusive||(t.exclusiveMaximum=!0),(0, de.setResponseValueAndErrors)(t,"maximum",n.value,n.message,e));break;case"multipleOf":(0, de.setResponseValueAndErrors)(t,"multipleOf",n.value,n.message,e);break}return t}ci.parseNumberDef=bo;});var Ji=g(We=>{Object.defineProperty(We,"__esModule",{value:!0});We.parseObjectDef=We.parseObjectDefX=void 0;var it=E();function Xi(i,e){return e.removeAdditionalStrategy==="strict"?i.catchall._def.typeName==="ZodNever"?i.unknownKeys!=="strict":(0, it.parseDef)(i.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0:i.catchall._def.typeName==="ZodNever"?i.unknownKeys==="passthrough":(0, it.parseDef)(i.catchall._def,{...e,currentPath:[...e.currentPath,"additionalProperties"]})??!0}function xo(i,e){Object.keys(i.shape()).reduce((n,r)=>{let s=i.shape()[r],o=s.isOptional();o||(s={...s._def.innerSchema});let c=(0, it.parseDef)(s._def,{...e,currentPath:[...e.currentPath,"properties",r],propertyPath:[...e.currentPath,"properties",r]});return c!==void 0&&(n.properties[r]=c,o||(n.required||(n.required=[]),n.required.push(r))),n},{type:"object",properties:{},additionalProperties:Xi(i,e)});let t={type:"object",...Object.entries(i.shape()).reduce((n,[r,s])=>{if(s===void 0||s._def===void 0)return n;let o=(0, it.parseDef)(s._def,{...e,currentPath:[...e.currentPath,"properties",r],propertyPath:[...e.currentPath,"properties",r]});return o===void 0?n:{properties:{...n.properties,[r]:o},required:s.isOptional()?n.required:[...n.required,r]}},{properties:{},required:[]}),additionalProperties:Xi(i,e)};return t.required.length||delete t.required,t}We.parseObjectDefX=xo;function wo(i,e){let t={type:"object",...Object.entries(i.shape()).reduce((n,[r,s])=>{if(s===void 0||s._def===void 0)return n;let o=(0, it.parseDef)(s._def,{...e,currentPath:[...e.currentPath,"properties",r],propertyPath:[...e.currentPath,"properties",r]});return o===void 0?n:{properties:{...n.properties,[r]:o},required:s.isOptional()?n.required:[...n.required,r]}},{properties:{},required:[]}),additionalProperties:Xi(i,e)};return t.required.length||delete t.required,t}We.parseObjectDef=wo;});var Qi=g(li=>{Object.defineProperty(li,"__esModule",{value:!0});li.parseOptionalDef=void 0;var Yn=E(),To=(i,e)=>{if(e.currentPath.toString()===e.propertyPath?.toString())return (0, Yn.parseDef)(i.innerType._def,e);let t=(0, Yn.parseDef)(i.innerType._def,{...e,currentPath:[...e.currentPath,"anyOf","1"]});return t?{anyOf:[{not:{}},t]}:{}};li.parseOptionalDef=To;});var Hi=g(ui=>{Object.defineProperty(ui,"__esModule",{value:!0});ui.parsePipelineDef=void 0;var di=E(),ko=(i,e)=>{if(e.pipeStrategy==="input")return (0, di.parseDef)(i.in._def,e);if(e.pipeStrategy==="output")return (0, di.parseDef)(i.out._def,e);let t=(0, di.parseDef)(i.in._def,{...e,currentPath:[...e.currentPath,"allOf","0"]}),n=(0, di.parseDef)(i.out._def,{...e,currentPath:[...e.currentPath,"allOf",t?"1":"0"]});return {allOf:[t,n].filter(r=>r!==void 0)}};ui.parsePipelineDef=ko;});var en=g(pi=>{Object.defineProperty(pi,"__esModule",{value:!0});pi.parsePromiseDef=void 0;var Io=E();function Po(i,e){return (0, Io.parseDef)(i.type._def,e)}pi.parsePromiseDef=Po;});var tn=g(hi=>{Object.defineProperty(hi,"__esModule",{value:!0});hi.parseSetDef=void 0;var Gn=re(),So=E();function Oo(i,e){let n={type:"array",uniqueItems:!0,items:(0, So.parseDef)(i.valueType._def,{...e,currentPath:[...e.currentPath,"items"]})};return i.minSize&&(0, Gn.setResponseValueAndErrors)(n,"minItems",i.minSize.value,i.minSize.message,e),i.maxSize&&(0, Gn.setResponseValueAndErrors)(n,"maxItems",i.maxSize.value,i.maxSize.message,e),n}hi.parseSetDef=Oo;});var rn=g(fi=>{Object.defineProperty(fi,"__esModule",{value:!0});fi.parseTupleDef=void 0;var nn=E();function Eo(i,e){return i.rest?{type:"array",minItems:i.items.length,items:i.items.map((t,n)=>(0, nn.parseDef)(t._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((t,n)=>n===void 0?t:[...t,n],[]),additionalItems:(0, nn.parseDef)(i.rest._def,{...e,currentPath:[...e.currentPath,"additionalItems"]})}:{type:"array",minItems:i.items.length,maxItems:i.items.length,items:i.items.map((t,n)=>(0, nn.parseDef)(t._def,{...e,currentPath:[...e.currentPath,"items",`${n}`]})).reduce((t,n)=>n===void 0?t:[...t,n],[])}}fi.parseTupleDef=Eo;});var sn=g(mi=>{Object.defineProperty(mi,"__esModule",{value:!0});mi.parseUndefinedDef=void 0;function Ro(){return {not:{}}}mi.parseUndefinedDef=Ro;});var on=g(yi=>{Object.defineProperty(yi,"__esModule",{value:!0});yi.parseUnknownDef=void 0;function Ao(){return {}}yi.parseUnknownDef=Ao;});var an=g(gi=>{Object.defineProperty(gi,"__esModule",{value:!0});gi.parseReadonlyDef=void 0;var Do=E(),Co=(i,e)=>(0, Do.parseDef)(i.innerType._def,e);gi.parseReadonlyDef=Co;});var E=g(_i=>{Object.defineProperty(_i,"__esModule",{value:!0});_i.parseDef=void 0;var x=Ut(),jo=Ai(),No=Di(),Mo=Ci(),Zo=ji(),$o=Ni(),Uo=Mi(),qo=Zi(),Lo=$i(),Vo=Ui(),Fo=qi(),Wo=Li(),Bo=Vi(),Ko=Wi(),zo=Bi(),Yo=Ki(),Go=zi(),Xo=Yi(),Jo=Gi(),Qo=Ji(),Ho=Qi(),ea=Hi(),ta=en(),ia=ti(),na=tn(),ra=Ht(),sa=rn(),oa=sn(),aa=oi(),ca=on(),la=an(),da=Rt();function Xn(i,e,t=!1){let n=e.seen.get(i);if(e.override){let o=e.override?.(i,e,n,t);if(o!==da.ignoreOverride)return o}if(n&&!t){let o=ua(n,e);if(o!==void 0)return o}let r={def:i,path:e.currentPath,jsonSchema:void 0};e.seen.set(i,r);let s=ha(i,i.typeName,e);return s&&fa(i,e,s),r.jsonSchema=s,s}_i.parseDef=Xn;var ua=(i,e)=>{switch(e.$refStrategy){case"root":return {$ref:i.path.join("/")};case"relative":return {$ref:pa(e.currentPath,i.path)};case"none":case"seen":return i.path.length<e.currentPath.length&&i.path.every((t,n)=>e.currentPath[n]===t)?(console.warn(`Recursive reference detected at ${e.currentPath.join("/")}! Defaulting to any`),{}):e.$refStrategy==="seen"?{}:void 0}},pa=(i,e)=>{let t=0;for(;t<i.length&&t<e.length&&i[t]===e[t];t++);return [(i.length-t).toString(),...e.slice(t)].join("/")},ha=(i,e,t)=>{switch(e){case x.ZodFirstPartyTypeKind.ZodString:return (0, ra.parseStringDef)(i,t);case x.ZodFirstPartyTypeKind.ZodNumber:return (0, Jo.parseNumberDef)(i,t);case x.ZodFirstPartyTypeKind.ZodObject:return (0, Qo.parseObjectDef)(i,t);case x.ZodFirstPartyTypeKind.ZodBigInt:return (0, Mo.parseBigintDef)(i,t);case x.ZodFirstPartyTypeKind.ZodBoolean:return (0, Zo.parseBooleanDef)();case x.ZodFirstPartyTypeKind.ZodDate:return (0, qo.parseDateDef)(i,t);case x.ZodFirstPartyTypeKind.ZodUndefined:return (0, oa.parseUndefinedDef)();case x.ZodFirstPartyTypeKind.ZodNull:return (0, Go.parseNullDef)(t);case x.ZodFirstPartyTypeKind.ZodArray:return (0, No.parseArrayDef)(i,t);case x.ZodFirstPartyTypeKind.ZodUnion:case x.ZodFirstPartyTypeKind.ZodDiscriminatedUnion:return (0, aa.parseUnionDef)(i,t);case x.ZodFirstPartyTypeKind.ZodIntersection:return (0, Wo.parseIntersectionDef)(i,t);case x.ZodFirstPartyTypeKind.ZodTuple:return (0, sa.parseTupleDef)(i,t);case x.ZodFirstPartyTypeKind.ZodRecord:return (0, ia.parseRecordDef)(i,t);case x.ZodFirstPartyTypeKind.ZodLiteral:return (0, Bo.parseLiteralDef)(i,t);case x.ZodFirstPartyTypeKind.ZodEnum:return (0, Fo.parseEnumDef)(i);case x.ZodFirstPartyTypeKind.ZodNativeEnum:return (0, zo.parseNativeEnumDef)(i);case x.ZodFirstPartyTypeKind.ZodNullable:return (0, Xo.parseNullableDef)(i,t);case x.ZodFirstPartyTypeKind.ZodOptional:return (0, Ho.parseOptionalDef)(i,t);case x.ZodFirstPartyTypeKind.ZodMap:return (0, Ko.parseMapDef)(i,t);case x.ZodFirstPartyTypeKind.ZodSet:return (0, na.parseSetDef)(i,t);case x.ZodFirstPartyTypeKind.ZodLazy:return Xn(i.getter()._def,t);case x.ZodFirstPartyTypeKind.ZodPromise:return (0, ta.parsePromiseDef)(i,t);case x.ZodFirstPartyTypeKind.ZodNaN:case x.ZodFirstPartyTypeKind.ZodNever:return (0, Yo.parseNeverDef)();case x.ZodFirstPartyTypeKind.ZodEffects:return (0, Vo.parseEffectsDef)(i,t);case x.ZodFirstPartyTypeKind.ZodAny:return (0, jo.parseAnyDef)();case x.ZodFirstPartyTypeKind.ZodUnknown:return (0, ca.parseUnknownDef)();case x.ZodFirstPartyTypeKind.ZodDefault:return (0, Lo.parseDefaultDef)(i,t);case x.ZodFirstPartyTypeKind.ZodBranded:return (0, $o.parseBrandedDef)(i,t);case x.ZodFirstPartyTypeKind.ZodReadonly:return (0, la.parseReadonlyDef)(i,t);case x.ZodFirstPartyTypeKind.ZodCatch:return (0, Uo.parseCatchDef)(i,t);case x.ZodFirstPartyTypeKind.ZodPipeline:return (0, ea.parsePipelineDef)(i,t);case x.ZodFirstPartyTypeKind.ZodFunction:case x.ZodFirstPartyTypeKind.ZodVoid:case x.ZodFirstPartyTypeKind.ZodSymbol:return;default:return (n=>{})()}},fa=(i,e,t)=>(i.description&&(t.description=i.description,e.markdownDescription&&(t.markdownDescription=i.description)),t);});var cn=g(vi=>{Object.defineProperty(vi,"__esModule",{value:!0});vi.zodToJsonSchema=void 0;var Jn=E(),ma=Ti(),ya=(i,e)=>{let t=(0, ma.getRefs)(e),n=typeof e=="object"&&e.definitions?Object.entries(e.definitions).reduce((c,[d,u])=>({...c,[d]:(0, Jn.parseDef)(u._def,{...t,currentPath:[...t.basePath,t.definitionPath,d]},!0)??{}}),{}):void 0,r=typeof e=="string"?e:e?.name,s=(0, Jn.parseDef)(i._def,r===void 0?t:{...t,currentPath:[...t.basePath,t.definitionPath,r]},!1)??{},o=r===void 0?n?{...s,[t.definitionPath]:n}:s:{$ref:[...t.$refStrategy==="relative"?[]:t.basePath,t.definitionPath,r].join("/"),[t.definitionPath]:{...n,[r]:s}};return t.target==="jsonSchema7"?o.$schema="http://json-schema.org/draft-07/schema#":t.target==="jsonSchema2019-09"&&(o.$schema="https://json-schema.org/draft/2019-09/schema#"),o};vi.zodToJsonSchema=ya;});var Qn=g(b=>{var ga=b&&b.__createBinding||(Object.create?function(i,e,t,n){n===void 0&&(n=t);var r=Object.getOwnPropertyDescriptor(e,t);(!r||("get"in r?!e.__esModule:r.writable||r.configurable))&&(r={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(i,n,r);}:function(i,e,t,n){n===void 0&&(n=t),i[n]=e[t];}),w=b&&b.__exportStar||function(i,e){for(var t in i)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&ga(e,i,t);};Object.defineProperty(b,"__esModule",{value:!0});w(Rt(),b);w(Ti(),b);w(re(),b);w(E(),b);w(Ai(),b);w(Di(),b);w(Ci(),b);w(ji(),b);w(Ni(),b);w(Mi(),b);w(Zi(),b);w($i(),b);w(Ui(),b);w(qi(),b);w(Li(),b);w(Vi(),b);w(Wi(),b);w(Bi(),b);w(Ki(),b);w(zi(),b);w(Yi(),b);w(Gi(),b);w(Ji(),b);w(Qi(),b);w(Hi(),b);w(en(),b);w(an(),b);w(ti(),b);w(tn(),b);w(Ht(),b);w(rn(),b);w(sn(),b);w(oi(),b);w(on(),b);w(cn(),b);var _a=cn();b.default=_a.zodToJsonSchema;});var rt=(t=>(t.EXECUTE="execute",t.PREVIEW="preview",t))(rt||{}),st=(n=>(n.DISCOVER="discover",n.HEALTH_CHECK="health-check",n.CODE="code",n))(st||{});var q=(S=>(S.WORKFLOW_NOT_FOUND_ERROR="WorkflowNotFoundError",S.WORKFLOW_ALREADY_EXISTS_ERROR="WorkflowAlreadyExistsError",S.WORKFLOW_EXECUTION_FAILED_ERROR="WorkflowExecutionFailedError",S.EXECUTION_STATE_OUTPUT_INVALID_ERROR="ExecutionStateOutputInvalidError",S.EXECUTION_STATE_RESULT_INVALID_ERROR="ExecutionStateResultInvalidError",S.EXECUTION_PROVIDER_OUTPUT_INVALID_ERROR="ExecutionProviderOutputInvalidError",S.PROVIDER_NOT_FOUND_ERROR="ProviderNotFoundError",S.PROVIDER_EXECUTION_FAILED_ERROR="ProviderExecutionFailedError",S.STEP_NOT_FOUND_ERROR="StepNotFoundError",S.STEP_ALREADY_EXISTS_ERROR="StepAlreadyExistsError",S.STEP_EXECUTION_FAILED_ERROR="StepExecutionFailedError",S.EXECUTION_STATE_CORRUPT_ERROR="ExecutionStateCorruptError",S.EXECUTION_EVENT_DATA_INVALID_ERROR="ExecutionEventDataInvalidError",S.EXECUTION_EVENT_INPUT_INVALID_ERROR="ExecutionEventInputInvalidError",S.EXECUTION_STATE_INPUT_INVALID_ERROR="ExecutionStateInputInvalidError",S.METHOD_NOT_ALLOWED_ERROR="MethodNotAllowedError",S.INVALID_ACTION_ERROR="InvalidActionError",S.MISSING_API_KEY_ERROR="MissingApiKeyError",S.SIGNATURE_MISMATCH_ERROR="SignatureMismatchError",S.SIGNATURE_NOT_FOUND_ERROR="SignatureNotFoundError",S.SIGNATURE_INVALID_ERROR="SignatureInvalidError",S.SIGNATURE_EXPIRED_ERROR="SignatureExpiredError",S.SIGNING_KEY_NOT_FOUND_ERROR="SigningKeyNotFoundError",S.PLATFORM_ERROR="PlatformError",S.SIGNATURE_VERSION_INVALID_ERROR="SignatureVersionInvalidError",S))(q||{});var ot=(n=>(n.POST="POST",n.GET="GET",n.OPTIONS="OPTIONS",n))(ot||{});var at=(s=>(s.EMAIL="email",s.SMS="sms",s.PUSH="push",s.CHAT="chat",s.IN_APP="in_app",s))(at||{});var X=class extends Error{data},ct=class extends X{statusCode=404},M=class extends X{statusCode=400},ie=class extends X{statusCode=401},De=class extends X{statusCode=500},lt=class extends X{statusCode=409};var dt=class extends M{code="ExecutionStateCorruptError";constructor(e,t){super(`Workflow with id: \`${e}\` has a corrupt state. Step with id: \`${t}\` does not exist. Please provide the missing state.`),this.data={workflowId:e,stepId:t};}},ut=class extends M{code="ExecutionEventDataInvalidError";constructor(e,t){super(`Workflow with id: \`${e}\` has invalid \`data\`. Please provide the correct event data.`),this.data=t;}},Ke=class extends M{code="ExecutionEventInputInvalidError";constructor(e,t){super(`Workflow with id: \`${e}\` has invalid \`inputs\`. Please provide the correct event inputs.`),this.data=t;}},pt=class extends M{code="ExecutionStateInputInvalidError";constructor(e,t,n){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid input. Please provide the correct step input.`),this.data=n;}},ht=class extends M{code="ExecutionStateOutputInvalidError";constructor(e,t,n){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid output. Please provide the correct step output.`),this.data=n;}},ft=class extends M{code="ExecutionStateResultInvalidError";constructor(e,t,n){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` has invalid result. Please provide the correct step result.`),this.data=n;}},mt=class extends M{code="ExecutionProviderOutputInvalidError";constructor(e,t,n,r){super(`Workflow with id: \`${e}\` has an invalid state. Step with id: \`${t}\` and provider with id: \`${n}\` has invalid output. Please provide the correct provider output.`),this.data=r;}};var I={info:i=>Ce__default.default.blue(i),warning:i=>Ce__default.default.yellow(i),error:i=>Ce__default.default.red(i),success:i=>Ce__default.default.green(i),underline:i=>Ce__default.default.underline(i),bold:i=>Ce__default.default.bold(i)},O={SUCCESS:I.success("\u2714"),ERROR:I.error("\u2717"),WARNING:I.warning("\u26A0"),INFO:I.info("\u2139"),ARROW:I.bold("\u2192"),MOCK:I.info("\u25CB"),HYDRATED:I.bold(I.info("\u2192")),STEP:I.info("\u03C3"),ACTION:I.info("\u03B1"),DURATION:I.info("\u0394"),PROVIDER:I.info("\u2699"),OUTPUT:I.info("\u21E2"),INPUT:I.info("\u21E0"),WORKFLOW:I.info("\u03C9"),STATE:I.info("\u03C3"),EXECUTE:I.info("\u03B5"),PREVIEW:I.info("\u03C1")};var wi=i=>Object.values(i).map(e=>`\`${e}\``).join(", "),yt=i=>i.replaceAll(/(\w)(\w*)/g,(e,t,n)=>t.toUpperCase()+n.toLowerCase()).replaceAll(/[\s-]+/g,"");var gt=class extends X{code="MethodNotAllowedError";statusCode=405;message=`Method not allowed. Please use one of ${wi(ot)}`},ze=class extends M{code="InvalidActionError";constructor(e,t){super(`Invalid query string: \`action\`=\`${e}\`. Please use one of ${wi(t)}`);}};var _t=class extends De{code="PlatformError";message="Something went wrong. Please try again later."};var je=class extends lt{constructor(e,t){super(`${yt(e)} with id: \`${t}\` already exists. Please use a different id.`);}},ne=class extends ct{constructor(e,t){super(`${yt(e)} with id: \`${t}\` does not exist. Please provide a valid id.`);}},Ne=class extends De{constructor(e,t){super(`Failed to execute ${yt(e)} with id: \`${t}\`. Please try again later.`);}};var vt=class extends ne{code="ProviderNotFoundError";constructor(e){super("provider",e);}},bt=class extends Ne{code="ProviderExecutionFailedError";constructor(e){super("workflow",e);}};var xt=class extends ie{code="SignatureMismatchError";constructor(){super("Signature does not match the expected signature. Please ensure the signature provided in the `x-novu-signature` header is correct and try again.");}},wt=class extends ie{code="SignatureNotFoundError";constructor(){super("Signature not found. Please provide a signature in the `x-novu-signature` header");}},Tt=class extends ie{code="SignatureInvalidError";constructor(){super("Signature is invalid. Please provide a valid signature in the `x-novu-signature` header");}},kt=class extends ie{code="SignatureExpiredError";constructor(){super(`Signature expired. Please provide a signature with a timestamp no older than ${5} minutes in the \`x-novu-signature\` header`);}},It=class extends ie{code="SigningKeyNotFoundError";constructor(){super("Signature key not found. Please provide a valid key in the Client constructor `config.apiKey`");}};var Pt=class extends ne{code="StepNotFoundError";constructor(e){super("step",e);}},St=class extends je{code="StepAlreadyExistsError";constructor(e){super("step",e);}};var Ye=class extends ne{code="WorkflowNotFoundError";constructor(e){super("workflow",e);}},Ot=class extends je{code="WorkflowAlreadyExistsError";constructor(e){super("workflow",e);}};var Et=class{ajv;compiledSchemas;constructor(){this.ajv=new vr__default.default({useDefaults:!0,removeAdditional:"all"}),br__default.default(this.ajv),this.compiledSchemas=new Map;}isSchema(e){return typeof e=="boolean"?!1:e.type==="object"||!!e.anyOf||!!e.oneOf}async validate(e,t){let n=this.compiledSchemas.get(t);return n||(n=this.ajv.compile(t),this.compiledSchemas.set(t,n)),n(e)?{success:!0,data:e}:{success:!1,errors:n.errors.map(s=>({path:s.instancePath,message:s.message}))}}transformToJsonSchema(e){return e}};var bi=class{isSchema(e){return e.safeParseAsync!==void 0}async validate(e,t){let n=t.safeParse(e);return n.success?{success:!0,data:n.data}:{success:!1,errors:n.error.errors.map(r=>({path:`/${r.path.join("/")}`,message:r.message}))}}transformToJsonSchema(e){try{return Qn().zodToJsonSchema(e)}catch(t){throw t?.message?.includes("Cannot find module")&&console.error("Tried to use a zod schema in @novu/framework without `zod-to-json-schema` installed. Please install it by running `npm install zod-to-json-schema`."),t}}};var Hn=[new bi,new Et],er=async(i,e)=>{for(let t of Hn)if(t.isSchema(i))return t.validate(e,i);throw new Error("Invalid schema")},C=i=>{for(let e of Hn)if(e.isSchema(i))return e.transformToJsonSchema(i);throw new Error("Invalid schema")};var tr={name:"@novu/framework",version:"0.24.3-alpha.7",description:"The Code-First Notifications Workflow SDK.",main:"./dist/index.js",types:"./dist/index.d.ts",publishConfig:{registry:"https://registry.npmjs.org",access:"public"},private:!1,repository:{type:"git",url:"git+https://github.com/novuhq/novu.git"},files:["dist","README.md"],scripts:{preinstall:"npx only-allow pnpm",test:"vitest","test:watch":"vitest --watch",lint:"eslint src --ext .ts","lint:fix":"eslint src --ext .ts --fix",format:"prettier --check --ignore-path .gitignore .","format:fix":"prettier --write --ignore-path .gitignore .",build:"tsup","build:watch":"tsup --watch","$comment:bump:prerelease":"This is a workaround to support `npm version prerelease` with lerna","bump:prerelease":"npm version prerelease --preid=alpha & PID=$!; (sleep 1 && kill -9 $PID) & wait $PID","release:alpha":"pnpm bump:prerelease || pnpm build && npm publish"},keywords:["novu","code-first","workflows","durable","sdk","notifications","email","sms","push","webhooks","next","nuxt","h3","express"],author:"Novu",license:"MIT",exports:{".":{require:"./dist/index.js",import:"./dist/index.js",types:"./dist/index.d.ts"},"./express":{require:"./dist/express.js",import:"./dist/express.js",types:"./dist/express.d.ts"},"./next":{require:"./dist/next.js",import:"./dist/next.js",types:"./dist/next.d.ts"},"./nuxt":{require:"./dist/nuxt.js",import:"./dist/nuxt.js",types:"./dist/nuxt.d.ts"},"./h3":{require:"./dist/h3.js",import:"./dist/h3.js",types:"./dist/h3.d.ts"},"./sveltekit":{require:"./dist/sveltekit.js",import:"./dist/sveltekit.js",types:"./dist/sveltekit.d.ts"},"./remix":{require:"./dist/remix.js",import:"./dist/remix.js",types:"./dist/remix.d.ts"}},devDependencies:{"@sveltejs/kit":"^2.5.10","@types/express":"^4.17.13","@types/json-schema":"^7.0.15","@types/node":"^20.11.20","@vercel/node":"^2.15.9",express:"^4.18.2",h3:"^1.11.1",next:"^13.5.4",prettier:"^3.2.5","ts-node":"^10.9.2",tsup:"^8.0.2",typescript:"^5.3.3",vitest:"^1.2.1",zod:"^3.23.0","zod-to-json-schema":"^3.23.0"},dependencies:{ajv:"^8.12.0","ajv-formats":"^2.1.1","better-ajv-errors":"^1.2.0",chalk:"^4.1.2","cross-fetch":"^4.0.0","json-schema-faker":"^0.5.6","json-schema-to-ts":"^3.0.0",liquidjs:"^10.13.1",ora:"^5.4.1"}};var ln=tr.version;jsonSchemaFaker.JSONSchemaFaker.random.shuffle=function(){return ["[placeholder]"]};jsonSchemaFaker.JSONSchemaFaker.option({useDefaultValue:!0,alwaysFakeOptionals:!0});var nt=class{discoveredWorkflows=[];templateEngine=new liquidjs.Liquid;apiKey;version=ln;strictAuthentication;static NOVU_SIGNATURE_HEADER="x-novu-signature";constructor(e){let t=this.buildOptions(e);this.apiKey=t.apiKey,this.strictAuthentication=t.strictAuthentication;}buildOptions(e){let t={apiKey:void 0,strictAuthentication:!0};return e?.apiKey!==void 0?t.apiKey=e.apiKey:process.env.NOVU_API_KEY!==void 0&&(t.apiKey=process.env.NOVU_API_KEY),e?.strictAuthentication!==void 0?t.strictAuthentication=e.strictAuthentication:process.env.NOVU_STRICT_AUTHENTICATION!==void 0&&(t.strictAuthentication=process.env.NOVU_STRICT_AUTHENTICATION==="true"),t}addWorkflows(e){for(let t of e){if(this.discoveredWorkflows.some(n=>n.workflowId===t.workflowId))throw new Ot(t.workflowId);this.discoveredWorkflows.push(t);}}healthCheck(){let e=this.discoveredWorkflows.length,t=this.discoveredWorkflows.reduce((n,r)=>n+r.steps.length,0);return {status:"ok",version:ln,discovered:{workflows:e,steps:t}}}getWorkflow(e){let t=this.discoveredWorkflows.find(n=>n.workflowId===e);if(t)return t;throw new Ye(e)}getStep(e,t){let r=this.getWorkflow(e).steps.find(s=>s.stepId===t);if(r)return r;throw new Pt(t)}getRegisteredWorkflows(){return this.discoveredWorkflows}discover(){return {workflows:this.getRegisteredWorkflows()}}mock(e){return jsonSchemaFaker.JSONSchemaFaker.generate(C(e))}async validate(e,t,n,r,s,o,c){let d=await er(t,e);if(d.success)return d.data;switch(n){case"event":this.throwInvalidEvent(r,s,d.errors);case"step":this.throwInvalidStep(o,r,s,d.errors);case"provider":this.throwInvalidProvider(o,c,r,s,d.errors);default:throw new Error(`Invalid component: '${n}'`)}}throwInvalidProvider(e,t,n,r,s){if(!e)throw new Error("stepId is required");if(!t)throw new Error("providerId is required");switch(n){case"output":throw new mt(r,e,t,s);default:throw new Error(`Invalid payload type: '${n}'`)}}throwInvalidStep(e,t,n,r){if(!e)throw new Error("stepId is required");switch(t){case"output":throw new ht(n,e,r);case"result":throw new ft(n,e,r);case"input":throw new pt(n,e,r);default:throw new Error(`Invalid payload type: '${t}'`)}}throwInvalidEvent(e,t,n){switch(e){case"input":throw new Ke(t,n);case"data":throw new ut(t,n);default:throw new Error(`Invalid payload type: '${e}'`)}}executeStepFactory(e,t){return async(n,r,s)=>{let o=this.getStep(e.workflowId,n),c=xa(e),d=await this.createStepInputs(o,c),u=e.action==="preview";if(!u&&await this.shouldSkip(s?.skip,d))return t({options:{skip:!0}}),{};let f=this.previewStep.bind(this),P=this.executeStep.bind(this),te=await(u?f:P)(e,{...o,providers:o.providers.map(Ae=>{let Be=s?.providers?.[Ae.type];if(!Be)throw new vt(Ae.type);return {...Ae,resolve:Be}}),resolve:r});return n===e.stepId&&t(te),te.outputs}}async shouldSkip(e,t){return e?e(t):!1}async executeWorkflow(e){let r=`${{execute:"Executing",preview:"Previewing"}[e.action]} workflowId:`;console.log(`
|
|
19
|
+
${I.bold(I.underline(r))} '${e.workflowId}'`);let s=this.getWorkflow(e.workflowId),o=process.hrtime(),c={outputs:{},providers:{},options:{}},d,u=new Promise(ue=>{d=ue;}),f=ue=>{d(),c=ue;},P;try{if(e.action==="execute"&&!e.data)throw new Ke(e.workflowId,{message:"Event `data` is required"});let ue=await this.createExecutionInputs(e,s);await Promise.race([u,s.execute({payload:ue,environment:{},input:{},subscriber:e.subscriber,step:{email:this.executeStepFactory(e,f),sms:this.executeStepFactory(e,f),inApp:this.executeStepFactory(e,f),digest:this.executeStepFactory(e,f),delay:this.executeStepFactory(e,f),push:this.executeStepFactory(e,f),chat:this.executeStepFactory(e,f),custom:this.executeStepFactory(e,f)}})]);}catch(ue){P=ue;}let ee=process.hrtime(o),te=ee[0],Ae=ee[1],Be=te*1e3+Ae/1e6,yr=P?O.ERROR:O.SUCCESS,gr=e.action==="execute"?"Executed":e.action==="preview"?"Previewed":"Invalid action";if(console.log(`${yr} ${gr} workflowId: \`${e.workflowId}\``),this.prettyPrintExecute(e,Be,P),P)throw P;return {outputs:c.outputs,providers:c.providers,options:c.options,metadata:{status:"success",error:!1,duration:Be}}}async createExecutionInputs(e,t){let n=e.data;if(e.action==="preview"){let s=this.mock(t.data.schema);n=Object.assign(s,n);}return await this.validate(n,t.data.unknownSchema,"event","input",e.workflowId)}prettyPrintExecute(e,t,n){let r=n?O.ERROR:O.SUCCESS,s=e.action==="execute"?"Executed":e.action==="preview"?"Previewed":"Invalid action",o=n?"Failed to execute":s,c=n?I.error:I.success,d=`${r} ${o} workflowId: '${e.workflowId}`;console.log(`
|
|
20
|
+
${I.bold(c(d))}'`),console.log(` \u251C ${O.STEP} stepId: '${e.stepId}'`),console.log(` \u251C ${O.ACTION} action: '${e.action}'`),console.log(` \u2514 ${O.DURATION} duration: '${t.toFixed(2)}ms'
|
|
21
|
+
`);}async executeProviders(e,t){return t.providers.reduce(async(n,r)=>{let s=await n,o=this.previewProvider.bind(this),c=this.executeProvider.bind(this),u=await(e.action==="preview"?o:c)(e,t,r);return {...s,[r.type]:u}},Promise.resolve({}))}previewProvider(e,t,n){return console.log(` ${O.MOCK} Mocked provider: \`${n.type}\``),this.mock(n.outputs.schema)}async executeProvider(e,t,n){let r=xi__default.default({indent:2}).start(`Executing provider: \`${n.type}\``);try{if(e.stepId===t.stepId){let s=await this.createStepInputs(t,e),o=await n.resolve({inputs:s}),c=await this.validate(o,n.outputs.unknownSchema,"step","output",e.workflowId,t.stepId,n.type);return r.succeed(`Executed provider: \`${n.type}\``),c}else r.stopAndPersist({symbol:O.HYDRATED,text:`Hydrated provider: \`${n.type}\``});}catch(s){throw r.stopAndPersist({symbol:O.ERROR,text:`Failed to execute provider: \`${n.type}\``}),new bt(`Failed to execute provider: '${n.type}'.
|
|
22
|
+
${s.message}`)}}async executeStep(e,t){if(e.stepId===t.stepId){let n=xi__default.default({indent:1}).start(`Executing stepId: \`${t.stepId}\``);try{let r=await this.createStepInputs(t,e),s=await this.compileInputs(r,e),o=await t.resolve(s),c=await this.validate(o,t.outputs.unknownSchema,"step","output",e.workflowId,t.stepId),d=await this.executeProviders(e,t);return n.succeed(`Executed stepId: \`${t.stepId}\``),{outputs:c,providers:d}}catch(r){throw n.stopAndPersist({prefixText:"",symbol:O.ERROR,text:`Failed to execute stepId: \`${t.stepId}\``}),r}}else {let n=xi__default.default({indent:1}).start(`Hydrating stepId: \`${t.stepId}\``);try{let r=e.state.find(s=>s.stepId===t.stepId);if(r){let s=await this.validate(r.outputs,t.results.unknownSchema,"step","result",e.workflowId,t.stepId);return n.stopAndPersist({symbol:O.HYDRATED,text:`Hydrated stepId: \`${t.stepId}\``}),{outputs:s,providers:await this.executeProviders(e,t)}}else throw new dt(e.workflowId,t.stepId)}catch(r){throw n.stopAndPersist({symbol:O.ERROR,text:`Failed to hydrate stepId: \`${t.stepId}\``}),r}}}async compileInputs(e,t){let n=this.templateEngine.parse(JSON.stringify(e)),r=await this.templateEngine.render(n,{...t.data,subscriber:t.subscriber});return JSON.parse(r)}async createStepInputs(e,t){let n=t.inputs;return await this.validate(n,e.inputs.unknownSchema,"step","input",t.workflowId,e.stepId)}async previewStep(e,t){let n=xi__default.default({indent:1}).start(`Previewing stepId: \`${t.stepId}\``);try{if(e.stepId===t.stepId){let r=await this.createStepInputs(t,e),s=await this.compileInputs(r,e),o=await t.resolve(s),c=await this.validate(o,t.outputs.unknownSchema,"step","output",e.workflowId,t.stepId);return n.stopAndPersist({symbol:O.MOCK,text:`Mocked stepId: \`${t.stepId}\``}),{outputs:c,providers:await this.executeProviders(e,t)}}else {let r=this.mock(t.results.schema);return n.stopAndPersist({symbol:O.MOCK,text:`Mocked stepId: \`${t.stepId}\``}),{outputs:r,providers:await this.executeProviders(e,t)}}}catch(r){throw n.stopAndPersist({symbol:O.ERROR,text:`Failed to preview stepId: \`${t.stepId}\``}),r}}getStepCode(e,t){return {code:this.getStep(e,t).resolve.toString()}}getWorkflowCode(e){return {code:this.getWorkflow(e).execute.toString()}}getCode(e,t){let n;if(e)t?n=this.getStepCode(e,t):n=this.getWorkflowCode(e);else throw new Ye(e);return n}};function xa(i){return JSON.parse(JSON.stringify(i))}var wa=(u=>(u.PENDING="pending",u.QUEUED="queued",u.RUNNING="running",u.COMPLETED="completed",u.FAILED="failed",u.DELAYED="delayed",u.CANCELED="canceled",u.MERGED="merged",u.SKIPPED="skipped",u))(wa||{});var un=class{frameworkName;handler;client;hmacEnabled;constructor(e){this.handler=e.handler,this.client=e.client?e.client:new nt,this.client.addWorkflows(e.workflows),this.frameworkName=e.frameworkName,this.hmacEnabled=this.client.strictAuthentication;}createHandler(){return async(...e)=>{let t=await this.handler(...e),n=await this.handleAction({actions:t});return t.transformResponse(n)}}getStaticHeaders(){let e=`novu-framework:v${this.client.version}`;return {"content-type":"application/json","access-control-allow-origin":"*","access-control-allow-methods":"GET, POST","access-control-allow-headers":"*","access-control-max-age":"604800","x-novu-framework":this.frameworkName,"user-agent":e,"x-novu-sdk":e}}createResponse(e,t,n={}){return {status:e,body:JSON.stringify(t),headers:{...this.getStaticHeaders(),...n}}}createError(e){return {status:e.statusCode,body:JSON.stringify({message:e.message,data:e.data,code:e.code}),headers:this.getStaticHeaders()}}async handleAction({actions:e}){let t=await e.url(),n=await e.method(),r=t.searchParams.get("action")||"",s=t.searchParams.get("workflowId")||"",o=t.searchParams.get("stepId")||"",c=await e.headers("x-novu-signature")||"",d=await e.headers("x-novu-anonymous")||"",u=t.searchParams.get("source")||"",f={};try{n==="POST"&&(f=await e.body());}catch{}try{r!=="health-check"&&this.validateHmac(f,c);let P=this.getPostActionMap(f,s,o,r,d,u),ee=this.getGetActionMap(s,o);if(n==="POST")return await this.handlePostAction(r,P);if(n==="GET")return await this.handleGetAction(r,ee);if(n==="OPTIONS")return this.createResponse(200,{},{...this.getStaticHeaders()})}catch(P){return this.handleError(P)}return this.createError(new gt(n))}getPostActionMap(e,t,n,r,s,o){return {execute:async()=>{let c=await this.client.executeWorkflow({...e,workflowId:t,stepId:n,action:r});return this.createResponse(200,c,{"x-novu-execution-duration":c.metadata.duration.toString()})},preview:async()=>{let c=await this.client.executeWorkflow({...e,workflowId:t,stepId:n,action:r});return this.createResponse(200,c,{"x-novu-execution-duration":c.metadata.duration.toString()})}}}getGetActionMap(e,t){return {discover:async()=>{let n=await this.client.discover();return this.createResponse(200,n)},"health-check":async()=>{let n=await this.client.healthCheck();return this.createResponse(200,n)},code:async()=>{let n=await this.client.getCode(e,t);return this.createResponse(200,n)}}}async handlePostAction(e,t){if(Object.values(rt).includes(e)){let n=t[e];return n()}else throw new ze(e,rt)}async handleGetAction(e,t){if(Object.values(st).includes(e)){let n=t[e];return n()}else throw new ze(e,st)}isClientError(e){return Object.values(q).includes(e.code)}handleError(e){return this.isClientError(e)?(e.statusCode===500&&console.error(e),this.createError(e)):(console.error(e),this.createError(new _t))}validateHmac(e,t){if(!this.hmacEnabled)return;if(!t)throw new wt;if(!this.client.apiKey)throw new It;let[n,r]=t.split(",");if(!n||!r)throw new Tt;let[s,o]=n.split("="),[c,d]=r.split("=");if(Number(s)<Date.now()-1500)throw new kt;if(!(this.hashHmac(this.client.apiKey,`${o}.${JSON.stringify(e)}`)===d))throw new xt}hashHmac(e,t){return crypto.createHmac("sha256",e).update(t).digest("hex")}};var Ia={type:"object",properties:{webhookUrl:{type:"string",format:"uri"},text:{type:"string"},blocks:{type:"array",items:{type:"object",properties:{type:{enum:["image","context","actions","divider","section","input","file","header","video","rich_text"]}},required:["type"],additionalProperties:!0,allOf:[{if:{properties:{type:{const:"image"}}},then:{$ref:"#/definitions/ImageBlock"}},{if:{properties:{type:{const:"context"}}},then:{$ref:"#/definitions/ContextBlock"}},{if:{properties:{type:{const:"actions"}}},then:{$ref:"#/definitions/ActionsBlock"}},{if:{properties:{type:{const:"divider"}}},then:{$ref:"#/definitions/DividerBlock"}},{if:{properties:{type:{const:"section"}}},then:{$ref:"#/definitions/SectionBlock"}},{if:{properties:{type:{const:"Input"}}},then:{$ref:"#/definitions/InputBlock"}},{if:{properties:{type:{const:"Video"}}},then:{$ref:"#/definitions/VideoBlock"}},{if:{properties:{type:{const:"rich_text"}}},then:{$ref:"#/definitions/RichTextBlock"}}]}}},definitions:{KnownBlock:{oneOf:[{$ref:"#/definitions/ImageBlock"},{$ref:"#/definitions/ContextBlock"},{$ref:"#/definitions/ActionsBlock"},{$ref:"#/definitions/DividerBlock"},{$ref:"#/definitions/SectionBlock"},{$ref:"#/definitions/InputBlock"},{$ref:"#/definitions/FileBlock"},{$ref:"#/definitions/HeaderBlock"},{$ref:"#/definitions/VideoBlock"},{$ref:"#/definitions/RichTextBlock"}]},ImageBlock:{type:"object",properties:{type:{type:"string",const:"image",description:"The type of block. For an image block, `type` is always `image`."},block_id:{type:"string"},image_url:{type:"string",description:"The URL of the image to be displayed. Maximum length for this field is 3000 characters."},alt_text:{type:"string",description:`A plain-text summary of the image. This should not contain any markup.
|
|
26
23
|
Maximum length for this field is 2000 characters.`},title:{$ref:"#/definitions/PlainTextElement",description:`An optional title for the image in the form of a {@link PlainTextElement } object.
|
|
27
24
|
Maximum length for the text in this field is 2000 characters.`}},required:["alt_text","image_url","type"],additionalProperties:!1,description:"Displays an image. A simple image block, designed to make those cat photos really pop."},PlainTextElement:{type:"object",properties:{type:{type:"string",const:"plain_text",description:"The formatting to use for this text object."},text:{type:"string",description:"The text for the block. The minimum length is 1 and maximum length is 3000 characters."},emoji:{type:"boolean",description:"Indicates whether emojis in a text field should be escaped into the colon emoji format."}},required:["type","text"],additionalProperties:!1,description:"Defines an object containing some text."},ContextBlock:{type:"object",properties:{type:{type:"string",const:"context",description:"The type of block. For a context block, `type` is always `context`."},block_id:{type:"string"},elements:{type:"array",items:{anyOf:[{$ref:"#/definitions/ImageElement"},{$ref:"#/definitions/PlainTextElement"},{$ref:"#/definitions/MrkdwnElement"}]},description:`An array of {@link ImageElement }, {@link PlainTextElement } or {@link MrkdwnElement } objects.
|
|
28
25
|
Maximum number of items is 10.`}},required:["elements","type"],additionalProperties:!1,description:"Displays contextual info, which can include both images and text."},ImageElement:{type:"object",properties:{type:{type:"string",const:"image",description:"The type of element. In this case `type` is always `image`."},image_url:{type:"string",description:"The URL of the image to be displayed."},alt_text:{type:"string",description:"A plain-text summary of the image. This should not contain any markup."}},required:["type","image_url","alt_text"],additionalProperties:!1,description:"Displays an image as part of a larger block of content. Use this `image` block if you want a block with\nonly an image in it."},MrkdwnElement:{type:"object",properties:{type:{type:"string",const:"mrkdwn",description:"The formatting to use for this text object."},text:{type:"string",description:`The text for the block. This field accepts any of the standard text formatting markup.
|
|
@@ -103,10 +100,10 @@ that contain remote files. If you want to add remote files to messages,
|
|
|
103
100
|
Maximum length for the text in this field is 150 characters.`}},required:["text","type"],additionalProperties:!1,description:"Displays a larger-sized text block. A `header` is a plain-text block that displays in a larger, bold\nfont. Use it to delineate between different groups of content in your app's surfaces."},VideoBlock:{type:"object",properties:{type:{type:"string",const:"video",description:"The type of block. For a video block, `type` is always `video`."},block_id:{type:"string",description:"A string acting as a unique identifier for a block. If not specified, a `block_id` will be generated.\nYou can use this `block_id` when you receive an interaction payload to\n{@link https://api.slack.com/interactivity/handling#payloads identify the source of the action}.\nMaximum length for this field is 255 characters. `block_id` should be unique for each message and each iteration of\na message. If a message is updated, use a new `block_id`."},video_url:{type:"string",description:`The URL to be embedded. Must match any existing
|
|
104
101
|
{@link https://api.slack.com/reference/messaging/link-unfurling#configuring_domains unfurl domains} within the app
|
|
105
102
|
and point to a HTTPS URL.`},thumbnail_url:{type:"string",description:"The thumbnail image URL."},alt_text:{type:"string",description:"A tooltip for the video. Required for accessibility."},title:{$ref:"#/definitions/PlainTextElement",description:"Video title as a {@link PlainTextElement } object. `text` within must be less than 200 characters."},title_url:{type:"string",description:`Hyperlink for the title text. Must correspond to the non-embeddable URL for the video.
|
|
106
|
-
Must go to an HTTPS URL.`},author_name:{type:"string",description:"Author name to be displayed. Must be less than 50 characters."},provider_name:{type:"string",description:"The originating application or domain of the video, e.g. YouTube."},provider_icon_url:{type:"string",description:"Icon for the video provider, e.g. YouTube icon."},description:{$ref:"#/definitions/PlainTextElement",description:"Description for video using a {@link PlainTextElement } object."}},required:["alt_text","thumbnail_url","title","type","video_url"],additionalProperties:!1,description:"Displays an embedded video player. A video block is designed to embed videos in all app surfaces (e.g.\nlink unfurls, messages, modals, App Home) \u2014 anywhere you can put blocks! To use the video block within your app, you\nmust have the {@link https://api.slack.com/scopes/links.embed:write `links.embed:write` scope}."}},additionalProperties:!1},
|
|
107
|
-
${
|
|
103
|
+
Must go to an HTTPS URL.`},author_name:{type:"string",description:"Author name to be displayed. Must be less than 50 characters."},provider_name:{type:"string",description:"The originating application or domain of the video, e.g. YouTube."},provider_icon_url:{type:"string",description:"Icon for the video provider, e.g. YouTube icon."},description:{$ref:"#/definitions/PlainTextElement",description:"Description for video using a {@link PlainTextElement } object."}},required:["alt_text","thumbnail_url","title","type","video_url"],additionalProperties:!1,description:"Displays an embedded video player. A video block is designed to embed videos in all app surfaces (e.g.\nlink unfurls, messages, modals, App Home) \u2014 anywhere you can put blocks! To use the video block within your app, you\nmust have the {@link https://api.slack.com/scopes/links.embed:write `links.embed:write` scope}."}},additionalProperties:!1},ir={output:Ia};var nr={slack:ir};var Pa={type:"object",properties:{ipPoolName:{type:"string"}},required:["ipPoolName"],additionalProperties:!1},rr={output:Pa};var sr={sendgrid:rr};var or={};var ar={};var cr={};var lr={chat:nr,sms:cr,email:sr,push:ar,in_app:or};var Sa={type:"object",properties:{type:{enum:["regular"],default:"regular"},amount:{type:"number"},unit:{type:"string",enum:["seconds","minutes","hours","days","weeks","months"]}},required:["amount","unit"],additionalProperties:!1},Oa={type:"object",properties:{duration:{type:"number"}},required:["duration"],additionalProperties:!1},pn={output:Sa,result:Oa};var Ea={type:"object",properties:{amount:{type:"number"},unit:{type:"string",enum:["seconds","minutes","hours","days","weeks","months"]},digestKey:{type:"string"},lookBackWindow:{type:"object",properties:{amount:{type:"number"},unit:{type:"string",enum:["seconds","minutes","hours","days","weeks","months"]}},required:["amount","unit"],additionalProperties:!1}},required:["amount","unit"],additionalProperties:!1},Ra={type:"object",properties:{cron:{type:"string"},digestKey:{type:"string"}},required:["cron"],additionalProperties:!1},Aa={oneOf:[Ea,Ra]},Da={type:"object",properties:{events:{type:"array",items:{type:"object",properties:{id:{type:"string"},time:{type:"string"},payload:{type:"object"}},required:["id","time","payload"],additionalProperties:!1}}},required:["events"],additionalProperties:!1},hn={output:Aa,result:Da};var Ca={type:"object",properties:{body:{type:"string"}},required:["body"],additionalProperties:!1},ja={type:"object",properties:{},required:[],additionalProperties:!1},dr={output:Ca,result:ja};var Na={type:"object",properties:{subject:{type:"string"},body:{type:"string"}},required:["subject","body"],additionalProperties:!1},Ma={type:"object",properties:{},required:[],additionalProperties:!1},ur={output:Na,result:Ma};var Za={type:"object",properties:{body:{type:"string"}},required:["body"],additionalProperties:!1},$a={type:"object",properties:{seen:{type:"boolean"},read:{type:"boolean"},lastSeenDate:{type:"string",format:"date-time",nullable:!0},lastReadDate:{type:"string",format:"date-time",nullable:!0}},required:["seen","read","lastSeenDate","lastReadDate"],additionalProperties:!1},pr={output:Za,result:$a};var Ua={type:"object",properties:{subject:{type:"string"},body:{type:"string"}},required:["subject","body"],additionalProperties:!1},qa={type:"object",properties:{},required:[],additionalProperties:!1},hr={output:Ua,result:qa};var La={type:"object",properties:{body:{type:"string"}},required:["body"],additionalProperties:!1},Va={type:"object",properties:{},required:[],additionalProperties:!1},fr={output:La,result:Va};var W={chat:dr,sms:fr,push:hr,email:ur,in_app:pr};var G={type:"object",properties:{},required:[],additionalProperties:!1};function Fa(i,e,t){let n=t||{},r={workflowId:i,options:{...n,inputSchema:C(n.inputSchema||G),payloadSchema:C(n.payloadSchema||G)},steps:[],code:e.toString(),data:{schema:C(n.payloadSchema||G),unknownSchema:n.payloadSchema||G},inputs:{schema:C(n.inputSchema||G),unknownSchema:n.inputSchema||G},execute:e};return e({payload:{},subscriber:{},environment:{},input:{},step:{push:Re(r,"push",W.push.output,W.push.result),chat:Re(r,"chat",W.chat.output,W.chat.result),email:Re(r,"email",W.email.output,W.email.result),sms:Re(r,"sms",W.sms.output,W.sms.result),inApp:Re(r,"in_app",W.in_app.output,W.in_app.result),digest:Re(r,"digest",hn.output,hn.result),delay:Re(r,"delay",pn.output,pn.result),custom:Ba(r,"custom")}}),Ka(r),r}function Re(i,e,t,n){return async(r,s,o={})=>{let c=o?.inputSchema||G,d={stepId:r,type:e,inputs:{schema:C(c),unknownSchema:c},outputs:{schema:C(t),unknownSchema:t},results:{schema:C(n),unknownSchema:n},resolve:s,code:s.toString(),options:o,providers:[]};mr(i,r,d),Object.values(at).includes(e)&&Object.keys(o.providers||{}).length>0&&Wa(d,e,o.providers||{});}}function mr(i,e,t){if(i.steps.some(n=>n.stepId===e))throw new St(e);i.steps.push(t);}function Wa(i,e,t){let n=lr[e];Object.entries(t).forEach(([r,s])=>{let o=n[r];i.providers.push({type:r,code:s.toString(),resolve:s,outputs:{schema:C(o.output),unknownSchema:o.output}});});}function Ba(i,e){return async(t,n,r={})=>{let s=r?.inputSchema||G,o=r?.outputSchema||G;mr(i,t,{stepId:t,type:e,inputs:{schema:C(s),unknownSchema:s},outputs:{schema:C(o),unknownSchema:o},results:{schema:C(o),unknownSchema:o},resolve:n,code:n.toString(),options:r,providers:[]});}}function Ka(i){console.log(`
|
|
104
|
+
${I.bold(I.underline("Discovered workflowId:"))} '${i.workflowId}'`),i.steps.forEach((e,t)=>{let n=t===i.steps.length-1?"\u2514":"\u251C";console.log(`${n} ${O.STEP} Discovered stepId: '${e.stepId}' Type: '${e.type}'`),e.providers.forEach((r,s)=>{let o=s===e.providers.length-1?"\u2514":"\u251C";console.log(` ${o} ${O.PROVIDER} Discovered provider: '${r.type}'`);});});}
|
|
108
105
|
|
|
109
|
-
exports.Client =
|
|
110
|
-
exports.JobStatusEnum =
|
|
111
|
-
exports.NovuRequestHandler =
|
|
112
|
-
exports.workflow =
|
|
106
|
+
exports.Client = nt;
|
|
107
|
+
exports.JobStatusEnum = wa;
|
|
108
|
+
exports.NovuRequestHandler = un;
|
|
109
|
+
exports.workflow = Fa;
|
package/dist/next.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import 'ajv';
|
|
1
|
+
import { j as SupportedFrameworkName, a as ServeHandlerOptions } from './handler-VweGZ1Z4.js';
|
|
3
2
|
import 'json-schema-to-ts';
|
|
3
|
+
import 'zod';
|
|
4
4
|
|
|
5
5
|
declare const frameworkName: SupportedFrameworkName;
|
|
6
6
|
/**
|