UNPKG

@novu/framework

Version:

The Code-First Notifications Workflow SDK.

32 lines (31 loc) 222 kB
"use strict";var Do=Object.create;var Kt=Object.defineProperty;var Uo=Object.getOwnPropertyDescriptor;var Fo=Object.getOwnPropertyNames;var $o=Object.getPrototypeOf,jo=Object.prototype.hasOwnProperty;var Yo=(f,n)=>{for(var s in n)Kt(f,s,{get:n[s],enumerable:!0})},Or=(f,n,s,l)=>{if(n&&typeof n=="object"||typeof n=="function")for(let S of Fo(n))!jo.call(f,S)&&S!==s&&Kt(f,S,{get:()=>n[S],enumerable:!(l=Uo(n,S))||l.enumerable});return f};var tt=(f,n,s)=>(s=f!=null?Do($o(f)):{},Or(n||!f||!f.__esModule?Kt(s,"default",{value:f,enumerable:!0}):s,f)),Wo=f=>Or(Kt({},"__esModule",{value:!0}),f);var qa={};Yo(qa,{Client:()=>St,CronExpression:()=>pi,NovuRequestHandler:()=>bt,SeverityLevelEnum:()=>$n,frameworkName:()=>Es,providerSchemas:()=>Ln,serve:()=>Va,workflow:()=>vs});module.exports=Wo(qa);var Ge=require("h3");var Kr=require("jsonrepair");var xt=(l=>(l.TRIGGER="trigger",l.EXECUTE="execute",l.PREVIEW="preview",l))(xt||{}),Ht=(l=>(l.DISCOVER="discover",l.HEALTH_CHECK="health-check",l.CODE="code",l))(Ht||{});var pi=(F=>(F.EVERY_SECOND="* * * * * *",F.EVERY_5_SECONDS="*/5 * * * * *",F.EVERY_10_SECONDS="*/10 * * * * *",F.EVERY_30_SECONDS="*/30 * * * * *",F.EVERY_MINUTE="*/1 * * * *",F.EVERY_5_MINUTES="0 */5 * * * *",F.EVERY_10_MINUTES="0 */10 * * * *",F.EVERY_30_MINUTES="0 */30 * * * *",F.EVERY_HOUR="0 0-23/1 * * *",F.EVERY_2_HOURS="0 0-23/2 * * *",F.EVERY_3_HOURS="0 0-23/3 * * *",F.EVERY_4_HOURS="0 0-23/4 * * *",F.EVERY_5_HOURS="0 0-23/5 * * *",F.EVERY_6_HOURS="0 0-23/6 * * *",F.EVERY_7_HOURS="0 0-23/7 * * *",F.EVERY_8_HOURS="0 0-23/8 * * *",F.EVERY_9_HOURS="0 0-23/9 * * *",F.EVERY_10_HOURS="0 0-23/10 * * *",F.EVERY_11_HOURS="0 0-23/11 * * *",F.EVERY_12_HOURS="0 0-23/12 * * *",F.EVERY_DAY_AT_1AM="0 01 * * *",F.EVERY_DAY_AT_2AM="0 02 * * *",F.EVERY_DAY_AT_3AM="0 03 * * *",F.EVERY_DAY_AT_4AM="0 04 * * *",F.EVERY_DAY_AT_5AM="0 05 * * *",F.EVERY_DAY_AT_6AM="0 06 * * *",F.EVERY_DAY_AT_7AM="0 07 * * *",F.EVERY_DAY_AT_8AM="0 08 * * *",F.EVERY_DAY_AT_9AM="0 09 * * *",F.EVERY_DAY_AT_10AM="0 10 * * *",F.EVERY_DAY_AT_11AM="0 11 * * *",F.EVERY_DAY_AT_NOON="0 12 * * *",F.EVERY_DAY_AT_1PM="0 13 * * *",F.EVERY_DAY_AT_2PM="0 14 * * *",F.EVERY_DAY_AT_3PM="0 15 * * *",F.EVERY_DAY_AT_4PM="0 16 * * *",F.EVERY_DAY_AT_5PM="0 17 * * *",F.EVERY_DAY_AT_6PM="0 18 * * *",F.EVERY_DAY_AT_7PM="0 19 * * *",F.EVERY_DAY_AT_8PM="0 20 * * *",F.EVERY_DAY_AT_9PM="0 21 * * *",F.EVERY_DAY_AT_10PM="0 22 * * *",F.EVERY_DAY_AT_11PM="0 23 * * *",F.EVERY_DAY_AT_MIDNIGHT="0 0 * * *",F.EVERY_WEEK="0 0 * * 0",F.EVERY_WEEKDAY="0 0 * * 1-5",F.EVERY_WEEKEND="0 0 * * 6,0",F.EVERY_1ST_DAY_OF_MONTH_AT_MIDNIGHT="0 0 1 * *",F.EVERY_1ST_DAY_OF_MONTH_AT_NOON="0 12 1 * *",F.EVERY_2ND_HOUR="0 */2 * * *",F.EVERY_2ND_HOUR_FROM_1AM_THROUGH_11PM="0 1-23/2 * * *",F.EVERY_2ND_MONTH="0 0 1 */2 *",F.EVERY_QUARTER="0 0 1 */3 *",F.EVERY_6_MONTHS="0 0 1 */6 *",F.EVERY_YEAR="0 0 1 0 *",F.EVERY_30_MINUTES_BETWEEN_9AM_AND_5PM="0 */30 9-17 * * *",F.EVERY_30_MINUTES_BETWEEN_9AM_AND_6PM="0 */30 9-18 * * *",F.EVERY_30_MINUTES_BETWEEN_10AM_AND_7PM="0 */30 10-19 * * *",F.MONDAY_TO_FRIDAY_AT_1AM="0 0 01 * * 1-5",F.MONDAY_TO_FRIDAY_AT_2AM="0 0 02 * * 1-5",F.MONDAY_TO_FRIDAY_AT_3AM="0 0 03 * * 1-5",F.MONDAY_TO_FRIDAY_AT_4AM="0 0 04 * * 1-5",F.MONDAY_TO_FRIDAY_AT_5AM="0 0 05 * * 1-5",F.MONDAY_TO_FRIDAY_AT_6AM="0 0 06 * * 1-5",F.MONDAY_TO_FRIDAY_AT_7AM="0 0 07 * * 1-5",F.MONDAY_TO_FRIDAY_AT_8AM="0 0 08 * * 1-5",F.MONDAY_TO_FRIDAY_AT_9AM="0 0 09 * * 1-5",F.MONDAY_TO_FRIDAY_AT_09_30AM="0 30 09 * * 1-5",F.MONDAY_TO_FRIDAY_AT_10AM="0 0 10 * * 1-5",F.MONDAY_TO_FRIDAY_AT_11AM="0 0 11 * * 1-5",F.MONDAY_TO_FRIDAY_AT_11_30AM="0 30 11 * * 1-5",F.MONDAY_TO_FRIDAY_AT_12PM="0 0 12 * * 1-5",F.MONDAY_TO_FRIDAY_AT_1PM="0 0 13 * * 1-5",F.MONDAY_TO_FRIDAY_AT_2PM="0 0 14 * * 1-5",F.MONDAY_TO_FRIDAY_AT_3PM="0 0 15 * * 1-5",F.MONDAY_TO_FRIDAY_AT_4PM="0 0 16 * * 1-5",F.MONDAY_TO_FRIDAY_AT_5PM="0 0 17 * * 1-5",F.MONDAY_TO_FRIDAY_AT_6PM="0 0 18 * * 1-5",F.MONDAY_TO_FRIDAY_AT_7PM="0 0 19 * * 1-5",F.MONDAY_TO_FRIDAY_AT_8PM="0 0 20 * * 1-5",F.MONDAY_TO_FRIDAY_AT_9PM="0 0 21 * * 1-5",F.MONDAY_TO_FRIDAY_AT_10PM="0 0 22 * * 1-5",F.MONDAY_TO_FRIDAY_AT_11PM="0 0 23 * * 1-5",F))(pi||{});var We=(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))(We||{});var zt=(l=>(l.POST="POST",l.GET="GET",l.OPTIONS="OPTIONS",l))(zt||{});var Vo=f=>{var s,l;if(typeof f!="object"||f===null)return!1;let n=Object.getPrototypeOf(f);return(l=(s=n==null?void 0:n.constructor)==null?void 0:s.name.endsWith("Error"))!=null?l:!1},nt=class extends Error{},Xt=class extends nt{constructor(){super(...arguments);this.statusCode=404}},Ue=class extends nt{constructor(){super(...arguments);this.statusCode=400}},ot=class extends nt{constructor(){super(...arguments);this.statusCode=401}},at=class extends nt{constructor(n,{cause:s}={}){var l;Vo(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})}},Qt=class extends nt{constructor(){super(...arguments);this.statusCode=409}};var yt=class extends at{constructor(s){super("Unknown BridgeError",{cause:s});this.statusCode=500;this.code="BridgeError"}};var Zt=class extends Ue{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}}},Nt=class extends Ue{constructor(s,l){super(`Workflow with id: \`${s}\` has invalid \`payload\`. Please provide the correct event payload.`);this.code="ExecutionEventPayloadInvalidError";this.data=l}},en=class extends Ue{constructor(s,l){super(`Workflow with id: \`${s}\` has invalid \`controls\`. Please provide the correct event controls.`);this.code="ExecutionEventControlInvalidError";this.data=l}},tn=class extends Ue{constructor(s,l,S){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=S}},nn=class extends Ue{constructor(s,l,S){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=S}},rn=class extends Ue{constructor(s,l,S){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=S}},sn=class extends Ue{constructor(s,l,S){super(`Workflow with id: \`${s}\` has invalid controls syntax in step with id: \`${l}\`. Please correct step control syntax.`);this.code="StepControlCompilationFailedError";this.data=S}},on=class extends Ue{constructor(s,l,S,U){super(`Workflow with id: \`${s}\` has an invalid state. Step with id: \`${l}\` and provider with id: \`${S}\` has invalid output. Please provide the correct provider output.`);this.code="ExecutionProviderOutputInvalidError";this.data=U}},an=class extends Ue{constructor(s,l){super(`Workflow with id: \`${s}\` has invalid \`payload\`. Please provide the correct payload.`);this.code="WorkflowPayloadInvalidError";this.data=l}};var ct=f=>Object.values(We).includes(f==null?void 0:f.code),Ar=f=>!ct(f)&&typeof f.statusCode=="number"&&f.statusCode>=400&&f.statusCode<500;var ui=f=>Object.values(f).map(n=>`\`${n}\``).join(", "),ln=f=>f.replaceAll(/(\w)(\w*)/g,(n,s,l)=>s.toUpperCase()+l.toLowerCase()).replaceAll(/[\s-]+/g,"");var cn=class extends nt{constructor(){super(...arguments);this.code="MethodNotAllowedError";this.statusCode=405;this.message=`Method not allowed. Please use one of ${ui(zt)}`}},kt=class extends Ue{constructor(s,l){super(`Invalid query string: \`action\`=\`${s}\`. Please use one of ${ui(l)}`);this.code="InvalidActionError"}},pn=class extends Ue{constructor(){super("Missing secret key. Set the `NOVU_SECRET_KEY` environment variable or pass `secretKey` to the client options.");this.code="MissingSecretKeyError"}};var un=class extends Error{constructor(n,s,l){super(),this.data={message:l},this.statusCode=n,this.code=s}};var Ct=class extends Qt{constructor(n,s){super(`${ln(n)} with id: \`${s}\` already exists. Please use a different id.`)}},lt=class extends Xt{constructor(n,s){super(`${ln(n)} with id: \`${s}\` does not exist. Please provide a valid id.`)}},gt=class extends at{constructor(s,l,S,U){super(`Failed to ${S} ${ln(s)} with id: \`${l}\``,{cause:U});this.statusCode=502}};var dn=class extends lt{constructor(s){super("provider",s);this.code="ProviderNotFoundError"}},fn=class extends gt{constructor(s,l,S){super("provider",s,l,S);this.code="ProviderExecutionFailedError"}};var hn=class extends ot{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"}},mn=class extends ot{constructor(){super("Signature not found. Please provide a signature in the `novu-signature` header");this.code="SignatureNotFoundError"}},yn=class extends ot{constructor(){super("Signature is invalid. Please provide a valid signature in the `novu-signature` header");this.code="SignatureInvalidError"}},gn=class extends ot{constructor(){super(`Signature expired. Please provide a signature with a timestamp no older than ${5} minutes in the \`novu-signature\` header`);this.code="SignatureExpiredError"}},wn=class extends ot{constructor(){super("Signature key not found. Please provide a valid key in the Client constructor `config.secretKey`");this.code="SigningKeyNotFoundError"}};var Sn=class extends lt{constructor(s){super("step",s);this.code="StepNotFoundError"}},bn=class extends Ct{constructor(s){super("step",s);this.code="StepAlreadyExistsError"}},Mt=class extends gt{constructor(s,l,S){super("step",s,l,S);this.code="StepExecutionFailedError"}};var Lt=class extends lt{constructor(s){super("workflow",s);this.code="WorkflowNotFoundError"}};var Tn=(()=>{var f=Object.defineProperty,n=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,l=Object.prototype.hasOwnProperty,S=(e,t)=>function(){return e&&(t=(0,e[s(e)[0]])(e=0)),t},U=(e,t)=>function(){return t||(0,e[s(e)[0]])((t={exports:{}}).exports,t),t.exports},C=(e,t)=>{for(var i in t)f(e,i,{get:t[i],enumerable:!0})},z=(e,t,i,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let p of s(t))!l.call(e,p)&&p!==i&&f(e,p,{get:()=>t[p],enumerable:!(c=n(t,p))||c.enumerable});return e},ie=e=>z(f({},"__esModule",{value:!0}),e),Se={};C(Se,{JSONSchemaFaker:()=>br,default:()=>Tr,setDependencies:()=>Li});function Ie(e,t){return typeof e=="string"?typeof t!="undefined"?vt.register(e,t):vt.get(e):vt.registerMany(e)}function Ne(e,t){return e=typeof e=="undefined"?ze.MIN_INTEGER:e,t=typeof t=="undefined"?ze.MAX_INTEGER:t,Math.floor(te("random")()*(t-e+1))+e}function be(e){return Yt.default.prototype.max=te("defaultRandExpMax"),Yt.default.prototype.randInt=(i,c)=>i+Math.floor(te("random")()*(1+(c-i))),new Yt.default(e).gen()}function ke(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 rt(e,t){return te("random")()*(t-e)+e}function Ke(e,t,i,c,p=!1){return i=typeof i=="undefined"?ze.MIN_NUMBER:i,c=typeof c=="undefined"?ze.MAX_NUMBER:c,e=typeof e=="undefined"?i:e,t=typeof t=="undefined"?c:t,t<e&&(t+=e),p?rt(e,t):Ne(e,t)}function Ft(e){switch(e){case"seconds":return Ke(0,60)*60;case"minutes":return Ke(15,50)*612;case"hours":return Ke(12,72)*36123;case"days":return Ke(7,30)*86412345;case"weeks":return Ke(4,52)*604812345;case"months":return Ke(2,13)*2592012345;case"years":return Ke(1,20)*31104012345;default:break}}function Yn(e){if(e)return Ft(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(rt(t.getTime(),i.getTime()))}function mi(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 h=c.shift();if(!p[h])throw new Error(`Prop not found: ${h} (${t})`);p=p[h]}return p}function $t(e){return typeof e=="string"&&Bi.test(e)}function He(e){return["number","boolean"].includes(typeof e)}function qe(e,...t){return t.filter(i=>typeof e[i]!="undefined").length>0}function yi(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 _s(e){if(e.includes(" "))return new Date(e).toISOString().substr(0,10);let[t,i]=e.split("T"),[c,p,h]=t.split("-"),[d,O,D]=i.substr(0,8).split(":");return p=`0${Math.max(1,Math.min(12,p))}`.slice(-2),h=`0${Math.max(1,Math.min(31,h))}`.slice(-2),d=`0${Math.max(1,Math.min(23,d))}`.slice(-2),O=`0${Math.max(1,Math.min(59,O))}`.slice(-2),D=`0${Math.max(1,Math.min(59,D))}`.slice(-2),`${c}-${p}-${h}T${d}:${O}:${D}.000Z`}function Rs(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 h=Math.max(c.minimum||0,0),d=Math.min(c.maximum||1/0,1/0);t.exclusiveMinimum&&h===t.minimum&&(h+=t.multipleOf||1),t.exclusiveMaximum&&d===t.maximum&&(d-=t.multipleOf||1),(h||d!==1/0)&&(t.enum=t.enum.filter(O=>O>=h&&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=$t(p)?parseFloat(p):p;break;case"integer":p=$t(p)?parseInt(p,10):p;break;case"boolean":p=!!p;break;case"string":{if(He(p))return p;p=String(p);let h=Math.max(c.minLength||0,0),d=Math.min(c.maxLength||1/0,1/0),O,D=0;for(;p.length<h;)if(O=p,t.pattern?p+=Z.randexp(t.pattern):p+=`${Z.pick([" ","/","_","-","+","=","@","^"])}${p}`,p===O){if(D+=1,D===3)break}else D=0;switch(p.length>d&&(p=p.substr(0,d)),t.format){case"date-time":case"datetime":p=new Date(_s(p)).toISOString().replace(/([0-9])0+Z$/,"$1Z");break;case"full-date":case"date":p=new Date(yi(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 ft(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]=ft(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]=ft({},t[i]):e[i]=ft(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 Ps(e){let t=JSON.stringify(e),i=JSON.stringify(e,null,2);return t.length>400?`${i.substr(0,400)}...`:i}function gi(){return Z.pick([!1,!0,null,-1,NaN,Math.PI,1/0,void 0,[],{},Math.random(),Math.random().toString(36).substr(2)])}function xs(e,t){if(e.enum)return e.enum.includes(t);if(e.const)return e.const===t}function Is(e,t){let i=ft({},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(ze.SCALAR_TYPES.filter(c=>(Array.isArray(e.type)?e.type:[e.type]).every(h=>c==="number"||c==="integer"?h!=="number"&&h!=="integer":c!==h)));else if(e.enum){let c;do c=gi();while(e.enum.indexOf(c)!==-1);i.enum=[c]}return e.required&&i.properties&&e.required.forEach(c=>{delete i.properties[c]}),i}function Wn(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 Ns(e,t){return!t.every(i=>Wn(e,i))}function ks(e,t){return t.reduce((c,p)=>c+(Wn(e,p)?1:0),0)===1}function Cs(e){return["enum","const","default","examples","required","definitions","items","properties"].includes(e)}function Ms(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?ft({},e[c]):e[c],i),{})}function wi(e,t){return Array.isArray(e)?e.map(i=>wi(i,t)):(typeof e=="string"&&(e=e.replace(/#\{([\w.-]+)\}/g,(i,c)=>t[c])),e)}function Vn(e){return Object.prototype.toString.call(e)==="[object Object]"&&!Object.keys(e).length}function Si(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 qn(e,t,i=!1){if(!e||typeof e!="object")return e;if(Array.isArray(e))return e.map(c=>qn(c,t,!0)).filter(c=>typeof c!="undefined");if(Object.keys(e).forEach(c=>{if(Vn(e[c]))Si(c,t)&&delete e[c];else{let p=t;t&&t.properties&&t.properties[c]&&(p=t.properties[c]);let h=qn(e[c],p);Vn(h)||(e[c]=h)}typeof e[c]=="undefined"&&delete e[c]}),!(!Object.keys(e).length&&i))return e}function Ls(e){return(t,i,c,p)=>{let h=t,d=[];typeof t=="object"&&(h=Object.keys(t)[0],Array.isArray(t[h])?d=t[h]:d.push(t[h]));let O=h.split("."),D=e();for(;O.length>1;)D=D[O.shift()];return t=typeof D=="object"?D[O[0]]:D,typeof t=="function"&&(t=t.apply(D,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}: ${h}', given: ${t}`)}),t}}function Ds(e,t){if(typeof e=="undefined")return mt.list();if(typeof e=="string")if(typeof t=="function")mt.register(e,t);else if(t===null||t===!1)mt.unregister(e);else return mt.get(e);else mt.registerMany(e)}function Us(e,t,i){return Object.keys(e).filter(c=>{let p=Hi.indexOf(t)>-1;return i.indexOf(c)>-1&&!p}).length>0}function Fs(e,t){let i=Object.keys(Et);for(let c=0;c<i.length;c+=1){let p=i[c],h=t[t.length-1];if(Us(e,h,Et[p]))return p}}function $s(){return te("random")()>.5}function js(){return null}function Ys(e,t,i,c,p,h){let d=[],O=[];function D($){let E=JSON.stringify($.value);return O.indexOf(E)===-1?(O.push(E),d.push($),!0):!1}t.forEach(D);let T=100;for(;d.length!==t.length&&(D(h(i.items||c,e,p))||(T-=1),!!T););return d}function Ws(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 Wt(`missing items for ${de.short(e)}`,t);return p}if(Array.isArray(e.items))return e.items.map((W,ae)=>{let Q=t.concat(["items",ae]);return c(W,Q,i)});let h=e.minItems,d=e.maxItems,O=te("minItems"),D=te("maxItems");O&&(h=typeof h=="undefined"?O:Math.min(O,h)),D&&(d=typeof d=="undefined"?D:Math.min(D,d),d&&d>D&&(d=D),h&&h>D&&(h=d));let T=te("alwaysFakeOptionals")===!0?1:te("optionalsProbability"),$=te("alwaysFakeOptionals")||te("fixedProbabilities")||!1,E=Z.number(h,d,1,5);T!==null&&(E=Math.max($?Math.round((d||E)*T):Math.abs(Z.number(h,d)*T),h||0));let J=typeof e.additionalItems=="object"?e.additionalItems:{};for(let W=p.length;W<E;W+=1){let ae=t.concat(["items",W]),Q=c(e.items||J,ae,i);p.push(Q)}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?Ys(t.concat(["items"]),p,e,J,i,c):p}function Vs(e){let t=typeof e.minimum=="undefined"||e.minimum===-Number.MAX_VALUE?ze.MIN_INTEGER:e.minimum,i=typeof e.maximum=="undefined"||e.maximum===Number.MAX_VALUE?ze.MAX_INTEGER:e.maximum,c=e.multipleOf,p=c&&String(c).match(/e-(\d)|\.(\d+)$/);if(p){let h=(Math.random()*Z.number(0,10)+1)*c,d=p[1]||p[2].length,O=parseFloat(h.toFixed(d)),D=Z.number(t,i-1);return String(O).includes(".")?D+O:(D+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 h=Z.number(Math.floor(t/c),Math.floor(i/c))*c;for(;h<t;)h+=c;return h}return Z.number(t,i,void 0,void 0,e.type!=="integer")}function qs(e){return Math.floor(si({...e}))}function Bs(e){return Z.shuffle(sr).slice(0,e)}function Js(e,t,i,c){let p={},h=e.properties||{},d=e.patternProperties||{},O=typeof e.required=="boolean"?[]:(e.required||[]).slice(),D=e.additionalProperties!==!1,T=Object.keys(h),$=Object.keys(d),E=T.concat($).reduce((Y,m)=>(O.indexOf(m)===-1&&Y.push(m),Y),[]),J=O.concat(E),W=D&&e.additionalProperties===!0?qt:e.additionalProperties;if(!D&&T.length===0&&$.length===0&&de.hasProperties(e,"minProperties","maxProperties","dependencies","required"))return null;if(te("requiredOnly")===!0)return O.forEach(Y=>{h[Y]&&(p[Y]=h[Y])}),c(p,t.concat(["properties"]),i,e);let ae=te("alwaysFakeOptionals")===!0?1:te("optionalsProbability"),Q=te("alwaysFakeOptionals")||te("fixedProbabilities")||!1,ne=te("ignoreProperties")||[],he=te("reuseProperties"),ye=te("fillProperties"),j=e.maxProperties||J.length+(D?Z.number(1,5):0),w=Math.max(e.minProperties||0,O.length),b=Math.max(0,J.length-w);J.length===1&&!O.length&&(w=Math.max(Z.number(ye?1:0,j),w)),ae!==null&&(Q===!0?b=Math.round(w-O.length+ae*(J.length-w)):b=Z.number(w-O.length,ae*(J.length-w)));let R=Z.shuffle(E).slice(0,b),x=E.filter(Y=>R.indexOf(Y)!==-1),M=ae!==null||O.length===j?j:Z.number(0,j),_=O.concat(Z.shuffle(x).slice(0,M)).slice(0,j),I=[],k=[];if(e.dependencies&&(Object.keys(e.dependencies).forEach(Y=>{let m=e.dependencies[Y];if(_.indexOf(Y)!==-1)if(Array.isArray(m))m.forEach(N=>{_.indexOf(N)===-1&&_.push(N)});else if(Array.isArray(m.oneOf||m.anyOf)){let N=m.oneOf||m.anyOf;k.push({prop:Y,values:N})}else I.push(m)}),I.length))return delete e.dependencies,c({allOf:I.concat(e)},t.concat(["properties"]),i,e);let V=[],G=[];_.forEach(Y=>{if(h[Y]&&["{}","true"].includes(JSON.stringify(h[Y].not)))return;for(let N=0;N<ne.length;N+=1)if(ne[N]instanceof RegExp&&ne[N].test(Y)||typeof ne[N]=="string"&&ne[N]===Y||typeof ne[N]=="function"&&ne[N](h[Y],Y)){V.push(Y);return}W===!1&&O.indexOf(Y)!==-1&&(p[Y]=h[Y]),h[Y]&&(p[Y]=h[Y]);let m;if($.forEach(N=>{Y.match(new RegExp(N))&&(m=!0,p[Y]?de.merge(p[Y],d[N]):p[Z.randexp(Y)]=d[N])}),!m){let N=d[Y]||W;N&&W!==!1?p[d[Y]?Z.randexp(Y):Y]=h[Y]||N:G.push(Y)}});let ee=Object.keys(p).length+(ye?0:V.length),Ae=Y=>Z.randexp(`_?[_a-f\\d]{1,3}${Y?"\\$?":""}`);function ve(Y){let m;do{if(!Y.length)break;m=Y.shift()}while(p[m]);return m}let _e=w;if(D&&!O.length&&(_e=Math.max(ae===null||W?Z.number(ye?1:0,j):0,w)),!x.length&&!b&&D&&Q===!0&&ye){let Y=Z.number(0,j);for(let m=0;m<Y;m+=1)p[Vt(1)+Ae(Y[m])]=W||qt}for(;ye&&!(!($.length||D)||ee>=_e);){if(D)if(he&&T.length-ee>_e){let Y=0,m;do{if(Y+=1,Y>1e3)break;m=ve(O)||Z.pick(T)}while(typeof p[m]!="undefined");typeof p[m]=="undefined"&&(p[m]=h[m],ee+=1)}else if($.length&&!W){let Y=Z.pick($),m=Z.randexp(Y);p[m]||(p[m]=d[Y],ee+=1)}else{let Y=ve(O)||Vt(1)+Ae();p[Y]||(p[Y]=W||qt,ee+=1)}for(let Y=0;ee<w&&Y<$.length;Y+=1){let m=$[Y],N=Z.randexp(m);p[N]||(p[N]=d[m],ee+=1)}}if(O.length===0&&(!D||ae===!1)){let Y=Z.number(w,j);for(;ee<Y;){let m=ve(T);m&&(p[m]=h[m]),ee+=1}}let Pe=p;if(te("sortProperties")!==null){let Y=Object.keys(h);Pe=Object.keys(p).sort((N,K)=>te("sortProperties")?N.localeCompare(K):Y.indexOf(N)-Y.indexOf(K)).reduce((N,K)=>(N[K]=p[K],N),{})}let Ce=c(Pe,t.concat(["properties"]),i,e);return k.forEach(Y=>{for(let m of Y.values)if(de.hasValue(m.properties[Y.prop],Ce.value[Y.prop])){Object.keys(m.properties).forEach(N=>{N!==Y.prop&&de.merge(Ce.value,c(m.properties,t.concat(["properties"]),i,e).value)});break}}),Ce}function bi(){let e=Z.number(1,5);return Vt(e).join(" ")}function Gs(e=0,t=140){let i=Math.max(0,e),c=Z.number(i,t),p=bi();for(;p.length<i;)p+=bi();return p.length>c&&(p=p.substr(0,c)),p}function Ks(){return[0,0,0,0].map(()=>Z.number(0,255)).join(".")}function Hs(){return Z.date().toISOString()}function zs(){return Bt().slice(0,10)}function Xs(){return Bt().slice(11)}function Qs(e){return Z.randexp(je[e]).replace(ur,(t,i)=>Z.randexp(je[i]))}function Zs(e,t){let i=ri(e.format);if(typeof i=="function")return i(e);switch(e.format){case"date-time":case"datetime":return Bt();case"date":return lr();case"time":return cr();case"ipv4":return ar();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 dr(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 eo(e){return de.typecast("string",e,i=>e.format?Zs(e,()=>oi(i.minLength,i.maxLength)):e.pattern?Z.randexp(e.pattern):oi(i.minLength,i.maxLength))}function to({$comment:e,title:t,description:i}){return Object.entries({comment:e,title:t,description:i}).filter(([,c])=>c).reduce((c,[p,h])=>(c[p]=h,c),{})}function ht(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={...to(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:$}=ht(e,t.concat(["not"]),i,c);return{value:de.clean(T,e,!1),context:{...p,items:$}}}if(typeof e.thunk=="function"){let{value:T,context:$}=ht(e.thunk(c),t,i);return{value:T,context:{...p,items:$}}}if(e.jsonPath)return{value:e,context:p};let h=e.type;if(Array.isArray(h)?h=Z.pick(h):typeof h=="undefined"&&(h=zi(e,t)||h,h&&(e.type=h)),typeof e.generate=="function"){let T=de.typecast(null,e,()=>e.generate(c,t)),$=T===null?"null":typeof T;if($===h||$==="number"&&h==="integer"||Array.isArray(T)&&h==="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 h=="string")if(_t[h])try{let T=_t[h](e,t,i,ht);return h==="array"?{value:T.map(({value:$})=>$),context:{...p,items:T.map(Array.isArray(e.items)?({context:$})=>$:({context:$})=>({...$,schemaPath:$.schemaPath.slice(0,-1)}))}}:h==="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 Wt(T.stack,t):T}else{if(te("failOnInvalidTypes"))throw new Wt(`unknown primitive ${de.short(h)}`,t.concat(["type"]));{let T=te("defaultInvalidTypeProduct");return typeof T=="string"&&_t[T]?{value:_t[T](e,t,i,ht),context:p}:{value:T,context:p}}}let d={},O={...p};Array.isArray(e)&&(d=[]);let D=te("pruneProperties")||[];return Object.keys(e).forEach(T=>{if(!D.includes(T)&&e[T]!==null)if(typeof e[T]=="object"&&T!=="definitions"){let{value:$,context:E}=ht(e[T],t.concat([T]),i,d);d[T]=de.clean($,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 no(e){return Array.isArray(e)?Z.pick(e):e}function io(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 Bn(e,t,i,c){if(!e||typeof e!="object")return e;if(i||(i={}),t||(t=e),Array.isArray(e))return e.map(p=>Bn(p,t,i,c));if(e.jsonPath){let{JSONPath:p}=Zn(),h=typeof e.jsonPath!="object"?{path:e.jsonPath}:e.jsonPath;h.group=e.group||h.group||c,h.cycle=e.cycle||h.cycle||!1,h.reverse=e.reverse||h.reverse||!1,h.count=e.count||h.count||1;let d=`${h.group}__${h.path}`;return i[d]||(h.count>1?i[d]=p(h.path,t).slice(0,h.count):i[d]=p(h.path,t)),h.cycle||h.reverse?io(i[d],h.reverse):no(i[d])}return Object.keys(e).forEach(p=>{e[p]=Bn(e[p],t,i,p)}),e}function ro(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,h=te("refDepthMax")||3;try{let{resolveSchema:d}=gr({refs:e,schema:t,container:i,synchronous:c,refDepthMin:p,refDepthMax:h}),O=mr(de.clone(t),[],d);return te("resolveJsonPath")?{value:Bn(O.value),context:O.context}:O}catch(d){throw d.path?new Error(`${d.message} in /${d.path.join("/")}`):d}}function so(e){return e.value}function oo(e,t){return t.reduce((i,c)=>c in i?i[c]:{},e)}function Jn(e,t,i,c=i){let{title:p,description:h,comment:d}=oo(e,t),O=[];te("renderTitle")&&p&&O.push(` ${p}`,""),te("renderDescription")&&h&&O.push(` ${h}`),te("renderComment")&&d&&O.push(` ${d}`),i.commentBefore=O.join(` `),c instanceof wr?c.items.forEach(D=>{Jn(e,[...t,"items",D.key.value],D.key,D.value)}):c instanceof Sr&&c.items.forEach((D,T)=>{Jn(e,[...t,"items",T],D)})}function ao({value:e,context:t}){let i=Rt.createNode(e);Jn(t,[],i);let c=new Rt.Document;return c.contents=i,c.toString()}function Ti(){Qe.define("autoIncrement",function(t,i){if(!this.offset){let c=i.minimum||1,p=c+ze.MAX_NUMBER,h=t.initialOffset||i.initialOffset;this.offset=h||Z.number(c,p)}return t?this.offset++:i}),Qe.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 Oi(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 h=p.$id||p.id;typeof h=="string"&&!i[h]&&(i[h]=p),Object.keys(p).forEach(d=>{c(p[d])})}return c(e),c(t),i}var Ai,Gn,vi,Kn,Ei,_i,$e,Ri,Hn,F,zn,Pi,xi,Ii,Ni,ki,At,jt,Xn,Ci,Mi,Qn,Zn,Li,Di,ei,ue,ti,Ui,Fi,vt,te,ni,ii,$i,ji,Yi,Wi,Vi,qi,ze,Yt,Z,Bi,de,Ji,Gi,mt,ri,Ki,Wt,Et,Hi,zi,Xi,Qi,Zi,er,tr,nr,ir,si,rr,sr,Vt,qt,or,oi,ar,Bt,lr,cr,ai,Jt,pr,je,ur,dr,fr,hr,_t,mr,yr,gr,li,ci,Le,lo,co,po,uo,fo,ho,mo,yo,go,wo,So,bo,wr,Sr,Rt,Qe,Oe,br,Tr,To=S({"src/shared.js"(){Ai=Object.create,Gn=Object.defineProperty,vi=Object.getOwnPropertyDescriptor,Kn=Object.getOwnPropertyNames,Ei=Object.getPrototypeOf,_i=Object.prototype.hasOwnProperty,$e=(e,t)=>function(){return t||(0,e[Kn(e)[0]])((t={exports:{}}).exports,t),t.exports},Ri=(e,t,i,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let p of Kn(t))!_i.call(e,p)&&p!==i&&Gn(e,p,{get:()=>t[p],enumerable:!(c=vi(t,p))||c.enumerable});return e},Hn=(e,t,i)=>(i=e!=null?Ai(Ei(e)):{},Ri(t||!e||!e.__esModule?Gn(i,"default",{value:e,enumerable:!0}):i,e)),F=$e({"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}}}),zn=$e({"node_modules/ret/lib/sets.js"(e){var t=F(),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}],h=()=>[{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:h(),not:!0})}}),Pi=$e({"node_modules/ret/lib/util.js"(e){var t=F(),i=zn(),c="@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^ ?",p={0:0,t:9,n:10,v:11,f:12,r:13};e.strToChars=h=>{var d=/(\[\\b\])|(\\)?\\(?:u([A-F0-9]{4})|x([A-F0-9]{2})|(0?[0-7]{2})|c([@A-Z[\\\]^?])|([0tnvfr]))/g;return h=h.replace(d,(O,D,T,$,E,J,W,ae)=>{if(T)return O;var Q=D?8:$?parseInt($,16):E?parseInt(E,16):J?parseInt(J,8):W?c.indexOf(W):p[ae],ne=String.fromCharCode(Q);return/[[\]{}^$.|?*+()]/.test(ne)&&(ne="\\"+ne),ne}),h},e.tokenizeClass=(h,d)=>{for(var O=[],D=/\\(?:(w)|(d)|(s)|(W)|(D)|(S))|((?:(?:\\)(.)|([^\]\\]))-(?:\\)?([^\]]))|(\])|(?:\\)?([^])/g,T,$;(T=D.exec(h))!=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($=T[12])O.push({type:t.CHAR,value:$.charCodeAt(0)});else return[O,D.lastIndex];e.error(d,"Unterminated character class")},e.error=(h,d)=>{throw new SyntaxError("Invalid regular expression: /"+h+"/: "+d)}}}),xi=$e({"node_modules/ret/lib/positions.js"(e){var t=F();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:"$"})}}),Ii=$e({"node_modules/ret/lib/index.js"(e,t){var i=Pi(),c=F(),p=zn(),h=xi();t.exports=d=>{var O=0,D,T,$={type:c.ROOT,stack:[]},E=$,J=$.stack,W=[],ae=x=>{i.error(d,`Nothing to repeat at column ${x-1}`)},Q=i.strToChars(d);for(D=Q.length;O<D;)switch(T=Q[O++],T){case"\\":switch(T=Q[O++],T){case"b":J.push(h.wordBoundary());break;case"B":J.push(h.nonWordBoundary());break;case"w":J.push(p.words());break;case"W":J.push(p.notWords());break;case"d":J.push(p.ints());break;case"D":J.push(p.notInts());break;case"s":J.push(p.whitespace());break;case"S":J.push(p.notWhitespace());break;default:/\d/.test(T)?J.push({type:c.REFERENCE,value:parseInt(T,10)}):J.push({type:c.CHAR,value:T.charCodeAt(0)})}break;case"^":J.push(h.begin());break;case"$":J.push(h.end());break;case"[":{var ne;Q[O]==="^"?(ne=!0,O++):ne=!1;var he=i.tokenizeClass(Q.slice(O),d);O+=he[1],J.push({type:c.SET,set:he[0],not:ne});break}case".":J.push(p.anyChar());break;case"(":{var ye={type:c.GROUP,stack:[],remember:!0};T=Q[O],T==="?"&&(T=Q[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),J.push(ye),W.push(E),E=ye,J=ye.stack;break}case")":W.length===0&&i.error(d,`Unmatched ) at column ${O-1}`),E=W.pop(),J=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),J=j;break}case"{":{var w=/^(\d+)(,(\d+)?)?\}/.exec(Q.slice(O)),b,R;w!==null?(J.length===0&&ae(O),b=parseInt(w[1],10),R=w[2]?w[3]?parseInt(w[3],10):1/0:b,O+=w[0].length,J.push({type:c.REPETITION,min:b,max:R,value:J.pop()})):J.push({type:c.CHAR,value:123});break}case"?":J.length===0&&ae(O),J.push({type:c.REPETITION,min:0,max:1,value:J.pop()});break;case"+":J.length===0&&ae(O),J.push({type:c.REPETITION,min:1,max:1/0,value:J.pop()});break;case"*":J.length===0&&ae(O),J.push({type:c.REPETITION,min:0,max:1/0,value:J.pop()});break;default:J.push({type:c.CHAR,value:T.charCodeAt(0)})}return W.length!==0&&i.error(d,"Unterminated group"),$},t.exports.types=c}}),Ni=$e({"node_modules/drange/lib/index.js"(e,t){var i=class wt{constructor(h,d){this.low=h,this.high=d,this.length=1+d-h}overlaps(h){return!(this.high<h.low||this.low>h.high)}touches(h){return!(this.high+1<h.low||this.low-1>h.high)}add(h){return new wt(Math.min(this.low,h.low),Math.max(this.high,h.high))}subtract(h){return h.low<=this.low&&h.high>=this.high?[]:h.low>this.low&&h.high<this.high?[new wt(this.low,h.low-1),new wt(h.high+1,this.high)]:h.low<=this.low?[new wt(h.high+1,this.high)]:[new wt(this.low,h.low-1)]}toString(){return this.low==this.high?this.low.toString():this.low+"-"+this.high}},c=class Dt{constructor(h,d){this.ranges=[],this.length=0,h!=null&&this.add(h,d)}_update_length(){this.length=this.ranges.reduce((h,d)=>h+d.length,0)}add(h,d){var O=D=>{for(var T=0;T<this.ranges.length&&!D.touches(this.ranges[T]);)T++;for(var $=this.ranges.slice(0,T);T<this.ranges.length&&D.touches(this.ranges[T]);)D=D.add(this.ranges[T]),T++;$.push(D),this.ranges=$.concat(this.ranges.slice(T)),this._update_length()};return h instanceof Dt?h.ranges.forEach(O):(d==null&&(d=h),O(new i(h,d))),this}subtract(h,d){var O=D=>{for(var T=0;T<this.ranges.length&&!D.overlaps(this.ranges[T]);)T++;for(var $=this.ranges.slice(0,T);T<this.ranges.length&&D.overlaps(this.ranges[T]);)$=$.concat(this.ranges[T].subtract(D)),T++;this.ranges=$.concat(this.ranges.slice(T)),this._update_length()};return h instanceof Dt?h.ranges.forEach(O):(d==null&&(d=h),O(new i(h,d))),this}intersect(h,d){var O=[],D=T=>{for(var $=0;$<this.ranges.length&&!T.overlaps(this.ranges[$]);)$++;for(;$<this.ranges.length&&T.overlaps(this.ranges[$]);){var E=Math.max(this.ranges[$].low,T.low),J=Math.min(this.ranges[$].high,T.high);O.push(new i(E,J)),$++}};return h instanceof Dt?h.ranges.forEach(D):(d==null&&(d=h),D(new i(h,d))),this.ranges=O,this._update_length(),this}index(h){for(var d=0;d<this.ranges.length&&this.ranges[d].length<=h;)h-=this.ranges[d].length,d++;return this.ranges[d].low+h}toString(){return"[ "+this.ranges.join(", ")+" ]"}clone(){return new Dt(this)}numbers(){return this.ranges.reduce((h,d)=>{for(var O=d.low;O<=d.high;)h.push(O),O++;return h},[])}subranges(){return this.ranges.map(h=>({low:h.low,high:h.high,length:1+h.high-h.low}))}};t.exports=c}}),ki=$e({"node_modules/randexp/lib/randexp.js"(e,t){var i=Ii(),c=Ni(),p=i.types;t.exports=class Ut{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:Ut.prototype.max!=null?Ut.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 D,T,$,E,J;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=d.options?this._randSelect(d.options):d.stack,T="",E=0,J=D.length;E<J;E++)T+=this._gen(D[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($=this.randInt(d.min,d.max===1/0?d.min+this.max:d.max),T="",E=0;E<$;E++)T+=this._gen(d.value,O);return T;case p.REFERENCE:return O[d.value-1]||"";case p.CHAR:{var ae=this.ignoreCase&&this._randBool()?this._toOtherCase(d.value):d.value;return String.fromCharCode(ae)}}}_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 D=0;D<d.set.length;D++){let T=this._expand(d.set[D]);if(O.add(T),this.ignoreCase)for(let $=0;$<T.length;$++){let E=T.index($),J=this._toOtherCase(E);E!==J&&O.add(J)}}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 D;return typeof d=="string"&&(d=new RegExp(d,O)),d._randexp===void 0?(D=new Ut(d,O),d._randexp=D):(D=d._randexp,D._setDefaults(d)),D.gen()}static sugar(){RegExp.prototype.gen=function(){return Ut.randexp(this)}}}}}),At=$e({"node_modules/yaml/dist/PlainValue-ec8e588e.js"(e){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 h(j){let w=[0],b=j.indexOf(` `);for(;b!==-1;)b+=1,w.push(b),b=j.indexOf(` `,b);return w}function d(j){let w,b;return typeof j=="string"?(w=h(j),b=j):(Array.isArray(j)&&(j=j[0]),j&&j.context&&(j.lineStarts||(j.lineStarts=h(j.context.src)),w=j.lineStarts,b=j.context.src)),{lineStarts:w,src:b}}function O(j,w){if(typeof j!="number"||j<0)return null;let{lineStarts:b,src:R}=d(w);if(!b||!R||j>R.length)return null;for(let M=0;M<b.length;++M){let _=b[M];if(j<_)return{line:M,col:j-b[M-1]+1};if(j===_)return{line:M+1,col:1}}let x=b.length;return{line:x,col:j-b[x-1]+1}}function D(j,w){let{lineStarts:b,src:R}=d(w);if(!b||!(j>=1)||j>b.length)return null;let x=b[j-1],M=b[j];for(;M&&M>x&&R[M-1]===` `;)--M;return R.slice(x,M)}function T({start:j,end:w},b,R=80){let x=D(j.line,b);if(!x)return null;let{col:M}=j;if(x.length>R)if(M<=R-10)x=x.substr(0,R-1)+"\u2026";else{let G=Math.round(R/2);x.length>M+G&&(x=x.substr(0,M+G-1)+"\u2026"),M-=x.length-R,x="\u2026"+x.substr(1-R)}let _=1,I="";w&&(w.line===j.line&&M+(w.col-j.col)<=R+1?_=w.col-j.col:(_=Math.min(x.length+1,R)-M,I="\u2026"));let k=M>1?" ".repeat(M-1):"",V="^".repeat(_);return`${x} ${k}${V}${I}`}var $=class Er{static copy(w){return new Er(w.start,w.end)}constructor(w,b){this.start=w,this.end=b||w}isEmpty(){return typeof this.start!="number"||!this.end||this.end<=this.start}setOrigRange(w,b){let{start:R,end:x}=this;if(w.length===0||x<=w[0])return this.origStart=R,this.origEnd=x,b;let M=b;for(;M<w.length&&!(w[M]>R);)++M;this.origStart=R+M;let _=M;for(;M<w.length&&!(w[M]>=x);)++M;return this.origEnd=x+M,_}},E=class it{static addStringTerminator(w,b,R){if(R[R.length-1]===` `)return R;let x=it.endOfWhiteSpace(w,b);return x>=w.length||w[x]===` `?R+` `:R}static atDocumentBoundary(w,b,R){let x=w[b];if(!x)return!0;let M=w[b-1];if(M&&M!==` `)return!1;if(R){if(x!==R)return!1}else if(x!==t.DIRECTIVES_END&&x!==t.DOCUMENT_END)return!1;let _=w[b+1],I=w[b+2];if(_!==x||I!==x)return!1;let k=w[b+3];return!k||k===` `||k===" "||k===" "}static endOfIdentifier(w,b){let R=w[b],x=R==="<",M=x?[` `," "," ",">"]:[` `," "," ","[","]","{","}",","];for(;R&&M.indexOf(R)===-1;)R=w[b+=1];return x&&R===">"&&(b+=1),b}static endOfIndent(w,b){let R=w[b];for(;R===" ";)R=w[b+=1];return b}static endOfLine(w,b){let R=w[b];for(;R&&R!==` `;)R=w[b+=1];return b}static endOfWhiteSpace(w,b){let R=w[b];for(;R===" "||R===" ";)R=w[b+=1];return b}static startOfLine(w,b){let R=w[b-1];if(R===` `)return b;for(;R&&R!==` `;)R=w[b-=1];return b+1}static endOfBlockIndent(w,b,R){let x=it.endOfIndent(w,R);if(x>R+b)return x;{let M=it.endOfWhiteSpace(w,x),_=w[M];if(!_||_===` `)return M}return null}static atBlank(w,b,R){let x=w[b];return x===` `||x===" "||x===" "||R&&!x}static nextNodeIsIndented(w,b,R){return!w||b<0?!1:b>0?!0:R&&w==="-"}static normalizeOffset(w,b){let R=w[b];return R?R!==` `&&w[b-1]===` `?b-1:it.endOfWhiteSpace(w,b):b}static foldNewline(w,b,R){let x=0,M=!1,_="",I=w[b+1];for(;I===" "||I===" "||I===` `;){switch(I){case` `:x=0,b+=1,_+=` `;break;case" ":x<=R&&(M=!0),b=it.endOfWhiteSpace(w,b+2)-1;break;case" ":x+=1,b+=1;break}I=w[b+1]}return _||(_=" "),I&&x<=R&&(M=!0),{fold:_,offset:b,error:M}}constructor(w,b,R){Object.defineProperty(this,"context",{value:R||null,writable:!0}),this.error=null,this.range=null,this.valueRange=null,this.props=b||[],this.type=w,this.value=null}getPropValue(w,b,R){if(!this.context)return null;let{src:x}=this.context,M=this.props[w];return M&&x[M.start]===b?x.slice(M.start+(R?1:0),M.end):null}get anchor(){for(let w=0;w<this.props.length;++w){let b=this.getPropValue(w,t.ANCHOR,!0);if(b!=null)return b}return null}get comment(){let w=[];for(let b=0;b<this.props.length;++b){let R=this.getPropValue(b,t.COMMENT,!0);R!=null&&w.push(R)}return w.length>0?w.join(` `):null}commentHasRequiredWhitespace(w){let{src:b}=this.context;if(this.header&&w===this.header.end||!this.valueRange)return!1;let{end:R}=this.valueRange;return w!==R||it.atBlank(b,R-1)}get hasComment(){if(this.context){let{src:w}=this.context;for(let b=0;b<this.props.length;++b)if(w[this.props[b].start]===t.COMMENT)return!0}return!1}get hasProps(){if(this.context){let{src:w}=this.context;for(let b=0;b<this.props.length;++b)if(w[this.props[b].start]!==t.COMMENT)return!0}return!1}get includesTrailingLines(){return!1}get jsonLike(){return[i.FLOW_MAP,i.FLOW_SEQ,i.QUOTE_DOUBLE,i.QUOTE_SINGLE].indexOf(this.type)!==-1}get rangeAsLinePos(){if(!this.range||!this.context)return;let w=O(this.range.start,this.context.root);if(!w)return;let b=O(this.range.end,this.context.root);return{start:w,end:b}}get rawValue(){if(!this.valueRange||!this.context)return null;let{start:w,end:b}=this.valueRange;return this.context.src.slice(w,b)}get tag(){for(let w=0;w<this.props.length;++w){let b=this.getPropValue(w,t.TAG,!1);if(b!=null){if(b[1]==="<")return{verbatim:b.slice(2,-1)};{let[R,x,M]=b.match(/^(.*!)([^!]*)$/);return{handle:x,suffix:M}}}}return null}get valueRangeContainsNewline(){if(!this.valueRange||!this.context)return!1;let{start:w,end:b}=this.valueRange,{src:R}=this.context;for(let x=w;x<b;++x)if(R[x]===` `)return!0;return!1}parseComment(w){let{src:b}=this.context;if(b[w]===t.COMMENT){let R=it.endOfLine(b,w+1),x=new $(w,R);return this.props.push(x),R}return w}setOrigRanges(w,b){return this.range&&(b=this.range.setOrigRange(w,b)),this.valueRange&&this.valueRange.setOrigRange(w,b),this.props.forEach(R=>R.setOrigRange(w,b)),b}toString(){let{context:{src:w},range:b,value:R}=this;if(R!=null)return R;let x=w.slice(b.start,b.end);return it.addStringTerminator(w,b.end,x)}},J=class extends Error{constructor(j,w,b){if(!b||!(w instanceof E))throw new Error(`Invalid arguments for new ${j}`);super(),this.name=j,this.message=b,this.source=w}makePretty(){if(!this.source)return;this.nodeType=this.source.type;let j=this.source.context&&this.source.context.root;if(typeof this.offset=="number"){this.range=new $(this.offset,this.offset+1);let w=j&&O(this.offset,j);if(w){let b={line:w.line,col:w.col+1};this.linePos={start:w,end:b}}delete this.offset}else this.range=this.source.range,this.linePos=this.source.rangeAsLinePos;if(this.linePos){let{line:w,col:b}=this.linePos.start;this.message+=` at line ${w}, column ${b}`;let R=j&&T(this.linePos,j);R&&(this.message+=`: ${R} `)}delete this.source}},W=class extends J{constructor(j,w){super("YAMLReferenceError",j,w)}},ae=class extends J{constructor(j,w){super("YAMLSemanticError",j,w)}},Q=class extends J{constructor(j,w){super("YAMLSyntaxError",j,w)}},ne=class extends J{constructor(j,w){super("YAMLWarning",j,w)}};function he(j,w,b){return w in j?Object.defineProperty(j,w,{value:b,enumerable:!0,configurable:!0,writable:!0}):j[w]=b,j}var ye=class di extends E{static endOfLine(w,b,R){let x=w[b],M=b;for(;x&&x!==` `&&!(R&&(x==="["||x==="]"||x==="{"||x==="}"||x===","));){let _=w[M+1];if(x===":"&&(!_||_===` `||_===" "||_===" "||R&&_===",")||(x===" "||x===" ")&&_==="#")break;M+=1,x=_}return M}get strValue(){if(!this.valueRange||!this.context)return null;let{start:w,end:b}=this.valueRange,{src:R}=this.context,x=R[b-1];for(;w<b&&(x===` `||x===" "||x===" ");)x=R[--b-1];let M="";for(let I=w;I<b;++I){let k=R[I];if(k===` `){let{fold:V,offset:G}=E.foldNewline(R,I,-1);M+=V,I=G}else if(k==="