@povio/openapi-codegen-cli 1.1.1 → 1.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -69,9 +69,9 @@ Expecting `+Mt.join(", ")+", got '"+(this.terminals_[E]||E)+"'":Qo="Parse error
69
69
  return undefined
70
70
  }
71
71
  `.trim()},"lookupPropertyFunctionVarDeclaration"),blockValue:o(function(t){var r=this.aliasable("container.hooks.blockHelperMissing"),n=[this.contextName(0)];this.setupHelperArgs(t,0,n);var i=this.popStack();n.splice(1,0,i),this.push(this.source.functionCall(r,"call",n))},"blockValue"),ambiguousBlockValue:o(function(){var t=this.aliasable("container.hooks.blockHelperMissing"),r=[this.contextName(0)];this.setupHelperArgs("",0,r,!0),this.flushInline();var n=this.topStack();r.splice(1,0,n),this.pushSource(["if (!",this.lastHelper,") { ",n," = ",this.source.functionCall(t,"call",r),"}"])},"ambiguousBlockValue"),appendContent:o(function(t){this.pendingContent?t=this.pendingContent+t:this.pendingLocation=this.source.currentLocation,this.pendingContent=t},"appendContent"),append:o(function(){if(this.isInline())this.replaceStack(function(r){return[" != null ? ",r,' : ""']}),this.pushSource(this.appendToBuffer(this.popStack()));else{var t=this.popStack();this.pushSource(["if (",t," != null) { ",this.appendToBuffer(t,void 0,!0)," }"]),this.environment.isSimple&&this.pushSource(["else { ",this.appendToBuffer("''",void 0,!0)," }"])}},"append"),appendEscaped:o(function(){this.pushSource(this.appendToBuffer([this.aliasable("container.escapeExpression"),"(",this.popStack(),")"]))},"appendEscaped"),getContext:o(function(t){this.lastContext=t},"getContext"),pushContext:o(function(){this.pushStackLiteral(this.contextName(this.lastContext))},"pushContext"),lookupOnContext:o(function(t,r,n,i){var s=0;!i&&this.options.compat&&!this.lastContext?this.push(this.depthedLookup(t[s++])):this.pushContext(),this.resolvePath("context",t,s,r,n)},"lookupOnContext"),lookupBlockParam:o(function(t,r){this.useBlockParams=!0,this.push(["blockParams[",t[0],"][",t[1],"]"]),this.resolvePath("context",r,1)},"lookupBlockParam"),lookupData:o(function(t,r,n){t?this.pushStackLiteral("container.data(data, "+t+")"):this.pushStackLiteral("data"),this.resolvePath("data",r,0,!0,n)},"lookupData"),resolvePath:o(function(t,r,n,i,s){var a=this;if(this.options.strict||this.options.assumeObjects){this.push(Aq(this.options.strict&&s,this,r,n,t));return}for(var c=r.length;n<c;n++)this.replaceStack(function(u){var l=a.nameLookup(u,r[n],t);return i?[" && ",l]:[" != null ? ",l," : ",u]})},"resolvePath"),resolvePossibleLambda:o(function(){this.push([this.aliasable("container.lambda"),"(",this.popStack(),", ",this.contextName(0),")"])},"resolvePossibleLambda"),pushStringParam:o(function(t,r){this.pushContext(),this.pushString(r),r!=="SubExpression"&&(typeof t=="string"?this.pushString(t):this.pushStackLiteral(t))},"pushStringParam"),emptyHash:o(function(t){this.trackIds&&this.push("{}"),this.stringParams&&(this.push("{}"),this.push("{}")),this.pushStackLiteral(t?"undefined":"{}")},"emptyHash"),pushHash:o(function(){this.hash&&this.hashes.push(this.hash),this.hash={values:{},types:[],contexts:[],ids:[]}},"pushHash"),popHash:o(function(){var t=this.hash;this.hash=this.hashes.pop(),this.trackIds&&this.push(this.objectLiteral(t.ids)),this.stringParams&&(this.push(this.objectLiteral(t.contexts)),this.push(this.objectLiteral(t.types))),this.push(this.objectLiteral(t.values))},"popHash"),pushString:o(function(t){this.pushStackLiteral(this.quotedString(t))},"pushString"),pushLiteral:o(function(t){this.pushStackLiteral(t)},"pushLiteral"),pushProgram:o(function(t){t!=null?this.pushStackLiteral(this.programExpression(t)):this.pushStackLiteral(null)},"pushProgram"),registerDecorator:o(function(t,r){var n=this.nameLookup("decorators",r,"decorator"),i=this.setupHelperArgs(r,t);this.decorators.push(["fn = ",this.decorators.functionCall(n,"",["fn","props","container",i])," || fn;"])},"registerDecorator"),invokeHelper:o(function(t,r,n){var i=this.popStack(),s=this.setupHelper(t,r),a=[];n&&a.push(s.name),a.push(i),this.options.strict||a.push(this.aliasable("container.hooks.helperMissing"));var c=["(",this.itemsSeparatedBy(a,"||"),")"],u=this.source.functionCall(c,"call",s.callParams);this.push(u)},"invokeHelper"),itemsSeparatedBy:o(function(t,r){var n=[];n.push(t[0]);for(var i=1;i<t.length;i++)n.push(r,t[i]);return n},"itemsSeparatedBy"),invokeKnownHelper:o(function(t,r){var n=this.setupHelper(t,r);this.push(this.source.functionCall(n.name,"call",n.callParams))},"invokeKnownHelper"),invokeAmbiguous:o(function(t,r){this.useRegister("helper");var n=this.popStack();this.emptyHash();var i=this.setupHelper(0,t,r),s=this.lastHelper=this.nameLookup("helpers",t,"helper"),a=["(","(helper = ",s," || ",n,")"];this.options.strict||(a[0]="(helper = ",a.push(" != null ? helper : ",this.aliasable("container.hooks.helperMissing"))),this.push(["(",a,i.paramsInit?["),(",i.paramsInit]:[],"),","(typeof helper === ",this.aliasable('"function"')," ? ",this.source.functionCall("helper","call",i.callParams)," : helper))"])},"invokeAmbiguous"),invokePartial:o(function(t,r,n){var i=[],s=this.setupParams(r,1,i);t&&(r=this.popStack(),delete s.name),n&&(s.indent=JSON.stringify(n)),s.helpers="helpers",s.partials="partials",s.decorators="container.decorators",t?i.unshift(r):i.unshift(this.nameLookup("partials",r,"partial")),this.options.compat&&(s.depths="depths"),s=this.objectLiteral(s),i.push(s),this.push(this.source.functionCall("container.invokePartial","",i))},"invokePartial"),assignToHash:o(function(t){var r=this.popStack(),n=void 0,i=void 0,s=void 0;this.trackIds&&(s=this.popStack()),this.stringParams&&(i=this.popStack(),n=this.popStack());var a=this.hash;n&&(a.contexts[t]=n),i&&(a.types[t]=i),s&&(a.ids[t]=s),a.values[t]=r},"assignToHash"),pushId:o(function(t,r,n){t==="BlockParam"?this.pushStackLiteral("blockParams["+r[0]+"].path["+r[1]+"]"+(n?" + "+JSON.stringify("."+n):"")):t==="PathExpression"?this.pushString(r):t==="SubExpression"?this.pushStackLiteral("true"):this.pushStackLiteral("null")},"pushId"),compiler:Pi,compileChildren:o(function(t,r){for(var n=t.children,i=void 0,s=void 0,a=0,c=n.length;a<c;a++){i=n[a],s=new this.compiler;var u=this.matchExistingProgram(i);if(u==null){this.context.programs.push("");var l=this.context.programs.length;i.index=l,i.name="program"+l,this.context.programs[l]=s.compile(i,r,this.context,!this.precompile),this.context.decorators[l]=s.decorators,this.context.environments[l]=i,this.useDepths=this.useDepths||s.useDepths,this.useBlockParams=this.useBlockParams||s.useBlockParams,i.useDepths=this.useDepths,i.useBlockParams=this.useBlockParams}else i.index=u.index,i.name="program"+u.index,this.useDepths=this.useDepths||u.useDepths,this.useBlockParams=this.useBlockParams||u.useBlockParams}},"compileChildren"),matchExistingProgram:o(function(t){for(var r=0,n=this.context.environments.length;r<n;r++){var i=this.context.environments[r];if(i&&i.equals(t))return i}},"matchExistingProgram"),programExpression:o(function(t){var r=this.environment.children[t],n=[r.index,"data",r.blockParams];return(this.useBlockParams||this.useDepths)&&n.push("blockParams"),this.useDepths&&n.push("depths"),"container.program("+n.join(", ")+")"},"programExpression"),useRegister:o(function(t){this.registers[t]||(this.registers[t]=!0,this.registers.list.push(t))},"useRegister"),push:o(function(t){return t instanceof _i||(t=this.source.wrap(t)),this.inlineStack.push(t),t},"push"),pushStackLiteral:o(function(t){this.push(new _i(t))},"pushStackLiteral"),pushSource:o(function(t){this.pendingContent&&(this.source.push(this.appendToBuffer(this.source.quotedString(this.pendingContent),this.pendingLocation)),this.pendingContent=void 0),t&&this.source.push(t)},"pushSource"),replaceStack:o(function(t){var r=["("],n=void 0,i=void 0,s=void 0;if(!this.isInline())throw new $d.default("replaceStack on non-inline");var a=this.popStack(!0);if(a instanceof _i)n=[a.value],r=["(",n],s=!0;else{i=!0;var c=this.incrStack();r=["((",this.push(c)," = ",a,")"],n=this.topStack()}var u=t.call(this,n);s||this.popStack(),i&&this.stackSlot--,this.push(r.concat(u,")"))},"replaceStack"),incrStack:o(function(){return this.stackSlot++,this.stackSlot>this.stackVars.length&&this.stackVars.push("stack"+this.stackSlot),this.topStackName()},"incrStack"),topStackName:o(function(){return"stack"+this.stackSlot},"topStackName"),flushInline:o(function(){var t=this.inlineStack;this.inlineStack=[];for(var r=0,n=t.length;r<n;r++){var i=t[r];if(i instanceof _i)this.compileStack.push(i);else{var s=this.incrStack();this.pushSource([s," = ",i,";"]),this.compileStack.push(s)}}},"flushInline"),isInline:o(function(){return this.inlineStack.length},"isInline"),popStack:o(function(t){var r=this.isInline(),n=(r?this.inlineStack:this.compileStack).pop();if(!t&&n instanceof _i)return n.value;if(!r){if(!this.stackSlot)throw new $d.default("Invalid stack pop");this.stackSlot--}return n},"popStack"),topStack:o(function(){var t=this.isInline()?this.inlineStack:this.compileStack,r=t[t.length-1];return r instanceof _i?r.value:r},"topStack"),contextName:o(function(t){return this.useDepths&&t?"depths["+t+"]":"depth"+t},"contextName"),quotedString:o(function(t){return this.source.quotedString(t)},"quotedString"),objectLiteral:o(function(t){return this.source.objectLiteral(t)},"objectLiteral"),aliasable:o(function(t){var r=this.aliases[t];return r?(r.referenceCount++,r):(r=this.aliases[t]=this.source.wrap(t),r.aliasable=!0,r.referenceCount=1,r)},"aliasable"),setupHelper:o(function(t,r,n){var i=[],s=this.setupHelperArgs(r,t,i,n),a=this.nameLookup("helpers",r,"helper"),c=this.aliasable(this.contextName(0)+" != null ? "+this.contextName(0)+" : (container.nullContext || {})");return{params:i,paramsInit:s,name:a,callParams:[c].concat(i)}},"setupHelper"),setupParams:o(function(t,r,n){var i={},s=[],a=[],c=[],u=!n,l=void 0;u&&(n=[]),i.name=this.quotedString(t),i.hash=this.popStack(),this.trackIds&&(i.hashIds=this.popStack()),this.stringParams&&(i.hashTypes=this.popStack(),i.hashContexts=this.popStack());var f=this.popStack(),p=this.popStack();(p||f)&&(i.fn=p||"container.noop",i.inverse=f||"container.noop");for(var d=r;d--;)l=this.popStack(),n[d]=l,this.trackIds&&(c[d]=this.popStack()),this.stringParams&&(a[d]=this.popStack(),s[d]=this.popStack());return u&&(i.args=this.source.generateArray(n)),this.trackIds&&(i.ids=this.source.generateArray(c)),this.stringParams&&(i.types=this.source.generateArray(a),i.contexts=this.source.generateArray(s)),this.options.data&&(i.data="data"),this.useBlockParams&&(i.blockParams="blockParams"),i},"setupParams"),setupHelperArgs:o(function(t,r,n,i){var s=this.setupParams(t,r,n);return s.loc=JSON.stringify(this.source.currentLocation),s=this.objectLiteral(s),i?(this.useRegister("options"),n.push("options"),["options=",s]):n?(n.push(s),""):s},"setupHelperArgs")};(function(){for(var e="break else new var case finally return void catch for switch while continue function this with default if throw delete in try do instanceof typeof abstract enum int short boolean export interface static byte extends long super char final native synchronized class float package throws const goto private transient debugger implements protected volatile double import public let yield await null true false".split(" "),t=Pi.RESERVED_WORDS={},r=0,n=e.length;r<n;r++)t[e[r]]=!0})();Pi.isValidJavaScriptVariableName=function(e){return!Pi.RESERVED_WORDS[e]&&/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(e)};function Aq(e,t,r,n,i){var s=t.popStack(),a=r.length;for(e&&a--;n<a;n++)s=t.nameLookup(s,r[n],i);return e?[t.aliasable("container.strict"),"(",s,", ",t.quotedString(r[n]),", ",JSON.stringify(t.source.currentLocation)," )"]:s}o(Aq,"strictLookup");uc.default=Pi;NP.exports=uc.default});var MP=h((lc,qP)=>{"use strict";lc.__esModule=!0;function Ko(e){return e&&e.__esModule?e:{default:e}}o(Ko,"_interopRequireDefault");var wq=D_(),Iq=Ko(wq),Tq=td(),Rq=Ko(Tq),Od=Y_(),xd=tP(),Cq=kP(),Nq=Ko(Cq),kq=ec(),jq=Ko(kq),qq=Yf(),Mq=Ko(qq),Dq=Iq.default.create;function jP(){var e=Dq();return e.compile=function(t,r){return xd.compile(t,r,e)},e.precompile=function(t,r){return xd.precompile(t,r,e)},e.AST=Rq.default,e.Compiler=xd.Compiler,e.JavaScriptCompiler=Nq.default,e.Parser=Od.parser,e.parse=Od.parse,e.parseWithoutProcessing=Od.parseWithoutProcessing,e}o(jP,"create");var Ei=jP();Ei.create=jP;Mq.default(Ei);Ei.Visitor=jq.default;Ei.default=Ei;lc.default=Ei;qP.exports=lc.default});var DP=h(pc=>{"use strict";pc.__esModule=!0;pc.print=Vq;pc.PrintVisitor=Y;function Lq(e){return e&&e.__esModule?e:{default:e}}o(Lq,"_interopRequireDefault");var Fq=ec(),Hq=Lq(Fq);function Vq(e){return new Y().accept(e)}o(Vq,"print");function Y(){this.padding=0}o(Y,"PrintVisitor");Y.prototype=new Hq.default;Y.prototype.pad=function(e){for(var t="",r=0,n=this.padding;r<n;r++)t+=" ";return t+=e+`
72
- `,t};Y.prototype.Program=function(e){var t="",r=e.body,n=void 0,i=void 0;if(e.blockParams){var s="BLOCK PARAMS: [";for(n=0,i=e.blockParams.length;n<i;n++)s+=" "+e.blockParams[n];s+=" ]",t+=this.pad(s)}for(n=0,i=r.length;n<i;n++)t+=this.accept(r[n]);return this.padding--,t};Y.prototype.MustacheStatement=function(e){return this.pad("{{ "+this.SubExpression(e)+" }}")};Y.prototype.Decorator=function(e){return this.pad("{{ DIRECTIVE "+this.SubExpression(e)+" }}")};Y.prototype.BlockStatement=Y.prototype.DecoratorBlock=function(e){var t="";return t+=this.pad((e.type==="DecoratorBlock"?"DIRECTIVE ":"")+"BLOCK:"),this.padding++,t+=this.pad(this.SubExpression(e)),e.program&&(t+=this.pad("PROGRAM:"),this.padding++,t+=this.accept(e.program),this.padding--),e.inverse&&(e.program&&this.padding++,t+=this.pad("{{^}}"),this.padding++,t+=this.accept(e.inverse),this.padding--,e.program&&this.padding--),this.padding--,t};Y.prototype.PartialStatement=function(e){var t="PARTIAL:"+e.name.original;return e.params[0]&&(t+=" "+this.accept(e.params[0])),e.hash&&(t+=" "+this.accept(e.hash)),this.pad("{{> "+t+" }}")};Y.prototype.PartialBlockStatement=function(e){var t="PARTIAL BLOCK:"+e.name.original;return e.params[0]&&(t+=" "+this.accept(e.params[0])),e.hash&&(t+=" "+this.accept(e.hash)),t+=" "+this.pad("PROGRAM:"),this.padding++,t+=this.accept(e.program),this.padding--,this.pad("{{> "+t+" }}")};Y.prototype.ContentStatement=function(e){return this.pad("CONTENT[ '"+e.value+"' ]")};Y.prototype.CommentStatement=function(e){return this.pad("{{! '"+e.value+"' }}")};Y.prototype.SubExpression=function(e){for(var t=e.params,r=[],n=void 0,i=0,s=t.length;i<s;i++)r.push(this.accept(t[i]));return t="["+r.join(", ")+"]",n=e.hash?" "+this.accept(e.hash):"",this.accept(e.path)+" "+t+n};Y.prototype.PathExpression=function(e){var t=e.parts.join("/");return(e.data?"@":"")+"PATH:"+t};Y.prototype.StringLiteral=function(e){return'"'+e.value+'"'};Y.prototype.NumberLiteral=function(e){return"NUMBER{"+e.value+"}"};Y.prototype.BooleanLiteral=function(e){return"BOOLEAN{"+e.value+"}"};Y.prototype.UndefinedLiteral=function(){return"UNDEFINED"};Y.prototype.NullLiteral=function(){return"NULL"};Y.prototype.Hash=function(e){for(var t=e.pairs,r=[],n=0,i=t.length;n<i;n++)r.push(this.accept(t[n]));return"HASH{"+r.join(", ")+"}"};Y.prototype.HashPair=function(e){return e.key+"="+this.accept(e.value)}});var Wt=h((AB,HP)=>{var fc=MP().default,FP=DP();fc.PrintVisitor=FP.PrintVisitor;fc.print=FP.print;HP.exports=fc;function LP(e,t){var r=require("fs"),n=r.readFileSync(t,"utf8");e.exports=fc.compile(n)}o(LP,"extension");typeof require<"u"&&require.extensions&&(require.extensions[".handlebars"]=LP,require.extensions[".hbs"]=LP)});var F3={};SE(F3,{getGenerateFilesData:()=>L3,getGenerateMetadata:()=>D3});module.exports=bE(F3);var Td=Ge(aS());var yo="AppRestClient",ta={query:"AppQueryOptions",infiniteQuery:"AppInfiniteQueryOptions",mutation:"AppMutationOptions"},rf="src/data",cS="@/data",en={appRestClient:"@/util/rest/clients/app-rest-client",queryTypes:"@/types/react-query",errorHandling:"@/util/vendor/error-handling",abilityContext:"@/data/acl/ability.context"},hr={ErrorHandler:"ErrorHandler",SharedErrorHandler:"SharedErrorHandler"},ra={bindings:[hr.ErrorHandler,hr.SharedErrorHandler],from:en.errorHandling},nf="AbilityContext",uS={bindings:[nf],from:en.abilityContext};var na={reactQueryTypes:{fileName:"react-query.types",extension:"ts"},restClient:{fileName:"rest-client",extension:"ts"},restInterceptor:{fileName:"rest-interceptor",extension:"ts"}},ia={fileName:"app-rest-client",extension:"ts"},of="QueryModule",oa={fileName:"queryModules",extension:"ts"},lS={fileName:"queryConfig.context",extension:"tsx"},ni={optionsType:"MutationEffectsOptions",hookName:"useMutationEffects",runFunctionName:"runMutationEffects"},sa={fileName:"useMutationEffects",extension:"ts"},Ye={namespace:"ZodExtended",exports:{parse:"parse",sortExp:"sortExp"}},aa={fileName:"zod.extended",extension:"ts"};var pS="Schema",fS="Enum",dS="Body",mS="Param",hS="Response",gS="ErrorResponse",vo="z.void()",ca="z.instanceof(Blob)",So="z.enum",yS="z.int()",vS="z.number()",ua="z.string()",SS="z.email()",bS="z.url()",_S="z.uuid()",PS="z.iso.datetime({ offset: true })",ii={bindings:["z"],from:"zod"};var sf={input:"http://localhost:4000/docs-json/",output:"output",splitByTags:!0,defaultTag:"Common",excludeTags:[],excludePathRegex:"",excludeRedundantZodSchemas:!0,tsNamespaces:!0,tsPath:cS,importPath:"ts",configs:{models:{outputFileNameSuffix:"models",namespaceSuffix:"Models"},endpoints:{outputFileNameSuffix:"api",namespaceSuffix:"Api"},queries:{outputFileNameSuffix:"queries",namespaceSuffix:"Queries"},acl:{outputFileNameSuffix:"acl",namespaceSuffix:"Acl"}},standalone:!1,baseUrl:"",schemaSuffix:pS,enumSuffix:fS,withDefaultValues:!0,extractEnums:!0,replaceOptionalWithNullish:!1,restClientImportPath:en.appRestClient,errorHandlingImportPath:en.errorHandling,removeOperationPrefixEndingWith:"Controller_",parseRequestParams:!0,queryTypesImportPath:en.queryTypes,axiosRequestConfig:!1,infiniteQueries:!1,mutationEffects:!0,acl:!0,checkAcl:!0,abilityContextImportPath:en.abilityContext,abilityContextGenericAppAbilities:!1};var mt={query:"useQuery",infiniteQuery:"useInfiniteQuery",mutation:"useMutation"},ES={bindings:[mt.query,mt.infiniteQuery,mt.mutation],from:"@tanstack/react-query"},bo={pageParamName:"page"},la={pageParamName:"page",totalItemsName:"totalItems",limitParamName:"limit"},_o="moduleName";var mb=Ge($S());var af={"Content-Type":"application/json",Accept:"application/json"},pa="data",cf="axios",yr="config",xt="AxiosRequestConfig",fa={defaultImport:cf,bindings:[xt],from:"axios"};var OS=o(e=>/^(?:[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+)$/.test(e),"isValidPropertyName"),At=o(e=>e.replace(/^[^a-zA-Z_$]*/g,"").replace(/[^a-zA-Z0-9_$]+(\w)?/g,(t,r)=>(r==null?void 0:r.toUpperCase())??""),"invalidVariableNameCharactersToCamel");function D(e){return e!=null&&Object.prototype.hasOwnProperty.call(e,"$ref")}o(D,"isReferenceObject");function le(e){return!D(e)}o(le,"isSchemaObject");function da(e){return e.type==="array"}o(da,"isArraySchemaObject");function xS(e){if(!e.allOf)throw new Error("Function inferRequiredSchema is specialized to handle item with required only in an allOf array.");let[t,r]=e.allOf.reduce((i,s)=>{if(yN(s)){let a=s.required;i[0].push(...a??[])}else i[1].push(s);return i},[[],[]]),n={properties:t.reduce((i,s)=>(i[s]={},i),{}),type:"object",required:t};return{noRequiredOnlyAllof:r,composedRequiredSchema:n,patchRequiredSchemaInLoop:o((i,s)=>{if(D(i)){let a=s(i.$ref);a&&n.required.forEach(c=>{var u;n.properties[c]=((u=a==null?void 0:a.properties)==null?void 0:u[c])??{}})}else{let a=i.properties??{};n.required.forEach(c=>{a[c]&&(n.properties[c]=a[c]??{})})}},"patchRequiredSchemaInLoop")}}o(xS,"inferRequiredSchema");var yN=o(e=>!D(e)&&!!e.required&&!e.type&&!e.properties&&!(e!=null&&e.allOf)&&!(e!=null&&e.anyOf)&&!e.oneOf,"isBrokenAllOfItem");var Bt=Symbol.for("@ts-pattern/matcher"),vN=Symbol.for("@ts-pattern/isVariadic"),ha="@ts-pattern/anonymous-select-key",uf=o(e=>!!(e&&typeof e=="object"),"r"),ma=o(e=>e&&!!e[Bt],"i"),Tt=o((e,t,r)=>{if(ma(e)){let n=e[Bt](),{matched:i,selections:s}=n.match(t);return i&&s&&Object.keys(s).forEach(a=>r(a,s[a])),i}if(uf(e)){if(!uf(t))return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let n=[],i=[],s=[];for(let a of e.keys()){let c=e[a];ma(c)&&c[vN]?s.push(c):s.length?i.push(c):n.push(c)}if(s.length){if(s.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(t.length<n.length+i.length)return!1;let a=t.slice(0,n.length),c=i.length===0?[]:t.slice(-i.length),u=t.slice(n.length,i.length===0?1/0:-i.length);return n.every((l,f)=>Tt(l,a[f],r))&&i.every((l,f)=>Tt(l,c[f],r))&&(s.length===0||Tt(s[0],u,r))}return e.length===t.length&&e.every((a,c)=>Tt(a,t[c],r))}return Reflect.ownKeys(e).every(n=>{let i=e[n];return(n in t||ma(s=i)&&s[Bt]().matcherType==="optional")&&Tt(i,t[n],r);var s})}return Object.is(t,e)},"s"),Pr=o(e=>{var t,r,n;return uf(e)?ma(e)?(t=(r=(n=e[Bt]()).getSelectionKeys)==null?void 0:r.call(n))!=null?t:[]:Array.isArray(e)?Eo(e,Pr):Eo(Object.values(e),Pr):[]},"o"),Eo=o((e,t)=>e.reduce((r,n)=>r.concat(t(n)),[]),"c");function Je(e){return Object.assign(e,{optional:o(()=>SN(e),"optional"),and:o(t=>K(e,t),"and"),or:o(t=>bN(e,t),"or"),select:o(t=>t===void 0?AS(e):AS(t,e),"select")})}o(Je,"u");function SN(e){return Je({[Bt]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return t===void 0?(Pr(e).forEach(i=>n(i,void 0)),{matched:!0,selections:r}):{matched:Tt(e,t,n),selections:r}},"match"),getSelectionKeys:o(()=>Pr(e),"getSelectionKeys"),matcherType:"optional"})})}o(SN,"h");function K(...e){return Je({[Bt]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return{matched:e.every(i=>Tt(i,t,n)),selections:r}},"match"),getSelectionKeys:o(()=>Eo(e,Pr),"getSelectionKeys"),matcherType:"and"})})}o(K,"m");function bN(...e){return Je({[Bt]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return Eo(e,Pr).forEach(i=>n(i,void 0)),{matched:e.some(i=>Tt(i,t,n)),selections:r}},"match"),getSelectionKeys:o(()=>Eo(e,Pr),"getSelectionKeys"),matcherType:"or"})})}o(bN,"d");function F(e){return{[Bt]:()=>({match:o(t=>({matched:!!e(t)}),"match")})}}o(F,"p");function AS(...e){let t=typeof e[0]=="string"?e[0]:void 0,r=e.length===2?e[1]:typeof e[0]=="string"?void 0:e[0];return Je({[Bt]:()=>({match:o(n=>{let i={[t??ha]:n};return{matched:r===void 0||Tt(r,n,(s,a)=>{i[s]=a}),selections:i}},"match"),getSelectionKeys:o(()=>[t??ha].concat(r===void 0?[]:Pr(r)),"getSelectionKeys")})})}o(AS,"y");function wt(e){return typeof e=="number"}o(wt,"v");function vr(e){return typeof e=="string"}o(vr,"b");function Sr(e){return typeof e=="bigint"}o(Sr,"w");var l5=Je(F(function(e){return!0}));var br=o(e=>Object.assign(Je(e),{startsWith:o(t=>{return br(K(e,(r=t,F(n=>vr(n)&&n.startsWith(r)))));var r},"startsWith"),endsWith:o(t=>{return br(K(e,(r=t,F(n=>vr(n)&&n.endsWith(r)))));var r},"endsWith"),minLength:o(t=>br(K(e,(r=>F(n=>vr(n)&&n.length>=r))(t))),"minLength"),length:o(t=>br(K(e,(r=>F(n=>vr(n)&&n.length===r))(t))),"length"),maxLength:o(t=>br(K(e,(r=>F(n=>vr(n)&&n.length<=r))(t))),"maxLength"),includes:o(t=>{return br(K(e,(r=t,F(n=>vr(n)&&n.includes(r)))));var r},"includes"),regex:o(t=>{return br(K(e,(r=t,F(n=>vr(n)&&!!n.match(r)))));var r},"regex")}),"j"),p5=br(F(vr)),It=o(e=>Object.assign(Je(e),{between:o((t,r)=>It(K(e,((n,i)=>F(s=>wt(s)&&n<=s&&i>=s))(t,r))),"between"),lt:o(t=>It(K(e,(r=>F(n=>wt(n)&&n<r))(t))),"lt"),gt:o(t=>It(K(e,(r=>F(n=>wt(n)&&n>r))(t))),"gt"),lte:o(t=>It(K(e,(r=>F(n=>wt(n)&&n<=r))(t))),"lte"),gte:o(t=>It(K(e,(r=>F(n=>wt(n)&&n>=r))(t))),"gte"),int:o(()=>It(K(e,F(t=>wt(t)&&Number.isInteger(t)))),"int"),finite:o(()=>It(K(e,F(t=>wt(t)&&Number.isFinite(t)))),"finite"),positive:o(()=>It(K(e,F(t=>wt(t)&&t>0))),"positive"),negative:o(()=>It(K(e,F(t=>wt(t)&&t<0))),"negative")}),"x"),f5=It(F(wt)),_r=o(e=>Object.assign(Je(e),{between:o((t,r)=>_r(K(e,((n,i)=>F(s=>Sr(s)&&n<=s&&i>=s))(t,r))),"between"),lt:o(t=>_r(K(e,(r=>F(n=>Sr(n)&&n<r))(t))),"lt"),gt:o(t=>_r(K(e,(r=>F(n=>Sr(n)&&n>r))(t))),"gt"),lte:o(t=>_r(K(e,(r=>F(n=>Sr(n)&&n<=r))(t))),"lte"),gte:o(t=>_r(K(e,(r=>F(n=>Sr(n)&&n>=r))(t))),"gte"),positive:o(()=>_r(K(e,F(t=>Sr(t)&&t>0))),"positive"),negative:o(()=>_r(K(e,F(t=>Sr(t)&&t<0))),"negative")}),"A"),d5=_r(F(Sr)),m5=Je(F(function(e){return typeof e=="boolean"})),h5=Je(F(function(e){return typeof e=="symbol"})),g5=Je(F(function(e){return e==null})),y5=Je(F(function(e){return e!=null}));var df=class df extends Error{constructor(t){let r;try{r=JSON.stringify(t)}catch{r=t}super(`Pattern matching error: no pattern matches value ${r}`),this.input=void 0,this.input=t}};o(df,"W");var lf=df,pf={matched:!1,value:void 0};function Pe(e){return new ff(e,pf)}o(Pe,"z");var Po=class Po{constructor(t,r){this.input=void 0,this.state=void 0,this.input=t,this.state=r}with(...t){if(this.state.matched)return this;let r=t[t.length-1],n=[t[0]],i;t.length===3&&typeof t[1]=="function"?i=t[1]:t.length>2&&n.push(...t.slice(1,t.length-1));let s=!1,a={},c=o((l,f)=>{s=!0,a[l]=f},"a"),u=!n.some(l=>Tt(l,this.input,c))||i&&!i(this.input)?pf:{matched:!0,value:r(s?ha in a?a[ha]:a:this.input,this.input)};return new Po(this.input,u)}when(t,r){if(this.state.matched)return this;let n=!!t(this.input);return new Po(this.input,n?{matched:!0,value:r(this.input,this.input)}:pf)}otherwise(t){return this.state.matched?this.state.value:t(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new lf(this.input)}run(){return this.exhaustive()}returnType(){return this}};o(Po,"I");var ff=Po;var mf=2,wS=["application/octet-stream","multipart/form-data","application/x-www-form-urlencoded","*/*"],IS=["query","header","path"],tn=["get","put","post","delete","options","head","patch","trace"],TS=["string","number","integer","boolean"],oi=["allOf","anyOf","oneOf"];var G=o(e=>e.charAt(0).toUpperCase()+e.slice(1),"capitalize"),Er=o(e=>e.charAt(0).toLowerCase()+e.slice(1),"decapitalize"),RS=o(e=>e.replace(/(-\w)/g,t=>t[1].toUpperCase()),"kebabToCamel"),pe=o(e=>e.replace(/(_\w)/g,t=>t[1].toUpperCase()),"snakeToCamel"),CS=o(e=>e.replace(/[\W_]+(\w)?/g,(t,r)=>(r==null?void 0:r.toUpperCase())??""),"nonWordCharactersToCamel"),hf=o((e,t="")=>e.endsWith(t)?e:`${e}${t}`,"suffixIfNeeded"),NS=o((e,t)=>e.replace(new RegExp(`${t}$`),""),"removeSuffix"),_N=o(e=>{var n;let t=e.reduce((i,s)=>({...i,[s]:(i[s]??0)+1}),{});return(n=Object.entries(t).sort((i,s)=>i[1]===s[1]?s[0].length-i[0].length:s[1]-i[1])[0])==null?void 0:n[0]},"getLongestMostCommon"),gf=o(e=>{let t=e.map(G).map(kS).map(r=>PN(r)).flat();return _N(t)},"getMostCommonAdjacentCombinationSplit"),kS=o(e=>e.split(/(?<![A-Z])(?=[A-Z])/).filter(Boolean),"splitByUppercase"),jS=o(e=>kS(e).join(" "),"camelToSpaceSeparated"),PN=o((e,t=["dto","by","for","of","in","to","and","with"])=>{var n;let r=[];for(let i=0;i<e.length;i++)if(!t.includes(e[i].toLowerCase()))for(let s=i+1;s<=e.length;s++)t.includes((n=e[s-1])==null?void 0:n.toLowerCase())||r.push(e.slice(i,s).join(""));return r},"getAdjacentStringCombinations"),qS=o((e,t)=>{let r=t.replace(/es$|s$/g,""),n=new RegExp(`(${Er(r)}|${G(r)})[a-z]*(?=$|[A-Z])`,"g");return e.replace(n,"")},"removeWord");var DS=o(e=>`#/components/schemas/${e}`,"getSchemaRef"),rn=o(e=>e[1]==="/"?e:"#/"+e.slice(1),"autocorrectRef"),si=o(e=>rn(e).split("/").at(-1),"getSchemaNameByRef");function vf(e){let t=EN(e).normalize("NFKD").trim().replace(/\s+/g,"_").replace(/--+/g,"-").replace(/-+/g,"_").replace(/[^\w-]+/g,"_");return pe(t)}o(vf,"normalizeString");function Sf(e){return/^[a-zA-Z]\w*$/.test(e)?e:`"${e}"`}o(Sf,"wrapWithQuotesIfNeeded");function LS(e){return typeof e=="string"&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}o(LS,"unwrapQuotesIfNeeded");function EN(e){let t=Number(e[0]);return typeof t=="number"&&!Number.isNaN(t)?"_"+e:e}o(EN,"prefixStringStartingWithNumberIfNeeded");function bf(e){let t=e.replaceAll("_","#");return pe(t.replaceAll("-","_")).replaceAll("#","_")}o(bf,"pathParamToVariableName");var Ut=o(e=>TS.includes(e),"isPrimitiveType");function FS(e){return e.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/([\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\uFFFE\uFFFF])/g,(t,r)=>{let n=r.codePointAt(),i=n.toString(16);return n<=255?`\\x${`00${i}`.slice(-2)}`:`\\u${`0000${i}`.slice(-4)}`}).replace(/\//g,"\\/")}o(FS,"escapeControlCharacters");function Xe(e){return e.includes("application/")&&e.includes("json")||wS.includes(e)||e.includes("text/")}o(Xe,"isParamMediaTypeAllowed");function $o(e){return e>=200&&e<300}o($o,"isMainResponseStatus");function ga(e){return!(e>=200&&e<300)}o(ga,"isErrorStatus");function ai(e){return e.startsWith("application/")}o(ai,"isMediaTypeAllowed");var MS=/({\w+})/g,$N=/[^\w\-]+/g;function HS(e){e=G(RS(e.replaceAll("/","-")).replaceAll("-",""));let t=[...e.matchAll(MS)];if(t.length>0){let r=t.sort((n,i)=>n.index-i.index)[t.length-1][0];e=`${e.replace(MS,"")}By${G(r.slice(1,-1))}`}return e.replace($N,"_")}o(HS,"pathToVariableName");var yf=/{(\b\w+(?:-\w+)*\b)}/g;function VS(e){let t=e.match(yf);return t===null?e.replaceAll(yf,":$1"):(t.forEach(r=>{let n=bf(r.replaceAll(yf,":$1"));e=e.replaceAll(r,n)}),e)}o(VS,"replaceHyphenatedPath");var BS=o(e=>{let t=e["x-enumNames"],r=Array.isArray(t)&&t.length>0,n=!!e.schema&&le(e.schema)&&e.schema.type==="string";return r&&n},"isSortingParameterObject"),nn=o((e,t)=>t.excludePathRegex?new RegExp(t.excludePathRegex).test(e):!1,"isPathExcluded");function Rt(e){return CS(e)}o(Rt,"formatTag");function $r(e,t){var n;let r=(n=e.tags)==null?void 0:n[0];return Rt(r??t.defaultTag)}o($r,"getOperationTag");function US(e,t){return t.excludeTags.some(r=>r.toLowerCase()===e.toLowerCase())}o(US,"isTagExcluded");var ya={fileName:"acl/app.ability",extension:"ts"},Oo="AppAbilities",va={fileName:"acl/useAclCheck",extension:"ts"},Or="useAclCheck",fe={abilityTuple:"AbilityTuple",pureAbility:"PureAbility",forcedSubject:"ForcedSubject",subjectType:"Subject",subject:"subject"},_f={bindings:[fe.abilityTuple,fe.pureAbility,fe.forcedSubject,fe.subjectType,fe.subject],from:"@casl/ability"};var Fe=o((...e)=>[...new Set(e.flat())],"getUniqueArray");var xo=o(e=>`canUse${G(pe(e.operationName))}`,"getAbilityFunctionName"),GS=o((e,t)=>`${t.tsNamespaces?`${Z({type:"acl",tag:Ar(e,t),options:t})}.`:""}${xo(e)}`,"getImportedAbilityFunctionName"),Pf=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].action},"getAbilityAction"),Ef=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].subject},"getAbilitySubject"),Ao=o(e=>{var t;return!!((t=ci(e))!=null&&t.length)},"hasAbilityConditions"),ci=o(e=>{var t,r;return(r=(t=e.acl)==null?void 0:t[0].conditionsTypes)==null?void 0:r.sort((n,i)=>n.name.localeCompare(i.name))},"getAbilityConditionsTypes"),ZS=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].description},"getAbilityDescription"),$f=o(e=>{var n;let t=Ef(e),r=[`"${t??""}"`];return Ao(e)&&r.push(`ForcedSubject<"${t}"> & { ${(n=ci(e))==null?void 0:n.map(i=>`${i.name}${i.required?"":"?"}: ${i.type??""}${i.zodSchemaName??""},`).join(" ")} }`),r},"getAbilitySubjectTypes");function Of({resolver:e,data:t,tag:r=""}){var c;let n=(c=t.get(r))==null?void 0:c.endpoints.filter(({acl:u})=>u&&u.length>0);if(!n||n.length===0)return;let i=n.some(({acl:u})=>(u==null?void 0:u[0].conditions)&&Object.keys(u[0].conditions).length>0),s=n.reduce((u,l)=>{var p,d;let f=(d=(p=l.acl)==null?void 0:p[0].conditionsTypes)==null?void 0:d.reduce((m,g)=>[...m,...g!=null&&g.zodSchemaName?[g.zodSchemaName]:[]],[]);return[...u,...f??[]]},[]),a=xr({resolver:e,tag:r,zodSchemasAsTypes:Fe(s)});return{endpoints:n,hasAdditionalAbilityImports:i,modelsImports:a}}o(Of,"getAclData");var zS=o(({resolver:e,data:t})=>{let r=new Map,n=[],i=!1;t.forEach((c,u)=>{let l=Of({resolver:e,data:t,tag:u});if(!l)return;let{modelsImports:f,hasAdditionalAbilityImports:p,endpoints:d}=l;n.push(f),i=i||p,d.forEach(m=>{let g=Pf(m);g&&r.set(g,new Set([...r.get(g)??[],...$f(m)]))})});let s=xf(e.options,...n);return{appAbilitiesType:r.size>0?Object.fromEntries(Array.from(r.entries()).map(([c,u])=>[c,Array.from(u)])):void 0,modelsImports:s,hasAdditionalAbilityImports:i}},"getAppAbilitiesType");function we(e,t){if(!e)return;let{data:r,onSchema:n}=t;if(D(e)&&n({type:"reference",schema:e,data:r})===!0)return;let i=e;if(oi.some(s=>s in i&&i[s])){let s=i.allOf??i.anyOf??i.oneOf??[];for(let a of s)(n==null?void 0:n({type:"composite",parentSchema:e,schema:a,data:r}))!==!0&&we(a,{data:r,onSchema:n})}if(i.properties)for(let[s,a]of Object.entries(i.properties))n({type:"property",parentSchema:e,schema:a,data:r,propertyName:s})!==!0&&we(a,t);if(i.additionalProperties&&typeof i.additionalProperties=="object"){if(n({type:"additionalProperties",parentSchema:e,schema:i.additionalProperties,data:r})===!0)return;we(i.additionalProperties,t)}if(i.type==="array"){let s=e.items;if(n({type:"array",parentSchema:e,schema:s,data:r})===!0)return;we(s,t)}}o(we,"iterateSchema");var on=o((e,t)=>hf(G(vf(e)),t),"getZodSchemaName"),wo=o((e,t,r)=>hf(G(vf(e)),`${t}${r}`),"getEnumZodSchemaName"),de=o(e=>["z.",`${Ye.namespace}.`].every(t=>!e.startsWith(t)),"isNamedZodSchema"),KS=o(e=>e.startsWith(So),"isEnumZodSchema"),sn=o((e,t,r)=>t?e:`${r}_${e}`,"getZodSchemaOperationName"),Sa=o(e=>pe(`${e}_${dS}`),"getBodyZodSchemaName"),QS=o((e,t)=>pe(`${e}_${t}${mS}`),"getParamZodSchemaName"),ON=o(e=>pe(`${e}${hS}`),"getMainResponseZodSchemaName"),xN=o((e,t)=>pe(`${e}_${t}_${gS}`),"getErrorResponseZodSchemaName");function ba({statusCode:e,operationName:t,isUniqueOperationName:r,tag:n}){let i=Number(e),s=sn(t,r,n);return!$o(i)&&e!=="default"&&ga(i)?xN(s,e):ON(s)}o(ba,"getResponseZodSchemaName");function Io(e){return["minimum","exclusiveMinimum","maximum","exclusiveMaximum","minItems","minLength","minProperties","maxItems","maxLength","maxProperties","default","example"].filter(n=>e[n]).reduce((n,i)=>[...n,`${G(jS(i))}: \`${e[i]}\``],[])}o(Io,"getSchemaDescriptions");var To=o((e,t)=>NS(e,t.schemaSuffix),"getZodSchemaInferedTypeName"),WS=o((e,t)=>de(t)?`${e.options.tsNamespaces?`${Z({type:"models",tag:e.getTagByZodSchemaName(t),options:e.options})}.`:""}${t}`:t,"getImportedZodSchemaName"),wr=o((e,t,r)=>{if(!de(t))return t===vo?"void":t;let n=e.getTagByZodSchemaName(t);return`${e.options.tsNamespaces&&n!==r?`${Z({type:"models",tag:n,options:e.options})}.`:""}${To(t,e.options)}`},"getImportedZodSchemaInferedTypeName");function YS(e){var t;return e.isEnum?"enum":((t=e.schemaObj)==null?void 0:t.type)??"object"}o(YS,"getZodSchemaType");function JS(e){if(e.schemaObj)return[e.schemaObj.description,...Io(e.schemaObj)].filter(Boolean).join(". ")}o(JS,"getZodSchemaDescription");function XS(e,t,r){var n;if(D(t)){let i=e.getZodSchemaNameByRef(t.$ref);return i?wr(e,i,r):void 0}if(da(t)){if(!D(t.items))return`${((n=t.items)==null?void 0:n.type)??"unknown"}[]`;let i=e.getZodSchemaNameByRef(t.items.$ref);return i?`${wr(e,i,r)}[]`:void 0}if(oi.some(i=>i in t&&t[i])){let i=t.allOf??t.anyOf??t.oneOf??[];if(i.length>0)return XS(e,i[0],r)}return t.type}o(XS,"getType");function eb(e,t,r){if(!t.schemaObj)return[];let n="[0]",i="[key]",s={},a=o(c=>{var l;if(c.type==="reference")return!0;if(c.type==="composite")return;let u=[...((l=c.data)==null?void 0:l.pathSegments)??[]];if(c.type==="array"?u.push(n):c.type==="property"?u.push(c.propertyName):c.type==="additionalProperties"&&u.push(i),c.schema&&u[u.length-1]!==n){let f=e.resolveObject(c.schema),p=[f.description,...Io(f)].filter(Boolean),d=u.join(".");s[d]&&"type"in c.schema&&c.schema.type==="object"||(delete s[d],s[d]={type:XS(e,c.schema,r)??"unknown",description:p.join(". ")})}return we(c.schema,{data:{pathSegments:[...u]},onSchema:a}),!0},"onSchema");return"allOf"in t.schemaObj&&t.schemaObj.allOf&&t.schemaObj.allOf.forEach(c=>{if(D(c)){let u=e.resolveObject(c);we(u,{data:{pathSegments:[]},onSchema:a})}}),we(t.schemaObj,{data:{pathSegments:[]},onSchema:a}),s}o(eb,"getZodSchemaPropertyDescriptions");function xr({resolver:e,tag:t,zodSchemas:r=[],zodSchemasAsTypes:n=[]}){let i="models",s=o(u=>e.getTagByZodSchemaName(u),"getTag"),a=_a({type:i,tag:t,entities:r,getTag:s,getEntityName:o(u=>u,"getEntityName"),options:e.options}),c=_a({type:i,tag:t,entities:n,getTag:s,getEntityName:o(u=>To(u,e.options),"getEntityName"),options:e.options});return xf(e.options,a,c)}o(xr,"getModelsImports");function tb({tag:e,endpoints:t,options:r}){return _a({type:"endpoints",tag:e,entities:t,getTag:o(n=>Ar(n,r),"getTag"),getEntityName:Ro,options:r})}o(tb,"getEndpointsImports");function rb({tag:e,endpoints:t,options:r}){return _a({type:"acl",tag:e,entities:t,getTag:o(n=>Ar(n,r),"getTag"),getEntityName:xo,options:r})}o(rb,"getAclImports");function Gt(e){let t=e.tsPath;return e.importPath==="relative"?t="../":e.importPath==="absolute"?t=e.output:new RegExp(`${rf}`,"g").test(e.output)&&(t=e.output.replace(new RegExp(`.*${rf}`,"g"),e.tsPath)),`${t}/`.replace(/\/\//g,"/")}o(Gt,"getImportPath");function _a({type:e="models",tag:t,entities:r,getTag:n,getEntityName:i,options:s}){let a=new Map;return r.forEach(c=>{let u=n(c);if(a.has(u))s.tsNamespaces||a.get(u).bindings.push(i(c));else{let l=t===u;a.set(u,{bindings:[s.tsNamespaces?Z({type:e,tag:u,options:s}):i(c)],from:`${l?"./":Gt(s)}${ui({type:e,tag:u,includeTagDir:!l,options:s})}`})}}),Array.from(a.values())}o(_a,"getImports");function xf(e,...t){let r=new Map;return t.forEach(n=>{n.forEach(i=>{r.has(i.from)?e.tsNamespaces||r.get(i.from).bindings.push(...i.bindings):r.set(i.from,i)})}),Array.from(r.values()).map(n=>({...n,bindings:Fe(n.bindings)}))}o(xf,"mergeImports");function an({fileName:e,extension:t}){return`${e}.${t}`}o(an,"getFileNameWithExtension");function nb({type:e,tag:t,options:r,includeTagDir:n=!0}){let i=r.configs[e].outputFileNameSuffix;return t?`${n?`${Er(t)}/`:""}${Er(t)}.${i}`:i}o(nb,"getTagFileNameWithoutExtension");function ui(...e){return nb(...e)}o(ui,"getTagImportPath");function ib(...e){return`${nb(...e)}.ts`}o(ib,"getTagFileName");var Z=o(({type:e,tag:t,options:r})=>`${G(t)}${r.configs[e].namespaceSuffix}`,"getNamespaceName");function ob(e){return e.standalone?`${Gt(e)}${ia.fileName}`:e.restClientImportPath}o(ob,"getAppRestClientImportPath");function sb(e){return e.standalone?`${Gt(e)}${na.reactQueryTypes.fileName}`:e.queryTypesImportPath}o(sb,"getQueryTypesImportPath");function ab(e){return`${Gt(e)}${oa.fileName}`}o(ab,"getQueryModulesImportPath");function cb(e){return`${Gt(e)}${sa.fileName}`}o(cb,"getMutationEffectsImportPath");function ub(e){return`${Gt(e)}${va.fileName}`}o(ub,"getAclCheckImportPath");function lb(e){return`${Gt(e)}${aa.fileName}`}o(lb,"getZodExtendedImportPath");function pb(e){return`${Gt(e)}${ya.fileName}`}o(pb,"getAppAbilitiesImportPath");function Pa(e){return Pe(e).with("string",()=>"string").with("number",()=>"number").with("integer",()=>"number").with("boolean",()=>"boolean").exhaustive()}o(Pa,"primitiveTypeToTsType");function li({zodSchemaName:e,schema:t,resolver:r}){let n="void",i;e&&de(e)?(n=wr(r,e),i=r.getTagByZodSchemaName(e)):t!=null&&t.type&&Ut(t==null?void 0:t.type)&&(n=Pa(t==null?void 0:t.type));let s=n.split(".");return{type:s[s.length-1],...s.length>1?{namespace:s[0]}:{},...i?{importPath:ui({type:"models",tag:i,includeTagDir:!0,options:r.options})}:{}}}o(li,"getTsTypeBase");function cn({schema:e,isCircular:t,parentTypes:r,resolver:n}){if(!e)return{metaType:"primitive"};for(let i of oi){let s=e[i];if(s)if(s.length>1){let a=s.map(c=>{let u=n.resolveObject(c);return cn({schema:u,parentTypes:r,resolver:n})});return a.every(({metaType:c})=>c==="object")?{metaType:"object",objectProperties:a.reduce((c,{objectProperties:u})=>{let l=u.map(({name:f})=>f);return[...c.filter(({name:f})=>!l.includes(f)),...u]},[])}:{metaType:"composite",[i]:a}}else e=n.resolveObject(s[0])}return e.type==="array"?{metaType:"array",arrayType:fb({arraySchema:e,resolver:n,parentTypes:r})}:(e.type==="object"||e.properties)&&t?{metaType:"object",objectProperties:[],isCircular:!0}:e.type==="object"||e.properties?{metaType:"object",objectProperties:AN({schema:e,parentTypes:r,resolver:n})}:{metaType:"primitive"}}o(cn,"getSchemaTsMetaType");function fb({arraySchema:e,parentTypes:t,resolver:r}){let n,i;if(D(e.items)){let u=e.items.$ref;n=r.getZodSchemaNameByRef(u),i=r.getSchemaByRef(u)}else i=e.items;let s=li({zodSchemaName:n,schema:i,resolver:r}),a=db(s,t),c=cn({schema:i,isCircular:a,parentTypes:[...t,s],resolver:r});return{...s,...c}}o(fb,"getArraySchemaTsType");function AN({schema:e,parentTypes:t,resolver:r}){return Object.entries((e==null?void 0:e.properties)??{}).map(([n,i])=>{var a;let s=((a=e==null?void 0:e.required)==null?void 0:a.includes(n))??!1;if(D(i)){let c=r.getZodSchemaNameByRef(i.$ref),u=r.getSchemaByRef(i.$ref),l=li({zodSchemaName:c,schema:u,resolver:r}),f=db(l,t),p=cn({schema:u,isCircular:f,parentTypes:[...t,l],resolver:r});return{name:n,isRequired:s,...l,...p}}else if(i.type==="array"){let c=fb({arraySchema:i,parentTypes:t,resolver:r});return{name:n,isRequired:s,type:"array",metaType:"array",arrayType:c}}else if(Ut(i.type))return{name:n,isRequired:s,type:Pa(i.type),metaType:"primitive"};return{name:n,isRequired:s,type:"void",metaType:"primitive"}})}o(AN,"getSchemaTsProperties");function db(e,t){return t.findIndex(({type:r,namespace:n})=>r===e.type&&n===e.namespace)>-1}o(db,"getIsCircular");var Ro=o(e=>Er(pe(e.operationName)),"getEndpointName");function hb(e,t){return`${t.tsNamespaces?`${Z({type:"endpoints",tag:Ar(e,t),options:t})}.`:""}${Ro(e)}`}o(hb,"getImportedEndpointName");var gb=o(e=>e.method!==mb.OpenAPIV3.HttpMethods.GET,"requiresBody"),Ea=o(e=>e.parameters.find(t=>t.type==="Body"),"getEndpointBody"),yb=o((e,t)=>{let r=Af(e),n=t.options.axiosRequestConfig;return Object.keys(r).length>0||n},"hasEndpointConfig"),vb=o(e=>e.path.replace(/:([a-zA-Z0-9_]+)/g,"${$1}"),"getEndpointPath");function Ar(e,t){var n;let r=t.splitByTags?(n=e.tags)==null?void 0:n[0]:t.defaultTag;return Rt(r??t.defaultTag)}o(Ar,"getEndpointTag");function Ir(e,t,r){let n=t.parameters.map(i=>{var a,c,u,l;let s="string";if(de(i.zodSchema))s=wr(e,i.zodSchema);else if((a=i.parameterObject)!=null&&a.schema&&le(i.parameterObject.schema)){let f=(u=(c=i.parameterObject)==null?void 0:c.schema)==null?void 0:u.type;f&&Ut(f)&&(s=Pa(f))}return{name:At(i.name),type:s,paramType:i.type,required:((l=i.parameterObject)==null?void 0:l.required)??!0,parameterObject:i.parameterObject,bodyObject:i.bodyObject}});return r!=null&&r.includeFileParam&&t.mediaUpload&&n.push({name:"file",type:"File",paramType:"Body",required:!0,parameterObject:void 0,bodyObject:void 0}),n.sort((i,s)=>{if(i.required===s.required){let a=["Path","Body","Query","Header"];return a.indexOf(i.paramType)-a.indexOf(s.paramType)}return i.required?-1:1}).filter(i=>(!(r!=null&&r.excludeBodyParam)||i.name!==pa)&&(!(r!=null&&r.excludePageParam)||i.name!==bo.pageParamName)&&(!(r!=null&&r.includeOnlyRequiredParams)||i.required)).map(i=>({...i,name:r!=null&&r.replacePageParam&&i.name===bo.pageParamName?"pageParam":i.name,required:i.required&&(i.paramType==="Path"||!(r!=null&&r.pathParamsRequiredOnly))}))}o(Ir,"mapEndpointParamsToFunctionParams");function Af(e){let t=e.parameters.filter(i=>i.type==="Query").map(i=>{let s=OS(i.name)?i.name:`"${i.name}"`,a=At(i.name);return{...i,name:s,value:a}}),r={};return e.requestFormat!==af["Content-Type"]&&(r["Content-Type"]=`'${e.requestFormat}'`),e.responseFormat&&e.responseFormat!==af.Accept&&(r.Accept=`'${e.responseFormat}'`),e.parameters.filter(i=>i.type==="Header").forEach(i=>{r[i.name]=At(i.name)}),{...t.length>0?{params:t}:{},...Object.keys(r).length?{headers:r}:{}}}o(Af,"getEndpointConfig");function Sb(e,t){return t.filter(r=>Ie(r)&&r.parameters.filter(n=>{var i;return(i=n.parameterObject)==null?void 0:i.required}).every(n=>e.parameters.some(i=>i.name===n.name))&&r.response===e.response)}o(Sb,"getUpdateQueryEndpoints");var Ie=o(e=>e.method==="get","isQuery"),Ct=o(e=>e.method!=="get"||!!e.mediaDownload,"isMutation"),pi=o((e,t)=>Ie(e)&&(t??Object.values(bo)).every(r=>e.parameters.some(n=>n.name===r&&n.type==="Query")),"isInfiniteQuery"),bb=o((e,t,r)=>{let n=r.reduce((i,s)=>[...i,...Ir(e,s,{includeOnlyRequiredParams:!0}).map(a=>a.name)],[]);return Ir(e,t,{includeOnlyRequiredParams:!0,excludeBodyParam:!0}).filter(i=>n.includes(i.name)).map(i=>i.name)},"getDestructuredVariables");var $a=o((e,t)=>{let r=Ie(e)&&Ct(e)&&t;return`use${G(pe(e.operationName))}${r?"Mutation":""}`},"getQueryName"),_b=o(e=>`use${G(pe(e.operationName))}Infinite`,"getInfiniteQueryName");var wf=["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 un(e,t){let r={};return Object.keys(e).forEach(n=>{t.includes(n)&&(r[n]=e[n])}),r}o(un,"pick");function fi(e,t){let r=e.deprecated&&!t.withDeprecatedEndpoints,n=$r(e,t),i=US(n,t);return r||i}o(fi,"isOperationExcluded");function If({path:e,method:t,operation:r,options:n,tag:i,keepOperationTag:s,keepOperationPrefix:a}){let c=`${t}${HS(e)}`,u=r.operationId?At(r.operationId):c;if(n.removeOperationPrefixEndingWith&&a)u=u.split(n.removeOperationPrefixEndingWith).map((f,p)=>p===0?f:G(f)).join("");else if(n.removeOperationPrefixEndingWith&&!a){let l=new RegExp(`^.*${n.removeOperationPrefixEndingWith}`);u=u.replace(l,"")}if(n.tsNamespaces&&!s){let l=qS(u,i);l===""?u=t.toLowerCase():wf.includes(l)||(u=l)}return wf.includes(u)?c:u}o(If,"getOperationName");function Co({operationsByTag:e,...t}){let{operation:r,options:n}=t,i=n.splitByTags?$r(r,n):n.defaultTag,s=o(a=>{let c=If({...t,tag:i,keepOperationTag:a});if(e[i].filter(l=>If({...t,operation:l,tag:i,keepOperationTag:a})===c).length===1)return c},"operationName");return s()??s(!0)??If({...t,tag:i,keepOperationTag:!0,keepOperationPrefix:!0})}o(Co,"getUniqueOperationName");function Pb(e,t,r){let n=[];for(let i in e.paths){if(nn(i,r))continue;let s=e.paths[i],a=un(s,tn);for(let c in a){let u=a[c];if(!u||fi(u,r))continue;let l=Co({path:i,method:c,operation:u,operationsByTag:t,options:r});n.push(l)}}return n}o(Pb,"getUniqueOperationNamesWithoutSplitByTags");function Eb(e,t){let r={};for(let n in e.paths){if(nn(n,t))continue;let i=e.paths[n],s=un(i,tn);for(let a in s){let c=s[a];if(!c||fi(c,t))continue;let u=t.splitByTags?$r(c,t):t.defaultTag;r[u]||(r[u]=[]),r[u].push(c)}}return r}o(Eb,"getOperationsByTag");var $b={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"};function No(e){return{type:"invalid-schema",message:e}}o(No,"getInvalidSchemaError");function Ob(e){return{type:"invalid-operation-id",message:`Operation ${e}`}}o(Ob,"getInvalidOperationIdError");function xb(e,t){return{type:"missing-path-parameter",message:`Path ${t} is missing [${e.map(({name:r})=>r).join(", ")}]`}}o(xb,"getMissingPathParameterError");function Ab(e){return{type:"not-allowed-inline-enum",message:`${e} is missing @IsEnum() and @ApiProperty(enum:, enumName:)`}}o(Ab,"getNotAllowedInlineEnumError");function wb(e,t,r){return{type:"missing-acl-condition-property",message:`Condition property ${e} is not found in parameters or body in operation ${xa(t,r)}`}}o(wb,"getMissingAclConditionPropertyError");function Tf(e,t,r){return{type:"missing-status-code",message:`Missing HTTP status code ${Oa(e)} in operation ${xa(t,r)}`}}o(Tf,"getMissingStatusCodeError");function Ib(e,t,r){return{type:"invalid-status-code",message:`Operation ${xa(t,r)} expected HTTP status code ${Oa(e.expected)} but received ${Oa(e.received)}`}}o(Ib,"getInvalidStatusCodeError");function Tb(e,t,r){return{type:"multiple-success-status-codes",message:`Operation ${xa(t,r)} has multiple success HTTP status codes: ${e.map(Oa).join(", ")}`}}o(Tb,"getMultipleSuccessStatusCodesError");function xa(e,t){return e.operationId??`${t.method} ${t.path}`}o(xa,"getOperationDescriptor");function Oa(e){return`${e} (${$b[e]})`}o(Oa,"getStatusCodeDescription");function Nt({schema:e,meta:t,options:r}){let n=[];Pe(e.type).with("string",()=>n.push(TN(e))).with("number","integer",()=>n.push(RN(e))).with("array",()=>n.push(CN(e))).otherwise(()=>{}),typeof e.description=="string"&&e.description!==""&&r.withDescription&&([`
72
+ `,t};Y.prototype.Program=function(e){var t="",r=e.body,n=void 0,i=void 0;if(e.blockParams){var s="BLOCK PARAMS: [";for(n=0,i=e.blockParams.length;n<i;n++)s+=" "+e.blockParams[n];s+=" ]",t+=this.pad(s)}for(n=0,i=r.length;n<i;n++)t+=this.accept(r[n]);return this.padding--,t};Y.prototype.MustacheStatement=function(e){return this.pad("{{ "+this.SubExpression(e)+" }}")};Y.prototype.Decorator=function(e){return this.pad("{{ DIRECTIVE "+this.SubExpression(e)+" }}")};Y.prototype.BlockStatement=Y.prototype.DecoratorBlock=function(e){var t="";return t+=this.pad((e.type==="DecoratorBlock"?"DIRECTIVE ":"")+"BLOCK:"),this.padding++,t+=this.pad(this.SubExpression(e)),e.program&&(t+=this.pad("PROGRAM:"),this.padding++,t+=this.accept(e.program),this.padding--),e.inverse&&(e.program&&this.padding++,t+=this.pad("{{^}}"),this.padding++,t+=this.accept(e.inverse),this.padding--,e.program&&this.padding--),this.padding--,t};Y.prototype.PartialStatement=function(e){var t="PARTIAL:"+e.name.original;return e.params[0]&&(t+=" "+this.accept(e.params[0])),e.hash&&(t+=" "+this.accept(e.hash)),this.pad("{{> "+t+" }}")};Y.prototype.PartialBlockStatement=function(e){var t="PARTIAL BLOCK:"+e.name.original;return e.params[0]&&(t+=" "+this.accept(e.params[0])),e.hash&&(t+=" "+this.accept(e.hash)),t+=" "+this.pad("PROGRAM:"),this.padding++,t+=this.accept(e.program),this.padding--,this.pad("{{> "+t+" }}")};Y.prototype.ContentStatement=function(e){return this.pad("CONTENT[ '"+e.value+"' ]")};Y.prototype.CommentStatement=function(e){return this.pad("{{! '"+e.value+"' }}")};Y.prototype.SubExpression=function(e){for(var t=e.params,r=[],n=void 0,i=0,s=t.length;i<s;i++)r.push(this.accept(t[i]));return t="["+r.join(", ")+"]",n=e.hash?" "+this.accept(e.hash):"",this.accept(e.path)+" "+t+n};Y.prototype.PathExpression=function(e){var t=e.parts.join("/");return(e.data?"@":"")+"PATH:"+t};Y.prototype.StringLiteral=function(e){return'"'+e.value+'"'};Y.prototype.NumberLiteral=function(e){return"NUMBER{"+e.value+"}"};Y.prototype.BooleanLiteral=function(e){return"BOOLEAN{"+e.value+"}"};Y.prototype.UndefinedLiteral=function(){return"UNDEFINED"};Y.prototype.NullLiteral=function(){return"NULL"};Y.prototype.Hash=function(e){for(var t=e.pairs,r=[],n=0,i=t.length;n<i;n++)r.push(this.accept(t[n]));return"HASH{"+r.join(", ")+"}"};Y.prototype.HashPair=function(e){return e.key+"="+this.accept(e.value)}});var Wt=h((AB,HP)=>{var fc=MP().default,FP=DP();fc.PrintVisitor=FP.PrintVisitor;fc.print=FP.print;HP.exports=fc;function LP(e,t){var r=require("fs"),n=r.readFileSync(t,"utf8");e.exports=fc.compile(n)}o(LP,"extension");typeof require<"u"&&require.extensions&&(require.extensions[".handlebars"]=LP,require.extensions[".hbs"]=LP)});var F3={};SE(F3,{getGenerateFilesData:()=>L3,getGenerateMetadata:()=>D3});module.exports=bE(F3);var Td=Ge(aS());var yo="AppRestClient",ta={query:"AppQueryOptions",infiniteQuery:"AppInfiniteQueryOptions",mutation:"AppMutationOptions"},rf="src/data",cS="@/data",en={appRestClient:"@/util/rest/clients/app-rest-client",queryTypes:"@/types/react-query",errorHandling:"@/util/vendor/error-handling",abilityContext:"@/data/acl/ability.context"},hr={ErrorHandler:"ErrorHandler",SharedErrorHandler:"SharedErrorHandler"},ra={bindings:[hr.ErrorHandler,hr.SharedErrorHandler],from:en.errorHandling},nf="AbilityContext",uS={bindings:[nf],from:en.abilityContext};var na={reactQueryTypes:{fileName:"react-query.types",extension:"ts"},restClient:{fileName:"rest-client",extension:"ts"},restInterceptor:{fileName:"rest-interceptor",extension:"ts"}},ia={fileName:"app-rest-client",extension:"ts"},of="QueryModule",oa={fileName:"queryModules",extension:"ts"},lS={fileName:"queryConfig.context",extension:"tsx"},ni={optionsType:"MutationEffectsOptions",hookName:"useMutationEffects",runFunctionName:"runMutationEffects"},sa={fileName:"useMutationEffects",extension:"ts"},Ye={namespace:"ZodExtended",exports:{parse:"parse",sortExp:"sortExp"}},aa={fileName:"zod.extended",extension:"ts"};var pS="Schema",fS="Enum",dS="Body",mS="Param",hS="Response",gS="ErrorResponse",vo="z.void()",ca="z.instanceof(Blob)",So="z.enum",yS="z.int()",vS="z.number()",ua="z.string()",SS="z.email()",bS="z.url()",_S="z.uuid()",PS="z.iso.datetime({ offset: true })",ii={bindings:["z"],from:"zod"};var sf={input:"http://localhost:4000/docs-json/",output:"output",splitByTags:!0,defaultTag:"Common",excludeTags:[],excludePathRegex:"",excludeRedundantZodSchemas:!0,tsNamespaces:!0,tsPath:cS,importPath:"ts",configs:{models:{outputFileNameSuffix:"models",namespaceSuffix:"Models"},endpoints:{outputFileNameSuffix:"api",namespaceSuffix:"Api"},queries:{outputFileNameSuffix:"queries",namespaceSuffix:"Queries"},acl:{outputFileNameSuffix:"acl",namespaceSuffix:"Acl"}},standalone:!1,baseUrl:"",schemaSuffix:pS,enumSuffix:fS,withDefaultValues:!0,extractEnums:!0,replaceOptionalWithNullish:!1,restClientImportPath:en.appRestClient,errorHandlingImportPath:en.errorHandling,removeOperationPrefixEndingWith:"Controller_",parseRequestParams:!0,queryTypesImportPath:en.queryTypes,axiosRequestConfig:!1,infiniteQueries:!1,mutationEffects:!0,acl:!0,checkAcl:!0,abilityContextImportPath:en.abilityContext,abilityContextGenericAppAbilities:!1};var mt={query:"useQuery",infiniteQuery:"useInfiniteQuery",mutation:"useMutation"},ES={bindings:[mt.query,mt.infiniteQuery,mt.mutation],from:"@tanstack/react-query"},bo={pageParamName:"page"},la={pageParamName:"page",totalItemsName:"totalItems",limitParamName:"limit"},_o="moduleName";var mb=Ge($S());var af={"Content-Type":"application/json",Accept:"application/json"},pa="data",cf="axios",yr="config",xt="AxiosRequestConfig",fa={defaultImport:cf,bindings:[xt],from:"axios"};var OS=o(e=>/^(?:[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+)$/.test(e),"isValidPropertyName"),At=o(e=>e.replace(/^[^a-zA-Z_$]*/g,"").replace(/[^a-zA-Z0-9_$]+(\w)?/g,(t,r)=>(r==null?void 0:r.toUpperCase())??""),"invalidVariableNameCharactersToCamel");function D(e){return e!=null&&Object.prototype.hasOwnProperty.call(e,"$ref")}o(D,"isReferenceObject");function le(e){return!D(e)}o(le,"isSchemaObject");function da(e){return e.type==="array"}o(da,"isArraySchemaObject");function xS(e){if(!e.allOf)throw new Error("Function inferRequiredSchema is specialized to handle item with required only in an allOf array.");let[t,r]=e.allOf.reduce((i,s)=>{if(yN(s)){let a=s.required;i[0].push(...a??[])}else i[1].push(s);return i},[[],[]]),n={properties:t.reduce((i,s)=>(i[s]={},i),{}),type:"object",required:t};return{noRequiredOnlyAllof:r,composedRequiredSchema:n,patchRequiredSchemaInLoop:o((i,s)=>{if(D(i)){let a=s(i.$ref);a&&n.required.forEach(c=>{var u;n.properties[c]=((u=a==null?void 0:a.properties)==null?void 0:u[c])??{}})}else{let a=i.properties??{};n.required.forEach(c=>{a[c]&&(n.properties[c]=a[c]??{})})}},"patchRequiredSchemaInLoop")}}o(xS,"inferRequiredSchema");var yN=o(e=>!D(e)&&!!e.required&&!e.type&&!e.properties&&!(e!=null&&e.allOf)&&!(e!=null&&e.anyOf)&&!e.oneOf,"isBrokenAllOfItem");var Bt=Symbol.for("@ts-pattern/matcher"),vN=Symbol.for("@ts-pattern/isVariadic"),ha="@ts-pattern/anonymous-select-key",uf=o(e=>!!(e&&typeof e=="object"),"r"),ma=o(e=>e&&!!e[Bt],"i"),Tt=o((e,t,r)=>{if(ma(e)){let n=e[Bt](),{matched:i,selections:s}=n.match(t);return i&&s&&Object.keys(s).forEach(a=>r(a,s[a])),i}if(uf(e)){if(!uf(t))return!1;if(Array.isArray(e)){if(!Array.isArray(t))return!1;let n=[],i=[],s=[];for(let a of e.keys()){let c=e[a];ma(c)&&c[vN]?s.push(c):s.length?i.push(c):n.push(c)}if(s.length){if(s.length>1)throw new Error("Pattern error: Using `...P.array(...)` several times in a single pattern is not allowed.");if(t.length<n.length+i.length)return!1;let a=t.slice(0,n.length),c=i.length===0?[]:t.slice(-i.length),u=t.slice(n.length,i.length===0?1/0:-i.length);return n.every((l,f)=>Tt(l,a[f],r))&&i.every((l,f)=>Tt(l,c[f],r))&&(s.length===0||Tt(s[0],u,r))}return e.length===t.length&&e.every((a,c)=>Tt(a,t[c],r))}return Reflect.ownKeys(e).every(n=>{let i=e[n];return(n in t||ma(s=i)&&s[Bt]().matcherType==="optional")&&Tt(i,t[n],r);var s})}return Object.is(t,e)},"s"),Pr=o(e=>{var t,r,n;return uf(e)?ma(e)?(t=(r=(n=e[Bt]()).getSelectionKeys)==null?void 0:r.call(n))!=null?t:[]:Array.isArray(e)?Eo(e,Pr):Eo(Object.values(e),Pr):[]},"o"),Eo=o((e,t)=>e.reduce((r,n)=>r.concat(t(n)),[]),"c");function Je(e){return Object.assign(e,{optional:o(()=>SN(e),"optional"),and:o(t=>K(e,t),"and"),or:o(t=>bN(e,t),"or"),select:o(t=>t===void 0?AS(e):AS(t,e),"select")})}o(Je,"u");function SN(e){return Je({[Bt]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return t===void 0?(Pr(e).forEach(i=>n(i,void 0)),{matched:!0,selections:r}):{matched:Tt(e,t,n),selections:r}},"match"),getSelectionKeys:o(()=>Pr(e),"getSelectionKeys"),matcherType:"optional"})})}o(SN,"h");function K(...e){return Je({[Bt]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return{matched:e.every(i=>Tt(i,t,n)),selections:r}},"match"),getSelectionKeys:o(()=>Eo(e,Pr),"getSelectionKeys"),matcherType:"and"})})}o(K,"m");function bN(...e){return Je({[Bt]:()=>({match:o(t=>{let r={},n=o((i,s)=>{r[i]=s},"r");return Eo(e,Pr).forEach(i=>n(i,void 0)),{matched:e.some(i=>Tt(i,t,n)),selections:r}},"match"),getSelectionKeys:o(()=>Eo(e,Pr),"getSelectionKeys"),matcherType:"or"})})}o(bN,"d");function F(e){return{[Bt]:()=>({match:o(t=>({matched:!!e(t)}),"match")})}}o(F,"p");function AS(...e){let t=typeof e[0]=="string"?e[0]:void 0,r=e.length===2?e[1]:typeof e[0]=="string"?void 0:e[0];return Je({[Bt]:()=>({match:o(n=>{let i={[t??ha]:n};return{matched:r===void 0||Tt(r,n,(s,a)=>{i[s]=a}),selections:i}},"match"),getSelectionKeys:o(()=>[t??ha].concat(r===void 0?[]:Pr(r)),"getSelectionKeys")})})}o(AS,"y");function wt(e){return typeof e=="number"}o(wt,"v");function vr(e){return typeof e=="string"}o(vr,"b");function Sr(e){return typeof e=="bigint"}o(Sr,"w");var l5=Je(F(function(e){return!0}));var br=o(e=>Object.assign(Je(e),{startsWith:o(t=>{return br(K(e,(r=t,F(n=>vr(n)&&n.startsWith(r)))));var r},"startsWith"),endsWith:o(t=>{return br(K(e,(r=t,F(n=>vr(n)&&n.endsWith(r)))));var r},"endsWith"),minLength:o(t=>br(K(e,(r=>F(n=>vr(n)&&n.length>=r))(t))),"minLength"),length:o(t=>br(K(e,(r=>F(n=>vr(n)&&n.length===r))(t))),"length"),maxLength:o(t=>br(K(e,(r=>F(n=>vr(n)&&n.length<=r))(t))),"maxLength"),includes:o(t=>{return br(K(e,(r=t,F(n=>vr(n)&&n.includes(r)))));var r},"includes"),regex:o(t=>{return br(K(e,(r=t,F(n=>vr(n)&&!!n.match(r)))));var r},"regex")}),"j"),p5=br(F(vr)),It=o(e=>Object.assign(Je(e),{between:o((t,r)=>It(K(e,((n,i)=>F(s=>wt(s)&&n<=s&&i>=s))(t,r))),"between"),lt:o(t=>It(K(e,(r=>F(n=>wt(n)&&n<r))(t))),"lt"),gt:o(t=>It(K(e,(r=>F(n=>wt(n)&&n>r))(t))),"gt"),lte:o(t=>It(K(e,(r=>F(n=>wt(n)&&n<=r))(t))),"lte"),gte:o(t=>It(K(e,(r=>F(n=>wt(n)&&n>=r))(t))),"gte"),int:o(()=>It(K(e,F(t=>wt(t)&&Number.isInteger(t)))),"int"),finite:o(()=>It(K(e,F(t=>wt(t)&&Number.isFinite(t)))),"finite"),positive:o(()=>It(K(e,F(t=>wt(t)&&t>0))),"positive"),negative:o(()=>It(K(e,F(t=>wt(t)&&t<0))),"negative")}),"x"),f5=It(F(wt)),_r=o(e=>Object.assign(Je(e),{between:o((t,r)=>_r(K(e,((n,i)=>F(s=>Sr(s)&&n<=s&&i>=s))(t,r))),"between"),lt:o(t=>_r(K(e,(r=>F(n=>Sr(n)&&n<r))(t))),"lt"),gt:o(t=>_r(K(e,(r=>F(n=>Sr(n)&&n>r))(t))),"gt"),lte:o(t=>_r(K(e,(r=>F(n=>Sr(n)&&n<=r))(t))),"lte"),gte:o(t=>_r(K(e,(r=>F(n=>Sr(n)&&n>=r))(t))),"gte"),positive:o(()=>_r(K(e,F(t=>Sr(t)&&t>0))),"positive"),negative:o(()=>_r(K(e,F(t=>Sr(t)&&t<0))),"negative")}),"A"),d5=_r(F(Sr)),m5=Je(F(function(e){return typeof e=="boolean"})),h5=Je(F(function(e){return typeof e=="symbol"})),g5=Je(F(function(e){return e==null})),y5=Je(F(function(e){return e!=null}));var df=class df extends Error{constructor(t){let r;try{r=JSON.stringify(t)}catch{r=t}super(`Pattern matching error: no pattern matches value ${r}`),this.input=void 0,this.input=t}};o(df,"W");var lf=df,pf={matched:!1,value:void 0};function Pe(e){return new ff(e,pf)}o(Pe,"z");var Po=class Po{constructor(t,r){this.input=void 0,this.state=void 0,this.input=t,this.state=r}with(...t){if(this.state.matched)return this;let r=t[t.length-1],n=[t[0]],i;t.length===3&&typeof t[1]=="function"?i=t[1]:t.length>2&&n.push(...t.slice(1,t.length-1));let s=!1,a={},c=o((l,f)=>{s=!0,a[l]=f},"a"),u=!n.some(l=>Tt(l,this.input,c))||i&&!i(this.input)?pf:{matched:!0,value:r(s?ha in a?a[ha]:a:this.input,this.input)};return new Po(this.input,u)}when(t,r){if(this.state.matched)return this;let n=!!t(this.input);return new Po(this.input,n?{matched:!0,value:r(this.input,this.input)}:pf)}otherwise(t){return this.state.matched?this.state.value:t(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new lf(this.input)}run(){return this.exhaustive()}returnType(){return this}};o(Po,"I");var ff=Po;var mf=2,wS=["application/octet-stream","multipart/form-data","application/x-www-form-urlencoded","*/*"],IS=["query","header","path"],tn=["get","put","post","delete","options","head","patch","trace"],TS=["string","number","integer","boolean"],oi=["allOf","anyOf","oneOf"];var G=o(e=>e.charAt(0).toUpperCase()+e.slice(1),"capitalize"),Er=o(e=>e.charAt(0).toLowerCase()+e.slice(1),"decapitalize"),RS=o(e=>e.replace(/(-\w)/g,t=>t[1].toUpperCase()),"kebabToCamel"),pe=o(e=>e.replace(/(_\w)/g,t=>t[1].toUpperCase()),"snakeToCamel"),CS=o(e=>e.replace(/[\W_]+(\w)?/g,(t,r)=>(r==null?void 0:r.toUpperCase())??""),"nonWordCharactersToCamel"),hf=o((e,t="")=>e.endsWith(t)?e:`${e}${t}`,"suffixIfNeeded"),NS=o((e,t)=>e.replace(new RegExp(`${t}$`),""),"removeSuffix"),_N=o(e=>{var n;let t=e.reduce((i,s)=>({...i,[s]:(i[s]??0)+1}),{});return(n=Object.entries(t).sort((i,s)=>i[1]===s[1]?s[0].length-i[0].length:s[1]-i[1])[0])==null?void 0:n[0]},"getLongestMostCommon"),gf=o(e=>{let t=e.map(G).map(kS).map(r=>PN(r)).flat();return _N(t)},"getMostCommonAdjacentCombinationSplit"),kS=o(e=>e.split(/(?<![A-Z])(?=[A-Z])/).filter(Boolean),"splitByUppercase"),jS=o(e=>kS(e).join(" "),"camelToSpaceSeparated"),PN=o((e,t=["dto","by","for","of","in","to","and","with"])=>{var n;let r=[];for(let i=0;i<e.length;i++)if(!t.includes(e[i].toLowerCase()))for(let s=i+1;s<=e.length;s++)t.includes((n=e[s-1])==null?void 0:n.toLowerCase())||r.push(e.slice(i,s).join(""));return r},"getAdjacentStringCombinations"),qS=o((e,t)=>{let r=t.replace(/es$|s$/g,""),n=new RegExp(`(${Er(r)}|${G(r)})[a-z]*(?=$|[A-Z])`,"g");return e.replace(n,"")},"removeWord");var DS=o(e=>`#/components/schemas/${e}`,"getSchemaRef"),rn=o(e=>e[1]==="/"?e:"#/"+e.slice(1),"autocorrectRef"),si=o(e=>rn(e).split("/").at(-1),"getSchemaNameByRef");function vf(e){let t=EN(e).normalize("NFKD").trim().replace(/\s+/g,"_").replace(/--+/g,"-").replace(/-+/g,"_").replace(/[^\w-]+/g,"_");return pe(t)}o(vf,"normalizeString");function Sf(e){return/^[a-zA-Z]\w*$/.test(e)?e:`"${e}"`}o(Sf,"wrapWithQuotesIfNeeded");function LS(e){return typeof e=="string"&&e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}o(LS,"unwrapQuotesIfNeeded");function EN(e){let t=Number(e[0]);return typeof t=="number"&&!Number.isNaN(t)?"_"+e:e}o(EN,"prefixStringStartingWithNumberIfNeeded");function bf(e){let t=e.replaceAll("_","#");return pe(t.replaceAll("-","_")).replaceAll("#","_")}o(bf,"pathParamToVariableName");var Ut=o(e=>TS.includes(e),"isPrimitiveType");function FS(e){return e.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/([\u0000-\u0008\u000B\u000C\u000E-\u001F\u007F-\u009F\uFFFE\uFFFF])/g,(t,r)=>{let n=r.codePointAt(),i=n.toString(16);return n<=255?`\\x${`00${i}`.slice(-2)}`:`\\u${`0000${i}`.slice(-4)}`}).replace(/\//g,"\\/")}o(FS,"escapeControlCharacters");function Xe(e){return e.includes("application/")&&e.includes("json")||wS.includes(e)||e.includes("text/")}o(Xe,"isParamMediaTypeAllowed");function $o(e){return e>=200&&e<300}o($o,"isMainResponseStatus");function ga(e){return!(e>=200&&e<300)}o(ga,"isErrorStatus");function ai(e){return e.startsWith("application/")}o(ai,"isMediaTypeAllowed");var MS=/({\w+})/g,$N=/[^\w\-]+/g;function HS(e){e=G(RS(e.replaceAll("/","-")).replaceAll("-",""));let t=[...e.matchAll(MS)];if(t.length>0){let r=t.sort((n,i)=>n.index-i.index)[t.length-1][0];e=`${e.replace(MS,"")}By${G(r.slice(1,-1))}`}return e.replace($N,"_")}o(HS,"pathToVariableName");var yf=/{(\b\w+(?:-\w+)*\b)}/g;function VS(e){let t=e.match(yf);return t===null?e.replaceAll(yf,":$1"):(t.forEach(r=>{let n=bf(r.replaceAll(yf,":$1"));e=e.replaceAll(r,n)}),e)}o(VS,"replaceHyphenatedPath");var BS=o(e=>{let t=e["x-enumNames"],r=Array.isArray(t)&&t.length>0,n=!!e.schema&&le(e.schema)&&e.schema.type==="string";return r&&n},"isSortingParameterObject"),nn=o((e,t)=>t.excludePathRegex?new RegExp(t.excludePathRegex).test(e):!1,"isPathExcluded");function Rt(e){return CS(e)}o(Rt,"formatTag");function $r(e,t){var n;let r=(n=e.tags)==null?void 0:n[0];return Rt(r??t.defaultTag)}o($r,"getOperationTag");function US(e,t){return t.excludeTags.some(r=>r.toLowerCase()===e.toLowerCase())}o(US,"isTagExcluded");var ya={fileName:"acl/app.ability",extension:"ts"},Oo="AppAbilities",va={fileName:"acl/useAclCheck",extension:"ts"},Or="useAclCheck",fe={abilityTuple:"AbilityTuple",pureAbility:"PureAbility",forcedSubject:"ForcedSubject",subjectType:"Subject",subject:"subject"},_f={bindings:[fe.abilityTuple,fe.pureAbility,fe.forcedSubject,fe.subjectType,fe.subject],from:"@casl/ability"};var Fe=o((...e)=>[...new Set(e.flat())],"getUniqueArray");var xo=o(e=>`canUse${G(pe(e.operationName))}`,"getAbilityFunctionName"),GS=o((e,t)=>`${t.tsNamespaces?`${Z({type:"acl",tag:Ar(e,t),options:t})}.`:""}${xo(e)}`,"getImportedAbilityFunctionName"),Pf=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].action},"getAbilityAction"),Ef=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].subject},"getAbilitySubject"),Ao=o(e=>{var t;return!!((t=ci(e))!=null&&t.length)},"hasAbilityConditions"),ci=o(e=>{var t,r;return(r=(t=e.acl)==null?void 0:t[0].conditionsTypes)==null?void 0:r.sort((n,i)=>n.name.localeCompare(i.name))},"getAbilityConditionsTypes"),ZS=o(e=>{var t;return(t=e.acl)==null?void 0:t[0].description},"getAbilityDescription"),$f=o(e=>{var n;let t=Ef(e),r=[`"${t??""}"`];return Ao(e)&&r.push(`ForcedSubject<"${t}"> & { ${(n=ci(e))==null?void 0:n.map(i=>`${i.name}${i.required?"":"?"}: ${i.type??""}${i.zodSchemaName??""},`).join(" ")} }`),r},"getAbilitySubjectTypes");function Of({resolver:e,data:t,tag:r=""}){var c;let n=(c=t.get(r))==null?void 0:c.endpoints.filter(({acl:u})=>u&&u.length>0);if(!n||n.length===0)return;let i=n.some(({acl:u})=>(u==null?void 0:u[0].conditions)&&Object.keys(u[0].conditions).length>0),s=n.reduce((u,l)=>{var p,d;let f=(d=(p=l.acl)==null?void 0:p[0].conditionsTypes)==null?void 0:d.reduce((m,g)=>[...m,...g!=null&&g.zodSchemaName?[g.zodSchemaName]:[]],[]);return[...u,...f??[]]},[]),a=xr({resolver:e,tag:r,zodSchemasAsTypes:Fe(s)});return{endpoints:n,hasAdditionalAbilityImports:i,modelsImports:a}}o(Of,"getAclData");var zS=o(({resolver:e,data:t})=>{let r=new Map,n=[],i=!1;t.forEach((c,u)=>{let l=Of({resolver:e,data:t,tag:u});if(!l)return;let{modelsImports:f,hasAdditionalAbilityImports:p,endpoints:d}=l;n.push(f),i=i||p,d.forEach(m=>{let g=Pf(m);g&&r.set(g,new Set([...r.get(g)??[],...$f(m)]))})});let s=xf(e.options,...n);return{appAbilitiesType:r.size>0?Object.fromEntries(Array.from(r.entries()).map(([c,u])=>[c,Array.from(u)])):void 0,modelsImports:s,hasAdditionalAbilityImports:i}},"getAppAbilitiesType");function we(e,t){if(!e)return;let{data:r,onSchema:n}=t;if(D(e)&&n({type:"reference",schema:e,data:r})===!0)return;let i=e;if(oi.some(s=>s in i&&i[s])){let s=i.allOf??i.anyOf??i.oneOf??[];for(let a of s)(n==null?void 0:n({type:"composite",parentSchema:e,schema:a,data:r}))!==!0&&we(a,{data:r,onSchema:n})}if(i.properties)for(let[s,a]of Object.entries(i.properties))n({type:"property",parentSchema:e,schema:a,data:r,propertyName:s})!==!0&&we(a,t);if(i.additionalProperties&&typeof i.additionalProperties=="object"){if(n({type:"additionalProperties",parentSchema:e,schema:i.additionalProperties,data:r})===!0)return;we(i.additionalProperties,t)}if(i.type==="array"){let s=e.items;if(n({type:"array",parentSchema:e,schema:s,data:r})===!0)return;we(s,t)}}o(we,"iterateSchema");var on=o((e,t)=>hf(G(vf(e)),t),"getZodSchemaName"),wo=o((e,t,r)=>hf(G(vf(e)),`${t}${r}`),"getEnumZodSchemaName"),de=o(e=>["z.",`${Ye.namespace}.`].every(t=>!e.startsWith(t)),"isNamedZodSchema"),KS=o(e=>e.startsWith(So),"isEnumZodSchema"),sn=o((e,t,r)=>t?e:`${r}_${e}`,"getZodSchemaOperationName"),Sa=o(e=>pe(`${e}_${dS}`),"getBodyZodSchemaName"),QS=o((e,t)=>pe(`${e}_${t}${mS}`),"getParamZodSchemaName"),ON=o(e=>pe(`${e}${hS}`),"getMainResponseZodSchemaName"),xN=o((e,t)=>pe(`${e}_${t}_${gS}`),"getErrorResponseZodSchemaName");function ba({statusCode:e,operationName:t,isUniqueOperationName:r,tag:n}){let i=Number(e),s=sn(t,r,n);return!$o(i)&&e!=="default"&&ga(i)?xN(s,e):ON(s)}o(ba,"getResponseZodSchemaName");function Io(e){return["minimum","exclusiveMinimum","maximum","exclusiveMaximum","minItems","minLength","minProperties","maxItems","maxLength","maxProperties","default","example"].filter(n=>e[n]).reduce((n,i)=>[...n,`${G(jS(i))}: \`${e[i]}\``],[])}o(Io,"getSchemaDescriptions");var To=o((e,t)=>NS(e,t.schemaSuffix),"getZodSchemaInferedTypeName"),WS=o((e,t)=>de(t)?`${e.options.tsNamespaces?`${Z({type:"models",tag:e.getTagByZodSchemaName(t),options:e.options})}.`:""}${t}`:t,"getImportedZodSchemaName"),wr=o((e,t,r)=>{if(!de(t))return t===vo?"void":t;let n=e.getTagByZodSchemaName(t);return`${e.options.tsNamespaces&&n!==r?`${Z({type:"models",tag:n,options:e.options})}.`:""}${To(t,e.options)}`},"getImportedZodSchemaInferedTypeName");function YS(e){var t;return e.isEnum?"enum":((t=e.schemaObj)==null?void 0:t.type)??"object"}o(YS,"getZodSchemaType");function JS(e){if(e.schemaObj)return[e.schemaObj.description,...Io(e.schemaObj)].filter(Boolean).join(". ")}o(JS,"getZodSchemaDescription");function XS(e,t,r){var n;if(D(t)){let i=e.getZodSchemaNameByRef(t.$ref);return i?wr(e,i,r):void 0}if(da(t)){if(!D(t.items))return`${((n=t.items)==null?void 0:n.type)??"unknown"}[]`;let i=e.getZodSchemaNameByRef(t.items.$ref);return i?`${wr(e,i,r)}[]`:void 0}if(oi.some(i=>i in t&&t[i])){let i=t.allOf??t.anyOf??t.oneOf??[];if(i.length>0)return XS(e,i[0],r)}return t.type}o(XS,"getType");function eb(e,t,r){if(!t.schemaObj)return[];let n="[0]",i="[key]",s={},a=o(c=>{var l;if(c.type==="reference")return!0;if(c.type==="composite")return;let u=[...((l=c.data)==null?void 0:l.pathSegments)??[]];if(c.type==="array"?u.push(n):c.type==="property"?u.push(c.propertyName):c.type==="additionalProperties"&&u.push(i),c.schema&&u[u.length-1]!==n){let f=e.resolveObject(c.schema),p=[f.description,...Io(f)].filter(Boolean),d=u.join(".");s[d]&&"type"in c.schema&&c.schema.type==="object"||(delete s[d],s[d]={type:XS(e,c.schema,r)??"unknown",description:p.join(". ")})}return we(c.schema,{data:{pathSegments:[...u]},onSchema:a}),!0},"onSchema");return"allOf"in t.schemaObj&&t.schemaObj.allOf&&t.schemaObj.allOf.forEach(c=>{if(D(c)){let u=e.resolveObject(c);we(u,{data:{pathSegments:[]},onSchema:a})}}),we(t.schemaObj,{data:{pathSegments:[]},onSchema:a}),s}o(eb,"getZodSchemaPropertyDescriptions");function xr({resolver:e,tag:t,zodSchemas:r=[],zodSchemasAsTypes:n=[]}){let i="models",s=o(u=>e.getTagByZodSchemaName(u),"getTag"),a=_a({type:i,tag:t,entities:r,getTag:s,getEntityName:o(u=>u,"getEntityName"),options:e.options}),c=_a({type:i,tag:t,entities:n,getTag:s,getEntityName:o(u=>To(u,e.options),"getEntityName"),options:e.options});return xf(e.options,a,c)}o(xr,"getModelsImports");function tb({tag:e,endpoints:t,options:r}){return _a({type:"endpoints",tag:e,entities:t,getTag:o(n=>Ar(n,r),"getTag"),getEntityName:Ro,options:r})}o(tb,"getEndpointsImports");function rb({tag:e,endpoints:t,options:r}){return _a({type:"acl",tag:e,entities:t,getTag:o(n=>Ar(n,r),"getTag"),getEntityName:xo,options:r})}o(rb,"getAclImports");function Gt(e){let t=e.tsPath;return e.importPath==="relative"?t="../":e.importPath==="absolute"?t=e.output:new RegExp(`${rf}`,"g").test(e.output)&&(t=e.output.replace(new RegExp(`.*${rf}`,"g"),e.tsPath)),`${t}/`.replace(/\/\//g,"/")}o(Gt,"getImportPath");function _a({type:e="models",tag:t,entities:r,getTag:n,getEntityName:i,options:s}){let a=new Map;return r.forEach(c=>{let u=n(c);if(a.has(u))s.tsNamespaces||a.get(u).bindings.push(i(c));else{let l=t===u;a.set(u,{bindings:[s.tsNamespaces?Z({type:e,tag:u,options:s}):i(c)],from:`${l?"./":Gt(s)}${ui({type:e,tag:u,includeTagDir:!l,options:s})}`})}}),Array.from(a.values())}o(_a,"getImports");function xf(e,...t){let r=new Map;return t.forEach(n=>{n.forEach(i=>{r.has(i.from)?e.tsNamespaces||r.get(i.from).bindings.push(...i.bindings):r.set(i.from,i)})}),Array.from(r.values()).map(n=>({...n,bindings:Fe(n.bindings)}))}o(xf,"mergeImports");function an({fileName:e,extension:t}){return`${e}.${t}`}o(an,"getFileNameWithExtension");function nb({type:e,tag:t,options:r,includeTagDir:n=!0}){let i=r.configs[e].outputFileNameSuffix;return t?`${n?`${Er(t)}/`:""}${Er(t)}.${i}`:i}o(nb,"getTagFileNameWithoutExtension");function ui(...e){return nb(...e)}o(ui,"getTagImportPath");function ib(...e){return`${nb(...e)}.ts`}o(ib,"getTagFileName");var Z=o(({type:e,tag:t,options:r})=>`${G(t)}${r.configs[e].namespaceSuffix}`,"getNamespaceName");function ob(e){return e.standalone?`${Gt(e)}${ia.fileName}`:e.restClientImportPath}o(ob,"getAppRestClientImportPath");function sb(e){return e.standalone?`${Gt(e)}${na.reactQueryTypes.fileName}`:e.queryTypesImportPath}o(sb,"getQueryTypesImportPath");function ab(e){return`${Gt(e)}${oa.fileName}`}o(ab,"getQueryModulesImportPath");function cb(e){return`${Gt(e)}${sa.fileName}`}o(cb,"getMutationEffectsImportPath");function ub(e){return`${Gt(e)}${va.fileName}`}o(ub,"getAclCheckImportPath");function lb(e){return`${Gt(e)}${aa.fileName}`}o(lb,"getZodExtendedImportPath");function pb(e){return`${Gt(e)}${ya.fileName}`}o(pb,"getAppAbilitiesImportPath");function Pa(e){return Pe(e).with("string",()=>"string").with("number",()=>"number").with("integer",()=>"number").with("boolean",()=>"boolean").exhaustive()}o(Pa,"primitiveTypeToTsType");function li({zodSchemaName:e,schema:t,resolver:r}){let n="void",i;e&&de(e)?(n=wr(r,e),i=r.getTagByZodSchemaName(e)):t!=null&&t.type&&Ut(t==null?void 0:t.type)&&(n=Pa(t==null?void 0:t.type));let s=n.split(".");return{type:s[s.length-1],...s.length>1?{namespace:s[0]}:{},...i?{importPath:ui({type:"models",tag:i,includeTagDir:!0,options:r.options})}:{}}}o(li,"getTsTypeBase");function cn({schema:e,isCircular:t,parentTypes:r,resolver:n}){if(!e)return{metaType:"primitive"};for(let i of oi){let s=e[i];if(s)if(s.length>1){let a=s.map(c=>{let u=n.resolveObject(c);return cn({schema:u,parentTypes:r,resolver:n})});return a.every(({metaType:c})=>c==="object")?{metaType:"object",objectProperties:a.reduce((c,{objectProperties:u})=>{let l=u.map(({name:f})=>f);return[...c.filter(({name:f})=>!l.includes(f)),...u]},[])}:{metaType:"composite",[i]:a}}else e=n.resolveObject(s[0])}return e.type==="array"?{metaType:"array",arrayType:fb({arraySchema:e,resolver:n,parentTypes:r})}:(e.type==="object"||e.properties)&&t?{metaType:"object",objectProperties:[],isCircular:!0}:e.type==="object"||e.properties?{metaType:"object",objectProperties:AN({schema:e,parentTypes:r,resolver:n})}:{metaType:"primitive"}}o(cn,"getSchemaTsMetaType");function fb({arraySchema:e,parentTypes:t,resolver:r}){let n,i;if(D(e.items)){let u=e.items.$ref;n=r.getZodSchemaNameByRef(u),i=r.getSchemaByRef(u)}else i=e.items;let s=li({zodSchemaName:n,schema:i,resolver:r}),a=db(s,t),c=cn({schema:i,isCircular:a,parentTypes:[...t,s],resolver:r});return{...s,...c}}o(fb,"getArraySchemaTsType");function AN({schema:e,parentTypes:t,resolver:r}){return Object.entries((e==null?void 0:e.properties)??{}).map(([n,i])=>{var a;let s=((a=e==null?void 0:e.required)==null?void 0:a.includes(n))??!1;if(D(i)){let c=r.getZodSchemaNameByRef(i.$ref),u=r.getSchemaByRef(i.$ref),l=li({zodSchemaName:c,schema:u,resolver:r}),f=db(l,t),p=cn({schema:u,isCircular:f,parentTypes:[...t,l],resolver:r});return{name:n,isRequired:s,...l,...p}}else if(i.type==="array"){let c=fb({arraySchema:i,parentTypes:t,resolver:r});return{name:n,isRequired:s,type:"array",metaType:"array",arrayType:c}}else if(Ut(i.type))return{name:n,isRequired:s,type:Pa(i.type),metaType:"primitive"};return{name:n,isRequired:s,type:"void",metaType:"primitive"}})}o(AN,"getSchemaTsProperties");function db(e,t){return t.findIndex(({type:r,namespace:n})=>r===e.type&&n===e.namespace)>-1}o(db,"getIsCircular");var Ro=o(e=>Er(pe(e.operationName)),"getEndpointName");function hb(e,t){return`${t.tsNamespaces?`${Z({type:"endpoints",tag:Ar(e,t),options:t})}.`:""}${Ro(e)}`}o(hb,"getImportedEndpointName");var gb=o(e=>e.method!==mb.OpenAPIV3.HttpMethods.GET,"requiresBody"),Ea=o(e=>e.parameters.find(t=>t.type==="Body"),"getEndpointBody"),yb=o((e,t)=>{let r=Af(e),n=t.options.axiosRequestConfig;return Object.keys(r).length>0||n},"hasEndpointConfig"),vb=o(e=>e.path.replace(/:([a-zA-Z0-9_]+)/g,"${$1}"),"getEndpointPath");function Ar(e,t){var n;let r=t.splitByTags?(n=e.tags)==null?void 0:n[0]:t.defaultTag;return Rt(r??t.defaultTag)}o(Ar,"getEndpointTag");function Ir(e,t,r){let n=t.parameters.map(i=>{var a,c,u,l;let s="string";if(de(i.zodSchema))s=wr(e,i.zodSchema);else if((a=i.parameterObject)!=null&&a.schema&&le(i.parameterObject.schema)){let f=(u=(c=i.parameterObject)==null?void 0:c.schema)==null?void 0:u.type;f&&Ut(f)&&(s=Pa(f))}return{name:At(i.name),type:s,paramType:i.type,required:((l=i.parameterObject)==null?void 0:l.required)??!0,parameterObject:i.parameterObject,bodyObject:i.bodyObject}});return r!=null&&r.includeFileParam&&t.mediaUpload&&n.push({name:"file",type:"File",paramType:"Body",required:!0,parameterObject:void 0,bodyObject:void 0}),n.sort((i,s)=>{if(i.required===s.required){let a=["Path","Body","Query","Header"];return a.indexOf(i.paramType)-a.indexOf(s.paramType)}return i.required?-1:1}).filter(i=>(!(r!=null&&r.excludeBodyParam)||i.name!==pa)&&(!(r!=null&&r.excludePageParam)||i.name!==bo.pageParamName)&&(!(r!=null&&r.includeOnlyRequiredParams)||i.required)).map(i=>({...i,name:r!=null&&r.replacePageParam&&i.name===bo.pageParamName?"pageParam":i.name,required:i.required&&(i.paramType==="Path"||!(r!=null&&r.pathParamsRequiredOnly))}))}o(Ir,"mapEndpointParamsToFunctionParams");function Af(e){let t=e.parameters.filter(i=>i.type==="Query").map(i=>{let s=OS(i.name)?i.name:`"${i.name}"`,a=At(i.name);return{...i,name:s,value:a}}),r={};return e.requestFormat!==af["Content-Type"]&&(r["Content-Type"]=`'${e.requestFormat}'`),e.responseFormat&&e.responseFormat!==af.Accept&&(r.Accept=`'${e.responseFormat}'`),e.parameters.filter(i=>i.type==="Header").forEach(i=>{r[i.name]=At(i.name)}),{...t.length>0?{params:t}:{},...Object.keys(r).length?{headers:r}:{}}}o(Af,"getEndpointConfig");function Sb(e,t){return t.filter(r=>Ie(r)&&r.parameters.filter(n=>{var i;return(i=n.parameterObject)==null?void 0:i.required}).every(n=>e.parameters.some(i=>i.name===n.name))&&r.response===e.response)}o(Sb,"getUpdateQueryEndpoints");var Ie=o(e=>e.method==="get","isQuery"),Ct=o(e=>e.method!=="get"||!!e.mediaDownload,"isMutation"),pi=o((e,t)=>Ie(e)&&(t??Object.values(bo)).every(r=>e.parameters.some(n=>n.name===r&&n.type==="Query")),"isInfiniteQuery"),bb=o((e,t,r)=>{let n=r.reduce((i,s)=>[...i,...Ir(e,s,{includeOnlyRequiredParams:!0}).map(a=>a.name)],[]);return Ir(e,t,{includeOnlyRequiredParams:!0,excludeBodyParam:!0}).filter(i=>n.includes(i.name)).map(i=>i.name)},"getDestructuredVariables");var $a=o((e,t)=>{let r=Ie(e)&&Ct(e)&&t;return`use${G(pe(e.operationName))}${r?"Mutation":""}`},"getQueryName"),_b=o(e=>`use${G(pe(e.operationName))}Infinite`,"getInfiniteQueryName");var wf=["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 un(e,t){let r={};return Object.keys(e).forEach(n=>{t.includes(n)&&(r[n]=e[n])}),r}o(un,"pick");function fi(e,t){let r=e.deprecated&&!t.withDeprecatedEndpoints,n=$r(e,t),i=US(n,t);return r||i}o(fi,"isOperationExcluded");function If({path:e,method:t,operation:r,options:n,tag:i,keepOperationTag:s,keepOperationPrefix:a}){let c=`${t}${HS(e)}`,u=r.operationId?At(r.operationId):c;if(n.removeOperationPrefixEndingWith&&a)u=u.split(n.removeOperationPrefixEndingWith).map((f,p)=>p===0?f:G(f)).join("");else if(n.removeOperationPrefixEndingWith&&!a){let l=new RegExp(`^.*${n.removeOperationPrefixEndingWith}`);u=u.replace(l,"")}if(n.tsNamespaces&&!s){let l=qS(u,i);l===""?u=t.toLowerCase():wf.includes(l)||(u=l)}return wf.includes(u)?c:u}o(If,"getOperationName");function Co({operationsByTag:e,...t}){let{operation:r,options:n}=t,i=n.splitByTags?$r(r,n):n.defaultTag,s=o(a=>{let c=If({...t,tag:i,keepOperationTag:a});if(e[i].filter(l=>If({...t,operation:l,tag:i,keepOperationTag:a})===c).length===1)return c},"operationName");return s()??s(!0)??If({...t,tag:i,keepOperationTag:!0,keepOperationPrefix:!0})}o(Co,"getUniqueOperationName");function Pb(e,t,r){let n=[];for(let i in e.paths){if(nn(i,r))continue;let s=e.paths[i],a=un(s,tn);for(let c in a){let u=a[c];if(!u||fi(u,r))continue;let l=Co({path:i,method:c,operation:u,operationsByTag:t,options:r});n.push(l)}}return n}o(Pb,"getUniqueOperationNamesWithoutSplitByTags");function Eb(e,t){let r={};for(let n in e.paths){if(nn(n,t))continue;let i=e.paths[n],s=un(i,tn);for(let a in s){let c=s[a];if(!c||fi(c,t))continue;let u=t.splitByTags?$r(c,t):t.defaultTag;r[u]||(r[u]=[]),r[u].push(c)}}return r}o(Eb,"getOperationsByTag");var $b={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"};function No(e){return{type:"invalid-schema",message:e}}o(No,"getInvalidSchemaError");function Ob(e){return{type:"invalid-operation-id",message:`Operation ${e}`}}o(Ob,"getInvalidOperationIdError");function xb(e,t){return{type:"missing-path-parameter",message:`Path ${t} is missing [${e.map(({name:r})=>r).join(", ")}]`}}o(xb,"getMissingPathParameterError");function Ab(e){return{type:"not-allowed-inline-enum",message:`${e} is missing @IsEnum() and @ApiProperty(enum:, enumName:)`}}o(Ab,"getNotAllowedInlineEnumError");function wb(e,t,r){return{type:"missing-acl-condition-property",message:`Condition property ${e} is not found in parameters or body in operation ${xa(t,r)}`}}o(wb,"getMissingAclConditionPropertyError");function Tf(e,t,r){return{type:"missing-status-code",message:`Missing HTTP status code ${Oa(e)} in operation ${xa(t,r)}`}}o(Tf,"getMissingStatusCodeError");function Ib(e,t,r){return{type:"invalid-status-code",message:`Operation ${xa(t,r)} expected HTTP status code ${Oa(e.expected)} but received ${Oa(e.received)}`}}o(Ib,"getInvalidStatusCodeError");function Tb(e,t,r){return{type:"multiple-success-status-codes",message:`Operation ${xa(t,r)} has multiple success HTTP status codes: ${e.map(Oa).join(", ")}`}}o(Tb,"getMultipleSuccessStatusCodesError");function xa(e,t){return e.operationId??`${t.method} ${t.path}`}o(xa,"getOperationDescriptor");function Oa(e){return`${e} (${$b[e]})`}o(Oa,"getStatusCodeDescription");function Nt({schema:e,meta:t,options:r}){let n=[];Pe(e.type).with("string",()=>n.push(TN(e))).with("number","integer",()=>n.push(CN(e))).with("array",()=>n.push(NN(e))).otherwise(()=>{}),typeof e.description=="string"&&e.description!==""&&r.withDescription&&([`
73
73
  `,"\r",`\r
74
- `].some(s=>String.prototype.includes.call(e.description,s))?n.push(`describe(\`${e.description}\`)`):n.push(`describe("${e.description}")`));let i=n.concat(wN({schema:e,meta:t,options:r}),r.withDefaultValues!==!1?IN(e):[]).filter(Boolean).join(".");return i?`.${i}`:""}o(Nt,"getZodChain");function wN({schema:e,meta:t,options:r}){return e.nullable&&!(t!=null&&t.isRequired)?"nullish()":e.nullable||r.replaceOptionalWithNullish&&(t!=null&&t.isParentPartial)?"nullable()":t!=null&&t.isRequired?"":r.replaceOptionalWithNullish?"nullish()":"optional()"}o(wN,"getZodChainablePresence");function IN(e){return e.default!==void 0?`default(${Pe(e.type).with("number","integer",()=>LS(e.default)).otherwise(()=>JSON.stringify(e.default))})`:""}o(IN,"getZodChainableDefault");function TN(e){let t=[];return e.enum||(e.minLength!==void 0&&t.push(`min(${e.minLength})`),e.maxLength!==void 0&&t.push(`max(${e.maxLength})`)),t.join(".")}o(TN,"getZodChainableStringValidations");function RN(e){let t=[];return e.enum?"":(e.minimum!==void 0?e.exclusiveMinimum===!0?t.push(`gt(${e.minimum})`):t.push(`gte(${e.minimum})`):typeof e.exclusiveMinimum=="number"&&t.push(`gt(${e.exclusiveMinimum})`),e.maximum!==void 0?e.exclusiveMaximum===!0?t.push(`lt(${e.maximum})`):t.push(`lte(${e.maximum})`):typeof e.exclusiveMaximum=="number"&&t.push(`lt(${e.exclusiveMaximum})`),e.multipleOf&&t.push(`multipleOf(${e.multipleOf})`),t.join("."))}o(RN,"getZodChainableNumberValidations");function CN(e){let t=[];return e.minItems&&t.push(`min(${e.minItems})`),e.maxItems&&t.push(`max(${e.maxItems})`),t.join(".")}o(CN,"getZodChainableArrayValidations");var ln=o(e=>e.reduce((t,r)=>t+r,0),"sum");function ae(e,t){if(!t)return e;if(D(t))return e+2;if(Array.isArray(t.type))return t.type.length===1?He("oneOf")+ae(e,{...t,type:t.type[0]}):e+He("oneOf")+ln(t.type.map(r=>ae(0,{...t,type:r})));if(t.oneOf)return t.oneOf.length===1?He("oneOf")+ae(e,t.oneOf[0]):e+He("oneOf")+ln(t.oneOf.map(r=>ae(0,r)));if(t.anyOf)return t.anyOf.length===1?He("anyOf")+ae(e,t.anyOf[0]):e+He("anyOf")+ln(t.anyOf.map(r=>ae(0,r)));if(t.allOf)return t.allOf.length===1?He("allOf")+ae(e,t.allOf[0]):e+He("allOf")+ln(t.allOf.map(r=>ae(0,r)));if(!t.type)return e;if(Ut(t.type))return t.enum?e+Rb(t)+He("enum")+ln(t.enum.map(r=>ae(0,r))):e+Rb(t);if(t.type==="array")return t.items?He("array")+ae(e,t.items):He("array")+ae(e);if(t.type==="object"||t.properties||t.additionalProperties){if(t.properties){let r=Object.values(t.properties);e+=He("object")+ln(r.map(n=>ae(0,n)))}else e+=He("empty-object");t.additionalProperties&&(typeof t.additionalProperties=="object"?e+=ae(0,t.additionalProperties):e+=ae(1))}return e}o(ae,"getOpenAPISchemaComplexity");function Rb(e){return Pe(e.type).with("string","number","integer","boolean",()=>1).otherwise(()=>0)}o(Rb,"complexityByType");function He(e){return Pe(e).with("oneOf",()=>2).with("anyOf",()=>3).with("allOf",()=>2).with("enum","array","empty-object",()=>1).with("object",()=>2).otherwise(()=>0)}o(He,"complexityByComposite");var Cf=class Cf{constructor(t,r,n={referencedBy:[]},i){this.schema=t;this.resolver=r;D(t)&&(this.ref=t.$ref),i&&(this.enumRef=i),this.meta={...n,referencedBy:[...(n==null?void 0:n.referencedBy)??[]]},this.ref&&this.meta.referencedBy.push(this)}code;ref;enumRef;children=[];meta;getCodeString(t,r){var s,a;if(!this.ref&&this.code)return this.code;if(!this.ref)throw new Error("Zod schema is missing both ref and code");let n=(s=this.resolver)==null?void 0:s.getZodSchemaNameByRef(this.ref);if(!n)return this.ref;let i=(a=this.resolver)==null?void 0:a.getTagByZodSchemaName(n);return r!=null&&r.tsNamespaces&&i&&i!==t?`${Z({type:"models",tag:i,options:r})}.${n}`:n}get complexity(){return ae(0,this.schema)}assign(t){return this.code=t,this}inherit(t){return t&&t.children.push(this),this}};o(Cf,"ZodSchema");var ko=Cf;function Rf(e){var t,r;if(e)return(t=e.parent)!=null&&t.ref?e.parent.ref:Rf((r=e.parent)==null?void 0:r.meta)}o(Rf,"getParentRef");function Cb(e,t){let r=e.getRefByZodSchemaName(t);if(r){let i=Array.from(e.dependencyGraph.refsDependencyGraph[r]??[]).map(a=>e.getZodSchemaNameByRef(a)),s=e.getExtractedEnumZodSchemaNamesReferencedBySchemaRef(r);return[...i,...s]}let n=e.getCompositeZodSchemaByZodSchemaName(t);return n?Array.from(Aa(n)).map(i=>e.getZodSchemaNameByRef(i)):[]}o(Cb,"getZodSchemaRefs");function Aa(e,{skipObjectSchema:t=!1}={}){return e.children.reduce((n,i)=>{let s=i.ref??i.enumRef;return s&&n.add(s),i.children.length>0&&(!t||!le(i.schema)||i.schema.type!=="object")&&Aa(i).forEach(a=>n.add(a)),n},new Set)}o(Aa,"getSchemaRefs");function W({schema:e,resolver:t,meta:r,tag:n}){var g;let i=new ko(e,t,r),s={parent:i.inherit(r==null?void 0:r.parent),referencedBy:[...i.meta.referencedBy]},a={resolver:t,meta:s,tag:n};if(D(e))return NN({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});let c=jN({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(c)return c;let u=kN({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(u)return u;let l=qN({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(l)return l;let f=MN({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(f)return f;let p=DN({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(p)return p;let d=t.options.allReadonly?".readonly()":"";if(da(e))return e.items?i.assign(`z.array(${W({...a,schema:e.items}).getCodeString(n,t.options)}${Nt({schema:e.items,meta:{...s,isRequired:!0},options:t.options})})${d}`):i.assign(`z.array(z.any())${d}`);let m=e.type?e.type.toLowerCase():void 0;if(m==="object"||e.properties||e.additionalProperties){let y=e.required&&e.required.length>0,v=t.options.withImplicitRequiredProps?!1:e.properties&&!((g=e.required)!=null&&g.length),S="{}";e.properties&&(S=`{ ${Object.entries(e.properties).map(([I,T])=>{var Mt;let ge={...s,isRequired:v?!0:y?(Mt=e.required)==null?void 0:Mt.includes(I):t.options.withImplicitRequiredProps,name:I,isParentPartial:v},re=T;if(D(T)&&t&&(re=t.getSchemaByRef(T.$ref),!re))throw new Error(`Schema ${T.$ref} not found`);let L=W({...a,schema:T,meta:ge}),X=L.getCodeString(n,t.options)+Nt({schema:re,meta:ge,options:t.options}),oe=!1,qt=Rf(r);return qt&&(oe=[...D(T)?[T.$ref]:[],...Aa(L,{skipObjectSchema:!0})].some(Ue=>{var Rd;return(Rd=t.dependencyGraph.deepDependencyGraph[Ue])==null?void 0:Rd.has(qt)})),[I,X,oe]}).map(([I,T,ge])=>ge?`get ${Sf(I)}() { return ${T} }`:`${Sf(I)}: ${T}`).join(", ")} }`);let b="";e.additionalProperties&&(b=`.catchall(${typeof e.additionalProperties=="object"&&Object.keys(e.additionalProperties).length>0?W({...a,schema:e.additionalProperties}).getCodeString(n,t.options)+Nt({schema:e.additionalProperties,meta:{...s,isRequired:!0},options:t.options}):"z.any()"})`);let E=`z.object(${S})${v?".partial()":""}${b}${d}`;return i.assign(E)}if(m==="any")return i.assign("z.any()");if(!m)return i.assign("z.unknown()");throw new Error(`Unsupported schema type: ${m}`)}o(W,"getZodSchema");function NN({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!D(e))return;let s=t.meta.referencedBy.slice(0,-1).map(u=>u.ref?r.getZodSchemaNameByRef(u.ref)??u.ref:void 0).filter(Boolean),a=r.getZodSchemaNameByRef(e.$ref);if(s.length>1&&s.includes(a))return t.assign(r.getCodeByZodSchemaName(t.ref));let c=r.getCodeByZodSchemaName(e.$ref);if(!c){let u=r.getSchemaByRef(e.$ref);if(!u)throw new Error(`Schema ${e.$ref} not found`);c=W({schema:u,resolver:r,meta:n,tag:i}).getCodeString(i,r.options)}return r.getCodeByZodSchemaName(a)||r.setZodSchema(a,c,i),t}o(NN,"getReferenceZodSchema");function kN({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){var a;if(!le(e)||!e.oneOf)return;if(e.oneOf.length===1){let c=W({schema:e.oneOf[0],resolver:r,meta:n,tag:i});return t.assign(c.getCodeString(i,r.options))}let s=(a=e.oneOf)==null?void 0:a.some(c=>le(c)&&((c==null?void 0:c.allOf)||[]).length>1);if(e.discriminator&&!s){let c=e.discriminator.propertyName;return t.assign(`
74
+ `].some(s=>String.prototype.includes.call(e.description,s))?n.push(`describe(\`${e.description}\`)`):n.push(`describe("${e.description}")`));let i=n.concat(wN({schema:e,meta:t,options:r}),r.withDefaultValues!==!1?IN(e):[]).filter(Boolean).join(".");return i?`.${i}`:""}o(Nt,"getZodChain");function wN({schema:e,meta:t,options:r}){return e.nullable&&!(t!=null&&t.isRequired)?"nullish()":e.nullable||r.replaceOptionalWithNullish&&(t!=null&&t.isParentPartial)?"nullable()":t!=null&&t.isRequired?"":r.replaceOptionalWithNullish?"nullish()":"optional()"}o(wN,"getZodChainablePresence");function IN(e){return e.default!==void 0?`default(${Pe(e.type).with("number","integer",()=>LS(e.default)).otherwise(()=>JSON.stringify(e.default))})`:""}o(IN,"getZodChainableDefault");function TN(e){let t=[];return e.enum||(e.minLength!==void 0&&t.push(`min(${e.minLength})`),e.maxLength!==void 0&&t.push(`max(${e.maxLength})`)),e.pattern&&t.push(`regex(${RN(e.pattern)})`),t.join(".")}o(TN,"getZodChainableStringValidations");function RN(e){return e.startsWith("/")&&e.endsWith("/")&&(e=e.slice(1,-1)),e=FS(e),`/${e}/`}o(RN,"formatPatternIfNeeded");function CN(e){let t=[];return e.enum?"":(e.minimum!==void 0?e.exclusiveMinimum===!0?t.push(`gt(${e.minimum})`):t.push(`gte(${e.minimum})`):typeof e.exclusiveMinimum=="number"&&t.push(`gt(${e.exclusiveMinimum})`),e.maximum!==void 0?e.exclusiveMaximum===!0?t.push(`lt(${e.maximum})`):t.push(`lte(${e.maximum})`):typeof e.exclusiveMaximum=="number"&&t.push(`lt(${e.exclusiveMaximum})`),e.multipleOf&&t.push(`multipleOf(${e.multipleOf})`),t.join("."))}o(CN,"getZodChainableNumberValidations");function NN(e){let t=[];return e.minItems&&t.push(`min(${e.minItems})`),e.maxItems&&t.push(`max(${e.maxItems})`),t.join(".")}o(NN,"getZodChainableArrayValidations");var ln=o(e=>e.reduce((t,r)=>t+r,0),"sum");function ae(e,t){if(!t)return e;if(D(t))return e+2;if(Array.isArray(t.type))return t.type.length===1?He("oneOf")+ae(e,{...t,type:t.type[0]}):e+He("oneOf")+ln(t.type.map(r=>ae(0,{...t,type:r})));if(t.oneOf)return t.oneOf.length===1?He("oneOf")+ae(e,t.oneOf[0]):e+He("oneOf")+ln(t.oneOf.map(r=>ae(0,r)));if(t.anyOf)return t.anyOf.length===1?He("anyOf")+ae(e,t.anyOf[0]):e+He("anyOf")+ln(t.anyOf.map(r=>ae(0,r)));if(t.allOf)return t.allOf.length===1?He("allOf")+ae(e,t.allOf[0]):e+He("allOf")+ln(t.allOf.map(r=>ae(0,r)));if(!t.type)return e;if(Ut(t.type))return t.enum?e+Rb(t)+He("enum")+ln(t.enum.map(r=>ae(0,r))):e+Rb(t);if(t.type==="array")return t.items?He("array")+ae(e,t.items):He("array")+ae(e);if(t.type==="object"||t.properties||t.additionalProperties){if(t.properties){let r=Object.values(t.properties);e+=He("object")+ln(r.map(n=>ae(0,n)))}else e+=He("empty-object");t.additionalProperties&&(typeof t.additionalProperties=="object"?e+=ae(0,t.additionalProperties):e+=ae(1))}return e}o(ae,"getOpenAPISchemaComplexity");function Rb(e){return Pe(e.type).with("string","number","integer","boolean",()=>1).otherwise(()=>0)}o(Rb,"complexityByType");function He(e){return Pe(e).with("oneOf",()=>2).with("anyOf",()=>3).with("allOf",()=>2).with("enum","array","empty-object",()=>1).with("object",()=>2).otherwise(()=>0)}o(He,"complexityByComposite");var Cf=class Cf{constructor(t,r,n={referencedBy:[]},i){this.schema=t;this.resolver=r;D(t)&&(this.ref=t.$ref),i&&(this.enumRef=i),this.meta={...n,referencedBy:[...(n==null?void 0:n.referencedBy)??[]]},this.ref&&this.meta.referencedBy.push(this)}code;ref;enumRef;children=[];meta;getCodeString(t,r){var s,a;if(!this.ref&&this.code)return this.code;if(!this.ref)throw new Error("Zod schema is missing both ref and code");let n=(s=this.resolver)==null?void 0:s.getZodSchemaNameByRef(this.ref);if(!n)return this.ref;let i=(a=this.resolver)==null?void 0:a.getTagByZodSchemaName(n);return r!=null&&r.tsNamespaces&&i&&i!==t?`${Z({type:"models",tag:i,options:r})}.${n}`:n}get complexity(){return ae(0,this.schema)}assign(t){return this.code=t,this}inherit(t){return t&&t.children.push(this),this}};o(Cf,"ZodSchema");var ko=Cf;function Rf(e){var t,r;if(e)return(t=e.parent)!=null&&t.ref?e.parent.ref:Rf((r=e.parent)==null?void 0:r.meta)}o(Rf,"getParentRef");function Cb(e,t){let r=e.getRefByZodSchemaName(t);if(r){let i=Array.from(e.dependencyGraph.refsDependencyGraph[r]??[]).map(a=>e.getZodSchemaNameByRef(a)),s=e.getExtractedEnumZodSchemaNamesReferencedBySchemaRef(r);return[...i,...s]}let n=e.getCompositeZodSchemaByZodSchemaName(t);return n?Array.from(Aa(n)).map(i=>e.getZodSchemaNameByRef(i)):[]}o(Cb,"getZodSchemaRefs");function Aa(e,{skipObjectSchema:t=!1}={}){return e.children.reduce((n,i)=>{let s=i.ref??i.enumRef;return s&&n.add(s),i.children.length>0&&(!t||!le(i.schema)||i.schema.type!=="object")&&Aa(i).forEach(a=>n.add(a)),n},new Set)}o(Aa,"getSchemaRefs");function W({schema:e,resolver:t,meta:r,tag:n}){var g;let i=new ko(e,t,r),s={parent:i.inherit(r==null?void 0:r.parent),referencedBy:[...i.meta.referencedBy]},a={resolver:t,meta:s,tag:n};if(D(e))return kN({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});let c=qN({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(c)return c;let u=jN({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(u)return u;let l=MN({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(l)return l;let f=DN({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(f)return f;let p=LN({schema:e,zodSchema:i,resolver:t,meta:s,tag:n});if(p)return p;let d=t.options.allReadonly?".readonly()":"";if(da(e))return e.items?i.assign(`z.array(${W({...a,schema:e.items}).getCodeString(n,t.options)}${Nt({schema:e.items,meta:{...s,isRequired:!0},options:t.options})})${d}`):i.assign(`z.array(z.any())${d}`);let m=e.type?e.type.toLowerCase():void 0;if(m==="object"||e.properties||e.additionalProperties){let y=e.required&&e.required.length>0,v=t.options.withImplicitRequiredProps?!1:e.properties&&!((g=e.required)!=null&&g.length),S="{}";e.properties&&(S=`{ ${Object.entries(e.properties).map(([I,T])=>{var Mt;let ge={...s,isRequired:v?!0:y?(Mt=e.required)==null?void 0:Mt.includes(I):t.options.withImplicitRequiredProps,name:I,isParentPartial:v},re=T;if(D(T)&&t&&(re=t.getSchemaByRef(T.$ref),!re))throw new Error(`Schema ${T.$ref} not found`);let L=W({...a,schema:T,meta:ge}),X=L.getCodeString(n,t.options)+Nt({schema:re,meta:ge,options:t.options}),oe=!1,qt=Rf(r);return qt&&(oe=[...D(T)?[T.$ref]:[],...Aa(L,{skipObjectSchema:!0})].some(Ue=>{var Rd;return(Rd=t.dependencyGraph.deepDependencyGraph[Ue])==null?void 0:Rd.has(qt)})),[I,X,oe]}).map(([I,T,ge])=>ge?`get ${Sf(I)}() { return ${T} }`:`${Sf(I)}: ${T}`).join(", ")} }`);let b="";e.additionalProperties&&(b=`.catchall(${typeof e.additionalProperties=="object"&&Object.keys(e.additionalProperties).length>0?W({...a,schema:e.additionalProperties}).getCodeString(n,t.options)+Nt({schema:e.additionalProperties,meta:{...s,isRequired:!0},options:t.options}):"z.any()"})`);let E=`z.object(${S})${v?".partial()":""}${b}${d}`;return i.assign(E)}if(m==="any")return i.assign("z.any()");if(!m)return i.assign("z.unknown()");throw new Error(`Unsupported schema type: ${m}`)}o(W,"getZodSchema");function kN({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!D(e))return;let s=t.meta.referencedBy.slice(0,-1).map(u=>u.ref?r.getZodSchemaNameByRef(u.ref)??u.ref:void 0).filter(Boolean),a=r.getZodSchemaNameByRef(e.$ref);if(s.length>1&&s.includes(a))return t.assign(r.getCodeByZodSchemaName(t.ref));let c=r.getCodeByZodSchemaName(e.$ref);if(!c){let u=r.getSchemaByRef(e.$ref);if(!u)throw new Error(`Schema ${e.$ref} not found`);c=W({schema:u,resolver:r,meta:n,tag:i}).getCodeString(i,r.options)}return r.getCodeByZodSchemaName(a)||r.setZodSchema(a,c,i),t}o(kN,"getReferenceZodSchema");function jN({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){var a;if(!le(e)||!e.oneOf)return;if(e.oneOf.length===1){let c=W({schema:e.oneOf[0],resolver:r,meta:n,tag:i});return t.assign(c.getCodeString(i,r.options))}let s=(a=e.oneOf)==null?void 0:a.some(c=>le(c)&&((c==null?void 0:c.allOf)||[]).length>1);if(e.discriminator&&!s){let c=e.discriminator.propertyName;return t.assign(`
75
75
  z.discriminatedUnion("${c}", [${e.oneOf.map(u=>W({schema:u,resolver:r,meta:n,tag:i}).getCodeString(i,r.options)).join(", ")}])
76
- `)}return t.assign(`z.union([${e.oneOf.map(c=>W({schema:c,resolver:r,meta:n,tag:i}).getCodeString(i,r.options)).join(", ")}])`)}o(kN,"getOneOfZodSchema");function jN({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!(!le(e)||!Array.isArray(e.type)))return e.type.length===1?W({schema:{...e,type:e.type[0]},resolver:r,meta:n,tag:i}):t.assign(`z.union([${e.type.map(s=>W({schema:{...e,type:s},resolver:r,meta:n,tag:i}).getCodeString(i,r.options)).join(", ")}])`)}o(jN,"getArrayZodSchema");function qN({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!le(e)||!e.anyOf)return;if(e.anyOf.length===1){let a=W({schema:e.anyOf[0],resolver:r,meta:n,tag:i});return t.assign(a.getCodeString(i,r.options))}let s=e.anyOf.map(a=>W({schema:a,resolver:r,meta:n,tag:i})).map(a=>a.getCodeString(i,r.options)).join(", ");return t.assign(`z.union([${s}])`)}o(qN,"getAnyOfZodSchema");function MN({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!le(e)||!e.allOf)return;if(e.allOf.length===1){let p=W({schema:e.allOf[0],resolver:r,meta:n,tag:i});return t.assign(p.getCodeString(i,r.options))}let{patchRequiredSchemaInLoop:s,noRequiredOnlyAllof:a,composedRequiredSchema:c}=xS(e),u=a.map(p=>{let d=W({schema:p,resolver:r,meta:n,tag:i});return r&&s(p,r.getSchemaByRef.bind(r)),d});c.required.length&&u.push(W({schema:c,resolver:r,meta:n,tag:i}));let l=u.at(0),f=u.slice(1).map(p=>`merge(${p.getCodeString(i,r.options)})`).join(".");return t.assign(`${l.getCodeString(i,r.options)}.${f}`)}o(MN,"getAllOfZodSchema");function DN({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!le(e))return;let s=e.type?e.type.toLowerCase():void 0;if(s&&Ut(s)){if(e.enum){if(s==="string")return FN({schema:e,zodSchema:t,resolver:r,meta:n,tag:i});if(e.enum.some(a=>typeof a=="string"))return t.assign("z.never()");if(e.enum.length===1){let a=e.enum[0];return t.assign(`z.literal(${a===null?"null":a})`)}return t.assign(`z.union([${e.enum.map(a=>`z.literal(${a===null?"null":a})`).join(", ")}])`)}return t.assign(Pe(s).with("integer",()=>Pe(e.type).with("integer",()=>yS).otherwise(()=>vS)).with("string",()=>e.pattern?`z.regex(${LN(e.pattern)})`:Pe(e.format).with("binary",()=>ca).with("email",()=>SS).with("hostname","uri",()=>bS).with("uuid",()=>_S).with("date-time",()=>PS).otherwise(()=>ua)).otherwise(a=>`z.${a}()`))}}o(DN,"getPrimitiveZodSchema");function LN(e){return e.startsWith("/")&&e.endsWith("/")&&(e=e.slice(1,-1)),e=FS(e),`/${e}/`}o(LN,"formatPatternIfNeeded");function FN({resolver:e,schema:t,zodSchema:r,meta:n,tag:i}){var l;if(!le(t))return;let s=di(t);if(!e.options.extractEnums)return r.assign(s);let a=e.getEnumZodSchemaDataByCode(s);if(a)return((l=r.meta.parent)==null?void 0:l.ref)===e.getRefByZodSchemaName(a.zodSchemaName)?r.assign(a.code):new ko({$ref:e.getRefByZodSchemaName(a.zodSchemaName)},e,n).inherit(r).assign(s);let c=e.getExtractedEnumZodSchemaDataByCode(s);if(!c)return r.assign(s);if(!c.zodSchemaName||!c.tag)throw new Error(`Enum zod schema name or tag not resolved for code: ${s}`);let u=e.options.tsNamespaces&&c.tag!==i?`${Z({type:"models",tag:c.tag,options:e.options})}.`:"";return r.assign(`${u}${c.zodSchemaName}`)}o(FN,"getEnumZodSchema");function di(e){var t;return`${So}([${(t=e.enum)==null?void 0:t.map(r=>r===null?"null":`"${r}"`).join(", ")}])`}o(di,"getEnumZodSchemaCode");function Nb(e){return`${So}([${e.map(t=>`"${t}"`).join(", ")}])`}o(Nb,"getEnumZodSchemaCodeFromEnumNames");function mi({schema:e,zodSchema:t,fallbackName:r,resolver:n,tag:i}){var c;let s=t.getCodeString();if((!de(s)||t.ref===void 0)&&r){if(t.complexity<mf)return s;let u=on(r,n.options.schemaSuffix);for(;n.getCodeByZodSchemaName(u);){if((c=n.getZodSchemaNamesByCompositeCode(s))!=null&&c.includes(u))return u;if(n.getCodeByZodSchemaName(u)===u)return u;throw new Error(`Can't uniquely resolve zod schema name: ${u}`)}return n.setZodSchema(u,s,i),n.addZodSchemaForCompositeCode(s,t,u,e),u}let a=n.getCodeByZodSchemaName(s);if(!a&&t.ref&&(a=n.getCodeByZodSchemaName(n.getZodSchemaNameByRef(t.ref))),t.ref&&a)return ae(0,n.getSchemaByRef(t.ref))<mf?n.getCodeByZodSchemaName(s):s;if(t.ref)return n.getZodSchemaNameByRef(t.ref);throw new Error(`Invalid ref: ${t.ref}`)}o(mi,"resolveZodSchemaName");function kb({resolver:e,endpoint:t,operation:r}){let n=r["x-acl"];return n==null?void 0:n.map(i=>{let s=Object.keys(i.conditions??{}).reduce((a,c)=>{let u=HN({resolver:e,endpoint:t,acl:n,name:c});return u?[...a,u]:(e.validationErrors.push(wb(c,r,t)),a)},[]);return{...i,conditionsTypes:s}})}o(kb,"getEndpointAcl");function HN({resolver:e,endpoint:t,acl:r,name:n}){var p,d,m,g,y,v,S,b,P,E;let i=(d=(p=r[0])==null?void 0:p.conditions)==null?void 0:d[n];if(!i)return;let s=i.replace(/^\$[^.]*\./,"").split("."),a,c,u,l=0,f=t.parameters.find(({name:_})=>_===s[l]);if(f)c=(m=f.parameterObject)==null?void 0:m.required,a=(g=f.parameterObject)==null?void 0:g.schema,u=`${f.name} ${Er(f.type)} parameter`,l++;else{let _=t.parameters.find(({bodyObject:ge})=>!!ge),T=Object.keys(((y=_==null?void 0:_.bodyObject)==null?void 0:y.content)??{}).find(Xe);T&&(a=(b=(S=(v=_==null?void 0:_.bodyObject)==null?void 0:v.content)==null?void 0:S[T])==null?void 0:b.schema,u=`${Ie(t)?"query":"mutation"} data`)}for(;a&&l<s.length;){let _=e.resolveObject(a);a=(P=Object.entries(_.properties??{}).find(([T])=>T===s[l]))==null?void 0:P[1],c=((E=_.required)==null?void 0:E.includes(s[l]))??!1,l++}if(a)return{name:n,type:D(a)?void 0:a.type,zodSchemaName:D(a)?e.getZodSchemaNameByRef(a.$ref):void 0,required:c,info:u}}o(HN,"getEndpointAclConditionPropertyType");function jb({resolver:e,operation:t,operationName:r,isUniqueOperationName:n,tag:i}){var m,g;let s=e.resolveObject(t.requestBody);if(!s)return;let c=Object.keys(s.content??{}).find(Xe);if(!c)return;let u=(g=(m=s.content)==null?void 0:m[c])==null?void 0:g.schema;if(!u)return;let l=W({schema:u,resolver:e,meta:{isRequired:s.required??!0},tag:i}),f=e.resolveObject(u),p=mi({schema:f,zodSchema:l,fallbackName:Sa(sn(r,n,i)),resolver:e,tag:i}),d=Nt({schema:f,meta:l.meta,options:e.options});return{endpointParameter:{name:pa,type:"Body",description:s.description,zodSchema:p+d,bodyObject:s},requestFormat:c}}o(jb,"getEndpointBody");function qb({resolver:e,param:t,operationName:r,isUniqueOperationName:n,tag:i}){let s=e.resolveObject(t);if(!IS.includes(s.in))return;let a={};if(s.content){let m=Object.keys(s.content??{}),g=m.find(Xe);if(!g)throw new Error(`Unsupported media type for param ${s.name}: ${m.join(", ")}`);let y=s.content[g];if(!y)throw new Error(`No content with media type for param ${s.name}: ${g}`);a=(y==null?void 0:y.schema)??y}else s.schema&&(a=s.schema);e.options.withDescription&&a&&(a.description=(s.description??"").trim());let c=QS(sn(r,n,i),s.name),u;if(BS(s)){let m=wo(c,e.options.enumSuffix,e.options.schemaSuffix),g=Nb(s["x-enumNames"]);e.setZodSchema(m,g,i),u=m}let l=W({schema:a,resolver:e,meta:{isRequired:s.in==="path"?!0:s.required??!1},tag:i}),f=e.resolveObject(a),p=Nt({schema:f,meta:l.meta,options:e.options}),d=mi({schema:f,zodSchema:l.assign(l.getCodeString(i)+p),fallbackName:c,resolver:e,tag:i});return{name:Pe(s.in).with("path",()=>bf(s.name)).otherwise(()=>s.name),type:Pe(s.in).with("header",()=>"Header").with("query",()=>"Query").with("path",()=>"Path").run(),zodSchema:d,parameterObject:s,parameterSortingEnumSchemaName:u}}o(qb,"getEndpointParameter");function Db(e){var r,n,i,s,a;let t=[];for(let c in e.openApiDoc.paths){if(nn(c,e.options))continue;let u=e.openApiDoc.paths[c],l=un(u,tn),f=Mb(u.parameters??[]);for(let p in l){let d=l[p];if(!d||fi(d,e.options))continue;let m=d.operationId&&d.operationId!==At(d.operationId);d.operationId&&m&&e.validationErrors.push(Ob(d.operationId));let g=Object.entries({...f,...Mb(d.parameters??[])}).map(([,_])=>_),y=Co({path:c,method:p,operation:d,operationsByTag:e.operationsByTag,options:e.options}),v=e.operationNames.filter(_=>_===y).length<=1,S=$r(d,e.options),b={method:p,path:VS(c),operationName:y,description:d.description,summary:d.summary,tags:(r=d.tags)==null?void 0:r.map(Rt),requestFormat:"application/json",parameters:[],response:"",errors:[],responseStatusCodes:[],mediaUpload:!!d["x-media-upload"],mediaDownload:!!d["x-media-download"]};if(d.requestBody){let _=jb({resolver:e,operation:d,operationName:y,isUniqueOperationName:v,tag:S});_&&(b.parameters.push(_.endpointParameter),b.requestFormat=_.requestFormat)}for(let _ of g){let I=qb({resolver:e,param:_,operationName:y,isUniqueOperationName:v,tag:S});I&&b.parameters.push(I)}let P=VN(b);P.forEach(_=>{b.parameters.push(_)}),P.length>0&&e.validationErrors.push(xb(P,c));for(let _ in d.responses){b.responseStatusCodes.push(_);let I=e.resolveObject(d.responses[_]),ge=Object.keys(I.content??{}).find(ai),re,L;if(ge?(b.responseFormat=ge,re=(i=(n=I.content)==null?void 0:n[ge])==null?void 0:i.schema):(L=vo,_==="200"&&e.validationErrors.push(Ib({received:"200",expected:"204"},d,b))),re){let X=W({schema:re,resolver:e,meta:{isRequired:!0},tag:S}),oe=e.resolveObject(re);L=mi({schema:oe,zodSchema:X,fallbackName:X.ref?void 0:ba({statusCode:_,operationName:y,isUniqueOperationName:v,tag:S}),resolver:e,tag:S})+Nt({schema:oe,meta:X.meta,options:e.options})}if(L){let X=Number(_);$o(X)&&!b.response?(b.response=L,b.responseObject=I,b.responseDescription=I.description):_!=="default"&&ga(X)&&b.errors.push({zodSchema:L,status:X,description:I.description})}}b.response||(b.response=vo);let E=Object.keys(d.responses).map(Number).filter($o);E.length>1&&e.validationErrors.push(Tb(E.map(String),d,b)),b.acl=kb({resolver:e,endpoint:b,operation:d}),(s=d.security)!=null&&s[0].Authorization&&!b.responseStatusCodes.includes("401")&&e.validationErrors.push(Tf("401",d,b)),(a=b.acl)!=null&&a[0]&&!b.responseStatusCodes.includes("403")&&e.validationErrors.push(Tf("403",d,b)),t.push(b)}}return t}o(Db,"getEndpointsFromOpenAPIDoc");function Mb(e){return Object.fromEntries((e??[]).map(t=>[D(t)?t.$ref:t.name,t]))}o(Mb,"getParameters");function VN(e){return[...e.path.matchAll(/:([a-zA-Z0-9_]+)/g)].map(r=>r[1]).filter(r=>e.parameters.findIndex(({name:n})=>n===r)===-1).map(r=>BN(r))}o(VN,"getMissingPathParameters");function BN(e){return{name:e,type:"Path",zodSchema:ua,parameterObject:{name:e,required:!0,in:"path",schema:{type:"string"}}}}o(BN,"getPathParameterFromName");function Lb(e,t){let r=UN(e,t),n=GN(e,r);return{refsDependencyGraph:r,deepDependencyGraph:n}}o(Lb,"getOpenAPISchemaDependencyGraph");function UN(e,t){let r={},n={};return e.forEach(i=>ZN({schema:t(i),fromRef:i,getSchemaByRef:t,visitedRefs:r,refsDependencyGraph:n})),n}o(UN,"getRefsDependencyGraph");function GN(e,t){let r={},n={},i=o((s,a)=>{n[a].add(s),t[s]&&a!==s&&t[s].forEach(c=>{let u=`${a}__${c}`;r[u]||(r[u]=!0,i(c,a))})},"visit");return e.forEach(s=>{let a=t[s];a&&(n[s]||(n[s]=new Set),a.forEach(c=>i(c,s)))}),n}o(GN,"getDeepRefsDependencyGraph");function ZN({schema:e,fromRef:t,getSchemaByRef:r,visitedRefs:n={},refsDependencyGraph:i={}}){let s=o(a=>{if(a.type!=="reference"||!a.data)return;let{schema:c,data:u}=a;if(i[u.fromRef]||(i[u.fromRef]=new Set),i[u.fromRef].add(c.$ref),n[c.$ref])return!0;n[u.fromRef]=!0,we(r(c.$ref),{data:{fromRef:c.$ref},onSchema:s})},"onSchema");return we(e,{data:{fromRef:t},onSchema:s}),{visitedRefs:n,refsDependencyGraph:i}}o(ZN,"getSchemaRefsDependencyGraph");function wa(e,t,r){let n=[];return we(t,{onSchema:o(s=>{s.type==="reference"?n.push(s.schema):D(s.parentSchema)&&(s.type==="property"?e.validationErrors.push(No(`${r} has both reference and properties`)):s.type==="additionalProperties"?e.validationErrors.push(No(`${r} has both reference and additionalProperties`)):s.type==="array"?e.validationErrors.push(No(`${r} is both reference and array schema`)):s.type==="composite"&&e.validationErrors.push(No(`${r} has both reference and composite keyword`)))},"onSchema")}),n}o(wa,"getSchemaRefObjs");function Fb(e,t){return t.map(i=>rn(i.$ref)).reduce((i,s)=>{let a=e.dependencyGraph.deepDependencyGraph[s];return[...i,s,...Array.from(a??[])]},[])}o(Fb,"getDeepSchemaRefObjs");function Hb(e){e.extractedEnumZodSchemaData.forEach(r=>{let n=r.meta.zodSchemaNameSegments.map(s=>s[s.length-1]).filter(Boolean),i=gf(n);if(!i)throw new Error(`No common last segment found for enum: ${r.code}`);r.zodSchemaName=wo(i,e.options.enumSuffix,e.options.schemaSuffix)});let t=0;for(;t<5&&!Nf(e);)zN(e,t+2),t++;if(Nf(e)||e.extractedEnumZodSchemaData.filter(n=>!Vb(e,n)).forEach(n=>{n.zodSchemaName=wo(n.meta.zodSchemaNameSegments[0].map(i=>kf(G(i))).join(""),e.options.enumSuffix,e.options.schemaSuffix)}),!Nf(e))throw new Error("Failed to resolve unique names for enum zod schemas")}o(Hb,"resolveExtractedEnumZodSchemaNames");function Nf(e){return e.extractedEnumZodSchemaData.every(t=>Vb(e,t))}o(Nf,"allExtractedEnumZodSchemaNamesAreUnique");function zN(e,t){e.extractedEnumZodSchemaData.forEach(r=>{let n=e.extractedEnumZodSchemaData.filter(({zodSchemaName:i})=>r.zodSchemaName===i);n.length!==1&&KN(n,t)})}o(zN,"additionalResolveExtractedEnumZodSchemaName");function KN(e,t=2){e.forEach(r=>{let n=r.meta.zodSchemaNameSegments.map(i=>i[i.length-t]).filter(Boolean);if(n.length===1){let i=[kf(G(n[0])),r.zodSchemaName].filter(Boolean).join("");r.zodSchemaName=i}else{let i=gf(n),s=[i?kf(G(i)):"",r.zodSchemaName].filter(Boolean).join("");r.zodSchemaName=s}})}o(KN,"suffixWithPreviousSegmentName");function Vb(e,t){return e.extractedEnumZodSchemaData.filter(({zodSchemaName:r})=>t.zodSchemaName===r).length===1}o(Vb,"isUnique");function kf(e){return e.replace(/(Dto|DTO|Response|Request)/g,"")}o(kf,"sanitizeName");function Bb(e){e.extractedEnumZodSchemaData.forEach(t=>{let r=Fe(t.meta.tags);t.tag=r.length===1?r[0]:e.options.defaultTag})}o(Bb,"resolveExtractedEnumZodSchemaTags");function jo({schema:e,nameSegments:t=[],includeSelf:r,...n}){r&&Ub({schema:e,nameSegments:t,...n}),we(e,{data:{nameSegments:t},onSchema:o(s=>{var c;if(s.type==="reference")return!0;let a=[...((c=s.data)==null?void 0:c.nameSegments)??[]];s.type==="property"&&a.push(s.propertyName),Ub({schema:s.schema,nameSegments:[...a],...n})},"onSchema")})}o(jo,"updateExtractedEnumZodSchemaData");function Ub({resolver:e,schema:t,schemaRef:r,schemaInfo:n,tags:i,nameSegments:s=[]}){if(!t||D(t)||!t.enum)return;let a=di(t),c=e.extractedEnumZodSchemaData.find(u=>u.code===a);c?(c.meta.zodSchemaNameSegments.push(s),c.meta.tags.push(...i),c.meta.schemaRefs.push(...r?[r]:[]),c.meta.schemas.push(...t?[t]:[])):e.extractedEnumZodSchemaData.push({code:a,meta:{zodSchemaNameSegments:[s],tags:[...i],schemaRefs:r?[r]:[],schemas:t?[t]:[]}}),e.validationErrors.push(Ab(r?`${si(r)}.${s[s.length-1]}`:n??s.join(".")))}o(Ub,"handleExtractedEnumZodSchemaDataUpdate");function Gb(e){var n;let t={},r={};return Object.entries(((n=e.openApiDoc.components)==null?void 0:n.schemas)??{}).forEach(([i,s])=>{let a=e.getSchemaDataByName(i);if(e.options.excludeRedundantZodSchemas&&(!a||a.deepRefOperations.length===0&&a.tags.length===0))return;let c=on(i,e.options.schemaSuffix);if(t[c])return;let u=e.getTagByZodSchemaName(c),l=e.resolveObject(s);l.enum?r[c]=di(l):t[c]=W({schema:s,resolver:e,tag:u}).getCodeString(u)}),{zodSchemas:t,enumZodSchemas:r}}o(Gb,"getZodSchemasFromOpenAPIDoc");function Zb(e){var r;let t=[];return Object.entries(((r=e.openApiDoc.components)==null?void 0:r.schemas)??{}).forEach(([n,i])=>{let s=on(n,e.options.schemaSuffix),a=e.resolveObject(i);!t.find(c=>c.zodSchemaName===s)&&a.enum&&t.push({zodSchemaName:s,code:di(a)})}),t}o(Zb,"getEnumZodSchemasFromOpenAPIDoc");var jf=class jf{constructor(t,r){this.openApiDoc=t;this.options=r;this.dependencyGraph=Lb(this.schemaRefs,this.getSchemaByRef.bind(this)),this.enumZodSchemas=Zb(this),this.operationsByTag=Eb(t,r),this.operationNames=Pb(t,this.operationsByTag,r),this.initialize()}schemaData=[];zodSchemaData=[];compositeZodSchemaData=[];dependencyGraph;enumZodSchemas=[];extractedEnumZodSchemaData=[];operationsByTag={};operationNames=[];validationErrors=[];get docSchemas(){var t;return((t=this.openApiDoc.components)==null?void 0:t.schemas)??{}}get schemaRefs(){return Object.keys(this.docSchemas).map(DS)}getSchemaByRef(t){return this.docSchemas[si(t)]}getSchemaDataByName(t){return this.schemaData.find(r=>r.name===t)}getZodSchemaNameByRef(t){var n,i;let r=((n=this.getSchemaDataByRef(rn(t)))==null?void 0:n.zodSchemaName)??((i=this.extractedEnumZodSchemaData.find(s=>s.zodSchemaName===t))==null?void 0:i.zodSchemaName);if(!r)throw new Error(`Zod schema not found for ref: ${t}`);return r}getRefByZodSchemaName(t){var r;return(r=this.schemaData.find(n=>n.zodSchemaName===t))==null?void 0:r.ref}getTagByZodSchemaName(t){var u,l;if(!this.options.splitByTags)return this.options.defaultTag;let r=this.extractedEnumZodSchemaData.find(f=>f.zodSchemaName===t);if(r)return Rt(r.tag??this.options.defaultTag);let n=this.getRefByZodSchemaName(t),i=n?((u=this.getSchemaDataByRef(n))==null?void 0:u.tags)??[]:[],s=((l=this.zodSchemaData.find(f=>f.zodSchemaName===t))==null?void 0:l.tags)??[],a=Fe(i,s),c=a.length===1?a[0]:this.options.defaultTag;return Rt(c??this.options.defaultTag)}getCodeByZodSchemaName(t){var r;return(r=this.zodSchemaData.find(n=>n.zodSchemaName===t))==null?void 0:r.code}getZodSchemaNamesByCompositeCode(t){var r;return(r=this.compositeZodSchemaData.find(n=>n.code===t))==null?void 0:r.zodSchemas.map(n=>n.zodSchemaName)}setZodSchema(t,r,n){let i=this.zodSchemaData.find(s=>s.zodSchemaName===t);i?(i.code=r,i.tags=(i.tags??[]).concat(n)):this.zodSchemaData.push({zodSchemaName:t,code:r,tags:[n]})}addZodSchemaForCompositeCode(t,r,n,i){let s={zodSchemaName:n,zodSchema:r,schema:i},a=this.compositeZodSchemaData.find(c=>c.code===t);a?a.zodSchemas.push(s):this.compositeZodSchemaData.push({code:t,zodSchemas:[s]})}getCompositeZodSchemaByZodSchemaName(t){var n;let r=this.compositeZodSchemaData.find(i=>i.zodSchemas.some(s=>s.zodSchemaName===t));return(n=r==null?void 0:r.zodSchemas.find(i=>i.zodSchemaName===t))==null?void 0:n.zodSchema}getSchemaByCompositeZodSchemaName(t){var r,n;return(n=(r=this.compositeZodSchemaData.find(i=>i.zodSchemas.some(s=>s.zodSchemaName===t)))==null?void 0:r.zodSchemas.find(i=>i.zodSchemaName===t))==null?void 0:n.schema}getEnumZodSchemaDataByCode(t){return this.enumZodSchemas.find(r=>r.code===t)}getExtractedEnumZodSchemaDataByCode(t){return this.extractedEnumZodSchemaData.find(r=>r.code===t)}getExtractedEnumZodSchemaNamesReferencedBySchemaRef(t){return this.extractedEnumZodSchemaData.reduce((r,{zodSchemaName:n,meta:i})=>(n&&i.schemaRefs.includes(t)&&r.push(n),r),[])}getZodSchemas(){return this.zodSchemaData.reduce((t,{zodSchemaName:r,code:n})=>({...t,[r]:n}),{})}getExtractedEnumZodSchemas(){return this.extractedEnumZodSchemaData.reduce((t,{zodSchemaName:r,code:n})=>r?{...t,[r]:n}:t,{})}resolveObject(t){return D(t)?this.getSchemaByRef(t.$ref):t}isSchemaCircular(t){var r;return(r=this.dependencyGraph.deepDependencyGraph[t])==null?void 0:r.has(t)}getCircularSchemaChain(t,r=t,n=[],i=[]){var s,a;return i.includes(r)?[]:(i.push(r),(s=this.dependencyGraph.refsDependencyGraph[r])!=null&&s.has(t)?[...n,r,t]:Array.from(((a=this.dependencyGraph.refsDependencyGraph[r])==null?void 0:a.values())??[]).map(c=>{let u=this.getCircularSchemaChain(t,c,n,i);return u.length>0?[r,...u]:u}).flat())}getBaseUrl(){var r,n;let t=(n=(r=this.openApiDoc.servers)==null?void 0:r[0])==null?void 0:n.url;return this.options.baseUrl===""&&t?t:this.options.baseUrl}getZodSchemaObj(t){let r=this.getRefByZodSchemaName(t);if(r)return this.getSchemaByRef(r);let n=this.getSchemaByCompositeZodSchemaName(t);if(n)return n;let i=this.getExtractedEnumZodSchemaDataByName(t);if(i)return i.meta.schemas.reduce((s,a)=>({...s,...this.resolveObject(a)}),{})}getSchemaDataByRef(t){return this.schemaData.find(r=>r.ref===t)}getExtractedEnumZodSchemaDataByName(t){return this.extractedEnumZodSchemaData.find(({zodSchemaName:r})=>r===t)}initialize(){var t,r,n,i,s;this.schemaRefs.forEach(a=>{let c=rn(a),u=si(c),l=on(u,this.options.schemaSuffix);this.schemaData.push({ref:c,name:u,zodSchemaName:l,tags:[],deepRefOperations:[]})});for(let a in this.openApiDoc.paths){if(nn(a,this.options))continue;let c=this.openApiDoc.paths[a],u=un(c,tn);for(let l in u){let f=u[l];if(!f||fi(f,this.options))continue;let p=$r(f,this.options),d=Co({path:a,method:l,operation:f,operationsByTag:this.operationsByTag,options:this.options}),m=this.operationNames.filter(S=>S===d).length<=1,g=pe(sn(d,m,p)),y=[];if((t=f.parameters)==null||t.map(S=>{let b=S,P=b.schema,E=`Operation ${f.operationId??a} parameter ${b.name}`;y.push(...wa(this,P,E)),this.options.extractEnums&&jo({resolver:this,schema:P,schemaInfo:E,tags:[p],nameSegments:[g,b.name],includeSelf:!0})}),f.requestBody){let S=this.resolveObject(f.requestBody),P=Object.keys(S.content??{}).find(Xe);if(P){let E=(n=(r=S.content)==null?void 0:r[P])==null?void 0:n.schema,_=`Operation ${f.operationId} request body`;y.push(...wa(this,E,_)),this.options.extractEnums&&jo({resolver:this,schema:E,schemaInfo:_,tags:[p],nameSegments:[Sa(g)]})}}for(let S in f.responses){let b=this.resolveObject(f.responses[S]),E=Object.keys(b.content??{}).find(ai);if(E){let _=(s=(i=b.content)==null?void 0:i[E])==null?void 0:s.schema,I=`Operation ${f.operationId} response body`;y.push(...wa(this,_,I)),this.options.extractEnums&&jo({resolver:this,schema:_,schemaInfo:I,tags:[p],nameSegments:[ba({statusCode:S,operationName:d,isUniqueOperationName:m,tag:p})]})}}Fb(this,y).forEach(S=>{let b=this.getSchemaDataByRef(S);b&&(b.tags.push(p),b.deepRefOperations.push(f))})}}this.options.extractEnums&&(this.schemaRefs.forEach(a=>{var u;let c=rn(a);jo({resolver:this,schema:this.getSchemaByRef(c),schemaRef:c,tags:((u=this.getSchemaDataByRef(c))==null?void 0:u.tags)??[],nameSegments:[si(c)]})}),Bb(this),this.handleDuplicateEnumZodSchemas(),Hb(this))}handleDuplicateEnumZodSchemas(){let t=this.enumZodSchemas.map(({code:n})=>n),r=this.enumZodSchemas.filter(({code:n})=>t.includes(n));this.schemaData.forEach(n=>{var a,c;let i=(a=r.find(({zodSchemaName:u})=>u===n.zodSchemaName))==null?void 0:a.code;if(!i)return;let s=this.extractedEnumZodSchemaData.find(({code:u})=>u===i);!s||((c=this.getEnumZodSchemaDataByCode(s.code))==null?void 0:c.zodSchemaName)!==n.zodSchemaName||(n.tags.push(...s.meta.tags??[]),s.meta.schemaRefs.forEach(u=>{this.dependencyGraph.refsDependencyGraph[u]||(this.dependencyGraph.refsDependencyGraph[u]=new Set),this.dependencyGraph.refsDependencyGraph[u].add(n.ref),this.dependencyGraph.deepDependencyGraph[u]||(this.dependencyGraph.deepDependencyGraph[u]=new Set),this.dependencyGraph.deepDependencyGraph[u].add(n.ref)}))}),this.extractedEnumZodSchemaData.splice(0,this.extractedEnumZodSchemaData.length,...this.extractedEnumZodSchemaData.filter(({code:n})=>!t.includes(n)))}};o(jf,"SchemaResolver");var Ia=jf;function zb(e){let t=[],r={};function n(i,s){Array.isArray(s)||(s=[]),s.push(i),r[i]=!0,e[i]&&e[i].forEach(a=>{s.includes(a)||r[a]||n(a,s.slice(0))}),t.includes(i)||t.push(i)}return o(n,"visit"),Object.keys(e).forEach(i=>n(i,[])),t}o(zb,"topologicalSort");function Kb(e,t){let r=Object.entries(e),n=r.filter(([i])=>t.includes(i)).sort(([i],[s])=>t.indexOf(i)-t.indexOf(s)).concat(r.filter(([i])=>!t.includes(i)));return Object.fromEntries(n)}o(Kb,"sortObjKeysFromArray");function Qb(e,t){let r=zb(e.dependencyGraph.deepDependencyGraph).map(i=>e.getZodSchemaNameByRef(i));return Kb(t,r)}o(Qb,"sortZodSchemasByTopology");function Ta(e,t){let r=new Ia(e,t),n=Db(r),i=Gb(r),s={...i.zodSchemas,...r.getZodSchemas(),...i.enumZodSchemas};return s=Qb(r,s),s={...r.getExtractedEnumZodSchemas(),...s},{resolver:r,data:QN({resolver:r,endpoints:n,zodSchemas:s,options:t})}}o(Ta,"getDataFromOpenAPIDoc");function QN({resolver:e,endpoints:t,zodSchemas:r,options:n}){let i=new Map;return n.splitByTags?(t.forEach(s=>{let a=Ar(s,n);Wb(a,i).endpoints.push(s)}),Object.entries(r).forEach(([s,a])=>{let c=e.getTagByZodSchemaName(s);c&&(Wb(c,i).zodSchemas[s]=a)}),i):(i.set(n.defaultTag,{endpoints:t,zodSchemas:r}),i)}o(QN,"splitDataByTags");function Wb(e,t){return t.has(e)||t.set(e,{endpoints:[],zodSchemas:{}}),t.get(e)}o(Wb,"getTagElement");async function Yb(e,t){let{resolver:r,data:n}=await Ta(e,t),i=[],s=[];return n.forEach(({endpoints:c,zodSchemas:u},l)=>{Object.keys(u).forEach(f=>{let p=r.getRefByZodSchemaName(f),d=p?r.getSchemaByRef(p):r.getSchemaByCompositeZodSchemaName(f),m=li({zodSchemaName:f,schema:d,resolver:r}),g;d&&(g=cn({schema:d,parentTypes:[m],resolver:r})),i.push({...m,metaType:"primitive",...g})}),c.forEach(f=>{let p="queries",d=Rt(l);s.push({name:$a(f),importPath:ui({type:p,tag:d,includeTagDir:!0,options:t}),namespace:t.tsNamespaces?Z({type:p,tag:d,options:t}):void 0,isQuery:Ie(f),isMutation:Ct(f),params:WN({resolver:r,endpoint:f}),response:YN({resolver:r,endpoint:f})})})}),{openApiDoc:e,models:i,queries:s}}o(Yb,"getMetadataFromOpenAPIDoc");function WN({resolver:e,endpoint:t}){return t.parameters.map(r=>{var a,c,u,l;let n;if((a=r.parameterObject)!=null&&a.schema)n=e.resolveObject(r.parameterObject.schema);else if(r.bodyObject){let p=Object.keys(r.bodyObject.content??{}).find(Xe);p&&(n=e.resolveObject((u=(c=r.bodyObject.content)==null?void 0:c[p])==null?void 0:u.schema))}let i=li({zodSchemaName:r.zodSchema,schema:n,resolver:e}),s;return n&&(s=cn({schema:n,parentTypes:[i],resolver:e})),{name:At(r.name),isRequired:((l=r.parameterObject)==null?void 0:l.required)??!0,...i,...s,paramType:r.type}}).sort((r,n)=>{if(r.isRequired===n.isRequired){let i=["Path","Body","Query","Header"];return i.indexOf(r.paramType)-i.indexOf(n.paramType)}return r.isRequired?-1:1}).map(({paramType:r,...n})=>n)}o(WN,"getQueryMetadataParams");function YN({resolver:e,endpoint:t}){var a,c,u,l;let r,n=Object.keys(((a=t.responseObject)==null?void 0:a.content)??{}).find(ai);n&&(r=e.resolveObject((l=(u=(c=t.responseObject)==null?void 0:c.content)==null?void 0:u[n])==null?void 0:l.schema));let i=li({zodSchemaName:t.response,schema:r,resolver:e}),s;return r&&(s=cn({schema:r,parentTypes:[i],resolver:e})),{...i,metaType:"primitive",...s}}o(YN,"getQueryMetadataResponse");var Id=Ge(Wt());var Ad=Ge(require("fs")),VP=Ge(require("path"));function BP(e){return Ad.default.readFileSync(VP.default.join(__dirname,`../${e}`),"utf-8")}o(BP,"readFileSync");function wd(e){let t=`src/generators/templates/${e}.hbs`;return BP(t)}o(wd,"readHbsTemplateSync");function UP(e){let t=`src/assets/${e}`;return BP(t)}o(UP,"readAssetSync");function Yt({output:e,fileName:t}){return`${e}/${t}`}o(Yt,"getOutputFileName");var Jt=Ge(Wt());function GP(e){Bq(),Uq(e.options),Gq(),Zq(),zq(),Kq(),Qq(),Wq()}o(GP,"registerAclHbsHelpers");function Bq(){Jt.default.registerHelper("abilityFunctionName",xo)}o(Bq,"registerAbilityFunctionNameHelper");function Uq(e){Jt.default.registerHelper("importedAbilityFunctionName",t=>GS(t,e))}o(Uq,"registerImportedAbilityFunctionNameHelper");function Gq(){Jt.default.registerHelper("ablityAction",Pf)}o(Gq,"registerAbilityActionHelper");function Zq(){Jt.default.registerHelper("ablitySubject",Ef)}o(Zq,"registerAbilitySubjectHelper");function zq(){Jt.default.registerHelper("hasAbilityConditions",Ao)}o(zq,"registerHasAbilityConditionsHelper");function Kq(){Jt.default.registerHelper("abilityConditionsTypes",ci)}o(Kq,"registerAbilityConditionsTypesHelper");function Qq(){Jt.default.registerHelper("abilityDescription",ZS)}o(Qq,"registerAbilityDescriptionHelper");function Wq(){Jt.default.registerHelper("abilitySubjectTypes",$f)}o(Wq,"registerAbilitySubjectTypesHelper");var yn=Ge(Wt());function ZP(){Yq(),Jq(),Xq(),e3(),t3(),r3()}o(ZP,"registerCommonHbsHelpers");function Yq(){yn.default.registerHelper("isEqual",(e,t)=>e===t)}o(Yq,"registerIsEqualHelper");function Jq(){yn.default.registerHelper("commaSeparated",e=>e.join(", "))}o(Jq,"registerCommaSeparatedListHelper");function Xq(){yn.default.registerHelper("union",e=>e.join(" | "))}o(Xq,"registerUnionHelper");function e3(){yn.default.registerHelper("addAsteriskAfterNewLine",e=>e.replace(/\n/g,`
76
+ `)}return t.assign(`z.union([${e.oneOf.map(c=>W({schema:c,resolver:r,meta:n,tag:i}).getCodeString(i,r.options)).join(", ")}])`)}o(jN,"getOneOfZodSchema");function qN({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!(!le(e)||!Array.isArray(e.type)))return e.type.length===1?W({schema:{...e,type:e.type[0]},resolver:r,meta:n,tag:i}):t.assign(`z.union([${e.type.map(s=>W({schema:{...e,type:s},resolver:r,meta:n,tag:i}).getCodeString(i,r.options)).join(", ")}])`)}o(qN,"getArrayZodSchema");function MN({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!le(e)||!e.anyOf)return;if(e.anyOf.length===1){let a=W({schema:e.anyOf[0],resolver:r,meta:n,tag:i});return t.assign(a.getCodeString(i,r.options))}let s=e.anyOf.map(a=>W({schema:a,resolver:r,meta:n,tag:i})).map(a=>a.getCodeString(i,r.options)).join(", ");return t.assign(`z.union([${s}])`)}o(MN,"getAnyOfZodSchema");function DN({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!le(e)||!e.allOf)return;if(e.allOf.length===1){let p=W({schema:e.allOf[0],resolver:r,meta:n,tag:i});return t.assign(p.getCodeString(i,r.options))}let{patchRequiredSchemaInLoop:s,noRequiredOnlyAllof:a,composedRequiredSchema:c}=xS(e),u=a.map(p=>{let d=W({schema:p,resolver:r,meta:n,tag:i});return r&&s(p,r.getSchemaByRef.bind(r)),d});c.required.length&&u.push(W({schema:c,resolver:r,meta:n,tag:i}));let l=u.at(0),f=u.slice(1).map(p=>`merge(${p.getCodeString(i,r.options)})`).join(".");return t.assign(`${l.getCodeString(i,r.options)}.${f}`)}o(DN,"getAllOfZodSchema");function LN({schema:e,zodSchema:t,resolver:r,meta:n,tag:i}){if(!le(e))return;let s=e.type?e.type.toLowerCase():void 0;if(s&&Ut(s)){if(e.enum){if(s==="string")return FN({schema:e,zodSchema:t,resolver:r,meta:n,tag:i});if(e.enum.some(a=>typeof a=="string"))return t.assign("z.never()");if(e.enum.length===1){let a=e.enum[0];return t.assign(`z.literal(${a===null?"null":a})`)}return t.assign(`z.union([${e.enum.map(a=>`z.literal(${a===null?"null":a})`).join(", ")}])`)}return t.assign(Pe(s).with("integer",()=>Pe(e.type).with("integer",()=>yS).otherwise(()=>vS)).with("string",()=>Pe(e.format).with("binary",()=>ca).with("email",()=>SS).with("hostname","uri",()=>bS).with("uuid",()=>_S).with("date-time",()=>PS).otherwise(()=>ua)).otherwise(a=>`z.${a}()`))}}o(LN,"getPrimitiveZodSchema");function FN({resolver:e,schema:t,zodSchema:r,meta:n,tag:i}){var l;if(!le(t))return;let s=di(t);if(!e.options.extractEnums)return r.assign(s);let a=e.getEnumZodSchemaDataByCode(s);if(a)return((l=r.meta.parent)==null?void 0:l.ref)===e.getRefByZodSchemaName(a.zodSchemaName)?r.assign(a.code):new ko({$ref:e.getRefByZodSchemaName(a.zodSchemaName)},e,n).inherit(r).assign(s);let c=e.getExtractedEnumZodSchemaDataByCode(s);if(!c)return r.assign(s);if(!c.zodSchemaName||!c.tag)throw new Error(`Enum zod schema name or tag not resolved for code: ${s}`);let u=e.options.tsNamespaces&&c.tag!==i?`${Z({type:"models",tag:c.tag,options:e.options})}.`:"";return r.assign(`${u}${c.zodSchemaName}`)}o(FN,"getEnumZodSchema");function di(e){var t;return`${So}([${(t=e.enum)==null?void 0:t.map(r=>r===null?"null":`"${r}"`).join(", ")}])`}o(di,"getEnumZodSchemaCode");function Nb(e){return`${So}([${e.map(t=>`"${t}"`).join(", ")}])`}o(Nb,"getEnumZodSchemaCodeFromEnumNames");function mi({schema:e,zodSchema:t,fallbackName:r,resolver:n,tag:i}){var c;let s=t.getCodeString();if((!de(s)||t.ref===void 0)&&r){if(t.complexity<mf)return s;let u=on(r,n.options.schemaSuffix);for(;n.getCodeByZodSchemaName(u);){if((c=n.getZodSchemaNamesByCompositeCode(s))!=null&&c.includes(u))return u;if(n.getCodeByZodSchemaName(u)===u)return u;throw new Error(`Can't uniquely resolve zod schema name: ${u}`)}return n.setZodSchema(u,s,i),n.addZodSchemaForCompositeCode(s,t,u,e),u}let a=n.getCodeByZodSchemaName(s);if(!a&&t.ref&&(a=n.getCodeByZodSchemaName(n.getZodSchemaNameByRef(t.ref))),t.ref&&a)return ae(0,n.getSchemaByRef(t.ref))<mf?n.getCodeByZodSchemaName(s):s;if(t.ref)return n.getZodSchemaNameByRef(t.ref);throw new Error(`Invalid ref: ${t.ref}`)}o(mi,"resolveZodSchemaName");function kb({resolver:e,endpoint:t,operation:r}){let n=r["x-acl"];return n==null?void 0:n.map(i=>{let s=Object.keys(i.conditions??{}).reduce((a,c)=>{let u=HN({resolver:e,endpoint:t,acl:n,name:c});return u?[...a,u]:(e.validationErrors.push(wb(c,r,t)),a)},[]);return{...i,conditionsTypes:s}})}o(kb,"getEndpointAcl");function HN({resolver:e,endpoint:t,acl:r,name:n}){var p,d,m,g,y,v,S,b,P,E;let i=(d=(p=r[0])==null?void 0:p.conditions)==null?void 0:d[n];if(!i)return;let s=i.replace(/^\$[^.]*\./,"").split("."),a,c,u,l=0,f=t.parameters.find(({name:_})=>_===s[l]);if(f)c=(m=f.parameterObject)==null?void 0:m.required,a=(g=f.parameterObject)==null?void 0:g.schema,u=`${f.name} ${Er(f.type)} parameter`,l++;else{let _=t.parameters.find(({bodyObject:ge})=>!!ge),T=Object.keys(((y=_==null?void 0:_.bodyObject)==null?void 0:y.content)??{}).find(Xe);T&&(a=(b=(S=(v=_==null?void 0:_.bodyObject)==null?void 0:v.content)==null?void 0:S[T])==null?void 0:b.schema,u=`${Ie(t)?"query":"mutation"} data`)}for(;a&&l<s.length;){let _=e.resolveObject(a);a=(P=Object.entries(_.properties??{}).find(([T])=>T===s[l]))==null?void 0:P[1],c=((E=_.required)==null?void 0:E.includes(s[l]))??!1,l++}if(a)return{name:n,type:D(a)?void 0:a.type,zodSchemaName:D(a)?e.getZodSchemaNameByRef(a.$ref):void 0,required:c,info:u}}o(HN,"getEndpointAclConditionPropertyType");function jb({resolver:e,operation:t,operationName:r,isUniqueOperationName:n,tag:i}){var m,g;let s=e.resolveObject(t.requestBody);if(!s)return;let c=Object.keys(s.content??{}).find(Xe);if(!c)return;let u=(g=(m=s.content)==null?void 0:m[c])==null?void 0:g.schema;if(!u)return;let l=W({schema:u,resolver:e,meta:{isRequired:s.required??!0},tag:i}),f=e.resolveObject(u),p=mi({schema:f,zodSchema:l,fallbackName:Sa(sn(r,n,i)),resolver:e,tag:i}),d=Nt({schema:f,meta:l.meta,options:e.options});return{endpointParameter:{name:pa,type:"Body",description:s.description,zodSchema:p+d,bodyObject:s},requestFormat:c}}o(jb,"getEndpointBody");function qb({resolver:e,param:t,operationName:r,isUniqueOperationName:n,tag:i}){let s=e.resolveObject(t);if(!IS.includes(s.in))return;let a={};if(s.content){let m=Object.keys(s.content??{}),g=m.find(Xe);if(!g)throw new Error(`Unsupported media type for param ${s.name}: ${m.join(", ")}`);let y=s.content[g];if(!y)throw new Error(`No content with media type for param ${s.name}: ${g}`);a=(y==null?void 0:y.schema)??y}else s.schema&&(a=s.schema);e.options.withDescription&&a&&(a.description=(s.description??"").trim());let c=QS(sn(r,n,i),s.name),u;if(BS(s)){let m=wo(c,e.options.enumSuffix,e.options.schemaSuffix),g=Nb(s["x-enumNames"]);e.setZodSchema(m,g,i),u=m}let l=W({schema:a,resolver:e,meta:{isRequired:s.in==="path"?!0:s.required??!1},tag:i}),f=e.resolveObject(a),p=Nt({schema:f,meta:l.meta,options:e.options}),d=mi({schema:f,zodSchema:l.assign(l.getCodeString(i)+p),fallbackName:c,resolver:e,tag:i});return{name:Pe(s.in).with("path",()=>bf(s.name)).otherwise(()=>s.name),type:Pe(s.in).with("header",()=>"Header").with("query",()=>"Query").with("path",()=>"Path").run(),zodSchema:d,parameterObject:s,parameterSortingEnumSchemaName:u}}o(qb,"getEndpointParameter");function Db(e){var r,n,i,s,a;let t=[];for(let c in e.openApiDoc.paths){if(nn(c,e.options))continue;let u=e.openApiDoc.paths[c],l=un(u,tn),f=Mb(u.parameters??[]);for(let p in l){let d=l[p];if(!d||fi(d,e.options))continue;let m=d.operationId&&d.operationId!==At(d.operationId);d.operationId&&m&&e.validationErrors.push(Ob(d.operationId));let g=Object.entries({...f,...Mb(d.parameters??[])}).map(([,_])=>_),y=Co({path:c,method:p,operation:d,operationsByTag:e.operationsByTag,options:e.options}),v=e.operationNames.filter(_=>_===y).length<=1,S=$r(d,e.options),b={method:p,path:VS(c),operationName:y,description:d.description,summary:d.summary,tags:(r=d.tags)==null?void 0:r.map(Rt),requestFormat:"application/json",parameters:[],response:"",errors:[],responseStatusCodes:[],mediaUpload:!!d["x-media-upload"],mediaDownload:!!d["x-media-download"]};if(d.requestBody){let _=jb({resolver:e,operation:d,operationName:y,isUniqueOperationName:v,tag:S});_&&(b.parameters.push(_.endpointParameter),b.requestFormat=_.requestFormat)}for(let _ of g){let I=qb({resolver:e,param:_,operationName:y,isUniqueOperationName:v,tag:S});I&&b.parameters.push(I)}let P=VN(b);P.forEach(_=>{b.parameters.push(_)}),P.length>0&&e.validationErrors.push(xb(P,c));for(let _ in d.responses){b.responseStatusCodes.push(_);let I=e.resolveObject(d.responses[_]),ge=Object.keys(I.content??{}).find(ai),re,L;if(ge?(b.responseFormat=ge,re=(i=(n=I.content)==null?void 0:n[ge])==null?void 0:i.schema):(L=vo,_==="200"&&e.validationErrors.push(Ib({received:"200",expected:"204"},d,b))),re){let X=W({schema:re,resolver:e,meta:{isRequired:!0},tag:S}),oe=e.resolveObject(re);L=mi({schema:oe,zodSchema:X,fallbackName:X.ref?void 0:ba({statusCode:_,operationName:y,isUniqueOperationName:v,tag:S}),resolver:e,tag:S})+Nt({schema:oe,meta:X.meta,options:e.options})}if(L){let X=Number(_);$o(X)&&!b.response?(b.response=L,b.responseObject=I,b.responseDescription=I.description):_!=="default"&&ga(X)&&b.errors.push({zodSchema:L,status:X,description:I.description})}}b.response||(b.response=vo);let E=Object.keys(d.responses).map(Number).filter($o);E.length>1&&e.validationErrors.push(Tb(E.map(String),d,b)),b.acl=kb({resolver:e,endpoint:b,operation:d}),(s=d.security)!=null&&s[0].Authorization&&!b.responseStatusCodes.includes("401")&&e.validationErrors.push(Tf("401",d,b)),(a=b.acl)!=null&&a[0]&&!b.responseStatusCodes.includes("403")&&e.validationErrors.push(Tf("403",d,b)),t.push(b)}}return t}o(Db,"getEndpointsFromOpenAPIDoc");function Mb(e){return Object.fromEntries((e??[]).map(t=>[D(t)?t.$ref:t.name,t]))}o(Mb,"getParameters");function VN(e){return[...e.path.matchAll(/:([a-zA-Z0-9_]+)/g)].map(r=>r[1]).filter(r=>e.parameters.findIndex(({name:n})=>n===r)===-1).map(r=>BN(r))}o(VN,"getMissingPathParameters");function BN(e){return{name:e,type:"Path",zodSchema:ua,parameterObject:{name:e,required:!0,in:"path",schema:{type:"string"}}}}o(BN,"getPathParameterFromName");function Lb(e,t){let r=UN(e,t),n=GN(e,r);return{refsDependencyGraph:r,deepDependencyGraph:n}}o(Lb,"getOpenAPISchemaDependencyGraph");function UN(e,t){let r={},n={};return e.forEach(i=>ZN({schema:t(i),fromRef:i,getSchemaByRef:t,visitedRefs:r,refsDependencyGraph:n})),n}o(UN,"getRefsDependencyGraph");function GN(e,t){let r={},n={},i=o((s,a)=>{n[a].add(s),t[s]&&a!==s&&t[s].forEach(c=>{let u=`${a}__${c}`;r[u]||(r[u]=!0,i(c,a))})},"visit");return e.forEach(s=>{let a=t[s];a&&(n[s]||(n[s]=new Set),a.forEach(c=>i(c,s)))}),n}o(GN,"getDeepRefsDependencyGraph");function ZN({schema:e,fromRef:t,getSchemaByRef:r,visitedRefs:n={},refsDependencyGraph:i={}}){let s=o(a=>{if(a.type!=="reference"||!a.data)return;let{schema:c,data:u}=a;if(i[u.fromRef]||(i[u.fromRef]=new Set),i[u.fromRef].add(c.$ref),n[c.$ref])return!0;n[u.fromRef]=!0,we(r(c.$ref),{data:{fromRef:c.$ref},onSchema:s})},"onSchema");return we(e,{data:{fromRef:t},onSchema:s}),{visitedRefs:n,refsDependencyGraph:i}}o(ZN,"getSchemaRefsDependencyGraph");function wa(e,t,r){let n=[];return we(t,{onSchema:o(s=>{s.type==="reference"?n.push(s.schema):D(s.parentSchema)&&(s.type==="property"?e.validationErrors.push(No(`${r} has both reference and properties`)):s.type==="additionalProperties"?e.validationErrors.push(No(`${r} has both reference and additionalProperties`)):s.type==="array"?e.validationErrors.push(No(`${r} is both reference and array schema`)):s.type==="composite"&&e.validationErrors.push(No(`${r} has both reference and composite keyword`)))},"onSchema")}),n}o(wa,"getSchemaRefObjs");function Fb(e,t){return t.map(i=>rn(i.$ref)).reduce((i,s)=>{let a=e.dependencyGraph.deepDependencyGraph[s];return[...i,s,...Array.from(a??[])]},[])}o(Fb,"getDeepSchemaRefObjs");function Hb(e){e.extractedEnumZodSchemaData.forEach(r=>{let n=r.meta.zodSchemaNameSegments.map(s=>s[s.length-1]).filter(Boolean),i=gf(n);if(!i)throw new Error(`No common last segment found for enum: ${r.code}`);r.zodSchemaName=wo(i,e.options.enumSuffix,e.options.schemaSuffix)});let t=0;for(;t<5&&!Nf(e);)zN(e,t+2),t++;if(Nf(e)||e.extractedEnumZodSchemaData.filter(n=>!Vb(e,n)).forEach(n=>{n.zodSchemaName=wo(n.meta.zodSchemaNameSegments[0].map(i=>kf(G(i))).join(""),e.options.enumSuffix,e.options.schemaSuffix)}),!Nf(e))throw new Error("Failed to resolve unique names for enum zod schemas")}o(Hb,"resolveExtractedEnumZodSchemaNames");function Nf(e){return e.extractedEnumZodSchemaData.every(t=>Vb(e,t))}o(Nf,"allExtractedEnumZodSchemaNamesAreUnique");function zN(e,t){e.extractedEnumZodSchemaData.forEach(r=>{let n=e.extractedEnumZodSchemaData.filter(({zodSchemaName:i})=>r.zodSchemaName===i);n.length!==1&&KN(n,t)})}o(zN,"additionalResolveExtractedEnumZodSchemaName");function KN(e,t=2){e.forEach(r=>{let n=r.meta.zodSchemaNameSegments.map(i=>i[i.length-t]).filter(Boolean);if(n.length===1){let i=[kf(G(n[0])),r.zodSchemaName].filter(Boolean).join("");r.zodSchemaName=i}else{let i=gf(n),s=[i?kf(G(i)):"",r.zodSchemaName].filter(Boolean).join("");r.zodSchemaName=s}})}o(KN,"suffixWithPreviousSegmentName");function Vb(e,t){return e.extractedEnumZodSchemaData.filter(({zodSchemaName:r})=>t.zodSchemaName===r).length===1}o(Vb,"isUnique");function kf(e){return e.replace(/(Dto|DTO|Response|Request)/g,"")}o(kf,"sanitizeName");function Bb(e){e.extractedEnumZodSchemaData.forEach(t=>{let r=Fe(t.meta.tags);t.tag=r.length===1?r[0]:e.options.defaultTag})}o(Bb,"resolveExtractedEnumZodSchemaTags");function jo({schema:e,nameSegments:t=[],includeSelf:r,...n}){r&&Ub({schema:e,nameSegments:t,...n}),we(e,{data:{nameSegments:t},onSchema:o(s=>{var c;if(s.type==="reference")return!0;let a=[...((c=s.data)==null?void 0:c.nameSegments)??[]];s.type==="property"&&a.push(s.propertyName),Ub({schema:s.schema,nameSegments:[...a],...n})},"onSchema")})}o(jo,"updateExtractedEnumZodSchemaData");function Ub({resolver:e,schema:t,schemaRef:r,schemaInfo:n,tags:i,nameSegments:s=[]}){if(!t||D(t)||!t.enum)return;let a=di(t),c=e.extractedEnumZodSchemaData.find(u=>u.code===a);c?(c.meta.zodSchemaNameSegments.push(s),c.meta.tags.push(...i),c.meta.schemaRefs.push(...r?[r]:[]),c.meta.schemas.push(...t?[t]:[])):e.extractedEnumZodSchemaData.push({code:a,meta:{zodSchemaNameSegments:[s],tags:[...i],schemaRefs:r?[r]:[],schemas:t?[t]:[]}}),e.validationErrors.push(Ab(r?`${si(r)}.${s[s.length-1]}`:n??s.join(".")))}o(Ub,"handleExtractedEnumZodSchemaDataUpdate");function Gb(e){var n;let t={},r={};return Object.entries(((n=e.openApiDoc.components)==null?void 0:n.schemas)??{}).forEach(([i,s])=>{let a=e.getSchemaDataByName(i);if(e.options.excludeRedundantZodSchemas&&(!a||a.deepRefOperations.length===0&&a.tags.length===0))return;let c=on(i,e.options.schemaSuffix);if(t[c])return;let u=e.getTagByZodSchemaName(c),l=e.resolveObject(s);l.enum?r[c]=di(l):t[c]=W({schema:s,resolver:e,tag:u}).getCodeString(u)}),{zodSchemas:t,enumZodSchemas:r}}o(Gb,"getZodSchemasFromOpenAPIDoc");function Zb(e){var r;let t=[];return Object.entries(((r=e.openApiDoc.components)==null?void 0:r.schemas)??{}).forEach(([n,i])=>{let s=on(n,e.options.schemaSuffix),a=e.resolveObject(i);!t.find(c=>c.zodSchemaName===s)&&a.enum&&t.push({zodSchemaName:s,code:di(a)})}),t}o(Zb,"getEnumZodSchemasFromOpenAPIDoc");var jf=class jf{constructor(t,r){this.openApiDoc=t;this.options=r;this.dependencyGraph=Lb(this.schemaRefs,this.getSchemaByRef.bind(this)),this.enumZodSchemas=Zb(this),this.operationsByTag=Eb(t,r),this.operationNames=Pb(t,this.operationsByTag,r),this.initialize()}schemaData=[];zodSchemaData=[];compositeZodSchemaData=[];dependencyGraph;enumZodSchemas=[];extractedEnumZodSchemaData=[];operationsByTag={};operationNames=[];validationErrors=[];get docSchemas(){var t;return((t=this.openApiDoc.components)==null?void 0:t.schemas)??{}}get schemaRefs(){return Object.keys(this.docSchemas).map(DS)}getSchemaByRef(t){return this.docSchemas[si(t)]}getSchemaDataByName(t){return this.schemaData.find(r=>r.name===t)}getZodSchemaNameByRef(t){var n,i;let r=((n=this.getSchemaDataByRef(rn(t)))==null?void 0:n.zodSchemaName)??((i=this.extractedEnumZodSchemaData.find(s=>s.zodSchemaName===t))==null?void 0:i.zodSchemaName);if(!r)throw new Error(`Zod schema not found for ref: ${t}`);return r}getRefByZodSchemaName(t){var r;return(r=this.schemaData.find(n=>n.zodSchemaName===t))==null?void 0:r.ref}getTagByZodSchemaName(t){var u,l;if(!this.options.splitByTags)return this.options.defaultTag;let r=this.extractedEnumZodSchemaData.find(f=>f.zodSchemaName===t);if(r)return Rt(r.tag??this.options.defaultTag);let n=this.getRefByZodSchemaName(t),i=n?((u=this.getSchemaDataByRef(n))==null?void 0:u.tags)??[]:[],s=((l=this.zodSchemaData.find(f=>f.zodSchemaName===t))==null?void 0:l.tags)??[],a=Fe(i,s),c=a.length===1?a[0]:this.options.defaultTag;return Rt(c??this.options.defaultTag)}getCodeByZodSchemaName(t){var r;return(r=this.zodSchemaData.find(n=>n.zodSchemaName===t))==null?void 0:r.code}getZodSchemaNamesByCompositeCode(t){var r;return(r=this.compositeZodSchemaData.find(n=>n.code===t))==null?void 0:r.zodSchemas.map(n=>n.zodSchemaName)}setZodSchema(t,r,n){let i=this.zodSchemaData.find(s=>s.zodSchemaName===t);i?(i.code=r,i.tags=(i.tags??[]).concat(n)):this.zodSchemaData.push({zodSchemaName:t,code:r,tags:[n]})}addZodSchemaForCompositeCode(t,r,n,i){let s={zodSchemaName:n,zodSchema:r,schema:i},a=this.compositeZodSchemaData.find(c=>c.code===t);a?a.zodSchemas.push(s):this.compositeZodSchemaData.push({code:t,zodSchemas:[s]})}getCompositeZodSchemaByZodSchemaName(t){var n;let r=this.compositeZodSchemaData.find(i=>i.zodSchemas.some(s=>s.zodSchemaName===t));return(n=r==null?void 0:r.zodSchemas.find(i=>i.zodSchemaName===t))==null?void 0:n.zodSchema}getSchemaByCompositeZodSchemaName(t){var r,n;return(n=(r=this.compositeZodSchemaData.find(i=>i.zodSchemas.some(s=>s.zodSchemaName===t)))==null?void 0:r.zodSchemas.find(i=>i.zodSchemaName===t))==null?void 0:n.schema}getEnumZodSchemaDataByCode(t){return this.enumZodSchemas.find(r=>r.code===t)}getExtractedEnumZodSchemaDataByCode(t){return this.extractedEnumZodSchemaData.find(r=>r.code===t)}getExtractedEnumZodSchemaNamesReferencedBySchemaRef(t){return this.extractedEnumZodSchemaData.reduce((r,{zodSchemaName:n,meta:i})=>(n&&i.schemaRefs.includes(t)&&r.push(n),r),[])}getZodSchemas(){return this.zodSchemaData.reduce((t,{zodSchemaName:r,code:n})=>({...t,[r]:n}),{})}getExtractedEnumZodSchemas(){return this.extractedEnumZodSchemaData.reduce((t,{zodSchemaName:r,code:n})=>r?{...t,[r]:n}:t,{})}resolveObject(t){return D(t)?this.getSchemaByRef(t.$ref):t}isSchemaCircular(t){var r;return(r=this.dependencyGraph.deepDependencyGraph[t])==null?void 0:r.has(t)}getCircularSchemaChain(t,r=t,n=[],i=[]){var s,a;return i.includes(r)?[]:(i.push(r),(s=this.dependencyGraph.refsDependencyGraph[r])!=null&&s.has(t)?[...n,r,t]:Array.from(((a=this.dependencyGraph.refsDependencyGraph[r])==null?void 0:a.values())??[]).map(c=>{let u=this.getCircularSchemaChain(t,c,n,i);return u.length>0?[r,...u]:u}).flat())}getBaseUrl(){var r,n;let t=(n=(r=this.openApiDoc.servers)==null?void 0:r[0])==null?void 0:n.url;return this.options.baseUrl===""&&t?t:this.options.baseUrl}getZodSchemaObj(t){let r=this.getRefByZodSchemaName(t);if(r)return this.getSchemaByRef(r);let n=this.getSchemaByCompositeZodSchemaName(t);if(n)return n;let i=this.getExtractedEnumZodSchemaDataByName(t);if(i)return i.meta.schemas.reduce((s,a)=>({...s,...this.resolveObject(a)}),{})}getSchemaDataByRef(t){return this.schemaData.find(r=>r.ref===t)}getExtractedEnumZodSchemaDataByName(t){return this.extractedEnumZodSchemaData.find(({zodSchemaName:r})=>r===t)}initialize(){var t,r,n,i,s;this.schemaRefs.forEach(a=>{let c=rn(a),u=si(c),l=on(u,this.options.schemaSuffix);this.schemaData.push({ref:c,name:u,zodSchemaName:l,tags:[],deepRefOperations:[]})});for(let a in this.openApiDoc.paths){if(nn(a,this.options))continue;let c=this.openApiDoc.paths[a],u=un(c,tn);for(let l in u){let f=u[l];if(!f||fi(f,this.options))continue;let p=$r(f,this.options),d=Co({path:a,method:l,operation:f,operationsByTag:this.operationsByTag,options:this.options}),m=this.operationNames.filter(S=>S===d).length<=1,g=pe(sn(d,m,p)),y=[];if((t=f.parameters)==null||t.map(S=>{let b=S,P=b.schema,E=`Operation ${f.operationId??a} parameter ${b.name}`;y.push(...wa(this,P,E)),this.options.extractEnums&&jo({resolver:this,schema:P,schemaInfo:E,tags:[p],nameSegments:[g,b.name],includeSelf:!0})}),f.requestBody){let S=this.resolveObject(f.requestBody),P=Object.keys(S.content??{}).find(Xe);if(P){let E=(n=(r=S.content)==null?void 0:r[P])==null?void 0:n.schema,_=`Operation ${f.operationId} request body`;y.push(...wa(this,E,_)),this.options.extractEnums&&jo({resolver:this,schema:E,schemaInfo:_,tags:[p],nameSegments:[Sa(g)]})}}for(let S in f.responses){let b=this.resolveObject(f.responses[S]),E=Object.keys(b.content??{}).find(ai);if(E){let _=(s=(i=b.content)==null?void 0:i[E])==null?void 0:s.schema,I=`Operation ${f.operationId} response body`;y.push(...wa(this,_,I)),this.options.extractEnums&&jo({resolver:this,schema:_,schemaInfo:I,tags:[p],nameSegments:[ba({statusCode:S,operationName:d,isUniqueOperationName:m,tag:p})]})}}Fb(this,y).forEach(S=>{let b=this.getSchemaDataByRef(S);b&&(b.tags.push(p),b.deepRefOperations.push(f))})}}this.options.extractEnums&&(this.schemaRefs.forEach(a=>{var u;let c=rn(a);jo({resolver:this,schema:this.getSchemaByRef(c),schemaRef:c,tags:((u=this.getSchemaDataByRef(c))==null?void 0:u.tags)??[],nameSegments:[si(c)]})}),Bb(this),this.handleDuplicateEnumZodSchemas(),Hb(this))}handleDuplicateEnumZodSchemas(){let t=this.enumZodSchemas.map(({code:n})=>n),r=this.enumZodSchemas.filter(({code:n})=>t.includes(n));this.schemaData.forEach(n=>{var a,c;let i=(a=r.find(({zodSchemaName:u})=>u===n.zodSchemaName))==null?void 0:a.code;if(!i)return;let s=this.extractedEnumZodSchemaData.find(({code:u})=>u===i);!s||((c=this.getEnumZodSchemaDataByCode(s.code))==null?void 0:c.zodSchemaName)!==n.zodSchemaName||(n.tags.push(...s.meta.tags??[]),s.meta.schemaRefs.forEach(u=>{this.dependencyGraph.refsDependencyGraph[u]||(this.dependencyGraph.refsDependencyGraph[u]=new Set),this.dependencyGraph.refsDependencyGraph[u].add(n.ref),this.dependencyGraph.deepDependencyGraph[u]||(this.dependencyGraph.deepDependencyGraph[u]=new Set),this.dependencyGraph.deepDependencyGraph[u].add(n.ref)}))}),this.extractedEnumZodSchemaData.splice(0,this.extractedEnumZodSchemaData.length,...this.extractedEnumZodSchemaData.filter(({code:n})=>!t.includes(n)))}};o(jf,"SchemaResolver");var Ia=jf;function zb(e){let t=[],r={};function n(i,s){Array.isArray(s)||(s=[]),s.push(i),r[i]=!0,e[i]&&e[i].forEach(a=>{s.includes(a)||r[a]||n(a,s.slice(0))}),t.includes(i)||t.push(i)}return o(n,"visit"),Object.keys(e).forEach(i=>n(i,[])),t}o(zb,"topologicalSort");function Kb(e,t){let r=Object.entries(e),n=r.filter(([i])=>t.includes(i)).sort(([i],[s])=>t.indexOf(i)-t.indexOf(s)).concat(r.filter(([i])=>!t.includes(i)));return Object.fromEntries(n)}o(Kb,"sortObjKeysFromArray");function Qb(e,t){let r=zb(e.dependencyGraph.deepDependencyGraph).map(i=>e.getZodSchemaNameByRef(i));return Kb(t,r)}o(Qb,"sortZodSchemasByTopology");function Ta(e,t){let r=new Ia(e,t),n=Db(r),i=Gb(r),s={...i.zodSchemas,...r.getZodSchemas(),...i.enumZodSchemas};return s=Qb(r,s),s={...r.getExtractedEnumZodSchemas(),...s},{resolver:r,data:QN({resolver:r,endpoints:n,zodSchemas:s,options:t})}}o(Ta,"getDataFromOpenAPIDoc");function QN({resolver:e,endpoints:t,zodSchemas:r,options:n}){let i=new Map;return n.splitByTags?(t.forEach(s=>{let a=Ar(s,n);Wb(a,i).endpoints.push(s)}),Object.entries(r).forEach(([s,a])=>{let c=e.getTagByZodSchemaName(s);c&&(Wb(c,i).zodSchemas[s]=a)}),i):(i.set(n.defaultTag,{endpoints:t,zodSchemas:r}),i)}o(QN,"splitDataByTags");function Wb(e,t){return t.has(e)||t.set(e,{endpoints:[],zodSchemas:{}}),t.get(e)}o(Wb,"getTagElement");async function Yb(e,t){let{resolver:r,data:n}=await Ta(e,t),i=[],s=[];return n.forEach(({endpoints:c,zodSchemas:u},l)=>{Object.keys(u).forEach(f=>{let p=r.getRefByZodSchemaName(f),d=p?r.getSchemaByRef(p):r.getSchemaByCompositeZodSchemaName(f),m=li({zodSchemaName:f,schema:d,resolver:r}),g;d&&(g=cn({schema:d,parentTypes:[m],resolver:r})),i.push({...m,metaType:"primitive",...g})}),c.forEach(f=>{let p="queries",d=Rt(l);s.push({name:$a(f),importPath:ui({type:p,tag:d,includeTagDir:!0,options:t}),namespace:t.tsNamespaces?Z({type:p,tag:d,options:t}):void 0,isQuery:Ie(f),isMutation:Ct(f),params:WN({resolver:r,endpoint:f}),response:YN({resolver:r,endpoint:f})})})}),{openApiDoc:e,models:i,queries:s}}o(Yb,"getMetadataFromOpenAPIDoc");function WN({resolver:e,endpoint:t}){return t.parameters.map(r=>{var a,c,u,l;let n;if((a=r.parameterObject)!=null&&a.schema)n=e.resolveObject(r.parameterObject.schema);else if(r.bodyObject){let p=Object.keys(r.bodyObject.content??{}).find(Xe);p&&(n=e.resolveObject((u=(c=r.bodyObject.content)==null?void 0:c[p])==null?void 0:u.schema))}let i=li({zodSchemaName:r.zodSchema,schema:n,resolver:e}),s;return n&&(s=cn({schema:n,parentTypes:[i],resolver:e})),{name:At(r.name),isRequired:((l=r.parameterObject)==null?void 0:l.required)??!0,...i,...s,paramType:r.type}}).sort((r,n)=>{if(r.isRequired===n.isRequired){let i=["Path","Body","Query","Header"];return i.indexOf(r.paramType)-i.indexOf(n.paramType)}return r.isRequired?-1:1}).map(({paramType:r,...n})=>n)}o(WN,"getQueryMetadataParams");function YN({resolver:e,endpoint:t}){var a,c,u,l;let r,n=Object.keys(((a=t.responseObject)==null?void 0:a.content)??{}).find(ai);n&&(r=e.resolveObject((l=(u=(c=t.responseObject)==null?void 0:c.content)==null?void 0:u[n])==null?void 0:l.schema));let i=li({zodSchemaName:t.response,schema:r,resolver:e}),s;return r&&(s=cn({schema:r,parentTypes:[i],resolver:e})),{...i,metaType:"primitive",...s}}o(YN,"getQueryMetadataResponse");var Id=Ge(Wt());var Ad=Ge(require("fs")),VP=Ge(require("path"));function BP(e){return Ad.default.readFileSync(VP.default.join(__dirname,`../${e}`),"utf-8")}o(BP,"readFileSync");function wd(e){let t=`src/generators/templates/${e}.hbs`;return BP(t)}o(wd,"readHbsTemplateSync");function UP(e){let t=`src/assets/${e}`;return BP(t)}o(UP,"readAssetSync");function Yt({output:e,fileName:t}){return`${e}/${t}`}o(Yt,"getOutputFileName");var Jt=Ge(Wt());function GP(e){Bq(),Uq(e.options),Gq(),Zq(),zq(),Kq(),Qq(),Wq()}o(GP,"registerAclHbsHelpers");function Bq(){Jt.default.registerHelper("abilityFunctionName",xo)}o(Bq,"registerAbilityFunctionNameHelper");function Uq(e){Jt.default.registerHelper("importedAbilityFunctionName",t=>GS(t,e))}o(Uq,"registerImportedAbilityFunctionNameHelper");function Gq(){Jt.default.registerHelper("ablityAction",Pf)}o(Gq,"registerAbilityActionHelper");function Zq(){Jt.default.registerHelper("ablitySubject",Ef)}o(Zq,"registerAbilitySubjectHelper");function zq(){Jt.default.registerHelper("hasAbilityConditions",Ao)}o(zq,"registerHasAbilityConditionsHelper");function Kq(){Jt.default.registerHelper("abilityConditionsTypes",ci)}o(Kq,"registerAbilityConditionsTypesHelper");function Qq(){Jt.default.registerHelper("abilityDescription",ZS)}o(Qq,"registerAbilityDescriptionHelper");function Wq(){Jt.default.registerHelper("abilitySubjectTypes",$f)}o(Wq,"registerAbilitySubjectTypesHelper");var yn=Ge(Wt());function ZP(){Yq(),Jq(),Xq(),e3(),t3(),r3()}o(ZP,"registerCommonHbsHelpers");function Yq(){yn.default.registerHelper("isEqual",(e,t)=>e===t)}o(Yq,"registerIsEqualHelper");function Jq(){yn.default.registerHelper("commaSeparated",e=>e.join(", "))}o(Jq,"registerCommaSeparatedListHelper");function Xq(){yn.default.registerHelper("union",e=>e.join(" | "))}o(Xq,"registerUnionHelper");function e3(){yn.default.registerHelper("addAsteriskAfterNewLine",e=>e.replace(/\n/g,`
77
77
  *`))}o(e3,"registerAddAsteriskAfterNewLineHelper");function t3(){yn.default.registerHelper("jsonStringify",e=>JSON.stringify(e,null,2))}o(t3,"registerJsonStringifyHelper");function r3(){yn.default.registerHelper("capitalize",G)}o(r3,"registerCapitalizeHelper");var Cr=Ge(Wt());function zP(e){n3(),i3(e.options),a3(e),o3(),s3(),c3(e),u3()}o(zP,"registerEndpointsHbsHelpers");function n3(){Cr.default.registerHelper("endpointName",Ro)}o(n3,"registerEndpointNameHelper");function i3(e){Cr.default.registerHelper("importedEndpointName",t=>hb(t,e))}o(i3,"registerImportedEndpointNameHelper");function o3(){Cr.default.registerHelper("endpointPath",vb)}o(o3,"registerEndpointPathHelper");function s3(){Cr.default.registerHelper("endpointBody",Ea)}o(s3,"registerEndpointBodyHelper");function a3(e){Cr.default.registerHelper("endpointParams",(t,r)=>Ir(e,t,r.hash))}o(a3,"registerEndpointParamsHelper");function c3(e){Cr.default.registerHelper("endpointArgs",(t,r)=>Ir(e,t,r.hash).map(n=>n.name).join(", "))}o(c3,"registerEndpointArgsHelper");function u3(){Cr.default.registerHelper("endpointParamDescription",e=>{var s,a,c,u,l;let t=[`${e.paramType} parameter`],r=((s=e.parameterObject)==null?void 0:s.description)||((a=e.bodyObject)==null?void 0:a.description);r&&t.push(r);let n,i;if((c=e.parameterObject)!=null&&c.schema&&le(e.parameterObject.schema)&&(n=(u=e.parameterObject)==null?void 0:u.schema),(l=e.bodyObject)!=null&&l.content){let p=Object.keys(e.bodyObject.content??{}).find(Xe);p&&(i=e.bodyObject.content[p],i.schema&&le(i.schema)&&(n=i.schema))}if(n){let f=Io(n);t.push(...f)}return i!=null&&i.example&&t.push(`Example: \`${i.example}\``),t.join(". ")})}o(u3,"registerEndpointParamDescriptionHelper");var KP=Ge(Wt());function QP(){l3()}o(QP,"registerImportsHbsHelpers");function l3(){KP.default.registerHelper("importNames",(e,t)=>[...t?[t]:[],...e?[`{ ${e.join(", ")} }`]:[]].join(", "))}o(l3,"registerBindingsHelper");var $e=Ge(Wt());function WP(e){p3(),f3(),d3(),m3(e),h3(e),g3(),y3(e),v3(e),S3(e),b3(e),_3(e),P3(),E3(),$3(),O3()}o(WP,"registerPartialsHbsHelpers");function p3(){$e.default.registerHelper("genModelJsDocs",(e,t,r)=>Re("model-js-docs")({name:e,zodSchema:t,tag:r}))}o(p3,"registerGenerateModelJsDocsHelper");function f3(){$e.default.registerHelper("genImport",e=>Re("import")({import:e}))}o(f3,"registerImportHelper");function d3(){$e.default.registerHelper("genEndpointParams",(e,t)=>Re("endpoint-params")({endpoint:e,options:t}))}o(d3,"registerGenerateEndpointParamsHelper");function m3(e){$e.default.registerHelper("hasUndefinedEndpointBody",t=>gb(t)&&!Ea(t)&&yb(t,e))}o(m3,"registerHasUndefinedEndpointBodyHelper");function h3(e){$e.default.registerHelper("genEndpointConfig",t=>{let r=Af(t),n=e.options.axiosRequestConfig;return Object.keys(r).length===0?n?yr:"":Re("endpoint-config")({endpointConfig:r,hasAxiosRequestConfig:n,hasBlobResponse:t.response===ca,hasFileDownload:t.mediaDownload,axiosRequestConfigName:yr,generateParse:e.options.parseRequestParams})})}o(h3,"registerGenerateEndpointConfigHelper");function g3(){$e.default.registerHelper("genEndpointParamParse",(e,t)=>{var r;return Re("endpoint-param-parse")({param:e,paramName:t,isQuery:e.type==="Query",zodExtendedNamespace:Ye.namespace,parse:Ye.exports.parse,sortExp:Ye.exports.sortExp,addOptional:!((r=e.parameterObject??e.bodyObject)!=null&&r.required)&&(e.parameterSortingEnumSchemaName||de(e.zodSchema))})})}o(g3,"registerGenerateEndpointParamParseHelper");function y3(e){$e.default.registerHelper("genQueryKeys",t=>t.length===0?"":Re("query-keys")({queryEndpoints:t,queriesModuleName:_o,generateInfiniteQueries:e.options.infiniteQueries}))}o(y3,"registerGenerateQueryKeysHelper");function v3(e){$e.default.registerHelper("genQuery",t=>{if(!Ie(t))return;let r=e.options.axiosRequestConfig,n=e.options.checkAcl&&t.acl;return Re("query-use-query")({endpoint:t,queryHook:mt.query,hasQueryFn:Ir(e,t).length>0||r||n,hasQueryFnBody:n,hasAxiosRequestConfig:r,axiosRequestConfigName:yr,axiosRequestConfigType:xt,hasAclCheck:n,aclCheckHook:Or})})}o(v3,"registerGenerateQueryHelper");function S3(e){$e.default.registerHelper("genMutation",(t,r)=>{if(!Ct(t))return;let n=Sb(t,r),i=bb(e,t,n),s=e.options.checkAcl&&t.acl;return Re("query-use-mutation")({endpoint:t,queryHook:mt.mutation,queriesModuleName:_o,hasAxiosRequestConfig:e.options.axiosRequestConfig,hasMutationFnBody:t.mediaUpload||s,axiosRequestConfigName:yr,axiosRequestConfigType:xt,hasMutationEffects:e.options.mutationEffects,mutationEffectsType:ni.optionsType,updateQueryEndpoints:n,destructuredVariables:i,hasAclCheck:s,aclCheckHook:Or})})}o(S3,"registerGenerateMutationHelper");function b3(e){$e.default.registerHelper("genInfiniteQuery",t=>{if(!e.options.infiniteQueries||!pi(t))return;let r=e.options.checkAcl&&t.acl;return Re("query-use-infinite-query")({endpoint:t,infiniteQueryHook:mt.infiniteQuery,hasQueryFnBody:r,pageParamName:la.pageParamName,totalItemsName:la.totalItemsName,limitParamName:la.limitParamName,hasAxiosRequestConfig:e.options.axiosRequestConfig,axiosRequestConfigName:yr,axiosRequestConfigType:xt,hasAclCheck:r,aclCheckHook:Or})})}o(b3,"registerGenerateInfiniteQueryHelper");function _3(e){$e.default.registerHelper("genQueryJsDocs",(t,r)=>Re("query-js-docs")({endpoint:t,query:r.hash.query,mutation:r.hash.mutation,infiniteQuery:r.hash.infiniteQuery,hasMutationEffects:e.options.mutationEffects,mutationEffectsType:ni.optionsType}))}o(_3,"registerGenerateQueryJsDocsHelper");function P3(){$e.default.registerHelper("genCaslAbilityType",e=>Re("casl-ability-type")({endpoint:e,abilityTuple:fe.abilityTuple}))}o(P3,"registerGenerateCaslAbilityTypeHelper");function E3(){$e.default.registerHelper("genCaslAbilityFunction",e=>Re("casl-ability-function")({endpoint:e}))}o(E3,"registerGenerateCaslAbilityFunctionHelper");function $3(){$e.default.registerHelper("genCaslAbilityQuery",e=>Re("casl-ability-query")({endpoint:e}))}o($3,"registerGenerateCaslAbilityQueryHelper");function O3(){$e.default.registerHelper("genAclCheckCall",e=>{var i;let t=(i=ci(e))==null?void 0:i.map(s=>s.name),r=e.parameters.map(s=>s.name),n=t==null?void 0:t.every(s=>r.includes(s));return Re("acl-check-call")({endpoint:e,generateAclCheckParams:Ao(e)&&n})})}o(O3,"registerGenerateAclCheckCallHelper");var $i=Ge(Wt());function YP(){x3(),w3(),I3(),A3(),T3()}o(YP,"registerQueryHbsHelpers");function x3(){$i.default.registerHelper("queryName",(e,t)=>$a(e,t.hash.mutation))}o(x3,"registerQueryNameHelper");function A3(){$i.default.registerHelper("infiniteQueryName",_b)}o(A3,"registerInfiniteQueryNameHelper");function w3(){$i.default.registerHelper("isQuery",Ie)}o(w3,"registerIsQueryHelper");function I3(){$i.default.registerHelper("isMutation",Ct)}o(I3,"registerIsMutationHelper");function T3(){$i.default.registerHelper("isInfiniteQuery",e=>pi(e))}o(T3,"registerIsInfiniteQueryHelper");var vn=Ge(Wt());function JP(e){R3(e.options),C3(e),N3(e),k3(),j3(),q3(e)}o(JP,"registerZodHbsHelpers");function R3(e){vn.default.registerHelper("zodInferedType",t=>To(t,e))}o(R3,"registerInferedTypeHelper");function C3(e){vn.default.registerHelper("importedZodSchemaName",t=>WS(e,t))}o(C3,"registerImportedZodSchemaNameHelper");function N3(e){vn.default.registerHelper("importedZodSchemaInferedType",t=>wr(e,t))}o(N3,"registerImportedZodSchemaInferedTypeHelper");function k3(){vn.default.registerHelper("zodSchemaType",e=>YS(e))}o(k3,"registerZodSchemaTypeHelper");function j3(){vn.default.registerHelper("zodSchemaDescription",e=>JS(e))}o(j3,"registerZodSchemaDescriptionHelper");function q3(e){vn.default.registerHelper("zodSchemaPropertyDescriptions",(t,r)=>eb(e,t,r))}o(q3,"registerZodSchemaPropertyDescriptionsHelper");function he(e,t){let r=wd(t);return ZP(),QP(),JP(e),zP(e),YP(),GP(e),WP(e),Id.default.compile(r)}o(he,"getHbsTemplateDelegate");function Re(e){let t=wd(`partials/${e}`);return Id.default.compile(t)}o(Re,"getHbsPartialTemplateDelegate");function XP({resolver:e,data:t,tag:r=""}){let n=Of({resolver:e,data:t,tag:r});if(!n)return;let{hasAdditionalAbilityImports:i,modelsImports:s,endpoints:a}=n,c={bindings:[fe.abilityTuple,...i?[fe.forcedSubject,fe.subject]:[]],from:_f.from};return he(e,"acl")({caslAbilityTupleImport:c,modelsImports:s,includeNamespace:e.options.tsNamespaces,namespace:Z({type:"acl",tag:r,options:e.options}),endpoints:a})}o(XP,"generateAcl");function eE({resolver:e,data:t}){let{appAbilitiesType:r,hasAdditionalAbilityImports:n,modelsImports:i}=zS({resolver:e,data:t}),s={bindings:[fe.pureAbility,fe.abilityTuple,...r?[]:[fe.subjectType],...n?[fe.forcedSubject]:[]],from:_f.from};return he(e,"app-acl")({caslAbilityTupleImport:s,modelsImports:i,appAbilitiesType:r,appAbilities:Oo,abilityTuple:fe.abilityTuple,subjectType:fe.subjectType})}o(eE,"generateAppAcl");function tE({resolver:e,data:t,tag:r=""}){var b;let n=(b=t.get(r))==null?void 0:b.endpoints;if(!n||n.length===0)return;let i={bindings:[yo],from:ob(e.options)},s=e.options.axiosRequestConfig,a=s,c={bindings:s?[xt]:[],from:fa.from},u=e.options.parseRequestParams,l=n.reduce((P,E)=>[...P,...E.parameters],[]),f=l.filter(P=>!["Path","Header"].includes(P.type)).map(P=>P.parameterSortingEnumSchemaName??P.zodSchema),p=n.map(P=>P.response),d=Fe([...p,...u?f:[]]),m=d.some(P=>!de(P)),g=e.options.parseRequestParams&&f.length>0,y={bindings:[Ye.namespace],from:lb(e.options)},v=xr({resolver:e,tag:r,zodSchemas:d.filter(de),zodSchemasAsTypes:Fe(l.map(P=>P.zodSchema).filter(de))});return he(e,"endpoints")({appRestClientImport:i,hasAxiosImport:a,axiosImport:c,hasZodImport:m,zodImport:ii,hasZodExtendedImport:g,zodExtendedImport:y,modelsImports:v,includeNamespace:e.options.tsNamespaces,namespace:Z({type:"endpoints",tag:r,options:e.options}),restClientName:yo,hasAxiosRequestConfig:s,axiosRequestConfigName:yr,axiosRequestConfigType:xt,endpoints:n,generateParse:u})}o(tE,"generateEndpoints");function rE({resolver:e,data:t,tag:r=""}){var u;let n=(u=t.get(r))==null?void 0:u.zodSchemas;if(!n||Object.keys(n).length===0)return;let i=Object.keys(n).reduce((l,f)=>[...l,...Cb(e,f)],[]).filter(l=>!n[l]),s=xr({resolver:e,tag:r,zodSchemas:i}),a=Object.entries(n).reduce((l,[f,p])=>{let d=e.getZodSchemaObj(f),m={code:p,isEnum:KS(p),schemaObj:d};return{...l,[f]:m}},{});return he(e,"models")({zodImport:ii,modelsImports:s,includeNamespace:e.options.tsNamespaces,namespace:Z({type:"models",tag:r,options:e.options}),tag:r,zodSchemasData:a})}o(rE,"generateModels");function nE({resolver:e,data:t,tag:r=""}){var re;let n=(re=t.get(r))==null?void 0:re.endpoints;if(!n||n.length===0)return;let i=e.options.axiosRequestConfig,s=n.some(({mediaUpload:L})=>L),a=i||s,c={defaultImport:s?cf:void 0,bindings:i?[xt]:[],from:fa.from},u=n.filter(Ie),l=u.filter(L=>pi(L)),f=n.filter(Ct),p={bindings:[...u.length>0?[mt.query]:[],...e.options.infiniteQueries&&l.length>0?[mt.infiniteQuery]:[],...f.length>0?[mt.mutation]:[]],from:ES.from},d=e.options.mutationEffects,m={bindings:[of],from:ab(e.options)},g=d&&f.length>0,y={bindings:[...f.length>0?[ni.optionsType,ni.hookName]:[]],from:cb(e.options)},v=n.filter(L=>L.acl),S=e.options.checkAcl&&v.length>0,b={bindings:[Or],from:ub(e.options)},P={bindings:[...u.length>0?[ta.query]:[],...e.options.infiniteQueries&&l.length>0?[ta.infiniteQuery]:[],...f.length>0?[ta.mutation]:[]],from:sb(e.options)},E=n.reduce((L,X)=>[...L,...X.parameters],[]),_=xr({resolver:e,tag:r,zodSchemasAsTypes:Fe(E.map(L=>L.zodSchema).filter(de))}),I=tb({tag:r,endpoints:n,options:e.options}),T=rb({tag:r,endpoints:v,options:e.options});return he(e,"queries")({hasAxiosImport:a,axiosImport:c,queryImport:p,hasMutationEffects:d,queryModulesImport:m,hasMutationEffectsImport:g,mutationEffectsImport:y,hasAclCheck:S,aclCheckImport:b,queryTypesImport:P,modelsImports:_,endpointsImports:I,aclImports:T,includeNamespace:e.options.tsNamespaces,tag:r,namespace:Z({type:"queries",tag:r,options:e.options}),queriesModuleName:_o,queryModuleEnum:of,endpoints:n,queryEndpoints:u})}o(nE,"generateQueries");function iE(e){return he(e,"acl-check")({abilityContextImport:{...uS,from:e.options.abilityContextImportPath},appAbilitiesImport:{bindings:[Oo],from:pb(e.options)},errorHandlingImport:{...ra,from:e.options.errorHandlingImportPath},abilityContext:nf,appAbilities:Oo,errorHandler:hr.ErrorHandler,sharedErrorHandler:hr.SharedErrorHandler,aclCheckHook:Or,hasGenericAppAbilities:e.options.abilityContextGenericAppAbilities})}o(iE,"generateAclCheck");function oE(e){return he(e,"app-rest-client")({appRestClientName:yo,baseUrl:e.getBaseUrl()})}o(oE,"generateAppRestClient");function sE({resolver:e,data:t}){let r=[];return t.forEach((i,s)=>{var c;let a=(c=t.get(s))==null?void 0:c.endpoints;!a||a.length===0||r.push({tag:s,namespace:Z({type:"queries",tag:s,options:e.options})})}),he(e,"query-modules")({modules:r})}o(sE,"generateQueryModules");function aE(e){return he(e,"zod-extended")({zodImport:ii,zodExtendedNamespace:Ye.namespace,parse:Ye.exports.parse,sortExp:Ye.exports.sortExp,errorHandler:hr.ErrorHandler,sharedErrorHandler:hr.SharedErrorHandler,errorHandlingImport:{...ra,from:e.options.errorHandlingImportPath}})}o(aE,"generateZodExtended");function cE(e,t){return t.options.acl?[{fileName:Yt({output:t.options.output,fileName:an(ya)}),content:eE({resolver:t,data:e})},...t.options.checkAcl?[{fileName:Yt({output:t.options.output,fileName:an(va)}),content:iE(t)}]:[]]:[]}o(cE,"getAclFiles");function uE(e,t){return t.options.mutationEffects?[...fE([lS,sa],t),{fileName:Yt({output:t.options.output,fileName:an(oa)}),content:sE({resolver:t,data:e})}]:[]}o(uE,"getMutationEffectsFiles");function lE(e){return e.options.standalone?[...fE(Object.values(na),e),{fileName:Yt({output:e.options.output,fileName:an(ia)}),content:oE(e)}]:[]}o(lE,"getStandaloneFiles");function pE(e,t){return t.options.parseRequestParams?[{fileName:Yt({output:t.options.output,fileName:an(aa)}),content:aE(t)}]:[]}o(pE,"getZodExtendedFiles");function fE(e,t){return e.reduce((r,n)=>[...r,M3(n,t)],[])}o(fE,"getAssetFiles");function M3(e,t){let r=an(e);return{fileName:Yt({output:t.options.output,fileName:r}),content:UP(r)}}o(M3,"getAssetFile");function dE(e,t){let r=t.standalone&&t.importPath==="ts"?"relative":t.importPath,{resolver:n,data:i}=Ta(e,{...t,importPath:r}),s=[],a=[],c=["models","endpoints","queries",...n.options.acl?["acl"]:[]],u={models:rE,endpoints:tE,queries:nE,acl:XP};return i.forEach((l,f)=>{c.forEach(p=>{let d=u[p]({resolver:n,data:i,tag:f});if(d){let m=Yt({output:t.output,fileName:ib({tag:f,type:p,options:t})});s.push({fileName:m,content:d}),p==="acl"&&a.push(f)}})}),s.push(...cE(i,n),...uE(i,n),...pE(i,n),...lE(n)),s}o(dE,"generateCodeFromOpenAPIDoc");async function D3({input:e,options:t}){let r={...sf,...t},n=await Td.default.bundle(e);return await Yb(n,r)}o(D3,"getGenerateMetadata");async function L3({input:e,options:t}){let r={...sf,...t},n=await Td.default.bundle(e);return dE(n,r)}o(L3,"getGenerateFilesData");0&&(module.exports={getGenerateFilesData,getGenerateMetadata});
package/dist/sh.js CHANGED
@@ -522,11 +522,11 @@ ${nr.join(`
522
522
  `:`
523
523
  `)+m,k=b+1,b=l.indexOf(`
524
524
  `,k)}while(b!==-1);return I+=l.slice(k),I}t(aZe,"stringEncaseCRLFWithFirstIndex");var{stdout:oZe,stderr:cZe}=iZe,_Ee=Symbol("GENERATOR"),_M=Symbol("STYLER"),kU=Symbol("IS_EMPTY"),lZe=["ansi","ansi","ansi256","ansi16m"],pM=Object.create(null),m5t=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=oZe?oZe.level:0;l.level=u.level===void 0?m:u.level},"applyOptions"),mEe=class mEe{constructor(u){return uZe(u)}};t(mEe,"Chalk");var qoe=mEe,uZe=t(l=>{let u=t((...m)=>m.join(" "),"chalk");return m5t(u,l),Object.setPrototypeOf(u,CU.prototype),u},"chalkFactory");function CU(l){return uZe(l)}t(CU,"createChalk");Object.setPrototypeOf(CU.prototype,Function.prototype);for(let[l,u]of Object.entries(Xx))pM[l]={get(){let m=zoe(this,dEe(u.open,u.close,this[_M]),this[kU]);return Object.defineProperty(this,l,{value:m}),m}};pM.visible={get(){let l=zoe(this,this[_M],!0);return Object.defineProperty(this,"visible",{value:l}),l}};var pEe=t((l,u,m,...b)=>l==="rgb"?u==="ansi16m"?Xx[m].ansi16m(...b):u==="ansi256"?Xx[m].ansi256(Xx.rgbToAnsi256(...b)):Xx[m].ansi(Xx.rgbToAnsi(...b)):l==="hex"?pEe("rgb",u,m,...Xx.hexToRgb(...b)):Xx[m][l](...b),"getModelAnsi"),h5t=["rgb","hex","ansi256"];for(let l of h5t){pM[l]={get(){let{level:m}=this;return function(...b){let k=dEe(pEe(l,lZe[m],"color",...b),Xx.color.close,this[_M]);return zoe(this,k,this[kU])}}};let u="bg"+l[0].toUpperCase()+l.slice(1);pM[u]={get(){let{level:m}=this;return function(...b){let k=dEe(pEe(l,lZe[m],"bgColor",...b),Xx.bgColor.close,this[_M]);return zoe(this,k,this[kU])}}}}var g5t=Object.defineProperties(()=>{},{...pM,level:{enumerable:!0,get(){return this[_Ee].level},set(l){this[_Ee].level=l}}}),dEe=t((l,u,m)=>{let b,k;return m===void 0?(b=l,k=u):(b=m.openAll+l,k=u+m.closeAll),{open:l,close:u,openAll:b,closeAll:k,parent:m}},"createStyler"),zoe=t((l,u,m)=>{let b=t((...k)=>y5t(b,k.length===1?""+k[0]:k.join(" ")),"builder");return Object.setPrototypeOf(b,g5t),b[_Ee]=l,b[_M]=u,b[kU]=m,b},"createBuilder"),y5t=t((l,u)=>{if(l.level<=0||!u)return l[kU]?"":u;let m=l[_M];if(m===void 0)return u;let{openAll:b,closeAll:k}=m;if(u.includes("\x1B"))for(;m!==void 0;)u=sZe(u,m.close,m.open),m=m.parent;let I=u.indexOf(`
525
- `);return I!==-1&&(u=aZe(u,k,b,I)),b+u+k},"applyStyle");Object.defineProperties(CU.prototype,pM);var yXt=CU(),vXt=CU({level:cZe?cZe.level:0});var xA=new qoe;function hEe(l){console.log(l)}t(hEe,"log");function oS(l){console.log(`[INFO] ${l}`)}t(oS,"logInfo");function EU(l){console.log(xA.green(`[SUCCESS] ${l}`))}t(EU,"logSuccess");function VN(l,u){l instanceof Error?console.log(xA.red(`[ERROR] ${u||l.message}`)):console.log(xA.red(`[ERROR] ${l}`))}t(VN,"logError");function Voe(l){console.log(xA.bgYellow(`==== ${l} ====`))}t(Voe,"logBanner");var fZe=Zm(require("fs"));function dM(){return"1.1.1"}t(dM,"getVersion");var NXt=Zm(pZe());var gEe=Symbol("options_key");function Ju(l){return(u,m)=>{var b,k;if(l!=null){let I={...Reflect.getMetadata(gEe,u)||{},[m]:{...l,describe:l.envAlias?`${l.describe||""} [${l.envAlias}]`:l.describe,type:l.type||((k=(b=Reflect.getMetadata("design:type",u,m))==null?void 0:b.name)==null?void 0:k.toLowerCase())}};Reflect.defineMetadata(gEe,I,u)}}}t(Ju,"YargOption");function dZe(l){let u=Reflect.getMetadata(gEe,l.prototype);if(!u)throw new Error(`Options for ${l.name} were not defined`);return u}t(dZe,"getYargsOption");function Uoe(l){return async u=>u.options(v5t(l)).middleware(async m=>await b5t(l,m),!0)}t(Uoe,"getBuilder");function v5t(l){return Object.entries(dZe(l)).reduce((u,[m,b])=>(u[m]=Object.fromEntries(Object.entries(b).filter(([k])=>!["envAlias","default"].includes(k))),u),{})}t(v5t,"getYargsOptions");async function b5t(l,u){let m=new l;for(let[b,k]of Object.entries(dZe(l)))m[b]=u[b]??k.default;return m}t(b5t,"loadYargsConfig");var qnt=Zm(owe());var Utt={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"},Wtt={"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 Yrt=Zm(Htt());var lT={query:"useQuery",infiniteQuery:"useInfiniteQuery",mutation:"useMutation"},Gtt={bindings:[lT.query,lT.infiniteQuery,lT.mutation],from:"@tanstack/react-query"},gW={pageParamName:"page"},Xce={pageParamName:"page",totalItemsName:"totalItems",limitParamName:"limit"},yW="moduleName";var cwe={"Content-Type":"application/json",Accept:"application/json"},Yce="data",lwe="axios",$A="config",AC="AxiosRequestConfig",Kce={defaultImport:lwe,bindings:[AC],from:"axios"};var Ztt=t(l=>/^(?:[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+)$/.test(l),"isValidPropertyName"),JA=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 Vf(l){return l!=null&&Object.prototype.hasOwnProperty.call(l,"$ref")}t(Vf,"isReferenceObject");function ey(l){return!Vf(l)}t(ey,"isSchemaObject");function ele(l){return l.type==="array"}t(ele,"isArraySchemaObject");function Qtt(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((k,I)=>{if(gVt(I)){let L=I.required;k[0].push(...L??[])}else k[1].push(I);return k},[[],[]]),b={properties:u.reduce((k,I)=>(k[I]={},k),{}),type:"object",required:u};return{noRequiredOnlyAllof:m,composedRequiredSchema:b,patchRequiredSchemaInLoop:t((k,I)=>{if(Vf(k)){let L=I(k.$ref);L&&b.required.forEach(Z=>{var oe;b.properties[Z]=((oe=L==null?void 0:L.properties)==null?void 0:oe[Z])??{}})}else{let L=k.properties??{};b.required.forEach(Z=>{L[Z]&&(b.properties[Z]=L[Z]??{})})}},"patchRequiredSchemaInLoop")}}t(Qtt,"inferRequiredSchema");var gVt=t(l=>!Vf(l)&&!!l.required&&!l.type&&!l.properties&&!(l!=null&&l.allOf)&&!(l!=null&&l.anyOf)&&!l.oneOf,"isBrokenAllOfItem");var e6=Symbol.for("@ts-pattern/matcher"),yVt=Symbol.for("@ts-pattern/isVariadic"),rle="@ts-pattern/anonymous-select-key",uwe=t(l=>!!(l&&typeof l=="object"),"r"),tle=t(l=>l&&!!l[e6],"i"),NC=t((l,u,m)=>{if(tle(l)){let b=l[e6](),{matched:k,selections:I}=b.match(u);return k&&I&&Object.keys(I).forEach(L=>m(L,I[L])),k}if(uwe(l)){if(!uwe(u))return!1;if(Array.isArray(l)){if(!Array.isArray(u))return!1;let b=[],k=[],I=[];for(let L of l.keys()){let Z=l[L];tle(Z)&&Z[yVt]?I.push(Z):I.length?k.push(Z):b.push(Z)}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+k.length)return!1;let L=u.slice(0,b.length),Z=k.length===0?[]:u.slice(-k.length),oe=u.slice(b.length,k.length===0?1/0:-k.length);return b.every((re,me)=>NC(re,L[me],m))&&k.every((re,me)=>NC(re,Z[me],m))&&(I.length===0||NC(I[0],oe,m))}return l.length===u.length&&l.every((L,Z)=>NC(L,u[Z],m))}return Reflect.ownKeys(l).every(b=>{let k=l[b];return(b in u||tle(I=k)&&I[e6]().matcherType==="optional")&&NC(k,u[b],m);var I})}return Object.is(u,l)},"s"),WA=t(l=>{var u,m,b;return uwe(l)?tle(l)?(u=(m=(b=l[e6]()).getSelectionKeys)==null?void 0:m.call(b))!=null?u:[]:Array.isArray(l)?bW(l,WA):bW(Object.values(l),WA):[]},"o"),bW=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=>bVt(l,u),"or"),select:t(u=>u===void 0?Xtt(l):Xtt(u,l),"select")})}t(pS,"u");function vVt(l){return pS({[e6]:()=>({match:t(u=>{let m={},b=t((k,I)=>{m[k]=I},"r");return u===void 0?(WA(l).forEach(k=>b(k,void 0)),{matched:!0,selections:m}):{matched:NC(l,u,b),selections:m}},"match"),getSelectionKeys:t(()=>WA(l),"getSelectionKeys"),matcherType:"optional"})})}t(vVt,"h");function Zp(...l){return pS({[e6]:()=>({match:t(u=>{let m={},b=t((k,I)=>{m[k]=I},"r");return{matched:l.every(k=>NC(k,u,b)),selections:m}},"match"),getSelectionKeys:t(()=>bW(l,WA),"getSelectionKeys"),matcherType:"and"})})}t(Zp,"m");function bVt(...l){return pS({[e6]:()=>({match:t(u=>{let m={},b=t((k,I)=>{m[k]=I},"r");return bW(l,WA).forEach(k=>b(k,void 0)),{matched:l.some(k=>NC(k,u,b)),selections:m}},"match"),getSelectionKeys:t(()=>bW(l,WA),"getSelectionKeys"),matcherType:"or"})})}t(bVt,"d");function Af(l){return{[e6]:()=>({match:t(u=>({matched:!!l(u)}),"match")})}}t(Af,"p");function Xtt(...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({[e6]:()=>({match:t(b=>{let k={[u??rle]:b};return{matched:m===void 0||NC(m,b,(I,L)=>{k[I]=L}),selections:k}},"match"),getSelectionKeys:t(()=>[u??rle].concat(m===void 0?[]:WA(m)),"getSelectionKeys")})})}t(Xtt,"y");function DC(l){return typeof l=="number"}t(DC,"v");function qA(l){return typeof l=="string"}t(qA,"b");function zA(l){return typeof l=="bigint"}t(zA,"w");var Yrr=pS(Af(function(l){return!0}));var VA=t(l=>Object.assign(pS(l),{startsWith:t(u=>{return VA(Zp(l,(m=u,Af(b=>qA(b)&&b.startsWith(m)))));var m},"startsWith"),endsWith:t(u=>{return VA(Zp(l,(m=u,Af(b=>qA(b)&&b.endsWith(m)))));var m},"endsWith"),minLength:t(u=>VA(Zp(l,(m=>Af(b=>qA(b)&&b.length>=m))(u))),"minLength"),length:t(u=>VA(Zp(l,(m=>Af(b=>qA(b)&&b.length===m))(u))),"length"),maxLength:t(u=>VA(Zp(l,(m=>Af(b=>qA(b)&&b.length<=m))(u))),"maxLength"),includes:t(u=>{return VA(Zp(l,(m=u,Af(b=>qA(b)&&b.includes(m)))));var m},"includes"),regex:t(u=>{return VA(Zp(l,(m=u,Af(b=>qA(b)&&!!b.match(m)))));var m},"regex")}),"j"),Krr=VA(Af(qA)),IC=t(l=>Object.assign(pS(l),{between:t((u,m)=>IC(Zp(l,((b,k)=>Af(I=>DC(I)&&b<=I&&k>=I))(u,m))),"between"),lt:t(u=>IC(Zp(l,(m=>Af(b=>DC(b)&&b<m))(u))),"lt"),gt:t(u=>IC(Zp(l,(m=>Af(b=>DC(b)&&b>m))(u))),"gt"),lte:t(u=>IC(Zp(l,(m=>Af(b=>DC(b)&&b<=m))(u))),"lte"),gte:t(u=>IC(Zp(l,(m=>Af(b=>DC(b)&&b>=m))(u))),"gte"),int:t(()=>IC(Zp(l,Af(u=>DC(u)&&Number.isInteger(u)))),"int"),finite:t(()=>IC(Zp(l,Af(u=>DC(u)&&Number.isFinite(u)))),"finite"),positive:t(()=>IC(Zp(l,Af(u=>DC(u)&&u>0))),"positive"),negative:t(()=>IC(Zp(l,Af(u=>DC(u)&&u<0))),"negative")}),"x"),enr=IC(Af(DC)),UA=t(l=>Object.assign(pS(l),{between:t((u,m)=>UA(Zp(l,((b,k)=>Af(I=>zA(I)&&b<=I&&k>=I))(u,m))),"between"),lt:t(u=>UA(Zp(l,(m=>Af(b=>zA(b)&&b<m))(u))),"lt"),gt:t(u=>UA(Zp(l,(m=>Af(b=>zA(b)&&b>m))(u))),"gt"),lte:t(u=>UA(Zp(l,(m=>Af(b=>zA(b)&&b<=m))(u))),"lte"),gte:t(u=>UA(Zp(l,(m=>Af(b=>zA(b)&&b>=m))(u))),"gte"),positive:t(()=>UA(Zp(l,Af(u=>zA(u)&&u>0))),"positive"),negative:t(()=>UA(Zp(l,Af(u=>zA(u)&&u<0))),"negative")}),"A"),tnr=UA(Af(zA)),rnr=pS(Af(function(l){return typeof l=="boolean"})),nnr=pS(Af(function(l){return typeof l=="symbol"})),inr=pS(Af(function(l){return l==null})),snr=pS(Af(function(l){return l!=null}));var dwe=class dwe 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(dwe,"W");var fwe=dwe,_we={matched:!1,value:void 0};function Gy(l){return new pwe(l,_we)}t(Gy,"z");var vW=class vW{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]],k;u.length===3&&typeof u[1]=="function"?k=u[1]:u.length>2&&b.push(...u.slice(1,u.length-1));let I=!1,L={},Z=t((re,me)=>{I=!0,L[re]=me},"a"),oe=!b.some(re=>NC(re,this.input,Z))||k&&!k(this.input)?_we:{matched:!0,value:m(I?rle in L?L[rle]:L:this.input,this.input)};return new vW(this.input,oe)}when(u,m){if(this.state.matched)return this;let b=!!u(this.input);return new vW(this.input,b?{matched:!0,value:m(this.input,this.input)}:_we)}otherwise(u){return this.state.matched?this.state.value:u(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new fwe(this.input)}run(){return this.exhaustive()}returnType(){return this}};t(vW,"I");var pwe=vW;var mwe=2,Ytt=["application/octet-stream","multipart/form-data","application/x-www-form-urlencoded","*/*"],Ktt=["query","header","path"],_8=["get","put","post","delete","options","head","patch","trace"],ert=["string","number","integer","boolean"],SW=["allOf","anyOf","oneOf"];var Ip=t(l=>l.charAt(0).toUpperCase()+l.slice(1),"capitalize"),HA=t(l=>l.charAt(0).toLowerCase()+l.slice(1),"decapitalize"),trt=t(l=>l.replace(/(-\w)/g,u=>u[1].toUpperCase()),"kebabToCamel"),ty=t(l=>l.replace(/(_\w)/g,u=>u[1].toUpperCase()),"snakeToCamel"),rrt=t(l=>l.replace(/[\W_]+(\w)?/g,(u,m)=>(m==null?void 0:m.toUpperCase())??""),"nonWordCharactersToCamel"),hwe=t((l,u="")=>l.endsWith(u)?l:`${l}${u}`,"suffixIfNeeded"),nrt=t((l,u)=>l.replace(new RegExp(`${u}$`),""),"removeSuffix"),SVt=t(l=>{var b;let u=l.reduce((k,I)=>({...k,[I]:(k[I]??0)+1}),{});return(b=Object.entries(u).sort((k,I)=>k[1]===I[1]?I[0].length-k[0].length:I[1]-k[1])[0])==null?void 0:b[0]},"getLongestMostCommon"),gwe=t(l=>{let u=l.map(Ip).map(irt).map(m=>xVt(m)).flat();return SVt(u)},"getMostCommonAdjacentCombinationSplit"),irt=t(l=>l.split(/(?<![A-Z])(?=[A-Z])/).filter(Boolean),"splitByUppercase"),srt=t(l=>irt(l).join(" "),"camelToSpaceSeparated"),xVt=t((l,u=["dto","by","for","of","in","to","and","with"])=>{var b;let m=[];for(let k=0;k<l.length;k++)if(!u.includes(l[k].toLowerCase()))for(let I=k+1;I<=l.length;I++)u.includes((b=l[I-1])==null?void 0:b.toLowerCase())||m.push(l.slice(k,I).join(""));return m},"getAdjacentStringCombinations"),art=t((l,u)=>{let m=u.replace(/es$|s$/g,""),b=new RegExp(`(${HA(m)}|${Ip(m)})[a-z]*(?=$|[A-Z])`,"g");return l.replace(b,"")},"removeWord");var crt=t(l=>`#/components/schemas/${l}`,"getSchemaRef"),p8=t(l=>l[1]==="/"?l:"#/"+l.slice(1),"autocorrectRef"),KM=t(l=>p8(l).split("/").at(-1),"getSchemaNameByRef");function vwe(l){let u=TVt(l).normalize("NFKD").trim().replace(/\s+/g,"_").replace(/--+/g,"-").replace(/-+/g,"_").replace(/[^\w-]+/g,"_");return ty(u)}t(vwe,"normalizeString");function bwe(l){return/^[a-zA-Z]\w*$/.test(l)?l:`"${l}"`}t(bwe,"wrapWithQuotesIfNeeded");function lrt(l){return typeof l=="string"&&l.startsWith('"')&&l.endsWith('"')?l.slice(1,-1):l}t(lrt,"unwrapQuotesIfNeeded");function TVt(l){let u=Number(l[0]);return typeof u=="number"&&!Number.isNaN(u)?"_"+l:l}t(TVt,"prefixStringStartingWithNumberIfNeeded");function Swe(l){let u=l.replaceAll("_","#");return ty(u.replaceAll("-","_")).replaceAll("#","_")}t(Swe,"pathParamToVariableName");var d8=t(l=>ert.includes(l),"isPrimitiveType");function urt(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(),k=b.toString(16);return b<=255?`\\x${`00${k}`.slice(-2)}`:`\\u${`0000${k}`.slice(-4)}`}).replace(/\//g,"\\/")}t(urt,"escapeControlCharacters");function OC(l){return l.includes("application/")&&l.includes("json")||Ytt.includes(l)||l.includes("text/")}t(OC,"isParamMediaTypeAllowed");function xW(l){return l>=200&&l<300}t(xW,"isMainResponseStatus");function nle(l){return!(l>=200&&l<300)}t(nle,"isErrorStatus");function ile(l){return l.startsWith("application/")}t(ile,"isMediaTypeAllowed");var ort=/({\w+})/g,kVt=/[^\w\-]+/g;function frt(l){l=Ip(trt(l.replaceAll("/","-")).replaceAll("-",""));let u=[...l.matchAll(ort)];if(u.length>0){let m=u.sort((b,k)=>b.index-k.index)[u.length-1][0];l=`${l.replace(ort,"")}By${Ip(m.slice(1,-1))}`}return l.replace(kVt,"_")}t(frt,"pathToVariableName");var ywe=/{(\b\w+(?:-\w+)*\b)}/g;function _rt(l){let u=l.match(ywe);return u===null?l.replaceAll(ywe,":$1"):(u.forEach(m=>{let b=Swe(m.replaceAll(ywe,":$1"));l=l.replaceAll(m,b)}),l)}t(_rt,"replaceHyphenatedPath");var prt=t(l=>{let u=l["x-enumNames"],m=Array.isArray(u)&&u.length>0,b=!!l.schema&&ey(l.schema)&&l.schema.type==="string";return m&&b},"isSortingParameterObject"),m8=t((l,u)=>u.excludePathRegex?new RegExp(u.excludePathRegex).test(l):!1,"isPathExcluded");var Ab=t(l=>l.method==="get","isQuery"),ZA=t(l=>l.method!=="get"||!!l.mediaDownload,"isMutation"),eR=t((l,u)=>Ab(l)&&(u??Object.values(gW)).every(m=>l.parameters.some(b=>b.name===m&&b.type==="Query")),"isInfiniteQuery"),drt=t((l,u,m)=>{let b=m.reduce((k,I)=>[...k,...GA(l,I,{includeOnlyRequiredParams:!0}).map(L=>L.name)],[]);return GA(l,u,{includeOnlyRequiredParams:!0,excludeBodyParam:!0}).filter(k=>b.includes(k.name)).map(k=>k.name)},"getDestructuredVariables");function QA(l){return rrt(l)}t(QA,"formatTag");function XA(l,u){var b;let m=(b=l.tags)==null?void 0:b[0];return QA(m??u.defaultTag)}t(XA,"getOperationTag");function mrt(l,u){return u.excludeTags.some(m=>m.toLowerCase()===l.toLowerCase())}t(mrt,"isTagExcluded");var sle={fileName:"acl/app.ability",extension:"ts"},TW="AppAbilities",ale={fileName:"acl/useAclCheck",extension:"ts"},YA="useAclCheck",ry={abilityTuple:"AbilityTuple",pureAbility:"PureAbility",forcedSubject:"ForcedSubject",subjectType:"Subject",subject:"subject"},xwe={bindings:[ry.abilityTuple,ry.pureAbility,ry.forcedSubject,ry.subjectType,ry.subject],from:"@casl/ability"};var kW="AppRestClient",ole={query:"AppQueryOptions",infiniteQuery:"AppInfiniteQueryOptions",mutation:"AppMutationOptions"},Twe="src/data",hrt="@/data",h8={appRestClient:"@/util/rest/clients/app-rest-client",queryTypes:"@/types/react-query",errorHandling:"@/util/vendor/error-handling",abilityContext:"@/data/acl/ability.context"},KA={ErrorHandler:"ErrorHandler",SharedErrorHandler:"SharedErrorHandler"},cle={bindings:[KA.ErrorHandler,KA.SharedErrorHandler],from:h8.errorHandling},kwe="AbilityContext",grt={bindings:[kwe],from:h8.abilityContext};var lle={reactQueryTypes:{fileName:"react-query.types",extension:"ts"},restClient:{fileName:"rest-client",extension:"ts"},restInterceptor:{fileName:"rest-interceptor",extension:"ts"}},ule={fileName:"app-rest-client",extension:"ts"},Cwe="QueryModule",fle={fileName:"queryModules",extension:"ts"},yrt={fileName:"queryConfig.context",extension:"tsx"},tR={optionsType:"MutationEffectsOptions",hookName:"useMutationEffects",runFunctionName:"runMutationEffects"},_le={fileName:"useMutationEffects",extension:"ts"},dS={namespace:"ZodExtended",exports:{parse:"parse",sortExp:"sortExp"}},ple={fileName:"zod.extended",extension:"ts"};var Db=t((...l)=>[...new Set(l.flat())],"getUniqueArray");var CW=t(l=>`canUse${Ip(ty(l.operationName))}`,"getAbilityFunctionName"),vrt=t((l,u)=>`${u.tsNamespaces?`${vd({type:"acl",tag:t3(l,u),options:u})}.`:""}${CW(l)}`,"getImportedAbilityFunctionName"),Ewe=t(l=>{var u;return(u=l.acl)==null?void 0:u[0].action},"getAbilityAction"),Pwe=t(l=>{var u;return(u=l.acl)==null?void 0:u[0].subject},"getAbilitySubject"),EW=t(l=>{var u;return!!((u=rR(l))!=null&&u.length)},"hasAbilityConditions"),rR=t(l=>{var u,m;return(m=(u=l.acl)==null?void 0:u[0].conditionsTypes)==null?void 0:m.sort((b,k)=>b.name.localeCompare(k.name))},"getAbilityConditionsTypes"),brt=t(l=>{var u;return(u=l.acl)==null?void 0:u[0].description},"getAbilityDescription"),wwe=t(l=>{var b;let u=Pwe(l),m=[`"${u??""}"`];return EW(l)&&m.push(`ForcedSubject<"${u}"> & { ${(b=rR(l))==null?void 0:b.map(k=>`${k.name}${k.required?"":"?"}: ${k.type??""}${k.zodSchemaName??""},`).join(" ")} }`),m},"getAbilitySubjectTypes");function Awe({resolver:l,data:u,tag:m=""}){var Z;let b=(Z=u.get(m))==null?void 0:Z.endpoints.filter(({acl:oe})=>oe&&oe.length>0);if(!b||b.length===0)return;let k=b.some(({acl:oe})=>(oe==null?void 0:oe[0].conditions)&&Object.keys(oe[0].conditions).length>0),I=b.reduce((oe,re)=>{var ke,et;let me=(et=(ke=re.acl)==null?void 0:ke[0].conditionsTypes)==null?void 0:et.reduce((At,nr)=>[...At,...nr!=null&&nr.zodSchemaName?[nr.zodSchemaName]:[]],[]);return[...oe,...me??[]]},[]),L=e3({resolver:l,tag:m,zodSchemasAsTypes:Db(I)});return{endpoints:b,hasAdditionalAbilityImports:k,modelsImports:L}}t(Awe,"getAclData");var Srt=t(({resolver:l,data:u})=>{let m=new Map,b=[],k=!1;u.forEach((Z,oe)=>{let re=Awe({resolver:l,data:u,tag:oe});if(!re)return;let{modelsImports:me,hasAdditionalAbilityImports:ke,endpoints:et}=re;b.push(me),k=k||ke,et.forEach(At=>{let nr=Ewe(At);nr&&m.set(nr,new Set([...m.get(nr)??[],...wwe(At)]))})});let I=Dwe(l.options,...b);return{appAbilitiesType:m.size>0?Object.fromEntries(Array.from(m.entries()).map(([Z,oe])=>[Z,Array.from(oe)])):void 0,modelsImports:I,hasAdditionalAbilityImports:k}},"getAppAbilitiesType");var xrt="Schema",Trt="Enum",krt="Body",Crt="Param",Ert="Response",Prt="ErrorResponse",PW="z.void()",dle="z.instanceof(Blob)",wW="z.enum",wrt="z.int()",Art="z.number()",mle="z.string()",Drt="z.email()",Irt="z.url()",Nrt="z.uuid()",Ort="z.iso.datetime({ offset: true })",nR={bindings:["z"],from:"zod"};function Z0(l,u){if(!l)return;let{data:m,onSchema:b}=u;if(Vf(l)&&b({type:"reference",schema:l,data:m})===!0)return;let k=l;if(SW.some(I=>I in k&&k[I])){let I=k.allOf??k.anyOf??k.oneOf??[];for(let L of I)(b==null?void 0:b({type:"composite",parentSchema:l,schema:L,data:m}))!==!0&&Z0(L,{data:m,onSchema:b})}if(k.properties)for(let[I,L]of Object.entries(k.properties))b({type:"property",parentSchema:l,schema:L,data:m,propertyName:I})!==!0&&Z0(L,u);if(k.additionalProperties&&typeof k.additionalProperties=="object"){if(b({type:"additionalProperties",parentSchema:l,schema:k.additionalProperties,data:m})===!0)return;Z0(k.additionalProperties,u)}if(k.type==="array"){let I=l.items;if(b({type:"array",parentSchema:l,schema:I,data:m})===!0)return;Z0(I,u)}}t(Z0,"iterateSchema");var g8=t((l,u)=>hwe(Ip(vwe(l)),u),"getZodSchemaName"),AW=t((l,u,m)=>hwe(Ip(vwe(l)),`${u}${m}`),"getEnumZodSchemaName"),Zy=t(l=>["z.",`${dS.namespace}.`].every(u=>!l.startsWith(u)),"isNamedZodSchema"),Frt=t(l=>l.startsWith(wW),"isEnumZodSchema"),y8=t((l,u,m)=>u?l:`${m}_${l}`,"getZodSchemaOperationName"),hle=t(l=>ty(`${l}_${krt}`),"getBodyZodSchemaName"),Mrt=t((l,u)=>ty(`${l}_${u}${Crt}`),"getParamZodSchemaName"),CVt=t(l=>ty(`${l}${Ert}`),"getMainResponseZodSchemaName"),EVt=t((l,u)=>ty(`${l}_${u}_${Prt}`),"getErrorResponseZodSchemaName");function gle({statusCode:l,operationName:u,isUniqueOperationName:m,tag:b}){let k=Number(l),I=y8(u,m,b);return!xW(k)&&l!=="default"&&nle(k)?EVt(I,l):CVt(I)}t(gle,"getResponseZodSchemaName");function DW(l){return["minimum","exclusiveMinimum","maximum","exclusiveMaximum","minItems","minLength","minProperties","maxItems","maxLength","maxProperties","default","example"].filter(b=>l[b]).reduce((b,k)=>[...b,`${Ip(srt(k))}: \`${l[k]}\``],[])}t(DW,"getSchemaDescriptions");var IW=t((l,u)=>nrt(l,u.schemaSuffix),"getZodSchemaInferedTypeName"),Rrt=t((l,u)=>Zy(u)?`${l.options.tsNamespaces?`${vd({type:"models",tag:l.getTagByZodSchemaName(u),options:l.options})}.`:""}${u}`:u,"getImportedZodSchemaName"),v8=t((l,u,m)=>{if(!Zy(u))return u===PW?"void":u;let b=l.getTagByZodSchemaName(u);return`${l.options.tsNamespaces&&b!==m?`${vd({type:"models",tag:b,options:l.options})}.`:""}${IW(u,l.options)}`},"getImportedZodSchemaInferedTypeName");function Lrt(l){var u;return l.isEnum?"enum":((u=l.schemaObj)==null?void 0:u.type)??"object"}t(Lrt,"getZodSchemaType");function jrt(l){if(l.schemaObj)return[l.schemaObj.description,...DW(l.schemaObj)].filter(Boolean).join(". ")}t(jrt,"getZodSchemaDescription");function Brt(l,u,m){var b;if(Vf(u)){let k=l.getZodSchemaNameByRef(u.$ref);return k?v8(l,k,m):void 0}if(ele(u)){if(!Vf(u.items))return`${((b=u.items)==null?void 0:b.type)??"unknown"}[]`;let k=l.getZodSchemaNameByRef(u.items.$ref);return k?`${v8(l,k,m)}[]`:void 0}if(SW.some(k=>k in u&&u[k])){let k=u.allOf??u.anyOf??u.oneOf??[];if(k.length>0)return Brt(l,k[0],m)}return u.type}t(Brt,"getType");function $rt(l,u,m){if(!u.schemaObj)return[];let b="[0]",k="[key]",I={},L=t(Z=>{var re;if(Z.type==="reference")return!0;if(Z.type==="composite")return;let oe=[...((re=Z.data)==null?void 0:re.pathSegments)??[]];if(Z.type==="array"?oe.push(b):Z.type==="property"?oe.push(Z.propertyName):Z.type==="additionalProperties"&&oe.push(k),Z.schema&&oe[oe.length-1]!==b){let me=l.resolveObject(Z.schema),ke=[me.description,...DW(me)].filter(Boolean),et=oe.join(".");I[et]&&"type"in Z.schema&&Z.schema.type==="object"||(delete I[et],I[et]={type:Brt(l,Z.schema,m)??"unknown",description:ke.join(". ")})}return Z0(Z.schema,{data:{pathSegments:[...oe]},onSchema:L}),!0},"onSchema");return"allOf"in u.schemaObj&&u.schemaObj.allOf&&u.schemaObj.allOf.forEach(Z=>{if(Vf(Z)){let oe=l.resolveObject(Z);Z0(oe,{data:{pathSegments:[]},onSchema:L})}}),Z0(u.schemaObj,{data:{pathSegments:[]},onSchema:L}),I}t($rt,"getZodSchemaPropertyDescriptions");function e3({resolver:l,tag:u,zodSchemas:m=[],zodSchemasAsTypes:b=[]}){let k="models",I=t(oe=>l.getTagByZodSchemaName(oe),"getTag"),L=yle({type:k,tag:u,entities:m,getTag:I,getEntityName:t(oe=>oe,"getEntityName"),options:l.options}),Z=yle({type:k,tag:u,entities:b,getTag:I,getEntityName:t(oe=>IW(oe,l.options),"getEntityName"),options:l.options});return Dwe(l.options,L,Z)}t(e3,"getModelsImports");function Jrt({tag:l,endpoints:u,options:m}){return yle({type:"endpoints",tag:l,entities:u,getTag:t(b=>t3(b,m),"getTag"),getEntityName:NW,options:m})}t(Jrt,"getEndpointsImports");function qrt({tag:l,endpoints:u,options:m}){return yle({type:"acl",tag:l,entities:u,getTag:t(b=>t3(b,m),"getTag"),getEntityName:CW,options:m})}t(qrt,"getAclImports");function t6(l){let u=l.tsPath;return l.importPath==="relative"?u="../":l.importPath==="absolute"?u=l.output:new RegExp(`${Twe}`,"g").test(l.output)&&(u=l.output.replace(new RegExp(`.*${Twe}`,"g"),l.tsPath)),`${u}/`.replace(/\/\//g,"/")}t(t6,"getImportPath");function yle({type:l="models",tag:u,entities:m,getTag:b,getEntityName:k,options:I}){let L=new Map;return m.forEach(Z=>{let oe=b(Z);if(L.has(oe))I.tsNamespaces||L.get(oe).bindings.push(k(Z));else{let re=u===oe;L.set(oe,{bindings:[I.tsNamespaces?vd({type:l,tag:oe,options:I}):k(Z)],from:`${re?"./":t6(I)}${Iwe({type:l,tag:oe,includeTagDir:!re,options:I})}`})}}),Array.from(L.values())}t(yle,"getImports");function Dwe(l,...u){let m=new Map;return u.forEach(b=>{b.forEach(k=>{m.has(k.from)?l.tsNamespaces||m.get(k.from).bindings.push(...k.bindings):m.set(k.from,k)})}),Array.from(m.values()).map(b=>({...b,bindings:Db(b.bindings)}))}t(Dwe,"mergeImports");function b8({fileName:l,extension:u}){return`${l}.${u}`}t(b8,"getFileNameWithExtension");function zrt({type:l,tag:u,options:m,includeTagDir:b=!0}){let k=m.configs[l].outputFileNameSuffix;return u?`${b?`${HA(u)}/`:""}${HA(u)}.${k}`:k}t(zrt,"getTagFileNameWithoutExtension");function Iwe(...l){return zrt(...l)}t(Iwe,"getTagImportPath");function vle(...l){return`${zrt(...l)}.ts`}t(vle,"getTagFileName");var vd=t(({type:l,tag:u,options:m})=>`${Ip(u)}${m.configs[l].namespaceSuffix}`,"getNamespaceName");function Vrt(l){return l.standalone?`${t6(l)}${ule.fileName}`:l.restClientImportPath}t(Vrt,"getAppRestClientImportPath");function Urt(l){return l.standalone?`${t6(l)}${lle.reactQueryTypes.fileName}`:l.queryTypesImportPath}t(Urt,"getQueryTypesImportPath");function Wrt(l){return`${t6(l)}${fle.fileName}`}t(Wrt,"getQueryModulesImportPath");function Hrt(l){return`${t6(l)}${_le.fileName}`}t(Hrt,"getMutationEffectsImportPath");function Grt(l){return`${t6(l)}${ale.fileName}`}t(Grt,"getAclCheckImportPath");function Zrt(l){return`${t6(l)}${ple.fileName}`}t(Zrt,"getZodExtendedImportPath");function Qrt(l){return`${t6(l)}${sle.fileName}`}t(Qrt,"getAppAbilitiesImportPath");function Xrt(l){return Gy(l).with("string",()=>"string").with("number",()=>"number").with("integer",()=>"number").with("boolean",()=>"boolean").exhaustive()}t(Xrt,"primitiveTypeToTsType");var NW=t(l=>HA(ty(l.operationName)),"getEndpointName");function Krt(l,u){return`${u.tsNamespaces?`${vd({type:"endpoints",tag:t3(l,u),options:u})}.`:""}${NW(l)}`}t(Krt,"getImportedEndpointName");var ent=t(l=>l.method!==Yrt.OpenAPIV3.HttpMethods.GET,"requiresBody"),ble=t(l=>l.parameters.find(u=>u.type==="Body"),"getEndpointBody"),tnt=t((l,u)=>{let m=Nwe(l),b=u.options.axiosRequestConfig;return Object.keys(m).length>0||b},"hasEndpointConfig"),rnt=t(l=>l.path.replace(/:([a-zA-Z0-9_]+)/g,"${$1}"),"getEndpointPath");function t3(l,u){var b;let m=u.splitByTags?(b=l.tags)==null?void 0:b[0]:u.defaultTag;return QA(m??u.defaultTag)}t(t3,"getEndpointTag");function GA(l,u,m){let b=u.parameters.map(k=>{var L,Z,oe,re;let I="string";if(Zy(k.zodSchema))I=v8(l,k.zodSchema);else if((L=k.parameterObject)!=null&&L.schema&&ey(k.parameterObject.schema)){let me=(oe=(Z=k.parameterObject)==null?void 0:Z.schema)==null?void 0:oe.type;me&&d8(me)&&(I=Xrt(me))}return{name:JA(k.name),type:I,paramType:k.type,required:((re=k.parameterObject)==null?void 0:re.required)??!0,parameterObject:k.parameterObject,bodyObject:k.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((k,I)=>{if(k.required===I.required){let L=["Path","Body","Query","Header"];return L.indexOf(k.paramType)-L.indexOf(I.paramType)}return k.required?-1:1}).filter(k=>(!(m!=null&&m.excludeBodyParam)||k.name!==Yce)&&(!(m!=null&&m.excludePageParam)||k.name!==gW.pageParamName)&&(!(m!=null&&m.includeOnlyRequiredParams)||k.required)).map(k=>({...k,name:m!=null&&m.replacePageParam&&k.name===gW.pageParamName?"pageParam":k.name,required:k.required&&(k.paramType==="Path"||!(m!=null&&m.pathParamsRequiredOnly))}))}t(GA,"mapEndpointParamsToFunctionParams");function Nwe(l){let u=l.parameters.filter(k=>k.type==="Query").map(k=>{let I=Ztt(k.name)?k.name:`"${k.name}"`,L=JA(k.name);return{...k,name:I,value:L}}),m={};return l.requestFormat!==cwe["Content-Type"]&&(m["Content-Type"]=`'${l.requestFormat}'`),l.responseFormat&&l.responseFormat!==cwe.Accept&&(m.Accept=`'${l.responseFormat}'`),l.parameters.filter(k=>k.type==="Header").forEach(k=>{m[k.name]=JA(k.name)}),{...u.length>0?{params:u}:{},...Object.keys(m).length?{headers:m}:{}}}t(Nwe,"getEndpointConfig");function nnt(l,u){return u.filter(m=>Ab(m)&&m.parameters.filter(b=>{var k;return(k=b.parameterObject)==null?void 0:k.required}).every(b=>l.parameters.some(k=>k.name===b.name))&&m.response===l.response)}t(nnt,"getUpdateQueryEndpoints");var Owe=["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 S8(l,u){let m={};return Object.keys(l).forEach(b=>{u.includes(b)&&(m[b]=l[b])}),m}t(S8,"pick");function int(l,...u){if(u.length===0)return l;let m=l;for(let b of u)m=snt(m,b);return m}t(int,"deepMerge");function snt(l,u){if(u==null)return l;if(l==null)return iR(u);if(Array.isArray(l)&&Array.isArray(u))return[...l,...u];if(OW(l)&&OW(u)){let m={};for(let[b,k]of Object.entries(l))m[b]=iR(k);for(let[b,k]of Object.entries(u)){let I=m[b];k!==void 0&&(k===null?m[b]=k:OW(I)&&OW(k)?m[b]=snt(I,k):Array.isArray(I)&&Array.isArray(k)?m[b]=[...I,...k]:m[b]=iR(k))}return m}return iR(u)}t(snt,"mergeTwoValues");function iR(l){if(l==null||typeof l!="object")return l;if(Array.isArray(l))return l.map(u=>iR(u));if(OW(l)){let u={};for(let[m,b]of Object.entries(l))u[m]=iR(b);return u}return l}t(iR,"deepClone");function OW(l){return l!==null&&typeof l=="object"&&!Array.isArray(l)&&Object.prototype.toString.call(l)==="[object Object]"}t(OW,"isPlainObject");function sR(l,u){let m=l.deprecated&&!u.withDeprecatedEndpoints,b=XA(l,u),k=mrt(b,u);return m||k}t(sR,"isOperationExcluded");function Fwe({path:l,method:u,operation:m,options:b,tag:k,keepOperationTag:I,keepOperationPrefix:L}){let Z=`${u}${frt(l)}`,oe=m.operationId?JA(m.operationId):Z;if(b.removeOperationPrefixEndingWith&&L)oe=oe.split(b.removeOperationPrefixEndingWith).map((me,ke)=>ke===0?me:Ip(me)).join("");else if(b.removeOperationPrefixEndingWith&&!L){let re=new RegExp(`^.*${b.removeOperationPrefixEndingWith}`);oe=oe.replace(re,"")}if(b.tsNamespaces&&!I){let re=art(oe,k);re===""?oe=u.toLowerCase():Owe.includes(re)||(oe=re)}return Owe.includes(oe)?Z:oe}t(Fwe,"getOperationName");function FW({operationsByTag:l,...u}){let{operation:m,options:b}=u,k=b.splitByTags?XA(m,b):b.defaultTag,I=t(L=>{let Z=Fwe({...u,tag:k,keepOperationTag:L});if(l[k].filter(re=>Fwe({...u,operation:re,tag:k,keepOperationTag:L})===Z).length===1)return Z},"operationName");return I()??I(!0)??Fwe({...u,tag:k,keepOperationTag:!0,keepOperationPrefix:!0})}t(FW,"getUniqueOperationName");function ant(l,u,m){let b=[];for(let k in l.paths){if(m8(k,m))continue;let I=l.paths[k],L=S8(I,_8);for(let Z in L){let oe=L[Z];if(!oe||sR(oe,m))continue;let re=FW({path:k,method:Z,operation:oe,operationsByTag:u,options:m});b.push(re)}}return b}t(ant,"getUniqueOperationNamesWithoutSplitByTags");function ont(l,u){let m={};for(let b in l.paths){if(m8(b,u))continue;let k=l.paths[b],I=S8(k,_8);for(let L in I){let Z=I[L];if(!Z||sR(Z,u))continue;let oe=u.splitByTags?XA(Z,u):u.defaultTag;m[oe]||(m[oe]=[]),m[oe].push(Z)}}return m}t(ont,"getOperationsByTag");function MW(l){return{type:"invalid-schema",message:l}}t(MW,"getInvalidSchemaError");function cnt(l){return{type:"invalid-operation-id",message:`Operation ${l}`}}t(cnt,"getInvalidOperationIdError");function lnt(l,u){return{type:"missing-path-parameter",message:`Path ${u} is missing [${l.map(({name:m})=>m).join(", ")}]`}}t(lnt,"getMissingPathParameterError");function unt(l){return{type:"not-allowed-inline-enum",message:`${l} is missing @IsEnum() and @ApiProperty(enum:, enumName:)`}}t(unt,"getNotAllowedInlineEnumError");function fnt(l,u,m){return{type:"missing-acl-condition-property",message:`Condition property ${l} is not found in parameters or body in operation ${xle(u,m)}`}}t(fnt,"getMissingAclConditionPropertyError");function Mwe(l,u,m){return{type:"missing-status-code",message:`Missing HTTP status code ${Sle(l)} in operation ${xle(u,m)}`}}t(Mwe,"getMissingStatusCodeError");function _nt(l,u,m){return{type:"invalid-status-code",message:`Operation ${xle(u,m)} expected HTTP status code ${Sle(l.expected)} but received ${Sle(l.received)}`}}t(_nt,"getInvalidStatusCodeError");function pnt(l,u,m){return{type:"multiple-success-status-codes",message:`Operation ${xle(u,m)} has multiple success HTTP status codes: ${l.map(Sle).join(", ")}`}}t(pnt,"getMultipleSuccessStatusCodesError");function xle(l,u){return l.operationId??`${u.method} ${u.path}`}t(xle,"getOperationDescriptor");function Sle(l){return`${l} (${Utt[l]})`}t(Sle,"getStatusCodeDescription");function dnt(l){return l.reduce((u,m)=>({...u,[m.type]:[...u[m.type]??[],m.message]}),{})}t(dnt,"groupByType");function FC({schema:l,meta:u,options:m}){let b=[];Gy(l.type).with("string",()=>b.push(AVt(l))).with("number","integer",()=>b.push(DVt(l))).with("array",()=>b.push(IVt(l))).otherwise(()=>{}),typeof l.description=="string"&&l.description!==""&&m.withDescription&&([`
525
+ `);return I!==-1&&(u=aZe(u,k,b,I)),b+u+k},"applyStyle");Object.defineProperties(CU.prototype,pM);var yXt=CU(),vXt=CU({level:cZe?cZe.level:0});var xA=new qoe;function hEe(l){console.log(l)}t(hEe,"log");function oS(l){console.log(`[INFO] ${l}`)}t(oS,"logInfo");function EU(l){console.log(xA.green(`[SUCCESS] ${l}`))}t(EU,"logSuccess");function VN(l,u){l instanceof Error?console.log(xA.red(`[ERROR] ${u||l.message}`)):console.log(xA.red(`[ERROR] ${l}`))}t(VN,"logError");function Voe(l){console.log(xA.bgYellow(`==== ${l} ====`))}t(Voe,"logBanner");var fZe=Zm(require("fs"));function dM(){return"1.1.2"}t(dM,"getVersion");var NXt=Zm(pZe());var gEe=Symbol("options_key");function Ju(l){return(u,m)=>{var b,k;if(l!=null){let I={...Reflect.getMetadata(gEe,u)||{},[m]:{...l,describe:l.envAlias?`${l.describe||""} [${l.envAlias}]`:l.describe,type:l.type||((k=(b=Reflect.getMetadata("design:type",u,m))==null?void 0:b.name)==null?void 0:k.toLowerCase())}};Reflect.defineMetadata(gEe,I,u)}}}t(Ju,"YargOption");function dZe(l){let u=Reflect.getMetadata(gEe,l.prototype);if(!u)throw new Error(`Options for ${l.name} were not defined`);return u}t(dZe,"getYargsOption");function Uoe(l){return async u=>u.options(v5t(l)).middleware(async m=>await b5t(l,m),!0)}t(Uoe,"getBuilder");function v5t(l){return Object.entries(dZe(l)).reduce((u,[m,b])=>(u[m]=Object.fromEntries(Object.entries(b).filter(([k])=>!["envAlias","default"].includes(k))),u),{})}t(v5t,"getYargsOptions");async function b5t(l,u){let m=new l;for(let[b,k]of Object.entries(dZe(l)))m[b]=u[b]??k.default;return m}t(b5t,"loadYargsConfig");var qnt=Zm(owe());var Utt={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"},Wtt={"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 Yrt=Zm(Htt());var lT={query:"useQuery",infiniteQuery:"useInfiniteQuery",mutation:"useMutation"},Gtt={bindings:[lT.query,lT.infiniteQuery,lT.mutation],from:"@tanstack/react-query"},gW={pageParamName:"page"},Xce={pageParamName:"page",totalItemsName:"totalItems",limitParamName:"limit"},yW="moduleName";var cwe={"Content-Type":"application/json",Accept:"application/json"},Yce="data",lwe="axios",$A="config",AC="AxiosRequestConfig",Kce={defaultImport:lwe,bindings:[AC],from:"axios"};var Ztt=t(l=>/^(?:[a-zA-Z_$][a-zA-Z0-9_$]*|[0-9]+)$/.test(l),"isValidPropertyName"),JA=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 Vf(l){return l!=null&&Object.prototype.hasOwnProperty.call(l,"$ref")}t(Vf,"isReferenceObject");function ey(l){return!Vf(l)}t(ey,"isSchemaObject");function ele(l){return l.type==="array"}t(ele,"isArraySchemaObject");function Qtt(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((k,I)=>{if(gVt(I)){let L=I.required;k[0].push(...L??[])}else k[1].push(I);return k},[[],[]]),b={properties:u.reduce((k,I)=>(k[I]={},k),{}),type:"object",required:u};return{noRequiredOnlyAllof:m,composedRequiredSchema:b,patchRequiredSchemaInLoop:t((k,I)=>{if(Vf(k)){let L=I(k.$ref);L&&b.required.forEach(Z=>{var oe;b.properties[Z]=((oe=L==null?void 0:L.properties)==null?void 0:oe[Z])??{}})}else{let L=k.properties??{};b.required.forEach(Z=>{L[Z]&&(b.properties[Z]=L[Z]??{})})}},"patchRequiredSchemaInLoop")}}t(Qtt,"inferRequiredSchema");var gVt=t(l=>!Vf(l)&&!!l.required&&!l.type&&!l.properties&&!(l!=null&&l.allOf)&&!(l!=null&&l.anyOf)&&!l.oneOf,"isBrokenAllOfItem");var e6=Symbol.for("@ts-pattern/matcher"),yVt=Symbol.for("@ts-pattern/isVariadic"),rle="@ts-pattern/anonymous-select-key",uwe=t(l=>!!(l&&typeof l=="object"),"r"),tle=t(l=>l&&!!l[e6],"i"),NC=t((l,u,m)=>{if(tle(l)){let b=l[e6](),{matched:k,selections:I}=b.match(u);return k&&I&&Object.keys(I).forEach(L=>m(L,I[L])),k}if(uwe(l)){if(!uwe(u))return!1;if(Array.isArray(l)){if(!Array.isArray(u))return!1;let b=[],k=[],I=[];for(let L of l.keys()){let Z=l[L];tle(Z)&&Z[yVt]?I.push(Z):I.length?k.push(Z):b.push(Z)}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+k.length)return!1;let L=u.slice(0,b.length),Z=k.length===0?[]:u.slice(-k.length),oe=u.slice(b.length,k.length===0?1/0:-k.length);return b.every((re,me)=>NC(re,L[me],m))&&k.every((re,me)=>NC(re,Z[me],m))&&(I.length===0||NC(I[0],oe,m))}return l.length===u.length&&l.every((L,Z)=>NC(L,u[Z],m))}return Reflect.ownKeys(l).every(b=>{let k=l[b];return(b in u||tle(I=k)&&I[e6]().matcherType==="optional")&&NC(k,u[b],m);var I})}return Object.is(u,l)},"s"),WA=t(l=>{var u,m,b;return uwe(l)?tle(l)?(u=(m=(b=l[e6]()).getSelectionKeys)==null?void 0:m.call(b))!=null?u:[]:Array.isArray(l)?bW(l,WA):bW(Object.values(l),WA):[]},"o"),bW=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=>bVt(l,u),"or"),select:t(u=>u===void 0?Xtt(l):Xtt(u,l),"select")})}t(pS,"u");function vVt(l){return pS({[e6]:()=>({match:t(u=>{let m={},b=t((k,I)=>{m[k]=I},"r");return u===void 0?(WA(l).forEach(k=>b(k,void 0)),{matched:!0,selections:m}):{matched:NC(l,u,b),selections:m}},"match"),getSelectionKeys:t(()=>WA(l),"getSelectionKeys"),matcherType:"optional"})})}t(vVt,"h");function Zp(...l){return pS({[e6]:()=>({match:t(u=>{let m={},b=t((k,I)=>{m[k]=I},"r");return{matched:l.every(k=>NC(k,u,b)),selections:m}},"match"),getSelectionKeys:t(()=>bW(l,WA),"getSelectionKeys"),matcherType:"and"})})}t(Zp,"m");function bVt(...l){return pS({[e6]:()=>({match:t(u=>{let m={},b=t((k,I)=>{m[k]=I},"r");return bW(l,WA).forEach(k=>b(k,void 0)),{matched:l.some(k=>NC(k,u,b)),selections:m}},"match"),getSelectionKeys:t(()=>bW(l,WA),"getSelectionKeys"),matcherType:"or"})})}t(bVt,"d");function Af(l){return{[e6]:()=>({match:t(u=>({matched:!!l(u)}),"match")})}}t(Af,"p");function Xtt(...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({[e6]:()=>({match:t(b=>{let k={[u??rle]:b};return{matched:m===void 0||NC(m,b,(I,L)=>{k[I]=L}),selections:k}},"match"),getSelectionKeys:t(()=>[u??rle].concat(m===void 0?[]:WA(m)),"getSelectionKeys")})})}t(Xtt,"y");function DC(l){return typeof l=="number"}t(DC,"v");function qA(l){return typeof l=="string"}t(qA,"b");function zA(l){return typeof l=="bigint"}t(zA,"w");var Yrr=pS(Af(function(l){return!0}));var VA=t(l=>Object.assign(pS(l),{startsWith:t(u=>{return VA(Zp(l,(m=u,Af(b=>qA(b)&&b.startsWith(m)))));var m},"startsWith"),endsWith:t(u=>{return VA(Zp(l,(m=u,Af(b=>qA(b)&&b.endsWith(m)))));var m},"endsWith"),minLength:t(u=>VA(Zp(l,(m=>Af(b=>qA(b)&&b.length>=m))(u))),"minLength"),length:t(u=>VA(Zp(l,(m=>Af(b=>qA(b)&&b.length===m))(u))),"length"),maxLength:t(u=>VA(Zp(l,(m=>Af(b=>qA(b)&&b.length<=m))(u))),"maxLength"),includes:t(u=>{return VA(Zp(l,(m=u,Af(b=>qA(b)&&b.includes(m)))));var m},"includes"),regex:t(u=>{return VA(Zp(l,(m=u,Af(b=>qA(b)&&!!b.match(m)))));var m},"regex")}),"j"),Krr=VA(Af(qA)),IC=t(l=>Object.assign(pS(l),{between:t((u,m)=>IC(Zp(l,((b,k)=>Af(I=>DC(I)&&b<=I&&k>=I))(u,m))),"between"),lt:t(u=>IC(Zp(l,(m=>Af(b=>DC(b)&&b<m))(u))),"lt"),gt:t(u=>IC(Zp(l,(m=>Af(b=>DC(b)&&b>m))(u))),"gt"),lte:t(u=>IC(Zp(l,(m=>Af(b=>DC(b)&&b<=m))(u))),"lte"),gte:t(u=>IC(Zp(l,(m=>Af(b=>DC(b)&&b>=m))(u))),"gte"),int:t(()=>IC(Zp(l,Af(u=>DC(u)&&Number.isInteger(u)))),"int"),finite:t(()=>IC(Zp(l,Af(u=>DC(u)&&Number.isFinite(u)))),"finite"),positive:t(()=>IC(Zp(l,Af(u=>DC(u)&&u>0))),"positive"),negative:t(()=>IC(Zp(l,Af(u=>DC(u)&&u<0))),"negative")}),"x"),enr=IC(Af(DC)),UA=t(l=>Object.assign(pS(l),{between:t((u,m)=>UA(Zp(l,((b,k)=>Af(I=>zA(I)&&b<=I&&k>=I))(u,m))),"between"),lt:t(u=>UA(Zp(l,(m=>Af(b=>zA(b)&&b<m))(u))),"lt"),gt:t(u=>UA(Zp(l,(m=>Af(b=>zA(b)&&b>m))(u))),"gt"),lte:t(u=>UA(Zp(l,(m=>Af(b=>zA(b)&&b<=m))(u))),"lte"),gte:t(u=>UA(Zp(l,(m=>Af(b=>zA(b)&&b>=m))(u))),"gte"),positive:t(()=>UA(Zp(l,Af(u=>zA(u)&&u>0))),"positive"),negative:t(()=>UA(Zp(l,Af(u=>zA(u)&&u<0))),"negative")}),"A"),tnr=UA(Af(zA)),rnr=pS(Af(function(l){return typeof l=="boolean"})),nnr=pS(Af(function(l){return typeof l=="symbol"})),inr=pS(Af(function(l){return l==null})),snr=pS(Af(function(l){return l!=null}));var dwe=class dwe 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(dwe,"W");var fwe=dwe,_we={matched:!1,value:void 0};function Gy(l){return new pwe(l,_we)}t(Gy,"z");var vW=class vW{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]],k;u.length===3&&typeof u[1]=="function"?k=u[1]:u.length>2&&b.push(...u.slice(1,u.length-1));let I=!1,L={},Z=t((re,me)=>{I=!0,L[re]=me},"a"),oe=!b.some(re=>NC(re,this.input,Z))||k&&!k(this.input)?_we:{matched:!0,value:m(I?rle in L?L[rle]:L:this.input,this.input)};return new vW(this.input,oe)}when(u,m){if(this.state.matched)return this;let b=!!u(this.input);return new vW(this.input,b?{matched:!0,value:m(this.input,this.input)}:_we)}otherwise(u){return this.state.matched?this.state.value:u(this.input)}exhaustive(){if(this.state.matched)return this.state.value;throw new fwe(this.input)}run(){return this.exhaustive()}returnType(){return this}};t(vW,"I");var pwe=vW;var mwe=2,Ytt=["application/octet-stream","multipart/form-data","application/x-www-form-urlencoded","*/*"],Ktt=["query","header","path"],_8=["get","put","post","delete","options","head","patch","trace"],ert=["string","number","integer","boolean"],SW=["allOf","anyOf","oneOf"];var Ip=t(l=>l.charAt(0).toUpperCase()+l.slice(1),"capitalize"),HA=t(l=>l.charAt(0).toLowerCase()+l.slice(1),"decapitalize"),trt=t(l=>l.replace(/(-\w)/g,u=>u[1].toUpperCase()),"kebabToCamel"),ty=t(l=>l.replace(/(_\w)/g,u=>u[1].toUpperCase()),"snakeToCamel"),rrt=t(l=>l.replace(/[\W_]+(\w)?/g,(u,m)=>(m==null?void 0:m.toUpperCase())??""),"nonWordCharactersToCamel"),hwe=t((l,u="")=>l.endsWith(u)?l:`${l}${u}`,"suffixIfNeeded"),nrt=t((l,u)=>l.replace(new RegExp(`${u}$`),""),"removeSuffix"),SVt=t(l=>{var b;let u=l.reduce((k,I)=>({...k,[I]:(k[I]??0)+1}),{});return(b=Object.entries(u).sort((k,I)=>k[1]===I[1]?I[0].length-k[0].length:I[1]-k[1])[0])==null?void 0:b[0]},"getLongestMostCommon"),gwe=t(l=>{let u=l.map(Ip).map(irt).map(m=>xVt(m)).flat();return SVt(u)},"getMostCommonAdjacentCombinationSplit"),irt=t(l=>l.split(/(?<![A-Z])(?=[A-Z])/).filter(Boolean),"splitByUppercase"),srt=t(l=>irt(l).join(" "),"camelToSpaceSeparated"),xVt=t((l,u=["dto","by","for","of","in","to","and","with"])=>{var b;let m=[];for(let k=0;k<l.length;k++)if(!u.includes(l[k].toLowerCase()))for(let I=k+1;I<=l.length;I++)u.includes((b=l[I-1])==null?void 0:b.toLowerCase())||m.push(l.slice(k,I).join(""));return m},"getAdjacentStringCombinations"),art=t((l,u)=>{let m=u.replace(/es$|s$/g,""),b=new RegExp(`(${HA(m)}|${Ip(m)})[a-z]*(?=$|[A-Z])`,"g");return l.replace(b,"")},"removeWord");var crt=t(l=>`#/components/schemas/${l}`,"getSchemaRef"),p8=t(l=>l[1]==="/"?l:"#/"+l.slice(1),"autocorrectRef"),KM=t(l=>p8(l).split("/").at(-1),"getSchemaNameByRef");function vwe(l){let u=TVt(l).normalize("NFKD").trim().replace(/\s+/g,"_").replace(/--+/g,"-").replace(/-+/g,"_").replace(/[^\w-]+/g,"_");return ty(u)}t(vwe,"normalizeString");function bwe(l){return/^[a-zA-Z]\w*$/.test(l)?l:`"${l}"`}t(bwe,"wrapWithQuotesIfNeeded");function lrt(l){return typeof l=="string"&&l.startsWith('"')&&l.endsWith('"')?l.slice(1,-1):l}t(lrt,"unwrapQuotesIfNeeded");function TVt(l){let u=Number(l[0]);return typeof u=="number"&&!Number.isNaN(u)?"_"+l:l}t(TVt,"prefixStringStartingWithNumberIfNeeded");function Swe(l){let u=l.replaceAll("_","#");return ty(u.replaceAll("-","_")).replaceAll("#","_")}t(Swe,"pathParamToVariableName");var d8=t(l=>ert.includes(l),"isPrimitiveType");function urt(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(),k=b.toString(16);return b<=255?`\\x${`00${k}`.slice(-2)}`:`\\u${`0000${k}`.slice(-4)}`}).replace(/\//g,"\\/")}t(urt,"escapeControlCharacters");function OC(l){return l.includes("application/")&&l.includes("json")||Ytt.includes(l)||l.includes("text/")}t(OC,"isParamMediaTypeAllowed");function xW(l){return l>=200&&l<300}t(xW,"isMainResponseStatus");function nle(l){return!(l>=200&&l<300)}t(nle,"isErrorStatus");function ile(l){return l.startsWith("application/")}t(ile,"isMediaTypeAllowed");var ort=/({\w+})/g,kVt=/[^\w\-]+/g;function frt(l){l=Ip(trt(l.replaceAll("/","-")).replaceAll("-",""));let u=[...l.matchAll(ort)];if(u.length>0){let m=u.sort((b,k)=>b.index-k.index)[u.length-1][0];l=`${l.replace(ort,"")}By${Ip(m.slice(1,-1))}`}return l.replace(kVt,"_")}t(frt,"pathToVariableName");var ywe=/{(\b\w+(?:-\w+)*\b)}/g;function _rt(l){let u=l.match(ywe);return u===null?l.replaceAll(ywe,":$1"):(u.forEach(m=>{let b=Swe(m.replaceAll(ywe,":$1"));l=l.replaceAll(m,b)}),l)}t(_rt,"replaceHyphenatedPath");var prt=t(l=>{let u=l["x-enumNames"],m=Array.isArray(u)&&u.length>0,b=!!l.schema&&ey(l.schema)&&l.schema.type==="string";return m&&b},"isSortingParameterObject"),m8=t((l,u)=>u.excludePathRegex?new RegExp(u.excludePathRegex).test(l):!1,"isPathExcluded");var Ab=t(l=>l.method==="get","isQuery"),ZA=t(l=>l.method!=="get"||!!l.mediaDownload,"isMutation"),eR=t((l,u)=>Ab(l)&&(u??Object.values(gW)).every(m=>l.parameters.some(b=>b.name===m&&b.type==="Query")),"isInfiniteQuery"),drt=t((l,u,m)=>{let b=m.reduce((k,I)=>[...k,...GA(l,I,{includeOnlyRequiredParams:!0}).map(L=>L.name)],[]);return GA(l,u,{includeOnlyRequiredParams:!0,excludeBodyParam:!0}).filter(k=>b.includes(k.name)).map(k=>k.name)},"getDestructuredVariables");function QA(l){return rrt(l)}t(QA,"formatTag");function XA(l,u){var b;let m=(b=l.tags)==null?void 0:b[0];return QA(m??u.defaultTag)}t(XA,"getOperationTag");function mrt(l,u){return u.excludeTags.some(m=>m.toLowerCase()===l.toLowerCase())}t(mrt,"isTagExcluded");var sle={fileName:"acl/app.ability",extension:"ts"},TW="AppAbilities",ale={fileName:"acl/useAclCheck",extension:"ts"},YA="useAclCheck",ry={abilityTuple:"AbilityTuple",pureAbility:"PureAbility",forcedSubject:"ForcedSubject",subjectType:"Subject",subject:"subject"},xwe={bindings:[ry.abilityTuple,ry.pureAbility,ry.forcedSubject,ry.subjectType,ry.subject],from:"@casl/ability"};var kW="AppRestClient",ole={query:"AppQueryOptions",infiniteQuery:"AppInfiniteQueryOptions",mutation:"AppMutationOptions"},Twe="src/data",hrt="@/data",h8={appRestClient:"@/util/rest/clients/app-rest-client",queryTypes:"@/types/react-query",errorHandling:"@/util/vendor/error-handling",abilityContext:"@/data/acl/ability.context"},KA={ErrorHandler:"ErrorHandler",SharedErrorHandler:"SharedErrorHandler"},cle={bindings:[KA.ErrorHandler,KA.SharedErrorHandler],from:h8.errorHandling},kwe="AbilityContext",grt={bindings:[kwe],from:h8.abilityContext};var lle={reactQueryTypes:{fileName:"react-query.types",extension:"ts"},restClient:{fileName:"rest-client",extension:"ts"},restInterceptor:{fileName:"rest-interceptor",extension:"ts"}},ule={fileName:"app-rest-client",extension:"ts"},Cwe="QueryModule",fle={fileName:"queryModules",extension:"ts"},yrt={fileName:"queryConfig.context",extension:"tsx"},tR={optionsType:"MutationEffectsOptions",hookName:"useMutationEffects",runFunctionName:"runMutationEffects"},_le={fileName:"useMutationEffects",extension:"ts"},dS={namespace:"ZodExtended",exports:{parse:"parse",sortExp:"sortExp"}},ple={fileName:"zod.extended",extension:"ts"};var Db=t((...l)=>[...new Set(l.flat())],"getUniqueArray");var CW=t(l=>`canUse${Ip(ty(l.operationName))}`,"getAbilityFunctionName"),vrt=t((l,u)=>`${u.tsNamespaces?`${vd({type:"acl",tag:t3(l,u),options:u})}.`:""}${CW(l)}`,"getImportedAbilityFunctionName"),Ewe=t(l=>{var u;return(u=l.acl)==null?void 0:u[0].action},"getAbilityAction"),Pwe=t(l=>{var u;return(u=l.acl)==null?void 0:u[0].subject},"getAbilitySubject"),EW=t(l=>{var u;return!!((u=rR(l))!=null&&u.length)},"hasAbilityConditions"),rR=t(l=>{var u,m;return(m=(u=l.acl)==null?void 0:u[0].conditionsTypes)==null?void 0:m.sort((b,k)=>b.name.localeCompare(k.name))},"getAbilityConditionsTypes"),brt=t(l=>{var u;return(u=l.acl)==null?void 0:u[0].description},"getAbilityDescription"),wwe=t(l=>{var b;let u=Pwe(l),m=[`"${u??""}"`];return EW(l)&&m.push(`ForcedSubject<"${u}"> & { ${(b=rR(l))==null?void 0:b.map(k=>`${k.name}${k.required?"":"?"}: ${k.type??""}${k.zodSchemaName??""},`).join(" ")} }`),m},"getAbilitySubjectTypes");function Awe({resolver:l,data:u,tag:m=""}){var Z;let b=(Z=u.get(m))==null?void 0:Z.endpoints.filter(({acl:oe})=>oe&&oe.length>0);if(!b||b.length===0)return;let k=b.some(({acl:oe})=>(oe==null?void 0:oe[0].conditions)&&Object.keys(oe[0].conditions).length>0),I=b.reduce((oe,re)=>{var ke,et;let me=(et=(ke=re.acl)==null?void 0:ke[0].conditionsTypes)==null?void 0:et.reduce((At,nr)=>[...At,...nr!=null&&nr.zodSchemaName?[nr.zodSchemaName]:[]],[]);return[...oe,...me??[]]},[]),L=e3({resolver:l,tag:m,zodSchemasAsTypes:Db(I)});return{endpoints:b,hasAdditionalAbilityImports:k,modelsImports:L}}t(Awe,"getAclData");var Srt=t(({resolver:l,data:u})=>{let m=new Map,b=[],k=!1;u.forEach((Z,oe)=>{let re=Awe({resolver:l,data:u,tag:oe});if(!re)return;let{modelsImports:me,hasAdditionalAbilityImports:ke,endpoints:et}=re;b.push(me),k=k||ke,et.forEach(At=>{let nr=Ewe(At);nr&&m.set(nr,new Set([...m.get(nr)??[],...wwe(At)]))})});let I=Dwe(l.options,...b);return{appAbilitiesType:m.size>0?Object.fromEntries(Array.from(m.entries()).map(([Z,oe])=>[Z,Array.from(oe)])):void 0,modelsImports:I,hasAdditionalAbilityImports:k}},"getAppAbilitiesType");var xrt="Schema",Trt="Enum",krt="Body",Crt="Param",Ert="Response",Prt="ErrorResponse",PW="z.void()",dle="z.instanceof(Blob)",wW="z.enum",wrt="z.int()",Art="z.number()",mle="z.string()",Drt="z.email()",Irt="z.url()",Nrt="z.uuid()",Ort="z.iso.datetime({ offset: true })",nR={bindings:["z"],from:"zod"};function Z0(l,u){if(!l)return;let{data:m,onSchema:b}=u;if(Vf(l)&&b({type:"reference",schema:l,data:m})===!0)return;let k=l;if(SW.some(I=>I in k&&k[I])){let I=k.allOf??k.anyOf??k.oneOf??[];for(let L of I)(b==null?void 0:b({type:"composite",parentSchema:l,schema:L,data:m}))!==!0&&Z0(L,{data:m,onSchema:b})}if(k.properties)for(let[I,L]of Object.entries(k.properties))b({type:"property",parentSchema:l,schema:L,data:m,propertyName:I})!==!0&&Z0(L,u);if(k.additionalProperties&&typeof k.additionalProperties=="object"){if(b({type:"additionalProperties",parentSchema:l,schema:k.additionalProperties,data:m})===!0)return;Z0(k.additionalProperties,u)}if(k.type==="array"){let I=l.items;if(b({type:"array",parentSchema:l,schema:I,data:m})===!0)return;Z0(I,u)}}t(Z0,"iterateSchema");var g8=t((l,u)=>hwe(Ip(vwe(l)),u),"getZodSchemaName"),AW=t((l,u,m)=>hwe(Ip(vwe(l)),`${u}${m}`),"getEnumZodSchemaName"),Zy=t(l=>["z.",`${dS.namespace}.`].every(u=>!l.startsWith(u)),"isNamedZodSchema"),Frt=t(l=>l.startsWith(wW),"isEnumZodSchema"),y8=t((l,u,m)=>u?l:`${m}_${l}`,"getZodSchemaOperationName"),hle=t(l=>ty(`${l}_${krt}`),"getBodyZodSchemaName"),Mrt=t((l,u)=>ty(`${l}_${u}${Crt}`),"getParamZodSchemaName"),CVt=t(l=>ty(`${l}${Ert}`),"getMainResponseZodSchemaName"),EVt=t((l,u)=>ty(`${l}_${u}_${Prt}`),"getErrorResponseZodSchemaName");function gle({statusCode:l,operationName:u,isUniqueOperationName:m,tag:b}){let k=Number(l),I=y8(u,m,b);return!xW(k)&&l!=="default"&&nle(k)?EVt(I,l):CVt(I)}t(gle,"getResponseZodSchemaName");function DW(l){return["minimum","exclusiveMinimum","maximum","exclusiveMaximum","minItems","minLength","minProperties","maxItems","maxLength","maxProperties","default","example"].filter(b=>l[b]).reduce((b,k)=>[...b,`${Ip(srt(k))}: \`${l[k]}\``],[])}t(DW,"getSchemaDescriptions");var IW=t((l,u)=>nrt(l,u.schemaSuffix),"getZodSchemaInferedTypeName"),Rrt=t((l,u)=>Zy(u)?`${l.options.tsNamespaces?`${vd({type:"models",tag:l.getTagByZodSchemaName(u),options:l.options})}.`:""}${u}`:u,"getImportedZodSchemaName"),v8=t((l,u,m)=>{if(!Zy(u))return u===PW?"void":u;let b=l.getTagByZodSchemaName(u);return`${l.options.tsNamespaces&&b!==m?`${vd({type:"models",tag:b,options:l.options})}.`:""}${IW(u,l.options)}`},"getImportedZodSchemaInferedTypeName");function Lrt(l){var u;return l.isEnum?"enum":((u=l.schemaObj)==null?void 0:u.type)??"object"}t(Lrt,"getZodSchemaType");function jrt(l){if(l.schemaObj)return[l.schemaObj.description,...DW(l.schemaObj)].filter(Boolean).join(". ")}t(jrt,"getZodSchemaDescription");function Brt(l,u,m){var b;if(Vf(u)){let k=l.getZodSchemaNameByRef(u.$ref);return k?v8(l,k,m):void 0}if(ele(u)){if(!Vf(u.items))return`${((b=u.items)==null?void 0:b.type)??"unknown"}[]`;let k=l.getZodSchemaNameByRef(u.items.$ref);return k?`${v8(l,k,m)}[]`:void 0}if(SW.some(k=>k in u&&u[k])){let k=u.allOf??u.anyOf??u.oneOf??[];if(k.length>0)return Brt(l,k[0],m)}return u.type}t(Brt,"getType");function $rt(l,u,m){if(!u.schemaObj)return[];let b="[0]",k="[key]",I={},L=t(Z=>{var re;if(Z.type==="reference")return!0;if(Z.type==="composite")return;let oe=[...((re=Z.data)==null?void 0:re.pathSegments)??[]];if(Z.type==="array"?oe.push(b):Z.type==="property"?oe.push(Z.propertyName):Z.type==="additionalProperties"&&oe.push(k),Z.schema&&oe[oe.length-1]!==b){let me=l.resolveObject(Z.schema),ke=[me.description,...DW(me)].filter(Boolean),et=oe.join(".");I[et]&&"type"in Z.schema&&Z.schema.type==="object"||(delete I[et],I[et]={type:Brt(l,Z.schema,m)??"unknown",description:ke.join(". ")})}return Z0(Z.schema,{data:{pathSegments:[...oe]},onSchema:L}),!0},"onSchema");return"allOf"in u.schemaObj&&u.schemaObj.allOf&&u.schemaObj.allOf.forEach(Z=>{if(Vf(Z)){let oe=l.resolveObject(Z);Z0(oe,{data:{pathSegments:[]},onSchema:L})}}),Z0(u.schemaObj,{data:{pathSegments:[]},onSchema:L}),I}t($rt,"getZodSchemaPropertyDescriptions");function e3({resolver:l,tag:u,zodSchemas:m=[],zodSchemasAsTypes:b=[]}){let k="models",I=t(oe=>l.getTagByZodSchemaName(oe),"getTag"),L=yle({type:k,tag:u,entities:m,getTag:I,getEntityName:t(oe=>oe,"getEntityName"),options:l.options}),Z=yle({type:k,tag:u,entities:b,getTag:I,getEntityName:t(oe=>IW(oe,l.options),"getEntityName"),options:l.options});return Dwe(l.options,L,Z)}t(e3,"getModelsImports");function Jrt({tag:l,endpoints:u,options:m}){return yle({type:"endpoints",tag:l,entities:u,getTag:t(b=>t3(b,m),"getTag"),getEntityName:NW,options:m})}t(Jrt,"getEndpointsImports");function qrt({tag:l,endpoints:u,options:m}){return yle({type:"acl",tag:l,entities:u,getTag:t(b=>t3(b,m),"getTag"),getEntityName:CW,options:m})}t(qrt,"getAclImports");function t6(l){let u=l.tsPath;return l.importPath==="relative"?u="../":l.importPath==="absolute"?u=l.output:new RegExp(`${Twe}`,"g").test(l.output)&&(u=l.output.replace(new RegExp(`.*${Twe}`,"g"),l.tsPath)),`${u}/`.replace(/\/\//g,"/")}t(t6,"getImportPath");function yle({type:l="models",tag:u,entities:m,getTag:b,getEntityName:k,options:I}){let L=new Map;return m.forEach(Z=>{let oe=b(Z);if(L.has(oe))I.tsNamespaces||L.get(oe).bindings.push(k(Z));else{let re=u===oe;L.set(oe,{bindings:[I.tsNamespaces?vd({type:l,tag:oe,options:I}):k(Z)],from:`${re?"./":t6(I)}${Iwe({type:l,tag:oe,includeTagDir:!re,options:I})}`})}}),Array.from(L.values())}t(yle,"getImports");function Dwe(l,...u){let m=new Map;return u.forEach(b=>{b.forEach(k=>{m.has(k.from)?l.tsNamespaces||m.get(k.from).bindings.push(...k.bindings):m.set(k.from,k)})}),Array.from(m.values()).map(b=>({...b,bindings:Db(b.bindings)}))}t(Dwe,"mergeImports");function b8({fileName:l,extension:u}){return`${l}.${u}`}t(b8,"getFileNameWithExtension");function zrt({type:l,tag:u,options:m,includeTagDir:b=!0}){let k=m.configs[l].outputFileNameSuffix;return u?`${b?`${HA(u)}/`:""}${HA(u)}.${k}`:k}t(zrt,"getTagFileNameWithoutExtension");function Iwe(...l){return zrt(...l)}t(Iwe,"getTagImportPath");function vle(...l){return`${zrt(...l)}.ts`}t(vle,"getTagFileName");var vd=t(({type:l,tag:u,options:m})=>`${Ip(u)}${m.configs[l].namespaceSuffix}`,"getNamespaceName");function Vrt(l){return l.standalone?`${t6(l)}${ule.fileName}`:l.restClientImportPath}t(Vrt,"getAppRestClientImportPath");function Urt(l){return l.standalone?`${t6(l)}${lle.reactQueryTypes.fileName}`:l.queryTypesImportPath}t(Urt,"getQueryTypesImportPath");function Wrt(l){return`${t6(l)}${fle.fileName}`}t(Wrt,"getQueryModulesImportPath");function Hrt(l){return`${t6(l)}${_le.fileName}`}t(Hrt,"getMutationEffectsImportPath");function Grt(l){return`${t6(l)}${ale.fileName}`}t(Grt,"getAclCheckImportPath");function Zrt(l){return`${t6(l)}${ple.fileName}`}t(Zrt,"getZodExtendedImportPath");function Qrt(l){return`${t6(l)}${sle.fileName}`}t(Qrt,"getAppAbilitiesImportPath");function Xrt(l){return Gy(l).with("string",()=>"string").with("number",()=>"number").with("integer",()=>"number").with("boolean",()=>"boolean").exhaustive()}t(Xrt,"primitiveTypeToTsType");var NW=t(l=>HA(ty(l.operationName)),"getEndpointName");function Krt(l,u){return`${u.tsNamespaces?`${vd({type:"endpoints",tag:t3(l,u),options:u})}.`:""}${NW(l)}`}t(Krt,"getImportedEndpointName");var ent=t(l=>l.method!==Yrt.OpenAPIV3.HttpMethods.GET,"requiresBody"),ble=t(l=>l.parameters.find(u=>u.type==="Body"),"getEndpointBody"),tnt=t((l,u)=>{let m=Nwe(l),b=u.options.axiosRequestConfig;return Object.keys(m).length>0||b},"hasEndpointConfig"),rnt=t(l=>l.path.replace(/:([a-zA-Z0-9_]+)/g,"${$1}"),"getEndpointPath");function t3(l,u){var b;let m=u.splitByTags?(b=l.tags)==null?void 0:b[0]:u.defaultTag;return QA(m??u.defaultTag)}t(t3,"getEndpointTag");function GA(l,u,m){let b=u.parameters.map(k=>{var L,Z,oe,re;let I="string";if(Zy(k.zodSchema))I=v8(l,k.zodSchema);else if((L=k.parameterObject)!=null&&L.schema&&ey(k.parameterObject.schema)){let me=(oe=(Z=k.parameterObject)==null?void 0:Z.schema)==null?void 0:oe.type;me&&d8(me)&&(I=Xrt(me))}return{name:JA(k.name),type:I,paramType:k.type,required:((re=k.parameterObject)==null?void 0:re.required)??!0,parameterObject:k.parameterObject,bodyObject:k.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((k,I)=>{if(k.required===I.required){let L=["Path","Body","Query","Header"];return L.indexOf(k.paramType)-L.indexOf(I.paramType)}return k.required?-1:1}).filter(k=>(!(m!=null&&m.excludeBodyParam)||k.name!==Yce)&&(!(m!=null&&m.excludePageParam)||k.name!==gW.pageParamName)&&(!(m!=null&&m.includeOnlyRequiredParams)||k.required)).map(k=>({...k,name:m!=null&&m.replacePageParam&&k.name===gW.pageParamName?"pageParam":k.name,required:k.required&&(k.paramType==="Path"||!(m!=null&&m.pathParamsRequiredOnly))}))}t(GA,"mapEndpointParamsToFunctionParams");function Nwe(l){let u=l.parameters.filter(k=>k.type==="Query").map(k=>{let I=Ztt(k.name)?k.name:`"${k.name}"`,L=JA(k.name);return{...k,name:I,value:L}}),m={};return l.requestFormat!==cwe["Content-Type"]&&(m["Content-Type"]=`'${l.requestFormat}'`),l.responseFormat&&l.responseFormat!==cwe.Accept&&(m.Accept=`'${l.responseFormat}'`),l.parameters.filter(k=>k.type==="Header").forEach(k=>{m[k.name]=JA(k.name)}),{...u.length>0?{params:u}:{},...Object.keys(m).length?{headers:m}:{}}}t(Nwe,"getEndpointConfig");function nnt(l,u){return u.filter(m=>Ab(m)&&m.parameters.filter(b=>{var k;return(k=b.parameterObject)==null?void 0:k.required}).every(b=>l.parameters.some(k=>k.name===b.name))&&m.response===l.response)}t(nnt,"getUpdateQueryEndpoints");var Owe=["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 S8(l,u){let m={};return Object.keys(l).forEach(b=>{u.includes(b)&&(m[b]=l[b])}),m}t(S8,"pick");function int(l,...u){if(u.length===0)return l;let m=l;for(let b of u)m=snt(m,b);return m}t(int,"deepMerge");function snt(l,u){if(u==null)return l;if(l==null)return iR(u);if(Array.isArray(l)&&Array.isArray(u))return[...l,...u];if(OW(l)&&OW(u)){let m={};for(let[b,k]of Object.entries(l))m[b]=iR(k);for(let[b,k]of Object.entries(u)){let I=m[b];k!==void 0&&(k===null?m[b]=k:OW(I)&&OW(k)?m[b]=snt(I,k):Array.isArray(I)&&Array.isArray(k)?m[b]=[...I,...k]:m[b]=iR(k))}return m}return iR(u)}t(snt,"mergeTwoValues");function iR(l){if(l==null||typeof l!="object")return l;if(Array.isArray(l))return l.map(u=>iR(u));if(OW(l)){let u={};for(let[m,b]of Object.entries(l))u[m]=iR(b);return u}return l}t(iR,"deepClone");function OW(l){return l!==null&&typeof l=="object"&&!Array.isArray(l)&&Object.prototype.toString.call(l)==="[object Object]"}t(OW,"isPlainObject");function sR(l,u){let m=l.deprecated&&!u.withDeprecatedEndpoints,b=XA(l,u),k=mrt(b,u);return m||k}t(sR,"isOperationExcluded");function Fwe({path:l,method:u,operation:m,options:b,tag:k,keepOperationTag:I,keepOperationPrefix:L}){let Z=`${u}${frt(l)}`,oe=m.operationId?JA(m.operationId):Z;if(b.removeOperationPrefixEndingWith&&L)oe=oe.split(b.removeOperationPrefixEndingWith).map((me,ke)=>ke===0?me:Ip(me)).join("");else if(b.removeOperationPrefixEndingWith&&!L){let re=new RegExp(`^.*${b.removeOperationPrefixEndingWith}`);oe=oe.replace(re,"")}if(b.tsNamespaces&&!I){let re=art(oe,k);re===""?oe=u.toLowerCase():Owe.includes(re)||(oe=re)}return Owe.includes(oe)?Z:oe}t(Fwe,"getOperationName");function FW({operationsByTag:l,...u}){let{operation:m,options:b}=u,k=b.splitByTags?XA(m,b):b.defaultTag,I=t(L=>{let Z=Fwe({...u,tag:k,keepOperationTag:L});if(l[k].filter(re=>Fwe({...u,operation:re,tag:k,keepOperationTag:L})===Z).length===1)return Z},"operationName");return I()??I(!0)??Fwe({...u,tag:k,keepOperationTag:!0,keepOperationPrefix:!0})}t(FW,"getUniqueOperationName");function ant(l,u,m){let b=[];for(let k in l.paths){if(m8(k,m))continue;let I=l.paths[k],L=S8(I,_8);for(let Z in L){let oe=L[Z];if(!oe||sR(oe,m))continue;let re=FW({path:k,method:Z,operation:oe,operationsByTag:u,options:m});b.push(re)}}return b}t(ant,"getUniqueOperationNamesWithoutSplitByTags");function ont(l,u){let m={};for(let b in l.paths){if(m8(b,u))continue;let k=l.paths[b],I=S8(k,_8);for(let L in I){let Z=I[L];if(!Z||sR(Z,u))continue;let oe=u.splitByTags?XA(Z,u):u.defaultTag;m[oe]||(m[oe]=[]),m[oe].push(Z)}}return m}t(ont,"getOperationsByTag");function MW(l){return{type:"invalid-schema",message:l}}t(MW,"getInvalidSchemaError");function cnt(l){return{type:"invalid-operation-id",message:`Operation ${l}`}}t(cnt,"getInvalidOperationIdError");function lnt(l,u){return{type:"missing-path-parameter",message:`Path ${u} is missing [${l.map(({name:m})=>m).join(", ")}]`}}t(lnt,"getMissingPathParameterError");function unt(l){return{type:"not-allowed-inline-enum",message:`${l} is missing @IsEnum() and @ApiProperty(enum:, enumName:)`}}t(unt,"getNotAllowedInlineEnumError");function fnt(l,u,m){return{type:"missing-acl-condition-property",message:`Condition property ${l} is not found in parameters or body in operation ${xle(u,m)}`}}t(fnt,"getMissingAclConditionPropertyError");function Mwe(l,u,m){return{type:"missing-status-code",message:`Missing HTTP status code ${Sle(l)} in operation ${xle(u,m)}`}}t(Mwe,"getMissingStatusCodeError");function _nt(l,u,m){return{type:"invalid-status-code",message:`Operation ${xle(u,m)} expected HTTP status code ${Sle(l.expected)} but received ${Sle(l.received)}`}}t(_nt,"getInvalidStatusCodeError");function pnt(l,u,m){return{type:"multiple-success-status-codes",message:`Operation ${xle(u,m)} has multiple success HTTP status codes: ${l.map(Sle).join(", ")}`}}t(pnt,"getMultipleSuccessStatusCodesError");function xle(l,u){return l.operationId??`${u.method} ${u.path}`}t(xle,"getOperationDescriptor");function Sle(l){return`${l} (${Utt[l]})`}t(Sle,"getStatusCodeDescription");function dnt(l){return l.reduce((u,m)=>({...u,[m.type]:[...u[m.type]??[],m.message]}),{})}t(dnt,"groupByType");function FC({schema:l,meta:u,options:m}){let b=[];Gy(l.type).with("string",()=>b.push(AVt(l))).with("number","integer",()=>b.push(IVt(l))).with("array",()=>b.push(NVt(l))).otherwise(()=>{}),typeof l.description=="string"&&l.description!==""&&m.withDescription&&([`
526
526
  `,"\r",`\r
527
- `].some(I=>String.prototype.includes.call(l.description,I))?b.push(`describe(\`${l.description}\`)`):b.push(`describe("${l.description}")`));let k=b.concat(PVt({schema:l,meta:u,options:m}),m.withDefaultValues!==!1?wVt(l):[]).filter(Boolean).join(".");return k?`.${k}`:""}t(FC,"getZodChain");function PVt({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(PVt,"getZodChainablePresence");function wVt(l){return l.default!==void 0?`default(${Gy(l.type).with("number","integer",()=>lrt(l.default)).otherwise(()=>JSON.stringify(l.default))})`:""}t(wVt,"getZodChainableDefault");function AVt(l){let u=[];return l.enum||(l.minLength!==void 0&&u.push(`min(${l.minLength})`),l.maxLength!==void 0&&u.push(`max(${l.maxLength})`)),u.join(".")}t(AVt,"getZodChainableStringValidations");function DVt(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(DVt,"getZodChainableNumberValidations");function IVt(l){let u=[];return l.minItems&&u.push(`min(${l.minItems})`),l.maxItems&&u.push(`max(${l.maxItems})`),u.join(".")}t(IVt,"getZodChainableArrayValidations");var x8=t(l=>l.reduce((u,m)=>u+m,0),"sum");function dg(l,u){if(!u)return l;if(Vf(u))return l+2;if(Array.isArray(u.type))return u.type.length===1?Ib("oneOf")+dg(l,{...u,type:u.type[0]}):l+Ib("oneOf")+x8(u.type.map(m=>dg(0,{...u,type:m})));if(u.oneOf)return u.oneOf.length===1?Ib("oneOf")+dg(l,u.oneOf[0]):l+Ib("oneOf")+x8(u.oneOf.map(m=>dg(0,m)));if(u.anyOf)return u.anyOf.length===1?Ib("anyOf")+dg(l,u.anyOf[0]):l+Ib("anyOf")+x8(u.anyOf.map(m=>dg(0,m)));if(u.allOf)return u.allOf.length===1?Ib("allOf")+dg(l,u.allOf[0]):l+Ib("allOf")+x8(u.allOf.map(m=>dg(0,m)));if(!u.type)return l;if(d8(u.type))return u.enum?l+mnt(u)+Ib("enum")+x8(u.enum.map(m=>dg(0,m))):l+mnt(u);if(u.type==="array")return u.items?Ib("array")+dg(l,u.items):Ib("array")+dg(l);if(u.type==="object"||u.properties||u.additionalProperties){if(u.properties){let m=Object.values(u.properties);l+=Ib("object")+x8(m.map(b=>dg(0,b)))}else l+=Ib("empty-object");u.additionalProperties&&(typeof u.additionalProperties=="object"?l+=dg(0,u.additionalProperties):l+=dg(1))}return l}t(dg,"getOpenAPISchemaComplexity");function mnt(l){return Gy(l.type).with("string","number","integer","boolean",()=>1).otherwise(()=>0)}t(mnt,"complexityByType");function Ib(l){return Gy(l).with("oneOf",()=>2).with("anyOf",()=>3).with("allOf",()=>2).with("enum","array","empty-object",()=>1).with("object",()=>2).otherwise(()=>0)}t(Ib,"complexityByComposite");var Lwe=class Lwe{constructor(u,m,b={referencedBy:[]},k){this.schema=u;this.resolver=m;Vf(u)&&(this.ref=u.$ref),k&&(this.enumRef=k),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 k=(L=this.resolver)==null?void 0:L.getTagByZodSchemaName(b);return m!=null&&m.tsNamespaces&&k&&k!==u?`${vd({type:"models",tag:k,options:m})}.${b}`:b}get complexity(){return dg(0,this.schema)}assign(u){return this.code=u,this}inherit(u){return u&&u.children.push(this),this}};t(Lwe,"ZodSchema");var RW=Lwe;function Rwe(l){var u,m;if(l)return(u=l.parent)!=null&&u.ref?l.parent.ref:Rwe((m=l.parent)==null?void 0:m.meta)}t(Rwe,"getParentRef");function hnt(l,u){let m=l.getRefByZodSchemaName(u);if(m){let k=Array.from(l.dependencyGraph.refsDependencyGraph[m]??[]).map(L=>l.getZodSchemaNameByRef(L)),I=l.getExtractedEnumZodSchemaNamesReferencedBySchemaRef(m);return[...k,...I]}let b=l.getCompositeZodSchemaByZodSchemaName(u);return b?Array.from(Tle(b)).map(k=>l.getZodSchemaNameByRef(k)):[]}t(hnt,"getZodSchemaRefs");function Tle(l,{skipObjectSchema:u=!1}={}){return l.children.reduce((b,k)=>{let I=k.ref??k.enumRef;return I&&b.add(I),k.children.length>0&&(!u||!ey(k.schema)||k.schema.type!=="object")&&Tle(k).forEach(L=>b.add(L)),b},new Set)}t(Tle,"getSchemaRefs");function Wd({schema:l,resolver:u,meta:m,tag:b}){var nr;let k=new RW(l,u,m),I={parent:k.inherit(m==null?void 0:m.parent),referencedBy:[...k.meta.referencedBy]},L={resolver:u,meta:I,tag:b};if(Vf(l))return NVt({schema:l,zodSchema:k,resolver:u,meta:I,tag:b});let Z=FVt({schema:l,zodSchema:k,resolver:u,meta:I,tag:b});if(Z)return Z;let oe=OVt({schema:l,zodSchema:k,resolver:u,meta:I,tag:b});if(oe)return oe;let re=MVt({schema:l,zodSchema:k,resolver:u,meta:I,tag:b});if(re)return re;let me=RVt({schema:l,zodSchema:k,resolver:u,meta:I,tag:b});if(me)return me;let ke=LVt({schema:l,zodSchema:k,resolver:u,meta:I,tag:b});if(ke)return ke;let et=u.options.allReadonly?".readonly()":"";if(ele(l))return l.items?k.assign(`z.array(${Wd({...L,schema:l.items}).getCodeString(b,u.options)}${FC({schema:l.items,meta:{...I,isRequired:!0},options:u.options})})${et}`):k.assign(`z.array(z.any())${et}`);let At=l.type?l.type.toLowerCase():void 0;if(At==="object"||l.properties||l.additionalProperties){let cr=l.required&&l.required.length>0,Jt=u.options.withImplicitRequiredProps?!1:l.properties&&!((nr=l.required)!=null&&nr.length),or="{}";l.properties&&(or=`{ ${Object.entries(l.properties).map(([zo,ei])=>{var Wt;let tf={...I,isRequired:Jt?!0:cr?(Wt=l.required)==null?void 0:Wt.includes(zo):u.options.withImplicitRequiredProps,name:zo,isParentPartial:Jt},zu=ei;if(Vf(ei)&&u&&(zu=u.getSchemaByRef(ei.$ref),!zu))throw new Error(`Schema ${ei.$ref} not found`);let ha=Wd({...L,schema:ei,meta:tf}),Sr=ha.getCodeString(b,u.options)+FC({schema:zu,meta:tf,options:u.options}),xs=!1,Fs=Rwe(m);return Fs&&(xs=[...Vf(ei)?[ei.$ref]:[],...Tle(ha,{skipObjectSchema:!0})].some(wa=>{var Co;return(Co=u.dependencyGraph.deepDependencyGraph[wa])==null?void 0:Co.has(Fs)})),[zo,Sr,xs]}).map(([zo,ei,tf])=>tf?`get ${bwe(zo)}() { return ${ei} }`:`${bwe(zo)}: ${ei}`).join(", ")} }`);let Qt="";l.additionalProperties&&(Qt=`.catchall(${typeof l.additionalProperties=="object"&&Object.keys(l.additionalProperties).length>0?Wd({...L,schema:l.additionalProperties}).getCodeString(b,u.options)+FC({schema:l.additionalProperties,meta:{...I,isRequired:!0},options:u.options}):"z.any()"})`);let Gn=`z.object(${or})${Jt?".partial()":""}${Qt}${et}`;return k.assign(Gn)}if(At==="any")return k.assign("z.any()");if(!At)return k.assign("z.unknown()");throw new Error(`Unsupported schema type: ${At}`)}t(Wd,"getZodSchema");function NVt({schema:l,zodSchema:u,resolver:m,meta:b,tag:k}){if(!Vf(l))return;let I=u.meta.referencedBy.slice(0,-1).map(oe=>oe.ref?m.getZodSchemaNameByRef(oe.ref)??oe.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 Z=m.getCodeByZodSchemaName(l.$ref);if(!Z){let oe=m.getSchemaByRef(l.$ref);if(!oe)throw new Error(`Schema ${l.$ref} not found`);Z=Wd({schema:oe,resolver:m,meta:b,tag:k}).getCodeString(k,m.options)}return m.getCodeByZodSchemaName(L)||m.setZodSchema(L,Z,k),u}t(NVt,"getReferenceZodSchema");function OVt({schema:l,zodSchema:u,resolver:m,meta:b,tag:k}){var L;if(!ey(l)||!l.oneOf)return;if(l.oneOf.length===1){let Z=Wd({schema:l.oneOf[0],resolver:m,meta:b,tag:k});return u.assign(Z.getCodeString(k,m.options))}let I=(L=l.oneOf)==null?void 0:L.some(Z=>ey(Z)&&((Z==null?void 0:Z.allOf)||[]).length>1);if(l.discriminator&&!I){let Z=l.discriminator.propertyName;return u.assign(`
527
+ `].some(I=>String.prototype.includes.call(l.description,I))?b.push(`describe(\`${l.description}\`)`):b.push(`describe("${l.description}")`));let k=b.concat(PVt({schema:l,meta:u,options:m}),m.withDefaultValues!==!1?wVt(l):[]).filter(Boolean).join(".");return k?`.${k}`:""}t(FC,"getZodChain");function PVt({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(PVt,"getZodChainablePresence");function wVt(l){return l.default!==void 0?`default(${Gy(l.type).with("number","integer",()=>lrt(l.default)).otherwise(()=>JSON.stringify(l.default))})`:""}t(wVt,"getZodChainableDefault");function AVt(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(${DVt(l.pattern)})`),u.join(".")}t(AVt,"getZodChainableStringValidations");function DVt(l){return l.startsWith("/")&&l.endsWith("/")&&(l=l.slice(1,-1)),l=urt(l),`/${l}/`}t(DVt,"formatPatternIfNeeded");function IVt(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(IVt,"getZodChainableNumberValidations");function NVt(l){let u=[];return l.minItems&&u.push(`min(${l.minItems})`),l.maxItems&&u.push(`max(${l.maxItems})`),u.join(".")}t(NVt,"getZodChainableArrayValidations");var x8=t(l=>l.reduce((u,m)=>u+m,0),"sum");function dg(l,u){if(!u)return l;if(Vf(u))return l+2;if(Array.isArray(u.type))return u.type.length===1?Ib("oneOf")+dg(l,{...u,type:u.type[0]}):l+Ib("oneOf")+x8(u.type.map(m=>dg(0,{...u,type:m})));if(u.oneOf)return u.oneOf.length===1?Ib("oneOf")+dg(l,u.oneOf[0]):l+Ib("oneOf")+x8(u.oneOf.map(m=>dg(0,m)));if(u.anyOf)return u.anyOf.length===1?Ib("anyOf")+dg(l,u.anyOf[0]):l+Ib("anyOf")+x8(u.anyOf.map(m=>dg(0,m)));if(u.allOf)return u.allOf.length===1?Ib("allOf")+dg(l,u.allOf[0]):l+Ib("allOf")+x8(u.allOf.map(m=>dg(0,m)));if(!u.type)return l;if(d8(u.type))return u.enum?l+mnt(u)+Ib("enum")+x8(u.enum.map(m=>dg(0,m))):l+mnt(u);if(u.type==="array")return u.items?Ib("array")+dg(l,u.items):Ib("array")+dg(l);if(u.type==="object"||u.properties||u.additionalProperties){if(u.properties){let m=Object.values(u.properties);l+=Ib("object")+x8(m.map(b=>dg(0,b)))}else l+=Ib("empty-object");u.additionalProperties&&(typeof u.additionalProperties=="object"?l+=dg(0,u.additionalProperties):l+=dg(1))}return l}t(dg,"getOpenAPISchemaComplexity");function mnt(l){return Gy(l.type).with("string","number","integer","boolean",()=>1).otherwise(()=>0)}t(mnt,"complexityByType");function Ib(l){return Gy(l).with("oneOf",()=>2).with("anyOf",()=>3).with("allOf",()=>2).with("enum","array","empty-object",()=>1).with("object",()=>2).otherwise(()=>0)}t(Ib,"complexityByComposite");var Lwe=class Lwe{constructor(u,m,b={referencedBy:[]},k){this.schema=u;this.resolver=m;Vf(u)&&(this.ref=u.$ref),k&&(this.enumRef=k),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 k=(L=this.resolver)==null?void 0:L.getTagByZodSchemaName(b);return m!=null&&m.tsNamespaces&&k&&k!==u?`${vd({type:"models",tag:k,options:m})}.${b}`:b}get complexity(){return dg(0,this.schema)}assign(u){return this.code=u,this}inherit(u){return u&&u.children.push(this),this}};t(Lwe,"ZodSchema");var RW=Lwe;function Rwe(l){var u,m;if(l)return(u=l.parent)!=null&&u.ref?l.parent.ref:Rwe((m=l.parent)==null?void 0:m.meta)}t(Rwe,"getParentRef");function hnt(l,u){let m=l.getRefByZodSchemaName(u);if(m){let k=Array.from(l.dependencyGraph.refsDependencyGraph[m]??[]).map(L=>l.getZodSchemaNameByRef(L)),I=l.getExtractedEnumZodSchemaNamesReferencedBySchemaRef(m);return[...k,...I]}let b=l.getCompositeZodSchemaByZodSchemaName(u);return b?Array.from(Tle(b)).map(k=>l.getZodSchemaNameByRef(k)):[]}t(hnt,"getZodSchemaRefs");function Tle(l,{skipObjectSchema:u=!1}={}){return l.children.reduce((b,k)=>{let I=k.ref??k.enumRef;return I&&b.add(I),k.children.length>0&&(!u||!ey(k.schema)||k.schema.type!=="object")&&Tle(k).forEach(L=>b.add(L)),b},new Set)}t(Tle,"getSchemaRefs");function Wd({schema:l,resolver:u,meta:m,tag:b}){var nr;let k=new RW(l,u,m),I={parent:k.inherit(m==null?void 0:m.parent),referencedBy:[...k.meta.referencedBy]},L={resolver:u,meta:I,tag:b};if(Vf(l))return OVt({schema:l,zodSchema:k,resolver:u,meta:I,tag:b});let Z=MVt({schema:l,zodSchema:k,resolver:u,meta:I,tag:b});if(Z)return Z;let oe=FVt({schema:l,zodSchema:k,resolver:u,meta:I,tag:b});if(oe)return oe;let re=RVt({schema:l,zodSchema:k,resolver:u,meta:I,tag:b});if(re)return re;let me=LVt({schema:l,zodSchema:k,resolver:u,meta:I,tag:b});if(me)return me;let ke=jVt({schema:l,zodSchema:k,resolver:u,meta:I,tag:b});if(ke)return ke;let et=u.options.allReadonly?".readonly()":"";if(ele(l))return l.items?k.assign(`z.array(${Wd({...L,schema:l.items}).getCodeString(b,u.options)}${FC({schema:l.items,meta:{...I,isRequired:!0},options:u.options})})${et}`):k.assign(`z.array(z.any())${et}`);let At=l.type?l.type.toLowerCase():void 0;if(At==="object"||l.properties||l.additionalProperties){let cr=l.required&&l.required.length>0,Jt=u.options.withImplicitRequiredProps?!1:l.properties&&!((nr=l.required)!=null&&nr.length),or="{}";l.properties&&(or=`{ ${Object.entries(l.properties).map(([zo,ei])=>{var Wt;let tf={...I,isRequired:Jt?!0:cr?(Wt=l.required)==null?void 0:Wt.includes(zo):u.options.withImplicitRequiredProps,name:zo,isParentPartial:Jt},zu=ei;if(Vf(ei)&&u&&(zu=u.getSchemaByRef(ei.$ref),!zu))throw new Error(`Schema ${ei.$ref} not found`);let ha=Wd({...L,schema:ei,meta:tf}),Sr=ha.getCodeString(b,u.options)+FC({schema:zu,meta:tf,options:u.options}),xs=!1,Fs=Rwe(m);return Fs&&(xs=[...Vf(ei)?[ei.$ref]:[],...Tle(ha,{skipObjectSchema:!0})].some(wa=>{var Co;return(Co=u.dependencyGraph.deepDependencyGraph[wa])==null?void 0:Co.has(Fs)})),[zo,Sr,xs]}).map(([zo,ei,tf])=>tf?`get ${bwe(zo)}() { return ${ei} }`:`${bwe(zo)}: ${ei}`).join(", ")} }`);let Qt="";l.additionalProperties&&(Qt=`.catchall(${typeof l.additionalProperties=="object"&&Object.keys(l.additionalProperties).length>0?Wd({...L,schema:l.additionalProperties}).getCodeString(b,u.options)+FC({schema:l.additionalProperties,meta:{...I,isRequired:!0},options:u.options}):"z.any()"})`);let Gn=`z.object(${or})${Jt?".partial()":""}${Qt}${et}`;return k.assign(Gn)}if(At==="any")return k.assign("z.any()");if(!At)return k.assign("z.unknown()");throw new Error(`Unsupported schema type: ${At}`)}t(Wd,"getZodSchema");function OVt({schema:l,zodSchema:u,resolver:m,meta:b,tag:k}){if(!Vf(l))return;let I=u.meta.referencedBy.slice(0,-1).map(oe=>oe.ref?m.getZodSchemaNameByRef(oe.ref)??oe.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 Z=m.getCodeByZodSchemaName(l.$ref);if(!Z){let oe=m.getSchemaByRef(l.$ref);if(!oe)throw new Error(`Schema ${l.$ref} not found`);Z=Wd({schema:oe,resolver:m,meta:b,tag:k}).getCodeString(k,m.options)}return m.getCodeByZodSchemaName(L)||m.setZodSchema(L,Z,k),u}t(OVt,"getReferenceZodSchema");function FVt({schema:l,zodSchema:u,resolver:m,meta:b,tag:k}){var L;if(!ey(l)||!l.oneOf)return;if(l.oneOf.length===1){let Z=Wd({schema:l.oneOf[0],resolver:m,meta:b,tag:k});return u.assign(Z.getCodeString(k,m.options))}let I=(L=l.oneOf)==null?void 0:L.some(Z=>ey(Z)&&((Z==null?void 0:Z.allOf)||[]).length>1);if(l.discriminator&&!I){let Z=l.discriminator.propertyName;return u.assign(`
528
528
  z.discriminatedUnion("${Z}", [${l.oneOf.map(oe=>Wd({schema:oe,resolver:m,meta:b,tag:k}).getCodeString(k,m.options)).join(", ")}])
529
- `)}return u.assign(`z.union([${l.oneOf.map(Z=>Wd({schema:Z,resolver:m,meta:b,tag:k}).getCodeString(k,m.options)).join(", ")}])`)}t(OVt,"getOneOfZodSchema");function FVt({schema:l,zodSchema:u,resolver:m,meta:b,tag:k}){if(!(!ey(l)||!Array.isArray(l.type)))return l.type.length===1?Wd({schema:{...l,type:l.type[0]},resolver:m,meta:b,tag:k}):u.assign(`z.union([${l.type.map(I=>Wd({schema:{...l,type:I},resolver:m,meta:b,tag:k}).getCodeString(k,m.options)).join(", ")}])`)}t(FVt,"getArrayZodSchema");function MVt({schema:l,zodSchema:u,resolver:m,meta:b,tag:k}){if(!ey(l)||!l.anyOf)return;if(l.anyOf.length===1){let L=Wd({schema:l.anyOf[0],resolver:m,meta:b,tag:k});return u.assign(L.getCodeString(k,m.options))}let I=l.anyOf.map(L=>Wd({schema:L,resolver:m,meta:b,tag:k})).map(L=>L.getCodeString(k,m.options)).join(", ");return u.assign(`z.union([${I}])`)}t(MVt,"getAnyOfZodSchema");function RVt({schema:l,zodSchema:u,resolver:m,meta:b,tag:k}){if(!ey(l)||!l.allOf)return;if(l.allOf.length===1){let ke=Wd({schema:l.allOf[0],resolver:m,meta:b,tag:k});return u.assign(ke.getCodeString(k,m.options))}let{patchRequiredSchemaInLoop:I,noRequiredOnlyAllof:L,composedRequiredSchema:Z}=Qtt(l),oe=L.map(ke=>{let et=Wd({schema:ke,resolver:m,meta:b,tag:k});return m&&I(ke,m.getSchemaByRef.bind(m)),et});Z.required.length&&oe.push(Wd({schema:Z,resolver:m,meta:b,tag:k}));let re=oe.at(0),me=oe.slice(1).map(ke=>`merge(${ke.getCodeString(k,m.options)})`).join(".");return u.assign(`${re.getCodeString(k,m.options)}.${me}`)}t(RVt,"getAllOfZodSchema");function LVt({schema:l,zodSchema:u,resolver:m,meta:b,tag:k}){if(!ey(l))return;let I=l.type?l.type.toLowerCase():void 0;if(I&&d8(I)){if(l.enum){if(I==="string")return BVt({schema:l,zodSchema:u,resolver:m,meta:b,tag:k});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(Gy(I).with("integer",()=>Gy(l.type).with("integer",()=>wrt).otherwise(()=>Art)).with("string",()=>l.pattern?`z.regex(${jVt(l.pattern)})`:Gy(l.format).with("binary",()=>dle).with("email",()=>Drt).with("hostname","uri",()=>Irt).with("uuid",()=>Nrt).with("date-time",()=>Ort).otherwise(()=>mle)).otherwise(L=>`z.${L}()`))}}t(LVt,"getPrimitiveZodSchema");function jVt(l){return l.startsWith("/")&&l.endsWith("/")&&(l=l.slice(1,-1)),l=urt(l),`/${l}/`}t(jVt,"formatPatternIfNeeded");function BVt({resolver:l,schema:u,zodSchema:m,meta:b,tag:k}){var re;if(!ey(u))return;let I=aR(u);if(!l.options.extractEnums)return m.assign(I);let L=l.getEnumZodSchemaDataByCode(I);if(L)return((re=m.meta.parent)==null?void 0:re.ref)===l.getRefByZodSchemaName(L.zodSchemaName)?m.assign(L.code):new RW({$ref:l.getRefByZodSchemaName(L.zodSchemaName)},l,b).inherit(m).assign(I);let Z=l.getExtractedEnumZodSchemaDataByCode(I);if(!Z)return m.assign(I);if(!Z.zodSchemaName||!Z.tag)throw new Error(`Enum zod schema name or tag not resolved for code: ${I}`);let oe=l.options.tsNamespaces&&Z.tag!==k?`${vd({type:"models",tag:Z.tag,options:l.options})}.`:"";return m.assign(`${oe}${Z.zodSchemaName}`)}t(BVt,"getEnumZodSchema");function aR(l){var u;return`${wW}([${(u=l.enum)==null?void 0:u.map(m=>m===null?"null":`"${m}"`).join(", ")}])`}t(aR,"getEnumZodSchemaCode");function gnt(l){return`${wW}([${l.map(u=>`"${u}"`).join(", ")}])`}t(gnt,"getEnumZodSchemaCodeFromEnumNames");function oR({schema:l,zodSchema:u,fallbackName:m,resolver:b,tag:k}){var Z;let I=u.getCodeString();if((!Zy(I)||u.ref===void 0)&&m){if(u.complexity<mwe)return I;let oe=g8(m,b.options.schemaSuffix);for(;b.getCodeByZodSchemaName(oe);){if((Z=b.getZodSchemaNamesByCompositeCode(I))!=null&&Z.includes(oe))return oe;if(b.getCodeByZodSchemaName(oe)===oe)return oe;throw new Error(`Can't uniquely resolve zod schema name: ${oe}`)}return b.setZodSchema(oe,I,k),b.addZodSchemaForCompositeCode(I,u,oe,l),oe}let L=b.getCodeByZodSchemaName(I);if(!L&&u.ref&&(L=b.getCodeByZodSchemaName(b.getZodSchemaNameByRef(u.ref))),u.ref&&L)return dg(0,b.getSchemaByRef(u.ref))<mwe?b.getCodeByZodSchemaName(I):I;if(u.ref)return b.getZodSchemaNameByRef(u.ref);throw new Error(`Invalid ref: ${u.ref}`)}t(oR,"resolveZodSchemaName");function ynt({resolver:l,endpoint:u,operation:m}){let b=m["x-acl"];return b==null?void 0:b.map(k=>{let I=Object.keys(k.conditions??{}).reduce((L,Z)=>{let oe=$Vt({resolver:l,endpoint:u,acl:b,name:Z});return oe?[...L,oe]:(l.validationErrors.push(fnt(Z,m,u)),L)},[]);return{...k,conditionsTypes:I}})}t(ynt,"getEndpointAcl");function $Vt({resolver:l,endpoint:u,acl:m,name:b}){var ke,et,At,nr,cr,Jt,or,Qt,zi,Gn;let k=(et=(ke=m[0])==null?void 0:ke.conditions)==null?void 0:et[b];if(!k)return;let I=k.replace(/^\$[^.]*\./,"").split("."),L,Z,oe,re=0,me=u.parameters.find(({name:xi})=>xi===I[re]);if(me)Z=(At=me.parameterObject)==null?void 0:At.required,L=(nr=me.parameterObject)==null?void 0:nr.schema,oe=`${me.name} ${HA(me.type)} parameter`,re++;else{let xi=u.parameters.find(({bodyObject:tf})=>!!tf),ei=Object.keys(((cr=xi==null?void 0:xi.bodyObject)==null?void 0:cr.content)??{}).find(OC);ei&&(L=(Qt=(or=(Jt=xi==null?void 0:xi.bodyObject)==null?void 0:Jt.content)==null?void 0:or[ei])==null?void 0:Qt.schema,oe=`${Ab(u)?"query":"mutation"} data`)}for(;L&&re<I.length;){let xi=l.resolveObject(L);L=(zi=Object.entries(xi.properties??{}).find(([ei])=>ei===I[re]))==null?void 0:zi[1],Z=((Gn=xi.required)==null?void 0:Gn.includes(I[re]))??!1,re++}if(L)return{name:b,type:Vf(L)?void 0:L.type,zodSchemaName:Vf(L)?l.getZodSchemaNameByRef(L.$ref):void 0,required:Z,info:oe}}t($Vt,"getEndpointAclConditionPropertyType");function vnt({resolver:l,operation:u,operationName:m,isUniqueOperationName:b,tag:k}){var At,nr;let I=l.resolveObject(u.requestBody);if(!I)return;let Z=Object.keys(I.content??{}).find(OC);if(!Z)return;let oe=(nr=(At=I.content)==null?void 0:At[Z])==null?void 0:nr.schema;if(!oe)return;let re=Wd({schema:oe,resolver:l,meta:{isRequired:I.required??!0},tag:k}),me=l.resolveObject(oe),ke=oR({schema:me,zodSchema:re,fallbackName:hle(y8(m,b,k)),resolver:l,tag:k}),et=FC({schema:me,meta:re.meta,options:l.options});return{endpointParameter:{name:Yce,type:"Body",description:I.description,zodSchema:ke+et,bodyObject:I},requestFormat:Z}}t(vnt,"getEndpointBody");function bnt({resolver:l,param:u,operationName:m,isUniqueOperationName:b,tag:k}){let I=l.resolveObject(u);if(!Ktt.includes(I.in))return;let L={};if(I.content){let At=Object.keys(I.content??{}),nr=At.find(OC);if(!nr)throw new Error(`Unsupported media type for param ${I.name}: ${At.join(", ")}`);let cr=I.content[nr];if(!cr)throw new Error(`No content with media type for param ${I.name}: ${nr}`);L=(cr==null?void 0:cr.schema)??cr}else I.schema&&(L=I.schema);l.options.withDescription&&L&&(L.description=(I.description??"").trim());let Z=Mrt(y8(m,b,k),I.name),oe;if(prt(I)){let At=AW(Z,l.options.enumSuffix,l.options.schemaSuffix),nr=gnt(I["x-enumNames"]);l.setZodSchema(At,nr,k),oe=At}let re=Wd({schema:L,resolver:l,meta:{isRequired:I.in==="path"?!0:I.required??!1},tag:k}),me=l.resolveObject(L),ke=FC({schema:me,meta:re.meta,options:l.options}),et=oR({schema:me,zodSchema:re.assign(re.getCodeString(k)+ke),fallbackName:Z,resolver:l,tag:k});return{name:Gy(I.in).with("path",()=>Swe(I.name)).otherwise(()=>I.name),type:Gy(I.in).with("header",()=>"Header").with("query",()=>"Query").with("path",()=>"Path").run(),zodSchema:et,parameterObject:I,parameterSortingEnumSchemaName:oe}}t(bnt,"getEndpointParameter");function xnt(l){var m,b,k,I,L;let u=[];for(let Z in l.openApiDoc.paths){if(m8(Z,l.options))continue;let oe=l.openApiDoc.paths[Z],re=S8(oe,_8),me=Snt(oe.parameters??[]);for(let ke in re){let et=re[ke];if(!et||sR(et,l.options))continue;let At=et.operationId&&et.operationId!==JA(et.operationId);et.operationId&&At&&l.validationErrors.push(cnt(et.operationId));let nr=Object.entries({...me,...Snt(et.parameters??[])}).map(([,xi])=>xi),cr=FW({path:Z,method:ke,operation:et,operationsByTag:l.operationsByTag,options:l.options}),Jt=l.operationNames.filter(xi=>xi===cr).length<=1,or=XA(et,l.options),Qt={method:ke,path:_rt(Z),operationName:cr,description:et.description,summary:et.summary,tags:(m=et.tags)==null?void 0:m.map(QA),requestFormat:"application/json",parameters:[],response:"",errors:[],responseStatusCodes:[],mediaUpload:!!et["x-media-upload"],mediaDownload:!!et["x-media-download"]};if(et.requestBody){let xi=vnt({resolver:l,operation:et,operationName:cr,isUniqueOperationName:Jt,tag:or});xi&&(Qt.parameters.push(xi.endpointParameter),Qt.requestFormat=xi.requestFormat)}for(let xi of nr){let zo=bnt({resolver:l,param:xi,operationName:cr,isUniqueOperationName:Jt,tag:or});zo&&Qt.parameters.push(zo)}let zi=JVt(Qt);zi.forEach(xi=>{Qt.parameters.push(xi)}),zi.length>0&&l.validationErrors.push(lnt(zi,Z));for(let xi in et.responses){Qt.responseStatusCodes.push(xi);let zo=l.resolveObject(et.responses[xi]),tf=Object.keys(zo.content??{}).find(ile),zu,ha;if(tf?(Qt.responseFormat=tf,zu=(k=(b=zo.content)==null?void 0:b[tf])==null?void 0:k.schema):(ha=PW,xi==="200"&&l.validationErrors.push(_nt({received:"200",expected:"204"},et,Qt))),zu){let Sr=Wd({schema:zu,resolver:l,meta:{isRequired:!0},tag:or}),xs=l.resolveObject(zu);ha=oR({schema:xs,zodSchema:Sr,fallbackName:Sr.ref?void 0:gle({statusCode:xi,operationName:cr,isUniqueOperationName:Jt,tag:or}),resolver:l,tag:or})+FC({schema:xs,meta:Sr.meta,options:l.options})}if(ha){let Sr=Number(xi);xW(Sr)&&!Qt.response?(Qt.response=ha,Qt.responseObject=zo,Qt.responseDescription=zo.description):xi!=="default"&&nle(Sr)&&Qt.errors.push({zodSchema:ha,status:Sr,description:zo.description})}}Qt.response||(Qt.response=PW);let Gn=Object.keys(et.responses).map(Number).filter(xW);Gn.length>1&&l.validationErrors.push(pnt(Gn.map(String),et,Qt)),Qt.acl=ynt({resolver:l,endpoint:Qt,operation:et}),(I=et.security)!=null&&I[0].Authorization&&!Qt.responseStatusCodes.includes("401")&&l.validationErrors.push(Mwe("401",et,Qt)),(L=Qt.acl)!=null&&L[0]&&!Qt.responseStatusCodes.includes("403")&&l.validationErrors.push(Mwe("403",et,Qt)),u.push(Qt)}}return u}t(xnt,"getEndpointsFromOpenAPIDoc");function Snt(l){return Object.fromEntries((l??[]).map(u=>[Vf(u)?u.$ref:u.name,u]))}t(Snt,"getParameters");function JVt(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=>qVt(m))}t(JVt,"getMissingPathParameters");function qVt(l){return{name:l,type:"Path",zodSchema:mle,parameterObject:{name:l,required:!0,in:"path",schema:{type:"string"}}}}t(qVt,"getPathParameterFromName");function Tnt(l,u){let m=zVt(l,u),b=VVt(l,m);return{refsDependencyGraph:m,deepDependencyGraph:b}}t(Tnt,"getOpenAPISchemaDependencyGraph");function zVt(l,u){let m={},b={};return l.forEach(k=>UVt({schema:u(k),fromRef:k,getSchemaByRef:u,visitedRefs:m,refsDependencyGraph:b})),b}t(zVt,"getRefsDependencyGraph");function VVt(l,u){let m={},b={},k=t((I,L)=>{b[L].add(I),u[I]&&L!==I&&u[I].forEach(Z=>{let oe=`${L}__${Z}`;m[oe]||(m[oe]=!0,k(Z,L))})},"visit");return l.forEach(I=>{let L=u[I];L&&(b[I]||(b[I]=new Set),L.forEach(Z=>k(Z,I)))}),b}t(VVt,"getDeepRefsDependencyGraph");function UVt({schema:l,fromRef:u,getSchemaByRef:m,visitedRefs:b={},refsDependencyGraph:k={}}){let I=t(L=>{if(L.type!=="reference"||!L.data)return;let{schema:Z,data:oe}=L;if(k[oe.fromRef]||(k[oe.fromRef]=new Set),k[oe.fromRef].add(Z.$ref),b[Z.$ref])return!0;b[oe.fromRef]=!0,Z0(m(Z.$ref),{data:{fromRef:Z.$ref},onSchema:I})},"onSchema");return Z0(l,{data:{fromRef:u},onSchema:I}),{visitedRefs:b,refsDependencyGraph:k}}t(UVt,"getSchemaRefsDependencyGraph");function kle(l,u,m){let b=[];return Z0(u,{onSchema:t(I=>{I.type==="reference"?b.push(I.schema):Vf(I.parentSchema)&&(I.type==="property"?l.validationErrors.push(MW(`${m} has both reference and properties`)):I.type==="additionalProperties"?l.validationErrors.push(MW(`${m} has both reference and additionalProperties`)):I.type==="array"?l.validationErrors.push(MW(`${m} is both reference and array schema`)):I.type==="composite"&&l.validationErrors.push(MW(`${m} has both reference and composite keyword`)))},"onSchema")}),b}t(kle,"getSchemaRefObjs");function knt(l,u){return u.map(k=>p8(k.$ref)).reduce((k,I)=>{let L=l.dependencyGraph.deepDependencyGraph[I];return[...k,I,...Array.from(L??[])]},[])}t(knt,"getDeepSchemaRefObjs");function Cnt(l){l.extractedEnumZodSchemaData.forEach(m=>{let b=m.meta.zodSchemaNameSegments.map(I=>I[I.length-1]).filter(Boolean),k=gwe(b);if(!k)throw new Error(`No common last segment found for enum: ${m.code}`);m.zodSchemaName=AW(k,l.options.enumSuffix,l.options.schemaSuffix)});let u=0;for(;u<5&&!jwe(l);)WVt(l,u+2),u++;if(jwe(l)||l.extractedEnumZodSchemaData.filter(b=>!Ent(l,b)).forEach(b=>{b.zodSchemaName=AW(b.meta.zodSchemaNameSegments[0].map(k=>Bwe(Ip(k))).join(""),l.options.enumSuffix,l.options.schemaSuffix)}),!jwe(l))throw new Error("Failed to resolve unique names for enum zod schemas")}t(Cnt,"resolveExtractedEnumZodSchemaNames");function jwe(l){return l.extractedEnumZodSchemaData.every(u=>Ent(l,u))}t(jwe,"allExtractedEnumZodSchemaNamesAreUnique");function WVt(l,u){l.extractedEnumZodSchemaData.forEach(m=>{let b=l.extractedEnumZodSchemaData.filter(({zodSchemaName:k})=>m.zodSchemaName===k);b.length!==1&&HVt(b,u)})}t(WVt,"additionalResolveExtractedEnumZodSchemaName");function HVt(l,u=2){l.forEach(m=>{let b=m.meta.zodSchemaNameSegments.map(k=>k[k.length-u]).filter(Boolean);if(b.length===1){let k=[Bwe(Ip(b[0])),m.zodSchemaName].filter(Boolean).join("");m.zodSchemaName=k}else{let k=gwe(b),I=[k?Bwe(Ip(k)):"",m.zodSchemaName].filter(Boolean).join("");m.zodSchemaName=I}})}t(HVt,"suffixWithPreviousSegmentName");function Ent(l,u){return l.extractedEnumZodSchemaData.filter(({zodSchemaName:m})=>u.zodSchemaName===m).length===1}t(Ent,"isUnique");function Bwe(l){return l.replace(/(Dto|DTO|Response|Request)/g,"")}t(Bwe,"sanitizeName");function Pnt(l){l.extractedEnumZodSchemaData.forEach(u=>{let m=Db(u.meta.tags);u.tag=m.length===1?m[0]:l.options.defaultTag})}t(Pnt,"resolveExtractedEnumZodSchemaTags");function LW({schema:l,nameSegments:u=[],includeSelf:m,...b}){m&&wnt({schema:l,nameSegments:u,...b}),Z0(l,{data:{nameSegments:u},onSchema:t(I=>{var Z;if(I.type==="reference")return!0;let L=[...((Z=I.data)==null?void 0:Z.nameSegments)??[]];I.type==="property"&&L.push(I.propertyName),wnt({schema:I.schema,nameSegments:[...L],...b})},"onSchema")})}t(LW,"updateExtractedEnumZodSchemaData");function wnt({resolver:l,schema:u,schemaRef:m,schemaInfo:b,tags:k,nameSegments:I=[]}){if(!u||Vf(u)||!u.enum)return;let L=aR(u),Z=l.extractedEnumZodSchemaData.find(oe=>oe.code===L);Z?(Z.meta.zodSchemaNameSegments.push(I),Z.meta.tags.push(...k),Z.meta.schemaRefs.push(...m?[m]:[]),Z.meta.schemas.push(...u?[u]:[])):l.extractedEnumZodSchemaData.push({code:L,meta:{zodSchemaNameSegments:[I],tags:[...k],schemaRefs:m?[m]:[],schemas:u?[u]:[]}}),l.validationErrors.push(unt(m?`${KM(m)}.${I[I.length-1]}`:b??I.join(".")))}t(wnt,"handleExtractedEnumZodSchemaDataUpdate");function Ant(l){var b;let u={},m={};return Object.entries(((b=l.openApiDoc.components)==null?void 0:b.schemas)??{}).forEach(([k,I])=>{let L=l.getSchemaDataByName(k);if(l.options.excludeRedundantZodSchemas&&(!L||L.deepRefOperations.length===0&&L.tags.length===0))return;let Z=g8(k,l.options.schemaSuffix);if(u[Z])return;let oe=l.getTagByZodSchemaName(Z),re=l.resolveObject(I);re.enum?m[Z]=aR(re):u[Z]=Wd({schema:I,resolver:l,tag:oe}).getCodeString(oe)}),{zodSchemas:u,enumZodSchemas:m}}t(Ant,"getZodSchemasFromOpenAPIDoc");function Dnt(l){var m;let u=[];return Object.entries(((m=l.openApiDoc.components)==null?void 0:m.schemas)??{}).forEach(([b,k])=>{let I=g8(b,l.options.schemaSuffix),L=l.resolveObject(k);!u.find(Z=>Z.zodSchemaName===I)&&L.enum&&u.push({zodSchemaName:I,code:aR(L)})}),u}t(Dnt,"getEnumZodSchemasFromOpenAPIDoc");var $we=class $we{constructor(u,m){this.openApiDoc=u;this.options=m;this.dependencyGraph=Tnt(this.schemaRefs,this.getSchemaByRef.bind(this)),this.enumZodSchemas=Dnt(this),this.operationsByTag=ont(u,m),this.operationNames=ant(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(crt)}getSchemaByRef(u){return this.docSchemas[KM(u)]}getSchemaDataByName(u){return this.schemaData.find(m=>m.name===u)}getZodSchemaNameByRef(u){var b,k;let m=((b=this.getSchemaDataByRef(p8(u)))==null?void 0:b.zodSchemaName)??((k=this.extractedEnumZodSchemaData.find(I=>I.zodSchemaName===u))==null?void 0:k.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 oe,re;if(!this.options.splitByTags)return this.options.defaultTag;let m=this.extractedEnumZodSchemaData.find(me=>me.zodSchemaName===u);if(m)return QA(m.tag??this.options.defaultTag);let b=this.getRefByZodSchemaName(u),k=b?((oe=this.getSchemaDataByRef(b))==null?void 0:oe.tags)??[]:[],I=((re=this.zodSchemaData.find(me=>me.zodSchemaName===u))==null?void 0:re.tags)??[],L=Db(k,I),Z=L.length===1?L[0]:this.options.defaultTag;return QA(Z??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 k=this.zodSchemaData.find(I=>I.zodSchemaName===u);k?(k.code=m,k.tags=(k.tags??[]).concat(b)):this.zodSchemaData.push({zodSchemaName:u,code:m,tags:[b]})}addZodSchemaForCompositeCode(u,m,b,k){let I={zodSchemaName:b,zodSchema:m,schema:k},L=this.compositeZodSchemaData.find(Z=>Z.code===u);L?L.zodSchemas.push(I):this.compositeZodSchemaData.push({code:u,zodSchemas:[I]})}getCompositeZodSchemaByZodSchemaName(u){var b;let m=this.compositeZodSchemaData.find(k=>k.zodSchemas.some(I=>I.zodSchemaName===u));return(b=m==null?void 0:m.zodSchemas.find(k=>k.zodSchemaName===u))==null?void 0:b.zodSchema}getSchemaByCompositeZodSchemaName(u){var m,b;return(b=(m=this.compositeZodSchemaData.find(k=>k.zodSchemas.some(I=>I.zodSchemaName===u)))==null?void 0:m.zodSchemas.find(k=>k.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:k})=>(b&&k.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 Vf(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=[],k=[]){var I,L;return k.includes(m)?[]:(k.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(Z=>{let oe=this.getCircularSchemaChain(u,Z,b,k);return oe.length>0?[m,...oe]:oe}).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 k=this.getExtractedEnumZodSchemaDataByName(u);if(k)return k.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,k,I;this.schemaRefs.forEach(L=>{let Z=p8(L),oe=KM(Z),re=g8(oe,this.options.schemaSuffix);this.schemaData.push({ref:Z,name:oe,zodSchemaName:re,tags:[],deepRefOperations:[]})});for(let L in this.openApiDoc.paths){if(m8(L,this.options))continue;let Z=this.openApiDoc.paths[L],oe=S8(Z,_8);for(let re in oe){let me=oe[re];if(!me||sR(me,this.options))continue;let ke=XA(me,this.options),et=FW({path:L,method:re,operation:me,operationsByTag:this.operationsByTag,options:this.options}),At=this.operationNames.filter(or=>or===et).length<=1,nr=ty(y8(et,At,ke)),cr=[];if((u=me.parameters)==null||u.map(or=>{let Qt=or,zi=Qt.schema,Gn=`Operation ${me.operationId??L} parameter ${Qt.name}`;cr.push(...kle(this,zi,Gn)),this.options.extractEnums&&LW({resolver:this,schema:zi,schemaInfo:Gn,tags:[ke],nameSegments:[nr,Qt.name],includeSelf:!0})}),me.requestBody){let or=this.resolveObject(me.requestBody),zi=Object.keys(or.content??{}).find(OC);if(zi){let Gn=(b=(m=or.content)==null?void 0:m[zi])==null?void 0:b.schema,xi=`Operation ${me.operationId} request body`;cr.push(...kle(this,Gn,xi)),this.options.extractEnums&&LW({resolver:this,schema:Gn,schemaInfo:xi,tags:[ke],nameSegments:[hle(nr)]})}}for(let or in me.responses){let Qt=this.resolveObject(me.responses[or]),Gn=Object.keys(Qt.content??{}).find(ile);if(Gn){let xi=(I=(k=Qt.content)==null?void 0:k[Gn])==null?void 0:I.schema,zo=`Operation ${me.operationId} response body`;cr.push(...kle(this,xi,zo)),this.options.extractEnums&&LW({resolver:this,schema:xi,schemaInfo:zo,tags:[ke],nameSegments:[gle({statusCode:or,operationName:et,isUniqueOperationName:At,tag:ke})]})}}knt(this,cr).forEach(or=>{let Qt=this.getSchemaDataByRef(or);Qt&&(Qt.tags.push(ke),Qt.deepRefOperations.push(me))})}}this.options.extractEnums&&(this.schemaRefs.forEach(L=>{var oe;let Z=p8(L);LW({resolver:this,schema:this.getSchemaByRef(Z),schemaRef:Z,tags:((oe=this.getSchemaDataByRef(Z))==null?void 0:oe.tags)??[],nameSegments:[KM(Z)]})}),Pnt(this),this.handleDuplicateEnumZodSchemas(),Cnt(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,Z;let k=(L=m.find(({zodSchemaName:oe})=>oe===b.zodSchemaName))==null?void 0:L.code;if(!k)return;let I=this.extractedEnumZodSchemaData.find(({code:oe})=>oe===k);!I||((Z=this.getEnumZodSchemaDataByCode(I.code))==null?void 0:Z.zodSchemaName)!==b.zodSchemaName||(b.tags.push(...I.meta.tags??[]),I.meta.schemaRefs.forEach(oe=>{this.dependencyGraph.refsDependencyGraph[oe]||(this.dependencyGraph.refsDependencyGraph[oe]=new Set),this.dependencyGraph.refsDependencyGraph[oe].add(b.ref),this.dependencyGraph.deepDependencyGraph[oe]||(this.dependencyGraph.deepDependencyGraph[oe]=new Set),this.dependencyGraph.deepDependencyGraph[oe].add(b.ref)}))}),this.extractedEnumZodSchemaData.splice(0,this.extractedEnumZodSchemaData.length,...this.extractedEnumZodSchemaData.filter(({code:b})=>!u.includes(b)))}};t($we,"SchemaResolver");var Cle=$we;function Int(l){let u=[],m={};function b(k,I){Array.isArray(I)||(I=[]),I.push(k),m[k]=!0,l[k]&&l[k].forEach(L=>{I.includes(L)||m[L]||b(L,I.slice(0))}),u.includes(k)||u.push(k)}return t(b,"visit"),Object.keys(l).forEach(k=>b(k,[])),u}t(Int,"topologicalSort");function Nnt(l,u){let m=Object.entries(l),b=m.filter(([k])=>u.includes(k)).sort(([k],[I])=>u.indexOf(k)-u.indexOf(I)).concat(m.filter(([k])=>!u.includes(k)));return Object.fromEntries(b)}t(Nnt,"sortObjKeysFromArray");function Ont(l,u){let m=Int(l.dependencyGraph.deepDependencyGraph).map(k=>l.getZodSchemaNameByRef(k));return Nnt(u,m)}t(Ont,"sortZodSchemasByTopology");function Ele(l,u){let m=new Cle(l,u),b=xnt(m),k=Ant(m),I={...k.zodSchemas,...m.getZodSchemas(),...k.enumZodSchemas};return I=Ont(m,I),I={...m.getExtractedEnumZodSchemas(),...I},{resolver:m,data:GVt({resolver:m,endpoints:b,zodSchemas:I,options:u})}}t(Ele,"getDataFromOpenAPIDoc");function GVt({resolver:l,endpoints:u,zodSchemas:m,options:b}){let k=new Map;return b.splitByTags?(u.forEach(I=>{let L=t3(I,b);Fnt(L,k).endpoints.push(I)}),Object.entries(m).forEach(([I,L])=>{let Z=l.getTagByZodSchemaName(I);Z&&(Fnt(Z,k).zodSchemas[I]=L)}),k):(k.set(b.defaultTag,{endpoints:u,zodSchemas:m}),k)}t(GVt,"splitDataByTags");function Fnt(l,u){return u.has(l)||u.set(l,{endpoints:[],zodSchemas:{}}),u.get(l)}t(Fnt,"getTagElement");var cR=Zm(require("fs")),Jwe=Zm(require("path"));function Mnt(l){return cR.default.readFileSync(Jwe.default.join(__dirname,`../${l}`),"utf-8")}t(Mnt,"readFileSync");function qwe(l){let u=`src/generators/templates/${l}.hbs`;return Mnt(u)}t(qwe,"readHbsTemplateSync");function Rnt(l){let u=`src/assets/${l}`;return Mnt(u)}t(Rnt,"readAssetSync");function uT({output:l,fileName:u}){return`${l}/${u}`}t(uT,"getOutputFileName");function ZVt(l,u){let m=Jwe.default.dirname(l);cR.default.existsSync(m)||cR.default.mkdirSync(m,{recursive:!0}),cR.default.writeFileSync(l,u,"utf-8")}t(ZVt,"writeFileWithDirSync");function QVt({fileName:l,content:u}){ZVt(l,u)}t(QVt,"writeFileSync");function Lnt(l){l.forEach(QVt)}t(Lnt,"writeGenerateFileData");function jnt(l,u){let{resolver:m,data:b}=Ele(l,u);if(m.validationErrors.length>0){let k=dnt(m.validationErrors);Object.entries(k).forEach(([I,L])=>{hEe(`${xA.red(`${Wtt[I]}:`)}
529
+ `)}return u.assign(`z.union([${l.oneOf.map(Z=>Wd({schema:Z,resolver:m,meta:b,tag:k}).getCodeString(k,m.options)).join(", ")}])`)}t(FVt,"getOneOfZodSchema");function MVt({schema:l,zodSchema:u,resolver:m,meta:b,tag:k}){if(!(!ey(l)||!Array.isArray(l.type)))return l.type.length===1?Wd({schema:{...l,type:l.type[0]},resolver:m,meta:b,tag:k}):u.assign(`z.union([${l.type.map(I=>Wd({schema:{...l,type:I},resolver:m,meta:b,tag:k}).getCodeString(k,m.options)).join(", ")}])`)}t(MVt,"getArrayZodSchema");function RVt({schema:l,zodSchema:u,resolver:m,meta:b,tag:k}){if(!ey(l)||!l.anyOf)return;if(l.anyOf.length===1){let L=Wd({schema:l.anyOf[0],resolver:m,meta:b,tag:k});return u.assign(L.getCodeString(k,m.options))}let I=l.anyOf.map(L=>Wd({schema:L,resolver:m,meta:b,tag:k})).map(L=>L.getCodeString(k,m.options)).join(", ");return u.assign(`z.union([${I}])`)}t(RVt,"getAnyOfZodSchema");function LVt({schema:l,zodSchema:u,resolver:m,meta:b,tag:k}){if(!ey(l)||!l.allOf)return;if(l.allOf.length===1){let ke=Wd({schema:l.allOf[0],resolver:m,meta:b,tag:k});return u.assign(ke.getCodeString(k,m.options))}let{patchRequiredSchemaInLoop:I,noRequiredOnlyAllof:L,composedRequiredSchema:Z}=Qtt(l),oe=L.map(ke=>{let et=Wd({schema:ke,resolver:m,meta:b,tag:k});return m&&I(ke,m.getSchemaByRef.bind(m)),et});Z.required.length&&oe.push(Wd({schema:Z,resolver:m,meta:b,tag:k}));let re=oe.at(0),me=oe.slice(1).map(ke=>`merge(${ke.getCodeString(k,m.options)})`).join(".");return u.assign(`${re.getCodeString(k,m.options)}.${me}`)}t(LVt,"getAllOfZodSchema");function jVt({schema:l,zodSchema:u,resolver:m,meta:b,tag:k}){if(!ey(l))return;let I=l.type?l.type.toLowerCase():void 0;if(I&&d8(I)){if(l.enum){if(I==="string")return BVt({schema:l,zodSchema:u,resolver:m,meta:b,tag:k});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(Gy(I).with("integer",()=>Gy(l.type).with("integer",()=>wrt).otherwise(()=>Art)).with("string",()=>Gy(l.format).with("binary",()=>dle).with("email",()=>Drt).with("hostname","uri",()=>Irt).with("uuid",()=>Nrt).with("date-time",()=>Ort).otherwise(()=>mle)).otherwise(L=>`z.${L}()`))}}t(jVt,"getPrimitiveZodSchema");function BVt({resolver:l,schema:u,zodSchema:m,meta:b,tag:k}){var re;if(!ey(u))return;let I=aR(u);if(!l.options.extractEnums)return m.assign(I);let L=l.getEnumZodSchemaDataByCode(I);if(L)return((re=m.meta.parent)==null?void 0:re.ref)===l.getRefByZodSchemaName(L.zodSchemaName)?m.assign(L.code):new RW({$ref:l.getRefByZodSchemaName(L.zodSchemaName)},l,b).inherit(m).assign(I);let Z=l.getExtractedEnumZodSchemaDataByCode(I);if(!Z)return m.assign(I);if(!Z.zodSchemaName||!Z.tag)throw new Error(`Enum zod schema name or tag not resolved for code: ${I}`);let oe=l.options.tsNamespaces&&Z.tag!==k?`${vd({type:"models",tag:Z.tag,options:l.options})}.`:"";return m.assign(`${oe}${Z.zodSchemaName}`)}t(BVt,"getEnumZodSchema");function aR(l){var u;return`${wW}([${(u=l.enum)==null?void 0:u.map(m=>m===null?"null":`"${m}"`).join(", ")}])`}t(aR,"getEnumZodSchemaCode");function gnt(l){return`${wW}([${l.map(u=>`"${u}"`).join(", ")}])`}t(gnt,"getEnumZodSchemaCodeFromEnumNames");function oR({schema:l,zodSchema:u,fallbackName:m,resolver:b,tag:k}){var Z;let I=u.getCodeString();if((!Zy(I)||u.ref===void 0)&&m){if(u.complexity<mwe)return I;let oe=g8(m,b.options.schemaSuffix);for(;b.getCodeByZodSchemaName(oe);){if((Z=b.getZodSchemaNamesByCompositeCode(I))!=null&&Z.includes(oe))return oe;if(b.getCodeByZodSchemaName(oe)===oe)return oe;throw new Error(`Can't uniquely resolve zod schema name: ${oe}`)}return b.setZodSchema(oe,I,k),b.addZodSchemaForCompositeCode(I,u,oe,l),oe}let L=b.getCodeByZodSchemaName(I);if(!L&&u.ref&&(L=b.getCodeByZodSchemaName(b.getZodSchemaNameByRef(u.ref))),u.ref&&L)return dg(0,b.getSchemaByRef(u.ref))<mwe?b.getCodeByZodSchemaName(I):I;if(u.ref)return b.getZodSchemaNameByRef(u.ref);throw new Error(`Invalid ref: ${u.ref}`)}t(oR,"resolveZodSchemaName");function ynt({resolver:l,endpoint:u,operation:m}){let b=m["x-acl"];return b==null?void 0:b.map(k=>{let I=Object.keys(k.conditions??{}).reduce((L,Z)=>{let oe=$Vt({resolver:l,endpoint:u,acl:b,name:Z});return oe?[...L,oe]:(l.validationErrors.push(fnt(Z,m,u)),L)},[]);return{...k,conditionsTypes:I}})}t(ynt,"getEndpointAcl");function $Vt({resolver:l,endpoint:u,acl:m,name:b}){var ke,et,At,nr,cr,Jt,or,Qt,zi,Gn;let k=(et=(ke=m[0])==null?void 0:ke.conditions)==null?void 0:et[b];if(!k)return;let I=k.replace(/^\$[^.]*\./,"").split("."),L,Z,oe,re=0,me=u.parameters.find(({name:xi})=>xi===I[re]);if(me)Z=(At=me.parameterObject)==null?void 0:At.required,L=(nr=me.parameterObject)==null?void 0:nr.schema,oe=`${me.name} ${HA(me.type)} parameter`,re++;else{let xi=u.parameters.find(({bodyObject:tf})=>!!tf),ei=Object.keys(((cr=xi==null?void 0:xi.bodyObject)==null?void 0:cr.content)??{}).find(OC);ei&&(L=(Qt=(or=(Jt=xi==null?void 0:xi.bodyObject)==null?void 0:Jt.content)==null?void 0:or[ei])==null?void 0:Qt.schema,oe=`${Ab(u)?"query":"mutation"} data`)}for(;L&&re<I.length;){let xi=l.resolveObject(L);L=(zi=Object.entries(xi.properties??{}).find(([ei])=>ei===I[re]))==null?void 0:zi[1],Z=((Gn=xi.required)==null?void 0:Gn.includes(I[re]))??!1,re++}if(L)return{name:b,type:Vf(L)?void 0:L.type,zodSchemaName:Vf(L)?l.getZodSchemaNameByRef(L.$ref):void 0,required:Z,info:oe}}t($Vt,"getEndpointAclConditionPropertyType");function vnt({resolver:l,operation:u,operationName:m,isUniqueOperationName:b,tag:k}){var At,nr;let I=l.resolveObject(u.requestBody);if(!I)return;let Z=Object.keys(I.content??{}).find(OC);if(!Z)return;let oe=(nr=(At=I.content)==null?void 0:At[Z])==null?void 0:nr.schema;if(!oe)return;let re=Wd({schema:oe,resolver:l,meta:{isRequired:I.required??!0},tag:k}),me=l.resolveObject(oe),ke=oR({schema:me,zodSchema:re,fallbackName:hle(y8(m,b,k)),resolver:l,tag:k}),et=FC({schema:me,meta:re.meta,options:l.options});return{endpointParameter:{name:Yce,type:"Body",description:I.description,zodSchema:ke+et,bodyObject:I},requestFormat:Z}}t(vnt,"getEndpointBody");function bnt({resolver:l,param:u,operationName:m,isUniqueOperationName:b,tag:k}){let I=l.resolveObject(u);if(!Ktt.includes(I.in))return;let L={};if(I.content){let At=Object.keys(I.content??{}),nr=At.find(OC);if(!nr)throw new Error(`Unsupported media type for param ${I.name}: ${At.join(", ")}`);let cr=I.content[nr];if(!cr)throw new Error(`No content with media type for param ${I.name}: ${nr}`);L=(cr==null?void 0:cr.schema)??cr}else I.schema&&(L=I.schema);l.options.withDescription&&L&&(L.description=(I.description??"").trim());let Z=Mrt(y8(m,b,k),I.name),oe;if(prt(I)){let At=AW(Z,l.options.enumSuffix,l.options.schemaSuffix),nr=gnt(I["x-enumNames"]);l.setZodSchema(At,nr,k),oe=At}let re=Wd({schema:L,resolver:l,meta:{isRequired:I.in==="path"?!0:I.required??!1},tag:k}),me=l.resolveObject(L),ke=FC({schema:me,meta:re.meta,options:l.options}),et=oR({schema:me,zodSchema:re.assign(re.getCodeString(k)+ke),fallbackName:Z,resolver:l,tag:k});return{name:Gy(I.in).with("path",()=>Swe(I.name)).otherwise(()=>I.name),type:Gy(I.in).with("header",()=>"Header").with("query",()=>"Query").with("path",()=>"Path").run(),zodSchema:et,parameterObject:I,parameterSortingEnumSchemaName:oe}}t(bnt,"getEndpointParameter");function xnt(l){var m,b,k,I,L;let u=[];for(let Z in l.openApiDoc.paths){if(m8(Z,l.options))continue;let oe=l.openApiDoc.paths[Z],re=S8(oe,_8),me=Snt(oe.parameters??[]);for(let ke in re){let et=re[ke];if(!et||sR(et,l.options))continue;let At=et.operationId&&et.operationId!==JA(et.operationId);et.operationId&&At&&l.validationErrors.push(cnt(et.operationId));let nr=Object.entries({...me,...Snt(et.parameters??[])}).map(([,xi])=>xi),cr=FW({path:Z,method:ke,operation:et,operationsByTag:l.operationsByTag,options:l.options}),Jt=l.operationNames.filter(xi=>xi===cr).length<=1,or=XA(et,l.options),Qt={method:ke,path:_rt(Z),operationName:cr,description:et.description,summary:et.summary,tags:(m=et.tags)==null?void 0:m.map(QA),requestFormat:"application/json",parameters:[],response:"",errors:[],responseStatusCodes:[],mediaUpload:!!et["x-media-upload"],mediaDownload:!!et["x-media-download"]};if(et.requestBody){let xi=vnt({resolver:l,operation:et,operationName:cr,isUniqueOperationName:Jt,tag:or});xi&&(Qt.parameters.push(xi.endpointParameter),Qt.requestFormat=xi.requestFormat)}for(let xi of nr){let zo=bnt({resolver:l,param:xi,operationName:cr,isUniqueOperationName:Jt,tag:or});zo&&Qt.parameters.push(zo)}let zi=JVt(Qt);zi.forEach(xi=>{Qt.parameters.push(xi)}),zi.length>0&&l.validationErrors.push(lnt(zi,Z));for(let xi in et.responses){Qt.responseStatusCodes.push(xi);let zo=l.resolveObject(et.responses[xi]),tf=Object.keys(zo.content??{}).find(ile),zu,ha;if(tf?(Qt.responseFormat=tf,zu=(k=(b=zo.content)==null?void 0:b[tf])==null?void 0:k.schema):(ha=PW,xi==="200"&&l.validationErrors.push(_nt({received:"200",expected:"204"},et,Qt))),zu){let Sr=Wd({schema:zu,resolver:l,meta:{isRequired:!0},tag:or}),xs=l.resolveObject(zu);ha=oR({schema:xs,zodSchema:Sr,fallbackName:Sr.ref?void 0:gle({statusCode:xi,operationName:cr,isUniqueOperationName:Jt,tag:or}),resolver:l,tag:or})+FC({schema:xs,meta:Sr.meta,options:l.options})}if(ha){let Sr=Number(xi);xW(Sr)&&!Qt.response?(Qt.response=ha,Qt.responseObject=zo,Qt.responseDescription=zo.description):xi!=="default"&&nle(Sr)&&Qt.errors.push({zodSchema:ha,status:Sr,description:zo.description})}}Qt.response||(Qt.response=PW);let Gn=Object.keys(et.responses).map(Number).filter(xW);Gn.length>1&&l.validationErrors.push(pnt(Gn.map(String),et,Qt)),Qt.acl=ynt({resolver:l,endpoint:Qt,operation:et}),(I=et.security)!=null&&I[0].Authorization&&!Qt.responseStatusCodes.includes("401")&&l.validationErrors.push(Mwe("401",et,Qt)),(L=Qt.acl)!=null&&L[0]&&!Qt.responseStatusCodes.includes("403")&&l.validationErrors.push(Mwe("403",et,Qt)),u.push(Qt)}}return u}t(xnt,"getEndpointsFromOpenAPIDoc");function Snt(l){return Object.fromEntries((l??[]).map(u=>[Vf(u)?u.$ref:u.name,u]))}t(Snt,"getParameters");function JVt(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=>qVt(m))}t(JVt,"getMissingPathParameters");function qVt(l){return{name:l,type:"Path",zodSchema:mle,parameterObject:{name:l,required:!0,in:"path",schema:{type:"string"}}}}t(qVt,"getPathParameterFromName");function Tnt(l,u){let m=zVt(l,u),b=VVt(l,m);return{refsDependencyGraph:m,deepDependencyGraph:b}}t(Tnt,"getOpenAPISchemaDependencyGraph");function zVt(l,u){let m={},b={};return l.forEach(k=>UVt({schema:u(k),fromRef:k,getSchemaByRef:u,visitedRefs:m,refsDependencyGraph:b})),b}t(zVt,"getRefsDependencyGraph");function VVt(l,u){let m={},b={},k=t((I,L)=>{b[L].add(I),u[I]&&L!==I&&u[I].forEach(Z=>{let oe=`${L}__${Z}`;m[oe]||(m[oe]=!0,k(Z,L))})},"visit");return l.forEach(I=>{let L=u[I];L&&(b[I]||(b[I]=new Set),L.forEach(Z=>k(Z,I)))}),b}t(VVt,"getDeepRefsDependencyGraph");function UVt({schema:l,fromRef:u,getSchemaByRef:m,visitedRefs:b={},refsDependencyGraph:k={}}){let I=t(L=>{if(L.type!=="reference"||!L.data)return;let{schema:Z,data:oe}=L;if(k[oe.fromRef]||(k[oe.fromRef]=new Set),k[oe.fromRef].add(Z.$ref),b[Z.$ref])return!0;b[oe.fromRef]=!0,Z0(m(Z.$ref),{data:{fromRef:Z.$ref},onSchema:I})},"onSchema");return Z0(l,{data:{fromRef:u},onSchema:I}),{visitedRefs:b,refsDependencyGraph:k}}t(UVt,"getSchemaRefsDependencyGraph");function kle(l,u,m){let b=[];return Z0(u,{onSchema:t(I=>{I.type==="reference"?b.push(I.schema):Vf(I.parentSchema)&&(I.type==="property"?l.validationErrors.push(MW(`${m} has both reference and properties`)):I.type==="additionalProperties"?l.validationErrors.push(MW(`${m} has both reference and additionalProperties`)):I.type==="array"?l.validationErrors.push(MW(`${m} is both reference and array schema`)):I.type==="composite"&&l.validationErrors.push(MW(`${m} has both reference and composite keyword`)))},"onSchema")}),b}t(kle,"getSchemaRefObjs");function knt(l,u){return u.map(k=>p8(k.$ref)).reduce((k,I)=>{let L=l.dependencyGraph.deepDependencyGraph[I];return[...k,I,...Array.from(L??[])]},[])}t(knt,"getDeepSchemaRefObjs");function Cnt(l){l.extractedEnumZodSchemaData.forEach(m=>{let b=m.meta.zodSchemaNameSegments.map(I=>I[I.length-1]).filter(Boolean),k=gwe(b);if(!k)throw new Error(`No common last segment found for enum: ${m.code}`);m.zodSchemaName=AW(k,l.options.enumSuffix,l.options.schemaSuffix)});let u=0;for(;u<5&&!jwe(l);)WVt(l,u+2),u++;if(jwe(l)||l.extractedEnumZodSchemaData.filter(b=>!Ent(l,b)).forEach(b=>{b.zodSchemaName=AW(b.meta.zodSchemaNameSegments[0].map(k=>Bwe(Ip(k))).join(""),l.options.enumSuffix,l.options.schemaSuffix)}),!jwe(l))throw new Error("Failed to resolve unique names for enum zod schemas")}t(Cnt,"resolveExtractedEnumZodSchemaNames");function jwe(l){return l.extractedEnumZodSchemaData.every(u=>Ent(l,u))}t(jwe,"allExtractedEnumZodSchemaNamesAreUnique");function WVt(l,u){l.extractedEnumZodSchemaData.forEach(m=>{let b=l.extractedEnumZodSchemaData.filter(({zodSchemaName:k})=>m.zodSchemaName===k);b.length!==1&&HVt(b,u)})}t(WVt,"additionalResolveExtractedEnumZodSchemaName");function HVt(l,u=2){l.forEach(m=>{let b=m.meta.zodSchemaNameSegments.map(k=>k[k.length-u]).filter(Boolean);if(b.length===1){let k=[Bwe(Ip(b[0])),m.zodSchemaName].filter(Boolean).join("");m.zodSchemaName=k}else{let k=gwe(b),I=[k?Bwe(Ip(k)):"",m.zodSchemaName].filter(Boolean).join("");m.zodSchemaName=I}})}t(HVt,"suffixWithPreviousSegmentName");function Ent(l,u){return l.extractedEnumZodSchemaData.filter(({zodSchemaName:m})=>u.zodSchemaName===m).length===1}t(Ent,"isUnique");function Bwe(l){return l.replace(/(Dto|DTO|Response|Request)/g,"")}t(Bwe,"sanitizeName");function Pnt(l){l.extractedEnumZodSchemaData.forEach(u=>{let m=Db(u.meta.tags);u.tag=m.length===1?m[0]:l.options.defaultTag})}t(Pnt,"resolveExtractedEnumZodSchemaTags");function LW({schema:l,nameSegments:u=[],includeSelf:m,...b}){m&&wnt({schema:l,nameSegments:u,...b}),Z0(l,{data:{nameSegments:u},onSchema:t(I=>{var Z;if(I.type==="reference")return!0;let L=[...((Z=I.data)==null?void 0:Z.nameSegments)??[]];I.type==="property"&&L.push(I.propertyName),wnt({schema:I.schema,nameSegments:[...L],...b})},"onSchema")})}t(LW,"updateExtractedEnumZodSchemaData");function wnt({resolver:l,schema:u,schemaRef:m,schemaInfo:b,tags:k,nameSegments:I=[]}){if(!u||Vf(u)||!u.enum)return;let L=aR(u),Z=l.extractedEnumZodSchemaData.find(oe=>oe.code===L);Z?(Z.meta.zodSchemaNameSegments.push(I),Z.meta.tags.push(...k),Z.meta.schemaRefs.push(...m?[m]:[]),Z.meta.schemas.push(...u?[u]:[])):l.extractedEnumZodSchemaData.push({code:L,meta:{zodSchemaNameSegments:[I],tags:[...k],schemaRefs:m?[m]:[],schemas:u?[u]:[]}}),l.validationErrors.push(unt(m?`${KM(m)}.${I[I.length-1]}`:b??I.join(".")))}t(wnt,"handleExtractedEnumZodSchemaDataUpdate");function Ant(l){var b;let u={},m={};return Object.entries(((b=l.openApiDoc.components)==null?void 0:b.schemas)??{}).forEach(([k,I])=>{let L=l.getSchemaDataByName(k);if(l.options.excludeRedundantZodSchemas&&(!L||L.deepRefOperations.length===0&&L.tags.length===0))return;let Z=g8(k,l.options.schemaSuffix);if(u[Z])return;let oe=l.getTagByZodSchemaName(Z),re=l.resolveObject(I);re.enum?m[Z]=aR(re):u[Z]=Wd({schema:I,resolver:l,tag:oe}).getCodeString(oe)}),{zodSchemas:u,enumZodSchemas:m}}t(Ant,"getZodSchemasFromOpenAPIDoc");function Dnt(l){var m;let u=[];return Object.entries(((m=l.openApiDoc.components)==null?void 0:m.schemas)??{}).forEach(([b,k])=>{let I=g8(b,l.options.schemaSuffix),L=l.resolveObject(k);!u.find(Z=>Z.zodSchemaName===I)&&L.enum&&u.push({zodSchemaName:I,code:aR(L)})}),u}t(Dnt,"getEnumZodSchemasFromOpenAPIDoc");var $we=class $we{constructor(u,m){this.openApiDoc=u;this.options=m;this.dependencyGraph=Tnt(this.schemaRefs,this.getSchemaByRef.bind(this)),this.enumZodSchemas=Dnt(this),this.operationsByTag=ont(u,m),this.operationNames=ant(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(crt)}getSchemaByRef(u){return this.docSchemas[KM(u)]}getSchemaDataByName(u){return this.schemaData.find(m=>m.name===u)}getZodSchemaNameByRef(u){var b,k;let m=((b=this.getSchemaDataByRef(p8(u)))==null?void 0:b.zodSchemaName)??((k=this.extractedEnumZodSchemaData.find(I=>I.zodSchemaName===u))==null?void 0:k.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 oe,re;if(!this.options.splitByTags)return this.options.defaultTag;let m=this.extractedEnumZodSchemaData.find(me=>me.zodSchemaName===u);if(m)return QA(m.tag??this.options.defaultTag);let b=this.getRefByZodSchemaName(u),k=b?((oe=this.getSchemaDataByRef(b))==null?void 0:oe.tags)??[]:[],I=((re=this.zodSchemaData.find(me=>me.zodSchemaName===u))==null?void 0:re.tags)??[],L=Db(k,I),Z=L.length===1?L[0]:this.options.defaultTag;return QA(Z??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 k=this.zodSchemaData.find(I=>I.zodSchemaName===u);k?(k.code=m,k.tags=(k.tags??[]).concat(b)):this.zodSchemaData.push({zodSchemaName:u,code:m,tags:[b]})}addZodSchemaForCompositeCode(u,m,b,k){let I={zodSchemaName:b,zodSchema:m,schema:k},L=this.compositeZodSchemaData.find(Z=>Z.code===u);L?L.zodSchemas.push(I):this.compositeZodSchemaData.push({code:u,zodSchemas:[I]})}getCompositeZodSchemaByZodSchemaName(u){var b;let m=this.compositeZodSchemaData.find(k=>k.zodSchemas.some(I=>I.zodSchemaName===u));return(b=m==null?void 0:m.zodSchemas.find(k=>k.zodSchemaName===u))==null?void 0:b.zodSchema}getSchemaByCompositeZodSchemaName(u){var m,b;return(b=(m=this.compositeZodSchemaData.find(k=>k.zodSchemas.some(I=>I.zodSchemaName===u)))==null?void 0:m.zodSchemas.find(k=>k.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:k})=>(b&&k.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 Vf(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=[],k=[]){var I,L;return k.includes(m)?[]:(k.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(Z=>{let oe=this.getCircularSchemaChain(u,Z,b,k);return oe.length>0?[m,...oe]:oe}).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 k=this.getExtractedEnumZodSchemaDataByName(u);if(k)return k.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,k,I;this.schemaRefs.forEach(L=>{let Z=p8(L),oe=KM(Z),re=g8(oe,this.options.schemaSuffix);this.schemaData.push({ref:Z,name:oe,zodSchemaName:re,tags:[],deepRefOperations:[]})});for(let L in this.openApiDoc.paths){if(m8(L,this.options))continue;let Z=this.openApiDoc.paths[L],oe=S8(Z,_8);for(let re in oe){let me=oe[re];if(!me||sR(me,this.options))continue;let ke=XA(me,this.options),et=FW({path:L,method:re,operation:me,operationsByTag:this.operationsByTag,options:this.options}),At=this.operationNames.filter(or=>or===et).length<=1,nr=ty(y8(et,At,ke)),cr=[];if((u=me.parameters)==null||u.map(or=>{let Qt=or,zi=Qt.schema,Gn=`Operation ${me.operationId??L} parameter ${Qt.name}`;cr.push(...kle(this,zi,Gn)),this.options.extractEnums&&LW({resolver:this,schema:zi,schemaInfo:Gn,tags:[ke],nameSegments:[nr,Qt.name],includeSelf:!0})}),me.requestBody){let or=this.resolveObject(me.requestBody),zi=Object.keys(or.content??{}).find(OC);if(zi){let Gn=(b=(m=or.content)==null?void 0:m[zi])==null?void 0:b.schema,xi=`Operation ${me.operationId} request body`;cr.push(...kle(this,Gn,xi)),this.options.extractEnums&&LW({resolver:this,schema:Gn,schemaInfo:xi,tags:[ke],nameSegments:[hle(nr)]})}}for(let or in me.responses){let Qt=this.resolveObject(me.responses[or]),Gn=Object.keys(Qt.content??{}).find(ile);if(Gn){let xi=(I=(k=Qt.content)==null?void 0:k[Gn])==null?void 0:I.schema,zo=`Operation ${me.operationId} response body`;cr.push(...kle(this,xi,zo)),this.options.extractEnums&&LW({resolver:this,schema:xi,schemaInfo:zo,tags:[ke],nameSegments:[gle({statusCode:or,operationName:et,isUniqueOperationName:At,tag:ke})]})}}knt(this,cr).forEach(or=>{let Qt=this.getSchemaDataByRef(or);Qt&&(Qt.tags.push(ke),Qt.deepRefOperations.push(me))})}}this.options.extractEnums&&(this.schemaRefs.forEach(L=>{var oe;let Z=p8(L);LW({resolver:this,schema:this.getSchemaByRef(Z),schemaRef:Z,tags:((oe=this.getSchemaDataByRef(Z))==null?void 0:oe.tags)??[],nameSegments:[KM(Z)]})}),Pnt(this),this.handleDuplicateEnumZodSchemas(),Cnt(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,Z;let k=(L=m.find(({zodSchemaName:oe})=>oe===b.zodSchemaName))==null?void 0:L.code;if(!k)return;let I=this.extractedEnumZodSchemaData.find(({code:oe})=>oe===k);!I||((Z=this.getEnumZodSchemaDataByCode(I.code))==null?void 0:Z.zodSchemaName)!==b.zodSchemaName||(b.tags.push(...I.meta.tags??[]),I.meta.schemaRefs.forEach(oe=>{this.dependencyGraph.refsDependencyGraph[oe]||(this.dependencyGraph.refsDependencyGraph[oe]=new Set),this.dependencyGraph.refsDependencyGraph[oe].add(b.ref),this.dependencyGraph.deepDependencyGraph[oe]||(this.dependencyGraph.deepDependencyGraph[oe]=new Set),this.dependencyGraph.deepDependencyGraph[oe].add(b.ref)}))}),this.extractedEnumZodSchemaData.splice(0,this.extractedEnumZodSchemaData.length,...this.extractedEnumZodSchemaData.filter(({code:b})=>!u.includes(b)))}};t($we,"SchemaResolver");var Cle=$we;function Int(l){let u=[],m={};function b(k,I){Array.isArray(I)||(I=[]),I.push(k),m[k]=!0,l[k]&&l[k].forEach(L=>{I.includes(L)||m[L]||b(L,I.slice(0))}),u.includes(k)||u.push(k)}return t(b,"visit"),Object.keys(l).forEach(k=>b(k,[])),u}t(Int,"topologicalSort");function Nnt(l,u){let m=Object.entries(l),b=m.filter(([k])=>u.includes(k)).sort(([k],[I])=>u.indexOf(k)-u.indexOf(I)).concat(m.filter(([k])=>!u.includes(k)));return Object.fromEntries(b)}t(Nnt,"sortObjKeysFromArray");function Ont(l,u){let m=Int(l.dependencyGraph.deepDependencyGraph).map(k=>l.getZodSchemaNameByRef(k));return Nnt(u,m)}t(Ont,"sortZodSchemasByTopology");function Ele(l,u){let m=new Cle(l,u),b=xnt(m),k=Ant(m),I={...k.zodSchemas,...m.getZodSchemas(),...k.enumZodSchemas};return I=Ont(m,I),I={...m.getExtractedEnumZodSchemas(),...I},{resolver:m,data:GVt({resolver:m,endpoints:b,zodSchemas:I,options:u})}}t(Ele,"getDataFromOpenAPIDoc");function GVt({resolver:l,endpoints:u,zodSchemas:m,options:b}){let k=new Map;return b.splitByTags?(u.forEach(I=>{let L=t3(I,b);Fnt(L,k).endpoints.push(I)}),Object.entries(m).forEach(([I,L])=>{let Z=l.getTagByZodSchemaName(I);Z&&(Fnt(Z,k).zodSchemas[I]=L)}),k):(k.set(b.defaultTag,{endpoints:u,zodSchemas:m}),k)}t(GVt,"splitDataByTags");function Fnt(l,u){return u.has(l)||u.set(l,{endpoints:[],zodSchemas:{}}),u.get(l)}t(Fnt,"getTagElement");var cR=Zm(require("fs")),Jwe=Zm(require("path"));function Mnt(l){return cR.default.readFileSync(Jwe.default.join(__dirname,`../${l}`),"utf-8")}t(Mnt,"readFileSync");function qwe(l){let u=`src/generators/templates/${l}.hbs`;return Mnt(u)}t(qwe,"readHbsTemplateSync");function Rnt(l){let u=`src/assets/${l}`;return Mnt(u)}t(Rnt,"readAssetSync");function uT({output:l,fileName:u}){return`${l}/${u}`}t(uT,"getOutputFileName");function ZVt(l,u){let m=Jwe.default.dirname(l);cR.default.existsSync(m)||cR.default.mkdirSync(m,{recursive:!0}),cR.default.writeFileSync(l,u,"utf-8")}t(ZVt,"writeFileWithDirSync");function QVt({fileName:l,content:u}){ZVt(l,u)}t(QVt,"writeFileSync");function Lnt(l){l.forEach(QVt)}t(Lnt,"writeGenerateFileData");function jnt(l,u){let{resolver:m,data:b}=Ele(l,u);if(m.validationErrors.length>0){let k=dnt(m.validationErrors);Object.entries(k).forEach(([I,L])=>{hEe(`${xA.red(`${Wtt[I]}:`)}
530
530
  ${L.map(Z=>`- ${Z}`).join(`
531
531
  `)}
532
532
  `)})}else{let k=[...b.keys()].reduce((I,L)=>[...I,...XVt(L,u)],[]);hEe(`${xA.green("Outputs:")}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@povio/openapi-codegen-cli",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "main": "./dist/index.js",
5
5
  "bin": {
6
6
  "openapi-codegen": "./dist/sh.js"