@animaapp/anima-sdk-react 0.1.0 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";var ta=Object.defineProperty,na=Object.defineProperties;var ra=Object.getOwnPropertyDescriptors;var Vr=Object.getOwnPropertySymbols;var sa=Object.prototype.hasOwnProperty,aa=Object.prototype.propertyIsEnumerable;var Ur=(t,e,n)=>e in t?ta(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Be=(t,e)=>{for(var n in e||(e={}))sa.call(e,n)&&Ur(t,n,e[n]);if(Vr)for(var n of Vr(e))aa.call(e,n)&&Ur(t,n,e[n]);return t},Br=(t,e)=>na(t,ra(e));var ot=(t,e,n)=>new Promise((r,s)=>{var a=u=>{try{o(n.next(u))}catch(c){s(c)}},i=u=>{try{o(n.throw(u))}catch(c){s(c)}},o=u=>u.done?r(u.value):Promise.resolve(u.value).then(a,i);o((n=n.apply(t,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const L=require("react");var ia=Object.defineProperty,oa=Object.defineProperties,ua=Object.getOwnPropertyDescriptors,qr=Object.getOwnPropertySymbols,ca=Object.prototype.hasOwnProperty,da=Object.prototype.propertyIsEnumerable,Kr=(t,e,n)=>e in t?ia(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,d=(t,e)=>{for(var n in e||(e={}))ca.call(e,n)&&Kr(t,n,e[n]);if(qr)for(var n of qr(e))da.call(e,n)&&Kr(t,n,e[n]);return t},k=(t,e)=>oa(t,ua(e)),Ee=(t,e,n)=>new Promise((r,s)=>{var a=u=>{try{o(n.next(u))}catch(c){s(c)}},i=u=>{try{o(n.throw(u))}catch(c){s(c)}},o=u=>u.done?r(u.value):Promise.resolve(u.value).then(a,i);o((n=n.apply(t,e)).next())}),C;(function(t){t.assertEqual=s=>s;function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},t.getValidEnumValues=s=>{const a=t.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return t.objectValues(i)},t.objectValues=s=>t.objectKeys(s).map(function(a){return s[a]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},t.find=(s,a)=>{for(const i of s)if(a(i))return i},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function r(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(C||(C={}));var Bn;(function(t){t.mergeShapes=(e,n)=>d(d({},e),n)})(Bn||(Bn={}));const _=C.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Pe=t=>{switch(typeof t){case"undefined":return _.undefined;case"string":return _.string;case"number":return isNaN(t)?_.nan:_.number;case"boolean":return _.boolean;case"function":return _.function;case"bigint":return _.bigint;case"symbol":return _.symbol;case"object":return Array.isArray(t)?_.array:t===null?_.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?_.promise:typeof Map!="undefined"&&t instanceof Map?_.map:typeof Set!="undefined"&&t instanceof Set?_.set:typeof Date!="undefined"&&t instanceof Date?_.date:_.object;default:return _.unknown}},l=C.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"]),la=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class ie extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(a){return a.message},r={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let o=r,u=0;for(;u<i.path.length;){const c=i.path[u];u===i.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(n(i))):o[c]=o[c]||{_errors:[]},o=o[c],u++}}};return s(this),r}static assert(e){if(!(e instanceof ie))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,C.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(e(s))):r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}ie.create=t=>new ie(t);const mt=(t,e)=>{let n;switch(t.code){case l.invalid_type:t.received===_.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case l.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,C.jsonStringifyReplacer)}`;break;case l.unrecognized_keys:n=`Unrecognized key(s) in object: ${C.joinValues(t.keys,", ")}`;break;case l.invalid_union:n="Invalid input";break;case l.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${C.joinValues(t.options)}`;break;case l.invalid_enum_value:n=`Invalid enum value. Expected ${C.joinValues(t.options)}, received '${t.received}'`;break;case l.invalid_arguments:n="Invalid function arguments";break;case l.invalid_return_type:n="Invalid function return type";break;case l.invalid_date:n="Invalid date";break;case l.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:C.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case l.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case l.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case l.custom:n="Invalid input";break;case l.invalid_intersection_types:n="Intersection results could not be merged";break;case l.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case l.not_finite:n="Number must be finite";break;default:n=e.defaultError,C.assertNever(t)}return{message:n}};let ks=mt;function fa(t){ks=t}function dn(){return ks}const ln=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,a=[...n,...s.path||[]],i=k(d({},s),{path:a});if(s.message!==void 0)return k(d({},s),{path:a,message:s.message});let o="";const u=r.filter(c=>!!c).slice().reverse();for(const c of u)o=c(i,{data:e,defaultError:o}).message;return k(d({},s),{path:a,message:o})},ha=[];function p(t,e){const n=dn(),r=ln({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===mt?void 0:mt].filter(s=>!!s)});t.common.issues.push(r)}class G{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const s of n){if(s.status==="aborted")return E;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static mergeObjectAsync(e,n){return Ee(this,null,function*(){const r=[];for(const s of n){const a=yield s.key,i=yield s.value;r.push({key:a,value:i})}return G.mergeObjectSync(e,r)})}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return E;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value!="undefined"||s.alwaysSet)&&(r[a.value]=i.value)}return{status:e.value,value:r}}}const E=Object.freeze({status:"aborted"}),fn=t=>({status:"dirty",value:t}),ee=t=>({status:"valid",value:t}),qn=t=>t.status==="aborted",Kn=t=>t.status==="dirty",Xe=t=>t.status==="valid",Nt=t=>typeof Promise!="undefined"&&t instanceof Promise;function hn(t,e,n,r){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function Es(t,e,n,r,s){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var b;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(b||(b={}));var Et,xt;class xe{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}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 Hr=(t,e)=>{if(Xe(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new ie(t.common.issues);return this._error=n,this._error}}};function S(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(a,i)=>{var o,u;const{message:c}=t;return a.code==="invalid_enum_value"?{message:c!=null?c:i.defaultError}:typeof i.data=="undefined"?{message:(o=c!=null?c:r)!==null&&o!==void 0?o:i.defaultError}:a.code!=="invalid_type"?{message:i.defaultError}:{message:(u=c!=null?c:n)!==null&&u!==void 0?u:i.defaultError}},description:s}}class T{get description(){return this._def.description}_getType(e){return Pe(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Pe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new G,ctx:{common:e.parent.common,data:e.data,parsedType:Pe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Nt(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){var r;const s={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Pe(e)},a=this._parseSync({data:e,path:s.path,parent:s});return Hr(s,a)}"~validate"(e){var n,r;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Pe(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:s});return Xe(a)?{value:a.value}:{issues:s.common.issues}}catch(a){!((r=(n=a==null?void 0:a.message)===null||n===void 0?void 0:n.toLowerCase())===null||r===void 0)&&r.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then(a=>Xe(a)?{value:a.value}:{issues:s.common.issues})}parseAsync(e,n){return Ee(this,null,function*(){const r=yield this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error})}safeParseAsync(e,n){return Ee(this,null,function*(){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Pe(e)},s=this._parse({data:e,path:r.path,parent:r}),a=yield Nt(s)?s:Promise.resolve(s);return Hr(r,a)})}refine(e,n){const r=s=>typeof n=="string"||typeof n=="undefined"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue(d({code:l.custom},r(s)));return typeof Promise!="undefined"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new ye({schema:this,typeName:w.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:n=>this["~validate"](n)}}optional(){return ke.create(this,this._def)}nullable(){return We.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return me.create(this)}promise(){return gt.create(this,this._def)}or(e){return Dt.create([this,e],this._def)}and(e){return Mt.create(this,e,this._def)}transform(e){return new ye(k(d({},S(this._def)),{schema:this,typeName:w.ZodEffects,effect:{type:"transform",transform:e}}))}default(e){const n=typeof e=="function"?e:()=>e;return new zt(k(d({},S(this._def)),{innerType:this,defaultValue:n,typeName:w.ZodDefault}))}brand(){return new Or(d({typeName:w.ZodBranded,type:this},S(this._def)))}catch(e){const n=typeof e=="function"?e:()=>e;return new Vt(k(d({},S(this._def)),{innerType:this,catchValue:n,typeName:w.ZodCatch}))}describe(e){const n=this.constructor;return new n(k(d({},this._def),{description:e}))}pipe(e){return Gt.create(this,e)}readonly(){return Ut.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const pa=/^c[^\s-]{8,}$/i,ma=/^[0-9a-z]+$/,ya=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ga=/^[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,_a=/^[a-z0-9_-]{21}$/i,va=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ba=/^[-+]?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)?)??$/,wa=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ka="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Rn;const Ea=/^(?:(?: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])$/,xa=/^(?:(?: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])$/,Sa=/^(([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]))$/,Oa=/^(([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])$/,Ta=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Aa=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,xs="((\\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])))",Ca=new RegExp(`^${xs}$`);function Ss(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Ra(t){return new RegExp(`^${Ss(t)}$`)}function Os(t){let e=`${xs}T${Ss(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function Pa(t,e){return!!((e==="v4"||!e)&&Ea.test(t)||(e==="v6"||!e)&&Sa.test(t))}function Na(t,e){if(!va.test(t))return!1;try{const[n]=t.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||!s.typ||!s.alg||e&&s.alg!==e)}catch(n){return!1}}function ja(t,e){return!!((e==="v4"||!e)&&xa.test(t)||(e==="v6"||!e)&&Oa.test(t))}class pe extends T{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==_.string){const s=this._getOrReturnCtx(e);return p(s,{code:l.invalid_type,expected:_.string,received:s.parsedType}),E}const n=new G;let r;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(r=this._getOrReturnCtx(e,r),p(r,{code:l.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(r=this._getOrReturnCtx(e,r),p(r,{code:l.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){const a=e.data.length>s.value,i=e.data.length<s.value;(a||i)&&(r=this._getOrReturnCtx(e,r),a?p(r,{code:l.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):i&&p(r,{code:l.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")wa.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"email",code:l.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Rn||(Rn=new RegExp(ka,"u")),Rn.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"emoji",code:l.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")ga.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"uuid",code:l.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")_a.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"nanoid",code:l.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")pa.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"cuid",code:l.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")ma.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"cuid2",code:l.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")ya.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"ulid",code:l.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch(a){r=this._getOrReturnCtx(e,r),p(r,{validation:"url",code:l.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"regex",code:l.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(r=this._getOrReturnCtx(e,r),p(r,{code:l.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(r=this._getOrReturnCtx(e,r),p(r,{code:l.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(r=this._getOrReturnCtx(e,r),p(r,{code:l.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Os(s).test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{code:l.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?Ca.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{code:l.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?Ra(s).test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{code:l.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?ba.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"duration",code:l.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?Pa(e.data,s.version)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"ip",code:l.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?Na(e.data,s.alg)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"jwt",code:l.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?ja(e.data,s.version)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"cidr",code:l.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?Ta.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"base64",code:l.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?Aa.test(e.data)||(r=this._getOrReturnCtx(e,r),p(r,{validation:"base64url",code:l.invalid_string,message:s.message}),n.dirty()):C.assertNever(s);return{status:n.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),d({validation:n,code:l.invalid_string},b.errToObj(r)))}_addCheck(e){return new pe(k(d({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(d({kind:"email"},b.errToObj(e)))}url(e){return this._addCheck(d({kind:"url"},b.errToObj(e)))}emoji(e){return this._addCheck(d({kind:"emoji"},b.errToObj(e)))}uuid(e){return this._addCheck(d({kind:"uuid"},b.errToObj(e)))}nanoid(e){return this._addCheck(d({kind:"nanoid"},b.errToObj(e)))}cuid(e){return this._addCheck(d({kind:"cuid"},b.errToObj(e)))}cuid2(e){return this._addCheck(d({kind:"cuid2"},b.errToObj(e)))}ulid(e){return this._addCheck(d({kind:"ulid"},b.errToObj(e)))}base64(e){return this._addCheck(d({kind:"base64"},b.errToObj(e)))}base64url(e){return this._addCheck(d({kind:"base64url"},b.errToObj(e)))}jwt(e){return this._addCheck(d({kind:"jwt"},b.errToObj(e)))}ip(e){return this._addCheck(d({kind:"ip"},b.errToObj(e)))}cidr(e){return this._addCheck(d({kind:"cidr"},b.errToObj(e)))}datetime(e){var n,r;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:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1},b.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},b.errToObj(e==null?void 0:e.message)))}duration(e){return this._addCheck(d({kind:"duration"},b.errToObj(e)))}regex(e,n){return this._addCheck(d({kind:"regex",regex:e},b.errToObj(n)))}includes(e,n){return this._addCheck(d({kind:"includes",value:e,position:n==null?void 0:n.position},b.errToObj(n==null?void 0:n.message)))}startsWith(e,n){return this._addCheck(d({kind:"startsWith",value:e},b.errToObj(n)))}endsWith(e,n){return this._addCheck(d({kind:"endsWith",value:e},b.errToObj(n)))}min(e,n){return this._addCheck(d({kind:"min",value:e},b.errToObj(n)))}max(e,n){return this._addCheck(d({kind:"max",value:e},b.errToObj(n)))}length(e,n){return this._addCheck(d({kind:"length",value:e},b.errToObj(n)))}nonempty(e){return this.min(1,b.errToObj(e))}trim(){return new pe(k(d({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}toLowerCase(){return new pe(k(d({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new pe(k(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 n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}pe.create=t=>{var e;return new pe(d({checks:[],typeName:w.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1},S(t)))};function Ia(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,a=parseInt(t.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}class Le extends T{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)!==_.number){const s=this._getOrReturnCtx(e);return p(s,{code:l.invalid_type,expected:_.number,received:s.parsedType}),E}let n;const r=new G;for(const s of this._def.checks)s.kind==="int"?C.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:l.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:l.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:l.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="multipleOf"?Ia(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),p(n,{code:l.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),p(n,{code:l.not_finite,message:s.message}),r.dirty()):C.assertNever(s);return{status:r.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,b.toString(n))}gt(e,n){return this.setLimit("min",e,!1,b.toString(n))}lte(e,n){return this.setLimit("max",e,!0,b.toString(n))}lt(e,n){return this.setLimit("max",e,!1,b.toString(n))}setLimit(e,n,r,s){return new Le(k(d({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:b.toString(s)}]}))}_addCheck(e){return new Le(k(d({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:b.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:b.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:b.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:b.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:b.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:b.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:b.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:b.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:b.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&C.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}Le.create=t=>new Le(d({checks:[],typeName:w.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1},S(t)));class $e extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(s){return this._getInvalidInput(e)}if(this._getType(e)!==_.bigint)return this._getInvalidInput(e);let n;const r=new G;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:l.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),p(n,{code:l.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),p(n,{code:l.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):C.assertNever(s);return{status:r.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return p(n,{code:l.invalid_type,expected:_.bigint,received:n.parsedType}),E}gte(e,n){return this.setLimit("min",e,!0,b.toString(n))}gt(e,n){return this.setLimit("min",e,!1,b.toString(n))}lte(e,n){return this.setLimit("max",e,!0,b.toString(n))}lt(e,n){return this.setLimit("max",e,!1,b.toString(n))}setLimit(e,n,r,s){return new $e(k(d({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:b.toString(s)}]}))}_addCheck(e){return new $e(k(d({},this._def),{checks:[...this._def.checks,e]}))}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:b.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:b.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:b.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:b.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:b.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}$e.create=t=>{var e;return new $e(d({checks:[],typeName:w.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1},S(t)))};class jt extends T{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==_.boolean){const n=this._getOrReturnCtx(e);return p(n,{code:l.invalid_type,expected:_.boolean,received:n.parsedType}),E}return ee(e.data)}}jt.create=t=>new jt(d({typeName:w.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1},S(t)));class Ye extends T{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==_.date){const s=this._getOrReturnCtx(e);return p(s,{code:l.invalid_type,expected:_.date,received:s.parsedType}),E}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return p(s,{code:l.invalid_date}),E}const n=new G;let r;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(r=this._getOrReturnCtx(e,r),p(r,{code:l.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(r=this._getOrReturnCtx(e,r),p(r,{code:l.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):C.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Ye(k(d({},this._def),{checks:[...this._def.checks,e]}))}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:b.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:b.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}Ye.create=t=>new Ye(d({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:w.ZodDate},S(t)));class pn extends T{_parse(e){if(this._getType(e)!==_.symbol){const n=this._getOrReturnCtx(e);return p(n,{code:l.invalid_type,expected:_.symbol,received:n.parsedType}),E}return ee(e.data)}}pn.create=t=>new pn(d({typeName:w.ZodSymbol},S(t)));class It extends T{_parse(e){if(this._getType(e)!==_.undefined){const n=this._getOrReturnCtx(e);return p(n,{code:l.invalid_type,expected:_.undefined,received:n.parsedType}),E}return ee(e.data)}}It.create=t=>new It(d({typeName:w.ZodUndefined},S(t)));class Zt extends T{_parse(e){if(this._getType(e)!==_.null){const n=this._getOrReturnCtx(e);return p(n,{code:l.invalid_type,expected:_.null,received:n.parsedType}),E}return ee(e.data)}}Zt.create=t=>new Zt(d({typeName:w.ZodNull},S(t)));class yt extends T{constructor(){super(...arguments),this._any=!0}_parse(e){return ee(e.data)}}yt.create=t=>new yt(d({typeName:w.ZodAny},S(t)));class Je extends T{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ee(e.data)}}Je.create=t=>new Je(d({typeName:w.ZodUnknown},S(t)));class je extends T{_parse(e){const n=this._getOrReturnCtx(e);return p(n,{code:l.invalid_type,expected:_.never,received:n.parsedType}),E}}je.create=t=>new je(d({typeName:w.ZodNever},S(t)));class mn extends T{_parse(e){if(this._getType(e)!==_.undefined){const n=this._getOrReturnCtx(e);return p(n,{code:l.invalid_type,expected:_.void,received:n.parsedType}),E}return ee(e.data)}}mn.create=t=>new mn(d({typeName:w.ZodVoid},S(t)));class me extends T{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==_.array)return p(n,{code:l.invalid_type,expected:_.array,received:n.parsedType}),E;if(s.exactLength!==null){const i=n.data.length>s.exactLength.value,o=n.data.length<s.exactLength.value;(i||o)&&(p(n,{code:i?l.too_big:l.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(p(n,{code:l.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(p(n,{code:l.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,o)=>s.type._parseAsync(new xe(n,i,n.path,o)))).then(i=>G.mergeArray(r,i));const a=[...n.data].map((i,o)=>s.type._parseSync(new xe(n,i,n.path,o)));return G.mergeArray(r,a)}get element(){return this._def.type}min(e,n){return new me(k(d({},this._def),{minLength:{value:e,message:b.toString(n)}}))}max(e,n){return new me(k(d({},this._def),{maxLength:{value:e,message:b.toString(n)}}))}length(e,n){return new me(k(d({},this._def),{exactLength:{value:e,message:b.toString(n)}}))}nonempty(e){return this.min(1,e)}}me.create=(t,e)=>new me(d({type:t,minLength:null,maxLength:null,exactLength:null,typeName:w.ZodArray},S(e)));function ut(t){if(t instanceof $){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=ke.create(ut(r))}return new $(k(d({},t._def),{shape:()=>e}))}else return t instanceof me?new me(k(d({},t._def),{type:ut(t.element)})):t instanceof ke?ke.create(ut(t.unwrap())):t instanceof We?We.create(ut(t.unwrap())):t instanceof Se?Se.create(t.items.map(e=>ut(e))):t}class $ extends T{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(),n=C.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==_.object){const u=this._getOrReturnCtx(e);return p(u,{code:l.invalid_type,expected:_.object,received:u.parsedType}),E}const{status:n,ctx:r}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),i=[];if(!(this._def.catchall instanceof je&&this._def.unknownKeys==="strip"))for(const u in r.data)a.includes(u)||i.push(u);const o=[];for(const u of a){const c=s[u],h=r.data[u];o.push({key:{status:"valid",value:u},value:c._parse(new xe(r,h,r.path,u)),alwaysSet:u in r.data})}if(this._def.catchall instanceof je){const u=this._def.unknownKeys;if(u==="passthrough")for(const c of i)o.push({key:{status:"valid",value:c},value:{status:"valid",value:r.data[c]}});else if(u==="strict")i.length>0&&(p(r,{code:l.unrecognized_keys,keys:i}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const c of i){const h=r.data[c];o.push({key:{status:"valid",value:c},value:u._parse(new xe(r,h,r.path,c)),alwaysSet:c in r.data})}}return r.common.async?Promise.resolve().then(()=>Ee(this,null,function*(){const u=[];for(const c of o){const h=yield c.key,f=yield c.value;u.push({key:h,value:f,alwaysSet:c.alwaysSet})}return u})).then(u=>G.mergeObjectSync(n,u)):G.mergeObjectSync(n,o)}get shape(){return this._def.shape()}strict(e){return b.errToObj,new $(d(k(d({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:(n,r)=>{var s,a,i,o;const u=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,n,r).message)!==null&&i!==void 0?i:r.defaultError;return n.code==="unrecognized_keys"?{message:(o=b.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}))}strip(){return new $(k(d({},this._def),{unknownKeys:"strip"}))}passthrough(){return new $(k(d({},this._def),{unknownKeys:"passthrough"}))}extend(e){return new $(k(d({},this._def),{shape:()=>d(d({},this._def.shape()),e)}))}merge(e){return new $({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>d(d({},this._def.shape()),e._def.shape()),typeName:w.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new $(k(d({},this._def),{catchall:e}))}pick(e){const n={};return C.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new $(k(d({},this._def),{shape:()=>n}))}omit(e){const n={};return C.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new $(k(d({},this._def),{shape:()=>n}))}deepPartial(){return ut(this)}partial(e){const n={};return C.objectKeys(this.shape).forEach(r=>{const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}),new $(k(d({},this._def),{shape:()=>n}))}required(e){const n={};return C.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof ke;)s=s._def.innerType;n[r]=s}}),new $(k(d({},this._def),{shape:()=>n}))}keyof(){return Ts(C.objectKeys(this.shape))}}$.create=(t,e)=>new $(d({shape:()=>t,unknownKeys:"strip",catchall:je.create(),typeName:w.ZodObject},S(e)));$.strictCreate=(t,e)=>new $(d({shape:()=>t,unknownKeys:"strict",catchall:je.create(),typeName:w.ZodObject},S(e)));$.lazycreate=(t,e)=>new $(d({shape:t,unknownKeys:"strip",catchall:je.create(),typeName:w.ZodObject},S(e)));class Dt extends T{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(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 n.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new ie(o.ctx.common.issues));return p(n,{code:l.invalid_union,unionErrors:i}),E}if(n.common.async)return Promise.all(r.map(a=>Ee(this,null,function*(){const i=k(d({},n),{common:k(d({},n.common),{issues:[]}),parent:null});return{result:yield a._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}}))).then(s);{let a;const i=[];for(const u of r){const c=k(d({},n),{common:k(d({},n.common),{issues:[]}),parent:null}),h=u._parseSync({data:n.data,path:n.path,parent:c});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(u=>new ie(u));return p(n,{code:l.invalid_union,unionErrors:o}),E}}get options(){return this._def.options}}Dt.create=(t,e)=>new Dt(d({options:t,typeName:w.ZodUnion},S(e)));const Ie=t=>t instanceof $t?Ie(t.schema):t instanceof ye?Ie(t.innerType()):t instanceof Ft?[t.value]:t instanceof Fe?t.options:t instanceof Wt?C.objectValues(t.enum):t instanceof zt?Ie(t._def.innerType):t instanceof It?[void 0]:t instanceof Zt?[null]:t instanceof ke?[void 0,...Ie(t.unwrap())]:t instanceof We?[null,...Ie(t.unwrap())]:t instanceof Or||t instanceof Ut?Ie(t.unwrap()):t instanceof Vt?Ie(t._def.innerType):[];class kn extends T{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==_.object)return p(n,{code:l.invalid_type,expected:_.object,received:n.parsedType}),E;const r=this.discriminator,s=n.data[r],a=this.optionsMap.get(s);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):(p(n,{code:l.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),E)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const s=new Map;for(const a of n){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(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new kn(d({typeName:w.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s},S(r)))}}function Hn(t,e){const n=Pe(t),r=Pe(e);if(t===e)return{valid:!0,data:t};if(n===_.object&&r===_.object){const s=C.objectKeys(e),a=C.objectKeys(t).filter(o=>s.indexOf(o)!==-1),i=d(d({},t),e);for(const o of a){const u=Hn(t[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(n===_.array&&r===_.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<t.length;a++){const i=t[a],o=e[a],u=Hn(i,o);if(!u.valid)return{valid:!1};s.push(u.data)}return{valid:!0,data:s}}else return n===_.date&&r===_.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Mt extends T{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(a,i)=>{if(qn(a)||qn(i))return E;const o=Hn(a.value,i.value);return o.valid?((Kn(a)||Kn(i))&&n.dirty(),{status:n.value,value:o.data}):(p(r,{code:l.invalid_intersection_types}),E)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Mt.create=(t,e,n)=>new Mt(d({left:t,right:e,typeName:w.ZodIntersection},S(n)));class Se extends T{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.array)return p(r,{code:l.invalid_type,expected:_.array,received:r.parsedType}),E;if(r.data.length<this._def.items.length)return p(r,{code:l.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),E;!this._def.rest&&r.data.length>this._def.items.length&&(p(r,{code:l.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((a,i)=>{const o=this._def.items[i]||this._def.rest;return o?o._parse(new xe(r,a,r.path,i)):null}).filter(a=>!!a);return r.common.async?Promise.all(s).then(a=>G.mergeArray(n,a)):G.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new Se(k(d({},this._def),{rest:e}))}}Se.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Se(d({items:t,typeName:w.ZodTuple,rest:null},S(e)))};class Lt extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.object)return p(r,{code:l.invalid_type,expected:_.object,received:r.parsedType}),E;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in r.data)s.push({key:a._parse(new xe(r,o,r.path,o)),value:i._parse(new xe(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?G.mergeObjectAsync(n,s):G.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof T?new Lt(d({keyType:e,valueType:n,typeName:w.ZodRecord},S(r))):new Lt(d({keyType:pe.create(),valueType:e,typeName:w.ZodRecord},S(n)))}}class yn extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.map)return p(r,{code:l.invalid_type,expected:_.map,received:r.parsedType}),E;const s=this._def.keyType,a=this._def.valueType,i=[...r.data.entries()].map(([o,u],c)=>({key:s._parse(new xe(r,o,r.path,[c,"key"])),value:a._parse(new xe(r,u,r.path,[c,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(()=>Ee(this,null,function*(){for(const u of i){const c=yield u.key,h=yield u.value;if(c.status==="aborted"||h.status==="aborted")return E;(c.status==="dirty"||h.status==="dirty")&&n.dirty(),o.set(c.value,h.value)}return{status:n.value,value:o}}))}else{const o=new Map;for(const u of i){const c=u.key,h=u.value;if(c.status==="aborted"||h.status==="aborted")return E;(c.status==="dirty"||h.status==="dirty")&&n.dirty(),o.set(c.value,h.value)}return{status:n.value,value:o}}}}yn.create=(t,e,n)=>new yn(d({valueType:e,keyType:t,typeName:w.ZodMap},S(n)));class Qe extends T{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.set)return p(r,{code:l.invalid_type,expected:_.set,received:r.parsedType}),E;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(p(r,{code:l.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(p(r,{code:l.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const a=this._def.valueType;function i(u){const c=new Set;for(const h of u){if(h.status==="aborted")return E;h.status==="dirty"&&n.dirty(),c.add(h.value)}return{status:n.value,value:c}}const o=[...r.data.values()].map((u,c)=>a._parse(new xe(r,u,r.path,c)));return r.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,n){return new Qe(k(d({},this._def),{minSize:{value:e,message:b.toString(n)}}))}max(e,n){return new Qe(k(d({},this._def),{maxSize:{value:e,message:b.toString(n)}}))}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Qe.create=(t,e)=>new Qe(d({valueType:t,minSize:null,maxSize:null,typeName:w.ZodSet},S(e)));class ht extends T{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==_.function)return p(n,{code:l.invalid_type,expected:_.function,received:n.parsedType}),E;function r(o,u){return ln({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,dn(),mt].filter(c=>!!c),issueData:{code:l.invalid_arguments,argumentsError:u}})}function s(o,u){return ln({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,dn(),mt].filter(c=>!!c),issueData:{code:l.invalid_return_type,returnTypeError:u}})}const a={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof gt){const o=this;return ee(function(...u){return Ee(this,null,function*(){const c=new ie([]),h=yield o._def.args.parseAsync(u,a).catch(m=>{throw c.addIssue(r(u,m)),c}),f=yield Reflect.apply(i,this,h);return yield o._def.returns._def.type.parseAsync(f,a).catch(m=>{throw c.addIssue(s(f,m)),c})})})}else{const o=this;return ee(function(...u){const c=o._def.args.safeParse(u,a);if(!c.success)throw new ie([r(u,c.error)]);const h=Reflect.apply(i,this,c.data),f=o._def.returns.safeParse(h,a);if(!f.success)throw new ie([s(h,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ht(k(d({},this._def),{args:Se.create(e).rest(Je.create())}))}returns(e){return new ht(k(d({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new ht(d({args:e||Se.create([]).rest(Je.create()),returns:n||Je.create(),typeName:w.ZodFunction},S(r)))}}class $t extends T{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}$t.create=(t,e)=>new $t(d({getter:t,typeName:w.ZodLazy},S(e)));class Ft extends T{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return p(n,{received:n.data,code:l.invalid_literal,expected:this._def.value}),E}return{status:"valid",value:e.data}}get value(){return this._def.value}}Ft.create=(t,e)=>new Ft(d({value:t,typeName:w.ZodLiteral},S(e)));function Ts(t,e){return new Fe(d({values:t,typeName:w.ZodEnum},S(e)))}class Fe extends T{constructor(){super(...arguments),Et.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return p(n,{expected:C.joinValues(r),received:n.parsedType,code:l.invalid_type}),E}if(hn(this,Et)||Es(this,Et,new Set(this._def.values)),!hn(this,Et).has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return p(n,{received:n.data,code:l.invalid_enum_value,options:r}),E}return ee(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Fe.create(e,d(d({},this._def),n))}exclude(e,n=this._def){return Fe.create(this.options.filter(r=>!e.includes(r)),d(d({},this._def),n))}}Et=new WeakMap;Fe.create=Ts;class Wt extends T{constructor(){super(...arguments),xt.set(this,void 0)}_parse(e){const n=C.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==_.string&&r.parsedType!==_.number){const s=C.objectValues(n);return p(r,{expected:C.joinValues(s),received:r.parsedType,code:l.invalid_type}),E}if(hn(this,xt)||Es(this,xt,new Set(C.getValidEnumValues(this._def.values))),!hn(this,xt).has(e.data)){const s=C.objectValues(n);return p(r,{received:r.data,code:l.invalid_enum_value,options:s}),E}return ee(e.data)}get enum(){return this._def.values}}xt=new WeakMap;Wt.create=(t,e)=>new Wt(d({values:t,typeName:w.ZodNativeEnum},S(e)));class gt extends T{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==_.promise&&n.common.async===!1)return p(n,{code:l.invalid_type,expected:_.promise,received:n.parsedType}),E;const r=n.parsedType===_.promise?n.data:Promise.resolve(n.data);return ee(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}gt.create=(t,e)=>new gt(d({type:t,typeName:w.ZodPromise},S(e)));class ye extends T{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===w.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{p(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(r.data,a);if(r.common.async)return Promise.resolve(i).then(o=>Ee(this,null,function*(){if(n.value==="aborted")return E;const u=yield this._def.schema._parseAsync({data:o,path:r.path,parent:r});return u.status==="aborted"?E:u.status==="dirty"||n.value==="dirty"?fn(u.value):u}));{if(n.value==="aborted")return E;const o=this._def.schema._parseSync({data:i,path:r.path,parent:r});return o.status==="aborted"?E:o.status==="dirty"||n.value==="dirty"?fn(o.value):o}}if(s.type==="refinement"){const i=o=>{const u=s.refinement(o,a);if(r.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?E:(o.status==="dirty"&&n.dirty(),i(o.value),{status:n.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?E:(o.status==="dirty"&&n.dirty(),i(o.value).then(()=>({status:n.value,value:o.value}))))}if(s.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Xe(i))return i;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>Xe(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:n.value,value:o})):i);C.assertNever(s)}}ye.create=(t,e,n)=>new ye(d({schema:t,typeName:w.ZodEffects,effect:e},S(n)));ye.createWithPreprocess=(t,e,n)=>new ye(d({schema:e,effect:{type:"preprocess",transform:t},typeName:w.ZodEffects},S(n)));class ke extends T{_parse(e){return this._getType(e)===_.undefined?ee(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ke.create=(t,e)=>new ke(d({innerType:t,typeName:w.ZodOptional},S(e)));class We extends T{_parse(e){return this._getType(e)===_.null?ee(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}We.create=(t,e)=>new We(d({innerType:t,typeName:w.ZodNullable},S(e)));class zt extends T{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===_.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}zt.create=(t,e)=>new zt(d({innerType:t,typeName:w.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default},S(e)));class Vt extends T{_parse(e){const{ctx:n}=this._processInputParams(e),r=k(d({},n),{common:k(d({},n.common),{issues:[]})}),s=this._def.innerType._parse({data:r.data,path:r.path,parent:d({},r)});return Nt(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new ie(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new ie(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Vt.create=(t,e)=>new Vt(d({innerType:t,typeName:w.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},S(e)));class gn extends T{_parse(e){if(this._getType(e)!==_.nan){const n=this._getOrReturnCtx(e);return p(n,{code:l.invalid_type,expected:_.nan,received:n.parsedType}),E}return{status:"valid",value:e.data}}}gn.create=t=>new gn(d({typeName:w.ZodNaN},S(t)));const Za=Symbol("zod_brand");class Or extends T{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Gt extends T{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return Ee(this,null,function*(){const s=yield this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?E:s.status==="dirty"?(n.dirty(),fn(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})});{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?E:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new Gt({in:e,out:n,typeName:w.ZodPipeline})}}class Ut extends T{_parse(e){const n=this._def.innerType._parse(e),r=s=>(Xe(s)&&(s.value=Object.freeze(s.value)),s);return Nt(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}Ut.create=(t,e)=>new Ut(d({innerType:t,typeName:w.ZodReadonly},S(e)));function As(t,e={},n){return t?yt.create().superRefine((r,s)=>{var a,i;if(!t(r)){const o=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,u=(i=(a=o.fatal)!==null&&a!==void 0?a:n)!==null&&i!==void 0?i:!0,c=typeof o=="string"?{message:o}:o;s.addIssue(k(d({code:"custom"},c),{fatal:u}))}}):yt.create()}const Da={object:$.lazycreate};var w;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(w||(w={}));const Ma=(t,e={message:`Input not instance of ${t.name}`})=>As(n=>n instanceof t,e),Cs=pe.create,Rs=Le.create,La=gn.create,$a=$e.create,Ps=jt.create,Fa=Ye.create,Wa=pn.create,za=It.create,Va=Zt.create,Ua=yt.create,Ba=Je.create,qa=je.create,Ka=mn.create,Ha=me.create,Ga=$.create,Ja=$.strictCreate,Xa=Dt.create,Ya=kn.create,Qa=Mt.create,ei=Se.create,ti=Lt.create,ni=yn.create,ri=Qe.create,si=ht.create,ai=$t.create,ii=Ft.create,oi=Fe.create,ui=Wt.create,ci=gt.create,Gr=ye.create,di=ke.create,li=We.create,fi=ye.createWithPreprocess,hi=Gt.create,pi=()=>Cs().optional(),mi=()=>Rs().optional(),yi=()=>Ps().optional(),gi={string:t=>pe.create(k(d({},t),{coerce:!0})),number:t=>Le.create(k(d({},t),{coerce:!0})),boolean:t=>jt.create(k(d({},t),{coerce:!0})),bigint:t=>$e.create(k(d({},t),{coerce:!0})),date:t=>Ye.create(k(d({},t),{coerce:!0}))},_i=E;var fe=Object.freeze({__proto__:null,defaultErrorMap:mt,setErrorMap:fa,getErrorMap:dn,makeIssue:ln,EMPTY_PATH:ha,addIssueToContext:p,ParseStatus:G,INVALID:E,DIRTY:fn,OK:ee,isAborted:qn,isDirty:Kn,isValid:Xe,isAsync:Nt,get util(){return C},get objectUtil(){return Bn},ZodParsedType:_,getParsedType:Pe,ZodType:T,datetimeRegex:Os,ZodString:pe,ZodNumber:Le,ZodBigInt:$e,ZodBoolean:jt,ZodDate:Ye,ZodSymbol:pn,ZodUndefined:It,ZodNull:Zt,ZodAny:yt,ZodUnknown:Je,ZodNever:je,ZodVoid:mn,ZodArray:me,ZodObject:$,ZodUnion:Dt,ZodDiscriminatedUnion:kn,ZodIntersection:Mt,ZodTuple:Se,ZodRecord:Lt,ZodMap:yn,ZodSet:Qe,ZodFunction:ht,ZodLazy:$t,ZodLiteral:Ft,ZodEnum:Fe,ZodNativeEnum:Wt,ZodPromise:gt,ZodEffects:ye,ZodTransformer:ye,ZodOptional:ke,ZodNullable:We,ZodDefault:zt,ZodCatch:Vt,ZodNaN:gn,BRAND:Za,ZodBranded:Or,ZodPipeline:Gt,ZodReadonly:Ut,custom:As,Schema:T,ZodSchema:T,late:Da,get ZodFirstPartyTypeKind(){return w},coerce:gi,any:Ua,array:Ha,bigint:$a,boolean:Ps,date:Fa,discriminatedUnion:Ya,effect:Gr,enum:oi,function:si,instanceof:Ma,intersection:Qa,lazy:ai,literal:ii,map:ni,nan:La,nativeEnum:ui,never:qa,null:Va,nullable:li,number:Rs,object:Ga,oboolean:yi,onumber:mi,optional:di,ostring:pi,pipeline:hi,preprocess:fi,promise:ci,record:ti,set:ri,strictObject:Ja,string:Cs,symbol:Wa,transformer:Gr,tuple:ei,undefined:za,union:Xa,unknown:Ba,void:Ka,NEVER:_i,ZodIssueCode:l,quotelessJson:la,ZodError:ie});fe.object({language:fe.enum(["typescript","javascript"]).optional()}).and(fe.union([fe.object({framework:fe.literal("react"),styling:fe.enum(["plain_css","css_modules","styled_components","tailwind","sass","scss","inline_styles"]),uiLibrary:fe.enum(["mui","antd","radix","shadcn"]).optional()}),fe.object({framework:fe.literal("html"),styling:fe.enum(["plain_css","inline_styles"]),enableTranslation:fe.boolean().optional()})]));const vi=t=>Object.entries(t).reduce((e,[n,r])=>(e[n]={content:r.code,isBinary:!1},e),{});var bi=Object.defineProperty,wi=Object.defineProperties,ki=Object.getOwnPropertyDescriptors,Jr=Object.getOwnPropertySymbols,Ei=Object.prototype.hasOwnProperty,xi=Object.prototype.propertyIsEnumerable,Xr=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ns=t=>{throw TypeError(t)},Yr=(t,e,n)=>e in t?bi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ae=(t,e)=>{for(var n in e||(e={}))Ei.call(e,n)&&Yr(t,n,e[n]);if(Jr)for(var n of Jr(e))xi.call(e,n)&&Yr(t,n,e[n]);return t},Tr=(t,e)=>wi(t,ki(e)),Ar=(t,e,n)=>e.has(t)||Ns("Cannot "+n),P=(t,e,n)=>(Ar(t,e,"read from private field"),n?n.call(t):e.get(t)),de=(t,e,n)=>e.has(t)?Ns("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),H=(t,e,n,r)=>(Ar(t,e,"write to private field"),e.set(t,n),n),be=(t,e,n)=>(Ar(t,e,"access private method"),n),z=(t,e,n)=>new Promise((r,s)=>{var a=u=>{try{o(n.next(u))}catch(c){s(c)}},i=u=>{try{o(n.throw(u))}catch(c){s(c)}},o=u=>u.done?r(u.value):Promise.resolve(u.value).then(a,i);o((n=n.apply(t,e)).next())}),Si=(t,e,n)=>(e=t[Xr("asyncIterator")])?e.call(t):(t=t[Xr("iterator")](),e={},n=(r,s)=>(s=t[r])&&(e[r]=a=>new Promise((i,o,u)=>(a=s.call(t,a),u=a.done,Promise.resolve(a.value).then(c=>i({value:c,done:u}),o)))),n("next"),n("return"),e),Oi=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Ti(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Gn={exports:{}},Ai=Gn.exports,Qr;function Ci(){return Qr||(Qr=1,function(t,e){(function(n,r){t.exports=r()})(Ai,function(){var n=typeof Promise=="function",r=typeof self=="object"?self:Oi,s=typeof Symbol!="undefined",a=typeof Map!="undefined",i=typeof Set!="undefined",o=typeof WeakMap!="undefined",u=typeof WeakSet!="undefined",c=typeof DataView!="undefined",h=s&&typeof Symbol.iterator!="undefined",f=s&&typeof Symbol.toStringTag!="undefined",m=i&&typeof Set.prototype.entries=="function",g=a&&typeof Map.prototype.entries=="function",x=m&&Object.getPrototypeOf(new Set().entries()),y=g&&Object.getPrototypeOf(new Map().entries()),O=h&&typeof Array.prototype[Symbol.iterator]=="function",v=O&&Object.getPrototypeOf([][Symbol.iterator]()),U=h&&typeof String.prototype[Symbol.iterator]=="function",W=U&&Object.getPrototypeOf(""[Symbol.iterator]()),te=8,B=-1;function J(D){var M=typeof D;if(M!=="object")return M;if(D===null)return"null";if(D===r)return"global";if(Array.isArray(D)&&(f===!1||!(Symbol.toStringTag in D)))return"Array";if(typeof window=="object"&&window!==null){if(typeof window.location=="object"&&D===window.location)return"Location";if(typeof window.document=="object"&&D===window.document)return"Document";if(typeof window.navigator=="object"){if(typeof window.navigator.mimeTypes=="object"&&D===window.navigator.mimeTypes)return"MimeTypeArray";if(typeof window.navigator.plugins=="object"&&D===window.navigator.plugins)return"PluginArray"}if((typeof window.HTMLElement=="function"||typeof window.HTMLElement=="object")&&D instanceof window.HTMLElement){if(D.tagName==="BLOCKQUOTE")return"HTMLQuoteElement";if(D.tagName==="TD")return"HTMLTableDataCellElement";if(D.tagName==="TH")return"HTMLTableHeaderCellElement"}}var Oe=f&&D[Symbol.toStringTag];if(typeof Oe=="string")return Oe;var I=Object.getPrototypeOf(D);return I===RegExp.prototype?"RegExp":I===Date.prototype?"Date":n&&I===Promise.prototype?"Promise":i&&I===Set.prototype?"Set":a&&I===Map.prototype?"Map":u&&I===WeakSet.prototype?"WeakSet":o&&I===WeakMap.prototype?"WeakMap":c&&I===DataView.prototype?"DataView":a&&I===y?"Map Iterator":i&&I===x?"Set Iterator":O&&I===v?"Array Iterator":U&&I===W?"String Iterator":I===null?"Object":Object.prototype.toString.call(D).slice(te,B)}return J})}(Gn)),Gn.exports}var Ri=Ci();const Pi=Ti(Ri),Cr=typeof Buffer!="undefined",Ni=Cr&&typeof Buffer.from!="undefined",ji=Cr?function(t){return Buffer.isBuffer(t)}:function(){return!1},Ii=Ni?function(t){return Buffer.from(t)}:Cr?function(t){return new Buffer(t)}:function(t){return t};function _t(t){return ji(t)?"Buffer":Pi(t)}const Zi=new Set(["Arguments","Array","Map","Object","Set"]);function Di(t,e,n=null){switch(n||_t(t)){case"Arguments":case"Array":case"Object":return t[e];case"Map":return t.get(e);case"Set":return e}}function Jn(t){return Zi.has(t)}function es(t,e,n,r=null){switch(r||_t(t)){case"Arguments":case"Array":case"Object":t[e]=n;break;case"Map":t.set(e,n);break;case"Set":t.add(n);break}return t}const Mi=typeof globalThis!="undefined"&&globalThis!==null&&globalThis.Object===Object&&globalThis,Li=typeof global!="undefined"&&global!==null&&global.Object===Object&&global,$i=typeof self!="undefined"&&self!==null&&self.Object===Object&&self,Pn=Mi||Li||$i||Function("return this")();function Fi(t){return t.slice(0)}function Wi(t){return new Boolean(t.valueOf())}function zi(t){return new DataView(t.buffer)}function Vi(t){return Ii(t)}function Ui(t){return new Date(t.getTime())}function Bi(t){return new Number(t)}function qi(t){return new RegExp(t.source,t.flags)}function Ki(t){return new String(t)}function Ce(t,e){return Pn[e].from?Pn[e].from(t):new Pn[e](t)}function Y(t){return t}function ts(){return[]}function Hi(){return new Map}function Gi(){return{}}function Ji(){return new Set}const Xi=new Map([["ArrayBuffer",Fi],["Boolean",Wi],["Buffer",Vi],["DataView",zi],["Date",Ui],["Number",Bi],["RegExp",qi],["String",Ki],["Float32Array",Ce],["Float64Array",Ce],["Int16Array",Ce],["Int32Array",Ce],["Int8Array",Ce],["Uint16Array",Ce],["Uint32Array",Ce],["Uint8Array",Ce],["Uint8ClampedArray",Ce],["Array Iterator",Y],["Map Iterator",Y],["Promise",Y],["Set Iterator",Y],["String Iterator",Y],["function",Y],["global",Y],["WeakMap",Y],["WeakSet",Y],["boolean",Y],["null",Y],["number",Y],["string",Y],["symbol",Y],["undefined",Y],["Arguments",ts],["Array",ts],["Map",Hi],["Object",Gi],["Set",Ji]]);function Yi(){}function Xn(t,e=null,n=Yi){arguments.length===2&&typeof e=="function"&&(n=e,e=null);const r=e||_t(t),s=Xi.get(r);if(r==="Object"){const a=n(t,r);if(a!==void 0)return a}return s?s(t,r):t}function kt(t,e={}){typeof e=="function"&&(e={customizer:e});const{customizer:n}=e,r=_t(t);if(!Jn(r))return Yn(t,null,null,null);const s=Xn(t,r,n),a=new WeakMap([[t,s]]),i=new WeakSet([t]);return Yn(t,s,a,i)}function Yn(t,e,n,r,s){const a=_t(t),i=Xn(t,a);if(!Jn(a))return i;let o;switch(a){case"Arguments":case"Array":o=Object.keys(t);break;case"Object":o=Object.keys(t),o.push(...Object.getOwnPropertySymbols(t));break;case"Map":case"Set":o=t.keys();break}for(let u of o){const c=Di(t,u,a);if(r.has(c))es(e,u,n.get(c),a);else{const h=_t(c),f=Xn(c,h);Jn(h)&&(n.set(c,f),r.add(c)),es(e,u,Yn(c,f,n,r),a)}}return e}const Qi=t=>new Promise(e=>setTimeout(e,t));var sn,Ke,an,Qn,js;class eo{constructor({maxAttempts:e=3,func:n}){de(this,Qn),de(this,sn),de(this,Ke),de(this,an),H(this,sn,e),H(this,an,n),H(this,Ke,0)}run(){return z(this,null,function*(){try{return yield P(this,an).call(this)}catch(e){if(H(this,Ke,P(this,Ke)+1),P(this,Ke)>P(this,sn))throw console.error("Max attempts reached"),e;const n=be(this,Qn,js).call(this);return yield Qi(n),yield this.run()}})}}sn=new WeakMap,Ke=new WeakMap,an=new WeakMap,Qn=new WeakSet,js=function(){return P(this,Ke)*1e3*1.5};function to(){return typeof CompressionStream!="undefined"}function no(t){return z(this,null,function*(){const e=new Blob([t]).stream().pipeThrough(new CompressionStream("gzip")),n=[];try{for(var r=Si(e),s,a,i;s=!(a=yield r.next()).done;s=!1){const o=a.value;n.push(o)}}catch(o){i=[o]}finally{try{s&&(a=r.return)&&(yield a.call(r))}finally{if(i)throw i[0]}}return yield ro(n)})}function ro(t){return z(this,null,function*(){const e=yield new Blob(t).arrayBuffer();return new Uint8Array(e)})}class so extends Error{constructor({resource:e,api:n,args:r,cause:s}){if(super(`API Error on resource "${e}" at api "${n}"`),this.causeProperties={},this.name="API Error",this.resource=e,this.api=n,this.cause=s,this.args=r,s instanceof Error)for(const[i,o]of Object.entries(s))if(typeof Headers!="undefined"&&o instanceof Headers){const u={};o.forEach((c,h)=>{u[h]=c}),this.causeProperties[i]=u}else this.causeProperties[i]=o;const a=this.causeProperties.body;a&&typeof a=="object"&&"code"in a&&(this.code=a.code)}}class ns extends Error{constructor({url:e,method:n,statusCode:r,requestHeaders:s,responseHeaders:a,body:i}){if(super("Fetch Error"),this.name="Fetch Error",this.url=e,this.method=n,this.statusNumber=r,this.requestHeaders=s,this.responseHeaders=a,i)try{const o=JSON.parse(i);this.body=o}catch(o){this.body=i}}}class St extends Error{constructor(e={}){const{canceled:n=!1}=e;super("Abort Error"),this.name="Abort Error",this.canceled=n}}class ao extends Error{constructor(e){super(`Async API Error: ${JSON.stringify(e)}`),this.name="Async API Error",this.body=e}}class Nn extends Error{constructor(e){super(e),this.name="Request Validation Error"}}function Is(){return Array.from({length:32},()=>Math.floor(Math.random()*256).toString(16).padStart(2,"0")).join("")}function er(){return Math.floor(Date.now()/1e3).toString()}const io=5*60*1e3,oo=1*1e3;var He,ne,_e,tr,nr,Ot;class uo{constructor({fetch:e=globalThis.fetch.bind(globalThis),baseAddress:n}){de(this,_e),de(this,He),de(this,ne),this.baseAddress=n,H(this,He,e),H(this,ne,{}),this.plugins=[]}get headers(){throw new Error("Missing implementation")}addPlugin(e){this.plugins.push(e)}removePlugin(e){this.plugins=this.plugins.filter(n=>n.name!==e)}withOptions(e={}){return H(this,ne,e),this}get(e){return z(this,arguments,function*(n,r={}){const{overrideBaseAddress:s,overrideDefaultHeaders:a}=r,i=s!=null?s:this.baseAddress;let o=a!=null?a:this.headers;const u=kt(P(this,ne));return H(this,ne,{}),u.extraHeaders&&(o=ae(ae({},o),u.extraHeaders)),u.requestValidation&&(o=Tr(ae({},o),{"X-Request-Nonce":Is(),"X-Request-Timestamp":er()})),u.async?yield be(this,_e,nr).call(this,`${i}${n}`,u.async,{headers:o}):yield be(this,_e,tr).call(this,`${i}${n}`,u,{headers:o})})}post(e,n){return z(this,arguments,function*(r,s,a={}){const i=kt(P(this,ne));return H(this,ne,{}),be(this,_e,Ot).call(this,r,"POST",s,a,i)})}put(e,n){return z(this,arguments,function*(r,s,a={}){const i=kt(P(this,ne));return H(this,ne,{}),be(this,_e,Ot).call(this,r,"PUT",s,a,i)})}delete(e,n){return z(this,arguments,function*(r,s,a={}){const i=kt(P(this,ne));return H(this,ne,{}),be(this,_e,Ot).call(this,r,"DELETE",s,a,i)})}patch(e,n){return z(this,arguments,function*(r,s,a={}){const i=kt(P(this,ne));return H(this,ne,{}),be(this,_e,Ot).call(this,r,"PATCH",s,a,i)})}}He=new WeakMap,ne=new WeakMap,_e=new WeakSet,tr=function(t,e,n){return z(this,null,function*(){const r=()=>z(this,null,function*(){var u,c;try{return yield P(this,He).call(this,t,ae(ae({},n),e.abortSignal&&{signal:e.abortSignal}))}catch(h){throw h instanceof Error&&h.name==="AbortError"?new St({canceled:(c=(u=e.abortSignal)==null?void 0:u.aborted)!=null?c:!1}):h}}),{headers:s}=n!=null?n:{},a=(u,c)=>{var h,f;return((h=u==null?void 0:u.headers)==null?void 0:h.get(c))||((f=u==null?void 0:u.headersObject)==null?void 0:f[c])||""},i=u=>z(this,null,function*(){var c;if(!u.ok){const f=yield u.text().catch();throw new ns({url:t,method:(c=n==null?void 0:n.method)!=null?c:"GET",statusCode:u.status,requestHeaders:s,responseHeaders:u.headers,body:f})}if(e.requestValidation&&process.env.UI_TESTS!==!0)try{const f=a(u,"x-response-nonce"),m=s==null?void 0:s["X-Request-Nonce"];if(!f||f!==m)throw new Nn("Response nonce mismatch");const g=Number(a(u,"x-response-timestamp")),x=Number(er()),y=60*60*24;if(isNaN(g)||Math.abs(x-g)>y)throw new Nn("Invalid response timestamp")}catch(f){const m=f instanceof Error?f.message:"Request validation failed";throw new Nn(m)}let h=yield u.text();try{h=JSON.parse(h)}catch(f){}return h});if(e.retry){const u=yield new eo({maxAttempts:e.retry,func:r}).run();return yield i(u)}const o=yield r();return yield i(o)})},nr=function(t,e,n){return z(this,null,function*(){var r,s;const{onProgress:a,abortSignal:i,pollingInterval:o=()=>oo,maxTimeout:u=io}=e,c=`${t}/async`,h=`${t}/async/job`;let f;try{f=yield P(this,He).call(this,c,ae(ae({},n),i&&{signal:i}))}catch(x){throw x instanceof Error&&x.name==="AbortError"?new St({canceled:(r=i==null?void 0:i.aborted)!=null?r:!1}):x}if(!f.ok){const x=yield f.text().catch();throw new ns({url:t,method:(s=n==null?void 0:n.method)!=null?s:"GET",statusCode:f.status,requestHeaders:this.headers,responseHeaders:f.headers,body:x})}const m=yield f.json(),{job_id:g}=m;if(!g)throw new Error("Job ID not found in response");return new Promise((x,y)=>z(this,null,function*(){const O=setTimeout(()=>{y(new Error("Job timed out"))},u),v=(U=0)=>z(this,null,function*(){if(i!=null&&i.aborted){clearTimeout(O),P(this,He).call(this,`${h}/${g}/cancel`,{method:"POST",headers:this.headers}).then(()=>{y(new St({canceled:!0}))}).catch(W=>{y(new St({canceled:!1}))});return}try{const W=yield(yield P(this,He).call(this,`${h}/${g}`,{headers:this.headers})).json();if(W.status==="success"){clearTimeout(O);const te=W.response_json;x(te)}else if(W.status==="failed")clearTimeout(O),y(new ao(W.response_json));else{a&&a(W.response_json);const te=o(U);setTimeout(()=>v(U+1),te)}}catch(W){y(W)}});v()}))})},Ot=function(t,e,n,r,s){return z(this,null,function*(){const{overrideBaseAddress:a,overrideDefaultHeaders:i}=r,o=a!=null?a:this.baseAddress;let u=i!=null?i:this.headers;s.extraHeaders&&(u=ae(ae({},u),s.extraHeaders)),s.requestValidation&&(u=Tr(ae({},u),{"X-Request-Nonce":Is(),"X-Request-Timestamp":er()}));let c=r.skipBodyJsonStringify?n:JSON.stringify(n);return s.compress&&to()&&(u["Content-Encoding"]="gzip",c=yield no(c)),s.async?yield be(this,_e,nr).call(this,`${o}${t}`,s.async,{method:e,headers:u,body:c}):yield be(this,_e,tr).call(this,`${o}${t}`,s,{method:e,headers:u,body:c})})};const rs=(t,e,n,r)=>t instanceof St?t:new so({resource:e,api:String(n),args:r,cause:t}),jn=(t,e)=>new Proxy(e,{get(n,r){return(...s)=>{var a;for(const o of t.plugins){const u=(a=o.beforeApi)==null?void 0:a.call(o,{resource:n.resourceName,api:r,args:s});if(u!==void 0)return u}let i;try{i=n[r](...s)}catch(o){throw rs(o,n.resourceName,r,s)}return i instanceof Promise?i.catch(o=>{throw rs(o,n.resourceName,r,s)}):i}}});var Tt;class co{constructor(e){de(this,Tt),this.resourceName="Files",H(this,Tt,e)}get(e){return z(this,arguments,function*({fileKey:n,params:r={}}){const s=new URLSearchParams(ae({plugin_data:"857346721138427857"},r)).toString(),a=`v1/files/${n}?${s}`;return yield P(this,Tt).get(a)})}getImageFills(e){return z(this,arguments,function*({fileKey:n}){var r,s;const a=`v1/files/${n}/images`;return(s=(r=(yield P(this,Tt).get(a)).meta)==null?void 0:r.images)!=null?s:{}})}}Tt=new WeakMap;const lo=(t,e,n)=>{const r=e.sort();return`${t}-${r.join("-")}-${n}`},fo=t=>t?t.ts>Date.now()-1e3*30:!1;var ve,rr,Zs;class ho{constructor(e){de(this,rr),de(this,ve),this.resourceName="Images",H(this,ve,e)}get(e){return z(this,arguments,function*({fileKey:n,nodeIds:r,format:s="jpg",scale:a}){const i=lo(n,r,s),o=P(this,ve).cache.images.entries.get(i);if(fo(o))return o.result;o&&P(this,ve).cache.images.entries.delete(i);const u=P(this,ve).cache.images.pendingRequests.get(i);if(u)return u;const c=be(this,rr,Zs).call(this,i,n,r,s,a);P(this,ve).cache.images.pendingRequests.set(i,c);try{return yield c}finally{P(this,ve).cache.images.pendingRequests.delete(i)}})}}ve=new WeakMap,rr=new WeakSet,Zs=function(t,e,n,r,s){return z(this,null,function*(){const a=yield P(this,ve).get(`v1/images/${e}?ids=${n}&format=${r}${s?`&scale=${s}`:""}`);return P(this,ve).cache.images.entries.set(t,{result:a,ts:Date.now()}),a})};var on;class po{constructor(e){de(this,on),this.resourceName="Nodes",H(this,on,e)}get(e){return z(this,arguments,function*({fileKey:n,nodeIds:r,params:s={}}){const a=Tr(ae({},s),{ids:r.join(",")}),i=new URLSearchParams(ae({plugin_data:"857346721138427857"},a)).toString(),o=`v1/files/${n}/nodes?${i}`;return yield P(this,on).get(o)})}}on=new WeakMap;var Ze;class mo extends uo{constructor({baseAddress:e="https://api.figma.com/",fetch:n=globalThis.fetch.bind(globalThis)}={}){super({fetch:n,baseAddress:e}),de(this,Ze,""),this.cache={images:{entries:new Map,pendingRequests:new Map}},this.files=jn(this,new co(this)),this.nodes=jn(this,new po(this)),this.images=jn(this,new ho(this))}set token(e){if(!e.startsWith("figd_")&&!e.startsWith("figu_"))throw new Error("Invalid Figma access token");H(this,Ze,e)}get token(){return P(this,Ze)}get headers(){const e={"Content-Type":"application/json"};return P(this,Ze).startsWith("figd_")?e["X-FIGMA-TOKEN"]=P(this,Ze):P(this,Ze).startsWith("figu_")&&(e.Authorization=`Bearer ${P(this,Ze)}`),e}}Ze=new WeakMap;const yo=t=>Ee(void 0,[t],function*({fileKey:e,authToken:n,figmaRestApi:r=new mo,params:s={}}){n&&(r.token=n);try{return yield r.files.get({fileKey:e,params:s})}catch(a){throw console.error(a),a}});var go=Object.defineProperty,_o=(t,e,n)=>e in t?go(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,en=(t,e,n)=>_o(t,typeof e!="symbol"?e+"":e,n);class ss extends Error{constructor(e,n){super(e),en(this,"type"),en(this,"field"),en(this,"value"),en(this,"line"),this.name="ParseError",this.type=n.type,this.field=n.field,this.value=n.value,this.line=n.line}}function In(t){}function vo(t){const{onEvent:e=In,onError:n=In,onRetry:r=In,onComment:s}=t;let a="",i=!0,o,u="",c="";function h(y){const O=i?y.replace(/^\xEF\xBB\xBF/,""):y,[v,U]=bo(`${a}${O}`);for(const W of v)f(W);a=U,i=!1}function f(y){if(y===""){g();return}if(y.startsWith(":")){s&&s(y.slice(y.startsWith(": ")?2:1));return}const O=y.indexOf(":");if(O!==-1){const v=y.slice(0,O),U=y[O+1]===" "?2:1,W=y.slice(O+U);m(v,W,y);return}m(y,"",y)}function m(y,O,v){switch(y){case"event":c=O;break;case"data":u=`${u}${O}
2
- `;break;case"id":o=O.includes("\0")?void 0:O;break;case"retry":/^\d+$/.test(O)?r(parseInt(O,10)):n(new ss(`Invalid \`retry\` value: "${O}"`,{type:"invalid-retry",value:O,line:v}));break;default:n(new ss(`Unknown field "${y.length>20?`${y.slice(0,20)}…`:y}"`,{type:"unknown-field",field:y,value:O,line:v}));break}}function g(){u.length>0&&e({id:o,event:c||void 0,data:u.endsWith(`
3
- `)?u.slice(0,-1):u}),o=void 0,u="",c=""}function x(y={}){a&&y.consume&&f(a),o=void 0,u="",c="",a=""}return{feed:h,reset:x}}function bo(t){const e=[];let n="";const r=t.length;for(let s=0;s<r;s++){const a=t[s];a==="\r"&&t[s+1]===`
1
+ "use strict";var ta=Object.defineProperty,na=Object.defineProperties;var ra=Object.getOwnPropertyDescriptors;var Vr=Object.getOwnPropertySymbols;var sa=Object.prototype.hasOwnProperty,aa=Object.prototype.propertyIsEnumerable;var Ur=(t,e,n)=>e in t?ta(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Be=(t,e)=>{for(var n in e||(e={}))sa.call(e,n)&&Ur(t,n,e[n]);if(Vr)for(var n of Vr(e))aa.call(e,n)&&Ur(t,n,e[n]);return t},Br=(t,e)=>na(t,ra(e));var qe=(t,e,n)=>new Promise((r,s)=>{var a=u=>{try{o(n.next(u))}catch(c){s(c)}},i=u=>{try{o(n.throw(u))}catch(c){s(c)}},o=u=>u.done?r(u.value):Promise.resolve(u.value).then(a,i);o((n=n.apply(t,e)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const F=require("react"),ia=t=>{for(var e="",n=new Uint8Array(t),r=n.byteLength,s=0;s<r;s++)e+=String.fromCharCode(n[s]);return btoa(e)};var oa=Object.defineProperty,ua=Object.defineProperties,ca=Object.getOwnPropertyDescriptors,qr=Object.getOwnPropertySymbols,da=Object.prototype.hasOwnProperty,la=Object.prototype.propertyIsEnumerable,Kr=(t,e,n)=>e in t?oa(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,d=(t,e)=>{for(var n in e||(e={}))da.call(e,n)&&Kr(t,n,e[n]);if(qr)for(var n of qr(e))la.call(e,n)&&Kr(t,n,e[n]);return t},x=(t,e)=>ua(t,ca(e)),Se=(t,e,n)=>new Promise((r,s)=>{var a=u=>{try{o(n.next(u))}catch(c){s(c)}},i=u=>{try{o(n.throw(u))}catch(c){s(c)}},o=u=>u.done?r(u.value):Promise.resolve(u.value).then(a,i);o((n=n.apply(t,e)).next())});const fa=t=>Object.entries(t).reduce((e,[n,r])=>(e[n]={content:r.code,isBinary:!1},e),{});var C;(function(t){t.assertEqual=s=>s;function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const a={};for(const i of s)a[i]=i;return a},t.getValidEnumValues=s=>{const a=t.objectKeys(s).filter(o=>typeof s[s[o]]!="number"),i={};for(const o of a)i[o]=s[o];return t.objectValues(i)},t.objectValues=s=>t.objectKeys(s).map(function(a){return s[a]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const a=[];for(const i in s)Object.prototype.hasOwnProperty.call(s,i)&&a.push(i);return a},t.find=(s,a)=>{for(const i of s)if(a(i))return i},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function r(s,a=" | "){return s.map(i=>typeof i=="string"?`'${i}'`:i).join(a)}t.joinValues=r,t.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(C||(C={}));var Bn;(function(t){t.mergeShapes=(e,n)=>d(d({},e),n)})(Bn||(Bn={}));const _=C.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Re=t=>{switch(typeof t){case"undefined":return _.undefined;case"string":return _.string;case"number":return isNaN(t)?_.nan:_.number;case"boolean":return _.boolean;case"function":return _.function;case"bigint":return _.bigint;case"symbol":return _.symbol;case"object":return Array.isArray(t)?_.array:t===null?_.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?_.promise:typeof Map!="undefined"&&t instanceof Map?_.map:typeof Set!="undefined"&&t instanceof Set?_.set:typeof Date!="undefined"&&t instanceof Date?_.date:_.object;default:return _.unknown}},f=C.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"]),ha=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:");class oe extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(a){return a.message},r={_errors:[]},s=a=>{for(const i of a.issues)if(i.code==="invalid_union")i.unionErrors.map(s);else if(i.code==="invalid_return_type")s(i.returnTypeError);else if(i.code==="invalid_arguments")s(i.argumentsError);else if(i.path.length===0)r._errors.push(n(i));else{let o=r,u=0;for(;u<i.path.length;){const c=i.path[u];u===i.path.length-1?(o[c]=o[c]||{_errors:[]},o[c]._errors.push(n(i))):o[c]=o[c]||{_errors:[]},o=o[c],u++}}};return s(this),r}static assert(e){if(!(e instanceof oe))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,C.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)s.path.length>0?(n[s.path[0]]=n[s.path[0]]||[],n[s.path[0]].push(e(s))):r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}oe.create=t=>new oe(t);const mt=(t,e)=>{let n;switch(t.code){case f.invalid_type:t.received===_.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case f.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,C.jsonStringifyReplacer)}`;break;case f.unrecognized_keys:n=`Unrecognized key(s) in object: ${C.joinValues(t.keys,", ")}`;break;case f.invalid_union:n="Invalid input";break;case f.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${C.joinValues(t.options)}`;break;case f.invalid_enum_value:n=`Invalid enum value. Expected ${C.joinValues(t.options)}, received '${t.received}'`;break;case f.invalid_arguments:n="Invalid function arguments";break;case f.invalid_return_type:n="Invalid function return type";break;case f.invalid_date:n="Invalid date";break;case f.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:C.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case f.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case f.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case f.custom:n="Invalid input";break;case f.invalid_intersection_types:n="Intersection results could not be merged";break;case f.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case f.not_finite:n="Number must be finite";break;default:n=e.defaultError,C.assertNever(t)}return{message:n}};let ks=mt;function pa(t){ks=t}function dn(){return ks}const ln=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,a=[...n,...s.path||[]],i=x(d({},s),{path:a});if(s.message!==void 0)return x(d({},s),{path:a,message:s.message});let o="";const u=r.filter(c=>!!c).slice().reverse();for(const c of u)o=c(i,{data:e,defaultError:o}).message;return x(d({},s),{path:a,message:o})},ma=[];function y(t,e){const n=dn(),r=ln({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===mt?void 0:mt].filter(s=>!!s)});t.common.issues.push(r)}class J{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const s of n){if(s.status==="aborted")return E;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static mergeObjectAsync(e,n){return Se(this,null,function*(){const r=[];for(const s of n){const a=yield s.key,i=yield s.value;r.push({key:a,value:i})}return J.mergeObjectSync(e,r)})}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:a,value:i}=s;if(a.status==="aborted"||i.status==="aborted")return E;a.status==="dirty"&&e.dirty(),i.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof i.value!="undefined"||s.alwaysSet)&&(r[a.value]=i.value)}return{status:e.value,value:r}}}const E=Object.freeze({status:"aborted"}),fn=t=>({status:"dirty",value:t}),te=t=>({status:"valid",value:t}),qn=t=>t.status==="aborted",Kn=t=>t.status==="dirty",Ye=t=>t.status==="valid",Pt=t=>typeof Promise!="undefined"&&t instanceof Promise;function hn(t,e,n,r){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e.get(t)}function Ss(t,e,n,r,s){if(typeof e=="function"?t!==e||!0:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n}var w;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(w||(w={}));var St,xt;class xe{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}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 Hr=(t,e)=>{if(Ye(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new oe(t.common.issues);return this._error=n,this._error}}};function O(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(a,i)=>{var o,u;const{message:c}=t;return a.code==="invalid_enum_value"?{message:c!=null?c:i.defaultError}:typeof i.data=="undefined"?{message:(o=c!=null?c:r)!==null&&o!==void 0?o:i.defaultError}:a.code!=="invalid_type"?{message:i.defaultError}:{message:(u=c!=null?c:n)!==null&&u!==void 0?u:i.defaultError}},description:s}}class T{get description(){return this._def.description}_getType(e){return Re(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Re(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:Re(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(Pt(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){var r;const s={common:{issues:[],async:(r=n==null?void 0:n.async)!==null&&r!==void 0?r:!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Re(e)},a=this._parseSync({data:e,path:s.path,parent:s});return Hr(s,a)}"~validate"(e){var n,r;const s={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Re(e)};if(!this["~standard"].async)try{const a=this._parseSync({data:e,path:[],parent:s});return Ye(a)?{value:a.value}:{issues:s.common.issues}}catch(a){!((r=(n=a==null?void 0:a.message)===null||n===void 0?void 0:n.toLowerCase())===null||r===void 0)&&r.includes("encountered")&&(this["~standard"].async=!0),s.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:s}).then(a=>Ye(a)?{value:a.value}:{issues:s.common.issues})}parseAsync(e,n){return Se(this,null,function*(){const r=yield this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error})}safeParseAsync(e,n){return Se(this,null,function*(){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Re(e)},s=this._parse({data:e,path:r.path,parent:r}),a=yield Pt(s)?s:Promise.resolve(s);return Hr(r,a)})}refine(e,n){const r=s=>typeof n=="string"||typeof n=="undefined"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,a)=>{const i=e(s),o=()=>a.addIssue(d({code:f.custom},r(s)));return typeof Promise!="undefined"&&i instanceof Promise?i.then(u=>u?!0:(o(),!1)):i?!0:(o(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new ye({schema:this,typeName:S.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:n=>this["~validate"](n)}}optional(){return ke.create(this,this._def)}nullable(){return We.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return me.create(this)}promise(){return gt.create(this,this._def)}or(e){return Dt.create([this,e],this._def)}and(e){return Mt.create(this,e,this._def)}transform(e){return new ye(x(d({},O(this._def)),{schema:this,typeName:S.ZodEffects,effect:{type:"transform",transform:e}}))}default(e){const n=typeof e=="function"?e:()=>e;return new zt(x(d({},O(this._def)),{innerType:this,defaultValue:n,typeName:S.ZodDefault}))}brand(){return new Or(d({typeName:S.ZodBranded,type:this},O(this._def)))}catch(e){const n=typeof e=="function"?e:()=>e;return new Vt(x(d({},O(this._def)),{innerType:this,catchValue:n,typeName:S.ZodCatch}))}describe(e){const n=this.constructor;return new n(x(d({},this._def),{description:e}))}pipe(e){return Gt.create(this,e)}readonly(){return Ut.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ya=/^c[^\s-]{8,}$/i,ga=/^[0-9a-z]+$/,_a=/^[0-9A-HJKMNP-TV-Z]{26}$/i,va=/^[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,ba=/^[a-z0-9_-]{21}$/i,wa=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ka=/^[-+]?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)?)??$/,Sa=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,xa="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Nn;const Ea=/^(?:(?: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])$/,Oa=/^(?:(?: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])$/,Ta=/^(([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]))$/,Aa=/^(([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])$/,Ca=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Na=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,xs="((\\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])))",Ra=new RegExp(`^${xs}$`);function Es(t){let e="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`),e}function Pa(t){return new RegExp(`^${Es(t)}$`)}function Os(t){let e=`${xs}T${Es(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function Ia(t,e){return!!((e==="v4"||!e)&&Ea.test(t)||(e==="v6"||!e)&&Ta.test(t))}function ja(t,e){if(!wa.test(t))return!1;try{const[n]=t.split("."),r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||!s.typ||!s.alg||e&&s.alg!==e)}catch(n){return!1}}function Za(t,e){return!!((e==="v4"||!e)&&Oa.test(t)||(e==="v6"||!e)&&Aa.test(t))}class pe extends T{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==_.string){const s=this._getOrReturnCtx(e);return y(s,{code:f.invalid_type,expected:_.string,received:s.parsedType}),E}const n=new J;let r;for(const s of this._def.checks)if(s.kind==="min")e.data.length<s.value&&(r=this._getOrReturnCtx(e,r),y(r,{code:f.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="max")e.data.length>s.value&&(r=this._getOrReturnCtx(e,r),y(r,{code:f.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!1,message:s.message}),n.dirty());else if(s.kind==="length"){const a=e.data.length>s.value,i=e.data.length<s.value;(a||i)&&(r=this._getOrReturnCtx(e,r),a?y(r,{code:f.too_big,maximum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}):i&&y(r,{code:f.too_small,minimum:s.value,type:"string",inclusive:!0,exact:!0,message:s.message}),n.dirty())}else if(s.kind==="email")Sa.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"email",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="emoji")Nn||(Nn=new RegExp(xa,"u")),Nn.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"emoji",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="uuid")va.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"uuid",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="nanoid")ba.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"nanoid",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid")ya.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"cuid",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="cuid2")ga.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"cuid2",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="ulid")_a.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"ulid",code:f.invalid_string,message:s.message}),n.dirty());else if(s.kind==="url")try{new URL(e.data)}catch(a){r=this._getOrReturnCtx(e,r),y(r,{validation:"url",code:f.invalid_string,message:s.message}),n.dirty()}else s.kind==="regex"?(s.regex.lastIndex=0,s.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"regex",code:f.invalid_string,message:s.message}),n.dirty())):s.kind==="trim"?e.data=e.data.trim():s.kind==="includes"?e.data.includes(s.value,s.position)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:{includes:s.value,position:s.position},message:s.message}),n.dirty()):s.kind==="toLowerCase"?e.data=e.data.toLowerCase():s.kind==="toUpperCase"?e.data=e.data.toUpperCase():s.kind==="startsWith"?e.data.startsWith(s.value)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:{startsWith:s.value},message:s.message}),n.dirty()):s.kind==="endsWith"?e.data.endsWith(s.value)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:{endsWith:s.value},message:s.message}),n.dirty()):s.kind==="datetime"?Os(s).test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:"datetime",message:s.message}),n.dirty()):s.kind==="date"?Ra.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:"date",message:s.message}),n.dirty()):s.kind==="time"?Pa(s).test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{code:f.invalid_string,validation:"time",message:s.message}),n.dirty()):s.kind==="duration"?ka.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"duration",code:f.invalid_string,message:s.message}),n.dirty()):s.kind==="ip"?Ia(e.data,s.version)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"ip",code:f.invalid_string,message:s.message}),n.dirty()):s.kind==="jwt"?ja(e.data,s.alg)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"jwt",code:f.invalid_string,message:s.message}),n.dirty()):s.kind==="cidr"?Za(e.data,s.version)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"cidr",code:f.invalid_string,message:s.message}),n.dirty()):s.kind==="base64"?Ca.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"base64",code:f.invalid_string,message:s.message}),n.dirty()):s.kind==="base64url"?Na.test(e.data)||(r=this._getOrReturnCtx(e,r),y(r,{validation:"base64url",code:f.invalid_string,message:s.message}),n.dirty()):C.assertNever(s);return{status:n.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),d({validation:n,code:f.invalid_string},w.errToObj(r)))}_addCheck(e){return new pe(x(d({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(d({kind:"email"},w.errToObj(e)))}url(e){return this._addCheck(d({kind:"url"},w.errToObj(e)))}emoji(e){return this._addCheck(d({kind:"emoji"},w.errToObj(e)))}uuid(e){return this._addCheck(d({kind:"uuid"},w.errToObj(e)))}nanoid(e){return this._addCheck(d({kind:"nanoid"},w.errToObj(e)))}cuid(e){return this._addCheck(d({kind:"cuid"},w.errToObj(e)))}cuid2(e){return this._addCheck(d({kind:"cuid2"},w.errToObj(e)))}ulid(e){return this._addCheck(d({kind:"ulid"},w.errToObj(e)))}base64(e){return this._addCheck(d({kind:"base64"},w.errToObj(e)))}base64url(e){return this._addCheck(d({kind:"base64url"},w.errToObj(e)))}jwt(e){return this._addCheck(d({kind:"jwt"},w.errToObj(e)))}ip(e){return this._addCheck(d({kind:"ip"},w.errToObj(e)))}cidr(e){return this._addCheck(d({kind:"cidr"},w.errToObj(e)))}datetime(e){var n,r;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:(n=e==null?void 0:e.offset)!==null&&n!==void 0?n:!1,local:(r=e==null?void 0:e.local)!==null&&r!==void 0?r:!1},w.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},w.errToObj(e==null?void 0:e.message)))}duration(e){return this._addCheck(d({kind:"duration"},w.errToObj(e)))}regex(e,n){return this._addCheck(d({kind:"regex",regex:e},w.errToObj(n)))}includes(e,n){return this._addCheck(d({kind:"includes",value:e,position:n==null?void 0:n.position},w.errToObj(n==null?void 0:n.message)))}startsWith(e,n){return this._addCheck(d({kind:"startsWith",value:e},w.errToObj(n)))}endsWith(e,n){return this._addCheck(d({kind:"endsWith",value:e},w.errToObj(n)))}min(e,n){return this._addCheck(d({kind:"min",value:e},w.errToObj(n)))}max(e,n){return this._addCheck(d({kind:"max",value:e},w.errToObj(n)))}length(e,n){return this._addCheck(d({kind:"length",value:e},w.errToObj(n)))}nonempty(e){return this.min(1,w.errToObj(e))}trim(){return new pe(x(d({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}toLowerCase(){return new pe(x(d({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new pe(x(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 n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}pe.create=t=>{var e;return new pe(d({checks:[],typeName:S.ZodString,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1},O(t)))};function Da(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,a=parseInt(t.toFixed(s).replace(".","")),i=parseInt(e.toFixed(s).replace(".",""));return a%i/Math.pow(10,s)}class Le extends T{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)!==_.number){const s=this._getOrReturnCtx(e);return y(s,{code:f.invalid_type,expected:_.number,received:s.parsedType}),E}let n;const r=new J;for(const s of this._def.checks)s.kind==="int"?C.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:f.invalid_type,expected:"integer",received:"float",message:s.message}),r.dirty()):s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.too_small,minimum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.too_big,maximum:s.value,type:"number",inclusive:s.inclusive,exact:!1,message:s.message}),r.dirty()):s.kind==="multipleOf"?Da(e.data,s.value)!==0&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):s.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),y(n,{code:f.not_finite,message:s.message}),r.dirty()):C.assertNever(s);return{status:r.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,w.toString(n))}gt(e,n){return this.setLimit("min",e,!1,w.toString(n))}lte(e,n){return this.setLimit("max",e,!0,w.toString(n))}lt(e,n){return this.setLimit("max",e,!1,w.toString(n))}setLimit(e,n,r,s){return new Le(x(d({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:w.toString(s)}]}))}_addCheck(e){return new Le(x(d({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:w.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:w.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:w.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:w.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:w.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&C.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}Le.create=t=>new Le(d({checks:[],typeName:S.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1},O(t)));class $e extends T{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(s){return this._getInvalidInput(e)}if(this._getType(e)!==_.bigint)return this._getInvalidInput(e);let n;const r=new J;for(const s of this._def.checks)s.kind==="min"?(s.inclusive?e.data<s.value:e.data<=s.value)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.too_small,type:"bigint",minimum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="max"?(s.inclusive?e.data>s.value:e.data>=s.value)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.too_big,type:"bigint",maximum:s.value,inclusive:s.inclusive,message:s.message}),r.dirty()):s.kind==="multipleOf"?e.data%s.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),y(n,{code:f.not_multiple_of,multipleOf:s.value,message:s.message}),r.dirty()):C.assertNever(s);return{status:r.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.bigint,received:n.parsedType}),E}gte(e,n){return this.setLimit("min",e,!0,w.toString(n))}gt(e,n){return this.setLimit("min",e,!1,w.toString(n))}lte(e,n){return this.setLimit("max",e,!0,w.toString(n))}lt(e,n){return this.setLimit("max",e,!1,w.toString(n))}setLimit(e,n,r,s){return new $e(x(d({},this._def),{checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:w.toString(s)}]}))}_addCheck(e){return new $e(x(d({},this._def),{checks:[...this._def.checks,e]}))}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:w.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:w.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:w.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:w.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}$e.create=t=>{var e;return new $e(d({checks:[],typeName:S.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!==null&&e!==void 0?e:!1},O(t)))};class It extends T{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==_.boolean){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.boolean,received:n.parsedType}),E}return te(e.data)}}It.create=t=>new It(d({typeName:S.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1},O(t)));class Qe extends T{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==_.date){const s=this._getOrReturnCtx(e);return y(s,{code:f.invalid_type,expected:_.date,received:s.parsedType}),E}if(isNaN(e.data.getTime())){const s=this._getOrReturnCtx(e);return y(s,{code:f.invalid_date}),E}const n=new J;let r;for(const s of this._def.checks)s.kind==="min"?e.data.getTime()<s.value&&(r=this._getOrReturnCtx(e,r),y(r,{code:f.too_small,message:s.message,inclusive:!0,exact:!1,minimum:s.value,type:"date"}),n.dirty()):s.kind==="max"?e.data.getTime()>s.value&&(r=this._getOrReturnCtx(e,r),y(r,{code:f.too_big,message:s.message,inclusive:!0,exact:!1,maximum:s.value,type:"date"}),n.dirty()):C.assertNever(s);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new Qe(x(d({},this._def),{checks:[...this._def.checks,e]}))}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:w.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:w.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}Qe.create=t=>new Qe(d({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:S.ZodDate},O(t)));class pn extends T{_parse(e){if(this._getType(e)!==_.symbol){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.symbol,received:n.parsedType}),E}return te(e.data)}}pn.create=t=>new pn(d({typeName:S.ZodSymbol},O(t)));class jt extends T{_parse(e){if(this._getType(e)!==_.undefined){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.undefined,received:n.parsedType}),E}return te(e.data)}}jt.create=t=>new jt(d({typeName:S.ZodUndefined},O(t)));class Zt extends T{_parse(e){if(this._getType(e)!==_.null){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.null,received:n.parsedType}),E}return te(e.data)}}Zt.create=t=>new Zt(d({typeName:S.ZodNull},O(t)));class yt extends T{constructor(){super(...arguments),this._any=!0}_parse(e){return te(e.data)}}yt.create=t=>new yt(d({typeName:S.ZodAny},O(t)));class Xe extends T{constructor(){super(...arguments),this._unknown=!0}_parse(e){return te(e.data)}}Xe.create=t=>new Xe(d({typeName:S.ZodUnknown},O(t)));class Ie extends T{_parse(e){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.never,received:n.parsedType}),E}}Ie.create=t=>new Ie(d({typeName:S.ZodNever},O(t)));class mn extends T{_parse(e){if(this._getType(e)!==_.undefined){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.void,received:n.parsedType}),E}return te(e.data)}}mn.create=t=>new mn(d({typeName:S.ZodVoid},O(t)));class me extends T{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==_.array)return y(n,{code:f.invalid_type,expected:_.array,received:n.parsedType}),E;if(s.exactLength!==null){const i=n.data.length>s.exactLength.value,o=n.data.length<s.exactLength.value;(i||o)&&(y(n,{code:i?f.too_big:f.too_small,minimum:o?s.exactLength.value:void 0,maximum:i?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(y(n,{code:f.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(y(n,{code:f.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((i,o)=>s.type._parseAsync(new xe(n,i,n.path,o)))).then(i=>J.mergeArray(r,i));const a=[...n.data].map((i,o)=>s.type._parseSync(new xe(n,i,n.path,o)));return J.mergeArray(r,a)}get element(){return this._def.type}min(e,n){return new me(x(d({},this._def),{minLength:{value:e,message:w.toString(n)}}))}max(e,n){return new me(x(d({},this._def),{maxLength:{value:e,message:w.toString(n)}}))}length(e,n){return new me(x(d({},this._def),{exactLength:{value:e,message:w.toString(n)}}))}nonempty(e){return this.min(1,e)}}me.create=(t,e)=>new me(d({type:t,minLength:null,maxLength:null,exactLength:null,typeName:S.ZodArray},O(e)));function ut(t){if(t instanceof W){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=ke.create(ut(r))}return new W(x(d({},t._def),{shape:()=>e}))}else return t instanceof me?new me(x(d({},t._def),{type:ut(t.element)})):t instanceof ke?ke.create(ut(t.unwrap())):t instanceof We?We.create(ut(t.unwrap())):t instanceof Ee?Ee.create(t.items.map(e=>ut(e))):t}class W extends T{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(),n=C.objectKeys(e);return this._cached={shape:e,keys:n}}_parse(e){if(this._getType(e)!==_.object){const u=this._getOrReturnCtx(e);return y(u,{code:f.invalid_type,expected:_.object,received:u.parsedType}),E}const{status:n,ctx:r}=this._processInputParams(e),{shape:s,keys:a}=this._getCached(),i=[];if(!(this._def.catchall instanceof Ie&&this._def.unknownKeys==="strip"))for(const u in r.data)a.includes(u)||i.push(u);const o=[];for(const u of a){const c=s[u],h=r.data[u];o.push({key:{status:"valid",value:u},value:c._parse(new xe(r,h,r.path,u)),alwaysSet:u in r.data})}if(this._def.catchall instanceof Ie){const u=this._def.unknownKeys;if(u==="passthrough")for(const c of i)o.push({key:{status:"valid",value:c},value:{status:"valid",value:r.data[c]}});else if(u==="strict")i.length>0&&(y(r,{code:f.unrecognized_keys,keys:i}),n.dirty());else if(u!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const u=this._def.catchall;for(const c of i){const h=r.data[c];o.push({key:{status:"valid",value:c},value:u._parse(new xe(r,h,r.path,c)),alwaysSet:c in r.data})}}return r.common.async?Promise.resolve().then(()=>Se(this,null,function*(){const u=[];for(const c of o){const h=yield c.key,p=yield c.value;u.push({key:h,value:p,alwaysSet:c.alwaysSet})}return u})).then(u=>J.mergeObjectSync(n,u)):J.mergeObjectSync(n,o)}get shape(){return this._def.shape()}strict(e){return w.errToObj,new W(d(x(d({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:(n,r)=>{var s,a,i,o;const u=(i=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,n,r).message)!==null&&i!==void 0?i:r.defaultError;return n.code==="unrecognized_keys"?{message:(o=w.errToObj(e).message)!==null&&o!==void 0?o:u}:{message:u}}}:{}))}strip(){return new W(x(d({},this._def),{unknownKeys:"strip"}))}passthrough(){return new W(x(d({},this._def),{unknownKeys:"passthrough"}))}extend(e){return new W(x(d({},this._def),{shape:()=>d(d({},this._def.shape()),e)}))}merge(e){return new W({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>d(d({},this._def.shape()),e._def.shape()),typeName:S.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new W(x(d({},this._def),{catchall:e}))}pick(e){const n={};return C.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(n[r]=this.shape[r])}),new W(x(d({},this._def),{shape:()=>n}))}omit(e){const n={};return C.objectKeys(this.shape).forEach(r=>{e[r]||(n[r]=this.shape[r])}),new W(x(d({},this._def),{shape:()=>n}))}deepPartial(){return ut(this)}partial(e){const n={};return C.objectKeys(this.shape).forEach(r=>{const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}),new W(x(d({},this._def),{shape:()=>n}))}required(e){const n={};return C.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])n[r]=this.shape[r];else{let s=this.shape[r];for(;s instanceof ke;)s=s._def.innerType;n[r]=s}}),new W(x(d({},this._def),{shape:()=>n}))}keyof(){return Ts(C.objectKeys(this.shape))}}W.create=(t,e)=>new W(d({shape:()=>t,unknownKeys:"strip",catchall:Ie.create(),typeName:S.ZodObject},O(e)));W.strictCreate=(t,e)=>new W(d({shape:()=>t,unknownKeys:"strict",catchall:Ie.create(),typeName:S.ZodObject},O(e)));W.lazycreate=(t,e)=>new W(d({shape:t,unknownKeys:"strip",catchall:Ie.create(),typeName:S.ZodObject},O(e)));class Dt extends T{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(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 n.common.issues.push(...o.ctx.common.issues),o.result;const i=a.map(o=>new oe(o.ctx.common.issues));return y(n,{code:f.invalid_union,unionErrors:i}),E}if(n.common.async)return Promise.all(r.map(a=>Se(this,null,function*(){const i=x(d({},n),{common:x(d({},n.common),{issues:[]}),parent:null});return{result:yield a._parseAsync({data:n.data,path:n.path,parent:i}),ctx:i}}))).then(s);{let a;const i=[];for(const u of r){const c=x(d({},n),{common:x(d({},n.common),{issues:[]}),parent:null}),h=u._parseSync({data:n.data,path:n.path,parent:c});if(h.status==="valid")return h;h.status==="dirty"&&!a&&(a={result:h,ctx:c}),c.common.issues.length&&i.push(c.common.issues)}if(a)return n.common.issues.push(...a.ctx.common.issues),a.result;const o=i.map(u=>new oe(u));return y(n,{code:f.invalid_union,unionErrors:o}),E}}get options(){return this._def.options}}Dt.create=(t,e)=>new Dt(d({options:t,typeName:S.ZodUnion},O(e)));const je=t=>t instanceof $t?je(t.schema):t instanceof ye?je(t.innerType()):t instanceof Ft?[t.value]:t instanceof Fe?t.options:t instanceof Wt?C.objectValues(t.enum):t instanceof zt?je(t._def.innerType):t instanceof jt?[void 0]:t instanceof Zt?[null]:t instanceof ke?[void 0,...je(t.unwrap())]:t instanceof We?[null,...je(t.unwrap())]:t instanceof Or||t instanceof Ut?je(t.unwrap()):t instanceof Vt?je(t._def.innerType):[];class kn extends T{_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==_.object)return y(n,{code:f.invalid_type,expected:_.object,received:n.parsedType}),E;const r=this.discriminator,s=n.data[r],a=this.optionsMap.get(s);return a?n.common.async?a._parseAsync({data:n.data,path:n.path,parent:n}):a._parseSync({data:n.data,path:n.path,parent:n}):(y(n,{code:f.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),E)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){const s=new Map;for(const a of n){const i=je(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(s.has(o))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);s.set(o,a)}}return new kn(d({typeName:S.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s},O(r)))}}function Hn(t,e){const n=Re(t),r=Re(e);if(t===e)return{valid:!0,data:t};if(n===_.object&&r===_.object){const s=C.objectKeys(e),a=C.objectKeys(t).filter(o=>s.indexOf(o)!==-1),i=d(d({},t),e);for(const o of a){const u=Hn(t[o],e[o]);if(!u.valid)return{valid:!1};i[o]=u.data}return{valid:!0,data:i}}else if(n===_.array&&r===_.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let a=0;a<t.length;a++){const i=t[a],o=e[a],u=Hn(i,o);if(!u.valid)return{valid:!1};s.push(u.data)}return{valid:!0,data:s}}else return n===_.date&&r===_.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class Mt extends T{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(a,i)=>{if(qn(a)||qn(i))return E;const o=Hn(a.value,i.value);return o.valid?((Kn(a)||Kn(i))&&n.dirty(),{status:n.value,value:o.data}):(y(r,{code:f.invalid_intersection_types}),E)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([a,i])=>s(a,i)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Mt.create=(t,e,n)=>new Mt(d({left:t,right:e,typeName:S.ZodIntersection},O(n)));class Ee extends T{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.array)return y(r,{code:f.invalid_type,expected:_.array,received:r.parsedType}),E;if(r.data.length<this._def.items.length)return y(r,{code:f.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),E;!this._def.rest&&r.data.length>this._def.items.length&&(y(r,{code:f.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const s=[...r.data].map((a,i)=>{const o=this._def.items[i]||this._def.rest;return o?o._parse(new xe(r,a,r.path,i)):null}).filter(a=>!!a);return r.common.async?Promise.all(s).then(a=>J.mergeArray(n,a)):J.mergeArray(n,s)}get items(){return this._def.items}rest(e){return new Ee(x(d({},this._def),{rest:e}))}}Ee.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Ee(d({items:t,typeName:S.ZodTuple,rest:null},O(e)))};class Lt extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.object)return y(r,{code:f.invalid_type,expected:_.object,received:r.parsedType}),E;const s=[],a=this._def.keyType,i=this._def.valueType;for(const o in r.data)s.push({key:a._parse(new xe(r,o,r.path,o)),value:i._parse(new xe(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?J.mergeObjectAsync(n,s):J.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof T?new Lt(d({keyType:e,valueType:n,typeName:S.ZodRecord},O(r))):new Lt(d({keyType:pe.create(),valueType:e,typeName:S.ZodRecord},O(n)))}}class yn extends T{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.map)return y(r,{code:f.invalid_type,expected:_.map,received:r.parsedType}),E;const s=this._def.keyType,a=this._def.valueType,i=[...r.data.entries()].map(([o,u],c)=>({key:s._parse(new xe(r,o,r.path,[c,"key"])),value:a._parse(new xe(r,u,r.path,[c,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(()=>Se(this,null,function*(){for(const u of i){const c=yield u.key,h=yield u.value;if(c.status==="aborted"||h.status==="aborted")return E;(c.status==="dirty"||h.status==="dirty")&&n.dirty(),o.set(c.value,h.value)}return{status:n.value,value:o}}))}else{const o=new Map;for(const u of i){const c=u.key,h=u.value;if(c.status==="aborted"||h.status==="aborted")return E;(c.status==="dirty"||h.status==="dirty")&&n.dirty(),o.set(c.value,h.value)}return{status:n.value,value:o}}}}yn.create=(t,e,n)=>new yn(d({valueType:e,keyType:t,typeName:S.ZodMap},O(n)));class et extends T{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==_.set)return y(r,{code:f.invalid_type,expected:_.set,received:r.parsedType}),E;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(y(r,{code:f.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(y(r,{code:f.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const a=this._def.valueType;function i(u){const c=new Set;for(const h of u){if(h.status==="aborted")return E;h.status==="dirty"&&n.dirty(),c.add(h.value)}return{status:n.value,value:c}}const o=[...r.data.values()].map((u,c)=>a._parse(new xe(r,u,r.path,c)));return r.common.async?Promise.all(o).then(u=>i(u)):i(o)}min(e,n){return new et(x(d({},this._def),{minSize:{value:e,message:w.toString(n)}}))}max(e,n){return new et(x(d({},this._def),{maxSize:{value:e,message:w.toString(n)}}))}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}et.create=(t,e)=>new et(d({valueType:t,minSize:null,maxSize:null,typeName:S.ZodSet},O(e)));class ht extends T{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==_.function)return y(n,{code:f.invalid_type,expected:_.function,received:n.parsedType}),E;function r(o,u){return ln({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,dn(),mt].filter(c=>!!c),issueData:{code:f.invalid_arguments,argumentsError:u}})}function s(o,u){return ln({data:o,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,dn(),mt].filter(c=>!!c),issueData:{code:f.invalid_return_type,returnTypeError:u}})}const a={errorMap:n.common.contextualErrorMap},i=n.data;if(this._def.returns instanceof gt){const o=this;return te(function(...u){return Se(this,null,function*(){const c=new oe([]),h=yield o._def.args.parseAsync(u,a).catch(k=>{throw c.addIssue(r(u,k)),c}),p=yield Reflect.apply(i,this,h);return yield o._def.returns._def.type.parseAsync(p,a).catch(k=>{throw c.addIssue(s(p,k)),c})})})}else{const o=this;return te(function(...u){const c=o._def.args.safeParse(u,a);if(!c.success)throw new oe([r(u,c.error)]);const h=Reflect.apply(i,this,c.data),p=o._def.returns.safeParse(h,a);if(!p.success)throw new oe([s(h,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new ht(x(d({},this._def),{args:Ee.create(e).rest(Xe.create())}))}returns(e){return new ht(x(d({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new ht(d({args:e||Ee.create([]).rest(Xe.create()),returns:n||Xe.create(),typeName:S.ZodFunction},O(r)))}}class $t extends T{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}$t.create=(t,e)=>new $t(d({getter:t,typeName:S.ZodLazy},O(e)));class Ft extends T{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return y(n,{received:n.data,code:f.invalid_literal,expected:this._def.value}),E}return{status:"valid",value:e.data}}get value(){return this._def.value}}Ft.create=(t,e)=>new Ft(d({value:t,typeName:S.ZodLiteral},O(e)));function Ts(t,e){return new Fe(d({values:t,typeName:S.ZodEnum},O(e)))}class Fe extends T{constructor(){super(...arguments),St.set(this,void 0)}_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return y(n,{expected:C.joinValues(r),received:n.parsedType,code:f.invalid_type}),E}if(hn(this,St)||Ss(this,St,new Set(this._def.values)),!hn(this,St).has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return y(n,{received:n.data,code:f.invalid_enum_value,options:r}),E}return te(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return Fe.create(e,d(d({},this._def),n))}exclude(e,n=this._def){return Fe.create(this.options.filter(r=>!e.includes(r)),d(d({},this._def),n))}}St=new WeakMap;Fe.create=Ts;class Wt extends T{constructor(){super(...arguments),xt.set(this,void 0)}_parse(e){const n=C.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==_.string&&r.parsedType!==_.number){const s=C.objectValues(n);return y(r,{expected:C.joinValues(s),received:r.parsedType,code:f.invalid_type}),E}if(hn(this,xt)||Ss(this,xt,new Set(C.getValidEnumValues(this._def.values))),!hn(this,xt).has(e.data)){const s=C.objectValues(n);return y(r,{received:r.data,code:f.invalid_enum_value,options:s}),E}return te(e.data)}get enum(){return this._def.values}}xt=new WeakMap;Wt.create=(t,e)=>new Wt(d({values:t,typeName:S.ZodNativeEnum},O(e)));class gt extends T{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==_.promise&&n.common.async===!1)return y(n,{code:f.invalid_type,expected:_.promise,received:n.parsedType}),E;const r=n.parsedType===_.promise?n.data:Promise.resolve(n.data);return te(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}gt.create=(t,e)=>new gt(d({type:t,typeName:S.ZodPromise},O(e)));class ye extends T{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===S.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:i=>{y(r,i),i.fatal?n.abort():n.dirty()},get path(){return r.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){const i=s.transform(r.data,a);if(r.common.async)return Promise.resolve(i).then(o=>Se(this,null,function*(){if(n.value==="aborted")return E;const u=yield this._def.schema._parseAsync({data:o,path:r.path,parent:r});return u.status==="aborted"?E:u.status==="dirty"||n.value==="dirty"?fn(u.value):u}));{if(n.value==="aborted")return E;const o=this._def.schema._parseSync({data:i,path:r.path,parent:r});return o.status==="aborted"?E:o.status==="dirty"||n.value==="dirty"?fn(o.value):o}}if(s.type==="refinement"){const i=o=>{const u=s.refinement(o,a);if(r.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?E:(o.status==="dirty"&&n.dirty(),i(o.value),{status:n.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?E:(o.status==="dirty"&&n.dirty(),i(o.value).then(()=>({status:n.value,value:o.value}))))}if(s.type==="transform")if(r.common.async===!1){const i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ye(i))return i;const o=s.transform(i.value,a);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(i=>Ye(i)?Promise.resolve(s.transform(i.value,a)).then(o=>({status:n.value,value:o})):i);C.assertNever(s)}}ye.create=(t,e,n)=>new ye(d({schema:t,typeName:S.ZodEffects,effect:e},O(n)));ye.createWithPreprocess=(t,e,n)=>new ye(d({schema:e,effect:{type:"preprocess",transform:t},typeName:S.ZodEffects},O(n)));class ke extends T{_parse(e){return this._getType(e)===_.undefined?te(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ke.create=(t,e)=>new ke(d({innerType:t,typeName:S.ZodOptional},O(e)));class We extends T{_parse(e){return this._getType(e)===_.null?te(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}We.create=(t,e)=>new We(d({innerType:t,typeName:S.ZodNullable},O(e)));class zt extends T{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===_.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}zt.create=(t,e)=>new zt(d({innerType:t,typeName:S.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default},O(e)));class Vt extends T{_parse(e){const{ctx:n}=this._processInputParams(e),r=x(d({},n),{common:x(d({},n.common),{issues:[]})}),s=this._def.innerType._parse({data:r.data,path:r.path,parent:d({},r)});return Pt(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new oe(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new oe(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Vt.create=(t,e)=>new Vt(d({innerType:t,typeName:S.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},O(e)));class gn extends T{_parse(e){if(this._getType(e)!==_.nan){const n=this._getOrReturnCtx(e);return y(n,{code:f.invalid_type,expected:_.nan,received:n.parsedType}),E}return{status:"valid",value:e.data}}}gn.create=t=>new gn(d({typeName:S.ZodNaN},O(t)));const Ma=Symbol("zod_brand");class Or extends T{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Gt extends T{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return Se(this,null,function*(){const s=yield this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?E:s.status==="dirty"?(n.dirty(),fn(s.value)):this._def.out._parseAsync({data:s.value,path:r.path,parent:r})});{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?E:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new Gt({in:e,out:n,typeName:S.ZodPipeline})}}class Ut extends T{_parse(e){const n=this._def.innerType._parse(e),r=s=>(Ye(s)&&(s.value=Object.freeze(s.value)),s);return Pt(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}Ut.create=(t,e)=>new Ut(d({innerType:t,typeName:S.ZodReadonly},O(e)));function As(t,e={},n){return t?yt.create().superRefine((r,s)=>{var a,i;if(!t(r)){const o=typeof e=="function"?e(r):typeof e=="string"?{message:e}:e,u=(i=(a=o.fatal)!==null&&a!==void 0?a:n)!==null&&i!==void 0?i:!0,c=typeof o=="string"?{message:o}:o;s.addIssue(x(d({code:"custom"},c),{fatal:u}))}}):yt.create()}const La={object:W.lazycreate};var S;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(S||(S={}));const $a=(t,e={message:`Input not instance of ${t.name}`})=>As(n=>n instanceof t,e),Cs=pe.create,Ns=Le.create,Fa=gn.create,Wa=$e.create,Rs=It.create,za=Qe.create,Va=pn.create,Ua=jt.create,Ba=Zt.create,qa=yt.create,Ka=Xe.create,Ha=Ie.create,Ga=mn.create,Ja=me.create,Xa=W.create,Ya=W.strictCreate,Qa=Dt.create,ei=kn.create,ti=Mt.create,ni=Ee.create,ri=Lt.create,si=yn.create,ai=et.create,ii=ht.create,oi=$t.create,ui=Ft.create,ci=Fe.create,di=Wt.create,li=gt.create,Gr=ye.create,fi=ke.create,hi=We.create,pi=ye.createWithPreprocess,mi=Gt.create,yi=()=>Cs().optional(),gi=()=>Ns().optional(),_i=()=>Rs().optional(),vi={string:t=>pe.create(x(d({},t),{coerce:!0})),number:t=>Le.create(x(d({},t),{coerce:!0})),boolean:t=>It.create(x(d({},t),{coerce:!0})),bigint:t=>$e.create(x(d({},t),{coerce:!0})),date:t=>Qe.create(x(d({},t),{coerce:!0}))},bi=E;var ae=Object.freeze({__proto__:null,defaultErrorMap:mt,setErrorMap:pa,getErrorMap:dn,makeIssue:ln,EMPTY_PATH:ma,addIssueToContext:y,ParseStatus:J,INVALID:E,DIRTY:fn,OK:te,isAborted:qn,isDirty:Kn,isValid:Ye,isAsync:Pt,get util(){return C},get objectUtil(){return Bn},ZodParsedType:_,getParsedType:Re,ZodType:T,datetimeRegex:Os,ZodString:pe,ZodNumber:Le,ZodBigInt:$e,ZodBoolean:It,ZodDate:Qe,ZodSymbol:pn,ZodUndefined:jt,ZodNull:Zt,ZodAny:yt,ZodUnknown:Xe,ZodNever:Ie,ZodVoid:mn,ZodArray:me,ZodObject:W,ZodUnion:Dt,ZodDiscriminatedUnion:kn,ZodIntersection:Mt,ZodTuple:Ee,ZodRecord:Lt,ZodMap:yn,ZodSet:et,ZodFunction:ht,ZodLazy:$t,ZodLiteral:Ft,ZodEnum:Fe,ZodNativeEnum:Wt,ZodPromise:gt,ZodEffects:ye,ZodTransformer:ye,ZodOptional:ke,ZodNullable:We,ZodDefault:zt,ZodCatch:Vt,ZodNaN:gn,BRAND:Ma,ZodBranded:Or,ZodPipeline:Gt,ZodReadonly:Ut,custom:As,Schema:T,ZodSchema:T,late:La,get ZodFirstPartyTypeKind(){return S},coerce:vi,any:qa,array:Ja,bigint:Wa,boolean:Rs,date:za,discriminatedUnion:ei,effect:Gr,enum:ci,function:ii,instanceof:$a,intersection:ti,lazy:oi,literal:ui,map:si,nan:Fa,nativeEnum:di,never:Ha,null:Ba,nullable:hi,number:Ns,object:Xa,oboolean:_i,onumber:gi,optional:fi,ostring:yi,pipeline:mi,preprocess:pi,promise:li,record:ri,set:ai,strictObject:Ya,string:Cs,symbol:Va,transformer:Gr,tuple:ni,undefined:Ua,union:Qa,unknown:Ka,void:Ga,NEVER:bi,ZodIssueCode:f,quotelessJson:ha,ZodError:oe});ae.object({language:ae.enum(["typescript","javascript"]).optional()}).and(ae.union([ae.object({framework:ae.literal("react"),model:ae.string().optional(),styling:ae.enum(["plain_css","css_modules","styled_components","tailwind","sass","scss","inline_styles"]),uiLibrary:ae.enum(["mui","antd","radix","shadcn"]).optional(),enableUILibraryTheming:ae.boolean().optional()}),ae.object({framework:ae.literal("html"),styling:ae.enum(["plain_css","inline_styles"]),enableTranslation:ae.boolean().optional()})]));var wi=Object.defineProperty,ki=Object.defineProperties,Si=Object.getOwnPropertyDescriptors,Jr=Object.getOwnPropertySymbols,xi=Object.prototype.hasOwnProperty,Ei=Object.prototype.propertyIsEnumerable,Xr=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),Ps=t=>{throw TypeError(t)},Yr=(t,e,n)=>e in t?wi(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ie=(t,e)=>{for(var n in e||(e={}))xi.call(e,n)&&Yr(t,n,e[n]);if(Jr)for(var n of Jr(e))Ei.call(e,n)&&Yr(t,n,e[n]);return t},Tr=(t,e)=>ki(t,Si(e)),Ar=(t,e,n)=>e.has(t)||Ps("Cannot "+n),R=(t,e,n)=>(Ar(t,e,"read from private field"),n?n.call(t):e.get(t)),le=(t,e,n)=>e.has(t)?Ps("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),G=(t,e,n,r)=>(Ar(t,e,"write to private field"),e.set(t,n),n),be=(t,e,n)=>(Ar(t,e,"access private method"),n),U=(t,e,n)=>new Promise((r,s)=>{var a=u=>{try{o(n.next(u))}catch(c){s(c)}},i=u=>{try{o(n.throw(u))}catch(c){s(c)}},o=u=>u.done?r(u.value):Promise.resolve(u.value).then(a,i);o((n=n.apply(t,e)).next())}),Oi=(t,e,n)=>(e=t[Xr("asyncIterator")])?e.call(t):(t=t[Xr("iterator")](),e={},n=(r,s)=>(s=t[r])&&(e[r]=a=>new Promise((i,o,u)=>(a=s.call(t,a),u=a.done,Promise.resolve(a.value).then(c=>i({value:c,done:u}),o)))),n("next"),n("return"),e),Ti=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Ai(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Gn={exports:{}},Ci=Gn.exports,Qr;function Ni(){return Qr||(Qr=1,function(t,e){(function(n,r){t.exports=r()})(Ci,function(){var n=typeof Promise=="function",r=typeof self=="object"?self:Ti,s=typeof Symbol!="undefined",a=typeof Map!="undefined",i=typeof Set!="undefined",o=typeof WeakMap!="undefined",u=typeof WeakSet!="undefined",c=typeof DataView!="undefined",h=s&&typeof Symbol.iterator!="undefined",p=s&&typeof Symbol.toStringTag!="undefined",k=i&&typeof Set.prototype.entries=="function",g=a&&typeof Map.prototype.entries=="function",v=k&&Object.getPrototypeOf(new Set().entries()),l=g&&Object.getPrototypeOf(new Map().entries()),b=h&&typeof Array.prototype[Symbol.iterator]=="function",m=b&&Object.getPrototypeOf([][Symbol.iterator]()),j=h&&typeof String.prototype[Symbol.iterator]=="function",M=j&&Object.getPrototypeOf(""[Symbol.iterator]()),B=8,z=-1;function X(L){var $=typeof L;if($!=="object")return $;if(L===null)return"null";if(L===r)return"global";if(Array.isArray(L)&&(p===!1||!(Symbol.toStringTag in L)))return"Array";if(typeof window=="object"&&window!==null){if(typeof window.location=="object"&&L===window.location)return"Location";if(typeof window.document=="object"&&L===window.document)return"Document";if(typeof window.navigator=="object"){if(typeof window.navigator.mimeTypes=="object"&&L===window.navigator.mimeTypes)return"MimeTypeArray";if(typeof window.navigator.plugins=="object"&&L===window.navigator.plugins)return"PluginArray"}if((typeof window.HTMLElement=="function"||typeof window.HTMLElement=="object")&&L instanceof window.HTMLElement){if(L.tagName==="BLOCKQUOTE")return"HTMLQuoteElement";if(L.tagName==="TD")return"HTMLTableDataCellElement";if(L.tagName==="TH")return"HTMLTableHeaderCellElement"}}var Oe=p&&L[Symbol.toStringTag];if(typeof Oe=="string")return Oe;var Z=Object.getPrototypeOf(L);return Z===RegExp.prototype?"RegExp":Z===Date.prototype?"Date":n&&Z===Promise.prototype?"Promise":i&&Z===Set.prototype?"Set":a&&Z===Map.prototype?"Map":u&&Z===WeakSet.prototype?"WeakSet":o&&Z===WeakMap.prototype?"WeakMap":c&&Z===DataView.prototype?"DataView":a&&Z===l?"Map Iterator":i&&Z===v?"Set Iterator":b&&Z===m?"Array Iterator":j&&Z===M?"String Iterator":Z===null?"Object":Object.prototype.toString.call(L).slice(B,z)}return X})}(Gn)),Gn.exports}var Ri=Ni();const Pi=Ai(Ri),Cr=typeof Buffer!="undefined",Ii=Cr&&typeof Buffer.from!="undefined",ji=Cr?function(t){return Buffer.isBuffer(t)}:function(){return!1},Zi=Ii?function(t){return Buffer.from(t)}:Cr?function(t){return new Buffer(t)}:function(t){return t};function _t(t){return ji(t)?"Buffer":Pi(t)}const Di=new Set(["Arguments","Array","Map","Object","Set"]);function Mi(t,e,n=null){switch(n||_t(t)){case"Arguments":case"Array":case"Object":return t[e];case"Map":return t.get(e);case"Set":return e}}function Jn(t){return Di.has(t)}function es(t,e,n,r=null){switch(r||_t(t)){case"Arguments":case"Array":case"Object":t[e]=n;break;case"Map":t.set(e,n);break;case"Set":t.add(n);break}return t}const Li=typeof globalThis!="undefined"&&globalThis!==null&&globalThis.Object===Object&&globalThis,$i=typeof global!="undefined"&&global!==null&&global.Object===Object&&global,Fi=typeof self!="undefined"&&self!==null&&self.Object===Object&&self,Rn=Li||$i||Fi||Function("return this")();function Wi(t){return t.slice(0)}function zi(t){return new Boolean(t.valueOf())}function Vi(t){return new DataView(t.buffer)}function Ui(t){return Zi(t)}function Bi(t){return new Date(t.getTime())}function qi(t){return new Number(t)}function Ki(t){return new RegExp(t.source,t.flags)}function Hi(t){return new String(t)}function Ce(t,e){return Rn[e].from?Rn[e].from(t):new Rn[e](t)}function Q(t){return t}function ts(){return[]}function Gi(){return new Map}function Ji(){return{}}function Xi(){return new Set}const Yi=new Map([["ArrayBuffer",Wi],["Boolean",zi],["Buffer",Ui],["DataView",Vi],["Date",Bi],["Number",qi],["RegExp",Ki],["String",Hi],["Float32Array",Ce],["Float64Array",Ce],["Int16Array",Ce],["Int32Array",Ce],["Int8Array",Ce],["Uint16Array",Ce],["Uint32Array",Ce],["Uint8Array",Ce],["Uint8ClampedArray",Ce],["Array Iterator",Q],["Map Iterator",Q],["Promise",Q],["Set Iterator",Q],["String Iterator",Q],["function",Q],["global",Q],["WeakMap",Q],["WeakSet",Q],["boolean",Q],["null",Q],["number",Q],["string",Q],["symbol",Q],["undefined",Q],["Arguments",ts],["Array",ts],["Map",Gi],["Object",Ji],["Set",Xi]]);function Qi(){}function Xn(t,e=null,n=Qi){arguments.length===2&&typeof e=="function"&&(n=e,e=null);const r=e||_t(t),s=Yi.get(r);if(r==="Object"){const a=n(t,r);if(a!==void 0)return a}return s?s(t,r):t}function kt(t,e={}){typeof e=="function"&&(e={customizer:e});const{customizer:n}=e,r=_t(t);if(!Jn(r))return Yn(t,null,null,null);const s=Xn(t,r,n),a=new WeakMap([[t,s]]),i=new WeakSet([t]);return Yn(t,s,a,i)}function Yn(t,e,n,r,s){const a=_t(t),i=Xn(t,a);if(!Jn(a))return i;let o;switch(a){case"Arguments":case"Array":o=Object.keys(t);break;case"Object":o=Object.keys(t),o.push(...Object.getOwnPropertySymbols(t));break;case"Map":case"Set":o=t.keys();break}for(let u of o){const c=Mi(t,u,a);if(r.has(c))es(e,u,n.get(c),a);else{const h=_t(c),p=Xn(c,h);Jn(h)&&(n.set(c,p),r.add(c)),es(e,u,Yn(c,p,n,r),a)}}return e}const eo=t=>new Promise(e=>setTimeout(e,t));var sn,He,an,Qn,Is;class to{constructor({maxAttempts:e=3,func:n}){le(this,Qn),le(this,sn),le(this,He),le(this,an),G(this,sn,e),G(this,an,n),G(this,He,0)}run(){return U(this,null,function*(){try{return yield R(this,an).call(this)}catch(e){if(G(this,He,R(this,He)+1),R(this,He)>R(this,sn))throw console.error("Max attempts reached"),e;const n=be(this,Qn,Is).call(this);return yield eo(n),yield this.run()}})}}sn=new WeakMap,He=new WeakMap,an=new WeakMap,Qn=new WeakSet,Is=function(){return R(this,He)*1e3*1.5};function no(){return typeof CompressionStream!="undefined"}function ro(t){return U(this,null,function*(){const e=new Blob([t]).stream().pipeThrough(new CompressionStream("gzip")),n=[];try{for(var r=Oi(e),s,a,i;s=!(a=yield r.next()).done;s=!1){const o=a.value;n.push(o)}}catch(o){i=[o]}finally{try{s&&(a=r.return)&&(yield a.call(r))}finally{if(i)throw i[0]}}return yield so(n)})}function so(t){return U(this,null,function*(){const e=yield new Blob(t).arrayBuffer();return new Uint8Array(e)})}class ao extends Error{constructor({resource:e,api:n,args:r,cause:s}){if(super(`API Error on resource "${e}" at api "${n}"`),this.causeProperties={},this.name="API Error",this.resource=e,this.api=n,this.cause=s,this.args=r,s instanceof Error)for(const[i,o]of Object.entries(s))if(typeof Headers!="undefined"&&o instanceof Headers){const u={};o.forEach((c,h)=>{u[h]=c}),this.causeProperties[i]=u}else this.causeProperties[i]=o;const a=this.causeProperties.body;a&&typeof a=="object"&&"code"in a&&(this.code=a.code)}}class ns extends Error{constructor({url:e,method:n,statusCode:r,requestHeaders:s,responseHeaders:a,body:i}){if(super("Fetch Error"),this.name="Fetch Error",this.url=e,this.method=n,this.statusNumber=r,this.requestHeaders=s,this.responseHeaders=a,i)try{const o=JSON.parse(i);this.body=o}catch(o){this.body=i}}}class Et extends Error{constructor(e={}){const{canceled:n=!1}=e;super("Abort Error"),this.name="Abort Error",this.canceled=n}}class io extends Error{constructor(e){super(`Async API Error: ${JSON.stringify(e)}`),this.name="Async API Error",this.body=e}}class Pn extends Error{constructor(e){super(e),this.name="Request Validation Error"}}function js(){return Array.from({length:32},()=>Math.floor(Math.random()*256).toString(16).padStart(2,"0")).join("")}function er(){return Math.floor(Date.now()/1e3).toString()}const oo=5*60*1e3,uo=1*1e3;var Ge,ne,_e,tr,nr,Ot;class co{constructor({fetch:e=globalThis.fetch.bind(globalThis),baseAddress:n}){le(this,_e),le(this,Ge),le(this,ne),this.baseAddress=n,G(this,Ge,e),G(this,ne,{}),this.plugins=[]}get headers(){throw new Error("Missing implementation")}addPlugin(e){this.plugins.push(e)}removePlugin(e){this.plugins=this.plugins.filter(n=>n.name!==e)}withOptions(e={}){return G(this,ne,e),this}get(e){return U(this,arguments,function*(n,r={}){const{overrideBaseAddress:s,overrideDefaultHeaders:a}=r,i=s!=null?s:this.baseAddress;let o=a!=null?a:this.headers;const u=kt(R(this,ne));return G(this,ne,{}),u.extraHeaders&&(o=ie(ie({},o),u.extraHeaders)),u.requestValidation&&(o=Tr(ie({},o),{"X-Request-Nonce":js(),"X-Request-Timestamp":er()})),u.async?yield be(this,_e,nr).call(this,`${i}${n}`,u.async,{headers:o}):yield be(this,_e,tr).call(this,`${i}${n}`,u,{headers:o})})}post(e,n){return U(this,arguments,function*(r,s,a={}){const i=kt(R(this,ne));return G(this,ne,{}),be(this,_e,Ot).call(this,r,"POST",s,a,i)})}put(e,n){return U(this,arguments,function*(r,s,a={}){const i=kt(R(this,ne));return G(this,ne,{}),be(this,_e,Ot).call(this,r,"PUT",s,a,i)})}delete(e,n){return U(this,arguments,function*(r,s,a={}){const i=kt(R(this,ne));return G(this,ne,{}),be(this,_e,Ot).call(this,r,"DELETE",s,a,i)})}patch(e,n){return U(this,arguments,function*(r,s,a={}){const i=kt(R(this,ne));return G(this,ne,{}),be(this,_e,Ot).call(this,r,"PATCH",s,a,i)})}}Ge=new WeakMap,ne=new WeakMap,_e=new WeakSet,tr=function(t,e,n){return U(this,null,function*(){const r=()=>U(this,null,function*(){var u,c;try{return yield R(this,Ge).call(this,t,ie(ie({},n),e.abortSignal&&{signal:e.abortSignal}))}catch(h){throw h instanceof Error&&h.name==="AbortError"?new Et({canceled:(c=(u=e.abortSignal)==null?void 0:u.aborted)!=null?c:!1}):h}}),{headers:s}=n!=null?n:{},a=(u,c)=>{var h,p;return((h=u==null?void 0:u.headers)==null?void 0:h.get(c))||((p=u==null?void 0:u.headersObject)==null?void 0:p[c])||""},i=u=>U(this,null,function*(){var c;if(!u.ok){const p=yield u.text().catch();throw new ns({url:t,method:(c=n==null?void 0:n.method)!=null?c:"GET",statusCode:u.status,requestHeaders:s,responseHeaders:u.headers,body:p})}if(e.requestValidation&&process.env.UI_TESTS!==!0)try{const p=a(u,"x-response-nonce"),k=s==null?void 0:s["X-Request-Nonce"];if(!p||p!==k)throw new Pn("Response nonce mismatch");const g=Number(a(u,"x-response-timestamp")),v=Number(er()),l=60*60*24;if(isNaN(g)||Math.abs(v-g)>l)throw new Pn("Invalid response timestamp")}catch(p){const k=p instanceof Error?p.message:"Request validation failed";throw new Pn(k)}let h=yield u.text();try{h=JSON.parse(h)}catch(p){}return h});if(e.retry){const u=yield new to({maxAttempts:e.retry,func:r}).run();return yield i(u)}const o=yield r();return yield i(o)})},nr=function(t,e,n){return U(this,null,function*(){var r,s;const{onProgress:a,abortSignal:i,pollingInterval:o=()=>uo,maxTimeout:u=oo}=e,c=`${t}/async`,h=`${t}/async/job`;let p;try{p=yield R(this,Ge).call(this,c,ie(ie({},n),i&&{signal:i}))}catch(v){throw v instanceof Error&&v.name==="AbortError"?new Et({canceled:(r=i==null?void 0:i.aborted)!=null?r:!1}):v}if(!p.ok){const v=yield p.text().catch();throw new ns({url:t,method:(s=n==null?void 0:n.method)!=null?s:"GET",statusCode:p.status,requestHeaders:this.headers,responseHeaders:p.headers,body:v})}const k=yield p.json(),{job_id:g}=k;if(!g)throw new Error("Job ID not found in response");return new Promise((v,l)=>U(this,null,function*(){const b=setTimeout(()=>{l(new Error("Job timed out"))},u),m=(j=0)=>U(this,null,function*(){if(i!=null&&i.aborted){clearTimeout(b),R(this,Ge).call(this,`${h}/${g}/cancel`,{method:"POST",headers:this.headers}).then(()=>{l(new Et({canceled:!0}))}).catch(M=>{l(new Et({canceled:!1}))});return}try{const M=yield(yield R(this,Ge).call(this,`${h}/${g}`,{headers:this.headers})).json();if(M.status==="success"){clearTimeout(b);const B=M.response_json;v(B)}else if(M.status==="failed")clearTimeout(b),l(new io(M.response_json));else{a&&a(M.response_json);const B=o(j);setTimeout(()=>m(j+1),B)}}catch(M){l(M)}});m()}))})},Ot=function(t,e,n,r,s){return U(this,null,function*(){const{overrideBaseAddress:a,overrideDefaultHeaders:i}=r,o=a!=null?a:this.baseAddress;let u=i!=null?i:this.headers;s.extraHeaders&&(u=ie(ie({},u),s.extraHeaders)),s.requestValidation&&(u=Tr(ie({},u),{"X-Request-Nonce":js(),"X-Request-Timestamp":er()}));let c=r.skipBodyJsonStringify?n:JSON.stringify(n);return s.compress&&no()&&(u["Content-Encoding"]="gzip",c=yield ro(c)),s.async?yield be(this,_e,nr).call(this,`${o}${t}`,s.async,{method:e,headers:u,body:c}):yield be(this,_e,tr).call(this,`${o}${t}`,s,{method:e,headers:u,body:c})})};const rs=(t,e,n,r)=>t instanceof Et?t:new ao({resource:e,api:String(n),args:r,cause:t}),In=(t,e)=>new Proxy(e,{get(n,r){return(...s)=>{var a;for(const o of t.plugins){const u=(a=o.beforeApi)==null?void 0:a.call(o,{resource:n.resourceName,api:r,args:s});if(u!==void 0)return u}let i;try{i=n[r](...s)}catch(o){throw rs(o,n.resourceName,r,s)}return i instanceof Promise?i.catch(o=>{throw rs(o,n.resourceName,r,s)}):i}}});var Tt;class lo{constructor(e){le(this,Tt),this.resourceName="Files",G(this,Tt,e)}get(e){return U(this,arguments,function*({fileKey:n,params:r={}}){const s=new URLSearchParams(ie({plugin_data:"857346721138427857"},r)).toString(),a=`v1/files/${n}?${s}`;return yield R(this,Tt).get(a)})}getImageFills(e){return U(this,arguments,function*({fileKey:n}){var r,s;const a=`v1/files/${n}/images`;return(s=(r=(yield R(this,Tt).get(a)).meta)==null?void 0:r.images)!=null?s:{}})}}Tt=new WeakMap;const fo=(t,e,n)=>{const r=e.sort();return`${t}-${r.join("-")}-${n}`},ho=t=>t?t.ts>Date.now()-1e3*30:!1;var ve,rr,Zs;class po{constructor(e){le(this,rr),le(this,ve),this.resourceName="Images",G(this,ve,e)}get(e){return U(this,arguments,function*({fileKey:n,nodeIds:r,format:s="jpg",scale:a}){const i=fo(n,r,s),o=R(this,ve).cache.images.entries.get(i);if(ho(o))return o.result;o&&R(this,ve).cache.images.entries.delete(i);const u=R(this,ve).cache.images.pendingRequests.get(i);if(u)return u;const c=be(this,rr,Zs).call(this,i,n,r,s,a);R(this,ve).cache.images.pendingRequests.set(i,c);try{return yield c}finally{R(this,ve).cache.images.pendingRequests.delete(i)}})}}ve=new WeakMap,rr=new WeakSet,Zs=function(t,e,n,r,s){return U(this,null,function*(){const a=yield R(this,ve).get(`v1/images/${e}?ids=${n}&format=${r}${s?`&scale=${s}`:""}`);return R(this,ve).cache.images.entries.set(t,{result:a,ts:Date.now()}),a})};var on;class mo{constructor(e){le(this,on),this.resourceName="Nodes",G(this,on,e)}get(e){return U(this,arguments,function*({fileKey:n,nodeIds:r,params:s={}}){const a=Tr(ie({},s),{ids:r.join(",")}),i=new URLSearchParams(ie({plugin_data:"857346721138427857"},a)).toString(),o=`v1/files/${n}/nodes?${i}`;return yield R(this,on).get(o)})}}on=new WeakMap;var Ze;class yo extends co{constructor({baseAddress:e="https://api.figma.com/",fetch:n=globalThis.fetch.bind(globalThis)}={}){super({fetch:n,baseAddress:e}),le(this,Ze,""),this.cache={images:{entries:new Map,pendingRequests:new Map}},this.files=In(this,new lo(this)),this.nodes=In(this,new mo(this)),this.images=In(this,new po(this))}set token(e){if(!e.startsWith("figd_")&&!e.startsWith("figu_"))throw new Error("Invalid Figma access token");G(this,Ze,e)}get token(){return R(this,Ze)}get headers(){const e={"Content-Type":"application/json"};return R(this,Ze).startsWith("figd_")?e["X-FIGMA-TOKEN"]=R(this,Ze):R(this,Ze).startsWith("figu_")&&(e.Authorization=`Bearer ${R(this,Ze)}`),e}}Ze=new WeakMap;const go=t=>Se(void 0,[t],function*({fileKey:e,authToken:n,figmaRestApi:r=new yo,params:s={}}){n&&(r.token=n);try{return yield r.files.get({fileKey:e,params:s})}catch(a){throw console.error(a),a}});var _o=Object.defineProperty,vo=(t,e,n)=>e in t?_o(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,en=(t,e,n)=>vo(t,typeof e!="symbol"?e+"":e,n);class ss extends Error{constructor(e,n){super(e),en(this,"type"),en(this,"field"),en(this,"value"),en(this,"line"),this.name="ParseError",this.type=n.type,this.field=n.field,this.value=n.value,this.line=n.line}}function jn(t){}function bo(t){const{onEvent:e=jn,onError:n=jn,onRetry:r=jn,onComment:s}=t;let a="",i=!0,o,u="",c="";function h(l){const b=i?l.replace(/^\xEF\xBB\xBF/,""):l,[m,j]=wo(`${a}${b}`);for(const M of m)p(M);a=j,i=!1}function p(l){if(l===""){g();return}if(l.startsWith(":")){s&&s(l.slice(l.startsWith(": ")?2:1));return}const b=l.indexOf(":");if(b!==-1){const m=l.slice(0,b),j=l[b+1]===" "?2:1,M=l.slice(b+j);k(m,M,l);return}k(l,"",l)}function k(l,b,m){switch(l){case"event":c=b;break;case"data":u=`${u}${b}
2
+ `;break;case"id":o=b.includes("\0")?void 0:b;break;case"retry":/^\d+$/.test(b)?r(parseInt(b,10)):n(new ss(`Invalid \`retry\` value: "${b}"`,{type:"invalid-retry",value:b,line:m}));break;default:n(new ss(`Unknown field "${l.length>20?`${l.slice(0,20)}…`:l}"`,{type:"unknown-field",field:l,value:b,line:m}));break}}function g(){u.length>0&&e({id:o,event:c||void 0,data:u.endsWith(`
3
+ `)?u.slice(0,-1):u}),o=void 0,u="",c=""}function v(l={}){a&&l.consume&&p(a),o=void 0,u="",c="",a=""}return{feed:h,reset:v}}function wo(t){const e=[];let n="";const r=t.length;for(let s=0;s<r;s++){const a=t[s];a==="\r"&&t[s+1]===`
4
4
  `?(e.push(n),n="",s++):a==="\r"||a===`
5
- `?(e.push(n),n=""):n+=a}return[e,n]}class as extends Event{constructor(e,n){var r,s;super(e),this.code=(r=n==null?void 0:n.code)!=null?r:void 0,this.message=(s=n==null?void 0:n.message)!=null?s:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,n,r){return r(is(this),n)}[Symbol.for("Deno.customInspect")](e,n){return e(is(this),n)}}function wo(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function sr(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(sr).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${sr(t.cause)}`:t.message:`${t}`}function is(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var Ds=t=>{throw TypeError(t)},Rr=(t,e,n)=>e.has(t)||Ds("Cannot "+n),A=(t,e,n)=>(Rr(t,e,"read from private field"),n?n.call(t):e.get(t)),V=(t,e,n)=>e.has(t)?Ds("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Z=(t,e,n,r)=>(Rr(t,e,"write to private field"),e.set(t,n),n),Re=(t,e,n)=>(Rr(t,e,"access private method"),n),re,Ge,ct,un,_n,Rt,ft,Pt,De,dt,pt,lt,At,he,ar,ir,or,os,ur,cr,Ct,dr,lr;class cn extends EventTarget{constructor(e,n){var r,s;super(),V(this,he),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,V(this,re),V(this,Ge),V(this,ct),V(this,un),V(this,_n),V(this,Rt),V(this,ft),V(this,Pt,null),V(this,De),V(this,dt),V(this,pt,null),V(this,lt,null),V(this,At,null),V(this,ir,a=>ot(this,null,function*(){var i;A(this,dt).reset();const{body:o,redirected:u,status:c,headers:h}=a;if(c===204){Re(this,he,Ct).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(u?Z(this,ct,new URL(a.url)):Z(this,ct,void 0),c!==200){Re(this,he,Ct).call(this,`Non-200 status code (${c})`,c);return}if(!(h.get("content-type")||"").startsWith("text/event-stream")){Re(this,he,Ct).call(this,'Invalid content type, expected "text/event-stream"',c);return}if(A(this,re)===this.CLOSED)return;Z(this,re,this.OPEN);const f=new Event("open");if((i=A(this,At))==null||i.call(this,f),this.dispatchEvent(f),typeof o!="object"||!o||!("getReader"in o)){Re(this,he,Ct).call(this,"Invalid response body, expected a web ReadableStream",c),this.close();return}const m=new TextDecoder,g=o.getReader();let x=!0;do{const{done:y,value:O}=yield g.read();O&&A(this,dt).feed(m.decode(O,{stream:!y})),y&&(x=!1,A(this,dt).reset(),Re(this,he,dr).call(this))}while(x)})),V(this,or,a=>{Z(this,De,void 0),!(a.name==="AbortError"||a.type==="aborted")&&Re(this,he,dr).call(this,sr(a))}),V(this,ur,a=>{typeof a.id=="string"&&Z(this,Pt,a.id);const i=new MessageEvent(a.event||"message",{data:a.data,origin:A(this,ct)?A(this,ct).origin:A(this,Ge).origin,lastEventId:a.id||""});A(this,lt)&&(!a.event||a.event==="message")&&A(this,lt).call(this,i),this.dispatchEvent(i)}),V(this,cr,a=>{Z(this,Rt,a)}),V(this,lr,()=>{Z(this,ft,void 0),A(this,re)===this.CONNECTING&&Re(this,he,ar).call(this)});try{if(e instanceof URL)Z(this,Ge,e);else if(typeof e=="string")Z(this,Ge,new URL(e,ko()));else throw new Error("Invalid URL")}catch(a){throw wo("An invalid or illegal string was specified")}Z(this,dt,vo({onEvent:A(this,ur),onRetry:A(this,cr)})),Z(this,re,this.CONNECTING),Z(this,Rt,3e3),Z(this,_n,(r=n==null?void 0:n.fetch)!=null?r:globalThis.fetch),Z(this,un,(s=n==null?void 0:n.withCredentials)!=null?s:!1),Re(this,he,ar).call(this)}get readyState(){return A(this,re)}get url(){return A(this,Ge).href}get withCredentials(){return A(this,un)}get onerror(){return A(this,pt)}set onerror(e){Z(this,pt,e)}get onmessage(){return A(this,lt)}set onmessage(e){Z(this,lt,e)}get onopen(){return A(this,At)}set onopen(e){Z(this,At,e)}addEventListener(e,n,r){const s=n;super.addEventListener(e,s,r)}removeEventListener(e,n,r){const s=n;super.removeEventListener(e,s,r)}close(){A(this,ft)&&clearTimeout(A(this,ft)),A(this,re)!==this.CLOSED&&(A(this,De)&&A(this,De).abort(),Z(this,re,this.CLOSED),Z(this,De,void 0))}}re=new WeakMap,Ge=new WeakMap,ct=new WeakMap,un=new WeakMap,_n=new WeakMap,Rt=new WeakMap,ft=new WeakMap,Pt=new WeakMap,De=new WeakMap,dt=new WeakMap,pt=new WeakMap,lt=new WeakMap,At=new WeakMap,he=new WeakSet,ar=function(){Z(this,re,this.CONNECTING),Z(this,De,new AbortController),A(this,_n)(A(this,Ge),Re(this,he,os).call(this)).then(A(this,ir)).catch(A(this,or))},ir=new WeakMap,or=new WeakMap,os=function(){var t;const e={mode:"cors",redirect:"follow",headers:Be({Accept:"text/event-stream"},A(this,Pt)?{"Last-Event-ID":A(this,Pt)}:void 0),cache:"no-store",signal:(t=A(this,De))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},ur=new WeakMap,cr=new WeakMap,Ct=function(t,e){var n;A(this,re)!==this.CLOSED&&Z(this,re,this.CLOSED);const r=new as("error",{code:e,message:t});(n=A(this,pt))==null||n.call(this,r),this.dispatchEvent(r)},dr=function(t,e){var n;if(A(this,re)===this.CLOSED)return;Z(this,re,this.CONNECTING);const r=new as("error",{code:e,message:t});(n=A(this,pt))==null||n.call(this,r),this.dispatchEvent(r),Z(this,ft,setTimeout(A(this,lr),A(this,Rt)))},lr=new WeakMap,cn.CONNECTING=0,cn.OPEN=1,cn.CLOSED=2;function ko(){const t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}var Ms=Symbol.for("immer-nothing"),us=Symbol.for("immer-draftable"),oe=Symbol.for("immer-state"),Eo=process.env.NODE_ENV!=="production"?[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}]:[];function se(t,...e){if(process.env.NODE_ENV!=="production"){const n=Eo[t],r=typeof n=="function"?n.apply(null,e):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var vt=Object.getPrototypeOf;function bt(t){return!!t&&!!t[oe]}function et(t){var e;return t?Ls(t)||Array.isArray(t)||!!t[us]||!!((e=t.constructor)!=null&&e[us])||xn(t)||Sn(t):!1}var xo=Object.prototype.constructor.toString();function Ls(t){if(!t||typeof t!="object")return!1;const e=vt(t);if(e===null)return!0;const n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===xo}function vn(t,e){En(t)===0?Reflect.ownKeys(t).forEach(n=>{e(n,t[n],t)}):t.forEach((n,r)=>e(r,n,t))}function En(t){const e=t[oe];return e?e.type_:Array.isArray(t)?1:xn(t)?2:Sn(t)?3:0}function fr(t,e){return En(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function $s(t,e,n){const r=En(t);r===2?t.set(e,n):r===3?t.add(n):t[e]=n}function So(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function xn(t){return t instanceof Map}function Sn(t){return t instanceof Set}function qe(t){return t.copy_||t.base_}function hr(t,e){if(xn(t))return new Map(t);if(Sn(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=Ls(t);if(e===!0||e==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(t);delete r[oe];let s=Reflect.ownKeys(r);for(let a=0;a<s.length;a++){const i=s[a],o=r[i];o.writable===!1&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:t[i]})}return Object.create(vt(t),r)}else{const r=vt(t);if(r!==null&&n)return Be({},t);const s=Object.create(r);return Object.assign(s,t)}}function Bt(t,e=!1){return On(t)||bt(t)||!et(t)||(En(t)>1&&(t.set=t.add=t.clear=t.delete=Oo),Object.freeze(t),e&&Object.entries(t).forEach(([n,r])=>Bt(r,!0))),t}function Oo(){se(2)}function On(t){return Object.isFrozen(t)}var To={};function tt(t){const e=To[t];return e||se(0,t),e}var qt;function Fs(){return qt}function Ao(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function cs(t,e){e&&(tt("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function pr(t){mr(t),t.drafts_.forEach(Co),t.drafts_=null}function mr(t){t===qt&&(qt=t.parent_)}function ds(t){return qt=Ao(qt,t)}function Co(t){const e=t[oe];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function ls(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[oe].modified_&&(pr(e),se(4)),et(t)&&(t=bn(e,t),e.parent_||wn(e,t)),e.patches_&&tt("Patches").generateReplacementPatches_(n[oe].base_,t,e.patches_,e.inversePatches_)):t=bn(e,n,[]),pr(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==Ms?t:void 0}function bn(t,e,n){if(On(e))return e;const r=e[oe];if(!r)return vn(e,(s,a)=>fs(t,r,e,s,a,n)),e;if(r.scope_!==t)return e;if(!r.modified_)return wn(t,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const s=r.copy_;let a=s,i=!1;r.type_===3&&(a=new Set(s),s.clear(),i=!0),vn(a,(o,u)=>fs(t,r,s,o,u,n,i)),wn(t,s,!1),n&&t.patches_&&tt("Patches").generatePatches_(r,n,t.patches_,t.inversePatches_)}return r.copy_}function fs(t,e,n,r,s,a,i){if(process.env.NODE_ENV!=="production"&&s===n&&se(5),bt(s)){const o=a&&e&&e.type_!==3&&!fr(e.assigned_,r)?a.concat(r):void 0,u=bn(t,s,o);if($s(n,r,u),bt(u))t.canAutoFreeze_=!1;else return}else i&&n.add(s);if(et(s)&&!On(s)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;bn(t,s),(!e||!e.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&wn(t,s)}}function wn(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&Bt(e,n)}function Ro(t,e){const n=Array.isArray(t),r={type_:n?1:0,scope_:e?e.scope_:Fs(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let s=r,a=Pr;n&&(s=[r],a=Kt);const{revoke:i,proxy:o}=Proxy.revocable(s,a);return r.draft_=o,r.revoke_=i,o}var Pr={get(t,e){if(e===oe)return t;const n=qe(t);if(!fr(n,e))return Po(t,n,e);const r=n[e];return t.finalized_||!et(r)?r:r===Zn(t.base_,e)?(Dn(t),t.copy_[e]=gr(r,t)):r},has(t,e){return e in qe(t)},ownKeys(t){return Reflect.ownKeys(qe(t))},set(t,e,n){const r=Ws(qe(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const s=Zn(qe(t),e),a=s==null?void 0:s[oe];if(a&&a.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(So(n,s)&&(n!==void 0||fr(t.base_,e)))return!0;Dn(t),yr(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty(t,e){return Zn(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,Dn(t),yr(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=qe(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:r.enumerable,value:n[e]}},defineProperty(){se(11)},getPrototypeOf(t){return vt(t.base_)},setPrototypeOf(){se(12)}},Kt={};vn(Pr,(t,e)=>{Kt[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});Kt.deleteProperty=function(t,e){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(e))&&se(13),Kt.set.call(this,t,e,void 0)};Kt.set=function(t,e,n){return process.env.NODE_ENV!=="production"&&e!=="length"&&isNaN(parseInt(e))&&se(14),Pr.set.call(this,t[0],e,n,t[0])};function Zn(t,e){const n=t[oe];return(n?qe(n):t)[e]}function Po(t,e,n){var s;const r=Ws(e,n);return r?"value"in r?r.value:(s=r.get)==null?void 0:s.call(t.draft_):void 0}function Ws(t,e){if(!(e in t))return;let n=vt(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=vt(n)}}function yr(t){t.modified_||(t.modified_=!0,t.parent_&&yr(t.parent_))}function Dn(t){t.copy_||(t.copy_=hr(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var No=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,n,r)=>{if(typeof e=="function"&&typeof n!="function"){const a=n;n=e;const i=this;return function(u=a,...c){return i.produce(u,h=>n.call(this,h,...c))}}typeof n!="function"&&se(6),r!==void 0&&typeof r!="function"&&se(7);let s;if(et(e)){const a=ds(this),i=gr(e,void 0);let o=!0;try{s=n(i),o=!1}finally{o?pr(a):mr(a)}return cs(a,r),ls(s,a)}else if(!e||typeof e!="object"){if(s=n(e),s===void 0&&(s=e),s===Ms&&(s=void 0),this.autoFreeze_&&Bt(s,!0),r){const a=[],i=[];tt("Patches").generateReplacementPatches_(e,s,a,i),r(a,i)}return s}else se(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(i,...o)=>this.produceWithPatches(i,u=>e(u,...o));let r,s;return[this.produce(e,n,(i,o)=>{r=i,s=o}),r,s]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){et(t)||se(8),bt(t)&&(t=jo(t));const e=ds(this),n=gr(t,void 0);return n[oe].isManual_=!0,mr(e),n}finishDraft(t,e){const n=t&&t[oe];(!n||!n.isManual_)&&se(9);const{scope_:r}=n;return cs(r,e),ls(void 0,r)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const s=e[n];if(s.path.length===0&&s.op==="replace"){t=s.value;break}}n>-1&&(e=e.slice(n+1));const r=tt("Patches").applyPatches_;return bt(t)?r(t,e):this.produce(t,s=>r(s,e))}};function gr(t,e){const n=xn(t)?tt("MapSet").proxyMap_(t,e):Sn(t)?tt("MapSet").proxySet_(t,e):Ro(t,e);return(e?e.scope_:Fs()).drafts_.push(n),n}function jo(t){return bt(t)||se(10,t),zs(t)}function zs(t){if(!et(t)||On(t))return t;const e=t[oe];let n;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=hr(t,e.scope_.immer_.useStrictShallowCopy_)}else n=hr(t,!0);return vn(n,(r,s)=>{$s(n,r,zs(s))}),e&&(e.finalized_=!1),n}var ue=new No,Io=ue.produce;ue.produceWithPatches.bind(ue);ue.setAutoFreeze.bind(ue);ue.setUseStrictShallowCopy.bind(ue);ue.applyPatches.bind(ue);ue.createDraft.bind(ue);ue.finishDraft.bind(ue);function Zo(t){var e=L.useState(function(){return Bt(typeof t=="function"?t():t,!0)}),n=e[1];return[e[0],L.useCallback(function(r){n(typeof r=="function"?Io(r):Bt(r))},[])]}const hs={status:"idle",error:null,result:null,tasks:{fetchDesign:{status:"pending"},codeGeneration:{status:"pending",progress:0},uploadAssets:{status:"pending"}}},Do=({url:t,method:e="POST"})=>{const[n,r]=Zo(hs);return{getCode:a=>ot(exports,null,function*(){var u;r(c=>{c.status="pending",c.error=null,c.result=null,c.tasks=hs.tasks});const i=new cn(t,{fetch:(c,h)=>fetch(c,Br(Be({},h),{method:e,body:JSON.stringify(a)}))}),o=new Promise(c=>{const h={};i.addEventListener("start",f=>{const m=JSON.parse(f.data);h.sessionId=m.sessionId,r(g=>{g.tasks.fetchDesign.status="running"})}),i.addEventListener("pre_codegen",f=>{JSON.parse(f.data).message==="Anima model built"&&r(g=>{g.tasks.fetchDesign.status="finished",g.tasks.codeGeneration.status="running",g.tasks.uploadAssets.status="running"})}),i.addEventListener("figma_metadata",f=>{const m=JSON.parse(f.data);h.figmaFileName=m.figmaFileName,h.figmaSelectedFrameName=m.figmaSelectedFrameName}),i.addEventListener("aborted",f=>{r(m=>{m.status="aborted"}),c({result:null,error:new Error("The request was aborted")})}),i.addEventListener("generating_code",f=>{const m=JSON.parse(f.data);if(m.payload.status==="success"){const g=m.payload.files;h.files=vi(g)}r(g=>{g.tasks.codeGeneration.progress=m.payload.progress})}),i.addEventListener("codegen_completed",f=>{r(m=>{m.tasks.codeGeneration.status="finished"})}),i.addEventListener("assets_uploaded",f=>{r(m=>{m.tasks.uploadAssets.status="finished"})}),i.addEventListener("error",f=>{if(f instanceof MessageEvent){const m=JSON.parse(f.data);r(g=>{g.status="error",g.error=new Error(m.payload.message)}),c({result:null,error:new Error(m.payload.message)})}else console.error("EventSource error:",f),r(m=>{m.status="error",m.error=new Error("HTTP error: "+f.message)}),c({result:null,error:new Error("HTTP error: "+f.message)})}),i.addEventListener("done",f=>{r(m=>{m.status="success",m.result=h}),c({result:h,error:null})})});try{const{result:c,error:h}=yield o;return h?{result:null,error:h}:Object.keys((u=c==null?void 0:c.files)!=null?u:{}).length===0?{result:null,error:new Error("No files received")}:{result:c,error:h}}finally{i.close()}}),status:n.status,tasks:n.tasks,error:n.error,result:n.result}};var tn={exports:{}},Mn={};/**
5
+ `?(e.push(n),n=""):n+=a}return[e,n]}class as extends Event{constructor(e,n){var r,s;super(e),this.code=(r=n==null?void 0:n.code)!=null?r:void 0,this.message=(s=n==null?void 0:n.message)!=null?s:void 0}[Symbol.for("nodejs.util.inspect.custom")](e,n,r){return r(is(this),n)}[Symbol.for("Deno.customInspect")](e,n){return e(is(this),n)}}function ko(t){const e=globalThis.DOMException;return typeof e=="function"?new e(t,"SyntaxError"):new SyntaxError(t)}function sr(t){return t instanceof Error?"errors"in t&&Array.isArray(t.errors)?t.errors.map(sr).join(", "):"cause"in t&&t.cause instanceof Error?`${t}: ${sr(t.cause)}`:t.message:`${t}`}function is(t){return{type:t.type,message:t.message,code:t.code,defaultPrevented:t.defaultPrevented,cancelable:t.cancelable,timeStamp:t.timeStamp}}var Ds=t=>{throw TypeError(t)},Nr=(t,e,n)=>e.has(t)||Ds("Cannot "+n),A=(t,e,n)=>(Nr(t,e,"read from private field"),n?n.call(t):e.get(t)),q=(t,e,n)=>e.has(t)?Ds("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),D=(t,e,n,r)=>(Nr(t,e,"write to private field"),e.set(t,n),n),Ne=(t,e,n)=>(Nr(t,e,"access private method"),n),re,Je,ct,un,_n,Nt,ft,Rt,De,dt,pt,lt,At,he,ar,ir,or,os,ur,cr,Ct,dr,lr;class cn extends EventTarget{constructor(e,n){var r,s;super(),q(this,he),this.CONNECTING=0,this.OPEN=1,this.CLOSED=2,q(this,re),q(this,Je),q(this,ct),q(this,un),q(this,_n),q(this,Nt),q(this,ft),q(this,Rt,null),q(this,De),q(this,dt),q(this,pt,null),q(this,lt,null),q(this,At,null),q(this,ir,a=>qe(this,null,function*(){var i;A(this,dt).reset();const{body:o,redirected:u,status:c,headers:h}=a;if(c===204){Ne(this,he,Ct).call(this,"Server sent HTTP 204, not reconnecting",204),this.close();return}if(u?D(this,ct,new URL(a.url)):D(this,ct,void 0),c!==200){Ne(this,he,Ct).call(this,`Non-200 status code (${c})`,c);return}if(!(h.get("content-type")||"").startsWith("text/event-stream")){Ne(this,he,Ct).call(this,'Invalid content type, expected "text/event-stream"',c);return}if(A(this,re)===this.CLOSED)return;D(this,re,this.OPEN);const p=new Event("open");if((i=A(this,At))==null||i.call(this,p),this.dispatchEvent(p),typeof o!="object"||!o||!("getReader"in o)){Ne(this,he,Ct).call(this,"Invalid response body, expected a web ReadableStream",c),this.close();return}const k=new TextDecoder,g=o.getReader();let v=!0;do{const{done:l,value:b}=yield g.read();b&&A(this,dt).feed(k.decode(b,{stream:!l})),l&&(v=!1,A(this,dt).reset(),Ne(this,he,dr).call(this))}while(v)})),q(this,or,a=>{D(this,De,void 0),!(a.name==="AbortError"||a.type==="aborted")&&Ne(this,he,dr).call(this,sr(a))}),q(this,ur,a=>{typeof a.id=="string"&&D(this,Rt,a.id);const i=new MessageEvent(a.event||"message",{data:a.data,origin:A(this,ct)?A(this,ct).origin:A(this,Je).origin,lastEventId:a.id||""});A(this,lt)&&(!a.event||a.event==="message")&&A(this,lt).call(this,i),this.dispatchEvent(i)}),q(this,cr,a=>{D(this,Nt,a)}),q(this,lr,()=>{D(this,ft,void 0),A(this,re)===this.CONNECTING&&Ne(this,he,ar).call(this)});try{if(e instanceof URL)D(this,Je,e);else if(typeof e=="string")D(this,Je,new URL(e,So()));else throw new Error("Invalid URL")}catch(a){throw ko("An invalid or illegal string was specified")}D(this,dt,bo({onEvent:A(this,ur),onRetry:A(this,cr)})),D(this,re,this.CONNECTING),D(this,Nt,3e3),D(this,_n,(r=n==null?void 0:n.fetch)!=null?r:globalThis.fetch),D(this,un,(s=n==null?void 0:n.withCredentials)!=null?s:!1),Ne(this,he,ar).call(this)}get readyState(){return A(this,re)}get url(){return A(this,Je).href}get withCredentials(){return A(this,un)}get onerror(){return A(this,pt)}set onerror(e){D(this,pt,e)}get onmessage(){return A(this,lt)}set onmessage(e){D(this,lt,e)}get onopen(){return A(this,At)}set onopen(e){D(this,At,e)}addEventListener(e,n,r){const s=n;super.addEventListener(e,s,r)}removeEventListener(e,n,r){const s=n;super.removeEventListener(e,s,r)}close(){A(this,ft)&&clearTimeout(A(this,ft)),A(this,re)!==this.CLOSED&&(A(this,De)&&A(this,De).abort(),D(this,re,this.CLOSED),D(this,De,void 0))}}re=new WeakMap,Je=new WeakMap,ct=new WeakMap,un=new WeakMap,_n=new WeakMap,Nt=new WeakMap,ft=new WeakMap,Rt=new WeakMap,De=new WeakMap,dt=new WeakMap,pt=new WeakMap,lt=new WeakMap,At=new WeakMap,he=new WeakSet,ar=function(){D(this,re,this.CONNECTING),D(this,De,new AbortController),A(this,_n)(A(this,Je),Ne(this,he,os).call(this)).then(A(this,ir)).catch(A(this,or))},ir=new WeakMap,or=new WeakMap,os=function(){var t;const e={mode:"cors",redirect:"follow",headers:Be({Accept:"text/event-stream"},A(this,Rt)?{"Last-Event-ID":A(this,Rt)}:void 0),cache:"no-store",signal:(t=A(this,De))==null?void 0:t.signal};return"window"in globalThis&&(e.credentials=this.withCredentials?"include":"same-origin"),e},ur=new WeakMap,cr=new WeakMap,Ct=function(t,e){var n;A(this,re)!==this.CLOSED&&D(this,re,this.CLOSED);const r=new as("error",{code:e,message:t});(n=A(this,pt))==null||n.call(this,r),this.dispatchEvent(r)},dr=function(t,e){var n;if(A(this,re)===this.CLOSED)return;D(this,re,this.CONNECTING);const r=new as("error",{code:e,message:t});(n=A(this,pt))==null||n.call(this,r),this.dispatchEvent(r),D(this,ft,setTimeout(A(this,lr),A(this,Nt)))},lr=new WeakMap,cn.CONNECTING=0,cn.OPEN=1,cn.CLOSED=2;function So(){const t="document"in globalThis?globalThis.document:void 0;return t&&typeof t=="object"&&"baseURI"in t&&typeof t.baseURI=="string"?t.baseURI:void 0}var Ms=Symbol.for("immer-nothing"),us=Symbol.for("immer-draftable"),ue=Symbol.for("immer-state"),xo=process.env.NODE_ENV!=="production"?[function(t){return`The plugin for '${t}' has not been loaded into Immer. To enable the plugin, import and call \`enable${t}()\` when initializing your application.`},function(t){return`produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '${t}'`},"This object has been frozen and should not be mutated",function(t){return"Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+t},"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.","Immer forbids circular references","The first or second argument to `produce` must be a function","The third argument to `produce` must be a function or undefined","First argument to `createDraft` must be a plain object, an array, or an immerable object","First argument to `finishDraft` must be a draft returned by `createDraft`",function(t){return`'current' expects a draft, got: ${t}`},"Object.defineProperty() cannot be used on an Immer draft","Object.setPrototypeOf() cannot be used on an Immer draft","Immer only supports deleting array indices","Immer only supports setting array indices and the 'length' property",function(t){return`'original' expects a draft, got: ${t}`}]:[];function se(t,...e){if(process.env.NODE_ENV!=="production"){const n=xo[t],r=typeof n=="function"?n.apply(null,e):n;throw new Error(`[Immer] ${r}`)}throw new Error(`[Immer] minified error nr: ${t}. Full error at: https://bit.ly/3cXEKWf`)}var vt=Object.getPrototypeOf;function bt(t){return!!t&&!!t[ue]}function tt(t){var e;return t?Ls(t)||Array.isArray(t)||!!t[us]||!!((e=t.constructor)!=null&&e[us])||xn(t)||En(t):!1}var Eo=Object.prototype.constructor.toString();function Ls(t){if(!t||typeof t!="object")return!1;const e=vt(t);if(e===null)return!0;const n=Object.hasOwnProperty.call(e,"constructor")&&e.constructor;return n===Object?!0:typeof n=="function"&&Function.toString.call(n)===Eo}function vn(t,e){Sn(t)===0?Reflect.ownKeys(t).forEach(n=>{e(n,t[n],t)}):t.forEach((n,r)=>e(r,n,t))}function Sn(t){const e=t[ue];return e?e.type_:Array.isArray(t)?1:xn(t)?2:En(t)?3:0}function fr(t,e){return Sn(t)===2?t.has(e):Object.prototype.hasOwnProperty.call(t,e)}function $s(t,e,n){const r=Sn(t);r===2?t.set(e,n):r===3?t.add(n):t[e]=n}function Oo(t,e){return t===e?t!==0||1/t===1/e:t!==t&&e!==e}function xn(t){return t instanceof Map}function En(t){return t instanceof Set}function Ke(t){return t.copy_||t.base_}function hr(t,e){if(xn(t))return new Map(t);if(En(t))return new Set(t);if(Array.isArray(t))return Array.prototype.slice.call(t);const n=Ls(t);if(e===!0||e==="class_only"&&!n){const r=Object.getOwnPropertyDescriptors(t);delete r[ue];let s=Reflect.ownKeys(r);for(let a=0;a<s.length;a++){const i=s[a],o=r[i];o.writable===!1&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:t[i]})}return Object.create(vt(t),r)}else{const r=vt(t);if(r!==null&&n)return Be({},t);const s=Object.create(r);return Object.assign(s,t)}}function Bt(t,e=!1){return On(t)||bt(t)||!tt(t)||(Sn(t)>1&&(t.set=t.add=t.clear=t.delete=To),Object.freeze(t),e&&Object.entries(t).forEach(([n,r])=>Bt(r,!0))),t}function To(){se(2)}function On(t){return Object.isFrozen(t)}var Ao={};function nt(t){const e=Ao[t];return e||se(0,t),e}var qt;function Fs(){return qt}function Co(t,e){return{drafts_:[],parent_:t,immer_:e,canAutoFreeze_:!0,unfinalizedDrafts_:0}}function cs(t,e){e&&(nt("Patches"),t.patches_=[],t.inversePatches_=[],t.patchListener_=e)}function pr(t){mr(t),t.drafts_.forEach(No),t.drafts_=null}function mr(t){t===qt&&(qt=t.parent_)}function ds(t){return qt=Co(qt,t)}function No(t){const e=t[ue];e.type_===0||e.type_===1?e.revoke_():e.revoked_=!0}function ls(t,e){e.unfinalizedDrafts_=e.drafts_.length;const n=e.drafts_[0];return t!==void 0&&t!==n?(n[ue].modified_&&(pr(e),se(4)),tt(t)&&(t=bn(e,t),e.parent_||wn(e,t)),e.patches_&&nt("Patches").generateReplacementPatches_(n[ue].base_,t,e.patches_,e.inversePatches_)):t=bn(e,n,[]),pr(e),e.patches_&&e.patchListener_(e.patches_,e.inversePatches_),t!==Ms?t:void 0}function bn(t,e,n){if(On(e))return e;const r=e[ue];if(!r)return vn(e,(s,a)=>fs(t,r,e,s,a,n)),e;if(r.scope_!==t)return e;if(!r.modified_)return wn(t,r.base_,!0),r.base_;if(!r.finalized_){r.finalized_=!0,r.scope_.unfinalizedDrafts_--;const s=r.copy_;let a=s,i=!1;r.type_===3&&(a=new Set(s),s.clear(),i=!0),vn(a,(o,u)=>fs(t,r,s,o,u,n,i)),wn(t,s,!1),n&&t.patches_&&nt("Patches").generatePatches_(r,n,t.patches_,t.inversePatches_)}return r.copy_}function fs(t,e,n,r,s,a,i){if(process.env.NODE_ENV!=="production"&&s===n&&se(5),bt(s)){const o=a&&e&&e.type_!==3&&!fr(e.assigned_,r)?a.concat(r):void 0,u=bn(t,s,o);if($s(n,r,u),bt(u))t.canAutoFreeze_=!1;else return}else i&&n.add(s);if(tt(s)&&!On(s)){if(!t.immer_.autoFreeze_&&t.unfinalizedDrafts_<1)return;bn(t,s),(!e||!e.scope_.parent_)&&typeof r!="symbol"&&Object.prototype.propertyIsEnumerable.call(n,r)&&wn(t,s)}}function wn(t,e,n=!1){!t.parent_&&t.immer_.autoFreeze_&&t.canAutoFreeze_&&Bt(e,n)}function Ro(t,e){const n=Array.isArray(t),r={type_:n?1:0,scope_:e?e.scope_:Fs(),modified_:!1,finalized_:!1,assigned_:{},parent_:e,base_:t,draft_:null,copy_:null,revoke_:null,isManual_:!1};let s=r,a=Rr;n&&(s=[r],a=Kt);const{revoke:i,proxy:o}=Proxy.revocable(s,a);return r.draft_=o,r.revoke_=i,o}var Rr={get(t,e){if(e===ue)return t;const n=Ke(t);if(!fr(n,e))return Po(t,n,e);const r=n[e];return t.finalized_||!tt(r)?r:r===Zn(t.base_,e)?(Dn(t),t.copy_[e]=gr(r,t)):r},has(t,e){return e in Ke(t)},ownKeys(t){return Reflect.ownKeys(Ke(t))},set(t,e,n){const r=Ws(Ke(t),e);if(r!=null&&r.set)return r.set.call(t.draft_,n),!0;if(!t.modified_){const s=Zn(Ke(t),e),a=s==null?void 0:s[ue];if(a&&a.base_===n)return t.copy_[e]=n,t.assigned_[e]=!1,!0;if(Oo(n,s)&&(n!==void 0||fr(t.base_,e)))return!0;Dn(t),yr(t)}return t.copy_[e]===n&&(n!==void 0||e in t.copy_)||Number.isNaN(n)&&Number.isNaN(t.copy_[e])||(t.copy_[e]=n,t.assigned_[e]=!0),!0},deleteProperty(t,e){return Zn(t.base_,e)!==void 0||e in t.base_?(t.assigned_[e]=!1,Dn(t),yr(t)):delete t.assigned_[e],t.copy_&&delete t.copy_[e],!0},getOwnPropertyDescriptor(t,e){const n=Ke(t),r=Reflect.getOwnPropertyDescriptor(n,e);return r&&{writable:!0,configurable:t.type_!==1||e!=="length",enumerable:r.enumerable,value:n[e]}},defineProperty(){se(11)},getPrototypeOf(t){return vt(t.base_)},setPrototypeOf(){se(12)}},Kt={};vn(Rr,(t,e)=>{Kt[t]=function(){return arguments[0]=arguments[0][0],e.apply(this,arguments)}});Kt.deleteProperty=function(t,e){return process.env.NODE_ENV!=="production"&&isNaN(parseInt(e))&&se(13),Kt.set.call(this,t,e,void 0)};Kt.set=function(t,e,n){return process.env.NODE_ENV!=="production"&&e!=="length"&&isNaN(parseInt(e))&&se(14),Rr.set.call(this,t[0],e,n,t[0])};function Zn(t,e){const n=t[ue];return(n?Ke(n):t)[e]}function Po(t,e,n){var s;const r=Ws(e,n);return r?"value"in r?r.value:(s=r.get)==null?void 0:s.call(t.draft_):void 0}function Ws(t,e){if(!(e in t))return;let n=vt(t);for(;n;){const r=Object.getOwnPropertyDescriptor(n,e);if(r)return r;n=vt(n)}}function yr(t){t.modified_||(t.modified_=!0,t.parent_&&yr(t.parent_))}function Dn(t){t.copy_||(t.copy_=hr(t.base_,t.scope_.immer_.useStrictShallowCopy_))}var Io=class{constructor(t){this.autoFreeze_=!0,this.useStrictShallowCopy_=!1,this.produce=(e,n,r)=>{if(typeof e=="function"&&typeof n!="function"){const a=n;n=e;const i=this;return function(u=a,...c){return i.produce(u,h=>n.call(this,h,...c))}}typeof n!="function"&&se(6),r!==void 0&&typeof r!="function"&&se(7);let s;if(tt(e)){const a=ds(this),i=gr(e,void 0);let o=!0;try{s=n(i),o=!1}finally{o?pr(a):mr(a)}return cs(a,r),ls(s,a)}else if(!e||typeof e!="object"){if(s=n(e),s===void 0&&(s=e),s===Ms&&(s=void 0),this.autoFreeze_&&Bt(s,!0),r){const a=[],i=[];nt("Patches").generateReplacementPatches_(e,s,a,i),r(a,i)}return s}else se(1,e)},this.produceWithPatches=(e,n)=>{if(typeof e=="function")return(i,...o)=>this.produceWithPatches(i,u=>e(u,...o));let r,s;return[this.produce(e,n,(i,o)=>{r=i,s=o}),r,s]},typeof(t==null?void 0:t.autoFreeze)=="boolean"&&this.setAutoFreeze(t.autoFreeze),typeof(t==null?void 0:t.useStrictShallowCopy)=="boolean"&&this.setUseStrictShallowCopy(t.useStrictShallowCopy)}createDraft(t){tt(t)||se(8),bt(t)&&(t=jo(t));const e=ds(this),n=gr(t,void 0);return n[ue].isManual_=!0,mr(e),n}finishDraft(t,e){const n=t&&t[ue];(!n||!n.isManual_)&&se(9);const{scope_:r}=n;return cs(r,e),ls(void 0,r)}setAutoFreeze(t){this.autoFreeze_=t}setUseStrictShallowCopy(t){this.useStrictShallowCopy_=t}applyPatches(t,e){let n;for(n=e.length-1;n>=0;n--){const s=e[n];if(s.path.length===0&&s.op==="replace"){t=s.value;break}}n>-1&&(e=e.slice(n+1));const r=nt("Patches").applyPatches_;return bt(t)?r(t,e):this.produce(t,s=>r(s,e))}};function gr(t,e){const n=xn(t)?nt("MapSet").proxyMap_(t,e):En(t)?nt("MapSet").proxySet_(t,e):Ro(t,e);return(e?e.scope_:Fs()).drafts_.push(n),n}function jo(t){return bt(t)||se(10,t),zs(t)}function zs(t){if(!tt(t)||On(t))return t;const e=t[ue];let n;if(e){if(!e.modified_)return e.base_;e.finalized_=!0,n=hr(t,e.scope_.immer_.useStrictShallowCopy_)}else n=hr(t,!0);return vn(n,(r,s)=>{$s(n,r,zs(s))}),e&&(e.finalized_=!1),n}var ce=new Io,Zo=ce.produce;ce.produceWithPatches.bind(ce);ce.setAutoFreeze.bind(ce);ce.setUseStrictShallowCopy.bind(ce);ce.applyPatches.bind(ce);ce.createDraft.bind(ce);ce.finishDraft.bind(ce);function Do(t){var e=F.useState(function(){return Bt(typeof t=="function"?t():t,!0)}),n=e[1];return[e[0],F.useCallback(function(r){n(typeof r=="function"?Zo(r):Bt(r))},[])]}const hs={status:"idle",error:null,result:null,tasks:{fetchDesign:{status:"pending"},codeGeneration:{status:"pending",progress:0},uploadAssets:{status:"pending"}}},Mo=({url:t,method:e="POST"})=>{const[n,r]=Do(hs);return{getCode:a=>qe(exports,null,function*(){var c,h,p,k;r(g=>{g.status="pending",g.error=null,g.result=null,g.tasks=hs.tasks});const i=structuredClone(a);((c=a.assetsStorage)==null?void 0:c.strategy)==="local"&&(a.assetsStorage={strategy:"external",url:a.assetsStorage.path});const o=new cn(t,{fetch:(g,v)=>fetch(g,Br(Be({},v),{method:e,body:JSON.stringify(a)}))}),u=new Promise(g=>{const v={};o.addEventListener("start",l=>{const b=JSON.parse(l.data);v.sessionId=b.sessionId,r(m=>{m.tasks.fetchDesign.status="running"})}),o.addEventListener("pre_codegen",l=>{JSON.parse(l.data).message==="Anima model built"&&r(m=>{m.tasks.fetchDesign.status="finished",m.tasks.codeGeneration.status="running",m.tasks.uploadAssets.status="running"})}),o.addEventListener("figma_metadata",l=>{const b=JSON.parse(l.data);v.figmaFileName=b.figmaFileName,v.figmaSelectedFrameName=b.figmaSelectedFrameName}),o.addEventListener("aborted",()=>{r(l=>{l.status="aborted"}),g({result:null,error:new Error("The request was aborted")})}),o.addEventListener("generating_code",l=>{const b=JSON.parse(l.data);if(b.payload.status==="success"){const m=b.payload.files;v.files=fa(m)}r(m=>{m.tasks.codeGeneration.progress=b.payload.progress})}),o.addEventListener("codegen_completed",()=>{r(l=>{l.tasks.codeGeneration.status="finished"})}),o.addEventListener("assets_uploaded",()=>{r(l=>{l.tasks.uploadAssets.status="finished"})}),o.addEventListener("assets_list",l=>{const b=JSON.parse(l.data);v.assets=b.payload.assets}),o.addEventListener("error",l=>{if(l instanceof MessageEvent){const b=JSON.parse(l.data);r(m=>{m.status="error",m.error=new Error(b.payload.message)}),g({result:null,error:new Error(b.payload.message)})}else console.error("EventSource error:",l),r(b=>{b.status="error",b.error=new Error("HTTP error: "+l.message)}),g({result:null,error:new Error("HTTP error: "+l.message)})}),o.addEventListener("done",()=>{r(l=>{l.status="success",l.result=v}),g({result:v,error:null})})});try{const{result:g,error:v}=yield u,l=structuredClone(g);if(((h=i.assetsStorage)==null?void 0:h.strategy)==="local"&&((p=l==null?void 0:l.assets)!=null&&p.length)){const b=l.assets.map(j=>qe(exports,null,function*(){const B=yield(yield fetch(j.url)).arrayBuffer();return{assetName:j.name,base64:ia(B)}})),m=yield Promise.allSettled(b);for(const j of m){const M={};if(j.status==="fulfilled"){const{assetName:B,base64:z}=j.value;M[B]=z,l.files[`${i.assetsStorage.path}/${B}`]={content:z,isBinary:!0}}}}return v?{result:null,error:v}:Object.keys((k=l==null?void 0:l.files)!=null?k:{}).length===0?{result:null,error:new Error("No files received")}:{result:l,error:v}}finally{o.close()}}),status:n.status,tasks:n.tasks,error:n.error,result:n.result}};var tn={exports:{}},Mn={};/**
6
6
  * @license React
7
7
  * use-sync-external-store-shim.production.js
8
8
  *
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * This source code is licensed under the MIT license found in the
12
12
  * LICENSE file in the root directory of this source tree.
13
- */var ps;function Mo(){if(ps)return Mn;ps=1;var t=L;function e(f,m){return f===m&&(f!==0||1/f===1/m)||f!==f&&m!==m}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,s=t.useEffect,a=t.useLayoutEffect,i=t.useDebugValue;function o(f,m){var g=m(),x=r({inst:{value:g,getSnapshot:m}}),y=x[0].inst,O=x[1];return a(function(){y.value=g,y.getSnapshot=m,u(y)&&O({inst:y})},[f,g,m]),s(function(){return u(y)&&O({inst:y}),f(function(){u(y)&&O({inst:y})})},[f]),i(g),g}function u(f){var m=f.getSnapshot;f=f.value;try{var g=m();return!n(f,g)}catch(x){return!0}}function c(f,m){return m()}var h=typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"?c:o;return Mn.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:h,Mn}var Ln={};/**
13
+ */var ps;function Lo(){if(ps)return Mn;ps=1;var t=F;function e(p,k){return p===k&&(p!==0||1/p===1/k)||p!==p&&k!==k}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,s=t.useEffect,a=t.useLayoutEffect,i=t.useDebugValue;function o(p,k){var g=k(),v=r({inst:{value:g,getSnapshot:k}}),l=v[0].inst,b=v[1];return a(function(){l.value=g,l.getSnapshot=k,u(l)&&b({inst:l})},[p,g,k]),s(function(){return u(l)&&b({inst:l}),p(function(){u(l)&&b({inst:l})})},[p]),i(g),g}function u(p){var k=p.getSnapshot;p=p.value;try{var g=k();return!n(p,g)}catch(v){return!0}}function c(p,k){return k()}var h=typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"?c:o;return Mn.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:h,Mn}var Ln={};/**
14
14
  * @license React
15
15
  * use-sync-external-store-shim.development.js
16
16
  *
@@ -18,5 +18,5 @@
18
18
  *
19
19
  * This source code is licensed under the MIT license found in the
20
20
  * LICENSE file in the root directory of this source tree.
21
- */var ms;function Lo(){return ms||(ms=1,process.env.NODE_ENV!=="production"&&function(){function t(g,x){return g===x&&(g!==0||1/g===1/x)||g!==g&&x!==x}function e(g,x){h||s.startTransition===void 0||(h=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var y=x();if(!f){var O=x();a(y,O)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),f=!0)}O=i({inst:{value:y,getSnapshot:x}});var v=O[0].inst,U=O[1];return u(function(){v.value=y,v.getSnapshot=x,n(v)&&U({inst:v})},[g,y,x]),o(function(){return n(v)&&U({inst:v}),g(function(){n(v)&&U({inst:v})})},[g]),c(y),y}function n(g){var x=g.getSnapshot;g=g.value;try{var y=x();return!a(g,y)}catch(O){return!0}}function r(g,x){return x()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=L,a=typeof Object.is=="function"?Object.is:t,i=s.useState,o=s.useEffect,u=s.useLayoutEffect,c=s.useDebugValue,h=!1,f=!1,m=typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"?r:e;Ln.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:m,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Ln}var ys;function $o(){return ys||(ys=1,process.env.NODE_ENV==="production"?tn.exports=Mo():tn.exports=Lo()),tn.exports}var Fo=$o();const Vs=0,Us=1,Bs=2,gs=3;var _s=Object.prototype.hasOwnProperty;function _r(t,e){var n,r;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((r=t.length)===e.length)for(;r--&&_r(t[r],e[r]););return r===-1}if(!n||typeof t=="object"){r=0;for(n in t)if(_s.call(t,n)&&++r&&!_s.call(e,n)||!(n in e)||!_r(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!==t&&e!==e}const Ne=new WeakMap,Me=()=>{},Q=Me(),vr=Object,R=t=>t===Q,we=t=>typeof t=="function",ze=(t,e)=>Be(Be({},t),e),qs=t=>we(t.then),$n={},nn={},Nr="undefined",Jt=typeof window!=Nr,br=typeof document!=Nr,Wo=Jt&&"Deno"in window,zo=()=>Jt&&typeof window.requestAnimationFrame!=Nr,Ks=(t,e)=>{const n=Ne.get(t);return[()=>!R(e)&&t.get(e)||$n,r=>{if(!R(e)){const s=t.get(e);e in nn||(nn[e]=s),n[5](e,ze(s,r),s||$n)}},n[6],()=>!R(e)&&e in nn?nn[e]:!R(e)&&t.get(e)||$n]};let wr=!0;const Vo=()=>wr,[kr,Er]=Jt&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Me,Me],Uo=()=>{const t=br&&document.visibilityState;return R(t)||t!=="hidden"},Bo=t=>(br&&document.addEventListener("visibilitychange",t),kr("focus",t),()=>{br&&document.removeEventListener("visibilitychange",t),Er("focus",t)}),qo=t=>{const e=()=>{wr=!0,t()},n=()=>{wr=!1};return kr("online",e),kr("offline",n),()=>{Er("online",e),Er("offline",n)}},Ko={isOnline:Vo,isVisible:Uo},Ho={initFocus:Bo,initReconnect:qo},vs=!L.useId,Ht=!Jt||Wo,Go=t=>zo()?window.requestAnimationFrame(t):setTimeout(t,1),Fn=Ht?L.useEffect:L.useLayoutEffect,Wn=typeof navigator!="undefined"&&navigator.connection,bs=!Ht&&Wn&&(["slow-2g","2g"].includes(Wn.effectiveType)||Wn.saveData),rn=new WeakMap,zn=(t,e)=>vr.prototype.toString.call(t)===`[object ${e}]`;let Jo=0;const xr=t=>{const e=typeof t,n=zn(t,"Date"),r=zn(t,"RegExp"),s=zn(t,"Object");let a,i;if(vr(t)===t&&!n&&!r){if(a=rn.get(t),a)return a;if(a=++Jo+"~",rn.set(t,a),Array.isArray(t)){for(a="@",i=0;i<t.length;i++)a+=xr(t[i])+",";rn.set(t,a)}if(s){a="#";const o=vr.keys(t).sort();for(;!R(i=o.pop());)R(t[i])||(a+=i+":"+xr(t[i])+",");rn.set(t,a)}}else a=n?t.toJSON():e=="symbol"?t.toString():e=="string"?JSON.stringify(t):""+t;return a},jr=t=>{if(we(t))try{t=t()}catch(n){t=""}const e=t;return t=typeof t=="string"?t:(Array.isArray(t)?t.length:t)?xr(t):"",[t,e]};let Xo=0;const Sr=()=>++Xo;function Hs(...t){return ot(this,null,function*(){const[e,n,r,s]=t,a=ze({populateCache:!0,throwOnError:!0},typeof s=="boolean"?{revalidate:s}:s||{});let i=a.populateCache;const o=a.rollbackOnError;let u=a.optimisticData;const c=m=>typeof o=="function"?o(m):o!==!1,h=a.throwOnError;if(we(n)){const m=n,g=[],x=e.keys();for(const y of x)!/^\$(inf|sub)\$/.test(y)&&m(e.get(y)._k)&&g.push(y);return Promise.all(g.map(f))}return f(n);function f(m){return ot(this,null,function*(){const[g]=jr(m);if(!g)return;const[x,y]=Ks(e,g),[O,v,U,W]=Ne.get(e),te=()=>{const le=O[g];return(we(a.revalidate)?a.revalidate(x().data,m):a.revalidate!==!1)&&(delete U[g],delete W[g],le&&le[0])?le[0](Bs).then(()=>x().data):x().data};if(t.length<3)return te();let B=r,J;const D=Sr();v[g]=[D,0];const M=!R(u),Oe=x(),I=Oe.data,nt=Oe._c,Ve=R(nt)?I:nt;if(M&&(u=we(u)?u(Ve,I):u,y({data:u,_c:Ve})),we(B))try{B=B(Ve)}catch(le){J=le}if(B&&qs(B))if(B=yield B.catch(le=>{J=le}),D!==v[g][0]){if(J)throw J;return B}else J&&M&&c(J)&&(i=!0,y({data:Ve,_c:Q}));if(i&&!J)if(we(i)){const le=i(B,Ve);y({data:le,error:Q,_c:Q})}else y({data:B,error:Q,_c:Q});if(v[g][1]=Sr(),Promise.resolve(te()).then(()=>{y({_c:Q})}),J){if(h)throw J;return}return B})}})}const ws=(t,e)=>{for(const n in t)t[n][0]&&t[n][0](e)},Yo=(t,e)=>{if(!Ne.has(t)){const n=ze(Ho,e),r={},s=Hs.bind(Q,t);let a=Me;const i={},o=(h,f)=>{const m=i[h]||[];return i[h]=m,m.push(f),()=>m.splice(m.indexOf(f),1)},u=(h,f,m)=>{t.set(h,f);const g=i[h];if(g)for(const x of g)x(f,m)},c=()=>{if(!Ne.has(t)&&(Ne.set(t,[r,{},{},{},s,u,o]),!Ht)){const h=n.initFocus(setTimeout.bind(Q,ws.bind(Q,r,Vs))),f=n.initReconnect(setTimeout.bind(Q,ws.bind(Q,r,Us)));a=()=>{h&&h(),f&&f(),Ne.delete(t)}}};return c(),[t,s,c,a]}return[t,Ne.get(t)[4]]},Qo=(t,e,n,r,s)=>{const a=n.errorRetryCount,i=s.retryCount,o=~~((Math.random()+.5)*(1<<(i<8?i:8)))*n.errorRetryInterval;!R(a)&&i>a||setTimeout(r,o,s)},eu=_r,[Gs,tu]=Yo(new Map),nu=ze({onLoadingSlow:Me,onSuccess:Me,onError:Me,onErrorRetry:Qo,onDiscarded:Me,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:bs?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:bs?5e3:3e3,compare:eu,isPaused:()=>!1,cache:Gs,mutate:tu,fallback:{}},Ko),ru=(t,e)=>{const n=ze(t,e);if(e){const{use:r,fallback:s}=t,{use:a,fallback:i}=e;r&&a&&(n.use=r.concat(a)),s&&i&&(n.fallback=ze(s,i))}return n},su=L.createContext({}),au="$inf$",Js=Jt&&window.__SWR_DEVTOOLS_USE__,iu=Js?window.__SWR_DEVTOOLS_USE__:[],ou=()=>{Js&&(window.__SWR_DEVTOOLS_REACT__=L)},uu=t=>we(t[1])?[t[0],t[1],t[2]||{}]:[t[0],null,(t[1]===null?t[2]:t[1])||{}],cu=()=>ze(nu,L.useContext(su)),du=t=>(e,n,r)=>t(e,n&&((...a)=>{const[i]=jr(e),[,,,o]=Ne.get(Gs);if(i.startsWith(au))return n(...a);const u=o[i];return R(u)?n(...a):(delete o[i],u)}),r),lu=iu.concat(du),fu=t=>function(...n){const r=cu(),[s,a,i]=uu(n),o=ru(r,i);let u=t;const{use:c}=o,h=(c||[]).concat(lu);for(let f=h.length;f--;)u=h[f](u);return u(s,a||o.fetcher||null,o)},hu=(t,e,n)=>{const r=e[t]||(e[t]=[]);return r.push(n),()=>{const s=r.indexOf(n);s>=0&&(r[s]=r[r.length-1],r.pop())}};ou();const Vn=L.use||(t=>{switch(t.status){case"pending":throw t;case"fulfilled":return t.value;case"rejected":throw t.reason;default:throw t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}),t}}),Un={dedupe:!0},pu=(t,e,n)=>{const{cache:r,compare:s,suspense:a,fallbackData:i,revalidateOnMount:o,revalidateIfStale:u,refreshInterval:c,refreshWhenHidden:h,refreshWhenOffline:f,keepPreviousData:m}=n,[g,x,y,O]=Ne.get(r),[v,U]=jr(t),W=L.useRef(!1),te=L.useRef(!1),B=L.useRef(v),J=L.useRef(e),D=L.useRef(n),M=()=>D.current,Oe=()=>M().isVisible()&&M().isOnline(),[I,nt,Ve,le]=Ks(r,v),rt=L.useRef({}).current,Xt=R(i)?R(n.fallback)?Q:n.fallback[v]:i,Ir=(N,j)=>{for(const K in rt){const F=K;if(F==="data"){if(!s(N[F],j[F])&&(!R(N[F])||!s(Qt,j[F])))return!1}else if(j[F]!==N[F])return!1}return!0},Zr=L.useMemo(()=>{const N=!v||!e?!1:R(o)?M().isPaused()||a?!1:u!==!1:o,j=X=>{const Te=ze(X);return delete Te._k,N?Be({isValidating:!0,isLoading:!0},Te):Te},K=I(),F=le(),ge=j(K),it=K===F?ge:j(F);let q=ge;return[()=>{const X=j(I());return Ir(X,q)?(q.data=X.data,q.isLoading=X.isLoading,q.isValidating=X.isValidating,q.error=X.error,q):(q=X,X)},()=>it]},[r,v]),st=Fo.useSyncExternalStore(L.useCallback(N=>Ve(v,(j,K)=>{Ir(K,j)||N()}),[r,v]),Zr[0],Zr[1]),Dr=!W.current,Xs=g[v]&&g[v].length>0,at=st.data,Ue=R(at)?Xt&&qs(Xt)?Vn(Xt):Xt:at,Yt=st.error,Tn=L.useRef(Ue),Qt=m?R(at)?R(Tn.current)?Ue:Tn.current:at:Ue,Mr=Xs&&!R(Yt)?!1:Dr&&!R(o)?o:M().isPaused()?!1:a?R(Ue)?!1:u:R(Ue)||u,Lr=!!(v&&e&&Dr&&Mr),Ys=R(st.isValidating)?Lr:st.isValidating,Qs=R(st.isLoading)?Lr:st.isLoading,wt=L.useCallback(N=>ot(exports,null,function*(){const j=J.current;if(!v||!j||te.current||M().isPaused())return!1;let K,F,ge=!0;const it=N||{},q=!y[v]||!it.dedupe,X=()=>vs?!te.current&&v===B.current&&W.current:v===B.current,Te={isValidating:!1,isLoading:!1},Fr=()=>{nt(Te)},Wr=()=>{const ce=y[v];ce&&ce[1]===F&&delete y[v]},zr={isValidating:!0};R(I().data)&&(zr.isLoading=!0);try{if(q&&(nt(zr),n.loadingTimeout&&R(I().data)&&setTimeout(()=>{ge&&X()&&M().onLoadingSlow(v,n)},n.loadingTimeout),y[v]=[j(U),Sr()]),[K,F]=y[v],K=yield K,q&&setTimeout(Wr,n.dedupingInterval),!y[v]||y[v][1]!==F)return q&&X()&&M().onDiscarded(v),!1;Te.error=Q;const ce=x[v];if(!R(ce)&&(F<=ce[0]||F<=ce[1]||ce[1]===0))return Fr(),q&&X()&&M().onDiscarded(v),!1;const Ae=I().data;Te.data=s(Ae,K)?Ae:K,q&&X()&&M().onSuccess(K,v,n)}catch(ce){Wr();const Ae=M(),{shouldRetryOnError:An}=Ae;Ae.isPaused()||(Te.error=ce,q&&X()&&(Ae.onError(ce,v,Ae),(An===!0||we(An)&&An(ce))&&(!M().revalidateOnFocus||!M().revalidateOnReconnect||Oe())&&Ae.onErrorRetry(ce,v,Ae,ea=>{const Cn=g[v];Cn&&Cn[0]&&Cn[0](gs,ea)},{retryCount:(it.retryCount||0)+1,dedupe:!0})))}return ge=!1,Fr(),!0}),[v,r]),$r=L.useCallback((...N)=>Hs(r,B.current,...N),[]);if(Fn(()=>{J.current=e,D.current=n,R(at)||(Tn.current=at)}),Fn(()=>{if(!v)return;const N=wt.bind(Q,Un);let j=0;const F=hu(v,g,(ge,it={})=>{if(ge==Vs){const q=Date.now();M().revalidateOnFocus&&q>j&&Oe()&&(j=q+M().focusThrottleInterval,N())}else if(ge==Us)M().revalidateOnReconnect&&Oe()&&N();else{if(ge==Bs)return wt();if(ge==gs)return wt(it)}});return te.current=!1,B.current=v,W.current=!0,nt({_k:U}),Mr&&(R(Ue)||Ht?N():Go(N)),()=>{te.current=!0,F()}},[v]),Fn(()=>{let N;function j(){const F=we(c)?c(I().data):c;F&&N!==-1&&(N=setTimeout(K,F))}function K(){!I().error&&(h||M().isVisible())&&(f||M().isOnline())?wt(Un).then(j):j()}return j(),()=>{N&&(clearTimeout(N),N=-1)}},[c,h,f,v]),L.useDebugValue(Qt),a&&R(Ue)&&v){if(!vs&&Ht)throw new Error("Fallback data is required when using Suspense in SSR.");J.current=e,D.current=n,te.current=!1;const N=O[v];if(!R(N)){const j=$r(N);Vn(j)}if(R(Yt)){const j=wt(Un);R(Qt)||(j.status="fulfilled",j.value=!0),Vn(j)}else throw Yt}return{mutate:$r,get data(){return rt.data=!0,Qt},get error(){return rt.error=!0,Yt},get isValidating(){return rt.isValidating=!0,Ys},get isLoading(){return rt.isLoading=!0,Qs}}},mu=fu(pu),yu=({fileKey:t,authToken:e,enabled:n=!0,params:r={}})=>{const s=!!(n&&t&&e),{data:a,isLoading:i,error:o}=mu(["figma",t,e,r],()=>s?yo({fileKey:t,authToken:e,params:r}):null,{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1});return{data:a!=null?a:null,isLoading:i,error:o}};exports.useAnimaCodegen=Do;exports.useFigmaFile=yu;
21
+ */var ms;function $o(){return ms||(ms=1,process.env.NODE_ENV!=="production"&&function(){function t(g,v){return g===v&&(g!==0||1/g===1/v)||g!==g&&v!==v}function e(g,v){h||s.startTransition===void 0||(h=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var l=v();if(!p){var b=v();a(l,b)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),p=!0)}b=i({inst:{value:l,getSnapshot:v}});var m=b[0].inst,j=b[1];return u(function(){m.value=l,m.getSnapshot=v,n(m)&&j({inst:m})},[g,l,v]),o(function(){return n(m)&&j({inst:m}),g(function(){n(m)&&j({inst:m})})},[g]),c(l),l}function n(g){var v=g.getSnapshot;g=g.value;try{var l=v();return!a(g,l)}catch(b){return!0}}function r(g,v){return v()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var s=F,a=typeof Object.is=="function"?Object.is:t,i=s.useState,o=s.useEffect,u=s.useLayoutEffect,c=s.useDebugValue,h=!1,p=!1,k=typeof window=="undefined"||typeof window.document=="undefined"||typeof window.document.createElement=="undefined"?r:e;Ln.useSyncExternalStore=s.useSyncExternalStore!==void 0?s.useSyncExternalStore:k,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!="undefined"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())}()),Ln}var ys;function Fo(){return ys||(ys=1,process.env.NODE_ENV==="production"?tn.exports=Lo():tn.exports=$o()),tn.exports}var Wo=Fo();const Vs=0,Us=1,Bs=2,gs=3;var _s=Object.prototype.hasOwnProperty;function _r(t,e){var n,r;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((r=t.length)===e.length)for(;r--&&_r(t[r],e[r]););return r===-1}if(!n||typeof t=="object"){r=0;for(n in t)if(_s.call(t,n)&&++r&&!_s.call(e,n)||!(n in e)||!_r(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!==t&&e!==e}const Pe=new WeakMap,Me=()=>{},ee=Me(),vr=Object,N=t=>t===ee,we=t=>typeof t=="function",ze=(t,e)=>Be(Be({},t),e),qs=t=>we(t.then),$n={},nn={},Pr="undefined",Jt=typeof window!=Pr,br=typeof document!=Pr,zo=Jt&&"Deno"in window,Vo=()=>Jt&&typeof window.requestAnimationFrame!=Pr,Ks=(t,e)=>{const n=Pe.get(t);return[()=>!N(e)&&t.get(e)||$n,r=>{if(!N(e)){const s=t.get(e);e in nn||(nn[e]=s),n[5](e,ze(s,r),s||$n)}},n[6],()=>!N(e)&&e in nn?nn[e]:!N(e)&&t.get(e)||$n]};let wr=!0;const Uo=()=>wr,[kr,Sr]=Jt&&window.addEventListener?[window.addEventListener.bind(window),window.removeEventListener.bind(window)]:[Me,Me],Bo=()=>{const t=br&&document.visibilityState;return N(t)||t!=="hidden"},qo=t=>(br&&document.addEventListener("visibilitychange",t),kr("focus",t),()=>{br&&document.removeEventListener("visibilitychange",t),Sr("focus",t)}),Ko=t=>{const e=()=>{wr=!0,t()},n=()=>{wr=!1};return kr("online",e),kr("offline",n),()=>{Sr("online",e),Sr("offline",n)}},Ho={isOnline:Uo,isVisible:Bo},Go={initFocus:qo,initReconnect:Ko},vs=!F.useId,Ht=!Jt||zo,Jo=t=>Vo()?window.requestAnimationFrame(t):setTimeout(t,1),Fn=Ht?F.useEffect:F.useLayoutEffect,Wn=typeof navigator!="undefined"&&navigator.connection,bs=!Ht&&Wn&&(["slow-2g","2g"].includes(Wn.effectiveType)||Wn.saveData),rn=new WeakMap,zn=(t,e)=>vr.prototype.toString.call(t)===`[object ${e}]`;let Xo=0;const xr=t=>{const e=typeof t,n=zn(t,"Date"),r=zn(t,"RegExp"),s=zn(t,"Object");let a,i;if(vr(t)===t&&!n&&!r){if(a=rn.get(t),a)return a;if(a=++Xo+"~",rn.set(t,a),Array.isArray(t)){for(a="@",i=0;i<t.length;i++)a+=xr(t[i])+",";rn.set(t,a)}if(s){a="#";const o=vr.keys(t).sort();for(;!N(i=o.pop());)N(t[i])||(a+=i+":"+xr(t[i])+",");rn.set(t,a)}}else a=n?t.toJSON():e=="symbol"?t.toString():e=="string"?JSON.stringify(t):""+t;return a},Ir=t=>{if(we(t))try{t=t()}catch(n){t=""}const e=t;return t=typeof t=="string"?t:(Array.isArray(t)?t.length:t)?xr(t):"",[t,e]};let Yo=0;const Er=()=>++Yo;function Hs(...t){return qe(this,null,function*(){const[e,n,r,s]=t,a=ze({populateCache:!0,throwOnError:!0},typeof s=="boolean"?{revalidate:s}:s||{});let i=a.populateCache;const o=a.rollbackOnError;let u=a.optimisticData;const c=k=>typeof o=="function"?o(k):o!==!1,h=a.throwOnError;if(we(n)){const k=n,g=[],v=e.keys();for(const l of v)!/^\$(inf|sub)\$/.test(l)&&k(e.get(l)._k)&&g.push(l);return Promise.all(g.map(p))}return p(n);function p(k){return qe(this,null,function*(){const[g]=Ir(k);if(!g)return;const[v,l]=Ks(e,g),[b,m,j,M]=Pe.get(e),B=()=>{const fe=b[g];return(we(a.revalidate)?a.revalidate(v().data,k):a.revalidate!==!1)&&(delete j[g],delete M[g],fe&&fe[0])?fe[0](Bs).then(()=>v().data):v().data};if(t.length<3)return B();let z=r,X;const L=Er();m[g]=[L,0];const $=!N(u),Oe=v(),Z=Oe.data,rt=Oe._c,Ve=N(rt)?Z:rt;if($&&(u=we(u)?u(Ve,Z):u,l({data:u,_c:Ve})),we(z))try{z=z(Ve)}catch(fe){X=fe}if(z&&qs(z))if(z=yield z.catch(fe=>{X=fe}),L!==m[g][0]){if(X)throw X;return z}else X&&$&&c(X)&&(i=!0,l({data:Ve,_c:ee}));if(i&&!X)if(we(i)){const fe=i(z,Ve);l({data:fe,error:ee,_c:ee})}else l({data:z,error:ee,_c:ee});if(m[g][1]=Er(),Promise.resolve(B()).then(()=>{l({_c:ee})}),X){if(h)throw X;return}return z})}})}const ws=(t,e)=>{for(const n in t)t[n][0]&&t[n][0](e)},Qo=(t,e)=>{if(!Pe.has(t)){const n=ze(Go,e),r={},s=Hs.bind(ee,t);let a=Me;const i={},o=(h,p)=>{const k=i[h]||[];return i[h]=k,k.push(p),()=>k.splice(k.indexOf(p),1)},u=(h,p,k)=>{t.set(h,p);const g=i[h];if(g)for(const v of g)v(p,k)},c=()=>{if(!Pe.has(t)&&(Pe.set(t,[r,{},{},{},s,u,o]),!Ht)){const h=n.initFocus(setTimeout.bind(ee,ws.bind(ee,r,Vs))),p=n.initReconnect(setTimeout.bind(ee,ws.bind(ee,r,Us)));a=()=>{h&&h(),p&&p(),Pe.delete(t)}}};return c(),[t,s,c,a]}return[t,Pe.get(t)[4]]},eu=(t,e,n,r,s)=>{const a=n.errorRetryCount,i=s.retryCount,o=~~((Math.random()+.5)*(1<<(i<8?i:8)))*n.errorRetryInterval;!N(a)&&i>a||setTimeout(r,o,s)},tu=_r,[Gs,nu]=Qo(new Map),ru=ze({onLoadingSlow:Me,onSuccess:Me,onError:Me,onErrorRetry:eu,onDiscarded:Me,revalidateOnFocus:!0,revalidateOnReconnect:!0,revalidateIfStale:!0,shouldRetryOnError:!0,errorRetryInterval:bs?1e4:5e3,focusThrottleInterval:5*1e3,dedupingInterval:2*1e3,loadingTimeout:bs?5e3:3e3,compare:tu,isPaused:()=>!1,cache:Gs,mutate:nu,fallback:{}},Ho),su=(t,e)=>{const n=ze(t,e);if(e){const{use:r,fallback:s}=t,{use:a,fallback:i}=e;r&&a&&(n.use=r.concat(a)),s&&i&&(n.fallback=ze(s,i))}return n},au=F.createContext({}),iu="$inf$",Js=Jt&&window.__SWR_DEVTOOLS_USE__,ou=Js?window.__SWR_DEVTOOLS_USE__:[],uu=()=>{Js&&(window.__SWR_DEVTOOLS_REACT__=F)},cu=t=>we(t[1])?[t[0],t[1],t[2]||{}]:[t[0],null,(t[1]===null?t[2]:t[1])||{}],du=()=>ze(ru,F.useContext(au)),lu=t=>(e,n,r)=>t(e,n&&((...a)=>{const[i]=Ir(e),[,,,o]=Pe.get(Gs);if(i.startsWith(iu))return n(...a);const u=o[i];return N(u)?n(...a):(delete o[i],u)}),r),fu=ou.concat(lu),hu=t=>function(...n){const r=du(),[s,a,i]=cu(n),o=su(r,i);let u=t;const{use:c}=o,h=(c||[]).concat(fu);for(let p=h.length;p--;)u=h[p](u);return u(s,a||o.fetcher||null,o)},pu=(t,e,n)=>{const r=e[t]||(e[t]=[]);return r.push(n),()=>{const s=r.indexOf(n);s>=0&&(r[s]=r[r.length-1],r.pop())}};uu();const Vn=F.use||(t=>{switch(t.status){case"pending":throw t;case"fulfilled":return t.value;case"rejected":throw t.reason;default:throw t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}),t}}),Un={dedupe:!0},mu=(t,e,n)=>{const{cache:r,compare:s,suspense:a,fallbackData:i,revalidateOnMount:o,revalidateIfStale:u,refreshInterval:c,refreshWhenHidden:h,refreshWhenOffline:p,keepPreviousData:k}=n,[g,v,l,b]=Pe.get(r),[m,j]=Ir(t),M=F.useRef(!1),B=F.useRef(!1),z=F.useRef(m),X=F.useRef(e),L=F.useRef(n),$=()=>L.current,Oe=()=>$().isVisible()&&$().isOnline(),[Z,rt,Ve,fe]=Ks(r,m),st=F.useRef({}).current,Xt=N(i)?N(n.fallback)?ee:n.fallback[m]:i,jr=(P,I)=>{for(const H in st){const V=H;if(V==="data"){if(!s(P[V],I[V])&&(!N(P[V])||!s(Qt,I[V])))return!1}else if(I[V]!==P[V])return!1}return!0},Zr=F.useMemo(()=>{const P=!m||!e?!1:N(o)?$().isPaused()||a?!1:u!==!1:o,I=Y=>{const Te=ze(Y);return delete Te._k,P?Be({isValidating:!0,isLoading:!0},Te):Te},H=Z(),V=fe(),ge=I(H),ot=H===V?ge:I(V);let K=ge;return[()=>{const Y=I(Z());return jr(Y,K)?(K.data=Y.data,K.isLoading=Y.isLoading,K.isValidating=Y.isValidating,K.error=Y.error,K):(K=Y,Y)},()=>ot]},[r,m]),at=Wo.useSyncExternalStore(F.useCallback(P=>Ve(m,(I,H)=>{jr(H,I)||P()}),[r,m]),Zr[0],Zr[1]),Dr=!M.current,Xs=g[m]&&g[m].length>0,it=at.data,Ue=N(it)?Xt&&qs(Xt)?Vn(Xt):Xt:it,Yt=at.error,Tn=F.useRef(Ue),Qt=k?N(it)?N(Tn.current)?Ue:Tn.current:it:Ue,Mr=Xs&&!N(Yt)?!1:Dr&&!N(o)?o:$().isPaused()?!1:a?N(Ue)?!1:u:N(Ue)||u,Lr=!!(m&&e&&Dr&&Mr),Ys=N(at.isValidating)?Lr:at.isValidating,Qs=N(at.isLoading)?Lr:at.isLoading,wt=F.useCallback(P=>qe(exports,null,function*(){const I=X.current;if(!m||!I||B.current||$().isPaused())return!1;let H,V,ge=!0;const ot=P||{},K=!l[m]||!ot.dedupe,Y=()=>vs?!B.current&&m===z.current&&M.current:m===z.current,Te={isValidating:!1,isLoading:!1},Fr=()=>{rt(Te)},Wr=()=>{const de=l[m];de&&de[1]===V&&delete l[m]},zr={isValidating:!0};N(Z().data)&&(zr.isLoading=!0);try{if(K&&(rt(zr),n.loadingTimeout&&N(Z().data)&&setTimeout(()=>{ge&&Y()&&$().onLoadingSlow(m,n)},n.loadingTimeout),l[m]=[I(j),Er()]),[H,V]=l[m],H=yield H,K&&setTimeout(Wr,n.dedupingInterval),!l[m]||l[m][1]!==V)return K&&Y()&&$().onDiscarded(m),!1;Te.error=ee;const de=v[m];if(!N(de)&&(V<=de[0]||V<=de[1]||de[1]===0))return Fr(),K&&Y()&&$().onDiscarded(m),!1;const Ae=Z().data;Te.data=s(Ae,H)?Ae:H,K&&Y()&&$().onSuccess(H,m,n)}catch(de){Wr();const Ae=$(),{shouldRetryOnError:An}=Ae;Ae.isPaused()||(Te.error=de,K&&Y()&&(Ae.onError(de,m,Ae),(An===!0||we(An)&&An(de))&&(!$().revalidateOnFocus||!$().revalidateOnReconnect||Oe())&&Ae.onErrorRetry(de,m,Ae,ea=>{const Cn=g[m];Cn&&Cn[0]&&Cn[0](gs,ea)},{retryCount:(ot.retryCount||0)+1,dedupe:!0})))}return ge=!1,Fr(),!0}),[m,r]),$r=F.useCallback((...P)=>Hs(r,z.current,...P),[]);if(Fn(()=>{X.current=e,L.current=n,N(it)||(Tn.current=it)}),Fn(()=>{if(!m)return;const P=wt.bind(ee,Un);let I=0;const V=pu(m,g,(ge,ot={})=>{if(ge==Vs){const K=Date.now();$().revalidateOnFocus&&K>I&&Oe()&&(I=K+$().focusThrottleInterval,P())}else if(ge==Us)$().revalidateOnReconnect&&Oe()&&P();else{if(ge==Bs)return wt();if(ge==gs)return wt(ot)}});return B.current=!1,z.current=m,M.current=!0,rt({_k:j}),Mr&&(N(Ue)||Ht?P():Jo(P)),()=>{B.current=!0,V()}},[m]),Fn(()=>{let P;function I(){const V=we(c)?c(Z().data):c;V&&P!==-1&&(P=setTimeout(H,V))}function H(){!Z().error&&(h||$().isVisible())&&(p||$().isOnline())?wt(Un).then(I):I()}return I(),()=>{P&&(clearTimeout(P),P=-1)}},[c,h,p,m]),F.useDebugValue(Qt),a&&N(Ue)&&m){if(!vs&&Ht)throw new Error("Fallback data is required when using Suspense in SSR.");X.current=e,L.current=n,B.current=!1;const P=b[m];if(!N(P)){const I=$r(P);Vn(I)}if(N(Yt)){const I=wt(Un);N(Qt)||(I.status="fulfilled",I.value=!0),Vn(I)}else throw Yt}return{mutate:$r,get data(){return st.data=!0,Qt},get error(){return st.error=!0,Yt},get isValidating(){return st.isValidating=!0,Ys},get isLoading(){return st.isLoading=!0,Qs}}},yu=hu(mu),gu=({fileKey:t,authToken:e,enabled:n=!0,params:r={}})=>{const s=!!(n&&t&&e),{data:a,isLoading:i,error:o}=yu(["figma",t,e,r],()=>s?go({fileKey:t,authToken:e,params:r}):null,{revalidateIfStale:!1,revalidateOnFocus:!1,revalidateOnReconnect:!1});return{data:a!=null?a:null,isLoading:i,error:o}};exports.useAnimaCodegen=Mo;exports.useFigmaFile=gu;
22
22
  //# sourceMappingURL=index.cjs.map