create-zuplo-api 6.60.21 → 6.60.22
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/dist/index.js +1 -1
- package/package.json +4 -4
- package/dist/templates/default/README-template.md +0 -29
- package/dist/templates/default/config/policies.json +0 -13
- package/dist/templates/default/config/routes.oas.json +0 -284
- package/dist/templates/default/docs/README-template.md +0 -45
- package/dist/templates/default/docs/gitignore +0 -32
- package/dist/templates/default/docs/pages/introduction.mdx +0 -153
- package/dist/templates/default/docs/pages/markdown.mdx +0 -108
- package/dist/templates/default/docs/public/banner-dark.svg +0 -100
- package/dist/templates/default/docs/public/banner.svg +0 -100
- package/dist/templates/default/docs/tsconfig.json +0 -16
- package/dist/templates/default/docs/zudoku.config.tsx +0 -93
- package/dist/templates/default/env.example +0 -2
- package/dist/templates/default/eslintrc.json +0 -7
- package/dist/templates/default/gitignore +0 -10
- package/dist/templates/default/modules/hello-world.ts +0 -21
- package/dist/templates/default/prettierrc.json +0 -1
- package/dist/templates/default/tsconfig.json +0 -19
- package/dist/templates/default/vscode/launch.json +0 -37
- package/dist/templates/default/vscode/settings.json +0 -20
- package/dist/templates/default/zuplo.jsonc +0 -4
- package/dist/templates/default-empty/config/policies.json +0 -3
- package/dist/templates/default-empty/config/routes.oas.json +0 -8
- package/dist/templates/default-empty/docs/README-template.md +0 -45
- package/dist/templates/default-empty/docs/gitignore +0 -32
- package/dist/templates/default-empty/docs/pages/introduction.mdx +0 -153
- package/dist/templates/default-empty/docs/pages/markdown.mdx +0 -108
- package/dist/templates/default-empty/docs/public/banner-dark.svg +0 -100
- package/dist/templates/default-empty/docs/public/banner.svg +0 -100
- package/dist/templates/default-empty/docs/tsconfig.json +0 -16
- package/dist/templates/default-empty/docs/zudoku.config.tsx +0 -93
- package/dist/templates/default-empty/env.example +0 -2
- package/dist/templates/default-empty/eslintrc.json +0 -7
- package/dist/templates/default-empty/gitignore +0 -10
- package/dist/templates/default-empty/prettierrc.json +0 -1
- package/dist/templates/default-empty/tsconfig.json +0 -19
- package/dist/templates/default-empty/zuplo.jsonc +0 -4
package/dist/index.js
CHANGED
|
@@ -69,4 +69,4 @@ var o=i(181);var a=o.Buffer;function copyProps(t,r){for(var i in t){r[i]=t[i]}}i
|
|
|
69
69
|
|| ${u} === "boolean" || ${a} === null`).assign(h,(0,l._)`[${a}]`)}}}function assignParentData({gen:t,parentData:r,parentDataProperty:i},o){t.if((0,l._)`${r} !== undefined`,(()=>t.assign((0,l._)`${r}[${i}]`,o)))}function checkDataType(t,r,i,o=h.Correct){const a=o===h.Correct?l.operators.EQ:l.operators.NEQ;let c;switch(t){case"null":return(0,l._)`${r} ${a} null`;case"array":c=(0,l._)`Array.isArray(${r})`;break;case"object":c=(0,l._)`${r} && typeof ${r} == "object" && !Array.isArray(${r})`;break;case"integer":c=numCond((0,l._)`!(${r} % 1) && !isNaN(${r})`);break;case"number":c=numCond();break;default:return(0,l._)`typeof ${r} ${a} ${t}`}return o===h.Correct?c:(0,l.not)(c);function numCond(t=l.nil){return(0,l.and)((0,l._)`typeof ${r} == "number"`,t,i?(0,l._)`isFinite(${r})`:l.nil)}}r.checkDataType=checkDataType;function checkDataTypes(t,r,i,o){if(t.length===1){return checkDataType(t[0],r,i,o)}let a;const c=(0,u.toHash)(t);if(c.array&&c.object){const t=(0,l._)`typeof ${r} != "object"`;a=c.null?t:(0,l._)`!${r} || ${t}`;delete c.null;delete c.array;delete c.object}else{a=l.nil}if(c.number)delete c.integer;for(const t in c)a=(0,l.and)(a,checkDataType(t,r,i,o));return a}r.checkDataTypes=checkDataTypes;const p={message:({schema:t})=>`must be ${t}`,params:({schema:t,schemaValue:r})=>typeof t=="string"?(0,l._)`{type: ${t}}`:(0,l._)`{type: ${r}}`};function reportTypeError(t){const r=getTypeErrorContext(t);(0,c.reportError)(r,p)}r.reportTypeError=reportTypeError;function getTypeErrorContext(t){const{gen:r,data:i,schema:o}=t;const a=(0,u.schemaRefOrVal)(t,o,"type");return{gen:r,keyword:"type",data:i,schema:o.type,schemaCode:a,schemaValue:a,parentSchema:o,params:{},it:t}}},4940:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.assignDefaults=void 0;const o=i(6515);const a=i(7373);function assignDefaults(t,r){const{properties:i,items:o}=t.schema;if(r==="object"&&i){for(const r in i){assignDefault(t,r,i[r].default)}}else if(r==="array"&&Array.isArray(o)){o.forEach(((r,i)=>assignDefault(t,i,r.default)))}}r.assignDefaults=assignDefaults;function assignDefault(t,r,i){const{gen:c,compositeRule:l,data:u,opts:h}=t;if(i===undefined)return;const d=(0,o._)`${u}${(0,o.getProperty)(r)}`;if(l){(0,a.checkStrictMode)(t,`default is ignored for: ${d}`);return}let p=(0,o._)`${d} === undefined`;if(h.useDefaults==="empty"){p=(0,o._)`${p} || ${d} === null || ${d} === ""`}c.if(p,(0,o._)`${d} = ${(0,o.stringify)(i)}`)}},9688:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.getData=r.KeywordCxt=r.validateFunctionCode=void 0;const o=i(3113);const a=i(8486);const c=i(7825);const l=i(8486);const u=i(4940);const h=i(3659);const d=i(6553);const p=i(6515);const m=i(3877);const g=i(2657);const y=i(7373);const v=i(8674);function validateFunctionCode(t){if(isSchemaObj(t)){checkKeywords(t);if(schemaCxtHasRules(t)){topSchemaObjCode(t);return}}validateFunction(t,(()=>(0,o.topBoolOrEmptySchema)(t)))}r.validateFunctionCode=validateFunctionCode;function validateFunction({gen:t,validateName:r,schema:i,schemaEnv:o,opts:a},c){if(a.code.es5){t.func(r,(0,p._)`${m.default.data}, ${m.default.valCxt}`,o.$async,(()=>{t.code((0,p._)`"use strict"; ${funcSourceUrl(i,a)}`);destructureValCxtES5(t,a);t.code(c)}))}else{t.func(r,(0,p._)`${m.default.data}, ${destructureValCxt(a)}`,o.$async,(()=>t.code(funcSourceUrl(i,a)).code(c)))}}function destructureValCxt(t){return(0,p._)`{${m.default.instancePath}="", ${m.default.parentData}, ${m.default.parentDataProperty}, ${m.default.rootData}=${m.default.data}${t.dynamicRef?(0,p._)`, ${m.default.dynamicAnchors}={}`:p.nil}}={}`}function destructureValCxtES5(t,r){t.if(m.default.valCxt,(()=>{t.var(m.default.instancePath,(0,p._)`${m.default.valCxt}.${m.default.instancePath}`);t.var(m.default.parentData,(0,p._)`${m.default.valCxt}.${m.default.parentData}`);t.var(m.default.parentDataProperty,(0,p._)`${m.default.valCxt}.${m.default.parentDataProperty}`);t.var(m.default.rootData,(0,p._)`${m.default.valCxt}.${m.default.rootData}`);if(r.dynamicRef)t.var(m.default.dynamicAnchors,(0,p._)`${m.default.valCxt}.${m.default.dynamicAnchors}`)}),(()=>{t.var(m.default.instancePath,(0,p._)`""`);t.var(m.default.parentData,(0,p._)`undefined`);t.var(m.default.parentDataProperty,(0,p._)`undefined`);t.var(m.default.rootData,m.default.data);if(r.dynamicRef)t.var(m.default.dynamicAnchors,(0,p._)`{}`)}))}function topSchemaObjCode(t){const{schema:r,opts:i,gen:o}=t;validateFunction(t,(()=>{if(i.$comment&&r.$comment)commentKeyword(t);checkNoDefault(t);o.let(m.default.vErrors,null);o.let(m.default.errors,0);if(i.unevaluated)resetEvaluated(t);typeAndKeywords(t);returnResults(t)}));return}function resetEvaluated(t){const{gen:r,validateName:i}=t;t.evaluated=r.const("evaluated",(0,p._)`${i}.evaluated`);r.if((0,p._)`${t.evaluated}.dynamicProps`,(()=>r.assign((0,p._)`${t.evaluated}.props`,(0,p._)`undefined`)));r.if((0,p._)`${t.evaluated}.dynamicItems`,(()=>r.assign((0,p._)`${t.evaluated}.items`,(0,p._)`undefined`)))}function funcSourceUrl(t,r){const i=typeof t=="object"&&t[r.schemaId];return i&&(r.code.source||r.code.process)?(0,p._)`/*# sourceURL=${i} */`:p.nil}function subschemaCode(t,r){if(isSchemaObj(t)){checkKeywords(t);if(schemaCxtHasRules(t)){subSchemaObjCode(t,r);return}}(0,o.boolOrEmptySchema)(t,r)}function schemaCxtHasRules({schema:t,self:r}){if(typeof t=="boolean")return!t;for(const i in t)if(r.RULES.all[i])return true;return false}function isSchemaObj(t){return typeof t.schema!="boolean"}function subSchemaObjCode(t,r){const{schema:i,gen:o,opts:a}=t;if(a.$comment&&i.$comment)commentKeyword(t);updateContext(t);checkAsyncSchema(t);const c=o.const("_errs",m.default.errors);typeAndKeywords(t,c);o.var(r,(0,p._)`${c} === ${m.default.errors}`)}function checkKeywords(t){(0,y.checkUnknownRules)(t);checkRefsAndKeywords(t)}function typeAndKeywords(t,r){if(t.opts.jtd)return schemaKeywords(t,[],false,r);const i=(0,a.getSchemaTypes)(t.schema);const o=(0,a.coerceAndCheckDataType)(t,i);schemaKeywords(t,i,!o,r)}function checkRefsAndKeywords(t){const{schema:r,errSchemaPath:i,opts:o,self:a}=t;if(r.$ref&&o.ignoreKeywordsWithRef&&(0,y.schemaHasRulesButRef)(r,a.RULES)){a.logger.warn(`$ref: keywords ignored in schema at path "${i}"`)}}function checkNoDefault(t){const{schema:r,opts:i}=t;if(r.default!==undefined&&i.useDefaults&&i.strictSchema){(0,y.checkStrictMode)(t,"default is ignored in the schema root")}}function updateContext(t){const r=t.schema[t.opts.schemaId];if(r)t.baseId=(0,g.resolveUrl)(t.opts.uriResolver,t.baseId,r)}function checkAsyncSchema(t){if(t.schema.$async&&!t.schemaEnv.$async)throw new Error("async schema in sync schema")}function commentKeyword({gen:t,schemaEnv:r,schema:i,errSchemaPath:o,opts:a}){const c=i.$comment;if(a.$comment===true){t.code((0,p._)`${m.default.self}.logger.log(${c})`)}else if(typeof a.$comment=="function"){const i=(0,p.str)`${o}/$comment`;const a=t.scopeValue("root",{ref:r.root});t.code((0,p._)`${m.default.self}.opts.$comment(${c}, ${i}, ${a}.schema)`)}}function returnResults(t){const{gen:r,schemaEnv:i,validateName:o,ValidationError:a,opts:c}=t;if(i.$async){r.if((0,p._)`${m.default.errors} === 0`,(()=>r.return(m.default.data)),(()=>r.throw((0,p._)`new ${a}(${m.default.vErrors})`)))}else{r.assign((0,p._)`${o}.errors`,m.default.vErrors);if(c.unevaluated)assignEvaluated(t);r.return((0,p._)`${m.default.errors} === 0`)}}function assignEvaluated({gen:t,evaluated:r,props:i,items:o}){if(i instanceof p.Name)t.assign((0,p._)`${r}.props`,i);if(o instanceof p.Name)t.assign((0,p._)`${r}.items`,o)}function schemaKeywords(t,r,i,o){const{gen:a,schema:u,data:h,allErrors:d,opts:g,self:v}=t;const{RULES:b}=v;if(u.$ref&&(g.ignoreKeywordsWithRef||!(0,y.schemaHasRulesButRef)(u,b))){a.block((()=>keywordCode(t,"$ref",b.all.$ref.definition)));return}if(!g.jtd)checkStrictTypes(t,r);a.block((()=>{for(const t of b.rules)groupKeywords(t);groupKeywords(b.post)}));function groupKeywords(y){if(!(0,c.shouldUseGroup)(u,y))return;if(y.type){a.if((0,l.checkDataType)(y.type,h,g.strictNumbers));iterateKeywords(t,y);if(r.length===1&&r[0]===y.type&&i){a.else();(0,l.reportTypeError)(t)}a.endIf()}else{iterateKeywords(t,y)}if(!d)a.if((0,p._)`${m.default.errors} === ${o||0}`)}}function iterateKeywords(t,r){const{gen:i,schema:o,opts:{useDefaults:a}}=t;if(a)(0,u.assignDefaults)(t,r.type);i.block((()=>{for(const i of r.rules){if((0,c.shouldUseRule)(o,i)){keywordCode(t,i.keyword,i.definition,r.type)}}}))}function checkStrictTypes(t,r){if(t.schemaEnv.meta||!t.opts.strictTypes)return;checkContextTypes(t,r);if(!t.opts.allowUnionTypes)checkMultipleTypes(t,r);checkKeywordTypes(t,t.dataTypes)}function checkContextTypes(t,r){if(!r.length)return;if(!t.dataTypes.length){t.dataTypes=r;return}r.forEach((r=>{if(!includesType(t.dataTypes,r)){strictTypesError(t,`type "${r}" not allowed by context "${t.dataTypes.join(",")}"`)}}));narrowSchemaTypes(t,r)}function checkMultipleTypes(t,r){if(r.length>1&&!(r.length===2&&r.includes("null"))){strictTypesError(t,"use allowUnionTypes to allow union type keyword")}}function checkKeywordTypes(t,r){const i=t.self.RULES.all;for(const o in i){const a=i[o];if(typeof a=="object"&&(0,c.shouldUseRule)(t.schema,a)){const{type:i}=a.definition;if(i.length&&!i.some((t=>hasApplicableType(r,t)))){strictTypesError(t,`missing type "${i.join(",")}" for keyword "${o}"`)}}}}function hasApplicableType(t,r){return t.includes(r)||r==="number"&&t.includes("integer")}function includesType(t,r){return t.includes(r)||r==="integer"&&t.includes("number")}function narrowSchemaTypes(t,r){const i=[];for(const o of t.dataTypes){if(includesType(r,o))i.push(o);else if(r.includes("integer")&&o==="number")i.push("integer")}t.dataTypes=i}function strictTypesError(t,r){const i=t.schemaEnv.baseId+t.errSchemaPath;r+=` at "${i}" (strictTypes)`;(0,y.checkStrictMode)(t,r,t.opts.strictTypes)}class KeywordCxt{constructor(t,r,i){(0,h.validateKeywordUsage)(t,r,i);this.gen=t.gen;this.allErrors=t.allErrors;this.keyword=i;this.data=t.data;this.schema=t.schema[i];this.$data=r.$data&&t.opts.$data&&this.schema&&this.schema.$data;this.schemaValue=(0,y.schemaRefOrVal)(t,this.schema,i,this.$data);this.schemaType=r.schemaType;this.parentSchema=t.schema;this.params={};this.it=t;this.def=r;if(this.$data){this.schemaCode=t.gen.const("vSchema",getData(this.$data,t))}else{this.schemaCode=this.schemaValue;if(!(0,h.validSchemaType)(this.schema,r.schemaType,r.allowUndefined)){throw new Error(`${i} value must be ${JSON.stringify(r.schemaType)}`)}}if("code"in r?r.trackErrors:r.errors!==false){this.errsCount=t.gen.const("_errs",m.default.errors)}}result(t,r,i){this.failResult((0,p.not)(t),r,i)}failResult(t,r,i){this.gen.if(t);if(i)i();else this.error();if(r){this.gen.else();r();if(this.allErrors)this.gen.endIf()}else{if(this.allErrors)this.gen.endIf();else this.gen.else()}}pass(t,r){this.failResult((0,p.not)(t),undefined,r)}fail(t){if(t===undefined){this.error();if(!this.allErrors)this.gen.if(false);return}this.gen.if(t);this.error();if(this.allErrors)this.gen.endIf();else this.gen.else()}fail$data(t){if(!this.$data)return this.fail(t);const{schemaCode:r}=this;this.fail((0,p._)`${r} !== undefined && (${(0,p.or)(this.invalid$data(),t)})`)}error(t,r,i){if(r){this.setParams(r);this._error(t,i);this.setParams({});return}this._error(t,i)}_error(t,r){(t?v.reportExtraError:v.reportError)(this,this.def.error,r)}$dataError(){(0,v.reportError)(this,this.def.$dataError||v.keyword$DataError)}reset(){if(this.errsCount===undefined)throw new Error('add "trackErrors" to keyword definition');(0,v.resetErrorsCount)(this.gen,this.errsCount)}ok(t){if(!this.allErrors)this.gen.if(t)}setParams(t,r){if(r)Object.assign(this.params,t);else this.params=t}block$data(t,r,i=p.nil){this.gen.block((()=>{this.check$data(t,i);r()}))}check$data(t=p.nil,r=p.nil){if(!this.$data)return;const{gen:i,schemaCode:o,schemaType:a,def:c}=this;i.if((0,p.or)((0,p._)`${o} === undefined`,r));if(t!==p.nil)i.assign(t,true);if(a.length||c.validateSchema){i.elseIf(this.invalid$data());this.$dataError();if(t!==p.nil)i.assign(t,false)}i.else()}invalid$data(){const{gen:t,schemaCode:r,schemaType:i,def:o,it:a}=this;return(0,p.or)(wrong$DataType(),invalid$DataSchema());function wrong$DataType(){if(i.length){if(!(r instanceof p.Name))throw new Error("ajv implementation error");const t=Array.isArray(i)?i:[i];return(0,p._)`${(0,l.checkDataTypes)(t,r,a.opts.strictNumbers,l.DataType.Wrong)}`}return p.nil}function invalid$DataSchema(){if(o.validateSchema){const i=t.scopeValue("validate$data",{ref:o.validateSchema});return(0,p._)`!${i}(${r})`}return p.nil}}subschema(t,r){const i=(0,d.getSubschema)(this.it,t);(0,d.extendSubschemaData)(i,this.it,t);(0,d.extendSubschemaMode)(i,t);const o={...this.it,...i,items:undefined,props:undefined};subschemaCode(o,r);return o}mergeEvaluated(t,r){const{it:i,gen:o}=this;if(!i.opts.unevaluated)return;if(i.props!==true&&t.props!==undefined){i.props=y.mergeEvaluated.props(o,t.props,i.props,r)}if(i.items!==true&&t.items!==undefined){i.items=y.mergeEvaluated.items(o,t.items,i.items,r)}}mergeValidEvaluated(t,r){const{it:i,gen:o}=this;if(i.opts.unevaluated&&(i.props!==true||i.items!==true)){o.if(r,(()=>this.mergeEvaluated(t,p.Name)));return true}}}r.KeywordCxt=KeywordCxt;function keywordCode(t,r,i,o){const a=new KeywordCxt(t,i,r);if("code"in i){i.code(a,o)}else if(a.$data&&i.validate){(0,h.funcKeywordCode)(a,i)}else if("macro"in i){(0,h.macroKeywordCode)(a,i)}else if(i.compile||i.validate){(0,h.funcKeywordCode)(a,i)}}const b=/^\/(?:[^~]|~0|~1)*$/;const w=/^([0-9]+)(#|\/(?:[^~]|~0|~1)*)?$/;function getData(t,{dataLevel:r,dataNames:i,dataPathArr:o}){let a;let c;if(t==="")return m.default.rootData;if(t[0]==="/"){if(!b.test(t))throw new Error(`Invalid JSON-pointer: ${t}`);a=t;c=m.default.rootData}else{const l=w.exec(t);if(!l)throw new Error(`Invalid JSON-pointer: ${t}`);const u=+l[1];a=l[2];if(a==="#"){if(u>=r)throw new Error(errorMsg("property/index",u));return o[r-u]}if(u>r)throw new Error(errorMsg("data",u));c=i[r-u];if(!a)return c}let l=c;const u=a.split("/");for(const t of u){if(t){c=(0,p._)`${c}${(0,p.getProperty)((0,y.unescapeJsonPointer)(t))}`;l=(0,p._)`${l} && ${c}`}}return l;function errorMsg(t,i){return`Cannot access ${t} ${i} levels up, current level is ${r}`}}r.getData=getData},3659:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.validateKeywordUsage=r.validSchemaType=r.funcKeywordCode=r.macroKeywordCode=void 0;const o=i(6515);const a=i(3877);const c=i(3955);const l=i(8674);function macroKeywordCode(t,r){const{gen:i,keyword:a,schema:c,parentSchema:l,it:u}=t;const h=r.macro.call(u.self,c,l,u);const d=useKeyword(i,a,h);if(u.opts.validateSchema!==false)u.self.validateSchema(h,true);const p=i.name("valid");t.subschema({schema:h,schemaPath:o.nil,errSchemaPath:`${u.errSchemaPath}/${a}`,topSchemaRef:d,compositeRule:true},p);t.pass(p,(()=>t.error(true)))}r.macroKeywordCode=macroKeywordCode;function funcKeywordCode(t,r){var i;const{gen:l,keyword:u,schema:h,parentSchema:d,$data:p,it:m}=t;checkAsyncKeyword(m,r);const g=!p&&r.compile?r.compile.call(m.self,h,d,m):r.validate;const y=useKeyword(l,u,g);const v=l.let("valid");t.block$data(v,validateKeyword);t.ok((i=r.valid)!==null&&i!==void 0?i:v);function validateKeyword(){if(r.errors===false){assignValid();if(r.modifying)modifyData(t);reportErrs((()=>t.error()))}else{const i=r.async?validateAsync():validateSync();if(r.modifying)modifyData(t);reportErrs((()=>addErrs(t,i)))}}function validateAsync(){const t=l.let("ruleErrs",null);l.try((()=>assignValid((0,o._)`await `)),(r=>l.assign(v,false).if((0,o._)`${r} instanceof ${m.ValidationError}`,(()=>l.assign(t,(0,o._)`${r}.errors`)),(()=>l.throw(r)))));return t}function validateSync(){const t=(0,o._)`${y}.errors`;l.assign(t,null);assignValid(o.nil);return t}function assignValid(i=(r.async?(0,o._)`await `:o.nil)){const u=m.opts.passContext?a.default.this:a.default.self;const h=!("compile"in r&&!p||r.schema===false);l.assign(v,(0,o._)`${i}${(0,c.callValidateCode)(t,y,u,h)}`,r.modifying)}function reportErrs(t){var i;l.if((0,o.not)((i=r.valid)!==null&&i!==void 0?i:v),t)}}r.funcKeywordCode=funcKeywordCode;function modifyData(t){const{gen:r,data:i,it:a}=t;r.if(a.parentData,(()=>r.assign(i,(0,o._)`${a.parentData}[${a.parentDataProperty}]`)))}function addErrs(t,r){const{gen:i}=t;i.if((0,o._)`Array.isArray(${r})`,(()=>{i.assign(a.default.vErrors,(0,o._)`${a.default.vErrors} === null ? ${r} : ${a.default.vErrors}.concat(${r})`).assign(a.default.errors,(0,o._)`${a.default.vErrors}.length`);(0,l.extendErrors)(t)}),(()=>t.error()))}function checkAsyncKeyword({schemaEnv:t},r){if(r.async&&!t.$async)throw new Error("async keyword in sync schema")}function useKeyword(t,r,i){if(i===undefined)throw new Error(`keyword "${r}" failed to compile`);return t.scopeValue("keyword",typeof i=="function"?{ref:i}:{ref:i,code:(0,o.stringify)(i)})}function validSchemaType(t,r,i=false){return!r.length||r.some((r=>r==="array"?Array.isArray(t):r==="object"?t&&typeof t=="object"&&!Array.isArray(t):typeof t==r||i&&typeof t=="undefined"))}r.validSchemaType=validSchemaType;function validateKeywordUsage({schema:t,opts:r,self:i,errSchemaPath:o},a,c){if(Array.isArray(a.keyword)?!a.keyword.includes(c):a.keyword!==c){throw new Error("ajv implementation error")}const l=a.dependencies;if(l===null||l===void 0?void 0:l.some((r=>!Object.prototype.hasOwnProperty.call(t,r)))){throw new Error(`parent schema must have dependencies of ${c}: ${l.join(",")}`)}if(a.validateSchema){const l=a.validateSchema(t[c]);if(!l){const t=`keyword "${c}" value is invalid at path "${o}": `+i.errorsText(a.validateSchema.errors);if(r.validateSchema==="log")i.logger.error(t);else throw new Error(t)}}}r.validateKeywordUsage=validateKeywordUsage},6553:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.extendSubschemaMode=r.extendSubschemaData=r.getSubschema=void 0;const o=i(6515);const a=i(7373);function getSubschema(t,{keyword:r,schemaProp:i,schema:c,schemaPath:l,errSchemaPath:u,topSchemaRef:h}){if(r!==undefined&&c!==undefined){throw new Error('both "keyword" and "schema" passed, only one allowed')}if(r!==undefined){const c=t.schema[r];return i===undefined?{schema:c,schemaPath:(0,o._)`${t.schemaPath}${(0,o.getProperty)(r)}`,errSchemaPath:`${t.errSchemaPath}/${r}`}:{schema:c[i],schemaPath:(0,o._)`${t.schemaPath}${(0,o.getProperty)(r)}${(0,o.getProperty)(i)}`,errSchemaPath:`${t.errSchemaPath}/${r}/${(0,a.escapeFragment)(i)}`}}if(c!==undefined){if(l===undefined||u===undefined||h===undefined){throw new Error('"schemaPath", "errSchemaPath" and "topSchemaRef" are required with "schema"')}return{schema:c,schemaPath:l,topSchemaRef:h,errSchemaPath:u}}throw new Error('either "keyword" or "schema" must be passed')}r.getSubschema=getSubschema;function extendSubschemaData(t,r,{dataProp:i,dataPropType:c,data:l,dataTypes:u,propertyName:h}){if(l!==undefined&&i!==undefined){throw new Error('both "data" and "dataProp" passed, only one allowed')}const{gen:d}=r;if(i!==undefined){const{errorPath:l,dataPathArr:u,opts:h}=r;const p=d.let("data",(0,o._)`${r.data}${(0,o.getProperty)(i)}`,true);dataContextProps(p);t.errorPath=(0,o.str)`${l}${(0,a.getErrorPath)(i,c,h.jsPropertySyntax)}`;t.parentDataProperty=(0,o._)`${i}`;t.dataPathArr=[...u,t.parentDataProperty]}if(l!==undefined){const r=l instanceof o.Name?l:d.let("data",l,true);dataContextProps(r);if(h!==undefined)t.propertyName=h}if(u)t.dataTypes=u;function dataContextProps(i){t.data=i;t.dataLevel=r.dataLevel+1;t.dataTypes=[];r.definedProperties=new Set;t.parentData=r.data;t.dataNames=[...r.dataNames,i]}}r.extendSubschemaData=extendSubschemaData;function extendSubschemaMode(t,{jtdDiscriminator:r,jtdMetadata:i,compositeRule:o,createErrors:a,allErrors:c}){if(o!==undefined)t.compositeRule=o;if(a!==undefined)t.createErrors=a;if(c!==undefined)t.allErrors=c;t.jtdDiscriminator=r;t.jtdMetadata=i}r.extendSubschemaMode=extendSubschemaMode},8124:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.CodeGen=r.Name=r.nil=r.stringify=r.str=r._=r.KeywordCxt=void 0;var o=i(9688);Object.defineProperty(r,"KeywordCxt",{enumerable:true,get:function(){return o.KeywordCxt}});var a=i(6515);Object.defineProperty(r,"_",{enumerable:true,get:function(){return a._}});Object.defineProperty(r,"str",{enumerable:true,get:function(){return a.str}});Object.defineProperty(r,"stringify",{enumerable:true,get:function(){return a.stringify}});Object.defineProperty(r,"nil",{enumerable:true,get:function(){return a.nil}});Object.defineProperty(r,"Name",{enumerable:true,get:function(){return a.Name}});Object.defineProperty(r,"CodeGen",{enumerable:true,get:function(){return a.CodeGen}});const c=i(7248);const l=i(5945);const u=i(7282);const h=i(4621);const d=i(6515);const p=i(2657);const m=i(8486);const g=i(7373);const y=i(3837);const v=i(5554);const defaultRegExp=(t,r)=>new RegExp(t,r);defaultRegExp.code="new RegExp";const b=["removeAdditional","useDefaults","coerceTypes"];const w=new Set(["validate","serialize","parse","wrapper","root","schema","keyword","pattern","formats","validate$data","func","obj","Error"]);const E={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."};const S={ignoreKeywordsWithRef:"",jsPropertySyntax:"",unicode:'"minLength"/"maxLength" account for unicode characters by default.'};const $=200;function requiredOptions(t){var r,i,o,a,c,l,u,h,d,p,m,g,y,b,w,E,S,R,P,O,A,x,T,k,C;const I=t.strict;const N=(r=t.code)===null||r===void 0?void 0:r.optimize;const D=N===true||N===undefined?1:N||0;const L=(o=(i=t.code)===null||i===void 0?void 0:i.regExp)!==null&&o!==void 0?o:defaultRegExp;const M=(a=t.uriResolver)!==null&&a!==void 0?a:v.default;return{strictSchema:(l=(c=t.strictSchema)!==null&&c!==void 0?c:I)!==null&&l!==void 0?l:true,strictNumbers:(h=(u=t.strictNumbers)!==null&&u!==void 0?u:I)!==null&&h!==void 0?h:true,strictTypes:(p=(d=t.strictTypes)!==null&&d!==void 0?d:I)!==null&&p!==void 0?p:"log",strictTuples:(g=(m=t.strictTuples)!==null&&m!==void 0?m:I)!==null&&g!==void 0?g:"log",strictRequired:(b=(y=t.strictRequired)!==null&&y!==void 0?y:I)!==null&&b!==void 0?b:false,code:t.code?{...t.code,optimize:D,regExp:L}:{optimize:D,regExp:L},loopRequired:(w=t.loopRequired)!==null&&w!==void 0?w:$,loopEnum:(E=t.loopEnum)!==null&&E!==void 0?E:$,meta:(S=t.meta)!==null&&S!==void 0?S:true,messages:(R=t.messages)!==null&&R!==void 0?R:true,inlineRefs:(P=t.inlineRefs)!==null&&P!==void 0?P:true,schemaId:(O=t.schemaId)!==null&&O!==void 0?O:"$id",addUsedSchema:(A=t.addUsedSchema)!==null&&A!==void 0?A:true,validateSchema:(x=t.validateSchema)!==null&&x!==void 0?x:true,validateFormats:(T=t.validateFormats)!==null&&T!==void 0?T:true,unicodeRegExp:(k=t.unicodeRegExp)!==null&&k!==void 0?k:true,int32range:(C=t.int32range)!==null&&C!==void 0?C:true,uriResolver:M}}class Ajv{constructor(t={}){this.schemas={};this.refs={};this.formats={};this._compilations=new Set;this._loading={};this._cache=new Map;t=this.opts={...t,...requiredOptions(t)};const{es5:r,lines:i}=this.opts.code;this.scope=new d.ValueScope({scope:{},prefixes:w,es5:r,lines:i});this.logger=getLogger(t.logger);const o=t.validateFormats;t.validateFormats=false;this.RULES=(0,u.getRules)();checkOptions.call(this,E,t,"NOT SUPPORTED");checkOptions.call(this,S,t,"DEPRECATED","warn");this._metaOpts=getMetaSchemaOptions.call(this);if(t.formats)addInitialFormats.call(this);this._addVocabularies();this._addDefaultMetaSchema();if(t.keywords)addInitialKeywords.call(this,t.keywords);if(typeof t.meta=="object")this.addMetaSchema(t.meta);addInitialSchemas.call(this);t.validateFormats=o}_addVocabularies(){this.addKeyword("$async")}_addDefaultMetaSchema(){const{$data:t,meta:r,schemaId:i}=this.opts;let o=y;if(i==="id"){o={...y};o.id=o.$id;delete o.$id}if(r&&t)this.addMetaSchema(o,o[i],false)}defaultMeta(){const{meta:t,schemaId:r}=this.opts;return this.opts.defaultMeta=typeof t=="object"?t[r]||t:undefined}validate(t,r){let i;if(typeof t=="string"){i=this.getSchema(t);if(!i)throw new Error(`no schema with key or ref "${t}"`)}else{i=this.compile(t)}const o=i(r);if(!("$async"in i))this.errors=i.errors;return o}compile(t,r){const i=this._addSchema(t,r);return i.validate||this._compileSchemaEnv(i)}compileAsync(t,r){if(typeof this.opts.loadSchema!="function"){throw new Error("options.loadSchema should be a function")}const{loadSchema:i}=this.opts;return runCompileAsync.call(this,t,r);async function runCompileAsync(t,r){await loadMetaSchema.call(this,t.$schema);const i=this._addSchema(t,r);return i.validate||_compileAsync.call(this,i)}async function loadMetaSchema(t){if(t&&!this.getSchema(t)){await runCompileAsync.call(this,{$ref:t},true)}}async function _compileAsync(t){try{return this._compileSchemaEnv(t)}catch(r){if(!(r instanceof l.default))throw r;checkLoaded.call(this,r);await loadMissingSchema.call(this,r.missingSchema);return _compileAsync.call(this,t)}}function checkLoaded({missingSchema:t,missingRef:r}){if(this.refs[t]){throw new Error(`AnySchema ${t} is loaded but ${r} cannot be resolved`)}}async function loadMissingSchema(t){const i=await _loadSchema.call(this,t);if(!this.refs[t])await loadMetaSchema.call(this,i.$schema);if(!this.refs[t])this.addSchema(i,t,r)}async function _loadSchema(t){const r=this._loading[t];if(r)return r;try{return await(this._loading[t]=i(t))}finally{delete this._loading[t]}}}addSchema(t,r,i,o=this.opts.validateSchema){if(Array.isArray(t)){for(const r of t)this.addSchema(r,undefined,i,o);return this}let a;if(typeof t==="object"){const{schemaId:r}=this.opts;a=t[r];if(a!==undefined&&typeof a!="string"){throw new Error(`schema ${r} must be string`)}}r=(0,p.normalizeId)(r||a);this._checkUnique(r);this.schemas[r]=this._addSchema(t,i,r,o,true);return this}addMetaSchema(t,r,i=this.opts.validateSchema){this.addSchema(t,r,true,i);return this}validateSchema(t,r){if(typeof t=="boolean")return true;let i;i=t.$schema;if(i!==undefined&&typeof i!="string"){throw new Error("$schema must be a string")}i=i||this.opts.defaultMeta||this.defaultMeta();if(!i){this.logger.warn("meta-schema not available");this.errors=null;return true}const o=this.validate(i,t);if(!o&&r){const t="schema is invalid: "+this.errorsText();if(this.opts.validateSchema==="log")this.logger.error(t);else throw new Error(t)}return o}getSchema(t){let r;while(typeof(r=getSchEnv.call(this,t))=="string")t=r;if(r===undefined){const{schemaId:i}=this.opts;const o=new h.SchemaEnv({schema:{},schemaId:i});r=h.resolveSchema.call(this,o,t);if(!r)return;this.refs[t]=r}return r.validate||this._compileSchemaEnv(r)}removeSchema(t){if(t instanceof RegExp){this._removeAllSchemas(this.schemas,t);this._removeAllSchemas(this.refs,t);return this}switch(typeof t){case"undefined":this._removeAllSchemas(this.schemas);this._removeAllSchemas(this.refs);this._cache.clear();return this;case"string":{const r=getSchEnv.call(this,t);if(typeof r=="object")this._cache.delete(r.schema);delete this.schemas[t];delete this.refs[t];return this}case"object":{const r=t;this._cache.delete(r);let i=t[this.opts.schemaId];if(i){i=(0,p.normalizeId)(i);delete this.schemas[i];delete this.refs[i]}return this}default:throw new Error("ajv.removeSchema: invalid parameter")}}addVocabulary(t){for(const r of t)this.addKeyword(r);return this}addKeyword(t,r){let i;if(typeof t=="string"){i=t;if(typeof r=="object"){this.logger.warn("these parameters are deprecated, see docs for addKeyword");r.keyword=i}}else if(typeof t=="object"&&r===undefined){r=t;i=r.keyword;if(Array.isArray(i)&&!i.length){throw new Error("addKeywords: keyword must be string or non-empty array")}}else{throw new Error("invalid addKeywords parameters")}checkKeyword.call(this,i,r);if(!r){(0,g.eachItem)(i,(t=>addRule.call(this,t)));return this}keywordMetaschema.call(this,r);const o={...r,type:(0,m.getJSONTypes)(r.type),schemaType:(0,m.getJSONTypes)(r.schemaType)};(0,g.eachItem)(i,o.type.length===0?t=>addRule.call(this,t,o):t=>o.type.forEach((r=>addRule.call(this,t,o,r))));return this}getKeyword(t){const r=this.RULES.all[t];return typeof r=="object"?r.definition:!!r}removeKeyword(t){const{RULES:r}=this;delete r.keywords[t];delete r.all[t];for(const i of r.rules){const r=i.rules.findIndex((r=>r.keyword===t));if(r>=0)i.rules.splice(r,1)}return this}addFormat(t,r){if(typeof r=="string")r=new RegExp(r);this.formats[t]=r;return this}errorsText(t=this.errors,{separator:r=", ",dataVar:i="data"}={}){if(!t||t.length===0)return"No errors";return t.map((t=>`${i}${t.instancePath} ${t.message}`)).reduce(((t,i)=>t+r+i))}$dataMetaSchema(t,r){const i=this.RULES.all;t=JSON.parse(JSON.stringify(t));for(const o of r){const r=o.split("/").slice(1);let a=t;for(const t of r)a=a[t];for(const t in i){const r=i[t];if(typeof r!="object")continue;const{$data:o}=r.definition;const c=a[t];if(o&&c)a[t]=schemaOrData(c)}}return t}_removeAllSchemas(t,r){for(const i in t){const o=t[i];if(!r||r.test(i)){if(typeof o=="string"){delete t[i]}else if(o&&!o.meta){this._cache.delete(o.schema);delete t[i]}}}}_addSchema(t,r,i,o=this.opts.validateSchema,a=this.opts.addUsedSchema){let c;const{schemaId:l}=this.opts;if(typeof t=="object"){c=t[l]}else{if(this.opts.jtd)throw new Error("schema must be object");else if(typeof t!="boolean")throw new Error("schema must be object or boolean")}let u=this._cache.get(t);if(u!==undefined)return u;i=(0,p.normalizeId)(c||i);const d=p.getSchemaRefs.call(this,t,i);u=new h.SchemaEnv({schema:t,schemaId:l,meta:r,baseId:i,localRefs:d});this._cache.set(u.schema,u);if(a&&!i.startsWith("#")){if(i)this._checkUnique(i);this.refs[i]=u}if(o)this.validateSchema(t,true);return u}_checkUnique(t){if(this.schemas[t]||this.refs[t]){throw new Error(`schema with key or id "${t}" already exists`)}}_compileSchemaEnv(t){if(t.meta)this._compileMetaSchema(t);else h.compileSchema.call(this,t);if(!t.validate)throw new Error("ajv implementation error");return t.validate}_compileMetaSchema(t){const r=this.opts;this.opts=this._metaOpts;try{h.compileSchema.call(this,t)}finally{this.opts=r}}}Ajv.ValidationError=c.default;Ajv.MissingRefError=l.default;r["default"]=Ajv;function checkOptions(t,r,i,o="error"){for(const a in t){const c=a;if(c in r)this.logger[o](`${i}: option ${a}. ${t[c]}`)}}function getSchEnv(t){t=(0,p.normalizeId)(t);return this.schemas[t]||this.refs[t]}function addInitialSchemas(){const t=this.opts.schemas;if(!t)return;if(Array.isArray(t))this.addSchema(t);else for(const r in t)this.addSchema(t[r],r)}function addInitialFormats(){for(const t in this.opts.formats){const r=this.opts.formats[t];if(r)this.addFormat(t,r)}}function addInitialKeywords(t){if(Array.isArray(t)){this.addVocabulary(t);return}this.logger.warn("keywords option as map is deprecated, pass array");for(const r in t){const i=t[r];if(!i.keyword)i.keyword=r;this.addKeyword(i)}}function getMetaSchemaOptions(){const t={...this.opts};for(const r of b)delete t[r];return t}const R={log(){},warn(){},error(){}};function getLogger(t){if(t===false)return R;if(t===undefined)return console;if(t.log&&t.warn&&t.error)return t;throw new Error("logger must implement log, warn and error methods")}const P=/^[a-z_$][a-z0-9_$:-]*$/i;function checkKeyword(t,r){const{RULES:i}=this;(0,g.eachItem)(t,(t=>{if(i.keywords[t])throw new Error(`Keyword ${t} is already defined`);if(!P.test(t))throw new Error(`Keyword ${t} has invalid name`)}));if(!r)return;if(r.$data&&!("code"in r||"validate"in r)){throw new Error('$data keyword must have "code" or "validate" function')}}function addRule(t,r,i){var o;const a=r===null||r===void 0?void 0:r.post;if(i&&a)throw new Error('keyword with "post" flag cannot have "type"');const{RULES:c}=this;let l=a?c.post:c.rules.find((({type:t})=>t===i));if(!l){l={type:i,rules:[]};c.rules.push(l)}c.keywords[t]=true;if(!r)return;const u={keyword:t,definition:{...r,type:(0,m.getJSONTypes)(r.type),schemaType:(0,m.getJSONTypes)(r.schemaType)}};if(r.before)addBeforeRule.call(this,l,u,r.before);else l.rules.push(u);c.all[t]=u;(o=r.implements)===null||o===void 0?void 0:o.forEach((t=>this.addKeyword(t)))}function addBeforeRule(t,r,i){const o=t.rules.findIndex((t=>t.keyword===i));if(o>=0){t.rules.splice(o,0,r)}else{t.rules.push(r);this.logger.warn(`rule ${i} is not defined`)}}function keywordMetaschema(t){let{metaSchema:r}=t;if(r===undefined)return;if(t.$data&&this.opts.$data)r=schemaOrData(r);t.validateSchema=this.compile(r,true)}const O={$ref:"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"};function schemaOrData(t){return{anyOf:[t,O]}}},3166:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(1678);const a=i(7216);const c=i(9547);const l=i(8226);const u=i(518);const h=i(4588);const d=i(5707);const p=i(7082);const m=["/properties"];function addMetaSchema2020(t){[o,a,c,l,u,with$data(this,h),d,with$data(this,p)].forEach((t=>this.addMetaSchema(t,undefined,false)));return this;function with$data(r,i){return t?r.$dataMetaSchema(i,m):i}}r["default"]=addMetaSchema2020},1760:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(5546);o.code='require("ajv/dist/runtime/equal").default';r["default"]=o},4475:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});function ucs2length(t){const r=t.length;let i=0;let o=0;let a;while(o<r){i++;a=t.charCodeAt(o++);if(a>=55296&&a<=56319&&o<r){a=t.charCodeAt(o);if((a&64512)===56320)o++}}return i}r["default"]=ucs2length;ucs2length.code='require("ajv/dist/runtime/ucs2length").default'},5554:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(2387);o.code='require("ajv/dist/runtime/uri").default';r["default"]=o},7248:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});class ValidationError extends Error{constructor(t){super("validation failed");this.errors=t;this.ajv=this.validation=true}}r["default"]=ValidationError},611:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.validateAdditionalItems=void 0;const o=i(6515);const a=i(7373);const c={message:({params:{len:t}})=>(0,o.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,o._)`{limit: ${t}}`};const l={keyword:"additionalItems",type:"array",schemaType:["boolean","object"],before:"uniqueItems",error:c,code(t){const{parentSchema:r,it:i}=t;const{items:o}=r;if(!Array.isArray(o)){(0,a.checkStrictMode)(i,'"additionalItems" is ignored when "items" is not an array of schemas');return}validateAdditionalItems(t,o)}};function validateAdditionalItems(t,r){const{gen:i,schema:c,data:l,keyword:u,it:h}=t;h.items=true;const d=i.const("len",(0,o._)`${l}.length`);if(c===false){t.setParams({len:r.length});t.pass((0,o._)`${d} <= ${r.length}`)}else if(typeof c=="object"&&!(0,a.alwaysValidSchema)(h,c)){const a=i.var("valid",(0,o._)`${d} <= ${r.length}`);i.if((0,o.not)(a),(()=>validateItems(a)));t.ok(a)}function validateItems(c){i.forRange("i",r.length,d,(r=>{t.subschema({keyword:u,dataProp:r,dataPropType:a.Type.Num},c);if(!h.allErrors)i.if((0,o.not)(c),(()=>i.break()))}))}}r.validateAdditionalItems=validateAdditionalItems;r["default"]=l},8846:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(3955);const a=i(6515);const c=i(3877);const l=i(7373);const u={message:"must NOT have additional properties",params:({params:t})=>(0,a._)`{additionalProperty: ${t.additionalProperty}}`};const h={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:true,trackErrors:true,error:u,code(t){const{gen:r,schema:i,parentSchema:u,data:h,errsCount:d,it:p}=t;if(!d)throw new Error("ajv implementation error");const{allErrors:m,opts:g}=p;p.props=true;if(g.removeAdditional!=="all"&&(0,l.alwaysValidSchema)(p,i))return;const y=(0,o.allSchemaProperties)(u.properties);const v=(0,o.allSchemaProperties)(u.patternProperties);checkAdditionalProperties();t.ok((0,a._)`${d} === ${c.default.errors}`);function checkAdditionalProperties(){r.forIn("key",h,(t=>{if(!y.length&&!v.length)additionalPropertyCode(t);else r.if(isAdditional(t),(()=>additionalPropertyCode(t)))}))}function isAdditional(i){let c;if(y.length>8){const t=(0,l.schemaRefOrVal)(p,u.properties,"properties");c=(0,o.isOwnProperty)(r,t,i)}else if(y.length){c=(0,a.or)(...y.map((t=>(0,a._)`${i} === ${t}`)))}else{c=a.nil}if(v.length){c=(0,a.or)(c,...v.map((r=>(0,a._)`${(0,o.usePattern)(t,r)}.test(${i})`)))}return(0,a.not)(c)}function deleteAdditional(t){r.code((0,a._)`delete ${h}[${t}]`)}function additionalPropertyCode(o){if(g.removeAdditional==="all"||g.removeAdditional&&i===false){deleteAdditional(o);return}if(i===false){t.setParams({additionalProperty:o});t.error();if(!m)r.break();return}if(typeof i=="object"&&!(0,l.alwaysValidSchema)(p,i)){const i=r.name("valid");if(g.removeAdditional==="failing"){applyAdditionalSchema(o,i,false);r.if((0,a.not)(i),(()=>{t.reset();deleteAdditional(o)}))}else{applyAdditionalSchema(o,i);if(!m)r.if((0,a.not)(i),(()=>r.break()))}}}function applyAdditionalSchema(r,i,o){const a={keyword:"additionalProperties",dataProp:r,dataPropType:l.Type.Str};if(o===false){Object.assign(a,{compositeRule:true,createErrors:false,allErrors:false})}t.subschema(a,i)}}};r["default"]=h},6170:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(7373);const a={keyword:"allOf",schemaType:"array",code(t){const{gen:r,schema:i,it:a}=t;if(!Array.isArray(i))throw new Error("ajv implementation error");const c=r.name("valid");i.forEach(((r,i)=>{if((0,o.alwaysValidSchema)(a,r))return;const l=t.subschema({keyword:"allOf",schemaProp:i},c);t.ok(c);t.mergeEvaluated(l)}))}};r["default"]=a},2307:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(3955);const a={keyword:"anyOf",schemaType:"array",trackErrors:true,code:o.validateUnion,error:{message:"must match a schema in anyOf"}};r["default"]=a},4795:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a=i(7373);const c={message:({params:{min:t,max:r}})=>r===undefined?(0,o.str)`must contain at least ${t} valid item(s)`:(0,o.str)`must contain at least ${t} and no more than ${r} valid item(s)`,params:({params:{min:t,max:r}})=>r===undefined?(0,o._)`{minContains: ${t}}`:(0,o._)`{minContains: ${t}, maxContains: ${r}}`};const l={keyword:"contains",type:"array",schemaType:["object","boolean"],before:"uniqueItems",trackErrors:true,error:c,code(t){const{gen:r,schema:i,parentSchema:c,data:l,it:u}=t;let h;let d;const{minContains:p,maxContains:m}=c;if(u.opts.next){h=p===undefined?1:p;d=m}else{h=1}const g=r.const("len",(0,o._)`${l}.length`);t.setParams({min:h,max:d});if(d===undefined&&h===0){(0,a.checkStrictMode)(u,`"minContains" == 0 without "maxContains": "contains" keyword ignored`);return}if(d!==undefined&&h>d){(0,a.checkStrictMode)(u,`"minContains" > "maxContains" is always invalid`);t.fail();return}if((0,a.alwaysValidSchema)(u,i)){let r=(0,o._)`${g} >= ${h}`;if(d!==undefined)r=(0,o._)`${r} && ${g} <= ${d}`;t.pass(r);return}u.items=true;const y=r.name("valid");if(d===undefined&&h===1){validateItems(y,(()=>r.if(y,(()=>r.break()))))}else if(h===0){r.let(y,true);if(d!==undefined)r.if((0,o._)`${l}.length > 0`,validateItemsWithCount)}else{r.let(y,false);validateItemsWithCount()}t.result(y,(()=>t.reset()));function validateItemsWithCount(){const t=r.name("_valid");const i=r.let("count",0);validateItems(t,(()=>r.if(t,(()=>checkLimits(i)))))}function validateItems(i,o){r.forRange("i",0,g,(r=>{t.subschema({keyword:"contains",dataProp:r,dataPropType:a.Type.Num,compositeRule:true},i);o()}))}function checkLimits(t){r.code((0,o._)`${t}++`);if(d===undefined){r.if((0,o._)`${t} >= ${h}`,(()=>r.assign(y,true).break()))}else{r.if((0,o._)`${t} > ${d}`,(()=>r.assign(y,false).break()));if(h===1)r.assign(y,true);else r.if((0,o._)`${t} >= ${h}`,(()=>r.assign(y,true)))}}}};r["default"]=l},8803:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.validateSchemaDeps=r.validatePropertyDeps=r.error=void 0;const o=i(6515);const a=i(7373);const c=i(3955);r.error={message:({params:{property:t,depsCount:r,deps:i}})=>{const a=r===1?"property":"properties";return(0,o.str)`must have ${a} ${i} when property ${t} is present`},params:({params:{property:t,depsCount:r,deps:i,missingProperty:a}})=>(0,o._)`{property: ${t},
|
|
70
70
|
missingProperty: ${a},
|
|
71
71
|
depsCount: ${r},
|
|
72
|
-
deps: ${i}}`};const l={keyword:"dependencies",type:"object",schemaType:"object",error:r.error,code(t){const[r,i]=splitDependencies(t);validatePropertyDeps(t,r);validateSchemaDeps(t,i)}};function splitDependencies({schema:t}){const r={};const i={};for(const o in t){if(o==="__proto__")continue;const a=Array.isArray(t[o])?r:i;a[o]=t[o]}return[r,i]}function validatePropertyDeps(t,r=t.schema){const{gen:i,data:a,it:l}=t;if(Object.keys(r).length===0)return;const u=i.let("missing");for(const h in r){const d=r[h];if(d.length===0)continue;const p=(0,c.propertyInData)(i,a,h,l.opts.ownProperties);t.setParams({property:h,depsCount:d.length,deps:d.join(", ")});if(l.allErrors){i.if(p,(()=>{for(const r of d){(0,c.checkReportMissingProp)(t,r)}}))}else{i.if((0,o._)`${p} && (${(0,c.checkMissingProp)(t,d,u)})`);(0,c.reportMissingProp)(t,u);i.else()}}}r.validatePropertyDeps=validatePropertyDeps;function validateSchemaDeps(t,r=t.schema){const{gen:i,data:o,keyword:l,it:u}=t;const h=i.name("valid");for(const d in r){if((0,a.alwaysValidSchema)(u,r[d]))continue;i.if((0,c.propertyInData)(i,o,d,u.opts.ownProperties),(()=>{const r=t.subschema({keyword:l,schemaProp:d},h);t.mergeValidEvaluated(r,h)}),(()=>i.var(h,true)));t.ok(h)}}r.validateSchemaDeps=validateSchemaDeps;r["default"]=l},539:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(8803);const a={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,o.validateSchemaDeps)(t)};r["default"]=a},4373:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a=i(7373);const c={message:({params:t})=>(0,o.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,o._)`{failingKeyword: ${t.ifClause}}`};const l={keyword:"if",schemaType:["object","boolean"],trackErrors:true,error:c,code(t){const{gen:r,parentSchema:i,it:c}=t;if(i.then===undefined&&i.else===undefined){(0,a.checkStrictMode)(c,'"if" without "then" and "else" is ignored')}const l=hasSchema(c,"then");const u=hasSchema(c,"else");if(!l&&!u)return;const h=r.let("valid",true);const d=r.name("_valid");validateIf();t.reset();if(l&&u){const i=r.let("ifClause");t.setParams({ifClause:i});r.if(d,validateClause("then",i),validateClause("else",i))}else if(l){r.if(d,validateClause("then"))}else{r.if((0,o.not)(d),validateClause("else"))}t.pass(h,(()=>t.error(true)));function validateIf(){const r=t.subschema({keyword:"if",compositeRule:true,createErrors:false,allErrors:false},d);t.mergeEvaluated(r)}function validateClause(i,a){return()=>{const c=t.subschema({keyword:i},d);r.assign(h,d);t.mergeValidEvaluated(c,h);if(a)r.assign(a,(0,o._)`${i}`);else t.setParams({ifClause:i})}}}};function hasSchema(t,r){const i=t.schema[r];return i!==undefined&&!(0,a.alwaysValidSchema)(t,i)}r["default"]=l},2756:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(611);const a=i(5836);const c=i(400);const l=i(3184);const u=i(4795);const h=i(8803);const d=i(6763);const p=i(8846);const m=i(2503);const g=i(7539);const y=i(1665);const v=i(2307);const b=i(7545);const w=i(6170);const E=i(4373);const S=i(6220);function getApplicator(t=false){const r=[y.default,v.default,b.default,w.default,E.default,S.default,d.default,p.default,h.default,m.default,g.default];if(t)r.push(a.default,l.default);else r.push(o.default,c.default);r.push(u.default);return r}r["default"]=getApplicator},400:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.validateTuple=void 0;const o=i(6515);const a=i(7373);const c=i(3955);const l={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){const{schema:r,it:i}=t;if(Array.isArray(r))return validateTuple(t,"additionalItems",r);i.items=true;if((0,a.alwaysValidSchema)(i,r))return;t.ok((0,c.validateArray)(t))}};function validateTuple(t,r,i=t.schema){const{gen:c,parentSchema:l,data:u,keyword:h,it:d}=t;checkStrictTuple(l);if(d.opts.unevaluated&&i.length&&d.items!==true){d.items=a.mergeEvaluated.items(c,i.length,d.items)}const p=c.name("valid");const m=c.const("len",(0,o._)`${u}.length`);i.forEach(((r,i)=>{if((0,a.alwaysValidSchema)(d,r))return;c.if((0,o._)`${m} > ${i}`,(()=>t.subschema({keyword:h,schemaProp:i,dataProp:i},p)));t.ok(p)}));function checkStrictTuple(t){const{opts:o,errSchemaPath:c}=d;const l=i.length;const u=l===t.minItems&&(l===t.maxItems||t[r]===false);if(o.strictTuples&&!u){const t=`"${h}" is ${l}-tuple, but minItems or maxItems/${r} are not specified or different at path "${c}"`;(0,a.checkStrictMode)(d,t,o.strictTuples)}}}r.validateTuple=validateTuple;r["default"]=l},3184:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a=i(7373);const c=i(3955);const l=i(611);const u={message:({params:{len:t}})=>(0,o.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,o._)`{limit: ${t}}`};const h={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:u,code(t){const{schema:r,parentSchema:i,it:o}=t;const{prefixItems:u}=i;o.items=true;if((0,a.alwaysValidSchema)(o,r))return;if(u)(0,l.validateAdditionalItems)(t,u);else t.ok((0,c.validateArray)(t))}};r["default"]=h},1665:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(7373);const a={keyword:"not",schemaType:["object","boolean"],trackErrors:true,code(t){const{gen:r,schema:i,it:a}=t;if((0,o.alwaysValidSchema)(a,i)){t.fail();return}const c=r.name("valid");t.subschema({keyword:"not",compositeRule:true,createErrors:false,allErrors:false},c);t.failResult(c,(()=>t.reset()),(()=>t.error()))},error:{message:"must NOT be valid"}};r["default"]=a},7545:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a=i(7373);const c={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,o._)`{passingSchemas: ${t.passing}}`};const l={keyword:"oneOf",schemaType:"array",trackErrors:true,error:c,code(t){const{gen:r,schema:i,parentSchema:c,it:l}=t;if(!Array.isArray(i))throw new Error("ajv implementation error");if(l.opts.discriminator&&c.discriminator)return;const u=i;const h=r.let("valid",false);const d=r.let("passing",null);const p=r.name("_valid");t.setParams({passing:d});r.block(validateOneOf);t.result(h,(()=>t.reset()),(()=>t.error(true)));function validateOneOf(){u.forEach(((i,c)=>{let u;if((0,a.alwaysValidSchema)(l,i)){r.var(p,true)}else{u=t.subschema({keyword:"oneOf",schemaProp:c,compositeRule:true},p)}if(c>0){r.if((0,o._)`${p} && ${h}`).assign(h,false).assign(d,(0,o._)`[${d}, ${c}]`).else()}r.if(p,(()=>{r.assign(h,true);r.assign(d,c);if(u)t.mergeEvaluated(u,o.Name)}))}))}}};r["default"]=l},7539:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(3955);const a=i(6515);const c=i(7373);const l=i(7373);const u={keyword:"patternProperties",type:"object",schemaType:"object",code(t){const{gen:r,schema:i,data:u,parentSchema:h,it:d}=t;const{opts:p}=d;const m=(0,o.allSchemaProperties)(i);const g=m.filter((t=>(0,c.alwaysValidSchema)(d,i[t])));if(m.length===0||g.length===m.length&&(!d.opts.unevaluated||d.props===true)){return}const y=p.strictSchema&&!p.allowMatchingProperties&&h.properties;const v=r.name("valid");if(d.props!==true&&!(d.props instanceof a.Name)){d.props=(0,l.evaluatedPropsToName)(r,d.props)}const{props:b}=d;validatePatternProperties();function validatePatternProperties(){for(const t of m){if(y)checkMatchingProperties(t);if(d.allErrors){validateProperties(t)}else{r.var(v,true);validateProperties(t);r.if(v)}}}function checkMatchingProperties(t){for(const r in y){if(new RegExp(t).test(r)){(0,c.checkStrictMode)(d,`property ${r} matches pattern ${t} (use allowMatchingProperties)`)}}}function validateProperties(i){r.forIn("key",u,(c=>{r.if((0,a._)`${(0,o.usePattern)(t,i)}.test(${c})`,(()=>{const o=g.includes(i);if(!o){t.subschema({keyword:"patternProperties",schemaProp:i,dataProp:c,dataPropType:l.Type.Str},v)}if(d.opts.unevaluated&&b!==true){r.assign((0,a._)`${b}[${c}]`,true)}else if(!o&&!d.allErrors){r.if((0,a.not)(v),(()=>r.break()))}}))}))}}};r["default"]=u},5836:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(400);const a={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,o.validateTuple)(t,"items")};r["default"]=a},2503:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(9688);const a=i(3955);const c=i(7373);const l=i(8846);const u={keyword:"properties",type:"object",schemaType:"object",code(t){const{gen:r,schema:i,parentSchema:u,data:h,it:d}=t;if(d.opts.removeAdditional==="all"&&u.additionalProperties===undefined){l.default.code(new o.KeywordCxt(d,l.default,"additionalProperties"))}const p=(0,a.allSchemaProperties)(i);for(const t of p){d.definedProperties.add(t)}if(d.opts.unevaluated&&p.length&&d.props!==true){d.props=c.mergeEvaluated.props(r,(0,c.toHash)(p),d.props)}const m=p.filter((t=>!(0,c.alwaysValidSchema)(d,i[t])));if(m.length===0)return;const g=r.name("valid");for(const i of m){if(hasDefault(i)){applyPropertySchema(i)}else{r.if((0,a.propertyInData)(r,h,i,d.opts.ownProperties));applyPropertySchema(i);if(!d.allErrors)r.else().var(g,true);r.endIf()}t.it.definedProperties.add(i);t.ok(g)}function hasDefault(t){return d.opts.useDefaults&&!d.compositeRule&&i[t].default!==undefined}function applyPropertySchema(r){t.subschema({keyword:"properties",schemaProp:r,dataProp:r},g)}}};r["default"]=u},6763:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a=i(7373);const c={message:"property name must be valid",params:({params:t})=>(0,o._)`{propertyName: ${t.propertyName}}`};const l={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:c,code(t){const{gen:r,schema:i,data:c,it:l}=t;if((0,a.alwaysValidSchema)(l,i))return;const u=r.name("valid");r.forIn("key",c,(i=>{t.setParams({propertyName:i});t.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:true},u);r.if((0,o.not)(u),(()=>{t.error(true);if(!l.allErrors)r.break()}))}));t.ok(u)}};r["default"]=l},6220:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(7373);const a={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:r,it:i}){if(r.if===undefined)(0,o.checkStrictMode)(i,`"${t}" without "if" is ignored`)}};r["default"]=a},3955:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.validateUnion=r.validateArray=r.usePattern=r.callValidateCode=r.schemaProperties=r.allSchemaProperties=r.noPropertyInData=r.propertyInData=r.isOwnProperty=r.hasPropFunc=r.reportMissingProp=r.checkMissingProp=r.checkReportMissingProp=void 0;const o=i(6515);const a=i(7373);const c=i(3877);const l=i(7373);function checkReportMissingProp(t,r){const{gen:i,data:a,it:c}=t;i.if(noPropertyInData(i,a,r,c.opts.ownProperties),(()=>{t.setParams({missingProperty:(0,o._)`${r}`},true);t.error()}))}r.checkReportMissingProp=checkReportMissingProp;function checkMissingProp({gen:t,data:r,it:{opts:i}},a,c){return(0,o.or)(...a.map((a=>(0,o.and)(noPropertyInData(t,r,a,i.ownProperties),(0,o._)`${c} = ${a}`))))}r.checkMissingProp=checkMissingProp;function reportMissingProp(t,r){t.setParams({missingProperty:r},true);t.error()}r.reportMissingProp=reportMissingProp;function hasPropFunc(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,o._)`Object.prototype.hasOwnProperty`})}r.hasPropFunc=hasPropFunc;function isOwnProperty(t,r,i){return(0,o._)`${hasPropFunc(t)}.call(${r}, ${i})`}r.isOwnProperty=isOwnProperty;function propertyInData(t,r,i,a){const c=(0,o._)`${r}${(0,o.getProperty)(i)} !== undefined`;return a?(0,o._)`${c} && ${isOwnProperty(t,r,i)}`:c}r.propertyInData=propertyInData;function noPropertyInData(t,r,i,a){const c=(0,o._)`${r}${(0,o.getProperty)(i)} === undefined`;return a?(0,o.or)(c,(0,o.not)(isOwnProperty(t,r,i))):c}r.noPropertyInData=noPropertyInData;function allSchemaProperties(t){return t?Object.keys(t).filter((t=>t!=="__proto__")):[]}r.allSchemaProperties=allSchemaProperties;function schemaProperties(t,r){return allSchemaProperties(r).filter((i=>!(0,a.alwaysValidSchema)(t,r[i])))}r.schemaProperties=schemaProperties;function callValidateCode({schemaCode:t,data:r,it:{gen:i,topSchemaRef:a,schemaPath:l,errorPath:u},it:h},d,p,m){const g=m?(0,o._)`${t}, ${r}, ${a}${l}`:r;const y=[[c.default.instancePath,(0,o.strConcat)(c.default.instancePath,u)],[c.default.parentData,h.parentData],[c.default.parentDataProperty,h.parentDataProperty],[c.default.rootData,c.default.rootData]];if(h.opts.dynamicRef)y.push([c.default.dynamicAnchors,c.default.dynamicAnchors]);const v=(0,o._)`${g}, ${i.object(...y)}`;return p!==o.nil?(0,o._)`${d}.call(${p}, ${v})`:(0,o._)`${d}(${v})`}r.callValidateCode=callValidateCode;const u=(0,o._)`new RegExp`;function usePattern({gen:t,it:{opts:r}},i){const a=r.unicodeRegExp?"u":"";const{regExp:c}=r.code;const h=c(i,a);return t.scopeValue("pattern",{key:h.toString(),ref:h,code:(0,o._)`${c.code==="new RegExp"?u:(0,l.useFunc)(t,c)}(${i}, ${a})`})}r.usePattern=usePattern;function validateArray(t){const{gen:r,data:i,keyword:c,it:l}=t;const u=r.name("valid");if(l.allErrors){const t=r.let("valid",true);validateItems((()=>r.assign(t,false)));return t}r.var(u,true);validateItems((()=>r.break()));return u;function validateItems(l){const h=r.const("len",(0,o._)`${i}.length`);r.forRange("i",0,h,(i=>{t.subschema({keyword:c,dataProp:i,dataPropType:a.Type.Num},u);r.if((0,o.not)(u),l)}))}}r.validateArray=validateArray;function validateUnion(t){const{gen:r,schema:i,keyword:c,it:l}=t;if(!Array.isArray(i))throw new Error("ajv implementation error");const u=i.some((t=>(0,a.alwaysValidSchema)(l,t)));if(u&&!l.opts.unevaluated)return;const h=r.let("valid",false);const d=r.name("_valid");r.block((()=>i.forEach(((i,a)=>{const l=t.subschema({keyword:c,schemaProp:a,compositeRule:true},d);r.assign(h,(0,o._)`${h} || ${d}`);const u=t.mergeValidEvaluated(l,d);if(!u)r.if((0,o.not)(h))}))));t.result(h,(()=>t.reset()),(()=>t.error(true)))}r.validateUnion=validateUnion},8129:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const i={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};r["default"]=i},6594:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(8129);const a=i(1259);const c=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",o.default,a.default];r["default"]=c},1259:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.callRef=r.getValidate=void 0;const o=i(5945);const a=i(3955);const c=i(6515);const l=i(3877);const u=i(4621);const h=i(7373);const d={keyword:"$ref",schemaType:"string",code(t){const{gen:r,schema:i,it:a}=t;const{baseId:l,schemaEnv:h,validateName:d,opts:p,self:m}=a;const{root:g}=h;if((i==="#"||i==="#/")&&l===g.baseId)return callRootRef();const y=u.resolveRef.call(m,g,l,i);if(y===undefined)throw new o.default(a.opts.uriResolver,l,i);if(y instanceof u.SchemaEnv)return callValidate(y);return inlineRefSchema(y);function callRootRef(){if(h===g)return callRef(t,d,h,h.$async);const i=r.scopeValue("root",{ref:g});return callRef(t,(0,c._)`${i}.validate`,g,g.$async)}function callValidate(r){const i=getValidate(t,r);callRef(t,i,r,r.$async)}function inlineRefSchema(o){const a=r.scopeValue("schema",p.code.source===true?{ref:o,code:(0,c.stringify)(o)}:{ref:o});const l=r.name("valid");const u=t.subschema({schema:o,dataTypes:[],schemaPath:c.nil,topSchemaRef:a,errSchemaPath:i},l);t.mergeEvaluated(u);t.ok(l)}}};function getValidate(t,r){const{gen:i}=t;return r.validate?i.scopeValue("validate",{ref:r.validate}):(0,c._)`${i.scopeValue("wrapper",{ref:r})}.validate`}r.getValidate=getValidate;function callRef(t,r,i,o){const{gen:u,it:d}=t;const{allErrors:p,schemaEnv:m,opts:g}=d;const y=g.passContext?l.default.this:c.nil;if(o)callAsyncRef();else callSyncRef();function callAsyncRef(){if(!m.$async)throw new Error("async schema referenced by sync schema");const i=u.let("valid");u.try((()=>{u.code((0,c._)`await ${(0,a.callValidateCode)(t,r,y)}`);addEvaluatedFrom(r);if(!p)u.assign(i,true)}),(t=>{u.if((0,c._)`!(${t} instanceof ${d.ValidationError})`,(()=>u.throw(t)));addErrorsFrom(t);if(!p)u.assign(i,false)}));t.ok(i)}function callSyncRef(){t.result((0,a.callValidateCode)(t,r,y),(()=>addEvaluatedFrom(r)),(()=>addErrorsFrom(r)))}function addErrorsFrom(t){const r=(0,c._)`${t}.errors`;u.assign(l.default.vErrors,(0,c._)`${l.default.vErrors} === null ? ${r} : ${l.default.vErrors}.concat(${r})`);u.assign(l.default.errors,(0,c._)`${l.default.vErrors}.length`)}function addEvaluatedFrom(t){var r;if(!d.opts.unevaluated)return;const o=(r=i===null||i===void 0?void 0:i.validate)===null||r===void 0?void 0:r.evaluated;if(d.props!==true){if(o&&!o.dynamicProps){if(o.props!==undefined){d.props=h.mergeEvaluated.props(u,o.props,d.props)}}else{const r=u.var("props",(0,c._)`${t}.evaluated.props`);d.props=h.mergeEvaluated.props(u,r,d.props,c.Name)}}if(d.items!==true){if(o&&!o.dynamicItems){if(o.items!==undefined){d.items=h.mergeEvaluated.items(u,o.items,d.items)}}else{const r=u.var("items",(0,c._)`${t}.evaluated.items`);d.items=h.mergeEvaluated.items(u,r,d.items,c.Name)}}}}r.callRef=callRef;r["default"]=d},1079:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a=i(3710);const c=i(4621);const l=i(5945);const u=i(7373);const h={message:({params:{discrError:t,tagName:r}})=>t===a.DiscrError.Tag?`tag "${r}" must be string`:`value of tag "${r}" must be in oneOf`,params:({params:{discrError:t,tag:r,tagName:i}})=>(0,o._)`{error: ${t}, tag: ${i}, tagValue: ${r}}`};const d={keyword:"discriminator",type:"object",schemaType:"object",error:h,code(t){const{gen:r,data:i,schema:h,parentSchema:d,it:p}=t;const{oneOf:m}=d;if(!p.opts.discriminator){throw new Error("discriminator: requires discriminator option")}const g=h.propertyName;if(typeof g!="string")throw new Error("discriminator: requires propertyName");if(h.mapping)throw new Error("discriminator: mapping is not supported");if(!m)throw new Error("discriminator: requires oneOf keyword");const y=r.let("valid",false);const v=r.const("tag",(0,o._)`${i}${(0,o.getProperty)(g)}`);r.if((0,o._)`typeof ${v} == "string"`,(()=>validateMapping()),(()=>t.error(false,{discrError:a.DiscrError.Tag,tag:v,tagName:g})));t.ok(y);function validateMapping(){const i=getMapping();r.if(false);for(const t in i){r.elseIf((0,o._)`${v} === ${t}`);r.assign(y,applyTagSchema(i[t]))}r.else();t.error(false,{discrError:a.DiscrError.Mapping,tag:v,tagName:g});r.endIf()}function applyTagSchema(i){const a=r.name("valid");const c=t.subschema({keyword:"oneOf",schemaProp:i},a);t.mergeEvaluated(c,o.Name);return a}function getMapping(){var t;const r={};const i=hasRequired(d);let o=true;for(let r=0;r<m.length;r++){let a=m[r];if((a===null||a===void 0?void 0:a.$ref)&&!(0,u.schemaHasRulesButRef)(a,p.self.RULES)){const t=a.$ref;a=c.resolveRef.call(p.self,p.schemaEnv.root,p.baseId,t);if(a instanceof c.SchemaEnv)a=a.schema;if(a===undefined)throw new l.default(p.opts.uriResolver,p.baseId,t)}const h=(t=a===null||a===void 0?void 0:a.properties)===null||t===void 0?void 0:t[g];if(typeof h!="object"){throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${g}"`)}o=o&&(i||hasRequired(a));addMappings(h,r)}if(!o)throw new Error(`discriminator: "${g}" must be required`);return r;function hasRequired({required:t}){return Array.isArray(t)&&t.includes(g)}function addMappings(t,r){if(t.const){addMapping(t.const,r)}else if(t.enum){for(const i of t.enum){addMapping(i,r)}}else{throw new Error(`discriminator: "properties/${g}" must have "const" or "enum"`)}}function addMapping(t,i){if(typeof t!="string"||t in r){throw new Error(`discriminator: "${g}" values must be unique strings`)}r[t]=i}}}};r["default"]=d},3710:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.DiscrError=void 0;var i;(function(t){t["Tag"]="tag";t["Mapping"]="mapping"})(i||(r.DiscrError=i={}))},5219:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6594);const a=i(7862);const c=i(2756);const l=i(6738);const u=i(7055);const h=i(5339);const d=i(7102);const p=i(6343);const m=[l.default,o.default,a.default,(0,c.default)(true),d.default,p.metadataVocabulary,p.contentVocabulary,u.default,h.default];r["default"]=m},9242:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6594);const a=i(7862);const c=i(2756);const l=i(7102);const u=i(6343);const h=[o.default,a.default,(0,c.default)(),l.default,u.metadataVocabulary,u.contentVocabulary];r["default"]=h},290:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.dynamicAnchor=void 0;const o=i(6515);const a=i(3877);const c=i(4621);const l=i(1259);const u={keyword:"$dynamicAnchor",schemaType:"string",code:t=>dynamicAnchor(t,t.schema)};function dynamicAnchor(t,r){const{gen:i,it:c}=t;c.schemaEnv.root.dynamicAnchors[r]=true;const l=(0,o._)`${a.default.dynamicAnchors}${(0,o.getProperty)(r)}`;const u=c.errSchemaPath==="#"?c.validateName:_getValidate(t);i.if((0,o._)`!${l}`,(()=>i.assign(l,u)))}r.dynamicAnchor=dynamicAnchor;function _getValidate(t){const{schemaEnv:r,schema:i,self:o}=t.it;const{root:a,baseId:u,localRefs:h,meta:d}=r.root;const{schemaId:p}=o.opts;const m=new c.SchemaEnv({schema:i,schemaId:p,root:a,baseId:u,localRefs:h,meta:d});c.compileSchema.call(o,m);return(0,l.getValidate)(t,m)}r["default"]=u},3422:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.dynamicRef=void 0;const o=i(6515);const a=i(3877);const c=i(1259);const l={keyword:"$dynamicRef",schemaType:"string",code:t=>dynamicRef(t,t.schema)};function dynamicRef(t,r){const{gen:i,keyword:l,it:u}=t;if(r[0]!=="#")throw new Error(`"${l}" only supports hash fragment reference`);const h=r.slice(1);if(u.allErrors){_dynamicRef()}else{const r=i.let("valid",false);_dynamicRef(r);t.ok(r)}function _dynamicRef(t){if(u.schemaEnv.root.dynamicAnchors[h]){const r=i.let("_v",(0,o._)`${a.default.dynamicAnchors}${(0,o.getProperty)(h)}`);i.if(r,_callRef(r,t),_callRef(u.validateName,t))}else{_callRef(u.validateName,t)()}}function _callRef(r,o){return o?()=>i.block((()=>{(0,c.callRef)(t,r);i.let(o,true)})):()=>(0,c.callRef)(t,r)}}r.dynamicRef=dynamicRef;r["default"]=l},6738:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(290);const a=i(3422);const c=i(9475);const l=i(4709);const u=[o.default,a.default,c.default,l.default];r["default"]=u},9475:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(290);const a=i(7373);const c={keyword:"$recursiveAnchor",schemaType:"boolean",code(t){if(t.schema)(0,o.dynamicAnchor)(t,"");else(0,a.checkStrictMode)(t.it,"$recursiveAnchor: false is ignored")}};r["default"]=c},4709:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(3422);const a={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,o.dynamicRef)(t,t.schema)};r["default"]=a},9711:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a={message:({schemaCode:t})=>(0,o.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,o._)`{format: ${t}}`};const c={keyword:"format",type:["number","string"],schemaType:"string",$data:true,error:a,code(t,r){const{gen:i,data:a,$data:c,schema:l,schemaCode:u,it:h}=t;const{opts:d,errSchemaPath:p,schemaEnv:m,self:g}=h;if(!d.validateFormats)return;if(c)validate$DataFormat();else validateFormat();function validate$DataFormat(){const c=i.scopeValue("formats",{ref:g.formats,code:d.code.formats});const l=i.const("fDef",(0,o._)`${c}[${u}]`);const h=i.let("fType");const p=i.let("format");i.if((0,o._)`typeof ${l} == "object" && !(${l} instanceof RegExp)`,(()=>i.assign(h,(0,o._)`${l}.type || "string"`).assign(p,(0,o._)`${l}.validate`)),(()=>i.assign(h,(0,o._)`"string"`).assign(p,l)));t.fail$data((0,o.or)(unknownFmt(),invalidFmt()));function unknownFmt(){if(d.strictSchema===false)return o.nil;return(0,o._)`${u} && !${p}`}function invalidFmt(){const t=m.$async?(0,o._)`(${l}.async ? await ${p}(${a}) : ${p}(${a}))`:(0,o._)`${p}(${a})`;const i=(0,o._)`(typeof ${p} == "function" ? ${t} : ${p}.test(${a}))`;return(0,o._)`${p} && ${p} !== true && ${h} === ${r} && !${i}`}}function validateFormat(){const c=g.formats[l];if(!c){unknownFormat();return}if(c===true)return;const[u,h,y]=getFormat(c);if(u===r)t.pass(validCondition());function unknownFormat(){if(d.strictSchema===false){g.logger.warn(unknownMsg());return}throw new Error(unknownMsg());function unknownMsg(){return`unknown format "${l}" ignored in schema at path "${p}"`}}function getFormat(t){const r=t instanceof RegExp?(0,o.regexpCode)(t):d.code.formats?(0,o._)`${d.code.formats}${(0,o.getProperty)(l)}`:undefined;const a=i.scopeValue("formats",{key:l,ref:t,code:r});if(typeof t=="object"&&!(t instanceof RegExp)){return[t.type||"string",t.validate,(0,o._)`${a}.validate`]}return["string",t,a]}function validCondition(){if(typeof c=="object"&&!(c instanceof RegExp)&&c.async){if(!m.$async)throw new Error("async format in sync schema");return(0,o._)`await ${y}(${a})`}return typeof h=="function"?(0,o._)`${y}(${a})`:(0,o._)`${y}.test(${a})`}}}};r["default"]=c},7102:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(9711);const a=[o.default];r["default"]=a},6343:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.contentVocabulary=r.metadataVocabulary=void 0;r.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];r.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]},7055:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(5020);const a=i(539);const c=i(8660);const l=[o.default,a.default,c.default];r["default"]=l},5339:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(1038);const a=i(8003);const c=[o.default,a.default];r["default"]=c},8003:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a=i(7373);const c={message:({params:{len:t}})=>(0,o.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,o._)`{limit: ${t}}`};const l={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:c,code(t){const{gen:r,schema:i,data:c,it:l}=t;const u=l.items||0;if(u===true)return;const h=r.const("len",(0,o._)`${c}.length`);if(i===false){t.setParams({len:u});t.fail((0,o._)`${h} > ${u}`)}else if(typeof i=="object"&&!(0,a.alwaysValidSchema)(l,i)){const i=r.var("valid",(0,o._)`${h} <= ${u}`);r.if((0,o.not)(i),(()=>validateItems(i,u)));t.ok(i)}l.items=true;function validateItems(i,c){r.forRange("i",c,h,(c=>{t.subschema({keyword:"unevaluatedItems",dataProp:c,dataPropType:a.Type.Num},i);if(!l.allErrors)r.if((0,o.not)(i),(()=>r.break()))}))}}};r["default"]=l},1038:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a=i(7373);const c=i(3877);const l={message:"must NOT have unevaluated properties",params:({params:t})=>(0,o._)`{unevaluatedProperty: ${t.unevaluatedProperty}}`};const u={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:true,error:l,code(t){const{gen:r,schema:i,data:l,errsCount:u,it:h}=t;if(!u)throw new Error("ajv implementation error");const{allErrors:d,props:p}=h;if(p instanceof o.Name){r.if((0,o._)`${p} !== true`,(()=>r.forIn("key",l,(t=>r.if(unevaluatedDynamic(p,t),(()=>unevaluatedPropCode(t)))))))}else if(p!==true){r.forIn("key",l,(t=>p===undefined?unevaluatedPropCode(t):r.if(unevaluatedStatic(p,t),(()=>unevaluatedPropCode(t)))))}h.props=true;t.ok((0,o._)`${u} === ${c.default.errors}`);function unevaluatedPropCode(c){if(i===false){t.setParams({unevaluatedProperty:c});t.error();if(!d)r.break();return}if(!(0,a.alwaysValidSchema)(h,i)){const i=r.name("valid");t.subschema({keyword:"unevaluatedProperties",dataProp:c,dataPropType:a.Type.Str},i);if(!d)r.if((0,o.not)(i),(()=>r.break()))}}function unevaluatedDynamic(t,r){return(0,o._)`!${t} || !${t}[${r}]`}function unevaluatedStatic(t,r){const i=[];for(const a in t){if(t[a]===true)i.push((0,o._)`${r} !== ${a}`)}return(0,o.and)(...i)}}};r["default"]=u},4381:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a=i(7373);const c=i(1760);const l={message:"must be equal to constant",params:({schemaCode:t})=>(0,o._)`{allowedValue: ${t}}`};const u={keyword:"const",$data:true,error:l,code(t){const{gen:r,data:i,$data:l,schemaCode:u,schema:h}=t;if(l||h&&typeof h=="object"){t.fail$data((0,o._)`!${(0,a.useFunc)(r,c.default)}(${i}, ${u})`)}else{t.fail((0,o._)`${h} !== ${i}`)}}};r["default"]=u},5020:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(8803);const a={keyword:"dependentRequired",type:"object",schemaType:"object",error:o.error,code:t=>(0,o.validatePropertyDeps)(t)};r["default"]=a},4209:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a=i(7373);const c=i(1760);const l={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,o._)`{allowedValues: ${t}}`};const u={keyword:"enum",schemaType:"array",$data:true,error:l,code(t){const{gen:r,data:i,$data:l,schema:u,schemaCode:h,it:d}=t;if(!l&&u.length===0)throw new Error("enum must have non-empty array");const p=u.length>=d.opts.loopEnum;let m;const getEql=()=>m!==null&&m!==void 0?m:m=(0,a.useFunc)(r,c.default);let g;if(p||l){g=r.let("valid");t.block$data(g,loopEnum)}else{if(!Array.isArray(u))throw new Error("ajv implementation error");const t=r.const("vSchema",h);g=(0,o.or)(...u.map(((r,i)=>equalCode(t,i))))}t.pass(g);function loopEnum(){r.assign(g,false);r.forOf("v",h,(t=>r.if((0,o._)`${getEql()}(${i}, ${t})`,(()=>r.assign(g,true).break()))))}function equalCode(t,r){const a=u[r];return typeof a==="object"&&a!==null?(0,o._)`${getEql()}(${i}, ${t}[${r}])`:(0,o._)`${i} === ${a}`}}};r["default"]=u},7862:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(2708);const a=i(1177);const c=i(2737);const l=i(6340);const u=i(1188);const h=i(4141);const d=i(2049);const p=i(9359);const m=i(4381);const g=i(4209);const y=[o.default,a.default,c.default,l.default,u.default,h.default,d.default,p.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},m.default,g.default];r["default"]=y},8660:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(7373);const a={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:t,parentSchema:r,it:i}){if(r.contains===undefined){(0,o.checkStrictMode)(i,`"${t}" without "contains" is ignored`)}}};r["default"]=a},2049:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a={message({keyword:t,schemaCode:r}){const i=t==="maxItems"?"more":"fewer";return(0,o.str)`must NOT have ${i} than ${r} items`},params:({schemaCode:t})=>(0,o._)`{limit: ${t}}`};const c={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:true,error:a,code(t){const{keyword:r,data:i,schemaCode:a}=t;const c=r==="maxItems"?o.operators.GT:o.operators.LT;t.fail$data((0,o._)`${i}.length ${c} ${a}`)}};r["default"]=c},2737:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a=i(7373);const c=i(4475);const l={message({keyword:t,schemaCode:r}){const i=t==="maxLength"?"more":"fewer";return(0,o.str)`must NOT have ${i} than ${r} characters`},params:({schemaCode:t})=>(0,o._)`{limit: ${t}}`};const u={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:true,error:l,code(t){const{keyword:r,data:i,schemaCode:l,it:u}=t;const h=r==="maxLength"?o.operators.GT:o.operators.LT;const d=u.opts.unicode===false?(0,o._)`${i}.length`:(0,o._)`${(0,a.useFunc)(t.gen,c.default)}(${i})`;t.fail$data((0,o._)`${d} ${h} ${l}`)}};r["default"]=u},2708:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a=o.operators;const c={maximum:{okStr:"<=",ok:a.LTE,fail:a.GT},minimum:{okStr:">=",ok:a.GTE,fail:a.LT},exclusiveMaximum:{okStr:"<",ok:a.LT,fail:a.GTE},exclusiveMinimum:{okStr:">",ok:a.GT,fail:a.LTE}};const l={message:({keyword:t,schemaCode:r})=>(0,o.str)`must be ${c[t].okStr} ${r}`,params:({keyword:t,schemaCode:r})=>(0,o._)`{comparison: ${c[t].okStr}, limit: ${r}}`};const u={keyword:Object.keys(c),type:"number",schemaType:"number",$data:true,error:l,code(t){const{keyword:r,data:i,schemaCode:a}=t;t.fail$data((0,o._)`${i} ${c[r].fail} ${a} || isNaN(${i})`)}};r["default"]=u},1188:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a={message({keyword:t,schemaCode:r}){const i=t==="maxProperties"?"more":"fewer";return(0,o.str)`must NOT have ${i} than ${r} properties`},params:({schemaCode:t})=>(0,o._)`{limit: ${t}}`};const c={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:true,error:a,code(t){const{keyword:r,data:i,schemaCode:a}=t;const c=r==="maxProperties"?o.operators.GT:o.operators.LT;t.fail$data((0,o._)`Object.keys(${i}).length ${c} ${a}`)}};r["default"]=c},1177:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a={message:({schemaCode:t})=>(0,o.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,o._)`{multipleOf: ${t}}`};const c={keyword:"multipleOf",type:"number",schemaType:"number",$data:true,error:a,code(t){const{gen:r,data:i,schemaCode:a,it:c}=t;const l=c.opts.multipleOfPrecision;const u=r.let("res");const h=l?(0,o._)`Math.abs(Math.round(${u}) - ${u}) > 1e-${l}`:(0,o._)`${u} !== parseInt(${u})`;t.fail$data((0,o._)`(${a} === 0 || (${u} = ${i}/${a}, ${h}))`)}};r["default"]=c},6340:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(3955);const a=i(6515);const c={message:({schemaCode:t})=>(0,a.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,a._)`{pattern: ${t}}`};const l={keyword:"pattern",type:"string",schemaType:"string",$data:true,error:c,code(t){const{data:r,$data:i,schema:c,schemaCode:l,it:u}=t;const h=u.opts.unicodeRegExp?"u":"";const d=i?(0,a._)`(new RegExp(${l}, ${h}))`:(0,o.usePattern)(t,c);t.fail$data((0,a._)`!${d}.test(${r})`)}};r["default"]=l},4141:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(3955);const a=i(6515);const c=i(7373);const l={message:({params:{missingProperty:t}})=>(0,a.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,a._)`{missingProperty: ${t}}`};const u={keyword:"required",type:"object",schemaType:"array",$data:true,error:l,code(t){const{gen:r,schema:i,schemaCode:l,data:u,$data:h,it:d}=t;const{opts:p}=d;if(!h&&i.length===0)return;const m=i.length>=p.loopRequired;if(d.allErrors)allErrorsMode();else exitOnErrorMode();if(p.strictRequired){const r=t.parentSchema.properties;const{definedProperties:o}=t.it;for(const t of i){if((r===null||r===void 0?void 0:r[t])===undefined&&!o.has(t)){const r=d.schemaEnv.baseId+d.errSchemaPath;const i=`required property "${t}" is not defined at "${r}" (strictRequired)`;(0,c.checkStrictMode)(d,i,d.opts.strictRequired)}}}function allErrorsMode(){if(m||h){t.block$data(a.nil,loopAllRequired)}else{for(const r of i){(0,o.checkReportMissingProp)(t,r)}}}function exitOnErrorMode(){const a=r.let("missing");if(m||h){const i=r.let("valid",true);t.block$data(i,(()=>loopUntilMissing(a,i)));t.ok(i)}else{r.if((0,o.checkMissingProp)(t,i,a));(0,o.reportMissingProp)(t,a);r.else()}}function loopAllRequired(){r.forOf("prop",l,(i=>{t.setParams({missingProperty:i});r.if((0,o.noPropertyInData)(r,u,i,p.ownProperties),(()=>t.error()))}))}function loopUntilMissing(i,c){t.setParams({missingProperty:i});r.forOf(i,l,(()=>{r.assign(c,(0,o.propertyInData)(r,u,i,p.ownProperties));r.if((0,a.not)(c),(()=>{t.error();r.break()}))}),a.nil)}}};r["default"]=u},9359:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(8486);const a=i(6515);const c=i(7373);const l=i(1760);const u={message:({params:{i:t,j:r}})=>(0,a.str)`must NOT have duplicate items (items ## ${r} and ${t} are identical)`,params:({params:{i:t,j:r}})=>(0,a._)`{i: ${t}, j: ${r}}`};const h={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:true,error:u,code(t){const{gen:r,data:i,$data:u,schema:h,parentSchema:d,schemaCode:p,it:m}=t;if(!u&&!h)return;const g=r.let("valid");const y=d.items?(0,o.getSchemaTypes)(d.items):[];t.block$data(g,validateUniqueItems,(0,a._)`${p} === false`);t.ok(g);function validateUniqueItems(){const o=r.let("i",(0,a._)`${i}.length`);const c=r.let("j");t.setParams({i:o,j:c});r.assign(g,true);r.if((0,a._)`${o} > 1`,(()=>(canOptimize()?loopN:loopN2)(o,c)))}function canOptimize(){return y.length>0&&!y.some((t=>t==="object"||t==="array"))}function loopN(c,l){const u=r.name("item");const h=(0,o.checkDataTypes)(y,u,m.opts.strictNumbers,o.DataType.Wrong);const d=r.const("indices",(0,a._)`{}`);r.for((0,a._)`;${c}--;`,(()=>{r.let(u,(0,a._)`${i}[${c}]`);r.if(h,(0,a._)`continue`);if(y.length>1)r.if((0,a._)`typeof ${u} == "string"`,(0,a._)`${u} += "_"`);r.if((0,a._)`typeof ${d}[${u}] == "number"`,(()=>{r.assign(l,(0,a._)`${d}[${u}]`);t.error();r.assign(g,false).break()})).code((0,a._)`${d}[${u}] = ${c}`)}))}function loopN2(o,u){const h=(0,c.useFunc)(r,l.default);const d=r.name("outer");r.label(d).for((0,a._)`;${o}--;`,(()=>r.for((0,a._)`${u} = ${o}; ${u}--;`,(()=>r.if((0,a._)`${h}(${i}[${o}], ${i}[${u}])`,(()=>{t.error();r.assign(g,false).break(d)}))))))}}};r["default"]=h},7362:(t,r,i)=>{"use strict";const o=i(2040);const a=process.env;Object.defineProperty(r,"_vendors",{value:o.map((function(t){return t.constant}))});r.name=null;r.isPR=null;o.forEach((function(t){const i=Array.isArray(t.env)?t.env:[t.env];const o=i.every((function(t){return checkEnv(t)}));r[t.constant]=o;if(!o){return}r.name=t.name;switch(typeof t.pr){case"string":r.isPR=!!a[t.pr];break;case"object":if("env"in t.pr){r.isPR=t.pr.env in a&&a[t.pr.env]!==t.pr.ne}else if("any"in t.pr){r.isPR=t.pr.any.some((function(t){return!!a[t]}))}else{r.isPR=checkEnv(t.pr)}break;default:r.isPR=null}}));r.isCI=!!(a.CI!=="false"&&(a.BUILD_ID||a.BUILD_NUMBER||a.CI||a.CI_APP_ID||a.CI_BUILD_ID||a.CI_BUILD_NUMBER||a.CI_NAME||a.CONTINUOUS_INTEGRATION||a.RUN_ID||r.name||false));function checkEnv(t){if(typeof t==="string")return!!a[t];if("env"in t){return a[t.env]&&a[t.env].includes(t.includes)}if("any"in t){return t.any.some((function(t){return!!a[t]}))}return Object.keys(t).every((function(r){return a[r]===t[r]}))}},2544:(t,r,i)=>{"use strict";const{builtinModules:o}=i(5720);var a=new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$");var c=["node_modules","favicon.ico"];function validate(t){var r=[];var i=[];if(t===null){i.push("name cannot be null");return done(r,i)}if(t===undefined){i.push("name cannot be undefined");return done(r,i)}if(typeof t!=="string"){i.push("name must be a string");return done(r,i)}if(!t.length){i.push("name length must be greater than zero")}if(t.match(/^\./)){i.push("name cannot start with a period")}if(t.match(/^_/)){i.push("name cannot start with an underscore")}if(t.trim()!==t){i.push("name cannot contain leading or trailing spaces")}c.forEach((function(r){if(t.toLowerCase()===r){i.push(r+" is a blacklisted name")}}));if(o.includes(t.toLowerCase())){r.push(t+" is a core module name")}if(t.length>214){r.push("name can no longer contain more than 214 characters")}if(t.toLowerCase()!==t){r.push("name can no longer contain capital letters")}if(/[~'!()*]/.test(t.split("/").slice(-1)[0])){r.push('name can no longer contain special characters ("~\'!()*")')}if(encodeURIComponent(t)!==t){var l=t.match(a);if(l){var u=l[1];var h=l[2];if(encodeURIComponent(u)===u&&encodeURIComponent(h)===h){return done(r,i)}}i.push("name can only contain URL-friendly characters")}return done(r,i)}var done=function(t,r){var i={validForNewPackages:r.length===0&&t.length===0,validForOldPackages:r.length===0,warnings:t,errors:r};if(!i.warnings.length){delete i.warnings}if(!i.errors.length){delete i.errors}return i};t.exports=validate},181:t=>{"use strict";t.exports=require("buffer")},5317:t=>{"use strict";t.exports=require("child_process")},4434:t=>{"use strict";t.exports=require("events")},9896:t=>{"use strict";t.exports=require("fs")},8611:t=>{"use strict";t.exports=require("http")},5692:t=>{"use strict";t.exports=require("https")},5720:t=>{"use strict";t.exports=require("module")},1421:t=>{"use strict";t.exports=require("node:child_process")},8474:t=>{"use strict";t.exports=require("node:events")},3024:t=>{"use strict";t.exports=require("node:fs")},6760:t=>{"use strict";t.exports=require("node:path")},1708:t=>{"use strict";t.exports=require("node:process")},857:t=>{"use strict";t.exports=require("os")},6928:t=>{"use strict";t.exports=require("path")},3785:t=>{"use strict";t.exports=require("readline")},2203:t=>{"use strict";t.exports=require("stream")},2018:t=>{"use strict";t.exports=require("tty")},7016:t=>{"use strict";t.exports=require("url")},9023:t=>{"use strict";t.exports=require("util")},7944:(t,r,i)=>{const{Argument:o}=i(3573);const{Command:a}=i(217);const{CommanderError:c,InvalidArgumentError:l}=i(5246);const{Help:u}=i(5889);const{Option:h}=i(8127);r.DM=new a;r.gu=t=>new a(t);r.Ww=(t,r)=>new h(t,r);r.er=(t,r)=>new o(t,r);r.uB=a;r.c$=h;r.ef=o;r._V=u;r.b7=c;r.Di=l;r.a2=l},3573:(t,r,i)=>{const{InvalidArgumentError:o}=i(5246);class Argument{constructor(t,r){this.description=r||"";this.variadic=false;this.parseArg=undefined;this.defaultValue=undefined;this.defaultValueDescription=undefined;this.argChoices=undefined;switch(t[0]){case"<":this.required=true;this._name=t.slice(1,-1);break;case"[":this.required=false;this._name=t.slice(1,-1);break;default:this.required=true;this._name=t;break}if(this._name.length>3&&this._name.slice(-3)==="..."){this.variadic=true;this._name=this._name.slice(0,-3)}}name(){return this._name}_concatValue(t,r){if(r===this.defaultValue||!Array.isArray(r)){return[t]}return r.concat(t)}default(t,r){this.defaultValue=t;this.defaultValueDescription=r;return this}argParser(t){this.parseArg=t;return this}choices(t){this.argChoices=t.slice();this.parseArg=(t,r)=>{if(!this.argChoices.includes(t)){throw new o(`Allowed choices are ${this.argChoices.join(", ")}.`)}if(this.variadic){return this._concatValue(t,r)}return t};return this}argRequired(){this.required=true;return this}argOptional(){this.required=false;return this}}function humanReadableArgName(t){const r=t.name()+(t.variadic===true?"...":"");return t.required?"<"+r+">":"["+r+"]"}r.Argument=Argument;r.humanReadableArgName=humanReadableArgName},217:(t,r,i)=>{const o=i(8474).EventEmitter;const a=i(1421);const c=i(6760);const l=i(3024);const u=i(1708);const{Argument:h,humanReadableArgName:d}=i(3573);const{CommanderError:p}=i(5246);const{Help:m}=i(5889);const{Option:g,DualOptions:y}=i(8127);const{suggestSimilar:v}=i(3733);class Command extends o{constructor(t){super();this.commands=[];this.options=[];this.parent=null;this._allowUnknownOption=false;this._allowExcessArguments=true;this.registeredArguments=[];this._args=this.registeredArguments;this.args=[];this.rawArgs=[];this.processedArgs=[];this._scriptPath=null;this._name=t||"";this._optionValues={};this._optionValueSources={};this._storeOptionsAsProperties=false;this._actionHandler=null;this._executableHandler=false;this._executableFile=null;this._executableDir=null;this._defaultCommandName=null;this._exitCallback=null;this._aliases=[];this._combineFlagAndOptionalValue=true;this._description="";this._summary="";this._argsDescription=undefined;this._enablePositionalOptions=false;this._passThroughOptions=false;this._lifeCycleHooks={};this._showHelpAfterError=false;this._showSuggestionAfterError=true;this._outputConfiguration={writeOut:t=>u.stdout.write(t),writeErr:t=>u.stderr.write(t),getOutHelpWidth:()=>u.stdout.isTTY?u.stdout.columns:undefined,getErrHelpWidth:()=>u.stderr.isTTY?u.stderr.columns:undefined,outputError:(t,r)=>r(t)};this._hidden=false;this._helpOption=undefined;this._addImplicitHelpCommand=undefined;this._helpCommand=undefined;this._helpConfiguration={}}copyInheritedSettings(t){this._outputConfiguration=t._outputConfiguration;this._helpOption=t._helpOption;this._helpCommand=t._helpCommand;this._helpConfiguration=t._helpConfiguration;this._exitCallback=t._exitCallback;this._storeOptionsAsProperties=t._storeOptionsAsProperties;this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue;this._allowExcessArguments=t._allowExcessArguments;this._enablePositionalOptions=t._enablePositionalOptions;this._showHelpAfterError=t._showHelpAfterError;this._showSuggestionAfterError=t._showSuggestionAfterError;return this}_getCommandAndAncestors(){const t=[];for(let r=this;r;r=r.parent){t.push(r)}return t}command(t,r,i){let o=r;let a=i;if(typeof o==="object"&&o!==null){a=o;o=null}a=a||{};const[,c,l]=t.match(/([^ ]+) *(.*)/);const u=this.createCommand(c);if(o){u.description(o);u._executableHandler=true}if(a.isDefault)this._defaultCommandName=u._name;u._hidden=!!(a.noHelp||a.hidden);u._executableFile=a.executableFile||null;if(l)u.arguments(l);this._registerCommand(u);u.parent=this;u.copyInheritedSettings(this);if(o)return this;return u}createCommand(t){return new Command(t)}createHelp(){return Object.assign(new m,this.configureHelp())}configureHelp(t){if(t===undefined)return this._helpConfiguration;this._helpConfiguration=t;return this}configureOutput(t){if(t===undefined)return this._outputConfiguration;Object.assign(this._outputConfiguration,t);return this}showHelpAfterError(t=true){if(typeof t!=="string")t=!!t;this._showHelpAfterError=t;return this}showSuggestionAfterError(t=true){this._showSuggestionAfterError=!!t;return this}addCommand(t,r){if(!t._name){throw new Error(`Command passed to .addCommand() must have a name\n- specify the name in Command constructor or using .name()`)}r=r||{};if(r.isDefault)this._defaultCommandName=t._name;if(r.noHelp||r.hidden)t._hidden=true;this._registerCommand(t);t.parent=this;t._checkForBrokenPassThrough();return this}createArgument(t,r){return new h(t,r)}argument(t,r,i,o){const a=this.createArgument(t,r);if(typeof i==="function"){a.default(o).argParser(i)}else{a.default(i)}this.addArgument(a);return this}arguments(t){t.trim().split(/ +/).forEach((t=>{this.argument(t)}));return this}addArgument(t){const r=this.registeredArguments.slice(-1)[0];if(r&&r.variadic){throw new Error(`only the last argument can be variadic '${r.name()}'`)}if(t.required&&t.defaultValue!==undefined&&t.parseArg===undefined){throw new Error(`a default value for a required argument is never used: '${t.name()}'`)}this.registeredArguments.push(t);return this}helpCommand(t,r){if(typeof t==="boolean"){this._addImplicitHelpCommand=t;return this}t=t??"help [command]";const[,i,o]=t.match(/([^ ]+) *(.*)/);const a=r??"display help for command";const c=this.createCommand(i);c.helpOption(false);if(o)c.arguments(o);if(a)c.description(a);this._addImplicitHelpCommand=true;this._helpCommand=c;return this}addHelpCommand(t,r){if(typeof t!=="object"){this.helpCommand(t,r);return this}this._addImplicitHelpCommand=true;this._helpCommand=t;return this}_getHelpCommand(){const t=this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"));if(t){if(this._helpCommand===undefined){this.helpCommand(undefined,undefined)}return this._helpCommand}return null}hook(t,r){const i=["preSubcommand","preAction","postAction"];if(!i.includes(t)){throw new Error(`Unexpected value for event passed to hook : '${t}'.\nExpecting one of '${i.join("', '")}'`)}if(this._lifeCycleHooks[t]){this._lifeCycleHooks[t].push(r)}else{this._lifeCycleHooks[t]=[r]}return this}exitOverride(t){if(t){this._exitCallback=t}else{this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync"){throw t}else{}}}return this}_exit(t,r,i){if(this._exitCallback){this._exitCallback(new p(t,r,i))}u.exit(t)}action(t){const listener=r=>{const i=this.registeredArguments.length;const o=r.slice(0,i);if(this._storeOptionsAsProperties){o[i]=this}else{o[i]=this.opts()}o.push(this);return t.apply(this,o)};this._actionHandler=listener;return this}createOption(t,r){return new g(t,r)}_callParseArg(t,r,i,o){try{return t.parseArg(r,i)}catch(t){if(t.code==="commander.invalidArgument"){const r=`${o} ${t.message}`;this.error(r,{exitCode:t.exitCode,code:t.code})}throw t}}_registerOption(t){const r=t.short&&this._findOption(t.short)||t.long&&this._findOption(t.long);if(r){const i=t.long&&this._findOption(t.long)?t.long:t.short;throw new Error(`Cannot add option '${t.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${i}'\n- already used by option '${r.flags}'`)}this.options.push(t)}_registerCommand(t){const knownBy=t=>[t.name()].concat(t.aliases());const r=knownBy(t).find((t=>this._findCommand(t)));if(r){const i=knownBy(this._findCommand(r)).join("|");const o=knownBy(t).join("|");throw new Error(`cannot add command '${o}' as already have command '${i}'`)}this.commands.push(t)}addOption(t){this._registerOption(t);const r=t.name();const i=t.attributeName();if(t.negate){const r=t.long.replace(/^--no-/,"--");if(!this._findOption(r)){this.setOptionValueWithSource(i,t.defaultValue===undefined?true:t.defaultValue,"default")}}else if(t.defaultValue!==undefined){this.setOptionValueWithSource(i,t.defaultValue,"default")}const handleOptionValue=(r,o,a)=>{if(r==null&&t.presetArg!==undefined){r=t.presetArg}const c=this.getOptionValue(i);if(r!==null&&t.parseArg){r=this._callParseArg(t,r,c,o)}else if(r!==null&&t.variadic){r=t._concatValue(r,c)}if(r==null){if(t.negate){r=false}else if(t.isBoolean()||t.optional){r=true}else{r=""}}this.setOptionValueWithSource(i,r,a)};this.on("option:"+r,(r=>{const i=`error: option '${t.flags}' argument '${r}' is invalid.`;handleOptionValue(r,i,"cli")}));if(t.envVar){this.on("optionEnv:"+r,(r=>{const i=`error: option '${t.flags}' value '${r}' from env '${t.envVar}' is invalid.`;handleOptionValue(r,i,"env")}))}return this}_optionEx(t,r,i,o,a){if(typeof r==="object"&&r instanceof g){throw new Error("To add an Option object use addOption() instead of option() or requiredOption()")}const c=this.createOption(r,i);c.makeOptionMandatory(!!t.mandatory);if(typeof o==="function"){c.default(a).argParser(o)}else if(o instanceof RegExp){const t=o;o=(r,i)=>{const o=t.exec(r);return o?o[0]:i};c.default(a).argParser(o)}else{c.default(o)}return this.addOption(c)}option(t,r,i,o){return this._optionEx({},t,r,i,o)}requiredOption(t,r,i,o){return this._optionEx({mandatory:true},t,r,i,o)}combineFlagAndOptionalValue(t=true){this._combineFlagAndOptionalValue=!!t;return this}allowUnknownOption(t=true){this._allowUnknownOption=!!t;return this}allowExcessArguments(t=true){this._allowExcessArguments=!!t;return this}enablePositionalOptions(t=true){this._enablePositionalOptions=!!t;return this}passThroughOptions(t=true){this._passThroughOptions=!!t;this._checkForBrokenPassThrough();return this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions){throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}}storeOptionsAsProperties(t=true){if(this.options.length){throw new Error("call .storeOptionsAsProperties() before adding options")}if(Object.keys(this._optionValues).length){throw new Error("call .storeOptionsAsProperties() before setting option values")}this._storeOptionsAsProperties=!!t;return this}getOptionValue(t){if(this._storeOptionsAsProperties){return this[t]}return this._optionValues[t]}setOptionValue(t,r){return this.setOptionValueWithSource(t,r,undefined)}setOptionValueWithSource(t,r,i){if(this._storeOptionsAsProperties){this[t]=r}else{this._optionValues[t]=r}this._optionValueSources[t]=i;return this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let r;this._getCommandAndAncestors().forEach((i=>{if(i.getOptionValueSource(t)!==undefined){r=i.getOptionValueSource(t)}}));return r}_prepareUserArgs(t,r){if(t!==undefined&&!Array.isArray(t)){throw new Error("first parameter to parse must be array or undefined")}r=r||{};if(t===undefined&&r.from===undefined){if(u.versions?.electron){r.from="electron"}const t=u.execArgv??[];if(t.includes("-e")||t.includes("--eval")||t.includes("-p")||t.includes("--print")){r.from="eval"}}if(t===undefined){t=u.argv}this.rawArgs=t.slice();let i;switch(r.from){case undefined:case"node":this._scriptPath=t[1];i=t.slice(2);break;case"electron":if(u.defaultApp){this._scriptPath=t[1];i=t.slice(2)}else{i=t.slice(1)}break;case"user":i=t.slice(0);break;case"eval":i=t.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);this._name=this._name||"program";return i}parse(t,r){const i=this._prepareUserArgs(t,r);this._parseCommand([],i);return this}async parseAsync(t,r){const i=this._prepareUserArgs(t,r);await this._parseCommand([],i);return this}_executeSubCommand(t,r){r=r.slice();let i=false;const o=[".js",".ts",".tsx",".mjs",".cjs"];function findFile(t,r){const i=c.resolve(t,r);if(l.existsSync(i))return i;if(o.includes(c.extname(r)))return undefined;const a=o.find((t=>l.existsSync(`${i}${t}`)));if(a)return`${i}${a}`;return undefined}this._checkForMissingMandatoryOptions();this._checkForConflictingOptions();let h=t._executableFile||`${this._name}-${t._name}`;let d=this._executableDir||"";if(this._scriptPath){let t;try{t=l.realpathSync(this._scriptPath)}catch(r){t=this._scriptPath}d=c.resolve(c.dirname(t),d)}if(d){let r=findFile(d,h);if(!r&&!t._executableFile&&this._scriptPath){const i=c.basename(this._scriptPath,c.extname(this._scriptPath));if(i!==this._name){r=findFile(d,`${i}-${t._name}`)}}h=r||h}i=o.includes(c.extname(h));let m;if(u.platform!=="win32"){if(i){r.unshift(h);r=incrementNodeInspectorPort(u.execArgv).concat(r);m=a.spawn(u.argv[0],r,{stdio:"inherit"})}else{m=a.spawn(h,r,{stdio:"inherit"})}}else{r.unshift(h);r=incrementNodeInspectorPort(u.execArgv).concat(r);m=a.spawn(u.execPath,r,{stdio:"inherit"})}if(!m.killed){const t=["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"];t.forEach((t=>{u.on(t,(()=>{if(m.killed===false&&m.exitCode===null){m.kill(t)}}))}))}const g=this._exitCallback;m.on("close",(t=>{t=t??1;if(!g){u.exit(t)}else{g(new p(t,"commander.executeSubCommandAsync","(close)"))}}));m.on("error",(r=>{if(r.code==="ENOENT"){const r=d?`searched for local subcommand relative to directory '${d}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory";const i=`'${h}' does not exist\n - if '${t._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\n - if the default executable name is not suitable, use the executableFile option to supply a custom name or path\n - ${r}`;throw new Error(i)}else if(r.code==="EACCES"){throw new Error(`'${h}' not executable`)}if(!g){u.exit(1)}else{const t=new p(1,"commander.executeSubCommandAsync","(error)");t.nestedError=r;g(t)}}));this.runningCommand=m}_dispatchSubcommand(t,r,i){const o=this._findCommand(t);if(!o)this.help({error:true});let a;a=this._chainOrCallSubCommandHook(a,o,"preSubcommand");a=this._chainOrCall(a,(()=>{if(o._executableHandler){this._executeSubCommand(o,r.concat(i))}else{return o._parseCommand(r,i)}}));return a}_dispatchHelpCommand(t){if(!t){this.help()}const r=this._findCommand(t);if(r&&!r._executableHandler){r.help()}return this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach(((t,r)=>{if(t.required&&this.args[r]==null){this.missingArgument(t.name())}}));if(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic){return}if(this.args.length>this.registeredArguments.length){this._excessArguments(this.args)}}_processArguments(){const myParseArg=(t,r,i)=>{let o=r;if(r!==null&&t.parseArg){const a=`error: command-argument value '${r}' is invalid for argument '${t.name()}'.`;o=this._callParseArg(t,r,i,a)}return o};this._checkNumberOfArguments();const t=[];this.registeredArguments.forEach(((r,i)=>{let o=r.defaultValue;if(r.variadic){if(i<this.args.length){o=this.args.slice(i);if(r.parseArg){o=o.reduce(((t,i)=>myParseArg(r,i,t)),r.defaultValue)}}else if(o===undefined){o=[]}}else if(i<this.args.length){o=this.args[i];if(r.parseArg){o=myParseArg(r,o,r.defaultValue)}}t[i]=o}));this.processedArgs=t}_chainOrCall(t,r){if(t&&t.then&&typeof t.then==="function"){return t.then((()=>r()))}return r()}_chainOrCallHooks(t,r){let i=t;const o=[];this._getCommandAndAncestors().reverse().filter((t=>t._lifeCycleHooks[r]!==undefined)).forEach((t=>{t._lifeCycleHooks[r].forEach((r=>{o.push({hookedCommand:t,callback:r})}))}));if(r==="postAction"){o.reverse()}o.forEach((t=>{i=this._chainOrCall(i,(()=>t.callback(t.hookedCommand,this)))}));return i}_chainOrCallSubCommandHook(t,r,i){let o=t;if(this._lifeCycleHooks[i]!==undefined){this._lifeCycleHooks[i].forEach((t=>{o=this._chainOrCall(o,(()=>t(this,r)))}))}return o}_parseCommand(t,r){const i=this.parseOptions(r);this._parseOptionsEnv();this._parseOptionsImplied();t=t.concat(i.operands);r=i.unknown;this.args=t.concat(r);if(t&&this._findCommand(t[0])){return this._dispatchSubcommand(t[0],t.slice(1),r)}if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name()){return this._dispatchHelpCommand(t[1])}if(this._defaultCommandName){this._outputHelpIfRequested(r);return this._dispatchSubcommand(this._defaultCommandName,t,r)}if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName){this.help({error:true})}this._outputHelpIfRequested(i.unknown);this._checkForMissingMandatoryOptions();this._checkForConflictingOptions();const checkForUnknownOptions=()=>{if(i.unknown.length>0){this.unknownOption(i.unknown[0])}};const o=`command:${this.name()}`;if(this._actionHandler){checkForUnknownOptions();this._processArguments();let i;i=this._chainOrCallHooks(i,"preAction");i=this._chainOrCall(i,(()=>this._actionHandler(this.processedArgs)));if(this.parent){i=this._chainOrCall(i,(()=>{this.parent.emit(o,t,r)}))}i=this._chainOrCallHooks(i,"postAction");return i}if(this.parent&&this.parent.listenerCount(o)){checkForUnknownOptions();this._processArguments();this.parent.emit(o,t,r)}else if(t.length){if(this._findCommand("*")){return this._dispatchSubcommand("*",t,r)}if(this.listenerCount("command:*")){this.emit("command:*",t,r)}else if(this.commands.length){this.unknownCommand()}else{checkForUnknownOptions();this._processArguments()}}else if(this.commands.length){checkForUnknownOptions();this.help({error:true})}else{checkForUnknownOptions();this._processArguments()}}_findCommand(t){if(!t)return undefined;return this.commands.find((r=>r._name===t||r._aliases.includes(t)))}_findOption(t){return this.options.find((r=>r.is(t)))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((t=>{t.options.forEach((r=>{if(r.mandatory&&t.getOptionValue(r.attributeName())===undefined){t.missingMandatoryOptionValue(r)}}))}))}_checkForConflictingLocalOptions(){const t=this.options.filter((t=>{const r=t.attributeName();if(this.getOptionValue(r)===undefined){return false}return this.getOptionValueSource(r)!=="default"}));const r=t.filter((t=>t.conflictsWith.length>0));r.forEach((r=>{const i=t.find((t=>r.conflictsWith.includes(t.attributeName())));if(i){this._conflictingOption(r,i)}}))}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((t=>{t._checkForConflictingLocalOptions()}))}parseOptions(t){const r=[];const i=[];let o=r;const a=t.slice();function maybeOption(t){return t.length>1&&t[0]==="-"}let c=null;while(a.length){const t=a.shift();if(t==="--"){if(o===i)o.push(t);o.push(...a);break}if(c&&!maybeOption(t)){this.emit(`option:${c.name()}`,t);continue}c=null;if(maybeOption(t)){const r=this._findOption(t);if(r){if(r.required){const t=a.shift();if(t===undefined)this.optionMissingArgument(r);this.emit(`option:${r.name()}`,t)}else if(r.optional){let t=null;if(a.length>0&&!maybeOption(a[0])){t=a.shift()}this.emit(`option:${r.name()}`,t)}else{this.emit(`option:${r.name()}`)}c=r.variadic?r:null;continue}}if(t.length>2&&t[0]==="-"&&t[1]!=="-"){const r=this._findOption(`-${t[1]}`);if(r){if(r.required||r.optional&&this._combineFlagAndOptionalValue){this.emit(`option:${r.name()}`,t.slice(2))}else{this.emit(`option:${r.name()}`);a.unshift(`-${t.slice(2)}`)}continue}}if(/^--[^=]+=/.test(t)){const r=t.indexOf("=");const i=this._findOption(t.slice(0,r));if(i&&(i.required||i.optional)){this.emit(`option:${i.name()}`,t.slice(r+1));continue}}if(maybeOption(t)){o=i}if((this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&i.length===0){if(this._findCommand(t)){r.push(t);if(a.length>0)i.push(...a);break}else if(this._getHelpCommand()&&t===this._getHelpCommand().name()){r.push(t);if(a.length>0)r.push(...a);break}else if(this._defaultCommandName){i.push(t);if(a.length>0)i.push(...a);break}}if(this._passThroughOptions){o.push(t);if(a.length>0)o.push(...a);break}o.push(t)}return{operands:r,unknown:i}}opts(){if(this._storeOptionsAsProperties){const t={};const r=this.options.length;for(let i=0;i<r;i++){const r=this.options[i].attributeName();t[r]=r===this._versionOptionName?this._version:this[r]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(((t,r)=>Object.assign(t,r.opts())),{})}error(t,r){this._outputConfiguration.outputError(`${t}\n`,this._outputConfiguration.writeErr);if(typeof this._showHelpAfterError==="string"){this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`)}else if(this._showHelpAfterError){this._outputConfiguration.writeErr("\n");this.outputHelp({error:true})}const i=r||{};const o=i.exitCode||1;const a=i.code||"commander.error";this._exit(o,a,t)}_parseOptionsEnv(){this.options.forEach((t=>{if(t.envVar&&t.envVar in u.env){const r=t.attributeName();if(this.getOptionValue(r)===undefined||["default","config","env"].includes(this.getOptionValueSource(r))){if(t.required||t.optional){this.emit(`optionEnv:${t.name()}`,u.env[t.envVar])}else{this.emit(`optionEnv:${t.name()}`)}}}}))}_parseOptionsImplied(){const t=new y(this.options);const hasCustomOptionValue=t=>this.getOptionValue(t)!==undefined&&!["default","implied"].includes(this.getOptionValueSource(t));this.options.filter((r=>r.implied!==undefined&&hasCustomOptionValue(r.attributeName())&&t.valueFromOption(this.getOptionValue(r.attributeName()),r))).forEach((t=>{Object.keys(t.implied).filter((t=>!hasCustomOptionValue(t))).forEach((r=>{this.setOptionValueWithSource(r,t.implied[r],"implied")}))}))}missingArgument(t){const r=`error: missing required argument '${t}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(t){const r=`error: option '${t.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){const r=`error: required option '${t.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,r){const findBestOptionFromValue=t=>{const r=t.attributeName();const i=this.getOptionValue(r);const o=this.options.find((t=>t.negate&&r===t.attributeName()));const a=this.options.find((t=>!t.negate&&r===t.attributeName()));if(o&&(o.presetArg===undefined&&i===false||o.presetArg!==undefined&&i===o.presetArg)){return o}return a||t};const getErrorMessage=t=>{const r=findBestOptionFromValue(t);const i=r.attributeName();const o=this.getOptionValueSource(i);if(o==="env"){return`environment variable '${r.envVar}'`}return`option '${r.flags}'`};const i=`error: ${getErrorMessage(t)} cannot be used with ${getErrorMessage(r)}`;this.error(i,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let r="";if(t.startsWith("--")&&this._showSuggestionAfterError){let i=[];let o=this;do{const t=o.createHelp().visibleOptions(o).filter((t=>t.long)).map((t=>t.long));i=i.concat(t);o=o.parent}while(o&&!o._enablePositionalOptions);r=v(t,i)}const i=`error: unknown option '${t}'${r}`;this.error(i,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;const r=this.registeredArguments.length;const i=r===1?"":"s";const o=this.parent?` for '${this.name()}'`:"";const a=`error: too many arguments${o}. Expected ${r} argument${i} but got ${t.length}.`;this.error(a,{code:"commander.excessArguments"})}unknownCommand(){const t=this.args[0];let r="";if(this._showSuggestionAfterError){const i=[];this.createHelp().visibleCommands(this).forEach((t=>{i.push(t.name());if(t.alias())i.push(t.alias())}));r=v(t,i)}const i=`error: unknown command '${t}'${r}`;this.error(i,{code:"commander.unknownCommand"})}version(t,r,i){if(t===undefined)return this._version;this._version=t;r=r||"-V, --version";i=i||"output the version number";const o=this.createOption(r,i);this._versionOptionName=o.attributeName();this._registerOption(o);this.on("option:"+o.name(),(()=>{this._outputConfiguration.writeOut(`${t}\n`);this._exit(0,"commander.version",t)}));return this}description(t,r){if(t===undefined&&r===undefined)return this._description;this._description=t;if(r){this._argsDescription=r}return this}summary(t){if(t===undefined)return this._summary;this._summary=t;return this}alias(t){if(t===undefined)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler){r=this.commands[this.commands.length-1]}if(t===r._name)throw new Error("Command alias can't be the same as its name");const i=this.parent?._findCommand(t);if(i){const r=[i.name()].concat(i.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${r}'`)}r._aliases.push(t);return this}aliases(t){if(t===undefined)return this._aliases;t.forEach((t=>this.alias(t)));return this}usage(t){if(t===undefined){if(this._usage)return this._usage;const t=this.registeredArguments.map((t=>d(t)));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}this._usage=t;return this}name(t){if(t===undefined)return this._name;this._name=t;return this}nameFromFilename(t){this._name=c.basename(t,c.extname(t));return this}executableDir(t){if(t===undefined)return this._executableDir;this._executableDir=t;return this}helpInformation(t){const r=this.createHelp();if(r.helpWidth===undefined){r.helpWidth=t&&t.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()}return r.formatHelp(this,r)}_getHelpContext(t){t=t||{};const r={error:!!t.error};let i;if(r.error){i=t=>this._outputConfiguration.writeErr(t)}else{i=t=>this._outputConfiguration.writeOut(t)}r.write=t.write||i;r.command=this;return r}outputHelp(t){let r;if(typeof t==="function"){r=t;t=undefined}const i=this._getHelpContext(t);this._getCommandAndAncestors().reverse().forEach((t=>t.emit("beforeAllHelp",i)));this.emit("beforeHelp",i);let o=this.helpInformation(i);if(r){o=r(o);if(typeof o!=="string"&&!Buffer.isBuffer(o)){throw new Error("outputHelp callback must return a string or a Buffer")}}i.write(o);if(this._getHelpOption()?.long){this.emit(this._getHelpOption().long)}this.emit("afterHelp",i);this._getCommandAndAncestors().forEach((t=>t.emit("afterAllHelp",i)))}helpOption(t,r){if(typeof t==="boolean"){if(t){this._helpOption=this._helpOption??undefined}else{this._helpOption=null}return this}t=t??"-h, --help";r=r??"display help for command";this._helpOption=this.createOption(t,r);return this}_getHelpOption(){if(this._helpOption===undefined){this.helpOption(undefined,undefined)}return this._helpOption}addHelpOption(t){this._helpOption=t;return this}help(t){this.outputHelp(t);let r=u.exitCode||0;if(r===0&&t&&typeof t!=="function"&&t.error){r=1}this._exit(r,"commander.help","(outputHelp)")}addHelpText(t,r){const i=["beforeAll","before","after","afterAll"];if(!i.includes(t)){throw new Error(`Unexpected value for position to addHelpText.\nExpecting one of '${i.join("', '")}'`)}const o=`${t}Help`;this.on(o,(t=>{let i;if(typeof r==="function"){i=r({error:t.error,command:t.command})}else{i=r}if(i){t.write(`${i}\n`)}}));return this}_outputHelpIfRequested(t){const r=this._getHelpOption();const i=r&&t.find((t=>r.is(t)));if(i){this.outputHelp();this._exit(0,"commander.helpDisplayed","(outputHelp)")}}}function incrementNodeInspectorPort(t){return t.map((t=>{if(!t.startsWith("--inspect")){return t}let r;let i="127.0.0.1";let o="9229";let a;if((a=t.match(/^(--inspect(-brk)?)$/))!==null){r=a[1]}else if((a=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null){r=a[1];if(/^\d+$/.test(a[3])){o=a[3]}else{i=a[3]}}else if((a=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null){r=a[1];i=a[3];o=a[4]}if(r&&o!=="0"){return`${r}=${i}:${parseInt(o)+1}`}return t}))}r.Command=Command},5246:(t,r)=>{class CommanderError extends Error{constructor(t,r,i){super(i);Error.captureStackTrace(this,this.constructor);this.name=this.constructor.name;this.code=r;this.exitCode=t;this.nestedError=undefined}}class InvalidArgumentError extends CommanderError{constructor(t){super(1,"commander.invalidArgument",t);Error.captureStackTrace(this,this.constructor);this.name=this.constructor.name}}r.CommanderError=CommanderError;r.InvalidArgumentError=InvalidArgumentError},5889:(t,r,i)=>{const{humanReadableArgName:o}=i(3573);class Help{constructor(){this.helpWidth=undefined;this.sortSubcommands=false;this.sortOptions=false;this.showGlobalOptions=false}visibleCommands(t){const r=t.commands.filter((t=>!t._hidden));const i=t._getHelpCommand();if(i&&!i._hidden){r.push(i)}if(this.sortSubcommands){r.sort(((t,r)=>t.name().localeCompare(r.name())))}return r}compareOptions(t,r){const getSortKey=t=>t.short?t.short.replace(/^-/,""):t.long.replace(/^--/,"");return getSortKey(t).localeCompare(getSortKey(r))}visibleOptions(t){const r=t.options.filter((t=>!t.hidden));const i=t._getHelpOption();if(i&&!i.hidden){const o=i.short&&t._findOption(i.short);const a=i.long&&t._findOption(i.long);if(!o&&!a){r.push(i)}else if(i.long&&!a){r.push(t.createOption(i.long,i.description))}else if(i.short&&!o){r.push(t.createOption(i.short,i.description))}}if(this.sortOptions){r.sort(this.compareOptions)}return r}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];const r=[];for(let i=t.parent;i;i=i.parent){const t=i.options.filter((t=>!t.hidden));r.push(...t)}if(this.sortOptions){r.sort(this.compareOptions)}return r}visibleArguments(t){if(t._argsDescription){t.registeredArguments.forEach((r=>{r.description=r.description||t._argsDescription[r.name()]||""}))}if(t.registeredArguments.find((t=>t.description))){return t.registeredArguments}return[]}subcommandTerm(t){const r=t.registeredArguments.map((t=>o(t))).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,r){return r.visibleCommands(t).reduce(((t,i)=>Math.max(t,r.subcommandTerm(i).length)),0)}longestOptionTermLength(t,r){return r.visibleOptions(t).reduce(((t,i)=>Math.max(t,r.optionTerm(i).length)),0)}longestGlobalOptionTermLength(t,r){return r.visibleGlobalOptions(t).reduce(((t,i)=>Math.max(t,r.optionTerm(i).length)),0)}longestArgumentTermLength(t,r){return r.visibleArguments(t).reduce(((t,i)=>Math.max(t,r.argumentTerm(i).length)),0)}commandUsage(t){let r=t._name;if(t._aliases[0]){r=r+"|"+t._aliases[0]}let i="";for(let r=t.parent;r;r=r.parent){i=r.name()+" "+i}return i+r+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){const r=[];if(t.argChoices){r.push(`choices: ${t.argChoices.map((t=>JSON.stringify(t))).join(", ")}`)}if(t.defaultValue!==undefined){const i=t.required||t.optional||t.isBoolean()&&typeof t.defaultValue==="boolean";if(i){r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`)}}if(t.presetArg!==undefined&&t.optional){r.push(`preset: ${JSON.stringify(t.presetArg)}`)}if(t.envVar!==undefined){r.push(`env: ${t.envVar}`)}if(r.length>0){return`${t.description} (${r.join(", ")})`}return t.description}argumentDescription(t){const r=[];if(t.argChoices){r.push(`choices: ${t.argChoices.map((t=>JSON.stringify(t))).join(", ")}`)}if(t.defaultValue!==undefined){r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`)}if(r.length>0){const i=`(${r.join(", ")})`;if(t.description){return`${t.description} ${i}`}return i}return t.description}formatHelp(t,r){const i=r.padWidth(t,r);const o=r.helpWidth||80;const a=2;const c=2;function formatItem(t,l){if(l){const u=`${t.padEnd(i+c)}${l}`;return r.wrap(u,o-a,i+c)}return t}function formatList(t){return t.join("\n").replace(/^/gm," ".repeat(a))}let l=[`Usage: ${r.commandUsage(t)}`,""];const u=r.commandDescription(t);if(u.length>0){l=l.concat([r.wrap(u,o,0),""])}const h=r.visibleArguments(t).map((t=>formatItem(r.argumentTerm(t),r.argumentDescription(t))));if(h.length>0){l=l.concat(["Arguments:",formatList(h),""])}const d=r.visibleOptions(t).map((t=>formatItem(r.optionTerm(t),r.optionDescription(t))));if(d.length>0){l=l.concat(["Options:",formatList(d),""])}if(this.showGlobalOptions){const i=r.visibleGlobalOptions(t).map((t=>formatItem(r.optionTerm(t),r.optionDescription(t))));if(i.length>0){l=l.concat(["Global Options:",formatList(i),""])}}const p=r.visibleCommands(t).map((t=>formatItem(r.subcommandTerm(t),r.subcommandDescription(t))));if(p.length>0){l=l.concat(["Commands:",formatList(p),""])}return l.join("\n")}padWidth(t,r){return Math.max(r.longestOptionTermLength(t,r),r.longestGlobalOptionTermLength(t,r),r.longestSubcommandTermLength(t,r),r.longestArgumentTermLength(t,r))}wrap(t,r,i,o=40){const a=" \\f\\t\\v - \ufeff";const c=new RegExp(`[\\n][${a}]+`);if(t.match(c))return t;const l=r-i;if(l<o)return t;const u=t.slice(0,i);const h=t.slice(i).replace("\r\n","\n");const d=" ".repeat(i);const p="";const m=`\\s${p}`;const g=new RegExp(`\n|.{1,${l-1}}([${m}]|$)|[^${m}]+?([${m}]|$)`,"g");const y=h.match(g)||[];return u+y.map(((t,r)=>{if(t==="\n")return"";return(r>0?d:"")+t.trimEnd()})).join("\n")}}r.Help=Help},8127:(t,r,i)=>{const{InvalidArgumentError:o}=i(5246);class Option{constructor(t,r){this.flags=t;this.description=r||"";this.required=t.includes("<");this.optional=t.includes("[");this.variadic=/\w\.\.\.[>\]]$/.test(t);this.mandatory=false;const i=splitOptionFlags(t);this.short=i.shortFlag;this.long=i.longFlag;this.negate=false;if(this.long){this.negate=this.long.startsWith("--no-")}this.defaultValue=undefined;this.defaultValueDescription=undefined;this.presetArg=undefined;this.envVar=undefined;this.parseArg=undefined;this.hidden=false;this.argChoices=undefined;this.conflictsWith=[];this.implied=undefined}default(t,r){this.defaultValue=t;this.defaultValueDescription=r;return this}preset(t){this.presetArg=t;return this}conflicts(t){this.conflictsWith=this.conflictsWith.concat(t);return this}implies(t){let r=t;if(typeof t==="string"){r={[t]:true}}this.implied=Object.assign(this.implied||{},r);return this}env(t){this.envVar=t;return this}argParser(t){this.parseArg=t;return this}makeOptionMandatory(t=true){this.mandatory=!!t;return this}hideHelp(t=true){this.hidden=!!t;return this}_concatValue(t,r){if(r===this.defaultValue||!Array.isArray(r)){return[t]}return r.concat(t)}choices(t){this.argChoices=t.slice();this.parseArg=(t,r)=>{if(!this.argChoices.includes(t)){throw new o(`Allowed choices are ${this.argChoices.join(", ")}.`)}if(this.variadic){return this._concatValue(t,r)}return t};return this}name(){if(this.long){return this.long.replace(/^--/,"")}return this.short.replace(/^-/,"")}attributeName(){return camelcase(this.name().replace(/^no-/,""))}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class DualOptions{constructor(t){this.positiveOptions=new Map;this.negativeOptions=new Map;this.dualOptions=new Set;t.forEach((t=>{if(t.negate){this.negativeOptions.set(t.attributeName(),t)}else{this.positiveOptions.set(t.attributeName(),t)}}));this.negativeOptions.forEach(((t,r)=>{if(this.positiveOptions.has(r)){this.dualOptions.add(r)}}))}valueFromOption(t,r){const i=r.attributeName();if(!this.dualOptions.has(i))return true;const o=this.negativeOptions.get(i).presetArg;const a=o!==undefined?o:false;return r.negate===(a===t)}}function camelcase(t){return t.split("-").reduce(((t,r)=>t+r[0].toUpperCase()+r.slice(1)))}function splitOptionFlags(t){let r;let i;const o=t.split(/[ |,]+/);if(o.length>1&&!/^[[<]/.test(o[1]))r=o.shift();i=o.shift();if(!r&&/^-[^-]$/.test(i)){r=i;i=undefined}return{shortFlag:r,longFlag:i}}r.Option=Option;r.DualOptions=DualOptions},3733:(t,r)=>{const i=3;function editDistance(t,r){if(Math.abs(t.length-r.length)>i)return Math.max(t.length,r.length);const o=[];for(let r=0;r<=t.length;r++){o[r]=[r]}for(let t=0;t<=r.length;t++){o[0][t]=t}for(let i=1;i<=r.length;i++){for(let a=1;a<=t.length;a++){let c=1;if(t[a-1]===r[i-1]){c=0}else{c=1}o[a][i]=Math.min(o[a-1][i]+1,o[a][i-1]+1,o[a-1][i-1]+c);if(a>1&&i>1&&t[a-1]===r[i-2]&&t[a-2]===r[i-1]){o[a][i]=Math.min(o[a][i],o[a-2][i-2]+1)}}}return o[t.length][r.length]}function suggestSimilar(t,r){if(!r||r.length===0)return"";r=Array.from(new Set(r));const o=t.startsWith("--");if(o){t=t.slice(2);r=r.map((t=>t.slice(2)))}let a=[];let c=i;const l=.4;r.forEach((r=>{if(r.length<=1)return;const i=editDistance(t,r);const o=Math.max(t.length,r.length);const u=(o-i)/o;if(u>l){if(i<c){c=i;a=[r]}else if(i===c){a.push(r)}}}));a.sort(((t,r)=>t.localeCompare(r)));if(o){a=a.map((t=>`--${t}`))}if(a.length>1){return`\n(Did you mean one of ${a.join(", ")}?)`}if(a.length===1){return`\n(Did you mean ${a[0]}?)`}return""}r.suggestSimilar=suggestSimilar},2387:(t,r,i)=>{"use strict";const{normalizeIPv6:o,normalizeIPv4:a,removeDotSegments:c,recomposeAuthority:l,normalizeComponentEncoding:u}=i(3918);const h=i(7475);function normalize(t,r){if(typeof t==="string"){t=serialize(parse(t,r),r)}else if(typeof t==="object"){t=parse(serialize(t,r),r)}return t}function resolve(t,r,i){const o=Object.assign({scheme:"null"},i);const a=resolveComponents(parse(t,o),parse(r,o),o,true);return serialize(a,{...o,skipEscape:true})}function resolveComponents(t,r,i,o){const a={};if(!o){t=parse(serialize(t,i),i);r=parse(serialize(r,i),i)}i=i||{};if(!i.tolerant&&r.scheme){a.scheme=r.scheme;a.userinfo=r.userinfo;a.host=r.host;a.port=r.port;a.path=c(r.path||"");a.query=r.query}else{if(r.userinfo!==undefined||r.host!==undefined||r.port!==undefined){a.userinfo=r.userinfo;a.host=r.host;a.port=r.port;a.path=c(r.path||"");a.query=r.query}else{if(!r.path){a.path=t.path;if(r.query!==undefined){a.query=r.query}else{a.query=t.query}}else{if(r.path.charAt(0)==="/"){a.path=c(r.path)}else{if((t.userinfo!==undefined||t.host!==undefined||t.port!==undefined)&&!t.path){a.path="/"+r.path}else if(!t.path){a.path=r.path}else{a.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+r.path}a.path=c(a.path)}a.query=r.query}a.userinfo=t.userinfo;a.host=t.host;a.port=t.port}a.scheme=t.scheme}a.fragment=r.fragment;return a}function equal(t,r,i){if(typeof t==="string"){t=unescape(t);t=serialize(u(parse(t,i),true),{...i,skipEscape:true})}else if(typeof t==="object"){t=serialize(u(t,true),{...i,skipEscape:true})}if(typeof r==="string"){r=unescape(r);r=serialize(u(parse(r,i),true),{...i,skipEscape:true})}else if(typeof r==="object"){r=serialize(u(r,true),{...i,skipEscape:true})}return t.toLowerCase()===r.toLowerCase()}function serialize(t,r){const i={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""};const o=Object.assign({},r);const a=[];const u=h[(o.scheme||i.scheme||"").toLowerCase()];if(u&&u.serialize)u.serialize(i,o);if(i.path!==undefined){if(!o.skipEscape){i.path=escape(i.path);if(i.scheme!==undefined){i.path=i.path.split("%3A").join(":")}}else{i.path=unescape(i.path)}}if(o.reference!=="suffix"&&i.scheme){a.push(i.scheme,":")}const d=l(i);if(d!==undefined){if(o.reference!=="suffix"){a.push("//")}a.push(d);if(i.path&&i.path.charAt(0)!=="/"){a.push("/")}}if(i.path!==undefined){let t=i.path;if(!o.absolutePath&&(!u||!u.absolutePath)){t=c(t)}if(d===undefined){t=t.replace(/^\/\//u,"/%2F")}a.push(t)}if(i.query!==undefined){a.push("?",i.query)}if(i.fragment!==undefined){a.push("#",i.fragment)}return a.join("")}const d=Array.from({length:127},((t,r)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(r))));function nonSimpleDomain(t){let r=0;for(let i=0,o=t.length;i<o;++i){r=t.charCodeAt(i);if(r>126||d[r]){return true}}return false}const p=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function parse(t,r){const i=Object.assign({},r);const c={scheme:undefined,userinfo:undefined,host:"",port:undefined,path:"",query:undefined,fragment:undefined};const l=t.indexOf("%")!==-1;let u=false;if(i.reference==="suffix")t=(i.scheme?i.scheme+":":"")+"//"+t;const d=t.match(p);if(d){c.scheme=d[1];c.userinfo=d[3];c.host=d[4];c.port=parseInt(d[5],10);c.path=d[6]||"";c.query=d[7];c.fragment=d[8];if(isNaN(c.port)){c.port=d[5]}if(c.host){const t=a(c.host);if(t.isIPV4===false){const r=o(t.host);c.host=r.host.toLowerCase();u=r.isIPV6}else{c.host=t.host;u=true}}if(c.scheme===undefined&&c.userinfo===undefined&&c.host===undefined&&c.port===undefined&&c.query===undefined&&!c.path){c.reference="same-document"}else if(c.scheme===undefined){c.reference="relative"}else if(c.fragment===undefined){c.reference="absolute"}else{c.reference="uri"}if(i.reference&&i.reference!=="suffix"&&i.reference!==c.reference){c.error=c.error||"URI is not a "+i.reference+" reference."}const t=h[(i.scheme||c.scheme||"").toLowerCase()];if(!i.unicodeSupport&&(!t||!t.unicodeSupport)){if(c.host&&(i.domainHost||t&&t.domainHost)&&u===false&&nonSimpleDomain(c.host)){try{c.host=URL.domainToASCII(c.host.toLowerCase())}catch(t){c.error=c.error||"Host's domain name can not be converted to ASCII: "+t}}}if(!t||t&&!t.skipNormalize){if(l&&c.scheme!==undefined){c.scheme=unescape(c.scheme)}if(l&&c.host!==undefined){c.host=unescape(c.host)}if(c.path){c.path=escape(unescape(c.path))}if(c.fragment){c.fragment=encodeURI(decodeURIComponent(c.fragment))}}if(t&&t.parse){t.parse(c,i)}}else{c.error=c.error||"URI can not be parsed."}return c}const m={SCHEMES:h,normalize:normalize,resolve:resolve,resolveComponents:resolveComponents,equal:equal,serialize:serialize,parse:parse};t.exports=m;t.exports["default"]=m;t.exports.fastUri=m},7475:t=>{"use strict";const r=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu;const i=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function isSecure(t){return typeof t.secure==="boolean"?t.secure:String(t.scheme).toLowerCase()==="wss"}function httpParse(t){if(!t.host){t.error=t.error||"HTTP URIs must have a host."}return t}function httpSerialize(t){const r=String(t.scheme).toLowerCase()==="https";if(t.port===(r?443:80)||t.port===""){t.port=undefined}if(!t.path){t.path="/"}return t}function wsParse(t){t.secure=isSecure(t);t.resourceName=(t.path||"/")+(t.query?"?"+t.query:"");t.path=undefined;t.query=undefined;return t}function wsSerialize(t){if(t.port===(isSecure(t)?443:80)||t.port===""){t.port=undefined}if(typeof t.secure==="boolean"){t.scheme=t.secure?"wss":"ws";t.secure=undefined}if(t.resourceName){const[r,i]=t.resourceName.split("?");t.path=r&&r!=="/"?r:undefined;t.query=i;t.resourceName=undefined}t.fragment=undefined;return t}function urnParse(t,r){if(!t.path){t.error="URN can not be parsed";return t}const o=t.path.match(i);if(o){const i=r.scheme||t.scheme||"urn";t.nid=o[1].toLowerCase();t.nss=o[2];const a=`${i}:${r.nid||t.nid}`;const c=d[a];t.path=undefined;if(c){t=c.parse(t,r)}}else{t.error=t.error||"URN can not be parsed."}return t}function urnSerialize(t,r){const i=r.scheme||t.scheme||"urn";const o=t.nid.toLowerCase();const a=`${i}:${r.nid||o}`;const c=d[a];if(c){t=c.serialize(t,r)}const l=t;const u=t.nss;l.path=`${o||r.nid}:${u}`;r.skipEscape=true;return l}function urnuuidParse(t,i){const o=t;o.uuid=o.nss;o.nss=undefined;if(!i.tolerant&&(!o.uuid||!r.test(o.uuid))){o.error=o.error||"UUID is not valid."}return o}function urnuuidSerialize(t){const r=t;r.nss=(t.uuid||"").toLowerCase();return r}const o={scheme:"http",domainHost:true,parse:httpParse,serialize:httpSerialize};const a={scheme:"https",domainHost:o.domainHost,parse:httpParse,serialize:httpSerialize};const c={scheme:"ws",domainHost:true,parse:wsParse,serialize:wsSerialize};const l={scheme:"wss",domainHost:c.domainHost,parse:c.parse,serialize:c.serialize};const u={scheme:"urn",parse:urnParse,serialize:urnSerialize,skipNormalize:true};const h={scheme:"urn:uuid",parse:urnuuidParse,serialize:urnuuidSerialize,skipNormalize:true};const d={http:o,https:a,ws:c,wss:l,urn:u,"urn:uuid":h};t.exports=d},6046:t=>{"use strict";const r={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};t.exports={HEX:r}},3918:(t,r,i)=>{"use strict";const{HEX:o}=i(6046);const a=/^(?:(?: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 normalizeIPv4(t){if(findToken(t,".")<3){return{host:t,isIPV4:false}}const r=t.match(a)||[];const[i]=r;if(i){return{host:stripLeadingZeros(i,"."),isIPV4:true}}else{return{host:t,isIPV4:false}}}function stringArrayToHexStripped(t,r=false){let i="";let a=true;for(const r of t){if(o[r]===undefined)return undefined;if(r!=="0"&&a===true)a=false;if(!a)i+=r}if(r&&i.length===0)i="0";return i}function getIPV6(t){let r=0;const i={error:false,address:"",zone:""};const o=[];const a=[];let c=false;let l=false;let u=false;function consume(){if(a.length){if(c===false){const t=stringArrayToHexStripped(a);if(t!==undefined){o.push(t)}else{i.error=true;return false}}a.length=0}return true}for(let h=0;h<t.length;h++){const d=t[h];if(d==="["||d==="]"){continue}if(d===":"){if(l===true){u=true}if(!consume()){break}r++;o.push(":");if(r>7){i.error=true;break}if(h-1>=0&&t[h-1]===":"){l=true}continue}else if(d==="%"){if(!consume()){break}c=true}else{a.push(d);continue}}if(a.length){if(c){i.zone=a.join("")}else if(u){o.push(a.join(""))}else{o.push(stringArrayToHexStripped(a))}}i.address=o.join("");return i}function normalizeIPv6(t){if(findToken(t,":")<2){return{host:t,isIPV6:false}}const r=getIPV6(t);if(!r.error){let t=r.address;let i=r.address;if(r.zone){t+="%"+r.zone;i+="%25"+r.zone}return{host:t,escapedHost:i,isIPV6:true}}else{return{host:t,isIPV6:false}}}function stripLeadingZeros(t,r){let i="";let o=true;const a=t.length;for(let c=0;c<a;c++){const l=t[c];if(l==="0"&&o){if(c+1<=a&&t[c+1]===r||c+1===a){i+=l;o=false}}else{if(l===r){o=true}else{o=false}i+=l}}return i}function findToken(t,r){let i=0;for(let o=0;o<t.length;o++){if(t[o]===r)i++}return i}const c=/^\.\.?\//u;const l=/^\/\.(?:\/|$)/u;const u=/^\/\.\.(?:\/|$)/u;const h=/^\/?(?:.|\n)*?(?=\/|$)/u;function removeDotSegments(t){const r=[];while(t.length){if(t.match(c)){t=t.replace(c,"")}else if(t.match(l)){t=t.replace(l,"/")}else if(t.match(u)){t=t.replace(u,"/");r.pop()}else if(t==="."||t===".."){t=""}else{const i=t.match(h);if(i){const o=i[0];t=t.slice(o.length);r.push(o)}else{throw new Error("Unexpected dot segment condition")}}}return r.join("")}function normalizeComponentEncoding(t,r){const i=r!==true?escape:unescape;if(t.scheme!==undefined){t.scheme=i(t.scheme)}if(t.userinfo!==undefined){t.userinfo=i(t.userinfo)}if(t.host!==undefined){t.host=i(t.host)}if(t.path!==undefined){t.path=i(t.path)}if(t.query!==undefined){t.query=i(t.query)}if(t.fragment!==undefined){t.fragment=i(t.fragment)}return t}function recomposeAuthority(t){const r=[];if(t.userinfo!==undefined){r.push(t.userinfo);r.push("@")}if(t.host!==undefined){let i=unescape(t.host);const o=normalizeIPv4(i);if(o.isIPV4){i=o.host}else{const r=normalizeIPv6(o.host);if(r.isIPV6===true){i=`[${r.escapedHost}]`}else{i=t.host}}r.push(i)}if(typeof t.port==="number"||typeof t.port==="string"){r.push(":");r.push(String(t.port))}return r.length?r.join(""):undefined}t.exports={recomposeAuthority:recomposeAuthority,normalizeComponentEncoding:normalizeComponentEncoding,removeDotSegments:removeDotSegments,normalizeIPv4:normalizeIPv4,normalizeIPv6:normalizeIPv6,stringArrayToHexStripped:stringArrayToHexStripped}},3837:t=>{"use strict";t.exports=JSON.parse('{"$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":false}')},7216:t=>{"use strict";t.exports=JSON.parse('{"$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":true},"$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"}}}}')},8226:t=>{"use strict";t.exports=JSON.parse('{"$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":true},"$dynamicAnchor":"meta","title":"Content vocabulary meta-schema","type":["object","boolean"],"properties":{"contentEncoding":{"type":"string"},"contentMediaType":{"type":"string"},"contentSchema":{"$dynamicRef":"#meta"}}}')},518:t=>{"use strict";t.exports=JSON.parse('{"$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":true},"$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"}}}')},4588:t=>{"use strict";t.exports=JSON.parse('{"$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":true},"$dynamicAnchor":"meta","title":"Format vocabulary meta-schema for annotation results","type":["object","boolean"],"properties":{"format":{"type":"string"}}}')},5707:t=>{"use strict";t.exports=JSON.parse('{"$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":true},"$dynamicAnchor":"meta","title":"Meta-data vocabulary meta-schema","type":["object","boolean"],"properties":{"title":{"type":"string"},"description":{"type":"string"},"default":true,"deprecated":{"type":"boolean","default":false},"readOnly":{"type":"boolean","default":false},"writeOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true}}}')},9547:t=>{"use strict";t.exports=JSON.parse('{"$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":true},"$dynamicAnchor":"meta","title":"Unevaluated applicator vocabulary meta-schema","type":["object","boolean"],"properties":{"unevaluatedItems":{"$dynamicRef":"#meta"},"unevaluatedProperties":{"$dynamicRef":"#meta"}}}')},7082:t=>{"use strict";t.exports=JSON.parse('{"$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":true},"$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":true}]},"const":true,"enum":{"type":"array","items":true},"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":false},"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":true,"default":[]}}}')},1678:t=>{"use strict";t.exports=JSON.parse('{"$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":true,"https://json-schema.org/draft/2020-12/vocab/applicator":true,"https://json-schema.org/draft/2020-12/vocab/unevaluated":true,"https://json-schema.org/draft/2020-12/vocab/validation":true,"https://json-schema.org/draft/2020-12/vocab/meta-data":true,"https://json-schema.org/draft/2020-12/vocab/format-annotation":true,"https://json-schema.org/draft/2020-12/vocab/content":true},"$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":true,"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":true,"default":{}},"$recursiveAnchor":{"$comment":"\\"$recursiveAnchor\\" has been replaced by \\"$dynamicAnchor\\".","$ref":"meta/core#/$defs/anchorString","deprecated":true},"$recursiveRef":{"$comment":"\\"$recursiveRef\\" has been replaced by \\"$dynamicRef\\".","$ref":"meta/core#/$defs/uriReferenceString","deprecated":true}}}')},2079:t=>{"use strict";t.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}')},2040:t=>{"use strict";t.exports=JSON.parse('[{"name":"Agola CI","constant":"AGOLA","env":"AGOLA_GIT_REF","pr":"AGOLA_PULL_REQUEST_ID"},{"name":"Appcircle","constant":"APPCIRCLE","env":"AC_APPCIRCLE"},{"name":"AppVeyor","constant":"APPVEYOR","env":"APPVEYOR","pr":"APPVEYOR_PULL_REQUEST_NUMBER"},{"name":"AWS CodeBuild","constant":"CODEBUILD","env":"CODEBUILD_BUILD_ARN"},{"name":"Azure Pipelines","constant":"AZURE_PIPELINES","env":"TF_BUILD","pr":{"BUILD_REASON":"PullRequest"}},{"name":"Bamboo","constant":"BAMBOO","env":"bamboo_planKey"},{"name":"Bitbucket Pipelines","constant":"BITBUCKET","env":"BITBUCKET_COMMIT","pr":"BITBUCKET_PR_ID"},{"name":"Bitrise","constant":"BITRISE","env":"BITRISE_IO","pr":"BITRISE_PULL_REQUEST"},{"name":"Buddy","constant":"BUDDY","env":"BUDDY_WORKSPACE_ID","pr":"BUDDY_EXECUTION_PULL_REQUEST_ID"},{"name":"Buildkite","constant":"BUILDKITE","env":"BUILDKITE","pr":{"env":"BUILDKITE_PULL_REQUEST","ne":"false"}},{"name":"CircleCI","constant":"CIRCLE","env":"CIRCLECI","pr":"CIRCLE_PULL_REQUEST"},{"name":"Cirrus CI","constant":"CIRRUS","env":"CIRRUS_CI","pr":"CIRRUS_PR"},{"name":"Codefresh","constant":"CODEFRESH","env":"CF_BUILD_ID","pr":{"any":["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{"name":"Codemagic","constant":"CODEMAGIC","env":"CM_BUILD_ID","pr":"CM_PULL_REQUEST"},{"name":"Codeship","constant":"CODESHIP","env":{"CI_NAME":"codeship"}},{"name":"Drone","constant":"DRONE","env":"DRONE","pr":{"DRONE_BUILD_EVENT":"pull_request"}},{"name":"dsari","constant":"DSARI","env":"DSARI"},{"name":"Earthly","constant":"EARTHLY","env":"EARTHLY_CI"},{"name":"Expo Application Services","constant":"EAS","env":"EAS_BUILD"},{"name":"Gerrit","constant":"GERRIT","env":"GERRIT_PROJECT"},{"name":"Gitea Actions","constant":"GITEA_ACTIONS","env":"GITEA_ACTIONS"},{"name":"GitHub Actions","constant":"GITHUB_ACTIONS","env":"GITHUB_ACTIONS","pr":{"GITHUB_EVENT_NAME":"pull_request"}},{"name":"GitLab CI","constant":"GITLAB","env":"GITLAB_CI","pr":"CI_MERGE_REQUEST_ID"},{"name":"GoCD","constant":"GOCD","env":"GO_PIPELINE_LABEL"},{"name":"Google Cloud Build","constant":"GOOGLE_CLOUD_BUILD","env":"BUILDER_OUTPUT"},{"name":"Harness CI","constant":"HARNESS","env":"HARNESS_BUILD_ID"},{"name":"Heroku","constant":"HEROKU","env":{"env":"NODE","includes":"/app/.heroku/node/bin/node"}},{"name":"Hudson","constant":"HUDSON","env":"HUDSON_URL"},{"name":"Jenkins","constant":"JENKINS","env":["JENKINS_URL","BUILD_ID"],"pr":{"any":["ghprbPullId","CHANGE_ID"]}},{"name":"LayerCI","constant":"LAYERCI","env":"LAYERCI","pr":"LAYERCI_PULL_REQUEST"},{"name":"Magnum CI","constant":"MAGNUM","env":"MAGNUM"},{"name":"Netlify CI","constant":"NETLIFY","env":"NETLIFY","pr":{"env":"PULL_REQUEST","ne":"false"}},{"name":"Nevercode","constant":"NEVERCODE","env":"NEVERCODE","pr":{"env":"NEVERCODE_PULL_REQUEST","ne":"false"}},{"name":"Prow","constant":"PROW","env":"PROW_JOB_ID"},{"name":"ReleaseHub","constant":"RELEASEHUB","env":"RELEASE_BUILD_ID"},{"name":"Render","constant":"RENDER","env":"RENDER","pr":{"IS_PULL_REQUEST":"true"}},{"name":"Sail CI","constant":"SAIL","env":"SAILCI","pr":"SAIL_PULL_REQUEST_NUMBER"},{"name":"Screwdriver","constant":"SCREWDRIVER","env":"SCREWDRIVER","pr":{"env":"SD_PULL_REQUEST","ne":"false"}},{"name":"Semaphore","constant":"SEMAPHORE","env":"SEMAPHORE","pr":"PULL_REQUEST_NUMBER"},{"name":"Sourcehut","constant":"SOURCEHUT","env":{"CI_NAME":"sourcehut"}},{"name":"Strider CD","constant":"STRIDER","env":"STRIDER"},{"name":"TaskCluster","constant":"TASKCLUSTER","env":["TASK_ID","RUN_ID"]},{"name":"TeamCity","constant":"TEAMCITY","env":"TEAMCITY_VERSION"},{"name":"Travis CI","constant":"TRAVIS","env":"TRAVIS","pr":{"env":"TRAVIS_PULL_REQUEST","ne":"false"}},{"name":"Vela","constant":"VELA","env":"VELA","pr":{"VELA_PULL_REQUEST":"1"}},{"name":"Vercel","constant":"VERCEL","env":{"any":["NOW_BUILDER","VERCEL"]},"pr":"VERCEL_GIT_PULL_REQUEST_ID"},{"name":"Visual Studio App Center","constant":"APPCENTER","env":"APPCENTER_BUILD_ID"},{"name":"Woodpecker","constant":"WOODPECKER","env":{"CI":"woodpecker"},"pr":{"CI_BUILD_EVENT":"pull_request"}},{"name":"Xcode Cloud","constant":"XCODE_CLOUD","env":"CI_XCODE_PROJECT","pr":"CI_PULL_REQUEST_NUMBER"},{"name":"Xcode Server","constant":"XCODE_SERVER","env":"XCS"}]')}};var r={};function __nccwpck_require__(i){var o=r[i];if(o!==undefined){return o.exports}var a=r[i]={exports:{}};var c=true;try{t[i](a,a.exports,__nccwpck_require__);c=false}finally{if(c)delete r[i]}return a.exports}(()=>{__nccwpck_require__.n=t=>{var r=t&&t.__esModule?()=>t["default"]:()=>t;__nccwpck_require__.d(r,{a:r});return r}})();(()=>{__nccwpck_require__.d=(t,r)=>{for(var i in r){if(__nccwpck_require__.o(r,i)&&!__nccwpck_require__.o(t,i)){Object.defineProperty(t,i,{enumerable:true,get:r[i]})}}}})();(()=>{__nccwpck_require__.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r)})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var i={};(()=>{"use strict";var t=__nccwpck_require__(9896);var r=__nccwpck_require__(6928);var i=__nccwpck_require__.n(r);var o=__nccwpck_require__(7362);var a=__nccwpck_require__.n(o);var c=__nccwpck_require__(7944);const{DM:l,gu:u,er:h,Ww:d,b7:p,Di:m,a2:g,uB:y,ef:v,c$:b,_V:w}=c;const E=require("node:util");var S=__nccwpck_require__(1708);var $=__nccwpck_require__(3024);var R=__nccwpck_require__(6760);const P=require("node:crypto");const O=require("node:assert");const isObject=t=>{const r=typeof t;return t!==null&&(r==="object"||r==="function")};const isEmptyObject=t=>isObject(t)&&Object.keys(t).length===0;const A=new Set(["__proto__","prototype","constructor"]);const x=new Set("0123456789");function getPathSegments(t){const r=[];let i="";let o="start";let a=false;for(const c of t){switch(c){case"\\":{if(o==="index"){throw new Error("Invalid character in an index")}if(o==="indexEnd"){throw new Error("Invalid character after an index")}if(a){i+=c}o="property";a=!a;break}case".":{if(o==="index"){throw new Error("Invalid character in an index")}if(o==="indexEnd"){o="property";break}if(a){a=false;i+=c;break}if(A.has(i)){return[]}r.push(i);i="";o="property";break}case"[":{if(o==="index"){throw new Error("Invalid character in an index")}if(o==="indexEnd"){o="index";break}if(a){a=false;i+=c;break}if(o==="property"){if(A.has(i)){return[]}r.push(i);i=""}o="index";break}case"]":{if(o==="index"){r.push(Number.parseInt(i,10));i="";o="indexEnd";break}if(o==="indexEnd"){throw new Error("Invalid character after an index")}}default:{if(o==="index"&&!x.has(c)){throw new Error("Invalid character in an index")}if(o==="indexEnd"){throw new Error("Invalid character after an index")}if(o==="start"){o="property"}if(a){a=false;i+="\\"}i+=c}}}if(a){i+="\\"}switch(o){case"property":{if(A.has(i)){return[]}r.push(i);break}case"index":{throw new Error("Index was not closed")}case"start":{r.push("");break}}return r}function isStringIndex(t,r){if(typeof r!=="number"&&Array.isArray(t)){const i=Number.parseInt(r,10);return Number.isInteger(i)&&t[i]===t[r]}return false}function assertNotStringIndex(t,r){if(isStringIndex(t,r)){throw new Error("Cannot use string index")}}function getProperty(t,r,i){if(!isObject(t)||typeof r!=="string"){return i===undefined?t:i}const o=getPathSegments(r);if(o.length===0){return i}for(let r=0;r<o.length;r++){const a=o[r];if(isStringIndex(t,a)){t=r===o.length-1?undefined:null}else{t=t[a]}if(t===undefined||t===null){if(r!==o.length-1){return i}break}}return t===undefined?i:t}function setProperty(t,r,i){if(!isObject(t)||typeof r!=="string"){return t}const o=t;const a=getPathSegments(r);for(let r=0;r<a.length;r++){const o=a[r];assertNotStringIndex(t,o);if(r===a.length-1){t[o]=i}else if(!isObject(t[o])){t[o]=typeof a[r+1]==="number"?[]:{}}t=t[o]}return o}function deleteProperty(t,r){if(!isObject(t)||typeof r!=="string"){return false}const i=getPathSegments(r);for(let r=0;r<i.length;r++){const o=i[r];assertNotStringIndex(t,o);if(r===i.length-1){delete t[o];return true}t=t[o];if(!isObject(t)){return false}}}function hasProperty(t,r){if(!isObject(t)||typeof r!=="string"){return false}const i=getPathSegments(r);if(i.length===0){return false}for(const r of i){if(!isObject(t)||!(r in t)||isStringIndex(t,r)){return false}t=t[r]}return true}function escapePath(t){if(typeof t!=="string"){throw new TypeError("Expected a string")}return t.replaceAll(/[\\.[]/g,"\\$&")}function entries(t){const r=Object.entries(t);if(Array.isArray(t)){return r.map((([t,r])=>[Number(t),r]))}return r}function stringifyPath(t){let r="";for(let[i,o]of entries(t)){if(typeof o==="number"){r+=`[${o}]`}else{o=escapePath(o);r+=i===0?o:`.${o}`}}return r}function*deepKeysIterator(t,r=[]){if(!isObject(t)||isEmptyObject(t)){if(r.length>0){yield stringifyPath(r)}return}for(const[i,o]of entries(t)){yield*deepKeysIterator(o,[...r,i])}}function deepKeys(t){return[...deepKeysIterator(t)]}const T=require("node:os");const k=T.homedir();const C=T.tmpdir();const{env:I}=S;const macos=t=>{const r=R.join(k,"Library");return{data:R.join(r,"Application Support",t),config:R.join(r,"Preferences",t),cache:R.join(r,"Caches",t),log:R.join(r,"Logs",t),temp:R.join(C,t)}};const windows=t=>{const r=I.APPDATA||R.join(k,"AppData","Roaming");const i=I.LOCALAPPDATA||R.join(k,"AppData","Local");return{data:R.join(i,t,"Data"),config:R.join(r,t,"Config"),cache:R.join(i,t,"Cache"),log:R.join(i,t,"Log"),temp:R.join(C,t)}};const linux=t=>{const r=R.basename(k);return{data:R.join(I.XDG_DATA_HOME||R.join(k,".local","share"),t),config:R.join(I.XDG_CONFIG_HOME||R.join(k,".config"),t),cache:R.join(I.XDG_CACHE_HOME||R.join(k,".cache"),t),log:R.join(I.XDG_STATE_HOME||R.join(k,".local","state"),t),temp:R.join(C,r,t)}};function envPaths(t,{suffix:r="nodejs"}={}){if(typeof t!=="string"){throw new TypeError(`Expected a string, got ${typeof t}`)}if(r){t+=`-${r}`}if(S.platform==="darwin"){return macos(t)}if(S.platform==="win32"){return windows(t)}return linux(t)}const attemptifyAsync=(t,r)=>function attemptified(...i){return t.apply(undefined,i).catch(r)};const attemptifySync=(t,r)=>function attemptified(...i){try{return t.apply(undefined,i)}catch(t){return r(t)}};const N=S.getuid?!S.getuid():false;const D=1e4;const NOOP=()=>undefined;const L={isChangeErrorOk:t=>{if(!L.isNodeError(t))return false;const{code:r}=t;if(r==="ENOSYS")return true;if(!N&&(r==="EINVAL"||r==="EPERM"))return true;return false},isNodeError:t=>t instanceof Error,isRetriableError:t=>{if(!L.isNodeError(t))return false;const{code:r}=t;if(r==="EMFILE"||r==="ENFILE"||r==="EAGAIN"||r==="EBUSY"||r==="EACCESS"||r==="EACCES"||r==="EACCS"||r==="EPERM")return true;return false},onChangeError:t=>{if(!L.isNodeError(t))throw t;if(L.isChangeErrorOk(t))return;throw t}};const M=L;class RetryfyQueue{constructor(){this.interval=25;this.intervalId=undefined;this.limit=D;this.queueActive=new Set;this.queueWaiting=new Set;this.init=()=>{if(this.intervalId)return;this.intervalId=setInterval(this.tick,this.interval)};this.reset=()=>{if(!this.intervalId)return;clearInterval(this.intervalId);delete this.intervalId};this.add=t=>{this.queueWaiting.add(t);if(this.queueActive.size<this.limit/2){this.tick()}else{this.init()}};this.remove=t=>{this.queueWaiting.delete(t);this.queueActive.delete(t)};this.schedule=()=>new Promise((t=>{const cleanup=()=>this.remove(resolver);const resolver=()=>t(cleanup);this.add(resolver)}));this.tick=()=>{if(this.queueActive.size>=this.limit)return;if(!this.queueWaiting.size)return this.reset();for(const t of this.queueWaiting){if(this.queueActive.size>=this.limit)break;this.queueWaiting.delete(t);this.queueActive.add(t);t()}}}}const j=new RetryfyQueue;const retryifyAsync=(t,r)=>function retrified(i){return function attempt(...o){return j.schedule().then((a=>{const onResolve=t=>{a();return t};const onReject=t=>{a();if(Date.now()>=i)throw t;if(r(t)){const t=Math.round(100*Math.random());const r=new Promise((r=>setTimeout(r,t)));return r.then((()=>attempt.apply(undefined,o)))}throw t};return t.apply(undefined,o).then(onResolve,onReject)}))}};const retryifySync=(t,r)=>function retrified(i){return function attempt(...o){try{return t.apply(undefined,o)}catch(t){if(Date.now()>i)throw t;if(r(t))return attempt.apply(undefined,o);throw t}}};const U={attempt:{chmod:attemptifyAsync((0,E.promisify)($.chmod),M.onChangeError),chown:attemptifyAsync((0,E.promisify)($.chown),M.onChangeError),close:attemptifyAsync((0,E.promisify)($.close),NOOP),fsync:attemptifyAsync((0,E.promisify)($.fsync),NOOP),mkdir:attemptifyAsync((0,E.promisify)($.mkdir),NOOP),realpath:attemptifyAsync((0,E.promisify)($.realpath),NOOP),stat:attemptifyAsync((0,E.promisify)($.stat),NOOP),unlink:attemptifyAsync((0,E.promisify)($.unlink),NOOP),chmodSync:attemptifySync($.chmodSync,M.onChangeError),chownSync:attemptifySync($.chownSync,M.onChangeError),closeSync:attemptifySync($.closeSync,NOOP),existsSync:attemptifySync($.existsSync,NOOP),fsyncSync:attemptifySync($.fsync,NOOP),mkdirSync:attemptifySync($.mkdirSync,NOOP),realpathSync:attemptifySync($.realpathSync,NOOP),statSync:attemptifySync($.statSync,NOOP),unlinkSync:attemptifySync($.unlinkSync,NOOP)},retry:{close:retryifyAsync((0,E.promisify)($.close),M.isRetriableError),fsync:retryifyAsync((0,E.promisify)($.fsync),M.isRetriableError),open:retryifyAsync((0,E.promisify)($.open),M.isRetriableError),readFile:retryifyAsync((0,E.promisify)($.readFile),M.isRetriableError),rename:retryifyAsync((0,E.promisify)($.rename),M.isRetriableError),stat:retryifyAsync((0,E.promisify)($.stat),M.isRetriableError),write:retryifyAsync((0,E.promisify)($.write),M.isRetriableError),writeFile:retryifyAsync((0,E.promisify)($.writeFile),M.isRetriableError),closeSync:retryifySync($.closeSync,M.isRetriableError),fsyncSync:retryifySync($.fsyncSync,M.isRetriableError),openSync:retryifySync($.openSync,M.isRetriableError),readFileSync:retryifySync($.readFileSync,M.isRetriableError),renameSync:retryifySync($.renameSync,M.isRetriableError),statSync:retryifySync($.statSync,M.isRetriableError),writeSync:retryifySync($.writeSync,M.isRetriableError),writeFileSync:retryifySync($.writeFileSync,M.isRetriableError)}};const B=U;const H="utf8";const V=438;const z=511;const G={};const q={};const W=T.userInfo().uid;const K=T.userInfo().gid;const Y=7500;const Z=1e3;const X=!!S.getuid;const J=S.getuid?!S.getuid():false;const Q=128;const ee=1e4;const constants_NOOP=()=>{};const lang_isException=t=>t instanceof Error&&"code"in t;const lang_isFunction=t=>typeof t==="function";const lang_isString=t=>typeof t==="string";const lang_isUndefined=t=>t===undefined;const te={};const re={next:t=>{const r=te[t];if(!r)return;r.shift();const i=r[0];if(i){i((()=>re.next(t)))}else{delete te[t]}},schedule:t=>new Promise((r=>{let i=te[t];if(!i)i=te[t]=[];i.push(r);if(i.length>1)return;r((()=>re.next(t)))}))};const se=null&&re;const ne=S.platform==="linux";const ie=S.platform==="win32";const oe=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(!ie){oe.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT")}if(ne){oe.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")}const ae=oe;class Interceptor{constructor(){this.callbacks=new Set;this.exited=false;this.exit=t=>{if(this.exited)return;this.exited=true;for(const t of this.callbacks){t()}if(t){if(ie&&(t!=="SIGINT"&&t!=="SIGTERM"&&t!=="SIGKILL")){S.kill(S.pid,"SIGTERM")}else{S.kill(S.pid,t)}}};this.hook=()=>{S.once("exit",(()=>this.exit()));for(const t of ae){try{S.once(t,(()=>this.exit(t)))}catch{}}};this.register=t=>{this.callbacks.add(t);return()=>{this.callbacks.delete(t)}};this.hook()}}const ce=new Interceptor;const le=ce.register;const ue=le;const he={store:{},create:t=>{const r=`000000${Math.floor(Math.random()*16777215).toString(16)}`.slice(-6);const i=Date.now().toString().slice(-10);const o="tmp-";const a=`.${o}${i}${r}`;const c=`${t}${a}`;return c},get:(t,r,i=true)=>{const o=he.truncate(r(t));if(o in he.store)return he.get(t,r,i);he.store[o]=i;const disposer=()=>delete he.store[o];return[o,disposer]},purge:t=>{if(!he.store[t])return;delete he.store[t];B.attempt.unlink(t)},purgeSync:t=>{if(!he.store[t])return;delete he.store[t];B.attempt.unlinkSync(t)},purgeSyncAll:()=>{for(const t in he.store){he.purgeSync(t)}},truncate:t=>{const r=R.basename(t);if(r.length<=Q)return t;const i=/^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(r);if(!i)return t;const o=r.length-Q;return`${t.slice(0,-r.length)}${i[1]}${i[2].slice(0,-o)}${i[3]}`}};ue(he.purgeSyncAll);const de=he;function readFile(t,r=DEFAULT_READ_OPTIONS){if(isString(r))return readFile(t,{encoding:r});const i=Date.now()+((r.timeout??DEFAULT_TIMEOUT_ASYNC)||-1);return fs.retry.readFile(i)(t,r)}function readFileSync(t,r=DEFAULT_READ_OPTIONS){if(isString(r))return readFileSync(t,{encoding:r});const i=Date.now()+((r.timeout??DEFAULT_TIMEOUT_SYNC)||-1);return fs.retry.readFileSync(i)(t,r)}function writeFile(t,r,i,o){if(isFunction(i))return writeFile(t,r,DEFAULT_WRITE_OPTIONS,i);const a=writeFileAsync(t,r,i);if(o)a.then(o,o);return a}async function writeFileAsync(t,r,i=DEFAULT_WRITE_OPTIONS){if(isString(i))return writeFileAsync(t,r,{encoding:i});const o=Date.now()+((i.timeout??DEFAULT_TIMEOUT_ASYNC)||-1);let a=null;let c=null;let l=null;let u=null;let h=null;try{if(i.schedule)a=await i.schedule(t);c=await Scheduler.schedule(t);const d=await fs.attempt.realpath(t);const p=!!d;t=d||t;[u,l]=Temp.get(t,i.tmpCreate||Temp.create,!(i.tmpPurge===false));const m=IS_POSIX&&isUndefined(i.chown);const g=isUndefined(i.mode);if(p&&(m||g)){const r=await fs.attempt.stat(t);if(r){i={...i};if(m){i.chown={uid:r.uid,gid:r.gid}}if(g){i.mode=r.mode}}}if(!p){const r=path.dirname(t);await fs.attempt.mkdir(r,{mode:DEFAULT_FOLDER_MODE,recursive:true})}h=await fs.retry.open(o)(u,"w",i.mode||DEFAULT_FILE_MODE);if(i.tmpCreated){i.tmpCreated(u)}if(isString(r)){await fs.retry.write(o)(h,r,0,i.encoding||DEFAULT_ENCODING)}else if(!isUndefined(r)){await fs.retry.write(o)(h,r,0,r.length,0)}if(i.fsync!==false){if(i.fsyncWait!==false){await fs.retry.fsync(o)(h)}else{fs.attempt.fsync(h)}}await fs.retry.close(o)(h);h=null;if(i.chown&&(i.chown.uid!==DEFAULT_USER_UID||i.chown.gid!==DEFAULT_USER_GID)){await fs.attempt.chown(u,i.chown.uid,i.chown.gid)}if(i.mode&&i.mode!==DEFAULT_FILE_MODE){await fs.attempt.chmod(u,i.mode)}try{await fs.retry.rename(o)(u,t)}catch(r){if(!isException(r))throw r;if(r.code!=="ENAMETOOLONG")throw r;await fs.retry.rename(o)(u,Temp.truncate(t))}l();u=null}finally{if(h)await fs.attempt.close(h);if(u)Temp.purge(u);if(a)a();if(c)c()}}function writeFileSync(t,r,i=q){if(lang_isString(i))return writeFileSync(t,r,{encoding:i});const o=Date.now()+((i.timeout??Z)||-1);let a=null;let c=null;let l=null;try{const u=B.attempt.realpathSync(t);const h=!!u;t=u||t;[c,a]=de.get(t,i.tmpCreate||de.create,!(i.tmpPurge===false));const d=X&&lang_isUndefined(i.chown);const p=lang_isUndefined(i.mode);if(h&&(d||p)){const r=B.attempt.statSync(t);if(r){i={...i};if(d){i.chown={uid:r.uid,gid:r.gid}}if(p){i.mode=r.mode}}}if(!h){const r=R.dirname(t);B.attempt.mkdirSync(r,{mode:z,recursive:true})}l=B.retry.openSync(o)(c,"w",i.mode||V);if(i.tmpCreated){i.tmpCreated(c)}if(lang_isString(r)){B.retry.writeSync(o)(l,r,0,i.encoding||H)}else if(!lang_isUndefined(r)){B.retry.writeSync(o)(l,r,0,r.length,0)}if(i.fsync!==false){if(i.fsyncWait!==false){B.retry.fsyncSync(o)(l)}else{B.attempt.fsync(l)}}B.retry.closeSync(o)(l);l=null;if(i.chown&&(i.chown.uid!==W||i.chown.gid!==K)){B.attempt.chownSync(c,i.chown.uid,i.chown.gid)}if(i.mode&&i.mode!==V){B.attempt.chmodSync(c,i.mode)}try{B.retry.renameSync(o)(c,t)}catch(r){if(!lang_isException(r))throw r;if(r.code!=="ENAMETOOLONG")throw r;B.retry.renameSync(o)(c,de.truncate(t))}a();c=null}finally{if(l)B.attempt.closeSync(l);if(c)de.purge(c)}}var fe=__nccwpck_require__(2911);var pe=__nccwpck_require__(9084);const copyProperty=(t,r,i,o)=>{if(i==="length"||i==="prototype"){return}if(i==="arguments"||i==="caller"){return}const a=Object.getOwnPropertyDescriptor(t,i);const c=Object.getOwnPropertyDescriptor(r,i);if(!canCopyProperty(a,c)&&o){return}Object.defineProperty(t,i,c)};const canCopyProperty=function(t,r){return t===undefined||t.configurable||t.writable===r.writable&&t.enumerable===r.enumerable&&t.configurable===r.configurable&&(t.writable||t.value===r.value)};const changePrototype=(t,r)=>{const i=Object.getPrototypeOf(r);if(i===Object.getPrototypeOf(t)){return}Object.setPrototypeOf(t,i)};const wrappedToString=(t,r)=>`/* Wrapped ${t}*/\n${r}`;const me=Object.getOwnPropertyDescriptor(Function.prototype,"toString");const ge=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name");const changeToString=(t,r,i)=>{const o=i===""?"":`with ${i.trim()}() `;const a=wrappedToString.bind(null,o,r.toString());Object.defineProperty(a,"name",ge);const{writable:c,enumerable:l,configurable:u}=me;Object.defineProperty(t,"toString",{value:a,writable:c,enumerable:l,configurable:u})};function mimicFunction(t,r,{ignoreNonConfigurable:i=false}={}){const{name:o}=t;for(const o of Reflect.ownKeys(r)){copyProperty(t,r,o,i)}changePrototype(t,r);changeToString(t,r,o);return t}const debounceFunction=(t,r={})=>{if(typeof t!=="function"){throw new TypeError(`Expected the first argument to be a function, got \`${typeof t}\``)}const{wait:i=0,maxWait:o=Number.POSITIVE_INFINITY,before:a=false,after:c=true}=r;if(i<0||o<0){throw new RangeError("`wait` and `maxWait` must not be negative.")}if(!a&&!c){throw new Error("Both `before` and `after` are false, function wouldn't be called.")}let l;let u;let h;const debouncedFunction=function(...r){const d=this;const later=()=>{l=undefined;if(u){clearTimeout(u);u=undefined}if(c){h=t.apply(d,r)}};const maxLater=()=>{u=undefined;if(l){clearTimeout(l);l=undefined}if(c){h=t.apply(d,r)}};const p=a&&!l;clearTimeout(l);l=setTimeout(later,i);if(o>0&&o!==Number.POSITIVE_INFINITY&&!u){u=setTimeout(maxLater,o)}if(p){h=t.apply(d,r)}return h};mimicFunction(debouncedFunction,t);debouncedFunction.cancel=()=>{if(l){clearTimeout(l);l=undefined}if(u){clearTimeout(u);u=undefined}};return debouncedFunction};const ye=debounceFunction;var _e=__nccwpck_require__(84);const ve=Object.prototype.toString;const be="[object Uint8Array]";const we="[object ArrayBuffer]";function isType(t,r,i){if(!t){return false}if(t.constructor===r){return true}return ve.call(t)===i}function isUint8Array(t){return isType(t,Uint8Array,be)}function isArrayBuffer(t){return isType(t,ArrayBuffer,we)}function isUint8ArrayOrArrayBuffer(t){return isUint8Array(t)||isArrayBuffer(t)}function assertUint8Array(t){if(!isUint8Array(t)){throw new TypeError(`Expected \`Uint8Array\`, got \`${typeof t}\``)}}function assertUint8ArrayOrArrayBuffer(t){if(!isUint8ArrayOrArrayBuffer(t)){throw new TypeError(`Expected \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof t}\``)}}function toUint8Array(t){if(t instanceof ArrayBuffer){return new Uint8Array(t)}if(ArrayBuffer.isView(t)){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}throw new TypeError(`Unsupported value, got \`${typeof t}\`.`)}function concatUint8Arrays(t,r){if(t.length===0){return new Uint8Array(0)}r??=t.reduce(((t,r)=>t+r.length),0);const i=new Uint8Array(r);let o=0;for(const r of t){assertUint8Array(r);i.set(r,o);o+=r.length}return i}function areUint8ArraysEqual(t,r){assertUint8Array(t);assertUint8Array(r);if(t===r){return true}if(t.length!==r.length){return false}for(let i=0;i<t.length;i++){if(t[i]!==r[i]){return false}}return true}function compareUint8Arrays(t,r){assertUint8Array(t);assertUint8Array(r);const i=Math.min(t.length,r.length);for(let o=0;o<i;o++){const i=t[o]-r[o];if(i!==0){return Math.sign(i)}}return Math.sign(t.length-r.length)}const Ee={utf8:new globalThis.TextDecoder("utf8")};function uint8ArrayToString(t,r="utf8"){assertUint8ArrayOrArrayBuffer(t);Ee[r]??=new globalThis.TextDecoder(r);return Ee[r].decode(t)}function assertString(t){if(typeof t!=="string"){throw new TypeError(`Expected \`string\`, got \`${typeof t}\``)}}const Se=new globalThis.TextEncoder;function stringToUint8Array(t){assertString(t);return Se.encode(t)}function base64ToBase64Url(t){return t.replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function base64UrlToBase64(t){return t.replaceAll("-","+").replaceAll("_","/")}const $e=65535;function uint8ArrayToBase64(t,{urlSafe:r=false}={}){assertUint8Array(t);let i;if(t.length<$e){i=globalThis.btoa(String.fromCodePoint.apply(this,t))}else{i="";for(const r of t){i+=String.fromCodePoint(r)}i=globalThis.btoa(i)}return r?base64ToBase64Url(i):i}function base64ToUint8Array(t){assertString(t);return Uint8Array.from(globalThis.atob(base64UrlToBase64(t)),(t=>t.codePointAt(0)))}function stringToBase64(t,{urlSafe:r=false}={}){assertString(t);return uint8ArrayToBase64(stringToUint8Array(t),{urlSafe:r})}function base64ToString(t){assertString(t);return uint8ArrayToString(base64ToUint8Array(t))}const Re=Array.from({length:256},((t,r)=>r.toString(16).padStart(2,"0")));function uint8ArrayToHex(t){assertUint8Array(t);let r="";for(let i=0;i<t.length;i++){r+=Re[t[i]]}return r}const Pe={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function hexToUint8Array(t){assertString(t);if(t.length%2!==0){throw new Error("Invalid Hex string length.")}const r=t.length/2;const i=new Uint8Array(r);for(let o=0;o<r;o++){const r=Pe[t[o*2]];const a=Pe[t[o*2+1]];if(r===undefined||a===undefined){throw new Error(`Invalid Hex character encountered at position ${o*2}`)}i[o]=r<<4|a}return i}function getUintBE(t){const{byteLength:r}=t;if(r===6){return t.getUint16(0)*2**32+t.getUint32(2)}if(r===5){return t.getUint8(0)*2**32+t.getUint32(1)}if(r===4){return t.getUint32(0)}if(r===3){return t.getUint8(0)*2**16+t.getUint16(1)}if(r===2){return t.getUint16(0)}if(r===1){return t.getUint8(0)}}function indexOf(t,r){const i=t.length;const o=r.length;if(o===0){return-1}if(o>i){return-1}const a=i-o;for(let i=0;i<=a;i++){let a=true;for(let c=0;c<o;c++){if(t[i+c]!==r[c]){a=false;break}}if(a){return i}}return-1}function includes(t,r){return indexOf(t,r)!==-1}const Oe=pe["default"];const Ae="aes-256-cbc";const createPlainObject=()=>Object.create(null);const isExist=t=>t!==undefined&&t!==null;const checkValueType=(t,r)=>{const i=new Set(["undefined","symbol","function"]);const o=typeof r;if(i.has(o)){throw new TypeError(`Setting a value of type \`${o}\` for key \`${t}\` is not allowed as it's not supported by JSON`)}};const xe="__internal__";const Te=`${xe}.migrations.version`;class Conf{path;events;#e;#t;#r;#s={};constructor(t={}){const r={configName:"config",fileExtension:"json",projectSuffix:"nodejs",clearInvalidConfig:false,accessPropertiesByDotNotation:true,configFileMode:438,...t};if(!r.cwd){if(!r.projectName){throw new Error("Please specify the `projectName` option.")}r.cwd=envPaths(r.projectName,{suffix:r.projectSuffix}).config}this.#r=r;if(r.schema){if(typeof r.schema!=="object"){throw new TypeError("The `schema` option must be an object.")}const t=new fe.Ajv2020({allErrors:true,useDefaults:true});Oe(t);const i={type:"object",properties:r.schema};this.#e=t.compile(i);for(const[t,i]of Object.entries(r.schema)){if(i?.default){this.#s[t]=i.default}}}if(r.defaults){this.#s={...this.#s,...r.defaults}}if(r.serialize){this._serialize=r.serialize}if(r.deserialize){this._deserialize=r.deserialize}this.events=new EventTarget;this.#t=r.encryptionKey;const i=r.fileExtension?`.${r.fileExtension}`:"";this.path=R.resolve(r.cwd,`${r.configName??"config"}${i}`);const o=this.store;const a=Object.assign(createPlainObject(),r.defaults,o);if(r.migrations){if(!r.projectVersion){throw new Error("Please specify the `projectVersion` option.")}this._migrate(r.migrations,r.projectVersion,r.beforeEachMigration)}this._validate(a);try{O.deepEqual(o,a)}catch{this.store=a}if(r.watch){this._watch()}}get(t,r){if(this.#r.accessPropertiesByDotNotation){return this._get(t,r)}const{store:i}=this;return t in i?i[t]:r}set(t,r){if(typeof t!=="string"&&typeof t!=="object"){throw new TypeError(`Expected \`key\` to be of type \`string\` or \`object\`, got ${typeof t}`)}if(typeof t!=="object"&&r===undefined){throw new TypeError("Use `delete()` to clear values")}if(this._containsReservedKey(t)){throw new TypeError(`Please don't use the ${xe} key, as it's used to manage this module internal operations.`)}const{store:i}=this;const set=(t,r)=>{checkValueType(t,r);if(this.#r.accessPropertiesByDotNotation){setProperty(i,t,r)}else{i[t]=r}};if(typeof t==="object"){const r=t;for(const[t,i]of Object.entries(r)){set(t,i)}}else{set(t,r)}this.store=i}has(t){if(this.#r.accessPropertiesByDotNotation){return hasProperty(this.store,t)}return t in this.store}reset(...t){for(const r of t){if(isExist(this.#s[r])){this.set(r,this.#s[r])}}}delete(t){const{store:r}=this;if(this.#r.accessPropertiesByDotNotation){deleteProperty(r,t)}else{delete r[t]}this.store=r}clear(){this.store=createPlainObject();for(const t of Object.keys(this.#s)){this.reset(t)}}onDidChange(t,r){if(typeof t!=="string"){throw new TypeError(`Expected \`key\` to be of type \`string\`, got ${typeof t}`)}if(typeof r!=="function"){throw new TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof r}`)}return this._handleChange((()=>this.get(t)),r)}onDidAnyChange(t){if(typeof t!=="function"){throw new TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof t}`)}return this._handleChange((()=>this.store),t)}get size(){return Object.keys(this.store).length}get store(){try{const t=$.readFileSync(this.path,this.#t?null:"utf8");const r=this._encryptData(t);const i=this._deserialize(r);this._validate(i);return Object.assign(createPlainObject(),i)}catch(t){if(t?.code==="ENOENT"){this._ensureDirectory();return createPlainObject()}if(this.#r.clearInvalidConfig&&t.name==="SyntaxError"){return createPlainObject()}throw t}}set store(t){this._ensureDirectory();this._validate(t);this._write(t);this.events.dispatchEvent(new Event("change"))}*[Symbol.iterator](){for(const[t,r]of Object.entries(this.store)){yield[t,r]}}_encryptData(t){if(!this.#t){return typeof t==="string"?t:uint8ArrayToString(t)}try{const r=t.slice(0,16);const i=P.pbkdf2Sync(this.#t,r.toString(),1e4,32,"sha512");const o=P.createDecipheriv(Ae,i,r);const a=t.slice(17);const c=typeof a==="string"?stringToUint8Array(a):a;return uint8ArrayToString(concatUint8Arrays([o.update(c),o.final()]))}catch{}return t.toString()}_handleChange(t,r){let i=t();const onChange=()=>{const o=i;const a=t();if((0,E.isDeepStrictEqual)(a,o)){return}i=a;r.call(this,a,o)};this.events.addEventListener("change",onChange);return()=>{this.events.removeEventListener("change",onChange)}}_deserialize=t=>JSON.parse(t);_serialize=t=>JSON.stringify(t,undefined,"\t");_validate(t){if(!this.#e){return}const r=this.#e(t);if(r||!this.#e.errors){return}const i=this.#e.errors.map((({instancePath:t,message:r=""})=>`\`${t.slice(1)}\` ${r}`));throw new Error("Config schema violation: "+i.join("; "))}_ensureDirectory(){$.mkdirSync(R.dirname(this.path),{recursive:true})}_write(t){let r=this._serialize(t);if(this.#t){const t=P.randomBytes(16);const i=P.pbkdf2Sync(this.#t,t.toString(),1e4,32,"sha512");const o=P.createCipheriv(Ae,i,t);r=concatUint8Arrays([t,stringToUint8Array(":"),o.update(stringToUint8Array(r)),o.final()])}if(S.env.SNAP){$.writeFileSync(this.path,r,{mode:this.#r.configFileMode})}else{try{writeFileSync(this.path,r,{mode:this.#r.configFileMode})}catch(t){if(t?.code==="EXDEV"){$.writeFileSync(this.path,r,{mode:this.#r.configFileMode});return}throw t}}}_watch(){this._ensureDirectory();if(!$.existsSync(this.path)){this._write(createPlainObject())}if(S.platform==="win32"){$.watch(this.path,{persistent:false},ye((()=>{this.events.dispatchEvent(new Event("change"))}),{wait:100}))}else{$.watchFile(this.path,{persistent:false},ye((()=>{this.events.dispatchEvent(new Event("change"))}),{wait:5e3}))}}_migrate(t,r,i){let o=this._get(Te,"0.0.0");const a=Object.keys(t).filter((t=>this._shouldPerformMigration(t,o,r)));let c={...this.store};for(const l of a){try{if(i){i(this,{fromVersion:o,toVersion:l,finalVersion:r,versions:a})}const u=t[l];u?.(this);this._set(Te,l);o=l;c={...this.store}}catch(t){this.store=c;throw new Error(`Something went wrong during the migration! Changes applied to the store until this failed migration will be restored. ${t}`)}}if(this._isVersionInRangeFormat(o)||!_e.eq(o,r)){this._set(Te,r)}}_containsReservedKey(t){if(typeof t==="object"){const r=Object.keys(t)[0];if(r===xe){return true}}if(typeof t!=="string"){return false}if(this.#r.accessPropertiesByDotNotation){if(t.startsWith(`${xe}.`)){return true}return false}return false}_isVersionInRangeFormat(t){return _e.clean(t)===null}_shouldPerformMigration(t,r,i){if(this._isVersionInRangeFormat(t)){if(r!=="0.0.0"&&_e.satisfies(r,t)){return false}return _e.satisfies(i,t)}if(_e.lte(t,r)){return false}if(_e.gt(t,i)){return false}return true}_get(t,r){return getProperty(this.store,t,r)}_set(t,r){const{store:i}=this;setProperty(i,t,r);this.store=i}}var ke=__nccwpck_require__(6596);var Ce=__nccwpck_require__(2171);var Ie=__nccwpck_require__.n(Ce);var Ne=__nccwpck_require__(5012);var De=__nccwpck_require__.n(Ne);var Le=__nccwpck_require__(4575);var Me=__nccwpck_require__.n(Le);const je=require("node:stream");const Fe=require("node:stream/promises");var Ue=__nccwpck_require__(4434);var Be=__nccwpck_require__(8474);const He=require("node:string_decoder");const Ve=typeof process==="object"&&process?process:{stdout:null,stderr:null};const isStream=t=>!!t&&typeof t==="object"&&(t instanceof Minipass||t instanceof je||isReadable(t)||isWritable(t));const isReadable=t=>!!t&&typeof t==="object"&&t instanceof Be.EventEmitter&&typeof t.pipe==="function"&&t.pipe!==je.Writable.prototype.pipe;const isWritable=t=>!!t&&typeof t==="object"&&t instanceof Be.EventEmitter&&typeof t.write==="function"&&typeof t.end==="function";const ze=Symbol("EOF");const Ge=Symbol("maybeEmitEnd");const qe=Symbol("emittedEnd");const We=Symbol("emittingEnd");const Ke=Symbol("emittedError");const Ye=Symbol("closed");const Ze=Symbol("read");const Xe=Symbol("flush");const Je=Symbol("flushChunk");const Qe=Symbol("encoding");const et=Symbol("decoder");const tt=Symbol("flowing");const rt=Symbol("paused");const st=Symbol("resume");const nt=Symbol("buffer");const it=Symbol("pipes");const ot=Symbol("bufferLength");const at=Symbol("bufferPush");const ct=Symbol("bufferShift");const ut=Symbol("objectMode");const ht=Symbol("destroyed");const dt=Symbol("error");const ft=Symbol("emitData");const pt=Symbol("emitEnd");const mt=Symbol("emitEnd2");const yt=Symbol("async");const _t=Symbol("abort");const vt=Symbol("aborted");const bt=Symbol("signal");const wt=Symbol("dataListeners");const Et=Symbol("discarded");const defer=t=>Promise.resolve().then(t);const nodefer=t=>t();const isEndish=t=>t==="end"||t==="finish"||t==="prefinish";const isArrayBufferLike=t=>t instanceof ArrayBuffer||!!t&&typeof t==="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0;const isArrayBufferView=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t);class Pipe{src;dest;opts;ondrain;constructor(t,r,i){this.src=t;this.dest=r;this.opts=i;this.ondrain=()=>t[st]();this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe();if(this.opts.end)this.dest.end()}}class PipeProxyErrors extends Pipe{unpipe(){this.src.removeListener("error",this.proxyErrors);super.unpipe()}constructor(t,r,i){super(t,r,i);this.proxyErrors=t=>r.emit("error",t);t.on("error",this.proxyErrors)}}const isObjectModeOptions=t=>!!t.objectMode;const isEncodingOptions=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer";class Minipass extends Be.EventEmitter{[tt]=false;[rt]=false;[it]=[];[nt]=[];[ut];[Qe];[yt];[et];[ze]=false;[qe]=false;[We]=false;[Ye]=false;[Ke]=null;[ot]=0;[ht]=false;[bt];[vt]=false;[wt]=0;[Et]=false;writable=true;readable=true;constructor(...t){const r=t[0]||{};super();if(r.objectMode&&typeof r.encoding==="string"){throw new TypeError("Encoding and objectMode may not be used together")}if(isObjectModeOptions(r)){this[ut]=true;this[Qe]=null}else if(isEncodingOptions(r)){this[Qe]=r.encoding;this[ut]=false}else{this[ut]=false;this[Qe]=null}this[yt]=!!r.async;this[et]=this[Qe]?new He.StringDecoder(this[Qe]):null;if(r&&r.debugExposeBuffer===true){Object.defineProperty(this,"buffer",{get:()=>this[nt]})}if(r&&r.debugExposePipes===true){Object.defineProperty(this,"pipes",{get:()=>this[it]})}const{signal:i}=r;if(i){this[bt]=i;if(i.aborted){this[_t]()}else{i.addEventListener("abort",(()=>this[_t]()))}}}get bufferLength(){return this[ot]}get encoding(){return this[Qe]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[ut]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[yt]}set["async"](t){this[yt]=this[yt]||!!t}[_t](){this[vt]=true;this.emit("abort",this[bt]?.reason);this.destroy(this[bt]?.reason)}get aborted(){return this[vt]}set aborted(t){}write(t,r,i){if(this[vt])return false;if(this[ze])throw new Error("write after end");if(this[ht]){this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"}));return true}if(typeof r==="function"){i=r;r="utf8"}if(!r)r="utf8";const o=this[yt]?defer:nodefer;if(!this[ut]&&!Buffer.isBuffer(t)){if(isArrayBufferView(t)){t=Buffer.from(t.buffer,t.byteOffset,t.byteLength)}else if(isArrayBufferLike(t)){t=Buffer.from(t)}else if(typeof t!=="string"){throw new Error("Non-contiguous data written to non-objectMode stream")}}if(this[ut]){if(this[tt]&&this[ot]!==0)this[Xe](true);if(this[tt])this.emit("data",t);else this[at](t);if(this[ot]!==0)this.emit("readable");if(i)o(i);return this[tt]}if(!t.length){if(this[ot]!==0)this.emit("readable");if(i)o(i);return this[tt]}if(typeof t==="string"&&!(r===this[Qe]&&!this[et]?.lastNeed)){t=Buffer.from(t,r)}if(Buffer.isBuffer(t)&&this[Qe]){t=this[et].write(t)}if(this[tt]&&this[ot]!==0)this[Xe](true);if(this[tt])this.emit("data",t);else this[at](t);if(this[ot]!==0)this.emit("readable");if(i)o(i);return this[tt]}read(t){if(this[ht])return null;this[Et]=false;if(this[ot]===0||t===0||t&&t>this[ot]){this[Ge]();return null}if(this[ut])t=null;if(this[nt].length>1&&!this[ut]){this[nt]=[this[Qe]?this[nt].join(""):Buffer.concat(this[nt],this[ot])]}const r=this[Ze](t||null,this[nt][0]);this[Ge]();return r}[Ze](t,r){if(this[ut])this[ct]();else{const i=r;if(t===i.length||t===null)this[ct]();else if(typeof i==="string"){this[nt][0]=i.slice(t);r=i.slice(0,t);this[ot]-=t}else{this[nt][0]=i.subarray(t);r=i.subarray(0,t);this[ot]-=t}}this.emit("data",r);if(!this[nt].length&&!this[ze])this.emit("drain");return r}end(t,r,i){if(typeof t==="function"){i=t;t=undefined}if(typeof r==="function"){i=r;r="utf8"}if(t!==undefined)this.write(t,r);if(i)this.once("end",i);this[ze]=true;this.writable=false;if(this[tt]||!this[rt])this[Ge]();return this}[st](){if(this[ht])return;if(!this[wt]&&!this[it].length){this[Et]=true}this[rt]=false;this[tt]=true;this.emit("resume");if(this[nt].length)this[Xe]();else if(this[ze])this[Ge]();else this.emit("drain")}resume(){return this[st]()}pause(){this[tt]=false;this[rt]=true;this[Et]=false}get destroyed(){return this[ht]}get flowing(){return this[tt]}get paused(){return this[rt]}[at](t){if(this[ut])this[ot]+=1;else this[ot]+=t.length;this[nt].push(t)}[ct](){if(this[ut])this[ot]-=1;else this[ot]-=this[nt][0].length;return this[nt].shift()}[Xe](t=false){do{}while(this[Je](this[ct]())&&this[nt].length);if(!t&&!this[nt].length&&!this[ze])this.emit("drain")}[Je](t){this.emit("data",t);return this[tt]}pipe(t,r){if(this[ht])return t;this[Et]=false;const i=this[qe];r=r||{};if(t===Ve.stdout||t===Ve.stderr)r.end=false;else r.end=r.end!==false;r.proxyErrors=!!r.proxyErrors;if(i){if(r.end)t.end()}else{this[it].push(!r.proxyErrors?new Pipe(this,t,r):new PipeProxyErrors(this,t,r));if(this[yt])defer((()=>this[st]()));else this[st]()}return t}unpipe(t){const r=this[it].find((r=>r.dest===t));if(r){if(this[it].length===1){if(this[tt]&&this[wt]===0){this[tt]=false}this[it]=[]}else this[it].splice(this[it].indexOf(r),1);r.unpipe()}}addListener(t,r){return this.on(t,r)}on(t,r){const i=super.on(t,r);if(t==="data"){this[Et]=false;this[wt]++;if(!this[it].length&&!this[tt]){this[st]()}}else if(t==="readable"&&this[ot]!==0){super.emit("readable")}else if(isEndish(t)&&this[qe]){super.emit(t);this.removeAllListeners(t)}else if(t==="error"&&this[Ke]){const t=r;if(this[yt])defer((()=>t.call(this,this[Ke])));else t.call(this,this[Ke])}return i}removeListener(t,r){return this.off(t,r)}off(t,r){const i=super.off(t,r);if(t==="data"){this[wt]=this.listeners("data").length;if(this[wt]===0&&!this[Et]&&!this[it].length){this[tt]=false}}return i}removeAllListeners(t){const r=super.removeAllListeners(t);if(t==="data"||t===undefined){this[wt]=0;if(!this[Et]&&!this[it].length){this[tt]=false}}return r}get emittedEnd(){return this[qe]}[Ge](){if(!this[We]&&!this[qe]&&!this[ht]&&this[nt].length===0&&this[ze]){this[We]=true;this.emit("end");this.emit("prefinish");this.emit("finish");if(this[Ye])this.emit("close");this[We]=false}}emit(t,...r){const i=r[0];if(t!=="error"&&t!=="close"&&t!==ht&&this[ht]){return false}else if(t==="data"){return!this[ut]&&!i?false:this[yt]?(defer((()=>this[ft](i))),true):this[ft](i)}else if(t==="end"){return this[pt]()}else if(t==="close"){this[Ye]=true;if(!this[qe]&&!this[ht])return false;const t=super.emit("close");this.removeAllListeners("close");return t}else if(t==="error"){this[Ke]=i;super.emit(dt,i);const t=!this[bt]||this.listeners("error").length?super.emit("error",i):false;this[Ge]();return t}else if(t==="resume"){const t=super.emit("resume");this[Ge]();return t}else if(t==="finish"||t==="prefinish"){const r=super.emit(t);this.removeAllListeners(t);return r}const o=super.emit(t,...r);this[Ge]();return o}[ft](t){for(const r of this[it]){if(r.dest.write(t)===false)this.pause()}const r=this[Et]?false:super.emit("data",t);this[Ge]();return r}[pt](){if(this[qe])return false;this[qe]=true;this.readable=false;return this[yt]?(defer((()=>this[mt]())),true):this[mt]()}[mt](){if(this[et]){const t=this[et].end();if(t){for(const r of this[it]){r.dest.write(t)}if(!this[Et])super.emit("data",t)}}for(const t of this[it]){t.end()}const t=super.emit("end");this.removeAllListeners("end");return t}async collect(){const t=Object.assign([],{dataLength:0});if(!this[ut])t.dataLength=0;const r=this.promise();this.on("data",(r=>{t.push(r);if(!this[ut])t.dataLength+=r.length}));await r;return t}async concat(){if(this[ut]){throw new Error("cannot concat in objectMode")}const t=await this.collect();return this[Qe]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise(((t,r)=>{this.on(ht,(()=>r(new Error("stream destroyed"))));this.on("error",(t=>r(t)));this.on("end",(()=>t()))}))}[Symbol.asyncIterator](){this[Et]=false;let t=false;const stop=async()=>{this.pause();t=true;return{value:undefined,done:true}};const next=()=>{if(t)return stop();const r=this.read();if(r!==null)return Promise.resolve({done:false,value:r});if(this[ze])return stop();let i;let o;const onerr=t=>{this.off("data",ondata);this.off("end",onend);this.off(ht,ondestroy);stop();o(t)};const ondata=t=>{this.off("error",onerr);this.off("end",onend);this.off(ht,ondestroy);this.pause();i({value:t,done:!!this[ze]})};const onend=()=>{this.off("error",onerr);this.off("data",ondata);this.off(ht,ondestroy);stop();i({done:true,value:undefined})};const ondestroy=()=>onerr(new Error("stream destroyed"));return new Promise(((t,r)=>{o=r;i=t;this.once(ht,ondestroy);this.once("error",onerr);this.once("end",onend);this.once("data",ondata)}))};return{next:next,throw:stop,return:stop,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[Et]=false;let t=false;const stop=()=>{this.pause();this.off(dt,stop);this.off(ht,stop);this.off("end",stop);t=true;return{done:true,value:undefined}};const next=()=>{if(t)return stop();const r=this.read();return r===null?stop():{done:false,value:r}};this.once("end",stop);this.once(dt,stop);this.once(ht,stop);return{next:next,throw:stop,return:stop,[Symbol.iterator](){return this}}}destroy(t){if(this[ht]){if(t)this.emit("error",t);else this.emit(ht);return this}this[ht]=true;this[Et]=true;this[nt].length=0;this[ot]=0;const r=this;if(typeof r.close==="function"&&!this[Ye])r.close();if(t)this.emit("error",t);else this.emit(ht);return this}static get isStream(){return isStream}}const St=t.writev;const $t=Symbol("_autoClose");const Rt=Symbol("_close");const Pt=Symbol("_ended");const Ot=Symbol("_fd");const At=Symbol("_finished");const xt=Symbol("_flags");const Tt=Symbol("_flush");const kt=Symbol("_handleChunk");const Ct=Symbol("_makeBuf");const It=Symbol("_mode");const Nt=Symbol("_needDrain");const Dt=Symbol("_onerror");const Lt=Symbol("_onopen");const Mt=Symbol("_onread");const jt=Symbol("_onwrite");const Ft=Symbol("_open");const Ut=Symbol("_path");const Bt=Symbol("_pos");const Ht=Symbol("_queue");const Vt=Symbol("_read");const zt=Symbol("_readSize");const Gt=Symbol("_reading");const qt=Symbol("_remain");const Wt=Symbol("_size");const Kt=Symbol("_write");const Yt=Symbol("_writing");const Zt=Symbol("_defaultFlag");const Xt=Symbol("_errored");class ReadStream extends Minipass{[Xt]=false;[Ot];[Ut];[zt];[Gt]=false;[Wt];[qt];[$t];constructor(t,r){r=r||{};super(r);this.readable=true;this.writable=false;if(typeof t!=="string"){throw new TypeError("path must be a string")}this[Xt]=false;this[Ot]=typeof r.fd==="number"?r.fd:undefined;this[Ut]=t;this[zt]=r.readSize||16*1024*1024;this[Gt]=false;this[Wt]=typeof r.size==="number"?r.size:Infinity;this[qt]=this[Wt];this[$t]=typeof r.autoClose==="boolean"?r.autoClose:true;if(typeof this[Ot]==="number"){this[Vt]()}else{this[Ft]()}}get fd(){return this[Ot]}get path(){return this[Ut]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[Ft](){t.open(this[Ut],"r",((t,r)=>this[Lt](t,r)))}[Lt](t,r){if(t){this[Dt](t)}else{this[Ot]=r;this.emit("open",r);this[Vt]()}}[Ct](){return Buffer.allocUnsafe(Math.min(this[zt],this[qt]))}[Vt](){if(!this[Gt]){this[Gt]=true;const r=this[Ct]();if(r.length===0){return process.nextTick((()=>this[Mt](null,0,r)))}t.read(this[Ot],r,0,r.length,null,((t,r,i)=>this[Mt](t,r,i)))}}[Mt](t,r,i){this[Gt]=false;if(t){this[Dt](t)}else if(this[kt](r,i)){this[Vt]()}}[Rt](){if(this[$t]&&typeof this[Ot]==="number"){const r=this[Ot];this[Ot]=undefined;t.close(r,(t=>t?this.emit("error",t):this.emit("close")))}}[Dt](t){this[Gt]=true;this[Rt]();this.emit("error",t)}[kt](t,r){let i=false;this[qt]-=t;if(t>0){i=super.write(t<r.length?r.subarray(0,t):r)}if(t===0||this[qt]<=0){i=false;this[Rt]();super.end()}return i}emit(t,...r){switch(t){case"prefinish":case"finish":return false;case"drain":if(typeof this[Ot]==="number"){this[Vt]()}return false;case"error":if(this[Xt]){return false}this[Xt]=true;return super.emit(t,...r);default:return super.emit(t,...r)}}}class ReadStreamSync extends ReadStream{[Ft](){let r=true;try{this[Lt](null,t.openSync(this[Ut],"r"));r=false}finally{if(r){this[Rt]()}}}[Vt](){let r=true;try{if(!this[Gt]){this[Gt]=true;do{const r=this[Ct]();const i=r.length===0?0:t.readSync(this[Ot],r,0,r.length,null);if(!this[kt](i,r)){break}}while(true);this[Gt]=false}r=false}finally{if(r){this[Rt]()}}}[Rt](){if(this[$t]&&typeof this[Ot]==="number"){const r=this[Ot];this[Ot]=undefined;t.closeSync(r);this.emit("close")}}}class WriteStream extends Ue{readable=false;writable=true;[Xt]=false;[Yt]=false;[Pt]=false;[Ht]=[];[Nt]=false;[Ut];[It];[$t];[Ot];[Zt];[xt];[At]=false;[Bt];constructor(t,r){r=r||{};super(r);this[Ut]=t;this[Ot]=typeof r.fd==="number"?r.fd:undefined;this[It]=r.mode===undefined?438:r.mode;this[Bt]=typeof r.start==="number"?r.start:undefined;this[$t]=typeof r.autoClose==="boolean"?r.autoClose:true;const i=this[Bt]!==undefined?"r+":"w";this[Zt]=r.flags===undefined;this[xt]=r.flags===undefined?i:r.flags;if(this[Ot]===undefined){this[Ft]()}}emit(t,...r){if(t==="error"){if(this[Xt]){return false}this[Xt]=true}return super.emit(t,...r)}get fd(){return this[Ot]}get path(){return this[Ut]}[Dt](t){this[Rt]();this[Yt]=true;this.emit("error",t)}[Ft](){t.open(this[Ut],this[xt],this[It],((t,r)=>this[Lt](t,r)))}[Lt](t,r){if(this[Zt]&&this[xt]==="r+"&&t&&t.code==="ENOENT"){this[xt]="w";this[Ft]()}else if(t){this[Dt](t)}else{this[Ot]=r;this.emit("open",r);if(!this[Yt]){this[Tt]()}}}end(t,r){if(t){this.write(t,r)}this[Pt]=true;if(!this[Yt]&&!this[Ht].length&&typeof this[Ot]==="number"){this[jt](null,0)}return this}write(t,r){if(typeof t==="string"){t=Buffer.from(t,r)}if(this[Pt]){this.emit("error",new Error("write() after end()"));return false}if(this[Ot]===undefined||this[Yt]||this[Ht].length){this[Ht].push(t);this[Nt]=true;return false}this[Yt]=true;this[Kt](t);return true}[Kt](r){t.write(this[Ot],r,0,r.length,this[Bt],((t,r)=>this[jt](t,r)))}[jt](t,r){if(t){this[Dt](t)}else{if(this[Bt]!==undefined&&typeof r==="number"){this[Bt]+=r}if(this[Ht].length){this[Tt]()}else{this[Yt]=false;if(this[Pt]&&!this[At]){this[At]=true;this[Rt]();this.emit("finish")}else if(this[Nt]){this[Nt]=false;this.emit("drain")}}}}[Tt](){if(this[Ht].length===0){if(this[Pt]){this[jt](null,0)}}else if(this[Ht].length===1){this[Kt](this[Ht].pop())}else{const t=this[Ht];this[Ht]=[];St(this[Ot],t,this[Bt],((t,r)=>this[jt](t,r)))}}[Rt](){if(this[$t]&&typeof this[Ot]==="number"){const r=this[Ot];this[Ot]=undefined;t.close(r,(t=>t?this.emit("error",t):this.emit("close")))}}}class WriteStreamSync extends WriteStream{[Ft](){let r;if(this[Zt]&&this[xt]==="r+"){try{r=t.openSync(this[Ut],this[xt],this[It])}catch(t){if(t?.code==="ENOENT"){this[xt]="w";return this[Ft]()}else{throw t}}}else{r=t.openSync(this[Ut],this[xt],this[It])}this[Lt](null,r)}[Rt](){if(this[$t]&&typeof this[Ot]==="number"){const r=this[Ot];this[Ot]=undefined;t.closeSync(r);this.emit("close")}}[Kt](r){let i=true;try{this[jt](null,t.writeSync(this[Ot],r,0,r.length,this[Bt]));i=false}finally{if(i){try{this[Rt]()}catch{}}}}}const Jt=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]);const isSyncFile=t=>!!t.sync&&!!t.file;const isAsyncFile=t=>!t.sync&&!!t.file;const isSyncNoFile=t=>!!t.sync&&!t.file;const isAsyncNoFile=t=>!t.sync&&!t.file;const isSync=t=>!!t.sync;const isAsync=t=>!t.sync;const isFile=t=>!!t.file;const isNoFile=t=>!t.file;const dealiasKey=t=>{const r=Jt.get(t);if(r)return r;return t};const dealias=(t={})=>{if(!t)return{};const r={};for(const[i,o]of Object.entries(t)){const t=dealiasKey(i);r[t]=o}if(r.chmod===undefined&&r.noChmod===false){r.chmod=true}delete r.noChmod;return r};const makeCommand=(t,r,i,o,a)=>Object.assign(((c=[],l,u)=>{if(Array.isArray(c)){l=c;c={}}if(typeof l==="function"){u=l;l=undefined}if(!l){l=[]}else{l=Array.from(l)}const h=dealias(c);a?.(h,l);if(isSyncFile(h)){if(typeof u==="function"){throw new TypeError("callback not supported for sync tar functions")}return t(h,l)}else if(isAsyncFile(h)){const t=r(h,l);const i=u?u:undefined;return i?t.then((()=>i()),i):t}else if(isSyncNoFile(h)){if(typeof u==="function"){throw new TypeError("callback not supported for sync tar functions")}return i(h,l)}else if(isAsyncNoFile(h)){if(typeof u==="function"){throw new TypeError("callback only supported with file option")}return o(h,l)}else{throw new Error("impossible options??")}}),{syncFile:t,asyncFile:r,syncNoFile:i,asyncNoFile:o,validate:a});const Qt=require("assert");var er=__nccwpck_require__(181);const tr=require("zlib");const rr=tr.constants||{ZLIB_VERNUM:4736};const sr=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:Infinity,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},rr));const nr=er.Buffer.concat;const ir=Symbol("_superWrite");class ZlibError extends Error{code;errno;constructor(t){super("zlib: "+t.message);this.code=t.code;this.errno=t.errno;if(!this.code)this.code="ZLIB_ERROR";this.message="zlib: "+t.message;Error.captureStackTrace(this,this.constructor)}get name(){return"ZlibError"}}const ar=Symbol("flushFlag");class ZlibBase extends Minipass{#n=false;#i=false;#o;#a;#c;#l;#u;get sawError(){return this.#n}get handle(){return this.#l}get flushFlag(){return this.#o}constructor(t,r){if(!t||typeof t!=="object")throw new TypeError("invalid options for ZlibBase constructor");super(t);this.#o=t.flush??0;this.#a=t.finishFlush??0;this.#c=t.fullFlushFlag??0;try{this.#l=new tr[r](t)}catch(t){throw new ZlibError(t)}this.#u=t=>{if(this.#n)return;this.#n=true;this.close();this.emit("error",t)};this.#l?.on("error",(t=>this.#u(new ZlibError(t))));this.once("end",(()=>this.close))}close(){if(this.#l){this.#l.close();this.#l=undefined;this.emit("close")}}reset(){if(!this.#n){Qt(this.#l,"zlib binding closed");return this.#l.reset?.()}}flush(t){if(this.ended)return;if(typeof t!=="number")t=this.#c;this.write(Object.assign(er.Buffer.alloc(0),{[ar]:t}))}end(t,r,i){if(typeof t==="function"){i=t;r=undefined;t=undefined}if(typeof r==="function"){i=r;r=undefined}if(t){if(r)this.write(t,r);else this.write(t)}this.flush(this.#a);this.#i=true;return super.end(i)}get ended(){return this.#i}[ir](t){return super.write(t)}write(t,r,i){if(typeof r==="function")i=r,r="utf8";if(typeof t==="string")t=er.Buffer.from(t,r);if(this.#n)return;Qt(this.#l,"zlib binding closed");const o=this.#l._handle;const a=o.close;o.close=()=>{};const c=this.#l.close;this.#l.close=()=>{};er.Buffer.concat=t=>t;let l=undefined;try{const r=typeof t[ar]==="number"?t[ar]:this.#o;l=this.#l._processChunk(t,r);er.Buffer.concat=nr}catch(t){er.Buffer.concat=nr;this.#u(new ZlibError(t))}finally{if(this.#l){this.#l._handle=o;o.close=a;this.#l.close=c;this.#l.removeAllListeners("error")}}if(this.#l)this.#l.on("error",(t=>this.#u(new ZlibError(t))));let u;if(l){if(Array.isArray(l)&&l.length>0){const t=l[0];u=this[ir](er.Buffer.from(t));for(let t=1;t<l.length;t++){u=this[ir](l[t])}}else{u=this[ir](er.Buffer.from(l))}}if(i)i();return u}}class Zlib extends ZlibBase{#h;#d;constructor(t,r){t=t||{};t.flush=t.flush||sr.Z_NO_FLUSH;t.finishFlush=t.finishFlush||sr.Z_FINISH;t.fullFlushFlag=sr.Z_FULL_FLUSH;super(t,r);this.#h=t.level;this.#d=t.strategy}params(t,r){if(this.sawError)return;if(!this.handle)throw new Error("cannot switch params when binding is closed");if(!this.handle.params)throw new Error("not supported in this implementation");if(this.#h!==t||this.#d!==r){this.flush(sr.Z_SYNC_FLUSH);Qt(this.handle,"zlib binding closed");const i=this.handle.flush;this.handle.flush=(t,r)=>{if(typeof t==="function"){r=t;t=this.flushFlag}this.flush(t);r?.()};try{this.handle.params(t,r)}finally{this.handle.flush=i}if(this.handle){this.#h=t;this.#d=r}}}}class Deflate extends Zlib{constructor(t){super(t,"Deflate")}}class Inflate extends Zlib{constructor(t){super(t,"Inflate")}}class Gzip extends Zlib{#f;constructor(t){super(t,"Gzip");this.#f=t&&!!t.portable}[ir](t){if(!this.#f)return super[ir](t);this.#f=false;t[9]=255;return super[ir](t)}}class Gunzip extends Zlib{constructor(t){super(t,"Gunzip")}}class DeflateRaw extends Zlib{constructor(t){super(t,"DeflateRaw")}}class InflateRaw extends Zlib{constructor(t){super(t,"InflateRaw")}}class Unzip extends Zlib{constructor(t){super(t,"Unzip")}}class Brotli extends ZlibBase{constructor(t,r){t=t||{};t.flush=t.flush||sr.BROTLI_OPERATION_PROCESS;t.finishFlush=t.finishFlush||sr.BROTLI_OPERATION_FINISH;t.fullFlushFlag=sr.BROTLI_OPERATION_FLUSH;super(t,r)}}class BrotliCompress extends Brotli{constructor(t){super(t,"BrotliCompress")}}class BrotliDecompress extends Brotli{constructor(t){super(t,"BrotliDecompress")}}class Yallist{tail;head;length=0;static create(t=[]){return new Yallist(t)}constructor(t=[]){for(const r of t){this.push(r)}}*[Symbol.iterator](){for(let t=this.head;t;t=t.next){yield t.value}}removeNode(t){if(t.list!==this){throw new Error("removing node which does not belong to this list")}const r=t.next;const i=t.prev;if(r){r.prev=i}if(i){i.next=r}if(t===this.head){this.head=r}if(t===this.tail){this.tail=i}this.length--;t.next=undefined;t.prev=undefined;t.list=undefined;return r}unshiftNode(t){if(t===this.head){return}if(t.list){t.list.removeNode(t)}const r=this.head;t.list=this;t.next=r;if(r){r.prev=t}this.head=t;if(!this.tail){this.tail=t}this.length++}pushNode(t){if(t===this.tail){return}if(t.list){t.list.removeNode(t)}const r=this.tail;t.list=this;t.prev=r;if(r){r.next=t}this.tail=t;if(!this.head){this.head=t}this.length++}push(...t){for(let r=0,i=t.length;r<i;r++){push(this,t[r])}return this.length}unshift(...t){for(var r=0,i=t.length;r<i;r++){unshift(this,t[r])}return this.length}pop(){if(!this.tail){return undefined}const t=this.tail.value;const r=this.tail;this.tail=this.tail.prev;if(this.tail){this.tail.next=undefined}else{this.head=undefined}r.list=undefined;this.length--;return t}shift(){if(!this.head){return undefined}const t=this.head.value;const r=this.head;this.head=this.head.next;if(this.head){this.head.prev=undefined}else{this.tail=undefined}r.list=undefined;this.length--;return t}forEach(t,r){r=r||this;for(let i=this.head,o=0;!!i;o++){t.call(r,i.value,o,this);i=i.next}}forEachReverse(t,r){r=r||this;for(let i=this.tail,o=this.length-1;!!i;o--){t.call(r,i.value,o,this);i=i.prev}}get(t){let r=0;let i=this.head;for(;!!i&&r<t;r++){i=i.next}if(r===t&&!!i){return i.value}}getReverse(t){let r=0;let i=this.tail;for(;!!i&&r<t;r++){i=i.prev}if(r===t&&!!i){return i.value}}map(t,r){r=r||this;const i=new Yallist;for(let o=this.head;!!o;){i.push(t.call(r,o.value,this));o=o.next}return i}mapReverse(t,r){r=r||this;var i=new Yallist;for(let o=this.tail;!!o;){i.push(t.call(r,o.value,this));o=o.prev}return i}reduce(t,r){let i;let o=this.head;if(arguments.length>1){i=r}else if(this.head){o=this.head.next;i=this.head.value}else{throw new TypeError("Reduce of empty list with no initial value")}for(var a=0;!!o;a++){i=t(i,o.value,a);o=o.next}return i}reduceReverse(t,r){let i;let o=this.tail;if(arguments.length>1){i=r}else if(this.tail){o=this.tail.prev;i=this.tail.value}else{throw new TypeError("Reduce of empty list with no initial value")}for(let r=this.length-1;!!o;r--){i=t(i,o.value,r);o=o.prev}return i}toArray(){const t=new Array(this.length);for(let r=0,i=this.head;!!i;r++){t[r]=i.value;i=i.next}return t}toArrayReverse(){const t=new Array(this.length);for(let r=0,i=this.tail;!!i;r++){t[r]=i.value;i=i.prev}return t}slice(t=0,r=this.length){if(r<0){r+=this.length}if(t<0){t+=this.length}const i=new Yallist;if(r<t||r<0){return i}if(t<0){t=0}if(r>this.length){r=this.length}let o=this.head;let a=0;for(a=0;!!o&&a<t;a++){o=o.next}for(;!!o&&a<r;a++,o=o.next){i.push(o.value)}return i}sliceReverse(t=0,r=this.length){if(r<0){r+=this.length}if(t<0){t+=this.length}const i=new Yallist;if(r<t||r<0){return i}if(t<0){t=0}if(r>this.length){r=this.length}let o=this.length;let a=this.tail;for(;!!a&&o>r;o--){a=a.prev}for(;!!a&&o>t;o--,a=a.prev){i.push(a.value)}return i}splice(t,r=0,...i){if(t>this.length){t=this.length-1}if(t<0){t=this.length+t}let o=this.head;for(let r=0;!!o&&r<t;r++){o=o.next}const a=[];for(let t=0;!!o&&t<r;t++){a.push(o.value);o=this.removeNode(o)}if(!o){o=this.tail}else if(o!==this.tail){o=o.prev}for(const t of i){o=insertAfter(this,o,t)}return a}reverse(){const t=this.head;const r=this.tail;for(let r=t;!!r;r=r.prev){const t=r.prev;r.prev=r.next;r.next=t}this.head=r;this.tail=t;return this}}function insertAfter(t,r,i){const o=r;const a=r?r.next:t.head;const c=new Node(i,o,a,t);if(c.next===undefined){t.tail=c}if(c.prev===undefined){t.head=c}t.length++;return c}function push(t,r){t.tail=new Node(r,t.tail,undefined,t);if(!t.head){t.head=t.tail}t.length++}function unshift(t,r){t.head=new Node(r,undefined,t.head,t);if(!t.tail){t.tail=t.head}t.length++}class Node{list;next;prev;value;constructor(t,r,i,o){this.list=o;this.value=t;if(r){r.next=this;this.prev=r}else{this.prev=undefined}if(i){i.prev=this;this.next=i}else{this.next=undefined}}}const encode=(t,r)=>{if(!Number.isSafeInteger(t)){throw Error("cannot encode number outside of javascript safe integer range")}else if(t<0){encodeNegative(t,r)}else{encodePositive(t,r)}return r};const encodePositive=(t,r)=>{r[0]=128;for(var i=r.length;i>1;i--){r[i-1]=t&255;t=Math.floor(t/256)}};const encodeNegative=(t,r)=>{r[0]=255;var i=false;t=t*-1;for(var o=r.length;o>1;o--){var a=t&255;t=Math.floor(t/256);if(i){r[o-1]=onesComp(a)}else if(a===0){r[o-1]=0}else{i=true;r[o-1]=twosComp(a)}}};const parse=t=>{const r=t[0];const i=r===128?pos(t.subarray(1,t.length)):r===255?twos(t):null;if(i===null){throw Error("invalid base256 encoding")}if(!Number.isSafeInteger(i)){throw Error("parsed number outside of javascript safe integer range")}return i};const twos=t=>{var r=t.length;var i=0;var o=false;for(var a=r-1;a>-1;a--){var c=Number(t[a]);var l;if(o){l=onesComp(c)}else if(c===0){l=c}else{o=true;l=twosComp(c)}if(l!==0){i-=l*Math.pow(256,r-a-1)}}return i};const pos=t=>{var r=t.length;var i=0;for(var o=r-1;o>-1;o--){var a=Number(t[o]);if(a!==0){i+=a*Math.pow(256,r-o-1)}}return i};const onesComp=t=>(255^t)&255;const twosComp=t=>(255^t)+1&255;const isCode=t=>cr.has(t);const isName=t=>lr.has(t);const cr=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]);const lr=new Map(Array.from(cr).map((t=>[t[1],t[0]])));class Header{cksumValid=false;needPax=false;nullBlock=false;block;path;mode;uid;gid;size;cksum;#p="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(t,r=0,i,o){if(Buffer.isBuffer(t)){this.decode(t,r||0,i,o)}else if(t){this.#m(t)}}decode(t,r,i,o){if(!r){r=0}if(!t||!(t.length>=r+512)){throw new Error("need 512 bytes for header")}this.path=decString(t,r,100);this.mode=decNumber(t,r+100,8);this.uid=decNumber(t,r+108,8);this.gid=decNumber(t,r+116,8);this.size=decNumber(t,r+124,12);this.mtime=decDate(t,r+136,12);this.cksum=decNumber(t,r+148,12);if(o)this.#m(o,true);if(i)this.#m(i);const a=decString(t,r+156,1);if(isCode(a)){this.#p=a||"0"}if(this.#p==="0"&&this.path.slice(-1)==="/"){this.#p="5"}if(this.#p==="5"){this.size=0}this.linkpath=decString(t,r+157,100);if(t.subarray(r+257,r+265).toString()==="ustar\x0000"){this.uname=decString(t,r+265,32);this.gname=decString(t,r+297,32);this.devmaj=decNumber(t,r+329,8)??0;this.devmin=decNumber(t,r+337,8)??0;if(t[r+475]!==0){const i=decString(t,r+345,155);this.path=i+"/"+this.path}else{const i=decString(t,r+345,130);if(i){this.path=i+"/"+this.path}this.atime=decDate(t,r+476,12);this.ctime=decDate(t,r+488,12)}}let c=8*32;for(let i=r;i<r+148;i++){c+=t[i]}for(let i=r+156;i<r+512;i++){c+=t[i]}this.cksumValid=c===this.cksum;if(this.cksum===undefined&&c===8*32){this.nullBlock=true}}#m(t,r=false){Object.assign(this,Object.fromEntries(Object.entries(t).filter((([t,i])=>!(i===null||i===undefined||t==="path"&&r||t==="linkpath"&&r||t==="global")))))}encode(t,r=0){if(!t){t=this.block=Buffer.alloc(512)}if(this.#p==="Unsupported"){this.#p="0"}if(!(t.length>=r+512)){throw new Error("need 512 bytes for header")}const i=this.ctime||this.atime?130:155;const o=splitPrefix(this.path||"",i);const a=o[0];const c=o[1];this.needPax=!!o[2];this.needPax=encString(t,r,100,a)||this.needPax;this.needPax=encNumber(t,r+100,8,this.mode)||this.needPax;this.needPax=encNumber(t,r+108,8,this.uid)||this.needPax;this.needPax=encNumber(t,r+116,8,this.gid)||this.needPax;this.needPax=encNumber(t,r+124,12,this.size)||this.needPax;this.needPax=encDate(t,r+136,12,this.mtime)||this.needPax;t[r+156]=this.#p.charCodeAt(0);this.needPax=encString(t,r+157,100,this.linkpath)||this.needPax;t.write("ustar\x0000",r+257,8);this.needPax=encString(t,r+265,32,this.uname)||this.needPax;this.needPax=encString(t,r+297,32,this.gname)||this.needPax;this.needPax=encNumber(t,r+329,8,this.devmaj)||this.needPax;this.needPax=encNumber(t,r+337,8,this.devmin)||this.needPax;this.needPax=encString(t,r+345,i,c)||this.needPax;if(t[r+475]!==0){this.needPax=encString(t,r+345,155,c)||this.needPax}else{this.needPax=encString(t,r+345,130,c)||this.needPax;this.needPax=encDate(t,r+476,12,this.atime)||this.needPax;this.needPax=encDate(t,r+488,12,this.ctime)||this.needPax}let l=8*32;for(let i=r;i<r+148;i++){l+=t[i]}for(let i=r+156;i<r+512;i++){l+=t[i]}this.cksum=l;encNumber(t,r+148,8,this.cksum);this.cksumValid=true;return this.needPax}get type(){return this.#p==="Unsupported"?this.#p:cr.get(this.#p)}get typeKey(){return this.#p}set type(t){const r=String(lr.get(t));if(isCode(r)||r==="Unsupported"){this.#p=r}else if(isCode(t)){this.#p=t}else{throw new TypeError("invalid entry type: "+t)}}}const splitPrefix=(t,r)=>{const i=100;let o=t;let a="";let c=undefined;const l=R.posix.parse(t).root||".";if(Buffer.byteLength(o)<i){c=[o,a,false]}else{a=R.posix.dirname(o);o=R.posix.basename(o);do{if(Buffer.byteLength(o)<=i&&Buffer.byteLength(a)<=r){c=[o,a,false]}else if(Buffer.byteLength(o)>i&&Buffer.byteLength(a)<=r){c=[o.slice(0,i-1),a,true]}else{o=R.posix.join(R.posix.basename(a),o);a=R.posix.dirname(a)}}while(a!==l&&c===undefined);if(!c){c=[t.slice(0,i-1),"",true]}}return c};const decString=(t,r,i)=>t.subarray(r,r+i).toString("utf8").replace(/\0.*/,"");const decDate=(t,r,i)=>numToDate(decNumber(t,r,i));const numToDate=t=>t===undefined?undefined:new Date(t*1e3);const decNumber=(t,r,i)=>Number(t[r])&128?parse(t.subarray(r,r+i)):decSmallNumber(t,r,i);const nanUndef=t=>isNaN(t)?undefined:t;const decSmallNumber=(t,r,i)=>nanUndef(parseInt(t.subarray(r,r+i).toString("utf8").replace(/\0.*$/,"").trim(),8));const ur={12:8589934591,8:2097151};const encNumber=(t,r,i,o)=>o===undefined?false:o>ur[i]||o<0?(encode(o,t.subarray(r,r+i)),true):(encSmallNumber(t,r,i,o),false);const encSmallNumber=(t,r,i,o)=>t.write(octalString(o,i),r,i,"ascii");const octalString=(t,r)=>padOctal(Math.floor(t).toString(8),r);const padOctal=(t,r)=>(t.length===r-1?t:new Array(r-t.length-1).join("0")+t+" ")+"\0";const encDate=(t,r,i,o)=>o===undefined?false:encNumber(t,r,i,o.getTime()/1e3);const hr=new Array(156).join("\0");const encString=(t,r,i,o)=>o===undefined?false:(t.write(o+hr,r,i,"utf8"),o.length!==Buffer.byteLength(o)||o.length>i);class Pax{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(t,r=false){this.atime=t.atime;this.charset=t.charset;this.comment=t.comment;this.ctime=t.ctime;this.dev=t.dev;this.gid=t.gid;this.global=r;this.gname=t.gname;this.ino=t.ino;this.linkpath=t.linkpath;this.mtime=t.mtime;this.nlink=t.nlink;this.path=t.path;this.size=t.size;this.uid=t.uid;this.uname=t.uname}encode(){const t=this.encodeBody();if(t===""){return Buffer.allocUnsafe(0)}const r=Buffer.byteLength(t);const i=512*Math.ceil(1+r/512);const o=Buffer.allocUnsafe(i);for(let t=0;t<512;t++){o[t]=0}new Header({path:("PaxHeader/"+(0,R.basename)(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:r,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(o);o.write(t,512,r,"utf8");for(let t=r+512;t<o.length;t++){o[t]=0}return o}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(t){if(this[t]===undefined){return""}const r=this[t];const i=r instanceof Date?r.getTime()/1e3:r;const o=" "+(t==="dev"||t==="ino"||t==="nlink"?"SCHILY.":"")+t+"="+i+"\n";const a=Buffer.byteLength(o);let c=Math.floor(Math.log(a)/Math.log(10))+1;if(a+c>=Math.pow(10,c)){c+=1}const l=c+a;return l+o}static parse(t,r,i=false){return new Pax(merge(parseKV(t),r),i)}}const merge=(t,r)=>r?Object.assign({},r,t):t;const parseKV=t=>t.replace(/\n$/,"").split("\n").reduce(parseKVLine,Object.create(null));const parseKVLine=(t,r)=>{const i=parseInt(r,10);if(i!==Buffer.byteLength(r)+1){return t}r=r.slice((i+" ").length);const o=r.split("=");const a=o.shift();if(!a){return t}const c=a.replace(/^SCHILY\.(dev|ino|nlink)/,"$1");const l=o.join("=");t[c]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(c)?new Date(Number(l)*1e3):/^[0-9]+$/.test(l)?+l:l;return t};const dr=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform;const fr=dr!=="win32"?t=>t:t=>t&&t.replace(/\\/g,"/");class ReadEntry extends Minipass{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=false;ignore=false;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=false;absolute;unsupported=false;constructor(t,r,i){super({});this.pause();this.extended=r;this.globalExtended=i;this.header=t;this.remain=t.size??0;this.startBlockSize=512*Math.ceil(this.remain/512);this.blockRemain=this.startBlockSize;this.type=t.type;switch(this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=true;break;default:this.ignore=true}if(!t.path){throw new Error("no path provided for tar.ReadEntry")}this.path=fr(t.path);this.mode=t.mode;if(this.mode){this.mode=this.mode&4095}this.uid=t.uid;this.gid=t.gid;this.uname=t.uname;this.gname=t.gname;this.size=this.remain;this.mtime=t.mtime;this.atime=t.atime;this.ctime=t.ctime;this.linkpath=t.linkpath?fr(t.linkpath):undefined;this.uname=t.uname;this.gname=t.gname;if(r){this.#m(r)}if(i){this.#m(i,true)}}write(t){const r=t.length;if(r>this.blockRemain){throw new Error("writing more to entry than is appropriate")}const i=this.remain;const o=this.blockRemain;this.remain=Math.max(0,i-r);this.blockRemain=Math.max(0,o-r);if(this.ignore){return true}if(i>=r){return super.write(t)}return super.write(t.subarray(0,i))}#m(t,r=false){if(t.path)t.path=fr(t.path);if(t.linkpath)t.linkpath=fr(t.linkpath);Object.assign(this,Object.fromEntries(Object.entries(t).filter((([t,i])=>!(i===null||i===undefined||t==="path"&&r)))))}}const warnMethod=(t,r,i,o={})=>{if(t.file){o.file=t.file}if(t.cwd){o.cwd=t.cwd}o.code=i instanceof Error&&i.code||r;o.tarCode=r;if(!t.strict&&o.recoverable!==false){if(i instanceof Error){o=Object.assign(i,o);i=i.message}t.emit("warn",r,i,o)}else if(i instanceof Error){t.emit("error",Object.assign(i,o))}else{t.emit("error",Object.assign(new Error(`${r}: ${i}`),o))}};const pr=1024*1024;const mr=Buffer.from([31,139]);const gr=Symbol("state");const yr=Symbol("writeEntry");const _r=Symbol("readEntry");const vr=Symbol("nextEntry");const br=Symbol("processEntry");const wr=Symbol("extendedHeader");const Er=Symbol("globalExtendedHeader");const Sr=Symbol("meta");const $r=Symbol("emitMeta");const Rr=Symbol("buffer");const Pr=Symbol("queue");const Or=Symbol("ended");const Ar=Symbol("emittedEnd");const xr=Symbol("emit");const Tr=Symbol("unzip");const kr=Symbol("consumeChunk");const Cr=Symbol("consumeChunkSub");const Ir=Symbol("consumeBody");const Nr=Symbol("consumeMeta");const Dr=Symbol("consumeHeader");const Lr=Symbol("consuming");const Mr=Symbol("bufferConcat");const jr=Symbol("maybeEnd");const Fr=Symbol("writing");const Ur=Symbol("aborted");const Br=Symbol("onDone");const Hr=Symbol("sawValidEntry");const Vr=Symbol("sawNullBlock");const zr=Symbol("sawEOF");const Gr=Symbol("closeStream");const noop=()=>true;class Parser extends Ue.EventEmitter{file;strict;maxMetaEntrySize;filter;brotli;writable=true;readable=false;[Pr]=new Yallist;[Rr];[_r];[yr];[gr]="begin";[Sr]="";[wr];[Er];[Or]=false;[Tr];[Ur]=false;[Hr];[Vr]=false;[zr]=false;[Fr]=false;[Lr]=false;[Ar]=false;constructor(t={}){super();this.file=t.file||"";this.on(Br,(()=>{if(this[gr]==="begin"||this[Hr]===false){this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}}));if(t.ondone){this.on(Br,t.ondone)}else{this.on(Br,(()=>{this.emit("prefinish");this.emit("finish");this.emit("end")}))}this.strict=!!t.strict;this.maxMetaEntrySize=t.maxMetaEntrySize||pr;this.filter=typeof t.filter==="function"?t.filter:noop;const r=t.file&&(t.file.endsWith(".tar.br")||t.file.endsWith(".tbr"));this.brotli=!t.gzip&&t.brotli!==undefined?t.brotli:r?undefined:false;this.on("end",(()=>this[Gr]()));if(typeof t.onwarn==="function"){this.on("warn",t.onwarn)}if(typeof t.onReadEntry==="function"){this.on("entry",t.onReadEntry)}}warn(t,r,i={}){warnMethod(this,t,r,i)}[Dr](t,r){if(this[Hr]===undefined){this[Hr]=false}let i;try{i=new Header(t,r,this[wr],this[Er])}catch(t){return this.warn("TAR_ENTRY_INVALID",t)}if(i.nullBlock){if(this[Vr]){this[zr]=true;if(this[gr]==="begin"){this[gr]="header"}this[xr]("eof")}else{this[Vr]=true;this[xr]("nullBlock")}}else{this[Vr]=false;if(!i.cksumValid){this.warn("TAR_ENTRY_INVALID","checksum failure",{header:i})}else if(!i.path){this.warn("TAR_ENTRY_INVALID","path is required",{header:i})}else{const t=i.type;if(/^(Symbolic)?Link$/.test(t)&&!i.linkpath){this.warn("TAR_ENTRY_INVALID","linkpath required",{header:i})}else if(!/^(Symbolic)?Link$/.test(t)&&!/^(Global)?ExtendedHeader$/.test(t)&&i.linkpath){this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:i})}else{const t=this[yr]=new ReadEntry(i,this[wr],this[Er]);if(!this[Hr]){if(t.remain){const onend=()=>{if(!t.invalid){this[Hr]=true}};t.on("end",onend)}else{this[Hr]=true}}if(t.meta){if(t.size>this.maxMetaEntrySize){t.ignore=true;this[xr]("ignoredEntry",t);this[gr]="ignore";t.resume()}else if(t.size>0){this[Sr]="";t.on("data",(t=>this[Sr]+=t));this[gr]="meta"}}else{this[wr]=undefined;t.ignore=t.ignore||!this.filter(t.path,t);if(t.ignore){this[xr]("ignoredEntry",t);this[gr]=t.remain?"ignore":"header";t.resume()}else{if(t.remain){this[gr]="body"}else{this[gr]="header";t.end()}if(!this[_r]){this[Pr].push(t);this[vr]()}else{this[Pr].push(t)}}}}}}}[Gr](){queueMicrotask((()=>this.emit("close")))}[br](t){let r=true;if(!t){this[_r]=undefined;r=false}else if(Array.isArray(t)){const[r,...i]=t;this.emit(r,...i)}else{this[_r]=t;this.emit("entry",t);if(!t.emittedEnd){t.on("end",(()=>this[vr]()));r=false}}return r}[vr](){do{}while(this[br](this[Pr].shift()));if(!this[Pr].length){const t=this[_r];const r=!t||t.flowing||t.size===t.remain;if(r){if(!this[Fr]){this.emit("drain")}}else{t.once("drain",(()=>this.emit("drain")))}}}[Ir](t,r){const i=this[yr];if(!i){throw new Error("attempt to consume body without entry??")}const o=i.blockRemain??0;const a=o>=t.length&&r===0?t:t.subarray(r,r+o);i.write(a);if(!i.blockRemain){this[gr]="header";this[yr]=undefined;i.end()}return a.length}[Nr](t,r){const i=this[yr];const o=this[Ir](t,r);if(!this[yr]&&i){this[$r](i)}return o}[xr](t,r,i){if(!this[Pr].length&&!this[_r]){this.emit(t,r,i)}else{this[Pr].push([t,r,i])}}[$r](t){this[xr]("meta",this[Sr]);switch(t.type){case"ExtendedHeader":case"OldExtendedHeader":this[wr]=Pax.parse(this[Sr],this[wr],false);break;case"GlobalExtendedHeader":this[Er]=Pax.parse(this[Sr],this[Er],true);break;case"NextFileHasLongPath":case"OldGnuLongPath":{const t=this[wr]??Object.create(null);this[wr]=t;t.path=this[Sr].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{const t=this[wr]||Object.create(null);this[wr]=t;t.linkpath=this[Sr].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+t.type)}}abort(t){this[Ur]=true;this.emit("abort",t);this.warn("TAR_ABORT",t,{recoverable:false})}write(t,r,i){if(typeof r==="function"){i=r;r=undefined}if(typeof t==="string"){t=Buffer.from(t,typeof r==="string"?r:"utf8")}if(this[Ur]){i?.();return false}const o=this[Tr]===undefined||this.brotli===undefined&&this[Tr]===false;if(o&&t){if(this[Rr]){t=Buffer.concat([this[Rr],t]);this[Rr]=undefined}if(t.length<mr.length){this[Rr]=t;i?.();return true}for(let r=0;this[Tr]===undefined&&r<mr.length;r++){if(t[r]!==mr[r]){this[Tr]=false}}const r=this.brotli===undefined;if(this[Tr]===false&&r){if(t.length<512){if(this[Or]){this.brotli=true}else{this[Rr]=t;i?.();return true}}else{try{new Header(t.subarray(0,512));this.brotli=false}catch(t){this.brotli=true}}}if(this[Tr]===undefined||this[Tr]===false&&this.brotli){const r=this[Or];this[Or]=false;this[Tr]=this[Tr]===undefined?new Unzip({}):new BrotliDecompress({});this[Tr].on("data",(t=>this[kr](t)));this[Tr].on("error",(t=>this.abort(t)));this[Tr].on("end",(()=>{this[Or]=true;this[kr]()}));this[Fr]=true;const o=!!this[Tr][r?"end":"write"](t);this[Fr]=false;i?.();return o}}this[Fr]=true;if(this[Tr]){this[Tr].write(t)}else{this[kr](t)}this[Fr]=false;const a=this[Pr].length?false:this[_r]?this[_r].flowing:true;if(!a&&!this[Pr].length){this[_r]?.once("drain",(()=>this.emit("drain")))}i?.();return a}[Mr](t){if(t&&!this[Ur]){this[Rr]=this[Rr]?Buffer.concat([this[Rr],t]):t}}[jr](){if(this[Or]&&!this[Ar]&&!this[Ur]&&!this[Lr]){this[Ar]=true;const t=this[yr];if(t&&t.blockRemain){const r=this[Rr]?this[Rr].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${t.blockRemain} more bytes, only ${r} available)`,{entry:t});if(this[Rr]){t.write(this[Rr])}t.end()}this[xr](Br)}}[kr](t){if(this[Lr]&&t){this[Mr](t)}else if(!t&&!this[Rr]){this[jr]()}else if(t){this[Lr]=true;if(this[Rr]){this[Mr](t);const r=this[Rr];this[Rr]=undefined;this[Cr](r)}else{this[Cr](t)}while(this[Rr]&&this[Rr]?.length>=512&&!this[Ur]&&!this[zr]){const t=this[Rr];this[Rr]=undefined;this[Cr](t)}this[Lr]=false}if(!this[Rr]||this[Or]){this[jr]()}}[Cr](t){let r=0;const i=t.length;while(r+512<=i&&!this[Ur]&&!this[zr]){switch(this[gr]){case"begin":case"header":this[Dr](t,r);r+=512;break;case"ignore":case"body":r+=this[Ir](t,r);break;case"meta":r+=this[Nr](t,r);break;default:throw new Error("invalid state: "+this[gr])}}if(r<i){if(this[Rr]){this[Rr]=Buffer.concat([t.subarray(r),this[Rr]])}else{this[Rr]=t.subarray(r)}}}end(t,r,i){if(typeof t==="function"){i=t;r=undefined;t=undefined}if(typeof r==="function"){i=r;r=undefined}if(typeof t==="string"){t=Buffer.from(t,r)}if(i)this.once("finish",i);if(!this[Ur]){if(this[Tr]){if(t)this[Tr].write(t);this[Tr].end()}else{this[Or]=true;if(this.brotli===undefined)t=t||Buffer.alloc(0);if(t)this.write(t);this[jr]()}}return this}}const stripTrailingSlashes=t=>{let r=t.length-1;let i=-1;while(r>-1&&t.charAt(r)==="/"){i=r;r--}return i===-1?t:t.slice(0,i)};const onReadEntryFunction=t=>{const r=t.onReadEntry;t.onReadEntry=r?t=>{r(t);t.resume()}:t=>t.resume()};const filesFilter=(t,i)=>{const o=new Map(i.map((t=>[stripTrailingSlashes(t),true])));const a=t.filter;const mapHas=(t,i="")=>{const a=i||(0,r.parse)(t).root||".";let c;if(t===a)c=false;else{const i=o.get(t);if(i!==undefined){c=i}else{c=mapHas((0,r.dirname)(t),a)}}o.set(t,c);return c};t.filter=a?(t,r)=>a(t,r)&&mapHas(stripTrailingSlashes(t)):t=>mapHas(stripTrailingSlashes(t))};const listFileSync=t=>{const r=new Parser(t);const i=t.file;let o;try{const a=$.statSync(i);const c=t.maxReadSize||16*1024*1024;if(a.size<c){r.end($.readFileSync(i))}else{let t=0;const l=Buffer.allocUnsafe(c);o=$.openSync(i,"r");while(t<a.size){const i=$.readSync(o,l,0,c,t);t+=i;r.write(l.subarray(0,i))}r.end()}}finally{if(typeof o==="number"){try{$.closeSync(o)}catch(t){}}}};const listFile=(t,r)=>{const i=new Parser(t);const o=t.maxReadSize||16*1024*1024;const a=t.file;const c=new Promise(((t,r)=>{i.on("error",r);i.on("end",t);$.stat(a,((t,c)=>{if(t){r(t)}else{const t=new ReadStream(a,{readSize:o,size:c.size});t.on("error",r);t.pipe(i)}}))}));return c};const qr=makeCommand(listFileSync,listFile,(t=>new Parser(t)),(t=>new Parser(t)),((t,r)=>{if(r?.length)filesFilter(t,r);if(!t.noResume)onReadEntryFunction(t)}));const modeFix=(t,r,i)=>{t&=4095;if(i){t=(t|384)&~18}if(r){if(t&256){t|=64}if(t&32){t|=8}if(t&4){t|=1}}return t};const{isAbsolute:Wr,parse:Kr}=R.win32;const stripAbsolutePath=t=>{let r="";let i=Kr(t);while(Wr(t)||i.root){const o=t.charAt(0)==="/"&&t.slice(0,4)!=="//?/"?"/":i.root;t=t.slice(o.length);r+=o;i=Kr(t)}return[r,t]};const Yr=["|","<",">","?",":"];const Zr=Yr.map((t=>String.fromCharCode(61440+t.charCodeAt(0))));const Xr=new Map(Yr.map(((t,r)=>[t,Zr[r]])));const Jr=new Map(Zr.map(((t,r)=>[t,Yr[r]])));const winchars_encode=t=>Yr.reduce(((t,r)=>t.split(r).join(Xr.get(r))),t);const decode=t=>Zr.reduce(((t,r)=>t.split(r).join(Jr.get(r))),t);const prefixPath=(t,r)=>{if(!r){return fr(t)}t=fr(t).replace(/^\.(\/|$)/,"");return stripTrailingSlashes(r)+"/"+t};const Qr=16*1024*1024;const es=Symbol("process");const ts=Symbol("file");const rs=Symbol("directory");const ss=Symbol("symlink");const ns=Symbol("hardlink");const is=Symbol("header");const os=Symbol("read");const as=Symbol("lstat");const cs=Symbol("onlstat");const ls=Symbol("onread");const us=Symbol("onreadlink");const hs=Symbol("openfile");const ds=Symbol("onopenfile");const ps=Symbol("close");const ms=Symbol("mode");const gs=Symbol("awaitDrain");const ys=Symbol("ondrain");const _s=Symbol("prefix");class WriteEntry extends Minipass{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#g=false;constructor(t,i={}){const o=dealias(i);super();this.path=fr(t);this.portable=!!o.portable;this.maxReadSize=o.maxReadSize||Qr;this.linkCache=o.linkCache||new Map;this.statCache=o.statCache||new Map;this.preservePaths=!!o.preservePaths;this.cwd=fr(o.cwd||process.cwd());this.strict=!!o.strict;this.noPax=!!o.noPax;this.noMtime=!!o.noMtime;this.mtime=o.mtime;this.prefix=o.prefix?fr(o.prefix):undefined;this.onWriteEntry=o.onWriteEntry;if(typeof o.onwarn==="function"){this.on("warn",o.onwarn)}let a=false;if(!this.preservePaths){const[t,r]=stripAbsolutePath(this.path);if(t&&typeof r==="string"){this.path=r;a=t}}this.win32=!!o.win32||process.platform==="win32";if(this.win32){this.path=decode(this.path.replace(/\\/g,"/"));t=t.replace(/\\/g,"/")}this.absolute=fr(o.absolute||r.resolve(this.cwd,t));if(this.path===""){this.path="./"}if(a){this.warn("TAR_ENTRY_INFO",`stripping ${a} from absolute path`,{entry:this,path:a+this.path})}const c=this.statCache.get(this.absolute);if(c){this[cs](c)}else{this[as]()}}warn(t,r,i={}){return warnMethod(this,t,r,i)}emit(t,...r){if(t==="error"){this.#g=true}return super.emit(t,...r)}[as](){t.lstat(this.absolute,((t,r)=>{if(t){return this.emit("error",t)}this[cs](r)}))}[cs](t){this.statCache.set(this.absolute,t);this.stat=t;if(!t.isFile()){t.size=0}this.type=getType(t);this.emit("stat",t);this[es]()}[es](){switch(this.type){case"File":return this[ts]();case"Directory":return this[rs]();case"SymbolicLink":return this[ss]();default:return this.end()}}[ms](t){return modeFix(t,this.type==="Directory",this.portable)}[_s](t){return prefixPath(t,this.prefix)}[is](){if(!this.stat){throw new Error("cannot write header before stat")}if(this.type==="Directory"&&this.portable){this.noMtime=true}this.onWriteEntry?.(this);this.header=new Header({path:this[_s](this.path),linkpath:this.type==="Link"&&this.linkpath!==undefined?this[_s](this.linkpath):this.linkpath,mode:this[ms](this.stat.mode),uid:this.portable?undefined:this.stat.uid,gid:this.portable?undefined:this.stat.gid,size:this.stat.size,mtime:this.noMtime?undefined:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?undefined:this.type,uname:this.portable?undefined:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?undefined:this.stat.atime,ctime:this.portable?undefined:this.stat.ctime});if(this.header.encode()&&!this.noPax){super.write(new Pax({atime:this.portable?undefined:this.header.atime,ctime:this.portable?undefined:this.header.ctime,gid:this.portable?undefined:this.header.gid,mtime:this.noMtime?undefined:this.mtime||this.header.mtime,path:this[_s](this.path),linkpath:this.type==="Link"&&this.linkpath!==undefined?this[_s](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?undefined:this.header.uid,uname:this.portable?undefined:this.header.uname,dev:this.portable?undefined:this.stat.dev,ino:this.portable?undefined:this.stat.ino,nlink:this.portable?undefined:this.stat.nlink}).encode())}const t=this.header?.block;if(!t){throw new Error("failed to encode header")}super.write(t)}[rs](){if(!this.stat){throw new Error("cannot create directory entry without stat")}if(this.path.slice(-1)!=="/"){this.path+="/"}this.stat.size=0;this[is]();this.end()}[ss](){t.readlink(this.absolute,((t,r)=>{if(t){return this.emit("error",t)}this[us](r)}))}[us](t){this.linkpath=fr(t);this[is]();this.end()}[ns](t){if(!this.stat){throw new Error("cannot create link entry without stat")}this.type="Link";this.linkpath=fr(r.relative(this.cwd,t));this.stat.size=0;this[is]();this.end()}[ts](){if(!this.stat){throw new Error("cannot create file entry without stat")}if(this.stat.nlink>1){const t=`${this.stat.dev}:${this.stat.ino}`;const r=this.linkCache.get(t);if(r?.indexOf(this.cwd)===0){return this[ns](r)}this.linkCache.set(t,this.absolute)}this[is]();if(this.stat.size===0){return this.end()}this[hs]()}[hs](){t.open(this.absolute,"r",((t,r)=>{if(t){return this.emit("error",t)}this[ds](r)}))}[ds](t){this.fd=t;if(this.#g){return this[ps]()}if(!this.stat){throw new Error("should stat before calling onopenfile")}this.blockLen=512*Math.ceil(this.stat.size/512);this.blockRemain=this.blockLen;const r=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(r);this.offset=0;this.pos=0;this.remain=this.stat.size;this.length=this.buf.length;this[os]()}[os](){const{fd:r,buf:i,offset:o,length:a,pos:c}=this;if(r===undefined||i===undefined){throw new Error("cannot read file without first opening")}t.read(r,i,o,a,c,((t,r)=>{if(t){return this[ps]((()=>this.emit("error",t)))}this[ls](r)}))}[ps](r=()=>{}){if(this.fd!==undefined)t.close(this.fd,r)}[ls](t){if(t<=0&&this.remain>0){const t=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[ps]((()=>this.emit("error",t)))}if(t>this.remain){const t=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[ps]((()=>this.emit("error",t)))}if(!this.buf){throw new Error("should have created buffer prior to reading")}if(t===this.remain){for(let r=t;r<this.length&&t<this.blockRemain;r++){this.buf[r+this.offset]=0;t++;this.remain++}}const r=this.offset===0&&t===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+t);const i=this.write(r);if(!i){this[gs]((()=>this[ys]()))}else{this[ys]()}}[gs](t){this.once("drain",t)}write(t,r,i){if(typeof r==="function"){i=r;r=undefined}if(typeof t==="string"){t=Buffer.from(t,typeof r==="string"?r:"utf8")}if(this.blockRemain<t.length){const t=Object.assign(new Error("writing more data than expected"),{path:this.absolute});return this.emit("error",t)}this.remain-=t.length;this.blockRemain-=t.length;this.pos+=t.length;this.offset+=t.length;return super.write(t,null,i)}[ys](){if(!this.remain){if(this.blockRemain){super.write(Buffer.alloc(this.blockRemain))}return this[ps]((t=>t?this.emit("error",t):this.end()))}if(!this.buf){throw new Error("buffer lost somehow in ONDRAIN")}if(this.offset>=this.length){this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length));this.offset=0}this.length=this.buf.length-this.offset;this[os]()}}class WriteEntrySync extends WriteEntry{sync=true;[as](){this[cs](t.lstatSync(this.absolute))}[ss](){this[us](t.readlinkSync(this.absolute))}[hs](){this[ds](t.openSync(this.absolute,"r"))}[os](){let r=true;try{const{fd:i,buf:o,offset:a,length:c,pos:l}=this;if(i===undefined||o===undefined){throw new Error("fd and buf must be set in READ method")}const u=t.readSync(i,o,a,c,l);this[ls](u);r=false}finally{if(r){try{this[ps]((()=>{}))}catch(t){}}}}[gs](t){t()}[ps](r=()=>{}){if(this.fd!==undefined)t.closeSync(this.fd);r()}}class WriteEntryTar extends Minipass{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(t,r,i={}){return warnMethod(this,t,r,i)}constructor(t,r={}){const i=dealias(r);super();this.preservePaths=!!i.preservePaths;this.portable=!!i.portable;this.strict=!!i.strict;this.noPax=!!i.noPax;this.noMtime=!!i.noMtime;this.onWriteEntry=i.onWriteEntry;this.readEntry=t;const{type:o}=t;if(o==="Unsupported"){throw new Error("writing entry that should be ignored")}this.type=o;if(this.type==="Directory"&&this.portable){this.noMtime=true}this.prefix=i.prefix;this.path=fr(t.path);this.mode=t.mode!==undefined?this[ms](t.mode):undefined;this.uid=this.portable?undefined:t.uid;this.gid=this.portable?undefined:t.gid;this.uname=this.portable?undefined:t.uname;this.gname=this.portable?undefined:t.gname;this.size=t.size;this.mtime=this.noMtime?undefined:i.mtime||t.mtime;this.atime=this.portable?undefined:t.atime;this.ctime=this.portable?undefined:t.ctime;this.linkpath=t.linkpath!==undefined?fr(t.linkpath):undefined;if(typeof i.onwarn==="function"){this.on("warn",i.onwarn)}let a=false;if(!this.preservePaths){const[t,r]=stripAbsolutePath(this.path);if(t&&typeof r==="string"){this.path=r;a=t}}this.remain=t.size;this.blockRemain=t.startBlockSize;this.onWriteEntry?.(this);this.header=new Header({path:this[_s](this.path),linkpath:this.type==="Link"&&this.linkpath!==undefined?this[_s](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?undefined:this.uid,gid:this.portable?undefined:this.gid,size:this.size,mtime:this.noMtime?undefined:this.mtime,type:this.type,uname:this.portable?undefined:this.uname,atime:this.portable?undefined:this.atime,ctime:this.portable?undefined:this.ctime});if(a){this.warn("TAR_ENTRY_INFO",`stripping ${a} from absolute path`,{entry:this,path:a+this.path})}if(this.header.encode()&&!this.noPax){super.write(new Pax({atime:this.portable?undefined:this.atime,ctime:this.portable?undefined:this.ctime,gid:this.portable?undefined:this.gid,mtime:this.noMtime?undefined:this.mtime,path:this[_s](this.path),linkpath:this.type==="Link"&&this.linkpath!==undefined?this[_s](this.linkpath):this.linkpath,size:this.size,uid:this.portable?undefined:this.uid,uname:this.portable?undefined:this.uname,dev:this.portable?undefined:this.readEntry.dev,ino:this.portable?undefined:this.readEntry.ino,nlink:this.portable?undefined:this.readEntry.nlink}).encode())}const c=this.header?.block;if(!c)throw new Error("failed to encode header");super.write(c);t.pipe(this)}[_s](t){return prefixPath(t,this.prefix)}[ms](t){return modeFix(t,this.type==="Directory",this.portable)}write(t,r,i){if(typeof r==="function"){i=r;r=undefined}if(typeof t==="string"){t=Buffer.from(t,typeof r==="string"?r:"utf8")}const o=t.length;if(o>this.blockRemain){throw new Error("writing more to entry than is appropriate")}this.blockRemain-=o;return super.write(t,i)}end(t,r,i){if(this.blockRemain){super.write(Buffer.alloc(this.blockRemain))}if(typeof t==="function"){i=t;r=undefined;t=undefined}if(typeof r==="function"){i=r;r=undefined}if(typeof t==="string"){t=Buffer.from(t,r??"utf8")}if(i)this.once("finish",i);t?super.end(t,i):super.end(i);return this}}const getType=t=>t.isFile()?"File":t.isDirectory()?"Directory":t.isSymbolicLink()?"SymbolicLink":"Unsupported";class PackJob{path;absolute;entry;stat;readdir;pending=false;ignore=false;piped=false;constructor(t,r){this.path=t||"./";this.absolute=r}}const vs=Buffer.alloc(1024);const bs=Symbol("onStat");const ws=Symbol("ended");const Es=Symbol("queue");const Ss=Symbol("current");const $s=Symbol("process");const Rs=Symbol("processing");const Ps=Symbol("processJob");const Os=Symbol("jobs");const As=Symbol("jobDone");const xs=Symbol("addFSEntry");const Ts=Symbol("addTarEntry");const ks=Symbol("stat");const Cs=Symbol("readdir");const Is=Symbol("onreaddir");const Ns=Symbol("pipe");const Ds=Symbol("entry");const Ls=Symbol("entryOpt");const Ms=Symbol("writeEntryClass");const js=Symbol("write");const Fs=Symbol("ondrain");class Pack extends Minipass{opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[Ms];onWriteEntry;[Es];[Os]=0;[Rs]=false;[ws]=false;constructor(t={}){super();this.opt=t;this.file=t.file||"";this.cwd=t.cwd||process.cwd();this.maxReadSize=t.maxReadSize;this.preservePaths=!!t.preservePaths;this.strict=!!t.strict;this.noPax=!!t.noPax;this.prefix=fr(t.prefix||"");this.linkCache=t.linkCache||new Map;this.statCache=t.statCache||new Map;this.readdirCache=t.readdirCache||new Map;this.onWriteEntry=t.onWriteEntry;this[Ms]=WriteEntry;if(typeof t.onwarn==="function"){this.on("warn",t.onwarn)}this.portable=!!t.portable;if(t.gzip||t.brotli){if(t.gzip&&t.brotli){throw new TypeError("gzip and brotli are mutually exclusive")}if(t.gzip){if(typeof t.gzip!=="object"){t.gzip={}}if(this.portable){t.gzip.portable=true}this.zip=new Gzip(t.gzip)}if(t.brotli){if(typeof t.brotli!=="object"){t.brotli={}}this.zip=new BrotliCompress(t.brotli)}if(!this.zip)throw new Error("impossible");const r=this.zip;r.on("data",(t=>super.write(t)));r.on("end",(()=>super.end()));r.on("drain",(()=>this[Fs]()));this.on("resume",(()=>r.resume()))}else{this.on("drain",this[Fs])}this.noDirRecurse=!!t.noDirRecurse;this.follow=!!t.follow;this.noMtime=!!t.noMtime;if(t.mtime)this.mtime=t.mtime;this.filter=typeof t.filter==="function"?t.filter:()=>true;this[Es]=new Yallist;this[Os]=0;this.jobs=Number(t.jobs)||4;this[Rs]=false;this[ws]=false}[js](t){return super.write(t)}add(t){this.write(t);return this}end(t,r,i){if(typeof t==="function"){i=t;t=undefined}if(typeof r==="function"){i=r;r=undefined}if(t){this.add(t)}this[ws]=true;this[$s]();if(i)i();return this}write(t){if(this[ws]){throw new Error("write after end")}if(t instanceof ReadEntry){this[Ts](t)}else{this[xs](t)}return this.flowing}[Ts](t){const i=fr(r.resolve(this.cwd,t.path));if(!this.filter(t.path,t)){t.resume()}else{const r=new PackJob(t.path,i);r.entry=new WriteEntryTar(t,this[Ls](r));r.entry.on("end",(()=>this[As](r)));this[Os]+=1;this[Es].push(r)}this[$s]()}[xs](t){const i=fr(r.resolve(this.cwd,t));this[Es].push(new PackJob(t,i));this[$s]()}[ks](r){r.pending=true;this[Os]+=1;const i=this.follow?"stat":"lstat";t[i](r.absolute,((t,i)=>{r.pending=false;this[Os]-=1;if(t){this.emit("error",t)}else{this[bs](r,i)}}))}[bs](t,r){this.statCache.set(t.absolute,r);t.stat=r;if(!this.filter(t.path,r)){t.ignore=true}this[$s]()}[Cs](r){r.pending=true;this[Os]+=1;t.readdir(r.absolute,((t,i)=>{r.pending=false;this[Os]-=1;if(t){return this.emit("error",t)}this[Is](r,i)}))}[Is](t,r){this.readdirCache.set(t.absolute,r);t.readdir=r;this[$s]()}[$s](){if(this[Rs]){return}this[Rs]=true;for(let t=this[Es].head;!!t&&this[Os]<this.jobs;t=t.next){this[Ps](t.value);if(t.value.ignore){const r=t.next;this[Es].removeNode(t);t.next=r}}this[Rs]=false;if(this[ws]&&!this[Es].length&&this[Os]===0){if(this.zip){this.zip.end(vs)}else{super.write(vs);super.end()}}}get[Ss](){return this[Es]&&this[Es].head&&this[Es].head.value}[As](t){this[Es].shift();this[Os]-=1;this[$s]()}[Ps](t){if(t.pending){return}if(t.entry){if(t===this[Ss]&&!t.piped){this[Ns](t)}return}if(!t.stat){const r=this.statCache.get(t.absolute);if(r){this[bs](t,r)}else{this[ks](t)}}if(!t.stat){return}if(t.ignore){return}if(!this.noDirRecurse&&t.stat.isDirectory()&&!t.readdir){const r=this.readdirCache.get(t.absolute);if(r){this[Is](t,r)}else{this[Cs](t)}if(!t.readdir){return}}t.entry=this[Ds](t);if(!t.entry){t.ignore=true;return}if(t===this[Ss]&&!t.piped){this[Ns](t)}}[Ls](t){return{onwarn:(t,r,i)=>this.warn(t,r,i),noPax:this.noPax,cwd:this.cwd,absolute:t.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[Ds](t){this[Os]+=1;try{const r=new this[Ms](t.path,this[Ls](t));return r.on("end",(()=>this[As](t))).on("error",(t=>this.emit("error",t)))}catch(t){this.emit("error",t)}}[Fs](){if(this[Ss]&&this[Ss].entry){this[Ss].entry.resume()}}[Ns](t){t.piped=true;if(t.readdir){t.readdir.forEach((r=>{const i=t.path;const o=i==="./"?"":i.replace(/\/*$/,"/");this[xs](o+r)}))}const r=t.entry;const i=this.zip;if(!r)throw new Error("cannot pipe without source");if(i){r.on("data",(t=>{if(!i.write(t)){r.pause()}}))}else{r.on("data",(t=>{if(!super.write(t)){r.pause()}}))}}pause(){if(this.zip){this.zip.pause()}return super.pause()}warn(t,r,i={}){warnMethod(this,t,r,i)}}class PackSync extends Pack{sync=true;constructor(t){super(t);this[Ms]=WriteEntrySync}pause(){}resume(){}[ks](r){const i=this.follow?"statSync":"lstatSync";this[bs](r,t[i](r.absolute))}[Cs](r){this[Is](r,t.readdirSync(r.absolute))}[Ns](t){const r=t.entry;const i=this.zip;if(t.readdir){t.readdir.forEach((r=>{const i=t.path;const o=i==="./"?"":i.replace(/\/*$/,"/");this[xs](o+r)}))}if(!r)throw new Error("Cannot pipe without source");if(i){r.on("data",(t=>{i.write(t)}))}else{r.on("data",(t=>{super[js](t)}))}}}const createFileSync=(t,r)=>{const i=new PackSync(t);const o=new WriteStreamSync(t.file,{mode:t.mode||438});i.pipe(o);addFilesSync(i,r)};const createFile=(t,r)=>{const i=new Pack(t);const o=new WriteStream(t.file,{mode:t.mode||438});i.pipe(o);const a=new Promise(((t,r)=>{o.on("error",r);o.on("close",t);i.on("error",r)}));addFilesAsync(i,r);return a};const addFilesSync=(t,r)=>{r.forEach((r=>{if(r.charAt(0)==="@"){qr({file:R.resolve(t.cwd,r.slice(1)),sync:true,noResume:true,onReadEntry:r=>t.add(r)})}else{t.add(r)}}));t.end()};const addFilesAsync=async(t,r)=>{for(let i=0;i<r.length;i++){const o=String(r[i]);if(o.charAt(0)==="@"){await qr({file:R.resolve(String(t.cwd),o.slice(1)),noResume:true,onReadEntry:r=>{t.add(r)}})}else{t.add(o)}}t.end()};const createSync=(t,r)=>{const i=new PackSync(t);addFilesSync(i,r);return i};const createAsync=(t,r)=>{const i=new Pack(t);addFilesAsync(i,r);return i};const Us=makeCommand(createFileSync,createFile,createSync,createAsync,((t,r)=>{if(!r?.length){throw new TypeError("no paths specified to add to archive")}}));const Bs=process.env.__FAKE_PLATFORM__||process.platform;const Hs=Bs==="win32";const{O_CREAT:Vs,O_TRUNC:zs,O_WRONLY:Gs}=t.constants;const qs=Number(process.env.__FAKE_FS_O_FILENAME__)||t.constants.UV_FS_O_FILEMAP||0;const Ws=Hs&&!!qs;const Ks=512*1024;const Ys=qs|zs|Vs|Gs;const Zs=!Ws?()=>"w":t=>t<Ks?Ys:"w";const lchownSync=(t,r,i)=>{try{return $.lchownSync(t,r,i)}catch(t){if(t?.code!=="ENOENT")throw t}};const chown=(t,r,i,o)=>{$.lchown(t,r,i,(t=>{o(t&&t?.code!=="ENOENT"?t:null)}))};const chownrKid=(t,r,i,o,a)=>{if(r.isDirectory()){chownr(R.resolve(t,r.name),i,o,(c=>{if(c)return a(c);const l=R.resolve(t,r.name);chown(l,i,o,a)}))}else{const c=R.resolve(t,r.name);chown(c,i,o,a)}};const chownr=(t,r,i,o)=>{$.readdir(t,{withFileTypes:true},((a,c)=>{if(a){if(a.code==="ENOENT")return o();else if(a.code!=="ENOTDIR"&&a.code!=="ENOTSUP")return o(a)}if(a||!c.length)return chown(t,r,i,o);let l=c.length;let u=null;const then=a=>{if(u)return;if(a)return o(u=a);if(--l===0)return chown(t,r,i,o)};for(const o of c){chownrKid(t,o,r,i,then)}}))};const chownrKidSync=(t,r,i,o)=>{if(r.isDirectory())chownrSync(R.resolve(t,r.name),i,o);lchownSync(R.resolve(t,r.name),i,o)};const chownrSync=(t,r,i)=>{let o;try{o=$.readdirSync(t,{withFileTypes:true})}catch(o){const a=o;if(a?.code==="ENOENT")return;else if(a?.code==="ENOTDIR"||a?.code==="ENOTSUP")return lchownSync(t,r,i);else throw a}for(const a of o){chownrKidSync(t,a,r,i)}return lchownSync(t,r,i)};const optsArg=r=>{if(!r){r={mode:511}}else if(typeof r==="object"){r={mode:511,...r}}else if(typeof r==="number"){r={mode:r}}else if(typeof r==="string"){r={mode:parseInt(r,8)}}else{throw new TypeError("invalid options argument")}const i=r;const o=r.fs||{};r.mkdir=r.mkdir||o.mkdir||t.mkdir;r.mkdirAsync=r.mkdirAsync?r.mkdirAsync:async(t,r)=>new Promise(((o,a)=>i.mkdir(t,r,((t,r)=>t?a(t):o(r)))));r.stat=r.stat||o.stat||t.stat;r.statAsync=r.statAsync?r.statAsync:async t=>new Promise(((r,o)=>i.stat(t,((t,i)=>t?o(t):r(i)))));r.statSync=r.statSync||o.statSync||t.statSync;r.mkdirSync=r.mkdirSync||o.mkdirSync||t.mkdirSync;return i};const mkdirp_manual_mkdirpManualSync=(t,i,o)=>{const a=(0,r.dirname)(t);const c={...optsArg(i),recursive:false};if(a===t){try{return c.mkdirSync(t,c)}catch(t){const r=t;if(r&&r.code!=="EISDIR"){throw t}return}}try{c.mkdirSync(t,c);return o||t}catch(r){const i=r;if(i&&i.code==="ENOENT"){return mkdirp_manual_mkdirpManualSync(t,c,mkdirp_manual_mkdirpManualSync(a,c,o))}if(i&&i.code!=="EEXIST"&&i&&i.code!=="EROFS"){throw r}try{if(!c.statSync(t).isDirectory())throw r}catch(t){throw r}}};const Xs=Object.assign((async(t,i,o)=>{const a=optsArg(i);a.recursive=false;const c=(0,r.dirname)(t);if(c===t){return a.mkdirAsync(t,a).catch((t=>{const r=t;if(r&&r.code!=="EISDIR"){throw t}}))}return a.mkdirAsync(t,a).then((()=>o||t),(async r=>{const i=r;if(i&&i.code==="ENOENT"){return Xs(c,a).then((r=>Xs(t,a,r)))}if(i&&i.code!=="EEXIST"&&i.code!=="EROFS"){throw r}return a.statAsync(t).then((t=>{if(t.isDirectory()){return o}else{throw r}}),(()=>{throw r}))}))}),{sync:mkdirp_manual_mkdirpManualSync});const findMade=async(t,i,o)=>{if(o===i){return}return t.statAsync(i).then((t=>t.isDirectory()?o:undefined),(o=>{const a=o;return a&&a.code==="ENOENT"?findMade(t,(0,r.dirname)(i),i):undefined}))};const findMadeSync=(t,i,o)=>{if(o===i){return undefined}try{return t.statSync(i).isDirectory()?o:undefined}catch(o){const a=o;return a&&a.code==="ENOENT"?findMadeSync(t,(0,r.dirname)(i),i):undefined}};const mkdirp_native_mkdirpNativeSync=(t,i)=>{const o=optsArg(i);o.recursive=true;const a=(0,r.dirname)(t);if(a===t){return o.mkdirSync(t,o)}const c=findMadeSync(o,t);try{o.mkdirSync(t,o);return c}catch(r){const i=r;if(i&&i.code==="ENOENT"){return mkdirp_manual_mkdirpManualSync(t,o)}else{throw r}}};const Js=Object.assign((async(t,i)=>{const o={...optsArg(i),recursive:true};const a=(0,r.dirname)(t);if(a===t){return await o.mkdirAsync(t,o)}return findMade(o,t).then((r=>o.mkdirAsync(t,o).then((t=>r||t)).catch((r=>{const i=r;if(i&&i.code==="ENOENT"){return Xs(t,o)}else{throw r}}))))}),{sync:mkdirp_native_mkdirpNativeSync});const Qs=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform;const pathArg=t=>{if(/\0/.test(t)){throw Object.assign(new TypeError("path must be a string without null bytes"),{path:t,code:"ERR_INVALID_ARG_VALUE"})}t=(0,r.resolve)(t);if(Qs==="win32"){const i=/[*|"<>?:]/;const{root:o}=(0,r.parse)(t);if(i.test(t.substring(o.length))){throw Object.assign(new Error("Illegal characters in path."),{path:t,code:"EINVAL"})}}return t};const en=process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version;const tn=en.replace(/^v/,"").split(".");const rn=+tn[0]>10||+tn[0]===10&&+tn[1]>=12;const sn=!rn?()=>false:r=>optsArg(r).mkdirSync===t.mkdirSync;const nn=Object.assign(!rn?()=>false:r=>optsArg(r).mkdir===t.mkdir,{sync:sn});const mkdirpSync=(t,r)=>{t=pathArg(t);const i=optsArg(r);return sn(i)?mkdirp_native_mkdirpNativeSync(t,i):mkdirp_manual_mkdirpManualSync(t,i)};const on=null&&mkdirpSync;const an=null&&mkdirpManual;const cn=null&&mkdirpManualSync;const ln=null&&mkdirpNative;const un=null&&mkdirpNativeSync;const hn=Object.assign((async(t,r)=>{t=pathArg(t);const i=optsArg(r);return nn(i)?Js(t,i):Xs(t,i)}),{mkdirpSync:mkdirpSync,mkdirpNative:Js,mkdirpNativeSync:mkdirp_native_mkdirpNativeSync,mkdirpManual:Xs,mkdirpManualSync:mkdirp_manual_mkdirpManualSync,sync:mkdirpSync,native:Js,nativeSync:mkdirp_native_mkdirpNativeSync,manual:Xs,manualSync:mkdirp_manual_mkdirpManualSync,useNative:nn,useNativeSync:sn});class CwdError extends Error{path;code;syscall="chdir";constructor(t,r){super(`${r}: Cannot cd into '${t}'`);this.path=t;this.code=r}get name(){return"CwdError"}}class SymlinkError extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(t,r){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link");this.symlink=t;this.path=r}get name(){return"SymlinkError"}}const cGet=(t,r)=>t.get(fr(r));const cSet=(t,r,i)=>t.set(fr(r),i);const checkCwd=(r,i)=>{t.stat(r,((t,o)=>{if(t||!o.isDirectory()){t=new CwdError(r,t?.code||"ENOTDIR")}i(t)}))};const mkdir=(r,i,o)=>{r=fr(r);const a=i.umask??18;const c=i.mode|448;const l=(c&a)!==0;const u=i.uid;const h=i.gid;const d=typeof u==="number"&&typeof h==="number"&&(u!==i.processUid||h!==i.processGid);const p=i.preserve;const m=i.unlink;const g=i.cache;const y=fr(i.cwd);const done=(i,a)=>{if(i){o(i)}else{cSet(g,r,true);if(a&&d){chownr(a,u,h,(t=>done(t)))}else if(l){t.chmod(r,c,o)}else{o()}}};if(g&&cGet(g,r)===true){return done()}if(r===y){return checkCwd(r,done)}if(p){return hn(r,{mode:c}).then((t=>done(null,t??undefined)),done)}const v=fr(R.relative(y,r));const b=v.split("/");mkdir_(y,b,c,g,m,y,undefined,done)};const mkdir_=(r,i,o,a,c,l,u,h)=>{if(!i.length){return h(null,u)}const d=i.shift();const p=fr(R.resolve(r+"/"+d));if(cGet(a,p)){return mkdir_(p,i,o,a,c,l,u,h)}t.mkdir(p,o,onmkdir(p,i,o,a,c,l,u,h))};const onmkdir=(r,i,o,a,c,l,u,h)=>d=>{if(d){t.lstat(r,((p,m)=>{if(p){p.path=p.path&&fr(p.path);h(p)}else if(m.isDirectory()){mkdir_(r,i,o,a,c,l,u,h)}else if(c){t.unlink(r,(d=>{if(d){return h(d)}t.mkdir(r,o,onmkdir(r,i,o,a,c,l,u,h))}))}else if(m.isSymbolicLink()){return h(new SymlinkError(r,r+"/"+i.join("/")))}else{h(d)}}))}else{u=u||r;mkdir_(r,i,o,a,c,l,u,h)}};const checkCwdSync=r=>{let i=false;let o=undefined;try{i=t.statSync(r).isDirectory()}catch(t){o=t?.code}finally{if(!i){throw new CwdError(r,o??"ENOTDIR")}}};const mkdirSync=(r,i)=>{r=fr(r);const o=i.umask??18;const a=i.mode|448;const c=(a&o)!==0;const l=i.uid;const u=i.gid;const h=typeof l==="number"&&typeof u==="number"&&(l!==i.processUid||u!==i.processGid);const d=i.preserve;const p=i.unlink;const m=i.cache;const g=fr(i.cwd);const done=i=>{cSet(m,r,true);if(i&&h){chownrSync(i,l,u)}if(c){t.chmodSync(r,a)}};if(m&&cGet(m,r)===true){return done()}if(r===g){checkCwdSync(g);return done()}if(d){return done(mkdirpSync(r,a)??undefined)}const y=fr(R.relative(g,r));const v=y.split("/");let b=undefined;for(let r=v.shift(),i=g;r&&(i+="/"+r);r=v.shift()){i=fr(R.resolve(i));if(cGet(m,i)){continue}try{t.mkdirSync(i,a);b=b||i;cSet(m,i,true)}catch(r){const o=t.lstatSync(i);if(o.isDirectory()){cSet(m,i,true);continue}else if(p){t.unlinkSync(i);t.mkdirSync(i,a);b=b||i;cSet(m,i,true);continue}else if(o.isSymbolicLink()){return new SymlinkError(i,i+"/"+v.join("/"))}}}return done(b)};const dn=Object.create(null);const{hasOwnProperty:fn}=Object.prototype;const normalizeUnicode=t=>{if(!fn.call(dn,t)){dn[t]=t.normalize("NFD")}return dn[t]};const pn=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform;const mn=pn==="win32";const getDirs=t=>{const r=t.split("/").slice(0,-1).reduce(((t,r)=>{const i=t[t.length-1];if(i!==undefined){r=(0,R.join)(i,r)}t.push(r||"/");return t}),[]);return r};class PathReservations{#y=new Map;#_=new Map;#v=new Set;reserve(t,r){t=mn?["win32 parallelization disabled"]:t.map((t=>stripTrailingSlashes((0,R.join)(normalizeUnicode(t))).toLowerCase()));const i=new Set(t.map((t=>getDirs(t))).reduce(((t,r)=>t.concat(r))));this.#_.set(r,{dirs:i,paths:t});for(const i of t){const t=this.#y.get(i);if(!t){this.#y.set(i,[r])}else{t.push(r)}}for(const t of i){const i=this.#y.get(t);if(!i){this.#y.set(t,[new Set([r])])}else{const t=i[i.length-1];if(t instanceof Set){t.add(r)}else{i.push(new Set([r]))}}}return this.#b(r)}#w(t){const r=this.#_.get(t);if(!r){throw new Error("function does not have any path reservations")}return{paths:r.paths.map((t=>this.#y.get(t))),dirs:[...r.dirs].map((t=>this.#y.get(t)))}}check(t){const{paths:r,dirs:i}=this.#w(t);return r.every((r=>r&&r[0]===t))&&i.every((r=>r&&r[0]instanceof Set&&r[0].has(t)))}#b(t){if(this.#v.has(t)||!this.check(t)){return false}this.#v.add(t);t((()=>this.#E(t)));return true}#E(t){if(!this.#v.has(t)){return false}const r=this.#_.get(t);if(!r){throw new Error("invalid reservation")}const{paths:i,dirs:o}=r;const a=new Set;for(const r of i){const i=this.#y.get(r);if(!i||i?.[0]!==t){continue}const o=i[1];if(!o){this.#y.delete(r);continue}i.shift();if(typeof o==="function"){a.add(o)}else{for(const t of o){a.add(t)}}}for(const r of o){const i=this.#y.get(r);const o=i?.[0];if(!i||!(o instanceof Set))continue;if(o.size===1&&i.length===1){this.#y.delete(r);continue}else if(o.size===1){i.shift();const t=i[0];if(typeof t==="function"){a.add(t)}}else{o.delete(t)}}this.#v.delete(t);a.forEach((t=>this.#b(t)));return true}}const gn=Symbol("onEntry");const yn=Symbol("checkFs");const _n=Symbol("checkFs2");const vn=Symbol("pruneCache");const bn=Symbol("isReusable");const wn=Symbol("makeFs");const En=Symbol("file");const Sn=Symbol("directory");const $n=Symbol("link");const Rn=Symbol("symlink");const Pn=Symbol("hardlink");const On=Symbol("unsupported");const An=Symbol("checkPath");const xn=Symbol("mkdir");const Tn=Symbol("onError");const kn=Symbol("pending");const Cn=Symbol("pend");const In=Symbol("unpend");const Nn=Symbol("ended");const Dn=Symbol("maybeClose");const Ln=Symbol("skip");const Mn=Symbol("doChown");const jn=Symbol("uid");const Fn=Symbol("gid");const Un=Symbol("checkedCwd");const Bn=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform;const Hn=Bn==="win32";const Vn=1024;const unlinkFile=(t,r)=>{if(!Hn){return $.unlink(t,r)}const i=t+".DELETE."+(0,P.randomBytes)(16).toString("hex");$.rename(t,i,(t=>{if(t){return r(t)}$.unlink(i,r)}))};const unlinkFileSync=t=>{if(!Hn){return $.unlinkSync(t)}const r=t+".DELETE."+(0,P.randomBytes)(16).toString("hex");$.renameSync(t,r);$.unlinkSync(r)};const uint32=(t,r,i)=>t!==undefined&&t===t>>>0?t:r!==undefined&&r===r>>>0?r:i;const cacheKeyNormalize=t=>stripTrailingSlashes(fr(normalizeUnicode(t))).toLowerCase();const pruneCache=(t,r)=>{r=cacheKeyNormalize(r);for(const i of t.keys()){const o=cacheKeyNormalize(i);if(o===r||o.indexOf(r+"/")===0){t.delete(i)}}};const dropCache=t=>{for(const r of t.keys()){t.delete(r)}};class Unpack extends Parser{[Nn]=false;[Un]=false;[kn]=0;reservations=new PathReservations;transform;writable=true;readable=false;dirCache;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(t={}){t.ondone=()=>{this[Nn]=true;this[Dn]()};super(t);this.transform=t.transform;this.dirCache=t.dirCache||new Map;this.chmod=!!t.chmod;if(typeof t.uid==="number"||typeof t.gid==="number"){if(typeof t.uid!=="number"||typeof t.gid!=="number"){throw new TypeError("cannot set owner without number uid and gid")}if(t.preserveOwner){throw new TypeError("cannot preserve owner in archive and also set owner explicitly")}this.uid=t.uid;this.gid=t.gid;this.setOwner=true}else{this.uid=undefined;this.gid=undefined;this.setOwner=false}if(t.preserveOwner===undefined&&typeof t.uid!=="number"){this.preserveOwner=!!(process.getuid&&process.getuid()===0)}else{this.preserveOwner=!!t.preserveOwner}this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():undefined;this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():undefined;this.maxDepth=typeof t.maxDepth==="number"?t.maxDepth:Vn;this.forceChown=t.forceChown===true;this.win32=!!t.win32||Hn;this.newer=!!t.newer;this.keep=!!t.keep;this.noMtime=!!t.noMtime;this.preservePaths=!!t.preservePaths;this.unlink=!!t.unlink;this.cwd=fr(R.resolve(t.cwd||process.cwd()));this.strip=Number(t.strip)||0;this.processUmask=!this.chmod?0:typeof t.processUmask==="number"?t.processUmask:process.umask();this.umask=typeof t.umask==="number"?t.umask:this.processUmask;this.dmode=t.dmode||511&~this.umask;this.fmode=t.fmode||438&~this.umask;this.on("entry",(t=>this[gn](t)))}warn(t,r,i={}){if(t==="TAR_BAD_ARCHIVE"||t==="TAR_ABORT"){i.recoverable=false}return super.warn(t,r,i)}[Dn](){if(this[Nn]&&this[kn]===0){this.emit("prefinish");this.emit("finish");this.emit("end")}}[An](t){const r=fr(t.path);const i=r.split("/");if(this.strip){if(i.length<this.strip){return false}if(t.type==="Link"){const r=fr(String(t.linkpath)).split("/");if(r.length>=this.strip){t.linkpath=r.slice(this.strip).join("/")}else{return false}}i.splice(0,this.strip);t.path=i.join("/")}if(isFinite(this.maxDepth)&&i.length>this.maxDepth){this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:t,path:r,depth:i.length,maxDepth:this.maxDepth});return false}if(!this.preservePaths){if(i.includes("..")||Hn&&/^[a-z]:\.\.$/i.test(i[0]??"")){this.warn("TAR_ENTRY_ERROR",`path contains '..'`,{entry:t,path:r});return false}const[o,a]=stripAbsolutePath(r);if(o){t.path=String(a);this.warn("TAR_ENTRY_INFO",`stripping ${o} from absolute path`,{entry:t,path:r})}}if(R.isAbsolute(t.path)){t.absolute=fr(R.resolve(t.path))}else{t.absolute=fr(R.resolve(this.cwd,t.path))}if(!this.preservePaths&&typeof t.absolute==="string"&&t.absolute.indexOf(this.cwd+"/")!==0&&t.absolute!==this.cwd){this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:t,path:fr(t.path),resolvedPath:t.absolute,cwd:this.cwd});return false}if(t.absolute===this.cwd&&t.type!=="Directory"&&t.type!=="GNUDumpDir"){return false}if(this.win32){const{root:r}=R.win32.parse(String(t.absolute));t.absolute=r+winchars_encode(String(t.absolute).slice(r.length));const{root:i}=R.win32.parse(t.path);t.path=i+winchars_encode(t.path.slice(i.length))}return true}[gn](t){if(!this[An](t)){return t.resume()}O.equal(typeof t.absolute,"string");switch(t.type){case"Directory":case"GNUDumpDir":if(t.mode){t.mode=t.mode|448}case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[yn](t);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[On](t)}}[Tn](t,r){if(t.name==="CwdError"){this.emit("error",t)}else{this.warn("TAR_ENTRY_ERROR",t,{entry:r});this[In]();r.resume()}}[xn](t,r,i){mkdir(fr(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:r},i)}[Mn](t){return this.forceChown||this.preserveOwner&&(typeof t.uid==="number"&&t.uid!==this.processUid||typeof t.gid==="number"&&t.gid!==this.processGid)||typeof this.uid==="number"&&this.uid!==this.processUid||typeof this.gid==="number"&&this.gid!==this.processGid}[jn](t){return uint32(this.uid,t.uid,this.processUid)}[Fn](t){return uint32(this.gid,t.gid,this.processGid)}[En](t,r){const i=typeof t.mode==="number"?t.mode&4095:this.fmode;const o=new WriteStream(String(t.absolute),{flags:Zs(t.size),mode:i,autoClose:false});o.on("error",(i=>{if(o.fd){$.close(o.fd,(()=>{}))}o.write=()=>true;this[Tn](i,t);r()}));let a=1;const done=i=>{if(i){if(o.fd){$.close(o.fd,(()=>{}))}this[Tn](i,t);r();return}if(--a===0){if(o.fd!==undefined){$.close(o.fd,(i=>{if(i){this[Tn](i,t)}else{this[In]()}r()}))}}};o.on("finish",(()=>{const r=String(t.absolute);const i=o.fd;if(typeof i==="number"&&t.mtime&&!this.noMtime){a++;const o=t.atime||new Date;const c=t.mtime;$.futimes(i,o,c,(t=>t?$.utimes(r,o,c,(r=>done(r&&t))):done()))}if(typeof i==="number"&&this[Mn](t)){a++;const o=this[jn](t);const c=this[Fn](t);if(typeof o==="number"&&typeof c==="number"){$.fchown(i,o,c,(t=>t?$.chown(r,o,c,(r=>done(r&&t))):done()))}}done()}));const c=this.transform?this.transform(t)||t:t;if(c!==t){c.on("error",(i=>{this[Tn](i,t);r()}));t.pipe(c)}c.pipe(o)}[Sn](t,r){const i=typeof t.mode==="number"?t.mode&4095:this.dmode;this[xn](String(t.absolute),i,(i=>{if(i){this[Tn](i,t);r();return}let o=1;const done=()=>{if(--o===0){r();this[In]();t.resume()}};if(t.mtime&&!this.noMtime){o++;$.utimes(String(t.absolute),t.atime||new Date,t.mtime,done)}if(this[Mn](t)){o++;$.chown(String(t.absolute),Number(this[jn](t)),Number(this[Fn](t)),done)}done()}))}[On](t){t.unsupported=true;this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${t.type}`,{entry:t});t.resume()}[Rn](t,r){this[$n](t,String(t.linkpath),"symlink",r)}[Pn](t,r){const i=fr(R.resolve(this.cwd,String(t.linkpath)));this[$n](t,i,"link",r)}[Cn](){this[kn]++}[In](){this[kn]--;this[Dn]()}[Ln](t){this[In]();t.resume()}[bn](t,r){return t.type==="File"&&!this.unlink&&r.isFile()&&r.nlink<=1&&!Hn}[yn](t){this[Cn]();const r=[t.path];if(t.linkpath){r.push(t.linkpath)}this.reservations.reserve(r,(r=>this[_n](t,r)))}[vn](t){if(t.type==="SymbolicLink"){dropCache(this.dirCache)}else if(t.type!=="Directory"){pruneCache(this.dirCache,String(t.absolute))}}[_n](t,r){this[vn](t);const done=i=>{this[vn](t);r(i)};const checkCwd=()=>{this[xn](this.cwd,this.dmode,(r=>{if(r){this[Tn](r,t);done();return}this[Un]=true;start()}))};const start=()=>{if(t.absolute!==this.cwd){const r=fr(R.dirname(String(t.absolute)));if(r!==this.cwd){return this[xn](r,this.dmode,(r=>{if(r){this[Tn](r,t);done();return}afterMakeParent()}))}}afterMakeParent()};const afterMakeParent=()=>{$.lstat(String(t.absolute),((r,i)=>{if(i&&(this.keep||this.newer&&i.mtime>(t.mtime??i.mtime))){this[Ln](t);done();return}if(r||this[bn](t,i)){return this[wn](null,t,done)}if(i.isDirectory()){if(t.type==="Directory"){const r=this.chmod&&t.mode&&(i.mode&4095)!==t.mode;const afterChmod=r=>this[wn](r??null,t,done);if(!r){return afterChmod()}return $.chmod(String(t.absolute),Number(t.mode),afterChmod)}if(t.absolute!==this.cwd){return $.rmdir(String(t.absolute),(r=>this[wn](r??null,t,done)))}}if(t.absolute===this.cwd){return this[wn](null,t,done)}unlinkFile(String(t.absolute),(r=>this[wn](r??null,t,done)))}))};if(this[Un]){start()}else{checkCwd()}}[wn](t,r,i){if(t){this[Tn](t,r);i();return}switch(r.type){case"File":case"OldFile":case"ContiguousFile":return this[En](r,i);case"Link":return this[Pn](r,i);case"SymbolicLink":return this[Rn](r,i);case"Directory":case"GNUDumpDir":return this[Sn](r,i)}}[$n](t,r,i,o){$[i](r,String(t.absolute),(r=>{if(r){this[Tn](r,t)}else{this[In]();t.resume()}o()}))}}const callSync=t=>{try{return[null,t()]}catch(t){return[t,null]}};class UnpackSync extends Unpack{sync=true;[wn](t,r){return super[wn](t,r,(()=>{}))}[yn](t){this[vn](t);if(!this[Un]){const r=this[xn](this.cwd,this.dmode);if(r){return this[Tn](r,t)}this[Un]=true}if(t.absolute!==this.cwd){const r=fr(R.dirname(String(t.absolute)));if(r!==this.cwd){const i=this[xn](r,this.dmode);if(i){return this[Tn](i,t)}}}const[r,i]=callSync((()=>$.lstatSync(String(t.absolute))));if(i&&(this.keep||this.newer&&i.mtime>(t.mtime??i.mtime))){return this[Ln](t)}if(r||this[bn](t,i)){return this[wn](null,t)}if(i.isDirectory()){if(t.type==="Directory"){const r=this.chmod&&t.mode&&(i.mode&4095)!==t.mode;const[o]=r?callSync((()=>{$.chmodSync(String(t.absolute),Number(t.mode))})):[];return this[wn](o,t)}const[r]=callSync((()=>$.rmdirSync(String(t.absolute))));this[wn](r,t)}const[o]=t.absolute===this.cwd?[]:callSync((()=>unlinkFileSync(String(t.absolute))));this[wn](o,t)}[En](t,r){const i=typeof t.mode==="number"?t.mode&4095:this.fmode;const oner=i=>{let a;try{$.closeSync(o)}catch(t){a=t}if(i||a){this[Tn](i||a,t)}r()};let o;try{o=$.openSync(String(t.absolute),Zs(t.size),i)}catch(t){return oner(t)}const a=this.transform?this.transform(t)||t:t;if(a!==t){a.on("error",(r=>this[Tn](r,t)));t.pipe(a)}a.on("data",(t=>{try{$.writeSync(o,t,0,t.length)}catch(t){oner(t)}}));a.on("end",(()=>{let r=null;if(t.mtime&&!this.noMtime){const i=t.atime||new Date;const a=t.mtime;try{$.futimesSync(o,i,a)}catch(o){try{$.utimesSync(String(t.absolute),i,a)}catch(t){r=o}}}if(this[Mn](t)){const i=this[jn](t);const a=this[Fn](t);try{$.fchownSync(o,Number(i),Number(a))}catch(o){try{$.chownSync(String(t.absolute),Number(i),Number(a))}catch(t){r=r||o}}}oner(r)}))}[Sn](t,r){const i=typeof t.mode==="number"?t.mode&4095:this.dmode;const o=this[xn](String(t.absolute),i);if(o){this[Tn](o,t);r();return}if(t.mtime&&!this.noMtime){try{$.utimesSync(String(t.absolute),t.atime||new Date,t.mtime)}catch(o){}}if(this[Mn](t)){try{$.chownSync(String(t.absolute),Number(this[jn](t)),Number(this[Fn](t)))}catch(o){}}r();t.resume()}[xn](t,r){try{return mkdirSync(fr(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:r})}catch(t){return t}}[$n](t,r,i,o){const a=`${i}Sync`;try{$[a](r,String(t.absolute));o();t.resume()}catch(r){return this[Tn](r,t)}}}const extractFileSync=t=>{const r=new UnpackSync(t);const i=t.file;const o=$.statSync(i);const a=t.maxReadSize||16*1024*1024;const c=new ReadStreamSync(i,{readSize:a,size:o.size});c.pipe(r)};const extractFile=(t,r)=>{const i=new Unpack(t);const o=t.maxReadSize||16*1024*1024;const a=t.file;const c=new Promise(((t,r)=>{i.on("error",r);i.on("close",t);$.stat(a,((t,c)=>{if(t){r(t)}else{const t=new ReadStream(a,{readSize:o,size:c.size});t.on("error",r);t.pipe(i)}}))}));return c};const zn=makeCommand(extractFileSync,extractFile,(t=>new UnpackSync(t)),(t=>new Unpack(t)),((t,r)=>{if(r?.length)filesFilter(t,r)}));const replaceSync=(t,r)=>{const i=new PackSync(t);let o=true;let a;let c;try{try{a=$.openSync(t.file,"r+")}catch(r){if(r?.code==="ENOENT"){a=$.openSync(t.file,"w+")}else{throw r}}const l=$.fstatSync(a);const u=Buffer.alloc(512);e:for(c=0;c<l.size;c+=512){for(let t=0,r=0;t<512;t+=r){r=$.readSync(a,u,t,u.length-t,c+t);if(c===0&&u[0]===31&&u[1]===139){throw new Error("cannot append to compressed archives")}if(!r){break e}}const r=new Header(u);if(!r.cksumValid){break}const i=512*Math.ceil((r.size||0)/512);if(c+i+512>l.size){break}c+=i;if(t.mtimeCache&&r.mtime){t.mtimeCache.set(String(r.path),r.mtime)}}o=false;streamSync(t,i,c,a,r)}finally{if(o){try{$.closeSync(a)}catch(t){}}}};const streamSync=(t,r,i,o,a)=>{const c=new WriteStreamSync(t.file,{fd:o,start:i});r.pipe(c);replace_addFilesSync(r,a)};const replaceAsync=(t,r)=>{r=Array.from(r);const i=new Pack(t);const getPos=(r,i,o)=>{const cb=(t,i)=>{if(t){$.close(r,(r=>o(t)))}else{o(null,i)}};let a=0;if(i===0){return cb(null,0)}let c=0;const l=Buffer.alloc(512);const onread=(o,u)=>{if(o||typeof u==="undefined"){return cb(o)}c+=u;if(c<512&&u){return $.read(r,l,c,l.length-c,a+c,onread)}if(a===0&&l[0]===31&&l[1]===139){return cb(new Error("cannot append to compressed archives"))}if(c<512){return cb(null,a)}const h=new Header(l);if(!h.cksumValid){return cb(null,a)}const d=512*Math.ceil((h.size??0)/512);if(a+d+512>i){return cb(null,a)}a+=d+512;if(a>=i){return cb(null,a)}if(t.mtimeCache&&h.mtime){t.mtimeCache.set(String(h.path),h.mtime)}c=0;$.read(r,l,0,512,a,onread)};$.read(r,l,0,512,a,onread)};const o=new Promise(((o,a)=>{i.on("error",a);let c="r+";const onopen=(l,u)=>{if(l&&l.code==="ENOENT"&&c==="r+"){c="w+";return $.open(t.file,c,onopen)}if(l||!u){return a(l)}$.fstat(u,((c,l)=>{if(c){return $.close(u,(()=>a(c)))}getPos(u,l.size,((c,l)=>{if(c){return a(c)}const h=new WriteStream(t.file,{fd:u,start:l});i.pipe(h);h.on("error",a);h.on("close",o);replace_addFilesAsync(i,r)}))}))};$.open(t.file,c,onopen)}));return o};const replace_addFilesSync=(t,r)=>{r.forEach((r=>{if(r.charAt(0)==="@"){qr({file:R.resolve(t.cwd,r.slice(1)),sync:true,noResume:true,onReadEntry:r=>t.add(r)})}else{t.add(r)}}));t.end()};const replace_addFilesAsync=async(t,r)=>{for(let i=0;i<r.length;i++){const o=String(r[i]);if(o.charAt(0)==="@"){await qr({file:R.resolve(String(t.cwd),o.slice(1)),noResume:true,onReadEntry:r=>t.add(r)})}else{t.add(o)}}t.end()};const Gn=makeCommand(replaceSync,replaceAsync,(()=>{throw new TypeError("file is required")}),(()=>{throw new TypeError("file is required")}),((t,r)=>{if(!isFile(t)){throw new TypeError("file is required")}if(t.gzip||t.brotli||t.file.endsWith(".br")||t.file.endsWith(".tbr")){throw new TypeError("cannot append to compressed archives")}if(!r?.length){throw new TypeError("no paths specified to add/replace")}}));const qn=makeCommand(Gn.syncFile,Gn.asyncFile,Gn.syncNoFile,Gn.asyncNoFile,((t,r=[])=>{Gn.validate?.(t,r);mtimeFilter(t)}));const mtimeFilter=t=>{const r=t.filter;if(!t.mtimeCache){t.mtimeCache=new Map}t.filter=r?(i,o)=>r(i,o)&&!((t.mtimeCache?.get(i)??o.mtime??0)>(o.mtime??0)):(r,i)=>!((t.mtimeCache?.get(r)??i.mtime??0)>(i.mtime??0))};async function isUrlOk(t){try{const r=await fetch(t,{method:"HEAD"});return r.status===200}catch{return false}}async function getRepoInfo(t,r){const[,i,o,a,c,...l]=t.pathname.split("/");const u=r?r.replace(/^\//,""):l.join("/");if(a===undefined||a===""&&c===undefined){try{const t=await fetch(`https://api.github.com/repos/${i}/${o}`);if(t.status!==200){return}const r=await t.json();return{username:i,name:o,branch:r["default_branch"],filePath:u}}catch{return}}const h=r?`${c}/${l.join("/")}`.replace(new RegExp(`/${u}|/$`),""):c;if(i&&o&&h&&a==="tree"){return{username:i,name:o,branch:h,filePath:u}}}function hasRepo({username:t,name:r,branch:i,filePath:o}){const a=`https://api.github.com/repos/${t}/${r}/contents`;const c=`${o?`/${o}`:""}/package.json`;return isUrlOk(a+c+`?ref=${i}`)}function existsInRepo(t){try{const r=new URL(t);return isUrlOk(r.href)}catch{return isUrlOk(`https://api.github.com/repos/zuplo/zuplo/contents/examples/${encodeURIComponent(t)}`)}}async function downloadTarStream(t,r=50*1024*1024){const i=await fetch(t);if(!i.body){throw new Error(`Failed to download: ${t}`)}const o=i.headers.get("content-length");if(o&&parseInt(o)>r){throw new Error(`File too large! ${o} bytes exceeds limit of ${r} bytes`)}const a=i.body;const c=je.Readable.fromWeb(a);let l=0;const u=new je.Transform({transform(t,i,o){l+=t.length;if(l>r){return o(new Error(`Download aborted! File size exceeded ${r} bytes`))}o(null,t)}});return c.pipe(u)}async function downloadAndExtractRepo(t,{username:r,name:i,branch:o,filePath:a}){let c=null;await(0,Fe.pipeline)(await downloadTarStream(`https://codeload.github.com/${r}/${i}/tar.gz/${o}`),zn({cwd:t,strip:a?a.split("/").length+1:1,filter:t=>{if(c===null){const r=t.split(R.sep);c=r.length?r[0]:null}return t.startsWith(`${c}${a?`/${a}/`:"/"}`)}}))}async function downloadAndExtractExample(t,r){if(r==="__internal-testing-retry"){throw new Error("This is an internal example for testing the CLI.")}await(0,Fe.pipeline)(await downloadTarStream("https://codeload.github.com/zuplo/zuplo/tar.gz/main"),zn({cwd:t,strip:2+r.split("/").length,filter:t=>t.includes(`zuplo-main/examples/${r}/`)}))}var Wn=__nccwpck_require__(1421);function isInGitRepository(){try{(0,Wn.execSync)("git rev-parse --is-inside-work-tree",{stdio:"ignore"});return true}catch{}return false}function isInMercurialRepository(){try{(0,Wn.execSync)("hg --cwd . root",{stdio:"ignore"});return true}catch{}return false}function isDefaultBranchSet(){try{(0,Wn.execSync)("git config init.defaultBranch",{stdio:"ignore"});return true}catch{}return false}function tryGitInit(t){let r=false;try{(0,Wn.execSync)("git --version",{stdio:"ignore"});if(isInGitRepository()||isInMercurialRepository()){return false}(0,Wn.execSync)("git init",{stdio:"ignore"});r=true;if(!isDefaultBranchSet()){(0,Wn.execSync)("git checkout -b main",{stdio:"ignore"})}(0,Wn.execSync)("git add -A",{stdio:"ignore"});(0,Wn.execSync)('git commit -m "Initial commit from Create Next App"',{stdio:"ignore"});return true}catch{if(r){try{(0,$.rmSync)((0,R.join)(t,".git"),{recursive:true,force:true})}catch{}}return false}}var Kn=__nccwpck_require__(4422);var Yn=__nccwpck_require__.n(Kn);async function install(t,r){const i=["install"];if(!r){console.log((0,ke.yellow)("You appear to be offline.\nFalling back to the local cache."));i.push("--offline")}return new Promise(((r,o)=>{const a=Yn()(t,i,{stdio:"inherit",env:{...process.env,ADBLOCK:"1",NODE_ENV:"development",DISABLE_OPENCOLLECTIVE:"1"}});a.on("close",(a=>{if(a!==0){o({command:`${t} ${i.join(" ")}`});return}r()}))}))}function isFolderEmpty(t,r){const i=[".DS_Store",".git",".gitattributes",".gitignore",".gitlab-ci.yml",".hg",".hgcheck",".hgignore",".idea",".npmignore",".travis.yml","LICENSE","Thumbs.db","docs","mkdocs.yml","npm-debug.log","yarn-debug.log","yarn-error.log","yarnrc.yml",".yarn"];const o=(0,$.readdirSync)(t).filter((t=>!i.includes(t)&&!/\.iml$/.test(t)));if(o.length>0){console.log(`The directory ${(0,ke.green)(r)} contains files that could conflict:`);console.log();for(const r of o){try{const i=(0,$.lstatSync)((0,R.join)(t,r));if(i.isDirectory()){console.log(` ${(0,ke.blue)(r)}/`)}else{console.log(` ${r}`)}}catch{console.log(` ${r}`)}}console.log();console.log("Either try using a new directory name, or remove the files listed above.");console.log();return false}return true}const Zn=require("node:dns/promises");const Xn=require("node:url");var Jn=__nccwpck_require__.n(Xn);function getProxy(){if(process.env.https_proxy){return process.env.https_proxy}try{const t=(0,Wn.execSync)("npm config get https-proxy").toString().trim();return t!=="null"?t:undefined}catch{return}}async function getOnline(){try{await(0,Zn.lookup)("registry.yarnpkg.com");return true}catch{const t=getProxy();if(!t){return false}const{hostname:r}=Jn().parse(t);if(!r){return false}try{await(0,Zn.lookup)(r);return true}catch{return false}}}const Qn=require("node:constants");const ei=require("node:fs/promises");async function isWriteable(t){try{await(0,ei.access)(t,Qn.W_OK);return true}catch{return false}}const ti=require("fs/promises");var ri=__nccwpck_require__.n(ti);var si=__nccwpck_require__(857);var ni=__nccwpck_require__.n(si);var ii=__nccwpck_require__(484);const identity=t=>t;const copy=async(t,r,{cwd:i,rename:o=identity,parents:a=true}={})=>{const c=typeof t==="string"?[t]:t;if(c.length===0||!r){throw new TypeError("`src` and `dest` are required")}const l=await(0,ii.async)(c,{cwd:i,dot:true,absolute:false,stats:false});const u=i?(0,R.resolve)(i,r):r;return Promise.all(l.map((async t=>{const r=(0,R.dirname)(t);const c=o((0,R.basename)(t),t);const l=i?(0,R.resolve)(i,t):t;const h=a?(0,R.join)(u,r,c):(0,R.join)(u,c);await(0,ei.mkdir)((0,R.dirname)(h),{recursive:true});return(0,ei.copyFile)(l,h)})))};const getTemplateFile=({template:t,file:r})=>__nccwpck_require__.ab+"templates/"+t+"/"+r;const installTemplate=async({appName:r,root:o,packageManager:a,isOnline:c,template:l,eslint:u,prettier:h,installPackages:d,zuploVersion:p})=>{var m;console.log((0,ke.bold)(`Using ${a}.`));console.log("\nInitializing project with template:",l,"\n");const g=__nccwpck_require__.ab+"templates/"+l;const y=["**","!vscode/**"];if(!u)y.push("!eslintrc.json");if(!h)y.push("!prettierrc.json");await copy(y,o,{parents:true,cwd:g,rename(t){switch(t){case"gitignore":case"eslintrc.json":case"prettierrc.json":{return`.${t}`}case"README-template.md":{return"README.md"}default:{return t}}}});const v=["settings.json","launch.json"];for(const r of v){const a=i().join(g,"vscode",r);const c=i().join(o,".vscode",r);if((0,t.existsSync)(a)){await ri().mkdir(i().join(o,".vscode"),{recursive:true});await ri().copyFile(a,c)}}const b=(m=process.env.ZUPLO_PRIVATE_TEST_VERSION)!==null&&m!==void 0?m:p;const w=new _e.SemVer(b);const E={name:r,version:"0.1.0",type:"module",private:true,scripts:{dev:`zuplo dev`,test:"zuplo test",docs:"npm run dev --workspace docs",...u?{lint:"eslint"}:{}},dependencies:{zuplo:`^${w.major}`},devDependencies:{typescript:"^5","@types/node":"^22"}};if(u){E.devDependencies={...E.devDependencies,eslint:"^8","@typescript-eslint/eslint-plugin":"^8","@typescript-eslint/parser":"^8"}}if(h){E.devDependencies={...E.devDependencies,prettier:"^3"}}if(u&&h){E.devDependencies={...E.devDependencies,"eslint-config-prettier":"^9"};const t=i().join(o,".eslintrc.json");const r=await ri().readFile(t,"utf-8").then(JSON.parse);r.extends.push("prettier");await ri().writeFile(t,JSON.stringify(r,null,2)+ni().EOL,"utf-8")}E.workspaces=["docs"];const sortObjectKeys=t=>Object.keys(t).sort().reduce(((r,i)=>{r[i]=t[i];return r}),{});if(E.dependencies){E.dependencies=sortObjectKeys(E.dependencies)}if(E.devDependencies){E.devDependencies=sortObjectKeys(E.devDependencies)}const S=Object.keys(E.devDependencies).length;if(!S)delete E.devDependencies;await ri().writeFile(i().join(o,"package.json"),JSON.stringify(E,null,2)+ni().EOL);let $="^0.53";try{const t=await fetch("https://api.github.com/repos/zuplo/zudoku/releases/latest");const r=await t.json();const i=r.tag_name.replace("v","");const o=new _e.SemVer(i);$=`^${o.major}.${o.minor}`}catch{console.warn("\nFailed to determine the latest dev portal version. Using the default version.")}const R={name:"docs",version:"0.1.0",type:"module",private:true,scripts:{dev:"zudoku dev --zuplo",build:"zudoku build --zuplo",...u?{lint:"eslint"}:{}},dependencies:{react:"^19","react-dom":"^19","@mdx-js/react":"3.0.1",zudoku:$},devDependencies:{"@types/node":"^22","@types/react":"^19","@types/react-dom":"^19",typescript:"^5"}};await ri().writeFile(i().join(o,"docs","package.json"),JSON.stringify(R,null,2)+ni().EOL);if(!d)return;console.log("\nInstalling dependencies:");for(const t in E.dependencies)console.log(`- ${(0,ke.cyan)(t)}`);if(S){console.log("\nInstalling devDependencies:");for(const t in E.devDependencies)console.log(`- ${(0,ke.cyan)(t)}`)}console.log();await install(a,c)};class DownloadError extends Error{}async function createApp({appPath:i,packageManager:o,example:a,examplePath:c,eslint:l,prettier:u,installPackages:h,empty:d,initGit:p,zuploVersion:m}){let g;const y=`default${d?"-empty":""}`;if(a){let O;try{O=new URL(a)}catch(A){const x=A;if(x.code!=="ERR_INVALID_URL"){console.error(A);process.exit(1)}}if(O){if(O.origin!=="https://github.com"){console.error(`Invalid URL: ${(0,ke.red)(`"${a}"`)}. Only GitHub repositories are supported. Please use a GitHub URL and try again.`);process.exit(1)}g=await getRepoInfo(O,c);if(!g){console.error(`Found invalid GitHub URL: ${(0,ke.red)(`"${a}"`)}. Please fix the URL and try again.`);process.exit(1)}const T=await hasRepo(g);if(!T){console.error(`Could not locate the repository for ${(0,ke.red)(`"${a}"`)}. Please check that the repository exists and try again.`);process.exit(1)}}else if(a!=="__internal-testing-retry"){const k=await existsInRepo(a);if(!k){console.error(`Could not locate an example named ${(0,ke.red)(`"${a}"`)}. It could be due to the following:\n`,`1. Your spelling of example ${(0,ke.red)(`"${a}"`)} might be incorrect.\n`,`2. You might not be connected to the internet or you are behind a proxy.`);process.exit(1)}}}const v=(0,r.resolve)(i);if(!await isWriteable((0,r.dirname)(v))){console.error("The application path is not writable, please check folder permissions and try again.");console.error("It is likely you do not have write permissions for this folder.");process.exit(1)}const b=(0,r.basename)(v);(0,t.mkdirSync)(v,{recursive:true});if(!isFolderEmpty(v,b)){process.exit(1)}const w=o==="yarn";const E=!w||await getOnline();const S=process.cwd();console.log(`Creating a new Zuplo API in ${(0,ke.green)(v)}.`);console.log();process.chdir(v);const $=(0,r.join)(v,"package.json");let R=false;if(a){try{if(g){const I=g;console.log(`Downloading files from repo ${(0,ke.cyan)(a)}. This might take a moment.`);console.log();await Me()((()=>downloadAndExtractRepo(v,I)),{retries:3})}else{console.log(`Downloading files for example ${(0,ke.cyan)(a)}. This might take a moment.`);console.log();await Me()((()=>downloadAndExtractExample(v,a)),{retries:3})}}catch(N){function isErrorLike(t){return typeof t==="object"&&t!==null&&typeof t.message==="string"}throw new DownloadError(isErrorLike(N)?N.message:N+"")}const C=(0,r.join)(v,".gitignore");if(!(0,t.existsSync)(C)){(0,t.copyFileSync)(getTemplateFile({template:y,file:"gitignore"}),C)}R=(0,t.existsSync)($);if(h&&R){console.log("Installing packages. This might take a couple of minutes.");console.log();await install(o,E);console.log()}}else{await installTemplate({appName:b,root:v,template:y,packageManager:o,isOnline:E,eslint:l,prettier:u,installPackages:h,zuploVersion:m})}if(p){if(tryGitInit(v)){console.log("Initialized a git repository.");console.log()}}let P;if((0,r.join)(S,b)===i){P=b}else{P=i}console.log(`${(0,ke.green)("Success!")} Created ${b} at ${i}`);if(R){console.log("Inside that directory, you can run several commands:");console.log();console.log((0,ke.cyan)(` ${o} ${w?"":"run "}dev`));console.log(" Starts the development server.");console.log();console.log((0,ke.cyan)(` ${o} ${w?"":"run "}build`));console.log(" Builds the app for production.");console.log();console.log((0,ke.cyan)(` ${o} start`));console.log(" Runs the built app in production mode.");console.log();console.log("We suggest that you begin by typing:");console.log();console.log((0,ke.cyan)(" cd"),P);console.log(` ${(0,ke.cyan)(`${o} ${w?"":"run "}dev`)}`)}console.log()}function getPkgManager(){var t;const r=(t=process.env.npm_config_user_agent)!==null&&t!==void 0?t:"";if(r.startsWith("yarn")){return"yarn"}if(r.startsWith("pnpm")){return"pnpm"}if(r.startsWith("bun")){return"bun"}return"npm"}var oi=__nccwpck_require__(2544);var ai=__nccwpck_require__.n(oi);function validateNpmName(t){const r=ai()(t);if(r.validForNewPackages){return{valid:true}}return{valid:false,problems:[...r.errors||[],...r.warnings||[]]}}let ci="";const handleSigTerm=()=>process.exit(0);process.on("SIGINT",handleSigTerm);process.on("SIGTERM",handleSigTerm);const onPromptState=t=>{if(t.aborted){process.stdout.write("[?25h");process.stdout.write("\n");process.exit(1)}};const li=JSON.parse((0,t.readFileSync)(i().resolve(__dirname,i().join("..","package.json")),"utf-8"));const ui=new y(li.name).version(li.version,"-v, --version","Output the current version of create-zuplo-api.").argument("[directory]").usage("[directory] [options]").helpOption("-h, --help","Display this help message.").option("--eslint","Initialize with ESLint config.").option("--prettier","Initialize with Prettier config.").option("--empty","Initialize an empty project.").option("--use-npm","Explicitly tell the CLI to bootstrap the application using npm.").option("--use-pnpm","Explicitly tell the CLI to bootstrap the application using pnpm.").option("--use-yarn","Explicitly tell the CLI to bootstrap the application using Yarn.").option("--use-bun","Explicitly tell the CLI to bootstrap the application using Bun.").option("--reset, --reset-preferences","Reset the preferences saved for create-zuplo-api.").option("--git","Whether or not to initialize the project as a git repo.").option("--version-check","Whether or not to check for an outdated version.").option("--install","Whether or not to install packages.").option("--yes","Use saved preferences or defaults for unprovided options.").option("-e, --example <example-name|github-url>",`\n\n An example to bootstrap the api with. You can use an example name\n from the official Zuplo repo or a public GitHub URL. The URL can use\n any branch and/or subdirectory.\n`).option("--example-path <path-to-example>",`\n\n In a rare case, your GitHub URL might contain a branch name with\n a slash (e.g. bug/fix-1) and the path to the example (e.g. foo/bar).\n In this case, you must specify the path to the example separately:\n --example-path foo/bar\n`).action((t=>{if(t&&!t.startsWith("--no-")){ci=t}})).allowUnknownOption().parse(process.argv);const hi=ui.opts();const{args:di}=ui;const fi=hi.useNpm?"npm":hi.usePnpm?"pnpm":hi.useYarn?"yarn":hi.useBun?"bun":getPkgManager();async function run(){var i,o,c;const l=new Conf({projectName:"create-zuplo-api"});if(hi.resetPreferences){const{resetPreferences:t}=await Ie()({onState:onPromptState,type:"toggle",name:"resetPreferences",message:"Would you like to reset the saved preferences?",initial:false,active:"Yes",inactive:"No"});if(t){l.clear();console.log("The preferences have been reset successfully!")}process.exit(0)}if(typeof ci==="string"){ci=ci.trim()}if(!ci){const t=await Ie()({onState:onPromptState,type:"text",name:"path",message:"What is your project named?",initial:"my-api",validate:t=>{const i=validateNpmName((0,r.basename)((0,r.resolve)(t)));if(i.valid){return true}return"Invalid project name: "+i.problems[0]}});if(typeof t.path==="string"){ci=t.path.trim()}}if(!ci){console.log("\nPlease specify the project directory:\n"+` ${(0,ke.cyan)(hi.name())} ${(0,ke.green)("<project-directory>")}\n`+"For example:\n"+` ${(0,ke.cyan)(hi.name())} ${(0,ke.green)("my-zuplo-api")}\n\n`+`Run ${(0,ke.cyan)(`${hi.name()} --help`)} to see all options.`);process.exit(1)}const u=(0,r.resolve)(ci);const h=(0,r.basename)(u);const d=validateNpmName(h);if(!d.valid){console.error(`Could not create a project called ${(0,ke.red)(`"${h}"`)} because of npm naming restrictions:`);d.problems.forEach((t=>console.error(` ${(0,ke.red)((0,ke.bold)("*"))} ${t}`)));process.exit(1)}if(hi.example===true){console.error("Please provide an example name or url, otherwise remove the example option.");process.exit(1)}if((0,t.existsSync)(u)&&!isFolderEmpty(u,h)){process.exit(1)}const p=typeof hi.example==="string"&&hi.example.trim();const m=l.get("preferences")||{};const g=a().isCI||hi.yes;if(!p){const t={eslint:true,prettier:true,git:true,install:true,versionCheck:true,empty:false,zudoku:false};const getPrefOrDefault=r=>{var i;return(i=m[r])!==null&&i!==void 0?i:t[r]};if(!hi.eslint&&!di.includes("--no-eslint")){if(g){hi.eslint=getPrefOrDefault("eslint")}else{const t=(0,ke.blue)("ESLint");const{eslint:r}=await Ie()({onState:onPromptState,type:"toggle",name:"eslint",message:`Would you like to use ${t}?`,initial:getPrefOrDefault("eslint"),active:"Yes",inactive:"No"});hi.eslint=Boolean(r);m.eslint=Boolean(r)}}if(!hi.prettier&&!di.includes("--no-prettier")){if(g){hi.prettier=getPrefOrDefault("prettier")}else{const t=(0,ke.blue)("Prettier");const{prettier:r}=await Ie()({onState:onPromptState,type:"toggle",name:"prettier",message:`Would you like to use ${t}?`,initial:getPrefOrDefault("prettier"),active:"Yes",inactive:"No"});hi.prettier=Boolean(r);m.prettier=Boolean(r)}}}hi.git=(i=hi.git)!==null&&i!==void 0?i:!di.includes("--no-git");hi.install=(o=hi.install)!==null&&o!==void 0?o:!di.includes("--no-install");hi.versionCheck=(c=hi.versionCheck)!==null&&c!==void 0?c:!di.includes("--no-version-check");try{await createApp({appPath:u,packageManager:fi,example:p&&p!=="default"?p:undefined,examplePath:hi.examplePath,eslint:hi.eslint,prettier:hi.prettier,installPackages:hi.install,empty:hi.empty,initGit:hi.git,zuploVersion:li.version})}catch(t){if(!(t instanceof DownloadError)){throw t}const r=await Ie()({onState:onPromptState,type:"confirm",name:"builtin",message:`Could not download "${p}" because of a connectivity issue between your machine and GitHub.\n`+`Do you want to use the default template instead?`,initial:true});if(!r.builtin){throw t}await createApp({appPath:u,packageManager:fi,eslint:hi.eslint,prettier:hi.prettier,installPackages:hi.install,empty:hi.empty,initGit:hi.git,zuploVersion:li.version})}l.set("preferences",m);if(hi.versionCheck){console.log();await notifyUpdate()}}const pi=De()(li).catch((()=>null));async function notifyUpdate(){var t;try{if((t=await pi)===null||t===void 0?void 0:t.latest){const t={npm:"npm i -g",yarn:"yarn global add",pnpm:"pnpm add -g",bun:"bun add -g"};const r=`${t[fi]} create-zuplo-api`;console.log((0,ke.yellow)((0,ke.bold)("A new version of `create-zuplo-api` is available!"))+"\n"+"You can update by running: "+(0,ke.cyan)(r)+"\n")}process.exit(0)}catch{}}async function exit(t){console.log();console.log("Aborting installation.");if(t.command){console.log(` ${(0,ke.cyan)(t.command)} has failed.`)}else{console.log((0,ke.red)("Unexpected error. Please report it as a bug:")+"\n",t)}process.exit(1)}run().catch(exit)})();module.exports=i})();
|
|
72
|
+
deps: ${i}}`};const l={keyword:"dependencies",type:"object",schemaType:"object",error:r.error,code(t){const[r,i]=splitDependencies(t);validatePropertyDeps(t,r);validateSchemaDeps(t,i)}};function splitDependencies({schema:t}){const r={};const i={};for(const o in t){if(o==="__proto__")continue;const a=Array.isArray(t[o])?r:i;a[o]=t[o]}return[r,i]}function validatePropertyDeps(t,r=t.schema){const{gen:i,data:a,it:l}=t;if(Object.keys(r).length===0)return;const u=i.let("missing");for(const h in r){const d=r[h];if(d.length===0)continue;const p=(0,c.propertyInData)(i,a,h,l.opts.ownProperties);t.setParams({property:h,depsCount:d.length,deps:d.join(", ")});if(l.allErrors){i.if(p,(()=>{for(const r of d){(0,c.checkReportMissingProp)(t,r)}}))}else{i.if((0,o._)`${p} && (${(0,c.checkMissingProp)(t,d,u)})`);(0,c.reportMissingProp)(t,u);i.else()}}}r.validatePropertyDeps=validatePropertyDeps;function validateSchemaDeps(t,r=t.schema){const{gen:i,data:o,keyword:l,it:u}=t;const h=i.name("valid");for(const d in r){if((0,a.alwaysValidSchema)(u,r[d]))continue;i.if((0,c.propertyInData)(i,o,d,u.opts.ownProperties),(()=>{const r=t.subschema({keyword:l,schemaProp:d},h);t.mergeValidEvaluated(r,h)}),(()=>i.var(h,true)));t.ok(h)}}r.validateSchemaDeps=validateSchemaDeps;r["default"]=l},539:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(8803);const a={keyword:"dependentSchemas",type:"object",schemaType:"object",code:t=>(0,o.validateSchemaDeps)(t)};r["default"]=a},4373:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a=i(7373);const c={message:({params:t})=>(0,o.str)`must match "${t.ifClause}" schema`,params:({params:t})=>(0,o._)`{failingKeyword: ${t.ifClause}}`};const l={keyword:"if",schemaType:["object","boolean"],trackErrors:true,error:c,code(t){const{gen:r,parentSchema:i,it:c}=t;if(i.then===undefined&&i.else===undefined){(0,a.checkStrictMode)(c,'"if" without "then" and "else" is ignored')}const l=hasSchema(c,"then");const u=hasSchema(c,"else");if(!l&&!u)return;const h=r.let("valid",true);const d=r.name("_valid");validateIf();t.reset();if(l&&u){const i=r.let("ifClause");t.setParams({ifClause:i});r.if(d,validateClause("then",i),validateClause("else",i))}else if(l){r.if(d,validateClause("then"))}else{r.if((0,o.not)(d),validateClause("else"))}t.pass(h,(()=>t.error(true)));function validateIf(){const r=t.subschema({keyword:"if",compositeRule:true,createErrors:false,allErrors:false},d);t.mergeEvaluated(r)}function validateClause(i,a){return()=>{const c=t.subschema({keyword:i},d);r.assign(h,d);t.mergeValidEvaluated(c,h);if(a)r.assign(a,(0,o._)`${i}`);else t.setParams({ifClause:i})}}}};function hasSchema(t,r){const i=t.schema[r];return i!==undefined&&!(0,a.alwaysValidSchema)(t,i)}r["default"]=l},2756:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(611);const a=i(5836);const c=i(400);const l=i(3184);const u=i(4795);const h=i(8803);const d=i(6763);const p=i(8846);const m=i(2503);const g=i(7539);const y=i(1665);const v=i(2307);const b=i(7545);const w=i(6170);const E=i(4373);const S=i(6220);function getApplicator(t=false){const r=[y.default,v.default,b.default,w.default,E.default,S.default,d.default,p.default,h.default,m.default,g.default];if(t)r.push(a.default,l.default);else r.push(o.default,c.default);r.push(u.default);return r}r["default"]=getApplicator},400:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.validateTuple=void 0;const o=i(6515);const a=i(7373);const c=i(3955);const l={keyword:"items",type:"array",schemaType:["object","array","boolean"],before:"uniqueItems",code(t){const{schema:r,it:i}=t;if(Array.isArray(r))return validateTuple(t,"additionalItems",r);i.items=true;if((0,a.alwaysValidSchema)(i,r))return;t.ok((0,c.validateArray)(t))}};function validateTuple(t,r,i=t.schema){const{gen:c,parentSchema:l,data:u,keyword:h,it:d}=t;checkStrictTuple(l);if(d.opts.unevaluated&&i.length&&d.items!==true){d.items=a.mergeEvaluated.items(c,i.length,d.items)}const p=c.name("valid");const m=c.const("len",(0,o._)`${u}.length`);i.forEach(((r,i)=>{if((0,a.alwaysValidSchema)(d,r))return;c.if((0,o._)`${m} > ${i}`,(()=>t.subschema({keyword:h,schemaProp:i,dataProp:i},p)));t.ok(p)}));function checkStrictTuple(t){const{opts:o,errSchemaPath:c}=d;const l=i.length;const u=l===t.minItems&&(l===t.maxItems||t[r]===false);if(o.strictTuples&&!u){const t=`"${h}" is ${l}-tuple, but minItems or maxItems/${r} are not specified or different at path "${c}"`;(0,a.checkStrictMode)(d,t,o.strictTuples)}}}r.validateTuple=validateTuple;r["default"]=l},3184:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a=i(7373);const c=i(3955);const l=i(611);const u={message:({params:{len:t}})=>(0,o.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,o._)`{limit: ${t}}`};const h={keyword:"items",type:"array",schemaType:["object","boolean"],before:"uniqueItems",error:u,code(t){const{schema:r,parentSchema:i,it:o}=t;const{prefixItems:u}=i;o.items=true;if((0,a.alwaysValidSchema)(o,r))return;if(u)(0,l.validateAdditionalItems)(t,u);else t.ok((0,c.validateArray)(t))}};r["default"]=h},1665:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(7373);const a={keyword:"not",schemaType:["object","boolean"],trackErrors:true,code(t){const{gen:r,schema:i,it:a}=t;if((0,o.alwaysValidSchema)(a,i)){t.fail();return}const c=r.name("valid");t.subschema({keyword:"not",compositeRule:true,createErrors:false,allErrors:false},c);t.failResult(c,(()=>t.reset()),(()=>t.error()))},error:{message:"must NOT be valid"}};r["default"]=a},7545:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a=i(7373);const c={message:"must match exactly one schema in oneOf",params:({params:t})=>(0,o._)`{passingSchemas: ${t.passing}}`};const l={keyword:"oneOf",schemaType:"array",trackErrors:true,error:c,code(t){const{gen:r,schema:i,parentSchema:c,it:l}=t;if(!Array.isArray(i))throw new Error("ajv implementation error");if(l.opts.discriminator&&c.discriminator)return;const u=i;const h=r.let("valid",false);const d=r.let("passing",null);const p=r.name("_valid");t.setParams({passing:d});r.block(validateOneOf);t.result(h,(()=>t.reset()),(()=>t.error(true)));function validateOneOf(){u.forEach(((i,c)=>{let u;if((0,a.alwaysValidSchema)(l,i)){r.var(p,true)}else{u=t.subschema({keyword:"oneOf",schemaProp:c,compositeRule:true},p)}if(c>0){r.if((0,o._)`${p} && ${h}`).assign(h,false).assign(d,(0,o._)`[${d}, ${c}]`).else()}r.if(p,(()=>{r.assign(h,true);r.assign(d,c);if(u)t.mergeEvaluated(u,o.Name)}))}))}}};r["default"]=l},7539:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(3955);const a=i(6515);const c=i(7373);const l=i(7373);const u={keyword:"patternProperties",type:"object",schemaType:"object",code(t){const{gen:r,schema:i,data:u,parentSchema:h,it:d}=t;const{opts:p}=d;const m=(0,o.allSchemaProperties)(i);const g=m.filter((t=>(0,c.alwaysValidSchema)(d,i[t])));if(m.length===0||g.length===m.length&&(!d.opts.unevaluated||d.props===true)){return}const y=p.strictSchema&&!p.allowMatchingProperties&&h.properties;const v=r.name("valid");if(d.props!==true&&!(d.props instanceof a.Name)){d.props=(0,l.evaluatedPropsToName)(r,d.props)}const{props:b}=d;validatePatternProperties();function validatePatternProperties(){for(const t of m){if(y)checkMatchingProperties(t);if(d.allErrors){validateProperties(t)}else{r.var(v,true);validateProperties(t);r.if(v)}}}function checkMatchingProperties(t){for(const r in y){if(new RegExp(t).test(r)){(0,c.checkStrictMode)(d,`property ${r} matches pattern ${t} (use allowMatchingProperties)`)}}}function validateProperties(i){r.forIn("key",u,(c=>{r.if((0,a._)`${(0,o.usePattern)(t,i)}.test(${c})`,(()=>{const o=g.includes(i);if(!o){t.subschema({keyword:"patternProperties",schemaProp:i,dataProp:c,dataPropType:l.Type.Str},v)}if(d.opts.unevaluated&&b!==true){r.assign((0,a._)`${b}[${c}]`,true)}else if(!o&&!d.allErrors){r.if((0,a.not)(v),(()=>r.break()))}}))}))}}};r["default"]=u},5836:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(400);const a={keyword:"prefixItems",type:"array",schemaType:["array"],before:"uniqueItems",code:t=>(0,o.validateTuple)(t,"items")};r["default"]=a},2503:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(9688);const a=i(3955);const c=i(7373);const l=i(8846);const u={keyword:"properties",type:"object",schemaType:"object",code(t){const{gen:r,schema:i,parentSchema:u,data:h,it:d}=t;if(d.opts.removeAdditional==="all"&&u.additionalProperties===undefined){l.default.code(new o.KeywordCxt(d,l.default,"additionalProperties"))}const p=(0,a.allSchemaProperties)(i);for(const t of p){d.definedProperties.add(t)}if(d.opts.unevaluated&&p.length&&d.props!==true){d.props=c.mergeEvaluated.props(r,(0,c.toHash)(p),d.props)}const m=p.filter((t=>!(0,c.alwaysValidSchema)(d,i[t])));if(m.length===0)return;const g=r.name("valid");for(const i of m){if(hasDefault(i)){applyPropertySchema(i)}else{r.if((0,a.propertyInData)(r,h,i,d.opts.ownProperties));applyPropertySchema(i);if(!d.allErrors)r.else().var(g,true);r.endIf()}t.it.definedProperties.add(i);t.ok(g)}function hasDefault(t){return d.opts.useDefaults&&!d.compositeRule&&i[t].default!==undefined}function applyPropertySchema(r){t.subschema({keyword:"properties",schemaProp:r,dataProp:r},g)}}};r["default"]=u},6763:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a=i(7373);const c={message:"property name must be valid",params:({params:t})=>(0,o._)`{propertyName: ${t.propertyName}}`};const l={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:c,code(t){const{gen:r,schema:i,data:c,it:l}=t;if((0,a.alwaysValidSchema)(l,i))return;const u=r.name("valid");r.forIn("key",c,(i=>{t.setParams({propertyName:i});t.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:true},u);r.if((0,o.not)(u),(()=>{t.error(true);if(!l.allErrors)r.break()}))}));t.ok(u)}};r["default"]=l},6220:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(7373);const a={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:t,parentSchema:r,it:i}){if(r.if===undefined)(0,o.checkStrictMode)(i,`"${t}" without "if" is ignored`)}};r["default"]=a},3955:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.validateUnion=r.validateArray=r.usePattern=r.callValidateCode=r.schemaProperties=r.allSchemaProperties=r.noPropertyInData=r.propertyInData=r.isOwnProperty=r.hasPropFunc=r.reportMissingProp=r.checkMissingProp=r.checkReportMissingProp=void 0;const o=i(6515);const a=i(7373);const c=i(3877);const l=i(7373);function checkReportMissingProp(t,r){const{gen:i,data:a,it:c}=t;i.if(noPropertyInData(i,a,r,c.opts.ownProperties),(()=>{t.setParams({missingProperty:(0,o._)`${r}`},true);t.error()}))}r.checkReportMissingProp=checkReportMissingProp;function checkMissingProp({gen:t,data:r,it:{opts:i}},a,c){return(0,o.or)(...a.map((a=>(0,o.and)(noPropertyInData(t,r,a,i.ownProperties),(0,o._)`${c} = ${a}`))))}r.checkMissingProp=checkMissingProp;function reportMissingProp(t,r){t.setParams({missingProperty:r},true);t.error()}r.reportMissingProp=reportMissingProp;function hasPropFunc(t){return t.scopeValue("func",{ref:Object.prototype.hasOwnProperty,code:(0,o._)`Object.prototype.hasOwnProperty`})}r.hasPropFunc=hasPropFunc;function isOwnProperty(t,r,i){return(0,o._)`${hasPropFunc(t)}.call(${r}, ${i})`}r.isOwnProperty=isOwnProperty;function propertyInData(t,r,i,a){const c=(0,o._)`${r}${(0,o.getProperty)(i)} !== undefined`;return a?(0,o._)`${c} && ${isOwnProperty(t,r,i)}`:c}r.propertyInData=propertyInData;function noPropertyInData(t,r,i,a){const c=(0,o._)`${r}${(0,o.getProperty)(i)} === undefined`;return a?(0,o.or)(c,(0,o.not)(isOwnProperty(t,r,i))):c}r.noPropertyInData=noPropertyInData;function allSchemaProperties(t){return t?Object.keys(t).filter((t=>t!=="__proto__")):[]}r.allSchemaProperties=allSchemaProperties;function schemaProperties(t,r){return allSchemaProperties(r).filter((i=>!(0,a.alwaysValidSchema)(t,r[i])))}r.schemaProperties=schemaProperties;function callValidateCode({schemaCode:t,data:r,it:{gen:i,topSchemaRef:a,schemaPath:l,errorPath:u},it:h},d,p,m){const g=m?(0,o._)`${t}, ${r}, ${a}${l}`:r;const y=[[c.default.instancePath,(0,o.strConcat)(c.default.instancePath,u)],[c.default.parentData,h.parentData],[c.default.parentDataProperty,h.parentDataProperty],[c.default.rootData,c.default.rootData]];if(h.opts.dynamicRef)y.push([c.default.dynamicAnchors,c.default.dynamicAnchors]);const v=(0,o._)`${g}, ${i.object(...y)}`;return p!==o.nil?(0,o._)`${d}.call(${p}, ${v})`:(0,o._)`${d}(${v})`}r.callValidateCode=callValidateCode;const u=(0,o._)`new RegExp`;function usePattern({gen:t,it:{opts:r}},i){const a=r.unicodeRegExp?"u":"";const{regExp:c}=r.code;const h=c(i,a);return t.scopeValue("pattern",{key:h.toString(),ref:h,code:(0,o._)`${c.code==="new RegExp"?u:(0,l.useFunc)(t,c)}(${i}, ${a})`})}r.usePattern=usePattern;function validateArray(t){const{gen:r,data:i,keyword:c,it:l}=t;const u=r.name("valid");if(l.allErrors){const t=r.let("valid",true);validateItems((()=>r.assign(t,false)));return t}r.var(u,true);validateItems((()=>r.break()));return u;function validateItems(l){const h=r.const("len",(0,o._)`${i}.length`);r.forRange("i",0,h,(i=>{t.subschema({keyword:c,dataProp:i,dataPropType:a.Type.Num},u);r.if((0,o.not)(u),l)}))}}r.validateArray=validateArray;function validateUnion(t){const{gen:r,schema:i,keyword:c,it:l}=t;if(!Array.isArray(i))throw new Error("ajv implementation error");const u=i.some((t=>(0,a.alwaysValidSchema)(l,t)));if(u&&!l.opts.unevaluated)return;const h=r.let("valid",false);const d=r.name("_valid");r.block((()=>i.forEach(((i,a)=>{const l=t.subschema({keyword:c,schemaProp:a,compositeRule:true},d);r.assign(h,(0,o._)`${h} || ${d}`);const u=t.mergeValidEvaluated(l,d);if(!u)r.if((0,o.not)(h))}))));t.result(h,(()=>t.reset()),(()=>t.error(true)))}r.validateUnion=validateUnion},8129:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const i={keyword:"id",code(){throw new Error('NOT SUPPORTED: keyword "id", use "$id" for schema ID')}};r["default"]=i},6594:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(8129);const a=i(1259);const c=["$schema","$id","$defs","$vocabulary",{keyword:"$comment"},"definitions",o.default,a.default];r["default"]=c},1259:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.callRef=r.getValidate=void 0;const o=i(5945);const a=i(3955);const c=i(6515);const l=i(3877);const u=i(4621);const h=i(7373);const d={keyword:"$ref",schemaType:"string",code(t){const{gen:r,schema:i,it:a}=t;const{baseId:l,schemaEnv:h,validateName:d,opts:p,self:m}=a;const{root:g}=h;if((i==="#"||i==="#/")&&l===g.baseId)return callRootRef();const y=u.resolveRef.call(m,g,l,i);if(y===undefined)throw new o.default(a.opts.uriResolver,l,i);if(y instanceof u.SchemaEnv)return callValidate(y);return inlineRefSchema(y);function callRootRef(){if(h===g)return callRef(t,d,h,h.$async);const i=r.scopeValue("root",{ref:g});return callRef(t,(0,c._)`${i}.validate`,g,g.$async)}function callValidate(r){const i=getValidate(t,r);callRef(t,i,r,r.$async)}function inlineRefSchema(o){const a=r.scopeValue("schema",p.code.source===true?{ref:o,code:(0,c.stringify)(o)}:{ref:o});const l=r.name("valid");const u=t.subschema({schema:o,dataTypes:[],schemaPath:c.nil,topSchemaRef:a,errSchemaPath:i},l);t.mergeEvaluated(u);t.ok(l)}}};function getValidate(t,r){const{gen:i}=t;return r.validate?i.scopeValue("validate",{ref:r.validate}):(0,c._)`${i.scopeValue("wrapper",{ref:r})}.validate`}r.getValidate=getValidate;function callRef(t,r,i,o){const{gen:u,it:d}=t;const{allErrors:p,schemaEnv:m,opts:g}=d;const y=g.passContext?l.default.this:c.nil;if(o)callAsyncRef();else callSyncRef();function callAsyncRef(){if(!m.$async)throw new Error("async schema referenced by sync schema");const i=u.let("valid");u.try((()=>{u.code((0,c._)`await ${(0,a.callValidateCode)(t,r,y)}`);addEvaluatedFrom(r);if(!p)u.assign(i,true)}),(t=>{u.if((0,c._)`!(${t} instanceof ${d.ValidationError})`,(()=>u.throw(t)));addErrorsFrom(t);if(!p)u.assign(i,false)}));t.ok(i)}function callSyncRef(){t.result((0,a.callValidateCode)(t,r,y),(()=>addEvaluatedFrom(r)),(()=>addErrorsFrom(r)))}function addErrorsFrom(t){const r=(0,c._)`${t}.errors`;u.assign(l.default.vErrors,(0,c._)`${l.default.vErrors} === null ? ${r} : ${l.default.vErrors}.concat(${r})`);u.assign(l.default.errors,(0,c._)`${l.default.vErrors}.length`)}function addEvaluatedFrom(t){var r;if(!d.opts.unevaluated)return;const o=(r=i===null||i===void 0?void 0:i.validate)===null||r===void 0?void 0:r.evaluated;if(d.props!==true){if(o&&!o.dynamicProps){if(o.props!==undefined){d.props=h.mergeEvaluated.props(u,o.props,d.props)}}else{const r=u.var("props",(0,c._)`${t}.evaluated.props`);d.props=h.mergeEvaluated.props(u,r,d.props,c.Name)}}if(d.items!==true){if(o&&!o.dynamicItems){if(o.items!==undefined){d.items=h.mergeEvaluated.items(u,o.items,d.items)}}else{const r=u.var("items",(0,c._)`${t}.evaluated.items`);d.items=h.mergeEvaluated.items(u,r,d.items,c.Name)}}}}r.callRef=callRef;r["default"]=d},1079:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a=i(3710);const c=i(4621);const l=i(5945);const u=i(7373);const h={message:({params:{discrError:t,tagName:r}})=>t===a.DiscrError.Tag?`tag "${r}" must be string`:`value of tag "${r}" must be in oneOf`,params:({params:{discrError:t,tag:r,tagName:i}})=>(0,o._)`{error: ${t}, tag: ${i}, tagValue: ${r}}`};const d={keyword:"discriminator",type:"object",schemaType:"object",error:h,code(t){const{gen:r,data:i,schema:h,parentSchema:d,it:p}=t;const{oneOf:m}=d;if(!p.opts.discriminator){throw new Error("discriminator: requires discriminator option")}const g=h.propertyName;if(typeof g!="string")throw new Error("discriminator: requires propertyName");if(h.mapping)throw new Error("discriminator: mapping is not supported");if(!m)throw new Error("discriminator: requires oneOf keyword");const y=r.let("valid",false);const v=r.const("tag",(0,o._)`${i}${(0,o.getProperty)(g)}`);r.if((0,o._)`typeof ${v} == "string"`,(()=>validateMapping()),(()=>t.error(false,{discrError:a.DiscrError.Tag,tag:v,tagName:g})));t.ok(y);function validateMapping(){const i=getMapping();r.if(false);for(const t in i){r.elseIf((0,o._)`${v} === ${t}`);r.assign(y,applyTagSchema(i[t]))}r.else();t.error(false,{discrError:a.DiscrError.Mapping,tag:v,tagName:g});r.endIf()}function applyTagSchema(i){const a=r.name("valid");const c=t.subschema({keyword:"oneOf",schemaProp:i},a);t.mergeEvaluated(c,o.Name);return a}function getMapping(){var t;const r={};const i=hasRequired(d);let o=true;for(let r=0;r<m.length;r++){let a=m[r];if((a===null||a===void 0?void 0:a.$ref)&&!(0,u.schemaHasRulesButRef)(a,p.self.RULES)){const t=a.$ref;a=c.resolveRef.call(p.self,p.schemaEnv.root,p.baseId,t);if(a instanceof c.SchemaEnv)a=a.schema;if(a===undefined)throw new l.default(p.opts.uriResolver,p.baseId,t)}const h=(t=a===null||a===void 0?void 0:a.properties)===null||t===void 0?void 0:t[g];if(typeof h!="object"){throw new Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${g}"`)}o=o&&(i||hasRequired(a));addMappings(h,r)}if(!o)throw new Error(`discriminator: "${g}" must be required`);return r;function hasRequired({required:t}){return Array.isArray(t)&&t.includes(g)}function addMappings(t,r){if(t.const){addMapping(t.const,r)}else if(t.enum){for(const i of t.enum){addMapping(i,r)}}else{throw new Error(`discriminator: "properties/${g}" must have "const" or "enum"`)}}function addMapping(t,i){if(typeof t!="string"||t in r){throw new Error(`discriminator: "${g}" values must be unique strings`)}r[t]=i}}}};r["default"]=d},3710:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.DiscrError=void 0;var i;(function(t){t["Tag"]="tag";t["Mapping"]="mapping"})(i||(r.DiscrError=i={}))},5219:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6594);const a=i(7862);const c=i(2756);const l=i(6738);const u=i(7055);const h=i(5339);const d=i(7102);const p=i(6343);const m=[l.default,o.default,a.default,(0,c.default)(true),d.default,p.metadataVocabulary,p.contentVocabulary,u.default,h.default];r["default"]=m},9242:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6594);const a=i(7862);const c=i(2756);const l=i(7102);const u=i(6343);const h=[o.default,a.default,(0,c.default)(),l.default,u.metadataVocabulary,u.contentVocabulary];r["default"]=h},290:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.dynamicAnchor=void 0;const o=i(6515);const a=i(3877);const c=i(4621);const l=i(1259);const u={keyword:"$dynamicAnchor",schemaType:"string",code:t=>dynamicAnchor(t,t.schema)};function dynamicAnchor(t,r){const{gen:i,it:c}=t;c.schemaEnv.root.dynamicAnchors[r]=true;const l=(0,o._)`${a.default.dynamicAnchors}${(0,o.getProperty)(r)}`;const u=c.errSchemaPath==="#"?c.validateName:_getValidate(t);i.if((0,o._)`!${l}`,(()=>i.assign(l,u)))}r.dynamicAnchor=dynamicAnchor;function _getValidate(t){const{schemaEnv:r,schema:i,self:o}=t.it;const{root:a,baseId:u,localRefs:h,meta:d}=r.root;const{schemaId:p}=o.opts;const m=new c.SchemaEnv({schema:i,schemaId:p,root:a,baseId:u,localRefs:h,meta:d});c.compileSchema.call(o,m);return(0,l.getValidate)(t,m)}r["default"]=u},3422:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.dynamicRef=void 0;const o=i(6515);const a=i(3877);const c=i(1259);const l={keyword:"$dynamicRef",schemaType:"string",code:t=>dynamicRef(t,t.schema)};function dynamicRef(t,r){const{gen:i,keyword:l,it:u}=t;if(r[0]!=="#")throw new Error(`"${l}" only supports hash fragment reference`);const h=r.slice(1);if(u.allErrors){_dynamicRef()}else{const r=i.let("valid",false);_dynamicRef(r);t.ok(r)}function _dynamicRef(t){if(u.schemaEnv.root.dynamicAnchors[h]){const r=i.let("_v",(0,o._)`${a.default.dynamicAnchors}${(0,o.getProperty)(h)}`);i.if(r,_callRef(r,t),_callRef(u.validateName,t))}else{_callRef(u.validateName,t)()}}function _callRef(r,o){return o?()=>i.block((()=>{(0,c.callRef)(t,r);i.let(o,true)})):()=>(0,c.callRef)(t,r)}}r.dynamicRef=dynamicRef;r["default"]=l},6738:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(290);const a=i(3422);const c=i(9475);const l=i(4709);const u=[o.default,a.default,c.default,l.default];r["default"]=u},9475:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(290);const a=i(7373);const c={keyword:"$recursiveAnchor",schemaType:"boolean",code(t){if(t.schema)(0,o.dynamicAnchor)(t,"");else(0,a.checkStrictMode)(t.it,"$recursiveAnchor: false is ignored")}};r["default"]=c},4709:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(3422);const a={keyword:"$recursiveRef",schemaType:"string",code:t=>(0,o.dynamicRef)(t,t.schema)};r["default"]=a},9711:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a={message:({schemaCode:t})=>(0,o.str)`must match format "${t}"`,params:({schemaCode:t})=>(0,o._)`{format: ${t}}`};const c={keyword:"format",type:["number","string"],schemaType:"string",$data:true,error:a,code(t,r){const{gen:i,data:a,$data:c,schema:l,schemaCode:u,it:h}=t;const{opts:d,errSchemaPath:p,schemaEnv:m,self:g}=h;if(!d.validateFormats)return;if(c)validate$DataFormat();else validateFormat();function validate$DataFormat(){const c=i.scopeValue("formats",{ref:g.formats,code:d.code.formats});const l=i.const("fDef",(0,o._)`${c}[${u}]`);const h=i.let("fType");const p=i.let("format");i.if((0,o._)`typeof ${l} == "object" && !(${l} instanceof RegExp)`,(()=>i.assign(h,(0,o._)`${l}.type || "string"`).assign(p,(0,o._)`${l}.validate`)),(()=>i.assign(h,(0,o._)`"string"`).assign(p,l)));t.fail$data((0,o.or)(unknownFmt(),invalidFmt()));function unknownFmt(){if(d.strictSchema===false)return o.nil;return(0,o._)`${u} && !${p}`}function invalidFmt(){const t=m.$async?(0,o._)`(${l}.async ? await ${p}(${a}) : ${p}(${a}))`:(0,o._)`${p}(${a})`;const i=(0,o._)`(typeof ${p} == "function" ? ${t} : ${p}.test(${a}))`;return(0,o._)`${p} && ${p} !== true && ${h} === ${r} && !${i}`}}function validateFormat(){const c=g.formats[l];if(!c){unknownFormat();return}if(c===true)return;const[u,h,y]=getFormat(c);if(u===r)t.pass(validCondition());function unknownFormat(){if(d.strictSchema===false){g.logger.warn(unknownMsg());return}throw new Error(unknownMsg());function unknownMsg(){return`unknown format "${l}" ignored in schema at path "${p}"`}}function getFormat(t){const r=t instanceof RegExp?(0,o.regexpCode)(t):d.code.formats?(0,o._)`${d.code.formats}${(0,o.getProperty)(l)}`:undefined;const a=i.scopeValue("formats",{key:l,ref:t,code:r});if(typeof t=="object"&&!(t instanceof RegExp)){return[t.type||"string",t.validate,(0,o._)`${a}.validate`]}return["string",t,a]}function validCondition(){if(typeof c=="object"&&!(c instanceof RegExp)&&c.async){if(!m.$async)throw new Error("async format in sync schema");return(0,o._)`await ${y}(${a})`}return typeof h=="function"?(0,o._)`${y}(${a})`:(0,o._)`${y}.test(${a})`}}}};r["default"]=c},7102:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(9711);const a=[o.default];r["default"]=a},6343:(t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});r.contentVocabulary=r.metadataVocabulary=void 0;r.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];r.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]},7055:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(5020);const a=i(539);const c=i(8660);const l=[o.default,a.default,c.default];r["default"]=l},5339:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(1038);const a=i(8003);const c=[o.default,a.default];r["default"]=c},8003:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a=i(7373);const c={message:({params:{len:t}})=>(0,o.str)`must NOT have more than ${t} items`,params:({params:{len:t}})=>(0,o._)`{limit: ${t}}`};const l={keyword:"unevaluatedItems",type:"array",schemaType:["boolean","object"],error:c,code(t){const{gen:r,schema:i,data:c,it:l}=t;const u=l.items||0;if(u===true)return;const h=r.const("len",(0,o._)`${c}.length`);if(i===false){t.setParams({len:u});t.fail((0,o._)`${h} > ${u}`)}else if(typeof i=="object"&&!(0,a.alwaysValidSchema)(l,i)){const i=r.var("valid",(0,o._)`${h} <= ${u}`);r.if((0,o.not)(i),(()=>validateItems(i,u)));t.ok(i)}l.items=true;function validateItems(i,c){r.forRange("i",c,h,(c=>{t.subschema({keyword:"unevaluatedItems",dataProp:c,dataPropType:a.Type.Num},i);if(!l.allErrors)r.if((0,o.not)(i),(()=>r.break()))}))}}};r["default"]=l},1038:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a=i(7373);const c=i(3877);const l={message:"must NOT have unevaluated properties",params:({params:t})=>(0,o._)`{unevaluatedProperty: ${t.unevaluatedProperty}}`};const u={keyword:"unevaluatedProperties",type:"object",schemaType:["boolean","object"],trackErrors:true,error:l,code(t){const{gen:r,schema:i,data:l,errsCount:u,it:h}=t;if(!u)throw new Error("ajv implementation error");const{allErrors:d,props:p}=h;if(p instanceof o.Name){r.if((0,o._)`${p} !== true`,(()=>r.forIn("key",l,(t=>r.if(unevaluatedDynamic(p,t),(()=>unevaluatedPropCode(t)))))))}else if(p!==true){r.forIn("key",l,(t=>p===undefined?unevaluatedPropCode(t):r.if(unevaluatedStatic(p,t),(()=>unevaluatedPropCode(t)))))}h.props=true;t.ok((0,o._)`${u} === ${c.default.errors}`);function unevaluatedPropCode(c){if(i===false){t.setParams({unevaluatedProperty:c});t.error();if(!d)r.break();return}if(!(0,a.alwaysValidSchema)(h,i)){const i=r.name("valid");t.subschema({keyword:"unevaluatedProperties",dataProp:c,dataPropType:a.Type.Str},i);if(!d)r.if((0,o.not)(i),(()=>r.break()))}}function unevaluatedDynamic(t,r){return(0,o._)`!${t} || !${t}[${r}]`}function unevaluatedStatic(t,r){const i=[];for(const a in t){if(t[a]===true)i.push((0,o._)`${r} !== ${a}`)}return(0,o.and)(...i)}}};r["default"]=u},4381:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a=i(7373);const c=i(1760);const l={message:"must be equal to constant",params:({schemaCode:t})=>(0,o._)`{allowedValue: ${t}}`};const u={keyword:"const",$data:true,error:l,code(t){const{gen:r,data:i,$data:l,schemaCode:u,schema:h}=t;if(l||h&&typeof h=="object"){t.fail$data((0,o._)`!${(0,a.useFunc)(r,c.default)}(${i}, ${u})`)}else{t.fail((0,o._)`${h} !== ${i}`)}}};r["default"]=u},5020:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(8803);const a={keyword:"dependentRequired",type:"object",schemaType:"object",error:o.error,code:t=>(0,o.validatePropertyDeps)(t)};r["default"]=a},4209:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a=i(7373);const c=i(1760);const l={message:"must be equal to one of the allowed values",params:({schemaCode:t})=>(0,o._)`{allowedValues: ${t}}`};const u={keyword:"enum",schemaType:"array",$data:true,error:l,code(t){const{gen:r,data:i,$data:l,schema:u,schemaCode:h,it:d}=t;if(!l&&u.length===0)throw new Error("enum must have non-empty array");const p=u.length>=d.opts.loopEnum;let m;const getEql=()=>m!==null&&m!==void 0?m:m=(0,a.useFunc)(r,c.default);let g;if(p||l){g=r.let("valid");t.block$data(g,loopEnum)}else{if(!Array.isArray(u))throw new Error("ajv implementation error");const t=r.const("vSchema",h);g=(0,o.or)(...u.map(((r,i)=>equalCode(t,i))))}t.pass(g);function loopEnum(){r.assign(g,false);r.forOf("v",h,(t=>r.if((0,o._)`${getEql()}(${i}, ${t})`,(()=>r.assign(g,true).break()))))}function equalCode(t,r){const a=u[r];return typeof a==="object"&&a!==null?(0,o._)`${getEql()}(${i}, ${t}[${r}])`:(0,o._)`${i} === ${a}`}}};r["default"]=u},7862:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(2708);const a=i(1177);const c=i(2737);const l=i(6340);const u=i(1188);const h=i(4141);const d=i(2049);const p=i(9359);const m=i(4381);const g=i(4209);const y=[o.default,a.default,c.default,l.default,u.default,h.default,d.default,p.default,{keyword:"type",schemaType:["string","array"]},{keyword:"nullable",schemaType:"boolean"},m.default,g.default];r["default"]=y},8660:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(7373);const a={keyword:["maxContains","minContains"],type:"array",schemaType:"number",code({keyword:t,parentSchema:r,it:i}){if(r.contains===undefined){(0,o.checkStrictMode)(i,`"${t}" without "contains" is ignored`)}}};r["default"]=a},2049:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a={message({keyword:t,schemaCode:r}){const i=t==="maxItems"?"more":"fewer";return(0,o.str)`must NOT have ${i} than ${r} items`},params:({schemaCode:t})=>(0,o._)`{limit: ${t}}`};const c={keyword:["maxItems","minItems"],type:"array",schemaType:"number",$data:true,error:a,code(t){const{keyword:r,data:i,schemaCode:a}=t;const c=r==="maxItems"?o.operators.GT:o.operators.LT;t.fail$data((0,o._)`${i}.length ${c} ${a}`)}};r["default"]=c},2737:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a=i(7373);const c=i(4475);const l={message({keyword:t,schemaCode:r}){const i=t==="maxLength"?"more":"fewer";return(0,o.str)`must NOT have ${i} than ${r} characters`},params:({schemaCode:t})=>(0,o._)`{limit: ${t}}`};const u={keyword:["maxLength","minLength"],type:"string",schemaType:"number",$data:true,error:l,code(t){const{keyword:r,data:i,schemaCode:l,it:u}=t;const h=r==="maxLength"?o.operators.GT:o.operators.LT;const d=u.opts.unicode===false?(0,o._)`${i}.length`:(0,o._)`${(0,a.useFunc)(t.gen,c.default)}(${i})`;t.fail$data((0,o._)`${d} ${h} ${l}`)}};r["default"]=u},2708:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a=o.operators;const c={maximum:{okStr:"<=",ok:a.LTE,fail:a.GT},minimum:{okStr:">=",ok:a.GTE,fail:a.LT},exclusiveMaximum:{okStr:"<",ok:a.LT,fail:a.GTE},exclusiveMinimum:{okStr:">",ok:a.GT,fail:a.LTE}};const l={message:({keyword:t,schemaCode:r})=>(0,o.str)`must be ${c[t].okStr} ${r}`,params:({keyword:t,schemaCode:r})=>(0,o._)`{comparison: ${c[t].okStr}, limit: ${r}}`};const u={keyword:Object.keys(c),type:"number",schemaType:"number",$data:true,error:l,code(t){const{keyword:r,data:i,schemaCode:a}=t;t.fail$data((0,o._)`${i} ${c[r].fail} ${a} || isNaN(${i})`)}};r["default"]=u},1188:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a={message({keyword:t,schemaCode:r}){const i=t==="maxProperties"?"more":"fewer";return(0,o.str)`must NOT have ${i} than ${r} properties`},params:({schemaCode:t})=>(0,o._)`{limit: ${t}}`};const c={keyword:["maxProperties","minProperties"],type:"object",schemaType:"number",$data:true,error:a,code(t){const{keyword:r,data:i,schemaCode:a}=t;const c=r==="maxProperties"?o.operators.GT:o.operators.LT;t.fail$data((0,o._)`Object.keys(${i}).length ${c} ${a}`)}};r["default"]=c},1177:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(6515);const a={message:({schemaCode:t})=>(0,o.str)`must be multiple of ${t}`,params:({schemaCode:t})=>(0,o._)`{multipleOf: ${t}}`};const c={keyword:"multipleOf",type:"number",schemaType:"number",$data:true,error:a,code(t){const{gen:r,data:i,schemaCode:a,it:c}=t;const l=c.opts.multipleOfPrecision;const u=r.let("res");const h=l?(0,o._)`Math.abs(Math.round(${u}) - ${u}) > 1e-${l}`:(0,o._)`${u} !== parseInt(${u})`;t.fail$data((0,o._)`(${a} === 0 || (${u} = ${i}/${a}, ${h}))`)}};r["default"]=c},6340:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(3955);const a=i(6515);const c={message:({schemaCode:t})=>(0,a.str)`must match pattern "${t}"`,params:({schemaCode:t})=>(0,a._)`{pattern: ${t}}`};const l={keyword:"pattern",type:"string",schemaType:"string",$data:true,error:c,code(t){const{data:r,$data:i,schema:c,schemaCode:l,it:u}=t;const h=u.opts.unicodeRegExp?"u":"";const d=i?(0,a._)`(new RegExp(${l}, ${h}))`:(0,o.usePattern)(t,c);t.fail$data((0,a._)`!${d}.test(${r})`)}};r["default"]=l},4141:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(3955);const a=i(6515);const c=i(7373);const l={message:({params:{missingProperty:t}})=>(0,a.str)`must have required property '${t}'`,params:({params:{missingProperty:t}})=>(0,a._)`{missingProperty: ${t}}`};const u={keyword:"required",type:"object",schemaType:"array",$data:true,error:l,code(t){const{gen:r,schema:i,schemaCode:l,data:u,$data:h,it:d}=t;const{opts:p}=d;if(!h&&i.length===0)return;const m=i.length>=p.loopRequired;if(d.allErrors)allErrorsMode();else exitOnErrorMode();if(p.strictRequired){const r=t.parentSchema.properties;const{definedProperties:o}=t.it;for(const t of i){if((r===null||r===void 0?void 0:r[t])===undefined&&!o.has(t)){const r=d.schemaEnv.baseId+d.errSchemaPath;const i=`required property "${t}" is not defined at "${r}" (strictRequired)`;(0,c.checkStrictMode)(d,i,d.opts.strictRequired)}}}function allErrorsMode(){if(m||h){t.block$data(a.nil,loopAllRequired)}else{for(const r of i){(0,o.checkReportMissingProp)(t,r)}}}function exitOnErrorMode(){const a=r.let("missing");if(m||h){const i=r.let("valid",true);t.block$data(i,(()=>loopUntilMissing(a,i)));t.ok(i)}else{r.if((0,o.checkMissingProp)(t,i,a));(0,o.reportMissingProp)(t,a);r.else()}}function loopAllRequired(){r.forOf("prop",l,(i=>{t.setParams({missingProperty:i});r.if((0,o.noPropertyInData)(r,u,i,p.ownProperties),(()=>t.error()))}))}function loopUntilMissing(i,c){t.setParams({missingProperty:i});r.forOf(i,l,(()=>{r.assign(c,(0,o.propertyInData)(r,u,i,p.ownProperties));r.if((0,a.not)(c),(()=>{t.error();r.break()}))}),a.nil)}}};r["default"]=u},9359:(t,r,i)=>{"use strict";Object.defineProperty(r,"__esModule",{value:true});const o=i(8486);const a=i(6515);const c=i(7373);const l=i(1760);const u={message:({params:{i:t,j:r}})=>(0,a.str)`must NOT have duplicate items (items ## ${r} and ${t} are identical)`,params:({params:{i:t,j:r}})=>(0,a._)`{i: ${t}, j: ${r}}`};const h={keyword:"uniqueItems",type:"array",schemaType:"boolean",$data:true,error:u,code(t){const{gen:r,data:i,$data:u,schema:h,parentSchema:d,schemaCode:p,it:m}=t;if(!u&&!h)return;const g=r.let("valid");const y=d.items?(0,o.getSchemaTypes)(d.items):[];t.block$data(g,validateUniqueItems,(0,a._)`${p} === false`);t.ok(g);function validateUniqueItems(){const o=r.let("i",(0,a._)`${i}.length`);const c=r.let("j");t.setParams({i:o,j:c});r.assign(g,true);r.if((0,a._)`${o} > 1`,(()=>(canOptimize()?loopN:loopN2)(o,c)))}function canOptimize(){return y.length>0&&!y.some((t=>t==="object"||t==="array"))}function loopN(c,l){const u=r.name("item");const h=(0,o.checkDataTypes)(y,u,m.opts.strictNumbers,o.DataType.Wrong);const d=r.const("indices",(0,a._)`{}`);r.for((0,a._)`;${c}--;`,(()=>{r.let(u,(0,a._)`${i}[${c}]`);r.if(h,(0,a._)`continue`);if(y.length>1)r.if((0,a._)`typeof ${u} == "string"`,(0,a._)`${u} += "_"`);r.if((0,a._)`typeof ${d}[${u}] == "number"`,(()=>{r.assign(l,(0,a._)`${d}[${u}]`);t.error();r.assign(g,false).break()})).code((0,a._)`${d}[${u}] = ${c}`)}))}function loopN2(o,u){const h=(0,c.useFunc)(r,l.default);const d=r.name("outer");r.label(d).for((0,a._)`;${o}--;`,(()=>r.for((0,a._)`${u} = ${o}; ${u}--;`,(()=>r.if((0,a._)`${h}(${i}[${o}], ${i}[${u}])`,(()=>{t.error();r.assign(g,false).break(d)}))))))}}};r["default"]=h},7362:(t,r,i)=>{"use strict";const o=i(2040);const a=process.env;Object.defineProperty(r,"_vendors",{value:o.map((function(t){return t.constant}))});r.name=null;r.isPR=null;o.forEach((function(t){const i=Array.isArray(t.env)?t.env:[t.env];const o=i.every((function(t){return checkEnv(t)}));r[t.constant]=o;if(!o){return}r.name=t.name;switch(typeof t.pr){case"string":r.isPR=!!a[t.pr];break;case"object":if("env"in t.pr){r.isPR=t.pr.env in a&&a[t.pr.env]!==t.pr.ne}else if("any"in t.pr){r.isPR=t.pr.any.some((function(t){return!!a[t]}))}else{r.isPR=checkEnv(t.pr)}break;default:r.isPR=null}}));r.isCI=!!(a.CI!=="false"&&(a.BUILD_ID||a.BUILD_NUMBER||a.CI||a.CI_APP_ID||a.CI_BUILD_ID||a.CI_BUILD_NUMBER||a.CI_NAME||a.CONTINUOUS_INTEGRATION||a.RUN_ID||r.name||false));function checkEnv(t){if(typeof t==="string")return!!a[t];if("env"in t){return a[t.env]&&a[t.env].includes(t.includes)}if("any"in t){return t.any.some((function(t){return!!a[t]}))}return Object.keys(t).every((function(r){return a[r]===t[r]}))}},2544:(t,r,i)=>{"use strict";const{builtinModules:o}=i(5720);var a=new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$");var c=["node_modules","favicon.ico"];function validate(t){var r=[];var i=[];if(t===null){i.push("name cannot be null");return done(r,i)}if(t===undefined){i.push("name cannot be undefined");return done(r,i)}if(typeof t!=="string"){i.push("name must be a string");return done(r,i)}if(!t.length){i.push("name length must be greater than zero")}if(t.match(/^\./)){i.push("name cannot start with a period")}if(t.match(/^_/)){i.push("name cannot start with an underscore")}if(t.trim()!==t){i.push("name cannot contain leading or trailing spaces")}c.forEach((function(r){if(t.toLowerCase()===r){i.push(r+" is a blacklisted name")}}));if(o.includes(t.toLowerCase())){r.push(t+" is a core module name")}if(t.length>214){r.push("name can no longer contain more than 214 characters")}if(t.toLowerCase()!==t){r.push("name can no longer contain capital letters")}if(/[~'!()*]/.test(t.split("/").slice(-1)[0])){r.push('name can no longer contain special characters ("~\'!()*")')}if(encodeURIComponent(t)!==t){var l=t.match(a);if(l){var u=l[1];var h=l[2];if(encodeURIComponent(u)===u&&encodeURIComponent(h)===h){return done(r,i)}}i.push("name can only contain URL-friendly characters")}return done(r,i)}var done=function(t,r){var i={validForNewPackages:r.length===0&&t.length===0,validForOldPackages:r.length===0,warnings:t,errors:r};if(!i.warnings.length){delete i.warnings}if(!i.errors.length){delete i.errors}return i};t.exports=validate},181:t=>{"use strict";t.exports=require("buffer")},5317:t=>{"use strict";t.exports=require("child_process")},4434:t=>{"use strict";t.exports=require("events")},9896:t=>{"use strict";t.exports=require("fs")},8611:t=>{"use strict";t.exports=require("http")},5692:t=>{"use strict";t.exports=require("https")},5720:t=>{"use strict";t.exports=require("module")},1421:t=>{"use strict";t.exports=require("node:child_process")},8474:t=>{"use strict";t.exports=require("node:events")},3024:t=>{"use strict";t.exports=require("node:fs")},6760:t=>{"use strict";t.exports=require("node:path")},1708:t=>{"use strict";t.exports=require("node:process")},857:t=>{"use strict";t.exports=require("os")},6928:t=>{"use strict";t.exports=require("path")},3785:t=>{"use strict";t.exports=require("readline")},2203:t=>{"use strict";t.exports=require("stream")},2018:t=>{"use strict";t.exports=require("tty")},7016:t=>{"use strict";t.exports=require("url")},9023:t=>{"use strict";t.exports=require("util")},7944:(t,r,i)=>{const{Argument:o}=i(3573);const{Command:a}=i(217);const{CommanderError:c,InvalidArgumentError:l}=i(5246);const{Help:u}=i(5889);const{Option:h}=i(8127);r.DM=new a;r.gu=t=>new a(t);r.Ww=(t,r)=>new h(t,r);r.er=(t,r)=>new o(t,r);r.uB=a;r.c$=h;r.ef=o;r._V=u;r.b7=c;r.Di=l;r.a2=l},3573:(t,r,i)=>{const{InvalidArgumentError:o}=i(5246);class Argument{constructor(t,r){this.description=r||"";this.variadic=false;this.parseArg=undefined;this.defaultValue=undefined;this.defaultValueDescription=undefined;this.argChoices=undefined;switch(t[0]){case"<":this.required=true;this._name=t.slice(1,-1);break;case"[":this.required=false;this._name=t.slice(1,-1);break;default:this.required=true;this._name=t;break}if(this._name.length>3&&this._name.slice(-3)==="..."){this.variadic=true;this._name=this._name.slice(0,-3)}}name(){return this._name}_concatValue(t,r){if(r===this.defaultValue||!Array.isArray(r)){return[t]}return r.concat(t)}default(t,r){this.defaultValue=t;this.defaultValueDescription=r;return this}argParser(t){this.parseArg=t;return this}choices(t){this.argChoices=t.slice();this.parseArg=(t,r)=>{if(!this.argChoices.includes(t)){throw new o(`Allowed choices are ${this.argChoices.join(", ")}.`)}if(this.variadic){return this._concatValue(t,r)}return t};return this}argRequired(){this.required=true;return this}argOptional(){this.required=false;return this}}function humanReadableArgName(t){const r=t.name()+(t.variadic===true?"...":"");return t.required?"<"+r+">":"["+r+"]"}r.Argument=Argument;r.humanReadableArgName=humanReadableArgName},217:(t,r,i)=>{const o=i(8474).EventEmitter;const a=i(1421);const c=i(6760);const l=i(3024);const u=i(1708);const{Argument:h,humanReadableArgName:d}=i(3573);const{CommanderError:p}=i(5246);const{Help:m}=i(5889);const{Option:g,DualOptions:y}=i(8127);const{suggestSimilar:v}=i(3733);class Command extends o{constructor(t){super();this.commands=[];this.options=[];this.parent=null;this._allowUnknownOption=false;this._allowExcessArguments=true;this.registeredArguments=[];this._args=this.registeredArguments;this.args=[];this.rawArgs=[];this.processedArgs=[];this._scriptPath=null;this._name=t||"";this._optionValues={};this._optionValueSources={};this._storeOptionsAsProperties=false;this._actionHandler=null;this._executableHandler=false;this._executableFile=null;this._executableDir=null;this._defaultCommandName=null;this._exitCallback=null;this._aliases=[];this._combineFlagAndOptionalValue=true;this._description="";this._summary="";this._argsDescription=undefined;this._enablePositionalOptions=false;this._passThroughOptions=false;this._lifeCycleHooks={};this._showHelpAfterError=false;this._showSuggestionAfterError=true;this._outputConfiguration={writeOut:t=>u.stdout.write(t),writeErr:t=>u.stderr.write(t),getOutHelpWidth:()=>u.stdout.isTTY?u.stdout.columns:undefined,getErrHelpWidth:()=>u.stderr.isTTY?u.stderr.columns:undefined,outputError:(t,r)=>r(t)};this._hidden=false;this._helpOption=undefined;this._addImplicitHelpCommand=undefined;this._helpCommand=undefined;this._helpConfiguration={}}copyInheritedSettings(t){this._outputConfiguration=t._outputConfiguration;this._helpOption=t._helpOption;this._helpCommand=t._helpCommand;this._helpConfiguration=t._helpConfiguration;this._exitCallback=t._exitCallback;this._storeOptionsAsProperties=t._storeOptionsAsProperties;this._combineFlagAndOptionalValue=t._combineFlagAndOptionalValue;this._allowExcessArguments=t._allowExcessArguments;this._enablePositionalOptions=t._enablePositionalOptions;this._showHelpAfterError=t._showHelpAfterError;this._showSuggestionAfterError=t._showSuggestionAfterError;return this}_getCommandAndAncestors(){const t=[];for(let r=this;r;r=r.parent){t.push(r)}return t}command(t,r,i){let o=r;let a=i;if(typeof o==="object"&&o!==null){a=o;o=null}a=a||{};const[,c,l]=t.match(/([^ ]+) *(.*)/);const u=this.createCommand(c);if(o){u.description(o);u._executableHandler=true}if(a.isDefault)this._defaultCommandName=u._name;u._hidden=!!(a.noHelp||a.hidden);u._executableFile=a.executableFile||null;if(l)u.arguments(l);this._registerCommand(u);u.parent=this;u.copyInheritedSettings(this);if(o)return this;return u}createCommand(t){return new Command(t)}createHelp(){return Object.assign(new m,this.configureHelp())}configureHelp(t){if(t===undefined)return this._helpConfiguration;this._helpConfiguration=t;return this}configureOutput(t){if(t===undefined)return this._outputConfiguration;Object.assign(this._outputConfiguration,t);return this}showHelpAfterError(t=true){if(typeof t!=="string")t=!!t;this._showHelpAfterError=t;return this}showSuggestionAfterError(t=true){this._showSuggestionAfterError=!!t;return this}addCommand(t,r){if(!t._name){throw new Error(`Command passed to .addCommand() must have a name\n- specify the name in Command constructor or using .name()`)}r=r||{};if(r.isDefault)this._defaultCommandName=t._name;if(r.noHelp||r.hidden)t._hidden=true;this._registerCommand(t);t.parent=this;t._checkForBrokenPassThrough();return this}createArgument(t,r){return new h(t,r)}argument(t,r,i,o){const a=this.createArgument(t,r);if(typeof i==="function"){a.default(o).argParser(i)}else{a.default(i)}this.addArgument(a);return this}arguments(t){t.trim().split(/ +/).forEach((t=>{this.argument(t)}));return this}addArgument(t){const r=this.registeredArguments.slice(-1)[0];if(r&&r.variadic){throw new Error(`only the last argument can be variadic '${r.name()}'`)}if(t.required&&t.defaultValue!==undefined&&t.parseArg===undefined){throw new Error(`a default value for a required argument is never used: '${t.name()}'`)}this.registeredArguments.push(t);return this}helpCommand(t,r){if(typeof t==="boolean"){this._addImplicitHelpCommand=t;return this}t=t??"help [command]";const[,i,o]=t.match(/([^ ]+) *(.*)/);const a=r??"display help for command";const c=this.createCommand(i);c.helpOption(false);if(o)c.arguments(o);if(a)c.description(a);this._addImplicitHelpCommand=true;this._helpCommand=c;return this}addHelpCommand(t,r){if(typeof t!=="object"){this.helpCommand(t,r);return this}this._addImplicitHelpCommand=true;this._helpCommand=t;return this}_getHelpCommand(){const t=this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand("help"));if(t){if(this._helpCommand===undefined){this.helpCommand(undefined,undefined)}return this._helpCommand}return null}hook(t,r){const i=["preSubcommand","preAction","postAction"];if(!i.includes(t)){throw new Error(`Unexpected value for event passed to hook : '${t}'.\nExpecting one of '${i.join("', '")}'`)}if(this._lifeCycleHooks[t]){this._lifeCycleHooks[t].push(r)}else{this._lifeCycleHooks[t]=[r]}return this}exitOverride(t){if(t){this._exitCallback=t}else{this._exitCallback=t=>{if(t.code!=="commander.executeSubCommandAsync"){throw t}else{}}}return this}_exit(t,r,i){if(this._exitCallback){this._exitCallback(new p(t,r,i))}u.exit(t)}action(t){const listener=r=>{const i=this.registeredArguments.length;const o=r.slice(0,i);if(this._storeOptionsAsProperties){o[i]=this}else{o[i]=this.opts()}o.push(this);return t.apply(this,o)};this._actionHandler=listener;return this}createOption(t,r){return new g(t,r)}_callParseArg(t,r,i,o){try{return t.parseArg(r,i)}catch(t){if(t.code==="commander.invalidArgument"){const r=`${o} ${t.message}`;this.error(r,{exitCode:t.exitCode,code:t.code})}throw t}}_registerOption(t){const r=t.short&&this._findOption(t.short)||t.long&&this._findOption(t.long);if(r){const i=t.long&&this._findOption(t.long)?t.long:t.short;throw new Error(`Cannot add option '${t.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${i}'\n- already used by option '${r.flags}'`)}this.options.push(t)}_registerCommand(t){const knownBy=t=>[t.name()].concat(t.aliases());const r=knownBy(t).find((t=>this._findCommand(t)));if(r){const i=knownBy(this._findCommand(r)).join("|");const o=knownBy(t).join("|");throw new Error(`cannot add command '${o}' as already have command '${i}'`)}this.commands.push(t)}addOption(t){this._registerOption(t);const r=t.name();const i=t.attributeName();if(t.negate){const r=t.long.replace(/^--no-/,"--");if(!this._findOption(r)){this.setOptionValueWithSource(i,t.defaultValue===undefined?true:t.defaultValue,"default")}}else if(t.defaultValue!==undefined){this.setOptionValueWithSource(i,t.defaultValue,"default")}const handleOptionValue=(r,o,a)=>{if(r==null&&t.presetArg!==undefined){r=t.presetArg}const c=this.getOptionValue(i);if(r!==null&&t.parseArg){r=this._callParseArg(t,r,c,o)}else if(r!==null&&t.variadic){r=t._concatValue(r,c)}if(r==null){if(t.negate){r=false}else if(t.isBoolean()||t.optional){r=true}else{r=""}}this.setOptionValueWithSource(i,r,a)};this.on("option:"+r,(r=>{const i=`error: option '${t.flags}' argument '${r}' is invalid.`;handleOptionValue(r,i,"cli")}));if(t.envVar){this.on("optionEnv:"+r,(r=>{const i=`error: option '${t.flags}' value '${r}' from env '${t.envVar}' is invalid.`;handleOptionValue(r,i,"env")}))}return this}_optionEx(t,r,i,o,a){if(typeof r==="object"&&r instanceof g){throw new Error("To add an Option object use addOption() instead of option() or requiredOption()")}const c=this.createOption(r,i);c.makeOptionMandatory(!!t.mandatory);if(typeof o==="function"){c.default(a).argParser(o)}else if(o instanceof RegExp){const t=o;o=(r,i)=>{const o=t.exec(r);return o?o[0]:i};c.default(a).argParser(o)}else{c.default(o)}return this.addOption(c)}option(t,r,i,o){return this._optionEx({},t,r,i,o)}requiredOption(t,r,i,o){return this._optionEx({mandatory:true},t,r,i,o)}combineFlagAndOptionalValue(t=true){this._combineFlagAndOptionalValue=!!t;return this}allowUnknownOption(t=true){this._allowUnknownOption=!!t;return this}allowExcessArguments(t=true){this._allowExcessArguments=!!t;return this}enablePositionalOptions(t=true){this._enablePositionalOptions=!!t;return this}passThroughOptions(t=true){this._passThroughOptions=!!t;this._checkForBrokenPassThrough();return this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions){throw new Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}}storeOptionsAsProperties(t=true){if(this.options.length){throw new Error("call .storeOptionsAsProperties() before adding options")}if(Object.keys(this._optionValues).length){throw new Error("call .storeOptionsAsProperties() before setting option values")}this._storeOptionsAsProperties=!!t;return this}getOptionValue(t){if(this._storeOptionsAsProperties){return this[t]}return this._optionValues[t]}setOptionValue(t,r){return this.setOptionValueWithSource(t,r,undefined)}setOptionValueWithSource(t,r,i){if(this._storeOptionsAsProperties){this[t]=r}else{this._optionValues[t]=r}this._optionValueSources[t]=i;return this}getOptionValueSource(t){return this._optionValueSources[t]}getOptionValueSourceWithGlobals(t){let r;this._getCommandAndAncestors().forEach((i=>{if(i.getOptionValueSource(t)!==undefined){r=i.getOptionValueSource(t)}}));return r}_prepareUserArgs(t,r){if(t!==undefined&&!Array.isArray(t)){throw new Error("first parameter to parse must be array or undefined")}r=r||{};if(t===undefined&&r.from===undefined){if(u.versions?.electron){r.from="electron"}const t=u.execArgv??[];if(t.includes("-e")||t.includes("--eval")||t.includes("-p")||t.includes("--print")){r.from="eval"}}if(t===undefined){t=u.argv}this.rawArgs=t.slice();let i;switch(r.from){case undefined:case"node":this._scriptPath=t[1];i=t.slice(2);break;case"electron":if(u.defaultApp){this._scriptPath=t[1];i=t.slice(2)}else{i=t.slice(1)}break;case"user":i=t.slice(0);break;case"eval":i=t.slice(1);break;default:throw new Error(`unexpected parse option { from: '${r.from}' }`)}if(!this._name&&this._scriptPath)this.nameFromFilename(this._scriptPath);this._name=this._name||"program";return i}parse(t,r){const i=this._prepareUserArgs(t,r);this._parseCommand([],i);return this}async parseAsync(t,r){const i=this._prepareUserArgs(t,r);await this._parseCommand([],i);return this}_executeSubCommand(t,r){r=r.slice();let i=false;const o=[".js",".ts",".tsx",".mjs",".cjs"];function findFile(t,r){const i=c.resolve(t,r);if(l.existsSync(i))return i;if(o.includes(c.extname(r)))return undefined;const a=o.find((t=>l.existsSync(`${i}${t}`)));if(a)return`${i}${a}`;return undefined}this._checkForMissingMandatoryOptions();this._checkForConflictingOptions();let h=t._executableFile||`${this._name}-${t._name}`;let d=this._executableDir||"";if(this._scriptPath){let t;try{t=l.realpathSync(this._scriptPath)}catch(r){t=this._scriptPath}d=c.resolve(c.dirname(t),d)}if(d){let r=findFile(d,h);if(!r&&!t._executableFile&&this._scriptPath){const i=c.basename(this._scriptPath,c.extname(this._scriptPath));if(i!==this._name){r=findFile(d,`${i}-${t._name}`)}}h=r||h}i=o.includes(c.extname(h));let m;if(u.platform!=="win32"){if(i){r.unshift(h);r=incrementNodeInspectorPort(u.execArgv).concat(r);m=a.spawn(u.argv[0],r,{stdio:"inherit"})}else{m=a.spawn(h,r,{stdio:"inherit"})}}else{r.unshift(h);r=incrementNodeInspectorPort(u.execArgv).concat(r);m=a.spawn(u.execPath,r,{stdio:"inherit"})}if(!m.killed){const t=["SIGUSR1","SIGUSR2","SIGTERM","SIGINT","SIGHUP"];t.forEach((t=>{u.on(t,(()=>{if(m.killed===false&&m.exitCode===null){m.kill(t)}}))}))}const g=this._exitCallback;m.on("close",(t=>{t=t??1;if(!g){u.exit(t)}else{g(new p(t,"commander.executeSubCommandAsync","(close)"))}}));m.on("error",(r=>{if(r.code==="ENOENT"){const r=d?`searched for local subcommand relative to directory '${d}'`:"no directory for search for local subcommand, use .executableDir() to supply a custom directory";const i=`'${h}' does not exist\n - if '${t._name}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead\n - if the default executable name is not suitable, use the executableFile option to supply a custom name or path\n - ${r}`;throw new Error(i)}else if(r.code==="EACCES"){throw new Error(`'${h}' not executable`)}if(!g){u.exit(1)}else{const t=new p(1,"commander.executeSubCommandAsync","(error)");t.nestedError=r;g(t)}}));this.runningCommand=m}_dispatchSubcommand(t,r,i){const o=this._findCommand(t);if(!o)this.help({error:true});let a;a=this._chainOrCallSubCommandHook(a,o,"preSubcommand");a=this._chainOrCall(a,(()=>{if(o._executableHandler){this._executeSubCommand(o,r.concat(i))}else{return o._parseCommand(r,i)}}));return a}_dispatchHelpCommand(t){if(!t){this.help()}const r=this._findCommand(t);if(r&&!r._executableHandler){r.help()}return this._dispatchSubcommand(t,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??"--help"])}_checkNumberOfArguments(){this.registeredArguments.forEach(((t,r)=>{if(t.required&&this.args[r]==null){this.missingArgument(t.name())}}));if(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic){return}if(this.args.length>this.registeredArguments.length){this._excessArguments(this.args)}}_processArguments(){const myParseArg=(t,r,i)=>{let o=r;if(r!==null&&t.parseArg){const a=`error: command-argument value '${r}' is invalid for argument '${t.name()}'.`;o=this._callParseArg(t,r,i,a)}return o};this._checkNumberOfArguments();const t=[];this.registeredArguments.forEach(((r,i)=>{let o=r.defaultValue;if(r.variadic){if(i<this.args.length){o=this.args.slice(i);if(r.parseArg){o=o.reduce(((t,i)=>myParseArg(r,i,t)),r.defaultValue)}}else if(o===undefined){o=[]}}else if(i<this.args.length){o=this.args[i];if(r.parseArg){o=myParseArg(r,o,r.defaultValue)}}t[i]=o}));this.processedArgs=t}_chainOrCall(t,r){if(t&&t.then&&typeof t.then==="function"){return t.then((()=>r()))}return r()}_chainOrCallHooks(t,r){let i=t;const o=[];this._getCommandAndAncestors().reverse().filter((t=>t._lifeCycleHooks[r]!==undefined)).forEach((t=>{t._lifeCycleHooks[r].forEach((r=>{o.push({hookedCommand:t,callback:r})}))}));if(r==="postAction"){o.reverse()}o.forEach((t=>{i=this._chainOrCall(i,(()=>t.callback(t.hookedCommand,this)))}));return i}_chainOrCallSubCommandHook(t,r,i){let o=t;if(this._lifeCycleHooks[i]!==undefined){this._lifeCycleHooks[i].forEach((t=>{o=this._chainOrCall(o,(()=>t(this,r)))}))}return o}_parseCommand(t,r){const i=this.parseOptions(r);this._parseOptionsEnv();this._parseOptionsImplied();t=t.concat(i.operands);r=i.unknown;this.args=t.concat(r);if(t&&this._findCommand(t[0])){return this._dispatchSubcommand(t[0],t.slice(1),r)}if(this._getHelpCommand()&&t[0]===this._getHelpCommand().name()){return this._dispatchHelpCommand(t[1])}if(this._defaultCommandName){this._outputHelpIfRequested(r);return this._dispatchSubcommand(this._defaultCommandName,t,r)}if(this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName){this.help({error:true})}this._outputHelpIfRequested(i.unknown);this._checkForMissingMandatoryOptions();this._checkForConflictingOptions();const checkForUnknownOptions=()=>{if(i.unknown.length>0){this.unknownOption(i.unknown[0])}};const o=`command:${this.name()}`;if(this._actionHandler){checkForUnknownOptions();this._processArguments();let i;i=this._chainOrCallHooks(i,"preAction");i=this._chainOrCall(i,(()=>this._actionHandler(this.processedArgs)));if(this.parent){i=this._chainOrCall(i,(()=>{this.parent.emit(o,t,r)}))}i=this._chainOrCallHooks(i,"postAction");return i}if(this.parent&&this.parent.listenerCount(o)){checkForUnknownOptions();this._processArguments();this.parent.emit(o,t,r)}else if(t.length){if(this._findCommand("*")){return this._dispatchSubcommand("*",t,r)}if(this.listenerCount("command:*")){this.emit("command:*",t,r)}else if(this.commands.length){this.unknownCommand()}else{checkForUnknownOptions();this._processArguments()}}else if(this.commands.length){checkForUnknownOptions();this.help({error:true})}else{checkForUnknownOptions();this._processArguments()}}_findCommand(t){if(!t)return undefined;return this.commands.find((r=>r._name===t||r._aliases.includes(t)))}_findOption(t){return this.options.find((r=>r.is(t)))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach((t=>{t.options.forEach((r=>{if(r.mandatory&&t.getOptionValue(r.attributeName())===undefined){t.missingMandatoryOptionValue(r)}}))}))}_checkForConflictingLocalOptions(){const t=this.options.filter((t=>{const r=t.attributeName();if(this.getOptionValue(r)===undefined){return false}return this.getOptionValueSource(r)!=="default"}));const r=t.filter((t=>t.conflictsWith.length>0));r.forEach((r=>{const i=t.find((t=>r.conflictsWith.includes(t.attributeName())));if(i){this._conflictingOption(r,i)}}))}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach((t=>{t._checkForConflictingLocalOptions()}))}parseOptions(t){const r=[];const i=[];let o=r;const a=t.slice();function maybeOption(t){return t.length>1&&t[0]==="-"}let c=null;while(a.length){const t=a.shift();if(t==="--"){if(o===i)o.push(t);o.push(...a);break}if(c&&!maybeOption(t)){this.emit(`option:${c.name()}`,t);continue}c=null;if(maybeOption(t)){const r=this._findOption(t);if(r){if(r.required){const t=a.shift();if(t===undefined)this.optionMissingArgument(r);this.emit(`option:${r.name()}`,t)}else if(r.optional){let t=null;if(a.length>0&&!maybeOption(a[0])){t=a.shift()}this.emit(`option:${r.name()}`,t)}else{this.emit(`option:${r.name()}`)}c=r.variadic?r:null;continue}}if(t.length>2&&t[0]==="-"&&t[1]!=="-"){const r=this._findOption(`-${t[1]}`);if(r){if(r.required||r.optional&&this._combineFlagAndOptionalValue){this.emit(`option:${r.name()}`,t.slice(2))}else{this.emit(`option:${r.name()}`);a.unshift(`-${t.slice(2)}`)}continue}}if(/^--[^=]+=/.test(t)){const r=t.indexOf("=");const i=this._findOption(t.slice(0,r));if(i&&(i.required||i.optional)){this.emit(`option:${i.name()}`,t.slice(r+1));continue}}if(maybeOption(t)){o=i}if((this._enablePositionalOptions||this._passThroughOptions)&&r.length===0&&i.length===0){if(this._findCommand(t)){r.push(t);if(a.length>0)i.push(...a);break}else if(this._getHelpCommand()&&t===this._getHelpCommand().name()){r.push(t);if(a.length>0)r.push(...a);break}else if(this._defaultCommandName){i.push(t);if(a.length>0)i.push(...a);break}}if(this._passThroughOptions){o.push(t);if(a.length>0)o.push(...a);break}o.push(t)}return{operands:r,unknown:i}}opts(){if(this._storeOptionsAsProperties){const t={};const r=this.options.length;for(let i=0;i<r;i++){const r=this.options[i].attributeName();t[r]=r===this._versionOptionName?this._version:this[r]}return t}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce(((t,r)=>Object.assign(t,r.opts())),{})}error(t,r){this._outputConfiguration.outputError(`${t}\n`,this._outputConfiguration.writeErr);if(typeof this._showHelpAfterError==="string"){this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`)}else if(this._showHelpAfterError){this._outputConfiguration.writeErr("\n");this.outputHelp({error:true})}const i=r||{};const o=i.exitCode||1;const a=i.code||"commander.error";this._exit(o,a,t)}_parseOptionsEnv(){this.options.forEach((t=>{if(t.envVar&&t.envVar in u.env){const r=t.attributeName();if(this.getOptionValue(r)===undefined||["default","config","env"].includes(this.getOptionValueSource(r))){if(t.required||t.optional){this.emit(`optionEnv:${t.name()}`,u.env[t.envVar])}else{this.emit(`optionEnv:${t.name()}`)}}}}))}_parseOptionsImplied(){const t=new y(this.options);const hasCustomOptionValue=t=>this.getOptionValue(t)!==undefined&&!["default","implied"].includes(this.getOptionValueSource(t));this.options.filter((r=>r.implied!==undefined&&hasCustomOptionValue(r.attributeName())&&t.valueFromOption(this.getOptionValue(r.attributeName()),r))).forEach((t=>{Object.keys(t.implied).filter((t=>!hasCustomOptionValue(t))).forEach((r=>{this.setOptionValueWithSource(r,t.implied[r],"implied")}))}))}missingArgument(t){const r=`error: missing required argument '${t}'`;this.error(r,{code:"commander.missingArgument"})}optionMissingArgument(t){const r=`error: option '${t.flags}' argument missing`;this.error(r,{code:"commander.optionMissingArgument"})}missingMandatoryOptionValue(t){const r=`error: required option '${t.flags}' not specified`;this.error(r,{code:"commander.missingMandatoryOptionValue"})}_conflictingOption(t,r){const findBestOptionFromValue=t=>{const r=t.attributeName();const i=this.getOptionValue(r);const o=this.options.find((t=>t.negate&&r===t.attributeName()));const a=this.options.find((t=>!t.negate&&r===t.attributeName()));if(o&&(o.presetArg===undefined&&i===false||o.presetArg!==undefined&&i===o.presetArg)){return o}return a||t};const getErrorMessage=t=>{const r=findBestOptionFromValue(t);const i=r.attributeName();const o=this.getOptionValueSource(i);if(o==="env"){return`environment variable '${r.envVar}'`}return`option '${r.flags}'`};const i=`error: ${getErrorMessage(t)} cannot be used with ${getErrorMessage(r)}`;this.error(i,{code:"commander.conflictingOption"})}unknownOption(t){if(this._allowUnknownOption)return;let r="";if(t.startsWith("--")&&this._showSuggestionAfterError){let i=[];let o=this;do{const t=o.createHelp().visibleOptions(o).filter((t=>t.long)).map((t=>t.long));i=i.concat(t);o=o.parent}while(o&&!o._enablePositionalOptions);r=v(t,i)}const i=`error: unknown option '${t}'${r}`;this.error(i,{code:"commander.unknownOption"})}_excessArguments(t){if(this._allowExcessArguments)return;const r=this.registeredArguments.length;const i=r===1?"":"s";const o=this.parent?` for '${this.name()}'`:"";const a=`error: too many arguments${o}. Expected ${r} argument${i} but got ${t.length}.`;this.error(a,{code:"commander.excessArguments"})}unknownCommand(){const t=this.args[0];let r="";if(this._showSuggestionAfterError){const i=[];this.createHelp().visibleCommands(this).forEach((t=>{i.push(t.name());if(t.alias())i.push(t.alias())}));r=v(t,i)}const i=`error: unknown command '${t}'${r}`;this.error(i,{code:"commander.unknownCommand"})}version(t,r,i){if(t===undefined)return this._version;this._version=t;r=r||"-V, --version";i=i||"output the version number";const o=this.createOption(r,i);this._versionOptionName=o.attributeName();this._registerOption(o);this.on("option:"+o.name(),(()=>{this._outputConfiguration.writeOut(`${t}\n`);this._exit(0,"commander.version",t)}));return this}description(t,r){if(t===undefined&&r===undefined)return this._description;this._description=t;if(r){this._argsDescription=r}return this}summary(t){if(t===undefined)return this._summary;this._summary=t;return this}alias(t){if(t===undefined)return this._aliases[0];let r=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler){r=this.commands[this.commands.length-1]}if(t===r._name)throw new Error("Command alias can't be the same as its name");const i=this.parent?._findCommand(t);if(i){const r=[i.name()].concat(i.aliases()).join("|");throw new Error(`cannot add alias '${t}' to command '${this.name()}' as already have command '${r}'`)}r._aliases.push(t);return this}aliases(t){if(t===undefined)return this._aliases;t.forEach((t=>this.alias(t)));return this}usage(t){if(t===undefined){if(this._usage)return this._usage;const t=this.registeredArguments.map((t=>d(t)));return[].concat(this.options.length||this._helpOption!==null?"[options]":[],this.commands.length?"[command]":[],this.registeredArguments.length?t:[]).join(" ")}this._usage=t;return this}name(t){if(t===undefined)return this._name;this._name=t;return this}nameFromFilename(t){this._name=c.basename(t,c.extname(t));return this}executableDir(t){if(t===undefined)return this._executableDir;this._executableDir=t;return this}helpInformation(t){const r=this.createHelp();if(r.helpWidth===undefined){r.helpWidth=t&&t.error?this._outputConfiguration.getErrHelpWidth():this._outputConfiguration.getOutHelpWidth()}return r.formatHelp(this,r)}_getHelpContext(t){t=t||{};const r={error:!!t.error};let i;if(r.error){i=t=>this._outputConfiguration.writeErr(t)}else{i=t=>this._outputConfiguration.writeOut(t)}r.write=t.write||i;r.command=this;return r}outputHelp(t){let r;if(typeof t==="function"){r=t;t=undefined}const i=this._getHelpContext(t);this._getCommandAndAncestors().reverse().forEach((t=>t.emit("beforeAllHelp",i)));this.emit("beforeHelp",i);let o=this.helpInformation(i);if(r){o=r(o);if(typeof o!=="string"&&!Buffer.isBuffer(o)){throw new Error("outputHelp callback must return a string or a Buffer")}}i.write(o);if(this._getHelpOption()?.long){this.emit(this._getHelpOption().long)}this.emit("afterHelp",i);this._getCommandAndAncestors().forEach((t=>t.emit("afterAllHelp",i)))}helpOption(t,r){if(typeof t==="boolean"){if(t){this._helpOption=this._helpOption??undefined}else{this._helpOption=null}return this}t=t??"-h, --help";r=r??"display help for command";this._helpOption=this.createOption(t,r);return this}_getHelpOption(){if(this._helpOption===undefined){this.helpOption(undefined,undefined)}return this._helpOption}addHelpOption(t){this._helpOption=t;return this}help(t){this.outputHelp(t);let r=u.exitCode||0;if(r===0&&t&&typeof t!=="function"&&t.error){r=1}this._exit(r,"commander.help","(outputHelp)")}addHelpText(t,r){const i=["beforeAll","before","after","afterAll"];if(!i.includes(t)){throw new Error(`Unexpected value for position to addHelpText.\nExpecting one of '${i.join("', '")}'`)}const o=`${t}Help`;this.on(o,(t=>{let i;if(typeof r==="function"){i=r({error:t.error,command:t.command})}else{i=r}if(i){t.write(`${i}\n`)}}));return this}_outputHelpIfRequested(t){const r=this._getHelpOption();const i=r&&t.find((t=>r.is(t)));if(i){this.outputHelp();this._exit(0,"commander.helpDisplayed","(outputHelp)")}}}function incrementNodeInspectorPort(t){return t.map((t=>{if(!t.startsWith("--inspect")){return t}let r;let i="127.0.0.1";let o="9229";let a;if((a=t.match(/^(--inspect(-brk)?)$/))!==null){r=a[1]}else if((a=t.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))!==null){r=a[1];if(/^\d+$/.test(a[3])){o=a[3]}else{i=a[3]}}else if((a=t.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null){r=a[1];i=a[3];o=a[4]}if(r&&o!=="0"){return`${r}=${i}:${parseInt(o)+1}`}return t}))}r.Command=Command},5246:(t,r)=>{class CommanderError extends Error{constructor(t,r,i){super(i);Error.captureStackTrace(this,this.constructor);this.name=this.constructor.name;this.code=r;this.exitCode=t;this.nestedError=undefined}}class InvalidArgumentError extends CommanderError{constructor(t){super(1,"commander.invalidArgument",t);Error.captureStackTrace(this,this.constructor);this.name=this.constructor.name}}r.CommanderError=CommanderError;r.InvalidArgumentError=InvalidArgumentError},5889:(t,r,i)=>{const{humanReadableArgName:o}=i(3573);class Help{constructor(){this.helpWidth=undefined;this.sortSubcommands=false;this.sortOptions=false;this.showGlobalOptions=false}visibleCommands(t){const r=t.commands.filter((t=>!t._hidden));const i=t._getHelpCommand();if(i&&!i._hidden){r.push(i)}if(this.sortSubcommands){r.sort(((t,r)=>t.name().localeCompare(r.name())))}return r}compareOptions(t,r){const getSortKey=t=>t.short?t.short.replace(/^-/,""):t.long.replace(/^--/,"");return getSortKey(t).localeCompare(getSortKey(r))}visibleOptions(t){const r=t.options.filter((t=>!t.hidden));const i=t._getHelpOption();if(i&&!i.hidden){const o=i.short&&t._findOption(i.short);const a=i.long&&t._findOption(i.long);if(!o&&!a){r.push(i)}else if(i.long&&!a){r.push(t.createOption(i.long,i.description))}else if(i.short&&!o){r.push(t.createOption(i.short,i.description))}}if(this.sortOptions){r.sort(this.compareOptions)}return r}visibleGlobalOptions(t){if(!this.showGlobalOptions)return[];const r=[];for(let i=t.parent;i;i=i.parent){const t=i.options.filter((t=>!t.hidden));r.push(...t)}if(this.sortOptions){r.sort(this.compareOptions)}return r}visibleArguments(t){if(t._argsDescription){t.registeredArguments.forEach((r=>{r.description=r.description||t._argsDescription[r.name()]||""}))}if(t.registeredArguments.find((t=>t.description))){return t.registeredArguments}return[]}subcommandTerm(t){const r=t.registeredArguments.map((t=>o(t))).join(" ");return t._name+(t._aliases[0]?"|"+t._aliases[0]:"")+(t.options.length?" [options]":"")+(r?" "+r:"")}optionTerm(t){return t.flags}argumentTerm(t){return t.name()}longestSubcommandTermLength(t,r){return r.visibleCommands(t).reduce(((t,i)=>Math.max(t,r.subcommandTerm(i).length)),0)}longestOptionTermLength(t,r){return r.visibleOptions(t).reduce(((t,i)=>Math.max(t,r.optionTerm(i).length)),0)}longestGlobalOptionTermLength(t,r){return r.visibleGlobalOptions(t).reduce(((t,i)=>Math.max(t,r.optionTerm(i).length)),0)}longestArgumentTermLength(t,r){return r.visibleArguments(t).reduce(((t,i)=>Math.max(t,r.argumentTerm(i).length)),0)}commandUsage(t){let r=t._name;if(t._aliases[0]){r=r+"|"+t._aliases[0]}let i="";for(let r=t.parent;r;r=r.parent){i=r.name()+" "+i}return i+r+" "+t.usage()}commandDescription(t){return t.description()}subcommandDescription(t){return t.summary()||t.description()}optionDescription(t){const r=[];if(t.argChoices){r.push(`choices: ${t.argChoices.map((t=>JSON.stringify(t))).join(", ")}`)}if(t.defaultValue!==undefined){const i=t.required||t.optional||t.isBoolean()&&typeof t.defaultValue==="boolean";if(i){r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`)}}if(t.presetArg!==undefined&&t.optional){r.push(`preset: ${JSON.stringify(t.presetArg)}`)}if(t.envVar!==undefined){r.push(`env: ${t.envVar}`)}if(r.length>0){return`${t.description} (${r.join(", ")})`}return t.description}argumentDescription(t){const r=[];if(t.argChoices){r.push(`choices: ${t.argChoices.map((t=>JSON.stringify(t))).join(", ")}`)}if(t.defaultValue!==undefined){r.push(`default: ${t.defaultValueDescription||JSON.stringify(t.defaultValue)}`)}if(r.length>0){const i=`(${r.join(", ")})`;if(t.description){return`${t.description} ${i}`}return i}return t.description}formatHelp(t,r){const i=r.padWidth(t,r);const o=r.helpWidth||80;const a=2;const c=2;function formatItem(t,l){if(l){const u=`${t.padEnd(i+c)}${l}`;return r.wrap(u,o-a,i+c)}return t}function formatList(t){return t.join("\n").replace(/^/gm," ".repeat(a))}let l=[`Usage: ${r.commandUsage(t)}`,""];const u=r.commandDescription(t);if(u.length>0){l=l.concat([r.wrap(u,o,0),""])}const h=r.visibleArguments(t).map((t=>formatItem(r.argumentTerm(t),r.argumentDescription(t))));if(h.length>0){l=l.concat(["Arguments:",formatList(h),""])}const d=r.visibleOptions(t).map((t=>formatItem(r.optionTerm(t),r.optionDescription(t))));if(d.length>0){l=l.concat(["Options:",formatList(d),""])}if(this.showGlobalOptions){const i=r.visibleGlobalOptions(t).map((t=>formatItem(r.optionTerm(t),r.optionDescription(t))));if(i.length>0){l=l.concat(["Global Options:",formatList(i),""])}}const p=r.visibleCommands(t).map((t=>formatItem(r.subcommandTerm(t),r.subcommandDescription(t))));if(p.length>0){l=l.concat(["Commands:",formatList(p),""])}return l.join("\n")}padWidth(t,r){return Math.max(r.longestOptionTermLength(t,r),r.longestGlobalOptionTermLength(t,r),r.longestSubcommandTermLength(t,r),r.longestArgumentTermLength(t,r))}wrap(t,r,i,o=40){const a=" \\f\\t\\v - \ufeff";const c=new RegExp(`[\\n][${a}]+`);if(t.match(c))return t;const l=r-i;if(l<o)return t;const u=t.slice(0,i);const h=t.slice(i).replace("\r\n","\n");const d=" ".repeat(i);const p="";const m=`\\s${p}`;const g=new RegExp(`\n|.{1,${l-1}}([${m}]|$)|[^${m}]+?([${m}]|$)`,"g");const y=h.match(g)||[];return u+y.map(((t,r)=>{if(t==="\n")return"";return(r>0?d:"")+t.trimEnd()})).join("\n")}}r.Help=Help},8127:(t,r,i)=>{const{InvalidArgumentError:o}=i(5246);class Option{constructor(t,r){this.flags=t;this.description=r||"";this.required=t.includes("<");this.optional=t.includes("[");this.variadic=/\w\.\.\.[>\]]$/.test(t);this.mandatory=false;const i=splitOptionFlags(t);this.short=i.shortFlag;this.long=i.longFlag;this.negate=false;if(this.long){this.negate=this.long.startsWith("--no-")}this.defaultValue=undefined;this.defaultValueDescription=undefined;this.presetArg=undefined;this.envVar=undefined;this.parseArg=undefined;this.hidden=false;this.argChoices=undefined;this.conflictsWith=[];this.implied=undefined}default(t,r){this.defaultValue=t;this.defaultValueDescription=r;return this}preset(t){this.presetArg=t;return this}conflicts(t){this.conflictsWith=this.conflictsWith.concat(t);return this}implies(t){let r=t;if(typeof t==="string"){r={[t]:true}}this.implied=Object.assign(this.implied||{},r);return this}env(t){this.envVar=t;return this}argParser(t){this.parseArg=t;return this}makeOptionMandatory(t=true){this.mandatory=!!t;return this}hideHelp(t=true){this.hidden=!!t;return this}_concatValue(t,r){if(r===this.defaultValue||!Array.isArray(r)){return[t]}return r.concat(t)}choices(t){this.argChoices=t.slice();this.parseArg=(t,r)=>{if(!this.argChoices.includes(t)){throw new o(`Allowed choices are ${this.argChoices.join(", ")}.`)}if(this.variadic){return this._concatValue(t,r)}return t};return this}name(){if(this.long){return this.long.replace(/^--/,"")}return this.short.replace(/^-/,"")}attributeName(){return camelcase(this.name().replace(/^no-/,""))}is(t){return this.short===t||this.long===t}isBoolean(){return!this.required&&!this.optional&&!this.negate}}class DualOptions{constructor(t){this.positiveOptions=new Map;this.negativeOptions=new Map;this.dualOptions=new Set;t.forEach((t=>{if(t.negate){this.negativeOptions.set(t.attributeName(),t)}else{this.positiveOptions.set(t.attributeName(),t)}}));this.negativeOptions.forEach(((t,r)=>{if(this.positiveOptions.has(r)){this.dualOptions.add(r)}}))}valueFromOption(t,r){const i=r.attributeName();if(!this.dualOptions.has(i))return true;const o=this.negativeOptions.get(i).presetArg;const a=o!==undefined?o:false;return r.negate===(a===t)}}function camelcase(t){return t.split("-").reduce(((t,r)=>t+r[0].toUpperCase()+r.slice(1)))}function splitOptionFlags(t){let r;let i;const o=t.split(/[ |,]+/);if(o.length>1&&!/^[[<]/.test(o[1]))r=o.shift();i=o.shift();if(!r&&/^-[^-]$/.test(i)){r=i;i=undefined}return{shortFlag:r,longFlag:i}}r.Option=Option;r.DualOptions=DualOptions},3733:(t,r)=>{const i=3;function editDistance(t,r){if(Math.abs(t.length-r.length)>i)return Math.max(t.length,r.length);const o=[];for(let r=0;r<=t.length;r++){o[r]=[r]}for(let t=0;t<=r.length;t++){o[0][t]=t}for(let i=1;i<=r.length;i++){for(let a=1;a<=t.length;a++){let c=1;if(t[a-1]===r[i-1]){c=0}else{c=1}o[a][i]=Math.min(o[a-1][i]+1,o[a][i-1]+1,o[a-1][i-1]+c);if(a>1&&i>1&&t[a-1]===r[i-2]&&t[a-2]===r[i-1]){o[a][i]=Math.min(o[a][i],o[a-2][i-2]+1)}}}return o[t.length][r.length]}function suggestSimilar(t,r){if(!r||r.length===0)return"";r=Array.from(new Set(r));const o=t.startsWith("--");if(o){t=t.slice(2);r=r.map((t=>t.slice(2)))}let a=[];let c=i;const l=.4;r.forEach((r=>{if(r.length<=1)return;const i=editDistance(t,r);const o=Math.max(t.length,r.length);const u=(o-i)/o;if(u>l){if(i<c){c=i;a=[r]}else if(i===c){a.push(r)}}}));a.sort(((t,r)=>t.localeCompare(r)));if(o){a=a.map((t=>`--${t}`))}if(a.length>1){return`\n(Did you mean one of ${a.join(", ")}?)`}if(a.length===1){return`\n(Did you mean ${a[0]}?)`}return""}r.suggestSimilar=suggestSimilar},2387:(t,r,i)=>{"use strict";const{normalizeIPv6:o,normalizeIPv4:a,removeDotSegments:c,recomposeAuthority:l,normalizeComponentEncoding:u}=i(3918);const h=i(7475);function normalize(t,r){if(typeof t==="string"){t=serialize(parse(t,r),r)}else if(typeof t==="object"){t=parse(serialize(t,r),r)}return t}function resolve(t,r,i){const o=Object.assign({scheme:"null"},i);const a=resolveComponents(parse(t,o),parse(r,o),o,true);return serialize(a,{...o,skipEscape:true})}function resolveComponents(t,r,i,o){const a={};if(!o){t=parse(serialize(t,i),i);r=parse(serialize(r,i),i)}i=i||{};if(!i.tolerant&&r.scheme){a.scheme=r.scheme;a.userinfo=r.userinfo;a.host=r.host;a.port=r.port;a.path=c(r.path||"");a.query=r.query}else{if(r.userinfo!==undefined||r.host!==undefined||r.port!==undefined){a.userinfo=r.userinfo;a.host=r.host;a.port=r.port;a.path=c(r.path||"");a.query=r.query}else{if(!r.path){a.path=t.path;if(r.query!==undefined){a.query=r.query}else{a.query=t.query}}else{if(r.path.charAt(0)==="/"){a.path=c(r.path)}else{if((t.userinfo!==undefined||t.host!==undefined||t.port!==undefined)&&!t.path){a.path="/"+r.path}else if(!t.path){a.path=r.path}else{a.path=t.path.slice(0,t.path.lastIndexOf("/")+1)+r.path}a.path=c(a.path)}a.query=r.query}a.userinfo=t.userinfo;a.host=t.host;a.port=t.port}a.scheme=t.scheme}a.fragment=r.fragment;return a}function equal(t,r,i){if(typeof t==="string"){t=unescape(t);t=serialize(u(parse(t,i),true),{...i,skipEscape:true})}else if(typeof t==="object"){t=serialize(u(t,true),{...i,skipEscape:true})}if(typeof r==="string"){r=unescape(r);r=serialize(u(parse(r,i),true),{...i,skipEscape:true})}else if(typeof r==="object"){r=serialize(u(r,true),{...i,skipEscape:true})}return t.toLowerCase()===r.toLowerCase()}function serialize(t,r){const i={host:t.host,scheme:t.scheme,userinfo:t.userinfo,port:t.port,path:t.path,query:t.query,nid:t.nid,nss:t.nss,uuid:t.uuid,fragment:t.fragment,reference:t.reference,resourceName:t.resourceName,secure:t.secure,error:""};const o=Object.assign({},r);const a=[];const u=h[(o.scheme||i.scheme||"").toLowerCase()];if(u&&u.serialize)u.serialize(i,o);if(i.path!==undefined){if(!o.skipEscape){i.path=escape(i.path);if(i.scheme!==undefined){i.path=i.path.split("%3A").join(":")}}else{i.path=unescape(i.path)}}if(o.reference!=="suffix"&&i.scheme){a.push(i.scheme,":")}const d=l(i);if(d!==undefined){if(o.reference!=="suffix"){a.push("//")}a.push(d);if(i.path&&i.path.charAt(0)!=="/"){a.push("/")}}if(i.path!==undefined){let t=i.path;if(!o.absolutePath&&(!u||!u.absolutePath)){t=c(t)}if(d===undefined){t=t.replace(/^\/\//u,"/%2F")}a.push(t)}if(i.query!==undefined){a.push("?",i.query)}if(i.fragment!==undefined){a.push("#",i.fragment)}return a.join("")}const d=Array.from({length:127},((t,r)=>/[^!"$&'()*+,\-.;=_`a-z{}~]/u.test(String.fromCharCode(r))));function nonSimpleDomain(t){let r=0;for(let i=0,o=t.length;i<o;++i){r=t.charCodeAt(i);if(r>126||d[r]){return true}}return false}const p=/^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;function parse(t,r){const i=Object.assign({},r);const c={scheme:undefined,userinfo:undefined,host:"",port:undefined,path:"",query:undefined,fragment:undefined};const l=t.indexOf("%")!==-1;let u=false;if(i.reference==="suffix")t=(i.scheme?i.scheme+":":"")+"//"+t;const d=t.match(p);if(d){c.scheme=d[1];c.userinfo=d[3];c.host=d[4];c.port=parseInt(d[5],10);c.path=d[6]||"";c.query=d[7];c.fragment=d[8];if(isNaN(c.port)){c.port=d[5]}if(c.host){const t=a(c.host);if(t.isIPV4===false){const r=o(t.host);c.host=r.host.toLowerCase();u=r.isIPV6}else{c.host=t.host;u=true}}if(c.scheme===undefined&&c.userinfo===undefined&&c.host===undefined&&c.port===undefined&&c.query===undefined&&!c.path){c.reference="same-document"}else if(c.scheme===undefined){c.reference="relative"}else if(c.fragment===undefined){c.reference="absolute"}else{c.reference="uri"}if(i.reference&&i.reference!=="suffix"&&i.reference!==c.reference){c.error=c.error||"URI is not a "+i.reference+" reference."}const t=h[(i.scheme||c.scheme||"").toLowerCase()];if(!i.unicodeSupport&&(!t||!t.unicodeSupport)){if(c.host&&(i.domainHost||t&&t.domainHost)&&u===false&&nonSimpleDomain(c.host)){try{c.host=URL.domainToASCII(c.host.toLowerCase())}catch(t){c.error=c.error||"Host's domain name can not be converted to ASCII: "+t}}}if(!t||t&&!t.skipNormalize){if(l&&c.scheme!==undefined){c.scheme=unescape(c.scheme)}if(l&&c.host!==undefined){c.host=unescape(c.host)}if(c.path){c.path=escape(unescape(c.path))}if(c.fragment){c.fragment=encodeURI(decodeURIComponent(c.fragment))}}if(t&&t.parse){t.parse(c,i)}}else{c.error=c.error||"URI can not be parsed."}return c}const m={SCHEMES:h,normalize:normalize,resolve:resolve,resolveComponents:resolveComponents,equal:equal,serialize:serialize,parse:parse};t.exports=m;t.exports["default"]=m;t.exports.fastUri=m},7475:t=>{"use strict";const r=/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu;const i=/([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;function isSecure(t){return typeof t.secure==="boolean"?t.secure:String(t.scheme).toLowerCase()==="wss"}function httpParse(t){if(!t.host){t.error=t.error||"HTTP URIs must have a host."}return t}function httpSerialize(t){const r=String(t.scheme).toLowerCase()==="https";if(t.port===(r?443:80)||t.port===""){t.port=undefined}if(!t.path){t.path="/"}return t}function wsParse(t){t.secure=isSecure(t);t.resourceName=(t.path||"/")+(t.query?"?"+t.query:"");t.path=undefined;t.query=undefined;return t}function wsSerialize(t){if(t.port===(isSecure(t)?443:80)||t.port===""){t.port=undefined}if(typeof t.secure==="boolean"){t.scheme=t.secure?"wss":"ws";t.secure=undefined}if(t.resourceName){const[r,i]=t.resourceName.split("?");t.path=r&&r!=="/"?r:undefined;t.query=i;t.resourceName=undefined}t.fragment=undefined;return t}function urnParse(t,r){if(!t.path){t.error="URN can not be parsed";return t}const o=t.path.match(i);if(o){const i=r.scheme||t.scheme||"urn";t.nid=o[1].toLowerCase();t.nss=o[2];const a=`${i}:${r.nid||t.nid}`;const c=d[a];t.path=undefined;if(c){t=c.parse(t,r)}}else{t.error=t.error||"URN can not be parsed."}return t}function urnSerialize(t,r){const i=r.scheme||t.scheme||"urn";const o=t.nid.toLowerCase();const a=`${i}:${r.nid||o}`;const c=d[a];if(c){t=c.serialize(t,r)}const l=t;const u=t.nss;l.path=`${o||r.nid}:${u}`;r.skipEscape=true;return l}function urnuuidParse(t,i){const o=t;o.uuid=o.nss;o.nss=undefined;if(!i.tolerant&&(!o.uuid||!r.test(o.uuid))){o.error=o.error||"UUID is not valid."}return o}function urnuuidSerialize(t){const r=t;r.nss=(t.uuid||"").toLowerCase();return r}const o={scheme:"http",domainHost:true,parse:httpParse,serialize:httpSerialize};const a={scheme:"https",domainHost:o.domainHost,parse:httpParse,serialize:httpSerialize};const c={scheme:"ws",domainHost:true,parse:wsParse,serialize:wsSerialize};const l={scheme:"wss",domainHost:c.domainHost,parse:c.parse,serialize:c.serialize};const u={scheme:"urn",parse:urnParse,serialize:urnSerialize,skipNormalize:true};const h={scheme:"urn:uuid",parse:urnuuidParse,serialize:urnuuidSerialize,skipNormalize:true};const d={http:o,https:a,ws:c,wss:l,urn:u,"urn:uuid":h};t.exports=d},6046:t=>{"use strict";const r={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,A:10,b:11,B:11,c:12,C:12,d:13,D:13,e:14,E:14,f:15,F:15};t.exports={HEX:r}},3918:(t,r,i)=>{"use strict";const{HEX:o}=i(6046);const a=/^(?:(?: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 normalizeIPv4(t){if(findToken(t,".")<3){return{host:t,isIPV4:false}}const r=t.match(a)||[];const[i]=r;if(i){return{host:stripLeadingZeros(i,"."),isIPV4:true}}else{return{host:t,isIPV4:false}}}function stringArrayToHexStripped(t,r=false){let i="";let a=true;for(const r of t){if(o[r]===undefined)return undefined;if(r!=="0"&&a===true)a=false;if(!a)i+=r}if(r&&i.length===0)i="0";return i}function getIPV6(t){let r=0;const i={error:false,address:"",zone:""};const o=[];const a=[];let c=false;let l=false;let u=false;function consume(){if(a.length){if(c===false){const t=stringArrayToHexStripped(a);if(t!==undefined){o.push(t)}else{i.error=true;return false}}a.length=0}return true}for(let h=0;h<t.length;h++){const d=t[h];if(d==="["||d==="]"){continue}if(d===":"){if(l===true){u=true}if(!consume()){break}r++;o.push(":");if(r>7){i.error=true;break}if(h-1>=0&&t[h-1]===":"){l=true}continue}else if(d==="%"){if(!consume()){break}c=true}else{a.push(d);continue}}if(a.length){if(c){i.zone=a.join("")}else if(u){o.push(a.join(""))}else{o.push(stringArrayToHexStripped(a))}}i.address=o.join("");return i}function normalizeIPv6(t){if(findToken(t,":")<2){return{host:t,isIPV6:false}}const r=getIPV6(t);if(!r.error){let t=r.address;let i=r.address;if(r.zone){t+="%"+r.zone;i+="%25"+r.zone}return{host:t,escapedHost:i,isIPV6:true}}else{return{host:t,isIPV6:false}}}function stripLeadingZeros(t,r){let i="";let o=true;const a=t.length;for(let c=0;c<a;c++){const l=t[c];if(l==="0"&&o){if(c+1<=a&&t[c+1]===r||c+1===a){i+=l;o=false}}else{if(l===r){o=true}else{o=false}i+=l}}return i}function findToken(t,r){let i=0;for(let o=0;o<t.length;o++){if(t[o]===r)i++}return i}const c=/^\.\.?\//u;const l=/^\/\.(?:\/|$)/u;const u=/^\/\.\.(?:\/|$)/u;const h=/^\/?(?:.|\n)*?(?=\/|$)/u;function removeDotSegments(t){const r=[];while(t.length){if(t.match(c)){t=t.replace(c,"")}else if(t.match(l)){t=t.replace(l,"/")}else if(t.match(u)){t=t.replace(u,"/");r.pop()}else if(t==="."||t===".."){t=""}else{const i=t.match(h);if(i){const o=i[0];t=t.slice(o.length);r.push(o)}else{throw new Error("Unexpected dot segment condition")}}}return r.join("")}function normalizeComponentEncoding(t,r){const i=r!==true?escape:unescape;if(t.scheme!==undefined){t.scheme=i(t.scheme)}if(t.userinfo!==undefined){t.userinfo=i(t.userinfo)}if(t.host!==undefined){t.host=i(t.host)}if(t.path!==undefined){t.path=i(t.path)}if(t.query!==undefined){t.query=i(t.query)}if(t.fragment!==undefined){t.fragment=i(t.fragment)}return t}function recomposeAuthority(t){const r=[];if(t.userinfo!==undefined){r.push(t.userinfo);r.push("@")}if(t.host!==undefined){let i=unescape(t.host);const o=normalizeIPv4(i);if(o.isIPV4){i=o.host}else{const r=normalizeIPv6(o.host);if(r.isIPV6===true){i=`[${r.escapedHost}]`}else{i=t.host}}r.push(i)}if(typeof t.port==="number"||typeof t.port==="string"){r.push(":");r.push(String(t.port))}return r.length?r.join(""):undefined}t.exports={recomposeAuthority:recomposeAuthority,normalizeComponentEncoding:normalizeComponentEncoding,removeDotSegments:removeDotSegments,normalizeIPv4:normalizeIPv4,normalizeIPv6:normalizeIPv6,stringArrayToHexStripped:stringArrayToHexStripped}},3837:t=>{"use strict";t.exports=JSON.parse('{"$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":false}')},7216:t=>{"use strict";t.exports=JSON.parse('{"$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":true},"$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"}}}}')},8226:t=>{"use strict";t.exports=JSON.parse('{"$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":true},"$dynamicAnchor":"meta","title":"Content vocabulary meta-schema","type":["object","boolean"],"properties":{"contentEncoding":{"type":"string"},"contentMediaType":{"type":"string"},"contentSchema":{"$dynamicRef":"#meta"}}}')},518:t=>{"use strict";t.exports=JSON.parse('{"$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":true},"$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"}}}')},4588:t=>{"use strict";t.exports=JSON.parse('{"$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":true},"$dynamicAnchor":"meta","title":"Format vocabulary meta-schema for annotation results","type":["object","boolean"],"properties":{"format":{"type":"string"}}}')},5707:t=>{"use strict";t.exports=JSON.parse('{"$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":true},"$dynamicAnchor":"meta","title":"Meta-data vocabulary meta-schema","type":["object","boolean"],"properties":{"title":{"type":"string"},"description":{"type":"string"},"default":true,"deprecated":{"type":"boolean","default":false},"readOnly":{"type":"boolean","default":false},"writeOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true}}}')},9547:t=>{"use strict";t.exports=JSON.parse('{"$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":true},"$dynamicAnchor":"meta","title":"Unevaluated applicator vocabulary meta-schema","type":["object","boolean"],"properties":{"unevaluatedItems":{"$dynamicRef":"#meta"},"unevaluatedProperties":{"$dynamicRef":"#meta"}}}')},7082:t=>{"use strict";t.exports=JSON.parse('{"$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":true},"$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":true}]},"const":true,"enum":{"type":"array","items":true},"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":false},"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":true,"default":[]}}}')},1678:t=>{"use strict";t.exports=JSON.parse('{"$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":true,"https://json-schema.org/draft/2020-12/vocab/applicator":true,"https://json-schema.org/draft/2020-12/vocab/unevaluated":true,"https://json-schema.org/draft/2020-12/vocab/validation":true,"https://json-schema.org/draft/2020-12/vocab/meta-data":true,"https://json-schema.org/draft/2020-12/vocab/format-annotation":true,"https://json-schema.org/draft/2020-12/vocab/content":true},"$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":true,"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":true,"default":{}},"$recursiveAnchor":{"$comment":"\\"$recursiveAnchor\\" has been replaced by \\"$dynamicAnchor\\".","$ref":"meta/core#/$defs/anchorString","deprecated":true},"$recursiveRef":{"$comment":"\\"$recursiveRef\\" has been replaced by \\"$dynamicRef\\".","$ref":"meta/core#/$defs/uriReferenceString","deprecated":true}}}')},2079:t=>{"use strict";t.exports=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}')},2040:t=>{"use strict";t.exports=JSON.parse('[{"name":"Agola CI","constant":"AGOLA","env":"AGOLA_GIT_REF","pr":"AGOLA_PULL_REQUEST_ID"},{"name":"Appcircle","constant":"APPCIRCLE","env":"AC_APPCIRCLE"},{"name":"AppVeyor","constant":"APPVEYOR","env":"APPVEYOR","pr":"APPVEYOR_PULL_REQUEST_NUMBER"},{"name":"AWS CodeBuild","constant":"CODEBUILD","env":"CODEBUILD_BUILD_ARN"},{"name":"Azure Pipelines","constant":"AZURE_PIPELINES","env":"TF_BUILD","pr":{"BUILD_REASON":"PullRequest"}},{"name":"Bamboo","constant":"BAMBOO","env":"bamboo_planKey"},{"name":"Bitbucket Pipelines","constant":"BITBUCKET","env":"BITBUCKET_COMMIT","pr":"BITBUCKET_PR_ID"},{"name":"Bitrise","constant":"BITRISE","env":"BITRISE_IO","pr":"BITRISE_PULL_REQUEST"},{"name":"Buddy","constant":"BUDDY","env":"BUDDY_WORKSPACE_ID","pr":"BUDDY_EXECUTION_PULL_REQUEST_ID"},{"name":"Buildkite","constant":"BUILDKITE","env":"BUILDKITE","pr":{"env":"BUILDKITE_PULL_REQUEST","ne":"false"}},{"name":"CircleCI","constant":"CIRCLE","env":"CIRCLECI","pr":"CIRCLE_PULL_REQUEST"},{"name":"Cirrus CI","constant":"CIRRUS","env":"CIRRUS_CI","pr":"CIRRUS_PR"},{"name":"Codefresh","constant":"CODEFRESH","env":"CF_BUILD_ID","pr":{"any":["CF_PULL_REQUEST_NUMBER","CF_PULL_REQUEST_ID"]}},{"name":"Codemagic","constant":"CODEMAGIC","env":"CM_BUILD_ID","pr":"CM_PULL_REQUEST"},{"name":"Codeship","constant":"CODESHIP","env":{"CI_NAME":"codeship"}},{"name":"Drone","constant":"DRONE","env":"DRONE","pr":{"DRONE_BUILD_EVENT":"pull_request"}},{"name":"dsari","constant":"DSARI","env":"DSARI"},{"name":"Earthly","constant":"EARTHLY","env":"EARTHLY_CI"},{"name":"Expo Application Services","constant":"EAS","env":"EAS_BUILD"},{"name":"Gerrit","constant":"GERRIT","env":"GERRIT_PROJECT"},{"name":"Gitea Actions","constant":"GITEA_ACTIONS","env":"GITEA_ACTIONS"},{"name":"GitHub Actions","constant":"GITHUB_ACTIONS","env":"GITHUB_ACTIONS","pr":{"GITHUB_EVENT_NAME":"pull_request"}},{"name":"GitLab CI","constant":"GITLAB","env":"GITLAB_CI","pr":"CI_MERGE_REQUEST_ID"},{"name":"GoCD","constant":"GOCD","env":"GO_PIPELINE_LABEL"},{"name":"Google Cloud Build","constant":"GOOGLE_CLOUD_BUILD","env":"BUILDER_OUTPUT"},{"name":"Harness CI","constant":"HARNESS","env":"HARNESS_BUILD_ID"},{"name":"Heroku","constant":"HEROKU","env":{"env":"NODE","includes":"/app/.heroku/node/bin/node"}},{"name":"Hudson","constant":"HUDSON","env":"HUDSON_URL"},{"name":"Jenkins","constant":"JENKINS","env":["JENKINS_URL","BUILD_ID"],"pr":{"any":["ghprbPullId","CHANGE_ID"]}},{"name":"LayerCI","constant":"LAYERCI","env":"LAYERCI","pr":"LAYERCI_PULL_REQUEST"},{"name":"Magnum CI","constant":"MAGNUM","env":"MAGNUM"},{"name":"Netlify CI","constant":"NETLIFY","env":"NETLIFY","pr":{"env":"PULL_REQUEST","ne":"false"}},{"name":"Nevercode","constant":"NEVERCODE","env":"NEVERCODE","pr":{"env":"NEVERCODE_PULL_REQUEST","ne":"false"}},{"name":"Prow","constant":"PROW","env":"PROW_JOB_ID"},{"name":"ReleaseHub","constant":"RELEASEHUB","env":"RELEASE_BUILD_ID"},{"name":"Render","constant":"RENDER","env":"RENDER","pr":{"IS_PULL_REQUEST":"true"}},{"name":"Sail CI","constant":"SAIL","env":"SAILCI","pr":"SAIL_PULL_REQUEST_NUMBER"},{"name":"Screwdriver","constant":"SCREWDRIVER","env":"SCREWDRIVER","pr":{"env":"SD_PULL_REQUEST","ne":"false"}},{"name":"Semaphore","constant":"SEMAPHORE","env":"SEMAPHORE","pr":"PULL_REQUEST_NUMBER"},{"name":"Sourcehut","constant":"SOURCEHUT","env":{"CI_NAME":"sourcehut"}},{"name":"Strider CD","constant":"STRIDER","env":"STRIDER"},{"name":"TaskCluster","constant":"TASKCLUSTER","env":["TASK_ID","RUN_ID"]},{"name":"TeamCity","constant":"TEAMCITY","env":"TEAMCITY_VERSION"},{"name":"Travis CI","constant":"TRAVIS","env":"TRAVIS","pr":{"env":"TRAVIS_PULL_REQUEST","ne":"false"}},{"name":"Vela","constant":"VELA","env":"VELA","pr":{"VELA_PULL_REQUEST":"1"}},{"name":"Vercel","constant":"VERCEL","env":{"any":["NOW_BUILDER","VERCEL"]},"pr":"VERCEL_GIT_PULL_REQUEST_ID"},{"name":"Visual Studio App Center","constant":"APPCENTER","env":"APPCENTER_BUILD_ID"},{"name":"Woodpecker","constant":"WOODPECKER","env":{"CI":"woodpecker"},"pr":{"CI_BUILD_EVENT":"pull_request"}},{"name":"Xcode Cloud","constant":"XCODE_CLOUD","env":"CI_XCODE_PROJECT","pr":"CI_PULL_REQUEST_NUMBER"},{"name":"Xcode Server","constant":"XCODE_SERVER","env":"XCS"}]')}};var r={};function __nccwpck_require__(i){var o=r[i];if(o!==undefined){return o.exports}var a=r[i]={exports:{}};var c=true;try{t[i](a,a.exports,__nccwpck_require__);c=false}finally{if(c)delete r[i]}return a.exports}(()=>{__nccwpck_require__.n=t=>{var r=t&&t.__esModule?()=>t["default"]:()=>t;__nccwpck_require__.d(r,{a:r});return r}})();(()=>{__nccwpck_require__.d=(t,r)=>{for(var i in r){if(__nccwpck_require__.o(r,i)&&!__nccwpck_require__.o(t,i)){Object.defineProperty(t,i,{enumerable:true,get:r[i]})}}}})();(()=>{__nccwpck_require__.o=(t,r)=>Object.prototype.hasOwnProperty.call(t,r)})();if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var i={};(()=>{"use strict";var t=__nccwpck_require__(3024);var r=__nccwpck_require__(6760);var i=__nccwpck_require__.n(r);var o=__nccwpck_require__(7362);var a=__nccwpck_require__.n(o);var c=__nccwpck_require__(7944);const{DM:l,gu:u,er:h,Ww:d,b7:p,Di:m,a2:g,uB:y,ef:v,c$:b,_V:w}=c;const E=require("node:util");var S=__nccwpck_require__(1708);const $=require("node:crypto");const R=require("node:assert");const isObject=t=>{const r=typeof t;return t!==null&&(r==="object"||r==="function")};const isEmptyObject=t=>isObject(t)&&Object.keys(t).length===0;const P=new Set(["__proto__","prototype","constructor"]);const O=new Set("0123456789");function getPathSegments(t){const r=[];let i="";let o="start";let a=false;for(const c of t){switch(c){case"\\":{if(o==="index"){throw new Error("Invalid character in an index")}if(o==="indexEnd"){throw new Error("Invalid character after an index")}if(a){i+=c}o="property";a=!a;break}case".":{if(o==="index"){throw new Error("Invalid character in an index")}if(o==="indexEnd"){o="property";break}if(a){a=false;i+=c;break}if(P.has(i)){return[]}r.push(i);i="";o="property";break}case"[":{if(o==="index"){throw new Error("Invalid character in an index")}if(o==="indexEnd"){o="index";break}if(a){a=false;i+=c;break}if(o==="property"){if(P.has(i)){return[]}r.push(i);i=""}o="index";break}case"]":{if(o==="index"){r.push(Number.parseInt(i,10));i="";o="indexEnd";break}if(o==="indexEnd"){throw new Error("Invalid character after an index")}}default:{if(o==="index"&&!O.has(c)){throw new Error("Invalid character in an index")}if(o==="indexEnd"){throw new Error("Invalid character after an index")}if(o==="start"){o="property"}if(a){a=false;i+="\\"}i+=c}}}if(a){i+="\\"}switch(o){case"property":{if(P.has(i)){return[]}r.push(i);break}case"index":{throw new Error("Index was not closed")}case"start":{r.push("");break}}return r}function isStringIndex(t,r){if(typeof r!=="number"&&Array.isArray(t)){const i=Number.parseInt(r,10);return Number.isInteger(i)&&t[i]===t[r]}return false}function assertNotStringIndex(t,r){if(isStringIndex(t,r)){throw new Error("Cannot use string index")}}function getProperty(t,r,i){if(!isObject(t)||typeof r!=="string"){return i===undefined?t:i}const o=getPathSegments(r);if(o.length===0){return i}for(let r=0;r<o.length;r++){const a=o[r];if(isStringIndex(t,a)){t=r===o.length-1?undefined:null}else{t=t[a]}if(t===undefined||t===null){if(r!==o.length-1){return i}break}}return t===undefined?i:t}function setProperty(t,r,i){if(!isObject(t)||typeof r!=="string"){return t}const o=t;const a=getPathSegments(r);for(let r=0;r<a.length;r++){const o=a[r];assertNotStringIndex(t,o);if(r===a.length-1){t[o]=i}else if(!isObject(t[o])){t[o]=typeof a[r+1]==="number"?[]:{}}t=t[o]}return o}function deleteProperty(t,r){if(!isObject(t)||typeof r!=="string"){return false}const i=getPathSegments(r);for(let r=0;r<i.length;r++){const o=i[r];assertNotStringIndex(t,o);if(r===i.length-1){delete t[o];return true}t=t[o];if(!isObject(t)){return false}}}function hasProperty(t,r){if(!isObject(t)||typeof r!=="string"){return false}const i=getPathSegments(r);if(i.length===0){return false}for(const r of i){if(!isObject(t)||!(r in t)||isStringIndex(t,r)){return false}t=t[r]}return true}function escapePath(t){if(typeof t!=="string"){throw new TypeError("Expected a string")}return t.replaceAll(/[\\.[]/g,"\\$&")}function entries(t){const r=Object.entries(t);if(Array.isArray(t)){return r.map((([t,r])=>[Number(t),r]))}return r}function stringifyPath(t){let r="";for(let[i,o]of entries(t)){if(typeof o==="number"){r+=`[${o}]`}else{o=escapePath(o);r+=i===0?o:`.${o}`}}return r}function*deepKeysIterator(t,r=[]){if(!isObject(t)||isEmptyObject(t)){if(r.length>0){yield stringifyPath(r)}return}for(const[i,o]of entries(t)){yield*deepKeysIterator(o,[...r,i])}}function deepKeys(t){return[...deepKeysIterator(t)]}const A=require("node:os");var x=__nccwpck_require__.n(A);const T=A.homedir();const k=A.tmpdir();const{env:C}=S;const macos=t=>{const i=r.join(T,"Library");return{data:r.join(i,"Application Support",t),config:r.join(i,"Preferences",t),cache:r.join(i,"Caches",t),log:r.join(i,"Logs",t),temp:r.join(k,t)}};const windows=t=>{const i=C.APPDATA||r.join(T,"AppData","Roaming");const o=C.LOCALAPPDATA||r.join(T,"AppData","Local");return{data:r.join(o,t,"Data"),config:r.join(i,t,"Config"),cache:r.join(o,t,"Cache"),log:r.join(o,t,"Log"),temp:r.join(k,t)}};const linux=t=>{const i=r.basename(T);return{data:r.join(C.XDG_DATA_HOME||r.join(T,".local","share"),t),config:r.join(C.XDG_CONFIG_HOME||r.join(T,".config"),t),cache:r.join(C.XDG_CACHE_HOME||r.join(T,".cache"),t),log:r.join(C.XDG_STATE_HOME||r.join(T,".local","state"),t),temp:r.join(k,i,t)}};function envPaths(t,{suffix:r="nodejs"}={}){if(typeof t!=="string"){throw new TypeError(`Expected a string, got ${typeof t}`)}if(r){t+=`-${r}`}if(S.platform==="darwin"){return macos(t)}if(S.platform==="win32"){return windows(t)}return linux(t)}const attemptifyAsync=(t,r)=>function attemptified(...i){return t.apply(undefined,i).catch(r)};const attemptifySync=(t,r)=>function attemptified(...i){try{return t.apply(undefined,i)}catch(t){return r(t)}};const I=S.getuid?!S.getuid():false;const N=1e4;const NOOP=()=>undefined;const D={isChangeErrorOk:t=>{if(!D.isNodeError(t))return false;const{code:r}=t;if(r==="ENOSYS")return true;if(!I&&(r==="EINVAL"||r==="EPERM"))return true;return false},isNodeError:t=>t instanceof Error,isRetriableError:t=>{if(!D.isNodeError(t))return false;const{code:r}=t;if(r==="EMFILE"||r==="ENFILE"||r==="EAGAIN"||r==="EBUSY"||r==="EACCESS"||r==="EACCES"||r==="EACCS"||r==="EPERM")return true;return false},onChangeError:t=>{if(!D.isNodeError(t))throw t;if(D.isChangeErrorOk(t))return;throw t}};const L=D;class RetryfyQueue{constructor(){this.interval=25;this.intervalId=undefined;this.limit=N;this.queueActive=new Set;this.queueWaiting=new Set;this.init=()=>{if(this.intervalId)return;this.intervalId=setInterval(this.tick,this.interval)};this.reset=()=>{if(!this.intervalId)return;clearInterval(this.intervalId);delete this.intervalId};this.add=t=>{this.queueWaiting.add(t);if(this.queueActive.size<this.limit/2){this.tick()}else{this.init()}};this.remove=t=>{this.queueWaiting.delete(t);this.queueActive.delete(t)};this.schedule=()=>new Promise((t=>{const cleanup=()=>this.remove(resolver);const resolver=()=>t(cleanup);this.add(resolver)}));this.tick=()=>{if(this.queueActive.size>=this.limit)return;if(!this.queueWaiting.size)return this.reset();for(const t of this.queueWaiting){if(this.queueActive.size>=this.limit)break;this.queueWaiting.delete(t);this.queueActive.add(t);t()}}}}const M=new RetryfyQueue;const retryifyAsync=(t,r)=>function retrified(i){return function attempt(...o){return M.schedule().then((a=>{const onResolve=t=>{a();return t};const onReject=t=>{a();if(Date.now()>=i)throw t;if(r(t)){const t=Math.round(100*Math.random());const r=new Promise((r=>setTimeout(r,t)));return r.then((()=>attempt.apply(undefined,o)))}throw t};return t.apply(undefined,o).then(onResolve,onReject)}))}};const retryifySync=(t,r)=>function retrified(i){return function attempt(...o){try{return t.apply(undefined,o)}catch(t){if(Date.now()>i)throw t;if(r(t))return attempt.apply(undefined,o);throw t}}};const j={attempt:{chmod:attemptifyAsync((0,E.promisify)(t.chmod),L.onChangeError),chown:attemptifyAsync((0,E.promisify)(t.chown),L.onChangeError),close:attemptifyAsync((0,E.promisify)(t.close),NOOP),fsync:attemptifyAsync((0,E.promisify)(t.fsync),NOOP),mkdir:attemptifyAsync((0,E.promisify)(t.mkdir),NOOP),realpath:attemptifyAsync((0,E.promisify)(t.realpath),NOOP),stat:attemptifyAsync((0,E.promisify)(t.stat),NOOP),unlink:attemptifyAsync((0,E.promisify)(t.unlink),NOOP),chmodSync:attemptifySync(t.chmodSync,L.onChangeError),chownSync:attemptifySync(t.chownSync,L.onChangeError),closeSync:attemptifySync(t.closeSync,NOOP),existsSync:attemptifySync(t.existsSync,NOOP),fsyncSync:attemptifySync(t.fsync,NOOP),mkdirSync:attemptifySync(t.mkdirSync,NOOP),realpathSync:attemptifySync(t.realpathSync,NOOP),statSync:attemptifySync(t.statSync,NOOP),unlinkSync:attemptifySync(t.unlinkSync,NOOP)},retry:{close:retryifyAsync((0,E.promisify)(t.close),L.isRetriableError),fsync:retryifyAsync((0,E.promisify)(t.fsync),L.isRetriableError),open:retryifyAsync((0,E.promisify)(t.open),L.isRetriableError),readFile:retryifyAsync((0,E.promisify)(t.readFile),L.isRetriableError),rename:retryifyAsync((0,E.promisify)(t.rename),L.isRetriableError),stat:retryifyAsync((0,E.promisify)(t.stat),L.isRetriableError),write:retryifyAsync((0,E.promisify)(t.write),L.isRetriableError),writeFile:retryifyAsync((0,E.promisify)(t.writeFile),L.isRetriableError),closeSync:retryifySync(t.closeSync,L.isRetriableError),fsyncSync:retryifySync(t.fsyncSync,L.isRetriableError),openSync:retryifySync(t.openSync,L.isRetriableError),readFileSync:retryifySync(t.readFileSync,L.isRetriableError),renameSync:retryifySync(t.renameSync,L.isRetriableError),statSync:retryifySync(t.statSync,L.isRetriableError),writeSync:retryifySync(t.writeSync,L.isRetriableError),writeFileSync:retryifySync(t.writeFileSync,L.isRetriableError)}};const U=j;const B="utf8";const H=438;const V=511;const z={};const G={};const q=A.userInfo().uid;const W=A.userInfo().gid;const K=7500;const Y=1e3;const Z=!!S.getuid;const X=S.getuid?!S.getuid():false;const J=128;const Q=1e4;const constants_NOOP=()=>{};const lang_isException=t=>t instanceof Error&&"code"in t;const lang_isFunction=t=>typeof t==="function";const lang_isString=t=>typeof t==="string";const lang_isUndefined=t=>t===undefined;const ee={};const te={next:t=>{const r=ee[t];if(!r)return;r.shift();const i=r[0];if(i){i((()=>te.next(t)))}else{delete ee[t]}},schedule:t=>new Promise((r=>{let i=ee[t];if(!i)i=ee[t]=[];i.push(r);if(i.length>1)return;r((()=>te.next(t)))}))};const re=null&&te;const se=S.platform==="linux";const ne=S.platform==="win32";const ie=["SIGABRT","SIGALRM","SIGHUP","SIGINT","SIGTERM"];if(!ne){ie.push("SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT")}if(se){ie.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT","SIGUNUSED")}const oe=ie;class Interceptor{constructor(){this.callbacks=new Set;this.exited=false;this.exit=t=>{if(this.exited)return;this.exited=true;for(const t of this.callbacks){t()}if(t){if(ne&&(t!=="SIGINT"&&t!=="SIGTERM"&&t!=="SIGKILL")){S.kill(S.pid,"SIGTERM")}else{S.kill(S.pid,t)}}};this.hook=()=>{S.once("exit",(()=>this.exit()));for(const t of oe){try{S.once(t,(()=>this.exit(t)))}catch{}}};this.register=t=>{this.callbacks.add(t);return()=>{this.callbacks.delete(t)}};this.hook()}}const ae=new Interceptor;const ce=ae.register;const le=ce;const ue={store:{},create:t=>{const r=`000000${Math.floor(Math.random()*16777215).toString(16)}`.slice(-6);const i=Date.now().toString().slice(-10);const o="tmp-";const a=`.${o}${i}${r}`;const c=`${t}${a}`;return c},get:(t,r,i=true)=>{const o=ue.truncate(r(t));if(o in ue.store)return ue.get(t,r,i);ue.store[o]=i;const disposer=()=>delete ue.store[o];return[o,disposer]},purge:t=>{if(!ue.store[t])return;delete ue.store[t];U.attempt.unlink(t)},purgeSync:t=>{if(!ue.store[t])return;delete ue.store[t];U.attempt.unlinkSync(t)},purgeSyncAll:()=>{for(const t in ue.store){ue.purgeSync(t)}},truncate:t=>{const i=r.basename(t);if(i.length<=J)return t;const o=/^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(i);if(!o)return t;const a=i.length-J;return`${t.slice(0,-i.length)}${o[1]}${o[2].slice(0,-a)}${o[3]}`}};le(ue.purgeSyncAll);const he=ue;function readFile(t,r=DEFAULT_READ_OPTIONS){if(isString(r))return readFile(t,{encoding:r});const i=Date.now()+((r.timeout??DEFAULT_TIMEOUT_ASYNC)||-1);return fs.retry.readFile(i)(t,r)}function readFileSync(t,r=DEFAULT_READ_OPTIONS){if(isString(r))return readFileSync(t,{encoding:r});const i=Date.now()+((r.timeout??DEFAULT_TIMEOUT_SYNC)||-1);return fs.retry.readFileSync(i)(t,r)}function writeFile(t,r,i,o){if(isFunction(i))return writeFile(t,r,DEFAULT_WRITE_OPTIONS,i);const a=writeFileAsync(t,r,i);if(o)a.then(o,o);return a}async function writeFileAsync(t,r,i=DEFAULT_WRITE_OPTIONS){if(isString(i))return writeFileAsync(t,r,{encoding:i});const o=Date.now()+((i.timeout??DEFAULT_TIMEOUT_ASYNC)||-1);let a=null;let c=null;let l=null;let u=null;let h=null;try{if(i.schedule)a=await i.schedule(t);c=await Scheduler.schedule(t);const d=await fs.attempt.realpath(t);const p=!!d;t=d||t;[u,l]=Temp.get(t,i.tmpCreate||Temp.create,!(i.tmpPurge===false));const m=IS_POSIX&&isUndefined(i.chown);const g=isUndefined(i.mode);if(p&&(m||g)){const r=await fs.attempt.stat(t);if(r){i={...i};if(m){i.chown={uid:r.uid,gid:r.gid}}if(g){i.mode=r.mode}}}if(!p){const r=path.dirname(t);await fs.attempt.mkdir(r,{mode:DEFAULT_FOLDER_MODE,recursive:true})}h=await fs.retry.open(o)(u,"w",i.mode||DEFAULT_FILE_MODE);if(i.tmpCreated){i.tmpCreated(u)}if(isString(r)){await fs.retry.write(o)(h,r,0,i.encoding||DEFAULT_ENCODING)}else if(!isUndefined(r)){await fs.retry.write(o)(h,r,0,r.length,0)}if(i.fsync!==false){if(i.fsyncWait!==false){await fs.retry.fsync(o)(h)}else{fs.attempt.fsync(h)}}await fs.retry.close(o)(h);h=null;if(i.chown&&(i.chown.uid!==DEFAULT_USER_UID||i.chown.gid!==DEFAULT_USER_GID)){await fs.attempt.chown(u,i.chown.uid,i.chown.gid)}if(i.mode&&i.mode!==DEFAULT_FILE_MODE){await fs.attempt.chmod(u,i.mode)}try{await fs.retry.rename(o)(u,t)}catch(r){if(!isException(r))throw r;if(r.code!=="ENAMETOOLONG")throw r;await fs.retry.rename(o)(u,Temp.truncate(t))}l();u=null}finally{if(h)await fs.attempt.close(h);if(u)Temp.purge(u);if(a)a();if(c)c()}}function writeFileSync(t,i,o=G){if(lang_isString(o))return writeFileSync(t,i,{encoding:o});const a=Date.now()+((o.timeout??Y)||-1);let c=null;let l=null;let u=null;try{const h=U.attempt.realpathSync(t);const d=!!h;t=h||t;[l,c]=he.get(t,o.tmpCreate||he.create,!(o.tmpPurge===false));const p=Z&&lang_isUndefined(o.chown);const m=lang_isUndefined(o.mode);if(d&&(p||m)){const r=U.attempt.statSync(t);if(r){o={...o};if(p){o.chown={uid:r.uid,gid:r.gid}}if(m){o.mode=r.mode}}}if(!d){const i=r.dirname(t);U.attempt.mkdirSync(i,{mode:V,recursive:true})}u=U.retry.openSync(a)(l,"w",o.mode||H);if(o.tmpCreated){o.tmpCreated(l)}if(lang_isString(i)){U.retry.writeSync(a)(u,i,0,o.encoding||B)}else if(!lang_isUndefined(i)){U.retry.writeSync(a)(u,i,0,i.length,0)}if(o.fsync!==false){if(o.fsyncWait!==false){U.retry.fsyncSync(a)(u)}else{U.attempt.fsync(u)}}U.retry.closeSync(a)(u);u=null;if(o.chown&&(o.chown.uid!==q||o.chown.gid!==W)){U.attempt.chownSync(l,o.chown.uid,o.chown.gid)}if(o.mode&&o.mode!==H){U.attempt.chmodSync(l,o.mode)}try{U.retry.renameSync(a)(l,t)}catch(r){if(!lang_isException(r))throw r;if(r.code!=="ENAMETOOLONG")throw r;U.retry.renameSync(a)(l,he.truncate(t))}c();l=null}finally{if(u)U.attempt.closeSync(u);if(l)he.purge(l)}}var de=__nccwpck_require__(2911);var fe=__nccwpck_require__(9084);const copyProperty=(t,r,i,o)=>{if(i==="length"||i==="prototype"){return}if(i==="arguments"||i==="caller"){return}const a=Object.getOwnPropertyDescriptor(t,i);const c=Object.getOwnPropertyDescriptor(r,i);if(!canCopyProperty(a,c)&&o){return}Object.defineProperty(t,i,c)};const canCopyProperty=function(t,r){return t===undefined||t.configurable||t.writable===r.writable&&t.enumerable===r.enumerable&&t.configurable===r.configurable&&(t.writable||t.value===r.value)};const changePrototype=(t,r)=>{const i=Object.getPrototypeOf(r);if(i===Object.getPrototypeOf(t)){return}Object.setPrototypeOf(t,i)};const wrappedToString=(t,r)=>`/* Wrapped ${t}*/\n${r}`;const pe=Object.getOwnPropertyDescriptor(Function.prototype,"toString");const me=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name");const changeToString=(t,r,i)=>{const o=i===""?"":`with ${i.trim()}() `;const a=wrappedToString.bind(null,o,r.toString());Object.defineProperty(a,"name",me);const{writable:c,enumerable:l,configurable:u}=pe;Object.defineProperty(t,"toString",{value:a,writable:c,enumerable:l,configurable:u})};function mimicFunction(t,r,{ignoreNonConfigurable:i=false}={}){const{name:o}=t;for(const o of Reflect.ownKeys(r)){copyProperty(t,r,o,i)}changePrototype(t,r);changeToString(t,r,o);return t}const debounceFunction=(t,r={})=>{if(typeof t!=="function"){throw new TypeError(`Expected the first argument to be a function, got \`${typeof t}\``)}const{wait:i=0,maxWait:o=Number.POSITIVE_INFINITY,before:a=false,after:c=true}=r;if(i<0||o<0){throw new RangeError("`wait` and `maxWait` must not be negative.")}if(!a&&!c){throw new Error("Both `before` and `after` are false, function wouldn't be called.")}let l;let u;let h;const debouncedFunction=function(...r){const d=this;const later=()=>{l=undefined;if(u){clearTimeout(u);u=undefined}if(c){h=t.apply(d,r)}};const maxLater=()=>{u=undefined;if(l){clearTimeout(l);l=undefined}if(c){h=t.apply(d,r)}};const p=a&&!l;clearTimeout(l);l=setTimeout(later,i);if(o>0&&o!==Number.POSITIVE_INFINITY&&!u){u=setTimeout(maxLater,o)}if(p){h=t.apply(d,r)}return h};mimicFunction(debouncedFunction,t);debouncedFunction.cancel=()=>{if(l){clearTimeout(l);l=undefined}if(u){clearTimeout(u);u=undefined}};return debouncedFunction};const ge=debounceFunction;var ye=__nccwpck_require__(84);const ve=Object.prototype.toString;const _e="[object Uint8Array]";const be="[object ArrayBuffer]";function isType(t,r,i){if(!t){return false}if(t.constructor===r){return true}return ve.call(t)===i}function isUint8Array(t){return isType(t,Uint8Array,_e)}function isArrayBuffer(t){return isType(t,ArrayBuffer,be)}function isUint8ArrayOrArrayBuffer(t){return isUint8Array(t)||isArrayBuffer(t)}function assertUint8Array(t){if(!isUint8Array(t)){throw new TypeError(`Expected \`Uint8Array\`, got \`${typeof t}\``)}}function assertUint8ArrayOrArrayBuffer(t){if(!isUint8ArrayOrArrayBuffer(t)){throw new TypeError(`Expected \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof t}\``)}}function toUint8Array(t){if(t instanceof ArrayBuffer){return new Uint8Array(t)}if(ArrayBuffer.isView(t)){return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}throw new TypeError(`Unsupported value, got \`${typeof t}\`.`)}function concatUint8Arrays(t,r){if(t.length===0){return new Uint8Array(0)}r??=t.reduce(((t,r)=>t+r.length),0);const i=new Uint8Array(r);let o=0;for(const r of t){assertUint8Array(r);i.set(r,o);o+=r.length}return i}function areUint8ArraysEqual(t,r){assertUint8Array(t);assertUint8Array(r);if(t===r){return true}if(t.length!==r.length){return false}for(let i=0;i<t.length;i++){if(t[i]!==r[i]){return false}}return true}function compareUint8Arrays(t,r){assertUint8Array(t);assertUint8Array(r);const i=Math.min(t.length,r.length);for(let o=0;o<i;o++){const i=t[o]-r[o];if(i!==0){return Math.sign(i)}}return Math.sign(t.length-r.length)}const we={utf8:new globalThis.TextDecoder("utf8")};function uint8ArrayToString(t,r="utf8"){assertUint8ArrayOrArrayBuffer(t);we[r]??=new globalThis.TextDecoder(r);return we[r].decode(t)}function assertString(t){if(typeof t!=="string"){throw new TypeError(`Expected \`string\`, got \`${typeof t}\``)}}const Ee=new globalThis.TextEncoder;function stringToUint8Array(t){assertString(t);return Ee.encode(t)}function base64ToBase64Url(t){return t.replaceAll("+","-").replaceAll("/","_").replace(/=+$/,"")}function base64UrlToBase64(t){return t.replaceAll("-","+").replaceAll("_","/")}const Se=65535;function uint8ArrayToBase64(t,{urlSafe:r=false}={}){assertUint8Array(t);let i;if(t.length<Se){i=globalThis.btoa(String.fromCodePoint.apply(this,t))}else{i="";for(const r of t){i+=String.fromCodePoint(r)}i=globalThis.btoa(i)}return r?base64ToBase64Url(i):i}function base64ToUint8Array(t){assertString(t);return Uint8Array.from(globalThis.atob(base64UrlToBase64(t)),(t=>t.codePointAt(0)))}function stringToBase64(t,{urlSafe:r=false}={}){assertString(t);return uint8ArrayToBase64(stringToUint8Array(t),{urlSafe:r})}function base64ToString(t){assertString(t);return uint8ArrayToString(base64ToUint8Array(t))}const $e=Array.from({length:256},((t,r)=>r.toString(16).padStart(2,"0")));function uint8ArrayToHex(t){assertUint8Array(t);let r="";for(let i=0;i<t.length;i++){r+=$e[t[i]]}return r}const Re={0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8,9:9,a:10,b:11,c:12,d:13,e:14,f:15,A:10,B:11,C:12,D:13,E:14,F:15};function hexToUint8Array(t){assertString(t);if(t.length%2!==0){throw new Error("Invalid Hex string length.")}const r=t.length/2;const i=new Uint8Array(r);for(let o=0;o<r;o++){const r=Re[t[o*2]];const a=Re[t[o*2+1]];if(r===undefined||a===undefined){throw new Error(`Invalid Hex character encountered at position ${o*2}`)}i[o]=r<<4|a}return i}function getUintBE(t){const{byteLength:r}=t;if(r===6){return t.getUint16(0)*2**32+t.getUint32(2)}if(r===5){return t.getUint8(0)*2**32+t.getUint32(1)}if(r===4){return t.getUint32(0)}if(r===3){return t.getUint8(0)*2**16+t.getUint16(1)}if(r===2){return t.getUint16(0)}if(r===1){return t.getUint8(0)}}function indexOf(t,r){const i=t.length;const o=r.length;if(o===0){return-1}if(o>i){return-1}const a=i-o;for(let i=0;i<=a;i++){let a=true;for(let c=0;c<o;c++){if(t[i+c]!==r[c]){a=false;break}}if(a){return i}}return-1}function includes(t,r){return indexOf(t,r)!==-1}const Pe=fe["default"];const Oe="aes-256-cbc";const createPlainObject=()=>Object.create(null);const isExist=t=>t!==undefined&&t!==null;const checkValueType=(t,r)=>{const i=new Set(["undefined","symbol","function"]);const o=typeof r;if(i.has(o)){throw new TypeError(`Setting a value of type \`${o}\` for key \`${t}\` is not allowed as it's not supported by JSON`)}};const Ae="__internal__";const xe=`${Ae}.migrations.version`;class Conf{path;events;#e;#t;#r;#s={};constructor(t={}){const i={configName:"config",fileExtension:"json",projectSuffix:"nodejs",clearInvalidConfig:false,accessPropertiesByDotNotation:true,configFileMode:438,...t};if(!i.cwd){if(!i.projectName){throw new Error("Please specify the `projectName` option.")}i.cwd=envPaths(i.projectName,{suffix:i.projectSuffix}).config}this.#r=i;if(i.schema){if(typeof i.schema!=="object"){throw new TypeError("The `schema` option must be an object.")}const t=new de.Ajv2020({allErrors:true,useDefaults:true});Pe(t);const r={type:"object",properties:i.schema};this.#e=t.compile(r);for(const[t,r]of Object.entries(i.schema)){if(r?.default){this.#s[t]=r.default}}}if(i.defaults){this.#s={...this.#s,...i.defaults}}if(i.serialize){this._serialize=i.serialize}if(i.deserialize){this._deserialize=i.deserialize}this.events=new EventTarget;this.#t=i.encryptionKey;const o=i.fileExtension?`.${i.fileExtension}`:"";this.path=r.resolve(i.cwd,`${i.configName??"config"}${o}`);const a=this.store;const c=Object.assign(createPlainObject(),i.defaults,a);if(i.migrations){if(!i.projectVersion){throw new Error("Please specify the `projectVersion` option.")}this._migrate(i.migrations,i.projectVersion,i.beforeEachMigration)}this._validate(c);try{R.deepEqual(a,c)}catch{this.store=c}if(i.watch){this._watch()}}get(t,r){if(this.#r.accessPropertiesByDotNotation){return this._get(t,r)}const{store:i}=this;return t in i?i[t]:r}set(t,r){if(typeof t!=="string"&&typeof t!=="object"){throw new TypeError(`Expected \`key\` to be of type \`string\` or \`object\`, got ${typeof t}`)}if(typeof t!=="object"&&r===undefined){throw new TypeError("Use `delete()` to clear values")}if(this._containsReservedKey(t)){throw new TypeError(`Please don't use the ${Ae} key, as it's used to manage this module internal operations.`)}const{store:i}=this;const set=(t,r)=>{checkValueType(t,r);if(this.#r.accessPropertiesByDotNotation){setProperty(i,t,r)}else{i[t]=r}};if(typeof t==="object"){const r=t;for(const[t,i]of Object.entries(r)){set(t,i)}}else{set(t,r)}this.store=i}has(t){if(this.#r.accessPropertiesByDotNotation){return hasProperty(this.store,t)}return t in this.store}reset(...t){for(const r of t){if(isExist(this.#s[r])){this.set(r,this.#s[r])}}}delete(t){const{store:r}=this;if(this.#r.accessPropertiesByDotNotation){deleteProperty(r,t)}else{delete r[t]}this.store=r}clear(){this.store=createPlainObject();for(const t of Object.keys(this.#s)){this.reset(t)}}onDidChange(t,r){if(typeof t!=="string"){throw new TypeError(`Expected \`key\` to be of type \`string\`, got ${typeof t}`)}if(typeof r!=="function"){throw new TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof r}`)}return this._handleChange((()=>this.get(t)),r)}onDidAnyChange(t){if(typeof t!=="function"){throw new TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof t}`)}return this._handleChange((()=>this.store),t)}get size(){return Object.keys(this.store).length}get store(){try{const r=t.readFileSync(this.path,this.#t?null:"utf8");const i=this._encryptData(r);const o=this._deserialize(i);this._validate(o);return Object.assign(createPlainObject(),o)}catch(t){if(t?.code==="ENOENT"){this._ensureDirectory();return createPlainObject()}if(this.#r.clearInvalidConfig&&t.name==="SyntaxError"){return createPlainObject()}throw t}}set store(t){this._ensureDirectory();this._validate(t);this._write(t);this.events.dispatchEvent(new Event("change"))}*[Symbol.iterator](){for(const[t,r]of Object.entries(this.store)){yield[t,r]}}_encryptData(t){if(!this.#t){return typeof t==="string"?t:uint8ArrayToString(t)}try{const r=t.slice(0,16);const i=$.pbkdf2Sync(this.#t,r.toString(),1e4,32,"sha512");const o=$.createDecipheriv(Oe,i,r);const a=t.slice(17);const c=typeof a==="string"?stringToUint8Array(a):a;return uint8ArrayToString(concatUint8Arrays([o.update(c),o.final()]))}catch{}return t.toString()}_handleChange(t,r){let i=t();const onChange=()=>{const o=i;const a=t();if((0,E.isDeepStrictEqual)(a,o)){return}i=a;r.call(this,a,o)};this.events.addEventListener("change",onChange);return()=>{this.events.removeEventListener("change",onChange)}}_deserialize=t=>JSON.parse(t);_serialize=t=>JSON.stringify(t,undefined,"\t");_validate(t){if(!this.#e){return}const r=this.#e(t);if(r||!this.#e.errors){return}const i=this.#e.errors.map((({instancePath:t,message:r=""})=>`\`${t.slice(1)}\` ${r}`));throw new Error("Config schema violation: "+i.join("; "))}_ensureDirectory(){t.mkdirSync(r.dirname(this.path),{recursive:true})}_write(r){let i=this._serialize(r);if(this.#t){const t=$.randomBytes(16);const r=$.pbkdf2Sync(this.#t,t.toString(),1e4,32,"sha512");const o=$.createCipheriv(Oe,r,t);i=concatUint8Arrays([t,stringToUint8Array(":"),o.update(stringToUint8Array(i)),o.final()])}if(S.env.SNAP){t.writeFileSync(this.path,i,{mode:this.#r.configFileMode})}else{try{writeFileSync(this.path,i,{mode:this.#r.configFileMode})}catch(r){if(r?.code==="EXDEV"){t.writeFileSync(this.path,i,{mode:this.#r.configFileMode});return}throw r}}}_watch(){this._ensureDirectory();if(!t.existsSync(this.path)){this._write(createPlainObject())}if(S.platform==="win32"){t.watch(this.path,{persistent:false},ge((()=>{this.events.dispatchEvent(new Event("change"))}),{wait:100}))}else{t.watchFile(this.path,{persistent:false},ge((()=>{this.events.dispatchEvent(new Event("change"))}),{wait:5e3}))}}_migrate(t,r,i){let o=this._get(xe,"0.0.0");const a=Object.keys(t).filter((t=>this._shouldPerformMigration(t,o,r)));let c={...this.store};for(const l of a){try{if(i){i(this,{fromVersion:o,toVersion:l,finalVersion:r,versions:a})}const u=t[l];u?.(this);this._set(xe,l);o=l;c={...this.store}}catch(t){this.store=c;throw new Error(`Something went wrong during the migration! Changes applied to the store until this failed migration will be restored. ${t}`)}}if(this._isVersionInRangeFormat(o)||!ye.eq(o,r)){this._set(xe,r)}}_containsReservedKey(t){if(typeof t==="object"){const r=Object.keys(t)[0];if(r===Ae){return true}}if(typeof t!=="string"){return false}if(this.#r.accessPropertiesByDotNotation){if(t.startsWith(`${Ae}.`)){return true}return false}return false}_isVersionInRangeFormat(t){return ye.clean(t)===null}_shouldPerformMigration(t,r,i){if(this._isVersionInRangeFormat(t)){if(r!=="0.0.0"&&ye.satisfies(r,t)){return false}return ye.satisfies(i,t)}if(ye.lte(t,r)){return false}if(ye.gt(t,i)){return false}return true}_get(t,r){return getProperty(this.store,t,r)}_set(t,r){const{store:i}=this;setProperty(i,t,r);this.store=i}}var Te=__nccwpck_require__(6596);var ke=__nccwpck_require__(2171);var Ce=__nccwpck_require__.n(ke);var Ie=__nccwpck_require__(5012);var Ne=__nccwpck_require__.n(Ie);var De=__nccwpck_require__(4575);var Le=__nccwpck_require__.n(De);const Me=require("node:stream");const je=require("node:stream/promises");var Fe=__nccwpck_require__(4434);var Ue=__nccwpck_require__(9896);var Be=__nccwpck_require__(8474);const He=require("node:string_decoder");const Ve=typeof process==="object"&&process?process:{stdout:null,stderr:null};const isStream=t=>!!t&&typeof t==="object"&&(t instanceof Minipass||t instanceof Me||isReadable(t)||isWritable(t));const isReadable=t=>!!t&&typeof t==="object"&&t instanceof Be.EventEmitter&&typeof t.pipe==="function"&&t.pipe!==Me.Writable.prototype.pipe;const isWritable=t=>!!t&&typeof t==="object"&&t instanceof Be.EventEmitter&&typeof t.write==="function"&&typeof t.end==="function";const ze=Symbol("EOF");const Ge=Symbol("maybeEmitEnd");const qe=Symbol("emittedEnd");const We=Symbol("emittingEnd");const Ke=Symbol("emittedError");const Ye=Symbol("closed");const Ze=Symbol("read");const Xe=Symbol("flush");const Je=Symbol("flushChunk");const Qe=Symbol("encoding");const et=Symbol("decoder");const tt=Symbol("flowing");const rt=Symbol("paused");const st=Symbol("resume");const nt=Symbol("buffer");const it=Symbol("pipes");const ot=Symbol("bufferLength");const at=Symbol("bufferPush");const ct=Symbol("bufferShift");const ut=Symbol("objectMode");const ht=Symbol("destroyed");const dt=Symbol("error");const ft=Symbol("emitData");const pt=Symbol("emitEnd");const mt=Symbol("emitEnd2");const yt=Symbol("async");const vt=Symbol("abort");const _t=Symbol("aborted");const bt=Symbol("signal");const wt=Symbol("dataListeners");const Et=Symbol("discarded");const defer=t=>Promise.resolve().then(t);const nodefer=t=>t();const isEndish=t=>t==="end"||t==="finish"||t==="prefinish";const isArrayBufferLike=t=>t instanceof ArrayBuffer||!!t&&typeof t==="object"&&t.constructor&&t.constructor.name==="ArrayBuffer"&&t.byteLength>=0;const isArrayBufferView=t=>!Buffer.isBuffer(t)&&ArrayBuffer.isView(t);class Pipe{src;dest;opts;ondrain;constructor(t,r,i){this.src=t;this.dest=r;this.opts=i;this.ondrain=()=>t[st]();this.dest.on("drain",this.ondrain)}unpipe(){this.dest.removeListener("drain",this.ondrain)}proxyErrors(t){}end(){this.unpipe();if(this.opts.end)this.dest.end()}}class PipeProxyErrors extends Pipe{unpipe(){this.src.removeListener("error",this.proxyErrors);super.unpipe()}constructor(t,r,i){super(t,r,i);this.proxyErrors=t=>r.emit("error",t);t.on("error",this.proxyErrors)}}const isObjectModeOptions=t=>!!t.objectMode;const isEncodingOptions=t=>!t.objectMode&&!!t.encoding&&t.encoding!=="buffer";class Minipass extends Be.EventEmitter{[tt]=false;[rt]=false;[it]=[];[nt]=[];[ut];[Qe];[yt];[et];[ze]=false;[qe]=false;[We]=false;[Ye]=false;[Ke]=null;[ot]=0;[ht]=false;[bt];[_t]=false;[wt]=0;[Et]=false;writable=true;readable=true;constructor(...t){const r=t[0]||{};super();if(r.objectMode&&typeof r.encoding==="string"){throw new TypeError("Encoding and objectMode may not be used together")}if(isObjectModeOptions(r)){this[ut]=true;this[Qe]=null}else if(isEncodingOptions(r)){this[Qe]=r.encoding;this[ut]=false}else{this[ut]=false;this[Qe]=null}this[yt]=!!r.async;this[et]=this[Qe]?new He.StringDecoder(this[Qe]):null;if(r&&r.debugExposeBuffer===true){Object.defineProperty(this,"buffer",{get:()=>this[nt]})}if(r&&r.debugExposePipes===true){Object.defineProperty(this,"pipes",{get:()=>this[it]})}const{signal:i}=r;if(i){this[bt]=i;if(i.aborted){this[vt]()}else{i.addEventListener("abort",(()=>this[vt]()))}}}get bufferLength(){return this[ot]}get encoding(){return this[Qe]}set encoding(t){throw new Error("Encoding must be set at instantiation time")}setEncoding(t){throw new Error("Encoding must be set at instantiation time")}get objectMode(){return this[ut]}set objectMode(t){throw new Error("objectMode must be set at instantiation time")}get["async"](){return this[yt]}set["async"](t){this[yt]=this[yt]||!!t}[vt](){this[_t]=true;this.emit("abort",this[bt]?.reason);this.destroy(this[bt]?.reason)}get aborted(){return this[_t]}set aborted(t){}write(t,r,i){if(this[_t])return false;if(this[ze])throw new Error("write after end");if(this[ht]){this.emit("error",Object.assign(new Error("Cannot call write after a stream was destroyed"),{code:"ERR_STREAM_DESTROYED"}));return true}if(typeof r==="function"){i=r;r="utf8"}if(!r)r="utf8";const o=this[yt]?defer:nodefer;if(!this[ut]&&!Buffer.isBuffer(t)){if(isArrayBufferView(t)){t=Buffer.from(t.buffer,t.byteOffset,t.byteLength)}else if(isArrayBufferLike(t)){t=Buffer.from(t)}else if(typeof t!=="string"){throw new Error("Non-contiguous data written to non-objectMode stream")}}if(this[ut]){if(this[tt]&&this[ot]!==0)this[Xe](true);if(this[tt])this.emit("data",t);else this[at](t);if(this[ot]!==0)this.emit("readable");if(i)o(i);return this[tt]}if(!t.length){if(this[ot]!==0)this.emit("readable");if(i)o(i);return this[tt]}if(typeof t==="string"&&!(r===this[Qe]&&!this[et]?.lastNeed)){t=Buffer.from(t,r)}if(Buffer.isBuffer(t)&&this[Qe]){t=this[et].write(t)}if(this[tt]&&this[ot]!==0)this[Xe](true);if(this[tt])this.emit("data",t);else this[at](t);if(this[ot]!==0)this.emit("readable");if(i)o(i);return this[tt]}read(t){if(this[ht])return null;this[Et]=false;if(this[ot]===0||t===0||t&&t>this[ot]){this[Ge]();return null}if(this[ut])t=null;if(this[nt].length>1&&!this[ut]){this[nt]=[this[Qe]?this[nt].join(""):Buffer.concat(this[nt],this[ot])]}const r=this[Ze](t||null,this[nt][0]);this[Ge]();return r}[Ze](t,r){if(this[ut])this[ct]();else{const i=r;if(t===i.length||t===null)this[ct]();else if(typeof i==="string"){this[nt][0]=i.slice(t);r=i.slice(0,t);this[ot]-=t}else{this[nt][0]=i.subarray(t);r=i.subarray(0,t);this[ot]-=t}}this.emit("data",r);if(!this[nt].length&&!this[ze])this.emit("drain");return r}end(t,r,i){if(typeof t==="function"){i=t;t=undefined}if(typeof r==="function"){i=r;r="utf8"}if(t!==undefined)this.write(t,r);if(i)this.once("end",i);this[ze]=true;this.writable=false;if(this[tt]||!this[rt])this[Ge]();return this}[st](){if(this[ht])return;if(!this[wt]&&!this[it].length){this[Et]=true}this[rt]=false;this[tt]=true;this.emit("resume");if(this[nt].length)this[Xe]();else if(this[ze])this[Ge]();else this.emit("drain")}resume(){return this[st]()}pause(){this[tt]=false;this[rt]=true;this[Et]=false}get destroyed(){return this[ht]}get flowing(){return this[tt]}get paused(){return this[rt]}[at](t){if(this[ut])this[ot]+=1;else this[ot]+=t.length;this[nt].push(t)}[ct](){if(this[ut])this[ot]-=1;else this[ot]-=this[nt][0].length;return this[nt].shift()}[Xe](t=false){do{}while(this[Je](this[ct]())&&this[nt].length);if(!t&&!this[nt].length&&!this[ze])this.emit("drain")}[Je](t){this.emit("data",t);return this[tt]}pipe(t,r){if(this[ht])return t;this[Et]=false;const i=this[qe];r=r||{};if(t===Ve.stdout||t===Ve.stderr)r.end=false;else r.end=r.end!==false;r.proxyErrors=!!r.proxyErrors;if(i){if(r.end)t.end()}else{this[it].push(!r.proxyErrors?new Pipe(this,t,r):new PipeProxyErrors(this,t,r));if(this[yt])defer((()=>this[st]()));else this[st]()}return t}unpipe(t){const r=this[it].find((r=>r.dest===t));if(r){if(this[it].length===1){if(this[tt]&&this[wt]===0){this[tt]=false}this[it]=[]}else this[it].splice(this[it].indexOf(r),1);r.unpipe()}}addListener(t,r){return this.on(t,r)}on(t,r){const i=super.on(t,r);if(t==="data"){this[Et]=false;this[wt]++;if(!this[it].length&&!this[tt]){this[st]()}}else if(t==="readable"&&this[ot]!==0){super.emit("readable")}else if(isEndish(t)&&this[qe]){super.emit(t);this.removeAllListeners(t)}else if(t==="error"&&this[Ke]){const t=r;if(this[yt])defer((()=>t.call(this,this[Ke])));else t.call(this,this[Ke])}return i}removeListener(t,r){return this.off(t,r)}off(t,r){const i=super.off(t,r);if(t==="data"){this[wt]=this.listeners("data").length;if(this[wt]===0&&!this[Et]&&!this[it].length){this[tt]=false}}return i}removeAllListeners(t){const r=super.removeAllListeners(t);if(t==="data"||t===undefined){this[wt]=0;if(!this[Et]&&!this[it].length){this[tt]=false}}return r}get emittedEnd(){return this[qe]}[Ge](){if(!this[We]&&!this[qe]&&!this[ht]&&this[nt].length===0&&this[ze]){this[We]=true;this.emit("end");this.emit("prefinish");this.emit("finish");if(this[Ye])this.emit("close");this[We]=false}}emit(t,...r){const i=r[0];if(t!=="error"&&t!=="close"&&t!==ht&&this[ht]){return false}else if(t==="data"){return!this[ut]&&!i?false:this[yt]?(defer((()=>this[ft](i))),true):this[ft](i)}else if(t==="end"){return this[pt]()}else if(t==="close"){this[Ye]=true;if(!this[qe]&&!this[ht])return false;const t=super.emit("close");this.removeAllListeners("close");return t}else if(t==="error"){this[Ke]=i;super.emit(dt,i);const t=!this[bt]||this.listeners("error").length?super.emit("error",i):false;this[Ge]();return t}else if(t==="resume"){const t=super.emit("resume");this[Ge]();return t}else if(t==="finish"||t==="prefinish"){const r=super.emit(t);this.removeAllListeners(t);return r}const o=super.emit(t,...r);this[Ge]();return o}[ft](t){for(const r of this[it]){if(r.dest.write(t)===false)this.pause()}const r=this[Et]?false:super.emit("data",t);this[Ge]();return r}[pt](){if(this[qe])return false;this[qe]=true;this.readable=false;return this[yt]?(defer((()=>this[mt]())),true):this[mt]()}[mt](){if(this[et]){const t=this[et].end();if(t){for(const r of this[it]){r.dest.write(t)}if(!this[Et])super.emit("data",t)}}for(const t of this[it]){t.end()}const t=super.emit("end");this.removeAllListeners("end");return t}async collect(){const t=Object.assign([],{dataLength:0});if(!this[ut])t.dataLength=0;const r=this.promise();this.on("data",(r=>{t.push(r);if(!this[ut])t.dataLength+=r.length}));await r;return t}async concat(){if(this[ut]){throw new Error("cannot concat in objectMode")}const t=await this.collect();return this[Qe]?t.join(""):Buffer.concat(t,t.dataLength)}async promise(){return new Promise(((t,r)=>{this.on(ht,(()=>r(new Error("stream destroyed"))));this.on("error",(t=>r(t)));this.on("end",(()=>t()))}))}[Symbol.asyncIterator](){this[Et]=false;let t=false;const stop=async()=>{this.pause();t=true;return{value:undefined,done:true}};const next=()=>{if(t)return stop();const r=this.read();if(r!==null)return Promise.resolve({done:false,value:r});if(this[ze])return stop();let i;let o;const onerr=t=>{this.off("data",ondata);this.off("end",onend);this.off(ht,ondestroy);stop();o(t)};const ondata=t=>{this.off("error",onerr);this.off("end",onend);this.off(ht,ondestroy);this.pause();i({value:t,done:!!this[ze]})};const onend=()=>{this.off("error",onerr);this.off("data",ondata);this.off(ht,ondestroy);stop();i({done:true,value:undefined})};const ondestroy=()=>onerr(new Error("stream destroyed"));return new Promise(((t,r)=>{o=r;i=t;this.once(ht,ondestroy);this.once("error",onerr);this.once("end",onend);this.once("data",ondata)}))};return{next:next,throw:stop,return:stop,[Symbol.asyncIterator](){return this}}}[Symbol.iterator](){this[Et]=false;let t=false;const stop=()=>{this.pause();this.off(dt,stop);this.off(ht,stop);this.off("end",stop);t=true;return{done:true,value:undefined}};const next=()=>{if(t)return stop();const r=this.read();return r===null?stop():{done:false,value:r}};this.once("end",stop);this.once(dt,stop);this.once(ht,stop);return{next:next,throw:stop,return:stop,[Symbol.iterator](){return this}}}destroy(t){if(this[ht]){if(t)this.emit("error",t);else this.emit(ht);return this}this[ht]=true;this[Et]=true;this[nt].length=0;this[ot]=0;const r=this;if(typeof r.close==="function"&&!this[Ye])r.close();if(t)this.emit("error",t);else this.emit(ht);return this}static get isStream(){return isStream}}const St=Ue.writev;const $t=Symbol("_autoClose");const Rt=Symbol("_close");const Pt=Symbol("_ended");const Ot=Symbol("_fd");const At=Symbol("_finished");const xt=Symbol("_flags");const Tt=Symbol("_flush");const kt=Symbol("_handleChunk");const Ct=Symbol("_makeBuf");const It=Symbol("_mode");const Nt=Symbol("_needDrain");const Dt=Symbol("_onerror");const Lt=Symbol("_onopen");const Mt=Symbol("_onread");const jt=Symbol("_onwrite");const Ft=Symbol("_open");const Ut=Symbol("_path");const Bt=Symbol("_pos");const Ht=Symbol("_queue");const Vt=Symbol("_read");const zt=Symbol("_readSize");const Gt=Symbol("_reading");const qt=Symbol("_remain");const Wt=Symbol("_size");const Kt=Symbol("_write");const Yt=Symbol("_writing");const Zt=Symbol("_defaultFlag");const Xt=Symbol("_errored");class ReadStream extends Minipass{[Xt]=false;[Ot];[Ut];[zt];[Gt]=false;[Wt];[qt];[$t];constructor(t,r){r=r||{};super(r);this.readable=true;this.writable=false;if(typeof t!=="string"){throw new TypeError("path must be a string")}this[Xt]=false;this[Ot]=typeof r.fd==="number"?r.fd:undefined;this[Ut]=t;this[zt]=r.readSize||16*1024*1024;this[Gt]=false;this[Wt]=typeof r.size==="number"?r.size:Infinity;this[qt]=this[Wt];this[$t]=typeof r.autoClose==="boolean"?r.autoClose:true;if(typeof this[Ot]==="number"){this[Vt]()}else{this[Ft]()}}get fd(){return this[Ot]}get path(){return this[Ut]}write(){throw new TypeError("this is a readable stream")}end(){throw new TypeError("this is a readable stream")}[Ft](){Ue.open(this[Ut],"r",((t,r)=>this[Lt](t,r)))}[Lt](t,r){if(t){this[Dt](t)}else{this[Ot]=r;this.emit("open",r);this[Vt]()}}[Ct](){return Buffer.allocUnsafe(Math.min(this[zt],this[qt]))}[Vt](){if(!this[Gt]){this[Gt]=true;const t=this[Ct]();if(t.length===0){return process.nextTick((()=>this[Mt](null,0,t)))}Ue.read(this[Ot],t,0,t.length,null,((t,r,i)=>this[Mt](t,r,i)))}}[Mt](t,r,i){this[Gt]=false;if(t){this[Dt](t)}else if(this[kt](r,i)){this[Vt]()}}[Rt](){if(this[$t]&&typeof this[Ot]==="number"){const t=this[Ot];this[Ot]=undefined;Ue.close(t,(t=>t?this.emit("error",t):this.emit("close")))}}[Dt](t){this[Gt]=true;this[Rt]();this.emit("error",t)}[kt](t,r){let i=false;this[qt]-=t;if(t>0){i=super.write(t<r.length?r.subarray(0,t):r)}if(t===0||this[qt]<=0){i=false;this[Rt]();super.end()}return i}emit(t,...r){switch(t){case"prefinish":case"finish":return false;case"drain":if(typeof this[Ot]==="number"){this[Vt]()}return false;case"error":if(this[Xt]){return false}this[Xt]=true;return super.emit(t,...r);default:return super.emit(t,...r)}}}class ReadStreamSync extends ReadStream{[Ft](){let t=true;try{this[Lt](null,Ue.openSync(this[Ut],"r"));t=false}finally{if(t){this[Rt]()}}}[Vt](){let t=true;try{if(!this[Gt]){this[Gt]=true;do{const t=this[Ct]();const r=t.length===0?0:Ue.readSync(this[Ot],t,0,t.length,null);if(!this[kt](r,t)){break}}while(true);this[Gt]=false}t=false}finally{if(t){this[Rt]()}}}[Rt](){if(this[$t]&&typeof this[Ot]==="number"){const t=this[Ot];this[Ot]=undefined;Ue.closeSync(t);this.emit("close")}}}class WriteStream extends Fe{readable=false;writable=true;[Xt]=false;[Yt]=false;[Pt]=false;[Ht]=[];[Nt]=false;[Ut];[It];[$t];[Ot];[Zt];[xt];[At]=false;[Bt];constructor(t,r){r=r||{};super(r);this[Ut]=t;this[Ot]=typeof r.fd==="number"?r.fd:undefined;this[It]=r.mode===undefined?438:r.mode;this[Bt]=typeof r.start==="number"?r.start:undefined;this[$t]=typeof r.autoClose==="boolean"?r.autoClose:true;const i=this[Bt]!==undefined?"r+":"w";this[Zt]=r.flags===undefined;this[xt]=r.flags===undefined?i:r.flags;if(this[Ot]===undefined){this[Ft]()}}emit(t,...r){if(t==="error"){if(this[Xt]){return false}this[Xt]=true}return super.emit(t,...r)}get fd(){return this[Ot]}get path(){return this[Ut]}[Dt](t){this[Rt]();this[Yt]=true;this.emit("error",t)}[Ft](){Ue.open(this[Ut],this[xt],this[It],((t,r)=>this[Lt](t,r)))}[Lt](t,r){if(this[Zt]&&this[xt]==="r+"&&t&&t.code==="ENOENT"){this[xt]="w";this[Ft]()}else if(t){this[Dt](t)}else{this[Ot]=r;this.emit("open",r);if(!this[Yt]){this[Tt]()}}}end(t,r){if(t){this.write(t,r)}this[Pt]=true;if(!this[Yt]&&!this[Ht].length&&typeof this[Ot]==="number"){this[jt](null,0)}return this}write(t,r){if(typeof t==="string"){t=Buffer.from(t,r)}if(this[Pt]){this.emit("error",new Error("write() after end()"));return false}if(this[Ot]===undefined||this[Yt]||this[Ht].length){this[Ht].push(t);this[Nt]=true;return false}this[Yt]=true;this[Kt](t);return true}[Kt](t){Ue.write(this[Ot],t,0,t.length,this[Bt],((t,r)=>this[jt](t,r)))}[jt](t,r){if(t){this[Dt](t)}else{if(this[Bt]!==undefined&&typeof r==="number"){this[Bt]+=r}if(this[Ht].length){this[Tt]()}else{this[Yt]=false;if(this[Pt]&&!this[At]){this[At]=true;this[Rt]();this.emit("finish")}else if(this[Nt]){this[Nt]=false;this.emit("drain")}}}}[Tt](){if(this[Ht].length===0){if(this[Pt]){this[jt](null,0)}}else if(this[Ht].length===1){this[Kt](this[Ht].pop())}else{const t=this[Ht];this[Ht]=[];St(this[Ot],t,this[Bt],((t,r)=>this[jt](t,r)))}}[Rt](){if(this[$t]&&typeof this[Ot]==="number"){const t=this[Ot];this[Ot]=undefined;Ue.close(t,(t=>t?this.emit("error",t):this.emit("close")))}}}class WriteStreamSync extends WriteStream{[Ft](){let t;if(this[Zt]&&this[xt]==="r+"){try{t=Ue.openSync(this[Ut],this[xt],this[It])}catch(t){if(t?.code==="ENOENT"){this[xt]="w";return this[Ft]()}else{throw t}}}else{t=Ue.openSync(this[Ut],this[xt],this[It])}this[Lt](null,t)}[Rt](){if(this[$t]&&typeof this[Ot]==="number"){const t=this[Ot];this[Ot]=undefined;Ue.closeSync(t);this.emit("close")}}[Kt](t){let r=true;try{this[jt](null,Ue.writeSync(this[Ot],t,0,t.length,this[Bt]));r=false}finally{if(r){try{this[Rt]()}catch{}}}}}var Jt=__nccwpck_require__(6928);const Qt=new Map([["C","cwd"],["f","file"],["z","gzip"],["P","preservePaths"],["U","unlink"],["strip-components","strip"],["stripComponents","strip"],["keep-newer","newer"],["keepNewer","newer"],["keep-newer-files","newer"],["keepNewerFiles","newer"],["k","keep"],["keep-existing","keep"],["keepExisting","keep"],["m","noMtime"],["no-mtime","noMtime"],["p","preserveOwner"],["L","follow"],["h","follow"],["onentry","onReadEntry"]]);const isSyncFile=t=>!!t.sync&&!!t.file;const isAsyncFile=t=>!t.sync&&!!t.file;const isSyncNoFile=t=>!!t.sync&&!t.file;const isAsyncNoFile=t=>!t.sync&&!t.file;const isSync=t=>!!t.sync;const isAsync=t=>!t.sync;const isFile=t=>!!t.file;const isNoFile=t=>!t.file;const dealiasKey=t=>{const r=Qt.get(t);if(r)return r;return t};const dealias=(t={})=>{if(!t)return{};const r={};for(const[i,o]of Object.entries(t)){const t=dealiasKey(i);r[t]=o}if(r.chmod===undefined&&r.noChmod===false){r.chmod=true}delete r.noChmod;return r};const makeCommand=(t,r,i,o,a)=>Object.assign(((c=[],l,u)=>{if(Array.isArray(c)){l=c;c={}}if(typeof l==="function"){u=l;l=undefined}if(!l){l=[]}else{l=Array.from(l)}const h=dealias(c);a?.(h,l);if(isSyncFile(h)){if(typeof u==="function"){throw new TypeError("callback not supported for sync tar functions")}return t(h,l)}else if(isAsyncFile(h)){const t=r(h,l);const i=u?u:undefined;return i?t.then((()=>i()),i):t}else if(isSyncNoFile(h)){if(typeof u==="function"){throw new TypeError("callback not supported for sync tar functions")}return i(h,l)}else if(isAsyncNoFile(h)){if(typeof u==="function"){throw new TypeError("callback only supported with file option")}return o(h,l)}else{throw new Error("impossible options??")}}),{syncFile:t,asyncFile:r,syncNoFile:i,asyncNoFile:o,validate:a});const er=require("assert");var tr=__nccwpck_require__(181);const rr=require("zlib");const sr=rr.constants||{ZLIB_VERNUM:4736};const nr=Object.freeze(Object.assign(Object.create(null),{Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_VERSION_ERROR:-6,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,DEFLATE:1,INFLATE:2,GZIP:3,GUNZIP:4,DEFLATERAW:5,INFLATERAW:6,UNZIP:7,BROTLI_DECODE:8,BROTLI_ENCODE:9,Z_MIN_WINDOWBITS:8,Z_MAX_WINDOWBITS:15,Z_DEFAULT_WINDOWBITS:15,Z_MIN_CHUNK:64,Z_MAX_CHUNK:Infinity,Z_DEFAULT_CHUNK:16384,Z_MIN_MEMLEVEL:1,Z_MAX_MEMLEVEL:9,Z_DEFAULT_MEMLEVEL:8,Z_MIN_LEVEL:-1,Z_MAX_LEVEL:9,Z_DEFAULT_LEVEL:-1,BROTLI_OPERATION_PROCESS:0,BROTLI_OPERATION_FLUSH:1,BROTLI_OPERATION_FINISH:2,BROTLI_OPERATION_EMIT_METADATA:3,BROTLI_MODE_GENERIC:0,BROTLI_MODE_TEXT:1,BROTLI_MODE_FONT:2,BROTLI_DEFAULT_MODE:0,BROTLI_MIN_QUALITY:0,BROTLI_MAX_QUALITY:11,BROTLI_DEFAULT_QUALITY:11,BROTLI_MIN_WINDOW_BITS:10,BROTLI_MAX_WINDOW_BITS:24,BROTLI_LARGE_MAX_WINDOW_BITS:30,BROTLI_DEFAULT_WINDOW:22,BROTLI_MIN_INPUT_BLOCK_BITS:16,BROTLI_MAX_INPUT_BLOCK_BITS:24,BROTLI_PARAM_MODE:0,BROTLI_PARAM_QUALITY:1,BROTLI_PARAM_LGWIN:2,BROTLI_PARAM_LGBLOCK:3,BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING:4,BROTLI_PARAM_SIZE_HINT:5,BROTLI_PARAM_LARGE_WINDOW:6,BROTLI_PARAM_NPOSTFIX:7,BROTLI_PARAM_NDIRECT:8,BROTLI_DECODER_RESULT_ERROR:0,BROTLI_DECODER_RESULT_SUCCESS:1,BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT:2,BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION:0,BROTLI_DECODER_PARAM_LARGE_WINDOW:1,BROTLI_DECODER_NO_ERROR:0,BROTLI_DECODER_SUCCESS:1,BROTLI_DECODER_NEEDS_MORE_INPUT:2,BROTLI_DECODER_NEEDS_MORE_OUTPUT:3,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE:-1,BROTLI_DECODER_ERROR_FORMAT_RESERVED:-2,BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE:-3,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET:-4,BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME:-5,BROTLI_DECODER_ERROR_FORMAT_CL_SPACE:-6,BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE:-7,BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT:-8,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1:-9,BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2:-10,BROTLI_DECODER_ERROR_FORMAT_TRANSFORM:-11,BROTLI_DECODER_ERROR_FORMAT_DICTIONARY:-12,BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS:-13,BROTLI_DECODER_ERROR_FORMAT_PADDING_1:-14,BROTLI_DECODER_ERROR_FORMAT_PADDING_2:-15,BROTLI_DECODER_ERROR_FORMAT_DISTANCE:-16,BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET:-19,BROTLI_DECODER_ERROR_INVALID_ARGUMENTS:-20,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES:-21,BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS:-22,BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP:-25,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1:-26,BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2:-27,BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES:-30,BROTLI_DECODER_ERROR_UNREACHABLE:-31},sr));const ir=tr.Buffer.concat;const ar=Symbol("_superWrite");class ZlibError extends Error{code;errno;constructor(t){super("zlib: "+t.message);this.code=t.code;this.errno=t.errno;if(!this.code)this.code="ZLIB_ERROR";this.message="zlib: "+t.message;Error.captureStackTrace(this,this.constructor)}get name(){return"ZlibError"}}const cr=Symbol("flushFlag");class ZlibBase extends Minipass{#n=false;#i=false;#o;#a;#c;#l;#u;get sawError(){return this.#n}get handle(){return this.#l}get flushFlag(){return this.#o}constructor(t,r){if(!t||typeof t!=="object")throw new TypeError("invalid options for ZlibBase constructor");super(t);this.#o=t.flush??0;this.#a=t.finishFlush??0;this.#c=t.fullFlushFlag??0;try{this.#l=new rr[r](t)}catch(t){throw new ZlibError(t)}this.#u=t=>{if(this.#n)return;this.#n=true;this.close();this.emit("error",t)};this.#l?.on("error",(t=>this.#u(new ZlibError(t))));this.once("end",(()=>this.close))}close(){if(this.#l){this.#l.close();this.#l=undefined;this.emit("close")}}reset(){if(!this.#n){er(this.#l,"zlib binding closed");return this.#l.reset?.()}}flush(t){if(this.ended)return;if(typeof t!=="number")t=this.#c;this.write(Object.assign(tr.Buffer.alloc(0),{[cr]:t}))}end(t,r,i){if(typeof t==="function"){i=t;r=undefined;t=undefined}if(typeof r==="function"){i=r;r=undefined}if(t){if(r)this.write(t,r);else this.write(t)}this.flush(this.#a);this.#i=true;return super.end(i)}get ended(){return this.#i}[ar](t){return super.write(t)}write(t,r,i){if(typeof r==="function")i=r,r="utf8";if(typeof t==="string")t=tr.Buffer.from(t,r);if(this.#n)return;er(this.#l,"zlib binding closed");const o=this.#l._handle;const a=o.close;o.close=()=>{};const c=this.#l.close;this.#l.close=()=>{};tr.Buffer.concat=t=>t;let l=undefined;try{const r=typeof t[cr]==="number"?t[cr]:this.#o;l=this.#l._processChunk(t,r);tr.Buffer.concat=ir}catch(t){tr.Buffer.concat=ir;this.#u(new ZlibError(t))}finally{if(this.#l){this.#l._handle=o;o.close=a;this.#l.close=c;this.#l.removeAllListeners("error")}}if(this.#l)this.#l.on("error",(t=>this.#u(new ZlibError(t))));let u;if(l){if(Array.isArray(l)&&l.length>0){const t=l[0];u=this[ar](tr.Buffer.from(t));for(let t=1;t<l.length;t++){u=this[ar](l[t])}}else{u=this[ar](tr.Buffer.from(l))}}if(i)i();return u}}class Zlib extends ZlibBase{#h;#d;constructor(t,r){t=t||{};t.flush=t.flush||nr.Z_NO_FLUSH;t.finishFlush=t.finishFlush||nr.Z_FINISH;t.fullFlushFlag=nr.Z_FULL_FLUSH;super(t,r);this.#h=t.level;this.#d=t.strategy}params(t,r){if(this.sawError)return;if(!this.handle)throw new Error("cannot switch params when binding is closed");if(!this.handle.params)throw new Error("not supported in this implementation");if(this.#h!==t||this.#d!==r){this.flush(nr.Z_SYNC_FLUSH);er(this.handle,"zlib binding closed");const i=this.handle.flush;this.handle.flush=(t,r)=>{if(typeof t==="function"){r=t;t=this.flushFlag}this.flush(t);r?.()};try{this.handle.params(t,r)}finally{this.handle.flush=i}if(this.handle){this.#h=t;this.#d=r}}}}class Deflate extends Zlib{constructor(t){super(t,"Deflate")}}class Inflate extends Zlib{constructor(t){super(t,"Inflate")}}class Gzip extends Zlib{#f;constructor(t){super(t,"Gzip");this.#f=t&&!!t.portable}[ar](t){if(!this.#f)return super[ar](t);this.#f=false;t[9]=255;return super[ar](t)}}class Gunzip extends Zlib{constructor(t){super(t,"Gunzip")}}class DeflateRaw extends Zlib{constructor(t){super(t,"DeflateRaw")}}class InflateRaw extends Zlib{constructor(t){super(t,"InflateRaw")}}class Unzip extends Zlib{constructor(t){super(t,"Unzip")}}class Brotli extends ZlibBase{constructor(t,r){t=t||{};t.flush=t.flush||nr.BROTLI_OPERATION_PROCESS;t.finishFlush=t.finishFlush||nr.BROTLI_OPERATION_FINISH;t.fullFlushFlag=nr.BROTLI_OPERATION_FLUSH;super(t,r)}}class BrotliCompress extends Brotli{constructor(t){super(t,"BrotliCompress")}}class BrotliDecompress extends Brotli{constructor(t){super(t,"BrotliDecompress")}}class Yallist{tail;head;length=0;static create(t=[]){return new Yallist(t)}constructor(t=[]){for(const r of t){this.push(r)}}*[Symbol.iterator](){for(let t=this.head;t;t=t.next){yield t.value}}removeNode(t){if(t.list!==this){throw new Error("removing node which does not belong to this list")}const r=t.next;const i=t.prev;if(r){r.prev=i}if(i){i.next=r}if(t===this.head){this.head=r}if(t===this.tail){this.tail=i}this.length--;t.next=undefined;t.prev=undefined;t.list=undefined;return r}unshiftNode(t){if(t===this.head){return}if(t.list){t.list.removeNode(t)}const r=this.head;t.list=this;t.next=r;if(r){r.prev=t}this.head=t;if(!this.tail){this.tail=t}this.length++}pushNode(t){if(t===this.tail){return}if(t.list){t.list.removeNode(t)}const r=this.tail;t.list=this;t.prev=r;if(r){r.next=t}this.tail=t;if(!this.head){this.head=t}this.length++}push(...t){for(let r=0,i=t.length;r<i;r++){push(this,t[r])}return this.length}unshift(...t){for(var r=0,i=t.length;r<i;r++){unshift(this,t[r])}return this.length}pop(){if(!this.tail){return undefined}const t=this.tail.value;const r=this.tail;this.tail=this.tail.prev;if(this.tail){this.tail.next=undefined}else{this.head=undefined}r.list=undefined;this.length--;return t}shift(){if(!this.head){return undefined}const t=this.head.value;const r=this.head;this.head=this.head.next;if(this.head){this.head.prev=undefined}else{this.tail=undefined}r.list=undefined;this.length--;return t}forEach(t,r){r=r||this;for(let i=this.head,o=0;!!i;o++){t.call(r,i.value,o,this);i=i.next}}forEachReverse(t,r){r=r||this;for(let i=this.tail,o=this.length-1;!!i;o--){t.call(r,i.value,o,this);i=i.prev}}get(t){let r=0;let i=this.head;for(;!!i&&r<t;r++){i=i.next}if(r===t&&!!i){return i.value}}getReverse(t){let r=0;let i=this.tail;for(;!!i&&r<t;r++){i=i.prev}if(r===t&&!!i){return i.value}}map(t,r){r=r||this;const i=new Yallist;for(let o=this.head;!!o;){i.push(t.call(r,o.value,this));o=o.next}return i}mapReverse(t,r){r=r||this;var i=new Yallist;for(let o=this.tail;!!o;){i.push(t.call(r,o.value,this));o=o.prev}return i}reduce(t,r){let i;let o=this.head;if(arguments.length>1){i=r}else if(this.head){o=this.head.next;i=this.head.value}else{throw new TypeError("Reduce of empty list with no initial value")}for(var a=0;!!o;a++){i=t(i,o.value,a);o=o.next}return i}reduceReverse(t,r){let i;let o=this.tail;if(arguments.length>1){i=r}else if(this.tail){o=this.tail.prev;i=this.tail.value}else{throw new TypeError("Reduce of empty list with no initial value")}for(let r=this.length-1;!!o;r--){i=t(i,o.value,r);o=o.prev}return i}toArray(){const t=new Array(this.length);for(let r=0,i=this.head;!!i;r++){t[r]=i.value;i=i.next}return t}toArrayReverse(){const t=new Array(this.length);for(let r=0,i=this.tail;!!i;r++){t[r]=i.value;i=i.prev}return t}slice(t=0,r=this.length){if(r<0){r+=this.length}if(t<0){t+=this.length}const i=new Yallist;if(r<t||r<0){return i}if(t<0){t=0}if(r>this.length){r=this.length}let o=this.head;let a=0;for(a=0;!!o&&a<t;a++){o=o.next}for(;!!o&&a<r;a++,o=o.next){i.push(o.value)}return i}sliceReverse(t=0,r=this.length){if(r<0){r+=this.length}if(t<0){t+=this.length}const i=new Yallist;if(r<t||r<0){return i}if(t<0){t=0}if(r>this.length){r=this.length}let o=this.length;let a=this.tail;for(;!!a&&o>r;o--){a=a.prev}for(;!!a&&o>t;o--,a=a.prev){i.push(a.value)}return i}splice(t,r=0,...i){if(t>this.length){t=this.length-1}if(t<0){t=this.length+t}let o=this.head;for(let r=0;!!o&&r<t;r++){o=o.next}const a=[];for(let t=0;!!o&&t<r;t++){a.push(o.value);o=this.removeNode(o)}if(!o){o=this.tail}else if(o!==this.tail){o=o.prev}for(const t of i){o=insertAfter(this,o,t)}return a}reverse(){const t=this.head;const r=this.tail;for(let r=t;!!r;r=r.prev){const t=r.prev;r.prev=r.next;r.next=t}this.head=r;this.tail=t;return this}}function insertAfter(t,r,i){const o=r;const a=r?r.next:t.head;const c=new Node(i,o,a,t);if(c.next===undefined){t.tail=c}if(c.prev===undefined){t.head=c}t.length++;return c}function push(t,r){t.tail=new Node(r,t.tail,undefined,t);if(!t.head){t.head=t.tail}t.length++}function unshift(t,r){t.head=new Node(r,undefined,t.head,t);if(!t.tail){t.tail=t.head}t.length++}class Node{list;next;prev;value;constructor(t,r,i,o){this.list=o;this.value=t;if(r){r.next=this;this.prev=r}else{this.prev=undefined}if(i){i.prev=this;this.next=i}else{this.next=undefined}}}const encode=(t,r)=>{if(!Number.isSafeInteger(t)){throw Error("cannot encode number outside of javascript safe integer range")}else if(t<0){encodeNegative(t,r)}else{encodePositive(t,r)}return r};const encodePositive=(t,r)=>{r[0]=128;for(var i=r.length;i>1;i--){r[i-1]=t&255;t=Math.floor(t/256)}};const encodeNegative=(t,r)=>{r[0]=255;var i=false;t=t*-1;for(var o=r.length;o>1;o--){var a=t&255;t=Math.floor(t/256);if(i){r[o-1]=onesComp(a)}else if(a===0){r[o-1]=0}else{i=true;r[o-1]=twosComp(a)}}};const parse=t=>{const r=t[0];const i=r===128?pos(t.subarray(1,t.length)):r===255?twos(t):null;if(i===null){throw Error("invalid base256 encoding")}if(!Number.isSafeInteger(i)){throw Error("parsed number outside of javascript safe integer range")}return i};const twos=t=>{var r=t.length;var i=0;var o=false;for(var a=r-1;a>-1;a--){var c=Number(t[a]);var l;if(o){l=onesComp(c)}else if(c===0){l=c}else{o=true;l=twosComp(c)}if(l!==0){i-=l*Math.pow(256,r-a-1)}}return i};const pos=t=>{var r=t.length;var i=0;for(var o=r-1;o>-1;o--){var a=Number(t[o]);if(a!==0){i+=a*Math.pow(256,r-o-1)}}return i};const onesComp=t=>(255^t)&255;const twosComp=t=>(255^t)+1&255;const isCode=t=>lr.has(t);const isName=t=>ur.has(t);const lr=new Map([["0","File"],["","OldFile"],["1","Link"],["2","SymbolicLink"],["3","CharacterDevice"],["4","BlockDevice"],["5","Directory"],["6","FIFO"],["7","ContiguousFile"],["g","GlobalExtendedHeader"],["x","ExtendedHeader"],["A","SolarisACL"],["D","GNUDumpDir"],["I","Inode"],["K","NextFileHasLongLinkpath"],["L","NextFileHasLongPath"],["M","ContinuationFile"],["N","OldGnuLongPath"],["S","SparseFile"],["V","TapeVolumeHeader"],["X","OldExtendedHeader"]]);const ur=new Map(Array.from(lr).map((t=>[t[1],t[0]])));class Header{cksumValid=false;needPax=false;nullBlock=false;block;path;mode;uid;gid;size;cksum;#p="Unsupported";linkpath;uname;gname;devmaj=0;devmin=0;atime;ctime;mtime;charset;comment;constructor(t,r=0,i,o){if(Buffer.isBuffer(t)){this.decode(t,r||0,i,o)}else if(t){this.#m(t)}}decode(t,r,i,o){if(!r){r=0}if(!t||!(t.length>=r+512)){throw new Error("need 512 bytes for header")}this.path=decString(t,r,100);this.mode=decNumber(t,r+100,8);this.uid=decNumber(t,r+108,8);this.gid=decNumber(t,r+116,8);this.size=decNumber(t,r+124,12);this.mtime=decDate(t,r+136,12);this.cksum=decNumber(t,r+148,12);if(o)this.#m(o,true);if(i)this.#m(i);const a=decString(t,r+156,1);if(isCode(a)){this.#p=a||"0"}if(this.#p==="0"&&this.path.slice(-1)==="/"){this.#p="5"}if(this.#p==="5"){this.size=0}this.linkpath=decString(t,r+157,100);if(t.subarray(r+257,r+265).toString()==="ustar\x0000"){this.uname=decString(t,r+265,32);this.gname=decString(t,r+297,32);this.devmaj=decNumber(t,r+329,8)??0;this.devmin=decNumber(t,r+337,8)??0;if(t[r+475]!==0){const i=decString(t,r+345,155);this.path=i+"/"+this.path}else{const i=decString(t,r+345,130);if(i){this.path=i+"/"+this.path}this.atime=decDate(t,r+476,12);this.ctime=decDate(t,r+488,12)}}let c=8*32;for(let i=r;i<r+148;i++){c+=t[i]}for(let i=r+156;i<r+512;i++){c+=t[i]}this.cksumValid=c===this.cksum;if(this.cksum===undefined&&c===8*32){this.nullBlock=true}}#m(t,r=false){Object.assign(this,Object.fromEntries(Object.entries(t).filter((([t,i])=>!(i===null||i===undefined||t==="path"&&r||t==="linkpath"&&r||t==="global")))))}encode(t,r=0){if(!t){t=this.block=Buffer.alloc(512)}if(this.#p==="Unsupported"){this.#p="0"}if(!(t.length>=r+512)){throw new Error("need 512 bytes for header")}const i=this.ctime||this.atime?130:155;const o=splitPrefix(this.path||"",i);const a=o[0];const c=o[1];this.needPax=!!o[2];this.needPax=encString(t,r,100,a)||this.needPax;this.needPax=encNumber(t,r+100,8,this.mode)||this.needPax;this.needPax=encNumber(t,r+108,8,this.uid)||this.needPax;this.needPax=encNumber(t,r+116,8,this.gid)||this.needPax;this.needPax=encNumber(t,r+124,12,this.size)||this.needPax;this.needPax=encDate(t,r+136,12,this.mtime)||this.needPax;t[r+156]=this.#p.charCodeAt(0);this.needPax=encString(t,r+157,100,this.linkpath)||this.needPax;t.write("ustar\x0000",r+257,8);this.needPax=encString(t,r+265,32,this.uname)||this.needPax;this.needPax=encString(t,r+297,32,this.gname)||this.needPax;this.needPax=encNumber(t,r+329,8,this.devmaj)||this.needPax;this.needPax=encNumber(t,r+337,8,this.devmin)||this.needPax;this.needPax=encString(t,r+345,i,c)||this.needPax;if(t[r+475]!==0){this.needPax=encString(t,r+345,155,c)||this.needPax}else{this.needPax=encString(t,r+345,130,c)||this.needPax;this.needPax=encDate(t,r+476,12,this.atime)||this.needPax;this.needPax=encDate(t,r+488,12,this.ctime)||this.needPax}let l=8*32;for(let i=r;i<r+148;i++){l+=t[i]}for(let i=r+156;i<r+512;i++){l+=t[i]}this.cksum=l;encNumber(t,r+148,8,this.cksum);this.cksumValid=true;return this.needPax}get type(){return this.#p==="Unsupported"?this.#p:lr.get(this.#p)}get typeKey(){return this.#p}set type(t){const r=String(ur.get(t));if(isCode(r)||r==="Unsupported"){this.#p=r}else if(isCode(t)){this.#p=t}else{throw new TypeError("invalid entry type: "+t)}}}const splitPrefix=(t,i)=>{const o=100;let a=t;let c="";let l=undefined;const u=r.posix.parse(t).root||".";if(Buffer.byteLength(a)<o){l=[a,c,false]}else{c=r.posix.dirname(a);a=r.posix.basename(a);do{if(Buffer.byteLength(a)<=o&&Buffer.byteLength(c)<=i){l=[a,c,false]}else if(Buffer.byteLength(a)>o&&Buffer.byteLength(c)<=i){l=[a.slice(0,o-1),c,true]}else{a=r.posix.join(r.posix.basename(c),a);c=r.posix.dirname(c)}}while(c!==u&&l===undefined);if(!l){l=[t.slice(0,o-1),"",true]}}return l};const decString=(t,r,i)=>t.subarray(r,r+i).toString("utf8").replace(/\0.*/,"");const decDate=(t,r,i)=>numToDate(decNumber(t,r,i));const numToDate=t=>t===undefined?undefined:new Date(t*1e3);const decNumber=(t,r,i)=>Number(t[r])&128?parse(t.subarray(r,r+i)):decSmallNumber(t,r,i);const nanUndef=t=>isNaN(t)?undefined:t;const decSmallNumber=(t,r,i)=>nanUndef(parseInt(t.subarray(r,r+i).toString("utf8").replace(/\0.*$/,"").trim(),8));const hr={12:8589934591,8:2097151};const encNumber=(t,r,i,o)=>o===undefined?false:o>hr[i]||o<0?(encode(o,t.subarray(r,r+i)),true):(encSmallNumber(t,r,i,o),false);const encSmallNumber=(t,r,i,o)=>t.write(octalString(o,i),r,i,"ascii");const octalString=(t,r)=>padOctal(Math.floor(t).toString(8),r);const padOctal=(t,r)=>(t.length===r-1?t:new Array(r-t.length-1).join("0")+t+" ")+"\0";const encDate=(t,r,i,o)=>o===undefined?false:encNumber(t,r,i,o.getTime()/1e3);const dr=new Array(156).join("\0");const encString=(t,r,i,o)=>o===undefined?false:(t.write(o+dr,r,i,"utf8"),o.length!==Buffer.byteLength(o)||o.length>i);class Pax{atime;mtime;ctime;charset;comment;gid;uid;gname;uname;linkpath;dev;ino;nlink;path;size;mode;global;constructor(t,r=false){this.atime=t.atime;this.charset=t.charset;this.comment=t.comment;this.ctime=t.ctime;this.dev=t.dev;this.gid=t.gid;this.global=r;this.gname=t.gname;this.ino=t.ino;this.linkpath=t.linkpath;this.mtime=t.mtime;this.nlink=t.nlink;this.path=t.path;this.size=t.size;this.uid=t.uid;this.uname=t.uname}encode(){const t=this.encodeBody();if(t===""){return Buffer.allocUnsafe(0)}const i=Buffer.byteLength(t);const o=512*Math.ceil(1+i/512);const a=Buffer.allocUnsafe(o);for(let t=0;t<512;t++){a[t]=0}new Header({path:("PaxHeader/"+(0,r.basename)(this.path??"")).slice(0,99),mode:this.mode||420,uid:this.uid,gid:this.gid,size:i,mtime:this.mtime,type:this.global?"GlobalExtendedHeader":"ExtendedHeader",linkpath:"",uname:this.uname||"",gname:this.gname||"",devmaj:0,devmin:0,atime:this.atime,ctime:this.ctime}).encode(a);a.write(t,512,i,"utf8");for(let t=i+512;t<a.length;t++){a[t]=0}return a}encodeBody(){return this.encodeField("path")+this.encodeField("ctime")+this.encodeField("atime")+this.encodeField("dev")+this.encodeField("ino")+this.encodeField("nlink")+this.encodeField("charset")+this.encodeField("comment")+this.encodeField("gid")+this.encodeField("gname")+this.encodeField("linkpath")+this.encodeField("mtime")+this.encodeField("size")+this.encodeField("uid")+this.encodeField("uname")}encodeField(t){if(this[t]===undefined){return""}const r=this[t];const i=r instanceof Date?r.getTime()/1e3:r;const o=" "+(t==="dev"||t==="ino"||t==="nlink"?"SCHILY.":"")+t+"="+i+"\n";const a=Buffer.byteLength(o);let c=Math.floor(Math.log(a)/Math.log(10))+1;if(a+c>=Math.pow(10,c)){c+=1}const l=c+a;return l+o}static parse(t,r,i=false){return new Pax(merge(parseKV(t),r),i)}}const merge=(t,r)=>r?Object.assign({},r,t):t;const parseKV=t=>t.replace(/\n$/,"").split("\n").reduce(parseKVLine,Object.create(null));const parseKVLine=(t,r)=>{const i=parseInt(r,10);if(i!==Buffer.byteLength(r)+1){return t}r=r.slice((i+" ").length);const o=r.split("=");const a=o.shift();if(!a){return t}const c=a.replace(/^SCHILY\.(dev|ino|nlink)/,"$1");const l=o.join("=");t[c]=/^([A-Z]+\.)?([mac]|birth|creation)time$/.test(c)?new Date(Number(l)*1e3):/^[0-9]+$/.test(l)?+l:l;return t};const fr=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform;const pr=fr!=="win32"?t=>t:t=>t&&t.replace(/\\/g,"/");class ReadEntry extends Minipass{extended;globalExtended;header;startBlockSize;blockRemain;remain;type;meta=false;ignore=false;path;mode;uid;gid;uname;gname;size=0;mtime;atime;ctime;linkpath;dev;ino;nlink;invalid=false;absolute;unsupported=false;constructor(t,r,i){super({});this.pause();this.extended=r;this.globalExtended=i;this.header=t;this.remain=t.size??0;this.startBlockSize=512*Math.ceil(this.remain/512);this.blockRemain=this.startBlockSize;this.type=t.type;switch(this.type){case"File":case"OldFile":case"Link":case"SymbolicLink":case"CharacterDevice":case"BlockDevice":case"Directory":case"FIFO":case"ContiguousFile":case"GNUDumpDir":break;case"NextFileHasLongLinkpath":case"NextFileHasLongPath":case"OldGnuLongPath":case"GlobalExtendedHeader":case"ExtendedHeader":case"OldExtendedHeader":this.meta=true;break;default:this.ignore=true}if(!t.path){throw new Error("no path provided for tar.ReadEntry")}this.path=pr(t.path);this.mode=t.mode;if(this.mode){this.mode=this.mode&4095}this.uid=t.uid;this.gid=t.gid;this.uname=t.uname;this.gname=t.gname;this.size=this.remain;this.mtime=t.mtime;this.atime=t.atime;this.ctime=t.ctime;this.linkpath=t.linkpath?pr(t.linkpath):undefined;this.uname=t.uname;this.gname=t.gname;if(r){this.#m(r)}if(i){this.#m(i,true)}}write(t){const r=t.length;if(r>this.blockRemain){throw new Error("writing more to entry than is appropriate")}const i=this.remain;const o=this.blockRemain;this.remain=Math.max(0,i-r);this.blockRemain=Math.max(0,o-r);if(this.ignore){return true}if(i>=r){return super.write(t)}return super.write(t.subarray(0,i))}#m(t,r=false){if(t.path)t.path=pr(t.path);if(t.linkpath)t.linkpath=pr(t.linkpath);Object.assign(this,Object.fromEntries(Object.entries(t).filter((([t,i])=>!(i===null||i===undefined||t==="path"&&r)))))}}const warnMethod=(t,r,i,o={})=>{if(t.file){o.file=t.file}if(t.cwd){o.cwd=t.cwd}o.code=i instanceof Error&&i.code||r;o.tarCode=r;if(!t.strict&&o.recoverable!==false){if(i instanceof Error){o=Object.assign(i,o);i=i.message}t.emit("warn",r,i,o)}else if(i instanceof Error){t.emit("error",Object.assign(i,o))}else{t.emit("error",Object.assign(new Error(`${r}: ${i}`),o))}};const mr=1024*1024;const gr=Buffer.from([31,139]);const yr=Symbol("state");const vr=Symbol("writeEntry");const _r=Symbol("readEntry");const br=Symbol("nextEntry");const wr=Symbol("processEntry");const Er=Symbol("extendedHeader");const Sr=Symbol("globalExtendedHeader");const $r=Symbol("meta");const Rr=Symbol("emitMeta");const Pr=Symbol("buffer");const Or=Symbol("queue");const Ar=Symbol("ended");const xr=Symbol("emittedEnd");const Tr=Symbol("emit");const kr=Symbol("unzip");const Cr=Symbol("consumeChunk");const Ir=Symbol("consumeChunkSub");const Nr=Symbol("consumeBody");const Dr=Symbol("consumeMeta");const Lr=Symbol("consumeHeader");const Mr=Symbol("consuming");const jr=Symbol("bufferConcat");const Fr=Symbol("maybeEnd");const Ur=Symbol("writing");const Br=Symbol("aborted");const Hr=Symbol("onDone");const Vr=Symbol("sawValidEntry");const zr=Symbol("sawNullBlock");const Gr=Symbol("sawEOF");const qr=Symbol("closeStream");const noop=()=>true;class Parser extends Fe.EventEmitter{file;strict;maxMetaEntrySize;filter;brotli;writable=true;readable=false;[Or]=new Yallist;[Pr];[_r];[vr];[yr]="begin";[$r]="";[Er];[Sr];[Ar]=false;[kr];[Br]=false;[Vr];[zr]=false;[Gr]=false;[Ur]=false;[Mr]=false;[xr]=false;constructor(t={}){super();this.file=t.file||"";this.on(Hr,(()=>{if(this[yr]==="begin"||this[Vr]===false){this.warn("TAR_BAD_ARCHIVE","Unrecognized archive format")}}));if(t.ondone){this.on(Hr,t.ondone)}else{this.on(Hr,(()=>{this.emit("prefinish");this.emit("finish");this.emit("end")}))}this.strict=!!t.strict;this.maxMetaEntrySize=t.maxMetaEntrySize||mr;this.filter=typeof t.filter==="function"?t.filter:noop;const r=t.file&&(t.file.endsWith(".tar.br")||t.file.endsWith(".tbr"));this.brotli=!t.gzip&&t.brotli!==undefined?t.brotli:r?undefined:false;this.on("end",(()=>this[qr]()));if(typeof t.onwarn==="function"){this.on("warn",t.onwarn)}if(typeof t.onReadEntry==="function"){this.on("entry",t.onReadEntry)}}warn(t,r,i={}){warnMethod(this,t,r,i)}[Lr](t,r){if(this[Vr]===undefined){this[Vr]=false}let i;try{i=new Header(t,r,this[Er],this[Sr])}catch(t){return this.warn("TAR_ENTRY_INVALID",t)}if(i.nullBlock){if(this[zr]){this[Gr]=true;if(this[yr]==="begin"){this[yr]="header"}this[Tr]("eof")}else{this[zr]=true;this[Tr]("nullBlock")}}else{this[zr]=false;if(!i.cksumValid){this.warn("TAR_ENTRY_INVALID","checksum failure",{header:i})}else if(!i.path){this.warn("TAR_ENTRY_INVALID","path is required",{header:i})}else{const t=i.type;if(/^(Symbolic)?Link$/.test(t)&&!i.linkpath){this.warn("TAR_ENTRY_INVALID","linkpath required",{header:i})}else if(!/^(Symbolic)?Link$/.test(t)&&!/^(Global)?ExtendedHeader$/.test(t)&&i.linkpath){this.warn("TAR_ENTRY_INVALID","linkpath forbidden",{header:i})}else{const t=this[vr]=new ReadEntry(i,this[Er],this[Sr]);if(!this[Vr]){if(t.remain){const onend=()=>{if(!t.invalid){this[Vr]=true}};t.on("end",onend)}else{this[Vr]=true}}if(t.meta){if(t.size>this.maxMetaEntrySize){t.ignore=true;this[Tr]("ignoredEntry",t);this[yr]="ignore";t.resume()}else if(t.size>0){this[$r]="";t.on("data",(t=>this[$r]+=t));this[yr]="meta"}}else{this[Er]=undefined;t.ignore=t.ignore||!this.filter(t.path,t);if(t.ignore){this[Tr]("ignoredEntry",t);this[yr]=t.remain?"ignore":"header";t.resume()}else{if(t.remain){this[yr]="body"}else{this[yr]="header";t.end()}if(!this[_r]){this[Or].push(t);this[br]()}else{this[Or].push(t)}}}}}}}[qr](){queueMicrotask((()=>this.emit("close")))}[wr](t){let r=true;if(!t){this[_r]=undefined;r=false}else if(Array.isArray(t)){const[r,...i]=t;this.emit(r,...i)}else{this[_r]=t;this.emit("entry",t);if(!t.emittedEnd){t.on("end",(()=>this[br]()));r=false}}return r}[br](){do{}while(this[wr](this[Or].shift()));if(!this[Or].length){const t=this[_r];const r=!t||t.flowing||t.size===t.remain;if(r){if(!this[Ur]){this.emit("drain")}}else{t.once("drain",(()=>this.emit("drain")))}}}[Nr](t,r){const i=this[vr];if(!i){throw new Error("attempt to consume body without entry??")}const o=i.blockRemain??0;const a=o>=t.length&&r===0?t:t.subarray(r,r+o);i.write(a);if(!i.blockRemain){this[yr]="header";this[vr]=undefined;i.end()}return a.length}[Dr](t,r){const i=this[vr];const o=this[Nr](t,r);if(!this[vr]&&i){this[Rr](i)}return o}[Tr](t,r,i){if(!this[Or].length&&!this[_r]){this.emit(t,r,i)}else{this[Or].push([t,r,i])}}[Rr](t){this[Tr]("meta",this[$r]);switch(t.type){case"ExtendedHeader":case"OldExtendedHeader":this[Er]=Pax.parse(this[$r],this[Er],false);break;case"GlobalExtendedHeader":this[Sr]=Pax.parse(this[$r],this[Sr],true);break;case"NextFileHasLongPath":case"OldGnuLongPath":{const t=this[Er]??Object.create(null);this[Er]=t;t.path=this[$r].replace(/\0.*/,"");break}case"NextFileHasLongLinkpath":{const t=this[Er]||Object.create(null);this[Er]=t;t.linkpath=this[$r].replace(/\0.*/,"");break}default:throw new Error("unknown meta: "+t.type)}}abort(t){this[Br]=true;this.emit("abort",t);this.warn("TAR_ABORT",t,{recoverable:false})}write(t,r,i){if(typeof r==="function"){i=r;r=undefined}if(typeof t==="string"){t=Buffer.from(t,typeof r==="string"?r:"utf8")}if(this[Br]){i?.();return false}const o=this[kr]===undefined||this.brotli===undefined&&this[kr]===false;if(o&&t){if(this[Pr]){t=Buffer.concat([this[Pr],t]);this[Pr]=undefined}if(t.length<gr.length){this[Pr]=t;i?.();return true}for(let r=0;this[kr]===undefined&&r<gr.length;r++){if(t[r]!==gr[r]){this[kr]=false}}const r=this.brotli===undefined;if(this[kr]===false&&r){if(t.length<512){if(this[Ar]){this.brotli=true}else{this[Pr]=t;i?.();return true}}else{try{new Header(t.subarray(0,512));this.brotli=false}catch(t){this.brotli=true}}}if(this[kr]===undefined||this[kr]===false&&this.brotli){const r=this[Ar];this[Ar]=false;this[kr]=this[kr]===undefined?new Unzip({}):new BrotliDecompress({});this[kr].on("data",(t=>this[Cr](t)));this[kr].on("error",(t=>this.abort(t)));this[kr].on("end",(()=>{this[Ar]=true;this[Cr]()}));this[Ur]=true;const o=!!this[kr][r?"end":"write"](t);this[Ur]=false;i?.();return o}}this[Ur]=true;if(this[kr]){this[kr].write(t)}else{this[Cr](t)}this[Ur]=false;const a=this[Or].length?false:this[_r]?this[_r].flowing:true;if(!a&&!this[Or].length){this[_r]?.once("drain",(()=>this.emit("drain")))}i?.();return a}[jr](t){if(t&&!this[Br]){this[Pr]=this[Pr]?Buffer.concat([this[Pr],t]):t}}[Fr](){if(this[Ar]&&!this[xr]&&!this[Br]&&!this[Mr]){this[xr]=true;const t=this[vr];if(t&&t.blockRemain){const r=this[Pr]?this[Pr].length:0;this.warn("TAR_BAD_ARCHIVE",`Truncated input (needed ${t.blockRemain} more bytes, only ${r} available)`,{entry:t});if(this[Pr]){t.write(this[Pr])}t.end()}this[Tr](Hr)}}[Cr](t){if(this[Mr]&&t){this[jr](t)}else if(!t&&!this[Pr]){this[Fr]()}else if(t){this[Mr]=true;if(this[Pr]){this[jr](t);const r=this[Pr];this[Pr]=undefined;this[Ir](r)}else{this[Ir](t)}while(this[Pr]&&this[Pr]?.length>=512&&!this[Br]&&!this[Gr]){const t=this[Pr];this[Pr]=undefined;this[Ir](t)}this[Mr]=false}if(!this[Pr]||this[Ar]){this[Fr]()}}[Ir](t){let r=0;const i=t.length;while(r+512<=i&&!this[Br]&&!this[Gr]){switch(this[yr]){case"begin":case"header":this[Lr](t,r);r+=512;break;case"ignore":case"body":r+=this[Nr](t,r);break;case"meta":r+=this[Dr](t,r);break;default:throw new Error("invalid state: "+this[yr])}}if(r<i){if(this[Pr]){this[Pr]=Buffer.concat([t.subarray(r),this[Pr]])}else{this[Pr]=t.subarray(r)}}}end(t,r,i){if(typeof t==="function"){i=t;r=undefined;t=undefined}if(typeof r==="function"){i=r;r=undefined}if(typeof t==="string"){t=Buffer.from(t,r)}if(i)this.once("finish",i);if(!this[Br]){if(this[kr]){if(t)this[kr].write(t);this[kr].end()}else{this[Ar]=true;if(this.brotli===undefined)t=t||Buffer.alloc(0);if(t)this.write(t);this[Fr]()}}return this}}const stripTrailingSlashes=t=>{let r=t.length-1;let i=-1;while(r>-1&&t.charAt(r)==="/"){i=r;r--}return i===-1?t:t.slice(0,i)};const onReadEntryFunction=t=>{const r=t.onReadEntry;t.onReadEntry=r?t=>{r(t);t.resume()}:t=>t.resume()};const filesFilter=(t,r)=>{const i=new Map(r.map((t=>[stripTrailingSlashes(t),true])));const o=t.filter;const mapHas=(t,r="")=>{const o=r||(0,Jt.parse)(t).root||".";let a;if(t===o)a=false;else{const r=i.get(t);if(r!==undefined){a=r}else{a=mapHas((0,Jt.dirname)(t),o)}}i.set(t,a);return a};t.filter=o?(t,r)=>o(t,r)&&mapHas(stripTrailingSlashes(t)):t=>mapHas(stripTrailingSlashes(t))};const listFileSync=r=>{const i=new Parser(r);const o=r.file;let a;try{const c=t.statSync(o);const l=r.maxReadSize||16*1024*1024;if(c.size<l){i.end(t.readFileSync(o))}else{let r=0;const u=Buffer.allocUnsafe(l);a=t.openSync(o,"r");while(r<c.size){const o=t.readSync(a,u,0,l,r);r+=o;i.write(u.subarray(0,o))}i.end()}}finally{if(typeof a==="number"){try{t.closeSync(a)}catch(t){}}}};const listFile=(r,i)=>{const o=new Parser(r);const a=r.maxReadSize||16*1024*1024;const c=r.file;const l=new Promise(((r,i)=>{o.on("error",i);o.on("end",r);t.stat(c,((t,r)=>{if(t){i(t)}else{const t=new ReadStream(c,{readSize:a,size:r.size});t.on("error",i);t.pipe(o)}}))}));return l};const Wr=makeCommand(listFileSync,listFile,(t=>new Parser(t)),(t=>new Parser(t)),((t,r)=>{if(r?.length)filesFilter(t,r);if(!t.noResume)onReadEntryFunction(t)}));const modeFix=(t,r,i)=>{t&=4095;if(i){t=(t|384)&~18}if(r){if(t&256){t|=64}if(t&32){t|=8}if(t&4){t|=1}}return t};const{isAbsolute:Kr,parse:Yr}=r.win32;const stripAbsolutePath=t=>{let r="";let i=Yr(t);while(Kr(t)||i.root){const o=t.charAt(0)==="/"&&t.slice(0,4)!=="//?/"?"/":i.root;t=t.slice(o.length);r+=o;i=Yr(t)}return[r,t]};const Zr=["|","<",">","?",":"];const Xr=Zr.map((t=>String.fromCharCode(61440+t.charCodeAt(0))));const Jr=new Map(Zr.map(((t,r)=>[t,Xr[r]])));const Qr=new Map(Xr.map(((t,r)=>[t,Zr[r]])));const winchars_encode=t=>Zr.reduce(((t,r)=>t.split(r).join(Jr.get(r))),t);const decode=t=>Xr.reduce(((t,r)=>t.split(r).join(Qr.get(r))),t);const prefixPath=(t,r)=>{if(!r){return pr(t)}t=pr(t).replace(/^\.(\/|$)/,"");return stripTrailingSlashes(r)+"/"+t};const es=16*1024*1024;const ts=Symbol("process");const rs=Symbol("file");const ss=Symbol("directory");const ns=Symbol("symlink");const is=Symbol("hardlink");const os=Symbol("header");const as=Symbol("read");const cs=Symbol("lstat");const ls=Symbol("onlstat");const us=Symbol("onread");const hs=Symbol("onreadlink");const ds=Symbol("openfile");const ps=Symbol("onopenfile");const ms=Symbol("close");const gs=Symbol("mode");const ys=Symbol("awaitDrain");const vs=Symbol("ondrain");const _s=Symbol("prefix");class WriteEntry extends Minipass{path;portable;myuid=process.getuid&&process.getuid()||0;myuser=process.env.USER||"";maxReadSize;linkCache;statCache;preservePaths;cwd;strict;mtime;noPax;noMtime;prefix;fd;blockLen=0;blockRemain=0;buf;pos=0;remain=0;length=0;offset=0;win32;absolute;header;type;linkpath;stat;onWriteEntry;#g=false;constructor(t,r={}){const i=dealias(r);super();this.path=pr(t);this.portable=!!i.portable;this.maxReadSize=i.maxReadSize||es;this.linkCache=i.linkCache||new Map;this.statCache=i.statCache||new Map;this.preservePaths=!!i.preservePaths;this.cwd=pr(i.cwd||process.cwd());this.strict=!!i.strict;this.noPax=!!i.noPax;this.noMtime=!!i.noMtime;this.mtime=i.mtime;this.prefix=i.prefix?pr(i.prefix):undefined;this.onWriteEntry=i.onWriteEntry;if(typeof i.onwarn==="function"){this.on("warn",i.onwarn)}let o=false;if(!this.preservePaths){const[t,r]=stripAbsolutePath(this.path);if(t&&typeof r==="string"){this.path=r;o=t}}this.win32=!!i.win32||process.platform==="win32";if(this.win32){this.path=decode(this.path.replace(/\\/g,"/"));t=t.replace(/\\/g,"/")}this.absolute=pr(i.absolute||Jt.resolve(this.cwd,t));if(this.path===""){this.path="./"}if(o){this.warn("TAR_ENTRY_INFO",`stripping ${o} from absolute path`,{entry:this,path:o+this.path})}const a=this.statCache.get(this.absolute);if(a){this[ls](a)}else{this[cs]()}}warn(t,r,i={}){return warnMethod(this,t,r,i)}emit(t,...r){if(t==="error"){this.#g=true}return super.emit(t,...r)}[cs](){Ue.lstat(this.absolute,((t,r)=>{if(t){return this.emit("error",t)}this[ls](r)}))}[ls](t){this.statCache.set(this.absolute,t);this.stat=t;if(!t.isFile()){t.size=0}this.type=getType(t);this.emit("stat",t);this[ts]()}[ts](){switch(this.type){case"File":return this[rs]();case"Directory":return this[ss]();case"SymbolicLink":return this[ns]();default:return this.end()}}[gs](t){return modeFix(t,this.type==="Directory",this.portable)}[_s](t){return prefixPath(t,this.prefix)}[os](){if(!this.stat){throw new Error("cannot write header before stat")}if(this.type==="Directory"&&this.portable){this.noMtime=true}this.onWriteEntry?.(this);this.header=new Header({path:this[_s](this.path),linkpath:this.type==="Link"&&this.linkpath!==undefined?this[_s](this.linkpath):this.linkpath,mode:this[gs](this.stat.mode),uid:this.portable?undefined:this.stat.uid,gid:this.portable?undefined:this.stat.gid,size:this.stat.size,mtime:this.noMtime?undefined:this.mtime||this.stat.mtime,type:this.type==="Unsupported"?undefined:this.type,uname:this.portable?undefined:this.stat.uid===this.myuid?this.myuser:"",atime:this.portable?undefined:this.stat.atime,ctime:this.portable?undefined:this.stat.ctime});if(this.header.encode()&&!this.noPax){super.write(new Pax({atime:this.portable?undefined:this.header.atime,ctime:this.portable?undefined:this.header.ctime,gid:this.portable?undefined:this.header.gid,mtime:this.noMtime?undefined:this.mtime||this.header.mtime,path:this[_s](this.path),linkpath:this.type==="Link"&&this.linkpath!==undefined?this[_s](this.linkpath):this.linkpath,size:this.header.size,uid:this.portable?undefined:this.header.uid,uname:this.portable?undefined:this.header.uname,dev:this.portable?undefined:this.stat.dev,ino:this.portable?undefined:this.stat.ino,nlink:this.portable?undefined:this.stat.nlink}).encode())}const t=this.header?.block;if(!t){throw new Error("failed to encode header")}super.write(t)}[ss](){if(!this.stat){throw new Error("cannot create directory entry without stat")}if(this.path.slice(-1)!=="/"){this.path+="/"}this.stat.size=0;this[os]();this.end()}[ns](){Ue.readlink(this.absolute,((t,r)=>{if(t){return this.emit("error",t)}this[hs](r)}))}[hs](t){this.linkpath=pr(t);this[os]();this.end()}[is](t){if(!this.stat){throw new Error("cannot create link entry without stat")}this.type="Link";this.linkpath=pr(Jt.relative(this.cwd,t));this.stat.size=0;this[os]();this.end()}[rs](){if(!this.stat){throw new Error("cannot create file entry without stat")}if(this.stat.nlink>1){const t=`${this.stat.dev}:${this.stat.ino}`;const r=this.linkCache.get(t);if(r?.indexOf(this.cwd)===0){return this[is](r)}this.linkCache.set(t,this.absolute)}this[os]();if(this.stat.size===0){return this.end()}this[ds]()}[ds](){Ue.open(this.absolute,"r",((t,r)=>{if(t){return this.emit("error",t)}this[ps](r)}))}[ps](t){this.fd=t;if(this.#g){return this[ms]()}if(!this.stat){throw new Error("should stat before calling onopenfile")}this.blockLen=512*Math.ceil(this.stat.size/512);this.blockRemain=this.blockLen;const r=Math.min(this.blockLen,this.maxReadSize);this.buf=Buffer.allocUnsafe(r);this.offset=0;this.pos=0;this.remain=this.stat.size;this.length=this.buf.length;this[as]()}[as](){const{fd:t,buf:r,offset:i,length:o,pos:a}=this;if(t===undefined||r===undefined){throw new Error("cannot read file without first opening")}Ue.read(t,r,i,o,a,((t,r)=>{if(t){return this[ms]((()=>this.emit("error",t)))}this[us](r)}))}[ms](t=()=>{}){if(this.fd!==undefined)Ue.close(this.fd,t)}[us](t){if(t<=0&&this.remain>0){const t=Object.assign(new Error("encountered unexpected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[ms]((()=>this.emit("error",t)))}if(t>this.remain){const t=Object.assign(new Error("did not encounter expected EOF"),{path:this.absolute,syscall:"read",code:"EOF"});return this[ms]((()=>this.emit("error",t)))}if(!this.buf){throw new Error("should have created buffer prior to reading")}if(t===this.remain){for(let r=t;r<this.length&&t<this.blockRemain;r++){this.buf[r+this.offset]=0;t++;this.remain++}}const r=this.offset===0&&t===this.buf.length?this.buf:this.buf.subarray(this.offset,this.offset+t);const i=this.write(r);if(!i){this[ys]((()=>this[vs]()))}else{this[vs]()}}[ys](t){this.once("drain",t)}write(t,r,i){if(typeof r==="function"){i=r;r=undefined}if(typeof t==="string"){t=Buffer.from(t,typeof r==="string"?r:"utf8")}if(this.blockRemain<t.length){const t=Object.assign(new Error("writing more data than expected"),{path:this.absolute});return this.emit("error",t)}this.remain-=t.length;this.blockRemain-=t.length;this.pos+=t.length;this.offset+=t.length;return super.write(t,null,i)}[vs](){if(!this.remain){if(this.blockRemain){super.write(Buffer.alloc(this.blockRemain))}return this[ms]((t=>t?this.emit("error",t):this.end()))}if(!this.buf){throw new Error("buffer lost somehow in ONDRAIN")}if(this.offset>=this.length){this.buf=Buffer.allocUnsafe(Math.min(this.blockRemain,this.buf.length));this.offset=0}this.length=this.buf.length-this.offset;this[as]()}}class WriteEntrySync extends WriteEntry{sync=true;[cs](){this[ls](Ue.lstatSync(this.absolute))}[ns](){this[hs](Ue.readlinkSync(this.absolute))}[ds](){this[ps](Ue.openSync(this.absolute,"r"))}[as](){let t=true;try{const{fd:r,buf:i,offset:o,length:a,pos:c}=this;if(r===undefined||i===undefined){throw new Error("fd and buf must be set in READ method")}const l=Ue.readSync(r,i,o,a,c);this[us](l);t=false}finally{if(t){try{this[ms]((()=>{}))}catch(t){}}}}[ys](t){t()}[ms](t=()=>{}){if(this.fd!==undefined)Ue.closeSync(this.fd);t()}}class WriteEntryTar extends Minipass{blockLen=0;blockRemain=0;buf=0;pos=0;remain=0;length=0;preservePaths;portable;strict;noPax;noMtime;readEntry;type;prefix;path;mode;uid;gid;uname;gname;header;mtime;atime;ctime;linkpath;size;onWriteEntry;warn(t,r,i={}){return warnMethod(this,t,r,i)}constructor(t,r={}){const i=dealias(r);super();this.preservePaths=!!i.preservePaths;this.portable=!!i.portable;this.strict=!!i.strict;this.noPax=!!i.noPax;this.noMtime=!!i.noMtime;this.onWriteEntry=i.onWriteEntry;this.readEntry=t;const{type:o}=t;if(o==="Unsupported"){throw new Error("writing entry that should be ignored")}this.type=o;if(this.type==="Directory"&&this.portable){this.noMtime=true}this.prefix=i.prefix;this.path=pr(t.path);this.mode=t.mode!==undefined?this[gs](t.mode):undefined;this.uid=this.portable?undefined:t.uid;this.gid=this.portable?undefined:t.gid;this.uname=this.portable?undefined:t.uname;this.gname=this.portable?undefined:t.gname;this.size=t.size;this.mtime=this.noMtime?undefined:i.mtime||t.mtime;this.atime=this.portable?undefined:t.atime;this.ctime=this.portable?undefined:t.ctime;this.linkpath=t.linkpath!==undefined?pr(t.linkpath):undefined;if(typeof i.onwarn==="function"){this.on("warn",i.onwarn)}let a=false;if(!this.preservePaths){const[t,r]=stripAbsolutePath(this.path);if(t&&typeof r==="string"){this.path=r;a=t}}this.remain=t.size;this.blockRemain=t.startBlockSize;this.onWriteEntry?.(this);this.header=new Header({path:this[_s](this.path),linkpath:this.type==="Link"&&this.linkpath!==undefined?this[_s](this.linkpath):this.linkpath,mode:this.mode,uid:this.portable?undefined:this.uid,gid:this.portable?undefined:this.gid,size:this.size,mtime:this.noMtime?undefined:this.mtime,type:this.type,uname:this.portable?undefined:this.uname,atime:this.portable?undefined:this.atime,ctime:this.portable?undefined:this.ctime});if(a){this.warn("TAR_ENTRY_INFO",`stripping ${a} from absolute path`,{entry:this,path:a+this.path})}if(this.header.encode()&&!this.noPax){super.write(new Pax({atime:this.portable?undefined:this.atime,ctime:this.portable?undefined:this.ctime,gid:this.portable?undefined:this.gid,mtime:this.noMtime?undefined:this.mtime,path:this[_s](this.path),linkpath:this.type==="Link"&&this.linkpath!==undefined?this[_s](this.linkpath):this.linkpath,size:this.size,uid:this.portable?undefined:this.uid,uname:this.portable?undefined:this.uname,dev:this.portable?undefined:this.readEntry.dev,ino:this.portable?undefined:this.readEntry.ino,nlink:this.portable?undefined:this.readEntry.nlink}).encode())}const c=this.header?.block;if(!c)throw new Error("failed to encode header");super.write(c);t.pipe(this)}[_s](t){return prefixPath(t,this.prefix)}[gs](t){return modeFix(t,this.type==="Directory",this.portable)}write(t,r,i){if(typeof r==="function"){i=r;r=undefined}if(typeof t==="string"){t=Buffer.from(t,typeof r==="string"?r:"utf8")}const o=t.length;if(o>this.blockRemain){throw new Error("writing more to entry than is appropriate")}this.blockRemain-=o;return super.write(t,i)}end(t,r,i){if(this.blockRemain){super.write(Buffer.alloc(this.blockRemain))}if(typeof t==="function"){i=t;r=undefined;t=undefined}if(typeof r==="function"){i=r;r=undefined}if(typeof t==="string"){t=Buffer.from(t,r??"utf8")}if(i)this.once("finish",i);t?super.end(t,i):super.end(i);return this}}const getType=t=>t.isFile()?"File":t.isDirectory()?"Directory":t.isSymbolicLink()?"SymbolicLink":"Unsupported";class PackJob{path;absolute;entry;stat;readdir;pending=false;ignore=false;piped=false;constructor(t,r){this.path=t||"./";this.absolute=r}}const bs=Buffer.alloc(1024);const ws=Symbol("onStat");const Es=Symbol("ended");const Ss=Symbol("queue");const $s=Symbol("current");const Rs=Symbol("process");const Ps=Symbol("processing");const Os=Symbol("processJob");const As=Symbol("jobs");const xs=Symbol("jobDone");const Ts=Symbol("addFSEntry");const ks=Symbol("addTarEntry");const Cs=Symbol("stat");const Is=Symbol("readdir");const Ns=Symbol("onreaddir");const Ds=Symbol("pipe");const Ls=Symbol("entry");const Ms=Symbol("entryOpt");const js=Symbol("writeEntryClass");const Fs=Symbol("write");const Us=Symbol("ondrain");class Pack extends Minipass{opt;cwd;maxReadSize;preservePaths;strict;noPax;prefix;linkCache;statCache;file;portable;zip;readdirCache;noDirRecurse;follow;noMtime;mtime;filter;jobs;[js];onWriteEntry;[Ss];[As]=0;[Ps]=false;[Es]=false;constructor(t={}){super();this.opt=t;this.file=t.file||"";this.cwd=t.cwd||process.cwd();this.maxReadSize=t.maxReadSize;this.preservePaths=!!t.preservePaths;this.strict=!!t.strict;this.noPax=!!t.noPax;this.prefix=pr(t.prefix||"");this.linkCache=t.linkCache||new Map;this.statCache=t.statCache||new Map;this.readdirCache=t.readdirCache||new Map;this.onWriteEntry=t.onWriteEntry;this[js]=WriteEntry;if(typeof t.onwarn==="function"){this.on("warn",t.onwarn)}this.portable=!!t.portable;if(t.gzip||t.brotli){if(t.gzip&&t.brotli){throw new TypeError("gzip and brotli are mutually exclusive")}if(t.gzip){if(typeof t.gzip!=="object"){t.gzip={}}if(this.portable){t.gzip.portable=true}this.zip=new Gzip(t.gzip)}if(t.brotli){if(typeof t.brotli!=="object"){t.brotli={}}this.zip=new BrotliCompress(t.brotli)}if(!this.zip)throw new Error("impossible");const r=this.zip;r.on("data",(t=>super.write(t)));r.on("end",(()=>super.end()));r.on("drain",(()=>this[Us]()));this.on("resume",(()=>r.resume()))}else{this.on("drain",this[Us])}this.noDirRecurse=!!t.noDirRecurse;this.follow=!!t.follow;this.noMtime=!!t.noMtime;if(t.mtime)this.mtime=t.mtime;this.filter=typeof t.filter==="function"?t.filter:()=>true;this[Ss]=new Yallist;this[As]=0;this.jobs=Number(t.jobs)||4;this[Ps]=false;this[Es]=false}[Fs](t){return super.write(t)}add(t){this.write(t);return this}end(t,r,i){if(typeof t==="function"){i=t;t=undefined}if(typeof r==="function"){i=r;r=undefined}if(t){this.add(t)}this[Es]=true;this[Rs]();if(i)i();return this}write(t){if(this[Es]){throw new Error("write after end")}if(t instanceof ReadEntry){this[ks](t)}else{this[Ts](t)}return this.flowing}[ks](t){const r=pr(Jt.resolve(this.cwd,t.path));if(!this.filter(t.path,t)){t.resume()}else{const i=new PackJob(t.path,r);i.entry=new WriteEntryTar(t,this[Ms](i));i.entry.on("end",(()=>this[xs](i)));this[As]+=1;this[Ss].push(i)}this[Rs]()}[Ts](t){const r=pr(Jt.resolve(this.cwd,t));this[Ss].push(new PackJob(t,r));this[Rs]()}[Cs](t){t.pending=true;this[As]+=1;const r=this.follow?"stat":"lstat";Ue[r](t.absolute,((r,i)=>{t.pending=false;this[As]-=1;if(r){this.emit("error",r)}else{this[ws](t,i)}}))}[ws](t,r){this.statCache.set(t.absolute,r);t.stat=r;if(!this.filter(t.path,r)){t.ignore=true}this[Rs]()}[Is](t){t.pending=true;this[As]+=1;Ue.readdir(t.absolute,((r,i)=>{t.pending=false;this[As]-=1;if(r){return this.emit("error",r)}this[Ns](t,i)}))}[Ns](t,r){this.readdirCache.set(t.absolute,r);t.readdir=r;this[Rs]()}[Rs](){if(this[Ps]){return}this[Ps]=true;for(let t=this[Ss].head;!!t&&this[As]<this.jobs;t=t.next){this[Os](t.value);if(t.value.ignore){const r=t.next;this[Ss].removeNode(t);t.next=r}}this[Ps]=false;if(this[Es]&&!this[Ss].length&&this[As]===0){if(this.zip){this.zip.end(bs)}else{super.write(bs);super.end()}}}get[$s](){return this[Ss]&&this[Ss].head&&this[Ss].head.value}[xs](t){this[Ss].shift();this[As]-=1;this[Rs]()}[Os](t){if(t.pending){return}if(t.entry){if(t===this[$s]&&!t.piped){this[Ds](t)}return}if(!t.stat){const r=this.statCache.get(t.absolute);if(r){this[ws](t,r)}else{this[Cs](t)}}if(!t.stat){return}if(t.ignore){return}if(!this.noDirRecurse&&t.stat.isDirectory()&&!t.readdir){const r=this.readdirCache.get(t.absolute);if(r){this[Ns](t,r)}else{this[Is](t)}if(!t.readdir){return}}t.entry=this[Ls](t);if(!t.entry){t.ignore=true;return}if(t===this[$s]&&!t.piped){this[Ds](t)}}[Ms](t){return{onwarn:(t,r,i)=>this.warn(t,r,i),noPax:this.noPax,cwd:this.cwd,absolute:t.absolute,preservePaths:this.preservePaths,maxReadSize:this.maxReadSize,strict:this.strict,portable:this.portable,linkCache:this.linkCache,statCache:this.statCache,noMtime:this.noMtime,mtime:this.mtime,prefix:this.prefix,onWriteEntry:this.onWriteEntry}}[Ls](t){this[As]+=1;try{const r=new this[js](t.path,this[Ms](t));return r.on("end",(()=>this[xs](t))).on("error",(t=>this.emit("error",t)))}catch(t){this.emit("error",t)}}[Us](){if(this[$s]&&this[$s].entry){this[$s].entry.resume()}}[Ds](t){t.piped=true;if(t.readdir){t.readdir.forEach((r=>{const i=t.path;const o=i==="./"?"":i.replace(/\/*$/,"/");this[Ts](o+r)}))}const r=t.entry;const i=this.zip;if(!r)throw new Error("cannot pipe without source");if(i){r.on("data",(t=>{if(!i.write(t)){r.pause()}}))}else{r.on("data",(t=>{if(!super.write(t)){r.pause()}}))}}pause(){if(this.zip){this.zip.pause()}return super.pause()}warn(t,r,i={}){warnMethod(this,t,r,i)}}class PackSync extends Pack{sync=true;constructor(t){super(t);this[js]=WriteEntrySync}pause(){}resume(){}[Cs](t){const r=this.follow?"statSync":"lstatSync";this[ws](t,Ue[r](t.absolute))}[Is](t){this[Ns](t,Ue.readdirSync(t.absolute))}[Ds](t){const r=t.entry;const i=this.zip;if(t.readdir){t.readdir.forEach((r=>{const i=t.path;const o=i==="./"?"":i.replace(/\/*$/,"/");this[Ts](o+r)}))}if(!r)throw new Error("Cannot pipe without source");if(i){r.on("data",(t=>{i.write(t)}))}else{r.on("data",(t=>{super[Fs](t)}))}}}const createFileSync=(t,r)=>{const i=new PackSync(t);const o=new WriteStreamSync(t.file,{mode:t.mode||438});i.pipe(o);addFilesSync(i,r)};const createFile=(t,r)=>{const i=new Pack(t);const o=new WriteStream(t.file,{mode:t.mode||438});i.pipe(o);const a=new Promise(((t,r)=>{o.on("error",r);o.on("close",t);i.on("error",r)}));addFilesAsync(i,r);return a};const addFilesSync=(t,i)=>{i.forEach((i=>{if(i.charAt(0)==="@"){Wr({file:r.resolve(t.cwd,i.slice(1)),sync:true,noResume:true,onReadEntry:r=>t.add(r)})}else{t.add(i)}}));t.end()};const addFilesAsync=async(t,i)=>{for(let o=0;o<i.length;o++){const a=String(i[o]);if(a.charAt(0)==="@"){await Wr({file:r.resolve(String(t.cwd),a.slice(1)),noResume:true,onReadEntry:r=>{t.add(r)}})}else{t.add(a)}}t.end()};const createSync=(t,r)=>{const i=new PackSync(t);addFilesSync(i,r);return i};const createAsync=(t,r)=>{const i=new Pack(t);addFilesAsync(i,r);return i};const Bs=makeCommand(createFileSync,createFile,createSync,createAsync,((t,r)=>{if(!r?.length){throw new TypeError("no paths specified to add to archive")}}));const Hs=process.env.__FAKE_PLATFORM__||process.platform;const Vs=Hs==="win32";const{O_CREAT:zs,O_TRUNC:Gs,O_WRONLY:qs}=Ue.constants;const Ws=Number(process.env.__FAKE_FS_O_FILENAME__)||Ue.constants.UV_FS_O_FILEMAP||0;const Ks=Vs&&!!Ws;const Ys=512*1024;const Zs=Ws|Gs|zs|qs;const Xs=!Ks?()=>"w":t=>t<Ys?Zs:"w";const lchownSync=(r,i,o)=>{try{return t.lchownSync(r,i,o)}catch(t){if(t?.code!=="ENOENT")throw t}};const chown=(r,i,o,a)=>{t.lchown(r,i,o,(t=>{a(t&&t?.code!=="ENOENT"?t:null)}))};const chownrKid=(t,i,o,a,c)=>{if(i.isDirectory()){chownr(r.resolve(t,i.name),o,a,(l=>{if(l)return c(l);const u=r.resolve(t,i.name);chown(u,o,a,c)}))}else{const l=r.resolve(t,i.name);chown(l,o,a,c)}};const chownr=(r,i,o,a)=>{t.readdir(r,{withFileTypes:true},((t,c)=>{if(t){if(t.code==="ENOENT")return a();else if(t.code!=="ENOTDIR"&&t.code!=="ENOTSUP")return a(t)}if(t||!c.length)return chown(r,i,o,a);let l=c.length;let u=null;const then=t=>{if(u)return;if(t)return a(u=t);if(--l===0)return chown(r,i,o,a)};for(const t of c){chownrKid(r,t,i,o,then)}}))};const chownrKidSync=(t,i,o,a)=>{if(i.isDirectory())chownrSync(r.resolve(t,i.name),o,a);lchownSync(r.resolve(t,i.name),o,a)};const chownrSync=(r,i,o)=>{let a;try{a=t.readdirSync(r,{withFileTypes:true})}catch(t){const a=t;if(a?.code==="ENOENT")return;else if(a?.code==="ENOTDIR"||a?.code==="ENOTSUP")return lchownSync(r,i,o);else throw a}for(const t of a){chownrKidSync(r,t,i,o)}return lchownSync(r,i,o)};const optsArg=t=>{if(!t){t={mode:511}}else if(typeof t==="object"){t={mode:511,...t}}else if(typeof t==="number"){t={mode:t}}else if(typeof t==="string"){t={mode:parseInt(t,8)}}else{throw new TypeError("invalid options argument")}const r=t;const i=t.fs||{};t.mkdir=t.mkdir||i.mkdir||Ue.mkdir;t.mkdirAsync=t.mkdirAsync?t.mkdirAsync:async(t,i)=>new Promise(((o,a)=>r.mkdir(t,i,((t,r)=>t?a(t):o(r)))));t.stat=t.stat||i.stat||Ue.stat;t.statAsync=t.statAsync?t.statAsync:async t=>new Promise(((i,o)=>r.stat(t,((t,r)=>t?o(t):i(r)))));t.statSync=t.statSync||i.statSync||Ue.statSync;t.mkdirSync=t.mkdirSync||i.mkdirSync||Ue.mkdirSync;return r};const mkdirp_manual_mkdirpManualSync=(t,r,i)=>{const o=(0,Jt.dirname)(t);const a={...optsArg(r),recursive:false};if(o===t){try{return a.mkdirSync(t,a)}catch(t){const r=t;if(r&&r.code!=="EISDIR"){throw t}return}}try{a.mkdirSync(t,a);return i||t}catch(r){const c=r;if(c&&c.code==="ENOENT"){return mkdirp_manual_mkdirpManualSync(t,a,mkdirp_manual_mkdirpManualSync(o,a,i))}if(c&&c.code!=="EEXIST"&&c&&c.code!=="EROFS"){throw r}try{if(!a.statSync(t).isDirectory())throw r}catch(t){throw r}}};const Js=Object.assign((async(t,r,i)=>{const o=optsArg(r);o.recursive=false;const a=(0,Jt.dirname)(t);if(a===t){return o.mkdirAsync(t,o).catch((t=>{const r=t;if(r&&r.code!=="EISDIR"){throw t}}))}return o.mkdirAsync(t,o).then((()=>i||t),(async r=>{const c=r;if(c&&c.code==="ENOENT"){return Js(a,o).then((r=>Js(t,o,r)))}if(c&&c.code!=="EEXIST"&&c.code!=="EROFS"){throw r}return o.statAsync(t).then((t=>{if(t.isDirectory()){return i}else{throw r}}),(()=>{throw r}))}))}),{sync:mkdirp_manual_mkdirpManualSync});const findMade=async(t,r,i)=>{if(i===r){return}return t.statAsync(r).then((t=>t.isDirectory()?i:undefined),(i=>{const o=i;return o&&o.code==="ENOENT"?findMade(t,(0,Jt.dirname)(r),r):undefined}))};const findMadeSync=(t,r,i)=>{if(i===r){return undefined}try{return t.statSync(r).isDirectory()?i:undefined}catch(i){const o=i;return o&&o.code==="ENOENT"?findMadeSync(t,(0,Jt.dirname)(r),r):undefined}};const mkdirp_native_mkdirpNativeSync=(t,r)=>{const i=optsArg(r);i.recursive=true;const o=(0,Jt.dirname)(t);if(o===t){return i.mkdirSync(t,i)}const a=findMadeSync(i,t);try{i.mkdirSync(t,i);return a}catch(r){const o=r;if(o&&o.code==="ENOENT"){return mkdirp_manual_mkdirpManualSync(t,i)}else{throw r}}};const Qs=Object.assign((async(t,r)=>{const i={...optsArg(r),recursive:true};const o=(0,Jt.dirname)(t);if(o===t){return await i.mkdirAsync(t,i)}return findMade(i,t).then((r=>i.mkdirAsync(t,i).then((t=>r||t)).catch((r=>{const o=r;if(o&&o.code==="ENOENT"){return Js(t,i)}else{throw r}}))))}),{sync:mkdirp_native_mkdirpNativeSync});const en=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform;const pathArg=t=>{if(/\0/.test(t)){throw Object.assign(new TypeError("path must be a string without null bytes"),{path:t,code:"ERR_INVALID_ARG_VALUE"})}t=(0,Jt.resolve)(t);if(en==="win32"){const r=/[*|"<>?:]/;const{root:i}=(0,Jt.parse)(t);if(r.test(t.substring(i.length))){throw Object.assign(new Error("Illegal characters in path."),{path:t,code:"EINVAL"})}}return t};const tn=process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version;const rn=tn.replace(/^v/,"").split(".");const sn=+rn[0]>10||+rn[0]===10&&+rn[1]>=12;const nn=!sn?()=>false:t=>optsArg(t).mkdirSync===Ue.mkdirSync;const on=Object.assign(!sn?()=>false:t=>optsArg(t).mkdir===Ue.mkdir,{sync:nn});const mkdirpSync=(t,r)=>{t=pathArg(t);const i=optsArg(r);return nn(i)?mkdirp_native_mkdirpNativeSync(t,i):mkdirp_manual_mkdirpManualSync(t,i)};const an=null&&mkdirpSync;const cn=null&&mkdirpManual;const ln=null&&mkdirpManualSync;const un=null&&mkdirpNative;const hn=null&&mkdirpNativeSync;const dn=Object.assign((async(t,r)=>{t=pathArg(t);const i=optsArg(r);return on(i)?Qs(t,i):Js(t,i)}),{mkdirpSync:mkdirpSync,mkdirpNative:Qs,mkdirpNativeSync:mkdirp_native_mkdirpNativeSync,mkdirpManual:Js,mkdirpManualSync:mkdirp_manual_mkdirpManualSync,sync:mkdirpSync,native:Qs,nativeSync:mkdirp_native_mkdirpNativeSync,manual:Js,manualSync:mkdirp_manual_mkdirpManualSync,useNative:on,useNativeSync:nn});class CwdError extends Error{path;code;syscall="chdir";constructor(t,r){super(`${r}: Cannot cd into '${t}'`);this.path=t;this.code=r}get name(){return"CwdError"}}class SymlinkError extends Error{path;symlink;syscall="symlink";code="TAR_SYMLINK_ERROR";constructor(t,r){super("TAR_SYMLINK_ERROR: Cannot extract through symbolic link");this.symlink=t;this.path=r}get name(){return"SymlinkError"}}const cGet=(t,r)=>t.get(pr(r));const cSet=(t,r,i)=>t.set(pr(r),i);const checkCwd=(t,r)=>{Ue.stat(t,((i,o)=>{if(i||!o.isDirectory()){i=new CwdError(t,i?.code||"ENOTDIR")}r(i)}))};const mkdir=(t,i,o)=>{t=pr(t);const a=i.umask??18;const c=i.mode|448;const l=(c&a)!==0;const u=i.uid;const h=i.gid;const d=typeof u==="number"&&typeof h==="number"&&(u!==i.processUid||h!==i.processGid);const p=i.preserve;const m=i.unlink;const g=i.cache;const y=pr(i.cwd);const done=(r,i)=>{if(r){o(r)}else{cSet(g,t,true);if(i&&d){chownr(i,u,h,(t=>done(t)))}else if(l){Ue.chmod(t,c,o)}else{o()}}};if(g&&cGet(g,t)===true){return done()}if(t===y){return checkCwd(t,done)}if(p){return dn(t,{mode:c}).then((t=>done(null,t??undefined)),done)}const v=pr(r.relative(y,t));const b=v.split("/");mkdir_(y,b,c,g,m,y,undefined,done)};const mkdir_=(t,i,o,a,c,l,u,h)=>{if(!i.length){return h(null,u)}const d=i.shift();const p=pr(r.resolve(t+"/"+d));if(cGet(a,p)){return mkdir_(p,i,o,a,c,l,u,h)}Ue.mkdir(p,o,onmkdir(p,i,o,a,c,l,u,h))};const onmkdir=(t,r,i,o,a,c,l,u)=>h=>{if(h){Ue.lstat(t,((d,p)=>{if(d){d.path=d.path&&pr(d.path);u(d)}else if(p.isDirectory()){mkdir_(t,r,i,o,a,c,l,u)}else if(a){Ue.unlink(t,(h=>{if(h){return u(h)}Ue.mkdir(t,i,onmkdir(t,r,i,o,a,c,l,u))}))}else if(p.isSymbolicLink()){return u(new SymlinkError(t,t+"/"+r.join("/")))}else{u(h)}}))}else{l=l||t;mkdir_(t,r,i,o,a,c,l,u)}};const checkCwdSync=t=>{let r=false;let i=undefined;try{r=Ue.statSync(t).isDirectory()}catch(t){i=t?.code}finally{if(!r){throw new CwdError(t,i??"ENOTDIR")}}};const mkdirSync=(t,i)=>{t=pr(t);const o=i.umask??18;const a=i.mode|448;const c=(a&o)!==0;const l=i.uid;const u=i.gid;const h=typeof l==="number"&&typeof u==="number"&&(l!==i.processUid||u!==i.processGid);const d=i.preserve;const p=i.unlink;const m=i.cache;const g=pr(i.cwd);const done=r=>{cSet(m,t,true);if(r&&h){chownrSync(r,l,u)}if(c){Ue.chmodSync(t,a)}};if(m&&cGet(m,t)===true){return done()}if(t===g){checkCwdSync(g);return done()}if(d){return done(mkdirpSync(t,a)??undefined)}const y=pr(r.relative(g,t));const v=y.split("/");let b=undefined;for(let t=v.shift(),i=g;t&&(i+="/"+t);t=v.shift()){i=pr(r.resolve(i));if(cGet(m,i)){continue}try{Ue.mkdirSync(i,a);b=b||i;cSet(m,i,true)}catch(t){const r=Ue.lstatSync(i);if(r.isDirectory()){cSet(m,i,true);continue}else if(p){Ue.unlinkSync(i);Ue.mkdirSync(i,a);b=b||i;cSet(m,i,true);continue}else if(r.isSymbolicLink()){return new SymlinkError(i,i+"/"+v.join("/"))}}}return done(b)};const fn=Object.create(null);const{hasOwnProperty:pn}=Object.prototype;const normalizeUnicode=t=>{if(!pn.call(fn,t)){fn[t]=t.normalize("NFD")}return fn[t]};const mn=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform;const gn=mn==="win32";const getDirs=t=>{const i=t.split("/").slice(0,-1).reduce(((t,i)=>{const o=t[t.length-1];if(o!==undefined){i=(0,r.join)(o,i)}t.push(i||"/");return t}),[]);return i};class PathReservations{#y=new Map;#v=new Map;#_=new Set;reserve(t,i){t=gn?["win32 parallelization disabled"]:t.map((t=>stripTrailingSlashes((0,r.join)(normalizeUnicode(t))).toLowerCase()));const o=new Set(t.map((t=>getDirs(t))).reduce(((t,r)=>t.concat(r))));this.#v.set(i,{dirs:o,paths:t});for(const r of t){const t=this.#y.get(r);if(!t){this.#y.set(r,[i])}else{t.push(i)}}for(const t of o){const r=this.#y.get(t);if(!r){this.#y.set(t,[new Set([i])])}else{const t=r[r.length-1];if(t instanceof Set){t.add(i)}else{r.push(new Set([i]))}}}return this.#b(i)}#w(t){const r=this.#v.get(t);if(!r){throw new Error("function does not have any path reservations")}return{paths:r.paths.map((t=>this.#y.get(t))),dirs:[...r.dirs].map((t=>this.#y.get(t)))}}check(t){const{paths:r,dirs:i}=this.#w(t);return r.every((r=>r&&r[0]===t))&&i.every((r=>r&&r[0]instanceof Set&&r[0].has(t)))}#b(t){if(this.#_.has(t)||!this.check(t)){return false}this.#_.add(t);t((()=>this.#E(t)));return true}#E(t){if(!this.#_.has(t)){return false}const r=this.#v.get(t);if(!r){throw new Error("invalid reservation")}const{paths:i,dirs:o}=r;const a=new Set;for(const r of i){const i=this.#y.get(r);if(!i||i?.[0]!==t){continue}const o=i[1];if(!o){this.#y.delete(r);continue}i.shift();if(typeof o==="function"){a.add(o)}else{for(const t of o){a.add(t)}}}for(const r of o){const i=this.#y.get(r);const o=i?.[0];if(!i||!(o instanceof Set))continue;if(o.size===1&&i.length===1){this.#y.delete(r);continue}else if(o.size===1){i.shift();const t=i[0];if(typeof t==="function"){a.add(t)}}else{o.delete(t)}}this.#_.delete(t);a.forEach((t=>this.#b(t)));return true}}const yn=Symbol("onEntry");const vn=Symbol("checkFs");const _n=Symbol("checkFs2");const bn=Symbol("pruneCache");const wn=Symbol("isReusable");const En=Symbol("makeFs");const Sn=Symbol("file");const $n=Symbol("directory");const Rn=Symbol("link");const Pn=Symbol("symlink");const On=Symbol("hardlink");const An=Symbol("unsupported");const xn=Symbol("checkPath");const Tn=Symbol("mkdir");const kn=Symbol("onError");const Cn=Symbol("pending");const In=Symbol("pend");const Nn=Symbol("unpend");const Dn=Symbol("ended");const Ln=Symbol("maybeClose");const Mn=Symbol("skip");const jn=Symbol("doChown");const Fn=Symbol("uid");const Un=Symbol("gid");const Bn=Symbol("checkedCwd");const Hn=process.env.TESTING_TAR_FAKE_PLATFORM||process.platform;const Vn=Hn==="win32";const zn=1024;const unlinkFile=(r,i)=>{if(!Vn){return t.unlink(r,i)}const o=r+".DELETE."+(0,$.randomBytes)(16).toString("hex");t.rename(r,o,(r=>{if(r){return i(r)}t.unlink(o,i)}))};const unlinkFileSync=r=>{if(!Vn){return t.unlinkSync(r)}const i=r+".DELETE."+(0,$.randomBytes)(16).toString("hex");t.renameSync(r,i);t.unlinkSync(i)};const uint32=(t,r,i)=>t!==undefined&&t===t>>>0?t:r!==undefined&&r===r>>>0?r:i;const cacheKeyNormalize=t=>stripTrailingSlashes(pr(normalizeUnicode(t))).toLowerCase();const pruneCache=(t,r)=>{r=cacheKeyNormalize(r);for(const i of t.keys()){const o=cacheKeyNormalize(i);if(o===r||o.indexOf(r+"/")===0){t.delete(i)}}};const dropCache=t=>{for(const r of t.keys()){t.delete(r)}};class Unpack extends Parser{[Dn]=false;[Bn]=false;[Cn]=0;reservations=new PathReservations;transform;writable=true;readable=false;dirCache;uid;gid;setOwner;preserveOwner;processGid;processUid;maxDepth;forceChown;win32;newer;keep;noMtime;preservePaths;unlink;cwd;strip;processUmask;umask;dmode;fmode;chmod;constructor(t={}){t.ondone=()=>{this[Dn]=true;this[Ln]()};super(t);this.transform=t.transform;this.dirCache=t.dirCache||new Map;this.chmod=!!t.chmod;if(typeof t.uid==="number"||typeof t.gid==="number"){if(typeof t.uid!=="number"||typeof t.gid!=="number"){throw new TypeError("cannot set owner without number uid and gid")}if(t.preserveOwner){throw new TypeError("cannot preserve owner in archive and also set owner explicitly")}this.uid=t.uid;this.gid=t.gid;this.setOwner=true}else{this.uid=undefined;this.gid=undefined;this.setOwner=false}if(t.preserveOwner===undefined&&typeof t.uid!=="number"){this.preserveOwner=!!(process.getuid&&process.getuid()===0)}else{this.preserveOwner=!!t.preserveOwner}this.processUid=(this.preserveOwner||this.setOwner)&&process.getuid?process.getuid():undefined;this.processGid=(this.preserveOwner||this.setOwner)&&process.getgid?process.getgid():undefined;this.maxDepth=typeof t.maxDepth==="number"?t.maxDepth:zn;this.forceChown=t.forceChown===true;this.win32=!!t.win32||Vn;this.newer=!!t.newer;this.keep=!!t.keep;this.noMtime=!!t.noMtime;this.preservePaths=!!t.preservePaths;this.unlink=!!t.unlink;this.cwd=pr(r.resolve(t.cwd||process.cwd()));this.strip=Number(t.strip)||0;this.processUmask=!this.chmod?0:typeof t.processUmask==="number"?t.processUmask:process.umask();this.umask=typeof t.umask==="number"?t.umask:this.processUmask;this.dmode=t.dmode||511&~this.umask;this.fmode=t.fmode||438&~this.umask;this.on("entry",(t=>this[yn](t)))}warn(t,r,i={}){if(t==="TAR_BAD_ARCHIVE"||t==="TAR_ABORT"){i.recoverable=false}return super.warn(t,r,i)}[Ln](){if(this[Dn]&&this[Cn]===0){this.emit("prefinish");this.emit("finish");this.emit("end")}}[xn](t){const i=pr(t.path);const o=i.split("/");if(this.strip){if(o.length<this.strip){return false}if(t.type==="Link"){const r=pr(String(t.linkpath)).split("/");if(r.length>=this.strip){t.linkpath=r.slice(this.strip).join("/")}else{return false}}o.splice(0,this.strip);t.path=o.join("/")}if(isFinite(this.maxDepth)&&o.length>this.maxDepth){this.warn("TAR_ENTRY_ERROR","path excessively deep",{entry:t,path:i,depth:o.length,maxDepth:this.maxDepth});return false}if(!this.preservePaths){if(o.includes("..")||Vn&&/^[a-z]:\.\.$/i.test(o[0]??"")){this.warn("TAR_ENTRY_ERROR",`path contains '..'`,{entry:t,path:i});return false}const[r,a]=stripAbsolutePath(i);if(r){t.path=String(a);this.warn("TAR_ENTRY_INFO",`stripping ${r} from absolute path`,{entry:t,path:i})}}if(r.isAbsolute(t.path)){t.absolute=pr(r.resolve(t.path))}else{t.absolute=pr(r.resolve(this.cwd,t.path))}if(!this.preservePaths&&typeof t.absolute==="string"&&t.absolute.indexOf(this.cwd+"/")!==0&&t.absolute!==this.cwd){this.warn("TAR_ENTRY_ERROR","path escaped extraction target",{entry:t,path:pr(t.path),resolvedPath:t.absolute,cwd:this.cwd});return false}if(t.absolute===this.cwd&&t.type!=="Directory"&&t.type!=="GNUDumpDir"){return false}if(this.win32){const{root:i}=r.win32.parse(String(t.absolute));t.absolute=i+winchars_encode(String(t.absolute).slice(i.length));const{root:o}=r.win32.parse(t.path);t.path=o+winchars_encode(t.path.slice(o.length))}return true}[yn](t){if(!this[xn](t)){return t.resume()}R.equal(typeof t.absolute,"string");switch(t.type){case"Directory":case"GNUDumpDir":if(t.mode){t.mode=t.mode|448}case"File":case"OldFile":case"ContiguousFile":case"Link":case"SymbolicLink":return this[vn](t);case"CharacterDevice":case"BlockDevice":case"FIFO":default:return this[An](t)}}[kn](t,r){if(t.name==="CwdError"){this.emit("error",t)}else{this.warn("TAR_ENTRY_ERROR",t,{entry:r});this[Nn]();r.resume()}}[Tn](t,r,i){mkdir(pr(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:r},i)}[jn](t){return this.forceChown||this.preserveOwner&&(typeof t.uid==="number"&&t.uid!==this.processUid||typeof t.gid==="number"&&t.gid!==this.processGid)||typeof this.uid==="number"&&this.uid!==this.processUid||typeof this.gid==="number"&&this.gid!==this.processGid}[Fn](t){return uint32(this.uid,t.uid,this.processUid)}[Un](t){return uint32(this.gid,t.gid,this.processGid)}[Sn](r,i){const o=typeof r.mode==="number"?r.mode&4095:this.fmode;const a=new WriteStream(String(r.absolute),{flags:Xs(r.size),mode:o,autoClose:false});a.on("error",(o=>{if(a.fd){t.close(a.fd,(()=>{}))}a.write=()=>true;this[kn](o,r);i()}));let c=1;const done=o=>{if(o){if(a.fd){t.close(a.fd,(()=>{}))}this[kn](o,r);i();return}if(--c===0){if(a.fd!==undefined){t.close(a.fd,(t=>{if(t){this[kn](t,r)}else{this[Nn]()}i()}))}}};a.on("finish",(()=>{const i=String(r.absolute);const o=a.fd;if(typeof o==="number"&&r.mtime&&!this.noMtime){c++;const a=r.atime||new Date;const l=r.mtime;t.futimes(o,a,l,(r=>r?t.utimes(i,a,l,(t=>done(t&&r))):done()))}if(typeof o==="number"&&this[jn](r)){c++;const a=this[Fn](r);const l=this[Un](r);if(typeof a==="number"&&typeof l==="number"){t.fchown(o,a,l,(r=>r?t.chown(i,a,l,(t=>done(t&&r))):done()))}}done()}));const l=this.transform?this.transform(r)||r:r;if(l!==r){l.on("error",(t=>{this[kn](t,r);i()}));r.pipe(l)}l.pipe(a)}[$n](r,i){const o=typeof r.mode==="number"?r.mode&4095:this.dmode;this[Tn](String(r.absolute),o,(o=>{if(o){this[kn](o,r);i();return}let a=1;const done=()=>{if(--a===0){i();this[Nn]();r.resume()}};if(r.mtime&&!this.noMtime){a++;t.utimes(String(r.absolute),r.atime||new Date,r.mtime,done)}if(this[jn](r)){a++;t.chown(String(r.absolute),Number(this[Fn](r)),Number(this[Un](r)),done)}done()}))}[An](t){t.unsupported=true;this.warn("TAR_ENTRY_UNSUPPORTED",`unsupported entry type: ${t.type}`,{entry:t});t.resume()}[Pn](t,r){this[Rn](t,String(t.linkpath),"symlink",r)}[On](t,i){const o=pr(r.resolve(this.cwd,String(t.linkpath)));this[Rn](t,o,"link",i)}[In](){this[Cn]++}[Nn](){this[Cn]--;this[Ln]()}[Mn](t){this[Nn]();t.resume()}[wn](t,r){return t.type==="File"&&!this.unlink&&r.isFile()&&r.nlink<=1&&!Vn}[vn](t){this[In]();const r=[t.path];if(t.linkpath){r.push(t.linkpath)}this.reservations.reserve(r,(r=>this[_n](t,r)))}[bn](t){if(t.type==="SymbolicLink"){dropCache(this.dirCache)}else if(t.type!=="Directory"){pruneCache(this.dirCache,String(t.absolute))}}[_n](i,o){this[bn](i);const done=t=>{this[bn](i);o(t)};const checkCwd=()=>{this[Tn](this.cwd,this.dmode,(t=>{if(t){this[kn](t,i);done();return}this[Bn]=true;start()}))};const start=()=>{if(i.absolute!==this.cwd){const t=pr(r.dirname(String(i.absolute)));if(t!==this.cwd){return this[Tn](t,this.dmode,(t=>{if(t){this[kn](t,i);done();return}afterMakeParent()}))}}afterMakeParent()};const afterMakeParent=()=>{t.lstat(String(i.absolute),((r,o)=>{if(o&&(this.keep||this.newer&&o.mtime>(i.mtime??o.mtime))){this[Mn](i);done();return}if(r||this[wn](i,o)){return this[En](null,i,done)}if(o.isDirectory()){if(i.type==="Directory"){const r=this.chmod&&i.mode&&(o.mode&4095)!==i.mode;const afterChmod=t=>this[En](t??null,i,done);if(!r){return afterChmod()}return t.chmod(String(i.absolute),Number(i.mode),afterChmod)}if(i.absolute!==this.cwd){return t.rmdir(String(i.absolute),(t=>this[En](t??null,i,done)))}}if(i.absolute===this.cwd){return this[En](null,i,done)}unlinkFile(String(i.absolute),(t=>this[En](t??null,i,done)))}))};if(this[Bn]){start()}else{checkCwd()}}[En](t,r,i){if(t){this[kn](t,r);i();return}switch(r.type){case"File":case"OldFile":case"ContiguousFile":return this[Sn](r,i);case"Link":return this[On](r,i);case"SymbolicLink":return this[Pn](r,i);case"Directory":case"GNUDumpDir":return this[$n](r,i)}}[Rn](r,i,o,a){t[o](i,String(r.absolute),(t=>{if(t){this[kn](t,r)}else{this[Nn]();r.resume()}a()}))}}const callSync=t=>{try{return[null,t()]}catch(t){return[t,null]}};class UnpackSync extends Unpack{sync=true;[En](t,r){return super[En](t,r,(()=>{}))}[vn](i){this[bn](i);if(!this[Bn]){const t=this[Tn](this.cwd,this.dmode);if(t){return this[kn](t,i)}this[Bn]=true}if(i.absolute!==this.cwd){const t=pr(r.dirname(String(i.absolute)));if(t!==this.cwd){const r=this[Tn](t,this.dmode);if(r){return this[kn](r,i)}}}const[o,a]=callSync((()=>t.lstatSync(String(i.absolute))));if(a&&(this.keep||this.newer&&a.mtime>(i.mtime??a.mtime))){return this[Mn](i)}if(o||this[wn](i,a)){return this[En](null,i)}if(a.isDirectory()){if(i.type==="Directory"){const r=this.chmod&&i.mode&&(a.mode&4095)!==i.mode;const[o]=r?callSync((()=>{t.chmodSync(String(i.absolute),Number(i.mode))})):[];return this[En](o,i)}const[r]=callSync((()=>t.rmdirSync(String(i.absolute))));this[En](r,i)}const[c]=i.absolute===this.cwd?[]:callSync((()=>unlinkFileSync(String(i.absolute))));this[En](c,i)}[Sn](r,i){const o=typeof r.mode==="number"?r.mode&4095:this.fmode;const oner=o=>{let c;try{t.closeSync(a)}catch(t){c=t}if(o||c){this[kn](o||c,r)}i()};let a;try{a=t.openSync(String(r.absolute),Xs(r.size),o)}catch(t){return oner(t)}const c=this.transform?this.transform(r)||r:r;if(c!==r){c.on("error",(t=>this[kn](t,r)));r.pipe(c)}c.on("data",(r=>{try{t.writeSync(a,r,0,r.length)}catch(t){oner(t)}}));c.on("end",(()=>{let i=null;if(r.mtime&&!this.noMtime){const o=r.atime||new Date;const c=r.mtime;try{t.futimesSync(a,o,c)}catch(a){try{t.utimesSync(String(r.absolute),o,c)}catch(t){i=a}}}if(this[jn](r)){const o=this[Fn](r);const c=this[Un](r);try{t.fchownSync(a,Number(o),Number(c))}catch(a){try{t.chownSync(String(r.absolute),Number(o),Number(c))}catch(t){i=i||a}}}oner(i)}))}[$n](r,i){const o=typeof r.mode==="number"?r.mode&4095:this.dmode;const a=this[Tn](String(r.absolute),o);if(a){this[kn](a,r);i();return}if(r.mtime&&!this.noMtime){try{t.utimesSync(String(r.absolute),r.atime||new Date,r.mtime)}catch(a){}}if(this[jn](r)){try{t.chownSync(String(r.absolute),Number(this[Fn](r)),Number(this[Un](r)))}catch(a){}}i();r.resume()}[Tn](t,r){try{return mkdirSync(pr(t),{uid:this.uid,gid:this.gid,processUid:this.processUid,processGid:this.processGid,umask:this.processUmask,preserve:this.preservePaths,unlink:this.unlink,cache:this.dirCache,cwd:this.cwd,mode:r})}catch(t){return t}}[Rn](r,i,o,a){const c=`${o}Sync`;try{t[c](i,String(r.absolute));a();r.resume()}catch(t){return this[kn](t,r)}}}const extractFileSync=r=>{const i=new UnpackSync(r);const o=r.file;const a=t.statSync(o);const c=r.maxReadSize||16*1024*1024;const l=new ReadStreamSync(o,{readSize:c,size:a.size});l.pipe(i)};const extractFile=(r,i)=>{const o=new Unpack(r);const a=r.maxReadSize||16*1024*1024;const c=r.file;const l=new Promise(((r,i)=>{o.on("error",i);o.on("close",r);t.stat(c,((t,r)=>{if(t){i(t)}else{const t=new ReadStream(c,{readSize:a,size:r.size});t.on("error",i);t.pipe(o)}}))}));return l};const Gn=makeCommand(extractFileSync,extractFile,(t=>new UnpackSync(t)),(t=>new Unpack(t)),((t,r)=>{if(r?.length)filesFilter(t,r)}));const replaceSync=(r,i)=>{const o=new PackSync(r);let a=true;let c;let l;try{try{c=t.openSync(r.file,"r+")}catch(i){if(i?.code==="ENOENT"){c=t.openSync(r.file,"w+")}else{throw i}}const u=t.fstatSync(c);const h=Buffer.alloc(512);e:for(l=0;l<u.size;l+=512){for(let r=0,i=0;r<512;r+=i){i=t.readSync(c,h,r,h.length-r,l+r);if(l===0&&h[0]===31&&h[1]===139){throw new Error("cannot append to compressed archives")}if(!i){break e}}const i=new Header(h);if(!i.cksumValid){break}const o=512*Math.ceil((i.size||0)/512);if(l+o+512>u.size){break}l+=o;if(r.mtimeCache&&i.mtime){r.mtimeCache.set(String(i.path),i.mtime)}}a=false;streamSync(r,o,l,c,i)}finally{if(a){try{t.closeSync(c)}catch(t){}}}};const streamSync=(t,r,i,o,a)=>{const c=new WriteStreamSync(t.file,{fd:o,start:i});r.pipe(c);replace_addFilesSync(r,a)};const replaceAsync=(r,i)=>{i=Array.from(i);const o=new Pack(r);const getPos=(i,o,a)=>{const cb=(r,o)=>{if(r){t.close(i,(t=>a(r)))}else{a(null,o)}};let c=0;if(o===0){return cb(null,0)}let l=0;const u=Buffer.alloc(512);const onread=(a,h)=>{if(a||typeof h==="undefined"){return cb(a)}l+=h;if(l<512&&h){return t.read(i,u,l,u.length-l,c+l,onread)}if(c===0&&u[0]===31&&u[1]===139){return cb(new Error("cannot append to compressed archives"))}if(l<512){return cb(null,c)}const d=new Header(u);if(!d.cksumValid){return cb(null,c)}const p=512*Math.ceil((d.size??0)/512);if(c+p+512>o){return cb(null,c)}c+=p+512;if(c>=o){return cb(null,c)}if(r.mtimeCache&&d.mtime){r.mtimeCache.set(String(d.path),d.mtime)}l=0;t.read(i,u,0,512,c,onread)};t.read(i,u,0,512,c,onread)};const a=new Promise(((a,c)=>{o.on("error",c);let l="r+";const onopen=(u,h)=>{if(u&&u.code==="ENOENT"&&l==="r+"){l="w+";return t.open(r.file,l,onopen)}if(u||!h){return c(u)}t.fstat(h,((l,u)=>{if(l){return t.close(h,(()=>c(l)))}getPos(h,u.size,((t,l)=>{if(t){return c(t)}const u=new WriteStream(r.file,{fd:h,start:l});o.pipe(u);u.on("error",c);u.on("close",a);replace_addFilesAsync(o,i)}))}))};t.open(r.file,l,onopen)}));return a};const replace_addFilesSync=(t,i)=>{i.forEach((i=>{if(i.charAt(0)==="@"){Wr({file:r.resolve(t.cwd,i.slice(1)),sync:true,noResume:true,onReadEntry:r=>t.add(r)})}else{t.add(i)}}));t.end()};const replace_addFilesAsync=async(t,i)=>{for(let o=0;o<i.length;o++){const a=String(i[o]);if(a.charAt(0)==="@"){await Wr({file:r.resolve(String(t.cwd),a.slice(1)),noResume:true,onReadEntry:r=>t.add(r)})}else{t.add(a)}}t.end()};const qn=makeCommand(replaceSync,replaceAsync,(()=>{throw new TypeError("file is required")}),(()=>{throw new TypeError("file is required")}),((t,r)=>{if(!isFile(t)){throw new TypeError("file is required")}if(t.gzip||t.brotli||t.file.endsWith(".br")||t.file.endsWith(".tbr")){throw new TypeError("cannot append to compressed archives")}if(!r?.length){throw new TypeError("no paths specified to add/replace")}}));const Wn=makeCommand(qn.syncFile,qn.asyncFile,qn.syncNoFile,qn.asyncNoFile,((t,r=[])=>{qn.validate?.(t,r);mtimeFilter(t)}));const mtimeFilter=t=>{const r=t.filter;if(!t.mtimeCache){t.mtimeCache=new Map}t.filter=r?(i,o)=>r(i,o)&&!((t.mtimeCache?.get(i)??o.mtime??0)>(o.mtime??0)):(r,i)=>!((t.mtimeCache?.get(r)??i.mtime??0)>(i.mtime??0))};async function isUrlOk(t){try{const r=await fetch(t,{method:"HEAD"});return r.status===200}catch{return false}}async function getRepoInfo(t,r){const[,i,o,a,c,...l]=t.pathname.split("/");const u=r?r.replace(/^\//,""):l.join("/");if(a===undefined||a===""&&c===undefined){try{const t=await fetch(`https://api.github.com/repos/${i}/${o}`);if(t.status!==200){return}const r=await t.json();return{username:i,name:o,branch:r["default_branch"],filePath:u}}catch{return}}const h=r?`${c}/${l.join("/")}`.replace(new RegExp(`/${u}|/$`),""):c;if(i&&o&&h&&a==="tree"){return{username:i,name:o,branch:h,filePath:u}}}function hasRepo({username:t,name:r,branch:i,filePath:o}){const a=`https://api.github.com/repos/${t}/${r}/contents`;const c=`${o?`/${o}`:""}/package.json`;return isUrlOk(`${a+c}?ref=${i}`)}function existsInRepo(t){try{const r=new URL(t);return isUrlOk(r.href)}catch{return isUrlOk(`https://api.github.com/repos/zuplo/zuplo/contents/examples/${encodeURIComponent(t)}`)}}async function downloadTarStream(t,r=50*1024*1024){const i=await fetch(t);if(!i.body){throw new Error(`Failed to download: ${t}`)}const o=i.headers.get("content-length");if(o&&parseInt(o,10)>r){throw new Error(`File too large! ${o} bytes exceeds limit of ${r} bytes`)}const a=i.body;const c=Me.Readable.fromWeb(a);let l=0;const u=new Me.Transform({transform(t,i,o){l+=t.length;if(l>r){return o(new Error(`Download aborted! File size exceeded ${r} bytes`))}o(null,t)}});return c.pipe(u)}async function downloadAndExtractRepo(t,{username:i,name:o,branch:a,filePath:c}){let l=null;await(0,je.pipeline)(await downloadTarStream(`https://codeload.github.com/${i}/${o}/tar.gz/${a}`),Gn({cwd:t,strip:c?c.split("/").length+1:1,filter:t=>{if(l===null){const i=t.split(r.sep);l=i.length?i[0]:null}return t.startsWith(`${l}${c?`/${c}/`:"/"}`)}}))}async function downloadAndExtractExample(t,r){if(r==="__internal-testing-retry"){throw new Error("This is an internal example for testing the CLI.")}await(0,je.pipeline)(await downloadTarStream("https://codeload.github.com/zuplo/zuplo/tar.gz/main"),Gn({cwd:t,strip:2+r.split("/").length,filter:t=>t.includes(`zuplo-main/examples/${r}/`)}))}var Kn=__nccwpck_require__(1421);function isInGitRepository(){try{(0,Kn.execSync)("git rev-parse --is-inside-work-tree",{stdio:"ignore"});return true}catch{}return false}function isInMercurialRepository(){try{(0,Kn.execSync)("hg --cwd . root",{stdio:"ignore"});return true}catch{}return false}function isDefaultBranchSet(){try{(0,Kn.execSync)("git config init.defaultBranch",{stdio:"ignore"});return true}catch{}return false}function tryGitInit(i){let o=false;try{(0,Kn.execSync)("git --version",{stdio:"ignore"});if(isInGitRepository()||isInMercurialRepository()){return false}(0,Kn.execSync)("git init",{stdio:"ignore"});o=true;if(!isDefaultBranchSet()){(0,Kn.execSync)("git checkout -b main",{stdio:"ignore"})}(0,Kn.execSync)("git add -A",{stdio:"ignore"});(0,Kn.execSync)('git commit -m "Initial commit from Create Next App"',{stdio:"ignore"});return true}catch{if(o){try{(0,t.rmSync)((0,r.join)(i,".git"),{recursive:true,force:true})}catch{}}return false}}var Yn=__nccwpck_require__(4422);var Zn=__nccwpck_require__.n(Yn);async function install(t,r){const i=["install"];if(!r){console.log((0,Te.yellow)("You appear to be offline.\nFalling back to the local cache."));i.push("--offline")}return new Promise(((r,o)=>{const a=Zn()(t,i,{stdio:"inherit",env:{...process.env,ADBLOCK:"1",NODE_ENV:"development",DISABLE_OPENCOLLECTIVE:"1"}});a.on("close",(a=>{if(a!==0){o({command:`${t} ${i.join(" ")}`});return}r()}))}))}function isFolderEmpty(i,o){const a=[".DS_Store",".git",".gitattributes",".gitignore",".gitlab-ci.yml",".hg",".hgcheck",".hgignore",".idea",".npmignore",".travis.yml","LICENSE","Thumbs.db","docs","mkdocs.yml","npm-debug.log","yarn-debug.log","yarn-error.log","yarnrc.yml",".yarn"];const c=(0,t.readdirSync)(i).filter((t=>!a.includes(t)&&!/\.iml$/.test(t)));if(c.length>0){console.log(`The directory ${(0,Te.green)(o)} contains files that could conflict:`);console.log();for(const o of c){try{const a=(0,t.lstatSync)((0,r.join)(i,o));if(a.isDirectory()){console.log(` ${(0,Te.blue)(o)}/`)}else{console.log(` ${o}`)}}catch{console.log(` ${o}`)}}console.log();console.log("Either try using a new directory name, or remove the files listed above.");console.log();return false}return true}const Xn=require("node:dns/promises");const Jn=require("node:url");var Qn=__nccwpck_require__.n(Jn);function getProxy(){if(process.env.https_proxy){return process.env.https_proxy}try{const t=(0,Kn.execSync)("npm config get https-proxy").toString().trim();return t!=="null"?t:undefined}catch{return}}async function getOnline(){try{await(0,Xn.lookup)("registry.yarnpkg.com");return true}catch{const t=getProxy();if(!t){return false}const{hostname:r}=Qn().parse(t);if(!r){return false}try{await(0,Xn.lookup)(r);return true}catch{return false}}}const ei=require("node:constants");const ti=require("node:fs/promises");var ri=__nccwpck_require__.n(ti);async function isWriteable(t){try{await(0,ti.access)(t,ei.W_OK);return true}catch{return false}}var si=__nccwpck_require__(484);const identity=t=>t;const copy=async(t,i,{cwd:o,rename:a=identity,parents:c=true}={})=>{const l=typeof t==="string"?[t]:t;if(l.length===0||!i){throw new TypeError("`src` and `dest` are required")}const u=await(0,si.async)(l,{cwd:o,dot:true,absolute:false,stats:false});const h=o?(0,r.resolve)(o,i):i;return Promise.all(u.map((async t=>{const i=(0,r.dirname)(t);const l=a((0,r.basename)(t),t);const u=o?(0,r.resolve)(o,t):t;const d=c?(0,r.join)(h,i,l):(0,r.join)(h,l);await(0,ti.mkdir)((0,r.dirname)(d),{recursive:true});return(0,ti.copyFile)(u,d)})))};const getTemplateFile=({template:t,file:r})=>i().join(__dirname,"templates",t,r);const installTemplate=async({appName:r,root:o,packageManager:a,isOnline:c,template:l,eslint:u,prettier:h,installPackages:d,zuploVersion:p})=>{var m;console.log((0,Te.bold)(`Using ${a}.`));console.log("\nInitializing project with template:",l,"\n");const g=i().join(__dirname,"templates",l);const y=["**","!vscode/**"];if(!u)y.push("!eslintrc.json");if(!h)y.push("!prettierrc.json");await copy(y,o,{parents:true,cwd:g,rename(t){switch(t){case"gitignore":case"eslintrc.json":case"prettierrc.json":{return`.${t}`}case"README-template.md":{return"README.md"}default:{return t}}}});const v=["settings.json","launch.json"];for(const r of v){const a=i().join(g,"vscode",r);const c=i().join(o,".vscode",r);if((0,t.existsSync)(a)){await ri().mkdir(i().join(o,".vscode"),{recursive:true});await ri().copyFile(a,c)}}const b=(m=process.env.ZUPLO_PRIVATE_TEST_VERSION)!==null&&m!==void 0?m:p;const w=new ye.SemVer(b);const E={name:r,version:"0.1.0",type:"module",private:true,scripts:{dev:`zuplo dev`,test:"zuplo test",docs:"npm run dev --workspace docs",...u?{lint:"eslint"}:{}},dependencies:{zuplo:`^${w.major}`},devDependencies:{typescript:"^5","@types/node":"^22"}};if(u){E.devDependencies={...E.devDependencies,eslint:"^8","@typescript-eslint/eslint-plugin":"^8","@typescript-eslint/parser":"^8"}}if(h){E.devDependencies={...E.devDependencies,prettier:"^3"}}if(u&&h){E.devDependencies={...E.devDependencies,"eslint-config-prettier":"^9"};const t=i().join(o,".eslintrc.json");const r=await ri().readFile(t,"utf-8").then(JSON.parse);r.extends.push("prettier");await ri().writeFile(t,JSON.stringify(r,null,2)+x().EOL,"utf-8")}E.workspaces=["docs"];const sortObjectKeys=t=>Object.keys(t).sort().reduce(((r,i)=>{r[i]=t[i];return r}),{});if(E.dependencies){E.dependencies=sortObjectKeys(E.dependencies)}if(E.devDependencies){E.devDependencies=sortObjectKeys(E.devDependencies)}const S=Object.keys(E.devDependencies).length;if(!S)delete E.devDependencies;await ri().writeFile(i().join(o,"package.json"),JSON.stringify(E,null,2)+x().EOL);let $="^0.53";try{const t=await fetch("https://api.github.com/repos/zuplo/zudoku/releases/latest");const r=await t.json();const i=r.tag_name.replace("v","");const o=new ye.SemVer(i);$=`^${o.major}.${o.minor}`}catch{console.warn("\nFailed to determine the latest dev portal version. Using the default version.")}const R={name:"docs",version:"0.1.0",type:"module",private:true,scripts:{dev:"zudoku dev --zuplo",build:"zudoku build --zuplo",...u?{lint:"eslint"}:{}},dependencies:{react:"^19","react-dom":"^19","@mdx-js/react":"3.0.1",zudoku:$},devDependencies:{"@types/node":"^22","@types/react":"^19","@types/react-dom":"^19",typescript:"^5"}};await ri().writeFile(i().join(o,"docs","package.json"),JSON.stringify(R,null,2)+x().EOL);if(!d)return;console.log("\nInstalling dependencies:");for(const t in E.dependencies)console.log(`- ${(0,Te.cyan)(t)}`);if(S){console.log("\nInstalling devDependencies:");for(const t in E.devDependencies)console.log(`- ${(0,Te.cyan)(t)}`)}console.log();await install(a,c)};class DownloadError extends Error{}async function createApp({appPath:i,packageManager:o,example:a,examplePath:c,eslint:l,prettier:u,installPackages:h,empty:d,initGit:p,zuploVersion:m}){let g;const y=`default${d?"-empty":""}`;if(a){let O;try{O=new URL(a)}catch(A){const x=A;if(x.code!=="ERR_INVALID_URL"){console.error(A);process.exit(1)}}if(O){if(O.origin!=="https://github.com"){console.error(`Invalid URL: ${(0,Te.red)(`"${a}"`)}. Only GitHub repositories are supported. Please use a GitHub URL and try again.`);process.exit(1)}g=await getRepoInfo(O,c);if(!g){console.error(`Found invalid GitHub URL: ${(0,Te.red)(`"${a}"`)}. Please fix the URL and try again.`);process.exit(1)}const T=await hasRepo(g);if(!T){console.error(`Could not locate the repository for ${(0,Te.red)(`"${a}"`)}. Please check that the repository exists and try again.`);process.exit(1)}}else if(a!=="__internal-testing-retry"){const k=await existsInRepo(a);if(!k){console.error(`Could not locate an example named ${(0,Te.red)(`"${a}"`)}. It could be due to the following:\n`,`1. Your spelling of example ${(0,Te.red)(`"${a}"`)} might be incorrect.\n`,`2. You might not be connected to the internet or you are behind a proxy.`);process.exit(1)}}}const v=(0,r.resolve)(i);if(!await isWriteable((0,r.dirname)(v))){console.error("The application path is not writable, please check folder permissions and try again.");console.error("It is likely you do not have write permissions for this folder.");process.exit(1)}const b=(0,r.basename)(v);(0,t.mkdirSync)(v,{recursive:true});if(!isFolderEmpty(v,b)){process.exit(1)}const w=o==="yarn";const E=!w||await getOnline();const S=process.cwd();console.log(`Creating a new Zuplo API in ${(0,Te.green)(v)}.`);console.log();process.chdir(v);const $=(0,r.join)(v,"package.json");let R=false;if(a){try{if(g){const I=g;console.log(`Downloading files from repo ${(0,Te.cyan)(a)}. This might take a moment.`);console.log();await Le()((()=>downloadAndExtractRepo(v,I)),{retries:3})}else{console.log(`Downloading files for example ${(0,Te.cyan)(a)}. This might take a moment.`);console.log();await Le()((()=>downloadAndExtractExample(v,a)),{retries:3})}}catch(N){function isErrorLike(t){return typeof t==="object"&&t!==null&&typeof t.message==="string"}throw new DownloadError(isErrorLike(N)?N.message:`${N}`)}const C=(0,r.join)(v,".gitignore");if(!(0,t.existsSync)(C)){(0,t.copyFileSync)(getTemplateFile({template:y,file:"gitignore"}),C)}R=(0,t.existsSync)($);if(h&&R){console.log("Installing packages. This might take a couple of minutes.");console.log();await install(o,E);console.log()}}else{await installTemplate({appName:b,root:v,template:y,packageManager:o,isOnline:E,eslint:l,prettier:u,installPackages:h,zuploVersion:m})}if(p){if(tryGitInit(v)){console.log("Initialized a git repository.");console.log()}}let P;if((0,r.join)(S,b)===i){P=b}else{P=i}console.log(`${(0,Te.green)("Success!")} Created ${b} at ${i}`);if(R){console.log("Inside that directory, you can run several commands:");console.log();console.log((0,Te.cyan)(` ${o} ${w?"":"run "}dev`));console.log(" Starts the development server.");console.log();console.log((0,Te.cyan)(` ${o} ${w?"":"run "}build`));console.log(" Builds the app for production.");console.log();console.log((0,Te.cyan)(` ${o} start`));console.log(" Runs the built app in production mode.");console.log();console.log("We suggest that you begin by typing:");console.log();console.log((0,Te.cyan)(" cd"),P);console.log(` ${(0,Te.cyan)(`${o} ${w?"":"run "}dev`)}`)}console.log()}function getPkgManager(){var t;const r=(t=process.env.npm_config_user_agent)!==null&&t!==void 0?t:"";if(r.startsWith("yarn")){return"yarn"}if(r.startsWith("pnpm")){return"pnpm"}if(r.startsWith("bun")){return"bun"}return"npm"}var ni=__nccwpck_require__(2544);var ii=__nccwpck_require__.n(ni);function validateNpmName(t){const r=ii()(t);if(r.validForNewPackages){return{valid:true}}return{valid:false,problems:[...r.errors||[],...r.warnings||[]]}}let oi="";const handleSigTerm=()=>process.exit(0);process.on("SIGINT",handleSigTerm);process.on("SIGTERM",handleSigTerm);const onPromptState=t=>{if(t.aborted){process.stdout.write("[?25h");process.stdout.write("\n");process.exit(1)}};const ai=JSON.parse((0,t.readFileSync)(i().resolve(__dirname,i().join("..","package.json")),"utf-8"));const ci=new y(ai.name).version(ai.version,"-v, --version","Output the current version of create-zuplo-api.").argument("[directory]").usage("[directory] [options]").helpOption("-h, --help","Display this help message.").option("--eslint","Initialize with ESLint config.").option("--prettier","Initialize with Prettier config.").option("--empty","Initialize an empty project.").option("--use-npm","Explicitly tell the CLI to bootstrap the application using npm.").option("--use-pnpm","Explicitly tell the CLI to bootstrap the application using pnpm.").option("--use-yarn","Explicitly tell the CLI to bootstrap the application using Yarn.").option("--use-bun","Explicitly tell the CLI to bootstrap the application using Bun.").option("--reset, --reset-preferences","Reset the preferences saved for create-zuplo-api.").option("--git","Whether or not to initialize the project as a git repo.").option("--version-check","Whether or not to check for an outdated version.").option("--install","Whether or not to install packages.").option("--yes","Use saved preferences or defaults for unprovided options.").option("-e, --example <example-name|github-url>",`\n\n An example to bootstrap the api with. You can use an example name\n from the official Zuplo repo or a public GitHub URL. The URL can use\n any branch and/or subdirectory.\n`).option("--example-path <path-to-example>",`\n\n In a rare case, your GitHub URL might contain a branch name with\n a slash (e.g. bug/fix-1) and the path to the example (e.g. foo/bar).\n In this case, you must specify the path to the example separately:\n --example-path foo/bar\n`).action((t=>{if(t&&!t.startsWith("--no-")){oi=t}})).allowUnknownOption().parse(process.argv);const li=ci.opts();const{args:ui}=ci;const hi=li.useNpm?"npm":li.usePnpm?"pnpm":li.useYarn?"yarn":li.useBun?"bun":getPkgManager();async function run(){var i,o,c;const l=new Conf({projectName:"create-zuplo-api"});if(li.resetPreferences){const{resetPreferences:t}=await Ce()({onState:onPromptState,type:"toggle",name:"resetPreferences",message:"Would you like to reset the saved preferences?",initial:false,active:"Yes",inactive:"No"});if(t){l.clear();console.log("The preferences have been reset successfully!")}process.exit(0)}if(typeof oi==="string"){oi=oi.trim()}if(!oi){const t=await Ce()({onState:onPromptState,type:"text",name:"path",message:"What is your project named?",initial:"my-api",validate:t=>{const i=validateNpmName((0,r.basename)((0,r.resolve)(t)));if(i.valid){return true}return`Invalid project name: ${i.problems[0]}`}});if(typeof t.path==="string"){oi=t.path.trim()}}if(!oi){console.log("\nPlease specify the project directory:\n"+` ${(0,Te.cyan)(li.name())} ${(0,Te.green)("<project-directory>")}\n`+"For example:\n"+` ${(0,Te.cyan)(li.name())} ${(0,Te.green)("my-zuplo-api")}\n\n`+`Run ${(0,Te.cyan)(`${li.name()} --help`)} to see all options.`);process.exit(1)}const u=(0,r.resolve)(oi);const h=(0,r.basename)(u);const d=validateNpmName(h);if(!d.valid){console.error(`Could not create a project called ${(0,Te.red)(`"${h}"`)} because of npm naming restrictions:`);d.problems.forEach((t=>console.error(` ${(0,Te.red)((0,Te.bold)("*"))} ${t}`)));process.exit(1)}if(li.example===true){console.error("Please provide an example name or url, otherwise remove the example option.");process.exit(1)}if((0,t.existsSync)(u)&&!isFolderEmpty(u,h)){process.exit(1)}const p=typeof li.example==="string"&&li.example.trim();const m=l.get("preferences")||{};const g=a().isCI||li.yes;if(!p){const t={eslint:true,prettier:true,git:true,install:true,versionCheck:true,empty:false,zudoku:false};const getPrefOrDefault=r=>{var i;return(i=m[r])!==null&&i!==void 0?i:t[r]};if(!li.eslint&&!ui.includes("--no-eslint")){if(g){li.eslint=getPrefOrDefault("eslint")}else{const t=(0,Te.blue)("ESLint");const{eslint:r}=await Ce()({onState:onPromptState,type:"toggle",name:"eslint",message:`Would you like to use ${t}?`,initial:getPrefOrDefault("eslint"),active:"Yes",inactive:"No"});li.eslint=Boolean(r);m.eslint=Boolean(r)}}if(!li.prettier&&!ui.includes("--no-prettier")){if(g){li.prettier=getPrefOrDefault("prettier")}else{const t=(0,Te.blue)("Prettier");const{prettier:r}=await Ce()({onState:onPromptState,type:"toggle",name:"prettier",message:`Would you like to use ${t}?`,initial:getPrefOrDefault("prettier"),active:"Yes",inactive:"No"});li.prettier=Boolean(r);m.prettier=Boolean(r)}}}li.git=(i=li.git)!==null&&i!==void 0?i:!ui.includes("--no-git");li.install=(o=li.install)!==null&&o!==void 0?o:!ui.includes("--no-install");li.versionCheck=(c=li.versionCheck)!==null&&c!==void 0?c:!ui.includes("--no-version-check");try{await createApp({appPath:u,packageManager:hi,example:p&&p!=="default"?p:undefined,examplePath:li.examplePath,eslint:li.eslint,prettier:li.prettier,installPackages:li.install,empty:li.empty,initGit:li.git,zuploVersion:ai.version})}catch(t){if(!(t instanceof DownloadError)){throw t}const r=await Ce()({onState:onPromptState,type:"confirm",name:"builtin",message:`Could not download "${p}" because of a connectivity issue between your machine and GitHub.\n`+`Do you want to use the default template instead?`,initial:true});if(!r.builtin){throw t}await createApp({appPath:u,packageManager:hi,eslint:li.eslint,prettier:li.prettier,installPackages:li.install,empty:li.empty,initGit:li.git,zuploVersion:ai.version})}l.set("preferences",m);if(li.versionCheck){console.log();await notifyUpdate()}}const di=Ne()(ai).catch((()=>null));async function notifyUpdate(){var t;try{if((t=await di)===null||t===void 0?void 0:t.latest){const t={npm:"npm i -g",yarn:"yarn global add",pnpm:"pnpm add -g",bun:"bun add -g"};const r=`${t[hi]} create-zuplo-api`;console.log((0,Te.yellow)((0,Te.bold)("A new version of `create-zuplo-api` is available!"))+"\n"+"You can update by running: "+(0,Te.cyan)(r)+"\n")}process.exit(0)}catch{}}async function exit(t){console.log();console.log("Aborting installation.");if(t.command){console.log(` ${(0,Te.cyan)(t.command)} has failed.`)}else{console.log(`${(0,Te.red)("Unexpected error. Please report it as a bug:")}\n`,t)}process.exit(1)}run().catch(exit)})();module.exports=i})();
|