@povio/openapi-codegen-cli 1.2.6 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/sh.js
CHANGED
|
@@ -522,11 +522,11 @@ ${rr.join(`
|
|
|
522
522
|
`:`
|
|
523
523
|
`)+m,T=b+1,b=l.indexOf(`
|
|
524
524
|
`,T)}while(b!==-1);return I+=l.slice(T),I}t(CQe,"stringEncaseCRLFWithFirstIndex");var{stdout:EQe,stderr:PQe}=TQe,AEe=Symbol("GENERATOR"),yM=Symbol("STYLER"),OU=Symbol("IS_EMPTY"),wQe=["ansi","ansi","ansi256","ansi16m"],vM=Object.create(null),B5t=t((l,u={})=>{if(u.level&&!(Number.isInteger(u.level)&&u.level>=0&&u.level<=3))throw new Error("The `level` option should be an integer from 0 to 3");let m=EQe?EQe.level:0;l.level=u.level===void 0?m:u.level},"applyOptions"),NEe=class NEe{constructor(u){return AQe(u)}};t(NEe,"Chalk");var tce=NEe,AQe=t(l=>{let u=t((...m)=>m.join(" "),"chalk");return B5t(u,l),Object.setPrototypeOf(u,FU.prototype),u},"chalkFactory");function FU(l){return AQe(l)}t(FU,"createChalk");Object.setPrototypeOf(FU.prototype,Function.prototype);for(let[l,u]of Object.entries(Yx))vM[l]={get(){let m=rce(this,IEe(u.open,u.close,this[yM]),this[OU]);return Object.defineProperty(this,l,{value:m}),m}};vM.visible={get(){let l=rce(this,this[yM],!0);return Object.defineProperty(this,"visible",{value:l}),l}};var DEe=t((l,u,m,...b)=>l==="rgb"?u==="ansi16m"?Yx[m].ansi16m(...b):u==="ansi256"?Yx[m].ansi256(Yx.rgbToAnsi256(...b)):Yx[m].ansi(Yx.rgbToAnsi(...b)):l==="hex"?DEe("rgb",u,m,...Yx.hexToRgb(...b)):Yx[m][l](...b),"getModelAnsi"),$5t=["rgb","hex","ansi256"];for(let l of $5t){vM[l]={get(){let{level:m}=this;return function(...b){let T=IEe(DEe(l,wQe[m],"color",...b),Yx.color.close,this[yM]);return rce(this,T,this[OU])}}};let u="bg"+l[0].toUpperCase()+l.slice(1);vM[u]={get(){let{level:m}=this;return function(...b){let T=IEe(DEe(l,wQe[m],"bgColor",...b),Yx.bgColor.close,this[yM]);return rce(this,T,this[OU])}}}}var J5t=Object.defineProperties(()=>{},{...vM,level:{enumerable:!0,get(){return this[AEe].level},set(l){this[AEe].level=l}}}),IEe=t((l,u,m)=>{let b,T;return m===void 0?(b=l,T=u):(b=m.openAll+l,T=u+m.closeAll),{open:l,close:u,openAll:b,closeAll:T,parent:m}},"createStyler"),rce=t((l,u,m)=>{let b=t((...T)=>q5t(b,T.length===1?""+T[0]:T.join(" ")),"builder");return Object.setPrototypeOf(b,J5t),b[AEe]=l,b[yM]=u,b[OU]=m,b},"createBuilder"),q5t=t((l,u)=>{if(l.level<=0||!u)return l[OU]?"":u;let m=l[yM];if(m===void 0)return u;let{openAll:b,closeAll:T}=m;if(u.includes("\x1B"))for(;m!==void 0;)u=kQe(u,m.close,m.open),m=m.parent;let I=u.indexOf(`
|
|
525
|
-
`);return I!==-1&&(u=CQe(u,T,b,I)),b+u+T},"applyStyle");Object.defineProperties(FU.prototype,vM);var WXt=FU(),HXt=FU({level:PQe?PQe.level:0});var EA=new tce;function OEe(l){console.log(l)}t(OEe,"log");function oS(l){console.log(`[INFO] ${l}`)}t(oS,"logInfo");function MU(l){console.log(EA.green(`[SUCCESS] ${l}`))}t(MU,"logSuccess");function HN(l,u){l instanceof Error?console.log(EA.red(`[ERROR] ${u||l.message}`)):console.log(EA.red(`[ERROR] ${l}`))}t(HN,"logError");function nce(l){console.log(EA.bgYellow(`==== ${l} ====`))}t(nce,"logBanner");var DQe=Vd(require("fs"));function bM(){return"1.2.6"}t(bM,"getVersion");var aYt=Vd(NQe());var FEe=Symbol("options_key");function Du(l){return(u,m)=>{var b,T;if(l!=null){let I={...Reflect.getMetadata(FEe,u)||{},[m]:{...l,describe:l.envAlias?`${l.describe||""} [${l.envAlias}]`:l.describe,type:l.type||((T=(b=Reflect.getMetadata("design:type",u,m))==null?void 0:b.name)==null?void 0:T.toLowerCase())}};Reflect.defineMetadata(FEe,I,u)}}}t(Du,"YargOption");function OQe(l){let u=Reflect.getMetadata(FEe,l.prototype);if(!u)throw new Error(`Options for ${l.name} were not defined`);return u}t(OQe,"getYargsOption");function ice(l){return async u=>u.options(z5t(l)).middleware(async m=>await V5t(l,m),!0)}t(ice,"getBuilder");function z5t(l){return Object.entries(OQe(l)).reduce((u,[m,b])=>(u[m]=Object.fromEntries(Object.entries(b).filter(([T])=>!["envAlias","default"].includes(T))),u),{})}t(z5t,"getYargsOptions");async function V5t(l,u){let m=new l;for(let[b,T]of Object.entries(OQe(l)))m[b]=u[b]??T.default;return m}t(V5t,"loadYargsConfig");var uit=Vd(kwe());var urt={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",300:"Ambiguous",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I Am a Teapot",421:"Misdirected Request",422:"Unprocessable Entity",424:"Failed Dependency",428:"Precondition Required",429:"Too Many Requests",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported"},frt={"invalid-schema":"Invalid OpenAPI Schemas","invalid-operation-id":"Invalid Operation IDs","missing-path-parameter":"Missing Path Parameters","not-allowed-inline-enum":"Not Allowed Inline Enums","not-allowed-circular-schema":"Not Allowed Circular Schemas","missing-acl-condition-property":"Missing x-acl Condition Properties","missing-status-code":"Missing HTTP Status Codes","invalid-status-code":"Invalid HTTP Status Codes","multiple-success-status-codes":"Multiple Success HTTP Status Codes"};var u_=t(l=>l.charAt(0).toUpperCase()+l.slice(1),"capitalize"),zA=t(l=>l.charAt(0).toLowerCase()+l.slice(1),"decapitalize"),EW=t(l=>l.replace(/(-\w)/g,u=>u[1].toUpperCase()),"kebabToCamel"),ny=t(l=>l.replace(/(_\w)/g,u=>u[1].toUpperCase()),"snakeToCamel"),_rt=t(l=>l.replace(/[\W_]+(\w)?/g,(u,m)=>(m==null?void 0:m.toUpperCase())??""),"nonWordCharactersToCamel"),Cwe=t((l,u="")=>l.endsWith(u)?l:`${l}${u}`,"suffixIfNeeded"),prt=t((l,u)=>l.replace(new RegExp(`${u}$`),""),"removeSuffix"),BVt=t(l=>{var b;let u=l.reduce((T,I)=>({...T,[I]:(T[I]??0)+1}),{});return(b=Object.entries(u).sort((T,I)=>T[1]===I[1]?I[0].length-T[0].length:I[1]-T[1])[0])==null?void 0:b[0]},"getLongestMostCommon"),Ewe=t(l=>{let u=l.map(u_).map(drt).map(m=>$Vt(m)).flat();return BVt(u)},"getMostCommonAdjacentCombinationSplit"),drt=t(l=>l.split(/(?<![A-Z])(?=[A-Z])/).filter(Boolean),"splitByUppercase"),ule=t(l=>drt(l).join(" "),"camelToSpaceSeparated"),$Vt=t((l,u=["dto","by","for","of","in","to","and","with"])=>{var b;let m=[];for(let T=0;T<l.length;T++)if(!u.includes(l[T].toLowerCase()))for(let I=T+1;I<=l.length;I++)u.includes((b=l[I-1])==null?void 0:b.toLowerCase())||m.push(l.slice(T,I).join(""));return m},"getAdjacentStringCombinations"),mrt=t((l,u)=>{let m=u.replace(/es$|s$/g,""),b=new RegExp(`(${zA(m)}|${u_(m)})[a-z]*(?=$|[A-Z])`,"g");return l.replace(b,"")},"removeWord");function m8(l){return _rt(l)}t(m8,"formatTag");function VA(l,u){var b;let m=(b=l.tags)==null?void 0:b[0];return m8(m??u.defaultTag)}t(VA,"getOperationTag");function Y1(l,u){var b;let m=u.splitByTags?(b=l.tags)==null?void 0:b[0]:u.defaultTag;return m8(m??u.defaultTag)}t(Y1,"getEndpointTag");function hrt(l,u){return u.excludeTags.some(m=>m.toLowerCase()===l.toLowerCase())}t(hrt,"isTagExcluded");var h8="application/json",Pwe={"Content-Type":h8,Accept:h8},fle="data",wwe="axios",UA="config",DC="AxiosRequestConfig",_le={defaultImport:wwe,bindings:[DC],from:"axios"};var r6=Vd(ple()),Awe=2,grt=["application/octet-stream","multipart/form-data","application/x-www-form-urlencoded","*/*"],yrt=["query","header","path"],g8=[r6.OpenAPIV3.HttpMethods.GET,r6.OpenAPIV3.HttpMethods.PUT,r6.OpenAPIV3.HttpMethods.POST,r6.OpenAPIV3.HttpMethods.DELETE,r6.OpenAPIV3.HttpMethods.OPTIONS,r6.OpenAPIV3.HttpMethods.HEAD,r6.OpenAPIV3.HttpMethods.PATCH,r6.OpenAPIV3.HttpMethods.TRACE],vrt=["string","number","integer","boolean"],PW=["allOf","anyOf","oneOf"];var brt="Schema",Srt="Enum",xrt="Body",Trt="Param",krt="Response",Crt="ErrorResponse",wW="z.void()",sR="z.any()",dle="z.instanceof(Blob)",AW="z.enum",Ert="z.int()",Prt="z.number()",mle="z.string()",wrt="z.email()",Art="z.url()",Drt="z.uuid()",Irt="z.iso.datetime({ offset: true })",HA={bindings:["z"],from:"zod"};var n6=Symbol.for("@ts-pattern/matcher"),zVt=Symbol.for("@ts-pattern/isVariadic"),gle="@ts-pattern/anonymous-select-key",Dwe=t(l=>!!(l&&typeof l=="object"),"r"),hle=t(l=>l&&!!l[n6],"i"),OC=t((l,u,m)=>{if(hle(l)){let b=l[n6](),{matched:T,selections:I}=b.match(u);return T&&I&&Object.keys(I).forEach(L=>m(L,I[L])),T}if(Dwe(l)){if(!Dwe(u))return!1;if(Array.isArray(l)){if(!Array.isArray(u))return!1;let b=[],T=[],I=[];for(let L of l.keys()){let Q=l[L];hle(Q)&&Q[zVt]?I.push(Q):I.length?T.push(Q):b.push(Q)}if(I.length){if(I.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(u.length<b.length+T.length)return!1;let L=u.slice(0,b.length),Q=T.length===0?[]:u.slice(-T.length),ae=u.slice(b.length,T.length===0?1/0:-T.length);return b.every((ee,pe)=>OC(ee,L[pe],m))&&T.every((ee,pe)=>OC(ee,Q[pe],m))&&(I.length===0||OC(I[0],ae,m))}return l.length===u.length&&l.every((L,Q)=>OC(L,u[Q],m))}return Reflect.ownKeys(l).every(b=>{let T=l[b];return(b in u||hle(I=T)&&I[n6]().matcherType==="optional")&&OC(T,u[b],m);var I})}return Object.is(u,l)},"s"),YA=t(l=>{var u,m,b;return Dwe(l)?hle(l)?(u=(m=(b=l[n6]()).getSelectionKeys)==null?void 0:m.call(b))!=null?u:[]:Array.isArray(l)?IW(l,YA):IW(Object.values(l),YA):[]},"o"),IW=t((l,u)=>l.reduce((m,b)=>m.concat(u(b)),[]),"c");function pS(l){return Object.assign(l,{optional:t(()=>VVt(l),"optional"),and:t(u=>Zp(l,u),"and"),or:t(u=>UVt(l,u),"or"),select:t(u=>u===void 0?Nrt(l):Nrt(u,l),"select")})}t(pS,"u");function VVt(l){return pS({[n6]:()=>({match:t(u=>{let m={},b=t((T,I)=>{m[T]=I},"r");return u===void 0?(YA(l).forEach(T=>b(T,void 0)),{matched:!0,selections:m}):{matched:OC(l,u,b),selections:m}},"match"),getSelectionKeys:t(()=>YA(l),"getSelectionKeys"),matcherType:"optional"})})}t(VVt,"h");function Zp(...l){return pS({[n6]:()=>({match:t(u=>{let m={},b=t((T,I)=>{m[T]=I},"r");return{matched:l.every(T=>OC(T,u,b)),selections:m}},"match"),getSelectionKeys:t(()=>IW(l,YA),"getSelectionKeys"),matcherType:"and"})})}t(Zp,"m");function UVt(...l){return pS({[n6]:()=>({match:t(u=>{let m={},b=t((T,I)=>{m[T]=I},"r");return IW(l,YA).forEach(T=>b(T,void 0)),{matched:l.some(T=>OC(T,u,b)),selections:m}},"match"),getSelectionKeys:t(()=>IW(l,YA),"getSelectionKeys"),matcherType:"or"})})}t(UVt,"d");function Df(l){return{[n6]:()=>({match:t(u=>({matched:!!l(u)}),"match")})}}t(Df,"p");function Nrt(...l){let u=typeof l[0]=="string"?l[0]:void 0,m=l.length===2?l[1]:typeof l[0]=="string"?void 0:l[0];return pS({[n6]:()=>({match:t(b=>{let T={[u??gle]:b};return{matched:m===void 0||OC(m,b,(I,L)=>{T[I]=L}),selections:T}},"match"),getSelectionKeys:t(()=>[u??gle].concat(m===void 0?[]:YA(m)),"getSelectionKeys")})})}t(Nrt,"y");function IC(l){return typeof l=="number"}t(IC,"v");function GA(l){return typeof l=="string"}t(GA,"b");function QA(l){return typeof l=="bigint"}t(QA,"w");var Pnr=pS(Df(function(l){return!0}));var ZA=t(l=>Object.assign(pS(l),{startsWith:t(u=>{return ZA(Zp(l,(m=u,Df(b=>GA(b)&&b.startsWith(m)))));var m},"startsWith"),endsWith:t(u=>{return ZA(Zp(l,(m=u,Df(b=>GA(b)&&b.endsWith(m)))));var m},"endsWith"),minLength:t(u=>ZA(Zp(l,(m=>Df(b=>GA(b)&&b.length>=m))(u))),"minLength"),length:t(u=>ZA(Zp(l,(m=>Df(b=>GA(b)&&b.length===m))(u))),"length"),maxLength:t(u=>ZA(Zp(l,(m=>Df(b=>GA(b)&&b.length<=m))(u))),"maxLength"),includes:t(u=>{return ZA(Zp(l,(m=u,Df(b=>GA(b)&&b.includes(m)))));var m},"includes"),regex:t(u=>{return ZA(Zp(l,(m=u,Df(b=>GA(b)&&!!b.match(m)))));var m},"regex")}),"j"),wnr=ZA(Df(GA)),NC=t(l=>Object.assign(pS(l),{between:t((u,m)=>NC(Zp(l,((b,T)=>Df(I=>IC(I)&&b<=I&&T>=I))(u,m))),"between"),lt:t(u=>NC(Zp(l,(m=>Df(b=>IC(b)&&b<m))(u))),"lt"),gt:t(u=>NC(Zp(l,(m=>Df(b=>IC(b)&&b>m))(u))),"gt"),lte:t(u=>NC(Zp(l,(m=>Df(b=>IC(b)&&b<=m))(u))),"lte"),gte:t(u=>NC(Zp(l,(m=>Df(b=>IC(b)&&b>=m))(u))),"gte"),int:t(()=>NC(Zp(l,Df(u=>IC(u)&&Number.isInteger(u)))),"int"),finite:t(()=>NC(Zp(l,Df(u=>IC(u)&&Number.isFinite(u)))),"finite"),positive:t(()=>NC(Zp(l,Df(u=>IC(u)&&u>0))),"positive"),negative:t(()=>NC(Zp(l,Df(u=>IC(u)&&u<0))),"negative")}),"x"),Anr=NC(Df(IC)),XA=t(l=>Object.assign(pS(l),{between:t((u,m)=>XA(Zp(l,((b,T)=>Df(I=>QA(I)&&b<=I&&T>=I))(u,m))),"between"),lt:t(u=>XA(Zp(l,(m=>Df(b=>QA(b)&&b<m))(u))),"lt"),gt:t(u=>XA(Zp(l,(m=>Df(b=>QA(b)&&b>m))(u))),"gt"),lte:t(u=>XA(Zp(l,(m=>Df(b=>QA(b)&&b<=m))(u))),"lte"),gte:t(u=>XA(Zp(l,(m=>Df(b=>QA(b)&&b>=m))(u))),"gte"),positive:t(()=>XA(Zp(l,Df(u=>QA(u)&&u>0))),"positive"),negative:t(()=>XA(Zp(l,Df(u=>QA(u)&&u<0))),"negative")}),"A"),Dnr=XA(Df(QA)),Inr=pS(Df(function(l){return typeof l=="boolean"})),Nnr=pS(Df(function(l){return typeof l=="symbol"})),Onr=pS(Df(function(l){return l==null})),Fnr=pS(Df(function(l){return l!=null}));var Fwe=class Fwe extends Error{constructor(u){let m;try{m=JSON.stringify(u)}catch{m=u}super(`Pattern matching error: no pattern matches value ${m}`),this.input=void 0,this.input=u}};t(Fwe,"W");var Iwe=Fwe,Nwe={matched:!1,value:void 0};function Xy(l){return new Owe(l,Nwe)}t(Xy,"z");var DW=class DW{constructor(u,m){this.input=void 0,this.state=void 0,this.input=u,this.state=m}with(...u){if(this.state.matched)return this;let m=u[u.length-1],b=[u[0]],T;u.length===3&&typeof u[1]=="function"?T=u[1]:u.length>2&&b.push(...u.slice(1,u.length-1));let I=!1,L={},Q=t((ee,pe)=>{I=!0,L[ee]=pe},"a"),ae=!b.some(ee=>OC(ee,this.input,Q))||T&&!T(this.input)?Nwe:{matched:!0,value:m(I?gle in L?L[gle]:L:this.input,this.input)};return new DW(this.input,ae)}when(u,m){if(this.state.matched)return this;let b=!!u(this.input);return new DW(this.input,b?{matched:!0,value:m(this.input,this.input)}:Nwe)}otherwise(u){return this.state.matched?this.state.value:u(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new Iwe(this.input)}run(){return this.exhaustive()}returnType(){return this}};t(DW,"I");var Owe=DW;function gf(l){return l!=null&&Object.prototype.hasOwnProperty.call(l,"$ref")}t(gf,"isReferenceObject");function iy(l){return!gf(l)}t(iy,"isSchemaObject");function yle(l){return l.type==="array"}t(yle,"isArraySchemaObject");function Ort(l){if(!l.allOf)throw new Error("Function inferRequiredSchema is specialized to handle item with required only in an allOf array.");let[u,m]=l.allOf.reduce((T,I)=>{if(WVt(I)){let L=I.required;T[0].push(...L??[])}else T[1].push(I);return T},[[],[]]),b={properties:u.reduce((T,I)=>(T[I]={},T),{}),type:"object",required:u};return{noRequiredOnlyAllof:m,composedRequiredSchema:b,patchRequiredSchemaInLoop:t((T,I)=>{if(gf(T)){let L=I(T.$ref);L&&b.required.forEach(Q=>{var ae;b.properties[Q]=((ae=L==null?void 0:L.properties)==null?void 0:ae[Q])??{}})}else{let L=T.properties??{};b.required.forEach(Q=>{L[Q]&&(b.properties[Q]=L[Q]??{})})}},"patchRequiredSchemaInLoop")}}t(Ort,"inferRequiredSchema");var WVt=t(l=>!gf(l)&&!!l.required&&!l.type&&!l.properties&&!(l!=null&&l.allOf)&&!(l!=null&&l.anyOf)&&!l.oneOf,"isBrokenAllOfItem");var Mrt=t(l=>`#/components/schemas/${l}`,"getSchemaRef"),y8=t(l=>l[1]==="/"?l:"#/"+l.slice(1),"autocorrectRef"),aR=t(l=>y8(l).split("/").at(-1),"getSchemaNameByRef");function Rwe(l){let u=HVt(l).normalize("NFKD").trim().replace(/\s+/g,"_").replace(/--+/g,"-").replace(/-+/g,"_").replace(/[^\w-]+/g,"_");return ny(u)}t(Rwe,"normalizeString");function Lwe(l){return/^[a-zA-Z]\w*$/.test(l)?l:`"${l}"`}t(Lwe,"wrapWithQuotesIfNeeded");function Rrt(l){return typeof l=="string"&&l.startsWith('"')&&l.endsWith('"')?l.slice(1,-1):l}t(Rrt,"unwrapQuotesIfNeeded");function HVt(l){let u=Number(l[0]);return typeof u=="number"&&!Number.isNaN(u)?"_"+l:l}t(HVt,"prefixStringStartingWithNumberIfNeeded");function jwe(l){let u=l.replaceAll("_","#");return ny(u.replaceAll("-","_")).replaceAll("#","_")}t(jwe,"pathParamToVariableName");var v8=t(l=>vrt.includes(l),"isPrimitiveType");function Lrt(l){return l.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/([\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\uFFFE\uFFFF])/g,(u,m)=>{let b=m.codePointAt(),T=b.toString(16);return b<=255?`\\x${`00${T}`.slice(-2)}`:`\\u${`0000${T}`.slice(-4)}`}).replace(/\//g,"\\/")}t(Lrt,"escapeControlCharacters");function FC(l){return l.includes("application/")&&l.includes("json")||grt.includes(l)||l.includes("text/")}t(FC,"isParamMediaTypeAllowed");function NW(l){return l>=200&&l<300}t(NW,"isMainResponseStatus");function vle(l){return!(l>=200&&l<300)}t(vle,"isErrorStatus");function ble(l){return l.startsWith("application/")}t(ble,"isMediaTypeAllowed");var Frt=/({\w+})/g,GVt=/[^\w\-]+/g;function jrt(l){l=u_(EW(l.replaceAll("/","-")).replaceAll("-",""));let u=[...l.matchAll(Frt)];if(u.length>0){let m=u.sort((b,T)=>b.index-T.index)[u.length-1][0];l=`${l.replace(Frt,"")}By${u_(m.slice(1,-1))}`}return l.replace(GVt,"_")}t(jrt,"pathToVariableName");var Mwe=/{(\b\w+(?:-\w+)*\b)}/g;function Brt(l){let u=l.match(Mwe);return u===null?l.replaceAll(Mwe,":$1"):(u.forEach(m=>{let b=jwe(m.replaceAll(Mwe,":$1"));l=l.replaceAll(m,b)}),l)}t(Brt,"replaceHyphenatedPath");var Sle=t(l=>{let u=l["x-enumNames"],m=Array.isArray(u)&&u.length>0,b=!!l.schema&&iy(l.schema)&&l.schema.type==="string";return m&&b},"isSortingParameterObject"),b8=t((l,u)=>u.excludePathRegex?new RegExp(u.excludePathRegex).test(l):!1,"isPathExcluded");function MC({schema:l,meta:u,options:m}){let b=[];Xy(l.type).with("string",()=>b.push(XVt(l))).with("number","integer",()=>b.push(KVt(l))).with("array",()=>b.push(eUt(l))).otherwise(()=>{}),typeof l.description=="string"&&l.description!==""&&m.withDescription&&([`
|
|
525
|
+
`);return I!==-1&&(u=CQe(u,T,b,I)),b+u+T},"applyStyle");Object.defineProperties(FU.prototype,vM);var WXt=FU(),HXt=FU({level:PQe?PQe.level:0});var EA=new tce;function OEe(l){console.log(l)}t(OEe,"log");function oS(l){console.log(`[INFO] ${l}`)}t(oS,"logInfo");function MU(l){console.log(EA.green(`[SUCCESS] ${l}`))}t(MU,"logSuccess");function HN(l,u){l instanceof Error?console.log(EA.red(`[ERROR] ${u||l.message}`)):console.log(EA.red(`[ERROR] ${l}`))}t(HN,"logError");function nce(l){console.log(EA.bgYellow(`==== ${l} ====`))}t(nce,"logBanner");var DQe=Vd(require("fs"));function bM(){return"1.2.8"}t(bM,"getVersion");var aYt=Vd(NQe());var FEe=Symbol("options_key");function Du(l){return(u,m)=>{var b,T;if(l!=null){let I={...Reflect.getMetadata(FEe,u)||{},[m]:{...l,describe:l.envAlias?`${l.describe||""} [${l.envAlias}]`:l.describe,type:l.type||((T=(b=Reflect.getMetadata("design:type",u,m))==null?void 0:b.name)==null?void 0:T.toLowerCase())}};Reflect.defineMetadata(FEe,I,u)}}}t(Du,"YargOption");function OQe(l){let u=Reflect.getMetadata(FEe,l.prototype);if(!u)throw new Error(`Options for ${l.name} were not defined`);return u}t(OQe,"getYargsOption");function ice(l){return async u=>u.options(z5t(l)).middleware(async m=>await V5t(l,m),!0)}t(ice,"getBuilder");function z5t(l){return Object.entries(OQe(l)).reduce((u,[m,b])=>(u[m]=Object.fromEntries(Object.entries(b).filter(([T])=>!["envAlias","default"].includes(T))),u),{})}t(z5t,"getYargsOptions");async function V5t(l,u){let m=new l;for(let[b,T]of Object.entries(OQe(l)))m[b]=u[b]??T.default;return m}t(V5t,"loadYargsConfig");var uit=Vd(kwe());var urt={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",300:"Ambiguous",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I Am a Teapot",421:"Misdirected Request",422:"Unprocessable Entity",424:"Failed Dependency",428:"Precondition Required",429:"Too Many Requests",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported"},frt={"invalid-schema":"Invalid OpenAPI Schemas","invalid-operation-id":"Invalid Operation IDs","missing-path-parameter":"Missing Path Parameters","not-allowed-inline-enum":"Not Allowed Inline Enums","not-allowed-circular-schema":"Not Allowed Circular Schemas","missing-acl-condition-property":"Missing x-acl Condition Properties","missing-status-code":"Missing HTTP Status Codes","invalid-status-code":"Invalid HTTP Status Codes","multiple-success-status-codes":"Multiple Success HTTP Status Codes"};var u_=t(l=>l.charAt(0).toUpperCase()+l.slice(1),"capitalize"),zA=t(l=>l.charAt(0).toLowerCase()+l.slice(1),"decapitalize"),EW=t(l=>l.replace(/(-\w)/g,u=>u[1].toUpperCase()),"kebabToCamel"),ny=t(l=>l.replace(/(_\w)/g,u=>u[1].toUpperCase()),"snakeToCamel"),_rt=t(l=>l.replace(/[\W_]+(\w)?/g,(u,m)=>(m==null?void 0:m.toUpperCase())??""),"nonWordCharactersToCamel"),Cwe=t((l,u="")=>l.endsWith(u)?l:`${l}${u}`,"suffixIfNeeded"),prt=t((l,u)=>l.replace(new RegExp(`${u}$`),""),"removeSuffix"),BVt=t(l=>{var b;let u=l.reduce((T,I)=>({...T,[I]:(T[I]??0)+1}),{});return(b=Object.entries(u).sort((T,I)=>T[1]===I[1]?I[0].length-T[0].length:I[1]-T[1])[0])==null?void 0:b[0]},"getLongestMostCommon"),Ewe=t(l=>{let u=l.map(u_).map(drt).map(m=>$Vt(m)).flat();return BVt(u)},"getMostCommonAdjacentCombinationSplit"),drt=t(l=>l.split(/(?<![A-Z])(?=[A-Z])/).filter(Boolean),"splitByUppercase"),ule=t(l=>drt(l).join(" "),"camelToSpaceSeparated"),$Vt=t((l,u=["dto","by","for","of","in","to","and","with"])=>{var b;let m=[];for(let T=0;T<l.length;T++)if(!u.includes(l[T].toLowerCase()))for(let I=T+1;I<=l.length;I++)u.includes((b=l[I-1])==null?void 0:b.toLowerCase())||m.push(l.slice(T,I).join(""));return m},"getAdjacentStringCombinations"),mrt=t((l,u)=>{let m=u.replace(/es$|s$/g,""),b=new RegExp(`(${zA(m)}|${u_(m)})[a-z]*(?=$|[A-Z])`,"g");return l.replace(b,"")},"removeWord");function m8(l){return _rt(l)}t(m8,"formatTag");function VA(l,u){var b;let m=(b=l.tags)==null?void 0:b[0];return m8(m??u.defaultTag)}t(VA,"getOperationTag");function Y1(l,u){var b;let m=u.splitByTags?(b=l.tags)==null?void 0:b[0]:u.defaultTag;return m8(m??u.defaultTag)}t(Y1,"getEndpointTag");function hrt(l,u){return u.excludeTags.some(m=>m.toLowerCase()===l.toLowerCase())}t(hrt,"isTagExcluded");var h8="application/json",Pwe={"Content-Type":h8,Accept:h8},fle="data",wwe="axios",UA="config",DC="AxiosRequestConfig",_le={defaultImport:wwe,bindings:[DC],from:"axios"};var r6=Vd(ple()),Awe=2,grt=["application/octet-stream","multipart/form-data","application/x-www-form-urlencoded","*/*"],yrt=["query","header","path"],g8=[r6.OpenAPIV3.HttpMethods.GET,r6.OpenAPIV3.HttpMethods.PUT,r6.OpenAPIV3.HttpMethods.POST,r6.OpenAPIV3.HttpMethods.DELETE,r6.OpenAPIV3.HttpMethods.OPTIONS,r6.OpenAPIV3.HttpMethods.HEAD,r6.OpenAPIV3.HttpMethods.PATCH,r6.OpenAPIV3.HttpMethods.TRACE],vrt=["string","number","integer","boolean"],PW=["allOf","anyOf","oneOf"];var brt="Schema",Srt="Enum",xrt="Body",Trt="Param",krt="Response",Crt="ErrorResponse",wW="z.void()",sR="z.any()",dle="z.instanceof(Blob)",AW="z.enum",Ert="z.int()",Prt="z.number()",mle="z.string()",wrt="z.email()",Art="z.url()",Drt="z.uuid()",Irt="z.iso.datetime({ offset: true })",HA={bindings:["z"],from:"zod"};var n6=Symbol.for("@ts-pattern/matcher"),zVt=Symbol.for("@ts-pattern/isVariadic"),gle="@ts-pattern/anonymous-select-key",Dwe=t(l=>!!(l&&typeof l=="object"),"r"),hle=t(l=>l&&!!l[n6],"i"),OC=t((l,u,m)=>{if(hle(l)){let b=l[n6](),{matched:T,selections:I}=b.match(u);return T&&I&&Object.keys(I).forEach(L=>m(L,I[L])),T}if(Dwe(l)){if(!Dwe(u))return!1;if(Array.isArray(l)){if(!Array.isArray(u))return!1;let b=[],T=[],I=[];for(let L of l.keys()){let Q=l[L];hle(Q)&&Q[zVt]?I.push(Q):I.length?T.push(Q):b.push(Q)}if(I.length){if(I.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(u.length<b.length+T.length)return!1;let L=u.slice(0,b.length),Q=T.length===0?[]:u.slice(-T.length),ae=u.slice(b.length,T.length===0?1/0:-T.length);return b.every((ee,pe)=>OC(ee,L[pe],m))&&T.every((ee,pe)=>OC(ee,Q[pe],m))&&(I.length===0||OC(I[0],ae,m))}return l.length===u.length&&l.every((L,Q)=>OC(L,u[Q],m))}return Reflect.ownKeys(l).every(b=>{let T=l[b];return(b in u||hle(I=T)&&I[n6]().matcherType==="optional")&&OC(T,u[b],m);var I})}return Object.is(u,l)},"s"),YA=t(l=>{var u,m,b;return Dwe(l)?hle(l)?(u=(m=(b=l[n6]()).getSelectionKeys)==null?void 0:m.call(b))!=null?u:[]:Array.isArray(l)?IW(l,YA):IW(Object.values(l),YA):[]},"o"),IW=t((l,u)=>l.reduce((m,b)=>m.concat(u(b)),[]),"c");function pS(l){return Object.assign(l,{optional:t(()=>VVt(l),"optional"),and:t(u=>Zp(l,u),"and"),or:t(u=>UVt(l,u),"or"),select:t(u=>u===void 0?Nrt(l):Nrt(u,l),"select")})}t(pS,"u");function VVt(l){return pS({[n6]:()=>({match:t(u=>{let m={},b=t((T,I)=>{m[T]=I},"r");return u===void 0?(YA(l).forEach(T=>b(T,void 0)),{matched:!0,selections:m}):{matched:OC(l,u,b),selections:m}},"match"),getSelectionKeys:t(()=>YA(l),"getSelectionKeys"),matcherType:"optional"})})}t(VVt,"h");function Zp(...l){return pS({[n6]:()=>({match:t(u=>{let m={},b=t((T,I)=>{m[T]=I},"r");return{matched:l.every(T=>OC(T,u,b)),selections:m}},"match"),getSelectionKeys:t(()=>IW(l,YA),"getSelectionKeys"),matcherType:"and"})})}t(Zp,"m");function UVt(...l){return pS({[n6]:()=>({match:t(u=>{let m={},b=t((T,I)=>{m[T]=I},"r");return IW(l,YA).forEach(T=>b(T,void 0)),{matched:l.some(T=>OC(T,u,b)),selections:m}},"match"),getSelectionKeys:t(()=>IW(l,YA),"getSelectionKeys"),matcherType:"or"})})}t(UVt,"d");function Df(l){return{[n6]:()=>({match:t(u=>({matched:!!l(u)}),"match")})}}t(Df,"p");function Nrt(...l){let u=typeof l[0]=="string"?l[0]:void 0,m=l.length===2?l[1]:typeof l[0]=="string"?void 0:l[0];return pS({[n6]:()=>({match:t(b=>{let T={[u??gle]:b};return{matched:m===void 0||OC(m,b,(I,L)=>{T[I]=L}),selections:T}},"match"),getSelectionKeys:t(()=>[u??gle].concat(m===void 0?[]:YA(m)),"getSelectionKeys")})})}t(Nrt,"y");function IC(l){return typeof l=="number"}t(IC,"v");function GA(l){return typeof l=="string"}t(GA,"b");function QA(l){return typeof l=="bigint"}t(QA,"w");var Pnr=pS(Df(function(l){return!0}));var ZA=t(l=>Object.assign(pS(l),{startsWith:t(u=>{return ZA(Zp(l,(m=u,Df(b=>GA(b)&&b.startsWith(m)))));var m},"startsWith"),endsWith:t(u=>{return ZA(Zp(l,(m=u,Df(b=>GA(b)&&b.endsWith(m)))));var m},"endsWith"),minLength:t(u=>ZA(Zp(l,(m=>Df(b=>GA(b)&&b.length>=m))(u))),"minLength"),length:t(u=>ZA(Zp(l,(m=>Df(b=>GA(b)&&b.length===m))(u))),"length"),maxLength:t(u=>ZA(Zp(l,(m=>Df(b=>GA(b)&&b.length<=m))(u))),"maxLength"),includes:t(u=>{return ZA(Zp(l,(m=u,Df(b=>GA(b)&&b.includes(m)))));var m},"includes"),regex:t(u=>{return ZA(Zp(l,(m=u,Df(b=>GA(b)&&!!b.match(m)))));var m},"regex")}),"j"),wnr=ZA(Df(GA)),NC=t(l=>Object.assign(pS(l),{between:t((u,m)=>NC(Zp(l,((b,T)=>Df(I=>IC(I)&&b<=I&&T>=I))(u,m))),"between"),lt:t(u=>NC(Zp(l,(m=>Df(b=>IC(b)&&b<m))(u))),"lt"),gt:t(u=>NC(Zp(l,(m=>Df(b=>IC(b)&&b>m))(u))),"gt"),lte:t(u=>NC(Zp(l,(m=>Df(b=>IC(b)&&b<=m))(u))),"lte"),gte:t(u=>NC(Zp(l,(m=>Df(b=>IC(b)&&b>=m))(u))),"gte"),int:t(()=>NC(Zp(l,Df(u=>IC(u)&&Number.isInteger(u)))),"int"),finite:t(()=>NC(Zp(l,Df(u=>IC(u)&&Number.isFinite(u)))),"finite"),positive:t(()=>NC(Zp(l,Df(u=>IC(u)&&u>0))),"positive"),negative:t(()=>NC(Zp(l,Df(u=>IC(u)&&u<0))),"negative")}),"x"),Anr=NC(Df(IC)),XA=t(l=>Object.assign(pS(l),{between:t((u,m)=>XA(Zp(l,((b,T)=>Df(I=>QA(I)&&b<=I&&T>=I))(u,m))),"between"),lt:t(u=>XA(Zp(l,(m=>Df(b=>QA(b)&&b<m))(u))),"lt"),gt:t(u=>XA(Zp(l,(m=>Df(b=>QA(b)&&b>m))(u))),"gt"),lte:t(u=>XA(Zp(l,(m=>Df(b=>QA(b)&&b<=m))(u))),"lte"),gte:t(u=>XA(Zp(l,(m=>Df(b=>QA(b)&&b>=m))(u))),"gte"),positive:t(()=>XA(Zp(l,Df(u=>QA(u)&&u>0))),"positive"),negative:t(()=>XA(Zp(l,Df(u=>QA(u)&&u<0))),"negative")}),"A"),Dnr=XA(Df(QA)),Inr=pS(Df(function(l){return typeof l=="boolean"})),Nnr=pS(Df(function(l){return typeof l=="symbol"})),Onr=pS(Df(function(l){return l==null})),Fnr=pS(Df(function(l){return l!=null}));var Fwe=class Fwe extends Error{constructor(u){let m;try{m=JSON.stringify(u)}catch{m=u}super(`Pattern matching error: no pattern matches value ${m}`),this.input=void 0,this.input=u}};t(Fwe,"W");var Iwe=Fwe,Nwe={matched:!1,value:void 0};function Xy(l){return new Owe(l,Nwe)}t(Xy,"z");var DW=class DW{constructor(u,m){this.input=void 0,this.state=void 0,this.input=u,this.state=m}with(...u){if(this.state.matched)return this;let m=u[u.length-1],b=[u[0]],T;u.length===3&&typeof u[1]=="function"?T=u[1]:u.length>2&&b.push(...u.slice(1,u.length-1));let I=!1,L={},Q=t((ee,pe)=>{I=!0,L[ee]=pe},"a"),ae=!b.some(ee=>OC(ee,this.input,Q))||T&&!T(this.input)?Nwe:{matched:!0,value:m(I?gle in L?L[gle]:L:this.input,this.input)};return new DW(this.input,ae)}when(u,m){if(this.state.matched)return this;let b=!!u(this.input);return new DW(this.input,b?{matched:!0,value:m(this.input,this.input)}:Nwe)}otherwise(u){return this.state.matched?this.state.value:u(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new Iwe(this.input)}run(){return this.exhaustive()}returnType(){return this}};t(DW,"I");var Owe=DW;function gf(l){return l!=null&&Object.prototype.hasOwnProperty.call(l,"$ref")}t(gf,"isReferenceObject");function iy(l){return!gf(l)}t(iy,"isSchemaObject");function yle(l){return l.type==="array"}t(yle,"isArraySchemaObject");function Ort(l){if(!l.allOf)throw new Error("Function inferRequiredSchema is specialized to handle item with required only in an allOf array.");let[u,m]=l.allOf.reduce((T,I)=>{if(WVt(I)){let L=I.required;T[0].push(...L??[])}else T[1].push(I);return T},[[],[]]),b={properties:u.reduce((T,I)=>(T[I]={},T),{}),type:"object",required:u};return{noRequiredOnlyAllof:m,composedRequiredSchema:b,patchRequiredSchemaInLoop:t((T,I)=>{if(gf(T)){let L=I(T.$ref);L&&b.required.forEach(Q=>{var ae;b.properties[Q]=((ae=L==null?void 0:L.properties)==null?void 0:ae[Q])??{}})}else{let L=T.properties??{};b.required.forEach(Q=>{L[Q]&&(b.properties[Q]=L[Q]??{})})}},"patchRequiredSchemaInLoop")}}t(Ort,"inferRequiredSchema");var WVt=t(l=>!gf(l)&&!!l.required&&!l.type&&!l.properties&&!(l!=null&&l.allOf)&&!(l!=null&&l.anyOf)&&!l.oneOf,"isBrokenAllOfItem");var Mrt=t(l=>`#/components/schemas/${l}`,"getSchemaRef"),y8=t(l=>l[1]==="/"?l:"#/"+l.slice(1),"autocorrectRef"),aR=t(l=>y8(l).split("/").at(-1),"getSchemaNameByRef");function Rwe(l){let u=HVt(l).normalize("NFKD").trim().replace(/\s+/g,"_").replace(/--+/g,"-").replace(/-+/g,"_").replace(/[^\w-]+/g,"_");return ny(u)}t(Rwe,"normalizeString");function Lwe(l){return/^[a-zA-Z]\w*$/.test(l)?l:`"${l}"`}t(Lwe,"wrapWithQuotesIfNeeded");function Rrt(l){return typeof l=="string"&&l.startsWith('"')&&l.endsWith('"')?l.slice(1,-1):l}t(Rrt,"unwrapQuotesIfNeeded");function HVt(l){let u=Number(l[0]);return typeof u=="number"&&!Number.isNaN(u)?"_"+l:l}t(HVt,"prefixStringStartingWithNumberIfNeeded");function jwe(l){let u=l.replaceAll("_","#");return ny(u.replaceAll("-","_")).replaceAll("#","_")}t(jwe,"pathParamToVariableName");var v8=t(l=>vrt.includes(l),"isPrimitiveType");function Lrt(l){return l.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/([\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\uFFFE\uFFFF])/g,(u,m)=>{let b=m.codePointAt(),T=b.toString(16);return b<=255?`\\x${`00${T}`.slice(-2)}`:`\\u${`0000${T}`.slice(-4)}`}).replace(/\//g,"\\/")}t(Lrt,"escapeControlCharacters");function FC(l){return l.includes("application/")&&l.includes("json")||grt.includes(l)||l.includes("text/")}t(FC,"isParamMediaTypeAllowed");function NW(l){return l>=200&&l<300}t(NW,"isMainResponseStatus");function vle(l){return!(l>=200&&l<300)}t(vle,"isErrorStatus");function ble(l){return l.startsWith("application/")}t(ble,"isMediaTypeAllowed");var Frt=/({\w+})/g,GVt=/[^\w\-]+/g;function jrt(l){l=u_(EW(l.replaceAll("/","-")).replaceAll("-",""));let u=[...l.matchAll(Frt)];if(u.length>0){let m=u.sort((b,T)=>b.index-T.index)[u.length-1][0];l=`${l.replace(Frt,"")}By${u_(m.slice(1,-1))}`}return l.replace(GVt,"_")}t(jrt,"pathToVariableName");var Mwe=/{(\b\w+(?:-\w+)*\b)}/g;function Brt(l){let u=l.match(Mwe);return u===null?l.replaceAll(Mwe,":$1"):(u.forEach(m=>{let b=jwe(m.replaceAll(Mwe,":$1"));l=l.replaceAll(m,b)}),l)}t(Brt,"replaceHyphenatedPath");var Sle=t(l=>{let u=l["x-enumNames"],m=Array.isArray(u)&&u.length>0,b=!!l.schema&&iy(l.schema)&&l.schema.type==="string";return m&&b},"isSortingParameterObject"),b8=t((l,u)=>u.excludePathRegex?new RegExp(u.excludePathRegex).test(l):!1,"isPathExcluded");function MC({schema:l,meta:u,options:m}){let b=[];Xy(l.type).with("string",()=>b.push(XVt(l))).with("number","integer",()=>b.push(KVt(l))).with("array",()=>b.push(eUt(l))).otherwise(()=>{}),typeof l.description=="string"&&l.description!==""&&m.withDescription&&([`
|
|
526
526
|
`,"\r",`\r
|
|
527
527
|
`].some(I=>String.prototype.includes.call(l.description,I))?b.push(`describe(\`${l.description}\`)`):b.push(`describe("${l.description}")`));let T=b.concat(QVt({schema:l,meta:u,options:m}),m.withDefaultValues!==!1?ZVt(l):[]).filter(Boolean).join(".");return T?`.${T}`:""}t(MC,"getZodChain");function QVt({schema:l,meta:u,options:m}){return l.nullable&&!(u!=null&&u.isRequired)?"nullish()":l.nullable||m.replaceOptionalWithNullish&&(u!=null&&u.isParentPartial)?"nullable()":u!=null&&u.isRequired?"":m.replaceOptionalWithNullish?"nullish()":"optional()"}t(QVt,"getZodChainablePresence");function ZVt(l){return l.default!==void 0?`default(${Xy(l.type).with("number","integer",()=>Rrt(l.default)).otherwise(()=>JSON.stringify(l.default))})`:""}t(ZVt,"getZodChainableDefault");function XVt(l){let u=[];return l.enum||(l.minLength!==void 0&&u.push(`min(${l.minLength})`),l.maxLength!==void 0&&u.push(`max(${l.maxLength})`)),l.pattern&&u.push(`regex(${YVt(l.pattern)})`),u.join(".")}t(XVt,"getZodChainableStringValidations");function YVt(l){return l.startsWith("/")&&l.endsWith("/")&&(l=l.slice(1,-1)),l=Lrt(l),`/${l}/`}t(YVt,"formatPatternIfNeeded");function KVt(l){let u=[];return l.enum?"":(l.minimum!==void 0?l.exclusiveMinimum===!0?u.push(`gt(${l.minimum})`):u.push(`gte(${l.minimum})`):typeof l.exclusiveMinimum=="number"&&u.push(`gt(${l.exclusiveMinimum})`),l.maximum!==void 0?l.exclusiveMaximum===!0?u.push(`lt(${l.maximum})`):u.push(`lte(${l.maximum})`):typeof l.exclusiveMaximum=="number"&&u.push(`lt(${l.exclusiveMaximum})`),l.multipleOf&&u.push(`multipleOf(${l.multipleOf})`),u.join("."))}t(KVt,"getZodChainableNumberValidations");function eUt(l){let u=[];return l.minItems&&u.push(`min(${l.minItems})`),l.maxItems&&u.push(`max(${l.maxItems})`),u.join(".")}t(eUt,"getZodChainableArrayValidations");var C_=t(({type:l,tag:u,options:m})=>`${u_(u)}${m.configs[l].namespaceSuffix}`,"getNamespaceName");var S8=t(l=>l.reduce((u,m)=>u+m,0),"sum");function hg(l,u){if(!u)return l;if(gf(u))return l+2;if(Array.isArray(u.type))return u.type.length===1?Db("oneOf")+hg(l,{...u,type:u.type[0]}):l+Db("oneOf")+S8(u.type.map(m=>hg(0,{...u,type:m})));if(u.oneOf)return u.oneOf.length===1?Db("oneOf")+hg(l,u.oneOf[0]):l+Db("oneOf")+S8(u.oneOf.map(m=>hg(0,m)));if(u.anyOf)return u.anyOf.length===1?Db("anyOf")+hg(l,u.anyOf[0]):l+Db("anyOf")+S8(u.anyOf.map(m=>hg(0,m)));if(u.allOf)return u.allOf.length===1?Db("allOf")+hg(l,u.allOf[0]):l+Db("allOf")+S8(u.allOf.map(m=>hg(0,m)));if(!u.type)return l;if(v8(u.type))return u.enum?l+$rt(u)+Db("enum")+S8(u.enum.map(m=>hg(0,m))):l+$rt(u);if(u.type==="array")return u.items?Db("array")+hg(l,u.items):Db("array")+hg(l);if(u.type==="object"||u.properties||u.additionalProperties){if(u.properties){let m=Object.values(u.properties);l+=Db("object")+S8(m.map(b=>hg(0,b)))}else l+=Db("empty-object");u.additionalProperties&&(typeof u.additionalProperties=="object"?l+=hg(0,u.additionalProperties):l+=hg(1))}return l}t(hg,"getOpenAPISchemaComplexity");function $rt(l){return Xy(l.type).with("string","number","integer","boolean",()=>1).otherwise(()=>0)}t($rt,"complexityByType");function Db(l){return Xy(l).with("oneOf",()=>2).with("anyOf",()=>3).with("allOf",()=>2).with("enum","array","empty-object",()=>1).with("object",()=>2).otherwise(()=>0)}t(Db,"complexityByComposite");var $we=class $we{constructor(u,m,b={referencedBy:[]},T){this.schema=u;this.resolver=m;gf(u)&&(this.ref=u.$ref),T&&(this.enumRef=T),this.meta={...b,referencedBy:[...(b==null?void 0:b.referencedBy)??[]]},this.ref&&this.meta.referencedBy.push(this)}code;ref;enumRef;children=[];meta;getCodeString(u,m){var I,L;if(!this.ref&&this.code)return this.code;if(!this.ref)throw new Error("Zod schema is missing both ref and code");let b=(I=this.resolver)==null?void 0:I.getZodSchemaNameByRef(this.ref);if(!b)return this.ref;let T=(L=this.resolver)==null?void 0:L.getTagByZodSchemaName(b);return m!=null&&m.tsNamespaces&&T&&T!==u?`${C_({type:"models",tag:T,options:m})}.${b}`:b}get complexity(){return hg(0,this.schema)}assign(u){return this.code=u,this}inherit(u){return u&&u.children.push(this),this}};t($we,"ZodSchema");var OW=$we;function Bwe(l){var u,m;if(l)return(u=l.parent)!=null&&u.ref?l.parent.ref:Bwe((m=l.parent)==null?void 0:m.meta)}t(Bwe,"getParentRef");function Jrt(l,u){let m=l.getRefByZodSchemaName(u);if(m){let T=Array.from(l.dependencyGraph.refsDependencyGraph[m]??[]).map(L=>l.getZodSchemaNameByRef(L)),I=l.getExtractedEnumZodSchemaNamesReferencedBySchemaRef(m);return[...T,...I]}let b=l.getCompositeZodSchemaByZodSchemaName(u);return b?Array.from(xle(b)).map(T=>l.getZodSchemaNameByRef(T)):[]}t(Jrt,"getZodSchemaRefs");function xle(l,{skipObjectSchema:u=!1}={}){return l.children.reduce((b,T)=>{let I=T.ref??T.enumRef;return I&&b.add(I),T.children.length>0&&(!u||!iy(T.schema)||T.schema.type!=="object")&&xle(T).forEach(L=>b.add(L)),b},new Set)}t(xle,"getSchemaRefs");function Hd({schema:l,resolver:u,meta:m,tag:b}){var rr;let T=new OW(l,u,m),I={parent:T.inherit(m==null?void 0:m.parent),referencedBy:[...T.meta.referencedBy]},L={resolver:u,meta:I,tag:b};if(gf(l))return tUt({schema:l,zodSchema:T,resolver:u,meta:I,tag:b});let Q=nUt({schema:l,zodSchema:T,resolver:u,meta:I,tag:b});if(Q)return Q;let ae=rUt({schema:l,zodSchema:T,resolver:u,meta:I,tag:b});if(ae)return ae;let ee=iUt({schema:l,zodSchema:T,resolver:u,meta:I,tag:b});if(ee)return ee;let pe=sUt({schema:l,zodSchema:T,resolver:u,meta:I,tag:b});if(pe)return pe;let Te=aUt({schema:l,zodSchema:T,resolver:u,meta:I,tag:b});if(Te)return Te;let Ke=u.options.allReadonly?".readonly()":"";if(yle(l))return l.items?T.assign(`z.array(${Hd({...L,schema:l.items}).getCodeString(b,u.options)}${MC({schema:l.items,meta:{...I,isRequired:!0},options:u.options})})${Ke}`):T.assign(`z.array(${sR})${Ke}`);let Pt=l.type?l.type.toLowerCase():void 0;if(Pt==="object"||l.properties||l.additionalProperties){let or=l.required&&l.required.length>0,Lt=u.options.withImplicitRequiredProps?!1:l.properties&&!((rr=l.required)!=null&&rr.length),Xt="{}";l.properties&&(Xt=`{ ${Object.entries(l.properties).map(([vo,Vn])=>{var Ht;let ql={...I,isRequired:Lt?!0:or?(Ht=l.required)==null?void 0:Ht.includes(vo):u.options.withImplicitRequiredProps,name:vo,isParentPartial:Lt},zl=Vn;if(gf(Vn)&&u&&(zl=u.getSchemaByRef(Vn.$ref),!zl))throw new Error(`Schema ${Vn.$ref} not found`);let ia=Hd({...L,schema:Vn,meta:ql}),lr=ia.getCodeString(b,u.options)+MC({schema:zl,meta:ql,options:u.options}),xs=!1,Fs=Bwe(m);return Fs&&(xs=[...gf(Vn)?[Vn.$ref]:[],...xle(ia,{skipObjectSchema:!0})].some(wa=>{var Eo;return(Eo=u.dependencyGraph.deepDependencyGraph[wa])==null?void 0:Eo.has(Fs)})),[vo,lr,xs]}).map(([vo,Vn,ql])=>ql?`get ${Lwe(vo)}() { return ${Vn} }`:`${Lwe(vo)}: ${Vn}`).join(", ")} }`);let Vt="";l.additionalProperties&&(Vt=`.catchall(${typeof l.additionalProperties=="object"&&Object.keys(l.additionalProperties).length>0?Hd({...L,schema:l.additionalProperties}).getCodeString(b,u.options)+MC({schema:l.additionalProperties,meta:{...I,isRequired:!0},options:u.options}):sR})`);let zn=`z.object(${Xt})${Lt?".partial()":""}${Vt}${Ke}`;return T.assign(zn)}if(Pt==="any")return T.assign(sR);if(!Pt)return T.assign("z.unknown()");throw new Error(`Unsupported schema type: ${Pt}`)}t(Hd,"getZodSchema");function tUt({schema:l,zodSchema:u,resolver:m,meta:b,tag:T}){if(!gf(l))return;let I=u.meta.referencedBy.slice(0,-1).map(ae=>ae.ref?m.getZodSchemaNameByRef(ae.ref)??ae.ref:void 0).filter(Boolean),L=m.getZodSchemaNameByRef(l.$ref);if(I.length>1&&I.includes(L))return u.assign(m.getCodeByZodSchemaName(u.ref));let Q=m.getCodeByZodSchemaName(l.$ref);if(!Q){let ae=m.getSchemaByRef(l.$ref);if(!ae)throw new Error(`Schema ${l.$ref} not found`);Q=Hd({schema:ae,resolver:m,meta:b,tag:T}).getCodeString(T,m.options)}return m.getCodeByZodSchemaName(L)||m.setZodSchema(L,Q,T),u}t(tUt,"getReferenceZodSchema");function rUt({schema:l,zodSchema:u,resolver:m,meta:b,tag:T}){var L;if(!iy(l)||!l.oneOf)return;if(l.oneOf.length===1){let Q=Hd({schema:l.oneOf[0],resolver:m,meta:b,tag:T});return u.assign(Q.getCodeString(T,m.options))}let I=(L=l.oneOf)==null?void 0:L.some(Q=>iy(Q)&&((Q==null?void 0:Q.allOf)||[]).length>1);if(l.discriminator&&!I){let Q=l.discriminator.propertyName;return u.assign(`
|
|
528
528
|
z.discriminatedUnion("${Q}", [${l.oneOf.map(ae=>Hd({schema:ae,resolver:m,meta:b,tag:T}).getCodeString(T,m.options)).join(", ")}])
|
|
529
|
-
`)}return u.assign(`z.union([${l.oneOf.map(Q=>Hd({schema:Q,resolver:m,meta:b,tag:T}).getCodeString(T,m.options)).join(", ")}])`)}t(rUt,"getOneOfZodSchema");function nUt({schema:l,zodSchema:u,resolver:m,meta:b,tag:T}){if(!(!iy(l)||!Array.isArray(l.type)))return l.type.length===1?Hd({schema:{...l,type:l.type[0]},resolver:m,meta:b,tag:T}):u.assign(`z.union([${l.type.map(I=>Hd({schema:{...l,type:I},resolver:m,meta:b,tag:T}).getCodeString(T,m.options)).join(", ")}])`)}t(nUt,"getArrayZodSchema");function iUt({schema:l,zodSchema:u,resolver:m,meta:b,tag:T}){if(!iy(l)||!l.anyOf)return;if(l.anyOf.length===1){let L=Hd({schema:l.anyOf[0],resolver:m,meta:b,tag:T});return u.assign(L.getCodeString(T,m.options))}let I=l.anyOf.map(L=>Hd({schema:L,resolver:m,meta:b,tag:T})).map(L=>L.getCodeString(T,m.options)).join(", ");return u.assign(`z.union([${I}])`)}t(iUt,"getAnyOfZodSchema");function sUt({schema:l,zodSchema:u,resolver:m,meta:b,tag:T}){if(!iy(l)||!l.allOf)return;if(l.allOf.length===1){let Te=Hd({schema:l.allOf[0],resolver:m,meta:b,tag:T});return u.assign(Te.getCodeString(T,m.options))}let{patchRequiredSchemaInLoop:I,noRequiredOnlyAllof:L,composedRequiredSchema:Q}=Ort(l),ae=L.map(Te=>{let Ke=Hd({schema:Te,resolver:m,meta:b,tag:T});return m&&I(Te,m.getSchemaByRef.bind(m)),Ke});Q.required.length&&ae.push(Hd({schema:Q,resolver:m,meta:b,tag:T}));let ee=ae.at(0),pe=ae.slice(1).map(Te=>`merge(${Te.getCodeString(T,m.options)})`).join(".");return u.assign(`${ee.getCodeString(T,m.options)}.${pe}`)}t(sUt,"getAllOfZodSchema");function aUt({schema:l,zodSchema:u,resolver:m,meta:b,tag:T}){if(!iy(l))return;let I=l.type?l.type.toLowerCase():void 0;if(I&&v8(I)){if(l.enum){if(I==="string")return oUt({schema:l,zodSchema:u,resolver:m,meta:b,tag:T});if(l.enum.some(L=>typeof L=="string"))return u.assign("z.never()");if(l.enum.length===1){let L=l.enum[0];return u.assign(`z.literal(${L===null?"null":L})`)}return u.assign(`z.union([${l.enum.map(L=>`z.literal(${L===null?"null":L})`).join(", ")}])`)}return u.assign(Xy(I).with("integer",()=>Xy(l.type).with("integer",()=>Ert).otherwise(()=>Prt)).with("string",()=>Xy(l.format).with("binary",()=>dle).with("email",()=>wrt).with("hostname","uri",()=>Art).with("uuid",()=>Drt).with("date-time",()=>Irt).otherwise(()=>mle)).otherwise(L=>`z.${L}()`))}}t(aUt,"getPrimitiveZodSchema");function oUt({resolver:l,schema:u,zodSchema:m,meta:b,tag:T}){var ee;if(!iy(u))return;let I=oR(u);if(!l.options.extractEnums)return m.assign(I);let L=l.getEnumZodSchemaDataByCode(I);if(L)return((ee=m.meta.parent)==null?void 0:ee.ref)===l.getRefByZodSchemaName(L.zodSchemaName)?m.assign(L.code):new OW({$ref:l.getRefByZodSchemaName(L.zodSchemaName)},l,b).inherit(m).assign(I);let Q=l.getExtractedEnumZodSchemaDataByCode(I);if(!Q)return m.assign(I);if(!Q.zodSchemaName||!Q.tag)throw new Error(`Enum zod schema name or tag not resolved for code: ${I}`);let ae=l.options.tsNamespaces&&Q.tag!==T?`${C_({type:"models",tag:Q.tag,options:l.options})}.`:"";return m.assign(`${ae}${Q.zodSchemaName}`)}t(oUt,"getEnumZodSchema");function oR(l){var u;return`${AW}([${(u=l.enum)==null?void 0:u.map(m=>m===null?"null":`"${m}"`).join(", ")}])`}t(oR,"getEnumZodSchemaCode");function qrt(l){return`${AW}([${l.map(u=>`"${u}"`).join(", ")}])`}t(qrt,"getEnumZodSchemaCodeFromEnumNames");var FW="AppRestClient",Tle={query:"AppQueryOptions",infiniteQuery:"AppInfiniteQueryOptions",mutation:"AppMutationOptions"},Jwe="src/data",KA={ErrorHandler:"ErrorHandler",SharedErrorHandler:"SharedErrorHandler"},kle={bindings:[KA.ErrorHandler,KA.SharedErrorHandler]},qwe="AbilityContext",zrt={bindings:[qwe]},MW={dynamicInputs:"dynamicInputs",dynamicColumns:"dynamicColumns"};var Cle={reactQueryTypes:{fileName:"react-query.types",extension:"ts"},restClient:{fileName:"rest-client",extension:"ts"},restInterceptor:{fileName:"rest-interceptor",extension:"ts"}},Ele={fileName:"app-rest-client",extension:"ts"},zwe="QueryModule",Ple={fileName:"queryModules",extension:"ts"},Vrt={fileName:"queryConfig.context",extension:"tsx"},cR={optionsType:"MutationEffectsOptions",hookName:"useMutationEffects",runFunctionName:"runMutationEffects"},wle={fileName:"useMutationEffects",extension:"ts"},dS={namespace:"ZodExtended",exports:{parse:"parse",sortExp:"sortExp"}},Ale={fileName:"zod.extended",extension:"ts"};var x8=t((l,u)=>Cwe(u_(Rwe(l)),u),"getZodSchemaName"),RW=t((l,u,m)=>Cwe(u_(Rwe(l)),`${u}${m}`),"getEnumZodSchemaName"),wh=t(l=>["z.",`${dS.namespace}.`].every(u=>!l.startsWith(u)),"isNamedZodSchema"),Urt=t(l=>l.startsWith(AW),"isEnumZodSchema"),T8=t((l,u,m)=>u?l:`${m}_${l}`,"getZodSchemaOperationName"),Dle=t(l=>ny(`${l}_${xrt}`),"getBodyZodSchemaName"),Wrt=t((l,u)=>ny(`${l}_${u}${Trt}`),"getParamZodSchemaName"),cUt=t(l=>ny(`${l}${krt}`),"getMainResponseZodSchemaName"),lUt=t((l,u)=>ny(`${l}_${u}_${Crt}`),"getErrorResponseZodSchemaName");function Ile({statusCode:l,operationName:u,isUniqueOperationName:m,tag:b}){let T=Number(l),I=T8(u,m,b);return!NW(T)&&l!=="default"&&vle(T)?lUt(I,l):cUt(I)}t(Ile,"getResponseZodSchemaName");function lR({schema:l,zodSchema:u,fallbackName:m,resolver:b,tag:T}){var Q;let I=u.getCodeString();if((!wh(I)||u.ref===void 0)&&m){if(u.complexity<Awe)return I;let ae=x8(m,b.options.schemaSuffix);for(;b.getCodeByZodSchemaName(ae);){if((Q=b.getZodSchemaNamesByCompositeCode(I))!=null&&Q.includes(ae))return ae;if(b.getCodeByZodSchemaName(ae)===ae)return ae;throw new Error(`Can't uniquely resolve zod schema name: ${ae}`)}return b.setZodSchema(ae,I,T),b.addZodSchemaForCompositeCode(I,u,ae,l),ae}let L=b.getCodeByZodSchemaName(I);if(!L&&u.ref&&(L=b.getCodeByZodSchemaName(b.getZodSchemaNameByRef(u.ref))),u.ref&&L)return hg(0,b.getSchemaByRef(u.ref))<Awe?b.getCodeByZodSchemaName(I):I;if(u.ref)return b.getZodSchemaNameByRef(u.ref);throw new Error(`Invalid ref: ${u.ref}`)}t(lR,"resolveZodSchemaName");var Hrt=t(l=>/^(?:[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+)$/.test(l),"isValidPropertyName"),e3=t(l=>l.replace(/^[^a-zA-Z_$]*/g,"").replace(/[^a-zA-Z0-9_$]+(\w)?/g,(u,m)=>(m==null?void 0:m.toUpperCase())??""),"invalidVariableNameCharactersToCamel");function k8(l,u){let m={};return Object.keys(l).forEach(b=>{u.includes(b)&&(m[b]=l[b])}),m}t(k8,"pick");function Grt(l,...u){if(u.length===0)return l;let m=l;for(let b of u)m=Qrt(m,b);return m}t(Grt,"deepMerge");function Qrt(l,u){if(u==null)return l;if(l==null)return uR(u);if(Array.isArray(l)&&Array.isArray(u))return[...l,...u];if(LW(l)&&LW(u)){let m={};for(let[b,T]of Object.entries(l))m[b]=uR(T);for(let[b,T]of Object.entries(u)){let I=m[b];T!==void 0&&(T===null?m[b]=T:LW(I)&&LW(T)?m[b]=Qrt(I,T):Array.isArray(I)&&Array.isArray(T)?m[b]=[...I,...T]:m[b]=uR(T))}return m}return uR(u)}t(Qrt,"mergeTwoValues");function uR(l){if(l==null||typeof l!="object")return l;if(Array.isArray(l))return l.map(u=>uR(u));if(LW(l)){let u={};for(let[m,b]of Object.entries(l))u[m]=uR(b);return u}return l}t(uR,"deepClone");function LW(l){return l!==null&&typeof l=="object"&&!Array.isArray(l)&&Object.prototype.toString.call(l)==="[object Object]"}t(LW,"isPlainObject");var Vwe=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with"];function fR(l,u){let m=l.deprecated&&!u.withDeprecatedEndpoints,b=VA(l,u),T=hrt(b,u);return m||T}t(fR,"isOperationExcluded");function Uwe({path:l,method:u,operation:m,options:b,tag:T,keepOperationTag:I,keepOperationPrefix:L}){let Q=`${u}${jrt(l)}`,ae=m.operationId?e3(m.operationId):Q;if(b.removeOperationPrefixEndingWith&&L)ae=ae.split(b.removeOperationPrefixEndingWith).map((pe,Te)=>Te===0?pe:u_(pe)).join("");else if(b.removeOperationPrefixEndingWith&&!L){let ee=new RegExp(`^.*${b.removeOperationPrefixEndingWith}`);ae=ae.replace(ee,"")}if(b.tsNamespaces&&!I){let ee=mrt(ae,T);ee===""?ae=u.toLowerCase():Vwe.includes(ee)||(ae=ee)}return Vwe.includes(ae)?Q:ae}t(Uwe,"getOperationName");function jW({operationsByTag:l,...u}){let{operation:m,options:b}=u,T=b.splitByTags?VA(m,b):b.defaultTag,I=t(L=>{let Q=Uwe({...u,tag:T,keepOperationTag:L});if(l[T].filter(ee=>Uwe({...u,operation:ee,tag:T,keepOperationTag:L})===Q).length===1)return Q},"operationName");return I()??I(!0)??Uwe({...u,tag:T,keepOperationTag:!0,keepOperationPrefix:!0})}t(jW,"getUniqueOperationName");function Zrt(l,u,m){let b=[];for(let T in l.paths){if(b8(T,m))continue;let I=l.paths[T],L=k8(I,g8);for(let Q in L){let ae=L[Q];if(!ae||fR(ae,m))continue;let ee=jW({path:T,method:Q,operation:ae,operationsByTag:u,options:m});b.push(ee)}}return b}t(Zrt,"getUniqueOperationNamesWithoutSplitByTags");function Xrt(l,u){let m={};for(let b in l.paths){if(b8(b,u))continue;let T=l.paths[b],I=k8(T,g8);for(let L in I){let Q=I[L];if(!Q||fR(Q,u))continue;let ae=u.splitByTags?VA(Q,u):u.defaultTag;m[ae]||(m[ae]=[]),m[ae].push(Q)}}return m}t(Xrt,"getOperationsByTag");function BW(l){return{type:"invalid-schema",message:l}}t(BW,"getInvalidSchemaError");function Yrt(l){return{type:"invalid-operation-id",message:`Operation ${l}`}}t(Yrt,"getInvalidOperationIdError");function Krt(l,u){return{type:"missing-path-parameter",message:`Path ${u} is missing [${l.map(({name:m})=>m).join(", ")}]`}}t(Krt,"getMissingPathParameterError");function ent(l){return{type:"not-allowed-inline-enum",message:`${l} is missing @IsEnum() and @ApiProperty(enum:, enumName:)`}}t(ent,"getNotAllowedInlineEnumError");function tnt(l,u,m){return{type:"missing-acl-condition-property",message:`Condition property ${l} is not found in parameters or body in operation ${Ole(u,m)}`}}t(tnt,"getMissingAclConditionPropertyError");function Wwe(l,u,m){return{type:"missing-status-code",message:`Missing HTTP status code ${Nle(l)} in operation ${Ole(u,m)}`}}t(Wwe,"getMissingStatusCodeError");function rnt(l,u,m){return{type:"invalid-status-code",message:`Operation ${Ole(u,m)} expected HTTP status code ${Nle(l.expected)} but received ${Nle(l.received)}`}}t(rnt,"getInvalidStatusCodeError");function nnt(l,u,m){return{type:"multiple-success-status-codes",message:`Operation ${Ole(u,m)} has multiple success HTTP status codes: ${l.map(Nle).join(", ")}`}}t(nnt,"getMultipleSuccessStatusCodesError");function Ole(l,u){return l.operationId??`${u.method} ${u.path}`}t(Ole,"getOperationDescriptor");function Nle(l){return`${l} (${urt[l]})`}t(Nle,"getStatusCodeDescription");function int(l){return l.reduce((u,m)=>({...u,[m.type]:[...u[m.type]??[],m.message]}),{})}t(int,"groupByType");var i6=Vd(ple());var Fle=t(l=>l.method===i6.OpenAPIV3.HttpMethods.GET,"isGetEndpoint"),Hwe=t((l,u)=>Fle(l)&&Object.values(u.infiniteQueryParamNames).every(m=>l.parameters.some(b=>b.name===m&&b.type==="Query")),"isPaginatedGetEndpoint"),snt=t((l,u)=>l.method===i6.OpenAPIV3.HttpMethods.GET&&!_R(l.pathSegments.at(-1))&&Hwe(l,u),"isReadAllEndpoint"),ant=t((l,u)=>l.method===i6.OpenAPIV3.HttpMethods.GET&&Gwe(l,u),"isReadEndpoint"),ont=t((l,u)=>l.method===i6.OpenAPIV3.HttpMethods.POST&&pnt(l,u),"isCreateEndpoint"),cnt=t((l,u)=>[i6.OpenAPIV3.HttpMethods.PUT,i6.OpenAPIV3.HttpMethods.PATCH].includes(l.method)&&Gwe(l,u),"isUpdateEndpoint"),lnt=t((l,u)=>l.method===i6.OpenAPIV3.HttpMethods.DELETE&&Gwe(l,u),"isDeleteEndpoint"),unt=t((l,u)=>l.method===i6.OpenAPIV3.HttpMethods.DELETE&&pnt(l,u),"isBulkDeleteEndpoint"),fnt=t(l=>l.split("/").filter(Boolean),"getPathSegments"),_R=t(l=>l==null?void 0:l.startsWith(":"),"isPathSegmentParam"),_nt=t((l,u)=>u.pathSegments.every((m,b)=>_R(m)&&_R(l.pathSegments[b])||m===l.pathSegments[b]),"hasMatchingPath"),pnt=t((l,u)=>l.pathSegments.length===u.pathSegments.length&&_nt(l,u),"hasMatchingPathWithoutTrailingParam"),Gwe=t((l,u)=>l.pathSegments.length-1===u.pathSegments.length&&_R(l.pathSegments.at(-1))&&_nt(l,u),"hasMatchingPathWithTrailingParam");var Ont=Vd(ple());var Mle={fileName:"acl/app.ability",extension:"ts"},$W="AppAbilities",Rle={fileName:"acl/useAclCheck",extension:"ts"},t3="useAclCheck",sy={abilityTuple:"AbilityTuple",pureAbility:"PureAbility",forcedSubject:"ForcedSubject",subjectType:"Subject",subject:"subject"},Qwe={bindings:[sy.abilityTuple,sy.pureAbility,sy.forcedSubject,sy.subjectType,sy.subject],from:"@casl/ability"};var Ib=t((...l)=>[...new Set(l.flat())],"getUniqueArray");var JW=t(l=>`canUse${u_(ny(l.operationName))}`,"getAbilityFunctionName"),Lle=t((l,u)=>`${u.tsNamespaces?`${C_({type:"acl",tag:Y1(l,u),options:u})}.`:""}${JW(l)}`,"getImportedAbilityFunctionName"),Zwe=t(l=>{var u;return(u=l.acl)==null?void 0:u[0].action},"getAbilityAction"),Xwe=t(l=>{var u;return(u=l.acl)==null?void 0:u[0].subject},"getAbilitySubject"),qW=t(l=>{var u;return!!((u=pR(l))!=null&&u.length)},"hasAbilityConditions"),pR=t(l=>{var u,m;return(m=(u=l.acl)==null?void 0:u[0].conditionsTypes)==null?void 0:m.sort((b,T)=>b.name.localeCompare(T.name))},"getAbilityConditionsTypes"),dnt=t(l=>{var u;return(u=l.acl)==null?void 0:u[0].description},"getAbilityDescription"),Ywe=t(l=>{var b;let u=Xwe(l),m=[`"${u??""}"`];return qW(l)&&m.push(`ForcedSubject<"${u}"> & { ${(b=pR(l))==null?void 0:b.map(T=>`${T.name}${T.required?"":"?"}: ${T.type??""}${T.zodSchemaName??""},`).join(" ")} }`),m},"getAbilitySubjectTypes");function Kwe({resolver:l,data:u,tag:m}){var Q;let b=(Q=u.get(m))==null?void 0:Q.endpoints.filter(({acl:ae})=>ae&&ae.length>0);if(!b||b.length===0)return;let T=b.some(({acl:ae})=>(ae==null?void 0:ae[0].conditions)&&Object.keys(ae[0].conditions).length>0),I=b.reduce((ae,ee)=>{var Te,Ke;let pe=(Ke=(Te=ee.acl)==null?void 0:Te[0].conditionsTypes)==null?void 0:Ke.reduce((Pt,rr)=>[...Pt,...rr!=null&&rr.zodSchemaName?[rr.zodSchemaName]:[]],[]);return[...ae,...pe??[]]},[]),L=RC({resolver:l,tag:m,zodSchemasAsTypes:Ib(I)});return{endpoints:b,hasAdditionalAbilityImports:T,modelsImports:L}}t(Kwe,"getAclData");var mnt=t(({resolver:l,data:u})=>{let m=new Map,b=[],T=!1;u.forEach((Q,ae)=>{let ee=Kwe({resolver:l,data:u,tag:ae});if(!ee)return;let{modelsImports:pe,hasAdditionalAbilityImports:Te,endpoints:Ke}=ee;b.push(pe),T=T||Te,Ke.forEach(Pt=>{let rr=Zwe(Pt);rr&&m.set(rr,new Set([...m.get(rr)??[],...Ywe(Pt)]))})});let I=zW(l.options,...b);return{appAbilitiesType:m.size>0?Object.fromEntries(Array.from(m.entries()).map(([Q,ae])=>[Q,Array.from(ae)])):void 0,modelsImports:I,hasAdditionalAbilityImports:T}},"getAppAbilitiesType");var VW=t((l,u)=>{let m=mS(l)&&r3(l)&&u;return`use${u_(ny(l.operationName))}${m?"Mutation":""}`},"getQueryName"),UW=t(l=>`use${u_(ny(l.operationName))}Infinite`,"getInfiniteQueryName"),C8=t((l,u)=>`${u.tsNamespaces?`${C_({type:"queries",tag:Y1(l,u),options:u})}.`:""}${VW(l)}`,"getImportedQueryName"),hnt=t((l,u)=>`${u.tsNamespaces?`${C_({type:"queries",tag:Y1(l,u),options:u})}.`:""}${UW(l)}`,"getImportedInfiniteQueryName");function X0(l,u){if(!l)return;let{data:m,onSchema:b}=u;if(gf(l)&&b({type:"reference",schema:l,data:m})===!0)return;let T=l;if(PW.some(I=>I in T&&T[I])){let I=T.allOf??T.anyOf??T.oneOf??[];for(let L of I)(b==null?void 0:b({type:"composite",parentSchema:l,schema:L,data:m}))!==!0&&X0(L,{data:m,onSchema:b})}if(T.properties)for(let[I,L]of Object.entries(T.properties))b({type:"property",parentSchema:l,schema:L,data:m,propertyName:I})!==!0&&X0(L,u);if(T.additionalProperties&&typeof T.additionalProperties=="object"){if(b({type:"additionalProperties",parentSchema:l,schema:T.additionalProperties,data:m})===!0)return;X0(T.additionalProperties,u)}if(T.type==="array"){let I=l.items;if(b({type:"array",parentSchema:l,schema:I,data:m})===!0)return;X0(I,u)}}t(X0,"iterateSchema");function WW(l){return["minimum","exclusiveMinimum","maximum","exclusiveMaximum","minItems","minLength","minProperties","maxItems","maxLength","maxProperties","default","example"].filter(b=>l[b]).reduce((b,T)=>[...b,`${u_(ule(T))}: \`${l[T]}\``],[])}t(WW,"getSchemaDescriptions");var HW=t((l,u)=>prt(l,u.schemaSuffix),"getZodSchemaInferedTypeName"),P8=t((l,u)=>wh(u)?`${l.options.tsNamespaces?`${C_({type:"models",tag:l.getTagByZodSchemaName(u),options:l.options})}.`:""}${u}`:u,"getImportedZodSchemaName"),E8=t((l,u,m)=>{if(!wh(u))return u===wW?"void":u;let b=l.getTagByZodSchemaName(u);return`${l.options.tsNamespaces&&b!==m?`${C_({type:"models",tag:b,options:l.options})}.`:""}${HW(u,l.options)}`},"getImportedZodSchemaInferedTypeName");function gnt(l){var u;return l.isEnum?"enum":((u=l.schemaObj)==null?void 0:u.type)??"object"}t(gnt,"getZodSchemaType");function ynt(l){if(l.schemaObj)return[l.schemaObj.description,...WW(l.schemaObj)].filter(Boolean).join(". ")}t(ynt,"getZodSchemaDescription");function vnt(l,u,m){var b;if(gf(u)){let T=l.getZodSchemaNameByRef(u.$ref);return T?E8(l,T,m):void 0}if(yle(u)){if(!gf(u.items))return`${((b=u.items)==null?void 0:b.type)??"unknown"}[]`;let T=l.getZodSchemaNameByRef(u.items.$ref);return T?`${E8(l,T,m)}[]`:void 0}if(PW.some(T=>T in u&&u[T])){let T=u.allOf??u.anyOf??u.oneOf??[];if(T.length>0)return vnt(l,T[0],m)}return u.type}t(vnt,"getType");function bnt(l,u,m){if(!u.schemaObj)return[];let b="[0]",T="[key]",I={},L=t(Q=>{var ee;if(Q.type==="reference")return!0;if(Q.type==="composite")return;let ae=[...((ee=Q.data)==null?void 0:ee.pathSegments)??[]];if(Q.type==="array"?ae.push(b):Q.type==="property"?ae.push(Q.propertyName):Q.type==="additionalProperties"&&ae.push(T),Q.schema&&ae[ae.length-1]!==b){let pe=l.resolveObject(Q.schema),Te=[pe.description,...WW(pe)].filter(Boolean),Ke=ae.join(".");I[Ke]&&"type"in Q.schema&&Q.schema.type==="object"||(delete I[Ke],I[Ke]={type:vnt(l,Q.schema,m)??"unknown",description:Te.join(". ")})}return X0(Q.schema,{data:{pathSegments:[...ae]},onSchema:L}),!0},"onSchema");return"allOf"in u.schemaObj&&u.schemaObj.allOf&&u.schemaObj.allOf.forEach(Q=>{if(gf(Q)){let ae=l.resolveObject(Q);X0(ae,{data:{pathSegments:[]},onSchema:L})}}),X0(u.schemaObj,{data:{pathSegments:[]},onSchema:L}),I}t(bnt,"getZodSchemaPropertyDescriptions");function RC({resolver:l,tag:u,zodSchemas:m=[],zodSchemasAsTypes:b=[]}){let T="models",I=t(ae=>l.getTagByZodSchemaName(ae),"getTag"),L=dR({type:T,tag:u,entities:m,getTag:I,getEntityName:t(ae=>ae,"getEntityName"),options:l.options}),Q=dR({type:T,tag:u,entities:b,getTag:I,getEntityName:t(ae=>HW(ae,l.options),"getEntityName"),options:l.options});return zW(l.options,L,Q)}t(RC,"getModelsImports");function Snt({tag:l,endpoints:u,options:m}){return dR({type:"endpoints",tag:l,entities:u,getTag:t(b=>Y1(b,m),"getTag"),getEntityName:GW,options:m})}t(Snt,"getEndpointsImports");function xnt({tag:l,endpoints:u,options:m}){return dR({type:"queries",tag:l,entities:u,getTag:t(b=>Y1(b,m),"getTag"),getEntityName:VW,options:m})}t(xnt,"getQueriesImports");function Tnt({tag:l,endpoints:u,options:m}){return dR({type:"queries",tag:l,entities:u,getTag:t(b=>Y1(b,m),"getTag"),getEntityName:UW,options:m})}t(Tnt,"getInfiniteQueriesImports");function jle({tag:l,endpoints:u,options:m}){return dR({type:"acl",tag:l,entities:u,getTag:t(b=>Y1(b,m),"getTag"),getEntityName:JW,options:m})}t(jle,"getAclImports");function s6(l){let u=l.tsPath;return l.importPath==="relative"?u="../":l.importPath==="absolute"?u=l.output:new RegExp(`${Jwe}`,"g").test(l.output)&&(u=l.output.replace(new RegExp(`.*${Jwe}`,"g"),l.tsPath)),`${u}/`.replace(/\/\//g,"/")}t(s6,"getImportPath");function dR({type:l="models",tag:u,entities:m,getTag:b,getEntityName:T,options:I}){let L=new Map;return m.forEach(Q=>{let ae=b(Q);if(L.has(ae))I.tsNamespaces||L.get(ae).bindings.push(T(Q));else{let ee=u===ae;L.set(ae,{bindings:[I.tsNamespaces?C_({type:l,tag:ae,options:I}):T(Q)],from:`${ee?"./":s6(I)}${eAe({type:l,tag:ae,includeTagDir:!ee,options:I})}`})}}),Array.from(L.values())}t(dR,"getImports");function zW(l,...u){let m=new Map;return u.forEach(b=>{b.forEach(T=>{m.has(T.from)?l.tsNamespaces||m.get(T.from).bindings.push(...T.bindings):m.set(T.from,T)})}),Array.from(m.values()).map(b=>({...b,bindings:Ib(b.bindings)}))}t(zW,"mergeImports");function w8({fileName:l,extension:u}){return`${l}.${u}`}t(w8,"getFileNameWithExtension");function knt({type:l,tag:u,options:m,includeTagDir:b=!0}){let T=m.configs[l].outputFileNameSuffix;return u?`${b?`${zA(u)}/`:""}${zA(u)}.${T}`:T}t(knt,"getTagFileNameWithoutExtension");function eAe(...l){return knt(...l)}t(eAe,"getTagImportPath");function Ble(...l){return`${knt(...l)}.ts`}t(Ble,"getTagFileName");function Cnt(l){return l.standalone?`${s6(l)}${Ele.fileName}`:l.restClientImportPath}t(Cnt,"getAppRestClientImportPath");function Ent(l){return l.standalone?`${s6(l)}${Cle.reactQueryTypes.fileName}`:l.queryTypesImportPath}t(Ent,"getQueryTypesImportPath");function Pnt(l){return`${s6(l)}${Ple.fileName}`}t(Pnt,"getQueryModulesImportPath");function wnt(l){return`${s6(l)}${wle.fileName}`}t(wnt,"getMutationEffectsImportPath");function Ant(l){return`${s6(l)}${Rle.fileName}`}t(Ant,"getAclCheckImportPath");function Dnt(l){return`${s6(l)}${Ale.fileName}`}t(Dnt,"getZodExtendedImportPath");function Int(l){return`${s6(l)}${Mle.fileName}`}t(Int,"getAppAbilitiesImportPath");function Nnt(l){return Xy(l).with("string",()=>"string").with("number",()=>"number").with("integer",()=>"number").with("boolean",()=>"boolean").exhaustive()}t(Nnt,"primitiveTypeToTsType");var GW=t(l=>zA(ny(l.operationName)),"getEndpointName");function Fnt(l,u){return`${u.tsNamespaces?`${C_({type:"endpoints",tag:Y1(l,u),options:u})}.`:""}${GW(l)}`}t(Fnt,"getImportedEndpointName");var Mnt=t(l=>l.method!==Ont.OpenAPIV3.HttpMethods.GET,"requiresBody"),n3=t(l=>l.parameters.find(u=>u.type==="Body"),"getEndpointBody"),Rnt=t((l,u)=>{let m=tAe(l),b=u.options.axiosRequestConfig;return Object.keys(m).length>0||b},"hasEndpointConfig"),Lnt=t(l=>l.path.replace(/:([a-zA-Z0-9_]+)/g,"${$1}"),"getEndpointPath");function i3(l,u,m){let b=u.parameters.map(T=>{var L,Q,ae,ee;let I="string";if(wh(T.zodSchema))I=E8(l,T.zodSchema);else if((L=T.parameterObject)!=null&&L.schema&&iy(T.parameterObject.schema)){let pe=(ae=(Q=T.parameterObject)==null?void 0:Q.schema)==null?void 0:ae.type;pe&&v8(pe)&&(I=Nnt(pe))}return{name:e3(T.name),type:I,paramType:T.type,required:((ee=T.parameterObject)==null?void 0:ee.required)??!0,parameterObject:T.parameterObject,bodyObject:T.bodyObject}});return m!=null&&m.includeFileParam&&u.mediaUpload&&b.push({name:"file",type:"File",paramType:"Body",required:!0,parameterObject:void 0,bodyObject:void 0}),b.sort((T,I)=>{if(T.required===I.required){let L=["Path","Body","Query","Header"];return L.indexOf(T.paramType)-L.indexOf(I.paramType)}return T.required?-1:1}).filter(T=>(!(m!=null&&m.excludeBodyParam)||T.name!==fle)&&(!(m!=null&&m.excludePageParam)||T.name!==l.options.infiniteQueryParamNames.page)&&(!(m!=null&&m.includeOnlyRequiredParams)||T.required)).map(T=>({...T,name:m!=null&&m.replacePageParam&&T.name===l.options.infiniteQueryParamNames.page?"pageParam":T.name,required:T.required&&(T.paramType==="Path"||!(m!=null&&m.pathParamsRequiredOnly))}))}t(i3,"mapEndpointParamsToFunctionParams");function tAe(l){let u=l.parameters.filter(T=>T.type==="Query").map(T=>{let I=Hrt(T.name)?T.name:`"${T.name}"`,L=e3(T.name);return{...T,name:I,value:L}}),m={};return l.requestFormat!==Pwe["Content-Type"]&&(m["Content-Type"]=`'${l.requestFormat}'`),l.responseFormat&&l.responseFormat!==Pwe.Accept&&(m.Accept=`'${l.responseFormat}'`),l.parameters.filter(T=>T.type==="Header").forEach(T=>{m[T.name]=e3(T.name)}),{...u.length>0?{params:u}:{},...Object.keys(m).length?{headers:m}:{}}}t(tAe,"getEndpointConfig");function jnt(l,u){return u.filter(m=>mS(m)&&m.parameters.filter(b=>{var T;return(T=b.parameterObject)==null?void 0:T.required}).every(b=>l.parameters.some(T=>T.name===b.name))&&m.response===l.response)}t(jnt,"getUpdateQueryEndpoints");var mS=t(l=>Fle(l),"isQuery"),r3=t(l=>!Fle(l)||!!l.mediaDownload,"isMutation"),mR=t((l,u)=>Hwe(l,u),"isInfiniteQuery"),Bnt=t((l,u,m)=>{let b=m.reduce((T,I)=>[...T,...i3(l,I,{includeOnlyRequiredParams:!0}).map(L=>L.name)],[]);return i3(l,u,{includeOnlyRequiredParams:!0,excludeBodyParam:!0}).filter(T=>b.includes(T.name)).map(T=>T.name)},"getDestructuredVariables");function $nt({resolver:l,endpoint:u,operation:m}){let b=m["x-acl"];return b==null?void 0:b.map(T=>{let I=Object.keys(T.conditions??{}).reduce((L,Q)=>{let ae=uUt({resolver:l,endpoint:u,acl:b,name:Q});return ae?[...L,ae]:(l.validationErrors.push(tnt(Q,m,u)),L)},[]);return{...T,conditionsTypes:I}})}t($nt,"getEndpointAcl");function uUt({resolver:l,endpoint:u,acl:m,name:b}){var Te,Ke,Pt,rr,or,Lt,Xt,Vt,Ti,zn;let T=(Ke=(Te=m[0])==null?void 0:Te.conditions)==null?void 0:Ke[b];if(!T)return;let I=T.replace(/^\$[^.]*\./,"").split("."),L,Q,ae,ee=0,pe=u.parameters.find(({name:_i})=>_i===I[ee]);if(pe)Q=(Pt=pe.parameterObject)==null?void 0:Pt.required,L=(rr=pe.parameterObject)==null?void 0:rr.schema,ae=`${pe.name} ${zA(pe.type)} parameter`,ee++;else{let _i=u.parameters.find(({bodyObject:ql})=>!!ql),Vn=Object.keys(((or=_i==null?void 0:_i.bodyObject)==null?void 0:or.content)??{}).find(FC);Vn&&(L=(Vt=(Xt=(Lt=_i==null?void 0:_i.bodyObject)==null?void 0:Lt.content)==null?void 0:Xt[Vn])==null?void 0:Vt.schema,ae=`${mS(u)?"query":"mutation"} data`)}for(;L&&ee<I.length;){let _i=l.resolveObject(L);L=(Ti=Object.entries(_i.properties??{}).find(([Vn])=>Vn===I[ee]))==null?void 0:Ti[1],Q=((zn=_i.required)==null?void 0:zn.includes(I[ee]))??!1,ee++}if(L)return{name:b,type:gf(L)?void 0:L.type,zodSchemaName:gf(L)?l.getZodSchemaNameByRef(L.$ref):void 0,required:Q,info:ae}}t(uUt,"getEndpointAclConditionPropertyType");function Jnt({resolver:l,operation:u,operationName:m,isUniqueOperationName:b,tag:T}){var Pt,rr;let I=l.resolveObject(u.requestBody);if(!I)return;let Q=Object.keys(I.content??{}).find(FC);if(!Q)return;let ae=(rr=(Pt=I.content)==null?void 0:Pt[Q])==null?void 0:rr.schema;if(!ae)return;let ee=Hd({schema:ae,resolver:l,meta:{isRequired:I.required??!0},tag:T}),pe=l.resolveObject(ae),Te=lR({schema:pe,zodSchema:ee,fallbackName:Dle(T8(m,b,T)),resolver:l,tag:T}),Ke=MC({schema:pe,meta:ee.meta,options:l.options});return{endpointParameter:{name:fle,type:"Body",description:I.description,zodSchema:Te+Ke,bodyObject:I},requestFormat:Q}}t(Jnt,"getEndpointBody");function qnt({resolver:l,param:u,operationName:m,isUniqueOperationName:b,tag:T}){let I=l.resolveObject(u);if(!yrt.includes(I.in))return;let L={};if(I.content){let Pt=Object.keys(I.content??{}),rr=Pt.find(FC);if(!rr)throw new Error(`Unsupported media type for param ${I.name}: ${Pt.join(", ")}`);let or=I.content[rr];if(!or)throw new Error(`No content with media type for param ${I.name}: ${rr}`);L=(or==null?void 0:or.schema)??or}else I.schema&&(L=I.schema);l.options.withDescription&&L&&(L.description=(I.description??"").trim());let Q=Wrt(T8(m,b,T),I.name),ae;if(Sle(I)){let Pt=RW(Q,l.options.enumSuffix,l.options.schemaSuffix),rr=qrt(I["x-enumNames"]);l.setZodSchema(Pt,rr,T),ae=Pt}let ee=Hd({schema:L,resolver:l,meta:{isRequired:I.in==="path"?!0:I.required??!1},tag:T}),pe=l.resolveObject(L),Te=MC({schema:pe,meta:ee.meta,options:l.options}),Ke=lR({schema:pe,zodSchema:ee.assign(ee.getCodeString(T)+Te),fallbackName:Q,resolver:l,tag:T});return{name:Xy(I.in).with("path",()=>jwe(I.name)).otherwise(()=>I.name),type:Xy(I.in).with("header",()=>"Header").with("query",()=>"Query").with("path",()=>"Path").run(),zodSchema:Ke,parameterObject:I,parameterSortingEnumSchemaName:ae}}t(qnt,"getEndpointParameter");function Vnt(l){var m,b,T,I,L;let u=[];for(let Q in l.openApiDoc.paths){if(b8(Q,l.options))continue;let ae=l.openApiDoc.paths[Q],ee=k8(ae,g8),pe=znt(ae.parameters??[]);for(let Te in ee){let Ke=ee[Te];if(!Ke||fR(Ke,l.options))continue;let Pt=Ke.operationId&&Ke.operationId!==e3(Ke.operationId);Ke.operationId&&Pt&&l.validationErrors.push(Yrt(Ke.operationId));let rr=Object.entries({...pe,...znt(Ke.parameters??[])}).map(([,_i])=>_i),or=jW({path:Q,method:Te,operation:Ke,operationsByTag:l.operationsByTag,options:l.options}),Lt=l.operationNames.filter(_i=>_i===or).length<=1,Xt=VA(Ke,l.options),Vt={method:Te,path:Brt(Q),operationName:or,description:Ke.description,summary:Ke.summary,tags:(m=Ke.tags)==null?void 0:m.map(m8),requestFormat:h8,parameters:[],response:"",errors:[],responseStatusCodes:[],mediaUpload:!!Ke["x-media-upload"],mediaDownload:!!Ke["x-media-download"]};if(Ke.requestBody){let _i=Jnt({resolver:l,operation:Ke,operationName:or,isUniqueOperationName:Lt,tag:Xt});_i&&(Vt.parameters.push(_i.endpointParameter),Vt.requestFormat=_i.requestFormat)}for(let _i of rr){let vo=qnt({resolver:l,param:_i,operationName:or,isUniqueOperationName:Lt,tag:Xt});vo&&Vt.parameters.push(vo)}let Ti=fUt(Vt);Ti.forEach(_i=>{Vt.parameters.push(_i)}),Ti.length>0&&l.validationErrors.push(Krt(Ti,Q));for(let _i in Ke.responses){Vt.responseStatusCodes.push(_i);let vo=l.resolveObject(Ke.responses[_i]),ql=Object.keys(vo.content??{}).find(ble),zl,ia;if(ql?(Vt.responseFormat=ql,zl=(T=(b=vo.content)==null?void 0:b[ql])==null?void 0:T.schema):(ia=wW,_i==="200"&&l.validationErrors.push(rnt({received:"200",expected:"204"},Ke,Vt))),zl){let lr=Hd({schema:zl,resolver:l,meta:{isRequired:!0},tag:Xt}),xs=l.resolveObject(zl);ia=lR({schema:xs,zodSchema:lr,fallbackName:lr.ref?void 0:Ile({statusCode:_i,operationName:or,isUniqueOperationName:Lt,tag:Xt}),resolver:l,tag:Xt})+MC({schema:xs,meta:lr.meta,options:l.options})}if(ia){let lr=Number(_i);NW(lr)&&!Vt.response?(Vt.response=ia,Vt.responseObject=vo,Vt.responseDescription=vo.description):_i!=="default"&&vle(lr)&&Vt.errors.push({zodSchema:ia,status:lr,description:vo.description})}}Vt.response||(Vt.response=wW);let zn=Object.keys(Ke.responses).map(Number).filter(NW);zn.length>1&&l.validationErrors.push(nnt(zn.map(String),Ke,Vt)),Vt.acl=$nt({resolver:l,endpoint:Vt,operation:Ke}),(I=Ke.security)!=null&&I[0].Authorization&&!Vt.responseStatusCodes.includes("401")&&l.validationErrors.push(Wwe("401",Ke,Vt)),(L=Vt.acl)!=null&&L[0]&&!Vt.responseStatusCodes.includes("403")&&l.validationErrors.push(Wwe("403",Ke,Vt)),u.push(Vt)}}return u}t(Vnt,"getEndpointsFromOpenAPIDoc");function znt(l){return Object.fromEntries((l??[]).map(u=>[gf(u)?u.$ref:u.name,u]))}t(znt,"getParameters");function fUt(l){return[...l.path.matchAll(/:([a-zA-Z0-9_]+)/g)].map(m=>m[1]).filter(m=>l.parameters.findIndex(({name:b})=>b===m)===-1).map(m=>_Ut(m))}t(fUt,"getMissingPathParameters");function _Ut(l){return{name:l,type:"Path",zodSchema:mle,parameterObject:{name:l,required:!0,in:"path",schema:{type:"string"}}}}t(_Ut,"getPathParameterFromName");function Unt(l,u){let m=pUt(l,u),b=dUt(l,m);return{refsDependencyGraph:m,deepDependencyGraph:b}}t(Unt,"getOpenAPISchemaDependencyGraph");function pUt(l,u){let m={},b={};return l.forEach(T=>mUt({schema:u(T),fromRef:T,getSchemaByRef:u,visitedRefs:m,refsDependencyGraph:b})),b}t(pUt,"getRefsDependencyGraph");function dUt(l,u){let m={},b={},T=t((I,L)=>{b[L].add(I),u[I]&&L!==I&&u[I].forEach(Q=>{let ae=`${L}__${Q}`;m[ae]||(m[ae]=!0,T(Q,L))})},"visit");return l.forEach(I=>{let L=u[I];L&&(b[I]||(b[I]=new Set),L.forEach(Q=>T(Q,I)))}),b}t(dUt,"getDeepRefsDependencyGraph");function mUt({schema:l,fromRef:u,getSchemaByRef:m,visitedRefs:b={},refsDependencyGraph:T={}}){let I=t(L=>{if(L.type!=="reference"||!L.data)return;let{schema:Q,data:ae}=L;if(T[ae.fromRef]||(T[ae.fromRef]=new Set),T[ae.fromRef].add(Q.$ref),b[Q.$ref])return!0;b[ae.fromRef]=!0,X0(m(Q.$ref),{data:{fromRef:Q.$ref},onSchema:I})},"onSchema");return X0(l,{data:{fromRef:u},onSchema:I}),{visitedRefs:b,refsDependencyGraph:T}}t(mUt,"getSchemaRefsDependencyGraph");function $le(l,u,m){let b=[];return X0(u,{onSchema:t(I=>{I.type==="reference"?b.push(I.schema):gf(I.parentSchema)&&(I.type==="property"?l.validationErrors.push(BW(`${m} has both reference and properties`)):I.type==="additionalProperties"?l.validationErrors.push(BW(`${m} has both reference and additionalProperties`)):I.type==="array"?l.validationErrors.push(BW(`${m} is both reference and array schema`)):I.type==="composite"&&l.validationErrors.push(BW(`${m} has both reference and composite keyword`)))},"onSchema")}),b}t($le,"getSchemaRefObjs");function Wnt(l,u){return u.map(T=>y8(T.$ref)).reduce((T,I)=>{let L=l.dependencyGraph.deepDependencyGraph[I];return[...T,I,...Array.from(L??[])]},[])}t(Wnt,"getDeepSchemaRefObjs");function Hnt(l){l.extractedEnumZodSchemaData.forEach(m=>{let b=m.meta.zodSchemaNameSegments.map(I=>I[I.length-1]).filter(Boolean),T=Ewe(b);if(!T)throw new Error(`No common last segment found for enum: ${m.code}`);m.zodSchemaName=RW(T,l.options.enumSuffix,l.options.schemaSuffix)});let u=0;for(;u<5&&!rAe(l);)hUt(l,u+2),u++;if(rAe(l)||l.extractedEnumZodSchemaData.filter(b=>!Gnt(l,b)).forEach(b=>{b.zodSchemaName=RW(b.meta.zodSchemaNameSegments[0].map(T=>nAe(u_(T))).join(""),l.options.enumSuffix,l.options.schemaSuffix)}),!rAe(l))throw new Error("Failed to resolve unique names for enum zod schemas")}t(Hnt,"resolveExtractedEnumZodSchemaNames");function rAe(l){return l.extractedEnumZodSchemaData.every(u=>Gnt(l,u))}t(rAe,"allExtractedEnumZodSchemaNamesAreUnique");function hUt(l,u){l.extractedEnumZodSchemaData.forEach(m=>{let b=l.extractedEnumZodSchemaData.filter(({zodSchemaName:T})=>m.zodSchemaName===T);b.length!==1&&gUt(b,u)})}t(hUt,"additionalResolveExtractedEnumZodSchemaName");function gUt(l,u=2){l.forEach(m=>{let b=m.meta.zodSchemaNameSegments.map(T=>T[T.length-u]).filter(Boolean);if(b.length===1){let T=[nAe(u_(b[0])),m.zodSchemaName].filter(Boolean).join("");m.zodSchemaName=T}else{let T=Ewe(b),I=[T?nAe(u_(T)):"",m.zodSchemaName].filter(Boolean).join("");m.zodSchemaName=I}})}t(gUt,"suffixWithPreviousSegmentName");function Gnt(l,u){return l.extractedEnumZodSchemaData.filter(({zodSchemaName:m})=>u.zodSchemaName===m).length===1}t(Gnt,"isUnique");function nAe(l){return l.replace(/(Dto|DTO|Response|Request)/g,"")}t(nAe,"sanitizeName");function Qnt(l){l.extractedEnumZodSchemaData.forEach(u=>{let m=Ib(u.meta.tags);u.tag=m.length===1?m[0]:l.options.defaultTag})}t(Qnt,"resolveExtractedEnumZodSchemaTags");function QW({schema:l,nameSegments:u=[],includeSelf:m,...b}){m&&Znt({schema:l,nameSegments:u,...b}),X0(l,{data:{nameSegments:u},onSchema:t(I=>{var Q;if(I.type==="reference")return!0;let L=[...((Q=I.data)==null?void 0:Q.nameSegments)??[]];I.type==="property"&&L.push(I.propertyName),Znt({schema:I.schema,nameSegments:[...L],...b})},"onSchema")})}t(QW,"updateExtractedEnumZodSchemaData");function Znt({resolver:l,schema:u,schemaRef:m,schemaInfo:b,tags:T,nameSegments:I=[]}){if(!u||gf(u)||!u.enum)return;let L=oR(u),Q=l.extractedEnumZodSchemaData.find(ae=>ae.code===L);Q?(Q.meta.zodSchemaNameSegments.push(I),Q.meta.tags.push(...T),Q.meta.schemaRefs.push(...m?[m]:[]),Q.meta.schemas.push(...u?[u]:[])):l.extractedEnumZodSchemaData.push({code:L,meta:{zodSchemaNameSegments:[I],tags:[...T],schemaRefs:m?[m]:[],schemas:u?[u]:[]}}),l.validationErrors.push(ent(m?`${aR(m)}.${I[I.length-1]}`:b??I.join(".")))}t(Znt,"handleExtractedEnumZodSchemaDataUpdate");function Xnt(l){var b;let u={},m={};return Object.entries(((b=l.openApiDoc.components)==null?void 0:b.schemas)??{}).forEach(([T,I])=>{let L=l.getSchemaDataByName(T);if(l.options.excludeRedundantZodSchemas&&(!L||L.deepRefOperations.length===0&&L.tags.length===0))return;let Q=x8(T,l.options.schemaSuffix);if(u[Q])return;let ae=l.getTagByZodSchemaName(Q),ee=l.resolveObject(I);ee.enum?m[Q]=oR(ee):u[Q]=Hd({schema:I,resolver:l,tag:ae}).getCodeString(ae)}),{zodSchemas:u,enumZodSchemas:m}}t(Xnt,"getZodSchemasFromOpenAPIDoc");function Ynt(l){var m;let u=[];return Object.entries(((m=l.openApiDoc.components)==null?void 0:m.schemas)??{}).forEach(([b,T])=>{let I=x8(b,l.options.schemaSuffix),L=l.resolveObject(T);!u.find(Q=>Q.zodSchemaName===I)&&L.enum&&u.push({zodSchemaName:I,code:oR(L)})}),u}t(Ynt,"getEnumZodSchemasFromOpenAPIDoc");var iAe=class iAe{constructor(u,m){this.openApiDoc=u;this.options=m;this.dependencyGraph=Unt(this.schemaRefs,this.getSchemaByRef.bind(this)),this.enumZodSchemas=Ynt(this),this.operationsByTag=Xrt(u,m),this.operationNames=Zrt(u,this.operationsByTag,m),this.initialize()}schemaData=[];zodSchemaData=[];compositeZodSchemaData=[];dependencyGraph;enumZodSchemas=[];extractedEnumZodSchemaData=[];operationsByTag={};operationNames=[];validationErrors=[];get docSchemas(){var u;return((u=this.openApiDoc.components)==null?void 0:u.schemas)??{}}get schemaRefs(){return Object.keys(this.docSchemas).map(Mrt)}getSchemaByRef(u){return this.docSchemas[aR(u)]}getSchemaDataByName(u){return this.schemaData.find(m=>m.name===u)}getZodSchemaNameByRef(u){var b,T;let m=((b=this.getSchemaDataByRef(y8(u)))==null?void 0:b.zodSchemaName)??((T=this.extractedEnumZodSchemaData.find(I=>I.zodSchemaName===u))==null?void 0:T.zodSchemaName);if(!m)throw new Error(`Zod schema not found for ref: ${u}`);return m}getRefByZodSchemaName(u){var m;return(m=this.schemaData.find(b=>b.zodSchemaName===u))==null?void 0:m.ref}getTagByZodSchemaName(u){var ae,ee;if(!this.options.splitByTags)return this.options.defaultTag;let m=this.extractedEnumZodSchemaData.find(pe=>pe.zodSchemaName===u);if(m)return m8(m.tag??this.options.defaultTag);let b=this.getRefByZodSchemaName(u),T=b?((ae=this.getSchemaDataByRef(b))==null?void 0:ae.tags)??[]:[],I=((ee=this.zodSchemaData.find(pe=>pe.zodSchemaName===u))==null?void 0:ee.tags)??[],L=Ib(T,I),Q=L.length===1?L[0]:this.options.defaultTag;return m8(Q??this.options.defaultTag)}getCodeByZodSchemaName(u){var m;return(m=this.zodSchemaData.find(b=>b.zodSchemaName===u))==null?void 0:m.code}getZodSchemaNamesByCompositeCode(u){var m;return(m=this.compositeZodSchemaData.find(b=>b.code===u))==null?void 0:m.zodSchemas.map(b=>b.zodSchemaName)}setZodSchema(u,m,b){let T=this.zodSchemaData.find(I=>I.zodSchemaName===u);T?(T.code=m,T.tags=(T.tags??[]).concat(b)):this.zodSchemaData.push({zodSchemaName:u,code:m,tags:[b]})}addZodSchemaForCompositeCode(u,m,b,T){let I={zodSchemaName:b,zodSchema:m,schema:T},L=this.compositeZodSchemaData.find(Q=>Q.code===u);L?L.zodSchemas.push(I):this.compositeZodSchemaData.push({code:u,zodSchemas:[I]})}getCompositeZodSchemaByZodSchemaName(u){var b;let m=this.compositeZodSchemaData.find(T=>T.zodSchemas.some(I=>I.zodSchemaName===u));return(b=m==null?void 0:m.zodSchemas.find(T=>T.zodSchemaName===u))==null?void 0:b.zodSchema}getSchemaByCompositeZodSchemaName(u){var m,b;return(b=(m=this.compositeZodSchemaData.find(T=>T.zodSchemas.some(I=>I.zodSchemaName===u)))==null?void 0:m.zodSchemas.find(T=>T.zodSchemaName===u))==null?void 0:b.schema}getEnumZodSchemaDataByCode(u){return this.enumZodSchemas.find(m=>m.code===u)}getExtractedEnumZodSchemaDataByCode(u){return this.extractedEnumZodSchemaData.find(m=>m.code===u)}getExtractedEnumZodSchemaNamesReferencedBySchemaRef(u){return this.extractedEnumZodSchemaData.reduce((m,{zodSchemaName:b,meta:T})=>(b&&T.schemaRefs.includes(u)&&m.push(b),m),[])}getZodSchemas(){return this.zodSchemaData.reduce((u,{zodSchemaName:m,code:b})=>({...u,[m]:b}),{})}getExtractedEnumZodSchemas(){return this.extractedEnumZodSchemaData.reduce((u,{zodSchemaName:m,code:b})=>m?{...u,[m]:b}:u,{})}resolveObject(u){return gf(u)?this.getSchemaByRef(u.$ref):u}isSchemaCircular(u){var m;return(m=this.dependencyGraph.deepDependencyGraph[u])==null?void 0:m.has(u)}getCircularSchemaChain(u,m=u,b=[],T=[]){var I,L;return T.includes(m)?[]:(T.push(m),(I=this.dependencyGraph.refsDependencyGraph[m])!=null&&I.has(u)?[...b,m,u]:Array.from(((L=this.dependencyGraph.refsDependencyGraph[m])==null?void 0:L.values())??[]).map(Q=>{let ae=this.getCircularSchemaChain(u,Q,b,T);return ae.length>0?[m,...ae]:ae}).flat())}getBaseUrl(){var m,b;let u=(b=(m=this.openApiDoc.servers)==null?void 0:m[0])==null?void 0:b.url;return this.options.baseUrl===""&&u?u:this.options.baseUrl}getZodSchemaObj(u){let m=this.getRefByZodSchemaName(u);if(m)return this.getSchemaByRef(m);let b=this.getSchemaByCompositeZodSchemaName(u);if(b)return b;let T=this.getExtractedEnumZodSchemaDataByName(u);if(T)return T.meta.schemas.reduce((I,L)=>({...I,...this.resolveObject(L)}),{})}getSchemaDataByRef(u){return this.schemaData.find(m=>m.ref===u)}getExtractedEnumZodSchemaDataByName(u){return this.extractedEnumZodSchemaData.find(({zodSchemaName:m})=>m===u)}initialize(){var u,m,b,T,I;this.schemaRefs.forEach(L=>{let Q=y8(L),ae=aR(Q),ee=x8(ae,this.options.schemaSuffix);this.schemaData.push({ref:Q,name:ae,zodSchemaName:ee,tags:[],deepRefOperations:[]})});for(let L in this.openApiDoc.paths){if(b8(L,this.options))continue;let Q=this.openApiDoc.paths[L],ae=k8(Q,g8);for(let ee in ae){let pe=ae[ee];if(!pe||fR(pe,this.options))continue;let Te=VA(pe,this.options),Ke=jW({path:L,method:ee,operation:pe,operationsByTag:this.operationsByTag,options:this.options}),Pt=this.operationNames.filter(Xt=>Xt===Ke).length<=1,rr=ny(T8(Ke,Pt,Te)),or=[];if((u=pe.parameters)==null||u.map(Xt=>{let Vt=Xt,Ti=Vt.schema,zn=`Operation ${pe.operationId??L} parameter ${Vt.name}`;or.push(...$le(this,Ti,zn)),this.options.extractEnums&&QW({resolver:this,schema:Ti,schemaInfo:zn,tags:[Te],nameSegments:[rr,Vt.name],includeSelf:!0})}),pe.requestBody){let Xt=this.resolveObject(pe.requestBody),Ti=Object.keys(Xt.content??{}).find(FC);if(Ti){let zn=(b=(m=Xt.content)==null?void 0:m[Ti])==null?void 0:b.schema,_i=`Operation ${pe.operationId} request body`;or.push(...$le(this,zn,_i)),this.options.extractEnums&&QW({resolver:this,schema:zn,schemaInfo:_i,tags:[Te],nameSegments:[Dle(rr)]})}}for(let Xt in pe.responses){let Vt=this.resolveObject(pe.responses[Xt]),zn=Object.keys(Vt.content??{}).find(ble);if(zn){let _i=(I=(T=Vt.content)==null?void 0:T[zn])==null?void 0:I.schema,vo=`Operation ${pe.operationId} response body`;or.push(...$le(this,_i,vo)),this.options.extractEnums&&QW({resolver:this,schema:_i,schemaInfo:vo,tags:[Te],nameSegments:[Ile({statusCode:Xt,operationName:Ke,isUniqueOperationName:Pt,tag:Te})]})}}Wnt(this,or).forEach(Xt=>{let Vt=this.getSchemaDataByRef(Xt);Vt&&(Vt.tags.push(Te),Vt.deepRefOperations.push(pe))})}}this.options.extractEnums&&(this.schemaRefs.forEach(L=>{var ae;let Q=y8(L);QW({resolver:this,schema:this.getSchemaByRef(Q),schemaRef:Q,tags:((ae=this.getSchemaDataByRef(Q))==null?void 0:ae.tags)??[],nameSegments:[aR(Q)]})}),Qnt(this),this.handleDuplicateEnumZodSchemas(),Hnt(this))}handleDuplicateEnumZodSchemas(){let u=this.enumZodSchemas.map(({code:b})=>b),m=this.enumZodSchemas.filter(({code:b})=>u.includes(b));this.schemaData.forEach(b=>{var L,Q;let T=(L=m.find(({zodSchemaName:ae})=>ae===b.zodSchemaName))==null?void 0:L.code;if(!T)return;let I=this.extractedEnumZodSchemaData.find(({code:ae})=>ae===T);!I||((Q=this.getEnumZodSchemaDataByCode(I.code))==null?void 0:Q.zodSchemaName)!==b.zodSchemaName||(b.tags.push(...I.meta.tags??[]),I.meta.schemaRefs.forEach(ae=>{this.dependencyGraph.refsDependencyGraph[ae]||(this.dependencyGraph.refsDependencyGraph[ae]=new Set),this.dependencyGraph.refsDependencyGraph[ae].add(b.ref),this.dependencyGraph.deepDependencyGraph[ae]||(this.dependencyGraph.deepDependencyGraph[ae]=new Set),this.dependencyGraph.deepDependencyGraph[ae].add(b.ref)}))}),this.extractedEnumZodSchemaData.splice(0,this.extractedEnumZodSchemaData.length,...this.extractedEnumZodSchemaData.filter(({code:b})=>!u.includes(b)))}};t(iAe,"SchemaResolver");var Jle=iAe;function Knt(l){let u=[],m={};function b(T,I){Array.isArray(I)||(I=[]),I.push(T),m[T]=!0,l[T]&&l[T].forEach(L=>{I.includes(L)||m[L]||b(L,I.slice(0))}),u.includes(T)||u.push(T)}return t(b,"visit"),Object.keys(l).forEach(T=>b(T,[])),u}t(Knt,"topologicalSort");function eit(l,u){let m=Object.entries(l),b=m.filter(([T])=>u.includes(T)).sort(([T],[I])=>u.indexOf(T)-u.indexOf(I)).concat(m.filter(([T])=>!u.includes(T)));return Object.fromEntries(b)}t(eit,"sortObjKeysFromArray");function tit(l,u){let m=Knt(l.dependencyGraph.deepDependencyGraph).map(T=>l.getZodSchemaNameByRef(T));return eit(u,m)}t(tit,"sortZodSchemasByTopology");function qle(l,u){let m=new Jle(l,u),b=Vnt(m),T=Xnt(m),I={...T.zodSchemas,...m.getZodSchemas(),...T.enumZodSchemas};return I=tit(m,I),I={...m.getExtractedEnumZodSchemas(),...I},{resolver:m,data:yUt({resolver:m,endpoints:b,zodSchemas:I,options:u})}}t(qle,"getDataFromOpenAPIDoc");function yUt({resolver:l,endpoints:u,zodSchemas:m,options:b}){let T=new Map;return b.splitByTags?(u.forEach(I=>{let L=Y1(I,b);rit(L,T).endpoints.push(I)}),Object.entries(m).forEach(([I,L])=>{let Q=l.getTagByZodSchemaName(I);Q&&(rit(Q,T).zodSchemas[I]=L)}),T):(T.set(b.defaultTag,{endpoints:u,zodSchemas:m}),T)}t(yUt,"splitDataByTags");function rit(l,u){return u.has(l)||u.set(l,{endpoints:[],zodSchemas:{}}),u.get(l)}t(rit,"getTagElement");var hR=Vd(require("fs")),sAe=Vd(require("path"));function nit(l){return hR.default.readFileSync(sAe.default.join(__dirname,`../${l}`),"utf-8")}t(nit,"readFileSync");function aAe(l){let u=`src/generators/templates/${l}.hbs`;return nit(u)}t(aAe,"readHbsTemplateSync");function iit(l){let u=`src/assets/${l}`;return nit(u)}t(iit,"readAssetSync");function uT({output:l,fileName:u}){return`${l}/${u}`}t(uT,"getOutputFileName");function vUt(l,u){let m=sAe.default.dirname(l);hR.default.existsSync(m)||hR.default.mkdirSync(m,{recursive:!0}),hR.default.writeFileSync(l,u,"utf-8")}t(vUt,"writeFileWithDirSync");function bUt({fileName:l,content:u}){vUt(l,u)}t(bUt,"writeFileSync");function sit(l){l.forEach(bUt)}t(sit,"writeGenerateFileData");function ait(l,u){let{resolver:m,data:b}=qle(l,u);if(m.validationErrors.length>0){let T=int(m.validationErrors);Object.entries(T).forEach(([I,L])=>{OEe(`${EA.red(`${frt[I]}:`)}
|
|
529
|
+
`)}return u.assign(`z.union([${l.oneOf.map(Q=>Hd({schema:Q,resolver:m,meta:b,tag:T}).getCodeString(T,m.options)).join(", ")}])`)}t(rUt,"getOneOfZodSchema");function nUt({schema:l,zodSchema:u,resolver:m,meta:b,tag:T}){if(!(!iy(l)||!Array.isArray(l.type)))return l.type.length===1?Hd({schema:{...l,type:l.type[0]},resolver:m,meta:b,tag:T}):u.assign(`z.union([${l.type.map(I=>Hd({schema:{...l,type:I},resolver:m,meta:b,tag:T}).getCodeString(T,m.options)).join(", ")}])`)}t(nUt,"getArrayZodSchema");function iUt({schema:l,zodSchema:u,resolver:m,meta:b,tag:T}){if(!iy(l)||!l.anyOf)return;if(l.anyOf.length===1){let L=Hd({schema:l.anyOf[0],resolver:m,meta:b,tag:T});return u.assign(L.getCodeString(T,m.options))}let I=l.anyOf.map(L=>Hd({schema:L,resolver:m,meta:b,tag:T})).map(L=>L.getCodeString(T,m.options)).join(", ");return u.assign(`z.union([${I}])`)}t(iUt,"getAnyOfZodSchema");function sUt({schema:l,zodSchema:u,resolver:m,meta:b,tag:T}){if(!iy(l)||!l.allOf)return;if(l.allOf.length===1){let Te=Hd({schema:l.allOf[0],resolver:m,meta:b,tag:T});return u.assign(Te.getCodeString(T,m.options))}let{patchRequiredSchemaInLoop:I,noRequiredOnlyAllof:L,composedRequiredSchema:Q}=Ort(l),ae=L.map(Te=>{let Ke=Hd({schema:Te,resolver:m,meta:b,tag:T});return m&&I(Te,m.getSchemaByRef.bind(m)),Ke});Q.required.length&&ae.push(Hd({schema:Q,resolver:m,meta:b,tag:T}));let ee=ae.at(0),pe=ae.slice(1).map(Te=>`merge(${Te.getCodeString(T,m.options)})`).join(".");return u.assign(`${ee.getCodeString(T,m.options)}.${pe}`)}t(sUt,"getAllOfZodSchema");function aUt({schema:l,zodSchema:u,resolver:m,meta:b,tag:T}){if(!iy(l))return;let I=l.type?l.type.toLowerCase():void 0;if(I&&v8(I)){if(l.enum){if(I==="string")return oUt({schema:l,zodSchema:u,resolver:m,meta:b,tag:T});if(l.enum.some(L=>typeof L=="string"))return u.assign("z.never()");if(l.enum.length===1){let L=l.enum[0];return u.assign(`z.literal(${L===null?"null":L})`)}return u.assign(`z.union([${l.enum.map(L=>`z.literal(${L===null?"null":L})`).join(", ")}])`)}return u.assign(Xy(I).with("integer",()=>Xy(l.type).with("integer",()=>Ert).otherwise(()=>Prt)).with("string",()=>Xy(l.format).with("binary",()=>dle).with("email",()=>wrt).with("hostname","uri",()=>Art).with("uuid",()=>Drt).with("date-time",()=>Irt).otherwise(()=>mle)).otherwise(L=>`z.${L}()`))}}t(aUt,"getPrimitiveZodSchema");function oUt({resolver:l,schema:u,zodSchema:m,meta:b,tag:T}){var ee;if(!iy(u))return;let I=oR(u);if(!l.options.extractEnums)return m.assign(I);let L=l.getEnumZodSchemaDataByCode(I);if(L)return((ee=m.meta.parent)==null?void 0:ee.ref)===l.getRefByZodSchemaName(L.zodSchemaName)?m.assign(L.code):new OW({$ref:l.getRefByZodSchemaName(L.zodSchemaName)},l,b).inherit(m).assign(I);let Q=l.getExtractedEnumZodSchemaDataByCode(I);if(!Q)return m.assign(I);if(!Q.zodSchemaName||!Q.tag)throw new Error(`Enum zod schema name or tag not resolved for code: ${I}`);let ae=l.options.tsNamespaces&&Q.tag!==T?`${C_({type:"models",tag:Q.tag,options:l.options})}.`:"";return m.assign(`${ae}${Q.zodSchemaName}`)}t(oUt,"getEnumZodSchema");function oR(l){var u;return`${AW}([${(u=l.enum)==null?void 0:u.map(m=>m===null?"null":`"${m}"`).join(", ")}])`}t(oR,"getEnumZodSchemaCode");function qrt(l){return`${AW}([${l.map(u=>`"${u}"`).join(", ")}])`}t(qrt,"getEnumZodSchemaCodeFromEnumNames");var FW="AppRestClient",Tle={query:"AppQueryOptions",infiniteQuery:"AppInfiniteQueryOptions",mutation:"AppMutationOptions"},Jwe="src/data",KA={ErrorHandler:"ErrorHandler",SharedErrorHandler:"SharedErrorHandler"},kle={bindings:[KA.ErrorHandler,KA.SharedErrorHandler]},qwe="AbilityContext",zrt={bindings:[qwe]},MW={dynamicInputs:"dynamicInputs",dynamicColumns:"dynamicColumns"};var Cle={reactQueryTypes:{fileName:"react-query.types",extension:"ts"},restClient:{fileName:"rest-client",extension:"ts"},restInterceptor:{fileName:"rest-interceptor",extension:"ts"}},Ele={fileName:"app-rest-client",extension:"ts"},zwe="QueryModule",Ple={fileName:"queryModules",extension:"ts"},Vrt={fileName:"queryConfig.context",extension:"tsx"},cR={optionsType:"MutationEffectsOptions",hookName:"useMutationEffects",runFunctionName:"runMutationEffects"},wle={fileName:"useMutationEffects",extension:"ts"},dS={namespace:"ZodExtended",exports:{parse:"parse",sortExp:"sortExp"}},Ale={fileName:"zod.extended",extension:"ts"};var x8=t((l,u)=>Cwe(u_(Rwe(l)),u),"getZodSchemaName"),RW=t((l,u,m)=>Cwe(u_(Rwe(l)),`${u}${m}`),"getEnumZodSchemaName"),wh=t(l=>["z.",`${dS.namespace}.`].every(u=>!l.startsWith(u)),"isNamedZodSchema"),Urt=t(l=>l.startsWith(AW),"isEnumZodSchema"),T8=t((l,u,m)=>u?l:`${m}_${l}`,"getZodSchemaOperationName"),Dle=t(l=>ny(`${l}_${xrt}`),"getBodyZodSchemaName"),Wrt=t((l,u)=>ny(`${l}_${u}${Trt}`),"getParamZodSchemaName"),cUt=t(l=>ny(`${l}${krt}`),"getMainResponseZodSchemaName"),lUt=t((l,u)=>ny(`${l}_${u}_${Crt}`),"getErrorResponseZodSchemaName");function Ile({statusCode:l,operationName:u,isUniqueOperationName:m,tag:b}){let T=Number(l),I=T8(u,m,b);return!NW(T)&&l!=="default"&&vle(T)?lUt(I,l):cUt(I)}t(Ile,"getResponseZodSchemaName");function lR({schema:l,zodSchema:u,fallbackName:m,resolver:b,tag:T}){var Q;let I=u.getCodeString();if((!wh(I)||u.ref===void 0)&&m){if(u.complexity<Awe)return I;let ae=x8(m,b.options.schemaSuffix);for(;b.getCodeByZodSchemaName(ae);){if((Q=b.getZodSchemaNamesByCompositeCode(I))!=null&&Q.includes(ae))return ae;if(b.getCodeByZodSchemaName(ae)===ae)return ae;throw new Error(`Can't uniquely resolve zod schema name: ${ae}`)}return b.setZodSchema(ae,I,T),b.addZodSchemaForCompositeCode(I,u,ae,l),ae}let L=b.getCodeByZodSchemaName(I);if(!L&&u.ref&&(L=b.getCodeByZodSchemaName(b.getZodSchemaNameByRef(u.ref))),u.ref&&L)return hg(0,b.getSchemaByRef(u.ref))<Awe?b.getCodeByZodSchemaName(I):I;if(u.ref)return b.getZodSchemaNameByRef(u.ref);throw new Error(`Invalid ref: ${u.ref}`)}t(lR,"resolveZodSchemaName");var Hrt=t(l=>/^(?:[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+)$/.test(l),"isValidPropertyName"),e3=t(l=>l.replace(/^[^a-zA-Z_$]*/g,"").replace(/[^a-zA-Z0-9_$]+(\w)?/g,(u,m)=>(m==null?void 0:m.toUpperCase())??""),"invalidVariableNameCharactersToCamel");function k8(l,u){let m={};return Object.keys(l).forEach(b=>{u.includes(b)&&(m[b]=l[b])}),m}t(k8,"pick");function Grt(l,...u){if(u.length===0)return l;let m=l;for(let b of u)m=Qrt(m,b);return m}t(Grt,"deepMerge");function Qrt(l,u){if(u==null)return l;if(l==null)return uR(u);if(Array.isArray(l)&&Array.isArray(u))return[...l,...u];if(LW(l)&&LW(u)){let m={};for(let[b,T]of Object.entries(l))m[b]=uR(T);for(let[b,T]of Object.entries(u)){let I=m[b];T!==void 0&&(T===null?m[b]=T:LW(I)&&LW(T)?m[b]=Qrt(I,T):Array.isArray(I)&&Array.isArray(T)?m[b]=[...I,...T]:m[b]=uR(T))}return m}return uR(u)}t(Qrt,"mergeTwoValues");function uR(l){if(l==null||typeof l!="object")return l;if(Array.isArray(l))return l.map(u=>uR(u));if(LW(l)){let u={};for(let[m,b]of Object.entries(l))u[m]=uR(b);return u}return l}t(uR,"deepClone");function LW(l){return l!==null&&typeof l=="object"&&!Array.isArray(l)&&Object.prototype.toString.call(l)==="[object Object]"}t(LW,"isPlainObject");var Vwe=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with"];function fR(l,u){let m=l.deprecated&&!u.withDeprecatedEndpoints,b=VA(l,u),T=hrt(b,u);return m||T}t(fR,"isOperationExcluded");function Uwe({path:l,method:u,operation:m,options:b,tag:T,keepOperationTag:I,keepOperationPrefix:L}){let Q=`${u}${jrt(l)}`,ae=m.operationId?e3(m.operationId):Q;if(b.removeOperationPrefixEndingWith&&L)ae=ae.split(b.removeOperationPrefixEndingWith).map((pe,Te)=>Te===0?pe:u_(pe)).join("");else if(b.removeOperationPrefixEndingWith&&!L){let ee=new RegExp(`^.*${b.removeOperationPrefixEndingWith}`);ae=ae.replace(ee,"")}if(b.tsNamespaces&&!I){let ee=mrt(ae,T);ee===""?ae=u.toLowerCase():Vwe.includes(ee)||(ae=ee)}return Vwe.includes(ae)?Q:ae}t(Uwe,"getOperationName");function jW({operationsByTag:l,...u}){let{operation:m,options:b}=u,T=b.splitByTags?VA(m,b):b.defaultTag,I=t(L=>{let Q=Uwe({...u,tag:T,keepOperationTag:L});if(l[T].filter(ee=>Uwe({...u,operation:ee,tag:T,keepOperationTag:L})===Q).length===1)return Q},"operationName");return I()??I(!0)??Uwe({...u,tag:T,keepOperationTag:!0,keepOperationPrefix:!0})}t(jW,"getUniqueOperationName");function Zrt(l,u,m){let b=[];for(let T in l.paths){if(b8(T,m))continue;let I=l.paths[T],L=k8(I,g8);for(let Q in L){let ae=L[Q];if(!ae||fR(ae,m))continue;let ee=jW({path:T,method:Q,operation:ae,operationsByTag:u,options:m});b.push(ee)}}return b}t(Zrt,"getUniqueOperationNamesWithoutSplitByTags");function Xrt(l,u){let m={};for(let b in l.paths){if(b8(b,u))continue;let T=l.paths[b],I=k8(T,g8);for(let L in I){let Q=I[L];if(!Q||fR(Q,u))continue;let ae=u.splitByTags?VA(Q,u):u.defaultTag;m[ae]||(m[ae]=[]),m[ae].push(Q)}}return m}t(Xrt,"getOperationsByTag");function BW(l){return{type:"invalid-schema",message:l}}t(BW,"getInvalidSchemaError");function Yrt(l){return{type:"invalid-operation-id",message:`Operation ${l}`}}t(Yrt,"getInvalidOperationIdError");function Krt(l,u){return{type:"missing-path-parameter",message:`Path ${u} is missing [${l.map(({name:m})=>m).join(", ")}]`}}t(Krt,"getMissingPathParameterError");function ent(l){return{type:"not-allowed-inline-enum",message:`${l} is missing @IsEnum() and @ApiProperty(enum:, enumName:)`}}t(ent,"getNotAllowedInlineEnumError");function tnt(l,u,m){return{type:"missing-acl-condition-property",message:`Condition property ${l} is not found in parameters or body in operation ${Ole(u,m)}`}}t(tnt,"getMissingAclConditionPropertyError");function Wwe(l,u,m){return{type:"missing-status-code",message:`Missing HTTP status code ${Nle(l)} in operation ${Ole(u,m)}`}}t(Wwe,"getMissingStatusCodeError");function rnt(l,u,m){return{type:"invalid-status-code",message:`Operation ${Ole(u,m)} expected HTTP status code ${Nle(l.expected)} but received ${Nle(l.received)}`}}t(rnt,"getInvalidStatusCodeError");function nnt(l,u,m){return{type:"multiple-success-status-codes",message:`Operation ${Ole(u,m)} has multiple success HTTP status codes: ${l.map(Nle).join(", ")}`}}t(nnt,"getMultipleSuccessStatusCodesError");function Ole(l,u){return l.operationId??`${u.method} ${u.path}`}t(Ole,"getOperationDescriptor");function Nle(l){return`${l} (${urt[l]})`}t(Nle,"getStatusCodeDescription");function int(l){return l.reduce((u,m)=>({...u,[m.type]:[...u[m.type]??[],m.message]}),{})}t(int,"groupByType");var i6=Vd(ple());var Fle=t(l=>l.method===i6.OpenAPIV3.HttpMethods.GET,"isGetEndpoint"),Hwe=t((l,u)=>Fle(l)&&Object.values(u.infiniteQueryParamNames).every(m=>l.parameters.some(b=>b.name===m&&b.type==="Query")),"isPaginatedGetEndpoint"),snt=t((l,u)=>l.method===i6.OpenAPIV3.HttpMethods.GET&&!_R(l.pathSegments.at(-1))&&Hwe(l,u),"isReadAllEndpoint"),ant=t((l,u)=>l.method===i6.OpenAPIV3.HttpMethods.GET&&Gwe(l,u),"isReadEndpoint"),ont=t((l,u)=>l.method===i6.OpenAPIV3.HttpMethods.POST&&pnt(l,u),"isCreateEndpoint"),cnt=t((l,u)=>[i6.OpenAPIV3.HttpMethods.PUT,i6.OpenAPIV3.HttpMethods.PATCH].includes(l.method)&&Gwe(l,u),"isUpdateEndpoint"),lnt=t((l,u)=>l.method===i6.OpenAPIV3.HttpMethods.DELETE&&Gwe(l,u),"isDeleteEndpoint"),unt=t((l,u)=>l.method===i6.OpenAPIV3.HttpMethods.DELETE&&pnt(l,u),"isBulkDeleteEndpoint"),fnt=t(l=>l.split("/").filter(Boolean),"getPathSegments"),_R=t(l=>l==null?void 0:l.startsWith(":"),"isPathSegmentParam"),_nt=t((l,u)=>u.pathSegments.every((m,b)=>_R(m)&&_R(l.pathSegments[b])||m===l.pathSegments[b]),"hasMatchingPath"),pnt=t((l,u)=>l.pathSegments.length===u.pathSegments.length&&_nt(l,u),"hasMatchingPathWithoutTrailingParam"),Gwe=t((l,u)=>l.pathSegments.length-1===u.pathSegments.length&&_R(l.pathSegments.at(-1))&&_nt(l,u),"hasMatchingPathWithTrailingParam");var Ont=Vd(ple());var Mle={fileName:"acl/app.ability",extension:"ts"},$W="AppAbilities",Rle={fileName:"acl/useAclCheck",extension:"ts"},t3="useAclCheck",sy={abilityTuple:"AbilityTuple",pureAbility:"PureAbility",forcedSubject:"ForcedSubject",subjectType:"Subject",subject:"subject"},Qwe={bindings:[sy.abilityTuple,sy.pureAbility,sy.forcedSubject,sy.subjectType,sy.subject],from:"@casl/ability"};var Ib=t((...l)=>[...new Set(l.flat())],"getUniqueArray");var JW=t(l=>`canUse${u_(ny(l.operationName))}`,"getAbilityFunctionName"),Lle=t((l,u)=>`${u.tsNamespaces?`${C_({type:"acl",tag:Y1(l,u),options:u})}.`:""}${JW(l)}`,"getImportedAbilityFunctionName"),Zwe=t(l=>{var u;return(u=l.acl)==null?void 0:u[0].action},"getAbilityAction"),Xwe=t(l=>{var u;return(u=l.acl)==null?void 0:u[0].subject},"getAbilitySubject"),qW=t(l=>{var u;return!!((u=pR(l))!=null&&u.length)},"hasAbilityConditions"),pR=t(l=>{var u,m;return(m=(u=l.acl)==null?void 0:u[0].conditionsTypes)==null?void 0:m.sort((b,T)=>b.name.localeCompare(T.name))},"getAbilityConditionsTypes"),dnt=t(l=>{var u;return(u=l.acl)==null?void 0:u[0].description},"getAbilityDescription"),Ywe=t(l=>{var b;let u=Xwe(l),m=[`"${u??""}"`];return qW(l)&&m.push(`ForcedSubject<"${u}"> & { ${(b=pR(l))==null?void 0:b.map(T=>`${T.name}${T.required?"":"?"}: ${T.type??""}${T.zodSchemaName??""},`).join(" ")} }`),m},"getAbilitySubjectTypes");function Kwe({resolver:l,data:u,tag:m}){var Q;let b=(Q=u.get(m))==null?void 0:Q.endpoints.filter(({acl:ae})=>ae&&ae.length>0);if(!b||b.length===0)return;let T=b.some(({acl:ae})=>(ae==null?void 0:ae[0].conditions)&&Object.keys(ae[0].conditions).length>0),I=b.reduce((ae,ee)=>{var Te,Ke;let pe=(Ke=(Te=ee.acl)==null?void 0:Te[0].conditionsTypes)==null?void 0:Ke.reduce((Pt,rr)=>[...Pt,...rr!=null&&rr.zodSchemaName?[rr.zodSchemaName]:[]],[]);return[...ae,...pe??[]]},[]),L=RC({resolver:l,tag:m,zodSchemasAsTypes:Ib(I)});return{endpoints:b,hasAdditionalAbilityImports:T,modelsImports:L}}t(Kwe,"getAclData");var mnt=t(({resolver:l,data:u})=>{let m=new Map,b=[],T=!1;u.forEach((Q,ae)=>{let ee=Kwe({resolver:l,data:u,tag:ae});if(!ee)return;let{modelsImports:pe,hasAdditionalAbilityImports:Te,endpoints:Ke}=ee;b.push(pe),T=T||Te,Ke.forEach(Pt=>{let rr=Zwe(Pt);rr&&m.set(rr,new Set([...m.get(rr)??[],...Ywe(Pt)]))})});let I=zW(l.options,...b);return{appAbilitiesType:m.size>0?Object.fromEntries(Array.from(m.entries()).map(([Q,ae])=>[Q,Array.from(ae)])):void 0,modelsImports:I,hasAdditionalAbilityImports:T}},"getAppAbilitiesType");var VW=t((l,u)=>{let m=mS(l)&&r3(l)&&u;return`use${u_(ny(l.operationName))}${m?"Mutation":""}`},"getQueryName"),UW=t(l=>`use${u_(ny(l.operationName))}Infinite`,"getInfiniteQueryName"),C8=t((l,u)=>`${u.tsNamespaces?`${C_({type:"queries",tag:Y1(l,u),options:u})}.`:""}${VW(l)}`,"getImportedQueryName"),hnt=t((l,u)=>`${u.tsNamespaces?`${C_({type:"queries",tag:Y1(l,u),options:u})}.`:""}${UW(l)}`,"getImportedInfiniteQueryName");function X0(l,u){if(!l)return;let{data:m,onSchema:b}=u;if(gf(l)&&b({type:"reference",schema:l,data:m})===!0)return;let T=l;if(PW.some(I=>I in T&&T[I])){let I=T.allOf??T.anyOf??T.oneOf??[];for(let L of I)(b==null?void 0:b({type:"composite",parentSchema:l,schema:L,data:m}))!==!0&&X0(L,{data:m,onSchema:b})}if(T.properties)for(let[I,L]of Object.entries(T.properties))b({type:"property",parentSchema:l,schema:L,data:m,propertyName:I})!==!0&&X0(L,u);if(T.additionalProperties&&typeof T.additionalProperties=="object"){if(b({type:"additionalProperties",parentSchema:l,schema:T.additionalProperties,data:m})===!0)return;X0(T.additionalProperties,u)}if(T.type==="array"){let I=l.items;if(b({type:"array",parentSchema:l,schema:I,data:m})===!0)return;X0(I,u)}}t(X0,"iterateSchema");function WW(l){return["minimum","exclusiveMinimum","maximum","exclusiveMaximum","minItems","minLength","minProperties","maxItems","maxLength","maxProperties","default","example"].filter(b=>l[b]).reduce((b,T)=>[...b,`${u_(ule(T))}: \`${l[T]}\``],[])}t(WW,"getSchemaDescriptions");var HW=t((l,u)=>prt(l,u.schemaSuffix),"getZodSchemaInferedTypeName"),P8=t((l,u)=>wh(u)?`${l.options.tsNamespaces?`${C_({type:"models",tag:l.getTagByZodSchemaName(u),options:l.options})}.`:""}${u}`:u,"getImportedZodSchemaName"),E8=t((l,u,m)=>{if(!wh(u))return u===wW?"void":u;let b=l.getTagByZodSchemaName(u);return`${l.options.tsNamespaces&&b!==m?`${C_({type:"models",tag:b,options:l.options})}.`:""}${HW(u,l.options)}`},"getImportedZodSchemaInferedTypeName");function gnt(l){var u;return l.isEnum?"enum":((u=l.schemaObj)==null?void 0:u.type)??"object"}t(gnt,"getZodSchemaType");function ynt(l){if(l.schemaObj)return[l.schemaObj.description,...WW(l.schemaObj)].filter(Boolean).join(". ")}t(ynt,"getZodSchemaDescription");function vnt(l,u,m){var b;if(gf(u)){let T=l.getZodSchemaNameByRef(u.$ref);return T?E8(l,T,m):void 0}if(yle(u)){if(!gf(u.items))return`${((b=u.items)==null?void 0:b.type)??"unknown"}[]`;let T=l.getZodSchemaNameByRef(u.items.$ref);return T?`${E8(l,T,m)}[]`:void 0}if(PW.some(T=>T in u&&u[T])){let T=u.allOf??u.anyOf??u.oneOf??[];if(T.length>0)return vnt(l,T[0],m)}return u.type}t(vnt,"getType");function bnt(l,u,m){if(!u.schemaObj)return[];let b="[0]",T="[key]",I={},L=t(Q=>{var ee;if(Q.type==="reference")return!0;if(Q.type==="composite")return;let ae=[...((ee=Q.data)==null?void 0:ee.pathSegments)??[]];if(Q.type==="array"?ae.push(b):Q.type==="property"?ae.push(Q.propertyName):Q.type==="additionalProperties"&&ae.push(T),Q.schema&&ae[ae.length-1]!==b){let pe=l.resolveObject(Q.schema),Te=[pe.description,...WW(pe)].filter(Boolean),Ke=ae.join(".");I[Ke]&&"type"in Q.schema&&Q.schema.type==="object"||(delete I[Ke],I[Ke]={type:vnt(l,Q.schema,m)??"unknown",description:Te.join(". ")})}return X0(Q.schema,{data:{pathSegments:[...ae]},onSchema:L}),!0},"onSchema");return"allOf"in u.schemaObj&&u.schemaObj.allOf&&u.schemaObj.allOf.forEach(Q=>{if(gf(Q)){let ae=l.resolveObject(Q);X0(ae,{data:{pathSegments:[]},onSchema:L})}}),X0(u.schemaObj,{data:{pathSegments:[]},onSchema:L}),I}t(bnt,"getZodSchemaPropertyDescriptions");function RC({resolver:l,tag:u,zodSchemas:m=[],zodSchemasAsTypes:b=[]}){let T="models",I=t(ae=>l.getTagByZodSchemaName(ae),"getTag"),L=dR({type:T,tag:u,entities:m,getTag:I,getEntityName:t(ae=>ae,"getEntityName"),options:l.options}),Q=dR({type:T,tag:u,entities:b,getTag:I,getEntityName:t(ae=>HW(ae,l.options),"getEntityName"),options:l.options});return zW(l.options,L,Q)}t(RC,"getModelsImports");function Snt({tag:l,endpoints:u,options:m}){return dR({type:"endpoints",tag:l,entities:u,getTag:t(b=>Y1(b,m),"getTag"),getEntityName:GW,options:m})}t(Snt,"getEndpointsImports");function xnt({tag:l,endpoints:u,options:m}){return dR({type:"queries",tag:l,entities:u,getTag:t(b=>Y1(b,m),"getTag"),getEntityName:VW,options:m})}t(xnt,"getQueriesImports");function Tnt({tag:l,endpoints:u,options:m}){return dR({type:"queries",tag:l,entities:u,getTag:t(b=>Y1(b,m),"getTag"),getEntityName:UW,options:m})}t(Tnt,"getInfiniteQueriesImports");function jle({tag:l,endpoints:u,options:m}){return dR({type:"acl",tag:l,entities:u,getTag:t(b=>Y1(b,m),"getTag"),getEntityName:JW,options:m})}t(jle,"getAclImports");function s6(l){let u=l.tsPath;return l.importPath==="relative"?u="../":l.importPath==="absolute"?u=l.output:new RegExp(`${Jwe}`,"g").test(l.output)&&(u=l.output.replace(new RegExp(`.*${Jwe}`,"g"),l.tsPath)),`${u}/`.replace(/\/\//g,"/")}t(s6,"getImportPath");function dR({type:l="models",tag:u,entities:m,getTag:b,getEntityName:T,options:I}){let L=new Map;return m.forEach(Q=>{let ae=b(Q);if(L.has(ae))I.tsNamespaces||L.get(ae).bindings.push(T(Q));else{let ee=u===ae;L.set(ae,{bindings:[I.tsNamespaces?C_({type:l,tag:ae,options:I}):T(Q)],from:`${ee?"./":s6(I)}${eAe({type:l,tag:ae,includeTagDir:!ee,options:I})}`})}}),Array.from(L.values())}t(dR,"getImports");function zW(l,...u){let m=new Map;return u.forEach(b=>{b.forEach(T=>{m.has(T.from)?l.tsNamespaces||m.get(T.from).bindings.push(...T.bindings):m.set(T.from,T)})}),Array.from(m.values()).map(b=>({...b,bindings:Ib(b.bindings)}))}t(zW,"mergeImports");function w8({fileName:l,extension:u}){return`${l}.${u}`}t(w8,"getFileNameWithExtension");function knt({type:l,tag:u,options:m,includeTagDir:b=!0}){let T=m.configs[l].outputFileNameSuffix;return u?`${b?`${zA(u)}/`:""}${zA(u)}.${T}`:T}t(knt,"getTagFileNameWithoutExtension");function eAe(...l){return knt(...l)}t(eAe,"getTagImportPath");function Ble(...l){return`${knt(...l)}.ts`}t(Ble,"getTagFileName");function Cnt(l){return l.standalone?`${s6(l)}${Ele.fileName}`:l.restClientImportPath}t(Cnt,"getAppRestClientImportPath");function Ent(l){return l.standalone?`${s6(l)}${Cle.reactQueryTypes.fileName}`:l.queryTypesImportPath}t(Ent,"getQueryTypesImportPath");function Pnt(l){return`${s6(l)}${Ple.fileName}`}t(Pnt,"getQueryModulesImportPath");function wnt(l){return`${s6(l)}${wle.fileName}`}t(wnt,"getMutationEffectsImportPath");function Ant(l){return`${s6(l)}${Rle.fileName}`}t(Ant,"getAclCheckImportPath");function Dnt(l){return`${s6(l)}${Ale.fileName}`}t(Dnt,"getZodExtendedImportPath");function Int(l){return`${s6(l)}${Mle.fileName}`}t(Int,"getAppAbilitiesImportPath");function Nnt(l){return Xy(l).with("string",()=>"string").with("number",()=>"number").with("integer",()=>"number").with("boolean",()=>"boolean").exhaustive()}t(Nnt,"primitiveTypeToTsType");var GW=t(l=>zA(ny(l.operationName)),"getEndpointName");function Fnt(l,u){return`${u.tsNamespaces?`${C_({type:"endpoints",tag:Y1(l,u),options:u})}.`:""}${GW(l)}`}t(Fnt,"getImportedEndpointName");var Mnt=t(l=>l.method!==Ont.OpenAPIV3.HttpMethods.GET,"requiresBody"),n3=t(l=>l.parameters.find(u=>u.type==="Body"),"getEndpointBody"),Rnt=t((l,u)=>{let m=tAe(l),b=u.options.axiosRequestConfig;return Object.keys(m).length>0||b},"hasEndpointConfig"),Lnt=t(l=>l.path.replace(/:([a-zA-Z0-9_]+)/g,"${$1}"),"getEndpointPath");function i3(l,u,m){let b=u.parameters.map(T=>{var L,Q,ae,ee;let I="string";if(wh(T.zodSchema))I=E8(l,T.zodSchema);else if((L=T.parameterObject)!=null&&L.schema&&iy(T.parameterObject.schema)){let pe=(ae=(Q=T.parameterObject)==null?void 0:Q.schema)==null?void 0:ae.type;pe&&v8(pe)&&(I=Nnt(pe))}return{name:e3(T.name),type:I,paramType:T.type,required:((ee=T.parameterObject)==null?void 0:ee.required)??!0,parameterObject:T.parameterObject,bodyObject:T.bodyObject}});return m!=null&&m.includeFileParam&&u.mediaUpload&&b.push({name:"file",type:"File",paramType:"Body",required:!1,parameterObject:void 0,bodyObject:void 0}),b.sort((T,I)=>{if(T.required===I.required){let L=["Path","Body","Query","Header"];return L.indexOf(T.paramType)-L.indexOf(I.paramType)}return T.required?-1:1}).filter(T=>(!(m!=null&&m.excludeBodyParam)||T.name!==fle)&&(!(m!=null&&m.excludePageParam)||T.name!==l.options.infiniteQueryParamNames.page)&&(!(m!=null&&m.includeOnlyRequiredParams)||T.required)).map(T=>({...T,name:m!=null&&m.replacePageParam&&T.name===l.options.infiniteQueryParamNames.page?"pageParam":T.name,required:T.required&&(T.paramType==="Path"||!(m!=null&&m.pathParamsRequiredOnly))}))}t(i3,"mapEndpointParamsToFunctionParams");function tAe(l){let u=l.parameters.filter(T=>T.type==="Query").map(T=>{let I=Hrt(T.name)?T.name:`"${T.name}"`,L=e3(T.name);return{...T,name:I,value:L}}),m={};return l.requestFormat!==Pwe["Content-Type"]&&(m["Content-Type"]=`'${l.requestFormat}'`),l.responseFormat&&l.responseFormat!==Pwe.Accept&&(m.Accept=`'${l.responseFormat}'`),l.parameters.filter(T=>T.type==="Header").forEach(T=>{m[T.name]=e3(T.name)}),{...u.length>0?{params:u}:{},...Object.keys(m).length?{headers:m}:{}}}t(tAe,"getEndpointConfig");function jnt(l,u){return u.filter(m=>mS(m)&&m.parameters.filter(b=>{var T;return(T=b.parameterObject)==null?void 0:T.required}).every(b=>l.parameters.some(T=>T.name===b.name))&&m.response===l.response)}t(jnt,"getUpdateQueryEndpoints");var mS=t(l=>Fle(l),"isQuery"),r3=t(l=>!Fle(l)||!!l.mediaDownload,"isMutation"),mR=t((l,u)=>Hwe(l,u),"isInfiniteQuery"),Bnt=t((l,u,m)=>{let b=m.reduce((T,I)=>[...T,...i3(l,I,{includeOnlyRequiredParams:!0}).map(L=>L.name)],[]);return i3(l,u,{includeOnlyRequiredParams:!0,excludeBodyParam:!0}).filter(T=>b.includes(T.name)).map(T=>T.name)},"getDestructuredVariables");function $nt({resolver:l,endpoint:u,operation:m}){let b=m["x-acl"];return b==null?void 0:b.map(T=>{let I=Object.keys(T.conditions??{}).reduce((L,Q)=>{let ae=uUt({resolver:l,endpoint:u,acl:b,name:Q});return ae?[...L,ae]:(l.validationErrors.push(tnt(Q,m,u)),L)},[]);return{...T,conditionsTypes:I}})}t($nt,"getEndpointAcl");function uUt({resolver:l,endpoint:u,acl:m,name:b}){var Te,Ke,Pt,rr,or,Lt,Xt,Vt,Ti,zn;let T=(Ke=(Te=m[0])==null?void 0:Te.conditions)==null?void 0:Ke[b];if(!T)return;let I=T.replace(/^\$[^.]*\./,"").split("."),L,Q,ae,ee=0,pe=u.parameters.find(({name:_i})=>_i===I[ee]);if(pe)Q=(Pt=pe.parameterObject)==null?void 0:Pt.required,L=(rr=pe.parameterObject)==null?void 0:rr.schema,ae=`${pe.name} ${zA(pe.type)} parameter`,ee++;else{let _i=u.parameters.find(({bodyObject:ql})=>!!ql),Vn=Object.keys(((or=_i==null?void 0:_i.bodyObject)==null?void 0:or.content)??{}).find(FC);Vn&&(L=(Vt=(Xt=(Lt=_i==null?void 0:_i.bodyObject)==null?void 0:Lt.content)==null?void 0:Xt[Vn])==null?void 0:Vt.schema,ae=`${mS(u)?"query":"mutation"} data`)}for(;L&&ee<I.length;){let _i=l.resolveObject(L);L=(Ti=Object.entries(_i.properties??{}).find(([Vn])=>Vn===I[ee]))==null?void 0:Ti[1],Q=((zn=_i.required)==null?void 0:zn.includes(I[ee]))??!1,ee++}if(L)return{name:b,type:gf(L)?void 0:L.type,zodSchemaName:gf(L)?l.getZodSchemaNameByRef(L.$ref):void 0,required:Q,info:ae}}t(uUt,"getEndpointAclConditionPropertyType");function Jnt({resolver:l,operation:u,operationName:m,isUniqueOperationName:b,tag:T}){var Pt,rr;let I=l.resolveObject(u.requestBody);if(!I)return;let Q=Object.keys(I.content??{}).find(FC);if(!Q)return;let ae=(rr=(Pt=I.content)==null?void 0:Pt[Q])==null?void 0:rr.schema;if(!ae)return;let ee=Hd({schema:ae,resolver:l,meta:{isRequired:I.required??!0},tag:T}),pe=l.resolveObject(ae),Te=lR({schema:pe,zodSchema:ee,fallbackName:Dle(T8(m,b,T)),resolver:l,tag:T}),Ke=MC({schema:pe,meta:ee.meta,options:l.options});return{endpointParameter:{name:fle,type:"Body",description:I.description,zodSchema:Te+Ke,bodyObject:I},requestFormat:Q}}t(Jnt,"getEndpointBody");function qnt({resolver:l,param:u,operationName:m,isUniqueOperationName:b,tag:T}){let I=l.resolveObject(u);if(!yrt.includes(I.in))return;let L={};if(I.content){let Pt=Object.keys(I.content??{}),rr=Pt.find(FC);if(!rr)throw new Error(`Unsupported media type for param ${I.name}: ${Pt.join(", ")}`);let or=I.content[rr];if(!or)throw new Error(`No content with media type for param ${I.name}: ${rr}`);L=(or==null?void 0:or.schema)??or}else I.schema&&(L=I.schema);l.options.withDescription&&L&&(L.description=(I.description??"").trim());let Q=Wrt(T8(m,b,T),I.name),ae;if(Sle(I)){let Pt=RW(Q,l.options.enumSuffix,l.options.schemaSuffix),rr=qrt(I["x-enumNames"]);l.setZodSchema(Pt,rr,T),ae=Pt}let ee=Hd({schema:L,resolver:l,meta:{isRequired:I.in==="path"?!0:I.required??!1},tag:T}),pe=l.resolveObject(L),Te=MC({schema:pe,meta:ee.meta,options:l.options}),Ke=lR({schema:pe,zodSchema:ee.assign(ee.getCodeString(T)+Te),fallbackName:Q,resolver:l,tag:T});return{name:Xy(I.in).with("path",()=>jwe(I.name)).otherwise(()=>I.name),type:Xy(I.in).with("header",()=>"Header").with("query",()=>"Query").with("path",()=>"Path").run(),zodSchema:Ke,parameterObject:I,parameterSortingEnumSchemaName:ae}}t(qnt,"getEndpointParameter");function Vnt(l){var m,b,T,I,L;let u=[];for(let Q in l.openApiDoc.paths){if(b8(Q,l.options))continue;let ae=l.openApiDoc.paths[Q],ee=k8(ae,g8),pe=znt(ae.parameters??[]);for(let Te in ee){let Ke=ee[Te];if(!Ke||fR(Ke,l.options))continue;let Pt=Ke.operationId&&Ke.operationId!==e3(Ke.operationId);Ke.operationId&&Pt&&l.validationErrors.push(Yrt(Ke.operationId));let rr=Object.entries({...pe,...znt(Ke.parameters??[])}).map(([,_i])=>_i),or=jW({path:Q,method:Te,operation:Ke,operationsByTag:l.operationsByTag,options:l.options}),Lt=l.operationNames.filter(_i=>_i===or).length<=1,Xt=VA(Ke,l.options),Vt={method:Te,path:Brt(Q),operationName:or,description:Ke.description,summary:Ke.summary,tags:(m=Ke.tags)==null?void 0:m.map(m8),requestFormat:h8,parameters:[],response:"",errors:[],responseStatusCodes:[],mediaUpload:!!Ke["x-media-upload"],mediaDownload:!!Ke["x-media-download"]};if(Ke.requestBody){let _i=Jnt({resolver:l,operation:Ke,operationName:or,isUniqueOperationName:Lt,tag:Xt});_i&&(Vt.parameters.push(_i.endpointParameter),Vt.requestFormat=_i.requestFormat)}for(let _i of rr){let vo=qnt({resolver:l,param:_i,operationName:or,isUniqueOperationName:Lt,tag:Xt});vo&&Vt.parameters.push(vo)}let Ti=fUt(Vt);Ti.forEach(_i=>{Vt.parameters.push(_i)}),Ti.length>0&&l.validationErrors.push(Krt(Ti,Q));for(let _i in Ke.responses){Vt.responseStatusCodes.push(_i);let vo=l.resolveObject(Ke.responses[_i]),ql=Object.keys(vo.content??{}).find(ble),zl,ia;if(ql?(Vt.responseFormat=ql,zl=(T=(b=vo.content)==null?void 0:b[ql])==null?void 0:T.schema):(ia=wW,_i==="200"&&l.validationErrors.push(rnt({received:"200",expected:"204"},Ke,Vt))),zl){let lr=Hd({schema:zl,resolver:l,meta:{isRequired:!0},tag:Xt}),xs=l.resolveObject(zl);ia=lR({schema:xs,zodSchema:lr,fallbackName:lr.ref?void 0:Ile({statusCode:_i,operationName:or,isUniqueOperationName:Lt,tag:Xt}),resolver:l,tag:Xt})+MC({schema:xs,meta:lr.meta,options:l.options})}if(ia){let lr=Number(_i);NW(lr)&&!Vt.response?(Vt.response=ia,Vt.responseObject=vo,Vt.responseDescription=vo.description):_i!=="default"&&vle(lr)&&Vt.errors.push({zodSchema:ia,status:lr,description:vo.description})}}Vt.response||(Vt.response=wW);let zn=Object.keys(Ke.responses).map(Number).filter(NW);zn.length>1&&l.validationErrors.push(nnt(zn.map(String),Ke,Vt)),Vt.acl=$nt({resolver:l,endpoint:Vt,operation:Ke}),(I=Ke.security)!=null&&I[0].Authorization&&!Vt.responseStatusCodes.includes("401")&&l.validationErrors.push(Wwe("401",Ke,Vt)),(L=Vt.acl)!=null&&L[0]&&!Vt.responseStatusCodes.includes("403")&&l.validationErrors.push(Wwe("403",Ke,Vt)),u.push(Vt)}}return u}t(Vnt,"getEndpointsFromOpenAPIDoc");function znt(l){return Object.fromEntries((l??[]).map(u=>[gf(u)?u.$ref:u.name,u]))}t(znt,"getParameters");function fUt(l){return[...l.path.matchAll(/:([a-zA-Z0-9_]+)/g)].map(m=>m[1]).filter(m=>l.parameters.findIndex(({name:b})=>b===m)===-1).map(m=>_Ut(m))}t(fUt,"getMissingPathParameters");function _Ut(l){return{name:l,type:"Path",zodSchema:mle,parameterObject:{name:l,required:!0,in:"path",schema:{type:"string"}}}}t(_Ut,"getPathParameterFromName");function Unt(l,u){let m=pUt(l,u),b=dUt(l,m);return{refsDependencyGraph:m,deepDependencyGraph:b}}t(Unt,"getOpenAPISchemaDependencyGraph");function pUt(l,u){let m={},b={};return l.forEach(T=>mUt({schema:u(T),fromRef:T,getSchemaByRef:u,visitedRefs:m,refsDependencyGraph:b})),b}t(pUt,"getRefsDependencyGraph");function dUt(l,u){let m={},b={},T=t((I,L)=>{b[L].add(I),u[I]&&L!==I&&u[I].forEach(Q=>{let ae=`${L}__${Q}`;m[ae]||(m[ae]=!0,T(Q,L))})},"visit");return l.forEach(I=>{let L=u[I];L&&(b[I]||(b[I]=new Set),L.forEach(Q=>T(Q,I)))}),b}t(dUt,"getDeepRefsDependencyGraph");function mUt({schema:l,fromRef:u,getSchemaByRef:m,visitedRefs:b={},refsDependencyGraph:T={}}){let I=t(L=>{if(L.type!=="reference"||!L.data)return;let{schema:Q,data:ae}=L;if(T[ae.fromRef]||(T[ae.fromRef]=new Set),T[ae.fromRef].add(Q.$ref),b[Q.$ref])return!0;b[ae.fromRef]=!0,X0(m(Q.$ref),{data:{fromRef:Q.$ref},onSchema:I})},"onSchema");return X0(l,{data:{fromRef:u},onSchema:I}),{visitedRefs:b,refsDependencyGraph:T}}t(mUt,"getSchemaRefsDependencyGraph");function $le(l,u,m){let b=[];return X0(u,{onSchema:t(I=>{I.type==="reference"?b.push(I.schema):gf(I.parentSchema)&&(I.type==="property"?l.validationErrors.push(BW(`${m} has both reference and properties`)):I.type==="additionalProperties"?l.validationErrors.push(BW(`${m} has both reference and additionalProperties`)):I.type==="array"?l.validationErrors.push(BW(`${m} is both reference and array schema`)):I.type==="composite"&&l.validationErrors.push(BW(`${m} has both reference and composite keyword`)))},"onSchema")}),b}t($le,"getSchemaRefObjs");function Wnt(l,u){return u.map(T=>y8(T.$ref)).reduce((T,I)=>{let L=l.dependencyGraph.deepDependencyGraph[I];return[...T,I,...Array.from(L??[])]},[])}t(Wnt,"getDeepSchemaRefObjs");function Hnt(l){l.extractedEnumZodSchemaData.forEach(m=>{let b=m.meta.zodSchemaNameSegments.map(I=>I[I.length-1]).filter(Boolean),T=Ewe(b);if(!T)throw new Error(`No common last segment found for enum: ${m.code}`);m.zodSchemaName=RW(T,l.options.enumSuffix,l.options.schemaSuffix)});let u=0;for(;u<5&&!rAe(l);)hUt(l,u+2),u++;if(rAe(l)||l.extractedEnumZodSchemaData.filter(b=>!Gnt(l,b)).forEach(b=>{b.zodSchemaName=RW(b.meta.zodSchemaNameSegments[0].map(T=>nAe(u_(T))).join(""),l.options.enumSuffix,l.options.schemaSuffix)}),!rAe(l))throw new Error("Failed to resolve unique names for enum zod schemas")}t(Hnt,"resolveExtractedEnumZodSchemaNames");function rAe(l){return l.extractedEnumZodSchemaData.every(u=>Gnt(l,u))}t(rAe,"allExtractedEnumZodSchemaNamesAreUnique");function hUt(l,u){l.extractedEnumZodSchemaData.forEach(m=>{let b=l.extractedEnumZodSchemaData.filter(({zodSchemaName:T})=>m.zodSchemaName===T);b.length!==1&&gUt(b,u)})}t(hUt,"additionalResolveExtractedEnumZodSchemaName");function gUt(l,u=2){l.forEach(m=>{let b=m.meta.zodSchemaNameSegments.map(T=>T[T.length-u]).filter(Boolean);if(b.length===1){let T=[nAe(u_(b[0])),m.zodSchemaName].filter(Boolean).join("");m.zodSchemaName=T}else{let T=Ewe(b),I=[T?nAe(u_(T)):"",m.zodSchemaName].filter(Boolean).join("");m.zodSchemaName=I}})}t(gUt,"suffixWithPreviousSegmentName");function Gnt(l,u){return l.extractedEnumZodSchemaData.filter(({zodSchemaName:m})=>u.zodSchemaName===m).length===1}t(Gnt,"isUnique");function nAe(l){return l.replace(/(Dto|DTO|Response|Request)/g,"")}t(nAe,"sanitizeName");function Qnt(l){l.extractedEnumZodSchemaData.forEach(u=>{let m=Ib(u.meta.tags);u.tag=m.length===1?m[0]:l.options.defaultTag})}t(Qnt,"resolveExtractedEnumZodSchemaTags");function QW({schema:l,nameSegments:u=[],includeSelf:m,...b}){m&&Znt({schema:l,nameSegments:u,...b}),X0(l,{data:{nameSegments:u},onSchema:t(I=>{var Q;if(I.type==="reference")return!0;let L=[...((Q=I.data)==null?void 0:Q.nameSegments)??[]];I.type==="property"&&L.push(I.propertyName),Znt({schema:I.schema,nameSegments:[...L],...b})},"onSchema")})}t(QW,"updateExtractedEnumZodSchemaData");function Znt({resolver:l,schema:u,schemaRef:m,schemaInfo:b,tags:T,nameSegments:I=[]}){if(!u||gf(u)||!u.enum)return;let L=oR(u),Q=l.extractedEnumZodSchemaData.find(ae=>ae.code===L);Q?(Q.meta.zodSchemaNameSegments.push(I),Q.meta.tags.push(...T),Q.meta.schemaRefs.push(...m?[m]:[]),Q.meta.schemas.push(...u?[u]:[])):l.extractedEnumZodSchemaData.push({code:L,meta:{zodSchemaNameSegments:[I],tags:[...T],schemaRefs:m?[m]:[],schemas:u?[u]:[]}}),l.validationErrors.push(ent(m?`${aR(m)}.${I[I.length-1]}`:b??I.join(".")))}t(Znt,"handleExtractedEnumZodSchemaDataUpdate");function Xnt(l){var b;let u={},m={};return Object.entries(((b=l.openApiDoc.components)==null?void 0:b.schemas)??{}).forEach(([T,I])=>{let L=l.getSchemaDataByName(T);if(l.options.excludeRedundantZodSchemas&&(!L||L.deepRefOperations.length===0&&L.tags.length===0))return;let Q=x8(T,l.options.schemaSuffix);if(u[Q])return;let ae=l.getTagByZodSchemaName(Q),ee=l.resolveObject(I);ee.enum?m[Q]=oR(ee):u[Q]=Hd({schema:I,resolver:l,tag:ae}).getCodeString(ae)}),{zodSchemas:u,enumZodSchemas:m}}t(Xnt,"getZodSchemasFromOpenAPIDoc");function Ynt(l){var m;let u=[];return Object.entries(((m=l.openApiDoc.components)==null?void 0:m.schemas)??{}).forEach(([b,T])=>{let I=x8(b,l.options.schemaSuffix),L=l.resolveObject(T);!u.find(Q=>Q.zodSchemaName===I)&&L.enum&&u.push({zodSchemaName:I,code:oR(L)})}),u}t(Ynt,"getEnumZodSchemasFromOpenAPIDoc");var iAe=class iAe{constructor(u,m){this.openApiDoc=u;this.options=m;this.dependencyGraph=Unt(this.schemaRefs,this.getSchemaByRef.bind(this)),this.enumZodSchemas=Ynt(this),this.operationsByTag=Xrt(u,m),this.operationNames=Zrt(u,this.operationsByTag,m),this.initialize()}schemaData=[];zodSchemaData=[];compositeZodSchemaData=[];dependencyGraph;enumZodSchemas=[];extractedEnumZodSchemaData=[];operationsByTag={};operationNames=[];validationErrors=[];get docSchemas(){var u;return((u=this.openApiDoc.components)==null?void 0:u.schemas)??{}}get schemaRefs(){return Object.keys(this.docSchemas).map(Mrt)}getSchemaByRef(u){return this.docSchemas[aR(u)]}getSchemaDataByName(u){return this.schemaData.find(m=>m.name===u)}getZodSchemaNameByRef(u){var b,T;let m=((b=this.getSchemaDataByRef(y8(u)))==null?void 0:b.zodSchemaName)??((T=this.extractedEnumZodSchemaData.find(I=>I.zodSchemaName===u))==null?void 0:T.zodSchemaName);if(!m)throw new Error(`Zod schema not found for ref: ${u}`);return m}getRefByZodSchemaName(u){var m;return(m=this.schemaData.find(b=>b.zodSchemaName===u))==null?void 0:m.ref}getTagByZodSchemaName(u){var ae,ee;if(!this.options.splitByTags)return this.options.defaultTag;let m=this.extractedEnumZodSchemaData.find(pe=>pe.zodSchemaName===u);if(m)return m8(m.tag??this.options.defaultTag);let b=this.getRefByZodSchemaName(u),T=b?((ae=this.getSchemaDataByRef(b))==null?void 0:ae.tags)??[]:[],I=((ee=this.zodSchemaData.find(pe=>pe.zodSchemaName===u))==null?void 0:ee.tags)??[],L=Ib(T,I),Q=L.length===1?L[0]:this.options.defaultTag;return m8(Q??this.options.defaultTag)}getCodeByZodSchemaName(u){var m;return(m=this.zodSchemaData.find(b=>b.zodSchemaName===u))==null?void 0:m.code}getZodSchemaNamesByCompositeCode(u){var m;return(m=this.compositeZodSchemaData.find(b=>b.code===u))==null?void 0:m.zodSchemas.map(b=>b.zodSchemaName)}setZodSchema(u,m,b){let T=this.zodSchemaData.find(I=>I.zodSchemaName===u);T?(T.code=m,T.tags=(T.tags??[]).concat(b)):this.zodSchemaData.push({zodSchemaName:u,code:m,tags:[b]})}addZodSchemaForCompositeCode(u,m,b,T){let I={zodSchemaName:b,zodSchema:m,schema:T},L=this.compositeZodSchemaData.find(Q=>Q.code===u);L?L.zodSchemas.push(I):this.compositeZodSchemaData.push({code:u,zodSchemas:[I]})}getCompositeZodSchemaByZodSchemaName(u){var b;let m=this.compositeZodSchemaData.find(T=>T.zodSchemas.some(I=>I.zodSchemaName===u));return(b=m==null?void 0:m.zodSchemas.find(T=>T.zodSchemaName===u))==null?void 0:b.zodSchema}getSchemaByCompositeZodSchemaName(u){var m,b;return(b=(m=this.compositeZodSchemaData.find(T=>T.zodSchemas.some(I=>I.zodSchemaName===u)))==null?void 0:m.zodSchemas.find(T=>T.zodSchemaName===u))==null?void 0:b.schema}getEnumZodSchemaDataByCode(u){return this.enumZodSchemas.find(m=>m.code===u)}getExtractedEnumZodSchemaDataByCode(u){return this.extractedEnumZodSchemaData.find(m=>m.code===u)}getExtractedEnumZodSchemaNamesReferencedBySchemaRef(u){return this.extractedEnumZodSchemaData.reduce((m,{zodSchemaName:b,meta:T})=>(b&&T.schemaRefs.includes(u)&&m.push(b),m),[])}getZodSchemas(){return this.zodSchemaData.reduce((u,{zodSchemaName:m,code:b})=>({...u,[m]:b}),{})}getExtractedEnumZodSchemas(){return this.extractedEnumZodSchemaData.reduce((u,{zodSchemaName:m,code:b})=>m?{...u,[m]:b}:u,{})}resolveObject(u){return gf(u)?this.getSchemaByRef(u.$ref):u}isSchemaCircular(u){var m;return(m=this.dependencyGraph.deepDependencyGraph[u])==null?void 0:m.has(u)}getCircularSchemaChain(u,m=u,b=[],T=[]){var I,L;return T.includes(m)?[]:(T.push(m),(I=this.dependencyGraph.refsDependencyGraph[m])!=null&&I.has(u)?[...b,m,u]:Array.from(((L=this.dependencyGraph.refsDependencyGraph[m])==null?void 0:L.values())??[]).map(Q=>{let ae=this.getCircularSchemaChain(u,Q,b,T);return ae.length>0?[m,...ae]:ae}).flat())}getBaseUrl(){var m,b;let u=(b=(m=this.openApiDoc.servers)==null?void 0:m[0])==null?void 0:b.url;return this.options.baseUrl===""&&u?u:this.options.baseUrl}getZodSchemaObj(u){let m=this.getRefByZodSchemaName(u);if(m)return this.getSchemaByRef(m);let b=this.getSchemaByCompositeZodSchemaName(u);if(b)return b;let T=this.getExtractedEnumZodSchemaDataByName(u);if(T)return T.meta.schemas.reduce((I,L)=>({...I,...this.resolveObject(L)}),{})}getSchemaDataByRef(u){return this.schemaData.find(m=>m.ref===u)}getExtractedEnumZodSchemaDataByName(u){return this.extractedEnumZodSchemaData.find(({zodSchemaName:m})=>m===u)}initialize(){var u,m,b,T,I;this.schemaRefs.forEach(L=>{let Q=y8(L),ae=aR(Q),ee=x8(ae,this.options.schemaSuffix);this.schemaData.push({ref:Q,name:ae,zodSchemaName:ee,tags:[],deepRefOperations:[]})});for(let L in this.openApiDoc.paths){if(b8(L,this.options))continue;let Q=this.openApiDoc.paths[L],ae=k8(Q,g8);for(let ee in ae){let pe=ae[ee];if(!pe||fR(pe,this.options))continue;let Te=VA(pe,this.options),Ke=jW({path:L,method:ee,operation:pe,operationsByTag:this.operationsByTag,options:this.options}),Pt=this.operationNames.filter(Xt=>Xt===Ke).length<=1,rr=ny(T8(Ke,Pt,Te)),or=[];if((u=pe.parameters)==null||u.map(Xt=>{let Vt=Xt,Ti=Vt.schema,zn=`Operation ${pe.operationId??L} parameter ${Vt.name}`;or.push(...$le(this,Ti,zn)),this.options.extractEnums&&QW({resolver:this,schema:Ti,schemaInfo:zn,tags:[Te],nameSegments:[rr,Vt.name],includeSelf:!0})}),pe.requestBody){let Xt=this.resolveObject(pe.requestBody),Ti=Object.keys(Xt.content??{}).find(FC);if(Ti){let zn=(b=(m=Xt.content)==null?void 0:m[Ti])==null?void 0:b.schema,_i=`Operation ${pe.operationId} request body`;or.push(...$le(this,zn,_i)),this.options.extractEnums&&QW({resolver:this,schema:zn,schemaInfo:_i,tags:[Te],nameSegments:[Dle(rr)]})}}for(let Xt in pe.responses){let Vt=this.resolveObject(pe.responses[Xt]),zn=Object.keys(Vt.content??{}).find(ble);if(zn){let _i=(I=(T=Vt.content)==null?void 0:T[zn])==null?void 0:I.schema,vo=`Operation ${pe.operationId} response body`;or.push(...$le(this,_i,vo)),this.options.extractEnums&&QW({resolver:this,schema:_i,schemaInfo:vo,tags:[Te],nameSegments:[Ile({statusCode:Xt,operationName:Ke,isUniqueOperationName:Pt,tag:Te})]})}}Wnt(this,or).forEach(Xt=>{let Vt=this.getSchemaDataByRef(Xt);Vt&&(Vt.tags.push(Te),Vt.deepRefOperations.push(pe))})}}this.options.extractEnums&&(this.schemaRefs.forEach(L=>{var ae;let Q=y8(L);QW({resolver:this,schema:this.getSchemaByRef(Q),schemaRef:Q,tags:((ae=this.getSchemaDataByRef(Q))==null?void 0:ae.tags)??[],nameSegments:[aR(Q)]})}),Qnt(this),this.handleDuplicateEnumZodSchemas(),Hnt(this))}handleDuplicateEnumZodSchemas(){let u=this.enumZodSchemas.map(({code:b})=>b),m=this.enumZodSchemas.filter(({code:b})=>u.includes(b));this.schemaData.forEach(b=>{var L,Q;let T=(L=m.find(({zodSchemaName:ae})=>ae===b.zodSchemaName))==null?void 0:L.code;if(!T)return;let I=this.extractedEnumZodSchemaData.find(({code:ae})=>ae===T);!I||((Q=this.getEnumZodSchemaDataByCode(I.code))==null?void 0:Q.zodSchemaName)!==b.zodSchemaName||(b.tags.push(...I.meta.tags??[]),I.meta.schemaRefs.forEach(ae=>{this.dependencyGraph.refsDependencyGraph[ae]||(this.dependencyGraph.refsDependencyGraph[ae]=new Set),this.dependencyGraph.refsDependencyGraph[ae].add(b.ref),this.dependencyGraph.deepDependencyGraph[ae]||(this.dependencyGraph.deepDependencyGraph[ae]=new Set),this.dependencyGraph.deepDependencyGraph[ae].add(b.ref)}))}),this.extractedEnumZodSchemaData.splice(0,this.extractedEnumZodSchemaData.length,...this.extractedEnumZodSchemaData.filter(({code:b})=>!u.includes(b)))}};t(iAe,"SchemaResolver");var Jle=iAe;function Knt(l){let u=[],m={};function b(T,I){Array.isArray(I)||(I=[]),I.push(T),m[T]=!0,l[T]&&l[T].forEach(L=>{I.includes(L)||m[L]||b(L,I.slice(0))}),u.includes(T)||u.push(T)}return t(b,"visit"),Object.keys(l).forEach(T=>b(T,[])),u}t(Knt,"topologicalSort");function eit(l,u){let m=Object.entries(l),b=m.filter(([T])=>u.includes(T)).sort(([T],[I])=>u.indexOf(T)-u.indexOf(I)).concat(m.filter(([T])=>!u.includes(T)));return Object.fromEntries(b)}t(eit,"sortObjKeysFromArray");function tit(l,u){let m=Knt(l.dependencyGraph.deepDependencyGraph).map(T=>l.getZodSchemaNameByRef(T));return eit(u,m)}t(tit,"sortZodSchemasByTopology");function qle(l,u){let m=new Jle(l,u),b=Vnt(m),T=Xnt(m),I={...T.zodSchemas,...m.getZodSchemas(),...T.enumZodSchemas};return I=tit(m,I),I={...m.getExtractedEnumZodSchemas(),...I},{resolver:m,data:yUt({resolver:m,endpoints:b,zodSchemas:I,options:u})}}t(qle,"getDataFromOpenAPIDoc");function yUt({resolver:l,endpoints:u,zodSchemas:m,options:b}){let T=new Map;return b.splitByTags?(u.forEach(I=>{let L=Y1(I,b);rit(L,T).endpoints.push(I)}),Object.entries(m).forEach(([I,L])=>{let Q=l.getTagByZodSchemaName(I);Q&&(rit(Q,T).zodSchemas[I]=L)}),T):(T.set(b.defaultTag,{endpoints:u,zodSchemas:m}),T)}t(yUt,"splitDataByTags");function rit(l,u){return u.has(l)||u.set(l,{endpoints:[],zodSchemas:{}}),u.get(l)}t(rit,"getTagElement");var hR=Vd(require("fs")),sAe=Vd(require("path"));function nit(l){return hR.default.readFileSync(sAe.default.join(__dirname,`../${l}`),"utf-8")}t(nit,"readFileSync");function aAe(l){let u=`src/generators/templates/${l}.hbs`;return nit(u)}t(aAe,"readHbsTemplateSync");function iit(l){let u=`src/assets/${l}`;return nit(u)}t(iit,"readAssetSync");function uT({output:l,fileName:u}){return`${l}/${u}`}t(uT,"getOutputFileName");function vUt(l,u){let m=sAe.default.dirname(l);hR.default.existsSync(m)||hR.default.mkdirSync(m,{recursive:!0}),hR.default.writeFileSync(l,u,"utf-8")}t(vUt,"writeFileWithDirSync");function bUt({fileName:l,content:u}){vUt(l,u)}t(bUt,"writeFileSync");function sit(l){l.forEach(bUt)}t(sit,"writeGenerateFileData");function ait(l,u){let{resolver:m,data:b}=qle(l,u);if(m.validationErrors.length>0){let T=int(m.validationErrors);Object.entries(T).forEach(([I,L])=>{OEe(`${EA.red(`${frt[I]}:`)}
|
|
530
530
|
${L.map(Q=>`- ${Q}`).join(`
|
|
531
531
|
`)}
|
|
532
532
|
`)})}else{let T=[...b.keys()].reduce((I,L)=>[...I,...SUt(L,u)],[]);OEe(`${EA.green("Outputs:")}
|