@equinor/fusion-framework-cli 11.3.0 → 11.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +130 -0
- package/bin/build/bin.mjs +1 -1
- package/bin/build/cli.mjs +3 -3
- package/dist/esm/version.js +1 -1
- package/dist/types/bin/app-tag.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +17 -17
package/bin/build/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{createCommand as e,createOption as t,InvalidOptionArgumentError as r,Command as n}from"commander";import o,{fileURLToPath as i}from"node:url";import{resolve as s,dirname as a,join as c}from"node:path";import{readPackageUpSync as l}from"read-package-up";import{ConsoleLogger as d,buildApplication as u,bundleApp as p,FusionEnv as h,resolveDefaultEnv as f,checkApp as m,initializeFramework as g,uploadApplication as y,publishAppConfig as v,generateApplicationConfig as b,AllowedAppTags as $,tagApplication as w,loadAppManifest as E,startAppDevServer as S,startPortalDevServer as P,loadPortalManifest as _,buildPortal as L,bundlePortal as C,uploadPortalBundle as k,tagPortal as N,AllowedPortalTags as I,publishPortalConfig as O,generatePortalConfig as A}from"@equinor/fusion-framework-cli/bin";import{mkdir as T,writeFile as x}from"node:fs/promises";import{accessSync as D,constants as j,readFileSync as R,writeFileSync as F,rmSync as M,existsSync as G,readdirSync as U,copyFileSync as B,cpSync as z,mkdirSync as V}from"node:fs";import H from"node:assert";import q from"inquirer";import W from"is-path-inside";import{execa as K,ExecaError as Y}from"execa";import{spawn as J}from"node:child_process";import{tmpdir as X}from"node:os";import{simpleGit as Z,ResetMode as Q}from"simple-git";import{z as ee}from"zod";import te from"url";import re from"node:module";import ne from"util";import{importConfig as oe,importJSON as ie}from"@equinor/fusion-imports";import"deepmerge";const se=(e=0)=>t=>`[${t+e}m`,ae=(e=0)=>t=>`[${38+e};5;${t}m`,ce=(e=0)=>(t,r,n)=>`[${38+e};2;${t};${r};${n}m`,le={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(le.modifier);Object.keys(le.color),Object.keys(le.bgColor);const de=function(){const e=new Map;for(const[t,r]of Object.entries(le)){for(const[t,n]of Object.entries(r))le[t]={open:`[${n[0]}m`,close:`[${n[1]}m`},r[t]=le[t],e.set(n[0],n[1]);Object.defineProperty(le,t,{value:r,enumerable:!1})}return Object.defineProperty(le,"codes",{value:e,enumerable:!1}),le.color.close="[39m",le.bgColor.close="[49m",le.color.ansi=se(),le.color.ansi256=ae(),le.color.ansi16m=ce(),le.bgColor.ansi=se(10),le.bgColor.ansi256=ae(10),le.bgColor.ansi16m=ce(10),Object.defineProperties(le,{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 n=Number.parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},enumerable:!1},hexToAnsi256:{value:e=>le.rgbToAnsi256(...le.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return e-8+90;let t,r,n;if(e>=232)t=(10*(e-232)+8)/255,r=t,n=t;else{const o=(e-=16)%36;t=Math.floor(e/36)/5,r=Math.floor(o/6)/5,n=o%6/5}const o=2*Math.max(t,r,n);if(0===o)return 30;let i=30+(Math.round(n)<<2|Math.round(r)<<1|Math.round(t));return 2===o&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(e,t,r)=>le.ansi256ToAnsi(le.rgbToAnsi256(e,t,r)),enumerable:!1},hexToAnsi:{value:e=>le.ansi256ToAnsi(le.hexToAnsi256(e)),enumerable:!1}}),le}(),ue=(()=>{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})(),pe=0!==ue&&{level:ue},he={stdout:pe,stderr:pe};function fe(e,t,r){let n=e.indexOf(t);if(-1===n)return e;const o=t.length;let i=0,s="";do{s+=e.slice(i,n)+t+r,i=n+o,n=e.indexOf(t,i)}while(-1!==n);return s+=e.slice(i),s}const{stdout:me,stderr:ge}=he,ye=Symbol("GENERATOR"),ve=Symbol("STYLER"),be=Symbol("IS_EMPTY"),$e=["ansi","ansi","ansi256","ansi16m"],we=Object.create(null),Ee=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=me?me.level:0;e.level=void 0===t.level?r:t.level})(t,e),Object.setPrototypeOf(t,Se.prototype),t};function Se(e){return Ee(e)}Object.setPrototypeOf(Se.prototype,Function.prototype);for(const[e,t]of Object.entries(de))we[e]={get(){const r=ke(this,Ce(t.open,t.close,this[ve]),this[be]);return Object.defineProperty(this,e,{value:r}),r}};we.visible={get(){const e=ke(this,this[ve],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const Pe=(e,t,r,...n)=>"rgb"===e?"ansi16m"===t?de[r].ansi16m(...n):"ansi256"===t?de[r].ansi256(de.rgbToAnsi256(...n)):de[r].ansi(de.rgbToAnsi(...n)):"hex"===e?Pe("rgb",t,r,...de.hexToRgb(...n)):de[r][e](...n),_e=["rgb","hex","ansi256"];for(const e of _e){we[e]={get(){const{level:t}=this;return function(...r){const n=Ce(Pe(e,$e[t],"color",...r),de.color.close,this[ve]);return ke(this,n,this[be])}}};we["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const{level:t}=this;return function(...r){const n=Ce(Pe(e,$e[t],"bgColor",...r),de.bgColor.close,this[ve]);return ke(this,n,this[be])}}}}const Le=Object.defineProperties(()=>{},{...we,level:{enumerable:!0,get(){return this[ye].level},set(e){this[ye].level=e}}}),Ce=(e,t,r)=>{let n,o;return void 0===r?(n=e,o=t):(n=r.openAll+e,o=t+r.closeAll),{open:e,close:t,openAll:n,closeAll:o,parent:r}},ke=(e,t,r)=>{const n=(...e)=>Ne(n,1===e.length?""+e[0]:e.join(" "));return Object.setPrototypeOf(n,Le),n[ye]=e,n[ve]=t,n[be]=r,n},Ne=(e,t)=>{if(e.level<=0||!t)return e[be]?"":t;let r=e[ve];if(void 0===r)return t;const{openAll:n,closeAll:o}=r;if(t.includes(""))for(;void 0!==r;)t=fe(t,r.close,r.open),r=r.parent;const i=t.indexOf("\n");return-1!==i&&(t=function(e,t,r,n){let o=0,i="";do{const s="\r"===e[n-1];i+=e.slice(o,s?n-1:n)+t+(s?"\r\n":"\n")+r,o=n+1,n=e.indexOf("\n",o)}while(-1!==n);return i+=e.slice(o),i}(t,o,n,i)),n+t+o};Object.defineProperties(Se.prototype,we);const Ie=Se();Se({level:ge?ge.level:0});const Oe=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 d("app:build",{debug:t.debug});await u({log:r,manifest:e})}),Ae="app-bundle.zip",Te=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)",Ae).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 d("app:pack",{debug:t.debug});await p({log:r,manifest:e,archive:t.archive}).catch(e=>{r.error("Failed to create package:",e),process.exit(1)})}),xe=e=>{const r=Object.values(h).filter(t=>t!==h.Development||e.allowDev);return t("-e, --env <string>",`Set environment [${r.join(", ")}, custom].`).env("FUSION_ENV").default(e.default??f(e.allowDev))};xe({allowDev:!0});const De=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,je=t("--tenantId <string>","The Azure Active Directory tenant ID").env("FUSION_TENANT_ID").default("3aa4a235-b6e2-48d5-9195-7fcf05b459b0"),Re=t("--clientId <string>","The client ID of the application registered in Azure AD").env("FUSION_CLIENT_ID").default("a318b8e1-0295-4e17-98d5-35f67dfeba14"),Fe=t("--token <string>","The Azure AD access token. If provided, the --tenant and --client options are ignored").env("FUSION_TOKEN").default(void 0),Me=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"]),Ge=(e,t)=>(e.addOption(je),e.addOption(Re),t?.excludeToken||e.addOption(Fe),t?.includeScope&&e.addOption(Me),e.hook("preAction",e=>{const n=e.opts();if(n.token){if("string"!=typeof n.token||""===n.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(!n.tenantId||"string"!=typeof n.tenantId)throw new r("Tenant ID must be a non-empty string.");if(!De.test(n.tenantId))throw new r("Tenant ID must be a valid UUID.");if(!n.clientId||"string"!=typeof n.clientId)throw new r("Client ID must be a non-empty string.");if(!De.test(n.clientId))throw new r("Client ID must be a valid UUID.");if(t?.includeScope){if(!Array.isArray(n.scope)||0===n.scope.length)throw new r("Scope must be a non-empty array of strings.");for(const e of n.scope)if("string"!=typeof e||""===e.trim())throw new r("Each scope must be a non-empty string.")}}),e),Ue=Ge(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(xe({allowDev:!1})).action(e=>{const t=new d("app:check",{debug:!!e.debug});return m({log:t,environment:e.env,auth:"token"in e?{token:e.token}:e})})),Be=Ge(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(xe({allowDev:!1})).argument("[bundle]","Application bundle to upload",Ae).action(async(e,t)=>{const r=new d("portal:upload",{debug:t.debug});r?.start("💾 Initializing Fusion Framework...");const n=await g({env:t.env,auth:{token:t.token,tenantId:t.tenantId,clientId:t.clientId}});r?.succeed("💾 Initialized Fusion Framework"),await y({log:r,appKey:t.appKey,framework:n,fileOrBundle:e}).catch(e=>{r.error("😢 Failed to upload bundle:",e),process.exit(1)})})),ze=Ge(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(xe({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 d("app:config",{debug:!!t.debug});if(t.publish)return"dev"===t.env&&(r?.fail("🤪",Ie.blue("--env"),'cannot be "dev" when',Ie.blue("--publish")," is used"),process.exit(1)),v({config:t.config,manifest:t.manifest,environment:t.env,auth:"token"in t?{token:t.token}:t,debug:t.debug});const{config:n}=await b({log:r,config:e,env:{environment:t.env},output:"stdout"===t.output?void 0:t.output});"stdout"===t.output&&console.log(JSON.stringify(n,null,2))}));const Ve=Ge(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(xe({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($).join(" | ")})`).action(async(e,t)=>{const r=t.silent?null:new d("app:tag",{debug:t.debug}),n={command:"build",environment:t.env,mode:process.env.NODE_ENV??"production",root:process.cwd()};let o,i;try{({appKey:o,version:i}=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 E({manifest:e.manifest,env:t}),n=r.build?.version;if(!n)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:n}}(t,n))}catch(e){r?.error(`😢 ${e instanceof Error?e.message:"Unknown error occurred"}`),process.exit(1)}r?.info("Tagging application:",Ie.greenBright(`${o}@${i} - ${e}`)),r?.start("Initializing Fusion Framework...");const s=await g({env:t.env,auth:{token:t.token,tenantId:t.tenantId,clientId:t.clientId}});r?.succeed("Initialized Fusion Framework"),r?.start("Tagging application..."),await w({appKey:o,version:i,framework:s,log:r,tag:e}).catch(e=>{r?.error("Failed to tag application:",e),process.exit(1)})})),He=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 d("app:dev",{debug:e.debug});t.start("Starting application in development mode..."),S({log:t,manifest:e.manifest,config:e.config,env:e.env,port:e.port}),t.succeed("Development server started successfully.")}),qe=(e,t)=>{try{return D(e,j.F_OK),!0}catch(e){return!1}},We=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 d("app:manifest",{debug:t.debug}),n=await E({log:r,manifest:e});if("stdout"!==t.output){const e=s(process.cwd(),t.output);r?.start("Writing manifest to file",t.output),qe(a(e))||await T(a(e),{recursive:!0}),await x(e,JSON.stringify(n.manifest,null,2)),r?.succeed("Manifest written to file",e)}else console.log(JSON.stringify(n.manifest,null,2))}),Ke=Ge(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(xe({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($).join(" | ")})`,$.Latest).argument("[bundle]","Path to the app bundle to upload").action(async(e,t)=>{const r=new d("app:publish",{debug:t.debug});let n;if(e)r.info(`📦 Using provided bundle: ${e}`),n=e;else try{r.start("📦 Bundle application...");n=(await p({log:r,manifest:t.manifest})).archive,r.succeed("📦 Bundle completed")}catch(e){r.error("😢 Failed to bundle application:",e),process.exit(1)}n||(r.error("😢 No bundle provided or created. Please specify a bundle file."),process.exit(1)),r?.start("💾 Initializing Fusion Framework...");const o=await g({env:t.env,auth:{token:t.token,tenantId:t.tenantId,clientId:t.clientId}});r?.succeed("💾 Initialized Fusion Framework"),r.start("🚀 Uploading application...");const i=await y({log:r,framework:o,fileOrBundle:n}).catch(e=>{r.error("😢 Failed to upload bundle:",e),process.exit(1)});r.succeed("🚀 Upload completed"),r.debug("Upload result:",i),r.start("🏷️ Tagging application...");const s=await w({tag:t.tag,appKey:i.name,version:i.version,log:r,framework:o}).catch(e=>{r.error("😢 Failed to tag application:",e),process.exit(1)});r.succeed("Tagging completed"),r.debug("Tagging result:",s)}));async function Ye(e,t="https://registry.npmjs.org"){const r=await async function(e,t="https://registry.npmjs.org"){try{const r=await fetch(`${t}/${e}`);if(!r.ok)throw new Error(`Failed to fetch package info for ${e}: ${r.statusText}`);const n=await r.json();if(!n.name)throw new Error(`Invalid package data received for ${e}`);const o=n["dist-tags"]?.latest;if(!o)throw new Error(`No latest version found for package ${e}`);return{name:n.name,latest:o,versions:Object.keys(n.versions||{}),"dist-tags":n["dist-tags"]||{},description:n.description,homepage:n.homepage,repository:n.repository,author:n.author,license:n.license,keywords:n.keywords,dependencies:n.dependencies,devDependencies:n.devDependencies,peerDependencies:n.peerDependencies}}catch(t){throw new Error(`Failed to fetch package info for ${e}: ${t instanceof Error?t.message:String(t)}`)}}(e,t);return r.latest}async function Je(e,t){const r=[{key:"dependencies",deps:e.dependencies},{key:"devDependencies",deps:e.devDependencies},{key:"peerDependencies",deps:e.peerDependencies}].filter(e=>void 0!==e.deps&&null!==e.deps);if(0!==r.length){t?.start(`Resolving workspace dependencies for ${r.length} dependency types`);try{const n=await Promise.all(r.map(({key:e,deps:r})=>async function(e,t,r){try{const n=Object.entries(t).filter(e=>{return"string"==typeof(t=e[1])&&t.startsWith("workspace:");var t});if(0===n.length)return r?.debug(`No workspace dependencies found in ${e}`),{key:e,resolved:t};r?.debug(`Resolving ${n.length} workspace dependencies for ${e}`);const o=await Promise.all(n.map(async([e,t])=>{try{const n=await Ye(e);return r?.debug(`Resolved ${e}: ${t} -> ${n}`),[e,n]}catch(n){const o=n instanceof Error?n.message:String(n);return r?.debug(`Failed to resolve ${e}: ${o}`),[e,t]}})),i={...t};for(const[e,t]of o)i[e]=t;return r?.debug(`Successfully processed ${e} with ${o.length} resolved dependencies`),{key:e,resolved:i}}catch(n){const o=n instanceof Error?n.message:String(n);return r?.debug(`Error processing ${e}: ${o}`),{key:e,resolved:t}}}(e,r,t)));for(const{key:t,resolved:r}of n)e[t]=r;const o=n.reduce((e,{resolved:t})=>e+Object.keys(t).length,0);t?.succeed(`Workspace dependencies resolved successfully (${o} total dependencies processed)`)}catch(e){const r=e instanceof Error?e.message:String(e);throw t?.debug(`Error details: ${r}`),new Error(`Failed to resolve workspace dependencies: ${r}`)}}else t?.debug("No dependencies found to resolve")}function Xe(e,t){if("string"!=typeof e||""===e.trim())throw new Error("Target path must be a non-empty string");const r=s(e);if(t){const e=s(t);if(!W(r,e))throw new Error("The target path must be within the specified base directory. Please specify a relative path or ensure the absolute path is within the base directory.")}return r}function Ze(e,t,r){const n=Xe(e,r);M(n,t)}const Qe=["code","cursor"];async function et(e,t){t.info("By selecting an IDE, it will be opened in a new window."),t.info("👋 please come back to this terminal to continue."),t.info(`You can also open the project in your IDE later by typing e.g. \`code ${e}\` in the terminal.`),t.info("If you do not want to open the project in an IDE, select no.");const{openInIDE:r}=await q.prompt([{type:"list",name:"openInIDE",message:"🚀 Open project in IDE?",default:!1,choices:[{name:"VS Code",value:"code"},{name:"Cursor",value:"cursor"},{name:"No, I will open the project in my IDE later",value:!1}]}]);if(r){if(!function(e){return Qe.includes(e)}(r))return void t.error(`Invalid IDE command: ${r}. Only supported IDEs are: ${Qe.join(", ")}`);try{const n=K(r,[e],{stdio:"pipe",detached:!0});n.unref(),n.catch(e=>{void 0!==e.exitCode&&0!==e.exitCode?t.error(`IDE process exited with code ${e.exitCode}. The IDE may not have opened successfully.`):t.error(`Failed to open IDE (${r}): ${e.message}`)})}catch(e){t.error(`Failed to spawn IDE process (${r}): ${e instanceof Error?e.message:String(e)}`)}}}const tt=["npm","pnpm"];async function rt(e,t){const{installDeps:r}=await q.prompt([{type:"confirm",name:"installDeps",message:"📦 Install dependencies?",default:!0}]);if(!r)return t.debug("Skipping dependency installation"),{installed:!1};const{packageManager:n}=await q.prompt([{type:"list",name:"packageManager",message:"📦 Which package manager do you want to use?",choices:["pnpm","npm"],default:"pnpm"}]);return await async function(e,t,r){H(tt.includes(t),"Package manager must be npm or pnpm"),r?.start("Installing dependencies...");try{return await K(t,["install"],{cwd:e,stdio:"inherit",shell:!0}),r?.succeed("Dependencies installed successfully!"),t}catch(e){if(e instanceof Y&&0!==e.exitCode)throw r?.error(`${t} install failed with exit code ${e.exitCode}`),new Error(`${t} install failed with exit code ${e.exitCode}`);throw r?.error(`Failed to run ${t} install: ${e instanceof Error?e.message:String(e)}`),e}}(e,n,t),{installed:!0,packageManager:n}}class nt{#e;#t;#r;get name(){return this.#e.name}get description(){return this.#e.description}get resources(){return this.#e.resources}constructor(e,t,r){this.#e=e,this.#r=t,this.#t=r.logger}copyTo(e){this.#t?.debug(`Copying template resources to ${e}`);for(const t of this.#e.resources){this.#t?.debug(`Copying resource ${t.path}`,{resource:t});const r=c(this.#r,t.path),n=c(e,t.target??t.path);if(G(r))try{"file"===t.type?(B(r,n),this.#t?.debug(`Copied file: ${t.path} -> ${n}`)):"dir"===t.type?(z(r,n,{recursive:t.recursive??!1}),this.#t?.debug(`Copied directory: ${t.path} -> ${n}`)):this.#t?.debug("Resource is not a file or directory, skipping",{resource:t})}catch(e){throw this.#t?.error(`Failed to copy resource ${t.path}:`,e),e}else this.#t?.warn(`Source resource does not exist, skipping: ${r}`)}}}const ot=ee.object({type:ee.literal("file"),path:ee.string(),target:ee.string().optional()}),it=ee.object({type:ee.literal("dir"),path:ee.string(),target:ee.string().optional(),recursive:ee.boolean().optional()}),st=ee.discriminatedUnion("type",[ot,it]),at=ee.object({name:ee.string(),description:ee.string(),resources:ee.array(st)}),ct=ee.object({templates:ee.array(at),resources:ee.array(st).optional()});class lt{repo;#n=!1;#o;#i;#s;#a;#c;get protocol(){return this.#a}set protocol(e){H("https"===e||"ssh"===e,"Protocol must be either https or ssh"),this.#a=e}get branch(){return this.#c}get repoUrl(){return"ssh"===this.#a?`git@github.com:${this.repo}.git`:`https://github.com/${this.repo}.git`}set branch(e){this.#c=e,this.#n&&this._checkoutBranch()}constructor(e,t){this.repo=e,this.#i=t.baseDir??c(X(),"ffc","repo",e),this.#s=t.log,this.#c=t.branch??"main",this.#o=Z(),this.#a=t.protocol??"https"}async initialize(){if(!this.#n)try{if(this.#s?.debug("Checking if repository directory exists...",this.#i),G(this.#i)||(this.#s?.info("Repository directory does not exist, creating..."),V(this.#i,{recursive:!0}),this.#s?.succeed("Repository directory created successfully!")),this.#o=Z({baseDir:this.#i}),this._setupOutputHandler(),!this.#a||"https"===this.#a)try{const e=await this.#o.getConfig("core.sshCommand");this.#a=e?"ssh":"https"}catch{this.#a="https"}this.#s?.debug("Checking if repository is initialized...");await this.#o.checkIsRepo()?(this.#s?.info("Git is initialized, checking out branch..."),await this._checkoutBranch(),this.#s?.succeed("Branch checked out successfully!")):(this.#s?.info("Git is not initialized, cloning repo..."),await this._cloneRepo(),this.#s?.succeed("Repo cloned successfully!")),this.#s?.succeed("Repository initialized successfully!"),this.#n=!0}catch(e){throw this.#s?.fail("Repository initialization failed!"),this.#s?.error(e),e}}async getAvailableTemplates(){let e;try{const t=c(this.#i,"templates.json");this.#s?.debug("Reading template manifest file...",t),e=R(t,"utf8")}catch(e){throw new Error("Failed to read templates.json file from the root of the repository...",{cause:e})}try{this.#s?.debug("Parsing and validating template content...");const t=function(e){try{const t=JSON.parse(e);return ct.parse(t)}catch(e){if(e instanceof ee.ZodError)throw new Error(`Template manifest validation failed: ${e.message}`);throw new Error(`Failed to parse JSON: ${e instanceof Error?e.message:"Unknown error"}`)}}(e);this.#s?.debug("Parsed template content...",t);return t.templates.map(e=>{const r=[...t.resources??[],...e.resources];return new nt({...e,resources:r},this.#i,{logger:this.#s})})}catch(e){throw new Error("Failed to parse templates.json content",{cause:e})}}async cleanup(){try{this.#s?.debug(`Removing repository directory: ${this.#i}`);return Ze(Xe(this.#i,X()),{recursive:!0,force:!0},X()),this.#s?.succeed("Repository directory cleaned up successfully!"),this.#n=!1,!0}catch(e){return this.#s?.error(`Failed to remove repository directory: ${this.#i}`,e),!1}}async _cloneRepo(){try{this.#s?.debug("Cloning repo...",{repo:this.repo,repoUrl:this.repoUrl,baseDir:this.#i,branch:this.#c,protocol:this.#a}),await this.#o.clone(this.repoUrl,this.#i,["--single-branch","--branch",this.#c])}catch(e){throw new Error("Failed to clone repo...",{cause:e})}}async _checkoutBranch(){try{this.#s?.debug("Fetching repo...",{repo:this.repo,repoUrl:this.repoUrl}),await this.#o.fetch(),this.#s?.debug("Checking out branch...",this.#c);(await this.#o.checkout(this.#c)).includes("branch is up to date")?this.#s?.debug("Branch is up to date!"):(this.#s?.info("Branch is not up to date, updating to latest changes..."),await this.#o.reset(Q.HARD).pull(),this.#s?.debug("Branch updated successfully!"))}catch(e){throw new Error("Failed to checkout branch...",{cause:e})}}_setupOutputHandler(){this.#o.outputHandler((e,t,r)=>{t.on("data",e=>{this.#s?.debug("🐙",String(e))}),r.on("data",e=>{this.#s?.error("🐙",String(e))})})}}async function dt(e,t,r){H(!!e,"App name is required"),H(G(t.directory),`Directory '${t.directory}' does not exist, use -d to specify a different directory`);const n=s(t.directory,e);r.debug(`Target dir: ${n}`);const o=await async function(e,t,r=!1,n=process.cwd()){let o;H("string"==typeof e,"Target directory must be a string");try{o=Xe(e,n)}catch(e){const r=e instanceof Error?e.message:String(e);return t.error(`❌ Invalid target directory path: ${r}`),t.info('💡 Try using a relative path like "my-app" or ensure the absolute path is within the specified directory.'),!1}if(!G(o))return t.debug(`Target directory does not exist: ${o}`),!0;try{const e=U(o);if(0===e.length)return t.debug(`Target directory is empty: ${o}`),!0;if(t.warn(`Target directory '${o}' is not empty and contains ${e.length} item(s).`),t.info("Contents:",e.slice(0,10).join(", ")+(e.length>10?"...":"")),r){t.info("Cleaning target directory (--clean flag)...");try{Ze(o,{recursive:!0,force:!0},n),t.succeed("Target directory cleaned successfully!")}catch(e){throw t.error(`Failed to clean target directory: ${e}`),t.info("Check directory permissions and ensure you have write access to the directory."),t.info("You may need to run the command with elevated privileges or manually remove the files."),e}}else{const{action:e}=await q.prompt([{type:"list",name:"action",message:"What would you like to do?",choices:[{name:"Continue - Add files to existing directory",value:"continue"},{name:"Clean - Remove all existing files and continue",value:"clean"},{name:"Abort - Cancel the operation",value:"abort"}],default:"abort"}]);if("abort"===e)return t.info("Operation cancelled by user."),!1;if("clean"===e){t.info("Cleaning target directory...");try{Ze(o,{recursive:!0,force:!0},n),t.succeed("Target directory cleaned successfully!")}catch(e){throw t.error(`Failed to clean target directory: ${e}`),t.info("Check directory permissions and ensure you have write access to the directory."),t.info("You may need to run the command with elevated privileges or manually remove the files."),e}}else t.info("Continuing with existing directory...")}return!0}catch(e){throw t.error(`Failed to check target directory: ${e}`),t.info("Ensure the path is valid and accessible, and that you have read permissions for the directory."),t.info("Check if the directory path contains any invalid characters or if the path is too long."),e}}(n,r,t.clean,t.directory);o||process.exit(0);const i=await async function(e,t,r,n){const o=s(X(),"ffc","repo",e);if(n.debug(`Repo dir: ${o}`),t){n.debug(`Removing repo dir: ${o}`);try{Ze(Xe(o,X()),{recursive:!0,force:!0},X())}catch(e){n.debug("Cleanup failed:",e)}}const i=new lt(e,{baseDir:o,log:n,branch:r});return await i.initialize(),i}("equinor/fusion-app-template",t.clean,t.branch,r),a=await i.getAvailableTemplates(),l=await async function(e,t,r){H(Array.isArray(e),"Templates must be an array"),H(e.length>0,"No templates available");const n=e.map(e=>e.name);if(t){H("string"==typeof t,"Pre-selected template must be a string"),H(n.includes(t),"Pre-selected template must be in the list of available templates"),r?.debug(`Using pre-selected template: ${t}`);const o=e.find(e=>e.name===t);return H(o,"Pre-selected template not found"),o}if(1===e.length)return r?.debug(`Using single template: ${e[0].name}`),e[0];const{selectedTemplate:o}=await q.prompt([{type:"list",name:"selectedTemplate",message:"🎨 Please select a template:",choices:e.map(e=>({name:`${e.name} - ${e.description}`,value:e})),pageSize:10,loop:!1}]);return o}(a,t.template,r);try{await l.copyTo(n),r.succeed("Template resources copied successfully!")}catch(e){r.error(`Failed to copy template resources: ${e instanceof Error?e.message:String(e)}`),r.info("Please check the target directory permissions and try again"),process.exit(1)}try{await(async(e,t,r)=>{const n=c(e,"package.json");try{const e=R(n,"utf-8"),o=JSON.parse(e);let i={...o};if(t?.resolveWorkspaceDependencies){r?.debug("Resolving workspace dependencies");const e=JSON.parse(JSON.stringify(o));await Je(e,r),i=e}t?.updates&&(r?.debug(`Applying updates: ${Object.keys(t.updates).join(", ")}`),i={...i,...t.updates}),JSON.stringify(o)!==JSON.stringify(i)?(r?.debug("Writing updated package.json to disk"),F(n,`${JSON.stringify(i,null,2)}\n`)):r?.debug("No changes detected, skipping package.json update")}catch(e){throw new Error(`Failed to update package.json: ${e instanceof Error?e.message:String(e)}`)}})(n,{updates:{name:e},resolveWorkspaceDependencies:!0},r),r.succeed(`Updated package.json with app name: ${e}`)}catch(e){r.error(`Failed to update package.json: ${e instanceof Error?e.message:String(e)}`),r.info("Please check the package.json file and try again"),process.exit(1)}await async function(e,t){const{cleanupTempFiles:r}=await q.prompt([{type:"confirm",name:"cleanupTempFiles",message:"🗑️ Clean up temporary template files?",default:!1}]);r?await e.cleanup():t.debug("Skipping cleanup of temporary template files")}(i,r),await et(n,r);const{installed:d,packageManager:u}=await rt(n,r);if(d&&u){const e=await async function(e,t,r,n=!1){const{startDev:o}=await q.prompt([{type:"confirm",name:"startDev",message:"🚀 Start development server?",default:!0}]);if(o){r.debug(`Starting development server: ${e}`),n&&r.info("Running in persistent mode - server will run until manually stopped (Ctrl+C)");try{const o=J(t,["run","dev"],{cwd:e,stdio:"inherit"});let i=null,s=!1;if(!n){const e=6e4;i=setTimeout(()=>{s=!0,r.error(`Development server did not start within ${e/1e3} seconds and may be hanging. Terminating process.`),o.kill("SIGTERM"),r.info(`You can try running '${t} run dev' manually in the project directory.`)},e)}const a=()=>{i&&clearTimeout(i),o.removeAllListeners("error"),o.removeAllListeners("exit")};return o.on("error",e=>{a(),s||(r.error(`Failed to start development server with ${t}: ${e.message}`),r.info(`Make sure ${t} is installed and the 'dev' script exists in package.json`))}),o.on("exit",e=>{a(),s||0===e||n?n&&0!==e&&r.info(`Development server stopped with exit code ${e}`):(r.error(`Development server process exited with code ${e}. The server may not have started successfully.`),r.info(`Check the output above for error details or try running '${t} run dev' manually`))}),!0}catch(e){r.error(`Failed to spawn development server process with ${t}: ${e instanceof Error?e.message:String(e)}`),r.info(`Make sure ${t} is installed and the 'dev' script exists in package.json`)}}return!1}(n,u,r,!0);e&&r.debug("Development server started successfully")}}const ut=t=>e(t).description("Create a new Fusion application from template").argument("<name>","Name of the application to create").option("-t, --template <type>","Template type to use (will prompt if not specified or not found)").option("-d, --directory <path>","Directory to create the app in",".").option("--branch <branch>","Branch to checkout","main").option("--clean","Clean the repo directory before cloning").option("--debug","Enable debug mode for verbose logging").action(async(e,t)=>{const r=new d("",{debug:t.debug});try{await dt(e,t,r)}catch(e){r.error("❌ An unexpected error occurred:",e instanceof Error?e.message:String(e)),t.debug&&r.error("Stack trace:",e instanceof Error?e.stack:"No stack trace available"),process.exit(1)}});Te.alias("build-pack").hook("preAction",e=>{"build-pack"===process.argv[3]&&(console.warn(Ie.bgRedBright.bold('The command "build-pack" is deprecated. Please use "pack" instead.')),e.getOptionValue("archive")||e.setOptionValue("archive",Ae))}),Be.alias("build-upload").hook("preAction",e=>{if("build-upload"===process.argv[3]){if(console.warn(Ie.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")??Ae;process.argv[4]=t}}),We.alias("build-manifest").hook("preAction",()=>{"build-manifest"===process.argv[3]&&console.warn(Ie.bgRedBright.bold('The command "build-manifest" is deprecated. Please use "manifest" instead.'))}),Ke.alias("build-publish").hook("preAction",e=>{if("build-publish"===process.argv[3]&&console.warn(Ie.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 pt=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:"," - Create new applications from templates with the create subcommand"," - 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(Oe).addCommand(Te).addCommand(Ue).addCommand(Be).addCommand(ze).addCommand(Ve).addCommand(He).addCommand(We).addCommand(Ke).addCommand(ut("create")),ht=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 d("auth:login",{debug:e.debug}),r="string"==typeof e.scope?[e.scope]:e.scope;t.start("Initializing Fusion Framework...");const n=await g({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 n.auth.login({scopes:r});t.info("username:",Ie.green(e.account?.username)),t.info("tenant: ",Ie.yellow(e.tenantId)),t.info("audience:",Ie.yellow(e.account?.idTokenClaims?.aud));for(const r of e.scopes)t.info("scope: ",Ie.dim(r));t.succeed("Successfully logged in",Ie.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}});Ge(ht,{includeScope:!0,excludeToken:!0});const ft=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 d("auth:logout",{debug:e.debug});t.start("Initializing Fusion Framework...");const r=await g({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}});Ge(ft,{excludeToken:!0,includeScope:!1});class mt extends Error{static Name="NoAccountsError";constructor(e,t){super(e,t),this.name=mt.Name}}const gt=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 d("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 n=await g({auth:{tenantId:e.tenantId,clientId:e.clientId}});t?.succeed("Initialized Fusion Framework");try{t?.start("Getting access token...");const o=await n.auth.acquireAccessToken({scopes:r});t?.succeed("Successfully acquired access token"),e.silent?console.log(o):t?.info("Access token:",o)}catch(r){if(e.silent||!(r instanceof mt))throw r;t?.fail("No accounts found, please login first")}});Ge(gt,{includeScope:!0});const yt=new n("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"));yt.addCommand(ht,{isDefault:!0}),yt.addCommand(ft),yt.addCommand(gt);const vt=e("create").description("Create new Fusion applications and components from templates").addHelpText("after",["",'The "create" command helps you bootstrap new Fusion applications and components',"using predefined templates from the Fusion ecosystem.","","Available templates:"," - app: Create a new Fusion application from the official template","","Examples:"," fusion create app my-new-app"," fusion create app my-new-app --template react",""].join("\n")).addCommand(ut("app")),bt=Ge(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(xe({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 d("disco:resolve");r?.start("Initializing Fusion Framework...");const n=await g({env:t.environment,auth:{token:t.token,tenantId:t.tenantId,clientId:t.clientId}});r?.succeed("Initialized Fusion Framework"),r?.start(`Resolving service ${e}...`);const o=await n.serviceDiscovery.resolveService(e);r?.succeed(`Resolved service ${e}`),r?.debug(o),t.silent&&console.log(JSON.stringify(o,null,2))})),$t=e("disco").description("Service discovery operations");$t.addCommand(bt);const wt=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 d("portal:dev",{debug:e.debug});t.start("Starting portal in development mode..."),P({server:{port:Number(e.port)},log:t,env:e.env}),t.succeed("Development server started successfully.")});function Et(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var St,Pt,_t,Lt;function Ct(){if(Pt)return St;Pt=1;const e="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};return St=e}function kt(){if(Lt)return _t;Lt=1;const e=Number.MAX_SAFE_INTEGER||9007199254740991;return _t={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:e,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}}var Nt,It,Ot,At,Tt,xt,Dt,jt,Rt,Ft,Mt,Gt,Ut,Bt={exports:{}};function zt(){return Nt||(Nt=1,function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:o}=kt(),i=Ct(),s=(t=e.exports={}).re=[],a=t.safeRe=[],c=t.src=[],l=t.safeSrc=[],d=t.t={};let u=0;const p="[a-zA-Z0-9-]",h=[["\\s",1],["\\d",o],[p,n]],f=(e,t,r)=>{const n=(e=>{for(const[t,r]of h)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),o=u++;i(e,o,t),d[e]=o,c[o]=t,l[o]=n,s[o]=new RegExp(t,r?"g":void 0),a[o]=new RegExp(n,r?"g":void 0)};f("NUMERICIDENTIFIER","0|[1-9]\\d*"),f("NUMERICIDENTIFIERLOOSE","\\d+"),f("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${p}*`),f("MAINVERSION",`(${c[d.NUMERICIDENTIFIER]})\\.(${c[d.NUMERICIDENTIFIER]})\\.(${c[d.NUMERICIDENTIFIER]})`),f("MAINVERSIONLOOSE",`(${c[d.NUMERICIDENTIFIERLOOSE]})\\.(${c[d.NUMERICIDENTIFIERLOOSE]})\\.(${c[d.NUMERICIDENTIFIERLOOSE]})`),f("PRERELEASEIDENTIFIER",`(?:${c[d.NONNUMERICIDENTIFIER]}|${c[d.NUMERICIDENTIFIER]})`),f("PRERELEASEIDENTIFIERLOOSE",`(?:${c[d.NONNUMERICIDENTIFIER]}|${c[d.NUMERICIDENTIFIERLOOSE]})`),f("PRERELEASE",`(?:-(${c[d.PRERELEASEIDENTIFIER]}(?:\\.${c[d.PRERELEASEIDENTIFIER]})*))`),f("PRERELEASELOOSE",`(?:-?(${c[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[d.PRERELEASEIDENTIFIERLOOSE]})*))`),f("BUILDIDENTIFIER",`${p}+`),f("BUILD",`(?:\\+(${c[d.BUILDIDENTIFIER]}(?:\\.${c[d.BUILDIDENTIFIER]})*))`),f("FULLPLAIN",`v?${c[d.MAINVERSION]}${c[d.PRERELEASE]}?${c[d.BUILD]}?`),f("FULL",`^${c[d.FULLPLAIN]}$`),f("LOOSEPLAIN",`[v=\\s]*${c[d.MAINVERSIONLOOSE]}${c[d.PRERELEASELOOSE]}?${c[d.BUILD]}?`),f("LOOSE",`^${c[d.LOOSEPLAIN]}$`),f("GTLT","((?:<|>)?=?)"),f("XRANGEIDENTIFIERLOOSE",`${c[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),f("XRANGEIDENTIFIER",`${c[d.NUMERICIDENTIFIER]}|x|X|\\*`),f("XRANGEPLAIN",`[v=\\s]*(${c[d.XRANGEIDENTIFIER]})(?:\\.(${c[d.XRANGEIDENTIFIER]})(?:\\.(${c[d.XRANGEIDENTIFIER]})(?:${c[d.PRERELEASE]})?${c[d.BUILD]}?)?)?`),f("XRANGEPLAINLOOSE",`[v=\\s]*(${c[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[d.XRANGEIDENTIFIERLOOSE]})(?:${c[d.PRERELEASELOOSE]})?${c[d.BUILD]}?)?)?`),f("XRANGE",`^${c[d.GTLT]}\\s*${c[d.XRANGEPLAIN]}$`),f("XRANGELOOSE",`^${c[d.GTLT]}\\s*${c[d.XRANGEPLAINLOOSE]}$`),f("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),f("COERCE",`${c[d.COERCEPLAIN]}(?:$|[^\\d])`),f("COERCEFULL",c[d.COERCEPLAIN]+`(?:${c[d.PRERELEASE]})?`+`(?:${c[d.BUILD]})?(?:$|[^\\d])`),f("COERCERTL",c[d.COERCE],!0),f("COERCERTLFULL",c[d.COERCEFULL],!0),f("LONETILDE","(?:~>?)"),f("TILDETRIM",`(\\s*)${c[d.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",f("TILDE",`^${c[d.LONETILDE]}${c[d.XRANGEPLAIN]}$`),f("TILDELOOSE",`^${c[d.LONETILDE]}${c[d.XRANGEPLAINLOOSE]}$`),f("LONECARET","(?:\\^)"),f("CARETTRIM",`(\\s*)${c[d.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",f("CARET",`^${c[d.LONECARET]}${c[d.XRANGEPLAIN]}$`),f("CARETLOOSE",`^${c[d.LONECARET]}${c[d.XRANGEPLAINLOOSE]}$`),f("COMPARATORLOOSE",`^${c[d.GTLT]}\\s*(${c[d.LOOSEPLAIN]})$|^$`),f("COMPARATOR",`^${c[d.GTLT]}\\s*(${c[d.FULLPLAIN]})$|^$`),f("COMPARATORTRIM",`(\\s*)${c[d.GTLT]}\\s*(${c[d.LOOSEPLAIN]}|${c[d.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",f("HYPHENRANGE",`^\\s*(${c[d.XRANGEPLAIN]})\\s+-\\s+(${c[d.XRANGEPLAIN]})\\s*$`),f("HYPHENRANGELOOSE",`^\\s*(${c[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[d.XRANGEPLAINLOOSE]})\\s*$`),f("STAR","(<|>)?=?\\s*\\*"),f("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),f("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(Bt,Bt.exports)),Bt.exports}function Vt(){if(Dt)return xt;Dt=1;const e=Ct(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:r}=kt(),{safeRe:n,t:o}=zt(),i=function(){if(Ot)return It;Ot=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return It=r=>r?"object"!=typeof r?e:r:t}(),{compareIdentifiers:s}=function(){if(Tt)return At;Tt=1;const e=/^[0-9]+$/,t=(t,r)=>{const n=e.test(t),o=e.test(r);return n&&o&&(t=+t,r=+r),t===r?0:n&&!o?-1:o&&!n?1:t<r?-1:1};return At={compareIdentifiers:t,rcompareIdentifiers:(e,r)=>t(r,e)}}();class a{constructor(s,c){if(c=i(c),s instanceof a){if(s.loose===!!c.loose&&s.includePrerelease===!!c.includePrerelease)return s;s=s.version}else if("string"!=typeof s)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof s}".`);if(s.length>t)throw new TypeError(`version is longer than ${t} characters`);e("SemVer",s,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;const l=s.trim().match(c.loose?n[o.LOOSE]:n[o.FULL]);if(!l)throw new TypeError(`Invalid Version: ${s}`);if(this.raw=s,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");l[4]?this.prerelease=l[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<r)return t}return e}):this.prerelease=[],this.build=l[5]?l[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(e("SemVer.compare",this.version,this.options,t),!(t instanceof a)){if("string"==typeof t&&t===this.version)return 0;t=new a(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(e){return e instanceof a||(e=new a(e,this.options)),s(this.major,e.major)||s(this.minor,e.minor)||s(this.patch,e.patch)}comparePre(t){if(t instanceof a||(t=new a(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{const n=this.prerelease[r],o=t.prerelease[r];if(e("prerelease compare",r,n,o),void 0===n&&void 0===o)return 0;if(void 0===o)return 1;if(void 0===n)return-1;if(n!==o)return s(n,o)}while(++r)}compareBuild(t){t instanceof a||(t=new a(t,this.options));let r=0;do{const n=this.build[r],o=t.build[r];if(e("build compare",r,n,o),void 0===n&&void 0===o)return 0;if(void 0===o)return 1;if(void 0===n)return-1;if(n!==o)return s(n,o)}while(++r)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&!1===r)throw new Error("invalid increment argument: identifier is empty");if(t){const e=`-${t}`.match(this.options.loose?n[o.PRERELEASELOOSE]:n[o.PRERELEASE]);if(!e||e[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,r),this.inc("pre",t,r);break;case"release":if(0===this.prerelease.length)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(r)?1:0;if(0===this.prerelease.length)this.prerelease=[e];else{let n=this.prerelease.length;for(;--n>=0;)"number"==typeof this.prerelease[n]&&(this.prerelease[n]++,n=-2);if(-1===n){if(t===this.prerelease.join(".")&&!1===r)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let n=[t,e];!1===r&&(n=[t]),0===s(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=n):this.prerelease=n}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return xt=a}function Ht(){if(Rt)return jt;Rt=1;const e=Vt();return jt=(t,r,n=!1)=>{if(t instanceof e)return t;try{return new e(t,r)}catch(e){if(!n)return null;throw e}}}var qt,Wt,Kt,Yt,Jt,Xt,Zt,Qt,er,tr,rr=["0BSD","3D-Slicer-1.0","AAL","ADSL","AFL-1.1","AFL-1.2","AFL-2.0","AFL-2.1","AFL-3.0","AGPL-1.0-only","AGPL-1.0-or-later","AGPL-3.0-only","AGPL-3.0-or-later","AMD-newlib","AMDPLPA","AML","AML-glslang","AMPAS","ANTLR-PD","ANTLR-PD-fallback","APAFML","APL-1.0","APSL-1.0","APSL-1.1","APSL-1.2","APSL-2.0","ASWF-Digital-Assets-1.0","ASWF-Digital-Assets-1.1","Abstyles","AdaCore-doc","Adobe-2006","Adobe-Display-PostScript","Adobe-Glyph","Adobe-Utopia","Afmparse","Aladdin","Apache-1.0","Apache-1.1","Apache-2.0","App-s2p","Arphic-1999","Artistic-1.0","Artistic-1.0-Perl","Artistic-1.0-cl8","Artistic-2.0","Artistic-dist","Aspell-RU","BSD-1-Clause","BSD-2-Clause","BSD-2-Clause-Darwin","BSD-2-Clause-Patent","BSD-2-Clause-Views","BSD-2-Clause-first-lines","BSD-2-Clause-pkgconf-disclaimer","BSD-3-Clause","BSD-3-Clause-Attribution","BSD-3-Clause-Clear","BSD-3-Clause-HP","BSD-3-Clause-LBNL","BSD-3-Clause-Modification","BSD-3-Clause-No-Military-License","BSD-3-Clause-No-Nuclear-License","BSD-3-Clause-No-Nuclear-License-2014","BSD-3-Clause-No-Nuclear-Warranty","BSD-3-Clause-Open-MPI","BSD-3-Clause-Sun","BSD-3-Clause-acpica","BSD-3-Clause-flex","BSD-4-Clause","BSD-4-Clause-Shortened","BSD-4-Clause-UC","BSD-4.3RENO","BSD-4.3TAHOE","BSD-Advertising-Acknowledgement","BSD-Attribution-HPND-disclaimer","BSD-Inferno-Nettverk","BSD-Protection","BSD-Source-Code","BSD-Source-beginning-file","BSD-Systemics","BSD-Systemics-W3Works","BSL-1.0","BUSL-1.1","Baekmuk","Bahyph","Barr","Beerware","BitTorrent-1.0","BitTorrent-1.1","Bitstream-Charter","Bitstream-Vera","BlueOak-1.0.0","Boehm-GC","Boehm-GC-without-fee","Borceux","Brian-Gladman-2-Clause","Brian-Gladman-3-Clause","C-UDA-1.0","CAL-1.0","CAL-1.0-Combined-Work-Exception","CATOSL-1.1","CC-BY-1.0","CC-BY-2.0","CC-BY-2.5","CC-BY-2.5-AU","CC-BY-3.0","CC-BY-3.0-AT","CC-BY-3.0-AU","CC-BY-3.0-DE","CC-BY-3.0-IGO","CC-BY-3.0-NL","CC-BY-3.0-US","CC-BY-4.0","CC-BY-NC-1.0","CC-BY-NC-2.0","CC-BY-NC-2.5","CC-BY-NC-3.0","CC-BY-NC-3.0-DE","CC-BY-NC-4.0","CC-BY-NC-ND-1.0","CC-BY-NC-ND-2.0","CC-BY-NC-ND-2.5","CC-BY-NC-ND-3.0","CC-BY-NC-ND-3.0-DE","CC-BY-NC-ND-3.0-IGO","CC-BY-NC-ND-4.0","CC-BY-NC-SA-1.0","CC-BY-NC-SA-2.0","CC-BY-NC-SA-2.0-DE","CC-BY-NC-SA-2.0-FR","CC-BY-NC-SA-2.0-UK","CC-BY-NC-SA-2.5","CC-BY-NC-SA-3.0","CC-BY-NC-SA-3.0-DE","CC-BY-NC-SA-3.0-IGO","CC-BY-NC-SA-4.0","CC-BY-ND-1.0","CC-BY-ND-2.0","CC-BY-ND-2.5","CC-BY-ND-3.0","CC-BY-ND-3.0-DE","CC-BY-ND-4.0","CC-BY-SA-1.0","CC-BY-SA-2.0","CC-BY-SA-2.0-UK","CC-BY-SA-2.1-JP","CC-BY-SA-2.5","CC-BY-SA-3.0","CC-BY-SA-3.0-AT","CC-BY-SA-3.0-DE","CC-BY-SA-3.0-IGO","CC-BY-SA-4.0","CC-PDDC","CC-PDM-1.0","CC-SA-1.0","CC0-1.0","CDDL-1.0","CDDL-1.1","CDL-1.0","CDLA-Permissive-1.0","CDLA-Permissive-2.0","CDLA-Sharing-1.0","CECILL-1.0","CECILL-1.1","CECILL-2.0","CECILL-2.1","CECILL-B","CECILL-C","CERN-OHL-1.1","CERN-OHL-1.2","CERN-OHL-P-2.0","CERN-OHL-S-2.0","CERN-OHL-W-2.0","CFITSIO","CMU-Mach","CMU-Mach-nodoc","CNRI-Jython","CNRI-Python","CNRI-Python-GPL-Compatible","COIL-1.0","CPAL-1.0","CPL-1.0","CPOL-1.02","CUA-OPL-1.0","Caldera","Caldera-no-preamble","Catharon","ClArtistic","Clips","Community-Spec-1.0","Condor-1.1","Cornell-Lossless-JPEG","Cronyx","Crossword","CryptoSwift","CrystalStacker","Cube","D-FSL-1.0","DEC-3-Clause","DL-DE-BY-2.0","DL-DE-ZERO-2.0","DOC","DRL-1.0","DRL-1.1","DSDP","DocBook-DTD","DocBook-Schema","DocBook-Stylesheet","DocBook-XML","Dotseqn","ECL-1.0","ECL-2.0","EFL-1.0","EFL-2.0","EPICS","EPL-1.0","EPL-2.0","EUDatagrid","EUPL-1.0","EUPL-1.1","EUPL-1.2","Elastic-2.0","Entessa","ErlPL-1.1","Eurosym","FBM","FDK-AAC","FSFAP","FSFAP-no-warranty-disclaimer","FSFUL","FSFULLR","FSFULLRSD","FSFULLRWD","FSL-1.1-ALv2","FSL-1.1-MIT","FTL","Fair","Ferguson-Twofish","Frameworx-1.0","FreeBSD-DOC","FreeImage","Furuseth","GCR-docs","GD","GFDL-1.1-invariants-only","GFDL-1.1-invariants-or-later","GFDL-1.1-no-invariants-only","GFDL-1.1-no-invariants-or-later","GFDL-1.1-only","GFDL-1.1-or-later","GFDL-1.2-invariants-only","GFDL-1.2-invariants-or-later","GFDL-1.2-no-invariants-only","GFDL-1.2-no-invariants-or-later","GFDL-1.2-only","GFDL-1.2-or-later","GFDL-1.3-invariants-only","GFDL-1.3-invariants-or-later","GFDL-1.3-no-invariants-only","GFDL-1.3-no-invariants-or-later","GFDL-1.3-only","GFDL-1.3-or-later","GL2PS","GLWTPL","GPL-1.0-only","GPL-1.0-or-later","GPL-2.0-only","GPL-2.0-or-later","GPL-3.0-only","GPL-3.0-or-later","Game-Programming-Gems","Giftware","Glide","Glulxe","Graphics-Gems","Gutmann","HDF5","HIDAPI","HP-1986","HP-1989","HPND","HPND-DEC","HPND-Fenneberg-Livingston","HPND-INRIA-IMAG","HPND-Intel","HPND-Kevlin-Henney","HPND-MIT-disclaimer","HPND-Markus-Kuhn","HPND-Netrek","HPND-Pbmplus","HPND-UC","HPND-UC-export-US","HPND-doc","HPND-doc-sell","HPND-export-US","HPND-export-US-acknowledgement","HPND-export-US-modify","HPND-export2-US","HPND-merchantability-variant","HPND-sell-MIT-disclaimer-xserver","HPND-sell-regexpr","HPND-sell-variant","HPND-sell-variant-MIT-disclaimer","HPND-sell-variant-MIT-disclaimer-rev","HTMLTIDY","HaskellReport","Hippocratic-2.1","IBM-pibs","ICU","IEC-Code-Components-EULA","IJG","IJG-short","IPA","IPL-1.0","ISC","ISC-Veillard","ImageMagick","Imlib2","Info-ZIP","Inner-Net-2.0","InnoSetup","Intel","Intel-ACPI","Interbase-1.0","JPL-image","JPNIC","JSON","Jam","JasPer-2.0","Kastrup","Kazlib","Knuth-CTAN","LAL-1.2","LAL-1.3","LGPL-2.0-only","LGPL-2.0-or-later","LGPL-2.1-only","LGPL-2.1-or-later","LGPL-3.0-only","LGPL-3.0-or-later","LGPLLR","LOOP","LPD-document","LPL-1.0","LPL-1.02","LPPL-1.0","LPPL-1.1","LPPL-1.2","LPPL-1.3a","LPPL-1.3c","LZMA-SDK-9.11-to-9.20","LZMA-SDK-9.22","Latex2e","Latex2e-translated-notice","Leptonica","LiLiQ-P-1.1","LiLiQ-R-1.1","LiLiQ-Rplus-1.1","Libpng","Linux-OpenIB","Linux-man-pages-1-para","Linux-man-pages-copyleft","Linux-man-pages-copyleft-2-para","Linux-man-pages-copyleft-var","Lucida-Bitmap-Fonts","MIPS","MIT","MIT-0","MIT-CMU","MIT-Click","MIT-Festival","MIT-Khronos-old","MIT-Modern-Variant","MIT-Wu","MIT-advertising","MIT-enna","MIT-feh","MIT-open-group","MIT-testregex","MITNFA","MMIXware","MPEG-SSG","MPL-1.0","MPL-1.1","MPL-2.0","MPL-2.0-no-copyleft-exception","MS-LPL","MS-PL","MS-RL","MTLL","Mackerras-3-Clause","Mackerras-3-Clause-acknowledgment","MakeIndex","Martin-Birgmeier","McPhee-slideshow","Minpack","MirOS","Motosoto","MulanPSL-1.0","MulanPSL-2.0","Multics","Mup","NAIST-2003","NASA-1.3","NBPL-1.0","NCBI-PD","NCGL-UK-2.0","NCL","NCSA","NGPL","NICTA-1.0","NIST-PD","NIST-PD-fallback","NIST-Software","NLOD-1.0","NLOD-2.0","NLPL","NOSL","NPL-1.0","NPL-1.1","NPOSL-3.0","NRL","NTIA-PD","NTP","NTP-0","Naumen","NetCDF","Newsletr","Nokia","Noweb","O-UDA-1.0","OAR","OCCT-PL","OCLC-2.0","ODC-By-1.0","ODbL-1.0","OFFIS","OFL-1.0","OFL-1.0-RFN","OFL-1.0-no-RFN","OFL-1.1","OFL-1.1-RFN","OFL-1.1-no-RFN","OGC-1.0","OGDL-Taiwan-1.0","OGL-Canada-2.0","OGL-UK-1.0","OGL-UK-2.0","OGL-UK-3.0","OGTSL","OLDAP-1.1","OLDAP-1.2","OLDAP-1.3","OLDAP-1.4","OLDAP-2.0","OLDAP-2.0.1","OLDAP-2.1","OLDAP-2.2","OLDAP-2.2.1","OLDAP-2.2.2","OLDAP-2.3","OLDAP-2.4","OLDAP-2.5","OLDAP-2.6","OLDAP-2.7","OLDAP-2.8","OLFL-1.3","OML","OPL-1.0","OPL-UK-3.0","OPUBL-1.0","OSET-PL-2.1","OSL-1.0","OSL-1.1","OSL-2.0","OSL-2.1","OSL-3.0","OpenPBS-2.3","OpenSSL","OpenSSL-standalone","OpenVision","PADL","PDDL-1.0","PHP-3.0","PHP-3.01","PPL","PSF-2.0","Parity-6.0.0","Parity-7.0.0","Pixar","Plexus","PolyForm-Noncommercial-1.0.0","PolyForm-Small-Business-1.0.0","PostgreSQL","Python-2.0","Python-2.0.1","QPL-1.0","QPL-1.0-INRIA-2004","Qhull","RHeCos-1.1","RPL-1.1","RPL-1.5","RPSL-1.0","RSA-MD","RSCPL","Rdisc","Ruby","Ruby-pty","SAX-PD","SAX-PD-2.0","SCEA","SGI-B-1.0","SGI-B-1.1","SGI-B-2.0","SGI-OpenGL","SGP4","SHL-0.5","SHL-0.51","SISSL","SISSL-1.2","SL","SMAIL-GPL","SMLNJ","SMPPL","SNIA","SOFA","SPL-1.0","SSH-OpenSSH","SSH-short","SSLeay-standalone","SSPL-1.0","SUL-1.0","SWL","Saxpath","SchemeReport","Sendmail","Sendmail-8.23","Sendmail-Open-Source-1.1","SimPL-2.0","Sleepycat","Soundex","Spencer-86","Spencer-94","Spencer-99","SugarCRM-1.1.3","Sun-PPP","Sun-PPP-2000","SunPro","Symlinks","TAPR-OHL-1.0","TCL","TCP-wrappers","TGPPL-1.0","TMate","TORQUE-1.1","TOSL","TPDL","TPL-1.0","TTWL","TTYP0","TU-Berlin-1.0","TU-Berlin-2.0","TermReadKey","ThirdEye","TrustedQSL","UCAR","UCL-1.0","UMich-Merit","UPL-1.0","URT-RLE","Ubuntu-font-1.0","Unicode-3.0","Unicode-DFS-2015","Unicode-DFS-2016","Unicode-TOU","UnixCrypt","Unlicense","Unlicense-libtelnet","Unlicense-libwhirlpool","VOSTROM","VSL-1.0","Vim","W3C","W3C-19980720","W3C-20150513","WTFPL","Watcom-1.0","Widget-Workshop","Wsuipa","X11","X11-distribute-modifications-variant","X11-swapped","XFree86-1.1","XSkat","Xdebug-1.03","Xerox","Xfig","Xnet","YPL-1.0","YPL-1.1","ZPL-1.1","ZPL-2.0","ZPL-2.1","Zed","Zeeff","Zend-2.0","Zimbra-1.3","Zimbra-1.4","Zlib","any-OSI","any-OSI-perl-modules","bcrypt-Solar-Designer","blessing","bzip2-1.0.6","check-cvs","checkmk","copyleft-next-0.3.0","copyleft-next-0.3.1","curl","cve-tou","diffmark","dtoa","dvipdfm","eGenix","etalab-2.0","fwlw","gSOAP-1.3b","generic-xts","gnuplot","gtkbook","hdparm","iMatix","jove","libpng-1.6.35","libpng-2.0","libselinux-1.0","libtiff","libutil-David-Nugent","lsof","magaz","mailprio","man2html","metamail","mpi-permissive","mpich2","mplus","ngrep","pkgconf","pnmstitch","psfrag","psutils","python-ldap","radvd","snprintf","softSurfer","ssh-keyscan","swrule","threeparttable","ulem","w3m","wwl","xinetd","xkeyboard-config-Zinoviev","xlock","xpp","xzoom","zlib-acknowledgement"],nr=["AGPL-1.0","AGPL-3.0","BSD-2-Clause-FreeBSD","BSD-2-Clause-NetBSD","GFDL-1.1","GFDL-1.2","GFDL-1.3","GPL-1.0","GPL-2.0","GPL-2.0-with-GCC-exception","GPL-2.0-with-autoconf-exception","GPL-2.0-with-bison-exception","GPL-2.0-with-classpath-exception","GPL-2.0-with-font-exception","GPL-3.0","GPL-3.0-with-GCC-exception","GPL-3.0-with-autoconf-exception","LGPL-2.0","LGPL-2.1","LGPL-3.0","Net-SNMP","Nunit","StandardML-NJ","bzip2-1.0.5","eCos-2.0","wxWindows"],or=["389-exception","Asterisk-exception","Autoconf-exception-2.0","Autoconf-exception-3.0","Autoconf-exception-generic","Autoconf-exception-generic-3.0","Autoconf-exception-macro","Bison-exception-1.24","Bison-exception-2.2","Bootloader-exception","Classpath-exception-2.0","CLISP-exception-2.0","cryptsetup-OpenSSL-exception","DigiRule-FOSS-exception","eCos-exception-2.0","Fawkes-Runtime-exception","FLTK-exception","fmt-exception","Font-exception-2.0","freertos-exception-2.0","GCC-exception-2.0","GCC-exception-2.0-note","GCC-exception-3.1","Gmsh-exception","GNAT-exception","GNOME-examples-exception","GNU-compiler-exception","gnu-javamail-exception","GPL-3.0-interface-exception","GPL-3.0-linking-exception","GPL-3.0-linking-source-exception","GPL-CC-1.0","GStreamer-exception-2005","GStreamer-exception-2008","i2p-gpl-java-exception","KiCad-libraries-exception","LGPL-3.0-linking-exception","libpri-OpenH323-exception","Libtool-exception","Linux-syscall-note","LLGPL","LLVM-exception","LZMA-exception","mif-exception","OCaml-LGPL-linking-exception","OCCT-exception-1.0","OpenJDK-assembly-exception-1.0","openvpn-openssl-exception","PS-or-PDF-font-exception-20170817","QPL-1.0-INRIA-2004-exception","Qt-GPL-exception-1.0","Qt-LGPL-exception-1.1","Qwt-exception-1.0","SANE-exception","SHL-2.0","SHL-2.1","stunnel-exception","SWI-exception","Swift-exception","Texinfo-exception","u-boot-exception-2.0","UBDL-exception","Universal-FOSS-exception-1.0","vsftpd-openssl-exception","WxWindows-exception-3.1","x11vnc-openssl-exception"];function ir(){if(Wt)return qt;Wt=1;var e=[].concat(rr).concat(nr),t=or;return qt=function(r){var n=0;function o(){return n<r.length}function i(e){if(e instanceof RegExp){var t=r.slice(n).match(e);if(t)return n+=t[0].length,t[0]}else if(r.indexOf(e,n)===n)return n+=e.length,e}function s(){i(/[ ]*/)}function a(){return i(/[A-Za-z0-9-.]+/)}function c(){var e=a();if(!e)throw new Error("Expected idstring at offset "+n);return e}function l(){return function(){for(var e,t=["WITH","AND","OR","(",")",":","+"],o=0;o<t.length&&!(e=i(t[o]));o++);if("+"===e&&n>1&&" "===r[n-2])throw new Error("Space before `+`");return e&&{type:"OPERATOR",string:e}}()||function(){if(i("DocumentRef-"))return{type:"DOCUMENTREF",string:c()}}()||function(){if(i("LicenseRef-"))return{type:"LICENSEREF",string:c()}}()||(o=n,s=a(),-1!==e.indexOf(s)?{type:"LICENSE",string:s}:-1!==t.indexOf(s)?{type:"EXCEPTION",string:s}:void(n=o));var o,s}for(var d=[];o()&&(s(),o());){var u=l();if(!u)throw new Error("Unexpected `"+r[n]+"` at offset "+n);d.push(u)}return d}}function sr(){return Yt||(Yt=1,Kt=function(e){var t=0;function r(){return t<e.length}function n(){return r()?e[t]:null}function o(){if(!r())throw new Error;t++}function i(e){var t=n();if(t&&"OPERATOR"===t.type&&e===t.string)return o(),t.string}function s(){var e=n();if(e&&"LICENSE"===e.type){o();var t={license:e.string};i("+")&&(t.plus=!0);var r=function(){if(i("WITH")){var e=n();if(e&&"EXCEPTION"===e.type)return o(),e.string;throw new Error("Expected exception after `WITH`")}}();return r&&(t.exception=r),t}}function a(e,t){return function r(){var n=t();if(n){if(!i(e))return n;var o=r();if(!o)throw new Error("Expected expression");return{left:n,conjunction:e.toLowerCase(),right:o}}}}var c=a("AND",function(){return function(){if(i("(")){var e=l();if(!i(")"))throw new Error("Expected `)`");return e}}()||function(){var e=t,r="",s=n();if("DOCUMENTREF"===s.type&&(o(),r+="DocumentRef-"+s.string+":",!i(":")))throw new Error("Expected `:` after `DocumentRef-...`");if("LICENSEREF"===(s=n()).type)return o(),{license:r+="LicenseRef-"+s.string};t=e}()||s()}),l=a("OR",c),d=l();if(!d||r())throw new Error("Syntax error");return d}),Kt}function ar(){if(Xt)return Jt;Xt=1;var e=ir(),t=sr();return Jt=function(r){return t(e(r))}}function cr(){if(tr)return er;tr=1;var e=ar(),t=function(){if(Qt)return Zt;Qt=1;var e=ar(),t=rr;function r(t){try{return e(t),!0}catch(e){return!1}}function n(e,t){var r=t[0].length-e[0].length;return 0!==r?r:e[0].toUpperCase().localeCompare(t[0].toUpperCase())}var o=[["APGL","AGPL"],["Gpl","GPL"],["GLP","GPL"],["APL","Apache"],["ISD","ISC"],["GLP","GPL"],["IST","ISC"],["Claude","Clause"],[" or later","+"],[" International",""],["GNU","GPL"],["GUN","GPL"],["+",""],["GNU GPL","GPL"],["GNU LGPL","LGPL"],["GNU/GPL","GPL"],["GNU GLP","GPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL"],["GNU Lesser General Public License","LGPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["GNU Lesser General Public License","LGPL-2.1"],["LESSER GENERAL PUBLIC LICENSE","LGPL"],["Lesser General Public License","LGPL"],["LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["Lesser General Public License","LGPL-2.1"],["GNU General Public License","GPL"],["Gnu public license","GPL"],["GNU Public License","GPL"],["GNU GENERAL PUBLIC LICENSE","GPL"],["MTI","MIT"],["Mozilla Public License","MPL"],["Universal Permissive License","UPL"],["WTH","WTF"],["WTFGPL","WTFPL"],["-License",""]].sort(n),i=[function(e){return e.toUpperCase()},function(e){return e.trim()},function(e){return e.replace(/\./g,"")},function(e){return e.replace(/\s+/g,"")},function(e){return e.replace(/\s+/g,"-")},function(e){return e.replace("v","-")},function(e){return e.replace(/,?\s*(\d)/,"-$1")},function(e){return e.replace(/,?\s*(\d)/,"-$1.0")},function(e){return e.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2")},function(e){return e.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2.0")},function(e){return e[0].toUpperCase()+e.slice(1)},function(e){return e.replace("/","-")},function(e){return e.replace(/\s*V\s*(\d)/,"-$1").replace(/(\d)$/,"$1.0")},function(e){return-1!==e.indexOf("3.0")?e+"-or-later":e+"-only"},function(e){return e+"only"},function(e){return e.replace(/(\d)$/,"-$1.0")},function(e){return e.replace(/(-| )?(\d)$/,"-$2-Clause")},function(e){return e.replace(/(-| )clause(-| )(\d)/,"-$3-Clause")},function(e){return e.replace(/\b(Modified|New|Revised)(-| )?BSD((-| )License)?/i,"BSD-3-Clause")},function(e){return e.replace(/\bSimplified(-| )?BSD((-| )License)?/i,"BSD-2-Clause")},function(e){return e.replace(/\b(Free|Net)(-| )?BSD((-| )License)?/i,"BSD-2-Clause-$1BSD")},function(e){return e.replace(/\bClear(-| )?BSD((-| )License)?/i,"BSD-3-Clause-Clear")},function(e){return e.replace(/\b(Old|Original)(-| )?BSD((-| )License)?/i,"BSD-4-Clause")},function(e){return"CC-"+e},function(e){return"CC-"+e+"-4.0"},function(e){return e.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")},function(e){return"CC-"+e.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")+"-4.0"}],s=t.map(function(e){var t=/^(.*)-\d+\.\d+$/.exec(e);return t?[t[0],t[1]]:[e,null]}).reduce(function(e,t){var r=t[1];return e[r]=e[r]||[],e[r].push(t[0]),e},{}),a=Object.keys(s).map(function(e){return[e,s[e]]}).filter(function(e){return 1===e[1].length&&null!==e[0]&&"APL"!==e[0]}).map(function(e){return[e[0],e[1][0]]});s=void 0;var c=[["UNLI","Unlicense"],["WTF","WTFPL"],["2 CLAUSE","BSD-2-Clause"],["2-CLAUSE","BSD-2-Clause"],["3 CLAUSE","BSD-3-Clause"],["3-CLAUSE","BSD-3-Clause"],["AFFERO","AGPL-3.0-or-later"],["AGPL","AGPL-3.0-or-later"],["APACHE","Apache-2.0"],["ARTISTIC","Artistic-2.0"],["Affero","AGPL-3.0-or-later"],["BEER","Beerware"],["BOOST","BSL-1.0"],["BSD","BSD-2-Clause"],["CDDL","CDDL-1.1"],["ECLIPSE","EPL-1.0"],["FUCK","WTFPL"],["GNU","GPL-3.0-or-later"],["LGPL","LGPL-3.0-or-later"],["GPLV1","GPL-1.0-only"],["GPL-1","GPL-1.0-only"],["GPLV2","GPL-2.0-only"],["GPL-2","GPL-2.0-only"],["GPL","GPL-3.0-or-later"],["MIT +NO-FALSE-ATTRIBS","MITNFA"],["MIT","MIT"],["MPL","MPL-2.0"],["X11","X11"],["ZLIB","Zlib"]].concat(a).sort(n),l=function(e){for(var t=0;t<i.length;t++){var n=i[t](e).trim();if(n!==e&&r(n))return n}return null},d=function(e){for(var t=e.toUpperCase(),r=0;r<c.length;r++){var n=c[r];if(t.indexOf(n[0])>-1)return n[1]}return null},u=function(e,t){for(var r=0;r<o.length;r++){var n=o[r],i=n[0];if(e.indexOf(i)>-1){var s=t(e.replace(i,n[1]));if(null!==s)return s}}return null};return Zt=function(e,t){var n=void 0===(t=t||{}).upgrade||!!t.upgrade;function o(e){return n?function(e){return-1!==["GPL-1.0","LGPL-1.0","AGPL-1.0","GPL-2.0","LGPL-2.0","AGPL-2.0","LGPL-2.1"].indexOf(e)?e+"-only":-1!==["GPL-1.0+","GPL-2.0+","GPL-3.0+","LGPL-2.0+","LGPL-2.1+","LGPL-3.0+","AGPL-1.0+","AGPL-3.0+"].indexOf(e)?e.replace(/\+$/,"-or-later"):-1!==["GPL-3.0","LGPL-3.0","AGPL-3.0"].indexOf(e)?e+"-or-later":e}(e):e}if("string"!=typeof e||0===e.trim().length)throw Error("Invalid argument. Expected non-empty string.");if(r(e=e.trim()))return o(e);var i=e.replace(/\+$/,"").trim();if(r(i))return o(i);var s=l(e);return null!==s||null!==(s=u(e,function(e){return r(e)?e:l(e)}))||null!==(s=d(e))||null!==(s=u(e,d))?o(s):null}}(),r='license should be a valid SPDX license expression (without "LicenseRef"), "UNLICENSED", or "SEE LICENSE IN <filename>"',n=/^SEE LICEN[CS]E IN (.+)$/;function o(e,t){return t.slice(0,e.length)===e}function i(e){if(e.hasOwnProperty("license")){var t=e.license;return o("LicenseRef",t)||o("DocumentRef",t)}return i(e.left)||i(e.right)}return er=function(o){var s;try{s=e(o)}catch(e){var a;if("UNLICENSED"===o||"UNLICENCED"===o)return{validForOldPackages:!0,validForNewPackages:!0,unlicensed:!0};if(a=n.exec(o))return{validForOldPackages:!0,validForNewPackages:!0,inFile:a[1]};var c={validForOldPackages:!1,validForNewPackages:!1,warnings:[r]};if(0!==o.trim().length){var l=t(o);l&&c.warnings.push('license is similar to the valid expression "'+l+'"')}return c}return i(s)?{validForNewPackages:!1,validForOldPackages:!1,spdx:!0,warnings:[r]}:{validForNewPackages:!0,validForOldPackages:!0,spdx:!0}}}var lr,dr,ur,pr,hr,fr,mr,gr,yr,vr,br,$r={};function wr(){if(lr)return $r;lr=1,Object.defineProperty($r,"__esModule",{value:!0}),$r.LRUCache=void 0;const e="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,t=new Set,r="object"==typeof process&&process?process:{},n=(e,t,n,o)=>{"function"==typeof r.emitWarning?r.emitWarning(e,t,n,o):console.error(`[${n}] ${t}: ${e}`)};let o=globalThis.AbortController,i=globalThis.AbortSignal;if(void 0===o){i=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(e,t){this._onabort.push(t)}},o=class{constructor(){t()}signal=new i;abort(e){if(!this.signal.aborted){this.signal.reason=e,this.signal.aborted=!0;for(const t of this.signal._onabort)t(e);this.signal.onabort?.(e)}}};let e="1"!==r.env?.LRU_CACHE_IGNORE_AC_WARNING;const t=()=>{e&&(e=!1,n("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}const s=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),a=e=>s(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?c:null:null;class c extends Array{constructor(e){super(e),this.fill(0)}}class l{heap;length;static#l=!1;static create(e){const t=a(e);if(!t)return[];l.#l=!0;const r=new l(e,t);return l.#l=!1,r}constructor(e,t){if(!l.#l)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}}class d{#d;#u;#p;#h;#f;#m;#g;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#y;#v;#b;#$;#w;#E;#S;#P;#_;#L;#C;#k;#N;#I;#O;#A;#T;#x;static unsafeExposeInternals(e){return{starts:e.#N,ttls:e.#I,sizes:e.#k,keyMap:e.#b,keyList:e.#$,valList:e.#w,next:e.#E,prev:e.#S,get head(){return e.#P},get tail(){return e.#_},free:e.#L,isBackgroundFetch:t=>e.#D(t),backgroundFetch:(t,r,n,o)=>e.#j(t,r,n,o),moveToTail:t=>e.#R(t),indexes:t=>e.#F(t),rindexes:t=>e.#M(t),isStale:t=>e.#G(t)}}get max(){return this.#d}get maxSize(){return this.#u}get calculatedSize(){return this.#v}get size(){return this.#y}get fetchMethod(){return this.#m}get memoMethod(){return this.#g}get dispose(){return this.#p}get onInsert(){return this.#h}get disposeAfter(){return this.#f}constructor(e){const{max:r=0,ttl:o,ttlResolution:i=1,ttlAutopurge:c,updateAgeOnGet:u,updateAgeOnHas:p,allowStale:h,dispose:f,onInsert:m,disposeAfter:g,noDisposeOnSet:y,noUpdateTTL:v,maxSize:b=0,maxEntrySize:$=0,sizeCalculation:w,fetchMethod:E,memoMethod:S,noDeleteOnFetchRejection:P,noDeleteOnStaleGet:_,allowStaleOnFetchRejection:L,allowStaleOnFetchAbort:C,ignoreFetchAbort:k}=e;if(0!==r&&!s(r))throw new TypeError("max option must be a nonnegative integer");const N=r?a(r):Array;if(!N)throw new Error("invalid max value: "+r);if(this.#d=r,this.#u=b,this.maxEntrySize=$||this.#u,this.sizeCalculation=w,this.sizeCalculation){if(!this.#u&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculation set to non-function")}if(void 0!==S&&"function"!=typeof S)throw new TypeError("memoMethod must be a function if defined");if(this.#g=S,void 0!==E&&"function"!=typeof E)throw new TypeError("fetchMethod must be a function if specified");if(this.#m=E,this.#A=!!E,this.#b=new Map,this.#$=new Array(r).fill(void 0),this.#w=new Array(r).fill(void 0),this.#E=new N(r),this.#S=new N(r),this.#P=0,this.#_=0,this.#L=l.create(r),this.#y=0,this.#v=0,"function"==typeof f&&(this.#p=f),"function"==typeof m&&(this.#h=m),"function"==typeof g?(this.#f=g,this.#C=[]):(this.#f=void 0,this.#C=void 0),this.#O=!!this.#p,this.#x=!!this.#h,this.#T=!!this.#f,this.noDisposeOnSet=!!y,this.noUpdateTTL=!!v,this.noDeleteOnFetchRejection=!!P,this.allowStaleOnFetchRejection=!!L,this.allowStaleOnFetchAbort=!!C,this.ignoreFetchAbort=!!k,0!==this.maxEntrySize){if(0!==this.#u&&!s(this.#u))throw new TypeError("maxSize must be a positive integer if specified");if(!s(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#U()}if(this.allowStale=!!h,this.noDeleteOnStaleGet=!!_,this.updateAgeOnGet=!!u,this.updateAgeOnHas=!!p,this.ttlResolution=s(i)||0===i?i:1,this.ttlAutopurge=!!c,this.ttl=o||0,this.ttl){if(!s(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#B()}if(0===this.#d&&0===this.ttl&&0===this.#u)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#d&&!this.#u){const e="LRU_CACHE_UNBOUNDED";if((e=>!t.has(e))(e)){t.add(e);n("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",e,d)}}}getRemainingTTL(e){return this.#b.has(e)?1/0:0}#B(){const t=new c(this.#d),r=new c(this.#d);this.#I=t,this.#N=r,this.#z=(n,o,i=e.now())=>{if(r[n]=0!==o?i:0,t[n]=o,0!==o&&this.ttlAutopurge){const e=setTimeout(()=>{this.#G(n)&&this.#V(this.#$[n],"expire")},o+1);e.unref&&e.unref()}},this.#H=n=>{r[n]=0!==t[n]?e.now():0},this.#q=(e,i)=>{if(t[i]){const s=t[i],a=r[i];if(!s||!a)return;e.ttl=s,e.start=a,e.now=n||o();const c=e.now-a;e.remainingTTL=s-c}};let n=0;const o=()=>{const t=e.now();if(this.ttlResolution>0){n=t;const e=setTimeout(()=>n=0,this.ttlResolution);e.unref&&e.unref()}return t};this.getRemainingTTL=e=>{const i=this.#b.get(e);if(void 0===i)return 0;const s=t[i],a=r[i];if(!s||!a)return 1/0;return s-((n||o())-a)},this.#G=e=>{const i=r[e],s=t[e];return!!s&&!!i&&(n||o())-i>s}}#H=()=>{};#q=()=>{};#z=()=>{};#G=()=>!1;#U(){const e=new c(this.#d);this.#v=0,this.#k=e,this.#W=t=>{this.#v-=e[t],e[t]=0},this.#K=(e,t,r,n)=>{if(this.#D(t))return 0;if(!s(r)){if(!n)throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");if("function"!=typeof n)throw new TypeError("sizeCalculation must be a function");if(r=n(t,e),!s(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return r},this.#Y=(t,r,n)=>{if(e[t]=r,this.#u){const r=this.#u-e[t];for(;this.#v>r;)this.#J(!0)}this.#v+=e[t],n&&(n.entrySize=r,n.totalCalculatedSize=this.#v)}}#W=e=>{};#Y=(e,t,r)=>{};#K=(e,t,r,n)=>{if(r||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#F({allowStale:e=this.allowStale}={}){if(this.#y)for(let t=this.#_;this.#X(t)&&(!e&&this.#G(t)||(yield t),t!==this.#P);)t=this.#S[t]}*#M({allowStale:e=this.allowStale}={}){if(this.#y)for(let t=this.#P;this.#X(t)&&(!e&&this.#G(t)||(yield t),t!==this.#_);)t=this.#E[t]}#X(e){return void 0!==e&&this.#b.get(this.#$[e])===e}*entries(){for(const e of this.#F())void 0===this.#w[e]||void 0===this.#$[e]||this.#D(this.#w[e])||(yield[this.#$[e],this.#w[e]])}*rentries(){for(const e of this.#M())void 0===this.#w[e]||void 0===this.#$[e]||this.#D(this.#w[e])||(yield[this.#$[e],this.#w[e]])}*keys(){for(const e of this.#F()){const t=this.#$[e];void 0===t||this.#D(this.#w[e])||(yield t)}}*rkeys(){for(const e of this.#M()){const t=this.#$[e];void 0===t||this.#D(this.#w[e])||(yield t)}}*values(){for(const e of this.#F()){void 0===this.#w[e]||this.#D(this.#w[e])||(yield this.#w[e])}}*rvalues(){for(const e of this.#M()){void 0===this.#w[e]||this.#D(this.#w[e])||(yield this.#w[e])}}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(const r of this.#F()){const n=this.#w[r],o=this.#D(n)?n.__staleWhileFetching:n;if(void 0!==o&&e(o,this.#$[r],this))return this.get(this.#$[r],t)}}forEach(e,t=this){for(const r of this.#F()){const n=this.#w[r],o=this.#D(n)?n.__staleWhileFetching:n;void 0!==o&&e.call(t,o,this.#$[r],this)}}rforEach(e,t=this){for(const r of this.#M()){const n=this.#w[r],o=this.#D(n)?n.__staleWhileFetching:n;void 0!==o&&e.call(t,o,this.#$[r],this)}}purgeStale(){let e=!1;for(const t of this.#M({allowStale:!0}))this.#G(t)&&(this.#V(this.#$[t],"expire"),e=!0);return e}info(t){const r=this.#b.get(t);if(void 0===r)return;const n=this.#w[r],o=this.#D(n)?n.__staleWhileFetching:n;if(void 0===o)return;const i={value:o};if(this.#I&&this.#N){const t=this.#I[r],n=this.#N[r];if(t&&n){const r=t-(e.now()-n);i.ttl=r,i.start=Date.now()}}return this.#k&&(i.size=this.#k[r]),i}dump(){const t=[];for(const r of this.#F({allowStale:!0})){const n=this.#$[r],o=this.#w[r],i=this.#D(o)?o.__staleWhileFetching:o;if(void 0===i||void 0===n)continue;const s={value:i};if(this.#I&&this.#N){s.ttl=this.#I[r];const t=e.now()-this.#N[r];s.start=Math.floor(Date.now()-t)}this.#k&&(s.size=this.#k[r]),t.unshift([n,s])}return t}load(t){this.clear();for(const[r,n]of t){if(n.start){const t=Date.now()-n.start;n.start=e.now()-t}this.set(r,n.value,n)}}set(e,t,r={}){if(void 0===t)return this.delete(e),this;const{ttl:n=this.ttl,start:o,noDisposeOnSet:i=this.noDisposeOnSet,sizeCalculation:s=this.sizeCalculation,status:a}=r;let{noUpdateTTL:c=this.noUpdateTTL}=r;const l=this.#K(e,t,r.size||0,s);if(this.maxEntrySize&&l>this.maxEntrySize)return a&&(a.set="miss",a.maxEntrySizeExceeded=!0),this.#V(e,"set"),this;let d=0===this.#y?void 0:this.#b.get(e);if(void 0===d)d=0===this.#y?this.#_:0!==this.#L.length?this.#L.pop():this.#y===this.#d?this.#J(!1):this.#y,this.#$[d]=e,this.#w[d]=t,this.#b.set(e,d),this.#E[this.#_]=d,this.#S[d]=this.#_,this.#_=d,this.#y++,this.#Y(d,l,a),a&&(a.set="add"),c=!1,this.#x&&this.#h?.(t,e,"add");else{this.#R(d);const r=this.#w[d];if(t!==r){if(this.#A&&this.#D(r)){r.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:t}=r;void 0===t||i||(this.#O&&this.#p?.(t,e,"set"),this.#T&&this.#C?.push([t,e,"set"]))}else i||(this.#O&&this.#p?.(r,e,"set"),this.#T&&this.#C?.push([r,e,"set"]));if(this.#W(d),this.#Y(d,l,a),this.#w[d]=t,a){a.set="replace";const e=r&&this.#D(r)?r.__staleWhileFetching:r;void 0!==e&&(a.oldValue=e)}}else a&&(a.set="update");this.#x&&this.onInsert?.(t,e,t===r?"update":"replace")}if(0===n||this.#I||this.#B(),this.#I&&(c||this.#z(d,n,o),a&&this.#q(a,d)),!i&&this.#T&&this.#C){const e=this.#C;let t;for(;t=e?.shift();)this.#f?.(...t)}return this}pop(){try{for(;this.#y;){const e=this.#w[this.#P];if(this.#J(!0),this.#D(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(void 0!==e)return e}}finally{if(this.#T&&this.#C){const e=this.#C;let t;for(;t=e?.shift();)this.#f?.(...t)}}}#J(e){const t=this.#P,r=this.#$[t],n=this.#w[t];return this.#A&&this.#D(n)?n.__abortController.abort(new Error("evicted")):(this.#O||this.#T)&&(this.#O&&this.#p?.(n,r,"evict"),this.#T&&this.#C?.push([n,r,"evict"])),this.#W(t),e&&(this.#$[t]=void 0,this.#w[t]=void 0,this.#L.push(t)),1===this.#y?(this.#P=this.#_=0,this.#L.length=0):this.#P=this.#E[t],this.#b.delete(r),this.#y--,t}has(e,t={}){const{updateAgeOnHas:r=this.updateAgeOnHas,status:n}=t,o=this.#b.get(e);if(void 0!==o){const e=this.#w[o];if(this.#D(e)&&void 0===e.__staleWhileFetching)return!1;if(!this.#G(o))return r&&this.#H(o),n&&(n.has="hit",this.#q(n,o)),!0;n&&(n.has="stale",this.#q(n,o))}else n&&(n.has="miss");return!1}peek(e,t={}){const{allowStale:r=this.allowStale}=t,n=this.#b.get(e);if(void 0===n||!r&&this.#G(n))return;const o=this.#w[n];return this.#D(o)?o.__staleWhileFetching:o}#j(e,t,r,n){const i=void 0===t?void 0:this.#w[t];if(this.#D(i))return i;const s=new o,{signal:a}=r;a?.addEventListener("abort",()=>s.abort(a.reason),{signal:s.signal});const c={signal:s.signal,options:r,context:n},l=(n,o=!1)=>{const{aborted:i}=s.signal,a=r.ignoreFetchAbort&&void 0!==n;if(r.status&&(i&&!o?(r.status.fetchAborted=!0,r.status.fetchError=s.signal.reason,a&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),i&&!a&&!o)return d(s.signal.reason);const l=u;return this.#w[t]===u&&(void 0===n?l.__staleWhileFetching?this.#w[t]=l.__staleWhileFetching:this.#V(e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(e,n,c.options))),n},d=n=>{const{aborted:o}=s.signal,i=o&&r.allowStaleOnFetchAbort,a=i||r.allowStaleOnFetchRejection,c=a||r.noDeleteOnFetchRejection,l=u;if(this.#w[t]===u){!c||void 0===l.__staleWhileFetching?this.#V(e,"fetch"):i||(this.#w[t]=l.__staleWhileFetching)}if(a)return r.status&&void 0!==l.__staleWhileFetching&&(r.status.returnedStale=!0),l.__staleWhileFetching;if(l.__returned===l)throw n};r.status&&(r.status.fetchDispatched=!0);const u=new Promise((t,n)=>{const o=this.#m?.(e,i,c);o&&o instanceof Promise&&o.then(e=>t(void 0===e?void 0:e),n),s.signal.addEventListener("abort",()=>{r.ignoreFetchAbort&&!r.allowStaleOnFetchAbort||(t(void 0),r.allowStaleOnFetchAbort&&(t=e=>l(e,!0)))})}).then(l,e=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=e),d(e))),p=Object.assign(u,{__abortController:s,__staleWhileFetching:i,__returned:void 0});return void 0===t?(this.set(e,p,{...c.options,status:void 0}),t=this.#b.get(e)):this.#w[t]=p,p}#D(e){if(!this.#A)return!1;const t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof o}async fetch(e,t={}){const{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:i=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size:a=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:u=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:h=this.allowStaleOnFetchAbort,context:f,forceRefresh:m=!1,status:g,signal:y}=t;if(!this.#A)return g&&(g.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:o,status:g});const v={allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:o,ttl:i,noDisposeOnSet:s,size:a,sizeCalculation:c,noUpdateTTL:l,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:u,allowStaleOnFetchAbort:h,ignoreFetchAbort:p,status:g,signal:y};let b=this.#b.get(e);if(void 0===b){g&&(g.fetch="miss");const t=this.#j(e,b,v,f);return t.__returned=t}{const t=this.#w[b];if(this.#D(t)){const e=r&&void 0!==t.__staleWhileFetching;return g&&(g.fetch="inflight",e&&(g.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}const o=this.#G(b);if(!m&&!o)return g&&(g.fetch="hit"),this.#R(b),n&&this.#H(b),g&&this.#q(g,b),t;const i=this.#j(e,b,v,f),s=void 0!==i.__staleWhileFetching&&r;return g&&(g.fetch=o?"stale":"refresh",s&&o&&(g.returnedStale=!0)),s?i.__staleWhileFetching:i.__returned=i}}async forceFetch(e,t={}){const r=await this.fetch(e,t);if(void 0===r)throw new Error("fetch() returned undefined");return r}memo(e,t={}){const r=this.#g;if(!r)throw new Error("no memoMethod provided to constructor");const{context:n,forceRefresh:o,...i}=t,s=this.get(e,i);if(!o&&void 0!==s)return s;const a=r(e,s,{options:i,context:n});return this.set(e,a,i),a}get(e,t={}){const{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:i}=t,s=this.#b.get(e);if(void 0!==s){const t=this.#w[s],a=this.#D(t);return i&&this.#q(i,s),this.#G(s)?(i&&(i.get="stale"),a?(i&&r&&void 0!==t.__staleWhileFetching&&(i.returnedStale=!0),r?t.__staleWhileFetching:void 0):(o||this.#V(e,"expire"),i&&r&&(i.returnedStale=!0),r?t:void 0)):(i&&(i.get="hit"),a?t.__staleWhileFetching:(this.#R(s),n&&this.#H(s),t))}i&&(i.get="miss")}#Z(e,t){this.#S[t]=e,this.#E[e]=t}#R(e){e!==this.#_&&(e===this.#P?this.#P=this.#E[e]:this.#Z(this.#S[e],this.#E[e]),this.#Z(this.#_,e),this.#_=e)}delete(e){return this.#V(e,"delete")}#V(e,t){let r=!1;if(0!==this.#y){const n=this.#b.get(e);if(void 0!==n)if(r=!0,1===this.#y)this.#Q(t);else{this.#W(n);const r=this.#w[n];if(this.#D(r)?r.__abortController.abort(new Error("deleted")):(this.#O||this.#T)&&(this.#O&&this.#p?.(r,e,t),this.#T&&this.#C?.push([r,e,t])),this.#b.delete(e),this.#$[n]=void 0,this.#w[n]=void 0,n===this.#_)this.#_=this.#S[n];else if(n===this.#P)this.#P=this.#E[n];else{const e=this.#S[n];this.#E[e]=this.#E[n];const t=this.#E[n];this.#S[t]=this.#S[n]}this.#y--,this.#L.push(n)}}if(this.#T&&this.#C?.length){const e=this.#C;let t;for(;t=e?.shift();)this.#f?.(...t)}return r}clear(){return this.#Q("delete")}#Q(e){for(const t of this.#M({allowStale:!0})){const r=this.#w[t];if(this.#D(r))r.__abortController.abort(new Error("deleted"));else{const n=this.#$[t];this.#O&&this.#p?.(r,n,e),this.#T&&this.#C?.push([r,n,e])}}if(this.#b.clear(),this.#w.fill(void 0),this.#$.fill(void 0),this.#I&&this.#N&&(this.#I.fill(0),this.#N.fill(0)),this.#k&&this.#k.fill(0),this.#P=0,this.#_=0,this.#L.length=0,this.#v=0,this.#y=0,this.#T&&this.#C){const e=this.#C;let t;for(;t=e?.shift();)this.#f?.(...t)}}}return $r.LRUCache=d,$r}function Er(){if(hr)return pr;hr=1;const e=te,t=(e,t,r)=>{const n=e.indexOf(r);return e.lastIndexOf(t,n>-1?n:1/0)},r=t=>{try{return new e.URL(t)}catch{}};return pr=(e,n)=>{const o=n?((e,t)=>{const r=e.indexOf(":"),n=e.slice(0,r+1);if(Object.prototype.hasOwnProperty.call(t,n))return e;const o=e.indexOf("@");return o>-1?o>r?`git+ssh://${e}`:e:e.indexOf("//")===r+1?e:`${e.slice(0,r+1)}//${e.slice(r+1)}`})(e,n):e;return r(o)||r((e=>{const r=t(e,"@","#"),n=t(e,":","#");return n>r&&(e=e.slice(0,n)+"/"+e.slice(n+1)),-1===t(e,":","#")&&-1===e.indexOf("//")&&(e=`git+ssh://${e}`),e})(o))},pr}function Sr(){if(mr)return fr;mr=1;const e=Er();return fr=(t,r,{gitHosts:n,protocols:o})=>{if(!t)return;const i=(e=>{const t=e.indexOf("#"),r=e.indexOf("/"),n=e.indexOf("/",r+1),o=e.indexOf(":"),i=/\s/.exec(e),s=e.indexOf("@"),a=!i||t>-1&&i.index>t,c=-1===s||t>-1&&s>t,l=-1===o||t>-1&&o>t,d=-1===n||t>-1&&n>t,u=r>0,p=t>-1?"/"!==e[t-1]:!e.endsWith("/"),h=!e.startsWith(".");return a&&u&&p&&h&&c&&l&&d})(t)?`github:${t}`:t,s=e(i,o);if(!s)return;const a=n.byShortcut[s.protocol],c=n.byDomain[s.hostname.startsWith("www.")?s.hostname.slice(4):s.hostname],l=a||c;if(!l)return;const d=n[a||c];let u=null;o[s.protocol]?.auth&&(s.username||s.password)&&(u=`${s.username}${s.password?":"+s.password:""}`);let p=null,h=null,f=null,m=null;try{if(a){let e=s.pathname.startsWith("/")?s.pathname.slice(1):s.pathname;const t=e.indexOf("@");t>-1&&(e=e.slice(t+1));const r=e.lastIndexOf("/");r>-1?(h=decodeURIComponent(e.slice(0,r)),h||(h=null),f=decodeURIComponent(e.slice(r+1))):f=decodeURIComponent(e),f.endsWith(".git")&&(f=f.slice(0,-4)),s.hash&&(p=decodeURIComponent(s.hash.slice(1))),m="shortcut"}else{if(!d.protocols.includes(s.protocol))return;const e=d.extract(s);if(!e)return;h=e.user&&decodeURIComponent(e.user),f=decodeURIComponent(e.project),p=decodeURIComponent(e.committish),m=o[s.protocol]?.name||s.protocol.slice(0,-1)}}catch(e){if(e instanceof URIError)return;throw e}return[l,h,u,f,p,m,r]}}function Pr(){if(yr)return gr;yr=1;const{LRUCache:e}=wr(),t=function(){if(ur)return dr;ur=1;const e=(...e)=>e.every(e=>e)?e.join(""):"",t=e=>e?encodeURIComponent(e):"",r=e=>e.toLowerCase().replace(/^\W+/g,"").replace(/(?<!\W)\W+$/,"").replace(/\//g,"").replace(/\W+/g,"-"),n={sshtemplate:({domain:t,user:r,project:n,committish:o})=>`git@${t}:${r}/${n}.git${e("#",o)}`,sshurltemplate:({domain:t,user:r,project:n,committish:o})=>`git+ssh://git@${t}/${r}/${n}.git${e("#",o)}`,edittemplate:({domain:r,user:n,project:o,committish:i,editpath:s,path:a})=>`https://${r}/${n}/${o}${e("/",s,"/",t(i||"HEAD"),"/",a)}`,browsetemplate:({domain:r,user:n,project:o,committish:i,treepath:s})=>`https://${r}/${n}/${o}${e("/",s,"/",t(i))}`,browsetreetemplate:({domain:r,user:n,project:o,committish:i,treepath:s,path:a,fragment:c,hashformat:l})=>`https://${r}/${n}/${o}/${s}/${t(i||"HEAD")}/${a}${e("#",l(c||""))}`,browseblobtemplate:({domain:r,user:n,project:o,committish:i,blobpath:s,path:a,fragment:c,hashformat:l})=>`https://${r}/${n}/${o}/${s}/${t(i||"HEAD")}/${a}${e("#",l(c||""))}`,docstemplate:({domain:r,user:n,project:o,treepath:i,committish:s})=>`https://${r}/${n}/${o}${e("/",i,"/",t(s))}#readme`,httpstemplate:({auth:t,domain:r,user:n,project:o,committish:i})=>`git+https://${e(t,"@")}${r}/${n}/${o}.git${e("#",i)}`,filetemplate:({domain:e,user:r,project:n,committish:o,path:i})=>`https://${e}/${r}/${n}/raw/${t(o||"HEAD")}/${i}`,shortcuttemplate:({type:t,user:r,project:n,committish:o})=>`${t}:${r}/${n}${e("#",o)}`,pathtemplate:({user:t,project:r,committish:n})=>`${t}/${r}${e("#",n)}`,bugstemplate:({domain:e,user:t,project:r})=>`https://${e}/${t}/${r}/issues`,hashformat:r},o={};o.github={protocols:["git:","http:","git+ssh:","git+https:","ssh:","https:"],domain:"github.com",treepath:"tree",blobpath:"blob",editpath:"edit",filetemplate:({auth:r,user:n,project:o,committish:i,path:s})=>`https://${e(r,"@")}raw.githubusercontent.com/${n}/${o}/${t(i||"HEAD")}/${s}`,gittemplate:({auth:t,domain:r,user:n,project:o,committish:i})=>`git://${e(t,"@")}${r}/${n}/${o}.git${e("#",i)}`,tarballtemplate:({domain:e,user:r,project:n,committish:o})=>`https://codeload.${e}/${r}/${n}/tar.gz/${t(o||"HEAD")}`,extract:e=>{let[,t,r,n,o]=e.pathname.split("/",5);if((!n||"tree"===n)&&(n||(o=e.hash.slice(1)),r&&r.endsWith(".git")&&(r=r.slice(0,-4)),t&&r))return{user:t,project:r,committish:o}}},o.bitbucket={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"bitbucket.org",treepath:"src",blobpath:"src",editpath:"?mode=edit",edittemplate:({domain:r,user:n,project:o,committish:i,treepath:s,path:a,editpath:c})=>`https://${r}/${n}/${o}${e("/",s,"/",t(i||"HEAD"),"/",a,c)}`,tarballtemplate:({domain:e,user:r,project:n,committish:o})=>`https://${e}/${r}/${n}/get/${t(o||"HEAD")}.tar.gz`,extract:e=>{let[,t,r,n]=e.pathname.split("/",4);if(!["get"].includes(n)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),t&&r))return{user:t,project:r,committish:e.hash.slice(1)}}},o.gitlab={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"gitlab.com",treepath:"tree",blobpath:"tree",editpath:"-/edit",httpstemplate:({auth:t,domain:r,user:n,project:o,committish:i})=>`git+https://${e(t,"@")}${r}/${n}/${o}.git${e("#",i)}`,tarballtemplate:({domain:e,user:r,project:n,committish:o})=>`https://${e}/${r}/${n}/repository/archive.tar.gz?ref=${t(o||"HEAD")}`,extract:e=>{const t=e.pathname.slice(1);if(t.includes("/-/")||t.includes("/archive.tar.gz"))return;const r=t.split("/");let n=r.pop();n.endsWith(".git")&&(n=n.slice(0,-4));const o=r.join("/");return o&&n?{user:o,project:n,committish:e.hash.slice(1)}:void 0}},o.gist={protocols:["git:","git+ssh:","git+https:","ssh:","https:"],domain:"gist.github.com",editpath:"edit",sshtemplate:({domain:t,project:r,committish:n})=>`git@${t}:${r}.git${e("#",n)}`,sshurltemplate:({domain:t,project:r,committish:n})=>`git+ssh://git@${t}/${r}.git${e("#",n)}`,edittemplate:({domain:r,user:n,project:o,committish:i,editpath:s})=>`https://${r}/${n}/${o}${e("/",t(i))}/${s}`,browsetemplate:({domain:r,project:n,committish:o})=>`https://${r}/${n}${e("/",t(o))}`,browsetreetemplate:({domain:r,project:n,committish:o,path:i,hashformat:s})=>`https://${r}/${n}${e("/",t(o))}${e("#",s(i))}`,browseblobtemplate:({domain:r,project:n,committish:o,path:i,hashformat:s})=>`https://${r}/${n}${e("/",t(o))}${e("#",s(i))}`,docstemplate:({domain:r,project:n,committish:o})=>`https://${r}/${n}${e("/",t(o))}`,httpstemplate:({domain:t,project:r,committish:n})=>`git+https://${t}/${r}.git${e("#",n)}`,filetemplate:({user:r,project:n,committish:o,path:i})=>`https://gist.githubusercontent.com/${r}/${n}/raw${e("/",t(o))}/${i}`,shortcuttemplate:({type:t,project:r,committish:n})=>`${t}:${r}${e("#",n)}`,pathtemplate:({project:t,committish:r})=>`${t}${e("#",r)}`,bugstemplate:({domain:e,project:t})=>`https://${e}/${t}`,gittemplate:({domain:t,project:r,committish:n})=>`git://${t}/${r}.git${e("#",n)}`,tarballtemplate:({project:e,committish:r})=>`https://codeload.github.com/gist/${e}/tar.gz/${t(r||"HEAD")}`,extract:e=>{let[,t,r,n]=e.pathname.split("/",4);if("raw"!==n){if(!r){if(!t)return;r=t,t=null}return r.endsWith(".git")&&(r=r.slice(0,-4)),{user:t,project:r,committish:e.hash.slice(1)}}},hashformat:function(e){return e&&"file-"+r(e)}},o.sourcehut={protocols:["git+ssh:","https:"],domain:"git.sr.ht",treepath:"tree",blobpath:"tree",filetemplate:({domain:e,user:r,project:n,committish:o,path:i})=>`https://${e}/${r}/${n}/blob/${t(o)||"HEAD"}/${i}`,httpstemplate:({domain:t,user:r,project:n,committish:o})=>`https://${t}/${r}/${n}.git${e("#",o)}`,tarballtemplate:({domain:e,user:r,project:n,committish:o})=>`https://${e}/${r}/${n}/archive/${t(o)||"HEAD"}.tar.gz`,bugstemplate:()=>null,extract:e=>{let[,t,r,n]=e.pathname.split("/",4);if(!["archive"].includes(n)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),t&&r))return{user:t,project:r,committish:e.hash.slice(1)}}};for(const[e,t]of Object.entries(o))o[e]=Object.assign({},n,t);return dr=o}(),r=Sr(),n=Er(),o=new e({max:1e3});class i{constructor(e,t,r,n,o,s,a={}){Object.assign(this,i.#ee[e],{type:e,user:t,auth:r,project:n,committish:o,default:s,opts:a})}static#ee={byShortcut:{},byDomain:{}};static#te={"git+ssh:":{name:"sshurl"},"ssh:":{name:"sshurl"},"git+https:":{name:"https",auth:!0},"git:":{auth:!0},"http:":{auth:!0},"https:":{auth:!0},"git+http:":{auth:!0}};static addHost(e,t){i.#ee[e]=t,i.#ee.byDomain[t.domain]=e,i.#ee.byShortcut[`${e}:`]=e,i.#te[`${e}:`]={name:e}}static fromUrl(e,t){if("string"!=typeof e)return;const n=e+JSON.stringify(t||{});if(!o.has(n)){const s=r(e,t,{gitHosts:i.#ee,protocols:i.#te});o.set(n,s?new i(...s):void 0)}return o.get(n)}static fromManifest(e,t={}){if(!e||"object"!=typeof e)return;const r=e.repository,n=r&&("string"==typeof r?r:"object"==typeof r&&"string"==typeof r.url?r.url:null);if(!n)throw new Error("no repository");const o=n&&i.fromUrl(n.replace(/^git\+/,""),t)||null;if(o)return o;const s=function(e){try{const{protocol:t,hostname:r,pathname:n}=new URL(e);if(!r)return null;return`${/(?:git\+)http:$/.test(t)?"http:":"https:"}//${r}${n.replace(/\.git$/,"")}`}catch{return null}}(n);return i.fromUrl(s,t)||s}static parseUrl(e){return n(e)}#re(e,t){if("function"!=typeof e)return null;const r={...this,...this.opts,...t};r.path||(r.path=""),r.path.startsWith("/")&&(r.path=r.path.slice(1)),r.noCommittish&&(r.committish=null);const n=e(r);return r.noGitPlus&&n.startsWith("git+")?n.slice(4):n}hash(){return this.committish?`#${this.committish}`:""}ssh(e){return this.#re(this.sshtemplate,e)}sshurl(e){return this.#re(this.sshurltemplate,e)}browse(e,...t){return"string"!=typeof e?this.#re(this.browsetemplate,e):"string"!=typeof t[0]?this.#re(this.browsetreetemplate,{...t[0],path:e}):this.#re(this.browsetreetemplate,{...t[1],fragment:t[0],path:e})}browseFile(e,...t){return"string"!=typeof t[0]?this.#re(this.browseblobtemplate,{...t[0],path:e}):this.#re(this.browseblobtemplate,{...t[1],fragment:t[0],path:e})}docs(e){return this.#re(this.docstemplate,e)}bugs(e){return this.#re(this.bugstemplate,e)}https(e){return this.#re(this.httpstemplate,e)}git(e){return this.#re(this.gittemplate,e)}shortcut(e){return this.#re(this.shortcuttemplate,e)}path(e){return this.#re(this.pathtemplate,e)}tarball(e){return this.#re(this.tarballtemplate,{...e,noCommittish:!1})}file(e,t){return this.#re(this.filetemplate,{...t,path:e})}edit(e,t){return this.#re(this.edittemplate,{...t,path:e})}getDefaultRepresentation(){return this.default}toString(e){return this.default&&"function"==typeof this[this.default]?this[this.default](e):this.sshurl(e)}}for(const[e,r]of Object.entries(t))i.addHost(e,r);return gr=i}var _r,Lr,Cr={topLevel:{dependancies:"dependencies",dependecies:"dependencies",depdenencies:"dependencies",devEependencies:"devDependencies",depends:"dependencies","dev-dependencies":"devDependencies",devDependences:"devDependencies",devDepenencies:"devDependencies",devdependencies:"devDependencies",repostitory:"repository",repo:"repository",prefereGlobal:"preferGlobal",hompage:"homepage",hampage:"homepage",autohr:"author",autor:"author",contributers:"contributors",publicationConfig:"publishConfig",script:"scripts"},bugs:{web:"url",name:"url"},script:{server:"start",tests:"test"}};function kr(){if(Lr)return _r;Lr=1;var{URL:e}=o,t=function(){if(Mt)return Ft;Mt=1;const e=Ht();return Ft=(t,r)=>{const n=e(t,r);return n?n.version:null}}(),r=function(){if(Ut)return Gt;Ut=1;const e=Ht();return Gt=(t,r)=>{const n=e(t.trim().replace(/^[=v]+/,""),r);return n?n.version:null}}(),n=cr(),i=Pr(),{isBuiltin:s}=re,a=["dependencies","devDependencies","optionalDependencies"],c=br?vr:(br=1,vr=function(e){if(!e)return;if("ERROR: No README data found!"===e)return;e=e.trim().split("\n");let t=0;for(;e[t]&&e[t].trim().match(/^(#|$)/);)t++;const r=e.length;let n=t+1;for(;n<r&&e[n].trim();)n++;return e.slice(t,n).join(" ").trim()}),l=Cr,d=e=>e.includes("@")&&e.indexOf("@")<e.lastIndexOf(".");function u(e,t){return e.author&&(e.author=t(e.author)),["maintainers","contributors"].forEach(function(r){Array.isArray(e[r])&&(e[r]=e[r].map(t))}),e}function p(e){if("string"==typeof e)return e;var t=e.name||"",r=e.url||e.web,n=r?" ("+r+")":"",o=e.email||e.mail;return t+(o?" <"+o+">":"")+n}function h(e){if("string"!=typeof e)return e;var t=e.match(/^([^(<]+)/),r=e.match(/\(([^()]+)\)/),n=e.match(/<([^<>]+)>/),o={};return t&&t[0].trim()&&(o.name=t[0].trim()),n&&(o.email=n[1]),r&&(o.url=r[1]),o}return _r={warn:function(){},fixRepositoryField:function(e){if(e.repositories&&(this.warn("repositories"),e.repository=e.repositories[0]),!e.repository)return this.warn("missingRepository");"string"==typeof e.repository&&(e.repository={type:"git",url:e.repository});var t=e.repository.url||"";if(t){var r=i.fromUrl(t);r&&(t=e.repository.url="shortcut"===r.getDefaultRepresentation()?r.https():r.toString())}t.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",t)},fixTypos:function(e){Object.keys(l.topLevel).forEach(function(t){Object.prototype.hasOwnProperty.call(e,t)&&this.warn("typo",t,l.topLevel[t])},this)},fixScriptsField:function(e){if(e.scripts)return"object"!=typeof e.scripts?(this.warn("nonObjectScripts"),void delete e.scripts):void Object.keys(e.scripts).forEach(function(t){"string"!=typeof e.scripts[t]?(this.warn("nonStringScript"),delete e.scripts[t]):l.script[t]&&!e.scripts[l.script[t]]&&this.warn("typo",t,l.script[t],"scripts")},this)},fixFilesField:function(e){var t=e.files;t&&!Array.isArray(t)?(this.warn("nonArrayFiles"),delete e.files):e.files&&(e.files=e.files.filter(function(e){return!(!e||"string"!=typeof e)||(this.warn("invalidFilename",e),!1)},this))},fixBinField:function(e){if(e.bin&&"string"==typeof e.bin){var t,r={};(t=e.name.match(/^@[^/]+[/](.*)$/))?r[t[1]]=e.bin:r[e.name]=e.bin,e.bin=r}},fixManField:function(e){e.man&&"string"==typeof e.man&&(e.man=[e.man])},fixBundleDependenciesField:function(e){var t="bundledDependencies",r="bundleDependencies";e[t]&&!e[r]&&(e[r]=e[t],delete e[t]),e[r]&&!Array.isArray(e[r])?(this.warn("nonArrayBundleDependencies"),delete e[r]):e[r]&&(e[r]=e[r].filter(function(t){return t&&"string"==typeof t?(e.dependencies||(e.dependencies={}),Object.prototype.hasOwnProperty.call(e.dependencies,t)||(this.warn("nonDependencyBundleDependency",t),e.dependencies[t]="*"),!0):(this.warn("nonStringBundleDependency",t),!1)},this))},fixDependencies:function(e){!function(e,t){a.forEach(function(r){e[r]&&(e[r]=function(e,t,r){if(!e)return{};"string"==typeof e&&(e=e.trim().split(/[\n\r\s\t ,]+/));if(!Array.isArray(e))return e;r("deprecatedArrayDependencies",t);var n={};return e.filter(function(e){return"string"==typeof e}).forEach(function(e){var t=(e=e.trim().split(/(:?[@\s><=])/)).shift(),r=e.join("");r=(r=r.trim()).replace(/^@/,""),n[t]=r}),n}(e[r],r,t))})}(e,this.warn),function(e){var t=e.optionalDependencies;if(!t)return;var r=e.dependencies||{};Object.keys(t).forEach(function(e){r[e]=t[e]}),e.dependencies=r}(e,this.warn),this.fixBundleDependenciesField(e),["dependencies","devDependencies"].forEach(function(t){if(t in e)return e[t]&&"object"==typeof e[t]?void Object.keys(e[t]).forEach(function(r){var n=e[t][r];"string"!=typeof n&&(this.warn("nonStringDependency",r,JSON.stringify(n)),delete e[t][r]);var o=i.fromUrl(e[t][r]);o&&(e[t][r]=o.toString())},this):(this.warn("nonObjectDependencies",t),void delete e[t])},this)},fixModulesField:function(e){e.modules&&(this.warn("deprecatedModules"),delete e.modules)},fixKeywordsField:function(e){"string"==typeof e.keywords&&(e.keywords=e.keywords.split(/,\s+/)),e.keywords&&!Array.isArray(e.keywords)?(delete e.keywords,this.warn("nonArrayKeywords")):e.keywords&&(e.keywords=e.keywords.filter(function(e){return!("string"!=typeof e||!e)||(this.warn("nonStringKeyword"),!1)},this))},fixVersionField:function(e,n){var o=!n;if(!e.version)return e.version="",!0;if(!t(e.version,o))throw new Error('Invalid version: "'+e.version+'"');return e.version=r(e.version,o),!0},fixPeople:function(e){u(e,p),u(e,h)},fixNameField:function(e,t){"boolean"==typeof t?t={strict:t}:void 0===t&&(t={});var r=t.strict;if(e.name||r){if("string"!=typeof e.name)throw new Error("name field must be a string.");r||(e.name=e.name.trim()),function(e,t,r){if("."===e.charAt(0)||!function(e){if("@"!==e.charAt(0))return!1;var t=e.slice(1).split("/");if(2!==t.length)return!1;return t[0]&&t[1]&&t[0]===encodeURIComponent(t[0])&&t[1]===encodeURIComponent(t[1])}(e)&&(n=e,n.match(/[/@\s+%:]/)||n!==encodeURIComponent(n))||t&&!r&&e!==e.toLowerCase()||"node_modules"===e.toLowerCase()||"favicon.ico"===e.toLowerCase())throw new Error("Invalid name: "+JSON.stringify(e));var n}(e.name,r,t.allowLegacyCase),s(e.name)&&this.warn("conflictingName",e.name)}else e.name=""},fixDescriptionField:function(e){e.description&&"string"!=typeof e.description&&(this.warn("nonStringDescription"),delete e.description),e.readme&&!e.description&&(e.description=c(e.readme)),void 0===e.description&&delete e.description,e.description||this.warn("missingDescription")},fixReadmeField:function(e){e.readme||(this.warn("missingReadme"),e.readme="ERROR: No README data found!")},fixBugsField:function(t){if(!t.bugs&&t.repository&&t.repository.url){var r=i.fromUrl(t.repository.url);r&&r.bugs()&&(t.bugs={url:r.bugs()})}else if(t.bugs){if("string"==typeof t.bugs)d(t.bugs)?t.bugs={email:t.bugs}:e.canParse(t.bugs)?t.bugs={url:t.bugs}:this.warn("nonEmailUrlBugsString");else{!function(e,t){if(!e)return;Object.keys(e).forEach(function(r){l.bugs[r]&&(t("typo",r,l.bugs[r],"bugs"),e[l.bugs[r]]=e[r],delete e[r])})}(t.bugs,this.warn);var n=t.bugs;t.bugs={},n.url&&(e.canParse(n.url)?t.bugs.url=n.url:this.warn("nonUrlBugsUrlField")),n.email&&("string"==typeof n.email&&d(n.email)?t.bugs.email=n.email:this.warn("nonEmailBugsEmailField"))}t.bugs.email||t.bugs.url||(delete t.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(t){if(!t.homepage&&t.repository&&t.repository.url){var r=i.fromUrl(t.repository.url);r&&r.docs()&&(t.homepage=r.docs())}if(t.homepage)return"string"!=typeof t.homepage?(this.warn("nonUrlHomepage"),delete t.homepage):void(e.canParse(t.homepage)||(t.homepage="http://"+t.homepage))},fixLicenseField:function(e){const t=e.license||e.licence;return t?"string"!=typeof t||t.length<1||""===t.trim()?this.warn("invalidLicense"):n(t).validForNewPackages?void 0:this.warn("invalidLicense"):this.warn("missingLicense")}},_r}var Nr,Ir,Or,Ar,Tr={repositories:"'repositories' (plural) Not supported. Please pick one as the 'repository' field",missingRepository:"No repository field.",brokenGitUrl:"Probably broken git url: %s",nonObjectScripts:"scripts must be an object",nonStringScript:"script values must be string commands",nonArrayFiles:"Invalid 'files' member",invalidFilename:"Invalid filename in 'files' list: %s",nonArrayBundleDependencies:"Invalid 'bundleDependencies' list. Must be array of package names",nonStringBundleDependency:"Invalid bundleDependencies member: %s",nonDependencyBundleDependency:"Non-dependency in bundleDependencies: %s",nonObjectDependencies:"%s field must be an object",nonStringDependency:"Invalid dependency: %s %s",deprecatedArrayDependencies:"specifying %s as array is deprecated",deprecatedModules:"modules field is deprecated",nonArrayKeywords:"keywords should be an array of strings",nonStringKeyword:"keywords should be an array of strings",conflictingName:"%s is also the name of a node core module.",nonStringDescription:"'description' field should be a string",missingDescription:"No description",missingReadme:"No README data",missingLicense:"No license field.",nonEmailUrlBugsString:"Bug string field must be url, email, or {email,url}",nonUrlBugsUrlField:"bugs.url field must be a string url. Deleted.",nonEmailBugsEmailField:"bugs.email field must be a string email. Deleted.",emptyNormalizedBugs:"Normalized value of bugs field is an empty object. Deleted.",nonUrlHomepage:"homepage field must be a string url. Deleted.",invalidLicense:"license should be a valid SPDX license expression",typo:"%s should probably be %s."};function xr(){if(Ir)return Nr;Ir=1;var e=ne,t=Tr;function r(r,n,o){return o&&(r=o+"['"+r+"']",n=o+"['"+n+"']"),e.format(t.typo,r,n)}return Nr=function(){var n=Array.prototype.slice.call(arguments,0),o=n.shift();if("typo"===o)return r.apply(null,n);var i=t[o]?t[o]:o+": '%s'";return n.unshift(i),e.format.apply(null,n)},Nr}!function(){if(Ar)return Or;Ar=1,Or=n;var e=kr();n.fixer=e;var t=xr(),r=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"].map(function(e){return o(e)+"Field"});function n(n,i,s){!0===i&&(i=null,s=!0),s||(s=!1),i&&!n.private||(i=function(){}),n.scripts&&"node-gyp rebuild"===n.scripts.install&&!n.scripts.preinstall&&(n.gypfile=!0),e.warn=function(){i(t.apply(null,arguments))},r.forEach(function(t){e["fix"+o(t)](n,s)}),n._id=n.name+"@"+n.version}function o(e){return e.charAt(0).toUpperCase()+e.slice(1)}r=r.concat(["dependencies","people","typos"])}();const Dr=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 d("portal:manifest",{debug:t.debug}),n=await _({log:r,manifest:e});if(t.output){const e=s(process.cwd(),t.output);r?.start("Writing manifest to file",t.output),qe(a(e))||await T(a(e),{recursive:!0}),await x(e,JSON.stringify(n.manifest,null,2)),r?.succeed("Manifest written to file",e)}else console.log(JSON.stringify(n.manifest,null,2))});var jr,Rr={exports:{}},Fr={},Mr={},Gr={},Ur={},Br={},zr={};function Vr(){return jr||(jr=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 n 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 o(e,...t){const r=[e[0]];let o=0;for(;o<t.length;)a(r,t[o]),r.push(e[++o]);return new n(r)}e._Code=n,e.nil=new n(""),e._=o;const i=new n("+");function s(e,...t){const r=[l(e[0])];let o=0;for(;o<t.length;)r.push(i),a(r,t[o]),r.push(i,l(e[++o]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===i){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 n(r)}function a(e,t){var o;t instanceof n?e.push(...t._items):t instanceof r?e.push(t):e.push("number"==typeof(o=t)||"boolean"==typeof o||null===o?o:l(Array.isArray(o)?o.join(","):o))}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 l(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.str=s,e.addCodeArg=a,e.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:s`${e}${t}`},e.stringify=function(e){return new n(l(e))},e.safeStringify=l,e.getProperty=function(t){return"string"==typeof t&&e.IDENTIFIER.test(t)?new n(`.${t}`):o`[${t}]`},e.getEsmExportName=function(t){if("string"==typeof t&&e.IDENTIFIER.test(t))return new n(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)},e.regexpCode=function(e){return new n(e.toString())}}(zr)),zr}var Hr,qr,Wr={};function Kr(){return Hr||(Hr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=Vr();class r extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}var n;!function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"}(n||(e.UsedValueState=n={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class o{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=o;class i extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=t._`.${new t.Name(r)}[${n}]`}}e.ValueScopeName=i;const s=t._`\n`;e.ValueScope=class extends o{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 i(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 n=this.toName(e),{prefix:o}=n,i=null!==(r=t.key)&&void 0!==r?r:t.ref;let s=this._values[o];if(s){const e=s.get(i);if(e)return e}else s=this._values[o]=new Map;s.set(i,n);const a=this._scope[o]||(this._scope[o]=[]),c=a.length;return a[c]=t.ref,n.setValue(t,{property:o,itemIndex:c}),n}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(o,i,s={},a){let c=t.nil;for(const l in o){const d=o[l];if(!d)continue;const u=s[l]=s[l]||new Map;d.forEach(o=>{if(u.has(o))return;u.set(o,n.Started);let s=i(o);if(s){const r=this.opts.es5?e.varKinds.var:e.varKinds.const;c=t._`${c}${r} ${o} = ${s};${this.opts._n}`}else{if(!(s=null==a?void 0:a(o)))throw new r(o);c=t._`${c}${s}${this.opts._n}`}u.set(o,n.Completed)})}return c}}}(Wr)),Wr}function Yr(){return qr||(qr=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=Vr(),r=Kr();var n=Vr();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var o=Kr();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return o.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 i{optimizeNodes(){return this}optimizeNames(e,t){return this}}class s extends i{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){const n=e?r.varKinds.var:this.varKind,o=void 0===this.rhs?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+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 a extends i{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 k(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}}class c extends a{constructor(e,t,r,n){super(e,r,n),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class l extends i{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class d extends i{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class u extends i{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class p extends i{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 h extends i{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 n=r.length;for(;n--;){const o=r[n];o.optimizeNames(e,t)||(I(e,o.names),r.splice(n,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>C(e,t.names),{})}}class f extends h{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class m extends h{}class g extends f{}g.kind="else";class y extends f{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(O(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=N(this.condition,e,t),this}get names(){const e=super.names;return k(e,this.condition),this.else&&C(e,this.else.names),e}}y.kind="if";class v extends f{}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=N(this.iteration,e,t),this}get names(){return C(super.names,this.iteration.names)}}class $ extends v{constructor(e,t,r,n){super(),this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){const t=e.es5?r.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${t} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(e)}get names(){const e=k(super.names,this.from);return k(e,this.to)}}class w extends v{constructor(e,t,r,n){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=n}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 C(super.names,this.iterable.names)}}class E extends f{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)}}E.kind="func";class S extends h{render(e){return"return "+super.render(e)}}S.kind="return";class P extends f{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,n;return super.optimizeNames(e,t),null===(r=this.catch)||void 0===r||r.optimizeNames(e,t),null===(n=this.finally)||void 0===n||n.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&C(e,this.catch.names),this.finally&&C(e,this.finally.names),e}}class _ extends f{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}_.kind="catch";class L extends f{render(e){return"finally"+super.render(e)}}L.kind="finally";function C(e,t){for(const r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function k(e,r){return r instanceof t._CodeOrName?C(e,r.names):e}function N(e,r,n){return e instanceof t.Name?i(e):(o=e)instanceof t._Code&&o._items.some(e=>e instanceof t.Name&&1===r[e.str]&&void 0!==n[e.str])?new t._Code(e._items.reduce((e,r)=>(r instanceof t.Name&&(r=i(r)),r instanceof t._Code?e.push(...r._items):e.push(r),e),[])):e;var o;function i(e){const t=n[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 O(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:t._`!${D(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 m]}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,n){const o=this._scope.toName(t);return void 0!==r&&n&&(this._constants[o.str]=r),this._leafNode(new s(e,o,r)),o}const(e,t,n){return this._def(r.varKinds.const,e,t,n)}let(e,t,n){return this._def(r.varKinds.let,e,t,n)}var(e,t,n){return this._def(r.varKinds.var,e,t,n)}assign(e,t,r){return this._leafNode(new a(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[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,t.addCodeArg)(r,o));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,n,o,i=(this.opts.es5?r.varKinds.var:r.varKinds.let)){const s=this._scope.toName(e);return this._for(new $(i,s,t,n),()=>o(s))}forOf(e,n,o,i=r.varKinds.const){const s=this._scope.toName(e);if(this.opts.es5){const e=n instanceof t.Name?n:this.var("_arr",n);return this.forRange("_i",0,t._`${e}.length`,r=>{this.var(s,t._`${e}[${r}]`),o(s)})}return this._for(new w("of",i,s,n),()=>o(s))}forIn(e,n,o,i=(this.opts.es5?r.varKinds.var:r.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,t._`Object.keys(${n})`,o);const s=this._scope.toName(e);return this._for(new w("in",i,s,n),()=>o(s))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new d(e))}return(e){const t=new S;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(S)}try(e,t,r){if(!t&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const n=new P;if(this._blockNode(n),this.code(e),t){const e=this.name("e");this._currNode=n.catch=new _(e),t(e)}return r&&(this._currNode=n.finally=new L,this.code(r)),this._endBlockNode(_,L)}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,n,o){return this._blockNode(new E(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(E)}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=O;const A=x(e.operators.AND);e.and=function(...e){return e.reduce(A)};const T=x(e.operators.OR);function x(e){return(r,n)=>r===t.nil?n:n===t.nil?r:t._`${D(r)} ${e} ${D(n)}`}function D(e){return e instanceof t.Name?e:t._`(${e})`}e.or=function(...e){return e.reduce(T)}}(Br)),Br}var Jr,Xr={};function Zr(){if(Jr)return Xr;Jr=1,Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.checkStrictMode=Xr.getErrorPath=Xr.Type=Xr.useFunc=Xr.setEvaluated=Xr.evaluatedPropsToName=Xr.mergeEvaluated=Xr.eachItem=Xr.unescapeJsonPointer=Xr.escapeJsonPointer=Xr.escapeFragment=Xr.unescapeFragment=Xr.schemaRefOrVal=Xr.schemaHasRulesButRef=Xr.schemaHasRules=Xr.checkUnknownRules=Xr.alwaysValidSchema=Xr.toHash=void 0;const e=Yr(),t=Vr();function r(e,t=e.schema){const{opts:r,self:n}=e;if(!r.strictSchema)return;if("boolean"==typeof t)return;const o=n.RULES.keywords;for(const r in t)o[r]||u(e,`unknown keyword: "${r}"`)}function n(e,t){if("boolean"==typeof e)return!e;for(const r in e)if(t[r])return!0;return!1}function o(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function i(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function s({mergeNames:t,mergeToName:r,mergeValues:n,resultToName:o}){return(i,s,a,c)=>{const l=void 0===a?s:a instanceof e.Name?(s instanceof e.Name?t(i,s,a):r(i,s,a),a):s instanceof e.Name?(r(i,a,s),s):n(s,a);return c!==e.Name||l instanceof e.Name?l:o(i,l)}}function a(t,r){if(!0===r)return t.var("props",!0);const n=t.var("props",e._`{}`);return void 0!==r&&c(t,n,r),n}function c(t,r,n){Object.keys(n).forEach(n=>t.assign(e._`${r}${(0,e.getProperty)(n)}`,!0))}Xr.toHash=function(e){const t={};for(const r of e)t[r]=!0;return t},Xr.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(r(e,t),!n(t,e.self.RULES.all))},Xr.checkUnknownRules=r,Xr.schemaHasRules=n,Xr.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},Xr.schemaRefOrVal=function({topSchemaRef:t,schemaPath:r},n,o,i){if(!i){if("number"==typeof n||"boolean"==typeof n)return n;if("string"==typeof n)return e._`${n}`}return e._`${t}${r}${(0,e.getProperty)(o)}`},Xr.unescapeFragment=function(e){return i(decodeURIComponent(e))},Xr.escapeFragment=function(e){return encodeURIComponent(o(e))},Xr.escapeJsonPointer=o,Xr.unescapeJsonPointer=i,Xr.eachItem=function(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)},Xr.mergeEvaluated={props:s({mergeNames:(t,r,n)=>t.if(e._`${n} !== true && ${r} !== undefined`,()=>{t.if(e._`${r} === true`,()=>t.assign(n,!0),()=>t.assign(n,e._`${n} || {}`).code(e._`Object.assign(${n}, ${r})`))}),mergeToName:(t,r,n)=>t.if(e._`${n} !== true`,()=>{!0===r?t.assign(n,!0):(t.assign(n,e._`${n} || {}`),c(t,n,r))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:a}),items:s({mergeNames:(t,r,n)=>t.if(e._`${n} !== true && ${r} !== undefined`,()=>t.assign(n,e._`${r} === true ? true : ${n} > ${r} ? ${n} : ${r}`)),mergeToName:(t,r,n)=>t.if(e._`${n} !== true`,()=>t.assign(n,!0===r||e._`${n} > ${r} ? ${n} : ${r}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},Xr.evaluatedPropsToName=a,Xr.setEvaluated=c;const l={};var d;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 Xr.useFunc=function(e,r){return e.scopeValue("func",{ref:r,code:l[r.code]||(l[r.code]=new t._Code(r.code))})},function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(d||(Xr.Type=d={})),Xr.getErrorPath=function(t,r,n){if(t instanceof e.Name){const o=r===d.Num;return n?o?e._`"[" + ${t} + "]"`:e._`"['" + ${t} + "']"`:o?e._`"/" + ${t}`:e._`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,e.getProperty)(t).toString():"/"+o(t)},Xr.checkStrictMode=u,Xr}var Qr,en,tn,rn={};function nn(){if(Qr)return rn;Qr=1,Object.defineProperty(rn,"__esModule",{value:!0});const e=Yr(),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 rn.default=t,rn}function on(){return en||(en=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=Yr(),r=Zr(),n=nn();function o(e,r){const o=e.const("err",r);e.if(t._`${n.default.vErrors} === null`,()=>e.assign(n.default.vErrors,t._`[${o}]`),t._`${n.default.vErrors}.push(${o})`),e.code(t._`${n.default.errors}++`)}function i(e,r){const{gen:n,validateName:o,schemaEnv:i}=e;i.$async?n.throw(t._`new ${e.ValidationError}(${r})`):(n.assign(t._`${o}.errors`,r),n.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,n=e.keywordError,s,c){const{it:l}=r,{gen:d,compositeRule:u,allErrors:p}=l,h=a(r,n,s);(null!=c?c:u||p)?o(d,h):i(l,t._`[${h}]`)},e.reportExtraError=function(t,r=e.keywordError,s){const{it:c}=t,{gen:l,compositeRule:d,allErrors:u}=c;o(l,a(t,r,s)),d||u||i(c,n.default.vErrors)},e.resetErrorsCount=function(e,r){e.assign(n.default.errors,r),e.if(t._`${n.default.vErrors} !== null`,()=>e.if(r,()=>e.assign(t._`${n.default.vErrors}.length`,r),()=>e.assign(n.default.vErrors,null)))},e.extendErrors=function({gen:e,keyword:r,schemaValue:o,data:i,errsCount:s,it:a}){if(void 0===s)throw new Error("ajv implementation error");const c=e.name("err");e.forRange("i",s,n.default.errors,s=>{e.const(c,t._`${n.default.vErrors}[${s}]`),e.if(t._`${c}.instancePath === undefined`,()=>e.assign(t._`${c}.instancePath`,(0,t.strConcat)(n.default.instancePath,a.errorPath))),e.assign(t._`${c}.schemaPath`,t.str`${a.errSchemaPath}/${r}`),a.opts.verbose&&(e.assign(t._`${c}.schema`,o),e.assign(t._`${c}.data`,i))})};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 a(e,r,o){const{createErrors:i}=e.it;return!1===i?t._`{}`:function(e,r,o={}){const{gen:i,it:a}=e,d=[c(a,o),l(e,o)];return function(e,{params:r,message:o},i){const{keyword:a,data:c,schemaValue:l,it:d}=e,{opts:u,propertyName:p,topSchemaRef:h,schemaPath:f}=d;i.push([s.keyword,a],[s.params,"function"==typeof r?r(e):r||t._`{}`]),u.messages&&i.push([s.message,"function"==typeof o?o(e):o]);u.verbose&&i.push([s.schema,l],[s.parentSchema,t._`${h}${f}`],[n.default.data,c]);p&&i.push([s.propertyName,p])}(e,r,d),i.object(...d)}(e,r,o)}function c({errorPath:e},{instancePath:o}){const i=o?t.str`${e}${(0,r.getErrorPath)(o,r.Type.Str)}`:e;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,i)]}function l({keyword:e,it:{errSchemaPath:n}},{schemaPath:o,parentSchema:i}){let a=i?n:t.str`${n}/${e}`;return o&&(a=t.str`${a}${(0,r.getErrorPath)(o,r.Type.Str)}`),[s.schemaPath,a]}}(Ur)),Ur}var sn,an={},cn={};function ln(){if(sn)return cn;sn=1,Object.defineProperty(cn,"__esModule",{value:!0}),cn.getRules=cn.isJSONType=void 0;const e=new Set(["string","number","integer","boolean","null","object","array"]);return cn.isJSONType=function(t){return"string"==typeof t&&e.has(t)},cn.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:{}}},cn}var dn,un,pn={};function hn(){if(dn)return pn;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 dn=1,Object.defineProperty(pn,"__esModule",{value:!0}),pn.shouldUseRule=pn.shouldUseGroup=pn.schemaHasRulesForType=void 0,pn.schemaHasRulesForType=function({schema:t,self:r},n){const o=r.RULES.types[n];return o&&!0!==o&&e(t,o)},pn.shouldUseGroup=e,pn.shouldUseRule=t,pn}function fn(){if(un)return an;un=1,Object.defineProperty(an,"__esModule",{value:!0}),an.reportTypeError=an.checkDataTypes=an.checkDataType=an.coerceAndCheckDataType=an.getJSONTypes=an.getSchemaTypes=an.DataType=void 0;const e=ln(),t=hn(),r=on(),n=Yr(),o=Zr();var i;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"}(i||(an.DataType=i={})),an.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},an.getJSONTypes=s,an.coerceAndCheckDataType=function(e,r){const{gen:o,data:s,opts:c}=e,d=function(e,t){return t?e.filter(e=>a.has(e)||"array"===t&&"array"===e):[]}(r,c.coerceTypes),p=r.length>0&&!(0===d.length&&1===r.length&&(0,t.schemaHasRulesForType)(e,r[0]));if(p){const t=l(r,s,c.strictNumbers,i.Wrong);o.if(t,()=>{d.length?function(e,t,r){const{gen:o,data:i,opts:s}=e,c=o.let("dataType",n._`typeof ${i}`),d=o.let("coerced",n._`undefined`);"array"===s.coerceTypes&&o.if(n._`${c} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>o.assign(i,n._`${i}[0]`).assign(c,n._`typeof ${i}`).if(l(t,i,s.strictNumbers),()=>o.assign(d,i)));o.if(n._`${d} !== undefined`);for(const e of r)(a.has(e)||"array"===e&&"array"===s.coerceTypes)&&p(e);function p(e){switch(e){case"string":return void o.elseIf(n._`${c} == "number" || ${c} == "boolean"`).assign(d,n._`"" + ${i}`).elseIf(n._`${i} === null`).assign(d,n._`""`);case"number":return void o.elseIf(n._`${c} == "boolean" || ${i} === null
|
|
1
|
+
import{createCommand as e,createOption as t,InvalidOptionArgumentError as r,Command as n}from"commander";import o,{fileURLToPath as i}from"node:url";import{resolve as s,dirname as a,join as c}from"node:path";import{readPackageUpSync as l}from"read-package-up";import{ConsoleLogger as d,buildApplication as u,bundleApp as p,FusionEnv as h,resolveDefaultEnv as f,checkApp as m,initializeFramework as g,uploadApplication as y,publishAppConfig as v,generateApplicationConfig as b,AllowedAppTags as $,tagApplication as w,loadAppManifest as E,startAppDevServer as S,startPortalDevServer as P,loadPortalManifest as _,buildPortal as L,bundlePortal as k,uploadPortalBundle as C,tagPortal as N,AllowedPortalTags as I,publishPortalConfig as O,generatePortalConfig as A}from"@equinor/fusion-framework-cli/bin";import{mkdir as x,writeFile as T}from"node:fs/promises";import{accessSync as D,constants as j,readFileSync as R,writeFileSync as F,rmSync as M,existsSync as G,readdirSync as U,copyFileSync as B,cpSync as z,mkdirSync as V}from"node:fs";import H from"node:assert";import q from"inquirer";import W from"is-path-inside";import{execa as K,ExecaError as Y}from"execa";import{spawn as J}from"node:child_process";import{tmpdir as X}from"node:os";import{simpleGit as Z,ResetMode as Q}from"simple-git";import{z as ee}from"zod";import te from"url";import re from"node:module";import ne from"util";import{importConfig as oe,importJSON as ie}from"@equinor/fusion-imports";import"deepmerge";const se=(e=0)=>t=>`[${t+e}m`,ae=(e=0)=>t=>`[${38+e};5;${t}m`,ce=(e=0)=>(t,r,n)=>`[${38+e};2;${t};${r};${n}m`,le={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(le.modifier);Object.keys(le.color),Object.keys(le.bgColor);const de=function(){const e=new Map;for(const[t,r]of Object.entries(le)){for(const[t,n]of Object.entries(r))le[t]={open:`[${n[0]}m`,close:`[${n[1]}m`},r[t]=le[t],e.set(n[0],n[1]);Object.defineProperty(le,t,{value:r,enumerable:!1})}return Object.defineProperty(le,"codes",{value:e,enumerable:!1}),le.color.close="[39m",le.bgColor.close="[49m",le.color.ansi=se(),le.color.ansi256=ae(),le.color.ansi16m=ce(),le.bgColor.ansi=se(10),le.bgColor.ansi256=ae(10),le.bgColor.ansi16m=ce(10),Object.defineProperties(le,{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 n=Number.parseInt(r,16);return[n>>16&255,n>>8&255,255&n]},enumerable:!1},hexToAnsi256:{value:e=>le.rgbToAnsi256(...le.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value(e){if(e<8)return 30+e;if(e<16)return e-8+90;let t,r,n;if(e>=232)t=(10*(e-232)+8)/255,r=t,n=t;else{const o=(e-=16)%36;t=Math.floor(e/36)/5,r=Math.floor(o/6)/5,n=o%6/5}const o=2*Math.max(t,r,n);if(0===o)return 30;let i=30+(Math.round(n)<<2|Math.round(r)<<1|Math.round(t));return 2===o&&(i+=60),i},enumerable:!1},rgbToAnsi:{value:(e,t,r)=>le.ansi256ToAnsi(le.rgbToAnsi256(e,t,r)),enumerable:!1},hexToAnsi:{value:e=>le.ansi256ToAnsi(le.hexToAnsi256(e)),enumerable:!1}}),le}(),ue=(()=>{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})(),pe=0!==ue&&{level:ue},he={stdout:pe,stderr:pe};function fe(e,t,r){let n=e.indexOf(t);if(-1===n)return e;const o=t.length;let i=0,s="";do{s+=e.slice(i,n)+t+r,i=n+o,n=e.indexOf(t,i)}while(-1!==n);return s+=e.slice(i),s}const{stdout:me,stderr:ge}=he,ye=Symbol("GENERATOR"),ve=Symbol("STYLER"),be=Symbol("IS_EMPTY"),$e=["ansi","ansi","ansi256","ansi16m"],we=Object.create(null),Ee=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=me?me.level:0;e.level=void 0===t.level?r:t.level})(t,e),Object.setPrototypeOf(t,Se.prototype),t};function Se(e){return Ee(e)}Object.setPrototypeOf(Se.prototype,Function.prototype);for(const[e,t]of Object.entries(de))we[e]={get(){const r=Ce(this,ke(t.open,t.close,this[ve]),this[be]);return Object.defineProperty(this,e,{value:r}),r}};we.visible={get(){const e=Ce(this,this[ve],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const Pe=(e,t,r,...n)=>"rgb"===e?"ansi16m"===t?de[r].ansi16m(...n):"ansi256"===t?de[r].ansi256(de.rgbToAnsi256(...n)):de[r].ansi(de.rgbToAnsi(...n)):"hex"===e?Pe("rgb",t,r,...de.hexToRgb(...n)):de[r][e](...n),_e=["rgb","hex","ansi256"];for(const e of _e){we[e]={get(){const{level:t}=this;return function(...r){const n=ke(Pe(e,$e[t],"color",...r),de.color.close,this[ve]);return Ce(this,n,this[be])}}};we["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const{level:t}=this;return function(...r){const n=ke(Pe(e,$e[t],"bgColor",...r),de.bgColor.close,this[ve]);return Ce(this,n,this[be])}}}}const Le=Object.defineProperties(()=>{},{...we,level:{enumerable:!0,get(){return this[ye].level},set(e){this[ye].level=e}}}),ke=(e,t,r)=>{let n,o;return void 0===r?(n=e,o=t):(n=r.openAll+e,o=t+r.closeAll),{open:e,close:t,openAll:n,closeAll:o,parent:r}},Ce=(e,t,r)=>{const n=(...e)=>Ne(n,1===e.length?""+e[0]:e.join(" "));return Object.setPrototypeOf(n,Le),n[ye]=e,n[ve]=t,n[be]=r,n},Ne=(e,t)=>{if(e.level<=0||!t)return e[be]?"":t;let r=e[ve];if(void 0===r)return t;const{openAll:n,closeAll:o}=r;if(t.includes(""))for(;void 0!==r;)t=fe(t,r.close,r.open),r=r.parent;const i=t.indexOf("\n");return-1!==i&&(t=function(e,t,r,n){let o=0,i="";do{const s="\r"===e[n-1];i+=e.slice(o,s?n-1:n)+t+(s?"\r\n":"\n")+r,o=n+1,n=e.indexOf("\n",o)}while(-1!==n);return i+=e.slice(o),i}(t,o,n,i)),n+t+o};Object.defineProperties(Se.prototype,we);const Ie=Se();Se({level:ge?ge.level:0});const Oe=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 d("app:build",{debug:t.debug});await u({log:r,manifest:e})}),Ae="app-bundle.zip",xe=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)",Ae).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 d("app:pack",{debug:t.debug});await p({log:r,manifest:e,archive:t.archive}).catch(e=>{r.error("Failed to create package:",e),process.exit(1)})}),Te=e=>{const r=Object.values(h).filter(t=>t!==h.Development||e.allowDev);return t("-e, --env <string>",`Set environment [${r.join(", ")}, custom].`).env("FUSION_ENV").default(e.default??f(e.allowDev))};Te({allowDev:!0});const De=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,je=t("--tenantId <string>","The Azure Active Directory tenant ID").env("FUSION_TENANT_ID").default("3aa4a235-b6e2-48d5-9195-7fcf05b459b0"),Re=t("--clientId <string>","The client ID of the application registered in Azure AD").env("FUSION_CLIENT_ID").default("a318b8e1-0295-4e17-98d5-35f67dfeba14"),Fe=t("--token <string>","The Azure AD access token. If provided, the --tenant and --client options are ignored").env("FUSION_TOKEN").default(void 0),Me=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"]),Ge=(e,t)=>(e.addOption(je),e.addOption(Re),t?.excludeToken||e.addOption(Fe),t?.includeScope&&e.addOption(Me),e.hook("preAction",e=>{const n=e.opts();if(n.token){if("string"!=typeof n.token||""===n.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(!n.tenantId||"string"!=typeof n.tenantId)throw new r("Tenant ID must be a non-empty string.");if(!De.test(n.tenantId))throw new r("Tenant ID must be a valid UUID.");if(!n.clientId||"string"!=typeof n.clientId)throw new r("Client ID must be a non-empty string.");if(!De.test(n.clientId))throw new r("Client ID must be a valid UUID.");if(t?.includeScope){if(!Array.isArray(n.scope)||0===n.scope.length)throw new r("Scope must be a non-empty array of strings.");for(const e of n.scope)if("string"!=typeof e||""===e.trim())throw new r("Each scope must be a non-empty string.")}}),e),Ue=Ge(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(Te({allowDev:!1})).action(e=>{const t=new d("app:check",{debug:!!e.debug});return m({log:t,environment:e.env,auth:"token"in e?{token:e.token}:e})})),Be=Ge(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(Te({allowDev:!1})).argument("[bundle]","Application bundle to upload",Ae).action(async(e,t)=>{const r=new d("portal:upload",{debug:t.debug});r?.start("💾 Initializing Fusion Framework...");const n=await g({env:t.env,auth:{token:t.token,tenantId:t.tenantId,clientId:t.clientId}});r?.succeed("💾 Initialized Fusion Framework"),await y({log:r,appKey:t.appKey,framework:n,fileOrBundle:e}).catch(e=>{r.error("😢 Failed to upload bundle:",e),process.exit(1)})})),ze=Ge(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(Te({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 d("app:config",{debug:!!t.debug});if(t.publish)return"dev"===t.env&&(r?.fail("🤪",Ie.blue("--env"),'cannot be "dev" when',Ie.blue("--publish")," is used"),process.exit(1)),v({config:t.config,manifest:t.manifest,environment:t.env,auth:"token"in t?{token:t.token}:t,debug:t.debug});const{config:n}=await b({log:r,config:e,env:{environment:t.env},output:"stdout"===t.output?void 0:t.output});"stdout"===t.output&&console.log(JSON.stringify(n,null,2))}));const Ve=Ge(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(Te({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($).join(" | ")})`).action(async(e,t)=>{const r=t.silent?null:new d("app:tag",{debug:t.debug}),n={command:"build",environment:t.env,mode:process.env.NODE_ENV??"production",root:process.cwd()};let o,i;try{({appKey:o,version:i}=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 E({manifest:e.manifest,env:t}),n=r.build?.version;if(!n)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:n}}(t,n))}catch(e){r?.error(`😢 ${e instanceof Error?e.message:"Unknown error occurred"}`),process.exit(1)}r?.info("Tagging application:",Ie.greenBright(`${o}@${i} - ${e}`)),r?.start("Initializing Fusion Framework...");const s=await g({env:t.env,auth:{token:t.token,tenantId:t.tenantId,clientId:t.clientId}});r?.succeed("Initialized Fusion Framework"),r?.start("Tagging application..."),await w({appKey:o,version:i,framework:s,log:r,tag:e}).catch(e=>{r?.error("Failed to tag application:",e),process.exit(1)})})),He=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 d("app:dev",{debug:e.debug});t.start("Starting application in development mode..."),S({log:t,manifest:e.manifest,config:e.config,env:e.env,port:e.port}),t.succeed("Development server started successfully.")}),qe=(e,t)=>{try{return D(e,j.F_OK),!0}catch(e){return!1}},We=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 d("app:manifest",{debug:t.debug}),n=await E({log:r,manifest:e});if("stdout"!==t.output){const e=s(process.cwd(),t.output);r?.start("Writing manifest to file",t.output),qe(a(e))||await x(a(e),{recursive:!0}),await T(e,JSON.stringify(n.manifest,null,2)),r?.succeed("Manifest written to file",e)}else console.log(JSON.stringify(n.manifest,null,2))}),Ke=Ge(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(Te({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($).join(" | ")})`,$.Latest).argument("[bundle]","Path to the app bundle to upload").action(async(e,t)=>{const r=new d("app:publish",{debug:t.debug});let n;if(e)r.info(`📦 Using provided bundle: ${e}`),n=e;else try{r.start("📦 Bundle application...");n=(await p({log:r,manifest:t.manifest})).archive,r.succeed("📦 Bundle completed")}catch(e){r.error("😢 Failed to bundle application:",e),process.exit(1)}n||(r.error("😢 No bundle provided or created. Please specify a bundle file."),process.exit(1)),r?.start("💾 Initializing Fusion Framework...");const o=await g({env:t.env,auth:{token:t.token,tenantId:t.tenantId,clientId:t.clientId}});r?.succeed("💾 Initialized Fusion Framework"),r.start("🚀 Uploading application...");const i=await y({log:r,framework:o,fileOrBundle:n}).catch(e=>{r.error("😢 Failed to upload bundle:",e),process.exit(1)});r.succeed("🚀 Upload completed"),r.debug("Upload result:",i),r.start("🏷️ Tagging application...");const s=await w({tag:t.tag,appKey:i.name,version:i.version,log:r,framework:o}).catch(e=>{r.error("😢 Failed to tag application:",e),process.exit(1)});r.succeed("Tagging completed"),r.debug("Tagging result:",s)}));async function Ye(e,t="https://registry.npmjs.org"){const r=await async function(e,t="https://registry.npmjs.org"){try{const r=await fetch(`${t}/${e}`);if(!r.ok)throw new Error(`Failed to fetch package info for ${e}: ${r.statusText}`);const n=await r.json();if(!n.name)throw new Error(`Invalid package data received for ${e}`);const o=n["dist-tags"]?.latest;if(!o)throw new Error(`No latest version found for package ${e}`);return{name:n.name,latest:o,versions:Object.keys(n.versions||{}),"dist-tags":n["dist-tags"]||{},description:n.description,homepage:n.homepage,repository:n.repository,author:n.author,license:n.license,keywords:n.keywords,dependencies:n.dependencies,devDependencies:n.devDependencies,peerDependencies:n.peerDependencies}}catch(t){throw new Error(`Failed to fetch package info for ${e}: ${t instanceof Error?t.message:String(t)}`)}}(e,t);return r.latest}async function Je(e,t){const r=[{key:"dependencies",deps:e.dependencies},{key:"devDependencies",deps:e.devDependencies},{key:"peerDependencies",deps:e.peerDependencies}].filter(e=>void 0!==e.deps&&null!==e.deps);if(0!==r.length){t?.start(`Resolving workspace dependencies for ${r.length} dependency types`);try{const n=await Promise.all(r.map(({key:e,deps:r})=>async function(e,t,r){try{const n=Object.entries(t).filter(e=>{return"string"==typeof(t=e[1])&&t.startsWith("workspace:");var t});if(0===n.length)return r?.debug(`No workspace dependencies found in ${e}`),{key:e,resolved:t};r?.debug(`Resolving ${n.length} workspace dependencies for ${e}`);const o=await Promise.all(n.map(async([e,t])=>{try{const n=await Ye(e);return r?.debug(`Resolved ${e}: ${t} -> ${n}`),[e,n]}catch(n){const o=n instanceof Error?n.message:String(n);return r?.debug(`Failed to resolve ${e}: ${o}`),[e,t]}})),i={...t};for(const[e,t]of o)i[e]=t;return r?.debug(`Successfully processed ${e} with ${o.length} resolved dependencies`),{key:e,resolved:i}}catch(n){const o=n instanceof Error?n.message:String(n);return r?.debug(`Error processing ${e}: ${o}`),{key:e,resolved:t}}}(e,r,t)));for(const{key:t,resolved:r}of n)e[t]=r;const o=n.reduce((e,{resolved:t})=>e+Object.keys(t).length,0);t?.succeed(`Workspace dependencies resolved successfully (${o} total dependencies processed)`)}catch(e){const r=e instanceof Error?e.message:String(e);throw t?.debug(`Error details: ${r}`),new Error(`Failed to resolve workspace dependencies: ${r}`)}}else t?.debug("No dependencies found to resolve")}function Xe(e,t){if("string"!=typeof e||""===e.trim())throw new Error("Target path must be a non-empty string");const r=s(e);if(t){const e=s(t);if(!W(r,e))throw new Error("The target path must be within the specified base directory. Please specify a relative path or ensure the absolute path is within the base directory.")}return r}function Ze(e,t,r){const n=Xe(e,r);M(n,t)}const Qe=["code","cursor"];async function et(e,t){t.info("By selecting an IDE, it will be opened in a new window."),t.info("👋 please come back to this terminal to continue."),t.info(`You can also open the project in your IDE later by typing e.g. \`code ${e}\` in the terminal.`),t.info("If you do not want to open the project in an IDE, select no.");const{openInIDE:r}=await q.prompt([{type:"list",name:"openInIDE",message:"🚀 Open project in IDE?",default:!1,choices:[{name:"VS Code",value:"code"},{name:"Cursor",value:"cursor"},{name:"No, I will open the project in my IDE later",value:!1}]}]);if(r){if(!function(e){return Qe.includes(e)}(r))return void t.error(`Invalid IDE command: ${r}. Only supported IDEs are: ${Qe.join(", ")}`);try{const n=K(r,[e],{stdio:"pipe",detached:!0});n.unref(),n.catch(e=>{void 0!==e.exitCode&&0!==e.exitCode?t.error(`IDE process exited with code ${e.exitCode}. The IDE may not have opened successfully.`):t.error(`Failed to open IDE (${r}): ${e.message}`)})}catch(e){t.error(`Failed to spawn IDE process (${r}): ${e instanceof Error?e.message:String(e)}`)}}}const tt=["npm","pnpm"];async function rt(e,t){const{installDeps:r}=await q.prompt([{type:"confirm",name:"installDeps",message:"📦 Install dependencies?",default:!0}]);if(!r)return t.debug("Skipping dependency installation"),{installed:!1};const{packageManager:n}=await q.prompt([{type:"list",name:"packageManager",message:"📦 Which package manager do you want to use?",choices:["pnpm","npm"],default:"pnpm"}]);return await async function(e,t,r){H(tt.includes(t),"Package manager must be npm or pnpm"),r?.start("Installing dependencies...");try{return await K(t,["install"],{cwd:e,stdio:"inherit",shell:!0}),r?.succeed("Dependencies installed successfully!"),t}catch(e){if(e instanceof Y&&0!==e.exitCode)throw r?.error(`${t} install failed with exit code ${e.exitCode}`),new Error(`${t} install failed with exit code ${e.exitCode}`);throw r?.error(`Failed to run ${t} install: ${e instanceof Error?e.message:String(e)}`),e}}(e,n,t),{installed:!0,packageManager:n}}class nt{#e;#t;#r;get name(){return this.#e.name}get description(){return this.#e.description}get resources(){return this.#e.resources}constructor(e,t,r){this.#e=e,this.#r=t,this.#t=r.logger}copyTo(e){this.#t?.debug(`Copying template resources to ${e}`);for(const t of this.#e.resources){this.#t?.debug(`Copying resource ${t.path}`,{resource:t});const r=c(this.#r,t.path),n=c(e,t.target??t.path);if(G(r))try{"file"===t.type?(B(r,n),this.#t?.debug(`Copied file: ${t.path} -> ${n}`)):"dir"===t.type?(z(r,n,{recursive:t.recursive??!1}),this.#t?.debug(`Copied directory: ${t.path} -> ${n}`)):this.#t?.debug("Resource is not a file or directory, skipping",{resource:t})}catch(e){throw this.#t?.error(`Failed to copy resource ${t.path}:`,e),e}else this.#t?.warn(`Source resource does not exist, skipping: ${r}`)}}}const ot=ee.object({type:ee.literal("file"),path:ee.string(),target:ee.string().optional()}),it=ee.object({type:ee.literal("dir"),path:ee.string(),target:ee.string().optional(),recursive:ee.boolean().optional()}),st=ee.discriminatedUnion("type",[ot,it]),at=ee.object({name:ee.string(),description:ee.string(),resources:ee.array(st)}),ct=ee.object({templates:ee.array(at),resources:ee.array(st).optional()});class lt{repo;#n=!1;#o;#i;#s;#a;#c;get protocol(){return this.#a}set protocol(e){H("https"===e||"ssh"===e,"Protocol must be either https or ssh"),this.#a=e}get branch(){return this.#c}get repoUrl(){return"ssh"===this.#a?`git@github.com:${this.repo}.git`:`https://github.com/${this.repo}.git`}set branch(e){this.#c=e,this.#n&&this._checkoutBranch()}constructor(e,t){this.repo=e,this.#i=t.baseDir??c(X(),"ffc","repo",e),this.#s=t.log,this.#c=t.branch??"main",this.#o=Z(),this.#a=t.protocol??"https"}async initialize(){if(!this.#n)try{if(this.#s?.debug("Checking if repository directory exists...",this.#i),G(this.#i)||(this.#s?.info("Repository directory does not exist, creating..."),V(this.#i,{recursive:!0}),this.#s?.succeed("Repository directory created successfully!")),this.#o=Z({baseDir:this.#i}),this._setupOutputHandler(),!this.#a||"https"===this.#a)try{const e=await this.#o.getConfig("core.sshCommand");this.#a=e?"ssh":"https"}catch{this.#a="https"}this.#s?.debug("Checking if repository is initialized...");await this.#o.checkIsRepo()?(this.#s?.info("Git is initialized, checking out branch..."),await this._checkoutBranch(),this.#s?.succeed("Branch checked out successfully!")):(this.#s?.info("Git is not initialized, cloning repo..."),await this._cloneRepo(),this.#s?.succeed("Repo cloned successfully!")),this.#s?.succeed("Repository initialized successfully!"),this.#n=!0}catch(e){throw this.#s?.fail("Repository initialization failed!"),this.#s?.error(e),e}}async getAvailableTemplates(){let e;try{const t=c(this.#i,"templates.json");this.#s?.debug("Reading template manifest file...",t),e=R(t,"utf8")}catch(e){throw new Error("Failed to read templates.json file from the root of the repository...",{cause:e})}try{this.#s?.debug("Parsing and validating template content...");const t=function(e){try{const t=JSON.parse(e);return ct.parse(t)}catch(e){if(e instanceof ee.ZodError)throw new Error(`Template manifest validation failed: ${e.message}`);throw new Error(`Failed to parse JSON: ${e instanceof Error?e.message:"Unknown error"}`)}}(e);this.#s?.debug("Parsed template content...",t);return t.templates.map(e=>{const r=[...t.resources??[],...e.resources];return new nt({...e,resources:r},this.#i,{logger:this.#s})})}catch(e){throw new Error("Failed to parse templates.json content",{cause:e})}}async cleanup(){try{this.#s?.debug(`Removing repository directory: ${this.#i}`);return Ze(Xe(this.#i,X()),{recursive:!0,force:!0},X()),this.#s?.succeed("Repository directory cleaned up successfully!"),this.#n=!1,!0}catch(e){return this.#s?.error(`Failed to remove repository directory: ${this.#i}`,e),!1}}async _cloneRepo(){try{this.#s?.debug("Cloning repo...",{repo:this.repo,repoUrl:this.repoUrl,baseDir:this.#i,branch:this.#c,protocol:this.#a}),await this.#o.clone(this.repoUrl,this.#i,["--single-branch","--branch",this.#c])}catch(e){throw new Error("Failed to clone repo...",{cause:e})}}async _checkoutBranch(){try{this.#s?.debug("Fetching repo...",{repo:this.repo,repoUrl:this.repoUrl}),await this.#o.fetch(),this.#s?.debug("Checking out branch...",this.#c);(await this.#o.checkout(this.#c)).includes("branch is up to date")?this.#s?.debug("Branch is up to date!"):(this.#s?.info("Branch is not up to date, updating to latest changes..."),await this.#o.reset(Q.HARD).pull(),this.#s?.debug("Branch updated successfully!"))}catch(e){throw new Error("Failed to checkout branch...",{cause:e})}}_setupOutputHandler(){this.#o.outputHandler((e,t,r)=>{t.on("data",e=>{this.#s?.debug("🐙",String(e))}),r.on("data",e=>{this.#s?.error("🐙",String(e))})})}}async function dt(e,t,r){H(!!e,"App name is required"),H(G(t.directory),`Directory '${t.directory}' does not exist, use -d to specify a different directory`);const n=s(t.directory,e);r.debug(`Target dir: ${n}`);const o=await async function(e,t,r=!1,n=process.cwd()){let o;H("string"==typeof e,"Target directory must be a string");try{o=Xe(e,n)}catch(e){const r=e instanceof Error?e.message:String(e);return t.error(`❌ Invalid target directory path: ${r}`),t.info('💡 Try using a relative path like "my-app" or ensure the absolute path is within the specified directory.'),!1}if(!G(o))return t.debug(`Target directory does not exist: ${o}`),!0;try{const e=U(o);if(0===e.length)return t.debug(`Target directory is empty: ${o}`),!0;if(t.warn(`Target directory '${o}' is not empty and contains ${e.length} item(s).`),t.info("Contents:",e.slice(0,10).join(", ")+(e.length>10?"...":"")),r){t.info("Cleaning target directory (--clean flag)...");try{Ze(o,{recursive:!0,force:!0},n),t.succeed("Target directory cleaned successfully!")}catch(e){throw t.error(`Failed to clean target directory: ${e}`),t.info("Check directory permissions and ensure you have write access to the directory."),t.info("You may need to run the command with elevated privileges or manually remove the files."),e}}else{const{action:e}=await q.prompt([{type:"list",name:"action",message:"What would you like to do?",choices:[{name:"Continue - Add files to existing directory",value:"continue"},{name:"Clean - Remove all existing files and continue",value:"clean"},{name:"Abort - Cancel the operation",value:"abort"}],default:"abort"}]);if("abort"===e)return t.info("Operation cancelled by user."),!1;if("clean"===e){t.info("Cleaning target directory...");try{Ze(o,{recursive:!0,force:!0},n),t.succeed("Target directory cleaned successfully!")}catch(e){throw t.error(`Failed to clean target directory: ${e}`),t.info("Check directory permissions and ensure you have write access to the directory."),t.info("You may need to run the command with elevated privileges or manually remove the files."),e}}else t.info("Continuing with existing directory...")}return!0}catch(e){throw t.error(`Failed to check target directory: ${e}`),t.info("Ensure the path is valid and accessible, and that you have read permissions for the directory."),t.info("Check if the directory path contains any invalid characters or if the path is too long."),e}}(n,r,t.clean,t.directory);o||process.exit(0);const i=await async function(e,t,r,n){const o=s(X(),"ffc","repo",e);if(n.debug(`Repo dir: ${o}`),t){n.debug(`Removing repo dir: ${o}`);try{Ze(Xe(o,X()),{recursive:!0,force:!0},X())}catch(e){n.debug("Cleanup failed:",e)}}const i=new lt(e,{baseDir:o,log:n,branch:r});return await i.initialize(),i}("equinor/fusion-app-template",t.clean,t.branch,r),a=await i.getAvailableTemplates(),l=await async function(e,t,r){H(Array.isArray(e),"Templates must be an array"),H(e.length>0,"No templates available");const n=e.map(e=>e.name);if(t){H("string"==typeof t,"Pre-selected template must be a string"),H(n.includes(t),"Pre-selected template must be in the list of available templates"),r?.debug(`Using pre-selected template: ${t}`);const o=e.find(e=>e.name===t);return H(o,"Pre-selected template not found"),o}if(1===e.length)return r?.debug(`Using single template: ${e[0].name}`),e[0];const{selectedTemplate:o}=await q.prompt([{type:"list",name:"selectedTemplate",message:"🎨 Please select a template:",choices:e.map(e=>({name:`${e.name} - ${e.description}`,value:e})),pageSize:10,loop:!1}]);return o}(a,t.template,r);try{await l.copyTo(n),r.succeed("Template resources copied successfully!")}catch(e){r.error(`Failed to copy template resources: ${e instanceof Error?e.message:String(e)}`),r.info("Please check the target directory permissions and try again"),process.exit(1)}try{await(async(e,t,r)=>{const n=c(e,"package.json");try{const e=R(n,"utf-8"),o=JSON.parse(e);let i={...o};if(t?.resolveWorkspaceDependencies){r?.debug("Resolving workspace dependencies");const e=JSON.parse(JSON.stringify(o));await Je(e,r),i=e}t?.updates&&(r?.debug(`Applying updates: ${Object.keys(t.updates).join(", ")}`),i={...i,...t.updates}),JSON.stringify(o)!==JSON.stringify(i)?(r?.debug("Writing updated package.json to disk"),F(n,`${JSON.stringify(i,null,2)}\n`)):r?.debug("No changes detected, skipping package.json update")}catch(e){throw new Error(`Failed to update package.json: ${e instanceof Error?e.message:String(e)}`)}})(n,{updates:{name:e},resolveWorkspaceDependencies:!0},r),r.succeed(`Updated package.json with app name: ${e}`)}catch(e){r.error(`Failed to update package.json: ${e instanceof Error?e.message:String(e)}`),r.info("Please check the package.json file and try again"),process.exit(1)}await async function(e,t){const{cleanupTempFiles:r}=await q.prompt([{type:"confirm",name:"cleanupTempFiles",message:"🗑️ Clean up temporary template files?",default:!1}]);r?await e.cleanup():t.debug("Skipping cleanup of temporary template files")}(i,r),await et(n,r);const{installed:d,packageManager:u}=await rt(n,r);if(d&&u){const e=await async function(e,t,r,n=!1){const{startDev:o}=await q.prompt([{type:"confirm",name:"startDev",message:"🚀 Start development server?",default:!0}]);if(o){r.debug(`Starting development server: ${e}`),n&&r.info("Running in persistent mode - server will run until manually stopped (Ctrl+C)");try{const o=J(t,["run","dev"],{cwd:e,stdio:"inherit"});let i=null,s=!1;if(!n){const e=6e4;i=setTimeout(()=>{s=!0,r.error(`Development server did not start within ${e/1e3} seconds and may be hanging. Terminating process.`),o.kill("SIGTERM"),r.info(`You can try running '${t} run dev' manually in the project directory.`)},e)}const a=()=>{i&&clearTimeout(i),o.removeAllListeners("error"),o.removeAllListeners("exit")};return o.on("error",e=>{a(),s||(r.error(`Failed to start development server with ${t}: ${e.message}`),r.info(`Make sure ${t} is installed and the 'dev' script exists in package.json`))}),o.on("exit",e=>{a(),s||0===e||n?n&&0!==e&&r.info(`Development server stopped with exit code ${e}`):(r.error(`Development server process exited with code ${e}. The server may not have started successfully.`),r.info(`Check the output above for error details or try running '${t} run dev' manually`))}),!0}catch(e){r.error(`Failed to spawn development server process with ${t}: ${e instanceof Error?e.message:String(e)}`),r.info(`Make sure ${t} is installed and the 'dev' script exists in package.json`)}}return!1}(n,u,r,!0);e&&r.debug("Development server started successfully")}}const ut=t=>e(t).description("Create a new Fusion application from template").argument("<name>","Name of the application to create").option("-t, --template <type>","Template type to use (will prompt if not specified or not found)").option("-d, --directory <path>","Directory to create the app in",".").option("--branch <branch>","Branch to checkout","main").option("--clean","Clean the repo directory before cloning").option("--debug","Enable debug mode for verbose logging").action(async(e,t)=>{const r=new d("",{debug:t.debug});try{await dt(e,t,r)}catch(e){r.error("❌ An unexpected error occurred:",e instanceof Error?e.message:String(e)),t.debug&&r.error("Stack trace:",e instanceof Error?e.stack:"No stack trace available"),process.exit(1)}});xe.alias("build-pack").hook("preAction",e=>{"build-pack"===process.argv[3]&&(console.warn(Ie.bgRedBright.bold('The command "build-pack" is deprecated. Please use "pack" instead.')),e.getOptionValue("archive")||e.setOptionValue("archive",Ae))}),Be.alias("build-upload").hook("preAction",e=>{if("build-upload"===process.argv[3]){if(console.warn(Ie.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")??Ae;process.argv[4]=t}}),We.alias("build-manifest").hook("preAction",()=>{"build-manifest"===process.argv[3]&&console.warn(Ie.bgRedBright.bold('The command "build-manifest" is deprecated. Please use "manifest" instead.'))}),Ke.alias("build-publish").hook("preAction",e=>{if("build-publish"===process.argv[3]&&console.warn(Ie.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 pt=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:"," - Create new applications from templates with the create subcommand"," - 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(Oe).addCommand(xe).addCommand(Ue).addCommand(Be).addCommand(ze).addCommand(Ve).addCommand(He).addCommand(We).addCommand(Ke).addCommand(ut("create")),ht=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 d("auth:login",{debug:e.debug}),r="string"==typeof e.scope?[e.scope]:e.scope;t.start("Initializing Fusion Framework...");const n=await g({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 n.auth.login({scopes:r});t.info("username:",Ie.green(e.account?.username)),t.info("tenant: ",Ie.yellow(e.tenantId)),t.info("audience:",Ie.yellow(e.account?.idTokenClaims?.aud));for(const r of e.scopes)t.info("scope: ",Ie.dim(r));t.succeed("Successfully logged in",Ie.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}});Ge(ht,{includeScope:!0,excludeToken:!0});const ft=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 d("auth:logout",{debug:e.debug});t.start("Initializing Fusion Framework...");const r=await g({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}});Ge(ft,{excludeToken:!0,includeScope:!1});class mt extends Error{static Name="NoAccountsError";constructor(e,t){super(e,t),this.name=mt.Name}}const gt=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 d("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 n=await g({auth:{tenantId:e.tenantId,clientId:e.clientId}});t?.succeed("Initialized Fusion Framework");try{t?.start("Getting access token...");const o=await n.auth.acquireAccessToken({scopes:r});t?.succeed("Successfully acquired access token"),e.silent?console.log(o):t?.info("Access token:",o)}catch(r){if(e.silent||!(r instanceof mt))throw r;t?.fail("No accounts found, please login first")}});Ge(gt,{includeScope:!0});const yt=new n("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"));yt.addCommand(ht,{isDefault:!0}),yt.addCommand(ft),yt.addCommand(gt);const vt=e("create").description("Create new Fusion applications and components from templates").addHelpText("after",["",'The "create" command helps you bootstrap new Fusion applications and components',"using predefined templates from the Fusion ecosystem.","","Available templates:"," - app: Create a new Fusion application from the official template","","Examples:"," fusion create app my-new-app"," fusion create app my-new-app --template react",""].join("\n")).addCommand(ut("app")),bt=Ge(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(Te({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 d("disco:resolve");r?.start("Initializing Fusion Framework...");const n=await g({env:t.environment,auth:{token:t.token,tenantId:t.tenantId,clientId:t.clientId}});r?.succeed("Initialized Fusion Framework"),r?.start(`Resolving service ${e}...`);const o=await n.serviceDiscovery.resolveService(e);r?.succeed(`Resolved service ${e}`),r?.debug(o),t.silent&&console.log(JSON.stringify(o,null,2))})),$t=e("disco").description("Service discovery operations");$t.addCommand(bt);const wt=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 d("portal:dev",{debug:e.debug});t.start("Starting portal in development mode..."),P({server:{port:Number(e.port)},log:t,env:e.env}),t.succeed("Development server started successfully.")});function Et(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var St,Pt,_t,Lt;function kt(){if(Pt)return St;Pt=1;const e="object"==typeof process&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};return St=e}function Ct(){if(Lt)return _t;Lt=1;const e=Number.MAX_SAFE_INTEGER||9007199254740991;return _t={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:e,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}}var Nt,It,Ot,At,xt,Tt,Dt,jt,Rt,Ft,Mt,Gt,Ut,Bt={exports:{}};function zt(){return Nt||(Nt=1,function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:o}=Ct(),i=kt(),s=(t=e.exports={}).re=[],a=t.safeRe=[],c=t.src=[],l=t.safeSrc=[],d=t.t={};let u=0;const p="[a-zA-Z0-9-]",h=[["\\s",1],["\\d",o],[p,n]],f=(e,t,r)=>{const n=(e=>{for(const[t,r]of h)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),o=u++;i(e,o,t),d[e]=o,c[o]=t,l[o]=n,s[o]=new RegExp(t,r?"g":void 0),a[o]=new RegExp(n,r?"g":void 0)};f("NUMERICIDENTIFIER","0|[1-9]\\d*"),f("NUMERICIDENTIFIERLOOSE","\\d+"),f("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${p}*`),f("MAINVERSION",`(${c[d.NUMERICIDENTIFIER]})\\.(${c[d.NUMERICIDENTIFIER]})\\.(${c[d.NUMERICIDENTIFIER]})`),f("MAINVERSIONLOOSE",`(${c[d.NUMERICIDENTIFIERLOOSE]})\\.(${c[d.NUMERICIDENTIFIERLOOSE]})\\.(${c[d.NUMERICIDENTIFIERLOOSE]})`),f("PRERELEASEIDENTIFIER",`(?:${c[d.NONNUMERICIDENTIFIER]}|${c[d.NUMERICIDENTIFIER]})`),f("PRERELEASEIDENTIFIERLOOSE",`(?:${c[d.NONNUMERICIDENTIFIER]}|${c[d.NUMERICIDENTIFIERLOOSE]})`),f("PRERELEASE",`(?:-(${c[d.PRERELEASEIDENTIFIER]}(?:\\.${c[d.PRERELEASEIDENTIFIER]})*))`),f("PRERELEASELOOSE",`(?:-?(${c[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[d.PRERELEASEIDENTIFIERLOOSE]})*))`),f("BUILDIDENTIFIER",`${p}+`),f("BUILD",`(?:\\+(${c[d.BUILDIDENTIFIER]}(?:\\.${c[d.BUILDIDENTIFIER]})*))`),f("FULLPLAIN",`v?${c[d.MAINVERSION]}${c[d.PRERELEASE]}?${c[d.BUILD]}?`),f("FULL",`^${c[d.FULLPLAIN]}$`),f("LOOSEPLAIN",`[v=\\s]*${c[d.MAINVERSIONLOOSE]}${c[d.PRERELEASELOOSE]}?${c[d.BUILD]}?`),f("LOOSE",`^${c[d.LOOSEPLAIN]}$`),f("GTLT","((?:<|>)?=?)"),f("XRANGEIDENTIFIERLOOSE",`${c[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),f("XRANGEIDENTIFIER",`${c[d.NUMERICIDENTIFIER]}|x|X|\\*`),f("XRANGEPLAIN",`[v=\\s]*(${c[d.XRANGEIDENTIFIER]})(?:\\.(${c[d.XRANGEIDENTIFIER]})(?:\\.(${c[d.XRANGEIDENTIFIER]})(?:${c[d.PRERELEASE]})?${c[d.BUILD]}?)?)?`),f("XRANGEPLAINLOOSE",`[v=\\s]*(${c[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[d.XRANGEIDENTIFIERLOOSE]})(?:${c[d.PRERELEASELOOSE]})?${c[d.BUILD]}?)?)?`),f("XRANGE",`^${c[d.GTLT]}\\s*${c[d.XRANGEPLAIN]}$`),f("XRANGELOOSE",`^${c[d.GTLT]}\\s*${c[d.XRANGEPLAINLOOSE]}$`),f("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),f("COERCE",`${c[d.COERCEPLAIN]}(?:$|[^\\d])`),f("COERCEFULL",c[d.COERCEPLAIN]+`(?:${c[d.PRERELEASE]})?`+`(?:${c[d.BUILD]})?(?:$|[^\\d])`),f("COERCERTL",c[d.COERCE],!0),f("COERCERTLFULL",c[d.COERCEFULL],!0),f("LONETILDE","(?:~>?)"),f("TILDETRIM",`(\\s*)${c[d.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",f("TILDE",`^${c[d.LONETILDE]}${c[d.XRANGEPLAIN]}$`),f("TILDELOOSE",`^${c[d.LONETILDE]}${c[d.XRANGEPLAINLOOSE]}$`),f("LONECARET","(?:\\^)"),f("CARETTRIM",`(\\s*)${c[d.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",f("CARET",`^${c[d.LONECARET]}${c[d.XRANGEPLAIN]}$`),f("CARETLOOSE",`^${c[d.LONECARET]}${c[d.XRANGEPLAINLOOSE]}$`),f("COMPARATORLOOSE",`^${c[d.GTLT]}\\s*(${c[d.LOOSEPLAIN]})$|^$`),f("COMPARATOR",`^${c[d.GTLT]}\\s*(${c[d.FULLPLAIN]})$|^$`),f("COMPARATORTRIM",`(\\s*)${c[d.GTLT]}\\s*(${c[d.LOOSEPLAIN]}|${c[d.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",f("HYPHENRANGE",`^\\s*(${c[d.XRANGEPLAIN]})\\s+-\\s+(${c[d.XRANGEPLAIN]})\\s*$`),f("HYPHENRANGELOOSE",`^\\s*(${c[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[d.XRANGEPLAINLOOSE]})\\s*$`),f("STAR","(<|>)?=?\\s*\\*"),f("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),f("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(Bt,Bt.exports)),Bt.exports}function Vt(){if(Dt)return Tt;Dt=1;const e=kt(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:r}=Ct(),{safeRe:n,t:o}=zt(),i=function(){if(Ot)return It;Ot=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return It=r=>r?"object"!=typeof r?e:r:t}(),{compareIdentifiers:s}=function(){if(xt)return At;xt=1;const e=/^[0-9]+$/,t=(t,r)=>{const n=e.test(t),o=e.test(r);return n&&o&&(t=+t,r=+r),t===r?0:n&&!o?-1:o&&!n?1:t<r?-1:1};return At={compareIdentifiers:t,rcompareIdentifiers:(e,r)=>t(r,e)}}();class a{constructor(s,c){if(c=i(c),s instanceof a){if(s.loose===!!c.loose&&s.includePrerelease===!!c.includePrerelease)return s;s=s.version}else if("string"!=typeof s)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof s}".`);if(s.length>t)throw new TypeError(`version is longer than ${t} characters`);e("SemVer",s,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;const l=s.trim().match(c.loose?n[o.LOOSE]:n[o.FULL]);if(!l)throw new TypeError(`Invalid Version: ${s}`);if(this.raw=s,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>r||this.major<0)throw new TypeError("Invalid major version");if(this.minor>r||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>r||this.patch<0)throw new TypeError("Invalid patch version");l[4]?this.prerelease=l[4].split(".").map(e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t<r)return t}return e}):this.prerelease=[],this.build=l[5]?l[5].split("."):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(".")}`),this.version}toString(){return this.version}compare(t){if(e("SemVer.compare",this.version,this.options,t),!(t instanceof a)){if("string"==typeof t&&t===this.version)return 0;t=new a(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(e){return e instanceof a||(e=new a(e,this.options)),s(this.major,e.major)||s(this.minor,e.minor)||s(this.patch,e.patch)}comparePre(t){if(t instanceof a||(t=new a(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{const n=this.prerelease[r],o=t.prerelease[r];if(e("prerelease compare",r,n,o),void 0===n&&void 0===o)return 0;if(void 0===o)return 1;if(void 0===n)return-1;if(n!==o)return s(n,o)}while(++r)}compareBuild(t){t instanceof a||(t=new a(t,this.options));let r=0;do{const n=this.build[r],o=t.build[r];if(e("build compare",r,n,o),void 0===n&&void 0===o)return 0;if(void 0===o)return 1;if(void 0===n)return-1;if(n!==o)return s(n,o)}while(++r)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&!1===r)throw new Error("invalid increment argument: identifier is empty");if(t){const e=`-${t}`.match(this.options.loose?n[o.PRERELEASELOOSE]:n[o.PRERELEASE]);if(!e||e[1]!==t)throw new Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":0===this.prerelease.length&&this.inc("patch",t,r),this.inc("pre",t,r);break;case"release":if(0===this.prerelease.length)throw new Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":0===this.minor&&0===this.patch&&0!==this.prerelease.length||this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":0===this.patch&&0!==this.prerelease.length||this.minor++,this.patch=0,this.prerelease=[];break;case"patch":0===this.prerelease.length&&this.patch++,this.prerelease=[];break;case"pre":{const e=Number(r)?1:0;if(0===this.prerelease.length)this.prerelease=[e];else{let n=this.prerelease.length;for(;--n>=0;)"number"==typeof this.prerelease[n]&&(this.prerelease[n]++,n=-2);if(-1===n){if(t===this.prerelease.join(".")&&!1===r)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let n=[t,e];!1===r&&(n=[t]),0===s(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=n):this.prerelease=n}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return Tt=a}function Ht(){if(Rt)return jt;Rt=1;const e=Vt();return jt=(t,r,n=!1)=>{if(t instanceof e)return t;try{return new e(t,r)}catch(e){if(!n)return null;throw e}}}var qt,Wt,Kt,Yt,Jt,Xt,Zt,Qt,er,tr,rr=["0BSD","3D-Slicer-1.0","AAL","ADSL","AFL-1.1","AFL-1.2","AFL-2.0","AFL-2.1","AFL-3.0","AGPL-1.0-only","AGPL-1.0-or-later","AGPL-3.0-only","AGPL-3.0-or-later","AMD-newlib","AMDPLPA","AML","AML-glslang","AMPAS","ANTLR-PD","ANTLR-PD-fallback","APAFML","APL-1.0","APSL-1.0","APSL-1.1","APSL-1.2","APSL-2.0","ASWF-Digital-Assets-1.0","ASWF-Digital-Assets-1.1","Abstyles","AdaCore-doc","Adobe-2006","Adobe-Display-PostScript","Adobe-Glyph","Adobe-Utopia","Afmparse","Aladdin","Apache-1.0","Apache-1.1","Apache-2.0","App-s2p","Arphic-1999","Artistic-1.0","Artistic-1.0-Perl","Artistic-1.0-cl8","Artistic-2.0","Artistic-dist","Aspell-RU","BSD-1-Clause","BSD-2-Clause","BSD-2-Clause-Darwin","BSD-2-Clause-Patent","BSD-2-Clause-Views","BSD-2-Clause-first-lines","BSD-2-Clause-pkgconf-disclaimer","BSD-3-Clause","BSD-3-Clause-Attribution","BSD-3-Clause-Clear","BSD-3-Clause-HP","BSD-3-Clause-LBNL","BSD-3-Clause-Modification","BSD-3-Clause-No-Military-License","BSD-3-Clause-No-Nuclear-License","BSD-3-Clause-No-Nuclear-License-2014","BSD-3-Clause-No-Nuclear-Warranty","BSD-3-Clause-Open-MPI","BSD-3-Clause-Sun","BSD-3-Clause-acpica","BSD-3-Clause-flex","BSD-4-Clause","BSD-4-Clause-Shortened","BSD-4-Clause-UC","BSD-4.3RENO","BSD-4.3TAHOE","BSD-Advertising-Acknowledgement","BSD-Attribution-HPND-disclaimer","BSD-Inferno-Nettverk","BSD-Protection","BSD-Source-Code","BSD-Source-beginning-file","BSD-Systemics","BSD-Systemics-W3Works","BSL-1.0","BUSL-1.1","Baekmuk","Bahyph","Barr","Beerware","BitTorrent-1.0","BitTorrent-1.1","Bitstream-Charter","Bitstream-Vera","BlueOak-1.0.0","Boehm-GC","Boehm-GC-without-fee","Borceux","Brian-Gladman-2-Clause","Brian-Gladman-3-Clause","C-UDA-1.0","CAL-1.0","CAL-1.0-Combined-Work-Exception","CATOSL-1.1","CC-BY-1.0","CC-BY-2.0","CC-BY-2.5","CC-BY-2.5-AU","CC-BY-3.0","CC-BY-3.0-AT","CC-BY-3.0-AU","CC-BY-3.0-DE","CC-BY-3.0-IGO","CC-BY-3.0-NL","CC-BY-3.0-US","CC-BY-4.0","CC-BY-NC-1.0","CC-BY-NC-2.0","CC-BY-NC-2.5","CC-BY-NC-3.0","CC-BY-NC-3.0-DE","CC-BY-NC-4.0","CC-BY-NC-ND-1.0","CC-BY-NC-ND-2.0","CC-BY-NC-ND-2.5","CC-BY-NC-ND-3.0","CC-BY-NC-ND-3.0-DE","CC-BY-NC-ND-3.0-IGO","CC-BY-NC-ND-4.0","CC-BY-NC-SA-1.0","CC-BY-NC-SA-2.0","CC-BY-NC-SA-2.0-DE","CC-BY-NC-SA-2.0-FR","CC-BY-NC-SA-2.0-UK","CC-BY-NC-SA-2.5","CC-BY-NC-SA-3.0","CC-BY-NC-SA-3.0-DE","CC-BY-NC-SA-3.0-IGO","CC-BY-NC-SA-4.0","CC-BY-ND-1.0","CC-BY-ND-2.0","CC-BY-ND-2.5","CC-BY-ND-3.0","CC-BY-ND-3.0-DE","CC-BY-ND-4.0","CC-BY-SA-1.0","CC-BY-SA-2.0","CC-BY-SA-2.0-UK","CC-BY-SA-2.1-JP","CC-BY-SA-2.5","CC-BY-SA-3.0","CC-BY-SA-3.0-AT","CC-BY-SA-3.0-DE","CC-BY-SA-3.0-IGO","CC-BY-SA-4.0","CC-PDDC","CC-PDM-1.0","CC-SA-1.0","CC0-1.0","CDDL-1.0","CDDL-1.1","CDL-1.0","CDLA-Permissive-1.0","CDLA-Permissive-2.0","CDLA-Sharing-1.0","CECILL-1.0","CECILL-1.1","CECILL-2.0","CECILL-2.1","CECILL-B","CECILL-C","CERN-OHL-1.1","CERN-OHL-1.2","CERN-OHL-P-2.0","CERN-OHL-S-2.0","CERN-OHL-W-2.0","CFITSIO","CMU-Mach","CMU-Mach-nodoc","CNRI-Jython","CNRI-Python","CNRI-Python-GPL-Compatible","COIL-1.0","CPAL-1.0","CPL-1.0","CPOL-1.02","CUA-OPL-1.0","Caldera","Caldera-no-preamble","Catharon","ClArtistic","Clips","Community-Spec-1.0","Condor-1.1","Cornell-Lossless-JPEG","Cronyx","Crossword","CryptoSwift","CrystalStacker","Cube","D-FSL-1.0","DEC-3-Clause","DL-DE-BY-2.0","DL-DE-ZERO-2.0","DOC","DRL-1.0","DRL-1.1","DSDP","DocBook-DTD","DocBook-Schema","DocBook-Stylesheet","DocBook-XML","Dotseqn","ECL-1.0","ECL-2.0","EFL-1.0","EFL-2.0","EPICS","EPL-1.0","EPL-2.0","EUDatagrid","EUPL-1.0","EUPL-1.1","EUPL-1.2","Elastic-2.0","Entessa","ErlPL-1.1","Eurosym","FBM","FDK-AAC","FSFAP","FSFAP-no-warranty-disclaimer","FSFUL","FSFULLR","FSFULLRSD","FSFULLRWD","FSL-1.1-ALv2","FSL-1.1-MIT","FTL","Fair","Ferguson-Twofish","Frameworx-1.0","FreeBSD-DOC","FreeImage","Furuseth","GCR-docs","GD","GFDL-1.1-invariants-only","GFDL-1.1-invariants-or-later","GFDL-1.1-no-invariants-only","GFDL-1.1-no-invariants-or-later","GFDL-1.1-only","GFDL-1.1-or-later","GFDL-1.2-invariants-only","GFDL-1.2-invariants-or-later","GFDL-1.2-no-invariants-only","GFDL-1.2-no-invariants-or-later","GFDL-1.2-only","GFDL-1.2-or-later","GFDL-1.3-invariants-only","GFDL-1.3-invariants-or-later","GFDL-1.3-no-invariants-only","GFDL-1.3-no-invariants-or-later","GFDL-1.3-only","GFDL-1.3-or-later","GL2PS","GLWTPL","GPL-1.0-only","GPL-1.0-or-later","GPL-2.0-only","GPL-2.0-or-later","GPL-3.0-only","GPL-3.0-or-later","Game-Programming-Gems","Giftware","Glide","Glulxe","Graphics-Gems","Gutmann","HDF5","HIDAPI","HP-1986","HP-1989","HPND","HPND-DEC","HPND-Fenneberg-Livingston","HPND-INRIA-IMAG","HPND-Intel","HPND-Kevlin-Henney","HPND-MIT-disclaimer","HPND-Markus-Kuhn","HPND-Netrek","HPND-Pbmplus","HPND-UC","HPND-UC-export-US","HPND-doc","HPND-doc-sell","HPND-export-US","HPND-export-US-acknowledgement","HPND-export-US-modify","HPND-export2-US","HPND-merchantability-variant","HPND-sell-MIT-disclaimer-xserver","HPND-sell-regexpr","HPND-sell-variant","HPND-sell-variant-MIT-disclaimer","HPND-sell-variant-MIT-disclaimer-rev","HTMLTIDY","HaskellReport","Hippocratic-2.1","IBM-pibs","ICU","IEC-Code-Components-EULA","IJG","IJG-short","IPA","IPL-1.0","ISC","ISC-Veillard","ImageMagick","Imlib2","Info-ZIP","Inner-Net-2.0","InnoSetup","Intel","Intel-ACPI","Interbase-1.0","JPL-image","JPNIC","JSON","Jam","JasPer-2.0","Kastrup","Kazlib","Knuth-CTAN","LAL-1.2","LAL-1.3","LGPL-2.0-only","LGPL-2.0-or-later","LGPL-2.1-only","LGPL-2.1-or-later","LGPL-3.0-only","LGPL-3.0-or-later","LGPLLR","LOOP","LPD-document","LPL-1.0","LPL-1.02","LPPL-1.0","LPPL-1.1","LPPL-1.2","LPPL-1.3a","LPPL-1.3c","LZMA-SDK-9.11-to-9.20","LZMA-SDK-9.22","Latex2e","Latex2e-translated-notice","Leptonica","LiLiQ-P-1.1","LiLiQ-R-1.1","LiLiQ-Rplus-1.1","Libpng","Linux-OpenIB","Linux-man-pages-1-para","Linux-man-pages-copyleft","Linux-man-pages-copyleft-2-para","Linux-man-pages-copyleft-var","Lucida-Bitmap-Fonts","MIPS","MIT","MIT-0","MIT-CMU","MIT-Click","MIT-Festival","MIT-Khronos-old","MIT-Modern-Variant","MIT-Wu","MIT-advertising","MIT-enna","MIT-feh","MIT-open-group","MIT-testregex","MITNFA","MMIXware","MPEG-SSG","MPL-1.0","MPL-1.1","MPL-2.0","MPL-2.0-no-copyleft-exception","MS-LPL","MS-PL","MS-RL","MTLL","Mackerras-3-Clause","Mackerras-3-Clause-acknowledgment","MakeIndex","Martin-Birgmeier","McPhee-slideshow","Minpack","MirOS","Motosoto","MulanPSL-1.0","MulanPSL-2.0","Multics","Mup","NAIST-2003","NASA-1.3","NBPL-1.0","NCBI-PD","NCGL-UK-2.0","NCL","NCSA","NGPL","NICTA-1.0","NIST-PD","NIST-PD-fallback","NIST-Software","NLOD-1.0","NLOD-2.0","NLPL","NOSL","NPL-1.0","NPL-1.1","NPOSL-3.0","NRL","NTIA-PD","NTP","NTP-0","Naumen","NetCDF","Newsletr","Nokia","Noweb","O-UDA-1.0","OAR","OCCT-PL","OCLC-2.0","ODC-By-1.0","ODbL-1.0","OFFIS","OFL-1.0","OFL-1.0-RFN","OFL-1.0-no-RFN","OFL-1.1","OFL-1.1-RFN","OFL-1.1-no-RFN","OGC-1.0","OGDL-Taiwan-1.0","OGL-Canada-2.0","OGL-UK-1.0","OGL-UK-2.0","OGL-UK-3.0","OGTSL","OLDAP-1.1","OLDAP-1.2","OLDAP-1.3","OLDAP-1.4","OLDAP-2.0","OLDAP-2.0.1","OLDAP-2.1","OLDAP-2.2","OLDAP-2.2.1","OLDAP-2.2.2","OLDAP-2.3","OLDAP-2.4","OLDAP-2.5","OLDAP-2.6","OLDAP-2.7","OLDAP-2.8","OLFL-1.3","OML","OPL-1.0","OPL-UK-3.0","OPUBL-1.0","OSET-PL-2.1","OSL-1.0","OSL-1.1","OSL-2.0","OSL-2.1","OSL-3.0","OpenPBS-2.3","OpenSSL","OpenSSL-standalone","OpenVision","PADL","PDDL-1.0","PHP-3.0","PHP-3.01","PPL","PSF-2.0","Parity-6.0.0","Parity-7.0.0","Pixar","Plexus","PolyForm-Noncommercial-1.0.0","PolyForm-Small-Business-1.0.0","PostgreSQL","Python-2.0","Python-2.0.1","QPL-1.0","QPL-1.0-INRIA-2004","Qhull","RHeCos-1.1","RPL-1.1","RPL-1.5","RPSL-1.0","RSA-MD","RSCPL","Rdisc","Ruby","Ruby-pty","SAX-PD","SAX-PD-2.0","SCEA","SGI-B-1.0","SGI-B-1.1","SGI-B-2.0","SGI-OpenGL","SGP4","SHL-0.5","SHL-0.51","SISSL","SISSL-1.2","SL","SMAIL-GPL","SMLNJ","SMPPL","SNIA","SOFA","SPL-1.0","SSH-OpenSSH","SSH-short","SSLeay-standalone","SSPL-1.0","SUL-1.0","SWL","Saxpath","SchemeReport","Sendmail","Sendmail-8.23","Sendmail-Open-Source-1.1","SimPL-2.0","Sleepycat","Soundex","Spencer-86","Spencer-94","Spencer-99","SugarCRM-1.1.3","Sun-PPP","Sun-PPP-2000","SunPro","Symlinks","TAPR-OHL-1.0","TCL","TCP-wrappers","TGPPL-1.0","TMate","TORQUE-1.1","TOSL","TPDL","TPL-1.0","TTWL","TTYP0","TU-Berlin-1.0","TU-Berlin-2.0","TermReadKey","ThirdEye","TrustedQSL","UCAR","UCL-1.0","UMich-Merit","UPL-1.0","URT-RLE","Ubuntu-font-1.0","Unicode-3.0","Unicode-DFS-2015","Unicode-DFS-2016","Unicode-TOU","UnixCrypt","Unlicense","Unlicense-libtelnet","Unlicense-libwhirlpool","VOSTROM","VSL-1.0","Vim","W3C","W3C-19980720","W3C-20150513","WTFPL","Watcom-1.0","Widget-Workshop","Wsuipa","X11","X11-distribute-modifications-variant","X11-swapped","XFree86-1.1","XSkat","Xdebug-1.03","Xerox","Xfig","Xnet","YPL-1.0","YPL-1.1","ZPL-1.1","ZPL-2.0","ZPL-2.1","Zed","Zeeff","Zend-2.0","Zimbra-1.3","Zimbra-1.4","Zlib","any-OSI","any-OSI-perl-modules","bcrypt-Solar-Designer","blessing","bzip2-1.0.6","check-cvs","checkmk","copyleft-next-0.3.0","copyleft-next-0.3.1","curl","cve-tou","diffmark","dtoa","dvipdfm","eGenix","etalab-2.0","fwlw","gSOAP-1.3b","generic-xts","gnuplot","gtkbook","hdparm","iMatix","jove","libpng-1.6.35","libpng-2.0","libselinux-1.0","libtiff","libutil-David-Nugent","lsof","magaz","mailprio","man2html","metamail","mpi-permissive","mpich2","mplus","ngrep","pkgconf","pnmstitch","psfrag","psutils","python-ldap","radvd","snprintf","softSurfer","ssh-keyscan","swrule","threeparttable","ulem","w3m","wwl","xinetd","xkeyboard-config-Zinoviev","xlock","xpp","xzoom","zlib-acknowledgement"],nr=["AGPL-1.0","AGPL-3.0","BSD-2-Clause-FreeBSD","BSD-2-Clause-NetBSD","GFDL-1.1","GFDL-1.2","GFDL-1.3","GPL-1.0","GPL-2.0","GPL-2.0-with-GCC-exception","GPL-2.0-with-autoconf-exception","GPL-2.0-with-bison-exception","GPL-2.0-with-classpath-exception","GPL-2.0-with-font-exception","GPL-3.0","GPL-3.0-with-GCC-exception","GPL-3.0-with-autoconf-exception","LGPL-2.0","LGPL-2.1","LGPL-3.0","Net-SNMP","Nunit","StandardML-NJ","bzip2-1.0.5","eCos-2.0","wxWindows"],or=["389-exception","Asterisk-exception","Autoconf-exception-2.0","Autoconf-exception-3.0","Autoconf-exception-generic","Autoconf-exception-generic-3.0","Autoconf-exception-macro","Bison-exception-1.24","Bison-exception-2.2","Bootloader-exception","Classpath-exception-2.0","CLISP-exception-2.0","cryptsetup-OpenSSL-exception","DigiRule-FOSS-exception","eCos-exception-2.0","Fawkes-Runtime-exception","FLTK-exception","fmt-exception","Font-exception-2.0","freertos-exception-2.0","GCC-exception-2.0","GCC-exception-2.0-note","GCC-exception-3.1","Gmsh-exception","GNAT-exception","GNOME-examples-exception","GNU-compiler-exception","gnu-javamail-exception","GPL-3.0-interface-exception","GPL-3.0-linking-exception","GPL-3.0-linking-source-exception","GPL-CC-1.0","GStreamer-exception-2005","GStreamer-exception-2008","i2p-gpl-java-exception","KiCad-libraries-exception","LGPL-3.0-linking-exception","libpri-OpenH323-exception","Libtool-exception","Linux-syscall-note","LLGPL","LLVM-exception","LZMA-exception","mif-exception","OCaml-LGPL-linking-exception","OCCT-exception-1.0","OpenJDK-assembly-exception-1.0","openvpn-openssl-exception","PS-or-PDF-font-exception-20170817","QPL-1.0-INRIA-2004-exception","Qt-GPL-exception-1.0","Qt-LGPL-exception-1.1","Qwt-exception-1.0","SANE-exception","SHL-2.0","SHL-2.1","stunnel-exception","SWI-exception","Swift-exception","Texinfo-exception","u-boot-exception-2.0","UBDL-exception","Universal-FOSS-exception-1.0","vsftpd-openssl-exception","WxWindows-exception-3.1","x11vnc-openssl-exception"];function ir(){if(Wt)return qt;Wt=1;var e=[].concat(rr).concat(nr),t=or;return qt=function(r){var n=0;function o(){return n<r.length}function i(e){if(e instanceof RegExp){var t=r.slice(n).match(e);if(t)return n+=t[0].length,t[0]}else if(r.indexOf(e,n)===n)return n+=e.length,e}function s(){i(/[ ]*/)}function a(){return i(/[A-Za-z0-9-.]+/)}function c(){var e=a();if(!e)throw new Error("Expected idstring at offset "+n);return e}function l(){return function(){for(var e,t=["WITH","AND","OR","(",")",":","+"],o=0;o<t.length&&!(e=i(t[o]));o++);if("+"===e&&n>1&&" "===r[n-2])throw new Error("Space before `+`");return e&&{type:"OPERATOR",string:e}}()||function(){if(i("DocumentRef-"))return{type:"DOCUMENTREF",string:c()}}()||function(){if(i("LicenseRef-"))return{type:"LICENSEREF",string:c()}}()||(o=n,s=a(),-1!==e.indexOf(s)?{type:"LICENSE",string:s}:-1!==t.indexOf(s)?{type:"EXCEPTION",string:s}:void(n=o));var o,s}for(var d=[];o()&&(s(),o());){var u=l();if(!u)throw new Error("Unexpected `"+r[n]+"` at offset "+n);d.push(u)}return d}}function sr(){return Yt||(Yt=1,Kt=function(e){var t=0;function r(){return t<e.length}function n(){return r()?e[t]:null}function o(){if(!r())throw new Error;t++}function i(e){var t=n();if(t&&"OPERATOR"===t.type&&e===t.string)return o(),t.string}function s(){var e=n();if(e&&"LICENSE"===e.type){o();var t={license:e.string};i("+")&&(t.plus=!0);var r=function(){if(i("WITH")){var e=n();if(e&&"EXCEPTION"===e.type)return o(),e.string;throw new Error("Expected exception after `WITH`")}}();return r&&(t.exception=r),t}}function a(e,t){return function r(){var n=t();if(n){if(!i(e))return n;var o=r();if(!o)throw new Error("Expected expression");return{left:n,conjunction:e.toLowerCase(),right:o}}}}var c=a("AND",function(){return function(){if(i("(")){var e=l();if(!i(")"))throw new Error("Expected `)`");return e}}()||function(){var e=t,r="",s=n();if("DOCUMENTREF"===s.type&&(o(),r+="DocumentRef-"+s.string+":",!i(":")))throw new Error("Expected `:` after `DocumentRef-...`");if("LICENSEREF"===(s=n()).type)return o(),{license:r+="LicenseRef-"+s.string};t=e}()||s()}),l=a("OR",c),d=l();if(!d||r())throw new Error("Syntax error");return d}),Kt}function ar(){if(Xt)return Jt;Xt=1;var e=ir(),t=sr();return Jt=function(r){return t(e(r))}}function cr(){if(tr)return er;tr=1;var e=ar(),t=function(){if(Qt)return Zt;Qt=1;var e=ar(),t=rr;function r(t){try{return e(t),!0}catch(e){return!1}}function n(e,t){var r=t[0].length-e[0].length;return 0!==r?r:e[0].toUpperCase().localeCompare(t[0].toUpperCase())}var o=[["APGL","AGPL"],["Gpl","GPL"],["GLP","GPL"],["APL","Apache"],["ISD","ISC"],["GLP","GPL"],["IST","ISC"],["Claude","Clause"],[" or later","+"],[" International",""],["GNU","GPL"],["GUN","GPL"],["+",""],["GNU GPL","GPL"],["GNU LGPL","LGPL"],["GNU/GPL","GPL"],["GNU GLP","GPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL"],["GNU Lesser General Public License","LGPL"],["GNU LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["GNU Lesser General Public License","LGPL-2.1"],["LESSER GENERAL PUBLIC LICENSE","LGPL"],["Lesser General Public License","LGPL"],["LESSER GENERAL PUBLIC LICENSE","LGPL-2.1"],["Lesser General Public License","LGPL-2.1"],["GNU General Public License","GPL"],["Gnu public license","GPL"],["GNU Public License","GPL"],["GNU GENERAL PUBLIC LICENSE","GPL"],["MTI","MIT"],["Mozilla Public License","MPL"],["Universal Permissive License","UPL"],["WTH","WTF"],["WTFGPL","WTFPL"],["-License",""]].sort(n),i=[function(e){return e.toUpperCase()},function(e){return e.trim()},function(e){return e.replace(/\./g,"")},function(e){return e.replace(/\s+/g,"")},function(e){return e.replace(/\s+/g,"-")},function(e){return e.replace("v","-")},function(e){return e.replace(/,?\s*(\d)/,"-$1")},function(e){return e.replace(/,?\s*(\d)/,"-$1.0")},function(e){return e.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2")},function(e){return e.replace(/,?\s*(V\.|v\.|V|v|Version|version)\s*(\d)/,"-$2.0")},function(e){return e[0].toUpperCase()+e.slice(1)},function(e){return e.replace("/","-")},function(e){return e.replace(/\s*V\s*(\d)/,"-$1").replace(/(\d)$/,"$1.0")},function(e){return-1!==e.indexOf("3.0")?e+"-or-later":e+"-only"},function(e){return e+"only"},function(e){return e.replace(/(\d)$/,"-$1.0")},function(e){return e.replace(/(-| )?(\d)$/,"-$2-Clause")},function(e){return e.replace(/(-| )clause(-| )(\d)/,"-$3-Clause")},function(e){return e.replace(/\b(Modified|New|Revised)(-| )?BSD((-| )License)?/i,"BSD-3-Clause")},function(e){return e.replace(/\bSimplified(-| )?BSD((-| )License)?/i,"BSD-2-Clause")},function(e){return e.replace(/\b(Free|Net)(-| )?BSD((-| )License)?/i,"BSD-2-Clause-$1BSD")},function(e){return e.replace(/\bClear(-| )?BSD((-| )License)?/i,"BSD-3-Clause-Clear")},function(e){return e.replace(/\b(Old|Original)(-| )?BSD((-| )License)?/i,"BSD-4-Clause")},function(e){return"CC-"+e},function(e){return"CC-"+e+"-4.0"},function(e){return e.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")},function(e){return"CC-"+e.replace("Attribution","BY").replace("NonCommercial","NC").replace("NoDerivatives","ND").replace(/ (\d)/,"-$1").replace(/ ?International/,"")+"-4.0"}],s=t.map(function(e){var t=/^(.*)-\d+\.\d+$/.exec(e);return t?[t[0],t[1]]:[e,null]}).reduce(function(e,t){var r=t[1];return e[r]=e[r]||[],e[r].push(t[0]),e},{}),a=Object.keys(s).map(function(e){return[e,s[e]]}).filter(function(e){return 1===e[1].length&&null!==e[0]&&"APL"!==e[0]}).map(function(e){return[e[0],e[1][0]]});s=void 0;var c=[["UNLI","Unlicense"],["WTF","WTFPL"],["2 CLAUSE","BSD-2-Clause"],["2-CLAUSE","BSD-2-Clause"],["3 CLAUSE","BSD-3-Clause"],["3-CLAUSE","BSD-3-Clause"],["AFFERO","AGPL-3.0-or-later"],["AGPL","AGPL-3.0-or-later"],["APACHE","Apache-2.0"],["ARTISTIC","Artistic-2.0"],["Affero","AGPL-3.0-or-later"],["BEER","Beerware"],["BOOST","BSL-1.0"],["BSD","BSD-2-Clause"],["CDDL","CDDL-1.1"],["ECLIPSE","EPL-1.0"],["FUCK","WTFPL"],["GNU","GPL-3.0-or-later"],["LGPL","LGPL-3.0-or-later"],["GPLV1","GPL-1.0-only"],["GPL-1","GPL-1.0-only"],["GPLV2","GPL-2.0-only"],["GPL-2","GPL-2.0-only"],["GPL","GPL-3.0-or-later"],["MIT +NO-FALSE-ATTRIBS","MITNFA"],["MIT","MIT"],["MPL","MPL-2.0"],["X11","X11"],["ZLIB","Zlib"]].concat(a).sort(n),l=function(e){for(var t=0;t<i.length;t++){var n=i[t](e).trim();if(n!==e&&r(n))return n}return null},d=function(e){for(var t=e.toUpperCase(),r=0;r<c.length;r++){var n=c[r];if(t.indexOf(n[0])>-1)return n[1]}return null},u=function(e,t){for(var r=0;r<o.length;r++){var n=o[r],i=n[0];if(e.indexOf(i)>-1){var s=t(e.replace(i,n[1]));if(null!==s)return s}}return null};return Zt=function(e,t){var n=void 0===(t=t||{}).upgrade||!!t.upgrade;function o(e){return n?function(e){return-1!==["GPL-1.0","LGPL-1.0","AGPL-1.0","GPL-2.0","LGPL-2.0","AGPL-2.0","LGPL-2.1"].indexOf(e)?e+"-only":-1!==["GPL-1.0+","GPL-2.0+","GPL-3.0+","LGPL-2.0+","LGPL-2.1+","LGPL-3.0+","AGPL-1.0+","AGPL-3.0+"].indexOf(e)?e.replace(/\+$/,"-or-later"):-1!==["GPL-3.0","LGPL-3.0","AGPL-3.0"].indexOf(e)?e+"-or-later":e}(e):e}if("string"!=typeof e||0===e.trim().length)throw Error("Invalid argument. Expected non-empty string.");if(r(e=e.trim()))return o(e);var i=e.replace(/\+$/,"").trim();if(r(i))return o(i);var s=l(e);return null!==s||null!==(s=u(e,function(e){return r(e)?e:l(e)}))||null!==(s=d(e))||null!==(s=u(e,d))?o(s):null}}(),r='license should be a valid SPDX license expression (without "LicenseRef"), "UNLICENSED", or "SEE LICENSE IN <filename>"',n=/^SEE LICEN[CS]E IN (.+)$/;function o(e,t){return t.slice(0,e.length)===e}function i(e){if(e.hasOwnProperty("license")){var t=e.license;return o("LicenseRef",t)||o("DocumentRef",t)}return i(e.left)||i(e.right)}return er=function(o){var s;try{s=e(o)}catch(e){var a;if("UNLICENSED"===o||"UNLICENCED"===o)return{validForOldPackages:!0,validForNewPackages:!0,unlicensed:!0};if(a=n.exec(o))return{validForOldPackages:!0,validForNewPackages:!0,inFile:a[1]};var c={validForOldPackages:!1,validForNewPackages:!1,warnings:[r]};if(0!==o.trim().length){var l=t(o);l&&c.warnings.push('license is similar to the valid expression "'+l+'"')}return c}return i(s)?{validForNewPackages:!1,validForOldPackages:!1,spdx:!0,warnings:[r]}:{validForNewPackages:!0,validForOldPackages:!0,spdx:!0}}}var lr,dr,ur,pr,hr,fr,mr,gr,yr,vr,br,$r={};function wr(){if(lr)return $r;lr=1,Object.defineProperty($r,"__esModule",{value:!0}),$r.LRUCache=void 0;const e="object"==typeof performance&&performance&&"function"==typeof performance.now?performance:Date,t=new Set,r="object"==typeof process&&process?process:{},n=(e,t,n,o)=>{"function"==typeof r.emitWarning?r.emitWarning(e,t,n,o):console.error(`[${n}] ${t}: ${e}`)};let o=globalThis.AbortController,i=globalThis.AbortSignal;if(void 0===o){i=class{onabort;_onabort=[];reason;aborted=!1;addEventListener(e,t){this._onabort.push(t)}},o=class{constructor(){t()}signal=new i;abort(e){if(!this.signal.aborted){this.signal.reason=e,this.signal.aborted=!0;for(const t of this.signal._onabort)t(e);this.signal.onabort?.(e)}}};let e="1"!==r.env?.LRU_CACHE_IGNORE_AC_WARNING;const t=()=>{e&&(e=!1,n("AbortController is not defined. If using lru-cache in node 14, load an AbortController polyfill from the `node-abort-controller` package. A minimal polyfill is provided for use by LRUCache.fetch(), but it should not be relied upon in other contexts (eg, passing it to other APIs that use AbortController/AbortSignal might have undesirable effects). You may disable this with LRU_CACHE_IGNORE_AC_WARNING=1 in the env.","NO_ABORT_CONTROLLER","ENOTSUP",t))}}const s=e=>e&&e===Math.floor(e)&&e>0&&isFinite(e),a=e=>s(e)?e<=Math.pow(2,8)?Uint8Array:e<=Math.pow(2,16)?Uint16Array:e<=Math.pow(2,32)?Uint32Array:e<=Number.MAX_SAFE_INTEGER?c:null:null;class c extends Array{constructor(e){super(e),this.fill(0)}}class l{heap;length;static#l=!1;static create(e){const t=a(e);if(!t)return[];l.#l=!0;const r=new l(e,t);return l.#l=!1,r}constructor(e,t){if(!l.#l)throw new TypeError("instantiate Stack using Stack.create(n)");this.heap=new t(e),this.length=0}push(e){this.heap[this.length++]=e}pop(){return this.heap[--this.length]}}class d{#d;#u;#p;#h;#f;#m;#g;#y;get perf(){return this.#y}ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#v;#b;#$;#w;#E;#S;#P;#_;#L;#k;#C;#N;#I;#O;#A;#x;#T;#D;static unsafeExposeInternals(e){return{starts:e.#I,ttls:e.#O,sizes:e.#N,keyMap:e.#$,keyList:e.#w,valList:e.#E,next:e.#S,prev:e.#P,get head(){return e.#_},get tail(){return e.#L},free:e.#k,isBackgroundFetch:t=>e.#j(t),backgroundFetch:(t,r,n,o)=>e.#R(t,r,n,o),moveToTail:t=>e.#F(t),indexes:t=>e.#M(t),rindexes:t=>e.#G(t),isStale:t=>e.#U(t)}}get max(){return this.#d}get maxSize(){return this.#u}get calculatedSize(){return this.#b}get size(){return this.#v}get fetchMethod(){return this.#m}get memoMethod(){return this.#g}get dispose(){return this.#p}get onInsert(){return this.#h}get disposeAfter(){return this.#f}constructor(r){const{max:o=0,ttl:i,ttlResolution:c=1,ttlAutopurge:u,updateAgeOnGet:p,updateAgeOnHas:h,allowStale:f,dispose:m,onInsert:g,disposeAfter:y,noDisposeOnSet:v,noUpdateTTL:b,maxSize:$=0,maxEntrySize:w=0,sizeCalculation:E,fetchMethod:S,memoMethod:P,noDeleteOnFetchRejection:_,noDeleteOnStaleGet:L,allowStaleOnFetchRejection:k,allowStaleOnFetchAbort:C,ignoreFetchAbort:N,perf:I}=r;if(void 0!==I&&"function"!=typeof I?.now)throw new TypeError("perf option must have a now() method if specified");if(this.#y=I??e,0!==o&&!s(o))throw new TypeError("max option must be a nonnegative integer");const O=o?a(o):Array;if(!O)throw new Error("invalid max value: "+o);if(this.#d=o,this.#u=$,this.maxEntrySize=w||this.#u,this.sizeCalculation=E,this.sizeCalculation){if(!this.#u&&!this.maxEntrySize)throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize");if("function"!=typeof this.sizeCalculation)throw new TypeError("sizeCalculation set to non-function")}if(void 0!==P&&"function"!=typeof P)throw new TypeError("memoMethod must be a function if defined");if(this.#g=P,void 0!==S&&"function"!=typeof S)throw new TypeError("fetchMethod must be a function if specified");if(this.#m=S,this.#x=!!S,this.#$=new Map,this.#w=new Array(o).fill(void 0),this.#E=new Array(o).fill(void 0),this.#S=new O(o),this.#P=new O(o),this.#_=0,this.#L=0,this.#k=l.create(o),this.#v=0,this.#b=0,"function"==typeof m&&(this.#p=m),"function"==typeof g&&(this.#h=g),"function"==typeof y?(this.#f=y,this.#C=[]):(this.#f=void 0,this.#C=void 0),this.#A=!!this.#p,this.#D=!!this.#h,this.#T=!!this.#f,this.noDisposeOnSet=!!v,this.noUpdateTTL=!!b,this.noDeleteOnFetchRejection=!!_,this.allowStaleOnFetchRejection=!!k,this.allowStaleOnFetchAbort=!!C,this.ignoreFetchAbort=!!N,0!==this.maxEntrySize){if(0!==this.#u&&!s(this.#u))throw new TypeError("maxSize must be a positive integer if specified");if(!s(this.maxEntrySize))throw new TypeError("maxEntrySize must be a positive integer if specified");this.#B()}if(this.allowStale=!!f,this.noDeleteOnStaleGet=!!L,this.updateAgeOnGet=!!p,this.updateAgeOnHas=!!h,this.ttlResolution=s(c)||0===c?c:1,this.ttlAutopurge=!!u,this.ttl=i||0,this.ttl){if(!s(this.ttl))throw new TypeError("ttl must be a positive integer if specified");this.#z()}if(0===this.#d&&0===this.ttl&&0===this.#u)throw new TypeError("At least one of max, maxSize, or ttl is required");if(!this.ttlAutopurge&&!this.#d&&!this.#u){const e="LRU_CACHE_UNBOUNDED";if((e=>!t.has(e))(e)){t.add(e);n("TTL caching without ttlAutopurge, max, or maxSize can result in unbounded memory consumption.","UnboundedCacheWarning",e,d)}}}getRemainingTTL(e){return this.#$.has(e)?1/0:0}#z(){const e=new c(this.#d),t=new c(this.#d);this.#O=e,this.#I=t,this.#V=(r,n,o=this.#y.now())=>{if(t[r]=0!==n?o:0,e[r]=n,0!==n&&this.ttlAutopurge){const e=setTimeout(()=>{this.#U(r)&&this.#H(this.#w[r],"expire")},n+1);e.unref&&e.unref()}},this.#q=r=>{t[r]=0!==e[r]?this.#y.now():0},this.#W=(o,i)=>{if(e[i]){const s=e[i],a=t[i];if(!s||!a)return;o.ttl=s,o.start=a,o.now=r||n();const c=o.now-a;o.remainingTTL=s-c}};let r=0;const n=()=>{const e=this.#y.now();if(this.ttlResolution>0){r=e;const t=setTimeout(()=>r=0,this.ttlResolution);t.unref&&t.unref()}return e};this.getRemainingTTL=o=>{const i=this.#$.get(o);if(void 0===i)return 0;const s=e[i],a=t[i];if(!s||!a)return 1/0;return s-((r||n())-a)},this.#U=o=>{const i=t[o],s=e[o];return!!s&&!!i&&(r||n())-i>s}}#q=()=>{};#W=()=>{};#V=()=>{};#U=()=>!1;#B(){const e=new c(this.#d);this.#b=0,this.#N=e,this.#K=t=>{this.#b-=e[t],e[t]=0},this.#Y=(e,t,r,n)=>{if(this.#j(t))return 0;if(!s(r)){if(!n)throw new TypeError("invalid size value (must be positive integer). When maxSize or maxEntrySize is used, sizeCalculation or size must be set.");if("function"!=typeof n)throw new TypeError("sizeCalculation must be a function");if(r=n(t,e),!s(r))throw new TypeError("sizeCalculation return invalid (expect positive integer)")}return r},this.#J=(t,r,n)=>{if(e[t]=r,this.#u){const r=this.#u-e[t];for(;this.#b>r;)this.#X(!0)}this.#b+=e[t],n&&(n.entrySize=r,n.totalCalculatedSize=this.#b)}}#K=e=>{};#J=(e,t,r)=>{};#Y=(e,t,r,n)=>{if(r||n)throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache");return 0};*#M({allowStale:e=this.allowStale}={}){if(this.#v)for(let t=this.#L;this.#Z(t)&&(!e&&this.#U(t)||(yield t),t!==this.#_);)t=this.#P[t]}*#G({allowStale:e=this.allowStale}={}){if(this.#v)for(let t=this.#_;this.#Z(t)&&(!e&&this.#U(t)||(yield t),t!==this.#L);)t=this.#S[t]}#Z(e){return void 0!==e&&this.#$.get(this.#w[e])===e}*entries(){for(const e of this.#M())void 0===this.#E[e]||void 0===this.#w[e]||this.#j(this.#E[e])||(yield[this.#w[e],this.#E[e]])}*rentries(){for(const e of this.#G())void 0===this.#E[e]||void 0===this.#w[e]||this.#j(this.#E[e])||(yield[this.#w[e],this.#E[e]])}*keys(){for(const e of this.#M()){const t=this.#w[e];void 0===t||this.#j(this.#E[e])||(yield t)}}*rkeys(){for(const e of this.#G()){const t=this.#w[e];void 0===t||this.#j(this.#E[e])||(yield t)}}*values(){for(const e of this.#M()){void 0===this.#E[e]||this.#j(this.#E[e])||(yield this.#E[e])}}*rvalues(){for(const e of this.#G()){void 0===this.#E[e]||this.#j(this.#E[e])||(yield this.#E[e])}}[Symbol.iterator](){return this.entries()}[Symbol.toStringTag]="LRUCache";find(e,t={}){for(const r of this.#M()){const n=this.#E[r],o=this.#j(n)?n.__staleWhileFetching:n;if(void 0!==o&&e(o,this.#w[r],this))return this.get(this.#w[r],t)}}forEach(e,t=this){for(const r of this.#M()){const n=this.#E[r],o=this.#j(n)?n.__staleWhileFetching:n;void 0!==o&&e.call(t,o,this.#w[r],this)}}rforEach(e,t=this){for(const r of this.#G()){const n=this.#E[r],o=this.#j(n)?n.__staleWhileFetching:n;void 0!==o&&e.call(t,o,this.#w[r],this)}}purgeStale(){let e=!1;for(const t of this.#G({allowStale:!0}))this.#U(t)&&(this.#H(this.#w[t],"expire"),e=!0);return e}info(e){const t=this.#$.get(e);if(void 0===t)return;const r=this.#E[t],n=this.#j(r)?r.__staleWhileFetching:r;if(void 0===n)return;const o={value:n};if(this.#O&&this.#I){const e=this.#O[t],r=this.#I[t];if(e&&r){const t=e-(this.#y.now()-r);o.ttl=t,o.start=Date.now()}}return this.#N&&(o.size=this.#N[t]),o}dump(){const e=[];for(const t of this.#M({allowStale:!0})){const r=this.#w[t],n=this.#E[t],o=this.#j(n)?n.__staleWhileFetching:n;if(void 0===o||void 0===r)continue;const i={value:o};if(this.#O&&this.#I){i.ttl=this.#O[t];const e=this.#y.now()-this.#I[t];i.start=Math.floor(Date.now()-e)}this.#N&&(i.size=this.#N[t]),e.unshift([r,i])}return e}load(e){this.clear();for(const[t,r]of e){if(r.start){const e=Date.now()-r.start;r.start=this.#y.now()-e}this.set(t,r.value,r)}}set(e,t,r={}){if(void 0===t)return this.delete(e),this;const{ttl:n=this.ttl,start:o,noDisposeOnSet:i=this.noDisposeOnSet,sizeCalculation:s=this.sizeCalculation,status:a}=r;let{noUpdateTTL:c=this.noUpdateTTL}=r;const l=this.#Y(e,t,r.size||0,s);if(this.maxEntrySize&&l>this.maxEntrySize)return a&&(a.set="miss",a.maxEntrySizeExceeded=!0),this.#H(e,"set"),this;let d=0===this.#v?void 0:this.#$.get(e);if(void 0===d)d=0===this.#v?this.#L:0!==this.#k.length?this.#k.pop():this.#v===this.#d?this.#X(!1):this.#v,this.#w[d]=e,this.#E[d]=t,this.#$.set(e,d),this.#S[this.#L]=d,this.#P[d]=this.#L,this.#L=d,this.#v++,this.#J(d,l,a),a&&(a.set="add"),c=!1,this.#D&&this.#h?.(t,e,"add");else{this.#F(d);const r=this.#E[d];if(t!==r){if(this.#x&&this.#j(r)){r.__abortController.abort(new Error("replaced"));const{__staleWhileFetching:t}=r;void 0===t||i||(this.#A&&this.#p?.(t,e,"set"),this.#T&&this.#C?.push([t,e,"set"]))}else i||(this.#A&&this.#p?.(r,e,"set"),this.#T&&this.#C?.push([r,e,"set"]));if(this.#K(d),this.#J(d,l,a),this.#E[d]=t,a){a.set="replace";const e=r&&this.#j(r)?r.__staleWhileFetching:r;void 0!==e&&(a.oldValue=e)}}else a&&(a.set="update");this.#D&&this.onInsert?.(t,e,t===r?"update":"replace")}if(0===n||this.#O||this.#z(),this.#O&&(c||this.#V(d,n,o),a&&this.#W(a,d)),!i&&this.#T&&this.#C){const e=this.#C;let t;for(;t=e?.shift();)this.#f?.(...t)}return this}pop(){try{for(;this.#v;){const e=this.#E[this.#_];if(this.#X(!0),this.#j(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(void 0!==e)return e}}finally{if(this.#T&&this.#C){const e=this.#C;let t;for(;t=e?.shift();)this.#f?.(...t)}}}#X(e){const t=this.#_,r=this.#w[t],n=this.#E[t];return this.#x&&this.#j(n)?n.__abortController.abort(new Error("evicted")):(this.#A||this.#T)&&(this.#A&&this.#p?.(n,r,"evict"),this.#T&&this.#C?.push([n,r,"evict"])),this.#K(t),e&&(this.#w[t]=void 0,this.#E[t]=void 0,this.#k.push(t)),1===this.#v?(this.#_=this.#L=0,this.#k.length=0):this.#_=this.#S[t],this.#$.delete(r),this.#v--,t}has(e,t={}){const{updateAgeOnHas:r=this.updateAgeOnHas,status:n}=t,o=this.#$.get(e);if(void 0!==o){const e=this.#E[o];if(this.#j(e)&&void 0===e.__staleWhileFetching)return!1;if(!this.#U(o))return r&&this.#q(o),n&&(n.has="hit",this.#W(n,o)),!0;n&&(n.has="stale",this.#W(n,o))}else n&&(n.has="miss");return!1}peek(e,t={}){const{allowStale:r=this.allowStale}=t,n=this.#$.get(e);if(void 0===n||!r&&this.#U(n))return;const o=this.#E[n];return this.#j(o)?o.__staleWhileFetching:o}#R(e,t,r,n){const i=void 0===t?void 0:this.#E[t];if(this.#j(i))return i;const s=new o,{signal:a}=r;a?.addEventListener("abort",()=>s.abort(a.reason),{signal:s.signal});const c={signal:s.signal,options:r,context:n},l=(n,o=!1)=>{const{aborted:i}=s.signal,a=r.ignoreFetchAbort&&void 0!==n;if(r.status&&(i&&!o?(r.status.fetchAborted=!0,r.status.fetchError=s.signal.reason,a&&(r.status.fetchAbortIgnored=!0)):r.status.fetchResolved=!0),i&&!a&&!o)return d(s.signal.reason);const l=u;return this.#E[t]===u&&(void 0===n?void 0!==l.__staleWhileFetching?this.#E[t]=l.__staleWhileFetching:this.#H(e,"fetch"):(r.status&&(r.status.fetchUpdated=!0),this.set(e,n,c.options))),n},d=n=>{const{aborted:o}=s.signal,i=o&&r.allowStaleOnFetchAbort,a=i||r.allowStaleOnFetchRejection,c=a||r.noDeleteOnFetchRejection,l=u;if(this.#E[t]===u){!c||void 0===l.__staleWhileFetching?this.#H(e,"fetch"):i||(this.#E[t]=l.__staleWhileFetching)}if(a)return r.status&&void 0!==l.__staleWhileFetching&&(r.status.returnedStale=!0),l.__staleWhileFetching;if(l.__returned===l)throw n};r.status&&(r.status.fetchDispatched=!0);const u=new Promise((t,n)=>{const o=this.#m?.(e,i,c);o&&o instanceof Promise&&o.then(e=>t(void 0===e?void 0:e),n),s.signal.addEventListener("abort",()=>{r.ignoreFetchAbort&&!r.allowStaleOnFetchAbort||(t(void 0),r.allowStaleOnFetchAbort&&(t=e=>l(e,!0)))})}).then(l,e=>(r.status&&(r.status.fetchRejected=!0,r.status.fetchError=e),d(e))),p=Object.assign(u,{__abortController:s,__staleWhileFetching:i,__returned:void 0});return void 0===t?(this.set(e,p,{...c.options,status:void 0}),t=this.#$.get(e)):this.#E[t]=p,p}#j(e){if(!this.#x)return!1;const t=e;return!!t&&t instanceof Promise&&t.hasOwnProperty("__staleWhileFetching")&&t.__abortController instanceof o}async fetch(e,t={}){const{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,ttl:i=this.ttl,noDisposeOnSet:s=this.noDisposeOnSet,size:a=0,sizeCalculation:c=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:d=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:u=this.allowStaleOnFetchRejection,ignoreFetchAbort:p=this.ignoreFetchAbort,allowStaleOnFetchAbort:h=this.allowStaleOnFetchAbort,context:f,forceRefresh:m=!1,status:g,signal:y}=t;if(!this.#x)return g&&(g.fetch="get"),this.get(e,{allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:o,status:g});const v={allowStale:r,updateAgeOnGet:n,noDeleteOnStaleGet:o,ttl:i,noDisposeOnSet:s,size:a,sizeCalculation:c,noUpdateTTL:l,noDeleteOnFetchRejection:d,allowStaleOnFetchRejection:u,allowStaleOnFetchAbort:h,ignoreFetchAbort:p,status:g,signal:y};let b=this.#$.get(e);if(void 0===b){g&&(g.fetch="miss");const t=this.#R(e,b,v,f);return t.__returned=t}{const t=this.#E[b];if(this.#j(t)){const e=r&&void 0!==t.__staleWhileFetching;return g&&(g.fetch="inflight",e&&(g.returnedStale=!0)),e?t.__staleWhileFetching:t.__returned=t}const o=this.#U(b);if(!m&&!o)return g&&(g.fetch="hit"),this.#F(b),n&&this.#q(b),g&&this.#W(g,b),t;const i=this.#R(e,b,v,f),s=void 0!==i.__staleWhileFetching&&r;return g&&(g.fetch=o?"stale":"refresh",s&&o&&(g.returnedStale=!0)),s?i.__staleWhileFetching:i.__returned=i}}async forceFetch(e,t={}){const r=await this.fetch(e,t);if(void 0===r)throw new Error("fetch() returned undefined");return r}memo(e,t={}){const r=this.#g;if(!r)throw new Error("no memoMethod provided to constructor");const{context:n,forceRefresh:o,...i}=t,s=this.get(e,i);if(!o&&void 0!==s)return s;const a=r(e,s,{options:i,context:n});return this.set(e,a,i),a}get(e,t={}){const{allowStale:r=this.allowStale,updateAgeOnGet:n=this.updateAgeOnGet,noDeleteOnStaleGet:o=this.noDeleteOnStaleGet,status:i}=t,s=this.#$.get(e);if(void 0!==s){const t=this.#E[s],a=this.#j(t);return i&&this.#W(i,s),this.#U(s)?(i&&(i.get="stale"),a?(i&&r&&void 0!==t.__staleWhileFetching&&(i.returnedStale=!0),r?t.__staleWhileFetching:void 0):(o||this.#H(e,"expire"),i&&r&&(i.returnedStale=!0),r?t:void 0)):(i&&(i.get="hit"),a?t.__staleWhileFetching:(this.#F(s),n&&this.#q(s),t))}i&&(i.get="miss")}#Q(e,t){this.#P[t]=e,this.#S[e]=t}#F(e){e!==this.#L&&(e===this.#_?this.#_=this.#S[e]:this.#Q(this.#P[e],this.#S[e]),this.#Q(this.#L,e),this.#L=e)}delete(e){return this.#H(e,"delete")}#H(e,t){let r=!1;if(0!==this.#v){const n=this.#$.get(e);if(void 0!==n)if(r=!0,1===this.#v)this.#ee(t);else{this.#K(n);const r=this.#E[n];if(this.#j(r)?r.__abortController.abort(new Error("deleted")):(this.#A||this.#T)&&(this.#A&&this.#p?.(r,e,t),this.#T&&this.#C?.push([r,e,t])),this.#$.delete(e),this.#w[n]=void 0,this.#E[n]=void 0,n===this.#L)this.#L=this.#P[n];else if(n===this.#_)this.#_=this.#S[n];else{const e=this.#P[n];this.#S[e]=this.#S[n];const t=this.#S[n];this.#P[t]=this.#P[n]}this.#v--,this.#k.push(n)}}if(this.#T&&this.#C?.length){const e=this.#C;let t;for(;t=e?.shift();)this.#f?.(...t)}return r}clear(){return this.#ee("delete")}#ee(e){for(const t of this.#G({allowStale:!0})){const r=this.#E[t];if(this.#j(r))r.__abortController.abort(new Error("deleted"));else{const n=this.#w[t];this.#A&&this.#p?.(r,n,e),this.#T&&this.#C?.push([r,n,e])}}if(this.#$.clear(),this.#E.fill(void 0),this.#w.fill(void 0),this.#O&&this.#I&&(this.#O.fill(0),this.#I.fill(0)),this.#N&&this.#N.fill(0),this.#_=0,this.#L=0,this.#k.length=0,this.#b=0,this.#v=0,this.#T&&this.#C){const e=this.#C;let t;for(;t=e?.shift();)this.#f?.(...t)}}}return $r.LRUCache=d,$r}function Er(){if(hr)return pr;hr=1;const e=te,t=(e,t,r)=>{const n=e.indexOf(r);return e.lastIndexOf(t,n>-1?n:1/0)},r=t=>{try{return new e.URL(t)}catch{}};return pr=(e,n)=>{const o=n?((e,t)=>{const r=e.indexOf(":"),n=e.slice(0,r+1);if(Object.prototype.hasOwnProperty.call(t,n))return e;const o=e.indexOf("@");return o>-1?o>r?`git+ssh://${e}`:e:e.indexOf("//")===r+1?e:`${e.slice(0,r+1)}//${e.slice(r+1)}`})(e,n):e;return r(o)||r((e=>{const r=t(e,"@","#"),n=t(e,":","#");return n>r&&(e=e.slice(0,n)+"/"+e.slice(n+1)),-1===t(e,":","#")&&-1===e.indexOf("//")&&(e=`git+ssh://${e}`),e})(o))},pr}function Sr(){if(mr)return fr;mr=1;const e=Er();return fr=(t,r,{gitHosts:n,protocols:o})=>{if(!t)return;const i=(e=>{const t=e.indexOf("#"),r=e.indexOf("/"),n=e.indexOf("/",r+1),o=e.indexOf(":"),i=/\s/.exec(e),s=e.indexOf("@"),a=!i||t>-1&&i.index>t,c=-1===s||t>-1&&s>t,l=-1===o||t>-1&&o>t,d=-1===n||t>-1&&n>t,u=r>0,p=t>-1?"/"!==e[t-1]:!e.endsWith("/"),h=!e.startsWith(".");return a&&u&&p&&h&&c&&l&&d})(t)?`github:${t}`:t,s=e(i,o);if(!s)return;const a=n.byShortcut[s.protocol],c=n.byDomain[s.hostname.startsWith("www.")?s.hostname.slice(4):s.hostname],l=a||c;if(!l)return;const d=n[a||c];let u=null;o[s.protocol]?.auth&&(s.username||s.password)&&(u=`${s.username}${s.password?":"+s.password:""}`);let p=null,h=null,f=null,m=null;try{if(a){let e=s.pathname.startsWith("/")?s.pathname.slice(1):s.pathname;const t=e.indexOf("@");t>-1&&(e=e.slice(t+1));const r=e.lastIndexOf("/");r>-1?(h=decodeURIComponent(e.slice(0,r)),h||(h=null),f=decodeURIComponent(e.slice(r+1))):f=decodeURIComponent(e),f.endsWith(".git")&&(f=f.slice(0,-4)),s.hash&&(p=decodeURIComponent(s.hash.slice(1))),m="shortcut"}else{if(!d.protocols.includes(s.protocol))return;const e=d.extract(s);if(!e)return;h=e.user&&decodeURIComponent(e.user),f=decodeURIComponent(e.project),p=decodeURIComponent(e.committish),m=o[s.protocol]?.name||s.protocol.slice(0,-1)}}catch(e){if(e instanceof URIError)return;throw e}return[l,h,u,f,p,m,r]}}function Pr(){if(yr)return gr;yr=1;const{LRUCache:e}=wr(),t=function(){if(ur)return dr;ur=1;const e=(...e)=>e.every(e=>e)?e.join(""):"",t=e=>e?encodeURIComponent(e):"",r=e=>e.toLowerCase().replace(/^\W+/g,"").replace(/(?<!\W)\W+$/,"").replace(/\//g,"").replace(/\W+/g,"-"),n={sshtemplate:({domain:t,user:r,project:n,committish:o})=>`git@${t}:${r}/${n}.git${e("#",o)}`,sshurltemplate:({domain:t,user:r,project:n,committish:o})=>`git+ssh://git@${t}/${r}/${n}.git${e("#",o)}`,edittemplate:({domain:r,user:n,project:o,committish:i,editpath:s,path:a})=>`https://${r}/${n}/${o}${e("/",s,"/",t(i||"HEAD"),"/",a)}`,browsetemplate:({domain:r,user:n,project:o,committish:i,treepath:s})=>`https://${r}/${n}/${o}${e("/",s,"/",t(i))}`,browsetreetemplate:({domain:r,user:n,project:o,committish:i,treepath:s,path:a,fragment:c,hashformat:l})=>`https://${r}/${n}/${o}/${s}/${t(i||"HEAD")}/${a}${e("#",l(c||""))}`,browseblobtemplate:({domain:r,user:n,project:o,committish:i,blobpath:s,path:a,fragment:c,hashformat:l})=>`https://${r}/${n}/${o}/${s}/${t(i||"HEAD")}/${a}${e("#",l(c||""))}`,docstemplate:({domain:r,user:n,project:o,treepath:i,committish:s})=>`https://${r}/${n}/${o}${e("/",i,"/",t(s))}#readme`,httpstemplate:({auth:t,domain:r,user:n,project:o,committish:i})=>`git+https://${e(t,"@")}${r}/${n}/${o}.git${e("#",i)}`,filetemplate:({domain:e,user:r,project:n,committish:o,path:i})=>`https://${e}/${r}/${n}/raw/${t(o||"HEAD")}/${i}`,shortcuttemplate:({type:t,user:r,project:n,committish:o})=>`${t}:${r}/${n}${e("#",o)}`,pathtemplate:({user:t,project:r,committish:n})=>`${t}/${r}${e("#",n)}`,bugstemplate:({domain:e,user:t,project:r})=>`https://${e}/${t}/${r}/issues`,hashformat:r},o={};o.github={protocols:["git:","http:","git+ssh:","git+https:","ssh:","https:"],domain:"github.com",treepath:"tree",blobpath:"blob",editpath:"edit",filetemplate:({auth:r,user:n,project:o,committish:i,path:s})=>`https://${e(r,"@")}raw.githubusercontent.com/${n}/${o}/${t(i||"HEAD")}/${s}`,gittemplate:({auth:t,domain:r,user:n,project:o,committish:i})=>`git://${e(t,"@")}${r}/${n}/${o}.git${e("#",i)}`,tarballtemplate:({domain:e,user:r,project:n,committish:o})=>`https://codeload.${e}/${r}/${n}/tar.gz/${t(o||"HEAD")}`,extract:e=>{let[,t,r,n,o]=e.pathname.split("/",5);if((!n||"tree"===n)&&(n||(o=e.hash.slice(1)),r&&r.endsWith(".git")&&(r=r.slice(0,-4)),t&&r))return{user:t,project:r,committish:o}}},o.bitbucket={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"bitbucket.org",treepath:"src",blobpath:"src",editpath:"?mode=edit",edittemplate:({domain:r,user:n,project:o,committish:i,treepath:s,path:a,editpath:c})=>`https://${r}/${n}/${o}${e("/",s,"/",t(i||"HEAD"),"/",a,c)}`,tarballtemplate:({domain:e,user:r,project:n,committish:o})=>`https://${e}/${r}/${n}/get/${t(o||"HEAD")}.tar.gz`,extract:e=>{let[,t,r,n]=e.pathname.split("/",4);if(!["get"].includes(n)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),t&&r))return{user:t,project:r,committish:e.hash.slice(1)}}},o.gitlab={protocols:["git+ssh:","git+https:","ssh:","https:"],domain:"gitlab.com",treepath:"tree",blobpath:"tree",editpath:"-/edit",httpstemplate:({auth:t,domain:r,user:n,project:o,committish:i})=>`git+https://${e(t,"@")}${r}/${n}/${o}.git${e("#",i)}`,tarballtemplate:({domain:e,user:r,project:n,committish:o})=>`https://${e}/${r}/${n}/repository/archive.tar.gz?ref=${t(o||"HEAD")}`,extract:e=>{const t=e.pathname.slice(1);if(t.includes("/-/")||t.includes("/archive.tar.gz"))return;const r=t.split("/");let n=r.pop();n.endsWith(".git")&&(n=n.slice(0,-4));const o=r.join("/");return o&&n?{user:o,project:n,committish:e.hash.slice(1)}:void 0}},o.gist={protocols:["git:","git+ssh:","git+https:","ssh:","https:"],domain:"gist.github.com",editpath:"edit",sshtemplate:({domain:t,project:r,committish:n})=>`git@${t}:${r}.git${e("#",n)}`,sshurltemplate:({domain:t,project:r,committish:n})=>`git+ssh://git@${t}/${r}.git${e("#",n)}`,edittemplate:({domain:r,user:n,project:o,committish:i,editpath:s})=>`https://${r}/${n}/${o}${e("/",t(i))}/${s}`,browsetemplate:({domain:r,project:n,committish:o})=>`https://${r}/${n}${e("/",t(o))}`,browsetreetemplate:({domain:r,project:n,committish:o,path:i,hashformat:s})=>`https://${r}/${n}${e("/",t(o))}${e("#",s(i))}`,browseblobtemplate:({domain:r,project:n,committish:o,path:i,hashformat:s})=>`https://${r}/${n}${e("/",t(o))}${e("#",s(i))}`,docstemplate:({domain:r,project:n,committish:o})=>`https://${r}/${n}${e("/",t(o))}`,httpstemplate:({domain:t,project:r,committish:n})=>`git+https://${t}/${r}.git${e("#",n)}`,filetemplate:({user:r,project:n,committish:o,path:i})=>`https://gist.githubusercontent.com/${r}/${n}/raw${e("/",t(o))}/${i}`,shortcuttemplate:({type:t,project:r,committish:n})=>`${t}:${r}${e("#",n)}`,pathtemplate:({project:t,committish:r})=>`${t}${e("#",r)}`,bugstemplate:({domain:e,project:t})=>`https://${e}/${t}`,gittemplate:({domain:t,project:r,committish:n})=>`git://${t}/${r}.git${e("#",n)}`,tarballtemplate:({project:e,committish:r})=>`https://codeload.github.com/gist/${e}/tar.gz/${t(r||"HEAD")}`,extract:e=>{let[,t,r,n]=e.pathname.split("/",4);if("raw"!==n){if(!r){if(!t)return;r=t,t=null}return r.endsWith(".git")&&(r=r.slice(0,-4)),{user:t,project:r,committish:e.hash.slice(1)}}},hashformat:function(e){return e&&"file-"+r(e)}},o.sourcehut={protocols:["git+ssh:","https:"],domain:"git.sr.ht",treepath:"tree",blobpath:"tree",filetemplate:({domain:e,user:r,project:n,committish:o,path:i})=>`https://${e}/${r}/${n}/blob/${t(o)||"HEAD"}/${i}`,httpstemplate:({domain:t,user:r,project:n,committish:o})=>`https://${t}/${r}/${n}.git${e("#",o)}`,tarballtemplate:({domain:e,user:r,project:n,committish:o})=>`https://${e}/${r}/${n}/archive/${t(o)||"HEAD"}.tar.gz`,bugstemplate:()=>null,extract:e=>{let[,t,r,n]=e.pathname.split("/",4);if(!["archive"].includes(n)&&(r&&r.endsWith(".git")&&(r=r.slice(0,-4)),t&&r))return{user:t,project:r,committish:e.hash.slice(1)}}};for(const[e,t]of Object.entries(o))o[e]=Object.assign({},n,t);return dr=o}(),r=Sr(),n=Er(),o=new e({max:1e3});class i{constructor(e,t,r,n,o,s,a={}){Object.assign(this,i.#te[e],{type:e,user:t,auth:r,project:n,committish:o,default:s,opts:a})}static#te={byShortcut:{},byDomain:{}};static#re={"git+ssh:":{name:"sshurl"},"ssh:":{name:"sshurl"},"git+https:":{name:"https",auth:!0},"git:":{auth:!0},"http:":{auth:!0},"https:":{auth:!0},"git+http:":{auth:!0}};static addHost(e,t){i.#te[e]=t,i.#te.byDomain[t.domain]=e,i.#te.byShortcut[`${e}:`]=e,i.#re[`${e}:`]={name:e}}static fromUrl(e,t){if("string"!=typeof e)return;const n=e+JSON.stringify(t||{});if(!o.has(n)){const s=r(e,t,{gitHosts:i.#te,protocols:i.#re});o.set(n,s?new i(...s):void 0)}return o.get(n)}static fromManifest(e,t={}){if(!e||"object"!=typeof e)return;const r=e.repository,n=r&&("string"==typeof r?r:"object"==typeof r&&"string"==typeof r.url?r.url:null);if(!n)throw new Error("no repository");const o=n&&i.fromUrl(n.replace(/^git\+/,""),t)||null;if(o)return o;const s=function(e){try{const{protocol:t,hostname:r,pathname:n}=new URL(e);if(!r)return null;return`${/(?:git\+)http:$/.test(t)?"http:":"https:"}//${r}${n.replace(/\.git$/,"")}`}catch{return null}}(n);return i.fromUrl(s,t)||s}static parseUrl(e){return n(e)}#ne(e,t){if("function"!=typeof e)return null;const r={...this,...this.opts,...t};r.path||(r.path=""),r.path.startsWith("/")&&(r.path=r.path.slice(1)),r.noCommittish&&(r.committish=null);const n=e(r);return r.noGitPlus&&n.startsWith("git+")?n.slice(4):n}hash(){return this.committish?`#${this.committish}`:""}ssh(e){return this.#ne(this.sshtemplate,e)}sshurl(e){return this.#ne(this.sshurltemplate,e)}browse(e,...t){return"string"!=typeof e?this.#ne(this.browsetemplate,e):"string"!=typeof t[0]?this.#ne(this.browsetreetemplate,{...t[0],path:e}):this.#ne(this.browsetreetemplate,{...t[1],fragment:t[0],path:e})}browseFile(e,...t){return"string"!=typeof t[0]?this.#ne(this.browseblobtemplate,{...t[0],path:e}):this.#ne(this.browseblobtemplate,{...t[1],fragment:t[0],path:e})}docs(e){return this.#ne(this.docstemplate,e)}bugs(e){return this.#ne(this.bugstemplate,e)}https(e){return this.#ne(this.httpstemplate,e)}git(e){return this.#ne(this.gittemplate,e)}shortcut(e){return this.#ne(this.shortcuttemplate,e)}path(e){return this.#ne(this.pathtemplate,e)}tarball(e){return this.#ne(this.tarballtemplate,{...e,noCommittish:!1})}file(e,t){return this.#ne(this.filetemplate,{...t,path:e})}edit(e,t){return this.#ne(this.edittemplate,{...t,path:e})}getDefaultRepresentation(){return this.default}toString(e){return this.default&&"function"==typeof this[this.default]?this[this.default](e):this.sshurl(e)}}for(const[e,r]of Object.entries(t))i.addHost(e,r);return gr=i}var _r,Lr,kr={topLevel:{dependancies:"dependencies",dependecies:"dependencies",depdenencies:"dependencies",devEependencies:"devDependencies",depends:"dependencies","dev-dependencies":"devDependencies",devDependences:"devDependencies",devDepenencies:"devDependencies",devdependencies:"devDependencies",repostitory:"repository",repo:"repository",prefereGlobal:"preferGlobal",hompage:"homepage",hampage:"homepage",autohr:"author",autor:"author",contributers:"contributors",publicationConfig:"publishConfig",script:"scripts"},bugs:{web:"url",name:"url"},script:{server:"start",tests:"test"}};function Cr(){if(Lr)return _r;Lr=1;var{URL:e}=o,t=function(){if(Mt)return Ft;Mt=1;const e=Ht();return Ft=(t,r)=>{const n=e(t,r);return n?n.version:null}}(),r=function(){if(Ut)return Gt;Ut=1;const e=Ht();return Gt=(t,r)=>{const n=e(t.trim().replace(/^[=v]+/,""),r);return n?n.version:null}}(),n=cr(),i=Pr(),{isBuiltin:s}=re,a=["dependencies","devDependencies","optionalDependencies"],c=br?vr:(br=1,vr=function(e){if(!e)return;if("ERROR: No README data found!"===e)return;e=e.trim().split("\n");let t=0;for(;e[t]&&e[t].trim().match(/^(#|$)/);)t++;const r=e.length;let n=t+1;for(;n<r&&e[n].trim();)n++;return e.slice(t,n).join(" ").trim()}),l=kr,d=e=>e.includes("@")&&e.indexOf("@")<e.lastIndexOf(".");function u(e,t){return e.author&&(e.author=t(e.author)),["maintainers","contributors"].forEach(function(r){Array.isArray(e[r])&&(e[r]=e[r].map(t))}),e}function p(e){if("string"==typeof e)return e;var t=e.name||"",r=e.url||e.web,n=r?" ("+r+")":"",o=e.email||e.mail;return t+(o?" <"+o+">":"")+n}function h(e){if("string"!=typeof e)return e;var t=e.match(/^([^(<]+)/),r=e.match(/\(([^()]+)\)/),n=e.match(/<([^<>]+)>/),o={};return t&&t[0].trim()&&(o.name=t[0].trim()),n&&(o.email=n[1]),r&&(o.url=r[1]),o}return _r={warn:function(){},fixRepositoryField:function(e){if(e.repositories&&(this.warn("repositories"),e.repository=e.repositories[0]),!e.repository)return this.warn("missingRepository");"string"==typeof e.repository&&(e.repository={type:"git",url:e.repository});var t=e.repository.url||"";if(t){var r=i.fromUrl(t);r&&(t=e.repository.url="shortcut"===r.getDefaultRepresentation()?r.https():r.toString())}t.match(/github.com\/[^/]+\/[^/]+\.git\.git$/)&&this.warn("brokenGitUrl",t)},fixTypos:function(e){Object.keys(l.topLevel).forEach(function(t){Object.prototype.hasOwnProperty.call(e,t)&&this.warn("typo",t,l.topLevel[t])},this)},fixScriptsField:function(e){if(e.scripts)return"object"!=typeof e.scripts?(this.warn("nonObjectScripts"),void delete e.scripts):void Object.keys(e.scripts).forEach(function(t){"string"!=typeof e.scripts[t]?(this.warn("nonStringScript"),delete e.scripts[t]):l.script[t]&&!e.scripts[l.script[t]]&&this.warn("typo",t,l.script[t],"scripts")},this)},fixFilesField:function(e){var t=e.files;t&&!Array.isArray(t)?(this.warn("nonArrayFiles"),delete e.files):e.files&&(e.files=e.files.filter(function(e){return!(!e||"string"!=typeof e)||(this.warn("invalidFilename",e),!1)},this))},fixBinField:function(e){if(e.bin&&"string"==typeof e.bin){var t,r={};(t=e.name.match(/^@[^/]+[/](.*)$/))?r[t[1]]=e.bin:r[e.name]=e.bin,e.bin=r}},fixManField:function(e){e.man&&"string"==typeof e.man&&(e.man=[e.man])},fixBundleDependenciesField:function(e){var t="bundledDependencies",r="bundleDependencies";e[t]&&!e[r]&&(e[r]=e[t],delete e[t]),e[r]&&!Array.isArray(e[r])?(this.warn("nonArrayBundleDependencies"),delete e[r]):e[r]&&(e[r]=e[r].filter(function(t){return t&&"string"==typeof t?(e.dependencies||(e.dependencies={}),Object.prototype.hasOwnProperty.call(e.dependencies,t)||(this.warn("nonDependencyBundleDependency",t),e.dependencies[t]="*"),!0):(this.warn("nonStringBundleDependency",t),!1)},this))},fixDependencies:function(e){!function(e,t){a.forEach(function(r){e[r]&&(e[r]=function(e,t,r){if(!e)return{};"string"==typeof e&&(e=e.trim().split(/[\n\r\s\t ,]+/));if(!Array.isArray(e))return e;r("deprecatedArrayDependencies",t);var n={};return e.filter(function(e){return"string"==typeof e}).forEach(function(e){var t=(e=e.trim().split(/(:?[@\s><=])/)).shift(),r=e.join("");r=(r=r.trim()).replace(/^@/,""),n[t]=r}),n}(e[r],r,t))})}(e,this.warn),function(e){var t=e.optionalDependencies;if(!t)return;var r=e.dependencies||{};Object.keys(t).forEach(function(e){r[e]=t[e]}),e.dependencies=r}(e,this.warn),this.fixBundleDependenciesField(e),["dependencies","devDependencies"].forEach(function(t){if(t in e)return e[t]&&"object"==typeof e[t]?void Object.keys(e[t]).forEach(function(r){var n=e[t][r];"string"!=typeof n&&(this.warn("nonStringDependency",r,JSON.stringify(n)),delete e[t][r]);var o=i.fromUrl(e[t][r]);o&&(e[t][r]=o.toString())},this):(this.warn("nonObjectDependencies",t),void delete e[t])},this)},fixModulesField:function(e){e.modules&&(this.warn("deprecatedModules"),delete e.modules)},fixKeywordsField:function(e){"string"==typeof e.keywords&&(e.keywords=e.keywords.split(/,\s+/)),e.keywords&&!Array.isArray(e.keywords)?(delete e.keywords,this.warn("nonArrayKeywords")):e.keywords&&(e.keywords=e.keywords.filter(function(e){return!("string"!=typeof e||!e)||(this.warn("nonStringKeyword"),!1)},this))},fixVersionField:function(e,n){var o=!n;if(!e.version)return e.version="",!0;if(!t(e.version,o))throw new Error('Invalid version: "'+e.version+'"');return e.version=r(e.version,o),!0},fixPeople:function(e){u(e,p),u(e,h)},fixNameField:function(e,t){"boolean"==typeof t?t={strict:t}:void 0===t&&(t={});var r=t.strict;if(e.name||r){if("string"!=typeof e.name)throw new Error("name field must be a string.");r||(e.name=e.name.trim()),function(e,t,r){if("."===e.charAt(0)||!function(e){if("@"!==e.charAt(0))return!1;var t=e.slice(1).split("/");if(2!==t.length)return!1;return t[0]&&t[1]&&t[0]===encodeURIComponent(t[0])&&t[1]===encodeURIComponent(t[1])}(e)&&(n=e,n.match(/[/@\s+%:]/)||n!==encodeURIComponent(n))||t&&!r&&e!==e.toLowerCase()||"node_modules"===e.toLowerCase()||"favicon.ico"===e.toLowerCase())throw new Error("Invalid name: "+JSON.stringify(e));var n}(e.name,r,t.allowLegacyCase),s(e.name)&&this.warn("conflictingName",e.name)}else e.name=""},fixDescriptionField:function(e){e.description&&"string"!=typeof e.description&&(this.warn("nonStringDescription"),delete e.description),e.readme&&!e.description&&(e.description=c(e.readme)),void 0===e.description&&delete e.description,e.description||this.warn("missingDescription")},fixReadmeField:function(e){e.readme||(this.warn("missingReadme"),e.readme="ERROR: No README data found!")},fixBugsField:function(t){if(!t.bugs&&t.repository&&t.repository.url){var r=i.fromUrl(t.repository.url);r&&r.bugs()&&(t.bugs={url:r.bugs()})}else if(t.bugs){if("string"==typeof t.bugs)d(t.bugs)?t.bugs={email:t.bugs}:e.canParse(t.bugs)?t.bugs={url:t.bugs}:this.warn("nonEmailUrlBugsString");else{!function(e,t){if(!e)return;Object.keys(e).forEach(function(r){l.bugs[r]&&(t("typo",r,l.bugs[r],"bugs"),e[l.bugs[r]]=e[r],delete e[r])})}(t.bugs,this.warn);var n=t.bugs;t.bugs={},n.url&&(e.canParse(n.url)?t.bugs.url=n.url:this.warn("nonUrlBugsUrlField")),n.email&&("string"==typeof n.email&&d(n.email)?t.bugs.email=n.email:this.warn("nonEmailBugsEmailField"))}t.bugs.email||t.bugs.url||(delete t.bugs,this.warn("emptyNormalizedBugs"))}},fixHomepageField:function(t){if(!t.homepage&&t.repository&&t.repository.url){var r=i.fromUrl(t.repository.url);r&&r.docs()&&(t.homepage=r.docs())}if(t.homepage)return"string"!=typeof t.homepage?(this.warn("nonUrlHomepage"),delete t.homepage):void(e.canParse(t.homepage)||(t.homepage="http://"+t.homepage))},fixLicenseField:function(e){const t=e.license||e.licence;return t?"string"!=typeof t||t.length<1||""===t.trim()?this.warn("invalidLicense"):n(t).validForNewPackages?void 0:this.warn("invalidLicense"):this.warn("missingLicense")}},_r}var Nr,Ir,Or,Ar,xr={repositories:"'repositories' (plural) Not supported. Please pick one as the 'repository' field",missingRepository:"No repository field.",brokenGitUrl:"Probably broken git url: %s",nonObjectScripts:"scripts must be an object",nonStringScript:"script values must be string commands",nonArrayFiles:"Invalid 'files' member",invalidFilename:"Invalid filename in 'files' list: %s",nonArrayBundleDependencies:"Invalid 'bundleDependencies' list. Must be array of package names",nonStringBundleDependency:"Invalid bundleDependencies member: %s",nonDependencyBundleDependency:"Non-dependency in bundleDependencies: %s",nonObjectDependencies:"%s field must be an object",nonStringDependency:"Invalid dependency: %s %s",deprecatedArrayDependencies:"specifying %s as array is deprecated",deprecatedModules:"modules field is deprecated",nonArrayKeywords:"keywords should be an array of strings",nonStringKeyword:"keywords should be an array of strings",conflictingName:"%s is also the name of a node core module.",nonStringDescription:"'description' field should be a string",missingDescription:"No description",missingReadme:"No README data",missingLicense:"No license field.",nonEmailUrlBugsString:"Bug string field must be url, email, or {email,url}",nonUrlBugsUrlField:"bugs.url field must be a string url. Deleted.",nonEmailBugsEmailField:"bugs.email field must be a string email. Deleted.",emptyNormalizedBugs:"Normalized value of bugs field is an empty object. Deleted.",nonUrlHomepage:"homepage field must be a string url. Deleted.",invalidLicense:"license should be a valid SPDX license expression",typo:"%s should probably be %s."};function Tr(){if(Ir)return Nr;Ir=1;var e=ne,t=xr;function r(r,n,o){return o&&(r=o+"['"+r+"']",n=o+"['"+n+"']"),e.format(t.typo,r,n)}return Nr=function(){var n=Array.prototype.slice.call(arguments,0),o=n.shift();if("typo"===o)return r.apply(null,n);var i=t[o]?t[o]:o+": '%s'";return n.unshift(i),e.format.apply(null,n)},Nr}!function(){if(Ar)return Or;Ar=1,Or=n;var e=Cr();n.fixer=e;var t=Tr(),r=["name","version","description","repository","modules","scripts","files","bin","man","bugs","keywords","readme","homepage","license"].map(function(e){return o(e)+"Field"});function n(n,i,s){!0===i&&(i=null,s=!0),s||(s=!1),i&&!n.private||(i=function(){}),n.scripts&&"node-gyp rebuild"===n.scripts.install&&!n.scripts.preinstall&&(n.gypfile=!0),e.warn=function(){i(t.apply(null,arguments))},r.forEach(function(t){e["fix"+o(t)](n,s)}),n._id=n.name+"@"+n.version}function o(e){return e.charAt(0).toUpperCase()+e.slice(1)}r=r.concat(["dependencies","people","typos"])}();const Dr=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 d("portal:manifest",{debug:t.debug}),n=await _({log:r,manifest:e});if(t.output){const e=s(process.cwd(),t.output);r?.start("Writing manifest to file",t.output),qe(a(e))||await x(a(e),{recursive:!0}),await T(e,JSON.stringify(n.manifest,null,2)),r?.succeed("Manifest written to file",e)}else console.log(JSON.stringify(n.manifest,null,2))});var jr,Rr={exports:{}},Fr={},Mr={},Gr={},Ur={},Br={},zr={};function Vr(){return jr||(jr=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 n 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 o(e,...t){const r=[e[0]];let o=0;for(;o<t.length;)a(r,t[o]),r.push(e[++o]);return new n(r)}e._Code=n,e.nil=new n(""),e._=o;const i=new n("+");function s(e,...t){const r=[l(e[0])];let o=0;for(;o<t.length;)r.push(i),a(r,t[o]),r.push(i,l(e[++o]));return function(e){let t=1;for(;t<e.length-1;){if(e[t]===i){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 n(r)}function a(e,t){var o;t instanceof n?e.push(...t._items):t instanceof r?e.push(t):e.push("number"==typeof(o=t)||"boolean"==typeof o||null===o?o:l(Array.isArray(o)?o.join(","):o))}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 l(e){return JSON.stringify(e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}e.str=s,e.addCodeArg=a,e.strConcat=function(e,t){return t.emptyStr()?e:e.emptyStr()?t:s`${e}${t}`},e.stringify=function(e){return new n(l(e))},e.safeStringify=l,e.getProperty=function(t){return"string"==typeof t&&e.IDENTIFIER.test(t)?new n(`.${t}`):o`[${t}]`},e.getEsmExportName=function(t){if("string"==typeof t&&e.IDENTIFIER.test(t))return new n(`${t}`);throw new Error(`CodeGen: invalid export name: ${t}, use explicit $id name mapping`)},e.regexpCode=function(e){return new n(e.toString())}}(zr)),zr}var Hr,qr,Wr={};function Kr(){return Hr||(Hr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=Vr();class r extends Error{constructor(e){super(`CodeGen: "code" for ${e} not defined`),this.value=e.value}}var n;!function(e){e[e.Started=0]="Started",e[e.Completed=1]="Completed"}(n||(e.UsedValueState=n={})),e.varKinds={const:new t.Name("const"),let:new t.Name("let"),var:new t.Name("var")};class o{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=o;class i extends t.Name{constructor(e,t){super(t),this.prefix=e}setValue(e,{property:r,itemIndex:n}){this.value=e,this.scopePath=t._`.${new t.Name(r)}[${n}]`}}e.ValueScopeName=i;const s=t._`\n`;e.ValueScope=class extends o{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 i(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 n=this.toName(e),{prefix:o}=n,i=null!==(r=t.key)&&void 0!==r?r:t.ref;let s=this._values[o];if(s){const e=s.get(i);if(e)return e}else s=this._values[o]=new Map;s.set(i,n);const a=this._scope[o]||(this._scope[o]=[]),c=a.length;return a[c]=t.ref,n.setValue(t,{property:o,itemIndex:c}),n}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(o,i,s={},a){let c=t.nil;for(const l in o){const d=o[l];if(!d)continue;const u=s[l]=s[l]||new Map;d.forEach(o=>{if(u.has(o))return;u.set(o,n.Started);let s=i(o);if(s){const r=this.opts.es5?e.varKinds.var:e.varKinds.const;c=t._`${c}${r} ${o} = ${s};${this.opts._n}`}else{if(!(s=null==a?void 0:a(o)))throw new r(o);c=t._`${c}${s}${this.opts._n}`}u.set(o,n.Completed)})}return c}}}(Wr)),Wr}function Yr(){return qr||(qr=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=Vr(),r=Kr();var n=Vr();Object.defineProperty(e,"_",{enumerable:!0,get:function(){return n._}}),Object.defineProperty(e,"str",{enumerable:!0,get:function(){return n.str}}),Object.defineProperty(e,"strConcat",{enumerable:!0,get:function(){return n.strConcat}}),Object.defineProperty(e,"nil",{enumerable:!0,get:function(){return n.nil}}),Object.defineProperty(e,"getProperty",{enumerable:!0,get:function(){return n.getProperty}}),Object.defineProperty(e,"stringify",{enumerable:!0,get:function(){return n.stringify}}),Object.defineProperty(e,"regexpCode",{enumerable:!0,get:function(){return n.regexpCode}}),Object.defineProperty(e,"Name",{enumerable:!0,get:function(){return n.Name}});var o=Kr();Object.defineProperty(e,"Scope",{enumerable:!0,get:function(){return o.Scope}}),Object.defineProperty(e,"ValueScope",{enumerable:!0,get:function(){return o.ValueScope}}),Object.defineProperty(e,"ValueScopeName",{enumerable:!0,get:function(){return o.ValueScopeName}}),Object.defineProperty(e,"varKinds",{enumerable:!0,get:function(){return o.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 i{optimizeNodes(){return this}optimizeNames(e,t){return this}}class s extends i{constructor(e,t,r){super(),this.varKind=e,this.name=t,this.rhs=r}render({es5:e,_n:t}){const n=e?r.varKinds.var:this.varKind,o=void 0===this.rhs?"":` = ${this.rhs}`;return`${n} ${this.name}${o};`+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 a extends i{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 C(this.lhs instanceof t.Name?{}:{...this.lhs.names},this.rhs)}}class c extends a{constructor(e,t,r,n){super(e,r,n),this.op=t}render({_n:e}){return`${this.lhs} ${this.op}= ${this.rhs};`+e}}class l extends i{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`${this.label}:`+e}}class d extends i{constructor(e){super(),this.label=e,this.names={}}render({_n:e}){return`break${this.label?` ${this.label}`:""};`+e}}class u extends i{constructor(e){super(),this.error=e}render({_n:e}){return`throw ${this.error};`+e}get names(){return this.error.names}}class p extends i{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 h extends i{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 n=r.length;for(;n--;){const o=r[n];o.optimizeNames(e,t)||(I(e,o.names),r.splice(n,1))}return r.length>0?this:void 0}get names(){return this.nodes.reduce((e,t)=>k(e,t.names),{})}}class f extends h{render(e){return"{"+e._n+super.render(e)+"}"+e._n}}class m extends h{}class g extends f{}g.kind="else";class y extends f{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(O(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=N(this.condition,e,t),this}get names(){const e=super.names;return C(e,this.condition),this.else&&k(e,this.else.names),e}}y.kind="if";class v extends f{}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=N(this.iteration,e,t),this}get names(){return k(super.names,this.iteration.names)}}class $ extends v{constructor(e,t,r,n){super(),this.varKind=e,this.name=t,this.from=r,this.to=n}render(e){const t=e.es5?r.varKinds.var:this.varKind,{name:n,from:o,to:i}=this;return`for(${t} ${n}=${o}; ${n}<${i}; ${n}++)`+super.render(e)}get names(){const e=C(super.names,this.from);return C(e,this.to)}}class w extends v{constructor(e,t,r,n){super(),this.loop=e,this.varKind=t,this.name=r,this.iterable=n}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 k(super.names,this.iterable.names)}}class E extends f{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)}}E.kind="func";class S extends h{render(e){return"return "+super.render(e)}}S.kind="return";class P extends f{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,n;return super.optimizeNames(e,t),null===(r=this.catch)||void 0===r||r.optimizeNames(e,t),null===(n=this.finally)||void 0===n||n.optimizeNames(e,t),this}get names(){const e=super.names;return this.catch&&k(e,this.catch.names),this.finally&&k(e,this.finally.names),e}}class _ extends f{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}_.kind="catch";class L extends f{render(e){return"finally"+super.render(e)}}L.kind="finally";function k(e,t){for(const r in t)e[r]=(e[r]||0)+(t[r]||0);return e}function C(e,r){return r instanceof t._CodeOrName?k(e,r.names):e}function N(e,r,n){return e instanceof t.Name?i(e):(o=e)instanceof t._Code&&o._items.some(e=>e instanceof t.Name&&1===r[e.str]&&void 0!==n[e.str])?new t._Code(e._items.reduce((e,r)=>(r instanceof t.Name&&(r=i(r)),r instanceof t._Code?e.push(...r._items):e.push(r),e),[])):e;var o;function i(e){const t=n[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 O(e){return"boolean"==typeof e||"number"==typeof e||null===e?!e:t._`!${D(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 m]}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,n){const o=this._scope.toName(t);return void 0!==r&&n&&(this._constants[o.str]=r),this._leafNode(new s(e,o,r)),o}const(e,t,n){return this._def(r.varKinds.const,e,t,n)}let(e,t,n){return this._def(r.varKinds.let,e,t,n)}var(e,t,n){return this._def(r.varKinds.var,e,t,n)}assign(e,t,r){return this._leafNode(new a(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[n,o]of e)r.length>1&&r.push(","),r.push(n),(n!==o||this.opts.es5)&&(r.push(":"),(0,t.addCodeArg)(r,o));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,n,o,i=(this.opts.es5?r.varKinds.var:r.varKinds.let)){const s=this._scope.toName(e);return this._for(new $(i,s,t,n),()=>o(s))}forOf(e,n,o,i=r.varKinds.const){const s=this._scope.toName(e);if(this.opts.es5){const e=n instanceof t.Name?n:this.var("_arr",n);return this.forRange("_i",0,t._`${e}.length`,r=>{this.var(s,t._`${e}[${r}]`),o(s)})}return this._for(new w("of",i,s,n),()=>o(s))}forIn(e,n,o,i=(this.opts.es5?r.varKinds.var:r.varKinds.const)){if(this.opts.ownProperties)return this.forOf(e,t._`Object.keys(${n})`,o);const s=this._scope.toName(e);return this._for(new w("in",i,s,n),()=>o(s))}endFor(){return this._endBlockNode(v)}label(e){return this._leafNode(new l(e))}break(e){return this._leafNode(new d(e))}return(e){const t=new S;if(this._blockNode(t),this.code(e),1!==t.nodes.length)throw new Error('CodeGen: "return" should have one node');return this._endBlockNode(S)}try(e,t,r){if(!t&&!r)throw new Error('CodeGen: "try" without "catch" and "finally"');const n=new P;if(this._blockNode(n),this.code(e),t){const e=this.name("e");this._currNode=n.catch=new _(e),t(e)}return r&&(this._currNode=n.finally=new L,this.code(r)),this._endBlockNode(_,L)}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,n,o){return this._blockNode(new E(e,r,n)),o&&this.code(o).endFunc(),this}endFunc(){return this._endBlockNode(E)}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=O;const A=T(e.operators.AND);e.and=function(...e){return e.reduce(A)};const x=T(e.operators.OR);function T(e){return(r,n)=>r===t.nil?n:n===t.nil?r:t._`${D(r)} ${e} ${D(n)}`}function D(e){return e instanceof t.Name?e:t._`(${e})`}e.or=function(...e){return e.reduce(x)}}(Br)),Br}var Jr,Xr={};function Zr(){if(Jr)return Xr;Jr=1,Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.checkStrictMode=Xr.getErrorPath=Xr.Type=Xr.useFunc=Xr.setEvaluated=Xr.evaluatedPropsToName=Xr.mergeEvaluated=Xr.eachItem=Xr.unescapeJsonPointer=Xr.escapeJsonPointer=Xr.escapeFragment=Xr.unescapeFragment=Xr.schemaRefOrVal=Xr.schemaHasRulesButRef=Xr.schemaHasRules=Xr.checkUnknownRules=Xr.alwaysValidSchema=Xr.toHash=void 0;const e=Yr(),t=Vr();function r(e,t=e.schema){const{opts:r,self:n}=e;if(!r.strictSchema)return;if("boolean"==typeof t)return;const o=n.RULES.keywords;for(const r in t)o[r]||u(e,`unknown keyword: "${r}"`)}function n(e,t){if("boolean"==typeof e)return!e;for(const r in e)if(t[r])return!0;return!1}function o(e){return"number"==typeof e?`${e}`:e.replace(/~/g,"~0").replace(/\//g,"~1")}function i(e){return e.replace(/~1/g,"/").replace(/~0/g,"~")}function s({mergeNames:t,mergeToName:r,mergeValues:n,resultToName:o}){return(i,s,a,c)=>{const l=void 0===a?s:a instanceof e.Name?(s instanceof e.Name?t(i,s,a):r(i,s,a),a):s instanceof e.Name?(r(i,a,s),s):n(s,a);return c!==e.Name||l instanceof e.Name?l:o(i,l)}}function a(t,r){if(!0===r)return t.var("props",!0);const n=t.var("props",e._`{}`);return void 0!==r&&c(t,n,r),n}function c(t,r,n){Object.keys(n).forEach(n=>t.assign(e._`${r}${(0,e.getProperty)(n)}`,!0))}Xr.toHash=function(e){const t={};for(const r of e)t[r]=!0;return t},Xr.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(r(e,t),!n(t,e.self.RULES.all))},Xr.checkUnknownRules=r,Xr.schemaHasRules=n,Xr.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},Xr.schemaRefOrVal=function({topSchemaRef:t,schemaPath:r},n,o,i){if(!i){if("number"==typeof n||"boolean"==typeof n)return n;if("string"==typeof n)return e._`${n}`}return e._`${t}${r}${(0,e.getProperty)(o)}`},Xr.unescapeFragment=function(e){return i(decodeURIComponent(e))},Xr.escapeFragment=function(e){return encodeURIComponent(o(e))},Xr.escapeJsonPointer=o,Xr.unescapeJsonPointer=i,Xr.eachItem=function(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)},Xr.mergeEvaluated={props:s({mergeNames:(t,r,n)=>t.if(e._`${n} !== true && ${r} !== undefined`,()=>{t.if(e._`${r} === true`,()=>t.assign(n,!0),()=>t.assign(n,e._`${n} || {}`).code(e._`Object.assign(${n}, ${r})`))}),mergeToName:(t,r,n)=>t.if(e._`${n} !== true`,()=>{!0===r?t.assign(n,!0):(t.assign(n,e._`${n} || {}`),c(t,n,r))}),mergeValues:(e,t)=>!0===e||{...e,...t},resultToName:a}),items:s({mergeNames:(t,r,n)=>t.if(e._`${n} !== true && ${r} !== undefined`,()=>t.assign(n,e._`${r} === true ? true : ${n} > ${r} ? ${n} : ${r}`)),mergeToName:(t,r,n)=>t.if(e._`${n} !== true`,()=>t.assign(n,!0===r||e._`${n} > ${r} ? ${n} : ${r}`)),mergeValues:(e,t)=>!0===e||Math.max(e,t),resultToName:(e,t)=>e.var("items",t)})},Xr.evaluatedPropsToName=a,Xr.setEvaluated=c;const l={};var d;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 Xr.useFunc=function(e,r){return e.scopeValue("func",{ref:r,code:l[r.code]||(l[r.code]=new t._Code(r.code))})},function(e){e[e.Num=0]="Num",e[e.Str=1]="Str"}(d||(Xr.Type=d={})),Xr.getErrorPath=function(t,r,n){if(t instanceof e.Name){const o=r===d.Num;return n?o?e._`"[" + ${t} + "]"`:e._`"['" + ${t} + "']"`:o?e._`"/" + ${t}`:e._`"/" + ${t}.replace(/~/g, "~0").replace(/\\//g, "~1")`}return n?(0,e.getProperty)(t).toString():"/"+o(t)},Xr.checkStrictMode=u,Xr}var Qr,en,tn,rn={};function nn(){if(Qr)return rn;Qr=1,Object.defineProperty(rn,"__esModule",{value:!0});const e=Yr(),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 rn.default=t,rn}function on(){return en||(en=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=Yr(),r=Zr(),n=nn();function o(e,r){const o=e.const("err",r);e.if(t._`${n.default.vErrors} === null`,()=>e.assign(n.default.vErrors,t._`[${o}]`),t._`${n.default.vErrors}.push(${o})`),e.code(t._`${n.default.errors}++`)}function i(e,r){const{gen:n,validateName:o,schemaEnv:i}=e;i.$async?n.throw(t._`new ${e.ValidationError}(${r})`):(n.assign(t._`${o}.errors`,r),n.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,n=e.keywordError,s,c){const{it:l}=r,{gen:d,compositeRule:u,allErrors:p}=l,h=a(r,n,s);(null!=c?c:u||p)?o(d,h):i(l,t._`[${h}]`)},e.reportExtraError=function(t,r=e.keywordError,s){const{it:c}=t,{gen:l,compositeRule:d,allErrors:u}=c;o(l,a(t,r,s)),d||u||i(c,n.default.vErrors)},e.resetErrorsCount=function(e,r){e.assign(n.default.errors,r),e.if(t._`${n.default.vErrors} !== null`,()=>e.if(r,()=>e.assign(t._`${n.default.vErrors}.length`,r),()=>e.assign(n.default.vErrors,null)))},e.extendErrors=function({gen:e,keyword:r,schemaValue:o,data:i,errsCount:s,it:a}){if(void 0===s)throw new Error("ajv implementation error");const c=e.name("err");e.forRange("i",s,n.default.errors,s=>{e.const(c,t._`${n.default.vErrors}[${s}]`),e.if(t._`${c}.instancePath === undefined`,()=>e.assign(t._`${c}.instancePath`,(0,t.strConcat)(n.default.instancePath,a.errorPath))),e.assign(t._`${c}.schemaPath`,t.str`${a.errSchemaPath}/${r}`),a.opts.verbose&&(e.assign(t._`${c}.schema`,o),e.assign(t._`${c}.data`,i))})};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 a(e,r,o){const{createErrors:i}=e.it;return!1===i?t._`{}`:function(e,r,o={}){const{gen:i,it:a}=e,d=[c(a,o),l(e,o)];return function(e,{params:r,message:o},i){const{keyword:a,data:c,schemaValue:l,it:d}=e,{opts:u,propertyName:p,topSchemaRef:h,schemaPath:f}=d;i.push([s.keyword,a],[s.params,"function"==typeof r?r(e):r||t._`{}`]),u.messages&&i.push([s.message,"function"==typeof o?o(e):o]);u.verbose&&i.push([s.schema,l],[s.parentSchema,t._`${h}${f}`],[n.default.data,c]);p&&i.push([s.propertyName,p])}(e,r,d),i.object(...d)}(e,r,o)}function c({errorPath:e},{instancePath:o}){const i=o?t.str`${e}${(0,r.getErrorPath)(o,r.Type.Str)}`:e;return[n.default.instancePath,(0,t.strConcat)(n.default.instancePath,i)]}function l({keyword:e,it:{errSchemaPath:n}},{schemaPath:o,parentSchema:i}){let a=i?n:t.str`${n}/${e}`;return o&&(a=t.str`${a}${(0,r.getErrorPath)(o,r.Type.Str)}`),[s.schemaPath,a]}}(Ur)),Ur}var sn,an={},cn={};function ln(){if(sn)return cn;sn=1,Object.defineProperty(cn,"__esModule",{value:!0}),cn.getRules=cn.isJSONType=void 0;const e=new Set(["string","number","integer","boolean","null","object","array"]);return cn.isJSONType=function(t){return"string"==typeof t&&e.has(t)},cn.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:{}}},cn}var dn,un,pn={};function hn(){if(dn)return pn;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 dn=1,Object.defineProperty(pn,"__esModule",{value:!0}),pn.shouldUseRule=pn.shouldUseGroup=pn.schemaHasRulesForType=void 0,pn.schemaHasRulesForType=function({schema:t,self:r},n){const o=r.RULES.types[n];return o&&!0!==o&&e(t,o)},pn.shouldUseGroup=e,pn.shouldUseRule=t,pn}function fn(){if(un)return an;un=1,Object.defineProperty(an,"__esModule",{value:!0}),an.reportTypeError=an.checkDataTypes=an.checkDataType=an.coerceAndCheckDataType=an.getJSONTypes=an.getSchemaTypes=an.DataType=void 0;const e=ln(),t=hn(),r=on(),n=Yr(),o=Zr();var i;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"}(i||(an.DataType=i={})),an.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},an.getJSONTypes=s,an.coerceAndCheckDataType=function(e,r){const{gen:o,data:s,opts:c}=e,d=function(e,t){return t?e.filter(e=>a.has(e)||"array"===t&&"array"===e):[]}(r,c.coerceTypes),p=r.length>0&&!(0===d.length&&1===r.length&&(0,t.schemaHasRulesForType)(e,r[0]));if(p){const t=l(r,s,c.strictNumbers,i.Wrong);o.if(t,()=>{d.length?function(e,t,r){const{gen:o,data:i,opts:s}=e,c=o.let("dataType",n._`typeof ${i}`),d=o.let("coerced",n._`undefined`);"array"===s.coerceTypes&&o.if(n._`${c} == 'object' && Array.isArray(${i}) && ${i}.length == 1`,()=>o.assign(i,n._`${i}[0]`).assign(c,n._`typeof ${i}`).if(l(t,i,s.strictNumbers),()=>o.assign(d,i)));o.if(n._`${d} !== undefined`);for(const e of r)(a.has(e)||"array"===e&&"array"===s.coerceTypes)&&p(e);function p(e){switch(e){case"string":return void o.elseIf(n._`${c} == "number" || ${c} == "boolean"`).assign(d,n._`"" + ${i}`).elseIf(n._`${i} === null`).assign(d,n._`""`);case"number":return void o.elseIf(n._`${c} == "boolean" || ${i} === null
|
|
2
2
|
|| (${c} == "string" && ${i} && ${i} == +${i})`).assign(d,n._`+${i}`);case"integer":return void o.elseIf(n._`${c} === "boolean" || ${i} === null
|
|
3
3
|
|| (${c} === "string" && ${i} && ${i} == +${i} && !(${i} % 1))`).assign(d,n._`+${i}`);case"boolean":return void o.elseIf(n._`${i} === "false" || ${i} === 0 || ${i} === null`).assign(d,!1).elseIf(n._`${i} === "true" || ${i} === 1`).assign(d,!0);case"null":return o.elseIf(n._`${i} === "" || ${i} === 0 || ${i} === false`),void o.assign(d,null);case"array":o.elseIf(n._`${c} === "string" || ${c} === "number"
|
|
4
|
-
|| ${c} === "boolean" || ${i} === null`).assign(d,n._`[${i}]`)}}o.else(),u(e),o.endIf(),o.if(n._`${d} !== undefined`,()=>{o.assign(i,d),function({gen:e,parentData:t,parentDataProperty:r},o){e.if(n._`${t} !== undefined`,()=>e.assign(n._`${t}[${r}]`,o))}(e,d)})}(e,r,d):u(e)})}return p};const a=new Set(["string","number","integer","boolean","null"]);function c(e,t,r,o=i.Correct){const s=o===i.Correct?n.operators.EQ:n.operators.NEQ;let a;switch(e){case"null":return n._`${t} ${s} null`;case"array":a=n._`Array.isArray(${t})`;break;case"object":a=n._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":a=c(n._`!(${t} % 1) && !isNaN(${t})`);break;case"number":a=c();break;default:return n._`typeof ${t} ${s} ${e}`}return o===i.Correct?a:(0,n.not)(a);function c(e=n.nil){return(0,n.and)(n._`typeof ${t} == "number"`,e,r?n._`isFinite(${t})`:n.nil)}}function l(e,t,r,i){if(1===e.length)return c(e[0],t,r,i);let s;const a=(0,o.toHash)(e);if(a.array&&a.object){const e=n._`typeof ${t} != "object"`;s=a.null?e:n._`!${t} || ${e}`,delete a.null,delete a.array,delete a.object}else s=n.nil;a.number&&delete a.integer;for(const e in a)s=(0,n.and)(s,c(e,t,r,i));return s}an.checkDataType=c,an.checkDataTypes=l;const d={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?n._`{type: ${e}}`:n._`{type: ${t}}`};function u(e){const t=function(e){const{gen:t,data:r,schema:n}=e,i=(0,o.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:e}}(e);(0,r.reportError)(t,d)}return an.reportTypeError=u,an}var mn,gn={};var yn,vn,bn={},$n={};function wn(){if(yn)return $n;yn=1,Object.defineProperty($n,"__esModule",{value:!0}),$n.validateUnion=$n.validateArray=$n.usePattern=$n.callValidateCode=$n.schemaProperties=$n.allSchemaProperties=$n.noPropertyInData=$n.propertyInData=$n.isOwnProperty=$n.hasPropFunc=$n.reportMissingProp=$n.checkMissingProp=$n.checkReportMissingProp=void 0;const e=Yr(),t=Zr(),r=nn(),n=Zr();function o(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:e._`Object.prototype.hasOwnProperty`})}function i(t,r,n){return e._`${o(t)}.call(${r}, ${n})`}function s(t,r,n,o){const s=e._`${r}${(0,e.getProperty)(n)} === undefined`;return o?(0,e.or)(s,(0,e.not)(i(t,r,n))):s}function a(e){return e?Object.keys(e).filter(e=>"__proto__"!==e):[]}$n.checkReportMissingProp=function(t,r){const{gen:n,data:o,it:i}=t;n.if(s(n,o,r,i.opts.ownProperties),()=>{t.setParams({missingProperty:e._`${r}`},!0),t.error()})},$n.checkMissingProp=function({gen:t,data:r,it:{opts:n}},o,i){return(0,e.or)(...o.map(o=>(0,e.and)(s(t,r,o,n.ownProperties),e._`${i} = ${o}`)))},$n.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},$n.hasPropFunc=o,$n.isOwnProperty=i,$n.propertyInData=function(t,r,n,o){const s=e._`${r}${(0,e.getProperty)(n)} !== undefined`;return o?e._`${s} && ${i(t,r,n)}`:s},$n.noPropertyInData=s,$n.allSchemaProperties=a,$n.schemaProperties=function(e,r){return a(r).filter(n=>!(0,t.alwaysValidSchema)(e,r[n]))},$n.callValidateCode=function({schemaCode:t,data:n,it:{gen:o,topSchemaRef:i,schemaPath:s,errorPath:a},it:c},l,d,u){const p=u?e._`${t}, ${n}, ${i}${s}`:n,h=[[r.default.instancePath,(0,e.strConcat)(r.default.instancePath,a)],[r.default.parentData,c.parentData],[r.default.parentDataProperty,c.parentDataProperty],[r.default.rootData,r.default.rootData]];c.opts.dynamicRef&&h.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);const f=e._`${p}, ${o.object(...h)}`;return d!==e.nil?e._`${l}.call(${d}, ${f})`:e._`${l}(${f})`};const c=e._`new RegExp`;return $n.usePattern=function({gen:t,it:{opts:r}},o){const i=r.unicodeRegExp?"u":"",{regExp:s}=r.code,a=s(o,i);return t.scopeValue("pattern",{key:a.toString(),ref:a,code:e._`${"new RegExp"===s.code?c:(0,n.useFunc)(t,s)}(${o}, ${i})`})},$n.validateArray=function(r){const{gen:n,data:o,keyword:i,it:s}=r,a=n.name("valid");if(s.allErrors){const e=n.let("valid",!0);return c(()=>n.assign(e,!1)),e}return n.var(a,!0),c(()=>n.break()),a;function c(s){const c=n.const("len",e._`${o}.length`);n.forRange("i",0,c,o=>{r.subschema({keyword:i,dataProp:o,dataPropType:t.Type.Num},a),n.if((0,e.not)(a),s)})}},$n.validateUnion=function(r){const{gen:n,schema:o,keyword:i,it:s}=r;if(!Array.isArray(o))throw new Error("ajv implementation error");if(o.some(e=>(0,t.alwaysValidSchema)(s,e))&&!s.opts.unevaluated)return;const a=n.let("valid",!1),c=n.name("_valid");n.block(()=>o.forEach((t,o)=>{const s=r.subschema({keyword:i,schemaProp:o,compositeRule:!0},c);n.assign(a,e._`${a} || ${c}`);r.mergeValidEvaluated(s,c)||n.if((0,e.not)(a))})),r.result(a,()=>r.reset(),()=>r.error(!0))},$n}function En(){if(vn)return bn;vn=1,Object.defineProperty(bn,"__esModule",{value:!0}),bn.validateKeywordUsage=bn.validSchemaType=bn.funcKeywordCode=bn.macroKeywordCode=void 0;const e=Yr(),t=nn(),r=wn(),n=on();function o(t){const{gen:r,data:n,it:o}=t;r.if(o.parentData,()=>r.assign(n,e._`${o.parentData}[${o.parentDataProperty}]`))}function i(t,r,n){if(void 0===n)throw new Error(`keyword "${r}" failed to compile`);return t.scopeValue("keyword","function"==typeof n?{ref:n}:{ref:n,code:(0,e.stringify)(n)})}return bn.macroKeywordCode=function(t,r){const{gen:n,keyword:o,schema:s,parentSchema:a,it:c}=t,l=r.macro.call(c.self,s,a,c),d=i(n,o,l);!1!==c.opts.validateSchema&&c.self.validateSchema(l,!0);const u=n.name("valid");t.subschema({schema:l,schemaPath:e.nil,errSchemaPath:`${c.errSchemaPath}/${o}`,topSchemaRef:d,compositeRule:!0},u),t.pass(u,()=>t.error(!0))},bn.funcKeywordCode=function(s,a){var c;const{gen:l,keyword:d,schema:u,parentSchema:p,$data:h,it:f}=s;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(f,a);const m=!h&&a.compile?a.compile.call(f.self,u,p,f):a.validate,g=i(l,d,m),y=l.let("valid");function v(n=(a.async?e._`await `:e.nil)){const o=f.opts.passContext?t.default.this:t.default.self,i=!("compile"in a&&!h||!1===a.schema);l.assign(y,e._`${n}${(0,r.callValidateCode)(s,g,o,i)}`,a.modifying)}function b(t){var r;l.if((0,e.not)(null!==(r=a.valid)&&void 0!==r?r:y),t)}s.block$data(y,function(){if(!1===a.errors)v(),a.modifying&&o(s),b(()=>s.error());else{const r=a.async?function(){const t=l.let("ruleErrs",null);return l.try(()=>v(e._`await `),r=>l.assign(y,!1).if(e._`${r} instanceof ${f.ValidationError}`,()=>l.assign(t,e._`${r}.errors`),()=>l.throw(r))),t}():function(){const t=e._`${g}.errors`;return l.assign(t,null),v(e.nil),t}();a.modifying&&o(s),b(()=>function(r,o){const{gen:i}=r;i.if(e._`Array.isArray(${o})`,()=>{i.assign(t.default.vErrors,e._`${t.default.vErrors} === null ? ${o} : ${t.default.vErrors}.concat(${o})`).assign(t.default.errors,e._`${t.default.vErrors}.length`),(0,n.extendErrors)(r)},()=>r.error())}(s,r))}}),s.ok(null!==(c=a.valid)&&void 0!==c?c:y)},bn.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)},bn.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");const s=o.dependencies;if(null==s?void 0:s.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw new Error(`parent schema must have dependencies of ${i}: ${s.join(",")}`);if(o.validateSchema){if(!o.validateSchema(e[i])){const e=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);r.logger.error(e)}}},bn}var Sn,Pn={};var _n,Ln,Cn={};function kn(){return Ln||(Ln=1,_n=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 n,o,i;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(o=n;0!==o--;)if(!e(t[o],r[o]))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((n=(i=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(o=n;0!==o--;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;0!==o--;){var s=i[o];if(!e(t[s],r[s]))return!1}return!0}return t!=t&&r!=r}),_n}var Nn,In,On,An={exports:{}};function Tn(){if(Nn)return An.exports;Nn=1;var e=An.exports=function(e,r,n){"function"==typeof r&&(n=r,r={}),t(r,"function"==typeof(n=r.cb||n)?n:n.pre||function(){},n.post||function(){},e,"",e)};function t(n,o,i,s,a,c,l,d,u,p){if(s&&"object"==typeof s&&!Array.isArray(s)){for(var h in o(s,a,c,l,d,u,p),s){var f=s[h];if(Array.isArray(f)){if(h in e.arrayKeywords)for(var m=0;m<f.length;m++)t(n,o,i,f[m],a+"/"+h+"/"+m,c,a,h,s,m)}else if(h in e.propsKeywords){if(f&&"object"==typeof f)for(var g in f)t(n,o,i,f[g],a+"/"+h+"/"+r(g),c,a,h,s,g)}else(h in e.keywords||n.allKeys&&!(h in e.skipKeywords))&&t(n,o,i,f,a+"/"+h,c,a,h,s)}i(s,a,c,l,d,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},An.exports}function xn(){if(In)return Cn;In=1,Object.defineProperty(Cn,"__esModule",{value:!0}),Cn.getSchemaRefs=Cn.resolveUrl=Cn.normalizeId=Cn._getFullPath=Cn.getFullPath=Cn.inlineRef=void 0;const e=Zr(),t=kn(),r=Tn(),n=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);Cn.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!i(e):!!t&&s(e)<=t)};const o=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function i(e){for(const t in e){if(o.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some(i))return!0;if("object"==typeof r&&i(r))return!0}return!1}function s(t){let r=0;for(const o in t){if("$ref"===o)return 1/0;if(r++,!n.has(o)&&("object"==typeof t[o]&&(0,e.eachItem)(t[o],e=>r+=s(e)),r===1/0))return 1/0}return r}function a(e,t="",r){!1!==r&&(t=d(t));const n=e.parse(t);return c(e,n)}function c(e,t){return e.serialize(t).split("#")[0]+"#"}Cn.getFullPath=a,Cn._getFullPath=c;const l=/#\/?$/;function d(e){return e?e.replace(l,""):""}Cn.normalizeId=d,Cn.resolveUrl=function(e,t,r){return r=d(r),e.resolve(t,r)};const u=/^[a-z_][-a-z0-9._]*$/i;return Cn.getSchemaRefs=function(e,n){if("boolean"==typeof e)return{};const{schemaId:o,uriResolver:i}=this.opts,s=d(e[o]||n),c={"":s},l=a(i,s,!1),p={},h=new Set;return r(e,{allKeys:!0},(e,t,r,n)=>{if(void 0===n)return;const i=l+t;let s=c[n];function a(t){const r=this.opts.uriResolver.resolve;if(t=d(s?r(s,t):t),h.has(t))throw m(t);h.add(t);let n=this.refs[t];return"string"==typeof n&&(n=this.refs[n]),"object"==typeof n?f(e,n.schema,t):t!==d(i)&&("#"===t[0]?(f(e,p[t],t),p[t]=e):this.refs[t]=i),t}function g(e){if("string"==typeof e){if(!u.test(e))throw new Error(`invalid anchor "${e}"`);a.call(this,`#${e}`)}}"string"==typeof e[o]&&(s=a.call(this,e[o])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),c[t]=s}),p;function f(e,r,n){if(void 0!==r&&!t(e,r))throw m(n)}function m(e){return new Error(`reference "${e}" resolves to more than one schema`)}},Cn}function Dn(){if(On)return Mr;On=1,Object.defineProperty(Mr,"__esModule",{value:!0}),Mr.getData=Mr.KeywordCxt=Mr.validateFunctionCode=void 0;const e=function(){if(tn)return Gr;tn=1,Object.defineProperty(Gr,"__esModule",{value:!0}),Gr.boolOrEmptySchema=Gr.topBoolOrEmptySchema=void 0;const e=on(),t=Yr(),r=nn(),n={message:"boolean schema is false"};function o(t,r){const{gen:o,data:i}=t,s={gen:o,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,e.reportError)(s,n,void 0,r)}return Gr.topBoolOrEmptySchema=function(e){const{gen:n,schema:i,validateName:s}=e;!1===i?o(e,!1):"object"==typeof i&&!0===i.$async?n.return(r.default.data):(n.assign(t._`${s}.errors`,null),n.return(!0))},Gr.boolOrEmptySchema=function(e,t){const{gen:r,schema:n}=e;!1===n?(r.var(t,!1),o(e)):r.var(t,!0)},Gr}(),t=fn(),r=hn(),n=fn(),o=function(){if(mn)return gn;mn=1,Object.defineProperty(gn,"__esModule",{value:!0}),gn.assignDefaults=void 0;const e=Yr(),t=Zr();function r(r,n,o){const{gen:i,compositeRule:s,data:a,opts:c}=r;if(void 0===o)return;const l=e._`${a}${(0,e.getProperty)(n)}`;if(s)return void(0,t.checkStrictMode)(r,`default is ignored for: ${l}`);let d=e._`${l} === undefined`;"empty"===c.useDefaults&&(d=e._`${d} || ${l} === null || ${l} === ""`),i.if(d,e._`${l} = ${(0,e.stringify)(o)}`)}return gn.assignDefaults=function(e,t){const{properties:n,items:o}=e.schema;if("object"===t&&n)for(const t in n)r(e,t,n[t].default);else"array"===t&&Array.isArray(o)&&o.forEach((t,n)=>r(e,n,t.default))},gn}(),i=En(),s=function(){if(Sn)return Pn;Sn=1,Object.defineProperty(Pn,"__esModule",{value:!0}),Pn.extendSubschemaMode=Pn.extendSubschemaData=Pn.getSubschema=void 0;const e=Yr(),t=Zr();return Pn.getSubschema=function(r,{keyword:n,schemaProp:o,schema:i,schemaPath:s,errSchemaPath:a,topSchemaRef:c}){if(void 0!==n&&void 0!==i)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==n){const i=r.schema[n];return void 0===o?{schema:i,schemaPath:e._`${r.schemaPath}${(0,e.getProperty)(n)}`,errSchemaPath:`${r.errSchemaPath}/${n}`}:{schema:i[o],schemaPath:e._`${r.schemaPath}${(0,e.getProperty)(n)}${(0,e.getProperty)(o)}`,errSchemaPath:`${r.errSchemaPath}/${n}/${(0,t.escapeFragment)(o)}`}}if(void 0!==i){if(void 0===s||void 0===a||void 0===c)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:i,schemaPath:s,topSchemaRef:c,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')},Pn.extendSubschemaData=function(r,n,{dataProp:o,dataPropType:i,data:s,dataTypes:a,propertyName:c}){if(void 0!==s&&void 0!==o)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:l}=n;if(void 0!==o){const{errorPath:s,dataPathArr:a,opts:c}=n;d(l.let("data",e._`${n.data}${(0,e.getProperty)(o)}`,!0)),r.errorPath=e.str`${s}${(0,t.getErrorPath)(o,i,c.jsPropertySyntax)}`,r.parentDataProperty=e._`${o}`,r.dataPathArr=[...a,r.parentDataProperty]}function d(e){r.data=e,r.dataLevel=n.dataLevel+1,r.dataTypes=[],n.definedProperties=new Set,r.parentData=n.data,r.dataNames=[...n.dataNames,e]}void 0!==s&&(d(s instanceof e.Name?s:l.let("data",s,!0)),void 0!==c&&(r.propertyName=c)),a&&(r.dataTypes=a)},Pn.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){void 0!==n&&(e.compositeRule=n),void 0!==o&&(e.createErrors=o),void 0!==i&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=r},Pn}(),a=Yr(),c=nn(),l=xn(),d=Zr(),u=on();function p({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},i){o.code.es5?e.func(t,a._`${c.default.data}, ${c.default.valCxt}`,n.$async,()=>{e.code(a._`"use strict"; ${h(r,o)}`),function(e,t){e.if(c.default.valCxt,()=>{e.var(c.default.instancePath,a._`${c.default.valCxt}.${c.default.instancePath}`),e.var(c.default.parentData,a._`${c.default.valCxt}.${c.default.parentData}`),e.var(c.default.parentDataProperty,a._`${c.default.valCxt}.${c.default.parentDataProperty}`),e.var(c.default.rootData,a._`${c.default.valCxt}.${c.default.rootData}`),t.dynamicRef&&e.var(c.default.dynamicAnchors,a._`${c.default.valCxt}.${c.default.dynamicAnchors}`)},()=>{e.var(c.default.instancePath,a._`""`),e.var(c.default.parentData,a._`undefined`),e.var(c.default.parentDataProperty,a._`undefined`),e.var(c.default.rootData,c.default.data),t.dynamicRef&&e.var(c.default.dynamicAnchors,a._`{}`)})}(e,o),e.code(i)}):e.func(t,a._`${c.default.data}, ${function(e){return a._`{${c.default.instancePath}="", ${c.default.parentData}, ${c.default.parentDataProperty}, ${c.default.rootData}=${c.default.data}${e.dynamicRef?a._`, ${c.default.dynamicAnchors}={}`:a.nil}}={}`}(o)}`,n.$async,()=>e.code(h(r,o)).code(i))}function h(e,t){const r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?a._`/*# sourceURL=${r} */`:a.nil}function f(t,r){g(t)&&(y(t),m(t))?function(e,t){const{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&b(e);(function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,l.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 i=n.const("_errs",c.default.errors);v(e,i),n.var(t,a._`${i} === ${c.default.errors}`)}(t,r):(0,e.boolOrEmptySchema)(t,r)}function m({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,d.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function v(e,r){if(e.opts.jtd)return $(e,[],!1,r);const n=(0,t.getSchemaTypes)(e.schema);$(e,n,!(0,t.coerceAndCheckDataType)(e,n),r)}function b({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){const i=r.$comment;if(!0===o.$comment)e.code(a._`${c.default.self}.logger.log(${i})`);else if("function"==typeof o.$comment){const r=a.str`${n}/$comment`,o=e.scopeValue("root",{ref:t.root});e.code(a._`${c.default.self}.opts.$comment(${i}, ${r}, ${o}.schema)`)}}function $(e,t,o,i){const{gen:s,schema:l,data:u,allErrors:p,opts:h,self:f}=e,{RULES:m}=f;function g(d){(0,r.shouldUseGroup)(l,d)&&(d.type?(s.if((0,n.checkDataType)(d.type,u,h.strictNumbers)),w(e,d),1===t.length&&t[0]===d.type&&o&&(s.else(),(0,n.reportTypeError)(e)),s.endIf()):w(e,d),p||s.if(a._`${c.default.errors} === ${i||0}`))}!l.$ref||!h.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(l,m)?(h.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=>{S(e.dataTypes,t)||P(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),function(e,t){const r=[];for(const n of e.dataTypes)S(t,n)?r.push(n):t.includes("integer")&&"number"===n&&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 n=e.self.RULES.all;for(const o in n){const i=n[o];if("object"==typeof i&&(0,r.shouldUseRule)(e.schema,i)){const{type:r}=i.definition;r.length&&!r.some(e=>E(t,e))&&P(e,`missing type "${r.join(",")}" for keyword "${o}"`)}}}(e,e.dataTypes)}(e,t),s.block(()=>{for(const e of m.rules)g(e);g(m.post)})):s.block(()=>L(e,"$ref",m.all.$ref.definition))}function w(e,t){const{gen:n,schema:i,opts:{useDefaults:s}}=e;s&&(0,o.assignDefaults)(e,t.type),n.block(()=>{for(const n of t.rules)(0,r.shouldUseRule)(i,n)&&L(e,n.keyword,n.definition,t.type)})}function E(e,t){return e.includes(t)||"number"===t&&e.includes("integer")}function S(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function P(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}Mr.validateFunctionCode=function(t){g(t)&&(y(t),m(t))?function(e){const{schema:t,opts:r,gen:n}=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,d.checkStrictMode)(e,"default is ignored in the schema root")}(e),n.let(c.default.vErrors,null),n.let(c.default.errors,0),r.unevaluated&&function(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",a._`${r}.evaluated`),t.if(a._`${e.evaluated}.dynamicProps`,()=>t.assign(a._`${e.evaluated}.props`,a._`undefined`)),t.if(a._`${e.evaluated}.dynamicItems`,()=>t.assign(a._`${e.evaluated}.items`,a._`undefined`))}(e),v(e),function(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=e;r.$async?t.if(a._`${c.default.errors} === 0`,()=>t.return(c.default.data),()=>t.throw(a._`new ${o}(${c.default.vErrors})`)):(t.assign(a._`${n}.errors`,c.default.vErrors),i.unevaluated&&function({gen:e,evaluated:t,props:r,items:n}){r instanceof a.Name&&e.assign(a._`${t}.props`,r);n instanceof a.Name&&e.assign(a._`${t}.items`,n)}(e),t.return(a._`${c.default.errors} === 0`))}(e)})}(t):p(t,()=>(0,e.topBoolOrEmptySchema)(t))};class _{constructor(e,t,r){if((0,i.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,d.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,i.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,a.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,a.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(a._`${t} !== undefined && (${(0,a.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=a.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=a.nil,t=a.nil){if(!this.$data)return;const{gen:r,schemaCode:n,schemaType:o,def:i}=this;r.if((0,a.or)(a._`${n} === undefined`,t)),e!==a.nil&&r.assign(e,!0),(o.length||i.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==a.nil&&r.assign(e,!1)),r.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:r,def:o,it:i}=this;return(0,a.or)(function(){if(r.length){if(!(t instanceof a.Name))throw new Error("ajv implementation error");const e=Array.isArray(r)?r:[r];return a._`${(0,n.checkDataTypes)(e,t,i.opts.strictNumbers,n.DataType.Wrong)}`}return a.nil}(),function(){if(o.validateSchema){const r=e.scopeValue("validate$data",{ref:o.validateSchema});return a._`!${r}(${t})`}return a.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 n={...this.it,...r,items:void 0,props:void 0};return f(n,t),n}mergeEvaluated(e,t){const{it:r,gen:n}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=d.mergeEvaluated.props(n,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=d.mergeEvaluated.items(n,e.items,r.items,t)))}mergeValidEvaluated(e,t){const{it:r,gen:n}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return n.if(t,()=>this.mergeEvaluated(e,a.Name)),!0}}function L(e,t,r,n){const o=new _(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,i.funcKeywordCode)(o,r):"macro"in r?(0,i.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,i.funcKeywordCode)(o,r)}Mr.KeywordCxt=_;const C=/^\/(?:[^~]|~0|~1)*$/,k=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function N(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,i;if(""===e)return c.default.rootData;if("/"===e[0]){if(!C.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,i=c.default.rootData}else{const s=k.exec(e);if(!s)throw new Error(`Invalid JSON-pointer: ${e}`);const a=+s[1];if(o=s[2],"#"===o){if(a>=t)throw new Error(u("property/index",a));return n[t-a]}if(a>t)throw new Error(u("data",a));if(i=r[t-a],!o)return i}let s=i;const l=o.split("/");for(const e of l)e&&(i=a._`${i}${(0,a.getProperty)((0,d.unescapeJsonPointer)(e))}`,s=a._`${s} && ${i}`);return s;function u(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}return Mr.getData=N,Mr}var jn,Rn={};function Fn(){if(jn)return Rn;jn=1,Object.defineProperty(Rn,"__esModule",{value:!0});class e extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}return Rn.default=e,Rn}var Mn,Gn={};function Un(){if(Mn)return Gn;Mn=1,Object.defineProperty(Gn,"__esModule",{value:!0});const e=xn();class t extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,e.resolveUrl)(t,r,n),this.missingSchema=(0,e.normalizeId)((0,e.getFullPath)(t,this.missingRef))}}return Gn.default=t,Gn}var Bn,zn={};function Vn(){if(Bn)return zn;Bn=1,Object.defineProperty(zn,"__esModule",{value:!0}),zn.resolveSchema=zn.getCompilingSchema=zn.resolveRef=zn.compileSchema=zn.SchemaEnv=void 0;const e=Yr(),t=Fn(),r=nn(),n=xn(),o=Zr(),i=Dn();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,n.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 a(o){const s=l.call(this,o);if(s)return s;const a=(0,n.getFullPath)(this.opts.uriResolver,o.root.baseId),{es5:c,lines:d}=this.opts.code,{ownProperties:u}=this.opts,p=new e.CodeGen(this.scope,{es5:c,lines:d,ownProperties:u});let h;o.$async&&(h=p.scopeValue("Error",{ref:t.default,code:e._`require("ajv/dist/runtime/validation_error").default`}));const f=p.scopeName("validate");o.validateName=f;const m={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:o.schema,code:(0,e.stringify)(o.schema)}:{ref:o.schema}),validateName:f,ValidationError:h,schema:o.schema,schemaEnv:o,rootId:a,baseId:o.baseId||a,schemaPath:e.nil,errSchemaPath:o.schemaPath||(this.opts.jtd?"":"#"),errorPath:e._`""`,opts:this.opts,self:this};let g;try{this._compilations.add(o),(0,i.validateFunctionCode)(m),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,o));const n=new Function(`${r.default.self}`,`${r.default.scope}`,g)(this,this.scope.get());if(this.scope.value(f,{ref:n}),n.errors=null,n.schema=o.schema,n.schemaEnv=o,o.$async&&(n.$async=!0),!0===this.opts.code.source&&(n.source={validateName:f,validateCode:t,scopeValues:p._values}),this.opts.unevaluated){const{props:t,items:r}=m;n.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},n.source&&(n.source.evaluated=(0,e.stringify)(n.evaluated))}return o.validate=n,o}catch(e){throw delete o.validate,delete o.validateName,g&&this.logger.error("Error compiling schema, function code:",g),e}finally{this._compilations.delete(o)}}function c(e){return(0,n.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:a.call(this,e)}function l(e){for(const t of this._compilations)if(d(t,e))return t}function d(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),o=(0,n._getFullPath)(this.opts.uriResolver,r);let i=(0,n.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&o===i)return f.call(this,r,e);const c=(0,n.normalizeId)(o),l=this.refs[c]||this.schemas[c];if("string"==typeof l){const t=p.call(this,e,l);if("object"!=typeof(null==t?void 0:t.schema))return;return f.call(this,r,t)}if("object"==typeof(null==l?void 0:l.schema)){if(l.validate||a.call(this,l),c===(0,n.normalizeId)(t)){const{schema:t}=l,{schemaId:r}=this.opts,o=t[r];return o&&(i=(0,n.resolveUrl)(this.opts.uriResolver,i,o)),new s({schema:t,schemaId:r,root:e,baseId:i})}return f.call(this,r,l)}}zn.SchemaEnv=s,zn.compileSchema=a,zn.resolveRef=function(e,t,r){var o;r=(0,n.resolveUrl)(this.opts.uriResolver,t,r);const i=e.refs[r];if(i)return i;let a=u.call(this,e,r);if(void 0===a){const n=null===(o=e.localRefs)||void 0===o?void 0:o[r],{schemaId:i}=this.opts;n&&(a=new s({schema:n,schemaId:i,root:e,baseId:t}))}return void 0!==a?e.refs[r]=c.call(this,a):void 0},zn.getCompilingSchema=l,zn.resolveSchema=p;const h=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function f(e,{baseId:t,schema:r,root:i}){var a;if("/"!==(null===(a=e.fragment)||void 0===a?void 0:a[0]))return;for(const i of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;const e=r[(0,o.unescapeFragment)(i)];if(void 0===e)return;const s="object"==typeof(r=e)&&r[this.opts.schemaId];!h.has(i)&&s&&(t=(0,n.resolveUrl)(this.opts.uriResolver,t,s))}let c;if("boolean"!=typeof r&&r.$ref&&!(0,o.schemaHasRulesButRef)(r,this.RULES)){const e=(0,n.resolveUrl)(this.opts.uriResolver,t,r.$ref);c=p.call(this,i,e)}const{schemaId:l}=this.opts;return c=c||new s({schema:r,schemaId:l,root:i,baseId:t}),c.schema!==c.root.schema?c:void 0}return zn}var Hn,qn,Wn,Kn,Yn,Jn,Xn,Zn,Qn,eo={$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},to={},ro={exports:{}};function no(){if(Kn)return Wn;Kn=1;const{HEX:e}=qn?Hn:(qn=1,Hn={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)||[],[n]=r;return n?{host:i(n,"."),isIPV4:!0}:{host:e,isIPV4:!1}}function n(t,r=!1){let n="",o=!0;for(const r of t){if(void 0===e[r])return;"0"!==r&&!0===o&&(o=!1),o||(n+=r)}return r&&0===n.length&&(n="0"),n}function o(e){if(s(e,":")<2)return{host:e,isIPV6:!1};const t=function(e){let t=0;const r={error:!1,address:"",zone:""},o=[],i=[];let s=!1,a=!1,c=!1;function l(){if(i.length){if(!1===s){const e=n(i);if(void 0===e)return r.error=!0,!1;o.push(e)}i.length=0}return!0}for(let n=0;n<e.length;n++){const d=e[n];if("["!==d&&"]"!==d)if(":"!==d)if("%"===d){if(!l())break;s=!0}else i.push(d);else{if(!0===a&&(c=!0),!l())break;if(t++,o.push(":"),t>7){r.error=!0;break}n-1>=0&&":"===e[n-1]&&(a=!0)}}return i.length&&(s?r.zone=i.join(""):c?o.push(i.join("")):o.push(n(i))),r.address=o.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 i(e,t){let r="",n=!0;const o=e.length;for(let i=0;i<o;i++){const s=e[i];"0"===s&&n?(i+1<=o&&e[i+1]===t||i+1===o)&&(r+=s,n=!1):(n=s===t,r+=s)}return r}function s(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}const a=/^\.\.?\//u,c=/^\/\.(?:\/|$)/u,l=/^\/\.\.(?:\/|$)/u,d=/^\/?(?:.|\n)*?(?=\/|$)/u;return Wn={recomposeAuthority:function(e){const t=[];if(void 0!==e.userinfo&&(t.push(e.userinfo),t.push("@")),void 0!==e.host){let n=unescape(e.host);const i=r(n);if(i.isIPV4)n=i.host;else{const t=o(i.host);n=!0===t.isIPV6?`[${t.escapedHost}]`:e.host}t.push(n)}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(a))e=e.replace(a,"");else if(e.match(c))e=e.replace(c,"/");else if(e.match(l))e=e.replace(l,"/"),t.pop();else if("."===e||".."===e)e="";else{const r=e.match(d);if(!r)throw new Error("Unexpected dot segment condition");{const n=r[0];e=e.slice(n.length),t.push(n)}}return t.join("")},normalizeIPv4:r,normalizeIPv6:o,stringArrayToHexStripped:n}}function oo(){if(Xn)return ro.exports;Xn=1;const{normalizeIPv6:e,normalizeIPv4:t,removeDotSegments:r,recomposeAuthority:n,normalizeComponentEncoding:o}=no(),i=function(){if(Jn)return Yn;Jn=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 n(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function o(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 i={scheme:"http",domainHost:!0,parse:n,serialize:o},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}},a={http:i,https:{scheme:"https",domainHost:i.domainHost,parse:n,serialize:o},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 n=e.path.match(t);if(n){const t=r.scheme||e.scheme||"urn";e.nid=n[1].toLowerCase(),e.nss=n[2];const o=`${t}:${r.nid||e.nid}`,i=a[o];e.path=void 0,i&&(e=i.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",n=e.nid.toLowerCase(),o=`${r}:${t.nid||n}`,i=a[o];i&&(e=i.serialize(e,t));const s=e,c=e.nss;return s.path=`${n||t.nid}:${c}`,t.skipEscape=!0,s},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(t,r){const n=t;return n.uuid=n.nss,n.nss=void 0,r.tolerant||n.uuid&&e.test(n.uuid)||(n.error=n.error||"UUID is not valid."),n},serialize:function(e){const t=e;return t.nss=(e.uuid||"").toLowerCase(),t},skipNormalize:!0}};return Yn=a}();function s(e,t,n,o){const i={};return o||(e=d(a(e,n),n),t=d(a(t,n),n)),!(n=n||{}).tolerant&&t.scheme?(i.scheme=t.scheme,i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=r(t.path||""),i.query=t.query):(void 0!==t.userinfo||void 0!==t.host||void 0!==t.port?(i.userinfo=t.userinfo,i.host=t.host,i.port=t.port,i.path=r(t.path||""),i.query=t.query):(t.path?("/"===t.path.charAt(0)?i.path=r(t.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?i.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+t.path:i.path=t.path:i.path="/"+t.path,i.path=r(i.path)),i.query=t.query):(i.path=e.path,void 0!==t.query?i.query=t.query:i.query=e.query),i.userinfo=e.userinfo,i.host=e.host,i.port=e.port),i.scheme=e.scheme),i.fragment=t.fragment,i}function a(e,t){const o={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),a=[],c=i[(s.scheme||o.scheme||"").toLowerCase()];c&&c.serialize&&c.serialize(o,s),void 0!==o.path&&(s.skipEscape?o.path=unescape(o.path):(o.path=escape(o.path),void 0!==o.scheme&&(o.path=o.path.split("%3A").join(":")))),"suffix"!==s.reference&&o.scheme&&a.push(o.scheme,":");const l=n(o);if(void 0!==l&&("suffix"!==s.reference&&a.push("//"),a.push(l),o.path&&"/"!==o.path.charAt(0)&&a.push("/")),void 0!==o.path){let e=o.path;s.absolutePath||c&&c.absolutePath||(e=r(e)),void 0===l&&(e=e.replace(/^\/\//u,"/%2F")),a.push(e)}return void 0!==o.query&&a.push("?",o.query),void 0!==o.fragment&&a.push("#",o.fragment),a.join("")}const c=Array.from({length:127},(e,t)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(t)));const l=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function d(r,n){const o=Object.assign({},n),s={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0},a=-1!==r.indexOf("%");let d=!1;"suffix"===o.reference&&(r=(o.scheme?o.scheme+":":"")+"//"+r);const u=r.match(l);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(),d=t.isIPV6}else s.host=r.host,d=!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",o.reference&&"suffix"!==o.reference&&o.reference!==s.reference&&(s.error=s.error||"URI is not a "+o.reference+" reference.");const r=i[(o.scheme||s.scheme||"").toLowerCase()];if(!(o.unicodeSupport||r&&r.unicodeSupport)&&s.host&&(o.domainHost||r&&r.domainHost)&&!1===d&&function(e){let t=0;for(let r=0,n=e.length;r<n;++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)&&(a&&void 0!==s.scheme&&(s.scheme=unescape(s.scheme)),a&&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,o)}else s.error=s.error||"URI can not be parsed.";return s}const u={SCHEMES:i,normalize:function(e,t){return"string"==typeof e?e=a(d(e,t),t):"object"==typeof e&&(e=d(a(e,t),t)),e},resolve:function(e,t,r){const n=Object.assign({scheme:"null"},r);return a(s(d(e,n),d(t,n),n,!0),{...n,skipEscape:!0})},resolveComponents:s,equal:function(e,t,r){return"string"==typeof e?(e=unescape(e),e=a(o(d(e,r),!0),{...r,skipEscape:!0})):"object"==typeof e&&(e=a(o(e,!0),{...r,skipEscape:!0})),"string"==typeof t?(t=unescape(t),t=a(o(d(t,r),!0),{...r,skipEscape:!0})):"object"==typeof t&&(t=a(o(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()},serialize:a,parse:d};return ro.exports=u,ro.exports.default=u,ro.exports.fastUri=u,ro.exports}function io(){return Qn||(Qn=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=Dn();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=Yr();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 n=Fn(),o=Un(),i=ln(),s=Vn(),a=Yr(),c=xn(),l=fn(),d=Zr(),u=eo,p=function(){if(Zn)return to;Zn=1,Object.defineProperty(to,"__esModule",{value:!0});const e=oo();return e.code='require("ajv/dist/runtime/uri").default',to.default=e,to}(),h=(e,t)=>new RegExp(e,t);h.code="new RegExp";const f=["removeAdditional","useDefaults","coerceTypes"],m=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,n,o,i,s,a,c,l,d,u,f,m,g,y,v,b,$,w,E,S,P,_,L,C;const k=e.strict,N=null===(t=e.code)||void 0===t?void 0:t.optimize,I=!0===N||void 0===N?1:N||0,O=null!==(n=null===(r=e.code)||void 0===r?void 0:r.regExp)&&void 0!==n?n:h,A=null!==(o=e.uriResolver)&&void 0!==o?o:p.default;return{strictSchema:null===(s=null!==(i=e.strictSchema)&&void 0!==i?i:k)||void 0===s||s,strictNumbers:null===(c=null!==(a=e.strictNumbers)&&void 0!==a?a:k)||void 0===c||c,strictTypes:null!==(d=null!==(l=e.strictTypes)&&void 0!==l?l:k)&&void 0!==d?d:"log",strictTuples:null!==(f=null!==(u=e.strictTuples)&&void 0!==u?u:k)&&void 0!==f?f:"log",strictRequired:null!==(g=null!==(m=e.strictRequired)&&void 0!==m?m:k)&&void 0!==g&&g,code:e.code?{...e.code,optimize:I,regExp:O}:{optimize:I,regExp:O},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=e.schemaId)&&void 0!==E?E:"$id",addUsedSchema:null===(S=e.addUsedSchema)||void 0===S||S,validateSchema:null===(P=e.validateSchema)||void 0===P||P,validateFormats:null===(_=e.validateFormats)||void 0===_||_,unicodeRegExp:null===(L=e.unicodeRegExp)||void 0===L||L,int32range:null===(C=e.int32range)||void 0===C||C,uriResolver:A}}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 a.ValueScope({scope:{},prefixes:m,es5:t,lines:r}),this.logger=function(e){if(!1===e)return L;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 n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,i.getRules)(),$.call(this,g,e,"NOT SUPPORTED"),$.call(this,y,e,"DEPRECATED","warn"),this._metaOpts=_.call(this),e.formats&&S.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&P.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),E.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:r}=this.opts;let n=u;"id"===r&&(n={...u},n.id=n.$id,delete n.$id),t&&e&&this.addMetaSchema(n,n[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 n=r(t);return"$async"in r||(this.errors=r.errors),n}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 n.call(this,e,t);async function n(e,t){await i.call(this,e.$schema);const r=this._addSchema(e,t);return r.validate||s.call(this,r)}async function i(e){e&&!this.getSchema(e)&&await n.call(this,{$ref:e},!0)}async function s(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof o.default))throw t;return a.call(this,t),await c.call(this,t.missingSchema),s.call(this,e)}}function a({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 l.call(this,e);this.refs[e]||await i.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function l(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,n=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,r,n);return this}let o;if("object"==typeof e){const{schemaId:t}=this.opts;if(o=e[t],void 0!==o&&"string"!=typeof o)throw new Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||o),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,n,!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 n=this.validate(r,e);if(!n&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return n}getSchema(e){let t;for(;"string"==typeof(t=w.call(this,e));)e=t;if(void 0===t){const{schemaId:r}=this.opts,n=new s.SchemaEnv({schema:{},schemaId:r});if(t=s.resolveSchema.call(this,n,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(k.call(this,r,t),!t)return(0,d.eachItem)(r,e=>N.call(this,e)),this;O.call(this,t);const n={...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)};return(0,d.eachItem)(r,0===n.type.length?e=>N.call(this,e,n):e=>n.type.forEach(t=>N.call(this,e,n,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 n of t){const t=n.split("/").slice(1);let o=e;for(const e of t)o=o[e];for(const e in r){const t=r[e];if("object"!=typeof t)continue;const{$data:n}=t.definition,i=o[e];n&&i&&(o[e]=T(i))}}return e}_removeAllSchemas(e,t){for(const r in e){const n=e[r];t&&!t.test(r)||("string"==typeof n?delete e[r]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[r]))}}_addSchema(e,t,r,n=this.opts.validateSchema,o=this.opts.addUsedSchema){let i;const{schemaId:a}=this.opts;if("object"==typeof e)i=e[a];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 l=this._cache.get(e);if(void 0!==l)return l;r=(0,c.normalizeId)(i||r);const d=c.getSchemaRefs.call(this,e,r);return l=new s.SchemaEnv({schema:e,schemaId:a,meta:t,baseId:r,localRefs:d}),this._cache.set(l.schema,l),o&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=l),n&&this.validateSchema(e,!0),l}_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,n="error"){for(const o in e){const i=o;i in t&&this.logger[n](`${r}: option ${o}. ${e[i]}`)}}function w(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function E(){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 S(){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 _(){const e={...this.opts};for(const t of f)delete e[t];return e}b.ValidationError=n.default,b.MissingRefError=o.default,e.default=b;const L={log(){},warn(){},error(){}};const C=/^[a-z_$][a-z0-9_$:-]*$/i;function k(e,t){const{RULES:r}=this;if((0,d.eachItem)(e,e=>{if(r.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!C.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 n;const o=null==t?void 0:t.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:i}=this;let s=o?i.post:i.rules.find(({type:e})=>e===r);if(s||(s={type:r,rules:[]},i.rules.push(s)),i.keywords[e]=!0,!t)return;const a={keyword:e,definition:{...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)}};t.before?I.call(this,s,a,t.before):s.rules.push(a),i.all[e]=a,null===(n=t.implements)||void 0===n||n.forEach(e=>this.addKeyword(e))}function I(e,t,r){const n=e.rules.findIndex(e=>e.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function O(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=T(t)),e.validateSchema=this.compile(t,!0))}const A={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function T(e){return{anyOf:[e,A]}}}(Fr)),Fr}var so,ao={},co={},lo={};var uo,po,ho={};function fo(){if(uo)return ho;uo=1,Object.defineProperty(ho,"__esModule",{value:!0}),ho.callRef=ho.getValidate=void 0;const e=Un(),t=wn(),r=Yr(),n=nn(),o=Vn(),i=Zr(),s={keyword:"$ref",schemaType:"string",code(t){const{gen:n,schema:i,it:s}=t,{baseId:l,schemaEnv:d,validateName:u,opts:p,self:h}=s,{root:f}=d;if(("#"===i||"#/"===i)&&l===f.baseId)return function(){if(d===f)return c(t,u,d,d.$async);const e=n.scopeValue("root",{ref:f});return c(t,r._`${e}.validate`,f,f.$async)}();const m=o.resolveRef.call(h,f,l,i);if(void 0===m)throw new e.default(s.opts.uriResolver,l,i);return m instanceof o.SchemaEnv?function(e){const r=a(t,e);c(t,r,e,e.$async)}(m):function(e){const o=n.scopeValue("schema",!0===p.code.source?{ref:e,code:(0,r.stringify)(e)}:{ref:e}),s=n.name("valid"),a=t.subschema({schema:e,dataTypes:[],schemaPath:r.nil,topSchemaRef:o,errSchemaPath:i},s);t.mergeEvaluated(a),t.ok(s)}(m)}};function a(e,t){const{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):r._`${n.scopeValue("wrapper",{ref:t})}.validate`}function c(e,o,s,a){const{gen:c,it:l}=e,{allErrors:d,schemaEnv:u,opts:p}=l,h=p.passContext?n.default.this:r.nil;function f(e){const t=r._`${e}.errors`;c.assign(n.default.vErrors,r._`${n.default.vErrors} === null ? ${t} : ${n.default.vErrors}.concat(${t})`),c.assign(n.default.errors,r._`${n.default.vErrors}.length`)}function m(e){var t;if(!l.opts.unevaluated)return;const n=null===(t=null==s?void 0:s.validate)||void 0===t?void 0:t.evaluated;if(!0!==l.props)if(n&&!n.dynamicProps)void 0!==n.props&&(l.props=i.mergeEvaluated.props(c,n.props,l.props));else{const t=c.var("props",r._`${e}.evaluated.props`);l.props=i.mergeEvaluated.props(c,t,l.props,r.Name)}if(!0!==l.items)if(n&&!n.dynamicItems)void 0!==n.items&&(l.items=i.mergeEvaluated.items(c,n.items,l.items));else{const t=c.var("items",r._`${e}.evaluated.items`);l.items=i.mergeEvaluated.items(c,t,l.items,r.Name)}}a?function(){if(!u.$async)throw new Error("async schema referenced by sync schema");const n=c.let("valid");c.try(()=>{c.code(r._`await ${(0,t.callValidateCode)(e,o,h)}`),m(o),d||c.assign(n,!0)},e=>{c.if(r._`!(${e} instanceof ${l.ValidationError})`,()=>c.throw(e)),f(e),d||c.assign(n,!1)}),e.ok(n)}():e.result((0,t.callValidateCode)(e,o,h),()=>m(o),()=>f(o))}return ho.getValidate=a,ho.callRef=c,ho.default=s,ho}function mo(){if(po)return co;po=1,Object.defineProperty(co,"__esModule",{value:!0});const e=function(){if(so)return lo;so=1,Object.defineProperty(lo,"__esModule",{value:!0});const e={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return lo.default=e,lo}(),t=fo(),r=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",e.default,t.default];return co.default=r,co}var go,yo={},vo={};var bo,$o={};var wo,Eo,So={},Po={};function _o(){if(Eo)return So;Eo=1,Object.defineProperty(So,"__esModule",{value:!0});const e=Yr(),t=Zr(),r=function(){if(wo)return Po;function e(e){const t=e.length;let r,n=0,o=0;for(;o<t;)n++,r=e.charCodeAt(o++),r>=55296&&r<=56319&&o<t&&(r=e.charCodeAt(o),56320==(64512&r)&&o++);return n}return wo=1,Object.defineProperty(Po,"__esModule",{value:!0}),Po.default=e,e.code='require("ajv/dist/runtime/ucs2length").default',Po}(),n={message({keyword:t,schemaCode:r}){const n="maxLength"===t?"more":"fewer";return e.str`must NOT have ${n} than ${r} characters`},params:({schemaCode:t})=>e._`{limit: ${t}}`},o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:n,code(n){const{keyword:o,data:i,schemaCode:s,it:a}=n,c="maxLength"===o?e.operators.GT:e.operators.LT,l=!1===a.opts.unicode?e._`${i}.length`:e._`${(0,t.useFunc)(n.gen,r.default)}(${i})`;n.fail$data(e._`${l} ${c} ${s}`)}};return So.default=o,So}var Lo,Co={};var ko,No={};var Io,Oo={};function Ao(){if(Io)return Oo;Io=1,Object.defineProperty(Oo,"__esModule",{value:!0});const e=wn(),t=Yr(),r=Zr(),n={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(n){const{gen:o,schema:i,schemaCode:s,data:a,$data:c,it:l}=n,{opts:d}=l;if(!c&&0===i.length)return;const u=i.length>=d.loopRequired;if(l.allErrors?function(){if(u||c)n.block$data(t.nil,p);else for(const t of i)(0,e.checkReportMissingProp)(n,t)}():function(){const r=o.let("missing");if(u||c){const i=o.let("valid",!0);n.block$data(i,()=>function(r,i){n.setParams({missingProperty:r}),o.forOf(r,s,()=>{o.assign(i,(0,e.propertyInData)(o,a,r,d.ownProperties)),o.if((0,t.not)(i),()=>{n.error(),o.break()})},t.nil)}(r,i)),n.ok(i)}else o.if((0,e.checkMissingProp)(n,i,r)),(0,e.reportMissingProp)(n,r),o.else()}(),d.strictRequired){const e=n.parentSchema.properties,{definedProperties:t}=n.it;for(const n of i)if(void 0===(null==e?void 0:e[n])&&!t.has(n)){const e=`required property "${n}" is not defined at "${l.schemaEnv.baseId+l.errSchemaPath}" (strictRequired)`;(0,r.checkStrictMode)(l,e,l.opts.strictRequired)}}function p(){o.forOf("prop",s,t=>{n.setParams({missingProperty:t}),o.if((0,e.noPropertyInData)(o,a,t,d.ownProperties),()=>n.error())})}}};return Oo.default=n,Oo}var To,xo={};var Do,jo,Ro={},Fo={};function Mo(){if(Do)return Fo;Do=1,Object.defineProperty(Fo,"__esModule",{value:!0});const e=kn();return e.code='require("ajv/dist/runtime/equal").default',Fo.default=e,Fo}function Go(){if(jo)return Ro;jo=1,Object.defineProperty(Ro,"__esModule",{value:!0});const e=fn(),t=Yr(),r=Zr(),n=Mo(),o={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(o){const{gen:i,data:s,$data:a,schema:c,parentSchema:l,schemaCode:d,it:u}=o;if(!a&&!c)return;const p=i.let("valid"),h=l.items?(0,e.getSchemaTypes)(l.items):[];function f(r,n){const a=i.name("item"),c=(0,e.checkDataTypes)(h,a,u.opts.strictNumbers,e.DataType.Wrong),l=i.const("indices",t._`{}`);i.for(t._`;${r}--;`,()=>{i.let(a,t._`${s}[${r}]`),i.if(c,t._`continue`),h.length>1&&i.if(t._`typeof ${a} == "string"`,t._`${a} += "_"`),i.if(t._`typeof ${l}[${a}] == "number"`,()=>{i.assign(n,t._`${l}[${a}]`),o.error(),i.assign(p,!1).break()}).code(t._`${l}[${a}] = ${r}`)})}function m(e,a){const c=(0,r.useFunc)(i,n.default),l=i.name("outer");i.label(l).for(t._`;${e}--;`,()=>i.for(t._`${a} = ${e}; ${a}--;`,()=>i.if(t._`${c}(${s}[${e}], ${s}[${a}])`,()=>{o.error(),i.assign(p,!1).break(l)})))}o.block$data(p,function(){const e=i.let("i",t._`${s}.length`),r=i.let("j");o.setParams({i:e,j:r}),i.assign(p,!0),i.if(t._`${e} > 1`,()=>(h.length>0&&!h.some(e=>"object"===e||"array"===e)?f:m)(e,r))},t._`${d} === false`),o.ok(p)}};return Ro.default=o,Ro}var Uo,Bo={};var zo,Vo,Ho={};function qo(){if(zo)return Ho;zo=1,Object.defineProperty(Ho,"__esModule",{value:!0});const e=Yr(),t=Zr(),r=Mo(),n={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>e._`{allowedValues: ${t}}`},code(n){const{gen:o,data:i,$data:s,schema:a,schemaCode:c,it:l}=n;if(!s&&0===a.length)throw new Error("enum must have non-empty array");const d=a.length>=l.opts.loopEnum;let u;const p=()=>null!=u?u:u=(0,t.useFunc)(o,r.default);let h;if(d||s)h=o.let("valid"),n.block$data(h,function(){o.assign(h,!1),o.forOf("v",c,t=>o.if(e._`${p()}(${i}, ${t})`,()=>o.assign(h,!0).break()))});else{if(!Array.isArray(a))throw new Error("ajv implementation error");const t=o.const("vSchema",c);h=(0,e.or)(...a.map((r,n)=>function(t,r){const n=a[r];return"object"==typeof n&&null!==n?e._`${p()}(${i}, ${t}[${r}])`:e._`${i} === ${n}`}(t,n)))}n.pass(h)}};return Ho.default=n,Ho}function Wo(){if(Vo)return yo;Vo=1,Object.defineProperty(yo,"__esModule",{value:!0});const e=function(){if(go)return vo;go=1,Object.defineProperty(vo,"__esModule",{value:!0});const e=Yr(),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}},n={message:({keyword:t,schemaCode:n})=>e.str`must be ${r[t].okStr} ${n}`,params:({keyword:t,schemaCode:n})=>e._`{comparison: ${r[t].okStr}, limit: ${n}}`},o={keyword:Object.keys(r),type:"number",schemaType:"number",$data:!0,error:n,code(t){const{keyword:n,data:o,schemaCode:i}=t;t.fail$data(e._`${o} ${r[n].fail} ${i} || isNaN(${o})`)}};return vo.default=o,vo}(),t=function(){if(bo)return $o;bo=1,Object.defineProperty($o,"__esModule",{value:!0});const e=Yr(),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:n,schemaCode:o,it:i}=t,s=i.opts.multipleOfPrecision,a=r.let("res"),c=s?e._`Math.abs(Math.round(${a}) - ${a}) > 1e-${s}`:e._`${a} !== parseInt(${a})`;t.fail$data(e._`(${o} === 0 || (${a} = ${n}/${o}, ${c}))`)}};return $o.default=t,$o}(),r=_o(),n=function(){if(Lo)return Co;Lo=1,Object.defineProperty(Co,"__esModule",{value:!0});const e=wn(),t=Yr(),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:n,$data:o,schema:i,schemaCode:s,it:a}=r,c=a.opts.unicodeRegExp?"u":"",l=o?t._`(new RegExp(${s}, ${c}))`:(0,e.usePattern)(r,i);r.fail$data(t._`!${l}.test(${n})`)}};return Co.default=r,Co}(),o=function(){if(ko)return No;ko=1,Object.defineProperty(No,"__esModule",{value:!0});const e=Yr(),t={message({keyword:t,schemaCode:r}){const n="maxProperties"===t?"more":"fewer";return e.str`must NOT have ${n} 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:n,schemaCode:o}=t,i="maxProperties"===r?e.operators.GT:e.operators.LT;t.fail$data(e._`Object.keys(${n}).length ${i} ${o}`)}};return No.default=r,No}(),i=Ao(),s=function(){if(To)return xo;To=1,Object.defineProperty(xo,"__esModule",{value:!0});const e=Yr(),t={message({keyword:t,schemaCode:r}){const n="maxItems"===t?"more":"fewer";return e.str`must NOT have ${n} 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:n,schemaCode:o}=t,i="maxItems"===r?e.operators.GT:e.operators.LT;t.fail$data(e._`${n}.length ${i} ${o}`)}};return xo.default=r,xo}(),a=Go(),c=function(){if(Uo)return Bo;Uo=1,Object.defineProperty(Bo,"__esModule",{value:!0});const e=Yr(),t=Zr(),r=Mo(),n={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>e._`{allowedValue: ${t}}`},code(n){const{gen:o,data:i,$data:s,schemaCode:a,schema:c}=n;s||c&&"object"==typeof c?n.fail$data(e._`!${(0,t.useFunc)(o,r.default)}(${i}, ${a})`):n.fail(e._`${c} !== ${i}`)}};return Bo.default=n,Bo}(),l=qo(),d=[e.default,t.default,r.default,n.default,o.default,i.default,s.default,a.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},c.default,l.default];return yo.default=d,yo}var Ko,Yo={},Jo={};function Xo(){if(Ko)return Jo;Ko=1,Object.defineProperty(Jo,"__esModule",{value:!0}),Jo.validateAdditionalItems=void 0;const e=Yr(),t=Zr(),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:o}=e,{items:i}=r;Array.isArray(i)?n(e,i):(0,t.checkStrictMode)(o,'"additionalItems" is ignored when "items" is not an array of schemas')}};function n(r,n){const{gen:o,schema:i,data:s,keyword:a,it:c}=r;c.items=!0;const l=o.const("len",e._`${s}.length`);if(!1===i)r.setParams({len:n.length}),r.pass(e._`${l} <= ${n.length}`);else if("object"==typeof i&&!(0,t.alwaysValidSchema)(c,i)){const i=o.var("valid",e._`${l} <= ${n.length}`);o.if((0,e.not)(i),()=>function(i){o.forRange("i",n.length,l,n=>{r.subschema({keyword:a,dataProp:n,dataPropType:t.Type.Num},i),c.allErrors||o.if((0,e.not)(i),()=>o.break())})}(i)),r.ok(i)}}return Jo.validateAdditionalItems=n,Jo.default=r,Jo}var Zo,Qo,ei={},ti={};function ri(){if(Zo)return ti;Zo=1,Object.defineProperty(ti,"__esModule",{value:!0}),ti.validateTuple=void 0;const e=Yr(),t=Zr(),r=wn(),n={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:n,it:i}=e;if(Array.isArray(n))return o(e,"additionalItems",n);i.items=!0,(0,t.alwaysValidSchema)(i,n)||e.ok((0,r.validateArray)(e))}};function o(r,n,o=r.schema){const{gen:i,parentSchema:s,data:a,keyword:c,it:l}=r;!function(e){const{opts:r,errSchemaPath:i}=l,s=o.length,a=s===e.minItems&&(s===e.maxItems||!1===e[n]);if(r.strictTuples&&!a){const e=`"${c}" is ${s}-tuple, but minItems or maxItems/${n} are not specified or different at path "${i}"`;(0,t.checkStrictMode)(l,e,r.strictTuples)}}(s),l.opts.unevaluated&&o.length&&!0!==l.items&&(l.items=t.mergeEvaluated.items(i,o.length,l.items));const d=i.name("valid"),u=i.const("len",e._`${a}.length`);o.forEach((n,o)=>{(0,t.alwaysValidSchema)(l,n)||(i.if(e._`${u} > ${o}`,()=>r.subschema({keyword:c,schemaProp:o,dataProp:o},d)),r.ok(d))})}return ti.validateTuple=o,ti.default=n,ti}var ni,oi={};var ii,si={};function ai(){if(ii)return si;ii=1,Object.defineProperty(si,"__esModule",{value:!0});const e=Yr(),t=Zr(),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:n,schema:o,parentSchema:i,data:s,it:a}=r;let c,l;const{minContains:d,maxContains:u}=i;a.opts.next?(c=void 0===d?1:d,l=u):c=1;const p=n.const("len",e._`${s}.length`);if(r.setParams({min:c,max:l}),void 0===l&&0===c)return void(0,t.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==l&&c>l)return(0,t.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),void r.fail();if((0,t.alwaysValidSchema)(a,o)){let t=e._`${p} >= ${c}`;return void 0!==l&&(t=e._`${t} && ${p} <= ${l}`),void r.pass(t)}a.items=!0;const h=n.name("valid");function f(){const t=n.name("_valid"),r=n.let("count",0);m(t,()=>n.if(t,()=>function(t){n.code(e._`${t}++`),void 0===l?n.if(e._`${t} >= ${c}`,()=>n.assign(h,!0).break()):(n.if(e._`${t} > ${l}`,()=>n.assign(h,!1).break()),1===c?n.assign(h,!0):n.if(e._`${t} >= ${c}`,()=>n.assign(h,!0)))}(r)))}function m(e,o){n.forRange("i",0,p,n=>{r.subschema({keyword:"contains",dataProp:n,dataPropType:t.Type.Num,compositeRule:!0},e),o()})}void 0===l&&1===c?m(h,()=>n.if(h,()=>n.break())):0===c?(n.let(h,!0),void 0!==l&&n.if(e._`${s}.length > 0`,f)):(n.let(h,!1),f()),r.result(h,()=>r.reset())}};return si.default=r,si}var ci,li={};function di(){return ci||(ci=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=Yr(),r=Zr(),n=wn();e.error={message:({params:{property:e,depsCount:r,deps:n}})=>{const o=1===r?"property":"properties";return t.str`must have ${o} ${n} when property ${e} is present`},params:({params:{property:e,depsCount:r,deps:n,missingProperty:o}})=>t._`{property: ${e},
|
|
4
|
+
|| ${c} === "boolean" || ${i} === null`).assign(d,n._`[${i}]`)}}o.else(),u(e),o.endIf(),o.if(n._`${d} !== undefined`,()=>{o.assign(i,d),function({gen:e,parentData:t,parentDataProperty:r},o){e.if(n._`${t} !== undefined`,()=>e.assign(n._`${t}[${r}]`,o))}(e,d)})}(e,r,d):u(e)})}return p};const a=new Set(["string","number","integer","boolean","null"]);function c(e,t,r,o=i.Correct){const s=o===i.Correct?n.operators.EQ:n.operators.NEQ;let a;switch(e){case"null":return n._`${t} ${s} null`;case"array":a=n._`Array.isArray(${t})`;break;case"object":a=n._`${t} && typeof ${t} == "object" && !Array.isArray(${t})`;break;case"integer":a=c(n._`!(${t} % 1) && !isNaN(${t})`);break;case"number":a=c();break;default:return n._`typeof ${t} ${s} ${e}`}return o===i.Correct?a:(0,n.not)(a);function c(e=n.nil){return(0,n.and)(n._`typeof ${t} == "number"`,e,r?n._`isFinite(${t})`:n.nil)}}function l(e,t,r,i){if(1===e.length)return c(e[0],t,r,i);let s;const a=(0,o.toHash)(e);if(a.array&&a.object){const e=n._`typeof ${t} != "object"`;s=a.null?e:n._`!${t} || ${e}`,delete a.null,delete a.array,delete a.object}else s=n.nil;a.number&&delete a.integer;for(const e in a)s=(0,n.and)(s,c(e,t,r,i));return s}an.checkDataType=c,an.checkDataTypes=l;const d={message:({schema:e})=>`must be ${e}`,params:({schema:e,schemaValue:t})=>"string"==typeof e?n._`{type: ${e}}`:n._`{type: ${t}}`};function u(e){const t=function(e){const{gen:t,data:r,schema:n}=e,i=(0,o.schemaRefOrVal)(e,n,"type");return{gen:t,keyword:"type",data:r,schema:n.type,schemaCode:i,schemaValue:i,parentSchema:n,params:{},it:e}}(e);(0,r.reportError)(t,d)}return an.reportTypeError=u,an}var mn,gn={};var yn,vn,bn={},$n={};function wn(){if(yn)return $n;yn=1,Object.defineProperty($n,"__esModule",{value:!0}),$n.validateUnion=$n.validateArray=$n.usePattern=$n.callValidateCode=$n.schemaProperties=$n.allSchemaProperties=$n.noPropertyInData=$n.propertyInData=$n.isOwnProperty=$n.hasPropFunc=$n.reportMissingProp=$n.checkMissingProp=$n.checkReportMissingProp=void 0;const e=Yr(),t=Zr(),r=nn(),n=Zr();function o(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:e._`Object.prototype.hasOwnProperty`})}function i(t,r,n){return e._`${o(t)}.call(${r}, ${n})`}function s(t,r,n,o){const s=e._`${r}${(0,e.getProperty)(n)} === undefined`;return o?(0,e.or)(s,(0,e.not)(i(t,r,n))):s}function a(e){return e?Object.keys(e).filter(e=>"__proto__"!==e):[]}$n.checkReportMissingProp=function(t,r){const{gen:n,data:o,it:i}=t;n.if(s(n,o,r,i.opts.ownProperties),()=>{t.setParams({missingProperty:e._`${r}`},!0),t.error()})},$n.checkMissingProp=function({gen:t,data:r,it:{opts:n}},o,i){return(0,e.or)(...o.map(o=>(0,e.and)(s(t,r,o,n.ownProperties),e._`${i} = ${o}`)))},$n.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},$n.hasPropFunc=o,$n.isOwnProperty=i,$n.propertyInData=function(t,r,n,o){const s=e._`${r}${(0,e.getProperty)(n)} !== undefined`;return o?e._`${s} && ${i(t,r,n)}`:s},$n.noPropertyInData=s,$n.allSchemaProperties=a,$n.schemaProperties=function(e,r){return a(r).filter(n=>!(0,t.alwaysValidSchema)(e,r[n]))},$n.callValidateCode=function({schemaCode:t,data:n,it:{gen:o,topSchemaRef:i,schemaPath:s,errorPath:a},it:c},l,d,u){const p=u?e._`${t}, ${n}, ${i}${s}`:n,h=[[r.default.instancePath,(0,e.strConcat)(r.default.instancePath,a)],[r.default.parentData,c.parentData],[r.default.parentDataProperty,c.parentDataProperty],[r.default.rootData,r.default.rootData]];c.opts.dynamicRef&&h.push([r.default.dynamicAnchors,r.default.dynamicAnchors]);const f=e._`${p}, ${o.object(...h)}`;return d!==e.nil?e._`${l}.call(${d}, ${f})`:e._`${l}(${f})`};const c=e._`new RegExp`;return $n.usePattern=function({gen:t,it:{opts:r}},o){const i=r.unicodeRegExp?"u":"",{regExp:s}=r.code,a=s(o,i);return t.scopeValue("pattern",{key:a.toString(),ref:a,code:e._`${"new RegExp"===s.code?c:(0,n.useFunc)(t,s)}(${o}, ${i})`})},$n.validateArray=function(r){const{gen:n,data:o,keyword:i,it:s}=r,a=n.name("valid");if(s.allErrors){const e=n.let("valid",!0);return c(()=>n.assign(e,!1)),e}return n.var(a,!0),c(()=>n.break()),a;function c(s){const c=n.const("len",e._`${o}.length`);n.forRange("i",0,c,o=>{r.subschema({keyword:i,dataProp:o,dataPropType:t.Type.Num},a),n.if((0,e.not)(a),s)})}},$n.validateUnion=function(r){const{gen:n,schema:o,keyword:i,it:s}=r;if(!Array.isArray(o))throw new Error("ajv implementation error");if(o.some(e=>(0,t.alwaysValidSchema)(s,e))&&!s.opts.unevaluated)return;const a=n.let("valid",!1),c=n.name("_valid");n.block(()=>o.forEach((t,o)=>{const s=r.subschema({keyword:i,schemaProp:o,compositeRule:!0},c);n.assign(a,e._`${a} || ${c}`);r.mergeValidEvaluated(s,c)||n.if((0,e.not)(a))})),r.result(a,()=>r.reset(),()=>r.error(!0))},$n}function En(){if(vn)return bn;vn=1,Object.defineProperty(bn,"__esModule",{value:!0}),bn.validateKeywordUsage=bn.validSchemaType=bn.funcKeywordCode=bn.macroKeywordCode=void 0;const e=Yr(),t=nn(),r=wn(),n=on();function o(t){const{gen:r,data:n,it:o}=t;r.if(o.parentData,()=>r.assign(n,e._`${o.parentData}[${o.parentDataProperty}]`))}function i(t,r,n){if(void 0===n)throw new Error(`keyword "${r}" failed to compile`);return t.scopeValue("keyword","function"==typeof n?{ref:n}:{ref:n,code:(0,e.stringify)(n)})}return bn.macroKeywordCode=function(t,r){const{gen:n,keyword:o,schema:s,parentSchema:a,it:c}=t,l=r.macro.call(c.self,s,a,c),d=i(n,o,l);!1!==c.opts.validateSchema&&c.self.validateSchema(l,!0);const u=n.name("valid");t.subschema({schema:l,schemaPath:e.nil,errSchemaPath:`${c.errSchemaPath}/${o}`,topSchemaRef:d,compositeRule:!0},u),t.pass(u,()=>t.error(!0))},bn.funcKeywordCode=function(s,a){var c;const{gen:l,keyword:d,schema:u,parentSchema:p,$data:h,it:f}=s;!function({schemaEnv:e},t){if(t.async&&!e.$async)throw new Error("async keyword in sync schema")}(f,a);const m=!h&&a.compile?a.compile.call(f.self,u,p,f):a.validate,g=i(l,d,m),y=l.let("valid");function v(n=(a.async?e._`await `:e.nil)){const o=f.opts.passContext?t.default.this:t.default.self,i=!("compile"in a&&!h||!1===a.schema);l.assign(y,e._`${n}${(0,r.callValidateCode)(s,g,o,i)}`,a.modifying)}function b(t){var r;l.if((0,e.not)(null!==(r=a.valid)&&void 0!==r?r:y),t)}s.block$data(y,function(){if(!1===a.errors)v(),a.modifying&&o(s),b(()=>s.error());else{const r=a.async?function(){const t=l.let("ruleErrs",null);return l.try(()=>v(e._`await `),r=>l.assign(y,!1).if(e._`${r} instanceof ${f.ValidationError}`,()=>l.assign(t,e._`${r}.errors`),()=>l.throw(r))),t}():function(){const t=e._`${g}.errors`;return l.assign(t,null),v(e.nil),t}();a.modifying&&o(s),b(()=>function(r,o){const{gen:i}=r;i.if(e._`Array.isArray(${o})`,()=>{i.assign(t.default.vErrors,e._`${t.default.vErrors} === null ? ${o} : ${t.default.vErrors}.concat(${o})`).assign(t.default.errors,e._`${t.default.vErrors}.length`),(0,n.extendErrors)(r)},()=>r.error())}(s,r))}}),s.ok(null!==(c=a.valid)&&void 0!==c?c:y)},bn.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)},bn.validateKeywordUsage=function({schema:e,opts:t,self:r,errSchemaPath:n},o,i){if(Array.isArray(o.keyword)?!o.keyword.includes(i):o.keyword!==i)throw new Error("ajv implementation error");const s=o.dependencies;if(null==s?void 0:s.some(t=>!Object.prototype.hasOwnProperty.call(e,t)))throw new Error(`parent schema must have dependencies of ${i}: ${s.join(",")}`);if(o.validateSchema){if(!o.validateSchema(e[i])){const e=`keyword "${i}" value is invalid at path "${n}": `+r.errorsText(o.validateSchema.errors);if("log"!==t.validateSchema)throw new Error(e);r.logger.error(e)}}},bn}var Sn,Pn={};var _n,Ln,kn={};function Cn(){return Ln||(Ln=1,_n=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 n,o,i;if(Array.isArray(t)){if((n=t.length)!=r.length)return!1;for(o=n;0!==o--;)if(!e(t[o],r[o]))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((n=(i=Object.keys(t)).length)!==Object.keys(r).length)return!1;for(o=n;0!==o--;)if(!Object.prototype.hasOwnProperty.call(r,i[o]))return!1;for(o=n;0!==o--;){var s=i[o];if(!e(t[s],r[s]))return!1}return!0}return t!=t&&r!=r}),_n}var Nn,In,On,An={exports:{}};function xn(){if(Nn)return An.exports;Nn=1;var e=An.exports=function(e,r,n){"function"==typeof r&&(n=r,r={}),t(r,"function"==typeof(n=r.cb||n)?n:n.pre||function(){},n.post||function(){},e,"",e)};function t(n,o,i,s,a,c,l,d,u,p){if(s&&"object"==typeof s&&!Array.isArray(s)){for(var h in o(s,a,c,l,d,u,p),s){var f=s[h];if(Array.isArray(f)){if(h in e.arrayKeywords)for(var m=0;m<f.length;m++)t(n,o,i,f[m],a+"/"+h+"/"+m,c,a,h,s,m)}else if(h in e.propsKeywords){if(f&&"object"==typeof f)for(var g in f)t(n,o,i,f[g],a+"/"+h+"/"+r(g),c,a,h,s,g)}else(h in e.keywords||n.allKeys&&!(h in e.skipKeywords))&&t(n,o,i,f,a+"/"+h,c,a,h,s)}i(s,a,c,l,d,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},An.exports}function Tn(){if(In)return kn;In=1,Object.defineProperty(kn,"__esModule",{value:!0}),kn.getSchemaRefs=kn.resolveUrl=kn.normalizeId=kn._getFullPath=kn.getFullPath=kn.inlineRef=void 0;const e=Zr(),t=Cn(),r=xn(),n=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);kn.inlineRef=function(e,t=!0){return"boolean"==typeof e||(!0===t?!i(e):!!t&&s(e)<=t)};const o=new Set(["$ref","$recursiveRef","$recursiveAnchor","$dynamicRef","$dynamicAnchor"]);function i(e){for(const t in e){if(o.has(t))return!0;const r=e[t];if(Array.isArray(r)&&r.some(i))return!0;if("object"==typeof r&&i(r))return!0}return!1}function s(t){let r=0;for(const o in t){if("$ref"===o)return 1/0;if(r++,!n.has(o)&&("object"==typeof t[o]&&(0,e.eachItem)(t[o],e=>r+=s(e)),r===1/0))return 1/0}return r}function a(e,t="",r){!1!==r&&(t=d(t));const n=e.parse(t);return c(e,n)}function c(e,t){return e.serialize(t).split("#")[0]+"#"}kn.getFullPath=a,kn._getFullPath=c;const l=/#\/?$/;function d(e){return e?e.replace(l,""):""}kn.normalizeId=d,kn.resolveUrl=function(e,t,r){return r=d(r),e.resolve(t,r)};const u=/^[a-z_][-a-z0-9._]*$/i;return kn.getSchemaRefs=function(e,n){if("boolean"==typeof e)return{};const{schemaId:o,uriResolver:i}=this.opts,s=d(e[o]||n),c={"":s},l=a(i,s,!1),p={},h=new Set;return r(e,{allKeys:!0},(e,t,r,n)=>{if(void 0===n)return;const i=l+t;let s=c[n];function a(t){const r=this.opts.uriResolver.resolve;if(t=d(s?r(s,t):t),h.has(t))throw m(t);h.add(t);let n=this.refs[t];return"string"==typeof n&&(n=this.refs[n]),"object"==typeof n?f(e,n.schema,t):t!==d(i)&&("#"===t[0]?(f(e,p[t],t),p[t]=e):this.refs[t]=i),t}function g(e){if("string"==typeof e){if(!u.test(e))throw new Error(`invalid anchor "${e}"`);a.call(this,`#${e}`)}}"string"==typeof e[o]&&(s=a.call(this,e[o])),g.call(this,e.$anchor),g.call(this,e.$dynamicAnchor),c[t]=s}),p;function f(e,r,n){if(void 0!==r&&!t(e,r))throw m(n)}function m(e){return new Error(`reference "${e}" resolves to more than one schema`)}},kn}function Dn(){if(On)return Mr;On=1,Object.defineProperty(Mr,"__esModule",{value:!0}),Mr.getData=Mr.KeywordCxt=Mr.validateFunctionCode=void 0;const e=function(){if(tn)return Gr;tn=1,Object.defineProperty(Gr,"__esModule",{value:!0}),Gr.boolOrEmptySchema=Gr.topBoolOrEmptySchema=void 0;const e=on(),t=Yr(),r=nn(),n={message:"boolean schema is false"};function o(t,r){const{gen:o,data:i}=t,s={gen:o,keyword:"false schema",data:i,schema:!1,schemaCode:!1,schemaValue:!1,params:{},it:t};(0,e.reportError)(s,n,void 0,r)}return Gr.topBoolOrEmptySchema=function(e){const{gen:n,schema:i,validateName:s}=e;!1===i?o(e,!1):"object"==typeof i&&!0===i.$async?n.return(r.default.data):(n.assign(t._`${s}.errors`,null),n.return(!0))},Gr.boolOrEmptySchema=function(e,t){const{gen:r,schema:n}=e;!1===n?(r.var(t,!1),o(e)):r.var(t,!0)},Gr}(),t=fn(),r=hn(),n=fn(),o=function(){if(mn)return gn;mn=1,Object.defineProperty(gn,"__esModule",{value:!0}),gn.assignDefaults=void 0;const e=Yr(),t=Zr();function r(r,n,o){const{gen:i,compositeRule:s,data:a,opts:c}=r;if(void 0===o)return;const l=e._`${a}${(0,e.getProperty)(n)}`;if(s)return void(0,t.checkStrictMode)(r,`default is ignored for: ${l}`);let d=e._`${l} === undefined`;"empty"===c.useDefaults&&(d=e._`${d} || ${l} === null || ${l} === ""`),i.if(d,e._`${l} = ${(0,e.stringify)(o)}`)}return gn.assignDefaults=function(e,t){const{properties:n,items:o}=e.schema;if("object"===t&&n)for(const t in n)r(e,t,n[t].default);else"array"===t&&Array.isArray(o)&&o.forEach((t,n)=>r(e,n,t.default))},gn}(),i=En(),s=function(){if(Sn)return Pn;Sn=1,Object.defineProperty(Pn,"__esModule",{value:!0}),Pn.extendSubschemaMode=Pn.extendSubschemaData=Pn.getSubschema=void 0;const e=Yr(),t=Zr();return Pn.getSubschema=function(r,{keyword:n,schemaProp:o,schema:i,schemaPath:s,errSchemaPath:a,topSchemaRef:c}){if(void 0!==n&&void 0!==i)throw new Error('both "keyword" and "schema" passed, only one allowed');if(void 0!==n){const i=r.schema[n];return void 0===o?{schema:i,schemaPath:e._`${r.schemaPath}${(0,e.getProperty)(n)}`,errSchemaPath:`${r.errSchemaPath}/${n}`}:{schema:i[o],schemaPath:e._`${r.schemaPath}${(0,e.getProperty)(n)}${(0,e.getProperty)(o)}`,errSchemaPath:`${r.errSchemaPath}/${n}/${(0,t.escapeFragment)(o)}`}}if(void 0!==i){if(void 0===s||void 0===a||void 0===c)throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"');return{schema:i,schemaPath:s,topSchemaRef:c,errSchemaPath:a}}throw new Error('either "keyword" or "schema" must be passed')},Pn.extendSubschemaData=function(r,n,{dataProp:o,dataPropType:i,data:s,dataTypes:a,propertyName:c}){if(void 0!==s&&void 0!==o)throw new Error('both "data" and "dataProp" passed, only one allowed');const{gen:l}=n;if(void 0!==o){const{errorPath:s,dataPathArr:a,opts:c}=n;d(l.let("data",e._`${n.data}${(0,e.getProperty)(o)}`,!0)),r.errorPath=e.str`${s}${(0,t.getErrorPath)(o,i,c.jsPropertySyntax)}`,r.parentDataProperty=e._`${o}`,r.dataPathArr=[...a,r.parentDataProperty]}function d(e){r.data=e,r.dataLevel=n.dataLevel+1,r.dataTypes=[],n.definedProperties=new Set,r.parentData=n.data,r.dataNames=[...n.dataNames,e]}void 0!==s&&(d(s instanceof e.Name?s:l.let("data",s,!0)),void 0!==c&&(r.propertyName=c)),a&&(r.dataTypes=a)},Pn.extendSubschemaMode=function(e,{jtdDiscriminator:t,jtdMetadata:r,compositeRule:n,createErrors:o,allErrors:i}){void 0!==n&&(e.compositeRule=n),void 0!==o&&(e.createErrors=o),void 0!==i&&(e.allErrors=i),e.jtdDiscriminator=t,e.jtdMetadata=r},Pn}(),a=Yr(),c=nn(),l=Tn(),d=Zr(),u=on();function p({gen:e,validateName:t,schema:r,schemaEnv:n,opts:o},i){o.code.es5?e.func(t,a._`${c.default.data}, ${c.default.valCxt}`,n.$async,()=>{e.code(a._`"use strict"; ${h(r,o)}`),function(e,t){e.if(c.default.valCxt,()=>{e.var(c.default.instancePath,a._`${c.default.valCxt}.${c.default.instancePath}`),e.var(c.default.parentData,a._`${c.default.valCxt}.${c.default.parentData}`),e.var(c.default.parentDataProperty,a._`${c.default.valCxt}.${c.default.parentDataProperty}`),e.var(c.default.rootData,a._`${c.default.valCxt}.${c.default.rootData}`),t.dynamicRef&&e.var(c.default.dynamicAnchors,a._`${c.default.valCxt}.${c.default.dynamicAnchors}`)},()=>{e.var(c.default.instancePath,a._`""`),e.var(c.default.parentData,a._`undefined`),e.var(c.default.parentDataProperty,a._`undefined`),e.var(c.default.rootData,c.default.data),t.dynamicRef&&e.var(c.default.dynamicAnchors,a._`{}`)})}(e,o),e.code(i)}):e.func(t,a._`${c.default.data}, ${function(e){return a._`{${c.default.instancePath}="", ${c.default.parentData}, ${c.default.parentDataProperty}, ${c.default.rootData}=${c.default.data}${e.dynamicRef?a._`, ${c.default.dynamicAnchors}={}`:a.nil}}={}`}(o)}`,n.$async,()=>e.code(h(r,o)).code(i))}function h(e,t){const r="object"==typeof e&&e[t.schemaId];return r&&(t.code.source||t.code.process)?a._`/*# sourceURL=${r} */`:a.nil}function f(t,r){g(t)&&(y(t),m(t))?function(e,t){const{schema:r,gen:n,opts:o}=e;o.$comment&&r.$comment&&b(e);(function(e){const t=e.schema[e.opts.schemaId];t&&(e.baseId=(0,l.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 i=n.const("_errs",c.default.errors);v(e,i),n.var(t,a._`${i} === ${c.default.errors}`)}(t,r):(0,e.boolOrEmptySchema)(t,r)}function m({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,d.checkUnknownRules)(e),function(e){const{schema:t,errSchemaPath:r,opts:n,self:o}=e;t.$ref&&n.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(t,o.RULES)&&o.logger.warn(`$ref: keywords ignored in schema at path "${r}"`)}(e)}function v(e,r){if(e.opts.jtd)return $(e,[],!1,r);const n=(0,t.getSchemaTypes)(e.schema);$(e,n,!(0,t.coerceAndCheckDataType)(e,n),r)}function b({gen:e,schemaEnv:t,schema:r,errSchemaPath:n,opts:o}){const i=r.$comment;if(!0===o.$comment)e.code(a._`${c.default.self}.logger.log(${i})`);else if("function"==typeof o.$comment){const r=a.str`${n}/$comment`,o=e.scopeValue("root",{ref:t.root});e.code(a._`${c.default.self}.opts.$comment(${i}, ${r}, ${o}.schema)`)}}function $(e,t,o,i){const{gen:s,schema:l,data:u,allErrors:p,opts:h,self:f}=e,{RULES:m}=f;function g(d){(0,r.shouldUseGroup)(l,d)&&(d.type?(s.if((0,n.checkDataType)(d.type,u,h.strictNumbers)),w(e,d),1===t.length&&t[0]===d.type&&o&&(s.else(),(0,n.reportTypeError)(e)),s.endIf()):w(e,d),p||s.if(a._`${c.default.errors} === ${i||0}`))}!l.$ref||!h.ignoreKeywordsWithRef&&(0,d.schemaHasRulesButRef)(l,m)?(h.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=>{S(e.dataTypes,t)||P(e,`type "${t}" not allowed by context "${e.dataTypes.join(",")}"`)}),function(e,t){const r=[];for(const n of e.dataTypes)S(t,n)?r.push(n):t.includes("integer")&&"number"===n&&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 n=e.self.RULES.all;for(const o in n){const i=n[o];if("object"==typeof i&&(0,r.shouldUseRule)(e.schema,i)){const{type:r}=i.definition;r.length&&!r.some(e=>E(t,e))&&P(e,`missing type "${r.join(",")}" for keyword "${o}"`)}}}(e,e.dataTypes)}(e,t),s.block(()=>{for(const e of m.rules)g(e);g(m.post)})):s.block(()=>L(e,"$ref",m.all.$ref.definition))}function w(e,t){const{gen:n,schema:i,opts:{useDefaults:s}}=e;s&&(0,o.assignDefaults)(e,t.type),n.block(()=>{for(const n of t.rules)(0,r.shouldUseRule)(i,n)&&L(e,n.keyword,n.definition,t.type)})}function E(e,t){return e.includes(t)||"number"===t&&e.includes("integer")}function S(e,t){return e.includes(t)||"integer"===t&&e.includes("number")}function P(e,t){t+=` at "${e.schemaEnv.baseId+e.errSchemaPath}" (strictTypes)`,(0,d.checkStrictMode)(e,t,e.opts.strictTypes)}Mr.validateFunctionCode=function(t){g(t)&&(y(t),m(t))?function(e){const{schema:t,opts:r,gen:n}=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,d.checkStrictMode)(e,"default is ignored in the schema root")}(e),n.let(c.default.vErrors,null),n.let(c.default.errors,0),r.unevaluated&&function(e){const{gen:t,validateName:r}=e;e.evaluated=t.const("evaluated",a._`${r}.evaluated`),t.if(a._`${e.evaluated}.dynamicProps`,()=>t.assign(a._`${e.evaluated}.props`,a._`undefined`)),t.if(a._`${e.evaluated}.dynamicItems`,()=>t.assign(a._`${e.evaluated}.items`,a._`undefined`))}(e),v(e),function(e){const{gen:t,schemaEnv:r,validateName:n,ValidationError:o,opts:i}=e;r.$async?t.if(a._`${c.default.errors} === 0`,()=>t.return(c.default.data),()=>t.throw(a._`new ${o}(${c.default.vErrors})`)):(t.assign(a._`${n}.errors`,c.default.vErrors),i.unevaluated&&function({gen:e,evaluated:t,props:r,items:n}){r instanceof a.Name&&e.assign(a._`${t}.props`,r);n instanceof a.Name&&e.assign(a._`${t}.items`,n)}(e),t.return(a._`${c.default.errors} === 0`))}(e)})}(t):p(t,()=>(0,e.topBoolOrEmptySchema)(t))};class _{constructor(e,t,r){if((0,i.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,d.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,i.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,a.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,a.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(a._`${t} !== undefined && (${(0,a.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=a.nil){this.gen.block(()=>{this.check$data(e,r),t()})}check$data(e=a.nil,t=a.nil){if(!this.$data)return;const{gen:r,schemaCode:n,schemaType:o,def:i}=this;r.if((0,a.or)(a._`${n} === undefined`,t)),e!==a.nil&&r.assign(e,!0),(o.length||i.validateSchema)&&(r.elseIf(this.invalid$data()),this.$dataError(),e!==a.nil&&r.assign(e,!1)),r.else()}invalid$data(){const{gen:e,schemaCode:t,schemaType:r,def:o,it:i}=this;return(0,a.or)(function(){if(r.length){if(!(t instanceof a.Name))throw new Error("ajv implementation error");const e=Array.isArray(r)?r:[r];return a._`${(0,n.checkDataTypes)(e,t,i.opts.strictNumbers,n.DataType.Wrong)}`}return a.nil}(),function(){if(o.validateSchema){const r=e.scopeValue("validate$data",{ref:o.validateSchema});return a._`!${r}(${t})`}return a.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 n={...this.it,...r,items:void 0,props:void 0};return f(n,t),n}mergeEvaluated(e,t){const{it:r,gen:n}=this;r.opts.unevaluated&&(!0!==r.props&&void 0!==e.props&&(r.props=d.mergeEvaluated.props(n,e.props,r.props,t)),!0!==r.items&&void 0!==e.items&&(r.items=d.mergeEvaluated.items(n,e.items,r.items,t)))}mergeValidEvaluated(e,t){const{it:r,gen:n}=this;if(r.opts.unevaluated&&(!0!==r.props||!0!==r.items))return n.if(t,()=>this.mergeEvaluated(e,a.Name)),!0}}function L(e,t,r,n){const o=new _(e,r,t);"code"in r?r.code(o,n):o.$data&&r.validate?(0,i.funcKeywordCode)(o,r):"macro"in r?(0,i.macroKeywordCode)(o,r):(r.compile||r.validate)&&(0,i.funcKeywordCode)(o,r)}Mr.KeywordCxt=_;const k=/^\/(?:[^~]|~0|~1)*$/,C=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function N(e,{dataLevel:t,dataNames:r,dataPathArr:n}){let o,i;if(""===e)return c.default.rootData;if("/"===e[0]){if(!k.test(e))throw new Error(`Invalid JSON-pointer: ${e}`);o=e,i=c.default.rootData}else{const s=C.exec(e);if(!s)throw new Error(`Invalid JSON-pointer: ${e}`);const a=+s[1];if(o=s[2],"#"===o){if(a>=t)throw new Error(u("property/index",a));return n[t-a]}if(a>t)throw new Error(u("data",a));if(i=r[t-a],!o)return i}let s=i;const l=o.split("/");for(const e of l)e&&(i=a._`${i}${(0,a.getProperty)((0,d.unescapeJsonPointer)(e))}`,s=a._`${s} && ${i}`);return s;function u(e,r){return`Cannot access ${e} ${r} levels up, current level is ${t}`}}return Mr.getData=N,Mr}var jn,Rn={};function Fn(){if(jn)return Rn;jn=1,Object.defineProperty(Rn,"__esModule",{value:!0});class e extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}return Rn.default=e,Rn}var Mn,Gn={};function Un(){if(Mn)return Gn;Mn=1,Object.defineProperty(Gn,"__esModule",{value:!0});const e=Tn();class t extends Error{constructor(t,r,n,o){super(o||`can't resolve reference ${n} from id ${r}`),this.missingRef=(0,e.resolveUrl)(t,r,n),this.missingSchema=(0,e.normalizeId)((0,e.getFullPath)(t,this.missingRef))}}return Gn.default=t,Gn}var Bn,zn={};function Vn(){if(Bn)return zn;Bn=1,Object.defineProperty(zn,"__esModule",{value:!0}),zn.resolveSchema=zn.getCompilingSchema=zn.resolveRef=zn.compileSchema=zn.SchemaEnv=void 0;const e=Yr(),t=Fn(),r=nn(),n=Tn(),o=Zr(),i=Dn();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,n.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 a(o){const s=l.call(this,o);if(s)return s;const a=(0,n.getFullPath)(this.opts.uriResolver,o.root.baseId),{es5:c,lines:d}=this.opts.code,{ownProperties:u}=this.opts,p=new e.CodeGen(this.scope,{es5:c,lines:d,ownProperties:u});let h;o.$async&&(h=p.scopeValue("Error",{ref:t.default,code:e._`require("ajv/dist/runtime/validation_error").default`}));const f=p.scopeName("validate");o.validateName=f;const m={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:o.schema,code:(0,e.stringify)(o.schema)}:{ref:o.schema}),validateName:f,ValidationError:h,schema:o.schema,schemaEnv:o,rootId:a,baseId:o.baseId||a,schemaPath:e.nil,errSchemaPath:o.schemaPath||(this.opts.jtd?"":"#"),errorPath:e._`""`,opts:this.opts,self:this};let g;try{this._compilations.add(o),(0,i.validateFunctionCode)(m),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,o));const n=new Function(`${r.default.self}`,`${r.default.scope}`,g)(this,this.scope.get());if(this.scope.value(f,{ref:n}),n.errors=null,n.schema=o.schema,n.schemaEnv=o,o.$async&&(n.$async=!0),!0===this.opts.code.source&&(n.source={validateName:f,validateCode:t,scopeValues:p._values}),this.opts.unevaluated){const{props:t,items:r}=m;n.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},n.source&&(n.source.evaluated=(0,e.stringify)(n.evaluated))}return o.validate=n,o}catch(e){throw delete o.validate,delete o.validateName,g&&this.logger.error("Error compiling schema, function code:",g),e}finally{this._compilations.delete(o)}}function c(e){return(0,n.inlineRef)(e.schema,this.opts.inlineRefs)?e.schema:e.validate?e:a.call(this,e)}function l(e){for(const t of this._compilations)if(d(t,e))return t}function d(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),o=(0,n._getFullPath)(this.opts.uriResolver,r);let i=(0,n.getFullPath)(this.opts.uriResolver,e.baseId,void 0);if(Object.keys(e.schema).length>0&&o===i)return f.call(this,r,e);const c=(0,n.normalizeId)(o),l=this.refs[c]||this.schemas[c];if("string"==typeof l){const t=p.call(this,e,l);if("object"!=typeof(null==t?void 0:t.schema))return;return f.call(this,r,t)}if("object"==typeof(null==l?void 0:l.schema)){if(l.validate||a.call(this,l),c===(0,n.normalizeId)(t)){const{schema:t}=l,{schemaId:r}=this.opts,o=t[r];return o&&(i=(0,n.resolveUrl)(this.opts.uriResolver,i,o)),new s({schema:t,schemaId:r,root:e,baseId:i})}return f.call(this,r,l)}}zn.SchemaEnv=s,zn.compileSchema=a,zn.resolveRef=function(e,t,r){var o;r=(0,n.resolveUrl)(this.opts.uriResolver,t,r);const i=e.refs[r];if(i)return i;let a=u.call(this,e,r);if(void 0===a){const n=null===(o=e.localRefs)||void 0===o?void 0:o[r],{schemaId:i}=this.opts;n&&(a=new s({schema:n,schemaId:i,root:e,baseId:t}))}return void 0!==a?e.refs[r]=c.call(this,a):void 0},zn.getCompilingSchema=l,zn.resolveSchema=p;const h=new Set(["properties","patternProperties","enum","dependencies","definitions"]);function f(e,{baseId:t,schema:r,root:i}){var a;if("/"!==(null===(a=e.fragment)||void 0===a?void 0:a[0]))return;for(const i of e.fragment.slice(1).split("/")){if("boolean"==typeof r)return;const e=r[(0,o.unescapeFragment)(i)];if(void 0===e)return;const s="object"==typeof(r=e)&&r[this.opts.schemaId];!h.has(i)&&s&&(t=(0,n.resolveUrl)(this.opts.uriResolver,t,s))}let c;if("boolean"!=typeof r&&r.$ref&&!(0,o.schemaHasRulesButRef)(r,this.RULES)){const e=(0,n.resolveUrl)(this.opts.uriResolver,t,r.$ref);c=p.call(this,i,e)}const{schemaId:l}=this.opts;return c=c||new s({schema:r,schemaId:l,root:i,baseId:t}),c.schema!==c.root.schema?c:void 0}return zn}var Hn,qn,Wn,Kn,Yn,Jn,Xn,Zn={$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},Qn={},eo={exports:{}};function to(){if(qn)return Hn;qn=1;const e=RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu),t=RegExp.prototype.test.bind(/^(?:(?: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){let t="",r=0,n=0;for(n=0;n<e.length;n++)if(r=e[n].charCodeAt(0),48!==r){if(!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n];break}for(n+=1;n<e.length;n++){if(r=e[n].charCodeAt(0),!(r>=48&&r<=57||r>=65&&r<=70||r>=97&&r<=102))return"";t+=e[n]}return t}const n=RegExp.prototype.test.bind(/[^!"$&'()*+,\-.;=_`a-z{}~]/u);function o(e){return e.length=0,!0}function i(e,t,n){if(e.length){const o=r(e);if(""===o)return n.error=!0,!1;t.push(o),e.length=0}return!0}function s(e){if(function(e,t){let r=0;for(let n=0;n<e.length;n++)e[n]===t&&r++;return r}(e,":")<2)return{host:e,isIPV6:!1};const t=function(e){let t=0;const n={error:!1,address:"",zone:""},s=[],a=[];let c=!1,l=!1,d=i;for(let r=0;r<e.length;r++){const i=e[r];if("["!==i&&"]"!==i)if(":"!==i)if("%"===i){if(!d(a,s,n))break;d=o}else a.push(i);else{if(!0===c&&(l=!0),!d(a,s,n))break;if(++t>7){n.error=!0;break}r>0&&":"===e[r-1]&&(c=!0),s.push(":")}}return a.length&&(d===o?n.zone=a.join(""):l?s.push(a.join("")):s.push(r(a))),n.address=s.join(""),n}(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,isIPV6:!0,escapedHost:r}}}return Hn={nonSimpleDomain:n,recomposeAuthority:function(e){const r=[];if(void 0!==e.userinfo&&(r.push(e.userinfo),r.push("@")),void 0!==e.host){let n=unescape(e.host);if(!t(n)){const t=s(n);n=!0===t.isIPV6?`[${t.escapedHost}]`:e.host}r.push(n)}return"number"!=typeof e.port&&"string"!=typeof e.port||(r.push(":"),r.push(String(e.port))),r.length?r.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){let t=e;const r=[];let n=-1,o=0;for(;o=t.length;){if(1===o){if("."===t)break;if("/"===t){r.push("/");break}r.push(t);break}if(2===o){if("."===t[0]){if("."===t[1])break;if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&("."===t[1]||"/"===t[1])){r.push("/");break}}else if(3===o&&"/.."===t){0!==r.length&&r.pop(),r.push("/");break}if("."===t[0]){if("."===t[1]){if("/"===t[2]){t=t.slice(3);continue}}else if("/"===t[1]){t=t.slice(2);continue}}else if("/"===t[0]&&"."===t[1]){if("/"===t[2]){t=t.slice(2);continue}if("."===t[2]&&"/"===t[3]){t=t.slice(3),0!==r.length&&r.pop();continue}}if(-1===(n=t.indexOf("/",1))){r.push(t);break}r.push(t.slice(0,n)),t=t.slice(n)}return r.join("")},isIPv4:t,isUUID:e,normalizeIPv6:s,stringArrayToHexStripped:r}}function ro(){if(Yn)return eo.exports;Yn=1;const{normalizeIPv6:e,removeDotSegments:t,recomposeAuthority:r,normalizeComponentEncoding:n,isIPv4:o,nonSimpleDomain:i}=to(),{SCHEMES:s,getSchemeHandler:a}=function(){if(Kn)return Wn;Kn=1;const{isUUID:e}=to(),t=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu,r=["http","https","ws","wss","urn","urn:uuid"];function n(e){return!0===e.secure||!1!==e.secure&&!!e.scheme&&!(3!==e.scheme.length||"w"!==e.scheme[0]&&"W"!==e.scheme[0]||"s"!==e.scheme[1]&&"S"!==e.scheme[1]||"s"!==e.scheme[2]&&"S"!==e.scheme[2])}function o(e){return e.host||(e.error=e.error||"HTTP URIs must have a host."),e}function i(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 s={scheme:"http",domainHost:!0,parse:o,serialize:i},a={scheme:"ws",domainHost:!0,parse:function(e){return e.secure=n(e),e.resourceName=(e.path||"/")+(e.query?"?"+e.query:""),e.path=void 0,e.query=void 0,e},serialize:function(e){if(e.port!==(n(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}},c={http:s,https:{scheme:"https",domainHost:s.domainHost,parse:o,serialize:i},ws:a,wss:{scheme:"wss",domainHost:a.domainHost,parse:a.parse,serialize:a.serialize},urn:{scheme:"urn",parse:function(e,r){if(!e.path)return e.error="URN can not be parsed",e;const n=e.path.match(t);if(n){const t=r.scheme||e.scheme||"urn";e.nid=n[1].toLowerCase(),e.nss=n[2];const o=l(`${t}:${r.nid||e.nid}`);e.path=void 0,o&&(e=o.parse(e,r))}else e.error=e.error||"URN can not be parsed.";return e},serialize:function(e,t){if(void 0===e.nid)throw new Error("URN without nid cannot be serialized");const r=t.scheme||e.scheme||"urn",n=e.nid.toLowerCase(),o=l(`${r}:${t.nid||n}`);o&&(e=o.serialize(e,t));const i=e,s=e.nss;return i.path=`${n||t.nid}:${s}`,t.skipEscape=!0,i},skipNormalize:!0},"urn:uuid":{scheme:"urn:uuid",parse:function(t,r){const n=t;return n.uuid=n.nss,n.nss=void 0,r.tolerant||n.uuid&&e(n.uuid)||(n.error=n.error||"UUID is not valid."),n},serialize:function(e){const t=e;return t.nss=(e.uuid||"").toLowerCase(),t},skipNormalize:!0}};function l(e){return e&&(c[e]||c[e.toLowerCase()])||void 0}return Object.setPrototypeOf(c,null),Wn={wsIsSecure:n,SCHEMES:c,isValidSchemeName:function(e){return-1!==r.indexOf(e)},getSchemeHandler:l}}();function c(e,r,n,o){const i={};return o||(e=u(l(e,n),n),r=u(l(r,n),n)),!(n=n||{}).tolerant&&r.scheme?(i.scheme=r.scheme,i.userinfo=r.userinfo,i.host=r.host,i.port=r.port,i.path=t(r.path||""),i.query=r.query):(void 0!==r.userinfo||void 0!==r.host||void 0!==r.port?(i.userinfo=r.userinfo,i.host=r.host,i.port=r.port,i.path=t(r.path||""),i.query=r.query):(r.path?("/"===r.path[0]?i.path=t(r.path):(void 0===e.userinfo&&void 0===e.host&&void 0===e.port||e.path?e.path?i.path=e.path.slice(0,e.path.lastIndexOf("/")+1)+r.path:i.path=r.path:i.path="/"+r.path,i.path=t(i.path)),i.query=r.query):(i.path=e.path,void 0!==r.query?i.query=r.query:i.query=e.query),i.userinfo=e.userinfo,i.host=e.host,i.port=e.port),i.scheme=e.scheme),i.fragment=r.fragment,i}function l(e,n){const o={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:""},i=Object.assign({},n),s=[],c=a(i.scheme||o.scheme);c&&c.serialize&&c.serialize(o,i),void 0!==o.path&&(i.skipEscape?o.path=unescape(o.path):(o.path=escape(o.path),void 0!==o.scheme&&(o.path=o.path.split("%3A").join(":")))),"suffix"!==i.reference&&o.scheme&&s.push(o.scheme,":");const l=r(o);if(void 0!==l&&("suffix"!==i.reference&&s.push("//"),s.push(l),o.path&&"/"!==o.path[0]&&s.push("/")),void 0!==o.path){let e=o.path;i.absolutePath||c&&c.absolutePath||(e=t(e)),void 0===l&&"/"===e[0]&&"/"===e[1]&&(e="/%2F"+e.slice(2)),s.push(e)}return void 0!==o.query&&s.push("?",o.query),void 0!==o.fragment&&s.push("#",o.fragment),s.join("")}const d=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function u(t,r){const n=Object.assign({},r),s={scheme:void 0,userinfo:void 0,host:"",port:void 0,path:"",query:void 0,fragment:void 0};let c=!1;"suffix"===n.reference&&(t=n.scheme?n.scheme+":"+t:"//"+t);const l=t.match(d);if(l){if(s.scheme=l[1],s.userinfo=l[3],s.host=l[4],s.port=parseInt(l[5],10),s.path=l[6]||"",s.query=l[7],s.fragment=l[8],isNaN(s.port)&&(s.port=l[5]),s.host){if(!1===o(s.host)){const t=e(s.host);s.host=t.host.toLowerCase(),c=t.isIPV6}else c=!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);if(!(n.unicodeSupport||r&&r.unicodeSupport)&&s.host&&(n.domainHost||r&&r.domainHost)&&!1===c&&i(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)&&(-1!==t.indexOf("%")&&(void 0!==s.scheme&&(s.scheme=unescape(s.scheme)),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 p={SCHEMES:s,normalize:function(e,t){return"string"==typeof e?e=l(u(e,t),t):"object"==typeof e&&(e=u(l(e,t),t)),e},resolve:function(e,t,r){const n=r?Object.assign({scheme:"null"},r):{scheme:"null"},o=c(u(e,n),u(t,n),n,!0);return n.skipEscape=!0,l(o,n)},resolveComponent:c,equal:function(e,t,r){return"string"==typeof e?(e=unescape(e),e=l(n(u(e,r),!0),{...r,skipEscape:!0})):"object"==typeof e&&(e=l(n(e,!0),{...r,skipEscape:!0})),"string"==typeof t?(t=unescape(t),t=l(n(u(t,r),!0),{...r,skipEscape:!0})):"object"==typeof t&&(t=l(n(t,!0),{...r,skipEscape:!0})),e.toLowerCase()===t.toLowerCase()},serialize:l,parse:u};return eo.exports=p,eo.exports.default=p,eo.exports.fastUri=p,eo.exports}function no(){return Xn||(Xn=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=Dn();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=Yr();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 n=Fn(),o=Un(),i=ln(),s=Vn(),a=Yr(),c=Tn(),l=fn(),d=Zr(),u=Zn,p=function(){if(Jn)return Qn;Jn=1,Object.defineProperty(Qn,"__esModule",{value:!0});const e=ro();return e.code='require("ajv/dist/runtime/uri").default',Qn.default=e,Qn}(),h=(e,t)=>new RegExp(e,t);h.code="new RegExp";const f=["removeAdditional","useDefaults","coerceTypes"],m=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,n,o,i,s,a,c,l,d,u,f,m,g,y,v,b,$,w,E,S,P,_,L,k;const C=e.strict,N=null===(t=e.code)||void 0===t?void 0:t.optimize,I=!0===N||void 0===N?1:N||0,O=null!==(n=null===(r=e.code)||void 0===r?void 0:r.regExp)&&void 0!==n?n:h,A=null!==(o=e.uriResolver)&&void 0!==o?o:p.default;return{strictSchema:null===(s=null!==(i=e.strictSchema)&&void 0!==i?i:C)||void 0===s||s,strictNumbers:null===(c=null!==(a=e.strictNumbers)&&void 0!==a?a:C)||void 0===c||c,strictTypes:null!==(d=null!==(l=e.strictTypes)&&void 0!==l?l:C)&&void 0!==d?d:"log",strictTuples:null!==(f=null!==(u=e.strictTuples)&&void 0!==u?u:C)&&void 0!==f?f:"log",strictRequired:null!==(g=null!==(m=e.strictRequired)&&void 0!==m?m:C)&&void 0!==g&&g,code:e.code?{...e.code,optimize:I,regExp:O}:{optimize:I,regExp:O},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=e.schemaId)&&void 0!==E?E:"$id",addUsedSchema:null===(S=e.addUsedSchema)||void 0===S||S,validateSchema:null===(P=e.validateSchema)||void 0===P||P,validateFormats:null===(_=e.validateFormats)||void 0===_||_,unicodeRegExp:null===(L=e.unicodeRegExp)||void 0===L||L,int32range:null===(k=e.int32range)||void 0===k||k,uriResolver:A}}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 a.ValueScope({scope:{},prefixes:m,es5:t,lines:r}),this.logger=function(e){if(!1===e)return L;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 n=e.validateFormats;e.validateFormats=!1,this.RULES=(0,i.getRules)(),$.call(this,g,e,"NOT SUPPORTED"),$.call(this,y,e,"DEPRECATED","warn"),this._metaOpts=_.call(this),e.formats&&S.call(this),this._addVocabularies(),this._addDefaultMetaSchema(),e.keywords&&P.call(this,e.keywords),"object"==typeof e.meta&&this.addMetaSchema(e.meta),E.call(this),e.validateFormats=n}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:e,meta:t,schemaId:r}=this.opts;let n=u;"id"===r&&(n={...u},n.id=n.$id,delete n.$id),t&&e&&this.addMetaSchema(n,n[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 n=r(t);return"$async"in r||(this.errors=r.errors),n}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 n.call(this,e,t);async function n(e,t){await i.call(this,e.$schema);const r=this._addSchema(e,t);return r.validate||s.call(this,r)}async function i(e){e&&!this.getSchema(e)&&await n.call(this,{$ref:e},!0)}async function s(e){try{return this._compileSchemaEnv(e)}catch(t){if(!(t instanceof o.default))throw t;return a.call(this,t),await c.call(this,t.missingSchema),s.call(this,e)}}function a({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 l.call(this,e);this.refs[e]||await i.call(this,r.$schema),this.refs[e]||this.addSchema(r,e,t)}async function l(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,n=this.opts.validateSchema){if(Array.isArray(e)){for(const t of e)this.addSchema(t,void 0,r,n);return this}let o;if("object"==typeof e){const{schemaId:t}=this.opts;if(o=e[t],void 0!==o&&"string"!=typeof o)throw new Error(`schema ${t} must be string`)}return t=(0,c.normalizeId)(t||o),this._checkUnique(t),this.schemas[t]=this._addSchema(e,r,t,n,!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 n=this.validate(r,e);if(!n&&t){const e="schema is invalid: "+this.errorsText();if("log"!==this.opts.validateSchema)throw new Error(e);this.logger.error(e)}return n}getSchema(e){let t;for(;"string"==typeof(t=w.call(this,e));)e=t;if(void 0===t){const{schemaId:r}=this.opts,n=new s.SchemaEnv({schema:{},schemaId:r});if(t=s.resolveSchema.call(this,n,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(C.call(this,r,t),!t)return(0,d.eachItem)(r,e=>N.call(this,e)),this;O.call(this,t);const n={...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)};return(0,d.eachItem)(r,0===n.type.length?e=>N.call(this,e,n):e=>n.type.forEach(t=>N.call(this,e,n,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 n of t){const t=n.split("/").slice(1);let o=e;for(const e of t)o=o[e];for(const e in r){const t=r[e];if("object"!=typeof t)continue;const{$data:n}=t.definition,i=o[e];n&&i&&(o[e]=x(i))}}return e}_removeAllSchemas(e,t){for(const r in e){const n=e[r];t&&!t.test(r)||("string"==typeof n?delete e[r]:n&&!n.meta&&(this._cache.delete(n.schema),delete e[r]))}}_addSchema(e,t,r,n=this.opts.validateSchema,o=this.opts.addUsedSchema){let i;const{schemaId:a}=this.opts;if("object"==typeof e)i=e[a];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 l=this._cache.get(e);if(void 0!==l)return l;r=(0,c.normalizeId)(i||r);const d=c.getSchemaRefs.call(this,e,r);return l=new s.SchemaEnv({schema:e,schemaId:a,meta:t,baseId:r,localRefs:d}),this._cache.set(l.schema,l),o&&!r.startsWith("#")&&(r&&this._checkUnique(r),this.refs[r]=l),n&&this.validateSchema(e,!0),l}_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,n="error"){for(const o in e){const i=o;i in t&&this.logger[n](`${r}: option ${o}. ${e[i]}`)}}function w(e){return e=(0,c.normalizeId)(e),this.schemas[e]||this.refs[e]}function E(){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 S(){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 _(){const e={...this.opts};for(const t of f)delete e[t];return e}b.ValidationError=n.default,b.MissingRefError=o.default,e.default=b;const L={log(){},warn(){},error(){}};const k=/^[a-z_$][a-z0-9_$:-]*$/i;function C(e,t){const{RULES:r}=this;if((0,d.eachItem)(e,e=>{if(r.keywords[e])throw new Error(`Keyword ${e} is already defined`);if(!k.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 n;const o=null==t?void 0:t.post;if(r&&o)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:i}=this;let s=o?i.post:i.rules.find(({type:e})=>e===r);if(s||(s={type:r,rules:[]},i.rules.push(s)),i.keywords[e]=!0,!t)return;const a={keyword:e,definition:{...t,type:(0,l.getJSONTypes)(t.type),schemaType:(0,l.getJSONTypes)(t.schemaType)}};t.before?I.call(this,s,a,t.before):s.rules.push(a),i.all[e]=a,null===(n=t.implements)||void 0===n||n.forEach(e=>this.addKeyword(e))}function I(e,t,r){const n=e.rules.findIndex(e=>e.keyword===r);n>=0?e.rules.splice(n,0,t):(e.rules.push(t),this.logger.warn(`rule ${r} is not defined`))}function O(e){let{metaSchema:t}=e;void 0!==t&&(e.$data&&this.opts.$data&&(t=x(t)),e.validateSchema=this.compile(t,!0))}const A={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function x(e){return{anyOf:[e,A]}}}(Fr)),Fr}var oo,io={},so={},ao={};var co,lo,uo={};function po(){if(co)return uo;co=1,Object.defineProperty(uo,"__esModule",{value:!0}),uo.callRef=uo.getValidate=void 0;const e=Un(),t=wn(),r=Yr(),n=nn(),o=Vn(),i=Zr(),s={keyword:"$ref",schemaType:"string",code(t){const{gen:n,schema:i,it:s}=t,{baseId:l,schemaEnv:d,validateName:u,opts:p,self:h}=s,{root:f}=d;if(("#"===i||"#/"===i)&&l===f.baseId)return function(){if(d===f)return c(t,u,d,d.$async);const e=n.scopeValue("root",{ref:f});return c(t,r._`${e}.validate`,f,f.$async)}();const m=o.resolveRef.call(h,f,l,i);if(void 0===m)throw new e.default(s.opts.uriResolver,l,i);return m instanceof o.SchemaEnv?function(e){const r=a(t,e);c(t,r,e,e.$async)}(m):function(e){const o=n.scopeValue("schema",!0===p.code.source?{ref:e,code:(0,r.stringify)(e)}:{ref:e}),s=n.name("valid"),a=t.subschema({schema:e,dataTypes:[],schemaPath:r.nil,topSchemaRef:o,errSchemaPath:i},s);t.mergeEvaluated(a),t.ok(s)}(m)}};function a(e,t){const{gen:n}=e;return t.validate?n.scopeValue("validate",{ref:t.validate}):r._`${n.scopeValue("wrapper",{ref:t})}.validate`}function c(e,o,s,a){const{gen:c,it:l}=e,{allErrors:d,schemaEnv:u,opts:p}=l,h=p.passContext?n.default.this:r.nil;function f(e){const t=r._`${e}.errors`;c.assign(n.default.vErrors,r._`${n.default.vErrors} === null ? ${t} : ${n.default.vErrors}.concat(${t})`),c.assign(n.default.errors,r._`${n.default.vErrors}.length`)}function m(e){var t;if(!l.opts.unevaluated)return;const n=null===(t=null==s?void 0:s.validate)||void 0===t?void 0:t.evaluated;if(!0!==l.props)if(n&&!n.dynamicProps)void 0!==n.props&&(l.props=i.mergeEvaluated.props(c,n.props,l.props));else{const t=c.var("props",r._`${e}.evaluated.props`);l.props=i.mergeEvaluated.props(c,t,l.props,r.Name)}if(!0!==l.items)if(n&&!n.dynamicItems)void 0!==n.items&&(l.items=i.mergeEvaluated.items(c,n.items,l.items));else{const t=c.var("items",r._`${e}.evaluated.items`);l.items=i.mergeEvaluated.items(c,t,l.items,r.Name)}}a?function(){if(!u.$async)throw new Error("async schema referenced by sync schema");const n=c.let("valid");c.try(()=>{c.code(r._`await ${(0,t.callValidateCode)(e,o,h)}`),m(o),d||c.assign(n,!0)},e=>{c.if(r._`!(${e} instanceof ${l.ValidationError})`,()=>c.throw(e)),f(e),d||c.assign(n,!1)}),e.ok(n)}():e.result((0,t.callValidateCode)(e,o,h),()=>m(o),()=>f(o))}return uo.getValidate=a,uo.callRef=c,uo.default=s,uo}function ho(){if(lo)return so;lo=1,Object.defineProperty(so,"__esModule",{value:!0});const e=function(){if(oo)return ao;oo=1,Object.defineProperty(ao,"__esModule",{value:!0});const e={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return ao.default=e,ao}(),t=po(),r=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",e.default,t.default];return so.default=r,so}var fo,mo={},go={};var yo,vo={};var bo,$o,wo={},Eo={};function So(){if($o)return wo;$o=1,Object.defineProperty(wo,"__esModule",{value:!0});const e=Yr(),t=Zr(),r=function(){if(bo)return Eo;function e(e){const t=e.length;let r,n=0,o=0;for(;o<t;)n++,r=e.charCodeAt(o++),r>=55296&&r<=56319&&o<t&&(r=e.charCodeAt(o),56320==(64512&r)&&o++);return n}return bo=1,Object.defineProperty(Eo,"__esModule",{value:!0}),Eo.default=e,e.code='require("ajv/dist/runtime/ucs2length").default',Eo}(),n={message({keyword:t,schemaCode:r}){const n="maxLength"===t?"more":"fewer";return e.str`must NOT have ${n} than ${r} characters`},params:({schemaCode:t})=>e._`{limit: ${t}}`},o={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:!0,error:n,code(n){const{keyword:o,data:i,schemaCode:s,it:a}=n,c="maxLength"===o?e.operators.GT:e.operators.LT,l=!1===a.opts.unicode?e._`${i}.length`:e._`${(0,t.useFunc)(n.gen,r.default)}(${i})`;n.fail$data(e._`${l} ${c} ${s}`)}};return wo.default=o,wo}var Po,_o={};var Lo,ko={};var Co,No={};function Io(){if(Co)return No;Co=1,Object.defineProperty(No,"__esModule",{value:!0});const e=wn(),t=Yr(),r=Zr(),n={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(n){const{gen:o,schema:i,schemaCode:s,data:a,$data:c,it:l}=n,{opts:d}=l;if(!c&&0===i.length)return;const u=i.length>=d.loopRequired;if(l.allErrors?function(){if(u||c)n.block$data(t.nil,p);else for(const t of i)(0,e.checkReportMissingProp)(n,t)}():function(){const r=o.let("missing");if(u||c){const i=o.let("valid",!0);n.block$data(i,()=>function(r,i){n.setParams({missingProperty:r}),o.forOf(r,s,()=>{o.assign(i,(0,e.propertyInData)(o,a,r,d.ownProperties)),o.if((0,t.not)(i),()=>{n.error(),o.break()})},t.nil)}(r,i)),n.ok(i)}else o.if((0,e.checkMissingProp)(n,i,r)),(0,e.reportMissingProp)(n,r),o.else()}(),d.strictRequired){const e=n.parentSchema.properties,{definedProperties:t}=n.it;for(const n of i)if(void 0===(null==e?void 0:e[n])&&!t.has(n)){const e=`required property "${n}" is not defined at "${l.schemaEnv.baseId+l.errSchemaPath}" (strictRequired)`;(0,r.checkStrictMode)(l,e,l.opts.strictRequired)}}function p(){o.forOf("prop",s,t=>{n.setParams({missingProperty:t}),o.if((0,e.noPropertyInData)(o,a,t,d.ownProperties),()=>n.error())})}}};return No.default=n,No}var Oo,Ao={};var xo,To,Do={},jo={};function Ro(){if(xo)return jo;xo=1,Object.defineProperty(jo,"__esModule",{value:!0});const e=Cn();return e.code='require("ajv/dist/runtime/equal").default',jo.default=e,jo}function Fo(){if(To)return Do;To=1,Object.defineProperty(Do,"__esModule",{value:!0});const e=fn(),t=Yr(),r=Zr(),n=Ro(),o={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(o){const{gen:i,data:s,$data:a,schema:c,parentSchema:l,schemaCode:d,it:u}=o;if(!a&&!c)return;const p=i.let("valid"),h=l.items?(0,e.getSchemaTypes)(l.items):[];function f(r,n){const a=i.name("item"),c=(0,e.checkDataTypes)(h,a,u.opts.strictNumbers,e.DataType.Wrong),l=i.const("indices",t._`{}`);i.for(t._`;${r}--;`,()=>{i.let(a,t._`${s}[${r}]`),i.if(c,t._`continue`),h.length>1&&i.if(t._`typeof ${a} == "string"`,t._`${a} += "_"`),i.if(t._`typeof ${l}[${a}] == "number"`,()=>{i.assign(n,t._`${l}[${a}]`),o.error(),i.assign(p,!1).break()}).code(t._`${l}[${a}] = ${r}`)})}function m(e,a){const c=(0,r.useFunc)(i,n.default),l=i.name("outer");i.label(l).for(t._`;${e}--;`,()=>i.for(t._`${a} = ${e}; ${a}--;`,()=>i.if(t._`${c}(${s}[${e}], ${s}[${a}])`,()=>{o.error(),i.assign(p,!1).break(l)})))}o.block$data(p,function(){const e=i.let("i",t._`${s}.length`),r=i.let("j");o.setParams({i:e,j:r}),i.assign(p,!0),i.if(t._`${e} > 1`,()=>(h.length>0&&!h.some(e=>"object"===e||"array"===e)?f:m)(e,r))},t._`${d} === false`),o.ok(p)}};return Do.default=o,Do}var Mo,Go={};var Uo,Bo,zo={};function Vo(){if(Uo)return zo;Uo=1,Object.defineProperty(zo,"__esModule",{value:!0});const e=Yr(),t=Zr(),r=Ro(),n={keyword:"enum",schemaType:"array",$data:!0,error:{message:"must be equal to one of the allowed values",params:({schemaCode:t})=>e._`{allowedValues: ${t}}`},code(n){const{gen:o,data:i,$data:s,schema:a,schemaCode:c,it:l}=n;if(!s&&0===a.length)throw new Error("enum must have non-empty array");const d=a.length>=l.opts.loopEnum;let u;const p=()=>null!=u?u:u=(0,t.useFunc)(o,r.default);let h;if(d||s)h=o.let("valid"),n.block$data(h,function(){o.assign(h,!1),o.forOf("v",c,t=>o.if(e._`${p()}(${i}, ${t})`,()=>o.assign(h,!0).break()))});else{if(!Array.isArray(a))throw new Error("ajv implementation error");const t=o.const("vSchema",c);h=(0,e.or)(...a.map((r,n)=>function(t,r){const n=a[r];return"object"==typeof n&&null!==n?e._`${p()}(${i}, ${t}[${r}])`:e._`${i} === ${n}`}(t,n)))}n.pass(h)}};return zo.default=n,zo}function Ho(){if(Bo)return mo;Bo=1,Object.defineProperty(mo,"__esModule",{value:!0});const e=function(){if(fo)return go;fo=1,Object.defineProperty(go,"__esModule",{value:!0});const e=Yr(),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}},n={message:({keyword:t,schemaCode:n})=>e.str`must be ${r[t].okStr} ${n}`,params:({keyword:t,schemaCode:n})=>e._`{comparison: ${r[t].okStr}, limit: ${n}}`},o={keyword:Object.keys(r),type:"number",schemaType:"number",$data:!0,error:n,code(t){const{keyword:n,data:o,schemaCode:i}=t;t.fail$data(e._`${o} ${r[n].fail} ${i} || isNaN(${o})`)}};return go.default=o,go}(),t=function(){if(yo)return vo;yo=1,Object.defineProperty(vo,"__esModule",{value:!0});const e=Yr(),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:n,schemaCode:o,it:i}=t,s=i.opts.multipleOfPrecision,a=r.let("res"),c=s?e._`Math.abs(Math.round(${a}) - ${a}) > 1e-${s}`:e._`${a} !== parseInt(${a})`;t.fail$data(e._`(${o} === 0 || (${a} = ${n}/${o}, ${c}))`)}};return vo.default=t,vo}(),r=So(),n=function(){if(Po)return _o;Po=1,Object.defineProperty(_o,"__esModule",{value:!0});const e=wn(),t=Yr(),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:n,$data:o,schema:i,schemaCode:s,it:a}=r,c=a.opts.unicodeRegExp?"u":"",l=o?t._`(new RegExp(${s}, ${c}))`:(0,e.usePattern)(r,i);r.fail$data(t._`!${l}.test(${n})`)}};return _o.default=r,_o}(),o=function(){if(Lo)return ko;Lo=1,Object.defineProperty(ko,"__esModule",{value:!0});const e=Yr(),t={message({keyword:t,schemaCode:r}){const n="maxProperties"===t?"more":"fewer";return e.str`must NOT have ${n} 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:n,schemaCode:o}=t,i="maxProperties"===r?e.operators.GT:e.operators.LT;t.fail$data(e._`Object.keys(${n}).length ${i} ${o}`)}};return ko.default=r,ko}(),i=Io(),s=function(){if(Oo)return Ao;Oo=1,Object.defineProperty(Ao,"__esModule",{value:!0});const e=Yr(),t={message({keyword:t,schemaCode:r}){const n="maxItems"===t?"more":"fewer";return e.str`must NOT have ${n} 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:n,schemaCode:o}=t,i="maxItems"===r?e.operators.GT:e.operators.LT;t.fail$data(e._`${n}.length ${i} ${o}`)}};return Ao.default=r,Ao}(),a=Fo(),c=function(){if(Mo)return Go;Mo=1,Object.defineProperty(Go,"__esModule",{value:!0});const e=Yr(),t=Zr(),r=Ro(),n={keyword:"const",$data:!0,error:{message:"must be equal to constant",params:({schemaCode:t})=>e._`{allowedValue: ${t}}`},code(n){const{gen:o,data:i,$data:s,schemaCode:a,schema:c}=n;s||c&&"object"==typeof c?n.fail$data(e._`!${(0,t.useFunc)(o,r.default)}(${i}, ${a})`):n.fail(e._`${c} !== ${i}`)}};return Go.default=n,Go}(),l=Vo(),d=[e.default,t.default,r.default,n.default,o.default,i.default,s.default,a.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},c.default,l.default];return mo.default=d,mo}var qo,Wo={},Ko={};function Yo(){if(qo)return Ko;qo=1,Object.defineProperty(Ko,"__esModule",{value:!0}),Ko.validateAdditionalItems=void 0;const e=Yr(),t=Zr(),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:o}=e,{items:i}=r;Array.isArray(i)?n(e,i):(0,t.checkStrictMode)(o,'"additionalItems" is ignored when "items" is not an array of schemas')}};function n(r,n){const{gen:o,schema:i,data:s,keyword:a,it:c}=r;c.items=!0;const l=o.const("len",e._`${s}.length`);if(!1===i)r.setParams({len:n.length}),r.pass(e._`${l} <= ${n.length}`);else if("object"==typeof i&&!(0,t.alwaysValidSchema)(c,i)){const i=o.var("valid",e._`${l} <= ${n.length}`);o.if((0,e.not)(i),()=>function(i){o.forRange("i",n.length,l,n=>{r.subschema({keyword:a,dataProp:n,dataPropType:t.Type.Num},i),c.allErrors||o.if((0,e.not)(i),()=>o.break())})}(i)),r.ok(i)}}return Ko.validateAdditionalItems=n,Ko.default=r,Ko}var Jo,Xo,Zo={},Qo={};function ei(){if(Jo)return Qo;Jo=1,Object.defineProperty(Qo,"__esModule",{value:!0}),Qo.validateTuple=void 0;const e=Yr(),t=Zr(),r=wn(),n={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(e){const{schema:n,it:i}=e;if(Array.isArray(n))return o(e,"additionalItems",n);i.items=!0,(0,t.alwaysValidSchema)(i,n)||e.ok((0,r.validateArray)(e))}};function o(r,n,o=r.schema){const{gen:i,parentSchema:s,data:a,keyword:c,it:l}=r;!function(e){const{opts:r,errSchemaPath:i}=l,s=o.length,a=s===e.minItems&&(s===e.maxItems||!1===e[n]);if(r.strictTuples&&!a){const e=`"${c}" is ${s}-tuple, but minItems or maxItems/${n} are not specified or different at path "${i}"`;(0,t.checkStrictMode)(l,e,r.strictTuples)}}(s),l.opts.unevaluated&&o.length&&!0!==l.items&&(l.items=t.mergeEvaluated.items(i,o.length,l.items));const d=i.name("valid"),u=i.const("len",e._`${a}.length`);o.forEach((n,o)=>{(0,t.alwaysValidSchema)(l,n)||(i.if(e._`${u} > ${o}`,()=>r.subschema({keyword:c,schemaProp:o,dataProp:o},d)),r.ok(d))})}return Qo.validateTuple=o,Qo.default=n,Qo}var ti,ri={};var ni,oi={};function ii(){if(ni)return oi;ni=1,Object.defineProperty(oi,"__esModule",{value:!0});const e=Yr(),t=Zr(),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:n,schema:o,parentSchema:i,data:s,it:a}=r;let c,l;const{minContains:d,maxContains:u}=i;a.opts.next?(c=void 0===d?1:d,l=u):c=1;const p=n.const("len",e._`${s}.length`);if(r.setParams({min:c,max:l}),void 0===l&&0===c)return void(0,t.checkStrictMode)(a,'"minContains" == 0 without "maxContains": "contains" keyword ignored');if(void 0!==l&&c>l)return(0,t.checkStrictMode)(a,'"minContains" > "maxContains" is always invalid'),void r.fail();if((0,t.alwaysValidSchema)(a,o)){let t=e._`${p} >= ${c}`;return void 0!==l&&(t=e._`${t} && ${p} <= ${l}`),void r.pass(t)}a.items=!0;const h=n.name("valid");function f(){const t=n.name("_valid"),r=n.let("count",0);m(t,()=>n.if(t,()=>function(t){n.code(e._`${t}++`),void 0===l?n.if(e._`${t} >= ${c}`,()=>n.assign(h,!0).break()):(n.if(e._`${t} > ${l}`,()=>n.assign(h,!1).break()),1===c?n.assign(h,!0):n.if(e._`${t} >= ${c}`,()=>n.assign(h,!0)))}(r)))}function m(e,o){n.forRange("i",0,p,n=>{r.subschema({keyword:"contains",dataProp:n,dataPropType:t.Type.Num,compositeRule:!0},e),o()})}void 0===l&&1===c?m(h,()=>n.if(h,()=>n.break())):0===c?(n.let(h,!0),void 0!==l&&n.if(e._`${s}.length > 0`,f)):(n.let(h,!1),f()),r.result(h,()=>r.reset())}};return oi.default=r,oi}var si,ai={};function ci(){return si||(si=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=Yr(),r=Zr(),n=wn();e.error={message:({params:{property:e,depsCount:r,deps:n}})=>{const o=1===r?"property":"properties";return t.str`must have ${o} ${n} when property ${e} is present`},params:({params:{property:e,depsCount:r,deps:n,missingProperty:o}})=>t._`{property: ${e},
|
|
5
5
|
missingProperty: ${o},
|
|
6
6
|
depsCount: ${r},
|
|
7
|
-
deps: ${n}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(e){const[t,r]=function({schema:e}){const t={},r={};for(const n in e){if("__proto__"===n)continue;(Array.isArray(e[n])?t:r)[n]=e[n]}return[t,r]}(e);i(e,t),s(e,r)}};function i(e,r=e.schema){const{gen:o,data:i,it:s}=e;if(0===Object.keys(r).length)return;const a=o.let("missing");for(const c in r){const l=r[c];if(0===l.length)continue;const d=(0,n.propertyInData)(o,i,c,s.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(", ")}),s.allErrors?o.if(d,()=>{for(const t of l)(0,n.checkReportMissingProp)(e,t)}):(o.if(t._`${d} && (${(0,n.checkMissingProp)(e,l,a)})`),(0,n.reportMissingProp)(e,a),o.else())}}function s(e,t=e.schema){const{gen:o,data:i,keyword:s,it:a}=e,c=o.name("valid");for(const l in t)(0,r.alwaysValidSchema)(a,t[l])||(o.if((0,n.propertyInData)(o,i,l,a.opts.ownProperties),()=>{const t=e.subschema({keyword:s,schemaProp:l},c);e.mergeValidEvaluated(t,c)},()=>o.var(c,!0)),e.ok(c))}e.validatePropertyDeps=i,e.validateSchemaDeps=s,e.default=o}(li)),li}var ui,pi={};var hi,fi={};function mi(){if(hi)return fi;hi=1,Object.defineProperty(fi,"__esModule",{value:!0});const e=wn(),t=Yr(),r=nn(),n=Zr(),o={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(o){const{gen:i,schema:s,parentSchema:a,data:c,errsCount:l,it:d}=o;if(!l)throw new Error("ajv implementation error");const{allErrors:u,opts:p}=d;if(d.props=!0,"all"!==p.removeAdditional&&(0,n.alwaysValidSchema)(d,s))return;const h=(0,e.allSchemaProperties)(a.properties),f=(0,e.allSchemaProperties)(a.patternProperties);function m(e){i.code(t._`delete ${c}[${e}]`)}function g(e){if("all"===p.removeAdditional||p.removeAdditional&&!1===s)m(e);else{if(!1===s)return o.setParams({additionalProperty:e}),o.error(),void(u||i.break());if("object"==typeof s&&!(0,n.alwaysValidSchema)(d,s)){const r=i.name("valid");"failing"===p.removeAdditional?(y(e,r,!1),i.if((0,t.not)(r),()=>{o.reset(),m(e)})):(y(e,r),u||i.if((0,t.not)(r),()=>i.break()))}}}function y(e,t,r){const i={keyword:"additionalProperties",dataProp:e,dataPropType:n.Type.Str};!1===r&&Object.assign(i,{compositeRule:!0,createErrors:!1,allErrors:!1}),o.subschema(i,t)}i.forIn("key",c,r=>{h.length||f.length?i.if(function(r){let s;if(h.length>8){const t=(0,n.schemaRefOrVal)(d,a.properties,"properties");s=(0,e.isOwnProperty)(i,t,r)}else s=h.length?(0,t.or)(...h.map(e=>t._`${r} === ${e}`)):t.nil;return f.length&&(s=(0,t.or)(s,...f.map(n=>t._`${(0,e.usePattern)(o,n)}.test(${r})`))),(0,t.not)(s)}(r),()=>g(r)):g(r)}),o.ok(t._`${l} === ${r.default.errors}`)}};return fi.default=o,fi}var gi,yi={};var vi,bi={};var $i,wi={};var Ei,Si={};var Pi,_i={};var Li,Ci={};var ki,Ni={};var Ii,Oi,Ai={};function Ti(){if(Oi)return Yo;Oi=1,Object.defineProperty(Yo,"__esModule",{value:!0});const e=Xo(),t=function(){if(Qo)return ei;Qo=1,Object.defineProperty(ei,"__esModule",{value:!0});const e=ri(),t={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,e.validateTuple)(t,"items")};return ei.default=t,ei}(),r=ri(),n=function(){if(ni)return oi;ni=1,Object.defineProperty(oi,"__esModule",{value:!0});const e=Yr(),t=Zr(),r=wn(),n=Xo(),o={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:o,parentSchema:i,it:s}=e,{prefixItems:a}=i;s.items=!0,(0,t.alwaysValidSchema)(s,o)||(a?(0,n.validateAdditionalItems)(e,a):e.ok((0,r.validateArray)(e)))}};return oi.default=o,oi}(),o=ai(),i=di(),s=function(){if(ui)return pi;ui=1,Object.defineProperty(pi,"__esModule",{value:!0});const e=Yr(),t=Zr(),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:n,schema:o,data:i,it:s}=r;if((0,t.alwaysValidSchema)(s,o))return;const a=n.name("valid");n.forIn("key",i,t=>{r.setParams({propertyName:t}),r.subschema({keyword:"propertyNames",data:t,dataTypes:["string"],propertyName:t,compositeRule:!0},a),n.if((0,e.not)(a),()=>{r.error(!0),s.allErrors||n.break()})}),r.ok(a)}};return pi.default=r,pi}(),a=mi(),c=function(){if(gi)return yi;gi=1,Object.defineProperty(yi,"__esModule",{value:!0});const e=Dn(),t=wn(),r=Zr(),n=mi(),o={keyword:"properties",type:"object",schemaType:"object",code(o){const{gen:i,schema:s,parentSchema:a,data:c,it:l}=o;"all"===l.opts.removeAdditional&&void 0===a.additionalProperties&&n.default.code(new e.KeywordCxt(l,n.default,"additionalProperties"));const d=(0,t.allSchemaProperties)(s);for(const e of d)l.definedProperties.add(e);l.opts.unevaluated&&d.length&&!0!==l.props&&(l.props=r.mergeEvaluated.props(i,(0,r.toHash)(d),l.props));const u=d.filter(e=>!(0,r.alwaysValidSchema)(l,s[e]));if(0===u.length)return;const p=i.name("valid");for(const e of u)h(e)?f(e):(i.if((0,t.propertyInData)(i,c,e,l.opts.ownProperties)),f(e),l.allErrors||i.else().var(p,!0),i.endIf()),o.it.definedProperties.add(e),o.ok(p);function h(e){return l.opts.useDefaults&&!l.compositeRule&&void 0!==s[e].default}function f(e){o.subschema({keyword:"properties",schemaProp:e,dataProp:e},p)}}};return yi.default=o,yi}(),l=function(){if(vi)return bi;vi=1,Object.defineProperty(bi,"__esModule",{value:!0});const e=wn(),t=Yr(),r=Zr(),n=Zr(),o={keyword:"patternProperties",type:"object",schemaType:"object",code(o){const{gen:i,schema:s,data:a,parentSchema:c,it:l}=o,{opts:d}=l,u=(0,e.allSchemaProperties)(s),p=u.filter(e=>(0,r.alwaysValidSchema)(l,s[e]));if(0===u.length||p.length===u.length&&(!l.opts.unevaluated||!0===l.props))return;const h=d.strictSchema&&!d.allowMatchingProperties&&c.properties,f=i.name("valid");!0===l.props||l.props instanceof t.Name||(l.props=(0,n.evaluatedPropsToName)(i,l.props));const{props:m}=l;function g(e){for(const t in h)new RegExp(e).test(t)&&(0,r.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function y(r){i.forIn("key",a,s=>{i.if(t._`${(0,e.usePattern)(o,r)}.test(${s})`,()=>{const e=p.includes(r);e||o.subschema({keyword:"patternProperties",schemaProp:r,dataProp:s,dataPropType:n.Type.Str},f),l.opts.unevaluated&&!0!==m?i.assign(t._`${m}[${s}]`,!0):e||l.allErrors||i.if((0,t.not)(f),()=>i.break())})})}!function(){for(const e of u)h&&g(e),l.allErrors?y(e):(i.var(f,!0),y(e),i.if(f))}()}};return bi.default=o,bi}(),d=function(){if($i)return wi;$i=1,Object.defineProperty(wi,"__esModule",{value:!0});const e=Zr(),t={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){const{gen:r,schema:n,it:o}=t;if((0,e.alwaysValidSchema)(o,n))return void t.fail();const i=r.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),t.failResult(i,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};return wi.default=t,wi}(),u=function(){if(Ei)return Si;Ei=1,Object.defineProperty(Si,"__esModule",{value:!0});const e={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:wn().validateUnion,error:{message:"must match a schema in anyOf"}};return Si.default=e,Si}(),p=function(){if(Pi)return _i;Pi=1,Object.defineProperty(_i,"__esModule",{value:!0});const e=Yr(),t=Zr(),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:n,schema:o,parentSchema:i,it:s}=r;if(!Array.isArray(o))throw new Error("ajv implementation error");if(s.opts.discriminator&&i.discriminator)return;const a=o,c=n.let("valid",!1),l=n.let("passing",null),d=n.name("_valid");r.setParams({passing:l}),n.block(function(){a.forEach((o,i)=>{let a;(0,t.alwaysValidSchema)(s,o)?n.var(d,!0):a=r.subschema({keyword:"oneOf",schemaProp:i,compositeRule:!0},d),i>0&&n.if(e._`${d} && ${c}`).assign(c,!1).assign(l,e._`[${l}, ${i}]`).else(),n.if(d,()=>{n.assign(c,!0),n.assign(l,i),a&&r.mergeEvaluated(a,e.Name)})})}),r.result(c,()=>r.reset(),()=>r.error(!0))}};return _i.default=r,_i}(),h=function(){if(Li)return Ci;Li=1,Object.defineProperty(Ci,"__esModule",{value:!0});const e=Zr(),t={keyword:"allOf",schemaType:"array",code(t){const{gen:r,schema:n,it:o}=t;if(!Array.isArray(n))throw new Error("ajv implementation error");const i=r.name("valid");n.forEach((r,n)=>{if((0,e.alwaysValidSchema)(o,r))return;const s=t.subschema({keyword:"allOf",schemaProp:n},i);t.ok(i),t.mergeEvaluated(s)})}};return Ci.default=t,Ci}(),f=function(){if(ki)return Ni;ki=1,Object.defineProperty(Ni,"__esModule",{value:!0});const e=Yr(),t=Zr(),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:o,parentSchema:i,it:s}=r;void 0===i.then&&void 0===i.else&&(0,t.checkStrictMode)(s,'"if" without "then" and "else" is ignored');const a=n(s,"then"),c=n(s,"else");if(!a&&!c)return;const l=o.let("valid",!0),d=o.name("_valid");if(function(){const e=r.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},d);r.mergeEvaluated(e)}(),r.reset(),a&&c){const e=o.let("ifClause");r.setParams({ifClause:e}),o.if(d,u("then",e),u("else",e))}else a?o.if(d,u("then")):o.if((0,e.not)(d),u("else"));function u(t,n){return()=>{const i=r.subschema({keyword:t},d);o.assign(l,d),r.mergeValidEvaluated(i,l),n?o.assign(n,e._`${t}`):r.setParams({ifClause:t})}}r.pass(l,()=>r.error(!0))}};function n(e,r){const n=e.schema[r];return void 0!==n&&!(0,t.alwaysValidSchema)(e,n)}return Ni.default=r,Ni}(),m=function(){if(Ii)return Ai;Ii=1,Object.defineProperty(Ai,"__esModule",{value:!0});const e=Zr(),t={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:r,it:n}){void 0===r.if&&(0,e.checkStrictMode)(n,`"${t}" without "if" is ignored`)}};return Ai.default=t,Ai}();return Yo.default=function(g=!1){const y=[d.default,u.default,p.default,h.default,f.default,m.default,s.default,a.default,i.default,c.default,l.default];return g?y.push(t.default,n.default):y.push(e.default,r.default),y.push(o.default),y},Yo}var xi,Di={},ji={};function Ri(){if(xi)return ji;xi=1,Object.defineProperty(ji,"__esModule",{value:!0}),ji.dynamicAnchor=void 0;const e=Yr(),t=nn(),r=Vn(),n=fo(),o={keyword:"$dynamicAnchor",schemaType:"string",code:e=>i(e,e.schema)};function i(o,i){const{gen:s,it:a}=o;a.schemaEnv.root.dynamicAnchors[i]=!0;const c=e._`${t.default.dynamicAnchors}${(0,e.getProperty)(i)}`,l="#"===a.errSchemaPath?a.validateName:function(e){const{schemaEnv:t,schema:o,self:i}=e.it,{root:s,baseId:a,localRefs:c,meta:l}=t.root,{schemaId:d}=i.opts,u=new r.SchemaEnv({schema:o,schemaId:d,root:s,baseId:a,localRefs:c,meta:l});return r.compileSchema.call(i,u),(0,n.getValidate)(e,u)}(o);s.if(e._`!${c}`,()=>s.assign(c,l))}return ji.dynamicAnchor=i,ji.default=o,ji}var Fi,Mi={};function Gi(){if(Fi)return Mi;Fi=1,Object.defineProperty(Mi,"__esModule",{value:!0}),Mi.dynamicRef=void 0;const e=Yr(),t=nn(),r=fo(),n={keyword:"$dynamicRef",schemaType:"string",code:e=>o(e,e.schema)};function o(n,o){const{gen:i,keyword:s,it:a}=n;if("#"!==o[0])throw new Error(`"${s}" only supports hash fragment reference`);const c=o.slice(1);if(a.allErrors)l();else{const e=i.let("valid",!1);l(e),n.ok(e)}function l(r){if(a.schemaEnv.root.dynamicAnchors[c]){const n=i.let("_v",e._`${t.default.dynamicAnchors}${(0,e.getProperty)(c)}`);i.if(n,d(n,r),d(a.validateName,r))}else d(a.validateName,r)()}function d(e,t){return t?()=>i.block(()=>{(0,r.callRef)(n,e),i.let(t,!0)}):()=>(0,r.callRef)(n,e)}}return Mi.dynamicRef=o,Mi.default=n,Mi}var Ui,Bi={};var zi,Vi,Hi={};function qi(){if(Vi)return Di;Vi=1,Object.defineProperty(Di,"__esModule",{value:!0});const e=Ri(),t=Gi(),r=function(){if(Ui)return Bi;Ui=1,Object.defineProperty(Bi,"__esModule",{value:!0});const e=Ri(),t=Zr(),r={keyword:"$recursiveAnchor",schemaType:"boolean",code(r){r.schema?(0,e.dynamicAnchor)(r,""):(0,t.checkStrictMode)(r.it,"$recursiveAnchor: false is ignored")}};return Bi.default=r,Bi}(),n=function(){if(zi)return Hi;zi=1,Object.defineProperty(Hi,"__esModule",{value:!0});const e=Gi(),t={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,e.dynamicRef)(t,t.schema)};return Hi.default=t,Hi}(),o=[e.default,t.default,r.default,n.default];return Di.default=o,Di}var Wi,Ki={},Yi={};var Ji,Xi={};var Zi,Qi,es={};function ts(){if(Qi)return Ki;Qi=1,Object.defineProperty(Ki,"__esModule",{value:!0});const e=function(){if(Wi)return Yi;Wi=1,Object.defineProperty(Yi,"__esModule",{value:!0});const e=di(),t={keyword:"dependentRequired",type:"object",schemaType:"object",error:e.error,code:t=>(0,e.validatePropertyDeps)(t)};return Yi.default=t,Yi}(),t=function(){if(Ji)return Xi;Ji=1,Object.defineProperty(Xi,"__esModule",{value:!0});const e=di(),t={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,e.validateSchemaDeps)(t)};return Xi.default=t,Xi}(),r=function(){if(Zi)return es;Zi=1,Object.defineProperty(es,"__esModule",{value:!0});const e=Zr(),t={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:t,parentSchema:r,it:n}){void 0===r.contains&&(0,e.checkStrictMode)(n,`"${t}" without "contains" is ignored`)}};return es.default=t,es}(),n=[e.default,t.default,r.default];return Ki.default=n,Ki}var rs,ns={},os={};function is(){if(rs)return os;rs=1,Object.defineProperty(os,"__esModule",{value:!0});const e=Yr(),t=Zr(),r=nn(),n={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:t})=>e._`{unevaluatedProperty: ${t.unevaluatedProperty}}`},code(n){const{gen:o,schema:i,data:s,errsCount:a,it:c}=n;if(!a)throw new Error("ajv implementation error");const{allErrors:l,props:d}=c;function u(r){if(!1===i)return n.setParams({unevaluatedProperty:r}),n.error(),void(l||o.break());if(!(0,t.alwaysValidSchema)(c,i)){const i=o.name("valid");n.subschema({keyword:"unevaluatedProperties",dataProp:r,dataPropType:t.Type.Str},i),l||o.if((0,e.not)(i),()=>o.break())}}d instanceof e.Name?o.if(e._`${d} !== true`,()=>o.forIn("key",s,t=>o.if(function(t,r){return e._`!${t} || !${t}[${r}]`}(d,t),()=>u(t)))):!0!==d&&o.forIn("key",s,t=>void 0===d?u(t):o.if(function(t,r){const n=[];for(const o in t)!0===t[o]&&n.push(e._`${r} !== ${o}`);return(0,e.and)(...n)}(d,t),()=>u(t))),c.props=!0,n.ok(e._`${a} === ${r.default.errors}`)}};return os.default=n,os}var ss,as,cs={};function ls(){if(ss)return cs;ss=1,Object.defineProperty(cs,"__esModule",{value:!0});const e=Yr(),t=Zr(),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:n,schema:o,data:i,it:s}=r,a=s.items||0;if(!0===a)return;const c=n.const("len",e._`${i}.length`);if(!1===o)r.setParams({len:a}),r.fail(e._`${c} > ${a}`);else if("object"==typeof o&&!(0,t.alwaysValidSchema)(s,o)){const o=n.var("valid",e._`${c} <= ${a}`);n.if((0,e.not)(o),()=>function(o,i){n.forRange("i",i,c,i=>{r.subschema({keyword:"unevaluatedItems",dataProp:i,dataPropType:t.Type.Num},o),s.allErrors||n.if((0,e.not)(o),()=>n.break())})}(o,a)),r.ok(o)}s.items=!0}};return cs.default=r,cs}var ds,us,ps={},hs={};function fs(){if(ds)return hs;ds=1,Object.defineProperty(hs,"__esModule",{value:!0});const e=Yr(),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:n,data:o,$data:i,schema:s,schemaCode:a,it:c}=t,{opts:l,errSchemaPath:d,schemaEnv:u,self:p}=c;l.validateFormats&&(i?function(){const i=n.scopeValue("formats",{ref:p.formats,code:l.code.formats}),s=n.const("fDef",e._`${i}[${a}]`),c=n.let("fType"),d=n.let("format");n.if(e._`typeof ${s} == "object" && !(${s} instanceof RegExp)`,()=>n.assign(c,e._`${s}.type || "string"`).assign(d,e._`${s}.validate`),()=>n.assign(c,e._`"string"`).assign(d,s)),t.fail$data((0,e.or)(!1===l.strictSchema?e.nil:e._`${a} && !${d}`,function(){const t=u.$async?e._`(${s}.async ? await ${d}(${o}) : ${d}(${o}))`:e._`${d}(${o})`,n=e._`(typeof ${d} == "function" ? ${t} : ${d}.test(${o}))`;return e._`${d} && ${d} !== true && ${c} === ${r} && !${n}`}()))}():function(){const i=p.formats[s];if(!i)return void function(){if(!1===l.strictSchema)return void p.logger.warn(e());throw new Error(e());function e(){return`unknown format "${s}" ignored in schema at path "${d}"`}}();if(!0===i)return;const[a,c,h]=function(t){const r=t instanceof RegExp?(0,e.regexpCode)(t):l.code.formats?e._`${l.code.formats}${(0,e.getProperty)(s)}`:void 0,o=n.scopeValue("formats",{key:s,ref:t,code:r});if("object"==typeof t&&!(t instanceof RegExp))return[t.type||"string",t.validate,e._`${o}.validate`];return["string",t,o]}(i);a===r&&t.pass(function(){if("object"==typeof i&&!(i instanceof RegExp)&&i.async){if(!u.$async)throw new Error("async format in sync schema");return e._`await ${h}(${o})`}return"function"==typeof c?e._`${h}(${o})`:e._`${h}.test(${o})`}())}())}};return hs.default=t,hs}var ms,gs,ys={};function vs(){if(gs)return ao;gs=1,Object.defineProperty(ao,"__esModule",{value:!0});const e=mo(),t=Wo(),r=Ti(),n=qi(),o=ts(),i=function(){if(as)return ns;as=1,Object.defineProperty(ns,"__esModule",{value:!0});const e=is(),t=ls(),r=[e.default,t.default];return ns.default=r,ns}(),s=function(){if(us)return ps;us=1,Object.defineProperty(ps,"__esModule",{value:!0});const e=[fs().default];return ps.default=e,ps}(),a=(ms||(ms=1,Object.defineProperty(ys,"__esModule",{value:!0}),ys.contentVocabulary=ys.metadataVocabulary=void 0,ys.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],ys.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),ys),c=[n.default,e.default,t.default,(0,r.default)(!0),s.default,a.metadataVocabulary,a.contentVocabulary,o.default,i.default];return ao.default=c,ao}var bs,$s,ws={},Es={};function Ss(){if($s)return ws;$s=1,Object.defineProperty(ws,"__esModule",{value:!0});const e=Yr(),t=(bs||(bs=1,Object.defineProperty(Es,"__esModule",{value:!0}),Es.DiscrError=void 0,function(e){e.Tag="tag",e.Mapping="mapping"}(r||(Es.DiscrError=r={}))),Es);var r;const n=Vn(),o=Un(),i=Zr(),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:n}})=>e._`{error: ${t}, tag: ${n}, tagValue: ${r}}`},code(r){const{gen:s,data:a,schema:c,parentSchema:l,it:d}=r,{oneOf:u}=l;if(!d.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 h=s.let("valid",!1),f=s.const("tag",e._`${a}${(0,e.getProperty)(p)}`);function m(t){const n=s.name("valid"),o=r.subschema({keyword:"oneOf",schemaProp:t},n);return r.mergeEvaluated(o,e.Name),n}s.if(e._`typeof ${f} == "string"`,()=>function(){const a=function(){var e;const t={},r=a(l);let s=!0;for(let t=0;t<u.length;t++){let l=u[t];if((null==l?void 0:l.$ref)&&!(0,i.schemaHasRulesButRef)(l,d.self.RULES)){const e=l.$ref;if(l=n.resolveRef.call(d.self,d.schemaEnv.root,d.baseId,e),l instanceof n.SchemaEnv&&(l=l.schema),void 0===l)throw new o.default(d.opts.uriResolver,d.baseId,e)}const h=null===(e=null==l?void 0:l.properties)||void 0===e?void 0:e[p];if("object"!=typeof h)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${p}"`);s=s&&(r||a(l)),c(h,t)}if(!s)throw new Error(`discriminator: "${p}" must be required`);return t;function a({required:e}){return Array.isArray(e)&&e.includes(p)}function c(e,t){if(e.const)h(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${p}" must have "const" or "enum"`);for(const r of e.enum)h(r,t)}}function h(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 a)s.elseIf(e._`${f} === ${t}`),s.assign(h,m(a[t]));s.else(),r.error(!1,{discrError:t.DiscrError.Mapping,tag:f,tagName:p}),s.endIf()}(),()=>r.error(!1,{discrError:t.DiscrError.Tag,tag:f,tagName:p})),r.ok(h)}};return ws.default=s,ws}var Ps,_s,Ls={},Cs={$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}}},ks={$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"}}}},Ns={$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"}}},Is={$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"}}},Os={$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"}}},As={$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"}}},Ts={$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}}},xs={$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 Ds=(_s||(_s=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=io(),n=vs(),o=Ss(),i=function(){if(Ps)return Ls;Ps=1,Object.defineProperty(Ls,"__esModule",{value:!0});const e=Cs,t=ks,r=Ns,n=Is,o=Os,i=As,s=Ts,a=xs,c=["/properties"];return Ls.default=function(l){return[e,t,r,n,o,d(this,i),s,d(this,a)].forEach(e=>this.addMetaSchema(e,void 0,!1)),this;function d(e,t){return l?e.$dataMetaSchema(t,c):t}},Ls}(),s="https://json-schema.org/draft/2020-12/schema";class a extends r.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),n.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();const{$data:e,meta:t}=this.opts;t&&(i.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=a,e.exports=t=a,e.exports.Ajv2020=a,Object.defineProperty(t,"__esModule",{value:!0}),t.default=a;var c=Dn();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var l=Yr();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return l.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return l.CodeGen}});var d=Fn();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var u=Un();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return u.default}})}(Rr,Rr.exports)),Rr.exports),js=Et(Ds);const Rs=ee.object({templateEntry:ee.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:ee.string({required_error:"schemaEntry is required in build section",invalid_type_error:"schemaEntry must be a string"}).describe("Schema file for portal validation"),assetPath:ee.string({invalid_type_error:"assetPath must be a string"}).optional().describe("Asset path for dev/preview builds"),githubRepo:ee.string({invalid_type_error:"githubRepo must be a string"}).optional().describe("GitHub repo URL or local git remote"),version:ee.string({required_error:"version is required in build section",invalid_type_error:"version must be a string"}).describe("Version from package.json"),timestamp:ee.string({required_error:"timestamp is required in build section",invalid_type_error:"timestamp must be a string"}).describe("Current build timestamp (ISO8601)"),commitSha:ee.string({required_error:"commitSha is required in build section",invalid_type_error:"commitSha must be a string"}).describe("Current git commit SHA"),annotations:ee.record(ee.string(),{invalid_type_error:"annotations must be a record of string values"}).optional().describe("Optional build annotations"),projectPage:ee.string({invalid_type_error:"projectPage must be a string"}).optional().describe("Optional project homepage"),allowedExtensions:ee.array(ee.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:ee.record(ee.unknown(),{invalid_type_error:"schema must be a record of unknown values"}).optional().describe("Optional schema for the portal"),config:ee.record(ee.unknown(),{invalid_type_error:"config must be a record of unknown values"}).optional().describe("Optional configuration for the portal")});ee.object({name:ee.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:ee.string({invalid_type_error:"displayName must be a string"}).optional().describe("Full package name, may include scope"),description:ee.string({invalid_type_error:"description must be a string"}).optional().describe("Description of the portal"),build:Rs});const Fs=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(xe({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 d("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 n=await(async(e,t)=>{const r=[`portal.schema.${e.environment}`,"portal.schema"],n=await oe(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:n.config,path:n.path,extension:n.extension}})({command:"build",environment:t.environment,mode:"build",root:process.cwd()});if(r.debug("Schema:",JSON.stringify(n,null,2)),r.succeed("Schema generated successfully!"),t.output&&("stdout"===t.output?r.info("Schema:",JSON.stringify(n.schema,null,2)):(r.start(`Writing schema to ${t.output}`),((e,t,r)=>{const n=a(String(e));G(n)||V(n,{recursive:!0}),F(e,t,r)})(t.output,JSON.stringify(n.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 js({strict:!0}).compile(n.schema),o=await ie(t.validate);r.debug("JSON value:",JSON.stringify(o,null,2));e(o)?r.succeed("Schema validation passed!"):(r.fail("Schema validation failed:",JSON.stringify(e.errors??"Unknown error")),process.exit(1))}}),Ms=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 d("portal:build",{debug:t.debug});await L({log:r,manifest:e})}),Gs=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 d("portal:pack",{debug:t.debug});await C({log:r,manifest:e,archive:t.archive,schema:t.schema}).catch(e=>{r.error("Failed to create package:",e),process.exit(1)})}),Us=Ge(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(xe({allowDev:!1})).argument("<bundle>","Portal bundle to upload (e.g., out/bundle.zip)").action(async(e,t)=>{const r=new d("portal:upload",{debug:t.debug});r?.start("Initializing Fusion Framework...");const n=await g({env:t.env,auth:{token:t.token,tenantId:t.tenantId,clientId:t.clientId}});r?.succeed("Initialized Fusion Framework"),await k({log:r,framework:n,fileOrBundle:e}).catch(e=>{r.error("Failed to upload bundle:",e),process.exit(1)})}));const Bs=Ge(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(xe({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 d("app:tag",{debug:t.debug}),n={command:"build",environment:t.env,mode:process.env.NODE_ENV??"production",root:process.cwd()},o=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 _({manifest:e.manifest,env:t}),n=r.build?.version;if(!n)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:n}}(t,n).catch(e=>{r?.error(`😢 ${e instanceof Error?e.message:"Unknown error occurred"}`),r?.debug(e),process.exit(1)});r?.info("Tagging portal:",Ie.greenBright(`${o.name}@${o.version} - ${e}`)),r?.start("Initializing Fusion Framework...");const i=await g({env:t.env,auth:{token:t.token,tenantId:t.tenantId,clientId:t.clientId}});r?.succeed("Initialized Fusion Framework"),N({tag:e,name:o.name,version:o.version,framework:i,log:r}).catch(e=>{r?.error("😢 Failed to tag application:",e),process.exit(1)})})),zs=Ge(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(xe({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(I).join(" | ")})`,I.Latest).action(async e=>{const t=new d("portal:publish",{debug:e.debug});t?.info("Using environment:",Ie.redBright(e.env)),t.start("📦 Bundling Portal Template...");const r=await C({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 n=await g({env:e.env,auth:{token:e.token,tenantId:e.tenantId,clientId:e.clientId}});t?.succeed("💾 Initialized Fusion Framework"),t.start("🚀 Uploading Portal Template..."),await k({log:t,framework:n,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 N({tag:e.tag,name:r.manifest.name,version:r.manifest.build.version,framework:n,log:t}).catch(e=>{t.error("😢 Failed to tag Portal Template:",e),process.exit(1)}),t.succeed("🏷️ Tagging completed")})),Vs=Ge(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(xe({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 d("portal:config",{debug:!!t.debug});if(t.publish){const[e,n]=t.publish.split("@")||[];return e&&n||(r?.fail("🤪","Portal identifier is required when using",Ie.blue("--publish")),r?.info("Example: fusion-framework-cli portal config --publish my-portal@1.2.3"),process.exit(1)),"dev"===t.env&&(r?.fail("🤪",Ie.blue("--env"),'cannot be "dev" when',Ie.blue("--publish")," is used"),process.exit(1)),O({config:t.config,portal:{name:e,version:n},environment:t.env,auth:"token"in t?{token:t.token}:t,debug:t.debug})}const{config:n}=await A({log:r,config:e,env:{environment:t.env},output:"stdout"===t.output?void 0:t.output});"stdout"===t.output&&console.log(JSON.stringify(n,null,2))})),Hs=e("portal").description("Develop and deploy portal templates").addCommand(wt).addCommand(Dr).addCommand(Fs).addCommand(Ms).addCommand(Gs).addCommand(Us).addCommand(Bs).addCommand(zs).addCommand(Vs);const[qs]=process.versions.node.split(".").map(Number);qs<Number(20)&&(console.error(Ie.red("[ERROR]"),"Fusion Framework CLI requires Node.js 20 or higher."),process.exit(1));qs!==Number(22)&&console.warn(Ie.yellow("[WARNING]"),"Node.js 22.x (LTS) is recommended for best compatibility. You are using Node.js",process.versions.node);const Ws=l({cwd:i(import.meta.url)});if(!Ws)throw Error("failed to find program root");process.env.CLI_BIN=s(a(Ws.path),String(Ws.packageJson.bin?.["fusion-framework-cli"]));const Ks=new n;Ks.name(Ws.packageJson.name),Ks.description([`${Ws.packageJson.name}@${Ws.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:",` ${Ws.packageJson.homepage}`].join("\n")),Ks.version(Ws.packageJson.version,"-V, --version","CLI version"),(e=>{e.addCommand(pt),e.addCommand(yt),e.addCommand(vt),e.addCommand($t),e.addCommand(Hs)})(Ks),Ks.parse();
|
|
7
|
+
deps: ${n}}`};const o={keyword:"dependencies",type:"object",schemaType:"object",error:e.error,code(e){const[t,r]=function({schema:e}){const t={},r={};for(const n in e){if("__proto__"===n)continue;(Array.isArray(e[n])?t:r)[n]=e[n]}return[t,r]}(e);i(e,t),s(e,r)}};function i(e,r=e.schema){const{gen:o,data:i,it:s}=e;if(0===Object.keys(r).length)return;const a=o.let("missing");for(const c in r){const l=r[c];if(0===l.length)continue;const d=(0,n.propertyInData)(o,i,c,s.opts.ownProperties);e.setParams({property:c,depsCount:l.length,deps:l.join(", ")}),s.allErrors?o.if(d,()=>{for(const t of l)(0,n.checkReportMissingProp)(e,t)}):(o.if(t._`${d} && (${(0,n.checkMissingProp)(e,l,a)})`),(0,n.reportMissingProp)(e,a),o.else())}}function s(e,t=e.schema){const{gen:o,data:i,keyword:s,it:a}=e,c=o.name("valid");for(const l in t)(0,r.alwaysValidSchema)(a,t[l])||(o.if((0,n.propertyInData)(o,i,l,a.opts.ownProperties),()=>{const t=e.subschema({keyword:s,schemaProp:l},c);e.mergeValidEvaluated(t,c)},()=>o.var(c,!0)),e.ok(c))}e.validatePropertyDeps=i,e.validateSchemaDeps=s,e.default=o}(ai)),ai}var li,di={};var ui,pi={};function hi(){if(ui)return pi;ui=1,Object.defineProperty(pi,"__esModule",{value:!0});const e=wn(),t=Yr(),r=nn(),n=Zr(),o={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(o){const{gen:i,schema:s,parentSchema:a,data:c,errsCount:l,it:d}=o;if(!l)throw new Error("ajv implementation error");const{allErrors:u,opts:p}=d;if(d.props=!0,"all"!==p.removeAdditional&&(0,n.alwaysValidSchema)(d,s))return;const h=(0,e.allSchemaProperties)(a.properties),f=(0,e.allSchemaProperties)(a.patternProperties);function m(e){i.code(t._`delete ${c}[${e}]`)}function g(e){if("all"===p.removeAdditional||p.removeAdditional&&!1===s)m(e);else{if(!1===s)return o.setParams({additionalProperty:e}),o.error(),void(u||i.break());if("object"==typeof s&&!(0,n.alwaysValidSchema)(d,s)){const r=i.name("valid");"failing"===p.removeAdditional?(y(e,r,!1),i.if((0,t.not)(r),()=>{o.reset(),m(e)})):(y(e,r),u||i.if((0,t.not)(r),()=>i.break()))}}}function y(e,t,r){const i={keyword:"additionalProperties",dataProp:e,dataPropType:n.Type.Str};!1===r&&Object.assign(i,{compositeRule:!0,createErrors:!1,allErrors:!1}),o.subschema(i,t)}i.forIn("key",c,r=>{h.length||f.length?i.if(function(r){let s;if(h.length>8){const t=(0,n.schemaRefOrVal)(d,a.properties,"properties");s=(0,e.isOwnProperty)(i,t,r)}else s=h.length?(0,t.or)(...h.map(e=>t._`${r} === ${e}`)):t.nil;return f.length&&(s=(0,t.or)(s,...f.map(n=>t._`${(0,e.usePattern)(o,n)}.test(${r})`))),(0,t.not)(s)}(r),()=>g(r)):g(r)}),o.ok(t._`${l} === ${r.default.errors}`)}};return pi.default=o,pi}var fi,mi={};var gi,yi={};var vi,bi={};var $i,wi={};var Ei,Si={};var Pi,_i={};var Li,ki={};var Ci,Ni,Ii={};function Oi(){if(Ni)return Wo;Ni=1,Object.defineProperty(Wo,"__esModule",{value:!0});const e=Yo(),t=function(){if(Xo)return Zo;Xo=1,Object.defineProperty(Zo,"__esModule",{value:!0});const e=ei(),t={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,e.validateTuple)(t,"items")};return Zo.default=t,Zo}(),r=ei(),n=function(){if(ti)return ri;ti=1,Object.defineProperty(ri,"__esModule",{value:!0});const e=Yr(),t=Zr(),r=wn(),n=Yo(),o={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:o,parentSchema:i,it:s}=e,{prefixItems:a}=i;s.items=!0,(0,t.alwaysValidSchema)(s,o)||(a?(0,n.validateAdditionalItems)(e,a):e.ok((0,r.validateArray)(e)))}};return ri.default=o,ri}(),o=ii(),i=ci(),s=function(){if(li)return di;li=1,Object.defineProperty(di,"__esModule",{value:!0});const e=Yr(),t=Zr(),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:n,schema:o,data:i,it:s}=r;if((0,t.alwaysValidSchema)(s,o))return;const a=n.name("valid");n.forIn("key",i,t=>{r.setParams({propertyName:t}),r.subschema({keyword:"propertyNames",data:t,dataTypes:["string"],propertyName:t,compositeRule:!0},a),n.if((0,e.not)(a),()=>{r.error(!0),s.allErrors||n.break()})}),r.ok(a)}};return di.default=r,di}(),a=hi(),c=function(){if(fi)return mi;fi=1,Object.defineProperty(mi,"__esModule",{value:!0});const e=Dn(),t=wn(),r=Zr(),n=hi(),o={keyword:"properties",type:"object",schemaType:"object",code(o){const{gen:i,schema:s,parentSchema:a,data:c,it:l}=o;"all"===l.opts.removeAdditional&&void 0===a.additionalProperties&&n.default.code(new e.KeywordCxt(l,n.default,"additionalProperties"));const d=(0,t.allSchemaProperties)(s);for(const e of d)l.definedProperties.add(e);l.opts.unevaluated&&d.length&&!0!==l.props&&(l.props=r.mergeEvaluated.props(i,(0,r.toHash)(d),l.props));const u=d.filter(e=>!(0,r.alwaysValidSchema)(l,s[e]));if(0===u.length)return;const p=i.name("valid");for(const e of u)h(e)?f(e):(i.if((0,t.propertyInData)(i,c,e,l.opts.ownProperties)),f(e),l.allErrors||i.else().var(p,!0),i.endIf()),o.it.definedProperties.add(e),o.ok(p);function h(e){return l.opts.useDefaults&&!l.compositeRule&&void 0!==s[e].default}function f(e){o.subschema({keyword:"properties",schemaProp:e,dataProp:e},p)}}};return mi.default=o,mi}(),l=function(){if(gi)return yi;gi=1,Object.defineProperty(yi,"__esModule",{value:!0});const e=wn(),t=Yr(),r=Zr(),n=Zr(),o={keyword:"patternProperties",type:"object",schemaType:"object",code(o){const{gen:i,schema:s,data:a,parentSchema:c,it:l}=o,{opts:d}=l,u=(0,e.allSchemaProperties)(s),p=u.filter(e=>(0,r.alwaysValidSchema)(l,s[e]));if(0===u.length||p.length===u.length&&(!l.opts.unevaluated||!0===l.props))return;const h=d.strictSchema&&!d.allowMatchingProperties&&c.properties,f=i.name("valid");!0===l.props||l.props instanceof t.Name||(l.props=(0,n.evaluatedPropsToName)(i,l.props));const{props:m}=l;function g(e){for(const t in h)new RegExp(e).test(t)&&(0,r.checkStrictMode)(l,`property ${t} matches pattern ${e} (use allowMatchingProperties)`)}function y(r){i.forIn("key",a,s=>{i.if(t._`${(0,e.usePattern)(o,r)}.test(${s})`,()=>{const e=p.includes(r);e||o.subschema({keyword:"patternProperties",schemaProp:r,dataProp:s,dataPropType:n.Type.Str},f),l.opts.unevaluated&&!0!==m?i.assign(t._`${m}[${s}]`,!0):e||l.allErrors||i.if((0,t.not)(f),()=>i.break())})})}!function(){for(const e of u)h&&g(e),l.allErrors?y(e):(i.var(f,!0),y(e),i.if(f))}()}};return yi.default=o,yi}(),d=function(){if(vi)return bi;vi=1,Object.defineProperty(bi,"__esModule",{value:!0});const e=Zr(),t={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(t){const{gen:r,schema:n,it:o}=t;if((0,e.alwaysValidSchema)(o,n))return void t.fail();const i=r.name("valid");t.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},i),t.failResult(i,()=>t.reset(),()=>t.error())},error:{message:"must NOT be valid"}};return bi.default=t,bi}(),u=function(){if($i)return wi;$i=1,Object.defineProperty(wi,"__esModule",{value:!0});const e={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:wn().validateUnion,error:{message:"must match a schema in anyOf"}};return wi.default=e,wi}(),p=function(){if(Ei)return Si;Ei=1,Object.defineProperty(Si,"__esModule",{value:!0});const e=Yr(),t=Zr(),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:n,schema:o,parentSchema:i,it:s}=r;if(!Array.isArray(o))throw new Error("ajv implementation error");if(s.opts.discriminator&&i.discriminator)return;const a=o,c=n.let("valid",!1),l=n.let("passing",null),d=n.name("_valid");r.setParams({passing:l}),n.block(function(){a.forEach((o,i)=>{let a;(0,t.alwaysValidSchema)(s,o)?n.var(d,!0):a=r.subschema({keyword:"oneOf",schemaProp:i,compositeRule:!0},d),i>0&&n.if(e._`${d} && ${c}`).assign(c,!1).assign(l,e._`[${l}, ${i}]`).else(),n.if(d,()=>{n.assign(c,!0),n.assign(l,i),a&&r.mergeEvaluated(a,e.Name)})})}),r.result(c,()=>r.reset(),()=>r.error(!0))}};return Si.default=r,Si}(),h=function(){if(Pi)return _i;Pi=1,Object.defineProperty(_i,"__esModule",{value:!0});const e=Zr(),t={keyword:"allOf",schemaType:"array",code(t){const{gen:r,schema:n,it:o}=t;if(!Array.isArray(n))throw new Error("ajv implementation error");const i=r.name("valid");n.forEach((r,n)=>{if((0,e.alwaysValidSchema)(o,r))return;const s=t.subschema({keyword:"allOf",schemaProp:n},i);t.ok(i),t.mergeEvaluated(s)})}};return _i.default=t,_i}(),f=function(){if(Li)return ki;Li=1,Object.defineProperty(ki,"__esModule",{value:!0});const e=Yr(),t=Zr(),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:o,parentSchema:i,it:s}=r;void 0===i.then&&void 0===i.else&&(0,t.checkStrictMode)(s,'"if" without "then" and "else" is ignored');const a=n(s,"then"),c=n(s,"else");if(!a&&!c)return;const l=o.let("valid",!0),d=o.name("_valid");if(function(){const e=r.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},d);r.mergeEvaluated(e)}(),r.reset(),a&&c){const e=o.let("ifClause");r.setParams({ifClause:e}),o.if(d,u("then",e),u("else",e))}else a?o.if(d,u("then")):o.if((0,e.not)(d),u("else"));function u(t,n){return()=>{const i=r.subschema({keyword:t},d);o.assign(l,d),r.mergeValidEvaluated(i,l),n?o.assign(n,e._`${t}`):r.setParams({ifClause:t})}}r.pass(l,()=>r.error(!0))}};function n(e,r){const n=e.schema[r];return void 0!==n&&!(0,t.alwaysValidSchema)(e,n)}return ki.default=r,ki}(),m=function(){if(Ci)return Ii;Ci=1,Object.defineProperty(Ii,"__esModule",{value:!0});const e=Zr(),t={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:r,it:n}){void 0===r.if&&(0,e.checkStrictMode)(n,`"${t}" without "if" is ignored`)}};return Ii.default=t,Ii}();return Wo.default=function(g=!1){const y=[d.default,u.default,p.default,h.default,f.default,m.default,s.default,a.default,i.default,c.default,l.default];return g?y.push(t.default,n.default):y.push(e.default,r.default),y.push(o.default),y},Wo}var Ai,xi={},Ti={};function Di(){if(Ai)return Ti;Ai=1,Object.defineProperty(Ti,"__esModule",{value:!0}),Ti.dynamicAnchor=void 0;const e=Yr(),t=nn(),r=Vn(),n=po(),o={keyword:"$dynamicAnchor",schemaType:"string",code:e=>i(e,e.schema)};function i(o,i){const{gen:s,it:a}=o;a.schemaEnv.root.dynamicAnchors[i]=!0;const c=e._`${t.default.dynamicAnchors}${(0,e.getProperty)(i)}`,l="#"===a.errSchemaPath?a.validateName:function(e){const{schemaEnv:t,schema:o,self:i}=e.it,{root:s,baseId:a,localRefs:c,meta:l}=t.root,{schemaId:d}=i.opts,u=new r.SchemaEnv({schema:o,schemaId:d,root:s,baseId:a,localRefs:c,meta:l});return r.compileSchema.call(i,u),(0,n.getValidate)(e,u)}(o);s.if(e._`!${c}`,()=>s.assign(c,l))}return Ti.dynamicAnchor=i,Ti.default=o,Ti}var ji,Ri={};function Fi(){if(ji)return Ri;ji=1,Object.defineProperty(Ri,"__esModule",{value:!0}),Ri.dynamicRef=void 0;const e=Yr(),t=nn(),r=po(),n={keyword:"$dynamicRef",schemaType:"string",code:e=>o(e,e.schema)};function o(n,o){const{gen:i,keyword:s,it:a}=n;if("#"!==o[0])throw new Error(`"${s}" only supports hash fragment reference`);const c=o.slice(1);if(a.allErrors)l();else{const e=i.let("valid",!1);l(e),n.ok(e)}function l(r){if(a.schemaEnv.root.dynamicAnchors[c]){const n=i.let("_v",e._`${t.default.dynamicAnchors}${(0,e.getProperty)(c)}`);i.if(n,d(n,r),d(a.validateName,r))}else d(a.validateName,r)()}function d(e,t){return t?()=>i.block(()=>{(0,r.callRef)(n,e),i.let(t,!0)}):()=>(0,r.callRef)(n,e)}}return Ri.dynamicRef=o,Ri.default=n,Ri}var Mi,Gi={};var Ui,Bi,zi={};function Vi(){if(Bi)return xi;Bi=1,Object.defineProperty(xi,"__esModule",{value:!0});const e=Di(),t=Fi(),r=function(){if(Mi)return Gi;Mi=1,Object.defineProperty(Gi,"__esModule",{value:!0});const e=Di(),t=Zr(),r={keyword:"$recursiveAnchor",schemaType:"boolean",code(r){r.schema?(0,e.dynamicAnchor)(r,""):(0,t.checkStrictMode)(r.it,"$recursiveAnchor: false is ignored")}};return Gi.default=r,Gi}(),n=function(){if(Ui)return zi;Ui=1,Object.defineProperty(zi,"__esModule",{value:!0});const e=Fi(),t={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,e.dynamicRef)(t,t.schema)};return zi.default=t,zi}(),o=[e.default,t.default,r.default,n.default];return xi.default=o,xi}var Hi,qi={},Wi={};var Ki,Yi={};var Ji,Xi,Zi={};function Qi(){if(Xi)return qi;Xi=1,Object.defineProperty(qi,"__esModule",{value:!0});const e=function(){if(Hi)return Wi;Hi=1,Object.defineProperty(Wi,"__esModule",{value:!0});const e=ci(),t={keyword:"dependentRequired",type:"object",schemaType:"object",error:e.error,code:t=>(0,e.validatePropertyDeps)(t)};return Wi.default=t,Wi}(),t=function(){if(Ki)return Yi;Ki=1,Object.defineProperty(Yi,"__esModule",{value:!0});const e=ci(),t={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,e.validateSchemaDeps)(t)};return Yi.default=t,Yi}(),r=function(){if(Ji)return Zi;Ji=1,Object.defineProperty(Zi,"__esModule",{value:!0});const e=Zr(),t={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:t,parentSchema:r,it:n}){void 0===r.contains&&(0,e.checkStrictMode)(n,`"${t}" without "contains" is ignored`)}};return Zi.default=t,Zi}(),n=[e.default,t.default,r.default];return qi.default=n,qi}var es,ts={},rs={};function ns(){if(es)return rs;es=1,Object.defineProperty(rs,"__esModule",{value:!0});const e=Yr(),t=Zr(),r=nn(),n={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:!0,error:{message:"must NOT have unevaluated properties",params:({params:t})=>e._`{unevaluatedProperty: ${t.unevaluatedProperty}}`},code(n){const{gen:o,schema:i,data:s,errsCount:a,it:c}=n;if(!a)throw new Error("ajv implementation error");const{allErrors:l,props:d}=c;function u(r){if(!1===i)return n.setParams({unevaluatedProperty:r}),n.error(),void(l||o.break());if(!(0,t.alwaysValidSchema)(c,i)){const i=o.name("valid");n.subschema({keyword:"unevaluatedProperties",dataProp:r,dataPropType:t.Type.Str},i),l||o.if((0,e.not)(i),()=>o.break())}}d instanceof e.Name?o.if(e._`${d} !== true`,()=>o.forIn("key",s,t=>o.if(function(t,r){return e._`!${t} || !${t}[${r}]`}(d,t),()=>u(t)))):!0!==d&&o.forIn("key",s,t=>void 0===d?u(t):o.if(function(t,r){const n=[];for(const o in t)!0===t[o]&&n.push(e._`${r} !== ${o}`);return(0,e.and)(...n)}(d,t),()=>u(t))),c.props=!0,n.ok(e._`${a} === ${r.default.errors}`)}};return rs.default=n,rs}var os,is,ss={};function as(){if(os)return ss;os=1,Object.defineProperty(ss,"__esModule",{value:!0});const e=Yr(),t=Zr(),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:n,schema:o,data:i,it:s}=r,a=s.items||0;if(!0===a)return;const c=n.const("len",e._`${i}.length`);if(!1===o)r.setParams({len:a}),r.fail(e._`${c} > ${a}`);else if("object"==typeof o&&!(0,t.alwaysValidSchema)(s,o)){const o=n.var("valid",e._`${c} <= ${a}`);n.if((0,e.not)(o),()=>function(o,i){n.forRange("i",i,c,i=>{r.subschema({keyword:"unevaluatedItems",dataProp:i,dataPropType:t.Type.Num},o),s.allErrors||n.if((0,e.not)(o),()=>n.break())})}(o,a)),r.ok(o)}s.items=!0}};return ss.default=r,ss}var cs,ls,ds={},us={};function ps(){if(cs)return us;cs=1,Object.defineProperty(us,"__esModule",{value:!0});const e=Yr(),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:n,data:o,$data:i,schema:s,schemaCode:a,it:c}=t,{opts:l,errSchemaPath:d,schemaEnv:u,self:p}=c;l.validateFormats&&(i?function(){const i=n.scopeValue("formats",{ref:p.formats,code:l.code.formats}),s=n.const("fDef",e._`${i}[${a}]`),c=n.let("fType"),d=n.let("format");n.if(e._`typeof ${s} == "object" && !(${s} instanceof RegExp)`,()=>n.assign(c,e._`${s}.type || "string"`).assign(d,e._`${s}.validate`),()=>n.assign(c,e._`"string"`).assign(d,s)),t.fail$data((0,e.or)(!1===l.strictSchema?e.nil:e._`${a} && !${d}`,function(){const t=u.$async?e._`(${s}.async ? await ${d}(${o}) : ${d}(${o}))`:e._`${d}(${o})`,n=e._`(typeof ${d} == "function" ? ${t} : ${d}.test(${o}))`;return e._`${d} && ${d} !== true && ${c} === ${r} && !${n}`}()))}():function(){const i=p.formats[s];if(!i)return void function(){if(!1===l.strictSchema)return void p.logger.warn(e());throw new Error(e());function e(){return`unknown format "${s}" ignored in schema at path "${d}"`}}();if(!0===i)return;const[a,c,h]=function(t){const r=t instanceof RegExp?(0,e.regexpCode)(t):l.code.formats?e._`${l.code.formats}${(0,e.getProperty)(s)}`:void 0,o=n.scopeValue("formats",{key:s,ref:t,code:r});if("object"==typeof t&&!(t instanceof RegExp))return[t.type||"string",t.validate,e._`${o}.validate`];return["string",t,o]}(i);a===r&&t.pass(function(){if("object"==typeof i&&!(i instanceof RegExp)&&i.async){if(!u.$async)throw new Error("async format in sync schema");return e._`await ${h}(${o})`}return"function"==typeof c?e._`${h}(${o})`:e._`${h}.test(${o})`}())}())}};return us.default=t,us}var hs,fs,ms={};function gs(){if(fs)return io;fs=1,Object.defineProperty(io,"__esModule",{value:!0});const e=ho(),t=Ho(),r=Oi(),n=Vi(),o=Qi(),i=function(){if(is)return ts;is=1,Object.defineProperty(ts,"__esModule",{value:!0});const e=ns(),t=as(),r=[e.default,t.default];return ts.default=r,ts}(),s=function(){if(ls)return ds;ls=1,Object.defineProperty(ds,"__esModule",{value:!0});const e=[ps().default];return ds.default=e,ds}(),a=(hs||(hs=1,Object.defineProperty(ms,"__esModule",{value:!0}),ms.contentVocabulary=ms.metadataVocabulary=void 0,ms.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],ms.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),ms),c=[n.default,e.default,t.default,(0,r.default)(!0),s.default,a.metadataVocabulary,a.contentVocabulary,o.default,i.default];return io.default=c,io}var ys,vs,bs={},$s={};function ws(){if(vs)return bs;vs=1,Object.defineProperty(bs,"__esModule",{value:!0});const e=Yr(),t=(ys||(ys=1,Object.defineProperty($s,"__esModule",{value:!0}),$s.DiscrError=void 0,function(e){e.Tag="tag",e.Mapping="mapping"}(r||($s.DiscrError=r={}))),$s);var r;const n=Vn(),o=Un(),i=Zr(),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:n}})=>e._`{error: ${t}, tag: ${n}, tagValue: ${r}}`},code(r){const{gen:s,data:a,schema:c,parentSchema:l,it:d}=r,{oneOf:u}=l;if(!d.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 h=s.let("valid",!1),f=s.const("tag",e._`${a}${(0,e.getProperty)(p)}`);function m(t){const n=s.name("valid"),o=r.subschema({keyword:"oneOf",schemaProp:t},n);return r.mergeEvaluated(o,e.Name),n}s.if(e._`typeof ${f} == "string"`,()=>function(){const a=function(){var e;const t={},r=a(l);let s=!0;for(let t=0;t<u.length;t++){let l=u[t];if((null==l?void 0:l.$ref)&&!(0,i.schemaHasRulesButRef)(l,d.self.RULES)){const e=l.$ref;if(l=n.resolveRef.call(d.self,d.schemaEnv.root,d.baseId,e),l instanceof n.SchemaEnv&&(l=l.schema),void 0===l)throw new o.default(d.opts.uriResolver,d.baseId,e)}const h=null===(e=null==l?void 0:l.properties)||void 0===e?void 0:e[p];if("object"!=typeof h)throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${p}"`);s=s&&(r||a(l)),c(h,t)}if(!s)throw new Error(`discriminator: "${p}" must be required`);return t;function a({required:e}){return Array.isArray(e)&&e.includes(p)}function c(e,t){if(e.const)h(e.const,t);else{if(!e.enum)throw new Error(`discriminator: "properties/${p}" must have "const" or "enum"`);for(const r of e.enum)h(r,t)}}function h(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 a)s.elseIf(e._`${f} === ${t}`),s.assign(h,m(a[t]));s.else(),r.error(!1,{discrError:t.DiscrError.Mapping,tag:f,tagName:p}),s.endIf()}(),()=>r.error(!1,{discrError:t.DiscrError.Tag,tag:f,tagName:p})),r.ok(h)}};return bs.default=s,bs}var Es,Ss,Ps={},_s={$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}}},Ls={$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"}}}},ks={$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"}}},Cs={$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"}}},Ns={$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"}}},Is={$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"}}},Os={$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}}},As={$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 xs=(Ss||(Ss=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=no(),n=gs(),o=ws(),i=function(){if(Es)return Ps;Es=1,Object.defineProperty(Ps,"__esModule",{value:!0});const e=_s,t=Ls,r=ks,n=Cs,o=Ns,i=Is,s=Os,a=As,c=["/properties"];return Ps.default=function(l){return[e,t,r,n,o,d(this,i),s,d(this,a)].forEach(e=>this.addMetaSchema(e,void 0,!1)),this;function d(e,t){return l?e.$dataMetaSchema(t,c):t}},Ps}(),s="https://json-schema.org/draft/2020-12/schema";class a extends r.default{constructor(e={}){super({...e,dynamicRef:!0,next:!0,unevaluated:!0})}_addVocabularies(){super._addVocabularies(),n.default.forEach(e=>this.addVocabulary(e)),this.opts.discriminator&&this.addKeyword(o.default)}_addDefaultMetaSchema(){super._addDefaultMetaSchema();const{$data:e,meta:t}=this.opts;t&&(i.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=a,e.exports=t=a,e.exports.Ajv2020=a,Object.defineProperty(t,"__esModule",{value:!0}),t.default=a;var c=Dn();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var l=Yr();Object.defineProperty(t,"_",{enumerable:!0,get:function(){return l._}}),Object.defineProperty(t,"str",{enumerable:!0,get:function(){return l.str}}),Object.defineProperty(t,"stringify",{enumerable:!0,get:function(){return l.stringify}}),Object.defineProperty(t,"nil",{enumerable:!0,get:function(){return l.nil}}),Object.defineProperty(t,"Name",{enumerable:!0,get:function(){return l.Name}}),Object.defineProperty(t,"CodeGen",{enumerable:!0,get:function(){return l.CodeGen}});var d=Fn();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var u=Un();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return u.default}})}(Rr,Rr.exports)),Rr.exports),Ts=Et(xs);const Ds=ee.object({templateEntry:ee.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:ee.string({required_error:"schemaEntry is required in build section",invalid_type_error:"schemaEntry must be a string"}).describe("Schema file for portal validation"),assetPath:ee.string({invalid_type_error:"assetPath must be a string"}).optional().describe("Asset path for dev/preview builds"),githubRepo:ee.string({invalid_type_error:"githubRepo must be a string"}).optional().describe("GitHub repo URL or local git remote"),version:ee.string({required_error:"version is required in build section",invalid_type_error:"version must be a string"}).describe("Version from package.json"),timestamp:ee.string({required_error:"timestamp is required in build section",invalid_type_error:"timestamp must be a string"}).describe("Current build timestamp (ISO8601)"),commitSha:ee.string({required_error:"commitSha is required in build section",invalid_type_error:"commitSha must be a string"}).describe("Current git commit SHA"),annotations:ee.record(ee.string(),{invalid_type_error:"annotations must be a record of string values"}).optional().describe("Optional build annotations"),projectPage:ee.string({invalid_type_error:"projectPage must be a string"}).optional().describe("Optional project homepage"),allowedExtensions:ee.array(ee.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:ee.record(ee.unknown(),{invalid_type_error:"schema must be a record of unknown values"}).optional().describe("Optional schema for the portal"),config:ee.record(ee.unknown(),{invalid_type_error:"config must be a record of unknown values"}).optional().describe("Optional configuration for the portal")});ee.object({name:ee.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:ee.string({invalid_type_error:"displayName must be a string"}).optional().describe("Full package name, may include scope"),description:ee.string({invalid_type_error:"description must be a string"}).optional().describe("Description of the portal"),build:Ds});const js=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(Te({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 d("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 n=await(async(e,t)=>{const r=[`portal.schema.${e.environment}`,"portal.schema"],n=await oe(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:n.config,path:n.path,extension:n.extension}})({command:"build",environment:t.environment,mode:"build",root:process.cwd()});if(r.debug("Schema:",JSON.stringify(n,null,2)),r.succeed("Schema generated successfully!"),t.output&&("stdout"===t.output?r.info("Schema:",JSON.stringify(n.schema,null,2)):(r.start(`Writing schema to ${t.output}`),((e,t,r)=>{const n=a(String(e));G(n)||V(n,{recursive:!0}),F(e,t,r)})(t.output,JSON.stringify(n.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 Ts({strict:!0}).compile(n.schema),o=await ie(t.validate);r.debug("JSON value:",JSON.stringify(o,null,2));e(o)?r.succeed("Schema validation passed!"):(r.fail("Schema validation failed:",JSON.stringify(e.errors??"Unknown error")),process.exit(1))}}),Rs=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 d("portal:build",{debug:t.debug});await L({log:r,manifest:e})}),Fs=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 d("portal:pack",{debug:t.debug});await k({log:r,manifest:e,archive:t.archive,schema:t.schema}).catch(e=>{r.error("Failed to create package:",e),process.exit(1)})}),Ms=Ge(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(Te({allowDev:!1})).argument("<bundle>","Portal bundle to upload (e.g., out/bundle.zip)").action(async(e,t)=>{const r=new d("portal:upload",{debug:t.debug});r?.start("Initializing Fusion Framework...");const n=await g({env:t.env,auth:{token:t.token,tenantId:t.tenantId,clientId:t.clientId}});r?.succeed("Initialized Fusion Framework"),await C({log:r,framework:n,fileOrBundle:e}).catch(e=>{r.error("Failed to upload bundle:",e),process.exit(1)})}));const Gs=Ge(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(Te({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 d("app:tag",{debug:t.debug}),n={command:"build",environment:t.env,mode:process.env.NODE_ENV??"production",root:process.cwd()},o=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 _({manifest:e.manifest,env:t}),n=r.build?.version;if(!n)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:n}}(t,n).catch(e=>{r?.error(`😢 ${e instanceof Error?e.message:"Unknown error occurred"}`),r?.debug(e),process.exit(1)});r?.info("Tagging portal:",Ie.greenBright(`${o.name}@${o.version} - ${e}`)),r?.start("Initializing Fusion Framework...");const i=await g({env:t.env,auth:{token:t.token,tenantId:t.tenantId,clientId:t.clientId}});r?.succeed("Initialized Fusion Framework"),N({tag:e,name:o.name,version:o.version,framework:i,log:r}).catch(e=>{r?.error("😢 Failed to tag application:",e),process.exit(1)})})),Us=Ge(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(Te({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(I).join(" | ")})`,I.Latest).action(async e=>{const t=new d("portal:publish",{debug:e.debug});t?.info("Using environment:",Ie.redBright(e.env)),t.start("📦 Bundling Portal Template...");const r=await k({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 n=await g({env:e.env,auth:{token:e.token,tenantId:e.tenantId,clientId:e.clientId}});t?.succeed("💾 Initialized Fusion Framework"),t.start("🚀 Uploading Portal Template..."),await C({log:t,framework:n,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 N({tag:e.tag,name:r.manifest.name,version:r.manifest.build.version,framework:n,log:t}).catch(e=>{t.error("😢 Failed to tag Portal Template:",e),process.exit(1)}),t.succeed("🏷️ Tagging completed")})),Bs=Ge(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(Te({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 d("portal:config",{debug:!!t.debug});if(t.publish){const[e,n]=t.publish.split("@")||[];return e&&n||(r?.fail("🤪","Portal identifier is required when using",Ie.blue("--publish")),r?.info("Example: fusion-framework-cli portal config --publish my-portal@1.2.3"),process.exit(1)),"dev"===t.env&&(r?.fail("🤪",Ie.blue("--env"),'cannot be "dev" when',Ie.blue("--publish")," is used"),process.exit(1)),O({config:t.config,portal:{name:e,version:n},environment:t.env,auth:"token"in t?{token:t.token}:t,debug:t.debug})}const{config:n}=await A({log:r,config:e,env:{environment:t.env},output:"stdout"===t.output?void 0:t.output});"stdout"===t.output&&console.log(JSON.stringify(n,null,2))})),zs=e("portal").description("Develop and deploy portal templates").addCommand(wt).addCommand(Dr).addCommand(js).addCommand(Rs).addCommand(Fs).addCommand(Ms).addCommand(Gs).addCommand(Us).addCommand(Bs);const[Vs]=process.versions.node.split(".").map(Number);Vs<Number(20)&&(console.error(Ie.red("[ERROR]"),"Fusion Framework CLI requires Node.js 20 or higher."),process.exit(1));Vs!==Number(22)&&console.warn(Ie.yellow("[WARNING]"),"Node.js 22.x (LTS) is recommended for best compatibility. You are using Node.js",process.versions.node);const Hs=l({cwd:i(import.meta.url)});if(!Hs)throw Error("failed to find program root");process.env.CLI_BIN=s(a(Hs.path),String(Hs.packageJson.bin?.["fusion-framework-cli"]));const qs=new n;qs.name(Hs.packageJson.name),qs.description([`${Hs.packageJson.name}@${Hs.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:",` ${Hs.packageJson.homepage}`].join("\n")),qs.version(Hs.packageJson.version,"-V, --version","CLI version"),(e=>{e.addCommand(pt),e.addCommand(yt),e.addCommand(vt),e.addCommand($t),e.addCommand(zs)})(qs),qs.parse();
|