@hey-api/openapi-ts 0.85.1 → 0.85.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/bin/index.cjs +3 -2
- package/dist/chunk-F2CVRHGI.js +47 -0
- package/dist/chunk-F2CVRHGI.js.map +1 -0
- package/dist/index.cjs +21 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +41 -31
- package/dist/index.d.ts +41 -31
- package/dist/index.js +44 -54
- package/dist/index.js.map +1 -1
- package/dist/internal.cjs +14 -14
- package/dist/internal.cjs.map +1 -1
- package/dist/internal.d.cts +1 -1
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/dist/{types.d-DIu3K5QP.d.cts → types.d-CGoxqmT9.d.cts} +11 -0
- package/dist/{types.d-DIu3K5QP.d.ts → types.d-CGoxqmT9.d.ts} +11 -0
- package/package.json +3 -3
- package/dist/chunk-SA4IKOSG.js +0 -47
- package/dist/chunk-SA4IKOSG.js.map +0 -1
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {createRequire}from'module';import ye from'node:fs';import L from'node:path';import ge from'ansi-colors';import {fileURLToPath}from'node:url';import S from'typescript';import {EOL}from'os';import*as In from'semver';import {Project,createBinding,mergeBindings,renderIds}from'@hey-api/codegen-core';import {getResolvedInput,sendRequest}from'@hey-api/json-schema-ref-parser';const require = createRequire(import.meta.url);
|
|
2
|
+
var Fm=Object.create;var Ii=Object.defineProperty;var Bm=Object.getOwnPropertyDescriptor;var Km=Object.getOwnPropertyNames;var Wm=Object.getPrototypeOf,zm=Object.prototype.hasOwnProperty;var ki=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var fh=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var _m=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Km(t))!zm.call(e,o)&&o!==r&&Ii(e,o,{get:()=>t[o],enumerable:!(n=Bm(t,o))||n.enumerable});return e};var dh=(e,t,r)=>(r=e!=null?Fm(Wm(e)):{},_m(t||!e||!e.__esModule?Ii(r,"default",{value:e,enumerable:true}):r,e));var Qm=fileURLToPath(import.meta.url),To=L.dirname(Qm),Zm=()=>{let e=To;for(;e!==L.dirname(e);){let r=ye.readdirSync(e).filter(n=>n==="package.json");if(r[0]){let n=L.join(e,r[0]);return JSON.parse(ye.readFileSync(n,{encoding:"utf8"}))}e=L.dirname(e);}},ji=()=>{let e=Zm(),t={bugs:{url:""},name:"",version:""};return e&&typeof e=="object"&&("name"in e&&typeof e.name=="string"&&(t.name=e.name),"version"in e&&typeof e.version=="string"&&(t.version=e.version),"bugs"in e&&e.bugs&&typeof e.bugs=="object"&&"url"in e.bugs&&typeof e.bugs.url=="string"&&(t.bugs.url=e.bugs.url,t.bugs.url&&!t.bugs.url.endsWith("/")&&(t.bugs.url+="/"))),t},Ci=e=>{if(e===null)return null;if(e){let r=L.isAbsolute(e)?e:L.resolve(To,e);return ye.existsSync(r)?r:null}let t=To;for(;t!==L.dirname(t);){let n=ye.readdirSync(t).filter(o=>o.startsWith("tsconfig")&&o.endsWith(".json")).sort(o=>o==="tsconfig.json"?-1:1);if(n[0])return L.join(t,n[0]);t=L.dirname(t);}return null},Ni=e=>{if(!e)return null;let t=S.readConfigFile(e,S.sys.readFile);if(t.error)throw new Error(`Couldn't read tsconfig from path: ${e}`);return S.parseJsonConfigFileContent(t.config,S.sys,L.dirname(e))};var it=e=>{ye.existsSync(e)||ye.mkdirSync(e,{recursive:true});},Oh=e=>{ye.existsSync(e)&&ye.rmSync(e,{force:true,recursive:true});},nr=({moduleOutput:e,sourceOutput:t})=>{let r=t.split("/");return `${Array.from({length:r.length}).fill("").join("../")||"./"}${e}`};var qt=class extends Error{constructor(t){super(t),this.name="ConfigError";}},Fr=class extends Error{errors;constructor(t){super(`Found ${t.length} configuration ${t.length===1?"error":"errors"}.`),this.name="ConfigValidationError",this.errors=t;}},Br=class extends Error{originalError;constructor(t,r){super(t),this.name="JobError",this.originalError=r;}},sr=class extends Error{args;event;pluginName;constructor({args:t,error:r,event:n,name:o,pluginName:i}){let a=r instanceof Error?r.message:"Unknown error";super(a),this.args=t,this.cause=r.cause,this.event=n,this.name=o||r.name,this.pluginName=i,this.stack=r.stack;}},kh=(e,t)=>{if(e instanceof qt||e instanceof Fr)return;e instanceof Br&&(e=e.originalError.error);let r=`openapi-ts-error-${Date.now()}.log`,n=L.resolve(process.cwd(),t);it(n);let o=L.resolve(n,r),i=`[${new Date().toISOString()}] `;e instanceof sr&&(i+=`${e.name} during event "${e.event}"
|
|
3
|
+
`,e.pluginName&&(i+=`Plugin: ${e.pluginName}
|
|
4
|
+
`),i+=`Arguments: ${JSON.stringify(e.args,null,2)}
|
|
5
|
+
|
|
6
|
+
`);let a=e instanceof Error?e.message:String(e),p=e instanceof Error?e.stack:void 0;return i+=`Error: ${a}
|
|
7
|
+
`,p&&(i+=`Stack:
|
|
8
|
+
${p}
|
|
9
|
+
`),ye.writeFileSync(o,i),o},jh=async e=>{let t=ji();if(!t.bugs.url)return;e instanceof Br&&(e=e.originalError.error);let r="";e instanceof sr&&(e.pluginName&&(r+=`**Plugin**: \`${e.pluginName}\`
|
|
10
|
+
`),r+=`**Event**: \`${e.event}\`
|
|
11
|
+
`,r+=`**Arguments**:
|
|
12
|
+
\`\`\`ts
|
|
13
|
+
${JSON.stringify(e.args,null,2)}
|
|
14
|
+
\`\`\`
|
|
15
|
+
|
|
16
|
+
`);let n=e instanceof Error?e.message:String(e),o=e instanceof Error?e.stack:void 0;r+=`**Error**: \`${n}\`
|
|
17
|
+
`,o&&(r+=`
|
|
18
|
+
**Stack Trace**:
|
|
19
|
+
\`\`\`
|
|
20
|
+
${o}
|
|
21
|
+
\`\`\``);let i=new URLSearchParams({body:r,labels:"bug \u{1F525}",title:"Crash Report"}),a=`${t.bugs.url}new?${i.toString()}`,p=(await import('open')).default;await p(a);},Ch=({error:e,logPath:t})=>{if(e instanceof Fr&&e.errors.length){let r=new Map;for(let{error:n,jobIndex:o}of e.errors)r.has(o)||r.set(o,[]),r.get(o).push(n);for(let[n,o]of r.entries()){let i=ge.gray(`[Job ${n+1}] `),a=o.length,p=ge.red(`Found ${a} configuration ${a===1?"error":"errors"}:`);console.error(`${i}\u2757\uFE0F ${p}`),o.forEach((c,m)=>{let l=` [${m+1}] `,f=ge.red(l);console.error(`${i}${f}${ge.white(c.message)}`);});}}else {let r=ge.gray("[root] ");e instanceof Br&&(r=ge.gray(`[Job ${e.originalError.jobIndex+1}] `),e=e.originalError.error);let n=ge.red("Failed with the message:");console.error(`${r}\u274C ${n}`);let i=ge.red(" ");console.error(`${r}${i}${typeof e=="string"?e:e instanceof Error?e.message:"Unknown error"}`);}if(t){let r=ge.gray("[root] ");console.error(`${r}${ge.cyan("\u{1F4C4} Crash log saved to:")} ${ge.gray(t)}`);}},Nh=async({error:e,isInteractive:t})=>!t||e instanceof qt||e instanceof Fr?false:new Promise(r=>{let n=ge.gray("[root] ");console.log(`${n}${ge.yellow("\u{1F4E2} Open a GitHub issue with crash details? (y/N):")}`),process.stdin.setEncoding("utf8"),process.stdin.once("data",o=>{r(o.trim().toLowerCase()==="y");});});var wi=e=>{let t={file:true,level:"info",path:process.cwd()};return typeof e?.logs=="string"?t.path=e.logs:t={...t,...e?.logs},t};var Xm=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)&&typeof e!="function",or=(e,t)=>{for(let[r,n]of Object.entries(t))n!==void 0&&n!==""&&(e[r]=n);return e},xe=({defaultValue:e,mappers:t,value:r})=>{let n={...e};switch(typeof r){case "boolean":if(t&&"boolean"in t){let o=t.boolean;n=or(n,o(r));}break;case "function":if(t&&"function"in t){let o=t.function;n=or(n,o(r));}break;case "number":if(t&&"number"in t){let o=t.number;n=or(n,o(r));}break;case "string":if(t&&"string"in t){let o=t.string;n=or(n,o(r));}break;case "object":if(Xm(r))if(t&&"object"in t&&typeof t.object=="function"){let o=t.object;n=or(n,o(r,e));}else n=or(n,r);break}return n};var Jm=["after","before","cursor","offset","page","start"],qi=e=>xe({defaultValue:{hooks:{},pagination:{keywords:Jm},transforms:{enums:{case:"PascalCase",enabled:false,mode:"root",name:"{{name}}Enum"},propertiesRequiredByDefault:false,readWrite:{enabled:true,requests:{case:"preserve",name:"{{name}}Writable"},responses:{case:"preserve",name:"{{name}}"}}},validate_EXPERIMENTAL:false},mappers:{object:(r,n)=>({...r,pagination:xe({defaultValue:{...n.pagination},value:r.pagination}),transforms:xe({defaultValue:{...n.transforms},mappers:{object:(o,i)=>({...o,enums:xe({defaultValue:{...i.enums,enabled:o.enums!==void 0?!!o.enums:i.enums.enabled},mappers:{boolean:a=>({enabled:a}),string:a=>({mode:a})},value:o.enums}),propertiesRequiredByDefault:o.propertiesRequiredByDefault!==void 0?o.propertiesRequiredByDefault:i.propertiesRequiredByDefault,readWrite:xe({defaultValue:{...i.readWrite,enabled:o.readWrite!==void 0?!!o.readWrite:i.readWrite.enabled},mappers:{boolean:a=>({enabled:a}),object:(a,p)=>({...a,requests:xe({defaultValue:{...p.requests},mappers:{function:c=>({name:c}),string:c=>({name:c})},value:a.requests}),responses:xe({defaultValue:{...p.responses},mappers:{function:c=>({name:c}),string:c=>({name:c})},value:a.responses})})},value:o.readWrite})})},value:r.transforms}),validate_EXPERIMENTAL:r.validate_EXPERIMENTAL===true?"warn":r.validate_EXPERIMENTAL})},value:e.parser});var R=e=>t=>({...e,config:{...e.config,...t}}),De={boolean:e=>({enabled:e}),function:e=>({name:e}),string:e=>({name:e})};var ir=/^[^$_\p{ID_Start}]+/u,ee=/^-?\d+(\.\d+)?$/,$i=/^(document|history|location|navigator|window)$/g,Mi=/^(console|Array|Date|Error|Function|JSON|Map|Math|Object|Promise|RegExp|Set|WeakMap|WeakSet)$/g,le=/^(arguments|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|eval|export|extends|false|finally|for|from|function|if|implements|import|in|instanceof|interface|let|new|null|package|private|protected|public|return|static|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)$/g,Li=/^(global|process|Buffer)$/g,Vi=/^(any|as|bigint|boolean|namespace|never|null|number|string|symbol|type|undefined|unknown|void)$/g,ve=/^[$_\p{ID_Start}][$\u200c\u200d\p{ID_Continue}]*$/u;var Te=e=>(e||e==="")&&(ve.lastIndex=0,!ve.test(e))?`'${e}'`:e,ar=e=>e&&e.startsWith("'")&&e.endsWith("'")?e.slice(1,e.length-1):e,z=e=>e.replace(/\*\//g,"*").replace(/\/\*/g,"*").replace(/\r?\n(.*)/g,(t,r)=>EOL+r.trim());var fe=e=>{let t=k(e);return t.name==="@hey-api/client-axios"||t.name==="@hey-api/client-nuxt"?"baseURL":"baseUrl"},k=e=>{for(let t of e.pluginOrder){let r=e.plugins[t];if(r?.tags?.includes("client"))return r}return {config:{name:""},name:""}};var Di,A=()=>{let e=Di,t=k(e);return e.client=t,e},Fi=e=>(Di=e,A()),Q=e=>k(e).name.startsWith("legacy/"),$t=e=>{if(Q(e))return e.name};var Ym=S.createPrinter({newLine:S.NewLineKind.LineFeed,removeComments:false}),el=e=>S.createSourceFile("",e,S.ScriptTarget.ESNext,false,S.ScriptKind.TS),tl=el(""),rl=e=>e.replace(/\\u([0-9a-fA-F]{4})/g,(t,r)=>String.fromCharCode(Number.parseInt(r,16)));function ce({node:e,unescape:t=false}){let r=Ym.printNode(S.EmitHint.Unspecified,e,tl);if(!t)return r;try{return rl(r)}catch{return A().logs.level==="debug"&&console.warn("Could not decode value:",r),r}}var E=({text:e})=>S.factory.createIdentifier(e),Bi=()=>S.factory.createThis(),X=({keyword:e})=>{let t=Ro({keyword:e});return S.factory.createModifier(t)},Ki=({initializer:e,modifier:t,name:r,type:n})=>S.factory.createPropertyDeclaration(t?[X({keyword:t})]:void 0,r,void 0,n,e),be={boolean:e=>e?S.factory.createTrue():S.factory.createFalse(),export:({alias:e,asType:t=false,name:r})=>{let n=E({text:r});if(e){let o=E({text:e});return S.factory.createExportSpecifier(t,n,o)}return S.factory.createExportSpecifier(t,void 0,n)},import:({alias:e,asType:t=false,name:r})=>{let n=E({text:r});if(e){let o=E({text:e});return S.factory.createImportSpecifier(t,n,o)}return S.factory.createImportSpecifier(t,void 0,n)},number:e=>e<0?S.factory.createPrefixUnaryExpression(S.SyntaxKind.MinusToken,S.factory.createNumericLiteral(Math.abs(e))):S.factory.createNumericLiteral(e),string:(e,t=false)=>{let r=e;t&&(r=ar(r));let n=r.includes("'")&&r.includes('"'),o=r.includes(`
|
|
22
|
+
`),i=r.startsWith("`"),a=r.startsWith("\\`")&&r.endsWith("\\`");return (o||n||i)&&!a&&(r=`\`${r.replace(/(?<!\\)`/g,"\\`").replace(/\${/g,"\\${")}\``),r.startsWith("`")?E({text:r}):Lt({text:r})}},Mt=e=>e!==null&&typeof e=="object"&&typeof e.kind=="number"&&typeof e.flags=="number"&&typeof e.pos=="number"&&typeof e.end=="number",At=e=>e!==void 0,nl=({commentObject:e,node:t})=>{let r=e.lines.filter(a=>!!a||a==="");if(!r.length)return;if(!e.jsdoc){for(let a of r)S.addSyntheticLeadingComment(t,S.SyntaxKind.SingleLineCommentTrivia,` ${a}`,true);return}let n=r.map((a,p)=>{let c=a;return p!==r.length&&(c=`${c}
|
|
23
|
+
`),S.factory.createJSDocText(c)}),o=S.factory.createJSDocComment(S.factory.createNodeArray(n),void 0),i=ce({node:o,unescape:true}).replace("/*","").replace("* */","");S.addSyntheticLeadingComment(t,S.SyntaxKind.MultiLineCommentTrivia,i,true);},se=({comments:e=[],node:t})=>{let r=!!e.find(o=>typeof o=="object"&&o),n=e;r||(n=[{jsdoc:true,lines:e}]);for(let o of n)nl({commentObject:o,node:t});};var oe=(e,t)=>S.isTypeNode(e)?e:typeof e=="number"?S.factory.createLiteralTypeNode(be.number(e)):Re({typeArguments:t?.map(r=>oe(r)),typeName:S.isIdentifier(e)?e.text:e}),Ao=({expression:e,name:t})=>S.factory.createPropertyAccessChain(e,S.factory.createToken(S.SyntaxKind.QuestionDotToken),t),Be=({expression:e,isOptional:t,name:r})=>{let n=typeof e=="string"?E({text:e}):e;if(t&&typeof r!="number")return Ao({expression:n,name:r});if(typeof r=="string"){if(ve.lastIndex=0,!ve.test(r)){!r.startsWith("'")&&!r.endsWith("'")&&(r=`'${r}'`);let i=E({text:r});return S.factory.createElementAccessExpression(n,i)}let o=E({text:r});return S.factory.createPropertyAccessExpression(n,o)}if(typeof r=="number"){let o=S.factory.createNumericLiteral(r);return S.factory.createElementAccessExpression(n,o)}return S.factory.createPropertyAccessExpression(n,r)},Po=()=>S.factory.createNull(),Fe=({identifiers:e=[],isValueAccess:t,shorthand:r,unescape:n,value:o})=>{if(o===null)return Po();if(Array.isArray(o))return Eo({elements:o});if(typeof o=="object")return Rn({identifiers:e,obj:o,shorthand:r});if(typeof o=="number")return be.number(o);if(typeof o=="boolean")return be.boolean(o);if(typeof o=="string"){if(t){let i=o.split(".");return Be({expression:i[0],name:i[1]})}return be.string(o,n)}},Kr=e=>e.map(t=>{if("destructure"in t)return pr({name:S.factory.createObjectBindingPattern(t.destructure.map(n=>"destructure"in n?void 0:S.factory.createBindingElement(void 0,void 0,E({text:n.name}),void 0)).filter(Boolean)),type:t.type!==void 0?oe(t.type):void 0});let r=t.accessLevel?[X({keyword:t.accessLevel})]:[];return t.isReadOnly&&r.push(X({keyword:"readonly"})),pr({initializer:t.default!==void 0?Fe({value:t.default}):void 0,modifiers:r,name:E({text:t.name}),required:t.isRequired!==false,type:t.type!==void 0?oe(t.type):void 0})}),Ro=({keyword:e})=>{switch(e){case "any":return S.SyntaxKind.AnyKeyword;case "async":return S.SyntaxKind.AsyncKeyword;case "boolean":return S.SyntaxKind.BooleanKeyword;case "export":return S.SyntaxKind.ExportKeyword;case "never":return S.SyntaxKind.NeverKeyword;case "number":return S.SyntaxKind.NumberKeyword;case "private":return S.SyntaxKind.PrivateKeyword;case "protected":return S.SyntaxKind.ProtectedKeyword;case "public":return S.SyntaxKind.PublicKeyword;case "readonly":return S.SyntaxKind.ReadonlyKeyword;case "static":return S.SyntaxKind.StaticKeyword;case "string":return S.SyntaxKind.StringKeyword;case "undefined":return S.SyntaxKind.UndefinedKeyword;case "unknown":return S.SyntaxKind.UnknownKeyword;case "void":return S.SyntaxKind.VoidKeyword;default:throw new Error(`unsupported syntax kind keyword "${e}"`)}},Vt=({keyword:e})=>{let t=Ro({keyword:e});return S.factory.createKeywordTypeNode(t)},Wr=e=>e.map(t=>S.isTypeParameterDeclaration(t)?t:zr({constraint:t.extends?typeof t.extends=="string"?Vt({keyword:"boolean"}):t.extends:void 0,defaultType:t.default!==void 0?Mt(t.default)?t.default:S.factory.createLiteralTypeNode(t.default?S.factory.createTrue():S.factory.createFalse()):void 0,name:t.name})),Wi=({operator:e,type:t})=>{let r=e==="keyof"?S.SyntaxKind.KeyOfKeyword:e==="readonly"?S.SyntaxKind.ReadonlyKeyword:S.SyntaxKind.UniqueKeyword;return S.factory.createTypeOperatorNode(r,t)},zr=({constraint:e,defaultType:t,modifiers:r,name:n})=>S.factory.createTypeParameterDeclaration(r,n,e,t),On=({members:e,nameType:t,questionToken:r,readonlyToken:n,type:o,typeParameter:i})=>S.factory.createMappedTypeNode(n,i,t,r,o,e),zi=({literal:e})=>S.factory.createLiteralTypeNode(e),Tn=({async:e,comment:t,multiLine:r,parameters:n=[],returnType:o,statements:i=[],types:a=[]})=>{let p=S.factory.createArrowFunction(e?[X({keyword:"async"})]:void 0,a?Wr(a):void 0,Kr(n),o?oe(o):void 0,void 0,Array.isArray(i)?Se({multiLine:r,statements:i}):i);return se({comments:t,node:p}),p},_i=({async:e,comment:t,multiLine:r,parameters:n=[],returnType:o,statements:i=[],types:a=[]})=>{let p=S.factory.createFunctionExpression(e?[X({keyword:"async"})]:void 0,void 0,void 0,a?Wr(a):void 0,Kr(n),o?oe(o):void 0,Se({multiLine:r,statements:i}));return se({comments:t,node:p}),p},Eo=({elements:e,multiLine:t=false})=>S.factory.createArrayLiteralExpression(e.map(n=>Mt(n)?n:Fe({value:n})).filter(At),t||!Array.isArray(e[0])&&typeof e[0]=="object"),Hi=({expression:e})=>S.factory.createAwaitExpression(e),Qi=({parameters:e=[],returnType:t,typeParameters:r})=>S.factory.createFunctionTypeNode(r,e,t),Rn=({comments:e,identifiers:t=[],multiLine:r=true,obj:n,shorthand:o,unescape:i=false})=>{let a=Array.isArray(n)?n.map(c=>{let m=false;if("key"in c){let{key:f}=c;m=f===c.value,(f.match(/^[0-9]/)&&f.match(/\D+/g)||f.match(/\W/g)||f==="")&&!f.startsWith("'")&&!f.endsWith("'")&&(c.key=`'${f}'`);}let l;if("spread"in c){let f=Mt(c.spread)?c.spread:E({text:c.spread});l=S.factory.createSpreadAssignment(c.assertion?Hr({expression:f,type:typeof c.assertion=="string"?Vt({keyword:c.assertion}):c.assertion}):f);}else if(c.shorthand||o&&m)l=S.factory.createShorthandPropertyAssignment(c.value);else {let f=Mt(c.value)?c.value:Array.isArray(c.value)&&(!c.value.length||typeof c.value[0]=="object")?Rn({multiLine:r,obj:c.value,shorthand:o,unescape:i}):Fe({identifiers:t.includes(c.key)?Object.keys(c.value):[],isValueAccess:c.isValueAccess,shorthand:o,unescape:i,value:c.value});if(!f)return;t.includes(c.key)&&!S.isObjectLiteralExpression(f)&&(f=E({text:c.value})),l=Sn({initializer:f,name:c.key});}return se({comments:c.comments,node:l}),l}).filter(At):Object.entries(n).map(([c,m])=>{let l=Fe({identifiers:t.includes(c)?Object.keys(m):[],shorthand:o,unescape:i,value:m});if(!l)return;t.includes(c)&&!S.isObjectLiteralExpression(l)&&(l=E({text:m}));let f=c===m;return c.match(/^[0-9]/)&&c.match(/\D+/g)&&!c.startsWith("'")&&!c.endsWith("'")&&(c=`'${c}'`),c.match(/\W/g)&&!c.startsWith("'")&&!c.endsWith("'")&&(c=`'${c}'`),o&&f?S.factory.createShorthandPropertyAssignment(m):Sn({initializer:l,name:c})}).filter(At),p=S.factory.createObjectLiteralExpression(a,r);return se({comments:e,node:p}),p},Zi=({asConst:e,comments:t={},leadingComment:r,name:n,obj:o})=>{let i=Array.isArray(o)?o.map(l=>{let f=ol({initializer:Fe({value:l.value}),name:l.key});return se({comments:l.comments,node:f}),f}):Object.entries(o).map(([l,f])=>{let d=S.factory.createEnumMember(l,Fe({unescape:true,value:f}));return se({comments:t[l],node:d}),d}),a=[X({keyword:"export"})],p=e?[S.factory.createToken(S.SyntaxKind.ConstKeyword)]:[],c=[...a,...p],m=S.factory.createEnumDeclaration(c,typeof n=="string"?E({text:n}):n,i);return se({comments:r,node:m}),m},ol=({initializer:e,name:t})=>{let r=t;return typeof r=="string"&&(r.includes("'")?r=Lt({isSingleQuote:false,text:r}):r=Te(r)),S.factory.createEnumMember(r,e)},Ui=({name:e,statements:t})=>S.factory.createModuleDeclaration([X({keyword:"export"})],E({text:e}),S.factory.createModuleBlock(t),S.NodeFlags.Namespace),Xi=({indexType:e,objectType:t})=>S.factory.createIndexedAccessTypeNode(t,e),Ji=({name:e,returnType:t,statements:r})=>S.factory.createGetAccessorDeclaration(void 0,e,[],t?Re({typeName:t}):void 0,Se({statements:r})),Lt=({isSingleQuote:e,text:t})=>(e===void 0&&(e=!t.includes("'")),S.factory.createStringLiteral(t,e)),Gi=({condition:e,whenFalse:t,whenTrue:r})=>S.factory.createConditionalExpression(e,S.factory.createToken(S.SyntaxKind.QuestionToken),r,S.factory.createToken(S.SyntaxKind.ColonToken),t),Yi=({text:e})=>S.factory.createTypeOfExpression(typeof e=="string"?E({text:e}):e),ea=({comment:e,exportType:t,name:r,type:n,typeParameters:o=[]})=>{let i=S.factory.createTypeAliasDeclaration(t?[X({keyword:"export"})]:void 0,typeof r=="string"?E({text:r}):r,Wr(o),oe(n));return se({comments:e,node:i}),i},Re=({typeArguments:e,typeName:t})=>S.factory.createTypeReferenceNode(t,e),ta=({type:e})=>S.factory.createParenthesizedType(e),pr=({initializer:e,modifiers:t,name:r,required:n=true,type:o})=>S.factory.createParameterDeclaration(t,void 0,r,n?void 0:S.factory.createToken(S.SyntaxKind.QuestionToken),o,e),_r=({argumentsArray:e,expression:t,typeArguments:r})=>S.factory.createNewExpression(t,r,e),ra=({awaitModifier:e,expression:t,initializer:r,statement:n})=>S.factory.createForOfStatement(e,r,t,n),na=({left:e,right:t})=>S.factory.createAssignment(e,t),Se=({multiLine:e=true,statements:t})=>S.factory.createBlock(t,e),Sn=({initializer:e,name:t})=>S.factory.createPropertyAssignment(t,e),sa=({flags:e=[],text:t})=>{let o=`/${(t.startsWith("/")&&t.endsWith("/")?t.slice(1,-1):t).replace(/(?<!\\)\//g,"\\/")}/`;return S.factory.createRegularExpressionLiteral(`${o}${e.join("")}`)},Hr=({expression:e,type:t})=>S.factory.createAsExpression(e,t),oa=({value:e})=>{let t=[],r="";for(let o of e.slice(0).reverse())if(typeof o=="string")r=`${o}${r}`;else {let i=t.length?S.factory.createTemplateMiddle(r):S.factory.createTemplateTail(r),a=S.factory.createTemplateLiteralTypeSpan(o,i);t.push(a),r="";}return S.factory.createTemplateLiteralType(S.factory.createTemplateHead(r),t.reverse())};var ia=({module:e,shouldAppendJs:t})=>S.factory.createExportDeclaration(void 0,false,void 0,be.string(t?`${e}.js`:e)),Ke=({functionName:e,parameters:t=[],types:r})=>{let n=typeof e=="string"?E({text:e}):e,o=t.filter(a=>a!==void 0).map(a=>typeof a=="string"?E({text:a}):a);return S.factory.createCallExpression(n,r,o)},aa=({exports:e,module:t})=>{let r=Array.isArray(e)?e:[e],n=r.some(c=>typeof c!="object"||!c.asType),o=r.map(c=>{let m=typeof c=="string"?{name:c}:c;return be.export({alias:m.alias,asType:n&&m.asType,name:m.name})}),i=S.factory.createNamedExports(o),a=be.string(t);return S.factory.createExportDeclaration(void 0,!n,i,a)},pa=({assertion:e,comment:t,destructure:r,exportConst:n,expression:o,name:i,typeName:a})=>{let p=e?Hr({expression:o,type:typeof e=="string"?Re({typeName:e}):e}):o,c=typeof i=="string"?E({text:i}):i,m=S.factory.createVariableDeclaration(r?S.factory.createObjectBindingPattern([S.factory.createBindingElement(void 0,void 0,c,void 0)]):c,void 0,a?typeof a=="string"?Re({typeName:a}):a:void 0,p),l=S.factory.createVariableStatement(n?[X({keyword:"export"})]:void 0,S.factory.createVariableDeclarationList([m],S.NodeFlags.Const));return se({comments:t,node:l}),l},ca=({imports:e,module:t})=>{let r=Array.isArray(e)?e:[e],n=r.some(l=>typeof l!="object"||!l.asType),o,i=[];r.forEach(l=>{let f=typeof l=="string"?{name:l}:l;f.name==="*"&&f.alias?o=f:i.push(be.import({alias:f.alias,asType:n&&f.asType,name:f.name}));});let a=o?S.factory.createNamespaceImport(E({text:o.alias})):S.factory.createNamedImports(i),p=S.factory.createImportClause(!n,void 0,a),c=be.string(t);return S.factory.createImportDeclaration(void 0,p,c)};var ma=({accessLevel:e,comment:t,multiLine:r=true,parameters:n=[],statements:o=[]})=>{let i=e?[X({keyword:e})]:void 0,a=S.factory.createConstructorDeclaration(i,Kr(n),Se({multiLine:r,statements:o}));return se({comments:t,node:a}),a},la=({accessLevel:e,comment:t,isStatic:r=false,multiLine:n=true,name:o,parameters:i=[],returnType:a,statements:p=[],types:c=[]})=>{let m=e?[X({keyword:e})]:[];r&&m.push(X({keyword:"static"}));let l=S.factory.createMethodDeclaration(m,void 0,E({text:o}),void 0,c?Wr(c):void 0,Kr(i),a?oe(a):void 0,Se({multiLine:n,statements:p}));return se({comments:t,node:l}),l},fa=({decorator:e,exportClass:t,extendedClasses:r,name:n,nodes:o})=>{let i=[];t&&i.push(X({keyword:"export"})),e&&i.unshift(S.factory.createDecorator(Ke({functionName:e.name,parameters:e.args.map(p=>Fe({value:p})).filter(At)})));let a=[];if(r)for(let p of r)a.push(S.factory.createHeritageClause(S.SyntaxKind.ExtendsKeyword,[S.factory.createExpressionWithTypeArguments(E({text:p}),void 0)]));return S.factory.createClassDeclaration(i,E({text:n}),void 0,a,o)};var Ft=({expression:e})=>S.factory.createExpressionStatement(e);var An=({expression:e})=>S.factory.createReturnStatement(e),ua=({args:e=[],name:t,types:r=[]})=>{let n=r.map(p=>Re({typeName:p})),o=e.map(p=>S.isExpression(p)?p:E({text:p})).filter(At),i=Ke({functionName:t,parameters:o,types:n});return An({expression:i})},ya=({expression:e})=>An({expression:typeof e=="string"?E({text:e}):e});var cr=e=>e.slice(1).reduce((t,r)=>(ve.lastIndex=0,ve.test(r)?Ao({expression:t,name:r}):S.factory.createElementAccessChain(t,S.factory.createToken(S.SyntaxKind.QuestionDotToken),E({text:r}))),E({text:e[0]})),Pn=e=>e.slice(1).reduce((t,r)=>Be({expression:t,name:r}),E({text:e[0]})),ha=({expressions:e})=>e.reduce((r,n)=>Be({expression:r,name:n})),En=({left:e,operator:t="=",right:r})=>S.factory.createBinaryExpression(e,t==="="?S.SyntaxKind.EqualsToken:t==="==="?S.SyntaxKind.EqualsEqualsEqualsToken:t==="!=="?S.SyntaxKind.ExclamationEqualsEqualsToken:t==="??"?S.SyntaxKind.QuestionQuestionToken:S.SyntaxKind.InKeyword,typeof r=="string"?E({text:r}):r),mr=({elseStatement:e,expression:t,thenStatement:r})=>S.factory.createIfStatement(t,r,e),ga=({path:e})=>{let t=cr(e),r=Pn(e),n=Se({statements:[Ft({expression:En({left:r,right:_r({argumentsArray:[r],expression:E({text:"Date"})})})})]});return mr({expression:t,thenStatement:n})},xa=({path:e,transformerName:t})=>{let r=cr(e),n=Pn(e),o=Se({statements:[Ft({expression:Ke({functionName:t,parameters:[n]})})]});return [mr({expression:r,thenStatement:o})]},ba=({path:e,transformerName:t})=>{let r=cr(e),n=Pn(e);return mr({expression:Ke({functionName:Be({expression:"Array",name:"isArray"}),parameters:[r]}),thenStatement:Se({statements:[Ft({expression:S.factory.createCallChain(Be({expression:n,name:"forEach"}),void 0,void 0,[E({text:t})])})]})})},Sa=({parameterName:e})=>{let t=E({text:"Date"});return _r({argumentsArray:[E({text:e})],expression:t})},Oa=({path:e,transformExpression:t})=>{let r=cr(e),n=Pn(e);return mr({expression:Ke({functionName:Be({expression:"Array",name:"isArray"}),parameters:[r]}),thenStatement:Se({statements:[Ft({expression:En({left:n,right:S.factory.createCallChain(Be({expression:n,name:"map"}),void 0,void 0,[Tn({parameters:[{name:"item"}],statements:t})])})})]})})};var dl=Re({typeName:"null"}),lr=({isNullable:e,node:t})=>e?S.factory.createUnionTypeNode([t,dl]):t,Io=({indexKey:e,indexProperty:t,isNullable:r,properties:n,useLegacyResolution:o})=>{let a=n.map(m=>{let l=m.isReadOnly?[X({keyword:"readonly"})]:void 0,f=m.isRequired!==false?void 0:S.factory.createToken(S.SyntaxKind.QuestionToken),d=oe(m.type);let u=S.factory.createPropertySignature(l,o||typeof m.name=="string"&&m.name.match(ve)||typeof m.name!="string"&&S.isPropertyName(m.name)?m.name:Lt({text:m.name}),f,d);return se({comments:m.comment,node:u}),u}),p=false;if(t)if(!n.length&&e){let m=On({questionToken:S.factory.createToken(S.SyntaxKind.QuestionToken),type:t.type??Vt({keyword:"string"}),typeParameter:zr({constraint:e,name:E({text:String(t.name)})})});a.push(m),p=true;}else {let m=t.isReadOnly?[X({keyword:"readonly"})]:void 0,l=S.factory.createIndexSignature(m,[pr({name:E({text:String(t.name)}),type:Vt({keyword:"string"})})],oe(t.type));a.push(l);}let c=p?a[0]:S.factory.createTypeLiteralNode(a);return lr({isNullable:r,node:c})},Qr=({isNullable:e,types:t})=>{let r=[];for(let o of t){let i=oe(o);S.isUnionTypeNode(i)?r.push(...i.types):r.push(i);}let n=S.factory.createUnionTypeNode(r);return lr({isNullable:e,node:n})},Ta=({isNullable:e,types:t})=>{let r=[];for(let o of t){let i=oe(o);S.isIntersectionTypeNode(i)?r.push(...i.types):r.push(i);}let n=S.factory.createIntersectionTypeNode(r);return lr({isNullable:e,node:n})},Ra=({isNullable:e=false,types:t})=>{let r=t.map(o=>oe(o)),n=S.factory.createTupleTypeNode(r);return lr({isNullable:e,node:n})},Aa=(e,t,r=false,n=true)=>{let o=Qr({types:e}),i=Qr({types:t}),a=Io({properties:[{name:`[key: ${ce({node:o,unescape:true})}]`,type:i}],useLegacyResolution:n});return lr({isNullable:r,node:a})},Pa=(e,t=false)=>{let r=Re({typeArguments:[Array.isArray(e)?Qr({types:e}):e],typeName:"Array"});return lr({isNullable:t,node:r})};var s={anonymousFunction:_i,arrayLiteralExpression:Eo,arrowFunction:Tn,asExpression:Hr,assignment:na,awaitExpression:Hi,binaryExpression:En,block:Se,callExpression:Ke,classDeclaration:fa,conditionalExpression:Gi,constVariable:pa,constructorDeclaration:ma,enumDeclaration:Zi,exportAllDeclaration:ia,exportNamedDeclaration:aa,expressionToStatement:Ft,forOfStatement:ra,functionTypeNode:Qi,getAccessorDeclaration:Ji,identifier:E,ifStatement:mr,indexedAccessTypeNode:Xi,isTsNode:Mt,keywordTypeNode:Vt,literalTypeNode:zi,mappedTypeNode:On,methodDeclaration:la,namedImportDeclarations:ca,namespaceDeclaration:Ui,newExpression:_r,nodeToString:ce,null:Po,objectExpression:Rn,ots:be,parameterDeclaration:pr,propertyAccessExpression:Be,propertyAccessExpressions:ha,propertyAssignment:Sn,propertyDeclaration:Ki,regularExpressionLiteral:sa,returnFunctionCall:ua,returnStatement:An,returnVariable:ya,safeAccessExpression:cr,stringLiteral:Lt,templateLiteralType:oa,this:Bi,transformArrayMap:Oa,transformArrayMutation:ba,transformDateMutation:ga,transformFunctionMutation:xa,transformNewDate:Sa,typeAliasDeclaration:ea,typeArrayNode:Pa,typeInterfaceNode:Io,typeIntersectionNode:Ta,typeNode:oe,typeOfExpression:Yi,typeOperatorNode:Wi,typeParameterDeclaration:zr,typeParenthesizedNode:ta,typeRecordNode:Aa,typeReferenceNode:Re,typeTupleNode:Ra,typeUnionNode:Qr,valueToExpression:Fe},Og=s;var Bt=(...e)=>In.satisfies(...e),kn=e=>({getVersion:t=>{let r=e[t];try{if(r)return In.parse(r)||void 0}catch{}},isInstalled:t=>!!e[t],satisfies:(t,r,n)=>{let o=typeof t=="string"?e[t]:t;return o?Bt(o,r,n):false}});var yl=[le,Vi,Mi,Li,$i],Kt=e=>{let t=e.replace(/[^$\u200c\u200d\p{ID_Continue}]/gu,"_");if(ir.lastIndex=0,ir.test(t))return `_${t}`;for(let r of yl){if(t.startsWith("_"))return t;t=t.replace(r,"_$1");}return t};var xl=new Set(["buffer","child_process","cluster","console","constants","crypto","dgram","dns","domain","events","freelist","fs","http","https","module","net","os","path","process","punycode","querystring","readline","repl","stream","string_decoder","timers","tls","tty","url","util","v8","vm","worker_threads","zlib"]),jn=class{addBinding({bindings:t,file:r,meta:n,project:o,symbol:i}){if(!i.external&&!o.symbols.hasValue(i.id))return;let[a]=o.symbolIdToFiles(i.id);if(!a)return;let p=this.getBindingPath(r,a,n),c=t.get(p),m=createBinding({file:r,modulePath:p,symbol:i,symbolFile:a});c?(mergeBindings(c,m),t.set(p,c)):t.set(p,m);}getBindingPath(t,r,n){if(!t.path||!r.path)return "";if(r.external&&!L.isAbsolute(r.path))return r.path;let o=L.posix.relative(L.posix.dirname(t.path.split(L.sep).join(L.posix.sep)),r.path.split(L.sep).join(L.posix.sep));return !o.startsWith(".")&&o!==""&&(o=`./${o}`),r.extension===".ts"&&(o.endsWith(r.extension)&&(o=o.slice(0,-r.extension.length)),n?.importFileExtension?o+=n.importFileExtension:o.endsWith("/index")&&(o=o.slice(0,-6))),o}getBodyLines(t,r){let n=[];for(let o of t.symbols.body){let i=r.symbols.getValue(o);if(typeof i=="string")n.push(i);else if(i instanceof Array)for(let a of i)n.push(ce({node:a,unescape:true}));else i!=null&&n.push(ce({node:i,unescape:true}));}return n}getExportLines(t,r,n){let o=[];for(let[i,a]of t.entries()){let p=[],c,m=false;if(a.namespaceBinding!==void 0)typeof a.namespaceBinding=="string"&&(c=renderIds(a.namespaceBinding,d=>{let u=n.symbols.get(d);return this.replacerFn({file:r,project:n,symbol:u})})),a.typeNamespaceBinding&&(m=true);else if(a.names&&a.names.length>0){a.names.every(d=>(a.typeNames??[]).includes(d))&&(m=true);for(let d of a.names){let u=a.aliases?.[d],y=d,g;u&&u!==y&&(g=y,y=u),y=renderIds(y,b=>{let I=n.symbols.get(b),P=this.replacerFn({file:r,project:n,symbol:I}),[j]=n.symbolIdToFiles(b),C=j?j.resolvedNames.get(b):void 0;return C&&C!==P&&(g||(g=C)),P}),g&&(g=renderIds(g,b=>{let I=n.symbols.get(b);return this.replacerFn({file:r,project:n,symbol:I})}),g===y&&(g=void 0));let x=S.factory.createExportSpecifier(m?false:a.typeNames?.includes(d)??false,g?s.identifier({text:g}):void 0,s.identifier({text:y}));p.push(x);}}let l=c?S.factory.createNamespaceExport(s.identifier({text:c})):p.length?S.factory.createNamedExports(p):void 0,f=S.factory.createExportDeclaration(void 0,m,l,s.stringLiteral({isSingleQuote:true,text:i}));o.push(ce({node:f,unescape:true}));}return o}getHeaderLines(){return ["// This file is auto-generated by @hey-api/openapi-ts"]}getImportLines(t,r,n){let o=[],i=-1,a=c=>{let m=c.from;return m.startsWith(".")?m.startsWith("./")?[2,0,m]:[2,m.match(/\.\.\//g)?.length??0,m]:xl.has(m.split("/")[0])?[0,0,m]:[1,0,m]},p=Array.from(t.values()).map(c=>({...c,k:a(c)})).sort((c,m)=>c.k[0]-m.k[0]||c.k[1]-m.k[1]||c.k[2].localeCompare(m.k[2]));for(let c of p){let m=[],l,f,d=false;if(c.defaultBinding){let g=renderIds(c.defaultBinding,x=>{let b=n.symbols.get(x);return this.replacerFn({file:r,project:n,symbol:b})});l=s.identifier({text:g}),c.typeDefaultBinding&&(d=true);}else if(typeof c.namespaceBinding=="string")f=renderIds(c.namespaceBinding,g=>{let x=n.symbols.get(g);return this.replacerFn({file:r,project:n,symbol:x})}),c.typeNamespaceBinding&&(d=true);else if(c.names&&c.names.length>0){c.names.every(x=>c.typeNames?.includes(x))&&(d=true);let g=[];for(let x of c.names){let b=c.aliases?.[x],I=x,P;b&&b!==I&&(P=I,I=b),I=renderIds(I,j=>{let C=n.symbols.get(j),D=this.replacerFn({file:r,project:n,symbol:C}),[K]=n.symbolIdToFiles(j),v=K?K.resolvedNames.get(j):void 0;return v&&v!==D&&(P||(P=v)),D}),P&&(P=renderIds(P,j=>{let C=n.symbols.get(j);return this.replacerFn({file:r,project:n,symbol:C})}),P===I&&(P=void 0)),g.push({isTypeOnly:d?false:c.typeNames?.includes(x)??false,name:I,propertyName:P?s.identifier({text:P}):void 0});}m=g.sort((x,b)=>x.name.localeCompare(b.name)).map(({isTypeOnly:x,name:b,propertyName:I})=>S.factory.createImportSpecifier(x,I,s.identifier({text:b})));}let u=S.factory.createImportClause(d,l,f?S.factory.createNamespaceImport(s.identifier({text:f})):m.length?S.factory.createNamedImports(m):void 0),y=S.factory.createImportDeclaration(void 0,u,s.stringLiteral({isSingleQuote:true,text:c.from}));i!==-1&&c.k[0]!==i&&o.push(""),o.push(ce({node:y,unescape:true})),i=c.k[0];}return o}getUniqueName(t,r){let n=2,o=t;for(;r.hasValue(o);)o=`${t}${n}`,n+=1;return o}renderFile(t,r,n,o){let i=new Map;if(t=renderIds(t,m=>{let l=n.symbols.get(m),f=this.replacerFn({file:r,project:n,symbol:l});return l&&this.addBinding({bindings:i,file:r,meta:o,project:n,symbol:l}),f}),!t.length)return "";let a="",p=this.getHeaderLines();a+=`${p.join(`
|
|
24
|
+
`)}${p.length?`
|
|
25
|
+
|
|
26
|
+
`:""}`;let c=this.getImportLines(i,r,n);return a+=`${c.join(`
|
|
27
|
+
`)}${c.length?`
|
|
28
|
+
|
|
29
|
+
`:""}`,`${a}${t}`}renderSymbols(t,r,n){let o=new Map,i="",a=this.getBodyLines(t,r);i+=`${a.join(`
|
|
30
|
+
|
|
31
|
+
`)}${a.length?`
|
|
32
|
+
`:""}`,i=renderIds(i,c=>{if(!t.symbols.body.includes(c))return;let m=r.symbols.get(c);return this.replacerFn({file:t,project:r,symbol:m})});for(let c of t.symbols.exports){let m=r.symbols.get(c);m&&this.addBinding({bindings:o,file:t,meta:n,project:r,symbol:m});}for(let c of o.values())c.namespaceBinding=true,c.typeNamespaceBinding=c.names&&c.typeNames&&c.names.length===c.typeNames.length&&c.names.every(m=>(c.typeNames??[]).includes(m));let p=this.getExportLines(o,t,r);return i+=`${p.join(`
|
|
33
|
+
`)}${p.length?`
|
|
34
|
+
`:""}`,i}replacerFn({file:t,project:r,symbol:n}){if(!n)return;let o=t.resolvedNames.get(n.id);if(o)return o;if(!n.name)return;let[i]=r.symbolIdToFiles(n.id),a=i?.resolvedNames.get(n.id),p=Kt(a??n.name);return t.resolvedNames.hasValue(p)&&(p=this.getUniqueName(p,t.resolvedNames)),t.resolvedNames.set(n.id,p),p}};var Ea=/[\p{Lu}]/u,ko=/[\p{Ll}]/u,ka=/([\p{Alpha}\p{N}_]|$)/u,fr=/[_.\- `\\[\]{}\\/]+/,bl=new RegExp(`^${fr.source}`),jo=new RegExp(`${fr.source}${ka.source}`,"gu"),Ia=new RegExp(`\\d+${ka.source}`,"gu"),Sl=({case:e,string:t})=>{let r=false,n=false,o=false,i=false,a=e==="snake_case"||e==="SCREAMING_SNAKE_CASE"?"_":"-";for(let p=0;p<t.length;p++){let c=t[p];i=p>2?t[p-3]===a:true;let m=p+1,l=t[m];for(fr.lastIndex=0;l&&fr.test(l);)m+=1,l=t[m];let f=m!==p+1;if(ko.lastIndex=0,Ea.lastIndex=0,Ea.test(c)&&(r||l&&!f&&l!=="s"&&ko.test(l)))t=`${t.slice(0,p)}${a}${t.slice(p)}`,p++,o=n,r=false,n=true;else if(n&&o&&ko.test(c)&&!i&&!(c==="s"&&(!l||l.toLocaleLowerCase()!==l)))t=`${t.slice(0,p-1)}${a}${t.slice(p-1)}`,o=n,r=true,n=false;else {let d=c.toLocaleLowerCase(),u=c.toLocaleUpperCase();o=n,r=d===c&&u!==c,n=u===c&&d!==c;}}return t},q=({case:e,stripLeadingSeparators:t=true,value:r})=>{let n=r.trim();return n.length?!e||e==="preserve"?n:n.length===1?(fr.lastIndex=0,fr.test(n)?"":e==="PascalCase"||e==="SCREAMING_SNAKE_CASE"?n.toLocaleUpperCase():n.toLocaleLowerCase()):(n!==n.toLocaleLowerCase()&&(n=Sl({case:e,string:n})),(t||n[0]!==r[0])&&(n=n.replace(bl,"")),n=e==="SCREAMING_SNAKE_CASE"?n.toLocaleUpperCase():n.toLocaleLowerCase(),e==="PascalCase"&&(n=`${n.charAt(0).toLocaleUpperCase()}${n.slice(1)}`),e==="snake_case"||e==="SCREAMING_SNAKE_CASE"?(n=n.replaceAll(jo,(i,a,p)=>p===0&&!t?i:`_${a}`),n[n.length-1]==="_"&&(n=n.slice(0,n.length-1))):(jo.lastIndex=0,Ia.lastIndex=0,n=n.replaceAll(Ia,(i,a,p)=>["_","-","."].includes(n.charAt(p+i.length))?i:i.toLocaleUpperCase()),n=n.replaceAll(jo,(i,a,p)=>p===0&&!t&&i[0]&&r.startsWith(i[0])?i:a.toLocaleUpperCase())),n):""};var O=({config:e,name:t})=>{if(typeof e.name=="function")t=e.name(t);else if(e.name){let r=e.case==="preserve"?"":"-";t=e.name.replace("{{name}}",`${r}${t}${r}`);}return q({case:e.case,value:t})};var Tl=e=>{if(e.meta?.pluginName)return e.meta.pluginName.startsWith("@hey-api/client-")?"client":e.meta.pluginName==="@hey-api/typescript"?"types":e.meta.pluginName.startsWith("@hey-api/")?e.meta.pluginName.split("/")[1]:e.meta.pluginName},Rl=e=>{switch(e.method){case "delete":case "patch":case "post":case "put":return ["mutation"];case "get":return ["query"];default:return}},Cn=class{api;config;context;dependencies=[];gen;handler;name;output;package;constructor(t){this.api=t.api??{},this.config=t.config,this.context=t.context,this.dependencies=t.dependencies,this.gen=t.gen,this.handler=t.handler,this.name=t.name,this.output=t.output,this.package=t.context.package;}forEach(...t){let r=t.slice(0,-1),n=t[t.length-1],o=new Set(r.length?r:["operation","parameter","requestBody","schema","server","webhook"]);if(o.has("server")&&this.context.ir.servers)for(let i of this.context.ir.servers){let a={_path:["servers",String(this.context.ir.servers.indexOf(i))],server:i,type:"server"};try{n(a);}catch(p){this.forEachError(p,a);}}if(o.has("schema")&&this.context.ir.components?.schemas)for(let i in this.context.ir.components.schemas){let a={$ref:`#/components/schemas/${i}`,_path:["components","schemas",i],name:i,schema:this.context.ir.components.schemas[i],type:"schema"};try{n(a);}catch(p){this.forEachError(p,a);}}if(o.has("parameter")&&this.context.ir.components?.parameters)for(let i in this.context.ir.components.parameters){let a={$ref:`#/components/parameters/${i}`,_path:["components","parameters",i],name:i,parameter:this.context.ir.components.parameters[i],type:"parameter"};try{n(a);}catch(p){this.forEachError(p,a);}}if(o.has("requestBody")&&this.context.ir.components?.requestBodies)for(let i in this.context.ir.components.requestBodies){let a={$ref:`#/components/requestBodies/${i}`,_path:["components","requestBodies",i],name:i,requestBody:this.context.ir.components.requestBodies[i],type:"requestBody"};try{n(a);}catch(p){this.forEachError(p,a);}}if(o.has("operation")&&this.context.ir.paths)for(let i in this.context.ir.paths){let a=this.context.ir.paths[i];for(let p in a){let c=p,m={_path:["paths",i,c],method:c,operation:a[c],path:i,type:"operation"};try{n(m);}catch(l){this.forEachError(l,m);}}}if(o.has("webhook")&&this.context.ir.webhooks)for(let i in this.context.ir.webhooks){let a=this.context.ir.webhooks[i];for(let p in a){let c=p,m={_path:["webhooks",i,c],key:i,method:c,operation:a[c],type:"webhook"};try{n(m);}catch(l){this.forEachError(l,m);}}}}forEachError(t,r){let n=t instanceof Error?t:new Error(String(t));throw new sr({args:[r],error:n,event:r.type,name:"Error",pluginName:this.name})}getPlugin(t){return this.context.plugins[t]}getPluginOrThrow(t){let r=this.getPlugin(t);if(!r)throw new Error(`plugin not found ${t}`);return r}getSymbol(t){return this.gen.symbols.get(t)}getSymbolFilePath(t){let r=this.config["~hooks"]?.symbols?.getFilePath,n=r?.(t);if(n!==void 0)return n;let o=this.context.config.parser.hooks.symbols?.getFilePath,i=o?.(t);return i!==void 0?i:Tl(t)}getSymbolValue(t){return this.gen.symbols.getValue(this.symbolToId(t))}hasSymbolValue(t){return this.gen.symbols.hasValue(this.symbolToId(t))}hooks={operation:{isMutation:t=>this.isOperationKind(t,"mutation"),isQuery:t=>this.isOperationKind(t,"query")},symbol:{getFilePath:t=>this.getSymbolFilePath(t)}};isOperationKind(t,r){let n=r==="query"?"isQuery":"isMutation",o=this.config["~hooks"]?.operations?.[n],i=o?.(t);if(i!==void 0)return i;let a=this.config["~hooks"]?.operations?.getKind,p=a?.(t);if(p!==void 0)return p.includes(r);let c=this.context.config.parser.hooks.operations?.[n],m=c?.(t);if(m!==void 0)return m;let l=this.context.config.parser.hooks.operations?.getKind,f=l?.(t);return f!==void 0?f.includes(r):(Rl(t)??[]).includes(r)}referenceSymbol(t){return this.gen.symbols.reference(t)}registerSymbol(t){return this.gen.symbols.register({...t,exportFrom:t.exportFrom??(!t.external&&this.context.config.output.indexFile&&this.config.exportFromIndex?["index"]:void 0),getFilePath:t.getFilePath??this.hooks.symbol.getFilePath,meta:{pluginName:L.isAbsolute(this.name)?"custom":this.name,...t.meta}})}async run(){await this.handler({plugin:this});}setSymbolValue(t,r){return this.gen.symbols.setValue(this.symbolToId(t),r)}symbolToId(t){return typeof t=="number"?t:t.id}};var Al=/~1/g,Pl=/~0/g,F=e=>{let t=Pe(e),r=t[t.length-1];return decodeURI(r)},El=e=>String(e).replace(/~/g,"~0").replace(/\//g,"~1"),Pe=e=>{let t=e.trim();return t.startsWith("#")&&(t=t.slice(1)),t.startsWith("/")&&(t=t.slice(1)),t?t.split("/").map(r=>r.replace(Al,"/").replace(Pl,"~")):[]},ja=e=>{let t=e.trim();return t.startsWith("#")||(t=`#${t}`),t.length>1&&t.endsWith("/")&&(t=t.slice(0,-1)),t=t.replace(/\/+/g,"/"),t},Ca=e=>{let t=e.map(El).join("/");return "#"+(t?`/${t}`:"")},Co=({$ref:e,spec:t})=>{let r=Pe(decodeURI(e)),n=t;for(let o of r){let i=o;if(n[i]===void 0)throw new Error(`Reference not found: ${e}`);n=n[i];}return n};var Nn=class{config;gen;ir={};logger;package;plugins={};spec;constructor({config:t,dependencies:r,logger:n,spec:o}){this.config=t,this.gen=new Project({defaultFileName:"index",fileName:i=>{let a=O({config:t.output.fileName,name:i}),{suffix:p}=t.output.fileName;return p?a==="index"||a.endsWith(p)?a:`${a}${p}`:a},renderers:{".ts":new jn},root:t.output.path}),this.logger=n,this.package=kn(r),this.spec=o;}dereference(t){let r=this.resolveRef(t.$ref),n={...t,...r};return delete n.$ref,n}registerPlugin(t){let r=this.config.plugins[t],n=new Cn({api:r.api,config:r.config,context:this,dependencies:r.dependencies??[],gen:this.gen,handler:r.handler,name:r.name,output:r.output});return this.plugins[n.name]=n,n}registerPlugins(){return this.config.pluginOrder.map(t=>this.registerPlugin(t))}resolveIrRef(t){return Co({$ref:t,spec:this.ir})}resolveRef(t){return Co({$ref:t,spec:this.spec})}};var vn=({context:e,parameter:t})=>{if(!t.pagination)return;if(t.pagination===true)return t.schema;let r=t.schema;return r.$ref&&(r=e.resolveIrRef(r.$ref)),r.properties[t.pagination]},Pt=e=>{for(let t in e)if(e[t].required)return true;return false},Na=e=>e?!!(Pt(e.cookie)||Pt(e.header)||Pt(e.path)||Pt(e.query)):false,No=({context:e,parameters:t})=>{if(t){for(let r in t.cookie){let n=t.cookie[r];if(n.pagination)return {in:n.location,name:n.pagination===true?n.name:`${n.name}.${n.pagination}`,schema:vn({context:e,parameter:n})}}for(let r in t.header){let n=t.header[r];if(n.pagination)return {in:n.location,name:n.pagination===true?n.name:`${n.name}.${n.pagination}`,schema:vn({context:e,parameter:n})}}for(let r in t.path){let n=t.path[r];if(n.pagination)return {in:n.location,name:n.pagination===true?n.name:`${n.name}.${n.pagination}`,schema:vn({context:e,parameter:n})}}for(let r in t.query){let n=t.query[r];if(n.pagination)return {in:n.location,name:n.pagination===true?n.name:`${n.name}.${n.pagination}`,schema:vn({context:e,parameter:n})}}}};var Z=({detectFormat:e=true,schema:t})=>{if(!t.items)return t;let r=[],n=[];for(let i of t.items){if(!i.type&&i.items||t.type==="tuple"){r.push(i);continue}if(!i.type||i.type==="boolean"||i.type==="integer"||i.type==="null"||i.type==="number"||i.type==="string"||i.type==="unknown"||i.type==="void"){let a=i.const!==void 0?`const-${i.const}`:"",p=i.format!==void 0&&e?`format-${i.format}`:"",c=[i.minLength!==void 0?`minLength-${i.minLength}`:"",i.maxLength!==void 0?`maxLength-${i.maxLength}`:"",i.minimum!==void 0?`minimum-${i.minimum}`:"",i.maximum!==void 0?`maximum-${i.maximum}`:"",i.exclusiveMinimum!==void 0?`exclusiveMinimum-${i.exclusiveMinimum}`:"",i.exclusiveMaximum!==void 0?`exclusiveMaximum-${i.exclusiveMaximum}`:"",i.minItems!==void 0?`minItems-${i.minItems}`:"",i.maxItems!==void 0?`maxItems-${i.maxItems}`:"",i.pattern!==void 0?`pattern-${i.pattern}`:""].join(""),m=`${i.$ref??""}${i.type??""}${a}${p}${c}`;n.includes(m)||(n.push(m),r.push(i));continue}r.push(i);}let o={...t};if(o.items=r,o.items.length<=1&&o.type!=="array"&&o.type!=="enum"&&o.type!=="tuple"){let i=o.items[0];delete o.logicalOperator,delete o.items,o={...o,...i};}return o.type==="unknown"?{}:o};var W=({items:e,logicalOperator:t="or",mutateSchemaOneItem:r=false,schema:n})=>e.length?n.type==="tuple"?(n.items=e,n):e.length!==1?(n.items=e,n.logicalOperator=t,n):r?(n={...n,...e[0]},n):(n.items=e,n):n;var dr=e=>!!(Na(e.parameters)||e.body?.required),V=({method:e,path:t})=>`${e.toUpperCase()} ${t}`,va=({context:e,operation:t})=>{let r=t.body;if(!r||!r.pagination)return No({context:e,parameters:t.parameters});if(r.pagination===true)return {in:"body",name:"body",schema:r.schema};let n=r.schema,o=n.$ref?e.resolveIrRef(n.$ref):n,a=("schema"in o?o.schema:o)?.properties?.[r.pagination];return a?{in:"body",name:r.pagination,schema:a}:No({context:e,parameters:t.parameters})},vo=({statusCode:e})=>{switch(e){case "1XX":return "1XX";case "2XX":return "2XX";case "3XX":return "3XX";case "4XX":return "4XX";case "5XX":return "5XX";case "default":return "default";default:return `${e[0]}XX`}},We=e=>{let t={};if(!e.responses)return t;let r={properties:{},type:"object"},n={properties:{},type:"object"},o;for(let p in e.responses){let c=e.responses[p];switch(vo({statusCode:p})){case "1XX":case "3XX":break;case "2XX":n.properties[p]=c.schema;break;case "4XX":case "5XX":r.properties[p]=c.schema;break;case "default":o=c;break}}if(o){let p=false;Object.keys(n.properties).length||(n.properties.default=o.schema,p=true);let c=(o.schema.description??"").toLocaleLowerCase(),m=(o.schema.$ref??"").toLocaleLowerCase();["success"].some(d=>c.includes(d)||m.includes(d))&&(n.properties.default=o.schema,p=true),["error","problem"].some(d=>c.includes(d)||m.includes(d))&&(r.properties.default=o.schema,p=true),p||(r.properties.default=o.schema);}let i=Object.keys(r.properties);if(i.length){r.required=i,t.errors=r;let p=W({items:Object.values(r.properties),mutateSchemaOneItem:true,schema:{}});p=Z({schema:p}),Object.keys(p).length&&p.type!=="unknown"&&(t.error=p);}let a=Object.keys(n.properties);if(a.length){n.required=a,t.responses=n;let p=W({items:Object.values(n.properties),mutateSchemaOneItem:true,schema:{}});p=Z({schema:p}),Object.keys(p).length&&p.type!=="unknown"&&(t.response=p);}return t};var we=e=>{let t=e.replace(/[^$\u200c\u200d\p{ID_Continue}]/gu,"_");return ir.lastIndex=0,ir.test(t)?`_${t}`:t},ct=e=>e.replace(/^[^\p{ID_Start}]+/u,"").replace(/[^$\u200c\u200d\p{ID_Continue}]/gu,"-").replace(/[$+]/g,"-"),wo=e=>{let t=e.replace("[]","Array");return ct(t)};var re=["delete","get","head","options","patch","post","put","trace"],zt=({context:e,count:t=1,id:r,method:n,path:o,state:i})=>{let a,{output:p}=e.config,c=(p!==void 0&&typeof p=="object"&&"case"in p?p.case:void 0)??"camelCase";if(r&&(!e.config.plugins["@hey-api/sdk"]||e.config.plugins["@hey-api/sdk"].config.operationId))a=q({case:c,value:ct(r)});else {let m=o.replace(/{(.*?)}/g,"by-$1").replace(/[/:+]/g,"-");a=q({case:c,value:`${n}-${m}`});}return t>1&&(a=`${a}${t}`),i.ids.has(a)?zt({context:e,count:t+1,id:r,method:n,path:o,state:i}):(i.ids.set(a,V({method:n,path:o})),a)};var wa="/",w=(e,t="")=>`${e}${wa}${t}`,te=e=>{let t=e.indexOf(wa);return {name:e.slice(t+1),namespace:e.slice(0,t)}},qa=e=>{switch(e){case "parameters":return "parameter";case "requestBodies":return "body";case "responses":return "response";case "definitions":case "schemas":return "schema";default:return "unknown"}},ze=(e,t)=>{let r=[],n=[];if(t)for(let o of t)o.startsWith("/")&&o.endsWith("/")?n.push(new RegExp(o.slice(1,o.length-1))):r.push(w(e,o));return {regexps:n,set:new Set(r)}},kl=({excludeOperations:e,excludeSchemas:t,includeOperations:r,includeSchemas:n,spec:o})=>{if((e.regexps.length||r.regexps.length)&&o.paths)for(let i of Object.entries(o.paths)){let a=i[0],p=i[1];for(let c of re){if(!p[c])continue;let l=V({method:c,path:a});e.regexps.some(f=>f.test(l))&&e.set.add(w("operation",l)),r.regexps.some(f=>f.test(l))&&r.set.add(w("operation",l));}}if(o.definitions&&(t.regexps.length||n.regexps.length))for(let i of Object.keys(o.definitions))t.regexps.some(a=>a.test(i))&&t.set.add(w("schema",i)),n.regexps.some(a=>a.test(i))&&n.set.add(w("schema",i));},jl=({excludeOperations:e,excludeParameters:t,excludeRequestBodies:r,excludeResponses:n,excludeSchemas:o,includeOperations:i,includeParameters:a,includeRequestBodies:p,includeResponses:c,includeSchemas:m,spec:l})=>{if((e.regexps.length||i.regexps.length)&&l.paths)for(let f of Object.entries(l.paths)){let d=f[0],u=f[1];for(let y of re){if(!u[y])continue;let x=V({method:y,path:d});e.regexps.some(b=>b.test(x))&&e.set.add(w("operation",x)),i.regexps.some(b=>b.test(x))&&i.set.add(w("operation",x));}}if(l.components){if((t.regexps.length||a.regexps.length)&&l.components.parameters)for(let f of Object.keys(l.components.parameters))t.regexps.some(d=>d.test(f))&&t.set.add(w("parameter",f)),a.regexps.some(d=>d.test(f))&&a.set.add(w("parameter",f));if((r.regexps.length||p.regexps.length)&&l.components.requestBodies)for(let f of Object.keys(l.components.requestBodies))r.regexps.some(d=>d.test(f))&&r.set.add(w("body",f)),p.regexps.some(d=>d.test(f))&&p.set.add(w("body",f));if((n.regexps.length||c.regexps.length)&&l.components.responses)for(let f of Object.keys(l.components.responses))n.regexps.some(d=>d.test(f))&&n.set.add(w("response",f)),c.regexps.some(d=>d.test(f))&&c.set.add(w("response",f));if((o.regexps.length||m.regexps.length)&&l.components.schemas)for(let f of Object.keys(l.components.schemas))o.regexps.some(d=>d.test(f))&&o.set.add(w("schema",f)),m.regexps.some(d=>d.test(f))&&m.set.add(w("schema",f));}},Cl=({spec:e,...t})=>{"swagger"in e?kl({...t,spec:e}):jl({...t,spec:e});},ur=(e,t,r)=>{let n=r.timeEvent("create-filters"),o=ze("operation",e?.operations?.exclude),i=ze("operation",e?.operations?.include),a=ze("parameter",e?.parameters?.exclude),p=ze("parameter",e?.parameters?.include),c=ze("body",e?.requestBodies?.exclude),m=ze("body",e?.requestBodies?.include),l=ze("response",e?.responses?.exclude),f=ze("response",e?.responses?.include),d=ze("schema",e?.schemas?.exclude),u=ze("schema",e?.schemas?.include);Cl({excludeOperations:o,excludeParameters:a,excludeRequestBodies:c,excludeResponses:l,excludeSchemas:d,includeOperations:i,includeParameters:p,includeRequestBodies:m,includeResponses:f,includeSchemas:u,spec:t});let y={deprecated:e?.deprecated??true,operations:{exclude:o.set,include:i.set},orphans:e?.orphans??false,parameters:{exclude:a.set,include:p.set},preserveOrder:e?.preserveOrder??false,requestBodies:{exclude:c.set,include:m.set},responses:{exclude:l.set,include:f.set},schemas:{exclude:d.set,include:u.set},tags:{exclude:new Set(e?.tags?.exclude),include:new Set(e?.tags?.include)}};return n.timeEnd(),y},yr=e=>e?e.orphans===false||e.deprecated===false?true:!!(e.operations?.exclude?.length||e.operations?.include?.length||e.parameters?.exclude?.length||e.parameters?.include?.length||e.requestBodies?.exclude?.length||e.requestBodies?.include?.length||e.responses?.exclude?.length||e.responses?.include?.length||e.schemas?.exclude?.length||e.schemas?.include?.length||e.tags?.exclude?.length||e.tags?.include?.length):false,Nl=({filters:e,parameters:t,requestBodies:r,resourceMetadata:n,responses:o,schemas:i})=>{let a=new Set,c=[...e.operations.include.size?e.operations.include:new Set(n.operations.keys())];for(;c.length;){let m=c.pop();if(e.operations.exclude.has(m)||a.has(m))continue;let l=n.operations.get(m);l&&(!e.deprecated&&l.deprecated||e.tags.exclude.size&&l.tags.size&&[...e.tags.exclude].some(f=>l.tags.has(f))||e.tags.include.size&&!new Set([...e.tags.include].filter(f=>l.tags.has(f))).size||[...l.dependencies].some(f=>{let{namespace:d}=te(f);switch(d){case "body":return !r.has(f);case "parameter":return !t.has(f);case "response":return !o.has(f);case "schema":return !i.has(f);default:return false}})||a.add(m));}return {operations:a}},vl=({filters:e,resourceMetadata:t,schemas:r})=>{let n=new Set,i=[...e.parameters.include.size?e.parameters.include:new Set(t.parameters.keys())];for(;i.length;){let a=i.pop();if(e.parameters.exclude.has(a)||n.has(a))continue;let p=t.parameters.get(a);if(p&&!(!e.deprecated&&p.deprecated)&&(n.add(a),!!p.dependencies.size))for(let c of p.dependencies){let{namespace:m}=te(c);switch(m){case "body":{e.requestBodies.exclude.has(c)?n.delete(a):n.has(c)||i.push(c);break}case "schema":{e.schemas.exclude.has(c)?n.delete(a):r.has(c)||r.add(c);break}}}}return {parameters:n}},wl=({filters:e,resourceMetadata:t,schemas:r})=>{let n=new Set,i=[...e.requestBodies.include.size?e.requestBodies.include:new Set(t.requestBodies.keys())];for(;i.length;){let a=i.pop();if(e.requestBodies.exclude.has(a)||n.has(a))continue;let p=t.requestBodies.get(a);if(p&&!(!e.deprecated&&p.deprecated)&&(n.add(a),!!p.dependencies.size))for(let c of p.dependencies){let{namespace:m}=te(c);switch(m){case "body":{e.requestBodies.exclude.has(c)?n.delete(a):n.has(c)||i.push(c);break}case "schema":{e.schemas.exclude.has(c)?n.delete(a):r.has(c)||r.add(c);break}}}}return {requestBodies:n}},ql=({filters:e,resourceMetadata:t,schemas:r})=>{let n=new Set,i=[...e.responses.include.size?e.responses.include:new Set(t.responses.keys())];for(;i.length;){let a=i.pop();if(e.responses.exclude.has(a)||n.has(a))continue;let p=t.responses.get(a);if(p&&!(!e.deprecated&&p.deprecated)&&(n.add(a),!!p.dependencies.size))for(let c of p.dependencies){let{namespace:m}=te(c);switch(m){case "body":{e.requestBodies.exclude.has(c)?n.delete(a):n.has(c)||i.push(c);break}case "schema":{e.schemas.exclude.has(c)?n.delete(a):r.has(c)||r.add(c);break}}}}return {responses:n}},$l=({filters:e,resourceMetadata:t})=>{let r=new Set,o=[...e.schemas.include.size?e.schemas.include:new Set(t.schemas.keys())];for(;o.length;){let i=o.pop();if(e.schemas.exclude.has(i)||r.has(i))continue;let a=t.schemas.get(i);if(a&&!(!e.deprecated&&a.deprecated)&&(r.add(i),!!a.dependencies.size))for(let p of a.dependencies){let{namespace:c}=te(p);switch(c){case "schema":{!r.has(p)&&!e.schemas.exclude.has(p)&&o.push(p);break}}}}return {schemas:r}},Ml=({filters:e,parameters:t,resourceMetadata:r})=>{if(e.parameters.exclude.size)for(let n of t){let o=r.parameters.get(n);if(o?.dependencies.size){for(let i of e.parameters.exclude)if(o.dependencies.has(i)){t.delete(n);break}}}},Ll=({filters:e,requestBodies:t,resourceMetadata:r})=>{if(e.requestBodies.exclude.size)for(let n of t){let o=r.requestBodies.get(n);if(o?.dependencies.size){for(let i of e.requestBodies.exclude)if(o.dependencies.has(i)){t.delete(n);break}}}},Vl=({filters:e,resourceMetadata:t,responses:r})=>{if(e.responses.exclude.size)for(let n of r){let o=t.responses.get(n);if(o?.dependencies.size){for(let i of e.responses.exclude)if(o.dependencies.has(i)){r.delete(n);break}}}},Dl=({filters:e,resourceMetadata:t,schemas:r})=>{if(e.schemas.exclude.size)for(let n of r){let o=t.schemas.get(n);if(o?.dependencies.size){for(let i of e.schemas.exclude)if(o.dependencies.has(i)){r.delete(n);break}}}},Fl=({operationDependencies:e,parameters:t,requestBodies:r,responses:n,schemas:o})=>{for(let i of o)e.has(i)||o.delete(i);for(let i of t)e.has(i)||t.delete(i);for(let i of r)e.has(i)||r.delete(i);for(let i of n)e.has(i)||n.delete(i);},Bl=({operations:e,resourceMetadata:t})=>{let r=new Set,o=[...new Set([...e].flatMap(i=>[...t.operations.get(i)?.dependencies??[]]))];for(;o.length;){let i=o.pop();if(r.has(i))continue;r.add(i);let{namespace:a}=te(i),p;if(a==="body"?p=t.requestBodies.get(i)?.dependencies:a==="operation"?p=t.operations.get(i)?.dependencies:a==="parameter"?p=t.parameters.get(i)?.dependencies:a==="response"?p=t.responses.get(i)?.dependencies:a==="schema"&&(p=t.schemas.get(i)?.dependencies),!!p?.size)for(let c of p)r.has(c)||o.push(c);}return {operationDependencies:r}},hr=({filters:e,logger:t,resourceMetadata:r})=>{let n=t.timeEvent("create-filtered-dependencies"),{schemas:o}=$l({filters:e,resourceMetadata:r}),{parameters:i}=vl({filters:e,resourceMetadata:r,schemas:o}),{requestBodies:a}=wl({filters:e,resourceMetadata:r,schemas:o}),{responses:p}=ql({filters:e,resourceMetadata:r,schemas:o});Dl({filters:e,resourceMetadata:r,schemas:o}),Ml({filters:e,parameters:i,resourceMetadata:r}),Ll({filters:e,requestBodies:a,resourceMetadata:r}),Vl({filters:e,resourceMetadata:r,responses:p});let{operations:c}=Nl({filters:e,parameters:i,requestBodies:a,resourceMetadata:r,responses:p,schemas:o});if(!e.orphans&&c.size){let{operationDependencies:m}=Bl({operations:c,resourceMetadata:r});Fl({operationDependencies:m,parameters:i,requestBodies:a,responses:p,schemas:o});}return n.timeEnd(),{operations:c,parameters:i,requestBodies:a,responses:p,schemas:o}};var gr=(e,t)=>{let r=t.timeEvent("build-resource-metadata"),n={operations:new Map,parameters:new Map,requestBodies:new Map,responses:new Map,schemas:new Map},o=i=>{let a=new Set,p=e.allDependencies.get(i);if(p?.size)for(let c of p){let m=Pe(c),l=m[m.length-2],f=m[m.length-1];if(l&&f){let d=qa(l);d==="unknown"&&console.warn(`unsupported type: ${l}`),a.add(w(d,f));}}return a};for(let[i,a]of e.nodes){let p=Pe(i);if(p[0]==="components"){if(p.length===3){if(p[1]==="schemas"){let c=p[p.length-1];n.schemas.set(w("schema",c),{dependencies:o(i),deprecated:a.deprecated??false});}else if(p[1]==="parameters"){let c=p[p.length-1];n.parameters.set(w("parameter",c),{dependencies:o(i),deprecated:a.deprecated??false});}else if(p[1]==="requestBodies"){let c=p[p.length-1];n.requestBodies.set(w("body",c),{dependencies:o(i),deprecated:a.deprecated??false});}else if(p[1]==="responses"){let c=p[p.length-1];n.responses.set(w("response",c),{dependencies:o(i),deprecated:a.deprecated??false});}}continue}if(p[0]==="paths"){if(p.length===3&&re.includes(p[2])){let c=p[p.length-1],m=p.slice(1,-1).join("/"),l=V({method:c,path:m});n.operations.set(w("operation",l),{dependencies:o(i),deprecated:a.deprecated??false,tags:a.tags??new Set});}continue}if(p[0]==="definitions"){if(p.length===2){let c=p[p.length-1];n.schemas.set(w("schema",c),{dependencies:o(i),deprecated:a.deprecated??false});}continue}}return r.timeEnd(),{resourceMetadata:n}};var Zr=e=>JSON.parse(JSON.stringify(e));var _e=[["additionalProperties","single"],["allOf","array"],["anyOf","array"],["contains","single"],["dependentSchemas","objectMap"],["else","single"],["if","single"],["items","singleOrArray"],["oneOf","array"],["patternProperties","objectMap"],["properties","objectMap"],["propertyNames","single"],["then","single"]];var Ur=e=>{if(wn(e))return e.components.schemas;if(qn(e))return e.definitions},wn=e=>typeof e=="object"&&e!==null&&"components"in e&&typeof e.components=="object"&&e.components!==null&&"schemas"in e.components&&typeof e.components.schemas=="object"&&e.components.schemas!==null,qn=e=>typeof e=="object"&&e!==null&&"definitions"in e&&typeof e.definitions=="object"&&e.definitions!==null;var $a=(e,t)=>e instanceof Set?e.has(t):e instanceof Array?e.includes(t):t in e,Xr=({base:e,components:t,extraComponents:r})=>{let n=2,o=e;for(;$a(t,o)||r&&$a(r,o);)o=`${e}${n}`,n+=1;return o},$n=e=>e.length===3&&e[0]==="components"&&e[1]==="schemas"||e.length===2&&e[0]==="definitions",xr=e=>{if(e&&typeof e=="object"){if("swagger"in e)return "#/definitions/";if("openapi"in e)return "#/components/schemas/"}return ""};var qo=e=>{if(!e||typeof e!="object"||!("enum"in e)||!(e.enum instanceof Array))return;let t=("type"in e?e.type:void 0)||"",r=[...e.enum].sort();return JSON.stringify({type:t,values:r})},$o=({key:e,node:t,parent:r,path:n,visitor:o})=>{if(!t||typeof t!="object"||t instanceof Array)return;let i=t;("type"in i||"enum"in i||_e.some(([a])=>a in i))&&o({key:e,node:t,parent:r,path:n});for(let[a,p]of Object.entries(i))typeof p=="object"&&p!==null&&(p instanceof Array?p.forEach((c,m)=>$o({key:m,node:c,parent:p,path:[...n,a,m],visitor:o})):$o({key:a,node:p,parent:t,path:[...n,a],visitor:o}));},Kl=({spec:e})=>{let t=Ur(e);if(!t)return;let r=xr(e),n={};for(let[i,a]of Object.entries(t))qo(a)&&(n[`${r}${i}`]=a);let o=i=>{if(i instanceof Array)i.forEach(o);else if(i&&typeof i=="object")for(let[a,p]of Object.entries(i))a==="$ref"&&typeof p=="string"&&p in n?(Object.assign(i,Zr(n[p])),delete i.$ref):o(p);};o(e);for(let i of Object.keys(n)){let a=Pe(i),p=a[a.length-1];p&&delete t[p];}},Wl=({config:e,spec:t})=>{let r=Ur(t);if(!r)return;let n={};for(let[c,m]of Object.entries(r)){let l=qo(m);l&&(n[l]=c);}let o=[];$o({key:null,node:t,parent:null,path:[],visitor:c=>{if(!$n(c.path)){let m=qo(c.node);m&&o.push({...c,signature:m});}}});let i={},a={};for(let{key:c,node:m,signature:l}of o){if(l in i)continue;if(l in n){i[l]=n[l];continue}let f=O({config:e,name:typeof m=="object"&&m&&"title"in m&&typeof m.title=="string"?m.title:String(c)}),d=Xr({base:f,components:r,extraComponents:Object.values(i)});i[l]=d,a[l]=m;}for(let[c,m]of Object.entries(i)){let l=a[c];m&&!(m in r)&&l&&typeof l=="object"&&(r[m]=l);}let p=xr(t);for(let{key:c,parent:m,signature:l}of o){let f=i[l];f&&c!=null&&m&&typeof m=="object"&&(m[c]={$ref:`${p}${f}`});}},Ma=({config:e,spec:t})=>{if(e.mode==="inline"){Kl({spec:t});return}if(e.mode==="root"){Wl({config:e,spec:t});return}};var Mo=({key:e,node:t,parent:r,path:n,visitor:o})=>{if(!t||typeof t!="object"||t instanceof Array)return;let i=t;("type"in i||_e.some(([a])=>a in i))&&o({key:e,node:t,parent:r,path:n});for(let[a,p]of Object.entries(i))typeof p=="object"&&p!==null&&(p instanceof Array?p.forEach((c,m)=>Mo({key:m,node:c,parent:p,path:[...n,a,m],visitor:o})):Mo({key:a,node:p,parent:t,path:[...n,a],visitor:o}));},La=({spec:e})=>{Mo({key:null,node:e,parent:null,path:[],visitor:t=>{if(t.node&&typeof t.node=="object"&&"type"in t.node&&t.node.type==="object"&&"properties"in t.node&&t.node.properties&&typeof t.node.properties=="object"&&!("required"in t.node)){let r=Object.keys(t.node.properties);r.length>0&&(t.node.required=r);}}});};var Lo=(e,t)=>{if(e===t)return true;if(e===null||t===null)return e===t;let r=typeof e;if(r!==typeof t||r!=="object")return false;if(Array.isArray(e)||Array.isArray(t)){if(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length)return false;for(let c=0;c<e.length;c++)if(!Lo(e[c],t[c]))return false;return true}let o=e,i=t,a=Object.keys(o).sort(),p=Object.keys(i).sort();if(a.length!==p.length)return false;for(let c=0;c<a.length;c++)if(a[c]!==p[c])return false;for(let c of a)if(!Lo(o[c],i[c]))return false;return true},Vo=Lo;var zl=e=>{for(let[,t]of e)if(!t.scopes&&t.parentPointer){let r=e.get(t.parentPointer);r?.scopes&&(t.scopes=new Set(r.scopes));}},Fo=({cache:e,graph:t,pointer:r,visited:n})=>{let o=e.allDependencies.get(r);if(o)return o;if(n.has(r))return new Set;if(n.add(r),!t.nodes.get(r))return new Set;let a=new Set,p=t.dependencies.get(r);if(p)for(let m of p){a.add(m);let l=Fo({cache:e,graph:t,pointer:m,visited:n});for(let f of l)a.add(f);}let c=e.parentToChildren.get(r);if(c)for(let m of c){let l=e.childDependencies.get(m);l||(l=Fo({cache:e,graph:t,pointer:m,visited:n}),e.childDependencies.set(m,l));for(let f of l)a.add(f);}return e.allDependencies.set(r,a),a},_l=e=>{let t=new Set(Array.from(e.nodes.entries()).filter(([,o])=>o.scopes&&o.scopes.size>0).map(([o])=>o)),r=(o,i,a)=>{i.parentPointer&&t.add(i.parentPointer);let p=e.reverseDependencies.get(o);if(p)for(let c of p)t.add(c);if(a){let c=a.match(/(.*)\/(allOf|anyOf|oneOf)\/\d+$/);if(c){let m=c[1];m&&t.add(m);}}},n=(o,i,a)=>{if(!i?.scopes)return;let p=e.nodes.get(a);if(!p?.scopes)return;Do(p,i)&&r(o,i,a);};for(;t.size>0;){let o=t.values().next().value;t.delete(o);let i=e.nodes.get(o);if(!i)continue;i.scopes||(i.scopes=new Set);let a=i.node;for(let[c,m]of _e){if(!a||typeof a!="object"||!(c in a))continue;let l=a[c];if(m==="array"&&l instanceof Array)for(let f=0;f<l.length;f++){let d=`${o}/${c}/${f}`;n(o,i,d);}else if(m==="objectMap"&&typeof l=="object"&&l!==null&&!(l instanceof Array))for(let f of Object.keys(l)){let d=`${o}/${c}/${f}`;n(o,i,d);}else if(m==="single"&&typeof l=="object"&&l!==null){let f=`${o}/${c}`;n(o,i,f);}else if(m==="singleOrArray"){if(l instanceof Array)for(let f=0;f<l.length;f++){let d=`${o}/${c}/${f}`;n(o,i,d);}else if(typeof l=="object"&&l!==null){let f=`${o}/${c}`;n(o,i,f);}}}let p=e.dependencies.get(o);if(p)for(let c of p){let m=e.nodes.get(c);m?.scopes&&Do(m,i)&&r(o,i);}if(i.parentPointer){let c=e.nodes.get(i.parentPointer);c&&Do(i,c)&&r(i.parentPointer,c);}}},Do=(e,t)=>{if(!e.scopes)return false;t.scopes||(t.scopes=new Set);let r=false;for(let n of e.scopes)t.scopes.has(n)||(t.scopes.add(n),r=true);return r},Hl=e=>{for(let[t,r]of e){let{node:n}=r;typeof n!="object"||n===null||n instanceof Array||("readOnly"in n&&n.readOnly===true?r.scopes=new Set(["read"]):"writeOnly"in n&&n.writeOnly===true?r.scopes=new Set(["write"]):t.match(/\/properties\/[^/]+$/)&&(r.scopes=new Set(["normal"])));}},Et=(e,t)=>{let r=t.timeEvent("build-graph"),n={allDependencies:new Map,dependencies:new Map,nodes:new Map,reverseDependencies:new Map},o=({key:a,node:p,parentPointer:c,path:m})=>{if(typeof p!="object"||p===null)return;let l=Ca(m),f,d;if(typeof p=="object"&&p!==null){if("deprecated"in p&&typeof p.deprecated=="boolean"&&(f=!!p.deprecated),"$ref"in p&&typeof p.$ref=="string"){let u=ja(p.$ref);n.dependencies.has(l)||n.dependencies.set(l,new Set),n.dependencies.get(l).add(u);}"tags"in p&&p.tags instanceof Array&&(d=new Set(p.tags.filter(u=>typeof u=="string")));}if(n.nodes.set(l,{deprecated:f,key:a,node:p,parentPointer:c,tags:d}),p instanceof Array)p.forEach((u,y)=>o({key:y,node:u,parentPointer:l,path:[...m,y]}));else for(let[u,y]of Object.entries(p))o({key:u,node:y,parentPointer:l,path:[...m,u]});};o({key:null,node:e,parentPointer:null,path:[]});let i={allDependencies:new Map,childDependencies:new Map,parentToChildren:new Map};for(let[a,p]of n.nodes){let c=p.parentPointer;c&&(i.parentToChildren.has(c)||i.parentToChildren.set(c,[]),i.parentToChildren.get(c).push(a));}for(let[a,p]of n.dependencies)for(let c of p)n.reverseDependencies.has(c)||n.reverseDependencies.set(c,new Set),n.reverseDependencies.get(c).add(a);Hl(n.nodes),_l(n),zl(n.nodes);for(let a of n.nodes.keys()){let p=Fo({cache:i,graph:n,pointer:a,visited:new Set});n.allDependencies.set(a,p);}return r.timeEnd(),{graph:n}};var Ql=new Set(["additionalProperties","allOf","anyOf","items","not","oneOf","patternProperties","properties","schema"]),Zl=e=>{if(e.length===3&&e[0]==="components"){let t=e[1];if(t==="parameters"||t==="requestBodies")return "write";if(t==="responses"||t==="headers")return "read"}if(e.length===2){let t=e[0];if(t==="parameters")return "write";if(t==="responses")return "read"}},Ul=(e,t)=>{let r=t.timeEvent("capture-original-schemas"),n={};if(wn(e))for(let[o,i]of Object.entries(e.components.schemas))n[`#/components/schemas/${o}`]=i;else if(qn(e))for(let[o,i]of Object.entries(e.definitions))n[`#/definitions/${o}`]=i;return r.timeEnd(),n},Xl=({logger:e,spec:t,split:r})=>{let n=e.timeEvent("insert-split-schemas-into-spec");wn(t)?Object.assign(t.components.schemas,r.schemas):qn(t)&&Object.assign(t.definitions,r.schemas),n.timeEnd();},_t=(e,t,r)=>{if(t&&typeof t=="object"){if("$ref"in t&&typeof t.$ref=="string"){let n=e.nodes.get(t.$ref);if(n?.scopes&&(r==="writeOnly"&&n.scopes.size===1&&n.scopes.has("write")||r==="readOnly"&&n.scopes.size===1&&n.scopes.has("read"))&&(delete t.$ref,!_e.some(([o])=>o in t)))return true}for(let[n,o]of _e){if(!(n in t))continue;let i=t[n];if(o==="array"&&i instanceof Array){for(let a=i.length-1;a>=0;a--){let p=i[a];(p&&typeof p=="object"&&p[r]===true||_t(e,p,r))&&i.splice(a,1);}i.length||delete t[n];}else if(o==="objectMap"&&typeof i=="object"&&i!==null&&!(i instanceof Array)){let a=i,p=new Set;for(let c of Object.keys(a)){let m=a[c];(m&&typeof m=="object"&&m[r]===true||_t(e,m,r))&&(delete a[c],n==="properties"&&p.add(c));}if(p.size>0&&n==="properties"&&"required"in t&&Array.isArray(t.required)){let m=t.required.filter(l=>!p.has(l));m.length?t.required=m:delete t.required;}Object.keys(a).length||delete t[n];}else if(o==="single"&&typeof i=="object"&&i!==null)(i[r]===true||_t(e,i,r))&&delete t[n];else if(o==="singleOrArray")if(i instanceof Array){for(let a=i.length-1;a>=0;a--){let p=i[a];(p&&typeof p=="object"&&p[r]===true||_t(e,p,r))&&i.splice(a,1);}i.length||delete t[n];}else typeof i=="object"&&i!==null&&(i[r]===true||_t(e,i,r))&&delete t[n];}if(t.type==="object"&&!_e.some(([n])=>n in t))return true}return false},Jl=({logger:e,originalSchemas:t,spec:r,split:n})=>{let o=e.timeEvent("remove-original-split-schemas"),i=Ur(r);for(let a of Object.keys(n.mapping)){let p=Pe(a),c=p[p.length-1];typeof c=="string"&&i&&Object.prototype.hasOwnProperty.call(i,c)&&i[c]===t[a]&&delete i[c];}o.timeEnd();},Gl=({config:e,graph:t,logger:r,spec:n})=>{let o=r.timeEvent("split-schemas"),i=new Set,a={mapping:{},reverseMapping:{},schemas:{}},p=xr(n),c=p.split("/").length-1,m=l=>{if(l.startsWith(p)){let f=Pe(l);if(f.length===c)return f[c-1]||""}return ""};for(let l of t.nodes.keys()){let f=m(l);f&&i.add(f);}for(let[l,f]of t.nodes){let d=m(l);if(!d||!(f.scopes?.has("read")||f.scopes?.has("write"))||!f.scopes?.has("normal"))continue;let u=Zr(f.node);_t(t,u,"writeOnly");let y=O({config:e.responses,name:d}),g=y===d?y:Xr({base:y,components:i});i.add(g),a.schemas[g]=u;let x=`${p}${g}`,b=Zr(f.node);if(_t(t,b,"readOnly"),Vo(u,b)&&Vo(u,f.node))continue;let I=O({config:e.requests,name:d}),P=I===d&&I!==g?I:Xr({base:I,components:i});i.add(P),a.schemas[P]=b;let j=`${p}${P}`;a.mapping[l]={read:x,write:j},a.reverseMapping[x]=l,a.reverseMapping[j]=l;}return o.timeEnd(),a},Yl=({logger:e,spec:t,split:r})=>{let n=e.timeEvent("update-refs-in-spec"),o=xr(t),i=({context:a,currentPointer:p,inSchema:c,node:m,path:l})=>{if(m instanceof Array)m.forEach((f,d)=>i({context:a,currentPointer:p,inSchema:c,node:f,path:[...l,d]}));else if(m&&typeof m=="object"){let f=p,d=a;if($n(l)){let y=l[l.length-1];f=`${o}${y}`;let g=r.reverseMapping[f];if(g){let x=r.mapping[g];x?.read===f?d="read":x?.write===f&&(d="write");}}let u=Zl(l);if(u!==void 0){for(let y in m)Object.prototype.hasOwnProperty.call(m,y)&&i({context:u,currentPointer:f,inSchema:false,node:m[y],path:[...l,y]});return}for(let y in m){if(!Object.prototype.hasOwnProperty.call(m,y))continue;let g=m[y];if(!c){if(y==="requestBody"){i({context:"write",currentPointer:f,inSchema:false,node:g,path:[...l,y]});continue}if(y==="responses"){i({context:"read",currentPointer:f,inSchema:false,node:g,path:[...l,y]});continue}if(y==="parameters"&&Array.isArray(g)){g.forEach((x,b)=>{x&&typeof x=="object"&&"schema"in x&&i({context:"write",currentPointer:f,inSchema:true,node:x.schema,path:[...l,y,b,"schema"]}),x&&typeof x=="object"&&"content"in x&&i({context:"write",currentPointer:f,inSchema:false,node:x.content,path:[...l,y,b,"content"]});});continue}if(y==="headers"&&typeof g=="object"&&g!==null){for(let x in g)Object.prototype.hasOwnProperty.call(g,x)&&i({context:"read",currentPointer:f,inSchema:false,node:g[x],path:[...l,y,x]});continue}}if(Ql.has(y))i({context:d,currentPointer:f,inSchema:true,node:g,path:[...l,y]});else if(y==="$ref"&&typeof g=="string"){let x=r.mapping[g];x&&(x.read&&(!d||d==="read")?m[y]=x.read:x.write&&(!d||d==="write")&&(m[y]=x.write));}else i({context:d,currentPointer:f,inSchema:c,node:g,path:[...l,y]});}}};i({context:null,currentPointer:null,inSchema:false,node:t,path:[]}),n.timeEnd();},Va=({config:e,logger:t,spec:r})=>{let{graph:n}=Et(r,t),o=Ul(r,t),i=Gl({config:e,graph:n,logger:t,spec:r});Xl({logger:t,spec:r,split:i}),Yl({logger:t,spec:r,split:i}),Jl({logger:t,originalSchemas:o,spec:r,split:i});};var br=({context:e})=>{let{logger:t}=e,r=t.timeEvent("transform-openapi-spec");e.config.parser.transforms.enums.enabled&&Ma({config:e.config.parser.transforms.enums,spec:e.spec}),e.config.parser.transforms.propertiesRequiredByDefault&&La({spec:e.spec}),e.config.parser.transforms.readWrite.enabled&&Va({config:e.config.parser.transforms.readWrite,logger:t,spec:e.spec}),r.timeEnd();};var $=({source:e,target:t})=>{let r={...t};if(e&&(e.cookie&&(r.cookie?r.cookie={...r.cookie,...e.cookie}:r.cookie=e.cookie),e.header&&(r.header?r.header={...r.header,...e.header}:r.header=e.header),e.path&&(r.path?r.path={...r.path,...e.path}:r.path=e.path),e.query&&(r.query?r.query={...r.query,...e.query}:r.query=e.query)),!!Object.keys(r).length)return r};var ef=e=>/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(e),tf=e=>e.map((t,r)=>typeof t=="number"?`[${t}]`:r===0?t:ef(t)?`.${t}`:`['${t.replace(/"/g,"\\'")}']`).join(""),rf=e=>{let t=tf(e.path),r=e.severity==="error"?ge.bold.red:ge.bold.yellow,n=e.message.replace(/`([^`]+)`/g,(o,i)=>ge.yellow(`\`${i}\``));return `${r(`[${e.severity.toUpperCase()}]`)} ${ge.cyan(t)}: ${n}`},nf=({context:e,issue:t})=>e.config.logs.level==="silent"?false:t.severity==="error"?e.config.logs.level!=="warn":true,Sr=({context:e,result:t})=>{for(let r of t.issues)nf({context:e,issue:r})&&console.log(rf(r));t.valid||process.exit(1);};var Da=({logger:e,operations:t,preserveOrder:r,schemas:n,spec:o})=>{let i=e.timeEvent("filter-spec");if(o.definitions){let a={};if(r)for(let[p,c]of Object.entries(o.definitions))n.has(w("schema",p))&&(a[p]=c);else for(let p of n){let{name:c}=te(p),m=o.definitions[c];m&&(a[c]=m);}o.definitions=a;}if(o.paths)for(let a of Object.entries(o.paths)){let p=a[0],c=a[1];for(let m of re){if(!c[m])continue;let f=w("operation",V({method:m,path:p}));t.has(f)||delete c[m];}Object.keys(c).length||delete o.paths[p];}i.timeEnd();};var Fa=/^(application\/(pdf|rtf|msword|vnd\.(ms-|openxmlformats-officedocument\.)|zip|x-(7z|tar|rar|zip|iso)|octet-stream|gzip|x-msdownload|json\+download|xml|x-yaml|x-7z-compressed|x-tar)|text\/(yaml|css|javascript)|audio\/(mpeg|wav)|video\/(mp4|x-matroska)|image\/(vnd\.adobe\.photoshop|svg\+xml))(; ?charset=[^;]+)?$/i,Ba=/^application\/(.*\+)?json(;.*)?$/i,Ka=/^multipart\/form-data(;.*)?$/i,Wa=/^text\/[a-z0-9.+-]+(;.*)?$/i,za=/^application\/x-www-form-urlencoded(;.*)?$/i,_a=/^application\/octet-stream(;.*)?$/i,mt=({mediaType:e})=>(Fa.lastIndex=0,Fa.test(e)),Or=({mediaType:e})=>{if(Ba.lastIndex=0,Ba.test(e))return "json";if(Ka.lastIndex=0,Ka.test(e))return "form-data";if(Wa.lastIndex=0,Wa.test(e))return "text";if(za.lastIndex=0,za.test(e))return "url-search-params";if(_a.lastIndex=0,_a.test(e))return "octet-stream"};var Ha=({content:e})=>{let{mediaType:t,schema:r}=e;return r&&"$ref"in r?{allOf:[{...r}]}:r?r.type==="string"&&!r.format&&mt({mediaType:t})?{...r,format:"binary"}:r:mt({mediaType:t})?{format:"binary",type:"string"}:void 0},Bo=({mimeTypes:e,response:t})=>{let r=[];for(let n of e??[])r.push({mediaType:n,schema:t.schema,type:Or({mediaType:n})});return r};function Oe(e){let t=`^(${e.keywords.join("|")})$`;return new RegExp(t)}var He=(e,t,r)=>{let n=[];for(let o in t)t[o]===e&&n.push(o);return !n.length&&(!r||r())?[F(e)]:n};var Jr=({schema:e})=>{if(e.type)return e.type;if(e.properties)return "object"},sf=({irSchema:e,schema:t})=>{t.example&&(e.example=t.example),t.description&&(e.description=t.description),t.title&&(e.title=t.title);},Ln=({irSchema:e,schema:t})=>{t.default!==void 0&&(e.default=t.default),t.exclusiveMaximum?t.maximum!==void 0&&(e.exclusiveMaximum=t.maximum):t.maximum!==void 0&&(e.maximum=t.maximum),t.exclusiveMinimum?t.minimum!==void 0&&(e.exclusiveMinimum=t.minimum):t.minimum!==void 0&&(e.minimum=t.minimum),t.format&&(e.format=t.format),t.maxItems!==void 0&&(e.maxItems=t.maxItems),t.maxLength!==void 0&&(e.maxLength=t.maxLength),t.minItems!==void 0&&(e.minItems=t.minItems),t.minLength!==void 0&&(e.minLength=t.minLength),t.pattern&&(e.pattern=t.pattern),t.readOnly&&(e.accessScope="read");},of=({context:e,irSchema:t={},schema:r,state:n})=>{r.maxItems&&r.maxItems===r.minItems?t.type="tuple":t.type="array";let o=[];if(r.items){let i=Ee({context:e,schema:r.items,state:n});if(!o.length&&r.maxItems&&r.maxItems===r.minItems)o=Array(r.maxItems).fill(i);else if("$ref"in r.items)o.push(i);else {let a=r.items.allOf;a&&a.length>1&&!r.items["x-nullable"]?t={...t,...i}:o.push(i);}}return t=W({items:o,schema:t}),t},af=({irSchema:e={}})=>(e.type="boolean",e),pf=({irSchema:e={},schema:t})=>(e.type=t.type,e),cf=({context:e,irSchema:t={},schema:r,state:n})=>{t.type="object";let o={};for(let i in r.properties){let a=r.properties[i];if(typeof a!="boolean"){let p=Ee({context:e,schema:a,state:n});o[i]=p;}}if(Object.keys(o).length&&(t.properties=o),r.additionalProperties===void 0)t.properties||(t.additionalProperties={type:"unknown"});else if(typeof r.additionalProperties=="boolean")n.inAllOf&&r.additionalProperties===false&&(!r.properties||!Object.keys(r.properties).length)||(t.additionalProperties={type:r.additionalProperties?"unknown":"never"});else {let i=Ee({context:e,schema:r.additionalProperties,state:n});t.additionalProperties=i;}return r.required&&(t.required=r.required),t},mf=({irSchema:e={}})=>(e.type="string",e),Tr=({schema:e})=>{let t={};return sf({irSchema:t,schema:e}),t},lf=({context:e,schema:t,state:r})=>{let n=Tr({schema:t}),o=[],i=Jr({schema:t}),a=t.allOf;for(let p of a){let c=r.inAllOf;"$ref"in p||(r.inAllOf=true);let m=Ee({context:e,schema:p,state:r});if(r.inAllOf=c,r.inAllOf===void 0&&delete r.inAllOf,t.required&&(m.required?m.required=[...m.required,...t.required]:m.required=t.required),o.push(m),p.$ref){let l=e.resolveRef(p.$ref);if(l.discriminator&&r.$ref){let d=He(r.$ref).map(y=>({const:y,type:"string"})),u={properties:{[l.discriminator]:d.length>1?{items:d,logicalOperator:"or"}:d[0]},type:"object"};l.required?.includes(l.discriminator)&&(u.required=[l.discriminator]),o.push(u);}}}if(i==="object"){let p=Gr({context:e,schema:{...t,type:"object"},state:r});if(p.properties){for(let c of p.required??[])if(!p.properties[c])for(let m of a){let l=m.$ref?e.resolveRef(m.$ref):m;if(Jr({schema:l})==="object"){let f=Gr({context:e,schema:{...l,type:"object"},state:r});if(f.properties?.[c]){p.properties[c]=f.properties[c];break}}}o.push(p);}}if(n=W({items:o,logicalOperator:"and",mutateSchemaOneItem:true,schema:n}),t["x-nullable"]){let p=[{type:"null"}];o.length&&p.unshift(n),n={items:p,logicalOperator:"or"},p[0].deprecated&&(n.deprecated=p[0].deprecated),p[0].description&&(n.description=p[0].description);}return n},ff=({context:e,schema:t,state:r})=>{let n=Tr({schema:t});n.type="enum";let o=[];for(let[i,a]of t.enum.entries()){let p=typeof a,c;if(p==="string"||p==="number"||p==="boolean"?c=p:p==="object"&&Array.isArray(a)?c="array":a===null?t["x-nullable"]&&(c="null"):console.warn("\u{1F6A8}",`unhandled "${p}" typeof value "${a}" for enum`,t.enum),!c)continue;let m=Gr({context:e,schema:{description:t["x-enum-descriptions"]?.[i],title:t["x-enum-varnames"]?.[i]??t["x-enumNames"]?.[i],type:c==="null"?"string":c},state:r});m.const=a,c==="null"&&(m.type=c),m.type==="array"&&(m.type="tuple"),o.push(m);}return n=W({items:o,schema:n}),n},df=({context:e,schema:t,state:r})=>{let n={};if(!t.$ref.startsWith("#/definitions/")&&!r.circularReferenceTracker.has(t.$ref)){r.refStack.push(t.$ref);let i=e.resolveRef(t.$ref),a=r.$ref;r.$ref=t.$ref;let p=Ee({context:e,schema:i,state:r});return r.$ref=a,r.refStack.pop(),p}if(n.$ref=decodeURI(t.$ref),n.$ref=n.$ref.replace(/#\/definitions\/([^/]+)/g,"#/components/schemas/$1"),r.refStack.includes(t.$ref)&&(r.refStack[0]===t.$ref&&(r.circularRef=t.$ref),n.circular=true),!r.circularReferenceTracker.has(t.$ref)){r.refStack.push(t.$ref);let i=e.resolveRef(t.$ref),a=r.$ref;r.$ref=t.$ref,Ee({context:e,schema:i,state:r}),r.circularRef&&r.refStack[0]===r.circularRef&&(n.circular=true),r.$ref=a,r.refStack.pop();}return n},uf=({context:e,irSchema:t,schema:r,state:n})=>{t||(t=Tr({schema:r}));let o={};Ln({irSchema:o,schema:r}),o.default===null&&delete o.default;let i=[Gr({context:e,irSchema:o,schema:r,state:n}),{type:"null"}];return t=W({items:i,schema:t}),t},yf=({context:e,schema:t,state:r})=>{let n=Tr({schema:t});Ln({irSchema:n,schema:t});let o=Jr({schema:t});return o?t["x-nullable"]?uf({context:e,irSchema:n,schema:{...t,type:o},state:r}):Gr({context:e,irSchema:n,schema:{...t,type:o},state:r}):n},Gr=({context:e,irSchema:t,schema:r,state:n})=>{switch(t||(t=Tr({schema:r}),Ln({irSchema:t,schema:r})),r.type){case "array":return of({context:e,irSchema:t,schema:r,state:n});case "boolean":return af({irSchema:t});case "integer":case "number":return pf({irSchema:t,schema:r});case "object":return cf({context:e,irSchema:t,schema:r,state:n});case "string":return mf({irSchema:t});default:return Qa({irSchema:t,schema:r})}},Qa=({irSchema:e,schema:t})=>(e||(e=Tr({schema:t})),e.type="unknown",Ln({irSchema:e,schema:t}),e),Ee=({context:e,schema:t,state:r})=>(r||(r={circularReferenceTracker:new Set,refStack:[]}),r.$ref&&r.circularReferenceTracker.add(r.$ref),t.$ref?df({context:e,schema:t,state:r}):t.enum?ff({context:e,schema:t,state:r}):t.allOf?lf({context:e,schema:t,state:r}):t.type||t.properties?yf({context:e,schema:t,state:r}):Qa({schema:t})),Za=({$ref:e,context:t,schema:r})=>{t.ir.components||(t.ir.components={}),t.ir.components.schemas||(t.ir.components.schemas={}),t.ir.components.schemas[F(e)]=Ee({context:t,schema:r,state:{$ref:e,circularReferenceTracker:new Set,refStack:[e]}});};var hf=e=>e==="boolean"||e==="integer"||e==="number"||e==="string",It=({context:e,name:t,schema:r})=>{if(Oe(e.config.parser.pagination).test(t))return true;if("$ref"in r){let o=e.resolveRef(r.$ref??"");if("in"in o&&o.in){let i="schema"in o?o.schema:{...o,in:void 0};return It({context:e,name:t,schema:i})}return It({context:e,name:t,schema:o})}if("in"in r){if(!r.in)return false;let o="schema"in r?r.schema:{...r,in:void 0};return It({context:e,name:t,schema:o})}for(let o in r.properties)if(Oe(e.config.parser.pagination).test(o)){let a=r.properties[o];if(typeof a!="boolean"&&!("$ref"in a)){let p=Jr({schema:a});if(hf(p))return o}}for(let o of r.allOf??[]){let i=It({context:e,name:t,schema:o});if(i)return i}return false};var gf=({irOperation:e,operation:t})=>{t.deprecated!==void 0&&(e.deprecated=t.deprecated),t.description&&(e.description=t.description),t.summary&&(e.summary=t.summary),t.tags?.length&&(e.tags=t.tags);},xf=({context:e,method:t,operation:r,path:n,state:o})=>{let i={id:zt({context:e,id:r.operationId,method:t,path:n,state:o}),method:t,path:n};return r.operationId&&(i.operationId=r.operationId),gf({irOperation:i,operation:r}),i},bf=({context:e,method:t,operation:r,path:n,securitySchemesMap:o,state:i})=>{let a=xf({context:e,method:t,operation:r,path:n,state:i});r.parameters&&(a.parameters=r.parameters);let p=false,c={mediaType:"",schema:{properties:{},required:[],type:"object"}},m=[];for(let l of r.requestBody??[]){let f="$ref"in l?e.resolveRef(l.$ref):l,d=f.in==="body"?f.schema:{...f,format:f.type==="file"?"binary":f.format,required:void 0,type:f.type==="file"?"string":f.type},u=Bo({mimeTypes:r.consumes,response:{schema:d}}),y=u.find(g=>g.type==="json")||u[0];if(y){let g=It({context:e,name:"",schema:y.schema&&"$ref"in y.schema?{allOf:[{...y.schema}],description:f.description}:{description:f.description,...y.schema}}),x=Ee({context:e,schema:"$ref"in f?{allOf:[{...f,$ref:f.$ref,required:[],type:"string"}],description:f.description}:y.schema&&"$ref"in y.schema?{allOf:[{...y.schema}],description:f.description}:{description:f.description,...y.schema},state:void 0});c.mediaType=y.mediaType,f.in==="body"?c.schema=x:(c.schema.properties[f.name]=x,f.required&&m.push(f.name)),g&&(c.pagination=g),y.type&&(c.type=y.type);}f.required&&(p=true);}c.mediaType&&(m.length&&(c.schema.required=m),a.body=c,p&&(a.body.required=p));for(let l in r.responses){a.responses||(a.responses={});let f=r.responses[l],d="$ref"in f?e.resolveRef(f.$ref):f,u=Bo({mimeTypes:r.produces?r.produces:["application/json"],response:d}),y=u.find(g=>g.type==="json")||u[0];y?a.responses[l]={mediaType:y.mediaType,schema:Ee({context:e,schema:{description:d.description,...Ha({content:y})},state:void 0})}:a.responses[l]={schema:{description:d.description,type:l==="204"?"void":"unknown"}};}if(r.security){let l=new Map;for(let f of r.security)for(let d in f){let u=o.get(d);if(!u)continue;let y;if(u.type==="apiKey"&&(y=u),u.type==="basic"&&(y={description:u.description,scheme:"basic",type:"http"}),u.type==="oauth2")switch(y={description:u.description,flows:{},type:"oauth2"},u.flow){case "accessCode":y.flows.authorizationCode={authorizationUrl:u.authorizationUrl,scopes:u.scopes,tokenUrl:u.tokenUrl};break;case "application":y.flows.clientCredentials={scopes:u.scopes,tokenUrl:u.tokenUrl};break;case "implicit":y.flows.implicit={authorizationUrl:u.authorizationUrl,scopes:u.scopes};break;case "password":y.flows.password={scopes:u.scopes,tokenUrl:u.tokenUrl};break}y&&l.set(d,y);}l.size&&(a.security=Array.from(l.values()));}return a},kt=({context:e,method:t,operation:r,path:n,securitySchemesMap:o,state:i})=>{e.ir.paths||(e.ir.paths={}),e.ir.paths[n]||(e.ir.paths[n]={}),e.ir.paths[n][t]=bf({context:e,method:t,operation:r,path:n,securitySchemesMap:o,state:i});};var Sf=e=>{switch(e){case "multi":return true;case "csv":case "pipes":case "ssv":case "tsv":default:return false}},Of=e=>{switch(e){case "header":case "path":return "simple";case "query":default:return "form"}},lt=({context:e,operation:t,parameters:r})=>{if(!r||!Object.keys(r).length)return;let n={};for(let o of r){let i="$ref"in o?e.dereference(o):o;if(i.in==="body"||i.in==="formData"){t.requestBody||(t.requestBody=[]),t.requestBody.push(i);continue}n[i.in]||(n[i.in]={}),n[i.in][i.name.toLocaleLowerCase()]=Tf({$ref:`#/todo/real/path/to/parameter/${i.name}`,context:e,parameter:i});}return n},Tf=({$ref:e,context:t,parameter:r})=>{let n=r,o=n&&"$ref"in n?{allOf:[{...n,$ref:n.$ref,required:Array.isArray(n.required)?n.required:[],type:n.type}],description:r.description}:{description:r.description,...n,required:Array.isArray(n.required)?n.required:[],type:n.type},i=It({context:t,name:r.name,schema:o}),a=Of(r.in),m={allowReserved:false,explode:Sf(r.collectionFormat),location:r.in,name:r.name,schema:Ee({context:t,schema:o,state:{$ref:e,circularReferenceTracker:new Set,refStack:[e]}}),style:a};return r.description&&(m.description=r.description),i&&(m.pagination=i),r.required&&(m.required=r.required),m};var Ua=/^(([^:/?#]+):)?((\/\/)?([^:/?#]*)(:?([^/?#]*)))?([^?#]*)(\?([^#]*))?(#(.*))?/,Qe=e=>{let t={host:"",path:"",port:"",protocol:""};Ua.lastIndex=0;let r=e.match(Ua);if(!r)return t;let n=r[5]||"";if(n==="."||n==="..")return t;let o=r[8]||"",i=r[2]||"";return i.length===1?t:{host:n,path:o==="/"?"":o,port:r[7]||"",protocol:i}};var Xa=({context:e})=>{let t=e.spec.schemes??[],r=e.spec.host??"",n=e.spec.basePath??"";for(let i of e.config.input)if(typeof i.path=="string"){let a=Qe(i.path);t.length||a.protocol&&(t=[a.protocol]),r||(r=`${a.host}${a.port?`:${a.port}`:""}`);}t.length||(t=[""]);let o=t.map(i=>`${i?`${i}://`:""}${r}${n}`).filter(Boolean);o.length&&(e.ir.servers=o.map(i=>({url:i})));};var Ja=(e,t)=>{let r=t.timeEvent("validate"),n=[],o=new Map;if(e.paths)for(let i of Object.entries(e.paths)){let a=i[0],p=i[1];for(let c of re){if(c==="trace")continue;let m=p[c];if(!m)continue;let l=V({method:c,path:a});m.operationId&&(o.has(m.operationId)?n.push({code:"duplicate_key",context:{key:"operationId",value:m.operationId},message:"Duplicate `operationId` found. Each `operationId` must be unique.",path:["paths",a,c,"operationId"],severity:"error"}):o.set(m.operationId,l));}}return r.timeEnd(),{issues:n,valid:!n.some(i=>i.severity==="error")}};var Ko=e=>{if(e.config.parser.validate_EXPERIMENTAL){let o=Ja(e.spec,e.logger);Sr({context:e,result:o});}if(yr(e.config.parser.filters)){let o=ur(e.config.parser.filters,e.spec,e.logger),{graph:i}=Et(e.spec,e.logger),{resourceMetadata:a}=gr(i,e.logger),p=hr({filters:o,logger:e.logger,resourceMetadata:a});Da({...p,logger:e.logger,preserveOrder:o.preserveOrder,spec:e.spec});}br({context:e});let r={ids:new Map},n=new Map;for(let o in e.spec.securityDefinitions){let i=e.spec.securityDefinitions[o];n.set(o,i);}if(e.spec.definitions)for(let o in e.spec.definitions){let i=`#/definitions/${o}`,a=e.spec.definitions[o];Za({$ref:i,context:e,schema:a});}Xa({context:e});for(let o in e.spec.paths){if(o.startsWith("x-"))continue;let i=e.spec.paths[o],a=i.$ref?{...e.resolveRef(i.$ref),...i}:i,p={consumes:e.spec.consumes,produces:e.spec.produces,responses:{},security:e.spec.security},c={context:e,operation:{...p,parameters:lt({context:e,operation:p,parameters:a.parameters})},path:o,securitySchemesMap:n,state:r};if(a.delete){let m=$({source:lt({context:e,operation:a.delete,parameters:a.delete.parameters}),target:c.operation.parameters});kt({...c,method:"delete",operation:{...c.operation,...a.delete,parameters:m}});}if(a.get){let m=$({source:lt({context:e,operation:a.get,parameters:a.get.parameters}),target:c.operation.parameters});kt({...c,method:"get",operation:{...c.operation,...a.get,parameters:m}});}if(a.head){let m=$({source:lt({context:e,operation:a.head,parameters:a.head.parameters}),target:c.operation.parameters});kt({...c,method:"head",operation:{...c.operation,...a.head,parameters:m}});}if(a.options){let m=$({source:lt({context:e,operation:a.options,parameters:a.options.parameters}),target:c.operation.parameters});kt({...c,method:"options",operation:{...c.operation,...a.options,parameters:m}});}if(a.patch){let m=$({source:lt({context:e,operation:a.patch,parameters:a.patch.parameters}),target:c.operation.parameters});kt({...c,method:"patch",operation:{...c.operation,...a.patch,parameters:m}});}if(a.post){let m=$({source:lt({context:e,operation:a.post,parameters:a.post.parameters}),target:c.operation.parameters});kt({...c,method:"post",operation:{...c.operation,...a.post,parameters:m}});}if(a.put){let m=$({source:lt({context:e,operation:a.put,parameters:a.put.parameters}),target:c.operation.parameters});kt({...c,method:"put",operation:{...c.operation,...a.put,parameters:m}});}}};var Ga=({logger:e,operations:t,parameters:r,preserveOrder:n,requestBodies:o,responses:i,schemas:a,spec:p})=>{let c=e.timeEvent("filter-spec");if(p.components){if(p.components.parameters){let m={};if(n)for(let[l,f]of Object.entries(p.components.parameters))r.has(w("parameter",l))&&(m[l]=f);else for(let l of r){let{name:f}=te(l),d=p.components.parameters[f];d&&(m[f]=d);}p.components.parameters=m;}if(p.components.requestBodies){let m={};if(n)for(let[l,f]of Object.entries(p.components.requestBodies))o.has(w("body",l))&&(m[l]=f);else for(let l of o){let{name:f}=te(l),d=p.components.requestBodies[f];d&&(m[f]=d);}p.components.requestBodies=m;}if(p.components.responses){let m={};if(n)for(let[l,f]of Object.entries(p.components.responses))i.has(w("response",l))&&(m[l]=f);else for(let l of i){let{name:f}=te(l),d=p.components.responses[f];d&&(m[f]=d);}p.components.responses=m;}if(p.components.schemas){let m={};if(n)for(let[l,f]of Object.entries(p.components.schemas))a.has(w("schema",l))&&(m[l]=f);else for(let l of a){let{name:f}=te(l),d=p.components.schemas[f];d&&(m[f]=d);}p.components.schemas=m;}}if(p.paths)for(let m of Object.entries(p.paths)){let l=m[0],f=m[1];for(let d of re){if(!f[d])continue;let y=w("operation",V({method:d,path:l}));t.has(y)||delete f[d];}Object.keys(f).length||delete p.paths[l];}c.timeEnd();};var Ya=({content:e})=>{let{mediaType:t,schema:r}=e;return r&&"$ref"in r?{allOf:[{...r}]}:r?r.type==="string"&&!r.format&&mt({mediaType:t})?{...r,format:"binary"}:r:mt({mediaType:t})?{format:"binary",type:"string"}:void 0},ft=({content:e})=>{let t=[];for(let r in e)t.push({mediaType:r,schema:e[r].schema,type:Or({mediaType:r})});return t};var Ht=({schema:e})=>{if(e.type)return e.type;if(e.properties)return "object"},Rf=({irSchema:e,schema:t})=>{t.deprecated!==void 0&&(e.deprecated=t.deprecated),t.example&&(e.example=t.example),t.description&&(e.description=t.description),t.title&&(e.title=t.title);},Vn=({irSchema:e,schema:t})=>{t.default!==void 0&&(e.default=t.default),t.exclusiveMaximum?t.maximum!==void 0&&(e.exclusiveMaximum=t.maximum):t.maximum!==void 0&&(e.maximum=t.maximum),t.exclusiveMinimum?t.minimum!==void 0&&(e.exclusiveMinimum=t.minimum):t.minimum!==void 0&&(e.minimum=t.minimum),t.format&&(e.format=t.format),t.maxItems!==void 0&&(e.maxItems=t.maxItems),t.maxLength!==void 0&&(e.maxLength=t.maxLength),t.minItems!==void 0&&(e.minItems=t.minItems),t.minLength!==void 0&&(e.minLength=t.minLength),t.pattern&&(e.pattern=t.pattern),t.readOnly?e.accessScope="read":t.writeOnly&&(e.accessScope="write");},Af=({context:e,irSchema:t={},schema:r,state:n})=>{r.maxItems&&r.maxItems===r.minItems?t.type="tuple":t.type="array";let o=[];if(r.items){let i=ie({context:e,schema:r.items,state:n});if(!o.length&&r.maxItems&&r.maxItems===r.minItems)o=Array(r.maxItems).fill(i);else if("$ref"in r.items)o.push(i);else {let a=r.items.allOf||r.items.anyOf||r.items.oneOf;a&&a.length>1&&!r.items.nullable?t={...t,...i}:o.push(i);}}return t=W({items:o,schema:t}),t},Pf=({irSchema:e={}})=>(e.type="boolean",e),Ef=({irSchema:e={},schema:t})=>(e.type=t.type,e),If=({context:e,irSchema:t={},schema:r,state:n})=>{t.type="object";let o={};for(let i in r.properties){let a=r.properties[i];typeof a=="boolean"||(o[i]=ie({context:e,schema:a,state:n}));}if(Object.keys(o).length&&(t.properties=o),r.additionalProperties===void 0)t.properties||(t.additionalProperties={type:"unknown"});else if(typeof r.additionalProperties=="boolean")n.inAllOf&&r.additionalProperties===false&&(!r.properties||!Object.keys(r.properties).length)||(t.additionalProperties={type:r.additionalProperties?"unknown":"never"});else {let i=ie({context:e,schema:r.additionalProperties,state:n});t.additionalProperties=i;}return r.required&&(t.required=r.required),t},kf=({irSchema:e={}})=>(e.type="string",e),jt=({schema:e})=>{let t={};return Rf({irSchema:t,schema:e}),t},jf=({context:e,schema:t,state:r})=>{let n=jt({schema:t}),o=[],i=Ht({schema:t}),a=t.allOf;for(let p of a){let c=r.inAllOf;"$ref"in p||(r.inAllOf=true);let m=ie({context:e,schema:p,state:r});if(r.inAllOf=c,r.inAllOf===void 0&&delete r.inAllOf,t.required&&(m.required?m.required=[...m.required,...t.required]:m.required=t.required),o.push(m),"$ref"in p){let l=e.resolveRef(p.$ref);if(l.discriminator&&r.$ref){let f=He(r.$ref,l.discriminator.mapping,l.oneOf?()=>l.oneOf.some(d=>"$ref"in d&&d.$ref===r.$ref):void 0);if(f.length>0){let d=f.map(y=>({const:y,type:"string"})),u={properties:{[l.discriminator.propertyName]:d.length>1?{items:d,logicalOperator:"or"}:d[0]},type:"object"};l.required?.includes(l.discriminator.propertyName)&&(u.required=[l.discriminator.propertyName]),o.push(u);}}}}if(i==="object"){let p=Qt({context:e,schema:{...t,type:"object"},state:r});if(p.properties){for(let c of p.required??[])if(!p.properties[c])for(let m of a){let l="$ref"in m?e.resolveRef(m.$ref):m;if(Ht({schema:l})==="object"){let f=Qt({context:e,schema:{...l,type:"object"},state:r});if(f.properties?.[c]){p.properties[c]=f.properties[c];break}}}o.push(p);}}if(n=W({items:o,logicalOperator:"and",mutateSchemaOneItem:true,schema:n}),t.nullable){let p=[{type:"null"}];o.length&&p.unshift(n),n={items:p,logicalOperator:"or"},p[0].deprecated&&(n.deprecated=p[0].deprecated),p[0].description&&(n.description=p[0].description);}return n},Cf=({context:e,schema:t,state:r})=>{let n=jt({schema:t}),o=[],i=Ht({schema:t}),a=t.anyOf;for(let p of a){let c=ie({context:e,schema:p,state:r});if(t.discriminator&&c.$ref!=null){let l=He(c.$ref,t.discriminator.mapping).map(d=>({const:d,type:"string"}));c={items:[{properties:{[t.discriminator.propertyName]:l.length>1?{items:l,logicalOperator:"or"}:l[0]},type:"object"},c],logicalOperator:"and"};}o.push(c);}if(t.nullable&&o.push({type:"null"}),n=W({items:o,mutateSchemaOneItem:true,schema:n}),i==="object"){let p=Qt({context:e,schema:{...t,type:"object"},state:r});p.properties&&(n={items:[n,p],logicalOperator:"and"});}return n},Nf=({context:e,schema:t,state:r})=>{let n=jt({schema:t});n.type="enum";let o=[];for(let[i,a]of t.enum.entries()){let p=typeof a,c;if(p==="string"||p==="number"||p==="boolean"?c=p:p==="object"&&Array.isArray(a)?c="array":a===null?t.nullable&&(c="null"):console.warn("\u{1F6A8}",`unhandled "${p}" typeof value "${a}" for enum`,t.enum),!c)continue;let m=Qt({context:e,schema:{description:t["x-enum-descriptions"]?.[i],title:t["x-enum-varnames"]?.[i]??t["x-enumNames"]?.[i],type:c==="null"?"string":c},state:r});m.const=a,c==="null"&&(m.type=c),m.type==="array"&&(m.type="tuple"),o.push(m);}return n=W({items:o,schema:n}),n},vf=({context:e,schema:t,state:r})=>{let n=jt({schema:t}),o=[],i=Ht({schema:t}),a=t.oneOf;for(let p of a){let c=ie({context:e,schema:p,state:r});if(t.discriminator&&c.$ref!=null){let l=He(c.$ref,t.discriminator.mapping).map(d=>({const:d,type:"string"}));c={items:[{properties:{[t.discriminator.propertyName]:l.length>1?{items:l,logicalOperator:"or"}:l[0]},required:[t.discriminator.propertyName],type:"object"},c],logicalOperator:"and"};}c.logicalOperator==="or"&&c.type!=="array"&&c.items?o=o.concat(c.items):o.push(c);}if(t.nullable&&o.push({type:"null"}),n=W({items:o,mutateSchemaOneItem:true,schema:n}),i==="object"){let p=Qt({context:e,schema:{...t,type:"object"},state:r});p.properties&&(n={items:[n,p],logicalOperator:"and"});}return n},wf=({context:e,schema:t,state:r})=>{if(!t.$ref.startsWith("#/components/")&&!r.circularReferenceTracker.has(t.$ref)){r.refStack.push(t.$ref);let i=e.resolveRef(t.$ref),a=r.$ref;r.$ref=t.$ref;let p=ie({context:e,schema:i,state:r});return r.$ref=a,r.refStack.pop(),p}let o={};if(o.$ref=decodeURI(t.$ref),r.refStack.includes(t.$ref)&&(r.refStack[0]===t.$ref&&(r.circularRef=t.$ref),o.circular=true),!r.circularReferenceTracker.has(t.$ref)){r.refStack.push(t.$ref);let i=e.resolveRef(t.$ref),a=r.$ref;r.$ref=t.$ref,ie({context:e,schema:i,state:r}),r.circularRef&&r.refStack[0]===r.circularRef&&(o.circular=true),r.$ref=a,r.refStack.pop();}return o},qf=({context:e,irSchema:t,schema:r,state:n})=>{t||(t=jt({schema:r}));let o={};Vn({irSchema:o,schema:r}),o.default===null&&delete o.default;let i=[Qt({context:e,irSchema:o,schema:r,state:n}),{type:"null"}];return t=W({items:i,schema:t}),t},$f=({context:e,schema:t,state:r})=>{let n=jt({schema:t});Vn({irSchema:n,schema:t});let o=Ht({schema:t});return o?t.nullable?qf({context:e,irSchema:n,schema:{...t,type:o},state:r}):Qt({context:e,irSchema:n,schema:{...t,type:o},state:r}):n},Qt=({context:e,irSchema:t,schema:r,state:n})=>{switch(t||(t=jt({schema:r}),Vn({irSchema:t,schema:r})),r.type){case "array":return Af({context:e,irSchema:t,schema:r,state:n});case "boolean":return Pf({irSchema:t});case "integer":case "number":return Ef({irSchema:t,schema:r});case "object":return If({context:e,irSchema:t,schema:r,state:n});case "string":return kf({irSchema:t});default:return ep({irSchema:t,schema:r})}},ep=({irSchema:e,schema:t})=>(e||(e=jt({schema:t})),e.type="unknown",Vn({irSchema:e,schema:t}),e),ie=({context:e,schema:t,state:r})=>(r||(r={circularReferenceTracker:new Set,refStack:[]}),r.$ref&&r.circularReferenceTracker.add(r.$ref),"$ref"in t?wf({context:e,schema:t,state:r}):t.enum?Nf({context:e,schema:t,state:r}):t.allOf?jf({context:e,schema:t,state:r}):t.anyOf?Cf({context:e,schema:t,state:r}):t.oneOf?vf({context:e,schema:t,state:r}):t.type||t.properties?$f({context:e,schema:t,state:r}):ep({schema:t})),tp=({$ref:e,context:t,schema:r})=>{t.ir.components||(t.ir.components={}),t.ir.components.schemas||(t.ir.components.schemas={}),t.ir.components.schemas[F(e)]=ie({context:t,schema:r,state:{$ref:e,circularReferenceTracker:new Set,refStack:[e]}});};var Mf=e=>e==="boolean"||e==="integer"||e==="number"||e==="string",Zt=({context:e,name:t,schema:r})=>{if(Oe(e.config.parser.pagination).test(t))return true;if("$ref"in r){let o=e.resolveRef(r.$ref);if("content"in o||"in"in o){let i;if("in"in o&&(i=o.schema),!i){let a=ft({content:o.content}),p=a.find(c=>c.type==="json")||a[0];p?.schema&&(i=p.schema);}return i?Zt({context:e,name:t,schema:i}):false}return Zt({context:e,name:t,schema:o})}for(let o in r.properties)if(Oe(e.config.parser.pagination).test(o)){let a=r.properties[o];if(typeof a!="boolean"&&!("$ref"in a)){let p=Ht({schema:a});if(Mf(p))return o}}for(let o of r.allOf??[]){let i=Zt({context:e,name:t,schema:o});if(i)return i}return false};var Lf=({irOperation:e,operation:t})=>{t.deprecated!==void 0&&(e.deprecated=t.deprecated),t.description&&(e.description=t.description),t.summary&&(e.summary=t.summary),t.tags?.length&&(e.tags=t.tags);},Vf=({context:e,method:t,operation:r,path:n,state:o})=>{let i={id:zt({context:e,id:r.operationId,method:t,path:n,state:o}),method:t,path:n};return r.operationId&&(i.operationId=r.operationId),Lf({irOperation:i,operation:r}),i},Df=({context:e,method:t,operation:r,path:n,securitySchemesMap:o,state:i})=>{let a=Vf({context:e,method:t,operation:r,path:n,state:i});if(r.parameters&&(a.parameters=r.parameters),r.requestBody){let p="$ref"in r.requestBody?e.resolveRef(r.requestBody.$ref):r.requestBody,c=ft({content:p.content}),m=c.find(l=>l.type==="json")||c[0];if(m){let l=Zt({context:e,name:"",schema:m.schema&&"$ref"in m.schema?{allOf:[{...m.schema}],description:p.description}:{description:p.description,...m.schema}});a.body={mediaType:m.mediaType,schema:ie({context:e,schema:"$ref"in r.requestBody?{allOf:[{...r.requestBody}],description:p.description}:m.schema&&"$ref"in m.schema?{allOf:[{...m.schema}],description:p.description}:{description:p.description,...m.schema},state:void 0})},l&&(a.body.pagination=l),p.required&&(a.body.required=p.required),m.type&&(a.body.type=m.type);}}for(let p in r.responses){a.responses||(a.responses={});let c=r.responses[p],m="$ref"in c?e.resolveRef(c.$ref):c,l=ft({content:m.content}),f=l.find(d=>d.type==="json")||l[0];f?a.responses[p]={mediaType:f.mediaType,schema:ie({context:e,schema:{description:m.description,...Ya({content:f})},state:void 0})}:a.responses[p]={schema:{description:m.description,type:p==="204"?"void":"unknown"}};}if(r.security){let p=new Map;for(let c of r.security)for(let m in c){let l=o.get(m);l&&p.set(m,l);}p.size&&(a.security=Array.from(p.values()));}return a},dt=({context:e,method:t,operation:r,path:n,securitySchemesMap:o,state:i})=>{e.ir.paths||(e.ir.paths={}),e.ir.paths[n]||(e.ir.paths[n]={}),r.servers&&(e.ir.servers=[...e.ir.servers??[],...r.servers]),e.ir.paths[n][t]=Df({context:e,method:t,operation:r,path:n,securitySchemesMap:o,state:i});};var Ff=e=>{switch(e){case "query":return false;default:return}},Bf=e=>{switch(e){case "deepObject":case "form":return true;default:return false}},Kf=e=>{switch(e){case "header":case "path":return "simple";case "cookie":case "query":return "form"}},Ze=({context:e,parameters:t})=>{if(!t||!Object.keys(t).length)return;let r={};for(let n of t){let o="$ref"in n?e.dereference(n):n;r[o.in]||(r[o.in]={}),r[o.in][o.name.toLocaleLowerCase()]=rp({$ref:`#/todo/real/path/to/parameter/${o.name}`,context:e,parameter:o});}return r},rp=({$ref:e,context:t,parameter:r})=>{let n=r.schema;if(!n){let l=ft({content:r.content}),f=l.find(d=>d.type==="json")||l[0];f&&(n=f.schema);}let o=n&&"$ref"in n?{allOf:[{...n}],deprecated:r.deprecated,description:r.description}:{deprecated:r.deprecated,description:r.description,...n},i=Zt({context:t,name:r.name,schema:o}),a=r.style||Kf(r.in),p=r.explode!==void 0?r.explode:Bf(a),m={allowReserved:r.allowReserved!==void 0?r.allowReserved:Ff(r.in),explode:p,location:r.in,name:r.name,schema:ie({context:t,schema:o,state:{$ref:e,circularReferenceTracker:new Set,refStack:[e]}}),style:a};return r.deprecated&&(m.deprecated=r.deprecated),r.description&&(m.description=r.description),i&&(m.pagination=i),r.required&&(m.required=r.required),m},np=({$ref:e,context:t,parameter:r})=>{t.ir.components||(t.ir.components={}),t.ir.components.parameters||(t.ir.components.parameters={}),t.ir.components.parameters[F(e)]=rp({$ref:e,context:t,parameter:r});};var Wf=({$ref:e,context:t,requestBody:r})=>{let n=ft({content:r.content}),o=n.find(c=>c.type==="json")||n[0],i=o?o.schema:void 0,a={description:r.description,...i},p={schema:ie({context:t,schema:a,state:{$ref:e,circularReferenceTracker:new Set,refStack:[e]}})};return r.description&&(p.description=r.description),r.required&&(p.required=r.required),p},sp=({$ref:e,context:t,requestBody:r})=>{t.ir.components||(t.ir.components={}),t.ir.components.requestBodies||(t.ir.components.requestBodies={}),t.ir.components.requestBodies[F(e)]=Wf({$ref:e,context:t,requestBody:r});};var op=({context:e})=>{if(e.spec.servers){e.ir.servers=e.spec.servers;return}for(let t of e.config.input)if(typeof t.path=="string"){let r=Qe(t.path);e.ir.servers=[{url:`${r.protocol?`${r.protocol}://`:""}${r.host}${r.port?`:${r.port}`:""}`}];}e.ir.servers||(e.ir.servers=[{url:"/"}]);};var ip=(e,t)=>{let r=t.timeEvent("validate"),n=[],o=new Map;if(e.paths)for(let i of Object.entries(e.paths)){let a=i[0],p=i[1];for(let c of re){let m=p[c];if(!m)continue;let l=V({method:c,path:a});m.operationId&&(o.has(m.operationId)?n.push({code:"duplicate_key",context:{key:"operationId",value:m.operationId},message:"Duplicate `operationId` found. Each `operationId` must be unique.",path:["paths",a,c,"operationId"],severity:"error"}):o.set(m.operationId,l));}}if(e.servers){(typeof e.servers!="object"||!Array.isArray(e.servers))&&n.push({code:"invalid_type",message:"`servers` must be an array.",path:[],severity:"error"});for(let i=0;i<e.servers.length;i++){let a=e.servers[i];!a||typeof a!="object"?n.push({code:"invalid_type",context:{actual:typeof a,expected:"object"},message:"Each entry in `servers` must be an object.",path:["servers",i],severity:"error"}):a.url||n.push({code:"missing_required_field",context:{field:"url"},message:"Missing required field `url` in server object.",path:["servers",i],severity:"error"});}}return r.timeEnd(),{issues:n,valid:!n.some(i=>i.severity==="error")}};var Wo=e=>{if(e.config.parser.validate_EXPERIMENTAL){let o=ip(e.spec,e.logger);Sr({context:e,result:o});}if(yr(e.config.parser.filters)){let o=ur(e.config.parser.filters,e.spec,e.logger),{graph:i}=Et(e.spec,e.logger),{resourceMetadata:a}=gr(i,e.logger),p=hr({filters:o,logger:e.logger,resourceMetadata:a});Ga({...p,logger:e.logger,preserveOrder:o.preserveOrder,spec:e.spec});}br({context:e});let r={ids:new Map},n=new Map;if(e.spec.components){for(let o in e.spec.components.securitySchemes){let i=e.spec.components.securitySchemes[o],a="$ref"in i?e.resolveRef(i.$ref):i;n.set(o,a);}for(let o in e.spec.components.parameters){let i=`#/components/parameters/${o}`,a=e.spec.components.parameters[o],p="$ref"in a?e.resolveRef(a.$ref):a;np({$ref:i,context:e,parameter:p});}for(let o in e.spec.components.requestBodies){let i=`#/components/requestBodies/${o}`,a=e.spec.components.requestBodies[o],p="$ref"in a?e.resolveRef(a.$ref):a;sp({$ref:i,context:e,requestBody:p});}for(let o in e.spec.components.schemas){let i=`#/components/schemas/${o}`,a=e.spec.components.schemas[o];tp({$ref:i,context:e,schema:a});}}op({context:e});for(let o in e.spec.paths){let i=e.spec.paths[o],a=i.$ref?{...e.resolveRef(i.$ref),...i}:i,p={context:e,operation:{description:a.description,parameters:Ze({context:e,parameters:a.parameters}),security:e.spec.security,servers:a.servers,summary:a.summary},path:o,securitySchemesMap:n,state:r};a.delete&&dt({...p,method:"delete",operation:{...p.operation,...a.delete,parameters:$({source:Ze({context:e,parameters:a.delete.parameters}),target:p.operation.parameters})}}),a.get&&dt({...p,method:"get",operation:{...p.operation,...a.get,parameters:$({source:Ze({context:e,parameters:a.get.parameters}),target:p.operation.parameters})}}),a.head&&dt({...p,method:"head",operation:{...p.operation,...a.head,parameters:$({source:Ze({context:e,parameters:a.head.parameters}),target:p.operation.parameters})}}),a.options&&dt({...p,method:"options",operation:{...p.operation,...a.options,parameters:$({source:Ze({context:e,parameters:a.options.parameters}),target:p.operation.parameters})}}),a.patch&&dt({...p,method:"patch",operation:{...p.operation,...a.patch,parameters:$({source:Ze({context:e,parameters:a.patch.parameters}),target:p.operation.parameters})}}),a.post&&dt({...p,method:"post",operation:{...p.operation,...a.post,parameters:$({source:Ze({context:e,parameters:a.post.parameters}),target:p.operation.parameters})}}),a.put&&dt({...p,method:"put",operation:{...p.operation,...a.put,parameters:$({source:Ze({context:e,parameters:a.put.parameters}),target:p.operation.parameters})}}),a.trace&&dt({...p,method:"trace",operation:{...p.operation,...a.trace,parameters:$({source:Ze({context:e,parameters:a.trace.parameters}),target:p.operation.parameters})}});}};var ap=({logger:e,operations:t,parameters:r,preserveOrder:n,requestBodies:o,responses:i,schemas:a,spec:p})=>{let c=e.timeEvent("filter-spec");if(p.components){if(p.components.parameters){let m={};if(n)for(let[l,f]of Object.entries(p.components.parameters))r.has(w("parameter",l))&&(m[l]=f);else for(let l of r){let{name:f}=te(l),d=p.components.parameters[f];d&&(m[f]=d);}p.components.parameters=m;}if(p.components.requestBodies){let m={};if(n)for(let[l,f]of Object.entries(p.components.requestBodies))o.has(w("body",l))&&(m[l]=f);else for(let l of o){let{name:f}=te(l),d=p.components.requestBodies[f];d&&(m[f]=d);}p.components.requestBodies=m;}if(p.components.responses){let m={};if(n)for(let[l,f]of Object.entries(p.components.responses))i.has(w("response",l))&&(m[l]=f);else for(let l of i){let{name:f}=te(l),d=p.components.responses[f];d&&(m[f]=d);}p.components.responses=m;}if(p.components.schemas){let m={};if(n)for(let[l,f]of Object.entries(p.components.schemas))a.has(w("schema",l))&&(m[l]=f);else for(let l of a){let{name:f}=te(l),d=p.components.schemas[f];d&&(m[f]=d);}p.components.schemas=m;}}if(p.paths)for(let m of Object.entries(p.paths)){let l=m[0],f=m[1];for(let d of re){if(!f[d])continue;let y=w("operation",V({method:d,path:l}));t.has(y)||delete f[d];}Object.keys(f).length||delete p.paths[l];}c.timeEnd();};var pp=({content:e})=>{let{mediaType:t,schema:r}=e;return r?r.type==="string"&&!r.format&&mt({mediaType:t})?{...r,format:"binary"}:r:mt({mediaType:t})?{format:"binary",type:"string"}:void 0},ut=({content:e})=>{let t=[];for(let r in e)t.push({mediaType:r,schema:e[r].schema,type:Or({mediaType:r})});return t};var Ue=({schema:e})=>typeof e.type=="string"?[e.type]:e.type?e.type:e.properties?["object"]:[],zf=({irSchema:e,schema:t})=>{t.deprecated!==void 0&&(e.deprecated=t.deprecated),t.example&&(e.example=t.example),t.description&&(e.description=t.description),t.title&&(e.title=t.title);},Dn=({irSchema:e,schema:t})=>{if(t.const!==void 0&&(e.const=t.const,!t.type))if(t.const===null)e.type="null";else switch(typeof t.const){case "bigint":case "number":e.type="number";break;case "boolean":e.type="boolean";break;case "string":e.type="string";break}t.default!==void 0&&(e.default=t.default),t.exclusiveMaximum!==void 0&&(e.exclusiveMaximum=t.exclusiveMaximum),t.exclusiveMinimum!==void 0&&(e.exclusiveMinimum=t.exclusiveMinimum),t.format&&(e.format=t.format),t.maximum!==void 0&&(e.maximum=t.maximum),t.maxItems!==void 0&&(e.maxItems=t.maxItems),t.maxLength!==void 0&&(e.maxLength=t.maxLength),t.minimum!==void 0&&(e.minimum=t.minimum),t.minItems!==void 0&&(e.minItems=t.minItems),t.minLength!==void 0&&(e.minLength=t.minLength),t.pattern&&(e.pattern=t.pattern),t.readOnly?e.accessScope="read":t.writeOnly&&(e.accessScope="write");},_f=({context:e,irSchema:t={},schema:r,state:n})=>{r.prefixItems&&r.prefixItems.length||r.maxItems&&r.maxItems===r.minItems||r.const!==void 0?t.type="tuple":t.type="array";let o=[];for(let i of r.prefixItems??[]){let a=J({context:e,schema:i,state:n});o.push(a);}if(r.items){let i=J({context:e,schema:r.items,state:n});if(!o.length&&r.maxItems&&r.maxItems===r.minItems)o=Array(r.maxItems).fill(i);else {let a=r.items.allOf||r.items.anyOf||r.items.oneOf;a&&a.length>1&&!Ue({schema:r.items}).includes("null")?t={...t,...i}:o.push(i);}}return t=W({items:o,schema:t}),t},Hf=({irSchema:e={}})=>(e.type="boolean",e),Qf=({irSchema:e={}})=>(e.type="null",e),Zf=({irSchema:e={},schema:t})=>(e.type=t.type,e),Uf=({context:e,irSchema:t={},schema:r,state:n})=>{t.type="object";let o={};for(let i in r.properties){let a=r.properties[i];if(typeof a!="boolean"){let p=J({context:e,schema:a,state:n});o[i]=p;}}if(Object.keys(o).length&&(t.properties=o),r.additionalProperties===void 0)t.properties||(t.additionalProperties={type:"unknown"});else if(typeof r.additionalProperties=="boolean")n.inAllOf&&r.additionalProperties===false&&(!r.properties||!Object.keys(r.properties).length)&&(!r.patternProperties||!Object.keys(r.patternProperties).length)||(t.additionalProperties={type:r.additionalProperties?"unknown":"never"});else {let i=J({context:e,schema:r.additionalProperties,state:n});t.additionalProperties=i;}if(r.patternProperties){let i={};for(let a in r.patternProperties){let p=r.patternProperties[a],c=J({context:e,schema:p,state:n});i[a]=c;}Object.keys(i).length&&(t.patternProperties=i);}return r.propertyNames&&(t.propertyNames=J({context:e,schema:r.propertyNames,state:n})),r.required&&(t.required=r.required),t},Xf=({irSchema:e={}})=>(e.type="string",e),yt=({schema:e})=>{let t={};return zf({irSchema:t,schema:e}),t},Jf=({context:e,schema:t,state:r})=>{let n=yt({schema:t}),o=[],i=Ue({schema:t}),a=t.allOf;for(let p of a){let c=r.inAllOf;"$ref"in p||(r.inAllOf=true);let m=J({context:e,schema:p,state:r});if(r.inAllOf=c,r.inAllOf===void 0&&delete r.inAllOf,t.required&&(m.required?m.required=[...m.required,...t.required]:m.required=t.required),o.push(m),p.$ref){let l=e.resolveRef(p.$ref);if(l.discriminator&&r.$ref){let f=He(r.$ref,l.discriminator.mapping,l.oneOf?()=>l.oneOf.some(d=>"$ref"in d&&d.$ref===r.$ref):void 0);if(f.length>0){let d=f.map(y=>({const:y,type:"string"})),u={properties:{[l.discriminator.propertyName]:d.length>1?{items:d,logicalOperator:"or"}:d[0]},type:"object"};l.required?.includes(l.discriminator.propertyName)&&(u.required=[l.discriminator.propertyName]),o.push(u);}}}}if(i.includes("object")){let p=Ut({context:e,schema:{...t,type:"object"},state:r});if(p.properties){for(let c of p.required??[])if(!p.properties[c])for(let m of a){let l=m.$ref?e.resolveRef(m.$ref):m;if(Ue({schema:l}).includes("object")){let f=Ut({context:e,schema:{...l,type:"object"},state:r});if(f.properties?.[c]){p.properties[c]=f.properties[c];break}}}o.push(p);}}if(n=W({items:o,logicalOperator:"and",mutateSchemaOneItem:true,schema:n}),i.includes("null")){let p=[{type:"null"}];o.length&&p.unshift(n),n={items:p,logicalOperator:"or"};}return n},Gf=({context:e,schema:t,state:r})=>{let n=yt({schema:t}),o=[],i=Ue({schema:t}),a=t.anyOf;for(let p of a){let c=J({context:e,schema:p,state:r});if(t.discriminator&&c.$ref!=null){let l=He(c.$ref,t.discriminator.mapping).map(d=>({const:d,type:"string"}));c={items:[{properties:{[t.discriminator.propertyName]:l.length>1?{items:l,logicalOperator:"or"}:l[0]},type:"object"},c],logicalOperator:"and"};}o.push(c);}if(i.includes("null")&&o.push({type:"null"}),n=W({items:o,mutateSchemaOneItem:true,schema:n}),i.includes("object")){let p=Ut({context:e,schema:{...t,type:"object"},state:r});p.properties&&(n={items:[n,p],logicalOperator:"and"});}return n},Yf=({context:e,schema:t,state:r})=>{let n=yt({schema:t});n.type="enum";let o=[],i=Ue({schema:t});for(let[a,p]of t.enum.entries()){let c=typeof p,m;if(c==="string"||c==="number"||c==="boolean"?m=c:c==="object"&&Array.isArray(p)?m="array":p===null?i.includes("null")&&(m="null"):console.warn("\u{1F6A8}",`unhandled "${c}" typeof value "${p}" for enum`,t.enum),!m)continue;let l=Ut({context:e,schema:{const:p,description:t["x-enum-descriptions"]?.[a],title:t["x-enum-varnames"]?.[a]??t["x-enumNames"]?.[a],type:m},state:r});o.push(l);}return n=W({items:o,schema:n}),n},ed=({context:e,schema:t,state:r})=>{let n=yt({schema:t}),o=[],i=Ue({schema:t}),a=t.oneOf;for(let p of a){let c=J({context:e,schema:p,state:r});if(t.discriminator&&c.$ref!=null){let l=He(c.$ref,t.discriminator.mapping).map(d=>({const:d,type:"string"}));c={items:[{properties:{[t.discriminator.propertyName]:l.length>1?{items:l,logicalOperator:"or"}:l[0]},required:[t.discriminator.propertyName],type:"object"},c],logicalOperator:"and"};}c.logicalOperator==="or"&&c.type!=="array"&&c.items?o=o.concat(c.items):o.push(c);}if(i.includes("null")&&o.push({type:"null"}),n=W({items:o,mutateSchemaOneItem:true,schema:n}),i.includes("object")){let p=Ut({context:e,schema:{...t,type:"object"},state:r});p.properties&&(n={items:[n,p],logicalOperator:"and"});}return n},td=({context:e,schema:t,state:r})=>{if(!t.$ref.startsWith("#/components/")&&!r.circularReferenceTracker.has(t.$ref)){r.refStack.push(t.$ref);let p=e.resolveRef(t.$ref),c=r.$ref;r.$ref=t.$ref;let m=J({context:e,schema:p,state:r});return r.$ref=c,r.refStack.pop(),m}let o=yt({schema:t}),i={};if(i.$ref=decodeURI(t.$ref),r.refStack.includes(t.$ref)&&(r.refStack[0]===t.$ref&&(r.circularRef=t.$ref),o.circular=true),!r.circularReferenceTracker.has(t.$ref)){r.refStack.push(t.$ref);let p=e.resolveRef(t.$ref),c=r.$ref;r.$ref=t.$ref,J({context:e,schema:p,state:r}),r.circularRef&&r.refStack[0]===r.circularRef&&(o.circular=true),r.$ref=c,r.refStack.pop();}let a=[];return a.push(i),t.type&&typeof t.type!="string"&&t.type.includes("null")&&a.push({type:"null"}),o=W({items:a,mutateSchemaOneItem:true,schema:o}),o},Ut=({context:e,irSchema:t,schema:r,state:n})=>{switch(t||(t=yt({schema:r}),Dn({irSchema:t,schema:r})),r.type){case "array":return _f({context:e,irSchema:t,schema:r,state:n});case "boolean":return Hf({irSchema:t});case "integer":case "number":return Zf({irSchema:t,schema:r});case "null":return Qf({irSchema:t});case "object":return Uf({context:e,irSchema:t,schema:r,state:n});case "string":return Xf({irSchema:t});default:return cp({irSchema:t,schema:r})}},rd=({context:e,irSchema:t,schema:r,state:n})=>{t||(t=yt({schema:r}));let o={};Dn({irSchema:o,schema:r}),r.type.includes("null")&&o.default===null&&delete o.default;let i=[];for(let a of r.type)if(a==="null")i.push({type:"null"});else {let p=Ut({context:e,irSchema:{...o},schema:{...r,type:a},state:n});i.push(p);}return t=W({items:i,schema:t}),t},nd=({context:e,schema:t,state:r})=>{let n=yt({schema:t});Dn({irSchema:n,schema:t});let o=Ue({schema:t});return o.length===1?Ut({context:e,irSchema:n,schema:{...t,type:o[0]},state:r}):rd({context:e,irSchema:n,schema:{...t,type:o},state:r})},cp=({irSchema:e,schema:t})=>(e||(e=yt({schema:t})),e.type="unknown",Dn({irSchema:e,schema:t}),e),J=({context:e,schema:t,state:r})=>(r||(r={circularReferenceTracker:new Set,refStack:[]}),r.$ref&&r.circularReferenceTracker.add(r.$ref),t.$ref?td({context:e,schema:t,state:r}):t.enum?Yf({context:e,schema:t,state:r}):t.allOf?Jf({context:e,schema:t,state:r}):t.anyOf?Gf({context:e,schema:t,state:r}):t.oneOf?ed({context:e,schema:t,state:r}):t.type||t.properties?nd({context:e,schema:t,state:r}):cp({schema:t})),mp=({$ref:e,context:t,schema:r})=>{t.ir.components||(t.ir.components={}),t.ir.components.schemas||(t.ir.components.schemas={}),t.ir.components.schemas[F(e)]=J({context:t,schema:r,state:{$ref:e,circularReferenceTracker:new Set,refStack:[e]}});};var lp=e=>e.includes("boolean")||e.includes("integer")||e.includes("number")||e.includes("string"),Xt=({context:e,name:t,schema:r})=>{if(Oe(e.config.parser.pagination).test(t))return true;if(r.$ref){let o=e.resolveRef(r.$ref);if("content"in o||"in"in o){let i;if("in"in o&&(i=o.schema),!i){let a=ut({content:o.content}),p=a.find(c=>c.type==="json")||a[0];p?.schema&&(i=p.schema);}return i?Xt({context:e,name:t,schema:i}):false}return Xt({context:e,name:t,schema:o})}for(let o in r.properties)if(Oe(e.config.parser.pagination).test(o)){let a=r.properties[o];if(typeof a!="boolean"){let p=Ue({schema:a});if(!p.length){let m=(a.anyOf??a.oneOf??[]).filter(l=>l.type!=="null");if(m.length===1){let l=Ue({schema:m[0]});if(lp(l))return o}}if(lp(p))return o}}for(let o of r.allOf??[]){let i=Xt({context:e,name:t,schema:o});if(i)return i}return false};var sd=({irOperation:e,operation:t})=>{t.deprecated!==void 0&&(e.deprecated=t.deprecated),t.description&&(e.description=t.description),t.summary&&(e.summary=t.summary),t.tags?.length&&(e.tags=t.tags);},od=({context:e,method:t,operation:r,path:n,state:o})=>{let i={id:zt({context:e,id:r.operationId,method:t,path:n,state:o}),method:t,path:n};return r.operationId&&(i.operationId=r.operationId),sd({irOperation:i,operation:r}),i},id=({context:e,method:t,operation:r,path:n,securitySchemesMap:o,state:i})=>{let a=od({context:e,method:t,operation:r,path:n,state:i});if(r.parameters&&(a.parameters=r.parameters),r.requestBody){let p="$ref"in r.requestBody?e.resolveRef(r.requestBody.$ref):r.requestBody,c=ut({content:p.content}),m=c.find(l=>l.type==="json")||c[0];if(m){let l=Xt({context:e,name:"",schema:{description:p.description,...m.schema}});a.body={mediaType:m.mediaType,schema:J({context:e,schema:{description:p.description,..."$ref"in r.requestBody?r.requestBody:m.schema},state:void 0})},l&&(a.body.pagination=l),p.required&&(a.body.required=p.required),m.type&&(a.body.type=m.type);}}for(let p in r.responses){a.responses||(a.responses={});let c=r.responses[p],m="$ref"in c?e.resolveRef(c.$ref):c,l=ut({content:m.content}),f=l.find(d=>d.type==="json")||l[0];f?a.responses[p]={mediaType:f.mediaType,schema:J({context:e,schema:{description:m.description,...pp({content:f})},state:void 0})}:a.responses[p]={schema:{description:m.description,type:p==="204"?"void":"unknown"}};}if(r.security){let p=new Map;for(let c of r.security)for(let m in c){let l=o.get(m);l&&p.set(m,l);}p.size&&(a.security=Array.from(p.values()));}return a},fp=({context:e,method:t,operation:r,path:n,securitySchemesMap:o,state:i})=>(r.servers&&(e.ir.servers=[...e.ir.servers??[],...r.servers]),{parsed:id({context:e,method:t,operation:r,path:n,securitySchemesMap:o,state:i})}),ht=({context:e,method:t,path:r,...n})=>{e.ir.paths||(e.ir.paths={}),e.ir.paths[r]||(e.ir.paths[r]={});let{parsed:o}=fp({context:e,method:t,path:r,...n});e.ir.paths[r][t]=o;},gt=({context:e,key:t,method:r,...n})=>{e.ir.webhooks||(e.ir.webhooks={}),e.ir.webhooks[t]||(e.ir.webhooks[t]={});let{parsed:o}=fp({context:e,method:r,path:t,...n});e.ir.webhooks[t][r]=o;};var ad=e=>{switch(e){case "query":return false;default:return}},pd=e=>{switch(e){case "deepObject":case "form":return true;default:return false}},cd=e=>{switch(e){case "header":case "path":return "simple";case "cookie":case "query":return "form"}},U=({context:e,parameters:t})=>{if(!t||!Object.keys(t).length)return;let r={};for(let n of t){let o="$ref"in n?e.dereference(n):n;r[o.in]||(r[o.in]={}),r[o.in][o.name.toLocaleLowerCase()]=dp({$ref:`#/todo/real/path/to/parameter/${o.name}`,context:e,parameter:o});}return r},dp=({$ref:e,context:t,parameter:r})=>{let n=r.schema;if(!n){let l=ut({content:r.content}),f=l.find(d=>d.type==="json")||l[0];f&&(n=f.schema);}let o={deprecated:r.deprecated,description:r.description,...n},i=Xt({context:t,name:r.name,schema:o}),a=r.style||cd(r.in),p=r.explode!==void 0?r.explode:pd(a),m={allowReserved:r.allowReserved!==void 0?r.allowReserved:ad(r.in),explode:p,location:r.in,name:r.name,schema:J({context:t,schema:o,state:{$ref:e,circularReferenceTracker:new Set,refStack:[e]}}),style:a};return r.deprecated&&(m.deprecated=r.deprecated),r.description&&(m.description=r.description),i&&(m.pagination=i),r.required&&(m.required=r.required),m},up=({$ref:e,context:t,parameter:r})=>{t.ir.components||(t.ir.components={}),t.ir.components.parameters||(t.ir.components.parameters={}),t.ir.components.parameters[F(e)]=dp({$ref:e,context:t,parameter:r});};var md=({$ref:e,context:t,requestBody:r})=>{let n=ut({content:r.content}),o=n.find(c=>c.type==="json")||n[0],i=o?o.schema:void 0,a={description:r.description,...i},p={schema:J({context:t,schema:a,state:{$ref:e,circularReferenceTracker:new Set,refStack:[e]}})};return r.description&&(p.description=r.description),r.required&&(p.required=r.required),p},yp=({$ref:e,context:t,requestBody:r})=>{t.ir.components||(t.ir.components={}),t.ir.components.requestBodies||(t.ir.components.requestBodies={}),t.ir.components.requestBodies[F(e)]=md({$ref:e,context:t,requestBody:r});};var hp=({context:e})=>{if(e.spec.servers){e.ir.servers=e.spec.servers;return}for(let t of e.config.input)if(typeof t.path=="string"){let r=Qe(t.path);e.ir.servers=[{url:`${r.protocol?`${r.protocol}://`:""}${r.host}${r.port?`:${r.port}`:""}`}];}e.ir.servers||(e.ir.servers=[{url:"/"}]);};var gp=(e,t)=>{let r=t.timeEvent("validate"),n=[],o=new Map;if(e.paths)for(let i of Object.entries(e.paths)){let a=i[0],p=i[1];for(let c of re){let m=p[c];if(!m)continue;let l=V({method:c,path:a});m.operationId&&(o.has(m.operationId)?n.push({code:"duplicate_key",context:{key:"operationId",value:m.operationId},message:"Duplicate `operationId` found. Each `operationId` must be unique.",path:["paths",a,c,"operationId"],severity:"error"}):o.set(m.operationId,l));}}if(e.servers){(typeof e.servers!="object"||!Array.isArray(e.servers))&&n.push({code:"invalid_type",message:"`servers` must be an array.",path:[],severity:"error"});for(let i=0;i<e.servers.length;i++){let a=e.servers[i];!a||typeof a!="object"?n.push({code:"invalid_type",context:{actual:typeof a,expected:"object"},message:"Each entry in `servers` must be an object.",path:["servers",i],severity:"error"}):a.url||n.push({code:"missing_required_field",context:{field:"url"},message:"Missing required field `url` in server object.",path:["servers",i],severity:"error"});}}return r.timeEnd(),{issues:n,valid:!n.some(i=>i.severity==="error")}};var xp=({context:e,securitySchemesMap:t})=>{let r={ids:new Map};for(let n in e.spec.webhooks){let o=e.spec.webhooks[n],i="$ref"in o?{...e.resolveRef(o.$ref),...o}:o,a={context:e,key:n,operation:{description:i.description,parameters:U({context:e,parameters:i.parameters}),security:e.spec.security,servers:i.servers,summary:i.summary},securitySchemesMap:t,state:r};i.delete&>({...a,method:"delete",operation:{...a.operation,...i.delete,parameters:$({source:U({context:e,parameters:i.delete.parameters}),target:a.operation.parameters})}}),i.get&>({...a,method:"get",operation:{...a.operation,...i.get,parameters:$({source:U({context:e,parameters:i.get.parameters}),target:a.operation.parameters})}}),i.head&>({...a,method:"head",operation:{...a.operation,...i.head,parameters:$({source:U({context:e,parameters:i.head.parameters}),target:a.operation.parameters})}}),i.options&>({...a,method:"options",operation:{...a.operation,...i.options,parameters:$({source:U({context:e,parameters:i.options.parameters}),target:a.operation.parameters})}}),i.patch&>({...a,method:"patch",operation:{...a.operation,...i.patch,parameters:$({source:U({context:e,parameters:i.patch.parameters}),target:a.operation.parameters})}}),i.post&>({...a,method:"post",operation:{...a.operation,...i.post,parameters:$({source:U({context:e,parameters:i.post.parameters}),target:a.operation.parameters})}}),i.put&>({...a,method:"put",operation:{...a.operation,...i.put,parameters:$({source:U({context:e,parameters:i.put.parameters}),target:a.operation.parameters})}}),i.trace&>({...a,method:"trace",operation:{...a.operation,...i.trace,parameters:$({source:U({context:e,parameters:i.trace.parameters}),target:a.operation.parameters})}});}};var zo=e=>{if(e.config.parser.validate_EXPERIMENTAL){let o=gp(e.spec,e.logger);Sr({context:e,result:o});}if(yr(e.config.parser.filters)){let o=ur(e.config.parser.filters,e.spec,e.logger),{graph:i}=Et(e.spec,e.logger),{resourceMetadata:a}=gr(i,e.logger),p=hr({filters:o,logger:e.logger,resourceMetadata:a});ap({...p,logger:e.logger,preserveOrder:o.preserveOrder,spec:e.spec});}br({context:e});let r={ids:new Map},n=new Map;if(e.spec.components){for(let o in e.spec.components.securitySchemes){let i=e.spec.components.securitySchemes[o],a="$ref"in i?e.resolveRef(i.$ref):i;n.set(o,a);}for(let o in e.spec.components.parameters){let i=`#/components/parameters/${o}`,a=e.spec.components.parameters[o],p="$ref"in a?e.resolveRef(a.$ref):a;up({$ref:i,context:e,parameter:p});}for(let o in e.spec.components.requestBodies){let i=`#/components/requestBodies/${o}`,a=e.spec.components.requestBodies[o],p="$ref"in a?e.resolveRef(a.$ref):a;yp({$ref:i,context:e,requestBody:p});}for(let o in e.spec.components.schemas){let i=`#/components/schemas/${o}`,a=e.spec.components.schemas[o];mp({$ref:i,context:e,schema:a});}}hp({context:e});for(let o in e.spec.paths){let i=e.spec.paths[o],a=i.$ref?{...e.resolveRef(i.$ref),...i}:i,p={context:e,operation:{description:a.description,parameters:U({context:e,parameters:a.parameters}),security:e.spec.security,servers:a.servers,summary:a.summary},path:o,securitySchemesMap:n,state:r};a.delete&&ht({...p,method:"delete",operation:{...p.operation,...a.delete,parameters:$({source:U({context:e,parameters:a.delete.parameters}),target:p.operation.parameters})}}),a.get&&ht({...p,method:"get",operation:{...p.operation,...a.get,parameters:$({source:U({context:e,parameters:a.get.parameters}),target:p.operation.parameters})}}),a.head&&ht({...p,method:"head",operation:{...p.operation,...a.head,parameters:$({source:U({context:e,parameters:a.head.parameters}),target:p.operation.parameters})}}),a.options&&ht({...p,method:"options",operation:{...p.operation,...a.options,parameters:$({source:U({context:e,parameters:a.options.parameters}),target:p.operation.parameters})}}),a.patch&&ht({...p,method:"patch",operation:{...p.operation,...a.patch,parameters:$({source:U({context:e,parameters:a.patch.parameters}),target:p.operation.parameters})}}),a.post&&ht({...p,method:"post",operation:{...p.operation,...a.post,parameters:$({source:U({context:e,parameters:a.post.parameters}),target:p.operation.parameters})}}),a.put&&ht({...p,method:"put",operation:{...p.operation,...a.put,parameters:$({source:U({context:e,parameters:a.put.parameters}),target:p.operation.parameters})}}),a.trace&&ht({...p,method:"trace",operation:{...p.operation,...a.trace,parameters:$({source:U({context:e,parameters:a.trace.parameters}),target:p.operation.parameters})}});}xp({context:e,securitySchemesMap:n});};var Fn=["connect","delete","get","head","options","patch","post","put","trace"];function Bn(e="1.0"){return String(e).replace(/^v/gi,"")}var Rr="#/components/parameters/",Kn="#/components/schemas/";var Ar=({config:e,name:t})=>{let r=e.plugins["@hey-api/sdk"];if(r?.config.classNameBuilder){let n="";return typeof r.config.classNameBuilder=="function"?n=r.config.classNameBuilder(t):n=r.config.classNameBuilder.replace("{{name}}",t),n}return t},_o=e=>A().plugins["@hey-api/typescript"]?.config.style==="PascalCase"?q({case:"PascalCase",value:e}):e,bp=e=>{let t=_o(e);return we(t).replace(le,"_$1")};var Sp=(e,t)=>{if(e.enum&&!t.includes("boolean"))return "enum"},Ho=e=>Pr(e).includes("null"),Ct=e=>e.nullable===true||Ho(e),Pr=({type:e})=>Array.isArray(e)?e:e?[e]:[];var Yr=e=>e.trim().replace(/^#\/definitions\//,"").replace(/^#\/parameters\//,"").replace(/^#\/responses\//,"").replace(/^#\/securityDefinitions\//,"").replace(/^#\/components\/schemas\//,"").replace(/^#\/components\/responses\//,"").replace(/^#\/components\/parameters\//,"").replace(/^#\/components\/examples\//,"").replace(/^#\/components\/requestBodies\//,"").replace(/^#\/components\/headers\//,"").replace(/^#\/components\/securitySchemes\//,"").replace(/^#\/components\/links\//,"").replace(/^#\/components\/callbacks\//,"");var Op=(e,t)=>{if(t==="binary")return "binary";switch(e){case "any":case "object":case "unknown":return "unknown";case "array":return "unknown[]";case "boolean":return "boolean";case "byte":case "double":case "float":case "int":case "integer":case "long":case "number":case "short":return "number";case "char":case "date":case "date-time":case "password":case "string":return "string";case "file":return "binary";case "null":return "null";case "void":return "void";default:return}},Tp=/(?<!`1)\[.*\]$/g,N=({debug:e,format:t,type:r="unknown"})=>{let n={$refs:[],base:"unknown",imports:[],isNullable:false,template:null,type:"unknown"};if(Array.isArray(r)){let a=r.filter(p=>p!=="null").map(p=>Op(p,t)).filter(Boolean).join(" | ");return n.type=a,n.base=a,n.isNullable=Ho({type:r}),n}let o=Op(r,t);if(o)return n.type=o,n.base=o,n;let i=decodeURIComponent(Yr(r));if(Tp.lastIndex=0,Tp.test(i)){let a=i.match(/(.*?)\[(.*)\]$/);if(a?.length){let p=N({debug:e,type:we(a[1])}),c=N({debug:e,type:we(a[2])});return p.type==="unknown[]"?(n.type=`${c.type}[]`,n.base=`${c.type}`,p.$refs=[],p.imports=[]):c.type?(n.type=`${p.type}<${c.type}>`,n.base=p.type,n.template=c.type):(n.type=p.type,n.base=p.type,n.template=p.type),n.$refs=[...n.$refs,...p.$refs,...c.$refs],n.imports=[...n.imports,...p.imports,...c.imports],n}}if(i){let a=_o(we(i));return r.startsWith(Rr)&&(a=`Parameter${a}`),n.type=a,n.base=a,r.startsWith("#")&&(n.$refs=[...n.$refs,decodeURIComponent(r)]),n.imports=[...n.imports,a],n}return n};function Xe(e,t,r){return r.indexOf(e)===t}var Er=(e,t)=>{if(!Array.isArray(t))return [];let r=(e["x-enum-descriptions"]??[]).filter(o=>typeof o=="string"),n=(e["x-enum-varnames"]??e["x-enumNames"]??[]).filter(o=>typeof o=="string");return t.filter(Xe).filter(o=>typeof o=="number"||typeof o=="string").map((o,i)=>({customDescription:r[i],customName:n[i],description:void 0,value:o}))};var G=e=>e?.replace(/\\/g,"\\\\").replace(/'/g,"\\'");var Wn=({definition:e,getModel:t,openApi:r,types:n})=>{let o=[];return Object.entries(e.properties??{}).forEach(([i,a])=>{let p=!!e.required?.includes(i);if(a.$ref){let c=N({type:a.$ref});o.push({$refs:[],base:c.base,description:a.description||null,enum:[],enums:[],exclusiveMaximum:a.exclusiveMaximum,exclusiveMinimum:a.exclusiveMinimum,export:"reference",format:a.format,imports:c.imports,in:"",isDefinition:false,isNullable:a["x-nullable"]===true,isReadOnly:a.readOnly===true,isRequired:p,link:null,maxItems:a.maxItems,maxLength:a.maxLength,maxProperties:a.maxProperties,maximum:a.maximum,minItems:a.minItems,minLength:a.minLength,minProperties:a.minProperties,minimum:a.minimum,multipleOf:a.multipleOf,name:Te(i),pattern:G(a.pattern),properties:[],template:c.template,type:c.type,uniqueItems:a.uniqueItems});}else {let c=t({definition:a,openApi:r,types:n});o.push({$refs:[],base:c.base,description:a.description||null,enum:c.enum,enums:c.enums,exclusiveMaximum:a.exclusiveMaximum,exclusiveMinimum:a.exclusiveMinimum,export:c.export,format:a.format,imports:c.imports,in:"",isDefinition:false,isNullable:a["x-nullable"]===true,isReadOnly:a.readOnly===true,isRequired:p,link:c.link,maxItems:a.maxItems,maxLength:a.maxLength,maxProperties:a.maxProperties,maximum:a.maximum,minItems:a.minItems,minLength:a.minLength,minProperties:a.minProperties,minimum:a.minimum,multipleOf:a.multipleOf,name:Te(i),pattern:G(a.pattern),properties:c.properties,template:c.template,type:c.type,uniqueItems:a.uniqueItems});}}),o};var ld=/~1/g,fd=/~0/g;function _(e,t){if(t.$ref){let r=t.$ref.replace(/^#/g,"").split("/").filter(Boolean),n=e;return r.forEach(o=>{let i=decodeURIComponent(o.replace(ld,"/").replace(fd,"~"));if(n.hasOwnProperty(i))n=n[i];else throw new Error(`Could not find reference: "${t.$ref}"`)}),n}return t}var Rp=({definitions:e,getModel:t,openApi:r,required:n,types:o})=>e.reduce((i,a)=>{if(a.$ref){let p=_(r,a);return [...i,...t({definition:p,openApi:r,types:o}).properties]}return [...i,...t({definition:a,openApi:r,types:o}).properties]},[]).filter(i=>!i.isRequired&&n.includes(i.name)).map(i=>({...i,isRequired:true}));var Ap=({definition:e,definitions:t,getModel:r,openApi:n,type:o,types:i})=>{let a={$refs:[],enums:[],export:o,imports:[],properties:[]},p=[];if(t.map(c=>r({definition:c,openApi:n,types:i})).filter(c=>{let m=c.properties.length,l=c.enums.length;return !(c.type==="unknown"&&!m&&!l)}).forEach(c=>{a.imports.push(...c.imports),a.enums.push(...c.enums),a.properties.push(c);}),e.required&&o==="all-of"){let c=Rp({definitions:t,getModel:r,openApi:n,required:e.required,types:i});c.forEach(m=>{a.imports.push(...m.imports),a.enums.push(...m.enums);}),p.push(...c);}if(e.properties){let c=Wn({definition:e,getModel:r,openApi:n,types:i});c.forEach(m=>{a.imports.push(...m.imports),a.enums.push(...m.enums),m.export==="enum"&&a.enums.push(m);}),p.push(...c);}return p.length&&a.properties.push({$refs:[],base:"unknown",description:"",enum:[],enums:[],export:"interface",imports:[],in:"",isDefinition:false,isNullable:false,isReadOnly:false,isRequired:false,link:null,name:"properties",properties:p,template:null,type:"unknown"}),a};var Je=({definition:e,isDefinition:t=false,meta:r,openApi:n,types:o})=>{let i={$refs:[],base:"unknown",description:e.description||null,enum:[],enums:[],exclusiveMaximum:e.exclusiveMaximum,exclusiveMinimum:e.exclusiveMinimum,export:"interface",format:e.format,imports:[],in:"",isDefinition:t,isNullable:e["x-nullable"]===true,isReadOnly:e.readOnly===true,isRequired:false,link:null,maxItems:e.maxItems,maxLength:e.maxLength,maxProperties:e.maxProperties,maximum:e.maximum,meta:r,minItems:e.minItems,minLength:e.minLength,minProperties:e.minProperties,minimum:e.minimum,multipleOf:e.multipleOf,name:r?.name??"",pattern:G(e.pattern),properties:[],template:null,type:"unknown",uniqueItems:e.uniqueItems};if(e.$ref){let a=N({type:e.$ref});return i.export="reference",i.type=a.type,i.base=a.base,i.template=a.template,i.imports.push(...a.imports),i}if(e.enum&&e.type!=="boolean"){let a=Er(e,e.enum);if(a.length)return i.base="string",i.enum=[...i.enum,...a],i.export="enum",i.type="string",i}if(e.type==="array"&&e.items)if(e.items.$ref){let a=N({type:e.items.$ref});return i.export="array",i.type=a.type,i.base=a.base,i.template=a.template,i.imports.push(...a.imports),i}else {let a=Je({definition:e.items,openApi:n,types:o});return i.export="array",i.type=a.type,i.base=a.base,i.template=a.template,i.link=a,i.imports.push(...a.imports),i}if(e.type==="object"&&typeof e.additionalProperties=="object")if(e.additionalProperties.$ref){let a=N({type:e.additionalProperties.$ref});return i.export="dictionary",i.type=a.type,i.base=a.base,i.template=a.template,i.imports.push(...a.imports),i}else {let a=Je({definition:e.additionalProperties,openApi:n,types:o});return i.export="dictionary",i.type=a.type,i.base=a.base,i.template=a.template,i.link=a,i.imports.push(...a.imports),i}if(e.allOf?.length){let a=Ap({definition:e,definitions:e.allOf,getModel:Je,openApi:n,type:"all-of",types:o});return i.export=a.export,i.imports.push(...a.imports),i.properties.push(...a.properties),i.enums=[...i.enums,...a.enums],i}if(e.type==="object")return i.export="interface",i.type="unknown",i.base="unknown",e.properties&&Wn({definition:e,getModel:Je,openApi:n,types:o}).forEach(p=>{i.imports.push(...p.imports),i.enums=[...i.enums,...p.enums],i.properties.push(p),p.export==="enum"&&(i.enums=[...i.enums,p]);}),i;if(e.type){let a=N({format:e.format,type:e.type});return i.export="generic",i.type=a.type,i.base=a.base,i.template=a.template,i.imports.push(...a.imports),i}return i};var Pp=e=>{let t={},r=[];return Object.entries(e.definitions??{}).forEach(([n,o])=>{let a=N({type:n}).base.replace(le,"_$1"),p={$ref:`#/definitions/${n}`,name:a};t[a]=p;let c=Je({definition:o,isDefinition:true,meta:p,openApi:e,types:t});r=[...r,c];}),{models:r,types:t}};function Qo(e,t){let r=e.toLocaleLowerCase(),n=t.toLocaleLowerCase();return r.localeCompare(n,"en")}var en=(e,t)=>Qo(e.name,t.name);function Ep(e){return e.sort(en)}var dd=(e,t)=>{if(t)return t;if(typeof e=="number")return `'_${e}'`;let r="";return typeof e=="string"&&(r=e.replace(/[^$\u200c\u200d\p{ID_Continue}]/gu,"_").replace(/^([^$_\p{ID_Start}])/u,"_$1").replace(/(\p{Lowercase})(\p{Uppercase}+)/gu,"$1_$2")),r=r.trim(),r||(r="empty_string"),r.toUpperCase()},Ip=e=>e.map(t=>zn(t.value,true)).filter(Xe).join(" | "),zn=(e,t=false)=>typeof e=="string"?e.includes("'")&&t?`"${e}"`:`'${e}'`:e,_n=e=>{let t=dd(e.value,e.customName),r=zn(e.value);return {key:t,value:r}},Hn=e=>{let t=e.enum.map(r=>_n(r)).sort((r,n)=>Qo(r.key,n.key)).map(r=>`${r.key}=${r.value}`).join("&");return {$ref:`enum/${e.name}/${t}`,name:we(ar(e.name))}};var kp=e=>{let r=`Parameter${N({type:e}).base.replace(le,"_$1")}`;return {$ref:Rr+e,name:r}},Qn=e=>{let t=bp(e);return {$ref:Kn+e,name:t}};var tn=e=>e.format==="date"||e.format==="date-time",Zo=e=>{let t=A();return e.base==="binary"?s.typeUnionNode({types:["Blob","File"]}):t.plugins["@hey-api/transformers"]?.config.dates&&tn(e)?s.typeNode("Date"):s.typeNode(e.base)},ud=e=>{let t=e.base==="null"?false:e.isNullable,r=Zo(e);if(e.export==="reference"&&e.$refs.length===1&&e.$refs[0].startsWith(Kn)){let o=Qn(e.base);r=s.typeNode(o.name);}return s.typeUnionNode({isNullable:t,types:[r]})},yd=e=>{if(e.link){if(Array.isArray(e.link)){let t=e.link.map(n=>Ie(n));return s.typeTupleNode({isNullable:e.isNullable,types:t})}if(e.export==="array"&&e.maxItems&&e.minItems&&e.maxItems===e.minItems&&e.maxItems<=100){let t=Array(e.maxItems).fill(Ie(e.link));return s.typeTupleNode({isNullable:e.isNullable,types:t})}return s.typeArrayNode([Ie(e.link)],e.isNullable)}return s.typeArrayNode([Zo(e)],e.isNullable)},hd=e=>{let t=e.enum.map(r=>zn(r.value));return s.typeUnionNode({isNullable:e.isNullable,types:t})},gd=e=>{let t=e.link&&!Array.isArray(e.link)?Ie(e.link):Zo(e);return s.typeRecordNode(["string"],[t],e.isNullable,true)},jp=({model:e,style:t})=>{let r=e.properties.map(o=>s.nodeToString({node:Ie(o),unescape:true})).filter(Xe),n=t==="union"?s.typeUnionNode({isNullable:e.isNullable&&!e.properties.find(o=>o.isNullable),types:r}):s.typeIntersectionNode({isNullable:e.isNullable,types:r});return e.meta?n:s.typeParenthesizedNode({type:n})},xd=e=>{if(!e.properties.length)return s.typeNode("unknown");let t=A(),r=Q(t),n=e.properties.map(o=>{let i=o.isRequired?"":"?",a=Ie(o),p=r?/^\dXX$/.test(o.name)?Te(o.name):o.name:Te(ar(Uo(o.name)));return o.name==="[key: string]"&&(p=o.name,i&&(i="",a=s.typeUnionNode({types:[a,"undefined"]}))),{comment:[o.description&&z(o.description),o.deprecated&&"@deprecated"],isReadOnly:o.isReadOnly,isRequired:i==="",name:p,type:a}});return s.typeInterfaceNode({isNullable:e.isNullable,properties:n,useLegacyResolution:true})},Ie=e=>{switch(e.export){case "all-of":return jp({model:e,style:"intersection"});case "any-of":case "one-of":return jp({model:e,style:"union"});case "array":return yd(e);case "dictionary":return gd(e);case "enum":return hd(e);case "interface":return xd(e);case "const":case "generic":case "reference":default:return ud(e)}},ke=({client:e,count:t=1,create:r=false,meta:n,nameTransformer:o})=>{let i={created:false,name:""},a=n.name;o&&(a=o(a)),t>1&&(a=`${a}${t}`);let p=e.types[a];return p?p.$ref===n.$ref?i={created:false,name:a}:i=ke({client:e,count:t+1,create:r,meta:n,nameTransformer:o}):r&&(e.types[a]=n,i={created:true,name:a}),i},Cp=({client:e,name:t})=>{let r={deleted:false,name:""};return e.types[t]&&(delete e.types[t],r={deleted:true,name:t}),r},Uo=e=>{let t=A();return Q(t)?q({case:"camelCase",value:wo(e)}).replace(le,"_$1"):e};var Zn=e=>{let t=e.find(r=>r.in==="header");return t?t.name:null},Ge=e=>e.some(r=>r.isRequired),Un=e=>{if(e==="default")return "default";if(e==="1XX")return "1XX";if(e==="2XX")return "2XX";if(e==="3XX")return "3XX";if(e==="4XX")return "4XX";if(e==="5XX")return "5XX";if(/\d{3}/g.test(e)){let t=Number.parseInt(e,10);if(t>=100&&t<600)return t}return null},Xn=(e,t)=>e.code>t.code?1:e.code<t.code?-1:0,bd=e=>e==="3XX"||e==="4XX"||e==="5XX"||typeof e=="number"&&e>=300,Np=e=>e==="2XX"||typeof e=="number"&&e>=200&&e<300,Sd=(e,t)=>{let r=[],n=m=>{r.includes(m)||(r=[...r,m]);};t.some(({code:m})=>Np(m))||n("success");let i=(e.description??"").toLocaleLowerCase(),a=e.$refs.join("|").toLocaleLowerCase(),p=["error","problem"];return ["success"].some(m=>i.includes(m)||a.includes(m))&&n("success"),p.some(m=>i.includes(m)||a.includes(m))&&n("error"),r.length||n("error"),r},Jn=({config:e,operationKey:t})=>{let r=e.plugins["@hey-api/sdk"]?.config.filter?new RegExp(e.plugins["@hey-api/sdk"]?.config.filter):void 0;return !r||r.test(t)},Gn=({config:e,method:t,operationId:r,path:n})=>{if(e.plugins["@hey-api/sdk"]?.config.operationId&&r)return q({case:"camelCase",value:ct(r)});let o=n;return Q(e)&&(o=o.replace(/[^/]*?{api-version}.*?\//g,"")),o=o.replace(/{(.*?)}/g,"by-$1").replace(/[/:+]/g,"-"),q({case:"camelCase",value:`${t}-${o}`})},Yn=e=>{let t=A();return !Q(t)||e.prop!=="api-version"},es=e=>{let t=A();return Q(t)?Uo(e.prop):e.prop},ts=e=>e.map(t=>{let{code:r}=t;return r==="default"?t.responseTypes=Sd(t,e):Np(r)?t.responseTypes=["success"]:bd(r)&&(t.responseTypes=["error"]),t});var H=(e,t)=>{if(e.default===void 0||e.default===null)return e.default;switch(Pr(e).find(o=>o!=="null")||typeof e.default){case "int":case "integer":case "number":if(t?.export==="enum"&&t.enum?.[e.default]){let{value:o}=t.enum[e.default];return o}return e.default;case "array":case "boolean":case "object":case "string":return e.default;default:return}};var vp=({openApi:e,parameter:t,types:r})=>{let n={$refs:[],base:"unknown",description:t.description||null,enum:[],enums:[],exclusiveMaximum:t.exclusiveMaximum,exclusiveMinimum:t.exclusiveMinimum,export:"interface",format:t.format,imports:[],in:t.in,isDefinition:false,isNullable:t["x-nullable"]===true,isReadOnly:false,isRequired:t.required===true,link:null,maxItems:t.maxItems,maxLength:t.maxLength,maximum:t.maximum,mediaType:null,minItems:t.minItems,minLength:t.minLength,minimum:t.minimum,multipleOf:t.multipleOf,pattern:G(t.pattern),prop:t.name,properties:[],template:null,type:"unknown",uniqueItems:t.uniqueItems},o={...n,name:es(n)};if(t.$ref){let a=N({type:t.$ref});return o={...o,$refs:[...o.$refs,...a.$refs],base:a.base,export:"reference",imports:[...o.imports,...a.imports],template:a.template,type:a.type},o.default=H(t,o),o}if(t.enum){let a=Er(t,t.enum);if(a.length)return o={...o,base:"string",enum:[...o.enum,...a],export:"enum",type:"string"},o.default=H(t,o),o}if(t.type==="array"&&t.items){let a=N({format:t.items.format,type:t.items.type});return o={...o,$refs:[...o.$refs,...a.$refs],base:a.base,export:"array",imports:[...o.imports,...a.imports],template:a.template,type:a.type},o.default=H(t,o),o}if(t.type==="object"&&t.items){let a=N({format:t.items.format,type:t.items.type});return o={...o,$refs:[...o.$refs,...a.$refs],base:a.base,export:"dictionary",imports:[...o.imports,...a.imports],template:a.template,type:a.type},o.default=H(t,o),o}let i=t.schema;if(i){if(i.$ref?.startsWith("#/parameters/")&&(i=_(e,i)),i.$ref){let p=N({type:i.$ref});return o={...o,$refs:[...o.$refs,...p.$refs],base:p.base,export:"reference",imports:[...o.imports,...p.imports],template:p.template,type:p.type},o.default=H(t,o),o}let a=Je({definition:i,openApi:e,types:r});return o={...o,$refs:[...o.$refs,...a.$refs],base:a.base,enum:[...o.enum,...a.enum],enums:[...o.enums,...a.enums],export:a.export,imports:[...o.imports,...a.imports],link:a.link,properties:[...o.properties,...a.properties],template:a.template,type:a.type},o.default=H(t,o),o}if(t.type){let a=N({format:t.format,type:t.type});return o={...o,$refs:[...o.$refs,...a.$refs],base:a.base,export:"generic",imports:[...o.imports,...a.imports],template:a.template,type:a.type},o.default=H(t,o),o}return o};var Od=["body","formData","header","path","query"],rs=({openApi:e,parameters:t,types:r})=>{let n={$refs:[],imports:[],parameters:[],parametersBody:null,parametersCookie:[],parametersForm:[],parametersHeader:[],parametersPath:[],parametersQuery:[]};return t.forEach(o=>{let i=_(e,o),a=vp({openApi:e,parameter:i,types:r}),p=!Yn(a);if(!(!Od.includes(i.in)||p)){switch(i.in){case "body":n.parametersBody=a;break;case "formData":n.parametersForm=[...n.parametersForm,a];break;case "header":n.parametersHeader=[...n.parametersHeader,a];break;case "path":n.parametersPath=[...n.parametersPath,a];break;case "query":n.parametersQuery=[...n.parametersQuery,a];break}n.$refs=[...n.$refs,...a.$refs],n.imports=[...n.imports,...a.imports],n.parameters=[...n.parameters,a];}}),n};function ns(e){return e.sort((t,r)=>{let n=t.isRequired&&t.default===void 0,o=r.isRequired&&r.default===void 0;return n&&!o?-1:o&&!n?1:0})}var wp=({code:e,openApi:t,response:r,types:n})=>{let o={$refs:[],base:e!==204?"unknown":"void",code:e,description:r.description||null,enum:[],enums:[],export:"generic",imports:[],in:"response",isDefinition:false,isNullable:false,isReadOnly:false,isRequired:false,link:null,name:"",properties:[],responseTypes:[],template:null,type:e!==204?"unknown":"void"},i=r.schema;if(i){if(i.$ref?.startsWith("#/responses/")&&(i=_(t,i)),i.$ref){let p=N({type:i.$ref});return o.export="reference",o.type=p.type,o.base=p.base,o.template=p.template,o.imports=[...o.imports,...p.imports],o}let a=Je({definition:i,openApi:t,types:n});return o.export=a.export,o.type=a.type,o.base=a.base,o.template=a.template,o.link=a.link,o.isReadOnly=a.isReadOnly,o.isRequired=a.isRequired,o.isNullable=a.isNullable,o.format=a.format,o.maximum=a.maximum,o.exclusiveMaximum=a.exclusiveMaximum,o.minimum=a.minimum,o.exclusiveMinimum=a.exclusiveMinimum,o.multipleOf=a.multipleOf,o.maxLength=a.maxLength,o.minLength=a.minLength,o.maxItems=a.maxItems,o.minItems=a.minItems,o.uniqueItems=a.uniqueItems,o.maxProperties=a.maxProperties,o.minProperties=a.minProperties,o.pattern=G(a.pattern),o.imports=[...o.imports,...a.imports],o.enum=[...o.enum,...a.enum],o.enums=[...o.enums,...a.enums],o.properties=[...o.properties,...a.properties],o}if(r.headers)for(let a in r.headers)return o.in="header",o.name=a,o.type="string",o.base="string",o;return o};var qp=({openApi:e,responses:t,types:r})=>{let n=[];return Object.entries(t).forEach(([o,i])=>{let a=Un(o);if(!a)return;let p=_(e,i),c=wp({code:a,openApi:e,response:p,types:r});n=[...n,c];}),n=ts(n),n.sort(Xn)};var $p=({method:e,op:t,openApi:r,pathParams:n,types:o,url:i})=>{let a={$refs:[],deprecated:t.deprecated===true,description:t.description||null,id:t.operationId||null,imports:[],method:e.toUpperCase(),parameters:[...n.parameters],parametersBody:n.parametersBody,parametersCookie:[...n.parametersCookie],parametersForm:[...n.parametersForm],parametersHeader:[...n.parametersHeader],parametersPath:[...n.parametersPath],parametersQuery:[...n.parametersQuery],path:i,responseHeader:null,responses:[],summary:t.summary||null,tags:t.tags||null},p={...a,name:Gn({config:A(),method:a.method,operationId:t.operationId,path:a.path})};if(t.parameters){let c=rs({openApi:r,parameters:t.parameters,types:o});p.$refs=[...p.$refs,...c.$refs],p.imports=[...p.imports,...c.imports],p.parameters=[...p.parameters,...c.parameters],p.parametersBody=c.parametersBody,p.parametersCookie=[...p.parametersCookie,...c.parametersCookie],p.parametersForm=[...p.parametersForm,...c.parametersForm],p.parametersHeader=[...p.parametersHeader,...c.parametersHeader],p.parametersPath=[...p.parametersPath,...c.parametersPath],p.parametersQuery=[...p.parametersQuery,...c.parametersQuery];}if(t.responses){p.responses=qp({openApi:r,responses:t.responses,types:o});let c=p.responses.filter(m=>m.responseTypes.includes("success"));p.responseHeader=Zn(c),c.forEach(m=>{p.$refs=[...p.$refs,...m.$refs],p.imports=[...p.imports,...m.imports];});}return p.parameters=ns(p.parameters),p};var Mp=({openApi:e,types:t})=>{let r=new Map,n=[],o=A();for(let i in e.paths){let a=e.paths[i],p=rs({openApi:e,parameters:a.parameters??[],types:t});for(let c in a){let m=c,l=V({method:m,path:i});if(Fn.includes(m)){let f=a[m];if(f.operationId&&(r.has(f.operationId)?o.logs.level!=="silent"&&console.warn(`\u2757\uFE0F Duplicate operationId: ${f.operationId} in ${l}. Please ensure your operation IDs are unique. This behavior is not supported and will likely lead to unexpected results.`):r.set(f.operationId,l)),Jn({config:o,operationKey:l})){let d=$p({method:m,op:f,openApi:e,pathParams:p,types:t,url:i});n.push(d);}}}}return n};var Lp=e=>{let t=e.schemes?.[0]||"http",r=e.host,n=e.basePath||"";return (r?`${t}://${r}${n}`:n).replace(/\/$/g,"")};var Vp=e=>{let t=Bn(e.info.version),r=Lp(e),{models:n,types:o}=Pp(e),i=Mp({openApi:e,types:o});return {models:n,operations:i,server:r,types:o,version:t}};var Td=e=>{let t={};for(let r in e)t[e[r]]=r;return t},Dp=(e,t)=>{if(e.components&&t){for(let r in e.components.schemas)if(e.components.schemas.hasOwnProperty(r)){let n=e.components.schemas[r];if(n.discriminator&&n.oneOf?.length&&n.oneOf.some(o=>o.$ref&&Yr(o.$ref)==t.name))return n.discriminator}}},Fp=(e,t)=>{if(e.mapping){let r=Td(e.mapping),n=Object.keys(r).find(o=>Yr(o)==t.name);if(n&&r[n])return r[n]}return t.name};var Xo=({debug:e,definition:t,getModel:r,model:n,openApi:o,types:i})=>{let a=typeof t.additionalProperties=="object"?t.additionalProperties:{},p=r({debug:e,definition:a,openApi:o,parentDefinition:t,types:i});if(a.$ref){let c=N({type:a.$ref});return n.base=c.base,n.default=H(t,n),n.export="dictionary",n.imports.push(...c.imports),n.template=c.template,n.type=c.type,n}if(t.additionalProperties&&t.properties&&Object.keys(t.properties).length>0){let c=typeof t.additionalProperties=="object"&&t.additionalProperties.type&&!Array.isArray(t.additionalProperties.type)?t.additionalProperties.type:p.base,m=[N({type:c}).base,...n.properties.map(l=>l.base)];return p.base=m.filter(Xe).join(" | "),p.default=H(t,n),p.export="generic",p.isRequired=t.additionalProperties===true,p.name="[key: string]",p}return n.base=p.base,n.default=H(t,n),n.export="dictionary",n.imports.push(...p.imports),n.link=p,n.template=p.template,n.type=p.type,n},ss=({debug:e,definition:t,getModel:r,openApi:n,parent:o,types:i})=>{let a=[],p=Dp(n,o);return Object.entries(t.properties??{}).forEach(([c,m])=>{let l=!!t.required?.includes(c),f={default:m.default,deprecated:m.deprecated===true,description:m.description||null,exclusiveMaximum:m.exclusiveMaximum,exclusiveMinimum:m.exclusiveMinimum,format:m.type==="array"?m.items?.format??m.format:m.format,in:"",isDefinition:false,isReadOnly:m.readOnly===true,isRequired:l,maxItems:m.maxItems,maxLength:m.maxLength,maxProperties:m.maxProperties,maximum:m.maximum,minItems:m.minItems,minLength:m.minLength,minProperties:m.minProperties,minimum:m.minimum,multipleOf:m.multipleOf,name:Te(c),pattern:G(m.pattern),uniqueItems:m.uniqueItems};if(o&&p?.propertyName==c){a=[...a,{...f,$refs:[],base:`'${Fp(p,o)}'`,enum:[],enums:[],export:"reference",imports:[],isNullable:Ct(m),link:null,properties:[],template:null,type:"string"}];return}if(m.$ref){let u=N({type:m.$ref});a=[...a,{...f,$refs:u.$refs,base:u.base,enum:[],enums:[],export:"reference",imports:u.imports,isNullable:u.isNullable||Ct(m),link:null,properties:[],template:u.template,type:u.type}];return}let d=r({debug:e,definition:m,initialValues:f,openApi:n,parentDefinition:t,types:i});d.isNullable=d.isNullable||Ct(m),a=[...a,d];}),a};var Bp=({debug:e,definitions:t,getModel:r,openApi:n,required:o,types:i})=>t.reduce((p,c)=>{if(c.$ref){let m=N({type:c.$ref}),l={$ref:c.$ref,name:m.base};i[m.base]=l;let f=_(n,c);return [...p,...r({debug:e,definition:f,meta:l,openApi:n,types:i}).properties]}return [...p,...r({debug:e,definition:c,openApi:n,parentDefinition:c,types:i}).properties]},[]).filter(p=>!p.isRequired&&o.includes(p.name)).map(p=>({...p,isRequired:true}));var os=e=>[{definitions:e.allOf,type:"all-of"},{definitions:e.anyOf,type:"any-of"},{definitions:e.oneOf,type:"one-of"}].find(r=>r.definitions?.length),Kp=({debug:e,definition:t,definitions:r,getModel:n,model:o,openApi:i,type:a,types:p})=>{let c={$refs:o.$refs,enums:o.enums,export:a,imports:o.imports,properties:o.properties},m=[];if(r.map(l=>n({debug:e,definition:l,openApi:i,parentDefinition:t,types:p})).forEach(l=>{c.$refs=[...c.$refs,...l.$refs],c.imports=[...c.imports,...l.imports],c.enums=[...c.enums,...l.enums],c.properties=[...c.properties,l];}),t.required&&a==="all-of"){let l=Bp({debug:e,definitions:r,getModel:n,openApi:i,required:t.required,types:p});l.forEach(f=>{c.$refs=[...c.$refs,...f.$refs],c.imports=[...c.imports,...f.imports],c.enums=[...c.enums,...f.enums];}),m=[...m,...l];}if(t.properties){let l=ss({definition:t,getModel:n,openApi:i,types:p});l.forEach(f=>{c.$refs=[...c.$refs,...f.$refs],c.imports=[...c.imports,...f.imports],c.enums=[...c.enums,...f.enums],f.export==="enum"&&(c.enums=[...c.enums,f]);}),m=[...m,...l];}if(m.length){let l=os(t);if(l){let f={$refs:[],base:"unknown",description:"",enum:[],enums:[],export:"interface",imports:[],in:"",isDefinition:false,isNullable:false,isReadOnly:false,isRequired:false,link:null,name:"properties",properties:m,template:null,type:"unknown"};l.type==="one-of"?(c.properties=[{...c,base:"",description:null,enum:[],in:"",isDefinition:false,isNullable:false,isReadOnly:false,isRequired:true,link:null,name:"",template:null,type:""},f],c.export="all-of"):c.properties=[...c.properties,f];}}return c};var ae=({debug:e,definition:t,initialValues:r={},isDefinition:n=false,meta:o,openApi:i,parentDefinition:a=null,types:p})=>{let c=Pr(t),m=Sp(t,c),l={$refs:[],base:"unknown",deprecated:!!t.deprecated,description:t.description||null,enum:[],enums:[],exclusiveMaximum:t.exclusiveMaximum,exclusiveMinimum:t.exclusiveMinimum,export:"interface",format:t.format,imports:[],in:"",isDefinition:n,isNullable:Ct(t),isReadOnly:t.readOnly===true,isRequired:false,link:null,maxItems:t.maxItems,maxLength:t.maxLength,maxProperties:t.maxProperties,maximum:t.maximum,meta:o,minItems:t.minItems,minLength:t.minLength,minProperties:t.minProperties,minimum:t.minimum,multipleOf:t.multipleOf,name:o?.name??"",pattern:G(t.pattern),properties:[],template:null,type:"unknown",uniqueItems:t.uniqueItems,...r};if(t.$ref){let d=N({debug:e,type:t.$ref});return l.$refs=[...l.$refs,decodeURIComponent(t.$ref)],l.base=d.base,l.export="reference",l.imports=[...l.imports,...d.imports],l.template=d.template,l.type=d.type,l.default=H(t,l),l}if(m==="enum"){let d=Er(t,t.enum);if(d.length)return l.base="string",l.enum=[...l.enum,...d],l.export="enum",l.type="string",l.default=H(t,l),l.meta||(l.meta=Hn(l)),l}if(c.includes("array")&&(t.items||t.prefixItems)){if(t.prefixItems){let y=t.prefixItems.map(g=>ae({definition:g,openApi:i,parentDefinition:t,types:p}));return l.export="array",l.$refs=[...l.$refs,...y.reduce((g,x)=>[...g,...x.$refs],[])],l.imports=[...l.imports,...y.reduce((g,x)=>[...g,...x.imports],[])],l.link=y,l.default=H(t,l),l}if(!t.items)return l;if(t.items.$ref){let y=N({type:t.items.$ref});return l.$refs=[...l.$refs,decodeURIComponent(t.items.$ref)],l.base=y.base,l.export="array",l.imports=[...l.imports,...y.imports],l.template=y.template,l.type=y.type,l.default=H(t,l),l}if(t.items.anyOf&&a&&a.type){let y=os(a);if(y&&y.definitions.some(g=>!Pr(g).includes("array")))return ae({definition:t.items,openApi:i,parentDefinition:t,types:p})}let d=Array.isArray(t.items)?{anyOf:t.items}:t.items,u=ae({definition:d,openApi:i,parentDefinition:t,types:p});return l.base=u.base,l.export="array",l.$refs=[...l.$refs,...u.$refs],l.imports=[...l.imports,...u.imports],l.link=u,l.template=u.template,l.type=u.type,l.default=H(t,l),l}let f=os(t);if(f){let d=Kp({...f,debug:e,definition:t,getModel:ae,model:l,openApi:i,types:p});return {...l,...d}}if(c.includes("object")||t.properties||t.additionalProperties){if(t.properties&&(Object.keys(t.properties).length>0||!t.additionalProperties)){if(l.base="unknown",l.export="interface",l.type="unknown",l.default=H(t,l),ss({debug:e,definition:t,getModel:ae,openApi:i,parent:l,types:p}).forEach(y=>{l.$refs=[...l.$refs,...y.$refs],l.enums=[...l.enums,...y.enums],l.imports=[...l.imports,...y.imports],l.properties=[...l.properties,y],y.export==="enum"&&(l.enums=[...l.enums,y]);}),t.additionalProperties){let y=Xo({debug:e,definition:t,getModel:ae,model:l,openApi:i,types:p});l.properties=[...l.properties,y];}return !l.properties.length&&l.base==="unknown"&&l.type==="unknown"&&(l.export="dictionary",l.name||(l.name="[key: string]")),l}return Xo({debug:e,definition:t,getModel:ae,model:l,openApi:i,types:p})}if(t.const!==void 0){let d=t.const,u=typeof d=="string"?`"${d}"`:`${d}`;return l.base=u,l.export="const",l.type=u,l}if(c.length){let d=N({format:t.format,type:t.type});return l.base=d.base,l.export="generic",l.$refs=[...l.$refs,...d.$refs],l.imports=[...l.imports,...d.imports],l.isNullable=d.isNullable||l.isNullable,l.template=d.template,l.type=d.type,l.default=H(t,l),l}return l};var is=e=>{if(e.schema)return e.schema;if(e.content){let t=Object.entries(e.content);for(let[r,n]of t)if(n.schema){let o=r;return e.content[o].schema}}};var Wp=e=>{let t={},r=[];return e.components?(Object.entries(e.components.schemas??{}).forEach(([n,o])=>{let i=Qn(n);t[i.name]=i;let a=ae({definition:o,isDefinition:true,meta:i,openApi:e,types:t});r=[...r,a];}),Object.entries(e.components.parameters??{}).forEach(([n,o])=>{let i=is(o);if(!i)return;let a=kp(n);t[a.name]=a;let p=ae({definition:i,isDefinition:true,meta:a,openApi:e,types:t});p.deprecated=o.deprecated,p.description=o.description||null,r=[...r,p];}),{models:r,types:t}):{models:r,types:t}};var zp=({openApi:e,parameter:t,types:r})=>{let n={$refs:[],base:"unknown",deprecated:t.deprecated===true,description:t.description||null,enum:[],enums:[],export:"interface",imports:[],in:t.in,isDefinition:false,isNullable:Ct(t),isReadOnly:false,isRequired:t.required===true,link:null,mediaType:null,prop:t.name,properties:[],template:null,type:"unknown"},o={...n,name:es(n)};if(t.$ref){let a=N({type:t.$ref});return o={...o,$refs:[...o.$refs,...a.$refs],base:a.base,export:"reference",imports:[...o.imports,...a.imports],template:a.template,type:a.type},o}let i=is(t);if(i){if(i.$ref?.startsWith(Rr)&&(i=_(e,i)),i.$ref){let p=N({type:i.$ref});return o={...o,$refs:[...o.$refs,...p.$refs],base:p.base,export:"reference",imports:[...o.imports,...p.imports],template:p.template,type:p.type},o.default=H(i),o}let a=ae({definition:i,openApi:e,types:r});return o={...o,$refs:[...o.$refs,...a.$refs],base:a.base,enum:[...o.enum,...a.enum],enums:[...o.enums,...a.enums],exclusiveMaximum:a.exclusiveMaximum,exclusiveMinimum:a.exclusiveMinimum,export:a.export,format:a.format,imports:[...o.imports,...a.imports],isNullable:o.isNullable||a.isNullable,isReadOnly:a.isReadOnly,isRequired:o.isRequired||a.isRequired,link:a.link,maxItems:a.maxItems,maxLength:a.maxLength,maxProperties:a.maxProperties,maximum:a.maximum,minItems:a.minItems,minLength:a.minLength,minProperties:a.minProperties,minimum:a.minimum,multipleOf:a.multipleOf,pattern:G(a.pattern),properties:[...o.properties,...a.properties],template:a.template,type:a.type,uniqueItems:a.uniqueItems},(o.enum.length||o.enums.length)&&!o.meta&&(o.meta=Hn(o)),o.default=a.default,o}return o};var Rd=["cookie","formData","header","path","query"],as=({openApi:e,parameters:t,types:r})=>{let n={$refs:[],imports:[],parameters:[],parametersBody:null,parametersCookie:[],parametersForm:[],parametersHeader:[],parametersPath:[],parametersQuery:[]};return t.forEach(o=>{let i=_(e,o),a=zp({openApi:e,parameter:i,types:r}),p=!Yn(a);if(!(!Rd.includes(i.in)||p)){switch(i.in){case "cookie":n.parametersCookie=[...n.parametersCookie,a];break;case "formData":n.parametersForm=[...n.parametersForm,a];break;case "header":n.parametersHeader=[...n.parametersHeader,a];break;case "path":n.parametersPath=[...n.parametersPath,a];break;case "query":n.parametersQuery=[...n.parametersQuery,a];break}n.$refs=[...n.$refs,...a.$refs],n.imports=[...n.imports,...a.imports],n.parameters=[...n.parameters,a];}}),n};var Ad=["application/json-patch+json","application/json","application/ld+json","application/x-www-form-urlencoded","multipart/batch","multipart/form-data","multipart/mixed","multipart/related","text/json","text/plain"],ps=(e,t)=>{let r=Object.keys(t).filter(o=>{let i=o.split(";")[0].trim();return Ad.includes(i)}).find(o=>!!t[o]?.schema);if(r)return {mediaType:r,schema:t[r].schema};let n=Object.keys(t).find(o=>!!t[o]?.schema);if(n)return {mediaType:n,schema:t[n].schema}};var _p=({body:e,debug:t,openApi:r,types:n})=>{let o=e["x-body-name"]??"requestBody",i={$refs:[],base:"unknown",default:void 0,description:e.description||null,enum:[],enums:[],export:"interface",imports:[],in:"body",isDefinition:false,isNullable:e.nullable===true,isReadOnly:false,isRequired:e.required===true,link:null,mediaType:null,name:o,prop:o,properties:[],template:null,type:"unknown"};if(!e.content)return i;let a=ps(r,e.content);if(!a)return i;switch(i.mediaType=a.mediaType,i.mediaType){case "application/x-www-form-urlencoded":case "multipart/form-data":i.in="formData",i.name="formData",i.prop="formData";break}if(a.schema.$ref){let c=N({type:a.schema.$ref});return i.export="reference",i.type=c.type,i.base=c.base,i.template=c.template,i.$refs=[...i.$refs,...c.$refs],i.imports=[...i.imports,...c.imports],i}let p=ae({debug:t,definition:a.schema,openApi:r,types:n});return i.$refs=[...i.$refs,...p.$refs],i.base=p.base,i.enum=[...i.enum,...p.enum],i.enums=[...i.enums,...p.enums],i.exclusiveMaximum=p.exclusiveMaximum,i.exclusiveMinimum=p.exclusiveMinimum,i.export=p.export,i.format=p.format,i.imports=[...i.imports,...p.imports],i.isNullable=i.isNullable||p.isNullable,i.isReadOnly=p.isReadOnly,i.isRequired=i.isRequired||p.isRequired,i.link=p.link,i.maximum=p.maximum,i.maxItems=p.maxItems,i.maxLength=p.maxLength,i.maxProperties=p.maxProperties,i.minimum=p.minimum,i.minItems=p.minItems,i.minLength=p.minLength,i.minProperties=p.minProperties,i.multipleOf=p.multipleOf,i.pattern=G(p.pattern),i.properties=[...i.properties,...p.properties],i.template=p.template,i.type=p.type,i.uniqueItems=p.uniqueItems,i};var Hp=({code:e,openApi:t,response:r,types:n})=>{let o={$refs:[],base:e!==204?"unknown":"void",code:e,description:r.description||null,enum:[],enums:[],export:"generic",imports:[],in:"response",isDefinition:false,isNullable:false,isReadOnly:false,isRequired:false,link:null,name:"",properties:[],responseTypes:[],template:null,type:e!==204?"unknown":"void"};if(r.content){let i=ps(t,r.content);if(i){if(i.schema.$ref?.startsWith("#/components/responses/")&&(i.schema=_(t,i.schema)),i.schema.$ref){let p=N({type:i.schema.$ref});return o.base=p.base,o.export="reference",o.$refs=[...o.$refs,...p.$refs],o.imports=[...o.imports,...p.imports],o.template=p.template,o.type=p.type,o}let a=ae({definition:i.schema,openApi:t,types:n});return o.export=a.export,o.type=a.type,o.base=a.base,o.template=a.template,o.link=a.link,o.isReadOnly=a.isReadOnly,o.isRequired=a.isRequired,o.isNullable=a.isNullable,o.format=a.format,o.maximum=a.maximum,o.exclusiveMaximum=a.exclusiveMaximum,o.minimum=a.minimum,o.exclusiveMinimum=a.exclusiveMinimum,o.multipleOf=a.multipleOf,o.maxLength=a.maxLength,o.minLength=a.minLength,o.maxItems=a.maxItems,o.minItems=a.minItems,o.uniqueItems=a.uniqueItems,o.maxProperties=a.maxProperties,o.minProperties=a.minProperties,o.pattern=G(a.pattern),o.$refs=[...o.$refs,...a.$refs],o.imports=[...o.imports,...a.imports],o.enum=[...o.enum,...a.enum],o.enums=[...o.enums,...a.enums],o.properties=[...o.properties,...a.properties],o}}if(r.headers)for(let i in r.headers)return o.in="header",o.name=i,o.type="string",o.base="string",o;return o};var Qp=({openApi:e,responses:t,types:r})=>{let n=[];return Object.entries(t).forEach(([o,i])=>{let a=Un(o);if(!a)return;let p=_(e,i),c=Hp({code:a,openApi:e,response:p,types:r});n=[...n,c];}),n=ts(n),n.sort(Xn)};var Ir=(e,t)=>{let r=[...e],n=[...t];for(;n.length>0;){let o=n[0];n=n.slice(1),r.every(a=>a.in!==o.in||a.name!==o.name)&&(r=[...r,o]);}return r},Zp=({debug:e,method:t,op:r,openApi:n,pathParams:o,types:i,url:a})=>{let p={$refs:[],deprecated:!!r.deprecated,description:r.description||null,id:r.operationId||null,imports:[],method:t.toUpperCase(),parameters:[],parametersBody:o.parametersBody,parametersCookie:[],parametersForm:[],parametersHeader:[],parametersPath:[],parametersQuery:[],path:a,responseHeader:null,responses:[],summary:r.summary||null,tags:r.tags||null},c={...p,name:Gn({config:A(),method:p.method,operationId:r.operationId,path:p.path})};if(r.parameters){let m=as({openApi:n,parameters:r.parameters,types:i});c.$refs=[...c.$refs,...m.$refs],c.imports=[...c.imports,...m.imports],c.parameters=[...c.parameters,...m.parameters],c.parametersBody=m.parametersBody,c.parametersCookie=[...c.parametersCookie,...m.parametersCookie],c.parametersForm=[...c.parametersForm,...m.parametersForm],c.parametersHeader=[...c.parametersHeader,...m.parametersHeader],c.parametersPath=[...c.parametersPath,...m.parametersPath],c.parametersQuery=[...c.parametersQuery,...m.parametersQuery];}if(r.requestBody){let m=_(n,r.requestBody),l=_p({body:m,debug:e,openApi:n,types:i});c.$refs=[...c.$refs,...l.$refs],c.imports=[...c.imports,...l.imports],c.parameters=[...c.parameters,l],c.parametersBody=l;}if(r.responses){c.responses=Qp({openApi:n,responses:r.responses,types:i});let m=c.responses.filter(l=>l.responseTypes.includes("success"));c.responseHeader=Zn(m),m.forEach(l=>{c.$refs=[...c.$refs,...l.$refs],c.imports=[...c.imports,...l.imports];});}return c.parameters=Ir(c.parameters,o.parameters),c.parametersCookie=Ir(c.parametersCookie,o.parametersCookie),c.parametersForm=Ir(c.parametersForm,o.parametersForm),c.parametersHeader=Ir(c.parametersHeader,o.parametersHeader),c.parametersPath=Ir(c.parametersPath,o.parametersPath),c.parametersQuery=Ir(c.parametersQuery,o.parametersQuery),c.parameters=ns(c.parameters),c};var Up=({openApi:e,types:t})=>{let r=new Map,n=[],o=A();for(let i in e.paths){let a=e.paths[i],p=as({openApi:e,parameters:a.parameters??[],types:t});for(let c in a){let m=c,l=V({method:m,path:i});if(Fn.includes(m)){let f=a[m];if(f.operationId&&(r.has(f.operationId)?o.logs.level!=="silent"&&console.warn(`\u2757\uFE0F Duplicate operationId: ${f.operationId} in ${l}. Please ensure your operation IDs are unique. This behavior is not supported and will likely lead to unexpected results.`):r.set(f.operationId,l)),Jn({config:o,operationKey:l})){let d=Zp({method:m,op:f,openApi:e,pathParams:p,types:t,url:i});n.push(d);}}}}return n};var Xp=e=>{let t=e.servers?.[0],r=t?.variables||{},n=t?.url||"";return Object.entries(r).forEach(([o,i])=>{n=n.replace(`{${o}}`,i.default);}),n.replace(/\/$/g,"")};var Jp=e=>{let t=Bn(e.info.version),r=Xp(e),{models:n,types:o}=Wp(e),i=Up({openApi:e,types:o});return {models:n,operations:i,server:r,types:o,version:t}};function hP({openApi:e}){let t=e;if("openapi"in t)return Jp(t);if("swagger"in t)return Vp(t);throw new Error(`Unsupported OpenAPI specification: ${JSON.stringify(t,null,2)}`)}var gP=({config:e,dependencies:t,logger:r,spec:n})=>{let o=new Nn({config:e,dependencies:t,logger:r,spec:n});if("swagger"in o.spec)return Ko(o),o;if(Bt(o.spec.openapi,">=3.0.0 <3.1.0"))return Wo(o),o;if(Bt(o.spec.openapi,">=3.1.0"))return zo(o),o;throw new Error("Unsupported OpenAPI specification")};var je={baseUrl:true,bundle:true,exportFromIndex:false},Ce={dependencies:["@hey-api/typescript"],tags:["client"]};var Ed=fileURLToPath(import.meta.url),Gp=L.dirname(Ed),Jt=({config:e,sourceOutput:t})=>{let r=k(e);if("bundle"in r.config&&r.config.bundle)return nr({moduleOutput:"client",sourceOutput:t});if(L.isAbsolute(r.name)){let n=L.dirname(r.name),o=L.resolve(e.output.path);return L.relative(o,n).replace(/\\/g,"/")}return r.name},Ye=e=>{let t=k(e);if("bundle"in t.config&&t.config.bundle){let r=e._FRAGILE_CLIENT_BUNDLE_RENAMED;return L.resolve(e.output.path,"client",`${r?.get("index")??"index"}.ts`)}return t.name},cs=(e,t)=>{if(ye.statSync(e).isDirectory()){ye.existsSync(t)||ye.mkdirSync(t,{recursive:true});let n=ye.readdirSync(e);for(let o of n)cs(L.join(e,o),L.join(t,o));}else {let n=ye.readFileSync(e);ye.writeFileSync(t,n);}},Yp=({filePath:e,project:t,renamed:r})=>{let n=L.extname(e),o=L.basename(e,n),i=t.fileName?.(o)||o;if(i!==o){let a=L.dirname(e);ye.renameSync(e,L.resolve(a,`${i}${n}`)),r.set(o,i);}},ec=({filePath:e,meta:t,renamed:r})=>{let n=ye.readFileSync(e,"utf8");n=n.replace(/from\s+['"](\.\.?\/[^'"]*?)['"]/g,(i,a)=>{let p=i.indexOf(a),c=L.extname(a),m=L.basename(a,c),l=L.dirname(a),f=(r.get(m)??m)+(t.importFileExtension?t.importFileExtension:c);return i.slice(0,p)+[l,f].filter(Boolean).join("/")+i.slice(p+a.length)}),n=`// This file is auto-generated by @hey-api/openapi-ts
|
|
35
|
+
|
|
36
|
+
${n}`,ye.writeFileSync(e,n,"utf8");},kP=({meta:e,outputPath:t,plugin:r,project:n})=>{let o=new Map;if(r.name.startsWith("@hey-api/client-")){let u=L.resolve(t,"core");it(u);let y=L.resolve(Gp,"clients","core");cs(y,u);let g=L.resolve(t,"client");it(g);let x=r.name.slice(16),b=L.resolve(Gp,"clients",x);if(cs(b,g),n){let j=ye.readdirSync(u);for(let D of j)Yp({filePath:L.resolve(u,D),project:n,renamed:o});let C=ye.readdirSync(g);for(let D of C)Yp({filePath:L.resolve(g,D),project:n,renamed:o});}let I=ye.readdirSync(u);for(let j of I)ec({filePath:L.resolve(u,j),meta:e,renamed:o});let P=ye.readdirSync(g);for(let j of P)ec({filePath:L.resolve(g,j),meta:e,renamed:o});return o}let a=L.isAbsolute(r.name)?L.dirname(r.name):void 0;if(a){let u=L.resolve(t,"client");it(u),cs(a,u);return}let c=L.normalize(ki.resolve(r.name)).split(L.sep),m=c.slice(0,c.indexOf("dist")+1).join(L.sep),f=[c[c.length-1],"index.d.ts","index.d.cts"],d=L.resolve(t,"client");it(d);for(let u of f)ye.copyFileSync(L.resolve(m,u),L.resolve(d,u));};var Id=({plugin:e})=>{let{baseUrl:t}=e.config;if(t===false)return;if(typeof t=="string")return t;let{servers:r}=e.context.ir;if(r)return r[typeof t=="number"?t:0]?.url},tc=({plugin:e})=>{let t=Ye(e.context.config),r=e.registerSymbol({external:t,name:"createClient"}),n=e.registerSymbol({external:t,name:"createConfig"}),o=e.getPluginOrThrow("@hey-api/typescript"),i=e.referenceSymbol(o.api.getSelector("ClientOptions")),{runtimeConfigPath:a}=e.config,p=a?e.registerSymbol({external:a,name:"createClientConfig"}):void 0,c=[],m=Id({plugin:e});if(m){let u=Qe(m);if(u.protocol&&u.host&&!m.includes("{"))c.push({key:fe(e.context.config),value:m});else if(m!=="/"&&m.startsWith("/")){let y=m.endsWith("/")?m.slice(0,-1):m;c.push({key:fe(e.context.config),value:y});}}"throwOnError"in e.config&&e.config.throwOnError&&c.push({key:"throwOnError",value:true});let l=[s.callExpression({functionName:n.placeholder,parameters:c.length?[s.objectExpression({obj:c})]:void 0,types:[s.typeReferenceNode({typeName:i.placeholder})]})],f=e.registerSymbol({name:"client",selector:e.api.getSelector("client")}),d=s.constVariable({exportConst:true,expression:s.callExpression({functionName:r.placeholder,parameters:p?[s.callExpression({functionName:p.placeholder,parameters:l})]:l}),name:f.placeholder});e.setSymbolValue(f,d);};var rc=({plugin:e})=>{let t=Ye(e.context.config),r=e.getPluginOrThrow("@hey-api/typescript"),n=e.referenceSymbol(r.api.getSelector("ClientOptions")),o=e.registerSymbol({external:t,meta:{kind:"type"},name:"Config"}),i=e.registerSymbol({external:t,meta:{kind:"type"},name:"ClientOptions"}),a=e.registerSymbol({exported:true,meta:{kind:"type"},name:"CreateClientConfig"}),p=s.typeReferenceNode({typeName:i.placeholder}),c=s.typeReferenceNode({typeName:"T"}),m=s.typeAliasDeclaration({comment:["The `createClientConfig()` function will be called on client initialization","and the returned object will become the client's initial configuration.","","You may want to initialize your client this way instead of calling","`setConfig()`. This is useful for example if you're using Next.js","to ensure your client always has the correct values."],exportType:a.exported,name:a.placeholder,type:s.functionTypeNode({parameters:[s.parameterDeclaration({name:"override",required:false,type:s.typeReferenceNode({typeArguments:[s.typeIntersectionNode({types:[p,c]})],typeName:o.placeholder})})],returnType:s.typeReferenceNode({typeArguments:[s.typeIntersectionNode({types:[s.typeReferenceNode({typeArguments:[p],typeName:"Required"}),c]})],typeName:o.placeholder})}),typeParameters:[{default:s.typeReferenceNode({typeName:n.placeholder}),extends:p,name:"T"}]});e.setSymbolValue(a,m);};var Ne=({plugin:e})=>{rc({plugin:e}),tc({plugin:e});};var ms=class{constructor(t){this.meta=t;}getSelector(...t){return [this.meta.name,...t]}};var kd=({securitySchemeObject:e})=>{if(e.type==="openIdConnect")return {scheme:"bearer",type:"http"};if(e.type==="oauth2")return e.flows.password||e.flows.authorizationCode||e.flows.clientCredentials||e.flows.implicit?{scheme:"bearer",type:"http"}:void 0;if(e.type==="apiKey")return e.in==="header"?{name:e.name,type:"apiKey"}:e.in==="query"||e.in=="cookie"?{in:e.in,name:e.name,type:"apiKey"}:void 0;if(e.type==="http"){let t=e.scheme.toLowerCase();return t==="bearer"||t==="basic"?{scheme:t,type:"http"}:void 0}},nc=({operation:e,plugin:t})=>{if(!e.security||!t.config.auth)return [];let r=[];for(let n of e.security){let o=kd({securitySchemeObject:n});o?r.push(o):console.warn(`\u2757\uFE0F SDK warning: unsupported security scheme. Please open an issue if you'd like it added https://github.com/hey-api/openapi-ts/issues
|
|
37
|
+
${JSON.stringify(n,null,2)}`);}return r};var kr="TComposable",et="DefaultT",Jo="ResT";var sc=({operation:e,plugin:t})=>{if(!t.config.validator.request)return;let r=t.getPluginOrThrow(t.config.validator.request);if(r.api.createRequestValidator)return r.api.createRequestValidator({operation:e,plugin:r})},oc=({operation:e,plugin:t})=>{if(!t.config.validator.response)return;let r=t.getPluginOrThrow(t.config.validator.response);if(r.api.createResponseValidator)return r.api.createResponseValidator({operation:e,plugin:r})};var ic=({context:e,value:t})=>{let r=q({case:"PascalCase",value:ct(t)});return Ar({config:e.config,name:r})},jd=({operation:e,plugin:t})=>t.config.methodNameBuilder?t.config.methodNameBuilder(e):!t.config.asClass&&e.id.match(le)?`${e.id}_`:e.id,qe=({context:e,operation:t,plugin:r})=>{let n=new Map,o,i,a=[];if(r.config.classStructure==="auto"&&t.operationId&&(a=t.operationId.split(/[./]/).filter(Boolean),a.length>1)){let c=a.pop();i=q({case:"camelCase",value:ct(c)}),o=a.pop();}let p=r.config.instance?[r.config.instance]:t.tags??["default"];for(let c of p){let m=ic({context:e,value:o||c}),l=[c];o&&(a.includes(c)||c===o?l=[...a,o]:l=[c,...a,o]),n.set(c,{className:m,methodName:i||jd({operation:t,plugin:r}),path:l.map(f=>ic({context:e,value:f}))});}return n},rn=({operation:e,plugin:t,throwOnError:r})=>{let o=k(t.context.config).name==="@hey-api/client-nuxt",i=t.getPluginOrThrow("@hey-api/typescript"),a=t.getSymbol(i.api.getSelector("data",e.id)),p=a?.placeholder||"unknown",c=t.referenceSymbol(t.api.getSelector("Options"));if(o){let l=t.getSymbol(i.api.getSelector("response",e.id))?.placeholder||"unknown";return `${c.placeholder}<${kr}, ${p}, ${l}, ${et}>`}return r?`${c.placeholder}<${p}, ${r}>`:a?`${c.placeholder}<${a.placeholder}>`:c.placeholder},Go=({isRequiredOptions:e,operation:t,plugin:r})=>{let n={argNames:[],fields:[],parameters:[]},o=r.getPluginOrThrow("@hey-api/typescript"),a=k(r.context.config).name==="@hey-api/client-nuxt";if(r.config.params_EXPERIMENTAL==="experiment"){if(t.parameters?.path)for(let p in t.parameters.path){let c=t.parameters.path[p],m=Kt(c.name);n.argNames.push(m),n.fields.push({in:"path",key:m}),n.parameters.push({isRequired:c.required,name:m,type:o.api.schemaToType({plugin:o,schema:c.schema})});}if(t.parameters?.query)for(let p in t.parameters.query){let c=t.parameters.query[p],m=Kt(c.name);n.argNames.push(m),n.fields.push({in:"path",key:m}),n.parameters.push({isRequired:c.required,name:m,type:o.api.schemaToType({plugin:o,schema:c.schema})});}if(t.body){let p="body";n.argNames.push(p),n.fields.push({in:"body"}),n.parameters.push({isRequired:t.body.required,name:p,type:o.api.schemaToType({plugin:o,schema:t.body.schema})});}}return n.parameters.push({isRequired:e,name:"options",type:rn({operation:t,plugin:r,throwOnError:a?void 0:"ThrowOnError"})}),n},Cd=e=>{if(!e)return;let t=e.split(";")[0]?.trim();if(t){if(t.startsWith("application/json")||t.endsWith("+json"))return "json";if(["application/","audio/","image/","video/"].some(r=>t.startsWith(r)))return "blob";if(t.startsWith("text/"))return "text"}},Yo=({isRequiredOptions:e,opParameters:t,operation:r,plugin:n})=>{let o=k(n.context.config),i=o.name==="@hey-api/client-nuxt",a=n.getPluginOrThrow("@hey-api/typescript"),c=n.getSymbol(a.api.getSelector(i?"response":"responses",r.id))?.placeholder||"unknown",l=n.getSymbol(a.api.getSelector(i?"error":"errors",r.id))?.placeholder||"unknown",f=[];if(r.body)switch(r.body.type){case "form-data":{let v=n.referenceSymbol(n.api.getSelector("formDataBodySerializer"));f.push({spread:v.placeholder});break}case "json":break;case "text":case "octet-stream":f.push({key:"bodySerializer",value:null});break;case "url-search-params":{let v=n.referenceSymbol(n.api.getSelector("urlSearchParamsBodySerializer"));f.push({spread:v.placeholder});break}}for(let v in r.parameters?.query){let M=r.parameters.query[v];if((M.schema.type==="array"||M.schema.type==="tuple")&&(M.style!=="form"||!M.explode)){f.push({key:"querySerializer",value:[{key:"array",value:[{key:"explode",value:false},{key:"style",value:"form"}]}]});break}}let d=sc({operation:r,plugin:n});if(d&&f.push({key:"requestValidator",value:d}),n.config.transformer==="@hey-api/transformers"){let v=n.getPluginOrThrow(n.config.transformer),M=n.getSymbol(v.api.getSelector("response",r.id));M&&n.getSymbolValue(M)&&f.push({key:"responseTransformer",value:M.placeholder});}let u=false,y;for(let v in r.responses){let M=r.responses[v];!y&&o.name==="@hey-api/client-axios"&&vo({statusCode:v})==="2XX"&&(y=Cd(M.mediaType),y&&f.push({key:"responseType",value:y})),M.mediaType==="text/event-stream"&&(u=true);}let g=oc({operation:r,plugin:n});g&&f.push({key:"responseValidator",value:g}),n.config.responseStyle==="data"&&f.push({key:"responseStyle",value:n.config.responseStyle});let x=nc({context:n.context,operation:r,plugin:n});x.length&&f.push({key:"security",value:s.arrayLiteralExpression({elements:x})}),f.push({key:"url",value:r.path}),f.push({spread:"options"});let b=[],I=t.argNames.length;if(I){let v=[],M=[];for(let Le of t.argNames)v.push(s.identifier({text:Le}));for(let Le of t.fields){let rr=[];"in"in Le&&(rr.push({key:"in",value:Le.in}),Le.key&&rr.push({key:"key",value:Le.key}),Le.map&&rr.push({key:"map",value:Le.map})),M.push(s.objectExpression({obj:rr}));}let Rt=n.referenceSymbol(n.api.getSelector("buildClientParams"));b.push(s.constVariable({expression:s.callExpression({functionName:Rt.placeholder,parameters:[s.arrayLiteralExpression({elements:v}),s.arrayLiteralExpression({elements:M})]}),name:"params"})),f.push({spread:"params"});}if(r.body){let v=r.parameters?.header?.["content-type"];if(!!!v?.required){let Rt=[{key:v?.name??"Content-Type",value:r.body.type==="form-data"?null:r.body.mediaType},{spread:s.propertyAccessExpression({expression:s.identifier({text:"options"}),isOptional:!e,name:"headers"})}];I&&Rt.push({spread:s.propertyAccessExpression({expression:s.identifier({text:"params"}),name:"headers"})}),f.push({key:"headers",value:Rt});}}let P=n.config.client&&o.api&&"getSelector"in o.api?n.getSymbol(o.api.getSelector("client")):void 0,j=s.propertyAccessExpression({expression:s.identifier({text:"options"}),isOptional:!e,name:"client"}),C;n.config.instance?C=s.binaryExpression({left:j,operator:"??",right:s.propertyAccessExpression({expression:s.this(),name:"_client"})}):P?C=s.binaryExpression({left:j,operator:"??",right:P.placeholder}):C=j;let D=[];i?D.push(kr,`${c} | ${et}`,l,et):D.push(c,l,"ThrowOnError"),n.config.responseStyle==="data"&&D.push(s.stringLiteral({text:n.config.responseStyle}));let K=u?s.propertyAccessExpression({expression:C,name:s.identifier({text:"sse"})}):C;return K=s.propertyAccessExpression({expression:K,name:s.identifier({text:r.method})}),b.push(s.returnFunctionCall({args:[s.objectExpression({identifiers:["responseTransformer"],obj:f})],name:K,types:D})),b};var ne=({context:e,operation:t})=>{let n=k(e.config).name==="@hey-api/client-nuxt",o=e.config.plugins["@hey-api/sdk"];return o&&!o.config.client&&!o.config.instance||n||dr(t)},jr=({operation:e})=>{for(let t in e.responses)if(e.responses[t].mediaType==="text/event-stream")return true;return false};var Nd=({plugin:e})=>{let t=new Map,r=new Set,n=e.getPluginOrThrow("@hey-api/sdk");e.forEach("operation",({operation:i})=>{let a=ne({context:e.context,operation:i}),p=qe({context:e.context,operation:i,plugin:n});for(let c of p.values())c.path.forEach((m,l)=>{t.has(m)||t.set(m,{className:m,classes:new Set,methods:new Set,nodes:[],root:!l});let f=c.path[l-1];if(f&&f!==m){let x=t.get(f);x.classes.add(m),t.set(f,x);}if(!(c.path.length===l+1))return;let u=t.get(m),y=e.config.httpRequests.methodNameBuilder(i);if(u.methods.has(y))return;let g=wd({isRequiredOptions:a,methodName:y,operation:i,plugin:e});u.nodes.length?u.nodes.push(s.identifier({text:`
|
|
38
|
+
`}),g):u.nodes.push(g),u.methods.add(y),t.set(m,u);});});let o=i=>{if(r.has(i.className))return;if(i.classes.size)for(let m of i.classes){let l=t.get(m);o(l),i.nodes.push(s.propertyDeclaration({initializer:s.newExpression({argumentsArray:[],expression:s.identifier({text:O({config:{case:"preserve",name:e.config.httpRequests.classNameBuilder},name:l.className})})}),name:q({case:"camelCase",value:l.className})}));}let a=e.referenceSymbol(e.api.getSelector("Injectable")),p=e.registerSymbol({exported:true,name:O({config:{case:"preserve",name:e.config.httpRequests.classNameBuilder},name:i.className}),selector:e.api.getSelector("class",i.className)}),c=s.classDeclaration({decorator:i.root?{args:[{providedIn:"root"}],name:a.placeholder}:void 0,exportClass:p.exported,name:p.placeholder,nodes:i.nodes});e.setSymbolValue(p,c),r.add(i.className);};for(let i of t.values())o(i);},vd=({plugin:e})=>{e.forEach("operation",({operation:t})=>{let r=ne({context:e.context,operation:t}),n=e.registerSymbol({exported:true,name:e.config.httpRequests.methodNameBuilder(t),selector:e.api.getSelector("httpRequest",t.id)}),o=qd({isRequiredOptions:r,operation:t,plugin:e,symbol:n});e.setSymbolValue(n,o);});},ac=({operation:e,plugin:t})=>{let r=k(t.context.config),n=r.api&&"getSelector"in r.api?t.getSymbol(r.api.getSelector("client")):void 0,o=s.propertyAccessExpression({expression:s.identifier({text:"options"}),isOptional:true,name:"client"}),i;return n?i=s.binaryExpression({left:o,operator:"??",right:n.placeholder}):i=o,s.callExpression({functionName:s.propertyAccessExpression({expression:i,name:"requestOptions"}),parameters:[s.objectExpression({obj:[{key:"responseStyle",value:s.identifier({text:"'data'"})},{key:"method",value:s.identifier({text:`'${e.method.toUpperCase()}'`})},{key:"url",value:s.identifier({text:`'${e.path}'`})},{spread:"options"}]})]})},wd=({isRequiredOptions:e,methodName:t,operation:r,plugin:n})=>{let o=n.getPluginOrThrow("@hey-api/typescript"),i=n.referenceSymbol(n.api.getSelector("HttpRequest")),a=n.getPluginOrThrow("@hey-api/sdk"),p=n.referenceSymbol(a.api.getSelector("Options")),m=n.getSymbol(o.api.getSelector("data",r.id))?.placeholder||"unknown";return s.methodDeclaration({accessLevel:"public",comment:a.api.createOperationComment({operation:r}),name:t,parameters:[{isRequired:e,name:"options",type:`${p.placeholder}<${m}, ThrowOnError>`}],returnType:`${i.placeholder}<unknown>`,statements:[s.returnStatement({expression:ac({operation:r,plugin:n})})],types:[{default:false,extends:"boolean",name:"ThrowOnError"}]})},qd=({isRequiredOptions:e,operation:t,plugin:r,symbol:n})=>{let o=r.getPluginOrThrow("@hey-api/typescript"),i=r.referenceSymbol(r.api.getSelector("HttpRequest")),a=r.getPluginOrThrow("@hey-api/sdk"),p=r.referenceSymbol(a.api.getSelector("Options")),m=r.getSymbol(o.api.getSelector("data",t.id))?.placeholder||"unknown";return s.constVariable({comment:a.api.createOperationComment({operation:t}),exportConst:n.exported,expression:s.arrowFunction({parameters:[{isRequired:e,name:"options",type:`${p.placeholder}<${m}, ThrowOnError>`}],returnType:`${i.placeholder}<unknown>`,statements:[s.returnStatement({expression:ac({operation:t,plugin:r})})],types:[{default:false,extends:"boolean",name:"ThrowOnError"}]}),name:n.placeholder})},pc=({plugin:e})=>{e.config.httpRequests.asClass?Nd({plugin:e}):vd({plugin:e});};var $d=({plugin:e})=>{let t=new Map,r=new Set,n=e.getPluginOrThrow("@hey-api/sdk");e.forEach("operation",({operation:i})=>{let a=ne({context:e.context,operation:i}),p=qe({context:e.context,operation:i,plugin:n});for(let c of p.values())c.path.forEach((m,l)=>{t.has(m)||t.set(m,{className:m,classes:new Set,methods:new Set,nodes:[],root:!l});let f=c.path[l-1];if(f&&f!==m){let x=t.get(f);x.classes.add(m),t.set(f,x);}if(!(c.path.length===l+1))return;let u=t.get(m),y=e.config.httpResources.methodNameBuilder(i);if(u.methods.has(y))return;let g=Ld({isRequiredOptions:a,methodName:y,operation:i,plugin:e});u.nodes.length?u.nodes.push(s.identifier({text:`
|
|
39
|
+
`}),g):u.nodes.push(g),u.methods.add(y),t.set(m,u);});});let o=i=>{if(r.has(i.className))return;if(i.classes.size)for(let m of i.classes){let l=t.get(m);o(l),i.nodes.push(s.propertyDeclaration({initializer:s.newExpression({argumentsArray:[],expression:s.identifier({text:O({config:{case:"preserve",name:e.config.httpResources.classNameBuilder},name:l.className})})}),name:q({case:"camelCase",value:l.className})}));}let a=e.referenceSymbol(e.api.getSelector("Injectable")),p=e.registerSymbol({exported:true,name:O({config:{case:"preserve",name:e.config.httpResources.classNameBuilder},name:i.className})}),c=s.classDeclaration({decorator:i.root?{args:[{providedIn:"root"}],name:a.placeholder}:void 0,exportClass:p.exported,name:p.placeholder,nodes:i.nodes});e.setSymbolValue(p,c),r.add(i.className);};for(let i of t.values())o(i);},Md=({plugin:e})=>{e.forEach("operation",({operation:t})=>{let r=ne({context:e.context,operation:t}),n=e.registerSymbol({exported:true,name:e.config.httpResources.methodNameBuilder(t)}),o=Vd({isRequiredOptions:r,operation:t,plugin:e,symbol:n});e.setSymbolValue(n,o);});},cc=({operation:e,plugin:t})=>{let r=t.getPluginOrThrow("@hey-api/sdk"),n=t.getPluginOrThrow("@hey-api/typescript"),o=t.referenceSymbol(t.api.getSelector("httpResource")),a=t.getSymbol(n.api.getSelector("response",e.id))?.placeholder||"unknown";if(t.config.httpRequests.asClass){let p=qe({context:t.context,operation:e,plugin:r}),c=Array.from(p.values())[0];if(c){let m=c.path[0],l=t.referenceSymbol(t.api.getSelector("class",m)),f=t.referenceSymbol(t.api.getSelector("inject")),d=s.callExpression({functionName:f.placeholder,parameters:[s.identifier({text:l.placeholder})]});for(let u=1;u<c.path.length;u++){let y=c.path[u];y&&(d=s.propertyAccessExpression({expression:d,name:q({case:"camelCase",value:y})}));}return d=s.propertyAccessExpression({expression:d,name:t.config.httpRequests.methodNameBuilder(e)}),s.callExpression({functionName:o.placeholder,parameters:[s.arrowFunction({parameters:[],statements:[s.constVariable({expression:s.conditionalExpression({condition:s.identifier({text:"options"}),whenFalse:s.identifier({text:"undefined"}),whenTrue:s.callExpression({functionName:"options",parameters:[]})}),name:"opts"}),s.returnStatement({expression:s.conditionalExpression({condition:s.identifier({text:"opts"}),whenFalse:s.identifier({text:"undefined"}),whenTrue:s.callExpression({functionName:d,parameters:[s.identifier({text:"opts"})]})})})]})],types:[s.typeNode(a)]})}}else {let p=t.referenceSymbol(t.api.getSelector("httpRequest",e.id));return s.callExpression({functionName:o.placeholder,parameters:[s.arrowFunction({parameters:[],statements:[s.constVariable({expression:s.conditionalExpression({condition:s.identifier({text:"options"}),whenFalse:s.identifier({text:"undefined"}),whenTrue:s.callExpression({functionName:"options",parameters:[]})}),name:"opts"}),s.returnStatement({expression:s.conditionalExpression({condition:s.identifier({text:"opts"}),whenFalse:s.identifier({text:"undefined"}),whenTrue:s.callExpression({functionName:p.placeholder,parameters:[s.identifier({text:"opts"})]})})})]})],types:[s.typeNode(a)]})}return s.callExpression({functionName:o.placeholder,parameters:[s.arrowFunction({parameters:[],statements:[s.returnStatement({expression:s.identifier({text:"undefined"})})]})],types:[s.typeNode(a)]})},Ld=({isRequiredOptions:e,methodName:t,operation:r,plugin:n})=>{let o=n.getPluginOrThrow("@hey-api/typescript"),i=n.getPluginOrThrow("@hey-api/sdk"),a=n.referenceSymbol(i.api.getSelector("Options")),c=n.getSymbol(o.api.getSelector("data",r.id))?.placeholder||"unknown";return s.methodDeclaration({accessLevel:"public",comment:i.api.createOperationComment({operation:r}),name:t,parameters:[{isRequired:e,name:"options",type:`() => ${a.placeholder}<${c}, ThrowOnError> | undefined`}],returnType:void 0,statements:[s.returnStatement({expression:cc({operation:r,plugin:n})})],types:[{default:false,extends:"boolean",name:"ThrowOnError"}]})},Vd=({isRequiredOptions:e,operation:t,plugin:r,symbol:n})=>{let o=r.getPluginOrThrow("@hey-api/typescript"),i=r.getPluginOrThrow("@hey-api/sdk"),a=r.referenceSymbol(i.api.getSelector("Options")),c=r.getSymbol(o.api.getSelector("data",t.id))?.placeholder||"unknown";return s.constVariable({comment:i.api.createOperationComment({operation:t}),exportConst:n.exported,expression:s.arrowFunction({parameters:[{isRequired:e,name:"options",type:`() => ${a.placeholder}<${c}, ThrowOnError> | undefined`}],statements:[s.returnStatement({expression:cc({operation:t,plugin:r})})],types:[{default:false,extends:"boolean",name:"ThrowOnError"}]}),name:n.placeholder})},mc=({plugin:e})=>{e.config.httpResources.asClass?$d({plugin:e}):Md({plugin:e});};var lc=({plugin:e})=>{e.registerSymbol({external:"@angular/common/http",meta:{kind:"type"},name:"HttpRequest",selector:e.api.getSelector("HttpRequest")}),e.registerSymbol({external:"@angular/core",name:"inject",selector:e.api.getSelector("inject")}),e.registerSymbol({external:"@angular/core",name:"Injectable",selector:e.api.getSelector("Injectable")}),e.registerSymbol({external:"@angular/common/http",name:"httpResource",selector:e.api.getSelector("httpResource")}),e.config.httpRequests.enabled&&pc({plugin:e}),e.config.httpResources.enabled&&mc({plugin:e});};var ls={api:new ms({name:"@angular/common"}),config:{exportFromIndex:false},dependencies:["@hey-api/client-angular","@hey-api/sdk"],handler:lc,name:"@angular/common",output:"@angular/common",resolveConfig:(e,t)=>{if(e.config.httpRequests=t.valueToObject({defaultValue:{asClass:false,classNameBuilder:"{{name}}Requests",enabled:true},mappers:{boolean:r=>({enabled:r})},value:e.config.httpRequests}),!e.config.httpRequests.methodNameBuilder){let{asClass:r}=e.config.httpRequests;e.config.httpRequests.methodNameBuilder=n=>r?String(n.id):`${String(n.id)}Request`;}if(e.config.httpResources=t.valueToObject({defaultValue:{asClass:false,classNameBuilder:"{{name}}Resources",enabled:true},mappers:{boolean:r=>({enabled:r})},value:e.config.httpResources}),!e.config.httpResources.methodNameBuilder){let{asClass:r}=e.config.httpResources;e.config.httpResources.methodNameBuilder=n=>r?String(n.id):`${String(n.id)}Resource`;}}};var fs=class{constructor(t){this.meta=t;}getSelector(...t){return [this.meta.name,...t]}};var ds={...Ce,api:new fs({name:"@hey-api/client-angular"}),config:{...je,throwOnError:false},handler:Ne,name:"@hey-api/client-angular"};var us=class{constructor(t){this.meta=t;}getSelector(...t){return [this.meta.name,...t]}};var ys={...Ce,api:new us({name:"@hey-api/client-axios"}),config:{...je,throwOnError:false},handler:Ne,name:"@hey-api/client-axios"};var hs=class{constructor(t){this.meta=t;}getSelector(...t){return [this.meta.name,...t]}};var gs={...Ce,api:new hs({name:"@hey-api/client-fetch"}),config:{...je,throwOnError:false},handler:Ne,name:"@hey-api/client-fetch"};var xs=class{constructor(t){this.meta=t;}getSelector(...t){return [this.meta.name,...t]}};var bs={...Ce,api:new xs({name:"@hey-api/client-next"}),config:{...je,throwOnError:false},handler:Ne,name:"@hey-api/client-next"};var Ss=class{constructor(t){this.meta=t;}getSelector(...t){return [this.meta.name,...t]}};var Os={...Ce,api:new Ss({name:"@hey-api/client-nuxt"}),config:je,handler:Ne,name:"@hey-api/client-nuxt"};var Ts=class{constructor(t){this.meta=t;}getSelector(...t){return [this.meta.name,...t]}};var Rs={...Ce,api:new Ts({name:"@hey-api/client-ofetch"}),config:{...je,throwOnError:false},handler:Ne,name:"@hey-api/client-ofetch"};var As={config:{},handler:()=>{},name:"legacy/angular",output:"client",tags:["client"]};var Ps={config:{},handler:()=>{},name:"legacy/axios",output:"client",tags:["client"]};var Es={config:{},handler:()=>{},name:"legacy/fetch",output:"client",tags:["client"]};var Is={config:{},handler:()=>{},name:"legacy/node",output:"client",tags:["client"]};var ks={config:{},handler:()=>{},name:"legacy/xhr",output:"client",tags:["client"]};var js=class{constructor(t){this.meta=t;}getSelector(...t){return [this.meta.name,...t]}};var ei=({plugin:e,schema:t})=>{e.config.type==="form"&&(t.description&&delete t.description,t["x-enum-descriptions"]&&delete t["x-enum-descriptions"],t["x-enum-varnames"]&&delete t["x-enum-varnames"],t["x-enumNames"]&&delete t["x-enumNames"],t.title&&delete t.title);},Cr=({context:e,plugin:t,schema:r})=>{if(Array.isArray(r))return r.map(o=>Cr({context:e,plugin:t,schema:o}));let n=structuredClone(r);if(n.$ref)return n.$ref=decodeURI(n.$ref),n;if(ei({plugin:t,schema:n}),n.additionalProperties&&typeof n.additionalProperties!="boolean"&&(n.additionalProperties=Cr({context:e,plugin:t,schema:n.additionalProperties})),n.allOf&&(n.allOf=n.allOf.map(o=>Cr({context:e,plugin:t,schema:o}))),n.items&&(n.items=Cr({context:e,plugin:t,schema:n.items})),n.properties)for(let o in n.properties){let i=n.properties[o];typeof i!="boolean"&&(n.properties[o]=Cr({context:e,plugin:t,schema:i}));}return n},Nt=({context:e,plugin:t,schema:r})=>{if(Array.isArray(r))return r.map(o=>Nt({context:e,plugin:t,schema:o}));let n=structuredClone(r);if("$ref"in n)return n.$ref=decodeURI(n.$ref),n;if(ei({plugin:t,schema:n}),n.additionalProperties&&typeof n.additionalProperties!="boolean"&&(n.additionalProperties=Nt({context:e,plugin:t,schema:n.additionalProperties})),n.allOf&&(n.allOf=n.allOf.map(o=>Nt({context:e,plugin:t,schema:o}))),n.anyOf&&(n.anyOf=n.anyOf.map(o=>Nt({context:e,plugin:t,schema:o}))),n.items&&(n.items=Nt({context:e,plugin:t,schema:n.items})),n.oneOf&&(n.oneOf=n.oneOf.map(o=>Nt({context:e,plugin:t,schema:o}))),n.properties)for(let o in n.properties){let i=n.properties[o];typeof i!="boolean"&&(n.properties[o]=Nt({context:e,plugin:t,schema:i}));}return n},xt=({context:e,plugin:t,schema:r})=>{if(Array.isArray(r))return r.map(o=>xt({context:e,plugin:t,schema:o}));let n=structuredClone(r);if(ei({plugin:t,schema:n}),n.$ref&&(n.$ref=decodeURI(n.$ref)),n.additionalProperties&&typeof n.additionalProperties!="boolean"&&(n.additionalProperties=xt({context:e,plugin:t,schema:n.additionalProperties})),n.allOf&&(n.allOf=n.allOf.map(o=>xt({context:e,plugin:t,schema:o}))),n.anyOf&&(n.anyOf=n.anyOf.map(o=>xt({context:e,plugin:t,schema:o}))),n.items&&(n.items=xt({context:e,plugin:t,schema:n.items})),n.oneOf&&(n.oneOf=n.oneOf.map(o=>xt({context:e,plugin:t,schema:o}))),n.prefixItems&&(n.prefixItems=n.prefixItems.map(o=>xt({context:e,plugin:t,schema:o}))),n.properties)for(let o in n.properties){let i=n.properties[o];typeof i!="boolean"&&(n.properties[o]=xt({context:e,plugin:t,schema:i}));}return n},ti=({name:e,plugin:t,schema:r})=>{let n="";return t.config.nameBuilder&&(typeof t.config.nameBuilder=="function"?n=t.config.nameBuilder(e,r):n=t.config.nameBuilder.replace("{{name}}",e)),n||(n=`${e}Schema`),Kt(n)},Jd=({context:e,plugin:t})=>{if(e.spec.definitions)for(let r in e.spec.definitions){let n=e.spec.definitions[r],o=t.registerSymbol({exported:true,name:ti({name:r,plugin:t,schema:n}),selector:t.api.getSelector("ref",r)}),i=Cr({context:e,plugin:t,schema:n}),a=s.constVariable({assertion:"const",exportConst:o.exported,expression:s.objectExpression({obj:i}),name:o.placeholder});t.setSymbolValue(o,a);}},Gd=({context:e,plugin:t})=>{if(e.spec.components)for(let r in e.spec.components.schemas){let n=e.spec.components.schemas[r],o=t.registerSymbol({exported:true,name:ti({name:r,plugin:t,schema:n}),selector:t.api.getSelector("ref",r)}),i=Nt({context:e,plugin:t,schema:n}),a=s.constVariable({assertion:"const",exportConst:o.exported,expression:s.objectExpression({obj:i}),name:o.placeholder});t.setSymbolValue(o,a);}},Yd=({context:e,plugin:t})=>{if(e.spec.components)for(let r in e.spec.components.schemas){let n=e.spec.components.schemas[r],o=t.registerSymbol({exported:true,name:ti({name:r,plugin:t,schema:n}),selector:t.api.getSelector("ref",r)}),i=xt({context:e,plugin:t,schema:n}),a=s.constVariable({assertion:"const",exportConst:o.exported,expression:s.objectExpression({obj:i}),name:o.placeholder});t.setSymbolValue(o,a);}},fc=({plugin:e})=>{if("swagger"in e.context.spec){Jd({context:e.context,plugin:e});return}if(Bt(e.context.spec.openapi,">=3.0.0 <3.1.0")){Gd({context:e.context,plugin:e});return}if(Bt(e.context.spec.openapi,">=3.1.0")){Yd({context:e.context,plugin:e});return}throw new Error("Unsupported OpenAPI specification")};var vt=class{_exportFromIndex;_headers=[];_id;_imports=new Map;_items=[];_name;_path;constructor({dir:t,exportFromIndex:r=false,header:n=true,id:o,name:i}){this._exportFromIndex=r,this._id=o,this._name=this._setName(i),this._path=L.resolve(t,this._name),n&&this._headers.push("// This file is auto-generated by @hey-api/openapi-ts");}add(...t){this._items=this._items.concat(t);}get exportFromIndex(){return this._exportFromIndex}get id(){return this._id}import({module:t,...r}){if(!r.name)return {name:void 0};let n=this._imports.get(t);n||(n=new Map,this._imports.set(t,n));let o=n.get(r.name);return o?{...o,name:o.alias||o.name}:(n.set(r.name,r),{...r,name:r.alias||r.name})}isEmpty(){return !this._items.length}nameWithoutExtension(){let{name:t}=uc(this._name);return t}remove(t){ye.rmSync(this._path,t);}removeNode_LEGACY(){this._items=this._items.slice(0,this._items.length-1);}_setName(t){if(t.includes("index"))return t;let{extension:r,name:n}=uc(t);return [n,"gen",r].filter(Boolean).join(".")}_toString(t,r){let n=[];this._headers.length&&n.push(this._headers.join(`
|
|
40
|
+
`));let o=r?.options.moduleResolution===S.ModuleResolutionKind.NodeNext,i=[];for(let[a,p]of this._imports.entries()){let c=Array.from(p.values()),m=a;o&&(m.startsWith("./")||m.startsWith("../"))&&(m==="./client"?m="./client/index.js":m=`${m}.js`);let l=s.namedImportDeclarations({imports:c,module:m});i.push(ce({node:l}));}return i.length&&n.push(i.join(`
|
|
41
|
+
`)),n=n.concat(this._items.map(a=>typeof a=="string"?a:ce({node:a,unescape:true}))),n.join(t)}write(t=`
|
|
42
|
+
`,r=null){if(this.isEmpty()){this.remove({force:true});return}let n=this._path;if(typeof this._path=="string"){let o=this._path.split(L.sep);n=o.slice(0,o.length-1).join(L.sep);}it(n),ye.writeFileSync(this._path,this._toString(t,r));}},uc=e=>{let t=e.match(/\.[0-9a-z]+$/i),r=t?t[0].slice(1):"",n=e.slice(0,e.length-(r?r.length+1:0));return {extension:r,name:n}};var ni=(e,t)=>{let r=A();if(Array.isArray(e))return e.map(o=>ni(o));if(typeof e!="object"||e===null)return e;let n={...e};return Object.entries(n).forEach(([o,i])=>{if(r.plugins["@hey-api/schemas"]?.config.type==="form"&&["description","x-enum-descriptions","x-enum-varnames","x-enumNames","title"].includes(o)&&t!=="properties"){delete n[o];return}o==="$ref"&&typeof i=="string"&&(n[o]=decodeURIComponent(i)),i&&typeof i=="object"&&(n[o]=ni(i,o));}),n},tu=(e,t)=>{let r=A(),n=we(e),o=r.plugins["@hey-api/schemas"];return o?.config.nameBuilder?typeof o.config.nameBuilder=="function"?o.config.nameBuilder(n,t):o.config.nameBuilder.replace("{{name}}",n):`${n}Schema`},yc=({files:e,openApi:t,plugin:r})=>{let n=A();e.schemas=new vt({dir:n.output.path,exportFromIndex:r.config.exportFromIndex,id:"schemas",name:"schemas.ts"});let o=(i,a)=>{let p=ni(a),c=s.objectExpression({obj:p}),m=s.constVariable({assertion:"const",exportConst:true,expression:c,name:tu(i,a)});e.schemas.add(m);};"swagger"in t&&Object.entries(t.definitions??{}).forEach(([i,a])=>{o(i,a);}),"openapi"in t&&Object.entries(t.components?.schemas??{}).forEach(([i,a])=>{o(i,a);});};var Cs={api:new js({name:"@hey-api/schemas"}),config:{exportFromIndex:false,nameBuilder:e=>`${e}Schema`,type:"json"},handler:fc,handlerLegacy:yc,name:"@hey-api/schemas"};var hc=({operation:e})=>{let t=[];if(e.summary&&t.push(z(e.summary)),e.description&&(t.length&&t.push(""),t.push(z(e.description))),e.deprecated&&(t.length&&t.push(""),t.push("@deprecated")),!!t.length)return t};var Ns=class{constructor(t){this.meta=t;}createOperationComment(...t){return hc(...t)}getSelector(...t){return [this.meta.name,...t]}};var Gt=({meta:e,onImport:t,...r})=>{if(!e)return {created:false,name:""};let{created:n,name:o}=ke({meta:e,...r});return o&&t(o),{created:n,name:o}},Oc=e=>`${e}ModelResponseTransformer`,Yt=e=>`${q({case:"PascalCase",value:e})}Data`,Nr=e=>`${q({case:"PascalCase",value:e})}Error`,si=e=>`${e}Transformer`,rt=e=>`${q({case:"PascalCase",value:e})}Response`,oi=({importedType:e,throwOnError:t})=>{let r="OptionsLegacyParser";return t?`${r}<${e||"unknown"}, ${t}>`:e?`${r}<${e}>`:r},gc=(e,t)=>{let r=A(),{name:n}=ke({client:e,meta:{$ref:t.name,name:t.name},nameTransformer:Yt}),o=Ge(t.parameters);if(!Q(r))return [{isRequired:o,name:"options",type:oi({importedType:n,throwOnError:"ThrowOnError"})}];if(!t.parameters.length)return [];let i=a=>{if(a.default!==void 0)return JSON.stringify(a.default,null,4)};return r.useOptions?[{default:o?void 0:{},name:"data",type:n}]:t.parameters.map(a=>{let p=`${n}['${a.name}']`;return {default:a?.default,isRequired:(!a.isRequired&&!i(a)?"?":"")=="",name:a.name,type:p}})},xc=(e,t)=>{let r=A(),n=s.typeNode("void");if(t.responses.filter(a=>a.responseTypes.includes("success")).length){let{name:a}=ke({client:e,meta:{$ref:t.name,name:t.name},nameTransformer:rt});n=s.typeUnionNode({types:[a]});}return r.useOptions&&r.plugins["@hey-api/sdk"]?.config.response==="response"&&(n=s.typeNode("ApiResult",[n])),k(r).name==="legacy/angular"?n=s.typeNode("Observable",[n]):n=s.typeNode("CancelablePromise",[n]),n},bc=e=>{let t=A();if(!Q(t))return [e.deprecated&&"@deprecated",e.summary&&z(e.summary),e.description&&z(e.description)];let r=[];e.parameters.length&&(t.useOptions?r=["@param data The data for the request.",...e.parameters.map(i=>`@param data.${i.name} ${i.description?z(i.description):""}`)]:r=e.parameters.map(i=>`@param ${i.name} ${i.description?z(i.description):""}`));let n=e.responses.filter(i=>i.responseTypes.includes("success"));return [e.deprecated&&"@deprecated",e.summary&&z(e.summary),e.description&&z(e.description),...r,...n.map(i=>`@returns ${i.type} ${i.description?z(i.description):""}`),"@throws ApiError"]},nu=({client:e,onClientImport:t,onImport:r,operation:n})=>{let o=A(),i=rt(n.name),{name:a}=ke({client:e,meta:{$ref:`transformers/${i}`,name:i},nameTransformer:si});if(a&&r(a),!Q(o)){let l=[{spread:"options"}],d=n.parameters.filter(u=>u.in==="body"||u.in==="formData").map(u=>u.mediaType||(u.in==="formData"?"multipart/form-data":void 0)).filter(Boolean).filter(Xe);return d.length===1&&(d[0]==="multipart/form-data"&&(l=[...l,{spread:"formDataBodySerializer"},{key:"headers",value:[{key:"Content-Type",value:null},{spread:"options?.headers"}]}],t?.("formDataBodySerializer")),d[0]==="application/x-www-form-urlencoded"&&(l=[...l,{spread:"urlSearchParamsBodySerializer"},{key:"headers",value:[{key:"Content-Type",value:d[0]},{spread:"options?.headers"}]}],t?.("urlSearchParamsBodySerializer"))),l=[...l,{key:"url",value:n.path}],a&&(l=[...l,{key:"responseTransformer",value:a}]),s.objectExpression({identifiers:["responseTransformer"],obj:l})}let p=l=>l.reduce((f,d)=>{let u=d.prop,y=o.useOptions?`data.${d.name}`:d.name;return u===y?f[u]=u:Te(u)===u?f[u]=y:f[`'${u}'`]=y,f},{}),c={method:n.method,url:n.path};n.parametersPath.length&&(c.path=p(n.parametersPath)),n.parametersCookie.length&&(c.cookies=p(n.parametersCookie)),n.parametersHeader.length&&(c.headers=p(n.parametersHeader)),n.parametersQuery.length&&(c.query=p(n.parametersQuery)),n.parametersForm.length&&(c.formData=p(n.parametersForm)),n.parametersBody&&(n.parametersBody.in==="formData"&&(o.useOptions?c.formData=`data.${n.parametersBody.name}`:c.formData=n.parametersBody.name),n.parametersBody.in==="body"&&(o.useOptions?c.body=`data.${n.parametersBody.name}`:c.body=n.parametersBody.name)),n.parametersBody?.mediaType&&(c.mediaType=n.parametersBody?.mediaType),n.responseHeader&&(c.responseHeader=n.responseHeader),a&&(c.responseTransformer=a);let m=n.responses.filter(l=>l.responseTypes.includes("error"));if(m.length>0){let l={};m.forEach(f=>{l[f.code]=f.description??"";}),c.errors=l;}return s.objectExpression({identifiers:["body","cookies","formData","headers","path","query","responseTransformer"],obj:c,shorthand:true})},tt=({config:e,handleIllegal:t,id:r,operation:n})=>e.plugins["@hey-api/sdk"]?.config.methodNameBuilder?e.plugins["@hey-api/sdk"].config.methodNameBuilder(n):t&&r.match(le)?`${r}_`:r,Sc=({client:e,onClientImport:t,onImport:r,operation:n})=>{let o=A(),i=nu({client:e,onClientImport:t,onImport:r,operation:n});if(!Q(o)){let p=ke({client:e,meta:{$ref:n.name,name:n.name},nameTransformer:Nr}).name,m=n.responses.filter(l=>l.responseTypes.includes("success")).length?ke({client:e,meta:{$ref:n.name,name:n.name},nameTransformer:rt}).name:"void";return [s.returnFunctionCall({args:[i],name:`(options?.client ?? client).${n.method.toLocaleLowerCase()}`,types:p&&m?[m,p,"ThrowOnError"]:p?["unknown",p,"ThrowOnError"]:m?[m,"unknown","ThrowOnError"]:[]})]}return $t(o)?[s.returnFunctionCall({args:[i],name:"this.httpRequest.request"})]:k(o).name==="legacy/angular"?[s.returnFunctionCall({args:["OpenAPI","this.http",i],name:"__request"})]:[s.returnFunctionCall({args:["OpenAPI",i],name:"__request"})]},su=({client:e,onClientImport:t,onImport:r,onNode:n,service:o})=>{let i=A(),a=k(i),p=Q(i);for(let d of o.operations)d.parameters.length&&Gt({client:e,meta:{$ref:d.name,name:d.name},nameTransformer:Yt,onImport:r}),p||Gt({client:e,meta:{$ref:d.name,name:d.name},nameTransformer:Nr,onImport:r}),d.responses.filter(y=>y.responseTypes.includes("success")).length&&Gt({client:e,meta:{$ref:d.name,name:d.name},nameTransformer:rt,onImport:r});let c={default:("throwOnError"in a.config?a.config.throwOnError:false)??false,extends:"boolean",name:"ThrowOnError"};if(!i.plugins["@hey-api/sdk"]?.config.asClass&&!$t(i)){for(let d of o.operations){let u={parameters:gc(e,d),returnType:p?xc(e,d):void 0,statements:Sc({client:e,onClientImport:t,onImport:r,operation:d}),types:p?void 0:[c]},y=a.name==="legacy/angular"?s.anonymousFunction(u):s.arrowFunction(u),g=s.constVariable({comment:bc(d),exportConst:true,expression:y,name:tt({config:i,handleIllegal:true,id:d.name,operation:d})});n(g);}return}let m=o.operations.map(d=>s.methodDeclaration({accessLevel:"public",comment:bc(d),isStatic:$t(i)===void 0&&a.name!=="legacy/angular",name:tt({config:i,id:d.name,operation:d}),parameters:gc(e,d),returnType:p?xc(e,d):void 0,statements:Sc({client:e,onClientImport:t,onImport:r,operation:d}),types:p?void 0:[c]}));if(!m.length)return;$t(i)?m=[s.constructorDeclaration({multiLine:false,parameters:[{accessLevel:"public",isReadOnly:true,name:"httpRequest",type:"BaseHttpRequest"}]}),...m]:a.name==="legacy/angular"&&(m=[s.constructorDeclaration({multiLine:false,parameters:[{accessLevel:"public",isReadOnly:true,name:"http",type:"HttpClient"}]}),...m]);let l=[];m.forEach((d,u)=>{u&&l.push(s.identifier({text:`
|
|
43
|
+
`})),l.push(d);});let f=s.classDeclaration({decorator:a.name==="legacy/angular"?{args:[{providedIn:"root"}],name:"Injectable"}:void 0,exportClass:true,name:Ar({config:i,name:o.name}),nodes:l});n(f);},Tc=({client:e,files:t,plugin:r})=>{let n=A(),o=Q(n),i="sdk";if(t.sdk=new vt({dir:n.output.path,exportFromIndex:r.config.exportFromIndex,id:"sdk",name:`${i}.ts`}),!o)t.sdk.import({module:Jt({config:n,sourceOutput:i}),name:"createClient"}),t.sdk.import({module:Jt({config:n,sourceOutput:i}),name:"createConfig"}),t.sdk.import({asType:true,module:Jt({config:n,sourceOutput:i}),name:"OptionsLegacyParser"});else if(k(n).name==="legacy/angular"?(t.sdk.import({module:"@angular/core",name:"Injectable"}),$t(n)||t.sdk.import({module:"@angular/common/http",name:"HttpClient"}),t.sdk.import({asType:true,module:"rxjs",name:"Observable"})):t.sdk.import({asType:true,module:"./core/CancelablePromise",name:"CancelablePromise"}),n.plugins["@hey-api/sdk"]?.config.response==="response"&&t.sdk.import({asType:true,module:"./core/ApiResult",name:"ApiResult"}),$t(n)){let p=k(n);t.sdk.import({asType:p.name!=="legacy/angular",module:"./core/BaseHttpRequest",name:"BaseHttpRequest"});}else t.sdk.import({module:"./core/OpenAPI",name:"OpenAPI"}),t.sdk.import({alias:"__request",module:"./core/request",name:"request"});if(!o){let a=k(n),p=s.constVariable({exportConst:true,expression:s.callExpression({functionName:"createClient",parameters:[s.callExpression({functionName:"createConfig",parameters:["throwOnError"in a&&a.throwOnError?s.objectExpression({obj:[{key:"throwOnError",value:true}]}):void 0]})]}),name:"client"});t.sdk.add(p);}for(let a of e.services)su({client:e,onClientImport:p=>{t.sdk.import({module:Jt({config:n,sourceOutput:i}),name:p});},onImport:p=>{t.sdk.import({asType:!p.endsWith("Transformer"),module:`./${t.types.nameWithoutExtension()}`,name:p});},onNode:p=>{t.sdk.add(p);},service:a});};var Rc=({plugin:e})=>{let t=Ye(e.context.config),n=k(e.context.config).name==="@hey-api/client-nuxt",o=e.registerSymbol({external:t,meta:{kind:"type"},name:"TDataShape"}),i=e.registerSymbol({external:t,meta:{kind:"type"},name:"Client",selector:e.api.getSelector("Client")}),a=e.registerSymbol({external:t,meta:{kind:"type"},name:"Options"}),p=e.registerSymbol({exported:true,meta:{kind:"type"},name:"Options",selector:e.api.getSelector("Options")}),c=s.typeAliasDeclaration({exportType:p.exported,name:p.placeholder,type:s.typeIntersectionNode({types:[s.typeReferenceNode({typeArguments:n?[s.typeReferenceNode({typeName:"TComposable"}),s.typeReferenceNode({typeName:"TData"}),s.typeReferenceNode({typeName:Jo}),s.typeReferenceNode({typeName:et})]:[s.typeReferenceNode({typeName:"TData"}),s.typeReferenceNode({typeName:"ThrowOnError"})],typeName:a.placeholder}),s.typeInterfaceNode({properties:[{comment:["You can provide a client instance returned by `createClient()` instead of","individual options. This might be also useful if you want to implement a","custom client."],isRequired:!e.config.client,name:"client",type:s.typeReferenceNode({typeName:i.placeholder})},{comment:["You can pass arbitrary values through the `meta` object. This can be","used to access values that aren't defined as part of the SDK function."],isRequired:false,name:"meta",type:s.typeReferenceNode({typeArguments:[s.keywordTypeNode({keyword:"string"}),s.keywordTypeNode({keyword:"unknown"})],typeName:"Record"})}],useLegacyResolution:false})]}),typeParameters:n?[s.typeParameterDeclaration({constraint:s.typeReferenceNode({typeName:e.referenceSymbol(e.api.getSelector("Composable")).placeholder}),defaultType:s.typeNode("'$fetch'"),name:"TComposable"}),s.typeParameterDeclaration({constraint:s.typeReferenceNode({typeName:o.placeholder}),defaultType:s.typeReferenceNode({typeName:o.placeholder}),name:"TData"}),s.typeParameterDeclaration({defaultType:s.keywordTypeNode({keyword:"unknown"}),name:Jo}),s.typeParameterDeclaration({defaultType:s.keywordTypeNode({keyword:"undefined"}),name:et})]:[s.typeParameterDeclaration({constraint:s.typeReferenceNode({typeName:o.placeholder}),defaultType:s.typeReferenceNode({typeName:o.placeholder}),name:"TData"}),s.typeParameterDeclaration({constraint:s.keywordTypeNode({keyword:"boolean"}),defaultType:s.keywordTypeNode({keyword:"boolean"}),name:"ThrowOnError"})]});e.setSymbolValue(p,c);};var ou=({plugin:e})=>{let t=s.expressionToStatement({expression:s.binaryExpression({left:s.propertyAccessExpression({expression:s.this(),name:"_client"}),operator:"=",right:s.propertyAccessExpression({expression:s.identifier({text:"args"}),name:"client"})})}),r=e.referenceSymbol(e.api.getSelector("Client")),n=k(e.context.config),o=n.api&&"getSelector"in n.api?e.getSymbol(n.api.getSelector("client")):void 0;return [s.propertyDeclaration({initializer:o?s.identifier({text:o.placeholder}):void 0,modifier:"protected",name:"_client",type:s.typeReferenceNode({typeName:r.placeholder})}),s.identifier({text:`
|
|
44
|
+
`}),s.constructorDeclaration({multiLine:true,parameters:[{isRequired:!e.config.client,name:"args",type:s.typeInterfaceNode({properties:[{isRequired:!e.config.client,name:"client",type:r.placeholder}],useLegacyResolution:false})}],statements:[e.config.client?s.ifStatement({expression:s.propertyAccessExpression({expression:s.identifier({text:"args"}),isOptional:true,name:"client"}),thenStatement:s.block({statements:[t]})}):t]})]},iu=({plugin:e})=>{let t=k(e.context.config),r=t.name==="@hey-api/client-angular",n=t.name==="@hey-api/client-nuxt",o=new Map,i=new Set,a=e.config.instance?ou({plugin:e}):[];e.forEach("operation",({operation:m})=>{let l=ne({context:e.context,operation:m}),f=e.getPluginOrThrow("@hey-api/typescript"),d=n?e.getSymbol(f.api.getSelector("response",m.id)):void 0,u=qe({context:e.context,operation:m,plugin:e});for(let y of u.values())y.path.forEach((g,x)=>{let b=e.referenceSymbol(e.api.getSelector("class",g));o.has(b.id)||o.set(b.id,{className:g,classes:new Set,id:b.id,methods:new Set,nodes:[],root:!x});let I=y.path[x-1];if(I){let v=e.referenceSymbol(e.api.getSelector("class",I));if(v.placeholder!==b.placeholder){let M=o.get(v.id);M.classes.add(b.id),o.set(v.id,M);}}if(!(y.path.length===x+1))return;let j=o.get(b.id);if(j.methods.has(y.methodName))return;let C=Go({isRequiredOptions:l,operation:m,plugin:e}),D=Yo({isRequiredOptions:l,opParameters:C,operation:m,plugin:e}),K=s.methodDeclaration({accessLevel:"public",comment:e.api.createOperationComment({operation:m}),isStatic:r?false:!e.config.instance,name:y.methodName,parameters:C.parameters,returnType:void 0,statements:D,types:n?[{default:s.ots.string("$fetch"),extends:s.typeNode(e.referenceSymbol(e.api.getSelector("Composable")).placeholder),name:kr},{default:d?s.typeReferenceNode({typeName:d.placeholder}):s.typeNode("undefined"),extends:d?s.typeReferenceNode({typeName:d.placeholder}):void 0,name:et}]:[{default:("throwOnError"in t.config?t.config.throwOnError:false)??false,extends:"boolean",name:"ThrowOnError"}]});j.nodes.length?j.nodes.push(s.identifier({text:`
|
|
45
|
+
`}),K):j.nodes.push(K),j.methods.add(y.methodName),o.set(b.id,j);});});let p=e.registerSymbol({exported:false,name:"_HeyApiClient"}),c=m=>{if(i.has(m.id))return;if(m.classes.size)for(let d of m.classes){let u=o.get(d);c(u),m.nodes.push(s.propertyDeclaration({initializer:e.config.instance?s.newExpression({argumentsArray:e.config.instance?[s.objectExpression({multiLine:false,obj:[{key:"client",value:s.propertyAccessExpression({expression:s.this(),name:"_client"})}]})]:[],expression:s.identifier({text:e.referenceSymbol(u.id).placeholder})}):s.identifier({text:e.referenceSymbol(u.id).placeholder}),modifier:e.config.instance?void 0:"static",name:q({case:"camelCase",value:u.className})}));}let l=e.registerSymbol({exported:true,name:m.className,selector:e.api.getSelector("class",m.className)}),f=s.classDeclaration({decorator:m.root&&r?{args:[{providedIn:"root"}],name:e.referenceSymbol(e.api.getSelector("Injectable")).placeholder}:void 0,exportClass:l.exported,extendedClasses:e.config.instance?[p.placeholder]:void 0,name:l.placeholder,nodes:m.nodes});e.setSymbolValue(l,f),i.add(l.id);};if(a.length){let m=s.classDeclaration({exportClass:p.exported,name:p.placeholder,nodes:a});e.setSymbolValue(p,m);}for(let m of o.values())c(m);},au=({plugin:e})=>{let t=k(e.context.config),r=t.name==="@hey-api/client-nuxt";e.forEach("operation",({operation:n})=>{let o=ne({context:e.context,operation:n}),i=e.getPluginOrThrow("@hey-api/typescript"),a=r?e.getSymbol(i.api.getSelector("response",n.id)):void 0,p=Go({isRequiredOptions:o,operation:n,plugin:e}),c=Yo({isRequiredOptions:o,opParameters:p,operation:n,plugin:e}),m=e.registerSymbol({name:tt({config:e.context.config,handleIllegal:true,id:n.id,operation:n}),selector:e.api.getSelector("function",n.id)}),l=s.constVariable({comment:e.api.createOperationComment({operation:n}),exportConst:true,expression:s.arrowFunction({parameters:p.parameters,returnType:void 0,statements:c,types:r?[{default:s.ots.string("$fetch"),extends:s.typeNode(e.referenceSymbol(e.api.getSelector("Composable")).placeholder),name:kr},{default:a?s.typeReferenceNode({typeName:a.placeholder}):s.typeNode("undefined"),extends:a?s.typeReferenceNode({typeName:a.placeholder}):void 0,name:et}]:[{default:("throwOnError"in t.config?t.config.throwOnError:false)??false,extends:"boolean",name:"ThrowOnError"}]}),name:m.placeholder});e.setSymbolValue(m,l);});},Ac=({plugin:e})=>{let t=Ye(e.context.config);e.registerSymbol({external:t,name:"formDataBodySerializer",selector:e.api.getSelector("formDataBodySerializer")}),e.registerSymbol({external:t,name:"urlSearchParamsBodySerializer",selector:e.api.getSelector("urlSearchParamsBodySerializer")}),e.registerSymbol({external:t,name:"buildClientParams",selector:e.api.getSelector("buildClientParams")});let r=k(e.context.config),n=r.name==="@hey-api/client-angular";r.name==="@hey-api/client-nuxt"&&e.registerSymbol({external:t,meta:{kind:"type"},name:"Composable",selector:e.api.getSelector("Composable")}),n&&e.config.asClass&&e.registerSymbol({external:"@angular/core",name:"Injectable",selector:e.api.getSelector("Injectable")}),Rc({plugin:e}),e.config.asClass?iu({plugin:e}):au({plugin:e});};var vs={api:new Ns({name:"@hey-api/sdk"}),config:{asClass:false,auth:true,classNameBuilder:"{{name}}",classStructure:"auto",client:true,exportFromIndex:true,instance:false,operationId:true,params_EXPERIMENTAL:"default",response:"body",responseStyle:"fields",transformer:false,validator:false},dependencies:["@hey-api/typescript"],handler:Ac,handlerLegacy:Tc,name:"@hey-api/sdk",resolveConfig:(e,t)=>{e.config.client?(typeof e.config.client=="boolean"&&(e.config.client=t.pluginByTag("client",{defaultPlugin:"@hey-api/client-fetch"})),e.dependencies.add(e.config.client)):e.config.client=false,e.config.transformer?(typeof e.config.transformer=="boolean"&&(e.config.transformer=t.pluginByTag("transformer")),e.dependencies.add(e.config.transformer)):e.config.transformer=false,typeof e.config.validator!="object"&&(e.config.validator={request:e.config.validator,response:e.config.validator}),e.config.validator.request?(typeof e.config.validator.request=="boolean"&&(e.config.validator.request=t.pluginByTag("validator")),e.dependencies.add(e.config.validator.request)):e.config.validator.request=false,e.config.validator.response?(typeof e.config.validator.response=="boolean"&&(e.config.validator.response=t.pluginByTag("validator")),e.dependencies.add(e.config.validator.response)):e.config.validator.response=false,e.config.instance?(typeof e.config.instance!="string"&&(e.config.instance="Sdk"),e.config.asClass=true):e.config.instance=false,e.config.classNameBuilder==="{{name}}"&&e.config.client==="@hey-api/client-angular"&&(e.config.classNameBuilder="{{name}}Service");}};var ws=class{constructor(t){this.meta=t;}getSelector(...t){return [this.meta.name,...t]}};var Pc=({dataExpression:e,schema:t})=>{if(t.type!=="integer"||t.format!=="int64")return;let r=e!==void 0?s.callExpression({functionName:"BigInt",parameters:[s.callExpression({functionName:s.propertyAccessExpression({expression:e,name:"toString"})})]}):void 0;if(r){if(typeof e=="string")return [r];if(e)return [s.assignment({left:e,right:r})]}},Ec=({dataExpression:e,schema:t})=>{if(t.type!=="string"||!(t.format==="date"||t.format==="date-time"))return;let r=s.identifier({text:"Date"});if(typeof e=="string")return [s.newExpression({argumentsArray:[s.identifier({text:e})],expression:r})];if(e)return [s.assignment({left:e,right:s.newExpression({argumentsArray:[e],expression:r})})]};var qs="data",nn=e=>e.map(t=>S.isStatement(t)?t:s.expressionToStatement({expression:t})),kc=({node:e})=>e.kind===S.SyntaxKind.ReturnStatement,jc=({plugin:e,schema:t})=>{let r=s.identifier({text:qs}),n=sn({dataExpression:r,plugin:e,schema:t});return n.length&&!kc({node:n[n.length-1]})&&n.push(s.returnStatement({expression:r})),n},sn=({dataExpression:e,plugin:t,schema:r})=>{if(r.$ref){let n=t.api.getSelector("response-ref",r.$ref);if(!t.getSymbol(n)){let i=t.registerSymbol({name:O({config:{case:"camelCase",name:"{{name}}SchemaResponseTransformer"},name:F(r.$ref)}),selector:n}),a=t.context.resolveIrRef(r.$ref),p=jc({plugin:t,schema:a});if(p.length){let c=s.constVariable({expression:s.arrowFunction({async:false,multiLine:true,parameters:[{name:qs,type:s.keywordTypeNode({keyword:"any"})}],statements:nn(p)}),name:i.placeholder});t.setSymbolValue(i,c);}else t.setSymbolValue(i,null);}let o=t.referenceSymbol(n);if(t.getSymbolValue(o)!==null){let i=s.callExpression({functionName:o.placeholder,parameters:[e]});if(e)return typeof e=="string"&&e==="item"?[s.returnStatement({expression:i})]:[typeof e=="string"?i:s.assignment({left:e,right:i})]}return []}if(r.type==="array"){if(!e||typeof e=="string")return [];let n=r.items?sn({dataExpression:"item",plugin:t,schema:r.items?.[0]?r.items[0]:{...r,type:void 0}}):[];if(!n.length)return [];let o=nn(n);return o.some(a=>kc({node:a}))||o.push(s.returnStatement({expression:s.identifier({text:"item"})})),[s.assignment({left:e,right:s.callExpression({functionName:s.propertyAccessExpression({expression:e,name:"map"}),parameters:[s.arrowFunction({multiLine:true,parameters:[{name:"item",type:"any"}],statements:o})]})})]}if(r.type==="object"){let n=[],o=r.required??[];for(let i in r.properties){let a=r.properties[i],p=s.propertyAccessExpression({expression:e||qs,name:i}),c=sn({dataExpression:p,plugin:t,schema:a});if(!c.length)continue;let m=!a.items?.find(f=>f.type==="null");o.includes(i)&&m?n=n.concat(c):n.push(s.ifStatement({expression:p,thenStatement:s.block({statements:nn(c)})}));}return n}if(r.items){if(r.items.length===1)return sn({dataExpression:"item",plugin:t,schema:r.items[0]});let n=[];if(r.logicalOperator==="and"||r.items.length===2&&r.items.find(o=>o.type==="null"||o.type==="void")){for(let o of r.items){let i=sn({dataExpression:e||"item",plugin:t,schema:o});if(i.length)if(e)n=n.concat(i);else {let a=s.identifier({text:"item"});n.push(s.ifStatement({expression:a,thenStatement:s.block({statements:nn(i)})}),s.returnStatement({expression:a}));}}return n}r.type!=="enum"&&((r.items??[]).every(o=>["boolean","integer","null","number","string"].includes(o.type))||console.warn(`\u2757\uFE0F Transformers warning: schema ${JSON.stringify(r)} is too complex and won't be currently processed. This will likely produce an incomplete transformer which is not what you want. Please open an issue if you'd like this improved https://github.com/hey-api/openapi-ts/issues`));}for(let n of t.config.transformers){let o=n({config:t.config,dataExpression:e,schema:r});if(o)return o}return []},Cc=({plugin:e})=>{e.forEach("operation",({operation:t})=>{let{response:r}=We(t);if(!r)return;if(r.items&&r.items.length>1){e.context.config.logs.level==="debug"&&console.warn(`\u2757\uFE0F Transformers warning: route ${V(t)} has ${r.items.length} non-void success responses. This is currently not handled and we will not generate a response transformer. Please open an issue if you'd like this feature https://github.com/hey-api/openapi-ts/issues`);return}let n=e.getPluginOrThrow("@hey-api/typescript"),o=e.getSymbol(n.api.getSelector("response",t.id));if(!o)return;let i=e.registerSymbol({exported:true,name:O({config:{case:"camelCase",name:"{{name}}ResponseTransformer"},name:t.id}),selector:e.api.getSelector("response",t.id)}),a=jc({plugin:e,schema:r});if(a.length){let p=s.constVariable({exportConst:i.exported,expression:s.arrowFunction({async:true,multiLine:true,parameters:[{name:qs,type:s.keywordTypeNode({keyword:"any"})}],returnType:s.typeReferenceNode({typeArguments:[s.typeReferenceNode({typeName:o.placeholder})],typeName:"Promise"}),statements:nn(a)}),name:i.placeholder});e.setSymbolValue(i,p);}else e.setSymbolValue(i,null);});};var cu="$OpenApiTs",pe={$refs:[],base:"",description:null,enum:[],enums:[],export:"interface",imports:[],in:"",isDefinition:false,isNullable:false,isReadOnly:false,isRequired:false,link:null,name:"",properties:[],template:null,type:""},mu=({comments:e,leadingComment:t,meta:r,obj:n,onNode:o,...i})=>{if(!r)return;let{created:a,name:p}=ke({create:true,meta:r,...i});if(a){let m=A().plugins["@hey-api/typescript"],l=s.enumDeclaration({asConst:typeof m?.config.enums=="object"&&m.config.enums.mode==="typescript-const",comments:e,leadingComment:t,name:p,obj:n});o(l);}},bt=({comment:e,meta:t,onCreated:r,onNode:n,type:o,...i})=>{if(!t)return {created:false,name:""};let a=ke({create:true,meta:t,...i}),{created:p,name:c}=a;if(p){let m=s.typeAliasDeclaration({comment:e,exportType:true,name:c,type:o});n(m),r?.(c);}return a},lu=e=>{let t=[];Nc(e),e.model.enums.forEach(r=>du({...e,model:r,onNode:n=>{t.push(n);}})),t.length&&e.onNode(s.namespaceDeclaration({name:e.model.name,statements:t}));},fu=({client:e,model:t,onNode:r})=>{let n=A(),o={},i={};t.enum.forEach(c=>{let{key:m,value:l}=_n(c);o[m]=l;let f=c.customDescription||c.description;f&&(i[m]=[z(f)]);});let a=[t.description&&z(t.description),t.deprecated&&"@deprecated"],p=n.plugins["@hey-api/typescript"];if(p?.config&&typeof p.config.enums=="object"&&p.config.enums.enabled&&(p.config.enums.mode==="typescript"||p.config.enums.mode==="typescript-const")){mu({asConst:p.config.enums.mode==="typescript-const",client:e,comments:i,leadingComment:a,meta:t.meta,obj:o,onNode:r});return}bt({client:e,comment:a,meta:t.meta,onCreated:c=>{let m=n.plugins["@hey-api/typescript"];if(m?.config&&typeof m.config.enums=="object"&&m.config.enums.enabled&&m.config.enums.mode==="javascript"){let l=s.objectExpression({multiLine:true,obj:Object.entries(o).map(([d,u])=>({comments:i[d],key:d,value:u})),unescape:true}),f=s.constVariable({assertion:"const",comment:a,exportConst:true,expression:l,name:c});r(f);}},onNode:r,type:Ip(t.enum)});},du=({model:e,onNode:t})=>{let r={},n={};e.enum.forEach(a=>{let{key:p,value:c}=_n(a);r[p]=c;let m=a.customDescription||a.description;m&&(n[p]=[z(m)]);});let i=A().plugins["@hey-api/typescript"];t(s.enumDeclaration({asConst:typeof i?.config.enums=="object"&&i.config.enums.mode==="typescript-const",comments:n,leadingComment:[e.description&&z(e.description),e.deprecated&&"@deprecated"],name:e.meta?.name||e.name,obj:r}));},Nc=({client:e,model:t,onNode:r})=>{bt({client:e,comment:[t.description&&z(t.description),t.deprecated&&"@deprecated"],meta:t.meta,onNode:r,type:Ie(t)});},uu=e=>{switch(e.model.export){case "all-of":case "any-of":case "one-of":case "interface":return lu(e);case "enum":return fu(e);default:return Nc(e)}},yu=({client:e,onNode:t})=>{let r={},n=A();if(!n.plugins["@hey-api/sdk"]&&!n.plugins["@hey-api/typescript"]?.config.tree)return;let o=Q(n);for(let a of e.services)for(let p of a.operations){if(!p.parameters.length&&!p.responses.length)continue;r[p.path]||(r[p.path]={});let c=r[p.path];c[p.method]||(c[p.method]={});let m=c[p.method];if(m.$ref=p.name,p.responses.length>0){if(m.res||(m.res={}),Array.isArray(m.res))continue;p.responses.forEach(f=>{m.res[f.code]=f;});}if(p.parameters.length>0){let f={mediaType:null,...pe,in:"body",name:"body",prop:"body"},d=p.parameters.filter(b=>b.in==="body");d.length||(d=p.parameters.filter(b=>b.in==="formData")),d.length===1?f={...pe,...d[0],in:"body",isRequired:d[0].isRequired,name:"body",prop:"body"}:d.length>1&&(f={...pe,in:"body",isRequired:d.some(b=>b.isRequired),mediaType:"multipart/form-data",name:"body",prop:"body",properties:d});let u={...pe,in:"header",isRequired:Ge(p.parameters.filter(b=>b.in==="header")),mediaType:null,name:o?"header":"headers",prop:o?"header":"headers",properties:p.parameters.filter(b=>b.in==="header").sort(en)},y={...pe,in:"path",isRequired:Ge(p.parameters.filter(b=>b.in==="path")),mediaType:null,name:"path",prop:"path",properties:p.parameters.filter(b=>b.in==="path").sort(en)},g={...pe,in:"query",isRequired:Ge(p.parameters.filter(b=>b.in==="query")),mediaType:null,name:"query",prop:"query",properties:p.parameters.filter(b=>b.in==="query").sort(en)},x=o?Ep([...p.parameters]):[f,u,y,g].filter(b=>b.properties.length||b.$refs.length||b.mediaType);m.req=x,bt({client:e,meta:{$ref:p.name,name:p.name},nameTransformer:Yt,onNode:t,type:Ie({...pe,properties:x})});}let l=p.responses.filter(f=>f.responseTypes.includes("success"));if(l.length>0){bt({client:e,meta:{$ref:p.name,name:p.name},nameTransformer:rt,onNode:t,type:Ie({...pe,export:"any-of",properties:l})});let f=p.responses.filter(d=>d.responseTypes.includes("error"));o||bt({client:e,meta:{$ref:p.name,name:p.name},nameTransformer:Nr,onNode:t,type:Ie(f.length?{...pe,export:"one-of",properties:f}:{...pe,base:"unknown"})});}}let i=Object.entries(r).map(([a,p])=>{let c=Object.entries(p).map(([l,f])=>{let d=l,u=[];if(f.req){let g=f.$ref,{name:x}=ke({client:e,meta:{$ref:g,name:g},nameTransformer:Yt}),b={...pe,base:x,export:"reference",isRequired:true,name:"req",properties:[],type:x};u=[...u,b];}if(f.res){let g=Object.entries(f.res).map(([b,I])=>({...pe,...I,isRequired:true,name:String(b)})),x={...pe,isRequired:true,name:"res",properties:g};u=[...u,x];}return {...pe,isRequired:true,name:d.toLocaleLowerCase(),properties:u}}).filter(Boolean);return {...pe,isRequired:true,name:`'${a}'`,properties:c}});n.plugins["@hey-api/typescript"]?.config.tree&&bt({client:e,meta:{$ref:"@hey-api/openapi-ts",name:cu},onNode:t,type:Ie({...pe,properties:i})});},vc=({client:e,files:t,plugin:r})=>{let n=A();t.types=new vt({dir:n.output.path,exportFromIndex:r.config.exportFromIndex,id:"types",name:"types.ts"});let o=i=>{t.types?.add(i);};for(let i of e.models)uu({client:e,model:i,onNode:o});yu({client:e,onNode:o});};var wt="data",hu=e=>e.base==="unknown"&&e.export==="generic"&&e.type==="unknown",wc=({client:e,model:t})=>t.$refs.map(n=>{let o=e.models.find(i=>i.meta?.$ref===n);if(!o)throw new Error(`Ref ${n} could not be found. Transformers cannot be generated without having access to all refs.`);return o}),qc=e=>{let t=e.model.meta.name,{name:r}=bt({...e,meta:{$ref:`transformers/${t}`,name:t},nameTransformer:Oc,onCreated:o=>{let i=$s({...e,meta:{$ref:`transformers/${t}`,name:o},path:[wt]});$c({...e,async:false,name:o,statements:i});},type:`(${wt}: any) => ${t}`});return {created:!!e.client.types[r],name:r}},gu=e=>{let{model:t}=e,r=wc(e);if(r.length===1){let{created:n,name:o}=qc({...e,model:r[0]});return n?[s.transformArrayMutation({path:e.path,transformerName:o})]:[]}return tn(t)||t.link&&!Array.isArray(t.link)&&t.link.export==="any-of"&&t.link.properties.find(n=>tn(n))?[s.transformArrayMap({path:e.path,transformExpression:s.conditionalExpression({condition:s.identifier({text:"item"}),whenFalse:s.identifier({text:"item"}),whenTrue:s.transformNewDate({parameterName:"item"})})})]:[]},xu=e=>{let{model:t}=e,r=[...e.path,t.name];return t.type==="string"&&t.export!=="array"&&tn(t)?[s.transformDateMutation({path:r})]:$s({...e,model:t,path:r})},$s=e=>{let{model:t}=e;switch(t.export){case "array":return gu(e);case "interface":return t.properties.flatMap(r=>xu({...e,model:r}));case "reference":{if(t.$refs.length!==1)return [];let r=wc(e),{created:n,name:o}=qc({...e,model:r[0]});return n?t.in==="response"?[s.expressionToStatement({expression:s.callExpression({functionName:o,parameters:[wt]})})]:s.transformFunctionMutation({path:e.path,transformerName:o}):[]}default:return []}},$c=({async:e,client:t,name:r,onNode:n,onRemoveNode:o,statements:i})=>{let a={created:false,name:r};if(!i.length)return Cp({client:t,name:r}),o?.(),a;let p=s.arrowFunction({async:e,multiLine:true,parameters:[{name:wt}],statements:[...i,s.returnVariable({expression:wt})]}),c=s.constVariable({exportConst:true,expression:p,name:r,typeName:r});return n(c),{created:true,name:r}},Mc=({client:e,files:t})=>{let r=A(),n=i=>{t.types?.add(i);},o=()=>{t.types?.removeNode_LEGACY();};for(let i of e.services)for(let a of i.operations){let p=a.responses.filter(l=>l.responseTypes.includes("success"));if(!p.length)continue;let c=p.filter(l=>!hu(l));if(!c.length)continue;if(c.length>1){r.logs.level==="debug"&&console.warn(`\u2757\uFE0F Transformers warning: route ${V(a)} has ${c.length} non-void success responses. This is currently not handled and we will not generate a response transformer. Please open an issue if you'd like this feature https://github.com/hey-api/openapi-ts/issues`);continue}let m=rt(a.name);bt({client:e,meta:{$ref:`transformers/${m}`,name:m},nameTransformer:si,onCreated:l=>{let f=p.length>1?p.flatMap(d=>{let u=$s({client:e,meta:{$ref:`transformers/${m}`,name:m},model:d,onNode:n,onRemoveNode:o,path:[wt]});return u.length?[s.ifStatement({expression:s.safeAccessExpression(["data"]),thenStatement:s.block({statements:u})})]:[]}):$s({client:e,meta:{$ref:`transformers/${m}`,name:m},model:p[0],onNode:n,onRemoveNode:o,path:[wt]});$c({async:true,client:e,name:l,onNode:n,onRemoveNode:o,statements:f});},onNode:n,type:`(${wt}: any) => Promise<${m}>`});}};var Ms={api:new ws({name:"@hey-api/transformers"}),config:{bigInt:true,dates:true,exportFromIndex:false,transformers:[],typeTransformers:[]},dependencies:["@hey-api/typescript"],handler:Cc,handlerLegacy:Mc,name:"@hey-api/transformers",resolveConfig:e=>{e.config.transformers||(e.config.transformers=[]),e.config.dates&&(e.config.transformers=[...e.config.transformers,Ec]),e.config.bigInt&&(e.config.transformers=[...e.config.transformers,Pc]);},tags:["transformer"]};var Vc=({context:e,name:t})=>(ee.lastIndex=0,ee.test(t)?t.startsWith("-")?S.factory.createStringLiteral(t):S.factory.createNumericLiteral(t):q({case:e.config.output.case,value:t}));var he=({schema:e})=>{let t=[];return e.title&&t.push(z(e.title)),e.description&&(t.length&&t.push(""),t.push(z(e.description))),e.deprecated&&(t.length&&t.push(""),t.push("@deprecated")),t.length?t:void 0};var Ls=s.keywordTypeNode({keyword:"string"}),Ou=({server:e})=>{let t=Qe(e.url);return t.protocol&&t.host?s.literalTypeNode({literal:s.stringLiteral({text:e.url})}):s.templateLiteralType({value:[t.protocol||Ls,"://",t.host||Ls,t.port?`:${t.port}`:"",t.path||""]})},Dc=({plugin:e,servers:t,symbolClientOptions:r})=>{let n=k(e.context.config),o=t.map(p=>Ou({server:p}));t.length?"strictBaseUrl"in n.config&&n.config.strictBaseUrl||o.push(s.typeIntersectionNode({types:[Ls,S.factory.createTypeLiteralNode([])]})):o.push(Ls);let i=s.typeInterfaceNode({properties:[{name:fe(e.context.config),type:s.typeUnionNode({types:o})}],useLegacyResolution:false}),a=s.typeAliasDeclaration({exportType:r.exported,name:r.placeholder,type:i});e.setSymbolValue(r,a);};var Tu=({plugin:e,schema:t})=>{let r=[];return {obj:(t.items??[]).map((o,i)=>{let a=typeof o.const;r.includes(a)||r.push(a);let p;return o.title?p=o.title:a==="number"||a==="string"?p=`${o.const}`:a==="boolean"?p=o.const?"true":"false":o.const===null?p="null":p=`${i}`,p&&(p=q({case:e.config.enums.case,stripLeadingSeparators:false,value:p}),ee.lastIndex=0,ee.test(p)&&e.config.enums.enabled&&(e.config.enums.mode==="typescript"||e.config.enums.mode==="typescript-const")&&(p=`_${p}`)),{comments:he({schema:o}),key:p,value:o.const}}),typeofItems:r}},Fc=({plugin:e,schema:t,symbol:r,type:n})=>{if(t.type==="enum"&&e.config.enums.enabled){let i=Tu({plugin:e,schema:t});if(e.config.enums.mode==="javascript"){e.config.enums.constantsIgnoreNull&&i.typeofItems.includes("object")&&(i.obj=i.obj.filter(m=>m.value!==null));let a=s.constVariable({assertion:"const",comment:he({schema:t}),exportConst:true,expression:s.objectExpression({multiLine:true,obj:i.obj}),name:r.placeholder}),p=s.typeOfExpression({text:r.placeholder}),c=s.typeAliasDeclaration({comment:he({schema:t}),exportType:true,name:r.placeholder,type:s.indexedAccessTypeNode({indexType:s.typeOperatorNode({operator:"keyof",type:p}),objectType:p})});e.setSymbolValue(r,[a,c]);return}else if((e.config.enums.mode==="typescript"||e.config.enums.mode==="typescript-const")&&!i.typeofItems.some(p=>p!=="number"&&p!=="string")){let p=s.enumDeclaration({asConst:e.config.enums.mode==="typescript-const",leadingComment:he({schema:t}),name:r.placeholder,obj:i.obj});e.setSymbolValue(r,p);return}}let o=s.typeAliasDeclaration({comment:he({schema:t}),exportType:r.exported,name:r.placeholder,type:n});e.setSymbolValue(r,o);};var ii=({parameters:e})=>{let t={type:"object"};if(e){let r={},n=[];for(let o in e){let i=e[o];r[i.name]=Z({detectFormat:false,schema:i.schema}),i.required&&n.push(i.name);}t.properties=r,n.length&&(t.required=n);}return t},Ru=({operation:e,plugin:t})=>{let r={type:"object"},n=[];r.properties||(r.properties={}),e.body?(r.properties.body=e.body.schema,e.body.required&&n.push("body")):r.properties.body={type:"never"},e.parameters?.header&&(r.properties.headers=ii({parameters:e.parameters.header}),r.properties.headers.required&&n.push("headers")),e.parameters?.path?(r.properties.path=ii({parameters:e.parameters.path}),r.properties.path.required&&n.push("path")):r.properties.path={type:"never"},e.parameters?.query?(r.properties.query=ii({parameters:e.parameters.query}),r.properties.query.required&&n.push("query")):r.properties.query={type:"never"},r.properties.url={const:e.path,type:"string"},n.push("url"),r.required=n;let o=t.registerSymbol({exported:true,meta:{kind:"type"},name:O({config:t.config.requests,name:e.id}),selector:t.api.getSelector("data",e.id)}),i=Y({plugin:t,schema:r}),a=s.typeAliasDeclaration({exportType:o.exported,name:o.placeholder,type:i});t.setSymbolValue(o,a);},Bc=({operation:e,plugin:t})=>{Ru({operation:e,plugin:t});let{error:r,errors:n,response:o,responses:i}=We(e);if(n){let a=t.registerSymbol({exported:true,meta:{kind:"type"},name:O({config:t.config.errors,name:e.id}),selector:t.api.getSelector("errors",e.id)}),p=Y({plugin:t,schema:n}),c=s.typeAliasDeclaration({exportType:a.exported,name:a.placeholder,type:p});if(t.setSymbolValue(a,c),r){let m=t.registerSymbol({exported:true,meta:{kind:"type"},name:O({config:{case:t.config.errors.case,name:t.config.errors.error},name:e.id}),selector:t.api.getSelector("error",e.id)}),l=s.indexedAccessTypeNode({indexType:s.typeOperatorNode({operator:"keyof",type:s.typeReferenceNode({typeName:a.placeholder})}),objectType:s.typeReferenceNode({typeName:a.placeholder})}),f=s.typeAliasDeclaration({exportType:m.exported,name:m.placeholder,type:l});t.setSymbolValue(m,f);}}if(i){let a=t.registerSymbol({exported:true,meta:{kind:"type"},name:O({config:t.config.responses,name:e.id}),selector:t.api.getSelector("responses",e.id)}),p=Y({plugin:t,schema:i}),c=s.typeAliasDeclaration({exportType:a.exported,name:a.placeholder,type:p});if(t.setSymbolValue(a,c),o){let m=t.registerSymbol({exported:true,meta:{kind:"type"},name:O({config:{case:t.config.responses.case,name:t.config.responses.response},name:e.id}),selector:t.api.getSelector("response",e.id)}),l=s.indexedAccessTypeNode({indexType:s.typeOperatorNode({operator:"keyof",type:s.typeReferenceNode({typeName:a.placeholder})}),objectType:s.typeReferenceNode({typeName:a.placeholder})}),f=s.typeAliasDeclaration({exportType:m.exported,name:m.placeholder,type:l});t.setSymbolValue(m,f);}}};var Au=({operation:e,plugin:t})=>{let r={type:"object"},n=[];if(r.properties||(r.properties={}),e.body){let p=t.registerSymbol({exported:true,meta:{kind:"type"},name:O({config:{case:t.config.webhooks.case,name:t.config.webhooks.payload},name:e.id}),selector:t.api.getSelector("webhook-payload",e.id)}),c=Y({plugin:t,schema:e.body.schema}),m=s.typeAliasDeclaration({comment:he({schema:e.body.schema}),exportType:p.exported,name:p.placeholder,type:c});t.setSymbolValue(p,m),t.registerSymbol({exported:true,meta:{kind:"type"},name:p.name,placeholder:p.placeholder,selector:t.api.getSelector("ref",p.placeholder)}),r.properties.body={$ref:p.placeholder},n.push("body");}else r.properties.body={type:"never"};r.properties.key={const:e.path,type:"string"},n.push("key"),r.properties.path={type:"never"},r.properties.query={type:"never"},r.required=n;let o=t.registerSymbol({exported:true,meta:{kind:"type"},name:O({config:t.config.webhooks,name:e.id}),selector:t.api.getSelector("webhook-request",e.id)}),i=Y({plugin:t,schema:r}),a=s.typeAliasDeclaration({exportType:o.exported,name:o.placeholder,type:i});return t.setSymbolValue(o,a),o.placeholder},Kc=({operation:e,plugin:t})=>Au({operation:e,plugin:t});var Wc=({plugin:e,symbolWebhooks:t,webhookNames:r})=>{if(!r.length)return;let n=s.typeUnionNode({types:r.map(i=>s.typeReferenceNode({typeName:i}))}),o=s.typeAliasDeclaration({exportType:t.exported,name:t.placeholder,type:n});e.setSymbolValue(t,o);};var Pu=({plugin:e,schema:t})=>{if(!t.items)return s.typeArrayNode(s.keywordTypeNode({keyword:e.config.topType}));t=Z({detectFormat:true,schema:t});let r=[];for(let n of t.items){let o=Y({plugin:e,schema:n});r.push(o);}return r.length===1?s.typeArrayNode(r[0]):t.logicalOperator==="and"?s.typeArrayNode(s.typeIntersectionNode({types:r})):s.typeArrayNode(s.typeUnionNode({types:r}))},Eu=({schema:e})=>e.const!==void 0?s.literalTypeNode({literal:s.ots.boolean(e.const)}):s.keywordTypeNode({keyword:"boolean"}),Iu=({plugin:e,schema:t})=>Y({plugin:e,schema:{...t,type:void 0}}),ku=({plugin:e,schema:t})=>t.const!==void 0?s.literalTypeNode({literal:s.ots.number(t.const)}):t.type==="integer"&&t.format==="int64"&&e.getPlugin("@hey-api/transformers")?.config.bigInt?s.typeReferenceNode({typeName:"bigint"}):s.keywordTypeNode({keyword:"number"}),ju=({plugin:e,schema:t})=>{let r,n,o=[],i=[],a=t.required??[],p=false;for(let d in t.properties){let u=t.properties[d],y=Y({plugin:e,schema:u}),g=a.includes(d);o.push({comment:he({schema:u}),isReadOnly:u.accessScope==="read",isRequired:g,name:Vc({context:e.context,name:d}),type:y}),i.push(u),g||(p=true);}if(t.patternProperties)for(let d in t.patternProperties){let u=t.patternProperties[d];i.unshift(u);}let c=!!t.patternProperties&&Object.keys(t.patternProperties).length>0,m=t.additionalProperties,l=m!==false&&m?m:void 0;if(c||!!l&&(l.type!=="never"||!i.length)){let d=l;d&&d.type!=="never"?i.unshift(d):!c&&!i.length&&d&&d.type==="never"&&(i=[d]),p&&i.push({type:"undefined"}),n={isRequired:!t.propertyNames,name:"key",type:i.length===1?Y({plugin:e,schema:i[0]}):Y({plugin:e,schema:{items:i,logicalOperator:"or"}})},t.propertyNames?.$ref&&(r=Y({plugin:e,schema:{$ref:t.propertyNames.$ref}}));}return s.typeInterfaceNode({indexKey:r,indexProperty:n,properties:o,useLegacyResolution:false})},Cu=({plugin:e,schema:t})=>{if(t.const!==void 0)return s.literalTypeNode({literal:s.stringLiteral({text:t.const})});if(t.format){if(t.format==="binary")return s.typeUnionNode({types:[s.typeReferenceNode({typeName:"Blob"}),s.typeReferenceNode({typeName:"File"})]});if((t.format==="date-time"||t.format==="date")&&e.getPlugin("@hey-api/transformers")?.config.dates)return s.typeReferenceNode({typeName:"Date"});if(t.format==="typeid"&&typeof t.example=="string"){let r=String(t.example).split("_");r.pop();let n=r.join("_"),o=e.api.getSelector("TypeID",n);if(!e.getSymbol(o)){let a=e.api.getSelector("TypeID");if(!e.getSymbol(a)){let l=e.registerSymbol({exported:true,meta:{kind:"type"},name:"TypeID",selector:a}),f=s.typeAliasDeclaration({exportType:l.exported,name:l.placeholder,type:s.templateLiteralType({value:[s.typeReferenceNode({typeName:"T"}),"_",s.keywordTypeNode({keyword:"string"})]}),typeParameters:[s.typeParameterDeclaration({constraint:s.keywordTypeNode({keyword:"string"}),name:"T"})]});e.setSymbolValue(l,f);}let p=e.referenceSymbol(a),c=e.registerSymbol({exported:true,meta:{kind:"type"},name:q({case:e.config.case,value:`${n}_id`}),selector:o}),m=s.typeAliasDeclaration({exportType:c.exported,name:c.placeholder,type:s.typeReferenceNode({typeArguments:[s.literalTypeNode({literal:s.stringLiteral({text:n})})],typeName:p.placeholder})});e.setSymbolValue(c,m);}let i=e.referenceSymbol(o);return s.typeReferenceNode({typeName:i.placeholder})}}return s.keywordTypeNode({keyword:"string"})},Nu=({plugin:e,schema:t})=>{let r=[];if(t.const&&Array.isArray(t.const))r=t.const.map(n=>s.valueToExpression({value:n})??s.identifier({text:e.config.topType}));else if(t.items)for(let n of t.items){let o=Y({plugin:e,schema:n});r.push(o);}return s.typeTupleNode({types:r})},zc=({plugin:e,schema:t})=>{let r=e.getPlugin("@hey-api/transformers");if(r?.config.typeTransformers)for(let n of r.config.typeTransformers){let o=n({schema:t});if(o)return o}switch(t.type){case "array":return Pu({plugin:e,schema:t});case "boolean":return Eu({schema:t});case "enum":return Iu({plugin:e,schema:t});case "integer":case "number":return ku({plugin:e,schema:t});case "never":return s.keywordTypeNode({keyword:"never"});case "null":return s.literalTypeNode({literal:s.null()});case "object":return ju({plugin:e,schema:t});case "string":return Cu({plugin:e,schema:t});case "tuple":return Nu({plugin:e,schema:t});case "undefined":return s.keywordTypeNode({keyword:"undefined"});case "unknown":return s.keywordTypeNode({keyword:e.config.topType});case "void":return s.keywordTypeNode({keyword:"void"})}},Y=({plugin:e,schema:t})=>{if(t.$ref){let r=e.referenceSymbol(e.api.getSelector("ref",t.$ref));return s.typeReferenceNode({typeName:r.placeholder})}if(t.type)return zc({plugin:e,schema:t});if(t.items){if(t=Z({detectFormat:false,schema:t}),t.items){let r=[];for(let n of t.items){let o=Y({plugin:e,schema:n});r.push(o);}return t.logicalOperator==="and"?s.typeIntersectionNode({types:r}):s.typeUnionNode({types:r})}return Y({plugin:e,schema:t})}return zc({plugin:e,schema:{type:"unknown"}})},ai=({id:e,plugin:t,schema:r})=>{let n=Y({plugin:t,schema:r}),o=r.type==="enum"&&t.config.enums.enabled,i=t.registerSymbol({exported:true,meta:{kind:o?void 0:"type"},name:O({config:t.config.definitions,name:F(e)}),selector:t.api.getSelector("ref",e)});Fc({plugin:t,schema:r,symbol:i,type:n});},_c=({plugin:e})=>{let t=e.registerSymbol({exported:true,meta:{kind:"type"},name:O({config:{case:e.config.case},name:"ClientOptions"}),selector:e.api.getSelector("ClientOptions")}),r=e.registerSymbol({exported:true,meta:{kind:"type"},name:O({config:{case:e.config.case},name:"Webhooks"}),selector:e.api.getSelector("Webhooks")}),n=[],o=[];e.forEach("operation","parameter","requestBody","schema","server","webhook",i=>{switch(i.type){case "operation":Bc({operation:i.operation,plugin:e});break;case "parameter":ai({id:i.$ref,plugin:e,schema:i.parameter.schema});break;case "requestBody":ai({id:i.$ref,plugin:e,schema:i.requestBody.schema});break;case "schema":ai({id:i.$ref,plugin:e,schema:i.schema});break;case "server":n.push(i.server);break;case "webhook":o.push(Kc({operation:i.operation,plugin:e}));break}}),Dc({plugin:e,servers:n,symbolClientOptions:t}),Wc({plugin:e,symbolWebhooks:r,webhookNames:o});};var Vs=class{constructor(t){this.meta=t;}getSelector(...t){return [this.meta.name,...t]}schemaToType(t){return Y(t)}};var Ds={api:new Vs({name:"@hey-api/typescript"}),config:{case:"PascalCase",exportFromIndex:true,style:"preserve",topType:"unknown",tree:false},handler:_c,handlerLegacy:vc,name:"@hey-api/typescript",resolveConfig:(e,t)=>{e.config.definitions=t.valueToObject({defaultValue:{case:e.config.case??"PascalCase",name:"{{name}}"},mappers:{function:r=>({name:r}),string:r=>({name:r})},value:e.config.definitions}),e.config.enums=t.valueToObject({defaultValue:{case:"SCREAMING_SNAKE_CASE",constantsIgnoreNull:false,enabled:!!e.config.enums,mode:"javascript"},mappers:{boolean:r=>({enabled:r}),string:r=>({mode:r})},value:e.config.enums}),e.config.errors=t.valueToObject({defaultValue:{case:e.config.case??"PascalCase",error:"{{name}}Error",name:"{{name}}Errors"},mappers:{function:r=>({name:r}),string:r=>({name:r})},value:e.config.errors}),e.config.requests=t.valueToObject({defaultValue:{case:e.config.case??"PascalCase",name:"{{name}}Data"},mappers:{function:r=>({name:r}),string:r=>({name:r})},value:e.config.requests}),e.config.responses=t.valueToObject({defaultValue:{case:e.config.case??"PascalCase",name:"{{name}}Responses",response:"{{name}}Response"},mappers:{function:r=>({name:r}),string:r=>({name:r})},value:e.config.responses}),e.config.webhooks=t.valueToObject({defaultValue:{case:e.config.case??"PascalCase",name:"{{name}}WebhookRequest",payload:"{{name}}WebhookPayload"},mappers:{function:r=>({name:r}),string:r=>({name:r})},value:e.config.webhooks});}};var Fs=class{constructor(t){this.meta=t;}getSelector(...t){return [this.meta.name,...t]}};var Bs=(e,t,r)=>{let n=e.config[r].meta;if(!n)return;let o=n(t);if(Object.keys(o).length)return s.valueToExpression({value:o})};var vr=({operation:e,plugin:t})=>{let r=t.getPluginOrThrow("@hey-api/sdk");return rn({operation:e,plugin:r})},Hc=({operation:e,plugin:t})=>{let r=k(t.context.config),n=t.getPluginOrThrow("@hey-api/typescript"),i=t.getSymbol(n.api.getSelector("error",e.id))?.placeholder;return i||(i="Error"),r.name==="@hey-api/client-axios"&&(i=`${t.referenceSymbol(t.api.getSelector("AxiosError")).placeholder}<${i}>`),i},Qc=({operation:e,plugin:t})=>{let r=t.getPluginOrThrow("@hey-api/typescript");return t.getSymbol(r.api.getSelector("response",e.id))?.placeholder||"unknown"};var wr=({plugin:e,typeData:t})=>{let n=k(e.context.config).name==="@hey-api/client-nuxt",o=n?`Omit<${t}, 'composable'>`:t;return {isNuxtClient:n,strippedTypeData:o}};var Zc=({operation:e,plugin:t,queryFn:r})=>{let n=t.referenceSymbol(t.api.getSelector("UseMutationOptions")),o=vr({operation:e,plugin:t}),i=Hc({operation:e,plugin:t}),a=Qc({operation:e,plugin:t}),{isNuxtClient:p,strippedTypeData:c}=wr({plugin:t,typeData:o}),m=p?`${n.placeholder}<${a}, ${c}, ${i}>`:`${n.placeholder}<${a}, ${o}, ${i}>`,l="fnOptions",f=s.awaitExpression({expression:s.callExpression({functionName:r,parameters:[s.objectExpression({multiLine:true,obj:[{spread:"options"},{spread:l},{key:"throwOnError",value:true}]})]})}),d=[];t.getPluginOrThrow("@hey-api/sdk").config.responseStyle==="data"?d.push(s.returnVariable({expression:f})):d.push(s.constVariable({destructure:true,expression:f,name:"data"}),s.returnVariable({expression:"data"}));let u=[{key:"mutation",value:s.arrowFunction({async:true,multiLine:true,parameters:[p?{name:l,type:`Partial<${c}>`}:{name:l}],statements:d})}],y=Bs(t,e,"mutationOptions");y&&u.push({key:"meta",value:y});let g=t.getPluginOrThrow("@hey-api/sdk"),x=t.registerSymbol({exported:true,name:O({config:t.config.mutationOptions,name:e.id})}),b=s.constVariable({comment:t.config.comments?g.api.createOperationComment({operation:e}):void 0,exportConst:x.exported,expression:s.arrowFunction({parameters:[{isRequired:false,name:"options",type:`Partial<${c}>`}],returnType:m,statements:[s.returnStatement({expression:s.objectExpression({obj:u})})]}),name:x.placeholder});t.setSymbolValue(x.id,b);};var on="TOptions",pi=s.identifier({text:"options"}),Uc=({plugin:e})=>{let t=e.registerSymbol({name:O({config:{case:e.config.case},name:"createQueryKey"}),selector:e.api.getSelector("createQueryKey")}),r=e.referenceSymbol(e.api.getSelector("QueryKey")),n=e.referenceSymbol(e.api.getSelector("_JSONValue")),o=s.indexedAccessTypeNode({indexType:s.literalTypeNode({literal:s.ots.number(0)}),objectType:s.typeReferenceNode({typeArguments:[s.typeReferenceNode({typeName:on})],typeName:r.placeholder})}),i=fe(e.context.config),a=e.getPluginOrThrow("@hey-api/sdk"),p=e.referenceSymbol(a.api.getSelector("Options")),c=k(e.context.config),m=c.api&&"getSelector"in c.api?e.getSymbol(c.api.getSelector("client")):void 0,l=Ye(e.context.config),f=e.registerSymbol({external:l,name:"serializeQueryKeyValue"}),d=s.constVariable({expression:s.arrowFunction({multiLine:true,parameters:[{name:"id",type:s.typeReferenceNode({typeName:"string"})},{isRequired:false,name:"options",type:s.typeReferenceNode({typeName:on})},{isRequired:false,name:"tags",type:s.typeReferenceNode({typeName:"ReadonlyArray<string>"})}],returnType:s.typeTupleNode({types:[o]}),statements:[s.constVariable({assertion:o,expression:s.objectExpression({multiLine:false,obj:[{key:"_id",value:s.identifier({text:"id"})},{key:i,value:s.identifier({text:`options?.${i} || (options?.client ?? ${m?.placeholder}).getConfig().${i}`})}]}),name:"params",typeName:o}),s.ifStatement({expression:s.identifier({text:"tags"}),thenStatement:s.block({statements:[s.expressionToStatement({expression:s.binaryExpression({left:s.propertyAccessExpression({expression:"params",name:"tags"}),right:s.asExpression({expression:s.asExpression({expression:s.identifier({text:"tags"}),type:s.keywordTypeNode({keyword:"unknown"})}),type:s.typeReferenceNode({typeName:n.placeholder})})})})]})}),s.ifStatement({expression:s.binaryExpression({left:s.propertyAccessExpression({expression:pi,isOptional:true,name:s.identifier({text:"body"})}),operator:"!==",right:"undefined"}),thenStatement:s.block({statements:[s.constVariable({expression:s.callExpression({functionName:f.placeholder,parameters:[s.propertyAccessExpression({expression:"options",name:"body"})]}),name:"normalizedBody"}),s.ifStatement({expression:s.binaryExpression({left:s.identifier({text:"normalizedBody"}),operator:"!==",right:"undefined"}),thenStatement:s.block({statements:[s.expressionToStatement({expression:s.binaryExpression({left:s.propertyAccessExpression({expression:"params",name:"body"}),right:s.identifier({text:"normalizedBody"})})})]})})]})}),s.ifStatement({expression:s.propertyAccessExpression({expression:pi,isOptional:true,name:s.identifier({text:"path"})}),thenStatement:s.block({statements:[s.expressionToStatement({expression:s.binaryExpression({left:s.propertyAccessExpression({expression:"params",name:"path"}),right:s.propertyAccessExpression({expression:"options",name:"path"})})})]})}),s.ifStatement({expression:s.binaryExpression({left:s.propertyAccessExpression({expression:pi,isOptional:true,name:s.identifier({text:"query"})}),operator:"!==",right:"undefined"}),thenStatement:s.block({statements:[s.constVariable({expression:s.callExpression({functionName:f.placeholder,parameters:[s.propertyAccessExpression({expression:"options",name:"query"})]}),name:"normalizedQuery"}),s.ifStatement({expression:s.binaryExpression({left:s.identifier({text:"normalizedQuery"}),operator:"!==",right:"undefined"}),thenStatement:s.block({statements:[s.expressionToStatement({expression:s.binaryExpression({left:s.propertyAccessExpression({expression:"params",name:"query"}),right:s.identifier({text:"normalizedQuery"})})})]})})]})}),s.returnStatement({expression:s.arrayLiteralExpression({elements:[s.identifier({text:"params"})]})})],types:[{extends:s.typeReferenceNode({typeName:s.identifier({text:p.placeholder})}),name:on}]}),name:t.placeholder});e.setSymbolValue(t,d);},wu=({id:e,operation:t,plugin:r})=>{let n=r.config.queryKeys,o;n.tags&&t.tags&&t.tags.length>0&&(o=s.arrayLiteralExpression({elements:t.tags.map(p=>s.stringLiteral({text:p}))}));let i=r.referenceSymbol(r.api.getSelector("createQueryKey"));return s.callExpression({functionName:i.placeholder,parameters:[s.ots.string(e),"options",o]})},Xc=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector("_JSONValue")),r=[{name:"_id",type:s.keywordTypeNode({keyword:"string"})},{isRequired:false,name:fe(e.context.config),type:s.typeReferenceNode({typeName:t.placeholder})},{isRequired:false,name:"body",type:s.typeReferenceNode({typeName:t.placeholder})},{isRequired:false,name:"query",type:s.typeReferenceNode({typeName:t.placeholder})},{isRequired:false,name:"tags",type:s.typeReferenceNode({typeName:t.placeholder})}],n=e.getPluginOrThrow("@hey-api/sdk"),o=e.referenceSymbol(n.api.getSelector("Options")),i=e.registerSymbol({exported:true,meta:{kind:"type"},name:"QueryKey",selector:e.api.getSelector("QueryKey")}),a=s.typeAliasDeclaration({exportType:i.exported,name:i.placeholder,type:s.typeTupleNode({types:[s.typeIntersectionNode({types:[s.typeReferenceNode({typeName:`Pick<${on}, 'path'>`}),s.typeInterfaceNode({properties:r,useLegacyResolution:true})]})]}),typeParameters:[{extends:s.typeReferenceNode({typeName:s.identifier({text:o.placeholder})}),name:on}]});e.setSymbolValue(i,a);},Jc=({operation:e,plugin:t,symbol:r})=>{let n=vr({operation:e,plugin:t}),{strippedTypeData:o}=wr({plugin:t,typeData:n});return s.constVariable({exportConst:r.exported,expression:s.arrowFunction({parameters:[{isRequired:dr(e),name:"options",type:o}],statements:wu({id:e.id,operation:e,plugin:t})}),name:r.placeholder})};var Ks="options",Gc="context",Yc=({operation:e,plugin:t,queryFn:r})=>{if(jr({operation:e}))return;let n=ne({context:t.context,operation:e});t.getSymbol(t.api.getSelector("createQueryKey"))||(Xc({plugin:t}),Uc({plugin:t}));let o;if(t.config.queryKeys.enabled){let g=t.registerSymbol({exported:true,name:O({config:t.config.queryKeys,name:e.id})}),x=Jc({operation:e,plugin:t,symbol:g});t.setSymbolValue(g,x),o=s.callExpression({functionName:g.placeholder,parameters:[Ks]});}else {let g=t.referenceSymbol(t.api.getSelector("createQueryKey")),x;t.config.queryKeys.tags&&e.tags&&e.tags.length>0&&(x=s.arrayLiteralExpression({elements:e.tags.map(b=>s.stringLiteral({text:b}))})),o=s.callExpression({functionName:g.placeholder,parameters:[s.ots.string(e.id),Ks,x]});}let i=vr({operation:e,plugin:t}),{strippedTypeData:a}=wr({plugin:t,typeData:i}),p=s.awaitExpression({expression:s.callExpression({functionName:r,parameters:[s.objectExpression({multiLine:true,obj:[{spread:Ks},{spread:Gc},{key:"throwOnError",value:true}]})]})}),c=[];t.getPluginOrThrow("@hey-api/sdk").config.responseStyle==="data"?c.push(s.returnVariable({expression:p})):c.push(s.constVariable({destructure:true,expression:p,name:"data"}),s.returnVariable({expression:"data"}));let m=[{key:"key",value:o},{key:"query",value:s.arrowFunction({async:true,multiLine:true,parameters:[{name:Gc}],statements:c})}],l=Bs(t,e,"queryOptions");l&&m.push({key:"meta",value:l});let f=t.getPluginOrThrow("@hey-api/sdk"),d=t.registerSymbol({exported:true,name:O({config:t.config.queryOptions,name:e.id}),selector:t.api.getSelector("queryOptionsFn",e.id)}),u=t.registerSymbol({external:t.name,name:"defineQueryOptions",selector:t.api.getSelector("defineQueryOptions")}),y=s.constVariable({comment:t.config.comments?f.api.createOperationComment({operation:e}):void 0,exportConst:d.exported,expression:s.callExpression({functionName:u.placeholder,parameters:[s.arrowFunction({parameters:[{isRequired:n,name:Ks,type:a}],statements:s.objectExpression({obj:m})})]}),name:d.placeholder});t.setSymbolValue(d,y);};var em=({plugin:e})=>{e.registerSymbol({external:e.name,meta:{kind:"type"},name:"UseMutationOptions",selector:e.api.getSelector("UseMutationOptions")}),e.registerSymbol({external:e.name,meta:{kind:"type"},name:"UseQueryOptions",selector:e.api.getSelector("UseQueryOptions")}),e.registerSymbol({external:e.name,meta:{kind:"type"},name:"_JSONValue",selector:e.api.getSelector("_JSONValue")}),e.registerSymbol({external:"axios",meta:{kind:"type"},name:"AxiosError",selector:e.api.getSelector("AxiosError")});let t=e.getPluginOrThrow("@hey-api/sdk");e.forEach("operation",({operation:r})=>{let n=t.config.asClass?qe({context:e.context,operation:r,plugin:t}):void 0,o=n?n.values().next().value:void 0,i=o?[e.referenceSymbol(t.api.getSelector("class",o.path[0])).placeholder,...o.path.slice(1).map(a=>q({case:"camelCase",value:a})),o.methodName].filter(Boolean).join("."):e.referenceSymbol(t.api.getSelector("function",r.id)).placeholder;e.hooks.operation.isQuery(r)&&e.config.queryOptions.enabled&&Yc({operation:r,plugin:e,queryFn:i}),e.hooks.operation.isMutation(r)&&e.config.mutationOptions.enabled&&Zc({operation:r,plugin:e,queryFn:i});});};var Ws={api:new Fs({name:"@pinia/colada"}),config:{case:"camelCase",comments:true,exportFromIndex:false},dependencies:["@hey-api/typescript","@hey-api/sdk"],handler:em,name:"@pinia/colada",resolveConfig:(e,t)=>{e.config.mutationOptions=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"{{name}}Mutation"},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.mutationOptions}),e.config.queryKeys=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"{{name}}QueryKey",tags:false},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.queryKeys}),e.config.queryOptions=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"{{name}}Query"},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.queryOptions});}};var qr=(e,t,r)=>{let n=e.config[r].meta;if(!n)return;let o=n(t);if(Object.keys(o).length)return s.valueToExpression({value:o})};var nt=({operation:e,plugin:t})=>{let r=t.getPluginOrThrow("@hey-api/sdk");return rn({operation:e,plugin:r})},zs=({operation:e,plugin:t})=>{let r=k(t.context.config),n=t.getPluginOrThrow("@hey-api/typescript"),i=t.getSymbol(n.api.getSelector("error",e.id))?.placeholder;return i||(i=t.referenceSymbol(t.api.getSelector("DefaultError")).placeholder),r.name==="@hey-api/client-axios"&&(i=`${t.referenceSymbol(t.api.getSelector("AxiosError")).placeholder}<${i}>`),i},_s=({operation:e,plugin:t})=>{let r=t.getPluginOrThrow("@hey-api/typescript");return t.getSymbol(r.api.getSelector("response",e.id))?.placeholder||"unknown"};var an="TOptions",tm=s.identifier({text:"infinite"}),Hs=s.identifier({text:"options"}),Qs=({plugin:e})=>{let t=e.registerSymbol({name:O({config:{case:e.config.case},name:"createQueryKey"}),selector:e.api.getSelector("createQueryKey")}),r=e.referenceSymbol(e.api.getSelector("QueryKey")),n=s.indexedAccessTypeNode({indexType:s.literalTypeNode({literal:s.ots.number(0)}),objectType:s.typeReferenceNode({typeArguments:[s.typeReferenceNode({typeName:an})],typeName:r.placeholder})}),o=fe(e.context.config),i=k(e.context.config),a=i.api&&"getSelector"in i.api?e.getSymbol(i.api.getSelector("client")):void 0,p=e.getPluginOrThrow("@hey-api/sdk"),c=e.referenceSymbol(p.api.getSelector("Options")),m=s.constVariable({expression:s.arrowFunction({multiLine:true,parameters:[{name:"id",type:s.typeReferenceNode({typeName:"string"})},{isRequired:false,name:"options",type:s.typeReferenceNode({typeName:an})},{isRequired:false,name:"infinite",type:s.typeReferenceNode({typeName:"boolean"})},{isRequired:false,name:"tags",type:s.typeReferenceNode({typeName:"ReadonlyArray<string>"})}],returnType:s.typeTupleNode({types:[n]}),statements:[s.constVariable({assertion:n,expression:s.objectExpression({multiLine:false,obj:[{key:"_id",value:s.identifier({text:"id"})},{key:o,value:s.identifier({text:`options?.${o} || (options?.client ?? ${a?.placeholder}).getConfig().${o}`})}]}),name:"params",typeName:n}),s.ifStatement({expression:tm,thenStatement:s.block({statements:[s.expressionToStatement({expression:s.binaryExpression({left:s.propertyAccessExpression({expression:"params",name:"_infinite"}),right:tm})})]})}),s.ifStatement({expression:s.identifier({text:"tags"}),thenStatement:s.block({statements:[s.expressionToStatement({expression:s.binaryExpression({left:s.propertyAccessExpression({expression:"params",name:"tags"}),right:s.identifier({text:"tags"})})})]})}),s.ifStatement({expression:s.propertyAccessExpression({expression:Hs,isOptional:true,name:s.identifier({text:"body"})}),thenStatement:s.block({statements:[s.expressionToStatement({expression:s.binaryExpression({left:s.propertyAccessExpression({expression:"params",name:"body"}),right:s.propertyAccessExpression({expression:"options",name:"body"})})})]})}),s.ifStatement({expression:s.propertyAccessExpression({expression:Hs,isOptional:true,name:s.identifier({text:"headers"})}),thenStatement:s.block({statements:[s.expressionToStatement({expression:s.binaryExpression({left:s.propertyAccessExpression({expression:"params",name:"headers"}),right:s.propertyAccessExpression({expression:"options",name:"headers"})})})]})}),s.ifStatement({expression:s.propertyAccessExpression({expression:Hs,isOptional:true,name:s.identifier({text:"path"})}),thenStatement:s.block({statements:[s.expressionToStatement({expression:s.binaryExpression({left:s.propertyAccessExpression({expression:"params",name:"path"}),right:s.propertyAccessExpression({expression:"options",name:"path"})})})]})}),s.ifStatement({expression:s.propertyAccessExpression({expression:Hs,isOptional:true,name:s.identifier({text:"query"})}),thenStatement:s.block({statements:[s.expressionToStatement({expression:s.binaryExpression({left:s.propertyAccessExpression({expression:"params",name:"query"}),right:s.propertyAccessExpression({expression:"options",name:"query"})})})]})}),s.returnStatement({expression:s.arrayLiteralExpression({elements:[s.identifier({text:"params"})]})})],types:[{extends:s.typeReferenceNode({typeName:s.identifier({text:c.placeholder})}),name:an}]}),name:t.placeholder});e.setSymbolValue(t,m);},$u=({id:e,isInfinite:t,operation:r,plugin:n})=>{let o=t?n.config.infiniteQueryKeys:n.config.queryKeys,i;o.tags&&r.tags&&r.tags.length>0&&(i=s.arrayLiteralExpression({elements:r.tags.map(c=>s.stringLiteral({text:c}))}));let a=n.referenceSymbol(n.api.getSelector("createQueryKey"));return s.callExpression({functionName:a.placeholder,parameters:[s.ots.string(e),"options",t||i?s.ots.boolean(!!t):void 0,i]})},Zs=({plugin:e})=>{let t=[{name:"_id",type:s.keywordTypeNode({keyword:"string"})},{isRequired:false,name:"_infinite",type:s.keywordTypeNode({keyword:"boolean"})},{isRequired:false,name:"tags",type:s.typeReferenceNode({typeName:"ReadonlyArray<string>"})}],r=e.getPluginOrThrow("@hey-api/sdk"),n=e.referenceSymbol(r.api.getSelector("Options")),o=e.registerSymbol({exported:true,meta:{kind:"type"},name:"QueryKey",selector:e.api.getSelector("QueryKey")}),i=s.typeAliasDeclaration({exportType:o.exported,name:o.placeholder,type:s.typeTupleNode({types:[s.typeIntersectionNode({types:[s.typeReferenceNode({typeName:`Pick<${an}, '${fe(e.context.config)}' | 'body' | 'headers' | 'path' | 'query'>`}),s.typeInterfaceNode({properties:t,useLegacyResolution:true})]})]}),typeParameters:[{extends:s.typeReferenceNode({typeName:s.identifier({text:n.placeholder})}),name:an}]});e.setSymbolValue(o,i);},Us=({isInfinite:e,operation:t,plugin:r,symbol:n,typeQueryKey:o})=>{let i=nt({operation:t,plugin:r});return s.constVariable({exportConst:n.exported,expression:s.arrowFunction({parameters:[{isRequired:dr(t),name:"options",type:i}],returnType:e?o:void 0,statements:$u({id:t.id,isInfinite:e,operation:t,plugin:r})}),name:n.placeholder})};var Lu=({plugin:e})=>{let t=e.registerSymbol({name:O({config:{case:e.config.case},name:"createInfiniteParams"}),selector:e.api.getSelector("createInfiniteParams")}),r=s.constVariable({expression:s.arrowFunction({multiLine:true,parameters:[{name:"queryKey",type:s.typeReferenceNode({typeName:"QueryKey<Options>"})},{name:"page",type:s.typeReferenceNode({typeName:"K"})}],statements:[s.constVariable({expression:s.objectExpression({obj:[{spread:s.propertyAccessExpression({expression:"queryKey",name:0})}]}),name:"params"}),s.ifStatement({expression:s.propertyAccessExpression({expression:s.identifier({text:"page"}),name:s.identifier({text:"body"})}),thenStatement:s.block({statements:[s.expressionToStatement({expression:s.binaryExpression({left:s.propertyAccessExpression({expression:"params",name:"body"}),right:s.objectExpression({multiLine:true,obj:[{assertion:"any",spread:"queryKey[0].body"},{assertion:"any",spread:"page.body"}]})})})]})}),s.ifStatement({expression:s.propertyAccessExpression({expression:s.identifier({text:"page"}),name:s.identifier({text:"headers"})}),thenStatement:s.block({statements:[s.expressionToStatement({expression:s.binaryExpression({left:s.propertyAccessExpression({expression:"params",name:"headers"}),right:s.objectExpression({multiLine:true,obj:[{spread:"queryKey[0].headers"},{spread:"page.headers"}]})})})]})}),s.ifStatement({expression:s.propertyAccessExpression({expression:s.identifier({text:"page"}),name:s.identifier({text:"path"})}),thenStatement:s.block({statements:[s.expressionToStatement({expression:s.binaryExpression({left:s.propertyAccessExpression({expression:"params",name:"path"}),right:s.objectExpression({multiLine:true,obj:[{assertion:"any",spread:"queryKey[0].path"},{assertion:"any",spread:"page.path"}]})})})]})}),s.ifStatement({expression:s.propertyAccessExpression({expression:s.identifier({text:"page"}),name:s.identifier({text:"query"})}),thenStatement:s.block({statements:[s.expressionToStatement({expression:s.binaryExpression({left:s.propertyAccessExpression({expression:"params",name:"query"}),right:s.objectExpression({multiLine:true,obj:[{assertion:"any",spread:"queryKey[0].query"},{assertion:"any",spread:"page.query"}]})})})]})}),s.returnVariable({expression:s.asExpression({expression:s.asExpression({expression:s.identifier({text:"params"}),type:s.keywordTypeNode({keyword:"unknown"})}),type:S.factory.createTypeQueryNode(s.identifier({text:"page"}))})})],types:[{extends:s.typeReferenceNode({typeName:s.identifier({text:"Pick<QueryKey<Options>[0], 'body' | 'headers' | 'path' | 'query'>"})}),name:"K"}]}),name:t.placeholder});e.setSymbolValue(t,r);},rm=({operation:e,plugin:t,queryFn:r})=>{let n=va({context:t.context,operation:e});if(!n)return;let o=ne({context:t.context,operation:e});t.getSymbol(t.api.getSelector("createQueryKey"))||(Zs({plugin:t}),Qs({plugin:t})),t.getSymbol(t.api.getSelector("createInfiniteParams"))||Lu({plugin:t});let i=t.referenceSymbol(t.api.getSelector("infiniteQueryOptions")),a=t.referenceSymbol(t.api.getSelector("InfiniteData")),p=nt({operation:e,plugin:t}),c=zs({operation:e,plugin:t}),m=_s({operation:e,plugin:t}),f=`${t.referenceSymbol(t.api.getSelector("QueryKey")).placeholder}<${p}>`,d=`Pick<${f}[0], 'body' | 'headers' | 'path' | 'query'>`,u=t.getPluginOrThrow("@hey-api/typescript"),y=u.api.schemaToType({plugin:u,schema:n.schema}),g=`${ce({node:y,unescape:true})} | ${d}`,x=t.registerSymbol({exported:true,name:O({config:t.config.infiniteQueryKeys,name:e.id})}),b=Us({isInfinite:true,operation:e,plugin:t,symbol:x,typeQueryKey:f});t.setSymbolValue(x,b);let I=s.awaitExpression({expression:s.callExpression({functionName:r,parameters:[s.objectExpression({multiLine:true,obj:[{spread:"options"},{spread:"params"},{key:"signal",shorthand:true,value:s.identifier({text:"signal"})},{key:"throwOnError",value:true}]})]})}),P=t.referenceSymbol(t.api.getSelector("createInfiniteParams")),j=[s.constVariable({comment:[{jsdoc:false,lines:["@ts-ignore"]}],expression:s.conditionalExpression({condition:s.binaryExpression({left:s.typeOfExpression({text:"pageParam"}),operator:"===",right:s.ots.string("object")}),whenFalse:s.objectExpression({multiLine:true,obj:[{key:n.in,value:s.objectExpression({multiLine:true,obj:[{key:n.name,value:s.identifier({text:"pageParam"})}]})}]}),whenTrue:s.identifier({text:"pageParam"})}),name:"page",typeName:d}),s.constVariable({expression:s.callExpression({functionName:P.placeholder,parameters:["queryKey","page"]}),name:"params"})];t.getPluginOrThrow("@hey-api/sdk").config.responseStyle==="data"?j.push(s.returnVariable({expression:I})):j.push(s.constVariable({destructure:true,expression:I,name:"data"}),s.returnVariable({expression:"data"}));let C=[{key:"queryFn",value:s.arrowFunction({async:true,multiLine:true,parameters:[{destructure:[{name:"pageParam"},{name:"queryKey"},{name:"signal"}]}],statements:j})},{key:"queryKey",value:s.callExpression({functionName:x.placeholder,parameters:["options"]})}],D=qr(t,e,"infiniteQueryOptions");D&&C.push({key:"meta",value:D});let K=t.getPluginOrThrow("@hey-api/sdk"),v=t.registerSymbol({exported:true,name:O({config:t.config.infiniteQueryOptions,name:e.id})}),M=s.constVariable({comment:t.config.comments?K.api.createOperationComment({operation:e}):void 0,exportConst:v.exported,expression:s.arrowFunction({parameters:[{isRequired:o,name:"options",type:p}],statements:[s.returnFunctionCall({args:[s.objectExpression({comments:[{jsdoc:false,lines:["@ts-ignore"]}],obj:C})],name:i.placeholder,types:[m,c||"unknown",`${a.placeholder}<${m}>`,f,g]})]}),name:v.placeholder});t.setSymbolValue(v,M);};var nm=({operation:e,plugin:t,queryFn:r})=>{let n=t.referenceSymbol(t.api.getSelector("MutationOptions")),o=nt({operation:e,plugin:t}),i=zs({operation:e,plugin:t}),a=_s({operation:e,plugin:t}),p=`${n.placeholder}<${a}, ${i}, ${o}>`,c="fnOptions",m=s.awaitExpression({expression:s.callExpression({functionName:r,parameters:[s.objectExpression({multiLine:true,obj:[{spread:"options"},{spread:c},{key:"throwOnError",value:true}]})]})}),l=[];t.getPluginOrThrow("@hey-api/sdk").config.responseStyle==="data"?l.push(s.returnVariable({expression:m})):l.push(s.constVariable({destructure:true,expression:m,name:"data"}),s.returnVariable({expression:"data"}));let f=[{key:"mutationFn",value:s.arrowFunction({async:true,multiLine:true,parameters:[{name:c}],statements:l})}],d=qr(t,e,"mutationOptions");d&&f.push({key:"meta",value:d});let u=t.getPluginOrThrow("@hey-api/sdk"),y="mutationOptions",g=s.arrowFunction({parameters:[{isRequired:false,name:"options",type:`Partial<${o}>`}],returnType:p,statements:[s.constVariable({expression:s.objectExpression({obj:f}),name:y,typeName:p}),s.returnVariable({expression:y})]}),x=t.registerSymbol({exported:true,name:O({config:t.config.mutationOptions,name:e.id})}),b=s.constVariable({comment:t.config.comments?u.api.createOperationComment({operation:e}):void 0,exportConst:x.exported,expression:g,name:x.placeholder});t.setSymbolValue(x,b);};var ci="options",sm=({operation:e,plugin:t,queryFn:r})=>{if(jr({operation:e}))return;let n=ne({context:t.context,operation:e});t.getSymbol(t.api.getSelector("createQueryKey"))||(Zs({plugin:t}),Qs({plugin:t}));let o=t.referenceSymbol(t.api.getSelector("queryOptions")),i=t.registerSymbol({exported:true,name:O({config:t.config.queryKeys,name:e.id})}),a=Us({isInfinite:false,operation:e,plugin:t,symbol:i});t.setSymbolValue(i,a);let p=nt({operation:e,plugin:t}),c=s.awaitExpression({expression:s.callExpression({functionName:r,parameters:[s.objectExpression({multiLine:true,obj:[{spread:ci},{spread:"queryKey[0]"},{key:"signal",shorthand:true,value:s.identifier({text:"signal"})},{key:"throwOnError",value:true}]})]})}),m=[];t.getPluginOrThrow("@hey-api/sdk").config.responseStyle==="data"?m.push(s.returnVariable({expression:c})):m.push(s.constVariable({destructure:true,expression:c,name:"data"}),s.returnVariable({expression:"data"}));let l=[{key:"queryFn",value:s.arrowFunction({async:true,multiLine:true,parameters:[{destructure:[{name:"queryKey"},{name:"signal"}]}],statements:m})},{key:"queryKey",value:s.callExpression({functionName:i.placeholder,parameters:[ci]})}],f=qr(t,e,"queryOptions");f&&l.push({key:"meta",value:f});let d=t.getPluginOrThrow("@hey-api/sdk"),u=t.registerSymbol({exported:t.config.queryOptions.exported,name:O({config:t.config.queryOptions,name:e.id}),selector:t.api.getSelector("queryOptionsFn",e.id)}),y=s.constVariable({comment:t.config.comments?d.api.createOperationComment({operation:e}):void 0,exportConst:u.exported,expression:s.arrowFunction({parameters:[{isRequired:n,name:ci,type:p}],statements:[s.returnFunctionCall({args:[s.objectExpression({obj:l})],name:o.placeholder})]}),name:u.placeholder});t.setSymbolValue(u,y);};var om="options",im=({operation:e,plugin:t})=>{if(jr({operation:e})||!("useQuery"in t.config))return;let r=t.getPluginOrThrow("@hey-api/sdk"),n=t.registerSymbol({exported:true,name:O({config:t.config.useQuery,name:e.id})}),o=t.referenceSymbol(t.api.getSelector("useQuery")),i=ne({context:t.context,operation:e}),a=nt({operation:e,plugin:t}),p=t.referenceSymbol(t.api.getSelector("queryOptionsFn",e.id)),c=s.constVariable({comment:t.config.comments?r.api.createOperationComment({operation:e}):void 0,exportConst:n.exported,expression:s.arrowFunction({parameters:[{isRequired:i,name:om,type:a}],statements:[s.returnStatement({expression:s.callExpression({functionName:o.placeholder,parameters:[s.callExpression({functionName:p.placeholder,parameters:[om]})]})})]}),name:n.placeholder});t.setSymbolValue(n,c);};var st=({plugin:e})=>{e.registerSymbol({external:e.name,meta:{kind:"type"},name:"DefaultError",selector:e.api.getSelector("DefaultError")}),e.registerSymbol({external:e.name,meta:{kind:"type"},name:"InfiniteData",selector:e.api.getSelector("InfiniteData")});let t=e.name==="@tanstack/angular-query-experimental"||e.name==="@tanstack/svelte-query"||e.name==="@tanstack/solid-query"?"MutationOptions":"UseMutationOptions";e.registerSymbol({external:e.name,meta:{kind:"type"},name:t,selector:e.api.getSelector("MutationOptions")}),e.registerSymbol({external:e.name,name:"infiniteQueryOptions",selector:e.api.getSelector("infiniteQueryOptions")}),e.registerSymbol({external:e.name,name:"queryOptions",selector:e.api.getSelector("queryOptions")}),e.registerSymbol({external:e.name,name:"useQuery",selector:e.api.getSelector("useQuery")}),e.registerSymbol({external:"axios",meta:{kind:"type"},name:"AxiosError",selector:e.api.getSelector("AxiosError")});let r=e.getPluginOrThrow("@hey-api/sdk");e.forEach("operation",({operation:n})=>{let o=r.config.asClass?qe({context:e.context,operation:n,plugin:r}):void 0,i=o?o.values().next().value:void 0,a=i?[e.referenceSymbol(r.api.getSelector("class",i.path[0])).placeholder,...i.path.slice(1).map(p=>q({case:"camelCase",value:p})),i.methodName].filter(Boolean).join("."):e.referenceSymbol(r.api.getSelector("function",n.id)).placeholder;e.hooks.operation.isQuery(n)&&(e.config.queryOptions.enabled&&sm({operation:n,plugin:e,queryFn:a}),e.config.infiniteQueryOptions.enabled&&rm({operation:n,plugin:e,queryFn:a}),"useQuery"in e.config&&e.config.useQuery.enabled&&im({operation:n,plugin:e})),e.hooks.operation.isMutation(n)&&e.config.mutationOptions.enabled&&nm({operation:n,plugin:e,queryFn:a});});};var Vu=e=>`${tt({config:A(),id:e.name,operation:e})}InfiniteOptions`,Du=e=>`${tt({config:A(),id:e.name,operation:e})}Mutation`,Fu=({config:e,id:t,operation:r})=>`${tt({config:e,id:t,operation:r})}Options`,Xs=({config:e,id:t,isInfinite:r,operation:n})=>`${tt({config:e,id:t,operation:n})}${r?"Infinite":""}QueryKey`,Bu=e=>{switch(e.in){case "formData":return "body";case "header":return "headers";default:return e.in}},Ku="createInfiniteParams",ym="createQueryKey",am="infiniteQueryOptions",pm="mutationOptions",li="QueryKey",cm="queryOptions",cn="TOptions",Wu=({file:e})=>{let t=s.constVariable({expression:s.arrowFunction({multiLine:true,parameters:[{name:"queryKey",type:s.typeNode("QueryKey<OptionsLegacyParser>")},{name:"page",type:s.typeNode("K")}],statements:[s.constVariable({expression:s.identifier({text:"queryKey[0]"}),name:"params"}),s.ifStatement({expression:s.propertyAccessExpression({expression:s.identifier({text:"page"}),name:s.identifier({text:"body"})}),thenStatement:s.block({statements:[s.expressionToStatement({expression:s.binaryExpression({left:s.propertyAccessExpression({expression:"params",name:"body"}),right:s.objectExpression({multiLine:true,obj:[{assertion:"any",spread:"queryKey[0].body"},{assertion:"any",spread:"page.body"}]})})})]})}),s.ifStatement({expression:s.propertyAccessExpression({expression:s.identifier({text:"page"}),name:s.identifier({text:"headers"})}),thenStatement:s.block({statements:[s.expressionToStatement({expression:s.binaryExpression({left:s.propertyAccessExpression({expression:"params",name:"headers"}),right:s.objectExpression({multiLine:true,obj:[{spread:"queryKey[0].headers"},{spread:"page.headers"}]})})})]})}),s.ifStatement({expression:s.propertyAccessExpression({expression:s.identifier({text:"page"}),name:s.identifier({text:"path"})}),thenStatement:s.block({statements:[s.expressionToStatement({expression:s.binaryExpression({left:s.propertyAccessExpression({expression:"params",name:"path"}),right:s.objectExpression({multiLine:true,obj:[{spread:"queryKey[0].path"},{spread:"page.path"}]})})})]})}),s.ifStatement({expression:s.propertyAccessExpression({expression:s.identifier({text:"page"}),name:s.identifier({text:"query"})}),thenStatement:s.block({statements:[s.expressionToStatement({expression:s.binaryExpression({left:s.propertyAccessExpression({expression:"params",name:"query"}),right:s.objectExpression({multiLine:true,obj:[{spread:"queryKey[0].query"},{spread:"page.query"}]})})})]})}),s.returnVariable({expression:S.factory.createAsExpression(S.factory.createAsExpression(s.identifier({text:"params"}),S.factory.createKeywordTypeNode(S.SyntaxKind.UnknownKeyword)),S.factory.createTypeQueryNode(s.identifier({text:"page"})))})],types:[{extends:s.typeReferenceNode({typeName:s.identifier({text:"Pick<QueryKey<OptionsLegacyParser>[0], 'body' | 'headers' | 'path' | 'query'>"})}),name:"K"}]}),name:Ku});e.add(t);},mm=({file:e})=>{let t=s.indexedAccessTypeNode({indexType:s.typeNode(0),objectType:s.typeNode(li,[s.typeNode(cn)])}),r=s.identifier({text:"infinite"}),n=fe(A()),o=s.constVariable({expression:s.arrowFunction({multiLine:true,parameters:[{name:"id",type:s.typeNode("string")},{isRequired:false,name:"options",type:s.typeNode(cn)},{isRequired:false,name:"infinite",type:s.typeNode("boolean")}],returnType:t,statements:[s.constVariable({assertion:t,expression:s.objectExpression({multiLine:false,obj:[{key:"_id",value:s.identifier({text:"id"})},{key:n,value:s.identifier({text:`options?.${n} || (options?.client ?? _heyApiClient).getConfig().${n}`})}]}),name:"params",typeName:t}),s.ifStatement({expression:r,thenStatement:s.block({statements:[s.expressionToStatement({expression:s.binaryExpression({left:s.propertyAccessExpression({expression:"params",name:"_infinite"}),right:r})})]})}),s.ifStatement({expression:s.propertyAccessExpression({expression:s.identifier({text:"options"}),isOptional:true,name:s.identifier({text:"body"})}),thenStatement:s.block({statements:[s.expressionToStatement({expression:s.binaryExpression({left:s.propertyAccessExpression({expression:"params",name:"body"}),right:s.propertyAccessExpression({expression:"options",name:"body"})})})]})}),s.ifStatement({expression:s.propertyAccessExpression({expression:s.identifier({text:"options"}),isOptional:true,name:s.identifier({text:"headers"})}),thenStatement:s.block({statements:[s.expressionToStatement({expression:s.binaryExpression({left:s.propertyAccessExpression({expression:"params",name:"headers"}),right:s.propertyAccessExpression({expression:"options",name:"headers"})})})]})}),s.ifStatement({expression:s.propertyAccessExpression({expression:s.identifier({text:"options"}),isOptional:true,name:s.identifier({text:"path"})}),thenStatement:s.block({statements:[s.expressionToStatement({expression:s.binaryExpression({left:s.propertyAccessExpression({expression:"params",name:"path"}),right:s.propertyAccessExpression({expression:"options",name:"path"})})})]})}),s.ifStatement({expression:s.propertyAccessExpression({expression:s.identifier({text:"options"}),isOptional:true,name:s.identifier({text:"query"})}),thenStatement:s.block({statements:[s.expressionToStatement({expression:s.binaryExpression({left:s.propertyAccessExpression({expression:"params",name:"query"}),right:s.propertyAccessExpression({expression:"options",name:"query"})})})]})}),s.returnVariable({expression:"params"})],types:[{extends:s.typeReferenceNode({typeName:s.identifier({text:"OptionsLegacyParser"})}),name:cn}]}),name:ym});e.add(o);},lm=({file:e})=>{let t=[{name:"_id",type:s.keywordTypeNode({keyword:"string"})},{isRequired:false,name:"_infinite",type:s.keywordTypeNode({keyword:"boolean"})}],r=s.typeAliasDeclaration({name:li,type:s.typeTupleNode({types:[s.typeIntersectionNode({types:[s.typeReferenceNode({typeName:`Pick<${cn}, '${fe(A())}' | 'body' | 'headers' | 'path' | 'query'>`}),s.typeInterfaceNode({properties:t,useLegacyResolution:true})]})]}),typeParameters:[{extends:s.typeReferenceNode({typeName:s.identifier({text:"OptionsLegacyParser"})}),name:cn}]});e.add(r);},mi=({client:e,file:t,operation:r,typesModulePath:n})=>{let{name:o}=Gt({client:e,meta:r.parameters.length?{$ref:r.name,name:r.name}:void 0,nameTransformer:Yt,onImport:a=>{t.import({asType:true,module:n,name:a});}});return {typeData:oi({importedType:o})}},fm=({client:e,file:t,operation:r,pluginName:n,typesModulePath:o})=>{let i=A(),{name:a}=Gt({client:e,meta:{$ref:r.name,name:r.name},nameTransformer:Nr,onImport:m=>{t.import({asType:true,module:o,name:m});}}),p={asType:true,name:a};if(p.name||(p=t.import({asType:true,module:n,name:"DefaultError"})),k(i).name==="@hey-api/client-axios"){let m=t.import({asType:true,module:"axios",name:"AxiosError"});p={...m,name:`${m.name}<${p.name}>`};}return {typeError:p}},dm=({client:e,file:t,operation:r,typesModulePath:n})=>{let{name:o}=Gt({client:e,meta:{$ref:r.name,name:r.name},nameTransformer:rt,onImport:a=>{t.import({asType:true,module:n,name:a});}});return {typeResponse:o||"void"}},um=({id:e,isInfinite:t})=>s.arrayLiteralExpression({elements:[s.callExpression({functionName:ym,parameters:[s.ots.string(e),"options",t?s.ots.boolean(true):void 0]})],multiLine:false}),ot=({client:e,files:t,plugin:r})=>{let n=A();if(Q(n))throw new Error("TanStack Query plugin does not support legacy clients");let o=t[r.name];o.import({asType:true,module:Jt({config:n,sourceOutput:r.output}),name:"OptionsLegacyParser"});let i=nr({moduleOutput:t.types.nameWithoutExtension(),sourceOutput:r.output}),a=r.name==="@tanstack/angular-query-experimental"||r.name==="@tanstack/svelte-query"||r.name==="@tanstack/solid-query"?"MutationOptions":"UseMutationOptions",p,c=false,m=false,l=false,f=false,d=false,u=new Map;for(let y of e.services)for(let g of y.operations){let x=V(g);if(u.has(x))continue;u.set(x,true);let b=[n.plugins["@hey-api/sdk"]?.config.asClass&&Ar({config:n,name:y.name}),tt({config:n,handleIllegal:!n.plugins["@hey-api/sdk"]?.config.asClass,id:g.name,operation:g})].filter(Boolean).join("."),I=false;if(r.config.queryOptions.enabled&&["GET","POST"].includes(g.method)){d||(d=true,m||(lm({file:o}),mm({file:o}),m=true),o.import({module:r.name,name:cm})),I=true;let{typeData:P}=mi({client:e,file:o,operation:g,typesModulePath:i}),j=Ge(g.parameters),C=s.constVariable({exportConst:true,expression:s.arrowFunction({parameters:[{isRequired:j,name:"options",type:P}],statements:um({id:g.name})}),name:Xs({config:n,id:g.name,operation:g})});o.add(C);let D=s.constVariable({comment:[],exportConst:true,expression:s.arrowFunction({parameters:[{isRequired:j,name:"options",type:P}],statements:[s.returnFunctionCall({args:[s.objectExpression({obj:[{key:"queryFn",value:s.arrowFunction({async:true,multiLine:true,parameters:[{destructure:[{name:"queryKey"},{name:"signal"}]}],statements:[s.constVariable({destructure:true,expression:s.awaitExpression({expression:s.callExpression({functionName:b,parameters:[s.objectExpression({multiLine:true,obj:[{spread:"options"},{spread:"queryKey[0]"},{key:"signal",shorthand:true,value:s.identifier({text:"signal"})},{key:"throwOnError",value:true}]})]})}),name:"data"}),s.returnVariable({expression:"data"})]})},{key:"queryKey",value:s.callExpression({functionName:Xs({config:n,id:g.name,operation:g}),parameters:["options"]})}]})],name:cm})]}),name:Fu({config:n,id:g.name,operation:g})});o.add(D);}if(r.config.infiniteQueryOptions&&["GET","POST"].includes(g.method)){let P,j=g.parameters.find(C=>{if(Oe(n.parser.pagination).test(C.name))return P=C,true;if(C.in==="body"){if(C.export==="reference"){let K=C.$refs[0];return e.models.find(M=>M.meta?.$ref===K)?.properties.find(M=>{if(Oe(n.parser.pagination).test(M.name))return P=M,true})}return C.properties.find(K=>{if(Oe(n.parser.pagination).test(K.name))return P=K,true})}});if(j&&P){l||(l=true,m||(lm({file:o}),mm({file:o}),m=true),c||(Wu({file:o}),c=true),o.import({module:r.name,name:am}),p=o.import({asType:true,module:r.name,name:"InfiniteData"})),I=true;let{typeData:C}=mi({client:e,file:o,operation:g,typesModulePath:i}),{typeError:D}=fm({client:e,file:o,operation:g,pluginName:r.name,typesModulePath:i}),{typeResponse:K}=dm({client:e,file:o,operation:g,typesModulePath:i}),v=Ge(g.parameters),M=`${li}<${C}>`,Rt=`Pick<${M}[0], 'body' | 'headers' | 'path' | 'query'>`,Le=`${P.base} | ${Rt}`,rr=s.constVariable({exportConst:true,expression:s.arrowFunction({parameters:[{isRequired:v,name:"options",type:C}],returnType:M,statements:um({id:g.name,isInfinite:true})}),name:Xs({config:n,id:g.name,isInfinite:true,operation:g})});o.add(rr);let Dm=s.constVariable({comment:[],exportConst:true,expression:s.arrowFunction({parameters:[{isRequired:v,name:"options",type:C}],statements:[s.returnFunctionCall({args:[s.objectExpression({comments:[{jsdoc:false,lines:["@ts-ignore"]}],obj:[{key:"queryFn",value:s.arrowFunction({async:true,multiLine:true,parameters:[{destructure:[{name:"pageParam"},{name:"queryKey"},{name:"signal"}]}],statements:[s.constVariable({comment:[{jsdoc:false,lines:["@ts-ignore"]}],expression:s.conditionalExpression({condition:s.binaryExpression({left:s.typeOfExpression({text:"pageParam"}),operator:"===",right:s.ots.string("object")}),whenFalse:s.objectExpression({multiLine:true,obj:[{key:Bu(j),value:s.objectExpression({multiLine:true,obj:[{key:P.name,value:s.identifier({text:"pageParam"})}]})}]}),whenTrue:s.identifier({text:"pageParam"})}),name:"page",typeName:Rt}),s.constVariable({expression:s.callExpression({functionName:"createInfiniteParams",parameters:["queryKey","page"]}),name:"params"}),s.constVariable({destructure:true,expression:s.awaitExpression({expression:s.callExpression({functionName:b,parameters:[s.objectExpression({multiLine:true,obj:[{spread:"options"},{spread:"params"},{key:"signal",shorthand:true,value:s.identifier({text:"signal"})},{key:"throwOnError",value:true}]})]})}),name:"data"}),s.returnVariable({expression:"data"})]})},{key:"queryKey",value:s.callExpression({functionName:Xs({config:n,id:g.name,isInfinite:true,operation:g}),parameters:["options"]})}]})],name:am,types:[K,D.name,`${typeof p=="string"?p:p.name}<${K}>`,M,Le]})]}),name:Vu(g)});o.add(Dm);}}if(r.config.mutationOptions&&["DELETE","PATCH","POST","PUT"].includes(g.method)){f||(f=true,o.import({asType:true,module:r.name,name:a})),I=true;let{typeData:P}=mi({client:e,file:o,operation:g,typesModulePath:i}),{typeError:j}=fm({client:e,file:o,operation:g,pluginName:r.name,typesModulePath:i}),{typeResponse:C}=dm({client:e,file:o,operation:g,typesModulePath:i}),D="fnOptions",K=s.arrowFunction({parameters:[{isRequired:false,name:"options",type:`Partial<${P}>`}],statements:[s.constVariable({expression:s.objectExpression({obj:[{key:"mutationFn",value:s.arrowFunction({async:true,multiLine:true,parameters:[{name:D}],statements:[s.constVariable({destructure:true,expression:s.awaitExpression({expression:s.callExpression({functionName:b,parameters:[s.objectExpression({multiLine:true,obj:[{spread:"options"},{spread:D},{key:"throwOnError",value:true}]})]})}),name:"data"}),s.returnVariable({expression:"data"})]})}]}),name:pm,typeName:`${a}<${C}, ${j.name}, ${P}>`}),s.returnVariable({expression:pm})]}),v=s.constVariable({comment:[],exportConst:true,expression:K,name:Du(g)});o.add(v);}(d||l)&&o.import({alias:"_heyApiClient",module:nr({moduleOutput:t.client.nameWithoutExtension(),sourceOutput:r.output}),name:"client"}),I&&o.import({module:nr({moduleOutput:t.sdk.nameWithoutExtension(),sourceOutput:r.output}),name:b.split(".")[0]});}};var Js=class{constructor(t){this.meta=t;}getSelector(...t){return [this.meta.name,...t]}};var Gs={api:new Js({name:"@tanstack/angular-query-experimental"}),config:{case:"camelCase",comments:true,exportFromIndex:false},dependencies:["@hey-api/sdk","@hey-api/typescript"],handler:st,handlerLegacy:ot,name:"@tanstack/angular-query-experimental",output:"@tanstack/angular-query-experimental",resolveConfig:(e,t)=>{e.config.infiniteQueryKeys=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"{{name}}InfiniteQueryKey",tags:false},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.infiniteQueryKeys}),e.config.infiniteQueryOptions=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"{{name}}InfiniteOptions"},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.infiniteQueryOptions}),e.config.mutationOptions=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"{{name}}Mutation"},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.mutationOptions}),e.config.queryKeys=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"{{name}}QueryKey",tags:false},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.queryKeys}),e.config.queryOptions=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,exported:true,name:"{{name}}Options"},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.queryOptions});}};var Ys=class{constructor(t){this.meta=t;}getSelector(...t){return [this.meta.name,...t]}};var eo={api:new Ys({name:"@tanstack/react-query"}),config:{case:"camelCase",comments:true,exportFromIndex:false},dependencies:["@hey-api/sdk","@hey-api/typescript"],handler:st,handlerLegacy:ot,name:"@tanstack/react-query",output:"@tanstack/react-query",resolveConfig:(e,t)=>{e.config.infiniteQueryKeys=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"{{name}}InfiniteQueryKey",tags:false},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.infiniteQueryKeys}),e.config.infiniteQueryOptions=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"{{name}}InfiniteOptions"},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.infiniteQueryOptions}),e.config.mutationOptions=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"{{name}}Mutation"},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.mutationOptions}),e.config.queryKeys=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"{{name}}QueryKey",tags:false},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.queryKeys}),e.config.queryOptions=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,exported:true,name:"{{name}}Options"},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.queryOptions}),e.config.useQuery=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:false,name:"use{{name}}Query"},mappers:{boolean:r=>({enabled:r}),function:r=>({enabled:true,name:r}),object:r=>({enabled:true,...r}),string:r=>({enabled:true,name:r})},value:e.config.useQuery}),e.config.useQuery.enabled&&(e.config.queryOptions.enabled||(e.config.queryOptions.enabled=true,e.config.queryOptions.exported=false));}};var to=class{constructor(t){this.meta=t;}getSelector(...t){return [this.meta.name,...t]}};var ro={api:new to({name:"@tanstack/solid-query"}),config:{case:"camelCase",comments:true,exportFromIndex:false},dependencies:["@hey-api/sdk","@hey-api/typescript"],handler:st,handlerLegacy:ot,name:"@tanstack/solid-query",output:"@tanstack/solid-query",resolveConfig:(e,t)=>{e.config.infiniteQueryKeys=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"{{name}}InfiniteQueryKey",tags:false},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.infiniteQueryKeys}),e.config.infiniteQueryOptions=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"{{name}}InfiniteOptions"},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.infiniteQueryOptions}),e.config.mutationOptions=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"{{name}}Mutation"},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.mutationOptions}),e.config.queryKeys=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"{{name}}QueryKey",tags:false},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.queryKeys}),e.config.queryOptions=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,exported:true,name:"{{name}}Options"},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.queryOptions});}};var no=class{constructor(t){this.meta=t;}getSelector(...t){return [this.meta.name,...t]}};var so={api:new no({name:"@tanstack/svelte-query"}),config:{case:"camelCase",comments:true,exportFromIndex:false},dependencies:["@hey-api/sdk","@hey-api/typescript"],handler:st,handlerLegacy:ot,name:"@tanstack/svelte-query",output:"@tanstack/svelte-query",resolveConfig:(e,t)=>{e.config.infiniteQueryKeys=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"{{name}}InfiniteQueryKey",tags:false},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.infiniteQueryKeys}),e.config.infiniteQueryOptions=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"{{name}}InfiniteOptions"},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.infiniteQueryOptions}),e.config.mutationOptions=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"{{name}}Mutation"},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.mutationOptions}),e.config.queryKeys=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"{{name}}QueryKey",tags:false},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.queryKeys}),e.config.queryOptions=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,exported:true,name:"{{name}}Options"},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.queryOptions});}};var oo=class{constructor(t){this.meta=t;}getSelector(...t){return [this.meta.name,...t]}};var io={api:new oo({name:"@tanstack/vue-query"}),config:{case:"camelCase",comments:true,exportFromIndex:false},dependencies:["@hey-api/sdk","@hey-api/typescript"],handler:st,handlerLegacy:ot,name:"@tanstack/vue-query",output:"@tanstack/vue-query",resolveConfig:(e,t)=>{e.config.infiniteQueryKeys=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"{{name}}InfiniteQueryKey",tags:false},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.infiniteQueryKeys}),e.config.infiniteQueryOptions=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"{{name}}InfiniteOptions"},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.infiniteQueryOptions}),e.config.mutationOptions=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"{{name}}Mutation"},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.mutationOptions}),e.config.queryKeys=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"{{name}}QueryKey",tags:false},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.queryKeys}),e.config.queryOptions=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,exported:true,name:"{{name}}Options"},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.queryOptions});}};var ao=class{constructor(t){this.meta=t;}getSelector(...t){return [this.meta.name,...t]}};var Uu=({operation:e,plugin:t})=>{let r=[],n=t.getPluginOrThrow("@hey-api/typescript"),o=t.getSymbol(n.api.getSelector("data",e.id));o&&(e.body&&r.push({isRequired:e.body.required,name:"Body",type:`${o.placeholder}['body']`}),e.parameters&&(e.parameters.header&&r.push({isRequired:Pt(e.parameters.header),name:"Headers",type:`${o.placeholder}['headers']`}),e.parameters.path&&r.push({isRequired:Pt(e.parameters.path),name:"Params",type:`${o.placeholder}['path']`}),e.parameters.query&&r.push({isRequired:Pt(e.parameters.query),name:"Querystring",type:`${o.placeholder}['query']`})));let{errors:i,responses:a}=We(e),p,c=t.getSymbol(n.api.getSelector("errors",e.id));if(c&&i&&i.properties){let y=Object.keys(i.properties);if(y.length){if(!y.includes("default"))p=s.typeReferenceNode({typeName:c.placeholder});else if(y.length>1){let x=s.typeReferenceNode({typeName:c.placeholder}),b=s.literalTypeNode({literal:s.stringLiteral({text:"default"})});p=s.typeReferenceNode({typeArguments:[x,b],typeName:"Omit"});}}}let m,l=t.getSymbol(n.api.getSelector("responses",e.id));if(l&&a&&a.properties){let y=Object.keys(a.properties);if(y.length){if(!y.includes("default"))m=s.typeReferenceNode({typeName:l.placeholder});else if(y.length>1){let x=s.typeReferenceNode({typeName:l.placeholder}),b=s.literalTypeNode({literal:s.stringLiteral({text:"default"})});m=s.typeReferenceNode({typeArguments:[x,b],typeName:"Omit"});}}}let f=[p,m].filter(Boolean);if(f.length&&r.push({name:"Reply",type:s.typeIntersectionNode({types:f})}),!r.length)return;let d=t.referenceSymbol(t.api.getSelector("RouteHandler"));return {name:e.id,type:s.typeReferenceNode({typeArguments:[s.typeInterfaceNode({properties:r,useLegacyResolution:false})],typeName:d.placeholder})}},hm=({plugin:e})=>{e.registerSymbol({external:"fastify",meta:{kind:"type"},name:"RouteHandler",selector:e.api.getSelector("RouteHandler")});let t=e.registerSymbol({exported:true,meta:{kind:"type"},name:"RouteHandlers"}),r=[];e.forEach("operation",({operation:o})=>{let i=Uu({operation:o,plugin:e});i&&r.push(i);});let n=s.typeAliasDeclaration({exportType:t.exported,name:t.placeholder,type:s.typeInterfaceNode({properties:r,useLegacyResolution:false})});e.setSymbolValue(t,n);};var po={api:new ao({name:"fastify"}),config:{exportFromIndex:false},dependencies:["@hey-api/typescript"],handler:hm,name:"fastify"};var T={actions:{args:s.identifier({text:"args"}),base64:s.identifier({text:"base64"}),bic:s.identifier({text:"bic"}),brand:s.identifier({text:"brand"}),bytes:s.identifier({text:"bytes"}),check:s.identifier({text:"check"}),checkItems:s.identifier({text:"checkItems"}),creditCard:s.identifier({text:"creditCard"}),cuid2:s.identifier({text:"cuid2"}),decimal:s.identifier({text:"decimal"}),description:s.identifier({text:"description"}),digits:s.identifier({text:"digits"}),email:s.identifier({text:"email"}),emoji:s.identifier({text:"emoji"}),empty:s.identifier({text:"empty"}),endsWith:s.identifier({text:"endsWith"}),entries:s.identifier({text:"entries"}),everyItem:s.identifier({text:"everyItem"}),excludes:s.identifier({text:"excludes"}),filterItems:s.identifier({text:"filterItems"}),findItem:s.identifier({text:"findItem"}),finite:s.identifier({text:"finite"}),flavor:s.identifier({text:"flavor"}),graphemes:s.identifier({text:"graphemes"}),gtValue:s.identifier({text:"gtValue"}),hash:s.identifier({text:"hash"}),hexColor:s.identifier({text:"hexColor"}),hexadecimal:s.identifier({text:"hexadecimal"}),imei:s.identifier({text:"imei"}),includes:s.identifier({text:"includes"}),integer:s.identifier({text:"integer"}),ip:s.identifier({text:"ip"}),ipv4:s.identifier({text:"ipv4"}),ipv6:s.identifier({text:"ipv6"}),isoDate:s.identifier({text:"isoDate"}),isoDateTime:s.identifier({text:"isoDateTime"}),isoTime:s.identifier({text:"isoTime"}),isoTimeSecond:s.identifier({text:"isoTimeSecond"}),isoTimestamp:s.identifier({text:"isoTimestamp"}),isoWeek:s.identifier({text:"isoWeek"}),length:s.identifier({text:"length"}),ltValue:s.identifier({text:"ltValue"}),mac:s.identifier({text:"mac"}),mac48:s.identifier({text:"mac48"}),mac64:s.identifier({text:"mac64"}),mapItems:s.identifier({text:"mapItems"}),maxBytes:s.identifier({text:"maxBytes"}),maxEntries:s.identifier({text:"maxEntries"}),maxGraphemes:s.identifier({text:"maxGraphemes"}),maxLength:s.identifier({text:"maxLength"}),maxSize:s.identifier({text:"maxSize"}),maxValue:s.identifier({text:"maxValue"}),maxWords:s.identifier({text:"maxWords"}),metadata:s.identifier({text:"metadata"}),mimeType:s.identifier({text:"mimeType"}),minBytes:s.identifier({text:"minBytes"}),minEntries:s.identifier({text:"minEntries"}),minGraphemes:s.identifier({text:"minGraphemes"}),minLength:s.identifier({text:"minLength"}),minSize:s.identifier({text:"minSize"}),minValue:s.identifier({text:"minValue"}),minWords:s.identifier({text:"minWords"}),multipleOf:s.identifier({text:"multipleOf"}),nanoid:s.identifier({text:"nanoid"}),nonEmpty:s.identifier({text:"nonEmpty"}),normalize:s.identifier({text:"normalize"}),notBytes:s.identifier({text:"notBytes"}),notEntries:s.identifier({text:"notEntries"}),notGraphemes:s.identifier({text:"notGraphemes"}),notLength:s.identifier({text:"notLength"}),notSize:s.identifier({text:"notSize"}),notValue:s.identifier({text:"notValue"}),notValues:s.identifier({text:"notValues"}),notWords:s.identifier({text:"notWords"}),octal:s.identifier({text:"octal"}),parseJson:s.identifier({text:"parseJson"}),partialCheck:s.identifier({text:"partialCheck"}),rawCheck:s.identifier({text:"rawCheck"}),rawTransform:s.identifier({text:"rawTransform"}),readonly:s.identifier({text:"readonly"}),reduceItems:s.identifier({text:"reduceItems"}),regex:s.identifier({text:"regex"}),returns:s.identifier({text:"returns"}),rfcEmail:s.identifier({text:"rfcEmail"}),safeInteger:s.identifier({text:"safeInteger"}),size:s.identifier({text:"size"}),slug:s.identifier({text:"slug"}),someItem:s.identifier({text:"someItem"}),sortItems:s.identifier({text:"sortItems"}),startsWith:s.identifier({text:"startsWith"}),stringifyJson:s.identifier({text:"stringifyJson"}),title:s.identifier({text:"title"}),toLowerCase:s.identifier({text:"toLowerCase"}),toMaxValue:s.identifier({text:"toMaxValue"}),toMinValue:s.identifier({text:"toMinValue"}),toUpperCase:s.identifier({text:"toUpperCase"}),transform:s.identifier({text:"transform"}),trim:s.identifier({text:"trim"}),trimEnd:s.identifier({text:"trimEnd"}),trimStart:s.identifier({text:"trimStart"}),ulid:s.identifier({text:"ulid"}),url:s.identifier({text:"url"}),uuid:s.identifier({text:"uuid"}),value:s.identifier({text:"value"}),values:s.identifier({text:"values"}),words:s.identifier({text:"words"})},async:{argsAsync:s.identifier({text:"argsAsync"}),arrayAsync:s.identifier({text:"arrayAsync"}),awaitAsync:s.identifier({text:"awaitAsync"}),checkAsync:s.identifier({text:"checkAsync"}),checkItemsAsync:s.identifier({text:"checkItemsAsync"}),customAsync:s.identifier({text:"customAsync"}),exactOptionalAsync:s.identifier({text:"exactOptionalAsync"}),fallbackAsync:s.identifier({text:"fallbackAsync"}),forwardAsync:s.identifier({text:"forwardAsync"}),getDefaultsAsync:s.identifier({text:"getDefaultsAsync"}),getFallbacksAsync:s.identifier({text:"getFallbacksAsync"}),intersectAsync:s.identifier({text:"intersectAsync"}),lazyAsync:s.identifier({text:"lazyAsync"}),looseObjectAsync:s.identifier({text:"looseObjectAsync"}),looseTupleAsync:s.identifier({text:"looseTupleAsync"}),mapAsync:s.identifier({text:"mapAsync"}),nonNullableAsync:s.identifier({text:"nonNullableAsync"}),nonNullishAsync:s.identifier({text:"nonNullishAsync"}),nonOptionalAsync:s.identifier({text:"nonOptionalAsync"}),nullableAsync:s.identifier({text:"nullableAsync"}),nullishAsync:s.identifier({text:"nullishAsync"}),objectAsync:s.identifier({text:"objectAsync"}),objectWithRestAsync:s.identifier({text:"objectWithRestAsync"}),optionalAsync:s.identifier({text:"optionalAsync"}),parseAsync:s.identifier({text:"parseAsync"}),parserAsync:s.identifier({text:"parserAsync"}),partialAsync:s.identifier({text:"partialAsync"}),partialCheckAsync:s.identifier({text:"partialCheckAsync"}),pipeAsync:s.identifier({text:"pipeAsync"}),rawCheckAsync:s.identifier({text:"rawCheckAsync"}),rawTransformAsync:s.identifier({text:"rawTransformAsync"}),recordAsync:s.identifier({text:"recordAsync"}),requiredAsync:s.identifier({text:"requiredAsync"}),returnsAsync:s.identifier({text:"returnsAsync"}),safeParseAsync:s.identifier({text:"safeParseAsync"}),safeParserAsync:s.identifier({text:"safeParserAsync"}),setAsync:s.identifier({text:"setAsync"}),strictObjectAsync:s.identifier({text:"strictObjectAsync"}),strictTupleAsync:s.identifier({text:"strictTupleAsync"}),transformAsync:s.identifier({text:"transformAsync"}),tupleAsync:s.identifier({text:"tupleAsync"}),tupleWithRestAsync:s.identifier({text:"tupleWithRestAsync"}),undefinedableAsync:s.identifier({text:"undefinedableAsync"}),unionAsync:s.identifier({text:"unionAsync"}),variantAsync:s.identifier({text:"variantAsync"})},methods:{assert:s.identifier({text:"assert"}),config:s.identifier({text:"config"}),fallback:s.identifier({text:"fallback"}),flatten:s.identifier({text:"flatten"}),forward:s.identifier({text:"forward"}),getDefault:s.identifier({text:"getDefault"}),getDefaults:s.identifier({text:"getDefaults"}),getDescription:s.identifier({text:"getDescription"}),getFallback:s.identifier({text:"getFallback"}),getFallbacks:s.identifier({text:"getFallbacks"}),getMetadata:s.identifier({text:"getMetadata"}),getTitle:s.identifier({text:"getTitle"}),is:s.identifier({text:"is"}),keyof:s.identifier({text:"keyof"}),message:s.identifier({text:"message"}),omit:s.identifier({text:"omit"}),parse:s.identifier({text:"parse"}),parser:s.identifier({text:"parser"}),partial:s.identifier({text:"partial"}),pick:s.identifier({text:"pick"}),pipe:s.identifier({text:"pipe"}),required:s.identifier({text:"required"}),safeParse:s.identifier({text:"safeParse"}),safeParser:s.identifier({text:"safeParser"}),summarize:s.identifier({text:"summarize"}),unwrap:s.identifier({text:"unwrap"})},schemas:{any:s.identifier({text:"any"}),array:s.identifier({text:"array"}),bigInt:s.identifier({text:"bigint"}),blob:s.identifier({text:"blob"}),boolean:s.identifier({text:"boolean"}),custom:s.identifier({text:"custom"}),date:s.identifier({text:"date"}),enum:s.identifier({text:"enum"}),exactOptional:s.identifier({text:"exactOptional"}),file:s.identifier({text:"file"}),function:s.identifier({text:"function"}),instance:s.identifier({text:"instance"}),intersect:s.identifier({text:"intersect"}),lazy:s.identifier({text:"lazy"}),literal:s.identifier({text:"literal"}),looseObject:s.identifier({text:"looseObject"}),looseTuple:s.identifier({text:"looseTuple"}),map:s.identifier({text:"map"}),nan:s.identifier({text:"nan"}),never:s.identifier({text:"never"}),nonNullable:s.identifier({text:"nonNullable"}),nonNullish:s.identifier({text:"nonNullish"}),nonOptional:s.identifier({text:"nonOptional"}),null:s.identifier({text:"null"}),nullable:s.identifier({text:"nullable"}),nullish:s.identifier({text:"nullish"}),number:s.identifier({text:"number"}),object:s.identifier({text:"object"}),objectWithRest:s.identifier({text:"objectWithRest"}),optional:s.identifier({text:"optional"}),picklist:s.identifier({text:"picklist"}),promise:s.identifier({text:"promise"}),record:s.identifier({text:"record"}),set:s.identifier({text:"set"}),strictObject:s.identifier({text:"strictObject"}),strictTuple:s.identifier({text:"strictTuple"}),string:s.identifier({text:"string"}),symbol:s.identifier({text:"symbol"}),tuple:s.identifier({text:"tuple"}),tupleWithRest:s.identifier({text:"tupleWithRest"}),undefined:s.identifier({text:"undefined"}),undefinedable:s.identifier({text:"undefinedable"}),union:s.identifier({text:"union"}),unknown:s.identifier({text:"unknown"}),variant:s.identifier({text:"variant"}),void:s.identifier({text:"void"})},types:{GenericSchema:s.identifier({text:"GenericSchema"})}};var co=class{constructor(t){this.meta=t;}createRequestValidator({operation:t,plugin:r}){let n=r.getSymbol(r.api.getSelector("data",t.id));if(!n)return;let o=r.referenceSymbol(r.api.getSelector("import","valibot")),i="data";return s.arrowFunction({async:true,parameters:[{name:i}],statements:[s.returnStatement({expression:s.awaitExpression({expression:s.callExpression({functionName:s.propertyAccessExpression({expression:o.placeholder,name:T.async.parseAsync}),parameters:[s.identifier({text:n.placeholder}),s.identifier({text:i})]})})})]})}createResponseValidator({operation:t,plugin:r}){let n=r.getSymbol(r.api.getSelector("responses",t.id));if(!n)return;let o=r.referenceSymbol(r.api.getSelector("import","valibot")),i="data";return s.arrowFunction({async:true,parameters:[{name:i}],statements:[s.returnStatement({expression:s.awaitExpression({expression:s.callExpression({functionName:s.propertyAccessExpression({expression:o.placeholder,name:T.async.parseAsync}),parameters:[s.identifier({text:n.placeholder}),s.identifier({text:i})]})})})]})}getSelector(...t){return [this.meta.name,...t]}};var er=e=>{if(e.length>=2){if(e[0]==="components"){if(e[1]==="schemas")return "schema";if(e[1]==="parameters")return "parameter";if(e[1]==="requestBodies")return "requestBody"}if(e[0]==="paths")return "operation";if(e[0]==="servers")return "server";if(e[0]==="webhooks")return "webhook"}};var mo={int16:{max:32767,maxError:"Invalid value: Expected int16 to be <= 2^15-1",min:-32768,minError:"Invalid value: Expected int16 to be >= -2^15",needsBigInt:false},int32:{max:2147483647,maxError:"Invalid value: Expected int32 to be <= 2^31-1",min:-2147483648,minError:"Invalid value: Expected int32 to be >= -2^31",needsBigInt:false},int64:{max:"9223372036854775807",maxError:"Invalid value: Expected int64 to be <= 2^63-1",min:"-9223372036854775808",minError:"Invalid value: Expected int64 to be >= -2^63",needsBigInt:true},int8:{max:127,maxError:"Invalid value: Expected int8 to be <= 2^7-1",min:-128,minError:"Invalid value: Expected int8 to be >= -2^7",needsBigInt:false},uint16:{max:65535,maxError:"Invalid value: Expected uint16 to be <= 2^16-1",min:0,minError:"Invalid value: Expected uint16 to be >= 0",needsBigInt:false},uint32:{max:4294967295,maxError:"Invalid value: Expected uint32 to be <= 2^32-1",min:0,minError:"Invalid value: Expected uint32 to be >= 0",needsBigInt:false},uint64:{max:"18446744073709551615",maxError:"Invalid value: Expected uint64 to be <= 2^64-1",min:"0",minError:"Invalid value: Expected uint64 to be >= 0",needsBigInt:true},uint8:{max:255,maxError:"Invalid value: Expected uint8 to be <= 2^8-1",min:0,minError:"Invalid value: Expected uint8 to be >= 0",needsBigInt:false}},fi=e=>e!==void 0&&e in mo,gm=e=>fi(e)&&mo[e].needsBigInt,$r=({isBigInt:e,value:t})=>{let r=s.valueToExpression({value:t});return e&&(typeof t=="bigint"||typeof t=="number"||typeof t=="string"||typeof t=="boolean")?s.callExpression({functionName:"BigInt",parameters:[r]}):r};var xm=({_path:e,operation:t,plugin:r,state:n})=>{if(r.config.requests.enabled){let o=new Set,i={properties:{body:{type:"never"},path:{type:"never"},query:{type:"never"}},type:"object"};if(t.parameters){if(t.parameters.header){let p={},c=[];for(let m in t.parameters.header){let l=t.parameters.header[m];p[l.name]=l.schema,l.required&&(c.push(l.name),o.add("headers"));}Object.keys(p).length&&(i.properties.headers={properties:p,required:c,type:"object"});}if(t.parameters.path){let p={},c=[];for(let m in t.parameters.path){let l=t.parameters.path[m];p[l.name]=l.schema,l.required&&(c.push(l.name),o.add("path"));}Object.keys(p).length&&(i.properties.path={properties:p,required:c,type:"object"});}if(t.parameters.query){let p={},c=[];for(let m in t.parameters.query){let l=t.parameters.query[m];p[l.name]=l.schema,l.required&&(c.push(l.name),o.add("query"));}Object.keys(p).length&&(i.properties.query={properties:p,required:c,type:"object"});}}t.body&&(i.properties.body=t.body.schema,t.body.required&&o.add("body")),i.required=[...o];let a=r.registerSymbol({exported:true,meta:{resourceType:er(e)},name:O({config:r.config.requests,name:t.id}),selector:r.api.getSelector("data",t.id)});me({_path:e,plugin:r,schema:i,state:n,symbol:a});}if(r.config.responses.enabled&&t.responses){let{response:o}=We(t);if(o){let i=[...e,"responses"],a=r.registerSymbol({exported:true,meta:{resourceType:er(i)},name:O({config:r.config.responses,name:t.id}),selector:r.api.getSelector("responses",t.id)});me({_path:i,plugin:r,schema:o,state:n,symbol:a});}}};var bm=({_path:e,operation:t,plugin:r,state:n})=>{if(r.config.webhooks.enabled){let o=new Set,i={properties:{body:{type:"never"},path:{type:"never"},query:{type:"never"}},type:"object"};if(t.parameters){if(t.parameters.header){let p={},c=[];for(let m in t.parameters.header){let l=t.parameters.header[m];p[l.name]=l.schema,l.required&&(c.push(l.name),o.add("headers"));}Object.keys(p).length&&(i.properties.headers={properties:p,required:c,type:"object"});}if(t.parameters.path){let p={},c=[];for(let m in t.parameters.path){let l=t.parameters.path[m];p[l.name]=l.schema,l.required&&(c.push(l.name),o.add("path"));}Object.keys(p).length&&(i.properties.path={properties:p,required:c,type:"object"});}if(t.parameters.query){let p={},c=[];for(let m in t.parameters.query){let l=t.parameters.query[m];p[l.name]=l.schema,l.required&&(c.push(l.name),o.add("query"));}Object.keys(p).length&&(i.properties.query={properties:p,required:c,type:"object"});}}t.body&&(i.properties.body=t.body.schema,t.body.required&&o.add("body")),i.required=[...o];let a=r.registerSymbol({exported:true,meta:{resourceType:er(e)},name:O({config:r.config.webhooks,name:t.id}),selector:r.api.getSelector("webhook-request",t.id)});me({_path:e,plugin:r,schema:i,state:n,symbol:a});}};var $e=({pipes:e,plugin:t})=>{if(e.length===1)return e[0];let r=t.referenceSymbol(t.api.getSelector("import","valibot"));return s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:T.methods.pipe}),parameters:e})},Ju=({_path:e,plugin:t,schema:r,state:n})=>{let o=t.referenceSymbol(t.api.getSelector("import","valibot")),i=s.propertyAccessExpression({expression:o.placeholder,name:T.schemas.array}),a=[];if(r.items){r=Z({schema:r});let p=r.items.map((c,m)=>{let l=me({_path:[...e,"items",m],plugin:t,schema:c,state:n});return $e({pipes:l,plugin:t})});if(p.length===1){let c=s.callExpression({functionName:i,parameters:p});a.push(c);}else {r.logicalOperator;let c=s.callExpression({functionName:i,parameters:[mn({plugin:t})]});a.push(c);}}else {let p=s.callExpression({functionName:i,parameters:[mn({plugin:t})]});a.push(p);}if(r.minItems===r.maxItems&&r.minItems!==void 0){let p=s.callExpression({functionName:s.propertyAccessExpression({expression:o.placeholder,name:T.actions.length}),parameters:[s.valueToExpression({value:r.minItems})]});a.push(p);}else {if(r.minItems!==void 0){let p=s.callExpression({functionName:s.propertyAccessExpression({expression:o.placeholder,name:T.actions.minLength}),parameters:[s.valueToExpression({value:r.minItems})]});a.push(p);}if(r.maxItems!==void 0){let p=s.callExpression({functionName:s.propertyAccessExpression({expression:o.placeholder,name:T.actions.maxLength}),parameters:[s.valueToExpression({value:r.maxItems})]});a.push(p);}}return $e({pipes:a,plugin:t})},Gu=({plugin:e,schema:t})=>{let r=e.referenceSymbol(e.api.getSelector("import","valibot"));return typeof t.const=="boolean"?s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:T.schemas.literal}),parameters:[s.ots.boolean(t.const)]}):s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:T.schemas.boolean})})},Yu=({_path:e,plugin:t,schema:r})=>{let n=[],o=false;for(let p of r.items??[])p.type==="string"&&typeof p.const=="string"?n.push(s.stringLiteral({text:p.const})):(p.type==="null"||p.const===null)&&(o=true);if(!n.length)return mn({plugin:t});let i=t.referenceSymbol(t.api.getSelector("import","valibot")),a=s.callExpression({functionName:s.propertyAccessExpression({expression:i.placeholder,name:T.schemas.picklist}),parameters:[s.arrayLiteralExpression({elements:n,multiLine:false})]});return o&&(a=s.callExpression({functionName:s.propertyAccessExpression({expression:i.placeholder,name:T.schemas.nullable}),parameters:[a]})),a},ey=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector("import","valibot"));return s.callExpression({functionName:s.propertyAccessExpression({expression:t.placeholder,name:T.schemas.never})})},ty=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector("import","valibot"));return s.callExpression({functionName:s.propertyAccessExpression({expression:t.placeholder,name:T.schemas.null})})},Sm=({plugin:e,schema:t})=>{let r=t.format,n=t.type==="integer",o=gm(r),i=fi(r)?mo[r]:null,a=e.referenceSymbol(e.api.getSelector("import","valibot"));if(t.const!==void 0&&t.const!==null){let c=t.const,m;if(typeof c=="number"&&!r)m=s.ots.number(c);else if(typeof c=="number"&&r)o?m=s.callExpression({functionName:"BigInt",parameters:[s.ots.string(c.toString())]}):m=s.ots.number(c);else if(typeof c=="string"&&o){let l=c.endsWith("n")?c.slice(0,-1):c;m=s.callExpression({functionName:"BigInt",parameters:[s.ots.string(l)]});}else if(typeof c=="bigint"){let l=c.toString(),f=l.endsWith("n")?l.slice(0,-1):l;m=s.callExpression({functionName:"BigInt",parameters:[s.ots.string(f)]});}else m=s.valueToExpression({value:c});return s.callExpression({functionName:s.propertyAccessExpression({expression:a.placeholder,name:T.schemas.literal}),parameters:[m]})}let p=[];if(o){let c=s.callExpression({functionName:s.propertyAccessExpression({expression:a.placeholder,name:T.schemas.union}),parameters:[s.arrayLiteralExpression({elements:[s.callExpression({functionName:s.propertyAccessExpression({expression:a.placeholder,name:T.schemas.number})}),s.callExpression({functionName:s.propertyAccessExpression({expression:a.placeholder,name:T.schemas.string})}),s.callExpression({functionName:s.propertyAccessExpression({expression:a.placeholder,name:T.schemas.bigInt})})],multiLine:false})]});p.push(c);let m=s.callExpression({functionName:s.propertyAccessExpression({expression:a.placeholder,name:T.actions.transform}),parameters:[s.arrowFunction({parameters:[{name:"x"}],statements:s.callExpression({functionName:"BigInt",parameters:[s.identifier({text:"x"})]})})]});p.push(m);}else {let c=s.callExpression({functionName:s.propertyAccessExpression({expression:a.placeholder,name:T.schemas.number})});p.push(c);}if(!o&&n){let c=s.callExpression({functionName:s.propertyAccessExpression({expression:a.placeholder,name:T.actions.integer})});p.push(c);}if(i){let c=i.min,m=i.max,l=i.minError,f=i.maxError,d=s.callExpression({functionName:s.propertyAccessExpression({expression:a.placeholder,name:T.actions.minValue}),parameters:[o?s.callExpression({functionName:"BigInt",parameters:[s.ots.string(c.toString())]}):s.ots.number(c),s.ots.string(l)]});p.push(d);let u=s.callExpression({functionName:s.propertyAccessExpression({expression:a.placeholder,name:T.actions.maxValue}),parameters:[o?s.callExpression({functionName:"BigInt",parameters:[s.ots.string(m.toString())]}):s.ots.number(m),s.ots.string(f)]});p.push(u);}if(t.exclusiveMinimum!==void 0){let c=s.callExpression({functionName:s.propertyAccessExpression({expression:a.placeholder,name:T.actions.gtValue}),parameters:[$r({isBigInt:o,value:t.exclusiveMinimum})]});p.push(c);}else if(t.minimum!==void 0){let c=s.callExpression({functionName:s.propertyAccessExpression({expression:a.placeholder,name:T.actions.minValue}),parameters:[$r({isBigInt:o,value:t.minimum})]});p.push(c);}if(t.exclusiveMaximum!==void 0){let c=s.callExpression({functionName:s.propertyAccessExpression({expression:a.placeholder,name:T.actions.ltValue}),parameters:[$r({isBigInt:o,value:t.exclusiveMaximum})]});p.push(c);}else if(t.maximum!==void 0){let c=s.callExpression({functionName:s.propertyAccessExpression({expression:a.placeholder,name:T.actions.maxValue}),parameters:[$r({isBigInt:o,value:t.maximum})]});p.push(c);}return $e({pipes:p,plugin:e})},ry=({_path:e,plugin:t,schema:r,state:n})=>{let o=[],i=r.required??[];for(let c in r.properties){let m=r.properties[c],l=i.includes(c),f=me({_path:[...e,"properties",c],optional:!l,plugin:t,schema:m,state:n});ee.lastIndex=0;let d;ee.test(c)?d=c.startsWith("-")?S.factory.createStringLiteral(c):S.factory.createNumericLiteral(c):d=c,(c.match(/^[0-9]/)&&c.match(/\D+/g)||c.match(/\W/g))&&!c.startsWith("'")&&!c.endsWith("'")&&(d=`'${c}'`),o.push(s.propertyAssignment({initializer:$e({pipes:f,plugin:t}),name:d}));}let a=t.referenceSymbol(t.api.getSelector("import","valibot"));if(r.additionalProperties&&r.additionalProperties.type==="object"&&!Object.keys(o).length){let c=me({_path:[...e,"additionalProperties"],plugin:t,schema:r.additionalProperties,state:n});return {anyType:"AnyZodObject",expression:s.callExpression({functionName:s.propertyAccessExpression({expression:a.placeholder,name:T.schemas.record}),parameters:[s.callExpression({functionName:s.propertyAccessExpression({expression:a.placeholder,name:T.schemas.string}),parameters:[]}),$e({pipes:c,plugin:t})]})}}let p=s.callExpression({functionName:s.propertyAccessExpression({expression:a.placeholder,name:T.schemas.object}),parameters:[S.factory.createObjectLiteralExpression(o,true)]});return {anyType:T.types.GenericSchema.text,expression:p}},ny=({plugin:e,schema:t})=>{let r=e.referenceSymbol(e.api.getSelector("import","valibot"));if(typeof t.const=="string")return s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:T.schemas.literal}),parameters:[s.ots.string(t.const)]});let n=[],o=s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:T.schemas.string})});if(n.push(o),t.format)switch(t.format){case "date":n.push(s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:T.actions.isoDate})}));break;case "date-time":n.push(s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:T.actions.isoTimestamp})}));break;case "ipv4":case "ipv6":n.push(s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:T.actions.ip})}));break;case "uri":n.push(s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:T.actions.url})}));break;case "email":case "time":case "uuid":n.push(s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:s.identifier({text:t.format})})}));break}if(t.minLength===t.maxLength&&t.minLength!==void 0){let i=s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:T.actions.length}),parameters:[s.valueToExpression({value:t.minLength})]});n.push(i);}else {if(t.minLength!==void 0){let i=s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:T.actions.minLength}),parameters:[s.valueToExpression({value:t.minLength})]});n.push(i);}if(t.maxLength!==void 0){let i=s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:T.actions.maxLength}),parameters:[s.valueToExpression({value:t.maxLength})]});n.push(i);}}if(t.pattern){let i=s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:T.actions.regex}),parameters:[s.regularExpressionLiteral({text:t.pattern})]});n.push(i);}return $e({pipes:n,plugin:e})},sy=({_path:e,plugin:t,schema:r,state:n})=>{let o=t.referenceSymbol(t.api.getSelector("import","valibot"));if(r.const&&Array.isArray(r.const)){let i=r.const.map(p=>s.callExpression({functionName:s.propertyAccessExpression({expression:o.placeholder,name:T.schemas.literal}),parameters:[s.valueToExpression({value:p})]}));return s.callExpression({functionName:s.propertyAccessExpression({expression:o.placeholder,name:T.schemas.tuple}),parameters:[s.arrayLiteralExpression({elements:i})]})}if(r.items){let i=r.items.map((p,c)=>{let m=me({_path:[...e,"items",c],plugin:t,schema:p,state:n});return $e({pipes:m,plugin:t})});return s.callExpression({functionName:s.propertyAccessExpression({expression:o.placeholder,name:T.schemas.tuple}),parameters:[s.arrayLiteralExpression({elements:i})]})}return mn({plugin:t})},oy=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector("import","valibot"));return s.callExpression({functionName:s.propertyAccessExpression({expression:t.placeholder,name:T.schemas.undefined})})},mn=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector("import","valibot"));return s.callExpression({functionName:s.propertyAccessExpression({expression:t.placeholder,name:T.schemas.unknown})})},iy=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector("import","valibot"));return s.callExpression({functionName:s.propertyAccessExpression({expression:t.placeholder,name:T.schemas.void})})},Om=({_path:e,plugin:t,schema:r,state:n})=>{switch(r.type){case "array":return {expression:Ju({_path:e,plugin:t,schema:r,state:n})};case "boolean":return {expression:Gu({plugin:t,schema:r})};case "enum":return {expression:Yu({_path:e,plugin:t,schema:r})};case "integer":case "number":return {expression:Sm({plugin:t,schema:r})};case "never":return {expression:ey({plugin:t})};case "null":return {expression:ty({plugin:t})};case "object":return ry({_path:e,plugin:t,schema:r,state:n});case "string":return r.format==="int64"||r.format==="uint64"?{expression:Sm({plugin:t,schema:r})}:{expression:ny({plugin:t,schema:r})};case "tuple":return {expression:sy({_path:e,plugin:t,schema:r,state:n})};case "undefined":return {expression:oy({plugin:t})};case "unknown":return {expression:mn({plugin:t})};case "void":return {expression:iy({plugin:t})}}},me=({$ref:e,_path:t=[],optional:r,plugin:n,schema:o,state:i,symbol:a})=>{let p,c=[];if(e&&(i.circularReferenceTracker.add(e),!a)){let l=n.api.getSelector("ref",e);n.getSymbol(l)||(a=n.referenceSymbol(l));}let m=n.referenceSymbol(n.api.getSelector("import","valibot"));if(o.$ref){let l=i.circularReferenceTracker.has(o.$ref),f=n.api.getSelector("ref",o.$ref),d=n.getSymbol(f);if(!d){let u=n.context.resolveIrRef(o.$ref),y=me({$ref:o.$ref,_path:Pe(o.$ref),plugin:n,schema:u,state:i});c.push(...y),d=n.getSymbol(f);}if(d){let u=s.identifier({text:d.placeholder});if(l){let y=s.callExpression({functionName:s.propertyAccessExpression({expression:m.placeholder,name:T.schemas.lazy}),parameters:[s.arrowFunction({statements:[s.returnStatement({expression:u})]})]});c.push(y),i.hasCircularReference=true;}else c.push(u);}}else if(o.type){let l=Om({_path:t,plugin:n,schema:o,state:i});if(p=l.anyType,c.push(l.expression),n.config.metadata&&o.description){let f=s.callExpression({functionName:s.propertyAccessExpression({expression:m.placeholder,name:T.actions.metadata}),parameters:[s.objectExpression({obj:[{key:"description",value:s.stringLiteral({text:o.description})}]})]});c.push(f);}}else if(o.items)if(o=Z({schema:o}),o.items){let l=o.items.map((f,d)=>{let u=me({_path:[...t,"items",d],plugin:n,schema:f,state:i});return $e({pipes:u,plugin:n})});if(o.logicalOperator==="and"){let f=s.callExpression({functionName:s.propertyAccessExpression({expression:m.placeholder,name:T.schemas.intersect}),parameters:[s.arrayLiteralExpression({elements:l})]});c.push(f);}else {let f=s.callExpression({functionName:s.propertyAccessExpression({expression:m.placeholder,name:T.schemas.union}),parameters:[s.arrayLiteralExpression({elements:l})]});c.push(f);}}else {let l=me({_path:t,plugin:n,schema:o,state:i});c.push(...l);}else {let l=Om({_path:t,plugin:n,schema:{type:"unknown"},state:i});p=l.anyType,c.push(l.expression);}if(e&&i.circularReferenceTracker.delete(e),c.length&&o.accessScope==="read"){let l=s.callExpression({functionName:s.propertyAccessExpression({expression:m.placeholder,name:T.actions.readonly})});c.push(l);}if(c.length){let l;if(o.default!==void 0){let f=o.type==="integer"&&o.format==="int64";l=$r({isBigInt:f,value:o.default}),l&&(c=[s.callExpression({functionName:s.propertyAccessExpression({expression:m.placeholder,name:T.schemas.optional}),parameters:[$e({pipes:c,plugin:n}),l]})]);}r&&!l&&(c=[s.callExpression({functionName:s.propertyAccessExpression({expression:m.placeholder,name:T.schemas.optional}),parameters:[$e({pipes:c,plugin:n})]})]);}if(a){e&&(a=n.registerSymbol({exported:true,meta:{resourceType:er(t)},name:O({config:{case:i.nameCase,name:i.nameTransformer},name:F(e)}),selector:n.api.getSelector("ref",e)}));let l=s.constVariable({comment:n.config.comments?he({schema:o}):void 0,exportConst:a.exported,expression:$e({pipes:c,plugin:n}),name:a.placeholder,typeName:i.hasCircularReference?s.propertyAccessExpression({expression:m.placeholder,name:p||T.types.GenericSchema.text}):void 0});return n.setSymbolValue(a,l),[]}return c},Tm=({plugin:e})=>{e.registerSymbol({external:"valibot",meta:{importKind:"namespace"},name:"v",selector:e.api.getSelector("import","valibot")}),e.forEach("operation","parameter","requestBody","schema","webhook",t=>{let r={circularReferenceTracker:new Set,hasCircularReference:false,nameCase:e.config.definitions.case,nameTransformer:e.config.definitions.name};switch(t.type){case "operation":xm({_path:t._path,operation:t.operation,plugin:e,state:r});break;case "parameter":me({$ref:t.$ref,_path:t._path,plugin:e,schema:t.parameter.schema,state:r});break;case "requestBody":me({$ref:t.$ref,_path:t._path,plugin:e,schema:t.requestBody.schema,state:r});break;case "schema":me({$ref:t.$ref,_path:t._path,plugin:e,schema:t.schema,state:r});break;case "webhook":bm({_path:t._path,operation:t.operation,plugin:e,state:r});break}});};var lo={api:new co({name:"valibot"}),config:{case:"camelCase",comments:true,exportFromIndex:false,metadata:false},handler:Tm,name:"valibot",resolveConfig:(e,t)=>{e.config.definitions=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"v{{name}}"},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.definitions}),e.config.requests=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"v{{name}}Data"},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.requests}),e.config.responses=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"v{{name}}Response"},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.responses}),e.config.webhooks=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"v{{name}}WebhookRequest"},mappers:{boolean:r=>({enabled:r}),function:r=>({name:r}),string:r=>({name:r})},value:e.config.webhooks});},tags:["validator"]};var h={ZodMiniOptional:s.identifier({text:"ZodMiniOptional"}),ZodOptional:s.identifier({text:"ZodOptional"}),_default:s.identifier({text:"_default"}),and:s.identifier({text:"and"}),array:s.identifier({text:"array"}),bigint:s.identifier({text:"bigint"}),boolean:s.identifier({text:"boolean"}),check:s.identifier({text:"check"}),coerce:s.identifier({text:"coerce"}),date:s.identifier({text:"date"}),datetime:s.identifier({text:"datetime"}),default:s.identifier({text:"default"}),describe:s.identifier({text:"describe"}),email:s.identifier({text:"email"}),enum:s.identifier({text:"enum"}),globalRegistry:s.identifier({text:"globalRegistry"}),gt:s.identifier({text:"gt"}),gte:s.identifier({text:"gte"}),infer:s.identifier({text:"infer"}),int:s.identifier({text:"int"}),intersection:s.identifier({text:"intersection"}),ip:s.identifier({text:"ip"}),ipv4:s.identifier({text:"ipv4"}),ipv6:s.identifier({text:"ipv6"}),iso:s.identifier({text:"iso"}),lazy:s.identifier({text:"lazy"}),length:s.identifier({text:"length"}),literal:s.identifier({text:"literal"}),lt:s.identifier({text:"lt"}),lte:s.identifier({text:"lte"}),max:s.identifier({text:"max"}),maxLength:s.identifier({text:"maxLength"}),min:s.identifier({text:"min"}),minLength:s.identifier({text:"minLength"}),never:s.identifier({text:"never"}),null:s.identifier({text:"null"}),nullable:s.identifier({text:"nullable"}),number:s.identifier({text:"number"}),object:s.identifier({text:"object"}),optional:s.identifier({text:"optional"}),parseAsync:s.identifier({text:"parseAsync"}),readonly:s.identifier({text:"readonly"}),record:s.identifier({text:"record"}),regex:s.identifier({text:"regex"}),register:s.identifier({text:"register"}),string:s.identifier({text:"string"}),time:s.identifier({text:"time"}),tuple:s.identifier({text:"tuple"}),undefined:s.identifier({text:"undefined"}),union:s.identifier({text:"union"}),unknown:s.identifier({text:"unknown"}),url:s.identifier({text:"url"}),uuid:s.identifier({text:"uuid"}),void:s.identifier({text:"void"})};var fo=class{constructor(t){this.meta=t;}createRequestValidator({operation:t,plugin:r}){let n=r.getSymbol(r.api.getSelector("data",t.id));if(!n)return;let o="data";return s.arrowFunction({async:true,parameters:[{name:o}],statements:[s.returnStatement({expression:s.awaitExpression({expression:s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.parseAsync}),parameters:[s.identifier({text:o})]})})})]})}createResponseValidator({operation:t,plugin:r}){let n=r.getSymbol(r.api.getSelector("responses",t.id));if(!n)return;let o="data";return s.arrowFunction({async:true,parameters:[{name:o}],statements:[s.returnStatement({expression:s.awaitExpression({expression:s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.parseAsync}),parameters:[s.identifier({text:o})]})})})]})}getSelector(...t){return [this.meta.name,...t]}};var Me=({plugin:e,schema:t,symbol:r,typeInferSymbol:n,zodSchema:o})=>{let i=e.referenceSymbol(e.api.getSelector("import","zod")),a=s.constVariable({comment:e.config.comments?he({schema:t}):void 0,exportConst:r.exported,expression:o.expression,name:r.placeholder,typeName:o.typeName?s.propertyAccessExpression({expression:i.placeholder,name:o.typeName}):void 0});if(e.setSymbolValue(r,a),n){let p=s.typeAliasDeclaration({exportType:n.exported,name:n.placeholder,type:s.typeReferenceNode({typeArguments:[s.typeOfExpression({text:r.placeholder})],typeName:s.propertyAccessExpression({expression:i.placeholder,name:h.infer})})});e.setSymbolValue(n,p);}};var Mr=({plugin:e})=>{let t=e.package.getVersion("zod");if(t&&e.package.satisfies(t,"<4.0.0"))switch(e.config.compatibilityVersion){case 3:default:return "zod";case 4:return "zod/v4";case "mini":return "zod/v4-mini"}switch(e.config.compatibilityVersion){case 3:return "zod/v3";case 4:default:return "zod";case "mini":return "zod/mini"}};var Lr=({getZodSchema:e,operation:t,plugin:r})=>{if(r.config.requests.enabled){let n=new Set,o={properties:{body:{type:"never"},path:{type:"never"},query:{type:"never"}},type:"object"};if(t.parameters){if(t.parameters.header){let c={},m=[];for(let l in t.parameters.header){let f=t.parameters.header[l];c[f.name]=f.schema,f.required&&(m.push(f.name),n.add("headers"));}Object.keys(c).length&&(o.properties.headers={properties:c,required:m,type:"object"});}if(t.parameters.path){let c={},m=[];for(let l in t.parameters.path){let f=t.parameters.path[l];c[f.name]=f.schema,f.required&&(m.push(f.name),n.add("path"));}Object.keys(c).length&&(o.properties.path={properties:c,required:m,type:"object"});}if(t.parameters.query){let c={},m=[];for(let l in t.parameters.query){let f=t.parameters.query[l];c[f.name]=f.schema,f.required&&(m.push(f.name),n.add("query"));}Object.keys(c).length&&(o.properties.query={properties:c,required:m,type:"object"});}}t.body&&(o.properties.body=t.body.schema,t.body.required&&n.add("body")),o.required=[...n];let i=e(o),a=r.registerSymbol({exported:true,name:O({config:r.config.requests,name:t.id}),selector:r.api.getSelector("data",t.id)}),p=r.config.requests.types.infer.enabled?r.registerSymbol({exported:true,meta:{kind:"type"},name:O({config:r.config.requests.types.infer,name:t.id}),selector:r.api.getSelector("type-infer-data",t.id)}):void 0;Me({plugin:r,schema:o,symbol:a,typeInferSymbol:p,zodSchema:i});}if(r.config.responses.enabled&&t.responses){let{response:n}=We(t);if(n){let o=e(n),i=r.registerSymbol({exported:true,name:O({config:r.config.responses,name:t.id}),selector:r.api.getSelector("responses",t.id)}),a=r.config.responses.types.infer.enabled?r.registerSymbol({exported:true,meta:{kind:"type"},name:O({config:r.config.responses.types.infer,name:t.id}),selector:r.api.getSelector("type-infer-responses",t.id)}):void 0;Me({plugin:r,schema:n,symbol:i,typeInferSymbol:a,zodSchema:o});}}};var Vr=({getZodSchema:e,operation:t,plugin:r})=>{if(r.config.webhooks.enabled){let n=new Set,o={properties:{body:{type:"never"},path:{type:"never"},query:{type:"never"}},type:"object"};if(t.parameters){if(t.parameters.header){let c={},m=[];for(let l in t.parameters.header){let f=t.parameters.header[l];c[f.name]=f.schema,f.required&&(m.push(f.name),n.add("headers"));}Object.keys(c).length&&(o.properties.headers={properties:c,required:m,type:"object"});}if(t.parameters.path){let c={},m=[];for(let l in t.parameters.path){let f=t.parameters.path[l];c[f.name]=f.schema,f.required&&(m.push(f.name),n.add("path"));}Object.keys(c).length&&(o.properties.path={properties:c,required:m,type:"object"});}if(t.parameters.query){let c={},m=[];for(let l in t.parameters.query){let f=t.parameters.query[l];c[f.name]=f.schema,f.required&&(m.push(f.name),n.add("query"));}Object.keys(c).length&&(o.properties.query={properties:c,required:m,type:"object"});}}t.body&&(o.properties.body=t.body.schema,t.body.required&&n.add("body")),o.required=[...n];let i=e(o),a=r.registerSymbol({exported:true,name:O({config:r.config.webhooks,name:t.id}),selector:r.api.getSelector("webhook-request",t.id)}),p=r.config.webhooks.types.infer.enabled?r.registerSymbol({exported:true,meta:{kind:"type"},name:O({config:r.config.webhooks.types.infer,name:t.id}),selector:r.api.getSelector("type-infer-webhook-request",t.id)}):void 0;Me({plugin:r,schema:o,symbol:a,typeInferSymbol:p,zodSchema:i});}};var py=({plugin:e,schema:t,state:r})=>{let n=e.referenceSymbol(e.api.getSelector("import","zod")),o={},i=s.propertyAccessExpression({expression:n.placeholder,name:h.array});if(!t.items)o.expression=s.callExpression({functionName:i,parameters:[yi({plugin:e}).expression]});else {t=Z({schema:t});let p=t.items.map(c=>{let m=St({plugin:e,schema:c,state:r});return m.hasCircularReference&&(o.hasCircularReference=true),m.expression});if(p.length===1)o.expression=s.callExpression({functionName:i,parameters:p});else if(t.logicalOperator==="and"){let c=t.items[0],m;if(c.logicalOperator==="or"||c.type&&c.type!=="object")m=s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.intersection}),parameters:p});else {m=p[0];for(let l=1;l<p.length;l++)m=s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.intersection}),parameters:[m,p[l]]});}o.expression=s.callExpression({functionName:i,parameters:[m]});}else o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.array}),parameters:[s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.union}),parameters:[s.arrayLiteralExpression({elements:p})]})]});}let a=[];return t.minItems===t.maxItems&&t.minItems!==void 0?a.push(s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.length}),parameters:[s.valueToExpression({value:t.minItems})]})):(t.minItems!==void 0&&a.push(s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.minLength}),parameters:[s.valueToExpression({value:t.minItems})]})),t.maxItems!==void 0&&a.push(s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.maxLength}),parameters:[s.valueToExpression({value:t.maxItems})]}))),a.length&&(o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:o.expression,name:h.check}),parameters:a})),o},cy=({plugin:e,schema:t})=>{let r=e.referenceSymbol(e.api.getSelector("import","zod")),n={};return typeof t.const=="boolean"?(n.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.literal}),parameters:[s.ots.boolean(t.const)]}),n):(n.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.boolean})}),n)},my=({plugin:e,schema:t})=>{let r=e.referenceSymbol(e.api.getSelector("import","zod")),n={},o=[],i=[],a=false,p=true;for(let c of t.items??[])if(c.type==="string"&&typeof c.const=="string"){let m=s.stringLiteral({text:c.const});o.push(m),i.push(s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.literal}),parameters:[m]}));}else if((c.type==="number"||c.type==="integer")&&typeof c.const=="number"){p=false;let m=s.ots.number(c.const);i.push(s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.literal}),parameters:[m]}));}else if(c.type==="boolean"&&typeof c.const=="boolean"){p=false;let m=s.ots.boolean(c.const);i.push(s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.literal}),parameters:[m]}));}else (c.type==="null"||c.const===null)&&(a=true);return i.length?(p&&o.length>0?n.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.enum}),parameters:[s.arrayLiteralExpression({elements:o,multiLine:false})]}):i.length===1?n.expression=i[0]:n.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.union}),parameters:[s.arrayLiteralExpression({elements:i,multiLine:i.length>3})]}),a&&(n.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.nullable}),parameters:[n.expression]})),n):yi({plugin:e})},ly=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector("import","zod")),r={};return r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:t.placeholder,name:h.never})}),r},fy=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector("import","zod")),r={};return r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:t.placeholder,name:h.null})}),r},ln=({isBigInt:e,value:t})=>{let r=s.valueToExpression({value:t});return e&&(typeof t=="bigint"||typeof t=="number"||typeof t=="string"||typeof t=="boolean")?s.callExpression({functionName:"BigInt",parameters:[r]}):r},dy=({plugin:e,schema:t})=>{let r=e.referenceSymbol(e.api.getSelector("import","zod")),n={},o=t.type==="integer"&&t.format==="int64";if(typeof t.const=="number")return n.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.literal}),parameters:[s.ots.number(t.const)]}),n;n.expression=s.callExpression({functionName:o?s.propertyAccessExpression({expression:s.propertyAccessExpression({expression:r.placeholder,name:h.coerce}),name:h.bigint}):s.propertyAccessExpression({expression:r.placeholder,name:h.number})}),!o&&t.type==="integer"&&(n.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.int})}));let i=[];return t.exclusiveMinimum!==void 0?i.push(s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.gt}),parameters:[ln({isBigInt:o,value:t.exclusiveMinimum})]})):t.minimum!==void 0&&i.push(s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.gte}),parameters:[ln({isBigInt:o,value:t.minimum})]})),t.exclusiveMaximum!==void 0?i.push(s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.lt}),parameters:[ln({isBigInt:o,value:t.exclusiveMaximum})]})):t.maximum!==void 0&&i.push(s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.lte}),parameters:[ln({isBigInt:o,value:t.maximum})]})),i.length&&(n.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:n.expression,name:h.check}),parameters:i})),n},uy=({plugin:e,schema:t,state:r})=>{let n=e.referenceSymbol(e.api.getSelector("import","zod")),o={},i=[],a=t.required??[];for(let p in t.properties){let c=t.properties[p],m=a.includes(p),l=St({optional:!m,plugin:e,schema:c,state:r});l.hasCircularReference&&(o.hasCircularReference=true),ee.lastIndex=0;let f;ee.test(p)?f=p.startsWith("-")?S.factory.createStringLiteral(p):S.factory.createNumericLiteral(p):f=p,(p.match(/^[0-9]/)&&p.match(/\D+/g)||p.match(/\W/g))&&!p.startsWith("'")&&!p.endsWith("'")&&(f=`'${p}'`),l.hasCircularReference?i.push(s.getAccessorDeclaration({name:f,returnType:l.typeName?s.propertyAccessExpression({expression:n.placeholder,name:l.typeName}):void 0,statements:[s.returnStatement({expression:l.expression})]})):i.push(s.propertyAssignment({initializer:l.expression,name:f}));}if(t.additionalProperties&&(!t.properties||!Object.keys(t.properties).length)){let p=St({plugin:e,schema:t.additionalProperties,state:r});return o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.record}),parameters:[s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.string}),parameters:[]}),p.expression]}),p.hasCircularReference&&(o.hasCircularReference=true),o}return o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.object}),parameters:[S.factory.createObjectLiteralExpression(i,true)]}),o},yy=({plugin:e,schema:t})=>{let r=e.referenceSymbol(e.api.getSelector("import","zod")),n={};if(typeof t.const=="string")return n.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.literal}),parameters:[s.ots.string(t.const)]}),n;n.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.string})});let o=[];if(e.config.dates.offset&&o.push({key:"offset",value:true}),e.config.dates.local&&o.push({key:"local",value:true}),t.format)switch(t.format){case "date":n.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:s.propertyAccessExpression({expression:r.placeholder,name:h.iso}),name:h.date})});break;case "date-time":n.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:s.propertyAccessExpression({expression:r.placeholder,name:h.iso}),name:h.datetime}),parameters:o.length>0?[s.objectExpression({obj:o})]:[]});break;case "email":n.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.email})});break;case "ipv4":n.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.ipv4})});break;case "ipv6":n.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.ipv6})});break;case "time":n.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:s.propertyAccessExpression({expression:r.placeholder,name:h.iso}),name:h.time})});break;case "uri":n.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.url})});break;case "uuid":n.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.uuid})});break}let i=[];return t.minLength===t.maxLength&&t.minLength!==void 0?i.push(s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.length}),parameters:[s.valueToExpression({value:t.minLength})]})):(t.minLength!==void 0&&i.push(s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.minLength}),parameters:[s.valueToExpression({value:t.minLength})]})),t.maxLength!==void 0&&i.push(s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.maxLength}),parameters:[s.valueToExpression({value:t.maxLength})]}))),t.pattern&&i.push(s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.regex}),parameters:[s.regularExpressionLiteral({text:t.pattern})]})),i.length&&(n.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:n.expression,name:h.check}),parameters:i})),n},hy=({plugin:e,schema:t,state:r})=>{let n=e.referenceSymbol(e.api.getSelector("import","zod")),o={};if(t.const&&Array.isArray(t.const)){let a=t.const.map(p=>s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.literal}),parameters:[s.valueToExpression({value:p})]}));return o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.tuple}),parameters:[s.arrayLiteralExpression({elements:a})]}),o}let i=[];for(let a of t.items??[]){let p=St({plugin:e,schema:a,state:r});i.push(p.expression),p.hasCircularReference&&(o.hasCircularReference=true);}return o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.tuple}),parameters:[s.arrayLiteralExpression({elements:i})]}),o},gy=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector("import","zod")),r={};return r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:t.placeholder,name:h.undefined})}),r},yi=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector("import","zod")),r={};return r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:t.placeholder,name:h.unknown})}),r},xy=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector("import","zod")),r={};return r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:t.placeholder,name:h.void})}),r},Rm=({plugin:e,schema:t,state:r})=>{switch(t.type){case "array":return py({plugin:e,schema:t,state:r});case "boolean":return cy({plugin:e,schema:t});case "enum":return my({plugin:e,schema:t});case "integer":case "number":return dy({plugin:e,schema:t});case "never":return ly({plugin:e});case "null":return fy({plugin:e});case "object":return uy({plugin:e,schema:t,state:r});case "string":return yy({plugin:e,schema:t});case "tuple":return hy({plugin:e,schema:t,state:r});case "undefined":return gy({plugin:e});case "unknown":return yi({plugin:e});case "void":return xy({plugin:e})}},St=({optional:e,plugin:t,schema:r,state:n})=>{let o={},i=t.referenceSymbol(t.api.getSelector("import","zod"));if(r.$ref){let a=n.circularReferenceTracker.includes(r.$ref),p=n.currentReferenceTracker.includes(r.$ref);n.circularReferenceTracker.push(r.$ref),n.currentReferenceTracker.push(r.$ref);let c=t.api.getSelector("ref",r.$ref),m=t.getSymbol(c);if(a)m||(m=t.referenceSymbol(c)),p?o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:i.placeholder,name:h.lazy}),parameters:[s.arrowFunction({returnType:s.keywordTypeNode({keyword:"any"}),statements:[s.returnStatement({expression:s.identifier({text:m.placeholder})})]})]}):o.expression=s.identifier({text:m.placeholder}),o.hasCircularReference=r.circular;else {if(m)o.hasCircularReference=r.circular;else {let f=t.context.resolveIrRef(r.$ref);uo({id:r.$ref,plugin:t,schema:f,state:n});}let l=t.referenceSymbol(c);o.expression=s.identifier({text:l.placeholder});}n.circularReferenceTracker.pop(),n.currentReferenceTracker.pop();}else if(r.type){let a=Rm({plugin:t,schema:r,state:n});o.expression=a.expression,o.hasCircularReference=a.hasCircularReference,t.config.metadata&&r.description&&(o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:o.expression,name:h.register}),parameters:[s.propertyAccessExpression({expression:i.placeholder,name:h.globalRegistry}),s.objectExpression({obj:[{key:"description",value:s.stringLiteral({text:r.description})}]})]}));}else if(r.items)if(r=Z({schema:r}),r.items){let a=r.items.map(p=>St({plugin:t,schema:p,state:n}));if(r.logicalOperator==="and"){let p=r.items[0];p.logicalOperator==="or"||p.type&&p.type!=="object"?o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:i.placeholder,name:h.intersection}),parameters:a.map(c=>c.expression)}):(o.expression=a[0].expression,a.slice(1).forEach(c=>{o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:i.placeholder,name:h.intersection}),parameters:[o.expression,c.hasCircularReference?s.callExpression({functionName:s.propertyAccessExpression({expression:i.placeholder,name:h.lazy}),parameters:[s.arrowFunction({statements:[s.returnStatement({expression:c.expression})]})]}):c.expression]});}));}else o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:i.placeholder,name:h.union}),parameters:[s.arrayLiteralExpression({elements:a.map(p=>p.expression)})]});}else o=St({plugin:t,schema:r,state:n});else {let a=Rm({plugin:t,schema:{type:"unknown"},state:n});o.expression=a.expression;}if(o.expression&&(r.accessScope==="read"&&(o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:i.placeholder,name:h.readonly}),parameters:[o.expression]})),e&&(o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:i.placeholder,name:h.optional}),parameters:[o.expression]}),o.typeName=h.ZodMiniOptional),r.default!==void 0)){let a=r.type==="integer"&&r.format==="int64",p=ln({isBigInt:a,value:r.default});p&&(o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:i.placeholder,name:h._default}),parameters:[o.expression,p]}));}return o},uo=({id:e,plugin:t,schema:r,state:n})=>{let o={circularReferenceTracker:[e],hasCircularReference:false,...n,currentReferenceTracker:[e]},i=t.api.getSelector("ref",e),a=t.getSymbol(i);if(a&&!t.getSymbolValue(a))return;let p=St({plugin:t,schema:r,state:o}),c=F(e);a=t.registerSymbol({exported:true,name:O({config:t.config.definitions,name:c}),selector:i});let m=t.config.definitions.types.infer.enabled?t.registerSymbol({exported:true,meta:{kind:"type"},name:O({config:t.config.definitions.types.infer,name:c}),selector:t.api.getSelector("type-infer-ref",e)}):void 0;Me({plugin:t,schema:r,symbol:a,typeInferSymbol:m,zodSchema:p});},Am=({plugin:e})=>{e.registerSymbol({external:Mr({plugin:e}),meta:{importKind:"namespace"},name:"z",selector:e.api.getSelector("import","zod")}),e.forEach("operation","parameter","requestBody","schema","webhook",t=>{switch(t.type){case "operation":Lr({getZodSchema:r=>St({plugin:e,schema:r,state:{circularReferenceTracker:[],currentReferenceTracker:[],hasCircularReference:false}}),operation:t.operation,plugin:e});break;case "parameter":uo({id:t.$ref,plugin:e,schema:t.parameter.schema});break;case "requestBody":uo({id:t.$ref,plugin:e,schema:t.requestBody.schema});break;case "schema":uo({id:t.$ref,plugin:e,schema:t.schema});break;case "webhook":Vr({getZodSchema:r=>St({plugin:e,schema:r,state:{circularReferenceTracker:[],currentReferenceTracker:[],hasCircularReference:false}}),operation:t.operation,plugin:e});break}});};var by=({plugin:e,schema:t,state:r})=>{let n=e.referenceSymbol(e.api.getSelector("import","zod")),o=s.propertyAccessExpression({expression:n.placeholder,name:h.array}),i,a=false;if(!t.items)i=s.callExpression({functionName:o,parameters:[gi({plugin:e})]});else {t=Z({schema:t});let p=t.items.map(c=>{let m=Ot({plugin:e,schema:c,state:r});return m.hasCircularReference&&(a=true),m.expression});if(p.length===1)i=s.callExpression({functionName:o,parameters:p});else if(t.logicalOperator==="and"){let c=t.items[0],m;if(c.logicalOperator==="or"||c.type&&c.type!=="object")m=s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.intersection}),parameters:p});else {m=p[0];for(let l=1;l<p.length;l++)m=s.callExpression({functionName:s.propertyAccessExpression({expression:m,name:h.and}),parameters:[p[l]]});}i=s.callExpression({functionName:o,parameters:[m]});}else i=s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.array}),parameters:[s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.union}),parameters:[s.arrayLiteralExpression({elements:p})]})]});}return t.minItems===t.maxItems&&t.minItems!==void 0?i=s.callExpression({functionName:s.propertyAccessExpression({expression:i,name:h.length}),parameters:[s.valueToExpression({value:t.minItems})]}):(t.minItems!==void 0&&(i=s.callExpression({functionName:s.propertyAccessExpression({expression:i,name:h.min}),parameters:[s.valueToExpression({value:t.minItems})]})),t.maxItems!==void 0&&(i=s.callExpression({functionName:s.propertyAccessExpression({expression:i,name:h.max}),parameters:[s.valueToExpression({value:t.maxItems})]}))),{expression:i,hasCircularReference:a}},Sy=({plugin:e,schema:t})=>{let r=e.referenceSymbol(e.api.getSelector("import","zod"));return typeof t.const=="boolean"?s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.literal}),parameters:[s.ots.boolean(t.const)]}):s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.boolean})})},Oy=({plugin:e,schema:t})=>{let r=e.referenceSymbol(e.api.getSelector("import","zod")),n=[],o=[],i=false,a=true;for(let c of t.items??[])if(c.type==="string"&&typeof c.const=="string"){let m=s.stringLiteral({text:c.const});n.push(m),o.push(s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.literal}),parameters:[m]}));}else if((c.type==="number"||c.type==="integer")&&typeof c.const=="number"){a=false;let m=s.ots.number(c.const);o.push(s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.literal}),parameters:[m]}));}else if(c.type==="boolean"&&typeof c.const=="boolean"){a=false;let m=s.ots.boolean(c.const);o.push(s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.literal}),parameters:[m]}));}else (c.type==="null"||c.const===null)&&(i=true);if(!o.length)return gi({plugin:e});let p;return a&&n.length>0?p=s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.enum}),parameters:[s.arrayLiteralExpression({elements:n,multiLine:false})]}):o.length===1?p=o[0]:p=s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.union}),parameters:[s.arrayLiteralExpression({elements:o,multiLine:o.length>3})]}),i&&(p=s.callExpression({functionName:s.propertyAccessExpression({expression:p,name:h.nullable})})),p},Ty=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector("import","zod"));return s.callExpression({functionName:s.propertyAccessExpression({expression:t.placeholder,name:h.never})})},Ry=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector("import","zod"));return s.callExpression({functionName:s.propertyAccessExpression({expression:t.placeholder,name:h.null})})},fn=({isBigInt:e,value:t})=>{let r=s.valueToExpression({value:t});return e&&(typeof t=="bigint"||typeof t=="number"||typeof t=="string"||typeof t=="boolean")?s.callExpression({functionName:"BigInt",parameters:[r]}):r},Ay=({plugin:e,schema:t})=>{let r=e.referenceSymbol(e.api.getSelector("import","zod")),n=t.type==="integer"&&t.format==="int64";if(typeof t.const=="number")return s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.literal}),parameters:[s.ots.number(t.const)]});let o=s.callExpression({functionName:n?s.propertyAccessExpression({expression:s.propertyAccessExpression({expression:r.placeholder,name:h.coerce}),name:h.bigint}):s.propertyAccessExpression({expression:r.placeholder,name:h.number})});return !n&&t.type==="integer"&&(o=s.callExpression({functionName:s.propertyAccessExpression({expression:o,name:h.int})})),t.exclusiveMinimum!==void 0?o=s.callExpression({functionName:s.propertyAccessExpression({expression:o,name:h.gt}),parameters:[fn({isBigInt:n,value:t.exclusiveMinimum})]}):t.minimum!==void 0&&(o=s.callExpression({functionName:s.propertyAccessExpression({expression:o,name:h.gte}),parameters:[fn({isBigInt:n,value:t.minimum})]})),t.exclusiveMaximum!==void 0?o=s.callExpression({functionName:s.propertyAccessExpression({expression:o,name:h.lt}),parameters:[fn({isBigInt:n,value:t.exclusiveMaximum})]}):t.maximum!==void 0&&(o=s.callExpression({functionName:s.propertyAccessExpression({expression:o,name:h.lte}),parameters:[fn({isBigInt:n,value:t.maximum})]})),o},Py=({plugin:e,schema:t,state:r})=>{let n=e.referenceSymbol(e.api.getSelector("import","zod")),o=false,i=[],a=t.required??[];for(let c in t.properties){let m=t.properties[c],l=a.includes(c),f=Ot({optional:!l,plugin:e,schema:m,state:r});f.hasCircularReference&&(o=true),ee.lastIndex=0;let d;ee.test(c)?d=c.startsWith("-")?S.factory.createStringLiteral(c):S.factory.createNumericLiteral(c):d=c,(c.match(/^[0-9]/)&&c.match(/\D+/g)||c.match(/\W/g))&&!c.startsWith("'")&&!c.endsWith("'")&&(d=`'${c}'`),i.push(s.propertyAssignment({initializer:f.expression,name:d}));}if(t.additionalProperties&&(!t.properties||!Object.keys(t.properties).length)){let c=Ot({plugin:e,schema:t.additionalProperties,state:r});return {anyType:"AnyZodObject",expression:s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.record}),parameters:[c.expression]}),hasCircularReference:c.hasCircularReference}}return {anyType:"AnyZodObject",expression:s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.object}),parameters:[S.factory.createObjectLiteralExpression(i,true)]}),hasCircularReference:o}},Ey=({plugin:e,schema:t})=>{let r=e.referenceSymbol(e.api.getSelector("import","zod"));if(typeof t.const=="string")return s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.literal}),parameters:[s.ots.string(t.const)]});let n=s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.string})}),o=[];if(e.config.dates.offset&&o.push({key:"offset",value:true}),e.config.dates.local&&o.push({key:"local",value:true}),t.format)switch(t.format){case "date":n=s.callExpression({functionName:s.propertyAccessExpression({expression:n,name:h.date})});break;case "date-time":n=s.callExpression({functionName:s.propertyAccessExpression({expression:n,name:h.datetime}),parameters:o.length>0?[s.objectExpression({obj:o})]:[]});break;case "email":n=s.callExpression({functionName:s.propertyAccessExpression({expression:n,name:h.email})});break;case "ipv4":case "ipv6":n=s.callExpression({functionName:s.propertyAccessExpression({expression:n,name:h.ip})});break;case "time":n=s.callExpression({functionName:s.propertyAccessExpression({expression:n,name:h.time})});break;case "uri":n=s.callExpression({functionName:s.propertyAccessExpression({expression:n,name:h.url})});break;case "uuid":n=s.callExpression({functionName:s.propertyAccessExpression({expression:n,name:h.uuid})});break}return t.minLength===t.maxLength&&t.minLength!==void 0?n=s.callExpression({functionName:s.propertyAccessExpression({expression:n,name:h.length}),parameters:[s.valueToExpression({value:t.minLength})]}):(t.minLength!==void 0&&(n=s.callExpression({functionName:s.propertyAccessExpression({expression:n,name:h.min}),parameters:[s.valueToExpression({value:t.minLength})]})),t.maxLength!==void 0&&(n=s.callExpression({functionName:s.propertyAccessExpression({expression:n,name:h.max}),parameters:[s.valueToExpression({value:t.maxLength})]}))),t.pattern&&(n=s.callExpression({functionName:s.propertyAccessExpression({expression:n,name:h.regex}),parameters:[s.regularExpressionLiteral({text:t.pattern})]})),n},Iy=({plugin:e,schema:t,state:r})=>{let n=e.referenceSymbol(e.api.getSelector("import","zod")),o=false;if(t.const&&Array.isArray(t.const)){let p=t.const.map(m=>s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.literal}),parameters:[s.valueToExpression({value:m})]}));return {expression:s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.tuple}),parameters:[s.arrayLiteralExpression({elements:p})]}),hasCircularReference:o}}let i=[];for(let p of t.items??[]){let c=Ot({plugin:e,schema:p,state:r});c.hasCircularReference&&(o=true),i.push(c.expression);}return {expression:s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.tuple}),parameters:[s.arrayLiteralExpression({elements:i})]}),hasCircularReference:o}},ky=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector("import","zod"));return s.callExpression({functionName:s.propertyAccessExpression({expression:t.placeholder,name:h.undefined})})},gi=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector("import","zod"));return s.callExpression({functionName:s.propertyAccessExpression({expression:t.placeholder,name:h.unknown})})},jy=({plugin:e})=>{let t=e.referenceSymbol(e.api.getSelector("import","zod"));return s.callExpression({functionName:s.propertyAccessExpression({expression:t.placeholder,name:h.void})})},Pm=({plugin:e,schema:t,state:r})=>{switch(t.type){case "array":return by({plugin:e,schema:t,state:r});case "boolean":return {expression:Sy({plugin:e,schema:t})};case "enum":return {expression:Oy({plugin:e,schema:t})};case "integer":case "number":return {expression:Ay({plugin:e,schema:t})};case "never":return {expression:Ty({plugin:e})};case "null":return {expression:Ry({plugin:e})};case "object":return Py({plugin:e,schema:t,state:r});case "string":return {expression:Ey({plugin:e,schema:t})};case "tuple":return Iy({plugin:e,schema:t,state:r});case "undefined":return {expression:ky({plugin:e})};case "unknown":return {expression:gi({plugin:e})};case "void":return {expression:jy({plugin:e})}}},Ot=({optional:e,plugin:t,schema:r,state:n})=>{let o={},i=t.referenceSymbol(t.api.getSelector("import","zod"));if(r.$ref){let a=n.circularReferenceTracker.includes(r.$ref);n.circularReferenceTracker.push(r.$ref),n.currentReferenceTracker.push(r.$ref);let p=t.api.getSelector("ref",r.$ref),c=t.getSymbol(p);if(a)c||(c=t.referenceSymbol(p)),o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:i.placeholder,name:h.lazy}),parameters:[s.arrowFunction({statements:[s.returnStatement({expression:s.identifier({text:c.placeholder})})]})]}),o.hasCircularReference=r.circular;else {if(c)o.hasCircularReference=r.circular;else {let l=t.context.resolveIrRef(r.$ref);yo({id:r.$ref,plugin:t,schema:l,state:{...n,currentReferenceTracker:[r.$ref]}});}let m=t.referenceSymbol(p);o.expression=s.identifier({text:m.placeholder});}n.circularReferenceTracker.pop(),n.currentReferenceTracker.pop();}else if(r.type){let a=Pm({plugin:t,schema:r,state:n});o.expression=a.expression,o.hasCircularReference=a.hasCircularReference,o.typeName=a.anyType,t.config.metadata&&r.description&&(o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:o.expression,name:h.describe}),parameters:[s.stringLiteral({text:r.description})]}));}else if(r.items)if(r=Z({schema:r}),r.items){let a=r.items.map(p=>{let c=Ot({plugin:t,schema:p,state:n});return c.hasCircularReference&&(o.hasCircularReference=true),c.expression});if(r.logicalOperator==="and"){let p=r.items[0];p.logicalOperator==="or"||p.type&&p.type!=="object"?o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:i.placeholder,name:h.intersection}),parameters:a}):(o.expression=a[0],a.slice(1).forEach(c=>{o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:o.expression,name:h.and}),parameters:[c]});}));}else o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:i.placeholder,name:h.union}),parameters:[s.arrayLiteralExpression({elements:a})]});}else o=Ot({plugin:t,schema:r,state:n});else {let a=Pm({plugin:t,schema:{type:"unknown"},state:n});o.expression=a.expression,o.hasCircularReference=a.hasCircularReference,o.typeName=a.anyType;}if(o.expression&&(r.accessScope==="read"&&(o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:o.expression,name:h.readonly})})),e&&(o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:o.expression,name:h.optional})})),r.default!==void 0)){let a=r.type==="integer"&&r.format==="int64",p=fn({isBigInt:a,value:r.default});p&&(o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:o.expression,name:h.default}),parameters:[p]}));}return o.hasCircularReference?o.typeName||(o.typeName="ZodTypeAny"):o.typeName&&(o.typeName=void 0),o},yo=({id:e,plugin:t,schema:r,state:n})=>{n||(n={circularReferenceTracker:[e],currentReferenceTracker:[e],hasCircularReference:false});let o=t.api.getSelector("ref",e),i=t.getSymbol(o);if(i)return;let a=Ot({plugin:t,schema:r,state:n}),p=F(e);i=t.registerSymbol({exported:true,name:O({config:t.config.definitions,name:p}),selector:o});let c=t.config.definitions.types.infer.enabled?t.registerSymbol({exported:true,meta:{kind:"type"},name:O({config:t.config.definitions.types.infer,name:p}),selector:t.api.getSelector("type-infer-ref",e)}):void 0;Me({plugin:t,schema:r,symbol:i,typeInferSymbol:c,zodSchema:a});},Em=({plugin:e})=>{e.registerSymbol({external:Mr({plugin:e}),name:"z",selector:e.api.getSelector("import","zod")}),e.forEach("operation","parameter","requestBody","schema","webhook",t=>{switch(t.type){case "operation":Lr({getZodSchema:r=>Ot({plugin:e,schema:r,state:{circularReferenceTracker:[],currentReferenceTracker:[],hasCircularReference:false}}),operation:t.operation,plugin:e});break;case "parameter":yo({id:t.$ref,plugin:e,schema:t.parameter.schema});break;case "requestBody":yo({id:t.$ref,plugin:e,schema:t.requestBody.schema});break;case "schema":yo({id:t.$ref,plugin:e,schema:t.schema});break;case "webhook":Vr({getZodSchema:r=>Ot({plugin:e,schema:r,state:{circularReferenceTracker:[],currentReferenceTracker:[],hasCircularReference:false}}),operation:t.operation,plugin:e});break}});};var Cy=({plugin:e,schema:t,state:r})=>{let n={},o=e.referenceSymbol(e.api.getSelector("import","zod")),i=s.propertyAccessExpression({expression:o.placeholder,name:h.array});if(!t.items)n.expression=s.callExpression({functionName:i,parameters:[bi({plugin:e}).expression]});else {t=Z({schema:t});let a=t.items.map(p=>{let c=Tt({plugin:e,schema:p,state:r});return c.hasCircularReference&&(n.hasCircularReference=true),c.expression});if(a.length===1)n.expression=s.callExpression({functionName:i,parameters:a});else if(t.logicalOperator==="and"){let p=t.items[0],c;if(p.logicalOperator==="or"||p.type&&p.type!=="object")c=s.callExpression({functionName:s.propertyAccessExpression({expression:o.placeholder,name:h.intersection}),parameters:a});else {c=a[0];for(let m=1;m<a.length;m++)c=s.callExpression({functionName:s.propertyAccessExpression({expression:c,name:h.and}),parameters:[a[m]]});}n.expression=s.callExpression({functionName:i,parameters:[c]});}else n.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:o.placeholder,name:h.array}),parameters:[s.callExpression({functionName:s.propertyAccessExpression({expression:o.placeholder,name:h.union}),parameters:[s.arrayLiteralExpression({elements:a})]})]});}return t.minItems===t.maxItems&&t.minItems!==void 0?n.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:n.expression,name:h.length}),parameters:[s.valueToExpression({value:t.minItems})]}):(t.minItems!==void 0&&(n.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:n.expression,name:h.min}),parameters:[s.valueToExpression({value:t.minItems})]})),t.maxItems!==void 0&&(n.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:n.expression,name:h.max}),parameters:[s.valueToExpression({value:t.maxItems})]}))),n},Ny=({plugin:e,schema:t})=>{let r={},n=e.referenceSymbol(e.api.getSelector("import","zod"));return typeof t.const=="boolean"?(r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.literal}),parameters:[s.ots.boolean(t.const)]}),r):(r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.boolean})}),r)},vy=({plugin:e,schema:t})=>{let r={},n=e.referenceSymbol(e.api.getSelector("import","zod")),o=[],i=[],a=false,p=true;for(let c of t.items??[])if(c.type==="string"&&typeof c.const=="string"){let m=s.stringLiteral({text:c.const});o.push(m),i.push(s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.literal}),parameters:[m]}));}else if((c.type==="number"||c.type==="integer")&&typeof c.const=="number"){p=false;let m=s.ots.number(c.const);i.push(s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.literal}),parameters:[m]}));}else if(c.type==="boolean"&&typeof c.const=="boolean"){p=false;let m=s.ots.boolean(c.const);i.push(s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.literal}),parameters:[m]}));}else (c.type==="null"||c.const===null)&&(a=true);return i.length?(p&&o.length>0?r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.enum}),parameters:[s.arrayLiteralExpression({elements:o,multiLine:false})]}):i.length===1?r.expression=i[0]:r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.union}),parameters:[s.arrayLiteralExpression({elements:i,multiLine:i.length>3})]}),a&&(r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.nullable}),parameters:[r.expression]})),r):bi({plugin:e})},wy=({plugin:e})=>{let t={},r=e.referenceSymbol(e.api.getSelector("import","zod"));return t.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.never})}),t},qy=({plugin:e})=>{let t={},r=e.referenceSymbol(e.api.getSelector("import","zod"));return t.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.null})}),t},dn=({isBigInt:e,value:t})=>{let r=s.valueToExpression({value:t});return e&&(typeof t=="bigint"||typeof t=="number"||typeof t=="string"||typeof t=="boolean")?s.callExpression({functionName:"BigInt",parameters:[r]}):r},$y=({plugin:e,schema:t})=>{let r={},n=t.type==="integer"&&t.format==="int64",o=e.referenceSymbol(e.api.getSelector("import","zod"));return typeof t.const=="number"?(r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:o.placeholder,name:h.literal}),parameters:[s.ots.number(t.const)]}),r):(r.expression=s.callExpression({functionName:n?s.propertyAccessExpression({expression:s.propertyAccessExpression({expression:o.placeholder,name:h.coerce}),name:h.bigint}):s.propertyAccessExpression({expression:o.placeholder,name:h.number})}),!n&&t.type==="integer"&&(r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:o.placeholder,name:h.int})})),t.exclusiveMinimum!==void 0?r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:r.expression,name:h.gt}),parameters:[dn({isBigInt:n,value:t.exclusiveMinimum})]}):t.minimum!==void 0&&(r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:r.expression,name:h.gte}),parameters:[dn({isBigInt:n,value:t.minimum})]})),t.exclusiveMaximum!==void 0?r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:r.expression,name:h.lt}),parameters:[dn({isBigInt:n,value:t.exclusiveMaximum})]}):t.maximum!==void 0&&(r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:r.expression,name:h.lte}),parameters:[dn({isBigInt:n,value:t.maximum})]})),r)},My=({plugin:e,schema:t,state:r})=>{let n={},o=[],i=t.required??[],a=e.referenceSymbol(e.api.getSelector("import","zod"));for(let p in t.properties){let c=t.properties[p],m=i.includes(p),l=Tt({optional:!m,plugin:e,schema:c,state:r});l.hasCircularReference&&(n.hasCircularReference=true),ee.lastIndex=0;let f;ee.test(p)?f=p.startsWith("-")?S.factory.createStringLiteral(p):S.factory.createNumericLiteral(p):f=p,(p.match(/^[0-9]/)&&p.match(/\D+/g)||p.match(/\W/g))&&!p.startsWith("'")&&!p.endsWith("'")&&(f=`'${p}'`),l.hasCircularReference?o.push(s.getAccessorDeclaration({name:f,returnType:l.typeName?s.propertyAccessExpression({expression:a.placeholder,name:l.typeName}):void 0,statements:[s.returnStatement({expression:l.expression})]})):o.push(s.propertyAssignment({initializer:l.expression,name:f}));}if(t.additionalProperties&&(!t.properties||!Object.keys(t.properties).length)){let p=Tt({plugin:e,schema:t.additionalProperties,state:r});return n.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:a.placeholder,name:h.record}),parameters:[s.callExpression({functionName:s.propertyAccessExpression({expression:a.placeholder,name:h.string}),parameters:[]}),p.expression]}),p.hasCircularReference&&(n.hasCircularReference=true),n.hasCircularReference?{...n,typeName:"ZodType"}:n}return n.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:a.placeholder,name:h.object}),parameters:[S.factory.createObjectLiteralExpression(o,true)]}),n.hasCircularReference?{...n,typeName:"ZodType"}:n},Ly=({plugin:e,schema:t})=>{let r={},n=e.referenceSymbol(e.api.getSelector("import","zod"));if(typeof t.const=="string")return r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.literal}),parameters:[s.ots.string(t.const)]}),r;r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.string})});let o=[];if(e.config.dates.offset&&o.push({key:"offset",value:true}),e.config.dates.local&&o.push({key:"local",value:true}),t.format)switch(t.format){case "date":r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:s.propertyAccessExpression({expression:n.placeholder,name:h.iso}),name:h.date})});break;case "date-time":r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:s.propertyAccessExpression({expression:n.placeholder,name:h.iso}),name:h.datetime}),parameters:o.length>0?[s.objectExpression({obj:o})]:[]});break;case "email":r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.email})});break;case "ipv4":r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.ipv4})});break;case "ipv6":r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.ipv6})});break;case "time":r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:s.propertyAccessExpression({expression:n.placeholder,name:h.iso}),name:h.time})});break;case "uri":r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.url})});break;case "uuid":r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:n.placeholder,name:h.uuid})});break}return t.minLength===t.maxLength&&t.minLength!==void 0?r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:r.expression,name:h.length}),parameters:[s.valueToExpression({value:t.minLength})]}):(t.minLength!==void 0&&(r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:r.expression,name:h.min}),parameters:[s.valueToExpression({value:t.minLength})]})),t.maxLength!==void 0&&(r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:r.expression,name:h.max}),parameters:[s.valueToExpression({value:t.maxLength})]}))),t.pattern&&(r.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:r.expression,name:h.regex}),parameters:[s.regularExpressionLiteral({text:t.pattern})]})),r},Vy=({plugin:e,schema:t,state:r})=>{let n={},o=e.referenceSymbol(e.api.getSelector("import","zod"));if(t.const&&Array.isArray(t.const)){let a=t.const.map(p=>s.callExpression({functionName:s.propertyAccessExpression({expression:o.placeholder,name:h.literal}),parameters:[s.valueToExpression({value:p})]}));return n.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:o.placeholder,name:h.tuple}),parameters:[s.arrayLiteralExpression({elements:a})]}),n}let i=[];for(let a of t.items??[]){let p=Tt({plugin:e,schema:a,state:r});i.push(p.expression),p.hasCircularReference&&(n.hasCircularReference=true);}return n.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:o.placeholder,name:h.tuple}),parameters:[s.arrayLiteralExpression({elements:i})]}),n},Dy=({plugin:e})=>{let t={},r=e.referenceSymbol(e.api.getSelector("import","zod"));return t.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.undefined})}),t},bi=({plugin:e})=>{let t={},r=e.referenceSymbol(e.api.getSelector("import","zod"));return t.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.unknown})}),t},Fy=({plugin:e})=>{let t={},r=e.referenceSymbol(e.api.getSelector("import","zod"));return t.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:r.placeholder,name:h.void})}),t},Im=({plugin:e,schema:t,state:r})=>{switch(t.type){case "array":return Cy({plugin:e,schema:t,state:r});case "boolean":return Ny({plugin:e,schema:t});case "enum":return vy({plugin:e,schema:t});case "integer":case "number":return $y({plugin:e,schema:t});case "never":return wy({plugin:e});case "null":return qy({plugin:e});case "object":return My({plugin:e,schema:t,state:r});case "string":return Ly({plugin:e,schema:t});case "tuple":return Vy({plugin:e,schema:t,state:r});case "undefined":return Dy({plugin:e});case "unknown":return bi({plugin:e});case "void":return Fy({plugin:e})}},Tt=({optional:e,plugin:t,schema:r,state:n})=>{let o={},i=t.referenceSymbol(t.api.getSelector("import","zod"));if(r.$ref){let a=n.circularReferenceTracker.includes(r.$ref),p=n.currentReferenceTracker.includes(r.$ref);n.circularReferenceTracker.push(r.$ref),n.currentReferenceTracker.push(r.$ref);let c=t.api.getSelector("ref",r.$ref),m=t.getSymbol(c);if(a)m||(m=t.referenceSymbol(c)),p?o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:i.placeholder,name:h.lazy}),parameters:[s.arrowFunction({returnType:s.keywordTypeNode({keyword:"any"}),statements:[s.returnStatement({expression:s.identifier({text:m.placeholder})})]})]}):o.expression=s.identifier({text:m.placeholder}),o.hasCircularReference=r.circular;else {if(m)o.hasCircularReference=r.circular;else {let f=t.context.resolveIrRef(r.$ref);ho({id:r.$ref,plugin:t,schema:f,state:n});}let l=t.referenceSymbol(c);o.expression=s.identifier({text:l.placeholder});}n.circularReferenceTracker.pop(),n.currentReferenceTracker.pop();}else if(r.type){let a=Im({plugin:t,schema:r,state:n});o.expression=a.expression,o.hasCircularReference=a.hasCircularReference,t.config.metadata&&r.description&&(o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:o.expression,name:h.register}),parameters:[s.propertyAccessExpression({expression:i.placeholder,name:h.globalRegistry}),s.objectExpression({obj:[{key:"description",value:s.stringLiteral({text:r.description})}]})]}));}else if(r.items)if(r=Z({schema:r}),r.items){let a=r.items.map(p=>Tt({plugin:t,schema:p,state:n}));if(r.logicalOperator==="and"){let p=r.items[0];p.logicalOperator==="or"||p.type&&p.type!=="object"?o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:i.placeholder,name:h.intersection}),parameters:a.map(c=>c.expression)}):(o.expression=a[0].expression,a.slice(1).forEach(c=>{o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:o.expression,name:h.and}),parameters:[c.hasCircularReference?s.callExpression({functionName:s.propertyAccessExpression({expression:i.placeholder,name:h.lazy}),parameters:[s.arrowFunction({statements:[s.returnStatement({expression:c.expression})]})]}):c.expression]});}));}else o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:i.placeholder,name:h.union}),parameters:[s.arrayLiteralExpression({elements:a.map(p=>p.expression)})]});}else o=Tt({plugin:t,schema:r,state:n});else {let a=Im({plugin:t,schema:{type:"unknown"},state:n});o.expression=a.expression;}if(o.expression&&(r.accessScope==="read"&&(o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:o.expression,name:h.readonly})})),e&&(o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:i.placeholder,name:h.optional}),parameters:[o.expression]}),o.typeName=h.ZodOptional),r.default!==void 0)){let a=r.type==="integer"&&r.format==="int64",p=dn({isBigInt:a,value:r.default});p&&(o.expression=s.callExpression({functionName:s.propertyAccessExpression({expression:o.expression,name:h.default}),parameters:[p]}));}return o},ho=({id:e,plugin:t,schema:r,state:n})=>{let o={circularReferenceTracker:[e],hasCircularReference:false,...n,currentReferenceTracker:[e]},i=t.api.getSelector("ref",e),a=t.getSymbol(i);if(a&&!t.getSymbolValue(a))return;let p=Tt({plugin:t,schema:r,state:o}),c=F(e);a=t.registerSymbol({exported:true,name:O({config:t.config.definitions,name:c}),selector:i});let m=t.config.definitions.types.infer.enabled?t.registerSymbol({exported:true,meta:{kind:"type"},name:O({config:t.config.definitions.types.infer,name:c}),selector:t.api.getSelector("type-infer-ref",e)}):void 0;Me({plugin:t,schema:r,symbol:a,typeInferSymbol:m,zodSchema:p});},Si=({plugin:e})=>{e.registerSymbol({external:Mr({plugin:e}),name:"z",selector:e.api.getSelector("import","zod")}),e.forEach("operation","parameter","requestBody","schema","webhook",t=>{switch(t.type){case "operation":Lr({getZodSchema:r=>Tt({plugin:e,schema:r,state:{circularReferenceTracker:[],currentReferenceTracker:[],hasCircularReference:false}}),operation:t.operation,plugin:e});break;case "parameter":ho({id:t.$ref,plugin:e,schema:t.parameter.schema});break;case "requestBody":ho({id:t.$ref,plugin:e,schema:t.requestBody.schema});break;case "schema":ho({id:t.$ref,plugin:e,schema:t.schema});break;case "webhook":Vr({getZodSchema:r=>Tt({plugin:e,schema:r,state:{circularReferenceTracker:[],currentReferenceTracker:[],hasCircularReference:false}}),operation:t.operation,plugin:e});break}});};var km=e=>{let{plugin:t}=e;switch(t.config.compatibilityVersion){case 3:return Em(e);case 4:return Si(e);case "mini":return Am(e);default:return Si(e)}};var go={api:new fo({name:"zod"}),config:{case:"camelCase",comments:true,exportFromIndex:false,metadata:false},handler:km,name:"zod",resolveConfig:(e,t)=>{let n=t.package.getVersion("zod"),o=()=>n&&(n.major===4||n.major===3)?n.major:4,i=a=>{if(!a)return o();if(!n)return a;if((a===4||a===3||a==="mini")&&!t.package.satisfies(n,">=3.25.0 <5.0.0")){let p=o();return console.warn(`\u{1F50C} ${ge.yellow("Warning:")} Installed ${ge.cyan("zod")} ${ge.cyan(`v${n.version}`)} does not support compatibility version ${ge.yellow(String(a))}, using ${ge.yellow(String(p))}.`),p}return a};e.config.compatibilityVersion=i(e.config.compatibilityVersion),e.config.dates=t.valueToObject({defaultValue:{local:false,offset:false},value:e.config.dates}),e.config.types=t.valueToObject({defaultValue:{infer:{case:"PascalCase",enabled:false}},mappers:{object:(a,p)=>({...a,infer:t.valueToObject({defaultValue:{...p.infer,enabled:a.infer!==void 0?!!a.infer:p.infer.enabled},mappers:De,value:a.infer})})},value:e.config.types}),e.config.definitions=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"z{{name}}",types:{...e.config.types,infer:{...e.config.types.infer,name:"{{name}}ZodType"}}},mappers:{...De,object:(a,p)=>({...a,types:t.valueToObject({defaultValue:p.types,mappers:{object:(c,m)=>({...c,infer:t.valueToObject({defaultValue:{...m.infer,enabled:c.infer!==void 0?!!c.infer:m.infer.enabled},mappers:De,value:c.infer})})},value:a.types})})},value:e.config.definitions}),e.config.requests=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"z{{name}}Data",types:{...e.config.types,infer:{...e.config.types.infer,name:"{{name}}DataZodType"}}},mappers:{...De,object:(a,p)=>({...a,types:t.valueToObject({defaultValue:p.types,mappers:{object:(c,m)=>({...c,infer:t.valueToObject({defaultValue:{...m.infer,enabled:c.infer!==void 0?!!c.infer:m.infer.enabled},mappers:De,value:c.infer})})},value:a.types})})},value:e.config.requests}),e.config.responses=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"z{{name}}Response",types:{...e.config.types,infer:{...e.config.types.infer,name:"{{name}}ResponseZodType"}}},mappers:{...De,object:(a,p)=>({...a,types:t.valueToObject({defaultValue:p.types,mappers:{object:(c,m)=>({...c,infer:t.valueToObject({defaultValue:{...m.infer,enabled:c.infer!==void 0?!!c.infer:m.infer.enabled},mappers:De,value:c.infer})})},value:a.types})})},value:e.config.responses}),e.config.webhooks=t.valueToObject({defaultValue:{case:e.config.case??"camelCase",enabled:true,name:"z{{name}}WebhookRequest",types:{...e.config.types,infer:{...e.config.types.infer,name:"{{name}}WebhookRequestZodType"}}},mappers:{...De,object:(a,p)=>({...a,types:t.valueToObject({defaultValue:p.types,mappers:{object:(c,m)=>({...c,infer:t.valueToObject({defaultValue:{...m.infer,enabled:c.infer!==void 0?!!c.infer:m.infer.enabled},mappers:De,value:c.infer})})},value:a.types})})},value:e.config.webhooks});},tags:["validator"]};var xo={"@angular/common":ls,"@hey-api/client-angular":ds,"@hey-api/client-axios":ys,"@hey-api/client-fetch":gs,"@hey-api/client-next":bs,"@hey-api/client-nuxt":Os,"@hey-api/client-ofetch":Rs,"@hey-api/schemas":Cs,"@hey-api/sdk":vs,"@hey-api/transformers":Ms,"@hey-api/typescript":Ds,"@pinia/colada":Ws,"@tanstack/angular-query-experimental":Gs,"@tanstack/react-query":eo,"@tanstack/solid-query":ro,"@tanstack/svelte-query":so,"@tanstack/vue-query":io,fastify:po,"legacy/angular":As,"legacy/axios":Ps,"legacy/fetch":Es,"legacy/node":Is,"legacy/xhr":ks,valibot:lo,zod:go};var jm=["@hey-api/typescript","@hey-api/sdk"],Ky=({dependencies:e,userPlugins:t,userPluginsConfig:r})=>{let n=new Set,o=new Set,i={},a=p=>{if(n.has(p))throw new Error(`Circular reference detected at '${p}'`);if(o.has(p))return;n.add(p);let c=xo[p],m=r[p];if(!c&&!m)throw new Error(`unknown plugin dependency "${p}" - do you need to register a custom plugin with this name?`);let l={...c,...m,config:{...c?.config,...m?.config},dependencies:new Set([...c?.dependencies||[],...m?.dependencies||[]])};if(l.resolveConfig){let f={package:kn(e),pluginByTag:(d,u={})=>{let{defaultPlugin:y,errorMessage:g}=u;for(let x of t){let b=xo[x]||r[x];if(b&&b.tags?.includes(d)&&x!==p)return x}if(y){let x=xo[y]||r[y];if(x&&x.tags?.includes(d)&&y!==p)return y}throw new Error(g||`missing plugin - no plugin with tag "${d}" found`)},valueToObject:xe};l.resolveConfig(l,f);}for(let f of l.dependencies)a(f);n.delete(p),o.add(p),i[p]=l;};for(let p of t)a(p);return {pluginOrder:Array.from(o),plugins:i}},Wy=e=>typeof e=="string"?e.startsWith("@hey-api/client")||e.startsWith("legacy/"):e.name.startsWith("@hey-api/client")||e.name.startsWith("legacy/")||e.tags&&e.tags.includes("client"),Cm=({dependencies:e,userConfig:t})=>{let r={},n=jm;t.plugins&&(t.plugins=t.plugins.filter(i=>typeof i=="string"&&i||typeof i!="string"&&i.name),t.plugins.length===1&&Wy(t.plugins[0])?n=[...jm,...t.plugins]:n=t.plugins);let o=n.map(i=>{if(typeof i=="string")return i;let a=i.name;return a&&(i.handler?r[a]=i:(r[a]={config:{...i}},delete r[a].config.name)),a}).filter(Boolean);return Ky({dependencies:e,userPlugins:o,userPluginsConfig:r})};var zy=/^([\w-]+)\/([\w-]+)(?:\?([\w=&.-]*))?$/,Dr="https://get.heyapi.dev",_y=(e,t,r)=>`${Dr}/${e}/${t}${r?`?${r}`:""}`,Hy=e=>{let t=e.organization,r=e.project,n;if(e.path){let i=e.path.match(zy);if(!i)throw new Error(`Invalid Hey API shorthand format. Expected "organization/project?queryParams" or "organization/project", received: ${e.path}`);t=i[1],r=i[2],n=i[3];}if(!t)throw new Error("The Hey API organization cannot be empty.");if(!r)throw new Error("The Hey API project cannot be empty.");return {organization:t,project:r,queryParams:n}},Oi=e=>{let t=Hy(e);return {path:_y(t.organization,t.project,t.queryParams),registry:"hey-api"}};var Qy=/^(@([\w-]+)\/([\w\-.]+)#)?([\w-]+)$/,Zy=e=>`https://dash.readme.com/api/v1/api-registry/${e}`,bo="readme",Uy=e=>{let t=e.match(Qy);if(!t)throw new Error(`Invalid ReadMe shorthand format. Expected "${bo}:@organization/project#uuid" or "${bo}:uuid", received: ${bo}:${e}`);let[,,r,n,o]=t;if(!o)throw new Error("The ReadMe UUID cannot be empty.");return {organization:r,project:n,uuid:o}},Nm=e=>{let t=e.slice(`${bo}:`.length),r=Uy(t);return {...r,path:Zy(r.uuid),registry:"readme"}};var Xy=/^(@[\w-]+)\/([\w.-]+)$/,Jy=(e,t)=>`https://registry.scalar.com/${e}/apis/${t}/latest?format=json`,Ti="scalar",Gy=e=>{let t=e.match(Xy);if(!t)throw new Error(`Invalid Scalar shorthand format. Expected "${Ti}:@organization/project", received: ${Ti}:${e}`);let[,r,n]=t;if(!r)throw new Error("The Scalar organization cannot be empty.");if(!n)throw new Error("The Scalar project cannot be empty.");return {organization:r,project:n}},vm=e=>{let t=e.slice(`${Ti}:`.length),r=Gy(t);return {...r,path:Jy(r.organization,r.project),registry:"scalar"}};var wm=e=>{if(e.path.startsWith("readme:")){Object.assign(e,Nm(e.path));return}if(e.path.startsWith("scalar:")){Object.assign(e,vm(e.path));return}if(e.path.startsWith("."))return;if(e.path.startsWith(Dr)){e.path=e.path.slice(Dr.length+1),Object.assign(e,Oi(e));return}let t=e.path.split("/");if(t.length===2&&t.filter(Boolean).length===2){Object.assign(e,Oi(e));return}};var yn={enabled:false,interval:1e3,timeout:6e4},qm=e=>{let t={...yn};return typeof e.path!="string"||(typeof e.watch=="boolean"?t.enabled=e.watch:typeof e.watch=="number"?(t.enabled=true,t.interval=e.watch):e.watch&&(t={...t,...e.watch})),t},Ri=e=>{let t=e.input instanceof Array?e.input:[e.input],r=[];for(let n of t){let o={path:"",watch:yn};typeof n=="string"?o.path=n:n&&(n.path!==void 0||n.organization!==void 0)?(o={...o,path:Dr,...n},o.watch!==void 0&&(o.watch=qm(o))):o={...o,path:n},typeof o.path=="string"&&wm(o),e.watch!==void 0&&o.watch.enabled===yn.enabled&&o.watch.interval===yn.interval&&o.watch.timeout===yn.timeout&&(o.watch=qm({path:o.path,watch:e.watch})),o.path&&r.push(o);}return r};var Yy=(e,t)=>({...e||{},...t||{}}),Ai=(e,t)=>{let r=e||{},n=t||{},o={...r,...n};return typeof o.logs=="object"&&(o.logs=Yy(r.logs,n.logs)),o};var $m=e=>{if(e.output instanceof Array)throw new Error("Unexpected array of outputs in user configuration. This should have been expanded already.");let t=xe({defaultValue:{clean:true,fileName:{case:"preserve",name:"{{name}}",suffix:".gen"},format:null,indexFile:true,lint:null,path:""},mappers:{object:(r,n)=>({...r,fileName:xe({defaultValue:{...n.fileName},mappers:{function:o=>({name:o}),string:o=>({name:o})},value:r.fileName})}),string:r=>({path:r})},value:e.output});return t.tsConfig=Ni(Ci(t.tsConfigPath)),t.importFileExtension===void 0&&t.tsConfig?.options.moduleResolution===S.ModuleResolutionKind.NodeNext&&(t.importFileExtension=".js"),t.importFileExtension&&!t.importFileExtension.startsWith(".")&&(t.importFileExtension=`.${t.importFileExtension}`),t};var Lm=e=>{let t=e?L.dirname(e):process.cwd();for(;t!==L.dirname(t);){let r=L.join(t,"package.json");if(ye.existsSync(r))try{let o=JSON.parse(ye.readFileSync(r,"utf8"));return {...o.dependencies,...o.devDependencies,...o.peerDependencies,...o.optionalDependencies}}catch{}let n=L.dirname(t);if(n===t)break;t=n;}return {}};var rh=()=>!!(process.stdin.isTTY&&process.stdout.isTTY&&!process.env.CI&&!process.env.NO_INTERACTIVE&&!process.env.NO_INTERACTION),dM=async({logger:e,userConfigs:t})=>{let r=[],n={},o=e.timeEvent("load");for(let p of t){let c;if(p?.configFile){let y=p.configFile.split(".");c=y.slice(0,y.length-1).join(".");}let m=e.timeEvent("c12"),{loadConfig:l}=await import('c12'),{config:f,configFile:d}=await l({configFile:c,name:"openapi-ts"});m.timeEnd(),Object.keys(n).length||(n=Lm(Object.keys(f).length?d:void 0));let u=f instanceof Array?f.map(y=>Ai(y,p)):[Ai(f,p)];for(let y of u){let g=Ri(y);if(y.output instanceof Array){let x=g.length,b=y.output.length;if(b>1)if(x!==b){console.warn(`\u2699\uFE0F ${ge.yellow("Warning:")} You provided ${ge.cyan(String(x))} ${ge.cyan(x===1?"input":"inputs")} and ${ge.yellow(String(b))} ${ge.yellow("outputs")}. This is probably not what you want as it will produce identical output in multiple locations. You most likely want to provide a single output or the same number of outputs as inputs.`);for(let I of y.output)r.push({...y,input:g,output:I});}else y.output.forEach((I,P)=>{r.push({...y,input:g[P],output:I});});else r.push({...y,input:g,output:y.output[0]??""});}else r.push({...y,input:g});}}o.timeEnd();let i=[],a=e.timeEvent("build");for(let p of r){let{base:c,configFile:m="",dryRun:l=false,experimentalParser:f=true,exportCore:d=true,name:u,request:y,useOptions:g=true}=p,x=p.interactive!==void 0?p.interactive:rh(),b=wi(p),I=Ri(p),P=$m(p),j=qi(p),C=[];I.length||C.push(new qt("missing input - which OpenAPI specification should we use to generate your output?")),P.path||C.push(new qt("missing output - where should we generate your output?")),g||console.warn("\u2757\uFE0F Deprecation warning: useOptions set to false. This setting will be removed in future versions. Please migrate useOptions to true https://heyapi.dev/openapi-ts/migrating.html#v0-27-38"),P.path=L.resolve(process.cwd(),P.path);let D;try{D=Cm({dependencies:n,userConfig:p});}catch(M){C.push(M),D={pluginOrder:[],plugins:{}};}let K=Fi({...D,base:c,configFile:m,dryRun:l,experimentalParser:f,exportCore:false,input:I,interactive:x,logs:b,name:u,output:P,parser:j,request:y,useOptions:g});K.exportCore=Q(K)?d:false;let v=i.length;if(b.level==="debug"){let M=ge.gray(`[Job ${v+1}] `);console.warn(`${M}${ge.cyan("config:")}`,K);}i.push({config:K,errors:C,jobIndex:v});}return a.timeEnd(),{dependencies:n,results:i}};var ch=e=>{let t=[];return e.forEach((r,n)=>{t.push([n,r]);}),t},Oo=(...e)=>{let t=new Headers;for(let r of e){if(!r)continue;let n=r instanceof Headers?ch(r):Object.entries(r);for(let[o,i]of n)if(i===null)t.delete(o);else if(Array.isArray(i))for(let a of i)t.append(o,a);else i!==void 0&&t.set(o,typeof i=="object"?JSON.stringify(i):i);}return t};var rL=async({fetchOptions:e,inputPath:t,timeout:r,watch:n})=>{let o=getResolvedInput({pathOrUrlOrSchema:t}),i,a,p;if(o.type==="url"){if(n.lastValue&&n.isHeadMethodSupported!==false){try{let c=await sendRequest({fetchOptions:{method:"HEAD",...e,headers:Oo(e?.headers,n.headers)},timeout:r,url:o.path});if(c.response.status>=300)return {error:"not-ok",response:c.response};p=c.response;}catch(c){return {error:"not-ok",response:new Response(c.message)}}if(!p.ok&&n.isHeadMethodSupported)return {error:"not-ok",response:p};if(n.isHeadMethodSupported===void 0&&(n.isHeadMethodSupported=p.ok),p.status===304)return {error:"not-modified",response:p};if(a===void 0){let c=p.headers.get("ETag");c&&(a=c!==n.headers.get("If-None-Match"),a&&n.headers.set("If-None-Match",c));}if(a===void 0){let c=p.headers.get("Last-Modified");c&&(a=c!==n.headers.get("If-Modified-Since"),a&&n.headers.set("If-Modified-Since",c));}if(a===false)return {error:"not-modified",response:p}}try{let c=await sendRequest({fetchOptions:{method:"GET",...e},timeout:r,url:o.path});if(c.response.status>=300)return {error:"not-ok",response:c.response};p=c.response;}catch(c){return {error:"not-ok",response:new Response(c.message)}}if(!p.ok)return {error:"not-ok",response:p};if(i=p.body?await p.arrayBuffer():new ArrayBuffer(0),a===void 0){let c=new TextDecoder().decode(i);a=c!==n.lastValue,n.lastValue=c;}}else n.lastValue?a=false:n.lastValue=o.type;return a===false?{error:"not-modified",response:p}:{arrayBuffer:i,resolvedInput:o}};
|
|
46
|
+
export{Qo as A,Ep as B,hP as C,gP as D,je as E,Ce as F,kP as G,Ne as H,vt as I,jm as J,dM as K,rL as L,ki as a,fh as b,dh as c,ji as d,it as e,Oh as f,qt as g,Fr as h,Br as i,kh as j,jh as k,Ch as l,Nh as m,k as n,A as o,Q as p,$t as q,wi as r,Jm as s,R as t,q as u,s as v,Og as w,ct as x,Ar as y,Xe as z};//# sourceMappingURL=chunk-F2CVRHGI.js.map
|
|
47
|
+
//# sourceMappingURL=chunk-F2CVRHGI.js.map
|