@zuplo/core 5.1886.0 → 5.1887.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.minified.js +1 -1
- package/package.json +1 -1
package/index.minified.js
CHANGED
|
@@ -465,7 +465,7 @@ export default {
|
|
|
465
465
|
return handler.requestHandler(request, env, ctx)
|
|
466
466
|
},
|
|
467
467
|
};
|
|
468
|
-
`;var jPn=a(async function({systemDirectory:e,logger:t,config:r}){return qPn.default.timeFn("Generating Worker shim",async()=>{t.debug("Generating Worker shim");const n=r?.flags?.esmWorker?$Pn:UPn;const i=MPn.default.join(e,e7.WORKER_ENTRY_NAME);try{await BPn.default.writeFile(i,n.trimStart(),"utf-8")}catch(s){t.error(s);const o={message:`Error creating file at ${i}`,pluginName:"generate-worker-entry",severity:"error"};return{warnings:[],errors:[o]}}return{warnings:[],errors:[]}})},"generateWorker");kP.generateWorker=jPn});var fOt=y(DP=>{"use strict";var pOt=DP&&DP.__importDefault||function(e){return e&&e.__esModule?e:{"default":e}};Object.defineProperty(DP,"__esModule",{value:true});DP.validateDevPortalJSON=void 0;var GPn=vn();var cOt=pOt(require("path"));var dOt=Bn();var HPn=ru();var VPn=pOt(xs());var zPn=require("fs/promises");var KPn=a(async function({logger:e,sourceDirectory:t}){return VPn.default.timeFn("Validate dev-portal.json file",async()=>{e.debug(`Validate dev-portal.json file`);const r=cOt.default.join(t,dOt.USER_CONFIG_DIR_NAME);const n=cOt.default.join(r,dOt.DEV_PORTAL_CONFIG_FILE);if(!await GPn.xfs.fileExists(n)){e.debug("Project is missing a dev-portal.json file. Skipping validate-dev-portal-json plugin.");return new HPn.PluginResult}const i=[];const s=await(0,zPn.readFile)(n,"utf-8");const o=JSON.parse(s);if(o.enableAuthentication&&o.authentication){const{provider:u}=o.authentication;if(u&&u!=="auth0"&&u!=="okta"&&u!=="azure-ad"&&u!=="clerk"&&u!=="oidc"&&u!=="external"){i.push({message:"The authentication setting 'provider' is not set or invalid. Valid values are 'auth0', 'okta', 'azure-ad', 'clerk', 'oidc', or 'external'.",pluginName:"validate-dev-portal-json",severity:"warning"})}if(u==="external"){const{loginUrl:l,logoutUrl:c}=o.authentication;if(l===void 0||l.trim().length===0){i.push({message:"The authentication setting for 'loginUrl' is not set or is invalid.",pluginName:"validate-dev-portal-json",severity:"warning"})}else if(l.startsWith("$env(")&&!l.startsWith("$env(ZUPLO_PUBLIC_")){i.push({message:"'loginUrl' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration.",pluginName:"validate-dev-portal-json",severity:"warning"})}if(c===void 0||c.trim().length===0){i.push({message:"The authentication setting for 'logoutUrl' is not set or is invalid.",pluginName:"validate-dev-portal-json",severity:"warning"})}else if(c.startsWith("$env(")&&!c.startsWith("$env(ZUPLO_PUBLIC_")){i.push({message:"'logoutUrl' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration.",pluginName:"validate-dev-portal-json",severity:"warning"})}}else{const{authority:l}=o.authentication;if(o.authentication.devPortalClient){const{clientId:c,audience:d}=o.authentication.devPortalClient;if(d===void 0||d.trim().length===0){i.push({message:"The authentication setting for 'audience' is not set or is invalid.",pluginName:"validate-dev-portal-json",severity:"warning"})}else if(d.startsWith("$env(")&&!d.startsWith("$env(ZUPLO_PUBLIC_")){i.push({message:"'audience' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration.",pluginName:"validate-dev-portal-json",severity:"warning"})}if(l===void 0||l.trim().length===0){i.push({message:"The authentication setting for 'authority' is not set or is invalid.",pluginName:"validate-dev-portal-json",severity:"warning"})}else if(l.startsWith("$env(")&&!l.startsWith("$env(ZUPLO_PUBLIC_")){i.push({message:"'authority' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration.",pluginName:"validate-dev-portal-json",severity:"warning"})}if(c===void 0||c.trim().length===0){i.push({message:"The authentication setting for 'clientId' is not set or is invalid.",pluginName:"validate-dev-portal-json",severity:"warning"})}else if(c.startsWith("$env(")&&!c.startsWith("$env(ZUPLO_PUBLIC_")){i.push({message:"'clientId' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration.",pluginName:"validate-dev-portal-json",severity:"warning"})}}}}if(o.enableMonetization&&o.monetization){const{provider:u}=o.monetization;if(!u||u.trim().length===0||u!=="stripe"){i.push({message:"The monetization setting 'provider' is not set or invalid. Valid values are 'stripe'.",pluginName:"validate-dev-portal-json",severity:"warning"})}if(u==="stripe"){const{pricingTableId:l,publishableKey:c,secretKey:d}=o.monetization;if(!l||l.trim().length===0){i.push({message:"The monetization setting for 'Pricing Table Id' is not set or is invalid. Field monetization.pricingTableId in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"})}else if(l.startsWith("$env(")){if(!l.startsWith("$env(ZUPLO_PUBLIC_")){i.push({message:"'Pricing Table Id' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration. Field monetization.pricingTableId in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"})}}else if(!l.startsWith("prctbl_")){i.push({message:"'Pricing Table Id' field must start with prctbl_. Field monetization.pricingTableId in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"})}if(!c||c.trim().length===0){i.push({message:"The monetization setting for 'Publishable Key' is not set or is invalid. Field monetization.publishableKey in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"})}else if(c.startsWith("$env(")){if(!c.startsWith("$env(ZUPLO_PUBLIC_")){i.push({message:"'Publishable Key' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration. Field monetization.publishableKey in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"})}}else if(!c.startsWith("pk_")){i.push({message:"'Publishable Key' field must start with pk_. Field monetization.publishableKey in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"})}if(!d||d.trim().length===0){i.push({message:"The monetization setting for 'Secret Key' is not set or is invalid. Field monetization.secretKey in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"})}else if(!d.startsWith("$env(")){i.push({message:"The monetization setting for 'Secret Key' must be an environment variable. Field monetization.secretKey in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"})}}}else if(o.enableMonetization&&!o.monetization){i.push({message:"Monetization was enabled but no monetization configuration was provider in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"})}return{errors:[],warnings:i}})},"validateDevPortalJSON");DP.validateDevPortalJSON=KPn});var cC=y(Ed=>{"use strict";var mOt=Ed&&Ed.__importDefault||function(e){return e&&e.__esModule?e:{"default":e}};Object.defineProperty(Ed,"__esModule",{value:true});Ed.getFilePathNameFromRefName=Ed.getFullyQualifiedRefName=Ed.chaseRefs=Ed.oasFileInProject=Ed.getOpenApiFilesByAlphabetical=void 0;var hOt=mOt(require("fs/promises"));var yQ=mOt(require("path"));var gOt=Bn();var WPn=a(async e=>{const t=await hOt.default.readdir(e);return t.map(r=>`${e}/${r}`).filter(r=>r.endsWith(gOt.OPEN_API_FILE_SUFFIX)).sort()},"getOpenApiFilesByAlphabetical");Ed.getOpenApiFilesByAlphabetical=WPn;var YPn=a(async e=>{const t=yQ.default.resolve(e,"config");const r=await hOt.default.readdir(t);return r.filter(n=>n.endsWith(gOt.OPEN_API_FILE_SUFFIX)).length>=1},"oasFileInProject");Ed.oasFileInProject=YPn;function yOt(e,t,r,n,i,s,o){if(s.has(r)){return}const u=n.get(r);s.set(r,i.length);i.push(r);HOe(vOt(r),t,u,n,i,s,o)}a(yOt,"chaseRefs");Ed.chaseRefs=yOt;function HOe(e,t,r,n,i,s,o){if(Array.isArray(r)){for(const u of r){HOe(e,t,u,n,i,s,o)}}else if(typeof r==="object"){for(const u in r){if(u==="$ref"){const l=r[u];if(o){r[u]=o(t,l)}yOt(e,t,_Ot(e,l),n,i,s,o)}HOe(e,t,r[u],n,i,s,o)}}}a(HOe,"lookForRefs");function _Ot(e,t){const r=t.indexOf("#");if(r>=0){return`${yQ.default.resolve(e,t.substring(0,r))}${t.substring(r)}`}else{return yQ.default.resolve(yQ.default.dirname(e),t)}}a(_Ot,"getFullyQualifiedRefName");Ed.getFullyQualifiedRefName=_Ot;function vOt(e){const t=e.indexOf("#");if(t>=0){return e.substring(0,t)}else{return e}}a(vOt,"getFilePathNameFromRefName");Ed.getFilePathNameFromRefName=vOt});var COt=y(LP=>{"use strict";var AOt=LP&&LP.__importDefault||function(e){return e&&e.__esModule?e:{"default":e}};Object.defineProperty(LP,"__esModule",{value:true});LP.validateOpenAPIFiles=void 0;var EOt=AOt(require("path"));var XPn=Bn();var bOt=ru();var JPn=AOt(xs());var QPn=cC();var SOt=require("fs/promises");var _Q="validate-open-api-files";var ZPn=a(async function({sourceDirectory:e,logger:t}){return JPn.default.timeFn("Building OpenAPI files to build output",async()=>{t.debug("Building OpenAPI files to build output");const r=EOt.default.join(e,XPn.USER_CONFIG_DIR_NAME);const n=[];try{const i=await(0,QPn.oasFileInProject)(e);if(!i){return new bOt.PluginResult({message:"Failed to build project because no open-api file was found on the 'config' folder",pluginName:_Q,severity:"error"})}const s=await(0,SOt.readdir)(r);const o=s.filter(u=>u.endsWith(".oas.json"));for(const u of o){const l=EOt.default.join(r,u);try{if(u==="zp.oas.json"){n.push({message:`Open API files cannot be named 'zp.oas.json' since 'zp' is a reserved prefix. Update the file name to solve this build issue.`,pluginName:_Q,severity:"error"})}const c=await(0,SOt.readFile)(l,"utf-8");const d=JSON.parse(c);if(d&&d.paths){const p=Object.entries(d.paths).filter(f=>{if(f[0]==="zp"||f[0]==="/zp"){return true}return false});if(p.length>0){const f=p.length===1?"includes one route path":`includes '${p.length}' routes`;n.push({message:`Open API file '${u}' ${f} that's named '/zp' which is a reserved route name. Updating the route to something other than '/zp' will solve this build issue.`,pluginName:_Q,severity:"error"})}}}catch(c){t.error(c)}}}catch(i){t.error(i);if(n.length>0){return{errors:n,warnings:[]}}else{return new bOt.PluginResult({message:"Failed while validating the open api files in the project",pluginName:_Q,severity:"warning"})}}return{errors:n,warnings:[]}})},"validateOpenAPIFiles");LP.validateOpenAPIFiles=ZPn});var WOe=y(KOe=>{"use strict";Object.defineProperty(KOe,"__esModule",{value:true});var eNn=require("vm");function tNn(e){return e&&typeof e==="object"&&"default"in e?e:{"default":e}}a(tNn,"_interopDefaultLegacy");var rNn=tNn(eNn);var{hasOwnProperty:bd}=Object.prototype;function dC(e,t){e=e.slice();e.push(t);return e}a(dC,"push");function VOe(e,t){t=t.slice();t.unshift(e);return t}a(VOe,"unshift");var zOe=class extends Error{static{a(this,"NewError")}constructor(t){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)');this.avoidNew=true;this.value=t;this.name="NewError"}};function Ds(e,t,r,n,i){if(!(this instanceof Ds)){try{return new Ds(e,t,r,n,i)}catch(o){if(!o.avoidNew){throw o}return o.value}}if(typeof e==="string"){i=n;n=r;r=t;t=e;e=null}const s=e&&typeof e==="object";e=e||{};this.json=e.json||r;this.path=e.path||t;this.resultType=e.resultType||"value";this.flatten=e.flatten||false;this.wrap=bd.call(e,"wrap")?e.wrap:true;this.sandbox=e.sandbox||{};this.preventEval=e.preventEval||false;this.parent=e.parent||null;this.parentProperty=e.parentProperty||null;this.callback=e.callback||n||null;this.otherTypeCallback=e.otherTypeCallback||i||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")};if(e.autostart!==false){const o={path:s?e.path:t};if(!s){o.json=r}else if("json"in e){o.json=e.json}const u=this.evaluate(o);if(!u||typeof u!=="object"){throw new zOe(u)}return u}}a(Ds,"JSONPath");Ds.prototype.evaluate=function(e,t,r,n){let i=this.parent,s=this.parentProperty;let{flatten:o,wrap:u}=this;this.currResultType=this.resultType;this.currPreventEval=this.preventEval;this.currSandbox=this.sandbox;r=r||this.callback;this.currOtherTypeCallback=n||this.otherTypeCallback;t=t||this.json;e=e||this.path;if(e&&typeof e==="object"&&!Array.isArray(e)){if(!e.path&&e.path!==""){throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().')}if(!bd.call(e,"json")){throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().')}({json:t}=e);o=bd.call(e,"flatten")?e.flatten:o;this.currResultType=bd.call(e,"resultType")?e.resultType:this.currResultType;this.currSandbox=bd.call(e,"sandbox")?e.sandbox:this.currSandbox;u=bd.call(e,"wrap")?e.wrap:u;this.currPreventEval=bd.call(e,"preventEval")?e.preventEval:this.currPreventEval;r=bd.call(e,"callback")?e.callback:r;this.currOtherTypeCallback=bd.call(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback;i=bd.call(e,"parent")?e.parent:i;s=bd.call(e,"parentProperty")?e.parentProperty:s;e=e.path}i=i||null;s=s||null;if(Array.isArray(e)){e=Ds.toPathString(e)}if(!e&&e!==""||!t){return void 0}const l=Ds.toPathArray(e);if(l[0]==="$"&&l.length>1){l.shift()}this._hasParentSelector=null;const c=this._trace(l,t,["$"],i,s,r).filter(function(d){return d&&!d.isParentSelector});if(!c.length){return u?[]:void 0}if(!u&&c.length===1&&!c[0].hasArrExpr){return this._getPreferredOutput(c[0])}return c.reduce((d,p)=>{const f=this._getPreferredOutput(p);if(o&&Array.isArray(f)){d=d.concat(f)}else{d.push(f)}return d},[])};Ds.prototype._getPreferredOutput=function(e){const t=this.currResultType;switch(t){case"all":{const r=Array.isArray(e.path)?e.path:Ds.toPathArray(e.path);e.pointer=Ds.toPointer(r);e.path=typeof e.path==="string"?e.path:Ds.toPathString(e.path);return e}case"value":case"parent":case"parentProperty":return e[t];case"path":return Ds.toPathString(e[t]);case"pointer":return Ds.toPointer(e.path);default:throw new TypeError("Unknown result type")}};Ds.prototype._handleCallback=function(e,t,r){if(t){const n=this._getPreferredOutput(e);e.path=typeof e.path==="string"?e.path:Ds.toPathString(e.path);t(n,r,e)}};Ds.prototype._trace=function(e,t,r,n,i,s,o,u){let l;if(!e.length){l={path:r,value:t,parent:n,parentProperty:i,hasArrExpr:o};this._handleCallback(l,s,"value");return l}const c=e[0],d=e.slice(1);const p=[];function f(m){if(Array.isArray(m)){m.forEach(h=>{p.push(h)})}else{p.push(m)}}a(f,"addRet");if((typeof c!=="string"||u)&&t&&bd.call(t,c)){f(this._trace(d,t[c],dC(r,c),t,c,s,o))}else if(c==="*"){this._walk(t,m=>{f(this._trace(d,t[m],dC(r,m),t,m,s,true,true))})}else if(c===".."){f(this._trace(d,t,r,n,i,s,o));this._walk(t,m=>{if(typeof t[m]==="object"){f(this._trace(e.slice(),t[m],dC(r,m),t,m,s,true))}})}else if(c==="^"){this._hasParentSelector=true;return{path:r.slice(0,-1),expr:d,isParentSelector:true}}else if(c==="~"){l={path:dC(r,c),value:i,parent:n,parentProperty:null};this._handleCallback(l,s,"property");return l}else if(c==="$"){f(this._trace(d,t,r,null,null,s,o))}else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(c)){f(this._slice(c,d,t,r,n,i,s))}else if(c.indexOf("?(")===0){if(this.currPreventEval){throw new Error("Eval [?(expr)] prevented in JSONPath expression.")}const m=c.replace(/^\?\((.*?)\)$/u,"$1");this._walk(t,h=>{if(this._eval(m,t[h],h,r,n,i)){f(this._trace(d,t[h],dC(r,h),t,h,s,true))}})}else if(c[0]==="("){if(this.currPreventEval){throw new Error("Eval [(expr)] prevented in JSONPath expression.")}f(this._trace(VOe(this._eval(c,t,r[r.length-1],r.slice(0,-1),n,i),d),t,r,n,i,s,o))}else if(c[0]==="@"){let m=false;const h=c.slice(1,-2);switch(h){case"scalar":if(!t||!["object","function"].includes(typeof t)){m=true}break;case"boolean":case"string":case"undefined":case"function":if(typeof t===h){m=true}break;case"integer":if(Number.isFinite(t)&&!(t%1)){m=true}break;case"number":if(Number.isFinite(t)){m=true}break;case"nonFinite":if(typeof t==="number"&&!Number.isFinite(t)){m=true}break;case"object":if(t&&typeof t===h){m=true}break;case"array":if(Array.isArray(t)){m=true}break;case"other":m=this.currOtherTypeCallback(t,r,n,i);break;case"null":if(t===null){m=true}break;default:throw new TypeError("Unknown value type "+h)}if(m){l={path:r,value:t,parent:n,parentProperty:i};this._handleCallback(l,s,"value");return l}}else if(c[0]==="`"&&t&&bd.call(t,c.slice(1))){const m=c.slice(1);f(this._trace(d,t[m],dC(r,m),t,m,s,o,true))}else if(c.includes(",")){const m=c.split(",");for(const h of m){f(this._trace(VOe(h,d),t,r,n,i,s,true))}}else if(!u&&t&&bd.call(t,c)){f(this._trace(d,t[c],dC(r,c),t,c,s,o,true))}if(this._hasParentSelector){for(let m=0;m<p.length;m++){const h=p[m];if(h&&h.isParentSelector){const g=this._trace(h.expr,t,h.path,n,i,s,o);if(Array.isArray(g)){p[m]=g[0];const _=g.length;for(let v=1;v<_;v++){m++;p.splice(m,0,g[v])}}else{p[m]=g}}}}return p};Ds.prototype._walk=function(e,t){if(Array.isArray(e)){const r=e.length;for(let n=0;n<r;n++){t(n)}}else if(e&&typeof e==="object"){Object.keys(e).forEach(r=>{t(r)})}};Ds.prototype._slice=function(e,t,r,n,i,s,o){if(!Array.isArray(r)){return void 0}const u=r.length,l=e.split(":"),c=l[2]&&Number.parseInt(l[2])||1;let d=l[0]&&Number.parseInt(l[0])||0,p=l[1]&&Number.parseInt(l[1])||u;d=d<0?Math.max(0,d+u):Math.min(u,d);p=p<0?Math.max(0,p+u):Math.min(u,p);const f=[];for(let m=d;m<p;m+=c){const h=this._trace(VOe(m,t),r,n,i,s,o,true);h.forEach(g=>{f.push(g)})}return f};Ds.prototype._eval=function(e,t,r,n,i,s){this.currSandbox._$_parentProperty=s;this.currSandbox._$_parent=i;this.currSandbox._$_property=r;this.currSandbox._$_root=this.json;this.currSandbox._$_v=t;const o=e.includes("@path");if(o){this.currSandbox._$_path=Ds.toPathString(n.concat([r]))}const u="script:"+e;if(!Ds.cache[u]){let l=e.replace(/@parentProperty/gu,"_$_parentProperty").replace(/@parent/gu,"_$_parent").replace(/@property/gu,"_$_property").replace(/@root/gu,"_$_root").replace(/@([.\s)[])/gu,"_$_v$1");if(o){l=l.replace(/@path/gu,"_$_path")}Ds.cache[u]=new this.vm.Script(l)}try{return Ds.cache[u].runInNewContext(this.currSandbox)}catch(l){throw new Error("jsonPath: "+l.message+": "+e)}};Ds.cache={};Ds.toPathString=function(e){const t=e,r=t.length;let n="$";for(let i=1;i<r;i++){if(!/^(~|\^|@.*?\(\))$/u.test(t[i])){n+=/^[0-9*]+$/u.test(t[i])?"["+t[i]+"]":"['"+t[i]+"']"}}return n};Ds.toPointer=function(e){const t=e,r=t.length;let n="";for(let i=1;i<r;i++){if(!/^(~|\^|@.*?\(\))$/u.test(t[i])){n+="/"+t[i].toString().replace(/~/gu,"~0").replace(/\//gu,"~1")}}return n};Ds.toPathArray=function(e){const{cache:t}=Ds;if(t[e]){return t[e].concat()}const r=[];const n=e.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replace(/[['](\??\(.*?\))[\]']/gu,function(s,o){return"[#"+(r.push(o)-1)+"]"}).replace(/\[['"]([^'\]]*)['"]\]/gu,function(s,o){return"['"+o.replace(/\./gu,"%@%").replace(/~/gu,"%%@@%%")+"']"}).replace(/~/gu,";~;").replace(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replace(/%@%/gu,".").replace(/%%@@%%/gu,"~").replace(/(?:;)?(\^+)(?:;)?/gu,function(s,o){return";"+o.split("").join(";")+";"}).replace(/;;;|;;/gu,";..;").replace(/;$|'?\]|'$/gu,"");const i=n.split(";").map(function(s){const o=s.match(/#(\d+)/u);return!o||!o[1]?s:r[o[1]]});t[e]=i;return t[e].concat()};Ds.prototype.vm=rNn["default"];KOe.JSONPath=Ds});var wOt=y(FP=>{"use strict";var YOe=FP&&FP.__importDefault||function(e){return e&&e.__esModule?e:{"default":e}};Object.defineProperty(FP,"__esModule",{value:true});FP.verifyWorkerOutput=void 0;var nNn=require("@swc/core");var iNn=vn();var sNn=WOe();var aNn=YOe(require("fs/promises"));var oNn=YOe(require("path"));var uNn=YOe(xs());var lNn=a(async function({outputDirectory:e,logger:t}){return uNn.default.timeFn("Verify Worker output",async()=>{t.debug("Verify Worker output");const r=oNn.default.join(e,"worker.js");try{if(await iNn.xfs.fileExists(r)){const n=await aNn.default.readFile(r,"utf-8");const i=await(0,nNn.parse)(n,{syntax:"ecmascript"});const s=(0,sNn.JSONPath)({path:"$..callee[?(@property === 'value' && (@ === 'Function'|| @ === 'eval'))]^",json:i.body});if(s&&s.length>0){const o={message:"We do not support the use of 'eval' or 'new Function(...)'",severity:"warning",pluginName:"verify-worker-output"};return{warnings:[o],errors:[]}}}}catch(n){t.error(n);const i={message:`Error validating build output : ${n.message}`,severity:"error",pluginName:"verify-worker-output"};return{warnings:[],errors:[i]}}return{warnings:[],errors:[]}})},"verifyWorkerOutput");FP.verifyWorkerOutput=lNn});var EQ=y(vQ=>{"use strict";Object.defineProperty(vQ,"__esModule",{value:true});vQ.CompilerResult=void 0;var t7=vn();var cNn=require("crypto");var XOe=class{static{a(this,"CompilerResult")}buildId;buildTime;buildTimeMs;errors;warnings;status;assets;metafile;constructor(t,r){this.buildId=r?.buildId??(0,cNn.randomUUID)();this.buildTime=r?.startBuildTime.toISOString();this.buildTimeMs=r?.endBuildTime.getTime()-r?.startBuildTime.getTime();this.errors=t.errors.map(n=>({message:n.text,severity:t7.ERROR_SEVERITY,...n}));this.warnings=t.warnings.map(n=>({message:n.text,severity:t7.WARNING_SEVERITY,...n}));if(t.metafile){this.metafile=t.metafile}this.status=t7.GOOD_STATUS;if(this.warnings&&this.warnings.length>0){this.status=t7.WARNING_STATUS}if(this.errors&&this.errors.length>0){this.status=t7.FAILURE_STATUS}}};vQ.CompilerResult=XOe});var DOt=y(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:true});vt.generateColor=vt.colorFunctions=vt.stripColor=vt.bgRgb24=vt.rgb24=vt.bgRgb8=vt.rgb8=vt.bgBrightWhite=vt.bgBrightCyan=vt.bgBrightMagenta=vt.bgBrightBlue=vt.bgBrightYellow=vt.bgBrightGreen=vt.bgBrightRed=vt.bgBrightBlack=vt.bgWhite=vt.bgCyan=vt.bgMagenta=vt.bgBlue=vt.bgYellow=vt.bgGreen=vt.bgRed=vt.bgBlack=vt.brightWhite=vt.brightCyan=vt.brightMagenta=vt.brightBlue=vt.brightYellow=vt.brightGreen=vt.brightRed=vt.brightBlack=vt.gray=vt.white=vt.cyan=vt.magenta=vt.blue=vt.yellow=vt.green=vt.red=vt.black=vt.strikethrough=vt.hidden=vt.inverse=vt.underline=vt.italic=vt.dim=vt.bold=vt.reset=vt.getColorEnabled=vt.setColorEnabled=void 0;var TOt=true;var JOe=!TOt;function dNn(e){if(TOt){return}JOe=e}a(dNn,"setColorEnabled");vt.setColorEnabled=dNn;function pNn(){return JOe}a(pNn,"getColorEnabled");vt.getColorEnabled=pNn;function sn(e,t){return{open:`\x1B[${e.join(";")}m`,close:`\x1B[${t}m`,regexp:new RegExp(`\\x1b\\[${t}m`,"g")}}a(sn,"code");function an(e,t){return JOe?`${t.open}${e.replace(t.regexp,t.open)}${t.close}`:e}a(an,"run");function fNn(e){return an(e,sn([0],0))}a(fNn,"reset");vt.reset=fNn;function mNn(e){return an(e,sn([1],22))}a(mNn,"bold");vt.bold=mNn;function hNn(e){return an(e,sn([2],22))}a(hNn,"dim");vt.dim=hNn;function gNn(e){return an(e,sn([3],23))}a(gNn,"italic");vt.italic=gNn;function yNn(e){return an(e,sn([4],24))}a(yNn,"underline");vt.underline=yNn;function _Nn(e){return an(e,sn([7],27))}a(_Nn,"inverse");vt.inverse=_Nn;function vNn(e){return an(e,sn([8],28))}a(vNn,"hidden");vt.hidden=vNn;function ENn(e){return an(e,sn([9],29))}a(ENn,"strikethrough");vt.strikethrough=ENn;function bNn(e){return an(e,sn([30],39))}a(bNn,"black");vt.black=bNn;function xOt(e){return an(e,sn([31],39))}a(xOt,"red");vt.red=xOt;function ROt(e){return an(e,sn([32],39))}a(ROt,"green");vt.green=ROt;function OOt(e){return an(e,sn([33],39))}a(OOt,"yellow");vt.yellow=OOt;function POt(e){return an(e,sn([34],39))}a(POt,"blue");vt.blue=POt;function NOt(e){return an(e,sn([35],39))}a(NOt,"magenta");vt.magenta=NOt;function IOt(e){return an(e,sn([36],39))}a(IOt,"cyan");vt.cyan=IOt;function SNn(e){return an(e,sn([37],39))}a(SNn,"white");vt.white=SNn;function ANn(e){return kOt(e)}a(ANn,"gray");vt.gray=ANn;function kOt(e){return an(e,sn([90],39))}a(kOt,"brightBlack");vt.brightBlack=kOt;function CNn(e){return an(e,sn([91],39))}a(CNn,"brightRed");vt.brightRed=CNn;function wNn(e){return an(e,sn([92],39))}a(wNn,"brightGreen");vt.brightGreen=wNn;function TNn(e){return an(e,sn([93],39))}a(TNn,"brightYellow");vt.brightYellow=TNn;function xNn(e){return an(e,sn([94],39))}a(xNn,"brightBlue");vt.brightBlue=xNn;function RNn(e){return an(e,sn([95],39))}a(RNn,"brightMagenta");vt.brightMagenta=RNn;function ONn(e){return an(e,sn([96],39))}a(ONn,"brightCyan");vt.brightCyan=ONn;function PNn(e){return an(e,sn([97],39))}a(PNn,"brightWhite");vt.brightWhite=PNn;function NNn(e){return an(e,sn([40],49))}a(NNn,"bgBlack");vt.bgBlack=NNn;function INn(e){return an(e,sn([41],49))}a(INn,"bgRed");vt.bgRed=INn;function kNn(e){return an(e,sn([42],49))}a(kNn,"bgGreen");vt.bgGreen=kNn;function DNn(e){return an(e,sn([43],49))}a(DNn,"bgYellow");vt.bgYellow=DNn;function LNn(e){return an(e,sn([44],49))}a(LNn,"bgBlue");vt.bgBlue=LNn;function FNn(e){return an(e,sn([45],49))}a(FNn,"bgMagenta");vt.bgMagenta=FNn;function BNn(e){return an(e,sn([46],49))}a(BNn,"bgCyan");vt.bgCyan=BNn;function MNn(e){return an(e,sn([47],49))}a(MNn,"bgWhite");vt.bgWhite=MNn;function qNn(e){return an(e,sn([100],49))}a(qNn,"bgBrightBlack");vt.bgBrightBlack=qNn;function UNn(e){return an(e,sn([101],49))}a(UNn,"bgBrightRed");vt.bgBrightRed=UNn;function $Nn(e){return an(e,sn([102],49))}a($Nn,"bgBrightGreen");vt.bgBrightGreen=$Nn;function jNn(e){return an(e,sn([103],49))}a(jNn,"bgBrightYellow");vt.bgBrightYellow=jNn;function GNn(e){return an(e,sn([104],49))}a(GNn,"bgBrightBlue");vt.bgBrightBlue=GNn;function HNn(e){return an(e,sn([105],49))}a(HNn,"bgBrightMagenta");vt.bgBrightMagenta=HNn;function VNn(e){return an(e,sn([106],49))}a(VNn,"bgBrightCyan");vt.bgBrightCyan=VNn;function zNn(e){return an(e,sn([107],49))}a(zNn,"bgBrightWhite");vt.bgBrightWhite=zNn;function XE(e,t=255,r=0){return Math.trunc(Math.max(Math.min(e,t),r))}a(XE,"clampAndTruncate");function KNn(e,t){return an(e,sn([38,5,XE(t)],39))}a(KNn,"rgb8");vt.rgb8=KNn;function WNn(e,t){return an(e,sn([48,5,XE(t)],49))}a(WNn,"bgRgb8");vt.bgRgb8=WNn;function YNn(e,t){if(typeof t==="number"){return an(e,sn([38,2,t>>16&255,t>>8&255,t&255],39))}return an(e,sn([38,2,XE(t.r),XE(t.g),XE(t.b)],39))}a(YNn,"rgb24");vt.rgb24=YNn;function XNn(e,t){if(typeof t==="number"){return an(e,sn([48,2,t>>16&255,t>>8&255,t&255],49))}return an(e,sn([48,2,XE(t.r),XE(t.g),XE(t.b)],49))}a(XNn,"bgRgb24");vt.bgRgb24=XNn;var JNn=new RegExp(["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|"),"g");function QNn(e){return e.replace(JNn,"")}a(QNn,"stripColor");vt.stripColor=QNn;vt.colorFunctions=[xOt,ROt,OOt,POt,NOt,IOt];function ZNn(e){let t=0;const r=e.length;let n=0;if(r>0)while(n<r)t=(t<<5)-t+e.charCodeAt(n++)|0;return t}a(ZNn,"hashCode");function eIn(e){const t=Math.abs(ZNn(e));return vt.colorFunctions[t%vt.colorFunctions.length]}a(eIn,"generateColor");vt.generateColor=eIn});var LOt=y(bQ=>{"use strict";Object.defineProperty(bQ,"__esModule",{value:true});bQ.format=void 0;function tIn(e,t,...r){let n=0;const i=r.length;let s=String(t).replace(/%[sdjoO%]/g,o=>{if(o==="%%")return"%";if(n>=i)return o;switch(o){case"%s":return String(r[n++]);case"%d":return Number(r[n++]).toString();case"%o":return e(r[n++]).split("\n").map(u=>u.trim()).join(" ");case"%O":return e(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch{return"[Circular]"}default:return o}});for(const o of r.splice(n)){if(o===null||!(typeof o==="object"&&o!==null)){s+=" "+o}else{s+=" "+e(o)}}return s}a(tIn,"format");bQ.format=tIn});var FOt=y(SQ=>{"use strict";Object.defineProperty(SQ,"__esModule",{value:true});SQ.format=void 0;var rIn=require("util");var nIn=LOt();var iIn=a((e,...t)=>(0,nIn.format)(rIn.inspect,e,t),"format");SQ.format=iIn});var qOt=y(JE=>{"use strict";Object.defineProperty(JE,"__esModule",{value:true});JE.debug=JE.withoutEnv=JE.Debugger=void 0;var BOt=DOt();var sIn=FOt();var AQ=class{static{a(this,"Debugger")}manager;ns;color;last;enabled;constructor(t,r){(0,BOt.setColorEnabled)(true);this.manager=t;this.ns=r;this.color=(0,BOt.generateColor)(r);this.last=0;this.enabled=t.enabled.some(n=>n.test(r))}log(...t){if(!this.enabled)return;let r;const n=t[0];if(typeof n==="function"){r=n()}else{r=String(n)}const i=Date.now()-(this.last||Date.now());r=(0,sIn.format)(r,...t);const s=`${this.color(this.ns)} ${r} ${this.color(`+${i}ms`)}`;console.log(s);this.last=Date.now()}};JE.Debugger=AQ;var CQ=class{static{a(this,"DebugManager")}debuggers;enabled;constructor(t){this.debuggers=new Map;this.enabled=t??[]}};function MOt(e){if(!e||e.length===0)return[];e=e.replace(/\s/g,"").replace(/\*/g,".+");return e.split(",").map(t=>new RegExp(`^${t}$`))}a(MOt,"extract");var r7;function aIn(e){if(!e)e=[];if(typeof e==="string")e=MOt(e);r7=new CQ(e)}a(aIn,"withoutEnv");JE.withoutEnv=aIn;function oIn(e){if(!r7)r7=new CQ(MOt(process.env.DEBUG));const t=new AQ(r7,e);r7.debuggers.set(e,t);const r=Object.assign(t.log.bind(t),{self:t});return r}a(oIn,"debug");JE.debug=oIn});var n7=y(Sd=>{"use strict";Object.defineProperty(Sd,"__esModule",{value:true});Sd.formatBuildResult=Sd.getBuildEntry=Sd.BUILD_TASK_PLUGIN_NAME=Sd.ESBUILD_PLUGIN_NAME=void 0;var uIn=Bn();var lIn=VF();Sd.ESBUILD_PLUGIN_NAME="run-esbuild";Sd.BUILD_TASK_PLUGIN_NAME="build-task";function cIn(e){let t;if(e==lIn.TargetPlatform.Worker){t=uIn.WORKER_ENTRY_NAME}else{throw new Error(`Target platform ${e} not supported by this plugin.`)}return t}a(cIn,"getBuildEntry");Sd.getBuildEntry=cIn;var dIn=a((e,t)=>{let r=t;if(t.includes(e)){const n=new RegExp(`.*(${e})`,"g");r=t.replace(n,"")}if(r.match(/^(\/)?(\.\.(\/)?)+/)){r=r.replace(/^(\/)?(\.\.(\/)?)+/,"/")}return r},"removePrefixFromString");var pIn=a((e,t)=>{let r=t;if(r.includes(e)){const n=new RegExp(`[a-zA-Z0-9-_.\\/]+(${e})`,"g");r=r.replace(n,"")}return r},"cleanFilePathsInMessage");var wQ=a((e,t,r)=>{if(!e||e.length<=0){return e}const n=e.filter(i=>i.message!=='Could not resolve "@zuplo/runtime"');if(n&&n.length>0){n.forEach(i=>{if(i.location&&i.location.file){i.location.file=dIn(t,i.location.file)}if(i.location&&i.location.lineText&&i.location.lineText.includes("@zuplo/core/index.minified.js")){i.location.lineText=i.location.lineText.substring(0,200)+"...<Truncated>"}i.message=pIn(t,i.message);if(i.notes&&i.notes.length>0){delete i.notes}if(i.text){delete i.text}if(i.pluginName===""){i.pluginName=r}})}return n},"cleanDataOnBuildIssue");function fIn(e,t,r){try{if(e.buildTaskResult){if(e.buildTaskResult.errors){e.buildTaskResult.errors=wQ(e.buildTaskResult.errors,t,Sd.BUILD_TASK_PLUGIN_NAME)}if(e.buildTaskResult.warnings){e.buildTaskResult.warnings=wQ(e.buildTaskResult.warnings,t,Sd.BUILD_TASK_PLUGIN_NAME)}}if(e.compilerResult){if(e.compilerResult.errors){e.compilerResult.errors=wQ(e.compilerResult.errors,t,Sd.ESBUILD_PLUGIN_NAME)}if(e.compilerResult.warnings){e.compilerResult.warnings=wQ(e.compilerResult.warnings,t,Sd.ESBUILD_PLUGIN_NAME)}}}catch(n){r.error("Error while formatting buildResult. Err: ",n)}return e}a(fIn,"formatBuildResult");Sd.formatBuildResult=fIn});var UOt=y(TQ=>{"use strict";Object.defineProperty(TQ,"__esModule",{value:true});TQ.blockRemoteModulePlugin=void 0;var QOe="no-remote-module";function mIn({logger:e}){return{name:QOe,async setup(t){t.onResolve({filter:/^https?:\/\//},r=>{e.error(r,`User attempted to load a remote module`);return{errors:[{text:`Remote modules are not supported. Attempted to load module ${r.path}`,detail:"InvalidRemoteModule",pluginName:QOe,location:{line:0,column:0,file:""}}],pluginName:QOe}})}}}a(mIn,"blockRemoteModulePlugin");TQ.blockRemoteModulePlugin=mIn});var QE=y(ePe=>{"use strict";Object.defineProperty(ePe,"__esModule",{value:true});var ZOe=class{static{a(this,"Environment")}get DEV_SERVER_PORT(){return process.env.DEV_SERVER_PORT?parseInt(process.env.DEV_SERVER_PORT):3e3}get DEBUG_BUILD_MODE(){return!!process.env.DEBUG_BUILD_MODE}get EXPERIMENTAL_CODEGEN(){return!!process.env.EXPERIMENTAL_CODEGEN}};var hIn=new ZOe;ePe.default=hIn});var GOt=y(Rc=>{"use strict";var i7=Rc&&Rc.__importDefault||function(e){return e&&e.__esModule?e:{"default":e}};Object.defineProperty(Rc,"__esModule",{value:true});Rc.devPortalConfigPlugin=Rc.generateSource=Rc.DEV_PORTAL_LEGACY_PATHNAME=Rc.DEFAULT_DEV_PORTAL_PATHNAME=void 0;var tPe=vn();var $Ot=i7(require("fs/promises"));var xQ=i7(require("path"));var gIn=i7(require("prettier"));var yIn=Bn();var _In=i7(QE());var vIn=i7(xs());Rc.DEFAULT_DEV_PORTAL_PATHNAME="/docs";Rc.DEV_PORTAL_LEGACY_PATHNAME=`/__zuplo/dev-portal`;function EIn(e){let t=e.trim().toLowerCase();if(t.endsWith("/")){t=t.slice(0,-1)}return t}a(EIn,"normalizePathname");function jOt(e){const t={sitePathname:e?.sitePathname===Rc.DEV_PORTAL_LEGACY_PATHNAME?Rc.DEFAULT_DEV_PORTAL_PATHNAME:e?.sitePathname?EIn(e.sitePathname):Rc.DEFAULT_DEV_PORTAL_PATHNAME,enabled:e?e.enabled??true:false};const r=`module.exports = ${JSON.stringify(t)}`;return r}a(jOt,"generateSource");Rc.generateSource=jOt;function bIn(e){return{name:"dev-portal-config",setup(t){t.onResolve({filter:/dev-portal.json$/},r=>{return{namespace:"dev-portal-json",path:xQ.default.isAbsolute(r.path)?r.path:xQ.default.join(r.resolveDir,r.path),pluginName:"dev-portal"}});t.onLoad({filter:/.*/,namespace:"dev-portal-json"},async r=>{return vIn.default.timeFn("Generating dev-portal.json data",async()=>{let n;let i;if(await tPe.xfs.fileExists(r.path)){i=await $Ot.default.readFile(r.path,"utf-8");n=JSON.parse(i)}const s=[];if(n){const u=new tPe.DevPortalConfigValidator;const l=u.validate(n);if(!l.isValid){l.errors.forEach(c=>{const d={id:"dev-portal-build-error",text:`${c.instancePath} ${c.message}`,location:{file:"dev-portal.json",namespace:"dev-portal-json",line:1,column:0,length:0,lineText:"issue",suggestion:""},detail:"DevPortalValidationError",pluginName:"dev-portal",notes:[{text:`${c.instancePath} ${c.message}`,location:null}]};s.push(d)})}}let o;try{o=jOt(n);if(_In.default.DEBUG_BUILD_MODE&&o){if(await tPe.xfs.dirExists(e.sourceDirectory)){const u=await gIn.default.format(o,{parser:"babel"});await $Ot.default.writeFile(xQ.default.join(e.sourceDirectory,yIn.GENERATED_SOURCE_DIR_NAME,"dev-portal.js"),u)}}if(s&&s.length>0){throw s}}catch(u){if(u.length>0){u.forEach(l=>{const c={id:"dev-portal-build-error",text:l.message,location:{file:"dev-portal.json",namespace:"dev-portal-json",line:1,column:0,length:0,lineText:"issue",suggestion:""},detail:"DevPortalValidationError",pluginName:"dev-portal",notes:[{text:l.message,location:null}]};s.push(c)})}else{s.push({id:"dev-portal-build-error",text:u.message,location:{file:"dev-portal.json",namespace:"dev-portal-json",line:1,column:0,length:0,lineText:"issue",suggestion:""},detail:"DevPortalValidationError",pluginName:"dev-portal",notes:[{text:u.message,location:null}]})}}return{contents:o,errors:s,pluginName:"dev-portal",loader:"js",resolveDir:xQ.default.dirname(r.path),watchFiles:[r.path]}})})}}}a(bIn,"devPortalConfigPlugin");Rc.devPortalConfigPlugin=bIn});var KOt=y(BP=>{"use strict";var SIn=BP&&BP.__importDefault||function(e){return e&&e.__esModule?e:{"default":e}};Object.defineProperty(BP,"__esModule",{value:true});BP.environmentPlugin=void 0;var HOt=SIn(require("path"));var AIn=Bn();var VOt="legacy-environment";var zOt="legacy-environment";var CIn=`import { environment } from "@zuplo/runtime";
|
|
468
|
+
`;var jPn=a(async function({systemDirectory:e,logger:t,config:r}){return qPn.default.timeFn("Generating Worker shim",async()=>{t.debug("Generating Worker shim");const n=r?.flags?.esmWorker?$Pn:UPn;const i=MPn.default.join(e,e7.WORKER_ENTRY_NAME);try{await BPn.default.writeFile(i,n.trimStart(),"utf-8")}catch(s){t.error(s);const o={message:`Error creating file at ${i}`,pluginName:"generate-worker-entry",severity:"error"};return{warnings:[],errors:[o]}}return{warnings:[],errors:[]}})},"generateWorker");kP.generateWorker=jPn});var fOt=y(DP=>{"use strict";var pOt=DP&&DP.__importDefault||function(e){return e&&e.__esModule?e:{"default":e}};Object.defineProperty(DP,"__esModule",{value:true});DP.validateDevPortalJSON=void 0;var GPn=vn();var HPn=require("fs/promises");var cOt=pOt(require("path"));var dOt=Bn();var VPn=ru();var zPn=pOt(xs());var KPn=a(async function({logger:e,sourceDirectory:t}){return zPn.default.timeFn("Validate dev-portal.json file",async()=>{e.debug(`Validate dev-portal.json file`);const r=cOt.default.join(t,dOt.USER_CONFIG_DIR_NAME);const n=cOt.default.join(r,dOt.DEV_PORTAL_CONFIG_FILE);if(!await GPn.xfs.fileExists(n)){e.debug("Project is missing a dev-portal.json file. Skipping validate-dev-portal-json plugin.");return new VPn.PluginResult}const i=[];const s=await(0,HPn.readFile)(n,"utf-8");const o=JSON.parse(s);if(o.enableAuthentication&&o.authentication){const{provider:u}=o.authentication;if(u&&u!=="auth0"&&u!=="okta"&&u!=="azure-ad"&&u!=="clerk"&&u!=="oidc"&&u!=="external"){i.push({message:"The authentication setting 'provider' is not set or invalid. Valid values are 'auth0', 'okta', 'azure-ad', 'clerk', 'oidc', or 'external'.",pluginName:"validate-dev-portal-json",severity:"warning"})}if(u==="external"){const{loginUrl:l,logoutUrl:c}=o.authentication;if(l===void 0||l.trim().length===0){i.push({message:"The authentication setting for 'loginUrl' is not set or is invalid.",pluginName:"validate-dev-portal-json",severity:"warning"})}else if(l.startsWith("$env(")&&!l.startsWith("$env(ZUPLO_PUBLIC_")){i.push({message:"'loginUrl' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration.",pluginName:"validate-dev-portal-json",severity:"warning"})}if(c===void 0||c.trim().length===0){i.push({message:"The authentication setting for 'logoutUrl' is not set or is invalid.",pluginName:"validate-dev-portal-json",severity:"warning"})}else if(c.startsWith("$env(")&&!c.startsWith("$env(ZUPLO_PUBLIC_")){i.push({message:"'logoutUrl' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration.",pluginName:"validate-dev-portal-json",severity:"warning"})}}else{const{authority:l}=o.authentication;if(o.authentication.devPortalClient){const{clientId:c,audience:d}=o.authentication.devPortalClient;if(d&&d.startsWith("$env(")&&!d.startsWith("$env(ZUPLO_PUBLIC_")){i.push({message:"'audience' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration.",pluginName:"validate-dev-portal-json",severity:"warning"})}if(l===void 0||l.trim().length===0){i.push({message:"The authentication setting for 'authority' is not set or is invalid.",pluginName:"validate-dev-portal-json",severity:"warning"})}else if(l.startsWith("$env(")&&!l.startsWith("$env(ZUPLO_PUBLIC_")){i.push({message:"'authority' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration.",pluginName:"validate-dev-portal-json",severity:"warning"})}if(c===void 0||c.trim().length===0){i.push({message:"The authentication setting for 'clientId' is not set or is invalid.",pluginName:"validate-dev-portal-json",severity:"warning"})}else if(c.startsWith("$env(")&&!c.startsWith("$env(ZUPLO_PUBLIC_")){i.push({message:"'clientId' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration.",pluginName:"validate-dev-portal-json",severity:"warning"})}}}}if(o.enableMonetization&&o.monetization){const{provider:u}=o.monetization;if(!u||u.trim().length===0||u!=="stripe"){i.push({message:"The monetization setting 'provider' is not set or invalid. Valid values are 'stripe'.",pluginName:"validate-dev-portal-json",severity:"warning"})}if(u==="stripe"){const{pricingTableId:l,publishableKey:c,secretKey:d}=o.monetization;if(!l||l.trim().length===0){i.push({message:"The monetization setting for 'Pricing Table Id' is not set or is invalid. Field monetization.pricingTableId in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"})}else if(l.startsWith("$env(")){if(!l.startsWith("$env(ZUPLO_PUBLIC_")){i.push({message:"'Pricing Table Id' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration. Field monetization.pricingTableId in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"})}}else if(!l.startsWith("prctbl_")){i.push({message:"'Pricing Table Id' field must start with prctbl_. Field monetization.pricingTableId in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"})}if(!c||c.trim().length===0){i.push({message:"The monetization setting for 'Publishable Key' is not set or is invalid. Field monetization.publishableKey in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"})}else if(c.startsWith("$env(")){if(!c.startsWith("$env(ZUPLO_PUBLIC_")){i.push({message:"'Publishable Key' field contains an invalid environment variable. Only variables prefixed with 'ZUPLO_PUBLIC_' can be used in developer portal configuration. Field monetization.publishableKey in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"})}}else if(!c.startsWith("pk_")){i.push({message:"'Publishable Key' field must start with pk_. Field monetization.publishableKey in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"})}if(!d||d.trim().length===0){i.push({message:"The monetization setting for 'Secret Key' is not set or is invalid. Field monetization.secretKey in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"})}else if(!d.startsWith("$env(")){i.push({message:"The monetization setting for 'Secret Key' must be an environment variable. Field monetization.secretKey in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"})}}}else if(o.enableMonetization&&!o.monetization){i.push({message:"Monetization was enabled but no monetization configuration was provider in dev-portal.json.",pluginName:"validate-dev-portal-json",severity:"warning"})}return{errors:[],warnings:i}})},"validateDevPortalJSON");DP.validateDevPortalJSON=KPn});var cC=y(Ed=>{"use strict";var mOt=Ed&&Ed.__importDefault||function(e){return e&&e.__esModule?e:{"default":e}};Object.defineProperty(Ed,"__esModule",{value:true});Ed.getFilePathNameFromRefName=Ed.getFullyQualifiedRefName=Ed.chaseRefs=Ed.oasFileInProject=Ed.getOpenApiFilesByAlphabetical=void 0;var hOt=mOt(require("fs/promises"));var yQ=mOt(require("path"));var gOt=Bn();var WPn=a(async e=>{const t=await hOt.default.readdir(e);return t.map(r=>`${e}/${r}`).filter(r=>r.endsWith(gOt.OPEN_API_FILE_SUFFIX)).sort()},"getOpenApiFilesByAlphabetical");Ed.getOpenApiFilesByAlphabetical=WPn;var YPn=a(async e=>{const t=yQ.default.resolve(e,"config");const r=await hOt.default.readdir(t);return r.filter(n=>n.endsWith(gOt.OPEN_API_FILE_SUFFIX)).length>=1},"oasFileInProject");Ed.oasFileInProject=YPn;function yOt(e,t,r,n,i,s,o){if(s.has(r)){return}const u=n.get(r);s.set(r,i.length);i.push(r);HOe(vOt(r),t,u,n,i,s,o)}a(yOt,"chaseRefs");Ed.chaseRefs=yOt;function HOe(e,t,r,n,i,s,o){if(Array.isArray(r)){for(const u of r){HOe(e,t,u,n,i,s,o)}}else if(typeof r==="object"){for(const u in r){if(u==="$ref"){const l=r[u];if(o){r[u]=o(t,l)}yOt(e,t,_Ot(e,l),n,i,s,o)}HOe(e,t,r[u],n,i,s,o)}}}a(HOe,"lookForRefs");function _Ot(e,t){const r=t.indexOf("#");if(r>=0){return`${yQ.default.resolve(e,t.substring(0,r))}${t.substring(r)}`}else{return yQ.default.resolve(yQ.default.dirname(e),t)}}a(_Ot,"getFullyQualifiedRefName");Ed.getFullyQualifiedRefName=_Ot;function vOt(e){const t=e.indexOf("#");if(t>=0){return e.substring(0,t)}else{return e}}a(vOt,"getFilePathNameFromRefName");Ed.getFilePathNameFromRefName=vOt});var COt=y(LP=>{"use strict";var AOt=LP&&LP.__importDefault||function(e){return e&&e.__esModule?e:{"default":e}};Object.defineProperty(LP,"__esModule",{value:true});LP.validateOpenAPIFiles=void 0;var EOt=AOt(require("path"));var XPn=Bn();var bOt=ru();var JPn=AOt(xs());var QPn=cC();var SOt=require("fs/promises");var _Q="validate-open-api-files";var ZPn=a(async function({sourceDirectory:e,logger:t}){return JPn.default.timeFn("Building OpenAPI files to build output",async()=>{t.debug("Building OpenAPI files to build output");const r=EOt.default.join(e,XPn.USER_CONFIG_DIR_NAME);const n=[];try{const i=await(0,QPn.oasFileInProject)(e);if(!i){return new bOt.PluginResult({message:"Failed to build project because no open-api file was found on the 'config' folder",pluginName:_Q,severity:"error"})}const s=await(0,SOt.readdir)(r);const o=s.filter(u=>u.endsWith(".oas.json"));for(const u of o){const l=EOt.default.join(r,u);try{if(u==="zp.oas.json"){n.push({message:`Open API files cannot be named 'zp.oas.json' since 'zp' is a reserved prefix. Update the file name to solve this build issue.`,pluginName:_Q,severity:"error"})}const c=await(0,SOt.readFile)(l,"utf-8");const d=JSON.parse(c);if(d&&d.paths){const p=Object.entries(d.paths).filter(f=>{if(f[0]==="zp"||f[0]==="/zp"){return true}return false});if(p.length>0){const f=p.length===1?"includes one route path":`includes '${p.length}' routes`;n.push({message:`Open API file '${u}' ${f} that's named '/zp' which is a reserved route name. Updating the route to something other than '/zp' will solve this build issue.`,pluginName:_Q,severity:"error"})}}}catch(c){t.error(c)}}}catch(i){t.error(i);if(n.length>0){return{errors:n,warnings:[]}}else{return new bOt.PluginResult({message:"Failed while validating the open api files in the project",pluginName:_Q,severity:"warning"})}}return{errors:n,warnings:[]}})},"validateOpenAPIFiles");LP.validateOpenAPIFiles=ZPn});var WOe=y(KOe=>{"use strict";Object.defineProperty(KOe,"__esModule",{value:true});var eNn=require("vm");function tNn(e){return e&&typeof e==="object"&&"default"in e?e:{"default":e}}a(tNn,"_interopDefaultLegacy");var rNn=tNn(eNn);var{hasOwnProperty:bd}=Object.prototype;function dC(e,t){e=e.slice();e.push(t);return e}a(dC,"push");function VOe(e,t){t=t.slice();t.unshift(e);return t}a(VOe,"unshift");var zOe=class extends Error{static{a(this,"NewError")}constructor(t){super('JSONPath should not be called with "new" (it prevents return of (unwrapped) scalar values)');this.avoidNew=true;this.value=t;this.name="NewError"}};function Ds(e,t,r,n,i){if(!(this instanceof Ds)){try{return new Ds(e,t,r,n,i)}catch(o){if(!o.avoidNew){throw o}return o.value}}if(typeof e==="string"){i=n;n=r;r=t;t=e;e=null}const s=e&&typeof e==="object";e=e||{};this.json=e.json||r;this.path=e.path||t;this.resultType=e.resultType||"value";this.flatten=e.flatten||false;this.wrap=bd.call(e,"wrap")?e.wrap:true;this.sandbox=e.sandbox||{};this.preventEval=e.preventEval||false;this.parent=e.parent||null;this.parentProperty=e.parentProperty||null;this.callback=e.callback||n||null;this.otherTypeCallback=e.otherTypeCallback||i||function(){throw new TypeError("You must supply an otherTypeCallback callback option with the @other() operator.")};if(e.autostart!==false){const o={path:s?e.path:t};if(!s){o.json=r}else if("json"in e){o.json=e.json}const u=this.evaluate(o);if(!u||typeof u!=="object"){throw new zOe(u)}return u}}a(Ds,"JSONPath");Ds.prototype.evaluate=function(e,t,r,n){let i=this.parent,s=this.parentProperty;let{flatten:o,wrap:u}=this;this.currResultType=this.resultType;this.currPreventEval=this.preventEval;this.currSandbox=this.sandbox;r=r||this.callback;this.currOtherTypeCallback=n||this.otherTypeCallback;t=t||this.json;e=e||this.path;if(e&&typeof e==="object"&&!Array.isArray(e)){if(!e.path&&e.path!==""){throw new TypeError('You must supply a "path" property when providing an object argument to JSONPath.evaluate().')}if(!bd.call(e,"json")){throw new TypeError('You must supply a "json" property when providing an object argument to JSONPath.evaluate().')}({json:t}=e);o=bd.call(e,"flatten")?e.flatten:o;this.currResultType=bd.call(e,"resultType")?e.resultType:this.currResultType;this.currSandbox=bd.call(e,"sandbox")?e.sandbox:this.currSandbox;u=bd.call(e,"wrap")?e.wrap:u;this.currPreventEval=bd.call(e,"preventEval")?e.preventEval:this.currPreventEval;r=bd.call(e,"callback")?e.callback:r;this.currOtherTypeCallback=bd.call(e,"otherTypeCallback")?e.otherTypeCallback:this.currOtherTypeCallback;i=bd.call(e,"parent")?e.parent:i;s=bd.call(e,"parentProperty")?e.parentProperty:s;e=e.path}i=i||null;s=s||null;if(Array.isArray(e)){e=Ds.toPathString(e)}if(!e&&e!==""||!t){return void 0}const l=Ds.toPathArray(e);if(l[0]==="$"&&l.length>1){l.shift()}this._hasParentSelector=null;const c=this._trace(l,t,["$"],i,s,r).filter(function(d){return d&&!d.isParentSelector});if(!c.length){return u?[]:void 0}if(!u&&c.length===1&&!c[0].hasArrExpr){return this._getPreferredOutput(c[0])}return c.reduce((d,p)=>{const f=this._getPreferredOutput(p);if(o&&Array.isArray(f)){d=d.concat(f)}else{d.push(f)}return d},[])};Ds.prototype._getPreferredOutput=function(e){const t=this.currResultType;switch(t){case"all":{const r=Array.isArray(e.path)?e.path:Ds.toPathArray(e.path);e.pointer=Ds.toPointer(r);e.path=typeof e.path==="string"?e.path:Ds.toPathString(e.path);return e}case"value":case"parent":case"parentProperty":return e[t];case"path":return Ds.toPathString(e[t]);case"pointer":return Ds.toPointer(e.path);default:throw new TypeError("Unknown result type")}};Ds.prototype._handleCallback=function(e,t,r){if(t){const n=this._getPreferredOutput(e);e.path=typeof e.path==="string"?e.path:Ds.toPathString(e.path);t(n,r,e)}};Ds.prototype._trace=function(e,t,r,n,i,s,o,u){let l;if(!e.length){l={path:r,value:t,parent:n,parentProperty:i,hasArrExpr:o};this._handleCallback(l,s,"value");return l}const c=e[0],d=e.slice(1);const p=[];function f(m){if(Array.isArray(m)){m.forEach(h=>{p.push(h)})}else{p.push(m)}}a(f,"addRet");if((typeof c!=="string"||u)&&t&&bd.call(t,c)){f(this._trace(d,t[c],dC(r,c),t,c,s,o))}else if(c==="*"){this._walk(t,m=>{f(this._trace(d,t[m],dC(r,m),t,m,s,true,true))})}else if(c===".."){f(this._trace(d,t,r,n,i,s,o));this._walk(t,m=>{if(typeof t[m]==="object"){f(this._trace(e.slice(),t[m],dC(r,m),t,m,s,true))}})}else if(c==="^"){this._hasParentSelector=true;return{path:r.slice(0,-1),expr:d,isParentSelector:true}}else if(c==="~"){l={path:dC(r,c),value:i,parent:n,parentProperty:null};this._handleCallback(l,s,"property");return l}else if(c==="$"){f(this._trace(d,t,r,null,null,s,o))}else if(/^(-?\d*):(-?\d*):?(\d*)$/u.test(c)){f(this._slice(c,d,t,r,n,i,s))}else if(c.indexOf("?(")===0){if(this.currPreventEval){throw new Error("Eval [?(expr)] prevented in JSONPath expression.")}const m=c.replace(/^\?\((.*?)\)$/u,"$1");this._walk(t,h=>{if(this._eval(m,t[h],h,r,n,i)){f(this._trace(d,t[h],dC(r,h),t,h,s,true))}})}else if(c[0]==="("){if(this.currPreventEval){throw new Error("Eval [(expr)] prevented in JSONPath expression.")}f(this._trace(VOe(this._eval(c,t,r[r.length-1],r.slice(0,-1),n,i),d),t,r,n,i,s,o))}else if(c[0]==="@"){let m=false;const h=c.slice(1,-2);switch(h){case"scalar":if(!t||!["object","function"].includes(typeof t)){m=true}break;case"boolean":case"string":case"undefined":case"function":if(typeof t===h){m=true}break;case"integer":if(Number.isFinite(t)&&!(t%1)){m=true}break;case"number":if(Number.isFinite(t)){m=true}break;case"nonFinite":if(typeof t==="number"&&!Number.isFinite(t)){m=true}break;case"object":if(t&&typeof t===h){m=true}break;case"array":if(Array.isArray(t)){m=true}break;case"other":m=this.currOtherTypeCallback(t,r,n,i);break;case"null":if(t===null){m=true}break;default:throw new TypeError("Unknown value type "+h)}if(m){l={path:r,value:t,parent:n,parentProperty:i};this._handleCallback(l,s,"value");return l}}else if(c[0]==="`"&&t&&bd.call(t,c.slice(1))){const m=c.slice(1);f(this._trace(d,t[m],dC(r,m),t,m,s,o,true))}else if(c.includes(",")){const m=c.split(",");for(const h of m){f(this._trace(VOe(h,d),t,r,n,i,s,true))}}else if(!u&&t&&bd.call(t,c)){f(this._trace(d,t[c],dC(r,c),t,c,s,o,true))}if(this._hasParentSelector){for(let m=0;m<p.length;m++){const h=p[m];if(h&&h.isParentSelector){const g=this._trace(h.expr,t,h.path,n,i,s,o);if(Array.isArray(g)){p[m]=g[0];const _=g.length;for(let v=1;v<_;v++){m++;p.splice(m,0,g[v])}}else{p[m]=g}}}}return p};Ds.prototype._walk=function(e,t){if(Array.isArray(e)){const r=e.length;for(let n=0;n<r;n++){t(n)}}else if(e&&typeof e==="object"){Object.keys(e).forEach(r=>{t(r)})}};Ds.prototype._slice=function(e,t,r,n,i,s,o){if(!Array.isArray(r)){return void 0}const u=r.length,l=e.split(":"),c=l[2]&&Number.parseInt(l[2])||1;let d=l[0]&&Number.parseInt(l[0])||0,p=l[1]&&Number.parseInt(l[1])||u;d=d<0?Math.max(0,d+u):Math.min(u,d);p=p<0?Math.max(0,p+u):Math.min(u,p);const f=[];for(let m=d;m<p;m+=c){const h=this._trace(VOe(m,t),r,n,i,s,o,true);h.forEach(g=>{f.push(g)})}return f};Ds.prototype._eval=function(e,t,r,n,i,s){this.currSandbox._$_parentProperty=s;this.currSandbox._$_parent=i;this.currSandbox._$_property=r;this.currSandbox._$_root=this.json;this.currSandbox._$_v=t;const o=e.includes("@path");if(o){this.currSandbox._$_path=Ds.toPathString(n.concat([r]))}const u="script:"+e;if(!Ds.cache[u]){let l=e.replace(/@parentProperty/gu,"_$_parentProperty").replace(/@parent/gu,"_$_parent").replace(/@property/gu,"_$_property").replace(/@root/gu,"_$_root").replace(/@([.\s)[])/gu,"_$_v$1");if(o){l=l.replace(/@path/gu,"_$_path")}Ds.cache[u]=new this.vm.Script(l)}try{return Ds.cache[u].runInNewContext(this.currSandbox)}catch(l){throw new Error("jsonPath: "+l.message+": "+e)}};Ds.cache={};Ds.toPathString=function(e){const t=e,r=t.length;let n="$";for(let i=1;i<r;i++){if(!/^(~|\^|@.*?\(\))$/u.test(t[i])){n+=/^[0-9*]+$/u.test(t[i])?"["+t[i]+"]":"['"+t[i]+"']"}}return n};Ds.toPointer=function(e){const t=e,r=t.length;let n="";for(let i=1;i<r;i++){if(!/^(~|\^|@.*?\(\))$/u.test(t[i])){n+="/"+t[i].toString().replace(/~/gu,"~0").replace(/\//gu,"~1")}}return n};Ds.toPathArray=function(e){const{cache:t}=Ds;if(t[e]){return t[e].concat()}const r=[];const n=e.replace(/@(?:null|boolean|number|string|integer|undefined|nonFinite|scalar|array|object|function|other)\(\)/gu,";$&;").replace(/[['](\??\(.*?\))[\]']/gu,function(s,o){return"[#"+(r.push(o)-1)+"]"}).replace(/\[['"]([^'\]]*)['"]\]/gu,function(s,o){return"['"+o.replace(/\./gu,"%@%").replace(/~/gu,"%%@@%%")+"']"}).replace(/~/gu,";~;").replace(/['"]?\.['"]?(?![^[]*\])|\[['"]?/gu,";").replace(/%@%/gu,".").replace(/%%@@%%/gu,"~").replace(/(?:;)?(\^+)(?:;)?/gu,function(s,o){return";"+o.split("").join(";")+";"}).replace(/;;;|;;/gu,";..;").replace(/;$|'?\]|'$/gu,"");const i=n.split(";").map(function(s){const o=s.match(/#(\d+)/u);return!o||!o[1]?s:r[o[1]]});t[e]=i;return t[e].concat()};Ds.prototype.vm=rNn["default"];KOe.JSONPath=Ds});var wOt=y(FP=>{"use strict";var YOe=FP&&FP.__importDefault||function(e){return e&&e.__esModule?e:{"default":e}};Object.defineProperty(FP,"__esModule",{value:true});FP.verifyWorkerOutput=void 0;var nNn=require("@swc/core");var iNn=vn();var sNn=WOe();var aNn=YOe(require("fs/promises"));var oNn=YOe(require("path"));var uNn=YOe(xs());var lNn=a(async function({outputDirectory:e,logger:t}){return uNn.default.timeFn("Verify Worker output",async()=>{t.debug("Verify Worker output");const r=oNn.default.join(e,"worker.js");try{if(await iNn.xfs.fileExists(r)){const n=await aNn.default.readFile(r,"utf-8");const i=await(0,nNn.parse)(n,{syntax:"ecmascript"});const s=(0,sNn.JSONPath)({path:"$..callee[?(@property === 'value' && (@ === 'Function'|| @ === 'eval'))]^",json:i.body});if(s&&s.length>0){const o={message:"We do not support the use of 'eval' or 'new Function(...)'",severity:"warning",pluginName:"verify-worker-output"};return{warnings:[o],errors:[]}}}}catch(n){t.error(n);const i={message:`Error validating build output : ${n.message}`,severity:"error",pluginName:"verify-worker-output"};return{warnings:[],errors:[i]}}return{warnings:[],errors:[]}})},"verifyWorkerOutput");FP.verifyWorkerOutput=lNn});var EQ=y(vQ=>{"use strict";Object.defineProperty(vQ,"__esModule",{value:true});vQ.CompilerResult=void 0;var t7=vn();var cNn=require("crypto");var XOe=class{static{a(this,"CompilerResult")}buildId;buildTime;buildTimeMs;errors;warnings;status;assets;metafile;constructor(t,r){this.buildId=r?.buildId??(0,cNn.randomUUID)();this.buildTime=r?.startBuildTime.toISOString();this.buildTimeMs=r?.endBuildTime.getTime()-r?.startBuildTime.getTime();this.errors=t.errors.map(n=>({message:n.text,severity:t7.ERROR_SEVERITY,...n}));this.warnings=t.warnings.map(n=>({message:n.text,severity:t7.WARNING_SEVERITY,...n}));if(t.metafile){this.metafile=t.metafile}this.status=t7.GOOD_STATUS;if(this.warnings&&this.warnings.length>0){this.status=t7.WARNING_STATUS}if(this.errors&&this.errors.length>0){this.status=t7.FAILURE_STATUS}}};vQ.CompilerResult=XOe});var DOt=y(vt=>{"use strict";Object.defineProperty(vt,"__esModule",{value:true});vt.generateColor=vt.colorFunctions=vt.stripColor=vt.bgRgb24=vt.rgb24=vt.bgRgb8=vt.rgb8=vt.bgBrightWhite=vt.bgBrightCyan=vt.bgBrightMagenta=vt.bgBrightBlue=vt.bgBrightYellow=vt.bgBrightGreen=vt.bgBrightRed=vt.bgBrightBlack=vt.bgWhite=vt.bgCyan=vt.bgMagenta=vt.bgBlue=vt.bgYellow=vt.bgGreen=vt.bgRed=vt.bgBlack=vt.brightWhite=vt.brightCyan=vt.brightMagenta=vt.brightBlue=vt.brightYellow=vt.brightGreen=vt.brightRed=vt.brightBlack=vt.gray=vt.white=vt.cyan=vt.magenta=vt.blue=vt.yellow=vt.green=vt.red=vt.black=vt.strikethrough=vt.hidden=vt.inverse=vt.underline=vt.italic=vt.dim=vt.bold=vt.reset=vt.getColorEnabled=vt.setColorEnabled=void 0;var TOt=true;var JOe=!TOt;function dNn(e){if(TOt){return}JOe=e}a(dNn,"setColorEnabled");vt.setColorEnabled=dNn;function pNn(){return JOe}a(pNn,"getColorEnabled");vt.getColorEnabled=pNn;function sn(e,t){return{open:`\x1B[${e.join(";")}m`,close:`\x1B[${t}m`,regexp:new RegExp(`\\x1b\\[${t}m`,"g")}}a(sn,"code");function an(e,t){return JOe?`${t.open}${e.replace(t.regexp,t.open)}${t.close}`:e}a(an,"run");function fNn(e){return an(e,sn([0],0))}a(fNn,"reset");vt.reset=fNn;function mNn(e){return an(e,sn([1],22))}a(mNn,"bold");vt.bold=mNn;function hNn(e){return an(e,sn([2],22))}a(hNn,"dim");vt.dim=hNn;function gNn(e){return an(e,sn([3],23))}a(gNn,"italic");vt.italic=gNn;function yNn(e){return an(e,sn([4],24))}a(yNn,"underline");vt.underline=yNn;function _Nn(e){return an(e,sn([7],27))}a(_Nn,"inverse");vt.inverse=_Nn;function vNn(e){return an(e,sn([8],28))}a(vNn,"hidden");vt.hidden=vNn;function ENn(e){return an(e,sn([9],29))}a(ENn,"strikethrough");vt.strikethrough=ENn;function bNn(e){return an(e,sn([30],39))}a(bNn,"black");vt.black=bNn;function xOt(e){return an(e,sn([31],39))}a(xOt,"red");vt.red=xOt;function ROt(e){return an(e,sn([32],39))}a(ROt,"green");vt.green=ROt;function OOt(e){return an(e,sn([33],39))}a(OOt,"yellow");vt.yellow=OOt;function POt(e){return an(e,sn([34],39))}a(POt,"blue");vt.blue=POt;function NOt(e){return an(e,sn([35],39))}a(NOt,"magenta");vt.magenta=NOt;function IOt(e){return an(e,sn([36],39))}a(IOt,"cyan");vt.cyan=IOt;function SNn(e){return an(e,sn([37],39))}a(SNn,"white");vt.white=SNn;function ANn(e){return kOt(e)}a(ANn,"gray");vt.gray=ANn;function kOt(e){return an(e,sn([90],39))}a(kOt,"brightBlack");vt.brightBlack=kOt;function CNn(e){return an(e,sn([91],39))}a(CNn,"brightRed");vt.brightRed=CNn;function wNn(e){return an(e,sn([92],39))}a(wNn,"brightGreen");vt.brightGreen=wNn;function TNn(e){return an(e,sn([93],39))}a(TNn,"brightYellow");vt.brightYellow=TNn;function xNn(e){return an(e,sn([94],39))}a(xNn,"brightBlue");vt.brightBlue=xNn;function RNn(e){return an(e,sn([95],39))}a(RNn,"brightMagenta");vt.brightMagenta=RNn;function ONn(e){return an(e,sn([96],39))}a(ONn,"brightCyan");vt.brightCyan=ONn;function PNn(e){return an(e,sn([97],39))}a(PNn,"brightWhite");vt.brightWhite=PNn;function NNn(e){return an(e,sn([40],49))}a(NNn,"bgBlack");vt.bgBlack=NNn;function INn(e){return an(e,sn([41],49))}a(INn,"bgRed");vt.bgRed=INn;function kNn(e){return an(e,sn([42],49))}a(kNn,"bgGreen");vt.bgGreen=kNn;function DNn(e){return an(e,sn([43],49))}a(DNn,"bgYellow");vt.bgYellow=DNn;function LNn(e){return an(e,sn([44],49))}a(LNn,"bgBlue");vt.bgBlue=LNn;function FNn(e){return an(e,sn([45],49))}a(FNn,"bgMagenta");vt.bgMagenta=FNn;function BNn(e){return an(e,sn([46],49))}a(BNn,"bgCyan");vt.bgCyan=BNn;function MNn(e){return an(e,sn([47],49))}a(MNn,"bgWhite");vt.bgWhite=MNn;function qNn(e){return an(e,sn([100],49))}a(qNn,"bgBrightBlack");vt.bgBrightBlack=qNn;function UNn(e){return an(e,sn([101],49))}a(UNn,"bgBrightRed");vt.bgBrightRed=UNn;function $Nn(e){return an(e,sn([102],49))}a($Nn,"bgBrightGreen");vt.bgBrightGreen=$Nn;function jNn(e){return an(e,sn([103],49))}a(jNn,"bgBrightYellow");vt.bgBrightYellow=jNn;function GNn(e){return an(e,sn([104],49))}a(GNn,"bgBrightBlue");vt.bgBrightBlue=GNn;function HNn(e){return an(e,sn([105],49))}a(HNn,"bgBrightMagenta");vt.bgBrightMagenta=HNn;function VNn(e){return an(e,sn([106],49))}a(VNn,"bgBrightCyan");vt.bgBrightCyan=VNn;function zNn(e){return an(e,sn([107],49))}a(zNn,"bgBrightWhite");vt.bgBrightWhite=zNn;function XE(e,t=255,r=0){return Math.trunc(Math.max(Math.min(e,t),r))}a(XE,"clampAndTruncate");function KNn(e,t){return an(e,sn([38,5,XE(t)],39))}a(KNn,"rgb8");vt.rgb8=KNn;function WNn(e,t){return an(e,sn([48,5,XE(t)],49))}a(WNn,"bgRgb8");vt.bgRgb8=WNn;function YNn(e,t){if(typeof t==="number"){return an(e,sn([38,2,t>>16&255,t>>8&255,t&255],39))}return an(e,sn([38,2,XE(t.r),XE(t.g),XE(t.b)],39))}a(YNn,"rgb24");vt.rgb24=YNn;function XNn(e,t){if(typeof t==="number"){return an(e,sn([48,2,t>>16&255,t>>8&255,t&255],49))}return an(e,sn([48,2,XE(t.r),XE(t.g),XE(t.b)],49))}a(XNn,"bgRgb24");vt.bgRgb24=XNn;var JNn=new RegExp(["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|"),"g");function QNn(e){return e.replace(JNn,"")}a(QNn,"stripColor");vt.stripColor=QNn;vt.colorFunctions=[xOt,ROt,OOt,POt,NOt,IOt];function ZNn(e){let t=0;const r=e.length;let n=0;if(r>0)while(n<r)t=(t<<5)-t+e.charCodeAt(n++)|0;return t}a(ZNn,"hashCode");function eIn(e){const t=Math.abs(ZNn(e));return vt.colorFunctions[t%vt.colorFunctions.length]}a(eIn,"generateColor");vt.generateColor=eIn});var LOt=y(bQ=>{"use strict";Object.defineProperty(bQ,"__esModule",{value:true});bQ.format=void 0;function tIn(e,t,...r){let n=0;const i=r.length;let s=String(t).replace(/%[sdjoO%]/g,o=>{if(o==="%%")return"%";if(n>=i)return o;switch(o){case"%s":return String(r[n++]);case"%d":return Number(r[n++]).toString();case"%o":return e(r[n++]).split("\n").map(u=>u.trim()).join(" ");case"%O":return e(r[n++]);case"%j":try{return JSON.stringify(r[n++])}catch{return"[Circular]"}default:return o}});for(const o of r.splice(n)){if(o===null||!(typeof o==="object"&&o!==null)){s+=" "+o}else{s+=" "+e(o)}}return s}a(tIn,"format");bQ.format=tIn});var FOt=y(SQ=>{"use strict";Object.defineProperty(SQ,"__esModule",{value:true});SQ.format=void 0;var rIn=require("util");var nIn=LOt();var iIn=a((e,...t)=>(0,nIn.format)(rIn.inspect,e,t),"format");SQ.format=iIn});var qOt=y(JE=>{"use strict";Object.defineProperty(JE,"__esModule",{value:true});JE.debug=JE.withoutEnv=JE.Debugger=void 0;var BOt=DOt();var sIn=FOt();var AQ=class{static{a(this,"Debugger")}manager;ns;color;last;enabled;constructor(t,r){(0,BOt.setColorEnabled)(true);this.manager=t;this.ns=r;this.color=(0,BOt.generateColor)(r);this.last=0;this.enabled=t.enabled.some(n=>n.test(r))}log(...t){if(!this.enabled)return;let r;const n=t[0];if(typeof n==="function"){r=n()}else{r=String(n)}const i=Date.now()-(this.last||Date.now());r=(0,sIn.format)(r,...t);const s=`${this.color(this.ns)} ${r} ${this.color(`+${i}ms`)}`;console.log(s);this.last=Date.now()}};JE.Debugger=AQ;var CQ=class{static{a(this,"DebugManager")}debuggers;enabled;constructor(t){this.debuggers=new Map;this.enabled=t??[]}};function MOt(e){if(!e||e.length===0)return[];e=e.replace(/\s/g,"").replace(/\*/g,".+");return e.split(",").map(t=>new RegExp(`^${t}$`))}a(MOt,"extract");var r7;function aIn(e){if(!e)e=[];if(typeof e==="string")e=MOt(e);r7=new CQ(e)}a(aIn,"withoutEnv");JE.withoutEnv=aIn;function oIn(e){if(!r7)r7=new CQ(MOt(process.env.DEBUG));const t=new AQ(r7,e);r7.debuggers.set(e,t);const r=Object.assign(t.log.bind(t),{self:t});return r}a(oIn,"debug");JE.debug=oIn});var n7=y(Sd=>{"use strict";Object.defineProperty(Sd,"__esModule",{value:true});Sd.formatBuildResult=Sd.getBuildEntry=Sd.BUILD_TASK_PLUGIN_NAME=Sd.ESBUILD_PLUGIN_NAME=void 0;var uIn=Bn();var lIn=VF();Sd.ESBUILD_PLUGIN_NAME="run-esbuild";Sd.BUILD_TASK_PLUGIN_NAME="build-task";function cIn(e){let t;if(e==lIn.TargetPlatform.Worker){t=uIn.WORKER_ENTRY_NAME}else{throw new Error(`Target platform ${e} not supported by this plugin.`)}return t}a(cIn,"getBuildEntry");Sd.getBuildEntry=cIn;var dIn=a((e,t)=>{let r=t;if(t.includes(e)){const n=new RegExp(`.*(${e})`,"g");r=t.replace(n,"")}if(r.match(/^(\/)?(\.\.(\/)?)+/)){r=r.replace(/^(\/)?(\.\.(\/)?)+/,"/")}return r},"removePrefixFromString");var pIn=a((e,t)=>{let r=t;if(r.includes(e)){const n=new RegExp(`[a-zA-Z0-9-_.\\/]+(${e})`,"g");r=r.replace(n,"")}return r},"cleanFilePathsInMessage");var wQ=a((e,t,r)=>{if(!e||e.length<=0){return e}const n=e.filter(i=>i.message!=='Could not resolve "@zuplo/runtime"');if(n&&n.length>0){n.forEach(i=>{if(i.location&&i.location.file){i.location.file=dIn(t,i.location.file)}if(i.location&&i.location.lineText&&i.location.lineText.includes("@zuplo/core/index.minified.js")){i.location.lineText=i.location.lineText.substring(0,200)+"...<Truncated>"}i.message=pIn(t,i.message);if(i.notes&&i.notes.length>0){delete i.notes}if(i.text){delete i.text}if(i.pluginName===""){i.pluginName=r}})}return n},"cleanDataOnBuildIssue");function fIn(e,t,r){try{if(e.buildTaskResult){if(e.buildTaskResult.errors){e.buildTaskResult.errors=wQ(e.buildTaskResult.errors,t,Sd.BUILD_TASK_PLUGIN_NAME)}if(e.buildTaskResult.warnings){e.buildTaskResult.warnings=wQ(e.buildTaskResult.warnings,t,Sd.BUILD_TASK_PLUGIN_NAME)}}if(e.compilerResult){if(e.compilerResult.errors){e.compilerResult.errors=wQ(e.compilerResult.errors,t,Sd.ESBUILD_PLUGIN_NAME)}if(e.compilerResult.warnings){e.compilerResult.warnings=wQ(e.compilerResult.warnings,t,Sd.ESBUILD_PLUGIN_NAME)}}}catch(n){r.error("Error while formatting buildResult. Err: ",n)}return e}a(fIn,"formatBuildResult");Sd.formatBuildResult=fIn});var UOt=y(TQ=>{"use strict";Object.defineProperty(TQ,"__esModule",{value:true});TQ.blockRemoteModulePlugin=void 0;var QOe="no-remote-module";function mIn({logger:e}){return{name:QOe,async setup(t){t.onResolve({filter:/^https?:\/\//},r=>{e.error(r,`User attempted to load a remote module`);return{errors:[{text:`Remote modules are not supported. Attempted to load module ${r.path}`,detail:"InvalidRemoteModule",pluginName:QOe,location:{line:0,column:0,file:""}}],pluginName:QOe}})}}}a(mIn,"blockRemoteModulePlugin");TQ.blockRemoteModulePlugin=mIn});var QE=y(ePe=>{"use strict";Object.defineProperty(ePe,"__esModule",{value:true});var ZOe=class{static{a(this,"Environment")}get DEV_SERVER_PORT(){return process.env.DEV_SERVER_PORT?parseInt(process.env.DEV_SERVER_PORT):3e3}get DEBUG_BUILD_MODE(){return!!process.env.DEBUG_BUILD_MODE}get EXPERIMENTAL_CODEGEN(){return!!process.env.EXPERIMENTAL_CODEGEN}};var hIn=new ZOe;ePe.default=hIn});var GOt=y(Rc=>{"use strict";var i7=Rc&&Rc.__importDefault||function(e){return e&&e.__esModule?e:{"default":e}};Object.defineProperty(Rc,"__esModule",{value:true});Rc.devPortalConfigPlugin=Rc.generateSource=Rc.DEV_PORTAL_LEGACY_PATHNAME=Rc.DEFAULT_DEV_PORTAL_PATHNAME=void 0;var tPe=vn();var $Ot=i7(require("fs/promises"));var xQ=i7(require("path"));var gIn=i7(require("prettier"));var yIn=Bn();var _In=i7(QE());var vIn=i7(xs());Rc.DEFAULT_DEV_PORTAL_PATHNAME="/docs";Rc.DEV_PORTAL_LEGACY_PATHNAME=`/__zuplo/dev-portal`;function EIn(e){let t=e.trim().toLowerCase();if(t.endsWith("/")){t=t.slice(0,-1)}return t}a(EIn,"normalizePathname");function jOt(e){const t={sitePathname:e?.sitePathname===Rc.DEV_PORTAL_LEGACY_PATHNAME?Rc.DEFAULT_DEV_PORTAL_PATHNAME:e?.sitePathname?EIn(e.sitePathname):Rc.DEFAULT_DEV_PORTAL_PATHNAME,enabled:e?e.enabled??true:false};const r=`module.exports = ${JSON.stringify(t)}`;return r}a(jOt,"generateSource");Rc.generateSource=jOt;function bIn(e){return{name:"dev-portal-config",setup(t){t.onResolve({filter:/dev-portal.json$/},r=>{return{namespace:"dev-portal-json",path:xQ.default.isAbsolute(r.path)?r.path:xQ.default.join(r.resolveDir,r.path),pluginName:"dev-portal"}});t.onLoad({filter:/.*/,namespace:"dev-portal-json"},async r=>{return vIn.default.timeFn("Generating dev-portal.json data",async()=>{let n;let i;if(await tPe.xfs.fileExists(r.path)){i=await $Ot.default.readFile(r.path,"utf-8");n=JSON.parse(i)}const s=[];if(n){const u=new tPe.DevPortalConfigValidator;const l=u.validate(n);if(!l.isValid){l.errors.forEach(c=>{const d={id:"dev-portal-build-error",text:`${c.instancePath} ${c.message}`,location:{file:"dev-portal.json",namespace:"dev-portal-json",line:1,column:0,length:0,lineText:"issue",suggestion:""},detail:"DevPortalValidationError",pluginName:"dev-portal",notes:[{text:`${c.instancePath} ${c.message}`,location:null}]};s.push(d)})}}let o;try{o=jOt(n);if(_In.default.DEBUG_BUILD_MODE&&o){if(await tPe.xfs.dirExists(e.sourceDirectory)){const u=await gIn.default.format(o,{parser:"babel"});await $Ot.default.writeFile(xQ.default.join(e.sourceDirectory,yIn.GENERATED_SOURCE_DIR_NAME,"dev-portal.js"),u)}}if(s&&s.length>0){throw s}}catch(u){if(u.length>0){u.forEach(l=>{const c={id:"dev-portal-build-error",text:l.message,location:{file:"dev-portal.json",namespace:"dev-portal-json",line:1,column:0,length:0,lineText:"issue",suggestion:""},detail:"DevPortalValidationError",pluginName:"dev-portal",notes:[{text:l.message,location:null}]};s.push(c)})}else{s.push({id:"dev-portal-build-error",text:u.message,location:{file:"dev-portal.json",namespace:"dev-portal-json",line:1,column:0,length:0,lineText:"issue",suggestion:""},detail:"DevPortalValidationError",pluginName:"dev-portal",notes:[{text:u.message,location:null}]})}}return{contents:o,errors:s,pluginName:"dev-portal",loader:"js",resolveDir:xQ.default.dirname(r.path),watchFiles:[r.path]}})})}}}a(bIn,"devPortalConfigPlugin");Rc.devPortalConfigPlugin=bIn});var KOt=y(BP=>{"use strict";var SIn=BP&&BP.__importDefault||function(e){return e&&e.__esModule?e:{"default":e}};Object.defineProperty(BP,"__esModule",{value:true});BP.environmentPlugin=void 0;var HOt=SIn(require("path"));var AIn=Bn();var VOt="legacy-environment";var zOt="legacy-environment";var CIn=`import { environment } from "@zuplo/runtime";
|
|
469
469
|
export default environment;`;function wIn(e){return{name:"environment",setup(t){t.onResolve({filter:/@app\/environment$/},()=>{return{namespace:zOt,pluginName:VOt,path:HOt.default.join(e.sourceDirectory,AIn.GENERATED_SOURCE_DIR_NAME,"environment.js")}});t.onLoad({filter:/.*/,namespace:zOt},async r=>{return{contents:CIn,loader:"ts",resolveDir:HOt.default.dirname(r.path),pluginName:VOt}})}}}a(wIn,"environmentPlugin");BP.environmentPlugin=wIn});var MP=y(ts=>{"use strict";Object.defineProperty(ts,"__esModule",{value:true});ts.regexpCode=ts.getEsmExportName=ts.getProperty=ts.safeStringify=ts.stringify=ts.strConcat=ts.addCodeArg=ts.str=ts._=ts.nil=ts._Code=ts.Name=ts.IDENTIFIER=ts._CodeOrName=void 0;var s7=class{static{a(this,"_CodeOrName")}};ts._CodeOrName=s7;ts.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;var pC=class extends s7{static{a(this,"Name")}constructor(t){super();if(!ts.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return false}get names(){return{[this.str]:1}}};ts.Name=pC;var qf=class extends s7{static{a(this,"_Code")}constructor(t){super();this._items=typeof t==="string"?[t]:t}toString(){return this.str}emptyStr(){if(this._items.length>1)return false;const t=this._items[0];return t===""||t==='""'}get str(){var t;return(t=this._str)!==null&&t!==void 0?t:this._str=this._items.reduce((r,n)=>`${r}${n}`,"")}get names(){var t;return(t=this._names)!==null&&t!==void 0?t:this._names=this._items.reduce((r,n)=>{if(n instanceof pC)r[n.str]=(r[n.str]||0)+1;return r},{})}};ts._Code=qf;ts.nil=new qf("");function WOt(e,...t){const r=[e[0]];let n=0;while(n<t.length){nPe(r,t[n]);r.push(e[++n])}return new qf(r)}a(WOt,"_");ts._=WOt;var rPe=new qf("+");function YOt(e,...t){const r=[a7(e[0])];let n=0;while(n<t.length){r.push(rPe);nPe(r,t[n]);r.push(rPe,a7(e[++n]))}TIn(r);return new qf(r)}a(YOt,"str");ts.str=YOt;function nPe(e,t){if(t instanceof qf)e.push(...t._items);else if(t instanceof pC)e.push(t);else e.push(OIn(t))}a(nPe,"addCodeArg");ts.addCodeArg=nPe;function TIn(e){let t=1;while(t<e.length-1){if(e[t]===rPe){const r=xIn(e[t-1],e[t+1]);if(r!==void 0){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}a(TIn,"optimize");function xIn(e,t){if(t==='""')return e;if(e==='""')return t;if(typeof e=="string"){if(t instanceof pC||e[e.length-1]!=='"')return;if(typeof t!="string")return`${e.slice(0,-1)}${t}"`;if(t[0]==='"')return e.slice(0,-1)+t.slice(1);return}if(typeof t=="string"&&t[0]==='"'&&!(e instanceof pC))return`"${e}${t.slice(1)}`;return}a(xIn,"mergeExprItems");function RIn(e,t){return t.emptyStr()?e:e.emptyStr()?t:YOt`${e}${t}`}a(RIn,"strConcat");ts.strConcat=RIn;function OIn(e){return typeof e=="number"||typeof e=="boolean"||e===null?e:a7(Array.isArray(e)?e.join(","):e)}a(OIn,"interpolate");function PIn(e){return new qf(a7(e))}a(PIn,"stringify");ts.stringify=PIn;function a7(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}a(a7,"safeStringify");ts.safeStringify=a7;function NIn(e){return typeof e=="string"&&ts.IDENTIFIER.test(e)?new qf(`.${e}`):WOt`[${e}]`}a(NIn,"getProperty");ts.getProperty=NIn;function IIn(e){if(typeof e=="string"&&ts.IDENTIFIER.test(e)){return new qf(`${e}`)}throw new Error(`CodeGen: invalid export name: ${e}, use explicit $id name mapping`)}a(IIn,"getEsmExportName");ts.getEsmExportName=IIn;function kIn(e){return new qf(e.toString())}a(kIn,"regexpCode");ts.regexpCode=kIn});var PQ=y(Oc=>{"use strict";Object.defineProperty(Oc,"__esModule",{value:true});Oc.ValueScope=Oc.ValueScopeName=Oc.Scope=Oc.varKinds=Oc.UsedValueState=void 0;var Ad=MP();var iPe=class extends Error{static{a(this,"ValueError")}constructor(t){super(`CodeGen: "code" for ${t} not defined`);this.value=t.value}};var sPe;(function(e){e[e["Started"]=0]="Started";e[e["Completed"]=1]="Completed"})(sPe=Oc.UsedValueState||(Oc.UsedValueState={}));Oc.varKinds={const:new Ad.Name("const"),let:new Ad.Name("let"),var:new Ad.Name("var")};var RQ=class{static{a(this,"Scope")}constructor({prefixes:t,parent:r}={}){this._names={};this._prefixes=t;this._parent=r}toName(t){return t instanceof Ad.Name?t:this.name(t)}name(t){return new Ad.Name(this._newName(t))}_newName(t){const r=this._names[t]||this._nameGroup(t);return`${t}${r.index++}`}_nameGroup(t){var r,n;if(((n=(r=this._parent)===null||r===void 0?void 0:r._prefixes)===null||n===void 0?void 0:n.has(t))||this._prefixes&&!this._prefixes.has(t)){throw new Error(`CodeGen: prefix "${t}" is not allowed in this scope`)}return this._names[t]={prefix:t,index:0}}};Oc.Scope=RQ;var OQ=class extends Ad.Name{static{a(this,"ValueScopeName")}constructor(t,r){super(r);this.prefix=t}setValue(t,{property:r,itemIndex:n}){this.value=t;this.scopePath=(0,Ad._)`.${new Ad.Name(r)}[${n}]`}};Oc.ValueScopeName=OQ;var DIn=(0,Ad._)`\n`;var aPe=class extends RQ{static{a(this,"ValueScope")}constructor(t){super(t);this._values={};this._scope=t.scope;this.opts={...t,_n:t.lines?DIn:Ad.nil}}get(){return this._scope}name(t){return new OQ(t,this._newName(t))}value(t,r){var n;if(r.ref===void 0)throw new Error("CodeGen: ref must be passed in value");const i=this.toName(t);const{prefix:s}=i;const o=(n=r.key)!==null&&n!==void 0?n:r.ref;let u=this._values[s];if(u){const d=u.get(o);if(d)return d}else{u=this._values[s]=new Map}u.set(o,i);const l=this._scope[s]||(this._scope[s]=[]);const c=l.length;l[c]=r.ref;i.setValue(r,{property:s,itemIndex:c});return i}getValue(t,r){const n=this._values[t];if(!n)return;return n.get(r)}scopeRefs(t,r=this._values){return this._reduceValues(r,n=>{if(n.scopePath===void 0)throw new Error(`CodeGen: name "${n}" has no value`);return(0,Ad._)`${t}${n.scopePath}`})}scopeCode(t=this._values,r,n){return this._reduceValues(t,i=>{if(i.value===void 0)throw new Error(`CodeGen: name "${i}" has no value`);return i.value.code},r,n)}_reduceValues(t,r,n={},i){let s=Ad.nil;for(const o in t){const u=t[o];if(!u)continue;const l=n[o]=n[o]||new Map;u.forEach(c=>{if(l.has(c))return;l.set(c,sPe.Started);let d=r(c);if(d){const p=this.opts.es5?Oc.varKinds.var:Oc.varKinds.const;s=(0,Ad._)`${s}${p} ${c} = ${d};${this.opts._n}`}else if(d=i===null||i===void 0?void 0:i(c)){s=(0,Ad._)`${s}${d}${this.opts._n}`}else{throw new iPe(c)}l.set(c,sPe.Completed)})}return s}};Oc.ValueScope=aPe});var En=y(Wn=>{"use strict";Object.defineProperty(Wn,"__esModule",{value:true});Wn.or=Wn.and=Wn.not=Wn.CodeGen=Wn.operators=Wn.varKinds=Wn.ValueScopeName=Wn.ValueScope=Wn.Scope=Wn.Name=Wn.regexpCode=Wn.stringify=Wn.getProperty=Wn.nil=Wn.strConcat=Wn.str=Wn._=void 0;var xi=MP();var vh=PQ();var ZE=MP();Object.defineProperty(Wn,"_",{enumerable:true,get:function(){return ZE._}});Object.defineProperty(Wn,"str",{enumerable:true,get:function(){return ZE.str}});Object.defineProperty(Wn,"strConcat",{enumerable:true,get:function(){return ZE.strConcat}});Object.defineProperty(Wn,"nil",{enumerable:true,get:function(){return ZE.nil}});Object.defineProperty(Wn,"getProperty",{enumerable:true,get:function(){return ZE.getProperty}});Object.defineProperty(Wn,"stringify",{enumerable:true,get:function(){return ZE.stringify}});Object.defineProperty(Wn,"regexpCode",{enumerable:true,get:function(){return ZE.regexpCode}});Object.defineProperty(Wn,"Name",{enumerable:true,get:function(){return ZE.Name}});var DQ=PQ();Object.defineProperty(Wn,"Scope",{enumerable:true,get:function(){return DQ.Scope}});Object.defineProperty(Wn,"ValueScope",{enumerable:true,get:function(){return DQ.ValueScope}});Object.defineProperty(Wn,"ValueScopeName",{enumerable:true,get:function(){return DQ.ValueScopeName}});Object.defineProperty(Wn,"varKinds",{enumerable:true,get:function(){return DQ.varKinds}});Wn.operators={GT:new xi._Code(">"),GTE:new xi._Code(">="),LT:new xi._Code("<"),LTE:new xi._Code("<="),EQ:new xi._Code("==="),NEQ:new xi._Code("!=="),NOT:new xi._Code("!"),OR:new xi._Code("||"),AND:new xi._Code("&&"),ADD:new xi._Code("+")};var Py=class{static{a(this,"Node")}optimizeNodes(){return this}optimizeNames(t,r){return this}};var oPe=class extends Py{static{a(this,"Def")}constructor(t,r,n){super();this.varKind=t;this.name=r;this.rhs=n}render({es5:t,_n:r}){const n=t?vh.varKinds.var:this.varKind;const i=this.rhs===void 0?"":` = ${this.rhs}`;return`${n} ${this.name}${i};`+r}optimizeNames(t,r){if(!t[this.name.str])return;if(this.rhs)this.rhs=UP(this.rhs,t,r);return this}get names(){return this.rhs instanceof xi._CodeOrName?this.rhs.names:{}}};var NQ=class extends Py{static{a(this,"Assign")}constructor(t,r,n){super();this.lhs=t;this.rhs=r;this.sideEffects=n}render({_n:t}){return`${this.lhs} = ${this.rhs};`+t}optimizeNames(t,r){if(this.lhs instanceof xi.Name&&!t[this.lhs.str]&&!this.sideEffects)return;this.rhs=UP(this.rhs,t,r);return this}get names(){const t=this.lhs instanceof xi.Name?{}:{...this.lhs.names};return kQ(t,this.rhs)}};var uPe=class extends NQ{static{a(this,"AssignOp")}constructor(t,r,n,i){super(t,n,i);this.op=r}render({_n:t}){return`${this.lhs} ${this.op}= ${this.rhs};`+t}};var lPe=class extends Py{static{a(this,"Label")}constructor(t){super();this.label=t;this.names={}}render({_n:t}){return`${this.label}:`+t}};var cPe=class extends Py{static{a(this,"Break")}constructor(t){super();this.label=t;this.names={}}render({_n:t}){const r=this.label?` ${this.label}`:"";return`break${r};`+t}};var dPe=class extends Py{static{a(this,"Throw")}constructor(t){super();this.error=t}render({_n:t}){return`throw ${this.error};`+t}get names(){return this.error.names}};var pPe=class extends Py{static{a(this,"AnyCode")}constructor(t){super();this.code=t}render({_n:t}){return`${this.code};`+t}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(t,r){this.code=UP(this.code,t,r);return this}get names(){return this.code instanceof xi._CodeOrName?this.code.names:{}}};var o7=class extends Py{static{a(this,"ParentNode")}constructor(t=[]){super();this.nodes=t}render(t){return this.nodes.reduce((r,n)=>r+n.render(t),"")}optimizeNodes(){const{nodes:t}=this;let r=t.length;while(r--){const n=t[r].optimizeNodes();if(Array.isArray(n))t.splice(r,1,...n);else if(n)t[r]=n;else t.splice(r,1)}return t.length>0?this:void 0}optimizeNames(t,r){const{nodes:n}=this;let i=n.length;while(i--){const s=n[i];if(s.optimizeNames(t,r))continue;LIn(t,s.names);n.splice(i,1)}return n.length>0?this:void 0}get names(){return this.nodes.reduce((t,r)=>hC(t,r.names),{})}};var Ny=class extends o7{static{a(this,"BlockNode")}render(t){return"{"+t._n+super.render(t)+"}"+t._n}};var fPe=class extends o7{static{a(this,"Root")}};var qP=class extends Ny{static{a(this,"Else")}};qP.kind="else";var fC=class e extends Ny{static{a(this,"If")}constructor(t,r){super(r);this.condition=t}render(t){let r=`if(${this.condition})`+super.render(t);if(this.else)r+="else "+this.else.render(t);return r}optimizeNodes(){super.optimizeNodes();const t=this.condition;if(t===true)return this.nodes;let r=this.else;if(r){const n=r.optimizeNodes();r=this.else=Array.isArray(n)?new qP(n):n}if(r){if(t===false)return r instanceof e?r:r.nodes;if(this.nodes.length)return this;return new e(XOt(t),r instanceof e?[r]:r.nodes)}if(t===false||!this.nodes.length)return void 0;return this}optimizeNames(t,r){var n;this.else=(n=this.else)===null||n===void 0?void 0:n.optimizeNames(t,r);if(!(super.optimizeNames(t,r)||this.else))return;this.condition=UP(this.condition,t,r);return this}get names(){const t=super.names;kQ(t,this.condition);if(this.else)hC(t,this.else.names);return t}};fC.kind="if";var mC=class extends Ny{static{a(this,"For")}};mC.kind="for";var mPe=class extends mC{static{a(this,"ForLoop")}constructor(t){super();this.iteration=t}render(t){return`for(${this.iteration})`+super.render(t)}optimizeNames(t,r){if(!super.optimizeNames(t,r))return;this.iteration=UP(this.iteration,t,r);return this}get names(){return hC(super.names,this.iteration.names)}};var hPe=class extends mC{static{a(this,"ForRange")}constructor(t,r,n,i){super();this.varKind=t;this.name=r;this.from=n;this.to=i}render(t){const r=t.es5?vh.varKinds.var:this.varKind;const{name:n,from:i,to:s}=this;return`for(${r} ${n}=${i}; ${n}<${s}; ${n}++)`+super.render(t)}get names(){const t=kQ(super.names,this.from);return kQ(t,this.to)}};var IQ=class extends mC{static{a(this,"ForIter")}constructor(t,r,n,i){super();this.loop=t;this.varKind=r;this.name=n;this.iterable=i}render(t){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(t)}optimizeNames(t,r){if(!super.optimizeNames(t,r))return;this.iterable=UP(this.iterable,t,r);return this}get names(){return hC(super.names,this.iterable.names)}};var u7=class extends Ny{static{a(this,"Func")}constructor(t,r,n){super();this.name=t;this.args=r;this.async=n}render(t){const r=this.async?"async ":"";return`${r}function ${this.name}(${this.args})`+super.render(t)}};u7.kind="func";var l7=class extends o7{static{a(this,"Return")}render(t){return"return "+super.render(t)}};l7.kind="return";var gPe=class extends Ny{static{a(this,"Try")}render(t){let r="try"+super.render(t);if(this.catch)r+=this.catch.render(t);if(this.finally)r+=this.finally.render(t);return r}optimizeNodes(){var t,r;super.optimizeNodes();(t=this.catch)===null||t===void 0?void 0:t.optimizeNodes();(r=this.finally)===null||r===void 0?void 0:r.optimizeNodes();return this}optimizeNames(t,r){var n,i;super.optimizeNames(t,r);(n=this.catch)===null||n===void 0?void 0:n.optimizeNames(t,r);(i=this.finally)===null||i===void 0?void 0:i.optimizeNames(t,r);return this}get names(){const t=super.names;if(this.catch)hC(t,this.catch.names);if(this.finally)hC(t,this.finally.names);return t}};var c7=class extends Ny{static{a(this,"Catch")}constructor(t){super();this.error=t}render(t){return`catch(${this.error})`+super.render(t)}};c7.kind="catch";var d7=class extends Ny{static{a(this,"Finally")}render(t){return"finally"+super.render(t)}};d7.kind="finally";var yPe=class{static{a(this,"CodeGen")}constructor(t,r={}){this._values={};this._blockStarts=[];this._constants={};this.opts={...r,_n:r.lines?"\n":""};this._extScope=t;this._scope=new vh.Scope({parent:t});this._nodes=[new fPe]}toString(){return this._root.render(this.opts)}name(t){return this._scope.name(t)}scopeName(t){return this._extScope.name(t)}scopeValue(t,r){const n=this._extScope.value(t,r);const i=this._values[n.prefix]||(this._values[n.prefix]=new Set);i.add(n);return n}getScopeValue(t,r){return this._extScope.getValue(t,r)}scopeRefs(t){return this._extScope.scopeRefs(t,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(t,r,n,i){const s=this._scope.toName(r);if(n!==void 0&&i)this._constants[s.str]=n;this._leafNode(new oPe(t,s,n));return s}const(t,r,n){return this._def(vh.varKinds.const,t,r,n)}let(t,r,n){return this._def(vh.varKinds.let,t,r,n)}var(t,r,n){return this._def(vh.varKinds.var,t,r,n)}assign(t,r,n){return this._leafNode(new NQ(t,r,n))}add(t,r){return this._leafNode(new uPe(t,Wn.operators.ADD,r))}code(t){if(typeof t=="function")t();else if(t!==xi.nil)this._leafNode(new pPe(t));return this}object(...t){const r=["{"];for(const[n,i]of t){if(r.length>1)r.push(",");r.push(n);if(n!==i||this.opts.es5){r.push(":");(0,xi.addCodeArg)(r,i)}}r.push("}");return new xi._Code(r)}if(t,r,n){this._blockNode(new fC(t));if(r&&n){this.code(r).else().code(n).endIf()}else if(r){this.code(r).endIf()}else if(n){throw new Error('CodeGen: "else" body without "then" body')}return this}elseIf(t){return this._elseNode(new fC(t))}else(){return this._elseNode(new qP)}endIf(){return this._endBlockNode(fC,qP)}_for(t,r){this._blockNode(t);if(r)this.code(r).endFor();return this}for(t,r){return this._for(new mPe(t),r)}forRange(t,r,n,i,s=this.opts.es5?vh.varKinds.var:vh.varKinds.let){const o=this._scope.toName(t);return this._for(new hPe(s,o,r,n),()=>i(o))}forOf(t,r,n,i=vh.varKinds.const){const s=this._scope.toName(t);if(this.opts.es5){const o=r instanceof xi.Name?r:this.var("_arr",r);return this.forRange("_i",0,(0,xi._)`${o}.length`,u=>{this.var(s,(0,xi._)`${o}[${u}]`);n(s)})}return this._for(new IQ("of",i,s,r),()=>n(s))}forIn(t,r,n,i=this.opts.es5?vh.varKinds.var:vh.varKinds.const){if(this.opts.ownProperties){return this.forOf(t,(0,xi._)`Object.keys(${r})`,n)}const s=this._scope.toName(t);return this._for(new IQ("in",i,s,r),()=>n(s))}endFor(){return this._endBlockNode(mC)}label(t){return this._leafNode(new lPe(t))}break(t){return this._leafNode(new cPe(t))}return(t){const r=new l7;this._blockNode(r);this.code(t);if(r.nodes.length!==1)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(l7)}try(t,r,n){if(!r&&!n)throw new Error('CodeGen: "try" without "catch" and "finally"');const i=new gPe;this._blockNode(i);this.code(t);if(r){const s=this.name("e");this._currNode=i.catch=new c7(s);r(s)}if(n){this._currNode=i.finally=new d7;this.code(n)}return this._endBlockNode(c7,d7)}throw(t){return this._leafNode(new dPe(t))}block(t,r){this._blockStarts.push(this._nodes.length);if(t)this.code(t).endBlock(r);return this}endBlock(t){const r=this._blockStarts.pop();if(r===void 0)throw new Error("CodeGen: not in self-balancing block");const n=this._nodes.length-r;if(n<0||t!==void 0&&n!==t){throw new Error(`CodeGen: wrong number of nodes: ${n} vs ${t} expected`)}this._nodes.length=r;return this}func(t,r=xi.nil,n,i){this._blockNode(new u7(t,r,n));if(i)this.code(i).endFunc();return this}endFunc(){return this._endBlockNode(u7)}optimize(t=1){while(t-- >0){this._root.optimizeNodes();this._root.optimizeNames(this._root.names,this._constants)}}_leafNode(t){this._currNode.nodes.push(t);return this}_blockNode(t){this._currNode.nodes.push(t);this._nodes.push(t)}_endBlockNode(t,r){const n=this._currNode;if(n instanceof t||r&&n instanceof r){this._nodes.pop();return this}throw new Error(`CodeGen: not in block "${r?`${t.kind}/${r.kind}`:t.kind}"`)}_elseNode(t){const r=this._currNode;if(!(r instanceof fC)){throw new Error('CodeGen: "else" without "if"')}this._currNode=r.else=t;return this}get _root(){return this._nodes[0]}get _currNode(){const t=this._nodes;return t[t.length-1]}set _currNode(t){const r=this._nodes;r[r.length-1]=t}};Wn.CodeGen=yPe;function hC(e,t){for(const r in t)e[r]=(e[r]||0)+(t[r]||0);return e}a(hC,"addNames");function kQ(e,t){return t instanceof xi._CodeOrName?hC(e,t.names):e}a(kQ,"addExprNames");function UP(e,t,r){if(e instanceof xi.Name)return n(e);if(!i(e))return e;return new xi._Code(e._items.reduce((s,o)=>{if(o instanceof xi.Name)o=n(o);if(o instanceof xi._Code)s.push(...o._items);else s.push(o);return s},[]));function n(s){const o=r[s.str];if(o===void 0||t[s.str]!==1)return s;delete t[s.str];return o}a(n,"replaceName");function i(s){return s instanceof xi._Code&&s._items.some(o=>o instanceof xi.Name&&t[o.str]===1&&r[o.str]!==void 0)}a(i,"canOptimize")}a(UP,"optimizeExpr");function LIn(e,t){for(const r in t)e[r]=(e[r]||0)-(t[r]||0)}a(LIn,"subtractNames");function XOt(e){return typeof e=="boolean"||typeof e=="number"||e===null?!e:(0,xi._)`!${_Pe(e)}`}a(XOt,"not");Wn.not=XOt;var FIn=JOt(Wn.operators.AND);function BIn(...e){return e.reduce(FIn)}a(BIn,"and");Wn.and=BIn;var MIn=JOt(Wn.operators.OR);function qIn(...e){return e.reduce(MIn)}a(qIn,"or");Wn.or=qIn;function JOt(e){return(t,r)=>t===xi.nil?r:r===xi.nil?t:(0,xi._)`${_Pe(t)} ${e} ${_Pe(r)}`}a(JOt,"mappend");function _Pe(e){return e instanceof xi.Name?e:(0,xi._)`(${e})`}a(_Pe,"par")});var fi=y(Yn=>{"use strict";Object.defineProperty(Yn,"__esModule",{value:true});Yn.checkStrictMode=Yn.getErrorPath=Yn.Type=Yn.useFunc=Yn.setEvaluated=Yn.evaluatedPropsToName=Yn.mergeEvaluated=Yn.eachItem=Yn.unescapeJsonPointer=Yn.escapeJsonPointer=Yn.escapeFragment=Yn.unescapeFragment=Yn.schemaRefOrVal=Yn.schemaHasRulesButRef=Yn.schemaHasRules=Yn.checkUnknownRules=Yn.alwaysValidSchema=Yn.toHash=void 0;var zs=En();var UIn=MP();function $In(e){const t={};for(const r of e)t[r]=true;return t}a($In,"toHash");Yn.toHash=$In;function jIn(e,t){if(typeof t=="boolean")return t;if(Object.keys(t).length===0)return true;ePt(e,t);return!tPt(t,e.self.RULES.all)}a(jIn,"alwaysValidSchema");Yn.alwaysValidSchema=jIn;function ePt(e,t=e.schema){const{opts:r,self:n}=e;if(!r.strictSchema)return;if(typeof t==="boolean")return;const i=n.RULES.keywords;for(const s in t){if(!i[s])sPt(e,`unknown keyword: "${s}"`)}}a(ePt,"checkUnknownRules");Yn.checkUnknownRules=ePt;function tPt(e,t){if(typeof e=="boolean")return!e;for(const r in e)if(t[r])return true;return false}a(tPt,"schemaHasRules");Yn.schemaHasRules=tPt;function GIn(e,t){if(typeof e=="boolean")return!e;for(const r in e)if(r!=="$ref"&&t.all[r])return true;return false}a(GIn,"schemaHasRulesButRef");Yn.schemaHasRulesButRef=GIn;function HIn({topSchemaRef:e,schemaPath:t},r,n,i){if(!i){if(typeof r=="number"||typeof r=="boolean")return r;if(typeof r=="string")return(0,zs._)`${r}`}return(0,zs._)`${e}${t}${(0,zs.getProperty)(n)}`}a(HIn,"schemaRefOrVal");Yn.schemaRefOrVal=HIn;function VIn(e){return rPt(decodeURIComponent(e))}a(VIn,"unescapeFragment");Yn.unescapeFragment=VIn;function zIn(e){return encodeURIComponent(vPe(e))}a(zIn,"escapeFragment");Yn.escapeFragment=zIn;function vPe(e){if(typeof e=="number")return`${e}`;return e.replace(/~/g,"~0").replace(/\//g,"~1")}a(vPe,"escapeJsonPointer");Yn.escapeJsonPointer=vPe;function rPt(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}a(rPt,"unescapeJsonPointer");Yn.unescapeJsonPointer=rPt;function KIn(e,t){if(Array.isArray(e)){for(const r of e)t(r)}else{t(e)}}a(KIn,"eachItem");Yn.eachItem=KIn;function QOt({mergeNames:e,mergeToName:t,mergeValues:r,resultToName:n}){return(i,s,o,u)=>{const l=o===void 0?s:o instanceof zs.Name?(s instanceof zs.Name?e(i,s,o):t(i,s,o),o):s instanceof zs.Name?(t(i,o,s),s):r(s,o);return u===zs.Name&&!(l instanceof zs.Name)?n(i,l):l}}a(QOt,"makeMergeEvaluated");Yn.mergeEvaluated={props:QOt({mergeNames:(e,t,r)=>e.if((0,zs._)`${r} !== true && ${t} !== undefined`,()=>{e.if((0,zs._)`${t} === true`,()=>e.assign(r,true),()=>e.assign(r,(0,zs._)`${r} || {}`).code((0,zs._)`Object.assign(${r}, ${t})`))}),mergeToName:(e,t,r)=>e.if((0,zs._)`${r} !== true`,()=>{if(t===true){e.assign(r,true)}else{e.assign(r,(0,zs._)`${r} || {}`);EPe(e,r,t)}}),mergeValues:(e,t)=>e===true?true:{...e,...t},resultToName:nPt}),items:QOt({mergeNames:(e,t,r)=>e.if((0,zs._)`${r} !== true && ${t} !== undefined`,()=>e.assign(r,(0,zs._)`${t} === true ? true : ${r} > ${t} ? ${r} : ${t}`)),mergeToName:(e,t,r)=>e.if((0,zs._)`${r} !== true`,()=>e.assign(r,t===true?true:(0,zs._)`${r} > ${t} ? ${r} : ${t}`)),mergeValues:(e,t)=>e===true?true:Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})};function nPt(e,t){if(t===true)return e.var("props",true);const r=e.var("props",(0,zs._)`{}`);if(t!==void 0)EPe(e,r,t);return r}a(nPt,"evaluatedPropsToName");Yn.evaluatedPropsToName=nPt;function EPe(e,t,r){Object.keys(r).forEach(n=>e.assign((0,zs._)`${t}${(0,zs.getProperty)(n)}`,true))}a(EPe,"setEvaluated");Yn.setEvaluated=EPe;var ZOt={};function WIn(e,t){return e.scopeValue("func",{ref:t,code:ZOt[t.code]||(ZOt[t.code]=new UIn._Code(t.code))})}a(WIn,"useFunc");Yn.useFunc=WIn;var iPt;(function(e){e[e["Num"]=0]="Num";e[e["Str"]=1]="Str"})(iPt=Yn.Type||(Yn.Type={}));function YIn(e,t,r){if(e instanceof zs.Name){const n=t===iPt.Num;return r?n?(0,zs._)`"[" + ${e} + "]"`:(0,zs._)`"['" + ${e} + "']"`:n?(0,zs._)`"/" + ${e}`:(0,zs._)`"/" + ${e}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return r?(0,zs.getProperty)(e).toString():"/"+vPe(e)}a(YIn,"getErrorPath");Yn.getErrorPath=YIn;function sPt(e,t,r=e.opts.strictSchema){if(!r)return;t=`strict mode: ${t}`;if(r===true)throw new Error(t);e.self.logger.warn(t)}a(sPt,"checkStrictMode");Yn.checkStrictMode=sPt});var Uf=y(bPe=>{"use strict";Object.defineProperty(bPe,"__esModule",{value:true});var Bl=En();var XIn={data:new Bl.Name("data"),valCxt:new Bl.Name("valCxt"),instancePath:new Bl.Name("instancePath"),parentData:new Bl.Name("parentData"),parentDataProperty:new Bl.Name("parentDataProperty"),rootData:new Bl.Name("rootData"),dynamicAnchors:new Bl.Name("dynamicAnchors"),vErrors:new Bl.Name("vErrors"),errors:new Bl.Name("errors"),this:new Bl.Name("this"),self:new Bl.Name("self"),scope:new Bl.Name("scope"),json:new Bl.Name("json"),jsonPos:new Bl.Name("jsonPos"),jsonLen:new Bl.Name("jsonLen"),jsonPart:new Bl.Name("jsonPart")};bPe.default=XIn});var p7=y(Ml=>{"use strict";Object.defineProperty(Ml,"__esModule",{value:true});Ml.extendErrors=Ml.resetErrorsCount=Ml.reportExtraError=Ml.reportError=Ml.keyword$DataError=Ml.keywordError=void 0;var qi=En();var LQ=fi();var Pc=Uf();Ml.keywordError={message:({keyword:e})=>(0,qi.str)`must pass "${e}" keyword validation`};Ml.keyword$DataError={message:({keyword:e,schemaType:t})=>t?(0,qi.str)`"${e}" keyword must be ${t} ($data)`:(0,qi.str)`"${e}" keyword is invalid ($data)`};function JIn(e,t=Ml.keywordError,r,n){const{it:i}=e;const{gen:s,compositeRule:o,allErrors:u}=i;const l=uPt(e,t,r);if(n!==null&&n!==void 0?n:o||u){aPt(s,l)}else{oPt(i,(0,qi._)`[${l}]`)}}a(JIn,"reportError");Ml.reportError=JIn;function QIn(e,t=Ml.keywordError,r){const{it:n}=e;const{gen:i,compositeRule:s,allErrors:o}=n;const u=uPt(e,t,r);aPt(i,u);if(!(s||o)){oPt(n,Pc.default.vErrors)}}a(QIn,"reportExtraError");Ml.reportExtraError=QIn;function ZIn(e,t){e.assign(Pc.default.errors,t);e.if((0,qi._)`${Pc.default.vErrors} !== null`,()=>e.if(t,()=>e.assign((0,qi._)`${Pc.default.vErrors}.length`,t),()=>e.assign(Pc.default.vErrors,null)))}a(ZIn,"resetErrorsCount");Ml.resetErrorsCount=ZIn;function e3n({gen:e,keyword:t,schemaValue:r,data:n,errsCount:i,it:s}){if(i===void 0)throw new Error("ajv implementation error");const o=e.name("err");e.forRange("i",i,Pc.default.errors,u=>{e.const(o,(0,qi._)`${Pc.default.vErrors}[${u}]`);e.if((0,qi._)`${o}.instancePath === undefined`,()=>e.assign((0,qi._)`${o}.instancePath`,(0,qi.strConcat)(Pc.default.instancePath,s.errorPath)));e.assign((0,qi._)`${o}.schemaPath`,(0,qi.str)`${s.errSchemaPath}/${t}`);if(s.opts.verbose){e.assign((0,qi._)`${o}.schema`,r);e.assign((0,qi._)`${o}.data`,n)}})}a(e3n,"extendErrors");Ml.extendErrors=e3n;function aPt(e,t){const r=e.const("err",t);e.if((0,qi._)`${Pc.default.vErrors} === null`,()=>e.assign(Pc.default.vErrors,(0,qi._)`[${r}]`),(0,qi._)`${Pc.default.vErrors}.push(${r})`);e.code((0,qi._)`${Pc.default.errors}++`)}a(aPt,"addError");function oPt(e,t){const{gen:r,validateName:n,schemaEnv:i}=e;if(i.$async){r.throw((0,qi._)`new ${e.ValidationError}(${t})`)}else{r.assign((0,qi._)`${n}.errors`,t);r.return(false)}}a(oPt,"returnErrors");var gC={keyword:new qi.Name("keyword"),schemaPath:new qi.Name("schemaPath"),params:new qi.Name("params"),propertyName:new qi.Name("propertyName"),message:new qi.Name("message"),schema:new qi.Name("schema"),parentSchema:new qi.Name("parentSchema")};function uPt(e,t,r){const{createErrors:n}=e.it;if(n===false)return(0,qi._)`{}`;return t3n(e,t,r)}a(uPt,"errorObjectCode");function t3n(e,t,r={}){const{gen:n,it:i}=e;const s=[r3n(i,r),n3n(e,r)];i3n(e,t,s);return n.object(...s)}a(t3n,"errorObject");function r3n({errorPath:e},{instancePath:t}){const r=t?(0,qi.str)`${e}${(0,LQ.getErrorPath)(t,LQ.Type.Str)}`:e;return[Pc.default.instancePath,(0,qi.strConcat)(Pc.default.instancePath,r)]}a(r3n,"errorInstancePath");function n3n({keyword:e,it:{errSchemaPath:t}},{schemaPath:r,parentSchema:n}){let i=n?t:(0,qi.str)`${t}/${e}`;if(r){i=(0,qi.str)`${i}${(0,LQ.getErrorPath)(r,LQ.Type.Str)}`}return[gC.schemaPath,i]}a(n3n,"errorSchemaPath");function i3n(e,{params:t,message:r},n){const{keyword:i,data:s,schemaValue:o,it:u}=e;const{opts:l,propertyName:c,topSchemaRef:d,schemaPath:p}=u;n.push([gC.keyword,i],[gC.params,typeof t=="function"?t(e):t||(0,qi._)`{}`]);if(l.messages){n.push([gC.message,typeof r=="function"?r(e):r])}if(l.verbose){n.push([gC.schema,o],[gC.parentSchema,(0,qi._)`${d}${p}`],[Pc.default.data,s])}if(c)n.push([gC.propertyName,c])}a(i3n,"extraErrorProps")});var cPt=y($P=>{"use strict";Object.defineProperty($P,"__esModule",{value:true});$P.boolOrEmptySchema=$P.topBoolOrEmptySchema=void 0;var s3n=p7();var a3n=En();var o3n=Uf();var u3n={message:"boolean schema is false"};function l3n(e){const{gen:t,schema:r,validateName:n}=e;if(r===false){lPt(e,false)}else if(typeof r=="object"&&r.$async===true){t.return(o3n.default.data)}else{t.assign((0,a3n._)`${n}.errors`,null);t.return(true)}}a(l3n,"topBoolOrEmptySchema");$P.topBoolOrEmptySchema=l3n;function c3n(e,t){const{gen:r,schema:n}=e;if(n===false){r.var(t,false);lPt(e)}else{r.var(t,true)}}a(c3n,"boolOrEmptySchema");$P.boolOrEmptySchema=c3n;function lPt(e,t){const{gen:r,data:n}=e;const i={gen:r,keyword:"false schema",data:n,schema:false,schemaCode:false,schemaValue:false,params:{},it:e};(0,s3n.reportError)(i,u3n,void 0,t)}a(lPt,"falseSchemaError")});var SPe=y(jP=>{"use strict";Object.defineProperty(jP,"__esModule",{value:true});jP.getRules=jP.isJSONType=void 0;var d3n=["string","number","integer","boolean","null","object","array"];var p3n=new Set(d3n);function f3n(e){return typeof e=="string"&&p3n.has(e)}a(f3n,"isJSONType");jP.isJSONType=f3n;function m3n(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:true,boolean:true,null:true},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}}a(m3n,"getRules");jP.getRules=m3n});var APe=y(eb=>{"use strict";Object.defineProperty(eb,"__esModule",{value:true});eb.shouldUseRule=eb.shouldUseGroup=eb.schemaHasRulesForType=void 0;function h3n({schema:e,self:t},r){const n=t.RULES.types[r];return n&&n!==true&&dPt(e,n)}a(h3n,"schemaHasRulesForType");eb.schemaHasRulesForType=h3n;function dPt(e,t){return t.rules.some(r=>pPt(e,r))}a(dPt,"shouldUseGroup");eb.shouldUseGroup=dPt;function pPt(e,t){var r;return e[t.keyword]!==void 0||((r=t.definition.implements)===null||r===void 0?void 0:r.some(n=>e[n]!==void 0))}a(pPt,"shouldUseRule");eb.shouldUseRule=pPt});var m7=y(ll=>{"use strict";Object.defineProperty(ll,"__esModule",{value:true});ll.reportTypeError=ll.checkDataTypes=ll.checkDataType=ll.coerceAndCheckDataType=ll.getJSONTypes=ll.getSchemaTypes=ll.DataType=void 0;var g3n=SPe();var y3n=APe();var _3n=p7();var In=En();var fPt=fi();var f7;(function(e){e[e["Correct"]=0]="Correct";e[e["Wrong"]=1]="Wrong"})(f7=ll.DataType||(ll.DataType={}));function v3n(e){const t=mPt(e.type);const r=t.includes("null");if(r){if(e.nullable===false)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&e.nullable!==void 0){throw new Error('"nullable" cannot be used without "type"')}if(e.nullable===true)t.push("null")}return t}a(v3n,"getSchemaTypes");ll.getSchemaTypes=v3n;function mPt(e){const t=Array.isArray(e)?e:e?[e]:[];if(t.every(g3n.isJSONType))return t;throw new Error("type must be JSONType or JSONType[]: "+t.join(","))}a(mPt,"getJSONTypes");ll.getJSONTypes=mPt;function E3n(e,t){const{gen:r,data:n,opts:i}=e;const s=b3n(t,i.coerceTypes);const o=t.length>0&&!(s.length===0&&t.length===1&&(0,y3n.schemaHasRulesForType)(e,t[0]));if(o){const u=wPe(t,n,i.strictNumbers,f7.Wrong);r.if(u,()=>{if(s.length)S3n(e,t,s);else TPe(e)})}return o}a(E3n,"coerceAndCheckDataType");ll.coerceAndCheckDataType=E3n;var hPt=new Set(["string","number","integer","boolean","null"]);function b3n(e,t){return t?e.filter(r=>hPt.has(r)||t==="array"&&r==="array"):[]}a(b3n,"coerceToTypes");function S3n(e,t,r){const{gen:n,data:i,opts:s}=e;const o=n.let("dataType",(0,In._)`typeof ${i}`);const u=n.let("coerced",(0,In._)`undefined`);if(s.coerceTypes==="array"){n.if((0,In._)`${o} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>n.assign(i,(0,In._)`${i}[0]`).assign(o,(0,In._)`typeof ${i}`).if(wPe(t,i,s.strictNumbers),()=>n.assign(u,i)))}n.if((0,In._)`${u} !== undefined`);for(const c of r){if(hPt.has(c)||c==="array"&&s.coerceTypes==="array"){l(c)}}n.else();TPe(e);n.endIf();n.if((0,In._)`${u} !== undefined`,()=>{n.assign(i,u);A3n(e,u)});function l(c){switch(c){case"string":n.elseIf((0,In._)`${o} == "number" || ${o} == "boolean"`).assign(u,(0,In._)`"" + ${i}`).elseIf((0,In._)`${i} === null`).assign(u,(0,In._)`""`);return;case"number":n.elseIf((0,In._)`${o} == "boolean" || ${i} === null
|
|
470
470
|
|| (${o} == "string" && ${i} && ${i} == +${i})`).assign(u,(0,In._)`+${i}`);return;case"integer":n.elseIf((0,In._)`${o} === "boolean" || ${i} === null
|
|
471
471
|
|| (${o} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(u,(0,In._)`+${i}`);return;case"boolean":n.elseIf((0,In._)`${i} === "false" || ${i} === 0 || ${i} === null`).assign(u,false).elseIf((0,In._)`${i} === "true" || ${i} === 1`).assign(u,true);return;case"null":n.elseIf((0,In._)`${i} === "" || ${i} === 0 || ${i} === false`);n.assign(u,null);return;case"array":n.elseIf((0,In._)`${o} === "string" || ${o} === "number"
|