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