UNPKG

@novu/framework

Version:

The Code-First Notifications Workflow SDK.

6 lines 221 kB
"use strict";var Bo=Object.create;var Lt=Object.defineProperty;var Nr=Object.getOwnPropertyDescriptor;var Jo=Object.getOwnPropertyNames;var Go=Object.getPrototypeOf,Ho=Object.prototype.hasOwnProperty;var Ko=(y,n)=>{for(var s in n)Lt(y,s,{get:n[s],enumerable:!0})},xr=(y,n,s,l)=>{if(n&&typeof n=="object"||typeof n=="function")for(let b of Jo(n))!Ho.call(y,b)&&b!==s&&Lt(y,b,{get:()=>n[b],enumerable:!(l=Nr(n,b))||l.enumerable});return y};var ft=(y,n,s)=>(s=y!=null?Bo(Go(y)):{},xr(n||!y||!y.__esModule?Lt(s,"default",{value:y,enumerable:!0}):s,y)),zo=y=>xr(Lt({},"__esModule",{value:!0}),y),He=(y,n,s,l)=>{for(var b=l>1?void 0:l?Nr(n,s):n,C=y.length-1,M;C>=0;C--)(M=y[C])&&(b=(l?M(n,s,b):M(b))||b);return l&&b&&Lt(n,s,b),b},Ke=(y,n)=>(s,l)=>n(s,l,y);var Fa={};Ko(Fa,{Client:()=>vt,CronExpression:()=>mi,NOVU_OPTIONS:()=>Pt,NovuClient:()=>Ge,NovuController:()=>Ye,NovuHandler:()=>Je,NovuModule:()=>Jt,NovuRequestHandler:()=>Et,REGISTER_API_PATH:()=>Oi,frameworkName:()=>xs,registerApiPath:()=>Bn,workflow:()=>Rs});module.exports=zo(Fa);var zr=require("liquidjs");function Xo(y,n){let s=n.split(".").reduce((l,b)=>{if(l&&typeof l=="object")return l[b]},y);if(s==null)return"";if(typeof s=="string")return s;if(typeof s=="number"||typeof s=="boolean")return String(s);if(typeof s=="object"){let l=JSON.stringify(s);return l==="{}"?"":l}return""}function kr(y,n=2,s,l=", "){if(!Array.isArray(y)||y.length===0)return"";let b=s?y.map(Q=>typeof Q!="object"||!Q?"":Xo(Q,s)):y;if(b.length===1)return b[0];if(b.length===2)return`${b[0]} and ${b[1]}`;if(b.length===3&&n>=3)return`${b[0]}, ${l}${b[1]} and ${b[2]}`;let C=b.slice(0,n),M=b.length-n;return`${C.join(l)} and ${M} ${M===1?"other":"others"}`}var Dt=(l=>(l.TRIGGER="trigger",l.EXECUTE="execute",l.PREVIEW="preview",l))(Dt||{}),rn=(l=>(l.DISCOVER="discover",l.HEALTH_CHECK="health-check",l.CODE="code",l))(rn||{});var mi=(U=>(U.EVERY_SECOND="* * * * * *",U.EVERY_5_SECONDS="*/5 * * * * *",U.EVERY_10_SECONDS="*/10 * * * * *",U.EVERY_30_SECONDS="*/30 * * * * *",U.EVERY_MINUTE="*/1 * * * *",U.EVERY_5_MINUTES="0 */5 * * * *",U.EVERY_10_MINUTES="0 */10 * * * *",U.EVERY_30_MINUTES="0 */30 * * * *",U.EVERY_HOUR="0 0-23/1 * * *",U.EVERY_2_HOURS="0 0-23/2 * * *",U.EVERY_3_HOURS="0 0-23/3 * * *",U.EVERY_4_HOURS="0 0-23/4 * * *",U.EVERY_5_HOURS="0 0-23/5 * * *",U.EVERY_6_HOURS="0 0-23/6 * * *",U.EVERY_7_HOURS="0 0-23/7 * * *",U.EVERY_8_HOURS="0 0-23/8 * * *",U.EVERY_9_HOURS="0 0-23/9 * * *",U.EVERY_10_HOURS="0 0-23/10 * * *",U.EVERY_11_HOURS="0 0-23/11 * * *",U.EVERY_12_HOURS="0 0-23/12 * * *",U.EVERY_DAY_AT_1AM="0 01 * * *",U.EVERY_DAY_AT_2AM="0 02 * * *",U.EVERY_DAY_AT_3AM="0 03 * * *",U.EVERY_DAY_AT_4AM="0 04 * * *",U.EVERY_DAY_AT_5AM="0 05 * * *",U.EVERY_DAY_AT_6AM="0 06 * * *",U.EVERY_DAY_AT_7AM="0 07 * * *",U.EVERY_DAY_AT_8AM="0 08 * * *",U.EVERY_DAY_AT_9AM="0 09 * * *",U.EVERY_DAY_AT_10AM="0 10 * * *",U.EVERY_DAY_AT_11AM="0 11 * * *",U.EVERY_DAY_AT_NOON="0 12 * * *",U.EVERY_DAY_AT_1PM="0 13 * * *",U.EVERY_DAY_AT_2PM="0 14 * * *",U.EVERY_DAY_AT_3PM="0 15 * * *",U.EVERY_DAY_AT_4PM="0 16 * * *",U.EVERY_DAY_AT_5PM="0 17 * * *",U.EVERY_DAY_AT_6PM="0 18 * * *",U.EVERY_DAY_AT_7PM="0 19 * * *",U.EVERY_DAY_AT_8PM="0 20 * * *",U.EVERY_DAY_AT_9PM="0 21 * * *",U.EVERY_DAY_AT_10PM="0 22 * * *",U.EVERY_DAY_AT_11PM="0 23 * * *",U.EVERY_DAY_AT_MIDNIGHT="0 0 * * *",U.EVERY_WEEK="0 0 * * 0",U.EVERY_WEEKDAY="0 0 * * 1-5",U.EVERY_WEEKEND="0 0 * * 6,0",U.EVERY_1ST_DAY_OF_MONTH_AT_MIDNIGHT="0 0 1 * *",U.EVERY_1ST_DAY_OF_MONTH_AT_NOON="0 12 1 * *",U.EVERY_2ND_HOUR="0 */2 * * *",U.EVERY_2ND_HOUR_FROM_1AM_THROUGH_11PM="0 1-23/2 * * *",U.EVERY_2ND_MONTH="0 0 1 */2 *",U.EVERY_QUARTER="0 0 1 */3 *",U.EVERY_6_MONTHS="0 0 1 */6 *",U.EVERY_YEAR="0 0 1 0 *",U.EVERY_30_MINUTES_BETWEEN_9AM_AND_5PM="0 */30 9-17 * * *",U.EVERY_30_MINUTES_BETWEEN_9AM_AND_6PM="0 */30 9-18 * * *",U.EVERY_30_MINUTES_BETWEEN_10AM_AND_7PM="0 */30 10-19 * * *",U.MONDAY_TO_FRIDAY_AT_1AM="0 0 01 * * 1-5",U.MONDAY_TO_FRIDAY_AT_2AM="0 0 02 * * 1-5",U.MONDAY_TO_FRIDAY_AT_3AM="0 0 03 * * 1-5",U.MONDAY_TO_FRIDAY_AT_4AM="0 0 04 * * 1-5",U.MONDAY_TO_FRIDAY_AT_5AM="0 0 05 * * 1-5",U.MONDAY_TO_FRIDAY_AT_6AM="0 0 06 * * 1-5",U.MONDAY_TO_FRIDAY_AT_7AM="0 0 07 * * 1-5",U.MONDAY_TO_FRIDAY_AT_8AM="0 0 08 * * 1-5",U.MONDAY_TO_FRIDAY_AT_9AM="0 0 09 * * 1-5",U.MONDAY_TO_FRIDAY_AT_09_30AM="0 30 09 * * 1-5",U.MONDAY_TO_FRIDAY_AT_10AM="0 0 10 * * 1-5",U.MONDAY_TO_FRIDAY_AT_11AM="0 0 11 * * 1-5",U.MONDAY_TO_FRIDAY_AT_11_30AM="0 30 11 * * 1-5",U.MONDAY_TO_FRIDAY_AT_12PM="0 0 12 * * 1-5",U.MONDAY_TO_FRIDAY_AT_1PM="0 0 13 * * 1-5",U.MONDAY_TO_FRIDAY_AT_2PM="0 0 14 * * 1-5",U.MONDAY_TO_FRIDAY_AT_3PM="0 0 15 * * 1-5",U.MONDAY_TO_FRIDAY_AT_4PM="0 0 16 * * 1-5",U.MONDAY_TO_FRIDAY_AT_5PM="0 0 17 * * 1-5",U.MONDAY_TO_FRIDAY_AT_6PM="0 0 18 * * 1-5",U.MONDAY_TO_FRIDAY_AT_7PM="0 0 19 * * 1-5",U.MONDAY_TO_FRIDAY_AT_8PM="0 0 20 * * 1-5",U.MONDAY_TO_FRIDAY_AT_9PM="0 0 21 * * 1-5",U.MONDAY_TO_FRIDAY_AT_10PM="0 0 22 * * 1-5",U.MONDAY_TO_FRIDAY_AT_11PM="0 0 23 * * 1-5",U))(mi||{});var qe=(ce=>(ce.BRIDGE_ERROR="BridgeError",ce.EXECUTION_EVENT_CONTROL_INVALID_ERROR="ExecutionEventControlInvalidError",ce.EXECUTION_EVENT_PAYLOAD_INVALID_ERROR="ExecutionEventPayloadInvalidError",ce.EXECUTION_PROVIDER_OUTPUT_INVALID_ERROR="ExecutionProviderOutputInvalidError",ce.EXECUTION_STATE_CONTROL_INVALID_ERROR="ExecutionStateControlInvalidError",ce.EXECUTION_STATE_CORRUPT_ERROR="ExecutionStateCorruptError",ce.EXECUTION_STATE_OUTPUT_INVALID_ERROR="ExecutionStateOutputInvalidError",ce.EXECUTION_STATE_RESULT_INVALID_ERROR="ExecutionStateResultInvalidError",ce.INVALID_ACTION_ERROR="InvalidActionError",ce.METHOD_NOT_ALLOWED_ERROR="MethodNotAllowedError",ce.MISSING_DEPENDENCY_ERROR="MissingDependencyError",ce.MISSING_SECRET_KEY_ERROR="MissingSecretKeyError",ce.PROVIDER_EXECUTION_FAILED_ERROR="ProviderExecutionFailedError",ce.PROVIDER_NOT_FOUND_ERROR="ProviderNotFoundError",ce.SIGNATURE_EXPIRED_ERROR="SignatureExpiredError",ce.SIGNATURE_INVALID_ERROR="SignatureInvalidError",ce.SIGNATURE_MISMATCH_ERROR="SignatureMismatchError",ce.SIGNATURE_NOT_FOUND_ERROR="SignatureNotFoundError",ce.SIGNATURE_VERSION_INVALID_ERROR="SignatureVersionInvalidError",ce.SIGNING_KEY_NOT_FOUND_ERROR="SigningKeyNotFoundError",ce.STEP_ALREADY_EXISTS_ERROR="StepAlreadyExistsError",ce.STEP_CONTROL_COMPILATION_FAILED_ERROR="StepControlCompilationFailedError",ce.STEP_EXECUTION_FAILED_ERROR="StepExecutionFailedError",ce.STEP_NOT_FOUND_ERROR="StepNotFoundError",ce.WORKFLOW_ALREADY_EXISTS_ERROR="WorkflowAlreadyExistsError",ce.WORKFLOW_NOT_FOUND_ERROR="WorkflowNotFoundError",ce.WORKFLOW_PAYLOAD_INVALID_ERROR="WorkflowPayloadInvalidError",ce))(qe||{});var sn=(l=>(l.POST="POST",l.GET="GET",l.OPTIONS="OPTIONS",l))(sn||{});var on=(C=>(C.EMAIL="email",C.SMS="sms",C.PUSH="push",C.CHAT="chat",C.IN_APP="in_app",C))(on||{});var Qo=y=>{var s,l;if(typeof y!="object"||y===null)return!1;let n=Object.getPrototypeOf(y);return(l=(s=n==null?void 0:n.constructor)==null?void 0:s.name.endsWith("Error"))!=null?l:!1},ot=class extends Error{},an=class extends ot{constructor(){super(...arguments);this.statusCode=404}},Le=class extends ot{constructor(){super(...arguments);this.statusCode=400}},pt=class extends ot{constructor(){super(...arguments);this.statusCode=401}},ut=class extends ot{constructor(n,{cause:s}={}){var l;Qo(s)?(super(`${n}: ${s.message}`),this.data={stack:(l=s.stack)!=null?l:n}):(super(`${n}${s?`: ${JSON.stringify(s,null,2)}`:""}`),this.data={stack:n})}},ln=class extends ot{constructor(){super(...arguments);this.statusCode=409}};var Tt=class extends ut{constructor(s){super("Unknown BridgeError",{cause:s});this.statusCode=500;this.code="BridgeError"}};var cn=class extends Le{constructor(s,l){super(`Workflow with id: \`${s}\` has a corrupt state. Step with id: \`${l}\` does not exist. Please provide the missing state.`);this.code="ExecutionStateCorruptError";this.data={workflowId:s,stepId:l}}},Ut=class extends Le{constructor(s,l){super(`Workflow with id: \`${s}\` has invalid \`payload\`. Please provide the correct event payload.`);this.code="ExecutionEventPayloadInvalidError";this.data=l}},pn=class extends Le{constructor(s,l){super(`Workflow with id: \`${s}\` has invalid \`controls\`. Please provide the correct event controls.`);this.code="ExecutionEventControlInvalidError";this.data=l}},un=class extends Le{constructor(s,l,b){super(`Workflow with id: \`${s}\` has an invalid state. Step with id: \`${l}\` has invalid \`controls\`. Please provide the correct step controls.`);this.code="ExecutionStateControlInvalidError";this.data=b}},dn=class extends Le{constructor(s,l,b){super(`Workflow with id: \`${s}\` has an invalid state. Step with id: \`${l}\` has invalid output. Please provide the correct step output.`);this.code="ExecutionStateOutputInvalidError";this.data=b}},fn=class extends Le{constructor(s,l,b){super(`Workflow with id: \`${s}\` has an invalid state. Step with id: \`${l}\` has invalid result. Please provide the correct step result.`);this.code="ExecutionStateResultInvalidError";this.data=b}},hn=class extends Le{constructor(s,l,b){super(`Workflow with id: \`${s}\` has invalid controls syntax in step with id: \`${l}\`. Please correct step control syntax.`);this.code="StepControlCompilationFailedError";this.data=b}},mn=class extends Le{constructor(s,l,b,C){super(`Workflow with id: \`${s}\` has an invalid state. Step with id: \`${l}\` and provider with id: \`${b}\` has invalid output. Please provide the correct provider output.`);this.code="ExecutionProviderOutputInvalidError";this.data=C}},yn=class extends Le{constructor(s,l){super(`Workflow with id: \`${s}\` has invalid \`payload\`. Please provide the correct payload.`);this.code="WorkflowPayloadInvalidError";this.data=l}};var yi=y=>Object.values(y).map(n=>`\`${n}\``).join(", "),gn=y=>y.replaceAll(/(\w)(\w*)/g,(n,s,l)=>s.toUpperCase()+l.toLowerCase()).replaceAll(/[\s-]+/g,""),gi=(y,n=0)=>Array.isArray(y)||typeof y=="object"&&y!==null?JSON.stringify(y,null,n).replace(/"/g,"'").replace(/\n/g,"\\n"):String(y);var wn=class extends ot{constructor(){super(...arguments);this.code="MethodNotAllowedError";this.statusCode=405;this.message=`Method not allowed. Please use one of ${yi(sn)}`}},Ft=class extends Le{constructor(s,l){super(`Invalid query string: \`action\`=\`${s}\`. Please use one of ${yi(l)}`);this.code="InvalidActionError"}},bn=class extends Le{constructor(){super("Missing secret key. Set the `NOVU_SECRET_KEY` environment variable or pass `secretKey` to the client options.");this.code="MissingSecretKeyError"}};var Sn=class extends Error{constructor(n,s,l){super(),this.data={message:l},this.statusCode=n,this.code=s}};var jt=class extends ln{constructor(n,s){super(`${gn(n)} with id: \`${s}\` already exists. Please use a different id.`)}},dt=class extends an{constructor(n,s){super(`${gn(n)} with id: \`${s}\` does not exist. Please provide a valid id.`)}},Ot=class extends ut{constructor(s,l,b,C){super(`Failed to ${b} ${gn(s)} with id: \`${l}\``,{cause:C});this.statusCode=502}};var Tn=class extends dt{constructor(s){super("provider",s);this.code="ProviderNotFoundError"}},On=class extends Ot{constructor(s,l,b){super("provider",s,l,b);this.code="ProviderExecutionFailedError"}};var An=class extends pt{constructor(){super("Signature does not match the expected signature. Please ensure the signature provided in the `novu-signature` header is correct and try again.");this.code="SignatureMismatchError"}},vn=class extends pt{constructor(){super("Signature not found. Please provide a signature in the `novu-signature` header");this.code="SignatureNotFoundError"}},En=class extends pt{constructor(){super("Signature is invalid. Please provide a valid signature in the `novu-signature` header");this.code="SignatureInvalidError"}},_n=class extends pt{constructor(){super(`Signature expired. Please provide a signature with a timestamp no older than ${5} minutes in the \`novu-signature\` header`);this.code="SignatureExpiredError"}},Rn=class extends pt{constructor(){super("Signature key not found. Please provide a valid key in the Client constructor `config.secretKey`");this.code="SigningKeyNotFoundError"}};var Pn=class extends dt{constructor(s){super("step",s);this.code="StepNotFoundError"}},In=class extends jt{constructor(s){super("step",s);this.code="StepAlreadyExistsError"}},Yt=class extends Ot{constructor(s,l,b){super("step",s,l,b);this.code="StepExecutionFailedError"}};var Wt=class extends dt{constructor(s){super("workflow",s);this.code="WorkflowNotFoundError"}};var ht=y=>Object.values(qe).includes(y==null?void 0:y.code),Cr=y=>!ht(y)&&typeof y.statusCode=="number"&&y.statusCode>=400&&y.statusCode<500;var Lr=async(y,n)=>{let s=new TextEncoder,l=s.encode(y),b=s.encode(n),C=await crypto.subtle.importKey("raw",l,{name:"HMAC",hash:{name:"SHA-256"}},!1,["sign"]),M=await crypto.subtle.sign("HMAC",C,b);return Array.from(new Uint8Array(M)).map(Q=>Q.toString(16).padStart(2,"0")).join("")};var ta=require("cross-fetch");var Dr=async()=>{if(process.env.NOVU_BRIDGE_ORIGIN)return`${process.env.NOVU_BRIDGE_ORIGIN}/api/novu`;if(process.env.NEXT_PUBLIC_VERCEL_ENV==="preview"&&process.env.NEXT_PUBLIC_VERCEL_URL)return`https://${process.env.NEXT_PUBLIC_VERCEL_URL}/api/novu`;try{if(process.env.NODE_ENV==="development"){let n=await(await fetch("http://localhost:2022/.well-known/novu")).json();return`${n.tunnelOrigin}${n.route}`}}catch(y){console.error(y)}return""};function $r(y){return!!y&&typeof y=="object"&&"error"in y&&"message"in y&&"statusCode"in y}var Nn=(y,n)=>{if(!y)throw new bn;return{post:async(s,l)=>{let b=await fetch(`${n}/v1${s}`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`ApiKey ${y}`},body:JSON.stringify(l)}),C=await b.json();if(b.ok)return C;throw $r(C)?new Sn(C.statusCode,C.error,C.message):new Tt(C)},delete:async s=>(await fetch(`${n}/v1${s}`,{method:"DELETE",headers:{"Content-Type":"application/json",Authorization:`ApiKey ${y}`}})).json()}};var mt=ft(require("chalk"),1),we={info:y=>mt.default.blue(y),warning:y=>mt.default.yellow(y),error:y=>mt.default.red(y),success:y=>mt.default.green(y),underline:y=>mt.default.underline(y),bold:y=>mt.default.bold(y)},_e={SUCCESS:we.success("\u2714"),ERROR:we.error("\u2717"),WARNING:we.warning("\u26A0"),INFO:we.info("\u2139"),ARROW:we.bold("\u2192"),MOCK:we.info("\u25CB"),HYDRATED:we.bold(we.info("\u2192")),STEP:we.info("\u03C3"),ACTION:we.info("\u03B1"),DURATION:we.info("\u0394"),PROVIDER:we.info("\u2699"),OUTPUT:we.info("\u21E2"),INPUT:we.info("\u21E0"),WORKFLOW:we.info("\u03C9"),STATE:we.info("\u03C3"),EXECUTE:we.info("\u03B5"),PREVIEW:we.info("\u03C1")};function xn(y){return y||process.env.NOVU_API_URL||"https://api.novu.co"}function kn(y){return y||process.env.NOVU_SECRET_KEY||process.env.NOVU_API_KEY||""}var wi=ft(require("sanitize-html"),1),na={allowedTags:wi.default.defaults.allowedTags.concat(["style","img","html","head","body","link","meta","title"]),allowedAttributes:!1,allowVulnerableTags:!0,parseStyleAttributes:!1,parser:{lowerCaseAttributeNames:!0}},Ur=y=>{if(!y)return y;let n=/^<!DOCTYPE .*?>/,s=y.match(n),l=(0,wi.default)(y,na);return s?s[0]+l:l},Mn=y=>Object.keys(y).reduce((n,s)=>{let l=y[s];return typeof l=="string"?n[s]=Ur(l):Array.isArray(l)?n[s]=l.map(b=>typeof b=="string"?Ur(b):typeof b=="object"?Mn(b):b):typeof l=="object"&&l!==null?n[s]=Mn(l):n[s]=l,n},{});var jr=ft(require("ajv"),1),Yr=ft(require("ajv-formats"),1);var Fr=y=>typeof structuredClone=="function"?structuredClone(y):JSON.parse(JSON.stringify(y));var Cn=class extends ut{constructor(s,l){let b=l.length===1?"it":"them";super(`Tried to use a ${s} in @novu/framework without ${l.join(", ")} installed. Please install ${b} by running \`npm install ${l.join(" ")}\`.`);this.statusCode=500;this.code="MissingDependencyError"}};var Ln=async(y,n)=>{let s=new Set;if((await Promise.allSettled(y.map(b=>b.import))).forEach((b,C)=>{let M=y[C];b.status==="fulfilled"&&M.exports.every(le=>b.value[le]!==void 0)||s.add(M.name)}),s.size>0)throw new Cn(n,Array.from(s))};var Dn=class{constructor(){this.requiredImports=[];this.ajv=new jr.default({useDefaults:!0,removeAdditional:"failing"}),(0,Yr.default)(this.ajv),this.compiledSchemas=new Map}async canHandle(n){let s=n.type==="object"||!!n.anyOf||!!n.allOf||!!n.oneOf;return s&&await Ln(this.requiredImports,"JSON schema"),s}async validate(n,s){let l=this.compiledSchemas.get(s);l||(l=this.ajv.compile(s),this.compiledSchemas.set(s,l));let b=Fr(n);return l(b)?{success:!0,data:b}:{success:!1,errors:l.errors.map(M=>({path:M.instancePath,message:M.message}))}}async transformToJsonSchema(n){return n}};var $n=class{constructor(){this.requiredImports=[{name:"zod",import:import("zod"),exports:["ZodType"]},{name:"zod-to-json-schema",import:import("zod-to-json-schema"),exports:["zodToJsonSchema"]}]}async canHandle(n){let s=n.safeParseAsync!==void 0;return s&&await Ln(this.requiredImports,"Zod schema"),s}async validate(n,s){let l=await s.safeParseAsync(n);return l.success?{success:!0,data:l.data}:{success:!1,errors:l.error.errors.map(b=>({path:`/${b.path.join("/")}`,message:b.message}))}}async transformToJsonSchema(n){let{zodToJsonSchema:s}=await import("zod-to-json-schema");return s(n)}};var Un=new $n,Fn=new Dn,jn=async(y,n)=>{if(await Un.canHandle(y))return Un.validate(n,y);if(await Fn.canHandle(y))return Fn.validate(n,y);throw new Error("Invalid schema")},xe=async y=>{if(await Un.canHandle(y))return Un.transformToJsonSchema(y);if(await Fn.canHandle(y))return Fn.transformToJsonSchema(y);throw new Error("Invalid schema")};var Yn=(()=>{var y=Object.defineProperty,n=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,l=Object.prototype.hasOwnProperty,b=(e,t)=>function(){return e&&(t=(0,e[s(e)[0]])(e=0)),t},C=(e,t)=>function(){return t||(0,e[s(e)[0]])((t={exports:{}}).exports,t),t.exports},M=(e,t)=>{for(var i in t)y(e,i,{get:t[i],enumerable:!0})},Q=(e,t,i,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let p of s(t))!l.call(e,p)&&p!==i&&y(e,p,{get:()=>t[p],enumerable:!(c=n(t,p))||c.enumerable});return e},le=e=>Q(y({},"__esModule",{value:!0}),e),ve={};M(ve,{JSONSchemaFaker:()=>Pr,default:()=>Ir,setDependencies:()=>Vi});function De(e,t){return typeof e=="string"?typeof t!="undefined"?Nt.register(e,t):Nt.get(e):Nt.registerMany(e)}function Ue(e,t){return e=typeof e=="undefined"?tt.MIN_INTEGER:e,t=typeof t=="undefined"?tt.MAX_INTEGER:t,Math.floor(te("random")()*(t-e+1))+e}function Re(e){return zt.default.prototype.max=te("defaultRandExpMax"),zt.default.prototype.randInt=(i,c)=>i+Math.floor(te("random")()*(1+(c-i))),new zt.default(e).gen()}function $e(e){return e[Math.floor(te("random")()*e.length)]}function Fe(e){let t,i,c=e.length,p=e.slice();for(;c>0;)i=Math.floor(te("random")()*c),c-=1,t=p[c],p[c]=p[i],p[i]=t;return p}function lt(e,t){return te("random")()*(t-e)+e}function Qe(e,t,i,c,p=!1){return i=typeof i=="undefined"?tt.MIN_NUMBER:i,c=typeof c=="undefined"?tt.MAX_NUMBER:c,e=typeof e=="undefined"?i:e,t=typeof t=="undefined"?c:t,t<e&&(t+=e),p?lt(e,t):Ue(e,t)}function Gt(e){switch(e){case"seconds":return Qe(0,60)*60;case"minutes":return Qe(15,50)*612;case"hours":return Qe(12,72)*36123;case"days":return Qe(7,30)*86412345;case"weeks":return Qe(4,52)*604812345;case"months":return Qe(2,13)*2592012345;case"years":return Qe(1,20)*31104012345;default:break}}function Jn(e){if(e)return Gt(e);let t=te("minDateTime"),i=te("maxDateTime");typeof t=="string"&&(t=new Date(t)),typeof i=="string"&&(i=new Date(i));let c=new Date().getTime();return typeof t=="number"&&(t=new Date(c+t)),typeof i=="number"&&(i=new Date(c+i)),new Date(lt(t.getTime(),i.getTime()))}function Ai(e,t,i){if(t=decodeURIComponent(t),i&&i[t])return ce(i[t]);let c=t.replace("#/","/").split("/"),p=e.$ref&&i&&i[e.$ref]||e;for(!p&&!c[0]&&(c[0]=e.$ref.split("#/")[0]),i&&t.includes("#/")&&i[c[0]]&&(p=i[c.shift()]),c[0]||c.shift();p&&c.length>0;){let f=c.shift();if(!p[f])throw new Error(`Prop not found: ${f} (${t})`);p=p[f]}return p}function Ht(e){return typeof e=="string"&&Zi.test(e)}function Ze(e){return["number","boolean"].includes(typeof e)}function et(e,...t){return t.filter(i=>typeof e[i]!="undefined").length>0}function vi(e){if(e.includes(" "))return new Date(e).toISOString().substr(0,10);let[t,i,c]=e.split("T")[0].split("-");return i=`0${Math.max(1,Math.min(12,i))}`.slice(-2),c=`0${Math.max(1,Math.min(31,c))}`.slice(-2),`${t}-${i}-${c}`}function Ls(e){if(e.includes(" "))return new Date(e).toISOString().substr(0,10);let[t,i]=e.split("T"),[c,p,f]=t.split("-"),[d,O,$]=i.substr(0,8).split(":");return p=`0${Math.max(1,Math.min(12,p))}`.slice(-2),f=`0${Math.max(1,Math.min(31,f))}`.slice(-2),d=`0${Math.max(1,Math.min(23,d))}`.slice(-2),O=`0${Math.max(1,Math.min(59,O))}`.slice(-2),$=`0${Math.max(1,Math.min(59,$))}`.slice(-2),`${c}-${p}-${f}T${d}:${O}:${$}.000Z`}function Ds(e,t,i){let c={};switch(e||t.type){case"integer":case"number":if(typeof t.minimum!="undefined"&&(c.minimum=t.minimum),typeof t.maximum!="undefined"&&(c.maximum=t.maximum),t.enum){let f=Math.max(c.minimum||0,0),d=Math.min(c.maximum||1/0,1/0);t.exclusiveMinimum&&f===t.minimum&&(f+=t.multipleOf||1),t.exclusiveMaximum&&d===t.maximum&&(d-=t.multipleOf||1),(f||d!==1/0)&&(t.enum=t.enum.filter(O=>O>=f&&O<=d))}break;case"string":{c.minLength=te("minLength")||0,c.maxLength=te("maxLength")||Number.MAX_SAFE_INTEGER,typeof t.minLength!="undefined"&&(c.minLength=Math.max(c.minLength,t.minLength)),typeof t.maxLength!="undefined"&&(c.maxLength=Math.min(c.maxLength,t.maxLength));break}default:break}let p=i(c);if(p==null)return null;switch(e||t.type){case"number":p=Ht(p)?parseFloat(p):p;break;case"integer":p=Ht(p)?parseInt(p,10):p;break;case"boolean":p=!!p;break;case"string":{if(Ze(p))return p;p=String(p);let f=Math.max(c.minLength||0,0),d=Math.min(c.maxLength||1/0,1/0),O,$=0;for(;p.length<f;)if(O=p,t.pattern?p+=Z.randexp(t.pattern):p+=`${Z.pick([" ","/","_","-","+","=","@","^"])}${p}`,p===O){if($+=1,$===3)break}else $=0;switch(p.length>d&&(p=p.substr(0,d)),t.format){case"date-time":case"datetime":p=new Date(Ls(p)).toISOString().replace(/([0-9])0+Z$/,"$1Z");break;case"full-date":case"date":p=new Date(vi(p)).toISOString().substr(0,10);break;case"time":p=new Date(`1969-01-01 ${p}`).toISOString().substr(11);break;default:break}break}default:break}return p}function wt(e,t){return Object.keys(t).forEach(i=>{typeof t[i]!="object"||t[i]===null?e[i]=t[i]:Array.isArray(t[i])?(e[i]=e[i]||[],t[i].forEach((c,p)=>{e.type==="array"&&t.type==="array"?e[i][p]=wt(e[i][p]||{},c,!0):Array.isArray(e[i])&&e[i].indexOf(c)===-1&&e[i].push(c)})):typeof e[i]!="object"||e[i]===null||Array.isArray(e[i])?e[i]=wt({},t[i]):e[i]=wt(e[i],t[i])}),e}function ce(e,t=new Map){if(!e||typeof e!="object")return e;if(t.has(e))return t.get(e);if(Array.isArray(e)){let c=[];return t.set(e,c),c.push(...e.map(p=>ce(p,t))),c}let i={};return t.set(e,i),Object.keys(e).reduce((c,p)=>(c[p]=ce(e[p],t),c),i)}function $s(e){let t=JSON.stringify(e),i=JSON.stringify(e,null,2);return t.length>400?`${i.substr(0,400)}...`:i}function Ei(){return Z.pick([!1,!0,null,-1,NaN,Math.PI,1/0,void 0,[],{},Math.random(),Math.random().toString(36).substr(2)])}function Us(e,t){if(e.enum)return e.enum.includes(t);if(e.const)return e.const===t}function Fs(e,t){let i=wt({},t);if(typeof e.minimum!="undefined"&&(i.maximum=e.minimum,i.exclusiveMaximum=!0),typeof e.maximum!="undefined"&&(i.minimum=e.maximum>i.maximum?0:e.maximum,i.exclusiveMinimum=!0),typeof e.minLength!="undefined"&&(i.maxLength=e.minLength),typeof e.maxLength!="undefined"&&(i.minLength=e.maxLength>i.maxLength?0:e.maxLength),e.type)i.type=Z.pick(tt.SCALAR_TYPES.filter(c=>(Array.isArray(e.type)?e.type:[e.type]).every(f=>c==="number"||c==="integer"?f!=="number"&&f!=="integer":c!==f)));else if(e.enum){let c;do c=Ei();while(e.enum.indexOf(c)!==-1);i.enum=[c]}return e.required&&i.properties&&e.required.forEach(c=>{delete i.properties[c]}),i}function Gn(e,t){let i=t.minimum!==void 0,c=t.maximum!==void 0;return(i||c)&&(!i||e>=t.minimum)&&(!c||e<=t.maximum)}function js(e,t){return!t.every(i=>Gn(e,i))}function Ys(e,t){return t.reduce((c,p)=>c+(Gn(e,p)?1:0),0)===1}function Ws(e){return["enum","const","default","examples","required","definitions","items","properties"].includes(e)}function Vs(e,t){return Object.keys(e).filter(i=>!t.includes(i)).reduce((i,c)=>(Array.isArray(e[c])?i[c]=e[c].slice():i[c]=e[c]instanceof Object?wt({},e[c]):e[c],i),{})}function _i(e,t){return Array.isArray(e)?e.map(i=>_i(i,t)):(typeof e=="string"&&(e=e.replace(/#\{([\w.-]+)\}/g,(i,c)=>t[c])),e)}function Hn(e){return Object.prototype.toString.call(e)==="[object Object]"&&!Object.keys(e).length}function Ri(e,t){t=t.items||t;let i=te("alwaysFakeOptionals"),c=Array.isArray(t.required)&&t.required.includes(e)||i,p=typeof t.thunk=="function"||t.additionalProperties&&typeof t.additionalProperties.thunk=="function";return!c&&!p}function Kn(e,t,i=!1){if(!e||typeof e!="object")return e;if(Array.isArray(e))return e.map(c=>Kn(c,t,!0)).filter(c=>typeof c!="undefined");if(Object.keys(e).forEach(c=>{if(Hn(e[c]))Ri(c,t)&&delete e[c];else{let p=t;t&&t.properties&&t.properties[c]&&(p=t.properties[c]);let f=Kn(e[c],p);Hn(f)||(e[c]=f)}typeof e[c]=="undefined"&&delete e[c]}),!(!Object.keys(e).length&&i))return e}function qs(e){return(t,i,c,p)=>{let f=t,d=[];typeof t=="object"&&(f=Object.keys(t)[0],Array.isArray(t[f])?d=t[f]:d.push(t[f]));let O=f.split("."),$=e();for(;O.length>1;)$=$[O.shift()];return t=typeof $=="object"?$[O[0]]:$,typeof t=="function"&&(t=t.apply($,d.map(T=>de.template(T,p)))),Object.prototype.toString.call(t)==="[object Object]"&&Object.keys(t).forEach(T=>{if(typeof t[T]=="function")throw new Error(`Cannot resolve value for '${c}: ${f}', given: ${t}`)}),t}}function Bs(e,t){if(typeof e=="undefined")return St.list();if(typeof e=="string")if(typeof t=="function")St.register(e,t);else if(t===null||t===!1)St.unregister(e);else return St.get(e);else St.registerMany(e)}function Js(e,t,i){return Object.keys(e).filter(c=>{let p=ir.indexOf(t)>-1;return i.indexOf(c)>-1&&!p}).length>0}function Gs(e,t){let i=Object.keys(xt);for(let c=0;c<i.length;c+=1){let p=i[c],f=t[t.length-1];if(Js(e,f,xt[p]))return p}}function Hs(){return te("random")()>.5}function Ks(){return null}function zs(e,t,i,c,p,f){let d=[],O=[];function $(F){let E=JSON.stringify(F.value);return O.indexOf(E)===-1?(O.push(E),d.push(F),!0):!1}t.forEach($);let T=100;for(;d.length!==t.length&&($(f(i.items||c,e,p))||(T-=1),!!T););return d}function Xs(e,t,i,c){let p=[];if(!(e.items||e.additionalItems)){if(de.hasProperties(e,"minItems","maxItems","uniqueItems")&&(e.minItems!==0||e.maxItems!==0))throw new Xt(`missing items for ${de.short(e)}`,t);return p}if(Array.isArray(e.items))return e.items.map((W,oe)=>{let X=t.concat(["items",oe]);return c(W,X,i)});let f=e.minItems,d=e.maxItems,O=te("minItems"),$=te("maxItems");O&&(f=typeof f=="undefined"?O:Math.min(O,f)),$&&(d=typeof d=="undefined"?$:Math.min($,d),d&&d>$&&(d=$),f&&f>$&&(f=d));let T=te("alwaysFakeOptionals")===!0?1:te("optionalsProbability"),F=te("alwaysFakeOptionals")||te("fixedProbabilities")||!1,E=Z.number(f,d,1,5);T!==null&&(E=Math.max(F?Math.round((d||E)*T):Math.abs(Z.number(f,d)*T),f||0));let B=typeof e.additionalItems=="object"?e.additionalItems:{};for(let W=p.length;W<E;W+=1){let oe=t.concat(["items",W]),X=c(e.items||B,oe,i);p.push(X)}if(e.contains&&E>0){let W=Z.number(0,E-1);p[W]=c(e.contains,t.concat(["items",W]),i)}return e.uniqueItems?zs(t.concat(["items"]),p,e,B,i,c):p}function Qs(e){let t=typeof e.minimum=="undefined"||e.minimum===-Number.MAX_VALUE?tt.MIN_INTEGER:e.minimum,i=typeof e.maximum=="undefined"||e.maximum===Number.MAX_VALUE?tt.MAX_INTEGER:e.maximum,c=e.multipleOf,p=c&&String(c).match(/e-(\d)|\.(\d+)$/);if(p){let f=(Math.random()*Z.number(0,10)+1)*c,d=p[1]||p[2].length,O=parseFloat(f.toFixed(d)),$=Z.number(t,i-1);return String(O).includes(".")?$+O:($+O).toExponential()}if(c&&(i=Math.floor(i/c)*c,t=Math.ceil(t/c)*c),e.exclusiveMinimum&&t===e.minimum&&(t+=c||1),e.exclusiveMaximum&&i===e.maximum&&(i-=c||1),t>i)return NaN;if(c){let f=Z.number(Math.floor(t/c),Math.floor(i/c))*c;for(;f<t;)f+=c;return f}return Z.number(t,i,void 0,void 0,e.type!=="integer")}function Zs(e){return Math.floor(pi({...e}))}function eo(e){return Z.shuffle(fr).slice(0,e)}function to(e,t,i,c){let p={},f=e.properties||{},d=e.patternProperties||{},O=typeof e.required=="boolean"?[]:(e.required||[]).slice(),$=e.additionalProperties!==!1,T=Object.keys(f),F=Object.keys(d),E=T.concat(F).reduce((Y,h)=>(O.indexOf(h)===-1&&Y.push(h),Y),[]),B=O.concat(E),W=$&&e.additionalProperties===!0?Zt:e.additionalProperties;if(!$&&T.length===0&&F.length===0&&de.hasProperties(e,"minProperties","maxProperties","dependencies","required"))return null;if(te("requiredOnly")===!0)return O.forEach(Y=>{f[Y]&&(p[Y]=f[Y])}),c(p,t.concat(["properties"]),i,e);let oe=te("alwaysFakeOptionals")===!0?1:te("optionalsProbability"),X=te("alwaysFakeOptionals")||te("fixedProbabilities")||!1,ne=te("ignoreProperties")||[],he=te("reuseProperties"),ye=te("fillProperties"),j=e.maxProperties||B.length+($?Z.number(1,5):0),w=Math.max(e.minProperties||0,O.length),S=Math.max(0,B.length-w);B.length===1&&!O.length&&(w=Math.max(Z.number(ye?1:0,j),w)),oe!==null&&(X===!0?S=Math.round(w-O.length+oe*(B.length-w)):S=Z.number(w-O.length,oe*(B.length-w)));let R=Z.shuffle(E).slice(0,S),I=E.filter(Y=>R.indexOf(Y)!==-1),L=oe!==null||O.length===j?j:Z.number(0,j),_=O.concat(Z.shuffle(I).slice(0,L)).slice(0,j),N=[],k=[];if(e.dependencies&&(Object.keys(e.dependencies).forEach(Y=>{let h=e.dependencies[Y];if(_.indexOf(Y)!==-1)if(Array.isArray(h))h.forEach(x=>{_.indexOf(x)===-1&&_.push(x)});else if(Array.isArray(h.oneOf||h.anyOf)){let x=h.oneOf||h.anyOf;k.push({prop:Y,values:x})}else N.push(h)}),N.length))return delete e.dependencies,c({allOf:N.concat(e)},t.concat(["properties"]),i,e);let V=[],J=[];_.forEach(Y=>{if(f[Y]&&["{}","true"].includes(JSON.stringify(f[Y].not)))return;for(let x=0;x<ne.length;x+=1)if(ne[x]instanceof RegExp&&ne[x].test(Y)||typeof ne[x]=="string"&&ne[x]===Y||typeof ne[x]=="function"&&ne[x](f[Y],Y)){V.push(Y);return}W===!1&&O.indexOf(Y)!==-1&&(p[Y]=f[Y]),f[Y]&&(p[Y]=f[Y]);let h;if(F.forEach(x=>{Y.match(new RegExp(x))&&(h=!0,p[Y]?de.merge(p[Y],d[x]):p[Z.randexp(Y)]=d[x])}),!h){let x=d[Y]||W;x&&W!==!1?p[d[Y]?Z.randexp(Y):Y]=f[Y]||x:J.push(Y)}});let ee=Object.keys(p).length+(ye?0:V.length),Te=Y=>Z.randexp(`_?[_a-f\\d]{1,3}${Y?"\\$?":""}`);function Oe(Y){let h;do{if(!Y.length)break;h=Y.shift()}while(p[h]);return h}let Ee=w;if($&&!O.length&&(Ee=Math.max(oe===null||W?Z.number(ye?1:0,j):0,w)),!I.length&&!S&&$&&X===!0&&ye){let Y=Z.number(0,j);for(let h=0;h<Y;h+=1)p[Qt(1)+Te(Y[h])]=W||Zt}for(;ye&&!(!(F.length||$)||ee>=Ee);){if($)if(he&&T.length-ee>Ee){let Y=0,h;do{if(Y+=1,Y>1e3)break;h=Oe(O)||Z.pick(T)}while(typeof p[h]!="undefined");typeof p[h]=="undefined"&&(p[h]=f[h],ee+=1)}else if(F.length&&!W){let Y=Z.pick(F),h=Z.randexp(Y);p[h]||(p[h]=d[Y],ee+=1)}else{let Y=Oe(O)||Qt(1)+Te();p[Y]||(p[Y]=W||Zt,ee+=1)}for(let Y=0;ee<w&&Y<F.length;Y+=1){let h=F[Y],x=Z.randexp(h);p[x]||(p[x]=d[h],ee+=1)}}if(O.length===0&&(!$||oe===!1)){let Y=Z.number(w,j);for(;ee<Y;){let h=Oe(T);h&&(p[h]=f[h]),ee+=1}}let Pe=p;if(te("sortProperties")!==null){let Y=Object.keys(f);Pe=Object.keys(p).sort((x,G)=>te("sortProperties")?x.localeCompare(G):Y.indexOf(x)-Y.indexOf(G)).reduce((x,G)=>(x[G]=p[G],x),{})}let ke=c(Pe,t.concat(["properties"]),i,e);return k.forEach(Y=>{for(let h of Y.values)if(de.hasValue(h.properties[Y.prop],ke.value[Y.prop])){Object.keys(h.properties).forEach(x=>{x!==Y.prop&&de.merge(ke.value,c(h.properties,t.concat(["properties"]),i,e).value)});break}}),ke}function Pi(){let e=Z.number(1,5);return Qt(e).join(" ")}function no(e=0,t=140){let i=Math.max(0,e),c=Z.number(i,t),p=Pi();for(;p.length<i;)p+=Pi();return p.length>c&&(p=p.substr(0,c)),p}function io(){return[0,0,0,0].map(()=>Z.number(0,255)).join(".")}function ro(){return Z.date().toISOString()}function so(){return en().slice(0,10)}function oo(){return en().slice(11)}function ao(e){return Z.randexp(We[e]).replace(br,(t,i)=>Z.randexp(We[i]))}function lo(e,t){let i=ci(e.format);if(typeof i=="function")return i(e);switch(e.format){case"date-time":case"datetime":return en();case"date":return yr();case"time":return gr();case"ipv4":return mr();case"regex":return".+?";case"email":case"hostname":case"ipv6":case"uri":case"uri-reference":case"iri":case"iri-reference":case"idn-email":case"idn-hostname":case"json-pointer":case"slug":case"uri-template":case"uuid":case"duration":return Sr(e.format);default:if(typeof i=="undefined"){if(te("failOnInvalidFormat"))throw new Error(`unknown registry key ${de.short(e.format)}`);return t()}throw new Error(`unsupported format '${e.format}'`)}}function co(e){return de.typecast("string",e,i=>e.format?lo(e,()=>ui(i.minLength,i.maxLength)):e.pattern?Z.randexp(e.pattern):ui(i.minLength,i.maxLength))}function po({$comment:e,title:t,description:i}){return Object.entries({comment:e,title:t,description:i}).filter(([,c])=>c).reduce((c,[p,f])=>(c[p]=f,c),{})}function bt(e,t,i,c){if(e=i(e,null,t),e&&(e.oneOf||e.anyOf||e.allOf)&&(e=i(e,null,t)),!e)throw new Error(`Cannot traverse at '${t.join(".")}', given '${JSON.stringify(c)}'`);let p={...po(e),schemaPath:t};if(t[t.length-1]!=="properties"){if(te("useExamplesValue")&&Array.isArray(e.examples)){let T=e.examples.concat("default"in e?[e.default]:[]);return{value:de.typecast(null,e,()=>Z.pick(T)),context:p}}if(te("useExamplesValue")&&typeof e.example!="undefined")return{value:de.typecast(null,e,()=>e.example),context:p};if(te("useDefaultValue")&&"default"in e&&(e.default!==""||!te("replaceEmptyByRandomValue")))return{value:e.default,context:p};if("template"in e)return{value:de.template(e.template,c),context:p};if("const"in e)return{value:e.const,context:p}}if(e.not&&typeof e.not=="object"&&(e=de.notValue(e.not,de.omitProps(e,["not"])),e.type&&e.type==="object")){let{value:T,context:F}=bt(e,t.concat(["not"]),i,c);return{value:de.clean(T,e,!1),context:{...p,items:F}}}if(typeof e.thunk=="function"){let{value:T,context:F}=bt(e.thunk(c),t,i);return{value:T,context:{...p,items:F}}}if(e.jsonPath)return{value:e,context:p};let f=e.type;if(Array.isArray(f)?f=Z.pick(f):typeof f=="undefined"&&(f=rr(e,t)||f,f&&(e.type=f)),typeof e.generate=="function"){let T=de.typecast(null,e,()=>e.generate(c,t)),F=T===null?"null":typeof T;if(F===f||F==="number"&&f==="integer"||Array.isArray(T)&&f==="array")return{value:T,context:p}}if(typeof e.pattern=="string")return{value:de.typecast("string",e,()=>Z.randexp(e.pattern)),context:p};if(Array.isArray(e.enum))return{value:de.typecast(null,e,()=>Z.pick(e.enum)),context:p};if(typeof f=="string")if(kt[f])try{let T=kt[f](e,t,i,bt);return f==="array"?{value:T.map(({value:F})=>F),context:{...p,items:T.map(Array.isArray(e.items)?({context:F})=>F:({context:F})=>({...F,schemaPath:F.schemaPath.slice(0,-1)}))}}:f==="object"?T!==null?{value:T.value,context:{...p,items:T.context}}:{value:{},context:p}:{value:T,context:p}}catch(T){throw typeof T.path=="undefined"?new Xt(T.stack,t):T}else{if(te("failOnInvalidTypes"))throw new Xt(`unknown primitive ${de.short(f)}`,t.concat(["type"]));{let T=te("defaultInvalidTypeProduct");return typeof T=="string"&&kt[T]?{value:kt[T](e,t,i,bt),context:p}:{value:T,context:p}}}let d={},O={...p};Array.isArray(e)&&(d=[]);let $=te("pruneProperties")||[];return Object.keys(e).forEach(T=>{if(!$.includes(T)&&e[T]!==null)if(typeof e[T]=="object"&&T!=="definitions"){let{value:F,context:E}=bt(e[T],t.concat([T]),i,d);d[T]=de.clean(F,e[T],!1),O[T]=E,d[T]===null&&te("omitNulls")&&(delete d[T],delete O[T])}else d[T]=e[T]}),{value:d,context:O}}function uo(e){return Array.isArray(e)?Z.pick(e):e}function fo(e,t){if(!Array.isArray(e))return e;let i=t?e.pop():e.shift();return t?e.unshift(i):e.push(i),i}function zn(e,t,i,c){if(!e||typeof e!="object")return e;if(i||(i={}),t||(t=e),Array.isArray(e))return e.map(p=>zn(p,t,i,c));if(e.jsonPath){let{JSONPath:p}=ri(),f=typeof e.jsonPath!="object"?{path:e.jsonPath}:e.jsonPath;f.group=e.group||f.group||c,f.cycle=e.cycle||f.cycle||!1,f.reverse=e.reverse||f.reverse||!1,f.count=e.count||f.count||1;let d=`${f.group}__${f.path}`;return i[d]||(f.count>1?i[d]=p(f.path,t).slice(0,f.count):i[d]=p(f.path,t)),f.cycle||f.reverse?fo(i[d],f.reverse):uo(i[d])}return Object.keys(e).forEach(p=>{e[p]=zn(e[p],t,i,p)}),e}function ho(e,t,i,c){if(Object.prototype.toString.call(t)!=="[object Object]")throw new Error(`Invalid input, expecting object but given ${typeof t}`);let p=te("refDepthMin")||0,f=te("refDepthMax")||3;try{let{resolveSchema:d}=Er({refs:e,schema:t,container:i,synchronous:c,refDepthMin:p,refDepthMax:f}),O=Ar(de.clone(t),[],d);return te("resolveJsonPath")?{value:zn(O.value),context:O.context}:O}catch(d){throw d.path?new Error(`${d.message} in /${d.path.join("/")}`):d}}function mo(e){return e.value}function yo(e,t){return t.reduce((i,c)=>c in i?i[c]:{},e)}function Xn(e,t,i,c=i){let{title:p,description:f,comment:d}=yo(e,t),O=[];te("renderTitle")&&p&&O.push(` ${p}`,""),te("renderDescription")&&f&&O.push(` ${f}`),te("renderComment")&&d&&O.push(` ${d}`),i.commentBefore=O.join(` `),c instanceof _r?c.items.forEach($=>{Xn(e,[...t,"items",$.key.value],$.key,$.value)}):c instanceof Rr&&c.items.forEach(($,T)=>{Xn(e,[...t,"items",T],$)})}function go({value:e,context:t}){let i=Mt.createNode(e);Xn(t,[],i);let c=new Mt.Document;return c.contents=i,c.toString()}function Ii(){it.define("autoIncrement",function(t,i){if(!this.offset){let c=i.minimum||1,p=c+tt.MAX_NUMBER,f=t.initialOffset||i.initialOffset;this.offset=f||Z.number(c,p)}return t?this.offset++:i}),it.define("sequentialDate",function(t,i){if(this.now||(this.now=Z.date()),t){if(i=this.now.toISOString(),t=t===!0?"days":t,["seconds","minutes","hours","days","weeks","months","years"].indexOf(t)===-1)throw new Error(`Unsupported increment by ${de.short(t)}`);this.now.setTime(this.now.getTime()+Z.date(t))}return i})}function Ni(e,t){let i={};Array.isArray(e)?e.forEach(p=>{i[p.$id||p.id]=p}):i=e||{};function c(p){if(!p||typeof p!="object")return;if(Array.isArray(p))return p.forEach(c);let f=p.$id||p.id;typeof f=="string"&&!i[f]&&(i[f]=p),Object.keys(p).forEach(d=>{c(p[d])})}return c(e),c(t),i}var xi,Qn,ki,Zn,Mi,Ci,je,Li,ei,U,ti,Di,$i,Ui,Fi,ji,It,Kt,ni,Yi,Wi,ii,ri,Vi,qi,si,ue,oi,Bi,Ji,Nt,te,ai,li,Gi,Hi,Ki,zi,Xi,Qi,tt,zt,Z,Zi,de,er,tr,St,ci,nr,Xt,xt,ir,rr,sr,or,ar,lr,cr,pr,ur,pi,dr,fr,Qt,Zt,hr,ui,mr,en,yr,gr,di,tn,wr,We,br,Sr,Tr,Or,kt,Ar,vr,Er,fi,hi,Me,wo,bo,So,To,Oo,Ao,vo,Eo,_o,Ro,Po,Io,_r,Rr,Mt,it,Se,Pr,Ir,No=b({"src/shared.js"(){xi=Object.create,Qn=Object.defineProperty,ki=Object.getOwnPropertyDescriptor,Zn=Object.getOwnPropertyNames,Mi=Object.getPrototypeOf,Ci=Object.prototype.hasOwnProperty,je=(e,t)=>function(){return t||(0,e[Zn(e)[0]])((t={exports:{}}).exports,t),t.exports},Li=(e,t,i,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let p of Zn(t))!Ci.call(e,p)&&p!==i&&Qn(e,p,{get:()=>t[p],enumerable:!(c=ki(t,p))||c.enumerable});return e},ei=(e,t,i)=>(i=e!=null?xi(Mi(e)):{},Li(t||!e||!e.__esModule?Qn(i,"default",{value:e,enumerable:!0}):i,e)),U=je({"node_modules/ret/lib/types.js"(e,t){t.exports={ROOT:0,GROUP:1,POSITION:2,SET:3,RANGE:4,REPETITION:5,REFERENCE:6,CHAR:7}}}),ti=je({"node_modules/ret/lib/sets.js"(e){var t=U(),i=()=>[{type:t.RANGE,from:48,to:57}],c=()=>[{type:t.CHAR,value:95},{type:t.RANGE,from:97,to:122},{type:t.RANGE,from:65,to:90}].concat(i()),p=()=>[{type:t.CHAR,value:9},{type:t.CHAR,value:10},{type:t.CHAR,value:11},{type:t.CHAR,value:12},{type:t.CHAR,value:13},{type:t.CHAR,value:32},{type:t.CHAR,value:160},{type:t.CHAR,value:5760},{type:t.RANGE,from:8192,to:8202},{type:t.CHAR,value:8232},{type:t.CHAR,value:8233},{type:t.CHAR,value:8239},{type:t.CHAR,value:8287},{type:t.CHAR,value:12288},{type:t.CHAR,value:65279}],f=()=>[{type:t.CHAR,value:10},{type:t.CHAR,value:13},{type:t.CHAR,value:8232},{type:t.CHAR,value:8233}];e.words=()=>({type:t.SET,set:c(),not:!1}),e.notWords=()=>({type:t.SET,set:c(),not:!0}),e.ints=()=>({type:t.SET,set:i(),not:!1}),e.notInts=()=>({type:t.SET,set:i(),not:!0}),e.whitespace=()=>({type:t.SET,set:p(),not:!1}),e.notWhitespace=()=>({type:t.SET,set:p(),not:!0}),e.anyChar=()=>({type:t.SET,set:f(),not:!0})}}),Di=je({"node_modules/ret/lib/util.js"(e){var t=U(),i=ti(),c="@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?",p={0:0,t:9,n:10,v:11,f:12,r:13};e.strToChars=function(f){var d=/(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z[\\\]^?])|([0tnvfr]))/g;return f=f.replace(d,function(O,$,T,F,E,B,W,oe){if(T)return O;var X=$?8:F?parseInt(F,16):E?parseInt(E,16):B?parseInt(B,8):W?c.indexOf(W):p[oe],ne=String.fromCharCode(X);return/[[\]{}^$.|?*+()]/.test(ne)&&(ne="\\"+ne),ne}),f},e.tokenizeClass=(f,d)=>{for(var O=[],$=/\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?([^])/g,T,F;(T=$.exec(f))!=null;)if(T[1])O.push(i.words());else if(T[2])O.push(i.ints());else if(T[3])O.push(i.whitespace());else if(T[4])O.push(i.notWords());else if(T[5])O.push(i.notInts());else if(T[6])O.push(i.notWhitespace());else if(T[7])O.push({type:t.RANGE,from:(T[8]||T[9]).charCodeAt(0),to:T[10].charCodeAt(0)});else if(F=T[12])O.push({type:t.CHAR,value:F.charCodeAt(0)});else return[O,$.lastIndex];e.error(d,"Unterminated character class")},e.error=(f,d)=>{throw new SyntaxError("Invalid regular expression: /"+f+"/: "+d)}}}),$i=je({"node_modules/ret/lib/positions.js"(e){var t=U();e.wordBoundary=()=>({type:t.POSITION,value:"b"}),e.nonWordBoundary=()=>({type:t.POSITION,value:"B"}),e.begin=()=>({type:t.POSITION,value:"^"}),e.end=()=>({type:t.POSITION,value:"$"})}}),Ui=je({"node_modules/ret/lib/index.js"(e,t){var i=Di(),c=U(),p=ti(),f=$i();t.exports=d=>{var O=0,$,T,F={type:c.ROOT,stack:[]},E=F,B=F.stack,W=[],oe=I=>{i.error(d,`Nothing to repeat at column ${I-1}`)},X=i.strToChars(d);for($=X.length;O<$;)switch(T=X[O++],T){case"\\":switch(T=X[O++],T){case"b":B.push(f.wordBoundary());break;case"B":B.push(f.nonWordBoundary());break;case"w":B.push(p.words());break;case"W":B.push(p.notWords());break;case"d":B.push(p.ints());break;case"D":B.push(p.notInts());break;case"s":B.push(p.whitespace());break;case"S":B.push(p.notWhitespace());break;default:/\d/.test(T)?B.push({type:c.REFERENCE,value:parseInt(T,10)}):B.push({type:c.CHAR,value:T.charCodeAt(0)})}break;case"^":B.push(f.begin());break;case"$":B.push(f.end());break;case"[":var ne;X[O]==="^"?(ne=!0,O++):ne=!1;var he=i.tokenizeClass(X.slice(O),d);O+=he[1],B.push({type:c.SET,set:he[0],not:ne});break;case".":B.push(p.anyChar());break;case"(":var ye={type:c.GROUP,stack:[],remember:!0};T=X[O],T==="?"&&(T=X[O+1],O+=2,T==="="?ye.followedBy=!0:T==="!"?ye.notFollowedBy=!0:T!==":"&&i.error(d,`Invalid group, character '${T}' after '?' at column ${O-1}`),ye.remember=!1),B.push(ye),W.push(E),E=ye,B=ye.stack;break;case")":W.length===0&&i.error(d,`Unmatched ) at column ${O-1}`),E=W.pop(),B=E.options?E.options[E.options.length-1]:E.stack;break;case"|":E.options||(E.options=[E.stack],delete E.stack);var j=[];E.options.push(j),B=j;break;case"{":var w=/^(\d+)(,(\d+)?)?\}/.exec(X.slice(O)),S,R;w!==null?(B.length===0&&oe(O),S=parseInt(w[1],10),R=w[2]?w[3]?parseInt(w[3],10):1/0:S,O+=w[0].length,B.push({type:c.REPETITION,min:S,max:R,value:B.pop()})):B.push({type:c.CHAR,value:123});break;case"?":B.length===0&&oe(O),B.push({type:c.REPETITION,min:0,max:1,value:B.pop()});break;case"+":B.length===0&&oe(O),B.push({type:c.REPETITION,min:1,max:1/0,value:B.pop()});break;case"*":B.length===0&&oe(O),B.push({type:c.REPETITION,min:0,max:1/0,value:B.pop()});break;default:B.push({type:c.CHAR,value:T.charCodeAt(0)})}return W.length!==0&&i.error(d,"Unterminated group"),F},t.exports.types=c}}),Fi=je({"node_modules/drange/lib/index.js"(e,t){"use strict";var i=class At{constructor(f,d){this.low=f,this.high=d,this.length=1+d-f}overlaps(f){return!(this.high<f.low||this.low>f.high)}touches(f){return!(this.high+1<f.low||this.low-1>f.high)}add(f){return new At(Math.min(this.low,f.low),Math.max(this.high,f.high))}subtract(f){return f.low<=this.low&&f.high>=this.high?[]:f.low>this.low&&f.high<this.high?[new At(this.low,f.low-1),new At(f.high+1,this.high)]:f.low<=this.low?[new At(f.high+1,this.high)]:[new At(this.low,f.low-1)]}toString(){return this.low==this.high?this.low.toString():this.low+"-"+this.high}},c=class Vt{constructor(f,d){this.ranges=[],this.length=0,f!=null&&this.add(f,d)}_update_length(){this.length=this.ranges.reduce((f,d)=>f+d.length,0)}add(f,d){var O=$=>{for(var T=0;T<this.ranges.length&&!$.touches(this.ranges[T]);)T++;for(var F=this.ranges.slice(0,T);T<this.ranges.length&&$.touches(this.ranges[T]);)$=$.add(this.ranges[T]),T++;F.push($),this.ranges=F.concat(this.ranges.slice(T)),this._update_length()};return f instanceof Vt?f.ranges.forEach(O):(d==null&&(d=f),O(new i(f,d))),this}subtract(f,d){var O=$=>{for(var T=0;T<this.ranges.length&&!$.overlaps(this.ranges[T]);)T++;for(var F=this.ranges.slice(0,T);T<this.ranges.length&&$.overlaps(this.ranges[T]);)F=F.concat(this.ranges[T].subtract($)),T++;this.ranges=F.concat(this.ranges.slice(T)),this._update_length()};return f instanceof Vt?f.ranges.forEach(O):(d==null&&(d=f),O(new i(f,d))),this}intersect(f,d){var O=[],$=T=>{for(var F=0;F<this.ranges.length&&!T.overlaps(this.ranges[F]);)F++;for(;F<this.ranges.length&&T.overlaps(this.ranges[F]);){var E=Math.max(this.ranges[F].low,T.low),B=Math.min(this.ranges[F].high,T.high);O.push(new i(E,B)),F++}};return f instanceof Vt?f.ranges.forEach($):(d==null&&(d=f),$(new i(f,d))),this.ranges=O,this._update_length(),this}index(f){for(var d=0;d<this.ranges.length&&this.ranges[d].length<=f;)f-=this.ranges[d].length,d++;return this.ranges[d].low+f}toString(){return"[ "+this.ranges.join(", ")+" ]"}clone(){return new Vt(this)}numbers(){return this.ranges.reduce((f,d)=>{for(var O=d.low;O<=d.high;)f.push(O),O++;return f},[])}subranges(){return this.ranges.map(f=>({low:f.low,high:f.high,length:1+f.high-f.low}))}};t.exports=c}}),ji=je({"node_modules/randexp/lib/randexp.js"(e,t){var i=Ui(),c=Fi(),p=i.types;t.exports=class qt{constructor(d,O){if(this._setDefaults(d),d instanceof RegExp)this.ignoreCase=d.ignoreCase,this.multiline=d.multiline,d=d.source;else if(typeof d=="string")this.ignoreCase=O&&O.indexOf("i")!==-1,this.multiline=O&&O.indexOf("m")!==-1;else throw new Error("Expected a regexp or string");this.tokens=i(d)}_setDefaults(d){this.max=d.max!=null?d.max:qt.prototype.max!=null?qt.prototype.max:100,this.defaultRange=d.defaultRange?d.defaultRange:this.defaultRange.clone(),d.randInt&&(this.randInt=d.randInt)}gen(){return this._gen(this.tokens,[])}_gen(d,O){var $,T,F,E,B;switch(d.type){case p.ROOT:case p.GROUP:if(d.followedBy||d.notFollowedBy)return"";for(d.remember&&d.groupNumber===void 0&&(d.groupNumber=O.push(null)-1),$=d.options?this._randSelect(d.options):d.stack,T="",E=0,B=$.length;E<B;E++)T+=this._gen($[E],O);return d.remember&&(O[d.groupNumber]=T),T;case p.POSITION:return"";case p.SET:var W=this._expand(d);return W.length?String.fromCharCode(this._randSelect(W)):"";case p.REPETITION:for(F=this.randInt(d.min,d.max===1/0?d.min+this.max:d.max),T="",E=0;E<F;E++)T+=this._gen(d.value,O);return T;case p.REFERENCE:return O[d.value-1]||"";case p.CHAR:var oe=this.ignoreCase&&this._randBool()?this._toOtherCase(d.value):d.value;return String.fromCharCode(oe)}}_toOtherCase(d){return d+(97<=d&&d<=122?-32:65<=d&&d<=90?32:0)}_randBool(){return!this.randInt(0,1)}_randSelect(d){return d instanceof c?d.index(this.randInt(0,d.length-1)):d[this.randInt(0,d.length-1)]}_expand(d){if(d.type===i.types.CHAR)return new c(d.value);if(d.type===i.types.RANGE)return new c(d.from,d.to);{let O=new c;for(let $=0;$<d.set.length;$++){let T=this._expand(d.set[$]);if(O.add(T),this.ignoreCase)for(let F=0;F<T.length;F++){let E=T.index(F),B=this._toOtherCase(E);E!==B&&O.add(B)}}return d.not?this.defaultRange.clone().subtract(O):this.defaultRange.clone().intersect(O)}}randInt(d,O){return d+Math.floor(Math.random()*(1+O-d))}get defaultRange(){return this._range=this._range||new c(32,126)}set defaultRange(d){this._range=d}static randexp(d,O){var $;return typeof d=="string"&&(d=new RegExp(d,O)),d._randexp===void 0?($=new qt(d,O),d._randexp=$):($=d._randexp,$._setDefaults(d)),$.gen()}static sugar(){RegExp.prototype.gen=function(){return qt.randexp(this)}}}}}),It=je({"node_modules/yaml/dist/PlainValue-ec8e588e.js"(e){"use strict";var t={ANCHOR:"&",COMMENT:"#",TAG:"!",DIRECTIVES_END:"-",DOCUMENT_END:"."},i={ALIAS:"ALIAS",BLANK_LINE:"BLANK_LINE",BLOCK_FOLDED:"BLOCK_FOLDED",BLOCK_LITERAL:"BLOCK_LITERAL",COMMENT:"COMMENT",DIRECTIVE:"DIRECTIVE",DOCUMENT:"DOCUMENT",FLOW_MAP:"FLOW_MAP",FLOW_SEQ:"FLOW_SEQ",MAP:"MAP",MAP_KEY:"MAP_KEY",MAP_VALUE:"MAP_VALUE",PLAIN:"PLAIN",QUOTE_DOUBLE:"QUOTE_DOUBLE",QUOTE_SINGLE:"QUOTE_SINGLE",SEQ:"SEQ",SEQ_ITEM:"SEQ_ITEM"},c="tag:yaml.org,2002:",p={MAP:"tag:yaml.org,2002:map",SEQ:"tag:yaml.org,2002:seq",STR:"tag:yaml.org,2002:str"};function f(j){let w=[0],S=j.indexOf(` `);for(;S!==-1;)S+=1,w.push(S),S=j.indexOf(` `,S);return w}function d(j){let w,S;return typeof j=="string"?(w=f(j),S=j):(Array.isArray(j)&&(j=j[0]),j&&j.context&&(j.lineStarts||(j.lineStarts=f(j.context.src)),w=j.lineStarts,S=j.context.src)),{lineStarts:w,src:S}}function O(j,w){if(typeof j!="number"||j<0)return null;let{lineStarts:S,src:R}=d(w);if(!S||!R||j>R.length)return null;for(let L=0;L<S.length;++L){let _=S[L];if(j<_)return{line:L,col:j-S[L-1]+1};if(j===_)return{line:L+1,col:1}}let I=S.length;return{line:I,col:j-S[I-1]+1}}function $(j,w){let{lineStarts:S,src:R}=d(w);if(!S||!(j>=1)||j>S.length)return null;let I=S[j-1],L=S[j];for(;L&&L>I&&R[L-1]===` `;)--L;return R.slice(I,L)}function T({start:j,end:w},S,R=80){let I=$(j.line,S);if(!I)return null;let{col:L}=j;if(I.length>R)if(L<=R-10)I=I.substr(0,R-1)+"\u2026";else{let J=Math.round(R/2);I.length>L+J&&(I=I.substr(0,L+J-1)+"\u2026"),L-=I.length-R,I="\u2026"+I.substr(1-R)}let _=1,N="";w&&(w.line===j.line&&L+(w.col-j.col)<=R+1?_=w.col-j.col:(_=Math.min(I.length+1,R)-L,N="\u2026"));let k=L>1?" ".repeat(L-1):"",V="^".repeat(_);return`${I} ${k}${V}${N}`}var F=class Wr{static copy(w){return new Wr(w.