@equinor/fusion-framework-cli 12.3.9 → 12.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 +72 -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/index.d.ts +1 -1
- package/dist/types/bin/portal-tag.d.ts +3 -17
- package/dist/types/cli/commands/portal/publish.d.ts +1 -1
- package/dist/types/cli/commands/portal/tag.d.ts +1 -1
- package/dist/types/version.d.ts +1 -1
- package/docs/portal.md +7 -5
- package/package.json +5 -5
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 L,buildPortal as _,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 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 H}from"node:fs";import V from"node:assert";import W from"inquirer";import q from"is-path-inside";import{execa as K,ExecaError as Y}from"execa";import{spawn as J,execSync as X}from"node:child_process";import{tmpdir as Z,homedir as Q}from"node:os";import{simpleGit as ee,ResetMode as te}from"simple-git";import{z as re}from"zod";import ne from"url";import oe from"node:module";import ie from"util";import{importConfig as se,importJSON as ae}from"@equinor/fusion-imports";import"deepmerge";const ce=(e=0)=>t=>`[${t+e}m`,le=(e=0)=>t=>`[${38+e};5;${t}m`,de=(e=0)=>(t,r,n)=>`[${38+e};2;${t};${r};${n}m`,ue={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(ue.modifier);Object.keys(ue.color),Object.keys(ue.bgColor);const pe=function(){const e=new Map;for(const[t,r]of Object.entries(ue)){for(const[t,n]of Object.entries(r))ue[t]={open:`[${n[0]}m`,close:`[${n[1]}m`},r[t]=ue[t],e.set(n[0],n[1]);Object.defineProperty(ue,t,{value:r,enumerable:!1})}return Object.defineProperty(ue,"codes",{value:e,enumerable:!1}),ue.color.close="[39m",ue.bgColor.close="[49m",ue.color.ansi=ce(),ue.color.ansi256=le(),ue.color.ansi16m=de(),ue.bgColor.ansi=ce(10),ue.bgColor.ansi256=le(10),ue.bgColor.ansi16m=de(10),Object.defineProperties(ue,{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=>ue.rgbToAnsi256(...ue.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)=>ue.ansi256ToAnsi(ue.rgbToAnsi256(e,t,r)),enumerable:!1},hexToAnsi:{value:e=>ue.ansi256ToAnsi(ue.hexToAnsi256(e)),enumerable:!1}}),ue}(),he=(()=>{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})(),fe=0!==he&&{level:he},me={stdout:fe,stderr:fe};function ge(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:ye,stderr:ve}=me,be=Symbol("GENERATOR"),$e=Symbol("STYLER"),we=Symbol("IS_EMPTY"),Ee=["ansi","ansi","ansi256","ansi16m"],Se=Object.create(null),Pe=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=ye?ye.level:0;e.level=void 0===t.level?r:t.level})(t,e),Object.setPrototypeOf(t,Le.prototype),t};function Le(e){return Pe(e)}Object.setPrototypeOf(Le.prototype,Function.prototype);for(const[e,t]of Object.entries(pe))Se[e]={get(){const r=Ie(this,Ne(t.open,t.close,this[$e]),this[we]);return Object.defineProperty(this,e,{value:r}),r}};Se.visible={get(){const e=Ie(this,this[$e],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const _e=(e,t,r,...n)=>"rgb"===e?"ansi16m"===t?pe[r].ansi16m(...n):"ansi256"===t?pe[r].ansi256(pe.rgbToAnsi256(...n)):pe[r].ansi(pe.rgbToAnsi(...n)):"hex"===e?_e("rgb",t,r,...pe.hexToRgb(...n)):pe[r][e](...n),ke=["rgb","hex","ansi256"];for(const e of ke){Se[e]={get(){const{level:t}=this;return function(...r){const n=Ne(_e(e,Ee[t],"color",...r),pe.color.close,this[$e]);return Ie(this,n,this[we])}}};Se["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const{level:t}=this;return function(...r){const n=Ne(_e(e,Ee[t],"bgColor",...r),pe.bgColor.close,this[$e]);return Ie(this,n,this[we])}}}}const Ce=Object.defineProperties(()=>{},{...Se,level:{enumerable:!0,get(){return this[be].level},set(e){this[be].level=e}}}),Ne=(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}},Ie=(e,t,r)=>{const n=(...e)=>Oe(n,1===e.length?""+e[0]:e.join(" "));return Object.setPrototypeOf(n,Ce),n[be]=e,n[$e]=t,n[we]=r,n},Oe=(e,t)=>{if(e.level<=0||!t)return e[we]?"":t;let r=e[$e];if(void 0===r)return t;const{openAll:n,closeAll:o}=r;if(t.includes(""))for(;void 0!==r;)t=ge(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(Le.prototype,Se);const Ae=Le();Le({level:ve?ve.level:0});const Te=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})}),xe="app-bundle.zip",De=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)",xe).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)})}),je=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))};je({allowDev:!0});const Re=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,Fe=t("--tenantId <string>","The Azure Active Directory tenant ID").env("FUSION_TENANT_ID").default("3aa4a235-b6e2-48d5-9195-7fcf05b459b0"),Me=t("--clientId <string>","The client ID of the application registered in Azure AD").env("FUSION_CLIENT_ID").default("a318b8e1-0295-4e17-98d5-35f67dfeba14"),Ge=t("--token <string>","The Azure AD access token. If provided, the --tenant and --client options are ignored").env("FUSION_TOKEN").default(void 0),Ue=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"]),Be=(e,t)=>(e.addOption(Fe),e.addOption(Me),t?.excludeToken||e.addOption(Ge),t?.includeScope&&e.addOption(Ue),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(!Re.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(!Re.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),ze=Be(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(je({allowDev:!1})).action(async e=>{const t=new d("app:check",{debug:!!e.debug});await m({log:t,environment:e.env,auth:"token"in e?{token:e.token}:e})})),He=Be(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 --env ci"," $ 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(je({allowDev:!1})).argument("[bundle]","Application bundle to upload",xe).action(async(e,t)=>{const r=new d("portal:upload",{debug:t.debug});await m({log:r,environment:t.env,auth:"token"in t?{token:t.token}:t})||(r.error("😢 App is not registered / deleted in app store"),process.exit(1)),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)})})),Ve=Be(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(je({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("🤪",Ae.blue("--env"),'cannot be "dev" when',Ae.blue("--publish")," is used"),process.exit(1)),v({config:e,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 We=Be(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(je({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:",Ae.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)})})),qe=e("dev").description("Start the application in development mode.").addHelpText("after",["","Configuration:"," dev-server.config.ts Optional configuration file for API mocking, service discovery,"," and development environment customization","","Examples:"," $ ffc app dev"," $ ffc app dev --port 4000"," $ ffc app dev --manifest ./app.manifest.local.ts --config ./app.config.ts"," $ ffc app dev --host 0.0.0.0","","See https://equinor.github.io/fusion-framework/cli/docs/dev-server-config.html for configuration options."].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").option("--host <host>","Host for the development server").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,host:e.host}),t.succeed("Development server started successfully.")}),Ke=(e,t)=>{try{return D(e,j.F_OK),!0}catch(e){return!1}},Ye=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),Ke(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))}),Je=Be(e("publish").description("Deployment: Upload and tag your Fusion application (builds if no bundle provided).").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(je({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(await m({log:r,environment:t.env,auth:"token"in t?{token:t.token}:t})||(r.error("😢 App is not registered / deleted in app store"),process.exit(1)),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 Xe(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 Ze(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 Xe(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 Qe(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(!q(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 et(e,t,r){const n=Qe(e,r);M(n,t)}const tt=["code","cursor"];async function rt(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 W.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 tt.includes(e)}(r))return void t.error(`Invalid IDE command: ${r}. Only supported IDEs are: ${tt.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 nt=["npm","pnpm"];async function ot(e,t){const{installDeps:r}=await W.prompt([{type:"confirm",name:"installDeps",message:"📦 Install dependencies?",default:!0}]);if(!r)return t.debug("Skipping dependency installation"),{installed:!1};const{packageManager:n}=await W.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){V(nt.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 it{#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 st=re.object({type:re.literal("file"),path:re.string(),target:re.string().optional()}),at=re.object({type:re.literal("dir"),path:re.string(),target:re.string().optional(),recursive:re.boolean().optional()}),ct=re.discriminatedUnion("type",[st,at]),lt=re.object({name:re.string(),description:re.string(),resources:re.array(ct)}),dt=re.object({templates:re.array(lt),resources:re.array(ct).optional()});class ut{repo;#n=!1;#o;#i;#s;#a;#c;get protocol(){return this.#a}set protocol(e){V("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(Z(),"ffc","repo",e),this.#s=t.log,this.#c=t.branch??"main",this.#o=ee(),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..."),H(this.#i,{recursive:!0}),this.#s?.succeed("Repository directory created successfully!")),this.#o=ee({baseDir:this.#i}),this._setupOutputHandler(),!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 dt.parse(t)}catch(e){if(e instanceof re.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 it({...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 et(Qe(this.#i,Z()),{recursive:!0,force:!0},Z()),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(te.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))})})}}const pt=[".rsa",".ed25519",".ecdsa",".dsa"],ht=/(_rsa|_ed25519|_ecdsa|_dsa)$/,ft=new Set(["known_hosts","config","authorized_keys","authorized_keys2","ssh_config","ssh_known_hosts"]);function mt(e){if(e.endsWith(".pub"))return!1;if(ft.has(e))return!1;const t=e.startsWith("id_"),r=pt.some(t=>e.endsWith(t)),n=ht.test(e);return t||r||n}async function gt(e){e?.debug("Detecting SSH configuration...");const t=function(){try{return X("git config core.sshCommand",{stdio:"ignore"}),!0}catch{return!1}}()||function(e){try{const t=c(Q(),".ssh");if(!G(t))return!1;for(const r of U(t,{withFileTypes:!0}))if(r.isFile()&&mt(r.name))return e?.debug("SSH private key detected in .ssh directory"),!0;return!1}catch{return!1}}(e);t&&e?.debug("SSH configuration detected");const r=t?void 0:"SSH not configured (no SSH keys or git config found)",{selectedProtocol:n}=await W.prompt([{type:"list",name:"selectedProtocol",message:"🔐 Which Git protocol would you like to use for cloning?",choices:[{name:"HTTPS - Works with personal access tokens and is generally more compatible",value:"https",short:"HTTPS"},{name:"SSH - Faster and more secure, but requires SSH key setup",value:"ssh",short:"SSH",disabled:r}],default:t?"ssh":"https",pageSize:5,loop:!1}]);return e?.debug(`Selected protocol: ${n}`),n}async function yt(e,t,r){V(!!e,"App name is required"),V(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;V("string"==typeof e,"Target directory must be a string");try{o=Qe(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{et(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 W.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{et(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(Z(),"ffc","repo",e);if(n.debug(`Repo dir: ${o}`),t){n.debug(`Removing repo dir: ${o}`);try{et(Qe(o,Z()),{recursive:!0,force:!0},Z())}catch(e){n.debug("Cleanup failed:",e)}}const i=await gt(n),a=new ut(e,{baseDir:o,log:n,branch:r,protocol:i});return await a.initialize(),a}("equinor/fusion-app-template",t.clean,t.branch,r),a=await i.getAvailableTemplates(),l=await async function(e,t,r){V(Array.isArray(e),"Templates must be an array"),V(e.length>0,"No templates available");const n=e.map(e=>e.name);if(t){V("string"==typeof t,"Pre-selected template must be a string"),V(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 V(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 W.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 Ze(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 W.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 rt(n,r);const{installed:d,packageManager:u}=await ot(n,r);if(d&&u){const e=await async function(e,t,r,n=!1){const{startDev:o}=await W.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 vt=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 yt(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)}});De.alias("build-pack").hook("preAction",e=>{"build-pack"===process.argv[3]&&(console.warn(Ae.bgRedBright.bold('The command "build-pack" is deprecated. Please use "pack" instead.')),e.getOptionValue("archive")||e.setOptionValue("archive",xe))}),He.alias("build-upload").hook("preAction",e=>{if("build-upload"===process.argv[3]){if(console.warn(Ae.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")??xe;process.argv[4]=t}}),Ye.alias("build-manifest").hook("preAction",()=>{"build-manifest"===process.argv[3]&&console.warn(Ae.bgRedBright.bold('The command "build-manifest" is deprecated. Please use "manifest" instead.'))}),Je.alias("build-publish").hook("preAction",e=>{if("build-publish"===process.argv[3]&&console.warn(Ae.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 bt=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(Te).addCommand(De).addCommand(ze).addCommand(He).addCommand(Ve).addCommand(We).addCommand(qe).addCommand(Ye).addCommand(Je).addCommand(vt("create")),$t=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:",Ae.green(e.account?.username)),t.info("tenant: ",Ae.yellow(e.tenantId)),t.info("audience:",Ae.yellow(e.account?.idTokenClaims?.aud));for(const r of e.scopes)t.info("scope: ",Ae.dim(r));t.succeed("Successfully logged in",Ae.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}});Be($t,{includeScope:!0,excludeToken:!0});const wt=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}});Be(wt,{excludeToken:!0,includeScope:!1});class Et extends Error{static Name="NoAccountsError";constructor(e,t){super(e,t),this.name=Et.Name}}const St=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 Et))throw r;t?.fail("No accounts found, please login first")}});Be(St,{includeScope:!0});const Pt=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"));Pt.addCommand($t,{isDefault:!0}),Pt.addCommand(wt),Pt.addCommand(St);const Lt=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(vt("app")),_t=Be(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(je({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))})),kt=e("disco").description("Service discovery operations");kt.addCommand(_t);const Ct=e("dev").description("Start a local development server for the Fusion portal.").addHelpText("after",["","Configuration:"," dev-server.config.ts Optional configuration file for API mocking, service discovery,"," and development environment customization","","Examples:"," $ ffc portal dev"," $ ffc portal dev --port 4000"," $ ffc portal dev --debug","","See https://equinor.github.io/fusion-framework/cli/docs/dev-server-config.html for configuration options."].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 Nt(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var It,Ot,At,Tt;function xt(){if(Ot)return It;Ot=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 It=e}function Dt(){if(Tt)return At;Tt=1;const e=Number.MAX_SAFE_INTEGER||9007199254740991;return At={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 jt,Rt,Ft,Mt,Gt,Ut,Bt,zt,Ht,Vt,Wt,qt,Kt,Yt={exports:{}};function Jt(){return jt||(jt=1,function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:o}=Dt(),i=xt(),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*$")}(Yt,Yt.exports)),Yt.exports}function Xt(){if(Bt)return Ut;Bt=1;const e=xt(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:r}=Dt(),{safeRe:n,t:o}=Jt(),i=function(){if(Ft)return Rt;Ft=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return Rt=r=>r?"object"!=typeof r?e:r:t}(),{compareIdentifiers:s}=function(){if(Gt)return Mt;Gt=1;const e=/^[0-9]+$/,t=(t,r)=>{if("number"==typeof t&&"number"==typeof r)return t===r?0:t<r?-1:1;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 Mt={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)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}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 Ut=a}function Zt(){if(Ht)return zt;Ht=1;const e=Xt();return zt=(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,er,tr,rr,nr,or,ir,sr,ar,cr,lr=["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"],dr=["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"],ur=["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 pr(){if(er)return Qt;er=1;var e=[].concat(lr).concat(dr),t=ur;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 hr(){return rr||(rr=1,tr=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}),tr}function fr(){if(or)return nr;or=1;var e=pr(),t=hr();return nr=function(r){return t(e(r))}}function mr(){if(cr)return ar;cr=1;var e=fr(),t=function(){if(sr)return ir;sr=1;var e=fr(),t=lr;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 ir=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 ar=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 gr,yr,vr,br,$r,wr,Er,Sr,Pr,Lr,_r,kr={};function Cr(){if(gr)return kr;gr=1,Object.defineProperty(kr,"__esModule",{value:!0}),kr.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;#T;#x;#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.#L},get tail(){return e.#_},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:L,noDeleteOnStaleGet:_,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.#T=!!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.#L=0,this.#_=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.#x=!!this.#f,this.noDisposeOnSet=!!v,this.noUpdateTTL=!!b,this.noDeleteOnFetchRejection=!!L,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=!!_,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.#H=(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.#V(this.#w[r],"expire")},n+1);e.unref&&e.unref()}},this.#W=r=>{t[r]=0!==e[r]?this.#y.now():0},this.#q=(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}}#W=()=>{};#q=()=>{};#H=()=>{};#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.#_;this.#Z(t)&&(!e&&this.#U(t)||(yield t),t!==this.#L);)t=this.#P[t]}*#G({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.#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.#V(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.#V(e,"set"),this;let d=0===this.#v?void 0:this.#$.get(e);if(void 0===d)d=0===this.#v?this.#_: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.#_]=d,this.#P[d]=this.#_,this.#_=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.#T&&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.#x&&this.#C?.push([t,e,"set"]))}else i||(this.#A&&this.#p?.(r,e,"set"),this.#x&&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.#H(d,n,o),a&&this.#q(a,d)),!i&&this.#x&&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.#L];if(this.#X(!0),this.#j(e)){if(e.__staleWhileFetching)return e.__staleWhileFetching}else if(void 0!==e)return e}}finally{if(this.#x&&this.#C){const e=this.#C;let t;for(;t=e?.shift();)this.#f?.(...t)}}}#X(e){const t=this.#L,r=this.#w[t],n=this.#E[t];return this.#T&&this.#j(n)?n.__abortController.abort(new Error("evicted")):(this.#A||this.#x)&&(this.#A&&this.#p?.(n,r,"evict"),this.#x&&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.#L=this.#_=0,this.#k.length=0):this.#L=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.#W(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.#$.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.#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.#E[t]===u){!c||void 0===l.__staleWhileFetching?this.#V(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.#T)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.#T)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.#W(b),g&&this.#q(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.#q(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.#V(e,"expire"),i&&r&&(i.returnedStale=!0),r?t:void 0)):(i&&(i.get="hit"),a?t.__staleWhileFetching:(this.#F(s),n&&this.#W(s),t))}i&&(i.get="miss")}#Q(e,t){this.#P[t]=e,this.#S[e]=t}#F(e){e!==this.#_&&(e===this.#L?this.#L=this.#S[e]:this.#Q(this.#P[e],this.#S[e]),this.#Q(this.#_,e),this.#_=e)}delete(e){return this.#V(e,"delete")}#V(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.#x)&&(this.#A&&this.#p?.(r,e,t),this.#x&&this.#C?.push([r,e,t])),this.#$.delete(e),this.#w[n]=void 0,this.#E[n]=void 0,n===this.#_)this.#_=this.#P[n];else if(n===this.#L)this.#L=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.#x&&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.#x&&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.#L=0,this.#_=0,this.#k.length=0,this.#b=0,this.#v=0,this.#x&&this.#C){const e=this.#C;let t;for(;t=e?.shift();)this.#f?.(...t)}}}return kr.LRUCache=d,kr}function Nr(){if($r)return br;$r=1;const e=ne,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 br=(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))},br}function Ir(){if(Er)return wr;Er=1;const e=Nr();return wr=(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 Or(){if(Pr)return Sr;Pr=1;const{LRUCache:e}=Cr(),t=function(){if(vr)return yr;vr=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 yr=o}(),r=Ir(),n=Nr(),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 Sr=i}var Ar,Tr,xr={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 Dr(){if(Tr)return Ar;Tr=1;var{URL:e}=o,t=function(){if(Wt)return Vt;Wt=1;const e=Zt();return Vt=(t,r)=>{const n=e(t,r);return n?n.version:null}}(),r=function(){if(Kt)return qt;Kt=1;const e=Zt();return qt=(t,r)=>{const n=e(t.trim().replace(/^[=v]+/,""),r);return n?n.version:null}}(),n=mr(),i=Or(),{isBuiltin:s}=oe,a=["dependencies","devDependencies","optionalDependencies"],c=_r?Lr:(_r=1,Lr=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=xr,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 Ar={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")}},Ar}var jr,Rr,Fr,Mr,Gr={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 Ur(){if(Rr)return jr;Rr=1;var e=ie,t=Gr;function r(r,n,o){return o&&(r=o+"['"+r+"']",n=o+"['"+n+"']"),e.format(t.typo,r,n)}return jr=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)},jr}!function(){if(Mr)return Fr;Mr=1,Fr=n;var e=Dr();n.fixer=e;var t=Ur(),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 Br=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 L({log:r,manifest:e});if(t.output){const e=s(process.cwd(),t.output);r?.start("Writing manifest to file",t.output),Ke(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 zr,Hr={exports:{}},Vr={},Wr={},qr={},Kr={},Yr={},Jr={};function Xr(){return zr||(zr=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())}}(Jr)),Jr}var Zr,Qr,en={};function tn(){return Zr||(Zr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=Xr();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}}}(en)),en}function rn(){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=Xr(),r=tn();var n=Xr();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=tn();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 L extends f{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}L.kind="catch";class _ extends f{render(e){return"finally"+super.render(e)}}_.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 L(e),t(e)}return r&&(this._currNode=n.finally=new _,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)}}(Yr)),Yr}var nn,on={};function sn(){if(nn)return on;nn=1,Object.defineProperty(on,"__esModule",{value:!0}),on.checkStrictMode=on.getErrorPath=on.Type=on.useFunc=on.setEvaluated=on.evaluatedPropsToName=on.mergeEvaluated=on.eachItem=on.unescapeJsonPointer=on.escapeJsonPointer=on.escapeFragment=on.unescapeFragment=on.schemaRefOrVal=on.schemaHasRulesButRef=on.schemaHasRules=on.checkUnknownRules=on.alwaysValidSchema=on.toHash=void 0;const e=rn(),t=Xr();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))}on.toHash=function(e){const t={};for(const r of e)t[r]=!0;return t},on.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(r(e,t),!n(t,e.self.RULES.all))},on.checkUnknownRules=r,on.schemaHasRules=n,on.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},on.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)}`},on.unescapeFragment=function(e){return i(decodeURIComponent(e))},on.escapeFragment=function(e){return encodeURIComponent(o(e))},on.escapeJsonPointer=o,on.unescapeJsonPointer=i,on.eachItem=function(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)},on.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)})},on.evaluatedPropsToName=a,on.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 on.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||(on.Type=d={})),on.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)},on.checkStrictMode=u,on}var an,cn,ln,dn={};function un(){if(an)return dn;an=1,Object.defineProperty(dn,"__esModule",{value:!0});const e=rn(),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 dn.default=t,dn}function pn(){return cn||(cn=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=rn(),r=sn(),n=un();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]}}(Kr)),Kr}var hn,fn={},mn={};function gn(){if(hn)return mn;hn=1,Object.defineProperty(mn,"__esModule",{value:!0}),mn.getRules=mn.isJSONType=void 0;const e=new Set(["string","number","integer","boolean","null","object","array"]);return mn.isJSONType=function(t){return"string"==typeof t&&e.has(t)},mn.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:{}}},mn}var yn,vn,bn={};function $n(){if(yn)return bn;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 yn=1,Object.defineProperty(bn,"__esModule",{value:!0}),bn.shouldUseRule=bn.shouldUseGroup=bn.schemaHasRulesForType=void 0,bn.schemaHasRulesForType=function({schema:t,self:r},n){const o=r.RULES.types[n];return o&&!0!==o&&e(t,o)},bn.shouldUseGroup=e,bn.shouldUseRule=t,bn}function wn(){if(vn)return fn;vn=1,Object.defineProperty(fn,"__esModule",{value:!0}),fn.reportTypeError=fn.checkDataTypes=fn.checkDataType=fn.coerceAndCheckDataType=fn.getJSONTypes=fn.getSchemaTypes=fn.DataType=void 0;const e=gn(),t=$n(),r=pn(),n=rn(),o=sn();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||(fn.DataType=i={})),fn.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},fn.getJSONTypes=s,fn.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 L,buildPortal as _,bundlePortal as k,uploadPortalBundle as C,tagPortal as N,publishPortalConfig as I,generatePortalConfig as O}from"@equinor/fusion-framework-cli/bin";import{mkdir as A,writeFile as x}from"node:fs/promises";import{accessSync as T,constants as D,readFileSync as j,writeFileSync as R,rmSync as F,existsSync as M,readdirSync as G,copyFileSync as U,cpSync as B,mkdirSync as z}from"node:fs";import H from"node:assert";import V from"inquirer";import W from"is-path-inside";import{execa as q,ExecaError as K}from"execa";import{spawn as Y,execSync as J}from"node:child_process";import{tmpdir as X,homedir as Z}from"node:os";import{simpleGit as Q,ResetMode as ee}from"simple-git";import{z as te}from"zod";import re from"url";import ne from"node:module";import oe from"util";import{importConfig as ie,importJSON as se}from"@equinor/fusion-imports";import"deepmerge";const ae=(e=0)=>t=>`[${t+e}m`,ce=(e=0)=>t=>`[${38+e};5;${t}m`,le=(e=0)=>(t,r,n)=>`[${38+e};2;${t};${r};${n}m`,de={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(de.modifier);Object.keys(de.color),Object.keys(de.bgColor);const ue=function(){const e=new Map;for(const[t,r]of Object.entries(de)){for(const[t,n]of Object.entries(r))de[t]={open:`[${n[0]}m`,close:`[${n[1]}m`},r[t]=de[t],e.set(n[0],n[1]);Object.defineProperty(de,t,{value:r,enumerable:!1})}return Object.defineProperty(de,"codes",{value:e,enumerable:!1}),de.color.close="[39m",de.bgColor.close="[49m",de.color.ansi=ae(),de.color.ansi256=ce(),de.color.ansi16m=le(),de.bgColor.ansi=ae(10),de.bgColor.ansi256=ce(10),de.bgColor.ansi16m=le(10),Object.defineProperties(de,{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=>de.rgbToAnsi256(...de.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)=>de.ansi256ToAnsi(de.rgbToAnsi256(e,t,r)),enumerable:!1},hexToAnsi:{value:e=>de.ansi256ToAnsi(de.hexToAnsi256(e)),enumerable:!1}}),de}(),pe=(()=>{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})(),he=0!==pe&&{level:pe},fe={stdout:he,stderr:he};function me(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:ge,stderr:ye}=fe,ve=Symbol("GENERATOR"),be=Symbol("STYLER"),$e=Symbol("IS_EMPTY"),we=["ansi","ansi","ansi256","ansi16m"],Ee=Object.create(null),Se=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=ge?ge.level:0;e.level=void 0===t.level?r:t.level})(t,e),Object.setPrototypeOf(t,Pe.prototype),t};function Pe(e){return Se(e)}Object.setPrototypeOf(Pe.prototype,Function.prototype);for(const[e,t]of Object.entries(ue))Ee[e]={get(){const r=Ne(this,Ce(t.open,t.close,this[be]),this[$e]);return Object.defineProperty(this,e,{value:r}),r}};Ee.visible={get(){const e=Ne(this,this[be],!0);return Object.defineProperty(this,"visible",{value:e}),e}};const Le=(e,t,r,...n)=>"rgb"===e?"ansi16m"===t?ue[r].ansi16m(...n):"ansi256"===t?ue[r].ansi256(ue.rgbToAnsi256(...n)):ue[r].ansi(ue.rgbToAnsi(...n)):"hex"===e?Le("rgb",t,r,...ue.hexToRgb(...n)):ue[r][e](...n),_e=["rgb","hex","ansi256"];for(const e of _e){Ee[e]={get(){const{level:t}=this;return function(...r){const n=Ce(Le(e,we[t],"color",...r),ue.color.close,this[be]);return Ne(this,n,this[$e])}}};Ee["bg"+e[0].toUpperCase()+e.slice(1)]={get(){const{level:t}=this;return function(...r){const n=Ce(Le(e,we[t],"bgColor",...r),ue.bgColor.close,this[be]);return Ne(this,n,this[$e])}}}}const ke=Object.defineProperties(()=>{},{...Ee,level:{enumerable:!0,get(){return this[ve].level},set(e){this[ve].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}},Ne=(e,t,r)=>{const n=(...e)=>Ie(n,1===e.length?""+e[0]:e.join(" "));return Object.setPrototypeOf(n,ke),n[ve]=e,n[be]=t,n[$e]=r,n},Ie=(e,t)=>{if(e.level<=0||!t)return e[$e]?"":t;let r=e[be];if(void 0===r)return t;const{openAll:n,closeAll:o}=r;if(t.includes(""))for(;void 0!==r;)t=me(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(Pe.prototype,Ee);const Oe=Pe();Pe({level:ye?ye.level:0});const Ae=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})}),xe="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)",xe).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)})}),De=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))};De({allowDev:!0});const je=/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i,Re=t("--tenantId <string>","The Azure Active Directory tenant ID").env("FUSION_TENANT_ID").default("3aa4a235-b6e2-48d5-9195-7fcf05b459b0"),Fe=t("--clientId <string>","The client ID of the application registered in Azure AD").env("FUSION_CLIENT_ID").default("a318b8e1-0295-4e17-98d5-35f67dfeba14"),Me=t("--token <string>","The Azure AD access token. If provided, the --tenant and --client options are ignored").env("FUSION_TOKEN").default(void 0),Ge=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"]),Ue=(e,t)=>(e.addOption(Re),e.addOption(Fe),t?.excludeToken||e.addOption(Me),t?.includeScope&&e.addOption(Ge),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(!je.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(!je.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),Be=Ue(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(De({allowDev:!1})).action(async e=>{const t=new d("app:check",{debug:!!e.debug});await m({log:t,environment:e.env,auth:"token"in e?{token:e.token}:e})})),ze=Ue(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 --env ci"," $ 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(De({allowDev:!1})).argument("[bundle]","Application bundle to upload",xe).action(async(e,t)=>{const r=new d("portal:upload",{debug:t.debug});await m({log:r,environment:t.env,auth:"token"in t?{token:t.token}:t})||(r.error("😢 App is not registered / deleted in app store"),process.exit(1)),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)})})),He=Ue(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(De({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("🤪",Oe.blue("--env"),'cannot be "dev" when',Oe.blue("--publish")," is used"),process.exit(1)),v({config:e,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=Ue(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(De({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:",Oe.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)})})),We=e("dev").description("Start the application in development mode.").addHelpText("after",["","Configuration:"," dev-server.config.ts Optional configuration file for API mocking, service discovery,"," and development environment customization","","Examples:"," $ ffc app dev"," $ ffc app dev --port 4000"," $ ffc app dev --manifest ./app.manifest.local.ts --config ./app.config.ts"," $ ffc app dev --host 0.0.0.0","","See https://equinor.github.io/fusion-framework/cli/docs/dev-server-config.html for configuration options."].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").option("--host <host>","Host for the development server").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,host:e.host}),t.succeed("Development server started successfully.")}),qe=(e,t)=>{try{return T(e,D.F_OK),!0}catch(e){return!1}},Ke=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 A(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))}),Ye=Ue(e("publish").description("Deployment: Upload and tag your Fusion application (builds if no bundle provided).").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(De({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(await m({log:r,environment:t.env,auth:"token"in t?{token:t.token}:t})||(r.error("😢 App is not registered / deleted in app store"),process.exit(1)),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 Je(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 Xe(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 Je(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 Ze(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 Qe(e,t,r){const n=Ze(e,r);F(n,t)}const et=["code","cursor"];async function tt(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 V.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 et.includes(e)}(r))return void t.error(`Invalid IDE command: ${r}. Only supported IDEs are: ${et.join(", ")}`);try{const n=q(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 rt=["npm","pnpm"];async function nt(e,t){const{installDeps:r}=await V.prompt([{type:"confirm",name:"installDeps",message:"📦 Install dependencies?",default:!0}]);if(!r)return t.debug("Skipping dependency installation"),{installed:!1};const{packageManager:n}=await V.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(rt.includes(t),"Package manager must be npm or pnpm"),r?.start("Installing dependencies...");try{return await q(t,["install"],{cwd:e,stdio:"inherit",shell:!0}),r?.succeed("Dependencies installed successfully!"),t}catch(e){if(e instanceof K&&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 ot{#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(M(r))try{"file"===t.type?(U(r,n),this.#t?.debug(`Copied file: ${t.path} -> ${n}`)):"dir"===t.type?(B(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 it=te.object({type:te.literal("file"),path:te.string(),target:te.string().optional()}),st=te.object({type:te.literal("dir"),path:te.string(),target:te.string().optional(),recursive:te.boolean().optional()}),at=te.discriminatedUnion("type",[it,st]),ct=te.object({name:te.string(),description:te.string(),resources:te.array(at)}),lt=te.object({templates:te.array(ct),resources:te.array(at).optional()});class dt{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=Q(),this.#a=t.protocol??"https"}async initialize(){if(!this.#n)try{if(this.#s?.debug("Checking if repository directory exists...",this.#i),M(this.#i)||(this.#s?.info("Repository directory does not exist, creating..."),z(this.#i,{recursive:!0}),this.#s?.succeed("Repository directory created successfully!")),this.#o=Q({baseDir:this.#i}),this._setupOutputHandler(),!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=j(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 lt.parse(t)}catch(e){if(e instanceof te.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 ot({...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 Qe(Ze(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(ee.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))})})}}const ut=[".rsa",".ed25519",".ecdsa",".dsa"],pt=/(_rsa|_ed25519|_ecdsa|_dsa)$/,ht=new Set(["known_hosts","config","authorized_keys","authorized_keys2","ssh_config","ssh_known_hosts"]);function ft(e){if(e.endsWith(".pub"))return!1;if(ht.has(e))return!1;const t=e.startsWith("id_"),r=ut.some(t=>e.endsWith(t)),n=pt.test(e);return t||r||n}async function mt(e){e?.debug("Detecting SSH configuration...");const t=function(){try{return J("git config core.sshCommand",{stdio:"ignore"}),!0}catch{return!1}}()||function(e){try{const t=c(Z(),".ssh");if(!M(t))return!1;for(const r of G(t,{withFileTypes:!0}))if(r.isFile()&&ft(r.name))return e?.debug("SSH private key detected in .ssh directory"),!0;return!1}catch{return!1}}(e);t&&e?.debug("SSH configuration detected");const r=t?void 0:"SSH not configured (no SSH keys or git config found)",{selectedProtocol:n}=await V.prompt([{type:"list",name:"selectedProtocol",message:"🔐 Which Git protocol would you like to use for cloning?",choices:[{name:"HTTPS - Works with personal access tokens and is generally more compatible",value:"https",short:"HTTPS"},{name:"SSH - Faster and more secure, but requires SSH key setup",value:"ssh",short:"SSH",disabled:r}],default:t?"ssh":"https",pageSize:5,loop:!1}]);return e?.debug(`Selected protocol: ${n}`),n}async function gt(e,t,r){H(!!e,"App name is required"),H(M(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=Ze(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(!M(o))return t.debug(`Target directory does not exist: ${o}`),!0;try{const e=G(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{Qe(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 V.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{Qe(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{Qe(Ze(o,X()),{recursive:!0,force:!0},X())}catch(e){n.debug("Cleanup failed:",e)}}const i=await mt(n),a=new dt(e,{baseDir:o,log:n,branch:r,protocol:i});return await a.initialize(),a}("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 V.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=j(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 Xe(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"),R(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 V.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 tt(n,r);const{installed:d,packageManager:u}=await nt(n,r);if(d&&u){const e=await async function(e,t,r,n=!1){const{startDev:o}=await V.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=Y(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 yt=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 gt(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(Oe.bgRedBright.bold('The command "build-pack" is deprecated. Please use "pack" instead.')),e.getOptionValue("archive")||e.setOptionValue("archive",xe))}),ze.alias("build-upload").hook("preAction",e=>{if("build-upload"===process.argv[3]){if(console.warn(Oe.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")??xe;process.argv[4]=t}}),Ke.alias("build-manifest").hook("preAction",()=>{"build-manifest"===process.argv[3]&&console.warn(Oe.bgRedBright.bold('The command "build-manifest" is deprecated. Please use "manifest" instead.'))}),Ye.alias("build-publish").hook("preAction",e=>{if("build-publish"===process.argv[3]&&console.warn(Oe.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 vt=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(Ae).addCommand(Te).addCommand(Be).addCommand(ze).addCommand(He).addCommand(Ve).addCommand(We).addCommand(Ke).addCommand(Ye).addCommand(yt("create")),bt=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({request:{scopes:r}});t.info("username:",Oe.green(e.account?.username)),t.info("tenant: ",Oe.yellow(e.tenantId)),t.info("audience:",Oe.yellow(e.account?.idTokenClaims?.aud));for(const r of e.scopes)t.info("scope: ",Oe.dim(r));t.succeed("Successfully logged in",Oe.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}});Ue(bt,{includeScope:!0,excludeToken:!0});const $t=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}});Ue($t,{excludeToken:!0,includeScope:!1});class wt extends Error{static Name="NoAccountsError";constructor(e,t){super(e,t),this.name=wt.Name}}const Et=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({request:{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 wt))throw r;t?.fail("No accounts found, please login first")}});Ue(Et,{includeScope:!0});const St=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"));St.addCommand(bt,{isDefault:!0}),St.addCommand($t),St.addCommand(Et);const Pt=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(yt("app")),Lt=Ue(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(De({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(Lt);const kt=e("dev").description("Start a local development server for the Fusion portal.").addHelpText("after",["","Configuration:"," dev-server.config.ts Optional configuration file for API mocking, service discovery,"," and development environment customization","","Examples:"," $ ffc portal dev"," $ ffc portal dev --port 4000"," $ ffc portal dev --debug","","See https://equinor.github.io/fusion-framework/cli/docs/dev-server-config.html for configuration options."].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 Ct(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Nt,It,Ot,At;function xt(){if(It)return Nt;It=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 Nt=e}function Tt(){if(At)return Ot;At=1;const e=Number.MAX_SAFE_INTEGER||9007199254740991;return Ot={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 Dt,jt,Rt,Ft,Mt,Gt,Ut,Bt,zt,Ht,Vt,Wt,qt,Kt={exports:{}};function Yt(){return Dt||(Dt=1,function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:o}=Tt(),i=xt(),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*$")}(Kt,Kt.exports)),Kt.exports}function Jt(){if(Ut)return Gt;Ut=1;const e=xt(),{MAX_LENGTH:t,MAX_SAFE_INTEGER:r}=Tt(),{safeRe:n,t:o}=Yt(),i=function(){if(Rt)return jt;Rt=1;const e=Object.freeze({loose:!0}),t=Object.freeze({});return jt=r=>r?"object"!=typeof r?e:r:t}(),{compareIdentifiers:s}=function(){if(Mt)return Ft;Mt=1;const e=/^[0-9]+$/,t=(t,r)=>{if("number"==typeof t&&"number"==typeof r)return t===r?0:t<r?-1:1;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 Ft={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)),this.major<e.major?-1:this.major>e.major?1:this.minor<e.minor?-1:this.minor>e.minor?1:this.patch<e.patch?-1:this.patch>e.patch?1:0}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 Gt=a}function Xt(){if(zt)return Bt;zt=1;const e=Jt();return Bt=(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 Zt,Qt,er,tr,rr,nr,or,ir,sr,ar,cr=["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"],lr=["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"],dr=["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 ur(){if(Qt)return Zt;Qt=1;var e=[].concat(cr).concat(lr),t=dr;return Zt=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 pr(){return tr||(tr=1,er=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}),er}function hr(){if(nr)return rr;nr=1;var e=ur(),t=pr();return rr=function(r){return t(e(r))}}function fr(){if(ar)return sr;ar=1;var e=hr(),t=function(){if(ir)return or;ir=1;var e=hr(),t=cr;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 or=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 sr=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 mr,gr,yr,vr,br,$r,wr,Er,Sr,Pr,Lr,_r={};function kr(){if(mr)return _r;mr=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.#L},get tail(){return e.#_},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:L,noDeleteOnStaleGet:_,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.#L=0,this.#_=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=!!L,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=!!_,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.#H=(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.#V(this.#w[r],"expire")},n+1);e.unref&&e.unref()}},this.#W=r=>{t[r]=0!==e[r]?this.#y.now():0},this.#q=(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}}#W=()=>{};#q=()=>{};#H=()=>{};#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.#_;this.#Z(t)&&(!e&&this.#U(t)||(yield t),t!==this.#L);)t=this.#P[t]}*#G({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.#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.#V(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.#V(e,"set"),this;let d=0===this.#v?void 0:this.#$.get(e);if(void 0===d)d=0===this.#v?this.#_: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.#_]=d,this.#P[d]=this.#_,this.#_=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.#H(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.#v;){const e=this.#E[this.#L];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.#L,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.#L=this.#_=0,this.#k.length=0):this.#L=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.#W(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.#$.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.#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.#E[t]===u){!c||void 0===l.__staleWhileFetching?this.#V(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.#W(b),g&&this.#q(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.#q(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.#V(e,"expire"),i&&r&&(i.returnedStale=!0),r?t:void 0)):(i&&(i.get="hit"),a?t.__staleWhileFetching:(this.#F(s),n&&this.#W(s),t))}i&&(i.get="miss")}#Q(e,t){this.#P[t]=e,this.#S[e]=t}#F(e){e!==this.#_&&(e===this.#L?this.#L=this.#S[e]:this.#Q(this.#P[e],this.#S[e]),this.#Q(this.#_,e),this.#_=e)}delete(e){return this.#V(e,"delete")}#V(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.#_)this.#_=this.#P[n];else if(n===this.#L)this.#L=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.#L=0,this.#_=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 Cr(){if(br)return vr;br=1;const e=re,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 vr=(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))},vr}function Nr(){if(wr)return $r;wr=1;const e=Cr();return $r=(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 Ir(){if(Sr)return Er;Sr=1;const{LRUCache:e}=kr(),t=function(){if(yr)return gr;yr=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 gr=o}(),r=Nr(),n=Cr(),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 Er=i}var Or,Ar,xr={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 Tr(){if(Ar)return Or;Ar=1;var{URL:e}=o,t=function(){if(Vt)return Ht;Vt=1;const e=Xt();return Ht=(t,r)=>{const n=e(t,r);return n?n.version:null}}(),r=function(){if(qt)return Wt;qt=1;const e=Xt();return Wt=(t,r)=>{const n=e(t.trim().replace(/^[=v]+/,""),r);return n?n.version:null}}(),n=fr(),i=Ir(),{isBuiltin:s}=ne,a=["dependencies","devDependencies","optionalDependencies"],c=Lr?Pr:(Lr=1,Pr=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=xr,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 Or={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")}},Or}var Dr,jr,Rr,Fr,Mr={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 Gr(){if(jr)return Dr;jr=1;var e=oe,t=Mr;function r(r,n,o){return o&&(r=o+"['"+r+"']",n=o+"['"+n+"']"),e.format(t.typo,r,n)}return Dr=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)},Dr}!function(){if(Fr)return Rr;Fr=1,Rr=n;var e=Tr();n.fixer=e;var t=Gr(),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 Ur=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 L({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 A(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 Br,zr={exports:{}},Hr={},Vr={},Wr={},qr={},Kr={},Yr={};function Jr(){return Br||(Br=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())}}(Yr)),Yr}var Xr,Zr,Qr={};function en(){return Xr||(Xr=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ValueScope=e.ValueScopeName=e.Scope=e.varKinds=e.UsedValueState=void 0;const t=Jr();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}}}(Qr)),Qr}function tn(){return Zr||(Zr=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=Jr(),r=en();var n=Jr();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=en();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 L extends f{constructor(e){super(),this.error=e}render(e){return`catch(${this.error})`+super.render(e)}}L.kind="catch";class _ extends f{render(e){return"finally"+super.render(e)}}_.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 L(e),t(e)}return r&&(this._currNode=n.finally=new _,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)}}(Kr)),Kr}var rn,nn={};function on(){if(rn)return nn;rn=1,Object.defineProperty(nn,"__esModule",{value:!0}),nn.checkStrictMode=nn.getErrorPath=nn.Type=nn.useFunc=nn.setEvaluated=nn.evaluatedPropsToName=nn.mergeEvaluated=nn.eachItem=nn.unescapeJsonPointer=nn.escapeJsonPointer=nn.escapeFragment=nn.unescapeFragment=nn.schemaRefOrVal=nn.schemaHasRulesButRef=nn.schemaHasRules=nn.checkUnknownRules=nn.alwaysValidSchema=nn.toHash=void 0;const e=tn(),t=Jr();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))}nn.toHash=function(e){const t={};for(const r of e)t[r]=!0;return t},nn.alwaysValidSchema=function(e,t){return"boolean"==typeof t?t:0===Object.keys(t).length||(r(e,t),!n(t,e.self.RULES.all))},nn.checkUnknownRules=r,nn.schemaHasRules=n,nn.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},nn.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)}`},nn.unescapeFragment=function(e){return i(decodeURIComponent(e))},nn.escapeFragment=function(e){return encodeURIComponent(o(e))},nn.escapeJsonPointer=o,nn.unescapeJsonPointer=i,nn.eachItem=function(e,t){if(Array.isArray(e))for(const r of e)t(r);else t(e)},nn.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)})},nn.evaluatedPropsToName=a,nn.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 nn.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||(nn.Type=d={})),nn.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)},nn.checkStrictMode=u,nn}var sn,an,cn,ln={};function dn(){if(sn)return ln;sn=1,Object.defineProperty(ln,"__esModule",{value:!0});const e=tn(),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 ln.default=t,ln}function un(){return an||(an=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=tn(),r=on(),n=dn();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]}}(qr)),qr}var pn,hn={},fn={};function mn(){if(pn)return fn;pn=1,Object.defineProperty(fn,"__esModule",{value:!0}),fn.getRules=fn.isJSONType=void 0;const e=new Set(["string","number","integer","boolean","null","object","array"]);return fn.isJSONType=function(t){return"string"==typeof t&&e.has(t)},fn.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:{}}},fn}var gn,yn,vn={};function bn(){if(gn)return vn;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 gn=1,Object.defineProperty(vn,"__esModule",{value:!0}),vn.shouldUseRule=vn.shouldUseGroup=vn.schemaHasRulesForType=void 0,vn.schemaHasRulesForType=function({schema:t,self:r},n){const o=r.RULES.types[n];return o&&!0!==o&&e(t,o)},vn.shouldUseGroup=e,vn.shouldUseRule=t,vn}function $n(){if(yn)return hn;yn=1,Object.defineProperty(hn,"__esModule",{value:!0}),hn.reportTypeError=hn.checkDataTypes=hn.checkDataType=hn.coerceAndCheckDataType=hn.getJSONTypes=hn.getSchemaTypes=hn.DataType=void 0;const e=mn(),t=bn(),r=un(),n=tn(),o=on();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||(hn.DataType=i={})),hn.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},hn.getJSONTypes=s,hn.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}fn.checkDataType=c,fn.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 fn.reportTypeError=u,fn}var En,Sn={};var Pn,Ln,_n={},kn={};function Cn(){if(Pn)return kn;Pn=1,Object.defineProperty(kn,"__esModule",{value:!0}),kn.validateUnion=kn.validateArray=kn.usePattern=kn.callValidateCode=kn.schemaProperties=kn.allSchemaProperties=kn.noPropertyInData=kn.propertyInData=kn.isOwnProperty=kn.hasPropFunc=kn.reportMissingProp=kn.checkMissingProp=kn.checkReportMissingProp=void 0;const e=rn(),t=sn(),r=un(),n=sn();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):[]}kn.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()})},kn.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}`)))},kn.reportMissingProp=function(e,t){e.setParams({missingProperty:t},!0),e.error()},kn.hasPropFunc=o,kn.isOwnProperty=i,kn.propertyInData=function(t,r,n,o){const s=e._`${r}${(0,e.getProperty)(n)} !== undefined`;return o?e._`${s} && ${i(t,r,n)}`:s},kn.noPropertyInData=s,kn.allSchemaProperties=a,kn.schemaProperties=function(e,r){return a(r).filter(n=>!(0,t.alwaysValidSchema)(e,r[n]))},kn.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 kn.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})`})},kn.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)})}},kn.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))},kn}function Nn(){if(Ln)return _n;Ln=1,Object.defineProperty(_n,"__esModule",{value:!0}),_n.validateKeywordUsage=_n.validSchemaType=_n.funcKeywordCode=_n.macroKeywordCode=void 0;const e=rn(),t=un(),r=Cn(),n=pn();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 _n.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))},_n.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)},_n.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)},_n.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)}}},_n}var In,On={};var An,Tn,xn={};function Dn(){return Tn||(Tn=1,An=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}),An}var jn,Rn,Fn,Mn={exports:{}};function Gn(){if(jn)return Mn.exports;jn=1;var e=Mn.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},Mn.exports}function Un(){if(Rn)return xn;Rn=1,Object.defineProperty(xn,"__esModule",{value:!0}),xn.getSchemaRefs=xn.resolveUrl=xn.normalizeId=xn._getFullPath=xn.getFullPath=xn.inlineRef=void 0;const e=sn(),t=Dn(),r=Gn(),n=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);xn.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]+"#"}xn.getFullPath=a,xn._getFullPath=c;const l=/#\/?$/;function d(e){return e?e.replace(l,""):""}xn.normalizeId=d,xn.resolveUrl=function(e,t,r){return r=d(r),e.resolve(t,r)};const u=/^[a-z_][-a-z0-9._]*$/i;return xn.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`)}},xn}function Bn(){if(Fn)return Wr;Fn=1,Object.defineProperty(Wr,"__esModule",{value:!0}),Wr.getData=Wr.KeywordCxt=Wr.validateFunctionCode=void 0;const e=function(){if(ln)return qr;ln=1,Object.defineProperty(qr,"__esModule",{value:!0}),qr.boolOrEmptySchema=qr.topBoolOrEmptySchema=void 0;const e=pn(),t=rn(),r=un(),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 qr.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))},qr.boolOrEmptySchema=function(e,t){const{gen:r,schema:n}=e;!1===n?(r.var(t,!1),o(e)):r.var(t,!0)},qr}(),t=wn(),r=$n(),n=wn(),o=function(){if(En)return Sn;En=1,Object.defineProperty(Sn,"__esModule",{value:!0}),Sn.assignDefaults=void 0;const e=rn(),t=sn();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 Sn.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))},Sn}(),i=Nn(),s=function(){if(In)return On;In=1,Object.defineProperty(On,"__esModule",{value:!0}),On.extendSubschemaMode=On.extendSubschemaData=On.getSubschema=void 0;const e=rn(),t=sn();return On.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')},On.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)},On.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},On}(),a=rn(),c=un(),l=Un(),d=sn(),u=pn();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(()=>_(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)&&_(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)}Wr.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 L{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 _(e,t,r,n){const o=new L(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)}Wr.KeywordCxt=L;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 Wr.getData=N,Wr}var zn,Hn={};function Vn(){if(zn)return Hn;zn=1,Object.defineProperty(Hn,"__esModule",{value:!0});class e extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}return Hn.default=e,Hn}var Wn,qn={};function Kn(){if(Wn)return qn;Wn=1,Object.defineProperty(qn,"__esModule",{value:!0});const e=Un();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 qn.default=t,qn}var Yn,Jn={};function Xn(){if(Yn)return Jn;Yn=1,Object.defineProperty(Jn,"__esModule",{value:!0}),Jn.resolveSchema=Jn.getCompilingSchema=Jn.resolveRef=Jn.compileSchema=Jn.SchemaEnv=void 0;const e=rn(),t=Vn(),r=un(),n=Un(),o=sn(),i=Bn();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)}}Jn.SchemaEnv=s,Jn.compileSchema=a,Jn.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},Jn.getCompilingSchema=l,Jn.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 Jn}var Zn,Qn,eo,to,ro,no,oo,io={$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},so={},ao={exports:{}};function co(){if(Qn)return Zn;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 Zn={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 lo(){if(ro)return ao.exports;ro=1;const{normalizeIPv6:e,removeDotSegments:t,recomposeAuthority:r,normalizeComponentEncoding:n,isIPv4:o,nonSimpleDomain:i}=co(),{SCHEMES:s,getSchemeHandler:a}=function(){if(to)return eo;to=1;const{isUUID:e}=co(),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),eo={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 ao.exports=p,ao.exports.default=p,ao.exports.fastUri=p,ao.exports}function uo(){return oo||(oo=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=Bn();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=rn();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=Vn(),o=Kn(),i=gn(),s=Xn(),a=rn(),c=Un(),l=wn(),d=sn(),u=io,p=function(){if(no)return so;no=1,Object.defineProperty(so,"__esModule",{value:!0});const e=lo();return e.code='require("ajv/dist/runtime/uri").default',so.default=e,so}(),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===(L=e.validateFormats)||void 0===L||L,unicodeRegExp:null===(_=e.unicodeRegExp)||void 0===_||_,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 _;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=L.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]=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 L(){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 _={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=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]}}}(Vr)),Vr}var po,ho={},fo={},mo={};var go,yo,vo={};function bo(){if(go)return vo;go=1,Object.defineProperty(vo,"__esModule",{value:!0}),vo.callRef=vo.getValidate=void 0;const e=Kn(),t=Cn(),r=rn(),n=un(),o=Xn(),i=sn(),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 vo.getValidate=a,vo.callRef=c,vo.default=s,vo}function $o(){if(yo)return fo;yo=1,Object.defineProperty(fo,"__esModule",{value:!0});const e=function(){if(po)return mo;po=1,Object.defineProperty(mo,"__esModule",{value:!0});const e={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return mo.default=e,mo}(),t=bo(),r=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",e.default,t.default];return fo.default=r,fo}var wo,Eo={},So={};var Po,Lo={};var _o,ko,Co={},No={};function Io(){if(ko)return Co;ko=1,Object.defineProperty(Co,"__esModule",{value:!0});const e=rn(),t=sn(),r=function(){if(_o)return No;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 _o=1,Object.defineProperty(No,"__esModule",{value:!0}),No.default=e,e.code='require("ajv/dist/runtime/ucs2length").default',No}(),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 Co.default=o,Co}var Oo,Ao={};var To,xo={};var Do,jo={};function Ro(){if(Do)return jo;Do=1,Object.defineProperty(jo,"__esModule",{value:!0});const e=Cn(),t=rn(),r=sn(),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 jo.default=n,jo}var Fo,Mo={};var Go,Uo,Bo={},zo={};function Ho(){if(Go)return zo;Go=1,Object.defineProperty(zo,"__esModule",{value:!0});const e=Dn();return e.code='require("ajv/dist/runtime/equal").default',zo.default=e,zo}function Vo(){if(Uo)return Bo;Uo=1,Object.defineProperty(Bo,"__esModule",{value:!0});const e=wn(),t=rn(),r=sn(),n=Ho(),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 Bo.default=o,Bo}var Wo,qo={};var Ko,Yo,Jo={};function Xo(){if(Ko)return Jo;Ko=1,Object.defineProperty(Jo,"__esModule",{value:!0});const e=rn(),t=sn(),r=Ho(),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 Jo.default=n,Jo}function Zo(){if(Yo)return Eo;Yo=1,Object.defineProperty(Eo,"__esModule",{value:!0});const e=function(){if(wo)return So;wo=1,Object.defineProperty(So,"__esModule",{value:!0});const e=rn(),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 So.default=o,So}(),t=function(){if(Po)return Lo;Po=1,Object.defineProperty(Lo,"__esModule",{value:!0});const e=rn(),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 Lo.default=t,Lo}(),r=Io(),n=function(){if(Oo)return Ao;Oo=1,Object.defineProperty(Ao,"__esModule",{value:!0});const e=Cn(),t=rn(),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 Ao.default=r,Ao}(),o=function(){if(To)return xo;To=1,Object.defineProperty(xo,"__esModule",{value:!0});const e=rn(),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 xo.default=r,xo}(),i=Ro(),s=function(){if(Fo)return Mo;Fo=1,Object.defineProperty(Mo,"__esModule",{value:!0});const e=rn(),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 Mo.default=r,Mo}(),a=Vo(),c=function(){if(Wo)return qo;Wo=1,Object.defineProperty(qo,"__esModule",{value:!0});const e=rn(),t=sn(),r=Ho(),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 qo.default=n,qo}(),l=Xo(),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 Eo.default=d,Eo}var Qo,ei={},ti={};function ri(){if(Qo)return ti;Qo=1,Object.defineProperty(ti,"__esModule",{value:!0}),ti.validateAdditionalItems=void 0;const e=rn(),t=sn(),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 ti.validateAdditionalItems=n,ti.default=r,ti}var ni,oi,ii={},si={};function ai(){if(ni)return si;ni=1,Object.defineProperty(si,"__esModule",{value:!0}),si.validateTuple=void 0;const e=rn(),t=sn(),r=Cn(),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 si.validateTuple=o,si.default=n,si}var ci,li={};var di,ui={};function pi(){if(di)return ui;di=1,Object.defineProperty(ui,"__esModule",{value:!0});const e=rn(),t=sn(),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 ui.default=r,ui}var hi,fi={};function mi(){return hi||(hi=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=rn(),r=sn(),n=Cn();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}hn.checkDataType=c,hn.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 hn.reportTypeError=u,hn}var wn,En={};var Sn,Pn,Ln={},_n={};function kn(){if(Sn)return _n;Sn=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=tn(),t=on(),r=dn(),n=on();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 Cn(){if(Pn)return Ln;Pn=1,Object.defineProperty(Ln,"__esModule",{value:!0}),Ln.validateKeywordUsage=Ln.validSchemaType=Ln.funcKeywordCode=Ln.macroKeywordCode=void 0;const e=tn(),t=dn(),r=kn(),n=un();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 Ln.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))},Ln.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)},Ln.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)},Ln.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)}}},Ln}var Nn,In={};var On,An,xn={};function Tn(){return An||(An=1,On=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}),On}var Dn,jn,Rn,Fn={exports:{}};function Mn(){if(Dn)return Fn.exports;Dn=1;var e=Fn.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},Fn.exports}function Gn(){if(jn)return xn;jn=1,Object.defineProperty(xn,"__esModule",{value:!0}),xn.getSchemaRefs=xn.resolveUrl=xn.normalizeId=xn._getFullPath=xn.getFullPath=xn.inlineRef=void 0;const e=on(),t=Tn(),r=Mn(),n=new Set(["type","format","pattern","maxLength","minLength","maxProperties","minProperties","maxItems","minItems","maximum","minimum","uniqueItems","multipleOf","required","enum","const"]);xn.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]+"#"}xn.getFullPath=a,xn._getFullPath=c;const l=/#\/?$/;function d(e){return e?e.replace(l,""):""}xn.normalizeId=d,xn.resolveUrl=function(e,t,r){return r=d(r),e.resolve(t,r)};const u=/^[a-z_][-a-z0-9._]*$/i;return xn.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`)}},xn}function Un(){if(Rn)return Vr;Rn=1,Object.defineProperty(Vr,"__esModule",{value:!0}),Vr.getData=Vr.KeywordCxt=Vr.validateFunctionCode=void 0;const e=function(){if(cn)return Wr;cn=1,Object.defineProperty(Wr,"__esModule",{value:!0}),Wr.boolOrEmptySchema=Wr.topBoolOrEmptySchema=void 0;const e=un(),t=tn(),r=dn(),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 Wr.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))},Wr.boolOrEmptySchema=function(e,t){const{gen:r,schema:n}=e;!1===n?(r.var(t,!1),o(e)):r.var(t,!0)},Wr}(),t=$n(),r=bn(),n=$n(),o=function(){if(wn)return En;wn=1,Object.defineProperty(En,"__esModule",{value:!0}),En.assignDefaults=void 0;const e=tn(),t=on();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 En.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))},En}(),i=Cn(),s=function(){if(Nn)return In;Nn=1,Object.defineProperty(In,"__esModule",{value:!0}),In.extendSubschemaMode=In.extendSubschemaData=In.getSubschema=void 0;const e=tn(),t=on();return In.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')},In.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)},In.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},In}(),a=tn(),c=dn(),l=Gn(),d=on(),u=un();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(()=>_(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)&&_(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)}Vr.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 L{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 _(e,t,r,n){const o=new L(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)}Vr.KeywordCxt=L;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 Vr.getData=N,Vr}var Bn,zn={};function Hn(){if(Bn)return zn;Bn=1,Object.defineProperty(zn,"__esModule",{value:!0});class e extends Error{constructor(e){super("validation failed"),this.errors=e,this.ajv=this.validation=!0}}return zn.default=e,zn}var Vn,Wn={};function qn(){if(Vn)return Wn;Vn=1,Object.defineProperty(Wn,"__esModule",{value:!0});const e=Gn();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 Wn.default=t,Wn}var Kn,Yn={};function Jn(){if(Kn)return Yn;Kn=1,Object.defineProperty(Yn,"__esModule",{value:!0}),Yn.resolveSchema=Yn.getCompilingSchema=Yn.resolveRef=Yn.compileSchema=Yn.SchemaEnv=void 0;const e=tn(),t=Hn(),r=dn(),n=Gn(),o=on(),i=Un();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)}}Yn.SchemaEnv=s,Yn.compileSchema=a,Yn.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},Yn.getCompilingSchema=l,Yn.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 Yn}var Xn,Zn,Qn,eo,to,ro,no,oo={$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},io={},so={exports:{}};function ao(){if(Zn)return Xn;Zn=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 Xn={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 co(){if(to)return so.exports;to=1;const{normalizeIPv6:e,removeDotSegments:t,recomposeAuthority:r,normalizeComponentEncoding:n,isIPv4:o,nonSimpleDomain:i}=ao(),{SCHEMES:s,getSchemeHandler:a}=function(){if(eo)return Qn;eo=1;const{isUUID:e}=ao(),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),Qn={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 so.exports=p,so.exports.default=p,so.exports.fastUri=p,so.exports}function lo(){return no||(no=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=Un();Object.defineProperty(e,"KeywordCxt",{enumerable:!0,get:function(){return t.KeywordCxt}});var r=tn();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=Hn(),o=qn(),i=mn(),s=Jn(),a=tn(),c=Gn(),l=$n(),d=on(),u=oo,p=function(){if(ro)return io;ro=1,Object.defineProperty(io,"__esModule",{value:!0});const e=co();return e.code='require("ajv/dist/runtime/uri").default',io.default=e,io}(),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===(L=e.validateFormats)||void 0===L||L,unicodeRegExp:null===(_=e.unicodeRegExp)||void 0===_||_,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 _;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=L.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 L(){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 _={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]}}}(Hr)),Hr}var uo,po={},ho={},fo={};var mo,go,yo={};function vo(){if(mo)return yo;mo=1,Object.defineProperty(yo,"__esModule",{value:!0}),yo.callRef=yo.getValidate=void 0;const e=qn(),t=kn(),r=tn(),n=dn(),o=Jn(),i=on(),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 yo.getValidate=a,yo.callRef=c,yo.default=s,yo}function bo(){if(go)return ho;go=1,Object.defineProperty(ho,"__esModule",{value:!0});const e=function(){if(uo)return fo;uo=1,Object.defineProperty(fo,"__esModule",{value:!0});const e={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};return fo.default=e,fo}(),t=vo(),r=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",e.default,t.default];return ho.default=r,ho}var $o,wo={},Eo={};var So,Po={};var Lo,_o,ko={},Co={};function No(){if(_o)return ko;_o=1,Object.defineProperty(ko,"__esModule",{value:!0});const e=tn(),t=on(),r=function(){if(Lo)return Co;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 Lo=1,Object.defineProperty(Co,"__esModule",{value:!0}),Co.default=e,e.code='require("ajv/dist/runtime/ucs2length").default',Co}(),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 ko.default=o,ko}var Io,Oo={};var Ao,xo={};var To,Do={};function jo(){if(To)return Do;To=1,Object.defineProperty(Do,"__esModule",{value:!0});const e=kn(),t=tn(),r=on(),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 Do.default=n,Do}var Ro,Fo={};var Mo,Go,Uo={},Bo={};function zo(){if(Mo)return Bo;Mo=1,Object.defineProperty(Bo,"__esModule",{value:!0});const e=Tn();return e.code='require("ajv/dist/runtime/equal").default',Bo.default=e,Bo}function Ho(){if(Go)return Uo;Go=1,Object.defineProperty(Uo,"__esModule",{value:!0});const e=$n(),t=tn(),r=on(),n=zo(),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 Uo.default=o,Uo}var Vo,Wo={};var qo,Ko,Yo={};function Jo(){if(qo)return Yo;qo=1,Object.defineProperty(Yo,"__esModule",{value:!0});const e=tn(),t=on(),r=zo(),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 Yo.default=n,Yo}function Xo(){if(Ko)return wo;Ko=1,Object.defineProperty(wo,"__esModule",{value:!0});const e=function(){if($o)return Eo;$o=1,Object.defineProperty(Eo,"__esModule",{value:!0});const e=tn(),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 Eo.default=o,Eo}(),t=function(){if(So)return Po;So=1,Object.defineProperty(Po,"__esModule",{value:!0});const e=tn(),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 Po.default=t,Po}(),r=No(),n=function(){if(Io)return Oo;Io=1,Object.defineProperty(Oo,"__esModule",{value:!0});const e=kn(),t=tn(),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 Oo.default=r,Oo}(),o=function(){if(Ao)return xo;Ao=1,Object.defineProperty(xo,"__esModule",{value:!0});const e=tn(),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 xo.default=r,xo}(),i=jo(),s=function(){if(Ro)return Fo;Ro=1,Object.defineProperty(Fo,"__esModule",{value:!0});const e=tn(),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 Fo.default=r,Fo}(),a=Ho(),c=function(){if(Vo)return Wo;Vo=1,Object.defineProperty(Wo,"__esModule",{value:!0});const e=tn(),t=on(),r=zo(),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 Wo.default=n,Wo}(),l=Jo(),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 wo.default=d,wo}var Zo,Qo={},ei={};function ti(){if(Zo)return ei;Zo=1,Object.defineProperty(ei,"__esModule",{value:!0}),ei.validateAdditionalItems=void 0;const e=tn(),t=on(),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 ei.validateAdditionalItems=n,ei.default=r,ei}var ri,ni,oi={},ii={};function si(){if(ri)return ii;ri=1,Object.defineProperty(ii,"__esModule",{value:!0}),ii.validateTuple=void 0;const e=tn(),t=on(),r=kn(),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 ii.validateTuple=o,ii.default=n,ii}var ai,ci={};var li,di={};function ui(){if(li)return di;li=1,Object.defineProperty(di,"__esModule",{value:!0});const e=tn(),t=on(),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 di.default=r,di}var pi,hi={};function fi(){return pi||(pi=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.validateSchemaDeps=e.validatePropertyDeps=e.error=void 0;const t=tn(),r=on(),n=kn();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}(fi)),fi}var gi,yi={};var vi,bi={};function $i(){if(vi)return bi;vi=1,Object.defineProperty(bi,"__esModule",{value:!0});const e=Cn(),t=rn(),r=un(),n=sn(),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 bi.default=o,bi}var wi,Ei={};var Si,Pi={};var Li,_i={};var ki,Ci={};var Ni,Ii={};var Oi,Ai={};var Ti,xi={};var Di,ji,Ri={};function Fi(){if(ji)return ei;ji=1,Object.defineProperty(ei,"__esModule",{value:!0});const e=ri(),t=function(){if(oi)return ii;oi=1,Object.defineProperty(ii,"__esModule",{value:!0});const e=ai(),t={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,e.validateTuple)(t,"items")};return ii.default=t,ii}(),r=ai(),n=function(){if(ci)return li;ci=1,Object.defineProperty(li,"__esModule",{value:!0});const e=rn(),t=sn(),r=Cn(),n=ri(),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 li.default=o,li}(),o=pi(),i=mi(),s=function(){if(gi)return yi;gi=1,Object.defineProperty(yi,"__esModule",{value:!0});const e=rn(),t=sn(),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 yi.default=r,yi}(),a=$i(),c=function(){if(wi)return Ei;wi=1,Object.defineProperty(Ei,"__esModule",{value:!0});const e=Bn(),t=Cn(),r=sn(),n=$i(),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 Ei.default=o,Ei}(),l=function(){if(Si)return Pi;Si=1,Object.defineProperty(Pi,"__esModule",{value:!0});const e=Cn(),t=rn(),r=sn(),n=sn(),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 Pi.default=o,Pi}(),d=function(){if(Li)return _i;Li=1,Object.defineProperty(_i,"__esModule",{value:!0});const e=sn(),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 _i.default=t,_i}(),u=function(){if(ki)return Ci;ki=1,Object.defineProperty(Ci,"__esModule",{value:!0});const e={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Cn().validateUnion,error:{message:"must match a schema in anyOf"}};return Ci.default=e,Ci}(),p=function(){if(Ni)return Ii;Ni=1,Object.defineProperty(Ii,"__esModule",{value:!0});const e=rn(),t=sn(),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 Ii.default=r,Ii}(),h=function(){if(Oi)return Ai;Oi=1,Object.defineProperty(Ai,"__esModule",{value:!0});const e=sn(),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 Ai.default=t,Ai}(),f=function(){if(Ti)return xi;Ti=1,Object.defineProperty(xi,"__esModule",{value:!0});const e=rn(),t=sn(),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 xi.default=r,xi}(),m=function(){if(Di)return Ri;Di=1,Object.defineProperty(Ri,"__esModule",{value:!0});const e=sn(),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 Ri.default=t,Ri}();return ei.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},ei}var Mi,Gi={},Ui={};function Bi(){if(Mi)return Ui;Mi=1,Object.defineProperty(Ui,"__esModule",{value:!0}),Ui.dynamicAnchor=void 0;const e=rn(),t=un(),r=Xn(),n=bo(),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 Ui.dynamicAnchor=i,Ui.default=o,Ui}var zi,Hi={};function Vi(){if(zi)return Hi;zi=1,Object.defineProperty(Hi,"__esModule",{value:!0}),Hi.dynamicRef=void 0;const e=rn(),t=un(),r=bo(),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 Hi.dynamicRef=o,Hi.default=n,Hi}var Wi,qi={};var Ki,Yi,Ji={};function Xi(){if(Yi)return Gi;Yi=1,Object.defineProperty(Gi,"__esModule",{value:!0});const e=Bi(),t=Vi(),r=function(){if(Wi)return qi;Wi=1,Object.defineProperty(qi,"__esModule",{value:!0});const e=Bi(),t=sn(),r={keyword:"$recursiveAnchor",schemaType:"boolean",code(r){r.schema?(0,e.dynamicAnchor)(r,""):(0,t.checkStrictMode)(r.it,"$recursiveAnchor: false is ignored")}};return qi.default=r,qi}(),n=function(){if(Ki)return Ji;Ki=1,Object.defineProperty(Ji,"__esModule",{value:!0});const e=Vi(),t={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,e.dynamicRef)(t,t.schema)};return Ji.default=t,Ji}(),o=[e.default,t.default,r.default,n.default];return Gi.default=o,Gi}var Zi,Qi={},es={};var ts,rs={};var ns,os,is={};function ss(){if(os)return Qi;os=1,Object.defineProperty(Qi,"__esModule",{value:!0});const e=function(){if(Zi)return es;Zi=1,Object.defineProperty(es,"__esModule",{value:!0});const e=mi(),t={keyword:"dependentRequired",type:"object",schemaType:"object",error:e.error,code:t=>(0,e.validatePropertyDeps)(t)};return es.default=t,es}(),t=function(){if(ts)return rs;ts=1,Object.defineProperty(rs,"__esModule",{value:!0});const e=mi(),t={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,e.validateSchemaDeps)(t)};return rs.default=t,rs}(),r=function(){if(ns)return is;ns=1,Object.defineProperty(is,"__esModule",{value:!0});const e=sn(),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 is.default=t,is}(),n=[e.default,t.default,r.default];return Qi.default=n,Qi}var as,cs={},ls={};function ds(){if(as)return ls;as=1,Object.defineProperty(ls,"__esModule",{value:!0});const e=rn(),t=sn(),r=un(),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 ls.default=n,ls}var us,ps,hs={};function fs(){if(us)return hs;us=1,Object.defineProperty(hs,"__esModule",{value:!0});const e=rn(),t=sn(),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 hs.default=r,hs}var ms,gs,ys={},vs={};function bs(){if(ms)return vs;ms=1,Object.defineProperty(vs,"__esModule",{value:!0});const e=rn(),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 vs.default=t,vs}var $s,ws,Es={};function Ss(){if(ws)return ho;ws=1,Object.defineProperty(ho,"__esModule",{value:!0});const e=$o(),t=Zo(),r=Fi(),n=Xi(),o=ss(),i=function(){if(ps)return cs;ps=1,Object.defineProperty(cs,"__esModule",{value:!0});const e=ds(),t=fs(),r=[e.default,t.default];return cs.default=r,cs}(),s=function(){if(gs)return ys;gs=1,Object.defineProperty(ys,"__esModule",{value:!0});const e=[bs().default];return ys.default=e,ys}(),a=($s||($s=1,Object.defineProperty(Es,"__esModule",{value:!0}),Es.contentVocabulary=Es.metadataVocabulary=void 0,Es.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],Es.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),Es),c=[n.default,e.default,t.default,(0,r.default)(!0),s.default,a.metadataVocabulary,a.contentVocabulary,o.default,i.default];return ho.default=c,ho}var Ps,Ls,_s={},ks={};function Cs(){if(Ls)return _s;Ls=1,Object.defineProperty(_s,"__esModule",{value:!0});const e=rn(),t=(Ps||(Ps=1,Object.defineProperty(ks,"__esModule",{value:!0}),ks.DiscrError=void 0,function(e){e.Tag="tag",e.Mapping="mapping"}(r||(ks.DiscrError=r={}))),ks);var r;const n=Xn(),o=Kn(),i=sn(),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 _s.default=s,_s}var Ns,Is,Os={},As={$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}}},Ts={$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"}}}},xs={$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"}}},Ds={$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"}}},js={$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"}}},Rs={$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"}}},Fs={$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}}},Ms={$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 Gs=(Is||(Is=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=uo(),n=Ss(),o=Cs(),i=function(){if(Ns)return Os;Ns=1,Object.defineProperty(Os,"__esModule",{value:!0});const e=As,t=Ts,r=xs,n=Ds,o=js,i=Rs,s=Fs,a=Ms,c=["/properties"];return Os.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}},Os}(),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=Bn();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var l=rn();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=Vn();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var u=Kn();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return u.default}})}(Hr,Hr.exports)),Hr.exports),Us=Nt(Gs);const Bs=re.object({templateEntry:re.string({message:"templateEntry must be a string"}).describe("Main entry point for the portal"),schemaEntry:re.string({message:"schemaEntry must be a string"}).describe("Schema file for portal validation"),assetPath:re.string({message:"assetPath must be a string"}).optional().describe("Asset path for dev/preview builds"),githubRepo:re.string({message:"githubRepo must be a string"}).optional().describe("GitHub repo URL or local git remote"),version:re.string({message:"version must be a string"}).describe("Version from package.json"),timestamp:re.string({message:"timestamp must be a string"}).describe("Current build timestamp (ISO8601)"),commitSha:re.string({message:"commitSha must be a string"}).describe("Current git commit SHA"),annotations:re.record(re.string(),re.string()).optional().describe("Optional build annotations"),projectPage:re.string({message:"projectPage must be a string"}).optional().describe("Optional project homepage"),allowedExtensions:re.array(re.string({message:"Each allowed extension must be a string"}),{message:"allowedExtensions must be an array of strings"}).describe("List of allowed asset extensions (with leading dot)"),schema:re.record(re.string(),re.unknown()).optional().describe("Optional schema for the portal"),config:re.record(re.string(),re.unknown()).optional().describe("Optional configuration for the portal")});re.object({name:re.string({message:"name must be a string"}).describe("Short app key (unscoped, derived from package name)"),displayName:re.string({message:"displayName must be a string"}).optional().describe("Full package name, may include scope"),description:re.string({message:"description must be a string"}).optional().describe("Description of the portal"),build:Bs});const zs=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(je({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 se(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)||H(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 Us({strict:!0}).compile(n.schema),o=await ae(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))}}),Hs=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 _({log:r,manifest:e})}),Vs=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)})}),Ws=Be(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(je({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 qs=Be(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(je({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 L({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:",Ae.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)})})),Ks=Be(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 preview"].join("\n")).option("-d, --debug","Enable debug mode for verbose logging",!1).addOption(je({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:",Ae.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")})),Ys=Be(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(je({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",Ae.blue("--publish")),r?.info("Example: fusion-framework-cli portal config --publish my-portal@1.2.3"),process.exit(1)),"dev"===t.env&&(r?.fail("🤪",Ae.blue("--env"),'cannot be "dev" when',Ae.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))})),Js=e("portal").description("Develop and deploy portal templates").addCommand(Ct).addCommand(Br).addCommand(zs).addCommand(Hs).addCommand(Vs).addCommand(Ws).addCommand(qs).addCommand(Ks).addCommand(Ys);const[Xs]=process.versions.node.split(".").map(Number);Xs<Number(20)&&(console.error(Ae.red("[ERROR]"),"Fusion Framework CLI requires Node.js 20 or higher."),process.exit(1));Xs!==Number(22)&&console.warn(Ae.yellow("[WARNING]"),"Node.js 22.x (LTS) is recommended for best compatibility. You are using Node.js",process.versions.node);const Zs=l({cwd:i(import.meta.url)});if(!Zs)throw Error("failed to find program root");process.env.CLI_BIN=s(a(Zs.path),String(Zs.packageJson.bin?.["fusion-framework-cli"]));const Qs=new n;Qs.name(Zs.packageJson.name),Qs.description([`${Zs.packageJson.name}@${Zs.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:"," https://equinor.github.io/fusion-framework/cli/"].join("\n")),Qs.version(Zs.packageJson.version,"-V, --version","CLI version"),(e=>{e.addCommand(bt),e.addCommand(Pt),e.addCommand(Lt),e.addCommand(kt),e.addCommand(Js)})(Qs),Qs.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}(hi)),hi}var mi,gi={};var yi,vi={};function bi(){if(yi)return vi;yi=1,Object.defineProperty(vi,"__esModule",{value:!0});const e=kn(),t=tn(),r=dn(),n=on(),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 vi.default=o,vi}var $i,wi={};var Ei,Si={};var Pi,Li={};var _i,ki={};var Ci,Ni={};var Ii,Oi={};var Ai,xi={};var Ti,Di,ji={};function Ri(){if(Di)return Qo;Di=1,Object.defineProperty(Qo,"__esModule",{value:!0});const e=ti(),t=function(){if(ni)return oi;ni=1,Object.defineProperty(oi,"__esModule",{value:!0});const e=si(),t={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,e.validateTuple)(t,"items")};return oi.default=t,oi}(),r=si(),n=function(){if(ai)return ci;ai=1,Object.defineProperty(ci,"__esModule",{value:!0});const e=tn(),t=on(),r=kn(),n=ti(),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 ci.default=o,ci}(),o=ui(),i=fi(),s=function(){if(mi)return gi;mi=1,Object.defineProperty(gi,"__esModule",{value:!0});const e=tn(),t=on(),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 gi.default=r,gi}(),a=bi(),c=function(){if($i)return wi;$i=1,Object.defineProperty(wi,"__esModule",{value:!0});const e=Un(),t=kn(),r=on(),n=bi(),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 wi.default=o,wi}(),l=function(){if(Ei)return Si;Ei=1,Object.defineProperty(Si,"__esModule",{value:!0});const e=kn(),t=tn(),r=on(),n=on(),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 Si.default=o,Si}(),d=function(){if(Pi)return Li;Pi=1,Object.defineProperty(Li,"__esModule",{value:!0});const e=on(),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 Li.default=t,Li}(),u=function(){if(_i)return ki;_i=1,Object.defineProperty(ki,"__esModule",{value:!0});const e={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:kn().validateUnion,error:{message:"must match a schema in anyOf"}};return ki.default=e,ki}(),p=function(){if(Ci)return Ni;Ci=1,Object.defineProperty(Ni,"__esModule",{value:!0});const e=tn(),t=on(),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 Ni.default=r,Ni}(),h=function(){if(Ii)return Oi;Ii=1,Object.defineProperty(Oi,"__esModule",{value:!0});const e=on(),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 Oi.default=t,Oi}(),f=function(){if(Ai)return xi;Ai=1,Object.defineProperty(xi,"__esModule",{value:!0});const e=tn(),t=on(),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 xi.default=r,xi}(),m=function(){if(Ti)return ji;Ti=1,Object.defineProperty(ji,"__esModule",{value:!0});const e=on(),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 ji.default=t,ji}();return Qo.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},Qo}var Fi,Mi={},Gi={};function Ui(){if(Fi)return Gi;Fi=1,Object.defineProperty(Gi,"__esModule",{value:!0}),Gi.dynamicAnchor=void 0;const e=tn(),t=dn(),r=Jn(),n=vo(),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 Gi.dynamicAnchor=i,Gi.default=o,Gi}var Bi,zi={};function Hi(){if(Bi)return zi;Bi=1,Object.defineProperty(zi,"__esModule",{value:!0}),zi.dynamicRef=void 0;const e=tn(),t=dn(),r=vo(),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 zi.dynamicRef=o,zi.default=n,zi}var Vi,Wi={};var qi,Ki,Yi={};function Ji(){if(Ki)return Mi;Ki=1,Object.defineProperty(Mi,"__esModule",{value:!0});const e=Ui(),t=Hi(),r=function(){if(Vi)return Wi;Vi=1,Object.defineProperty(Wi,"__esModule",{value:!0});const e=Ui(),t=on(),r={keyword:"$recursiveAnchor",schemaType:"boolean",code(r){r.schema?(0,e.dynamicAnchor)(r,""):(0,t.checkStrictMode)(r.it,"$recursiveAnchor: false is ignored")}};return Wi.default=r,Wi}(),n=function(){if(qi)return Yi;qi=1,Object.defineProperty(Yi,"__esModule",{value:!0});const e=Hi(),t={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,e.dynamicRef)(t,t.schema)};return Yi.default=t,Yi}(),o=[e.default,t.default,r.default,n.default];return Mi.default=o,Mi}var Xi,Zi={},Qi={};var es,ts={};var rs,ns,os={};function is(){if(ns)return Zi;ns=1,Object.defineProperty(Zi,"__esModule",{value:!0});const e=function(){if(Xi)return Qi;Xi=1,Object.defineProperty(Qi,"__esModule",{value:!0});const e=fi(),t={keyword:"dependentRequired",type:"object",schemaType:"object",error:e.error,code:t=>(0,e.validatePropertyDeps)(t)};return Qi.default=t,Qi}(),t=function(){if(es)return ts;es=1,Object.defineProperty(ts,"__esModule",{value:!0});const e=fi(),t={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,e.validateSchemaDeps)(t)};return ts.default=t,ts}(),r=function(){if(rs)return os;rs=1,Object.defineProperty(os,"__esModule",{value:!0});const e=on(),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 os.default=t,os}(),n=[e.default,t.default,r.default];return Zi.default=n,Zi}var ss,as={},cs={};function ls(){if(ss)return cs;ss=1,Object.defineProperty(cs,"__esModule",{value:!0});const e=tn(),t=on(),r=dn(),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 cs.default=n,cs}var ds,us,ps={};function hs(){if(ds)return ps;ds=1,Object.defineProperty(ps,"__esModule",{value:!0});const e=tn(),t=on(),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 ps.default=r,ps}var fs,ms,gs={},ys={};function vs(){if(fs)return ys;fs=1,Object.defineProperty(ys,"__esModule",{value:!0});const e=tn(),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 ys.default=t,ys}var bs,$s,ws={};function Es(){if($s)return po;$s=1,Object.defineProperty(po,"__esModule",{value:!0});const e=bo(),t=Xo(),r=Ri(),n=Ji(),o=is(),i=function(){if(us)return as;us=1,Object.defineProperty(as,"__esModule",{value:!0});const e=ls(),t=hs(),r=[e.default,t.default];return as.default=r,as}(),s=function(){if(ms)return gs;ms=1,Object.defineProperty(gs,"__esModule",{value:!0});const e=[vs().default];return gs.default=e,gs}(),a=(bs||(bs=1,Object.defineProperty(ws,"__esModule",{value:!0}),ws.contentVocabulary=ws.metadataVocabulary=void 0,ws.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"],ws.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]),ws),c=[n.default,e.default,t.default,(0,r.default)(!0),s.default,a.metadataVocabulary,a.contentVocabulary,o.default,i.default];return po.default=c,po}var Ss,Ps,Ls={},_s={};function ks(){if(Ps)return Ls;Ps=1,Object.defineProperty(Ls,"__esModule",{value:!0});const e=tn(),t=(Ss||(Ss=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=Jn(),o=qn(),i=on(),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 Ls.default=s,Ls}var Cs,Ns,Is={},Os={$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}}},As={$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"}}}},xs={$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"}}},Ts={$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"}}},Ds={$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"}}},js={$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"}}},Rs={$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}}},Fs={$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 Ms=(Ns||(Ns=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=lo(),n=Es(),o=ks(),i=function(){if(Cs)return Is;Cs=1,Object.defineProperty(Is,"__esModule",{value:!0});const e=Os,t=As,r=xs,n=Ts,o=Ds,i=js,s=Rs,a=Fs,c=["/properties"];return Is.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}},Is}(),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=Un();Object.defineProperty(t,"KeywordCxt",{enumerable:!0,get:function(){return c.KeywordCxt}});var l=tn();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=Hn();Object.defineProperty(t,"ValidationError",{enumerable:!0,get:function(){return d.default}});var u=qn();Object.defineProperty(t,"MissingRefError",{enumerable:!0,get:function(){return u.default}})}(zr,zr.exports)),zr.exports),Gs=Ct(Ms);const Us=te.object({templateEntry:te.string({message:"templateEntry must be a string"}).describe("Main entry point for the portal"),schemaEntry:te.string({message:"schemaEntry must be a string"}).describe("Schema file for portal validation"),assetPath:te.string({message:"assetPath must be a string"}).optional().describe("Asset path for dev/preview builds"),githubRepo:te.string({message:"githubRepo must be a string"}).optional().describe("GitHub repo URL or local git remote"),version:te.string({message:"version must be a string"}).describe("Version from package.json"),timestamp:te.string({message:"timestamp must be a string"}).describe("Current build timestamp (ISO8601)"),commitSha:te.string({message:"commitSha must be a string"}).describe("Current git commit SHA"),annotations:te.record(te.string(),te.string()).optional().describe("Optional build annotations"),projectPage:te.string({message:"projectPage must be a string"}).optional().describe("Optional project homepage"),allowedExtensions:te.array(te.string({message:"Each allowed extension must be a string"}),{message:"allowedExtensions must be an array of strings"}).describe("List of allowed asset extensions (with leading dot)"),schema:te.record(te.string(),te.unknown()).optional().describe("Optional schema for the portal"),config:te.record(te.string(),te.unknown()).optional().describe("Optional configuration for the portal")});te.object({name:te.string({message:"name must be a string"}).describe("Short app key (unscoped, derived from package name)"),displayName:te.string({message:"displayName must be a string"}).optional().describe("Full package name, may include scope"),description:te.string({message:"description must be a string"}).optional().describe("Description of the portal"),build:Us});const Bs=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(De({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 ie(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));M(n)||z(n,{recursive:!0}),R(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 Gs({strict:!0}).compile(n.schema),o=await se(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))}}),zs=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 _({log:r,manifest:e})}),Hs=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)})}),Vs=Ue(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(De({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 Ws=Ue(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"," $ ffc portal tag next --package my-portal@2.0.0-alpha"," $ ffc portal tag stable --package my-portal@1.5.0"].join("\n")).addOption(De({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 (e.g., latest, preview, next, or any string value)").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 L({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:",Oe.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)})})),qs=Ue(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 preview"," $ ffc portal publish --tag next"].join("\n")).option("-d, --debug","Enable debug mode for verbose logging",!1).addOption(De({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 (e.g., latest, preview, next, or any string value)","latest").action(async e=>{const t=new d("portal:publish",{debug:e.debug});t?.info("Using environment:",Oe.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")})),Ks=Ue(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(De({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",Oe.blue("--publish")),r?.info("Example: fusion-framework-cli portal config --publish my-portal@1.2.3"),process.exit(1)),"dev"===t.env&&(r?.fail("🤪",Oe.blue("--env"),'cannot be "dev" when',Oe.blue("--publish")," is used"),process.exit(1)),I({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 O({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))})),Ys=e("portal").description("Develop and deploy portal templates").addCommand(kt).addCommand(Ur).addCommand(Bs).addCommand(zs).addCommand(Hs).addCommand(Vs).addCommand(Ws).addCommand(qs).addCommand(Ks);const[Js]=process.versions.node.split(".").map(Number);Js<Number(20)&&(console.error(Oe.red("[ERROR]"),"Fusion Framework CLI requires Node.js 20 or higher."),process.exit(1));Js!==Number(22)&&console.warn(Oe.yellow("[WARNING]"),"Node.js 22.x (LTS) is recommended for best compatibility. You are using Node.js",process.versions.node);const Xs=l({cwd:i(import.meta.url)});if(!Xs)throw Error("failed to find program root");process.env.CLI_BIN=s(a(Xs.path),String(Xs.packageJson.bin?.["fusion-framework-cli"]));const Zs=new n;Zs.name(Xs.packageJson.name),Zs.description([`${Xs.packageJson.name}@${Xs.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:"," https://equinor.github.io/fusion-framework/cli/"].join("\n")),Zs.version(Xs.packageJson.version,"-V, --version","CLI version"),(e=>{e.addCommand(vt),e.addCommand(St),e.addCommand(Pt),e.addCommand(_t),e.addCommand(Ys)})(Zs),Zs.parse();
|