nemar-cli 0.10.28-dev.4344 → 0.10.29-PR2104.e70fa53
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/git-annex-remote-nemar.js +5 -5
- package/dist/index.js +500 -659
- package/package.json +1 -4
|
@@ -15,7 +15,7 @@ var hS=Object.create;var{getPrototypeOf:mS,defineProperty:Bo,getOwnPropertyNames
|
|
|
15
15
|
missingProperty: ${n},
|
|
16
16
|
depsCount: ${t},
|
|
17
17
|
deps: ${r}}`};var hD={keyword:"dependencies",type:"object",schemaType:"object",error:q0.error,code(e){let[t,r]=mD(e);C0(e,t),j0(e,r)}};function mD({schema:e}){let t={},r={};for(let n in e){if(n==="__proto__")continue;let s=Array.isArray(e[n])?t:r;s[n]=e[n]}return[t,r]}function C0(e,t=e.schema){let{gen:r,data:n,it:s}=e;if(Object.keys(t).length===0)return;let o=r.let("missing");for(let i in t){let a=t[i];if(a.length===0)continue;let c=ir.propertyInData(r,n,i,s.opts.ownProperties);if(e.setParams({property:i,depsCount:a.length,deps:a.join(", ")}),s.allErrors)r.if(c,()=>{for(let u of a)ir.checkReportMissingProp(e,u)});else r.if($s._`${c} && (${ir.checkMissingProp(e,a,o)})`),ir.reportMissingProp(e,o),r.else()}}q0.validatePropertyDeps=C0;function j0(e,t=e.schema){let{gen:r,data:n,keyword:s,it:o}=e,i=r.name("valid");for(let a in t){if(I0.alwaysValidSchema(o,t[a]))continue;r.if(ir.propertyInData(r,n,a,o.opts.ownProperties),()=>{let c=e.subschema({keyword:s,schemaProp:a},i);e.mergeValidEvaluated(c,i)},()=>r.var(i,!0)),e.ok(i)}}q0.validateSchemaDeps=j0;q0.default=hD});var V0=g(function(F0){Object.defineProperty(F0,"__esModule",{value:!0});var ya=Z(),U0=ae(),_D={message:"property name must be valid",params:({params:e})=>ya._`{propertyName: ${e.propertyName}}`},vD={keyword:"propertyNames",type:"object",schemaType:["object","boolean"],error:_D,code(e){let{gen:t,schema:r,data:n,it:s}=e;if(U0.alwaysValidSchema(s,r))return;let o=t.name("valid");t.forIn("key",n,(i)=>{e.setParams({propertyName:i}),e.subschema({keyword:"propertyNames",data:i,dataTypes:["string"],propertyName:i,compositeRule:!0},o),t.if(ya.not(o),()=>{if(e.error(!0),!s.allErrors)t.break()})}),e.ok(o)}};F0.default=vD});var rl=g(function(z0){Object.defineProperty(z0,"__esModule",{value:!0});var on=_t(),Ne=Z(),ED=vr(),an=ae(),wD={message:"must NOT have additional properties",params:({params:e})=>Ne._`{additionalProperty: ${e.additionalProperty}}`},bD={keyword:"additionalProperties",type:["object"],schemaType:["boolean","object"],allowUndefined:!0,trackErrors:!0,error:wD,code(e){let{gen:t,schema:r,parentSchema:n,data:s,errsCount:o,it:i}=e;if(!o)throw Error("ajv implementation error");let{allErrors:a,opts:c}=i;if(i.props=!0,c.removeAdditional!=="all"&&an.alwaysValidSchema(i,r))return;let u=on.allSchemaProperties(n.properties),d=on.allSchemaProperties(n.patternProperties);l(),e.ok(Ne._`${o} === ${ED.default.errors}`);function l(){t.forIn("key",s,(y)=>{if(!u.length&&!d.length)h(y);else t.if(p(y),()=>h(y))})}function p(y){let _;if(u.length>8){let O=an.schemaRefOrVal(i,n.properties,"properties");_=on.isOwnProperty(t,O,y)}else if(u.length)_=Ne.or(...u.map((O)=>Ne._`${y} === ${O}`));else _=Ne.nil;if(d.length)_=Ne.or(_,...d.map((O)=>Ne._`${on.usePattern(e,O)}.test(${y})`));return Ne.not(_)}function f(y){t.code(Ne._`delete ${s}[${y}]`)}function h(y){if(c.removeAdditional==="all"||c.removeAdditional&&r===!1){f(y);return}if(r===!1){if(e.setParams({additionalProperty:y}),e.error(),!a)t.break();return}if(typeof r=="object"&&!an.alwaysValidSchema(i,r)){let _=t.name("valid");if(c.removeAdditional==="failing")m(y,_,!1),t.if(Ne.not(_),()=>{e.reset(),f(y)});else if(m(y,_),!a)t.if(Ne.not(_),()=>t.break())}}function m(y,_,O){let T={keyword:"additionalProperties",dataProp:y,dataPropType:an.Type.Str};if(O===!1)Object.assign(T,{compositeRule:!0,createErrors:!1,allErrors:!1});e.subschema(T,_)}}};z0.default=bD});var B0=g(function(H0){Object.defineProperty(H0,"__esModule",{value:!0});var K0=fo(),_a=_t(),Es=ae(),G0=rl(),xD={keyword:"properties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,parentSchema:n,data:s,it:o}=e;if(o.opts.removeAdditional==="all"&&n.additionalProperties===void 0)G0.default.code(new K0.KeywordCxt(o,G0.default,"additionalProperties"));let i=_a.allSchemaProperties(r);for(let l of i)o.definedProperties.add(l);if(o.opts.unevaluated&&i.length&&o.props!==!0)o.props=Es.mergeEvaluated.props(t,Es.toHash(i),o.props);let a=i.filter((l)=>!Es.alwaysValidSchema(o,r[l]));if(a.length===0)return;let c=t.name("valid");for(let l of a){if(u(l))d(l);else{if(t.if(_a.propertyInData(t,s,l,o.opts.ownProperties)),d(l),!o.allErrors)t.else().var(c,!0);t.endIf()}e.it.definedProperties.add(l),e.ok(c)}function u(l){return o.opts.useDefaults&&!o.compositeRule&&r[l].default!==void 0}function d(l){e.subschema({keyword:"properties",schemaProp:l,dataProp:l},c)}}};H0.default=xD});var Y0=g(function(W0){Object.defineProperty(W0,"__esModule",{value:!0});var va=_t(),cn=Z(),$a=ae(),Ea=ae(),TD={keyword:"patternProperties",type:"object",schemaType:"object",code(e){let{gen:t,schema:r,data:n,parentSchema:s,it:o}=e,{opts:i}=o,a=va.allSchemaProperties(r),c=a.filter((m)=>$a.alwaysValidSchema(o,r[m]));if(a.length===0||c.length===a.length&&(!o.opts.unevaluated||o.props===!0))return;let u=i.strictSchema&&!i.allowMatchingProperties&&s.properties,d=t.name("valid");if(o.props!==!0&&!(o.props instanceof cn.Name))o.props=Ea.evaluatedPropsToName(t,o.props);let{props:l}=o;p();function p(){for(let m of a){if(u)f(m);if(o.allErrors)h(m);else t.var(d,!0),h(m),t.if(d)}}function f(m){for(let y in u)if(new RegExp(m).test(y))$a.checkStrictMode(o,`property ${y} matches pattern ${m} (use allowMatchingProperties)`)}function h(m){t.forIn("key",n,(y)=>{t.if(cn._`${va.usePattern(e,m)}.test(${y})`,()=>{let _=c.includes(m);if(!_)e.subschema({keyword:"patternProperties",schemaProp:m,dataProp:y,dataPropType:Ea.Type.Str},d);if(o.opts.unevaluated&&l!==!0)t.assign(cn._`${l}[${y}]`,!0);else if(!_&&!o.allErrors)t.if(cn.not(d),()=>t.break())})})}}};W0.default=TD});var Q0=g(function(J0){Object.defineProperty(J0,"__esModule",{value:!0});var X0=ae(),OD={keyword:"not",schemaType:["object","boolean"],trackErrors:!0,code(e){let{gen:t,schema:r,it:n}=e;if(X0.alwaysValidSchema(n,r)){e.fail();return}let s=t.name("valid");e.subschema({keyword:"not",compositeRule:!0,createErrors:!1,allErrors:!1},s),e.failResult(s,()=>e.reset(),()=>e.error())},error:{message:"must NOT be valid"}};J0.default=OD});var t$=g(function(e$){Object.defineProperty(e$,"__esModule",{value:!0});var Z0=_t(),PD={keyword:"anyOf",schemaType:"array",trackErrors:!0,code:Z0.validateUnion,error:{message:"must match a schema in anyOf"}};e$.default=PD});var s$=g(function(n$){Object.defineProperty(n$,"__esModule",{value:!0});var un=Z(),r$=ae(),ID={message:"must match exactly one schema in oneOf",params:({params:e})=>un._`{passingSchemas: ${e.passing}}`},CD={keyword:"oneOf",schemaType:"array",trackErrors:!0,error:ID,code(e){let{gen:t,schema:r,parentSchema:n,it:s}=e;if(!Array.isArray(r))throw Error("ajv implementation error");if(s.opts.discriminator&&n.discriminator)return;let o=r,i=t.let("valid",!1),a=t.let("passing",null),c=t.name("_valid");e.setParams({passing:a}),t.block(u),e.result(i,()=>e.reset(),()=>e.error(!0));function u(){o.forEach((d,l)=>{let p;if(r$.alwaysValidSchema(s,d))t.var(c,!0);else p=e.subschema({keyword:"oneOf",schemaProp:l,compositeRule:!0},c);if(l>0)t.if(un._`${c} && ${i}`).assign(i,!1).assign(a,un._`[${a}, ${l}]`).else();t.if(c,()=>{if(t.assign(i,!0),t.assign(a,l),p)e.mergeEvaluated(p,un.Name)})})}}};n$.default=CD});var a$=g(function(i$){Object.defineProperty(i$,"__esModule",{value:!0});var o$=ae(),qD={keyword:"allOf",schemaType:"array",code(e){let{gen:t,schema:r,it:n}=e;if(!Array.isArray(r))throw Error("ajv implementation error");let s=t.name("valid");r.forEach((o,i)=>{if(o$.alwaysValidSchema(n,o))return;let a=e.subschema({keyword:"allOf",schemaProp:i},s);e.ok(s),e.mergeEvaluated(a)})}};i$.default=qD});var l$=g(function(u$){Object.defineProperty(u$,"__esModule",{value:!0});var ln=Z(),wa=ae(),MD={message:({params:e})=>ln.str`must match "${e.ifClause}" schema`,params:({params:e})=>ln._`{failingKeyword: ${e.ifClause}}`},LD={keyword:"if",schemaType:["object","boolean"],trackErrors:!0,error:MD,code(e){let{gen:t,parentSchema:r,it:n}=e;if(r.then===void 0&&r.else===void 0)wa.checkStrictMode(n,'"if" without "then" and "else" is ignored');let s=c$(n,"then"),o=c$(n,"else");if(!s&&!o)return;let i=t.let("valid",!0),a=t.name("_valid");if(c(),e.reset(),s&&o){let d=t.let("ifClause");e.setParams({ifClause:d}),t.if(a,u("then",d),u("else",d))}else if(s)t.if(a,u("then"));else t.if(ln.not(a),u("else"));e.pass(i,()=>e.error(!0));function c(){let d=e.subschema({keyword:"if",compositeRule:!0,createErrors:!1,allErrors:!1},a);e.mergeEvaluated(d)}function u(d,l){return()=>{let p=e.subschema({keyword:d},a);if(t.assign(i,a),e.mergeValidEvaluated(p,i),l)t.assign(l,ln._`${d}`);else e.setParams({ifClause:d})}}}};function c$(e,t){let r=e.schema[t];return r!==void 0&&!wa.alwaysValidSchema(e,r)}u$.default=LD});var p$=g(function(f$){Object.defineProperty(f$,"__esModule",{value:!0});var d$=ae(),FD={keyword:["then","else"],schemaType:["object","boolean"],code({keyword:e,parentSchema:t,it:r}){if(t.if===void 0)d$.checkStrictMode(r,`"${e}" without "if" is ignored`)}};f$.default=FD});var m$=g(function(h$){Object.defineProperty(h$,"__esModule",{value:!0});var zD=el(),GD=x0(),KD=tl(),HD=A0(),BD=N0(),WD=L0(),YD=V0(),XD=rl(),JD=B0(),QD=Y0(),ZD=Q0(),eM=t$(),tM=s$(),rM=a$(),nM=l$(),sM=p$();function oM(e=!1){let t=[ZD.default,eM.default,tM.default,rM.default,nM.default,sM.default,YD.default,XD.default,WD.default,JD.default,QD.default];if(e)t.push(GD.default,HD.default);else t.push(zD.default,KD.default);return t.push(BD.default),t}h$.default=oM});var y$=g(function(g$){Object.defineProperty(g$,"__esModule",{value:!0});var J=Z(),aM={message:({schemaCode:e})=>J.str`must match format "${e}"`,params:({schemaCode:e})=>J._`{format: ${e}}`},cM={keyword:"format",type:["number","string"],schemaType:"string",$data:!0,error:aM,code(e,t){let{gen:r,data:n,$data:s,schema:o,schemaCode:i,it:a}=e,{opts:c,errSchemaPath:u,schemaEnv:d,self:l}=a;if(!c.validateFormats)return;if(s)p();else f();function p(){let h=r.scopeValue("formats",{ref:l.formats,code:c.code.formats}),m=r.const("fDef",J._`${h}[${i}]`),y=r.let("fType"),_=r.let("format");r.if(J._`typeof ${m} == "object" && !(${m} instanceof RegExp)`,()=>r.assign(y,J._`${m}.type || "string"`).assign(_,J._`${m}.validate`),()=>r.assign(y,J._`"string"`).assign(_,m)),e.fail$data(J.or(O(),T()));function O(){if(c.strictSchema===!1)return J.nil;return J._`${i} && !${_}`}function T(){let M=d.$async?J._`(${m}.async ? await ${_}(${n}) : ${_}(${n}))`:J._`${_}(${n})`,S=J._`(typeof ${_} == "function" ? ${M} : ${_}.test(${n}))`;return J._`${_} && ${_} !== true && ${y} === ${t} && !${S}`}}function f(){let h=l.formats[o];if(!h){O();return}if(h===!0)return;let[m,y,_]=T(h);if(m===t)e.pass(M());function O(){if(c.strictSchema===!1){l.logger.warn(S());return}throw Error(S());function S(){return`unknown format "${o}" ignored in schema at path "${u}"`}}function T(S){let _e=S instanceof RegExp?J.regexpCode(S):c.code.formats?J._`${c.code.formats}${J.getProperty(o)}`:void 0,ve=r.scopeValue("formats",{key:o,ref:S,code:_e});if(typeof S=="object"&&!(S instanceof RegExp))return[S.type||"string",S.validate,J._`${ve}.validate`];return["string",S,ve]}function M(){if(typeof h=="object"&&!(h instanceof RegExp)&&h.async){if(!d.$async)throw Error("async format in sync schema");return J._`await ${_}(${n})`}return typeof y=="function"?J._`${_}(${n})`:J._`${_}.test(${n})`}}}};g$.default=cM});var v$=g(function(_$){Object.defineProperty(_$,"__esModule",{value:!0});var lM=y$(),dM=[lM.default];_$.default=dM});var w$=g(function($$){Object.defineProperty($$,"__esModule",{value:!0});$$.contentVocabulary=$$.metadataVocabulary=void 0;$$.metadataVocabulary=["title","description","default","deprecated","readOnly","writeOnly","examples"];$$.contentVocabulary=["contentMediaType","contentEncoding","contentSchema"]});var S$=g(function(b$){Object.defineProperty(b$,"__esModule",{value:!0});var hM=qv(),mM=m0(),gM=m$(),yM=v$(),ba=w$(),_M=[hM.default,mM.default,(0,gM.default)(),yM.default,ba.metadataVocabulary,ba.contentVocabulary];b$.default=_M});var k$=g(function(R$){Object.defineProperty(R$,"__esModule",{value:!0});R$.DiscrError=void 0;var x$;(function(e){e.Tag="tag",e.Mapping="mapping"})(x$||(R$.DiscrError=x$={}))});var P$=g(function(A$){Object.defineProperty(A$,"__esModule",{value:!0});var vt=Z(),ws=k$(),Sa=ca(),$M=po(),O$=ae(),EM={message:({params:{discrError:e,tagName:t}})=>e===ws.DiscrError.Tag?`tag "${t}" must be string`:`value of tag "${t}" must be in oneOf`,params:({params:{discrError:e,tag:t,tagName:r}})=>vt._`{error: ${e}, tag: ${r}, tagValue: ${t}}`},wM={keyword:"discriminator",type:"object",schemaType:"object",error:EM,code(e){let{gen:t,data:r,schema:n,parentSchema:s,it:o}=e,{oneOf:i}=s;if(!o.opts.discriminator)throw Error("discriminator: requires discriminator option");let a=n.propertyName;if(typeof a!="string")throw Error("discriminator: requires propertyName");if(n.mapping)throw Error("discriminator: mapping is not supported");if(!i)throw Error("discriminator: requires oneOf keyword");let c=t.let("valid",!1),u=t.const("tag",vt._`${r}${vt.getProperty(a)}`);t.if(vt._`typeof ${u} == "string"`,()=>d(),()=>e.error(!1,{discrError:ws.DiscrError.Tag,tag:u,tagName:a})),e.ok(c);function d(){let f=p();t.if(!1);for(let h in f)t.elseIf(vt._`${u} === ${h}`),t.assign(c,l(f[h]));t.else(),e.error(!1,{discrError:ws.DiscrError.Mapping,tag:u,tagName:a}),t.endIf()}function l(f){let h=t.name("valid"),m=e.subschema({keyword:"oneOf",schemaProp:f},h);return e.mergeEvaluated(m,vt.Name),h}function p(){var f;let h={},m=_(s),y=!0;for(let M=0;M<i.length;M++){let S=i[M];if((S===null||S===void 0?void 0:S.$ref)&&!O$.schemaHasRulesButRef(S,o.self.RULES)){let ve=S.$ref;if(S=Sa.resolveRef.call(o.self,o.schemaEnv.root,o.baseId,ve),S instanceof Sa.SchemaEnv)S=S.schema;if(S===void 0)throw new $M.default(o.opts.uriResolver,o.baseId,ve)}let _e=(f=S===null||S===void 0?void 0:S.properties)===null||f===void 0?void 0:f[a];if(typeof _e!="object")throw Error(`discriminator: oneOf subschemas (or referenced schemas) must have "properties/${a}"`);y=y&&(m||_(S)),O(_e,M)}if(!y)throw Error(`discriminator: "${a}" must be required`);return h;function _({required:M}){return Array.isArray(M)&&M.includes(a)}function O(M,S){if(M.const)T(M.const,S);else if(M.enum)for(let _e of M.enum)T(_e,S);else throw Error(`discriminator: "properties/${a}" must have "const" or "enum"`)}function T(M,S){if(typeof M!="string"||M in h)throw Error(`discriminator: "${a}" values must be unique strings`);h[M]=S}}}};A$.default=wM});var N$=g(function(sH,SM){SM.exports={$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:!0,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:!0,readOnly:{type:"boolean",default:!1},examples:{type:"array",items:!0},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:!0},maxItems:{$ref:"#/definitions/nonNegativeInteger"},minItems:{$ref:"#/definitions/nonNegativeIntegerDefault0"},uniqueItems:{type:"boolean",default:!1},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:!0,enum:{type:"array",items:!0,minItems:1,uniqueItems:!0},type:{anyOf:[{$ref:"#/definitions/simpleTypes"},{type:"array",items:{$ref:"#/definitions/simpleTypes"},minItems:1,uniqueItems:!0}]},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:!0}});var C$=g(function(lt,nl){Object.defineProperty(lt,"__esModule",{value:!0});lt.MissingRefError=lt.ValidationError=lt.CodeGen=lt.Name=lt.nil=lt.stringify=lt.str=lt._=lt.KeywordCxt=lt.Ajv=void 0;var xM=kv(),RM=S$(),TM=P$(),I$=N$(),kM=["/properties"],xa="http://json-schema.org/draft-07/schema";class mo extends xM.default{_addVocabularies(){if(super._addVocabularies(),RM.default.forEach((e)=>this.addVocabulary(e)),this.opts.discriminator)this.addKeyword(TM.default)}_addDefaultMetaSchema(){if(super._addDefaultMetaSchema(),!this.opts.meta)return;let e=this.opts.$data?this.$dataMetaSchema(I$,kM):I$;this.addMetaSchema(e,xa,!1),this.refs["http://json-schema.org/schema"]=xa}defaultMeta(){return this.opts.defaultMeta=super.defaultMeta()||(this.getSchema(xa)?xa:void 0)}}lt.Ajv=mo;nl.exports=lt=mo;nl.exports.Ajv=mo;Object.defineProperty(lt,"__esModule",{value:!0});lt.default=mo;var OM=fo();Object.defineProperty(lt,"KeywordCxt",{enumerable:!0,get:function(){return OM.KeywordCxt}});var bs=Z();Object.defineProperty(lt,"_",{enumerable:!0,get:function(){return bs._}});Object.defineProperty(lt,"str",{enumerable:!0,get:function(){return bs.str}});Object.defineProperty(lt,"stringify",{enumerable:!0,get:function(){return bs.stringify}});Object.defineProperty(lt,"nil",{enumerable:!0,get:function(){return bs.nil}});Object.defineProperty(lt,"Name",{enumerable:!0,get:function(){return bs.Name}});Object.defineProperty(lt,"CodeGen",{enumerable:!0,get:function(){return bs.CodeGen}});var AM=oa();Object.defineProperty(lt,"ValidationError",{enumerable:!0,get:function(){return AM.default}});var PM=po();Object.defineProperty(lt,"MissingRefError",{enumerable:!0,get:function(){return PM.default}})});var D$=g(function(q$){Object.defineProperty(q$,"__esModule",{value:!0});q$.formatLimitDefinition=void 0;var j$=C$(),Ie=Z(),dn=Ie.operators,Ra={formatMaximum:{okStr:"<=",ok:dn.LTE,fail:dn.GT},formatMinimum:{okStr:">=",ok:dn.GTE,fail:dn.LT},formatExclusiveMaximum:{okStr:"<",ok:dn.LT,fail:dn.GTE},formatExclusiveMinimum:{okStr:">",ok:dn.GT,fail:dn.LTE}},CM={message:({keyword:e,schemaCode:t})=>Ie.str`should be ${Ra[e].okStr} ${t}`,params:({keyword:e,schemaCode:t})=>Ie._`{comparison: ${Ra[e].okStr}, limit: ${t}}`};q$.formatLimitDefinition={keyword:Object.keys(Ra),type:"string",schemaType:"string",$data:!0,error:CM,code(e){let{gen:t,data:r,schemaCode:n,keyword:s,it:o}=e,{opts:i,self:a}=o;if(!i.validateFormats)return;let c=new j$.KeywordCxt(o,a.RULES.all.format.definition,"format");if(c.$data)u();else d();function u(){let p=t.scopeValue("formats",{ref:a.formats,code:i.code.formats}),f=t.const("fmt",Ie._`${p}[${c.schemaCode}]`);e.fail$data(Ie.or(Ie._`typeof ${f} != "object"`,Ie._`${f} instanceof RegExp`,Ie._`typeof ${f}.compare != "function"`,l(f)))}function d(){let p=c.schema,f=a.formats[p];if(!f||f===!0)return;if(typeof f!="object"||f instanceof RegExp||typeof f.compare!="function")throw Error(`"${s}": format "${p}" does not define "compare" function`);let h=t.scopeValue("formats",{key:p,ref:f,code:i.code.formats?Ie._`${i.code.formats}${Ie.getProperty(p)}`:void 0});e.fail$data(l(h))}function l(p){return Ie._`${p}.compare(${r}, ${n}) ${Ra[s].fail} 0`}},dependencies:["format"]};var jM=(e)=>(e.addKeyword(q$.formatLimitDefinition),e);q$.default=jM});var F$=g(function(go,U$){Object.defineProperty(go,"__esModule",{value:!0});var $t=my(),DM=D$(),Ss=Z(),M$=new Ss.Name("fullFormats"),MM=new Ss.Name("fastFormats"),ol=(e,t={keywords:!0})=>{if(Array.isArray(t))return L$(e,t,$t.fullFormats,M$),e;let[r,n]=t.mode==="fast"?[$t.fastFormats,MM]:[$t.fullFormats,M$],s=t.formats||$t.formatNames;if(L$(e,s,r,n),t.keywords)(0,DM.default)(e);return e};ol.get=(e,t="full")=>{let n=(t==="fast"?$t.fastFormats:$t.fullFormats)[e];if(!n)throw Error(`Unknown format "${e}"`);return n};function L$(e,t,r,n){var s,o;(s=(o=e.opts.code).formats)!==null&&s!==void 0||(o.formats=Ss._`require("ajv-formats/dist/formats").${n}`);for(let i of t)e.addFormat(i,r[i])}U$.exports=go=ol;Object.defineProperty(go,"__esModule",{value:!0});go.default=ol});function il(e,t,{ignoreNonConfigurable:r=!1}={}){let{name:n}=e;for(let s of Reflect.ownKeys(t))LM(e,t,s,r);return FM(e,t),KM(e,t,n),e}var LM=(e,t,r,n)=>{if(r==="length"||r==="prototype")return;if(r==="arguments"||r==="caller")return;let s=Object.getOwnPropertyDescriptor(e,r),o=Object.getOwnPropertyDescriptor(t,r);if(!UM(s,o)&&n)return;Object.defineProperty(e,r,o)},UM=function(e,t){return e===void 0||e.configurable||e.writable===t.writable&&e.enumerable===t.enumerable&&e.configurable===t.configurable&&(e.writable||e.value===t.value)},FM=(e,t)=>{let r=Object.getPrototypeOf(t);if(r===Object.getPrototypeOf(e))return;Object.setPrototypeOf(e,r)},VM=(e,t)=>`/* Wrapped ${e}*/
|
|
18
|
-
${t}`,zM,GM,KM=(e,t,r)=>{let n=r===""?"":`with ${r.trim()}() `,s=VM.bind(null,n,t.toString());Object.defineProperty(s,"name",GM);let{writable:o,enumerable:i,configurable:a}=zM;Object.defineProperty(e,"toString",{value:s,writable:o,enumerable:i,configurable:a})};var V$=F(()=>{zM=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),GM=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name")});var HM=(e,t={})=>{if(typeof e!=="function")throw TypeError(`Expected the first argument to be a function, got \`${typeof e}\``);let{wait:r=0,maxWait:n=Number.POSITIVE_INFINITY,before:s=!1,after:o=!0}=t;if(r<0||n<0)throw RangeError("`wait` and `maxWait` must not be negative.");if(!s&&!o)throw Error("Both `before` and `after` are false, function wouldn't be called.");let i,a,c,u=function(...d){let l=this,p=()=>{if(i=void 0,a)clearTimeout(a),a=void 0;if(o)c=e.apply(l,d)},f=()=>{if(a=void 0,i)clearTimeout(i),i=void 0;if(o)c=e.apply(l,d)},h=s&&!i;if(clearTimeout(i),i=setTimeout(p,r),n>0&&n!==Number.POSITIVE_INFINITY&&!a)a=setTimeout(f,n);if(h)c=e.apply(l,d);return c};return il(u,e),u.cancel=()=>{if(i)clearTimeout(i),i=void 0;if(a)clearTimeout(a),a=void 0},u},al;var z$=F(()=>{V$();al=HM});var yo=g(function(yH,G$){var BM=Number.MAX_SAFE_INTEGER||9007199254740991,WM=["major","premajor","minor","preminor","patch","prepatch","prerelease"];G$.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:BM,RELEASE_TYPES:WM,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var _o=g(function(_H,K$){var YM=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};K$.exports=YM});var xs=g(function(ar,H$){var{MAX_SAFE_COMPONENT_LENGTH:cl,MAX_SAFE_BUILD_LENGTH:XM,MAX_LENGTH:JM}=yo(),QM=_o();ar=H$.exports={};var ZM=ar.re=[],eL=ar.safeRe=[],j=ar.src=[],tL=ar.safeSrc=[],q=ar.t={},rL=0,ul="[a-zA-Z0-9-]",nL=[["\\s",1],["\\d",JM],[ul,XM]],sL=(e)=>{for(let[t,r]of nL)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},W=(e,t,r)=>{let n=sL(t),s=rL++;QM(e,s,t),q[e]=s,j[s]=t,tL[s]=n,ZM[s]=new RegExp(t,r?"g":void 0),eL[s]=new RegExp(n,r?"g":void 0)};W("NUMERICIDENTIFIER","0|[1-9]\\d*");W("NUMERICIDENTIFIERLOOSE","\\d+");W("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${ul}*`);W("MAINVERSION",`(${j[q.NUMERICIDENTIFIER]})\\.(${j[q.NUMERICIDENTIFIER]})\\.(${j[q.NUMERICIDENTIFIER]})`);W("MAINVERSIONLOOSE",`(${j[q.NUMERICIDENTIFIERLOOSE]})\\.(${j[q.NUMERICIDENTIFIERLOOSE]})\\.(${j[q.NUMERICIDENTIFIERLOOSE]})`);W("PRERELEASEIDENTIFIER",`(?:${j[q.NONNUMERICIDENTIFIER]}|${j[q.NUMERICIDENTIFIER]})`);W("PRERELEASEIDENTIFIERLOOSE",`(?:${j[q.NONNUMERICIDENTIFIER]}|${j[q.NUMERICIDENTIFIERLOOSE]})`);W("PRERELEASE",`(?:-(${j[q.PRERELEASEIDENTIFIER]}(?:\\.${j[q.PRERELEASEIDENTIFIER]})*))`);W("PRERELEASELOOSE",`(?:-?(${j[q.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${j[q.PRERELEASEIDENTIFIERLOOSE]})*))`);W("BUILDIDENTIFIER",`${ul}+`);W("BUILD",`(?:\\+(${j[q.BUILDIDENTIFIER]}(?:\\.${j[q.BUILDIDENTIFIER]})*))`);W("FULLPLAIN",`v?${j[q.MAINVERSION]}${j[q.PRERELEASE]}?${j[q.BUILD]}?`);W("FULL",`^${j[q.FULLPLAIN]}$`);W("LOOSEPLAIN",`[v=\\s]*${j[q.MAINVERSIONLOOSE]}${j[q.PRERELEASELOOSE]}?${j[q.BUILD]}?`);W("LOOSE",`^${j[q.LOOSEPLAIN]}$`);W("GTLT","((?:<|>)?=?)");W("XRANGEIDENTIFIERLOOSE",`${j[q.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);W("XRANGEIDENTIFIER",`${j[q.NUMERICIDENTIFIER]}|x|X|\\*`);W("XRANGEPLAIN",`[v=\\s]*(${j[q.XRANGEIDENTIFIER]})(?:\\.(${j[q.XRANGEIDENTIFIER]})(?:\\.(${j[q.XRANGEIDENTIFIER]})(?:${j[q.PRERELEASE]})?${j[q.BUILD]}?)?)?`);W("XRANGEPLAINLOOSE",`[v=\\s]*(${j[q.XRANGEIDENTIFIERLOOSE]})(?:\\.(${j[q.XRANGEIDENTIFIERLOOSE]})(?:\\.(${j[q.XRANGEIDENTIFIERLOOSE]})(?:${j[q.PRERELEASELOOSE]})?${j[q.BUILD]}?)?)?`);W("XRANGE",`^${j[q.GTLT]}\\s*${j[q.XRANGEPLAIN]}$`);W("XRANGELOOSE",`^${j[q.GTLT]}\\s*${j[q.XRANGEPLAINLOOSE]}$`);W("COERCEPLAIN",`(^|[^\\d])(\\d{1,${cl}})(?:\\.(\\d{1,${cl}}))?(?:\\.(\\d{1,${cl}}))?`);W("COERCE",`${j[q.COERCEPLAIN]}(?:$|[^\\d])`);W("COERCEFULL",j[q.COERCEPLAIN]+`(?:${j[q.PRERELEASE]})?(?:${j[q.BUILD]})?(?:$|[^\\d])`);W("COERCERTL",j[q.COERCE],!0);W("COERCERTLFULL",j[q.COERCEFULL],!0);W("LONETILDE","(?:~>?)");W("TILDETRIM",`(\\s*)${j[q.LONETILDE]}\\s+`,!0);ar.tildeTrimReplace="$1~";W("TILDE",`^${j[q.LONETILDE]}${j[q.XRANGEPLAIN]}$`);W("TILDELOOSE",`^${j[q.LONETILDE]}${j[q.XRANGEPLAINLOOSE]}$`);W("LONECARET","(?:\\^)");W("CARETTRIM",`(\\s*)${j[q.LONECARET]}\\s+`,!0);ar.caretTrimReplace="$1^";W("CARET",`^${j[q.LONECARET]}${j[q.XRANGEPLAIN]}$`);W("CARETLOOSE",`^${j[q.LONECARET]}${j[q.XRANGEPLAINLOOSE]}$`);W("COMPARATORLOOSE",`^${j[q.GTLT]}\\s*(${j[q.LOOSEPLAIN]})$|^$`);W("COMPARATOR",`^${j[q.GTLT]}\\s*(${j[q.FULLPLAIN]})$|^$`);W("COMPARATORTRIM",`(\\s*)${j[q.GTLT]}\\s*(${j[q.LOOSEPLAIN]}|${j[q.XRANGEPLAIN]})`,!0);ar.comparatorTrimReplace="$1$2$3";W("HYPHENRANGE",`^\\s*(${j[q.XRANGEPLAIN]})\\s+-\\s+(${j[q.XRANGEPLAIN]})\\s*$`);W("HYPHENRANGELOOSE",`^\\s*(${j[q.XRANGEPLAINLOOSE]})\\s+-\\s+(${j[q.XRANGEPLAINLOOSE]})\\s*$`);W("STAR","(<|>)?=?\\s*\\*");W("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");W("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Ta=g(function(vH,B$){var oL=Object.freeze({loose:!0}),iL=Object.freeze({}),aL=(e)=>{if(!e)return iL;if(typeof e!=="object")return oL;return e};B$.exports=aL});var ll=g(function($H,X$){var W$=/^[0-9]+$/,Y$=(e,t)=>{if(typeof e==="number"&&typeof t==="number")return e===t?0:e<t?-1:1;let r=W$.test(e),n=W$.test(t);if(r&&n)e=+e,t=+t;return e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},cL=(e,t)=>Y$(t,e);X$.exports={compareIdentifiers:Y$,rcompareIdentifiers:cL}});var Ke=g(function(EH,Q$){var ka=_o(),{MAX_LENGTH:J$,MAX_SAFE_INTEGER:Oa}=yo(),{safeRe:Aa,t:Pa}=xs(),uL=Ta(),{compareIdentifiers:dl}=ll();class Ot{constructor(e,t){if(t=uL(t),e instanceof Ot)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else e=e.version;else if(typeof e!=="string")throw TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>J$)throw TypeError(`version is longer than ${J$} characters`);ka("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?Aa[Pa.LOOSE]:Aa[Pa.FULL]);if(!r)throw TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>Oa||this.major<0)throw TypeError("Invalid major version");if(this.minor>Oa||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>Oa||this.patch<0)throw TypeError("Invalid patch version");if(!r[4])this.prerelease=[];else this.prerelease=r[4].split(".").map((n)=>{if(/^[0-9]+$/.test(n)){let s=+n;if(s>=0&&s<Oa)return s}return n});this.build=r[5]?r[5].split("."):[],this.format()}format(){if(this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length)this.version+=`-${this.prerelease.join(".")}`;return this.version}toString(){return this.version}compare(e){if(ka("SemVer.compare",this.version,this.options,e),!(e instanceof Ot)){if(typeof e==="string"&&e===this.version)return 0;e=new Ot(e,this.options)}if(e.version===this.version)return 0;return this.compareMain(e)||this.comparePre(e)}compareMain(e){if(!(e instanceof Ot))e=new Ot(e,this.options);if(this.major<e.major)return-1;if(this.major>e.major)return 1;if(this.minor<e.minor)return-1;if(this.minor>e.minor)return 1;if(this.patch<e.patch)return-1;if(this.patch>e.patch)return 1;return 0}comparePre(e){if(!(e instanceof Ot))e=new Ot(e,this.options);if(this.prerelease.length&&!e.prerelease.length)return-1;else if(!this.prerelease.length&&e.prerelease.length)return 1;else if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],n=e.prerelease[t];if(ka("prerelease compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return dl(r,n)}while(++t)}compareBuild(e){if(!(e instanceof Ot))e=new Ot(e,this.options);let t=0;do{let r=this.build[t],n=e.build[t];if(ka("build compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return dl(r,n)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&r===!1)throw Error("invalid increment argument: identifier is empty");if(t){let n=`-${t}`.match(this.options.loose?Aa[Pa.PRERELEASELOOSE]:Aa[Pa.PRERELEASE]);if(!n||n[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":if(this.prerelease.length===0)this.inc("patch",t,r);this.inc("pre",t,r);break;case"release":if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":if(this.minor!==0||this.patch!==0||this.prerelease.length===0)this.major++;this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":if(this.patch!==0||this.prerelease.length===0)this.minor++;this.patch=0,this.prerelease=[];break;case"patch":if(this.prerelease.length===0)this.patch++;this.prerelease=[];break;case"pre":{let n=Number(r)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let s=this.prerelease.length;while(--s>=0)if(typeof this.prerelease[s]==="number")this.prerelease[s]++,s=-2;if(s===-1){if(t===this.prerelease.join(".")&&r===!1)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(t){let s=[t,n];if(r===!1)s=[t];if(dl(this.prerelease[0],t)===0){if(isNaN(this.prerelease[1]))this.prerelease=s}else this.prerelease=s}break}default:throw Error(`invalid increment argument: ${e}`)}if(this.raw=this.format(),this.build.length)this.raw+=`+${this.build.join(".")}`;return this}}Q$.exports=Ot});var Tn=g(function(wH,eE){var Z$=Ke(),lL=(e,t,r=!1)=>{if(e instanceof Z$)return e;try{return new Z$(e,t)}catch(n){if(!r)return null;throw n}};eE.exports=lL});var rE=g(function(bH,tE){var dL=Tn(),fL=(e,t)=>{let r=dL(e,t);return r?r.version:null};tE.exports=fL});var sE=g(function(SH,nE){var pL=Tn(),hL=(e,t)=>{let r=pL(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};nE.exports=hL});var aE=g(function(xH,iE){var oE=Ke(),mL=(e,t,r,n,s)=>{if(typeof r==="string")s=n,n=r,r=void 0;try{return new oE(e instanceof oE?e.version:e,r).inc(t,n,s).version}catch(o){return null}};iE.exports=mL});var lE=g(function(RH,uE){var cE=Tn(),gL=(e,t)=>{let r=cE(e,null,!0),n=cE(t,null,!0),s=r.compare(n);if(s===0)return null;let o=s>0,i=o?r:n,a=o?n:r,c=!!i.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(i)===0){if(a.minor&&!a.patch)return"minor";return"patch"}}let d=c?"pre":"";if(r.major!==n.major)return d+"major";if(r.minor!==n.minor)return d+"minor";if(r.patch!==n.patch)return d+"patch";return"prerelease"};uE.exports=gL});var fE=g(function(TH,dE){var yL=Ke(),_L=(e,t)=>new yL(e,t).major;dE.exports=_L});var hE=g(function(kH,pE){var vL=Ke(),$L=(e,t)=>new vL(e,t).minor;pE.exports=$L});var gE=g(function(OH,mE){var EL=Ke(),wL=(e,t)=>new EL(e,t).patch;mE.exports=wL});var _E=g(function(AH,yE){var bL=Tn(),SL=(e,t)=>{let r=bL(e,t);return r&&r.prerelease.length?r.prerelease:null};yE.exports=SL});var Et=g(function(PH,$E){var vE=Ke(),xL=(e,t,r)=>new vE(e,r).compare(new vE(t,r));$E.exports=xL});var wE=g(function(NH,EE){var RL=Et(),TL=(e,t,r)=>RL(t,e,r);EE.exports=TL});var SE=g(function(IH,bE){var kL=Et(),OL=(e,t)=>kL(e,t,!0);bE.exports=OL});var Na=g(function(CH,RE){var xE=Ke(),AL=(e,t,r)=>{let n=new xE(e,r),s=new xE(t,r);return n.compare(s)||n.compareBuild(s)};RE.exports=AL});var kE=g(function(jH,TE){var PL=Na(),NL=(e,t)=>e.sort((r,n)=>PL(r,n,t));TE.exports=NL});var AE=g(function(qH,OE){var IL=Na(),CL=(e,t)=>e.sort((r,n)=>IL(n,r,t));OE.exports=CL});var vo=g(function(DH,PE){var jL=Et(),qL=(e,t,r)=>jL(e,t,r)>0;PE.exports=qL});var Ia=g(function(MH,NE){var DL=Et(),ML=(e,t,r)=>DL(e,t,r)<0;NE.exports=ML});var fl=g(function(LH,IE){var LL=Et(),UL=(e,t,r)=>LL(e,t,r)===0;IE.exports=UL});var pl=g(function(UH,CE){var FL=Et(),VL=(e,t,r)=>FL(e,t,r)!==0;CE.exports=VL});var Ca=g(function(FH,jE){var zL=Et(),GL=(e,t,r)=>zL(e,t,r)>=0;jE.exports=GL});var ja=g(function(VH,qE){var KL=Et(),HL=(e,t,r)=>KL(e,t,r)<=0;qE.exports=HL});var hl=g(function(zH,DE){var BL=fl(),WL=pl(),YL=vo(),XL=Ca(),JL=Ia(),QL=ja(),ZL=(e,t,r,n)=>{switch(t){case"===":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e===r;case"!==":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e!==r;case"":case"=":case"==":return BL(e,r,n);case"!=":return WL(e,r,n);case">":return YL(e,r,n);case">=":return XL(e,r,n);case"<":return JL(e,r,n);case"<=":return QL(e,r,n);default:throw TypeError(`Invalid operator: ${t}`)}};DE.exports=ZL});var LE=g(function(GH,ME){var eU=Ke(),tU=Tn(),{safeRe:qa,t:Da}=xs(),rU=(e,t)=>{if(e instanceof eU)return e;if(typeof e==="number")e=String(e);if(typeof e!=="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?qa[Da.COERCEFULL]:qa[Da.COERCE]);else{let c=t.includePrerelease?qa[Da.COERCERTLFULL]:qa[Da.COERCERTL],u;while((u=c.exec(e))&&(!r||r.index+r[0].length!==e.length)){if(!r||u.index+u[0].length!==r.index+r[0].length)r=u;c.lastIndex=u.index+u[1].length+u[2].length}c.lastIndex=-1}if(r===null)return null;let n=r[2],s=r[3]||"0",o=r[4]||"0",i=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return tU(`${n}.${s}.${o}${i}${a}`,t)};ME.exports=rU});var VE=g(function(KH,FE){class UE{constructor(){this.max=1000,this.map=new Map}get(e){let t=this.map.get(e);if(t===void 0)return;else return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(e,t)}return this}}FE.exports=UE});var wt=g(function(HH,HE){var nU=/\s+/g;class $o{constructor(e,t){if(t=oU(t),e instanceof $o)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else return new $o(e.raw,t);if(e instanceof Ma)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(nU," "),this.set=this.raw.split("||").map((r)=>this.parseRange(r.trim())).filter((r)=>r.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let r=this.set[0];if(this.set=this.set.filter((n)=>!GE(n[0])),this.set.length===0)this.set=[r];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&fU(n[0])){this.set=[n];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){if(e>0)this.formatted+="||";let t=this.set[e];for(let r=0;r<t.length;r++){if(r>0)this.formatted+=" ";this.formatted+=t[r].toString().trim()}}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let r=((this.options.includePrerelease&&lU)|(this.options.loose&&dU))+":"+e,n=zE.get(r);if(n)return n;let s=this.options.loose,o=s?Xe[He.HYPHENRANGELOOSE]:Xe[He.HYPHENRANGE];e=e.replace(o,wU(this.options.includePrerelease)),ye("hyphen replace",e),e=e.replace(Xe[He.COMPARATORTRIM],aU),ye("comparator trim",e),e=e.replace(Xe[He.TILDETRIM],cU),ye("tilde trim",e),e=e.replace(Xe[He.CARETTRIM],uU),ye("caret trim",e);let i=e.split(" ").map((d)=>pU(d,this.options)).join(" ").split(/\s+/).map((d)=>EU(d,this.options));if(s)i=i.filter((d)=>(ye("loose invalid filter",d,this.options),!!d.match(Xe[He.COMPARATORLOOSE])));ye("range list",i);let a=new Map,c=i.map((d)=>new Ma(d,this.options));for(let d of c){if(GE(d))return[d];a.set(d.value,d)}if(a.size>1&&a.has(""))a.delete("");let u=[...a.values()];return zE.set(r,u),u}intersects(e,t){if(!(e instanceof $o))throw TypeError("a Range is required");return this.set.some((r)=>KE(r,t)&&e.set.some((n)=>KE(n,t)&&r.every((s)=>n.every((o)=>s.intersects(o,t)))))}test(e){if(!e)return!1;if(typeof e==="string")try{e=new iU(e,this.options)}catch(t){return!1}for(let t=0;t<this.set.length;t++)if(bU(this.set[t],e,this.options))return!0;return!1}}HE.exports=$o;var sU=VE(),zE=new sU,oU=Ta(),Ma=Eo(),ye=_o(),iU=Ke(),{safeRe:Xe,t:He,comparatorTrimReplace:aU,tildeTrimReplace:cU,caretTrimReplace:uU}=xs(),{FLAG_INCLUDE_PRERELEASE:lU,FLAG_LOOSE:dU}=yo(),GE=(e)=>e.value==="<0.0.0-0",fU=(e)=>e.value==="",KE=(e,t)=>{let r=!0,n=e.slice(),s=n.pop();while(r&&n.length)r=n.every((o)=>s.intersects(o,t)),s=n.pop();return r},pU=(e,t)=>(e=e.replace(Xe[He.BUILD],""),ye("comp",e,t),e=gU(e,t),ye("caret",e),e=hU(e,t),ye("tildes",e),e=_U(e,t),ye("xrange",e),e=$U(e,t),ye("stars",e),e),Je=(e)=>!e||e.toLowerCase()==="x"||e==="*",hU=(e,t)=>e.trim().split(/\s+/).map((r)=>mU(r,t)).join(" "),mU=(e,t)=>{let r=t.loose?Xe[He.TILDELOOSE]:Xe[He.TILDE];return e.replace(r,(n,s,o,i,a)=>{ye("tilde",e,n,s,o,i,a);let c;if(Je(s))c="";else if(Je(o))c=`>=${s}.0.0 <${+s+1}.0.0-0`;else if(Je(i))c=`>=${s}.${o}.0 <${s}.${+o+1}.0-0`;else if(a)ye("replaceTilde pr",a),c=`>=${s}.${o}.${i}-${a} <${s}.${+o+1}.0-0`;else c=`>=${s}.${o}.${i} <${s}.${+o+1}.0-0`;return ye("tilde return",c),c})},gU=(e,t)=>e.trim().split(/\s+/).map((r)=>yU(r,t)).join(" "),yU=(e,t)=>{ye("caret",e,t);let r=t.loose?Xe[He.CARETLOOSE]:Xe[He.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(s,o,i,a,c)=>{ye("caret",e,s,o,i,a,c);let u;if(Je(o))u="";else if(Je(i))u=`>=${o}.0.0${n} <${+o+1}.0.0-0`;else if(Je(a))if(o==="0")u=`>=${o}.${i}.0${n} <${o}.${+i+1}.0-0`;else u=`>=${o}.${i}.0${n} <${+o+1}.0.0-0`;else if(c)if(ye("replaceCaret pr",c),o==="0")if(i==="0")u=`>=${o}.${i}.${a}-${c} <${o}.${i}.${+a+1}-0`;else u=`>=${o}.${i}.${a}-${c} <${o}.${+i+1}.0-0`;else u=`>=${o}.${i}.${a}-${c} <${+o+1}.0.0-0`;else if(ye("no pr"),o==="0")if(i==="0")u=`>=${o}.${i}.${a}${n} <${o}.${i}.${+a+1}-0`;else u=`>=${o}.${i}.${a}${n} <${o}.${+i+1}.0-0`;else u=`>=${o}.${i}.${a} <${+o+1}.0.0-0`;return ye("caret return",u),u})},_U=(e,t)=>(ye("replaceXRanges",e,t),e.split(/\s+/).map((r)=>vU(r,t)).join(" ")),vU=(e,t)=>{e=e.trim();let r=t.loose?Xe[He.XRANGELOOSE]:Xe[He.XRANGE];return e.replace(r,(n,s,o,i,a,c)=>{ye("xRange",e,n,s,o,i,a,c);let u=Je(o),d=u||Je(i),l=d||Je(a),p=l;if(s==="="&&p)s="";if(c=t.includePrerelease?"-0":"",u)if(s===">"||s==="<")n="<0.0.0-0";else n="*";else if(s&&p){if(d)i=0;if(a=0,s===">")if(s=">=",d)o=+o+1,i=0,a=0;else i=+i+1,a=0;else if(s==="<=")if(s="<",d)o=+o+1;else i=+i+1;if(s==="<")c="-0";n=`${s+o}.${i}.${a}${c}`}else if(d)n=`>=${o}.0.0${c} <${+o+1}.0.0-0`;else if(l)n=`>=${o}.${i}.0${c} <${o}.${+i+1}.0-0`;return ye("xRange return",n),n})},$U=(e,t)=>(ye("replaceStars",e,t),e.trim().replace(Xe[He.STAR],"")),EU=(e,t)=>(ye("replaceGTE0",e,t),e.trim().replace(Xe[t.includePrerelease?He.GTE0PRE:He.GTE0],"")),wU=(e)=>(t,r,n,s,o,i,a,c,u,d,l,p)=>{if(Je(n))r="";else if(Je(s))r=`>=${n}.0.0${e?"-0":""}`;else if(Je(o))r=`>=${n}.${s}.0${e?"-0":""}`;else if(i)r=`>=${r}`;else r=`>=${r}${e?"-0":""}`;if(Je(u))c="";else if(Je(d))c=`<${+u+1}.0.0-0`;else if(Je(l))c=`<${u}.${+d+1}.0-0`;else if(p)c=`<=${u}.${d}.${l}-${p}`;else if(e)c=`<${u}.${d}.${+l+1}-0`;else c=`<=${c}`;return`${r} ${c}`.trim()},bU=(e,t,r)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let n=0;n<e.length;n++){if(ye(e[n].semver),e[n].semver===Ma.ANY)continue;if(e[n].semver.prerelease.length>0){let s=e[n].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}}return!1}return!0}});var Eo=g(function(BH,QE){var wo=Symbol("SemVer ANY");class La{static get ANY(){return wo}constructor(e,t){if(t=BE(t),e instanceof La)if(e.loose===!!t.loose)return e;else e=e.value;if(e=e.trim().split(/\s+/).join(" "),gl("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===wo)this.value="";else this.value=this.operator+this.semver.version;gl("comp",this)}parse(e){let t=this.options.loose?WE[YE.COMPARATORLOOSE]:WE[YE.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);if(this.operator=r[1]!==void 0?r[1]:"",this.operator==="=")this.operator="";if(!r[2])this.semver=wo;else this.semver=new XE(r[2],this.options.loose)}toString(){return this.value}test(e){if(gl("Comparator.test",e,this.options.loose),this.semver===wo||e===wo)return!0;if(typeof e==="string")try{e=new XE(e,this.options)}catch(t){return!1}return ml(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof La))throw TypeError("a Comparator is required");if(this.operator===""){if(this.value==="")return!0;return new JE(e.value,t).test(this.value)}else if(e.operator===""){if(e.value==="")return!0;return new JE(this.value,t).test(e.semver)}if(t=BE(t),t.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0"))return!1;if(!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))return!1;if(this.operator.startsWith(">")&&e.operator.startsWith(">"))return!0;if(this.operator.startsWith("<")&&e.operator.startsWith("<"))return!0;if(this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("="))return!0;if(ml(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))return!0;if(ml(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))return!0;return!1}}QE.exports=La;var BE=Ta(),{safeRe:WE,t:YE}=xs(),ml=hl(),gl=_o(),XE=Ke(),JE=wt()});var bo=g(function(WH,ZE){var SU=wt(),xU=(e,t,r)=>{try{t=new SU(t,r)}catch(n){return!1}return t.test(e)};ZE.exports=xU});var tw=g(function(YH,ew){var RU=wt(),TU=(e,t)=>new RU(e,t).set.map((r)=>r.map((n)=>n.value).join(" ").trim().split(" "));ew.exports=TU});var nw=g(function(XH,rw){var kU=Ke(),OU=wt(),AU=(e,t,r)=>{let n=null,s=null,o=null;try{o=new OU(t,r)}catch(i){return null}return e.forEach((i)=>{if(o.test(i)){if(!n||s.compare(i)===-1)n=i,s=new kU(n,r)}}),n};rw.exports=AU});var ow=g(function(JH,sw){var PU=Ke(),NU=wt(),IU=(e,t,r)=>{let n=null,s=null,o=null;try{o=new NU(t,r)}catch(i){return null}return e.forEach((i)=>{if(o.test(i)){if(!n||s.compare(i)===1)n=i,s=new PU(n,r)}}),n};sw.exports=IU});var cw=g(function(QH,aw){var yl=Ke(),CU=wt(),iw=vo(),jU=(e,t)=>{e=new CU(e,t);let r=new yl("0.0.0");if(e.test(r))return r;if(r=new yl("0.0.0-0"),e.test(r))return r;r=null;for(let n=0;n<e.set.length;++n){let s=e.set[n],o=null;if(s.forEach((i)=>{let a=new yl(i.semver.version);switch(i.operator){case">":if(a.prerelease.length===0)a.patch++;else a.prerelease.push(0);a.raw=a.format();case"":case">=":if(!o||iw(a,o))o=a;break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${i.operator}`)}}),o&&(!r||iw(r,o)))r=o}if(r&&e.test(r))return r;return null};aw.exports=jU});var lw=g(function(ZH,uw){var qU=wt(),DU=(e,t)=>{try{return new qU(e,t).range||"*"}catch(r){return null}};uw.exports=DU});var Ua=g(function(e5,hw){var MU=Ke(),pw=Eo(),{ANY:LU}=pw,UU=wt(),FU=bo(),dw=vo(),fw=Ia(),VU=ja(),zU=Ca(),GU=(e,t,r,n)=>{e=new MU(e,n),t=new UU(t,n);let s,o,i,a,c;switch(r){case">":s=dw,o=VU,i=fw,a=">",c=">=";break;case"<":s=fw,o=zU,i=dw,a="<",c="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(FU(e,t,n))return!1;for(let u=0;u<t.set.length;++u){let d=t.set[u],l=null,p=null;if(d.forEach((f)=>{if(f.semver===LU)f=new pw(">=0.0.0");if(l=l||f,p=p||f,s(f.semver,l.semver,n))l=f;else if(i(f.semver,p.semver,n))p=f}),l.operator===a||l.operator===c)return!1;if((!p.operator||p.operator===a)&&o(e,p.semver))return!1;else if(p.operator===c&&i(e,p.semver))return!1}return!0};hw.exports=GU});var gw=g(function(t5,mw){var KU=Ua(),HU=(e,t,r)=>KU(e,t,">",r);mw.exports=HU});var _w=g(function(r5,yw){var BU=Ua(),WU=(e,t,r)=>BU(e,t,"<",r);yw.exports=WU});var Ew=g(function(n5,$w){var vw=wt(),YU=(e,t,r)=>(e=new vw(e,r),t=new vw(t,r),e.intersects(t,r));$w.exports=YU});var bw=g(function(s5,ww){var XU=bo(),JU=Et();ww.exports=(e,t,r)=>{let n=[],s=null,o=null,i=e.sort((d,l)=>JU(d,l,r));for(let d of i)if(XU(d,t,r)){if(o=d,!s)s=d}else{if(o)n.push([s,o]);o=null,s=null}if(s)n.push([s,null]);let a=[];for(let[d,l]of n)if(d===l)a.push(d);else if(!l&&d===i[0])a.push("*");else if(!l)a.push(`>=${d}`);else if(d===i[0])a.push(`<=${l}`);else a.push(`${d} - ${l}`);let c=a.join(" || "),u=typeof t.raw==="string"?t.raw:String(t);return c.length<u.length?c:t}});var Ow=g(function(o5,kw){var Sw=wt(),vl=Eo(),{ANY:_l}=vl,So=bo(),$l=Et(),QU=(e,t,r={})=>{if(e===t)return!0;e=new Sw(e,r),t=new Sw(t,r);let n=!1;e:for(let s of e.set){for(let o of t.set){let i=e2(s,o,r);if(n=n||i!==null,i)continue e}if(n)return!1}return!0},ZU=[new vl(">=0.0.0-0")],xw=[new vl(">=0.0.0")],e2=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===_l)if(t.length===1&&t[0].semver===_l)return!0;else if(r.includePrerelease)e=ZU;else e=xw;if(t.length===1&&t[0].semver===_l)if(r.includePrerelease)return!0;else t=xw;let n=new Set,s,o;for(let f of e)if(f.operator===">"||f.operator===">=")s=Rw(s,f,r);else if(f.operator==="<"||f.operator==="<=")o=Tw(o,f,r);else n.add(f.semver);if(n.size>1)return null;let i;if(s&&o){if(i=$l(s.semver,o.semver,r),i>0)return null;else if(i===0&&(s.operator!==">="||o.operator!=="<="))return null}for(let f of n){if(s&&!So(f,String(s),r))return null;if(o&&!So(f,String(o),r))return null;for(let h of t)if(!So(f,String(h),r))return!1;return!0}let a,c,u,d,l=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1,p=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;if(l&&l.prerelease.length===1&&o.operator==="<"&&l.prerelease[0]===0)l=!1;for(let f of t){if(d=d||f.operator===">"||f.operator===">=",u=u||f.operator==="<"||f.operator==="<=",s){if(p){if(f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===p.major&&f.semver.minor===p.minor&&f.semver.patch===p.patch)p=!1}if(f.operator===">"||f.operator===">="){if(a=Rw(s,f,r),a===f&&a!==s)return!1}else if(s.operator===">="&&!So(s.semver,String(f),r))return!1}if(o){if(l){if(f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===l.major&&f.semver.minor===l.minor&&f.semver.patch===l.patch)l=!1}if(f.operator==="<"||f.operator==="<="){if(c=Tw(o,f,r),c===f&&c!==o)return!1}else if(o.operator==="<="&&!So(o.semver,String(f),r))return!1}if(!f.operator&&(o||s)&&i!==0)return!1}if(s&&u&&!o&&i!==0)return!1;if(o&&d&&!s&&i!==0)return!1;if(p||l)return!1;return!0},Rw=(e,t,r)=>{if(!e)return t;let n=$l(e.semver,t.semver,r);return n>0?e:n<0?t:t.operator===">"&&e.operator===">="?t:e},Tw=(e,t,r)=>{if(!e)return t;let n=$l(e.semver,t.semver,r);return n<0?e:n>0?t:t.operator==="<"&&e.operator==="<="?t:e};kw.exports=QU});var Pw=g(function(i5,Aw){var Rs=xs(),Fa=yo(),t2=Ke(),Va=ll(),r2=Tn(),n2=rE(),s2=sE(),o2=aE(),i2=lE(),a2=fE(),c2=hE(),u2=gE(),l2=_E(),d2=Et(),f2=wE(),p2=SE(),h2=Na(),m2=kE(),g2=AE(),y2=vo(),_2=Ia(),v2=fl(),$2=pl(),E2=Ca(),w2=ja(),b2=hl(),S2=LE(),x2=Eo(),R2=wt(),T2=bo(),k2=tw(),O2=nw(),A2=ow(),P2=cw(),N2=lw(),I2=Ua(),C2=gw(),j2=_w(),q2=Ew(),D2=bw(),M2=Ow();Aw.exports={parse:r2,valid:n2,clean:s2,inc:o2,diff:i2,major:a2,minor:c2,patch:u2,prerelease:l2,compare:d2,rcompare:f2,compareLoose:p2,compareBuild:h2,sort:m2,rsort:g2,gt:y2,lt:_2,eq:v2,neq:$2,gte:E2,lte:w2,cmp:b2,coerce:S2,Comparator:x2,Range:R2,satisfies:T2,toComparators:k2,maxSatisfying:O2,minSatisfying:A2,minVersion:P2,validRange:N2,outside:I2,gtr:C2,ltr:j2,intersects:q2,simplifyRange:D2,subset:M2,SemVer:t2,re:Rs.re,src:Rs.src,tokens:Rs.t,SEMVER_SPEC_VERSION:Fa.SEMVER_SPEC_VERSION,RELEASE_TYPES:Fa.RELEASE_TYPES,compareIdentifiers:Va.compareIdentifiers,rcompareIdentifiers:Va.rcompareIdentifiers}});function Iw(e,t,r){if(!e)return!1;if(e.constructor===t)return!0;return L2.call(e)===r}function Cw(e){return Iw(e,Uint8Array,"[object Uint8Array]")}function U2(e){return Iw(e,ArrayBuffer,"[object ArrayBuffer]")}function F2(e){return Cw(e)||U2(e)}function V2(e){if(!Cw(e))throw TypeError(`Expected \`Uint8Array\`, got \`${typeof e}\``)}function z2(e){if(!F2(e))throw TypeError(`Expected \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof e}\``)}function El(e,t){if(e.length===0)return new Uint8Array(0);t??=e.reduce((s,o)=>s+o.length,0);let r=new Uint8Array(t),n=0;for(let s of e)V2(s),r.set(s,n),n+=s.length;return r}function wl(e,t="utf8"){return z2(e),Nw[t]??=new globalThis.TextDecoder(t),Nw[t].decode(e)}function G2(e){if(typeof e!=="string")throw TypeError(`Expected \`string\`, got \`${typeof e}\``)}function za(e){return G2(e),K2.encode(e)}var L2,Nw,K2,a5;var jw=F(()=>{L2=Object.prototype.toString;Nw={utf8:new globalThis.TextDecoder("utf8")};K2=new globalThis.TextEncoder;a5=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"))});import{isDeepStrictEqual as H2}from"util";import qw from"process";import kn from"fs";import Dw from"path";import xo from"crypto";import B2 from"assert";var Lw,Uw,On,W2,Mw="aes-256-cbc",Ts=()=>Object.create(null),Y2=(e)=>e!==void 0&&e!==null,X2=(e,t)=>{let r=new Set(["undefined","symbol","function"]),n=typeof t;if(r.has(n))throw TypeError(`Setting a value of type \`${n}\` for key \`${e}\` is not allowed as it's not supported by JSON`)},Ga="__internal__",bl,Ka;var Fw=F(()=>{ld();fd();Vd();z$();jw();Lw=_c(oy(),1),Uw=_c(F$(),1),On=_c(Pw(),1),W2=Uw.default.default,bl=`${Ga}.migrations.version`;Ka=class Ka{path;events;#n;#t;#e;#r={};constructor(e={}){let t={configName:"config",fileExtension:"json",projectSuffix:"nodejs",clearInvalidConfig:!1,accessPropertiesByDotNotation:!0,configFileMode:438,...e};if(!t.cwd){if(!t.projectName)throw Error("Please specify the `projectName` option.");t.cwd=Sc(t.projectName,{suffix:t.projectSuffix}).config}if(this.#e=t,t.schema??t.ajvOptions??t.rootSchema){if(t.schema&&typeof t.schema!=="object")throw TypeError("The `schema` option must be an object.");let o=new Lw.Ajv2020({allErrors:!0,useDefaults:!0,...t.ajvOptions});W2(o);let i={...t.rootSchema,type:"object",properties:t.schema};this.#n=o.compile(i);for(let[a,c]of Object.entries(t.schema??{}))if(c?.default)this.#r[a]=c.default}if(t.defaults)this.#r={...this.#r,...t.defaults};if(t.serialize)this._serialize=t.serialize;if(t.deserialize)this._deserialize=t.deserialize;this.events=new EventTarget,this.#t=t.encryptionKey;let r=t.fileExtension?`.${t.fileExtension}`:"";this.path=Dw.resolve(t.cwd,`${t.configName??"config"}${r}`);let n=this.store,s=Object.assign(Ts(),t.defaults,n);if(t.migrations){if(!t.projectVersion)throw Error("Please specify the `projectVersion` option.");this._migrate(t.migrations,t.projectVersion,t.beforeEachMigration)}this._validate(s);try{B2.deepEqual(n,s)}catch{this.store=s}if(t.watch)this._watch()}get(e,t){if(this.#e.accessPropertiesByDotNotation)return this._get(e,t);let{store:r}=this;return e in r?r[e]:t}set(e,t){if(typeof e!=="string"&&typeof e!=="object")throw TypeError(`Expected \`key\` to be of type \`string\` or \`object\`, got ${typeof e}`);if(typeof e!=="object"&&t===void 0)throw TypeError("Use `delete()` to clear values");if(this._containsReservedKey(e))throw TypeError(`Please don't use the ${Ga} key, as it's used to manage this module internal operations.`);let{store:r}=this,n=(s,o)=>{if(X2(s,o),this.#e.accessPropertiesByDotNotation)Ec(r,s,o);else r[s]=o};if(typeof e==="object"){let s=e;for(let[o,i]of Object.entries(s))n(o,i)}else n(e,t);this.store=r}has(e){if(this.#e.accessPropertiesByDotNotation)return ud(this.store,e);return e in this.store}reset(...e){for(let t of e)if(Y2(this.#r[t]))this.set(t,this.#r[t])}delete(e){let{store:t}=this;if(this.#e.accessPropertiesByDotNotation)cd(t,e);else delete t[e];this.store=t}clear(){this.store=Ts();for(let e of Object.keys(this.#r))this.reset(e)}onDidChange(e,t){if(typeof e!=="string")throw TypeError(`Expected \`key\` to be of type \`string\`, got ${typeof e}`);if(typeof t!=="function")throw TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof t}`);return this._handleChange(()=>this.get(e),t)}onDidAnyChange(e){if(typeof e!=="function")throw TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof e}`);return this._handleChange(()=>this.store,e)}get size(){return Object.keys(this.store).length}get store(){try{let e=kn.readFileSync(this.path,this.#t?null:"utf8"),t=this._encryptData(e),r=this._deserialize(t);return this._validate(r),Object.assign(Ts(),r)}catch(e){if(e?.code==="ENOENT")return this._ensureDirectory(),Ts();if(this.#e.clearInvalidConfig&&e.name==="SyntaxError")return Ts();throw e}}set store(e){this._ensureDirectory(),this._validate(e),this._write(e),this.events.dispatchEvent(new Event("change"))}*[Symbol.iterator](){for(let[e,t]of Object.entries(this.store))yield[e,t]}_encryptData(e){if(!this.#t)return typeof e==="string"?e:wl(e);try{let t=e.slice(0,16),r=xo.pbkdf2Sync(this.#t,t.toString(),1e4,32,"sha512"),n=xo.createDecipheriv(Mw,r,t),s=e.slice(17),o=typeof s==="string"?za(s):s;return wl(El([n.update(o),n.final()]))}catch{}return e.toString()}_handleChange(e,t){let r=e(),n=()=>{let s=r,o=e();if(H2(o,s))return;r=o,t.call(this,o,s)};return this.events.addEventListener("change",n),()=>{this.events.removeEventListener("change",n)}}_deserialize=(e)=>JSON.parse(e);_serialize=(e)=>JSON.stringify(e,void 0,"\t");_validate(e){if(!this.#n)return;if(this.#n(e)||!this.#n.errors)return;let r=this.#n.errors.map(({instancePath:n,message:s=""})=>`\`${n.slice(1)}\` ${s}`);throw Error("Config schema violation: "+r.join("; "))}_ensureDirectory(){kn.mkdirSync(Dw.dirname(this.path),{recursive:!0})}_write(e){let t=this._serialize(e);if(this.#t){let r=xo.randomBytes(16),n=xo.pbkdf2Sync(this.#t,r.toString(),1e4,32,"sha512"),s=xo.createCipheriv(Mw,n,r);t=El([r,za(":"),s.update(za(t)),s.final()])}if(qw.env.SNAP)kn.writeFileSync(this.path,t,{mode:this.#e.configFileMode});else try{jc(this.path,t,{mode:this.#e.configFileMode})}catch(r){if(r?.code==="EXDEV"){kn.writeFileSync(this.path,t,{mode:this.#e.configFileMode});return}throw r}}_watch(){if(this._ensureDirectory(),!kn.existsSync(this.path))this._write(Ts());if(qw.platform==="win32")kn.watch(this.path,{persistent:!1},al(()=>{this.events.dispatchEvent(new Event("change"))},{wait:100}));else kn.watchFile(this.path,{persistent:!1},al(()=>{this.events.dispatchEvent(new Event("change"))},{wait:5000}))}_migrate(e,t,r){let n=this._get(bl,"0.0.0"),s=Object.keys(e).filter((i)=>this._shouldPerformMigration(i,n,t)),o={...this.store};for(let i of s)try{if(r)r(this,{fromVersion:n,toVersion:i,finalVersion:t,versions:s});let a=e[i];a?.(this),this._set(bl,i),n=i,o={...this.store}}catch(a){throw this.store=o,Error(`Something went wrong during the migration! Changes applied to the store until this failed migration will be restored. ${a}`)}if(this._isVersionInRangeFormat(n)||!On.default.eq(n,t))this._set(bl,t)}_containsReservedKey(e){if(typeof e==="object"){if(Object.keys(e)[0]===Ga)return!0}if(typeof e!=="string")return!1;if(this.#e.accessPropertiesByDotNotation){if(e.startsWith(`${Ga}.`))return!0;return!1}return!1}_isVersionInRangeFormat(e){return On.default.clean(e)===null}_shouldPerformMigration(e,t,r){if(this._isVersionInRangeFormat(e)){if(t!=="0.0.0"&&On.default.satisfies(t,e))return!1;return On.default.satisfies(r,e)}if(On.default.lte(e,t))return!1;if(On.default.gt(e,r))return!1;return!0}_get(e,t){return ad(this.store,e,t)}_set(e,t){let{store:r}=this;Ec(r,e,t),this.store=r}}});var re,Vw,N,Er=(e)=>{switch(typeof e){case"undefined":return N.undefined;case"string":return N.string;case"number":return Number.isNaN(e)?N.nan:N.number;case"boolean":return N.boolean;case"function":return N.function;case"bigint":return N.bigint;case"symbol":return N.symbol;case"object":if(Array.isArray(e))return N.array;if(e===null)return N.null;if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return N.promise;if(typeof Map<"u"&&e instanceof Map)return N.map;if(typeof Set<"u"&&e instanceof Set)return N.set;if(typeof Date<"u"&&e instanceof Date)return N.date;return N.object;default:return N.unknown}};var Ro=F(()=>{(function(e){e.assertEqual=(s)=>{};function t(s){}e.assertIs=t;function r(s){throw Error()}e.assertNever=r,e.arrayToEnum=(s)=>{let o={};for(let i of s)o[i]=i;return o},e.getValidEnumValues=(s)=>{let o=e.objectKeys(s).filter((a)=>typeof s[s[a]]!=="number"),i={};for(let a of o)i[a]=s[a];return e.objectValues(i)},e.objectValues=(s)=>e.objectKeys(s).map(function(o){return s[o]}),e.objectKeys=typeof Object.keys==="function"?(s)=>Object.keys(s):(s)=>{let o=[];for(let i in s)if(Object.prototype.hasOwnProperty.call(s,i))o.push(i);return o},e.find=(s,o)=>{for(let i of s)if(o(i))return i;return},e.isInteger=typeof Number.isInteger==="function"?(s)=>Number.isInteger(s):(s)=>typeof s==="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,o=" | "){return s.map((i)=>typeof i==="string"?`'${i}'`:i).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(s,o)=>{if(typeof o==="bigint")return o.toString();return o}})(re||(re={}));(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Vw||(Vw={}));N=re.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var b,ft;var Ha=F(()=>{Ro();b=re.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);ft=class ft extends Error{get errors(){return this.issues}constructor(e){super();this.issues=[],this.addIssue=(r)=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,t);else this.__proto__=t;this.name="ZodError",this.issues=e}format(e){let t=e||function(s){return s.message},r={_errors:[]},n=(s)=>{for(let o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)r._errors.push(t(o));else{let i=r,a=0;while(a<o.path.length){let c=o.path[a];if(a!==o.path.length-1)i[c]=i[c]||{_errors:[]};else i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(o));i=i[c],a++}}};return n(this),r}static assert(e){if(!(e instanceof ft))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,re.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=(t)=>t.message){let t={},r=[];for(let n of this.issues)if(n.path.length>0){let s=n.path[0];t[s]=t[s]||[],t[s].push(e(n))}else r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};ft.create=(e)=>new ft(e)});var J2=(e,t)=>{let r;switch(e.code){case b.invalid_type:if(e.received===N.undefined)r="Required";else r=`Expected ${e.expected}, received ${e.received}`;break;case b.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,re.jsonStringifyReplacer)}`;break;case b.unrecognized_keys:r=`Unrecognized key(s) in object: ${re.joinValues(e.keys,", ")}`;break;case b.invalid_union:r="Invalid input";break;case b.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${re.joinValues(e.options)}`;break;case b.invalid_enum_value:r=`Invalid enum value. Expected ${re.joinValues(e.options)}, received '${e.received}'`;break;case b.invalid_arguments:r="Invalid function arguments";break;case b.invalid_return_type:r="Invalid function return type";break;case b.invalid_date:r="Invalid date";break;case b.invalid_string:if(typeof e.validation==="object")if("includes"in e.validation){if(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==="number")r=`${r} at one or more positions greater than or equal to ${e.validation.position}`}else if("startsWith"in e.validation)r=`Invalid input: must start with "${e.validation.startsWith}"`;else if("endsWith"in e.validation)r=`Invalid input: must end with "${e.validation.endsWith}"`;else re.assertNever(e.validation);else if(e.validation!=="regex")r=`Invalid ${e.validation}`;else r="Invalid";break;case b.too_small:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="bigint")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`;else r="Invalid input";break;case b.too_big:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="bigint")r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`;else r="Invalid input";break;case b.custom:r="Invalid input";break;case b.invalid_intersection_types:r="Intersection results could not be merged";break;case b.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case b.not_finite:r="Number must be finite";break;default:r=t.defaultError,re.assertNever(e)}return{message:r}},fn;var Sl=F(()=>{Ha();Ro();fn=J2});function To(){return Q2}var Q2;var Ba=F(()=>{Sl();Q2=fn});function k(e,t){let r=To(),n=Wa({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===fn?void 0:fn].filter((s)=>!!s)});e.common.issues.push(n)}class Be{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(e,t){let r=[];for(let n of t){if(n.status==="aborted")return G;if(n.status==="dirty")e.dirty();r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let n of t){let s=await n.key,o=await n.value;r.push({key:s,value:o})}return Be.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:s,value:o}=n;if(s.status==="aborted")return G;if(o.status==="aborted")return G;if(s.status==="dirty")e.dirty();if(o.status==="dirty")e.dirty();if(s.value!=="__proto__"&&(typeof o.value<"u"||n.alwaysSet))r[s.value]=o.value}return{status:e.value,value:r}}}var Wa=(e)=>{let{data:t,path:r,errorMaps:n,issueData:s}=e,o=[...r,...s.path||[]],i={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let a="",c=n.filter((u)=>!!u).slice().reverse();for(let u of c)a=u(i,{data:t,defaultError:a}).message;return{...s,path:o,message:a}},G,ks=(e)=>({status:"dirty",value:e}),Qe=(e)=>({status:"valid",value:e}),xl=(e)=>e.status==="aborted",Rl=(e)=>e.status==="dirty",An=(e)=>e.status==="valid",ko=(e)=>typeof Promise<"u"&&e instanceof Promise;var Tl=F(()=>{Ba();Sl();G=Object.freeze({status:"aborted"})});var zw=()=>{};var D;var Gw=F(()=>{(function(e){e.errToObj=(t)=>typeof t==="string"?{message:t}:t||{},e.toString=(t)=>typeof t==="string"?t:t?.message})(D||(D={}))});class At{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}function Q(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:s}=e;if(t&&(r||n))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(t)return{errorMap:t,description:s};return{errorMap:(i,a)=>{let{message:c}=e;if(i.code==="invalid_enum_value")return{message:c??a.defaultError};if(typeof a.data>"u")return{message:c??n??a.defaultError};if(i.code!=="invalid_type")return{message:a.defaultError};return{message:c??r??a.defaultError}},description:s}}class ee{get description(){return this._def.description}_getType(e){return Er(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Er(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Be,ctx:{common:e.parent.common,data:e.data,parsedType:Er(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(ko(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Er(e)},n=this._parseSync({data:e,path:r.path,parent:r});return Kw(r,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Er(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return An(r)?{value:r.value}:{issues:t.common.issues}}catch(r){if(r?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((r)=>An(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Er(e)},n=this._parse({data:e,path:r.path,parent:r}),s=await(ko(n)?n:Promise.resolve(n));return Kw(r,s)}refine(e,t){let r=(n)=>{if(typeof t==="string"||typeof t>"u")return{message:t};else if(typeof t==="function")return t(n);else return t};return this._refinement((n,s)=>{let o=e(n),i=()=>s.addIssue({code:b.custom,...r(n)});if(typeof Promise<"u"&&o instanceof Promise)return o.then((a)=>{if(!a)return i(),!1;else return!0});if(!o)return i(),!1;else return!0})}refinement(e,t){return this._refinement((r,n)=>{if(!e(r))return n.addIssue(typeof t==="function"?t(r,n):t),!1;else return!0})}_refinement(e){return new lr({schema:this,typeName:K.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(t)=>this["~validate"](t)}}optional(){return ur.create(this,this._def)}nullable(){return pn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return cr.create(this)}promise(){return Is.create(this,this._def)}or(e){return Io.create([this,e],this._def)}and(e){return Co.create(this,e,this._def)}transform(e){return new lr({...Q(this._def),schema:this,typeName:K.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e==="function"?e:()=>e;return new Mo({...Q(this._def),innerType:this,defaultValue:t,typeName:K.ZodDefault})}brand(){return new Pl({typeName:K.ZodBranded,type:this,...Q(this._def)})}catch(e){let t=typeof e==="function"?e:()=>e;return new Lo({...Q(this._def),innerType:this,catchValue:t,typeName:K.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return rc.create(this,e)}readonly(){return Uo.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function Bw(e){let t="[0-5]\\d";if(e.precision)t=`${t}\\.\\d{${e.precision}}`;else if(e.precision==null)t=`${t}(\\.\\d+)?`;let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function mF(e){return new RegExp(`^${Bw(e)}$`)}function gF(e){let t=`${Hw}T${Bw(e)}`,r=[];if(r.push(e.local?"Z?":"Z"),e.offset)r.push("([+-]\\d{2}:?\\d{2})");return t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function yF(e,t){if((t==="v4"||!t)&&cF.test(e))return!0;if((t==="v6"||!t)&&lF.test(e))return!0;return!1}function _F(e,t){if(!sF.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));if(typeof s!=="object"||s===null)return!1;if("typ"in s&&s?.typ!=="JWT")return!1;if(!s.alg)return!1;if(t&&s.alg!==t)return!1;return!0}catch{return!1}}function vF(e,t){if((t==="v4"||!t)&&uF.test(e))return!0;if((t==="v6"||!t)&&dF.test(e))return!0;return!1}function $F(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=r>n?r:n,o=Number.parseInt(e.toFixed(s).replace(".","")),i=Number.parseInt(t.toFixed(s).replace(".",""));return o%i/10**s}function Os(e){if(e instanceof Ce){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=ur.create(Os(n))}return new Ce({...e._def,shape:()=>t})}else if(e instanceof cr)return new cr({...e._def,type:Os(e.element)});else if(e instanceof ur)return ur.create(Os(e.unwrap()));else if(e instanceof pn)return pn.create(Os(e.unwrap()));else if(e instanceof xr)return xr.create(e.items.map((t)=>Os(t)));else return e}function Ol(e,t){let r=Er(e),n=Er(t);if(e===t)return{valid:!0,data:e};else if(r===N.object&&n===N.object){let s=re.objectKeys(t),o=re.objectKeys(e).filter((a)=>s.indexOf(a)!==-1),i={...e,...t};for(let a of o){let c=Ol(e[a],t[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===N.array&&n===N.array){if(e.length!==t.length)return{valid:!1};let s=[];for(let o=0;o<e.length;o++){let i=e[o],a=t[o],c=Ol(i,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else if(r===N.date&&n===N.date&&+e===+t)return{valid:!0,data:e};else return{valid:!1}}function Ww(e,t){return new Nn({values:e,typeName:K.ZodEnum,...Q(t)})}var Kw=(e,t)=>{if(An(t))return{success:!0,data:t.value};else{if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new ft(e.common.issues);return this._error=r,this._error}}}},Z2,eF,tF,rF,nF,sF,oF,iF,aF="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",kl,cF,uF,lF,dF,fF,pF,Hw="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",hF,br,As,Ps,Ya,Ao,Xa,Po,No,Ja,Pn,Sr,Qa,cr,Ce,Io,wr=(e)=>{if(e instanceof jo)return wr(e.schema);else if(e instanceof lr)return wr(e.innerType());else if(e instanceof qo)return[e.value];else if(e instanceof Nn)return e.options;else if(e instanceof Do)return re.objectValues(e.enum);else if(e instanceof Mo)return wr(e._def.innerType);else if(e instanceof Po)return[void 0];else if(e instanceof No)return[null];else if(e instanceof ur)return[void 0,...wr(e.unwrap())];else if(e instanceof pn)return[null,...wr(e.unwrap())];else if(e instanceof Pl)return wr(e.unwrap());else if(e instanceof Uo)return wr(e.unwrap());else if(e instanceof Lo)return wr(e._def.innerType);else return[]},Al,Co,xr,Za,ec,Ns,Oo,jo,qo,Nn,Do,Is,lr,ur,pn,Mo,Lo,tc,M5,Pl,rc,Uo,L5,K,v,fe,U5,F5,Ue,V5,z5,G5,K5,H5,B5,W5,Y5,Ze,ne,X5,EF,Yw,J5,Q5,wF,Z5,e3,t3,r3,In,Ve,n3,s3,o3,i3,a3,c3,u3;var Xw=F(()=>{Ha();Ba();Gw();Tl();Ro();Z2=/^c[^\s-]{8,}$/i,eF=/^[0-9a-z]+$/,tF=/^[0-9A-HJKMNP-TV-Z]{26}$/i,rF=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,nF=/^[a-z0-9_-]{21}$/i,sF=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,oF=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,iF=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,cF=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,uF=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,lF=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,dF=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,fF=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,pF=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,hF=new RegExp(`^${Hw}$`);br=class br extends ee{_parse(e){if(this._def.coerce)e.data=String(e.data);if(this._getType(e)!==N.string){let s=this._getOrReturnCtx(e);return k(s,{code:b.invalid_type,expected:N.string,received:s.parsedType}),G}let r=new Be,n=void 0;for(let s of this._def.checks)if(s.kind==="min"){if(e.data.length<s.value)n=this._getOrReturnCtx(e,n),k(n,{code:b.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty()}else if(s.kind==="max"){if(e.data.length>s.value)n=this._getOrReturnCtx(e,n),k(n,{code:b.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty()}else if(s.kind==="length"){let o=e.data.length>s.value,i=e.data.length<s.value;if(o||i){if(n=this._getOrReturnCtx(e,n),o)k(n,{code:b.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message});else if(i)k(n,{code:b.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message});r.dirty()}}else if(s.kind==="email"){if(!iF.test(e.data))n=this._getOrReturnCtx(e,n),k(n,{validation:"email",code:b.invalid_string,message:s.message}),r.dirty()}else if(s.kind==="emoji"){if(!kl)kl=new RegExp(aF,"u");if(!kl.test(e.data))n=this._getOrReturnCtx(e,n),k(n,{validation:"emoji",code:b.invalid_string,message:s.message}),r.dirty()}else if(s.kind==="uuid"){if(!rF.test(e.data))n=this._getOrReturnCtx(e,n),k(n,{validation:"uuid",code:b.invalid_string,message:s.message}),r.dirty()}else if(s.kind==="nanoid"){if(!nF.test(e.data))n=this._getOrReturnCtx(e,n),k(n,{validation:"nanoid",code:b.invalid_string,message:s.message}),r.dirty()}else if(s.kind==="cuid"){if(!Z2.test(e.data))n=this._getOrReturnCtx(e,n),k(n,{validation:"cuid",code:b.invalid_string,message:s.message}),r.dirty()}else if(s.kind==="cuid2"){if(!eF.test(e.data))n=this._getOrReturnCtx(e,n),k(n,{validation:"cuid2",code:b.invalid_string,message:s.message}),r.dirty()}else if(s.kind==="ulid"){if(!tF.test(e.data))n=this._getOrReturnCtx(e,n),k(n,{validation:"ulid",code:b.invalid_string,message:s.message}),r.dirty()}else if(s.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),k(n,{validation:"url",code:b.invalid_string,message:s.message}),r.dirty()}else if(s.kind==="regex"){if(s.regex.lastIndex=0,!s.regex.test(e.data))n=this._getOrReturnCtx(e,n),k(n,{validation:"regex",code:b.invalid_string,message:s.message}),r.dirty()}else if(s.kind==="trim")e.data=e.data.trim();else if(s.kind==="includes"){if(!e.data.includes(s.value,s.position))n=this._getOrReturnCtx(e,n),k(n,{code:b.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()}else if(s.kind==="toLowerCase")e.data=e.data.toLowerCase();else if(s.kind==="toUpperCase")e.data=e.data.toUpperCase();else if(s.kind==="startsWith"){if(!e.data.startsWith(s.value))n=this._getOrReturnCtx(e,n),k(n,{code:b.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()}else if(s.kind==="endsWith"){if(!e.data.endsWith(s.value))n=this._getOrReturnCtx(e,n),k(n,{code:b.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()}else if(s.kind==="datetime"){if(!gF(s).test(e.data))n=this._getOrReturnCtx(e,n),k(n,{code:b.invalid_string,validation:"datetime",message:s.message}),r.dirty()}else if(s.kind==="date"){if(!hF.test(e.data))n=this._getOrReturnCtx(e,n),k(n,{code:b.invalid_string,validation:"date",message:s.message}),r.dirty()}else if(s.kind==="time"){if(!mF(s).test(e.data))n=this._getOrReturnCtx(e,n),k(n,{code:b.invalid_string,validation:"time",message:s.message}),r.dirty()}else if(s.kind==="duration"){if(!oF.test(e.data))n=this._getOrReturnCtx(e,n),k(n,{validation:"duration",code:b.invalid_string,message:s.message}),r.dirty()}else if(s.kind==="ip"){if(!yF(e.data,s.version))n=this._getOrReturnCtx(e,n),k(n,{validation:"ip",code:b.invalid_string,message:s.message}),r.dirty()}else if(s.kind==="jwt"){if(!_F(e.data,s.alg))n=this._getOrReturnCtx(e,n),k(n,{validation:"jwt",code:b.invalid_string,message:s.message}),r.dirty()}else if(s.kind==="cidr"){if(!vF(e.data,s.version))n=this._getOrReturnCtx(e,n),k(n,{validation:"cidr",code:b.invalid_string,message:s.message}),r.dirty()}else if(s.kind==="base64"){if(!fF.test(e.data))n=this._getOrReturnCtx(e,n),k(n,{validation:"base64",code:b.invalid_string,message:s.message}),r.dirty()}else if(s.kind==="base64url"){if(!pF.test(e.data))n=this._getOrReturnCtx(e,n),k(n,{validation:"base64url",code:b.invalid_string,message:s.message}),r.dirty()}else re.assertNever(s);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement((n)=>e.test(n),{validation:t,code:b.invalid_string,...D.errToObj(r)})}_addCheck(e){return new br({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...D.errToObj(e)})}url(e){return this._addCheck({kind:"url",...D.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...D.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...D.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...D.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...D.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...D.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...D.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...D.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...D.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...D.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...D.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...D.errToObj(e)})}datetime(e){if(typeof e==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e});return this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...D.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){if(typeof e==="string")return this._addCheck({kind:"time",precision:null,message:e});return this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...D.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...D.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...D.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...D.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...D.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...D.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...D.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...D.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...D.errToObj(t)})}nonempty(e){return this.min(1,D.errToObj(e))}trim(){return new br({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new br({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new br({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e)=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find((e)=>e.kind==="date")}get isTime(){return!!this._def.checks.find((e)=>e.kind==="time")}get isDuration(){return!!this._def.checks.find((e)=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find((e)=>e.kind==="email")}get isURL(){return!!this._def.checks.find((e)=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find((e)=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find((e)=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((e)=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((e)=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((e)=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find((e)=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find((e)=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find((e)=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find((e)=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find((e)=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxLength(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}};br.create=(e)=>new br({checks:[],typeName:K.ZodString,coerce:e?.coerce??!1,...Q(e)});As=class As extends ee{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce)e.data=Number(e.data);if(this._getType(e)!==N.number){let s=this._getOrReturnCtx(e);return k(s,{code:b.invalid_type,expected:N.number,received:s.parsedType}),G}let r=void 0,n=new Be;for(let s of this._def.checks)if(s.kind==="int"){if(!re.isInteger(e.data))r=this._getOrReturnCtx(e,r),k(r,{code:b.invalid_type,expected:"integer",received:"float",message:s.message}),n.dirty()}else if(s.kind==="min"){if(s.inclusive?e.data<s.value:e.data<=s.value)r=this._getOrReturnCtx(e,r),k(r,{code:b.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()}else if(s.kind==="max"){if(s.inclusive?e.data>s.value:e.data>=s.value)r=this._getOrReturnCtx(e,r),k(r,{code:b.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()}else if(s.kind==="multipleOf"){if($F(e.data,s.value)!==0)r=this._getOrReturnCtx(e,r),k(r,{code:b.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()}else if(s.kind==="finite"){if(!Number.isFinite(e.data))r=this._getOrReturnCtx(e,r),k(r,{code:b.not_finite,message:s.message}),n.dirty()}else re.assertNever(s);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,D.toString(t))}gt(e,t){return this.setLimit("min",e,!1,D.toString(t))}lte(e,t){return this.setLimit("max",e,!0,D.toString(t))}lt(e,t){return this.setLimit("max",e,!1,D.toString(t))}setLimit(e,t,r,n){return new As({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:D.toString(n)}]})}_addCheck(e){return new As({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:D.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:D.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:D.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:D.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:D.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:D.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:D.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:D.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:D.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}get isInt(){return!!this._def.checks.find((e)=>e.kind==="int"||e.kind==="multipleOf"&&re.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;else if(r.kind==="min"){if(t===null||r.value>t)t=r.value}else if(r.kind==="max"){if(e===null||r.value<e)e=r.value}return Number.isFinite(t)&&Number.isFinite(e)}};As.create=(e)=>new As({checks:[],typeName:K.ZodNumber,coerce:e?.coerce||!1,...Q(e)});Ps=class Ps extends ee{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==N.bigint)return this._getInvalidInput(e);let r=void 0,n=new Be;for(let s of this._def.checks)if(s.kind==="min"){if(s.inclusive?e.data<s.value:e.data<=s.value)r=this._getOrReturnCtx(e,r),k(r,{code:b.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty()}else if(s.kind==="max"){if(s.inclusive?e.data>s.value:e.data>=s.value)r=this._getOrReturnCtx(e,r),k(r,{code:b.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty()}else if(s.kind==="multipleOf"){if(e.data%s.value!==BigInt(0))r=this._getOrReturnCtx(e,r),k(r,{code:b.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()}else re.assertNever(s);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return k(t,{code:b.invalid_type,expected:N.bigint,received:t.parsedType}),G}gte(e,t){return this.setLimit("min",e,!0,D.toString(t))}gt(e,t){return this.setLimit("min",e,!1,D.toString(t))}lte(e,t){return this.setLimit("max",e,!0,D.toString(t))}lt(e,t){return this.setLimit("max",e,!1,D.toString(t))}setLimit(e,t,r,n){return new Ps({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:D.toString(n)}]})}_addCheck(e){return new Ps({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:D.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:D.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:D.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:D.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:D.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}};Ps.create=(e)=>new Ps({checks:[],typeName:K.ZodBigInt,coerce:e?.coerce??!1,...Q(e)});Ya=class Ya extends ee{_parse(e){if(this._def.coerce)e.data=Boolean(e.data);if(this._getType(e)!==N.boolean){let r=this._getOrReturnCtx(e);return k(r,{code:b.invalid_type,expected:N.boolean,received:r.parsedType}),G}return Qe(e.data)}};Ya.create=(e)=>new Ya({typeName:K.ZodBoolean,coerce:e?.coerce||!1,...Q(e)});Ao=class Ao extends ee{_parse(e){if(this._def.coerce)e.data=new Date(e.data);if(this._getType(e)!==N.date){let s=this._getOrReturnCtx(e);return k(s,{code:b.invalid_type,expected:N.date,received:s.parsedType}),G}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return k(s,{code:b.invalid_date}),G}let r=new Be,n=void 0;for(let s of this._def.checks)if(s.kind==="min"){if(e.data.getTime()<s.value)n=this._getOrReturnCtx(e,n),k(n,{code:b.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()}else if(s.kind==="max"){if(e.data.getTime()>s.value)n=this._getOrReturnCtx(e,n),k(n,{code:b.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()}else re.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ao({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:D.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:D.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e!=null?new Date(e):null}};Ao.create=(e)=>new Ao({checks:[],coerce:e?.coerce||!1,typeName:K.ZodDate,...Q(e)});Xa=class Xa extends ee{_parse(e){if(this._getType(e)!==N.symbol){let r=this._getOrReturnCtx(e);return k(r,{code:b.invalid_type,expected:N.symbol,received:r.parsedType}),G}return Qe(e.data)}};Xa.create=(e)=>new Xa({typeName:K.ZodSymbol,...Q(e)});Po=class Po extends ee{_parse(e){if(this._getType(e)!==N.undefined){let r=this._getOrReturnCtx(e);return k(r,{code:b.invalid_type,expected:N.undefined,received:r.parsedType}),G}return Qe(e.data)}};Po.create=(e)=>new Po({typeName:K.ZodUndefined,...Q(e)});No=class No extends ee{_parse(e){if(this._getType(e)!==N.null){let r=this._getOrReturnCtx(e);return k(r,{code:b.invalid_type,expected:N.null,received:r.parsedType}),G}return Qe(e.data)}};No.create=(e)=>new No({typeName:K.ZodNull,...Q(e)});Ja=class Ja extends ee{constructor(){super(...arguments);this._any=!0}_parse(e){return Qe(e.data)}};Ja.create=(e)=>new Ja({typeName:K.ZodAny,...Q(e)});Pn=class Pn extends ee{constructor(){super(...arguments);this._unknown=!0}_parse(e){return Qe(e.data)}};Pn.create=(e)=>new Pn({typeName:K.ZodUnknown,...Q(e)});Sr=class Sr extends ee{_parse(e){let t=this._getOrReturnCtx(e);return k(t,{code:b.invalid_type,expected:N.never,received:t.parsedType}),G}};Sr.create=(e)=>new Sr({typeName:K.ZodNever,...Q(e)});Qa=class Qa extends ee{_parse(e){if(this._getType(e)!==N.undefined){let r=this._getOrReturnCtx(e);return k(r,{code:b.invalid_type,expected:N.void,received:r.parsedType}),G}return Qe(e.data)}};Qa.create=(e)=>new Qa({typeName:K.ZodVoid,...Q(e)});cr=class cr extends ee{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==N.array)return k(t,{code:b.invalid_type,expected:N.array,received:t.parsedType}),G;if(n.exactLength!==null){let o=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;if(o||i)k(t,{code:o?b.too_big:b.too_small,minimum:i?n.exactLength.value:void 0,maximum:o?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty()}if(n.minLength!==null){if(t.data.length<n.minLength.value)k(t,{code:b.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()}if(n.maxLength!==null){if(t.data.length>n.maxLength.value)k(t,{code:b.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()}if(t.common.async)return Promise.all([...t.data].map((o,i)=>n.type._parseAsync(new At(t,o,t.path,i)))).then((o)=>Be.mergeArray(r,o));let s=[...t.data].map((o,i)=>n.type._parseSync(new At(t,o,t.path,i)));return Be.mergeArray(r,s)}get element(){return this._def.type}min(e,t){return new cr({...this._def,minLength:{value:e,message:D.toString(t)}})}max(e,t){return new cr({...this._def,maxLength:{value:e,message:D.toString(t)}})}length(e,t){return new cr({...this._def,exactLength:{value:e,message:D.toString(t)}})}nonempty(e){return this.min(1,e)}};cr.create=(e,t)=>new cr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:K.ZodArray,...Q(t)});Ce=class Ce extends ee{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=re.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==N.object){let c=this._getOrReturnCtx(e);return k(c,{code:b.invalid_type,expected:N.object,received:c.parsedType}),G}let{status:r,ctx:n}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof Sr&&this._def.unknownKeys==="strip")){for(let c in n.data)if(!o.includes(c))i.push(c)}let a=[];for(let c of o){let u=s[c],d=n.data[c];a.push({key:{status:"valid",value:c},value:u._parse(new At(n,d,n.path,c)),alwaysSet:c in n.data})}if(this._def.catchall instanceof Sr){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of i)a.push({key:{status:"valid",value:u},value:{status:"valid",value:n.data[u]}});else if(c==="strict"){if(i.length>0)k(n,{code:b.unrecognized_keys,keys:i}),r.dirty()}else if(c==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of i){let d=n.data[u];a.push({key:{status:"valid",value:u},value:c._parse(new At(n,d,n.path,u)),alwaysSet:u in n.data})}}if(n.common.async)return Promise.resolve().then(async()=>{let c=[];for(let u of a){let d=await u.key,l=await u.value;c.push({key:d,value:l,alwaysSet:u.alwaysSet})}return c}).then((c)=>Be.mergeObjectSync(r,c));else return Be.mergeObjectSync(r,a)}get shape(){return this._def.shape()}strict(e){return D.errToObj,new Ce({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let n=this._def.errorMap?.(t,r).message??r.defaultError;if(t.code==="unrecognized_keys")return{message:D.errToObj(e).message??n};return{message:n}}}:{}})}strip(){return new Ce({...this._def,unknownKeys:"strip"})}passthrough(){return new Ce({...this._def,unknownKeys:"passthrough"})}extend(e){return new Ce({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Ce({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:K.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Ce({...this._def,catchall:e})}pick(e){let t={};for(let r of re.objectKeys(e))if(e[r]&&this.shape[r])t[r]=this.shape[r];return new Ce({...this._def,shape:()=>t})}omit(e){let t={};for(let r of re.objectKeys(this.shape))if(!e[r])t[r]=this.shape[r];return new Ce({...this._def,shape:()=>t})}deepPartial(){return Os(this)}partial(e){let t={};for(let r of re.objectKeys(this.shape)){let n=this.shape[r];if(e&&!e[r])t[r]=n;else t[r]=n.optional()}return new Ce({...this._def,shape:()=>t})}required(e){let t={};for(let r of re.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let s=this.shape[r];while(s instanceof ur)s=s._def.innerType;t[r]=s}return new Ce({...this._def,shape:()=>t})}keyof(){return Ww(re.objectKeys(this.shape))}};Ce.create=(e,t)=>new Ce({shape:()=>e,unknownKeys:"strip",catchall:Sr.create(),typeName:K.ZodObject,...Q(t)});Ce.strictCreate=(e,t)=>new Ce({shape:()=>e,unknownKeys:"strict",catchall:Sr.create(),typeName:K.ZodObject,...Q(t)});Ce.lazycreate=(e,t)=>new Ce({shape:e,unknownKeys:"strip",catchall:Sr.create(),typeName:K.ZodObject,...Q(t)});Io=class Io extends ee{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function n(s){for(let i of s)if(i.result.status==="valid")return i.result;for(let i of s)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;let o=s.map((i)=>new ft(i.ctx.common.issues));return k(t,{code:b.invalid_union,unionErrors:o}),G}if(t.common.async)return Promise.all(r.map(async(s)=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await s._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(n);else{let s=void 0,o=[];for(let a of r){let c={...t,common:{...t.common,issues:[]},parent:null},u=a._parseSync({data:t.data,path:t.path,parent:c});if(u.status==="valid")return u;else if(u.status==="dirty"&&!s)s={result:u,ctx:c};if(c.common.issues.length)o.push(c.common.issues)}if(s)return t.common.issues.push(...s.ctx.common.issues),s.result;let i=o.map((a)=>new ft(a));return k(t,{code:b.invalid_union,unionErrors:i}),G}}get options(){return this._def.options}};Io.create=(e,t)=>new Io({options:e,typeName:K.ZodUnion,...Q(t)});Al=class Al extends ee{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==N.object)return k(t,{code:b.invalid_type,expected:N.object,received:t.parsedType}),G;let r=this.discriminator,n=t.data[r],s=this.optionsMap.get(n);if(!s)return k(t,{code:b.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),G;if(t.common.async)return s._parseAsync({data:t.data,path:t.path,parent:t});else return s._parseSync({data:t.data,path:t.path,parent:t})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let n=new Map;for(let s of t){let o=wr(s.shape[e]);if(!o.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of o){if(n.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,s)}}return new Al({typeName:K.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...Q(r)})}};Co=class Co extends ee{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=(s,o)=>{if(xl(s)||xl(o))return G;let i=Ol(s.value,o.value);if(!i.valid)return k(r,{code:b.invalid_intersection_types}),G;if(Rl(s)||Rl(o))t.dirty();return{status:t.value,value:i.data}};if(r.common.async)return Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,o])=>n(s,o));else return n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Co.create=(e,t,r)=>new Co({left:e,right:t,typeName:K.ZodIntersection,...Q(r)});xr=class xr extends ee{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==N.array)return k(r,{code:b.invalid_type,expected:N.array,received:r.parsedType}),G;if(r.data.length<this._def.items.length)return k(r,{code:b.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),G;if(!this._def.rest&&r.data.length>this._def.items.length)k(r,{code:b.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty();let s=[...r.data].map((o,i)=>{let a=this._def.items[i]||this._def.rest;if(!a)return null;return a._parse(new At(r,o,r.path,i))}).filter((o)=>!!o);if(r.common.async)return Promise.all(s).then((o)=>Be.mergeArray(t,o));else return Be.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new xr({...this._def,rest:e})}};xr.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new xr({items:e,typeName:K.ZodTuple,rest:null,...Q(t)})};Za=class Za extends ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==N.object)return k(r,{code:b.invalid_type,expected:N.object,received:r.parsedType}),G;let n=[],s=this._def.keyType,o=this._def.valueType;for(let i in r.data)n.push({key:s._parse(new At(r,i,r.path,i)),value:o._parse(new At(r,r.data[i],r.path,i)),alwaysSet:i in r.data});if(r.common.async)return Be.mergeObjectAsync(t,n);else return Be.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){if(t instanceof ee)return new Za({keyType:e,valueType:t,typeName:K.ZodRecord,...Q(r)});return new Za({keyType:br.create(),valueType:e,typeName:K.ZodRecord,...Q(t)})}};ec=class ec extends ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==N.map)return k(r,{code:b.invalid_type,expected:N.map,received:r.parsedType}),G;let n=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([i,a],c)=>({key:n._parse(new At(r,i,r.path,[c,"key"])),value:s._parse(new At(r,a,r.path,[c,"value"]))}));if(r.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let a of o){let c=await a.key,u=await a.value;if(c.status==="aborted"||u.status==="aborted")return G;if(c.status==="dirty"||u.status==="dirty")t.dirty();i.set(c.value,u.value)}return{status:t.value,value:i}})}else{let i=new Map;for(let a of o){let{key:c,value:u}=a;if(c.status==="aborted"||u.status==="aborted")return G;if(c.status==="dirty"||u.status==="dirty")t.dirty();i.set(c.value,u.value)}return{status:t.value,value:i}}}};ec.create=(e,t,r)=>new ec({valueType:t,keyType:e,typeName:K.ZodMap,...Q(r)});Ns=class Ns extends ee{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==N.set)return k(r,{code:b.invalid_type,expected:N.set,received:r.parsedType}),G;let n=this._def;if(n.minSize!==null){if(r.data.size<n.minSize.value)k(r,{code:b.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()}if(n.maxSize!==null){if(r.data.size>n.maxSize.value)k(r,{code:b.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty()}let s=this._def.valueType;function o(a){let c=new Set;for(let u of a){if(u.status==="aborted")return G;if(u.status==="dirty")t.dirty();c.add(u.value)}return{status:t.value,value:c}}let i=[...r.data.values()].map((a,c)=>s._parse(new At(r,a,r.path,c)));if(r.common.async)return Promise.all(i).then((a)=>o(a));else return o(i)}min(e,t){return new Ns({...this._def,minSize:{value:e,message:D.toString(t)}})}max(e,t){return new Ns({...this._def,maxSize:{value:e,message:D.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Ns.create=(e,t)=>new Ns({valueType:e,minSize:null,maxSize:null,typeName:K.ZodSet,...Q(t)});Oo=class Oo extends ee{constructor(){super(...arguments);this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==N.function)return k(t,{code:b.invalid_type,expected:N.function,received:t.parsedType}),G;function r(i,a){return Wa({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,To(),fn].filter((c)=>!!c),issueData:{code:b.invalid_arguments,argumentsError:a}})}function n(i,a){return Wa({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,To(),fn].filter((c)=>!!c),issueData:{code:b.invalid_return_type,returnTypeError:a}})}let s={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Is){let i=this;return Qe(async function(...a){let c=new ft([]),u=await i._def.args.parseAsync(a,s).catch((p)=>{throw c.addIssue(r(a,p)),c}),d=await Reflect.apply(o,this,u);return await i._def.returns._def.type.parseAsync(d,s).catch((p)=>{throw c.addIssue(n(d,p)),c})})}else{let i=this;return Qe(function(...a){let c=i._def.args.safeParse(a,s);if(!c.success)throw new ft([r(a,c.error)]);let u=Reflect.apply(o,this,c.data),d=i._def.returns.safeParse(u,s);if(!d.success)throw new ft([n(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Oo({...this._def,args:xr.create(e).rest(Pn.create())})}returns(e){return new Oo({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Oo({args:e?e:xr.create([]).rest(Pn.create()),returns:t||Pn.create(),typeName:K.ZodFunction,...Q(r)})}};jo=class jo extends ee{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};jo.create=(e,t)=>new jo({getter:e,typeName:K.ZodLazy,...Q(t)});qo=class qo extends ee{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return k(t,{received:t.data,code:b.invalid_literal,expected:this._def.value}),G}return{status:"valid",value:e.data}}get value(){return this._def.value}};qo.create=(e,t)=>new qo({value:e,typeName:K.ZodLiteral,...Q(t)});Nn=class Nn extends ee{_parse(e){if(typeof e.data!=="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return k(t,{expected:re.joinValues(r),received:t.parsedType,code:b.invalid_type}),G}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return k(t,{received:t.data,code:b.invalid_enum_value,options:r}),G}return Qe(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Nn.create(e,{...this._def,...t})}exclude(e,t=this._def){return Nn.create(this.options.filter((r)=>!e.includes(r)),{...this._def,...t})}};Nn.create=Ww;Do=class Do extends ee{_parse(e){let t=re.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==N.string&&r.parsedType!==N.number){let n=re.objectValues(t);return k(r,{expected:re.joinValues(n),received:r.parsedType,code:b.invalid_type}),G}if(!this._cache)this._cache=new Set(re.getValidEnumValues(this._def.values));if(!this._cache.has(e.data)){let n=re.objectValues(t);return k(r,{received:r.data,code:b.invalid_enum_value,options:n}),G}return Qe(e.data)}get enum(){return this._def.values}};Do.create=(e,t)=>new Do({values:e,typeName:K.ZodNativeEnum,...Q(t)});Is=class Is extends ee{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==N.promise&&t.common.async===!1)return k(t,{code:b.invalid_type,expected:N.promise,received:t.parsedType}),G;let r=t.parsedType===N.promise?t.data:Promise.resolve(t.data);return Qe(r.then((n)=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Is.create=(e,t)=>new Is({type:e,typeName:K.ZodPromise,...Q(t)});lr=class lr extends ee{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===K.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,s={addIssue:(o)=>{if(k(r,o),o.fatal)t.abort();else t.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),n.type==="preprocess"){let o=n.transform(r.data,s);if(r.common.async)return Promise.resolve(o).then(async(i)=>{if(t.value==="aborted")return G;let a=await this._def.schema._parseAsync({data:i,path:r.path,parent:r});if(a.status==="aborted")return G;if(a.status==="dirty")return ks(a.value);if(t.value==="dirty")return ks(a.value);return a});else{if(t.value==="aborted")return G;let i=this._def.schema._parseSync({data:o,path:r.path,parent:r});if(i.status==="aborted")return G;if(i.status==="dirty")return ks(i.value);if(t.value==="dirty")return ks(i.value);return i}}if(n.type==="refinement"){let o=(i)=>{let a=n.refinement(i,s);if(r.common.async)return Promise.resolve(a);if(a instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(i.status==="aborted")return G;if(i.status==="dirty")t.dirty();return o(i.value),{status:t.value,value:i.value}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((i)=>{if(i.status==="aborted")return G;if(i.status==="dirty")t.dirty();return o(i.value).then(()=>({status:t.value,value:i.value}))})}if(n.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!An(o))return G;let i=n.transform(o.value,s);if(i instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((o)=>{if(!An(o))return G;return Promise.resolve(n.transform(o.value,s)).then((i)=>({status:t.value,value:i}))});re.assertNever(n)}};lr.create=(e,t,r)=>new lr({schema:e,typeName:K.ZodEffects,effect:t,...Q(r)});lr.createWithPreprocess=(e,t,r)=>new lr({schema:t,effect:{type:"preprocess",transform:e},typeName:K.ZodEffects,...Q(r)});ur=class ur extends ee{_parse(e){if(this._getType(e)===N.undefined)return Qe(void 0);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ur.create=(e,t)=>new ur({innerType:e,typeName:K.ZodOptional,...Q(t)});pn=class pn extends ee{_parse(e){if(this._getType(e)===N.null)return Qe(null);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};pn.create=(e,t)=>new pn({innerType:e,typeName:K.ZodNullable,...Q(t)});Mo=class Mo extends ee{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;if(t.parsedType===N.undefined)r=this._def.defaultValue();return this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Mo.create=(e,t)=>new Mo({innerType:e,typeName:K.ZodDefault,defaultValue:typeof t.default==="function"?t.default:()=>t.default,...Q(t)});Lo=class Lo extends ee{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});if(ko(n))return n.then((s)=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ft(r.common.issues)},input:r.data})}));else return{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new ft(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Lo.create=(e,t)=>new Lo({innerType:e,typeName:K.ZodCatch,catchValue:typeof t.catch==="function"?t.catch:()=>t.catch,...Q(t)});tc=class tc extends ee{_parse(e){if(this._getType(e)!==N.nan){let r=this._getOrReturnCtx(e);return k(r,{code:b.invalid_type,expected:N.nan,received:r.parsedType}),G}return{status:"valid",value:e.data}}};tc.create=(e)=>new tc({typeName:K.ZodNaN,...Q(e)});M5=Symbol("zod_brand");Pl=class Pl extends ee{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}};rc=class rc extends ee{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});if(s.status==="aborted")return G;if(s.status==="dirty")return t.dirty(),ks(s.value);else return this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();else{let n=this._def.in._parseSync({data:r.data,path:r.path,parent:r});if(n.status==="aborted")return G;if(n.status==="dirty")return t.dirty(),{status:"dirty",value:n.value};else return this._def.out._parseSync({data:n.value,path:r.path,parent:r})}}static create(e,t){return new rc({in:e,out:t,typeName:K.ZodPipeline})}};Uo=class Uo extends ee{_parse(e){let t=this._def.innerType._parse(e),r=(n)=>{if(An(n))n.value=Object.freeze(n.value);return n};return ko(t)?t.then((n)=>r(n)):r(t)}unwrap(){return this._def.innerType}};Uo.create=(e,t)=>new Uo({innerType:e,typeName:K.ZodReadonly,...Q(t)});L5={object:Ce.lazycreate};(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(K||(K={}));v=br.create,fe=As.create,U5=tc.create,F5=Ps.create,Ue=Ya.create,V5=Ao.create,z5=Xa.create,G5=Po.create,K5=No.create,H5=Ja.create,B5=Pn.create,W5=Sr.create,Y5=Qa.create,Ze=cr.create,ne=Ce.create,X5=Ce.strictCreate,EF=Io.create,Yw=Al.create,J5=Co.create,Q5=xr.create,wF=Za.create,Z5=ec.create,e3=Ns.create,t3=Oo.create,r3=jo.create,In=qo.create,Ve=Nn.create,n3=Do.create,s3=Is.create,o3=lr.create,i3=ur.create,a3=pn.create,c3=lr.createWithPreprocess,u3=rc.create});var Nl=F(()=>{Ba();Tl();zw();Ro();Xw();Ha()});var jn=F(()=>{Nl();Nl()});function $3(e){return SF.includes(e)}var bF,qn,SF,E3,xF,Jw,RF,Qw,TF,kF,w3,OF,b3,S3,x3,R3,AF,Zw,PF,eb,T3=20,k3=500,NF,O3;var nc=F(()=>{jn();bF=Ve(["pending","verified","approved","revoked"]),qn=Ve(["person","service","test"]),SF=qn.options;E3={nemarOwner:"service",nemarAdmin:"service","test-admin":"service","test-owner":"service","cool-vibers":"test","test-user":"test","test-pending":"test","test-verified":"test","test-revoked":"test"},xF=Ve(["same_kind","orcid_linked","own_account","kind_changed_concurrently"]),Jw=xF.options,RF=Ve(["active","pending","revoked"]),Qw=ne({field:v(),blocks:Ze(v()).optional(),set_on:Ze(v()).optional()}).passthrough(),TF=ne({id:fe().int(),username:v().nullable(),email:v(),github_username:v().nullable(),role:v(),orcid:v().nullable().optional(),created_at:v().optional(),approved_at:v().nullable().optional(),dataset_count:fe().int().optional(),sandbox_completed:Ue().optional(),sandbox_completed_at:v().nullable().optional(),sandbox_dataset_id:v().nullable().optional(),service_access:Ue().optional(),status:bF.optional(),email_verified:Ue().optional(),orcid_verified:Ue().optional(),given_name:v().nullable().optional(),family_name:v().nullable().optional(),profile_gaps:Ze(Qw).optional(),username_auto_assigned:Ue().optional(),account_kind:qn.optional()}).passthrough(),kF=ne({prefix:v(),created_at:v(),last_used_at:v().nullable()}).passthrough().nullable(),w3=ne({user:TF,token:kF.optional()}).passthrough(),OF=ne({id:fe().int(),username:v().nullable(),email:v(),github_username:v().nullable(),status:v(),email_verified:fe().int().nullable().optional(),role:v().nullable(),created_at:v(),approved_at:v().nullable().optional(),revoked_at:v().nullable().optional(),signup_source:v().nullable().optional(),service_access:fe().int().nullable().optional(),service_access_granted_at:v().nullable().optional(),given_name:v().nullable().optional(),family_name:v().nullable().optional(),orcid:v().nullable().optional(),upload_access_requested_at:v().nullable().optional(),account_kind:qn.optional(),matched_in:Ze(v()).optional(),match_kind:v().optional()}).passthrough(),b3=ne({users:Ze(OF),count:fe().int()}).passthrough(),S3=Ve(["assigned","would_assign","single_name","no_name","lookup_failed","conflict","exhausted","write_failed"]),x3=Ve(["sent","already_verified","skipped_fence","rate_limited","failed","not_attempted"]),R3=ne({suggestion:v().nullable(),based_on:Ve(["name","unavailable","exhausted"])}).passthrough(),AF=Ve(["why_required","email_not_verified","profile_incomplete","github_username_unverified","github_unavailable","already_approved"]),Zw=AF.options,PF=Ve(["invalid_github_username","city_required","country_required","empty_patch","username_too_short","username_too_long","username_charset","username_reserved","given_name_required","family_name_required","username_taken","username_locked","name_is_orcid_canonical","account_revoked","github_unavailable","same_email","code_expired","code_incorrect","orcid_already_have","orcid_unavailable"]),eb=PF.options,NF=ne({id:fe().int(),email:v(),username:v().nullable(),role:v(),status:RF,email_verified:Ue(),given_name:v().nullable(),family_name:v().nullable(),orcid:v().nullable(),orcid_verified:Ue(),github_username:v().nullable(),city:v().nullable(),country:v().nullable(),affiliation:v().nullable(),service_access:Ue(),service_access_granted_at:v().nullable(),upload_access_requested_at:v().nullable(),profile_gaps:Ze(Qw),username_auto_assigned:Ue()}).passthrough(),O3=ne({user:NF.nullable()}).passthrough()});function dr(e){if(e instanceof Error)return e.message;return String(e)}function P3(e){if(!(e instanceof fr)||e.statusCode!==404)return!1;let t=e.rawBody;return typeof t==="object"&&t!==null&&t.error==="Not Found"&&typeof t.message==="string"}var fr,Il;var Cl=F(()=>{fr=class fr extends Error{statusCode;details;step;blockReason;missing;code;reason;rawBody;constructor(e,t,r,n,s,o){super(t);this.statusCode=e;this.details=r;this.step=n;this.blockReason=s;this.missing=o;this.name="ApiError"}};Il=class Il extends fr{mode;eta;constructor(e,t,r,n){super(503,t,n);this.mode=e;this.eta=r;this.name="MaintenanceError"}}});function jF(){let e=new Map;for(let[t,r]of Object.entries(we)){for(let[n,s]of Object.entries(r))we[n]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},r[n]=we[n],e.set(s[0],s[1]);Object.defineProperty(we,t,{value:r,enumerable:!1})}return Object.defineProperty(we,"codes",{value:e,enumerable:!1}),we.color.close="\x1B[39m",we.bgColor.close="\x1B[49m",we.color.ansi=tb(),we.color.ansi256=rb(),we.color.ansi16m=nb(),we.bgColor.ansi=tb(10),we.bgColor.ansi256=rb(10),we.bgColor.ansi16m=nb(10),Object.defineProperties(we,{rgbToAnsi256:{value(t,r,n){if(t===r&&r===n){if(t<8)return 16;if(t>248)return 231;return Math.round((t-8)/247*24)+232}return 16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(t){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[n]=r;if(n.length===3)n=[...n].map((o)=>o+o).join("");let s=Number.parseInt(n,16);return[s>>16&255,s>>8&255,s&255]},enumerable:!1},hexToAnsi256:{value:(t)=>we.rgbToAnsi256(...we.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,n,s;if(t>=232)r=((t-232)*10+8)/255,n=r,s=r;else{t-=16;let a=t%36;r=Math.floor(t/36)/5,n=Math.floor(a/6)/5,s=a%6/5}let o=Math.max(r,n,s)*2;if(o===0)return 30;let i=30+(Math.round(s)<<2|Math.round(n)<<1|Math.round(r));if(o===2)i+=60;return i},enumerable:!1},rgbToAnsi:{value:(t,r,n)=>we.ansi256ToAnsi(we.rgbToAnsi256(t,r,n)),enumerable:!1},hexToAnsi:{value:(t)=>we.ansi256ToAnsi(we.hexToAnsi256(t)),enumerable:!1}}),we}var tb=(e=0)=>(t)=>`\x1B[${t+e}m`,rb=(e=0)=>(t)=>`\x1B[${38+e};5;${t}m`,nb=(e=0)=>(t,r,n)=>`\x1B[${38+e};2;${t};${r};${n}m`,we,I3,IF,CF,C3,qF,Pt;var sb=F(()=>{we={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},I3=Object.keys(we.modifier),IF=Object.keys(we.color),CF=Object.keys(we.bgColor),C3=[...IF,...CF];qF=jF(),Pt=qF});import jl from"process";import DF from"os";import ob from"tty";function bt(e,t=globalThis.Deno?globalThis.Deno.args:jl.argv){let r=e.startsWith("-")?"":e.length===1?"-":"--",n=t.indexOf(r+e),s=t.indexOf("--");return n!==-1&&(s===-1||n<s)}function MF(){if("FORCE_COLOR"in be){if(be.FORCE_COLOR==="true")return 1;if(be.FORCE_COLOR==="false")return 0;return be.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(be.FORCE_COLOR,10),3)}}function LF(e){if(e===0)return!1;return{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function UF(e,{streamIsTTY:t,sniffFlags:r=!0}={}){let n=MF();if(n!==void 0)sc=n;let s=r?sc:n;if(s===0)return 0;if(r){if(bt("color=16m")||bt("color=full")||bt("color=truecolor"))return 3;if(bt("color=256"))return 2}if("TF_BUILD"in be&&"AGENT_NAME"in be)return 1;if(e&&!t&&s===void 0)return 0;let o=s||0;if(be.TERM==="dumb")return o;if(jl.platform==="win32"){let i=DF.release().split(".");if(Number(i[0])>=10&&Number(i[2])>=10586)return Number(i[2])>=14931?3:2;return 1}if("CI"in be){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((i)=>(i in be)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((i)=>(i in be))||be.CI_NAME==="codeship")return 1;return o}if("TEAMCITY_VERSION"in be)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(be.TEAMCITY_VERSION)?1:0;if(be.COLORTERM==="truecolor")return 3;if(be.TERM==="xterm-kitty")return 3;if(be.TERM==="xterm-ghostty")return 3;if(be.TERM==="wezterm")return 3;if("TERM_PROGRAM"in be){let i=Number.parseInt((be.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(be.TERM_PROGRAM){case"iTerm.app":return i>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(be.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(be.TERM))return 1;if("COLORTERM"in be)return 1;return o}function ib(e,t={}){let r=UF(e,{streamIsTTY:e&&e.isTTY,...t});return LF(r)}var be,sc,FF,ab;var cb=F(()=>{({env:be}=jl);if(bt("no-color")||bt("no-colors")||bt("color=false")||bt("color=never"))sc=0;else if(bt("color")||bt("colors")||bt("color=true")||bt("color=always"))sc=1;FF={stdout:ib({isTTY:ob.isatty(1)}),stderr:ib({isTTY:ob.isatty(2)})},ab=FF});function ub(e,t,r){let n=e.indexOf(t);if(n===-1)return e;let s=t.length,o=0,i="";do i+=e.slice(o,n)+t+r,o=n+s,n=e.indexOf(t,o);while(n!==-1);return i+=e.slice(o),i}function lb(e,t,r,n){let s=0,o="";do{let i=e[n-1]==="\r";o+=e.slice(s,i?n-1:n)+t+(i?`\r
|
|
18
|
+
${t}`,zM,GM,KM=(e,t,r)=>{let n=r===""?"":`with ${r.trim()}() `,s=VM.bind(null,n,t.toString());Object.defineProperty(s,"name",GM);let{writable:o,enumerable:i,configurable:a}=zM;Object.defineProperty(e,"toString",{value:s,writable:o,enumerable:i,configurable:a})};var V$=F(()=>{zM=Object.getOwnPropertyDescriptor(Function.prototype,"toString"),GM=Object.getOwnPropertyDescriptor(Function.prototype.toString,"name")});var HM=(e,t={})=>{if(typeof e!=="function")throw TypeError(`Expected the first argument to be a function, got \`${typeof e}\``);let{wait:r=0,maxWait:n=Number.POSITIVE_INFINITY,before:s=!1,after:o=!0}=t;if(r<0||n<0)throw RangeError("`wait` and `maxWait` must not be negative.");if(!s&&!o)throw Error("Both `before` and `after` are false, function wouldn't be called.");let i,a,c,u=function(...d){let l=this,p=()=>{if(i=void 0,a)clearTimeout(a),a=void 0;if(o)c=e.apply(l,d)},f=()=>{if(a=void 0,i)clearTimeout(i),i=void 0;if(o)c=e.apply(l,d)},h=s&&!i;if(clearTimeout(i),i=setTimeout(p,r),n>0&&n!==Number.POSITIVE_INFINITY&&!a)a=setTimeout(f,n);if(h)c=e.apply(l,d);return c};return il(u,e),u.cancel=()=>{if(i)clearTimeout(i),i=void 0;if(a)clearTimeout(a),a=void 0},u},al;var z$=F(()=>{V$();al=HM});var yo=g(function(yH,G$){var BM=Number.MAX_SAFE_INTEGER||9007199254740991,WM=["major","premajor","minor","preminor","patch","prepatch","prerelease"];G$.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:BM,RELEASE_TYPES:WM,SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}});var _o=g(function(_H,K$){var YM=typeof process==="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};K$.exports=YM});var xs=g(function(ar,H$){var{MAX_SAFE_COMPONENT_LENGTH:cl,MAX_SAFE_BUILD_LENGTH:XM,MAX_LENGTH:JM}=yo(),QM=_o();ar=H$.exports={};var ZM=ar.re=[],eL=ar.safeRe=[],j=ar.src=[],tL=ar.safeSrc=[],q=ar.t={},rL=0,ul="[a-zA-Z0-9-]",nL=[["\\s",1],["\\d",JM],[ul,XM]],sL=(e)=>{for(let[t,r]of nL)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e},W=(e,t,r)=>{let n=sL(t),s=rL++;QM(e,s,t),q[e]=s,j[s]=t,tL[s]=n,ZM[s]=new RegExp(t,r?"g":void 0),eL[s]=new RegExp(n,r?"g":void 0)};W("NUMERICIDENTIFIER","0|[1-9]\\d*");W("NUMERICIDENTIFIERLOOSE","\\d+");W("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${ul}*`);W("MAINVERSION",`(${j[q.NUMERICIDENTIFIER]})\\.(${j[q.NUMERICIDENTIFIER]})\\.(${j[q.NUMERICIDENTIFIER]})`);W("MAINVERSIONLOOSE",`(${j[q.NUMERICIDENTIFIERLOOSE]})\\.(${j[q.NUMERICIDENTIFIERLOOSE]})\\.(${j[q.NUMERICIDENTIFIERLOOSE]})`);W("PRERELEASEIDENTIFIER",`(?:${j[q.NONNUMERICIDENTIFIER]}|${j[q.NUMERICIDENTIFIER]})`);W("PRERELEASEIDENTIFIERLOOSE",`(?:${j[q.NONNUMERICIDENTIFIER]}|${j[q.NUMERICIDENTIFIERLOOSE]})`);W("PRERELEASE",`(?:-(${j[q.PRERELEASEIDENTIFIER]}(?:\\.${j[q.PRERELEASEIDENTIFIER]})*))`);W("PRERELEASELOOSE",`(?:-?(${j[q.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${j[q.PRERELEASEIDENTIFIERLOOSE]})*))`);W("BUILDIDENTIFIER",`${ul}+`);W("BUILD",`(?:\\+(${j[q.BUILDIDENTIFIER]}(?:\\.${j[q.BUILDIDENTIFIER]})*))`);W("FULLPLAIN",`v?${j[q.MAINVERSION]}${j[q.PRERELEASE]}?${j[q.BUILD]}?`);W("FULL",`^${j[q.FULLPLAIN]}$`);W("LOOSEPLAIN",`[v=\\s]*${j[q.MAINVERSIONLOOSE]}${j[q.PRERELEASELOOSE]}?${j[q.BUILD]}?`);W("LOOSE",`^${j[q.LOOSEPLAIN]}$`);W("GTLT","((?:<|>)?=?)");W("XRANGEIDENTIFIERLOOSE",`${j[q.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`);W("XRANGEIDENTIFIER",`${j[q.NUMERICIDENTIFIER]}|x|X|\\*`);W("XRANGEPLAIN",`[v=\\s]*(${j[q.XRANGEIDENTIFIER]})(?:\\.(${j[q.XRANGEIDENTIFIER]})(?:\\.(${j[q.XRANGEIDENTIFIER]})(?:${j[q.PRERELEASE]})?${j[q.BUILD]}?)?)?`);W("XRANGEPLAINLOOSE",`[v=\\s]*(${j[q.XRANGEIDENTIFIERLOOSE]})(?:\\.(${j[q.XRANGEIDENTIFIERLOOSE]})(?:\\.(${j[q.XRANGEIDENTIFIERLOOSE]})(?:${j[q.PRERELEASELOOSE]})?${j[q.BUILD]}?)?)?`);W("XRANGE",`^${j[q.GTLT]}\\s*${j[q.XRANGEPLAIN]}$`);W("XRANGELOOSE",`^${j[q.GTLT]}\\s*${j[q.XRANGEPLAINLOOSE]}$`);W("COERCEPLAIN",`(^|[^\\d])(\\d{1,${cl}})(?:\\.(\\d{1,${cl}}))?(?:\\.(\\d{1,${cl}}))?`);W("COERCE",`${j[q.COERCEPLAIN]}(?:$|[^\\d])`);W("COERCEFULL",j[q.COERCEPLAIN]+`(?:${j[q.PRERELEASE]})?(?:${j[q.BUILD]})?(?:$|[^\\d])`);W("COERCERTL",j[q.COERCE],!0);W("COERCERTLFULL",j[q.COERCEFULL],!0);W("LONETILDE","(?:~>?)");W("TILDETRIM",`(\\s*)${j[q.LONETILDE]}\\s+`,!0);ar.tildeTrimReplace="$1~";W("TILDE",`^${j[q.LONETILDE]}${j[q.XRANGEPLAIN]}$`);W("TILDELOOSE",`^${j[q.LONETILDE]}${j[q.XRANGEPLAINLOOSE]}$`);W("LONECARET","(?:\\^)");W("CARETTRIM",`(\\s*)${j[q.LONECARET]}\\s+`,!0);ar.caretTrimReplace="$1^";W("CARET",`^${j[q.LONECARET]}${j[q.XRANGEPLAIN]}$`);W("CARETLOOSE",`^${j[q.LONECARET]}${j[q.XRANGEPLAINLOOSE]}$`);W("COMPARATORLOOSE",`^${j[q.GTLT]}\\s*(${j[q.LOOSEPLAIN]})$|^$`);W("COMPARATOR",`^${j[q.GTLT]}\\s*(${j[q.FULLPLAIN]})$|^$`);W("COMPARATORTRIM",`(\\s*)${j[q.GTLT]}\\s*(${j[q.LOOSEPLAIN]}|${j[q.XRANGEPLAIN]})`,!0);ar.comparatorTrimReplace="$1$2$3";W("HYPHENRANGE",`^\\s*(${j[q.XRANGEPLAIN]})\\s+-\\s+(${j[q.XRANGEPLAIN]})\\s*$`);W("HYPHENRANGELOOSE",`^\\s*(${j[q.XRANGEPLAINLOOSE]})\\s+-\\s+(${j[q.XRANGEPLAINLOOSE]})\\s*$`);W("STAR","(<|>)?=?\\s*\\*");W("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$");W("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")});var Ta=g(function(vH,B$){var oL=Object.freeze({loose:!0}),iL=Object.freeze({}),aL=(e)=>{if(!e)return iL;if(typeof e!=="object")return oL;return e};B$.exports=aL});var ll=g(function($H,X$){var W$=/^[0-9]+$/,Y$=(e,t)=>{if(typeof e==="number"&&typeof t==="number")return e===t?0:e<t?-1:1;let r=W$.test(e),n=W$.test(t);if(r&&n)e=+e,t=+t;return e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},cL=(e,t)=>Y$(t,e);X$.exports={compareIdentifiers:Y$,rcompareIdentifiers:cL}});var Ke=g(function(EH,Q$){var ka=_o(),{MAX_LENGTH:J$,MAX_SAFE_INTEGER:Oa}=yo(),{safeRe:Aa,t:Pa}=xs(),uL=Ta(),{compareIdentifiers:dl}=ll();class Ot{constructor(e,t){if(t=uL(t),e instanceof Ot)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else e=e.version;else if(typeof e!=="string")throw TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>J$)throw TypeError(`version is longer than ${J$} characters`);ka("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;let r=e.trim().match(t.loose?Aa[Pa.LOOSE]:Aa[Pa.FULL]);if(!r)throw TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>Oa||this.major<0)throw TypeError("Invalid major version");if(this.minor>Oa||this.minor<0)throw TypeError("Invalid minor version");if(this.patch>Oa||this.patch<0)throw TypeError("Invalid patch version");if(!r[4])this.prerelease=[];else this.prerelease=r[4].split(".").map((n)=>{if(/^[0-9]+$/.test(n)){let s=+n;if(s>=0&&s<Oa)return s}return n});this.build=r[5]?r[5].split("."):[],this.format()}format(){if(this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length)this.version+=`-${this.prerelease.join(".")}`;return this.version}toString(){return this.version}compare(e){if(ka("SemVer.compare",this.version,this.options,e),!(e instanceof Ot)){if(typeof e==="string"&&e===this.version)return 0;e=new Ot(e,this.options)}if(e.version===this.version)return 0;return this.compareMain(e)||this.comparePre(e)}compareMain(e){if(!(e instanceof Ot))e=new Ot(e,this.options);if(this.major<e.major)return-1;if(this.major>e.major)return 1;if(this.minor<e.minor)return-1;if(this.minor>e.minor)return 1;if(this.patch<e.patch)return-1;if(this.patch>e.patch)return 1;return 0}comparePre(e){if(!(e instanceof Ot))e=new Ot(e,this.options);if(this.prerelease.length&&!e.prerelease.length)return-1;else if(!this.prerelease.length&&e.prerelease.length)return 1;else if(!this.prerelease.length&&!e.prerelease.length)return 0;let t=0;do{let r=this.prerelease[t],n=e.prerelease[t];if(ka("prerelease compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return dl(r,n)}while(++t)}compareBuild(e){if(!(e instanceof Ot))e=new Ot(e,this.options);let t=0;do{let r=this.build[t],n=e.build[t];if(ka("build compare",t,r,n),r===void 0&&n===void 0)return 0;else if(n===void 0)return 1;else if(r===void 0)return-1;else if(r===n)continue;else return dl(r,n)}while(++t)}inc(e,t,r){if(e.startsWith("pre")){if(!t&&r===!1)throw Error("invalid increment argument: identifier is empty");if(t){let n=`-${t}`.match(this.options.loose?Aa[Pa.PRERELEASELOOSE]:Aa[Pa.PRERELEASE]);if(!n||n[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",t,r);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",t,r);break;case"prepatch":this.prerelease.length=0,this.inc("patch",t,r),this.inc("pre",t,r);break;case"prerelease":if(this.prerelease.length===0)this.inc("patch",t,r);this.inc("pre",t,r);break;case"release":if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case"major":if(this.minor!==0||this.patch!==0||this.prerelease.length===0)this.major++;this.minor=0,this.patch=0,this.prerelease=[];break;case"minor":if(this.patch!==0||this.prerelease.length===0)this.minor++;this.patch=0,this.prerelease=[];break;case"patch":if(this.prerelease.length===0)this.patch++;this.prerelease=[];break;case"pre":{let n=Number(r)?1:0;if(this.prerelease.length===0)this.prerelease=[n];else{let s=this.prerelease.length;while(--s>=0)if(typeof this.prerelease[s]==="number")this.prerelease[s]++,s=-2;if(s===-1){if(t===this.prerelease.join(".")&&r===!1)throw Error("invalid increment argument: identifier already exists");this.prerelease.push(n)}}if(t){let s=[t,n];if(r===!1)s=[t];if(dl(this.prerelease[0],t)===0){if(isNaN(this.prerelease[1]))this.prerelease=s}else this.prerelease=s}break}default:throw Error(`invalid increment argument: ${e}`)}if(this.raw=this.format(),this.build.length)this.raw+=`+${this.build.join(".")}`;return this}}Q$.exports=Ot});var Tn=g(function(wH,eE){var Z$=Ke(),lL=(e,t,r=!1)=>{if(e instanceof Z$)return e;try{return new Z$(e,t)}catch(n){if(!r)return null;throw n}};eE.exports=lL});var rE=g(function(bH,tE){var dL=Tn(),fL=(e,t)=>{let r=dL(e,t);return r?r.version:null};tE.exports=fL});var sE=g(function(SH,nE){var pL=Tn(),hL=(e,t)=>{let r=pL(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};nE.exports=hL});var aE=g(function(xH,iE){var oE=Ke(),mL=(e,t,r,n,s)=>{if(typeof r==="string")s=n,n=r,r=void 0;try{return new oE(e instanceof oE?e.version:e,r).inc(t,n,s).version}catch(o){return null}};iE.exports=mL});var lE=g(function(RH,uE){var cE=Tn(),gL=(e,t)=>{let r=cE(e,null,!0),n=cE(t,null,!0),s=r.compare(n);if(s===0)return null;let o=s>0,i=o?r:n,a=o?n:r,c=!!i.prerelease.length;if(!!a.prerelease.length&&!c){if(!a.patch&&!a.minor)return"major";if(a.compareMain(i)===0){if(a.minor&&!a.patch)return"minor";return"patch"}}let d=c?"pre":"";if(r.major!==n.major)return d+"major";if(r.minor!==n.minor)return d+"minor";if(r.patch!==n.patch)return d+"patch";return"prerelease"};uE.exports=gL});var fE=g(function(TH,dE){var yL=Ke(),_L=(e,t)=>new yL(e,t).major;dE.exports=_L});var hE=g(function(kH,pE){var vL=Ke(),$L=(e,t)=>new vL(e,t).minor;pE.exports=$L});var gE=g(function(OH,mE){var EL=Ke(),wL=(e,t)=>new EL(e,t).patch;mE.exports=wL});var _E=g(function(AH,yE){var bL=Tn(),SL=(e,t)=>{let r=bL(e,t);return r&&r.prerelease.length?r.prerelease:null};yE.exports=SL});var Et=g(function(PH,$E){var vE=Ke(),xL=(e,t,r)=>new vE(e,r).compare(new vE(t,r));$E.exports=xL});var wE=g(function(NH,EE){var RL=Et(),TL=(e,t,r)=>RL(t,e,r);EE.exports=TL});var SE=g(function(IH,bE){var kL=Et(),OL=(e,t)=>kL(e,t,!0);bE.exports=OL});var Na=g(function(CH,RE){var xE=Ke(),AL=(e,t,r)=>{let n=new xE(e,r),s=new xE(t,r);return n.compare(s)||n.compareBuild(s)};RE.exports=AL});var kE=g(function(jH,TE){var PL=Na(),NL=(e,t)=>e.sort((r,n)=>PL(r,n,t));TE.exports=NL});var AE=g(function(qH,OE){var IL=Na(),CL=(e,t)=>e.sort((r,n)=>IL(n,r,t));OE.exports=CL});var vo=g(function(DH,PE){var jL=Et(),qL=(e,t,r)=>jL(e,t,r)>0;PE.exports=qL});var Ia=g(function(MH,NE){var DL=Et(),ML=(e,t,r)=>DL(e,t,r)<0;NE.exports=ML});var fl=g(function(LH,IE){var LL=Et(),UL=(e,t,r)=>LL(e,t,r)===0;IE.exports=UL});var pl=g(function(UH,CE){var FL=Et(),VL=(e,t,r)=>FL(e,t,r)!==0;CE.exports=VL});var Ca=g(function(FH,jE){var zL=Et(),GL=(e,t,r)=>zL(e,t,r)>=0;jE.exports=GL});var ja=g(function(VH,qE){var KL=Et(),HL=(e,t,r)=>KL(e,t,r)<=0;qE.exports=HL});var hl=g(function(zH,DE){var BL=fl(),WL=pl(),YL=vo(),XL=Ca(),JL=Ia(),QL=ja(),ZL=(e,t,r,n)=>{switch(t){case"===":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e===r;case"!==":if(typeof e==="object")e=e.version;if(typeof r==="object")r=r.version;return e!==r;case"":case"=":case"==":return BL(e,r,n);case"!=":return WL(e,r,n);case">":return YL(e,r,n);case">=":return XL(e,r,n);case"<":return JL(e,r,n);case"<=":return QL(e,r,n);default:throw TypeError(`Invalid operator: ${t}`)}};DE.exports=ZL});var LE=g(function(GH,ME){var eU=Ke(),tU=Tn(),{safeRe:qa,t:Da}=xs(),rU=(e,t)=>{if(e instanceof eU)return e;if(typeof e==="number")e=String(e);if(typeof e!=="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?qa[Da.COERCEFULL]:qa[Da.COERCE]);else{let c=t.includePrerelease?qa[Da.COERCERTLFULL]:qa[Da.COERCERTL],u;while((u=c.exec(e))&&(!r||r.index+r[0].length!==e.length)){if(!r||u.index+u[0].length!==r.index+r[0].length)r=u;c.lastIndex=u.index+u[1].length+u[2].length}c.lastIndex=-1}if(r===null)return null;let n=r[2],s=r[3]||"0",o=r[4]||"0",i=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return tU(`${n}.${s}.${o}${i}${a}`,t)};ME.exports=rU});var VE=g(function(KH,FE){class UE{constructor(){this.max=1000,this.map=new Map}get(e){let t=this.map.get(e);if(t===void 0)return;else return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let n=this.map.keys().next().value;this.delete(n)}this.map.set(e,t)}return this}}FE.exports=UE});var wt=g(function(HH,HE){var nU=/\s+/g;class $o{constructor(e,t){if(t=oU(t),e instanceof $o)if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;else return new $o(e.raw,t);if(e instanceof Ma)return this.raw=e.value,this.set=[[e]],this.formatted=void 0,this;if(this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease,this.raw=e.trim().replace(nU," "),this.set=this.raw.split("||").map((r)=>this.parseRange(r.trim())).filter((r)=>r.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let r=this.set[0];if(this.set=this.set.filter((n)=>!GE(n[0])),this.set.length===0)this.set=[r];else if(this.set.length>1){for(let n of this.set)if(n.length===1&&fU(n[0])){this.set=[n];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let e=0;e<this.set.length;e++){if(e>0)this.formatted+="||";let t=this.set[e];for(let r=0;r<t.length;r++){if(r>0)this.formatted+=" ";this.formatted+=t[r].toString().trim()}}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){let r=((this.options.includePrerelease&&lU)|(this.options.loose&&dU))+":"+e,n=zE.get(r);if(n)return n;let s=this.options.loose,o=s?Xe[He.HYPHENRANGELOOSE]:Xe[He.HYPHENRANGE];e=e.replace(o,wU(this.options.includePrerelease)),ye("hyphen replace",e),e=e.replace(Xe[He.COMPARATORTRIM],aU),ye("comparator trim",e),e=e.replace(Xe[He.TILDETRIM],cU),ye("tilde trim",e),e=e.replace(Xe[He.CARETTRIM],uU),ye("caret trim",e);let i=e.split(" ").map((d)=>pU(d,this.options)).join(" ").split(/\s+/).map((d)=>EU(d,this.options));if(s)i=i.filter((d)=>(ye("loose invalid filter",d,this.options),!!d.match(Xe[He.COMPARATORLOOSE])));ye("range list",i);let a=new Map,c=i.map((d)=>new Ma(d,this.options));for(let d of c){if(GE(d))return[d];a.set(d.value,d)}if(a.size>1&&a.has(""))a.delete("");let u=[...a.values()];return zE.set(r,u),u}intersects(e,t){if(!(e instanceof $o))throw TypeError("a Range is required");return this.set.some((r)=>KE(r,t)&&e.set.some((n)=>KE(n,t)&&r.every((s)=>n.every((o)=>s.intersects(o,t)))))}test(e){if(!e)return!1;if(typeof e==="string")try{e=new iU(e,this.options)}catch(t){return!1}for(let t=0;t<this.set.length;t++)if(bU(this.set[t],e,this.options))return!0;return!1}}HE.exports=$o;var sU=VE(),zE=new sU,oU=Ta(),Ma=Eo(),ye=_o(),iU=Ke(),{safeRe:Xe,t:He,comparatorTrimReplace:aU,tildeTrimReplace:cU,caretTrimReplace:uU}=xs(),{FLAG_INCLUDE_PRERELEASE:lU,FLAG_LOOSE:dU}=yo(),GE=(e)=>e.value==="<0.0.0-0",fU=(e)=>e.value==="",KE=(e,t)=>{let r=!0,n=e.slice(),s=n.pop();while(r&&n.length)r=n.every((o)=>s.intersects(o,t)),s=n.pop();return r},pU=(e,t)=>(e=e.replace(Xe[He.BUILD],""),ye("comp",e,t),e=gU(e,t),ye("caret",e),e=hU(e,t),ye("tildes",e),e=_U(e,t),ye("xrange",e),e=$U(e,t),ye("stars",e),e),Je=(e)=>!e||e.toLowerCase()==="x"||e==="*",hU=(e,t)=>e.trim().split(/\s+/).map((r)=>mU(r,t)).join(" "),mU=(e,t)=>{let r=t.loose?Xe[He.TILDELOOSE]:Xe[He.TILDE];return e.replace(r,(n,s,o,i,a)=>{ye("tilde",e,n,s,o,i,a);let c;if(Je(s))c="";else if(Je(o))c=`>=${s}.0.0 <${+s+1}.0.0-0`;else if(Je(i))c=`>=${s}.${o}.0 <${s}.${+o+1}.0-0`;else if(a)ye("replaceTilde pr",a),c=`>=${s}.${o}.${i}-${a} <${s}.${+o+1}.0-0`;else c=`>=${s}.${o}.${i} <${s}.${+o+1}.0-0`;return ye("tilde return",c),c})},gU=(e,t)=>e.trim().split(/\s+/).map((r)=>yU(r,t)).join(" "),yU=(e,t)=>{ye("caret",e,t);let r=t.loose?Xe[He.CARETLOOSE]:Xe[He.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,(s,o,i,a,c)=>{ye("caret",e,s,o,i,a,c);let u;if(Je(o))u="";else if(Je(i))u=`>=${o}.0.0${n} <${+o+1}.0.0-0`;else if(Je(a))if(o==="0")u=`>=${o}.${i}.0${n} <${o}.${+i+1}.0-0`;else u=`>=${o}.${i}.0${n} <${+o+1}.0.0-0`;else if(c)if(ye("replaceCaret pr",c),o==="0")if(i==="0")u=`>=${o}.${i}.${a}-${c} <${o}.${i}.${+a+1}-0`;else u=`>=${o}.${i}.${a}-${c} <${o}.${+i+1}.0-0`;else u=`>=${o}.${i}.${a}-${c} <${+o+1}.0.0-0`;else if(ye("no pr"),o==="0")if(i==="0")u=`>=${o}.${i}.${a}${n} <${o}.${i}.${+a+1}-0`;else u=`>=${o}.${i}.${a}${n} <${o}.${+i+1}.0-0`;else u=`>=${o}.${i}.${a} <${+o+1}.0.0-0`;return ye("caret return",u),u})},_U=(e,t)=>(ye("replaceXRanges",e,t),e.split(/\s+/).map((r)=>vU(r,t)).join(" ")),vU=(e,t)=>{e=e.trim();let r=t.loose?Xe[He.XRANGELOOSE]:Xe[He.XRANGE];return e.replace(r,(n,s,o,i,a,c)=>{ye("xRange",e,n,s,o,i,a,c);let u=Je(o),d=u||Je(i),l=d||Je(a),p=l;if(s==="="&&p)s="";if(c=t.includePrerelease?"-0":"",u)if(s===">"||s==="<")n="<0.0.0-0";else n="*";else if(s&&p){if(d)i=0;if(a=0,s===">")if(s=">=",d)o=+o+1,i=0,a=0;else i=+i+1,a=0;else if(s==="<=")if(s="<",d)o=+o+1;else i=+i+1;if(s==="<")c="-0";n=`${s+o}.${i}.${a}${c}`}else if(d)n=`>=${o}.0.0${c} <${+o+1}.0.0-0`;else if(l)n=`>=${o}.${i}.0${c} <${o}.${+i+1}.0-0`;return ye("xRange return",n),n})},$U=(e,t)=>(ye("replaceStars",e,t),e.trim().replace(Xe[He.STAR],"")),EU=(e,t)=>(ye("replaceGTE0",e,t),e.trim().replace(Xe[t.includePrerelease?He.GTE0PRE:He.GTE0],"")),wU=(e)=>(t,r,n,s,o,i,a,c,u,d,l,p)=>{if(Je(n))r="";else if(Je(s))r=`>=${n}.0.0${e?"-0":""}`;else if(Je(o))r=`>=${n}.${s}.0${e?"-0":""}`;else if(i)r=`>=${r}`;else r=`>=${r}${e?"-0":""}`;if(Je(u))c="";else if(Je(d))c=`<${+u+1}.0.0-0`;else if(Je(l))c=`<${u}.${+d+1}.0-0`;else if(p)c=`<=${u}.${d}.${l}-${p}`;else if(e)c=`<${u}.${d}.${+l+1}-0`;else c=`<=${c}`;return`${r} ${c}`.trim()},bU=(e,t,r)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!r.includePrerelease){for(let n=0;n<e.length;n++){if(ye(e[n].semver),e[n].semver===Ma.ANY)continue;if(e[n].semver.prerelease.length>0){let s=e[n].semver;if(s.major===t.major&&s.minor===t.minor&&s.patch===t.patch)return!0}}return!1}return!0}});var Eo=g(function(BH,QE){var wo=Symbol("SemVer ANY");class La{static get ANY(){return wo}constructor(e,t){if(t=BE(t),e instanceof La)if(e.loose===!!t.loose)return e;else e=e.value;if(e=e.trim().split(/\s+/).join(" "),gl("comparator",e,t),this.options=t,this.loose=!!t.loose,this.parse(e),this.semver===wo)this.value="";else this.value=this.operator+this.semver.version;gl("comp",this)}parse(e){let t=this.options.loose?WE[YE.COMPARATORLOOSE]:WE[YE.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);if(this.operator=r[1]!==void 0?r[1]:"",this.operator==="=")this.operator="";if(!r[2])this.semver=wo;else this.semver=new XE(r[2],this.options.loose)}toString(){return this.value}test(e){if(gl("Comparator.test",e,this.options.loose),this.semver===wo||e===wo)return!0;if(typeof e==="string")try{e=new XE(e,this.options)}catch(t){return!1}return ml(e,this.operator,this.semver,this.options)}intersects(e,t){if(!(e instanceof La))throw TypeError("a Comparator is required");if(this.operator===""){if(this.value==="")return!0;return new JE(e.value,t).test(this.value)}else if(e.operator===""){if(e.value==="")return!0;return new JE(this.value,t).test(e.semver)}if(t=BE(t),t.includePrerelease&&(this.value==="<0.0.0-0"||e.value==="<0.0.0-0"))return!1;if(!t.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))return!1;if(this.operator.startsWith(">")&&e.operator.startsWith(">"))return!0;if(this.operator.startsWith("<")&&e.operator.startsWith("<"))return!0;if(this.semver.version===e.semver.version&&this.operator.includes("=")&&e.operator.includes("="))return!0;if(ml(this.semver,"<",e.semver,t)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))return!0;if(ml(this.semver,">",e.semver,t)&&this.operator.startsWith("<")&&e.operator.startsWith(">"))return!0;return!1}}QE.exports=La;var BE=Ta(),{safeRe:WE,t:YE}=xs(),ml=hl(),gl=_o(),XE=Ke(),JE=wt()});var bo=g(function(WH,ZE){var SU=wt(),xU=(e,t,r)=>{try{t=new SU(t,r)}catch(n){return!1}return t.test(e)};ZE.exports=xU});var tw=g(function(YH,ew){var RU=wt(),TU=(e,t)=>new RU(e,t).set.map((r)=>r.map((n)=>n.value).join(" ").trim().split(" "));ew.exports=TU});var nw=g(function(XH,rw){var kU=Ke(),OU=wt(),AU=(e,t,r)=>{let n=null,s=null,o=null;try{o=new OU(t,r)}catch(i){return null}return e.forEach((i)=>{if(o.test(i)){if(!n||s.compare(i)===-1)n=i,s=new kU(n,r)}}),n};rw.exports=AU});var ow=g(function(JH,sw){var PU=Ke(),NU=wt(),IU=(e,t,r)=>{let n=null,s=null,o=null;try{o=new NU(t,r)}catch(i){return null}return e.forEach((i)=>{if(o.test(i)){if(!n||s.compare(i)===1)n=i,s=new PU(n,r)}}),n};sw.exports=IU});var cw=g(function(QH,aw){var yl=Ke(),CU=wt(),iw=vo(),jU=(e,t)=>{e=new CU(e,t);let r=new yl("0.0.0");if(e.test(r))return r;if(r=new yl("0.0.0-0"),e.test(r))return r;r=null;for(let n=0;n<e.set.length;++n){let s=e.set[n],o=null;if(s.forEach((i)=>{let a=new yl(i.semver.version);switch(i.operator){case">":if(a.prerelease.length===0)a.patch++;else a.prerelease.push(0);a.raw=a.format();case"":case">=":if(!o||iw(a,o))o=a;break;case"<":case"<=":break;default:throw Error(`Unexpected operation: ${i.operator}`)}}),o&&(!r||iw(r,o)))r=o}if(r&&e.test(r))return r;return null};aw.exports=jU});var lw=g(function(ZH,uw){var qU=wt(),DU=(e,t)=>{try{return new qU(e,t).range||"*"}catch(r){return null}};uw.exports=DU});var Ua=g(function(e5,hw){var MU=Ke(),pw=Eo(),{ANY:LU}=pw,UU=wt(),FU=bo(),dw=vo(),fw=Ia(),VU=ja(),zU=Ca(),GU=(e,t,r,n)=>{e=new MU(e,n),t=new UU(t,n);let s,o,i,a,c;switch(r){case">":s=dw,o=VU,i=fw,a=">",c=">=";break;case"<":s=fw,o=zU,i=dw,a="<",c="<=";break;default:throw TypeError('Must provide a hilo val of "<" or ">"')}if(FU(e,t,n))return!1;for(let u=0;u<t.set.length;++u){let d=t.set[u],l=null,p=null;if(d.forEach((f)=>{if(f.semver===LU)f=new pw(">=0.0.0");if(l=l||f,p=p||f,s(f.semver,l.semver,n))l=f;else if(i(f.semver,p.semver,n))p=f}),l.operator===a||l.operator===c)return!1;if((!p.operator||p.operator===a)&&o(e,p.semver))return!1;else if(p.operator===c&&i(e,p.semver))return!1}return!0};hw.exports=GU});var gw=g(function(t5,mw){var KU=Ua(),HU=(e,t,r)=>KU(e,t,">",r);mw.exports=HU});var _w=g(function(r5,yw){var BU=Ua(),WU=(e,t,r)=>BU(e,t,"<",r);yw.exports=WU});var Ew=g(function(n5,$w){var vw=wt(),YU=(e,t,r)=>(e=new vw(e,r),t=new vw(t,r),e.intersects(t,r));$w.exports=YU});var bw=g(function(s5,ww){var XU=bo(),JU=Et();ww.exports=(e,t,r)=>{let n=[],s=null,o=null,i=e.sort((d,l)=>JU(d,l,r));for(let d of i)if(XU(d,t,r)){if(o=d,!s)s=d}else{if(o)n.push([s,o]);o=null,s=null}if(s)n.push([s,null]);let a=[];for(let[d,l]of n)if(d===l)a.push(d);else if(!l&&d===i[0])a.push("*");else if(!l)a.push(`>=${d}`);else if(d===i[0])a.push(`<=${l}`);else a.push(`${d} - ${l}`);let c=a.join(" || "),u=typeof t.raw==="string"?t.raw:String(t);return c.length<u.length?c:t}});var Ow=g(function(o5,kw){var Sw=wt(),vl=Eo(),{ANY:_l}=vl,So=bo(),$l=Et(),QU=(e,t,r={})=>{if(e===t)return!0;e=new Sw(e,r),t=new Sw(t,r);let n=!1;e:for(let s of e.set){for(let o of t.set){let i=e2(s,o,r);if(n=n||i!==null,i)continue e}if(n)return!1}return!0},ZU=[new vl(">=0.0.0-0")],xw=[new vl(">=0.0.0")],e2=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===_l)if(t.length===1&&t[0].semver===_l)return!0;else if(r.includePrerelease)e=ZU;else e=xw;if(t.length===1&&t[0].semver===_l)if(r.includePrerelease)return!0;else t=xw;let n=new Set,s,o;for(let f of e)if(f.operator===">"||f.operator===">=")s=Rw(s,f,r);else if(f.operator==="<"||f.operator==="<=")o=Tw(o,f,r);else n.add(f.semver);if(n.size>1)return null;let i;if(s&&o){if(i=$l(s.semver,o.semver,r),i>0)return null;else if(i===0&&(s.operator!==">="||o.operator!=="<="))return null}for(let f of n){if(s&&!So(f,String(s),r))return null;if(o&&!So(f,String(o),r))return null;for(let h of t)if(!So(f,String(h),r))return!1;return!0}let a,c,u,d,l=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1,p=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;if(l&&l.prerelease.length===1&&o.operator==="<"&&l.prerelease[0]===0)l=!1;for(let f of t){if(d=d||f.operator===">"||f.operator===">=",u=u||f.operator==="<"||f.operator==="<=",s){if(p){if(f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===p.major&&f.semver.minor===p.minor&&f.semver.patch===p.patch)p=!1}if(f.operator===">"||f.operator===">="){if(a=Rw(s,f,r),a===f&&a!==s)return!1}else if(s.operator===">="&&!So(s.semver,String(f),r))return!1}if(o){if(l){if(f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===l.major&&f.semver.minor===l.minor&&f.semver.patch===l.patch)l=!1}if(f.operator==="<"||f.operator==="<="){if(c=Tw(o,f,r),c===f&&c!==o)return!1}else if(o.operator==="<="&&!So(o.semver,String(f),r))return!1}if(!f.operator&&(o||s)&&i!==0)return!1}if(s&&u&&!o&&i!==0)return!1;if(o&&d&&!s&&i!==0)return!1;if(p||l)return!1;return!0},Rw=(e,t,r)=>{if(!e)return t;let n=$l(e.semver,t.semver,r);return n>0?e:n<0?t:t.operator===">"&&e.operator===">="?t:e},Tw=(e,t,r)=>{if(!e)return t;let n=$l(e.semver,t.semver,r);return n<0?e:n>0?t:t.operator==="<"&&e.operator==="<="?t:e};kw.exports=QU});var Pw=g(function(i5,Aw){var Rs=xs(),Fa=yo(),t2=Ke(),Va=ll(),r2=Tn(),n2=rE(),s2=sE(),o2=aE(),i2=lE(),a2=fE(),c2=hE(),u2=gE(),l2=_E(),d2=Et(),f2=wE(),p2=SE(),h2=Na(),m2=kE(),g2=AE(),y2=vo(),_2=Ia(),v2=fl(),$2=pl(),E2=Ca(),w2=ja(),b2=hl(),S2=LE(),x2=Eo(),R2=wt(),T2=bo(),k2=tw(),O2=nw(),A2=ow(),P2=cw(),N2=lw(),I2=Ua(),C2=gw(),j2=_w(),q2=Ew(),D2=bw(),M2=Ow();Aw.exports={parse:r2,valid:n2,clean:s2,inc:o2,diff:i2,major:a2,minor:c2,patch:u2,prerelease:l2,compare:d2,rcompare:f2,compareLoose:p2,compareBuild:h2,sort:m2,rsort:g2,gt:y2,lt:_2,eq:v2,neq:$2,gte:E2,lte:w2,cmp:b2,coerce:S2,Comparator:x2,Range:R2,satisfies:T2,toComparators:k2,maxSatisfying:O2,minSatisfying:A2,minVersion:P2,validRange:N2,outside:I2,gtr:C2,ltr:j2,intersects:q2,simplifyRange:D2,subset:M2,SemVer:t2,re:Rs.re,src:Rs.src,tokens:Rs.t,SEMVER_SPEC_VERSION:Fa.SEMVER_SPEC_VERSION,RELEASE_TYPES:Fa.RELEASE_TYPES,compareIdentifiers:Va.compareIdentifiers,rcompareIdentifiers:Va.rcompareIdentifiers}});function Iw(e,t,r){if(!e)return!1;if(e.constructor===t)return!0;return L2.call(e)===r}function Cw(e){return Iw(e,Uint8Array,"[object Uint8Array]")}function U2(e){return Iw(e,ArrayBuffer,"[object ArrayBuffer]")}function F2(e){return Cw(e)||U2(e)}function V2(e){if(!Cw(e))throw TypeError(`Expected \`Uint8Array\`, got \`${typeof e}\``)}function z2(e){if(!F2(e))throw TypeError(`Expected \`Uint8Array\` or \`ArrayBuffer\`, got \`${typeof e}\``)}function El(e,t){if(e.length===0)return new Uint8Array(0);t??=e.reduce((s,o)=>s+o.length,0);let r=new Uint8Array(t),n=0;for(let s of e)V2(s),r.set(s,n),n+=s.length;return r}function wl(e,t="utf8"){return z2(e),Nw[t]??=new globalThis.TextDecoder(t),Nw[t].decode(e)}function G2(e){if(typeof e!=="string")throw TypeError(`Expected \`string\`, got \`${typeof e}\``)}function za(e){return G2(e),K2.encode(e)}var L2,Nw,K2,a5;var jw=F(()=>{L2=Object.prototype.toString;Nw={utf8:new globalThis.TextDecoder("utf8")};K2=new globalThis.TextEncoder;a5=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"))});import{isDeepStrictEqual as H2}from"util";import qw from"process";import kn from"fs";import Dw from"path";import xo from"crypto";import B2 from"assert";var Lw,Uw,On,W2,Mw="aes-256-cbc",Ts=()=>Object.create(null),Y2=(e)=>e!==void 0&&e!==null,X2=(e,t)=>{let r=new Set(["undefined","symbol","function"]),n=typeof t;if(r.has(n))throw TypeError(`Setting a value of type \`${n}\` for key \`${e}\` is not allowed as it's not supported by JSON`)},Ga="__internal__",bl,Ka;var Fw=F(()=>{ld();fd();Vd();z$();jw();Lw=_c(oy(),1),Uw=_c(F$(),1),On=_c(Pw(),1),W2=Uw.default.default,bl=`${Ga}.migrations.version`;Ka=class Ka{path;events;#n;#t;#e;#r={};constructor(e={}){let t={configName:"config",fileExtension:"json",projectSuffix:"nodejs",clearInvalidConfig:!1,accessPropertiesByDotNotation:!0,configFileMode:438,...e};if(!t.cwd){if(!t.projectName)throw Error("Please specify the `projectName` option.");t.cwd=Sc(t.projectName,{suffix:t.projectSuffix}).config}if(this.#e=t,t.schema??t.ajvOptions??t.rootSchema){if(t.schema&&typeof t.schema!=="object")throw TypeError("The `schema` option must be an object.");let o=new Lw.Ajv2020({allErrors:!0,useDefaults:!0,...t.ajvOptions});W2(o);let i={...t.rootSchema,type:"object",properties:t.schema};this.#n=o.compile(i);for(let[a,c]of Object.entries(t.schema??{}))if(c?.default)this.#r[a]=c.default}if(t.defaults)this.#r={...this.#r,...t.defaults};if(t.serialize)this._serialize=t.serialize;if(t.deserialize)this._deserialize=t.deserialize;this.events=new EventTarget,this.#t=t.encryptionKey;let r=t.fileExtension?`.${t.fileExtension}`:"";this.path=Dw.resolve(t.cwd,`${t.configName??"config"}${r}`);let n=this.store,s=Object.assign(Ts(),t.defaults,n);if(t.migrations){if(!t.projectVersion)throw Error("Please specify the `projectVersion` option.");this._migrate(t.migrations,t.projectVersion,t.beforeEachMigration)}this._validate(s);try{B2.deepEqual(n,s)}catch{this.store=s}if(t.watch)this._watch()}get(e,t){if(this.#e.accessPropertiesByDotNotation)return this._get(e,t);let{store:r}=this;return e in r?r[e]:t}set(e,t){if(typeof e!=="string"&&typeof e!=="object")throw TypeError(`Expected \`key\` to be of type \`string\` or \`object\`, got ${typeof e}`);if(typeof e!=="object"&&t===void 0)throw TypeError("Use `delete()` to clear values");if(this._containsReservedKey(e))throw TypeError(`Please don't use the ${Ga} key, as it's used to manage this module internal operations.`);let{store:r}=this,n=(s,o)=>{if(X2(s,o),this.#e.accessPropertiesByDotNotation)Ec(r,s,o);else r[s]=o};if(typeof e==="object"){let s=e;for(let[o,i]of Object.entries(s))n(o,i)}else n(e,t);this.store=r}has(e){if(this.#e.accessPropertiesByDotNotation)return ud(this.store,e);return e in this.store}reset(...e){for(let t of e)if(Y2(this.#r[t]))this.set(t,this.#r[t])}delete(e){let{store:t}=this;if(this.#e.accessPropertiesByDotNotation)cd(t,e);else delete t[e];this.store=t}clear(){this.store=Ts();for(let e of Object.keys(this.#r))this.reset(e)}onDidChange(e,t){if(typeof e!=="string")throw TypeError(`Expected \`key\` to be of type \`string\`, got ${typeof e}`);if(typeof t!=="function")throw TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof t}`);return this._handleChange(()=>this.get(e),t)}onDidAnyChange(e){if(typeof e!=="function")throw TypeError(`Expected \`callback\` to be of type \`function\`, got ${typeof e}`);return this._handleChange(()=>this.store,e)}get size(){return Object.keys(this.store).length}get store(){try{let e=kn.readFileSync(this.path,this.#t?null:"utf8"),t=this._encryptData(e),r=this._deserialize(t);return this._validate(r),Object.assign(Ts(),r)}catch(e){if(e?.code==="ENOENT")return this._ensureDirectory(),Ts();if(this.#e.clearInvalidConfig&&e.name==="SyntaxError")return Ts();throw e}}set store(e){this._ensureDirectory(),this._validate(e),this._write(e),this.events.dispatchEvent(new Event("change"))}*[Symbol.iterator](){for(let[e,t]of Object.entries(this.store))yield[e,t]}_encryptData(e){if(!this.#t)return typeof e==="string"?e:wl(e);try{let t=e.slice(0,16),r=xo.pbkdf2Sync(this.#t,t.toString(),1e4,32,"sha512"),n=xo.createDecipheriv(Mw,r,t),s=e.slice(17),o=typeof s==="string"?za(s):s;return wl(El([n.update(o),n.final()]))}catch{}return e.toString()}_handleChange(e,t){let r=e(),n=()=>{let s=r,o=e();if(H2(o,s))return;r=o,t.call(this,o,s)};return this.events.addEventListener("change",n),()=>{this.events.removeEventListener("change",n)}}_deserialize=(e)=>JSON.parse(e);_serialize=(e)=>JSON.stringify(e,void 0,"\t");_validate(e){if(!this.#n)return;if(this.#n(e)||!this.#n.errors)return;let r=this.#n.errors.map(({instancePath:n,message:s=""})=>`\`${n.slice(1)}\` ${s}`);throw Error("Config schema violation: "+r.join("; "))}_ensureDirectory(){kn.mkdirSync(Dw.dirname(this.path),{recursive:!0})}_write(e){let t=this._serialize(e);if(this.#t){let r=xo.randomBytes(16),n=xo.pbkdf2Sync(this.#t,r.toString(),1e4,32,"sha512"),s=xo.createCipheriv(Mw,n,r);t=El([r,za(":"),s.update(za(t)),s.final()])}if(qw.env.SNAP)kn.writeFileSync(this.path,t,{mode:this.#e.configFileMode});else try{jc(this.path,t,{mode:this.#e.configFileMode})}catch(r){if(r?.code==="EXDEV"){kn.writeFileSync(this.path,t,{mode:this.#e.configFileMode});return}throw r}}_watch(){if(this._ensureDirectory(),!kn.existsSync(this.path))this._write(Ts());if(qw.platform==="win32")kn.watch(this.path,{persistent:!1},al(()=>{this.events.dispatchEvent(new Event("change"))},{wait:100}));else kn.watchFile(this.path,{persistent:!1},al(()=>{this.events.dispatchEvent(new Event("change"))},{wait:5000}))}_migrate(e,t,r){let n=this._get(bl,"0.0.0"),s=Object.keys(e).filter((i)=>this._shouldPerformMigration(i,n,t)),o={...this.store};for(let i of s)try{if(r)r(this,{fromVersion:n,toVersion:i,finalVersion:t,versions:s});let a=e[i];a?.(this),this._set(bl,i),n=i,o={...this.store}}catch(a){throw this.store=o,Error(`Something went wrong during the migration! Changes applied to the store until this failed migration will be restored. ${a}`)}if(this._isVersionInRangeFormat(n)||!On.default.eq(n,t))this._set(bl,t)}_containsReservedKey(e){if(typeof e==="object"){if(Object.keys(e)[0]===Ga)return!0}if(typeof e!=="string")return!1;if(this.#e.accessPropertiesByDotNotation){if(e.startsWith(`${Ga}.`))return!0;return!1}return!1}_isVersionInRangeFormat(e){return On.default.clean(e)===null}_shouldPerformMigration(e,t,r){if(this._isVersionInRangeFormat(e)){if(t!=="0.0.0"&&On.default.satisfies(t,e))return!1;return On.default.satisfies(r,e)}if(On.default.lte(e,t))return!1;if(On.default.gt(e,r))return!1;return!0}_get(e,t){return ad(this.store,e,t)}_set(e,t){let{store:r}=this;Ec(r,e,t),this.store=r}}});var re,Vw,N,Er=(e)=>{switch(typeof e){case"undefined":return N.undefined;case"string":return N.string;case"number":return Number.isNaN(e)?N.nan:N.number;case"boolean":return N.boolean;case"function":return N.function;case"bigint":return N.bigint;case"symbol":return N.symbol;case"object":if(Array.isArray(e))return N.array;if(e===null)return N.null;if(e.then&&typeof e.then==="function"&&e.catch&&typeof e.catch==="function")return N.promise;if(typeof Map<"u"&&e instanceof Map)return N.map;if(typeof Set<"u"&&e instanceof Set)return N.set;if(typeof Date<"u"&&e instanceof Date)return N.date;return N.object;default:return N.unknown}};var Ro=F(()=>{(function(e){e.assertEqual=(s)=>{};function t(s){}e.assertIs=t;function r(s){throw Error()}e.assertNever=r,e.arrayToEnum=(s)=>{let o={};for(let i of s)o[i]=i;return o},e.getValidEnumValues=(s)=>{let o=e.objectKeys(s).filter((a)=>typeof s[s[a]]!=="number"),i={};for(let a of o)i[a]=s[a];return e.objectValues(i)},e.objectValues=(s)=>e.objectKeys(s).map(function(o){return s[o]}),e.objectKeys=typeof Object.keys==="function"?(s)=>Object.keys(s):(s)=>{let o=[];for(let i in s)if(Object.prototype.hasOwnProperty.call(s,i))o.push(i);return o},e.find=(s,o)=>{for(let i of s)if(o(i))return i;return},e.isInteger=typeof Number.isInteger==="function"?(s)=>Number.isInteger(s):(s)=>typeof s==="number"&&Number.isFinite(s)&&Math.floor(s)===s;function n(s,o=" | "){return s.map((i)=>typeof i==="string"?`'${i}'`:i).join(o)}e.joinValues=n,e.jsonStringifyReplacer=(s,o)=>{if(typeof o==="bigint")return o.toString();return o}})(re||(re={}));(function(e){e.mergeShapes=(t,r)=>({...t,...r})})(Vw||(Vw={}));N=re.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"])});var b,ft;var Ha=F(()=>{Ro();b=re.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);ft=class ft extends Error{get errors(){return this.issues}constructor(e){super();this.issues=[],this.addIssue=(r)=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};let t=new.target.prototype;if(Object.setPrototypeOf)Object.setPrototypeOf(this,t);else this.__proto__=t;this.name="ZodError",this.issues=e}format(e){let t=e||function(s){return s.message},r={_errors:[]},n=(s)=>{for(let o of s.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)r._errors.push(t(o));else{let i=r,a=0;while(a<o.path.length){let c=o.path[a];if(a!==o.path.length-1)i[c]=i[c]||{_errors:[]};else i[c]=i[c]||{_errors:[]},i[c]._errors.push(t(o));i=i[c],a++}}};return n(this),r}static assert(e){if(!(e instanceof ft))throw Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,re.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=(t)=>t.message){let t={},r=[];for(let n of this.issues)if(n.path.length>0){let s=n.path[0];t[s]=t[s]||[],t[s].push(e(n))}else r.push(e(n));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}};ft.create=(e)=>new ft(e)});var J2=(e,t)=>{let r;switch(e.code){case b.invalid_type:if(e.received===N.undefined)r="Required";else r=`Expected ${e.expected}, received ${e.received}`;break;case b.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,re.jsonStringifyReplacer)}`;break;case b.unrecognized_keys:r=`Unrecognized key(s) in object: ${re.joinValues(e.keys,", ")}`;break;case b.invalid_union:r="Invalid input";break;case b.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${re.joinValues(e.options)}`;break;case b.invalid_enum_value:r=`Invalid enum value. Expected ${re.joinValues(e.options)}, received '${e.received}'`;break;case b.invalid_arguments:r="Invalid function arguments";break;case b.invalid_return_type:r="Invalid function return type";break;case b.invalid_date:r="Invalid date";break;case b.invalid_string:if(typeof e.validation==="object")if("includes"in e.validation){if(r=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position==="number")r=`${r} at one or more positions greater than or equal to ${e.validation.position}`}else if("startsWith"in e.validation)r=`Invalid input: must start with "${e.validation.startsWith}"`;else if("endsWith"in e.validation)r=`Invalid input: must end with "${e.validation.endsWith}"`;else re.assertNever(e.validation);else if(e.validation!=="regex")r=`Invalid ${e.validation}`;else r="Invalid";break;case b.too_small:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="bigint")r=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`;else r="Invalid input";break;case b.too_big:if(e.type==="array")r=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`;else if(e.type==="string")r=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`;else if(e.type==="number")r=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="bigint")r=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`;else if(e.type==="date")r=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`;else r="Invalid input";break;case b.custom:r="Invalid input";break;case b.invalid_intersection_types:r="Intersection results could not be merged";break;case b.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case b.not_finite:r="Number must be finite";break;default:r=t.defaultError,re.assertNever(e)}return{message:r}},fn;var Sl=F(()=>{Ha();Ro();fn=J2});function To(){return Q2}var Q2;var Ba=F(()=>{Sl();Q2=fn});function k(e,t){let r=To(),n=Wa({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,r,r===fn?void 0:fn].filter((s)=>!!s)});e.common.issues.push(n)}class Be{constructor(){this.value="valid"}dirty(){if(this.value==="valid")this.value="dirty"}abort(){if(this.value!=="aborted")this.value="aborted"}static mergeArray(e,t){let r=[];for(let n of t){if(n.status==="aborted")return G;if(n.status==="dirty")e.dirty();r.push(n.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let n of t){let s=await n.key,o=await n.value;r.push({key:s,value:o})}return Be.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let n of t){let{key:s,value:o}=n;if(s.status==="aborted")return G;if(o.status==="aborted")return G;if(s.status==="dirty")e.dirty();if(o.status==="dirty")e.dirty();if(s.value!=="__proto__"&&(typeof o.value<"u"||n.alwaysSet))r[s.value]=o.value}return{status:e.value,value:r}}}var Wa=(e)=>{let{data:t,path:r,errorMaps:n,issueData:s}=e,o=[...r,...s.path||[]],i={...s,path:o};if(s.message!==void 0)return{...s,path:o,message:s.message};let a="",c=n.filter((u)=>!!u).slice().reverse();for(let u of c)a=u(i,{data:t,defaultError:a}).message;return{...s,path:o,message:a}},G,ks=(e)=>({status:"dirty",value:e}),Qe=(e)=>({status:"valid",value:e}),xl=(e)=>e.status==="aborted",Rl=(e)=>e.status==="dirty",An=(e)=>e.status==="valid",ko=(e)=>typeof Promise<"u"&&e instanceof Promise;var Tl=F(()=>{Ba();Sl();G=Object.freeze({status:"aborted"})});var zw=()=>{};var D;var Gw=F(()=>{(function(e){e.errToObj=(t)=>typeof t==="string"?{message:t}:t||{},e.toString=(t)=>typeof t==="string"?t:t?.message})(D||(D={}))});class At{constructor(e,t,r,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=n}get path(){if(!this._cachedPath.length)if(Array.isArray(this._key))this._cachedPath.push(...this._path,...this._key);else this._cachedPath.push(...this._path,this._key);return this._cachedPath}}function Q(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:n,description:s}=e;if(t&&(r||n))throw Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);if(t)return{errorMap:t,description:s};return{errorMap:(i,a)=>{let{message:c}=e;if(i.code==="invalid_enum_value")return{message:c??a.defaultError};if(typeof a.data>"u")return{message:c??n??a.defaultError};if(i.code!=="invalid_type")return{message:a.defaultError};return{message:c??r??a.defaultError}},description:s}}class ee{get description(){return this._def.description}_getType(e){return Er(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Er(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new Be,ctx:{common:e.parent.common,data:e.data,parsedType:Er(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(ko(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){let r={common:{issues:[],async:t?.async??!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Er(e)},n=this._parseSync({data:e,path:r.path,parent:r});return Kw(r,n)}"~validate"(e){let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Er(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:t});return An(r)?{value:r.value}:{issues:t.common.issues}}catch(r){if(r?.message?.toLowerCase()?.includes("encountered"))this["~standard"].async=!0;t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then((r)=>An(r)?{value:r.value}:{issues:t.common.issues})}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Er(e)},n=this._parse({data:e,path:r.path,parent:r}),s=await(ko(n)?n:Promise.resolve(n));return Kw(r,s)}refine(e,t){let r=(n)=>{if(typeof t==="string"||typeof t>"u")return{message:t};else if(typeof t==="function")return t(n);else return t};return this._refinement((n,s)=>{let o=e(n),i=()=>s.addIssue({code:b.custom,...r(n)});if(typeof Promise<"u"&&o instanceof Promise)return o.then((a)=>{if(!a)return i(),!1;else return!0});if(!o)return i(),!1;else return!0})}refinement(e,t){return this._refinement((r,n)=>{if(!e(r))return n.addIssue(typeof t==="function"?t(r,n):t),!1;else return!0})}_refinement(e){return new lr({schema:this,typeName:K.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:(t)=>this["~validate"](t)}}optional(){return ur.create(this,this._def)}nullable(){return pn.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return cr.create(this)}promise(){return Is.create(this,this._def)}or(e){return Io.create([this,e],this._def)}and(e){return Co.create(this,e,this._def)}transform(e){return new lr({...Q(this._def),schema:this,typeName:K.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e==="function"?e:()=>e;return new Mo({...Q(this._def),innerType:this,defaultValue:t,typeName:K.ZodDefault})}brand(){return new Pl({typeName:K.ZodBranded,type:this,...Q(this._def)})}catch(e){let t=typeof e==="function"?e:()=>e;return new Lo({...Q(this._def),innerType:this,catchValue:t,typeName:K.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return rc.create(this,e)}readonly(){return Uo.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}function Bw(e){let t="[0-5]\\d";if(e.precision)t=`${t}\\.\\d{${e.precision}}`;else if(e.precision==null)t=`${t}(\\.\\d+)?`;let r=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${r}`}function mF(e){return new RegExp(`^${Bw(e)}$`)}function gF(e){let t=`${Hw}T${Bw(e)}`,r=[];if(r.push(e.local?"Z?":"Z"),e.offset)r.push("([+-]\\d{2}:?\\d{2})");return t=`${t}(${r.join("|")})`,new RegExp(`^${t}$`)}function yF(e,t){if((t==="v4"||!t)&&cF.test(e))return!0;if((t==="v6"||!t)&&lF.test(e))return!0;return!1}function _F(e,t){if(!sF.test(e))return!1;try{let[r]=e.split(".");if(!r)return!1;let n=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),s=JSON.parse(atob(n));if(typeof s!=="object"||s===null)return!1;if("typ"in s&&s?.typ!=="JWT")return!1;if(!s.alg)return!1;if(t&&s.alg!==t)return!1;return!0}catch{return!1}}function vF(e,t){if((t==="v4"||!t)&&uF.test(e))return!0;if((t==="v6"||!t)&&dF.test(e))return!0;return!1}function $F(e,t){let r=(e.toString().split(".")[1]||"").length,n=(t.toString().split(".")[1]||"").length,s=r>n?r:n,o=Number.parseInt(e.toFixed(s).replace(".","")),i=Number.parseInt(t.toFixed(s).replace(".",""));return o%i/10**s}function Os(e){if(e instanceof Ce){let t={};for(let r in e.shape){let n=e.shape[r];t[r]=ur.create(Os(n))}return new Ce({...e._def,shape:()=>t})}else if(e instanceof cr)return new cr({...e._def,type:Os(e.element)});else if(e instanceof ur)return ur.create(Os(e.unwrap()));else if(e instanceof pn)return pn.create(Os(e.unwrap()));else if(e instanceof xr)return xr.create(e.items.map((t)=>Os(t)));else return e}function Ol(e,t){let r=Er(e),n=Er(t);if(e===t)return{valid:!0,data:e};else if(r===N.object&&n===N.object){let s=re.objectKeys(t),o=re.objectKeys(e).filter((a)=>s.indexOf(a)!==-1),i={...e,...t};for(let a of o){let c=Ol(e[a],t[a]);if(!c.valid)return{valid:!1};i[a]=c.data}return{valid:!0,data:i}}else if(r===N.array&&n===N.array){if(e.length!==t.length)return{valid:!1};let s=[];for(let o=0;o<e.length;o++){let i=e[o],a=t[o],c=Ol(i,a);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else if(r===N.date&&n===N.date&&+e===+t)return{valid:!0,data:e};else return{valid:!1}}function Ww(e,t){return new Nn({values:e,typeName:K.ZodEnum,...Q(t)})}var Kw=(e,t)=>{if(An(t))return{success:!0,data:t.value};else{if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new ft(e.common.issues);return this._error=r,this._error}}}},Z2,eF,tF,rF,nF,sF,oF,iF,aF="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",kl,cF,uF,lF,dF,fF,pF,Hw="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",hF,br,As,Ps,Ya,Ao,Xa,Po,No,Ja,Pn,Sr,Qa,cr,Ce,Io,wr=(e)=>{if(e instanceof jo)return wr(e.schema);else if(e instanceof lr)return wr(e.innerType());else if(e instanceof qo)return[e.value];else if(e instanceof Nn)return e.options;else if(e instanceof Do)return re.objectValues(e.enum);else if(e instanceof Mo)return wr(e._def.innerType);else if(e instanceof Po)return[void 0];else if(e instanceof No)return[null];else if(e instanceof ur)return[void 0,...wr(e.unwrap())];else if(e instanceof pn)return[null,...wr(e.unwrap())];else if(e instanceof Pl)return wr(e.unwrap());else if(e instanceof Uo)return wr(e.unwrap());else if(e instanceof Lo)return wr(e._def.innerType);else return[]},Al,Co,xr,Za,ec,Ns,Oo,jo,qo,Nn,Do,Is,lr,ur,pn,Mo,Lo,tc,M5,Pl,rc,Uo,L5,K,v,fe,U5,F5,Ue,V5,z5,G5,K5,H5,B5,W5,Y5,Ze,ne,X5,EF,Yw,J5,Q5,wF,Z5,e3,t3,r3,In,Ve,n3,s3,o3,i3,a3,c3,u3;var Xw=F(()=>{Ha();Ba();Gw();Tl();Ro();Z2=/^c[^\s-]{8,}$/i,eF=/^[0-9a-z]+$/,tF=/^[0-9A-HJKMNP-TV-Z]{26}$/i,rF=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,nF=/^[a-z0-9_-]{21}$/i,sF=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,oF=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,iF=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,cF=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,uF=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,lF=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,dF=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,fF=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,pF=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,hF=new RegExp(`^${Hw}$`);br=class br extends ee{_parse(e){if(this._def.coerce)e.data=String(e.data);if(this._getType(e)!==N.string){let s=this._getOrReturnCtx(e);return k(s,{code:b.invalid_type,expected:N.string,received:s.parsedType}),G}let r=new Be,n=void 0;for(let s of this._def.checks)if(s.kind==="min"){if(e.data.length<s.value)n=this._getOrReturnCtx(e,n),k(n,{code:b.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty()}else if(s.kind==="max"){if(e.data.length>s.value)n=this._getOrReturnCtx(e,n),k(n,{code:b.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),r.dirty()}else if(s.kind==="length"){let o=e.data.length>s.value,i=e.data.length<s.value;if(o||i){if(n=this._getOrReturnCtx(e,n),o)k(n,{code:b.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message});else if(i)k(n,{code:b.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message});r.dirty()}}else if(s.kind==="email"){if(!iF.test(e.data))n=this._getOrReturnCtx(e,n),k(n,{validation:"email",code:b.invalid_string,message:s.message}),r.dirty()}else if(s.kind==="emoji"){if(!kl)kl=new RegExp(aF,"u");if(!kl.test(e.data))n=this._getOrReturnCtx(e,n),k(n,{validation:"emoji",code:b.invalid_string,message:s.message}),r.dirty()}else if(s.kind==="uuid"){if(!rF.test(e.data))n=this._getOrReturnCtx(e,n),k(n,{validation:"uuid",code:b.invalid_string,message:s.message}),r.dirty()}else if(s.kind==="nanoid"){if(!nF.test(e.data))n=this._getOrReturnCtx(e,n),k(n,{validation:"nanoid",code:b.invalid_string,message:s.message}),r.dirty()}else if(s.kind==="cuid"){if(!Z2.test(e.data))n=this._getOrReturnCtx(e,n),k(n,{validation:"cuid",code:b.invalid_string,message:s.message}),r.dirty()}else if(s.kind==="cuid2"){if(!eF.test(e.data))n=this._getOrReturnCtx(e,n),k(n,{validation:"cuid2",code:b.invalid_string,message:s.message}),r.dirty()}else if(s.kind==="ulid"){if(!tF.test(e.data))n=this._getOrReturnCtx(e,n),k(n,{validation:"ulid",code:b.invalid_string,message:s.message}),r.dirty()}else if(s.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),k(n,{validation:"url",code:b.invalid_string,message:s.message}),r.dirty()}else if(s.kind==="regex"){if(s.regex.lastIndex=0,!s.regex.test(e.data))n=this._getOrReturnCtx(e,n),k(n,{validation:"regex",code:b.invalid_string,message:s.message}),r.dirty()}else if(s.kind==="trim")e.data=e.data.trim();else if(s.kind==="includes"){if(!e.data.includes(s.value,s.position))n=this._getOrReturnCtx(e,n),k(n,{code:b.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),r.dirty()}else if(s.kind==="toLowerCase")e.data=e.data.toLowerCase();else if(s.kind==="toUpperCase")e.data=e.data.toUpperCase();else if(s.kind==="startsWith"){if(!e.data.startsWith(s.value))n=this._getOrReturnCtx(e,n),k(n,{code:b.invalid_string,validation:{startsWith:s.value},message:s.message}),r.dirty()}else if(s.kind==="endsWith"){if(!e.data.endsWith(s.value))n=this._getOrReturnCtx(e,n),k(n,{code:b.invalid_string,validation:{endsWith:s.value},message:s.message}),r.dirty()}else if(s.kind==="datetime"){if(!gF(s).test(e.data))n=this._getOrReturnCtx(e,n),k(n,{code:b.invalid_string,validation:"datetime",message:s.message}),r.dirty()}else if(s.kind==="date"){if(!hF.test(e.data))n=this._getOrReturnCtx(e,n),k(n,{code:b.invalid_string,validation:"date",message:s.message}),r.dirty()}else if(s.kind==="time"){if(!mF(s).test(e.data))n=this._getOrReturnCtx(e,n),k(n,{code:b.invalid_string,validation:"time",message:s.message}),r.dirty()}else if(s.kind==="duration"){if(!oF.test(e.data))n=this._getOrReturnCtx(e,n),k(n,{validation:"duration",code:b.invalid_string,message:s.message}),r.dirty()}else if(s.kind==="ip"){if(!yF(e.data,s.version))n=this._getOrReturnCtx(e,n),k(n,{validation:"ip",code:b.invalid_string,message:s.message}),r.dirty()}else if(s.kind==="jwt"){if(!_F(e.data,s.alg))n=this._getOrReturnCtx(e,n),k(n,{validation:"jwt",code:b.invalid_string,message:s.message}),r.dirty()}else if(s.kind==="cidr"){if(!vF(e.data,s.version))n=this._getOrReturnCtx(e,n),k(n,{validation:"cidr",code:b.invalid_string,message:s.message}),r.dirty()}else if(s.kind==="base64"){if(!fF.test(e.data))n=this._getOrReturnCtx(e,n),k(n,{validation:"base64",code:b.invalid_string,message:s.message}),r.dirty()}else if(s.kind==="base64url"){if(!pF.test(e.data))n=this._getOrReturnCtx(e,n),k(n,{validation:"base64url",code:b.invalid_string,message:s.message}),r.dirty()}else re.assertNever(s);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement((n)=>e.test(n),{validation:t,code:b.invalid_string,...D.errToObj(r)})}_addCheck(e){return new br({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...D.errToObj(e)})}url(e){return this._addCheck({kind:"url",...D.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...D.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...D.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...D.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...D.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...D.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...D.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...D.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...D.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...D.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...D.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...D.errToObj(e)})}datetime(e){if(typeof e==="string")return this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e});return this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...D.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){if(typeof e==="string")return this._addCheck({kind:"time",precision:null,message:e});return this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...D.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...D.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...D.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...D.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...D.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...D.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...D.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...D.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...D.errToObj(t)})}nonempty(e){return this.min(1,D.errToObj(e))}trim(){return new br({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new br({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new br({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find((e)=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find((e)=>e.kind==="date")}get isTime(){return!!this._def.checks.find((e)=>e.kind==="time")}get isDuration(){return!!this._def.checks.find((e)=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find((e)=>e.kind==="email")}get isURL(){return!!this._def.checks.find((e)=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find((e)=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find((e)=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find((e)=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find((e)=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find((e)=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find((e)=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find((e)=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find((e)=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find((e)=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find((e)=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxLength(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}};br.create=(e)=>new br({checks:[],typeName:K.ZodString,coerce:e?.coerce??!1,...Q(e)});As=class As extends ee{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce)e.data=Number(e.data);if(this._getType(e)!==N.number){let s=this._getOrReturnCtx(e);return k(s,{code:b.invalid_type,expected:N.number,received:s.parsedType}),G}let r=void 0,n=new Be;for(let s of this._def.checks)if(s.kind==="int"){if(!re.isInteger(e.data))r=this._getOrReturnCtx(e,r),k(r,{code:b.invalid_type,expected:"integer",received:"float",message:s.message}),n.dirty()}else if(s.kind==="min"){if(s.inclusive?e.data<s.value:e.data<=s.value)r=this._getOrReturnCtx(e,r),k(r,{code:b.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()}else if(s.kind==="max"){if(s.inclusive?e.data>s.value:e.data>=s.value)r=this._getOrReturnCtx(e,r),k(r,{code:b.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),n.dirty()}else if(s.kind==="multipleOf"){if($F(e.data,s.value)!==0)r=this._getOrReturnCtx(e,r),k(r,{code:b.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()}else if(s.kind==="finite"){if(!Number.isFinite(e.data))r=this._getOrReturnCtx(e,r),k(r,{code:b.not_finite,message:s.message}),n.dirty()}else re.assertNever(s);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,D.toString(t))}gt(e,t){return this.setLimit("min",e,!1,D.toString(t))}lte(e,t){return this.setLimit("max",e,!0,D.toString(t))}lt(e,t){return this.setLimit("max",e,!1,D.toString(t))}setLimit(e,t,r,n){return new As({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:D.toString(n)}]})}_addCheck(e){return new As({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:D.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:D.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:D.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:D.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:D.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:D.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:D.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:D.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:D.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}get isInt(){return!!this._def.checks.find((e)=>e.kind==="int"||e.kind==="multipleOf"&&re.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks)if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;else if(r.kind==="min"){if(t===null||r.value>t)t=r.value}else if(r.kind==="max"){if(e===null||r.value<e)e=r.value}return Number.isFinite(t)&&Number.isFinite(e)}};As.create=(e)=>new As({checks:[],typeName:K.ZodNumber,coerce:e?.coerce||!1,...Q(e)});Ps=class Ps extends ee{constructor(){super(...arguments);this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==N.bigint)return this._getInvalidInput(e);let r=void 0,n=new Be;for(let s of this._def.checks)if(s.kind==="min"){if(s.inclusive?e.data<s.value:e.data<=s.value)r=this._getOrReturnCtx(e,r),k(r,{code:b.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty()}else if(s.kind==="max"){if(s.inclusive?e.data>s.value:e.data>=s.value)r=this._getOrReturnCtx(e,r),k(r,{code:b.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),n.dirty()}else if(s.kind==="multipleOf"){if(e.data%s.value!==BigInt(0))r=this._getOrReturnCtx(e,r),k(r,{code:b.not_multiple_of,multipleOf:s.value,message:s.message}),n.dirty()}else re.assertNever(s);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return k(t,{code:b.invalid_type,expected:N.bigint,received:t.parsedType}),G}gte(e,t){return this.setLimit("min",e,!0,D.toString(t))}gt(e,t){return this.setLimit("min",e,!1,D.toString(t))}lte(e,t){return this.setLimit("max",e,!0,D.toString(t))}lt(e,t){return this.setLimit("max",e,!1,D.toString(t))}setLimit(e,t,r,n){return new Ps({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:D.toString(n)}]})}_addCheck(e){return new Ps({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:D.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:D.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:D.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:D.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:D.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e}get maxValue(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e}};Ps.create=(e)=>new Ps({checks:[],typeName:K.ZodBigInt,coerce:e?.coerce??!1,...Q(e)});Ya=class Ya extends ee{_parse(e){if(this._def.coerce)e.data=Boolean(e.data);if(this._getType(e)!==N.boolean){let r=this._getOrReturnCtx(e);return k(r,{code:b.invalid_type,expected:N.boolean,received:r.parsedType}),G}return Qe(e.data)}};Ya.create=(e)=>new Ya({typeName:K.ZodBoolean,coerce:e?.coerce||!1,...Q(e)});Ao=class Ao extends ee{_parse(e){if(this._def.coerce)e.data=new Date(e.data);if(this._getType(e)!==N.date){let s=this._getOrReturnCtx(e);return k(s,{code:b.invalid_type,expected:N.date,received:s.parsedType}),G}if(Number.isNaN(e.data.getTime())){let s=this._getOrReturnCtx(e);return k(s,{code:b.invalid_date}),G}let r=new Be,n=void 0;for(let s of this._def.checks)if(s.kind==="min"){if(e.data.getTime()<s.value)n=this._getOrReturnCtx(e,n),k(n,{code:b.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),r.dirty()}else if(s.kind==="max"){if(e.data.getTime()>s.value)n=this._getOrReturnCtx(e,n),k(n,{code:b.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),r.dirty()}else re.assertNever(s);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ao({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:D.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:D.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)if(t.kind==="min"){if(e===null||t.value>e)e=t.value}return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)if(t.kind==="max"){if(e===null||t.value<e)e=t.value}return e!=null?new Date(e):null}};Ao.create=(e)=>new Ao({checks:[],coerce:e?.coerce||!1,typeName:K.ZodDate,...Q(e)});Xa=class Xa extends ee{_parse(e){if(this._getType(e)!==N.symbol){let r=this._getOrReturnCtx(e);return k(r,{code:b.invalid_type,expected:N.symbol,received:r.parsedType}),G}return Qe(e.data)}};Xa.create=(e)=>new Xa({typeName:K.ZodSymbol,...Q(e)});Po=class Po extends ee{_parse(e){if(this._getType(e)!==N.undefined){let r=this._getOrReturnCtx(e);return k(r,{code:b.invalid_type,expected:N.undefined,received:r.parsedType}),G}return Qe(e.data)}};Po.create=(e)=>new Po({typeName:K.ZodUndefined,...Q(e)});No=class No extends ee{_parse(e){if(this._getType(e)!==N.null){let r=this._getOrReturnCtx(e);return k(r,{code:b.invalid_type,expected:N.null,received:r.parsedType}),G}return Qe(e.data)}};No.create=(e)=>new No({typeName:K.ZodNull,...Q(e)});Ja=class Ja extends ee{constructor(){super(...arguments);this._any=!0}_parse(e){return Qe(e.data)}};Ja.create=(e)=>new Ja({typeName:K.ZodAny,...Q(e)});Pn=class Pn extends ee{constructor(){super(...arguments);this._unknown=!0}_parse(e){return Qe(e.data)}};Pn.create=(e)=>new Pn({typeName:K.ZodUnknown,...Q(e)});Sr=class Sr extends ee{_parse(e){let t=this._getOrReturnCtx(e);return k(t,{code:b.invalid_type,expected:N.never,received:t.parsedType}),G}};Sr.create=(e)=>new Sr({typeName:K.ZodNever,...Q(e)});Qa=class Qa extends ee{_parse(e){if(this._getType(e)!==N.undefined){let r=this._getOrReturnCtx(e);return k(r,{code:b.invalid_type,expected:N.void,received:r.parsedType}),G}return Qe(e.data)}};Qa.create=(e)=>new Qa({typeName:K.ZodVoid,...Q(e)});cr=class cr extends ee{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),n=this._def;if(t.parsedType!==N.array)return k(t,{code:b.invalid_type,expected:N.array,received:t.parsedType}),G;if(n.exactLength!==null){let o=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;if(o||i)k(t,{code:o?b.too_big:b.too_small,minimum:i?n.exactLength.value:void 0,maximum:o?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),r.dirty()}if(n.minLength!==null){if(t.data.length<n.minLength.value)k(t,{code:b.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),r.dirty()}if(n.maxLength!==null){if(t.data.length>n.maxLength.value)k(t,{code:b.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),r.dirty()}if(t.common.async)return Promise.all([...t.data].map((o,i)=>n.type._parseAsync(new At(t,o,t.path,i)))).then((o)=>Be.mergeArray(r,o));let s=[...t.data].map((o,i)=>n.type._parseSync(new At(t,o,t.path,i)));return Be.mergeArray(r,s)}get element(){return this._def.type}min(e,t){return new cr({...this._def,minLength:{value:e,message:D.toString(t)}})}max(e,t){return new cr({...this._def,maxLength:{value:e,message:D.toString(t)}})}length(e,t){return new cr({...this._def,exactLength:{value:e,message:D.toString(t)}})}nonempty(e){return this.min(1,e)}};cr.create=(e,t)=>new cr({type:e,minLength:null,maxLength:null,exactLength:null,typeName:K.ZodArray,...Q(t)});Ce=class Ce extends ee{constructor(){super(...arguments);this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=re.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==N.object){let c=this._getOrReturnCtx(e);return k(c,{code:b.invalid_type,expected:N.object,received:c.parsedType}),G}let{status:r,ctx:n}=this._processInputParams(e),{shape:s,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof Sr&&this._def.unknownKeys==="strip")){for(let c in n.data)if(!o.includes(c))i.push(c)}let a=[];for(let c of o){let u=s[c],d=n.data[c];a.push({key:{status:"valid",value:c},value:u._parse(new At(n,d,n.path,c)),alwaysSet:c in n.data})}if(this._def.catchall instanceof Sr){let c=this._def.unknownKeys;if(c==="passthrough")for(let u of i)a.push({key:{status:"valid",value:u},value:{status:"valid",value:n.data[u]}});else if(c==="strict"){if(i.length>0)k(n,{code:b.unrecognized_keys,keys:i}),r.dirty()}else if(c==="strip");else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let c=this._def.catchall;for(let u of i){let d=n.data[u];a.push({key:{status:"valid",value:u},value:c._parse(new At(n,d,n.path,u)),alwaysSet:u in n.data})}}if(n.common.async)return Promise.resolve().then(async()=>{let c=[];for(let u of a){let d=await u.key,l=await u.value;c.push({key:d,value:l,alwaysSet:u.alwaysSet})}return c}).then((c)=>Be.mergeObjectSync(r,c));else return Be.mergeObjectSync(r,a)}get shape(){return this._def.shape()}strict(e){return D.errToObj,new Ce({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,r)=>{let n=this._def.errorMap?.(t,r).message??r.defaultError;if(t.code==="unrecognized_keys")return{message:D.errToObj(e).message??n};return{message:n}}}:{}})}strip(){return new Ce({...this._def,unknownKeys:"strip"})}passthrough(){return new Ce({...this._def,unknownKeys:"passthrough"})}extend(e){return new Ce({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Ce({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:K.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new Ce({...this._def,catchall:e})}pick(e){let t={};for(let r of re.objectKeys(e))if(e[r]&&this.shape[r])t[r]=this.shape[r];return new Ce({...this._def,shape:()=>t})}omit(e){let t={};for(let r of re.objectKeys(this.shape))if(!e[r])t[r]=this.shape[r];return new Ce({...this._def,shape:()=>t})}deepPartial(){return Os(this)}partial(e){let t={};for(let r of re.objectKeys(this.shape)){let n=this.shape[r];if(e&&!e[r])t[r]=n;else t[r]=n.optional()}return new Ce({...this._def,shape:()=>t})}required(e){let t={};for(let r of re.objectKeys(this.shape))if(e&&!e[r])t[r]=this.shape[r];else{let s=this.shape[r];while(s instanceof ur)s=s._def.innerType;t[r]=s}return new Ce({...this._def,shape:()=>t})}keyof(){return Ww(re.objectKeys(this.shape))}};Ce.create=(e,t)=>new Ce({shape:()=>e,unknownKeys:"strip",catchall:Sr.create(),typeName:K.ZodObject,...Q(t)});Ce.strictCreate=(e,t)=>new Ce({shape:()=>e,unknownKeys:"strict",catchall:Sr.create(),typeName:K.ZodObject,...Q(t)});Ce.lazycreate=(e,t)=>new Ce({shape:e,unknownKeys:"strip",catchall:Sr.create(),typeName:K.ZodObject,...Q(t)});Io=class Io extends ee{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;function n(s){for(let i of s)if(i.result.status==="valid")return i.result;for(let i of s)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;let o=s.map((i)=>new ft(i.ctx.common.issues));return k(t,{code:b.invalid_union,unionErrors:o}),G}if(t.common.async)return Promise.all(r.map(async(s)=>{let o={...t,common:{...t.common,issues:[]},parent:null};return{result:await s._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(n);else{let s=void 0,o=[];for(let a of r){let c={...t,common:{...t.common,issues:[]},parent:null},u=a._parseSync({data:t.data,path:t.path,parent:c});if(u.status==="valid")return u;else if(u.status==="dirty"&&!s)s={result:u,ctx:c};if(c.common.issues.length)o.push(c.common.issues)}if(s)return t.common.issues.push(...s.ctx.common.issues),s.result;let i=o.map((a)=>new ft(a));return k(t,{code:b.invalid_union,unionErrors:i}),G}}get options(){return this._def.options}};Io.create=(e,t)=>new Io({options:e,typeName:K.ZodUnion,...Q(t)});Al=class Al extends ee{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==N.object)return k(t,{code:b.invalid_type,expected:N.object,received:t.parsedType}),G;let r=this.discriminator,n=t.data[r],s=this.optionsMap.get(n);if(!s)return k(t,{code:b.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),G;if(t.common.async)return s._parseAsync({data:t.data,path:t.path,parent:t});else return s._parseSync({data:t.data,path:t.path,parent:t})}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let n=new Map;for(let s of t){let o=wr(s.shape[e]);if(!o.length)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of o){if(n.has(i))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);n.set(i,s)}}return new Al({typeName:K.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n,...Q(r)})}};Co=class Co extends ee{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=(s,o)=>{if(xl(s)||xl(o))return G;let i=Ol(s.value,o.value);if(!i.valid)return k(r,{code:b.invalid_intersection_types}),G;if(Rl(s)||Rl(o))t.dirty();return{status:t.value,value:i.data}};if(r.common.async)return Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([s,o])=>n(s,o));else return n(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};Co.create=(e,t,r)=>new Co({left:e,right:t,typeName:K.ZodIntersection,...Q(r)});xr=class xr extends ee{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==N.array)return k(r,{code:b.invalid_type,expected:N.array,received:r.parsedType}),G;if(r.data.length<this._def.items.length)return k(r,{code:b.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),G;if(!this._def.rest&&r.data.length>this._def.items.length)k(r,{code:b.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty();let s=[...r.data].map((o,i)=>{let a=this._def.items[i]||this._def.rest;if(!a)return null;return a._parse(new At(r,o,r.path,i))}).filter((o)=>!!o);if(r.common.async)return Promise.all(s).then((o)=>Be.mergeArray(t,o));else return Be.mergeArray(t,s)}get items(){return this._def.items}rest(e){return new xr({...this._def,rest:e})}};xr.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new xr({items:e,typeName:K.ZodTuple,rest:null,...Q(t)})};Za=class Za extends ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==N.object)return k(r,{code:b.invalid_type,expected:N.object,received:r.parsedType}),G;let n=[],s=this._def.keyType,o=this._def.valueType;for(let i in r.data)n.push({key:s._parse(new At(r,i,r.path,i)),value:o._parse(new At(r,r.data[i],r.path,i)),alwaysSet:i in r.data});if(r.common.async)return Be.mergeObjectAsync(t,n);else return Be.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,r){if(t instanceof ee)return new Za({keyType:e,valueType:t,typeName:K.ZodRecord,...Q(r)});return new Za({keyType:br.create(),valueType:e,typeName:K.ZodRecord,...Q(t)})}};ec=class ec extends ee{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==N.map)return k(r,{code:b.invalid_type,expected:N.map,received:r.parsedType}),G;let n=this._def.keyType,s=this._def.valueType,o=[...r.data.entries()].map(([i,a],c)=>({key:n._parse(new At(r,i,r.path,[c,"key"])),value:s._parse(new At(r,a,r.path,[c,"value"]))}));if(r.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let a of o){let c=await a.key,u=await a.value;if(c.status==="aborted"||u.status==="aborted")return G;if(c.status==="dirty"||u.status==="dirty")t.dirty();i.set(c.value,u.value)}return{status:t.value,value:i}})}else{let i=new Map;for(let a of o){let{key:c,value:u}=a;if(c.status==="aborted"||u.status==="aborted")return G;if(c.status==="dirty"||u.status==="dirty")t.dirty();i.set(c.value,u.value)}return{status:t.value,value:i}}}};ec.create=(e,t,r)=>new ec({valueType:t,keyType:e,typeName:K.ZodMap,...Q(r)});Ns=class Ns extends ee{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==N.set)return k(r,{code:b.invalid_type,expected:N.set,received:r.parsedType}),G;let n=this._def;if(n.minSize!==null){if(r.data.size<n.minSize.value)k(r,{code:b.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()}if(n.maxSize!==null){if(r.data.size>n.maxSize.value)k(r,{code:b.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty()}let s=this._def.valueType;function o(a){let c=new Set;for(let u of a){if(u.status==="aborted")return G;if(u.status==="dirty")t.dirty();c.add(u.value)}return{status:t.value,value:c}}let i=[...r.data.values()].map((a,c)=>s._parse(new At(r,a,r.path,c)));if(r.common.async)return Promise.all(i).then((a)=>o(a));else return o(i)}min(e,t){return new Ns({...this._def,minSize:{value:e,message:D.toString(t)}})}max(e,t){return new Ns({...this._def,maxSize:{value:e,message:D.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Ns.create=(e,t)=>new Ns({valueType:e,minSize:null,maxSize:null,typeName:K.ZodSet,...Q(t)});Oo=class Oo extends ee{constructor(){super(...arguments);this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==N.function)return k(t,{code:b.invalid_type,expected:N.function,received:t.parsedType}),G;function r(i,a){return Wa({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,To(),fn].filter((c)=>!!c),issueData:{code:b.invalid_arguments,argumentsError:a}})}function n(i,a){return Wa({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,To(),fn].filter((c)=>!!c),issueData:{code:b.invalid_return_type,returnTypeError:a}})}let s={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Is){let i=this;return Qe(async function(...a){let c=new ft([]),u=await i._def.args.parseAsync(a,s).catch((p)=>{throw c.addIssue(r(a,p)),c}),d=await Reflect.apply(o,this,u);return await i._def.returns._def.type.parseAsync(d,s).catch((p)=>{throw c.addIssue(n(d,p)),c})})}else{let i=this;return Qe(function(...a){let c=i._def.args.safeParse(a,s);if(!c.success)throw new ft([r(a,c.error)]);let u=Reflect.apply(o,this,c.data),d=i._def.returns.safeParse(u,s);if(!d.success)throw new ft([n(u,d.error)]);return d.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Oo({...this._def,args:xr.create(e).rest(Pn.create())})}returns(e){return new Oo({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new Oo({args:e?e:xr.create([]).rest(Pn.create()),returns:t||Pn.create(),typeName:K.ZodFunction,...Q(r)})}};jo=class jo extends ee{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};jo.create=(e,t)=>new jo({getter:e,typeName:K.ZodLazy,...Q(t)});qo=class qo extends ee{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return k(t,{received:t.data,code:b.invalid_literal,expected:this._def.value}),G}return{status:"valid",value:e.data}}get value(){return this._def.value}};qo.create=(e,t)=>new qo({value:e,typeName:K.ZodLiteral,...Q(t)});Nn=class Nn extends ee{_parse(e){if(typeof e.data!=="string"){let t=this._getOrReturnCtx(e),r=this._def.values;return k(t,{expected:re.joinValues(r),received:t.parsedType,code:b.invalid_type}),G}if(!this._cache)this._cache=new Set(this._def.values);if(!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return k(t,{received:t.data,code:b.invalid_enum_value,options:r}),G}return Qe(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Nn.create(e,{...this._def,...t})}exclude(e,t=this._def){return Nn.create(this.options.filter((r)=>!e.includes(r)),{...this._def,...t})}};Nn.create=Ww;Do=class Do extends ee{_parse(e){let t=re.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==N.string&&r.parsedType!==N.number){let n=re.objectValues(t);return k(r,{expected:re.joinValues(n),received:r.parsedType,code:b.invalid_type}),G}if(!this._cache)this._cache=new Set(re.getValidEnumValues(this._def.values));if(!this._cache.has(e.data)){let n=re.objectValues(t);return k(r,{received:r.data,code:b.invalid_enum_value,options:n}),G}return Qe(e.data)}get enum(){return this._def.values}};Do.create=(e,t)=>new Do({values:e,typeName:K.ZodNativeEnum,...Q(t)});Is=class Is extends ee{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==N.promise&&t.common.async===!1)return k(t,{code:b.invalid_type,expected:N.promise,received:t.parsedType}),G;let r=t.parsedType===N.promise?t.data:Promise.resolve(t.data);return Qe(r.then((n)=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Is.create=(e,t)=>new Is({type:e,typeName:K.ZodPromise,...Q(t)});lr=class lr extends ee{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===K.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),n=this._def.effect||null,s={addIssue:(o)=>{if(k(r,o),o.fatal)t.abort();else t.dirty()},get path(){return r.path}};if(s.addIssue=s.addIssue.bind(s),n.type==="preprocess"){let o=n.transform(r.data,s);if(r.common.async)return Promise.resolve(o).then(async(i)=>{if(t.value==="aborted")return G;let a=await this._def.schema._parseAsync({data:i,path:r.path,parent:r});if(a.status==="aborted")return G;if(a.status==="dirty")return ks(a.value);if(t.value==="dirty")return ks(a.value);return a});else{if(t.value==="aborted")return G;let i=this._def.schema._parseSync({data:o,path:r.path,parent:r});if(i.status==="aborted")return G;if(i.status==="dirty")return ks(i.value);if(t.value==="dirty")return ks(i.value);return i}}if(n.type==="refinement"){let o=(i)=>{let a=n.refinement(i,s);if(r.common.async)return Promise.resolve(a);if(a instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(r.common.async===!1){let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(i.status==="aborted")return G;if(i.status==="dirty")t.dirty();return o(i.value),{status:t.value,value:i.value}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((i)=>{if(i.status==="aborted")return G;if(i.status==="dirty")t.dirty();return o(i.value).then(()=>({status:t.value,value:i.value}))})}if(n.type==="transform")if(r.common.async===!1){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!An(o))return G;let i=n.transform(o.value,s);if(i instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then((o)=>{if(!An(o))return G;return Promise.resolve(n.transform(o.value,s)).then((i)=>({status:t.value,value:i}))});re.assertNever(n)}};lr.create=(e,t,r)=>new lr({schema:e,typeName:K.ZodEffects,effect:t,...Q(r)});lr.createWithPreprocess=(e,t,r)=>new lr({schema:t,effect:{type:"preprocess",transform:e},typeName:K.ZodEffects,...Q(r)});ur=class ur extends ee{_parse(e){if(this._getType(e)===N.undefined)return Qe(void 0);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ur.create=(e,t)=>new ur({innerType:e,typeName:K.ZodOptional,...Q(t)});pn=class pn extends ee{_parse(e){if(this._getType(e)===N.null)return Qe(null);return this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};pn.create=(e,t)=>new pn({innerType:e,typeName:K.ZodNullable,...Q(t)});Mo=class Mo extends ee{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;if(t.parsedType===N.undefined)r=this._def.defaultValue();return this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};Mo.create=(e,t)=>new Mo({innerType:e,typeName:K.ZodDefault,defaultValue:typeof t.default==="function"?t.default:()=>t.default,...Q(t)});Lo=class Lo extends ee{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},n=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});if(ko(n))return n.then((s)=>({status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ft(r.common.issues)},input:r.data})}));else return{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new ft(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};Lo.create=(e,t)=>new Lo({innerType:e,typeName:K.ZodCatch,catchValue:typeof t.catch==="function"?t.catch:()=>t.catch,...Q(t)});tc=class tc extends ee{_parse(e){if(this._getType(e)!==N.nan){let r=this._getOrReturnCtx(e);return k(r,{code:b.invalid_type,expected:N.nan,received:r.parsedType}),G}return{status:"valid",value:e.data}}};tc.create=(e)=>new tc({typeName:K.ZodNaN,...Q(e)});M5=Symbol("zod_brand");Pl=class Pl extends ee{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}};rc=class rc extends ee{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let s=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});if(s.status==="aborted")return G;if(s.status==="dirty")return t.dirty(),ks(s.value);else return this._def.out._parseAsync({data:s.value,path:r.path,parent:r})})();else{let n=this._def.in._parseSync({data:r.data,path:r.path,parent:r});if(n.status==="aborted")return G;if(n.status==="dirty")return t.dirty(),{status:"dirty",value:n.value};else return this._def.out._parseSync({data:n.value,path:r.path,parent:r})}}static create(e,t){return new rc({in:e,out:t,typeName:K.ZodPipeline})}};Uo=class Uo extends ee{_parse(e){let t=this._def.innerType._parse(e),r=(n)=>{if(An(n))n.value=Object.freeze(n.value);return n};return ko(t)?t.then((n)=>r(n)):r(t)}unwrap(){return this._def.innerType}};Uo.create=(e,t)=>new Uo({innerType:e,typeName:K.ZodReadonly,...Q(t)});L5={object:Ce.lazycreate};(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(K||(K={}));v=br.create,fe=As.create,U5=tc.create,F5=Ps.create,Ue=Ya.create,V5=Ao.create,z5=Xa.create,G5=Po.create,K5=No.create,H5=Ja.create,B5=Pn.create,W5=Sr.create,Y5=Qa.create,Ze=cr.create,ne=Ce.create,X5=Ce.strictCreate,EF=Io.create,Yw=Al.create,J5=Co.create,Q5=xr.create,wF=Za.create,Z5=ec.create,e3=Ns.create,t3=Oo.create,r3=jo.create,In=qo.create,Ve=Nn.create,n3=Do.create,s3=Is.create,o3=lr.create,i3=ur.create,a3=pn.create,c3=lr.createWithPreprocess,u3=rc.create});var Nl=F(()=>{Ba();Tl();zw();Ro();Xw();Ha()});var jn=F(()=>{Nl();Nl()});function $3(e){return SF.includes(e)}var bF,qn,SF,E3,xF,Jw,RF,Qw,TF,kF,w3,OF,b3,S3,x3,R3,AF,Zw,PF,eb,T3=20,k3=500,NF,O3;var nc=F(()=>{jn();bF=Ve(["pending","verified","approved","revoked"]),qn=Ve(["person","service","test"]),SF=qn.options;E3={nemarOwner:"service",nemarAdmin:"service","test-admin":"service","test-owner":"service","cool-vibers":"test","test-user":"test","test-pending":"test","test-verified":"test","test-revoked":"test"},xF=Ve(["same_kind","orcid_linked","own_account","kind_changed_concurrently"]),Jw=xF.options,RF=Ve(["active","pending","revoked"]),Qw=ne({field:v(),blocks:Ze(v()).optional(),set_on:Ze(v()).optional()}).passthrough(),TF=ne({id:fe().int(),username:v().nullable(),email:v(),github_username:v().nullable(),role:v(),orcid:v().nullable().optional(),created_at:v().optional(),approved_at:v().nullable().optional(),dataset_count:fe().int().optional(),sandbox_completed:Ue().optional(),sandbox_completed_at:v().nullable().optional(),sandbox_dataset_id:v().nullable().optional(),service_access:Ue().optional(),status:bF.optional(),email_verified:Ue().optional(),orcid_verified:Ue().optional(),given_name:v().nullable().optional(),family_name:v().nullable().optional(),profile_gaps:Ze(Qw).optional(),username_auto_assigned:Ue().optional(),account_kind:qn.optional()}).passthrough(),kF=ne({prefix:v(),created_at:v(),last_used_at:v().nullable()}).passthrough().nullable(),w3=ne({user:TF,token:kF.optional()}).passthrough(),OF=ne({id:fe().int(),username:v().nullable(),email:v(),github_username:v().nullable(),status:v(),email_verified:fe().int().nullable().optional(),role:v().nullable(),created_at:v(),approved_at:v().nullable().optional(),revoked_at:v().nullable().optional(),signup_source:v().nullable().optional(),service_access:fe().int().nullable().optional(),service_access_granted_at:v().nullable().optional(),given_name:v().nullable().optional(),family_name:v().nullable().optional(),orcid:v().nullable().optional(),upload_access_requested_at:v().nullable().optional(),account_kind:qn.optional(),matched_in:Ze(v()).optional(),match_kind:v().optional()}).passthrough(),b3=ne({users:Ze(OF),count:fe().int()}).passthrough(),S3=Ve(["assigned","would_assign","single_name","no_name","lookup_failed","conflict","exhausted","write_failed"]),x3=Ve(["sent","already_verified","skipped_fence","rate_limited","failed","not_attempted"]),R3=ne({suggestion:v().nullable(),based_on:Ve(["name","unavailable","exhausted"])}).passthrough(),AF=Ve(["why_required","email_not_verified","profile_incomplete","github_username_unverified","github_unavailable","already_approved"]),Zw=AF.options,PF=Ve(["invalid_github_username","city_required","country_required","empty_patch","username_too_short","username_too_long","username_charset","given_name_required","family_name_required","username_taken","username_locked","name_is_orcid_canonical","account_revoked","github_unavailable","same_email","code_expired","code_incorrect","orcid_already_have","orcid_unavailable"]),eb=PF.options,NF=ne({id:fe().int(),email:v(),username:v().nullable(),role:v(),status:RF,email_verified:Ue(),given_name:v().nullable(),family_name:v().nullable(),orcid:v().nullable(),orcid_verified:Ue(),github_username:v().nullable(),city:v().nullable(),country:v().nullable(),affiliation:v().nullable(),service_access:Ue(),service_access_granted_at:v().nullable(),upload_access_requested_at:v().nullable(),profile_gaps:Ze(Qw),username_auto_assigned:Ue()}).passthrough(),O3=ne({user:NF.nullable()}).passthrough()});function dr(e){if(e instanceof Error)return e.message;return String(e)}function P3(e){if(!(e instanceof fr)||e.statusCode!==404)return!1;let t=e.rawBody;return typeof t==="object"&&t!==null&&t.error==="Not Found"&&typeof t.message==="string"}var fr,Il;var Cl=F(()=>{fr=class fr extends Error{statusCode;details;step;blockReason;missing;code;reason;rawBody;constructor(e,t,r,n,s,o){super(t);this.statusCode=e;this.details=r;this.step=n;this.blockReason=s;this.missing=o;this.name="ApiError"}};Il=class Il extends fr{mode;eta;constructor(e,t,r,n){super(503,t,n);this.mode=e;this.eta=r;this.name="MaintenanceError"}}});function jF(){let e=new Map;for(let[t,r]of Object.entries(we)){for(let[n,s]of Object.entries(r))we[n]={open:`\x1B[${s[0]}m`,close:`\x1B[${s[1]}m`},r[n]=we[n],e.set(s[0],s[1]);Object.defineProperty(we,t,{value:r,enumerable:!1})}return Object.defineProperty(we,"codes",{value:e,enumerable:!1}),we.color.close="\x1B[39m",we.bgColor.close="\x1B[49m",we.color.ansi=tb(),we.color.ansi256=rb(),we.color.ansi16m=nb(),we.bgColor.ansi=tb(10),we.bgColor.ansi256=rb(10),we.bgColor.ansi16m=nb(10),Object.defineProperties(we,{rgbToAnsi256:{value(t,r,n){if(t===r&&r===n){if(t<8)return 16;if(t>248)return 231;return Math.round((t-8)/247*24)+232}return 16+36*Math.round(t/255*5)+6*Math.round(r/255*5)+Math.round(n/255*5)},enumerable:!1},hexToRgb:{value(t){let r=/[a-f\d]{6}|[a-f\d]{3}/i.exec(t.toString(16));if(!r)return[0,0,0];let[n]=r;if(n.length===3)n=[...n].map((o)=>o+o).join("");let s=Number.parseInt(n,16);return[s>>16&255,s>>8&255,s&255]},enumerable:!1},hexToAnsi256:{value:(t)=>we.rgbToAnsi256(...we.hexToRgb(t)),enumerable:!1},ansi256ToAnsi:{value(t){if(t<8)return 30+t;if(t<16)return 90+(t-8);let r,n,s;if(t>=232)r=((t-232)*10+8)/255,n=r,s=r;else{t-=16;let a=t%36;r=Math.floor(t/36)/5,n=Math.floor(a/6)/5,s=a%6/5}let o=Math.max(r,n,s)*2;if(o===0)return 30;let i=30+(Math.round(s)<<2|Math.round(n)<<1|Math.round(r));if(o===2)i+=60;return i},enumerable:!1},rgbToAnsi:{value:(t,r,n)=>we.ansi256ToAnsi(we.rgbToAnsi256(t,r,n)),enumerable:!1},hexToAnsi:{value:(t)=>we.ansi256ToAnsi(we.hexToAnsi256(t)),enumerable:!1}}),we}var tb=(e=0)=>(t)=>`\x1B[${t+e}m`,rb=(e=0)=>(t)=>`\x1B[${38+e};5;${t}m`,nb=(e=0)=>(t,r,n)=>`\x1B[${38+e};2;${t};${r};${n}m`,we,I3,IF,CF,C3,qF,Pt;var sb=F(()=>{we={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],gray:[90,39],grey:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}},I3=Object.keys(we.modifier),IF=Object.keys(we.color),CF=Object.keys(we.bgColor),C3=[...IF,...CF];qF=jF(),Pt=qF});import jl from"process";import DF from"os";import ob from"tty";function bt(e,t=globalThis.Deno?globalThis.Deno.args:jl.argv){let r=e.startsWith("-")?"":e.length===1?"-":"--",n=t.indexOf(r+e),s=t.indexOf("--");return n!==-1&&(s===-1||n<s)}function MF(){if("FORCE_COLOR"in be){if(be.FORCE_COLOR==="true")return 1;if(be.FORCE_COLOR==="false")return 0;return be.FORCE_COLOR.length===0?1:Math.min(Number.parseInt(be.FORCE_COLOR,10),3)}}function LF(e){if(e===0)return!1;return{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function UF(e,{streamIsTTY:t,sniffFlags:r=!0}={}){let n=MF();if(n!==void 0)sc=n;let s=r?sc:n;if(s===0)return 0;if(r){if(bt("color=16m")||bt("color=full")||bt("color=truecolor"))return 3;if(bt("color=256"))return 2}if("TF_BUILD"in be&&"AGENT_NAME"in be)return 1;if(e&&!t&&s===void 0)return 0;let o=s||0;if(be.TERM==="dumb")return o;if(jl.platform==="win32"){let i=DF.release().split(".");if(Number(i[0])>=10&&Number(i[2])>=10586)return Number(i[2])>=14931?3:2;return 1}if("CI"in be){if(["GITHUB_ACTIONS","GITEA_ACTIONS","CIRCLECI"].some((i)=>(i in be)))return 3;if(["TRAVIS","APPVEYOR","GITLAB_CI","BUILDKITE","DRONE"].some((i)=>(i in be))||be.CI_NAME==="codeship")return 1;return o}if("TEAMCITY_VERSION"in be)return/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(be.TEAMCITY_VERSION)?1:0;if(be.COLORTERM==="truecolor")return 3;if(be.TERM==="xterm-kitty")return 3;if(be.TERM==="xterm-ghostty")return 3;if(be.TERM==="wezterm")return 3;if("TERM_PROGRAM"in be){let i=Number.parseInt((be.TERM_PROGRAM_VERSION||"").split(".")[0],10);switch(be.TERM_PROGRAM){case"iTerm.app":return i>=3?3:2;case"Apple_Terminal":return 2}}if(/-256(color)?$/i.test(be.TERM))return 2;if(/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(be.TERM))return 1;if("COLORTERM"in be)return 1;return o}function ib(e,t={}){let r=UF(e,{streamIsTTY:e&&e.isTTY,...t});return LF(r)}var be,sc,FF,ab;var cb=F(()=>{({env:be}=jl);if(bt("no-color")||bt("no-colors")||bt("color=false")||bt("color=never"))sc=0;else if(bt("color")||bt("colors")||bt("color=true")||bt("color=always"))sc=1;FF={stdout:ib({isTTY:ob.isatty(1)}),stderr:ib({isTTY:ob.isatty(2)})},ab=FF});function ub(e,t,r){let n=e.indexOf(t);if(n===-1)return e;let s=t.length,o=0,i="";do i+=e.slice(o,n)+t+r,o=n+s,n=e.indexOf(t,o);while(n!==-1);return i+=e.slice(o),i}function lb(e,t,r,n){let s=0,o="";do{let i=e[n-1]==="\r";o+=e.slice(s,i?n-1:n)+t+(i?`\r
|
|
19
19
|
`:`
|
|
20
20
|
`)+r,s=n+1,n=e.indexOf(`
|
|
21
21
|
`,s)}while(n!==-1);return o+=e.slice(s),o}function Vo(e){return zF(e)}var db,fb,Dl,Cs,Fo,pb,js,VF=(e,t={})=>{if(t.level&&!(Number.isInteger(t.level)&&t.level>=0&&t.level<=3))throw Error("The `level` option should be an integer from 0 to 3");let r=db?db.level:0;e.level=t.level===void 0?r:t.level},zF=(e)=>{let t=(...r)=>r.join(" ");return VF(t,e),Object.setPrototypeOf(t,Vo.prototype),t},Ml=(e,t,r,...n)=>{if(e==="rgb"){if(t==="ansi16m")return Pt[r].ansi16m(...n);if(t==="ansi256")return Pt[r].ansi256(Pt.rgbToAnsi256(...n));return Pt[r].ansi(Pt.rgbToAnsi(...n))}if(e==="hex")return Ml("rgb",t,r,...Pt.hexToRgb(...n));return Pt[r][e](...n)},GF,KF,Ll=(e,t,r)=>{let n,s;if(r===void 0)n=e,s=t;else n=r.openAll+e,s=t+r.closeAll;return{open:e,close:t,openAll:n,closeAll:s,parent:r}},oc=(e,t,r)=>{let n=(...s)=>HF(n,s.length===1?""+s[0]:s.join(" "));return Object.setPrototypeOf(n,KF),n[Dl]=e,n[Cs]=t,n[Fo]=r,n},HF=(e,t)=>{if(e.level<=0||!t)return e[Fo]?"":t;let r=e[Cs];if(r===void 0)return t;let{openAll:n,closeAll:s}=r;if(t.includes("\x1B"))while(r!==void 0)t=ub(t,r.close,r.open),r=r.parent;let o=t.indexOf(`
|
|
@@ -23,18 +23,18 @@ ${t}`,zM,GM,KM=(e,t,r)=>{let n=r===""?"":`with ${r.trim()}() `,s=VM.bind(null,n,
|
|
|
23
23
|
`)}var Fl=!1;var{spawn:WF}=globalThis.Bun;function Vl(e,t=[]){let r=e.replace(YF,'("$1","<redacted>")');for(let n of t)if(n.length>=XF)r=r.split(n).join("<redacted>");return r}function QF(e){let t=["AWS_SESSION_TOKEN","AWS_SECRET_ACCESS_KEY","AWS_ACCESS_KEY_ID"],r=new Set;for(let n of[process.env,e??{}])for(let s of t){let o=n[s];if(typeof o==="string"&&o.length>0)r.add(o)}return[...r]}async function hb(e,t){let r=e.getReader(),n=new TextDecoder,s="";while(!0){let{done:o,value:i}=await r.read();if(o)break;if(i.byteLength===0)continue;t(),s+=n.decode(i,{stream:!0})}return s+n.decode()}async function mb(e,t={}){let r={...process.env,GIT_TERMINAL_PROMPT:"0",...t.env};for(let y of t.unsetEnv??[])delete r[y];let n=WF({cmd:e,cwd:t.cwd,...t.stdin===void 0?{}:{stdin:new TextEncoder().encode(t.stdin)},stdout:"pipe",stderr:"pipe",env:r}),s=!1,o,i,a=performance.now(),c=()=>{if(i!==void 0)clearTimeout(i),i=void 0},u=()=>{if(!t.onInactivityWarning)return;c(),i=setTimeout(()=>{i=void 0;try{t.onInactivityWarning?.(performance.now()-a)}catch{console.error("Could not display subprocess inactivity warning; the child result is unaffected.")}},t.inactivityWarningAfterMs??JF)};if(u(),t.timeout)o=setTimeout(()=>{s=!0,c(),n.kill()},t.timeout);let d=ic()?[...QF(r),...t.redact??[]]:[];if(ic()){let y=t.cwd?` (cwd=${t.cwd})`:"";qs(Nt.dim(Vl(`$ ${e.join(" ")}${y}`,d)))}let l=()=>{a=performance.now(),u()},p,f,h,m=n.exited.then((y)=>(c(),y));try{[p,f,h]=await Promise.all([hb(n.stdout,l),hb(n.stderr,l),m])}finally{if(c(),o)clearTimeout(o)}if(ic()){if(t.sensitiveOutput)qs(Nt.dim("[sensitive subprocess output suppressed]"));else{if(p.trim())qs(Nt.dim(Vl(p.trimEnd(),d)));if(f.trim())qs(Nt.yellow(Vl(f.trimEnd(),d)))}qs(Nt.dim(`(exit ${h})`))}if(s)return{stdout:p,stderr:f||`Command timed out after ${Math.round(t.timeout/1000)}s`,exitCode:h??1,timedOut:!0};return{stdout:p,stderr:f,exitCode:h,timedOut:!1}}var YF,XF=8,JF=120000;var gb=F(()=>{Ul();YF=/\(\s*"((?:x-amz-)[^"]*|authorization|proxy-authorization)"\s*,\s*"[^"]*"\s*\)/gi});function eV(){if(process.platform==="darwin")return"macos";if(process.platform==="win32")return"windows";return"linux"}function _b(e,t=eV()){return e.installInstructions[t]}function tV(e){let t=e.match(/(\d+\.\d+(?:\.\d+)?)/);return t?t[1]:void 0}function nV(){let e=Number(process.env.TEST_PROBE_TIMEOUT_MS);return Number.isFinite(e)&&e>0?e:rV}async function vb(e){try{let{exitCode:t,stdout:r,timedOut:n}=await mb(e.cmd,{timeout:nV()});if(n)return{available:!1,timedOut:!0};if(t!==0)return{available:!1};return{available:!0,version:tV(r)}}catch(t){let r=t instanceof Error?t.message:String(t);if(!r.includes("ENOENT")&&!r.includes("not found"))console.error(` Warning: ${e.name} check failed unexpectedly: ${r}`);return{available:!1}}}async function zl(){let e=Object.entries(yb);return Promise.all(e.map(async([t,r])=>{let{available:n,version:s,timedOut:o}=await vb(r);return{key:t,name:r.name,purpose:r.purpose,required:r.required,available:n,version:s,timedOut:o,installInstruction:_b(r)}}))}async function Z3(){let t=(await zl()).filter((r)=>r.required&&!r.available);if(t.length===0)return[];console.warn(`
|
|
24
24
|
Heads up: some tools NEMAR needs for uploading/validating aren't installed yet:`);for(let r of t)console.warn(` - ${r.name} (${r.purpose})`),console.warn(` Install: ${r.installInstruction}`);return console.warn("Run `nemar doctor` anytime to re-check. You can finish signup without them.\n"),t}async function eB(e){let r=ZF[e].map((i)=>yb[i]).filter(Boolean),n=await Promise.all(r.map(async(i)=>{let a=await vb(i);return{check:i,available:a.available,timedOut:a.timedOut}}));for(let i of n)if(i.timedOut&&i.check.required)console.warn(`Warning: ${i.check.name} did not respond to a version check in time; continuing anyway.`);let s=n.filter((i)=>!i.available&&!i.timedOut&&i.check.required).map((i)=>({tool:i.check.name,installInstruction:_b(i.check)}));if(s.length===0)return;let o=[`
|
|
25
25
|
Missing required tools:`];for(let i of s)o.push(` ${i.tool} not installed`),o.push(` Install: ${i.installInstruction}`);throw Error(o.join(`
|
|
26
|
-
`))}var yb,ZF,rV=4000;var $b=F(()=>{gb();yb={git:{name:"git",purpose:"version control for dataset metadata",cmd:["git","--version"],required:!0,installInstructions:{macos:"brew install git (or install Xcode Command Line Tools)",linux:"sudo apt-get install git OR sudo dnf install git",windows:"winget install Git.Git (or https://git-scm.com/download/win)"}},"git-annex":{name:"git-annex",purpose:"large-file data transfer (upload/download)",cmd:["git-annex","version"],required:!0,installInstructions:{macos:"brew install git-annex",linux:"sudo apt-get install git-annex OR sudo dnf install git-annex",windows:"Download the installer from https://git-annex.branchable.com/install/Windows/"}},gh:{name:"GitHub CLI (gh)",purpose:"GitHub authentication + repository operations",cmd:["gh","--version"],required:!0,installInstructions:{macos:"brew install gh",linux:"See https://cli.github.com/manual/installation",windows:"winget install GitHub.cli (or: scoop install gh)"}},aws:{name:"AWS CLI",purpose:"S3 data upload/download",cmd:["aws","--version"],required:!0,installInstructions:{macos:"brew install awscli",linux:"pip install awscli OR sudo snap install aws-cli --classic",windows:"winget install Amazon.AWSCLI (or the MSI from https://aws.amazon.com/cli/)"}},deno:{name:"Deno",purpose:"BIDS validation",cmd:["deno","--version"],required:!0,installInstructions:{macos:"brew install deno (or: curl -fsSL https://deno.land/install.sh | sh)",linux:"curl -fsSL https://deno.land/install.sh | sh",windows:"winget install DenoLand.Deno (or: irm https://deno.land/install.ps1 | iex)"}}},ZF={upload:["git-annex","gh","aws","deno"],download:["gh"],clone:["git","gh"],push:["git-annex","gh"],publish:["gh","aws"],update:["git","gh"],release:["git","gh"]}});var wb;var Eb=F(()=>{wb={name:"nemar-cli",packageManager:"bun@1.4.3",version:"0.10.
|
|
26
|
+
`))}var yb,ZF,rV=4000;var $b=F(()=>{gb();yb={git:{name:"git",purpose:"version control for dataset metadata",cmd:["git","--version"],required:!0,installInstructions:{macos:"brew install git (or install Xcode Command Line Tools)",linux:"sudo apt-get install git OR sudo dnf install git",windows:"winget install Git.Git (or https://git-scm.com/download/win)"}},"git-annex":{name:"git-annex",purpose:"large-file data transfer (upload/download)",cmd:["git-annex","version"],required:!0,installInstructions:{macos:"brew install git-annex",linux:"sudo apt-get install git-annex OR sudo dnf install git-annex",windows:"Download the installer from https://git-annex.branchable.com/install/Windows/"}},gh:{name:"GitHub CLI (gh)",purpose:"GitHub authentication + repository operations",cmd:["gh","--version"],required:!0,installInstructions:{macos:"brew install gh",linux:"See https://cli.github.com/manual/installation",windows:"winget install GitHub.cli (or: scoop install gh)"}},aws:{name:"AWS CLI",purpose:"S3 data upload/download",cmd:["aws","--version"],required:!0,installInstructions:{macos:"brew install awscli",linux:"pip install awscli OR sudo snap install aws-cli --classic",windows:"winget install Amazon.AWSCLI (or the MSI from https://aws.amazon.com/cli/)"}},deno:{name:"Deno",purpose:"BIDS validation",cmd:["deno","--version"],required:!0,installInstructions:{macos:"brew install deno (or: curl -fsSL https://deno.land/install.sh | sh)",linux:"curl -fsSL https://deno.land/install.sh | sh",windows:"winget install DenoLand.Deno (or: irm https://deno.land/install.ps1 | iex)"}}},ZF={upload:["git-annex","gh","aws","deno"],download:["gh"],clone:["git","gh"],push:["git-annex","gh"],publish:["gh","aws"],update:["git","gh"],release:["git","gh"]}});var wb;var Eb=F(()=>{wb={name:"nemar-cli",packageManager:"bun@1.4.3",version:"0.10.29-PR2104.e70fa53",description:"CLI for NEMAR (Neuroelectromagnetic Data Archive and Tools Resource) dataset management",type:"module",main:"dist/index.js",bin:{nemar:"dist/index.js","git-annex-remote-nemar":"dist/git-annex-remote-nemar.js"},scripts:{dev:"bun run src/index.ts",build:"bun build src/index.ts src/git-annex-remote-nemar.ts --outdir dist --target bun --minify && sed '1s|#!/usr/bin/env node|#!/usr/bin/env bun|' dist/index.js > dist/index.js.tmp && mv dist/index.js.tmp dist/index.js",test:"bun test",lint:"biome check src/","lint:scrub":"biome check scripts/scrub shared/identifier-scrub.ts test/scrub","test:scrub":"bun test --preload ./test/scrub/helpers/temp-dirs-preload.ts --path-ignore-patterns='__run_every_scrub_suite__' test/scrub test/identifier-scan.test.ts test/identifier-scrub.test.ts test/identifier-dates.test.ts test/identifier-fleet.test.ts","migrations:d1-check":"bun run scripts/d1-migration-check.ts","zarr:geometry-check":"bun run backend/scripts/zarr-geometry-conformance.ts","lint:fix":"biome check --fix src/",format:"biome format --write src/",typecheck:"tsc --noEmit && tsc --noEmit -p backend","generate-openapi":"bun run scripts/generate-openapi.ts",prepublishOnly:"bun run build",prepare:"husky",postinstall:"bun scripts/postinstall-check.mjs",deploy:"wrangler deploy",preview:"wrangler dev"},keywords:["nemar","bids","neuroimaging","eeg","emg","datalad","cli"],author:"NEMAR Team",license:"CC-BY-NC-ND-4.0",repository:{type:"git",url:"git+https://github.com/nemarOrg/nemar-cli.git"},bugs:{url:"https://github.com/nemarOrg/nemar-cli/issues"},homepage:"https://docs.nemar.org",engines:{bun:">=1.0.0"},files:["dist","scripts/postinstall-check.mjs","scripts/recover-datasets.json","scripts/withdrawn-datasets.json","README.md","LICENSE"],dependencies:{chalk:"^5.3.0",commander:"^12.1.0",conf:"^13.0.1",inquirer:"^9.2.15",ora:"^8.0.1",semver:"^7.8.5",zod:"^3.23.8"},"lint-staged":{"src/**/*.{ts,tsx}":["biome check --fix"],"backend/src/**/*.{ts,tsx}":["biome check --fix"]},trustedDependencies:["@biomejs/biome"],devDependencies:{"@anthropic-ai/sdk":"^0.132.1","@asteasolutions/zod-to-openapi":"^7.3.4","@biomejs/biome":"1.9.4","@types/bun":"latest","@types/inquirer":"^9.0.7","@types/semver":"^7.8.0",ajv:"^8.20.0","ajv-formats":"^3.0.1",husky:"^9.1.7","lint-staged":"^16.3.2",typescript:"^5.5.4",wrangler:"^4.70.0",yaml:"^2.8.4"}}});var ac;var Gl=F(()=>{Eb();ac=wb.version});import{mkdirSync as oV,readdirSync as iV,unlinkSync as aV,writeFileSync as cV}from"fs";import{join as Kl}from"path";function dB(){Ds=!0}function lc(){return Ds}function fB(e,t=process.env){return e.includes("--debug")||t.NEMAR_DEBUG==="1"}function pB(e){Tb=e,pr(`Step: ${e}`)}function hB(){xb=!0}function mB(){return xb}function gB(){if(Rb)return;Bl=!0}function yB(){Bl=!1,Rb=!0}function _B(){return Bl}function pr(e){if(Ds)process.stderr.write(`[debug] ${e}
|
|
27
27
|
`)}function fV(e){let t={};for(let[r,n]of Object.entries(e))t[r]=dV.has(r.toLowerCase())?"[REDACTED]":n;return t}function Ob(e){let t=e.indexOf("@");if(t<=0)return"***";return`${e[0]}***${e.slice(t)}`}function Hl(e,t,r=0){if(r>hV)return"[REDACTED: depth]";if(Array.isArray(t))return t.map((n)=>Hl(e,n,r+1));if(t&&typeof t==="object"){let n={};for(let[s,o]of Object.entries(t))n[s]=Hl(s,o,r+1);return n}if(typeof t==="string"){if(pV.test(e))return"[REDACTED]";return t.replace(kb,Ob)}return t}function Wl(e){return e.replace(mV,"Bearer [REDACTED]").replace(gV,"[REDACTED_AWS_KEY]").replace(yV,"$1[REDACTED]").replace(_V,"$1$2=[REDACTED]").replace(kb,Ob)}function vV(e){return Wl(e)}function bb(e,t=lV){if(e===void 0)return;let r=e;try{let n=JSON.parse(e);r=JSON.stringify(Hl("",n))}catch{}if(r=Wl(r),Buffer.byteLength(r,"utf8")>t)r=`${Buffer.from(r,"utf8").subarray(0,t).toString("utf8")}... [truncated]`;return r}function dc(e){if(!Ds)return;let t=vV(e.url);try{let r={...e,url:t,requestHeaders:e.requestHeaders?fV(e.requestHeaders):void 0,requestBody:bb(e.requestBody),responseBody:bb(e.responseBody)};uc.push(r),pr(`${e.method} ${t} -> ${e.status??"ERROR"} (${e.durationMs}ms)`)}catch(r){let n=dr(r);uc.push({method:e.method,url:t,status:e.status,durationMs:e.durationMs,note:`redaction failed: ${n}`}),pr(`redaction failed for ${e.method} ${t}: ${n}`)}}async function $V(){let e=[];try{let t=process.versions.bun?`Bun ${process.versions.bun}`:`Node ${process.version}`;e.push(`CLI version: ${ac}`),e.push(`OS/Arch: ${process.platform}/${process.arch}`),e.push(`Runtime: ${t}`)}catch(t){e.push(`(could not read CLI/OS/runtime info: ${dr(t)})`)}e.push(""),e.push("Active account:");try{let t=hn();if(t.apiKey){if(t.username)e.push(` Username: ${t.username}`);if(e.push(` API URL: ${t.apiUrl}`),t.role)e.push(` Role: ${t.role}`);e.push(` Sandbox completed: ${!!t.sandboxCompleted}`)}else e.push(" (not authenticated)")}catch(t){e.push(` (could not read account config: ${dr(t)})`)}e.push(""),e.push("External tools:");try{let t=await zl();for(let r of t){let n=r.available?r.version??"installed":r.timedOut?"(timed out)":"not installed";e.push(` ${r.name}: ${n}`)}}catch(t){e.push(` (could not probe external tools: ${dr(t)})`)}return e}async function EV(){return(await $V()).join(`
|
|
28
28
|
`)}async function vB(){if(!Ds||cc!==void 0)return;try{cc=await EV()}catch(e){let t=dr(e);cc=`(could not build environment report: ${t})`,pr(`environment snapshot failed: ${t}`)}}function Ab(e){if(Sb.has(e))return{flag:e};for(let t of Sb){if(!e.startsWith(t)||e.length<=t.length)continue;if(t.length===2)return{flag:t,kind:"short-attached"};if(e[t.length]==="=")return{flag:t,kind:"long-eq"}}return null}function wV(e){let t=[];for(let r=0;r<e.length;r++){let n=e[r],s=Ab(n);if(!s){t.push(n);continue}if(s.kind==="long-eq")t.push(`${s.flag}=[REDACTED]`);else if(s.kind==="short-attached")t.push(`${s.flag}[REDACTED]`);else if(t.push(n),r+1<e.length)t.push("[REDACTED]"),r++}return t}function bV(e){let t=[];for(let r=0;r<e.length;r++){let n=e[r],s=Ab(n);if(!s){t.push(n);continue}if(!s.kind&&r+1<e.length)r++}return t}function SV(e){let t=[];for(let n of bV(e)){if(n.startsWith("-"))continue;if(t.push(n),t.length===2)break}return(t.length>0?t.join("-"):"nemar").replace(/[^a-zA-Z0-9_-]/g,"_")}function xV(e,t){let r=[];if(r.push("NEMAR CLI Debug Log"),r.push(`Generated: ${new Date().toISOString()}`),r.push(`Command: nemar ${Wl(wV(e).join(" "))}`),r.push(""),r.push(cc??"(environment snapshot unavailable)"),r.push(""),r.push("HTTP requests:"),uc.length===0)r.push(" (none)");else uc.forEach((n,s)=>{if(r.push(` [${s+1}] ${n.method} ${n.url} -> ${n.status??"ERROR"} (${n.durationMs}ms)`),n.error)r.push(` Error: ${n.error}`);if(n.note)r.push(` Note: ${n.note}`);if(n.requestHeaders)r.push(` Request headers: ${JSON.stringify(n.requestHeaders)}`);if(n.requestBody)r.push(` Request body: ${n.requestBody}`);if(n.responseBody)r.push(` Response body: ${n.responseBody}`)});return r.push(""),r.push(`Failing step: ${Tb??"(none recorded)"}`),r.push(`Exit code: ${t}`),`${r.join(`
|
|
29
29
|
`)}
|
|
30
|
-
`}function RV(e,t){let r;try{r=iV(e).filter((s)=>s.startsWith("nemar-")&&s.endsWith(".log"))}catch(s){if(s.code!=="ENOENT")pr(`could not list ${e} for log rotation: ${dr(s)}`);return}r.sort();let n=r.length-t;for(let s=0;s<n;s++)try{aV(Kl(e,r[s]))}catch(o){if(o.code!=="ENOENT")pr(`could not remove old log ${r[s]}: ${dr(o)}`)}}function $B(){return zo}function EB(e,t){if(!Ds)return null;let r=Kl(Xl(),"logs");try{oV(r,{recursive:!0})}catch(i){return zo=dr(i),pr(`could not create log directory ${r}: ${zo}`),null}let s=`nemar-${new Date().toISOString().replace(/[:.]/g,"-")}-${SV(e)}.log`,o=Kl(r,s);try{cV(o,xV(e,t),"utf8")}catch(i){return zo=dr(i),pr(`could not write log file ${o}: ${zo}`),null}return RV(r,uV),o}var uV=10,lV=2048,Ds=!1,xb=!1,Bl=!1,Rb=!1,Tb,cc,uc,dV,pV,kb,hV=32,mV,gV,yV,_V,Sb,zo;var Yl=F(()=>{Cl();fc();$b();Gl();uc=[];dV=new Set(["authorization","cookie","set-cookie","x-api-key","x-approval-dispatch-token"]);pV=/^(api[_-]?key|apikey|password|token|secret|access[_-]?key(_id)?|secret[_-]?access[_-]?key|session|session[_-]?token|authorization|ssh[_-]?key|private[_-]?key|device[_-]?code|dispatch[_-]?token
|
|
30
|
+
`}function RV(e,t){let r;try{r=iV(e).filter((s)=>s.startsWith("nemar-")&&s.endsWith(".log"))}catch(s){if(s.code!=="ENOENT")pr(`could not list ${e} for log rotation: ${dr(s)}`);return}r.sort();let n=r.length-t;for(let s=0;s<n;s++)try{aV(Kl(e,r[s]))}catch(o){if(o.code!=="ENOENT")pr(`could not remove old log ${r[s]}: ${dr(o)}`)}}function $B(){return zo}function EB(e,t){if(!Ds)return null;let r=Kl(Xl(),"logs");try{oV(r,{recursive:!0})}catch(i){return zo=dr(i),pr(`could not create log directory ${r}: ${zo}`),null}let s=`nemar-${new Date().toISOString().replace(/[:.]/g,"-")}-${SV(e)}.log`,o=Kl(r,s);try{cV(o,xV(e,t),"utf8")}catch(i){return zo=dr(i),pr(`could not write log file ${o}: ${zo}`),null}return RV(r,uV),o}var uV=10,lV=2048,Ds=!1,xb=!1,Bl=!1,Rb=!1,Tb,cc,uc,dV,pV,kb,hV=32,mV,gV,yV,_V,Sb,zo;var Yl=F(()=>{Cl();fc();$b();Gl();uc=[];dV=new Set(["authorization","cookie","set-cookie","x-api-key","x-approval-dispatch-token"]);pV=/^(api[_-]?key|apikey|password|token|secret|access[_-]?key(_id)?|secret[_-]?access[_-]?key|session|session[_-]?token|authorization|ssh[_-]?key|private[_-]?key|device[_-]?code|dispatch[_-]?token)$/i,kb=/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g;mV=/Bearer\s+[A-Za-z0-9\-._~+/=]+/gi,gV=/\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g,yV=/((?:aws_)?secret_access_key["']?\s*[:=]\s*["']?)[A-Za-z0-9/+=]{20,}/gi,_V=/([?&])(X-Amz-Signature|X-Amz-Security-Token|X-Amz-Credential|Signature|AWSAccessKeyId)=[^&\s"']+/gi;Sb=new Set(["-k","--key","--password","--api-key"])});import{chmodSync as TV,copyFileSync as kV,existsSync as Jl,mkdirSync as OV,statSync as AV}from"fs";import{homedir as pc}from"os";import{join as Ms}from"path";function NV(e){let t=e.trim().replace(/\/+$/,"");try{let r=new URL(t);return r.protocol=r.protocol.toLowerCase(),r.host=r.host.toLowerCase(),r.toString().replace(/\/+$/,"")}catch{return console.error(`[nemar] could not parse stored apiUrl ${JSON.stringify(e)}; leaving as-is`),t}}function Xl(){return process.env.NEMAR_CONFIG_DIR||Ms(pc(),".config","nemar")}function CV(e){if(process.env.NEMAR_CONFIG_DIR)return;let t=Ms(e,"config.json");if(Jl(t))return;let r=[];if(process.platform==="darwin")r.push(Ms(pc(),"Library","Preferences","nemar-nodejs","config.json"));if(process.platform==="win32"){let n=process.env.APPDATA||Ms(pc(),"AppData","Roaming");r.push(Ms(n,"nemar-nodejs","config.json"))}r.push(Ms(pc(),".config","nemar-nodejs","config.json"));for(let n of r)if(Jl(n))try{OV(e,{recursive:!0}),kV(n,t),console.error(`[nemar] Config migrated from ${n} to ${t}
|
|
31
31
|
[nemar] You can safely remove the old file.`);return}catch(s){console.error(`[nemar] Failed to migrate config from ${n}:`,s,`
|
|
32
|
-
[nemar] You can manually copy ${n} to ${t}`)}}function St(){let e=Xl();if(Go&&Pb===e)return Go;if(CV(e),Go=new Ka({projectName:"nemar",configFileMode:Ql,schema:{activeAccount:{type:"string"},accounts:{type:"object"},apiKey:{type:"string"},apiUrl:{type:"string"},username:{type:"string"},email:{type:"string"},githubUsername:{type:"string"},sandboxCompleted:{type:"boolean"},sandboxDatasetId:{type:"string"}},cwd:e}),Pb=e,!Nb.has(e))Nb.add(e),jV(Go.path),DV(),MV();return Go}function jV(e){if(process.platform==="win32")return;if(!Jl(e))return;try{if((AV(e).mode&511)!==Ql)TV(e,Ql)}catch(t){console.error(`[nemar] could not secure config file permissions for ${e}:`,t)}}function DV(){let e=St(),t=e.get("accounts");if(t&&Object.keys(t).length>0)return;let r=e.get("apiKey"),n=e.get("username");if(!r&&!n)return;try{let s=n||"default",o={};for(let i of qV){let a=e.get(i);if(a!==void 0)o[i]=a}e.store={activeAccount:s,accounts:{[s]:o}}}catch(s){console.error("Config migration failed (legacy config preserved):",s)}}function MV(){let e=St(),t=e.store,r=t.accounts,n=!1;if(r)for(let[o,i]of Object.entries(r)){let a=i?.apiUrl;if(!a)continue;if(PV.has(NV(a)))r[o]={...i,apiUrl:Ls},console.error(`[nemar] migrated stored apiUrl for account "${o}": ${a} -> ${Ls}`),n=!0}let s=t.apiUrl;if(r&&Object.keys(r).length>0&&s!==void 0){let{apiUrl:o,...i}=t;try{e.store=i,console.error(`[nemar] removed stale top-level apiUrl from config (was: ${s})`),n=!1}catch(a){console.error("API URL cleanup failed (config file unchanged):",a)}}if(n)try{e.store={...e.store,accounts:r}}catch(o){console.error("API URL migration failed (config file unchanged):",o)}}function Ko(){return St().get("activeAccount")}function mn(){return St().get("accounts")||{}}function hn(){let e={apiUrl:Ls},t=Ko();if(!t)return e;return mn()[t]||e}function PB(e,t){let r=St(),n=r.get("activeAccount")||"default",s=r.get("accounts")||{};if(!s[n])s[n]={apiUrl:Ls};s[n][e]=t,r.store={...r.store,accounts:s,activeAccount:n}}function NB(e){let t=Ko();if(!t)return;let r=mn();if(r[t])delete r[t][e],St().set("accounts",r)}function IB(){let e=St(),t=Ko();if(!t){e.clear();return}let r=mn();delete r[t];let n=Object.keys(r);if(n.length>0)e.store={...e.store,accounts:r,activeAccount:n[0]};else e.clear()}function CB(){St().clear()}function jB(){return!!hn().apiKey}function qB(){return St().path}function DB(){let e=mn(),t=Ko();return Object.entries(e).map(([r,n])=>({key:r,username:n.username,email:n.email,githubUsername:n.githubUsername,active:r===t,keySource:n.keySource}))}function MB(e){return e.username?.trim()||e.email}function LV(e){let t=e.trim().toLowerCase();if(!t)return;let r=Object.entries(mn()).filter(([,n])=>n.email&&n.email.toLowerCase()===t).map(([n])=>n);if(r.length>1){pr(`findAccountKeyByEmail: ${r.length} accounts share email ${t}: ${r.join(", ")}`);return}return r[0]}function LB(e,t){let r=St(),n=mn(),s;if(n[e])s=e;else if(t.email)s=LV(t.email);let o=s?n[s]:void 0,i={...o??{apiUrl:Ls},...t};if(s&&s!==e)delete n[s];return n[e]=i,r.store={...r.store,accounts:n,activeAccount:e},{key:e,previous:o}}function UB(e){let t=e.trim();if(!t)return"unchanged";let r=St(),n=Ko();if(!n||n===t)return"unchanged";let s=mn(),o=s[n];if(!o)return"unchanged";if(s[t])return"key_taken";return delete s[n],s[t]={...o,username:t},r.store={...r.store,accounts:s,activeAccount:t},"renamed"}function FB(e){let t=St(),r=mn();if(r[e])return t.store={...t.store,activeAccount:e},r[e];for(let[n,s]of Object.entries(r))if(s.githubUsername===e)return t.store={...t.store,activeAccount:n},s;return null}var Ls="https://nemar-api-dev.sccn-org.workers.dev",Ql=384,PV,IV,AB,Go=null,Pb=null,Nb,qV;var fc=F(()=>{Fw();jn();nc();Yl();PV=new Set(["https://api.osc.earth/nemar","https://nemar-api.neuromechanist.workers.dev","https://nemar-api-dev.shirazi-10f.workers.dev"]);IV=ne({field:v(),blocks:Ze(v()).optional(),set_on:Ze(v()).optional()}).passthrough(),AB=ne({apiKey:v().optional(),apiUrl:v().url().default(Ls),username:v().optional(),email:v().email().optional(),githubUsername:v().optional(),sandboxCompleted:Ue().optional(),sandboxDatasetId:v().optional(),dismissedNoticeIds:Ze(fe()).optional(),serviceAccess:Ue().optional(),profileGaps:Ze(IV).optional(),orcidVerified:Ue().optional(),role:v().optional(),accountKind:qn.optional(),pendingEmailChange:v().email().optional()});Nb=new Set;qV=["apiKey","apiUrl","username","email","githubUsername","sandboxCompleted","sandboxDatasetId","dismissedNoticeIds"]});var UV,FV,KB,VV,HB,zV,Ib,BB,WB=8,YB=100,Cb,XB,GV,JB;var jb=F(()=>{jn();nc();UV=["given_name","family_name","affiliation","city","country"],FV=["username","github_username","email","orcid"],KB=[...UV,...FV],VV={given_name:v().max(200).optional(),family_name:v().max(200).optional(),affiliation:v().max(500).optional(),city:v().max(200).optional(),country:v().max(200).optional(),username:v().max(100).optional(),github_username:v().max(100).optional(),email:v().max(320).optional(),orcid:v().max(40).optional()},HB=ne(VV),zV=Ve(["field_not_editable","owner_only_field","edit_own_account","owner_account","system_account","invalid_edit","orcid_already_proven","invalid_search","invalid_user_id"]),Ib=zV.options,BB=["exact","name","prefix","substring","fuzzy"],Cb=ne({id:fe().int(),username:v().nullable(),email:v(),github_username:v().nullable(),status:v(),role:v().nullable(),account_kind:qn.optional(),email_verified:fe().int().nullable().optional(),orcid:v().nullable().optional(),orcid_verified:fe().int().nullable().optional(),given_name:v().nullable().optional(),family_name:v().nullable().optional(),affiliation:v().nullable().optional(),city:v().nullable().optional(),country:v().nullable().optional(),description:v().nullable().optional(),signup_source:v().nullable().optional(),created_at:v(),updated_at:v().nullable().optional(),approved_at:v().nullable().optional(),revoked_at:v().nullable().optional(),deleted_at:v().nullable().optional(),service_access:fe().int().nullable().optional(),service_access_granted_at:v().nullable().optional(),service_access_granted_by:fe().int().nullable().optional(),upload_access_requested_at:v().nullable().optional(),upload_access_notified_at:v().nullable().optional(),identity_conflict:fe().int().nullable().optional(),username_auto_assigned:fe().int().nullable().optional(),sandbox_completed:fe().int().nullable().optional(),sandbox_completed_at:v().nullable().optional(),sandbox_dataset_id:v().nullable().optional(),aws_iam_username:v().nullable().optional(),dataset_count:fe().int().optional(),active_tokens:fe().int().optional(),linked_identities:Ze(v()).optional()}).passthrough(),XB=ne({user:Cb}).passthrough(),GV=ne({from:v().nullable(),to:v().nullable()}),JB=ne({message:v(),changed:wF(v(),GV),notes:Ze(v()).optional(),old_address_notified:Ue().optional(),user:Cb}).passthrough()});var e6=120,t6=64,r6="unnamed machine",KV=25,qb,n6,Us,Db,s6,o6,i6,HV,BV,a6,Zl,c6,u6,l6,d6,f6;var Mb=F(()=>{jn();qb=Ve(["authorization_pending","slow_down","expired_token","access_denied","invalid_grant"]),n6={authorization_pending:"Waiting for you to authorize this machine in the browser.",slow_down:"Polling too quickly; the CLI will slow down automatically.",expired_token:"The code expired. Run `nemar auth login` again for a new one.",access_denied:"This sign-in was declined in the browser. Run `nemar auth login` again if that was a mistake.",invalid_grant:"That code is no longer valid. Run `nemar auth login` again for a new one."},Us=Ve(["device_code_unknown","device_code_expired","device_code_used","device_code_denied","account_pending","account_revoked","identity_conflict","service_account","person_account","too_many_keys","key_not_found"]),Db=Us.options,s6={device_code_unknown:"That code was not found. Check the code shown in your terminal, or run `nemar auth login` again for a new one.",device_code_expired:"The code expired. Run `nemar auth login` again for a new one.",device_code_used:"That code has already been used. Run `nemar auth login` again for a new one.",device_code_denied:"This sign-in was declined in the browser. Run `nemar auth login` again if that was a mistake.",account_pending:"Verify your email address first. Check your inbox for the NEMAR verification code, then authorize again.",account_revoked:"Your NEMAR account access has been revoked. Contact the NEMAR team if you think this is a mistake.",identity_conflict:"This account shares an identifier with another NEMAR account and cannot sign in until that is resolved. Fix it in Settings on nemar.org or contact the NEMAR team.",service_account:"This is a service or test account, and it cannot sign in this way. Ask an owner to create a key for it with `nemar admin keys create`.",person_account:"This account belongs to a person. A person creates their own keys with `nemar auth login` or in Settings on nemar.org.",too_many_keys:`This account already has ${KV} active keys. Revoke one in Settings on nemar.org or with \`nemar auth keys\`, then try again.`,key_not_found:"That key was not found on this account, or it is already revoked. Run `nemar auth keys` to see the active ones."},o6=ne({error:Us,message:v()}).passthrough(),i6=ne({device_code:v(),user_code:v(),verification_uri:v(),verification_uri_complete:v(),expires_in:fe().int(),interval:fe().int()}).passthrough(),HV=Yw("error",[ne({error:In("authorization_pending"),message:v()}).passthrough(),ne({error:In("slow_down"),message:v()}).passthrough()]),BV=Yw("error",[ne({error:In("expired_token"),reason:Us,message:v()}).passthrough(),ne({error:In("access_denied"),reason:Us,message:v()}).passthrough(),ne({error:In("invalid_grant"),reason:Us,message:v()}).passthrough()]),a6=EF([HV,BV]),Zl=ne({id:fe().int(),name:v().nullable(),prefix:v(),created_at:v(),last_used_at:v().nullable(),current:Ue()}).passthrough(),c6=ne({api_key:v(),key:Zl,user:ne({username:v().nullable(),email:v(),github_username:v().nullable(),role:v(),sandbox_completed:Ue(),sandbox_dataset_id:v().nullable()}).passthrough()}).passthrough(),u6=ne({user_code:v(),machine_name:v(),requested_at:v(),expires_in:fe().int(),account:ne({username:v().nullable(),email_masked:v()}).passthrough(),refusal:ne({code:Us,message:v()}).passthrough().nullable()}).passthrough(),l6=ne({ok:In(!0),machine_name:v()}).passthrough(),d6=ne({keys:Ze(Zl)}).passthrough(),f6=ne({api_key:v(),key:Zl}).passthrough()});var WV,Lb,Ho="https://nemar.org/settings",m6,YV,XV,JV,g6,y6;var Ub=F(()=>{jn();WV=Ve(["orcid_in_use","orcid_already_linked","orcid_linked_other","email_in_use","github_in_use","identity_conflict_remains"]),Lb=WV.options,m6={orcid_in_use:`That ORCID iD already belongs to a NEMAR account. Sign in to that account instead; if you want the iD on a different account, unlink it there first (Settings, ${Ho}).`,orcid_already_linked:`That ORCID iD already belongs to a NEMAR account. Sign in to that account instead; if you want the iD on a different account, unlink it there first (Settings, ${Ho}).`,orcid_linked_other:`That ORCID iD is linked to a different NEMAR account. Unlink it there first (Settings, ${Ho}), then link it here.`,email_in_use:`That email address already belongs to a NEMAR account. Sign in to that account instead, or change its address first (Settings, ${Ho}).`,github_in_use:`That GitHub account is already linked to a NEMAR account. Sign in to that account instead, or change its GitHub username first (Settings, ${Ho}).`,identity_conflict_remains:"The collision that flagged this account is still there. Resolve it on the other account first (change its email or GitHub username, or unlink its ORCID iD), or delete that account, then clear the flag."},YV=Ve(["orcid","email","github"]),XV=ne({id:fe().int(),username:v().nullable(),email:v(),created_at:v(),has_oauth_identity:Ue(),dataset_count:fe().int(),identity_conflict:fe().int(),canonical:Ue()}).passthrough(),JV=ne({kind:YV,value:v(),canonical_user_id:fe().int(),accounts:Ze(XV)}).passthrough(),g6=ne({groups:Ze(JV),group_count:fe().int(),flagged_count:fe().int()}).passthrough(),y6=ne({ok:In(!0),id:fe().int(),cleared:Ue()}).passthrough()});function b6(e){return typeof e==="string"&&ZV.includes(e)}var QV,$6,E6,w6,ZV,e9="ci_check_unavailable",Fb,Vb,zb,S6="X-Approval-Dispatch-Token",x6;var Gb=F(()=>{jn();QV=/^\d{4}-\d{4}-\d{4}-\d{3}[\dX]$/,$6=v().regex(QV,"ORCID must be in format 0000-0000-0000-000X"),E6=Ve(["found","no_public_name","lookup_failed"]),w6=Ve(["bids_validation_failed","bids_validation_pending","bids_validation_in_progress","prescreen_failed","min_requirements_failed","owner_name_missing","identifier_screen_findings"]),ZV=["bids_validation_pending","bids_validation_in_progress"];Fb=[e9],Vb=["identifier_screen_pending","identifier_screen_not_clear","identifier_screen_not_applicable"],zb=["publication_review_not_clear","request_blocked","request_changed","request_mismatch","dispatch_superseded","dispatch_expired","decision_with_dispatch_token","approval_in_flight","deny_after_publishing","invalid_dataset_id","approval_closed_during_run"],x6=Ve(["filled","would_fill","no_public_name","lookup_failed","write_failed"])});function Hb(e){if(Kb)return;Kb=!0;let t=Nt.yellow("\u2500".repeat(60)),r=Nt.yellow.bold("[MAINTENANCE]"),n=Nt.dim(`mode: ${e.mode}`),s=e.eta?`
|
|
32
|
+
[nemar] You can manually copy ${n} to ${t}`)}}function St(){let e=Xl();if(Go&&Pb===e)return Go;if(CV(e),Go=new Ka({projectName:"nemar",configFileMode:Ql,schema:{activeAccount:{type:"string"},accounts:{type:"object"},apiKey:{type:"string"},apiUrl:{type:"string"},username:{type:"string"},email:{type:"string"},githubUsername:{type:"string"},sandboxCompleted:{type:"boolean"},sandboxDatasetId:{type:"string"}},cwd:e}),Pb=e,!Nb.has(e))Nb.add(e),jV(Go.path),DV(),MV();return Go}function jV(e){if(process.platform==="win32")return;if(!Jl(e))return;try{if((AV(e).mode&511)!==Ql)TV(e,Ql)}catch(t){console.error(`[nemar] could not secure config file permissions for ${e}:`,t)}}function DV(){let e=St(),t=e.get("accounts");if(t&&Object.keys(t).length>0)return;let r=e.get("apiKey"),n=e.get("username");if(!r&&!n)return;try{let s=n||"default",o={};for(let i of qV){let a=e.get(i);if(a!==void 0)o[i]=a}e.store={activeAccount:s,accounts:{[s]:o}}}catch(s){console.error("Config migration failed (legacy config preserved):",s)}}function MV(){let e=St(),t=e.store,r=t.accounts,n=!1;if(r)for(let[o,i]of Object.entries(r)){let a=i?.apiUrl;if(!a)continue;if(PV.has(NV(a)))r[o]={...i,apiUrl:Ls},console.error(`[nemar] migrated stored apiUrl for account "${o}": ${a} -> ${Ls}`),n=!0}let s=t.apiUrl;if(r&&Object.keys(r).length>0&&s!==void 0){let{apiUrl:o,...i}=t;try{e.store=i,console.error(`[nemar] removed stale top-level apiUrl from config (was: ${s})`),n=!1}catch(a){console.error("API URL cleanup failed (config file unchanged):",a)}}if(n)try{e.store={...e.store,accounts:r}}catch(o){console.error("API URL migration failed (config file unchanged):",o)}}function Ko(){return St().get("activeAccount")}function mn(){return St().get("accounts")||{}}function hn(){let e={apiUrl:Ls},t=Ko();if(!t)return e;return mn()[t]||e}function PB(e,t){let r=St(),n=r.get("activeAccount")||"default",s=r.get("accounts")||{};if(!s[n])s[n]={apiUrl:Ls};s[n][e]=t,r.store={...r.store,accounts:s,activeAccount:n}}function NB(e){let t=Ko();if(!t)return;let r=mn();if(r[t])delete r[t][e],St().set("accounts",r)}function IB(){let e=St(),t=Ko();if(!t){e.clear();return}let r=mn();delete r[t];let n=Object.keys(r);if(n.length>0)e.store={...e.store,accounts:r,activeAccount:n[0]};else e.clear()}function CB(){St().clear()}function jB(){return!!hn().apiKey}function qB(){return St().path}function DB(){let e=mn(),t=Ko();return Object.entries(e).map(([r,n])=>({key:r,username:n.username,email:n.email,githubUsername:n.githubUsername,active:r===t,keySource:n.keySource}))}function MB(e){return e.username?.trim()||e.email}function LV(e){let t=e.trim().toLowerCase();if(!t)return;let r=Object.entries(mn()).filter(([,n])=>n.email&&n.email.toLowerCase()===t).map(([n])=>n);if(r.length>1){pr(`findAccountKeyByEmail: ${r.length} accounts share email ${t}: ${r.join(", ")}`);return}return r[0]}function LB(e,t){let r=St(),n=mn(),s;if(n[e])s=e;else if(t.email)s=LV(t.email);let o=s?n[s]:void 0,i={...o??{apiUrl:Ls},...t};if(s&&s!==e)delete n[s];return n[e]=i,r.store={...r.store,accounts:n,activeAccount:e},{key:e,previous:o}}function UB(e){let t=e.trim();if(!t)return"unchanged";let r=St(),n=Ko();if(!n||n===t)return"unchanged";let s=mn(),o=s[n];if(!o)return"unchanged";if(s[t])return"key_taken";return delete s[n],s[t]={...o,username:t},r.store={...r.store,accounts:s,activeAccount:t},"renamed"}function FB(e){let t=St(),r=mn();if(r[e])return t.store={...t.store,activeAccount:e},r[e];for(let[n,s]of Object.entries(r))if(s.githubUsername===e)return t.store={...t.store,activeAccount:n},s;return null}var Ls="https://api.nemar.org",Ql=384,PV,IV,AB,Go=null,Pb=null,Nb,qV;var fc=F(()=>{Fw();jn();nc();Yl();PV=new Set(["https://api.osc.earth/nemar","https://nemar-api.neuromechanist.workers.dev","https://nemar-api-dev.shirazi-10f.workers.dev"]);IV=ne({field:v(),blocks:Ze(v()).optional(),set_on:Ze(v()).optional()}).passthrough(),AB=ne({apiKey:v().optional(),apiUrl:v().url().default(Ls),username:v().optional(),email:v().email().optional(),githubUsername:v().optional(),sandboxCompleted:Ue().optional(),sandboxDatasetId:v().optional(),dismissedNoticeIds:Ze(fe()).optional(),serviceAccess:Ue().optional(),profileGaps:Ze(IV).optional(),orcidVerified:Ue().optional(),role:v().optional(),accountKind:qn.optional(),pendingEmailChange:v().email().optional()});Nb=new Set;qV=["apiKey","apiUrl","username","email","githubUsername","sandboxCompleted","sandboxDatasetId","dismissedNoticeIds"]});var UV,FV,KB,VV,HB,zV,Ib,BB,WB=8,YB=100,Cb,XB,GV,JB;var jb=F(()=>{jn();nc();UV=["given_name","family_name","affiliation","city","country"],FV=["username","github_username","email","orcid"],KB=[...UV,...FV],VV={given_name:v().max(200).optional(),family_name:v().max(200).optional(),affiliation:v().max(500).optional(),city:v().max(200).optional(),country:v().max(200).optional(),username:v().max(100).optional(),github_username:v().max(100).optional(),email:v().max(320).optional(),orcid:v().max(40).optional()},HB=ne(VV),zV=Ve(["field_not_editable","owner_only_field","edit_own_account","owner_account","system_account","invalid_edit","orcid_already_proven","invalid_search","invalid_user_id"]),Ib=zV.options,BB=["exact","name","prefix","substring","fuzzy"],Cb=ne({id:fe().int(),username:v().nullable(),email:v(),github_username:v().nullable(),status:v(),role:v().nullable(),account_kind:qn.optional(),email_verified:fe().int().nullable().optional(),orcid:v().nullable().optional(),orcid_verified:fe().int().nullable().optional(),given_name:v().nullable().optional(),family_name:v().nullable().optional(),affiliation:v().nullable().optional(),city:v().nullable().optional(),country:v().nullable().optional(),description:v().nullable().optional(),signup_source:v().nullable().optional(),created_at:v(),updated_at:v().nullable().optional(),approved_at:v().nullable().optional(),revoked_at:v().nullable().optional(),deleted_at:v().nullable().optional(),service_access:fe().int().nullable().optional(),service_access_granted_at:v().nullable().optional(),service_access_granted_by:fe().int().nullable().optional(),upload_access_requested_at:v().nullable().optional(),upload_access_notified_at:v().nullable().optional(),identity_conflict:fe().int().nullable().optional(),username_auto_assigned:fe().int().nullable().optional(),sandbox_completed:fe().int().nullable().optional(),sandbox_completed_at:v().nullable().optional(),sandbox_dataset_id:v().nullable().optional(),aws_iam_username:v().nullable().optional(),dataset_count:fe().int().optional(),active_tokens:fe().int().optional(),linked_identities:Ze(v()).optional()}).passthrough(),XB=ne({user:Cb}).passthrough(),GV=ne({from:v().nullable(),to:v().nullable()}),JB=ne({message:v(),changed:wF(v(),GV),notes:Ze(v()).optional(),old_address_notified:Ue().optional(),user:Cb}).passthrough()});var e6=120,t6=64,r6="unnamed machine",KV=25,qb,n6,Us,Db,s6,o6,i6,HV,BV,a6,Zl,c6,u6,l6,d6,f6;var Mb=F(()=>{jn();qb=Ve(["authorization_pending","slow_down","expired_token","access_denied","invalid_grant"]),n6={authorization_pending:"Waiting for you to authorize this machine in the browser.",slow_down:"Polling too quickly; the CLI will slow down automatically.",expired_token:"The code expired. Run `nemar auth login` again for a new one.",access_denied:"This sign-in was declined in the browser. Run `nemar auth login` again if that was a mistake.",invalid_grant:"That code is no longer valid. Run `nemar auth login` again for a new one."},Us=Ve(["device_code_unknown","device_code_expired","device_code_used","device_code_denied","account_pending","account_revoked","identity_conflict","service_account","person_account","too_many_keys","key_not_found"]),Db=Us.options,s6={device_code_unknown:"That code was not found. Check the code shown in your terminal, or run `nemar auth login` again for a new one.",device_code_expired:"The code expired. Run `nemar auth login` again for a new one.",device_code_used:"That code has already been used. Run `nemar auth login` again for a new one.",device_code_denied:"This sign-in was declined in the browser. Run `nemar auth login` again if that was a mistake.",account_pending:"Verify your email address first. Check your inbox for the NEMAR verification code, then authorize again.",account_revoked:"Your NEMAR account access has been revoked. Contact the NEMAR team if you think this is a mistake.",identity_conflict:"This account shares an identifier with another NEMAR account and cannot sign in until that is resolved. Fix it in Settings on nemar.org or contact the NEMAR team.",service_account:"This is a service or test account, and it cannot sign in this way. Ask an owner to create a key for it with `nemar admin keys create`.",person_account:"This account belongs to a person. A person creates their own keys with `nemar auth login` or in Settings on nemar.org.",too_many_keys:`This account already has ${KV} active keys. Revoke one in Settings on nemar.org or with \`nemar auth keys\`, then try again.`,key_not_found:"That key was not found on this account, or it is already revoked. Run `nemar auth keys` to see the active ones."},o6=ne({error:Us,message:v()}).passthrough(),i6=ne({device_code:v(),user_code:v(),verification_uri:v(),verification_uri_complete:v(),expires_in:fe().int(),interval:fe().int()}).passthrough(),HV=Yw("error",[ne({error:In("authorization_pending"),message:v()}).passthrough(),ne({error:In("slow_down"),message:v()}).passthrough()]),BV=Yw("error",[ne({error:In("expired_token"),reason:Us,message:v()}).passthrough(),ne({error:In("access_denied"),reason:Us,message:v()}).passthrough(),ne({error:In("invalid_grant"),reason:Us,message:v()}).passthrough()]),a6=EF([HV,BV]),Zl=ne({id:fe().int(),name:v().nullable(),prefix:v(),created_at:v(),last_used_at:v().nullable(),current:Ue()}).passthrough(),c6=ne({api_key:v(),key:Zl,user:ne({username:v().nullable(),email:v(),github_username:v().nullable(),role:v(),sandbox_completed:Ue(),sandbox_dataset_id:v().nullable()}).passthrough()}).passthrough(),u6=ne({user_code:v(),machine_name:v(),requested_at:v(),expires_in:fe().int(),account:ne({username:v().nullable(),email_masked:v()}).passthrough(),refusal:ne({code:Us,message:v()}).passthrough().nullable()}).passthrough(),l6=ne({ok:In(!0),machine_name:v()}).passthrough(),d6=ne({keys:Ze(Zl)}).passthrough(),f6=ne({api_key:v(),key:Zl}).passthrough()});var WV,Lb,Ho="https://nemar.org/settings",m6,YV,XV,JV,g6,y6;var Ub=F(()=>{jn();WV=Ve(["orcid_in_use","orcid_already_linked","orcid_linked_other","email_in_use","github_in_use","identity_conflict_remains"]),Lb=WV.options,m6={orcid_in_use:`That ORCID iD already belongs to a NEMAR account. Sign in to that account instead; if you want the iD on a different account, unlink it there first (Settings, ${Ho}).`,orcid_already_linked:`That ORCID iD already belongs to a NEMAR account. Sign in to that account instead; if you want the iD on a different account, unlink it there first (Settings, ${Ho}).`,orcid_linked_other:`That ORCID iD is linked to a different NEMAR account. Unlink it there first (Settings, ${Ho}), then link it here.`,email_in_use:`That email address already belongs to a NEMAR account. Sign in to that account instead, or change its address first (Settings, ${Ho}).`,github_in_use:`That GitHub account is already linked to a NEMAR account. Sign in to that account instead, or change its GitHub username first (Settings, ${Ho}).`,identity_conflict_remains:"The collision that flagged this account is still there. Resolve it on the other account first (change its email or GitHub username, or unlink its ORCID iD), or delete that account, then clear the flag."},YV=Ve(["orcid","email","github"]),XV=ne({id:fe().int(),username:v().nullable(),email:v(),created_at:v(),has_oauth_identity:Ue(),dataset_count:fe().int(),identity_conflict:fe().int(),canonical:Ue()}).passthrough(),JV=ne({kind:YV,value:v(),canonical_user_id:fe().int(),accounts:Ze(XV)}).passthrough(),g6=ne({groups:Ze(JV),group_count:fe().int(),flagged_count:fe().int()}).passthrough(),y6=ne({ok:In(!0),id:fe().int(),cleared:Ue()}).passthrough()});function b6(e){return typeof e==="string"&&ZV.includes(e)}var QV,$6,E6,w6,ZV,e9="ci_check_unavailable",Fb,Vb,zb,S6="X-Approval-Dispatch-Token",x6;var Gb=F(()=>{jn();QV=/^\d{4}-\d{4}-\d{4}-\d{3}[\dX]$/,$6=v().regex(QV,"ORCID must be in format 0000-0000-0000-000X"),E6=Ve(["found","no_public_name","lookup_failed"]),w6=Ve(["bids_validation_failed","bids_validation_pending","bids_validation_in_progress","prescreen_failed","min_requirements_failed","owner_name_missing","identifier_screen_findings"]),ZV=["bids_validation_pending","bids_validation_in_progress"];Fb=[e9],Vb=["identifier_screen_pending","identifier_screen_not_clear","identifier_screen_not_applicable"],zb=["publication_review_not_clear","request_blocked","request_changed","request_mismatch","dispatch_superseded","dispatch_expired","decision_with_dispatch_token","approval_in_flight","deny_after_publishing","invalid_dataset_id","approval_closed_during_run"],x6=Ve(["filled","would_fill","no_public_name","lookup_failed","write_failed"])});function Hb(e){if(Kb)return;Kb=!0;let t=Nt.yellow("\u2500".repeat(60)),r=Nt.yellow.bold("[MAINTENANCE]"),n=Nt.dim(`mode: ${e.mode}`),s=e.eta?`
|
|
33
33
|
${Nt.dim(`eta: ${e.eta}`)}`:"";process.stderr.write(`${t}
|
|
34
34
|
${r} ${e.message}
|
|
35
35
|
${n}${s}
|
|
36
36
|
${t}
|
|
37
|
-
`)}var Kb=!1;var Bb=F(()=>{Ul()});function Wb(){if(process.env.TEST_API_URL)return process.env.TEST_API_URL;if(td)return ed;return hn().apiUrl||ed}async function L6(e,t={},r=!1,n){let s=`${Wb()}${e}`,o={"Content-Type":"application/json","X-CLI-Version":ac,...t.headers};if(r){let p=hn();if(!p.apiKey&&r===!0)throw new fr(401,"Not authenticated. Run 'nemar auth login' first.");if(p.apiKey)o.Authorization=`Bearer ${p.apiKey}`}let i=t.method||"GET",a=typeof t.body==="string"?t.body:void 0,c=Date.now(),u;try{u=await fetch(s,{...t,headers:o})}catch(p){if(lc())dc({method:i,url:s,status:null,durationMs:Date.now()-c,requestHeaders:o,requestBody:a,error:p instanceof Error?p.message:String(p)});throw new fr(0,`Network error: Could not connect to ${Wb()}`,{originalError:p instanceof Error?p.message:String(p)})}let d;try{d=await u.text()}catch(p){if(lc())dc({method:i,url:s,status:u.status,durationMs:Date.now()-c,requestHeaders:o,requestBody:a,error:p instanceof Error?p.message:String(p)});throw new fr(0,"Failed to read response body",{httpStatus:u.status,originalError:p instanceof Error?p.message:String(p)})}if(lc())dc({method:i,url:s,status:u.status,durationMs:Date.now()-c,requestHeaders:o,requestBody:a,responseBody:d});let l;try{l=JSON.parse(d)}catch{throw new fr(u.status,`Invalid response from server (status ${u.status})`)}if(!u.ok){if(u.status===503&&(l.mode==="read-only"||l.mode==="full")){let xt=typeof l.message==="string"?l.message:"NEMAR is in maintenance mode. Please retry shortly.",hr=typeof l.eta==="string"?l.eta:null,et=new Il(l.mode,xt,hr,l.details);throw Hb(et),et}let p=typeof l.block_reason==="string",f=Array.isArray(l.missing)?l.missing.filter((xt)=>typeof xt==="string"):void 0,h=typeof l.error==="string"&&(eb.includes(l.error)||Lb.includes(l.error)),m=typeof l.error==="string"&&(qb.options.includes(l.error)||Db.includes(l.error)),y=typeof l.error==="string"&&Jw.includes(l.error),_=typeof l.error==="string"&&Ib.includes(l.error),O=typeof l.error==="string"&&Vb.includes(l.error),T=typeof l.error==="string"&&Fb.includes(l.error),M=typeof l.error==="string"&&zb.includes(l.error),_e=p||T||M||h||m||y||_||O||f!==void 0&&typeof l.error==="string"&&Zw.includes(l.error)?l.message||l.error:l.error||l.message;if(u.status===404&&l.error==="Not Found"&&typeof l.message==="string")_e=`${l.message}. This NEMAR backend does not support this command yet.`;let ve=new fr(u.status,_e||"Request failed",l.details,typeof l.step==="string"?l.step:void 0,p?l.block_reason:void 0,f);if(typeof l.error==="string")ve.code=l.error;if(typeof l.reason==="string")ve.reason=l.reason;throw ve.rawBody=l,ve}if(n){let p=n.safeParse(l);if(!p.success)throw new fr(u.status,`Response for ${e} did not match the expected NEMAR contract`,{issues:p.error.issues});return p.data}return l}var ed="https://nemar-api-dev.sccn-org.workers.dev",td;var Yb=F(()=>{jb();Mb();Ub();Gb();nc();fc();Yl();Bb();Gl();Cl();td=ed.includes("workers.dev")});fc();import{open as c9,rm as u9}from"fs/promises";Yb();var Xb="NEMAR_DATA_HOSTS",t9="NEMAR_DATA_HOSTS_ONLY",r9="https://private.nemar.org",n9="https://private-test.nemar.org",s9=/^[a-z]{2,3}[0-9]{6}$/;function Jb(e){return s9.test(e)}function o9(e){return e}function Qb(e){return e==="127.0.0.1"||e==="localhost"||e==="[::1]"}function Zb(e){let t=e.trim();if(t===""||/[?#@]/.test(t))return null;let r;try{r=new URL(t)}catch{return null}if(r.username!==""||r.password!=="")return null;if(r.pathname!=="/")return null;if(r.protocol==="https:")return r.origin;if(r.protocol==="http:"&&Qb(r.hostname))return r.origin;return null}function eS(e){let t=[],r=[];for(let n of(e??"").split(",")){let s=n.trim();if(s==="")continue;let o=Zb(s);if(o===null)r.push(s);else if(!t.includes(o))t.push(o)}return{origins:t,rejected:r}}function tS(e){return e.env??process.env}function i9(e={}){let t=tS(e),r=e.isDevBuild??td,n=t[t9]==="1"?[]:[r?n9:r9],{origins:s}=eS(t[Xb]);return[...n,...s.filter((o)=>!n.includes(o))].map(o9)}function V6(e={}){return eS(tS(e)[Xb]).rejected}function hc(e,t={}){let r=Zb(e);if(r===null)return null;return i9(t).find((n)=>n===r)??null}function rS(e,t={}){return hc(e,t)!==null}function z6(e,t={}){let r;try{r=new URL(e)}catch{return null}if(r.username!==""||r.password!=="")return null;return hc(r.origin,t)}function nS(e,t){if(e.protocol==="https:")return!0;return e.protocol==="http:"&&Qb(e.hostname)&&new URL(t).protocol==="http:"}var a9="NEMAR_DATA_HOST_TIMEOUT_MS";function rd(e,t=process.env){let r=t[a9];if(r===void 0||!/^[0-9]+$/.test(r))return e;let n=Number(r);return n>0&&n<e?n:e}function nd(e){if(!(e instanceof Error))return"error";let t=e.code;return typeof t==="string"&&/^[A-Z][A-Z0-9_]+$/.test(t)?`${e.name} ${t}`:e.name}var sS=3,iS=60000,l9=262144,aS=255,cS=/^[A-Z0-9][A-Z0-9_]*-s([0-9]{1,16})(?:-S([0-9]{1,16})-C([0-9]{1,16}))?--[A-Za-z0-9._-]+$/;function uS(e){return e.length<=aS&&cS.test(e)}function d9(e){if(e.length>aS)return null;let t=cS.exec(e);if(!t||t[2]!==void 0)return null;let r=Number(t[1]);return Number.isSafeInteger(r)?r:null}function f9(e,t,r={}){if(!e)return{ok:!1,message:"The remote has no host setting."};if(!t)return{ok:!1,message:"The remote has no dataset setting."};if(!Jb(t))return{ok:!1,message:"The dataset setting is not a dataset id (two or three letters and six digits)."};let n=hc(e,r);if(n===null)return{ok:!1,message:`The host setting ${It(e)} is not an https origin on this CLI's list of data hosts. The remote's host setting is part of the repository, so it cannot add one.`};return{ok:!0,settings:{origin:n,dataset:t,options:r}}}function It(e,t=200){let r=e.replace(/[^\x20-\x7e]/g,"?");return r.length>t?`${r.slice(0,t)}...`:r}function p9(e,t){return new URL(`${e.origin}/o/${encodeURIComponent(e.dataset)}/${encodeURIComponent(t)}`)}function lS(e,t){if(t)return`The storage address was refused (status ${e}).`;if(e===401)return"The data host refused the API key. Run 'nemar auth login' to sign in again.";if(e===404)return"The data host has no such object, or this account has no access to the dataset.";if(e===429)return"The data host is limiting requests; try again shortly.";return`The data host answered status ${e}.`}async function dS(e,t,r,n,s,o){if(!rS(e.origin,e.options))return{kind:"failed",message:"The host is not on this CLI's list of data hosts."};let i=p9(e,t),a=!1;for(let c=0;;c++){let u={"Accept-Encoding":"identity"};if(i.origin===e.origin)u.Authorization=`Bearer ${r}`;let d;try{d=await fetch(i,{method:n,headers:u,redirect:"manual",signal:o})}catch(f){if(o.aborted)return{kind:"failed",message:"The request timed out."};return{kind:"failed",message:`Could not reach the host (${nd(f)}).`}}if(d.status<300||d.status>=400)return{kind:"response",response:d,redirected:a};if(await d.body?.cancel().catch(()=>{}),!s)return{kind:"response",response:d,redirected:a};if(c>=sS)return{kind:"failed",message:`More than ${sS} redirects.`};let l=d.headers.get("location");if(!l)return{kind:"failed",message:"A redirect named no address."};let p;try{p=new URL(l,i)}catch{return{kind:"failed",message:"A redirect named an address that is not a URL."}}if(!nS(p,e.origin))return{kind:"failed",message:"A redirect named an address that is not https."};i=p,a=!0}}async function fS(e,t){let r=new AbortController,n=setTimeout(()=>r.abort(),e),s=()=>{clearTimeout(n),n=setTimeout(()=>r.abort(),e)};try{return await t(r.signal,s)}finally{clearTimeout(n)}}async function h9(e,t,r,n,s){if(!uS(t))return{ok:!1,message:"The key is not one a data host serves."};let o=d9(t);return fS(rd(iS,e.options?.env),async(i,a)=>{let c=await dS(e,t,r,"GET",!0,i);if(c.kind==="failed")return{ok:!1,message:c.message};let{response:u,redirected:d}=c;if(u.status!==200||!u.body)return await u.body?.cancel().catch(()=>{}),{ok:!1,message:lS(u.status,d)};let l=u.headers.get("content-length");if(o!==null&&l!==null&&Number(l)!==o)return await u.body.cancel().catch(()=>{}),{ok:!1,message:`The object is ${It(l,20)} bytes but its key says ${o}.`};a();let p,f=0,h=0;try{p=await c9(n,"w");let m=u.body.getReader();while(!0){let{done:y,value:_}=await m.read();if(y)break;if(a(),f+=_.byteLength,o!==null&&f>o)throw await m.cancel().catch(()=>{}),new mc(`More bytes arrived than the key's ${o}.`);if(await p.write(_),f-h>=l9)h=f,s(f)}if(await p.close(),p=void 0,o!==null&&f!==o)throw new mc(`The object ended after ${f} bytes; its key says ${o}.`);if(f!==h)s(f);return{ok:!0,bytes:f}}catch(m){if(await p?.close().catch(()=>{}),await u9(n,{force:!0}).catch(()=>{}),m instanceof mc)return{ok:!1,message:m.message};if(i.aborted)return{ok:!1,message:"The transfer stalled and timed out."};return{ok:!1,message:`The transfer failed (${nd(m)}).`}}})}class mc extends Error{constructor(e){super(e);this.name="SizeError"}}async function m9(e,t,r){if(!uS(t))return{state:"unknown",message:"The key is not one a data host serves."};return fS(rd(iS,e.options?.env),async(n)=>{let s=await dS(e,t,r,"HEAD",!1,n);if(s.kind==="failed")return{state:"unknown",message:s.message};let{status:o}=s.response;if(await s.response.body?.cancel().catch(()=>{}),o===200)return{state:"present"};if(o===404)return{state:"absent"};return{state:"unknown",message:lS(o,!1)}})}class gc extends Error{constructor(e){super(e);this.name="ProtocolAbort"}}async function pS(e,t){let r=e.lines[Symbol.asyncIterator](),n=[],s=null,o=null,i=async()=>{let d=n.shift();if(d!==void 0)return d;let l=await r.next();return l.done?null:l.value},a=async(d)=>{await e.send(`GETCONFIG ${d}`);while(!0){let l=await r.next();if(l.done)throw new gc("git-annex closed the connection");let p=l.value;if(p==="VALUE"||p.startsWith("VALUE ")){let f=p.slice(5).trimStart();return f===""?void 0:f}if(p.startsWith("ERROR"))throw new gc(p);n.push(p)}},c=async()=>{let d=await a("host"),l=await a("dataset");return f9(d,l,t.options)},u=async(d,l)=>{if(!s||!o){await e.send(`TRANSFER-FAILURE RETRIEVE ${It(d)} The remote has not been prepared.`);return}let p=Promise.resolve(),f=await h9(s,d,o,l,(h)=>{p=p.then(()=>e.send(`PROGRESS ${h}`))});if(await p,f.ok)await e.send(`TRANSFER-SUCCESS RETRIEVE ${d}`);else await e.send(`TRANSFER-FAILURE RETRIEVE ${It(d)} ${It(f.message)}`)};await e.send("VERSION 1");while(!0){let d=await i();if(d===null)return 0;if(d.trim()==="")continue;let[l,...p]=oS(d,1),f=p[0]??"";try{switch(l){case"EXTENSIONS":await e.send("EXTENSIONS");break;case"INITREMOTE":{let h=await c();await e.send(h.ok?"INITREMOTE-SUCCESS":`INITREMOTE-FAILURE ${It(h.message)}`);break}case"PREPARE":{let h=await c();if(!h.ok){s=null,await e.send(`PREPARE-FAILURE ${It(h.message)}`);break}let m=t.loadApiKey();if(!m){s=null,await e.send("PREPARE-FAILURE No NEMAR API key is stored. Run 'nemar auth login' first.");break}s=h.settings,o=m,await e.send("PREPARE-SUCCESS");break}case"LISTCONFIGS":await e.send("CONFIG host The https origin of the NEMAR data host"),await e.send("CONFIG dataset The dataset id on that host"),await e.send("CONFIGEND");break;case"GETCOST":await e.send("COST 200");break;case"GETAVAILABILITY":await e.send("AVAILABILITY GLOBAL");break;case"GETINFO":if(s)await e.send("INFOFIELD host"),await e.send(`INFOVALUE ${s.origin}`),await e.send("INFOFIELD dataset"),await e.send(`INFOVALUE ${s.dataset}`);await e.send("INFOEND");break;case"EXPORTSUPPORTED":await e.send("EXPORTSUPPORTED-FAILURE");break;case"IMPORTSUPPORTED":await e.send("IMPORTSUPPORTED-FAILURE");break;case"WHEREIS":await e.send("WHEREIS-FAILURE");break;case"CLAIMURL":await e.send("CLAIMURL-FAILURE");break;case"CHECKURL":await e.send("CHECKURL-FAILURE");break;case"TRANSFER":{let[h,m,...y]=oS(f,2);if(h==="STORE")await e.send(`TRANSFER-FAILURE STORE ${It(m??"")} This remote is read-only for now.`);else if(h==="RETRIEVE"&&m&&y[0])await u(m,y[0]);else await e.send("UNSUPPORTED-REQUEST");break}case"CHECKPRESENT":{if(!f){await e.send("UNSUPPORTED-REQUEST");break}if(!s||!o){await e.send(`CHECKPRESENT-UNKNOWN ${It(f)} The remote has not been prepared.`);break}let h=await m9(s,f,o);if(h.state==="present")await e.send(`CHECKPRESENT-SUCCESS ${f}`);else if(h.state==="absent")await e.send(`CHECKPRESENT-FAILURE ${f}`);else await e.send(`CHECKPRESENT-UNKNOWN ${It(f)} ${h.message}`);break}case"REMOVE":await e.send(`REMOVE-FAILURE ${It(f)} This remote is read-only for now.`);break;case"ERROR":return 1;case"VALUE":break;default:await e.send("UNSUPPORTED-REQUEST")}}catch(h){if(h instanceof gc)return 1;throw h}}}function oS(e,t){let r=[],n=e;for(let s=0;s<t;s++){let o=n.indexOf(" ");if(o<0)break;r.push(n.slice(0,o)),n=n.slice(o+1)}return r.push(n),r}async function*g9(){let e=new TextDecoder,t="";for await(let r of Bun.stdin.stream()){t+=e.decode(r,{stream:!0});let n=t.indexOf(`
|
|
37
|
+
`)}var Kb=!1;var Bb=F(()=>{Ul()});function Wb(){if(process.env.TEST_API_URL)return process.env.TEST_API_URL;if(td)return ed;return hn().apiUrl||ed}async function L6(e,t={},r=!1,n){let s=`${Wb()}${e}`,o={"Content-Type":"application/json","X-CLI-Version":ac,...t.headers};if(r){let p=hn();if(!p.apiKey&&r===!0)throw new fr(401,"Not authenticated. Run 'nemar auth login' first.");if(p.apiKey)o.Authorization=`Bearer ${p.apiKey}`}let i=t.method||"GET",a=typeof t.body==="string"?t.body:void 0,c=Date.now(),u;try{u=await fetch(s,{...t,headers:o})}catch(p){if(lc())dc({method:i,url:s,status:null,durationMs:Date.now()-c,requestHeaders:o,requestBody:a,error:p instanceof Error?p.message:String(p)});throw new fr(0,`Network error: Could not connect to ${Wb()}`,{originalError:p instanceof Error?p.message:String(p)})}let d;try{d=await u.text()}catch(p){if(lc())dc({method:i,url:s,status:u.status,durationMs:Date.now()-c,requestHeaders:o,requestBody:a,error:p instanceof Error?p.message:String(p)});throw new fr(0,"Failed to read response body",{httpStatus:u.status,originalError:p instanceof Error?p.message:String(p)})}if(lc())dc({method:i,url:s,status:u.status,durationMs:Date.now()-c,requestHeaders:o,requestBody:a,responseBody:d});let l;try{l=JSON.parse(d)}catch{throw new fr(u.status,`Invalid response from server (status ${u.status})`)}if(!u.ok){if(u.status===503&&(l.mode==="read-only"||l.mode==="full")){let xt=typeof l.message==="string"?l.message:"NEMAR is in maintenance mode. Please retry shortly.",hr=typeof l.eta==="string"?l.eta:null,et=new Il(l.mode,xt,hr,l.details);throw Hb(et),et}let p=typeof l.block_reason==="string",f=Array.isArray(l.missing)?l.missing.filter((xt)=>typeof xt==="string"):void 0,h=typeof l.error==="string"&&(eb.includes(l.error)||Lb.includes(l.error)),m=typeof l.error==="string"&&(qb.options.includes(l.error)||Db.includes(l.error)),y=typeof l.error==="string"&&Jw.includes(l.error),_=typeof l.error==="string"&&Ib.includes(l.error),O=typeof l.error==="string"&&Vb.includes(l.error),T=typeof l.error==="string"&&Fb.includes(l.error),M=typeof l.error==="string"&&zb.includes(l.error),_e=p||T||M||h||m||y||_||O||f!==void 0&&typeof l.error==="string"&&Zw.includes(l.error)?l.message||l.error:l.error||l.message;if(u.status===404&&l.error==="Not Found"&&typeof l.message==="string")_e=`${l.message}. This NEMAR backend does not support this command yet.`;let ve=new fr(u.status,_e||"Request failed",l.details,typeof l.step==="string"?l.step:void 0,p?l.block_reason:void 0,f);if(typeof l.error==="string")ve.code=l.error;if(typeof l.reason==="string")ve.reason=l.reason;throw ve.rawBody=l,ve}if(n){let p=n.safeParse(l);if(!p.success)throw new fr(u.status,`Response for ${e} did not match the expected NEMAR contract`,{issues:p.error.issues});return p.data}return l}var ed="https://api.nemar.org",td;var Yb=F(()=>{jb();Mb();Ub();Gb();nc();fc();Yl();Bb();Gl();Cl();td=ed.includes("workers.dev")});fc();import{open as c9,rm as u9}from"fs/promises";Yb();var Xb="NEMAR_DATA_HOSTS",t9="NEMAR_DATA_HOSTS_ONLY",r9="https://private.nemar.org",n9="https://private-test.nemar.org",s9=/^[a-z]{2,3}[0-9]{6}$/;function Jb(e){return s9.test(e)}function o9(e){return e}function Qb(e){return e==="127.0.0.1"||e==="localhost"||e==="[::1]"}function Zb(e){let t=e.trim();if(t===""||/[?#@]/.test(t))return null;let r;try{r=new URL(t)}catch{return null}if(r.username!==""||r.password!=="")return null;if(r.pathname!=="/")return null;if(r.protocol==="https:")return r.origin;if(r.protocol==="http:"&&Qb(r.hostname))return r.origin;return null}function eS(e){let t=[],r=[];for(let n of(e??"").split(",")){let s=n.trim();if(s==="")continue;let o=Zb(s);if(o===null)r.push(s);else if(!t.includes(o))t.push(o)}return{origins:t,rejected:r}}function tS(e){return e.env??process.env}function i9(e={}){let t=tS(e),r=e.isDevBuild??td,n=t[t9]==="1"?[]:[r?n9:r9],{origins:s}=eS(t[Xb]);return[...n,...s.filter((o)=>!n.includes(o))].map(o9)}function V6(e={}){return eS(tS(e)[Xb]).rejected}function hc(e,t={}){let r=Zb(e);if(r===null)return null;return i9(t).find((n)=>n===r)??null}function rS(e,t={}){return hc(e,t)!==null}function z6(e,t={}){let r;try{r=new URL(e)}catch{return null}if(r.username!==""||r.password!=="")return null;return hc(r.origin,t)}function nS(e,t){if(e.protocol==="https:")return!0;return e.protocol==="http:"&&Qb(e.hostname)&&new URL(t).protocol==="http:"}var a9="NEMAR_DATA_HOST_TIMEOUT_MS";function rd(e,t=process.env){let r=t[a9];if(r===void 0||!/^[0-9]+$/.test(r))return e;let n=Number(r);return n>0&&n<e?n:e}function nd(e){if(!(e instanceof Error))return"error";let t=e.code;return typeof t==="string"&&/^[A-Z][A-Z0-9_]+$/.test(t)?`${e.name} ${t}`:e.name}var sS=3,iS=60000,l9=262144,aS=255,cS=/^[A-Z0-9][A-Z0-9_]*-s([0-9]{1,16})(?:-S([0-9]{1,16})-C([0-9]{1,16}))?--[A-Za-z0-9._-]+$/;function uS(e){return e.length<=aS&&cS.test(e)}function d9(e){if(e.length>aS)return null;let t=cS.exec(e);if(!t||t[2]!==void 0)return null;let r=Number(t[1]);return Number.isSafeInteger(r)?r:null}function f9(e,t,r={}){if(!e)return{ok:!1,message:"The remote has no host setting."};if(!t)return{ok:!1,message:"The remote has no dataset setting."};if(!Jb(t))return{ok:!1,message:"The dataset setting is not a dataset id (two or three letters and six digits)."};let n=hc(e,r);if(n===null)return{ok:!1,message:`The host setting ${It(e)} is not an https origin on this CLI's list of data hosts. The remote's host setting is part of the repository, so it cannot add one.`};return{ok:!0,settings:{origin:n,dataset:t,options:r}}}function It(e,t=200){let r=e.replace(/[^\x20-\x7e]/g,"?");return r.length>t?`${r.slice(0,t)}...`:r}function p9(e,t){return new URL(`${e.origin}/o/${encodeURIComponent(e.dataset)}/${encodeURIComponent(t)}`)}function lS(e,t){if(t)return`The storage address was refused (status ${e}).`;if(e===401)return"The data host refused the API key. Run 'nemar auth login' to sign in again.";if(e===404)return"The data host has no such object, or this account has no access to the dataset.";if(e===429)return"The data host is limiting requests; try again shortly.";return`The data host answered status ${e}.`}async function dS(e,t,r,n,s,o){if(!rS(e.origin,e.options))return{kind:"failed",message:"The host is not on this CLI's list of data hosts."};let i=p9(e,t),a=!1;for(let c=0;;c++){let u={"Accept-Encoding":"identity"};if(i.origin===e.origin)u.Authorization=`Bearer ${r}`;let d;try{d=await fetch(i,{method:n,headers:u,redirect:"manual",signal:o})}catch(f){if(o.aborted)return{kind:"failed",message:"The request timed out."};return{kind:"failed",message:`Could not reach the host (${nd(f)}).`}}if(d.status<300||d.status>=400)return{kind:"response",response:d,redirected:a};if(await d.body?.cancel().catch(()=>{}),!s)return{kind:"response",response:d,redirected:a};if(c>=sS)return{kind:"failed",message:`More than ${sS} redirects.`};let l=d.headers.get("location");if(!l)return{kind:"failed",message:"A redirect named no address."};let p;try{p=new URL(l,i)}catch{return{kind:"failed",message:"A redirect named an address that is not a URL."}}if(!nS(p,e.origin))return{kind:"failed",message:"A redirect named an address that is not https."};i=p,a=!0}}async function fS(e,t){let r=new AbortController,n=setTimeout(()=>r.abort(),e),s=()=>{clearTimeout(n),n=setTimeout(()=>r.abort(),e)};try{return await t(r.signal,s)}finally{clearTimeout(n)}}async function h9(e,t,r,n,s){if(!uS(t))return{ok:!1,message:"The key is not one a data host serves."};let o=d9(t);return fS(rd(iS,e.options?.env),async(i,a)=>{let c=await dS(e,t,r,"GET",!0,i);if(c.kind==="failed")return{ok:!1,message:c.message};let{response:u,redirected:d}=c;if(u.status!==200||!u.body)return await u.body?.cancel().catch(()=>{}),{ok:!1,message:lS(u.status,d)};let l=u.headers.get("content-length");if(o!==null&&l!==null&&Number(l)!==o)return await u.body.cancel().catch(()=>{}),{ok:!1,message:`The object is ${It(l,20)} bytes but its key says ${o}.`};a();let p,f=0,h=0;try{p=await c9(n,"w");let m=u.body.getReader();while(!0){let{done:y,value:_}=await m.read();if(y)break;if(a(),f+=_.byteLength,o!==null&&f>o)throw await m.cancel().catch(()=>{}),new mc(`More bytes arrived than the key's ${o}.`);if(await p.write(_),f-h>=l9)h=f,s(f)}if(await p.close(),p=void 0,o!==null&&f!==o)throw new mc(`The object ended after ${f} bytes; its key says ${o}.`);if(f!==h)s(f);return{ok:!0,bytes:f}}catch(m){if(await p?.close().catch(()=>{}),await u9(n,{force:!0}).catch(()=>{}),m instanceof mc)return{ok:!1,message:m.message};if(i.aborted)return{ok:!1,message:"The transfer stalled and timed out."};return{ok:!1,message:`The transfer failed (${nd(m)}).`}}})}class mc extends Error{constructor(e){super(e);this.name="SizeError"}}async function m9(e,t,r){if(!uS(t))return{state:"unknown",message:"The key is not one a data host serves."};return fS(rd(iS,e.options?.env),async(n)=>{let s=await dS(e,t,r,"HEAD",!1,n);if(s.kind==="failed")return{state:"unknown",message:s.message};let{status:o}=s.response;if(await s.response.body?.cancel().catch(()=>{}),o===200)return{state:"present"};if(o===404)return{state:"absent"};return{state:"unknown",message:lS(o,!1)}})}class gc extends Error{constructor(e){super(e);this.name="ProtocolAbort"}}async function pS(e,t){let r=e.lines[Symbol.asyncIterator](),n=[],s=null,o=null,i=async()=>{let d=n.shift();if(d!==void 0)return d;let l=await r.next();return l.done?null:l.value},a=async(d)=>{await e.send(`GETCONFIG ${d}`);while(!0){let l=await r.next();if(l.done)throw new gc("git-annex closed the connection");let p=l.value;if(p==="VALUE"||p.startsWith("VALUE ")){let f=p.slice(5).trimStart();return f===""?void 0:f}if(p.startsWith("ERROR"))throw new gc(p);n.push(p)}},c=async()=>{let d=await a("host"),l=await a("dataset");return f9(d,l,t.options)},u=async(d,l)=>{if(!s||!o){await e.send(`TRANSFER-FAILURE RETRIEVE ${It(d)} The remote has not been prepared.`);return}let p=Promise.resolve(),f=await h9(s,d,o,l,(h)=>{p=p.then(()=>e.send(`PROGRESS ${h}`))});if(await p,f.ok)await e.send(`TRANSFER-SUCCESS RETRIEVE ${d}`);else await e.send(`TRANSFER-FAILURE RETRIEVE ${It(d)} ${It(f.message)}`)};await e.send("VERSION 1");while(!0){let d=await i();if(d===null)return 0;if(d.trim()==="")continue;let[l,...p]=oS(d,1),f=p[0]??"";try{switch(l){case"EXTENSIONS":await e.send("EXTENSIONS");break;case"INITREMOTE":{let h=await c();await e.send(h.ok?"INITREMOTE-SUCCESS":`INITREMOTE-FAILURE ${It(h.message)}`);break}case"PREPARE":{let h=await c();if(!h.ok){s=null,await e.send(`PREPARE-FAILURE ${It(h.message)}`);break}let m=t.loadApiKey();if(!m){s=null,await e.send("PREPARE-FAILURE No NEMAR API key is stored. Run 'nemar auth login' first.");break}s=h.settings,o=m,await e.send("PREPARE-SUCCESS");break}case"LISTCONFIGS":await e.send("CONFIG host The https origin of the NEMAR data host"),await e.send("CONFIG dataset The dataset id on that host"),await e.send("CONFIGEND");break;case"GETCOST":await e.send("COST 200");break;case"GETAVAILABILITY":await e.send("AVAILABILITY GLOBAL");break;case"GETINFO":if(s)await e.send("INFOFIELD host"),await e.send(`INFOVALUE ${s.origin}`),await e.send("INFOFIELD dataset"),await e.send(`INFOVALUE ${s.dataset}`);await e.send("INFOEND");break;case"EXPORTSUPPORTED":await e.send("EXPORTSUPPORTED-FAILURE");break;case"IMPORTSUPPORTED":await e.send("IMPORTSUPPORTED-FAILURE");break;case"WHEREIS":await e.send("WHEREIS-FAILURE");break;case"CLAIMURL":await e.send("CLAIMURL-FAILURE");break;case"CHECKURL":await e.send("CHECKURL-FAILURE");break;case"TRANSFER":{let[h,m,...y]=oS(f,2);if(h==="STORE")await e.send(`TRANSFER-FAILURE STORE ${It(m??"")} This remote is read-only for now.`);else if(h==="RETRIEVE"&&m&&y[0])await u(m,y[0]);else await e.send("UNSUPPORTED-REQUEST");break}case"CHECKPRESENT":{if(!f){await e.send("UNSUPPORTED-REQUEST");break}if(!s||!o){await e.send(`CHECKPRESENT-UNKNOWN ${It(f)} The remote has not been prepared.`);break}let h=await m9(s,f,o);if(h.state==="present")await e.send(`CHECKPRESENT-SUCCESS ${f}`);else if(h.state==="absent")await e.send(`CHECKPRESENT-FAILURE ${f}`);else await e.send(`CHECKPRESENT-UNKNOWN ${It(f)} ${h.message}`);break}case"REMOVE":await e.send(`REMOVE-FAILURE ${It(f)} This remote is read-only for now.`);break;case"ERROR":return 1;case"VALUE":break;default:await e.send("UNSUPPORTED-REQUEST")}}catch(h){if(h instanceof gc)return 1;throw h}}}function oS(e,t){let r=[],n=e;for(let s=0;s<t;s++){let o=n.indexOf(" ");if(o<0)break;r.push(n.slice(0,o)),n=n.slice(o+1)}return r.push(n),r}async function*g9(){let e=new TextDecoder,t="";for await(let r of Bun.stdin.stream()){t+=e.decode(r,{stream:!0});let n=t.indexOf(`
|
|
38
38
|
`);while(n>=0)yield t.slice(0,n).replace(/\r$/,""),t=t.slice(n+1),n=t.indexOf(`
|
|
39
39
|
`)}if(t+=e.decode(),t!=="")yield t}var sd=Bun.stdout.writer(),y9=await pS({lines:g9(),send:async(e)=>{sd.write(`${e}
|
|
40
40
|
`),await sd.flush()}},{loadApiKey:()=>hn().apiKey||void 0});await sd.end();process.exit(y9);
|