UNPKG

prettier-plugin-classnames

Version:

A Prettier plugin that wraps verbose class name based on the `printWidth` option.

5 lines 104 kB
"use strict";var Mr=Object.create;var pt=Object.defineProperty;var zr=Object.getOwnPropertyDescriptor;var Vr=Object.getOwnPropertyNames;var Wr=Object.getPrototypeOf,qr=Object.prototype.hasOwnProperty;var G=(r,e)=>()=>(r&&(e=r(r=0)),e);var Xt=(r,e)=>{for(var t in e)pt(r,t,{get:e[t],enumerable:!0})},Kt=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Vr(e))!qr.call(r,s)&&s!==t&&pt(r,s,{get:()=>e[s],enumerable:!(n=zr(e,s))||n.enumerable});return r};var Qr=(r,e,t)=>(t=r!=null?Mr(Wr(r)):{},Kt(e||!r||!r.__esModule?pt(t,"default",{value:r,enumerable:!0}):t,r)),Ht=r=>Kt(pt({},"__esModule",{value:!0}),r);var Gt,Yt=G(()=>{"use strict";Gt={customAttributes:{since:"0.1.0",type:"string",array:!0,category:"Format",default:[{value:[]}],description:"List of attributes that enclosing class names. The `class` and `className` attributes are always supported, even if no options are specified."},customFunctions:{since:"0.1.0",type:"string",array:!0,category:"Format",default:[{value:[]}],description:"List of functions that enclosing class names. The `classNames` function is always supported, even if no options are specified."},endingPosition:{since:"0.5.0",type:"choice",category:"Format",default:"relative",description:"This is the criterion for ending the class name on each line when replacing the original class name with a multi-line class name.",choices:[{value:"relative",description:"Each line ends at a `printWidth` distance from the start of the class name."},{value:"absolute",description:"Each line ends at a `printWidth` distance from the start of the line."},{since:"0.6.0",value:"absolute-with-indent",description:"Basically the same as the `absolute` option, but indentation respects the `relative` option."}]},debugFlag:{since:"0.7.2",type:"boolean",category:"Format",default:!1,description:"A flag for branching in the development environment. It has no effect in production."},experimentalOptimization:{since:"0.7.2",type:"boolean",category:"Format",default:!1,description:"Formatting will be up to 67% faster. Note that Node.js version must be 17 or higher, and the output of nested expressions may be slightly different."},syntaxTransformation:{since:"0.7.7",type:"boolean",category:"Format",default:!1,description:"If a line wrapping occurs in a class name written in non-expression syntax, it is transformed into expression syntax. This transformation does not support reversible formatting."}}});var A,Q,M,pe,P,F,N,ft,ht=G(()=>{"use strict";A=`
`,Q="_",M=" ",pe="	",P="'",F='"',N="`",ft="?"});function Ur(r){return(0,tr.createHash)("sha1").update(r).digest("hex")}function er(r){let t=[...Array(16)].map((c,u)=>String.fromCharCode(945+u)),n=Ur(r),s=n.slice(0,Math.min(r.length,n.length)).split("").map(c=>t[Number.parseInt(c,16)]).join(""),a=Q.repeat(Math.max(0,r.length-n.length));return`${s}${a}`}function mt(r,e){let t=[],n=`${r}${M}`.replace(/[\s]+/g,M);for(;n.length;){let a=n.slice(0,Math.max(0,e)+1).lastIndexOf(M),c=n.slice(0,a);if(a===-1){let u=n.indexOf(M);c=n.slice(0,u),u===-1?(c=n,n=""):n=n.slice(u).trimStart()}else n=n.slice(a).trimStart();t.push(c)}return t.join(A)}function gt(r){return r.map(e=>e.frozenClassName??e.body).join("")}function Jr(r){let e=r.map(t=>({...t,children:[]})).sort((t,n)=>{let[s,a]=t.range,[c,u]=n.range;return s<c&&a<u?-1:s>c&&a>u?1:s<c&&a>=u?-1:s>c&&a<=u?1:0});return e.forEach((t,n)=>{if(n===0)return;let[s,a]=t.range,c=e.slice(0,n).findLastIndex(u=>{let[h,l]=u.range;return h<s&&a<=l});if(c!==-1){let u=e[c];t.parent=u,u.children.push(t)}}),e.filter(t=>!t.parent)}function It(r,e,t){let n=r.split(A),s=t.slice().sort((o,x)=>{let[g]=o.range,[v]=x.range;return v-g}),a=[],c=r.length,u=null,h=0,l=r.length;for(let o=0;o<s.length;o+=1){let x=s[o],{type:g,range:v,parent:f,children:d,startLineIndex:p,...m}=x,[y,k]=v,$=n[p].match(new RegExp(`^(${e})*`))[0].length/e.length,O=g==="expression"&&x.isItAnObjectProperty&&x.delimiterType==="backtick"?1:0;if(f&&(u=f.type,[h,l]=f.range,l<c&&(f.type==="ternary"||f.type==="logical"?(a.push({type:"Placeholder",range:[l,c],body:r.slice(l,c)}),c=l):(a.push({type:"Placeholder",range:[l-1,c],body:r.slice(l-1,c)}),c=l-1))),a.push({type:"Text",range:[k+O,c],body:r.slice(k+O,c)}),g==="ternary"||g==="logical"){let R=r.slice(y,k),B={type:g,range:[y,k],body:R};if(d.length){let V=It(r,e,d);B.children=V,B.body=gt(V)}if(B.props={...m,startLineIndex:p,indentLevel:$},f){let V=er(R);B.frozenClassName=V}a.push(B),c=y}else{a.push({type:"ClosingDelimiter",range:[k-1,k+O],body:r.slice(k-1,k+O)});let R=r.slice(y+1,k-1),B={type:g,range:[y+1,k-1],body:R};if(d.length){let V=It(r,e,d);B.children=V,B.body=gt(V)}if(B.props={...m,startLineIndex:p,indentLevel:$},f){let V=er(R.replace(/\s+/g,M));B.frozenClassName=V}a.push(B),a.push({type:"OpeningDelimiter",range:[y-O,y+1],body:r.slice(y-O,y+1)}),c=y-O}}return u?u==="ternary"||u==="logical"?(a.push({type:"Text",range:[h,c],body:r.slice(h,c)}),a.push({type:"Placeholder",range:[0,h],body:r.slice(0,h)})):(a.push({type:"Text",range:[h+1,c],body:r.slice(h+1,c)}),a.push({type:"Placeholder",range:[0,h+1],body:r.slice(0,h+1)})):a.push({type:"Text",range:[0,c],body:r.slice(0,c)}),a.reverse(),a.filter(o=>o.type!=="Placeholder")}function Lt(r,e,t){let n=structuredClone(r),s=t.endingPosition!=="absolute",a=t.endingPosition!=="relative",c=s&&a;for(let u=n.length-1;u>=0;u-=1){let h=n[u];if(h.type==="ternary"||h.type==="logical")h.children?.length&&(h.children=Lt(h.children,e,t));else if(h.type==="attribute"){let l=h.props,o=a?gt(n.slice(0,u)).split(A).slice(-1).join("").replace(/\t/g,M.repeat(t.tabWidth)):"",x=a?n[u+1].body:"",g=`${Q.repeat(o.length)}${h.body.trim()}${Q.repeat(x.length)}`,v=mt(g,t.printWidth).slice(o.length),f=v.split(A),d=f.length>1;if(d){let p=s?l.indentLevel+1:0;v=[f[0],...c?mt(f.slice(1).join(A),t.printWidth-t.tabWidth*p).split(A):f.slice(1)].join(`${A}${e.repeat(p)}`)}if(v=v.slice(0,-x.length||void 0),d&&t.syntaxTransformation)switch(t.parser){case"babel":case"typescript":case"astro":case"svelte":{n[u-1].body=`{${N}`,n[u+1].body=`${N}}`,v=v.replace(/`/g,`\\${N}`);break}case"vue":{n[u-2].body=n[u-2].body.replace(/([^ :=]+=)$/,":$1"),n[u-1].body=`${F}${N}`,n[u+1].body=`${N}${F}`,v=v.replace(/`/g,`\\${N}`);break}default:break}h.body=v}else if(h.type==="expression"){let l=h.props,o=a?gt(n.slice(0,u)).split(A).slice(-1).join("").replace(/\t/g,M.repeat(t.tabWidth)):"",x=a?n[u+1].body:"",g=h.body!==h.body.trimStart(),v=h.body!==h.body.trimEnd(),f=`${Q.repeat(o.length)}${g?M:""}${h.body.trim().replace(/\\\n/g,"")}${v?M:""}${Q.repeat(x.length)}`,d=`${mt(f,t.printWidth).slice(o.length)}${!x&&v?M:""}`,p=d.split(A);if(p.length>1){let y=s?l.isTheFirstLineOnTheSameLineAsTheAttributeName||l.isItAnOperandOfTernaryOperator?l.indentLevel+1:l.indentLevel:0;if(d=[p[0],...c?`${mt(p.slice(1).join(A),t.printWidth-t.tabWidth*y)}${!x&&v?M:""}`.split(A):p.slice(1)].join(`${A}${e.repeat(y)}`),d=d.slice(0,-x.length||void 0),l.isItAngularExpression)n[u-1].body=P,n[u+1].body=P;else{let k=l.isItAnObjectProperty;n[u-1].body=`${k?"[":""}${N}`,n[u+1].body=`${N}${k?"]":""}`,l.delimiterType!=="backtick"&&l.hasBacktick&&(d=d.replace(/`/g,`\\${N}`))}}else{d=d.slice(0,-x.length||void 0);let y=F;l.shouldKeepDelimiter?l.delimiterType==="backtick"?y=N:l.delimiterType==="single-quote"&&(y=P):l.isItInVueTemplate?y=P:t.singleQuote?l.hasSingleQuote||(y=P):t.singleQuote||l.hasDoubleQuote&&(y=P),l.isItAngularExpression&&(y=P);let k=l.isItAnObjectProperty&&y===N;n[u-1].body=`${k?"[":""}${y}`,n[u+1].body=`${y}${k?"]":""}`,y===P?l.delimiterType!=="single-quote"&&l.hasSingleQuote&&(d=d.replace(/'/g,`\\${P}`)):y===F?l.delimiterType!=="double-quote"&&l.hasDoubleQuote&&(d=d.replace(/"/g,`\\${F}`)):l.delimiterType!=="backtick"&&l.hasBacktick&&(d=d.replace(/`/g,`\\${N}`))}h.children?.length&&(h.children=Lt(h.children,e,t)),h.body=d}}return n}function Ct(r,e){if(r.children?.length)for(let t=r.children.length-1;t>=0;t-=1){let n=r.children[t];if(n.frozenClassName!==void 0){if(n.type==="ternary"||n.type==="logical"){let s=Ct(n,e),a=n.frozenClassName,c=s,u=r.body.match(new RegExp(`\\$\\{${A}[${M}${pe}]*${n.frozenClassName}`))!==null,h=r.body.match(new RegExp(`${n.frozenClassName}${A}[${M}${pe}]*\\}`))!==null;(u||h)&&(a=new RegExp(`[${M}${pe}]*${n.frozenClassName}${h?"":`[${M}${pe}]*`}`),c=`${u?"":A}${r.children[t-1].body.match(new RegExp(`[${M}${pe}]*$`))[0]}${s}${h?"":e.endingPosition==="absolute"?A:r.children[t+1].body.match(new RegExp(`^${A}[${M}${pe}]*`))[0]}`),r.body=r.body.replace(a,c)}else if(n.type==="expression"){let s=n.props,a=s.delimiterType==="single-quote"?P:s.delimiterType==="double-quote"?F:N;r.body=r.body.replace(`${a}${n.frozenClassName}${a}`,`${r.children[t-1].body}${Ct(n,e)}${r.children[t+1].body}`)}}}return r.body}function $t(r,e,t,n){let s=Jr(t),a=It(r,e,s);return Lt(a,e,n).map(u=>Ct(u,n)).join("")}var tr,rr=G(()=>{"use strict";tr=require("node:crypto");ht()});function Kr(r){ar=r}function bt(){return ar}function T(r,e){let t=vt({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,bt(),it].filter(n=>!!n)});r.common.issues.push(t)}function L(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:n,description:s}=r;if(e&&(t||n))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:(c,u)=>c.code!=="invalid_type"?{message:u.defaultError}:typeof u.data>"u"?{message:n??u.defaultError}:{message:t??u.defaultError},description:s}}function cn(r,e){return!!((e==="v4"||!e)&&sn.test(r)||(e==="v6"||!e)&&an.test(r))}function ln(r,e){let t=(r.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,s=t>n?t:n,a=parseInt(r.toFixed(s).replace(".","")),c=parseInt(e.toFixed(s).replace(".",""));return a%c/Math.pow(10,s)}function qe(r){if(r instanceof X){let e={};for(let t in r.shape){let n=r.shape[t];e[t]=ce.create(qe(n))}return new X({...r._def,shape:()=>e})}else return r instanceof me?new me({...r._def,type:qe(r.element)}):r instanceof ce?ce.create(qe(r.unwrap())):r instanceof ge?ge.create(qe(r.unwrap())):r instanceof fe?fe.create(r.items.map(e=>qe(e))):r}function Zt(r,e){let t=be(r),n=be(e);if(r===e)return{valid:!0,data:r};if(t===_.object&&n===_.object){let s=D.objectKeys(e),a=D.objectKeys(r).filter(u=>s.indexOf(u)!==-1),c={...r,...e};for(let u of a){let h=Zt(r[u],e[u]);if(!h.valid)return{valid:!1};c[u]=h.data}return{valid:!0,data:c}}else if(t===_.array&&n===_.array){if(r.length!==e.length)return{valid:!1};let s=[];for(let a=0;a<r.length;a++){let c=r[a],u=e[a],h=Zt(c,u);if(!h.valid)return{valid:!1};s.push(h.data)}return{valid:!0,data:s}}else return t===_.date&&n===_.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}function or(r,e){return new Re({values:r,typeName:j.ZodEnum,...L(e)})}var D,Rt,_,be,b,Xr,Y,it,ar,vt,Hr,q,I,ir,U,Pt,Dt,ot,xt,w,re,nr,C,Gr,Yr,en,tn,rn,nn,Nt,sn,an,on,ve,Ee,Oe,we,je,Qe,Ae,Ie,xe,he,le,Ue,me,X,Le,yt,kt,Ce,fe,_t,Je,Xe,Tt,$e,Ne,Re,Pe,ke,ee,ce,ge,De,Ke,He,un,St,ct,Ge,cr,dn,j,pn,lr,ur,fn,hn,dr,mn,gn,yn,bn,vn,xn,kn,_n,Tn,Sn,En,On,wn,jn,An,In,Ln,Cn,$n,Nn,Rn,Pn,Dn,Zn,sr,Fn,Bn,Mn,zn,Vn,Wn,qn,Qn,Un,i,pr=G(()=>{(function(r){r.assertEqual=s=>s;function e(s){}r.assertIs=e;function t(s){throw new Error}r.assertNever=t,r.arrayToEnum=s=>{let a={};for(let c of s)a[c]=c;return a},r.getValidEnumValues=s=>{let a=r.objectKeys(s).filter(u=>typeof s[s[u]]!="number"),c={};for(let u of a)c[u]=s[u];return r.objectValues(c)},r.objectValues=s=>r.objectKeys(s).map(function(a){return s[a]}),r.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let a=[];for(let c in s)Object.prototype.hasOwnProperty.call(s,c)&&a.push(c);return a},r.find=(s,a)=>{for(let c of s)if(a(c))return c},r.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&isFinite(s)&&Math.floor(s)===s;function n(s,a=" | "){return s.map(c=>typeof c=="string"?`'${c}'`:c).join(a)}r.joinValues=n,r.jsonStringifyReplacer=(s,a)=>typeof a=="bigint"?a.toString():a})(D||(D={}));(function(r){r.mergeShapes=(e,t)=>({...e,...t})})(Rt||(Rt={}));_=D.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),be=r=>{switch(typeof r){case"undefined":return _.undefined;case"string":return _.string;case"number":return isNaN(r)?_.nan:_.number;case"boolean":return _.boolean;case"function":return _.function;case"bigint":return _.bigint;case"symbol":return _.symbol;case"object":return Array.isArray(r)?_.array:r===null?_.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?_.promise:typeof Map<"u"&&r instanceof Map?_.map:typeof Set<"u"&&r instanceof Set?_.set:typeof Date<"u"&&r instanceof Date?_.date:_.object;default:return _.unknown}},b=D.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"]),Xr=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),Y=class extends Error{constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(a){return a.message},n={_errors:[]},s=a=>{for(let c of a.issues)if(c.code==="invalid_union")c.unionErrors.map(s);else if(c.code==="invalid_return_type")s(c.returnTypeError);else if(c.code==="invalid_arguments")s(c.argumentsError);else if(c.path.length===0)n._errors.push(t(c));else{let u=n,h=0;for(;h<c.path.length;){let l=c.path[h];h===c.path.length-1?(u[l]=u[l]||{_errors:[]},u[l]._errors.push(t(c))):u[l]=u[l]||{_errors:[]},u=u[l],h++}}};return s(this),n}toString(){return this.message}get message(){return JSON.stringify(this.issues,D.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},n=[];for(let s of this.issues)s.path.length>0?(t[s.path[0]]=t[s.path[0]]||[],t[s.path[0]].push(e(s))):n.push(e(s));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}};Y.create=r=>new Y(r);it=(r,e)=>{let t;switch(r.code){case b.invalid_type:r.received===_.undefined?t="Required":t=`Expected ${r.expected}, received ${r.received}`;break;case b.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(r.expected,D.jsonStringifyReplacer)}`;break;case b.unrecognized_keys:t=`Unrecognized key(s) in object: ${D.joinValues(r.keys,", ")}`;break;case b.invalid_union:t="Invalid input";break;case b.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${D.joinValues(r.options)}`;break;case b.invalid_enum_value:t=`Invalid enum value. Expected ${D.joinValues(r.options)}, received '${r.received}'`;break;case b.invalid_arguments:t="Invalid function arguments";break;case b.invalid_return_type:t="Invalid function return type";break;case b.invalid_date:t="Invalid date";break;case b.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=`Invalid input: must include "${r.validation.includes}"`,typeof r.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${r.validation.position}`)):"startsWith"in r.validation?t=`Invalid input: must start with "${r.validation.startsWith}"`:"endsWith"in r.validation?t=`Invalid input: must end with "${r.validation.endsWith}"`:D.assertNever(r.validation):r.validation!=="regex"?t=`Invalid ${r.validation}`:t="Invalid";break;case b.too_small:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at least":"more than"} ${r.minimum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at least":"over"} ${r.minimum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${r.minimum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(r.minimum))}`:t="Invalid input";break;case b.too_big:r.type==="array"?t=`Array must contain ${r.exact?"exactly":r.inclusive?"at most":"less than"} ${r.maximum} element(s)`:r.type==="string"?t=`String must contain ${r.exact?"exactly":r.inclusive?"at most":"under"} ${r.maximum} character(s)`:r.type==="number"?t=`Number must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="bigint"?t=`BigInt must be ${r.exact?"exactly":r.inclusive?"less than or equal to":"less than"} ${r.maximum}`:r.type==="date"?t=`Date must be ${r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(r.maximum))}`:t="Invalid input";break;case b.custom:t="Invalid input";break;case b.invalid_intersection_types:t="Intersection results could not be merged";break;case b.not_multiple_of:t=`Number must be a multiple of ${r.multipleOf}`;break;case b.not_finite:t="Number must be finite";break;default:t=e.defaultError,D.assertNever(r)}return{message:t}},ar=it;vt=r=>{let{data:e,path:t,errorMaps:n,issueData:s}=r,a=[...t,...s.path||[]],c={...s,path:a},u="",h=n.filter(l=>!!l).slice().reverse();for(let l of h)u=l(c,{data:e,defaultError:u}).message;return{...s,path:a,message:s.message||u}},Hr=[];q=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let n=[];for(let s of t){if(s.status==="aborted")return I;s.status==="dirty"&&e.dirty(),n.push(s.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){let n=[];for(let s of t)n.push({key:await s.key,value:await s.value});return r.mergeObjectSync(e,n)}static mergeObjectSync(e,t){let n={};for(let s of t){let{key:a,value:c}=s;if(a.status==="aborted"||c.status==="aborted")return I;a.status==="dirty"&&e.dirty(),c.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof c.value<"u"||s.alwaysSet)&&(n[a.value]=c.value)}return{status:e.value,value:n}}},I=Object.freeze({status:"aborted"}),ir=r=>({status:"dirty",value:r}),U=r=>({status:"valid",value:r}),Pt=r=>r.status==="aborted",Dt=r=>r.status==="dirty",ot=r=>r.status==="valid",xt=r=>typeof Promise<"u"&&r instanceof Promise;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e?.message})(w||(w={}));re=class{constructor(e,t,n,s){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,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}},nr=(r,e)=>{if(ot(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new Y(r.common.issues);return this._error=t,this._error}}};C=class{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)}get description(){return this._def.description}_getType(e){return be(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:be(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new q,ctx:{common:e.parent.common,data:e.data,parsedType:be(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(xt(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){var n;let s={common:{issues:[],async:(n=t?.async)!==null&&n!==void 0?n:!1,contextualErrorMap:t?.errorMap},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:be(e)},a=this._parseSync({data:e,path:s.path,parent:s});return nr(s,a)}async parseAsync(e,t){let n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){let n={common:{issues:[],contextualErrorMap:t?.errorMap,async:!0},path:t?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:be(e)},s=this._parse({data:e,path:n.path,parent:n}),a=await(xt(s)?s:Promise.resolve(s));return nr(n,a)}refine(e,t){let n=s=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(s):t;return this._refinement((s,a)=>{let c=e(s),u=()=>a.addIssue({code:b.custom,...n(s)});return typeof Promise<"u"&&c instanceof Promise?c.then(h=>h?!0:(u(),!1)):c?!0:(u(),!1)})}refinement(e,t){return this._refinement((n,s)=>e(n)?!0:(s.addIssue(typeof t=="function"?t(n,s):t),!1))}_refinement(e){return new ee({schema:this,typeName:j.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return ce.create(this,this._def)}nullable(){return ge.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return me.create(this,this._def)}promise(){return ke.create(this,this._def)}or(e){return Le.create([this,e],this._def)}and(e){return Ce.create(this,e,this._def)}transform(e){return new ee({...L(this._def),schema:this,typeName:j.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let t=typeof e=="function"?e:()=>e;return new De({...L(this._def),innerType:this,defaultValue:t,typeName:j.ZodDefault})}brand(){return new St({typeName:j.ZodBranded,type:this,...L(this._def)})}catch(e){let t=typeof e=="function"?e:()=>e;return new Ke({...L(this._def),innerType:this,catchValue:t,typeName:j.ZodCatch})}describe(e){let t=this.constructor;return new t({...this._def,description:e})}pipe(e){return ct.create(this,e)}readonly(){return Ge.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Gr=/^c[^\s-]{8,}$/i,Yr=/^[a-z][a-z0-9]*$/,en=/^[0-9A-HJKMNP-TV-Z]{26}$/,tn=/^[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,rn=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,nn="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",sn=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,an=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,on=r=>r.precision?r.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${r.precision}}Z$`):r.precision===0?r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):r.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");ve=class r extends C{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==_.string){let a=this._getOrReturnCtx(e);return T(a,{code:b.invalid_type,expected:_.string,received:a.parsedType}),I}let n=new q,s;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(s=this._getOrReturnCtx(e,s),T(s,{code:b.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="max")e.data.length>a.value&&(s=this._getOrReturnCtx(e,s),T(s,{code:b.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),n.dirty());else if(a.kind==="length"){let c=e.data.length>a.value,u=e.data.length<a.value;(c||u)&&(s=this._getOrReturnCtx(e,s),c?T(s,{code:b.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):u&&T(s,{code:b.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),n.dirty())}else if(a.kind==="email")rn.test(e.data)||(s=this._getOrReturnCtx(e,s),T(s,{validation:"email",code:b.invalid_string,message:a.message}),n.dirty());else if(a.kind==="emoji")Nt||(Nt=new RegExp(nn,"u")),Nt.test(e.data)||(s=this._getOrReturnCtx(e,s),T(s,{validation:"emoji",code:b.invalid_string,message:a.message}),n.dirty());else if(a.kind==="uuid")tn.test(e.data)||(s=this._getOrReturnCtx(e,s),T(s,{validation:"uuid",code:b.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid")Gr.test(e.data)||(s=this._getOrReturnCtx(e,s),T(s,{validation:"cuid",code:b.invalid_string,message:a.message}),n.dirty());else if(a.kind==="cuid2")Yr.test(e.data)||(s=this._getOrReturnCtx(e,s),T(s,{validation:"cuid2",code:b.invalid_string,message:a.message}),n.dirty());else if(a.kind==="ulid")en.test(e.data)||(s=this._getOrReturnCtx(e,s),T(s,{validation:"ulid",code:b.invalid_string,message:a.message}),n.dirty());else if(a.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),T(s,{validation:"url",code:b.invalid_string,message:a.message}),n.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),T(s,{validation:"regex",code:b.invalid_string,message:a.message}),n.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(s=this._getOrReturnCtx(e,s),T(s,{code:b.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),n.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(s=this._getOrReturnCtx(e,s),T(s,{code:b.invalid_string,validation:{startsWith:a.value},message:a.message}),n.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(s=this._getOrReturnCtx(e,s),T(s,{code:b.invalid_string,validation:{endsWith:a.value},message:a.message}),n.dirty()):a.kind==="datetime"?on(a).test(e.data)||(s=this._getOrReturnCtx(e,s),T(s,{code:b.invalid_string,validation:"datetime",message:a.message}),n.dirty()):a.kind==="ip"?cn(e.data,a.version)||(s=this._getOrReturnCtx(e,s),T(s,{validation:"ip",code:b.invalid_string,message:a.message}),n.dirty()):D.assertNever(a);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(s=>e.test(s),{validation:t,code:b.invalid_string,...w.errToObj(n)})}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...w.errToObj(e)})}url(e){return this._addCheck({kind:"url",...w.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...w.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...w.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...w.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...w.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...w.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...w.errToObj(e)})}datetime(e){var t;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:(t=e?.offset)!==null&&t!==void 0?t:!1,...w.errToObj(e?.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...w.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t?.position,...w.errToObj(t?.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...w.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...w.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...w.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...w.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...w.errToObj(t)})}nonempty(e){return this.min(1,w.errToObj(e))}trim(){return new r({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new r({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}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 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 minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};ve.create=r=>{var e;return new ve({checks:[],typeName:j.ZodString,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...L(r)})};Ee=class r extends C{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==_.number){let a=this._getOrReturnCtx(e);return T(a,{code:b.invalid_type,expected:_.number,received:a.parsedType}),I}let n,s=new q;for(let a of this._def.checks)a.kind==="int"?D.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),T(n,{code:b.invalid_type,expected:"integer",received:"float",message:a.message}),s.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),T(n,{code:b.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),T(n,{code:b.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),s.dirty()):a.kind==="multipleOf"?ln(e.data,a.value)!==0&&(n=this._getOrReturnCtx(e,n),T(n,{code:b.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),T(n,{code:b.not_finite,message:a.message}),s.dirty()):D.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,w.toString(t))}gt(e,t){return this.setLimit("min",e,!1,w.toString(t))}lte(e,t){return this.setLimit("max",e,!0,w.toString(t))}lt(e,t){return this.setLimit("max",e,!1,w.toString(t))}setLimit(e,t,n,s){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:w.toString(s)}]})}_addCheck(e){return new r({...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,t){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(t)})}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(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&D.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}};Ee.create=r=>new Ee({checks:[],typeName:j.ZodNumber,coerce:r?.coerce||!1,...L(r)});Oe=class r extends C{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==_.bigint){let a=this._getOrReturnCtx(e);return T(a,{code:b.invalid_type,expected:_.bigint,received:a.parsedType}),I}let n,s=new q;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(n=this._getOrReturnCtx(e,n),T(n,{code:b.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(n=this._getOrReturnCtx(e,n),T(n,{code:b.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),s.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),T(n,{code:b.not_multiple_of,multipleOf:a.value,message:a.message}),s.dirty()):D.assertNever(a);return{status:s.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,w.toString(t))}gt(e,t){return this.setLimit("min",e,!1,w.toString(t))}lte(e,t){return this.setLimit("max",e,!0,w.toString(t))}lt(e,t){return this.setLimit("max",e,!1,w.toString(t))}setLimit(e,t,n,s){return new r({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:w.toString(s)}]})}_addCheck(e){return new r({...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,t){return this._addCheck({kind:"multipleOf",value:e,message:w.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};Oe.create=r=>{var e;return new Oe({checks:[],typeName:j.ZodBigInt,coerce:(e=r?.coerce)!==null&&e!==void 0?e:!1,...L(r)})};we=class extends C{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==_.boolean){let n=this._getOrReturnCtx(e);return T(n,{code:b.invalid_type,expected:_.boolean,received:n.parsedType}),I}return U(e.data)}};we.create=r=>new we({typeName:j.ZodBoolean,coerce:r?.coerce||!1,...L(r)});je=class r extends C{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==_.date){let a=this._getOrReturnCtx(e);return T(a,{code:b.invalid_type,expected:_.date,received:a.parsedType}),I}if(isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return T(a,{code:b.invalid_date}),I}let n=new q,s;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(s=this._getOrReturnCtx(e,s),T(s,{code:b.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),n.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(s=this._getOrReturnCtx(e,s),T(s,{code:b.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),n.dirty()):D.assertNever(a);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:w.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:w.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};je.create=r=>new je({checks:[],coerce:r?.coerce||!1,typeName:j.ZodDate,...L(r)});Qe=class extends C{_parse(e){if(this._getType(e)!==_.symbol){let n=this._getOrReturnCtx(e);return T(n,{code:b.invalid_type,expected:_.symbol,received:n.parsedType}),I}return U(e.data)}};Qe.create=r=>new Qe({typeName:j.ZodSymbol,...L(r)});Ae=class extends C{_parse(e){if(this._getType(e)!==_.undefined){let n=this._getOrReturnCtx(e);return T(n,{code:b.invalid_type,expected:_.undefined,received:n.parsedType}),I}return U(e.data)}};Ae.create=r=>new Ae({typeName:j.ZodUndefined,...L(r)});Ie=class extends C{_parse(e){if(this._getType(e)!==_.null){let n=this._getOrReturnCtx(e);return T(n,{code:b.invalid_type,expected:_.null,received:n.parsedType}),I}return U(e.data)}};Ie.create=r=>new Ie({typeName:j.ZodNull,...L(r)});xe=class extends C{constructor(){super(...arguments),this._any=!0}_parse(e){return U(e.data)}};xe.create=r=>new xe({typeName:j.ZodAny,...L(r)});he=class extends C{constructor(){super(...arguments),this._unknown=!0}_parse(e){return U(e.data)}};he.create=r=>new he({typeName:j.ZodUnknown,...L(r)});le=class extends C{_parse(e){let t=this._getOrReturnCtx(e);return T(t,{code:b.invalid_type,expected:_.never,received:t.parsedType}),I}};le.create=r=>new le({typeName:j.ZodNever,...L(r)});Ue=class extends C{_parse(e){if(this._getType(e)!==_.undefined){let n=this._getOrReturnCtx(e);return T(n,{code:b.invalid_type,expected:_.void,received:n.parsedType}),I}return U(e.data)}};Ue.create=r=>new Ue({typeName:j.ZodVoid,...L(r)});me=class r extends C{_parse(e){let{ctx:t,status:n}=this._processInputParams(e),s=this._def;if(t.parsedType!==_.array)return T(t,{code:b.invalid_type,expected:_.array,received:t.parsedType}),I;if(s.exactLength!==null){let c=t.data.length>s.exactLength.value,u=t.data.length<s.exactLength.value;(c||u)&&(T(t,{code:c?b.too_big:b.too_small,minimum:u?s.exactLength.value:void 0,maximum:c?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),n.dirty())}if(s.minLength!==null&&t.data.length<s.minLength.value&&(T(t,{code:b.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),n.dirty()),s.maxLength!==null&&t.data.length>s.maxLength.value&&(T(t,{code:b.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((c,u)=>s.type._parseAsync(new re(t,c,t.path,u)))).then(c=>q.mergeArray(n,c));let a=[...t.data].map((c,u)=>s.type._parseSync(new re(t,c,t.path,u)));return q.mergeArray(n,a)}get element(){return this._def.type}min(e,t){return new r({...this._def,minLength:{value:e,message:w.toString(t)}})}max(e,t){return new r({...this._def,maxLength:{value:e,message:w.toString(t)}})}length(e,t){return new r({...this._def,exactLength:{value:e,message:w.toString(t)}})}nonempty(e){return this.min(1,e)}};me.create=(r,e)=>new me({type:r,minLength:null,maxLength:null,exactLength:null,typeName:j.ZodArray,...L(e)});X=class r extends C{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=D.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==_.object){let l=this._getOrReturnCtx(e);return T(l,{code:b.invalid_type,expected:_.object,received:l.parsedType}),I}let{status:n,ctx:s}=this._processInputParams(e),{shape:a,keys:c}=this._getCached(),u=[];if(!(this._def.catchall instanceof le&&this._def.unknownKeys==="strip"))for(let l in s.data)c.includes(l)||u.push(l);let h=[];for(let l of c){let o=a[l],x=s.data[l];h.push({key:{status:"valid",value:l},value:o._parse(new re(s,x,s.path,l)),alwaysSet:l in s.data})}if(this._def.catchall instanceof le){let l=this._def.unknownKeys;if(l==="passthrough")for(let o of u)h.push({key:{status:"valid",value:o},value:{status:"valid",value:s.data[o]}});else if(l==="strict")u.length>0&&(T(s,{code:b.unrecognized_keys,keys:u}),n.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let o of u){let x=s.data[o];h.push({key:{status:"valid",value:o},value:l._parse(new re(s,x,s.path,o)),alwaysSet:o in s.data})}}return s.common.async?Promise.resolve().then(async()=>{let l=[];for(let o of h){let x=await o.key;l.push({key:x,value:await o.value,alwaysSet:o.alwaysSet})}return l}).then(l=>q.mergeObjectSync(n,l)):q.mergeObjectSync(n,h)}get shape(){return this._def.shape()}strict(e){return w.errToObj,new r({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var s,a,c,u;let h=(c=(a=(s=this._def).errorMap)===null||a===void 0?void 0:a.call(s,t,n).message)!==null&&c!==void 0?c:n.defaultError;return t.code==="unrecognized_keys"?{message:(u=w.errToObj(e).message)!==null&&u!==void 0?u:h}:{message:h}}}:{}})}strip(){return new r({...this._def,unknownKeys:"strip"})}passthrough(){return new r({...this._def,unknownKeys:"passthrough"})}extend(e){return new r({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:j.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r({...this._def,catchall:e})}pick(e){let t={};return D.objectKeys(e).forEach(n=>{e[n]&&this.shape[n]&&(t[n]=this.shape[n])}),new r({...this._def,shape:()=>t})}omit(e){let t={};return D.objectKeys(this.shape).forEach(n=>{e[n]||(t[n]=this.shape[n])}),new r({...this._def,shape:()=>t})}deepPartial(){return qe(this)}partial(e){let t={};return D.objectKeys(this.shape).forEach(n=>{let s=this.shape[n];e&&!e[n]?t[n]=s:t[n]=s.optional()}),new r({...this._def,shape:()=>t})}required(e){let t={};return D.objectKeys(this.shape).forEach(n=>{if(e&&!e[n])t[n]=this.shape[n];else{let a=this.shape[n];for(;a instanceof ce;)a=a._def.innerType;t[n]=a}}),new r({...this._def,shape:()=>t})}keyof(){return or(D.objectKeys(this.shape))}};X.create=(r,e)=>new X({shape:()=>r,unknownKeys:"strip",catchall:le.create(),typeName:j.ZodObject,...L(e)});X.strictCreate=(r,e)=>new X({shape:()=>r,unknownKeys:"strict",catchall:le.create(),typeName:j.ZodObject,...L(e)});X.lazycreate=(r,e)=>new X({shape:r,unknownKeys:"strip",catchall:le.create(),typeName:j.ZodObject,...L(e)});Le=class extends C{_parse(e){let{ctx:t}=this._processInputParams(e),n=this._def.options;function s(a){for(let u of a)if(u.result.status==="valid")return u.result;for(let u of a)if(u.result.status==="dirty")return t.common.issues.push(...u.ctx.common.issues),u.result;let c=a.map(u=>new Y(u.ctx.common.issues));return T(t,{code:b.invalid_union,unionErrors:c}),I}if(t.common.async)return Promise.all(n.map(async a=>{let c={...t,common:{...t.common,issues:[]},parent:null};return{result:await a._parseAsync({data:t.data,path:t.path,parent:c}),ctx:c}})).then(s);{let a,c=[];for(let h of n){let l={...t,common:{...t.common,issues:[]},parent:null},o=h._parseSync({data:t.data,path:t.path,parent:l});if(o.status==="valid")return o;o.status==="dirty"&&!a&&(a={result:o,ctx:l}),l.common.issues.length&&c.push(l.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let u=c.map(h=>new Y(h));return T(t,{code:b.invalid_union,unionErrors:u}),I}}get options(){return this._def.options}};Le.create=(r,e)=>new Le({options:r,typeName:j.ZodUnion,...L(e)});yt=r=>r instanceof $e?yt(r.schema):r instanceof ee?yt(r.innerType()):r instanceof Ne?[r.value]:r instanceof Re?r.options:r instanceof Pe?Object.keys(r.enum):r instanceof De?yt(r._def.innerType):r instanceof Ae?[void 0]:r instanceof Ie?[null]:null,kt=class r extends C{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==_.object)return T(t,{code:b.invalid_type,expected:_.object,received:t.parsedType}),I;let n=this.discriminator,s=t.data[n],a=this.optionsMap.get(s);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(T(t,{code:b.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[n]}),I)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,n){let s=new Map;for(let a of t){let c=yt(a.shape[e]);if(!c)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let u of c){if(s.has(u))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(u)}`);s.set(u,a)}}return new r({typeName:j.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:s,...L(n)})}};Ce=class extends C{_parse(e){let{status:t,ctx:n}=this._processInputParams(e),s=(a,c)=>{if(Pt(a)||Pt(c))return I;let u=Zt(a.value,c.value);return u.valid?((Dt(a)||Dt(c))&&t.dirty(),{status:t.value,value:u.data}):(T(n,{code:b.invalid_intersection_types}),I)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([a,c])=>s(a,c)):s(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}};Ce.create=(r,e,t)=>new Ce({left:r,right:e,typeName:j.ZodIntersection,...L(t)});fe=class r extends C{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_.array)return T(n,{code:b.invalid_type,expected:_.array,received:n.parsedType}),I;if(n.data.length<this._def.items.length)return T(n,{code:b.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),I;!this._def.rest&&n.data.length>this._def.items.length&&(T(n,{code:b.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...n.data].map((c,u)=>{let h=this._def.items[u]||this._def.rest;return h?h._parse(new re(n,c,n.path,u)):null}).filter(c=>!!c);return n.common.async?Promise.all(a).then(c=>q.mergeArray(t,c)):q.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new r({...this._def,rest:e})}};fe.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new fe({items:r,typeName:j.ZodTuple,rest:null,...L(e)})};_t=class r extends C{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_.object)return T(n,{code:b.invalid_type,expected:_.object,received:n.parsedType}),I;let s=[],a=this._def.keyType,c=this._def.valueType;for(let u in n.data)s.push({key:a._parse(new re(n,u,n.path,u)),value:c._parse(new re(n,n.data[u],n.path,u))});return n.common.async?q.mergeObjectAsync(t,s):q.mergeObjectSync(t,s)}get element(){return this._def.valueType}static create(e,t,n){return t instanceof C?new r({keyType:e,valueType:t,typeName:j.ZodRecord,...L(n)}):new r({keyType:ve.create(),valueType:e,typeName:j.ZodRecord,...L(t)})}},Je=class extends C{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_.map)return T(n,{code:b.invalid_type,expected:_.map,received:n.parsedType}),I;let s=this._def.keyType,a=this._def.valueType,c=[...n.data.entries()].map(([u,h],l)=>({key:s._parse(new re(n,u,n.path,[l,"key"])),value:a._parse(new re(n,h,n.path,[l,"value"]))}));if(n.common.async){let u=new Map;return Promise.resolve().then(async()=>{for(let h of c){let l=await h.key,o=await h.value;if(l.status==="aborted"||o.status==="aborted")return I;(l.status==="dirty"||o.status==="dirty")&&t.dirty(),u.set(l.value,o.value)}return{status:t.value,value:u}})}else{let u=new Map;for(let h of c){let l=h.key,o=h.value;if(l.status==="aborted"||o.status==="aborted")return I;(l.status==="dirty"||o.status==="dirty")&&t.dirty(),u.set(l.value,o.value)}return{status:t.value,value:u}}}};Je.create=(r,e,t)=>new Je({valueType:e,keyType:r,typeName:j.ZodMap,...L(t)});Xe=class r extends C{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==_.set)return T(n,{code:b.invalid_type,expected:_.set,received:n.parsedType}),I;let s=this._def;s.minSize!==null&&n.data.size<s.minSize.value&&(T(n,{code:b.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),t.dirty()),s.maxSize!==null&&n.data.size>s.maxSize.value&&(T(n,{code:b.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),t.dirty());let a=this._def.valueType;function c(h){let l=new Set;for(let o of h){if(o.status==="aborted")return I;o.status==="dirty"&&t.dirty(),l.add(o.value)}return{status:t.value,value:l}}let u=[...n.data.values()].map((h,l)=>a._parse(new re(n,h,n.path,l)));return n.common.async?Promise.all(u).then(h=>c(h)):c(u)}min(e,t){return new r({...this._def,minSize:{value:e,message:w.toString(t)}})}max(e,t){return new r({...this._def,maxSize:{value:e,message:w.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};Xe.create=(r,e)=>new Xe({valueType:r,minSize:null,maxSize:null,typeName:j.ZodSet,...L(e)});Tt=class r extends C{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==_.function)return T(t,{code:b.invalid_type,expected:_.function,received:t.parsedType}),I;function n(u,h){return vt({data:u,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,bt(),it].filter(l=>!!l),issueData:{code:b.invalid_arguments,argumentsError:h}})}function s(u,h){return vt({data:u,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,bt(),it].filter(l=>!!l),issueData:{code:b.invalid_return_type,returnTypeError:h}})}let a={errorMap:t.common.contextualErrorMap},c=t.data;if(this._def.returns instanceof ke){let u=this;return U(async function(...h){let l=new Y([]),o=await u._def.args.parseAsync(h,a).catch(v=>{throw l.addIssue(n(h,v)),l}),x=await Reflect.apply(c,this,o);return await u._def.returns._def.type.parseAsync(x,a).catch(v=>{throw l.addIssue(s(x,v)),l})})}else{let u=this;return U(function(...h){let l=u._def.args.safeParse(h,a);if(!l.success)throw new Y([n(h,l.error)]);let o=Reflect.apply(c,this,l.data),x=u._def.returns.safeParse(o,a);if(!x.success)throw new Y([s(o,x.error)]);return x.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r({...this._def,args:fe.create(e).rest(he.create())})}returns(e){return new r({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new r({args:e||fe.create([]).rest(he.create()),returns:t||he.create(),typeName:j.ZodFunction,...L(n)})}},$e=class extends C{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};$e.create=(r,e)=>new $e({getter:r,typeName:j.ZodLazy,...L(e)});Ne=class extends C{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return T(t,{received:t.data,code:b.invalid_literal,expected:this._def.value}),I}return{status:"valid",value:e.data}}get value(){return this._def.value}};Ne.create=(r,e)=>new Ne({value:r,typeName:j.ZodLiteral,...L(e)});Re=class r extends C{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),n=this._def.values;return T(t,{expected:D.joinValues(n),received:t.parsedType,code:b.invalid_type}),I}if(this._def.values.indexOf(e.data)===-1){let t=this._getOrReturnCtx(e),n=this._def.values;return T(t,{received:t.data,code:b.invalid_enum_value,options:n}),I}return U(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e){return r.create(e)}exclude(e){return r.create(this.options.filter(t=>!e.includes(t)))}};Re.create=or;Pe=class extends C{_parse(e){let t=D.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==_.string&&n.parsedType!==_.number){let s=D.objectValues(t);return T(n,{expected:D.joinValues(s),received:n.parsedType,code:b.invalid_type}),I}if(t.indexOf(e.data)===-1){let s=D.objectValues(t);return T(n,{received:n.data,code:b.invalid_enum_value,options:s}),I}return U(e.data)}get enum(){return this._def.values}};Pe.create=(r,e)=>new Pe({values:r,typeName:j.ZodNativeEnum,...L(e)});ke=class extends C{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==_.promise&&t.common.async===!1)return T(t,{code:b.invalid_type,expected:_.promise,received:t.parsedType}),I;let n=t.parsedType===_.promise?t.data:Promise.resolve(t.data);return U(n.then(s=>this._def.type.parseAsync(s,{path:t.path,errorMap:t.common.contextualErrorMap})))}};ke.create=(r,e)=>new ke({type:r,typeName:j.ZodPromise,...L(e)});ee=class extends C{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===j.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:n}=this._processInputParams(e),s=this._def.effect||null,a={addIssue:c=>{T(n,c),c.fatal?t.abort():t.dirty()},get path(){return n.path}};if(a.addIssue=a.addIssue.bind(a),s.type==="preprocess"){let c=s.transform(n.data,a);return n.common.issues.length?{status:"dirty",value:n.data}:n.common.async?Promise.resolve(c).then(u=>this._def.schema._parseAsync({data:u,path:n.path,parent:n})):this._def.schema._parseSync({data:c,path:n.path,parent:n})}if(s.type==="refinement"){let c=u=>{let h=s.refinement(u,a);if(n.common.async)return Promise.resolve(h);if(h instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return u};if(n.common.async===!1){let u=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return u.status==="aborted"?I:(u.status==="dirty"&&t.dirty(),c(u.value),{status:t.value,value:u.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(u=>u.status==="aborted"?I:(u.status==="dirty"&&t.dirty(),c(u.value).then(()=>({status:t.value,value:u.value}))))}if(s.type==="transform")if(n.common.async===!1){let c=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!ot(c))return c;let u=s.transform(c.value,a);if(u instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:u}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(c=>ot(c)?Promise.resolve(s.transform(c.value,a)).then(u=>({status:t.value,value:u})):c);D.assertNever(s)}};ee.create=(r,e,t)=>new ee({schema:r,typeName:j.ZodEffects,effect:e,...L(t)});ee.createWithPreprocess=(r,e,t)=>new ee({schema:e,effect:{type:"preprocess",transform:r},typeName:j.ZodEffects,...L(t)});ce=class extends C{_parse(e){return this._getType(e)===_.undefined?U(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ce.create=(r,e)=>new ce({innerType:r,typeName:j.ZodOptional,...L(e)});ge=class extends C{_parse(e){return this._getType(e)===_.null?U(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};ge.create=(r,e)=>new ge({innerType:r,typeName:j.ZodNullable,...L(e)});De=class extends C{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return t.parsedType===_.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};De.create=(r,e)=>new De({innerType:r,typeName:j.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...L(e)});Ke=class extends C{_parse(e){let{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},s=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return xt(s)?s.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Y(n.common.issues)},input:n.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new Y(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}};Ke.create=(r,e)=>new Ke({innerType:r,typeName:j.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...L(e)});He=class extends C{_parse(e){if(this._getType(e)!==_.nan){let n=this._getOrReturnCtx(e);return T(n,{code:b.invalid_type,expected:_.nan,received:n.parsedType}),I}return{status:"valid",value:e.data}}};He.create=r=>new He({typeName:j.ZodNaN,...L(r)});un=Symbol("zod_brand"),St=class extends C{_parse(e){let{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}},ct=class r extends C{_parse(e){let{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return a.status==="aborted"?I:a.status==="dirty"?(t.dirty(),ir(a.value)):this._def.out._parseAsync({data:a.value,path:n.path,parent:n})})();{let s=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?I:s.status==="dirty"?(t.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:n.path,parent:n})}}static create(e,t){return new r({in:e,out:t,typeName:j.ZodPipeline})}},Ge=class extends C{_parse(e){let t=this._def.innerType._parse(e);return ot(t)&&(t.value=Object.freeze(t.value)),t}};Ge.create=(r,e)=>new Ge({innerType:r,typeName:j.ZodReadonly,...L(e)});cr=(r,e={},t)=>r?xe.create().superRefine((n,s)=>{var a,c;if(!r(n)){let u=typeof e=="function"?e(n):typeof e=="string"?{message:e}:e,h=(c=(a=u.fatal)!==null&&a!==void 0?a:t)!==null&&c!==void 0?c:!0,l=typeof u=="string"?{message:u}:u;s.addIssue({code:"custom",...l,fatal:h})}}):xe.create(),dn={object:X.lazycreate};(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(j||(j={}));pn=(r,e={message:`Input not instance of ${r.name}`})=>cr(t=>t instanceof r,e),lr=ve.create,ur=Ee.create,fn=He.create,hn=Oe.create,dr=we.create,mn=je.create,gn=Qe.create,yn=Ae.create,bn=Ie.create,vn=xe.create,xn=he.create,kn=le.create,_n=Ue.create,Tn=me.create,Sn=X.create,En=X.strictCreate,On=Le.create,wn=kt.create,jn=Ce.create,An=fe.create,In=_t.create,Ln=Je.create,Cn=Xe.create,$n=Tt.create,Nn=$e.create,Rn=Ne.create,Pn=Re.create,Dn=Pe.create,Zn=ke.create,sr=ee.create,Fn=ce.create,Bn=ge.create,Mn=ee.createWithPreprocess,zn=ct.create,Vn=()=>lr().optional(),Wn=()=>ur().optional(),qn=()=>dr().optional(),Qn={string:r=>ve.create({...r,coerce:!0}),number:r=>Ee.create({...r,coerce:!0}),boolean:r=>we.create({...r,coerce:!0}),bigint:r=>Oe.create({...r,coerce:!0}),date:r=>je.create({...r,coerce:!0})},Un=I,i=Object.freeze({__proto__:null,defaultErrorMap:it,setErrorMap:Kr,getErrorMap:bt,makeIssue:vt,EMPTY_PATH:Hr,addIssueToContext:T,ParseStatus:q,INVALID:I,DIRTY:ir,OK:U,isAborted:Pt,isDirty:Dt,isValid:ot,isAsync:xt,get util(){return D},get objectUtil(){return Rt},ZodParsedType:_,getParsedType:be,ZodType:C,ZodString:ve,ZodNumber:Ee,ZodBigInt:Oe,ZodBoolean:we,ZodDate:je,ZodSymbol:Qe,ZodUndefined:Ae,ZodNull:Ie,ZodAny:xe,ZodUnknown:he,ZodNever:le,ZodVoid:Ue,ZodArray:me,ZodObject:X,ZodUnion:Le,ZodDiscriminatedUnion:kt,ZodIntersection:Ce,ZodTuple:fe,ZodRecord:_t,ZodMap:Je,ZodSet:Xe,ZodFunction:Tt,ZodLazy:$e,ZodLiteral:Ne,ZodEnum:Re,ZodNativeEnum:Pe,ZodPromise:ke,ZodEffects:ee,ZodTransformer:ee,ZodOptional:ce,ZodNullable:ge,ZodDefault:De,ZodCatch:Ke,ZodNaN:He,BRAND:un,ZodBranded:St,ZodPipeline:ct,ZodReadonly:Ge,custom:cr,Schema:C,ZodSchema:C,late:dn,get ZodFirstPartyTypeKind(){return j},coerce:Qn,any:vn,array:Tn,bigint:hn,boolean:dr,date:mn,discriminatedUnion:wn,effect:sr,enum:Pn,function:$n,instanceof:pn,intersection:jn,lazy:Nn,literal:Rn,map:Ln,nan:fn,nativeEnum:Dn,never:kn,null:bn,nullable:Bn,number:ur,object:Sn,oboolean:qn,onumber:Wn,optional:Fn,ostring:Vn,pipeline:zn,preprocess:Mn,promise:Zn,record:In,set:Cn,strictObject:En,string:lr,symbol:gn,transformer:sr,tuple:An,undefined:yn,union:On,unknown:xn,void:_n,NEVER:Un,ZodIssueCode:b,quotelessJson:Xr,ZodError:Y})});function S(r,e){return e.safeParse(r).success}function fr(r){return r.type==="JSXIdentifier"?r.name:`${fr(r.object)}.${r.property.name}`}function K(r){return{type:"expression",isTheFirstLineOnTheSameLineAsTheAttributeName:!1,isItAnObjectProperty:!1,isItAnOperandOfTernaryOperator:!1,isItFunctionArgument:!1,isItInVueTemplate:!1,isItAngularExpression:!1,hasSingleQuote:!1,hasDoubleQuote:!1,hasBacktick:!1,shouldKeepDelimiter:!1,...r}}function Ye(r,e,t,n){let s=e.map(({range:c})=>{let[,u]=c;return r.filter(({range:[l]})=>u<l).sort(({range:[l,o]},{range:[x,g]})=>l-x||g-o).at(0)?.range??c}),a=t.map(({range:c})=>c);return n.filter(({range:[c,u]})=>s.every(([h,l])=>!(h<=c&&u<=l))&&a.some(([h,l])=>h<c&&u<=l)).sort(({startLineIndex:c,range:[u]},{startLineIndex:h,range:[l]})=>h-c||l-u)}function ne(r,e){let t=["class","className",...e.customAttributes],n=["classNames",...e.customFunctions],s=[],a=[],c=[],u=[];function h(l,o){if(!S(l,i.object({type:i.string()})))return;if(e.experimentalOptimization){let f=[];switch(l.type){case"ArrayExpression":{f=["elements"];break}case"ArrowFunctionExpression":case"BlockStatement":case"FunctionDeclaration":{f=["body"];break}case"CallExpression":{f=["arguments"];break}case"ConditionalExpression":{f=["consequent","alternate"];break}case"ExpressionStatement":case"JSXExpressionContainer":{f=["expression"];break}case"ExportDefaultDeclaration":case"ExportNamedDeclaration":{f=["declaration"];break}case"File":{f=["program"];break}case"JSXAttribute":{f=["value"];break}case"JSXElement":{f=["openingElement","children"];break}case"JSXFragment":{f=["children"];break}case"JSXOpeningElement":{f=["attributes"];break}case"LogicalExpression":{f=["right"];break}case"ObjectExpression":{f=["properties"];break}case"ObjectProperty":case"Property":{f=["key","value"];break}case"Program":{f=["body","comments"];break}case"ReturnStatement":{f=["argument"];break}case"TaggedTemplateExpression":{f=["quasi"];break}case"TemplateLiteral":{f=["expressions","quasis"];break}case"VariableDeclaration":{f=["declarations"];break}case"VariableDeclarator":{f=["init"];break}default:break}Object.entries(l).forEach(([d,p])=>{if(f.includes(d)){if(Array.isArray(p)){p.forEach(m=>{h(m,l)});return}h(p,l)}})}else Object.entries(l).forEach(([f,d])=>{if(f!=="type"){if(Array.isArray(d)){d.forEach(p=>{h(p,l)});return}h(d,l)}});if(!S(l,i.object({range:i.custom(f=>S(f,i.tuple([i.number(),i.number()])))})))return;let[x,g]=l.range,v={type:l.type,range:l.range};switch(l.type){case"CallExpression":{s.push(v),S(l,i.object({callee:i.object({type:i.unknown(),name:i.string()})}))&&l.callee.type==="Identifier"&&n.includes(l.callee.name)&&(c.push(v),u.forEach((f,d,p)=>{let[m,y]=f.range;x<=m&&y<=g&&(f.type==="unknown"?p[d]=K({delimiterType:f.delimiterType,isItFunctionArgument:!0,range:f.range,startLineIndex:f.startLineIndex}):f.type==="expression"&&(f.isItFunctionArgument=!0))}));break}case"JSXAttribute":{if(s.push(v),S(o,i.object({loc:i.object({start:i.object({line:i.unknown()})}),name:i.union([i.object({type:i.literal("JSXIdentifier"),name:i.string()}),i.object({type:i.literal("JSXMemberExpression"),object:i.union([i.object({type:i.literal("JSXIdentifier")}),i.object({type:i.literal("JSXMemberExpression")})]),property:i.object({type:i.literal("JSXIdentifier"),name:i.string()})})])}))&&o.type==="JSXOpeningElement"&&S(l,i.object({loc:i.object({start:i.object({line:i.unknown()})}),name:i.object({type:i.unknown(),name:i.string()})}))&&l.name.type==="JSXIdentifier"&&t.includes(l.name.name)){c.push(v);let f=o.loc.start.line,d=l.loc.start.line;u.forEach((p,m,y)=>{let[k,E]=p.range;x<=k&&E<=g&&p.type==="unknown"&&p.delimiterType!=="backtick"&&(y[m]={type:"attribute",isTheFirstLineOnTheSameLineAsTheOpeningTag:f===d,elementName:fr(o.name),range:p.range,startLineIndex:p.startLineIndex})})}break}case"JSXExpressionContainer":{if(s.push(v),S(l,i.object({loc:i.object({start:i.object({line:i.number()})})}))){let f=l.loc.start.line-1;u.forEach((d,p,m)=>{let[y,k]=d.range;x<=y&&k<=g&&(d.type==="unknown"?d.delimiterType!=="backtick"?m[p]=K({delimiterType:d.delimiterType,hasSingleQuote:d.hasSingleQuote,hasDoubleQuote:d.hasDoubleQuote,hasBacktick:d.hasBacktick,shouldKeepDelimiter:d.hasSingleQuote&&d.hasDoubleQuote,range:d.range,startLineIndex:d.startLineIndex}):m[p]=K({delimiterType:d.delimiterType,isTheFirstLineOnTheSameLineAsTheAttributeName:d.startLineIndex===f,range:d.range,startLineIndex:d.startLineIndex}):d.type==="expression"&&(d.isTheFirstLineOnTheSameLineAsTheAttributeName=d.startLineIndex===f))})}break}case"ObjectProperty":case"Property":{if(s.push(v),S(l,i.object({key:i.object({range:i.custom(f=>S(f,i.tuple([i.number(),i.number()])))})}))){let[f,d]=l.key.range;u.forEach((p,m,y)=>{let[k,E]=p.range,$=f<=k&&E<=d;x<=k&&E<=g&&(p.type==="unknown"?y[m]=K({delimiterType:p.delimiterType,isItAnObjectProperty:$,range:p.range,startLineIndex:p.startLineIndex}):p.type==="expression"&&(p.isItAnObjectProperty=$))})}break}case"ConditionalExpression":{s.push(v),u.forEach((f,d,p)=>{let[m,y]=f.range;x<=m&&y<=g&&(f.type==="unknown"?p[d]=K({delimiterType:f.delimiterType,isItAnOperandOfTernaryOperator:!0,range:f.range,startLineIndex:f.startLineIndex}):f.type==="expression"&&(f.isItAnOperandOfTernaryOperator=!0))}),S(l,i.object({loc:i.object({start:i.object({line:i.number()})})}))&&u.push({type:"ternary",range:[x,g],startLineIndex:l.loc.start.line-1});break}case"Literal":{s.push(v),S(l,i.object({value:i.string(),loc:i.object({start:i.object({line:i.number()})}),raw:i.string()}))&&u.push({type:"unknown",delimiterType:l.raw[0]===P?"single-quote":l.raw[0]===F?"double-quote":"backtick",hasSingleQuote:l.value.indexOf(P)!==-1,hasDoubleQuote:l.value.indexOf(F)!==-1,hasBacktick:l.value.indexOf(N)!==-1,range:[x,g],startLineIndex:l.loc.start.line-1});break}case"StringLiteral":{s.push(v),S(l,i.object({loc:i.object({start:i.object({line:i.number()})}),extra:i.object({raw:i.string()}),value:i.string()}))&&u.push({type:"unknown",delimiterType:l.extra.raw[0]===P?"single-quote":l.extra.raw[0]===F?"double-quote":"backtick",hasSingleQuote:l.value.indexOf(P)!==-1,hasDoubleQuote:l.value.indexOf(F)!==-1,hasBacktick:l.value.indexOf(N)!==-1,range:[x,g],startLineIndex:l.loc.start.line-1});break}case"TemplateLiteral":{if(s.push(v),S(l,i.object({loc:i.object({start:i.object({line:i.number()})}),quasis:i.array(i.object({type:i.literal("TemplateElement"),value:i.object({cooked:i.string()}),tail:i.boolean()}))}))){let{cooked:f}=l.quasis[0].value,d=f.indexOf(P)!==-1,p=f.indexOf(F)!==-1,m=f.indexOf(N)!==-1;u.push(K({delimiterType:"backtick",hasSingleQuote:d,hasDoubleQuote:p,hasBacktick:m,shouldKeepDelimiter:!l.quasis[0].tail||d&&p,range:[x,g],startLineIndex:l.loc.start.line-1}))}break}case"TaggedTemplateExpression":{if(s.push(v),S(l,i.object({tag:i.object({type:i.literal("Identifier"),name:i.string(),range:i.custom(f=>S(f,i.tuple([i.number(),i.number()])))})}))&&l.tag.name==="css"){let[f,d]=l.tag.range;a.push({type:l.tag.type,range:[f,d-1]});break}(S(l,i.object({tag:i.object({type:i.literal("Identifier"),name:i.string()})}))&&n.includes(l.tag.name)||S(l,i.object({tag:i.object({type:i.literal("MemberExpression"),object:i.object({type:i.literal("Identifier"),name:i.string()})})}))&&n.includes(l.tag.object.name)||S(l,i.object({tag:i.object({type:i.literal("CallExpression"),callee:i.object({type:i.literal("Identifier"),name:i.string()})})}))&&n.includes(l.tag.callee.name))&&(c.push(v),u.forEach((f,d,p)=>{let[m,y]=f.range;x<=m&&y<=g&&(f.type==="unknown"&&f.delimiterType==="backtick"?p[d]=K({delimiterType:f.delimiterType,isItFunctionArgument:l.tag.type==="CallExpression",shouldKeepDelimiter:!0,range:f.range,startLineIndex:f.startLineIndex}):f.type==="expression"&&f.delimiterType==="backtick"&&(f.isItFunctionArgument=l.tag.type==="CallExpression",f.shouldKeepDelimiter=!0))}));break}case"LogicalExpression":{if(s.push(v),!e.experimentalOptimization&&S(l,i.object({left:i.object({range:i.custom(f=>S(f,i.tuple([i.number(),i.number()])))})}))){let[f,d]=l.left.range;u.forEach(p=>{let[m,y]=p.range;f<=m&&y<=d&&(p.range=[0,1/0])})}e.experimentalOptimization&&S(l,i.object({loc:i.object({start:i.object({line:i.number()})})}))&&u.push({type:"logical",range:[x,g],startLineIndex:l.loc.start.line-1});break}case"Block":case"Line":{S(l,i.object({value:i.string()}))&&l.value.trim()==="prettier-ignore"&&a.push(v);break}case"File":{s.push(v),S(l,i.object({comments:i.array(i.object({type:i.string(),value:i.string(),start:i.number(),end:i.number()}))}))&&l.comments.forEach(f=>{f.value.trim()==="prettier-ignore"&&a.push({type:f.type,range:[f.start,f.end]})});break}default:{l.type!=="JSXText"&&s.push(v);break}}}return h(r),Ye(s,a,c,u)}function Ft(r,e,t){let n=["class","className",...e.customAttributes],s=["classNames",...e.customFunctions],a=[],c=[],u=[],h=[];function l(o,x){if(!S(o,i.object({type:i.string()})))return;if(e.experimentalOptimization){let d=[];switch(o.type){case"element":{d=["attrs","children"];break}case"root":{d=["children"];break}default:break}Object.entries(o).forEach(([p,m])=>{if(d.includes(p)){if(Array.isArray(m)){m.forEach(y=>{l(y,o)});return}l(m,o)}})}else Object.entries(o).forEach(([d,p])=>{if(d!=="type"){if(Array.isArray(p)){p.forEach(m=>{l(m,o)});return}l(p,o)}});if(!S(o,i.object({sourceSpan:i.object({start:i.object({offset:i.number()}),end:i.object({offset:i.number()})})})))return;let[g,v]=[o.sourceSpan.start.offset,o.sourceSpan.end.offset],f={type:o.type,range:[g,v]};switch(o.type){case"attribute":{if(a.push(f),S(x,i.object({sourceSpan:i.object({start:i.object({line:i.number()})}),name:i.string()}))&&x.type==="element"&&S(o,i.object({sourceSpan:i.object({start:i.object({line:i.number()})}),name:i.string(),value:i.string(),valueSpan:i.object({start:i.object({offset:i.number()}),end:i.object({offset:i.number()})})}))&&n.includes(o.name)){u.push(f);let d=o.valueSpan.start.offset,p=o.valueSpan.end.offset;a.push({type:"StringLiteral",range:[d,p]});let m=x.sourceSpan.start.line,y=o.sourceSpan.start.line;h.push({type:"attribute",isTheFirstLineOnTheSameLineAsTheOpeningTag:m===y,elementName:x.name,range:[d,p],startLineIndex:y})}break}case"element":{if(a.push(f),S(o,i.object({startSourceSpan:i.object({end:i.object({line:i.number(),offset:i.number()})}),name:i.string(),children:i.array(i.object({value:i.string()})),attrs:i.array(i.object({name:i.string(),value:i.unknown()}))}))&&o.name==="script"){let d=o.children.at(0);if(o.attrs.find(p=>p.name==="lang"&&p.value==="ts")){if(u.push(f),t.parseTypescript&&d){let p=o.startSourceSpan.end.line,m=o.startSourceSpan.end.offset,y=t.parseTypescript(d.value,{...e,parser:"typescript"}),k=ne(y,e).map(E=>{let[$,O]=E.range;return{...E,range:[$+m,O+m],startLineIndex:E.startLineIndex+p}});h.push(...k)}}else if((o.attrs.find(p=>p.name==="type"&&(p.value===""||p.value==="text/javascript"))||!o.attrs.find(p=>p.name==="type"))&&(u.push(f),t.parseBabel&&d)){let p=o.startSourceSpan.end.line,m=o.startSourceSpan.end.offset,y=t.parseBabel(d.value,{...e,parser:"babel"}),k=ne(y,e).map(E=>{let[$,O]=E.range;return{...E,range:[$+m,O+m],startLineIndex:E.startLineIndex+p}});h.push(...k)}}break}case"comment":{S(o,i.object({value:i.string()}))&&o.value.trim()==="prettier-ignore"&&c.push(f);break}default:{a.push(f);break}}}return l(r),Ye(a,c,u,h)}function Bt(r,e,t){let n=["class","className",...e.customAttributes],s=["classNames",...e.customFunctions],a=[],c=[],u=[],h=[];function l(o,x){if(!S(o,i.object({type:i.string()})))return;if(e.experimentalOptimization){let d=[];switch(o.type){case"element":{d=["attrs","children"];break}case"root":{d=["children"];break}default:break}Object.entries(o).forEach(([p,m])=>{if(d.includes(p)){if(Array.isArray(m)){m.forEach(y=>{l(y,o)});return}l(m,o)}})}else Object.entries(o).forEach(([d,p])=>{if(d!=="type"){if(Array.isArray(p)){p.forEach(m=>{l(m,o)});return}l(p,o)}});if(!S(o,i.object({sourceSpan:i.object({start:i.object({offset:i.number()}),end:i.object({offset:i.number()})})})))return;let[g,v]=[o.sourceSpan.start.offset,o.sourceSpan.end.offset],f={type:o.type,range:[g,v]};switch(o.type){case"attribute":{a.push(f);let d=/^(?:v-bind)?:/;if(S(x,i.object({sourceSpan:i.object({start:i.object({line:i.number()})}),name:i.string()}))&&x.type==="element"&&S(o,i.object({sourceSpan:i.object({start:i.object({line:i.number()})}),name:i.string(),value:i.string(),valueSpan:i.object({start:i.object({offset:i.number()}),end:i.object({offset:i.number()})})}))){if(o.name.match(d)!==null){if(u.push(f),t.parseBabel)try{let m=o.name.replace(d,""),k=`<div ${n.includes(m)?"className":m}={`,$=t.parseBabel(`${k}${o.value}}></div>`,{...e,parser:"babel"}),O=ne($,e).map(R=>{let[B,V]=R.range;R.type==="expression"&&(R.isItInVueTemplate=!0,R.delimiterType!=="backtick"&&R.startLineIndex===0&&(R.isTheFirstLineOnTheSameLineAsTheAttributeName=!0));let W=-k.length+o.valueSpan.start.offset+1;return{...R,range:[B+W,V+W],startLineIndex:R.startLineIndex+o.sourceSpan.start.line}});h.push(...O)}catch{}}else if(n.includes(o.name)){u.push(f);let m=o.valueSpan.start.offset,y=o.valueSpan.end.offset;a.push({type:"StringLiteral",range:[m,y]});let k=x.sourceSpan.start.line,E=o.sourceSpan.start.line;h.push({type:"attribute",isTheFirstLineOnTheSameLineAsTheOpeningTag:k===E,elementName:x.name,range:[m,y],startLineIndex:E})}}break}case"element":{if(a.push(f),S(o,i.object({startSourceSpan:i.object({end:i.object({line:i.number(),offset:i.number()})}),name:i.string(),children:i.array(i.object({value:i.string()}))}))&&o.name==="script"){u.push(f);let d=o.children.at(0);if(t.parseTypescript&&d){let p=o.startSourceSpan.end.line,m=o.startSourceSpan.end.offset,y=t.parseTypescript(d.value,{...e,parser:"typescript"}),k=ne(y,e).map(E=>{let[$,O]=E.range;return{...E,range:[$+m,O+m],startLineIndex:E.startLineIndex+p}});h.push(...k)}}break}case"comment":{S(o,i.object({value:i.string()}))&&o.value.trim()==="prettier-ignore"&&c.push(f);break}default:{a.push(f);break}}}return l(r),Ye(a,c,u,h)}function Mt(r,e,t){let n=["class","className","ngClass",...e.customAttributes],s=["classNames",...e.customFunctions],a=[],c=[],u=[],h=[];function l(o,x){if(!S(o,i.object({type:i.string()})))return;if(e.experimentalOptimization){let d=[];switch(o.type){case"element":{d=["attrs","children"];break}case"root":{d=["children"];break}default:break}Object.entries(o).forEach(([p,m])=>{if(d.includes(p)){if(Array.isArray(m)){m.forEach(y=>{l(y,o)});return}l(m,o)}})}else Object.entries(o).forEach(([d,p])=>{if(d!=="type"){if(Array.isArray(p)){p.forEach(m=>{l(m,o)});return}l(p,o)}});if(!S(o,i.object({sourceSpan:i.object({start:i.object({offset:i.number()}),end:i.object({offset:i.number()})})})))return;let[g,v]=[o.sourceSpan.start.offset,o.sourceSpan.end.offset],f={type:o.type,range:[g,v]};switch(o.type){case"attribute":{a.push(f);let d=/^\[(?:.+)\]$/;if(S(x,i.object({sourceSpan:i.object({start:i.object({line:i.number()})}),name:i.string()}))&&x.type==="element"&&S(o,i.object({sourceSpan:i.object({start:i.object({line:i.number()})}),name:i.string(),value:i.string(),valueSpan:i.object({start:i.object({offset:i.number()}),end:i.object({offset:i.number()})})}))){if(o.name.match(d)!==null){if(u.push(f),t.parseBabel){let m=[],y=o.value,k=null;do{k=null;try{let E=o.name.replace(/^\[(?:attr\.)?(.+)\]$/,"$1"),O=`<div ${n.includes(E)?"className":E}={`,B=t.parseBabel(`${O}${y}}></div>`,{...e,parser:"babel"}),V=ne(B,e).map(W=>{let[ze,_e]=W.range;W.type==="expression"&&(W.isItAngularExpression=!0,W.delimiterType!=="backtick"&&W.startLineIndex===0&&(W.isTheFirstLineOnTheSameLineAsTheAttributeName=!0));let Te=-O.length+o.valueSpan.start.offset+1,lt=ze-O.length,ut=m.filter(se=>se<lt).length,Ve=_e-O.length,ye=m.filter(se=>se<Ve).length;return{...W,range:[ze+Te-ut,_e+Te-ye],startLineIndex:W.startLineIndex+o.sourceSpan.start.line}});h.push(...V)}catch(E){if(S(E,i.object({message:i.string(),loc:i.object({start:i.object({line:i.number()})})}))){if(E.message.match(/^Unterminated string constant./)===null)break;k=E.loc.start.line-1}}if(k!==null){let E=y.split(A),$=!1;y=E.map((O,R)=>{if(!$&&R>=k&&O[O.length-1]!=="\\"){$=!0;let B=E.slice(0,R).reduce((V,W)=>V+W.length+A.length,0);return m.push(B+O.length),`${O}\\`}return O}).join(A)}}while(k!==null)}}else if(n.includes(o.name)){u.push(f);let m=o.valueSpan.start.offset,y=o.valueSpan.end.offset;a.push({type:"StringLiteral",range:[m,y]});let k=x.sourceSpan.start.line,E=o.sourceSpan.start.line;h.push({type:"attribute",isTheFirstLineOnTheSameLineAsTheOpeningTag:k===E,elementName:x.name,range:[m,y],startLineIndex:E})}}break}case"element":{if(a.push(f),S(o,i.object({startSourceSpan:i.object({end:i.object({line:i.number(),offset:i.number()})}),name:i.string(),children:i.array(i.object({value:i.string()}))}))&&o.name==="script"){u.push(f);let d=o.children.at(0);if(t.parseTypescript&&d){let p=o.startSourceSpan.end.line,m=o.startSourceSpan.end.offset,y=t.parseTypescript(d.value,{...e,parser:"typescript"}),k=ne(y,e).map(E=>{let[$,O]=E.range;return{...E,range:[$+m,O+m],startLineIndex:E.startLineIndex+p}});h.push(...k)}}break}case"comment":{S(o,i.object({value:i.string()}))&&o.value.trim()==="prettier-ignore"&&c.push(f);break}default:{a.push(f);break}}}return l(r),Ye(a,c,u,h)}function zt(r,e,t,n){let s=["class","className","class:list",...t.customAttributes],a=["classNames",...t.customFunctions],c=[],u=[],h=[],l=[],o=r.split(A).slice(0,-1).map(g=>`${g}${A}`.length).map((g,v,f)=>f.slice(0,v+1).reduce((d,p)=>d+p,0));o.unshift(0);function x(g,v){if(!S(g,i.object({type:i.string()})))return;if(t.experimentalOptimization){let m=[];switch(g.type){case"component":case"element":{m=["attributes","children"];break}case"fragment":case"root":{m=["children"];break}default:break}Object.entries(g).forEach(([y,k])=>{if(m.includes(y)){if(Array.isArray(k)){k.forEach(E=>{x(E,g)});return}x(k,g)}})}else Object.entries(g).forEach(([m,y])=>{if(m!=="type"){if(Array.isArray(y)){y.forEach(k=>{x(k,g)});return}x(y,g)}});if(!S(g,i.object({position:i.object({start:i.object({line:i.number(),column:i.number()}),end:i.object({line:i.number(),column:i.number()}).optional()}),name:i.unknown(),value:i.unknown()})))return;let f=o[g.position.start.line-1]+(g.position.start.column-1),d=g.position.end?o[g.position.end.line-1]+(g.position.end.column-1):f+(g.type==="attribute"?`${g.name}=${ft}${g.value}${ft}`.length:`${g.value}`.length),p={type:g.type,range:[f,d]};switch(g.type){case"frontmatter":{if(c.push(p),S(g,i.object({value:i.string()}))&&(h.push(p),n.parseTypescript)){let m=n.parseTypescript(g.value,{...t,parser:"typescript"}),y=ne(m,{...t,customAttributes:s,customFunctions:a}).map(k=>{let[E,$]=k.range,O=3;return{...k,range:[E+O,$+O],startLineIndex:k.startLineIndex}});l.push(...y)}break}case"attribute":{if(c.push(p),S(v,i.object({position:i.object({start:i.object({line:i.number()})}),name:i.string()}))&&(v.type==="element"||v.type==="component")&&S(g,i.object({kind:i.string(),name:i.string(),value:i.string()}))){let m=`${g.name}=${ft}`;if(g.kind==="expression"){if(h.push(p),n.parseTypescript){let k=`<div ${s.includes(g.name)?"className":g.name}={`,$=n.parseTypescript(`${k}${g.value}}></div>`,{...t,parser:"typescript"}),O=ne($,{...t,customAttributes:s,customFunctions:a}).map(R=>{let[B,V]=R.range;R.type==="expression"&&R.delimiterType!=="backtick"&&R.startLineIndex===0&&(R.isTheFirstLineOnTheSameLineAsTheAttributeName=!0);let W=-k.length+f+m.length;return{...R,range:[B+W,V+W],startLineIndex:R.startLineIndex+g.position.start.line-1}});l.push(...O)}}else if(g.kind==="quoted"&&s.includes(g.name)){h.push(p);let y=v.position.start.line-1,k=g.position.start.line-1;l.push({type:"attribute",isTheFirstLineOnTheSameLineAsTheOpeningTag:y===k,elementName:v.name,range:[f+m.length-1,d],startLineIndex:g.position.start.line-1})}}break}case"element":{if(c.push(p),S(g,i.object({name:i.string(),children:i.array(i.object({value:i.string(),position:i.object({start:i.object({line:i.number(),offset:i.number()})})}))}))&&g.name==="script"){h.push(p);let m=g.children.at(0);if(n.parseTypescript&&m){let y=m.position.start.line-1,k=m.position.start.offset,E=n.parseTypescript(m.value,{...t,parser:"typescript"}),$=ne(E,t).map(O=>{let[R,B]=O.range;return{...O,range:[R+k,B+k],startLineIndex:O.startLineIndex+y}});l.push(...$)}}break}case"comment":{S(g,i.object({value:i.string()}))&&g.value.trim()==="prettier-ignore"&&u.push({...p,range:[f-4,d]});break}default:{g.type!=="text"&&c.push(p);break}}}return x(e),Ye(c,u,h,l)}function Vt(r,e,t){let n=["class","className",...t.customAttributes],s=["classNames",...t.customFunctions],a=[],c=[],u=[],h=[];function l(o,x){if(!S(o,i.object({type:i.string()})))return;if(t.experimentalOptimization){let d=[];switch(o.type){case"ArrayExpression":{d=["elements"];break}case"Attribute":{d=["value"];break}case"CallExpression":{d=["arguments"];break}case"ConditionalExpression":{d=["consequent","alternate"];break}case"Element":case"InlineComponent":{d=["attributes","children"];break}case"Fragment":{d=["children"];break}case"Literal":{d=["leadingComments"];break}case"LogicalExpression":{d=["right"];break}case"MustacheTag":{d=["expression"];break}case"ObjectExpression":{d=["properties"];break}case"Program":{d=["body"];break}case"Property":{d=["key","value"];break}case"Root":{d=["html","instance"];break}case"Script":{d=["content"];break}case"TaggedTemplateExpression":{d=["quasi"];break}case"TemplateLiteral":{d=["expressions","quasis"];break}case"VariableDeclaration":{d=["declarations"];break}case"VariableDeclarator":{d=["init"];break}default:break}Object.entries(o).forEach(([p,m])=>{if(d.includes(p)){if(Array.isArray(m)){m.forEach(y=>{l(y,o)});return}l(m,o)}})}else Object.entries(o).forEach(([d,p])=>{if(d!=="type"){if(Array.isArray(p)){p.forEach(m=>{l(m,o)});return}l(p,o)}});if(!S(o,i.object({start:i.number(),end:i.number()})))return;let g=o.start,v=o.end,f={type:o.type,range:[g,v]};switch(o.type){case"CallExpression":{a.push(f),S(o,i.object({callee:i.object({type:i.literal("Identifier"),name:i.string()})}))&&s.includes(o.callee.name)&&(u.push(f),h.forEach((d,p,m)=>{let[y,k]=d.range;g<=y&&k<=v&&(d.type==="unknown"?m[p]=K({delimiterType:d.delimiterType,isItFunctionArgument:!0,range:d.range,startLineIndex:d.startLineIndex}):d.type==="expression"&&(d.isItFunctionArgument=!0))}));break}case"Attribute":{a.push(f),S(o,i.object({name:i.string(),value:i.array(i.object({type:i.string(),start:i.number(),end:i.number()}))}))&&n.includes(o.name)&&(u.push(f),h.forEach((d,p,m)=>{let[y,k]=d.range;g<=y&&k<=v&&d.type==="unknown"&&d.delimiterType!=="backtick"&&(m[p]={type:"attribute",isTheFirstLineOnTheSameLineAsTheOpeningTag:!1,elementName:"",range:d.range,startLineIndex:d.startLineIndex})}));break}case"MustacheTag":{a.push(f);let d=r.slice(0,g).split(A).length-1;h.forEach((p,m,y)=>{let[k,E]=p.range;g<=k&&E<=v&&(p.type==="unknown"?p.delimiterType!=="backtick"?y[m]=K({delimiterType:p.delimiterType,hasSingleQuote:p.hasSingleQuote,hasDoubleQuote:p.hasDoubleQuote,hasBacktick:p.hasBacktick,shouldKeepDelimiter:p.hasSingleQuote&&p.hasDoubleQuote,range:p.range,startLineIndex:p.startLineIndex}):y[m]=K({delimiterType:p.delimiterType,isTheFirstLineOnTheSameLineAsTheAttributeName:p.startLineIndex===d,range:p.range,startLineIndex:p.startLineIndex}):p.type==="expression"&&(p.isTheFirstLineOnTheSameLineAsTheAttributeName=p.startLineIndex===d))});break}case"Property":{if(a.push(f),S(o,i.object({key:i.object({start:i.number(),end:i.number()})}))){let[d,p]=[o.key.start,o.key.end];h.forEach((m,y,k)=>{let[E,$]=m.range,O=d<=E&&$<=p;g<=E&&$<=v&&(m.type==="unknown"?k[y]=K({delimiterType:m.delimiterType,isItAnObjectProperty:O,range:m.range,startLineIndex:m.startLineIndex}):m.type==="expression"&&(m.isItAnObjectProperty=O))})}break}case"ConditionalExpression":{a.push(f),h.forEach((d,p,m)=>{let[y,k]=d.range;g<=y&&k<=v&&(d.type==="unknown"?m[p]=K({delimiterType:d.delimiterType,isItAnOperandOfTernaryOperator:!0,range:d.range,startLineIndex:d.startLineIndex}):d.type==="expression"&&(d.isItAnOperandOfTernaryOperator=!0))}),S(o,i.object({loc:i.object({start:i.object({line:i.number()})})}))&&h.push({type:"ternary",range:[g,v],startLineIndex:o.loc.start.line-1});break}case"Text":{if(S(x,i.object({type:i.literal("Attribute"),name:i.string()}))&&S(o,i.object({data:i.string()}))){a.push(f);let d=r[o.start-1],p=r.slice(0,g).split(A).length-1;h.push({type:"unknown",delimiterType:d===P?"single-quote":d===F?"double-quote":"backtick",hasSingleQuote:o.data.indexOf(P)!==-1,hasDoubleQuote:o.data.indexOf(F)!==-1,hasBacktick:o.data.indexOf(N)!==-1,range:[g-1,v+1],startLineIndex:p})}break}case"Literal":{a.push(f),S(o,i.object({loc:i.object({start:i.object({line:i.number()})}),value:i.string(),raw:i.string()}))&&h.push({type:"unknown",delimiterType:o.raw[0]===P?"single-quote":o.raw[0]===F?"double-quote":"backtick",hasSingleQuote:o.value.indexOf(P)!==-1,hasDoubleQuote:o.value.indexOf(F)!==-1,hasBacktick:o.value.indexOf(N)!==-1,range:[g,v],startLineIndex:o.loc.start.line-1});break}case"TemplateLiteral":{if(a.push(f),S(o,i.object({loc:i.object({start:i.object({line:i.number()})}),quasis:i.array(i.object({type:i.literal("TemplateElement"),value:i.object({cooked:i.string()}),tail:i.boolean()}))}))){let{cooked:d}=o.quasis[0].value,p=d.indexOf(P)!==-1,m=d.indexOf(F)!==-1,y=d.indexOf(N)!==-1;h.push(K({delimiterType:"backtick",hasSingleQuote:p,hasDoubleQuote:m,hasBacktick:y,shouldKeepDelimiter:!o.quasis[0].tail||p&&m,range:[g,v],startLineIndex:o.loc.start.line-1}))}break}case"TaggedTemplateExpression":{if(a.push(f),S(o,i.object({tag:i.object({type:i.literal("Identifier"),name:i.string(),start:i.number(),end:i.number()})}))&&o.tag.name==="css"){let d=o.tag.start,p=o.tag.end;c.push({type:o.tag.type,range:[d,p-1]});break}(S(o,i.object({tag:i.object({type:i.literal("Identifier"),name:i.string()})}))&&s.includes(o.tag.name)||S(o,i.object({tag:i.object({type:i.literal("MemberExpression"),object:i.object({type:i.literal("Identifier"),name:i.string()})})}))&&s.includes(o.tag.object.name)||S(o,i.object({tag:i.object({type:i.literal("CallExpression"),callee:i.object({type:i.literal("Identifier"),name:i.string()})})}))&&s.includes(o.tag.callee.name))&&(u.push(f),h.forEach((d,p,m)=>{let[y,k]=d.range;g<=y&&k<=v&&(d.type==="unknown"&&d.delimiterType==="backtick"?m[p]=K({delimiterType:d.delimiterType,isItFunctionArgument:o.tag.type==="CallExpression",shouldKeepDelimiter:!0,range:d.range,startLineIndex:d.startLineIndex}):d.type==="expression"&&d.delimiterType==="backtick"&&(d.isItFunctionArgument=o.tag.type==="CallExpression",d.shouldKeepDelimiter=!0))}));break}case"LogicalExpression":{if(a.push(f),!t.experimentalOptimization&&S(o,i.object({left:i.object({start:i.number(),end:i.number()})}))){let d=o.left.start,p=o.left.end;h.forEach(m=>{let[y,k]=m.range;d<=y&&k<=p&&(m.range=[0,1/0])})}t.experimentalOptimization&&S(o,i.object({loc:i.object({start:i.object({line:i.number()})})}))&&h.push({type:"logical",range:[g,v],startLineIndex:o.loc.start.line-1});break}case"Block":case"Line":{S(o,i.object({value:i.string()}))&&o.value.trim()==="prettier-ignore"&&c.push(f);break}case"Comment":{S(o,i.object({data:i.string()}))&&o.data.trim()==="prettier-ignore"&&c.push(f);break}default:{a.push(f);break}}}return e.type||(e.type="Root"),l(e),Ye(a,c,u,h)}var hr=G(()=>{"use strict";pr();ht()});function gr(r,e){return r.split(A).map(n=>({indentLevel:n.match(new RegExp(`^(${e})*`))[0].length/e.length}))}function yr(r){return r.type==="attribute"||r.type==="expression"&&(r.isTheFirstLineOnTheSameLineAsTheAttributeName||r.isItAnOperandOfTernaryOperator)?1:0}function br(r,e,t){let n=F;if(r.type==="expression"&&(r.shouldKeepDelimiter?r.delimiterType==="backtick"?n=N:r.delimiterType==="single-quote"&&(n=P):r.isItInVueTemplate?n=P:t?r.hasSingleQuote||(n=P):t||r.hasDoubleQuote&&(n=P)),r.type==="expression"&&r.isItAngularExpression)return[P,P];let s=n,a=n;if(e){let c=r.type==="expression"&&r.delimiterType!=="backtick"&&r.isItAnObjectProperty;s=`${c?"[":""}${r.type==="attribute"?n:N}`,a=`${r.type==="attribute"?n:N}${c?"]":""}`}else{let c=r.type==="expression"&&r.isItAnObjectProperty&&n===N;s=`${c?"[":""}${n}`,a=`${n}${c?"]":""}`}return[s,a]}function vr(r){let e=r.match(/^(\s*)[^\s](?:[\s\w\W]*[^\s])?(\s*)$/),t=e?.[1]??"",n=e?.[2]??"",s=`${Q.repeat(t.length)}${r.slice(t.length,-n.length||void 0)}${Q.repeat(n.length)}`;return[t,s,n]}function xr(r){return(0,mr.createHash)("sha1").update(r).digest("hex")}function kr(r){let t=[...Array(16)].map((c,u)=>String.fromCharCode(913+u)),n=xr(r),s=n.slice(0,Math.min(r.length,n.length)).split("").map(c=>t[Number.parseInt(c,16)]).join(""),a=Q.repeat(Math.max(0,r.length-n.length));return`${s}${a}`}function _r(r){let t=[...Array(16)].map((c,u)=>String.fromCharCode(945+u)),n=xr(r),s=n.slice(0,Math.min(r.length,n.length)).split("").map(c=>t[Number.parseInt(c,16)]).join(""),a=Q.repeat(Math.max(0,r.length-n.length));return`${s}${a}`}function Jn({formattedText:r,indentUnit:e,targetClassNameNodes:t,lineNodes:n,options:s,format:a}){let c=[],u=[...Array(t.length)].map(()=>0),h=t.reduce((l,o,x)=>{let[g,v]=o.range,f=v-u[x],d=s.endingPosition!=="absolute",p=s.endingPosition!=="relative",m=d&&p,{indentLevel:y}=n[o.startLineIndex],k=yr(o),E=d?y+k:0;if(o.type==="ternary"){let J=l.slice(g,f),Z=kr(J);c.push({from:[Z],to:[J]});let z=`${l.slice(0,g)}${Z}${l.slice(f)}`;return u.forEach((te,H,oe)=>{if(H<=x)return;let[at,At]=t[H].range;at<g&&v<At&&(oe[H]+=f-g-Z.length)}),z}let $=l.slice(g+1,f-1),O=p?l[f-1]:"";if(o.type==="attribute")$=$.trim();else if(o.type==="expression"){let J=$!==$.trimStart(),Z=$!==$.trimEnd();$=`${J?M:""}${$.trim().replace(/\\\n/g,"")}${Z?M:""}`}let[R,B,V]=vr($),W=l.split(A).slice(0,o.startLineIndex).reduce((J,Z)=>J+Z.length+A.length,0),ze=e.length*y,_e=g+1-W-ze+s.tabWidth*y,Te=`${Q.repeat(p?_e:0)}${B}${Q.repeat(O.length)}`,ut=(J=>{let Z=a(J,{...s,parser:"html",plugins:[],rangeStart:0,rangeEnd:1/0,endOfLine:"lf"}).trimEnd();if(!m)return Z;let[z,...te]=Z.split(A);if(te.length===0)return z;let H=s.tabWidth*E,oe=a(te.join(A),{...s,parser:"html",plugins:[],rangeStart:0,rangeEnd:1/0,endOfLine:"lf",printWidth:s.printWidth-H}).trimEnd();return`${z}${A}${oe}`})(Te).slice(p?_e:0,-O.length||void 0),Ve=`${R}${ut.slice(R.length,-V.length||void 0)}${V}`,ye=Ve.split(A).length>1,[se,rt]=br(o,ye,s.singleQuote),ae=Ve;o.type==="expression"&&(se===P?o.delimiterType!=="single-quote"&&o.hasSingleQuote&&(ae=ae.replace(/'/g,`\\${P}`)):se===F?o.delimiterType!=="double-quote"&&o.hasDoubleQuote&&(ae=ae.replace(/"/g,`\\${F}`)):o.delimiterType!=="backtick"&&o.hasBacktick&&(ae=ae.replace(/`/g,`\\${N}`)),ae=`${se}${ae}${rt}`);let ie=e.repeat(E),dt=[],nt=[],st=ae.split(A).map(J=>{let Z=_r(J);return dt.push(J),nt.push(Z),Z}).join(`${A}${ie}`);c.push({from:nt,to:dt});let Se=o.type==="attribute",ue=!ye&&o.type==="expression"&&o.delimiterType==="backtick"&&o.isItAnObjectProperty?1:0,de=ye&&s.syntaxTransformation&&["babel","typescript","astro","svelte","vue"].includes(s.parser),We=`${Se&&de&&s.parser==="vue"?l.slice(0,g-ue).replace(/([^ :=]+=)$/,":$1"):l.slice(0,g-ue+(Se&&!de?1:0))}${Se&&de?s.parser==="vue"?`${F}${N}`:`{${N}`:""}${st}${Se?de?s.parser==="vue"?`${N}${F}`:`${N}}`:l.slice(f+ue-1,f+ue):""}${l.slice(f+ue)}`;return u.forEach((J,Z,z)=>{if(Z<=x)return;let[te,H]=t[Z].range;te<g&&v<H&&(z[Z]+=f-g-st.length)}),We},r);return c.reduceRight((l,{from:o,to:x})=>{let g=new RegExp(o.join("(\\s*)")),v=l.match(g);return v?l.replace(g,(f,...d)=>{let p=d.slice(0,v.length-1);return x.map((m,y)=>`${m}${p[y]===void 0?"":p[y]}`).join("")}):l},h)}function Wt({formattedText:r,ast:e,options:t,format:n,addon:s}){if(r==="")return r;let a=t.useTabs?pe:M.repeat(t.tabWidth),c=[];switch(t.parser){case"astro":{c=zt(r,e,t,s);break}case"svelte":{c=Vt(r,e,t);break}case"angular":{c=Mt(e,t,s);break}case"html":{c=Ft(e,t,s);break}case"vue":{c=Bt(e,t,s);break}default:{c=ne(e,t);break}}if(t.experimentalOptimization)return $t(r,a,c,t);let u=gr(r,a);return Jn({formattedText:r,indentUnit:a,targetClassNameNodes:c,lineNodes:u,options:t,format:n})}async function Xn({formattedText:r,indentUnit:e,targetClassNameNodes:t,lineNodes:n,options:s,format:a}){let c=[],u=[...Array(t.length)].map(()=>0),h=await t.reduce(async(l,o,x)=>{let[g,v]=o.range,f=await l,d=v-u[x],p=s.endingPosition!=="absolute",m=s.endingPosition!=="relative",y=p&&m,{indentLevel:k}=n[o.startLineIndex],E=yr(o),$=p?k+E:0;if(o.type==="ternary"){let Z=f.slice(g,d),z=kr(Z);c.push({from:[z],to:[Z]});let te=`${f.slice(0,g)}${z}${f.slice(d)}`;return u.forEach((H,oe,at)=>{if(oe<=x)return;let[At,Br]=t[oe].range;At<g&&v<Br&&(at[oe]+=d-g-z.length)}),te}let O=f.slice(g+1,d-1),R=m?f[d-1]:"";if(o.type==="attribute")O=O.trim();else if(o.type==="expression"){let Z=O!==O.trimStart(),z=O!==O.trimEnd();O=`${Z?M:""}${O.trim().replace(/\\\n/g,"")}${z?M:""}`}let[B,V,W]=vr(O),ze=f.split(A).slice(0,o.startLineIndex).reduce((Z,z)=>Z+z.length+A.length,0),_e=e.length*k,Te=g+1-ze-_e+s.tabWidth*k,lt=`${Q.repeat(m?Te:0)}${V}${Q.repeat(R.length)}`,Ve=(await(async Z=>{let z=(await a(Z,{...s,parser:"html",plugins:[],rangeStart:0,rangeEnd:1/0,endOfLine:"lf"})).trimEnd();if(!y)return z;let[te,...H]=z.split(A);if(H.length===0)return te;let oe=s.tabWidth*$,at=(await a(H.join(A),{...s,parser:"html",plugins:[],rangeStart:0,rangeEnd:1/0,endOfLine:"lf",printWidth:s.printWidth-oe})).trimEnd();return`${te}${A}${at}`})(lt)).slice(m?Te:0,-R.length||void 0),ye=`${B}${Ve.slice(B.length,-W.length||void 0)}${W}`,se=ye.split(A).length>1,[rt,ae]=br(o,se,s.singleQuote),ie=ye;o.type==="expression"&&(rt===P?o.delimiterType!=="single-quote"&&o.hasSingleQuote&&(ie=ie.replace(/'/g,`\\${P}`)):rt===F?o.delimiterType!=="double-quote"&&o.hasDoubleQuote&&(ie=ie.replace(/"/g,`\\${F}`)):o.delimiterType!=="backtick"&&o.hasBacktick&&(ie=ie.replace(/`/g,`\\${N}`)),ie=`${rt}${ie}${ae}`);let dt=e.repeat($),nt=[],st=[],Se=ie.split(A).map(Z=>{let z=_r(Z);return nt.push(Z),st.push(z),z}).join(`${A}${dt}`);c.push({from:st,to:nt});let ue=o.type==="attribute",de=!se&&o.type==="expression"&&o.delimiterType==="backtick"&&o.isItAnObjectProperty?1:0,We=se&&s.syntaxTransformation&&["babel","typescript","astro","svelte","vue"].includes(s.parser),J=`${ue&&We&&s.parser==="vue"?f.slice(0,g-de).replace(/([^ :=]+=)$/,":$1"):f.slice(0,g-de+(ue&&!We?1:0))}${ue&&We?s.parser==="vue"?`${F}${N}`:`{${N}`:""}${Se}${ue?We?s.parser==="vue"?`${N}${F}`:`${N}}`:f.slice(d+de-1,d+de):""}${f.slice(d+de)}`;return u.forEach((Z,z,te)=>{if(z<=x)return;let[H,oe]=t[z].range;H<g&&v<oe&&(te[z]+=d-g-Se.length)}),J},Promise.resolve(r));return c.reduceRight((l,{from:o,to:x})=>{let g=new RegExp(o.join("(\\s*)")),v=l.match(g);return v?l.replace(g,(f,...d)=>{let p=d.slice(0,v.length-1);return x.map((m,y)=>`${m}${p[y]===void 0?"":p[y]}`).join("")}):l},h)}async function qt({formattedText:r,ast:e,options:t,format:n,addon:s}){if(r==="")return r;let a=t.useTabs?pe:M.repeat(t.tabWidth),c=[];switch(t.parser){case"astro":{c=zt(r,e,t,s);break}case"svelte":{c=Vt(r,e,t);break}case"angular":{c=Mt(e,t,s);break}case"html":{c=Ft(e,t,s);break}case"vue":{c=Bt(e,t,s);break}default:{c=ne(e,t);break}}if(t.experimentalOptimization)return $t(r,a,c,t);let u=gr(r,a);return await Xn({formattedText:r,indentUnit:a,targetClassNameNodes:c,lineNodes:u,options:t,format:n})}var mr,Qt=G(()=>{"use strict";mr=require("node:crypto");rr();hr();ht()});function Hn(r,e=2){return r.split(Fe).map(t=>`${Kn.repeat(e)}${t}`).join(Fe)}function Ze(r,e,t){return{...e,parse:(n,s,a)=>{if(a.parentParser==="markdown"||a.parentParser==="mdx"){let p="```",m="```";return a.parser==="babel"?p="```jsx":a.parser==="typescript"&&(p="```tsx"),{type:"FormattedText",body:(0,et.format)(`${p}${Fe}${n}${Fe}${m}`,{...a,plugins:[],rangeEnd:1/0,endOfLine:"lf",parser:a.parentParser,parentParser:void 0}).trim().slice(`${p}${Fe}`.length,-`${Fe}${m}`.length)}}let c=a.plugins.filter(p=>typeof p!="string"),u,h;if(t){if(u=c.filter(p=>p.languages?.some(m=>m.name===t)).at(0),h=u?.parsers?.[r],!u||!h)throw new Error(`There doesn't seem to be any plugin that supports ${t} formatting.`);e=h}let l=u?[u]:[],o=(0,et.format)(n,{...a,plugins:l,endOfLine:"lf"}),x=e.parse(o,{[r]:e},a),g=Wt({formattedText:o,ast:x,options:a,format:et.format,addon:Tr});if(g===o)return{type:"FormattedText",body:g};let v;try{v=(0,et.format)(g,{...a,plugins:l,endOfLine:"lf",rangeEnd:1/0})}catch(p){throw new Error(`The second format failed. This is likely a bug in this plugin. Please file an issue.${p instanceof Error?`${Fe}${Hn(`Error: ${p.message}`,4)}`:""}`)}if(v===o)return{type:"FormattedText",body:g};let f=e.parse(v,{[r]:e},a);return{type:"FormattedText",body:Wt({formattedText:v,ast:f,options:a,format:et.format,addon:Tr})}},astFormat:"classnames-ast"}}var et,Ot,Et,wt,Fe,Kn,Tr,Sr,Er=G(()=>{"use strict";Qt();et=require("prettier"),Ot=require("prettier/parser-babel"),Et=require("prettier/parser-html"),wt=require("prettier/parser-typescript"),Fe=`
`,Kn=" ",Tr={parseBabel:(r,e)=>Ot.parsers.babel.parse(r,{babel:Ot.parsers.babel},e),parseTypescript:(r,e)=>wt.parsers.typescript.parse(r,{typescript:wt.parsers.typescript},e)};Sr={babel:Ze("babel",Ot.parsers.babel),typescript:Ze("typescript",wt.parsers.typescript),angular:Ze("angular",Et.parsers.angular),html:Ze("html",Et.parsers.html),vue:Ze("vue",Et.parsers.vue),astro:Ze("astro",{},"astro"),svelte:Ze("svelte",{},"svelte")}});function Gn(){function r(e,t,n){let s=e.getValue();if(s.type==="FormattedText")return s.body;throw new Error(`Unknown node type: ${s?.type}`)}return{print:r}}var Or,wr=G(()=>{"use strict";Or={"classnames-ast":Gn()}});var jr={};Xt(jr,{options:()=>Gt,parsers:()=>Sr,printers:()=>Or});var Ar=G(()=>{"use strict";Yt();Er();wr()});var Ir,Lr=G(()=>{"use strict";Ir={customAttributes:{since:"0.1.0",type:"string",array:!0,category:"Format",default:[{value:[]}],description:"List of attributes that enclosing class names. The `class` and `className` attributes are always supported, even if no options are specified."},customFunctions:{since:"0.1.0",type:"string",array:!0,category:"Format",default:[{value:[]}],description:"List of functions that enclosing class names. The `classNames` function is always supported, even if no options are specified."},endingPosition:{since:"0.5.0",type:"choice",category:"Format",default:"relative",description:"This is the criterion for ending the class name on each line when replacing the original class name with a multi-line class name.",choices:[{value:"relative",description:"Each line ends at a `printWidth` distance from the start of the class name."},{value:"absolute",description:"Each line ends at a `printWidth` distance from the start of the line."},{since:"0.6.0",value:"absolute-with-indent",description:"Basically the same as the `absolute` option, but indentation respects the `relative` option."}]},debugFlag:{since:"0.7.2",type:"boolean",category:"Format",default:!1,description:"A flag for branching in the development environment. It has no effect in production."},experimentalOptimization:{since:"0.7.2",type:"boolean",category:"Format",default:!1,description:"Formatting will be up to 67% faster. Note that Node.js version must be 17 or higher, and the output of nested expressions may be slightly different."},syntaxTransformation:{since:"0.7.7",type:"boolean",category:"Format",default:!1,description:"If a line wrapping occurs in a class name written in non-expression syntax, it is transformed into expression syntax. This transformation does not support reversible formatting."}}});function es(r,e=2){return r.split(Me).map(t=>`${Yn.repeat(e)}${t}`).join(Me)}function Be(r,e,t){return{...e,parse:async(n,s)=>{if(s.parentParser==="markdown"||s.parentParser==="mdx"){let d="```",p="```";return s.parser==="babel"?d="```jsx":s.parser==="typescript"&&(d="```tsx"),{type:"FormattedText",body:(await(0,tt.format)(`${d}${Me}${n}${Me}${p}`,{...s,plugins:[],rangeEnd:1/0,endOfLine:"lf",parser:s.parentParser,parentParser:void 0})).trim().slice(`${d}${Me}`.length,-`${Me}${p}`.length)}}let a=s.plugins.filter(d=>typeof d!="string"),c,u;if(t){if(c=a.filter(d=>d.languages?.some(p=>p.name===t)).at(0),u=c?.parsers?.[r],!c||!u)throw new Error(`There doesn't seem to be any plugin that supports ${t} formatting.`);e=u}let h=c?[c]:[],l=await(0,tt.format)(n,{...s,plugins:h,endOfLine:"lf"}),o=await e.parse(l,s),x=await qt({formattedText:l,ast:o,options:{...s,useTabs:s.useTabs??!1},format:tt.format,addon:Cr});if(x===l)return{type:"FormattedText",body:x};let g;try{g=await(0,tt.format)(x,{...s,plugins:h,endOfLine:"lf",rangeEnd:1/0})}catch(d){throw new Error(`The second format failed. This is likely a bug in this plugin. Please file an issue.${d instanceof Error?`${Me}${es(`Error: ${d.message}`,4)}`:""}`)}if(g===l)return{type:"FormattedText",body:x};let v=await e.parse(g,s);return{type:"FormattedText",body:await qt({formattedText:g,ast:v,options:{...s,useTabs:s.useTabs??!1},format:tt.format,addon:Cr})}},astFormat:"classnames-ast"}}var tt,Ut,jt,Jt,Me,Yn,Cr,$r,Nr=G(()=>{"use strict";Qt();tt=require("prettier"),Ut=require("prettier/plugins/babel"),jt=require("prettier/plugins/html"),Jt=require("prettier/plugins/typescript"),Me=`
`,Yn=" ",Cr={parseBabel:(r,e)=>Ut.parsers.babel.parse(r,e),parseTypescript:(r,e)=>Jt.parsers.typescript.parse(r,e)};$r={babel:Be("babel",Ut.parsers.babel),typescript:Be("typescript",Jt.parsers.typescript),angular:Be("angular",jt.parsers.angular),html:Be("html",jt.parsers.html),vue:Be("vue",jt.parsers.vue),astro:Be("astro",{},"astro"),svelte:Be("svelte",{},"svelte")}});function ts(){function r(e,t,n){let{node:s}=e;if(s.type==="FormattedText")return s.body;throw new Error(`Unknown node type: ${s?.type}`)}return{print:r}}var Rr,Pr=G(()=>{"use strict";Rr={"classnames-ast":ts()}});var Dr={};Xt(Dr,{options:()=>Ir,parsers:()=>$r,printers:()=>Rr});var Zr=G(()=>{"use strict";Lr();Nr();Pr()});var Fr=Qr(require("prettier"));Fr.default.version.startsWith("2.")?module.exports=(Ar(),Ht(jr)):module.exports=(Zr(),Ht(Dr));