@animaapp/anima-sdk 0.2.3 → 0.2.4
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/.turbo/turbo-build.log +5 -5
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +388 -384
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/anima.ts +6 -0
- package/src/types.ts +36 -34
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
2
|
+
[36mvite v6.0.11 [32mbuilding for production...[36m[39m
|
|
3
3
|
[2K[1Gtransforming (1) [2msrc/index.ts[22m[2K[1G[32m✓[39m 14 modules transformed.
|
|
4
4
|
[2K[1Grendering chunks (1)...[2K[1G[32m
|
|
5
5
|
[36m[vite:dts][32m Start generate declaration files...[39m
|
|
6
|
-
[2K[1Gcomputing gzip size (0)...[2K[1Gcomputing gzip size (1)...[2K[1G[2mdist/[22m[36mindex.cjs [39m[1m[2m87.
|
|
6
|
+
[2K[1Gcomputing gzip size (0)...[2K[1Gcomputing gzip size (1)...[2K[1G[2mdist/[22m[36mindex.cjs [39m[1m[2m87.76 kB[22m[1m[22m[2m │ gzip: 23.57 kB[22m[2m │ map: 324.19 kB[22m
|
|
7
7
|
[32m[36m[vite:dts][32m Start rollup declaration files...[39m
|
|
8
8
|
Analysis will use the bundled TypeScript version 5.7.2
|
|
9
|
-
[32m[36m[vite:dts][32m Declaration files built in
|
|
9
|
+
[32m[36m[vite:dts][32m Declaration files built in 1941ms.
|
|
10
10
|
[39m
|
|
11
|
-
[2K[1Grendering chunks (1)...[2K[1G[2K[1Gcomputing gzip size (1)...[2K[1G[2mdist/[22m[36mindex.js [39m[1m[2m124.
|
|
12
|
-
[32m✓ built in
|
|
11
|
+
[2K[1Grendering chunks (1)...[2K[1G[2K[1Gcomputing gzip size (1)...[2K[1G[2mdist/[22m[36mindex.js [39m[1m[2m124.96 kB[22m[1m[22m[2m │ gzip: 28.28 kB[22m[2m │ map: 338.18 kB[22m
|
|
12
|
+
[32m✓ built in 2.27s[39m
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var xn=Object.defineProperty,kn=Object.defineProperties;var Tn=Object.getOwnPropertyDescriptors;var jt=Object.getOwnPropertySymbols;var Sn=Object.prototype.hasOwnProperty,En=Object.prototype.propertyIsEnumerable;var Zt=n=>{throw TypeError(n)};var Rt=(n,e,t)=>e in n?xn(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,d=(n,e)=>{for(var t in e||(e={}))Sn.call(e,t)&&Rt(n,t,e[t]);if(jt)for(var t of jt(e))En.call(e,t)&&Rt(n,t,e[t]);return n},g=(n,e)=>kn(n,Tn(e));var Mt=(n,e,t)=>e.has(n)||Zt("Cannot "+t);var X=(n,e,t)=>(Mt(n,e,"read from private field"),t?t.call(n):e.get(n)),it=(n,e,t)=>e.has(n)?Zt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),ot=(n,e,t,s)=>(Mt(n,e,"write to private field"),s?s.call(n,t):e.set(n,t),t);var $=(n,e,t)=>new Promise((s,r)=>{var a=c=>{try{o(t.next(c))}catch(u){r(u)}},i=c=>{try{o(t.throw(c))}catch(u){r(u)}},o=c=>c.done?s(c.value):Promise.resolve(c.value).then(a,i);o((t=t.apply(n,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class be extends Error{constructor({name:e,reason:t,status:s}){super(),this.name=`[Codegen Error] ${e}`,this.message=t,this.status=s}}var x;(function(n){n.assertEqual=r=>r;function e(r){}n.assertIs=e;function t(r){throw new Error}n.assertNever=t,n.arrayToEnum=r=>{const a={};for(const i of r)a[i]=i;return a},n.getValidEnumValues=r=>{const a=n.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),i={};for(const o of a)i[o]=r[o];return n.objectValues(i)},n.objectValues=r=>n.objectKeys(r).map(function(a){return r[a]}),n.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const a=[];for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&a.push(i);return a},n.find=(r,a)=>{for(const i of r)if(a(i))return i},n.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&isFinite(r)&&Math.floor(r)===r;function s(r,a=" | "){return r.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}n.joinValues=s,n.jsonStringifyReplacer=(r,a)=>typeof a=="bigint"?a.toString():a})(x||(x={}));var ft;(function(n){n.mergeShapes=(e,t)=>d(d({},e),t)})(ft||(ft={}));const p=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),oe=n=>{switch(typeof n){case"undefined":return p.undefined;case"string":return p.string;case"number":return isNaN(n)?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(n)?p.array:n===null?p.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?p.promise:typeof Map!="undefined"&&n instanceof Map?p.map:typeof Set!="undefined"&&n instanceof Set?p.set:typeof Date!="undefined"&&n instanceof Date?p.date:p.object;default:return p.unknown}},l=x.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"]),An=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:");class U 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]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},s={_errors:[]},r=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(r);else if(i.code==="invalid_return_type")r(i.returnTypeError);else if(i.code==="invalid_arguments")r(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let o=s,c=0;for(;c<i.path.length;){const u=i.path[c];c===i.path.length-1?(o[u]=o[u]||{_errors:[]},o[u]._errors.push(t(i))):o[u]=o[u]||{_errors:[]},o=o[u],c++}}};return r(this),s}static assert(e){if(!(e instanceof U))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,x.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):s.push(e(r));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}U.create=n=>new U(n);const Te=(n,e)=>{let t;switch(n.code){case l.invalid_type:n.received===p.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case l.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,x.jsonStringifyReplacer)}`;break;case l.unrecognized_keys:t=`Unrecognized key(s) in object: ${x.joinValues(n.keys,", ")}`;break;case l.invalid_union:t="Invalid input";break;case l.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${x.joinValues(n.options)}`;break;case l.invalid_enum_value:t=`Invalid enum value. Expected ${x.joinValues(n.options)}, received '${n.received}'`;break;case l.invalid_arguments:t="Invalid function arguments";break;case l.invalid_return_type:t="Invalid function return type";break;case l.invalid_date:t="Invalid date";break;case l.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:x.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case l.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case l.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case l.custom:t="Invalid input";break;case l.invalid_intersection_types:t="Intersection results could not be merged";break;case l.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case l.not_finite:t="Number must be finite";break;default:t=e.defaultError,x.assertNever(n)}return{message:t}};let qt=Te;function On(n){qt=n}function Ye(){return qt}const Qe=n=>{const{data:e,path:t,errorMaps:s,issueData:r}=n,a=[...t,...r.path||[]],i=g(d({},r),{path:a});if(r.message!==void 0)return g(d({},r),{path:a,message:r.message});let o="";const c=s.filter(u=>!!u).slice().reverse();for(const u of c)o=u(i,{data:e,defaultError:o}).message;return g(d({},r),{path:a,message:o})},Cn=[];function h(n,e){const t=Ye(),s=Qe({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===Te?void 0:Te].filter(r=>!!r)});n.common.issues.push(s)}class R{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const r of t){if(r.status==="aborted")return v;r.status==="dirty"&&e.dirty(),s.push(r.value)}return{status:e.value,value:s}}static mergeObjectAsync(e,t){return $(this,null,function*(){const s=[];for(const r of t){const a=yield r.key,i=yield r.value;s.push({key:a,value:i})}return R.mergeObjectSync(e,s)})}static mergeObjectSync(e,t){const s={};for(const r of t){const{key:a,value:i}=r;if(a.status==="aborted"||i.status==="aborted")return v;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value!="undefined"||r.alwaysSet)&&(s[a.value]=i.value)}return{status:e.value,value:s}}}const v=Object.freeze({status:"aborted"}),xe=n=>({status:"dirty",value:n}),P=n=>({status:"valid",value:n}),ht=n=>n.status==="aborted",pt=n=>n.status==="dirty",ye=n=>n.status==="valid",Ze=n=>typeof Promise!="undefined"&&n instanceof Promise;function et(n,e,t,s){if(typeof e=="function"?n!==e||!0:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(n)}function Ht(n,e,t,s,r){if(typeof e=="function"?n!==e||!0:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(n,t),t}var m;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(m||(m={}));var Ce,Ne;class ne{constructor(e,t,s,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Pt=(n,e)=>{if(ye(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new U(n.common.issues);return this._error=t,this._error}}};function b(n){if(!n)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:r}=n;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(i,o)=>{var c,u;const{message:f}=n;return i.code==="invalid_enum_value"?{message:f!=null?f:o.defaultError}:typeof o.data=="undefined"?{message:(c=f!=null?f:s)!==null&&c!==void 0?c:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(u=f!=null?f:t)!==null&&u!==void 0?u:o.defaultError}},description:r}}class w{get description(){return this._def.description}_getType(e){return oe(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:oe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new R,ctx:{common:e.parent.common,data:e.data,parsedType:oe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Ze(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var s;const r={common:{issues:[],async:(s=t==null?void 0:t.async)!==null&&s!==void 0?s:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:oe(e)},a=this._parseSync({data:e,path:r.path,parent:r});return Pt(r,a)}"~validate"(e){var t,s;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:oe(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:r});return ye(a)?{value:a.value}:{issues:r.common.issues}}catch(a){!((s=(t=a==null?void 0:a.message)===null||t===void 0?void 0:t.toLowerCase())===null||s===void 0)&&s.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(a=>ye(a)?{value:a.value}:{issues:r.common.issues})}parseAsync(e,t){return $(this,null,function*(){const s=yield this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error})}safeParseAsync(e,t){return $(this,null,function*(){const s={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:oe(e)},r=this._parse({data:e,path:s.path,parent:s}),a=yield Ze(r)?r:Promise.resolve(r);return Pt(s,a)})}refine(e,t){const s=r=>typeof t=="string"||typeof t=="undefined"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,a)=>{const i=e(r),o=()=>a.addIssue(d({code:l.custom},s(r)));return typeof Promise!="undefined"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,r)=>e(s)?!0:(r.addIssue(typeof t=="function"?t(s,r):t),!1))}_refinement(e){return new G({schema:this,typeName:y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return te.create(this,this._def)}nullable(){return he.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return J.create(this)}promise(){return Ee.create(this,this._def)}or(e){return Fe.create([this,e],this._def)}and(e){return Le.create(this,e,this._def)}transform(e){return new G(g(d({},b(this._def)),{schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}}))}default(e){const t=typeof e=="function"?e:()=>e;return new We(g(d({},b(this._def)),{innerType:this,defaultValue:t,typeName:y.ZodDefault}))}brand(){return new St(d({typeName:y.ZodBranded,type:this},b(this._def)))}catch(e){const t=typeof e=="function"?e:()=>e;return new Be(g(d({},b(this._def)),{innerType:this,catchValue:t,typeName:y.ZodCatch}))}describe(e){const t=this.constructor;return new t(g(d({},this._def),{description:e}))}pipe(e){return Je.create(this,e)}readonly(){return qe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Nn=/^c[^\s-]{8,}$/i,In=/^[0-9a-z]+$/,jn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Rn=/^[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,Zn=/^[a-z0-9_-]{21}$/i,Mn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Pn=/^[-+]?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)?)??$/,$n=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Fn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ct;const Ln=/^(?:(?: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])$/,Dn=/^(?:(?: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])$/,Vn=/^(([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]))$/,Un=/^(([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])$/,zn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Wn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Jt="((\\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])))",Bn=new RegExp(`^${Jt}$`);function Gt(n){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`),e}function qn(n){return new RegExp(`^${Gt(n)}$`)}function Kt(n){let e=`${Jt}T${Gt(n)}`;const t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Hn(n,e){return!!((e==="v4"||!e)&&Ln.test(n)||(e==="v6"||!e)&&Vn.test(n))}function Jn(n,e){if(!Mn.test(n))return!1;try{const[t]=n.split("."),s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(s));return!(typeof r!="object"||r===null||!r.typ||!r.alg||e&&r.alg!==e)}catch(t){return!1}}function Gn(n,e){return!!((e==="v4"||!e)&&Dn.test(n)||(e==="v6"||!e)&&Un.test(n))}class H extends w{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){const a=this._getOrReturnCtx(e);return h(a,{code:l.invalid_type,expected:p.string,received:a.parsedType}),v}const s=new R;let r;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(r=this._getOrReturnCtx(e,r),h(r,{code:l.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&&(r=this._getOrReturnCtx(e,r),h(r,{code:l.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(r=this._getOrReturnCtx(e,r),i?h(r,{code:l.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&h(r,{code:l.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")$n.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"email",code:l.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")ct||(ct=new RegExp(Fn,"u")),ct.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"emoji",code:l.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")Rn.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"uuid",code:l.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")Zn.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"nanoid",code:l.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")Nn.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"cuid",code:l.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")In.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"cuid2",code:l.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")jn.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"ulid",code:l.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch(i){r=this._getOrReturnCtx(e,r),h(r,{validation:"url",code:l.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"regex",code:l.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)||(r=this._getOrReturnCtx(e,r),h(r,{code:l.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)||(r=this._getOrReturnCtx(e,r),h(r,{code:l.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(r=this._getOrReturnCtx(e,r),h(r,{code:l.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?Kt(a).test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{code:l.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?Bn.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{code:l.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?qn(a).test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{code:l.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?Pn.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"duration",code:l.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?Hn(e.data,a.version)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"ip",code:l.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?Jn(e.data,a.alg)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"jwt",code:l.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?Gn(e.data,a.version)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"cidr",code:l.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?zn.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"base64",code:l.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?Wn.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"base64url",code:l.invalid_string,message:a.message}),s.dirty()):x.assertNever(a);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(r=>e.test(r),d({validation:t,code:l.invalid_string},m.errToObj(s)))}_addCheck(e){return new H(g(d({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(d({kind:"email"},m.errToObj(e)))}url(e){return this._addCheck(d({kind:"url"},m.errToObj(e)))}emoji(e){return this._addCheck(d({kind:"emoji"},m.errToObj(e)))}uuid(e){return this._addCheck(d({kind:"uuid"},m.errToObj(e)))}nanoid(e){return this._addCheck(d({kind:"nanoid"},m.errToObj(e)))}cuid(e){return this._addCheck(d({kind:"cuid"},m.errToObj(e)))}cuid2(e){return this._addCheck(d({kind:"cuid2"},m.errToObj(e)))}ulid(e){return this._addCheck(d({kind:"ulid"},m.errToObj(e)))}base64(e){return this._addCheck(d({kind:"base64"},m.errToObj(e)))}base64url(e){return this._addCheck(d({kind:"base64url"},m.errToObj(e)))}jwt(e){return this._addCheck(d({kind:"jwt"},m.errToObj(e)))}ip(e){return this._addCheck(d({kind:"ip"},m.errToObj(e)))}cidr(e){return this._addCheck(d({kind:"cidr"},m.errToObj(e)))}datetime(e){var t,s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck(d({kind:"datetime",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(s=e==null?void 0:e.local)!==null&&s!==void 0?s:!1},m.errToObj(e==null?void 0: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(d({kind:"time",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision},m.errToObj(e==null?void 0:e.message)))}duration(e){return this._addCheck(d({kind:"duration"},m.errToObj(e)))}regex(e,t){return this._addCheck(d({kind:"regex",regex:e},m.errToObj(t)))}includes(e,t){return this._addCheck(d({kind:"includes",value:e,position:t==null?void 0:t.position},m.errToObj(t==null?void 0:t.message)))}startsWith(e,t){return this._addCheck(d({kind:"startsWith",value:e},m.errToObj(t)))}endsWith(e,t){return this._addCheck(d({kind:"endsWith",value:e},m.errToObj(t)))}min(e,t){return this._addCheck(d({kind:"min",value:e},m.errToObj(t)))}max(e,t){return this._addCheck(d({kind:"max",value:e},m.errToObj(t)))}length(e,t){return this._addCheck(d({kind:"length",value:e},m.errToObj(t)))}nonempty(e){return this.min(1,m.errToObj(e))}trim(){return new H(g(d({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}toLowerCase(){return new H(g(d({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new H(g(d({},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(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}H.create=n=>{var e;return new H(d({checks:[],typeName:y.ZodString,coerce:(e=n==null?void 0:n.coerce)!==null&&e!==void 0?e:!1},b(n)))};function Kn(n,e){const t=(n.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,r=t>s?t:s,a=parseInt(n.toFixed(r).replace(".","")),i=parseInt(e.toFixed(r).replace(".",""));return a%i/Math.pow(10,r)}class ue extends w{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){const a=this._getOrReturnCtx(e);return h(a,{code:l.invalid_type,expected:p.number,received:a.parsedType}),v}let s;const r=new R;for(const a of this._def.checks)a.kind==="int"?x.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:l.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),h(s,{code:l.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),h(s,{code:l.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="multipleOf"?Kn(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),h(s,{code:l.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:l.not_finite,message:a.message}),r.dirty()):x.assertNever(a);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,s,r){return new ue(g(d({},this._def),{checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:m.toString(r)}]}))}_addCheck(e){return new ue(g(d({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:m.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:m.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:m.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:m.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&x.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ue.create=n=>new ue(d({checks:[],typeName:y.ZodNumber,coerce:(n==null?void 0:n.coerce)||!1},b(n)));class le extends w{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(a){return this._getInvalidInput(e)}if(this._getType(e)!==p.bigint)return this._getInvalidInput(e);let s;const r=new R;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),h(s,{code:l.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),h(s,{code:l.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),h(s,{code:l.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):x.assertNever(a);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return h(t,{code:l.invalid_type,expected:p.bigint,received:t.parsedType}),v}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,s,r){return new le(g(d({},this._def),{checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:m.toString(r)}]}))}_addCheck(e){return new le(g(d({},this._def),{checks:[...this._def.checks,e]}))}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}le.create=n=>{var e;return new le(d({checks:[],typeName:y.ZodBigInt,coerce:(e=n==null?void 0:n.coerce)!==null&&e!==void 0?e:!1},b(n)))};class Me extends w{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.boolean){const s=this._getOrReturnCtx(e);return h(s,{code:l.invalid_type,expected:p.boolean,received:s.parsedType}),v}return P(e.data)}}Me.create=n=>new Me(d({typeName:y.ZodBoolean,coerce:(n==null?void 0:n.coerce)||!1},b(n)));class ve extends w{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){const a=this._getOrReturnCtx(e);return h(a,{code:l.invalid_type,expected:p.date,received:a.parsedType}),v}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return h(a,{code:l.invalid_date}),v}const s=new R;let r;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(r=this._getOrReturnCtx(e,r),h(r,{code:l.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(r=this._getOrReturnCtx(e,r),h(r,{code:l.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):x.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ve(g(d({},this._def),{checks:[...this._def.checks,e]}))}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:m.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:m.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}ve.create=n=>new ve(d({checks:[],coerce:(n==null?void 0:n.coerce)||!1,typeName:y.ZodDate},b(n)));class tt extends w{_parse(e){if(this._getType(e)!==p.symbol){const s=this._getOrReturnCtx(e);return h(s,{code:l.invalid_type,expected:p.symbol,received:s.parsedType}),v}return P(e.data)}}tt.create=n=>new tt(d({typeName:y.ZodSymbol},b(n)));class Pe extends w{_parse(e){if(this._getType(e)!==p.undefined){const s=this._getOrReturnCtx(e);return h(s,{code:l.invalid_type,expected:p.undefined,received:s.parsedType}),v}return P(e.data)}}Pe.create=n=>new Pe(d({typeName:y.ZodUndefined},b(n)));class $e extends w{_parse(e){if(this._getType(e)!==p.null){const s=this._getOrReturnCtx(e);return h(s,{code:l.invalid_type,expected:p.null,received:s.parsedType}),v}return P(e.data)}}$e.create=n=>new $e(d({typeName:y.ZodNull},b(n)));class Se extends w{constructor(){super(...arguments),this._any=!0}_parse(e){return P(e.data)}}Se.create=n=>new Se(d({typeName:y.ZodAny},b(n)));class ge extends w{constructor(){super(...arguments),this._unknown=!0}_parse(e){return P(e.data)}}ge.create=n=>new ge(d({typeName:y.ZodUnknown},b(n)));class ce extends w{_parse(e){const t=this._getOrReturnCtx(e);return h(t,{code:l.invalid_type,expected:p.never,received:t.parsedType}),v}}ce.create=n=>new ce(d({typeName:y.ZodNever},b(n)));class nt extends w{_parse(e){if(this._getType(e)!==p.undefined){const s=this._getOrReturnCtx(e);return h(s,{code:l.invalid_type,expected:p.void,received:s.parsedType}),v}return P(e.data)}}nt.create=n=>new nt(d({typeName:y.ZodVoid},b(n)));class J extends w{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),r=this._def;if(t.parsedType!==p.array)return h(t,{code:l.invalid_type,expected:p.array,received:t.parsedType}),v;if(r.exactLength!==null){const i=t.data.length>r.exactLength.value,o=t.data.length<r.exactLength.value;(i||o)&&(h(t,{code:i?l.too_big:l.too_small,minimum:o?r.exactLength.value:void 0,maximum:i?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),s.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(h(t,{code:l.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),s.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(h(t,{code:l.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>r.type._parseAsync(new ne(t,i,t.path,o)))).then(i=>R.mergeArray(s,i));const a=[...t.data].map((i,o)=>r.type._parseSync(new ne(t,i,t.path,o)));return R.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new J(g(d({},this._def),{minLength:{value:e,message:m.toString(t)}}))}max(e,t){return new J(g(d({},this._def),{maxLength:{value:e,message:m.toString(t)}}))}length(e,t){return new J(g(d({},this._def),{exactLength:{value:e,message:m.toString(t)}}))}nonempty(e){return this.min(1,e)}}J.create=(n,e)=>new J(d({type:n,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray},b(e)));function we(n){if(n instanceof S){const e={};for(const t in n.shape){const s=n.shape[t];e[t]=te.create(we(s))}return new S(g(d({},n._def),{shape:()=>e}))}else return n instanceof J?new J(g(d({},n._def),{type:we(n.element)})):n instanceof te?te.create(we(n.unwrap())):n instanceof he?he.create(we(n.unwrap())):n instanceof se?se.create(n.items.map(e=>we(e))):n}class S extends w{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=x.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==p.object){const u=this._getOrReturnCtx(e);return h(u,{code:l.invalid_type,expected:p.object,received:u.parsedType}),v}const{status:s,ctx:r}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof ce&&this._def.unknownKeys==="strip"))for(const u in r.data)i.includes(u)||o.push(u);const c=[];for(const u of i){const f=a[u],_=r.data[u];c.push({key:{status:"valid",value:u},value:f._parse(new ne(r,_,r.path,u)),alwaysSet:u in r.data})}if(this._def.catchall instanceof ce){const u=this._def.unknownKeys;if(u==="passthrough")for(const f of o)c.push({key:{status:"valid",value:f},value:{status:"valid",value:r.data[f]}});else if(u==="strict")o.length>0&&(h(r,{code:l.unrecognized_keys,keys:o}),s.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const f of o){const _=r.data[f];c.push({key:{status:"valid",value:f},value:u._parse(new ne(r,_,r.path,f)),alwaysSet:f in r.data})}}return r.common.async?Promise.resolve().then(()=>$(this,null,function*(){const u=[];for(const f of c){const _=yield f.key,C=yield f.value;u.push({key:_,value:C,alwaysSet:f.alwaysSet})}return u})).then(u=>R.mergeObjectSync(s,u)):R.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(e){return m.errToObj,new S(d(g(d({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:(t,s)=>{var r,a,i,o;const c=(i=(a=(r=this._def).errorMap)===null||a===void 0?void 0:a.call(r,t,s).message)!==null&&i!==void 0?i:s.defaultError;return t.code==="unrecognized_keys"?{message:(o=m.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}))}strip(){return new S(g(d({},this._def),{unknownKeys:"strip"}))}passthrough(){return new S(g(d({},this._def),{unknownKeys:"passthrough"}))}extend(e){return new S(g(d({},this._def),{shape:()=>d(d({},this._def.shape()),e)}))}merge(e){return new S({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>d(d({},this._def.shape()),e._def.shape()),typeName:y.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new S(g(d({},this._def),{catchall:e}))}pick(e){const t={};return x.objectKeys(e).forEach(s=>{e[s]&&this.shape[s]&&(t[s]=this.shape[s])}),new S(g(d({},this._def),{shape:()=>t}))}omit(e){const t={};return x.objectKeys(this.shape).forEach(s=>{e[s]||(t[s]=this.shape[s])}),new S(g(d({},this._def),{shape:()=>t}))}deepPartial(){return we(this)}partial(e){const t={};return x.objectKeys(this.shape).forEach(s=>{const r=this.shape[s];e&&!e[s]?t[s]=r:t[s]=r.optional()}),new S(g(d({},this._def),{shape:()=>t}))}required(e){const t={};return x.objectKeys(this.shape).forEach(s=>{if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof te;)a=a._def.innerType;t[s]=a}}),new S(g(d({},this._def),{shape:()=>t}))}keyof(){return Xt(x.objectKeys(this.shape))}}S.create=(n,e)=>new S(d({shape:()=>n,unknownKeys:"strip",catchall:ce.create(),typeName:y.ZodObject},b(e)));S.strictCreate=(n,e)=>new S(d({shape:()=>n,unknownKeys:"strict",catchall:ce.create(),typeName:y.ZodObject},b(e)));S.lazycreate=(n,e)=>new S(d({shape:n,unknownKeys:"strip",catchall:ce.create(),typeName:y.ZodObject},b(e)));class Fe extends w{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function r(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new U(o.ctx.common.issues));return h(t,{code:l.invalid_union,unionErrors:i}),v}if(t.common.async)return Promise.all(s.map(a=>$(this,null,function*(){const i=g(d({},t),{common:g(d({},t.common),{issues:[]}),parent:null});return{result:yield a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}}))).then(r);{let a;const i=[];for(const c of s){const u=g(d({},t),{common:g(d({},t.common),{issues:[]}),parent:null}),f=c._parseSync({data:t.data,path:t.path,parent:u});if(f.status==="valid")return f;f.status==="dirty"&&!a&&(a={result:f,ctx:u}),u.common.issues.length&&i.push(u.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(c=>new U(c));return h(t,{code:l.invalid_union,unionErrors:o}),v}}get options(){return this._def.options}}Fe.create=(n,e)=>new Fe(d({options:n,typeName:y.ZodUnion},b(e)));const ie=n=>n instanceof Ve?ie(n.schema):n instanceof G?ie(n.innerType()):n instanceof Ue?[n.value]:n instanceof fe?n.options:n instanceof ze?x.objectValues(n.enum):n instanceof We?ie(n._def.innerType):n instanceof Pe?[void 0]:n instanceof $e?[null]:n instanceof te?[void 0,...ie(n.unwrap())]:n instanceof he?[null,...ie(n.unwrap())]:n instanceof St||n instanceof qe?ie(n.unwrap()):n instanceof Be?ie(n._def.innerType):[];class at extends w{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.object)return h(t,{code:l.invalid_type,expected:p.object,received:t.parsedType}),v;const s=this.discriminator,r=t.data[s],a=this.optionsMap.get(r);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(h(t,{code:l.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),v)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const r=new Map;for(const a of t){const i=ie(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,a)}}return new at(d({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r},b(s)))}}function mt(n,e){const t=oe(n),s=oe(e);if(n===e)return{valid:!0,data:n};if(t===p.object&&s===p.object){const r=x.objectKeys(e),a=x.objectKeys(n).filter(o=>r.indexOf(o)!==-1),i=d(d({},n),e);for(const o of a){const c=mt(n[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===p.array&&s===p.array){if(n.length!==e.length)return{valid:!1};const r=[];for(let a=0;a<n.length;a++){const i=n[a],o=e[a],c=mt(i,o);if(!c.valid)return{valid:!1};r.push(c.data)}return{valid:!0,data:r}}else return t===p.date&&s===p.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}class Le extends w{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),r=(a,i)=>{if(ht(a)||ht(i))return v;const o=mt(a.value,i.value);return o.valid?((pt(a)||pt(i))&&t.dirty(),{status:t.value,value:o.data}):(h(s,{code:l.invalid_intersection_types}),v)};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])=>r(a,i)):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}Le.create=(n,e,t)=>new Le(d({left:n,right:e,typeName:y.ZodIntersection},b(t)));class se extends w{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.array)return h(s,{code:l.invalid_type,expected:p.array,received:s.parsedType}),v;if(s.data.length<this._def.items.length)return h(s,{code:l.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),v;!this._def.rest&&s.data.length>this._def.items.length&&(h(s,{code:l.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...s.data].map((i,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new ne(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(a).then(i=>R.mergeArray(t,i)):R.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new se(g(d({},this._def),{rest:e}))}}se.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new se(d({items:n,typeName:y.ZodTuple,rest:null},b(e)))};class De extends w{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.object)return h(s,{code:l.invalid_type,expected:p.object,received:s.parsedType}),v;const r=[],a=this._def.keyType,i=this._def.valueType;for(const o in s.data)r.push({key:a._parse(new ne(s,o,s.path,o)),value:i._parse(new ne(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?R.mergeObjectAsync(t,r):R.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof w?new De(d({keyType:e,valueType:t,typeName:y.ZodRecord},b(s))):new De(d({keyType:H.create(),valueType:e,typeName:y.ZodRecord},b(t)))}}class st extends w{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.map)return h(s,{code:l.invalid_type,expected:p.map,received:s.parsedType}),v;const r=this._def.keyType,a=this._def.valueType,i=[...s.data.entries()].map(([o,c],u)=>({key:r._parse(new ne(s,o,s.path,[u,"key"])),value:a._parse(new ne(s,c,s.path,[u,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(()=>$(this,null,function*(){for(const c of i){const u=yield c.key,f=yield c.value;if(u.status==="aborted"||f.status==="aborted")return v;(u.status==="dirty"||f.status==="dirty")&&t.dirty(),o.set(u.value,f.value)}return{status:t.value,value:o}}))}else{const o=new Map;for(const c of i){const u=c.key,f=c.value;if(u.status==="aborted"||f.status==="aborted")return v;(u.status==="dirty"||f.status==="dirty")&&t.dirty(),o.set(u.value,f.value)}return{status:t.value,value:o}}}}st.create=(n,e,t)=>new st(d({valueType:e,keyType:n,typeName:y.ZodMap},b(t)));class _e extends w{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.set)return h(s,{code:l.invalid_type,expected:p.set,received:s.parsedType}),v;const r=this._def;r.minSize!==null&&s.data.size<r.minSize.value&&(h(s,{code:l.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&s.data.size>r.maxSize.value&&(h(s,{code:l.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const a=this._def.valueType;function i(c){const u=new Set;for(const f of c){if(f.status==="aborted")return v;f.status==="dirty"&&t.dirty(),u.add(f.value)}return{status:t.value,value:u}}const o=[...s.data.values()].map((c,u)=>a._parse(new ne(s,c,s.path,u)));return s.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new _e(g(d({},this._def),{minSize:{value:e,message:m.toString(t)}}))}max(e,t){return new _e(g(d({},this._def),{maxSize:{value:e,message:m.toString(t)}}))}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}_e.create=(n,e)=>new _e(d({valueType:n,minSize:null,maxSize:null,typeName:y.ZodSet},b(e)));class ke extends w{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.function)return h(t,{code:l.invalid_type,expected:p.function,received:t.parsedType}),v;function s(o,c){return Qe({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ye(),Te].filter(u=>!!u),issueData:{code:l.invalid_arguments,argumentsError:c}})}function r(o,c){return Qe({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Ye(),Te].filter(u=>!!u),issueData:{code:l.invalid_return_type,returnTypeError:c}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Ee){const o=this;return P(function(...c){return $(this,null,function*(){const u=new U([]),f=yield o._def.args.parseAsync(c,a).catch(A=>{throw u.addIssue(s(c,A)),u}),_=yield Reflect.apply(i,this,f);return yield o._def.returns._def.type.parseAsync(_,a).catch(A=>{throw u.addIssue(r(_,A)),u})})})}else{const o=this;return P(function(...c){const u=o._def.args.safeParse(c,a);if(!u.success)throw new U([s(c,u.error)]);const f=Reflect.apply(i,this,u.data),_=o._def.returns.safeParse(f,a);if(!_.success)throw new U([r(f,_.error)]);return _.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ke(g(d({},this._def),{args:se.create(e).rest(ge.create())}))}returns(e){return new ke(g(d({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new ke(d({args:e||se.create([]).rest(ge.create()),returns:t||ge.create(),typeName:y.ZodFunction},b(s)))}}class Ve extends w{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Ve.create=(n,e)=>new Ve(d({getter:n,typeName:y.ZodLazy},b(e)));class Ue extends w{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return h(t,{received:t.data,code:l.invalid_literal,expected:this._def.value}),v}return{status:"valid",value:e.data}}get value(){return this._def.value}}Ue.create=(n,e)=>new Ue(d({value:n,typeName:y.ZodLiteral},b(e)));function Xt(n,e){return new fe(d({values:n,typeName:y.ZodEnum},b(e)))}class fe extends w{constructor(){super(...arguments),Ce.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return h(t,{expected:x.joinValues(s),received:t.parsedType,code:l.invalid_type}),v}if(et(this,Ce)||Ht(this,Ce,new Set(this._def.values)),!et(this,Ce).has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return h(t,{received:t.data,code:l.invalid_enum_value,options:s}),v}return P(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return fe.create(e,d(d({},this._def),t))}exclude(e,t=this._def){return fe.create(this.options.filter(s=>!e.includes(s)),d(d({},this._def),t))}}Ce=new WeakMap;fe.create=Xt;class ze extends w{constructor(){super(...arguments),Ne.set(this,void 0)}_parse(e){const t=x.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==p.string&&s.parsedType!==p.number){const r=x.objectValues(t);return h(s,{expected:x.joinValues(r),received:s.parsedType,code:l.invalid_type}),v}if(et(this,Ne)||Ht(this,Ne,new Set(x.getValidEnumValues(this._def.values))),!et(this,Ne).has(e.data)){const r=x.objectValues(t);return h(s,{received:s.data,code:l.invalid_enum_value,options:r}),v}return P(e.data)}get enum(){return this._def.values}}Ne=new WeakMap;ze.create=(n,e)=>new ze(d({values:n,typeName:y.ZodNativeEnum},b(e)));class Ee extends w{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.promise&&t.common.async===!1)return h(t,{code:l.invalid_type,expected:p.promise,received:t.parsedType}),v;const s=t.parsedType===p.promise?t.data:Promise.resolve(t.data);return P(s.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Ee.create=(n,e)=>new Ee(d({type:n,typeName:y.ZodPromise},b(e)));class G extends w{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),r=this._def.effect||null,a={addIssue:i=>{h(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),r.type==="preprocess"){const i=r.transform(s.data,a);if(s.common.async)return Promise.resolve(i).then(o=>$(this,null,function*(){if(t.value==="aborted")return v;const c=yield this._def.schema._parseAsync({data:o,path:s.path,parent:s});return c.status==="aborted"?v:c.status==="dirty"||t.value==="dirty"?xe(c.value):c}));{if(t.value==="aborted")return v;const o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?v:o.status==="dirty"||t.value==="dirty"?xe(o.value):o}}if(r.type==="refinement"){const i=o=>{const c=r.refinement(o,a);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?v:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?v:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(r.type==="transform")if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!ye(i))return i;const o=r.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>ye(i)?Promise.resolve(r.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);x.assertNever(r)}}G.create=(n,e,t)=>new G(d({schema:n,typeName:y.ZodEffects,effect:e},b(t)));G.createWithPreprocess=(n,e,t)=>new G(d({schema:e,effect:{type:"preprocess",transform:n},typeName:y.ZodEffects},b(t)));class te extends w{_parse(e){return this._getType(e)===p.undefined?P(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}te.create=(n,e)=>new te(d({innerType:n,typeName:y.ZodOptional},b(e)));class he extends w{_parse(e){return this._getType(e)===p.null?P(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}he.create=(n,e)=>new he(d({innerType:n,typeName:y.ZodNullable},b(e)));class We extends w{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===p.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}We.create=(n,e)=>new We(d({innerType:n,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default},b(e)));class Be extends w{_parse(e){const{ctx:t}=this._processInputParams(e),s=g(d({},t),{common:g(d({},t.common),{issues:[]})}),r=this._def.innerType._parse({data:s.data,path:s.path,parent:d({},s)});return Ze(r)?r.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new U(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new U(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}Be.create=(n,e)=>new Be(d({innerType:n,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},b(e)));class rt extends w{_parse(e){if(this._getType(e)!==p.nan){const s=this._getOrReturnCtx(e);return h(s,{code:l.invalid_type,expected:p.nan,received:s.parsedType}),v}return{status:"valid",value:e.data}}}rt.create=n=>new rt(d({typeName:y.ZodNaN},b(n)));const Xn=Symbol("zod_brand");class St extends w{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class Je extends w{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return $(this,null,function*(){const a=yield this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?v:a.status==="dirty"?(t.dirty(),xe(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})});{const r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?v:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(e,t){return new Je({in:e,out:t,typeName:y.ZodPipeline})}}class qe extends w{_parse(e){const t=this._def.innerType._parse(e),s=r=>(ye(r)&&(r.value=Object.freeze(r.value)),r);return Ze(t)?t.then(r=>s(r)):s(t)}unwrap(){return this._def.innerType}}qe.create=(n,e)=>new qe(d({innerType:n,typeName:y.ZodReadonly},b(e)));function Yt(n,e={},t){return n?Se.create().superRefine((s,r)=>{var a,i;if(!n(s)){const o=typeof e=="function"?e(s):typeof e=="string"?{message:e}:e,c=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,u=typeof o=="string"?{message:o}:o;r.addIssue(g(d({code:"custom"},u),{fatal:c}))}}):Se.create()}const Yn={object:S.lazycreate};var y;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(y||(y={}));const Qn=(n,e={message:`Input not instance of ${n.name}`})=>Yt(t=>t instanceof n,e),Qt=H.create,en=ue.create,es=rt.create,ts=le.create,tn=Me.create,ns=ve.create,ss=tt.create,rs=Pe.create,as=$e.create,is=Se.create,os=ge.create,cs=ce.create,ds=nt.create,us=J.create,ls=S.create,fs=S.strictCreate,hs=Fe.create,ps=at.create,ms=Le.create,gs=se.create,ys=De.create,vs=st.create,_s=_e.create,bs=ke.create,ws=Ve.create,xs=Ue.create,ks=fe.create,Ts=ze.create,Ss=Ee.create,$t=G.create,Es=te.create,As=he.create,Os=G.createWithPreprocess,Cs=Je.create,Ns=()=>Qt().optional(),Is=()=>en().optional(),js=()=>tn().optional(),Rs={string:n=>H.create(g(d({},n),{coerce:!0})),number:n=>ue.create(g(d({},n),{coerce:!0})),boolean:n=>Me.create(g(d({},n),{coerce:!0})),bigint:n=>le.create(g(d({},n),{coerce:!0})),date:n=>ve.create(g(d({},n),{coerce:!0}))},Zs=v;var I=Object.freeze({__proto__:null,defaultErrorMap:Te,setErrorMap:On,getErrorMap:Ye,makeIssue:Qe,EMPTY_PATH:Cn,addIssueToContext:h,ParseStatus:R,INVALID:v,DIRTY:xe,OK:P,isAborted:ht,isDirty:pt,isValid:ye,isAsync:Ze,get util(){return x},get objectUtil(){return ft},ZodParsedType:p,getParsedType:oe,ZodType:w,datetimeRegex:Kt,ZodString:H,ZodNumber:ue,ZodBigInt:le,ZodBoolean:Me,ZodDate:ve,ZodSymbol:tt,ZodUndefined:Pe,ZodNull:$e,ZodAny:Se,ZodUnknown:ge,ZodNever:ce,ZodVoid:nt,ZodArray:J,ZodObject:S,ZodUnion:Fe,ZodDiscriminatedUnion:at,ZodIntersection:Le,ZodTuple:se,ZodRecord:De,ZodMap:st,ZodSet:_e,ZodFunction:ke,ZodLazy:Ve,ZodLiteral:Ue,ZodEnum:fe,ZodNativeEnum:ze,ZodPromise:Ee,ZodEffects:G,ZodTransformer:G,ZodOptional:te,ZodNullable:he,ZodDefault:We,ZodCatch:Be,ZodNaN:rt,BRAND:Xn,ZodBranded:St,ZodPipeline:Je,ZodReadonly:qe,custom:Yt,Schema:w,ZodSchema:w,late:Yn,get ZodFirstPartyTypeKind(){return y},coerce:Rs,any:is,array:us,bigint:ts,boolean:tn,date:ns,discriminatedUnion:ps,effect:$t,enum:ks,function:bs,instanceof:Qn,intersection:ms,lazy:ws,literal:xs,map:vs,nan:es,nativeEnum:Ts,never:cs,null:as,nullable:As,number:en,object:ls,oboolean:js,onumber:Is,optional:Es,ostring:Ns,pipeline:Cs,preprocess:Os,promise:Ss,record:ys,set:_s,strictObject:fs,string:Qt,symbol:ss,transformer:$t,tuple:gs,undefined:rs,union:hs,unknown:os,void:ds,NEVER:Zs,ZodIssueCode:l,quotelessJson:An,ZodError:U});const Ms=I.object({language:I.enum(["typescript","javascript"]).optional()}).and(I.union([I.object({framework:I.literal("react"),model:I.string().optional(),styling:I.enum(["plain_css","css_modules","styled_components","tailwind","sass","scss","inline_styles"]),uiLibrary:I.enum(["mui","antd","radix","shadcn"]).optional(),enableUILibraryTheming:I.boolean().optional(),enableCompactStructure:I.boolean().optional(),enableAutoSplit:I.boolean().optional(),autoSplitThreshold:I.number().optional()}),I.object({framework:I.literal("html"),styling:I.enum(["plain_css","inline_styles"]),enableTranslation:I.boolean().optional()})])),nn=n=>{const e=Ms.safeParse(n);if(e.success===!1){const t=new Error("Invalid codegen settings");throw t.cause=e.error,t}return e.data};var W,He;class Ps{constructor({auth:e,apiBaseAddress:t="https://public-api.animaapp.com"}={}){it(this,W);it(this,He);ot(this,He,t),e&&(this.auth=e)}hasAuth(){return!!X(this,W)}set auth(e){ot(this,W,e)}get headers(){const e={"Content-Type":"application/json"};return X(this,W)&&(e.Authorization=`Bearer ${X(this,W).token}`,"teamId"in X(this,W)&&(e["X-Team-Id"]=X(this,W).teamId),"userId"in X(this,W)&&X(this,W).userId&&(e["X-User-Id"]=X(this,W).userId)),e}generateCode(s){return $(this,arguments,function*(e,t={}){var f,_,C,A,O,Z,q;if(this.hasAuth()===!1)throw new Error('It needs to set "auth" before calling this method.');const r={},a=nn(e.settings),i=yield fetch(`${X(this,He)}/v1/codegen`,{method:"POST",headers:g(d({},this.headers),{Accept:"text/event-stream"}),body:JSON.stringify({fileKey:e.fileKey,figmaToken:e.figmaToken,nodesId:e.nodesId,assetsStorage:e.assetsStorage,language:a.language,model:a.model,framework:a.framework,styling:a.styling,uiLibrary:a.uiLibrary,enableTranslation:a.enableTranslation,enableUILibraryTheming:a.enableUILibraryTheming,enableCompactStructure:a.enableCompactStructure,enableAutoSplit:a.enableAutoSplit,autoSplitThreshold:a.autoSplitThreshold})});if(!i.ok){let z;try{z=(yield i.json()).message||`HTTP error! status: ${i.status}`}catch(re){z=`HTTP error! status: ${i.status}`}throw new be({name:"HTTP Error",reason:z,status:i.status})}if(!i.body)throw new be({name:"Stream Error",reason:"Response body is null",status:i.status});const o=i.body.getReader(),c=new TextDecoder;let u="";try{for(;;){const{done:z,value:re}=yield o.read();if(z)break;u+=c.decode(re,{stream:!0});const L=u.split(`
|
|
2
|
-
`);u=L.pop()||"";for(const K of L)if(!(!K.trim()||K.startsWith(":"))&&K.startsWith("data: ")){let T;try{T=JSON.parse(K.slice(6))}catch(Ct){continue}switch(T.type){case"start":{r.sessionId=T.sessionId,typeof t=="function"?t(T):(f=t.onStart)==null||f.call(t,{sessionId:T.sessionId});break}case"pre_codegen":{typeof t=="function"?t(T):(_=t.onPreCodegen)==null||_.call(t,{message:T.message});break}case"assets_uploaded":{typeof t=="function"?t(T):(C=t.onAssetsUploaded)==null||C.call(t);break}case"assets_list":{r.assets=T.payload.assets,typeof t=="function"?t(T):(A=t.onAssetsList)==null||A.call(t,T.payload);break}case"figma_metadata":{r.figmaFileName=T.figmaFileName,r.figmaSelectedFrameName=T.figmaSelectedFrameName,typeof t=="function"?t(T):(O=t.onFigmaMetadata)==null||O.call(t,{figmaFileName:T.figmaFileName,figmaSelectedFrameName:T.figmaSelectedFrameName});break}case"generating_code":{T.payload.status==="success"&&(r.files=T.payload.files),typeof t=="function"?t(T):(Z=t.onGeneratingCode)==null||Z.call(t,{status:T.payload.status,progress:T.payload.progress,files:T.payload.files});break}case"codegen_completed":{typeof t=="function"?t(T):(q=t.onCodegenCompleted)==null||q.call(t);break}case"error":throw new be({name:T.payload.errorName,reason:T.payload.reason});case"done":{if(!r.files)throw new be({name:"Invalid response",reason:"No files found"});return r.tokenUsage=T.payload.tokenUsage,r}}}}}finally{o.cancel()}throw new be({name:"Connection",reason:"Connection closed before the 'done' message",status:500})})}}W=new WeakMap,He=new WeakMap;const $s=n=>{var e;if(!n)return[!1,"",""];try{const t=new URL(n),s=t.pathname;if(t.origin!=="https://www.figma.com")return[!1,"",""];const r=((e=t.searchParams.get("node-id"))!=null?e:"").replace(/-/g,":"),a=s.split("/")[2];return[(s.startsWith("/file/")&&t.searchParams.get("type")!=="whiteboard"||s.startsWith("/design/"))&&a.length===22,a,r]}catch(t){return[!1,"",""]}},Fs=({fileKey:n,nodeId:e})=>{const t=new URL("https://www.figma.com");return t.pathname=`design/${n}`,e&&t.searchParams.set("node-id",e.replace(":","-")),t};class Ls extends Error{constructor(e,t){super(e),this.response=t}}const Ds=({files:n,screenPath:e="src/screens"})=>{const t={},s=new Set;function r(a){if(s.has(a)||!n[a])return;s.add(a),t[a]=n[a],Vs(n[a].content).forEach(o=>{try{const c=Us(a,o);if(c.startsWith("src/")){const u=c.split("/").slice(0,-1).join("/");zs(n,u).forEach(_=>{s.has(_)||r(_)})}}catch(c){console.warn(`Failed to resolve import ${o} in ${a}:`,c)}})}return Object.entries(n).forEach(([a,i])=>{a.startsWith(e)?r(a):a.startsWith("src/")||(t[a]=i)}),t};function Vs(n){const e=/import.*?["']([^"']+)["']/g,t=/export.*from\s+["']([^"']+)["']/g,s=[];let r;for(;(r=e.exec(n))!==null;)s.push(r[1]);for(;(r=t.exec(n))!==null;)s.push(r[1]);return[...new Set(s)]}function Us(n,e){if(!e.startsWith("."))return e;const t=n.split("/").slice(0,-1),s=e.split("/"),r=[...t];for(const a of s)a===".."?r.pop():a!=="."&&r.push(a);return r.join("/")}function zs(n,e){return Object.keys(n).filter(t=>t.startsWith(e))}const sn="Figma Token Issue";class rn extends Error{constructor({fileKey:e,reason:t}){super(sn),this.fileKey=e,this.reason=t}}const an="Rate Limit Exceeded";class on extends Error{constructor({fileKey:e}){super(an),this.fileKey=e}}const cn="Not Found";class dn extends Error{constructor({fileKey:e}){super(cn),this.fileKey=e}}const un=n=>n.message===cn,ln="Unknown Figma API Exception";class fn extends Error{constructor({fileKey:e,cause:t}){super(ln),this.name="UnknownFigmaApiException",this.fileKey=e,this.cause=t}}const Ws=n=>n.message===ln,hn=n=>n.message===an,pn=n=>[sn,...["Invalid Figma token","Figma token expired"]].includes(n.message),mn=(n,e)=>{var s,r,a,i;const t=((s=n==null?void 0:n.cause)==null?void 0:s.body)||n.body;throw(t==null?void 0:t.status)===403?new rn({fileKey:e,reason:(((a=(r=n==null?void 0:n.cause)==null?void 0:r.body)==null?void 0:a.reason)||((i=n.body)==null?void 0:i.reason)||"Access denied").toString()}):(t==null?void 0:t.status)===429?new on({fileKey:e}):(t==null?void 0:t.status)===404?new dn({fileKey:e}):new fn({fileKey:e,cause:n})},Bs=n=>un(n)?"NotFound":hn(n)?"RateLimitExceeded":pn(n)?"FigmaTokenIssue":"UnknownFigmaApiException";var qs=Object.defineProperty,Hs=Object.defineProperties,Js=Object.getOwnPropertyDescriptors,Ft=Object.getOwnPropertySymbols,Gs=Object.prototype.hasOwnProperty,Ks=Object.prototype.propertyIsEnumerable,Lt=(n,e)=>(e=Symbol[n])?e:Symbol.for("Symbol."+n),gn=n=>{throw TypeError(n)},Dt=(n,e,t)=>e in n?qs(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,V=(n,e)=>{for(var t in e||(e={}))Gs.call(e,t)&&Dt(n,t,e[t]);if(Ft)for(var t of Ft(e))Ks.call(e,t)&&Dt(n,t,e[t]);return n},Et=(n,e)=>Hs(n,Js(e)),At=(n,e,t)=>e.has(n)||gn("Cannot "+t),k=(n,e,t)=>(At(n,e,"read from private field"),t?t.call(n):e.get(n)),B=(n,e,t)=>e.has(n)?gn("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),j=(n,e,t,s)=>(At(n,e,"write to private field"),e.set(n,t),t),ee=(n,e,t)=>(At(n,e,"access private method"),t),E=(n,e,t)=>new Promise((s,r)=>{var a=c=>{try{o(t.next(c))}catch(u){r(u)}},i=c=>{try{o(t.throw(c))}catch(u){r(u)}},o=c=>c.done?s(c.value):Promise.resolve(c.value).then(a,i);o((t=t.apply(n,e)).next())}),Xs=(n,e,t)=>(e=n[Lt("asyncIterator")])?e.call(n):(n=n[Lt("iterator")](),e={},t=(s,r)=>(r=n[s])&&(e[s]=a=>new Promise((i,o,c)=>(a=r.call(n,a),c=a.done,Promise.resolve(a.value).then(u=>i({value:u,done:c}),o)))),t("next"),t("return"),e),Ys=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Qs(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var gt={exports:{}},er=gt.exports,Vt;function tr(){return Vt||(Vt=1,function(n,e){(function(t,s){n.exports=s()})(er,function(){var t=typeof Promise=="function",s=typeof self=="object"?self:Ys,r=typeof Symbol!="undefined",a=typeof Map!="undefined",i=typeof Set!="undefined",o=typeof WeakMap!="undefined",c=typeof WeakSet!="undefined",u=typeof DataView!="undefined",f=r&&typeof Symbol.iterator!="undefined",_=r&&typeof Symbol.toStringTag!="undefined",C=i&&typeof Set.prototype.entries=="function",A=a&&typeof Map.prototype.entries=="function",O=C&&Object.getPrototypeOf(new Set().entries()),Z=A&&Object.getPrototypeOf(new Map().entries()),q=f&&typeof Array.prototype[Symbol.iterator]=="function",z=q&&Object.getPrototypeOf([][Symbol.iterator]()),re=f&&typeof String.prototype[Symbol.iterator]=="function",L=re&&Object.getPrototypeOf(""[Symbol.iterator]()),K=8,T=-1;function Ct(N){var Nt=typeof N;if(Nt!=="object")return Nt;if(N===null)return"null";if(N===s)return"global";if(Array.isArray(N)&&(_===!1||!(Symbol.toStringTag in N)))return"Array";if(typeof window=="object"&&window!==null){if(typeof window.location=="object"&&N===window.location)return"Location";if(typeof window.document=="object"&&N===window.document)return"Document";if(typeof window.navigator=="object"){if(typeof window.navigator.mimeTypes=="object"&&N===window.navigator.mimeTypes)return"MimeTypeArray";if(typeof window.navigator.plugins=="object"&&N===window.navigator.plugins)return"PluginArray"}if((typeof window.HTMLElement=="function"||typeof window.HTMLElement=="object")&&N instanceof window.HTMLElement){if(N.tagName==="BLOCKQUOTE")return"HTMLQuoteElement";if(N.tagName==="TD")return"HTMLTableDataCellElement";if(N.tagName==="TH")return"HTMLTableHeaderCellElement"}}var It=_&&N[Symbol.toStringTag];if(typeof It=="string")return It;var D=Object.getPrototypeOf(N);return D===RegExp.prototype?"RegExp":D===Date.prototype?"Date":t&&D===Promise.prototype?"Promise":i&&D===Set.prototype?"Set":a&&D===Map.prototype?"Map":c&&D===WeakSet.prototype?"WeakSet":o&&D===WeakMap.prototype?"WeakMap":u&&D===DataView.prototype?"DataView":a&&D===Z?"Map Iterator":i&&D===O?"Set Iterator":q&&D===z?"Array Iterator":re&&D===L?"String Iterator":D===null?"Object":Object.prototype.toString.call(N).slice(K,T)}return Ct})}(gt)),gt.exports}var nr=tr();const sr=Qs(nr),Ot=typeof Buffer!="undefined",rr=Ot&&typeof Buffer.from!="undefined",ar=Ot?function(n){return Buffer.isBuffer(n)}:function(){return!1},ir=rr?function(n){return Buffer.from(n)}:Ot?function(n){return new Buffer(n)}:function(n){return n};function Ae(n){return ar(n)?"Buffer":sr(n)}const or=new Set(["Arguments","Array","Map","Object","Set"]);function cr(n,e,t=null){switch(t||Ae(n)){case"Arguments":case"Array":case"Object":return n[e];case"Map":return n.get(e);case"Set":return e}}function yt(n){return or.has(n)}function Ut(n,e,t,s=null){switch(s||Ae(n)){case"Arguments":case"Array":case"Object":n[e]=t;break;case"Map":n.set(e,t);break;case"Set":n.add(t);break}return n}const dr=typeof globalThis!="undefined"&&globalThis!==null&&globalThis.Object===Object&&globalThis,ur=typeof global!="undefined"&&global!==null&&global.Object===Object&&global,lr=typeof self!="undefined"&&self!==null&&self.Object===Object&&self,dt=dr||ur||lr||Function("return this")();function fr(n){return n.slice(0)}function hr(n){return new Boolean(n.valueOf())}function pr(n){return new DataView(n.buffer)}function mr(n){return ir(n)}function gr(n){return new Date(n.getTime())}function yr(n){return new Number(n)}function vr(n){return new RegExp(n.source,n.flags)}function _r(n){return new String(n)}function ae(n,e){return dt[e].from?dt[e].from(n):new dt[e](n)}function M(n){return n}function zt(){return[]}function br(){return new Map}function wr(){return{}}function xr(){return new Set}const kr=new Map([["ArrayBuffer",fr],["Boolean",hr],["Buffer",mr],["DataView",pr],["Date",gr],["Number",yr],["RegExp",vr],["String",_r],["Float32Array",ae],["Float64Array",ae],["Int16Array",ae],["Int32Array",ae],["Int8Array",ae],["Uint16Array",ae],["Uint32Array",ae],["Uint8Array",ae],["Uint8ClampedArray",ae],["Array Iterator",M],["Map Iterator",M],["Promise",M],["Set Iterator",M],["String Iterator",M],["function",M],["global",M],["WeakMap",M],["WeakSet",M],["boolean",M],["null",M],["number",M],["string",M],["symbol",M],["undefined",M],["Arguments",zt],["Array",zt],["Map",br],["Object",wr],["Set",xr]]);function Tr(){}function vt(n,e=null,t=Tr){arguments.length===2&&typeof e=="function"&&(t=e,e=null);const s=e||Ae(n),r=kr.get(s);if(s==="Object"){const a=t(n,s);if(a!==void 0)return a}return r?r(n,s):n}function Oe(n,e={}){typeof e=="function"&&(e={customizer:e});const{customizer:t}=e,s=Ae(n);if(!yt(s))return _t(n,null,null,null);const r=vt(n,s,t),a=new WeakMap([[n,r]]),i=new WeakSet([n]);return _t(n,r,a,i)}function _t(n,e,t,s,r){const a=Ae(n),i=vt(n,a);if(!yt(a))return i;let o;switch(a){case"Arguments":case"Array":o=Object.keys(n);break;case"Object":o=Object.keys(n),o.push(...Object.getOwnPropertySymbols(n));break;case"Map":case"Set":o=n.keys();break}for(let c of o){const u=cr(n,c,a);if(s.has(u))Ut(e,c,t.get(u),a);else{const f=Ae(u),_=vt(u,f);yt(f)&&(t.set(u,_),s.add(u)),Ut(e,c,_t(u,_,t,s),a)}}return e}const Sr=n=>new Promise(e=>setTimeout(e,n));var Ge,pe,Ke,bt,yn;class Er{constructor({maxAttempts:e=3,func:t}){B(this,bt),B(this,Ge),B(this,pe),B(this,Ke),j(this,Ge,e),j(this,Ke,t),j(this,pe,0)}run(){return E(this,null,function*(){try{return yield k(this,Ke).call(this)}catch(e){if(j(this,pe,k(this,pe)+1),k(this,pe)>k(this,Ge))throw console.error("Max attempts reached"),e;const t=ee(this,bt,yn).call(this);return yield Sr(t),yield this.run()}})}}Ge=new WeakMap,pe=new WeakMap,Ke=new WeakMap,bt=new WeakSet,yn=function(){return k(this,pe)*1e3*1.5};function Ar(){return typeof CompressionStream!="undefined"}function Or(n){return E(this,null,function*(){const e=new Blob([n]).stream().pipeThrough(new CompressionStream("gzip")),t=[];try{for(var s=Xs(e),r,a,i;r=!(a=yield s.next()).done;r=!1){const o=a.value;t.push(o)}}catch(o){i=[o]}finally{try{r&&(a=s.return)&&(yield a.call(s))}finally{if(i)throw i[0]}}return yield Cr(t)})}function Cr(n){return E(this,null,function*(){const e=yield new Blob(n).arrayBuffer();return new Uint8Array(e)})}class Nr extends Error{constructor({resource:e,api:t,args:s,cause:r}){if(super(`API Error on resource "${e}" at api "${t}"`),this.causeProperties={},this.name="API Error",this.resource=e,this.api=t,this.cause=r,this.args=s,r instanceof Error)for(const[i,o]of Object.entries(r))if(typeof Headers!="undefined"&&o instanceof Headers){const c={};o.forEach((u,f)=>{c[f]=u}),this.causeProperties[i]=c}else this.causeProperties[i]=o;const a=this.causeProperties.body;a&&typeof a=="object"&&"code"in a&&(this.code=a.code)}}class Wt extends Error{constructor({url:e,method:t,statusCode:s,requestHeaders:r,responseHeaders:a,body:i}){if(super("Fetch Error"),this.name="Fetch Error",this.url=e,this.method=t,this.statusNumber=s,this.requestHeaders=r,this.responseHeaders=a,i)try{const o=JSON.parse(i);this.body=o}catch(o){this.body=i}}}class Ie extends Error{constructor(e={}){const{canceled:t=!1}=e;super("Abort Error"),this.name="Abort Error",this.canceled=t}}class Ir extends Error{constructor(e){super(`Async API Error: ${JSON.stringify(e)}`),this.name="Async API Error",this.body=e}}class ut extends Error{constructor(e){super(e),this.name="Request Validation Error"}}function vn(){return Array.from({length:32},()=>Math.floor(Math.random()*256).toString(16).padStart(2,"0")).join("")}function wt(){return Math.floor(Date.now()/1e3).toString()}const jr=5*60*1e3,Rr=1*1e3;var me,F,Y,xt,kt,je;class Zr{constructor({fetch:e=globalThis.fetch.bind(globalThis),baseAddress:t}){B(this,Y),B(this,me),B(this,F),this.baseAddress=t,j(this,me,e),j(this,F,{}),this.plugins=[]}get headers(){throw new Error("Missing implementation")}addPlugin(e){this.plugins.push(e)}removePlugin(e){this.plugins=this.plugins.filter(t=>t.name!==e)}withOptions(e={}){return j(this,F,e),this}get(e){return E(this,arguments,function*(t,s={}){const{overrideBaseAddress:r,overrideDefaultHeaders:a}=s,i=r!=null?r:this.baseAddress;let o=a!=null?a:this.headers;const c=Oe(k(this,F));return j(this,F,{}),c.extraHeaders&&(o=V(V({},o),c.extraHeaders)),c.requestValidation&&(o=Et(V({},o),{"X-Request-Nonce":vn(),"X-Request-Timestamp":wt()})),c.async?yield ee(this,Y,kt).call(this,`${i}${t}`,c.async,{headers:o}):yield ee(this,Y,xt).call(this,`${i}${t}`,c,{headers:o})})}post(e,t){return E(this,arguments,function*(s,r,a={}){const i=Oe(k(this,F));return j(this,F,{}),ee(this,Y,je).call(this,s,"POST",r,a,i)})}put(e,t){return E(this,arguments,function*(s,r,a={}){const i=Oe(k(this,F));return j(this,F,{}),ee(this,Y,je).call(this,s,"PUT",r,a,i)})}delete(e,t){return E(this,arguments,function*(s,r,a={}){const i=Oe(k(this,F));return j(this,F,{}),ee(this,Y,je).call(this,s,"DELETE",r,a,i)})}patch(e,t){return E(this,arguments,function*(s,r,a={}){const i=Oe(k(this,F));return j(this,F,{}),ee(this,Y,je).call(this,s,"PATCH",r,a,i)})}}me=new WeakMap,F=new WeakMap,Y=new WeakSet,xt=function(n,e,t){return E(this,null,function*(){const s=()=>E(this,null,function*(){var c,u;try{return yield k(this,me).call(this,n,V(V({},t),e.abortSignal&&{signal:e.abortSignal}))}catch(f){throw f instanceof Error&&f.name==="AbortError"?new Ie({canceled:(u=(c=e.abortSignal)==null?void 0:c.aborted)!=null?u:!1}):f}}),{headers:r}=t!=null?t:{},a=(c,u)=>{var f,_;return((f=c==null?void 0:c.headers)==null?void 0:f.get(u))||((_=c==null?void 0:c.headersObject)==null?void 0:_[u])||""},i=c=>E(this,null,function*(){var u;if(!c.ok){const _=yield c.text().catch();throw new Wt({url:n,method:(u=t==null?void 0:t.method)!=null?u:"GET",statusCode:c.status,requestHeaders:r,responseHeaders:c.headers,body:_})}if(e.requestValidation&&process.env.UI_TESTS!==!0)try{const _=a(c,"x-response-nonce"),C=r==null?void 0:r["X-Request-Nonce"];if(!_||_!==C)throw new ut("Response nonce mismatch");const A=Number(a(c,"x-response-timestamp")),O=Number(wt()),Z=60*60*24;if(isNaN(A)||Math.abs(O-A)>Z)throw new ut("Invalid response timestamp")}catch(_){const C=_ instanceof Error?_.message:"Request validation failed";throw new ut(C)}let f=yield c.text();try{f=JSON.parse(f)}catch(_){}return f});if(e.retry){const c=yield new Er({maxAttempts:e.retry,func:s}).run();return yield i(c)}const o=yield s();return yield i(o)})},kt=function(n,e,t){return E(this,null,function*(){var s,r;const{onProgress:a,abortSignal:i,pollingInterval:o=()=>Rr,maxTimeout:c=jr}=e,u=`${n}/async`,f=`${n}/async/job`;let _;try{_=yield k(this,me).call(this,u,V(V({},t),i&&{signal:i}))}catch(O){throw O instanceof Error&&O.name==="AbortError"?new Ie({canceled:(s=i==null?void 0:i.aborted)!=null?s:!1}):O}if(!_.ok){const O=yield _.text().catch();throw new Wt({url:n,method:(r=t==null?void 0:t.method)!=null?r:"GET",statusCode:_.status,requestHeaders:this.headers,responseHeaders:_.headers,body:O})}const C=yield _.json(),{job_id:A}=C;if(!A)throw new Error("Job ID not found in response");return new Promise((O,Z)=>E(this,null,function*(){const q=setTimeout(()=>{Z(new Error("Job timed out"))},c),z=(re=0)=>E(this,null,function*(){if(i!=null&&i.aborted){clearTimeout(q),k(this,me).call(this,`${f}/${A}/cancel`,{method:"POST",headers:this.headers}).then(()=>{Z(new Ie({canceled:!0}))}).catch(L=>{Z(new Ie({canceled:!1}))});return}try{const L=yield(yield k(this,me).call(this,`${f}/${A}`,{headers:this.headers})).json();if(L.status==="success"){clearTimeout(q);const K=L.response_json;O(K)}else if(L.status==="failed")clearTimeout(q),Z(new Ir(L.response_json));else{a&&a(L.response_json);const K=o(re);setTimeout(()=>z(re+1),K)}}catch(L){Z(L)}});z()}))})},je=function(n,e,t,s,r){return E(this,null,function*(){const{overrideBaseAddress:a,overrideDefaultHeaders:i}=s,o=a!=null?a:this.baseAddress;let c=i!=null?i:this.headers;r.extraHeaders&&(c=V(V({},c),r.extraHeaders)),r.requestValidation&&(c=Et(V({},c),{"X-Request-Nonce":vn(),"X-Request-Timestamp":wt()}));let u=s.skipBodyJsonStringify?t:JSON.stringify(t);return r.compress&&Ar()&&(c["Content-Encoding"]="gzip",u=yield Or(u)),r.async?yield ee(this,Y,kt).call(this,`${o}${n}`,r.async,{method:e,headers:c,body:u}):yield ee(this,Y,xt).call(this,`${o}${n}`,r,{method:e,headers:c,body:u})})};const Bt=(n,e,t,s)=>n instanceof Ie?n:new Nr({resource:e,api:String(t),args:s,cause:n}),lt=(n,e)=>new Proxy(e,{get(t,s){return(...r)=>{var a;for(const o of n.plugins){const c=(a=o.beforeApi)==null?void 0:a.call(o,{resource:t.resourceName,api:s,args:r});if(c!==void 0)return c}let i;try{i=t[s](...r)}catch(o){throw Bt(o,t.resourceName,s,r)}return i instanceof Promise?i.catch(o=>{throw Bt(o,t.resourceName,s,r)}):i}}});var Re;class Mr{constructor(e){B(this,Re),this.resourceName="Files",j(this,Re,e)}get(e){return E(this,arguments,function*({fileKey:t,params:s={}}){const r=new URLSearchParams(V({plugin_data:"857346721138427857"},s)).toString(),a=`v1/files/${t}?${r}`;return yield k(this,Re).get(a)})}getImageFills(e){return E(this,arguments,function*({fileKey:t}){var s,r;const a=`v1/files/${t}/images`;return(r=(s=(yield k(this,Re).get(a)).meta)==null?void 0:s.images)!=null?r:{}})}}Re=new WeakMap;const Pr=(n,e,t)=>{const s=e.sort();return`${n}-${s.join("-")}-${t}`},$r=n=>n?n.ts>Date.now()-1e3*30:!1;var Q,Tt,_n;class Fr{constructor(e){B(this,Tt),B(this,Q),this.resourceName="Images",j(this,Q,e)}get(e){return E(this,arguments,function*({fileKey:t,nodeIds:s,format:r="jpg",scale:a}){const i=Pr(t,s,r),o=k(this,Q).cache.images.entries.get(i);if($r(o))return o.result;o&&k(this,Q).cache.images.entries.delete(i);const c=k(this,Q).cache.images.pendingRequests.get(i);if(c)return c;const u=ee(this,Tt,_n).call(this,i,t,s,r,a);k(this,Q).cache.images.pendingRequests.set(i,u);try{return yield u}finally{k(this,Q).cache.images.pendingRequests.delete(i)}})}}Q=new WeakMap,Tt=new WeakSet,_n=function(n,e,t,s,r){return E(this,null,function*(){const a=yield k(this,Q).get(`v1/images/${e}?ids=${t}&format=${s}${r?`&scale=${r}`:""}`);return k(this,Q).cache.images.entries.set(n,{result:a,ts:Date.now()}),a})};var Xe;class Lr{constructor(e){B(this,Xe),this.resourceName="Nodes",j(this,Xe,e)}get(e){return E(this,arguments,function*({fileKey:t,nodeIds:s,params:r={}}){const a=Et(V({},r),{ids:s.join(",")}),i=new URLSearchParams(V({plugin_data:"857346721138427857"},a)).toString(),o=`v1/files/${t}/nodes?${i}`;return yield k(this,Xe).get(o)})}}Xe=new WeakMap;var de;class bn extends Zr{constructor({baseAddress:e="https://api.figma.com/",fetch:t=globalThis.fetch.bind(globalThis)}={}){super({fetch:t,baseAddress:e}),B(this,de,""),this.cache={images:{entries:new Map,pendingRequests:new Map}},this.files=lt(this,new Mr(this)),this.nodes=lt(this,new Lr(this)),this.images=lt(this,new Fr(this))}set token(e){if(!e.startsWith("figd_")&&!e.startsWith("figu_"))throw new Error("Invalid Figma access token");j(this,de,e)}get token(){return k(this,de)}get headers(){const e={"Content-Type":"application/json"};return k(this,de).startsWith("figd_")?e["X-FIGMA-TOKEN"]=k(this,de):k(this,de).startsWith("figu_")&&(e.Authorization=`Bearer ${k(this,de)}`),e}}de=new WeakMap;const Dr=r=>$(exports,[r],function*({fileKey:n,authToken:e,figmaRestApi:t=new bn,params:s={}}){e&&(t.token=e);try{return yield t.files.get({fileKey:n,params:s})}catch(a){throw console.error(a),a}}),Vr=a=>$(exports,[a],function*({fileKey:n,authToken:e,nodeIds:t,figmaRestApi:s=new bn,params:r={}}){e&&(s.token=e);try{return(yield s.nodes.get({fileKey:n,nodeIds:t,params:d({},r)})).nodes}catch(i){return mn(i,n)}}),wn=(n,e)=>new ReadableStream({start(t){n.generateCode(e,s=>{s.type==="error"?(console.log("NOT SURE IF THIS IS REACHABLE, ALL ERRORS ARE THROWING"),t.enqueue({type:"error",payload:{message:s.payload.reason}})):t.enqueue(s),(s.type==="aborted"||s.type==="error")&&t.close()}).then(s=>{t.enqueue({type:"done",payload:{tokenUsage:s.tokenUsage,sessionId:s.sessionId}}),t.close()}).catch(s=>{t.enqueue({type:"error",payload:{message:"message"in s?s.message:"Unknown",status:"status"in s?s.status:void 0}}),t.close()})}}),Ur=(n,e)=>$(exports,null,function*(){var c,u,f,_,C,A,O;const t=wn(n,e),[s,r]=t.tee(),a=yield s.getReader().read();if(a.done||!a.value||((c=a.value)==null?void 0:c.type)==="error"&&((f=(u=a.value)==null?void 0:u.payload)!=null&&f.status))return new Response(JSON.stringify(a.value),{status:((_=a.value)==null?void 0:_.type)==="error"&&(O=(A=(C=a.value)==null?void 0:C.payload)==null?void 0:A.status)!=null?O:500,headers:{"Content-Type":"application/json"}});const i=new TextEncoder,o=r.pipeThrough(new TransformStream({transform(Z,q){const z=`event: ${Z.type}
|
|
1
|
+
"use strict";var xn=Object.defineProperty,kn=Object.defineProperties;var Tn=Object.getOwnPropertyDescriptors;var jt=Object.getOwnPropertySymbols;var Sn=Object.prototype.hasOwnProperty,En=Object.prototype.propertyIsEnumerable;var Zt=n=>{throw TypeError(n)};var Rt=(n,e,t)=>e in n?xn(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,u=(n,e)=>{for(var t in e||(e={}))Sn.call(e,t)&&Rt(n,t,e[t]);if(jt)for(var t of jt(e))En.call(e,t)&&Rt(n,t,e[t]);return n},g=(n,e)=>kn(n,Tn(e));var Mt=(n,e,t)=>e.has(n)||Zt("Cannot "+t);var K=(n,e,t)=>(Mt(n,e,"read from private field"),t?t.call(n):e.get(n)),ot=(n,e,t)=>e.has(n)?Zt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),ct=(n,e,t,s)=>(Mt(n,e,"write to private field"),s?s.call(n,t):e.set(n,t),t);var F=(n,e,t)=>new Promise((s,r)=>{var a=c=>{try{o(t.next(c))}catch(d){r(d)}},i=c=>{try{o(t.throw(c))}catch(d){r(d)}},o=c=>c.done?s(c.value):Promise.resolve(c.value).then(a,i);o((t=t.apply(n,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class we extends Error{constructor({name:e,reason:t,status:s}){super(),this.name=`[Codegen Error] ${e}`,this.message=t,this.status=s}}var x;(function(n){n.assertEqual=r=>r;function e(r){}n.assertIs=e;function t(r){throw new Error}n.assertNever=t,n.arrayToEnum=r=>{const a={};for(const i of r)a[i]=i;return a},n.getValidEnumValues=r=>{const a=n.objectKeys(r).filter(o=>typeof r[r[o]]!="number"),i={};for(const o of a)i[o]=r[o];return n.objectValues(i)},n.objectValues=r=>n.objectKeys(r).map(function(a){return r[a]}),n.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const a=[];for(const i in r)Object.prototype.hasOwnProperty.call(r,i)&&a.push(i);return a},n.find=(r,a)=>{for(const i of r)if(a(i))return i},n.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&isFinite(r)&&Math.floor(r)===r;function s(r,a=" | "){return r.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}n.joinValues=s,n.jsonStringifyReplacer=(r,a)=>typeof a=="bigint"?a.toString():a})(x||(x={}));var ht;(function(n){n.mergeShapes=(e,t)=>u(u({},e),t)})(ht||(ht={}));const p=x.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ie=n=>{switch(typeof n){case"undefined":return p.undefined;case"string":return p.string;case"number":return isNaN(n)?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(n)?p.array:n===null?p.null:n.then&&typeof n.then=="function"&&n.catch&&typeof n.catch=="function"?p.promise:typeof Map!="undefined"&&n instanceof Map?p.map:typeof Set!="undefined"&&n instanceof Set?p.set:typeof Date!="undefined"&&n instanceof Date?p.date:p.object;default:return p.unknown}},l=x.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"]),An=n=>JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:");class U 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]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(a){return a.message},s={_errors:[]},r=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(r);else if(i.code==="invalid_return_type")r(i.returnTypeError);else if(i.code==="invalid_arguments")r(i.argumentsError);else if(i.path.length===0)s._errors.push(t(i));else{let o=s,c=0;for(;c<i.path.length;){const d=i.path[c];c===i.path.length-1?(o[d]=o[d]||{_errors:[]},o[d]._errors.push(t(i))):o[d]=o[d]||{_errors:[]},o=o[d],c++}}};return r(this),s}static assert(e){if(!(e instanceof U))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,x.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},s=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):s.push(e(r));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}}U.create=n=>new U(n);const Se=(n,e)=>{let t;switch(n.code){case l.invalid_type:n.received===p.undefined?t="Required":t=`Expected ${n.expected}, received ${n.received}`;break;case l.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(n.expected,x.jsonStringifyReplacer)}`;break;case l.unrecognized_keys:t=`Unrecognized key(s) in object: ${x.joinValues(n.keys,", ")}`;break;case l.invalid_union:t="Invalid input";break;case l.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${x.joinValues(n.options)}`;break;case l.invalid_enum_value:t=`Invalid enum value. Expected ${x.joinValues(n.options)}, received '${n.received}'`;break;case l.invalid_arguments:t="Invalid function arguments";break;case l.invalid_return_type:t="Invalid function return type";break;case l.invalid_date:t="Invalid date";break;case l.invalid_string:typeof n.validation=="object"?"includes"in n.validation?(t=`Invalid input: must include "${n.validation.includes}"`,typeof n.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${n.validation.position}`)):"startsWith"in n.validation?t=`Invalid input: must start with "${n.validation.startsWith}"`:"endsWith"in n.validation?t=`Invalid input: must end with "${n.validation.endsWith}"`:x.assertNever(n.validation):n.validation!=="regex"?t=`Invalid ${n.validation}`:t="Invalid";break;case l.too_small:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at least":"more than"} ${n.minimum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at least":"over"} ${n.minimum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${n.minimum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly equal to ":n.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(n.minimum))}`:t="Invalid input";break;case l.too_big:n.type==="array"?t=`Array must contain ${n.exact?"exactly":n.inclusive?"at most":"less than"} ${n.maximum} element(s)`:n.type==="string"?t=`String must contain ${n.exact?"exactly":n.inclusive?"at most":"under"} ${n.maximum} character(s)`:n.type==="number"?t=`Number must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="bigint"?t=`BigInt must be ${n.exact?"exactly":n.inclusive?"less than or equal to":"less than"} ${n.maximum}`:n.type==="date"?t=`Date must be ${n.exact?"exactly":n.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(n.maximum))}`:t="Invalid input";break;case l.custom:t="Invalid input";break;case l.invalid_intersection_types:t="Intersection results could not be merged";break;case l.not_multiple_of:t=`Number must be a multiple of ${n.multipleOf}`;break;case l.not_finite:t="Number must be finite";break;default:t=e.defaultError,x.assertNever(n)}return{message:t}};let qt=Se;function On(n){qt=n}function Qe(){return qt}const et=n=>{const{data:e,path:t,errorMaps:s,issueData:r}=n,a=[...t,...r.path||[]],i=g(u({},r),{path:a});if(r.message!==void 0)return g(u({},r),{path:a,message:r.message});let o="";const c=s.filter(d=>!!d).slice().reverse();for(const d of c)o=d(i,{data:e,defaultError:o}).message;return g(u({},r),{path:a,message:o})},Cn=[];function h(n,e){const t=Qe(),s=et({issueData:e,data:n.data,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,t,t===Se?void 0:Se].filter(r=>!!r)});n.common.issues.push(s)}class R{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const s=[];for(const r of t){if(r.status==="aborted")return v;r.status==="dirty"&&e.dirty(),s.push(r.value)}return{status:e.value,value:s}}static mergeObjectAsync(e,t){return F(this,null,function*(){const s=[];for(const r of t){const a=yield r.key,i=yield r.value;s.push({key:a,value:i})}return R.mergeObjectSync(e,s)})}static mergeObjectSync(e,t){const s={};for(const r of t){const{key:a,value:i}=r;if(a.status==="aborted"||i.status==="aborted")return v;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value!="undefined"||r.alwaysSet)&&(s[a.value]=i.value)}return{status:e.value,value:s}}}const v=Object.freeze({status:"aborted"}),ke=n=>({status:"dirty",value:n}),P=n=>({status:"valid",value:n}),pt=n=>n.status==="aborted",mt=n=>n.status==="dirty",ye=n=>n.status==="valid",Me=n=>typeof Promise!="undefined"&&n instanceof Promise;function tt(n,e,t,s){if(typeof e=="function"?n!==e||!0:!e.has(n))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(n)}function Ht(n,e,t,s,r){if(typeof e=="function"?n!==e||!0:!e.has(n))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(n,t),t}var m;(function(n){n.errToObj=e=>typeof e=="string"?{message:e}:e||{},n.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(m||(m={}));var Ne,Ie;class te{constructor(e,t,s,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=r}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Pt=(n,e)=>{if(ye(e))return{success:!0,data:e.value};if(!n.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new U(n.common.issues);return this._error=t,this._error}}};function b(n){if(!n)return{};const{errorMap:e,invalid_type_error:t,required_error:s,description:r}=n;if(e&&(t||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(i,o)=>{var c,d;const{message:f}=n;return i.code==="invalid_enum_value"?{message:f!=null?f:o.defaultError}:typeof o.data=="undefined"?{message:(c=f!=null?f:s)!==null&&c!==void 0?c:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(d=f!=null?f:t)!==null&&d!==void 0?d:o.defaultError}},description:r}}class w{get description(){return this._def.description}_getType(e){return ie(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:ie(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new R,ctx:{common:e.parent.common,data:e.data,parsedType:ie(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(Me(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var s;const r={common:{issues:[],async:(s=t==null?void 0:t.async)!==null&&s!==void 0?s:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ie(e)},a=this._parseSync({data:e,path:r.path,parent:r});return Pt(r,a)}"~validate"(e){var t,s;const r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ie(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:r});return ye(a)?{value:a.value}:{issues:r.common.issues}}catch(a){!((s=(t=a==null?void 0:a.message)===null||t===void 0?void 0:t.toLowerCase())===null||s===void 0)&&s.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(a=>ye(a)?{value:a.value}:{issues:r.common.issues})}parseAsync(e,t){return F(this,null,function*(){const s=yield this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error})}safeParseAsync(e,t){return F(this,null,function*(){const s={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:ie(e)},r=this._parse({data:e,path:s.path,parent:s}),a=yield Me(r)?r:Promise.resolve(r);return Pt(s,a)})}refine(e,t){const s=r=>typeof t=="string"||typeof t=="undefined"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,a)=>{const i=e(r),o=()=>a.addIssue(u({code:l.custom},s(r)));return typeof Promise!="undefined"&&i instanceof Promise?i.then(c=>c?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,t){return this._refinement((s,r)=>e(s)?!0:(r.addIssue(typeof t=="function"?t(s,r):t),!1))}_refinement(e){return new G({schema:this,typeName:y.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return ee.create(this,this._def)}nullable(){return he.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return J.create(this)}promise(){return Ae.create(this,this._def)}or(e){return Le.create([this,e],this._def)}and(e){return De.create(this,e,this._def)}transform(e){return new G(g(u({},b(this._def)),{schema:this,typeName:y.ZodEffects,effect:{type:"transform",transform:e}}))}default(e){const t=typeof e=="function"?e:()=>e;return new Be(g(u({},b(this._def)),{innerType:this,defaultValue:t,typeName:y.ZodDefault}))}brand(){return new Et(u({typeName:y.ZodBranded,type:this},b(this._def)))}catch(e){const t=typeof e=="function"?e:()=>e;return new qe(g(u({},b(this._def)),{innerType:this,catchValue:t,typeName:y.ZodCatch}))}describe(e){const t=this.constructor;return new t(g(u({},this._def),{description:e}))}pipe(e){return Ge.create(this,e)}readonly(){return He.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Nn=/^c[^\s-]{8,}$/i,In=/^[0-9a-z]+$/,jn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Rn=/^[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,Zn=/^[a-z0-9_-]{21}$/i,Mn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Pn=/^[-+]?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)?)??$/,$n=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Fn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let ut;const Ln=/^(?:(?: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])$/,Dn=/^(?:(?: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])$/,Vn=/^(([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]))$/,Un=/^(([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])$/,zn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Wn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Jt="((\\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])))",Bn=new RegExp(`^${Jt}$`);function Gt(n){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return n.precision?e=`${e}\\.\\d{${n.precision}}`:n.precision==null&&(e=`${e}(\\.\\d+)?`),e}function qn(n){return new RegExp(`^${Gt(n)}$`)}function Kt(n){let e=`${Jt}T${Gt(n)}`;const t=[];return t.push(n.local?"Z?":"Z"),n.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function Hn(n,e){return!!((e==="v4"||!e)&&Ln.test(n)||(e==="v6"||!e)&&Vn.test(n))}function Jn(n,e){if(!Mn.test(n))return!1;try{const[t]=n.split("."),s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(s));return!(typeof r!="object"||r===null||!r.typ||!r.alg||e&&r.alg!==e)}catch(t){return!1}}function Gn(n,e){return!!((e==="v4"||!e)&&Dn.test(n)||(e==="v6"||!e)&&Un.test(n))}class H extends w{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){const a=this._getOrReturnCtx(e);return h(a,{code:l.invalid_type,expected:p.string,received:a.parsedType}),v}const s=new R;let r;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(r=this._getOrReturnCtx(e,r),h(r,{code:l.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&&(r=this._getOrReturnCtx(e,r),h(r,{code:l.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){const i=e.data.length>a.value,o=e.data.length<a.value;(i||o)&&(r=this._getOrReturnCtx(e,r),i?h(r,{code:l.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&h(r,{code:l.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")$n.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"email",code:l.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")ut||(ut=new RegExp(Fn,"u")),ut.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"emoji",code:l.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")Rn.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"uuid",code:l.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")Zn.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"nanoid",code:l.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")Nn.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"cuid",code:l.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")In.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"cuid2",code:l.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")jn.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"ulid",code:l.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch(i){r=this._getOrReturnCtx(e,r),h(r,{validation:"url",code:l.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"regex",code:l.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)||(r=this._getOrReturnCtx(e,r),h(r,{code:l.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)||(r=this._getOrReturnCtx(e,r),h(r,{code:l.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(r=this._getOrReturnCtx(e,r),h(r,{code:l.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?Kt(a).test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{code:l.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?Bn.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{code:l.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?qn(a).test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{code:l.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?Pn.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"duration",code:l.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?Hn(e.data,a.version)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"ip",code:l.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?Jn(e.data,a.alg)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"jwt",code:l.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?Gn(e.data,a.version)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"cidr",code:l.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?zn.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"base64",code:l.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?Wn.test(e.data)||(r=this._getOrReturnCtx(e,r),h(r,{validation:"base64url",code:l.invalid_string,message:a.message}),s.dirty()):x.assertNever(a);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(r=>e.test(r),u({validation:t,code:l.invalid_string},m.errToObj(s)))}_addCheck(e){return new H(g(u({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(u({kind:"email"},m.errToObj(e)))}url(e){return this._addCheck(u({kind:"url"},m.errToObj(e)))}emoji(e){return this._addCheck(u({kind:"emoji"},m.errToObj(e)))}uuid(e){return this._addCheck(u({kind:"uuid"},m.errToObj(e)))}nanoid(e){return this._addCheck(u({kind:"nanoid"},m.errToObj(e)))}cuid(e){return this._addCheck(u({kind:"cuid"},m.errToObj(e)))}cuid2(e){return this._addCheck(u({kind:"cuid2"},m.errToObj(e)))}ulid(e){return this._addCheck(u({kind:"ulid"},m.errToObj(e)))}base64(e){return this._addCheck(u({kind:"base64"},m.errToObj(e)))}base64url(e){return this._addCheck(u({kind:"base64url"},m.errToObj(e)))}jwt(e){return this._addCheck(u({kind:"jwt"},m.errToObj(e)))}ip(e){return this._addCheck(u({kind:"ip"},m.errToObj(e)))}cidr(e){return this._addCheck(u({kind:"cidr"},m.errToObj(e)))}datetime(e){var t,s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck(u({kind:"datetime",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!==null&&t!==void 0?t:!1,local:(s=e==null?void 0:e.local)!==null&&s!==void 0?s:!1},m.errToObj(e==null?void 0: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(u({kind:"time",precision:typeof(e==null?void 0:e.precision)=="undefined"?null:e==null?void 0:e.precision},m.errToObj(e==null?void 0:e.message)))}duration(e){return this._addCheck(u({kind:"duration"},m.errToObj(e)))}regex(e,t){return this._addCheck(u({kind:"regex",regex:e},m.errToObj(t)))}includes(e,t){return this._addCheck(u({kind:"includes",value:e,position:t==null?void 0:t.position},m.errToObj(t==null?void 0:t.message)))}startsWith(e,t){return this._addCheck(u({kind:"startsWith",value:e},m.errToObj(t)))}endsWith(e,t){return this._addCheck(u({kind:"endsWith",value:e},m.errToObj(t)))}min(e,t){return this._addCheck(u({kind:"min",value:e},m.errToObj(t)))}max(e,t){return this._addCheck(u({kind:"max",value:e},m.errToObj(t)))}length(e,t){return this._addCheck(u({kind:"length",value:e},m.errToObj(t)))}nonempty(e){return this.min(1,m.errToObj(e))}trim(){return new H(g(u({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}toLowerCase(){return new H(g(u({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new H(g(u({},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(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}H.create=n=>{var e;return new H(u({checks:[],typeName:y.ZodString,coerce:(e=n==null?void 0:n.coerce)!==null&&e!==void 0?e:!1},b(n)))};function Kn(n,e){const t=(n.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,r=t>s?t:s,a=parseInt(n.toFixed(r).replace(".","")),i=parseInt(e.toFixed(r).replace(".",""));return a%i/Math.pow(10,r)}class de extends w{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){const a=this._getOrReturnCtx(e);return h(a,{code:l.invalid_type,expected:p.number,received:a.parsedType}),v}let s;const r=new R;for(const a of this._def.checks)a.kind==="int"?x.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:l.invalid_type,expected:"integer",received:"float",message:a.message}),r.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),h(s,{code:l.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),h(s,{code:l.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="multipleOf"?Kn(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),h(s,{code:l.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),h(s,{code:l.not_finite,message:a.message}),r.dirty()):x.assertNever(a);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,s,r){return new de(g(u({},this._def),{checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:m.toString(r)}]}))}_addCheck(e){return new de(g(u({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:m.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:m.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:m.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:m.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&x.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}}de.create=n=>new de(u({checks:[],typeName:y.ZodNumber,coerce:(n==null?void 0:n.coerce)||!1},b(n)));class le extends w{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(a){return this._getInvalidInput(e)}if(this._getType(e)!==p.bigint)return this._getInvalidInput(e);let s;const r=new R;for(const a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),h(s,{code:l.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),h(s,{code:l.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),r.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),h(s,{code:l.not_multiple_of,multipleOf:a.value,message:a.message}),r.dirty()):x.assertNever(a);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return h(t,{code:l.invalid_type,expected:p.bigint,received:t.parsedType}),v}gte(e,t){return this.setLimit("min",e,!0,m.toString(t))}gt(e,t){return this.setLimit("min",e,!1,m.toString(t))}lte(e,t){return this.setLimit("max",e,!0,m.toString(t))}lt(e,t){return this.setLimit("max",e,!1,m.toString(t))}setLimit(e,t,s,r){return new le(g(u({},this._def),{checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:m.toString(r)}]}))}_addCheck(e){return new le(g(u({},this._def),{checks:[...this._def.checks,e]}))}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:m.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:m.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:m.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:m.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:m.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}le.create=n=>{var e;return new le(u({checks:[],typeName:y.ZodBigInt,coerce:(e=n==null?void 0:n.coerce)!==null&&e!==void 0?e:!1},b(n)))};class Pe extends w{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.boolean){const s=this._getOrReturnCtx(e);return h(s,{code:l.invalid_type,expected:p.boolean,received:s.parsedType}),v}return P(e.data)}}Pe.create=n=>new Pe(u({typeName:y.ZodBoolean,coerce:(n==null?void 0:n.coerce)||!1},b(n)));class ve extends w{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){const a=this._getOrReturnCtx(e);return h(a,{code:l.invalid_type,expected:p.date,received:a.parsedType}),v}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return h(a,{code:l.invalid_date}),v}const s=new R;let r;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(r=this._getOrReturnCtx(e,r),h(r,{code:l.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(r=this._getOrReturnCtx(e,r),h(r,{code:l.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):x.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new ve(g(u({},this._def),{checks:[...this._def.checks,e]}))}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:m.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:m.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}ve.create=n=>new ve(u({checks:[],coerce:(n==null?void 0:n.coerce)||!1,typeName:y.ZodDate},b(n)));class nt extends w{_parse(e){if(this._getType(e)!==p.symbol){const s=this._getOrReturnCtx(e);return h(s,{code:l.invalid_type,expected:p.symbol,received:s.parsedType}),v}return P(e.data)}}nt.create=n=>new nt(u({typeName:y.ZodSymbol},b(n)));class $e extends w{_parse(e){if(this._getType(e)!==p.undefined){const s=this._getOrReturnCtx(e);return h(s,{code:l.invalid_type,expected:p.undefined,received:s.parsedType}),v}return P(e.data)}}$e.create=n=>new $e(u({typeName:y.ZodUndefined},b(n)));class Fe extends w{_parse(e){if(this._getType(e)!==p.null){const s=this._getOrReturnCtx(e);return h(s,{code:l.invalid_type,expected:p.null,received:s.parsedType}),v}return P(e.data)}}Fe.create=n=>new Fe(u({typeName:y.ZodNull},b(n)));class Ee extends w{constructor(){super(...arguments),this._any=!0}_parse(e){return P(e.data)}}Ee.create=n=>new Ee(u({typeName:y.ZodAny},b(n)));class ge extends w{constructor(){super(...arguments),this._unknown=!0}_parse(e){return P(e.data)}}ge.create=n=>new ge(u({typeName:y.ZodUnknown},b(n)));class oe extends w{_parse(e){const t=this._getOrReturnCtx(e);return h(t,{code:l.invalid_type,expected:p.never,received:t.parsedType}),v}}oe.create=n=>new oe(u({typeName:y.ZodNever},b(n)));class st extends w{_parse(e){if(this._getType(e)!==p.undefined){const s=this._getOrReturnCtx(e);return h(s,{code:l.invalid_type,expected:p.void,received:s.parsedType}),v}return P(e.data)}}st.create=n=>new st(u({typeName:y.ZodVoid},b(n)));class J extends w{_parse(e){const{ctx:t,status:s}=this._processInputParams(e),r=this._def;if(t.parsedType!==p.array)return h(t,{code:l.invalid_type,expected:p.array,received:t.parsedType}),v;if(r.exactLength!==null){const i=t.data.length>r.exactLength.value,o=t.data.length<r.exactLength.value;(i||o)&&(h(t,{code:i?l.too_big:l.too_small,minimum:o?r.exactLength.value:void 0,maximum:i?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),s.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(h(t,{code:l.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),s.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(h(t,{code:l.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((i,o)=>r.type._parseAsync(new te(t,i,t.path,o)))).then(i=>R.mergeArray(s,i));const a=[...t.data].map((i,o)=>r.type._parseSync(new te(t,i,t.path,o)));return R.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new J(g(u({},this._def),{minLength:{value:e,message:m.toString(t)}}))}max(e,t){return new J(g(u({},this._def),{maxLength:{value:e,message:m.toString(t)}}))}length(e,t){return new J(g(u({},this._def),{exactLength:{value:e,message:m.toString(t)}}))}nonempty(e){return this.min(1,e)}}J.create=(n,e)=>new J(u({type:n,minLength:null,maxLength:null,exactLength:null,typeName:y.ZodArray},b(e)));function xe(n){if(n instanceof S){const e={};for(const t in n.shape){const s=n.shape[t];e[t]=ee.create(xe(s))}return new S(g(u({},n._def),{shape:()=>e}))}else return n instanceof J?new J(g(u({},n._def),{type:xe(n.element)})):n instanceof ee?ee.create(xe(n.unwrap())):n instanceof he?he.create(xe(n.unwrap())):n instanceof ne?ne.create(n.items.map(e=>xe(e))):n}class S extends w{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=x.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==p.object){const d=this._getOrReturnCtx(e);return h(d,{code:l.invalid_type,expected:p.object,received:d.parsedType}),v}const{status:s,ctx:r}=this._processInputParams(e),{shape:a,keys:i}=this._getCached(),o=[];if(!(this._def.catchall instanceof oe&&this._def.unknownKeys==="strip"))for(const d in r.data)i.includes(d)||o.push(d);const c=[];for(const d of i){const f=a[d],_=r.data[d];c.push({key:{status:"valid",value:d},value:f._parse(new te(r,_,r.path,d)),alwaysSet:d in r.data})}if(this._def.catchall instanceof oe){const d=this._def.unknownKeys;if(d==="passthrough")for(const f of o)c.push({key:{status:"valid",value:f},value:{status:"valid",value:r.data[f]}});else if(d==="strict")o.length>0&&(h(r,{code:l.unrecognized_keys,keys:o}),s.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const f of o){const _=r.data[f];c.push({key:{status:"valid",value:f},value:d._parse(new te(r,_,r.path,f)),alwaysSet:f in r.data})}}return r.common.async?Promise.resolve().then(()=>F(this,null,function*(){const d=[];for(const f of c){const _=yield f.key,N=yield f.value;d.push({key:_,value:N,alwaysSet:f.alwaysSet})}return d})).then(d=>R.mergeObjectSync(s,d)):R.mergeObjectSync(s,c)}get shape(){return this._def.shape()}strict(e){return m.errToObj,new S(u(g(u({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:(t,s)=>{var r,a,i,o;const c=(i=(a=(r=this._def).errorMap)===null||a===void 0?void 0:a.call(r,t,s).message)!==null&&i!==void 0?i:s.defaultError;return t.code==="unrecognized_keys"?{message:(o=m.errToObj(e).message)!==null&&o!==void 0?o:c}:{message:c}}}:{}))}strip(){return new S(g(u({},this._def),{unknownKeys:"strip"}))}passthrough(){return new S(g(u({},this._def),{unknownKeys:"passthrough"}))}extend(e){return new S(g(u({},this._def),{shape:()=>u(u({},this._def.shape()),e)}))}merge(e){return new S({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>u(u({},this._def.shape()),e._def.shape()),typeName:y.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new S(g(u({},this._def),{catchall:e}))}pick(e){const t={};return x.objectKeys(e).forEach(s=>{e[s]&&this.shape[s]&&(t[s]=this.shape[s])}),new S(g(u({},this._def),{shape:()=>t}))}omit(e){const t={};return x.objectKeys(this.shape).forEach(s=>{e[s]||(t[s]=this.shape[s])}),new S(g(u({},this._def),{shape:()=>t}))}deepPartial(){return xe(this)}partial(e){const t={};return x.objectKeys(this.shape).forEach(s=>{const r=this.shape[s];e&&!e[s]?t[s]=r:t[s]=r.optional()}),new S(g(u({},this._def),{shape:()=>t}))}required(e){const t={};return x.objectKeys(this.shape).forEach(s=>{if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof ee;)a=a._def.innerType;t[s]=a}}),new S(g(u({},this._def),{shape:()=>t}))}keyof(){return Xt(x.objectKeys(this.shape))}}S.create=(n,e)=>new S(u({shape:()=>n,unknownKeys:"strip",catchall:oe.create(),typeName:y.ZodObject},b(e)));S.strictCreate=(n,e)=>new S(u({shape:()=>n,unknownKeys:"strict",catchall:oe.create(),typeName:y.ZodObject},b(e)));S.lazycreate=(n,e)=>new S(u({shape:n,unknownKeys:"strip",catchall:oe.create(),typeName:y.ZodObject},b(e)));class Le extends w{_parse(e){const{ctx:t}=this._processInputParams(e),s=this._def.options;function r(a){for(const o of a)if(o.result.status==="valid")return o.result;for(const o of a)if(o.result.status==="dirty")return t.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new U(o.ctx.common.issues));return h(t,{code:l.invalid_union,unionErrors:i}),v}if(t.common.async)return Promise.all(s.map(a=>F(this,null,function*(){const i=g(u({},t),{common:g(u({},t.common),{issues:[]}),parent:null});return{result:yield a._parseAsync({data:t.data,path:t.path,parent:i}),ctx:i}}))).then(r);{let a;const i=[];for(const c of s){const d=g(u({},t),{common:g(u({},t.common),{issues:[]}),parent:null}),f=c._parseSync({data:t.data,path:t.path,parent:d});if(f.status==="valid")return f;f.status==="dirty"&&!a&&(a={result:f,ctx:d}),d.common.issues.length&&i.push(d.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(c=>new U(c));return h(t,{code:l.invalid_union,unionErrors:o}),v}}get options(){return this._def.options}}Le.create=(n,e)=>new Le(u({options:n,typeName:y.ZodUnion},b(e)));const ae=n=>n instanceof Ue?ae(n.schema):n instanceof G?ae(n.innerType()):n instanceof ze?[n.value]:n instanceof fe?n.options:n instanceof We?x.objectValues(n.enum):n instanceof Be?ae(n._def.innerType):n instanceof $e?[void 0]:n instanceof Fe?[null]:n instanceof ee?[void 0,...ae(n.unwrap())]:n instanceof he?[null,...ae(n.unwrap())]:n instanceof Et||n instanceof He?ae(n.unwrap()):n instanceof qe?ae(n._def.innerType):[];class it extends w{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.object)return h(t,{code:l.invalid_type,expected:p.object,received:t.parsedType}),v;const s=this.discriminator,r=t.data[s],a=this.optionsMap.get(r);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(h(t,{code:l.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),v)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){const r=new Map;for(const a of t){const i=ae(a.shape[e]);if(!i.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(const o of i){if(r.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);r.set(o,a)}}return new it(u({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r},b(s)))}}function gt(n,e){const t=ie(n),s=ie(e);if(n===e)return{valid:!0,data:n};if(t===p.object&&s===p.object){const r=x.objectKeys(e),a=x.objectKeys(n).filter(o=>r.indexOf(o)!==-1),i=u(u({},n),e);for(const o of a){const c=gt(n[o],e[o]);if(!c.valid)return{valid:!1};i[o]=c.data}return{valid:!0,data:i}}else if(t===p.array&&s===p.array){if(n.length!==e.length)return{valid:!1};const r=[];for(let a=0;a<n.length;a++){const i=n[a],o=e[a],c=gt(i,o);if(!c.valid)return{valid:!1};r.push(c.data)}return{valid:!0,data:r}}else return t===p.date&&s===p.date&&+n==+e?{valid:!0,data:n}:{valid:!1}}class De extends w{_parse(e){const{status:t,ctx:s}=this._processInputParams(e),r=(a,i)=>{if(pt(a)||pt(i))return v;const o=gt(a.value,i.value);return o.valid?((mt(a)||mt(i))&&t.dirty(),{status:t.value,value:o.data}):(h(s,{code:l.invalid_intersection_types}),v)};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])=>r(a,i)):r(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}De.create=(n,e,t)=>new De(u({left:n,right:e,typeName:y.ZodIntersection},b(t)));class ne extends w{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.array)return h(s,{code:l.invalid_type,expected:p.array,received:s.parsedType}),v;if(s.data.length<this._def.items.length)return h(s,{code:l.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),v;!this._def.rest&&s.data.length>this._def.items.length&&(h(s,{code:l.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const a=[...s.data].map((i,o)=>{const c=this._def.items[o]||this._def.rest;return c?c._parse(new te(s,i,s.path,o)):null}).filter(i=>!!i);return s.common.async?Promise.all(a).then(i=>R.mergeArray(t,i)):R.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new ne(g(u({},this._def),{rest:e}))}}ne.create=(n,e)=>{if(!Array.isArray(n))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ne(u({items:n,typeName:y.ZodTuple,rest:null},b(e)))};class Ve extends w{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.object)return h(s,{code:l.invalid_type,expected:p.object,received:s.parsedType}),v;const r=[],a=this._def.keyType,i=this._def.valueType;for(const o in s.data)r.push({key:a._parse(new te(s,o,s.path,o)),value:i._parse(new te(s,s.data[o],s.path,o)),alwaysSet:o in s.data});return s.common.async?R.mergeObjectAsync(t,r):R.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof w?new Ve(u({keyType:e,valueType:t,typeName:y.ZodRecord},b(s))):new Ve(u({keyType:H.create(),valueType:e,typeName:y.ZodRecord},b(t)))}}class rt extends w{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.map)return h(s,{code:l.invalid_type,expected:p.map,received:s.parsedType}),v;const r=this._def.keyType,a=this._def.valueType,i=[...s.data.entries()].map(([o,c],d)=>({key:r._parse(new te(s,o,s.path,[d,"key"])),value:a._parse(new te(s,c,s.path,[d,"value"]))}));if(s.common.async){const o=new Map;return Promise.resolve().then(()=>F(this,null,function*(){for(const c of i){const d=yield c.key,f=yield c.value;if(d.status==="aborted"||f.status==="aborted")return v;(d.status==="dirty"||f.status==="dirty")&&t.dirty(),o.set(d.value,f.value)}return{status:t.value,value:o}}))}else{const o=new Map;for(const c of i){const d=c.key,f=c.value;if(d.status==="aborted"||f.status==="aborted")return v;(d.status==="dirty"||f.status==="dirty")&&t.dirty(),o.set(d.value,f.value)}return{status:t.value,value:o}}}}rt.create=(n,e,t)=>new rt(u({valueType:e,keyType:n,typeName:y.ZodMap},b(t)));class _e extends w{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==p.set)return h(s,{code:l.invalid_type,expected:p.set,received:s.parsedType}),v;const r=this._def;r.minSize!==null&&s.data.size<r.minSize.value&&(h(s,{code:l.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&s.data.size>r.maxSize.value&&(h(s,{code:l.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const a=this._def.valueType;function i(c){const d=new Set;for(const f of c){if(f.status==="aborted")return v;f.status==="dirty"&&t.dirty(),d.add(f.value)}return{status:t.value,value:d}}const o=[...s.data.values()].map((c,d)=>a._parse(new te(s,c,s.path,d)));return s.common.async?Promise.all(o).then(c=>i(c)):i(o)}min(e,t){return new _e(g(u({},this._def),{minSize:{value:e,message:m.toString(t)}}))}max(e,t){return new _e(g(u({},this._def),{maxSize:{value:e,message:m.toString(t)}}))}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}_e.create=(n,e)=>new _e(u({valueType:n,minSize:null,maxSize:null,typeName:y.ZodSet},b(e)));class Te extends w{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.function)return h(t,{code:l.invalid_type,expected:p.function,received:t.parsedType}),v;function s(o,c){return et({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Qe(),Se].filter(d=>!!d),issueData:{code:l.invalid_arguments,argumentsError:c}})}function r(o,c){return et({data:o,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Qe(),Se].filter(d=>!!d),issueData:{code:l.invalid_return_type,returnTypeError:c}})}const a={errorMap:t.common.contextualErrorMap},i=t.data;if(this._def.returns instanceof Ae){const o=this;return P(function(...c){return F(this,null,function*(){const d=new U([]),f=yield o._def.args.parseAsync(c,a).catch(A=>{throw d.addIssue(s(c,A)),d}),_=yield Reflect.apply(i,this,f);return yield o._def.returns._def.type.parseAsync(_,a).catch(A=>{throw d.addIssue(r(_,A)),d})})})}else{const o=this;return P(function(...c){const d=o._def.args.safeParse(c,a);if(!d.success)throw new U([s(c,d.error)]);const f=Reflect.apply(i,this,d.data),_=o._def.returns.safeParse(f,a);if(!_.success)throw new U([r(f,_.error)]);return _.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Te(g(u({},this._def),{args:ne.create(e).rest(ge.create())}))}returns(e){return new Te(g(u({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new Te(u({args:e||ne.create([]).rest(ge.create()),returns:t||ge.create(),typeName:y.ZodFunction},b(s)))}}class Ue extends w{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}Ue.create=(n,e)=>new Ue(u({getter:n,typeName:y.ZodLazy},b(e)));class ze extends w{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return h(t,{received:t.data,code:l.invalid_literal,expected:this._def.value}),v}return{status:"valid",value:e.data}}get value(){return this._def.value}}ze.create=(n,e)=>new ze(u({value:n,typeName:y.ZodLiteral},b(e)));function Xt(n,e){return new fe(u({values:n,typeName:y.ZodEnum},b(e)))}class fe extends w{constructor(){super(...arguments),Ne.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),s=this._def.values;return h(t,{expected:x.joinValues(s),received:t.parsedType,code:l.invalid_type}),v}if(tt(this,Ne)||Ht(this,Ne,new Set(this._def.values)),!tt(this,Ne).has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return h(t,{received:t.data,code:l.invalid_enum_value,options:s}),v}return P(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return fe.create(e,u(u({},this._def),t))}exclude(e,t=this._def){return fe.create(this.options.filter(s=>!e.includes(s)),u(u({},this._def),t))}}Ne=new WeakMap;fe.create=Xt;class We extends w{constructor(){super(...arguments),Ie.set(this,void 0)}_parse(e){const t=x.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==p.string&&s.parsedType!==p.number){const r=x.objectValues(t);return h(s,{expected:x.joinValues(r),received:s.parsedType,code:l.invalid_type}),v}if(tt(this,Ie)||Ht(this,Ie,new Set(x.getValidEnumValues(this._def.values))),!tt(this,Ie).has(e.data)){const r=x.objectValues(t);return h(s,{received:s.data,code:l.invalid_enum_value,options:r}),v}return P(e.data)}get enum(){return this._def.values}}Ie=new WeakMap;We.create=(n,e)=>new We(u({values:n,typeName:y.ZodNativeEnum},b(e)));class Ae extends w{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.promise&&t.common.async===!1)return h(t,{code:l.invalid_type,expected:p.promise,received:t.parsedType}),v;const s=t.parsedType===p.promise?t.data:Promise.resolve(t.data);return P(s.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}}Ae.create=(n,e)=>new Ae(u({type:n,typeName:y.ZodPromise},b(e)));class G extends w{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===y.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:s}=this._processInputParams(e),r=this._def.effect||null,a={addIssue:i=>{h(s,i),i.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),r.type==="preprocess"){const i=r.transform(s.data,a);if(s.common.async)return Promise.resolve(i).then(o=>F(this,null,function*(){if(t.value==="aborted")return v;const c=yield this._def.schema._parseAsync({data:o,path:s.path,parent:s});return c.status==="aborted"?v:c.status==="dirty"||t.value==="dirty"?ke(c.value):c}));{if(t.value==="aborted")return v;const o=this._def.schema._parseSync({data:i,path:s.path,parent:s});return o.status==="aborted"?v:o.status==="dirty"||t.value==="dirty"?ke(o.value):o}}if(r.type==="refinement"){const i=o=>{const c=r.refinement(o,a);if(s.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(s.common.async===!1){const o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?v:(o.status==="dirty"&&t.dirty(),i(o.value),{status:t.value,value:o.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>o.status==="aborted"?v:(o.status==="dirty"&&t.dirty(),i(o.value).then(()=>({status:t.value,value:o.value}))))}if(r.type==="transform")if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!ye(i))return i;const o=r.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:o}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>ye(i)?Promise.resolve(r.transform(i.value,a)).then(o=>({status:t.value,value:o})):i);x.assertNever(r)}}G.create=(n,e,t)=>new G(u({schema:n,typeName:y.ZodEffects,effect:e},b(t)));G.createWithPreprocess=(n,e,t)=>new G(u({schema:e,effect:{type:"preprocess",transform:n},typeName:y.ZodEffects},b(t)));class ee extends w{_parse(e){return this._getType(e)===p.undefined?P(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ee.create=(n,e)=>new ee(u({innerType:n,typeName:y.ZodOptional},b(e)));class he extends w{_parse(e){return this._getType(e)===p.null?P(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}he.create=(n,e)=>new he(u({innerType:n,typeName:y.ZodNullable},b(e)));class Be extends w{_parse(e){const{ctx:t}=this._processInputParams(e);let s=t.data;return t.parsedType===p.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Be.create=(n,e)=>new Be(u({innerType:n,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default},b(e)));class qe extends w{_parse(e){const{ctx:t}=this._processInputParams(e),s=g(u({},t),{common:g(u({},t.common),{issues:[]})}),r=this._def.innerType._parse({data:s.data,path:s.path,parent:u({},s)});return Me(r)?r.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new U(s.common.issues)},input:s.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new U(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}qe.create=(n,e)=>new qe(u({innerType:n,typeName:y.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},b(e)));class at extends w{_parse(e){if(this._getType(e)!==p.nan){const s=this._getOrReturnCtx(e);return h(s,{code:l.invalid_type,expected:p.nan,received:s.parsedType}),v}return{status:"valid",value:e.data}}}at.create=n=>new at(u({typeName:y.ZodNaN},b(n)));const Xn=Symbol("zod_brand");class Et extends w{_parse(e){const{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ge extends w{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return F(this,null,function*(){const a=yield this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?v:a.status==="dirty"?(t.dirty(),ke(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})});{const r=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return r.status==="aborted"?v:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:s.path,parent:s})}}static create(e,t){return new Ge({in:e,out:t,typeName:y.ZodPipeline})}}class He extends w{_parse(e){const t=this._def.innerType._parse(e),s=r=>(ye(r)&&(r.value=Object.freeze(r.value)),r);return Me(t)?t.then(r=>s(r)):s(t)}unwrap(){return this._def.innerType}}He.create=(n,e)=>new He(u({innerType:n,typeName:y.ZodReadonly},b(e)));function Yt(n,e={},t){return n?Ee.create().superRefine((s,r)=>{var a,i;if(!n(s)){const o=typeof e=="function"?e(s):typeof e=="string"?{message:e}:e,c=(i=(a=o.fatal)!==null&&a!==void 0?a:t)!==null&&i!==void 0?i:!0,d=typeof o=="string"?{message:o}:o;r.addIssue(g(u({code:"custom"},d),{fatal:c}))}}):Ee.create()}const Yn={object:S.lazycreate};var y;(function(n){n.ZodString="ZodString",n.ZodNumber="ZodNumber",n.ZodNaN="ZodNaN",n.ZodBigInt="ZodBigInt",n.ZodBoolean="ZodBoolean",n.ZodDate="ZodDate",n.ZodSymbol="ZodSymbol",n.ZodUndefined="ZodUndefined",n.ZodNull="ZodNull",n.ZodAny="ZodAny",n.ZodUnknown="ZodUnknown",n.ZodNever="ZodNever",n.ZodVoid="ZodVoid",n.ZodArray="ZodArray",n.ZodObject="ZodObject",n.ZodUnion="ZodUnion",n.ZodDiscriminatedUnion="ZodDiscriminatedUnion",n.ZodIntersection="ZodIntersection",n.ZodTuple="ZodTuple",n.ZodRecord="ZodRecord",n.ZodMap="ZodMap",n.ZodSet="ZodSet",n.ZodFunction="ZodFunction",n.ZodLazy="ZodLazy",n.ZodLiteral="ZodLiteral",n.ZodEnum="ZodEnum",n.ZodEffects="ZodEffects",n.ZodNativeEnum="ZodNativeEnum",n.ZodOptional="ZodOptional",n.ZodNullable="ZodNullable",n.ZodDefault="ZodDefault",n.ZodCatch="ZodCatch",n.ZodPromise="ZodPromise",n.ZodBranded="ZodBranded",n.ZodPipeline="ZodPipeline",n.ZodReadonly="ZodReadonly"})(y||(y={}));const Qn=(n,e={message:`Input not instance of ${n.name}`})=>Yt(t=>t instanceof n,e),Qt=H.create,en=de.create,es=at.create,ts=le.create,tn=Pe.create,ns=ve.create,ss=nt.create,rs=$e.create,as=Fe.create,is=Ee.create,os=ge.create,cs=oe.create,us=st.create,ds=J.create,ls=S.create,fs=S.strictCreate,hs=Le.create,ps=it.create,ms=De.create,gs=ne.create,ys=Ve.create,vs=rt.create,_s=_e.create,bs=Te.create,ws=Ue.create,xs=ze.create,ks=fe.create,Ts=We.create,Ss=Ae.create,$t=G.create,Es=ee.create,As=he.create,Os=G.createWithPreprocess,Cs=Ge.create,Ns=()=>Qt().optional(),Is=()=>en().optional(),js=()=>tn().optional(),Rs={string:n=>H.create(g(u({},n),{coerce:!0})),number:n=>de.create(g(u({},n),{coerce:!0})),boolean:n=>Pe.create(g(u({},n),{coerce:!0})),bigint:n=>le.create(g(u({},n),{coerce:!0})),date:n=>ve.create(g(u({},n),{coerce:!0}))},Zs=v;var I=Object.freeze({__proto__:null,defaultErrorMap:Se,setErrorMap:On,getErrorMap:Qe,makeIssue:et,EMPTY_PATH:Cn,addIssueToContext:h,ParseStatus:R,INVALID:v,DIRTY:ke,OK:P,isAborted:pt,isDirty:mt,isValid:ye,isAsync:Me,get util(){return x},get objectUtil(){return ht},ZodParsedType:p,getParsedType:ie,ZodType:w,datetimeRegex:Kt,ZodString:H,ZodNumber:de,ZodBigInt:le,ZodBoolean:Pe,ZodDate:ve,ZodSymbol:nt,ZodUndefined:$e,ZodNull:Fe,ZodAny:Ee,ZodUnknown:ge,ZodNever:oe,ZodVoid:st,ZodArray:J,ZodObject:S,ZodUnion:Le,ZodDiscriminatedUnion:it,ZodIntersection:De,ZodTuple:ne,ZodRecord:Ve,ZodMap:rt,ZodSet:_e,ZodFunction:Te,ZodLazy:Ue,ZodLiteral:ze,ZodEnum:fe,ZodNativeEnum:We,ZodPromise:Ae,ZodEffects:G,ZodTransformer:G,ZodOptional:ee,ZodNullable:he,ZodDefault:Be,ZodCatch:qe,ZodNaN:at,BRAND:Xn,ZodBranded:Et,ZodPipeline:Ge,ZodReadonly:He,custom:Yt,Schema:w,ZodSchema:w,late:Yn,get ZodFirstPartyTypeKind(){return y},coerce:Rs,any:is,array:ds,bigint:ts,boolean:tn,date:ns,discriminatedUnion:ps,effect:$t,enum:ks,function:bs,instanceof:Qn,intersection:ms,lazy:ws,literal:xs,map:vs,nan:es,nativeEnum:Ts,never:cs,null:as,nullable:As,number:en,object:ls,oboolean:js,onumber:Is,optional:Es,ostring:Ns,pipeline:Cs,preprocess:Os,promise:Ss,record:ys,set:_s,strictObject:fs,string:Qt,symbol:ss,transformer:$t,tuple:gs,undefined:rs,union:hs,unknown:os,void:us,NEVER:Zs,ZodIssueCode:l,quotelessJson:An,ZodError:U});const Ms=I.object({language:I.enum(["typescript","javascript"]).optional()}).and(I.union([I.object({framework:I.literal("react"),model:I.string().optional(),styling:I.enum(["plain_css","css_modules","styled_components","tailwind","sass","scss","inline_styles"]),uiLibrary:I.enum(["mui","antd","radix","shadcn"]).optional(),enableUILibraryTheming:I.boolean().optional(),enableCompactStructure:I.boolean().optional(),enableAutoSplit:I.boolean().optional(),autoSplitThreshold:I.number().optional()}),I.object({framework:I.literal("html"),styling:I.enum(["plain_css","inline_styles"]),enableTranslation:I.boolean().optional()})])),nn=n=>{const e=Ms.safeParse(n);if(e.success===!1){const t=new Error("Invalid codegen settings");throw t.cause=e.error,t}return e.data};var z,Je;class Ps{constructor({auth:e,apiBaseAddress:t="https://public-api.animaapp.com"}={}){ot(this,z);ot(this,Je);ct(this,Je,t),e&&(this.auth=e)}hasAuth(){return!!K(this,z)}set auth(e){ct(this,z,e)}get headers(){const e={"Content-Type":"application/json"};return K(this,z)&&(e.Authorization=`Bearer ${K(this,z).token}`,"teamId"in K(this,z)&&(e["X-Team-Id"]=K(this,z).teamId),"userId"in K(this,z)&&K(this,z).userId&&(e["X-User-Id"]=K(this,z).userId)),e}generateCode(s){return F(this,arguments,function*(e,t={}){var f,_,N,A,O,Z,B,se;if(this.hasAuth()===!1)throw new Error('It needs to set "auth" before calling this method.');const r={},a=nn(e.settings),i=yield fetch(`${K(this,Je)}/v1/codegen`,{method:"POST",headers:g(u({},this.headers),{Accept:"text/event-stream"}),body:JSON.stringify({fileKey:e.fileKey,figmaToken:e.figmaToken,nodesId:e.nodesId,assetsStorage:e.assetsStorage,language:a.language,model:a.model,framework:a.framework,styling:a.styling,uiLibrary:a.uiLibrary,enableTranslation:a.enableTranslation,enableUILibraryTheming:a.enableUILibraryTheming,enableCompactStructure:a.enableCompactStructure,enableAutoSplit:a.enableAutoSplit,autoSplitThreshold:a.autoSplitThreshold})});if(!i.ok){let q;try{q=(yield i.json()).message||`HTTP error! status: ${i.status}`}catch($){q=`HTTP error! status: ${i.status}`}throw new we({name:"HTTP Error",reason:q,status:i.status})}if(!i.body)throw new we({name:"Stream Error",reason:"Response body is null",status:i.status});const o=i.body.getReader(),c=new TextDecoder;let d="";try{for(;;){const{done:q,value:$}=yield o.read();if(q)break;d+=c.decode($,{stream:!0});const ce=d.split(`
|
|
2
|
+
`);d=ce.pop()||"";for(const be of ce)if(!(!be.trim()||be.startsWith(":"))&&be.startsWith("data: ")){let k;try{k=JSON.parse(be.slice(6))}catch(C){continue}switch(k.type){case"queueing":{typeof t=="function"?t(k):(f=t.onQueueing)==null||f.call(t);break}case"start":{r.sessionId=k.sessionId,typeof t=="function"?t(k):(_=t.onStart)==null||_.call(t,{sessionId:k.sessionId});break}case"pre_codegen":{typeof t=="function"?t(k):(N=t.onPreCodegen)==null||N.call(t,{message:k.message});break}case"assets_uploaded":{typeof t=="function"?t(k):(A=t.onAssetsUploaded)==null||A.call(t);break}case"assets_list":{r.assets=k.payload.assets,typeof t=="function"?t(k):(O=t.onAssetsList)==null||O.call(t,k.payload);break}case"figma_metadata":{r.figmaFileName=k.figmaFileName,r.figmaSelectedFrameName=k.figmaSelectedFrameName,typeof t=="function"?t(k):(Z=t.onFigmaMetadata)==null||Z.call(t,{figmaFileName:k.figmaFileName,figmaSelectedFrameName:k.figmaSelectedFrameName});break}case"generating_code":{k.payload.status==="success"&&(r.files=k.payload.files),typeof t=="function"?t(k):(B=t.onGeneratingCode)==null||B.call(t,{status:k.payload.status,progress:k.payload.progress,files:k.payload.files});break}case"codegen_completed":{typeof t=="function"?t(k):(se=t.onCodegenCompleted)==null||se.call(t);break}case"error":throw new we({name:k.payload.errorName,reason:k.payload.reason});case"done":{if(!r.files)throw new we({name:"Invalid response",reason:"No files found"});return r.tokenUsage=k.payload.tokenUsage,r}}}}}finally{o.cancel()}throw new we({name:"Connection",reason:"Connection closed before the 'done' message",status:500})})}}z=new WeakMap,Je=new WeakMap;const $s=n=>{var e;if(!n)return[!1,"",""];try{const t=new URL(n),s=t.pathname;if(t.origin!=="https://www.figma.com")return[!1,"",""];const r=((e=t.searchParams.get("node-id"))!=null?e:"").replace(/-/g,":"),a=s.split("/")[2];return[(s.startsWith("/file/")&&t.searchParams.get("type")!=="whiteboard"||s.startsWith("/design/"))&&a.length===22,a,r]}catch(t){return[!1,"",""]}},Fs=({fileKey:n,nodeId:e})=>{const t=new URL("https://www.figma.com");return t.pathname=`design/${n}`,e&&t.searchParams.set("node-id",e.replace(":","-")),t};class Ls extends Error{constructor(e,t){super(e),this.response=t}}const Ds=({files:n,screenPath:e="src/screens"})=>{const t={},s=new Set;function r(a){if(s.has(a)||!n[a])return;s.add(a),t[a]=n[a],Vs(n[a].content).forEach(o=>{try{const c=Us(a,o);if(c.startsWith("src/")){const d=c.split("/").slice(0,-1).join("/");zs(n,d).forEach(_=>{s.has(_)||r(_)})}}catch(c){console.warn(`Failed to resolve import ${o} in ${a}:`,c)}})}return Object.entries(n).forEach(([a,i])=>{a.startsWith(e)?r(a):a.startsWith("src/")||(t[a]=i)}),t};function Vs(n){const e=/import.*?["']([^"']+)["']/g,t=/export.*from\s+["']([^"']+)["']/g,s=[];let r;for(;(r=e.exec(n))!==null;)s.push(r[1]);for(;(r=t.exec(n))!==null;)s.push(r[1]);return[...new Set(s)]}function Us(n,e){if(!e.startsWith("."))return e;const t=n.split("/").slice(0,-1),s=e.split("/"),r=[...t];for(const a of s)a===".."?r.pop():a!=="."&&r.push(a);return r.join("/")}function zs(n,e){return Object.keys(n).filter(t=>t.startsWith(e))}const sn="Figma Token Issue";class rn extends Error{constructor({fileKey:e,reason:t}){super(sn),this.fileKey=e,this.reason=t}}const an="Rate Limit Exceeded";class on extends Error{constructor({fileKey:e}){super(an),this.fileKey=e}}const cn="Not Found";class un extends Error{constructor({fileKey:e}){super(cn),this.fileKey=e}}const dn=n=>n.message===cn,ln="Unknown Figma API Exception";class fn extends Error{constructor({fileKey:e,cause:t}){super(ln),this.name="UnknownFigmaApiException",this.fileKey=e,this.cause=t}}const Ws=n=>n.message===ln,hn=n=>n.message===an,pn=n=>[sn,...["Invalid Figma token","Figma token expired"]].includes(n.message),mn=(n,e)=>{var s,r,a,i;const t=((s=n==null?void 0:n.cause)==null?void 0:s.body)||n.body;throw(t==null?void 0:t.status)===403?new rn({fileKey:e,reason:(((a=(r=n==null?void 0:n.cause)==null?void 0:r.body)==null?void 0:a.reason)||((i=n.body)==null?void 0:i.reason)||"Access denied").toString()}):(t==null?void 0:t.status)===429?new on({fileKey:e}):(t==null?void 0:t.status)===404?new un({fileKey:e}):new fn({fileKey:e,cause:n})},Bs=n=>dn(n)?"NotFound":hn(n)?"RateLimitExceeded":pn(n)?"FigmaTokenIssue":"UnknownFigmaApiException";var qs=Object.defineProperty,Hs=Object.defineProperties,Js=Object.getOwnPropertyDescriptors,Ft=Object.getOwnPropertySymbols,Gs=Object.prototype.hasOwnProperty,Ks=Object.prototype.propertyIsEnumerable,Lt=(n,e)=>(e=Symbol[n])?e:Symbol.for("Symbol."+n),gn=n=>{throw TypeError(n)},Dt=(n,e,t)=>e in n?qs(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,V=(n,e)=>{for(var t in e||(e={}))Gs.call(e,t)&&Dt(n,t,e[t]);if(Ft)for(var t of Ft(e))Ks.call(e,t)&&Dt(n,t,e[t]);return n},At=(n,e)=>Hs(n,Js(e)),Ot=(n,e,t)=>e.has(n)||gn("Cannot "+t),T=(n,e,t)=>(Ot(n,e,"read from private field"),t?t.call(n):e.get(n)),W=(n,e,t)=>e.has(n)?gn("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),j=(n,e,t,s)=>(Ot(n,e,"write to private field"),e.set(n,t),t),Q=(n,e,t)=>(Ot(n,e,"access private method"),t),E=(n,e,t)=>new Promise((s,r)=>{var a=c=>{try{o(t.next(c))}catch(d){r(d)}},i=c=>{try{o(t.throw(c))}catch(d){r(d)}},o=c=>c.done?s(c.value):Promise.resolve(c.value).then(a,i);o((t=t.apply(n,e)).next())}),Xs=(n,e,t)=>(e=n[Lt("asyncIterator")])?e.call(n):(n=n[Lt("iterator")](),e={},t=(s,r)=>(r=n[s])&&(e[s]=a=>new Promise((i,o,c)=>(a=r.call(n,a),c=a.done,Promise.resolve(a.value).then(d=>i({value:d,done:c}),o)))),t("next"),t("return"),e),Ys=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Qs(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var yt={exports:{}},er=yt.exports,Vt;function tr(){return Vt||(Vt=1,function(n,e){(function(t,s){n.exports=s()})(er,function(){var t=typeof Promise=="function",s=typeof self=="object"?self:Ys,r=typeof Symbol!="undefined",a=typeof Map!="undefined",i=typeof Set!="undefined",o=typeof WeakMap!="undefined",c=typeof WeakSet!="undefined",d=typeof DataView!="undefined",f=r&&typeof Symbol.iterator!="undefined",_=r&&typeof Symbol.toStringTag!="undefined",N=i&&typeof Set.prototype.entries=="function",A=a&&typeof Map.prototype.entries=="function",O=N&&Object.getPrototypeOf(new Set().entries()),Z=A&&Object.getPrototypeOf(new Map().entries()),B=f&&typeof Array.prototype[Symbol.iterator]=="function",se=B&&Object.getPrototypeOf([][Symbol.iterator]()),q=f&&typeof String.prototype[Symbol.iterator]=="function",$=q&&Object.getPrototypeOf(""[Symbol.iterator]()),ce=8,be=-1;function k(C){var Nt=typeof C;if(Nt!=="object")return Nt;if(C===null)return"null";if(C===s)return"global";if(Array.isArray(C)&&(_===!1||!(Symbol.toStringTag in C)))return"Array";if(typeof window=="object"&&window!==null){if(typeof window.location=="object"&&C===window.location)return"Location";if(typeof window.document=="object"&&C===window.document)return"Document";if(typeof window.navigator=="object"){if(typeof window.navigator.mimeTypes=="object"&&C===window.navigator.mimeTypes)return"MimeTypeArray";if(typeof window.navigator.plugins=="object"&&C===window.navigator.plugins)return"PluginArray"}if((typeof window.HTMLElement=="function"||typeof window.HTMLElement=="object")&&C instanceof window.HTMLElement){if(C.tagName==="BLOCKQUOTE")return"HTMLQuoteElement";if(C.tagName==="TD")return"HTMLTableDataCellElement";if(C.tagName==="TH")return"HTMLTableHeaderCellElement"}}var It=_&&C[Symbol.toStringTag];if(typeof It=="string")return It;var D=Object.getPrototypeOf(C);return D===RegExp.prototype?"RegExp":D===Date.prototype?"Date":t&&D===Promise.prototype?"Promise":i&&D===Set.prototype?"Set":a&&D===Map.prototype?"Map":c&&D===WeakSet.prototype?"WeakSet":o&&D===WeakMap.prototype?"WeakMap":d&&D===DataView.prototype?"DataView":a&&D===Z?"Map Iterator":i&&D===O?"Set Iterator":B&&D===se?"Array Iterator":q&&D===$?"String Iterator":D===null?"Object":Object.prototype.toString.call(C).slice(ce,be)}return k})}(yt)),yt.exports}var nr=tr();const sr=Qs(nr),Ct=typeof Buffer!="undefined",rr=Ct&&typeof Buffer.from!="undefined",ar=Ct?function(n){return Buffer.isBuffer(n)}:function(){return!1},ir=rr?function(n){return Buffer.from(n)}:Ct?function(n){return new Buffer(n)}:function(n){return n};function Oe(n){return ar(n)?"Buffer":sr(n)}const or=new Set(["Arguments","Array","Map","Object","Set"]);function cr(n,e,t=null){switch(t||Oe(n)){case"Arguments":case"Array":case"Object":return n[e];case"Map":return n.get(e);case"Set":return e}}function vt(n){return or.has(n)}function Ut(n,e,t,s=null){switch(s||Oe(n)){case"Arguments":case"Array":case"Object":n[e]=t;break;case"Map":n.set(e,t);break;case"Set":n.add(t);break}return n}const ur=typeof globalThis!="undefined"&&globalThis!==null&&globalThis.Object===Object&&globalThis,dr=typeof global!="undefined"&&global!==null&&global.Object===Object&&global,lr=typeof self!="undefined"&&self!==null&&self.Object===Object&&self,dt=ur||dr||lr||Function("return this")();function fr(n){return n.slice(0)}function hr(n){return new Boolean(n.valueOf())}function pr(n){return new DataView(n.buffer)}function mr(n){return ir(n)}function gr(n){return new Date(n.getTime())}function yr(n){return new Number(n)}function vr(n){return new RegExp(n.source,n.flags)}function _r(n){return new String(n)}function re(n,e){return dt[e].from?dt[e].from(n):new dt[e](n)}function M(n){return n}function zt(){return[]}function br(){return new Map}function wr(){return{}}function xr(){return new Set}const kr=new Map([["ArrayBuffer",fr],["Boolean",hr],["Buffer",mr],["DataView",pr],["Date",gr],["Number",yr],["RegExp",vr],["String",_r],["Float32Array",re],["Float64Array",re],["Int16Array",re],["Int32Array",re],["Int8Array",re],["Uint16Array",re],["Uint32Array",re],["Uint8Array",re],["Uint8ClampedArray",re],["Array Iterator",M],["Map Iterator",M],["Promise",M],["Set Iterator",M],["String Iterator",M],["function",M],["global",M],["WeakMap",M],["WeakSet",M],["boolean",M],["null",M],["number",M],["string",M],["symbol",M],["undefined",M],["Arguments",zt],["Array",zt],["Map",br],["Object",wr],["Set",xr]]);function Tr(){}function _t(n,e=null,t=Tr){arguments.length===2&&typeof e=="function"&&(t=e,e=null);const s=e||Oe(n),r=kr.get(s);if(s==="Object"){const a=t(n,s);if(a!==void 0)return a}return r?r(n,s):n}function Ce(n,e={}){typeof e=="function"&&(e={customizer:e});const{customizer:t}=e,s=Oe(n);if(!vt(s))return bt(n,null,null,null);const r=_t(n,s,t),a=new WeakMap([[n,r]]),i=new WeakSet([n]);return bt(n,r,a,i)}function bt(n,e,t,s,r){const a=Oe(n),i=_t(n,a);if(!vt(a))return i;let o;switch(a){case"Arguments":case"Array":o=Object.keys(n);break;case"Object":o=Object.keys(n),o.push(...Object.getOwnPropertySymbols(n));break;case"Map":case"Set":o=n.keys();break}for(let c of o){const d=cr(n,c,a);if(s.has(d))Ut(e,c,t.get(d),a);else{const f=Oe(d),_=_t(d,f);vt(f)&&(t.set(d,_),s.add(d)),Ut(e,c,bt(d,_,t,s),a)}}return e}const Sr=n=>new Promise(e=>setTimeout(e,n));var Ke,pe,Xe,wt,yn;class Er{constructor({maxAttempts:e=3,func:t}){W(this,wt),W(this,Ke),W(this,pe),W(this,Xe),j(this,Ke,e),j(this,Xe,t),j(this,pe,0)}run(){return E(this,null,function*(){try{return yield T(this,Xe).call(this)}catch(e){if(j(this,pe,T(this,pe)+1),T(this,pe)>T(this,Ke))throw console.error("Max attempts reached"),e;const t=Q(this,wt,yn).call(this);return yield Sr(t),yield this.run()}})}}Ke=new WeakMap,pe=new WeakMap,Xe=new WeakMap,wt=new WeakSet,yn=function(){return T(this,pe)*1e3*1.5};function Ar(){return typeof CompressionStream!="undefined"}function Or(n){return E(this,null,function*(){const e=new Blob([n]).stream().pipeThrough(new CompressionStream("gzip")),t=[];try{for(var s=Xs(e),r,a,i;r=!(a=yield s.next()).done;r=!1){const o=a.value;t.push(o)}}catch(o){i=[o]}finally{try{r&&(a=s.return)&&(yield a.call(s))}finally{if(i)throw i[0]}}return yield Cr(t)})}function Cr(n){return E(this,null,function*(){const e=yield new Blob(n).arrayBuffer();return new Uint8Array(e)})}class Nr extends Error{constructor({resource:e,api:t,args:s,cause:r}){if(super(`API Error on resource "${e}" at api "${t}"`),this.causeProperties={},this.name="API Error",this.resource=e,this.api=t,this.cause=r,this.args=s,r instanceof Error)for(const[i,o]of Object.entries(r))if(typeof Headers!="undefined"&&o instanceof Headers){const c={};o.forEach((d,f)=>{c[f]=d}),this.causeProperties[i]=c}else this.causeProperties[i]=o;const a=this.causeProperties.body;a&&typeof a=="object"&&"code"in a&&(this.code=a.code)}}class Wt extends Error{constructor({url:e,method:t,statusCode:s,requestHeaders:r,responseHeaders:a,body:i}){if(super("Fetch Error"),this.name="Fetch Error",this.url=e,this.method=t,this.statusNumber=s,this.requestHeaders=r,this.responseHeaders=a,i)try{const o=JSON.parse(i);this.body=o}catch(o){this.body=i}}}class je extends Error{constructor(e={}){const{canceled:t=!1}=e;super("Abort Error"),this.name="Abort Error",this.canceled=t}}class Ir extends Error{constructor(e){super(`Async API Error: ${JSON.stringify(e)}`),this.name="Async API Error",this.body=e}}class lt extends Error{constructor(e){super(e),this.name="Request Validation Error"}}function vn(){return Array.from({length:32},()=>Math.floor(Math.random()*256).toString(16).padStart(2,"0")).join("")}function xt(){return Math.floor(Date.now()/1e3).toString()}const jr=5*60*1e3,Rr=1*1e3;var me,L,X,kt,Tt,Re;class Zr{constructor({fetch:e=globalThis.fetch.bind(globalThis),baseAddress:t}){W(this,X),W(this,me),W(this,L),this.baseAddress=t,j(this,me,e),j(this,L,{}),this.plugins=[]}get headers(){throw new Error("Missing implementation")}addPlugin(e){this.plugins.push(e)}removePlugin(e){this.plugins=this.plugins.filter(t=>t.name!==e)}withOptions(e={}){return j(this,L,e),this}get(e){return E(this,arguments,function*(t,s={}){const{overrideBaseAddress:r,overrideDefaultHeaders:a}=s,i=r!=null?r:this.baseAddress;let o=a!=null?a:this.headers;const c=Ce(T(this,L));return j(this,L,{}),c.extraHeaders&&(o=V(V({},o),c.extraHeaders)),c.requestValidation&&(o=At(V({},o),{"X-Request-Nonce":vn(),"X-Request-Timestamp":xt()})),c.async?yield Q(this,X,Tt).call(this,`${i}${t}`,c.async,{headers:o}):yield Q(this,X,kt).call(this,`${i}${t}`,c,{headers:o})})}post(e,t){return E(this,arguments,function*(s,r,a={}){const i=Ce(T(this,L));return j(this,L,{}),Q(this,X,Re).call(this,s,"POST",r,a,i)})}put(e,t){return E(this,arguments,function*(s,r,a={}){const i=Ce(T(this,L));return j(this,L,{}),Q(this,X,Re).call(this,s,"PUT",r,a,i)})}delete(e,t){return E(this,arguments,function*(s,r,a={}){const i=Ce(T(this,L));return j(this,L,{}),Q(this,X,Re).call(this,s,"DELETE",r,a,i)})}patch(e,t){return E(this,arguments,function*(s,r,a={}){const i=Ce(T(this,L));return j(this,L,{}),Q(this,X,Re).call(this,s,"PATCH",r,a,i)})}}me=new WeakMap,L=new WeakMap,X=new WeakSet,kt=function(n,e,t){return E(this,null,function*(){const s=()=>E(this,null,function*(){var c,d;try{return yield T(this,me).call(this,n,V(V({},t),e.abortSignal&&{signal:e.abortSignal}))}catch(f){throw f instanceof Error&&f.name==="AbortError"?new je({canceled:(d=(c=e.abortSignal)==null?void 0:c.aborted)!=null?d:!1}):f}}),{headers:r}=t!=null?t:{},a=(c,d)=>{var f,_;return((f=c==null?void 0:c.headers)==null?void 0:f.get(d))||((_=c==null?void 0:c.headersObject)==null?void 0:_[d])||""},i=c=>E(this,null,function*(){var d;if(!c.ok){const _=yield c.text().catch();throw new Wt({url:n,method:(d=t==null?void 0:t.method)!=null?d:"GET",statusCode:c.status,requestHeaders:r,responseHeaders:c.headers,body:_})}if(e.requestValidation&&process.env.UI_TESTS!==!0)try{const _=a(c,"x-response-nonce"),N=r==null?void 0:r["X-Request-Nonce"];if(!_||_!==N)throw new lt("Response nonce mismatch");const A=Number(a(c,"x-response-timestamp")),O=Number(xt()),Z=60*60*24;if(isNaN(A)||Math.abs(O-A)>Z)throw new lt("Invalid response timestamp")}catch(_){const N=_ instanceof Error?_.message:"Request validation failed";throw new lt(N)}let f=yield c.text();try{f=JSON.parse(f)}catch(_){}return f});if(e.retry){const c=yield new Er({maxAttempts:e.retry,func:s}).run();return yield i(c)}const o=yield s();return yield i(o)})},Tt=function(n,e,t){return E(this,null,function*(){var s,r;const{onProgress:a,abortSignal:i,pollingInterval:o=()=>Rr,maxTimeout:c=jr}=e,d=`${n}/async`,f=`${n}/async/job`;let _;try{_=yield T(this,me).call(this,d,V(V({},t),i&&{signal:i}))}catch(O){throw O instanceof Error&&O.name==="AbortError"?new je({canceled:(s=i==null?void 0:i.aborted)!=null?s:!1}):O}if(!_.ok){const O=yield _.text().catch();throw new Wt({url:n,method:(r=t==null?void 0:t.method)!=null?r:"GET",statusCode:_.status,requestHeaders:this.headers,responseHeaders:_.headers,body:O})}const N=yield _.json(),{job_id:A}=N;if(!A)throw new Error("Job ID not found in response");return new Promise((O,Z)=>E(this,null,function*(){const B=setTimeout(()=>{Z(new Error("Job timed out"))},c),se=(q=0)=>E(this,null,function*(){if(i!=null&&i.aborted){clearTimeout(B),T(this,me).call(this,`${f}/${A}/cancel`,{method:"POST",headers:this.headers}).then(()=>{Z(new je({canceled:!0}))}).catch($=>{Z(new je({canceled:!1}))});return}try{const $=yield(yield T(this,me).call(this,`${f}/${A}`,{headers:this.headers})).json();if($.status==="success"){clearTimeout(B);const ce=$.response_json;O(ce)}else if($.status==="failed")clearTimeout(B),Z(new Ir($.response_json));else{a&&a($.response_json);const ce=o(q);setTimeout(()=>se(q+1),ce)}}catch($){Z($)}});se()}))})},Re=function(n,e,t,s,r){return E(this,null,function*(){const{overrideBaseAddress:a,overrideDefaultHeaders:i}=s,o=a!=null?a:this.baseAddress;let c=i!=null?i:this.headers;r.extraHeaders&&(c=V(V({},c),r.extraHeaders)),r.requestValidation&&(c=At(V({},c),{"X-Request-Nonce":vn(),"X-Request-Timestamp":xt()}));let d=s.skipBodyJsonStringify?t:JSON.stringify(t);return r.compress&&Ar()&&(c["Content-Encoding"]="gzip",d=yield Or(d)),r.async?yield Q(this,X,Tt).call(this,`${o}${n}`,r.async,{method:e,headers:c,body:d}):yield Q(this,X,kt).call(this,`${o}${n}`,r,{method:e,headers:c,body:d})})};const Bt=(n,e,t,s)=>n instanceof je?n:new Nr({resource:e,api:String(t),args:s,cause:n}),ft=(n,e)=>new Proxy(e,{get(t,s){return(...r)=>{var a;for(const o of n.plugins){const c=(a=o.beforeApi)==null?void 0:a.call(o,{resource:t.resourceName,api:s,args:r});if(c!==void 0)return c}let i;try{i=t[s](...r)}catch(o){throw Bt(o,t.resourceName,s,r)}return i instanceof Promise?i.catch(o=>{throw Bt(o,t.resourceName,s,r)}):i}}});var Ze;class Mr{constructor(e){W(this,Ze),this.resourceName="Files",j(this,Ze,e)}get(e){return E(this,arguments,function*({fileKey:t,params:s={}}){const r=new URLSearchParams(V({plugin_data:"857346721138427857"},s)).toString(),a=`v1/files/${t}?${r}`;return yield T(this,Ze).get(a)})}getImageFills(e){return E(this,arguments,function*({fileKey:t}){var s,r;const a=`v1/files/${t}/images`;return(r=(s=(yield T(this,Ze).get(a)).meta)==null?void 0:s.images)!=null?r:{}})}}Ze=new WeakMap;const Pr=(n,e,t)=>{const s=e.sort();return`${n}-${s.join("-")}-${t}`},$r=n=>n?n.ts>Date.now()-1e3*30:!1;var Y,St,_n;class Fr{constructor(e){W(this,St),W(this,Y),this.resourceName="Images",j(this,Y,e)}get(e){return E(this,arguments,function*({fileKey:t,nodeIds:s,format:r="jpg",scale:a}){const i=Pr(t,s,r),o=T(this,Y).cache.images.entries.get(i);if($r(o))return o.result;o&&T(this,Y).cache.images.entries.delete(i);const c=T(this,Y).cache.images.pendingRequests.get(i);if(c)return c;const d=Q(this,St,_n).call(this,i,t,s,r,a);T(this,Y).cache.images.pendingRequests.set(i,d);try{return yield d}finally{T(this,Y).cache.images.pendingRequests.delete(i)}})}}Y=new WeakMap,St=new WeakSet,_n=function(n,e,t,s,r){return E(this,null,function*(){const a=yield T(this,Y).get(`v1/images/${e}?ids=${t}&format=${s}${r?`&scale=${r}`:""}`);return T(this,Y).cache.images.entries.set(n,{result:a,ts:Date.now()}),a})};var Ye;class Lr{constructor(e){W(this,Ye),this.resourceName="Nodes",j(this,Ye,e)}get(e){return E(this,arguments,function*({fileKey:t,nodeIds:s,params:r={}}){const a=At(V({},r),{ids:s.join(",")}),i=new URLSearchParams(V({plugin_data:"857346721138427857"},a)).toString(),o=`v1/files/${t}/nodes?${i}`;return yield T(this,Ye).get(o)})}}Ye=new WeakMap;var ue;class bn extends Zr{constructor({baseAddress:e="https://api.figma.com/",fetch:t=globalThis.fetch.bind(globalThis)}={}){super({fetch:t,baseAddress:e}),W(this,ue,""),this.cache={images:{entries:new Map,pendingRequests:new Map}},this.files=ft(this,new Mr(this)),this.nodes=ft(this,new Lr(this)),this.images=ft(this,new Fr(this))}set token(e){if(!e.startsWith("figd_")&&!e.startsWith("figu_"))throw new Error("Invalid Figma access token");j(this,ue,e)}get token(){return T(this,ue)}get headers(){const e={"Content-Type":"application/json"};return T(this,ue).startsWith("figd_")?e["X-FIGMA-TOKEN"]=T(this,ue):T(this,ue).startsWith("figu_")&&(e.Authorization=`Bearer ${T(this,ue)}`),e}}ue=new WeakMap;const Dr=r=>F(exports,[r],function*({fileKey:n,authToken:e,figmaRestApi:t=new bn,params:s={}}){e&&(t.token=e);try{return yield t.files.get({fileKey:n,params:s})}catch(a){throw console.error(a),a}}),Vr=a=>F(exports,[a],function*({fileKey:n,authToken:e,nodeIds:t,figmaRestApi:s=new bn,params:r={}}){e&&(s.token=e);try{return(yield s.nodes.get({fileKey:n,nodeIds:t,params:u({},r)})).nodes}catch(i){return mn(i,n)}}),wn=(n,e)=>new ReadableStream({start(t){n.generateCode(e,s=>{s.type==="error"?(console.log("NOT SURE IF THIS IS REACHABLE, ALL ERRORS ARE THROWING"),t.enqueue({type:"error",payload:{message:s.payload.reason}})):t.enqueue(s),(s.type==="aborted"||s.type==="error")&&t.close()}).then(s=>{t.enqueue({type:"done",payload:{tokenUsage:s.tokenUsage,sessionId:s.sessionId}}),t.close()}).catch(s=>{t.enqueue({type:"error",payload:{message:"message"in s?s.message:"Unknown",status:"status"in s?s.status:void 0}}),t.close()})}}),Ur=(n,e)=>F(exports,null,function*(){var c,d,f,_,N,A,O;const t=wn(n,e),[s,r]=t.tee(),a=yield s.getReader().read();if(a.done||!a.value||((c=a.value)==null?void 0:c.type)==="error"&&((f=(d=a.value)==null?void 0:d.payload)!=null&&f.status))return new Response(JSON.stringify(a.value),{status:((_=a.value)==null?void 0:_.type)==="error"&&(O=(A=(N=a.value)==null?void 0:N.payload)==null?void 0:A.status)!=null?O:500,headers:{"Content-Type":"application/json"}});const i=new TextEncoder,o=r.pipeThrough(new TransformStream({transform(Z,B){const se=`event: ${Z.type}
|
|
3
3
|
data: ${JSON.stringify(Z)}
|
|
4
4
|
|
|
5
|
-
`;
|
|
5
|
+
`;B.enqueue(i.encode(se))}}));return new Response(o,{status:200,headers:{"Content-Type":"text/event-stream; charset=utf-8",Connection:"keep-alive","Cache-Control":"no-cache"}})});exports.Anima=Ps;exports.CodegenError=we;exports.FigmaTokenIssue=rn;exports.NotFound=un;exports.RateLimitExceeded=on;exports.ResponseError=Ls;exports.UnknownFigmaApiException=fn;exports.createCodegenResponseEventStream=Ur;exports.createCodegenStream=wn;exports.formatToFigmaLink=Fs;exports.getFigmaApiErrorType=Bs;exports.getFigmaFile=Dr;exports.getFileNodes=Vr;exports.getRelatedScreenFiles=Ds;exports.handleFigmaApiError=mn;exports.isFigmaTokenIssue=pn;exports.isNotFound=dn;exports.isRateLimitExceeded=hn;exports.isUnknownFigmaApiException=Ws;exports.isValidFigmaUrl=$s;exports.validateSettings=nn;
|
|
6
6
|
//# sourceMappingURL=index.cjs.map
|