@animaapp/anima-sdk 0.2.0 → 0.2.2
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 +6 -14
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +40 -10
- package/dist/index.js +625 -566
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/anima.ts +5 -11
- package/src/dataStream.ts +7 -2
- package/src/figma/figmaError.ts +7 -2
- package/src/figma/utils.ts +4 -4
- package/src/index.ts +0 -1
- package/src/settings.ts +4 -2
- package/src/types.ts +43 -36
- package/src/{utils.ts → utils/figma.ts} +1 -1
- package/src/utils/files.ts +95 -0
- package/src/utils/index.ts +2 -0
- package/src/codegenToAnimaFiles.ts +0 -13
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Debugger attached.
|
|
5
|
-
Debugger listening on ws://127.0.0.1:65254/7860af3a-eefb-4792-a26b-062cc29764e2
|
|
6
|
-
For help, see: https://nodejs.org/en/docs/inspector
|
|
7
|
-
Debugger attached.
|
|
8
|
-
[36mvite v6.0.11 [32mbuilding for production...[36m[39m
|
|
9
|
-
[2K[1Gtransforming (1) [2msrc/index.ts[22m[2K[1G[32m✓[39m 13 modules transformed.
|
|
2
|
+
[36mvite v6.0.11 [32mbuilding for production...[36m[39m
|
|
3
|
+
[2K[1Gtransforming (1) [2msrc/index.ts[22m[2K[1G[32m✓[39m 14 modules transformed.
|
|
10
4
|
[2K[1Grendering chunks (1)...[2K[1G[32m
|
|
11
5
|
[36m[vite:dts][32m Start generate declaration files...[39m
|
|
12
|
-
[2K[1Gcomputing gzip size (0)...[2K[1Gcomputing gzip size (1)...[2K[1G[2mdist/[22m[36mindex.cjs [39m[1m[
|
|
6
|
+
[2K[1Gcomputing gzip size (0)...[2K[1Gcomputing gzip size (1)...[2K[1G[2mdist/[22m[36mindex.cjs [39m[1m[2m87.52 kB[22m[1m[22m[2m │ gzip: 23.50 kB[22m[2m │ map: 323.50 kB[22m
|
|
13
7
|
[32m[36m[vite:dts][32m Start rollup declaration files...[39m
|
|
14
8
|
Analysis will use the bundled TypeScript version 5.7.2
|
|
15
|
-
[32m[36m[vite:dts][32m Declaration files built in
|
|
9
|
+
[32m[36m[vite:dts][32m Declaration files built in 1505ms.
|
|
16
10
|
[39m
|
|
17
|
-
[2K[1Grendering chunks (1)...[2K[1G[2K[1Gcomputing gzip size (1)...[2K[1G[2mdist/[22m[36mindex.js [39m[1m[
|
|
18
|
-
[32m✓ built in
|
|
19
|
-
Waiting for the debugger to disconnect...
|
|
20
|
-
Waiting for the debugger to disconnect...
|
|
11
|
+
[2K[1Grendering chunks (1)...[2K[1G[2K[1Gcomputing gzip size (1)...[2K[1G[2mdist/[22m[36mindex.js [39m[1m[2m124.59 kB[22m[1m[22m[2m │ gzip: 28.22 kB[22m[2m │ map: 337.45 kB[22m
|
|
12
|
+
[32m✓ built in 1.76s[39m
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";var kn=Object.defineProperty,Tn=Object.defineProperties;var Sn=Object.getOwnPropertyDescriptors;var It=Object.getOwnPropertySymbols;var En=Object.prototype.hasOwnProperty,An=Object.prototype.propertyIsEnumerable;var Zt=n=>{throw TypeError(n)};var Rt=(n,e,t)=>e in n?kn(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,d=(n,e)=>{for(var t in e||(e={}))En.call(e,t)&&Rt(n,t,e[t]);if(It)for(var t of It(e))An.call(e,t)&&Rt(n,t,e[t]);return n},g=(n,e)=>Tn(n,Sn(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)),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 P=(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"});const qt=n=>Object.entries(n).reduce((e,[t,s])=>(e[t]={content:s.code,isBinary:!1},e),{});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 ht;(function(n){n.mergeShapes=(e,t)=>d(d({},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"]),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"]),On=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 Ht=Te;function Cn(n){Ht=n}function Qe(){return Ht}const et=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})},Nn=[];function f(n,e){const t=Qe(),s=et({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 I{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 P(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 I.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}),M=n=>({status:"valid",value:n}),pt=n=>n.status==="aborted",mt=n=>n.status==="dirty",ye=n=>n.status==="valid",Ze=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 Jt(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:h}=n;return i.code==="invalid_enum_value"?{message:h!=null?h:o.defaultError}:typeof o.data=="undefined"?{message:(c=h!=null?h:s)!==null&&c!==void 0?c:o.defaultError}:i.code!=="invalid_type"?{message:o.defaultError}:{message:(u=h!=null?h: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 I,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 P(this,null,function*(){const s=yield this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error})}safeParseAsync(e,t){return P(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 Be(g(d({},b(this._def)),{innerType:this,defaultValue:t,typeName:y.ZodDefault}))}brand(){return new Et(d({typeName:y.ZodBranded,type:this},b(this._def)))}catch(e){const t=typeof e=="function"?e:()=>e;return new We(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 jn=/^c[^\s-]{8,}$/i,In=/^[0-9a-z]+$/,Rn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Zn=/^[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,Mn=/^[a-z0-9_-]{21}$/i,Pn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,$n=/^[-+]?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)?)??$/,Fn=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Ln="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let dt;const Vn=/^(?:(?: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])$/,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]))$/,zn=/^(([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])$/,Bn=/^([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}(=)?))?$/,Gt="((\\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])))",qn=new RegExp(`^${Gt}$`);function Kt(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 Hn(n){return new RegExp(`^${Kt(n)}$`)}function Xt(n){let e=`${Gt}T${Kt(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 Jn(n,e){return!!((e==="v4"||!e)&&Vn.test(n)||(e==="v6"||!e)&&Un.test(n))}function Gn(n,e){if(!Pn.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 Kn(n,e){return!!((e==="v4"||!e)&&Dn.test(n)||(e==="v6"||!e)&&zn.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 f(a,{code:l.invalid_type,expected:p.string,received:a.parsedType}),v}const s=new I;let r;for(const a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(r=this._getOrReturnCtx(e,r),f(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),f(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?f(r,{code:l.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):o&&f(r,{code:l.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")Fn.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"email",code:l.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")dt||(dt=new RegExp(Ln,"u")),dt.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"emoji",code:l.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")Zn.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"uuid",code:l.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")Mn.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"nanoid",code:l.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")jn.test(e.data)||(r=this._getOrReturnCtx(e,r),f(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),f(r,{validation:"cuid2",code:l.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")Rn.test(e.data)||(r=this._getOrReturnCtx(e,r),f(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),f(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),f(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),f(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),f(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),f(r,{code:l.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?Xt(a).test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{code:l.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?qn.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{code:l.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?Hn(a).test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{code:l.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?$n.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"duration",code:l.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?Jn(e.data,a.version)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"ip",code:l.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?Gn(e.data,a.alg)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"jwt",code:l.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?Kn(e.data,a.version)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"cidr",code:l.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?Bn.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"base64",code:l.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?Wn.test(e.data)||(r=this._getOrReturnCtx(e,r),f(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 Xn(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 f(a,{code:l.invalid_type,expected:p.number,received:a.parsedType}),v}let s;const r=new I;for(const a of this._def.checks)a.kind==="int"?x.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),f(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),f(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),f(s,{code:l.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),r.dirty()):a.kind==="multipleOf"?Xn(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),f(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),f(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 I;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),f(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),f(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),f(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 f(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 f(s,{code:l.invalid_type,expected:p.boolean,received:s.parsedType}),v}return M(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 f(a,{code:l.invalid_type,expected:p.date,received:a.parsedType}),v}if(isNaN(e.data.getTime())){const a=this._getOrReturnCtx(e);return f(a,{code:l.invalid_date}),v}const s=new I;let r;for(const a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(r=this._getOrReturnCtx(e,r),f(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),f(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 nt extends w{_parse(e){if(this._getType(e)!==p.symbol){const s=this._getOrReturnCtx(e);return f(s,{code:l.invalid_type,expected:p.symbol,received:s.parsedType}),v}return M(e.data)}}nt.create=n=>new nt(d({typeName:y.ZodSymbol},b(n)));class Pe extends w{_parse(e){if(this._getType(e)!==p.undefined){const s=this._getOrReturnCtx(e);return f(s,{code:l.invalid_type,expected:p.undefined,received:s.parsedType}),v}return M(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 f(s,{code:l.invalid_type,expected:p.null,received:s.parsedType}),v}return M(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 M(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 M(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 f(t,{code:l.invalid_type,expected:p.never,received:t.parsedType}),v}}ce.create=n=>new ce(d({typeName:y.ZodNever},b(n)));class st extends w{_parse(e){if(this._getType(e)!==p.undefined){const s=this._getOrReturnCtx(e);return f(s,{code:l.invalid_type,expected:p.void,received:s.parsedType}),v}return M(e.data)}}st.create=n=>new st(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 f(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)&&(f(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&&(f(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&&(f(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=>I.mergeArray(s,i));const a=[...t.data].map((i,o)=>r.type._parseSync(new ne(t,i,t.path,o)));return I.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 f(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 h=a[u],_=r.data[u];c.push({key:{status:"valid",value:u},value:h._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 h of o)c.push({key:{status:"valid",value:h},value:{status:"valid",value:r.data[h]}});else if(u==="strict")o.length>0&&(f(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 h of o){const _=r.data[h];c.push({key:{status:"valid",value:h},value:u._parse(new ne(r,_,r.path,h)),alwaysSet:h in r.data})}}return r.common.async?Promise.resolve().then(()=>P(this,null,function*(){const u=[];for(const h of c){const _=yield h.key,N=yield h.value;u.push({key:_,value:N,alwaysSet:h.alwaysSet})}return u})).then(u=>I.mergeObjectSync(s,u)):I.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 Yt(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 f(t,{code:l.invalid_union,unionErrors:i}),v}if(t.common.async)return Promise.all(s.map(a=>P(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}),h=c._parseSync({data:t.data,path:t.path,parent:u});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,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 f(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 De?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 Be?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 Et||n instanceof qe?ie(n.unwrap()):n instanceof We?ie(n._def.innerType):[];class it extends w{_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==p.object)return f(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}):(f(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 it(d({typeName:y.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:r},b(s)))}}function gt(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=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 Le 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}):(f(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 f(s,{code:l.invalid_type,expected:p.array,received:s.parsedType}),v;if(s.data.length<this._def.items.length)return f(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&&(f(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=>I.mergeArray(t,i)):I.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 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 f(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?I.mergeObjectAsync(t,r):I.mergeObjectSync(t,r)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof w?new Ve(d({keyType:e,valueType:t,typeName:y.ZodRecord},b(s))):new Ve(d({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 f(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(()=>P(this,null,function*(){for(const c of i){const u=yield c.key,h=yield c.value;if(u.status==="aborted"||h.status==="aborted")return v;(u.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(u.value,h.value)}return{status:t.value,value:o}}))}else{const o=new Map;for(const c of i){const u=c.key,h=c.value;if(u.status==="aborted"||h.status==="aborted")return v;(u.status==="dirty"||h.status==="dirty")&&t.dirty(),o.set(u.value,h.value)}return{status:t.value,value:o}}}}rt.create=(n,e,t)=>new rt(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 f(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&&(f(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&&(f(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 h of c){if(h.status==="aborted")return v;h.status==="dirty"&&t.dirty(),u.add(h.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 f(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(),Te].filter(u=>!!u),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(),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 M(function(...c){return P(this,null,function*(){const u=new U([]),h=yield o._def.args.parseAsync(c,a).catch(O=>{throw u.addIssue(s(c,O)),u}),_=yield Reflect.apply(i,this,h);return yield o._def.returns._def.type.parseAsync(_,a).catch(O=>{throw u.addIssue(r(_,O)),u})})})}else{const o=this;return M(function(...c){const u=o._def.args.safeParse(c,a);if(!u.success)throw new U([s(c,u.error)]);const h=Reflect.apply(i,this,u.data),_=o._def.returns.safeParse(h,a);if(!_.success)throw new U([r(h,_.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 De 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})}}De.create=(n,e)=>new De(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 f(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 Yt(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 f(t,{expected:x.joinValues(s),received:t.parsedType,code:l.invalid_type}),v}if(tt(this,Ce)||Jt(this,Ce,new Set(this._def.values)),!tt(this,Ce).has(e.data)){const t=this._getOrReturnCtx(e),s=this._def.values;return f(t,{received:t.data,code:l.invalid_enum_value,options:s}),v}return M(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=Yt;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 f(s,{expected:x.joinValues(r),received:s.parsedType,code:l.invalid_type}),v}if(tt(this,Ne)||Jt(this,Ne,new Set(x.getValidEnumValues(this._def.values))),!tt(this,Ne).has(e.data)){const r=x.objectValues(t);return f(s,{received:s.data,code:l.invalid_enum_value,options:r}),v}return M(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 f(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 M(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=>{f(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=>P(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?M(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?M(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 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(d({innerType:n,typeName:y.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default},b(e)));class We 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}}We.create=(n,e)=>new We(d({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 f(s,{code:l.invalid_type,expected:p.nan,received:s.parsedType}),v}return{status:"valid",value:e.data}}}at.create=n=>new at(d({typeName:y.ZodNaN},b(n)));const Yn=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 Je extends w{_parse(e){const{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return P(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 Qt(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 Qn={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 es=(n,e={message:`Input not instance of ${n.name}`})=>Qt(t=>t instanceof n,e),en=H.create,tn=ue.create,ts=at.create,ns=le.create,nn=Me.create,ss=ve.create,rs=nt.create,as=Pe.create,is=$e.create,os=Se.create,cs=ge.create,ds=ce.create,us=st.create,ls=J.create,fs=S.create,hs=S.strictCreate,ps=Fe.create,ms=it.create,gs=Le.create,ys=se.create,vs=Ve.create,_s=rt.create,bs=_e.create,ws=ke.create,xs=De.create,ks=Ue.create,Ts=fe.create,Ss=ze.create,Es=Ee.create,$t=G.create,As=te.create,Os=he.create,Cs=G.createWithPreprocess,Ns=Je.create,js=()=>en().optional(),Is=()=>tn().optional(),Rs=()=>nn().optional(),Zs={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}))},Ms=v;var V=Object.freeze({__proto__:null,defaultErrorMap:Te,setErrorMap:Cn,getErrorMap:Qe,makeIssue:et,EMPTY_PATH:Nn,addIssueToContext:f,ParseStatus:I,INVALID:v,DIRTY:xe,OK:M,isAborted:pt,isDirty:mt,isValid:ye,isAsync:Ze,get util(){return x},get objectUtil(){return ht},ZodParsedType:p,getParsedType:oe,ZodType:w,datetimeRegex:Xt,ZodString:H,ZodNumber:ue,ZodBigInt:le,ZodBoolean:Me,ZodDate:ve,ZodSymbol:nt,ZodUndefined:Pe,ZodNull:$e,ZodAny:Se,ZodUnknown:ge,ZodNever:ce,ZodVoid:st,ZodArray:J,ZodObject:S,ZodUnion:Fe,ZodDiscriminatedUnion:it,ZodIntersection:Le,ZodTuple:se,ZodRecord:Ve,ZodMap:rt,ZodSet:_e,ZodFunction:ke,ZodLazy:De,ZodLiteral:Ue,ZodEnum:fe,ZodNativeEnum:ze,ZodPromise:Ee,ZodEffects:G,ZodTransformer:G,ZodOptional:te,ZodNullable:he,ZodDefault:Be,ZodCatch:We,ZodNaN:at,BRAND:Yn,ZodBranded:Et,ZodPipeline:Je,ZodReadonly:qe,custom:Qt,Schema:w,ZodSchema:w,late:Qn,get ZodFirstPartyTypeKind(){return y},coerce:Zs,any:os,array:ls,bigint:ns,boolean:nn,date:ss,discriminatedUnion:ms,effect:$t,enum:Ts,function:ws,instanceof:es,intersection:gs,lazy:xs,literal:ks,map:_s,nan:ts,nativeEnum:Ss,never:ds,null:is,nullable:Os,number:tn,object:fs,oboolean:Rs,onumber:Is,optional:As,ostring:js,pipeline:Ns,preprocess:Cs,promise:Es,record:vs,set:bs,strictObject:hs,string:en,symbol:rs,transformer:$t,tuple:ys,undefined:as,union:ps,unknown:cs,void:us,NEVER:Ms,ZodIssueCode:l,quotelessJson:On,ZodError:U});const Ps=V.object({language:V.enum(["typescript","javascript"]).optional()}).and(V.union([V.object({framework:V.literal("react"),model:V.string().optional(),styling:V.enum(["plain_css","css_modules","styled_components","tailwind","sass","scss","inline_styles"]),uiLibrary:V.enum(["mui","antd","radix","shadcn"]).optional(),enableUILibraryTheming:V.boolean().optional()}),V.object({framework:V.literal("html"),styling:V.enum(["plain_css","inline_styles"]),enableTranslation:V.boolean().optional()})])),sn=n=>{const e=Ps.safeParse(n);if(e.success===!1){const t=new Error("Invalid codegen settings");throw t.cause=e.error,t}return e.data};var B,He;class $s{constructor({auth:e,apiBaseAddress:t="https://public-api.animaapp.com"}={}){ot(this,B);ot(this,He);ct(this,He,t),e&&(this.auth=e)}hasAuth(){return!!X(this,B)}set auth(e){ct(this,B,e)}get headers(){const e={"Content-Type":"application/json"};return X(this,B)&&(e.Authorization=`Bearer ${X(this,B).token}`,"teamId"in X(this,B)&&(e["X-Team-Id"]=X(this,B).teamId),"userId"in X(this,B)&&X(this,B).userId&&(e["X-User-Id"]=X(this,B).userId)),e}generateCode(s){return P(this,arguments,function*(e,t={}){var h,_,N,O,C,R,q;if(this.hasAuth()===!1)throw new Error('It needs to set "auth" before calling this method.');const r={},a=sn(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})});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 F=u.split(`
|
|
2
|
-
`);u=F.pop()||"";for(const K of F)if(!(!K.trim()||K.startsWith(":"))&&K.startsWith("data: ")){let T;try{T=JSON.parse(K.slice(6))}catch(Ge){continue}switch(T.type){case"start":{r.sessionId=T.sessionId,typeof t=="function"?t(T):(h=t.onStart)==null||h.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):(N=t.onAssetsUploaded)==null||N.call(t);break}case"assets_list":{r.assets=T.payload.assets,typeof t=="function"?t(T):(O=t.onAssetsList)==null||O.call(t,T.payload);break}case"figma_metadata":{r.figmaFileName=T.figmaFileName,r.figmaSelectedFrameName=T.figmaSelectedFrameName,typeof t=="function"?t(T):(C=t.onFigmaMetadata)==null||C.call(t,{figmaFileName:T.figmaFileName,figmaSelectedFrameName:T.figmaSelectedFrameName});break}case"generating_code":{const Ge=T.payload.files,A=qt(Ge);T.payload.status==="success"&&(r.files=A),typeof t=="function"?t(T):(R=t.onGeneratingCode)==null||R.call(t,{status:T.payload.status,progress:T.payload.progress,files:A});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}}}}}finally{o.cancel()}throw new be({name:"Connection",reason:"Connection closed before the 'done' message",status:500})})}}B=new WeakMap,He=new WeakMap;const Fs=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,"",""]}},Ls=({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},rn="Figma Token Issue";class an extends Error{constructor({fileKey:e,reason:t}){super(rn),this.fileKey=e,this.reason=t}}const on="Rate Limit Exceeded";class cn extends Error{constructor({fileKey:e}){super(on),this.fileKey=e}}const dn="Not Found";class un extends Error{constructor({fileKey:e}){super(dn),this.fileKey=e}}const ln=n=>n.message===dn,fn="Unknown Figma API Exception";class hn extends Error{constructor({fileKey:e,cause:t}){super(fn),this.name="UnknownFigmaApiException",this.fileKey=e,this.cause=t}}const Vs=n=>n.message===fn,pn=n=>n.message===on,mn=n=>[rn,...["Invalid Figma token","Figma token expired"]].includes(n.message),gn=(n,e)=>{var s,r;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 an({fileKey:e,reason:((r=n==null?void 0:n.cause)==null?void 0:r.body)||n.body}):(t==null?void 0:t.status)===429?new cn({fileKey:e}):(t==null?void 0:t.status)===404?new un({fileKey:e}):new hn({fileKey:e,cause:n})},Ds=n=>ln(n)?"NotFound":pn(n)?"RateLimitExceeded":mn(n)?"FigmaTokenIssue":"UnknownFigmaApiException";var Us=Object.defineProperty,zs=Object.defineProperties,Bs=Object.getOwnPropertyDescriptors,Ft=Object.getOwnPropertySymbols,Ws=Object.prototype.hasOwnProperty,qs=Object.prototype.propertyIsEnumerable,Lt=(n,e)=>(e=Symbol[n])?e:Symbol.for("Symbol."+n),yn=n=>{throw TypeError(n)},Vt=(n,e,t)=>e in n?Us(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,D=(n,e)=>{for(var t in e||(e={}))Ws.call(e,t)&&Vt(n,t,e[t]);if(Ft)for(var t of Ft(e))qs.call(e,t)&&Vt(n,t,e[t]);return n},At=(n,e)=>zs(n,Bs(e)),Ot=(n,e,t)=>e.has(n)||yn("Cannot "+t),k=(n,e,t)=>(Ot(n,e,"read from private field"),t?t.call(n):e.get(n)),W=(n,e,t)=>e.has(n)?yn("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),ee=(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(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())}),Hs=(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),Js=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Gs(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var yt={exports:{}},Ks=yt.exports,Dt;function Xs(){return Dt||(Dt=1,function(n,e){(function(t,s){n.exports=s()})(Ks,function(){var t=typeof Promise=="function",s=typeof self=="object"?self:Js,r=typeof Symbol!="undefined",a=typeof Map!="undefined",i=typeof Set!="undefined",o=typeof WeakMap!="undefined",c=typeof WeakSet!="undefined",u=typeof DataView!="undefined",h=r&&typeof Symbol.iterator!="undefined",_=r&&typeof Symbol.toStringTag!="undefined",N=i&&typeof Set.prototype.entries=="function",O=a&&typeof Map.prototype.entries=="function",C=N&&Object.getPrototypeOf(new Set().entries()),R=O&&Object.getPrototypeOf(new Map().entries()),q=h&&typeof Array.prototype[Symbol.iterator]=="function",z=q&&Object.getPrototypeOf([][Symbol.iterator]()),re=h&&typeof String.prototype[Symbol.iterator]=="function",F=re&&Object.getPrototypeOf(""[Symbol.iterator]()),K=8,T=-1;function Ge(A){var Nt=typeof A;if(Nt!=="object")return Nt;if(A===null)return"null";if(A===s)return"global";if(Array.isArray(A)&&(_===!1||!(Symbol.toStringTag in A)))return"Array";if(typeof window=="object"&&window!==null){if(typeof window.location=="object"&&A===window.location)return"Location";if(typeof window.document=="object"&&A===window.document)return"Document";if(typeof window.navigator=="object"){if(typeof window.navigator.mimeTypes=="object"&&A===window.navigator.mimeTypes)return"MimeTypeArray";if(typeof window.navigator.plugins=="object"&&A===window.navigator.plugins)return"PluginArray"}if((typeof window.HTMLElement=="function"||typeof window.HTMLElement=="object")&&A instanceof window.HTMLElement){if(A.tagName==="BLOCKQUOTE")return"HTMLQuoteElement";if(A.tagName==="TD")return"HTMLTableDataCellElement";if(A.tagName==="TH")return"HTMLTableHeaderCellElement"}}var jt=_&&A[Symbol.toStringTag];if(typeof jt=="string")return jt;var L=Object.getPrototypeOf(A);return L===RegExp.prototype?"RegExp":L===Date.prototype?"Date":t&&L===Promise.prototype?"Promise":i&&L===Set.prototype?"Set":a&&L===Map.prototype?"Map":c&&L===WeakSet.prototype?"WeakSet":o&&L===WeakMap.prototype?"WeakMap":u&&L===DataView.prototype?"DataView":a&&L===R?"Map Iterator":i&&L===C?"Set Iterator":q&&L===z?"Array Iterator":re&&L===F?"String Iterator":L===null?"Object":Object.prototype.toString.call(A).slice(K,T)}return Ge})}(yt)),yt.exports}var Ys=Xs();const Qs=Gs(Ys),Ct=typeof Buffer!="undefined",er=Ct&&typeof Buffer.from!="undefined",tr=Ct?function(n){return Buffer.isBuffer(n)}:function(){return!1},nr=er?function(n){return Buffer.from(n)}:Ct?function(n){return new Buffer(n)}:function(n){return n};function Ae(n){return tr(n)?"Buffer":Qs(n)}const sr=new Set(["Arguments","Array","Map","Object","Set"]);function rr(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 vt(n){return sr.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 ar=typeof globalThis!="undefined"&&globalThis!==null&&globalThis.Object===Object&&globalThis,ir=typeof global!="undefined"&&global!==null&&global.Object===Object&&global,or=typeof self!="undefined"&&self!==null&&self.Object===Object&&self,ut=ar||ir||or||Function("return this")();function cr(n){return n.slice(0)}function dr(n){return new Boolean(n.valueOf())}function ur(n){return new DataView(n.buffer)}function lr(n){return nr(n)}function fr(n){return new Date(n.getTime())}function hr(n){return new Number(n)}function pr(n){return new RegExp(n.source,n.flags)}function mr(n){return new String(n)}function ae(n,e){return ut[e].from?ut[e].from(n):new ut[e](n)}function Z(n){return n}function zt(){return[]}function gr(){return new Map}function yr(){return{}}function vr(){return new Set}const _r=new Map([["ArrayBuffer",cr],["Boolean",dr],["Buffer",lr],["DataView",ur],["Date",fr],["Number",hr],["RegExp",pr],["String",mr],["Float32Array",ae],["Float64Array",ae],["Int16Array",ae],["Int32Array",ae],["Int8Array",ae],["Uint16Array",ae],["Uint32Array",ae],["Uint8Array",ae],["Uint8ClampedArray",ae],["Array Iterator",Z],["Map Iterator",Z],["Promise",Z],["Set Iterator",Z],["String Iterator",Z],["function",Z],["global",Z],["WeakMap",Z],["WeakSet",Z],["boolean",Z],["null",Z],["number",Z],["string",Z],["symbol",Z],["undefined",Z],["Arguments",zt],["Array",zt],["Map",gr],["Object",yr],["Set",vr]]);function br(){}function _t(n,e=null,t=br){arguments.length===2&&typeof e=="function"&&(t=e,e=null);const s=e||Ae(n),r=_r.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(!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=Ae(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 u=rr(n,c,a);if(s.has(u))Ut(e,c,t.get(u),a);else{const h=Ae(u),_=_t(u,h);vt(h)&&(t.set(u,_),s.add(u)),Ut(e,c,bt(u,_,t,s),a)}}return e}const wr=n=>new Promise(e=>setTimeout(e,n));var Ke,pe,Xe,wt,vn;class xr{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 k(this,Xe).call(this)}catch(e){if(j(this,pe,k(this,pe)+1),k(this,pe)>k(this,Ke))throw console.error("Max attempts reached"),e;const t=ee(this,wt,vn).call(this);return yield wr(t),yield this.run()}})}}Ke=new WeakMap,pe=new WeakMap,Xe=new WeakMap,wt=new WeakSet,vn=function(){return k(this,pe)*1e3*1.5};function kr(){return typeof CompressionStream!="undefined"}function Tr(n){return E(this,null,function*(){const e=new Blob([n]).stream().pipeThrough(new CompressionStream("gzip")),t=[];try{for(var s=Hs(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 Sr(t)})}function Sr(n){return E(this,null,function*(){const e=yield new Blob(n).arrayBuffer();return new Uint8Array(e)})}class Er 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,h)=>{c[h]=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 Bt 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 Ar 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 _n(){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 Or=5*60*1e3,Cr=1*1e3;var me,$,Y,kt,Tt,Ie;class Nr{constructor({fetch:e=globalThis.fetch.bind(globalThis),baseAddress:t}){W(this,Y),W(this,me),W(this,$),this.baseAddress=t,j(this,me,e),j(this,$,{}),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,$,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,$));return j(this,$,{}),c.extraHeaders&&(o=D(D({},o),c.extraHeaders)),c.requestValidation&&(o=At(D({},o),{"X-Request-Nonce":_n(),"X-Request-Timestamp":xt()})),c.async?yield ee(this,Y,Tt).call(this,`${i}${t}`,c.async,{headers:o}):yield ee(this,Y,kt).call(this,`${i}${t}`,c,{headers:o})})}post(e,t){return E(this,arguments,function*(s,r,a={}){const i=Oe(k(this,$));return j(this,$,{}),ee(this,Y,Ie).call(this,s,"POST",r,a,i)})}put(e,t){return E(this,arguments,function*(s,r,a={}){const i=Oe(k(this,$));return j(this,$,{}),ee(this,Y,Ie).call(this,s,"PUT",r,a,i)})}delete(e,t){return E(this,arguments,function*(s,r,a={}){const i=Oe(k(this,$));return j(this,$,{}),ee(this,Y,Ie).call(this,s,"DELETE",r,a,i)})}patch(e,t){return E(this,arguments,function*(s,r,a={}){const i=Oe(k(this,$));return j(this,$,{}),ee(this,Y,Ie).call(this,s,"PATCH",r,a,i)})}}me=new WeakMap,$=new WeakMap,Y=new WeakSet,kt=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,D(D({},t),e.abortSignal&&{signal:e.abortSignal}))}catch(h){throw h instanceof Error&&h.name==="AbortError"?new je({canceled:(u=(c=e.abortSignal)==null?void 0:c.aborted)!=null?u:!1}):h}}),{headers:r}=t!=null?t:{},a=(c,u)=>{var h,_;return((h=c==null?void 0:c.headers)==null?void 0:h.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 Bt({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"),N=r==null?void 0:r["X-Request-Nonce"];if(!_||_!==N)throw new lt("Response nonce mismatch");const O=Number(a(c,"x-response-timestamp")),C=Number(xt()),R=60*60*24;if(isNaN(O)||Math.abs(C-O)>R)throw new lt("Invalid response timestamp")}catch(_){const N=_ instanceof Error?_.message:"Request validation failed";throw new lt(N)}let h=yield c.text();try{h=JSON.parse(h)}catch(_){}return h});if(e.retry){const c=yield new xr({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=()=>Cr,maxTimeout:c=Or}=e,u=`${n}/async`,h=`${n}/async/job`;let _;try{_=yield k(this,me).call(this,u,D(D({},t),i&&{signal:i}))}catch(C){throw C instanceof Error&&C.name==="AbortError"?new je({canceled:(s=i==null?void 0:i.aborted)!=null?s:!1}):C}if(!_.ok){const C=yield _.text().catch();throw new Bt({url:n,method:(r=t==null?void 0:t.method)!=null?r:"GET",statusCode:_.status,requestHeaders:this.headers,responseHeaders:_.headers,body:C})}const N=yield _.json(),{job_id:O}=N;if(!O)throw new Error("Job ID not found in response");return new Promise((C,R)=>E(this,null,function*(){const q=setTimeout(()=>{R(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,`${h}/${O}/cancel`,{method:"POST",headers:this.headers}).then(()=>{R(new je({canceled:!0}))}).catch(F=>{R(new je({canceled:!1}))});return}try{const F=yield(yield k(this,me).call(this,`${h}/${O}`,{headers:this.headers})).json();if(F.status==="success"){clearTimeout(q);const K=F.response_json;C(K)}else if(F.status==="failed")clearTimeout(q),R(new Ar(F.response_json));else{a&&a(F.response_json);const K=o(re);setTimeout(()=>z(re+1),K)}}catch(F){R(F)}});z()}))})},Ie=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=D(D({},c),r.extraHeaders)),r.requestValidation&&(c=At(D({},c),{"X-Request-Nonce":_n(),"X-Request-Timestamp":xt()}));let u=s.skipBodyJsonStringify?t:JSON.stringify(t);return r.compress&&kr()&&(c["Content-Encoding"]="gzip",u=yield Tr(u)),r.async?yield ee(this,Y,Tt).call(this,`${o}${n}`,r.async,{method:e,headers:c,body:u}):yield ee(this,Y,kt).call(this,`${o}${n}`,r,{method:e,headers:c,body:u})})};const Wt=(n,e,t,s)=>n instanceof je?n:new Er({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 Wt(o,t.resourceName,s,r)}return i instanceof Promise?i.catch(o=>{throw Wt(o,t.resourceName,s,r)}):i}}});var Re;class jr{constructor(e){W(this,Re),this.resourceName="Files",j(this,Re,e)}get(e){return E(this,arguments,function*({fileKey:t,params:s={}}){const r=new URLSearchParams(D({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 Ir=(n,e,t)=>{const s=e.sort();return`${n}-${s.join("-")}-${t}`},Rr=n=>n?n.ts>Date.now()-1e3*30:!1;var Q,St,bn;class Zr{constructor(e){W(this,St),W(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=Ir(t,s,r),o=k(this,Q).cache.images.entries.get(i);if(Rr(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,St,bn).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,St=new WeakSet,bn=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 Ye;class Mr{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(D({},r),{ids:s.join(",")}),i=new URLSearchParams(D({plugin_data:"857346721138427857"},a)).toString(),o=`v1/files/${t}/nodes?${i}`;return yield k(this,Ye).get(o)})}}Ye=new WeakMap;var de;class wn extends Nr{constructor({baseAddress:e="https://api.figma.com/",fetch:t=globalThis.fetch.bind(globalThis)}={}){super({fetch:t,baseAddress:e}),W(this,de,""),this.cache={images:{entries:new Map,pendingRequests:new Map}},this.files=ft(this,new jr(this)),this.nodes=ft(this,new Mr(this)),this.images=ft(this,new Zr(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 Pr=r=>P(exports,[r],function*({fileKey:n,authToken:e,figmaRestApi:t=new wn,params:s={}}){e&&(t.token=e);try{return yield t.files.get({fileKey:n,params:s})}catch(a){throw console.error(a),a}}),$r=a=>P(exports,[a],function*({fileKey:n,authToken:e,nodeIds:t,figmaRestApi:s=new wn,params:r={}}){e&&(s.token=e);try{return(yield s.nodes.get({fileKey:n,nodeIds:t,params:d({},r)})).nodes}catch(i){return gn(i,n)}}),xn=(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"}),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()})}}),Fr=(n,e)=>P(exports,null,function*(){var c,u,h,_,N,O,C;const t=xn(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"&&((h=(u=a.value)==null?void 0:u.payload)!=null&&h.status))return new Response(JSON.stringify(a.value),{status:((_=a.value)==null?void 0:_.type)==="error"&&(C=(O=(N=a.value)==null?void 0:N.payload)==null?void 0:O.status)!=null?C:500,headers:{"Content-Type":"application/json"}});const i=new TextEncoder,o=r.pipeThrough(new TransformStream({transform(R,q){const z=`event: ${R.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,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 P=(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 j{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 P(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 j.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}),M=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 j,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 P(this,null,function*(){const s=yield this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error})}safeParseAsync(e,t){return P(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 j;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 j;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 j;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 M(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 j;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 M(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 M(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 M(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 M(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 M(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 M(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=>j.mergeArray(s,i));const a=[...t.data].map((i,o)=>r.type._parseSync(new ne(t,i,t.path,o)));return j.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(()=>P(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=>j.mergeObjectSync(s,u)):j.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=>P(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=>j.mergeArray(t,i)):j.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?j.mergeObjectAsync(t,r):j.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(()=>P(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 M(function(...c){return P(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 M(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 M(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 M(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 M(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=>P(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?M(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?M(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 P(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 $=Object.freeze({__proto__:null,defaultErrorMap:Te,setErrorMap:On,getErrorMap:Ye,makeIssue:Qe,EMPTY_PATH:Cn,addIssueToContext:h,ParseStatus:j,INVALID:v,DIRTY:xe,OK:M,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=$.object({language:$.enum(["typescript","javascript"]).optional()}).and($.union([$.object({framework:$.literal("react"),model:$.string().optional(),styling:$.enum(["plain_css","css_modules","styled_components","tailwind","sass","scss","inline_styles"]),uiLibrary:$.enum(["mui","antd","radix","shadcn"]).optional(),enableUILibraryTheming:$.boolean().optional(),enableCompactStructure:$.boolean().optional()}),$.object({framework:$.literal("html"),styling:$.enum(["plain_css","inline_styles"]),enableTranslation:$.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 P(this,arguments,function*(e,t={}){var f,_,C,A,O,R,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})});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):(R=t.onGeneratingCode)==null||R.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),I=(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()),R=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===R?"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 Z(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",Z],["Map Iterator",Z],["Promise",Z],["Set Iterator",Z],["String Iterator",Z],["function",Z],["global",Z],["WeakMap",Z],["WeakSet",Z],["boolean",Z],["null",Z],["number",Z],["string",Z],["symbol",Z],["undefined",Z],["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),I(this,Ge,e),I(this,Ke,t),I(this,pe,0)}run(){return E(this,null,function*(){try{return yield k(this,Ke).call(this)}catch(e){if(I(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,I(this,me,e),I(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 I(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 I(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 I(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 I(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 I(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 I(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()),R=60*60*24;if(isNaN(A)||Math.abs(O-A)>R)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,R)=>E(this,null,function*(){const q=setTimeout(()=>{R(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(()=>{R(new Ie({canceled:!0}))}).catch(L=>{R(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),R(new Ir(L.response_json));else{a&&a(L.response_json);const K=o(re);setTimeout(()=>z(re+1),K)}}catch(L){R(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",I(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",I(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",I(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");I(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=>P(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=>P(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)=>P(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(R,q){const z=`event: ${R.type}
|
|
3
3
|
data: ${JSON.stringify(R)}
|
|
4
4
|
|
|
5
|
-
`;q.enqueue(i.encode(z))}}));return new Response(o,{status:200,headers:{"Content-Type":"text/event-stream; charset=utf-8",Connection:"keep-alive","Cache-Control":"no-cache"}})});exports.Anima
|
|
5
|
+
`;q.enqueue(i.encode(z))}}));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=be;exports.FigmaTokenIssue=rn;exports.NotFound=dn;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=un;exports.isRateLimitExceeded=hn;exports.isUnknownFigmaApiException=Ws;exports.isValidFigmaUrl=$s;exports.validateSettings=nn;
|
|
6
6
|
//# sourceMappingURL=index.cjs.map
|