@equinor/fusion-framework-cli 11.1.2 → 11.1.3

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.
Files changed (32) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/README.md +3 -2
  3. package/bin/build/cli.mjs +3 -3
  4. package/dist/esm/version.js +1 -1
  5. package/dist/types/cli/commands/app/build.d.ts +1 -1
  6. package/dist/types/cli/commands/app/check.d.ts +3 -3
  7. package/dist/types/cli/commands/app/config.d.ts +4 -4
  8. package/dist/types/cli/commands/app/dev.d.ts +4 -4
  9. package/dist/types/cli/commands/app/manifest.d.ts +4 -4
  10. package/dist/types/cli/commands/app/pack.d.ts +3 -3
  11. package/dist/types/cli/commands/app/publish.d.ts +4 -4
  12. package/dist/types/cli/commands/app/tag.d.ts +10 -11
  13. package/dist/types/cli/commands/app/upload.d.ts +4 -4
  14. package/dist/types/cli/commands/auth/login.d.ts +14 -0
  15. package/dist/types/cli/commands/auth/logout.d.ts +13 -3
  16. package/dist/types/cli/commands/auth/token.d.ts +15 -1
  17. package/dist/types/cli/commands/portal/build.d.ts +25 -0
  18. package/dist/types/cli/commands/portal/config.d.ts +4 -4
  19. package/dist/types/cli/commands/portal/dev.d.ts +25 -0
  20. package/dist/types/cli/commands/portal/manifest.d.ts +28 -0
  21. package/dist/types/cli/commands/portal/pack.d.ts +24 -0
  22. package/dist/types/cli/commands/portal/publish.d.ts +29 -0
  23. package/dist/types/cli/commands/portal/schema.d.ts +27 -0
  24. package/dist/types/cli/commands/portal/tag.d.ts +29 -0
  25. package/dist/types/cli/commands/portal/upload.d.ts +25 -0
  26. package/dist/types/cli/options/auth.d.ts +16 -0
  27. package/dist/types/version.d.ts +1 -1
  28. package/docs/application.md +5 -6
  29. package/docs/auth.md +7 -0
  30. package/docs/portal.md +4 -4
  31. package/package.json +6 -6
  32. package/docs/libsecret.md +0 -66
package/bin/build/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
- import{createCommand as e,createOption as t,InvalidOptionArgumentError as r,Command as o}from"commander";import{fileURLToPath as n}from"node:url";import{resolve as a,dirname as s}from"node:path";import{readPackageUpSync as i}from"read-package-up";import{ConsoleLogger as c,buildApplication as d,bundleApp as l,FusionEnv as u,resolveDefaultEnv as p,checkApp as f,initializeFramework as m,uploadApplication as h,publishAppConfig as g,generateApplicationConfig as v,AllowedAppTags as y,loadAppManifest as b,tagApplication as $,startAppDevServer as w,startPortalDevServer as _,loadPortalManifest as k,buildPortal as P,bundlePortal as S,uploadPortalBundle as E,tagPortal as j,AllowedPortalTags as O,publishPortalConfig as N,generatePortalConfig as I}from"@equinor/fusion-framework-cli/bin";import{stdout as x}from"node:process";import{mkdir as T,writeFile as C}from"node:fs/promises";import{accessSync as R,constants as A,existsSync as F,mkdirSync as M,writeFileSync as D}from"node:fs";import"node:assert";import{importConfig as V,importJSON as z}from"@equinor/fusion-imports";import{z as U}from"zod";import"deepmerge";import"node:child_process";const q=(e=0)=>t=>`[${t+e}m`,K=(e=0)=>t=>`[${38+e};5;${t}m`,L=(e=0)=>(t,r,o)=>`[${38+e};2;${t};${r};${o}m`,B={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(B.modifier);Object.keys(B.color),Object.keys(B.bgColor);const H=function(){const e=new Map;for(const[t,r]of Object.entries(B)){for(const[t,o]of Object.entries(r))B[t]={open:`[${o[0]}m`,close:`[${o[1]}m`},r[t]=B[t],e.set(o[0],o[1]);Object.defineProperty(B,t,{value:r,enumerable:!1})}return Object.defineProperty(B,"codes",{value:e,enumerable:!1}),B.color.close="",B.bgColor.close="",B.color.ansi=q(),B.color.ansi256=K(),B.color.ansi16m=L(),B.bgColor.ansi=q(10),B.bgColor.ansi256=K(10),B.bgColor.ansi16m=L(10),Object.defineProperties(B,{rgbToAnsi256:{value:(e,t,r)=>e===t&&t===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value(e){const t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[r]=t;3===r.length&&(r=[...r].map(e=>e+e).join(""));const o=Number.parseInt(r,16);return[o>>16&255,o>>8&255,255&o]},enumerable:!1},hexToAnsi256:{value:e=>B.rgbToAnsi256(...B.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return e-8+90;let t,r,o;if(e>=232)t=(10*(e-232)+8)/255,r=t,o=t;else{const n=(e-=16)%36;t=Math.floor(e/36)/5,r=Math.floor(n/6)/5,o=n%6/5}const n=2*Math.max(t,r,o);if(0===n)return 30;let a=30+(Math.round(o)<<2|Math.round(r)<<1|Math.round(t));return 2===n&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,t,r)=>B.ansi256ToAnsi(B.rgbToAnsi256(e,t,r)),enumerable:!1},hexToAnsi:{value:e=>B.ansi256ToAnsi(B.hexToAnsi256(e)),enumerable:!1}}),B}(),G=(()=>{if(!("navigator"in globalThis))return 0;if(globalThis.navigator.userAgentData){const e=navigator.userAgentData.brands.find(({brand:e})=>"Chromium"===e);if(e&&e.version>93)return 3}return/\b(Chrome|Chromium)\//.test(globalThis.navigator.userAgent)?1:0})(),J=0!==G&&{level:G},W={stdout:J,stderr:J};function Y(e,t,r){let o=e.indexOf(t);if(-1===o)return e;const n=t.length;let a=0,s="";do{s+=e.slice(a,o)+t+r,a=o+n,o=e.indexOf(t,a)}while(-1!==o);return s+=e.slice(a),s}const{stdout:Q,stderr:X}=W,Z=Symbol("GENERATOR"),ee=Symbol("STYLER"),te=Symbol("IS_EMPTY"),re=["ansi","ansi","ansi256","ansi16m"],oe=Object.create(null),ne=e=>{const t=(...e)=>e.join(" ");return((e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const r=Q?Q.level:0;e.level=void 0===t.level?r:t.level})(t,e),Object.setPrototypeOf(t,ae.prototype),t};function ae(e){return ne(e)}Object.setPrototypeOf(ae.prototype,Function.prototype);for(const[e,t]of Object.entries(H))oe[e]={get(){const r=le(this,de(t.open,t.close,this[ee]),this[te]);return Object.defineProperty(this,e,{value:r}),r}};oe.visible={get(){const e=le(this,this[ee],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const se=(e,t,r,...o)=>"rgb"===e?"ansi16m"===t?H[r].ansi16m(...o):"ansi256"===t?H[r].ansi256(H.rgbToAnsi256(...o)):H[r].ansi(H.rgbToAnsi(...o)):"hex"===e?se("rgb",t,r,...H.hexToRgb(...o)):H[r][e](...o),ie=["rgb","hex","ansi256"];for(const e of ie){oe[e]={get(){const{level:t}=this;return function(...r){const o=de(se(e,re[t],"color",...r),H.color.close,this[ee]);return le(this,o,this[te])}}};oe["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const{level:t}=this;return function(...r){const o=de(se(e,re[t],"bgColor",...r),H.bgColor.close,this[ee]);return le(this,o,this[te])}}}}const ce=Object.defineProperties(()=>{},{...oe,level:{enumerable:!0,get(){return this[Z].level},set(e){this[Z].level=e}}}),de=(e,t,r)=>{let o,n;return void 0===r?(o=e,n=t):(o=r.openAll+e,n=t+r.closeAll),{open:e,close:t,openAll:o,closeAll:n,parent:r}},le=(e,t,r)=>{const o=(...e)=>ue(o,1===e.length?""+e[0]:e.join(" "));return Object.setPrototypeOf(o,ce),o[Z]=e,o[ee]=t,o[te]=r,o},ue=(e,t)=>{if(e.level<=0||!t)return e[te]?"":t;let r=e[ee];if(void 0===r)return t;const{openAll:o,closeAll:n}=r;if(t.includes(""))for(;void 0!==r;)t=Y(t,r.close,r.open),r=r.parent;const a=t.indexOf("\n");return-1!==a&&(t=function(e,t,r,o){let n=0,a="";do{const s="\r"===e[o-1];a+=e.slice(n,s?o-1:o)+t+(s?"\r\n":"\n")+r,n=o+1,o=e.indexOf("\n",n)}while(-1!==o);return a+=e.slice(n),a}(t,n,o,a)),o+t+n};Object.defineProperties(ae.prototype,oe);const pe=ae();ae({level:X?X.level:0});const fe=e("build").description("Build the application using a manifest file and environment-specific configuration.").addHelpText("after",["Builds the application using a manifest file and environment-specific configuration.","If no manifest is provided, searches for a default app.manifest.[ts|js|json] in the current directory.","You can use environment variables to customize the build process.","","Arguments:"," [manifest] Manifest file to use for building (e.g., app.manifest.ts)","","Options:"," -d, --debug Enable debug mode for verbose logging (default: false)","","Examples:"," $ fusion build"," $ fusion build app.manifest.dev.ts --debug"].join("\n")).option("-d, --debug","Enable debug mode for verbose logging",!1).argument("[manifest]","Manifest file to use for building (e.g., app.manifest.ts)").action(async(e,t)=>{const r=new c("app:build",{debug:t.debug});await d({log:r,manifest:e})}),me="app-bundle.zip",he=e("pack").description("Create a distributable app bundle of the application.").addHelpText("after",["Creates a distributable app bundle of the application.","Bundles all necessary files for deployment.","You can specify the output filename and directory, and optionally provide a manifest file.","If no manifest is provided, defaults to app.manifest.[ts|js|json] in the current directory.","","Arguments:"," [manifest] Manifest file to use for bundling (e.g., app.manifest.ts)","","Options:"," -a, --archive Name of the output archive file (default: app-bundle.zip)"," -o, --output Directory where the archive will be saved (default: current working directory)"," -d, --debug Enable debug mode for verbose logging","","Examples:"," $ fusion pack"," $ fusion pack app.manifest.dev.ts --archive my-app.zip --output ./dist"].join("\n")).option("-a, --archive [string]","Name of the output archive file (default: app-bundle.zip)",me).option("-o, --output [string]","Directory where the archive will be saved (default: current working directory)",process.cwd()).option("-d, --debug","Enable debug mode for verbose logging",!1).argument("[manifest]","Manifest file to use for bundling (e.g., app.manifest.ts)").action(async(e,t)=>{const r=new c("app:pack",{debug:t.debug});await l({log:r,manifest:e,archive:t.archive}).catch(e=>{r.error("Failed to create package:",e),process.exit(1)})}),ge=e=>{const r=Object.values(u).filter(t=>t!==u.Development||e.allowDev);return t("-e, --env <string>",["Specify the environment to use for the Fusion Framework command.",`Allowed values: [${r.join(", ")}, custom]`,"You can also set the environment using the FUSION_ENV environment variable.",`Defaults to ${e.default??p(e.allowDev)}.`,e.allowDev?"Development environment is allowed.":"Development environment is not allowed for this command."].join(" ")).env("FUSION_ENV").default(e.default??p(e.allowDev))};ge({allowDev:!0});const ve=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,ye=t("--tenantId <string>","The Azure Active Directory tenant ID").env("FUSION_TENANT_ID").default("3aa4a235-b6e2-48d5-9195-7fcf05b459b0"),be=t("--clientId <string>","The client ID of the application registered in Azure AD").env("FUSION_CLIENT_ID").default("a318b8e1-0295-4e17-98d5-35f67dfeba14"),$e=t("--token <string>","The Azure AD access token. If provided, the --tenant and --client options are ignored").env("FUSION_TOKEN").default(void 0),we=t("--scope <scopes...>","Azure audience scope, normally the application ID URI of the API you want to access and `.default`").env("FUSION_AUTH_SCOPE").default(["5a842df8-3238-415d-b168-9f16a6a6031b/.default"]),_e=(e,t)=>(e.addOption(ye),e.addOption(be),t?.excludeToken||e.addOption($e),t?.includeScope&&e.addOption(we),e.hook("preAction",e=>{const o=e.opts();if(o.token){if("string"!=typeof o.token||""===o.token.trim())throw new r("Token must be a non-empty string.");return e.setOptionValue("tenantId",void 0),e.setOptionValue("clientId",void 0),void(t?.includeScope&&e.setOptionValue("scope",void 0))}if(!o.tenantId||"string"!=typeof o.tenantId)throw new r("Tenant ID must be a non-empty string.");if(!ve.test(o.tenantId))throw new r("Tenant ID must be a valid UUID.");if(!o.clientId||"string"!=typeof o.clientId)throw new r("Client ID must be a non-empty string.");if(!ve.test(o.clientId))throw new r("Client ID must be a valid UUID.");if(t?.includeScope){if(!Array.isArray(o.scope)||0===o.scope.length)throw new r("Scope must be a non-empty array of strings.");for(const e of o.scope)if("string"!=typeof e||""===e.trim())throw new r("Each scope must be a non-empty string.")}}),e),ke=_e(e("check").description("Check if application is registered in Fusion app store.").addHelpText("after",["Checks if the application is registered in the Fusion app store.","Verifies the registration status of your application in the Fusion app store.","Helps identify issues with app registration or configuration.","Supports authentication and environment options. Provides a debug mode for verbose logging.","","Options:"," -d, --debug Enable debug mode for verbose logging (default: false)"," --environment <env> Specify the environment (see available environments)"," --token <token> Provide an authentication token (if required)","","Examples:"," $ fusion check --environment prod --debug"].join("\n")).option("-d, --debug","debug mode",!1).addOption(ge({allowDev:!1})).action(e=>{const t=new c("app:check",{debug:!!e.debug});return f({log:t,environment:e.environment,auth:"token"in e?{token:e.token}:e})})),Pe=_e(e("upload").description("Upload a Fusion application bundle to the Fusion App Store.").addHelpText("after",["","Uploads a Fusion application bundle to the Fusion App Store.","Uploads a distributable application bundle (e.g., app-bundle.zip) to the Fusion app registry.","Supports specifying application key, environment, and debug mode.","","Arguments:"," [bundle] Application bundle to upload (default: app-bundle.zip)","","Options:"," -k, --appKey <string> Application key (if not provided, resolved from manifest)"," -e, --env <env> Target environment"," -d, --debug Enable debug mode for verbose logging","","Examples:"," $ fusion upload"," $ fusion upload my-app-bundle.zip --appKey my-app"," $ fusion upload --debug"].join("\n")).option("-d, --debug [boolean]","Enable debug mode for verbose logging",!1).option("-k, --appKey <string>","Application key (if not provided, resolved from manifest)").addOption(ge({allowDev:!1})).argument("[bundle]","Application bundle to upload (default: app-bundle.zip)",me).action(async(e,t)=>{const r=new c("portal:upload",{debug:t.debug});r?.start("💾 Initializing Fusion Framework...");const o=await m({env:t.env,auth:{token:t.token,tenantId:t.tenantId,clientId:t.clientId}});r?.succeed("💾 Initialized Fusion Framework"),await h({log:r,appKey:t.appKey,framework:o,fileOrBundle:e}).catch(e=>{r.error("😢 Failed to upload bundle:",e),process.exit(1)})})),Se=_e(e("config").description("Generate or publish the Fusion application configuration file.").addHelpText("after",["Generate and/or publish the application configuration for Fusion apps.","","By default, outputs the generated config to stdout or a file. Use --publish to upload the config to the Fusion app registry.","Options [token, tenant, client, manifest] are only relevant when --publish is used.","Option [-e, --env] cannot be set to dev when --publish is used.","","Arguments:"," [config] Config build file to use (e.g., app.config[.env]?.[ts,js,json])","","Options:"," --debug Enable debug mode for verbose logging"," --silent Silent mode, suppresses output except errors"," --publish Publish config to Fusion app registry"," --manifest <path> Path to the app manifest file (required with --publish)"," -e, --env <env> Target environment"," -o, --output <stdout|path> Output to stdout or a file (default: stdout)","","Examples:"," $ fusion-framework-cli config app.config.ts"," $ fusion-framework-cli config app.config.prod.ts --output ./dist/app.config.json"," $ fusion-framework-cli config --publish --manifest app.manifest.ts --env prod"," $ fusion-framework-cli config --env prod my-custom.config.ts"].join("\n")).option("--debug","Enable debug mode for verbose logging").option("--silent","Silent mode, suppresses output except errors").option("--publish","Publish config to Fusion app registry").option("--manifest <path>","Path to the app manifest file (required with --publish)").addOption(ge({allowDev:!0})).option("-o, --output <stdout|path>","Output the result to stdout or a file (ignored with --publish, default: stdout)","stdout").argument("[config]","Config build file to use (e.g., app.config[.env]?.[ts,js,json])").action(async(e,t)=>{const r=t.silent?null:new c("app:config",{debug:!!t.debug});if(t.publish)return"dev"===t.env&&(r?.fail("🤪",pe.blue("--env"),'cannot be "dev" when',pe.blue("--publish")," is used"),process.exit(1)),g({config:t.config,manifest:t.manifest,environment:t.env,auth:"token"in t?{token:t.token}:t,debug:t.debug});const{config:o}=await v({log:r,config:e,env:{environment:t.env},output:"stdout"===t.output?void 0:t.output});"stdout"===t.output&&x.write(JSON.stringify(o,null,2))})),Ee=_e(e("tag").description("Tag your Fusion application with a specific version or preview.").addHelpText("after",["","Tags a Fusion application with a specific version or preview in the Fusion app registry.","Applies a tag to the specified application version for release management.","App key and version can be provided or resolved from the manifest file.","Supports environment selection, debug, and silent modes.","","Arguments:"," <tag> Tag to apply (latest | preview | stable)","","Options:"," --appKey <string> Application key (if not provided, resolved from manifest)"," -v, --version <string> Version to tag (if not provided, resolved from manifest)"," -m, --manifest <string> Manifest file to use for resolving app key and version"," --debug Enable debug mode for verbose logging"," --silent Silent mode, suppresses output except errors"," -e, --env <env> Target environment","","Examples:"," $ fusion tag latest"," $ fusion tag preview --env prod --manifest app.manifest.prod.ts"," $ fusion tag stable --appKey my-app --version 1.2.3"].join("\n")).addOption(ge({allowDev:!1})).option("--appKey <string>","Application key (if not provided, resolved from manifest)").option("-v, --version <string>","Version to tag (if not provided, resolved from manifest)").option("-m, --manifest <string>","Manifest file to use for resolving app key and version").option("--debug","Enable debug mode for verbose logging").option("--silent","Silent mode, suppresses output except errors").argument("<tag>",`Tag to apply (${Object.values(y).join(" | ")})`).action(async(e,t)=>{const r=t.silent?null:new c("app:tag",{debug:t.debug}),o={command:"build",environment:t.env,mode:process.env.NODE_ENV??"production",root:process.cwd()};let n=t.appKey,a=t.version;if(!n||!a){const{manifest:e}=await b({log:r,manifest:t.manifest,env:o});n=n??e.appKey,a=a??e.build?.version}r?.start("Initializing Fusion Framework...");const s=await m({env:t.env,auth:{token:t.token,tenantId:t.tenantId,clientId:t.clientId}});r?.succeed("Initialized Fusion Framework"),r?.start("Tagging application..."),await $({appKey:n,version:a,framework:s,log:r,tag:e}).catch(e=>{r?.error("Failed to tag application:",e),process.exit(1)})})),je=e("dev").description("Start the application in development mode.").addHelpText("after",["","Starts the application in development mode with a local dev server.","","Options:"," --debug Enable debug mode"," --manifest <path> Path to the app manifest file (app.manifest[.env]?.[ts,js,json])"," --config <path> Path to the app config file (app.config[.env]?.[ts,js,json])"," --env <environment> Runtime environment for the dev server (default: local)"," --port <port> Port for the development server (default: 3000)","","Examples:"," $ fusion app dev"," $ fusion app dev --port 4000"," $ fusion app dev --manifest ./app.manifest.local.ts --config ./app.config.ts"].join("\n")).option("--debug","Enable debug mode").option("--manifest <path>","Path to the app manifest file (app.manifest[.env]?.[ts,js,json])").option("--config <path>","Path to the app config file (app.config[.env]?.[ts,js,json])").option("--env <environment>","Runtime environment for the dev server","local").option("--port <port>","Port for the development server","3000").action(async e=>{const t=new c("app:dev",{debug:e.debug});t.start("Starting application in development mode..."),w({log:t,manifest:e.manifest,config:e.config,env:e.env,port:e.port}),t.succeed("Development server started successfully.")}),Oe=(e,t)=>{try{return R(e,A.F_OK),!0}catch(e){return!1}},Ne=e("manifest").description("Build and output the application manifest for Fusion apps.").addHelpText("after",["","Builds and outputs the application manifest for Fusion apps.","By default, prints the manifest to stdout. Use --output to write to a file.","You can specify a custom manifest build file or use the default (app.manifest[.env]?.[ts,js,json]).","Supports debug and silent modes for flexible output.","","Arguments:"," [manifest] Manifest build file to use (e.g., app.manifest[.env]?.[ts,js,json])","","Options:"," -d, --debug Enable debug mode for verbose logging"," -o, --output Write manifest to the specified file (default: stdout)"," -s, --silent Silent mode, suppresses output except errors","","Examples:"," $ fusion manifest"," $ fusion manifest app.manifest.prod.ts --output ./dist/app.manifest.json"," $ fusion manifest --debug"].join("\n")).option("-d, --debug","Enable debug mode for verbose logging",!1).option("-o, --output <string>","Write manifest to the specified file","stdout").option("-s, --silent","Silent mode, suppresses output except errors").argument("[manifest]","Manifest build file to use (e.g., app.manifest[.env]?.[ts,js,json])").action(async(e,t)=>{const r=t.silent?null:new c("app:manifest",{debug:t.debug}),o=await b({log:r,manifest:e});if(t.output){const e=a(process.cwd(),t.output);r?.start("Writing manifest to file",t.output),Oe(s(e))||await T(s(e),{recursive:!0}),await C(e,JSON.stringify(o.manifest,null,2)),r?.succeed("Manifest written to file",e)}else x.write(JSON.stringify(o.manifest,null,2))}),Ie=_e(e("publish").description("Build, upload, and tag your Fusion application for deployment.").addHelpText("after",["","Builds, uploads, and tags a Fusion application for deployment to the Fusion portal.","Bundles the app, uploads it to the Fusion app store, and applies a tag for versioning.","Supports specifying environment, manifest file, and tag.","Debug mode and authentication options are supported.","","Arguments:"," [bundle] Path to the app bundle to upload","","Options:"," -d, --debug Enable debug mode for verbose logging (default: false)"," -e, --env <env> Target environment"," -m, --manifest Manifest file to use for bundling (e.g., app.manifest.ts)"," -t, --tag Tag to apply to the published app (latest | preview)","","Examples:"," $ fusion publish"," $ fusion publish --env prod --manifest app.manifest.prod.ts"," $ fusion publish --tag latest app.bundle.zip"].join("\n")).option("-d, --debug","Enable debug mode for verbose logging",!1).addOption(ge({allowDev:!1})).option("-m, --manifest [string]","Manifest file to use for bundling (e.g., app.manifest.ts)").option("-t, --tag [string]",`Tag to apply to the published app (${Object.values(y).join(" | ")})`,y.Latest).argument("[bundle]","Path to the app bundle to upload").action(async(e,t)=>{const r=new c("app:publish",{debug:t.debug});let o;if(e)r.info(`📦 Using provided bundle: ${e}`),o=e;else try{r.start("📦 Bundle application...");o=(await l({log:r,manifest:t.manifest})).archive,r.succeed("📦 Bundle completed")}catch(e){r.error("😢 Failed to bundle application:",e),process.exit(1)}o||(r.error("😢 No bundle provided or created. Please specify a bundle file."),process.exit(1)),r?.start("💾 Initializing Fusion Framework...");const n=await m({env:t.env,auth:{token:t.token,tenantId:t.tenantId,clientId:t.clientId}});r?.succeed("💾 Initialized Fusion Framework"),r.start("🚀 Uploading application...");const a=await h({log:r,framework:n,fileOrBundle:o}).catch(e=>{r.error("😢 Failed to upload bundle:",e),process.exit(1)});r.succeed("🚀 Upload completed"),r.debug("Upload result:",a),r.start("🏷️ Tagging application...");const s=await $({tag:t.tag,appKey:a.name,version:a.version,log:r,framework:n}).catch(e=>{r.error("😢 Failed to tag application:",e),process.exit(1)});r.succeed("Tagging completed"),r.debug("Tagging result:",s)}));he.alias("build-pack").hook("preAction",e=>{"build-pack"===process.argv[3]&&(console.warn(pe.bgRedBright.bold('The command "build-pack" is deprecated. Please use "pack" instead.')),e.getOptionValue("archive")||e.setOptionValue("archive",me))}),Pe.alias("build-upload").hook("preAction",e=>{if("build-upload"===process.argv[3]){if(console.warn(pe.bgRedBright.bold('The command "build-upload" is deprecated. Please use "upload" instead.')),e.getOptionValue("service"))throw new Error("The --service option is deprecated. Please use --env instead.");const t=e.getOptionValue("bundle")??me;process.argv[4]=t}}),Ne.alias("build-manifest").hook("preAction",()=>{"build-manifest"===process.argv[3]&&console.warn(pe.bgRedBright.bold('The command "build-manifest" is deprecated. Please use "manifest" instead.'))}),Ie.alias("build-publish").hook("preAction",e=>{if("build-publish"===process.argv[3]&&console.warn(pe.bgRedBright.bold('The command "build-publish" is deprecated. Please use "publish" instead.')),e.getOptionValue("service"))throw new Error("The --service option is deprecated. Please use --env instead.")});const xe=e("app").description("Develop, build, configure, and deploy Fusion applications from your workspace root.").addHelpText("after",["",'The "app" command is your main entry point for managing Fusion applications in this workspace.',"","It provides access to subcommands for every stage of the application lifecycle, including development, building, packaging, configuration, deployment, and release management.","","All available subcommands are listed below automatically. For details and options for a specific subcommand, run:"," fusion app <subcommand> --help","","Typical usage:"," - Run and test your app locally with the dev subcommand"," - Build, bundle, and configure your app for deployment"," - Upload, publish, and tag releases to the Fusion App Store"," - Check registration and generate manifests as needed","","This command should be run from your app root directory."].join("\n")).addCommand(fe).addCommand(he).addCommand(ke).addCommand(Pe).addCommand(Se).addCommand(Ee).addCommand(je).addCommand(Ne).addCommand(Ie),Te=e("login").description("Authenticate and log in to Fusion Framework using interactive browser-based authentication.").addHelpText("after",["","Authenticate and log in to Fusion Framework using interactive browser-based authentication.","","This command initializes the Fusion Framework and opens a browser window for secure login.","Supports custom tenant, client, and scope options for advanced authentication scenarios.","","Options:"," --tenant <tenantId> Specify the tenant ID"," --client <clientId> Specify the client ID"," --scope <scope> Specify the scope(s) for authentication"," --debug Enable debug mode for verbose logging","","Examples:"," $ fusion-framework-cli login"," $ fusion-framework-cli login --tenant my-tenant --client my-client-id --scope api://my-app/.default"].join("\n")).action(async e=>{const t=new c("auth:login",{debug:e.debug}),r="string"==typeof e.scope?[e.scope]:e.scope;t.start("Initializing Fusion Framework...");const o=await m({auth:{tenantId:e.tenantId,clientId:e.clientId,interactive:!0,server:{port:49741}}});t.succeed("Initialized Fusion Framework");try{t.start("Logging in...");const e=await o.auth.login({scopes:r});t.info("username:",pe.green(e.account?.username)),t.info("tenant: ",pe.yellow(e.tenantId)),t.info("audience:",pe.yellow(e.account?.idTokenClaims?.aud));for(const r of e.scopes)t.info("scope: ",pe.dim(r));t.succeed("Successfully logged in",pe.greenBright(e.account?.name))}catch(r){throw t.fail("Failed to log in 🥺",JSON.stringify({tenant:e.tenant,client:e.clientId},void 0,2)),r}});_e(Te,{includeScope:!0,excludeToken:!0});const Ce=e("logout").description("Log out from Fusion Framework and clear your authentication session.").addHelpText("after",["","Log out from Fusion Framework and clear your authentication session.","","This command removes your current authentication state from the Fusion Framework CLI.","Supports custom tenant and client options for advanced scenarios.","","Options:"," --tenant <tenantId> Specify the tenant ID"," --client <clientId> Specify the client ID"," --debug Enable debug mode for verbose logging","","Examples:"," $ fusion-framework-cli logout"," $ fusion-framework-cli logout --tenant my-tenant --client my-client-id"].join("\n")).action(async e=>{const t=new c("auth:logout",{debug:e.debug});t.start("Initializing Fusion Framework...");const r=await m({auth:{tenantId:e.tenantId,clientId:e.clientId}});t.succeed("Initialized Fusion Framework");try{t.start("Logging in..."),await r.auth.logout(),t.succeed("Successfully logged out")}catch(r){throw t.fail("Failed to log out 🥺",JSON.stringify({tenant:e.tenant,client:e.clientId},void 0,2)),r}});_e(Ce,{excludeToken:!0,includeScope:!1});class Re extends Error{static Name="NoAccountsError";constructor(e,t){super(e,t),this.name=Re.Name}}const Ae=e("token").description("Acquire and print an access token for Fusion APIs using your current authentication context.").addHelpText("after",["","Acquire and print an access token for Fusion APIs using your current authentication context.","","This command retrieves an access token for the specified scopes, tenant, and client.","Supports debug and silent modes for flexible output.","","Options:"," --tenant <tenantId> Specify the tenant ID"," --client <clientId> Specify the client ID"," --scope <scope> Specify the scope(s) for authentication"," --debug Enable debug mode for verbose logging"," --silent Only output the token (no extra logging)","","Examples:"," $ fusion-framework-cli token"," $ fusion-framework-cli token --scope api://my-app/.default"," $ fusion-framework-cli token --tenant my-tenant --client my-client-id --silent"].join("\n")).option("-d, --debug","Enable debug mode for verbose logging",!1).option("--silent","Only output the token (no extra logging)").action(async e=>{const t=e.silent?null:new c("auth:token",{debug:e.debug}),r="string"==typeof e.scope?[e.scope]:e.scope;console.log("options"),t?.info("Using tenant",e.tenantId),t?.info("Using client",e.clientId),t?.info("Using scope",JSON.stringify(r)),t?.start("Initializing Fusion Framework...");const o=await m({auth:{tenantId:e.tenantId,clientId:e.clientId}});t?.succeed("Initialized Fusion Framework");try{t?.start("Getting access token...");const n=await o.auth.acquireAccessToken({scopes:r});t?.succeed("Successfully acquired access token"),e.silent?console.log(n):t?.info("Access token:",n)}catch(r){if(e.silent||!(r instanceof Re))throw r;t?.fail("No accounts found, please login first")}});_e(Ae,{includeScope:!0});const Fe=new o("auth").description("Authenticate with Fusion Framework CLI").addHelpText("after",["","Authentication commands for Fusion Framework CLI.","","Use these commands to log in, log out, or acquire tokens for Fusion APIs.","","Examples:"," $ fusion-framework-cli auth login"," $ fusion-framework-cli auth logout"," $ fusion-framework-cli auth token --scope api://my-app/.default"].join("\n"));Fe.addCommand(Te,{isDefault:!0}),Fe.addCommand(Ce),Fe.addCommand(Ae);const Me=_e(e("resolve").description("Resolve and display information about a service registered in Fusion service discovery.").addHelpText("after",["","Resolve and display information about a service registered in Fusion service discovery.","","This command looks up a service by name and prints its discovery details using the current authentication and environment.","","Examples:"," $ fusion-framework-cli resolve my-service"," $ fusion-framework-cli resolve my-service --env prod"," $ fusion-framework-cli resolve my-service --env test --tenantId my-tenant --clientId my-client-id","","The command will print the resolved service details to the console."].join("\n")).addOption(ge({allowDev:!1})).argument("<service>","Name of the service to resolve in Fusion service discovery").action(async(e,t)=>{const r=new c("disco:resolve");r.start("Initializing Fusion Framework..."),console.log("Options:",t);const o=await m({env:t.environment,auth:{token:t.token,tenantId:t.tenantId,clientId:t.clientId}});r.succeed("Initialized Fusion Framework"),r.start(`Resolving service ${e}...`);const n=await o.serviceDiscovery.resolveService(e);r.succeed(`Resolved service ${e}`),console.debug(n)})),De=e("disco").description("Service discovery operations");De.addCommand(Me);const Ve=e("dev").description("Start a local development server for the Fusion portal.").addHelpText("after",["","Starts a local development server for your Fusion portal.","","Options:"," -p, --port Port to run the development server on (default: 3000)"," -d, --debug Enable debug mode for verbose logging","","Examples:"," $ fusion-framework-cli portal dev"," $ fusion-framework-cli portal dev --port 4000 --debug"].join("\n")).option("-p, --port <number>","Port to run the development server on","3000").option("-d, --debug","Enable debug mode for verbose logging").action(async e=>{const t=new c("portal:dev",{debug:e.debug});t.start("Starting application in development mode..."),_({server:{port:Number(e.port)},log:t}),t.succeed("Development server started successfully.")}),ze=e("manifest").description("Generate or validate a Fusion portal manifest file.").addHelpText("after",["Generates or validates a Fusion portal manifest file.","","If no manifest is provided, a default portal.manifest.[ts|js|json] is used from the current directory.","","Options:"," -o, --output Write manifest to the specified file (default: stdout)"," -d, --debug Enable debug mode for verbose logging"," -s, --silent Silent mode, suppresses output except errors","","Examples:"," $ fusion-framework-cli portal manifest"," $ fusion-framework-cli portal manifest portal.manifest.prod.ts --output ./dist/portal.manifest.json"].join("\n")).option("-d, --debug","Enable debug mode for verbose logging",!1).option("-o, --output <string>","Write manifest to the specified file","stdout").option("-s, --silent","Silent mode, suppresses output except errors").argument("[manifest]","Manifest build file to use (e.g., app.manifest[.env]?.[ts,js,json])").action(async(e,t)=>{const r=t.silent?null:new c("app:manifest",{debug:t.debug}),o=await k({log:r,manifest:e});if(t.output){const e=a(process.cwd(),t.output);r?.start("Writing manifest to file",t.output),Oe(s(e))||await T(s(e),{recursive:!0}),await C(e,JSON.stringify(o.manifest,null,2)),r?.succeed("Manifest written to file",e)}else x.write(JSON.stringify(o.manifest,null,2))});function Ue(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var qe,Ke={exports:{}},Le={},Be={},He={},Ge={},Je={},We={};function Ye(){return qe||(qe=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class o extends t{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const e=this._items[0];return""===e||'""'===e}get str(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce((e,t)=>`${e}${t}`,"")}get names(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce((e,t)=>(t instanceof r&&(e[t.str]=(e[t.str]||0)+1),e),{})}}function n(e,...t){const r=[e[0]];let n=0;for(;n<t.length;)i(r,t[n]),r.push(e[++n]);return new o(r)}e._Code=o,e.nil=new o(""),e._=n;const a=new o("+");function s(e,...t){const r=[d(e[0])];let n=0;for(;n<t.length;)r.push(a),i(r,t[n]),r.push(a,d(e[++n]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===a){const r=c(e[t-1],e[t+1]);if(void 0!==r){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}(r),new o(r)}function i(e,t){var n;t instanceof o?e.push(...t._items):t instanceof r?e.push(t):e.push("number"==typeof(n=t)||"boolean"==typeof n||null===n?n:d(Array.isArray(n)?n.join(","):n))}function c(e,t){if('""'===t)return e;if('""'===e)return t;if("string"==typeof e){if(t instanceof r||'"'!==e[e.length-1])return;return"string"!=typeof t?`${e.slice(0,-1)}${t}"`:'"'===t[0]?e.slice(0,-1)+t.slice(1):void 0}return"string"!=typeof t||'"'!==t[0]||e instanceof r?void 0:`"${e}${t.slice(1)}`}function d(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.str=s,e.addCodeArg=i,e.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:s`${e}${t}`},e.stringify=function(e){return new o(d(e))},e.safeStringify=d,e.getProperty=function(t){return"string"==typeof t&&e.IDENTIFIER.test(t)?new o(`.${t}`):n`[${t}]`},e.getEsmExportName=function(t){if("string"==typeof t&&e.IDENTIFIER.test(t))return new o(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)},e.regexpCode=function(e){return new o(e.toString())}}(We)),We}var Qe,Xe,Ze={};function et(){return Qe||(Qe=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=Ye();class r extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}var o;!function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"}(o||(e.UsedValueState=o={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class n{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){return`${e}${(this._names[e]||this._nameGroup(e)).index++}`}_nameGroup(e){var t,r;if((null===(r=null===(t=this._parent)||void 0===t?void 0:t._prefixes)||void 0===r?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}e.Scope=n;class a extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:r,itemIndex:o}){this.value=e,this.scopePath=t._`.${new t.Name(r)}[${o}]`}}e.ValueScopeName=a;const s=t._`\n`;e.ValueScope=class extends n{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?s:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw new Error("CodeGen: ref must be passed in value");const o=this.toName(e),{prefix:n}=o,a=null!==(r=t.key)&&void 0!==r?r:t.ref;let s=this._values[n];if(s){const e=s.get(a);if(e)return e}else s=this._values[n]=new Map;s.set(a,o);const i=this._scope[n]||(this._scope[n]=[]),c=i.length;return i[c]=t.ref,o.setValue(t,{property:n,itemIndex:c}),o}getValue(e,t){const r=this._values[e];if(r)return r.get(t)}scopeRefs(e,r=this._values){return this._reduceValues(r,r=>{if(void 0===r.scopePath)throw new Error(`CodeGen: name "${r}" has no value`);return t._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,r)}_reduceValues(n,a,s={},i){let c=t.nil;for(const d in n){const l=n[d];if(!l)continue;const u=s[d]=s[d]||new Map;l.forEach(n=>{if(u.has(n))return;u.set(n,o.Started);let s=a(n);if(s){const r=this.opts.es5?e.varKinds.var:e.varKinds.const;c=t._`${c}${r} ${n} = ${s};${this.opts._n}`}else{if(!(s=null==i?void 0:i(n)))throw new r(n);c=t._`${c}${s}${this.opts._n}`}u.set(n,o.Completed)})}return c}}}(Ze)),Ze}function tt(){return Xe||(Xe=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=Ye(),r=et();var o=Ye();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return o.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return o.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return o.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return o.Name}});var n=et();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return n.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return n.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return n.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return n.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class a{optimizeNodes(){return this}optimizeNames(e,t){return this}}class s extends a{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){const o=e?r.varKinds.var:this.varKind,n=void 0===this.rhs?"":` = ${this.rhs}`;return`${o} ${this.name}${n};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=N(this.rhs,e,t)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class i extends a{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof t.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=N(this.rhs,e,r),this}get names(){return O(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}}class c extends i{constructor(e,t,r,o){super(e,r,o),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class d extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class l extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class u extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class p extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=N(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class f extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;for(;t--;){const r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){const{nodes:r}=this;let o=r.length;for(;o--;){const n=r[o];n.optimizeNames(e,t)||(I(e,n.names),r.splice(o,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>j(e,t.names),{})}}class m extends f{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class h extends f{}class g extends m{}g.kind="else";class v extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new g(e):e}return t?!1===e?t instanceof v?t:t.nodes:this.nodes.length?this:new v(x(e),t instanceof v?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null===(r=this.else)||void 0===r?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=N(this.condition,e,t),this}get names(){const e=super.names;return O(e,this.condition),this.else&&j(e,this.else.names),e}}v.kind="if";class y extends m{}y.kind="for";class b extends y{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=N(this.iteration,e,t),this}get names(){return j(super.names,this.iteration.names)}}class $ extends y{constructor(e,t,r,o){super(),this.varKind=e,this.name=t,this.from=r,this.to=o}render(e){const t=e.es5?r.varKinds.var:this.varKind,{name:o,from:n,to:a}=this;return`for(${t} ${o}=${n}; ${o}<${a}; ${o}++)`+super.render(e)}get names(){const e=O(super.names,this.from);return O(e,this.to)}}class w extends y{constructor(e,t,r,o){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=N(this.iterable,e,t),this}get names(){return j(super.names,this.iterable.names)}}class _ extends m{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}_.kind="func";class k extends f{render(e){return"return "+super.render(e)}}k.kind="return";class P extends m{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(t=this.finally)||void 0===t||t.optimizeNodes(),this}optimizeNames(e,t){var r,o;return super.optimizeNames(e,t),null===(r=this.catch)||void 0===r||r.optimizeNames(e,t),null===(o=this.finally)||void 0===o||o.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&j(e,this.catch.names),this.finally&&j(e,this.finally.names),e}}class S extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}S.kind="catch";class E extends m{render(e){return"finally"+super.render(e)}}E.kind="finally";function j(e,t){for(const r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function O(e,r){return r instanceof t._CodeOrName?j(e,r.names):e}function N(e,r,o){return e instanceof t.Name?a(e):(n=e)instanceof t._Code&&n._items.some(e=>e instanceof t.Name&&1===r[e.str]&&void 0!==o[e.str])?new t._Code(e._items.reduce((e,r)=>(r instanceof t.Name&&(r=a(r)),r instanceof t._Code?e.push(...r._items):e.push(r),e),[])):e;var n;function a(e){const t=o[e.str];return void 0===t||1!==r[e.str]?e:(delete r[e.str],t)}}function I(e,t){for(const r in t)e[r]=(e[r]||0)-(t[r]||0)}function x(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:t._`!${A(e)}`}e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new r.Scope({parent:e}),this._nodes=[new h]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,o){const n=this._scope.toName(t);return void 0!==r&&o&&(this._constants[n.str]=r),this._leafNode(new s(e,n,r)),n}const(e,t,o){return this._def(r.varKinds.const,e,t,o)}let(e,t,o){return this._def(r.varKinds.let,e,t,o)}var(e,t,o){return this._def(r.varKinds.var,e,t,o)}assign(e,t,r){return this._leafNode(new i(e,t,r))}add(t,r){return this._leafNode(new c(t,e.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==t.nil&&this._leafNode(new p(e)),this}object(...e){const r=["{"];for(const[o,n]of e)r.length>1&&r.push(","),r.push(o),(o!==n||this.opts.es5)&&(r.push(":"),(0,t.addCodeArg)(r,n));return r.push("}"),new t._Code(r)}if(e,t,r){if(this._blockNode(new v(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new v(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(v,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new b(e),t)}forRange(e,t,o,n,a=(this.opts.es5?r.varKinds.var:r.varKinds.let)){const s=this._scope.toName(e);return this._for(new $(a,s,t,o),()=>n(s))}forOf(e,o,n,a=r.varKinds.const){const s=this._scope.toName(e);if(this.opts.es5){const e=o instanceof t.Name?o:this.var("_arr",o);return this.forRange("_i",0,t._`${e}.length`,r=>{this.var(s,t._`${e}[${r}]`),n(s)})}return this._for(new w("of",a,s,o),()=>n(s))}forIn(e,o,n,a=(this.opts.es5?r.varKinds.var:r.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,t._`Object.keys(${o})`,n);const s=this._scope.toName(e);return this._for(new w("in",a,s,o),()=>n(s))}endFor(){return this._endBlockNode(y)}label(e){return this._leafNode(new d(e))}break(e){return this._leafNode(new l(e))}return(e){const t=new k;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(k)}try(e,t,r){if(!t&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const o=new P;if(this._blockNode(o),this.code(e),t){const e=this.name("e");this._currNode=o.catch=new S(e),t(e)}return r&&(this._currNode=o.finally=new E,this.code(r)),this._endBlockNode(S,E)}throw(e){return this._leafNode(new u(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){const t=this._blockStarts.pop();if(void 0===t)throw new Error("CodeGen: not in self-balancing block");const r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,r=t.nil,o,n){return this._blockNode(new _(e,r,o)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(_)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){const r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof v))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}},e.not=x;const T=R(e.operators.AND);e.and=function(...e){return e.reduce(T)};const C=R(e.operators.OR);function R(e){return(r,o)=>r===t.nil?o:o===t.nil?r:t._`${A(r)} ${e} ${A(o)}`}function A(e){return e instanceof t.Name?e:t._`(${e})`}e.or=function(...e){return e.reduce(C)}}(Je)),Je}var rt,ot={};function nt(){if(rt)return ot;rt=1,Object.defineProperty(ot,"__esModule",{value:!0}),ot.checkStrictMode=ot.getErrorPath=ot.Type=ot.useFunc=ot.setEvaluated=ot.evaluatedPropsToName=ot.mergeEvaluated=ot.eachItem=ot.unescapeJsonPointer=ot.escapeJsonPointer=ot.escapeFragment=ot.unescapeFragment=ot.schemaRefOrVal=ot.schemaHasRulesButRef=ot.schemaHasRules=ot.checkUnknownRules=ot.alwaysValidSchema=ot.toHash=void 0;const e=tt(),t=Ye();function r(e,t=e.schema){const{opts:r,self:o}=e;if(!r.strictSchema)return;if("boolean"==typeof t)return;const n=o.RULES.keywords;for(const r in t)n[r]||u(e,`unknown keyword: "${r}"`)}function o(e,t){if("boolean"==typeof e)return!e;for(const r in e)if(t[r])return!0;return!1}function n(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function a(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function s({mergeNames:t,mergeToName:r,mergeValues:o,resultToName:n}){return(a,s,i,c)=>{const d=void 0===i?s:i instanceof e.Name?(s instanceof e.Name?t(a,s,i):r(a,s,i),i):s instanceof e.Name?(r(a,i,s),s):o(s,i);return c!==e.Name||d instanceof e.Name?d:n(a,d)}}function i(t,r){if(!0===r)return t.var("props",!0);const o=t.var("props",e._`{}`);return void 0!==r&&c(t,o,r),o}function c(t,r,o){Object.keys(o).forEach(o=>t.assign(e._`${r}${(0,e.getProperty)(o)}`,!0))}ot.toHash=function(e){const t={};for(const r of e)t[r]=!0;return t},ot.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(r(e,t),!o(t,e.self.RULES.all))},ot.checkUnknownRules=r,ot.schemaHasRules=o,ot.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(const r in e)if("$ref"!==r&&t.all[r])return!0;return!1},ot.schemaRefOrVal=function({topSchemaRef:t,schemaPath:r},o,n,a){if(!a){if("number"==typeof o||"boolean"==typeof o)return o;if("string"==typeof o)return e._`${o}`}return e._`${t}${r}${(0,e.getProperty)(n)}`},ot.unescapeFragment=function(e){return a(decodeURIComponent(e))},ot.escapeFragment=function(e){return encodeURIComponent(n(e))},ot.escapeJsonPointer=n,ot.unescapeJsonPointer=a,ot.eachItem=function(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)},ot.mergeEvaluated={props:s({mergeNames:(t,r,o)=>t.if(e._`${o} !== true && ${r} !== undefined`,()=>{t.if(e._`${r} === true`,()=>t.assign(o,!0),()=>t.assign(o,e._`${o} || {}`).code(e._`Object.assign(${o}, ${r})`))}),mergeToName:(t,r,o)=>t.if(e._`${o} !== true`,()=>{!0===r?t.assign(o,!0):(t.assign(o,e._`${o} || {}`),c(t,o,r))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:i}),items:s({mergeNames:(t,r,o)=>t.if(e._`${o} !== true && ${r} !== undefined`,()=>t.assign(o,e._`${r} === true ? true : ${o} > ${r} ? ${o} : ${r}`)),mergeToName:(t,r,o)=>t.if(e._`${o} !== true`,()=>t.assign(o,!0===r||e._`${o} > ${r} ? ${o} : ${r}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},ot.evaluatedPropsToName=i,ot.setEvaluated=c;const d={};var l;function u(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw new Error(t);e.self.logger.warn(t)}}return ot.useFunc=function(e,r){return e.scopeValue("func",{ref:r,code:d[r.code]||(d[r.code]=new t._Code(r.code))})},function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(l||(ot.Type=l={})),ot.getErrorPath=function(t,r,o){if(t instanceof e.Name){const n=r===l.Num;return o?n?e._`"[" + ${t} + "]"`:e._`"['" + ${t} + "']"`:n?e._`"/" + ${t}`:e._`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return o?(0,e.getProperty)(t).toString():"/"+n(t)},ot.checkStrictMode=u,ot}var at,st,it,ct={};function dt(){if(at)return ct;at=1,Object.defineProperty(ct,"__esModule",{value:!0});const e=tt(),t={data:new e.Name("data"),valCxt:new e.Name("valCxt"),instancePath:new e.Name("instancePath"),parentData:new e.Name("parentData"),parentDataProperty:new e.Name("parentDataProperty"),rootData:new e.Name("rootData"),dynamicAnchors:new e.Name("dynamicAnchors"),vErrors:new e.Name("vErrors"),errors:new e.Name("errors"),this:new e.Name("this"),self:new e.Name("self"),scope:new e.Name("scope"),json:new e.Name("json"),jsonPos:new e.Name("jsonPos"),jsonLen:new e.Name("jsonLen"),jsonPart:new e.Name("jsonPart")};return ct.default=t,ct}function lt(){return st||(st=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=tt(),r=nt(),o=dt();function n(e,r){const n=e.const("err",r);e.if(t._`${o.default.vErrors} === null`,()=>e.assign(o.default.vErrors,t._`[${n}]`),t._`${o.default.vErrors}.push(${n})`),e.code(t._`${o.default.errors}++`)}function a(e,r){const{gen:o,validateName:n,schemaEnv:a}=e;a.$async?o.throw(t._`new ${e.ValidationError}(${r})`):(o.assign(t._`${n}.errors`,r),o.return(!1))}e.keywordError={message:({keyword:e})=>t.str`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:r})=>r?t.str`"${e}" keyword must be ${r} ($data)`:t.str`"${e}" keyword is invalid ($data)`},e.reportError=function(r,o=e.keywordError,s,c){const{it:d}=r,{gen:l,compositeRule:u,allErrors:p}=d,f=i(r,o,s);(null!=c?c:u||p)?n(l,f):a(d,t._`[${f}]`)},e.reportExtraError=function(t,r=e.keywordError,s){const{it:c}=t,{gen:d,compositeRule:l,allErrors:u}=c;n(d,i(t,r,s)),l||u||a(c,o.default.vErrors)},e.resetErrorsCount=function(e,r){e.assign(o.default.errors,r),e.if(t._`${o.default.vErrors} !== null`,()=>e.if(r,()=>e.assign(t._`${o.default.vErrors}.length`,r),()=>e.assign(o.default.vErrors,null)))},e.extendErrors=function({gen:e,keyword:r,schemaValue:n,data:a,errsCount:s,it:i}){if(void 0===s)throw new Error("ajv implementation error");const c=e.name("err");e.forRange("i",s,o.default.errors,s=>{e.const(c,t._`${o.default.vErrors}[${s}]`),e.if(t._`${c}.instancePath === undefined`,()=>e.assign(t._`${c}.instancePath`,(0,t.strConcat)(o.default.instancePath,i.errorPath))),e.assign(t._`${c}.schemaPath`,t.str`${i.errSchemaPath}/${r}`),i.opts.verbose&&(e.assign(t._`${c}.schema`,n),e.assign(t._`${c}.data`,a))})};const s={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function i(e,r,n){const{createErrors:a}=e.it;return!1===a?t._`{}`:function(e,r,n={}){const{gen:a,it:i}=e,l=[c(i,n),d(e,n)];return function(e,{params:r,message:n},a){const{keyword:i,data:c,schemaValue:d,it:l}=e,{opts:u,propertyName:p,topSchemaRef:f,schemaPath:m}=l;a.push([s.keyword,i],[s.params,"function"==typeof r?r(e):r||t._`{}`]),u.messages&&a.push([s.message,"function"==typeof n?n(e):n]);u.verbose&&a.push([s.schema,d],[s.parentSchema,t._`${f}${m}`],[o.default.data,c]);p&&a.push([s.propertyName,p])}(e,r,l),a.object(...l)}(e,r,n)}function c({errorPath:e},{instancePath:n}){const a=n?t.str`${e}${(0,r.getErrorPath)(n,r.Type.Str)}`:e;return[o.default.instancePath,(0,t.strConcat)(o.default.instancePath,a)]}function d({keyword:e,it:{errSchemaPath:o}},{schemaPath:n,parentSchema:a}){let i=a?o:t.str`${o}/${e}`;return n&&(i=t.str`${i}${(0,r.getErrorPath)(n,r.Type.Str)}`),[s.schemaPath,i]}}(Ge)),Ge}var ut,pt={},ft={};function mt(){if(ut)return ft;ut=1,Object.defineProperty(ft,"__esModule",{value:!0}),ft.getRules=ft.isJSONType=void 0;const e=new Set(["string","number","integer","boolean","null","object","array"]);return ft.isJSONType=function(t){return"string"==typeof t&&e.has(t)},ft.getRules=function(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}},ft}var ht,gt,vt={};function yt(){if(ht)return vt;function e(e,r){return r.rules.some(r=>t(e,r))}function t(e,t){var r;return void 0!==e[t.keyword]||(null===(r=t.definition.implements)||void 0===r?void 0:r.some(t=>void 0!==e[t]))}return ht=1,Object.defineProperty(vt,"__esModule",{value:!0}),vt.shouldUseRule=vt.shouldUseGroup=vt.schemaHasRulesForType=void 0,vt.schemaHasRulesForType=function({schema:t,self:r},o){const n=r.RULES.types[o];return n&&!0!==n&&e(t,n)},vt.shouldUseGroup=e,vt.shouldUseRule=t,vt}function bt(){if(gt)return pt;gt=1,Object.defineProperty(pt,"__esModule",{value:!0}),pt.reportTypeError=pt.checkDataTypes=pt.checkDataType=pt.coerceAndCheckDataType=pt.getJSONTypes=pt.getSchemaTypes=pt.DataType=void 0;const e=mt(),t=yt(),r=lt(),o=tt(),n=nt();var a;function s(t){const r=Array.isArray(t)?t:t?[t]:[];if(r.every(e.isJSONType))return r;throw new Error("type must be JSONType or JSONType[]: "+r.join(","))}!function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"}(a||(pt.DataType=a={})),pt.getSchemaTypes=function(e){const t=s(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},pt.getJSONTypes=s,pt.coerceAndCheckDataType=function(e,r){const{gen:n,data:s,opts:c}=e,l=function(e,t){return t?e.filter(e=>i.has(e)||"array"===t&&"array"===e):[]}(r,c.coerceTypes),p=r.length>0&&!(0===l.length&&1===r.length&&(0,t.schemaHasRulesForType)(e,r[0]));if(p){const t=d(r,s,c.strictNumbers,a.Wrong);n.if(t,()=>{l.length?function(e,t,r){const{gen:n,data:a,opts:s}=e,c=n.let("dataType",o._`typeof ${a}`),l=n.let("coerced",o._`undefined`);"array"===s.coerceTypes&&n.if(o._`${c} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>n.assign(a,o._`${a}[0]`).assign(c,o._`typeof ${a}`).if(d(t,a,s.strictNumbers),()=>n.assign(l,a)));n.if(o._`${l} !== undefined`);for(const e of r)(i.has(e)||"array"===e&&"array"===s.coerceTypes)&&p(e);function p(e){switch(e){case"string":return void n.elseIf(o._`${c} == "number" || ${c} == "boolean"`).assign(l,o._`"" + ${a}`).elseIf(o._`${a} === null`).assign(l,o._`""`);case"number":return void n.elseIf(o._`${c} == "boolean" || ${a} === null
1
+ import{createCommand as e,createOption as t,InvalidOptionArgumentError as r,Command as o}from"commander";import{fileURLToPath as n}from"node:url";import{resolve as a,dirname as s}from"node:path";import{readPackageUpSync as i}from"read-package-up";import{ConsoleLogger as c,buildApplication as d,bundleApp as l,FusionEnv as u,resolveDefaultEnv as p,checkApp as f,initializeFramework as m,uploadApplication as h,publishAppConfig as g,generateApplicationConfig as y,AllowedAppTags as v,tagApplication as b,loadAppManifest as $,startAppDevServer as w,startPortalDevServer as _,loadPortalManifest as k,buildPortal as P,bundlePortal as E,uploadPortalBundle as S,tagPortal as j,AllowedPortalTags as N,publishPortalConfig as I,generatePortalConfig as O}from"@equinor/fusion-framework-cli/bin";import{mkdir as T,writeFile as x}from"node:fs/promises";import{accessSync as C,constants as R,existsSync as A,mkdirSync as M,writeFileSync as D}from"node:fs";import"node:assert";import{importConfig as F,importJSON as V}from"@equinor/fusion-imports";import{z}from"zod";import"deepmerge";import"node:child_process";const U=(e=0)=>t=>`[${t+e}m`,q=(e=0)=>t=>`[${38+e};5;${t}m`,K=(e=0)=>(t,r,o)=>`[${38+e};2;${t};${r};${o}m`,L={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(L.modifier);Object.keys(L.color),Object.keys(L.bgColor);const B=function(){const e=new Map;for(const[t,r]of Object.entries(L)){for(const[t,o]of Object.entries(r))L[t]={open:`[${o[0]}m`,close:`[${o[1]}m`},r[t]=L[t],e.set(o[0],o[1]);Object.defineProperty(L,t,{value:r,enumerable:!1})}return Object.defineProperty(L,"codes",{value:e,enumerable:!1}),L.color.close="",L.bgColor.close="",L.color.ansi=U(),L.color.ansi256=q(),L.color.ansi16m=K(),L.bgColor.ansi=U(10),L.bgColor.ansi256=q(10),L.bgColor.ansi16m=K(10),Object.defineProperties(L,{rgbToAnsi256:{value:(e,t,r)=>e===t&&t===r?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(r/255*5),enumerable:!1},hexToRgb:{value(e){const t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[r]=t;3===r.length&&(r=[...r].map(e=>e+e).join(""));const o=Number.parseInt(r,16);return[o>>16&255,o>>8&255,255&o]},enumerable:!1},hexToAnsi256:{value:e=>L.rgbToAnsi256(...L.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return e-8+90;let t,r,o;if(e>=232)t=(10*(e-232)+8)/255,r=t,o=t;else{const n=(e-=16)%36;t=Math.floor(e/36)/5,r=Math.floor(n/6)/5,o=n%6/5}const n=2*Math.max(t,r,o);if(0===n)return 30;let a=30+(Math.round(o)<<2|Math.round(r)<<1|Math.round(t));return 2===n&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,t,r)=>L.ansi256ToAnsi(L.rgbToAnsi256(e,t,r)),enumerable:!1},hexToAnsi:{value:e=>L.ansi256ToAnsi(L.hexToAnsi256(e)),enumerable:!1}}),L}(),H=(()=>{if(!("navigator"in globalThis))return 0;if(globalThis.navigator.userAgentData){const e=navigator.userAgentData.brands.find(({brand:e})=>"Chromium"===e);if(e&&e.version>93)return 3}return/\b(Chrome|Chromium)\//.test(globalThis.navigator.userAgent)?1:0})(),G=0!==H&&{level:H},J={stdout:G,stderr:G};function W(e,t,r){let o=e.indexOf(t);if(-1===o)return e;const n=t.length;let a=0,s="";do{s+=e.slice(a,o)+t+r,a=o+n,o=e.indexOf(t,a)}while(-1!==o);return s+=e.slice(a),s}const{stdout:Y,stderr:Q}=J,X=Symbol("GENERATOR"),Z=Symbol("STYLER"),ee=Symbol("IS_EMPTY"),te=["ansi","ansi","ansi256","ansi16m"],re=Object.create(null),oe=e=>{const t=(...e)=>e.join(" ");return((e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");const r=Y?Y.level:0;e.level=void 0===t.level?r:t.level})(t,e),Object.setPrototypeOf(t,ne.prototype),t};function ne(e){return oe(e)}Object.setPrototypeOf(ne.prototype,Function.prototype);for(const[e,t]of Object.entries(B))re[e]={get(){const r=de(this,ce(t.open,t.close,this[Z]),this[ee]);return Object.defineProperty(this,e,{value:r}),r}};re.visible={get(){const e=de(this,this[Z],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const ae=(e,t,r,...o)=>"rgb"===e?"ansi16m"===t?B[r].ansi16m(...o):"ansi256"===t?B[r].ansi256(B.rgbToAnsi256(...o)):B[r].ansi(B.rgbToAnsi(...o)):"hex"===e?ae("rgb",t,r,...B.hexToRgb(...o)):B[r][e](...o),se=["rgb","hex","ansi256"];for(const e of se){re[e]={get(){const{level:t}=this;return function(...r){const o=ce(ae(e,te[t],"color",...r),B.color.close,this[Z]);return de(this,o,this[ee])}}};re["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const{level:t}=this;return function(...r){const o=ce(ae(e,te[t],"bgColor",...r),B.bgColor.close,this[Z]);return de(this,o,this[ee])}}}}const ie=Object.defineProperties(()=>{},{...re,level:{enumerable:!0,get(){return this[X].level},set(e){this[X].level=e}}}),ce=(e,t,r)=>{let o,n;return void 0===r?(o=e,n=t):(o=r.openAll+e,n=t+r.closeAll),{open:e,close:t,openAll:o,closeAll:n,parent:r}},de=(e,t,r)=>{const o=(...e)=>le(o,1===e.length?""+e[0]:e.join(" "));return Object.setPrototypeOf(o,ie),o[X]=e,o[Z]=t,o[ee]=r,o},le=(e,t)=>{if(e.level<=0||!t)return e[ee]?"":t;let r=e[Z];if(void 0===r)return t;const{openAll:o,closeAll:n}=r;if(t.includes(""))for(;void 0!==r;)t=W(t,r.close,r.open),r=r.parent;const a=t.indexOf("\n");return-1!==a&&(t=function(e,t,r,o){let n=0,a="";do{const s="\r"===e[o-1];a+=e.slice(n,s?o-1:o)+t+(s?"\r\n":"\n")+r,n=o+1,o=e.indexOf("\n",n)}while(-1!==o);return a+=e.slice(n),a}(t,n,o,a)),o+t+n};Object.defineProperties(ne.prototype,re);const ue=ne();ne({level:Q?Q.level:0});const pe=e("build").description("Build the application").addHelpText("after",["","If no manifest is provided, searches for a default app.manifest(.$ENV)?.[ts|js|json] in the current directory.","example: `ffc app build --env prod` will search for `app.manifest.prod.ts` then fallback to `app.manifest.ts`","","NOTE: app manifest is not required, a default manifest will be generated if not provided","","OUTPUT LOCATION:"," The build output location is determined by the `main` field in your package.json.",' - "main": "dist/index.js" → outputs to dist/index.js',' - "main": "build/app.js" → outputs to build/app.js'," - No main field → defaults to dist/bundle.js"," Output directory cannot be project root, src/, or current working directory.","","Examples:"," $ ffc app build"," $ ffc app build app.manifest.dev.ts --debug"].join("\n")).option("-d, --debug","Enable debug mode for verbose logging",!1).argument("[manifest]","Manifest file to use for building (e.g., app.manifest.ts)").action(async(e,t)=>{const r=new c("app:build",{debug:t.debug});await d({log:r,manifest:e})}),fe="app-bundle.zip",me=e("pack").description("Create a distributable app bundle of the application.").addHelpText("after",["","If no manifest is provided, a default app.manifest(.$ENV)?.[ts|js|json] is used from the current directory.","example: `ffc app pack --env prod` will search for `app.manifest.prod.ts` then fallback to `app.manifest.ts`","","NOTE: app manifest is not required, a default manifest will be generated if not provided","","Examples:"," $ ffc app pack"," $ ffc app pack app.manifest.dev.ts --archive my-app.zip --output ./dist"].join("\n")).option("-a, --archive [string]","Name of the output archive file (default: app-bundle.zip)",fe).option("-o, --output [string]","Directory where the archive will be saved (default: current working directory)",process.cwd()).option("-d, --debug","Enable debug mode for verbose logging",!1).argument("[manifest]","Manifest file to use for bundling (e.g., app.manifest.ts)").action(async(e,t)=>{const r=new c("app:pack",{debug:t.debug});await l({log:r,manifest:e,archive:t.archive}).catch(e=>{r.error("Failed to create package:",e),process.exit(1)})}),he=e=>{const r=Object.values(u).filter(t=>t!==u.Development||e.allowDev);return t("-e, --env <string>",`Set environment [${r.join(", ")}, custom].`).env("FUSION_ENV").default(e.default??p(e.allowDev))};he({allowDev:!0});const ge=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,ye=t("--tenantId <string>","The Azure Active Directory tenant ID").env("FUSION_TENANT_ID").default("3aa4a235-b6e2-48d5-9195-7fcf05b459b0"),ve=t("--clientId <string>","The client ID of the application registered in Azure AD").env("FUSION_CLIENT_ID").default("a318b8e1-0295-4e17-98d5-35f67dfeba14"),be=t("--token <string>","The Azure AD access token. If provided, the --tenant and --client options are ignored").env("FUSION_TOKEN").default(void 0),$e=t("--scope <scopes...>","Azure audience scope, normally the application ID URI of the API you want to access and `.default`").env("FUSION_AUTH_SCOPE").default(["5a842df8-3238-415d-b168-9f16a6a6031b/.default"]),we=(e,t)=>(e.addOption(ye),e.addOption(ve),t?.excludeToken||e.addOption(be),t?.includeScope&&e.addOption($e),e.hook("preAction",e=>{const o=e.opts();if(o.token){if("string"!=typeof o.token||""===o.token.trim())throw new r("Token must be a non-empty string.");return e.setOptionValue("tenantId",void 0),e.setOptionValue("clientId",void 0),void(t?.includeScope&&e.setOptionValue("scope",void 0))}if(!o.tenantId||"string"!=typeof o.tenantId)throw new r("Tenant ID must be a non-empty string.");if(!ge.test(o.tenantId))throw new r("Tenant ID must be a valid UUID.");if(!o.clientId||"string"!=typeof o.clientId)throw new r("Client ID must be a non-empty string.");if(!ge.test(o.clientId))throw new r("Client ID must be a valid UUID.");if(t?.includeScope){if(!Array.isArray(o.scope)||0===o.scope.length)throw new r("Scope must be a non-empty array of strings.");for(const e of o.scope)if("string"!=typeof e||""===e.trim())throw new r("Each scope must be a non-empty string.")}}),e),_e=we(e("check").description("Check if application is registered in Fusion app store.").addHelpText("after",["","Verifies the registration status of your application in the Fusion app store.","Helps identify issues with app registration or configuration.","","FIRST TIME SETUP:"," Before checking app status, ensure your app is registered in the Fusion App Admin."," The check command will tell you if your app is properly registered.","","Examples:"," $ ffc app check"," $ ffc app check --env prod --debug"].join("\n")).option("-d, --debug","debug mode",!1).addOption(he({allowDev:!1})).action(e=>{const t=new c("app:check",{debug:!!e.debug});return f({log:t,environment:e.env,auth:"token"in e?{token:e.token}:e})})),ke=we(e("upload").description("Upload a Fusion application bundle to the Fusion App Store.").addHelpText("after",["","Uploads a distributable application bundle (e.g., app-bundle.zip) to the Fusion app store.","","Examples:"," $ ffc app upload"," $ ffc app upload my-app-bundle.zip --appKey my-app"," $ ffc app upload --debug"].join("\n")).option("-d, --debug [boolean]","Enable debug mode for verbose logging",!1).option("-k, --appKey <string>","Application key (if not provided, resolved from the build metadata of the bundle)").addOption(he({allowDev:!1})).argument("[bundle]","Application bundle to upload",fe).action(async(e,t)=>{const r=new c("portal:upload",{debug:t.debug});r?.start("💾 Initializing Fusion Framework...");const o=await m({env:t.env,auth:{token:t.token,tenantId:t.tenantId,clientId:t.clientId}});r?.succeed("💾 Initialized Fusion Framework"),await h({log:r,appKey:t.appKey,framework:o,fileOrBundle:e}).catch(e=>{r.error("😢 Failed to upload bundle:",e),process.exit(1)})})),Pe=we(e("config").description("Generate or publish the Fusion application configuration object.").addHelpText("after",["","By default, outputs the generated config object to stdout or a file. Use --publish to upload the config to the Fusion app registry.","- Options [--token, --tenantId, --clientId, --manifest] are only relevant when --publish is used.",'- Option [-e, --env] cannot be set to "dev" when --publish is used.',"","Note:","- If not `app.config(.$ENV)?.[ts|js|json]` is found it will fallback to generate a default config (empty object)","- If not `app.manifest(.$ENV)?.[ts|js|json]` is found it will fallback to generate a default manifest","","Examples:"," $ ffc app config app.config.ts"," $ ffc app config app.config.prod.ts --output ./dist/app.config.json"," $ ffc app config app.manifest.prod.ts --silent > ./dist/app.config.json"," $ ffc app config --publish --manifest app.manifest.ts --env prod"," $ ffc app config --env prod my-custom.config.ts"].join("\n")).option("--debug","Enable debug mode for verbose logging").option("--silent","Silent mode, suppresses output except errors").option("--publish","Publish config to Fusion app registry").option("--manifest <path>","Path to the app manifest file (required with --publish)").addOption(he({allowDev:!0})).option("-o, --output <stdout|path>","Output the result to stdout or a file (ignored with --publish, default: stdout)","stdout").argument("[config]","Config build file to use (e.g., app.config[.env]?.[ts,js,json])").action(async(e,t)=>{const r=t.silent?null:new c("app:config",{debug:!!t.debug});if(t.publish)return"dev"===t.env&&(r?.fail("🤪",ue.blue("--env"),'cannot be "dev" when',ue.blue("--publish")," is used"),process.exit(1)),g({config:t.config,manifest:t.manifest,environment:t.env,auth:"token"in t?{token:t.token}:t,debug:t.debug});const{config:o}=await y({log:r,config:e,env:{environment:t.env},output:"stdout"===t.output?void 0:t.output});"stdout"===t.output&&console.log(JSON.stringify(o,null,2))}));const Ee=we(e("tag").description("Tag your uploaded Fusion Application build version with a specific tag.").addHelpText("after",["","Note: using --package is preferred over --manifest, since no infered compilation is required.","","Examples:"," $ ffc app tag latest"," $ ffc app tag preview --env prod --manifest app.manifest.prod.ts"," $ ffc app tag stable --package my-app@1.2.3"," $ ffc app tag latest --manifest app.manifest.custom.ts"].join("\n")).addOption(he({allowDev:!1})).option("-p, --package [package@version]","Package to tag in format name@version (e.g., my-app@1.0.0)").option("-m, --manifest <string>","Manifest file to use. Note: ignoring if --package is provided").option("--debug","Enable debug mode for verbose logging").option("--silent","Silent mode, suppresses output except errors").argument("<tag>",`Tag to apply (${Object.values(v).join(" | ")})`).action(async(e,t)=>{const r=t.silent?null:new c("app:tag",{debug:t.debug}),o={command:"build",environment:t.env,mode:process.env.NODE_ENV??"production",root:process.cwd()};let n,a;try{({appKey:n,version:a}=await async function(e,t){if(e.package){const[t,r]=e.package.split("@");if(!t||!r)throw new Error("Package must be in format name@version (e.g., my-app@1.0.0). Please verify the package name and version with --package");return{appKey:t,version:r}}const{manifest:r}=await $({manifest:e.manifest,env:t}),o=r.build?.version;if(!o)throw new Error(`Could not determine version from manifest. Please verify manifest ${e.manifest} or provide a package name and version with --package`);return{appKey:r.appKey,version:o}}(t,o))}catch(e){r?.error(`😢 ${e instanceof Error?e.message:"Unknown error occurred"}`),process.exit(1)}r?.info("Tagging application:",ue.greenBright(`${n}@${a} - ${e}`)),r?.start("Initializing Fusion Framework...");const s=await m({env:t.env,auth:{token:t.token,tenantId:t.tenantId,clientId:t.clientId}});r?.succeed("Initialized Fusion Framework"),r?.start("Tagging application..."),await b({appKey:n,version:a,framework:s,log:r,tag:e}).catch(e=>{r?.error("Failed to tag application:",e),process.exit(1)})})),Se=e("dev").description("Start the application in development mode.").addHelpText("after",["","Examples:"," $ ffc app dev"," $ ffc app dev --port 4000"," $ ffc app dev --manifest ./app.manifest.local.ts --config ./app.config.ts"].join("\n")).option("--debug","Enable debug mode").option("--manifest <path>","Path to the app manifest file (app.manifest[.env]?.[ts,js,json])").option("--config <path>","Path to the app config file (app.config[.env]?.[ts,js,json])").option("--env <environment>","Runtime environment for the dev server","local").option("--port <port>","Port for the development server","3000").action(async e=>{const t=new c("app:dev",{debug:e.debug});t.start("Starting application in development mode..."),w({log:t,manifest:e.manifest,config:e.config,env:e.env,port:e.port}),t.succeed("Development server started successfully.")}),je=(e,t)=>{try{return C(e,R.F_OK),!0}catch(e){return!1}},Ne=e("manifest").description("Build and output the application manifest for Fusion apps.").addHelpText("after",["","By default, outputs the generated manifest object to stdout or a file. Use --output to write to a file.","","Note:","- If not `app.manifest(.$ENV)?.[ts|js|json]` is found it will fallback to generate a default manifest","","Examples:"," $ ffc app manifest"," $ ffc app manifest app.manifest.prod.ts --output ./dist/app.manifest.json",' $ ffc app manifest --silent | jq ".build.entryPoint"'," $ ffc app manifest --debug"].join("\n")).option("-d, --debug","Enable debug mode for verbose logging",!1).option("-o, --output <string>","Output the result to stdout or a file","stdout").option("-s, --silent","Silent mode, suppresses output except errors").argument("[manifest]","Manifest build file to use (e.g., app.manifest[.env]?.[ts,js,json])").action(async(e,t)=>{const r=t.silent?null:new c("app:manifest",{debug:t.debug}),o=await $({log:r,manifest:e});if("stdout"!==t.output){const e=a(process.cwd(),t.output);r?.start("Writing manifest to file",t.output),je(s(e))||await T(s(e),{recursive:!0}),await x(e,JSON.stringify(o.manifest,null,2)),r?.succeed("Manifest written to file",e)}else console.log(JSON.stringify(o.manifest,null,2))}),Ie=we(e("publish").description("Deployment: Build, upload, and tag your Fusion application.").addHelpText("after",["","WHAT THIS COMMAND DOES:"," 1. Builds your application (if no bundle provided)"," 2. Uploads the bundle to Fusion app registry"," 3. Tags the uploaded version for deployment","","If no manifest is provided, a default app.manifest(.$ENV)?.[ts|js|json] is used from the current directory.","example: `ffc app publish --env prod` will search for `app.manifest.prod.ts` then fallback to `app.manifest.ts`","","NOTE: app manifest is not required, a default manifest will be generated if not provided","","FIRST TIME PUBLISHING:"," - Ensure your app is registered in Fusion App Admin"," - Use `ffc app check` first to verify registration status"," - Start with a test environment before production","","Examples:"," $ ffc app publish"," $ ffc app publish --env prod --manifest app.manifest.prod.ts"," $ ffc app publish --tag latest app.bundle.zip"].join("\n")).option("-d, --debug","Enable debug mode for verbose logging",!1).addOption(he({allowDev:!1})).option("-m, --manifest [string]","Manifest file to use for bundling (e.g., app.manifest.ts)").option("-t, --tag [string]",`Tag to apply to the published app (${Object.values(v).join(" | ")})`,v.Latest).argument("[bundle]","Path to the app bundle to upload").action(async(e,t)=>{const r=new c("app:publish",{debug:t.debug});let o;if(e)r.info(`📦 Using provided bundle: ${e}`),o=e;else try{r.start("📦 Bundle application...");o=(await l({log:r,manifest:t.manifest})).archive,r.succeed("📦 Bundle completed")}catch(e){r.error("😢 Failed to bundle application:",e),process.exit(1)}o||(r.error("😢 No bundle provided or created. Please specify a bundle file."),process.exit(1)),r?.start("💾 Initializing Fusion Framework...");const n=await m({env:t.env,auth:{token:t.token,tenantId:t.tenantId,clientId:t.clientId}});r?.succeed("💾 Initialized Fusion Framework"),r.start("🚀 Uploading application...");const a=await h({log:r,framework:n,fileOrBundle:o}).catch(e=>{r.error("😢 Failed to upload bundle:",e),process.exit(1)});r.succeed("🚀 Upload completed"),r.debug("Upload result:",a),r.start("🏷️ Tagging application...");const s=await b({tag:t.tag,appKey:a.name,version:a.version,log:r,framework:n}).catch(e=>{r.error("😢 Failed to tag application:",e),process.exit(1)});r.succeed("Tagging completed"),r.debug("Tagging result:",s)}));me.alias("build-pack").hook("preAction",e=>{"build-pack"===process.argv[3]&&(console.warn(ue.bgRedBright.bold('The command "build-pack" is deprecated. Please use "pack" instead.')),e.getOptionValue("archive")||e.setOptionValue("archive",fe))}),ke.alias("build-upload").hook("preAction",e=>{if("build-upload"===process.argv[3]){if(console.warn(ue.bgRedBright.bold('The command "build-upload" is deprecated. Please use "upload" instead.')),e.getOptionValue("service"))throw new Error("The --service option is deprecated. Please use --env instead.");const t=e.getOptionValue("bundle")??fe;process.argv[4]=t}}),Ne.alias("build-manifest").hook("preAction",()=>{"build-manifest"===process.argv[3]&&console.warn(ue.bgRedBright.bold('The command "build-manifest" is deprecated. Please use "manifest" instead.'))}),Ie.alias("build-publish").hook("preAction",e=>{if("build-publish"===process.argv[3]&&console.warn(ue.bgRedBright.bold('The command "build-publish" is deprecated. Please use "publish" instead.')),e.getOptionValue("service"))throw new Error("The --service option is deprecated. Please use --env instead.")});const Oe=e("app").description("Develop, build, configure, and deploy Fusion applications from your workspace root.").addHelpText("after",["",'The "app" command is your main entry point for managing Fusion applications in this workspace.',"","It provides access to subcommands for every stage of the application lifecycle, including development, building, packaging, configuration, deployment, and release management.","","All available subcommands are listed below automatically. For details and options for a specific subcommand, run:"," fusion app <subcommand> --help","","Typical usage:"," - Run and test your app locally with the dev subcommand"," - Build, bundle, and configure your app for deployment"," - Upload, publish, and tag releases to the Fusion App Store"," - Check registration and generate manifests as needed","","This command should be run from your app root directory."].join("\n")).addCommand(pe).addCommand(me).addCommand(_e).addCommand(ke).addCommand(Pe).addCommand(Ee).addCommand(Se).addCommand(Ne).addCommand(Ie),Te=e("login").description("Authenticate and log in to Fusion Framework using interactive browser-based authentication.").addHelpText("after",["","WHAT HAPPENS WHEN YOU RUN THIS COMMAND:"," 1. Opens a browser window for Azure AD authentication"," 2. Prompts you to sign in with your Fusion credentials"," 3. Securely caches your tokens for future CLI commands"," 4. You only need to log in once per session","","Note: Requires interactive environment (won't work in CI/CD pipelines)","","Examples:"," $ ffc auth login"," $ ffc auth login --tenant my-tenant --client my-client-id --scope api://my-app/.default"].join("\n")).action(async e=>{const t=new c("auth:login",{debug:e.debug}),r="string"==typeof e.scope?[e.scope]:e.scope;t.start("Initializing Fusion Framework...");const o=await m({auth:{tenantId:e.tenantId,clientId:e.clientId,interactive:!0,server:{port:49741}}});t.succeed("Initialized Fusion Framework");try{t.start("Logging in...");const e=await o.auth.login({scopes:r});t.info("username:",ue.green(e.account?.username)),t.info("tenant: ",ue.yellow(e.tenantId)),t.info("audience:",ue.yellow(e.account?.idTokenClaims?.aud));for(const r of e.scopes)t.info("scope: ",ue.dim(r));t.succeed("Successfully logged in",ue.greenBright(e.account?.name))}catch(r){throw t.fail("Failed to log in 🥺",JSON.stringify({tenant:e.tenant,client:e.clientId},void 0,2)),r}});we(Te,{includeScope:!0,excludeToken:!0});const xe=e("logout").description("Log out from Fusion Framework and clear your authentication session.").addHelpText("after",["","WHAT THIS COMMAND DOES:"," - Removes your cached authentication tokens from local storage"," - Clears the current session (does not revoke tokens server-side)"," - You will need to run `ffc auth login` again for future commands","","WHEN TO USE THIS COMMAND:"," - When switching between different user accounts"," - When troubleshooting authentication issues"," - When your cached tokens have expired and you want a fresh login","","Examples:"," $ ffc auth logout"," $ ffc auth logout --tenant my-tenant --client my-client-id"].join("\n")).action(async e=>{const t=new c("auth:logout",{debug:e.debug});t.start("Initializing Fusion Framework...");const r=await m({auth:{tenantId:e.tenantId,clientId:e.clientId}});t.succeed("Initialized Fusion Framework");try{t.start("Logging in..."),await r.auth.logout(),t.succeed("Successfully logged out")}catch(r){throw t.fail("Failed to log out 🥺",JSON.stringify({tenant:e.tenant,client:e.clientId},void 0,2)),r}});we(xe,{excludeToken:!0,includeScope:!1});class Ce extends Error{static Name="NoAccountsError";constructor(e,t){super(e,t),this.name=Ce.Name}}const Re=e("token").description("Acquire and print an access token for Fusion APIs using your current authentication context.").addHelpText("after",["","USAGE NOTES:"," - This command acquires an access token using your current interactive login session."," - It is intended for local development, manual testing, and debugging authentication issues.","","LIMITATIONS:"," - Requires an interactive user session (not suitable for CI/CD or headless environments)."," - Will only work if you have previously logged in using `ffc auth login`."," - Does NOT prompt for login; if no cached credentials are found, you must log in first."," - For automation or CI/CD, set the FUSION_TOKEN environment variable instead.","","BEST PRACTICES:"," - Use this command to quickly fetch a token for manual API calls or local scripts."," - Use the --silent flag to output only the token (useful for scripting or piping)."," - Specify --scope, --tenant, or --client for advanced scenarios.","","EXAMPLES:"," $ ffc auth token"," $ export MY_TOKEN=$(ffc auth token --silent)"," $ ffc auth token --scope api://my-app/.default"," $ ffc auth token --tenant my-tenant --client my-client-id --silent"].join("\n")).option("-d, --debug","Enable debug mode for verbose logging",!1).option("--silent","Only output the token (no extra logging)").action(async e=>{const t=e.silent?null:new c("auth:token",{debug:e.debug}),r="string"==typeof e.scope?[e.scope]:e.scope;t?.info("Using tenant",e.tenantId),t?.info("Using client",e.clientId),t?.info("Using scope",JSON.stringify(r)),t?.start("Initializing Fusion Framework...");const o=await m({auth:{tenantId:e.tenantId,clientId:e.clientId}});t?.succeed("Initialized Fusion Framework");try{t?.start("Getting access token...");const n=await o.auth.acquireAccessToken({scopes:r});t?.succeed("Successfully acquired access token"),e.silent?console.log(n):t?.info("Access token:",n)}catch(r){if(e.silent||!(r instanceof Ce))throw r;t?.fail("No accounts found, please login first")}});we(Re,{includeScope:!0});const Ae=new o("auth").description("Authenticate with Fusion Framework CLI").addHelpText("after",["","Authentication commands for Fusion Framework CLI.","","Use these commands to log in, log out, or acquire tokens for Fusion APIs.","","Examples:"," $ fusion-framework-cli auth login"," $ fusion-framework-cli auth logout"," $ fusion-framework-cli auth token --scope api://my-app/.default"].join("\n"));Ae.addCommand(Te,{isDefault:!0}),Ae.addCommand(xe),Ae.addCommand(Re);const Me=we(e("resolve").description("Resolve and display information about a service registered in Fusion service discovery.").addHelpText("after",["","This command looks up a service by name and prints its discovery details using the current authentication and environment.","","USEFUL FOR:"," - Finding service endpoints for API calls"," - Debugging service connectivity issues"," - Getting service metadata and configuration","","OUTPUT FORMATS:"," - Normal: Pretty-printed JSON with service details",' - Silent: Raw JSON only (useful for scripts: --silent | jq ".uri")',"","Examples:"," $ ffc disco resolve my-service",' $ ffc disco resolve my-service --silent | jq ".uri"'," $ ffc disco resolve my-service --env prod"," $ ffc disco resolve my-service --env test --tenantId my-tenant --clientId my-client-id"].join("\n")).addOption(he({allowDev:!1})).option("--silent","Silent mode, suppresses output except errors").argument("<service>","Name of the service to resolve in Fusion service discovery").action(async(e,t)=>{const r=t.silent?null:new c("disco:resolve");r?.start("Initializing Fusion Framework...");const o=await m({env:t.environment,auth:{token:t.token,tenantId:t.tenantId,clientId:t.clientId}});r?.succeed("Initialized Fusion Framework"),r?.start(`Resolving service ${e}...`);const n=await o.serviceDiscovery.resolveService(e);r?.succeed(`Resolved service ${e}`),r?.debug(n),t.silent&&console.log(JSON.stringify(n,null,2))})),De=e("disco").description("Service discovery operations");De.addCommand(Me);const Fe=e("dev").description("Start a local development server for the Fusion portal.").addHelpText("after",["","Examples:"," $ ffc portal dev"," $ ffc portal dev --port 4000"," $ ffc portal dev --debug"].join("\n")).option("--debug","Enable debug mode").option("--env <environment>","Runtime environment for the dev server","local").option("--port <port>","Port for the development server","3000").action(async e=>{const t=new c("portal:dev",{debug:e.debug});t.start("Starting portal in development mode..."),_({server:{port:Number(e.port)},log:t,env:e.env}),t.succeed("Development server started successfully.")}),Ve=e("manifest").description("Generate or validate a Fusion portal manifest file.").addHelpText("after",["","By default, outputs the generated manifest object to stdout or a file. Use --output to write to a file.","","Note:","- If not `portal.manifest(.$ENV)?.[ts|js|json]` is found it will fallback to generate a default manifest","","Examples:"," $ ffc portal manifest"," $ ffc portal manifest portal.manifest.prod.ts --output ./dist/portal.manifest.json",' $ ffc portal manifest --silent | jq ".build.entryPoint"'," $ ffc portal manifest --debug"].join("\n")).option("-d, --debug","Enable debug mode for verbose logging",!1).option("-o, --output <string>","Write manifest to the specified file","stdout").option("-s, --silent","Silent mode, suppresses output except errors").argument("[manifest]","Manifest build file to use (e.g., portal.manifest[.env]?.[ts,js,json])").action(async(e,t)=>{const r=t.silent?null:new c("portal:manifest",{debug:t.debug}),o=await k({log:r,manifest:e});if(t.output){const e=a(process.cwd(),t.output);r?.start("Writing manifest to file",t.output),je(s(e))||await T(s(e),{recursive:!0}),await x(e,JSON.stringify(o.manifest,null,2)),r?.succeed("Manifest written to file",e)}else console.log(JSON.stringify(o.manifest,null,2))});function ze(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Ue,qe={exports:{}},Ke={},Le={},Be={},He={},Ge={},Je={};function We(){return Ue||(Ue=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.regexpCode=e.getEsmExportName=e.getProperty=e.safeStringify=e.stringify=e.strConcat=e.addCodeArg=e.str=e._=e.nil=e._Code=e.Name=e.IDENTIFIER=e._CodeOrName=void 0;class t{}e._CodeOrName=t,e.IDENTIFIER=/^[a-z$_][a-z$_0-9]*$/i;class r extends t{constructor(t){if(super(),!e.IDENTIFIER.test(t))throw new Error("CodeGen: name must be a valid identifier");this.str=t}toString(){return this.str}emptyStr(){return!1}get names(){return{[this.str]:1}}}e.Name=r;class o extends t{constructor(e){super(),this._items="string"==typeof e?[e]:e}toString(){return this.str}emptyStr(){if(this._items.length>1)return!1;const e=this._items[0];return""===e||'""'===e}get str(){var e;return null!==(e=this._str)&&void 0!==e?e:this._str=this._items.reduce((e,t)=>`${e}${t}`,"")}get names(){var e;return null!==(e=this._names)&&void 0!==e?e:this._names=this._items.reduce((e,t)=>(t instanceof r&&(e[t.str]=(e[t.str]||0)+1),e),{})}}function n(e,...t){const r=[e[0]];let n=0;for(;n<t.length;)i(r,t[n]),r.push(e[++n]);return new o(r)}e._Code=o,e.nil=new o(""),e._=n;const a=new o("+");function s(e,...t){const r=[d(e[0])];let n=0;for(;n<t.length;)r.push(a),i(r,t[n]),r.push(a,d(e[++n]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===a){const r=c(e[t-1],e[t+1]);if(void 0!==r){e.splice(t-1,3,r);continue}e[t++]="+"}t++}}(r),new o(r)}function i(e,t){var n;t instanceof o?e.push(...t._items):t instanceof r?e.push(t):e.push("number"==typeof(n=t)||"boolean"==typeof n||null===n?n:d(Array.isArray(n)?n.join(","):n))}function c(e,t){if('""'===t)return e;if('""'===e)return t;if("string"==typeof e){if(t instanceof r||'"'!==e[e.length-1])return;return"string"!=typeof t?`${e.slice(0,-1)}${t}"`:'"'===t[0]?e.slice(0,-1)+t.slice(1):void 0}return"string"!=typeof t||'"'!==t[0]||e instanceof r?void 0:`"${e}${t.slice(1)}`}function d(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.str=s,e.addCodeArg=i,e.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:s`${e}${t}`},e.stringify=function(e){return new o(d(e))},e.safeStringify=d,e.getProperty=function(t){return"string"==typeof t&&e.IDENTIFIER.test(t)?new o(`.${t}`):n`[${t}]`},e.getEsmExportName=function(t){if("string"==typeof t&&e.IDENTIFIER.test(t))return new o(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)},e.regexpCode=function(e){return new o(e.toString())}}(Je)),Je}var Ye,Qe,Xe={};function Ze(){return Ye||(Ye=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=We();class r extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}var o;!function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"}(o||(e.UsedValueState=o={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class n{constructor({prefixes:e,parent:t}={}){this._names={},this._prefixes=e,this._parent=t}toName(e){return e instanceof t.Name?e:this.name(e)}name(e){return new t.Name(this._newName(e))}_newName(e){return`${e}${(this._names[e]||this._nameGroup(e)).index++}`}_nameGroup(e){var t,r;if((null===(r=null===(t=this._parent)||void 0===t?void 0:t._prefixes)||void 0===r?void 0:r.has(e))||this._prefixes&&!this._prefixes.has(e))throw new Error(`CodeGen: prefix "${e}" is not allowed in this scope`);return this._names[e]={prefix:e,index:0}}}e.Scope=n;class a extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:r,itemIndex:o}){this.value=e,this.scopePath=t._`.${new t.Name(r)}[${o}]`}}e.ValueScopeName=a;const s=t._`\n`;e.ValueScope=class extends n{constructor(e){super(e),this._values={},this._scope=e.scope,this.opts={...e,_n:e.lines?s:t.nil}}get(){return this._scope}name(e){return new a(e,this._newName(e))}value(e,t){var r;if(void 0===t.ref)throw new Error("CodeGen: ref must be passed in value");const o=this.toName(e),{prefix:n}=o,a=null!==(r=t.key)&&void 0!==r?r:t.ref;let s=this._values[n];if(s){const e=s.get(a);if(e)return e}else s=this._values[n]=new Map;s.set(a,o);const i=this._scope[n]||(this._scope[n]=[]),c=i.length;return i[c]=t.ref,o.setValue(t,{property:n,itemIndex:c}),o}getValue(e,t){const r=this._values[e];if(r)return r.get(t)}scopeRefs(e,r=this._values){return this._reduceValues(r,r=>{if(void 0===r.scopePath)throw new Error(`CodeGen: name "${r}" has no value`);return t._`${e}${r.scopePath}`})}scopeCode(e=this._values,t,r){return this._reduceValues(e,e=>{if(void 0===e.value)throw new Error(`CodeGen: name "${e}" has no value`);return e.value.code},t,r)}_reduceValues(n,a,s={},i){let c=t.nil;for(const d in n){const l=n[d];if(!l)continue;const u=s[d]=s[d]||new Map;l.forEach(n=>{if(u.has(n))return;u.set(n,o.Started);let s=a(n);if(s){const r=this.opts.es5?e.varKinds.var:e.varKinds.const;c=t._`${c}${r} ${n} = ${s};${this.opts._n}`}else{if(!(s=null==i?void 0:i(n)))throw new r(n);c=t._`${c}${s}${this.opts._n}`}u.set(n,o.Completed)})}return c}}}(Xe)),Xe}function et(){return Qe||(Qe=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.or=e.and=e.not=e.CodeGen=e.operators=e.varKinds=e.ValueScopeName=e.ValueScope=e.Scope=e.Name=e.regexpCode=e.stringify=e.getProperty=e.nil=e.strConcat=e.str=e._=void 0;const t=We(),r=Ze();var o=We();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return o._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return o.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return o.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return o.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return o.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return o.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return o.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return o.Name}});var n=Ze();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return n.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return n.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return n.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return n.varKinds}}),e.operators={GT:new t._Code(">"),GTE:new t._Code(">="),LT:new t._Code("<"),LTE:new t._Code("<="),EQ:new t._Code("==="),NEQ:new t._Code("!=="),NOT:new t._Code("!"),OR:new t._Code("||"),AND:new t._Code("&&"),ADD:new t._Code("+")};class a{optimizeNodes(){return this}optimizeNames(e,t){return this}}class s extends a{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){const o=e?r.varKinds.var:this.varKind,n=void 0===this.rhs?"":` = ${this.rhs}`;return`${o} ${this.name}${n};`+t}optimizeNames(e,t){if(e[this.name.str])return this.rhs&&(this.rhs=I(this.rhs,e,t)),this}get names(){return this.rhs instanceof t._CodeOrName?this.rhs.names:{}}}class i extends a{constructor(e,t,r){super(),this.lhs=e,this.rhs=t,this.sideEffects=r}render({_n:e}){return`${this.lhs} = ${this.rhs};`+e}optimizeNames(e,r){if(!(this.lhs instanceof t.Name)||e[this.lhs.str]||this.sideEffects)return this.rhs=I(this.rhs,e,r),this}get names(){return N(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}}class c extends i{constructor(e,t,r,o){super(e,r,o),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class d extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class l extends a{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class u extends a{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class p extends a{constructor(e){super(),this.code=e}render({_n:e}){return`${this.code};`+e}optimizeNodes(){return`${this.code}`?this:void 0}optimizeNames(e,t){return this.code=I(this.code,e,t),this}get names(){return this.code instanceof t._CodeOrName?this.code.names:{}}}class f extends a{constructor(e=[]){super(),this.nodes=e}render(e){return this.nodes.reduce((t,r)=>t+r.render(e),"")}optimizeNodes(){const{nodes:e}=this;let t=e.length;for(;t--;){const r=e[t].optimizeNodes();Array.isArray(r)?e.splice(t,1,...r):r?e[t]=r:e.splice(t,1)}return e.length>0?this:void 0}optimizeNames(e,t){const{nodes:r}=this;let o=r.length;for(;o--;){const n=r[o];n.optimizeNames(e,t)||(O(e,n.names),r.splice(o,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>j(e,t.names),{})}}class m extends f{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class h extends f{}class g extends m{}g.kind="else";class y extends m{constructor(e,t){super(t),this.condition=e}render(e){let t=`if(${this.condition})`+super.render(e);return this.else&&(t+="else "+this.else.render(e)),t}optimizeNodes(){super.optimizeNodes();const e=this.condition;if(!0===e)return this.nodes;let t=this.else;if(t){const e=t.optimizeNodes();t=this.else=Array.isArray(e)?new g(e):e}return t?!1===e?t instanceof y?t:t.nodes:this.nodes.length?this:new y(T(e),t instanceof y?[t]:t.nodes):!1!==e&&this.nodes.length?this:void 0}optimizeNames(e,t){var r;if(this.else=null===(r=this.else)||void 0===r?void 0:r.optimizeNames(e,t),super.optimizeNames(e,t)||this.else)return this.condition=I(this.condition,e,t),this}get names(){const e=super.names;return N(e,this.condition),this.else&&j(e,this.else.names),e}}y.kind="if";class v extends m{}v.kind="for";class b extends v{constructor(e){super(),this.iteration=e}render(e){return`for(${this.iteration})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iteration=I(this.iteration,e,t),this}get names(){return j(super.names,this.iteration.names)}}class $ extends v{constructor(e,t,r,o){super(),this.varKind=e,this.name=t,this.from=r,this.to=o}render(e){const t=e.es5?r.varKinds.var:this.varKind,{name:o,from:n,to:a}=this;return`for(${t} ${o}=${n}; ${o}<${a}; ${o}++)`+super.render(e)}get names(){const e=N(super.names,this.from);return N(e,this.to)}}class w extends v{constructor(e,t,r,o){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=o}render(e){return`for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})`+super.render(e)}optimizeNames(e,t){if(super.optimizeNames(e,t))return this.iterable=I(this.iterable,e,t),this}get names(){return j(super.names,this.iterable.names)}}class _ extends m{constructor(e,t,r){super(),this.name=e,this.args=t,this.async=r}render(e){return`${this.async?"async ":""}function ${this.name}(${this.args})`+super.render(e)}}_.kind="func";class k extends f{render(e){return"return "+super.render(e)}}k.kind="return";class P extends m{render(e){let t="try"+super.render(e);return this.catch&&(t+=this.catch.render(e)),this.finally&&(t+=this.finally.render(e)),t}optimizeNodes(){var e,t;return super.optimizeNodes(),null===(e=this.catch)||void 0===e||e.optimizeNodes(),null===(t=this.finally)||void 0===t||t.optimizeNodes(),this}optimizeNames(e,t){var r,o;return super.optimizeNames(e,t),null===(r=this.catch)||void 0===r||r.optimizeNames(e,t),null===(o=this.finally)||void 0===o||o.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&j(e,this.catch.names),this.finally&&j(e,this.finally.names),e}}class E extends m{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}E.kind="catch";class S extends m{render(e){return"finally"+super.render(e)}}S.kind="finally";function j(e,t){for(const r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function N(e,r){return r instanceof t._CodeOrName?j(e,r.names):e}function I(e,r,o){return e instanceof t.Name?a(e):(n=e)instanceof t._Code&&n._items.some(e=>e instanceof t.Name&&1===r[e.str]&&void 0!==o[e.str])?new t._Code(e._items.reduce((e,r)=>(r instanceof t.Name&&(r=a(r)),r instanceof t._Code?e.push(...r._items):e.push(r),e),[])):e;var n;function a(e){const t=o[e.str];return void 0===t||1!==r[e.str]?e:(delete r[e.str],t)}}function O(e,t){for(const r in t)e[r]=(e[r]||0)-(t[r]||0)}function T(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:t._`!${A(e)}`}e.CodeGen=class{constructor(e,t={}){this._values={},this._blockStarts=[],this._constants={},this.opts={...t,_n:t.lines?"\n":""},this._extScope=e,this._scope=new r.Scope({parent:e}),this._nodes=[new h]}toString(){return this._root.render(this.opts)}name(e){return this._scope.name(e)}scopeName(e){return this._extScope.name(e)}scopeValue(e,t){const r=this._extScope.value(e,t);return(this._values[r.prefix]||(this._values[r.prefix]=new Set)).add(r),r}getScopeValue(e,t){return this._extScope.getValue(e,t)}scopeRefs(e){return this._extScope.scopeRefs(e,this._values)}scopeCode(){return this._extScope.scopeCode(this._values)}_def(e,t,r,o){const n=this._scope.toName(t);return void 0!==r&&o&&(this._constants[n.str]=r),this._leafNode(new s(e,n,r)),n}const(e,t,o){return this._def(r.varKinds.const,e,t,o)}let(e,t,o){return this._def(r.varKinds.let,e,t,o)}var(e,t,o){return this._def(r.varKinds.var,e,t,o)}assign(e,t,r){return this._leafNode(new i(e,t,r))}add(t,r){return this._leafNode(new c(t,e.operators.ADD,r))}code(e){return"function"==typeof e?e():e!==t.nil&&this._leafNode(new p(e)),this}object(...e){const r=["{"];for(const[o,n]of e)r.length>1&&r.push(","),r.push(o),(o!==n||this.opts.es5)&&(r.push(":"),(0,t.addCodeArg)(r,n));return r.push("}"),new t._Code(r)}if(e,t,r){if(this._blockNode(new y(e)),t&&r)this.code(t).else().code(r).endIf();else if(t)this.code(t).endIf();else if(r)throw new Error('CodeGen: "else" body without "then" body');return this}elseIf(e){return this._elseNode(new y(e))}else(){return this._elseNode(new g)}endIf(){return this._endBlockNode(y,g)}_for(e,t){return this._blockNode(e),t&&this.code(t).endFor(),this}for(e,t){return this._for(new b(e),t)}forRange(e,t,o,n,a=(this.opts.es5?r.varKinds.var:r.varKinds.let)){const s=this._scope.toName(e);return this._for(new $(a,s,t,o),()=>n(s))}forOf(e,o,n,a=r.varKinds.const){const s=this._scope.toName(e);if(this.opts.es5){const e=o instanceof t.Name?o:this.var("_arr",o);return this.forRange("_i",0,t._`${e}.length`,r=>{this.var(s,t._`${e}[${r}]`),n(s)})}return this._for(new w("of",a,s,o),()=>n(s))}forIn(e,o,n,a=(this.opts.es5?r.varKinds.var:r.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,t._`Object.keys(${o})`,n);const s=this._scope.toName(e);return this._for(new w("in",a,s,o),()=>n(s))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new d(e))}break(e){return this._leafNode(new l(e))}return(e){const t=new k;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(k)}try(e,t,r){if(!t&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const o=new P;if(this._blockNode(o),this.code(e),t){const e=this.name("e");this._currNode=o.catch=new E(e),t(e)}return r&&(this._currNode=o.finally=new S,this.code(r)),this._endBlockNode(E,S)}throw(e){return this._leafNode(new u(e))}block(e,t){return this._blockStarts.push(this._nodes.length),e&&this.code(e).endBlock(t),this}endBlock(e){const t=this._blockStarts.pop();if(void 0===t)throw new Error("CodeGen: not in self-balancing block");const r=this._nodes.length-t;if(r<0||void 0!==e&&r!==e)throw new Error(`CodeGen: wrong number of nodes: ${r} vs ${e} expected`);return this._nodes.length=t,this}func(e,r=t.nil,o,n){return this._blockNode(new _(e,r,o)),n&&this.code(n).endFunc(),this}endFunc(){return this._endBlockNode(_)}optimize(e=1){for(;e-- >0;)this._root.optimizeNodes(),this._root.optimizeNames(this._root.names,this._constants)}_leafNode(e){return this._currNode.nodes.push(e),this}_blockNode(e){this._currNode.nodes.push(e),this._nodes.push(e)}_endBlockNode(e,t){const r=this._currNode;if(r instanceof e||t&&r instanceof t)return this._nodes.pop(),this;throw new Error(`CodeGen: not in block "${t?`${e.kind}/${t.kind}`:e.kind}"`)}_elseNode(e){const t=this._currNode;if(!(t instanceof y))throw new Error('CodeGen: "else" without "if"');return this._currNode=t.else=e,this}get _root(){return this._nodes[0]}get _currNode(){const e=this._nodes;return e[e.length-1]}set _currNode(e){const t=this._nodes;t[t.length-1]=e}},e.not=T;const x=R(e.operators.AND);e.and=function(...e){return e.reduce(x)};const C=R(e.operators.OR);function R(e){return(r,o)=>r===t.nil?o:o===t.nil?r:t._`${A(r)} ${e} ${A(o)}`}function A(e){return e instanceof t.Name?e:t._`(${e})`}e.or=function(...e){return e.reduce(C)}}(Ge)),Ge}var tt,rt={};function ot(){if(tt)return rt;tt=1,Object.defineProperty(rt,"__esModule",{value:!0}),rt.checkStrictMode=rt.getErrorPath=rt.Type=rt.useFunc=rt.setEvaluated=rt.evaluatedPropsToName=rt.mergeEvaluated=rt.eachItem=rt.unescapeJsonPointer=rt.escapeJsonPointer=rt.escapeFragment=rt.unescapeFragment=rt.schemaRefOrVal=rt.schemaHasRulesButRef=rt.schemaHasRules=rt.checkUnknownRules=rt.alwaysValidSchema=rt.toHash=void 0;const e=et(),t=We();function r(e,t=e.schema){const{opts:r,self:o}=e;if(!r.strictSchema)return;if("boolean"==typeof t)return;const n=o.RULES.keywords;for(const r in t)n[r]||u(e,`unknown keyword: "${r}"`)}function o(e,t){if("boolean"==typeof e)return!e;for(const r in e)if(t[r])return!0;return!1}function n(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function a(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function s({mergeNames:t,mergeToName:r,mergeValues:o,resultToName:n}){return(a,s,i,c)=>{const d=void 0===i?s:i instanceof e.Name?(s instanceof e.Name?t(a,s,i):r(a,s,i),i):s instanceof e.Name?(r(a,i,s),s):o(s,i);return c!==e.Name||d instanceof e.Name?d:n(a,d)}}function i(t,r){if(!0===r)return t.var("props",!0);const o=t.var("props",e._`{}`);return void 0!==r&&c(t,o,r),o}function c(t,r,o){Object.keys(o).forEach(o=>t.assign(e._`${r}${(0,e.getProperty)(o)}`,!0))}rt.toHash=function(e){const t={};for(const r of e)t[r]=!0;return t},rt.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(r(e,t),!o(t,e.self.RULES.all))},rt.checkUnknownRules=r,rt.schemaHasRules=o,rt.schemaHasRulesButRef=function(e,t){if("boolean"==typeof e)return!e;for(const r in e)if("$ref"!==r&&t.all[r])return!0;return!1},rt.schemaRefOrVal=function({topSchemaRef:t,schemaPath:r},o,n,a){if(!a){if("number"==typeof o||"boolean"==typeof o)return o;if("string"==typeof o)return e._`${o}`}return e._`${t}${r}${(0,e.getProperty)(n)}`},rt.unescapeFragment=function(e){return a(decodeURIComponent(e))},rt.escapeFragment=function(e){return encodeURIComponent(n(e))},rt.escapeJsonPointer=n,rt.unescapeJsonPointer=a,rt.eachItem=function(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)},rt.mergeEvaluated={props:s({mergeNames:(t,r,o)=>t.if(e._`${o} !== true && ${r} !== undefined`,()=>{t.if(e._`${r} === true`,()=>t.assign(o,!0),()=>t.assign(o,e._`${o} || {}`).code(e._`Object.assign(${o}, ${r})`))}),mergeToName:(t,r,o)=>t.if(e._`${o} !== true`,()=>{!0===r?t.assign(o,!0):(t.assign(o,e._`${o} || {}`),c(t,o,r))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:i}),items:s({mergeNames:(t,r,o)=>t.if(e._`${o} !== true && ${r} !== undefined`,()=>t.assign(o,e._`${r} === true ? true : ${o} > ${r} ? ${o} : ${r}`)),mergeToName:(t,r,o)=>t.if(e._`${o} !== true`,()=>t.assign(o,!0===r||e._`${o} > ${r} ? ${o} : ${r}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},rt.evaluatedPropsToName=i,rt.setEvaluated=c;const d={};var l;function u(e,t,r=e.opts.strictSchema){if(r){if(t=`strict mode: ${t}`,!0===r)throw new Error(t);e.self.logger.warn(t)}}return rt.useFunc=function(e,r){return e.scopeValue("func",{ref:r,code:d[r.code]||(d[r.code]=new t._Code(r.code))})},function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(l||(rt.Type=l={})),rt.getErrorPath=function(t,r,o){if(t instanceof e.Name){const n=r===l.Num;return o?n?e._`"[" + ${t} + "]"`:e._`"['" + ${t} + "']"`:n?e._`"/" + ${t}`:e._`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return o?(0,e.getProperty)(t).toString():"/"+n(t)},rt.checkStrictMode=u,rt}var nt,at,st,it={};function ct(){if(nt)return it;nt=1,Object.defineProperty(it,"__esModule",{value:!0});const e=et(),t={data:new e.Name("data"),valCxt:new e.Name("valCxt"),instancePath:new e.Name("instancePath"),parentData:new e.Name("parentData"),parentDataProperty:new e.Name("parentDataProperty"),rootData:new e.Name("rootData"),dynamicAnchors:new e.Name("dynamicAnchors"),vErrors:new e.Name("vErrors"),errors:new e.Name("errors"),this:new e.Name("this"),self:new e.Name("self"),scope:new e.Name("scope"),json:new e.Name("json"),jsonPos:new e.Name("jsonPos"),jsonLen:new e.Name("jsonLen"),jsonPart:new e.Name("jsonPart")};return it.default=t,it}function dt(){return at||(at=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.extendErrors=e.resetErrorsCount=e.reportExtraError=e.reportError=e.keyword$DataError=e.keywordError=void 0;const t=et(),r=ot(),o=ct();function n(e,r){const n=e.const("err",r);e.if(t._`${o.default.vErrors} === null`,()=>e.assign(o.default.vErrors,t._`[${n}]`),t._`${o.default.vErrors}.push(${n})`),e.code(t._`${o.default.errors}++`)}function a(e,r){const{gen:o,validateName:n,schemaEnv:a}=e;a.$async?o.throw(t._`new ${e.ValidationError}(${r})`):(o.assign(t._`${n}.errors`,r),o.return(!1))}e.keywordError={message:({keyword:e})=>t.str`must pass "${e}" keyword validation`},e.keyword$DataError={message:({keyword:e,schemaType:r})=>r?t.str`"${e}" keyword must be ${r} ($data)`:t.str`"${e}" keyword is invalid ($data)`},e.reportError=function(r,o=e.keywordError,s,c){const{it:d}=r,{gen:l,compositeRule:u,allErrors:p}=d,f=i(r,o,s);(null!=c?c:u||p)?n(l,f):a(d,t._`[${f}]`)},e.reportExtraError=function(t,r=e.keywordError,s){const{it:c}=t,{gen:d,compositeRule:l,allErrors:u}=c;n(d,i(t,r,s)),l||u||a(c,o.default.vErrors)},e.resetErrorsCount=function(e,r){e.assign(o.default.errors,r),e.if(t._`${o.default.vErrors} !== null`,()=>e.if(r,()=>e.assign(t._`${o.default.vErrors}.length`,r),()=>e.assign(o.default.vErrors,null)))},e.extendErrors=function({gen:e,keyword:r,schemaValue:n,data:a,errsCount:s,it:i}){if(void 0===s)throw new Error("ajv implementation error");const c=e.name("err");e.forRange("i",s,o.default.errors,s=>{e.const(c,t._`${o.default.vErrors}[${s}]`),e.if(t._`${c}.instancePath === undefined`,()=>e.assign(t._`${c}.instancePath`,(0,t.strConcat)(o.default.instancePath,i.errorPath))),e.assign(t._`${c}.schemaPath`,t.str`${i.errSchemaPath}/${r}`),i.opts.verbose&&(e.assign(t._`${c}.schema`,n),e.assign(t._`${c}.data`,a))})};const s={keyword:new t.Name("keyword"),schemaPath:new t.Name("schemaPath"),params:new t.Name("params"),propertyName:new t.Name("propertyName"),message:new t.Name("message"),schema:new t.Name("schema"),parentSchema:new t.Name("parentSchema")};function i(e,r,n){const{createErrors:a}=e.it;return!1===a?t._`{}`:function(e,r,n={}){const{gen:a,it:i}=e,l=[c(i,n),d(e,n)];return function(e,{params:r,message:n},a){const{keyword:i,data:c,schemaValue:d,it:l}=e,{opts:u,propertyName:p,topSchemaRef:f,schemaPath:m}=l;a.push([s.keyword,i],[s.params,"function"==typeof r?r(e):r||t._`{}`]),u.messages&&a.push([s.message,"function"==typeof n?n(e):n]);u.verbose&&a.push([s.schema,d],[s.parentSchema,t._`${f}${m}`],[o.default.data,c]);p&&a.push([s.propertyName,p])}(e,r,l),a.object(...l)}(e,r,n)}function c({errorPath:e},{instancePath:n}){const a=n?t.str`${e}${(0,r.getErrorPath)(n,r.Type.Str)}`:e;return[o.default.instancePath,(0,t.strConcat)(o.default.instancePath,a)]}function d({keyword:e,it:{errSchemaPath:o}},{schemaPath:n,parentSchema:a}){let i=a?o:t.str`${o}/${e}`;return n&&(i=t.str`${i}${(0,r.getErrorPath)(n,r.Type.Str)}`),[s.schemaPath,i]}}(He)),He}var lt,ut={},pt={};function ft(){if(lt)return pt;lt=1,Object.defineProperty(pt,"__esModule",{value:!0}),pt.getRules=pt.isJSONType=void 0;const e=new Set(["string","number","integer","boolean","null","object","array"]);return pt.isJSONType=function(t){return"string"==typeof t&&e.has(t)},pt.getRules=function(){const e={number:{type:"number",rules:[]},string:{type:"string",rules:[]},array:{type:"array",rules:[]},object:{type:"object",rules:[]}};return{types:{...e,integer:!0,boolean:!0,null:!0},rules:[{rules:[]},e.number,e.string,e.array,e.object],post:{rules:[]},all:{},keywords:{}}},pt}var mt,ht,gt={};function yt(){if(mt)return gt;function e(e,r){return r.rules.some(r=>t(e,r))}function t(e,t){var r;return void 0!==e[t.keyword]||(null===(r=t.definition.implements)||void 0===r?void 0:r.some(t=>void 0!==e[t]))}return mt=1,Object.defineProperty(gt,"__esModule",{value:!0}),gt.shouldUseRule=gt.shouldUseGroup=gt.schemaHasRulesForType=void 0,gt.schemaHasRulesForType=function({schema:t,self:r},o){const n=r.RULES.types[o];return n&&!0!==n&&e(t,n)},gt.shouldUseGroup=e,gt.shouldUseRule=t,gt}function vt(){if(ht)return ut;ht=1,Object.defineProperty(ut,"__esModule",{value:!0}),ut.reportTypeError=ut.checkDataTypes=ut.checkDataType=ut.coerceAndCheckDataType=ut.getJSONTypes=ut.getSchemaTypes=ut.DataType=void 0;const e=ft(),t=yt(),r=dt(),o=et(),n=ot();var a;function s(t){const r=Array.isArray(t)?t:t?[t]:[];if(r.every(e.isJSONType))return r;throw new Error("type must be JSONType or JSONType[]: "+r.join(","))}!function(e){e[e.Correct=0]="Correct",e[e.Wrong=1]="Wrong"}(a||(ut.DataType=a={})),ut.getSchemaTypes=function(e){const t=s(e.type);if(t.includes("null")){if(!1===e.nullable)throw new Error("type: null contradicts nullable: false")}else{if(!t.length&&void 0!==e.nullable)throw new Error('"nullable" cannot be used without "type"');!0===e.nullable&&t.push("null")}return t},ut.getJSONTypes=s,ut.coerceAndCheckDataType=function(e,r){const{gen:n,data:s,opts:c}=e,l=function(e,t){return t?e.filter(e=>i.has(e)||"array"===t&&"array"===e):[]}(r,c.coerceTypes),p=r.length>0&&!(0===l.length&&1===r.length&&(0,t.schemaHasRulesForType)(e,r[0]));if(p){const t=d(r,s,c.strictNumbers,a.Wrong);n.if(t,()=>{l.length?function(e,t,r){const{gen:n,data:a,opts:s}=e,c=n.let("dataType",o._`typeof ${a}`),l=n.let("coerced",o._`undefined`);"array"===s.coerceTypes&&n.if(o._`${c} == 'object' && Array.isArray(${a}) && ${a}.length == 1`,()=>n.assign(a,o._`${a}[0]`).assign(c,o._`typeof ${a}`).if(d(t,a,s.strictNumbers),()=>n.assign(l,a)));n.if(o._`${l} !== undefined`);for(const e of r)(i.has(e)||"array"===e&&"array"===s.coerceTypes)&&p(e);function p(e){switch(e){case"string":return void n.elseIf(o._`${c} == "number" || ${c} == "boolean"`).assign(l,o._`"" + ${a}`).elseIf(o._`${a} === null`).assign(l,o._`""`);case"number":return void n.elseIf(o._`${c} == "boolean" || ${a} === null
2
2
  || (${c} == "string" && ${a} && ${a} == +${a})`).assign(l,o._`+${a}`);case"integer":return void n.elseIf(o._`${c} === "boolean" || ${a} === null
3
3
  || (${c} === "string" && ${a} && ${a} == +${a} && !(${a} % 1))`).assign(l,o._`+${a}`);case"boolean":return void n.elseIf(o._`${a} === "false" || ${a} === 0 || ${a} === null`).assign(l,!1).elseIf(o._`${a} === "true" || ${a} === 1`).assign(l,!0);case"null":return n.elseIf(o._`${a} === "" || ${a} === 0 || ${a} === false`),void n.assign(l,null);case"array":n.elseIf(o._`${c} === "string" || ${c} === "number"
4
- || ${c} === "boolean" || ${a} === null`).assign(l,o._`[${a}]`)}}n.else(),u(e),n.endIf(),n.if(o._`${l} !== undefined`,()=>{n.assign(a,l),function({gen:e,parentData:t,parentDataProperty:r},n){e.if(o._`${t} !== undefined`,()=>e.assign(o._`${t}[${r}]`,n))}(e,l)})}(e,r,l):u(e)})}return p};const i=new Set(["string","number","integer","boolean","null"]);function c(e,t,r,n=a.Correct){const s=n===a.Correct?o.operators.EQ:o.operators.NEQ;let i;switch(e){case"null":return o._`${t} ${s} null`;case"array":i=o._`Array.isArray(${t})`;break;case"object":i=o._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=c(o._`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=c();break;default:return o._`typeof ${t} ${s} ${e}`}return n===a.Correct?i:(0,o.not)(i);function c(e=o.nil){return(0,o.and)(o._`typeof ${t} == "number"`,e,r?o._`isFinite(${t})`:o.nil)}}function d(e,t,r,a){if(1===e.length)return c(e[0],t,r,a);let s;const i=(0,n.toHash)(e);if(i.array&&i.object){const e=o._`typeof ${t} != "object"`;s=i.null?e:o._`!${t} || ${e}`,delete i.null,delete i.array,delete i.object}else s=o.nil;i.number&&delete i.integer;for(const e in i)s=(0,o.and)(s,c(e,t,r,a));return s}pt.checkDataType=c,pt.checkDataTypes=d;const l={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?o._`{type: ${e}}`:o._`{type: ${t}}`};function u(e){const t=function(e){const{gen:t,data:r,schema:o}=e,a=(0,n.schemaRefOrVal)(e,o,"type");return{gen:t,keyword:"type",data:r,schema:o.type,schemaCode:a,schemaValue:a,parentSchema:o,params:{},it:e}}(e);(0,r.reportError)(t,l)}return pt.reportTypeError=u,pt}var $t,wt={};var _t,kt,Pt={},St={};function Et(){if(_t)return St;_t=1,Object.defineProperty(St,"__esModule",{value:!0}),St.validateUnion=St.validateArray=St.usePattern=St.callValidateCode=St.schemaProperties=St.allSchemaProperties=St.noPropertyInData=St.propertyInData=St.isOwnProperty=St.hasPropFunc=St.reportMissingProp=St.checkMissingProp=St.checkReportMissingProp=void 0;const e=tt(),t=nt(),r=dt(),o=nt();function n(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:e._`Object.prototype.hasOwnProperty`})}function a(t,r,o){return e._`${n(t)}.call(${r}, ${o})`}function s(t,r,o,n){const s=e._`${r}${(0,e.getProperty)(o)} === undefined`;return n?(0,e.or)(s,(0,e.not)(a(t,r,o))):s}function i(e){return e?Object.keys(e).filter(e=>"__proto__"!==e):[]}St.checkReportMissingProp=function(t,r){const{gen:o,data:n,it:a}=t;o.if(s(o,n,r,a.opts.ownProperties),()=>{t.setParams({missingProperty:e._`${r}`},!0),t.error()})},St.checkMissingProp=function({gen:t,data:r,it:{opts:o}},n,a){return(0,e.or)(...n.map(n=>(0,e.and)(s(t,r,n,o.ownProperties),e._`${a} = ${n}`)))},St.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},St.hasPropFunc=n,St.isOwnProperty=a,St.propertyInData=function(t,r,o,n){const s=e._`${r}${(0,e.getProperty)(o)} !== undefined`;return n?e._`${s} && ${a(t,r,o)}`:s},St.noPropertyInData=s,St.allSchemaProperties=i,St.schemaProperties=function(e,r){return i(r).filter(o=>!(0,t.alwaysValidSchema)(e,r[o]))},St.callValidateCode=function({schemaCode:t,data:o,it:{gen:n,topSchemaRef:a,schemaPath:s,errorPath:i},it:c},d,l,u){const p=u?e._`${t}, ${o}, ${a}${s}`:o,f=[[r.default.instancePath,(0,e.strConcat)(r.default.instancePath,i)],[r.default.parentData,c.parentData],[r.default.parentDataProperty,c.parentDataProperty],[r.default.rootData,r.default.rootData]];c.opts.dynamicRef&&f.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);const m=e._`${p}, ${n.object(...f)}`;return l!==e.nil?e._`${d}.call(${l}, ${m})`:e._`${d}(${m})`};const c=e._`new RegExp`;return St.usePattern=function({gen:t,it:{opts:r}},n){const a=r.unicodeRegExp?"u":"",{regExp:s}=r.code,i=s(n,a);return t.scopeValue("pattern",{key:i.toString(),ref:i,code:e._`${"new RegExp"===s.code?c:(0,o.useFunc)(t,s)}(${n}, ${a})`})},St.validateArray=function(r){const{gen:o,data:n,keyword:a,it:s}=r,i=o.name("valid");if(s.allErrors){const e=o.let("valid",!0);return c(()=>o.assign(e,!1)),e}return o.var(i,!0),c(()=>o.break()),i;function c(s){const c=o.const("len",e._`${n}.length`);o.forRange("i",0,c,n=>{r.subschema({keyword:a,dataProp:n,dataPropType:t.Type.Num},i),o.if((0,e.not)(i),s)})}},St.validateUnion=function(r){const{gen:o,schema:n,keyword:a,it:s}=r;if(!Array.isArray(n))throw new Error("ajv implementation error");if(n.some(e=>(0,t.alwaysValidSchema)(s,e))&&!s.opts.unevaluated)return;const i=o.let("valid",!1),c=o.name("_valid");o.block(()=>n.forEach((t,n)=>{const s=r.subschema({keyword:a,schemaProp:n,compositeRule:!0},c);o.assign(i,e._`${i} || ${c}`);r.mergeValidEvaluated(s,c)||o.if((0,e.not)(i))})),r.result(i,()=>r.reset(),()=>r.error(!0))},St}function jt(){if(kt)return Pt;kt=1,Object.defineProperty(Pt,"__esModule",{value:!0}),Pt.validateKeywordUsage=Pt.validSchemaType=Pt.funcKeywordCode=Pt.macroKeywordCode=void 0;const e=tt(),t=dt(),r=Et(),o=lt();function n(t){const{gen:r,data:o,it:n}=t;r.if(n.parentData,()=>r.assign(o,e._`${n.parentData}[${n.parentDataProperty}]`))}function a(t,r,o){if(void 0===o)throw new Error(`keyword "${r}" failed to compile`);return t.scopeValue("keyword","function"==typeof o?{ref:o}:{ref:o,code:(0,e.stringify)(o)})}return Pt.macroKeywordCode=function(t,r){const{gen:o,keyword:n,schema:s,parentSchema:i,it:c}=t,d=r.macro.call(c.self,s,i,c),l=a(o,n,d);!1!==c.opts.validateSchema&&c.self.validateSchema(d,!0);const u=o.name("valid");t.subschema({schema:d,schemaPath:e.nil,errSchemaPath:`${c.errSchemaPath}/${n}`,topSchemaRef:l,compositeRule:!0},u),t.pass(u,()=>t.error(!0))},Pt.funcKeywordCode=function(s,i){var c;const{gen:d,keyword:l,schema:u,parentSchema:p,$data:f,it:m}=s;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(m,i);const h=!f&&i.compile?i.compile.call(m.self,u,p,m):i.validate,g=a(d,l,h),v=d.let("valid");function y(o=(i.async?e._`await `:e.nil)){const n=m.opts.passContext?t.default.this:t.default.self,a=!("compile"in i&&!f||!1===i.schema);d.assign(v,e._`${o}${(0,r.callValidateCode)(s,g,n,a)}`,i.modifying)}function b(t){var r;d.if((0,e.not)(null!==(r=i.valid)&&void 0!==r?r:v),t)}s.block$data(v,function(){if(!1===i.errors)y(),i.modifying&&n(s),b(()=>s.error());else{const r=i.async?function(){const t=d.let("ruleErrs",null);return d.try(()=>y(e._`await `),r=>d.assign(v,!1).if(e._`${r} instanceof ${m.ValidationError}`,()=>d.assign(t,e._`${r}.errors`),()=>d.throw(r))),t}():function(){const t=e._`${g}.errors`;return d.assign(t,null),y(e.nil),t}();i.modifying&&n(s),b(()=>function(r,n){const{gen:a}=r;a.if(e._`Array.isArray(${n})`,()=>{a.assign(t.default.vErrors,e._`${t.default.vErrors} === null ? ${n} : ${t.default.vErrors}.concat(${n})`).assign(t.default.errors,e._`${t.default.vErrors}.length`),(0,o.extendErrors)(r)},()=>r.error())}(s,r))}}),s.ok(null!==(c=i.valid)&&void 0!==c?c:v)},Pt.validSchemaType=function(e,t,r=!1){return!t.length||t.some(t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&void 0===e)},Pt.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:o},n,a){if(Array.isArray(n.keyword)?!n.keyword.includes(a):n.keyword!==a)throw new Error("ajv implementation error");const s=n.dependencies;if(null==s?void 0:s.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw new Error(`parent schema must have dependencies of ${a}: ${s.join(",")}`);if(n.validateSchema){if(!n.validateSchema(e[a])){const e=`keyword "${a}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);r.logger.error(e)}}},Pt}var Ot,Nt={};var It,xt,Tt={};function Ct(){return xt||(xt=1,It=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var o,n,a;if(Array.isArray(t)){if((o=t.length)!=r.length)return!1;for(n=o;0!==n--;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((o=(a=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(n=o;0!==n--;)if(!Object.prototype.hasOwnProperty.call(r,a[n]))return!1;for(n=o;0!==n--;){var s=a[n];if(!e(t[s],r[s]))return!1}return!0}return t!=t&&r!=r}),It}var Rt,At,Ft,Mt={exports:{}};function Dt(){if(Rt)return Mt.exports;Rt=1;var e=Mt.exports=function(e,r,o){"function"==typeof r&&(o=r,r={}),t(r,"function"==typeof(o=r.cb||o)?o:o.pre||function(){},o.post||function(){},e,"",e)};function t(o,n,a,s,i,c,d,l,u,p){if(s&&"object"==typeof s&&!Array.isArray(s)){for(var f in n(s,i,c,d,l,u,p),s){var m=s[f];if(Array.isArray(m)){if(f in e.arrayKeywords)for(var h=0;h<m.length;h++)t(o,n,a,m[h],i+"/"+f+"/"+h,c,i,f,s,h)}else if(f in e.propsKeywords){if(m&&"object"==typeof m)for(var g in m)t(o,n,a,m[g],i+"/"+f+"/"+r(g),c,i,f,s,g)}else(f in e.keywords||o.allKeys&&!(f in e.skipKeywords))&&t(o,n,a,m,i+"/"+f,c,i,f,s)}a(s,i,c,d,l,u,p)}}function r(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}return e.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},e.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},e.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},e.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0},Mt.exports}function Vt(){if(At)return Tt;At=1,Object.defineProperty(Tt,"__esModule",{value:!0}),Tt.getSchemaRefs=Tt.resolveUrl=Tt.normalizeId=Tt._getFullPath=Tt.getFullPath=Tt.inlineRef=void 0;const e=nt(),t=Ct(),r=Dt(),o=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);Tt.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!a(e):!!t&&s(e)<=t)};const n=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function a(e){for(const t in e){if(n.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some(a))return!0;if("object"==typeof r&&a(r))return!0}return!1}function s(t){let r=0;for(const n in t){if("$ref"===n)return 1/0;if(r++,!o.has(n)&&("object"==typeof t[n]&&(0,e.eachItem)(t[n],e=>r+=s(e)),r===1/0))return 1/0}return r}function i(e,t="",r){!1!==r&&(t=l(t));const o=e.parse(t);return c(e,o)}function c(e,t){return e.serialize(t).split("#")[0]+"#"}Tt.getFullPath=i,Tt._getFullPath=c;const d=/#\/?$/;function l(e){return e?e.replace(d,""):""}Tt.normalizeId=l,Tt.resolveUrl=function(e,t,r){return r=l(r),e.resolve(t,r)};const u=/^[a-z_][-a-z0-9._]*$/i;return Tt.getSchemaRefs=function(e,o){if("boolean"==typeof e)return{};const{schemaId:n,uriResolver:a}=this.opts,s=l(e[n]||o),c={"":s},d=i(a,s,!1),p={},f=new Set;return r(e,{allKeys:!0},(e,t,r,o)=>{if(void 0===o)return;const a=d+t;let s=c[o];function i(t){const r=this.opts.uriResolver.resolve;if(t=l(s?r(s,t):t),f.has(t))throw h(t);f.add(t);let o=this.refs[t];return"string"==typeof o&&(o=this.refs[o]),"object"==typeof o?m(e,o.schema,t):t!==l(a)&&("#"===t[0]?(m(e,p[t],t),p[t]=e):this.refs[t]=a),t}function g(e){if("string"==typeof e){if(!u.test(e))throw new Error(`invalid anchor "${e}"`);i.call(this,`#${e}`)}}"string"==typeof e[n]&&(s=i.call(this,e[n])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),c[t]=s}),p;function m(e,r,o){if(void 0!==r&&!t(e,r))throw h(o)}function h(e){return new Error(`reference "${e}" resolves to more than one schema`)}},Tt}function zt(){if(Ft)return Be;Ft=1,Object.defineProperty(Be,"__esModule",{value:!0}),Be.getData=Be.KeywordCxt=Be.validateFunctionCode=void 0;const e=function(){if(it)return He;it=1,Object.defineProperty(He,"__esModule",{value:!0}),He.boolOrEmptySchema=He.topBoolOrEmptySchema=void 0;const e=lt(),t=tt(),r=dt(),o={message:"boolean schema is false"};function n(t,r){const{gen:n,data:a}=t,s={gen:n,keyword:"false schema",data:a,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,e.reportError)(s,o,void 0,r)}return He.topBoolOrEmptySchema=function(e){const{gen:o,schema:a,validateName:s}=e;!1===a?n(e,!1):"object"==typeof a&&!0===a.$async?o.return(r.default.data):(o.assign(t._`${s}.errors`,null),o.return(!0))},He.boolOrEmptySchema=function(e,t){const{gen:r,schema:o}=e;!1===o?(r.var(t,!1),n(e)):r.var(t,!0)},He}(),t=bt(),r=yt(),o=bt(),n=function(){if($t)return wt;$t=1,Object.defineProperty(wt,"__esModule",{value:!0}),wt.assignDefaults=void 0;const e=tt(),t=nt();function r(r,o,n){const{gen:a,compositeRule:s,data:i,opts:c}=r;if(void 0===n)return;const d=e._`${i}${(0,e.getProperty)(o)}`;if(s)return void(0,t.checkStrictMode)(r,`default is ignored for: ${d}`);let l=e._`${d} === undefined`;"empty"===c.useDefaults&&(l=e._`${l} || ${d} === null || ${d} === ""`),a.if(l,e._`${d} = ${(0,e.stringify)(n)}`)}return wt.assignDefaults=function(e,t){const{properties:o,items:n}=e.schema;if("object"===t&&o)for(const t in o)r(e,t,o[t].default);else"array"===t&&Array.isArray(n)&&n.forEach((t,o)=>r(e,o,t.default))},wt}(),a=jt(),s=function(){if(Ot)return Nt;Ot=1,Object.defineProperty(Nt,"__esModule",{value:!0}),Nt.extendSubschemaMode=Nt.extendSubschemaData=Nt.getSubschema=void 0;const e=tt(),t=nt();return Nt.getSubschema=function(r,{keyword:o,schemaProp:n,schema:a,schemaPath:s,errSchemaPath:i,topSchemaRef:c}){if(void 0!==o&&void 0!==a)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==o){const a=r.schema[o];return void 0===n?{schema:a,schemaPath:e._`${r.schemaPath}${(0,e.getProperty)(o)}`,errSchemaPath:`${r.errSchemaPath}/${o}`}:{schema:a[n],schemaPath:e._`${r.schemaPath}${(0,e.getProperty)(o)}${(0,e.getProperty)(n)}`,errSchemaPath:`${r.errSchemaPath}/${o}/${(0,t.escapeFragment)(n)}`}}if(void 0!==a){if(void 0===s||void 0===i||void 0===c)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:a,schemaPath:s,topSchemaRef:c,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')},Nt.extendSubschemaData=function(r,o,{dataProp:n,dataPropType:a,data:s,dataTypes:i,propertyName:c}){if(void 0!==s&&void 0!==n)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:d}=o;if(void 0!==n){const{errorPath:s,dataPathArr:i,opts:c}=o;l(d.let("data",e._`${o.data}${(0,e.getProperty)(n)}`,!0)),r.errorPath=e.str`${s}${(0,t.getErrorPath)(n,a,c.jsPropertySyntax)}`,r.parentDataProperty=e._`${n}`,r.dataPathArr=[...i,r.parentDataProperty]}function l(e){r.data=e,r.dataLevel=o.dataLevel+1,r.dataTypes=[],o.definedProperties=new Set,r.parentData=o.data,r.dataNames=[...o.dataNames,e]}void 0!==s&&(l(s instanceof e.Name?s:d.let("data",s,!0)),void 0!==c&&(r.propertyName=c)),i&&(r.dataTypes=i)},Nt.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:a}){void 0!==o&&(e.compositeRule=o),void 0!==n&&(e.createErrors=n),void 0!==a&&(e.allErrors=a),e.jtdDiscriminator=t,e.jtdMetadata=r},Nt}(),i=tt(),c=dt(),d=Vt(),l=nt(),u=lt();function p({gen:e,validateName:t,schema:r,schemaEnv:o,opts:n},a){n.code.es5?e.func(t,i._`${c.default.data}, ${c.default.valCxt}`,o.$async,()=>{e.code(i._`"use strict"; ${f(r,n)}`),function(e,t){e.if(c.default.valCxt,()=>{e.var(c.default.instancePath,i._`${c.default.valCxt}.${c.default.instancePath}`),e.var(c.default.parentData,i._`${c.default.valCxt}.${c.default.parentData}`),e.var(c.default.parentDataProperty,i._`${c.default.valCxt}.${c.default.parentDataProperty}`),e.var(c.default.rootData,i._`${c.default.valCxt}.${c.default.rootData}`),t.dynamicRef&&e.var(c.default.dynamicAnchors,i._`${c.default.valCxt}.${c.default.dynamicAnchors}`)},()=>{e.var(c.default.instancePath,i._`""`),e.var(c.default.parentData,i._`undefined`),e.var(c.default.parentDataProperty,i._`undefined`),e.var(c.default.rootData,c.default.data),t.dynamicRef&&e.var(c.default.dynamicAnchors,i._`{}`)})}(e,n),e.code(a)}):e.func(t,i._`${c.default.data}, ${function(e){return i._`{${c.default.instancePath}="", ${c.default.parentData}, ${c.default.parentDataProperty}, ${c.default.rootData}=${c.default.data}${e.dynamicRef?i._`, ${c.default.dynamicAnchors}={}`:i.nil}}={}`}(n)}`,o.$async,()=>e.code(f(r,n)).code(a))}function f(e,t){const r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?i._`/*# sourceURL=${r} */`:i.nil}function m(t,r){g(t)&&(v(t),h(t))?function(e,t){const{schema:r,gen:o,opts:n}=e;n.$comment&&r.$comment&&b(e);(function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,d.resolveUrl)(e.opts.uriResolver,e.baseId,t))})(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);const a=o.const("_errs",c.default.errors);y(e,a),o.var(t,i._`${a} === ${c.default.errors}`)}(t,r):(0,e.boolOrEmptySchema)(t,r)}function h({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const r in e)if(t.RULES.all[r])return!0;return!1}function g(e){return"boolean"!=typeof e.schema}function v(e){(0,l.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:r,opts:o,self:n}=e;t.$ref&&o.ignoreKeywordsWithRef&&(0,l.schemaHasRulesButRef)(t,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function y(e,r){if(e.opts.jtd)return $(e,[],!1,r);const o=(0,t.getSchemaTypes)(e.schema);$(e,o,!(0,t.coerceAndCheckDataType)(e,o),r)}function b({gen:e,schemaEnv:t,schema:r,errSchemaPath:o,opts:n}){const a=r.$comment;if(!0===n.$comment)e.code(i._`${c.default.self}.logger.log(${a})`);else if("function"==typeof n.$comment){const r=i.str`${o}/$comment`,n=e.scopeValue("root",{ref:t.root});e.code(i._`${c.default.self}.opts.$comment(${a}, ${r}, ${n}.schema)`)}}function $(e,t,n,a){const{gen:s,schema:d,data:u,allErrors:p,opts:f,self:m}=e,{RULES:h}=m;function g(l){(0,r.shouldUseGroup)(d,l)&&(l.type?(s.if((0,o.checkDataType)(l.type,u,f.strictNumbers)),w(e,l),1===t.length&&t[0]===l.type&&n&&(s.else(),(0,o.reportTypeError)(e)),s.endIf()):w(e,l),p||s.if(i._`${c.default.errors} === ${a||0}`))}!d.$ref||!f.ignoreKeywordsWithRef&&(0,l.schemaHasRulesButRef)(d,h)?(f.jtd||function(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;(function(e,t){if(!t.length)return;if(!e.dataTypes.length)return void(e.dataTypes=t);t.forEach(t=>{k(e.dataTypes,t)||P(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),function(e,t){const r=[];for(const o of e.dataTypes)k(t,o)?r.push(o):t.includes("integer")&&"number"===o&&r.push("integer");e.dataTypes=r}(e,t)})(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&P(e,"use allowUnionTypes to allow union type keyword")}(e,t);!function(e,t){const o=e.self.RULES.all;for(const n in o){const a=o[n];if("object"==typeof a&&(0,r.shouldUseRule)(e.schema,a)){const{type:r}=a.definition;r.length&&!r.some(e=>_(t,e))&&P(e,`missing type "${r.join(",")}" for keyword "${n}"`)}}}(e,e.dataTypes)}(e,t),s.block(()=>{for(const e of h.rules)g(e);g(h.post)})):s.block(()=>E(e,"$ref",h.all.$ref.definition))}function w(e,t){const{gen:o,schema:a,opts:{useDefaults:s}}=e;s&&(0,n.assignDefaults)(e,t.type),o.block(()=>{for(const o of t.rules)(0,r.shouldUseRule)(a,o)&&E(e,o.keyword,o.definition,t.type)})}function _(e,t){return e.includes(t)||"number"===t&&e.includes("integer")}function k(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function P(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,l.checkStrictMode)(e,t,e.opts.strictTypes)}Be.validateFunctionCode=function(t){g(t)&&(v(t),h(t))?function(e){const{schema:t,opts:r,gen:o}=e;p(e,()=>{r.$comment&&t.$comment&&b(e),function(e){const{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,l.checkStrictMode)(e,"default is ignored in the schema root")}(e),o.let(c.default.vErrors,null),o.let(c.default.errors,0),r.unevaluated&&function(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",i._`${r}.evaluated`),t.if(i._`${e.evaluated}.dynamicProps`,()=>t.assign(i._`${e.evaluated}.props`,i._`undefined`)),t.if(i._`${e.evaluated}.dynamicItems`,()=>t.assign(i._`${e.evaluated}.items`,i._`undefined`))}(e),y(e),function(e){const{gen:t,schemaEnv:r,validateName:o,ValidationError:n,opts:a}=e;r.$async?t.if(i._`${c.default.errors} === 0`,()=>t.return(c.default.data),()=>t.throw(i._`new ${n}(${c.default.vErrors})`)):(t.assign(i._`${o}.errors`,c.default.vErrors),a.unevaluated&&function({gen:e,evaluated:t,props:r,items:o}){r instanceof i.Name&&e.assign(i._`${t}.props`,r);o instanceof i.Name&&e.assign(i._`${t}.items`,o)}(e),t.return(i._`${c.default.errors} === 0`))}(e)})}(t):p(t,()=>(0,e.topBoolOrEmptySchema)(t))};class S{constructor(e,t,r){if((0,a.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,l.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",N(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,a.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",c.default.errors))}result(e,t,r){this.failResult((0,i.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,i.not)(e),void 0,t)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail(i._`${t} !== undefined && (${(0,i.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t)return this.setParams(t),this._error(e,r),void this.setParams({});this._error(e,r)}_error(e,t){(e?u.reportExtraError:u.reportError)(this,this.def.error,t)}$dataError(){(0,u.reportError)(this,this.def.$dataError||u.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,u.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=i.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=i.nil,t=i.nil){if(!this.$data)return;const{gen:r,schemaCode:o,schemaType:n,def:a}=this;r.if((0,i.or)(i._`${o} === undefined`,t)),e!==i.nil&&r.assign(e,!0),(n.length||a.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==i.nil&&r.assign(e,!1)),r.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:r,def:n,it:a}=this;return(0,i.or)(function(){if(r.length){if(!(t instanceof i.Name))throw new Error("ajv implementation error");const e=Array.isArray(r)?r:[r];return i._`${(0,o.checkDataTypes)(e,t,a.opts.strictNumbers,o.DataType.Wrong)}`}return i.nil}(),function(){if(n.validateSchema){const r=e.scopeValue("validate$data",{ref:n.validateSchema});return i._`!${r}(${t})`}return i.nil}())}subschema(e,t){const r=(0,s.getSubschema)(this.it,e);(0,s.extendSubschemaData)(r,this.it,e),(0,s.extendSubschemaMode)(r,e);const o={...this.it,...r,items:void 0,props:void 0};return m(o,t),o}mergeEvaluated(e,t){const{it:r,gen:o}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=l.mergeEvaluated.props(o,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=l.mergeEvaluated.items(o,e.items,r.items,t)))}mergeValidEvaluated(e,t){const{it:r,gen:o}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return o.if(t,()=>this.mergeEvaluated(e,i.Name)),!0}}function E(e,t,r,o){const n=new S(e,r,t);"code"in r?r.code(n,o):n.$data&&r.validate?(0,a.funcKeywordCode)(n,r):"macro"in r?(0,a.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,a.funcKeywordCode)(n,r)}Be.KeywordCxt=S;const j=/^\/(?:[^~]|~0|~1)*$/,O=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function N(e,{dataLevel:t,dataNames:r,dataPathArr:o}){let n,a;if(""===e)return c.default.rootData;if("/"===e[0]){if(!j.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);n=e,a=c.default.rootData}else{const s=O.exec(e);if(!s)throw new Error(`Invalid JSON-pointer: ${e}`);const i=+s[1];if(n=s[2],"#"===n){if(i>=t)throw new Error(u("property/index",i));return o[t-i]}if(i>t)throw new Error(u("data",i));if(a=r[t-i],!n)return a}let s=a;const d=n.split("/");for(const e of d)e&&(a=i._`${a}${(0,i.getProperty)((0,l.unescapeJsonPointer)(e))}`,s=i._`${s} && ${a}`);return s;function u(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}return Be.getData=N,Be}var Ut,qt={};function Kt(){if(Ut)return qt;Ut=1,Object.defineProperty(qt,"__esModule",{value:!0});class e extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}return qt.default=e,qt}var Lt,Bt={};function Ht(){if(Lt)return Bt;Lt=1,Object.defineProperty(Bt,"__esModule",{value:!0});const e=Vt();class t extends Error{constructor(t,r,o,n){super(n||`can't resolve reference ${o} from id ${r}`),this.missingRef=(0,e.resolveUrl)(t,r,o),this.missingSchema=(0,e.normalizeId)((0,e.getFullPath)(t,this.missingRef))}}return Bt.default=t,Bt}var Gt,Jt={};function Wt(){if(Gt)return Jt;Gt=1,Object.defineProperty(Jt,"__esModule",{value:!0}),Jt.resolveSchema=Jt.getCompilingSchema=Jt.resolveRef=Jt.compileSchema=Jt.SchemaEnv=void 0;const e=tt(),t=Kt(),r=dt(),o=Vt(),n=nt(),a=zt();class s{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:(0,o.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}}function i(n){const s=d.call(this,n);if(s)return s;const i=(0,o.getFullPath)(this.opts.uriResolver,n.root.baseId),{es5:c,lines:l}=this.opts.code,{ownProperties:u}=this.opts,p=new e.CodeGen(this.scope,{es5:c,lines:l,ownProperties:u});let f;n.$async&&(f=p.scopeValue("Error",{ref:t.default,code:e._`require("ajv/dist/runtime/validation_error").default`}));const m=p.scopeName("validate");n.validateName=m;const h={gen:p,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[e.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:p.scopeValue("schema",!0===this.opts.code.source?{ref:n.schema,code:(0,e.stringify)(n.schema)}:{ref:n.schema}),validateName:m,ValidationError:f,schema:n.schema,schemaEnv:n,rootId:i,baseId:n.baseId||i,schemaPath:e.nil,errSchemaPath:n.schemaPath||(this.opts.jtd?"":"#"),errorPath:e._`""`,opts:this.opts,self:this};let g;try{this._compilations.add(n),(0,a.validateFunctionCode)(h),p.optimize(this.opts.code.optimize);const t=p.toString();g=`${p.scopeRefs(r.default.scope)}return ${t}`,this.opts.code.process&&(g=this.opts.code.process(g,n));const o=new Function(`${r.default.self}`,`${r.default.scope}`,g)(this,this.scope.get());if(this.scope.value(m,{ref:o}),o.errors=null,o.schema=n.schema,o.schemaEnv=n,n.$async&&(o.$async=!0),!0===this.opts.code.source&&(o.source={validateName:m,validateCode:t,scopeValues:p._values}),this.opts.unevaluated){const{props:t,items:r}=h;o.evaluated={props:t instanceof e.Name?void 0:t,items:r instanceof e.Name?void 0:r,dynamicProps:t instanceof e.Name,dynamicItems:r instanceof e.Name},o.source&&(o.source.evaluated=(0,e.stringify)(o.evaluated))}return n.validate=o,n}catch(e){throw delete n.validate,delete n.validateName,g&&this.logger.error("Error compiling schema, function code:",g),e}finally{this._compilations.delete(n)}}function c(e){return(0,o.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:i.call(this,e)}function d(e){for(const t of this._compilations)if(l(t,e))return t}function l(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function u(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||p.call(this,e,t)}function p(e,t){const r=this.opts.uriResolver.parse(t),n=(0,o._getFullPath)(this.opts.uriResolver,r);let a=(0,o.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===a)return m.call(this,r,e);const c=(0,o.normalizeId)(n),d=this.refs[c]||this.schemas[c];if("string"==typeof d){const t=p.call(this,e,d);if("object"!=typeof(null==t?void 0:t.schema))return;return m.call(this,r,t)}if("object"==typeof(null==d?void 0:d.schema)){if(d.validate||i.call(this,d),c===(0,o.normalizeId)(t)){const{schema:t}=d,{schemaId:r}=this.opts,n=t[r];return n&&(a=(0,o.resolveUrl)(this.opts.uriResolver,a,n)),new s({schema:t,schemaId:r,root:e,baseId:a})}return m.call(this,r,d)}}Jt.SchemaEnv=s,Jt.compileSchema=i,Jt.resolveRef=function(e,t,r){var n;r=(0,o.resolveUrl)(this.opts.uriResolver,t,r);const a=e.refs[r];if(a)return a;let i=u.call(this,e,r);if(void 0===i){const o=null===(n=e.localRefs)||void 0===n?void 0:n[r],{schemaId:a}=this.opts;o&&(i=new s({schema:o,schemaId:a,root:e,baseId:t}))}return void 0!==i?e.refs[r]=c.call(this,i):void 0},Jt.getCompilingSchema=d,Jt.resolveSchema=p;const f=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function m(e,{baseId:t,schema:r,root:a}){var i;if("/"!==(null===(i=e.fragment)||void 0===i?void 0:i[0]))return;for(const a of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;const e=r[(0,n.unescapeFragment)(a)];if(void 0===e)return;const s="object"==typeof(r=e)&&r[this.opts.schemaId];!f.has(a)&&s&&(t=(0,o.resolveUrl)(this.opts.uriResolver,t,s))}let c;if("boolean"!=typeof r&&r.$ref&&!(0,n.schemaHasRulesButRef)(r,this.RULES)){const e=(0,o.resolveUrl)(this.opts.uriResolver,t,r.$ref);c=p.call(this,a,e)}const{schemaId:d}=this.opts;return c=c||new s({schema:r,schemaId:d,root:a,baseId:t}),c.schema!==c.root.schema?c:void 0}return Jt}var Yt,Qt,Xt,Zt,er,tr,rr,or,nr,ar={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1},sr={},ir={exports:{}};function cr(){if(Zt)return Xt;Zt=1;const{HEX:e}=Qt?Yt:(Qt=1,Yt={HEX:{0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15}}),t=/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u;function r(e){if(s(e,".")<3)return{host:e,isIPV4:!1};const r=e.match(t)||[],[o]=r;return o?{host:a(o,"."),isIPV4:!0}:{host:e,isIPV4:!1}}function o(t,r=!1){let o="",n=!0;for(const r of t){if(void 0===e[r])return;"0"!==r&&!0===n&&(n=!1),n||(o+=r)}return r&&0===o.length&&(o="0"),o}function n(e){if(s(e,":")<2)return{host:e,isIPV6:!1};const t=function(e){let t=0;const r={error:!1,address:"",zone:""},n=[],a=[];let s=!1,i=!1,c=!1;function d(){if(a.length){if(!1===s){const e=o(a);if(void 0===e)return r.error=!0,!1;n.push(e)}a.length=0}return!0}for(let o=0;o<e.length;o++){const l=e[o];if("["!==l&&"]"!==l)if(":"!==l)if("%"===l){if(!d())break;s=!0}else a.push(l);else{if(!0===i&&(c=!0),!d())break;if(t++,n.push(":"),t>7){r.error=!0;break}o-1>=0&&":"===e[o-1]&&(i=!0)}}return a.length&&(s?r.zone=a.join(""):c?n.push(a.join("")):n.push(o(a))),r.address=n.join(""),r}(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,r=t.address;return t.zone&&(e+="%"+t.zone,r+="%25"+t.zone),{host:e,escapedHost:r,isIPV6:!0}}}function a(e,t){let r="",o=!0;const n=e.length;for(let a=0;a<n;a++){const s=e[a];"0"===s&&o?(a+1<=n&&e[a+1]===t||a+1===n)&&(r+=s,o=!1):(o=s===t,r+=s)}return r}function s(e,t){let r=0;for(let o=0;o<e.length;o++)e[o]===t&&r++;return r}const i=/^\.\.?\//u,c=/^\/\.(?:\/|$)/u,d=/^\/\.\.(?:\/|$)/u,l=/^\/?(?:.|\n)*?(?=\/|$)/u;return Xt={recomposeAuthority:function(e){const t=[];if(void 0!==e.userinfo&&(t.push(e.userinfo),t.push("@")),void 0!==e.host){let o=unescape(e.host);const a=r(o);if(a.isIPV4)o=a.host;else{const t=n(a.host);o=!0===t.isIPV6?`[${t.escapedHost}]`:e.host}t.push(o)}return"number"!=typeof e.port&&"string"!=typeof e.port||(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0},normalizeComponentEncoding:function(e,t){const r=!0!==t?escape:unescape;return void 0!==e.scheme&&(e.scheme=r(e.scheme)),void 0!==e.userinfo&&(e.userinfo=r(e.userinfo)),void 0!==e.host&&(e.host=r(e.host)),void 0!==e.path&&(e.path=r(e.path)),void 0!==e.query&&(e.query=r(e.query)),void 0!==e.fragment&&(e.fragment=r(e.fragment)),e},removeDotSegments:function(e){const t=[];for(;e.length;)if(e.match(i))e=e.replace(i,"");else if(e.match(c))e=e.replace(c,"/");else if(e.match(d))e=e.replace(d,"/"),t.pop();else if("."===e||".."===e)e="";else{const r=e.match(l);if(!r)throw new Error("Unexpected dot segment condition");{const o=r[0];e=e.slice(o.length),t.push(o)}}return t.join("")},normalizeIPv4:r,normalizeIPv6:n,stringArrayToHexStripped:o}}function dr(){if(rr)return ir.exports;rr=1;const{normalizeIPv6:e,normalizeIPv4:t,removeDotSegments:r,recomposeAuthority:o,normalizeComponentEncoding:n}=cr(),a=function(){if(tr)return er;tr=1;const e=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,t=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function r(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}function o(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function n(e){const t="https"===String(e.scheme).toLowerCase();return e.port!==(t?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}const a={scheme:"http",domainHost:!0,parse:o,serialize:n},s={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=r(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if(e.port!==(r(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){const[t,r]=e.resourceName.split("?");e.path=t&&"/"!==t?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}},i={http:a,https:{scheme:"https",domainHost:a.domainHost,parse:o,serialize:n},ws:s,wss:{scheme:"wss",domainHost:s.domainHost,parse:s.parse,serialize:s.serialize},urn:{scheme:"urn",parse:function(e,r){if(!e.path)return e.error="URN can not be parsed",e;const o=e.path.match(t);if(o){const t=r.scheme||e.scheme||"urn";e.nid=o[1].toLowerCase(),e.nss=o[2];const n=`${t}:${r.nid||e.nid}`,a=i[n];e.path=void 0,a&&(e=a.parse(e,r))}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){const r=t.scheme||e.scheme||"urn",o=e.nid.toLowerCase(),n=`${r}:${t.nid||o}`,a=i[n];a&&(e=a.serialize(e,t));const s=e,c=e.nss;return s.path=`${o||t.nid}:${c}`,t.skipEscape=!0,s},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(t,r){const o=t;return o.uuid=o.nss,o.nss=void 0,r.tolerant||o.uuid&&e.test(o.uuid)||(o.error=o.error||"UUID is not valid."),o},serialize:function(e){const t=e;return t.nss=(e.uuid||"").toLowerCase(),t},skipNormalize:!0}};return er=i}();function s(e,t,o,n){const a={};return n||(e=l(i(e,o),o),t=l(i(t,o),o)),!(o=o||{}).tolerant&&t.scheme?(a.scheme=t.scheme,a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||""),a.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||""),a.query=t.query):(t.path?("/"===t.path.charAt(0)?a.path=r(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?a.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:a.path=t.path:a.path="/"+t.path,a.path=r(a.path)),a.query=t.query):(a.path=e.path,void 0!==t.query?a.query=t.query:a.query=e.query),a.userinfo=e.userinfo,a.host=e.host,a.port=e.port),a.scheme=e.scheme),a.fragment=t.fragment,a}function i(e,t){const n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},s=Object.assign({},t),i=[],c=a[(s.scheme||n.scheme||"").toLowerCase()];c&&c.serialize&&c.serialize(n,s),void 0!==n.path&&(s.skipEscape?n.path=unescape(n.path):(n.path=escape(n.path),void 0!==n.scheme&&(n.path=n.path.split("%3A").join(":")))),"suffix"!==s.reference&&n.scheme&&i.push(n.scheme,":");const d=o(n);if(void 0!==d&&("suffix"!==s.reference&&i.push("//"),i.push(d),n.path&&"/"!==n.path.charAt(0)&&i.push("/")),void 0!==n.path){let e=n.path;s.absolutePath||c&&c.absolutePath||(e=r(e)),void 0===d&&(e=e.replace(/^\/\//u,"/%2F")),i.push(e)}return void 0!==n.query&&i.push("?",n.query),void 0!==n.fragment&&i.push("#",n.fragment),i.join("")}const c=Array.from({length:127},(e,t)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(t)));const d=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function l(r,o){const n=Object.assign({},o),s={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=-1!==r.indexOf("%");let l=!1;"suffix"===n.reference&&(r=(n.scheme?n.scheme+":":"")+"//"+r);const u=r.match(d);if(u){if(s.scheme=u[1],s.userinfo=u[3],s.host=u[4],s.port=parseInt(u[5],10),s.path=u[6]||"",s.query=u[7],s.fragment=u[8],isNaN(s.port)&&(s.port=u[5]),s.host){const r=t(s.host);if(!1===r.isIPV4){const t=e(r.host);s.host=t.host.toLowerCase(),l=t.isIPV6}else s.host=r.host,l=!0}void 0!==s.scheme||void 0!==s.userinfo||void 0!==s.host||void 0!==s.port||void 0!==s.query||s.path?void 0===s.scheme?s.reference="relative":void 0===s.fragment?s.reference="absolute":s.reference="uri":s.reference="same-document",n.reference&&"suffix"!==n.reference&&n.reference!==s.reference&&(s.error=s.error||"URI is not a "+n.reference+" reference.");const r=a[(n.scheme||s.scheme||"").toLowerCase()];if(!(n.unicodeSupport||r&&r.unicodeSupport)&&s.host&&(n.domainHost||r&&r.domainHost)&&!1===l&&function(e){let t=0;for(let r=0,o=e.length;r<o;++r)if(t=e.charCodeAt(r),t>126||c[t])return!0;return!1}(s.host))try{s.host=URL.domainToASCII(s.host.toLowerCase())}catch(e){s.error=s.error||"Host's domain name can not be converted to ASCII: "+e}(!r||r&&!r.skipNormalize)&&(i&&void 0!==s.scheme&&(s.scheme=unescape(s.scheme)),i&&void 0!==s.host&&(s.host=unescape(s.host)),s.path&&(s.path=escape(unescape(s.path))),s.fragment&&(s.fragment=encodeURI(decodeURIComponent(s.fragment)))),r&&r.parse&&r.parse(s,n)}else s.error=s.error||"URI can not be parsed.";return s}const u={SCHEMES:a,normalize:function(e,t){return"string"==typeof e?e=i(l(e,t),t):"object"==typeof e&&(e=l(i(e,t),t)),e},resolve:function(e,t,r){const o=Object.assign({scheme:"null"},r);return i(s(l(e,o),l(t,o),o,!0),{...o,skipEscape:!0})},resolveComponents:s,equal:function(e,t,r){return"string"==typeof e?(e=unescape(e),e=i(n(l(e,r),!0),{...r,skipEscape:!0})):"object"==typeof e&&(e=i(n(e,!0),{...r,skipEscape:!0})),"string"==typeof t?(t=unescape(t),t=i(n(l(t,r),!0),{...r,skipEscape:!0})):"object"==typeof t&&(t=i(n(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()},serialize:i,parse:l};return ir.exports=u,ir.exports.default=u,ir.exports.fastUri=u,ir.exports}function lr(){return nr||(nr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=zt();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=tt();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});const o=Kt(),n=Ht(),a=mt(),s=Wt(),i=tt(),c=Vt(),d=bt(),l=nt(),u=ar,p=function(){if(or)return sr;or=1,Object.defineProperty(sr,"__esModule",{value:!0});const e=dr();return e.code='require("ajv/dist/runtime/uri").default',sr.default=e,sr}(),f=(e,t)=>new RegExp(e,t);f.code="new RegExp";const m=["removeAdditional","useDefaults","coerceTypes"],h=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),g={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},v={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function y(e){var t,r,o,n,a,s,i,c,d,l,u,m,h,g,v,y,b,$,w,_,k,P,S,E,j;const O=e.strict,N=null===(t=e.code)||void 0===t?void 0:t.optimize,I=!0===N||void 0===N?1:N||0,x=null!==(o=null===(r=e.code)||void 0===r?void 0:r.regExp)&&void 0!==o?o:f,T=null!==(n=e.uriResolver)&&void 0!==n?n:p.default;return{strictSchema:null===(s=null!==(a=e.strictSchema)&&void 0!==a?a:O)||void 0===s||s,strictNumbers:null===(c=null!==(i=e.strictNumbers)&&void 0!==i?i:O)||void 0===c||c,strictTypes:null!==(l=null!==(d=e.strictTypes)&&void 0!==d?d:O)&&void 0!==l?l:"log",strictTuples:null!==(m=null!==(u=e.strictTuples)&&void 0!==u?u:O)&&void 0!==m?m:"log",strictRequired:null!==(g=null!==(h=e.strictRequired)&&void 0!==h?h:O)&&void 0!==g&&g,code:e.code?{...e.code,optimize:I,regExp:x}:{optimize:I,regExp:x},loopRequired:null!==(v=e.loopRequired)&&void 0!==v?v:200,loopEnum:null!==(y=e.loopEnum)&&void 0!==y?y:200,meta:null===(b=e.meta)||void 0===b||b,messages:null===($=e.messages)||void 0===$||$,inlineRefs:null===(w=e.inlineRefs)||void 0===w||w,schemaId:null!==(_=e.schemaId)&&void 0!==_?_:"$id",addUsedSchema:null===(k=e.addUsedSchema)||void 0===k||k,validateSchema:null===(P=e.validateSchema)||void 0===P||P,validateFormats:null===(S=e.validateFormats)||void 0===S||S,unicodeRegExp:null===(E=e.unicodeRegExp)||void 0===E||E,int32range:null===(j=e.int32range)||void 0===j||j,uriResolver:T}}class b{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...y(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new i.ValueScope({scope:{},prefixes:h,es5:t,lines:r}),this.logger=function(e){if(!1===e)return E;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(e.logger);const o=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),$.call(this,g,e,"NOT SUPPORTED"),$.call(this,v,e,"DEPRECATED","warn"),this._metaOpts=S.call(this),e.formats&&k.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&P.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),_.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:r}=this.opts;let o=u;"id"===r&&(o={...u},o.id=o.$id,delete o.$id),t&&e&&this.addMetaSchema(o,o[r],!1)}defaultMeta(){const{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(r=this.getSchema(e),!r)throw new Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);const o=r(t);return"$async"in r||(this.errors=r.errors),o}compile(e,t){const r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:r}=this.opts;return o.call(this,e,t);async function o(e,t){await a.call(this,e.$schema);const r=this._addSchema(e,t);return r.validate||s.call(this,r)}async function a(e){e&&!this.getSchema(e)&&await o.call(this,{$ref:e},!0)}async function s(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof n.default))throw t;return i.call(this,t),await c.call(this,t.missingSchema),s.call(this,e)}}function i({missingSchema:e,missingRef:t}){if(this.refs[e])throw new Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){const r=await d.call(this,e);this.refs[e]||await a.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function d(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,o=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,r,o);return this}let n;if("object"==typeof e){const{schemaId:t}=this.opts;if(n=e[t],void 0!==n&&"string"!=typeof n)throw new Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||n),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,o,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if("boolean"==typeof e)return!0;let r;if(r=e.$schema,void 0!==r&&"string"!=typeof r)throw new Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const o=this.validate(r,e);if(!o&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return o}getSchema(e){let t;for(;"string"==typeof(t=w.call(this,e));)e=t;if(void 0===t){const{schemaId:r}=this.opts,o=new s.SchemaEnv({schema:{},schemaId:r});if(t=s.resolveSchema.call(this,o,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const t=w.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const t=e;this._cache.delete(t);let r=e[this.opts.schemaId];return r&&(r=(0,c.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(r=(t=e).keyword,Array.isArray(r)&&!r.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(O.call(this,r,t),!t)return(0,l.eachItem)(r,e=>N.call(this,e)),this;x.call(this,t);const o={...t,type:(0,d.getJSONTypes)(t.type),schemaType:(0,d.getJSONTypes)(t.schemaType)};return(0,l.eachItem)(r,0===o.type.length?e=>N.call(this,e,o):e=>o.type.forEach(t=>N.call(this,e,o,t))),this}getKeyword(e){const t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){const{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(const r of t.rules){const t=r.rules.findIndex(t=>t.keyword===e);t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map(e=>`${r}${e.instancePath} ${e.message}`).reduce((e,r)=>e+t+r):"No errors"}$dataMetaSchema(e,t){const r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const o of t){const t=o.split("/").slice(1);let n=e;for(const e of t)n=n[e];for(const e in r){const t=r[e];if("object"!=typeof t)continue;const{$data:o}=t.definition,a=n[e];o&&a&&(n[e]=C(a))}}return e}_removeAllSchemas(e,t){for(const r in e){const o=e[r];t&&!t.test(r)||("string"==typeof o?delete e[r]:o&&!o.meta&&(this._cache.delete(o.schema),delete e[r]))}}_addSchema(e,t,r,o=this.opts.validateSchema,n=this.opts.addUsedSchema){let a;const{schemaId:i}=this.opts;if("object"==typeof e)a=e[i];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof e)throw new Error("schema must be object or boolean")}let d=this._cache.get(e);if(void 0!==d)return d;r=(0,c.normalizeId)(a||r);const l=c.getSchemaRefs.call(this,e,r);return d=new s.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:r,localRefs:l}),this._cache.set(d.schema,d),n&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=d),o&&this.validateSchema(e,!0),d}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):s.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{s.compileSchema.call(this,e)}finally{this.opts=t}}}function $(e,t,r,o="error"){for(const n in e){const a=n;a in t&&this.logger[o](`${r}: option ${n}. ${e[a]}`)}}function w(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function _(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function k(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function P(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}}function S(){const e={...this.opts};for(const t of m)delete e[t];return e}b.ValidationError=o.default,b.MissingRefError=n.default,e.default=b;const E={log(){},warn(){},error(){}};const j=/^[a-z_$][a-z0-9_$:-]*$/i;function O(e,t){const{RULES:r}=this;if((0,l.eachItem)(e,e=>{if(r.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!j.test(e))throw new Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!("code"in t)&&!("validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function N(e,t,r){var o;const n=null==t?void 0:t.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:a}=this;let s=n?a.post:a.rules.find(({type:e})=>e===r);if(s||(s={type:r,rules:[]},a.rules.push(s)),a.keywords[e]=!0,!t)return;const i={keyword:e,definition:{...t,type:(0,d.getJSONTypes)(t.type),schemaType:(0,d.getJSONTypes)(t.schemaType)}};t.before?I.call(this,s,i,t.before):s.rules.push(i),a.all[e]=i,null===(o=t.implements)||void 0===o||o.forEach(e=>this.addKeyword(e))}function I(e,t,r){const o=e.rules.findIndex(e=>e.keyword===r);o>=0?e.rules.splice(o,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function x(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=C(t)),e.validateSchema=this.compile(t,!0))}const T={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function C(e){return{anyOf:[e,T]}}}(Le)),Le}var ur,pr={},fr={},mr={};var hr,gr,vr={};function yr(){if(hr)return vr;hr=1,Object.defineProperty(vr,"__esModule",{value:!0}),vr.callRef=vr.getValidate=void 0;const e=Ht(),t=Et(),r=tt(),o=dt(),n=Wt(),a=nt(),s={keyword:"$ref",schemaType:"string",code(t){const{gen:o,schema:a,it:s}=t,{baseId:d,schemaEnv:l,validateName:u,opts:p,self:f}=s,{root:m}=l;if(("#"===a||"#/"===a)&&d===m.baseId)return function(){if(l===m)return c(t,u,l,l.$async);const e=o.scopeValue("root",{ref:m});return c(t,r._`${e}.validate`,m,m.$async)}();const h=n.resolveRef.call(f,m,d,a);if(void 0===h)throw new e.default(s.opts.uriResolver,d,a);return h instanceof n.SchemaEnv?function(e){const r=i(t,e);c(t,r,e,e.$async)}(h):function(e){const n=o.scopeValue("schema",!0===p.code.source?{ref:e,code:(0,r.stringify)(e)}:{ref:e}),s=o.name("valid"),i=t.subschema({schema:e,dataTypes:[],schemaPath:r.nil,topSchemaRef:n,errSchemaPath:a},s);t.mergeEvaluated(i),t.ok(s)}(h)}};function i(e,t){const{gen:o}=e;return t.validate?o.scopeValue("validate",{ref:t.validate}):r._`${o.scopeValue("wrapper",{ref:t})}.validate`}function c(e,n,s,i){const{gen:c,it:d}=e,{allErrors:l,schemaEnv:u,opts:p}=d,f=p.passContext?o.default.this:r.nil;function m(e){const t=r._`${e}.errors`;c.assign(o.default.vErrors,r._`${o.default.vErrors} === null ? ${t} : ${o.default.vErrors}.concat(${t})`),c.assign(o.default.errors,r._`${o.default.vErrors}.length`)}function h(e){var t;if(!d.opts.unevaluated)return;const o=null===(t=null==s?void 0:s.validate)||void 0===t?void 0:t.evaluated;if(!0!==d.props)if(o&&!o.dynamicProps)void 0!==o.props&&(d.props=a.mergeEvaluated.props(c,o.props,d.props));else{const t=c.var("props",r._`${e}.evaluated.props`);d.props=a.mergeEvaluated.props(c,t,d.props,r.Name)}if(!0!==d.items)if(o&&!o.dynamicItems)void 0!==o.items&&(d.items=a.mergeEvaluated.items(c,o.items,d.items));else{const t=c.var("items",r._`${e}.evaluated.items`);d.items=a.mergeEvaluated.items(c,t,d.items,r.Name)}}i?function(){if(!u.$async)throw new Error("async schema referenced by sync schema");const o=c.let("valid");c.try(()=>{c.code(r._`await ${(0,t.callValidateCode)(e,n,f)}`),h(n),l||c.assign(o,!0)},e=>{c.if(r._`!(${e} instanceof ${d.ValidationError})`,()=>c.throw(e)),m(e),l||c.assign(o,!1)}),e.ok(o)}():e.result((0,t.callValidateCode)(e,n,f),()=>h(n),()=>m(n))}return vr.getValidate=i,vr.callRef=c,vr.default=s,vr}function br(){if(gr)return fr;gr=1,Object.defineProperty(fr,"__esModule",{value:!0});const e=function(){if(ur)return mr;ur=1,Object.defineProperty(mr,"__esModule",{value:!0});const e={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return mr.default=e,mr}(),t=yr(),r=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",e.default,t.default];return fr.default=r,fr}var $r,wr={},_r={};var kr,Pr={};var Sr,Er,jr={},Or={};function Nr(){if(Er)return jr;Er=1,Object.defineProperty(jr,"__esModule",{value:!0});const e=tt(),t=nt(),r=function(){if(Sr)return Or;function e(e){const t=e.length;let r,o=0,n=0;for(;n<t;)o++,r=e.charCodeAt(n++),r>=55296&&r<=56319&&n<t&&(r=e.charCodeAt(n),56320==(64512&r)&&n++);return o}return Sr=1,Object.defineProperty(Or,"__esModule",{value:!0}),Or.default=e,e.code='require("ajv/dist/runtime/ucs2length").default',Or}(),o={message({keyword:t,schemaCode:r}){const o="maxLength"===t?"more":"fewer";return e.str`must NOT have ${o} than ${r} characters`},params:({schemaCode:t})=>e._`{limit: ${t}}`},n={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:o,code(o){const{keyword:n,data:a,schemaCode:s,it:i}=o,c="maxLength"===n?e.operators.GT:e.operators.LT,d=!1===i.opts.unicode?e._`${a}.length`:e._`${(0,t.useFunc)(o.gen,r.default)}(${a})`;o.fail$data(e._`${d} ${c} ${s}`)}};return jr.default=n,jr}var Ir,xr={};var Tr,Cr={};var Rr,Ar={};function Fr(){if(Rr)return Ar;Rr=1,Object.defineProperty(Ar,"__esModule",{value:!0});const e=Et(),t=tt(),r=nt(),o={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>t.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>t._`{missingProperty: ${e}}`},code(o){const{gen:n,schema:a,schemaCode:s,data:i,$data:c,it:d}=o,{opts:l}=d;if(!c&&0===a.length)return;const u=a.length>=l.loopRequired;if(d.allErrors?function(){if(u||c)o.block$data(t.nil,p);else for(const t of a)(0,e.checkReportMissingProp)(o,t)}():function(){const r=n.let("missing");if(u||c){const a=n.let("valid",!0);o.block$data(a,()=>function(r,a){o.setParams({missingProperty:r}),n.forOf(r,s,()=>{n.assign(a,(0,e.propertyInData)(n,i,r,l.ownProperties)),n.if((0,t.not)(a),()=>{o.error(),n.break()})},t.nil)}(r,a)),o.ok(a)}else n.if((0,e.checkMissingProp)(o,a,r)),(0,e.reportMissingProp)(o,r),n.else()}(),l.strictRequired){const e=o.parentSchema.properties,{definedProperties:t}=o.it;for(const o of a)if(void 0===(null==e?void 0:e[o])&&!t.has(o)){const e=`required property "${o}" is not defined at "${d.schemaEnv.baseId+d.errSchemaPath}" (strictRequired)`;(0,r.checkStrictMode)(d,e,d.opts.strictRequired)}}function p(){n.forOf("prop",s,t=>{o.setParams({missingProperty:t}),n.if((0,e.noPropertyInData)(n,i,t,l.ownProperties),()=>o.error())})}}};return Ar.default=o,Ar}var Mr,Dr={};var Vr,zr,Ur={},qr={};function Kr(){if(Vr)return qr;Vr=1,Object.defineProperty(qr,"__esModule",{value:!0});const e=Ct();return e.code='require("ajv/dist/runtime/equal").default',qr.default=e,qr}function Lr(){if(zr)return Ur;zr=1,Object.defineProperty(Ur,"__esModule",{value:!0});const e=bt(),t=tt(),r=nt(),o=Kr(),n={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:r}})=>t.str`must NOT have duplicate items (items ## ${r} and ${e} are identical)`,params:({params:{i:e,j:r}})=>t._`{i: ${e}, j: ${r}}`},code(n){const{gen:a,data:s,$data:i,schema:c,parentSchema:d,schemaCode:l,it:u}=n;if(!i&&!c)return;const p=a.let("valid"),f=d.items?(0,e.getSchemaTypes)(d.items):[];function m(r,o){const i=a.name("item"),c=(0,e.checkDataTypes)(f,i,u.opts.strictNumbers,e.DataType.Wrong),d=a.const("indices",t._`{}`);a.for(t._`;${r}--;`,()=>{a.let(i,t._`${s}[${r}]`),a.if(c,t._`continue`),f.length>1&&a.if(t._`typeof ${i} == "string"`,t._`${i} += "_"`),a.if(t._`typeof ${d}[${i}] == "number"`,()=>{a.assign(o,t._`${d}[${i}]`),n.error(),a.assign(p,!1).break()}).code(t._`${d}[${i}] = ${r}`)})}function h(e,i){const c=(0,r.useFunc)(a,o.default),d=a.name("outer");a.label(d).for(t._`;${e}--;`,()=>a.for(t._`${i} = ${e}; ${i}--;`,()=>a.if(t._`${c}(${s}[${e}], ${s}[${i}])`,()=>{n.error(),a.assign(p,!1).break(d)})))}n.block$data(p,function(){const e=a.let("i",t._`${s}.length`),r=a.let("j");n.setParams({i:e,j:r}),a.assign(p,!0),a.if(t._`${e} > 1`,()=>(f.length>0&&!f.some(e=>"object"===e||"array"===e)?m:h)(e,r))},t._`${l} === false`),n.ok(p)}};return Ur.default=n,Ur}var Br,Hr={};var Gr,Jr,Wr={};function Yr(){if(Gr)return Wr;Gr=1,Object.defineProperty(Wr,"__esModule",{value:!0});const e=tt(),t=nt(),r=Kr(),o={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>e._`{allowedValues: ${t}}`},code(o){const{gen:n,data:a,$data:s,schema:i,schemaCode:c,it:d}=o;if(!s&&0===i.length)throw new Error("enum must have non-empty array");const l=i.length>=d.opts.loopEnum;let u;const p=()=>null!=u?u:u=(0,t.useFunc)(n,r.default);let f;if(l||s)f=n.let("valid"),o.block$data(f,function(){n.assign(f,!1),n.forOf("v",c,t=>n.if(e._`${p()}(${a}, ${t})`,()=>n.assign(f,!0).break()))});else{if(!Array.isArray(i))throw new Error("ajv implementation error");const t=n.const("vSchema",c);f=(0,e.or)(...i.map((r,o)=>function(t,r){const o=i[r];return"object"==typeof o&&null!==o?e._`${p()}(${a}, ${t}[${r}])`:e._`${a} === ${o}`}(t,o)))}o.pass(f)}};return Wr.default=o,Wr}function Qr(){if(Jr)return wr;Jr=1,Object.defineProperty(wr,"__esModule",{value:!0});const e=function(){if($r)return _r;$r=1,Object.defineProperty(_r,"__esModule",{value:!0});const e=tt(),t=e.operators,r={maximum:{okStr:"<=",ok:t.LTE,fail:t.GT},minimum:{okStr:">=",ok:t.GTE,fail:t.LT},exclusiveMaximum:{okStr:"<",ok:t.LT,fail:t.GTE},exclusiveMinimum:{okStr:">",ok:t.GT,fail:t.LTE}},o={message:({keyword:t,schemaCode:o})=>e.str`must be ${r[t].okStr} ${o}`,params:({keyword:t,schemaCode:o})=>e._`{comparison: ${r[t].okStr}, limit: ${o}}`},n={keyword:Object.keys(r),type:"number",schemaType:"number",$data:!0,error:o,code(t){const{keyword:o,data:n,schemaCode:a}=t;t.fail$data(e._`${n} ${r[o].fail} ${a} || isNaN(${n})`)}};return _r.default=n,_r}(),t=function(){if(kr)return Pr;kr=1,Object.defineProperty(Pr,"__esModule",{value:!0});const e=tt(),t={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:t})=>e.str`must be multiple of ${t}`,params:({schemaCode:t})=>e._`{multipleOf: ${t}}`},code(t){const{gen:r,data:o,schemaCode:n,it:a}=t,s=a.opts.multipleOfPrecision,i=r.let("res"),c=s?e._`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:e._`${i} !== parseInt(${i})`;t.fail$data(e._`(${n} === 0 || (${i} = ${o}/${n}, ${c}))`)}};return Pr.default=t,Pr}(),r=Nr(),o=function(){if(Ir)return xr;Ir=1,Object.defineProperty(xr,"__esModule",{value:!0});const e=Et(),t=tt(),r={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>t.str`must match pattern "${e}"`,params:({schemaCode:e})=>t._`{pattern: ${e}}`},code(r){const{data:o,$data:n,schema:a,schemaCode:s,it:i}=r,c=i.opts.unicodeRegExp?"u":"",d=n?t._`(new RegExp(${s}, ${c}))`:(0,e.usePattern)(r,a);r.fail$data(t._`!${d}.test(${o})`)}};return xr.default=r,xr}(),n=function(){if(Tr)return Cr;Tr=1,Object.defineProperty(Cr,"__esModule",{value:!0});const e=tt(),t={message({keyword:t,schemaCode:r}){const o="maxProperties"===t?"more":"fewer";return e.str`must NOT have ${o} than ${r} properties`},params:({schemaCode:t})=>e._`{limit: ${t}}`},r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:t,code(t){const{keyword:r,data:o,schemaCode:n}=t,a="maxProperties"===r?e.operators.GT:e.operators.LT;t.fail$data(e._`Object.keys(${o}).length ${a} ${n}`)}};return Cr.default=r,Cr}(),a=Fr(),s=function(){if(Mr)return Dr;Mr=1,Object.defineProperty(Dr,"__esModule",{value:!0});const e=tt(),t={message({keyword:t,schemaCode:r}){const o="maxItems"===t?"more":"fewer";return e.str`must NOT have ${o} than ${r} items`},params:({schemaCode:t})=>e._`{limit: ${t}}`},r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:t,code(t){const{keyword:r,data:o,schemaCode:n}=t,a="maxItems"===r?e.operators.GT:e.operators.LT;t.fail$data(e._`${o}.length ${a} ${n}`)}};return Dr.default=r,Dr}(),i=Lr(),c=function(){if(Br)return Hr;Br=1,Object.defineProperty(Hr,"__esModule",{value:!0});const e=tt(),t=nt(),r=Kr(),o={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>e._`{allowedValue: ${t}}`},code(o){const{gen:n,data:a,$data:s,schemaCode:i,schema:c}=o;s||c&&"object"==typeof c?o.fail$data(e._`!${(0,t.useFunc)(n,r.default)}(${a}, ${i})`):o.fail(e._`${c} !== ${a}`)}};return Hr.default=o,Hr}(),d=Yr(),l=[e.default,t.default,r.default,o.default,n.default,a.default,s.default,i.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},c.default,d.default];return wr.default=l,wr}var Xr,Zr={},eo={};function to(){if(Xr)return eo;Xr=1,Object.defineProperty(eo,"__esModule",{value:!0}),eo.validateAdditionalItems=void 0;const e=tt(),t=nt(),r={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:t}})=>e.str`must NOT have more than ${t} items`,params:({params:{len:t}})=>e._`{limit: ${t}}`},code(e){const{parentSchema:r,it:n}=e,{items:a}=r;Array.isArray(a)?o(e,a):(0,t.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas')}};function o(r,o){const{gen:n,schema:a,data:s,keyword:i,it:c}=r;c.items=!0;const d=n.const("len",e._`${s}.length`);if(!1===a)r.setParams({len:o.length}),r.pass(e._`${d} <= ${o.length}`);else if("object"==typeof a&&!(0,t.alwaysValidSchema)(c,a)){const a=n.var("valid",e._`${d} <= ${o.length}`);n.if((0,e.not)(a),()=>function(a){n.forRange("i",o.length,d,o=>{r.subschema({keyword:i,dataProp:o,dataPropType:t.Type.Num},a),c.allErrors||n.if((0,e.not)(a),()=>n.break())})}(a)),r.ok(a)}}return eo.validateAdditionalItems=o,eo.default=r,eo}var ro,oo,no={},ao={};function so(){if(ro)return ao;ro=1,Object.defineProperty(ao,"__esModule",{value:!0}),ao.validateTuple=void 0;const e=tt(),t=nt(),r=Et(),o={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:o,it:a}=e;if(Array.isArray(o))return n(e,"additionalItems",o);a.items=!0,(0,t.alwaysValidSchema)(a,o)||e.ok((0,r.validateArray)(e))}};function n(r,o,n=r.schema){const{gen:a,parentSchema:s,data:i,keyword:c,it:d}=r;!function(e){const{opts:r,errSchemaPath:a}=d,s=n.length,i=s===e.minItems&&(s===e.maxItems||!1===e[o]);if(r.strictTuples&&!i){const e=`"${c}" is ${s}-tuple, but minItems or maxItems/${o} are not specified or different at path "${a}"`;(0,t.checkStrictMode)(d,e,r.strictTuples)}}(s),d.opts.unevaluated&&n.length&&!0!==d.items&&(d.items=t.mergeEvaluated.items(a,n.length,d.items));const l=a.name("valid"),u=a.const("len",e._`${i}.length`);n.forEach((o,n)=>{(0,t.alwaysValidSchema)(d,o)||(a.if(e._`${u} > ${n}`,()=>r.subschema({keyword:c,schemaProp:n,dataProp:n},l)),r.ok(l))})}return ao.validateTuple=n,ao.default=o,ao}var io,co={};var lo,uo={};function po(){if(lo)return uo;lo=1,Object.defineProperty(uo,"__esModule",{value:!0});const e=tt(),t=nt(),r={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:r}})=>void 0===r?e.str`must contain at least ${t} valid item(s)`:e.str`must contain at least ${t} and no more than ${r} valid item(s)`,params:({params:{min:t,max:r}})=>void 0===r?e._`{minContains: ${t}}`:e._`{minContains: ${t}, maxContains: ${r}}`},code(r){const{gen:o,schema:n,parentSchema:a,data:s,it:i}=r;let c,d;const{minContains:l,maxContains:u}=a;i.opts.next?(c=void 0===l?1:l,d=u):c=1;const p=o.const("len",e._`${s}.length`);if(r.setParams({min:c,max:d}),void 0===d&&0===c)return void(0,t.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==d&&c>d)return(0,t.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),void r.fail();if((0,t.alwaysValidSchema)(i,n)){let t=e._`${p} >= ${c}`;return void 0!==d&&(t=e._`${t} && ${p} <= ${d}`),void r.pass(t)}i.items=!0;const f=o.name("valid");function m(){const t=o.name("_valid"),r=o.let("count",0);h(t,()=>o.if(t,()=>function(t){o.code(e._`${t}++`),void 0===d?o.if(e._`${t} >= ${c}`,()=>o.assign(f,!0).break()):(o.if(e._`${t} > ${d}`,()=>o.assign(f,!1).break()),1===c?o.assign(f,!0):o.if(e._`${t} >= ${c}`,()=>o.assign(f,!0)))}(r)))}function h(e,n){o.forRange("i",0,p,o=>{r.subschema({keyword:"contains",dataProp:o,dataPropType:t.Type.Num,compositeRule:!0},e),n()})}void 0===d&&1===c?h(f,()=>o.if(f,()=>o.break())):0===c?(o.let(f,!0),void 0!==d&&o.if(e._`${s}.length > 0`,m)):(o.let(f,!1),m()),r.result(f,()=>r.reset())}};return uo.default=r,uo}var fo,mo={};function ho(){return fo||(fo=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=tt(),r=nt(),o=Et();e.error={message:({params:{property:e,depsCount:r,deps:o}})=>{const n=1===r?"property":"properties";return t.str`must have ${n} ${o} when property ${e} is present`},params:({params:{property:e,depsCount:r,deps:o,missingProperty:n}})=>t._`{property: ${e},
4
+ || ${c} === "boolean" || ${a} === null`).assign(l,o._`[${a}]`)}}n.else(),u(e),n.endIf(),n.if(o._`${l} !== undefined`,()=>{n.assign(a,l),function({gen:e,parentData:t,parentDataProperty:r},n){e.if(o._`${t} !== undefined`,()=>e.assign(o._`${t}[${r}]`,n))}(e,l)})}(e,r,l):u(e)})}return p};const i=new Set(["string","number","integer","boolean","null"]);function c(e,t,r,n=a.Correct){const s=n===a.Correct?o.operators.EQ:o.operators.NEQ;let i;switch(e){case"null":return o._`${t} ${s} null`;case"array":i=o._`Array.isArray(${t})`;break;case"object":i=o._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":i=c(o._`!(${t} % 1) && !isNaN(${t})`);break;case"number":i=c();break;default:return o._`typeof ${t} ${s} ${e}`}return n===a.Correct?i:(0,o.not)(i);function c(e=o.nil){return(0,o.and)(o._`typeof ${t} == "number"`,e,r?o._`isFinite(${t})`:o.nil)}}function d(e,t,r,a){if(1===e.length)return c(e[0],t,r,a);let s;const i=(0,n.toHash)(e);if(i.array&&i.object){const e=o._`typeof ${t} != "object"`;s=i.null?e:o._`!${t} || ${e}`,delete i.null,delete i.array,delete i.object}else s=o.nil;i.number&&delete i.integer;for(const e in i)s=(0,o.and)(s,c(e,t,r,a));return s}ut.checkDataType=c,ut.checkDataTypes=d;const l={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?o._`{type: ${e}}`:o._`{type: ${t}}`};function u(e){const t=function(e){const{gen:t,data:r,schema:o}=e,a=(0,n.schemaRefOrVal)(e,o,"type");return{gen:t,keyword:"type",data:r,schema:o.type,schemaCode:a,schemaValue:a,parentSchema:o,params:{},it:e}}(e);(0,r.reportError)(t,l)}return ut.reportTypeError=u,ut}var bt,$t={};var wt,_t,kt={},Pt={};function Et(){if(wt)return Pt;wt=1,Object.defineProperty(Pt,"__esModule",{value:!0}),Pt.validateUnion=Pt.validateArray=Pt.usePattern=Pt.callValidateCode=Pt.schemaProperties=Pt.allSchemaProperties=Pt.noPropertyInData=Pt.propertyInData=Pt.isOwnProperty=Pt.hasPropFunc=Pt.reportMissingProp=Pt.checkMissingProp=Pt.checkReportMissingProp=void 0;const e=et(),t=ot(),r=ct(),o=ot();function n(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:e._`Object.prototype.hasOwnProperty`})}function a(t,r,o){return e._`${n(t)}.call(${r}, ${o})`}function s(t,r,o,n){const s=e._`${r}${(0,e.getProperty)(o)} === undefined`;return n?(0,e.or)(s,(0,e.not)(a(t,r,o))):s}function i(e){return e?Object.keys(e).filter(e=>"__proto__"!==e):[]}Pt.checkReportMissingProp=function(t,r){const{gen:o,data:n,it:a}=t;o.if(s(o,n,r,a.opts.ownProperties),()=>{t.setParams({missingProperty:e._`${r}`},!0),t.error()})},Pt.checkMissingProp=function({gen:t,data:r,it:{opts:o}},n,a){return(0,e.or)(...n.map(n=>(0,e.and)(s(t,r,n,o.ownProperties),e._`${a} = ${n}`)))},Pt.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},Pt.hasPropFunc=n,Pt.isOwnProperty=a,Pt.propertyInData=function(t,r,o,n){const s=e._`${r}${(0,e.getProperty)(o)} !== undefined`;return n?e._`${s} && ${a(t,r,o)}`:s},Pt.noPropertyInData=s,Pt.allSchemaProperties=i,Pt.schemaProperties=function(e,r){return i(r).filter(o=>!(0,t.alwaysValidSchema)(e,r[o]))},Pt.callValidateCode=function({schemaCode:t,data:o,it:{gen:n,topSchemaRef:a,schemaPath:s,errorPath:i},it:c},d,l,u){const p=u?e._`${t}, ${o}, ${a}${s}`:o,f=[[r.default.instancePath,(0,e.strConcat)(r.default.instancePath,i)],[r.default.parentData,c.parentData],[r.default.parentDataProperty,c.parentDataProperty],[r.default.rootData,r.default.rootData]];c.opts.dynamicRef&&f.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);const m=e._`${p}, ${n.object(...f)}`;return l!==e.nil?e._`${d}.call(${l}, ${m})`:e._`${d}(${m})`};const c=e._`new RegExp`;return Pt.usePattern=function({gen:t,it:{opts:r}},n){const a=r.unicodeRegExp?"u":"",{regExp:s}=r.code,i=s(n,a);return t.scopeValue("pattern",{key:i.toString(),ref:i,code:e._`${"new RegExp"===s.code?c:(0,o.useFunc)(t,s)}(${n}, ${a})`})},Pt.validateArray=function(r){const{gen:o,data:n,keyword:a,it:s}=r,i=o.name("valid");if(s.allErrors){const e=o.let("valid",!0);return c(()=>o.assign(e,!1)),e}return o.var(i,!0),c(()=>o.break()),i;function c(s){const c=o.const("len",e._`${n}.length`);o.forRange("i",0,c,n=>{r.subschema({keyword:a,dataProp:n,dataPropType:t.Type.Num},i),o.if((0,e.not)(i),s)})}},Pt.validateUnion=function(r){const{gen:o,schema:n,keyword:a,it:s}=r;if(!Array.isArray(n))throw new Error("ajv implementation error");if(n.some(e=>(0,t.alwaysValidSchema)(s,e))&&!s.opts.unevaluated)return;const i=o.let("valid",!1),c=o.name("_valid");o.block(()=>n.forEach((t,n)=>{const s=r.subschema({keyword:a,schemaProp:n,compositeRule:!0},c);o.assign(i,e._`${i} || ${c}`);r.mergeValidEvaluated(s,c)||o.if((0,e.not)(i))})),r.result(i,()=>r.reset(),()=>r.error(!0))},Pt}function St(){if(_t)return kt;_t=1,Object.defineProperty(kt,"__esModule",{value:!0}),kt.validateKeywordUsage=kt.validSchemaType=kt.funcKeywordCode=kt.macroKeywordCode=void 0;const e=et(),t=ct(),r=Et(),o=dt();function n(t){const{gen:r,data:o,it:n}=t;r.if(n.parentData,()=>r.assign(o,e._`${n.parentData}[${n.parentDataProperty}]`))}function a(t,r,o){if(void 0===o)throw new Error(`keyword "${r}" failed to compile`);return t.scopeValue("keyword","function"==typeof o?{ref:o}:{ref:o,code:(0,e.stringify)(o)})}return kt.macroKeywordCode=function(t,r){const{gen:o,keyword:n,schema:s,parentSchema:i,it:c}=t,d=r.macro.call(c.self,s,i,c),l=a(o,n,d);!1!==c.opts.validateSchema&&c.self.validateSchema(d,!0);const u=o.name("valid");t.subschema({schema:d,schemaPath:e.nil,errSchemaPath:`${c.errSchemaPath}/${n}`,topSchemaRef:l,compositeRule:!0},u),t.pass(u,()=>t.error(!0))},kt.funcKeywordCode=function(s,i){var c;const{gen:d,keyword:l,schema:u,parentSchema:p,$data:f,it:m}=s;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(m,i);const h=!f&&i.compile?i.compile.call(m.self,u,p,m):i.validate,g=a(d,l,h),y=d.let("valid");function v(o=(i.async?e._`await `:e.nil)){const n=m.opts.passContext?t.default.this:t.default.self,a=!("compile"in i&&!f||!1===i.schema);d.assign(y,e._`${o}${(0,r.callValidateCode)(s,g,n,a)}`,i.modifying)}function b(t){var r;d.if((0,e.not)(null!==(r=i.valid)&&void 0!==r?r:y),t)}s.block$data(y,function(){if(!1===i.errors)v(),i.modifying&&n(s),b(()=>s.error());else{const r=i.async?function(){const t=d.let("ruleErrs",null);return d.try(()=>v(e._`await `),r=>d.assign(y,!1).if(e._`${r} instanceof ${m.ValidationError}`,()=>d.assign(t,e._`${r}.errors`),()=>d.throw(r))),t}():function(){const t=e._`${g}.errors`;return d.assign(t,null),v(e.nil),t}();i.modifying&&n(s),b(()=>function(r,n){const{gen:a}=r;a.if(e._`Array.isArray(${n})`,()=>{a.assign(t.default.vErrors,e._`${t.default.vErrors} === null ? ${n} : ${t.default.vErrors}.concat(${n})`).assign(t.default.errors,e._`${t.default.vErrors}.length`),(0,o.extendErrors)(r)},()=>r.error())}(s,r))}}),s.ok(null!==(c=i.valid)&&void 0!==c?c:y)},kt.validSchemaType=function(e,t,r=!1){return!t.length||t.some(t=>"array"===t?Array.isArray(e):"object"===t?e&&"object"==typeof e&&!Array.isArray(e):typeof e==t||r&&void 0===e)},kt.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:o},n,a){if(Array.isArray(n.keyword)?!n.keyword.includes(a):n.keyword!==a)throw new Error("ajv implementation error");const s=n.dependencies;if(null==s?void 0:s.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw new Error(`parent schema must have dependencies of ${a}: ${s.join(",")}`);if(n.validateSchema){if(!n.validateSchema(e[a])){const e=`keyword "${a}" value is invalid at path "${o}": `+r.errorsText(n.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);r.logger.error(e)}}},kt}var jt,Nt={};var It,Ot,Tt={};function xt(){return Ot||(Ot=1,It=function e(t,r){if(t===r)return!0;if(t&&r&&"object"==typeof t&&"object"==typeof r){if(t.constructor!==r.constructor)return!1;var o,n,a;if(Array.isArray(t)){if((o=t.length)!=r.length)return!1;for(n=o;0!==n--;)if(!e(t[n],r[n]))return!1;return!0}if(t.constructor===RegExp)return t.source===r.source&&t.flags===r.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===r.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===r.toString();if((o=(a=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(n=o;0!==n--;)if(!Object.prototype.hasOwnProperty.call(r,a[n]))return!1;for(n=o;0!==n--;){var s=a[n];if(!e(t[s],r[s]))return!1}return!0}return t!=t&&r!=r}),It}var Ct,Rt,At,Mt={exports:{}};function Dt(){if(Ct)return Mt.exports;Ct=1;var e=Mt.exports=function(e,r,o){"function"==typeof r&&(o=r,r={}),t(r,"function"==typeof(o=r.cb||o)?o:o.pre||function(){},o.post||function(){},e,"",e)};function t(o,n,a,s,i,c,d,l,u,p){if(s&&"object"==typeof s&&!Array.isArray(s)){for(var f in n(s,i,c,d,l,u,p),s){var m=s[f];if(Array.isArray(m)){if(f in e.arrayKeywords)for(var h=0;h<m.length;h++)t(o,n,a,m[h],i+"/"+f+"/"+h,c,i,f,s,h)}else if(f in e.propsKeywords){if(m&&"object"==typeof m)for(var g in m)t(o,n,a,m[g],i+"/"+f+"/"+r(g),c,i,f,s,g)}else(f in e.keywords||o.allKeys&&!(f in e.skipKeywords))&&t(o,n,a,m,i+"/"+f,c,i,f,s)}a(s,i,c,d,l,u,p)}}function r(e){return e.replace(/~/g,"~0").replace(/\//g,"~1")}return e.keywords={additionalItems:!0,items:!0,contains:!0,additionalProperties:!0,propertyNames:!0,not:!0,if:!0,then:!0,else:!0},e.arrayKeywords={items:!0,allOf:!0,anyOf:!0,oneOf:!0},e.propsKeywords={$defs:!0,definitions:!0,properties:!0,patternProperties:!0,dependencies:!0},e.skipKeywords={default:!0,enum:!0,const:!0,required:!0,maximum:!0,minimum:!0,exclusiveMaximum:!0,exclusiveMinimum:!0,multipleOf:!0,maxLength:!0,minLength:!0,pattern:!0,format:!0,maxItems:!0,minItems:!0,uniqueItems:!0,maxProperties:!0,minProperties:!0},Mt.exports}function Ft(){if(Rt)return Tt;Rt=1,Object.defineProperty(Tt,"__esModule",{value:!0}),Tt.getSchemaRefs=Tt.resolveUrl=Tt.normalizeId=Tt._getFullPath=Tt.getFullPath=Tt.inlineRef=void 0;const e=ot(),t=xt(),r=Dt(),o=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);Tt.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!a(e):!!t&&s(e)<=t)};const n=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function a(e){for(const t in e){if(n.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some(a))return!0;if("object"==typeof r&&a(r))return!0}return!1}function s(t){let r=0;for(const n in t){if("$ref"===n)return 1/0;if(r++,!o.has(n)&&("object"==typeof t[n]&&(0,e.eachItem)(t[n],e=>r+=s(e)),r===1/0))return 1/0}return r}function i(e,t="",r){!1!==r&&(t=l(t));const o=e.parse(t);return c(e,o)}function c(e,t){return e.serialize(t).split("#")[0]+"#"}Tt.getFullPath=i,Tt._getFullPath=c;const d=/#\/?$/;function l(e){return e?e.replace(d,""):""}Tt.normalizeId=l,Tt.resolveUrl=function(e,t,r){return r=l(r),e.resolve(t,r)};const u=/^[a-z_][-a-z0-9._]*$/i;return Tt.getSchemaRefs=function(e,o){if("boolean"==typeof e)return{};const{schemaId:n,uriResolver:a}=this.opts,s=l(e[n]||o),c={"":s},d=i(a,s,!1),p={},f=new Set;return r(e,{allKeys:!0},(e,t,r,o)=>{if(void 0===o)return;const a=d+t;let s=c[o];function i(t){const r=this.opts.uriResolver.resolve;if(t=l(s?r(s,t):t),f.has(t))throw h(t);f.add(t);let o=this.refs[t];return"string"==typeof o&&(o=this.refs[o]),"object"==typeof o?m(e,o.schema,t):t!==l(a)&&("#"===t[0]?(m(e,p[t],t),p[t]=e):this.refs[t]=a),t}function g(e){if("string"==typeof e){if(!u.test(e))throw new Error(`invalid anchor "${e}"`);i.call(this,`#${e}`)}}"string"==typeof e[n]&&(s=i.call(this,e[n])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),c[t]=s}),p;function m(e,r,o){if(void 0!==r&&!t(e,r))throw h(o)}function h(e){return new Error(`reference "${e}" resolves to more than one schema`)}},Tt}function Vt(){if(At)return Le;At=1,Object.defineProperty(Le,"__esModule",{value:!0}),Le.getData=Le.KeywordCxt=Le.validateFunctionCode=void 0;const e=function(){if(st)return Be;st=1,Object.defineProperty(Be,"__esModule",{value:!0}),Be.boolOrEmptySchema=Be.topBoolOrEmptySchema=void 0;const e=dt(),t=et(),r=ct(),o={message:"boolean schema is false"};function n(t,r){const{gen:n,data:a}=t,s={gen:n,keyword:"false schema",data:a,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,e.reportError)(s,o,void 0,r)}return Be.topBoolOrEmptySchema=function(e){const{gen:o,schema:a,validateName:s}=e;!1===a?n(e,!1):"object"==typeof a&&!0===a.$async?o.return(r.default.data):(o.assign(t._`${s}.errors`,null),o.return(!0))},Be.boolOrEmptySchema=function(e,t){const{gen:r,schema:o}=e;!1===o?(r.var(t,!1),n(e)):r.var(t,!0)},Be}(),t=vt(),r=yt(),o=vt(),n=function(){if(bt)return $t;bt=1,Object.defineProperty($t,"__esModule",{value:!0}),$t.assignDefaults=void 0;const e=et(),t=ot();function r(r,o,n){const{gen:a,compositeRule:s,data:i,opts:c}=r;if(void 0===n)return;const d=e._`${i}${(0,e.getProperty)(o)}`;if(s)return void(0,t.checkStrictMode)(r,`default is ignored for: ${d}`);let l=e._`${d} === undefined`;"empty"===c.useDefaults&&(l=e._`${l} || ${d} === null || ${d} === ""`),a.if(l,e._`${d} = ${(0,e.stringify)(n)}`)}return $t.assignDefaults=function(e,t){const{properties:o,items:n}=e.schema;if("object"===t&&o)for(const t in o)r(e,t,o[t].default);else"array"===t&&Array.isArray(n)&&n.forEach((t,o)=>r(e,o,t.default))},$t}(),a=St(),s=function(){if(jt)return Nt;jt=1,Object.defineProperty(Nt,"__esModule",{value:!0}),Nt.extendSubschemaMode=Nt.extendSubschemaData=Nt.getSubschema=void 0;const e=et(),t=ot();return Nt.getSubschema=function(r,{keyword:o,schemaProp:n,schema:a,schemaPath:s,errSchemaPath:i,topSchemaRef:c}){if(void 0!==o&&void 0!==a)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==o){const a=r.schema[o];return void 0===n?{schema:a,schemaPath:e._`${r.schemaPath}${(0,e.getProperty)(o)}`,errSchemaPath:`${r.errSchemaPath}/${o}`}:{schema:a[n],schemaPath:e._`${r.schemaPath}${(0,e.getProperty)(o)}${(0,e.getProperty)(n)}`,errSchemaPath:`${r.errSchemaPath}/${o}/${(0,t.escapeFragment)(n)}`}}if(void 0!==a){if(void 0===s||void 0===i||void 0===c)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:a,schemaPath:s,topSchemaRef:c,errSchemaPath:i}}throw new Error('either "keyword" or "schema" must be passed')},Nt.extendSubschemaData=function(r,o,{dataProp:n,dataPropType:a,data:s,dataTypes:i,propertyName:c}){if(void 0!==s&&void 0!==n)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:d}=o;if(void 0!==n){const{errorPath:s,dataPathArr:i,opts:c}=o;l(d.let("data",e._`${o.data}${(0,e.getProperty)(n)}`,!0)),r.errorPath=e.str`${s}${(0,t.getErrorPath)(n,a,c.jsPropertySyntax)}`,r.parentDataProperty=e._`${n}`,r.dataPathArr=[...i,r.parentDataProperty]}function l(e){r.data=e,r.dataLevel=o.dataLevel+1,r.dataTypes=[],o.definedProperties=new Set,r.parentData=o.data,r.dataNames=[...o.dataNames,e]}void 0!==s&&(l(s instanceof e.Name?s:d.let("data",s,!0)),void 0!==c&&(r.propertyName=c)),i&&(r.dataTypes=i)},Nt.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:o,createErrors:n,allErrors:a}){void 0!==o&&(e.compositeRule=o),void 0!==n&&(e.createErrors=n),void 0!==a&&(e.allErrors=a),e.jtdDiscriminator=t,e.jtdMetadata=r},Nt}(),i=et(),c=ct(),d=Ft(),l=ot(),u=dt();function p({gen:e,validateName:t,schema:r,schemaEnv:o,opts:n},a){n.code.es5?e.func(t,i._`${c.default.data}, ${c.default.valCxt}`,o.$async,()=>{e.code(i._`"use strict"; ${f(r,n)}`),function(e,t){e.if(c.default.valCxt,()=>{e.var(c.default.instancePath,i._`${c.default.valCxt}.${c.default.instancePath}`),e.var(c.default.parentData,i._`${c.default.valCxt}.${c.default.parentData}`),e.var(c.default.parentDataProperty,i._`${c.default.valCxt}.${c.default.parentDataProperty}`),e.var(c.default.rootData,i._`${c.default.valCxt}.${c.default.rootData}`),t.dynamicRef&&e.var(c.default.dynamicAnchors,i._`${c.default.valCxt}.${c.default.dynamicAnchors}`)},()=>{e.var(c.default.instancePath,i._`""`),e.var(c.default.parentData,i._`undefined`),e.var(c.default.parentDataProperty,i._`undefined`),e.var(c.default.rootData,c.default.data),t.dynamicRef&&e.var(c.default.dynamicAnchors,i._`{}`)})}(e,n),e.code(a)}):e.func(t,i._`${c.default.data}, ${function(e){return i._`{${c.default.instancePath}="", ${c.default.parentData}, ${c.default.parentDataProperty}, ${c.default.rootData}=${c.default.data}${e.dynamicRef?i._`, ${c.default.dynamicAnchors}={}`:i.nil}}={}`}(n)}`,o.$async,()=>e.code(f(r,n)).code(a))}function f(e,t){const r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?i._`/*# sourceURL=${r} */`:i.nil}function m(t,r){g(t)&&(y(t),h(t))?function(e,t){const{schema:r,gen:o,opts:n}=e;n.$comment&&r.$comment&&b(e);(function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,d.resolveUrl)(e.opts.uriResolver,e.baseId,t))})(e),function(e){if(e.schema.$async&&!e.schemaEnv.$async)throw new Error("async schema in sync schema")}(e);const a=o.const("_errs",c.default.errors);v(e,a),o.var(t,i._`${a} === ${c.default.errors}`)}(t,r):(0,e.boolOrEmptySchema)(t,r)}function h({schema:e,self:t}){if("boolean"==typeof e)return!e;for(const r in e)if(t.RULES.all[r])return!0;return!1}function g(e){return"boolean"!=typeof e.schema}function y(e){(0,l.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:r,opts:o,self:n}=e;t.$ref&&o.ignoreKeywordsWithRef&&(0,l.schemaHasRulesButRef)(t,n.RULES)&&n.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function v(e,r){if(e.opts.jtd)return $(e,[],!1,r);const o=(0,t.getSchemaTypes)(e.schema);$(e,o,!(0,t.coerceAndCheckDataType)(e,o),r)}function b({gen:e,schemaEnv:t,schema:r,errSchemaPath:o,opts:n}){const a=r.$comment;if(!0===n.$comment)e.code(i._`${c.default.self}.logger.log(${a})`);else if("function"==typeof n.$comment){const r=i.str`${o}/$comment`,n=e.scopeValue("root",{ref:t.root});e.code(i._`${c.default.self}.opts.$comment(${a}, ${r}, ${n}.schema)`)}}function $(e,t,n,a){const{gen:s,schema:d,data:u,allErrors:p,opts:f,self:m}=e,{RULES:h}=m;function g(l){(0,r.shouldUseGroup)(d,l)&&(l.type?(s.if((0,o.checkDataType)(l.type,u,f.strictNumbers)),w(e,l),1===t.length&&t[0]===l.type&&n&&(s.else(),(0,o.reportTypeError)(e)),s.endIf()):w(e,l),p||s.if(i._`${c.default.errors} === ${a||0}`))}!d.$ref||!f.ignoreKeywordsWithRef&&(0,l.schemaHasRulesButRef)(d,h)?(f.jtd||function(e,t){if(e.schemaEnv.meta||!e.opts.strictTypes)return;(function(e,t){if(!t.length)return;if(!e.dataTypes.length)return void(e.dataTypes=t);t.forEach(t=>{k(e.dataTypes,t)||P(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),function(e,t){const r=[];for(const o of e.dataTypes)k(t,o)?r.push(o):t.includes("integer")&&"number"===o&&r.push("integer");e.dataTypes=r}(e,t)})(e,t),e.opts.allowUnionTypes||function(e,t){t.length>1&&(2!==t.length||!t.includes("null"))&&P(e,"use allowUnionTypes to allow union type keyword")}(e,t);!function(e,t){const o=e.self.RULES.all;for(const n in o){const a=o[n];if("object"==typeof a&&(0,r.shouldUseRule)(e.schema,a)){const{type:r}=a.definition;r.length&&!r.some(e=>_(t,e))&&P(e,`missing type "${r.join(",")}" for keyword "${n}"`)}}}(e,e.dataTypes)}(e,t),s.block(()=>{for(const e of h.rules)g(e);g(h.post)})):s.block(()=>S(e,"$ref",h.all.$ref.definition))}function w(e,t){const{gen:o,schema:a,opts:{useDefaults:s}}=e;s&&(0,n.assignDefaults)(e,t.type),o.block(()=>{for(const o of t.rules)(0,r.shouldUseRule)(a,o)&&S(e,o.keyword,o.definition,t.type)})}function _(e,t){return e.includes(t)||"number"===t&&e.includes("integer")}function k(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function P(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,l.checkStrictMode)(e,t,e.opts.strictTypes)}Le.validateFunctionCode=function(t){g(t)&&(y(t),h(t))?function(e){const{schema:t,opts:r,gen:o}=e;p(e,()=>{r.$comment&&t.$comment&&b(e),function(e){const{schema:t,opts:r}=e;void 0!==t.default&&r.useDefaults&&r.strictSchema&&(0,l.checkStrictMode)(e,"default is ignored in the schema root")}(e),o.let(c.default.vErrors,null),o.let(c.default.errors,0),r.unevaluated&&function(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",i._`${r}.evaluated`),t.if(i._`${e.evaluated}.dynamicProps`,()=>t.assign(i._`${e.evaluated}.props`,i._`undefined`)),t.if(i._`${e.evaluated}.dynamicItems`,()=>t.assign(i._`${e.evaluated}.items`,i._`undefined`))}(e),v(e),function(e){const{gen:t,schemaEnv:r,validateName:o,ValidationError:n,opts:a}=e;r.$async?t.if(i._`${c.default.errors} === 0`,()=>t.return(c.default.data),()=>t.throw(i._`new ${n}(${c.default.vErrors})`)):(t.assign(i._`${o}.errors`,c.default.vErrors),a.unevaluated&&function({gen:e,evaluated:t,props:r,items:o}){r instanceof i.Name&&e.assign(i._`${t}.props`,r);o instanceof i.Name&&e.assign(i._`${t}.items`,o)}(e),t.return(i._`${c.default.errors} === 0`))}(e)})}(t):p(t,()=>(0,e.topBoolOrEmptySchema)(t))};class E{constructor(e,t,r){if((0,a.validateKeywordUsage)(e,t,r),this.gen=e.gen,this.allErrors=e.allErrors,this.keyword=r,this.data=e.data,this.schema=e.schema[r],this.$data=t.$data&&e.opts.$data&&this.schema&&this.schema.$data,this.schemaValue=(0,l.schemaRefOrVal)(e,this.schema,r,this.$data),this.schemaType=t.schemaType,this.parentSchema=e.schema,this.params={},this.it=e,this.def=t,this.$data)this.schemaCode=e.gen.const("vSchema",I(this.$data,e));else if(this.schemaCode=this.schemaValue,!(0,a.validSchemaType)(this.schema,t.schemaType,t.allowUndefined))throw new Error(`${r} value must be ${JSON.stringify(t.schemaType)}`);("code"in t?t.trackErrors:!1!==t.errors)&&(this.errsCount=e.gen.const("_errs",c.default.errors))}result(e,t,r){this.failResult((0,i.not)(e),t,r)}failResult(e,t,r){this.gen.if(e),r?r():this.error(),t?(this.gen.else(),t(),this.allErrors&&this.gen.endIf()):this.allErrors?this.gen.endIf():this.gen.else()}pass(e,t){this.failResult((0,i.not)(e),void 0,t)}fail(e){if(void 0===e)return this.error(),void(this.allErrors||this.gen.if(!1));this.gen.if(e),this.error(),this.allErrors?this.gen.endIf():this.gen.else()}fail$data(e){if(!this.$data)return this.fail(e);const{schemaCode:t}=this;this.fail(i._`${t} !== undefined && (${(0,i.or)(this.invalid$data(),e)})`)}error(e,t,r){if(t)return this.setParams(t),this._error(e,r),void this.setParams({});this._error(e,r)}_error(e,t){(e?u.reportExtraError:u.reportError)(this,this.def.error,t)}$dataError(){(0,u.reportError)(this,this.def.$dataError||u.keyword$DataError)}reset(){if(void 0===this.errsCount)throw new Error('add "trackErrors" to keyword definition');(0,u.resetErrorsCount)(this.gen,this.errsCount)}ok(e){this.allErrors||this.gen.if(e)}setParams(e,t){t?Object.assign(this.params,e):this.params=e}block$data(e,t,r=i.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=i.nil,t=i.nil){if(!this.$data)return;const{gen:r,schemaCode:o,schemaType:n,def:a}=this;r.if((0,i.or)(i._`${o} === undefined`,t)),e!==i.nil&&r.assign(e,!0),(n.length||a.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==i.nil&&r.assign(e,!1)),r.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:r,def:n,it:a}=this;return(0,i.or)(function(){if(r.length){if(!(t instanceof i.Name))throw new Error("ajv implementation error");const e=Array.isArray(r)?r:[r];return i._`${(0,o.checkDataTypes)(e,t,a.opts.strictNumbers,o.DataType.Wrong)}`}return i.nil}(),function(){if(n.validateSchema){const r=e.scopeValue("validate$data",{ref:n.validateSchema});return i._`!${r}(${t})`}return i.nil}())}subschema(e,t){const r=(0,s.getSubschema)(this.it,e);(0,s.extendSubschemaData)(r,this.it,e),(0,s.extendSubschemaMode)(r,e);const o={...this.it,...r,items:void 0,props:void 0};return m(o,t),o}mergeEvaluated(e,t){const{it:r,gen:o}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=l.mergeEvaluated.props(o,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=l.mergeEvaluated.items(o,e.items,r.items,t)))}mergeValidEvaluated(e,t){const{it:r,gen:o}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return o.if(t,()=>this.mergeEvaluated(e,i.Name)),!0}}function S(e,t,r,o){const n=new E(e,r,t);"code"in r?r.code(n,o):n.$data&&r.validate?(0,a.funcKeywordCode)(n,r):"macro"in r?(0,a.macroKeywordCode)(n,r):(r.compile||r.validate)&&(0,a.funcKeywordCode)(n,r)}Le.KeywordCxt=E;const j=/^\/(?:[^~]|~0|~1)*$/,N=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function I(e,{dataLevel:t,dataNames:r,dataPathArr:o}){let n,a;if(""===e)return c.default.rootData;if("/"===e[0]){if(!j.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);n=e,a=c.default.rootData}else{const s=N.exec(e);if(!s)throw new Error(`Invalid JSON-pointer: ${e}`);const i=+s[1];if(n=s[2],"#"===n){if(i>=t)throw new Error(u("property/index",i));return o[t-i]}if(i>t)throw new Error(u("data",i));if(a=r[t-i],!n)return a}let s=a;const d=n.split("/");for(const e of d)e&&(a=i._`${a}${(0,i.getProperty)((0,l.unescapeJsonPointer)(e))}`,s=i._`${s} && ${a}`);return s;function u(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}return Le.getData=I,Le}var zt,Ut={};function qt(){if(zt)return Ut;zt=1,Object.defineProperty(Ut,"__esModule",{value:!0});class e extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}return Ut.default=e,Ut}var Kt,Lt={};function Bt(){if(Kt)return Lt;Kt=1,Object.defineProperty(Lt,"__esModule",{value:!0});const e=Ft();class t extends Error{constructor(t,r,o,n){super(n||`can't resolve reference ${o} from id ${r}`),this.missingRef=(0,e.resolveUrl)(t,r,o),this.missingSchema=(0,e.normalizeId)((0,e.getFullPath)(t,this.missingRef))}}return Lt.default=t,Lt}var Ht,Gt={};function Jt(){if(Ht)return Gt;Ht=1,Object.defineProperty(Gt,"__esModule",{value:!0}),Gt.resolveSchema=Gt.getCompilingSchema=Gt.resolveRef=Gt.compileSchema=Gt.SchemaEnv=void 0;const e=et(),t=qt(),r=ct(),o=Ft(),n=ot(),a=Vt();class s{constructor(e){var t;let r;this.refs={},this.dynamicAnchors={},"object"==typeof e.schema&&(r=e.schema),this.schema=e.schema,this.schemaId=e.schemaId,this.root=e.root||this,this.baseId=null!==(t=e.baseId)&&void 0!==t?t:(0,o.normalizeId)(null==r?void 0:r[e.schemaId||"$id"]),this.schemaPath=e.schemaPath,this.localRefs=e.localRefs,this.meta=e.meta,this.$async=null==r?void 0:r.$async,this.refs={}}}function i(n){const s=d.call(this,n);if(s)return s;const i=(0,o.getFullPath)(this.opts.uriResolver,n.root.baseId),{es5:c,lines:l}=this.opts.code,{ownProperties:u}=this.opts,p=new e.CodeGen(this.scope,{es5:c,lines:l,ownProperties:u});let f;n.$async&&(f=p.scopeValue("Error",{ref:t.default,code:e._`require("ajv/dist/runtime/validation_error").default`}));const m=p.scopeName("validate");n.validateName=m;const h={gen:p,allErrors:this.opts.allErrors,data:r.default.data,parentData:r.default.parentData,parentDataProperty:r.default.parentDataProperty,dataNames:[r.default.data],dataPathArr:[e.nil],dataLevel:0,dataTypes:[],definedProperties:new Set,topSchemaRef:p.scopeValue("schema",!0===this.opts.code.source?{ref:n.schema,code:(0,e.stringify)(n.schema)}:{ref:n.schema}),validateName:m,ValidationError:f,schema:n.schema,schemaEnv:n,rootId:i,baseId:n.baseId||i,schemaPath:e.nil,errSchemaPath:n.schemaPath||(this.opts.jtd?"":"#"),errorPath:e._`""`,opts:this.opts,self:this};let g;try{this._compilations.add(n),(0,a.validateFunctionCode)(h),p.optimize(this.opts.code.optimize);const t=p.toString();g=`${p.scopeRefs(r.default.scope)}return ${t}`,this.opts.code.process&&(g=this.opts.code.process(g,n));const o=new Function(`${r.default.self}`,`${r.default.scope}`,g)(this,this.scope.get());if(this.scope.value(m,{ref:o}),o.errors=null,o.schema=n.schema,o.schemaEnv=n,n.$async&&(o.$async=!0),!0===this.opts.code.source&&(o.source={validateName:m,validateCode:t,scopeValues:p._values}),this.opts.unevaluated){const{props:t,items:r}=h;o.evaluated={props:t instanceof e.Name?void 0:t,items:r instanceof e.Name?void 0:r,dynamicProps:t instanceof e.Name,dynamicItems:r instanceof e.Name},o.source&&(o.source.evaluated=(0,e.stringify)(o.evaluated))}return n.validate=o,n}catch(e){throw delete n.validate,delete n.validateName,g&&this.logger.error("Error compiling schema, function code:",g),e}finally{this._compilations.delete(n)}}function c(e){return(0,o.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:i.call(this,e)}function d(e){for(const t of this._compilations)if(l(t,e))return t}function l(e,t){return e.schema===t.schema&&e.root===t.root&&e.baseId===t.baseId}function u(e,t){let r;for(;"string"==typeof(r=this.refs[t]);)t=r;return r||this.schemas[t]||p.call(this,e,t)}function p(e,t){const r=this.opts.uriResolver.parse(t),n=(0,o._getFullPath)(this.opts.uriResolver,r);let a=(0,o.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&n===a)return m.call(this,r,e);const c=(0,o.normalizeId)(n),d=this.refs[c]||this.schemas[c];if("string"==typeof d){const t=p.call(this,e,d);if("object"!=typeof(null==t?void 0:t.schema))return;return m.call(this,r,t)}if("object"==typeof(null==d?void 0:d.schema)){if(d.validate||i.call(this,d),c===(0,o.normalizeId)(t)){const{schema:t}=d,{schemaId:r}=this.opts,n=t[r];return n&&(a=(0,o.resolveUrl)(this.opts.uriResolver,a,n)),new s({schema:t,schemaId:r,root:e,baseId:a})}return m.call(this,r,d)}}Gt.SchemaEnv=s,Gt.compileSchema=i,Gt.resolveRef=function(e,t,r){var n;r=(0,o.resolveUrl)(this.opts.uriResolver,t,r);const a=e.refs[r];if(a)return a;let i=u.call(this,e,r);if(void 0===i){const o=null===(n=e.localRefs)||void 0===n?void 0:n[r],{schemaId:a}=this.opts;o&&(i=new s({schema:o,schemaId:a,root:e,baseId:t}))}return void 0!==i?e.refs[r]=c.call(this,i):void 0},Gt.getCompilingSchema=d,Gt.resolveSchema=p;const f=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function m(e,{baseId:t,schema:r,root:a}){var i;if("/"!==(null===(i=e.fragment)||void 0===i?void 0:i[0]))return;for(const a of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;const e=r[(0,n.unescapeFragment)(a)];if(void 0===e)return;const s="object"==typeof(r=e)&&r[this.opts.schemaId];!f.has(a)&&s&&(t=(0,o.resolveUrl)(this.opts.uriResolver,t,s))}let c;if("boolean"!=typeof r&&r.$ref&&!(0,n.schemaHasRulesButRef)(r,this.RULES)){const e=(0,o.resolveUrl)(this.opts.uriResolver,t,r.$ref);c=p.call(this,a,e)}const{schemaId:d}=this.opts;return c=c||new s({schema:r,schemaId:d,root:a,baseId:t}),c.schema!==c.root.schema?c:void 0}return Gt}var Wt,Yt,Qt,Xt,Zt,er,tr,rr,or,nr={$id:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",description:"Meta-schema for $data reference (JSON AnySchema extension proposal)",type:"object",required:["$data"],properties:{$data:{type:"string",anyOf:[{format:"relative-json-pointer"},{format:"json-pointer"}]}},additionalProperties:!1},ar={},sr={exports:{}};function ir(){if(Xt)return Qt;Xt=1;const{HEX:e}=Yt?Wt:(Yt=1,Wt={HEX:{0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15}}),t=/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u;function r(e){if(s(e,".")<3)return{host:e,isIPV4:!1};const r=e.match(t)||[],[o]=r;return o?{host:a(o,"."),isIPV4:!0}:{host:e,isIPV4:!1}}function o(t,r=!1){let o="",n=!0;for(const r of t){if(void 0===e[r])return;"0"!==r&&!0===n&&(n=!1),n||(o+=r)}return r&&0===o.length&&(o="0"),o}function n(e){if(s(e,":")<2)return{host:e,isIPV6:!1};const t=function(e){let t=0;const r={error:!1,address:"",zone:""},n=[],a=[];let s=!1,i=!1,c=!1;function d(){if(a.length){if(!1===s){const e=o(a);if(void 0===e)return r.error=!0,!1;n.push(e)}a.length=0}return!0}for(let o=0;o<e.length;o++){const l=e[o];if("["!==l&&"]"!==l)if(":"!==l)if("%"===l){if(!d())break;s=!0}else a.push(l);else{if(!0===i&&(c=!0),!d())break;if(t++,n.push(":"),t>7){r.error=!0;break}o-1>=0&&":"===e[o-1]&&(i=!0)}}return a.length&&(s?r.zone=a.join(""):c?n.push(a.join("")):n.push(o(a))),r.address=n.join(""),r}(e);if(t.error)return{host:e,isIPV6:!1};{let e=t.address,r=t.address;return t.zone&&(e+="%"+t.zone,r+="%25"+t.zone),{host:e,escapedHost:r,isIPV6:!0}}}function a(e,t){let r="",o=!0;const n=e.length;for(let a=0;a<n;a++){const s=e[a];"0"===s&&o?(a+1<=n&&e[a+1]===t||a+1===n)&&(r+=s,o=!1):(o=s===t,r+=s)}return r}function s(e,t){let r=0;for(let o=0;o<e.length;o++)e[o]===t&&r++;return r}const i=/^\.\.?\//u,c=/^\/\.(?:\/|$)/u,d=/^\/\.\.(?:\/|$)/u,l=/^\/?(?:.|\n)*?(?=\/|$)/u;return Qt={recomposeAuthority:function(e){const t=[];if(void 0!==e.userinfo&&(t.push(e.userinfo),t.push("@")),void 0!==e.host){let o=unescape(e.host);const a=r(o);if(a.isIPV4)o=a.host;else{const t=n(a.host);o=!0===t.isIPV6?`[${t.escapedHost}]`:e.host}t.push(o)}return"number"!=typeof e.port&&"string"!=typeof e.port||(t.push(":"),t.push(String(e.port))),t.length?t.join(""):void 0},normalizeComponentEncoding:function(e,t){const r=!0!==t?escape:unescape;return void 0!==e.scheme&&(e.scheme=r(e.scheme)),void 0!==e.userinfo&&(e.userinfo=r(e.userinfo)),void 0!==e.host&&(e.host=r(e.host)),void 0!==e.path&&(e.path=r(e.path)),void 0!==e.query&&(e.query=r(e.query)),void 0!==e.fragment&&(e.fragment=r(e.fragment)),e},removeDotSegments:function(e){const t=[];for(;e.length;)if(e.match(i))e=e.replace(i,"");else if(e.match(c))e=e.replace(c,"/");else if(e.match(d))e=e.replace(d,"/"),t.pop();else if("."===e||".."===e)e="";else{const r=e.match(l);if(!r)throw new Error("Unexpected dot segment condition");{const o=r[0];e=e.slice(o.length),t.push(o)}}return t.join("")},normalizeIPv4:r,normalizeIPv6:n,stringArrayToHexStripped:o}}function cr(){if(tr)return sr.exports;tr=1;const{normalizeIPv6:e,normalizeIPv4:t,removeDotSegments:r,recomposeAuthority:o,normalizeComponentEncoding:n}=ir(),a=function(){if(er)return Zt;er=1;const e=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu,t=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function r(e){return"boolean"==typeof e.secure?e.secure:"wss"===String(e.scheme).toLowerCase()}function o(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function n(e){const t="https"===String(e.scheme).toLowerCase();return e.port!==(t?443:80)&&""!==e.port||(e.port=void 0),e.path||(e.path="/"),e}const a={scheme:"http",domainHost:!0,parse:o,serialize:n},s={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=r(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if(e.port!==(r(e)?443:80)&&""!==e.port||(e.port=void 0),"boolean"==typeof e.secure&&(e.scheme=e.secure?"wss":"ws",e.secure=void 0),e.resourceName){const[t,r]=e.resourceName.split("?");e.path=t&&"/"!==t?t:void 0,e.query=r,e.resourceName=void 0}return e.fragment=void 0,e}},i={http:a,https:{scheme:"https",domainHost:a.domainHost,parse:o,serialize:n},ws:s,wss:{scheme:"wss",domainHost:s.domainHost,parse:s.parse,serialize:s.serialize},urn:{scheme:"urn",parse:function(e,r){if(!e.path)return e.error="URN can not be parsed",e;const o=e.path.match(t);if(o){const t=r.scheme||e.scheme||"urn";e.nid=o[1].toLowerCase(),e.nss=o[2];const n=`${t}:${r.nid||e.nid}`,a=i[n];e.path=void 0,a&&(e=a.parse(e,r))}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){const r=t.scheme||e.scheme||"urn",o=e.nid.toLowerCase(),n=`${r}:${t.nid||o}`,a=i[n];a&&(e=a.serialize(e,t));const s=e,c=e.nss;return s.path=`${o||t.nid}:${c}`,t.skipEscape=!0,s},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(t,r){const o=t;return o.uuid=o.nss,o.nss=void 0,r.tolerant||o.uuid&&e.test(o.uuid)||(o.error=o.error||"UUID is not valid."),o},serialize:function(e){const t=e;return t.nss=(e.uuid||"").toLowerCase(),t},skipNormalize:!0}};return Zt=i}();function s(e,t,o,n){const a={};return n||(e=l(i(e,o),o),t=l(i(t,o),o)),!(o=o||{}).tolerant&&t.scheme?(a.scheme=t.scheme,a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||""),a.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(a.userinfo=t.userinfo,a.host=t.host,a.port=t.port,a.path=r(t.path||""),a.query=t.query):(t.path?("/"===t.path.charAt(0)?a.path=r(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?a.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:a.path=t.path:a.path="/"+t.path,a.path=r(a.path)),a.query=t.query):(a.path=e.path,void 0!==t.query?a.query=t.query:a.query=e.query),a.userinfo=e.userinfo,a.host=e.host,a.port=e.port),a.scheme=e.scheme),a.fragment=t.fragment,a}function i(e,t){const n={host:e.host,scheme:e.scheme,userinfo:e.userinfo,port:e.port,path:e.path,query:e.query,nid:e.nid,nss:e.nss,uuid:e.uuid,fragment:e.fragment,reference:e.reference,resourceName:e.resourceName,secure:e.secure,error:""},s=Object.assign({},t),i=[],c=a[(s.scheme||n.scheme||"").toLowerCase()];c&&c.serialize&&c.serialize(n,s),void 0!==n.path&&(s.skipEscape?n.path=unescape(n.path):(n.path=escape(n.path),void 0!==n.scheme&&(n.path=n.path.split("%3A").join(":")))),"suffix"!==s.reference&&n.scheme&&i.push(n.scheme,":");const d=o(n);if(void 0!==d&&("suffix"!==s.reference&&i.push("//"),i.push(d),n.path&&"/"!==n.path.charAt(0)&&i.push("/")),void 0!==n.path){let e=n.path;s.absolutePath||c&&c.absolutePath||(e=r(e)),void 0===d&&(e=e.replace(/^\/\//u,"/%2F")),i.push(e)}return void 0!==n.query&&i.push("?",n.query),void 0!==n.fragment&&i.push("#",n.fragment),i.join("")}const c=Array.from({length:127},(e,t)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(t)));const d=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function l(r,o){const n=Object.assign({},o),s={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},i=-1!==r.indexOf("%");let l=!1;"suffix"===n.reference&&(r=(n.scheme?n.scheme+":":"")+"//"+r);const u=r.match(d);if(u){if(s.scheme=u[1],s.userinfo=u[3],s.host=u[4],s.port=parseInt(u[5],10),s.path=u[6]||"",s.query=u[7],s.fragment=u[8],isNaN(s.port)&&(s.port=u[5]),s.host){const r=t(s.host);if(!1===r.isIPV4){const t=e(r.host);s.host=t.host.toLowerCase(),l=t.isIPV6}else s.host=r.host,l=!0}void 0!==s.scheme||void 0!==s.userinfo||void 0!==s.host||void 0!==s.port||void 0!==s.query||s.path?void 0===s.scheme?s.reference="relative":void 0===s.fragment?s.reference="absolute":s.reference="uri":s.reference="same-document",n.reference&&"suffix"!==n.reference&&n.reference!==s.reference&&(s.error=s.error||"URI is not a "+n.reference+" reference.");const r=a[(n.scheme||s.scheme||"").toLowerCase()];if(!(n.unicodeSupport||r&&r.unicodeSupport)&&s.host&&(n.domainHost||r&&r.domainHost)&&!1===l&&function(e){let t=0;for(let r=0,o=e.length;r<o;++r)if(t=e.charCodeAt(r),t>126||c[t])return!0;return!1}(s.host))try{s.host=URL.domainToASCII(s.host.toLowerCase())}catch(e){s.error=s.error||"Host's domain name can not be converted to ASCII: "+e}(!r||r&&!r.skipNormalize)&&(i&&void 0!==s.scheme&&(s.scheme=unescape(s.scheme)),i&&void 0!==s.host&&(s.host=unescape(s.host)),s.path&&(s.path=escape(unescape(s.path))),s.fragment&&(s.fragment=encodeURI(decodeURIComponent(s.fragment)))),r&&r.parse&&r.parse(s,n)}else s.error=s.error||"URI can not be parsed.";return s}const u={SCHEMES:a,normalize:function(e,t){return"string"==typeof e?e=i(l(e,t),t):"object"==typeof e&&(e=l(i(e,t),t)),e},resolve:function(e,t,r){const o=Object.assign({scheme:"null"},r);return i(s(l(e,o),l(t,o),o,!0),{...o,skipEscape:!0})},resolveComponents:s,equal:function(e,t,r){return"string"==typeof e?(e=unescape(e),e=i(n(l(e,r),!0),{...r,skipEscape:!0})):"object"==typeof e&&(e=i(n(e,!0),{...r,skipEscape:!0})),"string"==typeof t?(t=unescape(t),t=i(n(l(t,r),!0),{...r,skipEscape:!0})):"object"==typeof t&&(t=i(n(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()},serialize:i,parse:l};return sr.exports=u,sr.exports.default=u,sr.exports.fastUri=u,sr.exports}function dr(){return or||(or=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.CodeGen=e.Name=e.nil=e.stringify=e.str=e._=e.KeywordCxt=void 0;var t=Vt();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=et();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return r._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return r.str}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return r.stringify}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return r.nil}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return r.Name}}),Object.defineProperty(e,"CodeGen",{enumerable:!0,get:function(){return r.CodeGen}});const o=qt(),n=Bt(),a=ft(),s=Jt(),i=et(),c=Ft(),d=vt(),l=ot(),u=nr,p=function(){if(rr)return ar;rr=1,Object.defineProperty(ar,"__esModule",{value:!0});const e=cr();return e.code='require("ajv/dist/runtime/uri").default',ar.default=e,ar}(),f=(e,t)=>new RegExp(e,t);f.code="new RegExp";const m=["removeAdditional","useDefaults","coerceTypes"],h=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]),g={errorDataPath:"",format:"`validateFormats: false` can be used instead.",nullable:'"nullable" keyword is supported by default.',jsonPointers:"Deprecated jsPropertySyntax can be used instead.",extendRefs:"Deprecated ignoreKeywordsWithRef can be used instead.",missingRefs:"Pass empty schema with $id that should be ignored to ajv.addSchema.",processCode:"Use option `code: {process: (code, schemaEnv: object) => string}`",sourceCode:"Use option `code: {source: true}`",strictDefaults:"It is default now, see option `strict`.",strictKeywords:"It is default now, see option `strict`.",uniqueItems:'"uniqueItems" keyword is always validated.',unknownFormats:"Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",cache:"Map is used as cache, schema object as key.",serialize:"Map is used as cache, schema object as key.",ajvErrors:"It is default now."},y={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};function v(e){var t,r,o,n,a,s,i,c,d,l,u,m,h,g,y,v,b,$,w,_,k,P,E,S,j;const N=e.strict,I=null===(t=e.code)||void 0===t?void 0:t.optimize,O=!0===I||void 0===I?1:I||0,T=null!==(o=null===(r=e.code)||void 0===r?void 0:r.regExp)&&void 0!==o?o:f,x=null!==(n=e.uriResolver)&&void 0!==n?n:p.default;return{strictSchema:null===(s=null!==(a=e.strictSchema)&&void 0!==a?a:N)||void 0===s||s,strictNumbers:null===(c=null!==(i=e.strictNumbers)&&void 0!==i?i:N)||void 0===c||c,strictTypes:null!==(l=null!==(d=e.strictTypes)&&void 0!==d?d:N)&&void 0!==l?l:"log",strictTuples:null!==(m=null!==(u=e.strictTuples)&&void 0!==u?u:N)&&void 0!==m?m:"log",strictRequired:null!==(g=null!==(h=e.strictRequired)&&void 0!==h?h:N)&&void 0!==g&&g,code:e.code?{...e.code,optimize:O,regExp:T}:{optimize:O,regExp:T},loopRequired:null!==(y=e.loopRequired)&&void 0!==y?y:200,loopEnum:null!==(v=e.loopEnum)&&void 0!==v?v:200,meta:null===(b=e.meta)||void 0===b||b,messages:null===($=e.messages)||void 0===$||$,inlineRefs:null===(w=e.inlineRefs)||void 0===w||w,schemaId:null!==(_=e.schemaId)&&void 0!==_?_:"$id",addUsedSchema:null===(k=e.addUsedSchema)||void 0===k||k,validateSchema:null===(P=e.validateSchema)||void 0===P||P,validateFormats:null===(E=e.validateFormats)||void 0===E||E,unicodeRegExp:null===(S=e.unicodeRegExp)||void 0===S||S,int32range:null===(j=e.int32range)||void 0===j||j,uriResolver:x}}class b{constructor(e={}){this.schemas={},this.refs={},this.formats={},this._compilations=new Set,this._loading={},this._cache=new Map,e=this.opts={...e,...v(e)};const{es5:t,lines:r}=this.opts.code;this.scope=new i.ValueScope({scope:{},prefixes:h,es5:t,lines:r}),this.logger=function(e){if(!1===e)return S;if(void 0===e)return console;if(e.log&&e.warn&&e.error)return e;throw new Error("logger must implement log, warn and error methods")}(e.logger);const o=e.validateFormats;e.validateFormats=!1,this.RULES=(0,a.getRules)(),$.call(this,g,e,"NOT SUPPORTED"),$.call(this,y,e,"DEPRECATED","warn"),this._metaOpts=E.call(this),e.formats&&k.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&P.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),_.call(this),e.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:r}=this.opts;let o=u;"id"===r&&(o={...u},o.id=o.$id,delete o.$id),t&&e&&this.addMetaSchema(o,o[r],!1)}defaultMeta(){const{meta:e,schemaId:t}=this.opts;return this.opts.defaultMeta="object"==typeof e?e[t]||e:void 0}validate(e,t){let r;if("string"==typeof e){if(r=this.getSchema(e),!r)throw new Error(`no schema with key or ref "${e}"`)}else r=this.compile(e);const o=r(t);return"$async"in r||(this.errors=r.errors),o}compile(e,t){const r=this._addSchema(e,t);return r.validate||this._compileSchemaEnv(r)}compileAsync(e,t){if("function"!=typeof this.opts.loadSchema)throw new Error("options.loadSchema should be a function");const{loadSchema:r}=this.opts;return o.call(this,e,t);async function o(e,t){await a.call(this,e.$schema);const r=this._addSchema(e,t);return r.validate||s.call(this,r)}async function a(e){e&&!this.getSchema(e)&&await o.call(this,{$ref:e},!0)}async function s(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof n.default))throw t;return i.call(this,t),await c.call(this,t.missingSchema),s.call(this,e)}}function i({missingSchema:e,missingRef:t}){if(this.refs[e])throw new Error(`AnySchema ${e} is loaded but ${t} cannot be resolved`)}async function c(e){const r=await d.call(this,e);this.refs[e]||await a.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function d(e){const t=this._loading[e];if(t)return t;try{return await(this._loading[e]=r(e))}finally{delete this._loading[e]}}}addSchema(e,t,r,o=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,r,o);return this}let n;if("object"==typeof e){const{schemaId:t}=this.opts;if(n=e[t],void 0!==n&&"string"!=typeof n)throw new Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||n),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,o,!0),this}addMetaSchema(e,t,r=this.opts.validateSchema){return this.addSchema(e,t,!0,r),this}validateSchema(e,t){if("boolean"==typeof e)return!0;let r;if(r=e.$schema,void 0!==r&&"string"!=typeof r)throw new Error("$schema must be a string");if(r=r||this.opts.defaultMeta||this.defaultMeta(),!r)return this.logger.warn("meta-schema not available"),this.errors=null,!0;const o=this.validate(r,e);if(!o&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return o}getSchema(e){let t;for(;"string"==typeof(t=w.call(this,e));)e=t;if(void 0===t){const{schemaId:r}=this.opts,o=new s.SchemaEnv({schema:{},schemaId:r});if(t=s.resolveSchema.call(this,o,e),!t)return;this.refs[e]=t}return t.validate||this._compileSchemaEnv(t)}removeSchema(e){if(e instanceof RegExp)return this._removeAllSchemas(this.schemas,e),this._removeAllSchemas(this.refs,e),this;switch(typeof e){case"undefined":return this._removeAllSchemas(this.schemas),this._removeAllSchemas(this.refs),this._cache.clear(),this;case"string":{const t=w.call(this,e);return"object"==typeof t&&this._cache.delete(t.schema),delete this.schemas[e],delete this.refs[e],this}case"object":{const t=e;this._cache.delete(t);let r=e[this.opts.schemaId];return r&&(r=(0,c.normalizeId)(r),delete this.schemas[r],delete this.refs[r]),this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(e){for(const t of e)this.addKeyword(t);return this}addKeyword(e,t){let r;if("string"==typeof e)r=e,"object"==typeof t&&(this.logger.warn("these parameters are deprecated, see docs for addKeyword"),t.keyword=r);else{if("object"!=typeof e||void 0!==t)throw new Error("invalid addKeywords parameters");if(r=(t=e).keyword,Array.isArray(r)&&!r.length)throw new Error("addKeywords: keyword must be string or non-empty array")}if(N.call(this,r,t),!t)return(0,l.eachItem)(r,e=>I.call(this,e)),this;T.call(this,t);const o={...t,type:(0,d.getJSONTypes)(t.type),schemaType:(0,d.getJSONTypes)(t.schemaType)};return(0,l.eachItem)(r,0===o.type.length?e=>I.call(this,e,o):e=>o.type.forEach(t=>I.call(this,e,o,t))),this}getKeyword(e){const t=this.RULES.all[e];return"object"==typeof t?t.definition:!!t}removeKeyword(e){const{RULES:t}=this;delete t.keywords[e],delete t.all[e];for(const r of t.rules){const t=r.rules.findIndex(t=>t.keyword===e);t>=0&&r.rules.splice(t,1)}return this}addFormat(e,t){return"string"==typeof t&&(t=new RegExp(t)),this.formats[e]=t,this}errorsText(e=this.errors,{separator:t=", ",dataVar:r="data"}={}){return e&&0!==e.length?e.map(e=>`${r}${e.instancePath} ${e.message}`).reduce((e,r)=>e+t+r):"No errors"}$dataMetaSchema(e,t){const r=this.RULES.all;e=JSON.parse(JSON.stringify(e));for(const o of t){const t=o.split("/").slice(1);let n=e;for(const e of t)n=n[e];for(const e in r){const t=r[e];if("object"!=typeof t)continue;const{$data:o}=t.definition,a=n[e];o&&a&&(n[e]=C(a))}}return e}_removeAllSchemas(e,t){for(const r in e){const o=e[r];t&&!t.test(r)||("string"==typeof o?delete e[r]:o&&!o.meta&&(this._cache.delete(o.schema),delete e[r]))}}_addSchema(e,t,r,o=this.opts.validateSchema,n=this.opts.addUsedSchema){let a;const{schemaId:i}=this.opts;if("object"==typeof e)a=e[i];else{if(this.opts.jtd)throw new Error("schema must be object");if("boolean"!=typeof e)throw new Error("schema must be object or boolean")}let d=this._cache.get(e);if(void 0!==d)return d;r=(0,c.normalizeId)(a||r);const l=c.getSchemaRefs.call(this,e,r);return d=new s.SchemaEnv({schema:e,schemaId:i,meta:t,baseId:r,localRefs:l}),this._cache.set(d.schema,d),n&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=d),o&&this.validateSchema(e,!0),d}_checkUnique(e){if(this.schemas[e]||this.refs[e])throw new Error(`schema with key or id "${e}" already exists`)}_compileSchemaEnv(e){if(e.meta?this._compileMetaSchema(e):s.compileSchema.call(this,e),!e.validate)throw new Error("ajv implementation error");return e.validate}_compileMetaSchema(e){const t=this.opts;this.opts=this._metaOpts;try{s.compileSchema.call(this,e)}finally{this.opts=t}}}function $(e,t,r,o="error"){for(const n in e){const a=n;a in t&&this.logger[o](`${r}: option ${n}. ${e[a]}`)}}function w(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function _(){const e=this.opts.schemas;if(e)if(Array.isArray(e))this.addSchema(e);else for(const t in e)this.addSchema(e[t],t)}function k(){for(const e in this.opts.formats){const t=this.opts.formats[e];t&&this.addFormat(e,t)}}function P(e){if(Array.isArray(e))this.addVocabulary(e);else{this.logger.warn("keywords option as map is deprecated, pass array");for(const t in e){const r=e[t];r.keyword||(r.keyword=t),this.addKeyword(r)}}}function E(){const e={...this.opts};for(const t of m)delete e[t];return e}b.ValidationError=o.default,b.MissingRefError=n.default,e.default=b;const S={log(){},warn(){},error(){}};const j=/^[a-z_$][a-z0-9_$:-]*$/i;function N(e,t){const{RULES:r}=this;if((0,l.eachItem)(e,e=>{if(r.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!j.test(e))throw new Error(`Keyword ${e} has invalid name`)}),t&&t.$data&&!("code"in t)&&!("validate"in t))throw new Error('$data keyword must have "code" or "validate" function')}function I(e,t,r){var o;const n=null==t?void 0:t.post;if(r&&n)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:a}=this;let s=n?a.post:a.rules.find(({type:e})=>e===r);if(s||(s={type:r,rules:[]},a.rules.push(s)),a.keywords[e]=!0,!t)return;const i={keyword:e,definition:{...t,type:(0,d.getJSONTypes)(t.type),schemaType:(0,d.getJSONTypes)(t.schemaType)}};t.before?O.call(this,s,i,t.before):s.rules.push(i),a.all[e]=i,null===(o=t.implements)||void 0===o||o.forEach(e=>this.addKeyword(e))}function O(e,t,r){const o=e.rules.findIndex(e=>e.keyword===r);o>=0?e.rules.splice(o,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function T(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=C(t)),e.validateSchema=this.compile(t,!0))}const x={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function C(e){return{anyOf:[e,x]}}}(Ke)),Ke}var lr,ur={},pr={},fr={};var mr,hr,gr={};function yr(){if(mr)return gr;mr=1,Object.defineProperty(gr,"__esModule",{value:!0}),gr.callRef=gr.getValidate=void 0;const e=Bt(),t=Et(),r=et(),o=ct(),n=Jt(),a=ot(),s={keyword:"$ref",schemaType:"string",code(t){const{gen:o,schema:a,it:s}=t,{baseId:d,schemaEnv:l,validateName:u,opts:p,self:f}=s,{root:m}=l;if(("#"===a||"#/"===a)&&d===m.baseId)return function(){if(l===m)return c(t,u,l,l.$async);const e=o.scopeValue("root",{ref:m});return c(t,r._`${e}.validate`,m,m.$async)}();const h=n.resolveRef.call(f,m,d,a);if(void 0===h)throw new e.default(s.opts.uriResolver,d,a);return h instanceof n.SchemaEnv?function(e){const r=i(t,e);c(t,r,e,e.$async)}(h):function(e){const n=o.scopeValue("schema",!0===p.code.source?{ref:e,code:(0,r.stringify)(e)}:{ref:e}),s=o.name("valid"),i=t.subschema({schema:e,dataTypes:[],schemaPath:r.nil,topSchemaRef:n,errSchemaPath:a},s);t.mergeEvaluated(i),t.ok(s)}(h)}};function i(e,t){const{gen:o}=e;return t.validate?o.scopeValue("validate",{ref:t.validate}):r._`${o.scopeValue("wrapper",{ref:t})}.validate`}function c(e,n,s,i){const{gen:c,it:d}=e,{allErrors:l,schemaEnv:u,opts:p}=d,f=p.passContext?o.default.this:r.nil;function m(e){const t=r._`${e}.errors`;c.assign(o.default.vErrors,r._`${o.default.vErrors} === null ? ${t} : ${o.default.vErrors}.concat(${t})`),c.assign(o.default.errors,r._`${o.default.vErrors}.length`)}function h(e){var t;if(!d.opts.unevaluated)return;const o=null===(t=null==s?void 0:s.validate)||void 0===t?void 0:t.evaluated;if(!0!==d.props)if(o&&!o.dynamicProps)void 0!==o.props&&(d.props=a.mergeEvaluated.props(c,o.props,d.props));else{const t=c.var("props",r._`${e}.evaluated.props`);d.props=a.mergeEvaluated.props(c,t,d.props,r.Name)}if(!0!==d.items)if(o&&!o.dynamicItems)void 0!==o.items&&(d.items=a.mergeEvaluated.items(c,o.items,d.items));else{const t=c.var("items",r._`${e}.evaluated.items`);d.items=a.mergeEvaluated.items(c,t,d.items,r.Name)}}i?function(){if(!u.$async)throw new Error("async schema referenced by sync schema");const o=c.let("valid");c.try(()=>{c.code(r._`await ${(0,t.callValidateCode)(e,n,f)}`),h(n),l||c.assign(o,!0)},e=>{c.if(r._`!(${e} instanceof ${d.ValidationError})`,()=>c.throw(e)),m(e),l||c.assign(o,!1)}),e.ok(o)}():e.result((0,t.callValidateCode)(e,n,f),()=>h(n),()=>m(n))}return gr.getValidate=i,gr.callRef=c,gr.default=s,gr}function vr(){if(hr)return pr;hr=1,Object.defineProperty(pr,"__esModule",{value:!0});const e=function(){if(lr)return fr;lr=1,Object.defineProperty(fr,"__esModule",{value:!0});const e={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return fr.default=e,fr}(),t=yr(),r=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",e.default,t.default];return pr.default=r,pr}var br,$r={},wr={};var _r,kr={};var Pr,Er,Sr={},jr={};function Nr(){if(Er)return Sr;Er=1,Object.defineProperty(Sr,"__esModule",{value:!0});const e=et(),t=ot(),r=function(){if(Pr)return jr;function e(e){const t=e.length;let r,o=0,n=0;for(;n<t;)o++,r=e.charCodeAt(n++),r>=55296&&r<=56319&&n<t&&(r=e.charCodeAt(n),56320==(64512&r)&&n++);return o}return Pr=1,Object.defineProperty(jr,"__esModule",{value:!0}),jr.default=e,e.code='require("ajv/dist/runtime/ucs2length").default',jr}(),o={message({keyword:t,schemaCode:r}){const o="maxLength"===t?"more":"fewer";return e.str`must NOT have ${o} than ${r} characters`},params:({schemaCode:t})=>e._`{limit: ${t}}`},n={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:o,code(o){const{keyword:n,data:a,schemaCode:s,it:i}=o,c="maxLength"===n?e.operators.GT:e.operators.LT,d=!1===i.opts.unicode?e._`${a}.length`:e._`${(0,t.useFunc)(o.gen,r.default)}(${a})`;o.fail$data(e._`${d} ${c} ${s}`)}};return Sr.default=n,Sr}var Ir,Or={};var Tr,xr={};var Cr,Rr={};function Ar(){if(Cr)return Rr;Cr=1,Object.defineProperty(Rr,"__esModule",{value:!0});const e=Et(),t=et(),r=ot(),o={keyword:"required",type:"object",schemaType:"array",$data:!0,error:{message:({params:{missingProperty:e}})=>t.str`must have required property '${e}'`,params:({params:{missingProperty:e}})=>t._`{missingProperty: ${e}}`},code(o){const{gen:n,schema:a,schemaCode:s,data:i,$data:c,it:d}=o,{opts:l}=d;if(!c&&0===a.length)return;const u=a.length>=l.loopRequired;if(d.allErrors?function(){if(u||c)o.block$data(t.nil,p);else for(const t of a)(0,e.checkReportMissingProp)(o,t)}():function(){const r=n.let("missing");if(u||c){const a=n.let("valid",!0);o.block$data(a,()=>function(r,a){o.setParams({missingProperty:r}),n.forOf(r,s,()=>{n.assign(a,(0,e.propertyInData)(n,i,r,l.ownProperties)),n.if((0,t.not)(a),()=>{o.error(),n.break()})},t.nil)}(r,a)),o.ok(a)}else n.if((0,e.checkMissingProp)(o,a,r)),(0,e.reportMissingProp)(o,r),n.else()}(),l.strictRequired){const e=o.parentSchema.properties,{definedProperties:t}=o.it;for(const o of a)if(void 0===(null==e?void 0:e[o])&&!t.has(o)){const e=`required property "${o}" is not defined at "${d.schemaEnv.baseId+d.errSchemaPath}" (strictRequired)`;(0,r.checkStrictMode)(d,e,d.opts.strictRequired)}}function p(){n.forOf("prop",s,t=>{o.setParams({missingProperty:t}),n.if((0,e.noPropertyInData)(n,i,t,l.ownProperties),()=>o.error())})}}};return Rr.default=o,Rr}var Mr,Dr={};var Fr,Vr,zr={},Ur={};function qr(){if(Fr)return Ur;Fr=1,Object.defineProperty(Ur,"__esModule",{value:!0});const e=xt();return e.code='require("ajv/dist/runtime/equal").default',Ur.default=e,Ur}function Kr(){if(Vr)return zr;Vr=1,Object.defineProperty(zr,"__esModule",{value:!0});const e=vt(),t=et(),r=ot(),o=qr(),n={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:!0,error:{message:({params:{i:e,j:r}})=>t.str`must NOT have duplicate items (items ## ${r} and ${e} are identical)`,params:({params:{i:e,j:r}})=>t._`{i: ${e}, j: ${r}}`},code(n){const{gen:a,data:s,$data:i,schema:c,parentSchema:d,schemaCode:l,it:u}=n;if(!i&&!c)return;const p=a.let("valid"),f=d.items?(0,e.getSchemaTypes)(d.items):[];function m(r,o){const i=a.name("item"),c=(0,e.checkDataTypes)(f,i,u.opts.strictNumbers,e.DataType.Wrong),d=a.const("indices",t._`{}`);a.for(t._`;${r}--;`,()=>{a.let(i,t._`${s}[${r}]`),a.if(c,t._`continue`),f.length>1&&a.if(t._`typeof ${i} == "string"`,t._`${i} += "_"`),a.if(t._`typeof ${d}[${i}] == "number"`,()=>{a.assign(o,t._`${d}[${i}]`),n.error(),a.assign(p,!1).break()}).code(t._`${d}[${i}] = ${r}`)})}function h(e,i){const c=(0,r.useFunc)(a,o.default),d=a.name("outer");a.label(d).for(t._`;${e}--;`,()=>a.for(t._`${i} = ${e}; ${i}--;`,()=>a.if(t._`${c}(${s}[${e}], ${s}[${i}])`,()=>{n.error(),a.assign(p,!1).break(d)})))}n.block$data(p,function(){const e=a.let("i",t._`${s}.length`),r=a.let("j");n.setParams({i:e,j:r}),a.assign(p,!0),a.if(t._`${e} > 1`,()=>(f.length>0&&!f.some(e=>"object"===e||"array"===e)?m:h)(e,r))},t._`${l} === false`),n.ok(p)}};return zr.default=n,zr}var Lr,Br={};var Hr,Gr,Jr={};function Wr(){if(Hr)return Jr;Hr=1,Object.defineProperty(Jr,"__esModule",{value:!0});const e=et(),t=ot(),r=qr(),o={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>e._`{allowedValues: ${t}}`},code(o){const{gen:n,data:a,$data:s,schema:i,schemaCode:c,it:d}=o;if(!s&&0===i.length)throw new Error("enum must have non-empty array");const l=i.length>=d.opts.loopEnum;let u;const p=()=>null!=u?u:u=(0,t.useFunc)(n,r.default);let f;if(l||s)f=n.let("valid"),o.block$data(f,function(){n.assign(f,!1),n.forOf("v",c,t=>n.if(e._`${p()}(${a}, ${t})`,()=>n.assign(f,!0).break()))});else{if(!Array.isArray(i))throw new Error("ajv implementation error");const t=n.const("vSchema",c);f=(0,e.or)(...i.map((r,o)=>function(t,r){const o=i[r];return"object"==typeof o&&null!==o?e._`${p()}(${a}, ${t}[${r}])`:e._`${a} === ${o}`}(t,o)))}o.pass(f)}};return Jr.default=o,Jr}function Yr(){if(Gr)return $r;Gr=1,Object.defineProperty($r,"__esModule",{value:!0});const e=function(){if(br)return wr;br=1,Object.defineProperty(wr,"__esModule",{value:!0});const e=et(),t=e.operators,r={maximum:{okStr:"<=",ok:t.LTE,fail:t.GT},minimum:{okStr:">=",ok:t.GTE,fail:t.LT},exclusiveMaximum:{okStr:"<",ok:t.LT,fail:t.GTE},exclusiveMinimum:{okStr:">",ok:t.GT,fail:t.LTE}},o={message:({keyword:t,schemaCode:o})=>e.str`must be ${r[t].okStr} ${o}`,params:({keyword:t,schemaCode:o})=>e._`{comparison: ${r[t].okStr}, limit: ${o}}`},n={keyword:Object.keys(r),type:"number",schemaType:"number",$data:!0,error:o,code(t){const{keyword:o,data:n,schemaCode:a}=t;t.fail$data(e._`${n} ${r[o].fail} ${a} || isNaN(${n})`)}};return wr.default=n,wr}(),t=function(){if(_r)return kr;_r=1,Object.defineProperty(kr,"__esModule",{value:!0});const e=et(),t={keyword:"multipleOf",type:"number",schemaType:"number",$data:!0,error:{message:({schemaCode:t})=>e.str`must be multiple of ${t}`,params:({schemaCode:t})=>e._`{multipleOf: ${t}}`},code(t){const{gen:r,data:o,schemaCode:n,it:a}=t,s=a.opts.multipleOfPrecision,i=r.let("res"),c=s?e._`Math.abs(Math.round(${i}) - ${i}) > 1e-${s}`:e._`${i} !== parseInt(${i})`;t.fail$data(e._`(${n} === 0 || (${i} = ${o}/${n}, ${c}))`)}};return kr.default=t,kr}(),r=Nr(),o=function(){if(Ir)return Or;Ir=1,Object.defineProperty(Or,"__esModule",{value:!0});const e=Et(),t=et(),r={keyword:"pattern",type:"string",schemaType:"string",$data:!0,error:{message:({schemaCode:e})=>t.str`must match pattern "${e}"`,params:({schemaCode:e})=>t._`{pattern: ${e}}`},code(r){const{data:o,$data:n,schema:a,schemaCode:s,it:i}=r,c=i.opts.unicodeRegExp?"u":"",d=n?t._`(new RegExp(${s}, ${c}))`:(0,e.usePattern)(r,a);r.fail$data(t._`!${d}.test(${o})`)}};return Or.default=r,Or}(),n=function(){if(Tr)return xr;Tr=1,Object.defineProperty(xr,"__esModule",{value:!0});const e=et(),t={message({keyword:t,schemaCode:r}){const o="maxProperties"===t?"more":"fewer";return e.str`must NOT have ${o} than ${r} properties`},params:({schemaCode:t})=>e._`{limit: ${t}}`},r={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:!0,error:t,code(t){const{keyword:r,data:o,schemaCode:n}=t,a="maxProperties"===r?e.operators.GT:e.operators.LT;t.fail$data(e._`Object.keys(${o}).length ${a} ${n}`)}};return xr.default=r,xr}(),a=Ar(),s=function(){if(Mr)return Dr;Mr=1,Object.defineProperty(Dr,"__esModule",{value:!0});const e=et(),t={message({keyword:t,schemaCode:r}){const o="maxItems"===t?"more":"fewer";return e.str`must NOT have ${o} than ${r} items`},params:({schemaCode:t})=>e._`{limit: ${t}}`},r={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:!0,error:t,code(t){const{keyword:r,data:o,schemaCode:n}=t,a="maxItems"===r?e.operators.GT:e.operators.LT;t.fail$data(e._`${o}.length ${a} ${n}`)}};return Dr.default=r,Dr}(),i=Kr(),c=function(){if(Lr)return Br;Lr=1,Object.defineProperty(Br,"__esModule",{value:!0});const e=et(),t=ot(),r=qr(),o={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>e._`{allowedValue: ${t}}`},code(o){const{gen:n,data:a,$data:s,schemaCode:i,schema:c}=o;s||c&&"object"==typeof c?o.fail$data(e._`!${(0,t.useFunc)(n,r.default)}(${a}, ${i})`):o.fail(e._`${c} !== ${a}`)}};return Br.default=o,Br}(),d=Wr(),l=[e.default,t.default,r.default,o.default,n.default,a.default,s.default,i.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},c.default,d.default];return $r.default=l,$r}var Qr,Xr={},Zr={};function eo(){if(Qr)return Zr;Qr=1,Object.defineProperty(Zr,"__esModule",{value:!0}),Zr.validateAdditionalItems=void 0;const e=et(),t=ot(),r={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:{message:({params:{len:t}})=>e.str`must NOT have more than ${t} items`,params:({params:{len:t}})=>e._`{limit: ${t}}`},code(e){const{parentSchema:r,it:n}=e,{items:a}=r;Array.isArray(a)?o(e,a):(0,t.checkStrictMode)(n,'"additionalItems" is ignored when "items" is not an array of schemas')}};function o(r,o){const{gen:n,schema:a,data:s,keyword:i,it:c}=r;c.items=!0;const d=n.const("len",e._`${s}.length`);if(!1===a)r.setParams({len:o.length}),r.pass(e._`${d} <= ${o.length}`);else if("object"==typeof a&&!(0,t.alwaysValidSchema)(c,a)){const a=n.var("valid",e._`${d} <= ${o.length}`);n.if((0,e.not)(a),()=>function(a){n.forRange("i",o.length,d,o=>{r.subschema({keyword:i,dataProp:o,dataPropType:t.Type.Num},a),c.allErrors||n.if((0,e.not)(a),()=>n.break())})}(a)),r.ok(a)}}return Zr.validateAdditionalItems=o,Zr.default=r,Zr}var to,ro,oo={},no={};function ao(){if(to)return no;to=1,Object.defineProperty(no,"__esModule",{value:!0}),no.validateTuple=void 0;const e=et(),t=ot(),r=Et(),o={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:o,it:a}=e;if(Array.isArray(o))return n(e,"additionalItems",o);a.items=!0,(0,t.alwaysValidSchema)(a,o)||e.ok((0,r.validateArray)(e))}};function n(r,o,n=r.schema){const{gen:a,parentSchema:s,data:i,keyword:c,it:d}=r;!function(e){const{opts:r,errSchemaPath:a}=d,s=n.length,i=s===e.minItems&&(s===e.maxItems||!1===e[o]);if(r.strictTuples&&!i){const e=`"${c}" is ${s}-tuple, but minItems or maxItems/${o} are not specified or different at path "${a}"`;(0,t.checkStrictMode)(d,e,r.strictTuples)}}(s),d.opts.unevaluated&&n.length&&!0!==d.items&&(d.items=t.mergeEvaluated.items(a,n.length,d.items));const l=a.name("valid"),u=a.const("len",e._`${i}.length`);n.forEach((o,n)=>{(0,t.alwaysValidSchema)(d,o)||(a.if(e._`${u} > ${n}`,()=>r.subschema({keyword:c,schemaProp:n,dataProp:n},l)),r.ok(l))})}return no.validateTuple=n,no.default=o,no}var so,io={};var co,lo={};function uo(){if(co)return lo;co=1,Object.defineProperty(lo,"__esModule",{value:!0});const e=et(),t=ot(),r={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:!0,error:{message:({params:{min:t,max:r}})=>void 0===r?e.str`must contain at least ${t} valid item(s)`:e.str`must contain at least ${t} and no more than ${r} valid item(s)`,params:({params:{min:t,max:r}})=>void 0===r?e._`{minContains: ${t}}`:e._`{minContains: ${t}, maxContains: ${r}}`},code(r){const{gen:o,schema:n,parentSchema:a,data:s,it:i}=r;let c,d;const{minContains:l,maxContains:u}=a;i.opts.next?(c=void 0===l?1:l,d=u):c=1;const p=o.const("len",e._`${s}.length`);if(r.setParams({min:c,max:d}),void 0===d&&0===c)return void(0,t.checkStrictMode)(i,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==d&&c>d)return(0,t.checkStrictMode)(i,'"minContains" > "maxContains" is always invalid'),void r.fail();if((0,t.alwaysValidSchema)(i,n)){let t=e._`${p} >= ${c}`;return void 0!==d&&(t=e._`${t} && ${p} <= ${d}`),void r.pass(t)}i.items=!0;const f=o.name("valid");function m(){const t=o.name("_valid"),r=o.let("count",0);h(t,()=>o.if(t,()=>function(t){o.code(e._`${t}++`),void 0===d?o.if(e._`${t} >= ${c}`,()=>o.assign(f,!0).break()):(o.if(e._`${t} > ${d}`,()=>o.assign(f,!1).break()),1===c?o.assign(f,!0):o.if(e._`${t} >= ${c}`,()=>o.assign(f,!0)))}(r)))}function h(e,n){o.forRange("i",0,p,o=>{r.subschema({keyword:"contains",dataProp:o,dataPropType:t.Type.Num,compositeRule:!0},e),n()})}void 0===d&&1===c?h(f,()=>o.if(f,()=>o.break())):0===c?(o.let(f,!0),void 0!==d&&o.if(e._`${s}.length > 0`,m)):(o.let(f,!1),m()),r.result(f,()=>r.reset())}};return lo.default=r,lo}var po,fo={};function mo(){return po||(po=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=et(),r=ot(),o=Et();e.error={message:({params:{property:e,depsCount:r,deps:o}})=>{const n=1===r?"property":"properties";return t.str`must have ${n} ${o} when property ${e} is present`},params:({params:{property:e,depsCount:r,deps:o,missingProperty:n}})=>t._`{property: ${e},
5
5
  missingProperty: ${n},
6
6
  depsCount: ${r},
7
- deps: ${o}}`};const n={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(e){const[t,r]=function({schema:e}){const t={},r={};for(const o in e){if("__proto__"===o)continue;(Array.isArray(e[o])?t:r)[o]=e[o]}return[t,r]}(e);a(e,t),s(e,r)}};function a(e,r=e.schema){const{gen:n,data:a,it:s}=e;if(0===Object.keys(r).length)return;const i=n.let("missing");for(const c in r){const d=r[c];if(0===d.length)continue;const l=(0,o.propertyInData)(n,a,c,s.opts.ownProperties);e.setParams({property:c,depsCount:d.length,deps:d.join(", ")}),s.allErrors?n.if(l,()=>{for(const t of d)(0,o.checkReportMissingProp)(e,t)}):(n.if(t._`${l} && (${(0,o.checkMissingProp)(e,d,i)})`),(0,o.reportMissingProp)(e,i),n.else())}}function s(e,t=e.schema){const{gen:n,data:a,keyword:s,it:i}=e,c=n.name("valid");for(const d in t)(0,r.alwaysValidSchema)(i,t[d])||(n.if((0,o.propertyInData)(n,a,d,i.opts.ownProperties),()=>{const t=e.subschema({keyword:s,schemaProp:d},c);e.mergeValidEvaluated(t,c)},()=>n.var(c,!0)),e.ok(c))}e.validatePropertyDeps=a,e.validateSchemaDeps=s,e.default=n}(mo)),mo}var go,vo={};var yo,bo={};function $o(){if(yo)return bo;yo=1,Object.defineProperty(bo,"__esModule",{value:!0});const e=Et(),t=tt(),r=dt(),o=nt(),n={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>t._`{additionalProperty: ${e.additionalProperty}}`},code(n){const{gen:a,schema:s,parentSchema:i,data:c,errsCount:d,it:l}=n;if(!d)throw new Error("ajv implementation error");const{allErrors:u,opts:p}=l;if(l.props=!0,"all"!==p.removeAdditional&&(0,o.alwaysValidSchema)(l,s))return;const f=(0,e.allSchemaProperties)(i.properties),m=(0,e.allSchemaProperties)(i.patternProperties);function h(e){a.code(t._`delete ${c}[${e}]`)}function g(e){if("all"===p.removeAdditional||p.removeAdditional&&!1===s)h(e);else{if(!1===s)return n.setParams({additionalProperty:e}),n.error(),void(u||a.break());if("object"==typeof s&&!(0,o.alwaysValidSchema)(l,s)){const r=a.name("valid");"failing"===p.removeAdditional?(v(e,r,!1),a.if((0,t.not)(r),()=>{n.reset(),h(e)})):(v(e,r),u||a.if((0,t.not)(r),()=>a.break()))}}}function v(e,t,r){const a={keyword:"additionalProperties",dataProp:e,dataPropType:o.Type.Str};!1===r&&Object.assign(a,{compositeRule:!0,createErrors:!1,allErrors:!1}),n.subschema(a,t)}a.forIn("key",c,r=>{f.length||m.length?a.if(function(r){let s;if(f.length>8){const t=(0,o.schemaRefOrVal)(l,i.properties,"properties");s=(0,e.isOwnProperty)(a,t,r)}else s=f.length?(0,t.or)(...f.map(e=>t._`${r} === ${e}`)):t.nil;return m.length&&(s=(0,t.or)(s,...m.map(o=>t._`${(0,e.usePattern)(n,o)}.test(${r})`))),(0,t.not)(s)}(r),()=>g(r)):g(r)}),n.ok(t._`${d} === ${r.default.errors}`)}};return bo.default=n,bo}var wo,_o={};var ko,Po={};var So,Eo={};var jo,Oo={};var No,Io={};var xo,To={};var Co,Ro={};var Ao,Fo,Mo={};function Do(){if(Fo)return Zr;Fo=1,Object.defineProperty(Zr,"__esModule",{value:!0});const e=to(),t=function(){if(oo)return no;oo=1,Object.defineProperty(no,"__esModule",{value:!0});const e=so(),t={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,e.validateTuple)(t,"items")};return no.default=t,no}(),r=so(),o=function(){if(io)return co;io=1,Object.defineProperty(co,"__esModule",{value:!0});const e=tt(),t=nt(),r=Et(),o=to(),n={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:t}})=>e.str`must NOT have more than ${t} items`,params:({params:{len:t}})=>e._`{limit: ${t}}`},code(e){const{schema:n,parentSchema:a,it:s}=e,{prefixItems:i}=a;s.items=!0,(0,t.alwaysValidSchema)(s,n)||(i?(0,o.validateAdditionalItems)(e,i):e.ok((0,r.validateArray)(e)))}};return co.default=n,co}(),n=po(),a=ho(),s=function(){if(go)return vo;go=1,Object.defineProperty(vo,"__esModule",{value:!0});const e=tt(),t=nt(),r={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:t})=>e._`{propertyName: ${t.propertyName}}`},code(r){const{gen:o,schema:n,data:a,it:s}=r;if((0,t.alwaysValidSchema)(s,n))return;const i=o.name("valid");o.forIn("key",a,t=>{r.setParams({propertyName:t}),r.subschema({keyword:"propertyNames",data:t,dataTypes:["string"],propertyName:t,compositeRule:!0},i),o.if((0,e.not)(i),()=>{r.error(!0),s.allErrors||o.break()})}),r.ok(i)}};return vo.default=r,vo}(),i=$o(),c=function(){if(wo)return _o;wo=1,Object.defineProperty(_o,"__esModule",{value:!0});const e=zt(),t=Et(),r=nt(),o=$o(),n={keyword:"properties",type:"object",schemaType:"object",code(n){const{gen:a,schema:s,parentSchema:i,data:c,it:d}=n;"all"===d.opts.removeAdditional&&void 0===i.additionalProperties&&o.default.code(new e.KeywordCxt(d,o.default,"additionalProperties"));const l=(0,t.allSchemaProperties)(s);for(const e of l)d.definedProperties.add(e);d.opts.unevaluated&&l.length&&!0!==d.props&&(d.props=r.mergeEvaluated.props(a,(0,r.toHash)(l),d.props));const u=l.filter(e=>!(0,r.alwaysValidSchema)(d,s[e]));if(0===u.length)return;const p=a.name("valid");for(const e of u)f(e)?m(e):(a.if((0,t.propertyInData)(a,c,e,d.opts.ownProperties)),m(e),d.allErrors||a.else().var(p,!0),a.endIf()),n.it.definedProperties.add(e),n.ok(p);function f(e){return d.opts.useDefaults&&!d.compositeRule&&void 0!==s[e].default}function m(e){n.subschema({keyword:"properties",schemaProp:e,dataProp:e},p)}}};return _o.default=n,_o}(),d=function(){if(ko)return Po;ko=1,Object.defineProperty(Po,"__esModule",{value:!0});const e=Et(),t=tt(),r=nt(),o=nt(),n={keyword:"patternProperties",type:"object",schemaType:"object",code(n){const{gen:a,schema:s,data:i,parentSchema:c,it:d}=n,{opts:l}=d,u=(0,e.allSchemaProperties)(s),p=u.filter(e=>(0,r.alwaysValidSchema)(d,s[e]));if(0===u.length||p.length===u.length&&(!d.opts.unevaluated||!0===d.props))return;const f=l.strictSchema&&!l.allowMatchingProperties&&c.properties,m=a.name("valid");!0===d.props||d.props instanceof t.Name||(d.props=(0,o.evaluatedPropsToName)(a,d.props));const{props:h}=d;function g(e){for(const t in f)new RegExp(e).test(t)&&(0,r.checkStrictMode)(d,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function v(r){a.forIn("key",i,s=>{a.if(t._`${(0,e.usePattern)(n,r)}.test(${s})`,()=>{const e=p.includes(r);e||n.subschema({keyword:"patternProperties",schemaProp:r,dataProp:s,dataPropType:o.Type.Str},m),d.opts.unevaluated&&!0!==h?a.assign(t._`${h}[${s}]`,!0):e||d.allErrors||a.if((0,t.not)(m),()=>a.break())})})}!function(){for(const e of u)f&&g(e),d.allErrors?v(e):(a.var(m,!0),v(e),a.if(m))}()}};return Po.default=n,Po}(),l=function(){if(So)return Eo;So=1,Object.defineProperty(Eo,"__esModule",{value:!0});const e=nt(),t={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){const{gen:r,schema:o,it:n}=t;if((0,e.alwaysValidSchema)(n,o))return void t.fail();const a=r.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},a),t.failResult(a,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};return Eo.default=t,Eo}(),u=function(){if(jo)return Oo;jo=1,Object.defineProperty(Oo,"__esModule",{value:!0});const e={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Et().validateUnion,error:{message:"must match a schema in anyOf"}};return Oo.default=e,Oo}(),p=function(){if(No)return Io;No=1,Object.defineProperty(Io,"__esModule",{value:!0});const e=tt(),t=nt(),r={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:t})=>e._`{passingSchemas: ${t.passing}}`},code(r){const{gen:o,schema:n,parentSchema:a,it:s}=r;if(!Array.isArray(n))throw new Error("ajv implementation error");if(s.opts.discriminator&&a.discriminator)return;const i=n,c=o.let("valid",!1),d=o.let("passing",null),l=o.name("_valid");r.setParams({passing:d}),o.block(function(){i.forEach((n,a)=>{let i;(0,t.alwaysValidSchema)(s,n)?o.var(l,!0):i=r.subschema({keyword:"oneOf",schemaProp:a,compositeRule:!0},l),a>0&&o.if(e._`${l} && ${c}`).assign(c,!1).assign(d,e._`[${d}, ${a}]`).else(),o.if(l,()=>{o.assign(c,!0),o.assign(d,a),i&&r.mergeEvaluated(i,e.Name)})})}),r.result(c,()=>r.reset(),()=>r.error(!0))}};return Io.default=r,Io}(),f=function(){if(xo)return To;xo=1,Object.defineProperty(To,"__esModule",{value:!0});const e=nt(),t={keyword:"allOf",schemaType:"array",code(t){const{gen:r,schema:o,it:n}=t;if(!Array.isArray(o))throw new Error("ajv implementation error");const a=r.name("valid");o.forEach((r,o)=>{if((0,e.alwaysValidSchema)(n,r))return;const s=t.subschema({keyword:"allOf",schemaProp:o},a);t.ok(a),t.mergeEvaluated(s)})}};return To.default=t,To}(),m=function(){if(Co)return Ro;Co=1,Object.defineProperty(Ro,"__esModule",{value:!0});const e=tt(),t=nt(),r={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:t})=>e.str`must match "${t.ifClause}" schema`,params:({params:t})=>e._`{failingKeyword: ${t.ifClause}}`},code(r){const{gen:n,parentSchema:a,it:s}=r;void 0===a.then&&void 0===a.else&&(0,t.checkStrictMode)(s,'"if" without "then" and "else" is ignored');const i=o(s,"then"),c=o(s,"else");if(!i&&!c)return;const d=n.let("valid",!0),l=n.name("_valid");if(function(){const e=r.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},l);r.mergeEvaluated(e)}(),r.reset(),i&&c){const e=n.let("ifClause");r.setParams({ifClause:e}),n.if(l,u("then",e),u("else",e))}else i?n.if(l,u("then")):n.if((0,e.not)(l),u("else"));function u(t,o){return()=>{const a=r.subschema({keyword:t},l);n.assign(d,l),r.mergeValidEvaluated(a,d),o?n.assign(o,e._`${t}`):r.setParams({ifClause:t})}}r.pass(d,()=>r.error(!0))}};function o(e,r){const o=e.schema[r];return void 0!==o&&!(0,t.alwaysValidSchema)(e,o)}return Ro.default=r,Ro}(),h=function(){if(Ao)return Mo;Ao=1,Object.defineProperty(Mo,"__esModule",{value:!0});const e=nt(),t={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:r,it:o}){void 0===r.if&&(0,e.checkStrictMode)(o,`"${t}" without "if" is ignored`)}};return Mo.default=t,Mo}();return Zr.default=function(g=!1){const v=[l.default,u.default,p.default,f.default,m.default,h.default,s.default,i.default,a.default,c.default,d.default];return g?v.push(t.default,o.default):v.push(e.default,r.default),v.push(n.default),v},Zr}var Vo,zo={},Uo={};function qo(){if(Vo)return Uo;Vo=1,Object.defineProperty(Uo,"__esModule",{value:!0}),Uo.dynamicAnchor=void 0;const e=tt(),t=dt(),r=Wt(),o=yr(),n={keyword:"$dynamicAnchor",schemaType:"string",code:e=>a(e,e.schema)};function a(n,a){const{gen:s,it:i}=n;i.schemaEnv.root.dynamicAnchors[a]=!0;const c=e._`${t.default.dynamicAnchors}${(0,e.getProperty)(a)}`,d="#"===i.errSchemaPath?i.validateName:function(e){const{schemaEnv:t,schema:n,self:a}=e.it,{root:s,baseId:i,localRefs:c,meta:d}=t.root,{schemaId:l}=a.opts,u=new r.SchemaEnv({schema:n,schemaId:l,root:s,baseId:i,localRefs:c,meta:d});return r.compileSchema.call(a,u),(0,o.getValidate)(e,u)}(n);s.if(e._`!${c}`,()=>s.assign(c,d))}return Uo.dynamicAnchor=a,Uo.default=n,Uo}var Ko,Lo={};function Bo(){if(Ko)return Lo;Ko=1,Object.defineProperty(Lo,"__esModule",{value:!0}),Lo.dynamicRef=void 0;const e=tt(),t=dt(),r=yr(),o={keyword:"$dynamicRef",schemaType:"string",code:e=>n(e,e.schema)};function n(o,n){const{gen:a,keyword:s,it:i}=o;if("#"!==n[0])throw new Error(`"${s}" only supports hash fragment reference`);const c=n.slice(1);if(i.allErrors)d();else{const e=a.let("valid",!1);d(e),o.ok(e)}function d(r){if(i.schemaEnv.root.dynamicAnchors[c]){const o=a.let("_v",e._`${t.default.dynamicAnchors}${(0,e.getProperty)(c)}`);a.if(o,l(o,r),l(i.validateName,r))}else l(i.validateName,r)()}function l(e,t){return t?()=>a.block(()=>{(0,r.callRef)(o,e),a.let(t,!0)}):()=>(0,r.callRef)(o,e)}}return Lo.dynamicRef=n,Lo.default=o,Lo}var Ho,Go={};var Jo,Wo,Yo={};function Qo(){if(Wo)return zo;Wo=1,Object.defineProperty(zo,"__esModule",{value:!0});const e=qo(),t=Bo(),r=function(){if(Ho)return Go;Ho=1,Object.defineProperty(Go,"__esModule",{value:!0});const e=qo(),t=nt(),r={keyword:"$recursiveAnchor",schemaType:"boolean",code(r){r.schema?(0,e.dynamicAnchor)(r,""):(0,t.checkStrictMode)(r.it,"$recursiveAnchor: false is ignored")}};return Go.default=r,Go}(),o=function(){if(Jo)return Yo;Jo=1,Object.defineProperty(Yo,"__esModule",{value:!0});const e=Bo(),t={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,e.dynamicRef)(t,t.schema)};return Yo.default=t,Yo}(),n=[e.default,t.default,r.default,o.default];return zo.default=n,zo}var Xo,Zo={},en={};var tn,rn={};var on,nn,an={};function sn(){if(nn)return Zo;nn=1,Object.defineProperty(Zo,"__esModule",{value:!0});const e=function(){if(Xo)return en;Xo=1,Object.defineProperty(en,"__esModule",{value:!0});const e=ho(),t={keyword:"dependentRequired",type:"object",schemaType:"object",error:e.error,code:t=>(0,e.validatePropertyDeps)(t)};return en.default=t,en}(),t=function(){if(tn)return rn;tn=1,Object.defineProperty(rn,"__esModule",{value:!0});const e=ho(),t={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,e.validateSchemaDeps)(t)};return rn.default=t,rn}(),r=function(){if(on)return an;on=1,Object.defineProperty(an,"__esModule",{value:!0});const e=nt(),t={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:t,parentSchema:r,it:o}){void 0===r.contains&&(0,e.checkStrictMode)(o,`"${t}" without "contains" is ignored`)}};return an.default=t,an}(),o=[e.default,t.default,r.default];return Zo.default=o,Zo}var cn,dn={},ln={};function un(){if(cn)return ln;cn=1,Object.defineProperty(ln,"__esModule",{value:!0});const e=tt(),t=nt(),r=dt(),o={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:t})=>e._`{unevaluatedProperty: ${t.unevaluatedProperty}}`},code(o){const{gen:n,schema:a,data:s,errsCount:i,it:c}=o;if(!i)throw new Error("ajv implementation error");const{allErrors:d,props:l}=c;function u(r){if(!1===a)return o.setParams({unevaluatedProperty:r}),o.error(),void(d||n.break());if(!(0,t.alwaysValidSchema)(c,a)){const a=n.name("valid");o.subschema({keyword:"unevaluatedProperties",dataProp:r,dataPropType:t.Type.Str},a),d||n.if((0,e.not)(a),()=>n.break())}}l instanceof e.Name?n.if(e._`${l} !== true`,()=>n.forIn("key",s,t=>n.if(function(t,r){return e._`!${t} || !${t}[${r}]`}(l,t),()=>u(t)))):!0!==l&&n.forIn("key",s,t=>void 0===l?u(t):n.if(function(t,r){const o=[];for(const n in t)!0===t[n]&&o.push(e._`${r} !== ${n}`);return(0,e.and)(...o)}(l,t),()=>u(t))),c.props=!0,o.ok(e._`${i} === ${r.default.errors}`)}};return ln.default=o,ln}var pn,fn,mn={};function hn(){if(pn)return mn;pn=1,Object.defineProperty(mn,"__esModule",{value:!0});const e=tt(),t=nt(),r={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:t}})=>e.str`must NOT have more than ${t} items`,params:({params:{len:t}})=>e._`{limit: ${t}}`},code(r){const{gen:o,schema:n,data:a,it:s}=r,i=s.items||0;if(!0===i)return;const c=o.const("len",e._`${a}.length`);if(!1===n)r.setParams({len:i}),r.fail(e._`${c} > ${i}`);else if("object"==typeof n&&!(0,t.alwaysValidSchema)(s,n)){const n=o.var("valid",e._`${c} <= ${i}`);o.if((0,e.not)(n),()=>function(n,a){o.forRange("i",a,c,a=>{r.subschema({keyword:"unevaluatedItems",dataProp:a,dataPropType:t.Type.Num},n),s.allErrors||o.if((0,e.not)(n),()=>o.break())})}(n,i)),r.ok(n)}s.items=!0}};return mn.default=r,mn}var gn,vn,yn={},bn={};function $n(){if(gn)return bn;gn=1,Object.defineProperty(bn,"__esModule",{value:!0});const e=tt(),t={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>e.str`must match format "${t}"`,params:({schemaCode:t})=>e._`{format: ${t}}`},code(t,r){const{gen:o,data:n,$data:a,schema:s,schemaCode:i,it:c}=t,{opts:d,errSchemaPath:l,schemaEnv:u,self:p}=c;d.validateFormats&&(a?function(){const a=o.scopeValue("formats",{ref:p.formats,code:d.code.formats}),s=o.const("fDef",e._`${a}[${i}]`),c=o.let("fType"),l=o.let("format");o.if(e._`typeof ${s} == "object" && !(${s} instanceof RegExp)`,()=>o.assign(c,e._`${s}.type || "string"`).assign(l,e._`${s}.validate`),()=>o.assign(c,e._`"string"`).assign(l,s)),t.fail$data((0,e.or)(!1===d.strictSchema?e.nil:e._`${i} && !${l}`,function(){const t=u.$async?e._`(${s}.async ? await ${l}(${n}) : ${l}(${n}))`:e._`${l}(${n})`,o=e._`(typeof ${l} == "function" ? ${t} : ${l}.test(${n}))`;return e._`${l} && ${l} !== true && ${c} === ${r} && !${o}`}()))}():function(){const a=p.formats[s];if(!a)return void function(){if(!1===d.strictSchema)return void p.logger.warn(e());throw new Error(e());function e(){return`unknown format "${s}" ignored in schema at path "${l}"`}}();if(!0===a)return;const[i,c,f]=function(t){const r=t instanceof RegExp?(0,e.regexpCode)(t):d.code.formats?e._`${d.code.formats}${(0,e.getProperty)(s)}`:void 0,n=o.scopeValue("formats",{key:s,ref:t,code:r});if("object"==typeof t&&!(t instanceof RegExp))return[t.type||"string",t.validate,e._`${n}.validate`];return["string",t,n]}(a);i===r&&t.pass(function(){if("object"==typeof a&&!(a instanceof RegExp)&&a.async){if(!u.$async)throw new Error("async format in sync schema");return e._`await ${f}(${n})`}return"function"==typeof c?e._`${f}(${n})`:e._`${f}.test(${n})`}())}())}};return bn.default=t,bn}var wn,_n,kn={};function Pn(){if(_n)return pr;_n=1,Object.defineProperty(pr,"__esModule",{value:!0});const e=br(),t=Qr(),r=Do(),o=Qo(),n=sn(),a=function(){if(fn)return dn;fn=1,Object.defineProperty(dn,"__esModule",{value:!0});const e=un(),t=hn(),r=[e.default,t.default];return dn.default=r,dn}(),s=function(){if(vn)return yn;vn=1,Object.defineProperty(yn,"__esModule",{value:!0});const e=[$n().default];return yn.default=e,yn}(),i=(wn||(wn=1,Object.defineProperty(kn,"__esModule",{value:!0}),kn.contentVocabulary=kn.metadataVocabulary=void 0,kn.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],kn.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),kn),c=[o.default,e.default,t.default,(0,r.default)(!0),s.default,i.metadataVocabulary,i.contentVocabulary,n.default,a.default];return pr.default=c,pr}var Sn,En,jn={},On={};function Nn(){if(En)return jn;En=1,Object.defineProperty(jn,"__esModule",{value:!0});const e=tt(),t=(Sn||(Sn=1,Object.defineProperty(On,"__esModule",{value:!0}),On.DiscrError=void 0,function(e){e.Tag="tag",e.Mapping="mapping"}(r||(On.DiscrError=r={}))),On);var r;const o=Wt(),n=Ht(),a=nt(),s={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:r}})=>e===t.DiscrError.Tag?`tag "${r}" must be string`:`value of tag "${r}" must be in oneOf`,params:({params:{discrError:t,tag:r,tagName:o}})=>e._`{error: ${t}, tag: ${o}, tagValue: ${r}}`},code(r){const{gen:s,data:i,schema:c,parentSchema:d,it:l}=r,{oneOf:u}=d;if(!l.opts.discriminator)throw new Error("discriminator: requires discriminator option");const p=c.propertyName;if("string"!=typeof p)throw new Error("discriminator: requires propertyName");if(c.mapping)throw new Error("discriminator: mapping is not supported");if(!u)throw new Error("discriminator: requires oneOf keyword");const f=s.let("valid",!1),m=s.const("tag",e._`${i}${(0,e.getProperty)(p)}`);function h(t){const o=s.name("valid"),n=r.subschema({keyword:"oneOf",schemaProp:t},o);return r.mergeEvaluated(n,e.Name),o}s.if(e._`typeof ${m} == "string"`,()=>function(){const i=function(){var e;const t={},r=i(d);let s=!0;for(let t=0;t<u.length;t++){let d=u[t];if((null==d?void 0:d.$ref)&&!(0,a.schemaHasRulesButRef)(d,l.self.RULES)){const e=d.$ref;if(d=o.resolveRef.call(l.self,l.schemaEnv.root,l.baseId,e),d instanceof o.SchemaEnv&&(d=d.schema),void 0===d)throw new n.default(l.opts.uriResolver,l.baseId,e)}const f=null===(e=null==d?void 0:d.properties)||void 0===e?void 0:e[p];if("object"!=typeof f)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${p}"`);s=s&&(r||i(d)),c(f,t)}if(!s)throw new Error(`discriminator: "${p}" must be required`);return t;function i({required:e}){return Array.isArray(e)&&e.includes(p)}function c(e,t){if(e.const)f(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${p}" must have "const" or "enum"`);for(const r of e.enum)f(r,t)}}function f(e,r){if("string"!=typeof e||e in t)throw new Error(`discriminator: "${p}" values must be unique strings`);t[e]=r}}();s.if(!1);for(const t in i)s.elseIf(e._`${m} === ${t}`),s.assign(f,h(i[t]));s.else(),r.error(!1,{discrError:t.DiscrError.Mapping,tag:m,tagName:p}),s.endIf()}(),()=>r.error(!1,{discrError:t.DiscrError.Tag,tag:m,tagName:p})),r.ok(f)}};return jn.default=s,jn}var In,xn,Tn={},Cn={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}},Rn={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}},An={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}},Fn={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}},Mn={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}},Dn={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}},Vn={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}},zn={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}};var Un=(xn||(xn=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv2020=void 0;const r=lr(),o=Pn(),n=Nn(),a=function(){if(In)return Tn;In=1,Object.defineProperty(Tn,"__esModule",{value:!0});const e=Cn,t=Rn,r=An,o=Fn,n=Mn,a=Dn,s=Vn,i=zn,c=["/properties"];return Tn.default=function(d){return[e,t,r,o,n,l(this,a),s,l(this,i)].forEach(e=>this.addMetaSchema(e,void 0,!1)),this;function l(e,t){return d?e.$dataMetaSchema(t,c):t}},Tn}(),s="https://json-schema.org/draft/2020-12/schema";class i extends r.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),o.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(n.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();const{$data:e,meta:t}=this.opts;t&&(a.default.call(this,e),this.refs["http://json-schema.org/schema"]=s)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}}t.Ajv2020=i,e.exports=t=i,e.exports.Ajv2020=i,Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var c=zt();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var d=tt();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var l=Kt();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return l.default}});var u=Ht();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return u.default}})}(Ke,Ke.exports)),Ke.exports),qn=Ue(Un);const Kn=U.object({templateEntry:U.string({required_error:"templateEntry is required in build section",invalid_type_error:"templateEntry must be a string"}).describe("Main entry point for the portal"),schemaEntry:U.string({required_error:"schemaEntry is required in build section",invalid_type_error:"schemaEntry must be a string"}).describe("Schema file for portal validation"),assetPath:U.string({invalid_type_error:"assetPath must be a string"}).optional().describe("Asset path for dev/preview builds"),githubRepo:U.string({invalid_type_error:"githubRepo must be a string"}).optional().describe("GitHub repo URL or local git remote"),version:U.string({required_error:"version is required in build section",invalid_type_error:"version must be a string"}).describe("Version from package.json"),timestamp:U.string({required_error:"timestamp is required in build section",invalid_type_error:"timestamp must be a string"}).describe("Current build timestamp (ISO8601)"),commitSha:U.string({required_error:"commitSha is required in build section",invalid_type_error:"commitSha must be a string"}).describe("Current git commit SHA"),annotations:U.record(U.string(),{invalid_type_error:"annotations must be a record of string values"}).optional().describe("Optional build annotations"),projectPage:U.string({invalid_type_error:"projectPage must be a string"}).optional().describe("Optional project homepage"),allowedExtensions:U.array(U.string({invalid_type_error:"Each allowed extension must be a string"}),{required_error:"allowedExtensions is required in build section",invalid_type_error:"allowedExtensions must be an array of strings"}).describe("List of allowed asset extensions (with leading dot)"),schema:U.record(U.unknown(),{invalid_type_error:"schema must be a record of unknown values"}).optional().describe("Optional schema for the portal"),config:U.record(U.unknown(),{invalid_type_error:"config must be a record of unknown values"}).optional().describe("Optional configuration for the portal")});U.object({name:U.string({required_error:"name is required in portal manifest",invalid_type_error:"name must be a string"}).describe("Short app key (unscoped, derived from package name)"),displayName:U.string({invalid_type_error:"displayName must be a string"}).optional().describe("Full package name, may include scope"),description:U.string({invalid_type_error:"description must be a string"}).optional().describe("Description of the portal"),build:Kn});const Ln=e("schema").description("Generate or validate a Fusion portal schema file.").addHelpText("after",["Generates or validates a Fusion portal schema file.","","Options:"," -o, --output Output file name (default: stdout)"," -v, --validate Validate the generated schema against a JSON file"," -d, --debug Enable debug mode for verbose logging","","Examples:"," $ fusion-framework-cli portal schema"," $ fusion-framework-cli portal schema --output portal.schema.json"," $ fusion-framework-cli portal schema --validate my-config.json"].join("\n")).addOption(ge({allowDev:!0})).option("-o, --output <string>","Output file name (default: stdout)","stdout").option("-d, --debug","Enable debug mode for verbose logging",!1).option("-v, --validate <file>","Validate the generated schema against a JSON file").argument("[schema]","Schema build file to use (e.g., portal.schema[.env]?.[ts,js,json])").action(async(e,t)=>{const r=new c("portal:schema",{debug:t.debug});r.debug("Manifest file:",e),r.debug("Current working directory:",process.cwd()),r.start("Generating schema for the application...");const o=await(async(e,t)=>{const r=[`portal.schema.${e.environment}`,"portal.schema"],o=await V(r,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async t=>{const r="function"==typeof t.default?await Promise.resolve(t.default(e)):t.default;if(!r)throw new Error("Schema function did not return a valid schema");return r}}});return{schema:o.config,path:o.path,extension:o.extension}})({command:"build",environment:t.environment,mode:"build",root:process.cwd()});if(r.debug("Schema:",JSON.stringify(o,null,2)),r.succeed("Schema generated successfully!"),t.output&&("stdout"===t.output?r.info("Schema:",JSON.stringify(o.schema,null,2)):(r.start(`Writing schema to ${t.output}`),((e,t,r)=>{const o=s(String(e));F(o)||M(o,{recursive:!0}),D(e,t,r)})(t.output,JSON.stringify(o.schema,null,2)),r.succeed(`Schema written to ${t.output}`)),process.exit(0)),t.validate){r.start("Validating schema against JSON file...");const e=new qn({strict:!0}).compile(o.schema),n=await z(t.validate);r.debug("JSON value:",JSON.stringify(n,null,2));e(n)?r.succeed("Schema validation passed!"):(r.fail("Schema validation failed:",JSON.stringify(e.errors??"Unknown error")),process.exit(1))}}),Bn=e("build").description("Build the Fusion portal from a manifest file with environment-specific settings.").addHelpText("after",["Builds the Fusion portal using a manifest file and environment-specific configuration.","","If no manifest is provided, the command will search for a default portal.manifest.[ts|js|json] in the current directory.","You can use environment variables to customize the build process (e.g., NODE_ENV, FUSION_PORTAL_*).","","Options:"," -d, --debug Enable debug mode for verbose logging","","Examples:"," $ fusion-framework-cli portal build"," $ fusion-framework-cli portal build portal.manifest.prod.ts --debug",""].join("\n")).option("-d, --debug","Enable debug mode for verbose logging",!1).argument("[manifest]","Manifest build file to use for building (e.g., portal.manifest[.env]?.[ts,js,json])").action(async(e,t)=>{const r=new c("portal:build",{debug:t.debug});await P({log:r,manifest:e})}),Hn=e("pack").description("Bundle the Fusion portal into a deployable archive.").addHelpText("after",["Bundles the Fusion portal using the provided manifest and schema into a zip archive for deployment.","","If no manifest is provided, a default portal.manifest.[ts|js|json] is used from the current directory.","","Options:"," -a, --archive Name of the output archive file (default: out/bundle.zip)"," --schema Schema file to use for validation"," -d, --debug Enable debug mode for verbose logging","","Examples:"," $ fusion-framework-cli portal pack"," $ fusion-framework-cli portal pack --archive my-portal.zip --schema portal.schema.json"," $ fusion-framework-cli portal pack portal.manifest.prod.ts --debug"].join("\n")).option("-a, --archive [string]","Name of the output archive file (default: out/bundle.zip)","out/bundle.zip").option("-d, --debug [boolean]","Enable debug mode for verbose logging",!1).option("--schema [string]","Schema file to use for validation").argument("[manifest]","Manifest file to use for bundling (e.g., portal.manifest[.env]?.[ts,js,json])").action(async(e,t)=>{const r=new c("portal:pack",{debug:t.debug});await S({log:r,manifest:e,archive:t.archive,schema:t.schema}).catch(e=>{r.error("Failed to create package:",e),process.exit(1)})}),Gn=_e(e("upload").description("Upload a Fusion portal bundle to the portal registry.").addHelpText("after",["Uploads a distributable Fusion portal bundle to the portal registry for deployment.","","Options:"," --env Target environment"," -d, --debug Enable debug mode for verbose logging","","Examples:"," $ fusion-framework-cli portal upload my-portal-bundle.zip"," $ fusion-framework-cli portal upload my-portal-bundle.zip --env prod"].join("\n")).option("-d, --debug [boolean]","Enable debug mode for verbose logging",!1).addOption(ge({allowDev:!1})).argument("<bundle>","Portal bundle to upload (e.g., out/bundle.zip)").action(async(e,t)=>{const r=new c("portal:upload",{debug:t.debug});r?.start("Initializing Fusion Framework...");const o=await m({env:t.env,auth:{token:t.token,tenantId:t.tenantId,clientId:t.clientId}});r?.succeed("Initialized Fusion Framework"),await E({log:r,framework:o,fileOrBundle:e}).catch(e=>{r.error("Failed to upload bundle:",e),process.exit(1)})})),Jn=_e(e("tag").description("Tag your Fusion portal with a specific version or label.").addHelpText("after",["Tags your Fusion portal with a specific version or label in the portal registry.","","Options:"," -n, --name Portal name (if not provided, resolved from manifest)"," -m, --manifest Manifest file to use for resolving portal name and version"," -v, --version Version to tag (if not provided, resolved from manifest)"," --env Target environment"," -d, --debug Enable debug mode for verbose logging"," --silent Silent mode, suppresses output except errors","","Examples:"," $ fusion-framework-cli portal tag latest"," $ fusion-framework-cli portal tag preview --env prod --manifest portal.manifest.prod.ts"].join("\n")).addOption(ge({allowDev:!1})).option("-m, --manifest <string>","Manifest file to use for resolving portal name and version (only used when --package is not provided)").option("-p, --package [package@version]","Package to tag (e.g., my-portal@1.0.0)").option("-v, --version <string>","Version to tag (if not provided, resolved from manifest)").option("-d, --debug","Enable debug mode for verbose logging").option("--silent","Silent mode, suppresses output except errors").argument("<tag>","Tag to apply (latest | preview)").action(async(e,t)=>{const r=t.silent?null:new c("app:tag",{debug:t.debug}),o={command:"build",environment:t.env,mode:process.env.NODE_ENV??"production",root:process.cwd()};let[n,a]=(t.package??"").split("@");if(!n||!a){const{manifest:e}=await k({log:r,manifest:t.manifest,env:o});e||(r?.error("😢 No portal manifest found. Please provide a valid manifest file or package name"),process.exit(1)),n=e.name,a=e.build.version}r?.start("Initializing Fusion Framework...");const s=await m({env:t.env,auth:{token:t.token,tenantId:t.tenantId,clientId:t.clientId}});r?.succeed("Initialized Fusion Framework"),j({tag:e,name:n,version:a,framework:s,log:r}).catch(e=>{r?.error("😢 Failed to tag application:",e),process.exit(1)})})),Wn=_e(e("publish").description("Build, upload, and tag your Fusion portal bundle for deployment.").addHelpText("after",["Builds, uploads, and tags your Fusion portal bundle for deployment to the portal registry.","","Options:"," --env Target environment"," -m, --manifest Manifest file to use for bundling"," --schema Schema file to use for validation"," -t, --tag Tag to apply to the published portal"," -d, --debug Enable debug mode for verbose logging","","Examples:"," $ fusion-framework-cli portal publish"," $ fusion-framework-cli portal publish --env prod --manifest portal.manifest.prod.ts"].join("\n")).option("-d, --debug","Enable debug mode for verbose logging",!1).addOption(ge({allowDev:!1})).option("-m, --manifest [string]","Manifest file to use for bundling (e.g., portal.manifest.ts)").option("--schema [string]","Schema file to use for validation").option("-t, --tag [string]",`Tag to apply to the published portal (${Object.values(O).join(" | ")})`,O.Latest).action(async e=>{const t=new c("portal:publish",{debug:e.debug});t?.info("Using environment:",pe.redBright(e.env)),t.start("📦 Bundling Portal Template...");const r=await S({log:t,manifest:e.manifest,schema:e.schema}).catch(e=>{t.error("😢 Failed to create bundle:",e),process.exit(1)});t.succeed("📦 Bundling completed"),t?.start("💾 Initializing Fusion Framework...");const o=await m({env:e.env,auth:{token:e.token,tenantId:e.tenantId,clientId:e.clientId}});t?.succeed("💾 Initialized Fusion Framework"),t.start("🚀 Uploading Portal Template..."),await E({log:t,framework:o,fileOrBundle:r.archive}).catch(e=>{t.error("😢 Failed to upload bundle:",e),process.exit(1)}),t.succeed("🚀 Upload completed"),t.start("🏷️ Tagging Portal Template..."),await j({tag:e.tag,name:r.manifest.name,version:r.manifest.build.version,framework:o,log:t}).catch(e=>{t.error("😢 Failed to tag Portal Template:",e),process.exit(1)}),t.succeed("🏷️ Tagging completed")})),Yn=_e(e("config").description("Generate or publish the Fusion portal configuration file.").addHelpText("after",["Generates and/or publishes the Fusion portal configuration.","","By default, outputs the config to stdout or a file. Use --publish to upload to the portal registry.","","Options:"," --publish Publish config to Fusion portal registry"," --identifier Portal identifier (required with --publish)"," -o, --output Output to stdout or a file (default: stdout)"," --env Target environment"," --debug Enable debug mode for verbose logging","","Examples:"," $ fusion-framework-cli portal config --identifier my-portal@1.2.3 -o stdout portal.config.ts"," $ fusion-framework-cli portal config --publish --env prod --identifier my-portal@1.2.3 portal.config.ts"].join("\n")).option("--debug","Enable debug mode for verbose logging").option("--silent","Silent mode, suppresses output except errors").option("--publish <name@version>","Publish config to Fusion portal registry, Identifier of the portal, example my-portal@1.2.3").addOption(ge({allowDev:!0})).option("-o, --output <stdout|path>","Output the result to stdout or a file (ignored with --publish, default: stdout)","stdout").argument("[config]","Path to the portal config file (e.g., portal.config[.env]?.[ts,js,json])").action(async(e,t)=>{const r=t.silent?null:new c("portal:config",{debug:!!t.debug});if(t.publish){const[e,o]=t.publish.split("@")||[];return e&&o||(r?.fail("🤪","Portal identifier is required when using",pe.blue("--publish")),r?.info("Example: fusion-framework-cli portal config --publish my-portal@1.2.3"),process.exit(1)),"dev"===t.env&&(r?.fail("🤪",pe.blue("--env"),'cannot be "dev" when',pe.blue("--publish")," is used"),process.exit(1)),N({config:t.config,portal:{name:e,version:o},environment:t.env,auth:"token"in t?{token:t.token}:t,debug:t.debug})}const{config:o}=await I({log:r,config:e,env:{environment:t.env},output:"stdout"===t.output?void 0:t.output});"stdout"===t.output&&x.write(JSON.stringify(o,null,2))})),Qn=e("portal").description("Develop and deploy portal templates").addCommand(Ve).addCommand(ze).addCommand(Ln).addCommand(Bn).addCommand(Hn).addCommand(Gn).addCommand(Jn).addCommand(Wn).addCommand(Yn);const[Xn]=process.versions.node.split(".").map(Number);Xn<Number(20)&&(console.error(pe.red("[ERROR]"),"Fusion Framework CLI requires Node.js 20 or higher."),process.exit(1));Xn!==Number(22)&&console.warn(pe.yellow("[WARNING]"),"Node.js 22.x (LTS) is recommended for best compatibility. You are using Node.js",process.versions.node);const Zn=i({cwd:n(import.meta.url)});if(!Zn)throw Error("failed to find program root");process.env.CLI_BIN=a(s(Zn.path),String(Zn.packageJson.bin?.["fusion-framework-cli"]));const ea=new o;ea.name(Zn.packageJson.name),ea.description([`${Zn.packageJson.name}@${Zn.packageJson.version}`,"","Fusion Framework CLI","","A toolkit for building, packaging, deploying, and managing Fusion applications and portals.","","• Run fusion <command> --help for details on any command.","• For documentation, issues, and source code, visit:",` ${Zn.packageJson.homepage}`].join("\n")),ea.version(Zn.packageJson.version,"-V, --version","CLI version"),(e=>{e.addCommand(xe),e.addCommand(Fe),e.addCommand(De),e.addCommand(Qn)})(ea),ea.parse();
7
+ deps: ${o}}`};const n={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(e){const[t,r]=function({schema:e}){const t={},r={};for(const o in e){if("__proto__"===o)continue;(Array.isArray(e[o])?t:r)[o]=e[o]}return[t,r]}(e);a(e,t),s(e,r)}};function a(e,r=e.schema){const{gen:n,data:a,it:s}=e;if(0===Object.keys(r).length)return;const i=n.let("missing");for(const c in r){const d=r[c];if(0===d.length)continue;const l=(0,o.propertyInData)(n,a,c,s.opts.ownProperties);e.setParams({property:c,depsCount:d.length,deps:d.join(", ")}),s.allErrors?n.if(l,()=>{for(const t of d)(0,o.checkReportMissingProp)(e,t)}):(n.if(t._`${l} && (${(0,o.checkMissingProp)(e,d,i)})`),(0,o.reportMissingProp)(e,i),n.else())}}function s(e,t=e.schema){const{gen:n,data:a,keyword:s,it:i}=e,c=n.name("valid");for(const d in t)(0,r.alwaysValidSchema)(i,t[d])||(n.if((0,o.propertyInData)(n,a,d,i.opts.ownProperties),()=>{const t=e.subschema({keyword:s,schemaProp:d},c);e.mergeValidEvaluated(t,c)},()=>n.var(c,!0)),e.ok(c))}e.validatePropertyDeps=a,e.validateSchemaDeps=s,e.default=n}(fo)),fo}var ho,go={};var yo,vo={};function bo(){if(yo)return vo;yo=1,Object.defineProperty(vo,"__esModule",{value:!0});const e=Et(),t=et(),r=ct(),o=ot(),n={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:{message:"must NOT have additional properties",params:({params:e})=>t._`{additionalProperty: ${e.additionalProperty}}`},code(n){const{gen:a,schema:s,parentSchema:i,data:c,errsCount:d,it:l}=n;if(!d)throw new Error("ajv implementation error");const{allErrors:u,opts:p}=l;if(l.props=!0,"all"!==p.removeAdditional&&(0,o.alwaysValidSchema)(l,s))return;const f=(0,e.allSchemaProperties)(i.properties),m=(0,e.allSchemaProperties)(i.patternProperties);function h(e){a.code(t._`delete ${c}[${e}]`)}function g(e){if("all"===p.removeAdditional||p.removeAdditional&&!1===s)h(e);else{if(!1===s)return n.setParams({additionalProperty:e}),n.error(),void(u||a.break());if("object"==typeof s&&!(0,o.alwaysValidSchema)(l,s)){const r=a.name("valid");"failing"===p.removeAdditional?(y(e,r,!1),a.if((0,t.not)(r),()=>{n.reset(),h(e)})):(y(e,r),u||a.if((0,t.not)(r),()=>a.break()))}}}function y(e,t,r){const a={keyword:"additionalProperties",dataProp:e,dataPropType:o.Type.Str};!1===r&&Object.assign(a,{compositeRule:!0,createErrors:!1,allErrors:!1}),n.subschema(a,t)}a.forIn("key",c,r=>{f.length||m.length?a.if(function(r){let s;if(f.length>8){const t=(0,o.schemaRefOrVal)(l,i.properties,"properties");s=(0,e.isOwnProperty)(a,t,r)}else s=f.length?(0,t.or)(...f.map(e=>t._`${r} === ${e}`)):t.nil;return m.length&&(s=(0,t.or)(s,...m.map(o=>t._`${(0,e.usePattern)(n,o)}.test(${r})`))),(0,t.not)(s)}(r),()=>g(r)):g(r)}),n.ok(t._`${d} === ${r.default.errors}`)}};return vo.default=n,vo}var $o,wo={};var _o,ko={};var Po,Eo={};var So,jo={};var No,Io={};var Oo,To={};var xo,Co={};var Ro,Ao,Mo={};function Do(){if(Ao)return Xr;Ao=1,Object.defineProperty(Xr,"__esModule",{value:!0});const e=eo(),t=function(){if(ro)return oo;ro=1,Object.defineProperty(oo,"__esModule",{value:!0});const e=ao(),t={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,e.validateTuple)(t,"items")};return oo.default=t,oo}(),r=ao(),o=function(){if(so)return io;so=1,Object.defineProperty(io,"__esModule",{value:!0});const e=et(),t=ot(),r=Et(),o=eo(),n={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:{message:({params:{len:t}})=>e.str`must NOT have more than ${t} items`,params:({params:{len:t}})=>e._`{limit: ${t}}`},code(e){const{schema:n,parentSchema:a,it:s}=e,{prefixItems:i}=a;s.items=!0,(0,t.alwaysValidSchema)(s,n)||(i?(0,o.validateAdditionalItems)(e,i):e.ok((0,r.validateArray)(e)))}};return io.default=n,io}(),n=uo(),a=mo(),s=function(){if(ho)return go;ho=1,Object.defineProperty(go,"__esModule",{value:!0});const e=et(),t=ot(),r={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:{message:"property name must be valid",params:({params:t})=>e._`{propertyName: ${t.propertyName}}`},code(r){const{gen:o,schema:n,data:a,it:s}=r;if((0,t.alwaysValidSchema)(s,n))return;const i=o.name("valid");o.forIn("key",a,t=>{r.setParams({propertyName:t}),r.subschema({keyword:"propertyNames",data:t,dataTypes:["string"],propertyName:t,compositeRule:!0},i),o.if((0,e.not)(i),()=>{r.error(!0),s.allErrors||o.break()})}),r.ok(i)}};return go.default=r,go}(),i=bo(),c=function(){if($o)return wo;$o=1,Object.defineProperty(wo,"__esModule",{value:!0});const e=Vt(),t=Et(),r=ot(),o=bo(),n={keyword:"properties",type:"object",schemaType:"object",code(n){const{gen:a,schema:s,parentSchema:i,data:c,it:d}=n;"all"===d.opts.removeAdditional&&void 0===i.additionalProperties&&o.default.code(new e.KeywordCxt(d,o.default,"additionalProperties"));const l=(0,t.allSchemaProperties)(s);for(const e of l)d.definedProperties.add(e);d.opts.unevaluated&&l.length&&!0!==d.props&&(d.props=r.mergeEvaluated.props(a,(0,r.toHash)(l),d.props));const u=l.filter(e=>!(0,r.alwaysValidSchema)(d,s[e]));if(0===u.length)return;const p=a.name("valid");for(const e of u)f(e)?m(e):(a.if((0,t.propertyInData)(a,c,e,d.opts.ownProperties)),m(e),d.allErrors||a.else().var(p,!0),a.endIf()),n.it.definedProperties.add(e),n.ok(p);function f(e){return d.opts.useDefaults&&!d.compositeRule&&void 0!==s[e].default}function m(e){n.subschema({keyword:"properties",schemaProp:e,dataProp:e},p)}}};return wo.default=n,wo}(),d=function(){if(_o)return ko;_o=1,Object.defineProperty(ko,"__esModule",{value:!0});const e=Et(),t=et(),r=ot(),o=ot(),n={keyword:"patternProperties",type:"object",schemaType:"object",code(n){const{gen:a,schema:s,data:i,parentSchema:c,it:d}=n,{opts:l}=d,u=(0,e.allSchemaProperties)(s),p=u.filter(e=>(0,r.alwaysValidSchema)(d,s[e]));if(0===u.length||p.length===u.length&&(!d.opts.unevaluated||!0===d.props))return;const f=l.strictSchema&&!l.allowMatchingProperties&&c.properties,m=a.name("valid");!0===d.props||d.props instanceof t.Name||(d.props=(0,o.evaluatedPropsToName)(a,d.props));const{props:h}=d;function g(e){for(const t in f)new RegExp(e).test(t)&&(0,r.checkStrictMode)(d,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function y(r){a.forIn("key",i,s=>{a.if(t._`${(0,e.usePattern)(n,r)}.test(${s})`,()=>{const e=p.includes(r);e||n.subschema({keyword:"patternProperties",schemaProp:r,dataProp:s,dataPropType:o.Type.Str},m),d.opts.unevaluated&&!0!==h?a.assign(t._`${h}[${s}]`,!0):e||d.allErrors||a.if((0,t.not)(m),()=>a.break())})})}!function(){for(const e of u)f&&g(e),d.allErrors?y(e):(a.var(m,!0),y(e),a.if(m))}()}};return ko.default=n,ko}(),l=function(){if(Po)return Eo;Po=1,Object.defineProperty(Eo,"__esModule",{value:!0});const e=ot(),t={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){const{gen:r,schema:o,it:n}=t;if((0,e.alwaysValidSchema)(n,o))return void t.fail();const a=r.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},a),t.failResult(a,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};return Eo.default=t,Eo}(),u=function(){if(So)return jo;So=1,Object.defineProperty(jo,"__esModule",{value:!0});const e={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Et().validateUnion,error:{message:"must match a schema in anyOf"}};return jo.default=e,jo}(),p=function(){if(No)return Io;No=1,Object.defineProperty(Io,"__esModule",{value:!0});const e=et(),t=ot(),r={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:{message:"must match exactly one schema in oneOf",params:({params:t})=>e._`{passingSchemas: ${t.passing}}`},code(r){const{gen:o,schema:n,parentSchema:a,it:s}=r;if(!Array.isArray(n))throw new Error("ajv implementation error");if(s.opts.discriminator&&a.discriminator)return;const i=n,c=o.let("valid",!1),d=o.let("passing",null),l=o.name("_valid");r.setParams({passing:d}),o.block(function(){i.forEach((n,a)=>{let i;(0,t.alwaysValidSchema)(s,n)?o.var(l,!0):i=r.subschema({keyword:"oneOf",schemaProp:a,compositeRule:!0},l),a>0&&o.if(e._`${l} && ${c}`).assign(c,!1).assign(d,e._`[${d}, ${a}]`).else(),o.if(l,()=>{o.assign(c,!0),o.assign(d,a),i&&r.mergeEvaluated(i,e.Name)})})}),r.result(c,()=>r.reset(),()=>r.error(!0))}};return Io.default=r,Io}(),f=function(){if(Oo)return To;Oo=1,Object.defineProperty(To,"__esModule",{value:!0});const e=ot(),t={keyword:"allOf",schemaType:"array",code(t){const{gen:r,schema:o,it:n}=t;if(!Array.isArray(o))throw new Error("ajv implementation error");const a=r.name("valid");o.forEach((r,o)=>{if((0,e.alwaysValidSchema)(n,r))return;const s=t.subschema({keyword:"allOf",schemaProp:o},a);t.ok(a),t.mergeEvaluated(s)})}};return To.default=t,To}(),m=function(){if(xo)return Co;xo=1,Object.defineProperty(Co,"__esModule",{value:!0});const e=et(),t=ot(),r={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:{message:({params:t})=>e.str`must match "${t.ifClause}" schema`,params:({params:t})=>e._`{failingKeyword: ${t.ifClause}}`},code(r){const{gen:n,parentSchema:a,it:s}=r;void 0===a.then&&void 0===a.else&&(0,t.checkStrictMode)(s,'"if" without "then" and "else" is ignored');const i=o(s,"then"),c=o(s,"else");if(!i&&!c)return;const d=n.let("valid",!0),l=n.name("_valid");if(function(){const e=r.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},l);r.mergeEvaluated(e)}(),r.reset(),i&&c){const e=n.let("ifClause");r.setParams({ifClause:e}),n.if(l,u("then",e),u("else",e))}else i?n.if(l,u("then")):n.if((0,e.not)(l),u("else"));function u(t,o){return()=>{const a=r.subschema({keyword:t},l);n.assign(d,l),r.mergeValidEvaluated(a,d),o?n.assign(o,e._`${t}`):r.setParams({ifClause:t})}}r.pass(d,()=>r.error(!0))}};function o(e,r){const o=e.schema[r];return void 0!==o&&!(0,t.alwaysValidSchema)(e,o)}return Co.default=r,Co}(),h=function(){if(Ro)return Mo;Ro=1,Object.defineProperty(Mo,"__esModule",{value:!0});const e=ot(),t={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:r,it:o}){void 0===r.if&&(0,e.checkStrictMode)(o,`"${t}" without "if" is ignored`)}};return Mo.default=t,Mo}();return Xr.default=function(g=!1){const y=[l.default,u.default,p.default,f.default,m.default,h.default,s.default,i.default,a.default,c.default,d.default];return g?y.push(t.default,o.default):y.push(e.default,r.default),y.push(n.default),y},Xr}var Fo,Vo={},zo={};function Uo(){if(Fo)return zo;Fo=1,Object.defineProperty(zo,"__esModule",{value:!0}),zo.dynamicAnchor=void 0;const e=et(),t=ct(),r=Jt(),o=yr(),n={keyword:"$dynamicAnchor",schemaType:"string",code:e=>a(e,e.schema)};function a(n,a){const{gen:s,it:i}=n;i.schemaEnv.root.dynamicAnchors[a]=!0;const c=e._`${t.default.dynamicAnchors}${(0,e.getProperty)(a)}`,d="#"===i.errSchemaPath?i.validateName:function(e){const{schemaEnv:t,schema:n,self:a}=e.it,{root:s,baseId:i,localRefs:c,meta:d}=t.root,{schemaId:l}=a.opts,u=new r.SchemaEnv({schema:n,schemaId:l,root:s,baseId:i,localRefs:c,meta:d});return r.compileSchema.call(a,u),(0,o.getValidate)(e,u)}(n);s.if(e._`!${c}`,()=>s.assign(c,d))}return zo.dynamicAnchor=a,zo.default=n,zo}var qo,Ko={};function Lo(){if(qo)return Ko;qo=1,Object.defineProperty(Ko,"__esModule",{value:!0}),Ko.dynamicRef=void 0;const e=et(),t=ct(),r=yr(),o={keyword:"$dynamicRef",schemaType:"string",code:e=>n(e,e.schema)};function n(o,n){const{gen:a,keyword:s,it:i}=o;if("#"!==n[0])throw new Error(`"${s}" only supports hash fragment reference`);const c=n.slice(1);if(i.allErrors)d();else{const e=a.let("valid",!1);d(e),o.ok(e)}function d(r){if(i.schemaEnv.root.dynamicAnchors[c]){const o=a.let("_v",e._`${t.default.dynamicAnchors}${(0,e.getProperty)(c)}`);a.if(o,l(o,r),l(i.validateName,r))}else l(i.validateName,r)()}function l(e,t){return t?()=>a.block(()=>{(0,r.callRef)(o,e),a.let(t,!0)}):()=>(0,r.callRef)(o,e)}}return Ko.dynamicRef=n,Ko.default=o,Ko}var Bo,Ho={};var Go,Jo,Wo={};function Yo(){if(Jo)return Vo;Jo=1,Object.defineProperty(Vo,"__esModule",{value:!0});const e=Uo(),t=Lo(),r=function(){if(Bo)return Ho;Bo=1,Object.defineProperty(Ho,"__esModule",{value:!0});const e=Uo(),t=ot(),r={keyword:"$recursiveAnchor",schemaType:"boolean",code(r){r.schema?(0,e.dynamicAnchor)(r,""):(0,t.checkStrictMode)(r.it,"$recursiveAnchor: false is ignored")}};return Ho.default=r,Ho}(),o=function(){if(Go)return Wo;Go=1,Object.defineProperty(Wo,"__esModule",{value:!0});const e=Lo(),t={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,e.dynamicRef)(t,t.schema)};return Wo.default=t,Wo}(),n=[e.default,t.default,r.default,o.default];return Vo.default=n,Vo}var Qo,Xo={},Zo={};var en,tn={};var rn,on,nn={};function an(){if(on)return Xo;on=1,Object.defineProperty(Xo,"__esModule",{value:!0});const e=function(){if(Qo)return Zo;Qo=1,Object.defineProperty(Zo,"__esModule",{value:!0});const e=mo(),t={keyword:"dependentRequired",type:"object",schemaType:"object",error:e.error,code:t=>(0,e.validatePropertyDeps)(t)};return Zo.default=t,Zo}(),t=function(){if(en)return tn;en=1,Object.defineProperty(tn,"__esModule",{value:!0});const e=mo(),t={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,e.validateSchemaDeps)(t)};return tn.default=t,tn}(),r=function(){if(rn)return nn;rn=1,Object.defineProperty(nn,"__esModule",{value:!0});const e=ot(),t={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:t,parentSchema:r,it:o}){void 0===r.contains&&(0,e.checkStrictMode)(o,`"${t}" without "contains" is ignored`)}};return nn.default=t,nn}(),o=[e.default,t.default,r.default];return Xo.default=o,Xo}var sn,cn={},dn={};function ln(){if(sn)return dn;sn=1,Object.defineProperty(dn,"__esModule",{value:!0});const e=et(),t=ot(),r=ct(),o={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:t})=>e._`{unevaluatedProperty: ${t.unevaluatedProperty}}`},code(o){const{gen:n,schema:a,data:s,errsCount:i,it:c}=o;if(!i)throw new Error("ajv implementation error");const{allErrors:d,props:l}=c;function u(r){if(!1===a)return o.setParams({unevaluatedProperty:r}),o.error(),void(d||n.break());if(!(0,t.alwaysValidSchema)(c,a)){const a=n.name("valid");o.subschema({keyword:"unevaluatedProperties",dataProp:r,dataPropType:t.Type.Str},a),d||n.if((0,e.not)(a),()=>n.break())}}l instanceof e.Name?n.if(e._`${l} !== true`,()=>n.forIn("key",s,t=>n.if(function(t,r){return e._`!${t} || !${t}[${r}]`}(l,t),()=>u(t)))):!0!==l&&n.forIn("key",s,t=>void 0===l?u(t):n.if(function(t,r){const o=[];for(const n in t)!0===t[n]&&o.push(e._`${r} !== ${n}`);return(0,e.and)(...o)}(l,t),()=>u(t))),c.props=!0,o.ok(e._`${i} === ${r.default.errors}`)}};return dn.default=o,dn}var un,pn,fn={};function mn(){if(un)return fn;un=1,Object.defineProperty(fn,"__esModule",{value:!0});const e=et(),t=ot(),r={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:{message:({params:{len:t}})=>e.str`must NOT have more than ${t} items`,params:({params:{len:t}})=>e._`{limit: ${t}}`},code(r){const{gen:o,schema:n,data:a,it:s}=r,i=s.items||0;if(!0===i)return;const c=o.const("len",e._`${a}.length`);if(!1===n)r.setParams({len:i}),r.fail(e._`${c} > ${i}`);else if("object"==typeof n&&!(0,t.alwaysValidSchema)(s,n)){const n=o.var("valid",e._`${c} <= ${i}`);o.if((0,e.not)(n),()=>function(n,a){o.forRange("i",a,c,a=>{r.subschema({keyword:"unevaluatedItems",dataProp:a,dataPropType:t.Type.Num},n),s.allErrors||o.if((0,e.not)(n),()=>o.break())})}(n,i)),r.ok(n)}s.items=!0}};return fn.default=r,fn}var hn,gn,yn={},vn={};function bn(){if(hn)return vn;hn=1,Object.defineProperty(vn,"__esModule",{value:!0});const e=et(),t={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:{message:({schemaCode:t})=>e.str`must match format "${t}"`,params:({schemaCode:t})=>e._`{format: ${t}}`},code(t,r){const{gen:o,data:n,$data:a,schema:s,schemaCode:i,it:c}=t,{opts:d,errSchemaPath:l,schemaEnv:u,self:p}=c;d.validateFormats&&(a?function(){const a=o.scopeValue("formats",{ref:p.formats,code:d.code.formats}),s=o.const("fDef",e._`${a}[${i}]`),c=o.let("fType"),l=o.let("format");o.if(e._`typeof ${s} == "object" && !(${s} instanceof RegExp)`,()=>o.assign(c,e._`${s}.type || "string"`).assign(l,e._`${s}.validate`),()=>o.assign(c,e._`"string"`).assign(l,s)),t.fail$data((0,e.or)(!1===d.strictSchema?e.nil:e._`${i} && !${l}`,function(){const t=u.$async?e._`(${s}.async ? await ${l}(${n}) : ${l}(${n}))`:e._`${l}(${n})`,o=e._`(typeof ${l} == "function" ? ${t} : ${l}.test(${n}))`;return e._`${l} && ${l} !== true && ${c} === ${r} && !${o}`}()))}():function(){const a=p.formats[s];if(!a)return void function(){if(!1===d.strictSchema)return void p.logger.warn(e());throw new Error(e());function e(){return`unknown format "${s}" ignored in schema at path "${l}"`}}();if(!0===a)return;const[i,c,f]=function(t){const r=t instanceof RegExp?(0,e.regexpCode)(t):d.code.formats?e._`${d.code.formats}${(0,e.getProperty)(s)}`:void 0,n=o.scopeValue("formats",{key:s,ref:t,code:r});if("object"==typeof t&&!(t instanceof RegExp))return[t.type||"string",t.validate,e._`${n}.validate`];return["string",t,n]}(a);i===r&&t.pass(function(){if("object"==typeof a&&!(a instanceof RegExp)&&a.async){if(!u.$async)throw new Error("async format in sync schema");return e._`await ${f}(${n})`}return"function"==typeof c?e._`${f}(${n})`:e._`${f}.test(${n})`}())}())}};return vn.default=t,vn}var $n,wn,_n={};function kn(){if(wn)return ur;wn=1,Object.defineProperty(ur,"__esModule",{value:!0});const e=vr(),t=Yr(),r=Do(),o=Yo(),n=an(),a=function(){if(pn)return cn;pn=1,Object.defineProperty(cn,"__esModule",{value:!0});const e=ln(),t=mn(),r=[e.default,t.default];return cn.default=r,cn}(),s=function(){if(gn)return yn;gn=1,Object.defineProperty(yn,"__esModule",{value:!0});const e=[bn().default];return yn.default=e,yn}(),i=($n||($n=1,Object.defineProperty(_n,"__esModule",{value:!0}),_n.contentVocabulary=_n.metadataVocabulary=void 0,_n.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],_n.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),_n),c=[o.default,e.default,t.default,(0,r.default)(!0),s.default,i.metadataVocabulary,i.contentVocabulary,n.default,a.default];return ur.default=c,ur}var Pn,En,Sn={},jn={};function Nn(){if(En)return Sn;En=1,Object.defineProperty(Sn,"__esModule",{value:!0});const e=et(),t=(Pn||(Pn=1,Object.defineProperty(jn,"__esModule",{value:!0}),jn.DiscrError=void 0,function(e){e.Tag="tag",e.Mapping="mapping"}(r||(jn.DiscrError=r={}))),jn);var r;const o=Jt(),n=Bt(),a=ot(),s={keyword:"discriminator",type:"object",schemaType:"object",error:{message:({params:{discrError:e,tagName:r}})=>e===t.DiscrError.Tag?`tag "${r}" must be string`:`value of tag "${r}" must be in oneOf`,params:({params:{discrError:t,tag:r,tagName:o}})=>e._`{error: ${t}, tag: ${o}, tagValue: ${r}}`},code(r){const{gen:s,data:i,schema:c,parentSchema:d,it:l}=r,{oneOf:u}=d;if(!l.opts.discriminator)throw new Error("discriminator: requires discriminator option");const p=c.propertyName;if("string"!=typeof p)throw new Error("discriminator: requires propertyName");if(c.mapping)throw new Error("discriminator: mapping is not supported");if(!u)throw new Error("discriminator: requires oneOf keyword");const f=s.let("valid",!1),m=s.const("tag",e._`${i}${(0,e.getProperty)(p)}`);function h(t){const o=s.name("valid"),n=r.subschema({keyword:"oneOf",schemaProp:t},o);return r.mergeEvaluated(n,e.Name),o}s.if(e._`typeof ${m} == "string"`,()=>function(){const i=function(){var e;const t={},r=i(d);let s=!0;for(let t=0;t<u.length;t++){let d=u[t];if((null==d?void 0:d.$ref)&&!(0,a.schemaHasRulesButRef)(d,l.self.RULES)){const e=d.$ref;if(d=o.resolveRef.call(l.self,l.schemaEnv.root,l.baseId,e),d instanceof o.SchemaEnv&&(d=d.schema),void 0===d)throw new n.default(l.opts.uriResolver,l.baseId,e)}const f=null===(e=null==d?void 0:d.properties)||void 0===e?void 0:e[p];if("object"!=typeof f)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${p}"`);s=s&&(r||i(d)),c(f,t)}if(!s)throw new Error(`discriminator: "${p}" must be required`);return t;function i({required:e}){return Array.isArray(e)&&e.includes(p)}function c(e,t){if(e.const)f(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${p}" must have "const" or "enum"`);for(const r of e.enum)f(r,t)}}function f(e,r){if("string"!=typeof e||e in t)throw new Error(`discriminator: "${p}" values must be unique strings`);t[e]=r}}();s.if(!1);for(const t in i)s.elseIf(e._`${m} === ${t}`),s.assign(f,h(i[t]));s.else(),r.error(!1,{discrError:t.DiscrError.Mapping,tag:m,tagName:p}),s.endIf()}(),()=>r.error(!1,{discrError:t.DiscrError.Tag,tag:m,tagName:p})),r.ok(f)}};return Sn.default=s,Sn}var In,On,Tn={},xn={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/schema",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0,"https://json-schema.org/draft/2020-12/vocab/applicator":!0,"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0,"https://json-schema.org/draft/2020-12/vocab/validation":!0,"https://json-schema.org/draft/2020-12/vocab/meta-data":!0,"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0,"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Core and Validation specifications meta-schema",allOf:[{$ref:"meta/core"},{$ref:"meta/applicator"},{$ref:"meta/unevaluated"},{$ref:"meta/validation"},{$ref:"meta/meta-data"},{$ref:"meta/format-annotation"},{$ref:"meta/content"}],type:["object","boolean"],$comment:"This meta-schema also defines keywords that have appeared in previous drafts in order to prevent incompatible extensions as they remain in common use.",properties:{definitions:{$comment:'"definitions" has been replaced by "$defs".',type:"object",additionalProperties:{$dynamicRef:"#meta"},deprecated:!0,default:{}},dependencies:{$comment:'"dependencies" has been split and replaced by "dependentSchemas" and "dependentRequired" in order to serve their differing semantics.',type:"object",additionalProperties:{anyOf:[{$dynamicRef:"#meta"},{$ref:"meta/validation#/$defs/stringArray"}]},deprecated:!0,default:{}},$recursiveAnchor:{$comment:'"$recursiveAnchor" has been replaced by "$dynamicAnchor".',$ref:"meta/core#/$defs/anchorString",deprecated:!0},$recursiveRef:{$comment:'"$recursiveRef" has been replaced by "$dynamicRef".',$ref:"meta/core#/$defs/uriReferenceString",deprecated:!0}}},Cn={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/applicator",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/applicator":!0},$dynamicAnchor:"meta",title:"Applicator vocabulary meta-schema",type:["object","boolean"],properties:{prefixItems:{$ref:"#/$defs/schemaArray"},items:{$dynamicRef:"#meta"},contains:{$dynamicRef:"#meta"},additionalProperties:{$dynamicRef:"#meta"},properties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},patternProperties:{type:"object",additionalProperties:{$dynamicRef:"#meta"},propertyNames:{format:"regex"},default:{}},dependentSchemas:{type:"object",additionalProperties:{$dynamicRef:"#meta"},default:{}},propertyNames:{$dynamicRef:"#meta"},if:{$dynamicRef:"#meta"},then:{$dynamicRef:"#meta"},else:{$dynamicRef:"#meta"},allOf:{$ref:"#/$defs/schemaArray"},anyOf:{$ref:"#/$defs/schemaArray"},oneOf:{$ref:"#/$defs/schemaArray"},not:{$dynamicRef:"#meta"}},$defs:{schemaArray:{type:"array",minItems:1,items:{$dynamicRef:"#meta"}}}},Rn={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/unevaluated",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/unevaluated":!0},$dynamicAnchor:"meta",title:"Unevaluated applicator vocabulary meta-schema",type:["object","boolean"],properties:{unevaluatedItems:{$dynamicRef:"#meta"},unevaluatedProperties:{$dynamicRef:"#meta"}}},An={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/content",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/content":!0},$dynamicAnchor:"meta",title:"Content vocabulary meta-schema",type:["object","boolean"],properties:{contentEncoding:{type:"string"},contentMediaType:{type:"string"},contentSchema:{$dynamicRef:"#meta"}}},Mn={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/core",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/core":!0},$dynamicAnchor:"meta",title:"Core vocabulary meta-schema",type:["object","boolean"],properties:{$id:{$ref:"#/$defs/uriReferenceString",$comment:"Non-empty fragments not allowed.",pattern:"^[^#]*#?$"},$schema:{$ref:"#/$defs/uriString"},$ref:{$ref:"#/$defs/uriReferenceString"},$anchor:{$ref:"#/$defs/anchorString"},$dynamicRef:{$ref:"#/$defs/uriReferenceString"},$dynamicAnchor:{$ref:"#/$defs/anchorString"},$vocabulary:{type:"object",propertyNames:{$ref:"#/$defs/uriString"},additionalProperties:{type:"boolean"}},$comment:{type:"string"},$defs:{type:"object",additionalProperties:{$dynamicRef:"#meta"}}},$defs:{anchorString:{type:"string",pattern:"^[A-Za-z_][-A-Za-z0-9._]*$"},uriString:{type:"string",format:"uri"},uriReferenceString:{type:"string",format:"uri-reference"}}},Dn={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/format-annotation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/format-annotation":!0},$dynamicAnchor:"meta",title:"Format vocabulary meta-schema for annotation results",type:["object","boolean"],properties:{format:{type:"string"}}},Fn={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/meta-data",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/meta-data":!0},$dynamicAnchor:"meta",title:"Meta-data vocabulary meta-schema",type:["object","boolean"],properties:{title:{type:"string"},description:{type:"string"},default:!0,deprecated:{type:"boolean",default:!1},readOnly:{type:"boolean",default:!1},writeOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0}}},Vn={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://json-schema.org/draft/2020-12/meta/validation",$vocabulary:{"https://json-schema.org/draft/2020-12/vocab/validation":!0},$dynamicAnchor:"meta",title:"Validation vocabulary meta-schema",type:["object","boolean"],properties:{type:{anyOf:[{$ref:"#/$defs/simpleTypes"},{type:"array",items:{$ref:"#/$defs/simpleTypes"},minItems:1,uniqueItems:!0}]},const:!0,enum:{type:"array",items:!0},multipleOf:{type:"number",exclusiveMinimum:0},maximum:{type:"number"},exclusiveMaximum:{type:"number"},minimum:{type:"number"},exclusiveMinimum:{type:"number"},maxLength:{$ref:"#/$defs/nonNegativeInteger"},minLength:{$ref:"#/$defs/nonNegativeIntegerDefault0"},pattern:{type:"string",format:"regex"},maxItems:{$ref:"#/$defs/nonNegativeInteger"},minItems:{$ref:"#/$defs/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},maxContains:{$ref:"#/$defs/nonNegativeInteger"},minContains:{$ref:"#/$defs/nonNegativeInteger",default:1},maxProperties:{$ref:"#/$defs/nonNegativeInteger"},minProperties:{$ref:"#/$defs/nonNegativeIntegerDefault0"},required:{$ref:"#/$defs/stringArray"},dependentRequired:{type:"object",additionalProperties:{$ref:"#/$defs/stringArray"}}},$defs:{nonNegativeInteger:{type:"integer",minimum:0},nonNegativeIntegerDefault0:{$ref:"#/$defs/nonNegativeInteger",default:0},simpleTypes:{enum:["array","boolean","integer","null","number","object","string"]},stringArray:{type:"array",items:{type:"string"},uniqueItems:!0,default:[]}}};var zn=(On||(On=1,function(e,t){Object.defineProperty(t,"__esModule",{value:!0}),t.MissingRefError=t.ValidationError=t.CodeGen=t.Name=t.nil=t.stringify=t.str=t._=t.KeywordCxt=t.Ajv2020=void 0;const r=dr(),o=kn(),n=Nn(),a=function(){if(In)return Tn;In=1,Object.defineProperty(Tn,"__esModule",{value:!0});const e=xn,t=Cn,r=Rn,o=An,n=Mn,a=Dn,s=Fn,i=Vn,c=["/properties"];return Tn.default=function(d){return[e,t,r,o,n,l(this,a),s,l(this,i)].forEach(e=>this.addMetaSchema(e,void 0,!1)),this;function l(e,t){return d?e.$dataMetaSchema(t,c):t}},Tn}(),s="https://json-schema.org/draft/2020-12/schema";class i extends r.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),o.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(n.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();const{$data:e,meta:t}=this.opts;t&&(a.default.call(this,e),this.refs["http://json-schema.org/schema"]=s)}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(s)?s:void 0)}}t.Ajv2020=i,e.exports=t=i,e.exports.Ajv2020=i,Object.defineProperty(t,"__esModule",{value:!0}),t.default=i;var c=Vt();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var d=et();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return d._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return d.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return d.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return d.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return d.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return d.CodeGen}});var l=qt();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return l.default}});var u=Bt();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return u.default}})}(qe,qe.exports)),qe.exports),Un=ze(zn);const qn=z.object({templateEntry:z.string({required_error:"templateEntry is required in build section",invalid_type_error:"templateEntry must be a string"}).describe("Main entry point for the portal"),schemaEntry:z.string({required_error:"schemaEntry is required in build section",invalid_type_error:"schemaEntry must be a string"}).describe("Schema file for portal validation"),assetPath:z.string({invalid_type_error:"assetPath must be a string"}).optional().describe("Asset path for dev/preview builds"),githubRepo:z.string({invalid_type_error:"githubRepo must be a string"}).optional().describe("GitHub repo URL or local git remote"),version:z.string({required_error:"version is required in build section",invalid_type_error:"version must be a string"}).describe("Version from package.json"),timestamp:z.string({required_error:"timestamp is required in build section",invalid_type_error:"timestamp must be a string"}).describe("Current build timestamp (ISO8601)"),commitSha:z.string({required_error:"commitSha is required in build section",invalid_type_error:"commitSha must be a string"}).describe("Current git commit SHA"),annotations:z.record(z.string(),{invalid_type_error:"annotations must be a record of string values"}).optional().describe("Optional build annotations"),projectPage:z.string({invalid_type_error:"projectPage must be a string"}).optional().describe("Optional project homepage"),allowedExtensions:z.array(z.string({invalid_type_error:"Each allowed extension must be a string"}),{required_error:"allowedExtensions is required in build section",invalid_type_error:"allowedExtensions must be an array of strings"}).describe("List of allowed asset extensions (with leading dot)"),schema:z.record(z.unknown(),{invalid_type_error:"schema must be a record of unknown values"}).optional().describe("Optional schema for the portal"),config:z.record(z.unknown(),{invalid_type_error:"config must be a record of unknown values"}).optional().describe("Optional configuration for the portal")});z.object({name:z.string({required_error:"name is required in portal manifest",invalid_type_error:"name must be a string"}).describe("Short app key (unscoped, derived from package name)"),displayName:z.string({invalid_type_error:"displayName must be a string"}).optional().describe("Full package name, may include scope"),description:z.string({invalid_type_error:"description must be a string"}).optional().describe("Description of the portal"),build:qn});const Kn=e("schema").description("Generate or validate a Fusion portal schema file.").addHelpText("after",["","Examples:"," $ ffc portal schema"," $ ffc portal schema --output portal.schema.json"," $ ffc portal schema --validate my-config.json"].join("\n")).addOption(he({allowDev:!0})).option("-o, --output <string>","Output file name (default: stdout)","stdout").option("-d, --debug","Enable debug mode for verbose logging",!1).option("-v, --validate <file>","Validate the generated schema against a JSON file").argument("[schema]","Schema build file to use (e.g., portal.schema[.env]?.[ts,js,json])").action(async(e,t)=>{const r=new c("portal:schema",{debug:t.debug});r.debug("Manifest file:",e),r.debug("Current working directory:",process.cwd()),r.start("Generating schema for the application...");const o=await(async(e,t)=>{const r=[`portal.schema.${e.environment}`,"portal.schema"],o=await F(r,{baseDir:e.root,extensions:t?.extensions,script:{resolve:async t=>{const r="function"==typeof t.default?await Promise.resolve(t.default(e)):t.default;if(!r)throw new Error("Schema function did not return a valid schema");return r}}});return{schema:o.config,path:o.path,extension:o.extension}})({command:"build",environment:t.environment,mode:"build",root:process.cwd()});if(r.debug("Schema:",JSON.stringify(o,null,2)),r.succeed("Schema generated successfully!"),t.output&&("stdout"===t.output?r.info("Schema:",JSON.stringify(o.schema,null,2)):(r.start(`Writing schema to ${t.output}`),((e,t,r)=>{const o=s(String(e));A(o)||M(o,{recursive:!0}),D(e,t,r)})(t.output,JSON.stringify(o.schema,null,2)),r.succeed(`Schema written to ${t.output}`)),process.exit(0)),t.validate){r.start("Validating schema against JSON file...");const e=new Un({strict:!0}).compile(o.schema),n=await V(t.validate);r.debug("JSON value:",JSON.stringify(n,null,2));e(n)?r.succeed("Schema validation passed!"):(r.fail("Schema validation failed:",JSON.stringify(e.errors??"Unknown error")),process.exit(1))}}),Ln=e("build").description("Build the Fusion portal from a manifest file with environment-specific settings.").addHelpText("after",["","If no manifest is provided, the command will search for a default portal.manifest.[ts|js|json] in the current directory.","example: `ffc portal build --env prod` will search for `portal.manifest.prod.ts` then fallback to `portal.manifest.ts`","","NOTE: portal manifest is not required, a default manifest will be generated if not provided","","Examples:"," $ ffc portal build"," $ ffc portal build portal.manifest.prod.ts --debug",""].join("\n")).option("-d, --debug","Enable debug mode for verbose logging",!1).argument("[manifest]","Manifest build file to use for building (e.g., portal.manifest[.env]?.[ts|js|json])").action(async(e,t)=>{const r=new c("portal:build",{debug:t.debug});await P({log:r,manifest:e})}),Bn=e("pack").description("Bundle the Fusion portal into a deployable archive.").addHelpText("after",["","If no manifest is provided, a default portal.manifest(.$ENV)?.[ts|js|json] is used from the current directory.","example: `ffc portal pack --env prod` will search for `portal.manifest.prod.ts` then fallback to `portal.manifest.ts`","","NOTE: portal manifest is not required, a default manifest will be generated if not provided","","Examples:"," $ ffc portal pack"," $ ffc portal pack portal.manifest.dev.ts --archive my-portal.zip --output ./dist"].join("\n")).option("-a, --archive [string]","Name of the output archive file (default: out/bundle.zip)","out/bundle.zip").option("-d, --debug [boolean]","Enable debug mode for verbose logging",!1).option("--schema [string]","Schema file to use for validation").argument("[manifest]","Manifest file to use for bundling (e.g., my-portal.manifest.ts)").action(async(e,t)=>{const r=new c("portal:pack",{debug:t.debug});await E({log:r,manifest:e,archive:t.archive,schema:t.schema}).catch(e=>{r.error("Failed to create package:",e),process.exit(1)})}),Hn=we(e("upload").description("Upload a Fusion portal bundle to the portal registry.").addHelpText("after",["","Uploads a distributable portal bundle (e.g., portal-bundle.zip) to the Fusion portal registry.","","Examples:"," $ ffc portal upload"," $ ffc portal upload my-portal-bundle.zip --name my-portal"," $ ffc portal upload --debug"].join("\n")).option("-d, --debug [boolean]","Enable debug mode for verbose logging",!1).addOption(he({allowDev:!1})).argument("<bundle>","Portal bundle to upload (e.g., out/bundle.zip)").action(async(e,t)=>{const r=new c("portal:upload",{debug:t.debug});r?.start("Initializing Fusion Framework...");const o=await m({env:t.env,auth:{token:t.token,tenantId:t.tenantId,clientId:t.clientId}});r?.succeed("Initialized Fusion Framework"),await S({log:r,framework:o,fileOrBundle:e}).catch(e=>{r.error("Failed to upload bundle:",e),process.exit(1)})}));const Gn=we(e("tag").description("Tag your uploaded Fusion Portal build version with a specific tag.").addHelpText("after",["","Note: using --package is preferred over --manifest, since no infered compilation is required.","","Examples:"," $ ffc portal tag latest"," $ ffc portal tag latest --package my-portal@1.2.3 --env prod"," $ ffc portal tag preview --manifest ./portal.manifest.ts"].join("\n")).addOption(he({allowDev:!1})).option("-m, --manifest <string>","Manifest file to use. Note: ignoring if --package is provided").option("-p, --package [package@version]","Package to tag in format name@version (e.g., my-portal@1.0.0). If not provided, loaded from manifest").option("-d, --debug","Enable debug mode for verbose logging").option("--silent","Silent mode, suppresses output except errors").argument("<tag>","Tag to apply (latest | preview)").action(async(e,t)=>{const r=t.silent?null:new c("app:tag",{debug:t.debug}),o={command:"build",environment:t.env,mode:process.env.NODE_ENV??"production",root:process.cwd()},n=await async function(e,t){if(e.package){const[t,r]=e.package.split("@");if(!t||!r)throw new Error("Package must be in format name@version (e.g., my-portal@1.0.0). Please verify the package name and version with --package");return{name:t,version:r}}const{manifest:r}=await k({manifest:e.manifest,env:t}),o=r.build?.version;if(!o)throw new Error(`Could not determine version from manifest. Please verify manifest ${e.manifest} or provide a package name and version with --package`);return{name:r.name,version:o}}(t,o).catch(e=>{r?.error(`😢 ${e instanceof Error?e.message:"Unknown error occurred"}`),r?.debug(e),process.exit(1)});r?.info("Tagging portal:",ue.greenBright(`${n.name}@${n.version} - ${e}`)),r?.start("Initializing Fusion Framework...");const a=await m({env:t.env,auth:{token:t.token,tenantId:t.tenantId,clientId:t.clientId}});r?.succeed("Initialized Fusion Framework"),j({tag:e,name:n.name,version:n.version,framework:a,log:r}).catch(e=>{r?.error("😢 Failed to tag application:",e),process.exit(1)})})),Jn=we(e("publish").description("Build, upload, and tag your Fusion portal bundle for deployment.").addHelpText("after",["","If no manifest is provided, a default portal.manifest(.$ENV)?.[ts|js|json] is used from the current directory.","example: `ffc portal publish --env prod` will search for `portal.manifest.prod.ts` then fallback to `portal.manifest.ts`","","NOTE: portal manifest is not required, a default manifest will be generated if not provided","","Examples:"," $ ffc portal publish"," $ ffc portal publish --env prod --manifest portal.manifest.prod.ts"," $ ffc portal publish --tag latest portal.bundle.zip"].join("\n")).option("-d, --debug","Enable debug mode for verbose logging",!1).addOption(he({allowDev:!1})).option("-m, --manifest [string]","Manifest file to use for bundling (e.g., my-portal.manifest.ts)").option("--schema [string]","Schema file to use for validation").option("-t, --tag [string]",`Tag to apply to the published portal (${Object.values(N).join(" | ")})`,N.Latest).action(async e=>{const t=new c("portal:publish",{debug:e.debug});t?.info("Using environment:",ue.redBright(e.env)),t.start("📦 Bundling Portal Template...");const r=await E({log:t,manifest:e.manifest,schema:e.schema}).catch(e=>{t.error("😢 Failed to create bundle:",e),process.exit(1)});t.succeed("📦 Bundling completed"),t?.start("💾 Initializing Fusion Framework...");const o=await m({env:e.env,auth:{token:e.token,tenantId:e.tenantId,clientId:e.clientId}});t?.succeed("💾 Initialized Fusion Framework"),t.start("🚀 Uploading Portal Template..."),await S({log:t,framework:o,fileOrBundle:r.archive}).catch(e=>{t.error("😢 Failed to upload bundle:",e),process.exit(1)}),t.succeed("🚀 Upload completed"),t.start("🏷️ Tagging Portal Template..."),await j({tag:e.tag,name:r.manifest.name,version:r.manifest.build.version,framework:o,log:t}).catch(e=>{t.error("😢 Failed to tag Portal Template:",e),process.exit(1)}),t.succeed("🏷️ Tagging completed")})),Wn=we(e("config").description("Generate or publish the Fusion portal configuration file.").addHelpText("after",["","By default, outputs the generated config object to stdout or a file. Use --publish to upload the config to the Fusion portal registry.","- Options [--token, --tenantId, --clientId, --manifest] are only relevant when --publish is used.",'- Option [-e, --env] cannot be set to "dev" when --publish is used.',"","Note:","- If not `portal.config(.$ENV)?.[ts|js|json]` is found it will fallback to generate a default config (empty object)","- If not `portal.manifest(.$ENV)?.[ts|js|json]` is found it will fallback to generate a default manifest","","Examples:"," $ ffc portal config app.config.ts"," $ ffc portal config portal.config.prod.ts --output ./dist/portal.config.json"," $ ffc portal config portal.manifest.prod.ts --silent > ./dist/portal.config.json"," $ ffc portal config --publish --manifest portal.manifest.ts --env prod"," $ ffc portal config --env prod my-custom.config.ts"].join("\n")).option("--debug","Enable debug mode for verbose logging").option("--silent","Silent mode, suppresses output except errors").option("--publish <name@version>","Publish config to Fusion portal registry, Identifier of the portal, example my-portal@1.2.3").addOption(he({allowDev:!0})).option("-o, --output <stdout|path>","Output the result to stdout or a file (ignored with --publish, default: stdout)","stdout").argument("[config]","Path to the portal config file (e.g., portal.config[.env]?.[ts,js,json])").action(async(e,t)=>{const r=t.silent?null:new c("portal:config",{debug:!!t.debug});if(t.publish){const[e,o]=t.publish.split("@")||[];return e&&o||(r?.fail("🤪","Portal identifier is required when using",ue.blue("--publish")),r?.info("Example: fusion-framework-cli portal config --publish my-portal@1.2.3"),process.exit(1)),"dev"===t.env&&(r?.fail("🤪",ue.blue("--env"),'cannot be "dev" when',ue.blue("--publish")," is used"),process.exit(1)),I({config:t.config,portal:{name:e,version:o},environment:t.env,auth:"token"in t?{token:t.token}:t,debug:t.debug})}const{config:o}=await O({log:r,config:e,env:{environment:t.env},output:"stdout"===t.output?void 0:t.output});"stdout"===t.output&&console.log(JSON.stringify(o,null,2))})),Yn=e("portal").description("Develop and deploy portal templates").addCommand(Fe).addCommand(Ve).addCommand(Kn).addCommand(Ln).addCommand(Bn).addCommand(Hn).addCommand(Gn).addCommand(Jn).addCommand(Wn);const[Qn]=process.versions.node.split(".").map(Number);Qn<Number(20)&&(console.error(ue.red("[ERROR]"),"Fusion Framework CLI requires Node.js 20 or higher."),process.exit(1));Qn!==Number(22)&&console.warn(ue.yellow("[WARNING]"),"Node.js 22.x (LTS) is recommended for best compatibility. You are using Node.js",process.versions.node);const Xn=i({cwd:n(import.meta.url)});if(!Xn)throw Error("failed to find program root");process.env.CLI_BIN=a(s(Xn.path),String(Xn.packageJson.bin?.["fusion-framework-cli"]));const Zn=new o;Zn.name(Xn.packageJson.name),Zn.description([`${Xn.packageJson.name}@${Xn.packageJson.version}`,"","Fusion Framework CLI","","A toolkit for building, packaging, deploying, and managing Fusion applications and portals.","","• Run fusion <command> --help for details on any command.","• For documentation, issues, and source code, visit:",` ${Xn.packageJson.homepage}`].join("\n")),Zn.version(Xn.packageJson.version,"-V, --version","CLI version"),(e=>{e.addCommand(Oe),e.addCommand(Ae),e.addCommand(De),e.addCommand(Yn)})(Zn),Zn.parse();