@crossmint/cli 1.1.11 → 1.1.13

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/README.md CHANGED
@@ -14,13 +14,27 @@ pnpm install
14
14
  pnpm build
15
15
  ```
16
16
 
17
- ### 4️⃣ Link the CLI Globally
17
+ ### 4️⃣ Set Up Global Bin Directory (First Time Only)
18
+
19
+ If this is your first time using pnpm global packages, set up the global bin directory:
20
+
21
+ ```sh
22
+ pnpm setup
23
+ ```
24
+
25
+ Then restart your shell or run:
18
26
 
19
27
  ```sh
20
- pnpm link --global
28
+ source ~/.zshrc # or ~/.bashrc for bash
21
29
  ```
22
30
 
23
- ### 5️⃣ Verify the CLI is Installed
31
+ ### 5️⃣ Link the CLI Globally
32
+
33
+ ```sh
34
+ pnpm link
35
+ ```
36
+
37
+ ### 6️⃣ Verify the CLI is Installed
24
38
 
25
39
  ```sh
26
40
  crossmint --help
@@ -44,9 +58,10 @@ pnpm dev
44
58
 
45
59
  #### **Fix:** Ensure the CLI is linked globally:
46
60
 
61
+ Add the links (ignore error if not previously installed):
62
+
47
63
  ```sh
48
- pnpm unlink --global
49
- pnpm link --global
64
+ pnpm unlink 2>/dev/null || pnpm link
50
65
  ```
51
66
 
52
67
  Then, verify it’s linked:
@@ -56,27 +71,9 @@ pnpm bin -g
56
71
  ls -l $(pnpm bin -g)
57
72
  ```
58
73
 
59
- ### **Issue: `pnpm bin -g` is empty or returns an error**
60
-
61
- #### **Fix:** The global bin directory is missing or not in `PATH`. Run:
74
+ ### **Issue: `ERR_PNPM_NO_GLOBAL_BIN_DIR` - Unable to find the global bin directory**
62
75
 
63
- ```sh
64
- pnpm config set global-bin-dir ~/.local/bin
65
- ```
66
-
67
- Then, add it to your PATH:
68
-
69
- ```sh
70
- echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
71
- source ~/.zshrc
72
- ```
73
-
74
- Then, relink the CLI:
75
-
76
- ```sh
77
- pnpm unlink --global
78
- pnpm link --global
79
- ```
76
+ #### **Fix:** This may not have been needed with older pnpm versions, but is now required. Follow the instructions in step 4️⃣ above to set up the global bin directory.
80
77
 
81
78
  ## Releasing
82
79
 
@@ -1,18 +1,20 @@
1
1
  #!/usr/bin/env node
2
- var Fs=(t,e)=>()=>(t&&(e=t(t=0)),e);var Bs=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);import Dr from"path";import{fileURLToPath as Ur}from"url";var l=Fs(()=>{"use strict"});var gt=Bs((Mn,nr)=>{nr.exports={name:"@crossmint/cli",version:"1.1.11",description:"",keywords:[],repository:{type:"git",url:"https://github.com/Paella-Labs/crossbit-main"},license:"ISC",author:"",type:"module",main:"dist/bin/crossmint.js",bin:{crossmint:"dist/bin/crossmint.js"},scripts:{build:"tsup --env.NODE_ENV production","build:pkg":"NODE_ENV=production node ./build-pkg.js",dev:"tsup --watch --env.NODE_ENV development",start:"pnpm build && node dist/bin/crossmint.js","test:vitest":"vitest run","test:vitest:watch":"vitest"},dependencies:{"@crossmint/common-consts":"workspace:*","@crossmint/common-string-utils":"workspace:*","@crossmint/common-types":"workspace:*","@crossmint/data-dbs-types":"workspace:*","@crossmint/products-console-types":"workspace:*","@inquirer/prompts":"7.4.0",chalk:"4.1.2",commander:"12.0.0",keytar:"7.9.0",nanospinner:"1.2.2",open:"9.1.0"},devDependencies:{"@crossmint/tsconfig":"workspace:*","@crossmint/tsupconfig":"workspace:*","@crossmint/vitestconfig":"workspace:*","@types/node":"20.14.8","@yao-pkg/pkg":"6.5.1",esbuild:"0.25.2",vitest:"2.1.9"},pkg:{scripts:"dist/bin/crossmint.js",assets:[],targets:["node20-macos-arm64","node20-linux-x64","node20-macos-x64"],outputPath:"build"}}});l();import{program as ye}from"commander";l();l();var Ws={production:"https://www.crossmint.com",staging:"https://staging.crossmint.com",local:"http://localhost:3000"};function ae(t){return Ws[t]}l();l();import ct from"keytar";var lt="crossmint-cli";async function ve(t,e){return ct.setPassword(lt,t,e)}async function Ee(t){return ct.getPassword(lt,t)}async function Le(t){return ct.deletePassword(lt,t)}function wt(t){return ve("environment",t)}async function M(){return Ee("environment")}async function Rt(){return Le("environment")}function jt(t){return ve("sessionToken",t)}async function Nt(){return Ee("sessionToken")}async function kt(){return Le("sessionToken")}function Re(t){return ve("projectId",t)}async function F(){return Ee("projectId")}async function Ot(){return Le("projectId")}import{select as pr}from"@inquirer/prompts";l();l();l();l();l();l();var Ks=Object.defineProperty;var $e=(t,e)=>Ks(t,"name",{value:e,configurable:!0});l();function De(t){return Object.values(t)}$e(De,"objectValues");function Lt(t){return Object.keys(t)}$e(Lt,"objectKeys");function $t(t){return Object.entries(t)}$e($t,"objectEntries");l();var I;(function(t){t.assertEqual=r=>r;function e(r){}t.assertIs=e;function s(r){throw new Error}t.assertNever=s,t.arrayToEnum=r=>{let n={};for(let o of r)n[o]=o;return n},t.getValidEnumValues=r=>{let n=t.objectKeys(r).filter(i=>typeof r[r[i]]!="number"),o={};for(let i of n)o[i]=r[i];return t.objectValues(o)},t.objectValues=r=>t.objectKeys(r).map(function(n){return r[n]}),t.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let n=[];for(let o in r)Object.prototype.hasOwnProperty.call(r,o)&&n.push(o);return n},t.find=(r,n)=>{for(let o of r)if(n(o))return o},t.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&isFinite(r)&&Math.floor(r)===r;function a(r,n=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(n)}t.joinValues=a,t.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(I||(I={}));var pt;(function(t){t.mergeShapes=(e,s)=>({...e,...s})})(pt||(pt={}));var m=I.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Q=t=>{switch(typeof t){case"undefined":return m.undefined;case"string":return m.string;case"number":return isNaN(t)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(t)?m.array:t===null?m.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?m.promise:typeof Map<"u"&&t instanceof Map?m.map:typeof Set<"u"&&t instanceof Set?m.set:typeof Date<"u"&&t instanceof Date?m.date:m.object;default:return m.unknown}},p=I.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"]),Zs=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),U=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};let s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let s=e||function(n){return n.message},a={_errors:[]},r=n=>{for(let o of n.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)a._errors.push(s(o));else{let i=a,d=0;for(;d<o.path.length;){let u=o.path[d];d===o.path.length-1?(i[u]=i[u]||{_errors:[]},i[u]._errors.push(s(o))):i[u]=i[u]||{_errors:[]},i=i[u],d++}}};return r(this),a}toString(){return this.message}get message(){return JSON.stringify(this.issues,I.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=s=>s.message){let s={},a=[];for(let r of this.issues)r.path.length>0?(s[r.path[0]]=s[r.path[0]]||[],s[r.path[0]].push(e(r))):a.push(e(r));return{formErrors:a,fieldErrors:s}}get formErrors(){return this.flatten()}};U.create=t=>new U(t);var je=(t,e)=>{let s;switch(t.code){case p.invalid_type:t.received===m.undefined?s="Required":s=`Expected ${t.expected}, received ${t.received}`;break;case p.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(t.expected,I.jsonStringifyReplacer)}`;break;case p.unrecognized_keys:s=`Unrecognized key(s) in object: ${I.joinValues(t.keys,", ")}`;break;case p.invalid_union:s="Invalid input";break;case p.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${I.joinValues(t.options)}`;break;case p.invalid_enum_value:s=`Invalid enum value. Expected ${I.joinValues(t.options)}, received '${t.received}'`;break;case p.invalid_arguments:s="Invalid function arguments";break;case p.invalid_return_type:s="Invalid function return type";break;case p.invalid_date:s="Invalid date";break;case p.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(s=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(s=`${s} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?s=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?s=`Invalid input: must end with "${t.validation.endsWith}"`:I.assertNever(t.validation):t.validation!=="regex"?s=`Invalid ${t.validation}`:s="Invalid";break;case p.too_small:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:s="Invalid input";break;case p.too_big:t.type==="array"?s=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?s=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?s=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?s=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?s=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:s="Invalid input";break;case p.custom:s="Invalid input";break;case p.invalid_intersection_types:s="Intersection results could not be merged";break;case p.not_multiple_of:s=`Number must be a multiple of ${t.multipleOf}`;break;case p.not_finite:s="Number must be finite";break;default:s=e.defaultError,I.assertNever(t)}return{message:s}},Ut=je;function Hs(t){Ut=t}function Ue(){return Ut}var Ve=t=>{let{data:e,path:s,errorMaps:a,issueData:r}=t,n=[...s,...r.path||[]],o={...r,path:n},i="",d=a.filter(u=>!!u).slice().reverse();for(let u of d)i=u(o,{data:e,defaultError:i}).message;return{...r,path:n,message:r.message||i}},zs=[];function f(t,e){let s=Ve({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ue(),je].filter(a=>!!a)});t.common.issues.push(s)}var O=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,s){let a=[];for(let r of s){if(r.status==="aborted")return E;r.status==="dirty"&&e.dirty(),a.push(r.value)}return{status:e.value,value:a}}static async mergeObjectAsync(e,s){let a=[];for(let r of s)a.push({key:await r.key,value:await r.value});return t.mergeObjectSync(e,a)}static mergeObjectSync(e,s){let a={};for(let r of s){let{key:n,value:o}=r;if(n.status==="aborted"||o.status==="aborted")return E;n.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),n.value!=="__proto__"&&(typeof o.value<"u"||r.alwaysSet)&&(a[n.value]=o.value)}return{status:e.value,value:a}}},E=Object.freeze({status:"aborted"}),Vt=t=>({status:"dirty",value:t}),L=t=>({status:"valid",value:t}),ut=t=>t.status==="aborted",mt=t=>t.status==="dirty",Ne=t=>t.status==="valid",Fe=t=>typeof Promise<"u"&&t instanceof Promise,h;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(h||(h={}));var B=class{constructor(e,s,a,r){this._cachedPath=[],this.parent=e,this.data=s,this._path=a,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Dt=(t,e)=>{if(Ne(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let s=new U(t.common.issues);return this._error=s,this._error}}};function T(t){if(!t)return{};let{errorMap:e,invalid_type_error:s,required_error:a,description:r}=t;if(e&&(s||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(o,i)=>o.code!=="invalid_type"?{message:i.defaultError}:typeof i.data>"u"?{message:a??i.defaultError}:{message:s??i.defaultError},description:r}}var S=class{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)}get description(){return this._def.description}_getType(e){return Q(e.data)}_getOrReturnCtx(e,s){return s||{common:e.parent.common,data:e.data,parsedType:Q(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new O,ctx:{common:e.parent.common,data:e.data,parsedType:Q(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let s=this._parse(e);if(Fe(s))throw new Error("Synchronous parse encountered promise.");return s}_parseAsync(e){let s=this._parse(e);return Promise.resolve(s)}parse(e,s){let a=this.safeParse(e,s);if(a.success)return a.data;throw a.error}safeParse(e,s){var a;let r={common:{issues:[],async:(a=s?.async)!==null&&a!==void 0?a:!1,contextualErrorMap:s?.errorMap},path:s?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Q(e)},n=this._parseSync({data:e,path:r.path,parent:r});return Dt(r,n)}async parseAsync(e,s){let a=await this.safeParseAsync(e,s);if(a.success)return a.data;throw a.error}async safeParseAsync(e,s){let a={common:{issues:[],contextualErrorMap:s?.errorMap,async:!0},path:s?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Q(e)},r=this._parse({data:e,path:a.path,parent:a}),n=await(Fe(r)?r:Promise.resolve(r));return Dt(a,n)}refine(e,s){let a=r=>typeof s=="string"||typeof s>"u"?{message:s}:typeof s=="function"?s(r):s;return this._refinement((r,n)=>{let o=e(r),i=()=>n.addIssue({code:p.custom,...a(r)});return typeof Promise<"u"&&o instanceof Promise?o.then(d=>d?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,s){return this._refinement((a,r)=>e(a)?!0:(r.addIssue(typeof s=="function"?s(a,r):s),!1))}_refinement(e){return new V({schema:this,typeName:_.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return W.create(this,this._def)}nullable(){return q.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Y.create(this,this._def)}promise(){return te.create(this,this._def)}or(e){return de.create([this,e],this._def)}and(e){return pe.create(this,e,this._def)}transform(e){return new V({...T(this._def),schema:this,typeName:_.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let s=typeof e=="function"?e:()=>e;return new ge({...T(this._def),innerType:this,defaultValue:s,typeName:_.ZodDefault})}brand(){return new Ze({typeName:_.ZodBranded,type:this,...T(this._def)})}catch(e){let s=typeof e=="function"?e:()=>e;return new Ae({...T(this._def),innerType:this,catchValue:s,typeName:_.ZodCatch})}describe(e){let s=this.constructor;return new s({...this._def,description:e})}pipe(e){return ke.create(this,e)}readonly(){return xe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Gs=/^c[^\s-]{8,}$/i,Ys=/^[a-z][a-z0-9]*$/,qs=/^[0-9A-HJKMNP-TV-Z]{26}$/,Js=/^[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,Qs=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Xs="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",dt,ea=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,ta=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,sa=t=>t.precision?t.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${t.precision}}Z$`):t.precision===0?t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):t.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function aa(t,e){return!!((e==="v4"||!e)&&ea.test(t)||(e==="v6"||!e)&&ta.test(t))}var X=class t extends S{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){let n=this._getOrReturnCtx(e);return f(n,{code:p.invalid_type,expected:m.string,received:n.parsedType}),E}let a=new O,r;for(let n of this._def.checks)if(n.kind==="min")e.data.length<n.value&&(r=this._getOrReturnCtx(e,r),f(r,{code:p.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),a.dirty());else if(n.kind==="max")e.data.length>n.value&&(r=this._getOrReturnCtx(e,r),f(r,{code:p.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),a.dirty());else if(n.kind==="length"){let o=e.data.length>n.value,i=e.data.length<n.value;(o||i)&&(r=this._getOrReturnCtx(e,r),o?f(r,{code:p.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&f(r,{code:p.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),a.dirty())}else if(n.kind==="email")Qs.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"email",code:p.invalid_string,message:n.message}),a.dirty());else if(n.kind==="emoji")dt||(dt=new RegExp(Xs,"u")),dt.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"emoji",code:p.invalid_string,message:n.message}),a.dirty());else if(n.kind==="uuid")Js.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"uuid",code:p.invalid_string,message:n.message}),a.dirty());else if(n.kind==="cuid")Gs.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"cuid",code:p.invalid_string,message:n.message}),a.dirty());else if(n.kind==="cuid2")Ys.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"cuid2",code:p.invalid_string,message:n.message}),a.dirty());else if(n.kind==="ulid")qs.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"ulid",code:p.invalid_string,message:n.message}),a.dirty());else if(n.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),f(r,{validation:"url",code:p.invalid_string,message:n.message}),a.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"regex",code:p.invalid_string,message:n.message}),a.dirty())):n.kind==="trim"?e.data=e.data.trim():n.kind==="includes"?e.data.includes(n.value,n.position)||(r=this._getOrReturnCtx(e,r),f(r,{code:p.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),a.dirty()):n.kind==="toLowerCase"?e.data=e.data.toLowerCase():n.kind==="toUpperCase"?e.data=e.data.toUpperCase():n.kind==="startsWith"?e.data.startsWith(n.value)||(r=this._getOrReturnCtx(e,r),f(r,{code:p.invalid_string,validation:{startsWith:n.value},message:n.message}),a.dirty()):n.kind==="endsWith"?e.data.endsWith(n.value)||(r=this._getOrReturnCtx(e,r),f(r,{code:p.invalid_string,validation:{endsWith:n.value},message:n.message}),a.dirty()):n.kind==="datetime"?sa(n).test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{code:p.invalid_string,validation:"datetime",message:n.message}),a.dirty()):n.kind==="ip"?aa(e.data,n.version)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"ip",code:p.invalid_string,message:n.message}),a.dirty()):I.assertNever(n);return{status:a.value,value:e.data}}_regex(e,s,a){return this.refinement(r=>e.test(r),{validation:s,code:p.invalid_string,...h.errToObj(a)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...h.errToObj(e)})}url(e){return this._addCheck({kind:"url",...h.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...h.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...h.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...h.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...h.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...h.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...h.errToObj(e)})}datetime(e){var s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(s=e?.offset)!==null&&s!==void 0?s:!1,...h.errToObj(e?.message)})}regex(e,s){return this._addCheck({kind:"regex",regex:e,...h.errToObj(s)})}includes(e,s){return this._addCheck({kind:"includes",value:e,position:s?.position,...h.errToObj(s?.message)})}startsWith(e,s){return this._addCheck({kind:"startsWith",value:e,...h.errToObj(s)})}endsWith(e,s){return this._addCheck({kind:"endsWith",value:e,...h.errToObj(s)})}min(e,s){return this._addCheck({kind:"min",value:e,...h.errToObj(s)})}max(e,s){return this._addCheck({kind:"max",value:e,...h.errToObj(s)})}length(e,s){return this._addCheck({kind:"length",value:e,...h.errToObj(s)})}nonempty(e){return this.min(1,h.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}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 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 minLength(){let e=null;for(let s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxLength(){let e=null;for(let s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}};X.create=t=>{var e;return new X({checks:[],typeName:_.ZodString,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...T(t)})};function ra(t,e){let s=(t.toString().split(".")[1]||"").length,a=(e.toString().split(".")[1]||"").length,r=s>a?s:a,n=parseInt(t.toFixed(r).replace(".","")),o=parseInt(e.toFixed(r).replace(".",""));return n%o/Math.pow(10,r)}var re=class t extends S{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)),this._getType(e)!==m.number){let n=this._getOrReturnCtx(e);return f(n,{code:p.invalid_type,expected:m.number,received:n.parsedType}),E}let a,r=new O;for(let n of this._def.checks)n.kind==="int"?I.isInteger(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{code:p.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(a=this._getOrReturnCtx(e,a),f(a,{code:p.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(a=this._getOrReturnCtx(e,a),f(a,{code:p.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="multipleOf"?ra(e.data,n.value)!==0&&(a=this._getOrReturnCtx(e,a),f(a,{code:p.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):n.kind==="finite"?Number.isFinite(e.data)||(a=this._getOrReturnCtx(e,a),f(a,{code:p.not_finite,message:n.message}),r.dirty()):I.assertNever(n);return{status:r.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,h.toString(s))}gt(e,s){return this.setLimit("min",e,!1,h.toString(s))}lte(e,s){return this.setLimit("max",e,!0,h.toString(s))}lt(e,s){return this.setLimit("max",e,!1,h.toString(s))}setLimit(e,s,a,r){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:a,message:h.toString(r)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:h.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:h.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(s)})}finite(e){return this._addCheck({kind:"finite",message:h.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:h.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:h.toString(e)})}get minValue(){let e=null;for(let s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(let s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&I.isInteger(e.value))}get isFinite(){let e=null,s=null;for(let a of this._def.checks){if(a.kind==="finite"||a.kind==="int"||a.kind==="multipleOf")return!0;a.kind==="min"?(s===null||a.value>s)&&(s=a.value):a.kind==="max"&&(e===null||a.value<e)&&(e=a.value)}return Number.isFinite(s)&&Number.isFinite(e)}};re.create=t=>new re({checks:[],typeName:_.ZodNumber,coerce:t?.coerce||!1,...T(t)});var ne=class t extends S{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==m.bigint){let n=this._getOrReturnCtx(e);return f(n,{code:p.invalid_type,expected:m.bigint,received:n.parsedType}),E}let a,r=new O;for(let n of this._def.checks)n.kind==="min"?(n.inclusive?e.data<n.value:e.data<=n.value)&&(a=this._getOrReturnCtx(e,a),f(a,{code:p.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="max"?(n.inclusive?e.data>n.value:e.data>=n.value)&&(a=this._getOrReturnCtx(e,a),f(a,{code:p.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="multipleOf"?e.data%n.value!==BigInt(0)&&(a=this._getOrReturnCtx(e,a),f(a,{code:p.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):I.assertNever(n);return{status:r.value,value:e.data}}gte(e,s){return this.setLimit("min",e,!0,h.toString(s))}gt(e,s){return this.setLimit("min",e,!1,h.toString(s))}lte(e,s){return this.setLimit("max",e,!0,h.toString(s))}lt(e,s){return this.setLimit("max",e,!1,h.toString(s))}setLimit(e,s,a,r){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:s,inclusive:a,message:h.toString(r)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:h.toString(e)})}multipleOf(e,s){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(s)})}get minValue(){let e=null;for(let s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e}get maxValue(){let e=null;for(let s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e}};ne.create=t=>{var e;return new ne({checks:[],typeName:_.ZodBigInt,coerce:(e=t?.coerce)!==null&&e!==void 0?e:!1,...T(t)})};var oe=class extends S{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){let a=this._getOrReturnCtx(e);return f(a,{code:p.invalid_type,expected:m.boolean,received:a.parsedType}),E}return L(e.data)}};oe.create=t=>new oe({typeName:_.ZodBoolean,coerce:t?.coerce||!1,...T(t)});var ie=class t extends S{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){let n=this._getOrReturnCtx(e);return f(n,{code:p.invalid_type,expected:m.date,received:n.parsedType}),E}if(isNaN(e.data.getTime())){let n=this._getOrReturnCtx(e);return f(n,{code:p.invalid_date}),E}let a=new O,r;for(let n of this._def.checks)n.kind==="min"?e.data.getTime()<n.value&&(r=this._getOrReturnCtx(e,r),f(r,{code:p.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),a.dirty()):n.kind==="max"?e.data.getTime()>n.value&&(r=this._getOrReturnCtx(e,r),f(r,{code:p.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),a.dirty()):I.assertNever(n);return{status:a.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,s){return this._addCheck({kind:"min",value:e.getTime(),message:h.toString(s)})}max(e,s){return this._addCheck({kind:"max",value:e.getTime(),message:h.toString(s)})}get minDate(){let e=null;for(let s of this._def.checks)s.kind==="min"&&(e===null||s.value>e)&&(e=s.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let s of this._def.checks)s.kind==="max"&&(e===null||s.value<e)&&(e=s.value);return e!=null?new Date(e):null}};ie.create=t=>new ie({checks:[],coerce:t?.coerce||!1,typeName:_.ZodDate,...T(t)});var Se=class extends S{_parse(e){if(this._getType(e)!==m.symbol){let a=this._getOrReturnCtx(e);return f(a,{code:p.invalid_type,expected:m.symbol,received:a.parsedType}),E}return L(e.data)}};Se.create=t=>new Se({typeName:_.ZodSymbol,...T(t)});var ce=class extends S{_parse(e){if(this._getType(e)!==m.undefined){let a=this._getOrReturnCtx(e);return f(a,{code:p.invalid_type,expected:m.undefined,received:a.parsedType}),E}return L(e.data)}};ce.create=t=>new ce({typeName:_.ZodUndefined,...T(t)});var le=class extends S{_parse(e){if(this._getType(e)!==m.null){let a=this._getOrReturnCtx(e);return f(a,{code:p.invalid_type,expected:m.null,received:a.parsedType}),E}return L(e.data)}};le.create=t=>new le({typeName:_.ZodNull,...T(t)});var ee=class extends S{constructor(){super(...arguments),this._any=!0}_parse(e){return L(e.data)}};ee.create=t=>new ee({typeName:_.ZodAny,...T(t)});var G=class extends S{constructor(){super(...arguments),this._unknown=!0}_parse(e){return L(e.data)}};G.create=t=>new G({typeName:_.ZodUnknown,...T(t)});var K=class extends S{_parse(e){let s=this._getOrReturnCtx(e);return f(s,{code:p.invalid_type,expected:m.never,received:s.parsedType}),E}};K.create=t=>new K({typeName:_.ZodNever,...T(t)});var Ce=class extends S{_parse(e){if(this._getType(e)!==m.undefined){let a=this._getOrReturnCtx(e);return f(a,{code:p.invalid_type,expected:m.void,received:a.parsedType}),E}return L(e.data)}};Ce.create=t=>new Ce({typeName:_.ZodVoid,...T(t)});var Y=class t extends S{_parse(e){let{ctx:s,status:a}=this._processInputParams(e),r=this._def;if(s.parsedType!==m.array)return f(s,{code:p.invalid_type,expected:m.array,received:s.parsedType}),E;if(r.exactLength!==null){let o=s.data.length>r.exactLength.value,i=s.data.length<r.exactLength.value;(o||i)&&(f(s,{code:o?p.too_big:p.too_small,minimum:i?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),a.dirty())}if(r.minLength!==null&&s.data.length<r.minLength.value&&(f(s,{code:p.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),a.dirty()),r.maxLength!==null&&s.data.length>r.maxLength.value&&(f(s,{code:p.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),a.dirty()),s.common.async)return Promise.all([...s.data].map((o,i)=>r.type._parseAsync(new B(s,o,s.path,i)))).then(o=>O.mergeArray(a,o));let n=[...s.data].map((o,i)=>r.type._parseSync(new B(s,o,s.path,i)));return O.mergeArray(a,n)}get element(){return this._def.type}min(e,s){return new t({...this._def,minLength:{value:e,message:h.toString(s)}})}max(e,s){return new t({...this._def,maxLength:{value:e,message:h.toString(s)}})}length(e,s){return new t({...this._def,exactLength:{value:e,message:h.toString(s)}})}nonempty(e){return this.min(1,e)}};Y.create=(t,e)=>new Y({type:t,minLength:null,maxLength:null,exactLength:null,typeName:_.ZodArray,...T(e)});function Te(t){if(t instanceof $){let e={};for(let s in t.shape){let a=t.shape[s];e[s]=W.create(Te(a))}return new $({...t._def,shape:()=>e})}else return t instanceof Y?new Y({...t._def,type:Te(t.element)}):t instanceof W?W.create(Te(t.unwrap())):t instanceof q?q.create(Te(t.unwrap())):t instanceof Z?Z.create(t.items.map(e=>Te(e))):t}var $=class t extends S{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(),s=I.objectKeys(e);return this._cached={shape:e,keys:s}}_parse(e){if(this._getType(e)!==m.object){let u=this._getOrReturnCtx(e);return f(u,{code:p.invalid_type,expected:m.object,received:u.parsedType}),E}let{status:a,ctx:r}=this._processInputParams(e),{shape:n,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof K&&this._def.unknownKeys==="strip"))for(let u in r.data)o.includes(u)||i.push(u);let d=[];for(let u of o){let g=n[u],b=r.data[u];d.push({key:{status:"valid",value:u},value:g._parse(new B(r,b,r.path,u)),alwaysSet:u in r.data})}if(this._def.catchall instanceof K){let u=this._def.unknownKeys;if(u==="passthrough")for(let g of i)d.push({key:{status:"valid",value:g},value:{status:"valid",value:r.data[g]}});else if(u==="strict")i.length>0&&(f(r,{code:p.unrecognized_keys,keys:i}),a.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let g of i){let b=r.data[g];d.push({key:{status:"valid",value:g},value:u._parse(new B(r,b,r.path,g)),alwaysSet:g in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let u=[];for(let g of d){let b=await g.key;u.push({key:b,value:await g.value,alwaysSet:g.alwaysSet})}return u}).then(u=>O.mergeObjectSync(a,u)):O.mergeObjectSync(a,d)}get shape(){return this._def.shape()}strict(e){return h.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(s,a)=>{var r,n,o,i;let d=(o=(n=(r=this._def).errorMap)===null||n===void 0?void 0:n.call(r,s,a).message)!==null&&o!==void 0?o:a.defaultError;return s.code==="unrecognized_keys"?{message:(i=h.errToObj(e).message)!==null&&i!==void 0?i:d}:{message:d}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:_.ZodObject})}setKey(e,s){return this.augment({[e]:s})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let s={};return I.objectKeys(e).forEach(a=>{e[a]&&this.shape[a]&&(s[a]=this.shape[a])}),new t({...this._def,shape:()=>s})}omit(e){let s={};return I.objectKeys(this.shape).forEach(a=>{e[a]||(s[a]=this.shape[a])}),new t({...this._def,shape:()=>s})}deepPartial(){return Te(this)}partial(e){let s={};return I.objectKeys(this.shape).forEach(a=>{let r=this.shape[a];e&&!e[a]?s[a]=r:s[a]=r.optional()}),new t({...this._def,shape:()=>s})}required(e){let s={};return I.objectKeys(this.shape).forEach(a=>{if(e&&!e[a])s[a]=this.shape[a];else{let n=this.shape[a];for(;n instanceof W;)n=n._def.innerType;s[a]=n}}),new t({...this._def,shape:()=>s})}keyof(){return Ft(I.objectKeys(this.shape))}};$.create=(t,e)=>new $({shape:()=>t,unknownKeys:"strip",catchall:K.create(),typeName:_.ZodObject,...T(e)});$.strictCreate=(t,e)=>new $({shape:()=>t,unknownKeys:"strict",catchall:K.create(),typeName:_.ZodObject,...T(e)});$.lazycreate=(t,e)=>new $({shape:t,unknownKeys:"strip",catchall:K.create(),typeName:_.ZodObject,...T(e)});var de=class extends S{_parse(e){let{ctx:s}=this._processInputParams(e),a=this._def.options;function r(n){for(let i of n)if(i.result.status==="valid")return i.result;for(let i of n)if(i.result.status==="dirty")return s.common.issues.push(...i.ctx.common.issues),i.result;let o=n.map(i=>new U(i.ctx.common.issues));return f(s,{code:p.invalid_union,unionErrors:o}),E}if(s.common.async)return Promise.all(a.map(async n=>{let o={...s,common:{...s.common,issues:[]},parent:null};return{result:await n._parseAsync({data:s.data,path:s.path,parent:o}),ctx:o}})).then(r);{let n,o=[];for(let d of a){let u={...s,common:{...s.common,issues:[]},parent:null},g=d._parseSync({data:s.data,path:s.path,parent:u});if(g.status==="valid")return g;g.status==="dirty"&&!n&&(n={result:g,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(n)return s.common.issues.push(...n.ctx.common.issues),n.result;let i=o.map(d=>new U(d));return f(s,{code:p.invalid_union,unionErrors:i}),E}}get options(){return this._def.options}};de.create=(t,e)=>new de({options:t,typeName:_.ZodUnion,...T(e)});var Me=t=>t instanceof ue?Me(t.schema):t instanceof V?Me(t.innerType()):t instanceof me?[t.value]:t instanceof fe?t.options:t instanceof he?Object.keys(t.enum):t instanceof ge?Me(t._def.innerType):t instanceof ce?[void 0]:t instanceof le?[null]:null,Be=class t extends S{_parse(e){let{ctx:s}=this._processInputParams(e);if(s.parsedType!==m.object)return f(s,{code:p.invalid_type,expected:m.object,received:s.parsedType}),E;let a=this.discriminator,r=s.data[a],n=this.optionsMap.get(r);return n?s.common.async?n._parseAsync({data:s.data,path:s.path,parent:s}):n._parseSync({data:s.data,path:s.path,parent:s}):(f(s,{code:p.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),E)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,s,a){let r=new Map;for(let n of s){let o=Me(n.shape[e]);if(!o)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let i of o){if(r.has(i))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(i)}`);r.set(i,n)}}return new t({typeName:_.ZodDiscriminatedUnion,discriminator:e,options:s,optionsMap:r,...T(a)})}};function ft(t,e){let s=Q(t),a=Q(e);if(t===e)return{valid:!0,data:t};if(s===m.object&&a===m.object){let r=I.objectKeys(e),n=I.objectKeys(t).filter(i=>r.indexOf(i)!==-1),o={...t,...e};for(let i of n){let d=ft(t[i],e[i]);if(!d.valid)return{valid:!1};o[i]=d.data}return{valid:!0,data:o}}else if(s===m.array&&a===m.array){if(t.length!==e.length)return{valid:!1};let r=[];for(let n=0;n<t.length;n++){let o=t[n],i=e[n],d=ft(o,i);if(!d.valid)return{valid:!1};r.push(d.data)}return{valid:!0,data:r}}else return s===m.date&&a===m.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var pe=class extends S{_parse(e){let{status:s,ctx:a}=this._processInputParams(e),r=(n,o)=>{if(ut(n)||ut(o))return E;let i=ft(n.value,o.value);return i.valid?((mt(n)||mt(o))&&s.dirty(),{status:s.value,value:i.data}):(f(a,{code:p.invalid_intersection_types}),E)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([n,o])=>r(n,o)):r(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};pe.create=(t,e,s)=>new pe({left:t,right:e,typeName:_.ZodIntersection,...T(s)});var Z=class t extends S{_parse(e){let{status:s,ctx:a}=this._processInputParams(e);if(a.parsedType!==m.array)return f(a,{code:p.invalid_type,expected:m.array,received:a.parsedType}),E;if(a.data.length<this._def.items.length)return f(a,{code:p.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),E;!this._def.rest&&a.data.length>this._def.items.length&&(f(a,{code:p.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),s.dirty());let n=[...a.data].map((o,i)=>{let d=this._def.items[i]||this._def.rest;return d?d._parse(new B(a,o,a.path,i)):null}).filter(o=>!!o);return a.common.async?Promise.all(n).then(o=>O.mergeArray(s,o)):O.mergeArray(s,n)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};Z.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Z({items:t,typeName:_.ZodTuple,rest:null,...T(e)})};var We=class t extends S{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:s,ctx:a}=this._processInputParams(e);if(a.parsedType!==m.object)return f(a,{code:p.invalid_type,expected:m.object,received:a.parsedType}),E;let r=[],n=this._def.keyType,o=this._def.valueType;for(let i in a.data)r.push({key:n._parse(new B(a,i,a.path,i)),value:o._parse(new B(a,a.data[i],a.path,i))});return a.common.async?O.mergeObjectAsync(s,r):O.mergeObjectSync(s,r)}get element(){return this._def.valueType}static create(e,s,a){return s instanceof S?new t({keyType:e,valueType:s,typeName:_.ZodRecord,...T(a)}):new t({keyType:X.create(),valueType:e,typeName:_.ZodRecord,...T(s)})}},be=class extends S{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:s,ctx:a}=this._processInputParams(e);if(a.parsedType!==m.map)return f(a,{code:p.invalid_type,expected:m.map,received:a.parsedType}),E;let r=this._def.keyType,n=this._def.valueType,o=[...a.data.entries()].map(([i,d],u)=>({key:r._parse(new B(a,i,a.path,[u,"key"])),value:n._parse(new B(a,d,a.path,[u,"value"]))}));if(a.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let d of o){let u=await d.key,g=await d.value;if(u.status==="aborted"||g.status==="aborted")return E;(u.status==="dirty"||g.status==="dirty")&&s.dirty(),i.set(u.value,g.value)}return{status:s.value,value:i}})}else{let i=new Map;for(let d of o){let u=d.key,g=d.value;if(u.status==="aborted"||g.status==="aborted")return E;(u.status==="dirty"||g.status==="dirty")&&s.dirty(),i.set(u.value,g.value)}return{status:s.value,value:i}}}};be.create=(t,e,s)=>new be({valueType:e,keyType:t,typeName:_.ZodMap,...T(s)});var Ie=class t extends S{_parse(e){let{status:s,ctx:a}=this._processInputParams(e);if(a.parsedType!==m.set)return f(a,{code:p.invalid_type,expected:m.set,received:a.parsedType}),E;let r=this._def;r.minSize!==null&&a.data.size<r.minSize.value&&(f(a,{code:p.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),s.dirty()),r.maxSize!==null&&a.data.size>r.maxSize.value&&(f(a,{code:p.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),s.dirty());let n=this._def.valueType;function o(d){let u=new Set;for(let g of d){if(g.status==="aborted")return E;g.status==="dirty"&&s.dirty(),u.add(g.value)}return{status:s.value,value:u}}let i=[...a.data.values()].map((d,u)=>n._parse(new B(a,d,a.path,u)));return a.common.async?Promise.all(i).then(d=>o(d)):o(i)}min(e,s){return new t({...this._def,minSize:{value:e,message:h.toString(s)}})}max(e,s){return new t({...this._def,maxSize:{value:e,message:h.toString(s)}})}size(e,s){return this.min(e,s).max(e,s)}nonempty(e){return this.min(1,e)}};Ie.create=(t,e)=>new Ie({valueType:t,minSize:null,maxSize:null,typeName:_.ZodSet,...T(e)});var Ke=class t extends S{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:s}=this._processInputParams(e);if(s.parsedType!==m.function)return f(s,{code:p.invalid_type,expected:m.function,received:s.parsedType}),E;function a(i,d){return Ve({data:i,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,Ue(),je].filter(u=>!!u),issueData:{code:p.invalid_arguments,argumentsError:d}})}function r(i,d){return Ve({data:i,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,Ue(),je].filter(u=>!!u),issueData:{code:p.invalid_return_type,returnTypeError:d}})}let n={errorMap:s.common.contextualErrorMap},o=s.data;if(this._def.returns instanceof te){let i=this;return L(async function(...d){let u=new U([]),g=await i._def.args.parseAsync(d,n).catch(_e=>{throw u.addIssue(a(d,_e)),u}),b=await Reflect.apply(o,this,g);return await i._def.returns._def.type.parseAsync(b,n).catch(_e=>{throw u.addIssue(r(b,_e)),u})})}else{let i=this;return L(function(...d){let u=i._def.args.safeParse(d,n);if(!u.success)throw new U([a(d,u.error)]);let g=Reflect.apply(o,this,u.data),b=i._def.returns.safeParse(g,n);if(!b.success)throw new U([r(g,b.error)]);return b.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:Z.create(e).rest(G.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,s,a){return new t({args:e||Z.create([]).rest(G.create()),returns:s||G.create(),typeName:_.ZodFunction,...T(a)})}},ue=class extends S{get schema(){return this._def.getter()}_parse(e){let{ctx:s}=this._processInputParams(e);return this._def.getter()._parse({data:s.data,path:s.path,parent:s})}};ue.create=(t,e)=>new ue({getter:t,typeName:_.ZodLazy,...T(e)});var me=class extends S{_parse(e){if(e.data!==this._def.value){let s=this._getOrReturnCtx(e);return f(s,{received:s.data,code:p.invalid_literal,expected:this._def.value}),E}return{status:"valid",value:e.data}}get value(){return this._def.value}};me.create=(t,e)=>new me({value:t,typeName:_.ZodLiteral,...T(e)});function Ft(t,e){return new fe({values:t,typeName:_.ZodEnum,...T(e)})}var fe=class t extends S{_parse(e){if(typeof e.data!="string"){let s=this._getOrReturnCtx(e),a=this._def.values;return f(s,{expected:I.joinValues(a),received:s.parsedType,code:p.invalid_type}),E}if(this._def.values.indexOf(e.data)===-1){let s=this._getOrReturnCtx(e),a=this._def.values;return f(s,{received:s.data,code:p.invalid_enum_value,options:a}),E}return L(e.data)}get options(){return this._def.values}get enum(){let e={};for(let s of this._def.values)e[s]=s;return e}get Values(){let e={};for(let s of this._def.values)e[s]=s;return e}get Enum(){let e={};for(let s of this._def.values)e[s]=s;return e}extract(e){return t.create(e)}exclude(e){return t.create(this.options.filter(s=>!e.includes(s)))}};fe.create=Ft;var he=class extends S{_parse(e){let s=I.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(e);if(a.parsedType!==m.string&&a.parsedType!==m.number){let r=I.objectValues(s);return f(a,{expected:I.joinValues(r),received:a.parsedType,code:p.invalid_type}),E}if(s.indexOf(e.data)===-1){let r=I.objectValues(s);return f(a,{received:a.data,code:p.invalid_enum_value,options:r}),E}return L(e.data)}get enum(){return this._def.values}};he.create=(t,e)=>new he({values:t,typeName:_.ZodNativeEnum,...T(e)});var te=class extends S{unwrap(){return this._def.type}_parse(e){let{ctx:s}=this._processInputParams(e);if(s.parsedType!==m.promise&&s.common.async===!1)return f(s,{code:p.invalid_type,expected:m.promise,received:s.parsedType}),E;let a=s.parsedType===m.promise?s.data:Promise.resolve(s.data);return L(a.then(r=>this._def.type.parseAsync(r,{path:s.path,errorMap:s.common.contextualErrorMap})))}};te.create=(t,e)=>new te({type:t,typeName:_.ZodPromise,...T(e)});var V=class extends S{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===_.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:s,ctx:a}=this._processInputParams(e),r=this._def.effect||null,n={addIssue:o=>{f(a,o),o.fatal?s.abort():s.dirty()},get path(){return a.path}};if(n.addIssue=n.addIssue.bind(n),r.type==="preprocess"){let o=r.transform(a.data,n);return a.common.issues.length?{status:"dirty",value:a.data}:a.common.async?Promise.resolve(o).then(i=>this._def.schema._parseAsync({data:i,path:a.path,parent:a})):this._def.schema._parseSync({data:o,path:a.path,parent:a})}if(r.type==="refinement"){let o=i=>{let d=r.refinement(i,n);if(a.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(a.common.async===!1){let i=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return i.status==="aborted"?E:(i.status==="dirty"&&s.dirty(),o(i.value),{status:s.value,value:i.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(i=>i.status==="aborted"?E:(i.status==="dirty"&&s.dirty(),o(i.value).then(()=>({status:s.value,value:i.value}))))}if(r.type==="transform")if(a.common.async===!1){let o=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!Ne(o))return o;let i=r.transform(o.value,n);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:i}}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(o=>Ne(o)?Promise.resolve(r.transform(o.value,n)).then(i=>({status:s.value,value:i})):o);I.assertNever(r)}};V.create=(t,e,s)=>new V({schema:t,typeName:_.ZodEffects,effect:e,...T(s)});V.createWithPreprocess=(t,e,s)=>new V({schema:e,effect:{type:"preprocess",transform:t},typeName:_.ZodEffects,...T(s)});var W=class extends S{_parse(e){return this._getType(e)===m.undefined?L(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};W.create=(t,e)=>new W({innerType:t,typeName:_.ZodOptional,...T(e)});var q=class extends S{_parse(e){return this._getType(e)===m.null?L(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};q.create=(t,e)=>new q({innerType:t,typeName:_.ZodNullable,...T(e)});var ge=class extends S{_parse(e){let{ctx:s}=this._processInputParams(e),a=s.data;return s.parsedType===m.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:s.path,parent:s})}removeDefault(){return this._def.innerType}};ge.create=(t,e)=>new ge({innerType:t,typeName:_.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...T(e)});var Ae=class extends S{_parse(e){let{ctx:s}=this._processInputParams(e),a={...s,common:{...s.common,issues:[]}},r=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return Fe(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new U(a.common.issues)},input:a.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new U(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};Ae.create=(t,e)=>new Ae({innerType:t,typeName:_.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...T(e)});var Pe=class extends S{_parse(e){if(this._getType(e)!==m.nan){let a=this._getOrReturnCtx(e);return f(a,{code:p.invalid_type,expected:m.nan,received:a.parsedType}),E}return{status:"valid",value:e.data}}};Pe.create=t=>new Pe({typeName:_.ZodNaN,...T(t)});var na=Symbol("zod_brand"),Ze=class extends S{_parse(e){let{ctx:s}=this._processInputParams(e),a=s.data;return this._def.type._parse({data:a,path:s.path,parent:s})}unwrap(){return this._def.type}},ke=class t extends S{_parse(e){let{status:s,ctx:a}=this._processInputParams(e);if(a.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return n.status==="aborted"?E:n.status==="dirty"?(s.dirty(),Vt(n.value)):this._def.out._parseAsync({data:n.value,path:a.path,parent:a})})();{let r=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return r.status==="aborted"?E:r.status==="dirty"?(s.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:a.path,parent:a})}}static create(e,s){return new t({in:e,out:s,typeName:_.ZodPipeline})}},xe=class extends S{_parse(e){let s=this._def.innerType._parse(e);return Ne(s)&&(s.value=Object.freeze(s.value)),s}};xe.create=(t,e)=>new xe({innerType:t,typeName:_.ZodReadonly,...T(e)});var Bt=(t,e={},s)=>t?ee.create().superRefine((a,r)=>{var n,o;if(!t(a)){let i=typeof e=="function"?e(a):typeof e=="string"?{message:e}:e,d=(o=(n=i.fatal)!==null&&n!==void 0?n:s)!==null&&o!==void 0?o:!0,u=typeof i=="string"?{message:i}:i;r.addIssue({code:"custom",...u,fatal:d})}}):ee.create(),oa={object:$.lazycreate},_;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(_||(_={}));var ia=(t,e={message:`Input not instance of ${t.name}`})=>Bt(s=>s instanceof t,e),Wt=X.create,Kt=re.create,ca=Pe.create,la=ne.create,Zt=oe.create,da=ie.create,pa=Se.create,ua=ce.create,ma=le.create,fa=ee.create,ha=G.create,ga=K.create,ya=Ce.create,_a=Y.create,va=$.create,Ea=$.strictCreate,Ta=de.create,Sa=Be.create,Ca=pe.create,ba=Z.create,Ia=We.create,Aa=be.create,Pa=Ie.create,xa=Ke.create,wa=ue.create,Ra=me.create,ja=fe.create,Na=he.create,ka=te.create,Mt=V.create,Oa=W.create,La=q.create,$a=V.createWithPreprocess,Da=ke.create,Ma=()=>Wt().optional(),Ua=()=>Kt().optional(),Va=()=>Zt().optional(),Fa={string:t=>X.create({...t,coerce:!0}),number:t=>re.create({...t,coerce:!0}),boolean:t=>oe.create({...t,coerce:!0}),bigint:t=>ne.create({...t,coerce:!0}),date:t=>ie.create({...t,coerce:!0})},Ba=E,v=Object.freeze({__proto__:null,defaultErrorMap:je,setErrorMap:Hs,getErrorMap:Ue,makeIssue:Ve,EMPTY_PATH:zs,addIssueToContext:f,ParseStatus:O,INVALID:E,DIRTY:Vt,OK:L,isAborted:ut,isDirty:mt,isValid:Ne,isAsync:Fe,get util(){return I},get objectUtil(){return pt},ZodParsedType:m,getParsedType:Q,ZodType:S,ZodString:X,ZodNumber:re,ZodBigInt:ne,ZodBoolean:oe,ZodDate:ie,ZodSymbol:Se,ZodUndefined:ce,ZodNull:le,ZodAny:ee,ZodUnknown:G,ZodNever:K,ZodVoid:Ce,ZodArray:Y,ZodObject:$,ZodUnion:de,ZodDiscriminatedUnion:Be,ZodIntersection:pe,ZodTuple:Z,ZodRecord:We,ZodMap:be,ZodSet:Ie,ZodFunction:Ke,ZodLazy:ue,ZodLiteral:me,ZodEnum:fe,ZodNativeEnum:he,ZodPromise:te,ZodEffects:V,ZodTransformer:V,ZodOptional:W,ZodNullable:q,ZodDefault:ge,ZodCatch:Ae,ZodNaN:Pe,BRAND:na,ZodBranded:Ze,ZodPipeline:ke,ZodReadonly:xe,custom:Bt,Schema:S,ZodSchema:S,late:oa,get ZodFirstPartyTypeKind(){return _},coerce:Fa,any:fa,array:_a,bigint:la,boolean:Zt,date:da,discriminatedUnion:Sa,effect:Mt,enum:ja,function:xa,instanceof:ia,intersection:Ca,lazy:wa,literal:Ra,map:Aa,nan:ca,nativeEnum:Na,never:ga,null:ma,nullable:La,number:Kt,object:va,oboolean:Va,onumber:Ua,optional:Oa,ostring:Ma,pipeline:Da,preprocess:$a,promise:ka,record:Ia,set:Pa,strictObject:Ea,string:Wt,symbol:pa,transformer:Mt,tuple:ba,undefined:ua,union:Ta,unknown:ha,void:ya,NEVER:Ba,ZodIssueCode:p,quotelessJson:Zs,ZodError:U});l();l();var Ht={CROSSMINT_EUROPE:"crossmint-europe",CROSSMINT_HORIZON:"crossmint-horizon"};l();var Wa=v.object({providerType:v.literal("openpayd"),providerClientId:v.string(),providerAccountId:v.string()}),zt=v.discriminatedUnion("providerType",[Wa]);l();var Ka=v.object({providerType:v.literal("openpayd"),providerBeneficiaryId:v.string().uuid()}),Gt=v.discriminatedUnion("providerType",[Ka]);var Za=v.object({whitelabelWalletAPI:v.boolean(),whitelabelCheckoutAPI:v.boolean(),billingAPI:v.boolean(),ethereumMintAPI:v.boolean(),baseMintAPI:v.boolean().optional(),subprojectCreation:v.object({enabled:v.boolean(),KYCOwnership:v.enum(["crossmint","developer"])}).optional(),mintAPIBYOC:v.boolean().optional(),mintAPITransferable:v.boolean().optional(),mintAPIUserIdBasedMintRecipient:v.boolean().optional(),embeddedCheckout:v.boolean().optional(),batchMintAPI:v.boolean().optional(),spamPlan:v.enum(["simple","advanced"]).optional(),paymentsMintToProjectScopedWallets:v.boolean().optional(),nonCustodialWallets:v.boolean().optional(),registerExternalCollections:v.boolean().optional(),mintAPIMaxReuploadFileSizeMB:v.number().optional(),solanaNonCompressedMint:v.boolean().optional(),solanaSFTMint:v.boolean().optional(),subscriptions:v.boolean().optional(),memeTokensCheckout:v.boolean().optional(),onrampCheckout:v.boolean().optional(),worldstore:v.object({sellerId:v.string().optional()}).optional(),onrampB2B:v.object({legalEntityName:v.string(),crossmintEntity:v.nativeEnum(Ht),crossmintReference:v.string().regex(/^\d{3}$/),provider:zt}).optional(),offrampB2B:v.object({provider:Gt,transactionLimit:v.number().min(1)}).optional(),payWithCryptoNativePassthrough:v.boolean().optional(),tokenizedCard:v.boolean().optional(),walletsMoneyTransfers:v.boolean().optional(),checkoutEnabled:v.boolean(),treasuryWallets:v.boolean().optional()}),J=(t=>(t.WHITELABEL_WALLET_API="whitelabelWalletAPI",t.WHITELABEL_CHECKOUT_API="whitelabelCheckoutAPI",t.BILLING_API="billingAPI",t.SUBSCRIPTIONS="subscriptions",t.PROJECT_TRANSFERS="walletsMoneyTransfers",t))(J||{});var N={GET:"GET",POST:"POST",PUT:"PUT",DELETE:"DELETE",PATCH:"PATCH",HEAD:"HEAD",OPTIONS:"OPTIONS",CONNECT:"CONNECT",TRACE:"TRACE"},Ha=De(N);l();l();var za=Object.defineProperty,c=(t,e)=>za(t,"name",{value:e,configurable:!0});l();l();var Ga=Object.defineProperty,C=(t,e)=>Ga(t,"name",{value:e,configurable:!0});function H(t){return t.charAt(0).toUpperCase()+t.slice(1)}C(H,"capitalizeFirstLetter");function z(t){return!t||t.length===0||t.trim().length===0}C(z,"isEmpty");function qt(t,e){return t.length<=e?t:t.slice(0,e)+"\u2026"}C(qt,"cutAndAddEllipsis");function Jt(t,e=4,s=4){return t.length<=e+s?t:t.slice(0,e)+"\u2026"+t.slice(s*-1)}C(Jt,"cutMiddleAndAddEllipsis");function Qt(){return(Math.random()+1).toString(36).substring(7)}C(Qt,"randomString");function Xt(t){let e=t.length,s=0,a=0;if(e>0)for(;a<e;)s=(s<<5)-s+t.charCodeAt(a++)|0;return s}C(Xt,"hashCode");var Yt=1e3;function es(t){return t.length<=Yt?t:t.slice(0,Yt)+"<truncated>"}C(es,"truncateForLog");function ts(t){return!t||typeof t!="string"?!1:t.toLowerCase()==="true"}C(ts,"parseBoolean");function ss(t){return/^-?\d+$/.test(t)}C(ss,"containsInteger");function as(t){if(t.length===0)return"";if(t.length===1)return t[0];let e=t.slice(0,t.length-1),s=t[t.length-1];return e.join(", ")+" and "+s}C(as,"makeFormattedEnglishList");function rs(t){return z(t)?"":t.split(" ").map(e=>e?H(e):"").join(" ")}C(rs,"capitalizeFirstLetterOfEachWord");function ns(t){return t.replace(/\s/g,"")}C(ns,"removeAllWhitespaces");function os(t){if(z(t))return 0;let e=C((s,a)=>{let r=(a.charCodeAt(0)-48)/74;return(s+r)%1},"base58Reduction");return t.split("").reduce(e,0)}C(os,"normalizeBase58String");function is(t,e=100){if(!z(t))return t.substring(0,e)}C(is,"trimIfDefined");function cs(t){return t.replace(/(\r\n|\n|\r)/g," ").replace(/[\x00-\x1F\x7F-\uFFFF]/g,"")}C(cs,"sanitizeStringToValidHTTPHeaderValue");function ls(t){try{JSON.parse(t)}catch{return!1}return!0}C(ls,"isStringifiedJson");function ds(t,e){if(!z(t))try{return JSON.parse(t)}catch(s){console.error(`safeJSONParse failed: ${e??""}`,s);return}}C(ds,"safeJSONParse");function ps(t,e){return t?.toLowerCase()===e?.toLowerCase()}C(ps,"equalsIgnoreCase");function us(t){return t.map(e=>`'${e}'`).join(" | ")}C(us,"arrayToUnionString");function ms(t){return t.startsWith("0x")?t:`0x${t}`}C(ms,"addHexIndicator");function fs(t){return Number.parseFloat(t).toString()}C(fs,"removeTrailingZeros");function hs(){let t="9876543210",e="";for(let s=0;s<4;s++)e+=t[Math.floor(Math.random()*10)];return e}C(hs,"generateOTP");function gs(t){return t&&t.includes("@")?t.split("@")[0]:t??""}C(gs,"getNameFromEmail");function ys(t){return t!=null?`@${t.split("@").pop()}`:""}C(ys,"getDomainFromEmail");function _s(t){return H(t.toLowerCase().replace(/([-_][a-z])/g,e=>e.toUpperCase().replace("-","").replace("_","")))}C(_s,"snakeToUpperCamel");function vs(t){return t[0].toLowerCase()+t.slice(1,t.length).replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)}C(vs,"upperCamelToSnake");function Es(t){return t.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}C(Es,"slugify");var Ya=C(t=>t.startsWith("0x")?t.slice(2):t,"trimHexIndicator");function ht(t){return new TextEncoder().encode(t).length}C(ht,"utf8Size");function Ts(t){return ht(JSON.stringify(t))}C(Ts,"serializedSize");function Ss(t){let e=unescape(encodeURIComponent(t)),s=new Uint8Array(e.length);for(let a=0;a<e.length;a++)s[a]=e.charCodeAt(a);return s}C(Ss,"stringToUtf8ByteArray");function Cs(t){return t.split("_").map(e=>H(e)).join(" ")}C(Cs,"capitalizeAndRemoveUnderscores");function bs(t){return t.split("-").map(e=>H(e)).join(" ")}C(bs,"capitalizeAndRemoveDashes");function Is(t){if(typeof t!="string")return t;let e=t;for(;;)try{let s=JSON.parse(e);if(typeof s=="string")e=s;else return s}catch{return e}}C(Is,"multiParse");function As(t,e=1){let s=["gmail.com","hotmail.com","outlook.com","live.com"],[a,r]=t.split("@"),[n,o]=r.split("."),i,d;return a.length<=3?i="*".repeat(a.length):i=a.length<=e?a:a[0]+"*".repeat(a.length-e-1)+a.slice(-e),s.includes(`${n}.${o}`)?d=`${n}.${o}`:d=`${n.length>1?n[0]+"*".repeat(n.length-2)+n.slice(-1):n}.${o}`,`${i}@${d}`}C(As,"obfuscateEmail");function Ps(t){return t.includes("*")}C(Ps,"isObfuscated");function xs(t){return t===null?!1:/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(t||"")}C(xs,"isEmail");function ws(...t){for(let e of t)if(!z(e))return e;throw new Error("All values are empty")}C(ws,"getFirstNonEmpty");function Rs(t){return t.endsWith(".")?t.slice(0,-1):t}C(Rs,"removeTrailingDecimal");var js={admin:{index:"/console/admin",enterpriseClient:{index:"/console/admin/enterprise-clients",withId:c(t=>`/console/admin/enterprise-clients/${t}`,"withId"),details:c(t=>`/console/admin/enterprise-clients/${t}/details`,"details"),onrampB2B:c(t=>`/console/admin/enterprise-clients/${t}/onrampb2b`,"onrampB2B")},quickstarts:{index:"/console/admin/quickstarts",new:"/console/admin/quickstarts/new",edit:c(t=>`/console/admin/quickstarts/${t}`,"edit")}},billing:{index:"/console/billing",planDetails:"/console/billing/plan-details"},overview:{index:"/console/overview"},orders:{index:"/console/orders",orderDetails:c(t=>`/console/orders/${t}`,"orderDetails")},createAccount:"/console/create-account",onboarding:"/console/onboarding",collections:{index:"/console/collections",create:"/console/create-collection",dashboard:c(t=>`/console/collections/${t}/dashboard`,"dashboard"),details:c(t=>`/console/collections/${t}/details`,"details"),branding:c(t=>`/console/collections/${t}/branding`,"branding"),contract:c(t=>`/console/collections/${t}/contract`,"contract"),payments:c(t=>`/console/collections/${t}/payments`,"payments"),orders:c(t=>`/console/collections/${t}/orders`,"orders"),orderDetails:c((t,e)=>`/console/collections/${t}/orders/${e}`,"orderDetails"),payouts:{index:c(t=>`/console/collections/${t}/payouts`,"index"),details:c((t,e)=>`/console/collections/${t}/payouts/${e}`,"details"),scheduled:c((t,e)=>`/console/collections/${t}/payouts/scheduled/${e}`,"scheduled")},registeredNfts:c(t=>`/console/collections/${t}/registered/nfts`,"registeredNfts"),createdNfts:c(t=>`/console/collections/${t}/created/nfts`,"createdNfts")},wallets:{company:{index:"/console/wallets/company",walletDetails:c(t=>`/console/wallets/company/${t}`,"walletDetails")},index:"/console/wallets",address:c((t,e)=>`/console/wallets/${t}?${e}`,"address")},prepay:{create:c(t=>`/console/collections/create-prepay/${t}`,"create"),details:c(t=>`/console/collections/prepay/${t}/details`,"details"),update:c(t=>`/console/collections/prepay/${t}/update`,"update")},projects:{index:"/console/projects",addMember:"/console/projects/addMember",apiKeys:{index:"/console/projects/apiKeys",edit:c((t,e)=>`/console/projects/${t}/APIKeys/Create?apiKeyId=${e}`,"edit")},projectId:c(t=>`/console/projects/${t}`,"projectId"),withId:c(t=>`/console/projects/${t}`,"withId"),branding:c(t=>`/console/projects/${t}/branding`,"branding"),settings:c(t=>`/console/projects/${t}/settings`,"settings"),walletsSettings:c(t=>`/console/projects/${t}/settings/wallets`,"walletsSettings")},webhooks:{index:"/console/webhooks"},domains:{index:"/console/domains"},applePayDomains:{index:"/console/apple-pay-domains"},account:{index:"/console/account"},mintingApi:{index:"/console/minting-api"},authorizeDevice:{index:c(t=>`/console/authorize-device?${new URLSearchParams(t).toString()}`,"index"),success:"/console/authorize-device/success"}};function He(t,e){return e?`${t}?clientId=${e}`:t}c(He,"appendClientId");var qa={console:{collections:{new:{chooseAction:c(t=>He("/alpha/console/collections/new/choose-action",t),"chooseAction"),details:c(t=>`/alpha/console/collections/new/details?${new URLSearchParams({...z(t)?{}:{clientId:t}}).toString()}`,"details"),registerCollection:c(t=>He("/alpha/console/collections/new/register-collection",t),"registerCollection"),smartContract:c(t=>He("/alpha/console/collections/new/smart-contract",t),"smartContract")}}}},Ja={admin:{godmode:{info:c(t=>`/api/admin/godmode/info?userId=${t}`,"info"),relatedEntities:c(t=>`/api/admin/godmode/related-entities?identifier=${t}`,"relatedEntities"),impersonate:c((t,e)=>`/api/admin/godmode/impersonate?entityId=${t}&type=${e}`,"impersonate"),gatherInfo:c((t,e)=>`/api/admin/godmode/gather-info/${t}/${e}`,"gatherInfo"),enterpriseData:c(t=>`/api/admin/godmode/enterprise-data?identifier=${t}`,"enterpriseData")}},auth:{callback:{email:"/api/auth/callback/email"}},internal:{transfer:{confirmation:"/api/internal/transfer/confirmation"},transaction:{confirmation:"/api/internal/transaction/confirmation"}},"v1-alpha1":{wallets:{transaction:{getViewInfo:c(t=>`/api/v1-alpha1/wallets/transaction/getViewInfo/${t}`,"getViewInfo")},nfts:c(t=>`api/v1-alpha1/wallets/${t}/nfts`,"nfts"),getViewInfo:c(t=>`api/v1-alpha1/wallets/transfers/getViewInfo/${t}`,"getViewInfo")},collections:{index:"/api/v1-alpha1/collections",mints:c((t,e,s)=>`/api/v1-alpha1/collections/${t}/mints?projectId=${e}${s?`&cursor=${s}`:""}`,"mints")},minting:{collections:{nfts:c((t,e)=>`/api/v1-alpha1/minting/collections/${t}/nfts?projectId=${e}`,"nfts")}},project:{branding:c(t=>`/api/v1-alpha1/projects/${t}/branding`,"branding"),usage:c((t,e,s)=>`/api/v1-alpha1/projects/${t}/usage?dimension=${e}&startDate=${s}`,"usage"),walletsCreated:c(t=>`/api/v1-alpha1/projects/${t}/wallets-created`,"walletsCreated")}},blockchain:{price:c(t=>`/api/blockchain/${t}/price`,"price")},console:{billing:{details:c(t=>`/api/billing/${t}`,"details"),addPaymentMethodUrl:c(t=>`/api/billing/addPaymentInfoUrl/${t}`,"addPaymentMethodUrl"),getCurrentBalance:c(t=>`/api/billing/${t}/balance`,"getCurrentBalance"),paymentMethods:c(t=>`/api/billing/${t}/paymentMethods`,"paymentMethods")},collections:{index:c(t=>`/api/collections?projectId=${t}`,"index"),indexPaginated:c((t,e,s,a=!1)=>`/api/v1-alpha1/collections?${new URLSearchParams({projectId:t,page:e.toString(),perPage:s.toString(),hideDrafts:a?"true":"false"})}`,"indexPaginated"),byClientId:c((t,e)=>`/api/console/collections/${t}?projectId=${e}`,"byClientId"),requestVerification:c((t,e)=>`/api/console/collections/${t}/request-verification?projectId=${e}`,"requestVerification"),mintableTemplates:c((t,e,s,a=20)=>`/api/console/collections/${t}/templates/mintable?projectId=${e}&page=${s}&perPage=${a}`,"mintableTemplates"),templateSupply:c((t,e)=>`/api/console/collections/${t}/templates/supply?projectId=${e}`,"templateSupply"),payments:{parameters:c((t,e)=>`/api/console/collections/${t}/payments/parameters?projectId=${e}`,"parameters")},orders:{stats:c((t,e)=>`/api/collections/${t}/orders/stats?projectId=${e}`,"stats"),index:c((t,e,s)=>{let a=new URLSearchParams({projectId:e,...s});return`/api/collections/${t}/orders?${a}`},"index"),order:c((t,e,s)=>`/api/collections/${t}/orders/${s}?projectId=${e}`,"order")},register:{evm:{contract:{getInfo:c((t,e)=>`/api/console/collections/register/evm/contract/${t}/get-info?chain=${e}`,"getInfo")},getThirdwebParams:c((t,e)=>`/api/console/collections/register/evm/contract/get-thirdweb-params?projectId=${t}&clientId=${e}`,"getThirdwebParams")}},batchUpload:c((t,e,s)=>`/api/console/collections/${t}/batchUpload?projectId=${e}&batchIdentifier=${s}`,"batchUpload"),batchUploadStatus:c((t,e,s,a)=>`/api/console/collections/${t}/batchUpload?projectId=${e}&batchIdentifier=${s}&workflowId=${a}`,"batchUploadStatus")},getProject:c(t=>`/api/console/projects?projectId=${t}`,"getProject"),projects:{index:`/api/${js.projects.index}`,exportCsv:c((t,e)=>`/api/export-csv?projectId=${t}&clientId=${e}`,"exportCsv"),apiKeys:c((t,e)=>`/api/console/projects/${t}/apiKeys${z(e)?"":`?keyId=${e}`}`,"apiKeys"),webhook:c(t=>`/api/console/projects/${t}/webhook`,"webhook"),members:"/api/console/projects/members",billing:{paymentMethods:c(t=>`/api/console/projects/${t}/billing/paymentMethods`,"paymentMethods"),balance:c(t=>`/api/console/projects/${t}/billing/balance`,"balance"),subscription:c(t=>`/api/console/projects/${t}/billing/subscription`,"subscription"),pricing:c(t=>`/api/console/projects/${t}/billing/pricing`,"pricing"),apiActionEnabled:c((t,e,s)=>`/api/console/projects/${t}/billing/apiActionEnabled?apiAction=${e}&chain=${s}`,"apiActionEnabled"),usage:c(t=>`/api/console/projects/${t}/billing/usage`,"usage"),autoRecharge:c(t=>`/api/console/projects/${t}/billing/autoRecharge`,"autoRecharge"),redeemCoupon:c(t=>`/api/console/projects/${t}/billing/redeemCoupon`,"redeemCoupon"),payments:c(t=>`/api/console/projects/${t}/billing/payments`,"payments"),topupStatus:c((t,e)=>`/api/console/projects/${t}/billing/topupStatus?requestId=${e}`,"topupStatus"),billingInformation:c(t=>`/api/console/projects/${t}/billing/billingInformation`,"billingInformation")},privacyPolicy:c(t=>`/api/console/project/${t}/privacy-policy`,"privacyPolicy")},webhook:{index:c(t=>`/api/console/webhook?projectId=${t}`,"index"),attempts:c(t=>`/api/console/webhook/attempts?projectId=${t}`,"attempts"),svix:{appPortal:"/api/console/webhook/svix/app-portal"}},domains:{createUpdateDelete:c((t,e)=>`/api/v1-alpha1/projects/${t}/domains/${e}`,"createUpdateDelete")},applePayDomains:{list:c(t=>`/api/v1-alpha1/projects/${t}/apple-pay-domains`,"list"),register:c((t,e)=>`/api/v1-alpha1/projects/${t}/apple-pay-domains/${e}`,"register"),deregister:c((t,e)=>`/api/v1-alpha1/projects/${t}/apple-pay-domains/${e}`,"deregister")},accesslist:{discordInfo:c((t,e)=>`/api/console/collections/${t}/accesslists/discord?projectId=${e}`,"discordInfo"),validateTwitter:c((t,e,s)=>`/api/console/collections/${t}/accesslists/twitter?username=${s}&projectId=${e}`,"validateTwitter"),accesslists:c((t,e)=>`/api/console/collections/${t}/accesslists?projectId=${e}`,"accesslists")},developerAccount:{get:c(t=>`/api/console/developer-account?projectId=${t}`,"get")},mintingApi:{hasMinted:c(t=>`/api/console/minting-api/hasMinted?projectId=${t}`,"hasMinted")},payments:{hostedSalesPage:{index:c((t,e)=>`/api/console/collections/${t}/payments/hostedSalesPage?projectId=${e}`,"index")},enable:c((t,e)=>`/api/console/collections/${t}/payments/enable?projectId=${e}`,"enable")},branding:c((t,e)=>`/api/console/collections/${t}/branding?projectId=${e}`,"branding"),registerContract:c((t,e)=>`/api/console/collections/${t}/register-contract?projectId=${e}`,"registerContract"),dashboard:{revenue:c((t,e,s,a,r)=>`/api/console/collections/${t}/dashboard/revenue/?projectId=${e}&after=${s}&before=${a}&periodInMS=${r}`,"revenue"),sales:c((t,e,s,a)=>`/api/console/collections/${t}/dashboard/sales/?projectId=${e}&after=${s}&before=${a}`,"sales")},contactSales:{upgradePlanSubmission:c(t=>`/api/console/contact-sales/upgrade-plan-submission?projectId=${t}`,"upgradePlanSubmission")}},developerAccount:"/api/developeraccount",contactSales:{upgradePlanSubmission:c(t=>`/api/console/contact-sales/upgrade-plan-submission?projectId=${t}`,"upgradePlanSubmission")},crossmint:{user:{discord:{index:"/api/crossmint/user/discord"}}},projects:"/api/projects",verification:{otp:c((t,e,s)=>`/api/verifyOTP?${new URLSearchParams({exportId:t,otp:e,uuid:s}).toString()}`,"otp"),getStatusByEntityId:c(t=>`/api/verification/${t}/status`,"getStatusByEntityId"),getCollectionStatus:c((t,e)=>`/api/verification/${t}/collectionStatus?projectId=${e}`,"getCollectionStatus")},prepays:{details:c(t=>`/api/prepays/${t}`,"details")},hostedSalesPage:{mintStatus:c(({clientId:t,isConsole:e,quantity:s,projectId:a,currency:r,price:n})=>`/api/collections/drop/mintStatus?clientId=${t}&quantity=${s}&currency=${r}&price=${n}&isConsole=${e}${a?`&projectId=${a}`:""}`,"mintStatus"),index:c(t=>`/api/collections/drop?slug=${t}`,"index"),context:c(t=>`/api/collections/drop/context?slug=${t}`,"context")},claim:{index:"/api/collections/claim",context:c(t=>`/api/collections/claim/context?slug=${t}`,"context"),pageStatus:c(({clientId:t,projectId:e})=>`/api/collections/claim/pageStatus?clientId=${t}&projectId=${e}`,"pageStatus"),supply:c(({clientId:t,projectId:e})=>`/api/collections/claim/supply?clientId=${t}&projectId=${e}`,"supply"),status:c(({clientId:t,projectId:e,requestId:s})=>`/api/collections/claim/status?clientId=${t}&projectId=${e}&requestId=${s}`,"status")},walletConnect:{signMessage:"/api/walletConnect"},transactions:{nft:c(t=>`/api/transactions/${t}/nft`,"nft")},"2023-06-09":{crossmint:{connect:c((t,{forceWalletSelection:e,projectId:s,showAAWallets:a})=>{let r=e?"&forceWalletSelection=true":"",n=s?`&projectId=${s}`:"";return`/api/2023-06-09/crossmint/connect?chain=${t}${r}${n}${a?"&showAAWallets=true":""}`},"connect")}},"2022-06-09":{minting:{collections:{index:c(t=>`/api/2022-06-09/minting/collections?projectId=${t}`,"index"),collectionId:c((t,e)=>`/api/2022-06-09/minting/collections/${t}${e?`?projectId=${e}`:""}`,"collectionId"),templates:c((t,e)=>`/api/2022-06-09/minting/collections/${t}/templates?projectId=${e}`,"templates"),nfts:c((t,e)=>`/api/2022-06-09/minting/collections/${t}/nfts?projectId=${e}`,"nfts"),template:c((t,e,s)=>`/api/2022-06-09/minting/collections/${t}/templates/${e}?projectId=${s}`,"template")}},wallets:{index:c(t=>`/api/2022-06-09/wallets?projectId=${t}`,"index")}},wallets:{get(t,e,s,a){return`/api/unstable/wallets?${new URLSearchParams({projectId:t,page:e.toString(),perPage:s.toString(),...a})}`},index:c(t=>`/api/v1-alpha1/wallets?projectId=${t}`,"index")},services:{aws:{s3:{presignedPutObject:c((t,e,s,a)=>`/api/services/aws/s3/presignedPutObject?${new URLSearchParams({clientId:t,projectId:s,batchIdentifier:e,bucketName:a}).toString()}`,"presignedPutObject")}}}},Qa={referralProgramAgreement:"/legal/referral-program-agreement",contentPolicy:"/content-policy",termsOfService:"/legal/terms-of-service",msa:"/master-services-agreement",privacyPolicy:"/legal/privacy-policy"},Xa={claim:c(t=>`/collections/${t}/claim`,"claim")},er={getSession:"/api/session",signOut:"/api/session/signout",oauthSessionAuthenticate:"/api/session/authenticate",authenticate:"/api/session/authenticate",oauthSessionAuthenticateAuthSDK:"/api/2024-09-26/session/sdk/auth/authenticate",stytchGetOrCreateUser:"/api/sdk/auth/user/get-or-create",exchangeAccessToken:"/api/session/exchange-access-token",sendOtp:"/api/session/send/otp"},tr={support:"https://help.crossmint.com/hc/en-us/requests/new",collectionVerificationFAQ:"https://help.crossmint.com/hc/en-us/articles/17367432791053-Crossmint-Collection-Review",sales:"/contact/sales",index:"/contact"},sr={contract:c(t=>`/claim/contract/${t}`,"contract")},ar={index:"https://docs.crossmint.com",changelog:{index:"https://docs.crossmint.com/changelog",article:c(t=>`https://docs.crossmint.com/changelog/${t}`,"article")},payments:{index:"https://docs.crossmint.com/payments/introduction"}},rr={index:"/cli-signin",success:"/cli-signin/success"},x={cliSignin:rr,console:js,api:Ja,alpha:qa,legal:Qa,collection:Xa,authentication:er,notFound:"/404",contact:tr,claim:sr,docs:ar,pricing:"/pricing"};import Ns from"os";var ks=gt().version,Os="@crossmint/cli";function or(){let t=Ns.platform(),e=Ns.arch(),s=process.version;return`${Os} ${ks} (${t} ${e}) Node.js/${s} (production)`}function ir(){return{"user-agent":or(),"x-client-name":Os,"x-client-version":ks}}async function k(t,e=N.GET,s){let a=await Nt(),r=await M();a||(console.error("\u274C Session not found, please run crossmint login"),process.exit(1)),r||(console.error("\u274C Environment not found, please run crossmint login"),process.exit(1));let n=`${ae(r)}${t}`;return ze(n,e,s,{Cookie:`sessionToken=${a}`})}async function Ls(t,e=N.GET,s){let a=await M();a||(console.error("\u274C Environment not found"),process.exit(1));let r=`${ae(a)}${t}`;return ze(r,e,s)}async function ze(t,e=N.GET,s,a){let r={method:e,headers:{"Content-Type":"application/json",...ir(),...a}};s&&(r.body=JSON.stringify(s));let n=await fetch(t,r);if(n.status>=400){let o=await n.json();throw new Error(`${o.message}`)}return await n.json()}import{select as lr}from"@inquirer/prompts";l();import{createSpinner as cr}from"nanospinner";function D(t){let e=cr(t),s={start:a=>(e.start({text:a}),s),succeed:a=>(e.success({text:a}),s),fail:a=>(e.error({text:a}),s)};return s}l();var yt="crossmint",A={LOGIN:"login",LOGOUT:"logout",WHOAMI:"whoami",KEYS:"keys",PROJECTS:"projects",CREATE:"create",DELETE:"delete",EDIT:"edit",LIST:"list",SELECT:"select",DETAILS:"details"};function w(t){return[yt,...t].join(" ")}var R={login:[A.LOGIN],logout:[A.LOGOUT],whoami:[A.WHOAMI],projects:{select:[A.PROJECTS,A.SELECT],create:[A.PROJECTS,A.CREATE],details:[A.PROJECTS,A.DETAILS]},keys:{create:[A.KEYS,A.CREATE],delete:[A.KEYS,A.DELETE],edit:[A.KEYS,A.EDIT],list:[A.KEYS,A.LIST]}};async function we(){let t=D("Fetching projects...").start();try{let e=await k(x.api.projects);if(!e||e.length===0)return t.fail(`No projects found. Create a new project using \`${w(R.projects.create)}\``),process.exit(0);if(t.succeed("Fetched projects"),e.length===1){let a=e[0];return console.log(`You only have one project: ${a.name}`),console.log(`To create another project, run \`${w(R.projects.create)}\``),await Re(a.id),console.log(`\u2705 Project ${a.name} selected`),process.exit(0)}let s=await lr({message:"Select a project:",choices:e.map(a=>({name:a.name,value:a,description:a.description}))});await Re(s.id),console.log(`\u2705 Project ${s.name} selected`),process.exit(0)}catch{t.fail("Failed to fetch projects"),process.exit(1)}}import ur from"open";l();import $s from"crypto";async function Ds(){let e=$s.randomBytes(32).toString("base64url"),a=$s.createHash("sha256").update(e).digest().toString("base64url");return await ve("pkceCodeVerifier",e),a}async function Ms(){return await Ee("pkceCodeVerifier")}l();import dr from"http";l();async function Ge(){let t=await M();return t||(console.error("\u274C Environment not found"),process.exit(1)),t==="local"?{uri:"test.stytch.com",projectId:"project-test-8eb55d3d-949f-4e0f-aea6-c9ba740f7813",clientId:"connected-app-test-4d27d6d8-3491-45c8-9bb0-b05f89cb7a1a"}:t==="staging"?{uri:"api.stytch.com",projectId:"project-live-b7c564af-0c0d-4662-bfc0-72bed1049cfe",clientId:"connected-app-live-47cd5bf1-c155-42c1-9f36-5d35853b34a7"}:{uri:"api.stytch.com",projectId:"project-live-7a1cb98d-b8b7-4471-aaf6-f8af67a0df94",clientId:"connected-app-live-a72edd7e-6ff3-4002-a13a-e7ca66354bd1"}}async function _t(t){return new Promise((e,s)=>{let a=dr.createServer(async(n,o)=>{try{let d=new URL(n.url||"",`http://${n.headers.host}`).searchParams.get("code");if(!d){o.writeHead(400,{"Content-Type":"text/plain"}),o.end("No code provided");return}let u=await Ge(),g=await ze(`https://${u.uri}/v1/public/${u.projectId}/oauth2/token`,N.POST,{grant_type:"authorization_code",code:d,client_id:u.clientId,redirect_uri:"http://127.0.0.1:3456/callback",code_verifier:await Ms()}),b=await Ls(x.authentication.exchangeAccessToken,N.POST,{accessToken:g.access_token});await jt(b.sessionToken),o.writeHead(302,{Location:`${ae(t)}${x.console.authorizeDevice.success}`}),o.end(),a.close(),e(g)}catch(i){o.writeHead(500,{"Content-Type":"text/plain"}),o.end("Error during authentication"),a.close(),s(i)}});a.listen(3456)})}var mr=!1;async function vt(){try{console.log("\u{1F510} Crossmint CLI - Login");let t=await pr({message:"Select environment:",choices:[{name:"Production",value:"production"},{name:"Staging",value:"staging"},...mr?[{name:"Local",value:"local"}]:[]]}),e=ae(t);e||(console.error(`Error: No URL found for ${t} environment`),process.exit(1)),await wt(t);let s=_t(t),{clientId:a}=await Ge(),n={code_challenge:await Ds(),code_challenge_method:"S256",scope:"full_access",response_type:"code",grant_type:"authorization_code",redirect_uri:"http://127.0.0.1:3456/callback",client_id:a},o=`${e}${x.console.authorizeDevice.index(n)}`;console.log("Opening browser for authentication..."),ur(o),await s,console.log(`\u2705 Login successful! You are now authenticated in the ${t} environment.`),await we()}catch{console.error("\u274C Login failed, please try again."),process.exit(1)}}l();l();async function se(t){return(await k(x.api.projects)).find(a=>a.id===t)}async function Et(){let t=await M(),e=await F(),s=await se(e||""),a=await k(x.authentication.getSession);console.log(`You are logged in to \u{1F340}Crossmint as: ${a.user.email} - Environment: ${H(t)} - ${s?`Project: ${s.name}`:"No project selected"}`),process.exit(0)}l();async function Tt(){await kt(),await Rt(),await Ot(),console.log("Logged out"),process.exit(0)}l();l();import{confirm as fr,input as hr}from"@inquirer/prompts";async function Ye(t={}){let e=D();try{let s=t.name;s||(s=await hr({message:"Enter project name:",validate:o=>o.length>0||"Project name is required"})),e.start(`\u{1F680} Creating project "${s}" with Smart Wallets...`);let a=await k(x.api.console.projects.index,N.POST,{name:s,walletType:"smart_wallet",storageProvider:"ipfs",projectThumbnail:""}),r=JSON.parse(a);e.succeed(`\u2705 Project created successfully!
2
+ var Zs=(e,t)=>()=>(e&&(t=e(e=0)),t);var Hs=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);import Kr from"path";import{fileURLToPath as Hr}from"url";var l=Zs(()=>{"use strict"});var _t=Hs((ao,pr)=>{pr.exports={name:"@crossmint/cli",version:"1.1.13",description:"",keywords:[],repository:{type:"git",url:"https://github.com/Paella-Labs/crossbit-main"},license:"ISC",author:"",type:"module",main:"dist/bin/crossmint.js",bin:{crossmint:"dist/bin/crossmint.js"},scripts:{build:"tsup --env.NODE_ENV production","build:pkg":"NODE_ENV=production node ./build-pkg.js",dev:"tsup --watch --env.NODE_ENV development",start:"pnpm build && node dist/bin/crossmint.js","test:vitest":"vitest run","test:vitest:watch":"vitest"},dependencies:{"@crossmint/common-consts":"workspace:*","@crossmint/common-string-utils":"workspace:*","@crossmint/common-types":"workspace:*","@crossmint/data-dbs-types":"workspace:*","@crossmint/products-console-types":"workspace:*","@inquirer/prompts":"7.4.0",chalk:"4.1.2",commander:"12.0.0",keytar:"7.9.0",nanospinner:"1.2.2",open:"9.1.0"},devDependencies:{"@crossmint/tsconfig":"workspace:*","@crossmint/tsupconfig":"workspace:*","@crossmint/vitestconfig":"workspace:*","@types/node":"20.14.8","@yao-pkg/pkg":"6.5.1",esbuild:"0.25.2",vitest:"2.1.9"},pkg:{scripts:"dist/bin/crossmint.js",assets:[],targets:["node20-macos-arm64","node20-linux-x64","node20-macos-x64"],outputPath:"build"}}});l();import{program as _e}from"commander";l();l();var zs={production:"https://www.crossmint.com",staging:"https://staging.crossmint.com",local:"http://localhost:3000"};function re(e){return zs[e]}l();l();import dt from"keytar";var pt="crossmint-cli";async function Ee(e,t){return dt.setPassword(pt,e,t)}async function Te(e){return dt.getPassword(pt,e)}async function $e(e){return dt.deletePassword(pt,e)}function Nt(e){return Ee("environment",e)}async function M(){return Te("environment")}async function jt(){return $e("environment")}function kt(e){return Ee("sessionToken",e)}async function Ot(){return Te("sessionToken")}async function Lt(){return $e("sessionToken")}function Ne(e){return Ee("projectId",e)}async function F(){return Te("projectId")}async function $t(){return $e("projectId")}import{select as yr}from"@inquirer/prompts";l();l();l();l();l();l();var Gs=Object.defineProperty;var Q=(e,t)=>Gs(e,"name",{value:t,configurable:!0});l();function De(e){return Object.values(e)}Q(De,"objectValues");function Dt(e){return Object.keys(e)}Q(Dt,"objectKeys");function Mt(e){return Object.entries(e)}Q(Mt,"objectEntries");l();var I;(function(e){e.assertEqual=r=>r;function t(r){}e.assertIs=t;function s(r){throw new Error}e.assertNever=s,e.arrayToEnum=r=>{let n={};for(let o of r)n[o]=o;return n},e.getValidEnumValues=r=>{let n=e.objectKeys(r).filter(i=>typeof r[r[i]]!="number"),o={};for(let i of n)o[i]=r[i];return e.objectValues(o)},e.objectValues=r=>e.objectKeys(r).map(function(n){return r[n]}),e.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{let n=[];for(let o in r)Object.prototype.hasOwnProperty.call(r,o)&&n.push(o);return n},e.find=(r,n)=>{for(let o of r)if(n(o))return o},e.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&isFinite(r)&&Math.floor(r)===r;function a(r,n=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(n)}e.joinValues=a,e.jsonStringifyReplacer=(r,n)=>typeof n=="bigint"?n.toString():n})(I||(I={}));var mt;(function(e){e.mergeShapes=(t,s)=>({...t,...s})})(mt||(mt={}));var m=I.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),X=e=>{switch(typeof e){case"undefined":return m.undefined;case"string":return m.string;case"number":return isNaN(e)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(e)?m.array:e===null?m.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?m.promise:typeof Map<"u"&&e instanceof Map?m.map:typeof Set<"u"&&e instanceof Set?m.set:typeof Date<"u"&&e instanceof Date?m.date:m.object;default:return m.unknown}},p=I.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"]),Ys=e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),U=class extends Error{constructor(t){super(),this.issues=[],this.addIssue=a=>{this.issues=[...this.issues,a]},this.addIssues=(a=[])=>{this.issues=[...this.issues,...a]};let s=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,s):this.__proto__=s,this.name="ZodError",this.issues=t}get errors(){return this.issues}format(t){let s=t||function(n){return n.message},a={_errors:[]},r=n=>{for(let o of n.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)a._errors.push(s(o));else{let i=a,d=0;for(;d<o.path.length;){let u=o.path[d];d===o.path.length-1?(i[u]=i[u]||{_errors:[]},i[u]._errors.push(s(o))):i[u]=i[u]||{_errors:[]},i=i[u],d++}}};return r(this),a}toString(){return this.message}get message(){return JSON.stringify(this.issues,I.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=s=>s.message){let s={},a=[];for(let r of this.issues)r.path.length>0?(s[r.path[0]]=s[r.path[0]]||[],s[r.path[0]].push(t(r))):a.push(t(r));return{formErrors:a,fieldErrors:s}}get formErrors(){return this.flatten()}};U.create=e=>new U(e);var je=(e,t)=>{let s;switch(e.code){case p.invalid_type:e.received===m.undefined?s="Required":s=`Expected ${e.expected}, received ${e.received}`;break;case p.invalid_literal:s=`Invalid literal value, expected ${JSON.stringify(e.expected,I.jsonStringifyReplacer)}`;break;case p.unrecognized_keys:s=`Unrecognized key(s) in object: ${I.joinValues(e.keys,", ")}`;break;case p.invalid_union:s="Invalid input";break;case p.invalid_union_discriminator:s=`Invalid discriminator value. Expected ${I.joinValues(e.options)}`;break;case p.invalid_enum_value:s=`Invalid enum value. Expected ${I.joinValues(e.options)}, received '${e.received}'`;break;case p.invalid_arguments:s="Invalid function arguments";break;case p.invalid_return_type:s="Invalid function return type";break;case p.invalid_date:s="Invalid date";break;case p.invalid_string:typeof e.validation=="object"?"includes"in e.validation?(s=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(s=`${s} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?s=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?s=`Invalid input: must end with "${e.validation.endsWith}"`:I.assertNever(e.validation):e.validation!=="regex"?s=`Invalid ${e.validation}`:s="Invalid";break;case p.too_small:e.type==="array"?s=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?s=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?s=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?s=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:s="Invalid input";break;case p.too_big:e.type==="array"?s=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?s=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?s=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?s=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?s=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:s="Invalid input";break;case p.custom:s="Invalid input";break;case p.invalid_intersection_types:s="Intersection results could not be merged";break;case p.not_multiple_of:s=`Number must be a multiple of ${e.multipleOf}`;break;case p.not_finite:s="Number must be finite";break;default:s=t.defaultError,I.assertNever(e)}return{message:s}},Ft=je;function qs(e){Ft=e}function Ue(){return Ft}var Ve=e=>{let{data:t,path:s,errorMaps:a,issueData:r}=e,n=[...s,...r.path||[]],o={...r,path:n},i="",d=a.filter(u=>!!u).slice().reverse();for(let u of d)i=u(o,{data:t,defaultError:i}).message;return{...r,path:n,message:r.message||i}},Js=[];function f(e,t){let s=Ve({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,Ue(),je].filter(a=>!!a)});e.common.issues.push(s)}var O=class e{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,s){let a=[];for(let r of s){if(r.status==="aborted")return E;r.status==="dirty"&&t.dirty(),a.push(r.value)}return{status:t.value,value:a}}static async mergeObjectAsync(t,s){let a=[];for(let r of s)a.push({key:await r.key,value:await r.value});return e.mergeObjectSync(t,a)}static mergeObjectSync(t,s){let a={};for(let r of s){let{key:n,value:o}=r;if(n.status==="aborted"||o.status==="aborted")return E;n.status==="dirty"&&t.dirty(),o.status==="dirty"&&t.dirty(),n.value!=="__proto__"&&(typeof o.value<"u"||r.alwaysSet)&&(a[n.value]=o.value)}return{status:t.value,value:a}}},E=Object.freeze({status:"aborted"}),Bt=e=>({status:"dirty",value:e}),L=e=>({status:"valid",value:e}),ft=e=>e.status==="aborted",ht=e=>e.status==="dirty",ke=e=>e.status==="valid",Fe=e=>typeof Promise<"u"&&e instanceof Promise,y;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t?.message})(y||(y={}));var B=class{constructor(t,s,a,r){this._cachedPath=[],this.parent=t,this.data=s,this._path=a,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Ut=(e,t)=>{if(ke(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let s=new U(e.common.issues);return this._error=s,this._error}}};function T(e){if(!e)return{};let{errorMap:t,invalid_type_error:s,required_error:a,description:r}=e;if(t&&(s||a))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:r}:{errorMap:(o,i)=>o.code!=="invalid_type"?{message:i.defaultError}:typeof i.data>"u"?{message:a??i.defaultError}:{message:s??i.defaultError},description:r}}var S=class{constructor(t){this.spa=this.safeParseAsync,this._def=t,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)}get description(){return this._def.description}_getType(t){return X(t.data)}_getOrReturnCtx(t,s){return s||{common:t.parent.common,data:t.data,parsedType:X(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new O,ctx:{common:t.parent.common,data:t.data,parsedType:X(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){let s=this._parse(t);if(Fe(s))throw new Error("Synchronous parse encountered promise.");return s}_parseAsync(t){let s=this._parse(t);return Promise.resolve(s)}parse(t,s){let a=this.safeParse(t,s);if(a.success)return a.data;throw a.error}safeParse(t,s){var a;let r={common:{issues:[],async:(a=s?.async)!==null&&a!==void 0?a:!1,contextualErrorMap:s?.errorMap},path:s?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:X(t)},n=this._parseSync({data:t,path:r.path,parent:r});return Ut(r,n)}async parseAsync(t,s){let a=await this.safeParseAsync(t,s);if(a.success)return a.data;throw a.error}async safeParseAsync(t,s){let a={common:{issues:[],contextualErrorMap:s?.errorMap,async:!0},path:s?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:X(t)},r=this._parse({data:t,path:a.path,parent:a}),n=await(Fe(r)?r:Promise.resolve(r));return Ut(a,n)}refine(t,s){let a=r=>typeof s=="string"||typeof s>"u"?{message:s}:typeof s=="function"?s(r):s;return this._refinement((r,n)=>{let o=t(r),i=()=>n.addIssue({code:p.custom,...a(r)});return typeof Promise<"u"&&o instanceof Promise?o.then(d=>d?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(t,s){return this._refinement((a,r)=>t(a)?!0:(r.addIssue(typeof s=="function"?s(a,r):s),!1))}_refinement(t){return new V({schema:this,typeName:v.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}optional(){return W.create(this,this._def)}nullable(){return q.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Y.create(this,this._def)}promise(){return se.create(this,this._def)}or(t){return pe.create([this,t],this._def)}and(t){return ue.create(this,t,this._def)}transform(t){return new V({...T(this._def),schema:this,typeName:v.ZodEffects,effect:{type:"transform",transform:t}})}default(t){let s=typeof t=="function"?t:()=>t;return new ye({...T(this._def),innerType:this,defaultValue:s,typeName:v.ZodDefault})}brand(){return new Ze({typeName:v.ZodBranded,type:this,...T(this._def)})}catch(t){let s=typeof t=="function"?t:()=>t;return new Pe({...T(this._def),innerType:this,catchValue:s,typeName:v.ZodCatch})}describe(t){let s=this.constructor;return new s({...this._def,description:t})}pipe(t){return Oe.create(this,t)}readonly(){return we.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Qs=/^c[^\s-]{8,}$/i,Xs=/^[a-z][a-z0-9]*$/,ea=/^[0-9A-HJKMNP-TV-Z]{26}$/,ta=/^[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,sa=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,aa="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",ut,ra=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,na=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,oa=e=>e.precision?e.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):e.precision===0?e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function ia(e,t){return!!((t==="v4"||!t)&&ra.test(e)||(t==="v6"||!t)&&na.test(e))}var ee=class e extends S{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==m.string){let n=this._getOrReturnCtx(t);return f(n,{code:p.invalid_type,expected:m.string,received:n.parsedType}),E}let a=new O,r;for(let n of this._def.checks)if(n.kind==="min")t.data.length<n.value&&(r=this._getOrReturnCtx(t,r),f(r,{code:p.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),a.dirty());else if(n.kind==="max")t.data.length>n.value&&(r=this._getOrReturnCtx(t,r),f(r,{code:p.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),a.dirty());else if(n.kind==="length"){let o=t.data.length>n.value,i=t.data.length<n.value;(o||i)&&(r=this._getOrReturnCtx(t,r),o?f(r,{code:p.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):i&&f(r,{code:p.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),a.dirty())}else if(n.kind==="email")sa.test(t.data)||(r=this._getOrReturnCtx(t,r),f(r,{validation:"email",code:p.invalid_string,message:n.message}),a.dirty());else if(n.kind==="emoji")ut||(ut=new RegExp(aa,"u")),ut.test(t.data)||(r=this._getOrReturnCtx(t,r),f(r,{validation:"emoji",code:p.invalid_string,message:n.message}),a.dirty());else if(n.kind==="uuid")ta.test(t.data)||(r=this._getOrReturnCtx(t,r),f(r,{validation:"uuid",code:p.invalid_string,message:n.message}),a.dirty());else if(n.kind==="cuid")Qs.test(t.data)||(r=this._getOrReturnCtx(t,r),f(r,{validation:"cuid",code:p.invalid_string,message:n.message}),a.dirty());else if(n.kind==="cuid2")Xs.test(t.data)||(r=this._getOrReturnCtx(t,r),f(r,{validation:"cuid2",code:p.invalid_string,message:n.message}),a.dirty());else if(n.kind==="ulid")ea.test(t.data)||(r=this._getOrReturnCtx(t,r),f(r,{validation:"ulid",code:p.invalid_string,message:n.message}),a.dirty());else if(n.kind==="url")try{new URL(t.data)}catch{r=this._getOrReturnCtx(t,r),f(r,{validation:"url",code:p.invalid_string,message:n.message}),a.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(t.data)||(r=this._getOrReturnCtx(t,r),f(r,{validation:"regex",code:p.invalid_string,message:n.message}),a.dirty())):n.kind==="trim"?t.data=t.data.trim():n.kind==="includes"?t.data.includes(n.value,n.position)||(r=this._getOrReturnCtx(t,r),f(r,{code:p.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),a.dirty()):n.kind==="toLowerCase"?t.data=t.data.toLowerCase():n.kind==="toUpperCase"?t.data=t.data.toUpperCase():n.kind==="startsWith"?t.data.startsWith(n.value)||(r=this._getOrReturnCtx(t,r),f(r,{code:p.invalid_string,validation:{startsWith:n.value},message:n.message}),a.dirty()):n.kind==="endsWith"?t.data.endsWith(n.value)||(r=this._getOrReturnCtx(t,r),f(r,{code:p.invalid_string,validation:{endsWith:n.value},message:n.message}),a.dirty()):n.kind==="datetime"?oa(n).test(t.data)||(r=this._getOrReturnCtx(t,r),f(r,{code:p.invalid_string,validation:"datetime",message:n.message}),a.dirty()):n.kind==="ip"?ia(t.data,n.version)||(r=this._getOrReturnCtx(t,r),f(r,{validation:"ip",code:p.invalid_string,message:n.message}),a.dirty()):I.assertNever(n);return{status:a.value,value:t.data}}_regex(t,s,a){return this.refinement(r=>t.test(r),{validation:s,code:p.invalid_string,...y.errToObj(a)})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...y.errToObj(t)})}url(t){return this._addCheck({kind:"url",...y.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...y.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...y.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...y.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...y.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...y.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...y.errToObj(t)})}datetime(t){var s;return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof t?.precision>"u"?null:t?.precision,offset:(s=t?.offset)!==null&&s!==void 0?s:!1,...y.errToObj(t?.message)})}regex(t,s){return this._addCheck({kind:"regex",regex:t,...y.errToObj(s)})}includes(t,s){return this._addCheck({kind:"includes",value:t,position:s?.position,...y.errToObj(s?.message)})}startsWith(t,s){return this._addCheck({kind:"startsWith",value:t,...y.errToObj(s)})}endsWith(t,s){return this._addCheck({kind:"endsWith",value:t,...y.errToObj(s)})}min(t,s){return this._addCheck({kind:"min",value:t,...y.errToObj(s)})}max(t,s){return this._addCheck({kind:"max",value:t,...y.errToObj(s)})}length(t,s){return this._addCheck({kind:"length",value:t,...y.errToObj(s)})}nonempty(t){return this.min(1,y.errToObj(t))}trim(){return new e({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new e({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get minLength(){let t=null;for(let s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t}get maxLength(){let t=null;for(let s of this._def.checks)s.kind==="max"&&(t===null||s.value<t)&&(t=s.value);return t}};ee.create=e=>{var t;return new ee({checks:[],typeName:v.ZodString,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...T(e)})};function ca(e,t){let s=(e.toString().split(".")[1]||"").length,a=(t.toString().split(".")[1]||"").length,r=s>a?s:a,n=parseInt(e.toFixed(r).replace(".","")),o=parseInt(t.toFixed(r).replace(".",""));return n%o/Math.pow(10,r)}var ne=class e extends S{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==m.number){let n=this._getOrReturnCtx(t);return f(n,{code:p.invalid_type,expected:m.number,received:n.parsedType}),E}let a,r=new O;for(let n of this._def.checks)n.kind==="int"?I.isInteger(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{code:p.invalid_type,expected:"integer",received:"float",message:n.message}),r.dirty()):n.kind==="min"?(n.inclusive?t.data<n.value:t.data<=n.value)&&(a=this._getOrReturnCtx(t,a),f(a,{code:p.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="max"?(n.inclusive?t.data>n.value:t.data>=n.value)&&(a=this._getOrReturnCtx(t,a),f(a,{code:p.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),r.dirty()):n.kind==="multipleOf"?ca(t.data,n.value)!==0&&(a=this._getOrReturnCtx(t,a),f(a,{code:p.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):n.kind==="finite"?Number.isFinite(t.data)||(a=this._getOrReturnCtx(t,a),f(a,{code:p.not_finite,message:n.message}),r.dirty()):I.assertNever(n);return{status:r.value,value:t.data}}gte(t,s){return this.setLimit("min",t,!0,y.toString(s))}gt(t,s){return this.setLimit("min",t,!1,y.toString(s))}lte(t,s){return this.setLimit("max",t,!0,y.toString(s))}lt(t,s){return this.setLimit("max",t,!1,y.toString(s))}setLimit(t,s,a,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:s,inclusive:a,message:y.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:y.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:y.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:y.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:y.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:y.toString(t)})}multipleOf(t,s){return this._addCheck({kind:"multipleOf",value:t,message:y.toString(s)})}finite(t){return this._addCheck({kind:"finite",message:y.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:y.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:y.toString(t)})}get minValue(){let t=null;for(let s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t}get maxValue(){let t=null;for(let s of this._def.checks)s.kind==="max"&&(t===null||s.value<t)&&(t=s.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&I.isInteger(t.value))}get isFinite(){let t=null,s=null;for(let a of this._def.checks){if(a.kind==="finite"||a.kind==="int"||a.kind==="multipleOf")return!0;a.kind==="min"?(s===null||a.value>s)&&(s=a.value):a.kind==="max"&&(t===null||a.value<t)&&(t=a.value)}return Number.isFinite(s)&&Number.isFinite(t)}};ne.create=e=>new ne({checks:[],typeName:v.ZodNumber,coerce:e?.coerce||!1,...T(e)});var oe=class e extends S{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce&&(t.data=BigInt(t.data)),this._getType(t)!==m.bigint){let n=this._getOrReturnCtx(t);return f(n,{code:p.invalid_type,expected:m.bigint,received:n.parsedType}),E}let a,r=new O;for(let n of this._def.checks)n.kind==="min"?(n.inclusive?t.data<n.value:t.data<=n.value)&&(a=this._getOrReturnCtx(t,a),f(a,{code:p.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="max"?(n.inclusive?t.data>n.value:t.data>=n.value)&&(a=this._getOrReturnCtx(t,a),f(a,{code:p.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),r.dirty()):n.kind==="multipleOf"?t.data%n.value!==BigInt(0)&&(a=this._getOrReturnCtx(t,a),f(a,{code:p.not_multiple_of,multipleOf:n.value,message:n.message}),r.dirty()):I.assertNever(n);return{status:r.value,value:t.data}}gte(t,s){return this.setLimit("min",t,!0,y.toString(s))}gt(t,s){return this.setLimit("min",t,!1,y.toString(s))}lte(t,s){return this.setLimit("max",t,!0,y.toString(s))}lt(t,s){return this.setLimit("max",t,!1,y.toString(s))}setLimit(t,s,a,r){return new e({...this._def,checks:[...this._def.checks,{kind:t,value:s,inclusive:a,message:y.toString(r)}]})}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:y.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:y.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:y.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:y.toString(t)})}multipleOf(t,s){return this._addCheck({kind:"multipleOf",value:t,message:y.toString(s)})}get minValue(){let t=null;for(let s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t}get maxValue(){let t=null;for(let s of this._def.checks)s.kind==="max"&&(t===null||s.value<t)&&(t=s.value);return t}};oe.create=e=>{var t;return new oe({checks:[],typeName:v.ZodBigInt,coerce:(t=e?.coerce)!==null&&t!==void 0?t:!1,...T(e)})};var ie=class extends S{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==m.boolean){let a=this._getOrReturnCtx(t);return f(a,{code:p.invalid_type,expected:m.boolean,received:a.parsedType}),E}return L(t.data)}};ie.create=e=>new ie({typeName:v.ZodBoolean,coerce:e?.coerce||!1,...T(e)});var ce=class e extends S{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==m.date){let n=this._getOrReturnCtx(t);return f(n,{code:p.invalid_type,expected:m.date,received:n.parsedType}),E}if(isNaN(t.data.getTime())){let n=this._getOrReturnCtx(t);return f(n,{code:p.invalid_date}),E}let a=new O,r;for(let n of this._def.checks)n.kind==="min"?t.data.getTime()<n.value&&(r=this._getOrReturnCtx(t,r),f(r,{code:p.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),a.dirty()):n.kind==="max"?t.data.getTime()>n.value&&(r=this._getOrReturnCtx(t,r),f(r,{code:p.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),a.dirty()):I.assertNever(n);return{status:a.value,value:new Date(t.data.getTime())}}_addCheck(t){return new e({...this._def,checks:[...this._def.checks,t]})}min(t,s){return this._addCheck({kind:"min",value:t.getTime(),message:y.toString(s)})}max(t,s){return this._addCheck({kind:"max",value:t.getTime(),message:y.toString(s)})}get minDate(){let t=null;for(let s of this._def.checks)s.kind==="min"&&(t===null||s.value>t)&&(t=s.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(let s of this._def.checks)s.kind==="max"&&(t===null||s.value<t)&&(t=s.value);return t!=null?new Date(t):null}};ce.create=e=>new ce({checks:[],coerce:e?.coerce||!1,typeName:v.ZodDate,...T(e)});var Ce=class extends S{_parse(t){if(this._getType(t)!==m.symbol){let a=this._getOrReturnCtx(t);return f(a,{code:p.invalid_type,expected:m.symbol,received:a.parsedType}),E}return L(t.data)}};Ce.create=e=>new Ce({typeName:v.ZodSymbol,...T(e)});var le=class extends S{_parse(t){if(this._getType(t)!==m.undefined){let a=this._getOrReturnCtx(t);return f(a,{code:p.invalid_type,expected:m.undefined,received:a.parsedType}),E}return L(t.data)}};le.create=e=>new le({typeName:v.ZodUndefined,...T(e)});var de=class extends S{_parse(t){if(this._getType(t)!==m.null){let a=this._getOrReturnCtx(t);return f(a,{code:p.invalid_type,expected:m.null,received:a.parsedType}),E}return L(t.data)}};de.create=e=>new de({typeName:v.ZodNull,...T(e)});var te=class extends S{constructor(){super(...arguments),this._any=!0}_parse(t){return L(t.data)}};te.create=e=>new te({typeName:v.ZodAny,...T(e)});var G=class extends S{constructor(){super(...arguments),this._unknown=!0}_parse(t){return L(t.data)}};G.create=e=>new G({typeName:v.ZodUnknown,...T(e)});var K=class extends S{_parse(t){let s=this._getOrReturnCtx(t);return f(s,{code:p.invalid_type,expected:m.never,received:s.parsedType}),E}};K.create=e=>new K({typeName:v.ZodNever,...T(e)});var be=class extends S{_parse(t){if(this._getType(t)!==m.undefined){let a=this._getOrReturnCtx(t);return f(a,{code:p.invalid_type,expected:m.void,received:a.parsedType}),E}return L(t.data)}};be.create=e=>new be({typeName:v.ZodVoid,...T(e)});var Y=class e extends S{_parse(t){let{ctx:s,status:a}=this._processInputParams(t),r=this._def;if(s.parsedType!==m.array)return f(s,{code:p.invalid_type,expected:m.array,received:s.parsedType}),E;if(r.exactLength!==null){let o=s.data.length>r.exactLength.value,i=s.data.length<r.exactLength.value;(o||i)&&(f(s,{code:o?p.too_big:p.too_small,minimum:i?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),a.dirty())}if(r.minLength!==null&&s.data.length<r.minLength.value&&(f(s,{code:p.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),a.dirty()),r.maxLength!==null&&s.data.length>r.maxLength.value&&(f(s,{code:p.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),a.dirty()),s.common.async)return Promise.all([...s.data].map((o,i)=>r.type._parseAsync(new B(s,o,s.path,i)))).then(o=>O.mergeArray(a,o));let n=[...s.data].map((o,i)=>r.type._parseSync(new B(s,o,s.path,i)));return O.mergeArray(a,n)}get element(){return this._def.type}min(t,s){return new e({...this._def,minLength:{value:t,message:y.toString(s)}})}max(t,s){return new e({...this._def,maxLength:{value:t,message:y.toString(s)}})}length(t,s){return new e({...this._def,exactLength:{value:t,message:y.toString(s)}})}nonempty(t){return this.min(1,t)}};Y.create=(e,t)=>new Y({type:e,minLength:null,maxLength:null,exactLength:null,typeName:v.ZodArray,...T(t)});function Se(e){if(e instanceof $){let t={};for(let s in e.shape){let a=e.shape[s];t[s]=W.create(Se(a))}return new $({...e._def,shape:()=>t})}else return e instanceof Y?new Y({...e._def,type:Se(e.element)}):e instanceof W?W.create(Se(e.unwrap())):e instanceof q?q.create(Se(e.unwrap())):e instanceof Z?Z.create(e.items.map(t=>Se(t))):e}var $=class e extends S{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let t=this._def.shape(),s=I.objectKeys(t);return this._cached={shape:t,keys:s}}_parse(t){if(this._getType(t)!==m.object){let u=this._getOrReturnCtx(t);return f(u,{code:p.invalid_type,expected:m.object,received:u.parsedType}),E}let{status:a,ctx:r}=this._processInputParams(t),{shape:n,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof K&&this._def.unknownKeys==="strip"))for(let u in r.data)o.includes(u)||i.push(u);let d=[];for(let u of o){let g=n[u],b=r.data[u];d.push({key:{status:"valid",value:u},value:g._parse(new B(r,b,r.path,u)),alwaysSet:u in r.data})}if(this._def.catchall instanceof K){let u=this._def.unknownKeys;if(u==="passthrough")for(let g of i)d.push({key:{status:"valid",value:g},value:{status:"valid",value:r.data[g]}});else if(u==="strict")i.length>0&&(f(r,{code:p.unrecognized_keys,keys:i}),a.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let u=this._def.catchall;for(let g of i){let b=r.data[g];d.push({key:{status:"valid",value:g},value:u._parse(new B(r,b,r.path,g)),alwaysSet:g in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let u=[];for(let g of d){let b=await g.key;u.push({key:b,value:await g.value,alwaysSet:g.alwaysSet})}return u}).then(u=>O.mergeObjectSync(a,u)):O.mergeObjectSync(a,d)}get shape(){return this._def.shape()}strict(t){return y.errToObj,new e({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(s,a)=>{var r,n,o,i;let d=(o=(n=(r=this._def).errorMap)===null||n===void 0?void 0:n.call(r,s,a).message)!==null&&o!==void 0?o:a.defaultError;return s.code==="unrecognized_keys"?{message:(i=y.errToObj(t).message)!==null&&i!==void 0?i:d}:{message:d}}}:{}})}strip(){return new e({...this._def,unknownKeys:"strip"})}passthrough(){return new e({...this._def,unknownKeys:"passthrough"})}extend(t){return new e({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new e({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:v.ZodObject})}setKey(t,s){return this.augment({[t]:s})}catchall(t){return new e({...this._def,catchall:t})}pick(t){let s={};return I.objectKeys(t).forEach(a=>{t[a]&&this.shape[a]&&(s[a]=this.shape[a])}),new e({...this._def,shape:()=>s})}omit(t){let s={};return I.objectKeys(this.shape).forEach(a=>{t[a]||(s[a]=this.shape[a])}),new e({...this._def,shape:()=>s})}deepPartial(){return Se(this)}partial(t){let s={};return I.objectKeys(this.shape).forEach(a=>{let r=this.shape[a];t&&!t[a]?s[a]=r:s[a]=r.optional()}),new e({...this._def,shape:()=>s})}required(t){let s={};return I.objectKeys(this.shape).forEach(a=>{if(t&&!t[a])s[a]=this.shape[a];else{let n=this.shape[a];for(;n instanceof W;)n=n._def.innerType;s[a]=n}}),new e({...this._def,shape:()=>s})}keyof(){return Wt(I.objectKeys(this.shape))}};$.create=(e,t)=>new $({shape:()=>e,unknownKeys:"strip",catchall:K.create(),typeName:v.ZodObject,...T(t)});$.strictCreate=(e,t)=>new $({shape:()=>e,unknownKeys:"strict",catchall:K.create(),typeName:v.ZodObject,...T(t)});$.lazycreate=(e,t)=>new $({shape:e,unknownKeys:"strip",catchall:K.create(),typeName:v.ZodObject,...T(t)});var pe=class extends S{_parse(t){let{ctx:s}=this._processInputParams(t),a=this._def.options;function r(n){for(let i of n)if(i.result.status==="valid")return i.result;for(let i of n)if(i.result.status==="dirty")return s.common.issues.push(...i.ctx.common.issues),i.result;let o=n.map(i=>new U(i.ctx.common.issues));return f(s,{code:p.invalid_union,unionErrors:o}),E}if(s.common.async)return Promise.all(a.map(async n=>{let o={...s,common:{...s.common,issues:[]},parent:null};return{result:await n._parseAsync({data:s.data,path:s.path,parent:o}),ctx:o}})).then(r);{let n,o=[];for(let d of a){let u={...s,common:{...s.common,issues:[]},parent:null},g=d._parseSync({data:s.data,path:s.path,parent:u});if(g.status==="valid")return g;g.status==="dirty"&&!n&&(n={result:g,ctx:u}),u.common.issues.length&&o.push(u.common.issues)}if(n)return s.common.issues.push(...n.ctx.common.issues),n.result;let i=o.map(d=>new U(d));return f(s,{code:p.invalid_union,unionErrors:i}),E}}get options(){return this._def.options}};pe.create=(e,t)=>new pe({options:e,typeName:v.ZodUnion,...T(t)});var Me=e=>e instanceof me?Me(e.schema):e instanceof V?Me(e.innerType()):e instanceof fe?[e.value]:e instanceof he?e.options:e instanceof ge?Object.keys(e.enum):e instanceof ye?Me(e._def.innerType):e instanceof le?[void 0]:e instanceof de?[null]:null,Be=class e extends S{_parse(t){let{ctx:s}=this._processInputParams(t);if(s.parsedType!==m.object)return f(s,{code:p.invalid_type,expected:m.object,received:s.parsedType}),E;let a=this.discriminator,r=s.data[a],n=this.optionsMap.get(r);return n?s.common.async?n._parseAsync({data:s.data,path:s.path,parent:s}):n._parseSync({data:s.data,path:s.path,parent:s}):(f(s,{code:p.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[a]}),E)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(t,s,a){let r=new Map;for(let n of s){let o=Me(n.shape[t]);if(!o)throw new Error(`A discriminator value for key \`${t}\` could not be extracted from all schema options`);for(let i of o){if(r.has(i))throw new Error(`Discriminator property ${String(t)} has duplicate value ${String(i)}`);r.set(i,n)}}return new e({typeName:v.ZodDiscriminatedUnion,discriminator:t,options:s,optionsMap:r,...T(a)})}};function gt(e,t){let s=X(e),a=X(t);if(e===t)return{valid:!0,data:e};if(s===m.object&&a===m.object){let r=I.objectKeys(t),n=I.objectKeys(e).filter(i=>r.indexOf(i)!==-1),o={...e,...t};for(let i of n){let d=gt(e[i],t[i]);if(!d.valid)return{valid:!1};o[i]=d.data}return{valid:!0,data:o}}else if(s===m.array&&a===m.array){if(e.length!==t.length)return{valid:!1};let r=[];for(let n=0;n<e.length;n++){let o=e[n],i=t[n],d=gt(o,i);if(!d.valid)return{valid:!1};r.push(d.data)}return{valid:!0,data:r}}else return s===m.date&&a===m.date&&+e==+t?{valid:!0,data:e}:{valid:!1}}var ue=class extends S{_parse(t){let{status:s,ctx:a}=this._processInputParams(t),r=(n,o)=>{if(ft(n)||ft(o))return E;let i=gt(n.value,o.value);return i.valid?((ht(n)||ht(o))&&s.dirty(),{status:s.value,value:i.data}):(f(a,{code:p.invalid_intersection_types}),E)};return a.common.async?Promise.all([this._def.left._parseAsync({data:a.data,path:a.path,parent:a}),this._def.right._parseAsync({data:a.data,path:a.path,parent:a})]).then(([n,o])=>r(n,o)):r(this._def.left._parseSync({data:a.data,path:a.path,parent:a}),this._def.right._parseSync({data:a.data,path:a.path,parent:a}))}};ue.create=(e,t,s)=>new ue({left:e,right:t,typeName:v.ZodIntersection,...T(s)});var Z=class e extends S{_parse(t){let{status:s,ctx:a}=this._processInputParams(t);if(a.parsedType!==m.array)return f(a,{code:p.invalid_type,expected:m.array,received:a.parsedType}),E;if(a.data.length<this._def.items.length)return f(a,{code:p.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),E;!this._def.rest&&a.data.length>this._def.items.length&&(f(a,{code:p.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),s.dirty());let n=[...a.data].map((o,i)=>{let d=this._def.items[i]||this._def.rest;return d?d._parse(new B(a,o,a.path,i)):null}).filter(o=>!!o);return a.common.async?Promise.all(n).then(o=>O.mergeArray(s,o)):O.mergeArray(s,n)}get items(){return this._def.items}rest(t){return new e({...this._def,rest:t})}};Z.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Z({items:e,typeName:v.ZodTuple,rest:null,...T(t)})};var We=class e extends S{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:s,ctx:a}=this._processInputParams(t);if(a.parsedType!==m.object)return f(a,{code:p.invalid_type,expected:m.object,received:a.parsedType}),E;let r=[],n=this._def.keyType,o=this._def.valueType;for(let i in a.data)r.push({key:n._parse(new B(a,i,a.path,i)),value:o._parse(new B(a,a.data[i],a.path,i))});return a.common.async?O.mergeObjectAsync(s,r):O.mergeObjectSync(s,r)}get element(){return this._def.valueType}static create(t,s,a){return s instanceof S?new e({keyType:t,valueType:s,typeName:v.ZodRecord,...T(a)}):new e({keyType:ee.create(),valueType:t,typeName:v.ZodRecord,...T(s)})}},Ie=class extends S{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){let{status:s,ctx:a}=this._processInputParams(t);if(a.parsedType!==m.map)return f(a,{code:p.invalid_type,expected:m.map,received:a.parsedType}),E;let r=this._def.keyType,n=this._def.valueType,o=[...a.data.entries()].map(([i,d],u)=>({key:r._parse(new B(a,i,a.path,[u,"key"])),value:n._parse(new B(a,d,a.path,[u,"value"]))}));if(a.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let d of o){let u=await d.key,g=await d.value;if(u.status==="aborted"||g.status==="aborted")return E;(u.status==="dirty"||g.status==="dirty")&&s.dirty(),i.set(u.value,g.value)}return{status:s.value,value:i}})}else{let i=new Map;for(let d of o){let u=d.key,g=d.value;if(u.status==="aborted"||g.status==="aborted")return E;(u.status==="dirty"||g.status==="dirty")&&s.dirty(),i.set(u.value,g.value)}return{status:s.value,value:i}}}};Ie.create=(e,t,s)=>new Ie({valueType:t,keyType:e,typeName:v.ZodMap,...T(s)});var Ae=class e extends S{_parse(t){let{status:s,ctx:a}=this._processInputParams(t);if(a.parsedType!==m.set)return f(a,{code:p.invalid_type,expected:m.set,received:a.parsedType}),E;let r=this._def;r.minSize!==null&&a.data.size<r.minSize.value&&(f(a,{code:p.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),s.dirty()),r.maxSize!==null&&a.data.size>r.maxSize.value&&(f(a,{code:p.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),s.dirty());let n=this._def.valueType;function o(d){let u=new Set;for(let g of d){if(g.status==="aborted")return E;g.status==="dirty"&&s.dirty(),u.add(g.value)}return{status:s.value,value:u}}let i=[...a.data.values()].map((d,u)=>n._parse(new B(a,d,a.path,u)));return a.common.async?Promise.all(i).then(d=>o(d)):o(i)}min(t,s){return new e({...this._def,minSize:{value:t,message:y.toString(s)}})}max(t,s){return new e({...this._def,maxSize:{value:t,message:y.toString(s)}})}size(t,s){return this.min(t,s).max(t,s)}nonempty(t){return this.min(1,t)}};Ae.create=(e,t)=>new Ae({valueType:e,minSize:null,maxSize:null,typeName:v.ZodSet,...T(t)});var Ke=class e extends S{constructor(){super(...arguments),this.validate=this.implement}_parse(t){let{ctx:s}=this._processInputParams(t);if(s.parsedType!==m.function)return f(s,{code:p.invalid_type,expected:m.function,received:s.parsedType}),E;function a(i,d){return Ve({data:i,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,Ue(),je].filter(u=>!!u),issueData:{code:p.invalid_arguments,argumentsError:d}})}function r(i,d){return Ve({data:i,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,Ue(),je].filter(u=>!!u),issueData:{code:p.invalid_return_type,returnTypeError:d}})}let n={errorMap:s.common.contextualErrorMap},o=s.data;if(this._def.returns instanceof se){let i=this;return L(async function(...d){let u=new U([]),g=await i._def.args.parseAsync(d,n).catch(ve=>{throw u.addIssue(a(d,ve)),u}),b=await Reflect.apply(o,this,g);return await i._def.returns._def.type.parseAsync(b,n).catch(ve=>{throw u.addIssue(r(b,ve)),u})})}else{let i=this;return L(function(...d){let u=i._def.args.safeParse(d,n);if(!u.success)throw new U([a(d,u.error)]);let g=Reflect.apply(o,this,u.data),b=i._def.returns.safeParse(g,n);if(!b.success)throw new U([r(g,b.error)]);return b.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...t){return new e({...this._def,args:Z.create(t).rest(G.create())})}returns(t){return new e({...this._def,returns:t})}implement(t){return this.parse(t)}strictImplement(t){return this.parse(t)}static create(t,s,a){return new e({args:t||Z.create([]).rest(G.create()),returns:s||G.create(),typeName:v.ZodFunction,...T(a)})}},me=class extends S{get schema(){return this._def.getter()}_parse(t){let{ctx:s}=this._processInputParams(t);return this._def.getter()._parse({data:s.data,path:s.path,parent:s})}};me.create=(e,t)=>new me({getter:e,typeName:v.ZodLazy,...T(t)});var fe=class extends S{_parse(t){if(t.data!==this._def.value){let s=this._getOrReturnCtx(t);return f(s,{received:s.data,code:p.invalid_literal,expected:this._def.value}),E}return{status:"valid",value:t.data}}get value(){return this._def.value}};fe.create=(e,t)=>new fe({value:e,typeName:v.ZodLiteral,...T(t)});function Wt(e,t){return new he({values:e,typeName:v.ZodEnum,...T(t)})}var he=class e extends S{_parse(t){if(typeof t.data!="string"){let s=this._getOrReturnCtx(t),a=this._def.values;return f(s,{expected:I.joinValues(a),received:s.parsedType,code:p.invalid_type}),E}if(this._def.values.indexOf(t.data)===-1){let s=this._getOrReturnCtx(t),a=this._def.values;return f(s,{received:s.data,code:p.invalid_enum_value,options:a}),E}return L(t.data)}get options(){return this._def.values}get enum(){let t={};for(let s of this._def.values)t[s]=s;return t}get Values(){let t={};for(let s of this._def.values)t[s]=s;return t}get Enum(){let t={};for(let s of this._def.values)t[s]=s;return t}extract(t){return e.create(t)}exclude(t){return e.create(this.options.filter(s=>!t.includes(s)))}};he.create=Wt;var ge=class extends S{_parse(t){let s=I.getValidEnumValues(this._def.values),a=this._getOrReturnCtx(t);if(a.parsedType!==m.string&&a.parsedType!==m.number){let r=I.objectValues(s);return f(a,{expected:I.joinValues(r),received:a.parsedType,code:p.invalid_type}),E}if(s.indexOf(t.data)===-1){let r=I.objectValues(s);return f(a,{received:a.data,code:p.invalid_enum_value,options:r}),E}return L(t.data)}get enum(){return this._def.values}};ge.create=(e,t)=>new ge({values:e,typeName:v.ZodNativeEnum,...T(t)});var se=class extends S{unwrap(){return this._def.type}_parse(t){let{ctx:s}=this._processInputParams(t);if(s.parsedType!==m.promise&&s.common.async===!1)return f(s,{code:p.invalid_type,expected:m.promise,received:s.parsedType}),E;let a=s.parsedType===m.promise?s.data:Promise.resolve(s.data);return L(a.then(r=>this._def.type.parseAsync(r,{path:s.path,errorMap:s.common.contextualErrorMap})))}};se.create=(e,t)=>new se({type:e,typeName:v.ZodPromise,...T(t)});var V=class extends S{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===v.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){let{status:s,ctx:a}=this._processInputParams(t),r=this._def.effect||null,n={addIssue:o=>{f(a,o),o.fatal?s.abort():s.dirty()},get path(){return a.path}};if(n.addIssue=n.addIssue.bind(n),r.type==="preprocess"){let o=r.transform(a.data,n);return a.common.issues.length?{status:"dirty",value:a.data}:a.common.async?Promise.resolve(o).then(i=>this._def.schema._parseAsync({data:i,path:a.path,parent:a})):this._def.schema._parseSync({data:o,path:a.path,parent:a})}if(r.type==="refinement"){let o=i=>{let d=r.refinement(i,n);if(a.common.async)return Promise.resolve(d);if(d instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(a.common.async===!1){let i=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});return i.status==="aborted"?E:(i.status==="dirty"&&s.dirty(),o(i.value),{status:s.value,value:i.value})}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(i=>i.status==="aborted"?E:(i.status==="dirty"&&s.dirty(),o(i.value).then(()=>({status:s.value,value:i.value}))))}if(r.type==="transform")if(a.common.async===!1){let o=this._def.schema._parseSync({data:a.data,path:a.path,parent:a});if(!ke(o))return o;let i=r.transform(o.value,n);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:s.value,value:i}}else return this._def.schema._parseAsync({data:a.data,path:a.path,parent:a}).then(o=>ke(o)?Promise.resolve(r.transform(o.value,n)).then(i=>({status:s.value,value:i})):o);I.assertNever(r)}};V.create=(e,t,s)=>new V({schema:e,typeName:v.ZodEffects,effect:t,...T(s)});V.createWithPreprocess=(e,t,s)=>new V({schema:t,effect:{type:"preprocess",transform:e},typeName:v.ZodEffects,...T(s)});var W=class extends S{_parse(t){return this._getType(t)===m.undefined?L(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};W.create=(e,t)=>new W({innerType:e,typeName:v.ZodOptional,...T(t)});var q=class extends S{_parse(t){return this._getType(t)===m.null?L(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}};q.create=(e,t)=>new q({innerType:e,typeName:v.ZodNullable,...T(t)});var ye=class extends S{_parse(t){let{ctx:s}=this._processInputParams(t),a=s.data;return s.parsedType===m.undefined&&(a=this._def.defaultValue()),this._def.innerType._parse({data:a,path:s.path,parent:s})}removeDefault(){return this._def.innerType}};ye.create=(e,t)=>new ye({innerType:e,typeName:v.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...T(t)});var Pe=class extends S{_parse(t){let{ctx:s}=this._processInputParams(t),a={...s,common:{...s.common,issues:[]}},r=this._def.innerType._parse({data:a.data,path:a.path,parent:{...a}});return Fe(r)?r.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new U(a.common.issues)},input:a.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new U(a.common.issues)},input:a.data})}}removeCatch(){return this._def.innerType}};Pe.create=(e,t)=>new Pe({innerType:e,typeName:v.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...T(t)});var xe=class extends S{_parse(t){if(this._getType(t)!==m.nan){let a=this._getOrReturnCtx(t);return f(a,{code:p.invalid_type,expected:m.nan,received:a.parsedType}),E}return{status:"valid",value:t.data}}};xe.create=e=>new xe({typeName:v.ZodNaN,...T(e)});var la=Symbol("zod_brand"),Ze=class extends S{_parse(t){let{ctx:s}=this._processInputParams(t),a=s.data;return this._def.type._parse({data:a,path:s.path,parent:s})}unwrap(){return this._def.type}},Oe=class e extends S{_parse(t){let{status:s,ctx:a}=this._processInputParams(t);if(a.common.async)return(async()=>{let n=await this._def.in._parseAsync({data:a.data,path:a.path,parent:a});return n.status==="aborted"?E:n.status==="dirty"?(s.dirty(),Bt(n.value)):this._def.out._parseAsync({data:n.value,path:a.path,parent:a})})();{let r=this._def.in._parseSync({data:a.data,path:a.path,parent:a});return r.status==="aborted"?E:r.status==="dirty"?(s.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:a.path,parent:a})}}static create(t,s){return new e({in:t,out:s,typeName:v.ZodPipeline})}},we=class extends S{_parse(t){let s=this._def.innerType._parse(t);return ke(s)&&(s.value=Object.freeze(s.value)),s}};we.create=(e,t)=>new we({innerType:e,typeName:v.ZodReadonly,...T(t)});var Kt=(e,t={},s)=>e?te.create().superRefine((a,r)=>{var n,o;if(!e(a)){let i=typeof t=="function"?t(a):typeof t=="string"?{message:t}:t,d=(o=(n=i.fatal)!==null&&n!==void 0?n:s)!==null&&o!==void 0?o:!0,u=typeof i=="string"?{message:i}:i;r.addIssue({code:"custom",...u,fatal:d})}}):te.create(),da={object:$.lazycreate},v;(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"})(v||(v={}));var pa=(e,t={message:`Input not instance of ${e.name}`})=>Kt(s=>s instanceof e,t),Zt=ee.create,Ht=ne.create,ua=xe.create,ma=oe.create,zt=ie.create,fa=ce.create,ha=Ce.create,ga=le.create,ya=de.create,_a=te.create,va=G.create,Ea=K.create,Ta=be.create,Sa=Y.create,Ca=$.create,ba=$.strictCreate,Ia=pe.create,Aa=Be.create,Pa=ue.create,xa=Z.create,wa=We.create,Ra=Ie.create,Na=Ae.create,ja=Ke.create,ka=me.create,Oa=fe.create,La=he.create,$a=ge.create,Da=se.create,Vt=V.create,Ma=W.create,Ua=q.create,Va=V.createWithPreprocess,Fa=Oe.create,Ba=()=>Zt().optional(),Wa=()=>Ht().optional(),Ka=()=>zt().optional(),Za={string:e=>ee.create({...e,coerce:!0}),number:e=>ne.create({...e,coerce:!0}),boolean:e=>ie.create({...e,coerce:!0}),bigint:e=>oe.create({...e,coerce:!0}),date:e=>ce.create({...e,coerce:!0})},Ha=E,h=Object.freeze({__proto__:null,defaultErrorMap:je,setErrorMap:qs,getErrorMap:Ue,makeIssue:Ve,EMPTY_PATH:Js,addIssueToContext:f,ParseStatus:O,INVALID:E,DIRTY:Bt,OK:L,isAborted:ft,isDirty:ht,isValid:ke,isAsync:Fe,get util(){return I},get objectUtil(){return mt},ZodParsedType:m,getParsedType:X,ZodType:S,ZodString:ee,ZodNumber:ne,ZodBigInt:oe,ZodBoolean:ie,ZodDate:ce,ZodSymbol:Ce,ZodUndefined:le,ZodNull:de,ZodAny:te,ZodUnknown:G,ZodNever:K,ZodVoid:be,ZodArray:Y,ZodObject:$,ZodUnion:pe,ZodDiscriminatedUnion:Be,ZodIntersection:ue,ZodTuple:Z,ZodRecord:We,ZodMap:Ie,ZodSet:Ae,ZodFunction:Ke,ZodLazy:me,ZodLiteral:fe,ZodEnum:he,ZodNativeEnum:ge,ZodPromise:se,ZodEffects:V,ZodTransformer:V,ZodOptional:W,ZodNullable:q,ZodDefault:ye,ZodCatch:Pe,ZodNaN:xe,BRAND:la,ZodBranded:Ze,ZodPipeline:Oe,ZodReadonly:we,custom:Kt,Schema:S,ZodSchema:S,late:da,get ZodFirstPartyTypeKind(){return v},coerce:Za,any:_a,array:Sa,bigint:ma,boolean:zt,date:fa,discriminatedUnion:Aa,effect:Vt,enum:La,function:ja,instanceof:pa,intersection:Pa,lazy:ka,literal:Oa,map:Ra,nan:ua,nativeEnum:$a,never:Ea,null:ya,nullable:Ua,number:Ht,object:Ca,oboolean:Ka,onumber:Wa,optional:Ma,ostring:Ba,pipeline:Fa,preprocess:Va,promise:Da,record:wa,set:Na,strictObject:ba,string:Zt,symbol:ha,transformer:Vt,tuple:xa,undefined:ga,union:Ia,unknown:va,void:Ta,NEVER:Ha,ZodIssueCode:p,quotelessJson:Ys,ZodError:U});l();l();var za=h.object({providerType:h.literal("openpayd"),providerClientId:h.string(),providerAccountId:h.string()}),Gt=h.discriminatedUnion("providerType",[za]);l();var Ga=h.object({providerType:h.literal("openpayd"),providerBeneficiaryId:h.string().uuid()}),Yt=h.discriminatedUnion("providerType",[Ga]);l();var qt={CROSSMINT_EUROPE:"crossmint-europe",CROSSMINT_HORIZON:"crossmint-horizon"};l();l();var Jt={US:"us",EU:"eu"};var He={CROSSMINT:"crossmint",DATA_SHARE:"data-share",RELIANCE:"reliance"},Ya={PERSONA:"persona",SUMSUB:"sumsub"},Qt=h.object({trustPolicy:h.nativeEnum(He).default(He.CROSSMINT),externalProvider:h.nativeEnum(Ya).optional(),kycRegion:h.nativeEnum(Jt)});function qa(e){return e?.trustPolicy===He.DATA_SHARE||e?.trustPolicy===He.RELIANCE}Q(qa,"isServerSideKyc");var Ja=h.object({whitelabelWalletAPI:h.boolean(),whitelabelCheckoutAPI:h.boolean(),billingAPI:h.boolean(),ethereumMintAPI:h.boolean(),baseMintAPI:h.boolean().optional(),subprojectCreation:h.object({enabled:h.boolean(),KYCOwnership:h.enum(["crossmint","developer"])}).optional(),mintAPIBYOC:h.boolean().optional(),mintAPITransferable:h.boolean().optional(),mintAPIUserIdBasedMintRecipient:h.boolean().optional(),embeddedCheckout:h.boolean().optional(),batchMintAPI:h.boolean().optional(),spamPlan:h.enum(["simple","advanced"]).optional(),paymentsMintToProjectScopedWallets:h.boolean().optional(),nonCustodialWallets:h.boolean().optional(),registerExternalCollections:h.boolean().optional(),mintAPIMaxReuploadFileSizeMB:h.number().optional(),solanaNonCompressedMint:h.boolean().optional(),solanaSFTMint:h.boolean().optional(),subscriptions:h.boolean().optional(),memeTokensCheckout:h.boolean().optional(),onrampCheckout:h.boolean().optional(),worldstore:h.object({sellerId:h.string().optional()}).optional(),onrampB2B:h.object({legalEntityName:h.string(),crossmintEntity:h.nativeEnum(qt),crossmintReference:h.string().regex(/^\d{3}$/),provider:Gt}).optional(),offrampB2B:h.object({provider:Yt,transactionLimit:h.number().min(1)}).optional(),payWithCryptoNativePassthrough:h.boolean().optional(),tokenizedCard:h.boolean().optional(),networkTokensEnabled:h.boolean().optional(),walletsMoneyTransfers:h.boolean().optional(),checkoutEnabled:h.boolean(),treasuryWallets:h.boolean().optional(),consoleTreasuryWalletsTransfer:h.boolean().optional(),kycConfig:Qt.optional(),getAllTokens:h.boolean().optional()}),J=(e=>(e.WHITELABEL_WALLET_API="whitelabelWalletAPI",e.WHITELABEL_CHECKOUT_API="whitelabelCheckoutAPI",e.BILLING_API="billingAPI",e.SUBSCRIPTIONS="subscriptions",e.PROJECT_TRANSFERS="walletsMoneyTransfers",e))(J||{});l();function ze(e){return!e||e.length===0||e.trim().length===0}Q(ze,"isEmpty");var j={GET:"GET",POST:"POST",PUT:"PUT",DELETE:"DELETE",PATCH:"PATCH",HEAD:"HEAD",OPTIONS:"OPTIONS",CONNECT:"CONNECT",TRACE:"TRACE"},Qa=De(j);l();l();var Xa=Object.defineProperty,c=(e,t)=>Xa(e,"name",{value:t,configurable:!0});l();l();var er=Object.defineProperty,C=(e,t)=>er(e,"name",{value:t,configurable:!0});function H(e){return e.charAt(0).toUpperCase()+e.slice(1)}C(H,"capitalizeFirstLetter");function z(e){return!e||e.length===0||e.trim().length===0}C(z,"isEmpty");function es(e,t){return e.length<=t?e:e.slice(0,t)+"\u2026"}C(es,"cutAndAddEllipsis");function ts(e,t=4,s=4){return e.length<=t+s?e:e.slice(0,t)+"\u2026"+e.slice(s*-1)}C(ts,"cutMiddleAndAddEllipsis");function ss(){return(Math.random()+1).toString(36).substring(7)}C(ss,"randomString");function as(e){let t=e.length,s=0,a=0;if(t>0)for(;a<t;)s=(s<<5)-s+e.charCodeAt(a++)|0;return s}C(as,"hashCode");var Xt=1e3;function rs(e){return e.length<=Xt?e:e.slice(0,Xt)+"<truncated>"}C(rs,"truncateForLog");function ns(e){return!e||typeof e!="string"?!1:e.toLowerCase()==="true"}C(ns,"parseBoolean");function os(e){return/^-?\d+$/.test(e)}C(os,"containsInteger");function is(e){if(e.length===0)return"";if(e.length===1)return e[0];let t=e.slice(0,e.length-1),s=e[e.length-1];return t.join(", ")+" and "+s}C(is,"makeFormattedEnglishList");function cs(e){return z(e)?"":e.split(" ").map(t=>t?H(t):"").join(" ")}C(cs,"capitalizeFirstLetterOfEachWord");function ls(e){return e.replace(/\s/g,"")}C(ls,"removeAllWhitespaces");function ds(e){if(z(e))return 0;let t=C((s,a)=>{let r=(a.charCodeAt(0)-48)/74;return(s+r)%1},"base58Reduction");return e.split("").reduce(t,0)}C(ds,"normalizeBase58String");function ps(e,t=100){if(!z(e))return e.substring(0,t)}C(ps,"trimIfDefined");function us(e){return e.replace(/(\r\n|\n|\r)/g," ").replace(/[\x00-\x1F\x7F-\uFFFF]/g,"")}C(us,"sanitizeStringToValidHTTPHeaderValue");function ms(e){try{JSON.parse(e)}catch{return!1}return!0}C(ms,"isStringifiedJson");function fs(e,t){if(!z(e))try{return JSON.parse(e)}catch(s){console.error(`safeJSONParse failed: ${t??""}`,s);return}}C(fs,"safeJSONParse");function hs(e,t){return e?.toLowerCase()===t?.toLowerCase()}C(hs,"equalsIgnoreCase");function gs(e){return e.map(t=>`'${t}'`).join(" | ")}C(gs,"arrayToUnionString");function ys(e){return e.startsWith("0x")?e:`0x${e}`}C(ys,"addHexIndicator");function _s(e){return Number.parseFloat(e).toString()}C(_s,"removeTrailingZeros");function vs(){let e="9876543210",t="";for(let s=0;s<4;s++)t+=e[Math.floor(Math.random()*10)];return t}C(vs,"generateOTP");function Es(e){return e&&e.includes("@")?e.split("@")[0]:e??""}C(Es,"getNameFromEmail");function Ts(e){return e!=null?`@${e.split("@").pop()}`:""}C(Ts,"getDomainFromEmail");function Ss(e){return H(e.toLowerCase().replace(/([-_][a-z])/g,t=>t.toUpperCase().replace("-","").replace("_","")))}C(Ss,"snakeToUpperCamel");function Cs(e){return e[0].toLowerCase()+e.slice(1,e.length).replace(/[A-Z]/g,t=>`_${t.toLowerCase()}`)}C(Cs,"upperCamelToSnake");function bs(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}C(bs,"slugify");var tr=C(e=>e.startsWith("0x")?e.slice(2):e,"trimHexIndicator");function yt(e){return new TextEncoder().encode(e).length}C(yt,"utf8Size");function Is(e){return yt(JSON.stringify(e))}C(Is,"serializedSize");function As(e){let t=unescape(encodeURIComponent(e)),s=new Uint8Array(t.length);for(let a=0;a<t.length;a++)s[a]=t.charCodeAt(a);return s}C(As,"stringToUtf8ByteArray");function Ps(e){return e.split("_").map(t=>H(t)).join(" ")}C(Ps,"capitalizeAndRemoveUnderscores");function xs(e){return e.split("-").map(t=>H(t)).join(" ")}C(xs,"capitalizeAndRemoveDashes");function ws(e){if(typeof e!="string")return e;let t=e;for(;;)try{let s=JSON.parse(t);if(typeof s=="string")t=s;else return s}catch{return t}}C(ws,"multiParse");function Rs(e,t=1){let s=["gmail.com","hotmail.com","outlook.com","live.com"],[a,r]=e.split("@"),[n,o]=r.split("."),i,d;return a.length<=3?i="*".repeat(a.length):i=a.length<=t?a:a[0]+"*".repeat(a.length-t-1)+a.slice(-t),s.includes(`${n}.${o}`)?d=`${n}.${o}`:d=`${n.length>1?n[0]+"*".repeat(n.length-2)+n.slice(-1):n}.${o}`,`${i}@${d}`}C(Rs,"obfuscateEmail");function Ns(e){return e.includes("*")}C(Ns,"isObfuscated");function js(e){return e===null?!1:/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e||"")}C(js,"isEmail");function ks(...e){for(let t of e)if(!z(t))return t;throw new Error("All values are empty")}C(ks,"getFirstNonEmpty");function Os(e){return e.endsWith(".")?e.slice(0,-1):e}C(Os,"removeTrailingDecimal");var Ls={admin:{index:"/console/admin",enterpriseClient:{index:"/console/admin/enterprise-clients",withId:c(e=>`/console/admin/enterprise-clients/${e}`,"withId"),details:c(e=>`/console/admin/enterprise-clients/${e}/details`,"details"),onrampB2B:c(e=>`/console/admin/enterprise-clients/${e}/onrampb2b`,"onrampB2B")},quickstarts:{index:"/console/admin/quickstarts",new:"/console/admin/quickstarts/new",edit:c(e=>`/console/admin/quickstarts/${e}`,"edit")}},billing:{index:"/console/billing",planDetails:"/console/billing/plan-details"},overview:{index:"/console/overview"},orders:{index:"/console/orders",orderDetails:c(e=>`/console/orders/${e}`,"orderDetails")},createAccount:"/console/create-account",onboarding:"/console/onboarding",collections:{index:"/console/collections",create:"/console/create-collection",dashboard:c(e=>`/console/collections/${e}/dashboard`,"dashboard"),details:c(e=>`/console/collections/${e}/details`,"details"),branding:c(e=>`/console/collections/${e}/branding`,"branding"),contract:c(e=>`/console/collections/${e}/contract`,"contract"),payments:c(e=>`/console/collections/${e}/payments`,"payments"),orders:c(e=>`/console/collections/${e}/orders`,"orders"),orderDetails:c((e,t)=>`/console/collections/${e}/orders/${t}`,"orderDetails"),payouts:{index:c(e=>`/console/collections/${e}/payouts`,"index"),details:c((e,t)=>`/console/collections/${e}/payouts/${t}`,"details"),scheduled:c((e,t)=>`/console/collections/${e}/payouts/scheduled/${t}`,"scheduled")},registeredNfts:c(e=>`/console/collections/${e}/registered/nfts`,"registeredNfts"),createdNfts:c(e=>`/console/collections/${e}/created/nfts`,"createdNfts")},wallets:{company:{index:"/console/wallets/company",walletDetails:c(e=>`/console/wallets/company/${e}`,"walletDetails")},index:"/console/wallets",address:c((e,t)=>`/console/wallets/${e}?${t}`,"address")},prepay:{create:c(e=>`/console/collections/create-prepay/${e}`,"create"),details:c(e=>`/console/collections/prepay/${e}/details`,"details"),update:c(e=>`/console/collections/prepay/${e}/update`,"update")},projects:{index:"/console/projects",addMember:"/console/projects/addMember",apiKeys:{index:"/console/projects/apiKeys",edit:c((e,t)=>`/console/projects/${e}/APIKeys/Create?apiKeyId=${t}`,"edit")},projectId:c(e=>`/console/projects/${e}`,"projectId"),withId:c(e=>`/console/projects/${e}`,"withId"),branding:c(e=>`/console/projects/${e}/branding`,"branding"),settings:c(e=>`/console/projects/${e}/settings`,"settings"),walletsSettings:c(e=>`/console/projects/${e}/settings/wallets`,"walletsSettings")},webhooks:{index:"/console/webhooks"},domains:{index:"/console/domains"},applePayDomains:{index:"/console/apple-pay-domains"},account:{index:"/console/account"},mintingApi:{index:"/console/minting-api"},authorizeDevice:{index:c(e=>`/console/authorize-device?${new URLSearchParams(e).toString()}`,"index"),success:"/console/authorize-device/success"}};function Ge(e,t){return t?`${e}?clientId=${t}`:e}c(Ge,"appendClientId");var sr={console:{collections:{new:{chooseAction:c(e=>Ge("/alpha/console/collections/new/choose-action",e),"chooseAction"),details:c(e=>`/alpha/console/collections/new/details?${new URLSearchParams({...z(e)?{}:{clientId:e}}).toString()}`,"details"),registerCollection:c(e=>Ge("/alpha/console/collections/new/register-collection",e),"registerCollection"),smartContract:c(e=>Ge("/alpha/console/collections/new/smart-contract",e),"smartContract")}}}},ar={admin:{godmode:{info:c(e=>`/api/admin/godmode/info?userId=${e}`,"info"),relatedEntities:c(e=>`/api/admin/godmode/related-entities?identifier=${e}`,"relatedEntities"),impersonate:c((e,t)=>`/api/admin/godmode/impersonate?entityId=${e}&type=${t}`,"impersonate"),gatherInfo:c((e,t)=>`/api/admin/godmode/gather-info/${e}/${t}`,"gatherInfo"),enterpriseData:c(e=>`/api/admin/godmode/enterprise-data?identifier=${e}`,"enterpriseData")}},auth:{callback:{email:"/api/auth/callback/email"}},internal:{transfer:{confirmation:"/api/internal/transfer/confirmation"},transaction:{confirmation:"/api/internal/transaction/confirmation"}},"v1-alpha1":{wallets:{transaction:{getViewInfo:c(e=>`/api/v1-alpha1/wallets/transaction/getViewInfo/${e}`,"getViewInfo")},nfts:c(e=>`api/v1-alpha1/wallets/${e}/nfts`,"nfts"),getViewInfo:c(e=>`api/v1-alpha1/wallets/transfers/getViewInfo/${e}`,"getViewInfo")},collections:{index:"/api/v1-alpha1/collections",mints:c((e,t,s)=>`/api/v1-alpha1/collections/${e}/mints?projectId=${t}${s?`&cursor=${s}`:""}`,"mints")},minting:{collections:{nfts:c((e,t)=>`/api/v1-alpha1/minting/collections/${e}/nfts?projectId=${t}`,"nfts")}},project:{branding:c(e=>`/api/v1-alpha1/projects/${e}/branding`,"branding"),usage:c((e,t,s)=>`/api/v1-alpha1/projects/${e}/usage?dimension=${t}&startDate=${s}`,"usage"),walletsCreated:c(e=>`/api/v1-alpha1/projects/${e}/wallets-created`,"walletsCreated")}},blockchain:{price:c(e=>`/api/blockchain/${e}/price`,"price")},console:{billing:{details:c(e=>`/api/billing/${e}`,"details"),addPaymentMethodUrl:c(e=>`/api/billing/addPaymentInfoUrl/${e}`,"addPaymentMethodUrl"),getCurrentBalance:c(e=>`/api/billing/${e}/balance`,"getCurrentBalance"),paymentMethods:c(e=>`/api/billing/${e}/paymentMethods`,"paymentMethods")},collections:{index:c(e=>`/api/collections?projectId=${e}`,"index"),indexPaginated:c((e,t,s,a=!1)=>`/api/v1-alpha1/collections?${new URLSearchParams({projectId:e,page:t.toString(),perPage:s.toString(),hideDrafts:a?"true":"false"})}`,"indexPaginated"),byClientId:c((e,t)=>`/api/console/collections/${e}?projectId=${t}`,"byClientId"),requestVerification:c((e,t)=>`/api/console/collections/${e}/request-verification?projectId=${t}`,"requestVerification"),mintableTemplates:c((e,t,s,a=20)=>`/api/console/collections/${e}/templates/mintable?projectId=${t}&page=${s}&perPage=${a}`,"mintableTemplates"),templateSupply:c((e,t)=>`/api/console/collections/${e}/templates/supply?projectId=${t}`,"templateSupply"),payments:{parameters:c((e,t)=>`/api/console/collections/${e}/payments/parameters?projectId=${t}`,"parameters")},orders:{stats:c((e,t)=>`/api/collections/${e}/orders/stats?projectId=${t}`,"stats"),index:c((e,t,s)=>{let a=new URLSearchParams({projectId:t,...s});return`/api/collections/${e}/orders?${a}`},"index"),order:c((e,t,s)=>`/api/collections/${e}/orders/${s}?projectId=${t}`,"order")},register:{evm:{contract:{getInfo:c((e,t)=>`/api/console/collections/register/evm/contract/${e}/get-info?chain=${t}`,"getInfo")},getThirdwebParams:c((e,t)=>`/api/console/collections/register/evm/contract/get-thirdweb-params?projectId=${e}&clientId=${t}`,"getThirdwebParams")}},batchUpload:c((e,t,s)=>`/api/console/collections/${e}/batchUpload?projectId=${t}&batchIdentifier=${s}`,"batchUpload"),batchUploadStatus:c((e,t,s,a)=>`/api/console/collections/${e}/batchUpload?projectId=${t}&batchIdentifier=${s}&workflowId=${a}`,"batchUploadStatus")},getProject:c(e=>`/api/console/projects?projectId=${e}`,"getProject"),projects:{index:`/api/${Ls.projects.index}`,exportCsv:c((e,t)=>`/api/export-csv?projectId=${e}&clientId=${t}`,"exportCsv"),apiKeys:c((e,t)=>`/api/console/projects/${e}/apiKeys${z(t)?"":`?keyId=${t}`}`,"apiKeys"),webhook:c(e=>`/api/console/projects/${e}/webhook`,"webhook"),members:"/api/console/projects/members",billing:{paymentMethods:c(e=>`/api/console/projects/${e}/billing/paymentMethods`,"paymentMethods"),balance:c(e=>`/api/console/projects/${e}/billing/balance`,"balance"),subscription:c(e=>`/api/console/projects/${e}/billing/subscription`,"subscription"),pricing:c(e=>`/api/console/projects/${e}/billing/pricing`,"pricing"),apiActionEnabled:c((e,t,s)=>`/api/console/projects/${e}/billing/apiActionEnabled?apiAction=${t}&chain=${s}`,"apiActionEnabled"),usage:c(e=>`/api/console/projects/${e}/billing/usage`,"usage"),autoRecharge:c(e=>`/api/console/projects/${e}/billing/autoRecharge`,"autoRecharge"),redeemCoupon:c(e=>`/api/console/projects/${e}/billing/redeemCoupon`,"redeemCoupon"),payments:c(e=>`/api/console/projects/${e}/billing/payments`,"payments"),topupStatus:c((e,t)=>`/api/console/projects/${e}/billing/topupStatus?requestId=${t}`,"topupStatus"),billingInformation:c(e=>`/api/console/projects/${e}/billing/billingInformation`,"billingInformation")},privacyPolicy:c(e=>`/api/console/project/${e}/privacy-policy`,"privacyPolicy")},webhook:{index:c(e=>`/api/console/webhook?projectId=${e}`,"index"),attempts:c(e=>`/api/console/webhook/attempts?projectId=${e}`,"attempts"),svix:{appPortal:"/api/console/webhook/svix/app-portal"}},domains:{createUpdateDelete:c((e,t)=>`/api/v1-alpha1/projects/${e}/domains/${t}`,"createUpdateDelete")},applePayDomains:{list:c(e=>`/api/v1-alpha1/projects/${e}/apple-pay-domains`,"list"),register:c((e,t)=>`/api/v1-alpha1/projects/${e}/apple-pay-domains/${t}`,"register"),deregister:c((e,t)=>`/api/v1-alpha1/projects/${e}/apple-pay-domains/${t}`,"deregister")},accesslist:{discordInfo:c((e,t)=>`/api/console/collections/${e}/accesslists/discord?projectId=${t}`,"discordInfo"),validateTwitter:c((e,t,s)=>`/api/console/collections/${e}/accesslists/twitter?username=${s}&projectId=${t}`,"validateTwitter"),accesslists:c((e,t)=>`/api/console/collections/${e}/accesslists?projectId=${t}`,"accesslists")},developerAccount:{get:c(e=>`/api/console/developer-account?projectId=${e}`,"get")},mintingApi:{hasMinted:c(e=>`/api/console/minting-api/hasMinted?projectId=${e}`,"hasMinted")},payments:{hostedSalesPage:{index:c((e,t)=>`/api/console/collections/${e}/payments/hostedSalesPage?projectId=${t}`,"index")},enable:c((e,t)=>`/api/console/collections/${e}/payments/enable?projectId=${t}`,"enable")},branding:c((e,t)=>`/api/console/collections/${e}/branding?projectId=${t}`,"branding"),registerContract:c((e,t)=>`/api/console/collections/${e}/register-contract?projectId=${t}`,"registerContract"),dashboard:{revenue:c((e,t,s,a,r)=>`/api/console/collections/${e}/dashboard/revenue/?projectId=${t}&after=${s}&before=${a}&periodInMS=${r}`,"revenue"),sales:c((e,t,s,a)=>`/api/console/collections/${e}/dashboard/sales/?projectId=${t}&after=${s}&before=${a}`,"sales")},contactSales:{upgradePlanSubmission:c(e=>`/api/console/contact-sales/upgrade-plan-submission?projectId=${e}`,"upgradePlanSubmission")}},developerAccount:"/api/developeraccount",contactSales:{upgradePlanSubmission:c(e=>`/api/console/contact-sales/upgrade-plan-submission?projectId=${e}`,"upgradePlanSubmission")},crossmint:{user:{discord:{index:"/api/crossmint/user/discord"}}},projects:"/api/projects",verification:{otp:c((e,t,s)=>`/api/verifyOTP?${new URLSearchParams({exportId:e,otp:t,uuid:s}).toString()}`,"otp"),getStatusByEntityId:c(e=>`/api/verification/${e}/status`,"getStatusByEntityId"),getCollectionStatus:c((e,t)=>`/api/verification/${e}/collectionStatus?projectId=${t}`,"getCollectionStatus")},prepays:{details:c(e=>`/api/prepays/${e}`,"details")},hostedSalesPage:{mintStatus:c(({clientId:e,isConsole:t,quantity:s,projectId:a,currency:r,price:n})=>`/api/collections/drop/mintStatus?clientId=${e}&quantity=${s}&currency=${r}&price=${n}&isConsole=${t}${a?`&projectId=${a}`:""}`,"mintStatus"),index:c(e=>`/api/collections/drop?slug=${e}`,"index"),context:c(e=>`/api/collections/drop/context?slug=${e}`,"context")},claim:{index:"/api/collections/claim",context:c(e=>`/api/collections/claim/context?slug=${e}`,"context"),pageStatus:c(({clientId:e,projectId:t})=>`/api/collections/claim/pageStatus?clientId=${e}&projectId=${t}`,"pageStatus"),supply:c(({clientId:e,projectId:t})=>`/api/collections/claim/supply?clientId=${e}&projectId=${t}`,"supply"),status:c(({clientId:e,projectId:t,requestId:s})=>`/api/collections/claim/status?clientId=${e}&projectId=${t}&requestId=${s}`,"status")},walletConnect:{signMessage:"/api/walletConnect"},transactions:{nft:c(e=>`/api/transactions/${e}/nft`,"nft")},"2023-06-09":{crossmint:{connect:c((e,{forceWalletSelection:t,projectId:s,showAAWallets:a})=>{let r=t?"&forceWalletSelection=true":"",n=s?`&projectId=${s}`:"";return`/api/2023-06-09/crossmint/connect?chain=${e}${r}${n}${a?"&showAAWallets=true":""}`},"connect")}},"2022-06-09":{minting:{collections:{index:c(e=>`/api/2022-06-09/minting/collections?projectId=${e}`,"index"),collectionId:c((e,t)=>`/api/2022-06-09/minting/collections/${e}${t?`?projectId=${t}`:""}`,"collectionId"),templates:c((e,t)=>`/api/2022-06-09/minting/collections/${e}/templates?projectId=${t}`,"templates"),nfts:c((e,t)=>`/api/2022-06-09/minting/collections/${e}/nfts?projectId=${t}`,"nfts"),template:c((e,t,s)=>`/api/2022-06-09/minting/collections/${e}/templates/${t}?projectId=${s}`,"template")}},wallets:{index:c(e=>`/api/2022-06-09/wallets?projectId=${e}`,"index")}},wallets:{get(e,t,s,a){return`/api/unstable/wallets?${new URLSearchParams({projectId:e,page:t.toString(),perPage:s.toString(),...a})}`},index:c(e=>`/api/v1-alpha1/wallets?projectId=${e}`,"index")},services:{aws:{s3:{presignedPutObject:c((e,t,s,a)=>`/api/services/aws/s3/presignedPutObject?${new URLSearchParams({clientId:e,projectId:s,batchIdentifier:t,bucketName:a}).toString()}`,"presignedPutObject")}}}},rr={referralProgramAgreement:"/legal/referral-program-agreement",contentPolicy:"/content-policy",termsOfService:"/legal/terms-of-service",msa:"/master-services-agreement",privacyPolicy:"/legal/privacy-policy"},nr={claim:c(e=>`/collections/${e}/claim`,"claim")},or={getSession:"/api/session",signOut:"/api/session/signout",oauthSessionAuthenticate:"/api/session/authenticate",authenticate:"/api/session/authenticate",oauthSessionAuthenticateAuthSDK:"/api/2024-09-26/session/sdk/auth/authenticate",stytchGetOrCreateUser:"/api/sdk/auth/user/get-or-create",exchangeAccessToken:"/api/session/exchange-access-token",sendOtp:"/api/session/send/otp"},ir={support:"https://help.crossmint.com/hc/en-us/requests/new",collectionVerificationFAQ:"https://help.crossmint.com/hc/en-us/articles/17367432791053-Crossmint-Collection-Review",sales:"/contact/sales",index:"/contact"},cr={contract:c(e=>`/claim/contract/${e}`,"contract")},lr={index:"https://docs.crossmint.com",changelog:{index:"https://docs.crossmint.com/changelog",article:c(e=>`https://docs.crossmint.com/changelog/${e}`,"article")},payments:{index:"https://docs.crossmint.com/payments/introduction"}},dr={index:"/cli-signin",success:"/cli-signin/success"},x={cliSignin:dr,console:Ls,api:ar,alpha:sr,legal:rr,collection:nr,authentication:or,notFound:"/404",contact:ir,claim:cr,docs:lr,pricing:"/pricing"};import $s from"os";var Ds=_t().version,Ms="@crossmint/cli";function ur(){let e=$s.platform(),t=$s.arch(),s=process.version;return`${Ms} ${Ds} (${e} ${t}) Node.js/${s} (production)`}function mr(){return{"user-agent":ur(),"x-client-name":Ms,"x-client-version":Ds}}async function k(e,t=j.GET,s){let a=await Ot(),r=await M();a||(console.error("\u274C Session not found, please run crossmint login"),process.exit(1)),r||(console.error("\u274C Environment not found, please run crossmint login"),process.exit(1));let n=`${re(r)}${e}`;return Ye(n,t,s,{Cookie:`sessionToken=${a}`})}async function Us(e,t=j.GET,s){let a=await M();a||(console.error("\u274C Environment not found"),process.exit(1));let r=`${re(a)}${e}`;return Ye(r,t,s)}async function Ye(e,t=j.GET,s,a){let r={method:t,headers:{"Content-Type":"application/json",...mr(),...a}};s&&(r.body=JSON.stringify(s));let n=await fetch(e,r);if(n.status>=400){let o=await n.json();throw new Error(`${o.message}`)}return await n.json()}import{select as hr}from"@inquirer/prompts";l();import{createSpinner as fr}from"nanospinner";function D(e){let t=fr(e),s={start:a=>(t.start({text:a}),s),succeed:a=>(t.success({text:a}),s),fail:a=>(t.error({text:a}),s)};return s}l();var vt="crossmint",A={LOGIN:"login",LOGOUT:"logout",WHOAMI:"whoami",KEYS:"keys",PROJECTS:"projects",CREATE:"create",DELETE:"delete",EDIT:"edit",LIST:"list",SELECT:"select",DETAILS:"details"};function R(e){return[vt,...e].join(" ")}var N={login:[A.LOGIN],logout:[A.LOGOUT],whoami:[A.WHOAMI],projects:{select:[A.PROJECTS,A.SELECT],create:[A.PROJECTS,A.CREATE],details:[A.PROJECTS,A.DETAILS]},keys:{create:[A.KEYS,A.CREATE],delete:[A.KEYS,A.DELETE],edit:[A.KEYS,A.EDIT],list:[A.KEYS,A.LIST]}};async function Re(){let e=D("Fetching projects...").start();try{let t=await k(x.api.projects);if(!t||t.length===0)return e.fail(`No projects found. Create a new project using \`${R(N.projects.create)}\``),process.exit(0);if(e.succeed("Fetched projects"),t.length===1){let a=t[0];return console.log(`You only have one project: ${a.name}`),console.log(`To create another project, run \`${R(N.projects.create)}\``),await Ne(a.id),console.log(`\u2705 Project ${a.name} selected`),process.exit(0)}let s=await hr({message:"Select a project:",choices:t.map(a=>({name:a.name,value:a,description:a.description}))});await Ne(s.id),console.log(`\u2705 Project ${s.name} selected`),process.exit(0)}catch{e.fail("Failed to fetch projects"),process.exit(1)}}import _r from"open";l();import Vs from"crypto";async function Fs(){let t=Vs.randomBytes(32).toString("base64url"),a=Vs.createHash("sha256").update(t).digest().toString("base64url");return await Ee("pkceCodeVerifier",t),a}async function Bs(){return await Te("pkceCodeVerifier")}l();import gr from"http";l();async function qe(){let e=await M();return e||(console.error("\u274C Environment not found"),process.exit(1)),e==="local"?{uri:"test.stytch.com",projectId:"project-test-8eb55d3d-949f-4e0f-aea6-c9ba740f7813",clientId:"connected-app-test-4d27d6d8-3491-45c8-9bb0-b05f89cb7a1a"}:e==="staging"?{uri:"api.stytch.com",projectId:"project-live-b7c564af-0c0d-4662-bfc0-72bed1049cfe",clientId:"connected-app-live-47cd5bf1-c155-42c1-9f36-5d35853b34a7"}:{uri:"api.stytch.com",projectId:"project-live-7a1cb98d-b8b7-4471-aaf6-f8af67a0df94",clientId:"connected-app-live-a72edd7e-6ff3-4002-a13a-e7ca66354bd1"}}async function Et(e){return new Promise((t,s)=>{let a=gr.createServer(async(n,o)=>{try{let d=new URL(n.url||"",`http://${n.headers.host}`).searchParams.get("code");if(!d){o.writeHead(400,{"Content-Type":"text/plain"}),o.end("No code provided");return}let u=await qe(),g=await Ye(`https://${u.uri}/v1/public/${u.projectId}/oauth2/token`,j.POST,{grant_type:"authorization_code",code:d,client_id:u.clientId,redirect_uri:"http://127.0.0.1:3456/callback",code_verifier:await Bs()}),b=await Us(x.authentication.exchangeAccessToken,j.POST,{accessToken:g.access_token});await kt(b.sessionToken),o.writeHead(302,{Location:`${re(e)}${x.console.authorizeDevice.success}`}),o.end(),a.close(),t(g)}catch(i){o.writeHead(500,{"Content-Type":"text/plain"}),o.end("Error during authentication"),a.close(),s(i)}});a.listen(3456)})}var vr=!1;async function Tt(e={}){try{console.log("\u{1F510} Crossmint CLI - Login");let t;if(ze(e.env))t=await yr({message:"Select environment:",choices:[{name:"Production",value:"production"},{name:"Staging",value:"staging"},...vr?[{name:"Local",value:"local"}]:[]]});else{let d=["staging","production"];d.includes(e.env)||(console.error(`Error: Invalid environment "${e.env}". Must be one of: ${d.join(", ")}`),process.exit(1)),t=e.env}let s=re(t);s||(console.error(`Error: No URL found for ${t} environment`),process.exit(1)),await Nt(t);let a=Et(t),{clientId:r}=await qe(),o={code_challenge:await Fs(),code_challenge_method:"S256",scope:"full_access",response_type:"code",grant_type:"authorization_code",redirect_uri:"http://127.0.0.1:3456/callback",client_id:r},i=`${s}${x.console.authorizeDevice.index(o)}`;console.log("Opening browser for authentication..."),_r(i),await a,console.log(`\u2705 Login successful! You are now authenticated in the ${t} environment.`),await Re()}catch{console.error("\u274C Login failed, please try again."),process.exit(1)}}l();l();async function ae(e){return(await k(x.api.projects)).find(a=>a.id===e)}async function St(){let e=await M(),t=await F(),s=await ae(t||""),a=await k(x.authentication.getSession);console.log(`You are logged in to \u{1F340}Crossmint as: ${a.user.email} - Environment: ${H(e)} - ${s?`Project: ${s.name}`:"No project selected"}`),process.exit(0)}l();async function Ct(){await Lt(),await jt(),await $t(),console.log("Logged out"),process.exit(0)}l();l();import{confirm as Er,input as Tr}from"@inquirer/prompts";async function Je(e={}){let t=D();try{let s=e.name;s||(s=await Tr({message:"Enter project name:",validate:o=>o.length>0||"Project name is required"})),t.start(`\u{1F680} Creating project "${s}" with Smart Wallets...`);let a=await k(x.api.console.projects.index,j.POST,{name:s,walletType:"smart_wallet",storageProvider:"ipfs",projectThumbnail:""}),r=JSON.parse(a);t.succeed(`\u2705 Project created successfully!
3
3
 
4
4
  `),console.log(`\u{1F4CC} Project Details:
5
5
  Name: ${s}
6
6
  ID: ${r.kableClientId}
7
- `),await fr({message:"Do you want to select this project?"})&&(await Re(r._id),console.log(`\u2705Project '${s}' selected`)),process.exit(0)}catch(s){e.fail(`\u274C Failed to create project: ${s instanceof Error?s.message:"Unknown error"}`),process.exit(1)}}l();async function qe(){let t=await F();t||(console.error(`No project selected. Please select a project first using \`${w(R.projects.select)}\``),process.exit(1));let e=D("Fetching project details...").start();try{let s=await se(t);s||(e.fail("Project not found"),process.exit(1)),e.succeed("Fetched project details"),console.log(`
8
- \u{1F4CC} Project Details:`),console.log(`Name: ${s.name}`),console.log(`ID: ${s.kableClientId}`),console.log(`Wallet Type: ${s.addons.nonCustodialWallets?"Smart":"Custodial"}`),process.exit(0)}catch(s){e.fail("Failed to fetch project details"),console.error("Error:",s instanceof Error?s.message:"Unknown error"),process.exit(1)}}l();l();import{select as Vs,checkbox as xr}from"@inquirer/prompts";l();import{Separator as Ir}from"@inquirer/prompts";l();l();l();l();var St={WALLET_CREATE:"wallets.create",WALLET_READ:"wallets.read",WALLET_NFT_READ:"wallets:nfts.read",WALLET_BALANCE_READ:"wallets:balance.read",WALLET_TRANSACTION_CREATE:"wallets:transactions.create",WALLET_TRANSACTION_SIGN:"wallets:transactions.sign",WALLET_TRANSACTION_READ:"wallets:transactions.read",WALLET_SIGNATURES_CREATE:"wallets:signatures.create",WALLET_SIGNATURES_READ:"wallets:signatures.read",CREDENTIALS_READ:"credentials.read",CREDENTIALS_DECRYPT:"credentials.decrypt",ORDERS_CREATE:"orders.create",ORDERS_WS_CREATE:"orders.ws.create",ORDERS_WS_SEARCH:"orders.ws.search",WALLET_FUND:"wallets.fund"},yr={},j={...St,...yr};var _r={NFTS_MINT:"nfts.mint"},P={COLLECTIONS_CREATE:"collections.create",COLLECTIONS_UPDATE:"collections.update",COLLECTIONS_READ:"collections.read",NFTS_CREATE:"nfts.create",NFTS_UPDATE:"nfts.update",NFTS_DELETE:"nfts.delete",NFTS_READ:"nfts.read",NFTS_TRANSFER:"nfts.transfer",CREDENTIALS_TEMPLATE_CREATE:"credentials:templates.create",CREDENTIALS_CREATE:"credentials.create",CREDENTIALS_DELETE:"credentials.delete",WALLET_NFT_TRANSFER:"wallets:nfts.transfer",WALLET_MESSAGE_SIGN:"wallets:messages.sign",BILLING_READONLY:"billing.readonly",PROJECTS_USAGE_READ:"projects:usage.read",ORDERS_UPDATE:"orders.update",ORDERS_READ:"orders.read",SUBSCRIPTIONS_UPDATE:"subscriptions.update",SUBSCRIPTIONS_READ:"subscriptions.read",USERS_READ:"users.read",USERS_CREATE:"users.create",EXP_PROJECT_TRANSFER_CREATE:"experimental:projects:transfers.create",EXP_PROJECT_TRANSFER_READ:"experimental:projects:transfers.read",...St},vr={COLLECTIONS_WRITE:"collections.write",ALLOWLIST_WRITE:"allowlist.write",MERKLE_COMPUTE:"allowlist:merkle.compute",VERIFY_ADDRESSES:"allowlist:addresses.verify",ACCESSLIST_WRITE:"accesslist.write",ACCESSLIST_READ:"accesslist.read",WALLET_FROM_EMAIL:"user:wallets.read",WALLET_TRANSACTION_SIGN:"wallets:transactions.sign",WALLET_TRANSACTION_SEND:"wallets:transactions.send",NFT_CHECKOUT:"nfts.checkout"},Er={MARKETPLACES_TOS_ACCEPT:"crossmint:marketplaces:tos.accept",FILEBASE_BUCKET_DELETE:"crossmint:filebase.buckets.delete",GOD:"god"},gi={...P,...vr,...Er,..._r};l();l();var y={MINTING_API:"minting_api",WALLETS:"wallets_api",PAYMENTS:"payments",PROJECT_API:"project_api",CREDENTIALS_API:"credentials_api",USERS:"users"},Ct={[y.MINTING_API]:"Minting API",[y.WALLETS]:"Wallet API",[y.PAYMENTS]:"Payments",[y.PROJECT_API]:"Project Admin",[y.CREDENTIALS_API]:"Verifiable Credentials",[y.USERS]:"Users"};var Tr=[{value:j.ORDERS_CREATE,title:"Create an order",description:"Create an order for headless checkout.",category:y.PAYMENTS,projectPermission:null,dangerMessage:null}],Sr=[{value:j.ORDERS_WS_CREATE,title:"Create worldstore order",description:"Create an order for a Worldstore listing.",category:y.PAYMENTS,projectPermission:null,dangerMessage:null},{value:j.ORDERS_WS_SEARCH,title:"Search worldstore listings",description:"Search Worldstore listings.",category:y.PAYMENTS,projectPermission:null,dangerMessage:null}],Je=[{value:j.WALLET_READ,title:"Read wallet",description:"Retrieve all wallets for a user.",category:y.WALLETS,projectPermission:null,dangerMessage:null},{value:j.WALLET_CREATE,title:"Create wallet",description:"Create a wallet for a user.",category:y.WALLETS,projectPermission:null,dangerMessage:null},{value:j.WALLET_TRANSACTION_CREATE,title:"Create Transaction",description:"Create a transaction from a user's wallet.",category:y.WALLETS,projectPermission:null,dangerMessage:"Sensitive scope: misuse of this scope may result in unauthorized wallet transactions."},{value:j.WALLET_TRANSACTION_SIGN,title:"Sign Transaction",description:"Sign a transaction from a user's wallet.",category:y.WALLETS,projectPermission:null,dangerMessage:"Sensitive scope: misuse of this scope may result in unauthorized transaction signatures."},{value:j.WALLET_TRANSACTION_READ,title:"Read Transactions",description:"Read transactions from a user's wallet.",category:y.WALLETS,projectPermission:null,dangerMessage:null},{value:j.WALLET_SIGNATURES_CREATE,title:"Create Wallet Signatures",description:"Create a signature for a wallet.",category:y.WALLETS,projectPermission:null,dangerMessage:null},{value:j.WALLET_SIGNATURES_READ,title:"Read Wallet Signatures",description:"Read a signature for a wallet.",category:y.WALLETS,projectPermission:null,dangerMessage:null},{value:j.WALLET_NFT_READ,title:"Get NFTs",description:"Fetch the NFTs owned by a specific wallet address.",category:y.WALLETS,projectPermission:null,dangerMessage:null},{value:j.WALLET_BALANCE_READ,title:"Get wallet balance",description:"Get the balance of a specific wallet address.",category:y.WALLETS,projectPermission:null,dangerMessage:null},{value:j.CREDENTIALS_READ,title:"Get Credentials",description:"Fetch credentials, some endpoints will only work with a server side key.",category:y.CREDENTIALS_API,projectPermission:null,dangerMessage:null},{value:j.CREDENTIALS_DECRYPT,title:"Decrypt Credentials",description:"Decrypt credentials, mainly used by our client side SDK.",category:y.CREDENTIALS_API,projectPermission:null,dangerMessage:null},{value:j.WALLET_FUND,title:"Fund Wallet",description:"Send funds to a wallet.",category:y.WALLETS,projectPermission:null,dangerMessage:null},...Tr,...Sr];var Cr=[{value:P.ORDERS_READ,title:"Get order",description:"Get an existing order for headless checkout.",category:y.PAYMENTS,projectPermission:null,dangerMessage:null},{value:P.ORDERS_UPDATE,title:"Update order",description:"Update an existing order for headless checkout.",category:y.PAYMENTS,projectPermission:null,dangerMessage:null}],br=[{value:P.SUBSCRIPTIONS_UPDATE,title:"Update a subscription",description:"Be able to update and cancel subscriptions",category:y.PAYMENTS,projectPermission:J.SUBSCRIPTIONS,dangerMessage:null},{value:P.SUBSCRIPTIONS_READ,title:"Retrieve subscription information",description:"Be able to read subscription information",category:y.PAYMENTS,projectPermission:J.SUBSCRIPTIONS,dangerMessage:null}],bt=[...Je,{value:P.NFTS_CREATE,title:"Mint NFTs",description:"Mint your NFTs and deliver them to a wallet or to an email address.",category:y.MINTING_API,projectPermission:null,dangerMessage:null},{value:P.NFTS_UPDATE,title:"Update NFTs",description:"Update a minted NFT's metadata on IPFS (image, description, name...).",category:y.MINTING_API,projectPermission:null,dangerMessage:null},{value:P.NFTS_READ,title:"Read NFTs",description:"Retrieve all metadata for an NFT.",category:y.MINTING_API,projectPermission:null,dangerMessage:null},{value:P.NFTS_DELETE,title:"Burn NFTs",description:"Burn a specific NFT within a collection.",category:y.MINTING_API,projectPermission:null,dangerMessage:"Sensitive scope: misuse of this scope may result in permanent loss of user assets."},{value:P.NFTS_TRANSFER,title:"Transfer NFTs",description:"Transfer an NFT to a different wallet.",category:y.MINTING_API,projectPermission:null,dangerMessage:null},{value:P.COLLECTIONS_CREATE,title:"Create collection",description:"Create a collection of NFTs.",category:y.MINTING_API,projectPermission:null,dangerMessage:null},{value:P.COLLECTIONS_UPDATE,title:"Update collection",description:"Update information for an existing collection (image, name, royalties...).",category:y.MINTING_API,projectPermission:null,dangerMessage:null},{value:P.COLLECTIONS_READ,title:"Read collections",description:"Retrieve the information about a specific collection.",category:y.MINTING_API,projectPermission:null,dangerMessage:null},{value:P.CREDENTIALS_TEMPLATE_CREATE,title:"Create Credentials Templates",description:"Create a template for your credentials.",category:y.CREDENTIALS_API,projectPermission:null,dangerMessage:null},{value:P.CREDENTIALS_CREATE,title:"Create Credentials and Types",description:"Issue your credentials and create credential types",category:y.CREDENTIALS_API,projectPermission:null,dangerMessage:null},{value:P.CREDENTIALS_DELETE,title:"Revoke Credentials",description:"Revoke a credential issued to a subject.",category:y.CREDENTIALS_API,projectPermission:null,dangerMessage:null},{value:P.WALLET_NFT_TRANSFER,title:"Transfer NFTs",description:"Transfer an NFT from a user's wallet.",category:y.WALLETS,projectPermission:J.WHITELABEL_WALLET_API,dangerMessage:"Sensitive scope: misuse of this scope may result in permanent loss of user assets."},{value:P.WALLET_MESSAGE_SIGN,title:"Sign Messages",description:"Sign a message from a user's wallet.",category:y.WALLETS,projectPermission:null,dangerMessage:null},{value:P.BILLING_READONLY,title:"Get balance",description:"Get balance in credits for a project.",category:y.PROJECT_API,projectPermission:J.BILLING_API,dangerMessage:null},{value:P.PROJECTS_USAGE_READ,title:"Get usage",description:"Get usage for the different products in a project.",category:y.PROJECT_API,projectPermission:null,dangerMessage:null},{value:P.USERS_READ,title:"Get user",description:"Get user information.",category:y.USERS,projectPermission:null,dangerMessage:null},{value:P.USERS_CREATE,title:"Create user",description:"Create a user.",category:y.USERS,projectPermission:null,dangerMessage:null},{value:P.EXP_PROJECT_TRANSFER_CREATE,title:"Create project transfers",description:"Create outbound transfers from the project balance to external wallets.",category:y.PROJECT_API,projectPermission:J.PROJECT_TRANSFERS,dangerMessage:"This allows the API key holder to initiate transfers of funds from the project balance to any wallet address."},{value:P.EXP_PROJECT_TRANSFER_READ,title:"Read project transfers",description:"View transfer history and details for outbound transfers from the project balance.",category:y.PROJECT_API,projectPermission:J.PROJECT_TRANSFERS,dangerMessage:null},...br,...Cr];l();l();var Qe={USERS_CREATE:"users.create",USERS_READ:"users.read"},Ni={...j,...Qe};var It=[...Je,{value:Qe.USERS_CREATE,title:"Create users",description:"Create users / allow them to sign up",category:y.USERS,projectPermission:null,dangerMessage:null},{value:Qe.USERS_READ,title:"Read users",description:"Get profile info for user accounts",category:y.USERS,projectPermission:null,dangerMessage:null}];l();var At=["server","client"];function Xe(t,e,s,a=[]){let n=(t==="server"?bt:It).reduce((o,i)=>{let{title:d,description:u,value:g,category:b}=i;return o[b]||(o[b]=[]),Ar(i,e,s)||o[b].push({name:`${d} (${g})`,value:g,description:u,checked:a.includes(g)}),o},{});return Object.entries(n).flatMap(([o,i])=>[new Ir(Ct[o]),...i])}function Ar(t,e,s){return e==="production"&&t.projectPermission!=null&&s?.addons!=null&&!s.addons[t.projectPermission]}l();import{input as Us}from"@inquirer/prompts";function Pr(t){try{return new URL(t),!0}catch{return!1}}async function et(t,e){let s=[],a=[],r=e?`
9
- Press [tab] to edit or [enter] to confirm current value`:"";if(t==="web"){let n=await Us({default:e?.join(","),message:`Enter whitelisted domain or localhost (e.g., https://www.yourdomain.com) (separate multiple domains with a comma):${r}`,validate:o=>{let i=o.split(",");for(let d of i)if(!Pr(d))return`Invalid domain: ${d}. Please enter a valid URL (e.g., https://www.yourdomain.com)`;return!0}});s.push(...n.split(",").map(o=>o.trim()))}else if(t==="mobile"){let n=await Us({default:e?.join(","),message:`Enter iOS bundle ID or Android package name (e.g., com.company.appname) (separate multiple domains with a comma):${r}`,validate:o=>{let i=o.split(",");for(let d of i)if(d.trim().length===0)return"App identifier cannot be empty";return!0}});a.push(...n.split(",").map(o=>o.trim()))}return{whitelistedOrigins:s,whitelistedAppIdentifiers:a}}async function tt(){let t=await M(),e=await F();t||(console.error(`There is no environment selected, please first run \`${w(R.login)}\``),process.exit(1)),e||(console.error(`There is no project selected, please first run \`${w(R.projects.select)}\``),process.exit(1));let s=D("Creating key...");try{let a=await Vs({message:"Select Key Usage:",choices:[{name:"Server side",value:"server"},{name:"Client side",value:"client"}]}),r,n,o;a==="client"&&(r=await Vs({message:"Select client platform:",choices:[{name:"Web",value:"web"},{name:"Mobile",value:"mobile"}]}),{whitelistedOrigins:n,whitelistedAppIdentifiers:o}=await et(r));let i=await se(e);i||(console.error(`\u274C Project not found, please run \`${w(R.projects.select)}\``),process.exit(1));let d=Xe(a,t,i),u=await xr({message:`Select scopes for ${a} key:`,choices:d,validate:Oe=>Oe.length===0?"At least one scope must be selected":!0}),g={usageOrigin:a,scopes:u};a==="client"&&(g.whitelistedOrigins=n,g.whitelistedAppIdentifiers=o),s.start();let b=await k(x.api.console.projects.apiKeys(e),N.POST,g);s.succeed("\u2705 API Key created successfully!"),console.log("Key ID:",b.apiKey._id),console.log("\u{1F512} Key Secret:",b.apiKey.clientSecret),a==="server"&&t==="production"&&console.log("Please save these credentials securely. The key secret will not be shown again."),process.exit(0)}catch(a){s.fail(`\u274C Failed to create key: ${a instanceof Error?a.message:"Unknown error"}`),process.exit(1)}}l();l();import{spawn as wr}from"child_process";var st=class{output="";pager;constructor(){this.pager=wr("less",["-R"],{stdio:["pipe","inherit","inherit"]}),this.pager.on("exit",e=>{console.log(this.output),process.exit(e??0)})}add(e){this.output+=e}shouldUsePager(){let e=process.stdout.rows;return this.output.split(`
10
- `).length>e}write(){this.shouldUsePager()?(this.pager.stdin?.write(this.output),this.pager.stdin?.end()):this.pager.kill()}};import at from"chalk";async function rt(t){let e=await M(),s=await F();s||(console.error(`There is no project selected, please first run \`${w(R.projects.select)}\``),process.exit(1)),t&&!At.includes(t)&&(console.error("Invalid key type. Please use 'server' or 'client'."),process.exit(1));let a=D("Fetching API keys...");try{a.start();let r=await k(x.api.console.projects.apiKeys(s)),n=t?r.filter(d=>d.usageOrigin===t):r;if(n.length===0)return a.succeed(`\u{1F50D} No API keys found for this project. To create a new API key, run \`${w(R.keys.create)}\``),process.exit(0);a.succeed("\u{1F4CC} List of API Keys:");let o=new st,i=at.bold.magenta("=========");n.forEach((d,u)=>{o.add(`
7
+ `),await Er({message:"Do you want to select this project?"})&&(await Ne(r._id),console.log(`\u2705Project '${s}' selected`)),process.exit(0)}catch(s){t.fail(`\u274C Failed to create project: ${s instanceof Error?s.message:"Unknown error"}`),process.exit(1)}}l();async function Qe(){let e=await F();e||(console.error(`No project selected. Please select a project first using \`${R(N.projects.select)}\``),process.exit(1));let t=D("Fetching project details...").start();try{let s=await ae(e);s||(t.fail("Project not found"),process.exit(1)),t.succeed("Fetched project details"),console.log(`
8
+ \u{1F4CC} Project Details:`),console.log(`Name: ${s.name}`),console.log(`ID: ${s.kableClientId}`),console.log(`Wallet Type: ${s.addons.nonCustodialWallets?"Smart":"Custodial"}`),process.exit(0)}catch(s){t.fail("Failed to fetch project details"),console.error("Error:",s instanceof Error?s.message:"Unknown error"),process.exit(1)}}l();l();import{select as Ks,checkbox as Lr}from"@inquirer/prompts";l();import{Separator as jr}from"@inquirer/prompts";l();l();l();l();var bt={WALLET_CREATE:"wallets.create",WALLET_READ:"wallets.read",WALLET_NFT_READ:"wallets:nfts.read",WALLET_BALANCE_READ:"wallets:balance.read",WALLET_TRANSACTION_CREATE:"wallets:transactions.create",WALLET_TRANSACTION_SIGN:"wallets:transactions.sign",WALLET_TRANSACTION_READ:"wallets:transactions.read",WALLET_SIGNATURES_CREATE:"wallets:signatures.create",WALLET_SIGNATURES_READ:"wallets:signatures.read",CREDENTIALS_READ:"credentials.read",CREDENTIALS_DECRYPT:"credentials.decrypt",ORDERS_CREATE:"orders.create",ORDERS_WS_CREATE:"orders.ws.create",ORDERS_WS_SEARCH:"orders.ws.search",WALLET_FUND:"wallets.fund",TOKENS_READ:"tokens.read"},Cr={},w={...bt,...Cr};var br={NFTS_MINT:"nfts.mint"},P={COLLECTIONS_CREATE:"collections.create",COLLECTIONS_UPDATE:"collections.update",COLLECTIONS_READ:"collections.read",NFTS_CREATE:"nfts.create",NFTS_UPDATE:"nfts.update",NFTS_DELETE:"nfts.delete",NFTS_READ:"nfts.read",NFTS_TRANSFER:"nfts.transfer",CREDENTIALS_TEMPLATE_CREATE:"credentials:templates.create",CREDENTIALS_CREATE:"credentials.create",CREDENTIALS_DELETE:"credentials.delete",WALLET_NFT_TRANSFER:"wallets:nfts.transfer",WALLET_MESSAGE_SIGN:"wallets:messages.sign",BILLING_READONLY:"billing.readonly",PROJECTS_USAGE_READ:"projects:usage.read",ORDERS_UPDATE:"orders.update",ORDERS_READ:"orders.read",SUBSCRIPTIONS_UPDATE:"subscriptions.update",SUBSCRIPTIONS_READ:"subscriptions.read",USERS_READ:"users.read",USERS_CREATE:"users.create",EXP_PROJECT_TRANSFER_CREATE:"experimental:projects:transfers.create",EXP_PROJECT_TRANSFER_READ:"experimental:projects:transfers.read",...bt},Ir={COLLECTIONS_WRITE:"collections.write",ALLOWLIST_WRITE:"allowlist.write",MERKLE_COMPUTE:"allowlist:merkle.compute",VERIFY_ADDRESSES:"allowlist:addresses.verify",ACCESSLIST_WRITE:"accesslist.write",ACCESSLIST_READ:"accesslist.read",WALLET_FROM_EMAIL:"user:wallets.read",WALLET_TRANSACTION_SIGN:"wallets:transactions.sign",WALLET_TRANSACTION_SEND:"wallets:transactions.send",NFT_CHECKOUT:"nfts.checkout"},Ar={MARKETPLACES_TOS_ACCEPT:"crossmint:marketplaces:tos.accept",FILEBASE_BUCKET_DELETE:"crossmint:filebase.buckets.delete",GOD:"god"},$i={...P,...Ir,...Ar,...br};l();l();var _={MINTING_API:"minting_api",WALLETS:"wallets_api",PAYMENTS:"payments",PROJECT_API:"project_api",CREDENTIALS_API:"credentials_api",USERS:"users"},It={[_.MINTING_API]:"Minting API",[_.WALLETS]:"Wallet API",[_.PAYMENTS]:"Payments",[_.PROJECT_API]:"Project Admin",[_.CREDENTIALS_API]:"Verifiable Credentials",[_.USERS]:"Users"};var Pr=[{value:w.ORDERS_CREATE,title:"Create an order",description:"Create an order for headless checkout.",category:_.PAYMENTS,projectPermission:null,dangerMessage:null}],xr=[{value:w.ORDERS_WS_CREATE,title:"Create worldstore order",description:"Create an order for a Worldstore listing.",category:_.PAYMENTS,projectPermission:null,dangerMessage:null},{value:w.ORDERS_WS_SEARCH,title:"Search worldstore listings",description:"Search Worldstore listings.",category:_.PAYMENTS,projectPermission:null,dangerMessage:null}],wr=[{value:w.TOKENS_READ,title:"Read tokens",description:"Retrieve availability and enabled features for tokens.",category:_.PAYMENTS,projectPermission:null,dangerMessage:null}],Xe=[{value:w.WALLET_READ,title:"Read wallet",description:"Retrieve all wallets for a user.",category:_.WALLETS,projectPermission:null,dangerMessage:null},{value:w.WALLET_CREATE,title:"Create wallet",description:"Create a wallet for a user.",category:_.WALLETS,projectPermission:null,dangerMessage:null},{value:w.WALLET_TRANSACTION_CREATE,title:"Create Transaction",description:"Create a transaction from a user's wallet.",category:_.WALLETS,projectPermission:null,dangerMessage:"Sensitive scope: misuse of this scope may result in unauthorized wallet transactions."},{value:w.WALLET_TRANSACTION_SIGN,title:"Sign Transaction",description:"Sign a transaction from a user's wallet.",category:_.WALLETS,projectPermission:null,dangerMessage:"Sensitive scope: misuse of this scope may result in unauthorized transaction signatures."},{value:w.WALLET_TRANSACTION_READ,title:"Read Transactions",description:"Read transactions from a user's wallet.",category:_.WALLETS,projectPermission:null,dangerMessage:null},{value:w.WALLET_SIGNATURES_CREATE,title:"Create Wallet Signatures",description:"Create a signature for a wallet.",category:_.WALLETS,projectPermission:null,dangerMessage:null},{value:w.WALLET_SIGNATURES_READ,title:"Read Wallet Signatures",description:"Read a signature for a wallet.",category:_.WALLETS,projectPermission:null,dangerMessage:null},{value:w.WALLET_NFT_READ,title:"Get NFTs",description:"Fetch the NFTs owned by a specific wallet address.",category:_.WALLETS,projectPermission:null,dangerMessage:null},{value:w.WALLET_BALANCE_READ,title:"Get wallet balance",description:"Get the balance of a specific wallet address.",category:_.WALLETS,projectPermission:null,dangerMessage:null},{value:w.CREDENTIALS_READ,title:"Get Credentials",description:"Fetch credentials, some endpoints will only work with a server side key.",category:_.CREDENTIALS_API,projectPermission:null,dangerMessage:null},{value:w.CREDENTIALS_DECRYPT,title:"Decrypt Credentials",description:"Decrypt credentials, mainly used by our client side SDK.",category:_.CREDENTIALS_API,projectPermission:null,dangerMessage:null},{value:w.WALLET_FUND,title:"Fund Wallet",description:"Send funds to a wallet.",category:_.WALLETS,projectPermission:null,dangerMessage:null},...Pr,...xr,...wr];var Rr=[{value:P.ORDERS_READ,title:"Get order",description:"Get an existing order for headless checkout.",category:_.PAYMENTS,projectPermission:null,dangerMessage:null},{value:P.ORDERS_UPDATE,title:"Update order",description:"Update an existing order for headless checkout.",category:_.PAYMENTS,projectPermission:null,dangerMessage:null}],Nr=[{value:P.SUBSCRIPTIONS_UPDATE,title:"Update a subscription",description:"Be able to update and cancel subscriptions",category:_.PAYMENTS,projectPermission:J.SUBSCRIPTIONS,dangerMessage:null},{value:P.SUBSCRIPTIONS_READ,title:"Retrieve subscription information",description:"Be able to read subscription information",category:_.PAYMENTS,projectPermission:J.SUBSCRIPTIONS,dangerMessage:null}],At=[...Xe,{value:P.NFTS_CREATE,title:"Mint NFTs",description:"Mint your NFTs and deliver them to a wallet or to an email address.",category:_.MINTING_API,projectPermission:null,dangerMessage:null},{value:P.NFTS_UPDATE,title:"Update NFTs",description:"Update a minted NFT's metadata on IPFS (image, description, name...).",category:_.MINTING_API,projectPermission:null,dangerMessage:null},{value:P.NFTS_READ,title:"Read NFTs",description:"Retrieve all metadata for an NFT.",category:_.MINTING_API,projectPermission:null,dangerMessage:null},{value:P.NFTS_DELETE,title:"Burn NFTs",description:"Burn a specific NFT within a collection.",category:_.MINTING_API,projectPermission:null,dangerMessage:"Sensitive scope: misuse of this scope may result in permanent loss of user assets."},{value:P.NFTS_TRANSFER,title:"Transfer NFTs",description:"Transfer an NFT to a different wallet.",category:_.MINTING_API,projectPermission:null,dangerMessage:null},{value:P.COLLECTIONS_CREATE,title:"Create collection",description:"Create a collection of NFTs.",category:_.MINTING_API,projectPermission:null,dangerMessage:null},{value:P.COLLECTIONS_UPDATE,title:"Update collection",description:"Update information for an existing collection (image, name, royalties...).",category:_.MINTING_API,projectPermission:null,dangerMessage:null},{value:P.COLLECTIONS_READ,title:"Read collections",description:"Retrieve the information about a specific collection.",category:_.MINTING_API,projectPermission:null,dangerMessage:null},{value:P.CREDENTIALS_TEMPLATE_CREATE,title:"Create Credentials Templates",description:"Create a template for your credentials.",category:_.CREDENTIALS_API,projectPermission:null,dangerMessage:null},{value:P.CREDENTIALS_CREATE,title:"Create Credentials and Types",description:"Issue your credentials and create credential types",category:_.CREDENTIALS_API,projectPermission:null,dangerMessage:null},{value:P.CREDENTIALS_DELETE,title:"Revoke Credentials",description:"Revoke a credential issued to a subject.",category:_.CREDENTIALS_API,projectPermission:null,dangerMessage:null},{value:P.WALLET_NFT_TRANSFER,title:"Transfer NFTs",description:"Transfer an NFT from a user's wallet.",category:_.WALLETS,projectPermission:J.WHITELABEL_WALLET_API,dangerMessage:"Sensitive scope: misuse of this scope may result in permanent loss of user assets."},{value:P.WALLET_MESSAGE_SIGN,title:"Sign Messages",description:"Sign a message from a user's wallet.",category:_.WALLETS,projectPermission:null,dangerMessage:null},{value:P.BILLING_READONLY,title:"Get balance",description:"Get balance in credits for a project.",category:_.PROJECT_API,projectPermission:J.BILLING_API,dangerMessage:null},{value:P.PROJECTS_USAGE_READ,title:"Get usage",description:"Get usage for the different products in a project.",category:_.PROJECT_API,projectPermission:null,dangerMessage:null},{value:P.USERS_READ,title:"Get user",description:"Get user information.",category:_.USERS,projectPermission:null,dangerMessage:null},{value:P.USERS_CREATE,title:"Create user",description:"Create a user.",category:_.USERS,projectPermission:null,dangerMessage:null},{value:P.EXP_PROJECT_TRANSFER_CREATE,title:"Create project transfers",description:"Create outbound transfers from the project balance to external wallets.",category:_.PROJECT_API,projectPermission:J.PROJECT_TRANSFERS,dangerMessage:"This allows the API key holder to initiate transfers of funds from the project balance to any wallet address."},{value:P.EXP_PROJECT_TRANSFER_READ,title:"Read project transfers",description:"View transfer history and details for outbound transfers from the project balance.",category:_.PROJECT_API,projectPermission:J.PROJECT_TRANSFERS,dangerMessage:null},...Nr,...Rr];l();l();var et={USERS_CREATE:"users.create",USERS_READ:"users.read"},Qi={...w,...et};var Pt=[...Xe,{value:et.USERS_CREATE,title:"Create users",description:"Create users / allow them to sign up",category:_.USERS,projectPermission:null,dangerMessage:null},{value:et.USERS_READ,title:"Read users",description:"Get profile info for user accounts",category:_.USERS,projectPermission:null,dangerMessage:null}];l();var xt=["server","client"];function tt(e,t,s,a=[]){let n=(e==="server"?At:Pt).reduce((o,i)=>{let{title:d,description:u,value:g,category:b}=i;return o[b]||(o[b]=[]),kr(i,t,s)||o[b].push({name:`${d} (${g})`,value:g,description:u,checked:a.includes(g)}),o},{});return Object.entries(n).flatMap(([o,i])=>[new jr(It[o]),...i])}function kr(e,t,s){return t==="production"&&e.projectPermission!=null&&s?.addons!=null&&!s.addons[e.projectPermission]}l();import{input as Ws}from"@inquirer/prompts";function Or(e){try{return new URL(e),!0}catch{return!1}}async function st(e,t){let s=[],a=[],r=t?`
9
+ Press [tab] to edit or [enter] to confirm current value`:"";if(e==="desktop")return console.log(`
10
+ \u26A0\uFE0F Security Warning: Desktop/CLI keys have no origin restrictions. If this key is leaked, it can be used from anywhere.
11
+ `),{whitelistedOrigins:[],whitelistedAppIdentifiers:[]};if(e==="web"){let n=await Ws({default:t?.join(","),message:`Enter whitelisted domain or localhost (e.g., https://www.yourdomain.com) (separate multiple domains with a comma):${r}`,validate:o=>{let i=o.split(",");for(let d of i)if(!Or(d))return`Invalid domain: ${d}. Please enter a valid URL (e.g., https://www.yourdomain.com)`;return!0}});s.push(...n.split(",").map(o=>o.trim()))}else if(e==="mobile"){let n=await Ws({default:t?.join(","),message:`Enter iOS bundle ID or Android package name (e.g., com.company.appname) (separate multiple domains with a comma):${r}`,validate:o=>{let i=o.split(",");for(let d of i)if(d.trim().length===0)return"App identifier cannot be empty";return!0}});a.push(...n.split(",").map(o=>o.trim()))}return{whitelistedOrigins:s,whitelistedAppIdentifiers:a}}async function at(){let e=await M(),t=await F();e||(console.error(`There is no environment selected, please first run \`${R(N.login)}\``),process.exit(1)),t||(console.error(`There is no project selected, please first run \`${R(N.projects.select)}\``),process.exit(1));let s=D("Creating key...");try{let a=await Ks({message:"Select Key Usage:",choices:[{name:"Server side",value:"server"},{name:"Client side",value:"client"}]}),r,n,o;a==="client"&&(r=await Ks({message:"Select client platform:",choices:[{name:"Web",value:"web"},{name:"Mobile",value:"mobile"},{name:"Desktop/CLI (no origin restrictions)",value:"desktop"}]}),{whitelistedOrigins:n,whitelistedAppIdentifiers:o}=await st(r));let i=await ae(t);i||(console.error(`\u274C Project not found, please run \`${R(N.projects.select)}\``),process.exit(1));let d=tt(a,e,i),u=await Lr({message:`Select scopes for ${a} key:`,choices:d,validate:Le=>Le.length===0?"At least one scope must be selected":!0}),g={usageOrigin:a,scopes:u};a==="client"&&(g.whitelistedOrigins=n,g.whitelistedAppIdentifiers=o,g.clientType=r),s.start();let b=await k(x.api.console.projects.apiKeys(t),j.POST,g);s.succeed("\u2705 API Key created successfully!"),console.log("Key ID:",b.apiKey._id),console.log("\u{1F512} Key Secret:",b.apiKey.clientSecret),a==="server"&&e==="production"&&console.log("Please save these credentials securely. The key secret will not be shown again."),process.exit(0)}catch(a){s.fail(`\u274C Failed to create key: ${a instanceof Error?a.message:"Unknown error"}`),process.exit(1)}}l();l();import{spawn as $r}from"child_process";var rt=class{output="";pager;constructor(){this.pager=$r("less",["-R"],{stdio:["pipe","inherit","inherit"]}),this.pager.on("exit",t=>{console.log(this.output),process.exit(t??0)})}add(t){this.output+=t}shouldUsePager(){let t=process.stdout.rows;return this.output.split(`
12
+ `).length>t}write(){this.shouldUsePager()?(this.pager.stdin?.write(this.output),this.pager.stdin?.end()):this.pager.kill()}};import nt from"chalk";async function ot(e){let t=await M(),s=await F();s||(console.error(`There is no project selected, please first run \`${R(N.projects.select)}\``),process.exit(1)),e&&!xt.includes(e)&&(console.error("Invalid key type. Please use 'server' or 'client'."),process.exit(1));let a=D("Fetching API keys...");try{a.start();let r=await k(x.api.console.projects.apiKeys(s)),n=e?r.filter(d=>d.usageOrigin===e):r;if(n.length===0)return a.succeed(`\u{1F50D} No API keys found for this project. To create a new API key, run \`${R(N.keys.create)}\``),process.exit(0);a.succeed("\u{1F4CC} List of API Keys:");let o=new rt,i=nt.bold.magenta("=========");n.forEach((d,u)=>{o.add(`
11
13
  ${i}
12
14
 
13
- `),o.add(`${at.bold(`${u+1}. Key ID:`)} ${d._id}
14
- `);let g=d.usageOrigin==="server"&&e==="production"?`******************${d.clientSecret.slice(-4)}`:d.clientSecret;o.add(` ${at.bold("Key Secret:")} ${g}
15
+ `),o.add(`${nt.bold(`${u+1}. Key ID:`)} ${d._id}
16
+ `);let g=d.usageOrigin==="server"&&t==="production"?`******************${d.clientSecret.slice(-4)}`:d.clientSecret;o.add(` ${nt.bold("Key Secret:")} ${g}
15
17
 
16
- `);let b=[["Type",H(d.usageOrigin)],["Created By",d.createdBy],["Created",d.createdAt?new Date(d.createdAt).toLocaleString():void 0],["Scopes",d.scopes.join(", ")]];d.usageOrigin==="client"&&(d.whitelistedOrigins.length>0&&b.push(["Whitelisted Origins",d.whitelistedOrigins.join(", ")]),d.whitelistedAppIdentifiers&&d.whitelistedAppIdentifiers.length>0&&b.push(["Whitelisted App IDs",d.whitelistedAppIdentifiers.join(", ")])),b.forEach(([Oe,_e])=>{_e!==void 0&&o.add(`${at.cyan(Oe.padEnd(20))} ${_e}
18
+ `);let b=[["Type",H(d.usageOrigin)],["Created By",d.createdBy],["Created",d.createdAt?new Date(d.createdAt).toLocaleString():void 0],["Scopes",d.scopes.join(", ")]];d.usageOrigin==="client"&&(d.whitelistedOrigins.length>0&&b.push(["Whitelisted Origins",d.whitelistedOrigins.join(", ")]),d.whitelistedAppIdentifiers&&d.whitelistedAppIdentifiers.length>0&&b.push(["Whitelisted App IDs",d.whitelistedAppIdentifiers.join(", ")])),b.forEach(([Le,ve])=>{ve!==void 0&&o.add(`${nt.cyan(Le.padEnd(20))} ${ve}
17
19
  `)})}),o.add(`
18
- ${i}`),o.write()}catch(r){a.fail(`\u274C Failed to fetch keys: ${r instanceof Error?r.message:"Unknown error"}`),process.exit(1)}}l();import{confirm as Rr}from"@inquirer/prompts";async function nt(t){let e=await F();e||(console.error(`There is no project selected, please first run \`${w(R.projects.select)}\``),process.exit(1));let s=D("Deleting API key...");try{await Rr({message:"Are you sure you want to delete this API key? This action cannot be undone.",default:!1})||(s.fail("Operation cancelled"),process.exit(0)),s.start(),await k(x.api.console.projects.apiKeys(e,t),N.DELETE),s.succeed("\u2705 API key deleted successfully!")}catch(a){s.fail(`\u274C Failed to delete API key: ${a instanceof Error?a.message:"Unknown error"}`),process.exit(1)}}l();import{checkbox as jr}from"@inquirer/prompts";async function ot(t){let e=await M();e||(console.error(`There is no environment selected, please first run \`${w(R.login)}\``),process.exit(1));let s=await F();s||(console.error(`There is no project selected, please first run \`${w(R.projects.select)}\``),process.exit(1));let a=D("Fetching API key...");try{a.start();let n=(await k(x.api.console.projects.apiKeys(s))).find(b=>b._id.toString()===t);n||(a.fail("API key not found"),process.exit(1));let o,i;n.usageOrigin==="client"&&(a.succeed("\u{1F4CC} Current API Key Whitelisted Origins:"),{whitelistedOrigins:o,whitelistedAppIdentifiers:i}=await et(n.whitelistedOrigins?.length>0?"web":"mobile",n.whitelistedOrigins?.length>0?n.whitelistedOrigins:n.whitelistedAppIdentifiers)),a.succeed("\u{1F4CC} Current API Key Scopes:");let d=await se(s);d||(console.error(`\u274C Project not found, please run \`${w(R.projects.select)}\``),process.exit(1));let u=Xe(n.usageOrigin,e,d,n.scopes),g=await jr({message:`Select scopes for ${n.usageOrigin} key:`,choices:u,validate:b=>b.length===0?"At least one scope must be selected":!0});if(Nr(n,g)||kr(n,o,i)){a.start("Updating API key scopes...");let b={apiKeyId:t,...n,scopes:g};n.usageOrigin==="client"&&(b.whitelistedOrigins=o,b.whitelistedAppIdentifiers=i),await k(x.api.console.projects.apiKeys(s),N.PUT,b)}a.succeed("\u2705 API key scopes updated successfully!")}catch(r){a.fail(`\u274C Failed to update API key: ${r instanceof Error?r.message:"Unknown error"}`),process.exit(1)}}function Nr(t,e){return t.scopes.some(s=>!e.includes(s))||e.some(s=>!t.scopes.includes(s))}function kr(t,e,s){return t.usageOrigin==="client"&&(t.whitelistedOrigins?.some(a=>!e?.includes(a))||e?.some(a=>!t.whitelistedOrigins?.includes(a))||t.whitelistedAppIdentifiers?.some(a=>!s?.includes(a))||s?.some(a=>!t.whitelistedAppIdentifiers?.includes(a)))}ye.name(yt).description("Crossmint CLI Tool").version(gt().version);var it=ye.command(A.KEYS).description("API Keys management commands");it.command(A.CREATE).description("Create a new API Key").action(tt);it.command(`${A.DELETE} <key-id>`).description("Delete an API Key").action(nt);it.command(`${A.EDIT} <key-id>`).description("Edit the scopes of an API Key").action(ot);it.command(`${A.LIST} [type]`).description("List all API Keys (optionally filter by type: server|client)").action(rt);ye.command(A.LOGIN).description("Login to Crossmint").action(vt);ye.command(A.LOGOUT).description("Logout from Crossmint").action(Tt);var Pt=ye.command(A.PROJECTS).description("Project management commands");Pt.command(A.CREATE).description("Create a new project").action(Ye).option("-n, --name <name>","Project name");Pt.command(A.DETAILS).description("Show project details").action(qe);Pt.command(A.SELECT).description("Select a project").action(we);ye.command(A.WHOAMI).description("Show current user and environment").action(Et);ye.parse(process.argv);
20
+ ${i}`),o.write()}catch(r){a.fail(`\u274C Failed to fetch keys: ${r instanceof Error?r.message:"Unknown error"}`),process.exit(1)}}l();import{confirm as Dr}from"@inquirer/prompts";async function it(e){let t=await F();t||(console.error(`There is no project selected, please first run \`${R(N.projects.select)}\``),process.exit(1));let s=D("Deleting API key...");try{await Dr({message:"Are you sure you want to delete this API key? This action cannot be undone.",default:!1})||(s.fail("Operation cancelled"),process.exit(0)),s.start(),await k(x.api.console.projects.apiKeys(t,e),j.DELETE),s.succeed("\u2705 API key deleted successfully!")}catch(a){s.fail(`\u274C Failed to delete API key: ${a instanceof Error?a.message:"Unknown error"}`),process.exit(1)}}l();import{checkbox as Mr}from"@inquirer/prompts";async function ct(e){let t=await M();t||(console.error(`There is no environment selected, please first run \`${R(N.login)}\``),process.exit(1));let s=await F();s||(console.error(`There is no project selected, please first run \`${R(N.projects.select)}\``),process.exit(1));let a=D("Fetching API key...");try{a.start();let n=(await k(x.api.console.projects.apiKeys(s))).find(b=>b._id.toString()===e);n||(a.fail("API key not found"),process.exit(1));let o,i;n.usageOrigin==="client"&&(a.succeed("\u{1F4CC} Current API Key Whitelisted Origins:"),{whitelistedOrigins:o,whitelistedAppIdentifiers:i}=await st(n.whitelistedOrigins?.length>0?"web":"mobile",n.whitelistedOrigins?.length>0?n.whitelistedOrigins:n.whitelistedAppIdentifiers)),a.succeed("\u{1F4CC} Current API Key Scopes:");let d=await ae(s);d||(console.error(`\u274C Project not found, please run \`${R(N.projects.select)}\``),process.exit(1));let u=tt(n.usageOrigin,t,d,n.scopes),g=await Mr({message:`Select scopes for ${n.usageOrigin} key:`,choices:u,validate:b=>b.length===0?"At least one scope must be selected":!0});if(Ur(n,g)||Vr(n,o,i)){a.start("Updating API key scopes...");let b={apiKeyId:e,...n,scopes:g};n.usageOrigin==="client"&&(b.whitelistedOrigins=o,b.whitelistedAppIdentifiers=i),await k(x.api.console.projects.apiKeys(s),j.PUT,b)}a.succeed("\u2705 API key scopes updated successfully!")}catch(r){a.fail(`\u274C Failed to update API key: ${r instanceof Error?r.message:"Unknown error"}`),process.exit(1)}}function Ur(e,t){return e.scopes.some(s=>!t.includes(s))||t.some(s=>!e.scopes.includes(s))}function Vr(e,t,s){return e.usageOrigin==="client"&&(e.whitelistedOrigins?.some(a=>!t?.includes(a))||t?.some(a=>!e.whitelistedOrigins?.includes(a))||e.whitelistedAppIdentifiers?.some(a=>!s?.includes(a))||s?.some(a=>!e.whitelistedAppIdentifiers?.includes(a)))}_e.name(vt).description("Crossmint CLI Tool").version(_t().version);var lt=_e.command(A.KEYS).description("API Keys management commands");lt.command(A.CREATE).description("Create a new API Key").action(at);lt.command(`${A.DELETE} <key-id>`).description("Delete an API Key").action(it);lt.command(`${A.EDIT} <key-id>`).description("Edit the scopes of an API Key").action(ct);lt.command(`${A.LIST} [type]`).description("List all API Keys (optionally filter by type: server|client)").action(ot);_e.command(A.LOGIN).description("Login to Crossmint").option("-e, --env <environment>","Environment to login to (staging or production)").action(Tt);_e.command(A.LOGOUT).description("Logout from Crossmint").action(Ct);var wt=_e.command(A.PROJECTS).description("Project management commands");wt.command(A.CREATE).description("Create a new project").action(Je).option("-n, --name <name>","Project name");wt.command(A.DETAILS).description("Show project details").action(Qe);wt.command(A.SELECT).description("Select a project").action(Re);_e.command(A.WHOAMI).description("Show current user and environment").action(St);_e.parse(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crossmint/cli",
3
- "version": "1.1.11",
3
+ "version": "1.1.13",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "repository": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crossmint/cli",
3
- "version": "1.1.11",
3
+ "version": "1.1.13",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "repository": {
@@ -22,7 +22,11 @@ keysCommand
22
22
  .description("List all API Keys (optionally filter by type: server|client)")
23
23
  .action(keysCommands.list);
24
24
 
25
- program.command(CLI_TOKENS.LOGIN).description("Login to Crossmint").action(login);
25
+ program
26
+ .command(CLI_TOKENS.LOGIN)
27
+ .description("Login to Crossmint")
28
+ .option("-e, --env <environment>", "Environment to login to (staging or production)")
29
+ .action(login);
26
30
  program.command(CLI_TOKENS.LOGOUT).description("Logout from Crossmint").action(logout);
27
31
 
28
32
  const projectsCommand = program.command(CLI_TOKENS.PROJECTS).description("Project management commands");
@@ -109,6 +109,7 @@ describe("createKey", () => {
109
109
  scopes: [APIKeyScopes.WALLET_READ],
110
110
  whitelistedOrigins: ["https://example.com"],
111
111
  whitelistedAppIdentifiers: [],
112
+ clientType: "web",
112
113
  }
113
114
  );
114
115
  expect(createSpinner).toHaveBeenCalledWith("Creating key...");
@@ -144,6 +145,7 @@ describe("createKey", () => {
144
145
  scopes: [APIKeyScopes.WALLET_READ],
145
146
  whitelistedOrigins: [],
146
147
  whitelistedAppIdentifiers: ["com.example.app"],
148
+ clientType: "mobile",
147
149
  }
148
150
  );
149
151
  });
@@ -172,6 +174,7 @@ describe("createKey", () => {
172
174
  scopes: [APIKeyScopes.WALLET_READ],
173
175
  whitelistedOrigins: ["https://example.com", "https://api.example.com", "http://localhost:3000"],
174
176
  whitelistedAppIdentifiers: [],
177
+ clientType: "web",
175
178
  }
176
179
  );
177
180
  });
@@ -201,10 +204,41 @@ describe("createKey", () => {
201
204
  scopes: [APIKeyScopes.WALLET_READ],
202
205
  whitelistedOrigins: [],
203
206
  whitelistedAppIdentifiers: ["com.example.app", "com.example.app2", "com.example.app3"],
207
+ clientType: "mobile",
204
208
  }
205
209
  );
206
210
  });
207
211
 
212
+ it("should create a client API key for desktop platform successfully", async () => {
213
+ vi.mocked(select)
214
+ .mockResolvedValueOnce("client" as APIKeyUsageOrigin)
215
+ .mockResolvedValueOnce("desktop");
216
+ vi.mocked(checkbox).mockResolvedValueOnce([APIKeyScopes.WALLET_READ]);
217
+
218
+ const mockResponse = {
219
+ apiKey: {
220
+ clientSecret: "test-client-secret",
221
+ },
222
+ };
223
+ vi.mocked(fetchAuthenticated).mockResolvedValueOnce(mockResponse);
224
+
225
+ await createKey();
226
+
227
+ expect(fetchAuthenticated).toHaveBeenCalledWith(
228
+ expect.stringContaining(`/api/console/projects/${mockProjectId}/apiKeys`),
229
+ "POST",
230
+ {
231
+ usageOrigin: "client",
232
+ scopes: [APIKeyScopes.WALLET_READ],
233
+ whitelistedOrigins: [],
234
+ whitelistedAppIdentifiers: [],
235
+ clientType: "desktop",
236
+ }
237
+ );
238
+ expect(createSpinner).toHaveBeenCalledWith("Creating key...");
239
+ expect(mockSpinner.succeed).toHaveBeenCalledWith("✅ API Key created successfully!");
240
+ });
241
+
208
242
  it("should handle API errors gracefully", async () => {
209
243
  vi.mocked(select).mockResolvedValueOnce("server" as APIKeyUsageOrigin);
210
244
  vi.mocked(checkbox).mockResolvedValueOnce([APIKeyScopes.NFTS_READ]);
@@ -42,6 +42,7 @@ export default async function createKey() {
42
42
  choices: [
43
43
  { name: "Web", value: "web" },
44
44
  { name: "Mobile", value: "mobile" },
45
+ { name: "Desktop/CLI (no origin restrictions)", value: "desktop" },
45
46
  ],
46
47
  });
47
48
  ({ whitelistedOrigins, whitelistedAppIdentifiers } =
@@ -74,6 +75,7 @@ export default async function createKey() {
74
75
  if (keyType === "client") {
75
76
  payload.whitelistedOrigins = whitelistedOrigins;
76
77
  payload.whitelistedAppIdentifiers = whitelistedAppIdentifiers;
78
+ payload.clientType = clientPlatform;
77
79
  }
78
80
  spinner.start();
79
81
 
@@ -84,4 +84,50 @@ describe("login", () => {
84
84
  expect(consoleErrorSpy).toHaveBeenCalledWith(expect.stringContaining("Login failed"));
85
85
  expect(processExitSpy).toHaveBeenCalledWith(1);
86
86
  });
87
+
88
+ it("should skip interactive prompt when --env flag is provided", async () => {
89
+ const mockUrl = "https://api.crossmint.com";
90
+ const mockCodeChallenge = "mock-code-challenge";
91
+ const mockChildProcess = { pid: 123 } as ChildProcess;
92
+
93
+ vi.mocked(getCrossmintUrl).mockReturnValue(mockUrl);
94
+ vi.mocked(generateCodeChallenge).mockResolvedValue(mockCodeChallenge);
95
+ vi.mocked(server).mockResolvedValue(undefined);
96
+ vi.mocked(open).mockResolvedValue(mockChildProcess);
97
+
98
+ await login({ env: "staging" });
99
+
100
+ expect(select).not.toHaveBeenCalled();
101
+ expect(getCrossmintUrl).toHaveBeenCalledWith("staging");
102
+ expect(setEnvironment).toHaveBeenCalledWith("staging");
103
+ });
104
+
105
+ it("should accept production as --env flag value", async () => {
106
+ const mockUrl = "https://api.crossmint.com";
107
+ const mockCodeChallenge = "mock-code-challenge";
108
+ const mockChildProcess = { pid: 123 } as ChildProcess;
109
+
110
+ vi.mocked(getCrossmintUrl).mockReturnValue(mockUrl);
111
+ vi.mocked(generateCodeChallenge).mockResolvedValue(mockCodeChallenge);
112
+ vi.mocked(server).mockResolvedValue(undefined);
113
+ vi.mocked(open).mockResolvedValue(mockChildProcess);
114
+
115
+ await login({ env: "production" });
116
+
117
+ expect(select).not.toHaveBeenCalled();
118
+ expect(getCrossmintUrl).toHaveBeenCalledWith("production");
119
+ expect(setEnvironment).toHaveBeenCalledWith("production");
120
+ });
121
+
122
+ it("should exit with error for invalid --env flag value", async () => {
123
+ const consoleErrorSpy = vi.spyOn(console, "error");
124
+ const processExitSpy = vi.spyOn(process, "exit").mockImplementation(() => undefined as never);
125
+
126
+ // @ts-expect-error - testing an invalid environment
127
+ await login({ env: "invalid" });
128
+
129
+ expect(select).not.toHaveBeenCalled();
130
+ expect(consoleErrorSpy).toHaveBeenCalledWith(expect.stringContaining('Invalid environment "invalid"'));
131
+ expect(processExitSpy).toHaveBeenCalledWith(1);
132
+ });
87
133
  });
@@ -7,21 +7,37 @@ import { generateCodeChallenge } from "@/utils/oauth/codeChallenge";
7
7
  import server from "@/utils/oauth/server";
8
8
  import { getStytchConfig } from "@/utils/oauth/getStytchConfig";
9
9
  import { routes } from "@crossmint/common-consts";
10
+ import { isEmpty } from "@crossmint/common-types";
10
11
 
11
12
  const isLocal = process.env.NODE_ENV === "development";
12
13
 
13
- export default async function login() {
14
+ interface LoginOptions {
15
+ env?: Exclude<Environment, "local">;
16
+ }
17
+
18
+ export default async function login(options: LoginOptions = {}) {
14
19
  try {
15
20
  console.log("🔐 Crossmint CLI - Login");
16
21
 
17
- const environment = await select<Environment>({
18
- message: "Select environment:",
19
- choices: [
20
- { name: "Production", value: "production" },
21
- { name: "Staging", value: "staging" },
22
- ...(isLocal ? [{ name: "Local", value: "local" as Environment }] : []),
23
- ],
24
- });
22
+ let environment: Environment;
23
+
24
+ if (!isEmpty(options.env)) {
25
+ const validEnvs = ["staging", "production"];
26
+ if (!validEnvs.includes(options.env)) {
27
+ console.error(`Error: Invalid environment "${options.env}". Must be one of: ${validEnvs.join(", ")}`);
28
+ process.exit(1);
29
+ }
30
+ environment = options.env as Environment;
31
+ } else {
32
+ environment = await select<Environment>({
33
+ message: "Select environment:",
34
+ choices: [
35
+ { name: "Production", value: "production" },
36
+ { name: "Staging", value: "staging" },
37
+ ...(isLocal ? [{ name: "Local", value: "local" as Environment }] : []),
38
+ ],
39
+ });
40
+ }
25
41
 
26
42
  const baseUrl = getCrossmintUrl(environment);
27
43
  if (!baseUrl) {
@@ -36,7 +52,7 @@ export default async function login() {
36
52
  const { clientId } = await getStytchConfig();
37
53
 
38
54
  const codeChallenge = await generateCodeChallenge();
39
- const options = {
55
+ const authParams = {
40
56
  code_challenge: codeChallenge,
41
57
  code_challenge_method: "S256",
42
58
  scope: "full_access",
@@ -45,7 +61,7 @@ export default async function login() {
45
61
  redirect_uri: "http://127.0.0.1:3456/callback",
46
62
  client_id: clientId,
47
63
  };
48
- const authUrl = `${baseUrl}${routes.console.authorizeDevice.index(options)}`;
64
+ const authUrl = `${baseUrl}${routes.console.authorizeDevice.index(authParams)}`;
49
65
  console.log("Opening browser for authentication...");
50
66
  void open(authUrl);
51
67
  await serverPromise;
package/src/types/keys.ts CHANGED
@@ -2,7 +2,7 @@ import { APIKeyScopes } from "@crossmint/products-console-types";
2
2
 
3
3
  import { APIKeyUsageOrigin } from "@crossmint/products-console-types";
4
4
 
5
- export type ClientPlatform = "web" | "mobile";
5
+ export type ClientPlatform = "web" | "mobile" | "desktop";
6
6
 
7
7
  export type APIKeyPayload = {
8
8
  apiKeyId?: string;
@@ -10,4 +10,5 @@ export type APIKeyPayload = {
10
10
  scopes: APIKeyScopes[];
11
11
  whitelistedOrigins?: string[];
12
12
  whitelistedAppIdentifiers?: string[];
13
+ clientType?: ClientPlatform;
13
14
  };
@@ -16,6 +16,13 @@ export async function getWhitelistedOriginsAndAppIdentifiersPrompt(clientPlatfor
16
16
 
17
17
  const instructions = values ? "\nPress [tab] to edit or [enter] to confirm current value" : "";
18
18
 
19
+ if (clientPlatform === "desktop") {
20
+ console.log(
21
+ "\n⚠️ Security Warning: Desktop/CLI keys have no origin restrictions. If this key is leaked, it can be used from anywhere.\n"
22
+ );
23
+ return { whitelistedOrigins: [], whitelistedAppIdentifiers: [] };
24
+ }
25
+
19
26
  if (clientPlatform === "web") {
20
27
  const domains = await input({
21
28
  default: values?.join(","),