@canva/cli 0.0.1-beta.35 → 0.0.1-beta.36
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/cli.js +612 -612
- package/lib/cjs/index.cjs +3 -3
- package/lib/esm/index.mjs +4 -4
- package/package.json +1 -1
- package/templates/base/backend/routers/auth.ts +4 -4
- package/templates/base/backend/routers/oauth.ts +2 -2
- package/templates/base/scripts/ssl/ssl.ts +1 -1
- package/templates/base/scripts/start/app_runner.ts +6 -6
- package/templates/base/scripts/start/start.ts +1 -1
- package/templates/base/utils/backend/base_backend/create.ts +3 -3
- package/templates/base/utils/backend/bearer_middleware/bearer_middleware.ts +1 -1
- package/templates/base/utils/backend/jwt_middleware/jwt_middleware.ts +3 -3
- package/templates/base/utils/use_add_element.ts +1 -1
- package/templates/base/utils/use_feature_support.ts +1 -1
- package/templates/base/webpack.config.ts +1 -1
- package/templates/common/utils/backend/base_backend/create.ts +3 -3
- package/templates/common/utils/backend/jwt_middleware/jwt_middleware.ts +3 -3
- package/templates/common/utils/tests/table_wrapper.tests.ts +1 -1
- package/templates/common/utils/use_add_element.ts +1 -1
- package/templates/common/utils/use_feature_support.ts +1 -1
- package/templates/dam/backend/routers/dam.ts +2 -2
- package/templates/dam/backend/server.ts +1 -1
- package/templates/dam/scripts/ssl/ssl.ts +1 -1
- package/templates/dam/scripts/start/app_runner.ts +6 -6
- package/templates/dam/scripts/start/start.ts +1 -1
- package/templates/dam/src/app.tsx +1 -1
- package/templates/dam/src/index.tsx +1 -1
- package/templates/dam/utils/backend/base_backend/create.ts +3 -3
- package/templates/dam/utils/backend/jwt_middleware/jwt_middleware.ts +3 -3
- package/templates/dam/webpack.config.ts +1 -1
- package/templates/data_connector/scripts/ssl/ssl.ts +1 -1
- package/templates/data_connector/scripts/start/app_runner.ts +6 -6
- package/templates/data_connector/scripts/start/start.ts +1 -1
- package/templates/data_connector/src/api/data_source.ts +1 -1
- package/templates/data_connector/src/api/data_sources/designs.tsx +9 -9
- package/templates/data_connector/src/api/data_sources/templates.tsx +9 -9
- package/templates/data_connector/src/api/fetch_data_table.ts +1 -1
- package/templates/data_connector/src/api/tests/data_source.test.tsx +2 -2
- package/templates/data_connector/src/app.tsx +5 -5
- package/templates/data_connector/src/components/footer.tsx +1 -1
- package/templates/data_connector/src/components/header.tsx +1 -1
- package/templates/data_connector/src/context/app_context.tsx +1 -1
- package/templates/data_connector/src/entrypoint.tsx +7 -7
- package/templates/data_connector/src/home.tsx +2 -2
- package/templates/data_connector/src/index.tsx +5 -6
- package/templates/data_connector/src/pages/error.tsx +2 -2
- package/templates/data_connector/src/pages/login.tsx +7 -7
- package/templates/data_connector/src/routes/routes.tsx +1 -1
- package/templates/data_connector/src/utils/data_table.ts +1 -1
- package/templates/data_connector/src/utils/fetch_result.ts +1 -1
- package/templates/data_connector/src/utils/tests/data_table.test.ts +5 -5
- package/templates/data_connector/webpack.config.ts +1 -1
- package/templates/gen_ai/backend/server.ts +1 -1
- package/templates/gen_ai/scripts/ssl/ssl.ts +1 -1
- package/templates/gen_ai/scripts/start/app_runner.ts +6 -6
- package/templates/gen_ai/scripts/start/start.ts +1 -1
- package/templates/gen_ai/src/app.tsx +3 -3
- package/templates/gen_ai/src/components/footer.tsx +4 -4
- package/templates/gen_ai/src/components/image_grid.tsx +1 -1
- package/templates/gen_ai/src/components/loading_results.tsx +8 -8
- package/templates/gen_ai/src/components/prompt_input.tsx +3 -3
- package/templates/gen_ai/src/components/remaining_credits.tsx +1 -1
- package/templates/gen_ai/src/components/report_box.tsx +1 -1
- package/templates/gen_ai/src/components/tests/remaining_credit.tests.tsx +2 -2
- package/templates/gen_ai/src/home.tsx +2 -2
- package/templates/gen_ai/src/pages/error.tsx +2 -2
- package/templates/gen_ai/src/pages/results.tsx +1 -1
- package/templates/gen_ai/utils/backend/base_backend/create.ts +3 -3
- package/templates/gen_ai/utils/backend/bearer_middleware/bearer_middleware.ts +1 -1
- package/templates/gen_ai/webpack.config.ts +1 -1
- package/templates/hello_world/scripts/ssl/ssl.ts +1 -1
- package/templates/hello_world/scripts/start/app_runner.ts +6 -6
- package/templates/hello_world/scripts/start/start.ts +1 -1
- package/templates/hello_world/src/app.tsx +1 -1
- package/templates/hello_world/src/index.tsx +1 -1
- package/templates/hello_world/src/tests/app.tests.tsx +3 -3
- package/templates/hello_world/utils/use_add_element.ts +1 -1
- package/templates/hello_world/utils/use_feature_support.ts +1 -1
- package/templates/hello_world/webpack.config.ts +1 -1
package/lib/esm/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Copyright 2024 Canva Inc. All Rights Reserved.
|
|
2
|
-
var ft=Object.create;var Se=Object.defineProperty;var ht=Object.getOwnPropertyDescriptor;var mt=Object.getOwnPropertyNames;var vt=Object.getPrototypeOf,_t=Object.prototype.hasOwnProperty;var we=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var Fe=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),gt=(t,e)=>{for(var r in e)Se(t,r,{get:e[r],enumerable:!0})},yt=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of mt(e))!_t.call(t,n)&&n!==r&&Se(t,n,{get:()=>e[n],enumerable:!(s=ht(e,n))||s.enumerable});return t};var xt=(t,e,r)=>(r=t!=null?ft(vt(t)):{},yt(e||!t||!t.__esModule?Se(r,"default",{value:t,enumerable:!0}):r,t));var rt=Fe((
|
|
3
|
-
`);let s;for(;(s=
|
|
4
|
-
`),a=a.replace(/\\r/g,"\r")),e[n]=a}return e}function Fr(t){let e=it(t);t.path=e;let r=x.configDotenv(t);if(!r.parsed){let i=new Error(`MISSING_DATA: Cannot parse ${e} for an unknown reason`);throw i.code="MISSING_DATA",i}let s=at(t).split(","),n=s.length,a;for(let i=0;i<n;i++)try{let o=s[i].trim(),u=Ur(r,o);a=x.decrypt(u.ciphertext,u.key);break}catch(o){if(i+1>=n)throw o}return x.parse(a)}function Mr(t){console.log(`[dotenv@${$e}][WARN] ${t}`)}function Re(t){console.log(`[dotenv@${$e}][DEBUG] ${t}`)}function nt(t){console.log(`[dotenv@${$e}] ${t}`)}function at(t){return t&&t.DOTENV_KEY&&t.DOTENV_KEY.length>0?t.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function Ur(t,e){let r;try{r=new URL(e)}catch(o){if(o.code==="ERR_INVALID_URL"){let u=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw u.code="INVALID_DOTENV_KEY",u}throw o}let s=r.password;if(!s){let o=new Error("INVALID_DOTENV_KEY: Missing key part");throw o.code="INVALID_DOTENV_KEY",o}let n=r.searchParams.get("environment");if(!n){let o=new Error("INVALID_DOTENV_KEY: Missing environment part");throw o.code="INVALID_DOTENV_KEY",o}let a=`DOTENV_VAULT_${n.toUpperCase()}`,i=t.parsed[a];if(!i){let o=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${a} in your .env.vault file.`);throw o.code="NOT_FOUND_DOTENV_ENVIRONMENT",o}return{ciphertext:i,key:s}}function it(t){let e=null;if(t&&t.path&&t.path.length>0)if(Array.isArray(t.path))for(let r of t.path)Le.existsSync(r)&&(e=r.endsWith(".vault")?r:`${r}.vault`);else e=t.path.endsWith(".vault")?t.path:`${t.path}.vault`;else e=Oe.resolve(process.cwd(),".env.vault");return Le.existsSync(e)?e:null}function st(t){return t[0]==="~"?Oe.join(Dr.homedir(),t.slice(1)):t}function Gr(t){let e=!!(t&&t.debug),r=!!(t&&t.quiet);(e||!r)&&nt("Loading env from encrypted .env.vault");let s=x._parseVault(t),n=process.env;return t&&t.processEnv!=null&&(n=t.processEnv),x.populate(n,s,t),{parsed:s}}function Zr(t){let e=Oe.resolve(process.cwd(),".env"),r="utf8",s=!!(t&&t.debug),n=!!(t&&t.quiet);t&&t.encoding?r=t.encoding:s&&Re("No encoding is specified. UTF-8 is used by default");let a=[e];if(t&&t.path)if(!Array.isArray(t.path))a=[st(t.path)];else{a=[];for(let d of t.path)a.push(st(d))}let i,o={};for(let d of a)try{let h=x.parse(Le.readFileSync(d,{encoding:r}));x.populate(o,h,t)}catch(h){s&&Re(`Failed to load ${d} ${h.message}`),i=h}let u=process.env;if(t&&t.processEnv!=null&&(u=t.processEnv),x.populate(u,o,t),s||!n){let d=Object.keys(o).length,h=[];for(let k of a)try{let oe=Oe.relative(process.cwd(),k);h.push(oe)}catch{}nt(`injecting env (${d}) from ${h.join(",")}`)}return i?{parsed:o,error:i}:{parsed:o}}function zr(t){if(at(t).length===0)return x.configDotenv(t);let e=it(t);return e?x._configVault(t):(Mr(`You set DOTENV_KEY but you are missing a .env.vault file at ${e}. Did you forget to build it?`),x.configDotenv(t))}function Br(t,e){let r=Buffer.from(e.slice(-64),"hex"),s=Buffer.from(t,"base64"),n=s.subarray(0,12),a=s.subarray(-16);s=s.subarray(12,-16);try{let i=Vr.createDecipheriv("aes-256-gcm",r,n);return i.setAuthTag(a),`${i.update(s)}${i.final()}`}catch(i){let o=i instanceof RangeError,u=i.message==="Invalid key length",d=i.message==="Unsupported state or unable to authenticate data";if(o||u){let h=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw h.code="INVALID_DOTENV_KEY",h}else if(d){let h=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw h.code="DECRYPTION_FAILED",h}else throw i}}function Kr(t,e,r={}){let s=!!(r&&r.debug),n=!!(r&&r.override);if(typeof e!="object"){let a=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw a.code="OBJECT_REQUIRED",a}for(let a of Object.keys(e))Object.prototype.hasOwnProperty.call(t,a)?(n===!0&&(t[a]=e[a]),s&&Re(n===!0?`"${a}" is already defined and WAS overwritten`:`"${a}" is already defined and was NOT overwritten`)):t[a]=e[a]}var x={configDotenv:Zr,_configVault:Gr,_parseVault:Fr,config:zr,decrypt:Br,parse:$r,populate:Kr};F.exports.configDotenv=x.configDotenv;F.exports._configVault=x._configVault;F.exports._parseVault=x._parseVault;F.exports.config=x.config;F.exports.decrypt=x.decrypt;F.exports.parse=x.parse;F.exports.populate=x.populate;F.exports=x});function Me(t,e){if(t instanceof Promise)throw new Error(e)}function wt(t,e){let r={},s=[];for(let n in t){let a=t[n]["~standard"].validate(e[n]);if(Me(a,`Validation must be synchronous, but ${n} returned a Promise.`),a.issues){s.push(...a.issues.map(i=>({...i,message:i.message,path:[n,...i.path??[]]})));continue}r[n]=a.value}return s.length?{issues:s}:{value:r}}function Pe(t){let e=t.runtimeEnvStrict??t.runtimeEnv??process.env;if(t.emptyStringAsUndefined??!1)for(let[E,D]of Object.entries(e))D===""&&delete e[E];if(!!t.skipValidation)return e;let n=typeof t.client=="object"?t.client:{},a=typeof t.server=="object"?t.server:{},i=typeof t.shared=="object"?t.shared:{},o=t.isServer??(typeof window>"u"||"Deno"in window),u=o?{...a,...i,...n}:{...n,...i},d=t.createFinalSchema?.(u,o)["~standard"].validate(e)??wt(u,e);Me(d,"Validation must be synchronous");let h=t.onValidationError??(E=>{throw console.error("\u274C Invalid environment variables:",E),new Error("Invalid environment variables")}),k=t.onInvalidAccess??(()=>{throw new Error("\u274C Attempted to access a server-side environment variable on the client")});if(d.issues)return h(d.issues);let oe=E=>t.clientPrefix?!E.startsWith(t.clientPrefix)&&!(E in i):!0,ve=E=>o||!oe(E),ut=E=>E==="__esModule"||E==="$$typeof",lt=(t.extends??[]).reduce((E,D)=>Object.assign(E,D),{}),pt=Object.assign(lt,d.value);return new Proxy(pt,{get(E,D){if(typeof D=="string"&&!ut(D))return ve(D)?Reflect.get(E,D):k(D)}})}var z={};gt(z,{BRAND:()=>Yt,DIRTY:()=>B,EMPTY_PATH:()=>At,INVALID:()=>m,NEVER:()=>Cr,OK:()=>b,ParseStatus:()=>w,Schema:()=>g,ZodAny:()=>G,ZodArray:()=>$,ZodBigInt:()=>Y,ZodBoolean:()=>W,ZodBranded:()=>ge,ZodCatch:()=>ae,ZodDate:()=>q,ZodDefault:()=>ne,ZodDiscriminatedUnion:()=>Ee,ZodEffects:()=>R,ZodEnum:()=>re,ZodError:()=>A,ZodFirstPartyTypeKind:()=>v,ZodFunction:()=>Ne,ZodIntersection:()=>X,ZodIssueCode:()=>c,ZodLazy:()=>ee,ZodLiteral:()=>te,ZodMap:()=>fe,ZodNaN:()=>me,ZodNativeEnum:()=>se,ZodNever:()=>I,ZodNull:()=>H,ZodNullable:()=>P,ZodNumber:()=>K,ZodObject:()=>N,ZodOptional:()=>T,ZodParsedType:()=>p,ZodPipeline:()=>ye,ZodPromise:()=>Z,ZodReadonly:()=>ie,ZodRecord:()=>Ae,ZodSchema:()=>g,ZodSet:()=>he,ZodString:()=>U,ZodSymbol:()=>le,ZodTransformer:()=>R,ZodTuple:()=>S,ZodType:()=>g,ZodUndefined:()=>J,ZodUnion:()=>Q,ZodUnknown:()=>L,ZodVoid:()=>pe,addIssueToContext:()=>l,any:()=>rr,array:()=>ir,bigint:()=>Ht,boolean:()=>He,coerce:()=>Ir,custom:()=>We,date:()=>Qt,datetimeRegex:()=>Ke,defaultErrorMap:()=>V,discriminatedUnion:()=>ur,effect:()=>kr,enum:()=>yr,function:()=>vr,getErrorMap:()=>ce,getParsedType:()=>C,instanceof:()=>qt,intersection:()=>lr,isAborted:()=>ke,isAsync:()=>de,isDirty:()=>be,isValid:()=>M,late:()=>Wt,lazy:()=>_r,literal:()=>gr,makeIssue:()=>_e,map:()=>hr,nan:()=>Jt,nativeEnum:()=>xr,never:()=>nr,null:()=>tr,nullable:()=>Er,number:()=>Je,object:()=>or,objectUtil:()=>De,oboolean:()=>Rr,onumber:()=>Or,optional:()=>br,ostring:()=>Tr,pipeline:()=>Nr,preprocess:()=>Ar,promise:()=>wr,quotelessJson:()=>kt,record:()=>fr,set:()=>mr,setErrorMap:()=>Et,strictObject:()=>cr,string:()=>qe,symbol:()=>Xt,transformer:()=>kr,tuple:()=>pr,undefined:()=>er,union:()=>dr,unknown:()=>sr,util:()=>y,void:()=>ar});var y;(function(t){t.assertEqual=n=>{};function e(n){}t.assertIs=e;function r(n){throw new Error}t.assertNever=r,t.arrayToEnum=n=>{let a={};for(let i of n)a[i]=i;return a},t.getValidEnumValues=n=>{let a=t.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(let o of a)i[o]=n[o];return t.objectValues(i)},t.objectValues=n=>t.objectKeys(n).map(function(a){return n[a]}),t.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let a=[];for(let i in n)Object.prototype.hasOwnProperty.call(n,i)&&a.push(i);return a},t.find=(n,a)=>{for(let i of n)if(a(i))return i},t.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=s,t.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(y||(y={}));var De;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(De||(De={}));var p=y.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),C=t=>{switch(typeof t){case"undefined":return p.undefined;case"string":return p.string;case"number":return Number.isNaN(t)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":return Array.isArray(t)?p.array:t===null?p.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?p.promise:typeof Map<"u"&&t instanceof Map?p.map:typeof Set<"u"&&t instanceof Set?p.set:typeof Date<"u"&&t instanceof Date?p.date:p.object;default:return p.unknown}};var c=y.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"]),kt=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),A=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(a){return a.message},s={_errors:[]},n=a=>{for(let i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)s._errors.push(r(i));else{let o=s,u=0;for(;u<i.path.length;){let d=i.path[u];u===i.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(r(i))):o[d]=o[d]||{_errors:[]},o=o[d],u++}}};return n(this),s}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,y.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},s=[];for(let n of this.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):s.push(e(n));return{formErrors:s,fieldErrors:r}}get formErrors(){return this.flatten()}};A.create=t=>new A(t);var bt=(t,e)=>{let r;switch(t.code){case c.invalid_type:t.received===p.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case c.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,y.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:r=`Unrecognized key(s) in object: ${y.joinValues(t.keys,", ")}`;break;case c.invalid_union:r="Invalid input";break;case c.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${y.joinValues(t.options)}`;break;case c.invalid_enum_value:r=`Invalid enum value. Expected ${y.joinValues(t.options)}, received '${t.received}'`;break;case c.invalid_arguments:r="Invalid function arguments";break;case c.invalid_return_type:r="Invalid function return type";break;case c.invalid_date:r="Invalid date";break;case c.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:y.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case c.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case c.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case c.custom:r="Invalid input";break;case c.invalid_intersection_types:r="Intersection results could not be merged";break;case c.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case c.not_finite:r="Number must be finite";break;default:r=e.defaultError,y.assertNever(t)}return{message:r}},V=bt;var Ue=V;function Et(t){Ue=t}function ce(){return Ue}var _e=t=>{let{data:e,path:r,errorMaps:s,issueData:n}=t,a=[...r,...n.path||[]],i={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let o="",u=s.filter(d=>!!d).slice().reverse();for(let d of u)o=d(i,{data:e,defaultError:o}).message;return{...n,path:a,message:o}},At=[];function l(t,e){let r=ce(),s=_e({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===V?void 0:V].filter(n=>!!n)});t.common.issues.push(s)}var w=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let s=[];for(let n of r){if(n.status==="aborted")return m;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,r){let s=[];for(let n of r){let a=await n.key,i=await n.value;s.push({key:a,value:i})}return t.mergeObjectSync(e,s)}static mergeObjectSync(e,r){let s={};for(let n of r){let{key:a,value:i}=n;if(a.status==="aborted"||i.status==="aborted")return m;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(s[a.value]=i.value)}return{status:e.value,value:s}}},m=Object.freeze({status:"aborted"}),B=t=>({status:"dirty",value:t}),b=t=>({status:"valid",value:t}),ke=t=>t.status==="aborted",be=t=>t.status==="dirty",M=t=>t.status==="valid",de=t=>typeof Promise<"u"&&t instanceof Promise;var f;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(f||(f={}));var O=class{constructor(e,r,s,n){this._cachedPath=[],this.parent=e,this.data=r,this._path=s,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Ge=(t,e)=>{if(M(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 r=new A(t.common.issues);return this._error=r,this._error}}};function _(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:s,description:n}=t;if(e&&(r||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(i,o)=>{let{message:u}=t;return i.code==="invalid_enum_value"?{message:u??o.defaultError}:typeof o.data>"u"?{message:u??s??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:u??r??o.defaultError}},description:n}}var g=class{get description(){return this._def.description}_getType(e){return C(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:C(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new w,ctx:{common:e.parent.common,data:e.data,parsedType:C(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(de(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let s=this.safeParse(e,r);if(s.success)return s.data;throw s.error}safeParse(e,r){let s={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:C(e)},n=this._parseSync({data:e,path:s.path,parent:s});return Ge(s,n)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:C(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:r});return M(s)?{value:s.value}:{issues:r.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(s=>M(s)?{value:s.value}:{issues:r.common.issues})}async parseAsync(e,r){let s=await this.safeParseAsync(e,r);if(s.success)return s.data;throw s.error}async safeParseAsync(e,r){let s={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:C(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(de(n)?n:Promise.resolve(n));return Ge(s,a)}refine(e,r){let s=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,a)=>{let i=e(n),o=()=>a.addIssue({code:c.custom,...s(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,r){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof r=="function"?r(s,n):r),!1))}_refinement(e){return new R({schema:this,typeName:v.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return T.create(this,this._def)}nullable(){return P.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return $.create(this)}promise(){return Z.create(this,this._def)}or(e){return Q.create([this,e],this._def)}and(e){return X.create(this,e,this._def)}transform(e){return new R({..._(this._def),schema:this,typeName:v.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new ne({..._(this._def),innerType:this,defaultValue:r,typeName:v.ZodDefault})}brand(){return new ge({typeName:v.ZodBranded,type:this,..._(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new ae({..._(this._def),innerType:this,catchValue:r,typeName:v.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return ye.create(this,e)}readonly(){return ie.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Nt=/^c[^\s-]{8,}$/i,Tt=/^[0-9a-z]+$/,Ot=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Rt=/^[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,It=/^[a-z0-9_-]{21}$/i,Ct=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,St=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Pt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Dt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ve,Vt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,jt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Lt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,$t=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ft=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Mt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ze="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ut=new RegExp(`^${ze}$`);function Be(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Gt(t){return new RegExp(`^${Be(t)}$`)}function Ke(t){let e=`${ze}T${Be(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Zt(t,e){return!!((e==="v4"||!e)&&Vt.test(t)||(e==="v6"||!e)&&Lt.test(t))}function zt(t,e){if(!Ct.test(t))return!1;try{let[r]=t.split("."),s=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function Bt(t,e){return!!((e==="v4"||!e)&&jt.test(t)||(e==="v6"||!e)&&$t.test(t))}var U=class t extends g{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:p.string,received:a.parsedType}),m}let s=new w,n;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){let i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(n=this._getOrReturnCtx(e,n),i?l(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&l(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")Pt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"email",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")Ve||(Ve=new RegExp(Dt,"u")),Ve.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"emoji",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")Rt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"uuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")It.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"nanoid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")Nt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")Tt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cuid2",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")Ot.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"ulid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),l(n,{validation:"url",code:c.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"regex",code:c.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?Ke(a).test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?Ut.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?Gt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?St.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"duration",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?Zt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"ip",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?zt(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"jwt",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?Bt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cidr",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?Ft.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"base64",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?Mt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"base64url",code:c.invalid_string,message:a.message}),s.dirty()):y.assertNever(a);return{status:s.value,value:e.data}}_regex(e,r,s){return this.refinement(n=>e.test(n),{validation:r,code:c.invalid_string,...f.errToObj(s)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...f.errToObj(e)})}url(e){return this._addCheck({kind:"url",...f.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...f.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...f.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...f.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...f.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...f.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...f.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...f.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...f.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...f.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...f.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...f.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...f.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...f.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...f.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...f.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...f.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...f.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...f.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...f.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...f.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...f.errToObj(r)})}nonempty(e){return this.min(1,f.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 isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};U.create=t=>new U({checks:[],typeName:v.ZodString,coerce:t?.coerce??!1,..._(t)});function Kt(t,e){let r=(t.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=r>s?r:s,a=Number.parseInt(t.toFixed(n).replace(".","")),i=Number.parseInt(e.toFixed(n).replace(".",""));return a%i/10**n}var K=class t extends g{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)!==p.number){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:p.number,received:a.parsedType}),m}let s,n=new w;for(let a of this._def.checks)a.kind==="int"?y.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?Kt(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.not_finite,message:a.message}),n.dirty()):y.assertNever(a);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,f.toString(r))}gt(e,r){return this.setLimit("min",e,!1,f.toString(r))}lte(e,r){return this.setLimit("max",e,!0,f.toString(r))}lt(e,r){return this.setLimit("max",e,!1,f.toString(r))}setLimit(e,r,s,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:f.toString(n)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:f.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:f.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:f.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:f.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:f.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:f.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:f.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:f.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:f.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&y.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(r===null||s.value>r)&&(r=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(r)&&Number.isFinite(e)}};K.create=t=>new K({checks:[],typeName:v.ZodNumber,coerce:t?.coerce||!1,..._(t)});var Y=class t extends g{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==p.bigint)return this._getInvalidInput(e);let s,n=new w;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):y.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return l(r,{code:c.invalid_type,expected:p.bigint,received:r.parsedType}),m}gte(e,r){return this.setLimit("min",e,!0,f.toString(r))}gt(e,r){return this.setLimit("min",e,!1,f.toString(r))}lte(e,r){return this.setLimit("max",e,!0,f.toString(r))}lt(e,r){return this.setLimit("max",e,!1,f.toString(r))}setLimit(e,r,s,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:f.toString(n)}]})}_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:f.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:f.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:f.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:f.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:f.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};Y.create=t=>new Y({checks:[],typeName:v.ZodBigInt,coerce:t?.coerce??!1,..._(t)});var W=class extends g{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.boolean){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:p.boolean,received:s.parsedType}),m}return b(e.data)}};W.create=t=>new W({typeName:v.ZodBoolean,coerce:t?.coerce||!1,..._(t)});var q=class t extends g{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:p.date,received:a.parsedType}),m}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_date}),m}let s=new w,n;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):y.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:f.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:f.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};q.create=t=>new q({checks:[],coerce:t?.coerce||!1,typeName:v.ZodDate,..._(t)});var le=class extends g{_parse(e){if(this._getType(e)!==p.symbol){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:p.symbol,received:s.parsedType}),m}return b(e.data)}};le.create=t=>new le({typeName:v.ZodSymbol,..._(t)});var J=class extends g{_parse(e){if(this._getType(e)!==p.undefined){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:p.undefined,received:s.parsedType}),m}return b(e.data)}};J.create=t=>new J({typeName:v.ZodUndefined,..._(t)});var H=class extends g{_parse(e){if(this._getType(e)!==p.null){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:p.null,received:s.parsedType}),m}return b(e.data)}};H.create=t=>new H({typeName:v.ZodNull,..._(t)});var G=class extends g{constructor(){super(...arguments),this._any=!0}_parse(e){return b(e.data)}};G.create=t=>new G({typeName:v.ZodAny,..._(t)});var L=class extends g{constructor(){super(...arguments),this._unknown=!0}_parse(e){return b(e.data)}};L.create=t=>new L({typeName:v.ZodUnknown,..._(t)});var I=class extends g{_parse(e){let r=this._getOrReturnCtx(e);return l(r,{code:c.invalid_type,expected:p.never,received:r.parsedType}),m}};I.create=t=>new I({typeName:v.ZodNever,..._(t)});var pe=class extends g{_parse(e){if(this._getType(e)!==p.undefined){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:p.void,received:s.parsedType}),m}return b(e.data)}};pe.create=t=>new pe({typeName:v.ZodVoid,..._(t)});var $=class t extends g{_parse(e){let{ctx:r,status:s}=this._processInputParams(e),n=this._def;if(r.parsedType!==p.array)return l(r,{code:c.invalid_type,expected:p.array,received:r.parsedType}),m;if(n.exactLength!==null){let i=r.data.length>n.exactLength.value,o=r.data.length<n.exactLength.value;(i||o)&&(l(r,{code:i?c.too_big:c.too_small,minimum:o?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(l(r,{code:c.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(l(r,{code:c.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),r.common.async)return Promise.all([...r.data].map((i,o)=>n.type._parseAsync(new O(r,i,r.path,o)))).then(i=>w.mergeArray(s,i));let a=[...r.data].map((i,o)=>n.type._parseSync(new O(r,i,r.path,o)));return w.mergeArray(s,a)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:f.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:f.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:f.toString(r)}})}nonempty(e){return this.min(1,e)}};$.create=(t,e)=>new $({type:t,minLength:null,maxLength:null,exactLength:null,typeName:v.ZodArray,..._(e)});function ue(t){if(t instanceof N){let e={};for(let r in t.shape){let s=t.shape[r];e[r]=T.create(ue(s))}return new N({...t._def,shape:()=>e})}else return t instanceof $?new $({...t._def,type:ue(t.element)}):t instanceof T?T.create(ue(t.unwrap())):t instanceof P?P.create(ue(t.unwrap())):t instanceof S?S.create(t.items.map(e=>ue(e))):t}var N=class t extends g{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(),r=y.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==p.object){let d=this._getOrReturnCtx(e);return l(d,{code:c.invalid_type,expected:p.object,received:d.parsedType}),m}let{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof I&&this._def.unknownKeys==="strip"))for(let d in n.data)i.includes(d)||o.push(d);let u=[];for(let d of i){let h=a[d],k=n.data[d];u.push({key:{status:"valid",value:d},value:h._parse(new O(n,k,n.path,d)),alwaysSet:d in n.data})}if(this._def.catchall instanceof I){let d=this._def.unknownKeys;if(d==="passthrough")for(let h of o)u.push({key:{status:"valid",value:h},value:{status:"valid",value:n.data[h]}});else if(d==="strict")o.length>0&&(l(n,{code:c.unrecognized_keys,keys:o}),s.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let h of o){let k=n.data[h];u.push({key:{status:"valid",value:h},value:d._parse(new O(n,k,n.path,h)),alwaysSet:h in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let d=[];for(let h of u){let k=await h.key,oe=await h.value;d.push({key:k,value:oe,alwaysSet:h.alwaysSet})}return d}).then(d=>w.mergeObjectSync(s,d)):w.mergeObjectSync(s,u)}get shape(){return this._def.shape()}strict(e){return f.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,s)=>{let n=this._def.errorMap?.(r,s).message??s.defaultError;return r.code==="unrecognized_keys"?{message:f.errToObj(e).message??n}:{message:n}}}:{}})}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:v.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let s of y.objectKeys(e))e[s]&&this.shape[s]&&(r[s]=this.shape[s]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let s of y.objectKeys(this.shape))e[s]||(r[s]=this.shape[s]);return new t({...this._def,shape:()=>r})}deepPartial(){return ue(this)}partial(e){let r={};for(let s of y.objectKeys(this.shape)){let n=this.shape[s];e&&!e[s]?r[s]=n:r[s]=n.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let s of y.objectKeys(this.shape))if(e&&!e[s])r[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof T;)a=a._def.innerType;r[s]=a}return new t({...this._def,shape:()=>r})}keyof(){return Ye(y.objectKeys(this.shape))}};N.create=(t,e)=>new N({shape:()=>t,unknownKeys:"strip",catchall:I.create(),typeName:v.ZodObject,..._(e)});N.strictCreate=(t,e)=>new N({shape:()=>t,unknownKeys:"strict",catchall:I.create(),typeName:v.ZodObject,..._(e)});N.lazycreate=(t,e)=>new N({shape:t,unknownKeys:"strip",catchall:I.create(),typeName:v.ZodObject,..._(e)});var Q=class extends g{_parse(e){let{ctx:r}=this._processInputParams(e),s=this._def.options;function n(a){for(let o of a)if(o.result.status==="valid")return o.result;for(let o of a)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;let i=a.map(o=>new A(o.ctx.common.issues));return l(r,{code:c.invalid_union,unionErrors:i}),m}if(r.common.async)return Promise.all(s.map(async a=>{let i={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(n);{let a,i=[];for(let u of s){let d={...r,common:{...r.common,issues:[]},parent:null},h=u._parseSync({data:r.data,path:r.path,parent:d});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,ctx:d}),d.common.issues.length&&i.push(d.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(u=>new A(u));return l(r,{code:c.invalid_union,unionErrors:o}),m}}get options(){return this._def.options}};Q.create=(t,e)=>new Q({options:t,typeName:v.ZodUnion,..._(e)});var j=t=>t instanceof ee?j(t.schema):t instanceof R?j(t.innerType()):t instanceof te?[t.value]:t instanceof re?t.options:t instanceof se?y.objectValues(t.enum):t instanceof ne?j(t._def.innerType):t instanceof J?[void 0]:t instanceof H?[null]:t instanceof T?[void 0,...j(t.unwrap())]:t instanceof P?[null,...j(t.unwrap())]:t instanceof ge||t instanceof ie?j(t.unwrap()):t instanceof ae?j(t._def.innerType):[],Ee=class t extends g{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==p.object)return l(r,{code:c.invalid_type,expected:p.object,received:r.parsedType}),m;let s=this.discriminator,n=r.data[s],a=this.optionsMap.get(n);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(l(r,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),m)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,s){let n=new Map;for(let a of r){let i=j(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of i){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,a)}}return new t({typeName:v.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:n,..._(s)})}};function je(t,e){let r=C(t),s=C(e);if(t===e)return{valid:!0,data:t};if(r===p.object&&s===p.object){let n=y.objectKeys(e),a=y.objectKeys(t).filter(o=>n.indexOf(o)!==-1),i={...t,...e};for(let o of a){let u=je(t[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(r===p.array&&s===p.array){if(t.length!==e.length)return{valid:!1};let n=[];for(let a=0;a<t.length;a++){let i=t[a],o=e[a],u=je(i,o);if(!u.valid)return{valid:!1};n.push(u.data)}return{valid:!0,data:n}}else return r===p.date&&s===p.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var X=class extends g{_parse(e){let{status:r,ctx:s}=this._processInputParams(e),n=(a,i)=>{if(ke(a)||ke(i))return m;let o=je(a.value,i.value);return o.valid?((be(a)||be(i))&&r.dirty(),{status:r.value,value:o.data}):(l(s,{code:c.invalid_intersection_types}),m)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};X.create=(t,e,r)=>new X({left:t,right:e,typeName:v.ZodIntersection,..._(r)});var S=class t extends g{_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.array)return l(s,{code:c.invalid_type,expected:p.array,received:s.parsedType}),m;if(s.data.length<this._def.items.length)return l(s,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m;!this._def.rest&&s.data.length>this._def.items.length&&(l(s,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...s.data].map((i,o)=>{let u=this._def.items[o]||this._def.rest;return u?u._parse(new O(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(a).then(i=>w.mergeArray(r,i)):w.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};S.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new S({items:t,typeName:v.ZodTuple,rest:null,..._(e)})};var Ae=class t extends g{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.object)return l(s,{code:c.invalid_type,expected:p.object,received:s.parsedType}),m;let n=[],a=this._def.keyType,i=this._def.valueType;for(let o in s.data)n.push({key:a._parse(new O(s,o,s.path,o)),value:i._parse(new O(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?w.mergeObjectAsync(r,n):w.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(e,r,s){return r instanceof g?new t({keyType:e,valueType:r,typeName:v.ZodRecord,..._(s)}):new t({keyType:U.create(),valueType:e,typeName:v.ZodRecord,..._(r)})}},fe=class extends g{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.map)return l(s,{code:c.invalid_type,expected:p.map,received:s.parsedType}),m;let n=this._def.keyType,a=this._def.valueType,i=[...s.data.entries()].map(([o,u],d)=>({key:n._parse(new O(s,o,s.path,[d,"key"])),value:a._parse(new O(s,u,s.path,[d,"value"]))}));if(s.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let u of i){let d=await u.key,h=await u.value;if(d.status==="aborted"||h.status==="aborted")return m;(d.status==="dirty"||h.status==="dirty")&&r.dirty(),o.set(d.value,h.value)}return{status:r.value,value:o}})}else{let o=new Map;for(let u of i){let d=u.key,h=u.value;if(d.status==="aborted"||h.status==="aborted")return m;(d.status==="dirty"||h.status==="dirty")&&r.dirty(),o.set(d.value,h.value)}return{status:r.value,value:o}}}};fe.create=(t,e,r)=>new fe({valueType:e,keyType:t,typeName:v.ZodMap,..._(r)});var he=class t extends g{_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.set)return l(s,{code:c.invalid_type,expected:p.set,received:s.parsedType}),m;let n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(l(s,{code:c.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(l(s,{code:c.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());let a=this._def.valueType;function i(u){let d=new Set;for(let h of u){if(h.status==="aborted")return m;h.status==="dirty"&&r.dirty(),d.add(h.value)}return{status:r.value,value:d}}let o=[...s.data.values()].map((u,d)=>a._parse(new O(s,u,s.path,d)));return s.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,r){return new t({...this._def,minSize:{value:e,message:f.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:f.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};he.create=(t,e)=>new he({valueType:t,minSize:null,maxSize:null,typeName:v.ZodSet,..._(e)});var Ne=class t extends g{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==p.function)return l(r,{code:c.invalid_type,expected:p.function,received:r.parsedType}),m;function s(o,u){return _e({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ce(),V].filter(d=>!!d),issueData:{code:c.invalid_arguments,argumentsError:u}})}function n(o,u){return _e({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ce(),V].filter(d=>!!d),issueData:{code:c.invalid_return_type,returnTypeError:u}})}let a={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof Z){let o=this;return b(async function(...u){let d=new A([]),h=await o._def.args.parseAsync(u,a).catch(ve=>{throw d.addIssue(s(u,ve)),d}),k=await Reflect.apply(i,this,h);return await o._def.returns._def.type.parseAsync(k,a).catch(ve=>{throw d.addIssue(n(k,ve)),d})})}else{let o=this;return b(function(...u){let d=o._def.args.safeParse(u,a);if(!d.success)throw new A([s(u,d.error)]);let h=Reflect.apply(i,this,d.data),k=o._def.returns.safeParse(h,a);if(!k.success)throw new A([n(h,k.error)]);return k.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:S.create(e).rest(L.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,r,s){return new t({args:e||S.create([]).rest(L.create()),returns:r||L.create(),typeName:v.ZodFunction,..._(s)})}},ee=class extends g{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};ee.create=(t,e)=>new ee({getter:t,typeName:v.ZodLazy,..._(e)});var te=class extends g{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return l(r,{received:r.data,code:c.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}};te.create=(t,e)=>new te({value:t,typeName:v.ZodLiteral,..._(e)});function Ye(t,e){return new re({values:t,typeName:v.ZodEnum,..._(e)})}var re=class t extends g{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),s=this._def.values;return l(r,{expected:y.joinValues(s),received:r.parsedType,code:c.invalid_type}),m}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),s=this._def.values;return l(r,{received:r.data,code:c.invalid_enum_value,options:s}),m}return b(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(s=>!e.includes(s)),{...this._def,...r})}};re.create=Ye;var se=class extends g{_parse(e){let r=y.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==p.string&&s.parsedType!==p.number){let n=y.objectValues(r);return l(s,{expected:y.joinValues(n),received:s.parsedType,code:c.invalid_type}),m}if(this._cache||(this._cache=new Set(y.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=y.objectValues(r);return l(s,{received:s.data,code:c.invalid_enum_value,options:n}),m}return b(e.data)}get enum(){return this._def.values}};se.create=(t,e)=>new se({values:t,typeName:v.ZodNativeEnum,..._(e)});var Z=class extends g{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==p.promise&&r.common.async===!1)return l(r,{code:c.invalid_type,expected:p.promise,received:r.parsedType}),m;let s=r.parsedType===p.promise?r.data:Promise.resolve(r.data);return b(s.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Z.create=(t,e)=>new Z({type:t,typeName:v.ZodPromise,..._(e)});var R=class extends g{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===v.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{l(s,i),i.fatal?r.abort():r.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){let i=n.transform(s.data,a);if(s.common.async)return Promise.resolve(i).then(async o=>{if(r.value==="aborted")return m;let u=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return u.status==="aborted"?m:u.status==="dirty"?B(u.value):r.value==="dirty"?B(u.value):u});{if(r.value==="aborted")return m;let o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?m:o.status==="dirty"?B(o.value):r.value==="dirty"?B(o.value):o}}if(n.type==="refinement"){let i=o=>{let u=n.refinement(o,a);if(s.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?m:(o.status==="dirty"&&r.dirty(),i(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?m:(o.status==="dirty"&&r.dirty(),i(o.value).then(()=>({status:r.value,value:o.value}))))}if(n.type==="transform")if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!M(i))return m;let o=n.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>M(i)?Promise.resolve(n.transform(i.value,a)).then(o=>({status:r.value,value:o})):m);y.assertNever(n)}};R.create=(t,e,r)=>new R({schema:t,typeName:v.ZodEffects,effect:e,..._(r)});R.createWithPreprocess=(t,e,r)=>new R({schema:e,effect:{type:"preprocess",transform:t},typeName:v.ZodEffects,..._(r)});var T=class extends g{_parse(e){return this._getType(e)===p.undefined?b(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};T.create=(t,e)=>new T({innerType:t,typeName:v.ZodOptional,..._(e)});var P=class extends g{_parse(e){return this._getType(e)===p.null?b(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};P.create=(t,e)=>new P({innerType:t,typeName:v.ZodNullable,..._(e)});var ne=class extends g{_parse(e){let{ctx:r}=this._processInputParams(e),s=r.data;return r.parsedType===p.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};ne.create=(t,e)=>new ne({innerType:t,typeName:v.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var ae=class extends g{_parse(e){let{ctx:r}=this._processInputParams(e),s={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return de(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new A(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new A(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};ae.create=(t,e)=>new ae({innerType:t,typeName:v.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});var me=class extends g{_parse(e){if(this._getType(e)!==p.nan){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:p.nan,received:s.parsedType}),m}return{status:"valid",value:e.data}}};me.create=t=>new me({typeName:v.ZodNaN,..._(t)});var Yt=Symbol("zod_brand"),ge=class extends g{_parse(e){let{ctx:r}=this._processInputParams(e),s=r.data;return this._def.type._parse({data:s,path:r.path,parent:r})}unwrap(){return this._def.type}},ye=class t extends g{_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?m:a.status==="dirty"?(r.dirty(),B(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?m:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,r){return new t({in:e,out:r,typeName:v.ZodPipeline})}},ie=class extends g{_parse(e){let r=this._def.innerType._parse(e),s=n=>(M(n)&&(n.value=Object.freeze(n.value)),n);return de(r)?r.then(n=>s(n)):s(r)}unwrap(){return this._def.innerType}};ie.create=(t,e)=>new ie({innerType:t,typeName:v.ZodReadonly,..._(e)});function Ze(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function We(t,e={},r){return t?G.create().superRefine((s,n)=>{let a=t(s);if(a instanceof Promise)return a.then(i=>{if(!i){let o=Ze(e,s),u=o.fatal??r??!0;n.addIssue({code:"custom",...o,fatal:u})}});if(!a){let i=Ze(e,s),o=i.fatal??r??!0;n.addIssue({code:"custom",...i,fatal:o})}}):G.create()}var Wt={object:N.lazycreate},v;(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"})(v||(v={}));var qt=(t,e={message:`Input not instance of ${t.name}`})=>We(r=>r instanceof t,e),qe=U.create,Je=K.create,Jt=me.create,Ht=Y.create,He=W.create,Qt=q.create,Xt=le.create,er=J.create,tr=H.create,rr=G.create,sr=L.create,nr=I.create,ar=pe.create,ir=$.create,or=N.create,cr=N.strictCreate,dr=Q.create,ur=Ee.create,lr=X.create,pr=S.create,fr=Ae.create,hr=fe.create,mr=he.create,vr=Ne.create,_r=ee.create,gr=te.create,yr=re.create,xr=se.create,wr=Z.create,kr=R.create,br=T.create,Er=P.create,Ar=R.createWithPreprocess,Nr=ye.create,Tr=()=>qe().optional(),Or=()=>Je().optional(),Rr=()=>He().optional(),Ir={string:t=>U.create({...t,coerce:!0}),number:t=>K.create({...t,coerce:!0}),boolean:t=>W.create({...t,coerce:!0}),bigint:t=>Y.create({...t,coerce:!0}),date:t=>q.create({...t,coerce:!0})};var Cr=m;var xe=(i=>(i.PROD_CN="prod-cn",i.PROD="prod",i.STAGING="staging",i.STAGING_CN="staging-cn",i.DEV="dev",i.LOCAL="local",i))(xe||{}),Qe=({fallback:t="prod"})=>{let e=process.env.ENV;if(!e)return t;let r=e.toLowerCase().trim();return Object.values(xe).includes(r)?r:t},Xe=t=>t==="prod-cn"||t==="staging-cn";var Sr=t=>{switch(t){case"local":return{CONNECT_API_BASE_URL:"http://localhost:3000/rest",CANVA_ENV_URL:"http://localhost:3000",CANVA_CLI_CLIENT_ID:"FAKE_CLIENT_ID",FLAVOR:"local"};case"dev":return{CONNECT_API_BASE_URL:"https://api.canva-dev.com/rest",CANVA_ENV_URL:"https://www.canva-dev.com",CANVA_CLI_CLIENT_ID:"OC-AZFEJKOjQYw3",FLAVOR:"dev"};case"staging-cn":return{CONNECT_API_BASE_URL:"https://api.canva-staging.cn/rest",CANVA_ENV_URL:"https://www.canva-staging.cn",CANVA_CLI_CLIENT_ID:"OC-AZNlOhtxI_Zb",FLAVOR:"staging-cn"};case"staging":return{CONNECT_API_BASE_URL:"https://api.canva-staging.com/rest",CANVA_ENV_URL:"https://www.canva-staging.com",CANVA_CLI_CLIENT_ID:"OC-AZH-EOTpT8Ib",FLAVOR:"staging"};case"prod-cn":return{CONNECT_API_BASE_URL:"https://api.canva.cn/rest",CANVA_ENV_URL:"https://www.canva.cn",CANVA_CLI_CLIENT_ID:"OC-AZN2AS1hKtVM",FLAVOR:"prod-cn"};case"prod":default:return{CONNECT_API_BASE_URL:"https://api.canva.com/rest",CANVA_ENV_URL:"https://www.canva.com",CANVA_CLI_CLIENT_ID:"OC-AZICxlGo2biD",FLAVOR:"prod"}}},et=({fallback:t="prod"})=>Pe({server:{FLAVOR:z.enum(["prod","prod-cn","staging","staging-cn","dev","local"]).default(t),CONNECT_API_BASE_URL:z.string().url(),CANVA_ENV_URL:z.string().url(),CANVA_CLI_CLIENT_ID:z.enum(["OC-AZICxlGo2biD","OC-AZN2AS1hKtVM","OC-AZH-EOTpT8Ib","OC-AZNlOhtxI_Zb","OC-AZFEJKOjQYw3","FAKE_CLIENT_ID"]).default("OC-AZICxlGo2biD"),CANVA_CLI_MANIFEST_ENABLED:z.boolean().default(!1)},runtimeEnv:{...Sr(Qe({fallback:t})),CANVA_CLI_MANIFEST_ENABLED:process.env.CANVA_CLI_MANIFEST_ENABLED==="true"},emptyStringAsUndefined:!0});var Te=class{constructor(e,r,s=!1){this.envService=e;this.env=r;this.debug=s}generatePreviewResult=async e=>{let r=e;if(!r){let n=await this.getAppId();if(!n.success)return n;r=n.data}return{success:!0,data:this.constructPreviewUrl(r)}};async getAppId(){try{let e=await this.envService.getAppIdFromEnvFile();if(!e.success)return e;let r=e.data;if(r==="YOUR_APP_ID_HERE"){let s="CANVA_APP_ID is set to the default placeholder value. Please update it in the .env file.";return this.debug&&console.error(s),{success:!1,code:"MISSING_FIELD",message:s}}return{success:!0,data:r}}catch(e){let r=`Unknown Error reading CANVA_APP_ID from .env file: ${e instanceof Error?e.message:String(e)}`;return this.debug&&console.error(r),{success:!1,code:"ENV_READ_ERROR",message:r}}}constructPreviewUrl(e){let r=this.encodeUiState({appId:e}),s=this.env.CANVA_ENV_URL,n=new URL("/login/",s),a=new URL("/design",s);return a.searchParams.append("create",""),a.searchParams.append("width","800"),a.searchParams.append("height","600"),a.searchParams.append("units","px"),a.searchParams.append("ui",r),n.searchParams.append("redirect",a.pathname+a.search),n.toString()}encodeUiState(e){let r={E:{"A?":"N",S:e.appId,g:!0}},s=JSON.stringify(r);return btoa(s).replace(/[+]/g,"-").replace(/[/]/g,"_").replace(/[=]/g,"")}};var ct=xt(ot(),1);import Yr from"path";var Ie=class{constructor(e,r,s=Yr,n=!1){this.env=e;this.fileService=r;this.pathModule=s;this.debug=n}get isChina(){return Xe(this.env.FLAVOR)}handleError(e,r,s){let n=`${r}: ${e instanceof Error?e.message:String(e)}`;return this.debug&&console.error(n),{success:!1,code:s,message:n}}async getAppIdFromEnvFile(){let e=this.pathModule.resolve(process.cwd(),".env"),r=await this.fileService.exists(e);if(!r.success||!r.data){let i="No .env file found, ensure you are in your intended app's directory.";return this.debug&&console.error(i),{success:!1,code:"FILE_NOT_FOUND",message:i}}let s=await this.fileService.readFile(e);if(!s.success)return s;let a=ct.parse(s.data).CANVA_APP_ID;if(!a){let i="CANVA_APP_ID not found in .env file";return this.debug&&console.error(i),{success:!1,code:"MISSING_FIELD",message:i}}return{success:!0,data:a}}async fetchRemoteEnvTemplate(){try{let e=await fetch("https://raw.githubusercontent.com/canva-sdks/canva-apps-sdk-starter-kit/refs/heads/main/.env.template");return e.ok?{success:!0,data:await e.text()}:this.handleError(new Error(e.statusText),"Failed to fetch .env.template","FILE_NOT_FOUND")}catch(e){return this.handleError(e,"Failed to fetch .env.template","FILE_NOT_FOUND")}}async parseEnvFile(e){let r=await this.fileService.exists(e);if(!r.success||!r.data)return{success:!0,data:new Set};let s=await this.fileService.readFile(e);return s.success?{success:!0,data:new Set(s.data.split(`
|
|
5
|
-
`).map(a=>a.trim()).filter(a=>a&&!a.startsWith("#")).filter(a=>a.includes("=")).map(a=>a.split("=")[0]?.trim()??"").filter(a=>a!==""))}:s}};import
|
|
2
|
+
var ft=Object.create;var Se=Object.defineProperty;var ht=Object.getOwnPropertyDescriptor;var mt=Object.getOwnPropertyNames;var vt=Object.getPrototypeOf,_t=Object.prototype.hasOwnProperty;var we=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,r)=>(typeof require<"u"?require:e)[r]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var Fe=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),gt=(t,e)=>{for(var r in e)Se(t,r,{get:e[r],enumerable:!0})},yt=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of mt(e))!_t.call(t,n)&&n!==r&&Se(t,n,{get:()=>e[n],enumerable:!(s=ht(e,n))||s.enumerable});return t};var xt=(t,e,r)=>(r=t!=null?ft(vt(t)):{},yt(e||!t||!t.__esModule?Se(r,"default",{value:t,enumerable:!0}):r,t));var rt=Fe((Bs,Pr)=>{Pr.exports={name:"dotenv",version:"16.6.0",description:"Loads environment variables from .env file",main:"lib/main.js",types:"lib/main.d.ts",exports:{".":{types:"./lib/main.d.ts",require:"./lib/main.js",default:"./lib/main.js"},"./config":"./config.js","./config.js":"./config.js","./lib/env-options":"./lib/env-options.js","./lib/env-options.js":"./lib/env-options.js","./lib/cli-options":"./lib/cli-options.js","./lib/cli-options.js":"./lib/cli-options.js","./package.json":"./package.json"},scripts:{"dts-check":"tsc --project tests/types/tsconfig.json",lint:"standard",pretest:"npm run lint && npm run dts-check",test:"tap run --allow-empty-coverage --disable-coverage --timeout=60000","test:coverage":"tap run --show-full-coverage --timeout=60000 --coverage-report=lcov",prerelease:"npm test",release:"standard-version"},repository:{type:"git",url:"git://github.com/motdotla/dotenv.git"},homepage:"https://github.com/motdotla/dotenv#readme",funding:"https://dotenvx.com",keywords:["dotenv","env",".env","environment","variables","config","settings"],readmeFilename:"README.md",license:"BSD-2-Clause",devDependencies:{"@types/node":"^18.11.3",decache:"^4.6.2",sinon:"^14.0.1",standard:"^17.0.0","standard-version":"^9.5.0",tap:"^19.2.0",typescript:"^4.8.4"},engines:{node:">=12"},browser:{fs:!1}}});var ot=Fe((zs,F)=>{var je=we("fs"),Re=we("path"),Dr=we("os"),Vr=we("crypto"),Lr=rt(),$e=Lr.version,jr=/(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/mg;function $r(t){let e={},r=t.toString();r=r.replace(/\r\n?/mg,`
|
|
3
|
+
`);let s;for(;(s=jr.exec(r))!=null;){let n=s[1],a=s[2]||"";a=a.trim();let i=a[0];a=a.replace(/^(['"`])([\s\S]*)\1$/mg,"$2"),i==='"'&&(a=a.replace(/\\n/g,`
|
|
4
|
+
`),a=a.replace(/\\r/g,"\r")),e[n]=a}return e}function Fr(t){let e=it(t);t.path=e;let r=x.configDotenv(t);if(!r.parsed){let i=new Error(`MISSING_DATA: Cannot parse ${e} for an unknown reason`);throw i.code="MISSING_DATA",i}let s=at(t).split(","),n=s.length,a;for(let i=0;i<n;i++)try{let o=s[i].trim(),u=Ur(r,o);a=x.decrypt(u.ciphertext,u.key);break}catch(o){if(i+1>=n)throw o}return x.parse(a)}function Mr(t){console.log(`[dotenv@${$e}][WARN] ${t}`)}function Oe(t){console.log(`[dotenv@${$e}][DEBUG] ${t}`)}function nt(t){console.log(`[dotenv@${$e}] ${t}`)}function at(t){return t&&t.DOTENV_KEY&&t.DOTENV_KEY.length>0?t.DOTENV_KEY:process.env.DOTENV_KEY&&process.env.DOTENV_KEY.length>0?process.env.DOTENV_KEY:""}function Ur(t,e){let r;try{r=new URL(e)}catch(o){if(o.code==="ERR_INVALID_URL"){let u=new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");throw u.code="INVALID_DOTENV_KEY",u}throw o}let s=r.password;if(!s){let o=new Error("INVALID_DOTENV_KEY: Missing key part");throw o.code="INVALID_DOTENV_KEY",o}let n=r.searchParams.get("environment");if(!n){let o=new Error("INVALID_DOTENV_KEY: Missing environment part");throw o.code="INVALID_DOTENV_KEY",o}let a=`DOTENV_VAULT_${n.toUpperCase()}`,i=t.parsed[a];if(!i){let o=new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${a} in your .env.vault file.`);throw o.code="NOT_FOUND_DOTENV_ENVIRONMENT",o}return{ciphertext:i,key:s}}function it(t){let e=null;if(t&&t.path&&t.path.length>0)if(Array.isArray(t.path))for(let r of t.path)je.existsSync(r)&&(e=r.endsWith(".vault")?r:`${r}.vault`);else e=t.path.endsWith(".vault")?t.path:`${t.path}.vault`;else e=Re.resolve(process.cwd(),".env.vault");return je.existsSync(e)?e:null}function st(t){return t[0]==="~"?Re.join(Dr.homedir(),t.slice(1)):t}function Gr(t){let e=!!(t&&t.debug),r=!!(t&&t.quiet);(e||!r)&&nt("Loading env from encrypted .env.vault");let s=x._parseVault(t),n=process.env;return t&&t.processEnv!=null&&(n=t.processEnv),x.populate(n,s,t),{parsed:s}}function Zr(t){let e=Re.resolve(process.cwd(),".env"),r="utf8",s=!!(t&&t.debug),n=!!(t&&t.quiet);t&&t.encoding?r=t.encoding:s&&Oe("No encoding is specified. UTF-8 is used by default");let a=[e];if(t&&t.path)if(!Array.isArray(t.path))a=[st(t.path)];else{a=[];for(let d of t.path)a.push(st(d))}let i,o={};for(let d of a)try{let h=x.parse(je.readFileSync(d,{encoding:r}));x.populate(o,h,t)}catch(h){s&&Oe(`Failed to load ${d} ${h.message}`),i=h}let u=process.env;if(t&&t.processEnv!=null&&(u=t.processEnv),x.populate(u,o,t),s||!n){let d=Object.keys(o).length,h=[];for(let k of a)try{let oe=Re.relative(process.cwd(),k);h.push(oe)}catch{}nt(`injecting env (${d}) from ${h.join(",")}`)}return i?{parsed:o,error:i}:{parsed:o}}function Br(t){if(at(t).length===0)return x.configDotenv(t);let e=it(t);return e?x._configVault(t):(Mr(`You set DOTENV_KEY but you are missing a .env.vault file at ${e}. Did you forget to build it?`),x.configDotenv(t))}function zr(t,e){let r=Buffer.from(e.slice(-64),"hex"),s=Buffer.from(t,"base64"),n=s.subarray(0,12),a=s.subarray(-16);s=s.subarray(12,-16);try{let i=Vr.createDecipheriv("aes-256-gcm",r,n);return i.setAuthTag(a),`${i.update(s)}${i.final()}`}catch(i){let o=i instanceof RangeError,u=i.message==="Invalid key length",d=i.message==="Unsupported state or unable to authenticate data";if(o||u){let h=new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");throw h.code="INVALID_DOTENV_KEY",h}else if(d){let h=new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");throw h.code="DECRYPTION_FAILED",h}else throw i}}function Kr(t,e,r={}){let s=!!(r&&r.debug),n=!!(r&&r.override);if(typeof e!="object"){let a=new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");throw a.code="OBJECT_REQUIRED",a}for(let a of Object.keys(e))Object.prototype.hasOwnProperty.call(t,a)?(n===!0&&(t[a]=e[a]),s&&Oe(n===!0?`"${a}" is already defined and WAS overwritten`:`"${a}" is already defined and was NOT overwritten`)):t[a]=e[a]}var x={configDotenv:Zr,_configVault:Gr,_parseVault:Fr,config:Br,decrypt:zr,parse:$r,populate:Kr};F.exports.configDotenv=x.configDotenv;F.exports._configVault=x._configVault;F.exports._parseVault=x._parseVault;F.exports.config=x.config;F.exports.decrypt=x.decrypt;F.exports.parse=x.parse;F.exports.populate=x.populate;F.exports=x});var ke=class{constructor(e,r,s=!1){this.envService=e;this.env=r;this.debug=s}generatePreviewResult=async e=>{let r=e;if(!r){let n=await this.getAppId();if(!n.success)return n;r=n.data}return{success:!0,data:this.constructPreviewUrl(r)}};async getAppId(){try{let e=await this.envService.getAppIdFromEnvFile();if(!e.success)return e;let r=e.data;if(r==="YOUR_APP_ID_HERE"){let s="CANVA_APP_ID is set to the default placeholder value. Please update it in the .env file.";return this.debug&&console.error(s),{success:!1,code:"MISSING_FIELD",message:s}}return{success:!0,data:r}}catch(e){let r=`Unknown Error reading CANVA_APP_ID from .env file: ${e instanceof Error?e.message:String(e)}`;return this.debug&&console.error(r),{success:!1,code:"ENV_READ_ERROR",message:r}}}constructPreviewUrl(e){let r=this.encodeUiState({appId:e}),s=this.env.CANVA_ENV_URL,n=new URL("/login/",s),a=new URL("/design",s);return a.searchParams.append("create",""),a.searchParams.append("width","800"),a.searchParams.append("height","600"),a.searchParams.append("units","px"),a.searchParams.append("ui",r),n.searchParams.append("redirect",a.pathname+a.search),n.toString()}encodeUiState(e){let r={E:{"A?":"N",S:e.appId,g:!0}},s=JSON.stringify(r);return btoa(s).replace(/[+]/g,"-").replace(/[/]/g,"_").replace(/[=]/g,"")}};function Ue(t,e){if(t instanceof Promise)throw new Error(e)}function wt(t,e){let r={},s=[];for(let n in t){let a=t[n]["~standard"].validate(e[n]);if(Ue(a,`Validation must be synchronous, but ${n} returned a Promise.`),a.issues){s.push(...a.issues.map(i=>({...i,message:i.message,path:[n,...i.path??[]]})));continue}r[n]=a.value}return s.length?{issues:s}:{value:r}}function Pe(t){let e=t.runtimeEnvStrict??t.runtimeEnv??process.env;if(t.emptyStringAsUndefined??!1)for(let[A,D]of Object.entries(e))D===""&&delete e[A];if(!!t.skipValidation)return e;let n=typeof t.client=="object"?t.client:{},a=typeof t.server=="object"?t.server:{},i=typeof t.shared=="object"?t.shared:{},o=t.isServer??(typeof window>"u"||"Deno"in window),u=o?{...a,...i,...n}:{...n,...i},d=t.createFinalSchema?.(u,o)["~standard"].validate(e)??wt(u,e);Ue(d,"Validation must be synchronous");let h=t.onValidationError??(A=>{throw console.error("\u274C Invalid environment variables:",A),new Error("Invalid environment variables")}),k=t.onInvalidAccess??(()=>{throw new Error("\u274C Attempted to access a server-side environment variable on the client")});if(d.issues)return h(d.issues);let oe=A=>t.clientPrefix?!A.startsWith(t.clientPrefix)&&!(A in i):!0,ve=A=>o||!oe(A),ut=A=>A==="__esModule"||A==="$$typeof",lt=(t.extends??[]).reduce((A,D)=>Object.assign(A,D),{}),pt=Object.assign(lt,d.value);return new Proxy(pt,{get(A,D){if(typeof D=="string"&&!ut(D))return ve(D)?Reflect.get(A,D):k(D)}})}var B={};gt(B,{BRAND:()=>Wt,DIRTY:()=>z,EMPTY_PATH:()=>bt,INVALID:()=>m,NEVER:()=>Cr,OK:()=>E,ParseStatus:()=>w,Schema:()=>g,ZodAny:()=>G,ZodArray:()=>$,ZodBigInt:()=>W,ZodBoolean:()=>Y,ZodBranded:()=>ge,ZodCatch:()=>ae,ZodDate:()=>q,ZodDefault:()=>ne,ZodDiscriminatedUnion:()=>be,ZodEffects:()=>O,ZodEnum:()=>re,ZodError:()=>b,ZodFirstPartyTypeKind:()=>v,ZodFunction:()=>Te,ZodIntersection:()=>X,ZodIssueCode:()=>c,ZodLazy:()=>ee,ZodLiteral:()=>te,ZodMap:()=>fe,ZodNaN:()=>me,ZodNativeEnum:()=>se,ZodNever:()=>I,ZodNull:()=>H,ZodNullable:()=>P,ZodNumber:()=>K,ZodObject:()=>N,ZodOptional:()=>T,ZodParsedType:()=>p,ZodPipeline:()=>ye,ZodPromise:()=>Z,ZodReadonly:()=>ie,ZodRecord:()=>Ne,ZodSchema:()=>g,ZodSet:()=>he,ZodString:()=>U,ZodSymbol:()=>le,ZodTransformer:()=>O,ZodTuple:()=>S,ZodType:()=>g,ZodUndefined:()=>J,ZodUnion:()=>Q,ZodUnknown:()=>j,ZodVoid:()=>pe,addIssueToContext:()=>l,any:()=>rr,array:()=>ir,bigint:()=>Ht,boolean:()=>Qe,coerce:()=>Ir,custom:()=>qe,date:()=>Qt,datetimeRegex:()=>We,defaultErrorMap:()=>V,discriminatedUnion:()=>ur,effect:()=>kr,enum:()=>yr,function:()=>vr,getErrorMap:()=>ce,getParsedType:()=>C,instanceof:()=>qt,intersection:()=>lr,isAborted:()=>Ee,isAsync:()=>de,isDirty:()=>Ae,isValid:()=>M,late:()=>Yt,lazy:()=>_r,literal:()=>gr,makeIssue:()=>_e,map:()=>hr,nan:()=>Jt,nativeEnum:()=>xr,never:()=>nr,null:()=>tr,nullable:()=>Ar,number:()=>He,object:()=>or,objectUtil:()=>De,oboolean:()=>Or,onumber:()=>Rr,optional:()=>Er,ostring:()=>Tr,pipeline:()=>Nr,preprocess:()=>br,promise:()=>wr,quotelessJson:()=>kt,record:()=>fr,set:()=>mr,setErrorMap:()=>At,strictObject:()=>cr,string:()=>Je,symbol:()=>Xt,transformer:()=>kr,tuple:()=>pr,undefined:()=>er,union:()=>dr,unknown:()=>sr,util:()=>y,void:()=>ar});var y;(function(t){t.assertEqual=n=>{};function e(n){}t.assertIs=e;function r(n){throw new Error}t.assertNever=r,t.arrayToEnum=n=>{let a={};for(let i of n)a[i]=i;return a},t.getValidEnumValues=n=>{let a=t.objectKeys(n).filter(o=>typeof n[n[o]]!="number"),i={};for(let o of a)i[o]=n[o];return t.objectValues(i)},t.objectValues=n=>t.objectKeys(n).map(function(a){return n[a]}),t.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let a=[];for(let i in n)Object.prototype.hasOwnProperty.call(n,i)&&a.push(i);return a},t.find=(n,a)=>{for(let i of n)if(a(i))return i},t.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=s,t.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(y||(y={}));var De;(function(t){t.mergeShapes=(e,r)=>({...e,...r})})(De||(De={}));var p=y.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),C=t=>{switch(typeof t){case"undefined":return p.undefined;case"string":return p.string;case"number":return Number.isNaN(t)?p.nan:p.number;case"boolean":return p.boolean;case"function":return p.function;case"bigint":return p.bigint;case"symbol":return p.symbol;case"object":return Array.isArray(t)?p.array:t===null?p.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?p.promise:typeof Map<"u"&&t instanceof Map?p.map:typeof Set<"u"&&t instanceof Set?p.set:typeof Date<"u"&&t instanceof Date?p.date:p.object;default:return p.unknown}};var c=y.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"]),kt=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),b=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(a){return a.message},s={_errors:[]},n=a=>{for(let i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(n);else if(i.code==="invalid_return_type")n(i.returnTypeError);else if(i.code==="invalid_arguments")n(i.argumentsError);else if(i.path.length===0)s._errors.push(r(i));else{let o=s,u=0;for(;u<i.path.length;){let d=i.path[u];u===i.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(r(i))):o[d]=o[d]||{_errors:[]},o=o[d],u++}}};return n(this),s}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,y.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},s=[];for(let n of this.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):s.push(e(n));return{formErrors:s,fieldErrors:r}}get formErrors(){return this.flatten()}};b.create=t=>new b(t);var Et=(t,e)=>{let r;switch(t.code){case c.invalid_type:t.received===p.undefined?r="Required":r=`Expected ${t.expected}, received ${t.received}`;break;case c.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(t.expected,y.jsonStringifyReplacer)}`;break;case c.unrecognized_keys:r=`Unrecognized key(s) in object: ${y.joinValues(t.keys,", ")}`;break;case c.invalid_union:r="Invalid input";break;case c.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${y.joinValues(t.options)}`;break;case c.invalid_enum_value:r=`Invalid enum value. Expected ${y.joinValues(t.options)}, received '${t.received}'`;break;case c.invalid_arguments:r="Invalid function arguments";break;case c.invalid_return_type:r="Invalid function return type";break;case c.invalid_date:r="Invalid date";break;case c.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(r=`${r} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?r=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?r=`Invalid input: must end with "${t.validation.endsWith}"`:y.assertNever(t.validation):t.validation!=="regex"?r=`Invalid ${t.validation}`:r="Invalid";break;case c.too_small:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:r="Invalid input";break;case c.too_big:t.type==="array"?r=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?r=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?r=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?r=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?r=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:r="Invalid input";break;case c.custom:r="Invalid input";break;case c.invalid_intersection_types:r="Intersection results could not be merged";break;case c.not_multiple_of:r=`Number must be a multiple of ${t.multipleOf}`;break;case c.not_finite:r="Number must be finite";break;default:r=e.defaultError,y.assertNever(t)}return{message:r}},V=Et;var Ge=V;function At(t){Ge=t}function ce(){return Ge}var _e=t=>{let{data:e,path:r,errorMaps:s,issueData:n}=t,a=[...r,...n.path||[]],i={...n,path:a};if(n.message!==void 0)return{...n,path:a,message:n.message};let o="",u=s.filter(d=>!!d).slice().reverse();for(let d of u)o=d(i,{data:e,defaultError:o}).message;return{...n,path:a,message:o}},bt=[];function l(t,e){let r=ce(),s=_e({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===V?void 0:V].filter(n=>!!n)});t.common.issues.push(s)}var w=class t{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let s=[];for(let n of r){if(n.status==="aborted")return m;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,r){let s=[];for(let n of r){let a=await n.key,i=await n.value;s.push({key:a,value:i})}return t.mergeObjectSync(e,s)}static mergeObjectSync(e,r){let s={};for(let n of r){let{key:a,value:i}=n;if(a.status==="aborted"||i.status==="aborted")return m;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value<"u"||n.alwaysSet)&&(s[a.value]=i.value)}return{status:e.value,value:s}}},m=Object.freeze({status:"aborted"}),z=t=>({status:"dirty",value:t}),E=t=>({status:"valid",value:t}),Ee=t=>t.status==="aborted",Ae=t=>t.status==="dirty",M=t=>t.status==="valid",de=t=>typeof Promise<"u"&&t instanceof Promise;var f;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message})(f||(f={}));var R=class{constructor(e,r,s,n){this._cachedPath=[],this.parent=e,this.data=r,this._path=s,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Ze=(t,e)=>{if(M(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 r=new b(t.common.issues);return this._error=r,this._error}}};function _(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:s,description:n}=t;if(e&&(r||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:n}:{errorMap:(i,o)=>{let{message:u}=t;return i.code==="invalid_enum_value"?{message:u??o.defaultError}:typeof o.data>"u"?{message:u??s??o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:u??r??o.defaultError}},description:n}}var g=class{get description(){return this._def.description}_getType(e){return C(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:C(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new w,ctx:{common:e.parent.common,data:e.data,parsedType:C(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(de(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let s=this.safeParse(e,r);if(s.success)return s.data;throw s.error}safeParse(e,r){let s={common:{issues:[],async:r?.async??!1,contextualErrorMap:r?.errorMap},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:C(e)},n=this._parseSync({data:e,path:s.path,parent:s});return Ze(s,n)}"~validate"(e){let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:C(e)};if(!this["~standard"].async)try{let s=this._parseSync({data:e,path:[],parent:r});return M(s)?{value:s.value}:{issues:r.common.issues}}catch(s){s?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(s=>M(s)?{value:s.value}:{issues:r.common.issues})}async parseAsync(e,r){let s=await this.safeParseAsync(e,r);if(s.success)return s.data;throw s.error}async safeParseAsync(e,r){let s={common:{issues:[],contextualErrorMap:r?.errorMap,async:!0},path:r?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:C(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(de(n)?n:Promise.resolve(n));return Ze(s,a)}refine(e,r){let s=n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r;return this._refinement((n,a)=>{let i=e(n),o=()=>a.addIssue({code:c.custom,...s(n)});return typeof Promise<"u"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,r){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof r=="function"?r(s,n):r),!1))}_refinement(e){return new O({schema:this,typeName:v.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:r=>this["~validate"](r)}}optional(){return T.create(this,this._def)}nullable(){return P.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return $.create(this)}promise(){return Z.create(this,this._def)}or(e){return Q.create([this,e],this._def)}and(e){return X.create(this,e,this._def)}transform(e){return new O({..._(this._def),schema:this,typeName:v.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let r=typeof e=="function"?e:()=>e;return new ne({..._(this._def),innerType:this,defaultValue:r,typeName:v.ZodDefault})}brand(){return new ge({typeName:v.ZodBranded,type:this,..._(this._def)})}catch(e){let r=typeof e=="function"?e:()=>e;return new ae({..._(this._def),innerType:this,catchValue:r,typeName:v.ZodCatch})}describe(e){let r=this.constructor;return new r({...this._def,description:e})}pipe(e){return ye.create(this,e)}readonly(){return ie.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Nt=/^c[^\s-]{8,}$/i,Tt=/^[0-9a-z]+$/,Rt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Ot=/^[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,It=/^[a-z0-9_-]{21}$/i,Ct=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,St=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Pt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Dt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Ve,Vt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Lt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,jt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,$t=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ft=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Mt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ze="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Ut=new RegExp(`^${ze}$`);function Ke(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let r=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${r}`}function Gt(t){return new RegExp(`^${Ke(t)}$`)}function We(t){let e=`${ze}T${Ke(t)}`,r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${r.join("|")})`,new RegExp(`^${e}$`)}function Zt(t,e){return!!((e==="v4"||!e)&&Vt.test(t)||(e==="v6"||!e)&&jt.test(t))}function Bt(t,e){if(!Ct.test(t))return!1;try{let[r]=t.split("."),s=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&n?.typ!=="JWT"||!n.alg||e&&n.alg!==e)}catch{return!1}}function zt(t,e){return!!((e==="v4"||!e)&&Lt.test(t)||(e==="v6"||!e)&&$t.test(t))}var U=class t extends g{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:p.string,received:a.parsedType}),m}let s=new w,n;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){let i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(n=this._getOrReturnCtx(e,n),i?l(n,{code:c.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&l(n,{code:c.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")Pt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"email",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")Ve||(Ve=new RegExp(Dt,"u")),Ve.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"emoji",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")Ot.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"uuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")It.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"nanoid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")Nt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cuid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")Tt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cuid2",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")Rt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"ulid",code:c.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{n=this._getOrReturnCtx(e,n),l(n,{validation:"url",code:c.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"regex",code:c.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?We(a).test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?Ut.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?Gt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{code:c.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?St.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"duration",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?Zt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"ip",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?Bt(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"jwt",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?zt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"cidr",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?Ft.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"base64",code:c.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?Mt.test(e.data)||(n=this._getOrReturnCtx(e,n),l(n,{validation:"base64url",code:c.invalid_string,message:a.message}),s.dirty()):y.assertNever(a);return{status:s.value,value:e.data}}_regex(e,r,s){return this.refinement(n=>e.test(n),{validation:r,code:c.invalid_string,...f.errToObj(s)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...f.errToObj(e)})}url(e){return this._addCheck({kind:"url",...f.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...f.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...f.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...f.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...f.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...f.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...f.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...f.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...f.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...f.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...f.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...f.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??!1,local:e?.local??!1,...f.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...f.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...f.errToObj(e)})}regex(e,r){return this._addCheck({kind:"regex",regex:e,...f.errToObj(r)})}includes(e,r){return this._addCheck({kind:"includes",value:e,position:r?.position,...f.errToObj(r?.message)})}startsWith(e,r){return this._addCheck({kind:"startsWith",value:e,...f.errToObj(r)})}endsWith(e,r){return this._addCheck({kind:"endsWith",value:e,...f.errToObj(r)})}min(e,r){return this._addCheck({kind:"min",value:e,...f.errToObj(r)})}max(e,r){return this._addCheck({kind:"max",value:e,...f.errToObj(r)})}length(e,r){return this._addCheck({kind:"length",value:e,...f.errToObj(r)})}nonempty(e){return this.min(1,f.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 isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};U.create=t=>new U({checks:[],typeName:v.ZodString,coerce:t?.coerce??!1,..._(t)});function Kt(t,e){let r=(t.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=r>s?r:s,a=Number.parseInt(t.toFixed(n).replace(".","")),i=Number.parseInt(e.toFixed(n).replace(".",""));return a%i/10**n}var K=class t extends g{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)!==p.number){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:p.number,received:a.parsedType}),m}let s,n=new w;for(let a of this._def.checks)a.kind==="int"?y.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?Kt(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),l(s,{code:c.not_finite,message:a.message}),n.dirty()):y.assertNever(a);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,f.toString(r))}gt(e,r){return this.setLimit("min",e,!1,f.toString(r))}lte(e,r){return this.setLimit("max",e,!0,f.toString(r))}lt(e,r){return this.setLimit("max",e,!1,f.toString(r))}setLimit(e,r,s,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:f.toString(n)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:f.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:f.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:f.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:f.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:f.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:f.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:f.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:f.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:f.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&y.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(r===null||s.value>r)&&(r=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(r)&&Number.isFinite(e)}};K.create=t=>new K({checks:[],typeName:v.ZodNumber,coerce:t?.coerce||!1,..._(t)});var W=class t extends g{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==p.bigint)return this._getInvalidInput(e);let s,n=new w;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),l(s,{code:c.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):y.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return l(r,{code:c.invalid_type,expected:p.bigint,received:r.parsedType}),m}gte(e,r){return this.setLimit("min",e,!0,f.toString(r))}gt(e,r){return this.setLimit("min",e,!1,f.toString(r))}lte(e,r){return this.setLimit("max",e,!0,f.toString(r))}lt(e,r){return this.setLimit("max",e,!1,f.toString(r))}setLimit(e,r,s,n){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:r,inclusive:s,message:f.toString(n)}]})}_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:f.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:f.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:f.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:f.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:f.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};W.create=t=>new W({checks:[],typeName:v.ZodBigInt,coerce:t?.coerce??!1,..._(t)});var Y=class extends g{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.boolean){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:p.boolean,received:s.parsedType}),m}return E(e.data)}};Y.create=t=>new Y({typeName:v.ZodBoolean,coerce:t?.coerce||!1,..._(t)});var q=class t extends g{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_type,expected:p.date,received:a.parsedType}),m}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return l(a,{code:c.invalid_date}),m}let s=new w,n;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),l(n,{code:c.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):y.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:f.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:f.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};q.create=t=>new q({checks:[],coerce:t?.coerce||!1,typeName:v.ZodDate,..._(t)});var le=class extends g{_parse(e){if(this._getType(e)!==p.symbol){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:p.symbol,received:s.parsedType}),m}return E(e.data)}};le.create=t=>new le({typeName:v.ZodSymbol,..._(t)});var J=class extends g{_parse(e){if(this._getType(e)!==p.undefined){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:p.undefined,received:s.parsedType}),m}return E(e.data)}};J.create=t=>new J({typeName:v.ZodUndefined,..._(t)});var H=class extends g{_parse(e){if(this._getType(e)!==p.null){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:p.null,received:s.parsedType}),m}return E(e.data)}};H.create=t=>new H({typeName:v.ZodNull,..._(t)});var G=class extends g{constructor(){super(...arguments),this._any=!0}_parse(e){return E(e.data)}};G.create=t=>new G({typeName:v.ZodAny,..._(t)});var j=class extends g{constructor(){super(...arguments),this._unknown=!0}_parse(e){return E(e.data)}};j.create=t=>new j({typeName:v.ZodUnknown,..._(t)});var I=class extends g{_parse(e){let r=this._getOrReturnCtx(e);return l(r,{code:c.invalid_type,expected:p.never,received:r.parsedType}),m}};I.create=t=>new I({typeName:v.ZodNever,..._(t)});var pe=class extends g{_parse(e){if(this._getType(e)!==p.undefined){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:p.void,received:s.parsedType}),m}return E(e.data)}};pe.create=t=>new pe({typeName:v.ZodVoid,..._(t)});var $=class t extends g{_parse(e){let{ctx:r,status:s}=this._processInputParams(e),n=this._def;if(r.parsedType!==p.array)return l(r,{code:c.invalid_type,expected:p.array,received:r.parsedType}),m;if(n.exactLength!==null){let i=r.data.length>n.exactLength.value,o=r.data.length<n.exactLength.value;(i||o)&&(l(r,{code:i?c.too_big:c.too_small,minimum:o?n.exactLength.value:void 0,maximum:i?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(l(r,{code:c.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(l(r,{code:c.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),r.common.async)return Promise.all([...r.data].map((i,o)=>n.type._parseAsync(new R(r,i,r.path,o)))).then(i=>w.mergeArray(s,i));let a=[...r.data].map((i,o)=>n.type._parseSync(new R(r,i,r.path,o)));return w.mergeArray(s,a)}get element(){return this._def.type}min(e,r){return new t({...this._def,minLength:{value:e,message:f.toString(r)}})}max(e,r){return new t({...this._def,maxLength:{value:e,message:f.toString(r)}})}length(e,r){return new t({...this._def,exactLength:{value:e,message:f.toString(r)}})}nonempty(e){return this.min(1,e)}};$.create=(t,e)=>new $({type:t,minLength:null,maxLength:null,exactLength:null,typeName:v.ZodArray,..._(e)});function ue(t){if(t instanceof N){let e={};for(let r in t.shape){let s=t.shape[r];e[r]=T.create(ue(s))}return new N({...t._def,shape:()=>e})}else return t instanceof $?new $({...t._def,type:ue(t.element)}):t instanceof T?T.create(ue(t.unwrap())):t instanceof P?P.create(ue(t.unwrap())):t instanceof S?S.create(t.items.map(e=>ue(e))):t}var N=class t extends g{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(),r=y.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==p.object){let d=this._getOrReturnCtx(e);return l(d,{code:c.invalid_type,expected:p.object,received:d.parsedType}),m}let{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof I&&this._def.unknownKeys==="strip"))for(let d in n.data)i.includes(d)||o.push(d);let u=[];for(let d of i){let h=a[d],k=n.data[d];u.push({key:{status:"valid",value:d},value:h._parse(new R(n,k,n.path,d)),alwaysSet:d in n.data})}if(this._def.catchall instanceof I){let d=this._def.unknownKeys;if(d==="passthrough")for(let h of o)u.push({key:{status:"valid",value:h},value:{status:"valid",value:n.data[h]}});else if(d==="strict")o.length>0&&(l(n,{code:c.unrecognized_keys,keys:o}),s.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let d=this._def.catchall;for(let h of o){let k=n.data[h];u.push({key:{status:"valid",value:h},value:d._parse(new R(n,k,n.path,h)),alwaysSet:h in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let d=[];for(let h of u){let k=await h.key,oe=await h.value;d.push({key:k,value:oe,alwaysSet:h.alwaysSet})}return d}).then(d=>w.mergeObjectSync(s,d)):w.mergeObjectSync(s,u)}get shape(){return this._def.shape()}strict(e){return f.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(r,s)=>{let n=this._def.errorMap?.(r,s).message??s.defaultError;return r.code==="unrecognized_keys"?{message:f.errToObj(e).message??n}:{message:n}}}:{}})}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:v.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let r={};for(let s of y.objectKeys(e))e[s]&&this.shape[s]&&(r[s]=this.shape[s]);return new t({...this._def,shape:()=>r})}omit(e){let r={};for(let s of y.objectKeys(this.shape))e[s]||(r[s]=this.shape[s]);return new t({...this._def,shape:()=>r})}deepPartial(){return ue(this)}partial(e){let r={};for(let s of y.objectKeys(this.shape)){let n=this.shape[s];e&&!e[s]?r[s]=n:r[s]=n.optional()}return new t({...this._def,shape:()=>r})}required(e){let r={};for(let s of y.objectKeys(this.shape))if(e&&!e[s])r[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof T;)a=a._def.innerType;r[s]=a}return new t({...this._def,shape:()=>r})}keyof(){return Ye(y.objectKeys(this.shape))}};N.create=(t,e)=>new N({shape:()=>t,unknownKeys:"strip",catchall:I.create(),typeName:v.ZodObject,..._(e)});N.strictCreate=(t,e)=>new N({shape:()=>t,unknownKeys:"strict",catchall:I.create(),typeName:v.ZodObject,..._(e)});N.lazycreate=(t,e)=>new N({shape:t,unknownKeys:"strip",catchall:I.create(),typeName:v.ZodObject,..._(e)});var Q=class extends g{_parse(e){let{ctx:r}=this._processInputParams(e),s=this._def.options;function n(a){for(let o of a)if(o.result.status==="valid")return o.result;for(let o of a)if(o.result.status==="dirty")return r.common.issues.push(...o.ctx.common.issues),o.result;let i=a.map(o=>new b(o.ctx.common.issues));return l(r,{code:c.invalid_union,unionErrors:i}),m}if(r.common.async)return Promise.all(s.map(async a=>{let i={...r,common:{...r.common,issues:[]},parent:null};return{result:await a._parseAsync({data:r.data,path:r.path,parent:i}),ctx:i}})).then(n);{let a,i=[];for(let u of s){let d={...r,common:{...r.common,issues:[]},parent:null},h=u._parseSync({data:r.data,path:r.path,parent:d});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,ctx:d}),d.common.issues.length&&i.push(d.common.issues)}if(a)return r.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(u=>new b(u));return l(r,{code:c.invalid_union,unionErrors:o}),m}}get options(){return this._def.options}};Q.create=(t,e)=>new Q({options:t,typeName:v.ZodUnion,..._(e)});var L=t=>t instanceof ee?L(t.schema):t instanceof O?L(t.innerType()):t instanceof te?[t.value]:t instanceof re?t.options:t instanceof se?y.objectValues(t.enum):t instanceof ne?L(t._def.innerType):t instanceof J?[void 0]:t instanceof H?[null]:t instanceof T?[void 0,...L(t.unwrap())]:t instanceof P?[null,...L(t.unwrap())]:t instanceof ge||t instanceof ie?L(t.unwrap()):t instanceof ae?L(t._def.innerType):[],be=class t extends g{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==p.object)return l(r,{code:c.invalid_type,expected:p.object,received:r.parsedType}),m;let s=this.discriminator,n=r.data[s],a=this.optionsMap.get(n);return a?r.common.async?a._parseAsync({data:r.data,path:r.path,parent:r}):a._parseSync({data:r.data,path:r.path,parent:r}):(l(r,{code:c.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),m)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,s){let n=new Map;for(let a of r){let i=L(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let o of i){if(n.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);n.set(o,a)}}return new t({typeName:v.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:n,..._(s)})}};function Le(t,e){let r=C(t),s=C(e);if(t===e)return{valid:!0,data:t};if(r===p.object&&s===p.object){let n=y.objectKeys(e),a=y.objectKeys(t).filter(o=>n.indexOf(o)!==-1),i={...t,...e};for(let o of a){let u=Le(t[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(r===p.array&&s===p.array){if(t.length!==e.length)return{valid:!1};let n=[];for(let a=0;a<t.length;a++){let i=t[a],o=e[a],u=Le(i,o);if(!u.valid)return{valid:!1};n.push(u.data)}return{valid:!0,data:n}}else return r===p.date&&s===p.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}var X=class extends g{_parse(e){let{status:r,ctx:s}=this._processInputParams(e),n=(a,i)=>{if(Ee(a)||Ee(i))return m;let o=Le(a.value,i.value);return o.valid?((Ae(a)||Ae(i))&&r.dirty(),{status:r.value,value:o.data}):(l(s,{code:c.invalid_intersection_types}),m)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,i])=>n(a,i)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};X.create=(t,e,r)=>new X({left:t,right:e,typeName:v.ZodIntersection,..._(r)});var S=class t extends g{_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.array)return l(s,{code:c.invalid_type,expected:p.array,received:s.parsedType}),m;if(s.data.length<this._def.items.length)return l(s,{code:c.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m;!this._def.rest&&s.data.length>this._def.items.length&&(l(s,{code:c.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let a=[...s.data].map((i,o)=>{let u=this._def.items[o]||this._def.rest;return u?u._parse(new R(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(a).then(i=>w.mergeArray(r,i)):w.mergeArray(r,a)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};S.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new S({items:t,typeName:v.ZodTuple,rest:null,..._(e)})};var Ne=class t extends g{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.object)return l(s,{code:c.invalid_type,expected:p.object,received:s.parsedType}),m;let n=[],a=this._def.keyType,i=this._def.valueType;for(let o in s.data)n.push({key:a._parse(new R(s,o,s.path,o)),value:i._parse(new R(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?w.mergeObjectAsync(r,n):w.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(e,r,s){return r instanceof g?new t({keyType:e,valueType:r,typeName:v.ZodRecord,..._(s)}):new t({keyType:U.create(),valueType:e,typeName:v.ZodRecord,..._(r)})}},fe=class extends g{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.map)return l(s,{code:c.invalid_type,expected:p.map,received:s.parsedType}),m;let n=this._def.keyType,a=this._def.valueType,i=[...s.data.entries()].map(([o,u],d)=>({key:n._parse(new R(s,o,s.path,[d,"key"])),value:a._parse(new R(s,u,s.path,[d,"value"]))}));if(s.common.async){let o=new Map;return Promise.resolve().then(async()=>{for(let u of i){let d=await u.key,h=await u.value;if(d.status==="aborted"||h.status==="aborted")return m;(d.status==="dirty"||h.status==="dirty")&&r.dirty(),o.set(d.value,h.value)}return{status:r.value,value:o}})}else{let o=new Map;for(let u of i){let d=u.key,h=u.value;if(d.status==="aborted"||h.status==="aborted")return m;(d.status==="dirty"||h.status==="dirty")&&r.dirty(),o.set(d.value,h.value)}return{status:r.value,value:o}}}};fe.create=(t,e,r)=>new fe({valueType:e,keyType:t,typeName:v.ZodMap,..._(r)});var he=class t extends g{_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.set)return l(s,{code:c.invalid_type,expected:p.set,received:s.parsedType}),m;let n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(l(s,{code:c.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(l(s,{code:c.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());let a=this._def.valueType;function i(u){let d=new Set;for(let h of u){if(h.status==="aborted")return m;h.status==="dirty"&&r.dirty(),d.add(h.value)}return{status:r.value,value:d}}let o=[...s.data.values()].map((u,d)=>a._parse(new R(s,u,s.path,d)));return s.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,r){return new t({...this._def,minSize:{value:e,message:f.toString(r)}})}max(e,r){return new t({...this._def,maxSize:{value:e,message:f.toString(r)}})}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};he.create=(t,e)=>new he({valueType:t,minSize:null,maxSize:null,typeName:v.ZodSet,..._(e)});var Te=class t extends g{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==p.function)return l(r,{code:c.invalid_type,expected:p.function,received:r.parsedType}),m;function s(o,u){return _e({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ce(),V].filter(d=>!!d),issueData:{code:c.invalid_arguments,argumentsError:u}})}function n(o,u){return _e({data:o,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,ce(),V].filter(d=>!!d),issueData:{code:c.invalid_return_type,returnTypeError:u}})}let a={errorMap:r.common.contextualErrorMap},i=r.data;if(this._def.returns instanceof Z){let o=this;return E(async function(...u){let d=new b([]),h=await o._def.args.parseAsync(u,a).catch(ve=>{throw d.addIssue(s(u,ve)),d}),k=await Reflect.apply(i,this,h);return await o._def.returns._def.type.parseAsync(k,a).catch(ve=>{throw d.addIssue(n(k,ve)),d})})}else{let o=this;return E(function(...u){let d=o._def.args.safeParse(u,a);if(!d.success)throw new b([s(u,d.error)]);let h=Reflect.apply(i,this,d.data),k=o._def.returns.safeParse(h,a);if(!k.success)throw new b([n(h,k.error)]);return k.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:S.create(e).rest(j.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,r,s){return new t({args:e||S.create([]).rest(j.create()),returns:r||j.create(),typeName:v.ZodFunction,..._(s)})}},ee=class extends g{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};ee.create=(t,e)=>new ee({getter:t,typeName:v.ZodLazy,..._(e)});var te=class extends g{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return l(r,{received:r.data,code:c.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}};te.create=(t,e)=>new te({value:t,typeName:v.ZodLiteral,..._(e)});function Ye(t,e){return new re({values:t,typeName:v.ZodEnum,..._(e)})}var re=class t extends g{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),s=this._def.values;return l(r,{expected:y.joinValues(s),received:r.parsedType,code:c.invalid_type}),m}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),s=this._def.values;return l(r,{received:r.data,code:c.invalid_enum_value,options:s}),m}return E(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return t.create(e,{...this._def,...r})}exclude(e,r=this._def){return t.create(this.options.filter(s=>!e.includes(s)),{...this._def,...r})}};re.create=Ye;var se=class extends g{_parse(e){let r=y.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==p.string&&s.parsedType!==p.number){let n=y.objectValues(r);return l(s,{expected:y.joinValues(n),received:s.parsedType,code:c.invalid_type}),m}if(this._cache||(this._cache=new Set(y.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=y.objectValues(r);return l(s,{received:s.data,code:c.invalid_enum_value,options:n}),m}return E(e.data)}get enum(){return this._def.values}};se.create=(t,e)=>new se({values:t,typeName:v.ZodNativeEnum,..._(e)});var Z=class extends g{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==p.promise&&r.common.async===!1)return l(r,{code:c.invalid_type,expected:p.promise,received:r.parsedType}),m;let s=r.parsedType===p.promise?r.data:Promise.resolve(r.data);return E(s.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};Z.create=(t,e)=>new Z({type:t,typeName:v.ZodPromise,..._(e)});var O=class extends g{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===v.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:i=>{l(s,i),i.fatal?r.abort():r.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){let i=n.transform(s.data,a);if(s.common.async)return Promise.resolve(i).then(async o=>{if(r.value==="aborted")return m;let u=await this._def.schema._parseAsync({data:o,path:s.path,parent:s});return u.status==="aborted"?m:u.status==="dirty"?z(u.value):r.value==="dirty"?z(u.value):u});{if(r.value==="aborted")return m;let o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?m:o.status==="dirty"?z(o.value):r.value==="dirty"?z(o.value):o}}if(n.type==="refinement"){let i=o=>{let u=n.refinement(o,a);if(s.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?m:(o.status==="dirty"&&r.dirty(),i(o.value),{status:r.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?m:(o.status==="dirty"&&r.dirty(),i(o.value).then(()=>({status:r.value,value:o.value}))))}if(n.type==="transform")if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!M(i))return m;let o=n.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>M(i)?Promise.resolve(n.transform(i.value,a)).then(o=>({status:r.value,value:o})):m);y.assertNever(n)}};O.create=(t,e,r)=>new O({schema:t,typeName:v.ZodEffects,effect:e,..._(r)});O.createWithPreprocess=(t,e,r)=>new O({schema:e,effect:{type:"preprocess",transform:t},typeName:v.ZodEffects,..._(r)});var T=class extends g{_parse(e){return this._getType(e)===p.undefined?E(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};T.create=(t,e)=>new T({innerType:t,typeName:v.ZodOptional,..._(e)});var P=class extends g{_parse(e){return this._getType(e)===p.null?E(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};P.create=(t,e)=>new P({innerType:t,typeName:v.ZodNullable,..._(e)});var ne=class extends g{_parse(e){let{ctx:r}=this._processInputParams(e),s=r.data;return r.parsedType===p.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};ne.create=(t,e)=>new ne({innerType:t,typeName:v.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,..._(e)});var ae=class extends g{_parse(e){let{ctx:r}=this._processInputParams(e),s={...r,common:{...r.common,issues:[]}},n=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return de(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new b(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new b(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};ae.create=(t,e)=>new ae({innerType:t,typeName:v.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,..._(e)});var me=class extends g{_parse(e){if(this._getType(e)!==p.nan){let s=this._getOrReturnCtx(e);return l(s,{code:c.invalid_type,expected:p.nan,received:s.parsedType}),m}return{status:"valid",value:e.data}}};me.create=t=>new me({typeName:v.ZodNaN,..._(t)});var Wt=Symbol("zod_brand"),ge=class extends g{_parse(e){let{ctx:r}=this._processInputParams(e),s=r.data;return this._def.type._parse({data:s,path:r.path,parent:r})}unwrap(){return this._def.type}},ye=class t extends g{_parse(e){let{status:r,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?m:a.status==="dirty"?(r.dirty(),z(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?m:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,r){return new t({in:e,out:r,typeName:v.ZodPipeline})}},ie=class extends g{_parse(e){let r=this._def.innerType._parse(e),s=n=>(M(n)&&(n.value=Object.freeze(n.value)),n);return de(r)?r.then(n=>s(n)):s(r)}unwrap(){return this._def.innerType}};ie.create=(t,e)=>new ie({innerType:t,typeName:v.ZodReadonly,..._(e)});function Be(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}function qe(t,e={},r){return t?G.create().superRefine((s,n)=>{let a=t(s);if(a instanceof Promise)return a.then(i=>{if(!i){let o=Be(e,s),u=o.fatal??r??!0;n.addIssue({code:"custom",...o,fatal:u})}});if(!a){let i=Be(e,s),o=i.fatal??r??!0;n.addIssue({code:"custom",...i,fatal:o})}}):G.create()}var Yt={object:N.lazycreate},v;(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"})(v||(v={}));var qt=(t,e={message:`Input not instance of ${t.name}`})=>qe(r=>r instanceof t,e),Je=U.create,He=K.create,Jt=me.create,Ht=W.create,Qe=Y.create,Qt=q.create,Xt=le.create,er=J.create,tr=H.create,rr=G.create,sr=j.create,nr=I.create,ar=pe.create,ir=$.create,or=N.create,cr=N.strictCreate,dr=Q.create,ur=be.create,lr=X.create,pr=S.create,fr=Ne.create,hr=fe.create,mr=he.create,vr=Te.create,_r=ee.create,gr=te.create,yr=re.create,xr=se.create,wr=Z.create,kr=O.create,Er=T.create,Ar=P.create,br=O.createWithPreprocess,Nr=ye.create,Tr=()=>Je().optional(),Rr=()=>He().optional(),Or=()=>Qe().optional(),Ir={string:t=>U.create({...t,coerce:!0}),number:t=>K.create({...t,coerce:!0}),boolean:t=>Y.create({...t,coerce:!0}),bigint:t=>W.create({...t,coerce:!0}),date:t=>q.create({...t,coerce:!0})};var Cr=m;var xe=(i=>(i.PROD_CN="prod-cn",i.PROD="prod",i.STAGING="staging",i.STAGING_CN="staging-cn",i.DEV="dev",i.LOCAL="local",i))(xe||{}),Xe=({fallback:t="prod"})=>{let e=process.env.ENV;if(!e)return t;let r=e.toLowerCase().trim();return Object.values(xe).includes(r)?r:t},et=t=>t==="prod-cn"||t==="staging-cn";var Sr=t=>{switch(t){case"local":return{CONNECT_API_BASE_URL:"http://localhost:3000/rest",CANVA_ENV_URL:"http://localhost:3000",CANVA_CLI_CLIENT_ID:"FAKE_CLIENT_ID",FLAVOR:"local"};case"dev":return{CONNECT_API_BASE_URL:"https://api.canva-dev.com/rest",CANVA_ENV_URL:"https://www.canva-dev.com",CANVA_CLI_CLIENT_ID:"OC-AZFEJKOjQYw3",FLAVOR:"dev"};case"staging-cn":return{CONNECT_API_BASE_URL:"https://api.canva-staging.cn/rest",CANVA_ENV_URL:"https://www.canva-staging.cn",CANVA_CLI_CLIENT_ID:"OC-AZNlOhtxI_Zb",FLAVOR:"staging-cn"};case"staging":return{CONNECT_API_BASE_URL:"https://api.canva-staging.com/rest",CANVA_ENV_URL:"https://www.canva-staging.com",CANVA_CLI_CLIENT_ID:"OC-AZH-EOTpT8Ib",FLAVOR:"staging"};case"prod-cn":return{CONNECT_API_BASE_URL:"https://api.canva.cn/rest",CANVA_ENV_URL:"https://www.canva.cn",CANVA_CLI_CLIENT_ID:"OC-AZN2AS1hKtVM",FLAVOR:"prod-cn"};case"prod":default:return{CONNECT_API_BASE_URL:"https://api.canva.com/rest",CANVA_ENV_URL:"https://www.canva.com",CANVA_CLI_CLIENT_ID:"OC-AZICxlGo2biD",FLAVOR:"prod"}}},tt=({fallback:t="prod"})=>Pe({server:{FLAVOR:B.enum(["prod","prod-cn","staging","staging-cn","dev","local"]).default(t),CONNECT_API_BASE_URL:B.string().url(),CANVA_ENV_URL:B.string().url(),CANVA_CLI_CLIENT_ID:B.enum(["OC-AZICxlGo2biD","OC-AZN2AS1hKtVM","OC-AZH-EOTpT8Ib","OC-AZNlOhtxI_Zb","OC-AZFEJKOjQYw3","FAKE_CLIENT_ID"]).default("OC-AZICxlGo2biD"),CANVA_CLI_MANIFEST_ENABLED:B.boolean().default(!1)},runtimeEnv:{...Sr(Xe({fallback:t})),CANVA_CLI_MANIFEST_ENABLED:process.env.CANVA_CLI_MANIFEST_ENABLED==="true"},emptyStringAsUndefined:!0});var ct=xt(ot(),1);import Wr from"path";var Ie=class{constructor(e,r,s=Wr,n=!1){this.env=e;this.fileService=r;this.pathModule=s;this.debug=n}get isChina(){return et(this.env.FLAVOR)}handleError(e,r,s){let n=`${r}: ${e instanceof Error?e.message:String(e)}`;return this.debug&&console.error(n),{success:!1,code:s,message:n}}async getAppIdFromEnvFile(){let e=this.pathModule.resolve(process.cwd(),".env"),r=await this.fileService.exists(e);if(!r.success||!r.data){let i="No .env file found, ensure you are in your intended app's directory.";return this.debug&&console.error(i),{success:!1,code:"FILE_NOT_FOUND",message:i}}let s=await this.fileService.readFile(e);if(!s.success)return s;let a=ct.parse(s.data).CANVA_APP_ID;if(!a){let i="CANVA_APP_ID not found in .env file";return this.debug&&console.error(i),{success:!1,code:"MISSING_FIELD",message:i}}return{success:!0,data:a}}async fetchRemoteEnvTemplate(){try{let e=await fetch("https://raw.githubusercontent.com/canva-sdks/canva-apps-sdk-starter-kit/refs/heads/main/.env.template");return e.ok?{success:!0,data:await e.text()}:this.handleError(new Error(e.statusText),"Failed to fetch .env.template","FILE_NOT_FOUND")}catch(e){return this.handleError(e,"Failed to fetch .env.template","FILE_NOT_FOUND")}}async parseEnvFile(e){let r=await this.fileService.exists(e);if(!r.success||!r.data)return{success:!0,data:new Set};let s=await this.fileService.readFile(e);return s.success?{success:!0,data:new Set(s.data.split(`
|
|
5
|
+
`).map(a=>a.trim()).filter(a=>a&&!a.startsWith("#")).filter(a=>a.includes("=")).map(a=>a.split("=")[0]?.trim()??"").filter(a=>a!==""))}:s}};import Yr from"fs/promises";var Ce=class{constructor(e=Yr,r=!1){this.fileSystem=e;this.debug=r}handleError(e,r,s){let n=`${r}: ${e instanceof Error?e.message:String(e)}`;return this.debug&&console.error(n),{success:!1,code:s,message:n}}async handleFileOperation(e,r,s){try{return{success:!0,data:await e()}}catch(n){return this.handleError(n,`Failed to ${s} file at ${r}`,"FILE_NOT_FOUND")}}async exists(e){return this.handleFileOperation(()=>this.fileSystem.access(e),e,"access").then(r=>({success:!0,data:r.success}))}async readFile(e){return this.handleFileOperation(()=>this.fileSystem.readFile(e,"utf-8"),e,"read")}async writeFile(e,r){return this.handleFileOperation(async()=>(await this.fileSystem.writeFile(e,r,"utf-8"),!0),e,"write")}async readDir(e){return this.handleFileOperation(async()=>{let r=await this.fileSystem.readdir(e),s=[];for(let n of r){let a=`${e}/${n}`;if((await this.fileSystem.stat(a)).isDirectory()){let o=await this.readDir(a);o.success&&s.push(...o.data)}else s.push(a)}return s},e,"readDir")}};var dt=tt({fallback:"prod"}),qr=new Ce,Jr=new Ie(dt,qr),Hr=new ke(Jr,dt),pn=()=>Hr.generatePreviewResult();export{pn as generatePreviewUrl};
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as chalk from "chalk";
|
|
2
|
+
import * as cookieParser from "cookie-parser";
|
|
2
3
|
import * as crypto from "crypto";
|
|
3
4
|
import "dotenv/config";
|
|
4
5
|
import * as express from "express";
|
|
5
|
-
import * as cookieParser from "cookie-parser";
|
|
6
6
|
import * as basicAuth from "express-basic-auth";
|
|
7
|
-
import { JSONFileDatabase } from "../database/database";
|
|
8
|
-
import { getTokenFromQueryString } from "../../utils/backend/jwt_middleware/jwt_middleware";
|
|
9
7
|
import { createJwtMiddleware } from "../../utils/backend/jwt_middleware";
|
|
8
|
+
import { getTokenFromQueryString } from "../../utils/backend/jwt_middleware/jwt_middleware";
|
|
9
|
+
import { JSONFileDatabase } from "../database/database";
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* These are the hard-coded credentials for logging in to this template.
|
|
@@ -16,7 +16,7 @@ const PASSWORD = "password";
|
|
|
16
16
|
|
|
17
17
|
const COOKIE_EXPIRY_MS = 5 * 60 * 1000; // 5 minutes
|
|
18
18
|
|
|
19
|
-
const CANVA_BASE_URL = "https://canva.com";
|
|
19
|
+
const CANVA_BASE_URL = "https://www.canva.com";
|
|
20
20
|
|
|
21
21
|
interface Data {
|
|
22
22
|
users: string[];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as crypto from "crypto";
|
|
2
2
|
import "dotenv/config";
|
|
3
|
+
import * as debug from "debug";
|
|
3
4
|
import * as express from "express";
|
|
4
5
|
import * as basicAuth from "express-basic-auth";
|
|
5
|
-
import { JSONFileDatabase } from "../database/database";
|
|
6
6
|
import { createBearerMiddleware } from "../../utils/backend/bearer_middleware";
|
|
7
|
-
import
|
|
7
|
+
import { JSONFileDatabase } from "../database/database";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Prefix your start command with `DEBUG=express:route:oauth` to enable debug logging
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as crypto from "crypto";
|
|
2
|
+
import * as fs from "fs/promises";
|
|
2
3
|
import { pki } from "node-forge";
|
|
3
4
|
import * as path from "path";
|
|
4
|
-
import * as fs from "fs/promises";
|
|
5
5
|
|
|
6
6
|
const SSL_CERT_DIR = path.resolve(process.cwd(), "..", "..", ".ssl");
|
|
7
7
|
const CERT_FILE = path.resolve(SSL_CERT_DIR, "certificate.pem");
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
-
import
|
|
3
|
-
import * as chalk from "chalk";
|
|
4
|
-
import { buildConfig } from "../../webpack.config";
|
|
2
|
+
import { generatePreviewUrl } from "@canva/cli";
|
|
5
3
|
import * as ngrok from "@ngrok/ngrok";
|
|
6
|
-
import * as
|
|
4
|
+
import * as chalk from "chalk";
|
|
7
5
|
import * as Table from "cli-table3";
|
|
6
|
+
import * as nodemon from "nodemon";
|
|
7
|
+
import * as open from "open";
|
|
8
8
|
import * as webpack from "webpack";
|
|
9
9
|
import * as WebpackDevServer from "webpack-dev-server";
|
|
10
|
-
import
|
|
11
|
-
import { generatePreviewUrl } from "@canva/cli";
|
|
10
|
+
import { buildConfig } from "../../webpack.config";
|
|
12
11
|
import type { Certificate } from "../ssl/ssl";
|
|
13
12
|
import { createOrRetrieveCertificate } from "../ssl/ssl";
|
|
13
|
+
import type { Context } from "./context";
|
|
14
14
|
|
|
15
15
|
export const infoChalk = chalk.blue.bold;
|
|
16
16
|
export const warnChalk = chalk.bgYellow.bold;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
+
import debug from "debug";
|
|
2
3
|
import * as express from "express";
|
|
4
|
+
import type { NextFunction, Request, Response } from "express";
|
|
5
|
+
import * as fs from "fs";
|
|
3
6
|
import * as http from "http";
|
|
4
7
|
import * as https from "https";
|
|
5
|
-
import * as fs from "fs";
|
|
6
|
-
import type { Request, Response, NextFunction } from "express";
|
|
7
|
-
import debug from "debug";
|
|
8
8
|
|
|
9
9
|
const serverDebug = debug("server");
|
|
10
10
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
import * as debug from "debug";
|
|
3
|
-
import type { Request, Response
|
|
3
|
+
import type { NextFunction, Request, Response } from "express";
|
|
4
4
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5
5
|
import Express from "express-serve-static-core";
|
|
6
6
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
import * as chalk from "chalk";
|
|
3
3
|
import * as debug from "debug";
|
|
4
|
-
import type { Request, Response
|
|
5
|
-
import * as jwt from "jsonwebtoken";
|
|
6
|
-
import { JwksClient, SigningKeyNotFoundError } from "jwks-rsa";
|
|
4
|
+
import type { NextFunction, Request, Response } from "express";
|
|
7
5
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
8
6
|
import Express from "express-serve-static-core";
|
|
7
|
+
import * as jwt from "jsonwebtoken";
|
|
8
|
+
import { JwksClient, SigningKeyNotFoundError } from "jwks-rsa";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Prefix your start command with `DEBUG=express:middleware:jwt` to enable debug logging
|
|
@@ -7,9 +7,9 @@ import type {
|
|
|
7
7
|
VideoElement,
|
|
8
8
|
} from "@canva/design";
|
|
9
9
|
import { addElementAtCursor, addElementAtPoint } from "@canva/design";
|
|
10
|
-
import { useFeatureSupport } from "./use_feature_support";
|
|
11
10
|
import { features } from "@canva/platform";
|
|
12
11
|
import { useEffect, useState } from "react";
|
|
12
|
+
import { useFeatureSupport } from "./use_feature_support";
|
|
13
13
|
|
|
14
14
|
type AddElementParams =
|
|
15
15
|
| ImageElement
|
|
@@ -182,7 +182,7 @@ export function buildConfig({
|
|
|
182
182
|
new DefinePlugin({
|
|
183
183
|
BACKEND_HOST: JSON.stringify(backendHost),
|
|
184
184
|
}),
|
|
185
|
-
// Apps can only submit a single JS file via the
|
|
185
|
+
// Apps can only submit a single JS file via the Developer Portal
|
|
186
186
|
new optimize.LimitChunkCountPlugin({ maxChunks: 1 }),
|
|
187
187
|
].filter(Boolean),
|
|
188
188
|
...buildDevConfig(devConfig),
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
+
import debug from "debug";
|
|
2
3
|
import * as express from "express";
|
|
4
|
+
import type { NextFunction, Request, Response } from "express";
|
|
5
|
+
import * as fs from "fs";
|
|
3
6
|
import * as http from "http";
|
|
4
7
|
import * as https from "https";
|
|
5
|
-
import * as fs from "fs";
|
|
6
|
-
import type { Request, Response, NextFunction } from "express";
|
|
7
|
-
import debug from "debug";
|
|
8
8
|
|
|
9
9
|
const serverDebug = debug("server");
|
|
10
10
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
import * as chalk from "chalk";
|
|
3
3
|
import * as debug from "debug";
|
|
4
|
-
import type { Request, Response
|
|
5
|
-
import * as jwt from "jsonwebtoken";
|
|
6
|
-
import { JwksClient, SigningKeyNotFoundError } from "jwks-rsa";
|
|
4
|
+
import type { NextFunction, Request, Response } from "express";
|
|
7
5
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
8
6
|
import Express from "express-serve-static-core";
|
|
7
|
+
import * as jwt from "jsonwebtoken";
|
|
8
|
+
import { JwksClient, SigningKeyNotFoundError } from "jwks-rsa";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Prefix your start command with `DEBUG=express:middleware:jwt` to enable debug logging
|
|
@@ -7,9 +7,9 @@ import type {
|
|
|
7
7
|
VideoElement,
|
|
8
8
|
} from "@canva/design";
|
|
9
9
|
import { addElementAtCursor, addElementAtPoint } from "@canva/design";
|
|
10
|
-
import { useFeatureSupport } from "./use_feature_support";
|
|
11
10
|
import { features } from "@canva/platform";
|
|
12
11
|
import { useEffect, useState } from "react";
|
|
12
|
+
import { useFeatureSupport } from "./use_feature_support";
|
|
13
13
|
|
|
14
14
|
type AddElementParams =
|
|
15
15
|
| ImageElement
|