@fern-api/csharp-dynamic-snippets 2.80.0 → 2.81.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ var Sc=Object.defineProperty;var Ed=(e,t,r)=>t in e?Sc(e,t,{enumerable:!0,config
|
|
|
2
2
|
`).map(A=>{let I=A.match(/at\s+(.*)\s+\((.*):(\d+):(\d+)\)/);if(I&&I.length===5){let[,P,L,O,F]=I;if(!P||!L||!O||!F)return;if(w||o.some(U=>P?.includes(U))){w=!0;return}switch(P){case"Object.<anonymous>":P="";break;case"Object.object":case"Object.alias":case"Object.union":case"Object.enum":case"Object.undiscriminatedUnion":P=`${P.substring(P.indexOf(".")+1)}()=> { ... }`;break}return{fn:P,path:b(L),position:`${O}:${F}`}}}).filter(A=>A&&!i.some(I=>A.fn.includes(I))&&!(p&&A.path?.startsWith("node:"))&&!(l&&A.path?.endsWith(".js"))&&!r.some(I=>A.path.includes(I))).slice(t,t+e)}function Ui({maxFrames:e=50,skip:t=0,filterPaths:r=[],filterFunctions:i=[],stopOn:o=["runInteractiveTask"],filterNode:p=!0,filterJs:l=!0,multiline:b=!1,formatFilename:w=A=>A}={}){return je?`${Di({maxFrames:e,skip:t,filterPaths:r,filterFunctions:i,stopOn:o,filterNode:p,filterJs:l,formatFilename:w}).map(A=>`${b?`
|
|
3
3
|
`:" > "}${A.fn} - ${A.path}:${A.position}`).join("")}`:""}var Gn=class{constructor({maxFrames:t=50,skip:r=0,filterPaths:i=[],filterFunctions:o=[],stopOn:p=[],filterNode:l=!0,filterJs:b=!0,multiline:w=!1,formatFilename:A=I=>I}={}){y(this,"maxFrames");y(this,"skip");y(this,"filterPaths");y(this,"filterFunctions");y(this,"stopOn");y(this,"filterNode");y(this,"filterJs");y(this,"multiline");y(this,"formatFilename");y(this,"tracking",new WeakMap);this.maxFrames=t,this.skip=r,this.filterPaths=i,this.filterFunctions=o,this.stopOn=p,this.filterNode=l,this.filterJs=b,this.multiline=w,this.formatFilename=A}tag(t){let r=this.tracking.get(t)||new Set;Di({maxFrames:this.maxFrames,skip:this.skip,filterPaths:this.filterPaths,filterFunctions:this.filterFunctions,stopOn:this.stopOn,filterNode:this.filterNode,filterJs:this.filterJs,formatFilename:this.formatFilename}).forEach(i=>r.add(i)),this.tracking.set(t,r)}trace(t){if(!je)return"";let r=this.tracking.get(t);return r?[...r].map(i=>`${this.multiline?`
|
|
4
4
|
`:""}${i.fn} - ${i.path}:${i.position}`).join(""):""}frames(t){let r=this.tracking.get(t);return r?[...r]:[]}free(t){this.tracking.delete(t)}clear(){this.tracking=new WeakMap}},Wo;function ql({maxFrames:e=50,skip:t=0,filterPaths:r=[],filterFunctions:i=[],stopOn:o=[],filterNode:p=!0,filterJs:l=!0,multiline:b=!1,formatFilename:w=A=>A}={}){je&&(Wo??(Wo=new Gn({maxFrames:e,skip:t,filterPaths:r,filterFunctions:i,stopOn:o,filterNode:p,filterJs:l,multiline:b,formatFilename:w})))}function Gl(e){Wo?.tag(e)}function Mi(e){return Wo?.frames(e)??[]}var ut=class{constructor(){Gl(this)}};n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();var h0="__package__",S2=`${h0}.yml`;var Wl="default-group",$l="spec-origin",Hl="async-api",Jl="openapi",Kl="openapi-overrides",Ql="api-settings";var Yl="local";var Ge={};z(Ge,{API_ORIGIN_LOCATION_KEY:()=>$l,API_SETTINGS_KEY:()=>Ql,ASYNC_API_LOCATION_KEY:()=>Hl,CoerceConstsTo:()=>df,DEFAULT_GROUP_GENERATORS_CONFIG_KEY:()=>Wl,DEFAULT_GROUP_NAME:()=>Yl,DefaultIntegerFormat:()=>hf,ExampleStyle:()=>yf,FormParameterEncoding:()=>gf,GenerationLanguage:()=>Xl,GithubCommitAndReleaseMode:()=>Af,GithubLicenseType:()=>Nf,GithubSelfhostedMode:()=>If,Language:()=>bf,MessageNamingSettingsSchema:()=>xf,ModelProvider:()=>rf,MultiServerStrategy:()=>Sf,OPENAPI_LOCATION_KEY:()=>Jl,OPENAPI_OVERRIDES_LOCATION_KEY:()=>Kl,PathParameterOrder:()=>wf,RemoveDiscriminantsFromSchemas:()=>Tf,UnionSettingsSchema:()=>Ef,ai:()=>$o,automation:()=>nf,fernDefinition:()=>Ko,generators:()=>Qo,getPackageName:()=>Zl,group:()=>Yo,isApiConfigurationV2Schema:()=>im,isAsyncApiSpecSchema:()=>nm,isConjureSchema:()=>sm,isGraphQLSpecSchema:()=>am,isNamespacedApiConfiguration:()=>om,isOpenApiSpecSchema:()=>um,isOpenRpcSpecSchema:()=>cm,isProtoSpecSchema:()=>pm,isRawProtobufAPIDefinitionSchema:()=>ef,license:()=>Xo,replay:()=>Rf,resolveAutomationConfig:()=>tf,reviewers:()=>Of,serialization:()=>wu});n();a();s();n();a();s();var Xl={TYPESCRIPT:"typescript",JAVA:"java",PYTHON:"python",GO:"go",RUBY:"ruby",CSHARP:"csharp",SWIFT:"swift",PHP:"php",RUST:"rust"};function Zl({generatorInvocation:e}){return e.language==="go"?y0(e):e.outputMode._visit({downloadFiles:()=>{},github:t=>t.publishInfo?._visit({maven:r=>r.coordinate,npm:r=>r.packageName,pypi:r=>r.packageName,postman:()=>{},rubygems:r=>r.packageName,nuget:r=>r.packageName,crates:r=>r.packageName,_other:()=>{}}),githubV2:t=>t.publishInfo?._visit({maven:r=>r.coordinate,npm:r=>r.packageName,pypi:r=>r.packageName,postman:()=>{},rubygems:r=>r.packageName,nuget:r=>r.packageName,crates:r=>r.packageName,_other:()=>{}}),publish:()=>{},publishV2:()=>{},_other:()=>{}})}function y0(e){return e.outputMode._visit({downloadFiles:()=>{},github:t=>`github.com/${t.owner}/${t.repo}`,githubV2:t=>`github.com/${t.owner}/${t.repo}`,publish:()=>{},publishV2:()=>{},_other:()=>{}})}n();a();s();function ef(e){return typeof e!="string"&&"proto"in e}n();a();s();var Wn={generate:!0,upgrade:!0,preview:!0,verify:!0};function tf({rootAutomation:e,groupAutomation:t,generatorAutomation:r}){return{generate:r?.generate??t?.generate??e?.generate??Wn.generate,upgrade:r?.upgrade??t?.upgrade??e?.upgrade??Wn.upgrade,preview:r?.preview??t?.preview??e?.preview??Wn.preview,verify:r?.verify??t?.verify??e?.verify??Wn.verify}}n();a();s();n();a();s();var $o={};z($o,{ModelProvider:()=>rf});n();a();s();n();a();s();var rf={Openai:"openai",Anthropic:"anthropic",AwsBedrock:"aws-bedrock"};var nf={};n();a();s();var Ko={};z(Ko,{AvailabilityStatusSchema:()=>af,OAuthFlowTypeSchema:()=>sf,auth:()=>Ho,availability:()=>Jo,commons:()=>of,encoding:()=>uf,environments:()=>cf,file:()=>pf,service:()=>lf,types:()=>ff,validation:()=>mf});n();a();s();n();a();s();var Ho={};z(Ho,{OAuthFlowTypeSchema:()=>sf});n();a();s();n();a();s();var sf={ClientCredentials:"client-credentials",AuthorizationCode:"authorization-code",DeviceCode:"device-code"};var Jo={};z(Jo,{AvailabilityStatusSchema:()=>af});n();a();s();n();a();s();var af={InDevelopment:"in-development",PreRelease:"pre-release",Deprecated:"deprecated",GenerallyAvailable:"generally-available"};var of={};n();a();s();var uf={};n();a();s();var cf={};n();a();s();var pf={};n();a();s();var lf={};n();a();s();var ff={};n();a();s();var mf={};n();a();s();var Qo={};z(Qo,{CoerceConstsTo:()=>df,DefaultIntegerFormat:()=>hf,ExampleStyle:()=>yf,FormParameterEncoding:()=>gf,Language:()=>bf,MessageNamingSettingsSchema:()=>xf,MultiServerStrategy:()=>Sf,PathParameterOrder:()=>wf,RemoveDiscriminantsFromSchemas:()=>Tf,UnionSettingsSchema:()=>Ef});n();a();s();n();a();s();var df={Literals:"literals",Enums:"enums",EnumsCoerceableToLiterals:"enums-coerceable-to-literals"};n();a();s();var hf={Int32:"int32",Int64:"int64",Uint32:"uint32",Uint64:"uint64"};n();a();s();var yf={Minimal:"minimal",Comprehensive:"comprehensive"};n();a();s();var gf={Form:"form",Json:"json"};n();a();s();var bf={Java:"java",Python:"python",Go:"go",Ruby:"ruby",Csharp:"csharp",Typescript:"typescript",Php:"php",Rust:"rust",Swift:"swift"};n();a();s();var xf={V1:"v1",V2:"v2"};n();a();s();var Sf={EnvironmentPerServer:"environment-per-server",UrlsPerEnvironment:"urls-per-environment"};n();a();s();var wf={UrlOrder:"url-order",SpecOrder:"spec-order"};n();a();s();var Tf={Always:"always",Never:"never"};n();a();s();var Ef={V1:"v1"};var Yo={};z(Yo,{GithubCommitAndReleaseMode:()=>Af,GithubSelfhostedMode:()=>If});n();a();s();n();a();s();var Af={Commit:"commit",Release:"release"};n();a();s();var If={PullRequest:"pull-request",Push:"push",CommitAndRelease:"commit-and-release"};var Xo={};z(Xo,{GithubLicenseType:()=>Nf});n();a();s();n();a();s();var Nf={Mit:"MIT",Apache:"Apache-2.0"};var Rf={};n();a();s();var Of={};n();a();s();var wu={};z(wu,{AiServicesSchema:()=>Xn,ApiConfigurationSchema:()=>ca,ApiConfigurationSchemaInternal:()=>Pr,ApiConfigurationV2Schema:()=>oa,ApiConfigurationV2SettingsSchema:()=>kr,ApiConfigurationV2SpecsSchema:()=>Fr,ApiDefinitionList:()=>$s,ApiDefinitionPathSchema:()=>It,ApiDefinitionSchema:()=>Ws,ApiDefinitionSettingsSchema:()=>Ir,ApiDefinitionWithOverridesSchema:()=>Nr,AsyncApiSettingsSchema:()=>_r,AsyncApiSpecSchema:()=>ta,AutomationSchema:()=>wt,BaseApiSettingsSchema:()=>Cr,BaseGeneratorInvocationSchema:()=>Lr,CoerceConstsTo:()=>Hs,ConjureSchema:()=>ea,CratesOutputLocationSchema:()=>da,CustomGeneratorInvocationSchema:()=>ja,DefaultGeneratorInvocationSchema:()=>Ba,DefaultIntegerFormat:()=>Js,ExampleStyle:()=>pa,FormParameterEncoding:()=>Ks,GeneratorApiSettingsSchema:()=>ma,GeneratorGroupSchema:()=>Ua,GeneratorImageObjectSchema:()=>la,GeneratorInvocationSchema:()=>Da,GeneratorOutputSchema:()=>Aa,GeneratorPublishMetadataSchema:()=>Gi,GeneratorSnippetsSchema:()=>Ra,GeneratorsConfigurationSchema:()=>rm,GeneratorsOpenApiObjectSchema:()=>va,GeneratorsOpenApiSchema:()=>Va,GitRemoteSchema:()=>qs,GithubCommitAndReleaseMode:()=>Oa,GithubCommitAndReleaseSchema:()=>Pa,GithubConfigurationSchema:()=>La,GithubLicenseCustomSchema:()=>Ia,GithubLicenseSchema:()=>qe,GithubLicenseType:()=>Na,GithubPullRequestSchema:()=>Ca,GithubPushSchema:()=>_a,GithubSelfhostedMode:()=>ka,GithubSelfhostedSchema:()=>Fa,GraphQlSpecSchema:()=>ra,Language:()=>za,LocalFileSystemOutputLocationSchema:()=>ha,MavenOutputLocationSchema:()=>ga,MavenOutputSignatureSchema:()=>ya,MessageNamingSettingsSchema:()=>wr,ModelName:()=>Qn,ModelProvider:()=>Yn,MultiServerStrategy:()=>Tr,NamespacedApiConfigurationSchema:()=>ua,NpmOutputLocationSchema:()=>ba,NugetOutputLocationSchema:()=>xa,OpenApiExampleGenerationSchema:()=>Qs,OpenApiFilterSchema:()=>Ys,OpenApiSettingsSchema:()=>Rt,OpenApiSpecSchema:()=>ia,OpenRpcSpecSchema:()=>na,OutputMetadataAuthor:()=>fa,OutputMetadataSchema:()=>Ot,OverridesSchema:()=>ze,PathParameterOrder:()=>Er,PostmanOutputLocationSchema:()=>Sa,ProtobufApiDefinitionSchema:()=>Or,ProtobufDefinitionSchema:()=>Rr,ProtobufSpecSchema:()=>sa,PypiOutputLocationSchema:()=>Ta,PypiOutputMetadataSchema:()=>wa,ReadmeCustomSectionSchema:()=>qa,ReadmeEndpointObjectSchema:()=>Ga,ReadmeEndpointSchema:()=>Wi,ReadmeSchema:()=>Wa,RemoveDiscriminantsFromSchemas:()=>Ar,ReplayConfigSchema:()=>Ma,RequestOrResponseExampleGenerationSchema:()=>zi,ResolveAliases:()=>Zs,ResolveAliasesSchema:()=>Xs,ReviewerSchema:()=>qi,ReviewersSchema:()=>Pt,RubyGemsOutputLocationSchema:()=>Ea,SpecGitSourceSchema:()=>Gs,SpecSchema:()=>aa,SpecSourceSchema:()=>Nt,UnionSettingsSchema:()=>zs,WhitelabelConfigurationSchema:()=>Ha,WhitelabelGithubConfigurationSchema:()=>$a,ai:()=>nu,automation:()=>su,fernDefinition:()=>hu,generators:()=>yu,group:()=>gu,license:()=>bu,replay:()=>xu,reviewers:()=>Su});n();a();s();n();a();s();var nu={};z(nu,{AiServicesSchema:()=>Xn,ModelName:()=>Qn,ModelProvider:()=>Yn});n();a();s();n();a();s();n();a();s();var u={};z(u,{JsonError:()=>fr,ParseError:()=>mr,any:()=>zf,bigint:()=>Cf,boolean:()=>qf,booleanLiteral:()=>vf,date:()=>_f,discriminant:()=>Zf,enum_:()=>Hn,getObjectLikeUtils:()=>Je,getObjectUtils:()=>Jt,getSchemaUtils:()=>ae,isProperty:()=>pt,lazy:()=>kf,lazyObject:()=>Uf,list:()=>Kn,never:()=>Gf,number:()=>Wf,object:()=>Jn,objectWithoutOptionalProperties:()=>Df,optional:()=>Zo,property:()=>Lf,record:()=>Kf,set:()=>Qf,string:()=>$f,stringLiteral:()=>Vf,transform:()=>eu,undiscriminatedUnion:()=>Xf,union:()=>tm,unknown:()=>Hf,withParsedProperties:()=>iu});n();a();s();n();a();s();n();a();s();n();a();s();var Q={BIGINT:"bigint",DATE:"date",ENUM:"enum",LIST:"list",STRING_LITERAL:"stringLiteral",BOOLEAN_LITERAL:"booleanLiteral",OBJECT:"object",ANY:"any",BOOLEAN:"boolean",NUMBER:"number",STRING:"string",UNKNOWN:"unknown",NEVER:"never",RECORD:"record",SET:"set",UNION:"union",UNDISCRIMINATED_UNION:"undiscriminatedUnion",NULLABLE:"nullable",OPTIONAL:"optional",OPTIONAL_NULLABLE:"optionalNullable"};n();a();s();function ie(e,t){return`Expected ${t}. Received ${g0(e)}.`}function g0(e){if(Array.isArray(e))return"list";if(e===null)return"null";if(e instanceof BigInt)return"BigInt";switch(typeof e){case"string":return`"${e}"`;case"bigint":case"number":case"boolean":case"undefined":return`${e}`}return typeof e}n();a();s();function xe(e){return{...e,json:Pf(e.json),parse:Pf(e.parse)}}function Pf(e){return(t,r)=>{let i=e(t,r),{skipValidation:o=!1}=r??{};return!i.ok&&o?(console.warn(["Failed to validate.",...i.errors.map(p=>" - "+(p.path.length>0?`${p.path.join(".")}: ${p.message}`:p.message))].join(`
|
|
5
|
-
`)),{ok:!0,value:t}):i}}n();a();s();n();a();s();n();a();s();n();a();s();function $n(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var fr=class extends Error{constructor(r){super(r.map($n).join("; "));y(this,"errors");this.errors=r,Object.setPrototypeOf(this,new.target.prototype),this.name=this.constructor.name}};n();a();s();var mr=class extends Error{constructor(r){super(r.map($n).join("; "));y(this,"errors");this.errors=r,Object.setPrototypeOf(this,new.target.prototype),this.name=this.constructor.name}};function ae(e){return{nullable:()=>b0(e),optional:()=>Zo(e),optionalNullable:()=>x0(e),transform:t=>eu(e,t),parseOrThrow:(t,r)=>{let i=e.parse(t,r);if(i.ok)return i.value;throw new mr(i.errors)},jsonOrThrow:(t,r)=>{let i=e.json(t,r);if(i.ok)return i.value;throw new fr(i.errors)}}}function b0(e){let t={parse:(r,i)=>r==null?{ok:!0,value:null}:e.parse(r,i),json:(r,i)=>r==null?{ok:!0,value:null}:e.json(r,i),getType:()=>Q.NULLABLE};return{...t,...ae(t)}}function Zo(e){let t={parse:(r,i)=>r==null?{ok:!0,value:void 0}:e.parse(r,i),json:(r,i)=>i?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,i),getType:()=>Q.OPTIONAL};return{...t,...ae(t)}}function x0(e){let t={parse:(r,i)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.parse(r,i),json:(r,i)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.json(r,i),getType:()=>Q.OPTIONAL_NULLABLE};return{...t,...ae(t)}}function eu(e,t){let r={parse:(i,o)=>{let p=e.parse(i,o);return p.ok?{ok:!0,value:t.transform(p.value)}:p},json:(i,o)=>{let p=t.untransform(i);return e.json(p,o)},getType:()=>e.getType()};return{...r,...ae(r)}}function Cf(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t}:typeof t=="number"?{ok:!0,value:BigInt(t)}:{ok:!1,errors:[{path:r,message:ie(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:ie(t,"bigint")}]}:{ok:!0,value:t},getType:()=>Q.BIGINT};return{...xe(e),...ae(e)}}n();a();s();n();a();s();var S0=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function _f(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:ie(t,"string")}]}:S0.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:ie(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:ie(t,"Date object")}]},getType:()=>Q.DATE};return{...xe(e),...ae(e)}}n();a();s();n();a();s();n();a();s();function Se(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...xe(r),...ae(r)}}}function Hn(e){let t=new Set(e);return Se(Q.ENUM,(i,{allowUnrecognizedEnumValues:o,breadcrumbsPrefix:p=[]}={})=>typeof i!="string"?{ok:!1,errors:[{path:p,message:ie(i,"string")}]}:!t.has(i)&&!o?{ok:!1,errors:[{path:p,message:ie(i,"enum")}]}:{ok:!0,value:i})()}n();a();s();n();a();s();function kf(e){let t=tu(e);return{...t,...ae(t)}}function tu(e){return{parse:(t,r)=>dr(e).parse(t,r),json:(t,r)=>dr(e).json(t,r),getType:()=>dr(e).getType()}}function dr(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}n();a();s();n();a();s();n();a();s();n();a();s();function ru(e){return Object.entries(e)}n();a();s();function vi(e,t){let r=new Set(t);return Object.entries(e).reduce((i,[o,p])=>(r.has(o)&&(i[o]=p),i),{})}n();a();s();function ct(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===null?!0:Object.getPrototypeOf(t)===null}n();a();s();function Vi(e){return Object.keys(e)}n();a();s();function Ff(e,t){let r=[],i=[];for(let o of e)t(o)?r.push(o):i.push(o);return[r,i]}n();a();s();n();a();s();var w0=Object.prototype.hasOwnProperty;function Je(e){return{withParsedProperties:t=>iu(e,t)}}function iu(e,t){let r={parse:(i,o)=>{let p=e.parse(i,o);if(!p.ok)return p;let l={};for(let b in t)if(w0.call(t,b)){let w=t[b];l[b]=typeof w=="function"?w(p.value):w}return{ok:!0,value:{...p.value,...l}}},json:(i,o)=>{if(!ct(i))return{ok:!1,errors:[{path:o?.breadcrumbsPrefix??[],message:ie(i,"object")}]};let p=new Set(Object.keys(t)),l=vi(i,Object.keys(i).filter(b=>!p.has(b)));return e.json(l,o)},getType:()=>e.getType()};return{...r,...ae(r),...Je(r)}}n();a();s();function Lf(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function pt(e){return e.isProperty}var T0=Object.prototype.hasOwnProperty;function Jn(e){let t;function r(){if(t==null){t={};for(let[L,O]of ru(e)){let F=pt(O)?O.rawKey:L,U=pt(O)?O.valueSchema:O;t[F]={rawKey:F,parsedKey:L,valueSchema:U}}}return t}let i,o,p,l;function b(){if(i==null){i=[],o=[];for(let[L,O]of ru(e)){let F=pt(O)?O.rawKey:L,U=pt(O)?O.valueSchema:O;E0(U)&&(i.push(F),o.push(L))}p=new Set(i),l=new Set(o)}return i}function w(){return o==null&&b(),o}function A(){return p==null&&b(),p}function I(){return l==null&&b(),l}let P={_getRawProperties:()=>Object.entries(e).map(([L,O])=>pt(O)?O.rawKey:L),_getParsedProperties:()=>Vi(e),parse:(L,O)=>{let F=O?.breadcrumbsPrefix??[];return jf({value:L,requiredKeys:b(),requiredKeysSet:A(),getProperty:U=>{let M=r()[U];if(M!=null)return{transformedKey:M.parsedKey,transform:W=>{let q=[...F,U];return M.valueSchema.parse(W,{...O,breadcrumbsPrefix:q})}}},unrecognizedObjectKeys:O?.unrecognizedObjectKeys,skipValidation:O?.skipValidation,breadcrumbsPrefix:F,omitUndefined:O?.omitUndefined})},json:(L,O)=>{let F=O?.breadcrumbsPrefix??[];return jf({value:L,requiredKeys:w(),requiredKeysSet:I(),getProperty:U=>{let M=e[U];if(M!=null)return pt(M)?{transformedKey:M.rawKey,transform:W=>{let q=[...F,U];return M.valueSchema.json(W,{...O,breadcrumbsPrefix:q})}}:{transformedKey:U,transform:W=>{let q=[...F,U];return M.json(W,{...O,breadcrumbsPrefix:q})}}},unrecognizedObjectKeys:O?.unrecognizedObjectKeys,skipValidation:O?.skipValidation,breadcrumbsPrefix:F,omitUndefined:O?.omitUndefined})},getType:()=>Q.OBJECT};return{...xe(P),...ae(P),...Je(P),...Jt(P)}}function jf({value:e,requiredKeys:t,requiredKeysSet:r,getProperty:i,unrecognizedObjectKeys:o="fail",skipValidation:p=!1,breadcrumbsPrefix:l=[]}){if(!ct(e))return{ok:!1,errors:[{path:l,message:ie(e,"object")}]};let b=t.length,w=[],A={};for(let I in e){if(!T0.call(e,I))continue;let P=e[I],L=i(I);if(L!=null){b>0&&r.has(I)&&b--;let O=L.transform(P);O.ok?A[L.transformedKey]=O.value:(A[I]=P,w.push(...O.errors))}else switch(o){case"fail":w.push({path:[...l,I],message:`Unexpected key "${I}"`});break;case"strip":break;case"passthrough":A[I]=P;break}}if(b>0)for(let I of t)I in e||w.push({path:l,message:`Missing required key "${I}"`});return w.length===0||p?{ok:!0,value:A}:{ok:!1,errors:w}}function Jt(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(i,o)=>Bf({extensionKeys:t._getRawProperties(),value:i,transformBase:p=>e.parse(p,o),transformExtension:p=>t.parse(p,o),breadcrumbsPrefix:o?.breadcrumbsPrefix}),json:(i,o)=>Bf({extensionKeys:t._getParsedProperties(),value:i,transformBase:p=>e.json(p,o),transformExtension:p=>t.json(p,o),breadcrumbsPrefix:o?.breadcrumbsPrefix}),getType:()=>Q.OBJECT};return{...r,...ae(r),...Je(r),...Jt(r)}},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),i={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(o,p)=>{let l=e.parse(o,{...p,unrecognizedObjectKeys:"passthrough"});if(!l.ok)return l;let b={};if(typeof o=="object"&&o!=null)for(let[w,A]of Object.entries(o))t.has(w)||(b[w]=A);return{ok:!0,value:{...b,...l.value}}},json:(o,p)=>{let l=e.json(o,{...p,unrecognizedObjectKeys:"passthrough"});if(!l.ok)return l;let b={};if(typeof o=="object"&&o!=null)for(let[w,A]of Object.entries(o))r.has(w)||(b[w]=A);return{ok:!0,value:{...b,...l.value}}},getType:()=>Q.OBJECT};return{...i,...ae(i),...Je(i),...Jt(i)}}}}function Bf({extensionKeys:e,value:t,transformBase:r,transformExtension:i,breadcrumbsPrefix:o=[]}){if(!ct(t))return{ok:!1,errors:[{path:o,message:ie(t,"object")}]};let p=new Set(e),[l,b]=Ff(Vi(t),I=>p.has(I)),w=r(vi(t,b)),A=i(vi(t,l));return w.ok&&A.ok?{ok:!0,value:{...w.value,...A.value}}:{ok:!1,errors:[...w.ok?[]:w.errors,...A.ok?[]:A.errors]}}function E0(e){return!A0(e)}function A0(e){switch(e.getType()){case Q.ANY:case Q.UNKNOWN:case Q.OPTIONAL:case Q.OPTIONAL_NULLABLE:return!0;default:return!1}}n();a();s();function Df(e){return Jn(e)}function Uf(e){let t={...tu(e),_getRawProperties:()=>dr(e)._getRawProperties(),_getParsedProperties:()=>dr(e)._getParsedProperties()};return{...t,...ae(t),...Je(t),...Jt(t)}}n();a();s();n();a();s();function Kn(e){let t={parse:(r,i)=>Mf(r,(o,p)=>e.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${p}]`]})),json:(r,i)=>Mf(r,(o,p)=>e.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${p}]`]})),getType:()=>Q.LIST};return{...xe(t),...ae(t)}}function Mf(e,t){if(!Array.isArray(e))return{ok:!1,errors:[{message:ie(e,"list"),path:[]}]};let r=[],i=[];for(let o=0;o<e.length;o++){let p=t(e[o],o);p.ok?r.push(p.value):i.push(...p.errors)}return i.length===0?{ok:!0,value:r}:{ok:!1,errors:i}}n();a();s();n();a();s();function vf(e){return Se(Q.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:ie(r,`${e.toString()}`)}]})()}n();a();s();function Vf(e){return Se(Q.STRING_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:ie(r,`"${e}"`)}]})()}n();a();s();n();a();s();var zf=Se(Q.ANY,e=>({ok:!0,value:e}));n();a();s();var qf=Se(Q.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:ie(e,"boolean")}]});n();a();s();var Gf=Se(Q.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}));n();a();s();var Wf=Se(Q.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:ie(e,"number")}]});n();a();s();var $f=Se(Q.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:ie(e,"string")}]});n();a();s();var Hf=Se(Q.UNKNOWN,e=>({ok:!0,value:e}));n();a();s();n();a();s();var I0=Object.prototype.hasOwnProperty;function Kf(e,t){let r={parse:(i,o)=>Jf({value:i,isKeyNumeric:e.getType()===Q.NUMBER,transformKey:p=>e.parse(p,{...o,breadcrumbsPrefix:[...o?.breadcrumbsPrefix??[],`${p} (key)`]}),transformValue:(p,l)=>t.parse(p,{...o,breadcrumbsPrefix:[...o?.breadcrumbsPrefix??[],`${l}`]}),breadcrumbsPrefix:o?.breadcrumbsPrefix}),json:(i,o)=>Jf({value:i,isKeyNumeric:e.getType()===Q.NUMBER,transformKey:p=>e.json(p,{...o,breadcrumbsPrefix:[...o?.breadcrumbsPrefix??[],`${p} (key)`]}),transformValue:(p,l)=>t.json(p,{...o,breadcrumbsPrefix:[...o?.breadcrumbsPrefix??[],`${l}`]}),breadcrumbsPrefix:o?.breadcrumbsPrefix}),getType:()=>Q.RECORD};return{...xe(r),...ae(r)}}function Jf({value:e,isKeyNumeric:t,transformKey:r,transformValue:i,breadcrumbsPrefix:o=[]}){if(!ct(e))return{ok:!1,errors:[{path:o,message:ie(e,"object")}]};let p={},l=[];for(let b in e){if(!I0.call(e,b))continue;let w=e[b];if(w===void 0)continue;let A=b;if(t){let L=b.length>0?Number(b):NaN;Number.isNaN(L)||(A=L)}let I=r(A),P=i(w,A);I.ok&&P.ok?p[I.value]=P.value:(I.ok||l.push(...I.errors),P.ok||l.push(...P.errors))}return l.length===0?{ok:!0,value:p}:{ok:!1,errors:l}}n();a();s();n();a();s();function Qf(e){let t=Kn(e),r={parse:(i,o)=>{let p=t.parse(i,o);return p.ok?{ok:!0,value:new Set(p.value)}:p},json:(i,o)=>i instanceof Set?t.json([...i],o):{ok:!1,errors:[{path:o?.breadcrumbsPrefix??[],message:ie(i,"Set")}]},getType:()=>Q.SET};return{...xe(r),...ae(r)}}n();a();s();n();a();s();function Xf(e){let t={parse:(r,i)=>Yf((o,p)=>o.parse(r,p),e,i),json:(r,i)=>Yf((o,p)=>o.json(r,p),e,i),getType:()=>Q.UNDISCRIMINATED_UNION};return{...xe(t),...ae(t)}}function Yf(e,t,r){let i=[];for(let[o,p]of t.entries()){let l=e(p,{...r,skipValidation:!1});if(l.ok)return l;for(let b of l.errors)i.push({path:b.path,message:`[Variant ${o}] ${b.message}`})}return{ok:!1,errors:i}}n();a();s();n();a();s();function Zf(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}n();a();s();var N0=Object.prototype.hasOwnProperty;function tm(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,i=typeof e=="string"?e:e.parsedDiscriminant,o=Hn(Vi(t)),p={parse:(l,b)=>em({value:l,discriminant:r,transformedDiscriminant:i,transformDiscriminantValue:w=>o.parse(w,{allowUnrecognizedEnumValues:b?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...b?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:w=>t[w],allowUnrecognizedUnionMembers:b?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(w,A)=>A.parse(w,b),breadcrumbsPrefix:b?.breadcrumbsPrefix}),json:(l,b)=>em({value:l,discriminant:i,transformedDiscriminant:r,transformDiscriminantValue:w=>o.json(w,{allowUnrecognizedEnumValues:b?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...b?.breadcrumbsPrefix??[],i]}),getAdditionalPropertiesSchema:w=>t[w],allowUnrecognizedUnionMembers:b?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(w,A)=>A.json(w,b),breadcrumbsPrefix:b?.breadcrumbsPrefix}),getType:()=>Q.UNION};return{...xe(p),...ae(p),...Je(p)}}function em({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:i,getAdditionalPropertiesSchema:o,allowUnrecognizedUnionMembers:p=!1,transformAdditionalProperties:l,breadcrumbsPrefix:b=[]}){if(!ct(e))return{ok:!1,errors:[{path:b,message:ie(e,"object")}]};let w=e[t],A={};for(let O in e)N0.call(e,O)&&O!==t&&(A[O]=e[O]);if(w==null)return{ok:!1,errors:[{path:b,message:`Missing discriminant ("${t}")`}]};let I=i(w);if(!I.ok)return{ok:!1,errors:I.errors};let P=o(I.value);if(P==null)return p?{ok:!0,value:{[r]:I.value,...A}}:{ok:!1,errors:[{path:[...b,t],message:"Unexpected discriminant value"}]};let L=l(A,P);return L.ok?{ok:!0,value:{[r]:w,...L.value}}:L}n();a();s();var Qn=u.string();n();a();s();var Yn=u.enum_(["openai","anthropic","aws-bedrock"]);var Xn=u.object({provider:Yn,model:Qn});var su={};z(su,{AutomationSchema:()=>wt});n();a();s();n();a();s();var wt=u.object({generate:u.boolean().optional(),upgrade:u.boolean().optional(),preview:u.boolean().optional(),verify:u.boolean().optional()});var hu={};z(hu,{AnyAuthItem:()=>Zn,AnyAuthSchemesSchema:()=>es,ApiAuthSchema:()=>yr,AuthSchemeDeclarationSchema:()=>Et,AuthSchemeReferenceSchema:()=>hr,AuthScope:()=>ls,AuthVariable:()=>Kt,AvailabilitySchema:()=>Es,AvailabilityStatusSchema:()=>br,AvailabilityUnionSchema:()=>As,BaseTypeReferenceSchema:()=>Ds,BasicAuthSchemeSchema:()=>is,BearerAuthSchemeSchema:()=>cs,EncodingSchema:()=>Rs,EndpointSecuritySchema:()=>rs,EndpointSecuritySchemaDetails:()=>ts,EnvironmentSchema:()=>Cs,HeaderAuthSchemeSchema:()=>ps,HttpHeaderSchema:()=>Sr,InferredAuthenticatedRequestHeader:()=>ns,InferredBearerAuthSchema:()=>os,InferredGetTokenEndpointSchema:()=>as,InferredGetTokenEndpointSchemaObject:()=>ss,ListValidationSchema:()=>ks,MapValidationSchema:()=>Fs,MultipleBaseUrlsEnvironmentSchema:()=>Os,NumberValidationSchema:()=>Ls,OAuthAccessTokenRequestPropertiesSchema:()=>ms,OAuthAccessTokenResponsePropertiesSchema:()=>ds,OAuthFlowTypeSchema:()=>fs,OAuthGetTokenEndpointSchema:()=>hs,OAuthPkceSchema:()=>ys,OAuthRefreshTokenEndpointSchema:()=>xs,OAuthRefreshTokenRequestPropertiesSchema:()=>gs,OAuthRefreshTokenResponsePropertiesSchema:()=>bs,OAuthSchemeSchema:()=>Ts,ProtobufTypeSchema:()=>Ns,RedirectUriSchema:()=>ws,RedirectUriWithBackupPortsSchema:()=>Ss,ServerVariableSchema:()=>xr,SingleBaseUrlEnvironmentSchema:()=>Ps,StringValidationSchema:()=>js,TokenBearerAuthSchema:()=>us,TypeReferenceDeclarationWithEnvOverride:()=>vs,TypeReferenceDeclarationWithEnvOverrideSchema:()=>Ms,TypeReferenceDeclarationWithName:()=>Us,ValidationSchema:()=>Bs,WithAudiences:()=>At,WithAvailability:()=>Is,WithDocsSchema:()=>me,WithEnvironmentVariable:()=>gr,WithEnvironmentsSchema:()=>_s,WithHeadersSchema:()=>Vs,WithName:()=>Tt,auth:()=>au,availability:()=>ou,commons:()=>uu,encoding:()=>cu,environments:()=>pu,file:()=>lu,service:()=>fu,types:()=>mu,validation:()=>du});n();a();s();n();a();s();var au={};z(au,{AnyAuthItem:()=>Zn,AnyAuthSchemesSchema:()=>es,ApiAuthSchema:()=>yr,AuthSchemeDeclarationSchema:()=>Et,AuthSchemeReferenceSchema:()=>hr,AuthScope:()=>ls,AuthVariable:()=>Kt,BasicAuthSchemeSchema:()=>is,BearerAuthSchemeSchema:()=>cs,EndpointSecuritySchema:()=>rs,EndpointSecuritySchemaDetails:()=>ts,HeaderAuthSchemeSchema:()=>ps,InferredAuthenticatedRequestHeader:()=>ns,InferredBearerAuthSchema:()=>os,InferredGetTokenEndpointSchema:()=>as,InferredGetTokenEndpointSchemaObject:()=>ss,OAuthAccessTokenRequestPropertiesSchema:()=>ms,OAuthAccessTokenResponsePropertiesSchema:()=>ds,OAuthFlowTypeSchema:()=>fs,OAuthGetTokenEndpointSchema:()=>hs,OAuthPkceSchema:()=>ys,OAuthRefreshTokenEndpointSchema:()=>xs,OAuthRefreshTokenRequestPropertiesSchema:()=>gs,OAuthRefreshTokenResponsePropertiesSchema:()=>bs,OAuthSchemeSchema:()=>Ts,RedirectUriSchema:()=>ws,RedirectUriWithBackupPortsSchema:()=>Ss,TokenBearerAuthSchema:()=>us,WithEnvironmentVariable:()=>gr});n();a();s();n();a();s();n();a();s();n();a();s();var me=u.object({docs:u.string().optional()});var hr=u.object({scheme:u.string()}).extend(me);var Zn=u.undiscriminatedUnion([u.string(),hr]);n();a();s();var es=u.object({any:u.list(Zn)}).extend(me);n();a();s();n();a();s();n();a();s();var ts=u.object({});var rs=u.object({"endpoint-security":ts}).extend(me);var yr=u.undiscriminatedUnion([u.string(),hr,es,rs]);n();a();s();n();a();s();n();a();s();n();a();s();var Tt=u.object({name:u.string().optional()});n();a();s();var gr=u.object({env:u.string().optional()});var Kt=u.object({omit:u.boolean().optional()}).extend(gr).extend(Tt);var is=u.object({scheme:u.stringLiteral("basic"),username:Kt.optional(),password:Kt.optional()}).extend(me);n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();var ns=u.object({"response-property":u.string(),"header-name":u.string(),"value-prefix":u.string().optional()});var ss=u.object({endpoint:u.string(),"expiry-response-property":u.string().optional(),"authenticated-request-headers":u.list(ns).optional()});var as=u.undiscriminatedUnion([u.string(),ss]);var os=u.object({scheme:u.stringLiteral("bearer"),"get-token":as}).extend(me);n();a();s();var us=u.object({scheme:u.stringLiteral("bearer"),token:Kt.optional()}).extend(me);var cs=u.undiscriminatedUnion([us,os]);n();a();s();var ps=u.object({header:u.string(),type:u.string().optional(),prefix:u.string().optional()}).extend(gr).extend(Tt).extend(me);n();a();s();n();a();s();var ls=u.string();n();a();s();var fs=u.enum_(["client-credentials","authorization-code","device-code"]);n();a();s();n();a();s();var ms=u.object({"client-id":u.string().optional(),"client-secret":u.string().optional(),scopes:u.string().optional()});n();a();s();var ds=u.object({"access-token":u.string().optional(),"expires-in":u.string().optional(),"refresh-token":u.string().optional()});var hs=u.object({endpoint:u.string(),"request-properties":ms.optional(),"response-properties":ds.optional()});n();a();s();var ys=u.object({method:u.string().optional()});n();a();s();n();a();s();var gs=u.object({"refresh-token":u.string()});n();a();s();var bs=u.object({"access-token":u.string().optional(),"expires-in":u.string().optional(),"refresh-token":u.string().optional()});var xs=u.object({endpoint:u.string(),"request-properties":gs.optional(),"response-properties":bs.optional()});n();a();s();n();a();s();var Ss=u.object({url:u.string(),ports:u.list(u.number()).optional()});var ws=u.undiscriminatedUnion([u.string(),Ss]);var Ts=u.object({scheme:u.stringLiteral("oauth"),type:fs,scopes:u.list(ls).optional(),"token-prefix":u.string().optional(),"token-header":u.string().optional(),"client-id-env":u.string().optional(),"client-secret-env":u.string().optional(),"get-token":hs.optional(),"refresh-token":xs.optional(),"client-id":u.string().optional(),"authorization-url":u.string().optional(),"device-authorization-url":u.string().optional(),"token-url":u.string().optional(),"refresh-url":u.string().optional(),"redirect-uri":ws.optional(),pkce:ys.optional(),"authorization-parameters":u.record(u.string(),u.string()).optional(),"device-authorization-parameters":u.record(u.string(),u.string()).optional(),"token-parameters":u.record(u.string(),u.string()).optional(),"refresh-parameters":u.record(u.string(),u.string()).optional()}).extend(me);var Et=u.undiscriminatedUnion([Ts,ps,is,cs]);var ou={};z(ou,{AvailabilitySchema:()=>Es,AvailabilityStatusSchema:()=>br,AvailabilityUnionSchema:()=>As});n();a();s();n();a();s();n();a();s();var br=u.enum_(["in-development","pre-release","deprecated","generally-available"]);var Es=u.object({status:br,message:u.string().optional()});n();a();s();var As=u.undiscriminatedUnion([br,Es]);var uu={};z(uu,{WithAudiences:()=>At,WithAvailability:()=>Is,WithDocsSchema:()=>me,WithName:()=>Tt});n();a();s();n();a();s();var At=u.object({audiences:u.list(u.string()).optional()});n();a();s();var Is=u.object({availability:As.optional()});var cu={};z(cu,{EncodingSchema:()=>Rs,ProtobufTypeSchema:()=>Ns});n();a();s();n();a();s();n();a();s();var Ns=u.object({type:u.string()});var Rs=u.object({proto:Ns.optional()});var pu={};z(pu,{EnvironmentSchema:()=>Cs,MultipleBaseUrlsEnvironmentSchema:()=>Os,ServerVariableSchema:()=>xr,SingleBaseUrlEnvironmentSchema:()=>Ps,WithEnvironmentsSchema:()=>_s});n();a();s();n();a();s();n();a();s();n();a();s();var xr=u.object({id:u.string(),default:u.string().optional(),values:u.list(u.string()).optional()});var Os=u.object({urls:u.record(u.string(),u.string()),"url-templates":u.record(u.string(),u.string()).optional(),"default-urls":u.record(u.string(),u.string()).optional(),variables:u.record(u.string(),u.list(xr)).optional()}).extend(At).extend(me);n();a();s();var Ps=u.object({url:u.string(),"default-url":u.string().optional(),"url-template":u.string().optional(),variables:u.list(xr).optional()}).extend(At).extend(me);var Cs=u.undiscriminatedUnion([u.string(),Ps,Os]);n();a();s();var _s=u.object({"default-url":u.string().optional(),"default-environment":u.string().optional(),environments:u.record(u.string(),Cs).optional()});var lu={};z(lu,{WithHeadersSchema:()=>Vs});n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();var ks=u.object({minItems:u.number().optional(),maxItems:u.number().optional()});n();a();s();var Fs=u.object({minProperties:u.number().optional(),maxProperties:u.number().optional()});n();a();s();var Ls=u.object({min:u.number().optional(),max:u.number().optional(),exclusiveMin:u.boolean().optional(),exclusiveMax:u.boolean().optional(),multipleOf:u.number().optional()});n();a();s();var js=u.object({minLength:u.number().optional(),maxLength:u.number().optional(),pattern:u.string().optional(),format:u.string().optional()});var Bs=u.undiscriminatedUnion([js,Ls,ks,Fs]);var Ds=u.object({default:u.unknown().optional(),"client-default":u.unknown().optional(),encoding:Rs.optional(),validation:Bs.optional()}).extend(me).extend(Is);var Us=u.object({type:u.string()}).extend(Ds).extend(Tt).extend(At);var Ms=u.object({env:u.string().optional()}).extend(Us);var vs=u.undiscriminatedUnion([u.string(),Ms]);var Sr=vs;var Vs=u.object({headers:u.record(u.string(),Sr).optional()});var fu={};z(fu,{HttpHeaderSchema:()=>Sr,TypeReferenceDeclarationWithEnvOverride:()=>vs,TypeReferenceDeclarationWithEnvOverrideSchema:()=>Ms});n();a();s();var mu={};z(mu,{BaseTypeReferenceSchema:()=>Ds,TypeReferenceDeclarationWithName:()=>Us});n();a();s();var du={};z(du,{ListValidationSchema:()=>ks,MapValidationSchema:()=>Fs,NumberValidationSchema:()=>Ls,StringValidationSchema:()=>js,ValidationSchema:()=>Bs});n();a();s();var yu={};z(yu,{ApiConfigurationSchema:()=>ca,ApiConfigurationSchemaInternal:()=>Pr,ApiConfigurationV2Schema:()=>oa,ApiConfigurationV2SettingsSchema:()=>kr,ApiConfigurationV2SpecsSchema:()=>Fr,ApiDefinitionList:()=>$s,ApiDefinitionPathSchema:()=>It,ApiDefinitionSchema:()=>Ws,ApiDefinitionSettingsSchema:()=>Ir,ApiDefinitionWithOverridesSchema:()=>Nr,AsyncApiSettingsSchema:()=>_r,AsyncApiSpecSchema:()=>ta,BaseApiSettingsSchema:()=>Cr,CoerceConstsTo:()=>Hs,ConjureSchema:()=>ea,DefaultIntegerFormat:()=>Js,ExampleStyle:()=>pa,FormParameterEncoding:()=>Ks,GeneratorImageObjectSchema:()=>la,GeneratorsConfigurationSchema:()=>rm,GeneratorsOpenApiObjectSchema:()=>va,GeneratorsOpenApiSchema:()=>Va,GitRemoteSchema:()=>qs,GraphQlSpecSchema:()=>ra,Language:()=>za,MessageNamingSettingsSchema:()=>wr,MultiServerStrategy:()=>Tr,NamespacedApiConfigurationSchema:()=>ua,OpenApiExampleGenerationSchema:()=>Qs,OpenApiFilterSchema:()=>Ys,OpenApiSettingsSchema:()=>Rt,OpenApiSpecSchema:()=>ia,OpenRpcSpecSchema:()=>na,OutputMetadataAuthor:()=>fa,OutputMetadataSchema:()=>Ot,OverridesSchema:()=>ze,PathParameterOrder:()=>Er,ProtobufApiDefinitionSchema:()=>Or,ProtobufDefinitionSchema:()=>Rr,ProtobufSpecSchema:()=>sa,ReadmeCustomSectionSchema:()=>qa,ReadmeEndpointObjectSchema:()=>Ga,ReadmeEndpointSchema:()=>Wi,ReadmeSchema:()=>Wa,RemoveDiscriminantsFromSchemas:()=>Ar,RequestOrResponseExampleGenerationSchema:()=>zi,ResolveAliases:()=>Zs,ResolveAliasesSchema:()=>Xs,SpecGitSourceSchema:()=>Gs,SpecSchema:()=>aa,SpecSourceSchema:()=>Nt,UnionSettingsSchema:()=>zs,WhitelabelConfigurationSchema:()=>Ha,WhitelabelGithubConfigurationSchema:()=>$a});n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();var It=u.string();n();a();s();n();a();s();n();a();s();var wr=u.enum_(["v1","v2"]);n();a();s();var Tr=u.enum_(["environment-per-server","urls-per-environment"]);n();a();s();var Er=u.enum_(["url-order","spec-order"]);n();a();s();var Ar=u.enum_(["always","never"]);n();a();s();var zs=u.enum_(["v1"]);var Ir=u.object({"use-title":u.boolean().optional(),unions:zs.optional(),"message-naming":wr.optional(),"respect-nullable-schemas":u.boolean().optional(),"only-include-referenced-schemas":u.boolean().optional(),"inline-path-parameters":u.boolean().optional(),"idiomatic-request-names":u.boolean().optional(),"wrap-references-to-nullable-in-optional":u.boolean().optional(),"coerce-optional-schemas-to-nullable":u.boolean().optional(),"group-environments-by-host":u.boolean().optional(),"multi-server-strategy":Tr.optional(),"remove-discriminants-from-schemas":Ar.optional(),"path-parameter-order":Er.optional()});n();a();s();var ze=u.undiscriminatedUnion([u.string(),u.list(u.string())]);var Nr=u.object({path:It,origin:u.string().optional(),overrides:ze.optional(),audiences:u.list(u.string()).optional(),settings:Ir.optional()});n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();var qs=u.object({repo:u.string(),ref:u.string().optional(),path:u.string()});var Gs=u.object({git:qs});var Nt=u.undiscriminatedUnion([u.string(),Gs]);var Rr=u.object({target:u.string().optional(),root:Nt,overrides:ze.optional(),"local-generation":u.boolean().optional(),"from-openapi":u.boolean().optional(),dependencies:u.list(u.string()).optional()});var Or=u.object({proto:Rr});var Ws=u.undiscriminatedUnion([It,Nr,Or]);var $s=u.list(Ws);var Pr=u.undiscriminatedUnion([It,Nr,$s,Or]);n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();var Hs=u.enum_(["literals","enums","enums-coerceable-to-literals"]);var Cr=u.object({"respect-nullable-schemas":u.boolean().optional(),"title-as-schema-name":u.boolean().optional(),"optional-additional-properties":u.boolean().optional(),"coerce-enums-to-literals":u.boolean().optional(),"idiomatic-request-names":u.boolean().optional(),"wrap-references-to-nullable-in-optional":u.boolean().optional(),"coerce-optional-schemas-to-nullable":u.boolean().optional(),"group-environments-by-host":u.boolean().optional(),"multi-server-strategy":Tr.optional(),"remove-discriminants-from-schemas":Ar.optional(),"path-parameter-order":Er.optional(),"resolve-schema-collisions":u.boolean().optional(),"infer-forward-compatible":u.boolean().optional(),"infer-default-environment":u.boolean().optional(),"coerce-consts-to":Hs.optional()});var _r=u.object({"message-naming":wr.optional()}).extend(Cr);n();a();s();n();a();s();var Js=u.enum_(["int32","int64","uint32","uint64"]);n();a();s();var Ks=u.enum_(["form","json"]);n();a();s();n();a();s();var zi=u.object({"max-depth":u.number().optional()});var Qs=u.object({request:zi.optional(),response:zi.optional()});n();a();s();var Ys=u.object({endpoints:u.list(u.string()).optional()});n();a();s();n();a();s();var Xs=u.object({except:u.list(u.string()).optional()});var Zs=u.undiscriminatedUnion([u.boolean(),Xs]);var Rt=u.object({"only-include-referenced-schemas":u.boolean().optional(),"inline-path-parameters":u.boolean().optional(),"prefer-undiscriminated-unions-with-literals":u.boolean().optional(),"object-query-parameters":u.boolean().optional(),"respect-readonly-schemas":u.boolean().optional(),"use-read-variant-for-responses":u.boolean().optional(),"respect-forward-compatible-enums":u.boolean().optional(),"use-bytes-for-binary-response":u.boolean().optional(),"default-form-parameter-encoding":Ks.optional(),filter:Ys.optional(),"example-generation":Qs.optional(),"additional-properties-defaults-to":u.boolean().optional(),"type-dates-as-strings":u.boolean().optional(),"preserve-single-schema-oneof":u.boolean().optional(),"preserve-one-of-in-all-of":u.boolean().optional(),"inline-all-of-schemas":u.boolean().optional(),"resolve-aliases":Zs.optional(),"group-multi-api-environments":u.boolean().optional(),"default-integer-format":Js.optional(),"infer-discriminated-union-base-properties":u.boolean().optional(),"disambiguate-request-names":u.boolean().optional(),"ignore-tags":u.boolean().optional()}).extend(Cr);var kr=u.object({"auto-generate-idempotency-key":u.unknown().optional()}).extend(Rt).extend(_r);n();a();s();n();a();s();var ea=u.object({conjure:u.string()});n();a();s();n();a();s();var ta=u.object({asyncapi:Nt,origin:u.string().optional(),overrides:ze.optional(),namespace:u.string().optional(),settings:_r.optional()});n();a();s();var ra=u.object({graphql:u.string(),origin:u.string().optional(),overrides:u.string().optional(),examples:u.string().optional(),name:u.string().optional()});n();a();s();var ia=u.object({openapi:Nt,origin:u.string().optional(),overrides:ze.optional(),overlays:u.string().optional(),namespace:u.string().optional(),settings:Rt.optional()});n();a();s();var na=u.object({openrpc:u.string(),overrides:ze.optional(),namespace:u.string().optional()});n();a();s();var sa=u.object({proto:Rr});var aa=u.undiscriminatedUnion([ia,ta,sa,na,ra]);var Fr=u.undiscriminatedUnion([u.list(aa),ea]);var oa=u.object({auth:yr.optional(),"auth-schemes":u.record(u.string(),Et).optional(),specs:Fr,settings:kr.optional()}).extend(Vs).extend(_s);n();a();s();var ua=u.object({namespaces:u.record(u.string(),Pr)});var ca=u.undiscriminatedUnion([Pr,ua,oa]);n();a();s();var pa=u.enum_(["minimal","comprehensive"]);n();a();s();var la=u.object({name:u.string(),registry:u.string()});n();a();s();n();a();s();n();a();s();n();a();s();var fa=u.object({name:u.string(),email:u.string()});var Ot=u.object({description:u.string().optional(),authors:u.list(fa).optional()});n();a();s();n();a();s();var qi=u.object({name:u.string()});var Pt=u.object({teams:u.list(qi).optional(),users:u.list(qi).optional()});n();a();s();n();a();s();n();a();s();n();a();s();var ma=u.object({auth:yr.optional(),"auth-schemes":u.record(u.string(),Et).optional(),headers:u.record(u.string(),Sr).optional(),settings:kr.optional(),specs:Fr.optional()});n();a();s();n();a();s();var da=u.object({url:u.string().optional(),"package-name":u.string(),token:u.string().optional()});n();a();s();var ha=u.object({path:u.string()});n();a();s();n();a();s();var ya=u.object({keyId:u.string(),password:u.string(),secretKey:u.string()});var ga=u.object({url:u.string().optional(),coordinate:u.string(),username:u.string().optional(),password:u.string().optional(),signature:ya.optional()});n();a();s();var ba=u.object({url:u.string().optional(),"package-name":u.string(),token:u.string().optional()});n();a();s();var xa=u.object({url:u.string().optional(),"package-name":u.string(),"api-key":u.string().optional()});n();a();s();var Sa=u.object({"api-key":u.string(),"workspace-id":u.string(),"collection-id":u.string().optional()});n();a();s();n();a();s();var wa=u.object({keywords:u.list(u.string()).optional(),"documentation-link":u.string().optional(),"homepage-link":u.string().optional()}).extend(Ot);var Ta=u.object({url:u.string().optional(),"package-name":u.string(),token:u.string().optional(),username:u.string().optional(),password:u.string().optional(),metadata:wa.optional()});n();a();s();var Ea=u.object({url:u.string().optional(),"package-name":u.string(),"api-key":u.string().optional()});var Aa=u.union("location",{npm:ba,maven:ga,pypi:Ta,postman:Sa,"local-file-system":ha,nuget:xa,rubygems:Ea,crates:da}).transform({transform:e=>e,untransform:e=>e});n();a();s();n();a();s();n();a();s();var Ia=u.object({custom:u.string()});n();a();s();var Na=u.enum_(["MIT","Apache-2.0"]);var qe=u.undiscriminatedUnion([Na,Ia]);var Gi=u.object({"package-description":u.string().optional(),email:u.string().optional(),"reference-url":u.string().optional(),author:u.string().optional(),license:qe.optional()});n();a();s();var Ra=u.object({path:u.string()});n();a();s();n();a();s();n();a();s();var Oa=u.enum_(["commit","release"]);var Pa=u.object({repository:u.string(),branch:u.string().optional(),license:qe.optional(),mode:Oa.optional()});n();a();s();var Ca=u.object({repository:u.string(),branch:u.string().optional(),license:qe.optional(),mode:u.stringLiteral("pull-request"),reviewers:Pt.optional()});n();a();s();var _a=u.object({repository:u.string(),license:qe.optional(),mode:u.stringLiteral("push"),branch:u.string().optional()});n();a();s();n();a();s();var ka=u.enum_(["pull-request","push","commit-and-release"]);var Fa=u.object({uri:u.string(),token:u.string(),mode:ka.optional(),branch:u.string().optional(),license:qe.optional()});var La=u.undiscriminatedUnion([Fa,Pa,Ca,_a]);var Lr=u.object({version:u.string(),output:Aa.optional(),github:La.optional(),config:u.unknown().optional(),metadata:Gi.optional(),keywords:u.list(u.string()).optional(),snippets:Ra.optional(),"ir-version":u.string().optional(),"smart-casing":u.boolean().optional(),"smart-casing-digit-word-boundary":u.boolean().optional(),api:ma.optional(),"disable-examples":u.boolean().optional(),"publish-metadata":Gi.optional(),autorelease:u.boolean().optional(),automation:wt.optional()});var ja=u.object({image:la}).extend(Lr);n();a();s();var Ba=u.object({name:u.string()}).extend(Lr);var Da=u.undiscriminatedUnion([Ba,ja]);var Ua=u.object({audiences:u.list(u.string()).optional(),generators:u.list(Da),metadata:Ot.optional(),reviewers:Pt.optional(),automation:wt.optional()});n();a();s();var Ma=u.object({enabled:u.boolean()});n();a();s();n();a();s();var va=u.object({path:u.string(),origin:u.string().optional(),overrides:u.string().optional(),"disable-examples":u.boolean().optional(),settings:Rt});var Va=u.undiscriminatedUnion([va,u.string()]);n();a();s();n();a();s();n();a();s();var za=u.enum_(["java","python","go","ruby","csharp","typescript","php","rust","swift"]);var qa=u.object({title:u.string(),language:za,content:u.string()});n();a();s();n();a();s();var Ga=u.object({method:u.string(),path:u.string(),stream:u.boolean().optional()});var Wi=u.undiscriminatedUnion([u.string(),Ga]);var Wa=u.object({bannerLink:u.string().optional(),introduction:u.string().optional(),apiReferenceLink:u.string().optional(),apiName:u.string().optional(),disabledSections:u.list(u.string()).optional(),defaultEndpoint:Wi.optional(),features:u.record(u.string(),u.list(Wi)).optional(),customSections:u.list(qa).optional(),exampleStyle:pa.optional()});n();a();s();n();a();s();var $a=u.object({username:u.string(),email:u.string(),token:u.string()});var Ha=u.object({github:$a.optional()});var rm=u.object({"auth-schemes":u.record(u.string(),Et).optional(),api:ca.optional(),whitelabel:Ha.optional(),metadata:Ot.optional(),readme:Wa.optional(),"default-group":u.string().optional(),aliases:u.record(u.string(),u.list(u.string())).optional(),groups:u.record(u.string(),Ua).optional(),reviewers:Pt.optional(),replay:Ma.optional(),ai:Xn.optional(),autorelease:u.boolean().optional(),automation:wt.optional(),openapi:Va.optional(),"openapi-overrides":u.string().optional(),"spec-origin":u.string().optional(),"async-api":u.string().optional(),"api-settings":Ir.optional()});var gu={};z(gu,{BaseGeneratorInvocationSchema:()=>Lr,CratesOutputLocationSchema:()=>da,CustomGeneratorInvocationSchema:()=>ja,DefaultGeneratorInvocationSchema:()=>Ba,GeneratorApiSettingsSchema:()=>ma,GeneratorGroupSchema:()=>Ua,GeneratorInvocationSchema:()=>Da,GeneratorOutputSchema:()=>Aa,GeneratorPublishMetadataSchema:()=>Gi,GeneratorSnippetsSchema:()=>Ra,GithubCommitAndReleaseMode:()=>Oa,GithubCommitAndReleaseSchema:()=>Pa,GithubConfigurationSchema:()=>La,GithubPullRequestSchema:()=>Ca,GithubPushSchema:()=>_a,GithubSelfhostedMode:()=>ka,GithubSelfhostedSchema:()=>Fa,LocalFileSystemOutputLocationSchema:()=>ha,MavenOutputLocationSchema:()=>ga,MavenOutputSignatureSchema:()=>ya,NpmOutputLocationSchema:()=>ba,NugetOutputLocationSchema:()=>xa,PostmanOutputLocationSchema:()=>Sa,PypiOutputLocationSchema:()=>Ta,PypiOutputMetadataSchema:()=>wa,RubyGemsOutputLocationSchema:()=>Ea});n();a();s();var bu={};z(bu,{GithubLicenseCustomSchema:()=>Ia,GithubLicenseSchema:()=>qe,GithubLicenseType:()=>Na});n();a();s();var xu={};z(xu,{ReplayConfigSchema:()=>Ma});n();a();s();var Su={};z(Su,{ReviewerSchema:()=>qi,ReviewersSchema:()=>Pt});n();a();s();n();a();s();n();a();s();function im(e){return e?.specs!=null}n();a();s();function nm(e){return e?.asyncapi!=null}n();a();s();function sm(e){return e?.conjure!=null}n();a();s();function am(e){return e?.graphql!=null}n();a();s();function om(e){return e?.namespaces!=null}n();a();s();function um(e){return e?.openapi!=null}n();a();s();function cm(e){return e?.openrpc!=null}n();a();s();function pm(e){return e?.proto!=null}var lm={[Ge.GenerationLanguage.PHP]:new Set(["abstract","and","as","break","callable","case","catch","class","clone","const","continue","declare","default","do","echo","else","elseif","enddeclare","endfor","endforeach","endif","endswitch","endwhile","extends","final","finally","fn","for","foreach","function","global","goto","list","if","implements","include","include_once","instanceof","insteadof","interface","match","namespace","new","or","parent","Parent","print","private","protected","public","readonly","require","require_once","return","static","switch","throw","trait","try","use","var","while","xor","yield"].flatMap(e=>[e,Le(e)])),[Ge.GenerationLanguage.TYPESCRIPT]:new Set(["any","as","boolean","break","case","catch","class","const","constructor","continue","debugger","declare","default","delete","do","else","enum","export","extends","false","finally","for","from","function","get","if","implements","import","in","instanceof","interface","let","module","new","null","number","of","package","private","protected","public","require","return","set","static","string","super","switch","symbol","this","throw","true","try","type","typeof","var","void","while","with","yield","Date","Error","File","Object","Record"]),[Ge.GenerationLanguage.JAVA]:new Set(["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","false","final","finally","float","for","goto","if","implements","import","instanceof","int","interface","long","native","new","null","package","private","protected","public","return","short","static","strictfp","super","switch","synchronized","this","throw","throws","transient","true","try","void","volatile","while"]),[Ge.GenerationLanguage.PYTHON]:new Set(["False","None","True","and","as","assert","async","","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield","float","int","complex","bool","uuid","list","set","map","long","self","all","kwargs"]),[Ge.GenerationLanguage.GO]:new Set(["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","internal","map","package","range","return","select","struct","switch","type","var","vendor","any","bool","byte","complex64","complex128","error","float32","float64","int","int8","int16","int32","int64","make","new","rune","string","uint","uint8","uint16","uint32","uint64","uintptr"]),[Ge.GenerationLanguage.RUBY]:new Set(["__ENCODING__","__LINE__","__FILE__","alias","and","begin","break","case","class","def","defined","do","else","elsif","end","ensure","false","for","if","in","module","next","nil","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","Object","JSON","Date","DateTime","object_id","hash","eql?","equal?","method","send","respond_to?","respond_to_missing?","instance_of?","kind_of?","is_a?","extend","singleton_class","instance_variables","instance_variable_get","instance_variable_set","instance_variable_defined?","remove_instance_variable","public_methods","private_methods","protected_methods","singleton_methods"]),[Ge.GenerationLanguage.CSHARP]:new Set(["abstract","as","base","bool","break","byte","case","catch","char","checked","class","const","continue","decimal","default","delegate","do","double","else","enum","event","explicit","extern","false","finally","fixed","float","for","foreach","goto","if","implicit","in","int","interface","internal","is","lock","long","namespace","new","null","object","operator","out","override","params","private","protected","public","readonly","ref","return","sbyte","sealed","short","sizeof","stackalloc","static","string","struct","switch","this","throw","true","try","typeof","uint","ulong","unchecked","unsafe","ushort","using","virtual","void","volatile","while","add","and","alias","ascending","args","async","","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","managed","nameof","nint","not","notnull","nuint","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value","var","when","where","with","yield"]),[Ge.GenerationLanguage.RUST]:new Set(["as","async","await","break","const","continue","crate","dyn","else","enum","extern","false","fn","for","if","impl","in","let","loop","match","mod","move","mut","pub","ref","return","self","Self","static","struct","super","trait","true","type","union","unsafe","use","where","while","abstract","become","box","do","final","macro","override","priv","try","typeof","unsized","virtual","yield","bool","char","f32","f64","i8","i16","i32","i64","i128","isize","str","u8","u16","u32","u64","u128","usize","String","Vec","Option","Result","Box","Rc","Arc","Cell","RefCell","HashMap","HashSet","BTreeMap","BTreeSet"]),[Ge.GenerationLanguage.SWIFT]:new Set([])};var R0=["go","ruby"];function Ja(e,t,r){let{generationLanguage:i,keywords:o,smartCasing:p,smartCasingDigitWordBoundary:l}=r,b=B0(e),w=W=>({unsafeName:W,safeName:O0({name:W,keywords:P0({generationLanguage:i,keywords:o})})}),A=t.preserveUnderscores===!0,I=A?(W,q)=>Tu(W,q):(W,q)=>q(W),P=I(b,lr),L=A?Tu(b,W=>Le(lr(W))):Le(P),O=I(b,qn),{leading:F,trailing:U}=A?mm(b):{leading:"",trailing:""},M=Li(P);if(p){!k0(M)&&(i==null||R0.includes(i))&&(P=F+M.map((q,oe)=>{if(oe>0){let H=Ka(q);if(H!=null)return H;if(Qa(q))return q.toUpperCase()}return q}).join("")+U,L=Le(F+M.map((q,oe)=>{let H=Ka(q);return H??(Qa(q)?q.toUpperCase():oe===0?Le(q):q)}).join("")+U));let W=q=>q.split(" ").map(oe=>{let H=oe.split(/(\d+)/);return H.map((K,C)=>{let D=qn(K),Z=H[C-1];return(l??!1)&&D!==""&&Z!=null&&/^\d+$/.test(Z)&&/^[^a-z0-9]/.test(K)?`_${D}`:D}).join("")}).join("_");O=A?Tu(b,W):W(b)}return{originalName:e,camelCase:w(t.casingOverrides?.camel??P),snakeCase:w(t.casingOverrides?.snake??O),screamingSnakeCase:w(t.casingOverrides?.["screaming-snake"]??O.toUpperCase()),pascalCase:w(t.casingOverrides?.pascal??L)}}function fm({generationLanguage:e,keywords:t,smartCasing:r,smartCasingDigitWordBoundary:i}){let o={generationLanguage:e,keywords:t,smartCasing:r,smartCasingDigitWordBoundary:i};return{generateName:(p,l)=>{if(typeof p=="string")return Ja(p,l??{},o);if("wireValue"in p){let b=p.name;return typeof b=="string"?Ja(b,l??{},o):b}return p},generateNameAndWireValue:(p,l)=>{if(typeof p=="string")return{wireValue:p,name:Ja(p,l??{},o)};let{name:b,wireValue:w}=p,A=typeof b=="string"?Ja(b,l??{},o):b;return{wireValue:w,name:A}}}}function O0({name:e,keywords:t}){return t==null?e:t.has(e)?e+"_":_0(e)?"_"+e:e}function P0({generationLanguage:e,keywords:t}){if(t!=null)return new Set(t);if(e!=null)return lm[e]}var C0=/^[0-9]/;function _0(e){return C0.test(e)}function k0(e){return e.some((t,r)=>{if(r===0)return!1;let i=e[r-1];if(i==null)return!1;let o=Ka(i)!=null||Qa(i),p=Ka(t)!=null||Qa(t);return o&&p})}function Ka(e){return L0.get(e.toUpperCase())}function Qa(e){return F0.has(e.toUpperCase())}var F0=new Set(["ACL","API","ASCII","CPU","CSS","DNS","EOF","GUID","HTML","HTTP","HTTPS","ID","IP","JSON","LHS","QPS","RAM","RHS","RPC","SAML","SCIM","SLA","SMTP","SQL","SSH","SSO","TCP","TLS","TTL","UDP","UI","UID","UUID","URI","URL","UTF8","VM","XML","XMPP","XSRF","XSS"]),L0=new Map([["ACLS","ACLs"],["APIS","APIs"],["CPUS","CPUs"],["GUIDS","GUIDs"],["IDS","IDs"],["UIDS","UIDs"],["UUIDS","UUIDs"],["URIS","URIs"],["URLS","URLs"]]),j0=[[/\[\]/g,"Array"]];function B0(e){return j0.reduce((t,[r,i])=>t.replace(r,i),e)}function mm(e){let t=e.match(/^(_+)/),r=e.match(/(_+)$/),i=t?.[1]??"",o=r?.[1]??"";if(i.length+o.length>=e.length)return{leading:e,trailing:"",core:""};let p=e.slice(i.length,e.length-o.length||void 0);return{leading:i,trailing:o,core:p}}function Tu(e,t){let{leading:r,trailing:i,core:o}=mm(e);return r===""&&i===""?t(e):`${r}${t(o)}${i}`}n();a();s();function $i(e){return typeof e=="string"?e:e.wireValue}var Hi=class e{constructor(t){y(this,"casingsGenerator");this.casingsGenerator=fm(t)}static fromLanguage(t,r){return new e({generationLanguage:t,keywords:void 0,smartCasing:r})}resolve(t){return this.casingsGenerator.generateName(t)}resolveNameOrString(t){return this.casingsGenerator.generateName(t)}resolveNameAndWireValue(t){return this.casingsGenerator.generateNameAndWireValue(t)}camel(t){return this.resolve(t).camelCase}camelSafe(t){return this.camel(t).safeName}camelUnsafe(t){return this.camel(t).unsafeName}pascal(t){return this.resolve(t).pascalCase}pascalSafe(t){return this.pascal(t).safeName}pascalUnsafe(t){return this.pascal(t).unsafeName}snake(t){return this.resolve(t).snakeCase}snakeSafe(t){return this.snake(t).safeName}snakeUnsafe(t){return this.snake(t).unsafeName}screamingSnake(t){return this.resolve(t).screamingSnakeCase}screamingSnakeSafe(t){return this.screamingSnake(t).safeName}screamingSnakeUnsafe(t){return this.screamingSnake(t).unsafeName}};n();a();s();var Ke=class extends ut{constructor(r){super();y(this,"value");this.value=r}write(r){typeof this.value=="string"?r.write(this.value):typeof this.value=="function"?this.value(r):this.value.write(r)}};var M0=4;ql({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var Ji=class{constructor(){y(this,"lineBuffer",[]);y(this,"indentLevel",0);y(this,"hasWrittenAnything",!1);y(this,"lastCharacterIsSemicolon",!1);y(this,"lastCharacterIsNewline",!1);y(this,"nodeStackFrames",[])}get buffer(){return je&&this.nodeStackFrames.length>0&&this.writeInternal(`
|
|
5
|
+
`)),{ok:!0,value:t}):i}}n();a();s();n();a();s();n();a();s();n();a();s();function $n(e){return e.path.length===0?e.message:`${e.path.join(" -> ")}: ${e.message}`}var fr=class extends Error{constructor(r){super(r.map($n).join("; "));y(this,"errors");this.errors=r,Object.setPrototypeOf(this,new.target.prototype),this.name=this.constructor.name}};n();a();s();var mr=class extends Error{constructor(r){super(r.map($n).join("; "));y(this,"errors");this.errors=r,Object.setPrototypeOf(this,new.target.prototype),this.name=this.constructor.name}};function ae(e){return{nullable:()=>b0(e),optional:()=>Zo(e),optionalNullable:()=>x0(e),transform:t=>eu(e,t),parseOrThrow:(t,r)=>{let i=e.parse(t,r);if(i.ok)return i.value;throw new mr(i.errors)},jsonOrThrow:(t,r)=>{let i=e.json(t,r);if(i.ok)return i.value;throw new fr(i.errors)}}}function b0(e){let t={parse:(r,i)=>r==null?{ok:!0,value:null}:e.parse(r,i),json:(r,i)=>r==null?{ok:!0,value:null}:e.json(r,i),getType:()=>Q.NULLABLE};return{...t,...ae(t)}}function Zo(e){let t={parse:(r,i)=>r==null?{ok:!0,value:void 0}:e.parse(r,i),json:(r,i)=>i?.omitUndefined&&r===void 0?{ok:!0,value:void 0}:r==null?{ok:!0,value:null}:e.json(r,i),getType:()=>Q.OPTIONAL};return{...t,...ae(t)}}function x0(e){let t={parse:(r,i)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.parse(r,i),json:(r,i)=>r===void 0?{ok:!0,value:void 0}:r===null?{ok:!0,value:null}:e.json(r,i),getType:()=>Q.OPTIONAL_NULLABLE};return{...t,...ae(t)}}function eu(e,t){let r={parse:(i,o)=>{let p=e.parse(i,o);return p.ok?{ok:!0,value:t.transform(p.value)}:p},json:(i,o)=>{let p=t.untransform(i);return e.json(p,o)},getType:()=>e.getType()};return{...r,...ae(r)}}function Cf(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t=="bigint"?{ok:!0,value:t}:typeof t=="number"?{ok:!0,value:BigInt(t)}:{ok:!1,errors:[{path:r,message:ie(t,"bigint | number")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="bigint"?{ok:!1,errors:[{path:r,message:ie(t,"bigint")}]}:{ok:!0,value:t},getType:()=>Q.BIGINT};return{...xe(e),...ae(e)}}n();a();s();n();a();s();var S0=/^([+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([.,]\d+(?!:))?)?(\17[0-5]\d([.,]\d+)?)?([zZ]|([+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/;function _f(){let e={parse:(t,{breadcrumbsPrefix:r=[]}={})=>typeof t!="string"?{ok:!1,errors:[{path:r,message:ie(t,"string")}]}:S0.test(t)?{ok:!0,value:new Date(t)}:{ok:!1,errors:[{path:r,message:ie(t,"ISO 8601 date string")}]},json:(t,{breadcrumbsPrefix:r=[]}={})=>t instanceof Date?{ok:!0,value:t.toISOString()}:{ok:!1,errors:[{path:r,message:ie(t,"Date object")}]},getType:()=>Q.DATE};return{...xe(e),...ae(e)}}n();a();s();n();a();s();n();a();s();function Se(e,t){return()=>{let r={parse:t,json:t,getType:()=>e};return{...xe(r),...ae(r)}}}function Hn(e){let t=new Set(e);return Se(Q.ENUM,(i,{allowUnrecognizedEnumValues:o,breadcrumbsPrefix:p=[]}={})=>typeof i!="string"?{ok:!1,errors:[{path:p,message:ie(i,"string")}]}:!t.has(i)&&!o?{ok:!1,errors:[{path:p,message:ie(i,"enum")}]}:{ok:!0,value:i})()}n();a();s();n();a();s();function kf(e){let t=tu(e);return{...t,...ae(t)}}function tu(e){return{parse:(t,r)=>dr(e).parse(t,r),json:(t,r)=>dr(e).json(t,r),getType:()=>dr(e).getType()}}function dr(e){let t=e;return t.__zurg_memoized==null&&(t.__zurg_memoized=e()),t.__zurg_memoized}n();a();s();n();a();s();n();a();s();n();a();s();function ru(e){return Object.entries(e)}n();a();s();function vi(e,t){let r=new Set(t);return Object.entries(e).reduce((i,[o,p])=>(r.has(o)&&(i[o]=p),i),{})}n();a();s();function ct(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return t===null?!0:Object.getPrototypeOf(t)===null}n();a();s();function Vi(e){return Object.keys(e)}n();a();s();function Ff(e,t){let r=[],i=[];for(let o of e)t(o)?r.push(o):i.push(o);return[r,i]}n();a();s();n();a();s();var w0=Object.prototype.hasOwnProperty;function Je(e){return{withParsedProperties:t=>iu(e,t)}}function iu(e,t){let r={parse:(i,o)=>{let p=e.parse(i,o);if(!p.ok)return p;let l={};for(let b in t)if(w0.call(t,b)){let w=t[b];l[b]=typeof w=="function"?w(p.value):w}return{ok:!0,value:{...p.value,...l}}},json:(i,o)=>{if(!ct(i))return{ok:!1,errors:[{path:o?.breadcrumbsPrefix??[],message:ie(i,"object")}]};let p=new Set(Object.keys(t)),l=vi(i,Object.keys(i).filter(b=>!p.has(b)));return e.json(l,o)},getType:()=>e.getType()};return{...r,...ae(r),...Je(r)}}n();a();s();function Lf(e,t){return{rawKey:e,valueSchema:t,isProperty:!0}}function pt(e){return e.isProperty}var T0=Object.prototype.hasOwnProperty;function Jn(e){let t;function r(){if(t==null){t={};for(let[L,O]of ru(e)){let F=pt(O)?O.rawKey:L,U=pt(O)?O.valueSchema:O;t[F]={rawKey:F,parsedKey:L,valueSchema:U}}}return t}let i,o,p,l;function b(){if(i==null){i=[],o=[];for(let[L,O]of ru(e)){let F=pt(O)?O.rawKey:L,U=pt(O)?O.valueSchema:O;E0(U)&&(i.push(F),o.push(L))}p=new Set(i),l=new Set(o)}return i}function w(){return o==null&&b(),o}function A(){return p==null&&b(),p}function I(){return l==null&&b(),l}let P={_getRawProperties:()=>Object.entries(e).map(([L,O])=>pt(O)?O.rawKey:L),_getParsedProperties:()=>Vi(e),parse:(L,O)=>{let F=O?.breadcrumbsPrefix??[];return jf({value:L,requiredKeys:b(),requiredKeysSet:A(),getProperty:U=>{let M=r()[U];if(M!=null)return{transformedKey:M.parsedKey,transform:W=>{let q=[...F,U];return M.valueSchema.parse(W,{...O,breadcrumbsPrefix:q})}}},unrecognizedObjectKeys:O?.unrecognizedObjectKeys,skipValidation:O?.skipValidation,breadcrumbsPrefix:F,omitUndefined:O?.omitUndefined})},json:(L,O)=>{let F=O?.breadcrumbsPrefix??[];return jf({value:L,requiredKeys:w(),requiredKeysSet:I(),getProperty:U=>{let M=e[U];if(M!=null)return pt(M)?{transformedKey:M.rawKey,transform:W=>{let q=[...F,U];return M.valueSchema.json(W,{...O,breadcrumbsPrefix:q})}}:{transformedKey:U,transform:W=>{let q=[...F,U];return M.json(W,{...O,breadcrumbsPrefix:q})}}},unrecognizedObjectKeys:O?.unrecognizedObjectKeys,skipValidation:O?.skipValidation,breadcrumbsPrefix:F,omitUndefined:O?.omitUndefined})},getType:()=>Q.OBJECT};return{...xe(P),...ae(P),...Je(P),...Jt(P)}}function jf({value:e,requiredKeys:t,requiredKeysSet:r,getProperty:i,unrecognizedObjectKeys:o="fail",skipValidation:p=!1,breadcrumbsPrefix:l=[]}){if(!ct(e))return{ok:!1,errors:[{path:l,message:ie(e,"object")}]};let b=t.length,w=[],A={};for(let I in e){if(!T0.call(e,I))continue;let P=e[I],L=i(I);if(L!=null){b>0&&r.has(I)&&b--;let O=L.transform(P);O.ok?A[L.transformedKey]=O.value:(A[I]=P,w.push(...O.errors))}else switch(o){case"fail":w.push({path:[...l,I],message:`Unexpected key "${I}"`});break;case"strip":break;case"passthrough":A[I]=P;break}}if(b>0)for(let I of t)I in e||w.push({path:l,message:`Missing required key "${I}"`});return w.length===0||p?{ok:!0,value:A}:{ok:!1,errors:w}}function Jt(e){return{extend:t=>{let r={_getParsedProperties:()=>[...e._getParsedProperties(),...t._getParsedProperties()],_getRawProperties:()=>[...e._getRawProperties(),...t._getRawProperties()],parse:(i,o)=>Bf({extensionKeys:t._getRawProperties(),value:i,transformBase:p=>e.parse(p,o),transformExtension:p=>t.parse(p,o),breadcrumbsPrefix:o?.breadcrumbsPrefix}),json:(i,o)=>Bf({extensionKeys:t._getParsedProperties(),value:i,transformBase:p=>e.json(p,o),transformExtension:p=>t.json(p,o),breadcrumbsPrefix:o?.breadcrumbsPrefix}),getType:()=>Q.OBJECT};return{...r,...ae(r),...Je(r),...Jt(r)}},passthrough:()=>{let t=new Set(e._getRawProperties()),r=new Set(e._getParsedProperties()),i={_getParsedProperties:()=>e._getParsedProperties(),_getRawProperties:()=>e._getRawProperties(),parse:(o,p)=>{let l=e.parse(o,{...p,unrecognizedObjectKeys:"passthrough"});if(!l.ok)return l;let b={};if(typeof o=="object"&&o!=null)for(let[w,A]of Object.entries(o))t.has(w)||(b[w]=A);return{ok:!0,value:{...b,...l.value}}},json:(o,p)=>{let l=e.json(o,{...p,unrecognizedObjectKeys:"passthrough"});if(!l.ok)return l;let b={};if(typeof o=="object"&&o!=null)for(let[w,A]of Object.entries(o))r.has(w)||(b[w]=A);return{ok:!0,value:{...b,...l.value}}},getType:()=>Q.OBJECT};return{...i,...ae(i),...Je(i),...Jt(i)}}}}function Bf({extensionKeys:e,value:t,transformBase:r,transformExtension:i,breadcrumbsPrefix:o=[]}){if(!ct(t))return{ok:!1,errors:[{path:o,message:ie(t,"object")}]};let p=new Set(e),[l,b]=Ff(Vi(t),I=>p.has(I)),w=r(vi(t,b)),A=i(vi(t,l));return w.ok&&A.ok?{ok:!0,value:{...w.value,...A.value}}:{ok:!1,errors:[...w.ok?[]:w.errors,...A.ok?[]:A.errors]}}function E0(e){return!A0(e)}function A0(e){switch(e.getType()){case Q.ANY:case Q.UNKNOWN:case Q.OPTIONAL:case Q.OPTIONAL_NULLABLE:return!0;default:return!1}}n();a();s();function Df(e){return Jn(e)}function Uf(e){let t={...tu(e),_getRawProperties:()=>dr(e)._getRawProperties(),_getParsedProperties:()=>dr(e)._getParsedProperties()};return{...t,...ae(t),...Je(t),...Jt(t)}}n();a();s();n();a();s();function Kn(e){let t={parse:(r,i)=>Mf(r,(o,p)=>e.parse(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${p}]`]})),json:(r,i)=>Mf(r,(o,p)=>e.json(o,{...i,breadcrumbsPrefix:[...i?.breadcrumbsPrefix??[],`[${p}]`]})),getType:()=>Q.LIST};return{...xe(t),...ae(t)}}function Mf(e,t){if(!Array.isArray(e))return{ok:!1,errors:[{message:ie(e,"list"),path:[]}]};let r=[],i=[];for(let o=0;o<e.length;o++){let p=t(e[o],o);p.ok?r.push(p.value):i.push(...p.errors)}return i.length===0?{ok:!0,value:r}:{ok:!1,errors:i}}n();a();s();n();a();s();function vf(e){return Se(Q.BOOLEAN_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:ie(r,`${e.toString()}`)}]})()}n();a();s();function Vf(e){return Se(Q.STRING_LITERAL,(r,{breadcrumbsPrefix:i=[]}={})=>r===e?{ok:!0,value:e}:{ok:!1,errors:[{path:i,message:ie(r,`"${e}"`)}]})()}n();a();s();n();a();s();var zf=Se(Q.ANY,e=>({ok:!0,value:e}));n();a();s();var qf=Se(Q.BOOLEAN,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="boolean"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:ie(e,"boolean")}]});n();a();s();var Gf=Se(Q.NEVER,(e,{breadcrumbsPrefix:t=[]}={})=>({ok:!1,errors:[{path:t,message:"Expected never"}]}));n();a();s();var Wf=Se(Q.NUMBER,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="number"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:ie(e,"number")}]});n();a();s();var $f=Se(Q.STRING,(e,{breadcrumbsPrefix:t=[]}={})=>typeof e=="string"?{ok:!0,value:e}:{ok:!1,errors:[{path:t,message:ie(e,"string")}]});n();a();s();var Hf=Se(Q.UNKNOWN,e=>({ok:!0,value:e}));n();a();s();n();a();s();var I0=Object.prototype.hasOwnProperty;function Kf(e,t){let r={parse:(i,o)=>Jf({value:i,isKeyNumeric:e.getType()===Q.NUMBER,transformKey:p=>e.parse(p,{...o,breadcrumbsPrefix:[...o?.breadcrumbsPrefix??[],`${p} (key)`]}),transformValue:(p,l)=>t.parse(p,{...o,breadcrumbsPrefix:[...o?.breadcrumbsPrefix??[],`${l}`]}),breadcrumbsPrefix:o?.breadcrumbsPrefix}),json:(i,o)=>Jf({value:i,isKeyNumeric:e.getType()===Q.NUMBER,transformKey:p=>e.json(p,{...o,breadcrumbsPrefix:[...o?.breadcrumbsPrefix??[],`${p} (key)`]}),transformValue:(p,l)=>t.json(p,{...o,breadcrumbsPrefix:[...o?.breadcrumbsPrefix??[],`${l}`]}),breadcrumbsPrefix:o?.breadcrumbsPrefix}),getType:()=>Q.RECORD};return{...xe(r),...ae(r)}}function Jf({value:e,isKeyNumeric:t,transformKey:r,transformValue:i,breadcrumbsPrefix:o=[]}){if(!ct(e))return{ok:!1,errors:[{path:o,message:ie(e,"object")}]};let p={},l=[];for(let b in e){if(!I0.call(e,b))continue;let w=e[b];if(w===void 0)continue;let A=b;if(t){let L=b.length>0?Number(b):NaN;Number.isNaN(L)||(A=L)}let I=r(A),P=i(w,A);I.ok&&P.ok?p[I.value]=P.value:(I.ok||l.push(...I.errors),P.ok||l.push(...P.errors))}return l.length===0?{ok:!0,value:p}:{ok:!1,errors:l}}n();a();s();n();a();s();function Qf(e){let t=Kn(e),r={parse:(i,o)=>{let p=t.parse(i,o);return p.ok?{ok:!0,value:new Set(p.value)}:p},json:(i,o)=>i instanceof Set?t.json([...i],o):{ok:!1,errors:[{path:o?.breadcrumbsPrefix??[],message:ie(i,"Set")}]},getType:()=>Q.SET};return{...xe(r),...ae(r)}}n();a();s();n();a();s();function Xf(e){let t={parse:(r,i)=>Yf((o,p)=>o.parse(r,p),e,i),json:(r,i)=>Yf((o,p)=>o.json(r,p),e,i),getType:()=>Q.UNDISCRIMINATED_UNION};return{...xe(t),...ae(t)}}function Yf(e,t,r){let i=[];for(let[o,p]of t.entries()){let l=e(p,{...r,skipValidation:!1});if(l.ok)return l;for(let b of l.errors)i.push({path:b.path,message:`[Variant ${o}] ${b.message}`})}return{ok:!1,errors:i}}n();a();s();n();a();s();function Zf(e,t){return{parsedDiscriminant:e,rawDiscriminant:t}}n();a();s();var N0=Object.prototype.hasOwnProperty;function tm(e,t){let r=typeof e=="string"?e:e.rawDiscriminant,i=typeof e=="string"?e:e.parsedDiscriminant,o=Hn(Vi(t)),p={parse:(l,b)=>em({value:l,discriminant:r,transformedDiscriminant:i,transformDiscriminantValue:w=>o.parse(w,{allowUnrecognizedEnumValues:b?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...b?.breadcrumbsPrefix??[],r]}),getAdditionalPropertiesSchema:w=>t[w],allowUnrecognizedUnionMembers:b?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(w,A)=>A.parse(w,b),breadcrumbsPrefix:b?.breadcrumbsPrefix}),json:(l,b)=>em({value:l,discriminant:i,transformedDiscriminant:r,transformDiscriminantValue:w=>o.json(w,{allowUnrecognizedEnumValues:b?.allowUnrecognizedUnionMembers,breadcrumbsPrefix:[...b?.breadcrumbsPrefix??[],i]}),getAdditionalPropertiesSchema:w=>t[w],allowUnrecognizedUnionMembers:b?.allowUnrecognizedUnionMembers,transformAdditionalProperties:(w,A)=>A.json(w,b),breadcrumbsPrefix:b?.breadcrumbsPrefix}),getType:()=>Q.UNION};return{...xe(p),...ae(p),...Je(p)}}function em({value:e,discriminant:t,transformedDiscriminant:r,transformDiscriminantValue:i,getAdditionalPropertiesSchema:o,allowUnrecognizedUnionMembers:p=!1,transformAdditionalProperties:l,breadcrumbsPrefix:b=[]}){if(!ct(e))return{ok:!1,errors:[{path:b,message:ie(e,"object")}]};let w=e[t],A={};for(let O in e)N0.call(e,O)&&O!==t&&(A[O]=e[O]);if(w==null)return{ok:!1,errors:[{path:b,message:`Missing discriminant ("${t}")`}]};let I=i(w);if(!I.ok)return{ok:!1,errors:I.errors};let P=o(I.value);if(P==null)return p?{ok:!0,value:{[r]:I.value,...A}}:{ok:!1,errors:[{path:[...b,t],message:"Unexpected discriminant value"}]};let L=l(A,P);return L.ok?{ok:!0,value:{[r]:w,...L.value}}:L}n();a();s();var Qn=u.string();n();a();s();var Yn=u.enum_(["openai","anthropic","aws-bedrock"]);var Xn=u.object({provider:Yn,model:Qn});var su={};z(su,{AutomationSchema:()=>wt});n();a();s();n();a();s();var wt=u.object({generate:u.boolean().optional(),upgrade:u.boolean().optional(),preview:u.boolean().optional(),verify:u.boolean().optional()});var hu={};z(hu,{AnyAuthItem:()=>Zn,AnyAuthSchemesSchema:()=>es,ApiAuthSchema:()=>yr,AuthSchemeDeclarationSchema:()=>Et,AuthSchemeReferenceSchema:()=>hr,AuthScope:()=>ls,AuthVariable:()=>Kt,AvailabilitySchema:()=>Es,AvailabilityStatusSchema:()=>br,AvailabilityUnionSchema:()=>As,BaseTypeReferenceSchema:()=>Ds,BasicAuthSchemeSchema:()=>is,BearerAuthSchemeSchema:()=>cs,EncodingSchema:()=>Rs,EndpointSecuritySchema:()=>rs,EndpointSecuritySchemaDetails:()=>ts,EnvironmentSchema:()=>Cs,HeaderAuthSchemeSchema:()=>ps,HttpHeaderSchema:()=>Sr,InferredAuthenticatedRequestHeader:()=>ns,InferredBearerAuthSchema:()=>os,InferredGetTokenEndpointSchema:()=>as,InferredGetTokenEndpointSchemaObject:()=>ss,ListValidationSchema:()=>ks,MapValidationSchema:()=>Fs,MultipleBaseUrlsEnvironmentSchema:()=>Os,NumberValidationSchema:()=>Ls,OAuthAccessTokenRequestPropertiesSchema:()=>ms,OAuthAccessTokenResponsePropertiesSchema:()=>ds,OAuthFlowTypeSchema:()=>fs,OAuthGetTokenEndpointSchema:()=>hs,OAuthPkceSchema:()=>ys,OAuthRefreshTokenEndpointSchema:()=>xs,OAuthRefreshTokenRequestPropertiesSchema:()=>gs,OAuthRefreshTokenResponsePropertiesSchema:()=>bs,OAuthSchemeSchema:()=>Ts,ProtobufTypeSchema:()=>Ns,RedirectUriSchema:()=>ws,RedirectUriWithBackupPortsSchema:()=>Ss,ServerVariableSchema:()=>xr,SingleBaseUrlEnvironmentSchema:()=>Ps,StringValidationSchema:()=>js,TokenBearerAuthSchema:()=>us,TypeReferenceDeclarationWithEnvOverride:()=>vs,TypeReferenceDeclarationWithEnvOverrideSchema:()=>Ms,TypeReferenceDeclarationWithName:()=>Us,ValidationSchema:()=>Bs,WithAudiences:()=>At,WithAvailability:()=>Is,WithDocsSchema:()=>me,WithEnvironmentVariable:()=>gr,WithEnvironmentsSchema:()=>_s,WithHeadersSchema:()=>Vs,WithName:()=>Tt,auth:()=>au,availability:()=>ou,commons:()=>uu,encoding:()=>cu,environments:()=>pu,file:()=>lu,service:()=>fu,types:()=>mu,validation:()=>du});n();a();s();n();a();s();var au={};z(au,{AnyAuthItem:()=>Zn,AnyAuthSchemesSchema:()=>es,ApiAuthSchema:()=>yr,AuthSchemeDeclarationSchema:()=>Et,AuthSchemeReferenceSchema:()=>hr,AuthScope:()=>ls,AuthVariable:()=>Kt,BasicAuthSchemeSchema:()=>is,BearerAuthSchemeSchema:()=>cs,EndpointSecuritySchema:()=>rs,EndpointSecuritySchemaDetails:()=>ts,HeaderAuthSchemeSchema:()=>ps,InferredAuthenticatedRequestHeader:()=>ns,InferredBearerAuthSchema:()=>os,InferredGetTokenEndpointSchema:()=>as,InferredGetTokenEndpointSchemaObject:()=>ss,OAuthAccessTokenRequestPropertiesSchema:()=>ms,OAuthAccessTokenResponsePropertiesSchema:()=>ds,OAuthFlowTypeSchema:()=>fs,OAuthGetTokenEndpointSchema:()=>hs,OAuthPkceSchema:()=>ys,OAuthRefreshTokenEndpointSchema:()=>xs,OAuthRefreshTokenRequestPropertiesSchema:()=>gs,OAuthRefreshTokenResponsePropertiesSchema:()=>bs,OAuthSchemeSchema:()=>Ts,RedirectUriSchema:()=>ws,RedirectUriWithBackupPortsSchema:()=>Ss,TokenBearerAuthSchema:()=>us,WithEnvironmentVariable:()=>gr});n();a();s();n();a();s();n();a();s();n();a();s();var me=u.object({docs:u.string().optional()});var hr=u.object({scheme:u.string()}).extend(me);var Zn=u.undiscriminatedUnion([u.string(),hr]);n();a();s();var es=u.object({any:u.list(Zn)}).extend(me);n();a();s();n();a();s();n();a();s();var ts=u.object({});var rs=u.object({"endpoint-security":ts}).extend(me);var yr=u.undiscriminatedUnion([u.string(),hr,es,rs]);n();a();s();n();a();s();n();a();s();n();a();s();var Tt=u.object({name:u.string().optional()});n();a();s();var gr=u.object({env:u.string().optional()});var Kt=u.object({omit:u.boolean().optional()}).extend(gr).extend(Tt);var is=u.object({scheme:u.stringLiteral("basic"),username:Kt.optional(),password:Kt.optional()}).extend(me);n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();var ns=u.object({"response-property":u.string(),"header-name":u.string(),"value-prefix":u.string().optional()});var ss=u.object({endpoint:u.string(),"expiry-response-property":u.string().optional(),"authenticated-request-headers":u.list(ns).optional()});var as=u.undiscriminatedUnion([u.string(),ss]);var os=u.object({scheme:u.stringLiteral("bearer"),"get-token":as}).extend(me);n();a();s();var us=u.object({scheme:u.stringLiteral("bearer"),token:Kt.optional()}).extend(me);var cs=u.undiscriminatedUnion([us,os]);n();a();s();var ps=u.object({header:u.string(),type:u.string().optional(),prefix:u.string().optional()}).extend(gr).extend(Tt).extend(me);n();a();s();n();a();s();var ls=u.string();n();a();s();var fs=u.enum_(["client-credentials","authorization-code","device-code"]);n();a();s();n();a();s();var ms=u.object({"client-id":u.string().optional(),"client-secret":u.string().optional(),scopes:u.string().optional()});n();a();s();var ds=u.object({"access-token":u.string().optional(),"expires-in":u.string().optional(),"refresh-token":u.string().optional()});var hs=u.object({endpoint:u.string(),"request-properties":ms.optional(),"response-properties":ds.optional()});n();a();s();var ys=u.object({method:u.string().optional()});n();a();s();n();a();s();var gs=u.object({"refresh-token":u.string()});n();a();s();var bs=u.object({"access-token":u.string().optional(),"expires-in":u.string().optional(),"refresh-token":u.string().optional()});var xs=u.object({endpoint:u.string(),"request-properties":gs.optional(),"response-properties":bs.optional()});n();a();s();n();a();s();var Ss=u.object({url:u.string(),ports:u.list(u.number()).optional()});var ws=u.undiscriminatedUnion([u.string(),Ss]);var Ts=u.object({scheme:u.stringLiteral("oauth"),type:fs,scopes:u.list(ls).optional(),"token-prefix":u.string().optional(),"token-header":u.string().optional(),"client-id-env":u.string().optional(),"client-secret-env":u.string().optional(),"get-token":hs.optional(),"refresh-token":xs.optional(),"client-id":u.string().optional(),"authorization-url":u.string().optional(),"device-authorization-url":u.string().optional(),"token-url":u.string().optional(),"refresh-url":u.string().optional(),"redirect-uri":ws.optional(),pkce:ys.optional(),"authorization-parameters":u.record(u.string(),u.string()).optional(),"device-authorization-parameters":u.record(u.string(),u.string()).optional(),"token-parameters":u.record(u.string(),u.string()).optional(),"refresh-parameters":u.record(u.string(),u.string()).optional()}).extend(me);var Et=u.undiscriminatedUnion([Ts,ps,is,cs]);var ou={};z(ou,{AvailabilitySchema:()=>Es,AvailabilityStatusSchema:()=>br,AvailabilityUnionSchema:()=>As});n();a();s();n();a();s();n();a();s();var br=u.enum_(["in-development","pre-release","deprecated","generally-available"]);var Es=u.object({status:br,message:u.string().optional()});n();a();s();var As=u.undiscriminatedUnion([br,Es]);var uu={};z(uu,{WithAudiences:()=>At,WithAvailability:()=>Is,WithDocsSchema:()=>me,WithName:()=>Tt});n();a();s();n();a();s();var At=u.object({audiences:u.list(u.string()).optional()});n();a();s();var Is=u.object({availability:As.optional()});var cu={};z(cu,{EncodingSchema:()=>Rs,ProtobufTypeSchema:()=>Ns});n();a();s();n();a();s();n();a();s();var Ns=u.object({type:u.string()});var Rs=u.object({proto:Ns.optional()});var pu={};z(pu,{EnvironmentSchema:()=>Cs,MultipleBaseUrlsEnvironmentSchema:()=>Os,ServerVariableSchema:()=>xr,SingleBaseUrlEnvironmentSchema:()=>Ps,WithEnvironmentsSchema:()=>_s});n();a();s();n();a();s();n();a();s();n();a();s();var xr=u.object({id:u.string(),default:u.string().optional(),values:u.list(u.string()).optional()});var Os=u.object({urls:u.record(u.string(),u.string()),"url-templates":u.record(u.string(),u.string()).optional(),"default-urls":u.record(u.string(),u.string()).optional(),variables:u.record(u.string(),u.list(xr)).optional()}).extend(At).extend(me);n();a();s();var Ps=u.object({url:u.string(),"default-url":u.string().optional(),"url-template":u.string().optional(),variables:u.list(xr).optional()}).extend(At).extend(me);var Cs=u.undiscriminatedUnion([u.string(),Ps,Os]);n();a();s();var _s=u.object({"default-url":u.string().optional(),"default-environment":u.string().optional(),environments:u.record(u.string(),Cs).optional()});var lu={};z(lu,{WithHeadersSchema:()=>Vs});n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();var ks=u.object({minItems:u.number().optional(),maxItems:u.number().optional()});n();a();s();var Fs=u.object({minProperties:u.number().optional(),maxProperties:u.number().optional()});n();a();s();var Ls=u.object({min:u.number().optional(),max:u.number().optional(),exclusiveMin:u.boolean().optional(),exclusiveMax:u.boolean().optional(),multipleOf:u.number().optional()});n();a();s();var js=u.object({minLength:u.number().optional(),maxLength:u.number().optional(),pattern:u.string().optional(),format:u.string().optional()});var Bs=u.undiscriminatedUnion([js,Ls,ks,Fs]);var Ds=u.object({default:u.unknown().optional(),"client-default":u.unknown().optional(),encoding:Rs.optional(),validation:Bs.optional()}).extend(me).extend(Is);var Us=u.object({type:u.string()}).extend(Ds).extend(Tt).extend(At);var Ms=u.object({env:u.string().optional()}).extend(Us);var vs=u.undiscriminatedUnion([u.string(),Ms]);var Sr=vs;var Vs=u.object({headers:u.record(u.string(),Sr).optional()});var fu={};z(fu,{HttpHeaderSchema:()=>Sr,TypeReferenceDeclarationWithEnvOverride:()=>vs,TypeReferenceDeclarationWithEnvOverrideSchema:()=>Ms});n();a();s();var mu={};z(mu,{BaseTypeReferenceSchema:()=>Ds,TypeReferenceDeclarationWithName:()=>Us});n();a();s();var du={};z(du,{ListValidationSchema:()=>ks,MapValidationSchema:()=>Fs,NumberValidationSchema:()=>Ls,StringValidationSchema:()=>js,ValidationSchema:()=>Bs});n();a();s();var yu={};z(yu,{ApiConfigurationSchema:()=>ca,ApiConfigurationSchemaInternal:()=>Pr,ApiConfigurationV2Schema:()=>oa,ApiConfigurationV2SettingsSchema:()=>kr,ApiConfigurationV2SpecsSchema:()=>Fr,ApiDefinitionList:()=>$s,ApiDefinitionPathSchema:()=>It,ApiDefinitionSchema:()=>Ws,ApiDefinitionSettingsSchema:()=>Ir,ApiDefinitionWithOverridesSchema:()=>Nr,AsyncApiSettingsSchema:()=>_r,AsyncApiSpecSchema:()=>ta,BaseApiSettingsSchema:()=>Cr,CoerceConstsTo:()=>Hs,ConjureSchema:()=>ea,DefaultIntegerFormat:()=>Js,ExampleStyle:()=>pa,FormParameterEncoding:()=>Ks,GeneratorImageObjectSchema:()=>la,GeneratorsConfigurationSchema:()=>rm,GeneratorsOpenApiObjectSchema:()=>va,GeneratorsOpenApiSchema:()=>Va,GitRemoteSchema:()=>qs,GraphQlSpecSchema:()=>ra,Language:()=>za,MessageNamingSettingsSchema:()=>wr,MultiServerStrategy:()=>Tr,NamespacedApiConfigurationSchema:()=>ua,OpenApiExampleGenerationSchema:()=>Qs,OpenApiFilterSchema:()=>Ys,OpenApiSettingsSchema:()=>Rt,OpenApiSpecSchema:()=>ia,OpenRpcSpecSchema:()=>na,OutputMetadataAuthor:()=>fa,OutputMetadataSchema:()=>Ot,OverridesSchema:()=>ze,PathParameterOrder:()=>Er,ProtobufApiDefinitionSchema:()=>Or,ProtobufDefinitionSchema:()=>Rr,ProtobufSpecSchema:()=>sa,ReadmeCustomSectionSchema:()=>qa,ReadmeEndpointObjectSchema:()=>Ga,ReadmeEndpointSchema:()=>Wi,ReadmeSchema:()=>Wa,RemoveDiscriminantsFromSchemas:()=>Ar,RequestOrResponseExampleGenerationSchema:()=>zi,ResolveAliases:()=>Zs,ResolveAliasesSchema:()=>Xs,SpecGitSourceSchema:()=>Gs,SpecSchema:()=>aa,SpecSourceSchema:()=>Nt,UnionSettingsSchema:()=>zs,WhitelabelConfigurationSchema:()=>Ha,WhitelabelGithubConfigurationSchema:()=>$a});n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();var It=u.string();n();a();s();n();a();s();n();a();s();var wr=u.enum_(["v1","v2"]);n();a();s();var Tr=u.enum_(["environment-per-server","urls-per-environment"]);n();a();s();var Er=u.enum_(["url-order","spec-order"]);n();a();s();var Ar=u.enum_(["always","never"]);n();a();s();var zs=u.enum_(["v1"]);var Ir=u.object({"use-title":u.boolean().optional(),unions:zs.optional(),"message-naming":wr.optional(),"respect-nullable-schemas":u.boolean().optional(),"only-include-referenced-schemas":u.boolean().optional(),"inline-path-parameters":u.boolean().optional(),"idiomatic-request-names":u.boolean().optional(),"wrap-references-to-nullable-in-optional":u.boolean().optional(),"coerce-optional-schemas-to-nullable":u.boolean().optional(),"group-environments-by-host":u.boolean().optional(),"multi-server-strategy":Tr.optional(),"remove-discriminants-from-schemas":Ar.optional(),"path-parameter-order":Er.optional()});n();a();s();var ze=u.undiscriminatedUnion([u.string(),u.list(u.string())]);var Nr=u.object({path:It,origin:u.string().optional(),overrides:ze.optional(),audiences:u.list(u.string()).optional(),settings:Ir.optional()});n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();var qs=u.object({repo:u.string(),ref:u.string().optional(),path:u.string()});var Gs=u.object({git:qs});var Nt=u.undiscriminatedUnion([u.string(),Gs]);var Rr=u.object({target:u.string().optional(),root:Nt,overrides:ze.optional(),"local-generation":u.boolean().optional(),"from-openapi":u.boolean().optional(),dependencies:u.list(u.string()).optional()});var Or=u.object({proto:Rr});var Ws=u.undiscriminatedUnion([It,Nr,Or]);var $s=u.list(Ws);var Pr=u.undiscriminatedUnion([It,Nr,$s,Or]);n();a();s();n();a();s();n();a();s();n();a();s();n();a();s();var Hs=u.enum_(["literals","enums","enums-coerceable-to-literals"]);var Cr=u.object({"respect-nullable-schemas":u.boolean().optional(),"title-as-schema-name":u.boolean().optional(),"optional-additional-properties":u.boolean().optional(),"coerce-enums-to-literals":u.boolean().optional(),"idiomatic-request-names":u.boolean().optional(),"wrap-references-to-nullable-in-optional":u.boolean().optional(),"coerce-optional-schemas-to-nullable":u.boolean().optional(),"group-environments-by-host":u.boolean().optional(),"multi-server-strategy":Tr.optional(),"remove-discriminants-from-schemas":Ar.optional(),"path-parameter-order":Er.optional(),"resolve-schema-collisions":u.boolean().optional(),"infer-forward-compatible":u.boolean().optional(),"infer-default-environment":u.boolean().optional(),"coerce-consts-to":Hs.optional()});var _r=u.object({"message-naming":wr.optional()}).extend(Cr);n();a();s();n();a();s();var Js=u.enum_(["int32","int64","uint32","uint64"]);n();a();s();var Ks=u.enum_(["form","json"]);n();a();s();n();a();s();var zi=u.object({"max-depth":u.number().optional()});var Qs=u.object({request:zi.optional(),response:zi.optional()});n();a();s();var Ys=u.object({endpoints:u.list(u.string()).optional()});n();a();s();n();a();s();var Xs=u.object({except:u.list(u.string()).optional()});var Zs=u.undiscriminatedUnion([u.boolean(),Xs]);var Rt=u.object({"only-include-referenced-schemas":u.boolean().optional(),"inline-path-parameters":u.boolean().optional(),"prefer-undiscriminated-unions-with-literals":u.boolean().optional(),"object-query-parameters":u.boolean().optional(),"respect-readonly-schemas":u.boolean().optional(),"use-read-variant-for-responses":u.boolean().optional(),"respect-forward-compatible-enums":u.boolean().optional(),"respect-optional-request-body":u.boolean().optional(),"use-bytes-for-binary-response":u.boolean().optional(),"default-form-parameter-encoding":Ks.optional(),filter:Ys.optional(),"example-generation":Qs.optional(),"additional-properties-defaults-to":u.boolean().optional(),"type-dates-as-strings":u.boolean().optional(),"preserve-single-schema-oneof":u.boolean().optional(),"preserve-one-of-in-all-of":u.boolean().optional(),"inline-all-of-schemas":u.boolean().optional(),"resolve-aliases":Zs.optional(),"group-multi-api-environments":u.boolean().optional(),"default-integer-format":Js.optional(),"infer-discriminated-union-base-properties":u.boolean().optional(),"disambiguate-request-names":u.boolean().optional(),"ignore-tags":u.boolean().optional()}).extend(Cr);var kr=u.object({"auto-generate-idempotency-key":u.unknown().optional()}).extend(Rt).extend(_r);n();a();s();n();a();s();var ea=u.object({conjure:u.string()});n();a();s();n();a();s();var ta=u.object({asyncapi:Nt,origin:u.string().optional(),overrides:ze.optional(),namespace:u.string().optional(),settings:_r.optional()});n();a();s();var ra=u.object({graphql:u.string(),origin:u.string().optional(),overrides:u.string().optional(),examples:u.string().optional(),name:u.string().optional()});n();a();s();var ia=u.object({openapi:Nt,origin:u.string().optional(),overrides:ze.optional(),overlays:u.string().optional(),namespace:u.string().optional(),settings:Rt.optional()});n();a();s();var na=u.object({openrpc:u.string(),overrides:ze.optional(),namespace:u.string().optional()});n();a();s();var sa=u.object({proto:Rr});var aa=u.undiscriminatedUnion([ia,ta,sa,na,ra]);var Fr=u.undiscriminatedUnion([u.list(aa),ea]);var oa=u.object({auth:yr.optional(),"auth-schemes":u.record(u.string(),Et).optional(),specs:Fr,settings:kr.optional()}).extend(Vs).extend(_s);n();a();s();var ua=u.object({namespaces:u.record(u.string(),Pr)});var ca=u.undiscriminatedUnion([Pr,ua,oa]);n();a();s();var pa=u.enum_(["minimal","comprehensive"]);n();a();s();var la=u.object({name:u.string(),registry:u.string()});n();a();s();n();a();s();n();a();s();n();a();s();var fa=u.object({name:u.string(),email:u.string()});var Ot=u.object({description:u.string().optional(),authors:u.list(fa).optional()});n();a();s();n();a();s();var qi=u.object({name:u.string()});var Pt=u.object({teams:u.list(qi).optional(),users:u.list(qi).optional()});n();a();s();n();a();s();n();a();s();n();a();s();var ma=u.object({auth:yr.optional(),"auth-schemes":u.record(u.string(),Et).optional(),headers:u.record(u.string(),Sr).optional(),settings:kr.optional(),specs:Fr.optional()});n();a();s();n();a();s();var da=u.object({url:u.string().optional(),"package-name":u.string(),token:u.string().optional()});n();a();s();var ha=u.object({path:u.string()});n();a();s();n();a();s();var ya=u.object({keyId:u.string(),password:u.string(),secretKey:u.string()});var ga=u.object({url:u.string().optional(),coordinate:u.string(),username:u.string().optional(),password:u.string().optional(),signature:ya.optional()});n();a();s();var ba=u.object({url:u.string().optional(),"package-name":u.string(),token:u.string().optional()});n();a();s();var xa=u.object({url:u.string().optional(),"package-name":u.string(),"api-key":u.string().optional()});n();a();s();var Sa=u.object({"api-key":u.string(),"workspace-id":u.string(),"collection-id":u.string().optional()});n();a();s();n();a();s();var wa=u.object({keywords:u.list(u.string()).optional(),"documentation-link":u.string().optional(),"homepage-link":u.string().optional()}).extend(Ot);var Ta=u.object({url:u.string().optional(),"package-name":u.string(),token:u.string().optional(),username:u.string().optional(),password:u.string().optional(),metadata:wa.optional()});n();a();s();var Ea=u.object({url:u.string().optional(),"package-name":u.string(),"api-key":u.string().optional()});var Aa=u.union("location",{npm:ba,maven:ga,pypi:Ta,postman:Sa,"local-file-system":ha,nuget:xa,rubygems:Ea,crates:da}).transform({transform:e=>e,untransform:e=>e});n();a();s();n();a();s();n();a();s();var Ia=u.object({custom:u.string()});n();a();s();var Na=u.enum_(["MIT","Apache-2.0"]);var qe=u.undiscriminatedUnion([Na,Ia]);var Gi=u.object({"package-description":u.string().optional(),email:u.string().optional(),"reference-url":u.string().optional(),author:u.string().optional(),license:qe.optional()});n();a();s();var Ra=u.object({path:u.string()});n();a();s();n();a();s();n();a();s();var Oa=u.enum_(["commit","release"]);var Pa=u.object({repository:u.string(),branch:u.string().optional(),license:qe.optional(),mode:Oa.optional()});n();a();s();var Ca=u.object({repository:u.string(),branch:u.string().optional(),license:qe.optional(),mode:u.stringLiteral("pull-request"),reviewers:Pt.optional()});n();a();s();var _a=u.object({repository:u.string(),license:qe.optional(),mode:u.stringLiteral("push"),branch:u.string().optional()});n();a();s();n();a();s();var ka=u.enum_(["pull-request","push","commit-and-release"]);var Fa=u.object({uri:u.string(),token:u.string(),mode:ka.optional(),branch:u.string().optional(),license:qe.optional()});var La=u.undiscriminatedUnion([Fa,Pa,Ca,_a]);var Lr=u.object({version:u.string(),output:Aa.optional(),github:La.optional(),config:u.unknown().optional(),metadata:Gi.optional(),keywords:u.list(u.string()).optional(),snippets:Ra.optional(),"ir-version":u.string().optional(),"smart-casing":u.boolean().optional(),"smart-casing-digit-word-boundary":u.boolean().optional(),api:ma.optional(),"disable-examples":u.boolean().optional(),"publish-metadata":Gi.optional(),autorelease:u.boolean().optional(),automation:wt.optional()});var ja=u.object({image:la}).extend(Lr);n();a();s();var Ba=u.object({name:u.string()}).extend(Lr);var Da=u.undiscriminatedUnion([Ba,ja]);var Ua=u.object({audiences:u.list(u.string()).optional(),generators:u.list(Da),metadata:Ot.optional(),reviewers:Pt.optional(),automation:wt.optional()});n();a();s();var Ma=u.object({enabled:u.boolean()});n();a();s();n();a();s();var va=u.object({path:u.string(),origin:u.string().optional(),overrides:u.string().optional(),"disable-examples":u.boolean().optional(),settings:Rt});var Va=u.undiscriminatedUnion([va,u.string()]);n();a();s();n();a();s();n();a();s();var za=u.enum_(["java","python","go","ruby","csharp","typescript","php","rust","swift"]);var qa=u.object({title:u.string(),language:za,content:u.string()});n();a();s();n();a();s();var Ga=u.object({method:u.string(),path:u.string(),stream:u.boolean().optional()});var Wi=u.undiscriminatedUnion([u.string(),Ga]);var Wa=u.object({bannerLink:u.string().optional(),introduction:u.string().optional(),apiReferenceLink:u.string().optional(),apiName:u.string().optional(),disabledSections:u.list(u.string()).optional(),defaultEndpoint:Wi.optional(),features:u.record(u.string(),u.list(Wi)).optional(),customSections:u.list(qa).optional(),exampleStyle:pa.optional()});n();a();s();n();a();s();var $a=u.object({username:u.string(),email:u.string(),token:u.string()});var Ha=u.object({github:$a.optional()});var rm=u.object({"auth-schemes":u.record(u.string(),Et).optional(),api:ca.optional(),whitelabel:Ha.optional(),metadata:Ot.optional(),readme:Wa.optional(),"default-group":u.string().optional(),aliases:u.record(u.string(),u.list(u.string())).optional(),groups:u.record(u.string(),Ua).optional(),reviewers:Pt.optional(),replay:Ma.optional(),ai:Xn.optional(),autorelease:u.boolean().optional(),automation:wt.optional(),openapi:Va.optional(),"openapi-overrides":u.string().optional(),"spec-origin":u.string().optional(),"async-api":u.string().optional(),"api-settings":Ir.optional()});var gu={};z(gu,{BaseGeneratorInvocationSchema:()=>Lr,CratesOutputLocationSchema:()=>da,CustomGeneratorInvocationSchema:()=>ja,DefaultGeneratorInvocationSchema:()=>Ba,GeneratorApiSettingsSchema:()=>ma,GeneratorGroupSchema:()=>Ua,GeneratorInvocationSchema:()=>Da,GeneratorOutputSchema:()=>Aa,GeneratorPublishMetadataSchema:()=>Gi,GeneratorSnippetsSchema:()=>Ra,GithubCommitAndReleaseMode:()=>Oa,GithubCommitAndReleaseSchema:()=>Pa,GithubConfigurationSchema:()=>La,GithubPullRequestSchema:()=>Ca,GithubPushSchema:()=>_a,GithubSelfhostedMode:()=>ka,GithubSelfhostedSchema:()=>Fa,LocalFileSystemOutputLocationSchema:()=>ha,MavenOutputLocationSchema:()=>ga,MavenOutputSignatureSchema:()=>ya,NpmOutputLocationSchema:()=>ba,NugetOutputLocationSchema:()=>xa,PostmanOutputLocationSchema:()=>Sa,PypiOutputLocationSchema:()=>Ta,PypiOutputMetadataSchema:()=>wa,RubyGemsOutputLocationSchema:()=>Ea});n();a();s();var bu={};z(bu,{GithubLicenseCustomSchema:()=>Ia,GithubLicenseSchema:()=>qe,GithubLicenseType:()=>Na});n();a();s();var xu={};z(xu,{ReplayConfigSchema:()=>Ma});n();a();s();var Su={};z(Su,{ReviewerSchema:()=>qi,ReviewersSchema:()=>Pt});n();a();s();n();a();s();n();a();s();function im(e){return e?.specs!=null}n();a();s();function nm(e){return e?.asyncapi!=null}n();a();s();function sm(e){return e?.conjure!=null}n();a();s();function am(e){return e?.graphql!=null}n();a();s();function om(e){return e?.namespaces!=null}n();a();s();function um(e){return e?.openapi!=null}n();a();s();function cm(e){return e?.openrpc!=null}n();a();s();function pm(e){return e?.proto!=null}var lm={[Ge.GenerationLanguage.PHP]:new Set(["abstract","and","as","break","callable","case","catch","class","clone","const","continue","declare","default","do","echo","else","elseif","enddeclare","endfor","endforeach","endif","endswitch","endwhile","extends","final","finally","fn","for","foreach","function","global","goto","list","if","implements","include","include_once","instanceof","insteadof","interface","match","namespace","new","or","parent","Parent","print","private","protected","public","readonly","require","require_once","return","static","switch","throw","trait","try","use","var","while","xor","yield"].flatMap(e=>[e,Le(e)])),[Ge.GenerationLanguage.TYPESCRIPT]:new Set(["any","as","boolean","break","case","catch","class","const","constructor","continue","debugger","declare","default","delete","do","else","enum","export","extends","false","finally","for","from","function","get","if","implements","import","in","instanceof","interface","let","module","new","null","number","of","package","private","protected","public","require","return","set","static","string","super","switch","symbol","this","throw","true","try","type","typeof","var","void","while","with","yield","Date","Error","File","Object","Record"]),[Ge.GenerationLanguage.JAVA]:new Set(["abstract","assert","boolean","break","byte","case","catch","char","class","const","continue","default","do","double","else","enum","extends","false","final","finally","float","for","goto","if","implements","import","instanceof","int","interface","long","native","new","null","package","private","protected","public","return","short","static","strictfp","super","switch","synchronized","this","throw","throws","transient","true","try","void","volatile","while"]),[Ge.GenerationLanguage.PYTHON]:new Set(["False","None","True","and","as","assert","async","","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield","float","int","complex","bool","uuid","list","set","map","long","self","all","kwargs"]),[Ge.GenerationLanguage.GO]:new Set(["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","internal","map","package","range","return","select","struct","switch","type","var","vendor","any","bool","byte","complex64","complex128","error","float32","float64","int","int8","int16","int32","int64","make","new","rune","string","uint","uint8","uint16","uint32","uint64","uintptr"]),[Ge.GenerationLanguage.RUBY]:new Set(["__ENCODING__","__LINE__","__FILE__","alias","and","begin","break","case","class","def","defined","do","else","elsif","end","ensure","false","for","if","in","module","next","nil","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","Object","JSON","Date","DateTime","object_id","hash","eql?","equal?","method","send","respond_to?","respond_to_missing?","instance_of?","kind_of?","is_a?","extend","singleton_class","instance_variables","instance_variable_get","instance_variable_set","instance_variable_defined?","remove_instance_variable","public_methods","private_methods","protected_methods","singleton_methods"]),[Ge.GenerationLanguage.CSHARP]:new Set(["abstract","as","base","bool","break","byte","case","catch","char","checked","class","const","continue","decimal","default","delegate","do","double","else","enum","event","explicit","extern","false","finally","fixed","float","for","foreach","goto","if","implicit","in","int","interface","internal","is","lock","long","namespace","new","null","object","operator","out","override","params","private","protected","public","readonly","ref","return","sbyte","sealed","short","sizeof","stackalloc","static","string","struct","switch","this","throw","true","try","typeof","uint","ulong","unchecked","unsafe","ushort","using","virtual","void","volatile","while","add","and","alias","ascending","args","async","","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","managed","nameof","nint","not","notnull","nuint","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value","var","when","where","with","yield"]),[Ge.GenerationLanguage.RUST]:new Set(["as","async","await","break","const","continue","crate","dyn","else","enum","extern","false","fn","for","if","impl","in","let","loop","match","mod","move","mut","pub","ref","return","self","Self","static","struct","super","trait","true","type","union","unsafe","use","where","while","abstract","become","box","do","final","macro","override","priv","try","typeof","unsized","virtual","yield","bool","char","f32","f64","i8","i16","i32","i64","i128","isize","str","u8","u16","u32","u64","u128","usize","String","Vec","Option","Result","Box","Rc","Arc","Cell","RefCell","HashMap","HashSet","BTreeMap","BTreeSet"]),[Ge.GenerationLanguage.SWIFT]:new Set([])};var R0=["go","ruby"];function Ja(e,t,r){let{generationLanguage:i,keywords:o,smartCasing:p,smartCasingDigitWordBoundary:l}=r,b=B0(e),w=W=>({unsafeName:W,safeName:O0({name:W,keywords:P0({generationLanguage:i,keywords:o})})}),A=t.preserveUnderscores===!0,I=A?(W,q)=>Tu(W,q):(W,q)=>q(W),P=I(b,lr),L=A?Tu(b,W=>Le(lr(W))):Le(P),O=I(b,qn),{leading:F,trailing:U}=A?mm(b):{leading:"",trailing:""},M=Li(P);if(p){!k0(M)&&(i==null||R0.includes(i))&&(P=F+M.map((q,oe)=>{if(oe>0){let H=Ka(q);if(H!=null)return H;if(Qa(q))return q.toUpperCase()}return q}).join("")+U,L=Le(F+M.map((q,oe)=>{let H=Ka(q);return H??(Qa(q)?q.toUpperCase():oe===0?Le(q):q)}).join("")+U));let W=q=>q.split(" ").map(oe=>{let H=oe.split(/(\d+)/);return H.map((K,C)=>{let D=qn(K),Z=H[C-1];return(l??!1)&&D!==""&&Z!=null&&/^\d+$/.test(Z)&&/^[^a-z0-9]/.test(K)?`_${D}`:D}).join("")}).join("_");O=A?Tu(b,W):W(b)}return{originalName:e,camelCase:w(t.casingOverrides?.camel??P),snakeCase:w(t.casingOverrides?.snake??O),screamingSnakeCase:w(t.casingOverrides?.["screaming-snake"]??O.toUpperCase()),pascalCase:w(t.casingOverrides?.pascal??L)}}function fm({generationLanguage:e,keywords:t,smartCasing:r,smartCasingDigitWordBoundary:i}){let o={generationLanguage:e,keywords:t,smartCasing:r,smartCasingDigitWordBoundary:i};return{generateName:(p,l)=>{if(typeof p=="string")return Ja(p,l??{},o);if("wireValue"in p){let b=p.name;return typeof b=="string"?Ja(b,l??{},o):b}return p},generateNameAndWireValue:(p,l)=>{if(typeof p=="string")return{wireValue:p,name:Ja(p,l??{},o)};let{name:b,wireValue:w}=p,A=typeof b=="string"?Ja(b,l??{},o):b;return{wireValue:w,name:A}}}}function O0({name:e,keywords:t}){return t==null?e:t.has(e)?e+"_":_0(e)?"_"+e:e}function P0({generationLanguage:e,keywords:t}){if(t!=null)return new Set(t);if(e!=null)return lm[e]}var C0=/^[0-9]/;function _0(e){return C0.test(e)}function k0(e){return e.some((t,r)=>{if(r===0)return!1;let i=e[r-1];if(i==null)return!1;let o=Ka(i)!=null||Qa(i),p=Ka(t)!=null||Qa(t);return o&&p})}function Ka(e){return L0.get(e.toUpperCase())}function Qa(e){return F0.has(e.toUpperCase())}var F0=new Set(["ACL","API","ASCII","CPU","CSS","DNS","EOF","GUID","HTML","HTTP","HTTPS","ID","IP","JSON","LHS","QPS","RAM","RHS","RPC","SAML","SCIM","SLA","SMTP","SQL","SSH","SSO","TCP","TLS","TTL","UDP","UI","UID","UUID","URI","URL","UTF8","VM","XML","XMPP","XSRF","XSS"]),L0=new Map([["ACLS","ACLs"],["APIS","APIs"],["CPUS","CPUs"],["GUIDS","GUIDs"],["IDS","IDs"],["UIDS","UIDs"],["UUIDS","UUIDs"],["URIS","URIs"],["URLS","URLs"]]),j0=[[/\[\]/g,"Array"]];function B0(e){return j0.reduce((t,[r,i])=>t.replace(r,i),e)}function mm(e){let t=e.match(/^(_+)/),r=e.match(/(_+)$/),i=t?.[1]??"",o=r?.[1]??"";if(i.length+o.length>=e.length)return{leading:e,trailing:"",core:""};let p=e.slice(i.length,e.length-o.length||void 0);return{leading:i,trailing:o,core:p}}function Tu(e,t){let{leading:r,trailing:i,core:o}=mm(e);return r===""&&i===""?t(e):`${r}${t(o)}${i}`}n();a();s();function $i(e){return typeof e=="string"?e:e.wireValue}var Hi=class e{constructor(t){y(this,"casingsGenerator");this.casingsGenerator=fm(t)}static fromLanguage(t,r){return new e({generationLanguage:t,keywords:void 0,smartCasing:r})}resolve(t){return this.casingsGenerator.generateName(t)}resolveNameOrString(t){return this.casingsGenerator.generateName(t)}resolveNameAndWireValue(t){return this.casingsGenerator.generateNameAndWireValue(t)}camel(t){return this.resolve(t).camelCase}camelSafe(t){return this.camel(t).safeName}camelUnsafe(t){return this.camel(t).unsafeName}pascal(t){return this.resolve(t).pascalCase}pascalSafe(t){return this.pascal(t).safeName}pascalUnsafe(t){return this.pascal(t).unsafeName}snake(t){return this.resolve(t).snakeCase}snakeSafe(t){return this.snake(t).safeName}snakeUnsafe(t){return this.snake(t).unsafeName}screamingSnake(t){return this.resolve(t).screamingSnakeCase}screamingSnakeSafe(t){return this.screamingSnake(t).safeName}screamingSnakeUnsafe(t){return this.screamingSnake(t).unsafeName}};n();a();s();var Ke=class extends ut{constructor(r){super();y(this,"value");this.value=r}write(r){typeof this.value=="string"?r.write(this.value):typeof this.value=="function"?this.value(r):this.value.write(r)}};var M0=4;ql({skip:0,maxFrames:15,filterFunctions:["Abstract"]});var Ji=class{constructor(){y(this,"lineBuffer",[]);y(this,"indentLevel",0);y(this,"hasWrittenAnything",!1);y(this,"lastCharacterIsSemicolon",!1);y(this,"lastCharacterIsNewline",!1);y(this,"nodeStackFrames",[])}get buffer(){return je&&this.nodeStackFrames.length>0&&this.writeInternal(`
|
|
6
6
|
`),this.lineBuffer.join(`
|
|
7
7
|
`)+(this.lastCharacterIsNewline?`
|
|
8
8
|
`:"")}write(...t){for(let r of t)if(r!=null)if(typeof r=="string"){let i=r.length>0&&r.endsWith(`
|
|
@@ -30,7 +30,7 @@ ${Mi(this).map(r=>` ${r.fn} - ${r.path}:${r.position}`).join(`
|
|
|
30
30
|
`),this.hasSameAccess(this.init)||r.write(`${this.init} `),r.writeTextStatement("init"),r.writeNoIndent(`#else
|
|
31
31
|
`),r.writeTextStatement("set"),r.writeNoIndent(`#endif
|
|
32
32
|
`)):(this.hasSameAccess(this.init)||r.write(`${this.init} `),this.accessors?.init?(r.write("init"),r.write(" => "),this.accessors.init(r),r.writeTextStatement("")):r.write("init; "))),this.set&&(this.hasSameAccess(this.set)||r.write(`${this.set} `),this.accessors?.set?(r.write("set"),r.write(" => "),this.accessors.set(r),r.writeTextStatement("")):r.write("set; ")),r.write("}")),this.initializer!=null?(p?r.write(" => "):r.write(" = "),this.initializer.write(r),r.writeLine(";")):!this.skipDefaultInitializer&&!i&&o?v.Type(this.type)&&this.type.writeEmptyCollectionInitializer(r):!this.get&&!this.init&&r.writeLine(";")}hasSameAccess(r){return r===!0||r===this.access}};n();a();s();var Xe;(function(e){e[e.INSTANCE=0]="INSTANCE",e[e.STATIC=1]="STATIC"})(Xe||(Xe={}));var Gt=class e extends Ct{constructor({name:r,isAsync:i,override:o,access:p,return_:l,body:b,noBody:w,bodyType:A,summary:I,doc:P,type:L,classReference:O,parameters:F,typeParameters:U,annotations:M,codeExample:W,interfaceReference:q,origin:oe,enclosingType:H},K){super({enclosingType:H},oe,K);y(this,"name");y(this,"isAsync");y(this,"access");y(this,"return");y(this,"noBody");y(this,"body");y(this,"bodyType");y(this,"summary");y(this,"doc");y(this,"type");y(this,"reference");y(this,"override");y(this,"parameters");y(this,"typeParameters");y(this,"annotations");y(this,"interfaceReference");this.name=r,this.isAsync=i??!1,this.override=o??!1,this.access=p,this.return=l,this.noBody=w??!1,this.body=b,this.bodyType=A??e.BodyType.Statement,this.summary=I,this.doc=this.csharp.xmlDocBlockOf(P??{summary:I,codeExample:W}),this.type=L??Xe.INSTANCE,this.reference=O,this.parameters=F??[],this.typeParameters=U??[],this.annotations=(M??[]).map(C=>C instanceof _e?this.csharp.annotation({reference:C}):C),this.interfaceReference=q}get isAsyncEnumerable(){return v.AsyncEnumerable(this.return)}addParameter(r){return r instanceof Ye||(r=new Ye(r,this.generation)),this.parameters.push(r),r}write(r){if(r.writeNode(this.doc),this.annotations.forEach(i=>{i.write(r)}),r.writeNewLineIfLastLineNot(),this.access&&r.write(`${this.access} `),this.type===Xe.STATIC&&r.write("static "),this.isAsync&&r.write("async "),this.override&&r.write("override "),this.return==null?this.isAsync?(r.writeNode(this.System.Threading.Tasks.Task()),r.write(" ")):r.write("void "):(this.isAsync&&!this.isAsyncEnumerable?r.writeNode(this.System.Threading.Tasks.Task(this.return)):this.return.write(r),r.write(" ")),this.interfaceReference&&r.write(`${this.interfaceReference.name}.`),r.write(this.name),this.typeParameters.length>0&&(r.write("<"),this.typeParameters.forEach((i,o)=>{i.write(r),o<this.typeParameters.length-1&&r.write(", ")}),r.write(">")),r.write("("),this.parameters.forEach((i,o)=>{i.write(r),o<this.parameters.length-1&&r.write(", ")}),r.write(")"),this.noBody)r.writeLine(";");else switch(this.bodyType){case e.BodyType.Statement:r.write(" "),r.pushScope(),this.body?.write(r),r.popScope();break;case e.BodyType.Expression:r.write(" => "),this.body?.write(r),r.writeSemicolonIfLastCharacterIsNot();break;default:ue(this.bodyType)}}getParameters(){return this.parameters}};(function(e){e.BodyType={Statement:"statement",Expression:"expression"}})(Gt||(Gt={}));var Ti=class extends Be{constructor({name:r,namespace:i,access:o,partial:p,interfaceReferences:l,enclosingType:b,origin:w},A){super(w,A);y(this,"access");y(this,"partial");y(this,"reference");y(this,"interfaceReferences");y(this,"fields",[]);y(this,"methods",[]);r=r||(w?this.model.getClassNameFor(w):de("Class/Interface name or origin is required")),this.reference=b?this.csharp.classReference({name:r,enclosingType:b}):this.csharp.classReference({name:r,namespace:i||de("Class/Interface: Namespace or enclosingType is required ")}),this.access=o,this.partial=p??!1,this.interfaceReferences=l??[]}get name(){return this.reference.name}get namespace(){return this.reference.namespace}get enclosingType(){return this.reference.enclosingType}get isNested(){return this.enclosingType!=null}explicit(r){return this.origin?this.model.explicit(v.Provenance(this.origin)?this.origin.node:this.origin,r):de(`Cannot create explicit named member '${r}' on '${this.name}' because the class is not bound to an origin.`)}getField(r){return this.fields.find(i=>this.model.provenance(i.origin)?.jsonPath===r.jsonPath)}addField(r){r.enclosingType=this.reference;let i=new wi(r,this.generation);return this.fields.push(i),i}addMethod(r){r.enclosingType=this.reference;let i=new Gt(r,this.generation);return this.methods.push(i),i}get multipartMethodName(){return"AddJsonPart"}get multipartMethodNameForCollection(){return"AddJsonParts"}get isOptional(){return!1}get isCollection(){return!1}get isReferenceType(){}asOptional(){return new $e(this,this.generation)}asNullable(){return new nr(this,this.generation)}asNonOptional(){return this}get defaultValue(){return this.csharp.Literal.null()}get fullyQualifiedName(){return this.reference.fullyQualifiedName}};var ve=class ve extends Ti{constructor({name:r,namespace:i,access:o,static_:p,abstract_:l,sealed:b,partial:w,readonly:A,parentClassReference:I,interfaceReferences:P,enclosingType:L,type:O,summary:F,doc:U,annotations:M,primaryConstructor:W,skipNamespaceDeclaration:q,origin:oe},H){super({name:r,namespace:i,access:o,partial:w,interfaceReferences:P,enclosingType:L,origin:oe},H);y(this,"static_");y(this,"abstract_");y(this,"sealed");y(this,"readonly");y(this,"parentClassReference");y(this,"type");y(this,"summary");y(this,"doc");y(this,"annotations",[]);y(this,"primaryConstructor");y(this,"namespaceReferences",[]);y(this,"skipNamespaceDeclaration");y(this,"constructors",[]);y(this,"operators",[]);y(this,"nestedClasses",[]);y(this,"nestedInterfaces",[]);y(this,"rawBodyBlocks",[]);this.skipNamespaceDeclaration=q??!1,this.static_=p??!1,this.abstract_=l??!1,this.sealed=b??!1,this.readonly=A??!1,this.type=O??ve.ClassType.Class,this.summary=F,this.doc=this.csharp.xmlDocBlockOf(U??{summary:F}),this.parentClassReference=I,this.annotations=(M??[]).map(K=>K instanceof _e?this.csharp.annotation({reference:K}):K),this.primaryConstructor=W}addConstructor(r){let i=new ve.Constructor(r,this.generation);return this.constructors.push(i),i}addNestedClass(r){if(r instanceof ve||(r.enclosingType=this.reference,r=new ve(r,this.generation)),!r.isNested)throw new Error(`Set the enclosingType of the class ${this.name} to add the nested class ${r.name}.`);return this.nestedClasses.push(r),r}addNestedClasses(r){r.forEach(i=>{i instanceof ve?this.addNestedClass(i):this.addNestedClass(i)})}addAnnotation(r){return r instanceof gt||(r=new gt(r,this.generation)),this.annotations.push(r),r}addOperator(r){this.operators.push(r)}addOperators(r){r.forEach(i=>this.addOperator(i))}addRawBodyContent(r){this.rawBodyBlocks.push(r)}write(r){if(this.namespaceReferences.forEach(i=>{r.addNamespace(i)}),!this.isNested&&!this.skipNamespaceDeclaration&&(r.writeLine(`namespace ${this.namespace};`),r.newLine()),r.writeNode(this.doc),this.annotations.forEach(i=>{i.write(r)}),this.skipNamespaceDeclaration||r.writeNewLineIfLastLineNot(),r.write(`${this.access}`),this.static_&&r.write(" static"),this.abstract_&&r.write(" abstract"),this.sealed&&r.write(" sealed"),this.readonly&&r.write(" readonly"),this.partial&&r.write(" partial"),r.write(` ${this.type}`),r.write(` ${this.name}`),this.primaryConstructor!=null&&this.primaryConstructor.parameters.length>0){let i=this.primaryConstructor;r.write("("),i.parameters.forEach((o,p)=>{p>0&&r.write(","),o.write(r)}),r.write(")")}if(this.parentClassReference!=null||this.interfaceReferences.length>0){if(r.write(" : "),this.parentClassReference!=null&&(this.parentClassReference.write(r),this.interfaceReferences.length>0&&r.write(", ")),this.primaryConstructor!=null&&this.primaryConstructor.superClassArguments.length>0){let i=this.primaryConstructor;r.write("("),this.primaryConstructor.superClassArguments.forEach((o,p)=>{o.write(r),p<i.superClassArguments.length-1&&r.write(", ")}),r.write(")")}this.interfaceReferences.forEach((i,o)=>{i.write(r),o<this.interfaceReferences.length-1&&r.write(", ")})}if(!this.hasBody()){r.write(";");return}r.writeNewLineIfLastLineNot(),r.pushScope(),r.pushTypeScope(this.reference.fullyQualifiedName),this.writeConsts(r),this.writeFieldFields(r),this.writeConstructors(r),this.writeProperties(r),this.writeMethods(r),this.writeOperators(r),this.writeRawBodyBlocks(r),this.writeNestedClasses(r),this.writeNestedInterfaces(r),r.popTypeScope(),r.popScope()}hasBody(){return this.fields.length>0||this.constructors.length>0||this.nestedClasses.length>0||this.nestedInterfaces.length>0||this.methods.length>0||this.operators.length>0||this.rawBodyBlocks.length>0}writeConstructors(r){this.constructors.forEach(i=>{r.writeNode(this.csharp.xmlDocBlockOf(i.doc)),i.annotations.forEach(o=>{o.write(r),r.writeNewLineIfLastLineNot()}),r.write(`${i.access} ${this.name} (`),i.parameters.forEach((o,p)=>{o.write(r),p<i.parameters.length-1&&r.write(", ")}),r.write(")"),i.baseConstructorCall!=null&&(r.write(" : "),i.baseConstructorCall.write(r)),r.pushScope(),i.body.write(r),r.popScope(),r.newLine()})}writeFields({writer:r,fields:i}){i.forEach((o,p)=>{o.write(r),r.writeNewLineIfLastLineNot(),p<this.fields.length-1&&r.newLine()})}writeConsts(r){this.writeFields({writer:r,fields:this.getFields().sort(Ei).sort(nc).filter(this.fieldConstFilter())})}writeFieldFields(r){this.writeFields({writer:r,fields:this.getFields().sort(Ei).sort(nc).filter(this.fieldFieldFilter())})}writeProperties(r){this.writeFields({writer:r,fields:this.getFields().sort(Ei).sort(nc).filter(this.fieldPropertyFilter())})}writeMethods(r){this.methods.sort(Ei).sort(Qy).sort(Ky).forEach(i=>{i.write(r),r.writeNewLineIfLastLineNot(),r.newLine()})}writeOperators(r){this.operators.forEach(i=>{this.writeOperator({writer:r,operator:i}),r.newLine()})}writeRawBodyBlocks(r){this.rawBodyBlocks.forEach(i=>{i.write(r),r.writeNewLineIfLastLineNot()})}writeNestedClasses(r){this.nestedClasses.sort(Ei).forEach((i,o)=>{i.write(r),r.writeNewLineIfLastLineNot(),o<this.fields.length-1&&r.newLine()})}writeNestedInterfaces(r){this.nestedInterfaces.sort(Ei).forEach((i,o)=>{i.write(r),r.writeNewLineIfLastLineNot(),o<this.fields.length-1&&r.newLine()})}fieldConstFilter(){return r=>r.isConst}fieldFieldFilter(){return r=>r.isField}fieldPropertyFilter(){return r=>r.isProperty}getFields(){return this.fields}get isReferenceType(){return this.type===ve.ClassType.Class||this.type===ve.ClassType.Record}writeOperator({writer:r,operator:i}){if(r.write("public static "),i.type===ve.CastOperator.Type.Explicit||i.type===ve.CastOperator.Type.Implicit){r.write(`${i.type} `),r.write("operator ");let o=i.to??this.reference;r.writeNode(o),r.write("("),i.parameter.write(r)}else{let o=i;o.return.write(r),r.write(" operator "),r.write(`${i.type}(`),o.parameters.forEach((p,l)=>{p.write(r),l<o.parameters.length-1&&r.write(", ")})}i.useExpressionBody?(r.write(") => "),r.writeNodeStatement(i.body)):(r.write(") {"),r.writeNode(i.body),r.writeLine("}"))}addNamespaceReference(r){this.namespaceReferences.push(r)}};y(ve,"ClassType",{Class:"class",Record:"record",Struct:"struct",RecordStruct:"record struct"}),y(ve,"Access",ge);var nt=ve;(function(e){class t{constructor({doc:o,body:p,parameters:l,access:b,baseConstructorCall:w,annotations:A},I){y(this,"generation");y(this,"doc");y(this,"body");y(this,"parameters");y(this,"access");y(this,"baseConstructorCall");y(this,"annotations");this.generation=I,this.parameters=l??[],this.access=b??ge.Public,this.doc=o,this.annotations=A??[],this.body=new vt({},this.generation),p!=null&&this.body.append(p),this.baseConstructorCall=w}addParameter(o){let p=new Ye(o,this.generation);return this.parameters.push(p),p}}e.Constructor=t;let r;(function(i){i.Type={Implicit:"implicit",Explicit:"explicit"}})(r=e.CastOperator||(e.CastOperator={}))})(nt||(nt={}));function ad(e){switch(e){case void 0:return 0;case ge.Private:return 1;case ge.Protected:return 2;case ge.Internal:return 3;case ge.Public:return 4}}function Ei(e,t){return ad(e.access)-ad(t.access)}function nc(e,t){return e.isStatic===t.isStatic?0:e.isStatic?-1:1}function Ky(e,t){return e.type===Xe.STATIC&&t.type!==Xe.STATIC?-1:e.type!==Xe.STATIC&&t.type===Xe.STATIC?1:0}function Qy(e,t){return e.name==="FromProto"||e.name==="ToProto"?t.name==="Equals"||t.name==="ToString"?-1:1:t.name==="FromProto"||t.name==="ToProto"?e.name==="Equals"||e.name==="ToString"?1:-1:e.name==="ToString"?1:t.name==="ToString"?-1:e.name==="Equals"?t.name==="ToString"?-1:1:t.name==="Equals"?e.name==="ToString"?1:-1:0}n();a();s();var Ai=class extends Be{constructor({name:r,namespace:i,access:o,annotations:p,origin:l},b){super(l,b);y(this,"access");y(this,"reference");y(this,"annotations");y(this,"fields",[]);y(this,"generateSerializer",!1);y(this,"serializerClassReference");this.reference=this.csharp.classReference({name:r,namespace:i,origin:l}),this.access=o,this.annotations=p??[]}get name(){return this.reference.name}get namespace(){return this.reference.namespace}getNamespace(){return this.namespace}addAnnotation(r){this.annotations.push(r)}addMember(r){this.fields.push({name:r.name,wireValue:r.value,value:this.csharp.annotation({reference:this.System.Runtime.Serialization.EnumMember,argument:this.csharp.codeblock(i=>{i.write("Value = "),i.writeNode(this.csharp.string_({string:r.value}))})})})}enableSerializerGeneration(){return this.generateSerializer=!0,this.serializerClassReference=this.csharp.classReference({name:`${this.name}Serializer`,namespace:this.namespace}),this.serializerClassReference}write(r){r.writeLine(`namespace ${this.namespace};`),r.newLine();for(let i of this.annotations)i.write(r);r.writeNewLineIfLastLineNot(),r.write(`${this.access} `),r.write("enum "),r.writeLine(`${this.name}`),r.pushScope(),this.fields.forEach((i,o)=>{i.value.write(r),r.write(i.name),o<this.fields.length-1&&(r.writeLine(","),r.newLine())}),r.writeNewLineIfLastLineNot(),r.popScope(),this.generateSerializer&&this.writeSerializerClass(r)}writeSerializerClass(r){r.newLine(),r.writeLine(`internal class ${this.name}Serializer : global::System.Text.Json.Serialization.JsonConverter<${this.name}>`),r.pushScope(),r.writeLine(`private static readonly global::System.Collections.Generic.Dictionary<string, ${this.name}> _stringToEnum = new()`),r.pushScope();for(let i of this.fields)r.writeLine(`{ ${JSON.stringify($i(i))}, ${this.name}.${i.name} },`);r.popScope(!1),r.writeLine(";"),r.newLine(),r.writeLine(`private static readonly global::System.Collections.Generic.Dictionary<${this.name}, string> _enumToString = new()`),r.pushScope();for(let i of this.fields)r.writeLine(`{ ${this.name}.${i.name}, ${JSON.stringify($i(i))} },`);r.popScope(!1),r.writeLine(";"),r.newLine(),r.writeLine(`public override ${this.name} Read(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options)`),r.pushScope(),r.writeLine('var stringValue = reader.GetString() ?? throw new global::System.Exception("The JSON value could not be read as a string.");'),r.writeLine("return _stringToEnum.TryGetValue(stringValue, out var enumValue) ? enumValue : default;"),r.popScope(),r.newLine(),r.writeLine(`public override void Write(global::System.Text.Json.Utf8JsonWriter writer, ${this.name} value, global::System.Text.Json.JsonSerializerOptions options)`),r.pushScope(),r.writeLine("writer.WriteStringValue(_enumToString.TryGetValue(value, out var stringValue) ? stringValue : null);"),r.popScope(),r.newLine(),r.writeLine(`public override ${this.name} ReadAsPropertyName(ref global::System.Text.Json.Utf8JsonReader reader, global::System.Type typeToConvert, global::System.Text.Json.JsonSerializerOptions options)`),r.pushScope(),r.writeLine('var stringValue = reader.GetString() ?? throw new global::System.Exception("The JSON property name could not be read as a string.");'),r.writeLine("return _stringToEnum.TryGetValue(stringValue, out var enumValue) ? enumValue : default;"),r.popScope(),r.newLine(),r.writeLine(`public override void WriteAsPropertyName(global::System.Text.Json.Utf8JsonWriter writer, ${this.name} value, global::System.Text.Json.JsonSerializerOptions options)`),r.pushScope(),r.writeLine("writer.WritePropertyName(_enumToString.TryGetValue(value, out var stringValue) ? stringValue : value.ToString());"),r.popScope(),r.popScope()}};n();a();s();var Ii=class extends Ti{constructor({name:t,namespace:r,access:i,partial:o,interfaceReferences:p,enclosingType:l,origin:b},w){super({name:t,namespace:r,access:i,partial:o,interfaceReferences:p,enclosingType:l,origin:b},w)}write(t){this.isNested||(t.writeLine(`namespace ${this.namespace};`),t.newLine()),t.write(`${this.access} `),this.partial&&t.write("partial "),t.write("interface "),t.writeLine(`${this.name}`),this.interfaceReferences.length>0&&(t.write(" : "),this.interfaceReferences.forEach((r,i)=>{r.write(t),i<this.interfaceReferences.length-1&&t.write(", ")})),t.pushScope();for(let r of this.fields)r.write(t),t.writeLine("");t.dedent(),t.indent();for(let r of this.methods)r.write(t),t.writeLine("");t.popScope()}};n();a();s();var Ni=class extends Be{constructor({name:r,namespace:i,parentClassReference:o,origin:p},l){super(p,l);y(this,"reference");y(this,"parentClassReference");y(this,"testMethods",[]);this.reference=this.csharp.classReference({name:r,namespace:i,origin:p}),this.parentClassReference=o}get name(){return this.reference.name}get namespace(){return this.reference.namespace}write(r){r.writeNode(this.getClass())}getClass(){let r=[this.NUnit.Framework.TestFixture,this.csharp.annotation({reference:this.NUnit.Framework.Parallelizable,argument:"ParallelScope.Self"})],i=new nt({access:ge.Public,name:this.name,namespace:this.namespace,annotations:r,parentClassReference:this.parentClassReference,origin:this.origin},this.generation);for(let o of this.testMethods)i.addMethod({access:ge.Public,isAsync:o.isAsync,name:o.name,parameters:[],body:o.body,annotations:[this.NUnit.Framework.Test]});return i}addTestMethod(r){this.testMethods.push(r)}};n();a();s();function od(e){return typeof e=="object"&&e!=null}function ud(e){let t=e.publishConfig;if(!od(t)||t.type!=="filesystem")return;let r=t.publishTarget;if(!(!od(r)||r.type!=="nuget"))return{version:typeof r.version=="string"?r.version:void 0,packageName:typeof r.packageName=="string"?r.packageName:void 0}}n();a();s();n();a();s();n();a();s();n();a();s();var sc={System:["AccessViolationException","Action","Activator","AggregateException","AppContext","AppDomain","AppDomainSetup","AppDomainUnloadedException","ApplicationException","ApplicationId","ArgIterator","ArgumentException","ArgumentNullException","ArgumentOutOfRangeException","ArithmeticException","Array","ArrayTypeMismatchException","AssemblyLoadEventArgs","AssemblyLoadEventHandler","AsyncCallback","Attribute","AttributeTargets","AttributeUsageAttribute","BadImageFormatException","Base64FormattingOptions","BitConverter","Boolean","Buffer","Byte","CannotUnloadAppDomainException","Char","CharEnumerator","CLSCompliantAttribute","Console","ConsoleCancelEventArgs","ConsoleCancelEventHandler","ConsoleColor","ConsoleKey","ConsoleKeyInfo","ConsoleModifiers","ConsoleSpecialKey","ContextBoundObject","ContextMarshalException","ContextStaticAttribute","Convert","CultureAwareComparer","DataMisalignedException","DateOnly","DateTime","DateTimeKind","DateTimeOffset","DayOfWeek","DBNull","Decimal","Delegate","DivideByZeroException","DllNotFoundException","Double","DuplicateWaitObjectException","EntryPointNotFoundException","Enum","Environment","EnvironmentVariableTarget","EventArgs","EventHandler","Exception","ExecutionEngineException","FieldAccessException","FlagsAttribute","FormatException","FormattableString","GC","GCCollectionMode","GCGenerationInfo","GCKind","GCMemoryInfo","GCNotificationStatus","Guid","Half","HashCode","IAsyncDisposable","IAsyncResult","ICloneable","IComparable","IConvertible","ICustomFormatter","IDisposable","IFormatProvider","IFormattable","Index","IndexOutOfRangeException","InsufficientExecutionStackException","InsufficientMemoryException","Int128","Int16","Int32","Int64","IntPtr","InvalidCastException","InvalidOperationException","InvalidProgramException","InvalidTimeZoneException","ISpanFormattable","IUtf8SpanFormattable","LoaderOptimization","LoaderOptimizationAttribute","LocalDataStoreSlot","MarshalByRefObject","Math","MathF","MemberAccessException","MemoryExtensions","MethodAccessException","MidpointRounding","MissingFieldException","MissingMemberException","MissingMethodException","ModuleHandle","MTAThreadAttribute","MulticastDelegate","MulticastNotSupportedException","NonSerializedAttribute","NotFiniteNumberException","NotImplementedException","NotSupportedException","Nullable","NullReferenceException","Object","ObjectDisposedException","ObsoleteAttribute","OperatingSystem","OperationCanceledException","OrdinalComparer","OutOfMemoryException","OverflowException","ParamArrayAttribute","PlatformID","PlatformNotSupportedException","Random","Range","RankException","ResolveEventArgs","ResolveEventHandler","RuntimeArgumentHandle","RuntimeFieldHandle","RuntimeMethodHandle","RuntimeTypeHandle","SByte","SerializableAttribute","Single","StackOverflowException","STAThreadAttribute","String","StringComparer","StringComparison","StringNormalizationExtensions","StringSplitOptions","SystemException","ThreadStaticAttribute","TimeOnly","TimeoutException","TimeProvider","TimeSpan","TimeZone","TimeZoneInfo","TimeZoneNotFoundException","Tuple","TupleExtensions","Type","TypeAccessException","TypeCode","TypedReference","TypeInitializationException","TypeLoadException","TypeUnloadedException","UInt128","UInt16","UInt32","UInt64","UIntPtr","UnauthorizedAccessException","UnhandledExceptionEventArgs","UnhandledExceptionEventHandler","UnitySerializationHolder","ValueTuple","ValueType","Version","Void","WeakReference","Buffers","Collections","ComponentModel","Diagnostics","Globalization","IO","Linq","Net","Numerics","Reflection","Resources","Runtime","Security","Text","Threading"],"System.Collections.Generic":["ByteEqualityComparer","CollectionExtensions","IEnumerable","KeyNotFoundException","KeyValuePair","NonRandomizedStringEqualityComparer","ReferenceEqualityComparer"],"System.IO":["BinaryReader","BinaryWriter","BufferedStream","Directory","DirectoryInfo","DirectoryNotFoundException","EndOfStreamException","EnumerationOptions","File","FileAccess","FileAttributes","FileInfo","FileLoadException","FileMode","FileNotFoundException","FileOptions","FileShare","FileStream","FileStreamOptions","FileSystemInfo","HandleInheritability","InvalidDataException","IOException","MatchCasing","MatchType","MemoryStream","Path","PathTooLongException","RandomAccess","SearchOption","SeekOrigin","Stream","StreamReader","StreamWriter","StringReader","StringWriter","TextReader","TextWriter","UnixFileMode","UnmanagedMemoryAccessor","UnmanagedMemoryStream","System.IO.Enumeration"],"System.Linq":["Enumerable"],"System.Net.Http":["HttpClient","HttpMethod"],"System.Threading":["AbandonedMutexException","ApartmentState","AsyncFlowControl","AutoResetEvent","CancellationToken","CancellationTokenRegistration","CancellationTokenSource","CompressedStack","ContextCallback","EventResetMode","EventWaitHandle","ExecutionContext","Interlocked","IOCompletionCallback","IThreadPoolWorkItem","ITimer","LazyInitializer","LazyThreadSafetyMode","Lock","LockRecursionException","LockRecursionPolicy","ManualResetEvent","ManualResetEventSlim","Monitor","Mutex","NativeOverlapped","Overlapped","ParameterizedThreadStart","PeriodicTimer","PreAllocatedOverlapped","ReaderWriterLockSlim","RegisteredWaitHandle","Semaphore","SemaphoreFullException","SemaphoreSlim","SendOrPostCallback","SpinLock","SpinWait","SynchronizationContext","SynchronizationLockException","Thread","ThreadAbortException","ThreadExceptionEventArgs","ThreadExceptionEventHandler","ThreadInterruptedException","ThreadPool","ThreadPoolBoundHandle","ThreadPriority","ThreadStart","ThreadStartException","ThreadState","ThreadStateException","Timeout","Timer","TimerCallback","Volatile","WaitCallback","WaitHandle","WaitHandleCannotBeOpenedException","WaitHandleExtensions","WaitOrTimerCallback","Tasks"],"System.Threading.Tasks":["ConcurrentExclusiveSchedulerPair","ConfigureAwaitOptions","Task","TaskAsyncEnumerableExtensions","TaskCanceledException","TaskCompletionSource","TaskContinuationOptions","TaskCreationOptions","TaskExtensions","TaskFactory","TaskScheduler","TaskSchedulerException","TaskStatus","TaskToAsyncResult","UnobservedTaskExceptionEventArgs","ValueTask","Sources"]};var Yy=new Set(["abstract","as","base","bool","break","byte","case","catch","char","checked","class","const","continue","decimal","default","delegate","do","double","else","enum","event","explicit","extern","false","finally","fixed","float","for","foreach","goto","if","implicit","in","int","interface","internal","is","lock","long","namespace","new","null","object","operator","out","override","params","private","protected","public","readonly","ref","return","sbyte","sealed","short","sizeof","stackalloc","static","string","struct","switch","this","throw","true","try","typeof","uint","ulong","unchecked","unsafe","ushort","using","virtual","void","volatile","while"]);var Xy=new Set(["from","where","select","orderby","groupby","into","let","join","on","equals"]),Zy=new Set(["async","await"]),eg=new Set(["yield"]),tg=new Set(["var","dynamic"]),rg=new Set(["using","alias"]);var ig=new Set(["required","scoped","unmanaged","managed"]),ng=new Set(["when","and","or","not"]),sg=new Set(["Equals","GetHashCode","ToString","GetType","MemberwiseClone","Finalize"]),ag=new Set([...Yy,...Xy,...Zy,...eg,...tg,...rg,...ig,...ng]),Eo=class{constructor(t,r,i){y(this,"registry");y(this,"name");y(this,"jsonPath");this.registry=t,this.name=r,this.jsonPath=i}};var Ao=class{constructor(t){y(this,"scope");y(this,"byName",new Map);y(this,"byPath",new Map);y(this,"redirections",new Map);this.scope=t}[Symbol.iterator](){return this.byName.values()}has(t){return this.byName.has(t)}getByJsonPath(t){return this.byPath.get(t)}getByName(t){return this.byName.get(t)}getRedirectedName(t){return this.redirections.get(t)}set(t){this.byName.has(t.name)&&de(`set: ${t.name} in ${this.scope.fullyQualifiedName} already exists`),t.jsonPath&&this.byPath.has(t.jsonPath)&&de(`set: ${t.name} in ${this.scope.fullyQualifiedName} already exists by jsonPath`),this.byName.set(t.name,t),t.jsonPath&&this.byPath.set(t.jsonPath,t)}redirect(t,r){this.redirections.has(t)&&de(`redirect: ${t} in ${this.scope.fullyQualifiedName} already has a redirect`),this.redirections.set(t,r)}},ac=class extends Eo{constructor(r,i,o,p){super(r,i);y(this,"namespace");y(this,"fullyQualifiedName");y(this,"fields");y(this,"methods");this.namespace=o,this.fullyQualifiedName=p,this.fields=new Ao(this),this.methods=new Ao(this)}isKeyword(r){return ag.has(r)}isBuiltinMemberName(r){return sg.has(r)}isTypeName(r){return this.name===r}isField(r){return this.fields.has(r)}isMethod(r){return this.methods.has(r)}isMember(r){return this.isField(r)||this.isMethod(r)}nameBlocked(r){if(this.isKeyword(r))return"keyword";if(this.isBuiltinMemberName(r))return"builtin";if(this.isTypeName(r))return"typeName";if(this.isField(r))return"field";if(this.isMethod(r))return"method"}getAlternativeName(r){let i=`${r}_`,o=2;for(;this.nameBlocked(i);)i=`${r}_${o}`,o++;return i}getFieldByJsonPath(r){return r!==void 0?this.fields.getByJsonPath(r):void 0}getFieldByName(r){return this.fields.getByName(r)}getRedirectedFieldName(r){return this.fields.getRedirectedName(r)}registerField(r,i,o){let p=this.registry.model.jsonPath(i);if(p){let w=this.fields.getByJsonPath(p);if(w)return w.name}let l=this.fields.getByName(r);if(l&&p===l.jsonPath)return r;switch(this.nameBlocked(r)){case"field":i&&v.Provenance(i)&&i.explicit||de(`Field ${r} already exists - attempting to add a duplicate field with the same name that is not an explicitly named property`);break;case"keyword":case"builtin":case"typeName":case"method":break;default:return this.fields.set(new Io(this.registry,r,this,p,o)),this.registry.setFieldNameShortcut(p,r),r}let b=this.getAlternativeName(r);return this.fields.set(new Io(this.registry,b,this,p,o)),this.fields.redirect(r,b),this.registry.setFieldNameShortcut(p,b),b}getFieldName(r,i){let o=this.getFieldByJsonPath(this.registry.model.jsonPath(r))?.name;if(o)return o;if(v.Provenance(r)){let b=this.getRedirectedFieldName(i);if(b)return b;let w=this.getFieldByName(i);return w?this.registry.model.provenance(w.jsonPath)?.explicit?i:`${i}_`:i}let p=this.getFieldByName(i);if(p)return this.registry.model.provenance(p.jsonPath)?.explicit?i:p.name;let l=this.getRedirectedFieldName(i);if(l)return l;this.isMethod(i)}},oc=class extends Eo{constructor(r,i,o,p){super(r,i,p);y(this,"scope");this.scope=o}},Io=class extends oc{constructor(r,i,o,p,l){super(r,i,o,p);y(this,"field");this.field=l}};var Oi=class e{constructor(t){y(this,"generation");y(this,"classReferenceByJsonPath",new Map);y(this,"typeRegistry",new Map);y(this,"namespaceRegistry",new Map);y(this,"typeNames",new Map);y(this,"namespaceNames",new Map);y(this,"nestedTypeShadows",new Map);y(this,"implicitNamespaces",new Set);y(this,"shortcuts",new Map);y(this,"knownBuiltInIdentifiers",new Set(["Text","Json","Xml","Security","Collections","Data","Diagnostics","Globalization","Math","Reflection","Runtime","Security","Serialization","Threading","Xml"]));this.generation=t,this.initializeBuiltIns()}get csharp(){return this.generation.csharp}get model(){return this.generation.model}initializeBuiltIns(){for(let[t,r]of Object.entries(sc))t.split(".").forEach(i=>this.knownBuiltInIdentifiers.add(i)),r.forEach(i=>this.knownBuiltInIdentifiers.add(i));for(let[t,r]of Object.entries(sc)){for(let o of r)this.typeNames.set(o,new Set([t]));let i=t.split(".")[0];i&&this.typeNames.set(i,new Set([t]))}this.typeNames.set("System",new Set(["System"])),this.typeNames.set("NUnit",new Set(["NUnit"])),this.typeNames.set("OneOf",new Set(["OneOf"])),this.knownBuiltInIdentifiers.add("NUnit"),this.knownBuiltInIdentifiers.add("OneOf")}setFieldNameShortcut(t,r){if(t){let i=this.shortcuts.get(t);i&&i!==r&&de(`BAD_BAD_BAD setFieldNameShortcut: ${t} already has a name: ${i} - while setting to ${r} - if this is happening, then you could be getting back the wrong name later!`),this.shortcuts.set(t,r)}}getFieldNameByOrigin(t){return this.shortcuts.get(this.model.jsonPath(t)??">ignore<")}isKnownBuiltInIdentifier(t){return!t||typeof t!="string"?!1:this.knownBuiltInIdentifiers.has(t)}isKnownNamespace(t){return!t||typeof t!="string"?!1:this.namespaceRegistry.has(t)}isRegisteredTypeName(t){return this.typeRegistry.has(t)}isAmbiguousTypeName(t){return t?(this.typeNames.get(t)?.size??0)>1:!1}isAmbiguousNamespaceName(t){return t?(this.namespaceNames.get(t)?.size??0)>1:!1}hasTypeNamespaceConflict(t){return!t||this.knownBuiltInIdentifiers.has(t)?!1:this.typeNames.has(t)&&(this.namespaceNames.get(t)?.has("")??!1)}hasNestedTypeShadowInScope(t,r){if(!t||this.knownBuiltInIdentifiers.has(t))return!1;let i=this.nestedTypeShadows.get(t);return i?r.some(o=>i.has(o)):!1}static fullyQualifiedNameOf(t){return t.enclosingType?`${t.enclosingType.fullyQualifiedName??`${t.namespace}.${t.enclosingType.name}`}+${t.name}`:`${t.namespace}.${t.name}`}registerNamespace(t,r){this.namespaceRegistry.has(t)&&this.namespaceRegistry.get(t)!==r||this.namespaceRegistry.set(t,r)}trackType(t,r){let{name:i,namespace:o,enclosingType:p,fullyQualifiedName:l,origin:b}=t;if(b){let w=this.model.jsonPath(b)??de(`JsonPath not found for origin: ${JSON.stringify(b).substring(0,100)}`);this.classReferenceByJsonPath.set(w,t)}if(r&&r!==l&&!this.typeRegistry.has(r)&&this.typeRegistry.set(r,t),!this.typeRegistry.has(l)){this.typeRegistry.set(l,t);for(let w of this.allNamespacesOf(o))this.registerNamespace(w,w);if(!p)this.trackTypeName(i,o);else if(i===o.split(".")[0]){let w=this.nestedTypeShadows.get(i);w||(w=new Set,this.nestedTypeShadows.set(i,w)),w.add(p.fullyQualifiedName)}for(let w of[this.generation.namespaces.root,...this.implicitNamespaces])if(o.startsWith(w)){let A=o.split(".")[w.split(".").length];A&&this.trackTypeName(A,o)}}return t}addImplicitNamespace(t){this.implicitNamespaces.add(t)}isNamespaceImplicit(t){return this.implicitNamespaces.has(t)}get implicitlyImportedNamespaces(){return[...this.implicitNamespaces]}trackTypeName(t,r){this.typeNames.has(t)?this.typeNames.get(t)?.add(r):this.typeNames.set(t,new Set([r]));let i=r.split("."),o="";for(let p of i)this.namespaceNames.has(p)?this.namespaceNames.get(p)?.add(o):this.namespaceNames.set(p,new Set([o])),o=o?`${o}.${p}`:p}allNamespacesOf(t){if(!t||typeof t!="string")return new Set;let r="",i=new Set;for(let o of t.split("."))o.trim()&&(r=r?`${r}.${o}`:`${o}`,i.add(r));return i}registerClassReference(t,r){let{name:i,namespace:o,enclosingType:p,origin:l}=t,b=this.model.jsonPath(l),w=(b?this.classReferenceByJsonPath.get(b):void 0)??this.typeRegistry.get(r),A=this.model.jsonPath(w?.origin),I=A&&b?A===b?"match":"mismatch":"no origin";if(w&&I!=="mismatch")return new _e({name:w.name,namespace:w.namespace,enclosingType:w.enclosingType,fullyQualifiedName:w.fullyQualifiedName,namespaceAlias:t.namespaceAlias,fullyQualified:t.fullyQualified,generics:t.generics,global:t.global,origin:w.origin??l,isCollection:w.isCollection,isReferenceType:w.isReferenceType,multipartMethodName:w.multipartMethodName,multipartMethodNameForCollection:w.multipartMethodNameForCollection},w.scope,this.generation);let P=!1,L=this.resolveNamespace(o);L!==o&&(o=L,P=!0);let O;e:for(;;){O=e.fullyQualifiedNameOf({name:i,namespace:o,enclosingType:p});let F="",U=o.split(".");for(let M=0;M<U.length;M++)if(F=F?`${F}.${U[M]}`:`${U[M]}`,this.typeRegistry.has(F)){U[M]=`${U[M]}_`,o=U.join("."),P=!0;continue e}if(P&&this.registerNamespace(t.namespace,o),I==="mismatch"&&w?.name===i){i=`${i}_`,P=!0;continue e}if(this.namespaceRegistry.has(O)){i=`${i}_`,P=!0;continue e}if(this.typeRegistry.has(O)){i=`${i}_`,P=!0;continue e}if(p){let M=O.replaceAll("+",".");if(this.typeRegistry.has(M)){i=`${i}_`,P=!0;continue e}if(this.namespaceRegistry.has(M)){i=`${i}_`,P=!0;continue e}}else{let M=O.split(".");for(let W=1;W<M.length;W++){let q=M.slice(0,W).join(".")+"+"+M.slice(W).join("+");if(this.typeRegistry.has(q)){i=`${i}_`,P=!0;continue e}}}break}return this.trackType(new _e({name:i,namespace:o,enclosingType:p,namespaceAlias:t.namespaceAlias,fullyQualified:t.fullyQualified,generics:t.generics,global:t.global,fullyQualifiedName:O,origin:l,isCollection:t.isCollection,isReferenceType:t.isReferenceType,multipartMethodName:t.multipartMethodName,multipartMethodNameForCollection:t.multipartMethodNameForCollection},new ac(this,i,o,O),this.generation),r)}resolveNamespace(t){let r=this.namespaceRegistry.get(t);if(r!==void 0)return r;let i=t.split(".");for(let o=i.length-1;o>=0;o--){let p=i.slice(0,o).join(".");if(this.namespaceRegistry.has(p)){let l=this.namespaceRegistry.get(p);if(l!==void 0){let b=i.slice(o).join("."),w=`${l}.${b}`;return this.registerNamespace(t,w),w}}}return t}canonicalizeNamespace(t){let r=this.namespaceRegistry.get(t);if(r!==void 0)return r;let i=!1,o=t;e:for(;;){let p="",l=o.split(".");for(let b=0;b<l.length;b++)if(p=p?`${p}.${l[b]}`:`${l[b]}`,this.typeRegistry.has(p)){l[b]=`${l[b]}_`,o=l.join("."),i=!0;continue e}break}return i&&this.registerNamespace(t,o),o}};var No=class{constructor(t){y(this,"generation");y(this,"frozen",!1);y(this,"extraClassReferences",new Map);y(this,"InstantiatedPrimitive",{string:t=>new Ne({type:"string",value:t},this.generation),boolean:t=>new Ne({type:"boolean",value:t},this.generation),integer:t=>new Ne({type:"integer",value:t},this.generation),long:t=>new Ne({type:"long",value:t},this.generation),uint:t=>new Ne({type:"uint",value:t},this.generation),ulong:t=>new Ne({type:"ulong",value:t},this.generation),float:t=>new Ne({type:"float",value:t},this.generation),double:t=>new Ne({type:"double",value:t},this.generation),date:t=>new Ne({type:"date",value:t},this.generation),dateTime:(t,r=!0)=>new Ne({type:"dateTime",value:t,parse:r},this.generation),uuid:t=>new Ne({type:"uuid",value:t},this.generation),null:()=>new Ne({type:"null"},this.generation)});y(this,"Literal",{class_:({reference:t,fields:r})=>new Y.Class_(t,r,this.generation),dictionary:({keyType:t,valueType:r,entries:i})=>new Y.Dictionary(t,r,i,this.generation),list:({valueType:t,values:r})=>new Y.List(t,r,this.generation),set:({valueType:t,values:r})=>new Y.Set(t,r,this.generation),boolean:t=>new Y.Boolean(t,this.generation),float:t=>new Y.Float(t,this.generation),date:t=>new Y.Date(t,this.generation),datetime:t=>new Y.DateTime(t,this.generation),decimal:t=>new Y.Decimal(t,this.generation),double:t=>new Y.Double(t,this.generation),integer:t=>new Y.Integer(t,this.generation),long:t=>new Y.Long(t,this.generation),uint:t=>new Y.Uint(t,this.generation),ulong:t=>new Y.Ulong(t,this.generation),reference:t=>new Y.Reference(t,this.generation),string:t=>new Y.String(t,this.generation),null:()=>new Y.Null(this.generation),nop:()=>new Y.Nop(this.generation),unknown:t=>new Y.Unknown(t,this.generation)});y(this,"VALID_READ_ONLY_MEMORY_TYPES",new Set(["int","long","uint","ulong","string","bool","float","double"]));this.generation=t}get model(){return this.generation.model}classReference(t){return this.classReferenceInternal(t)}classReferenceInternal(t){if(!t.name&&"origin"in t&&t.origin&&(t.name=this.model.getClassNameFor(t.origin)),t.enclosingType){if(t.namespace&&t.namespace!==t.enclosingType.namespace)throw new Error("ClassReference: Both enclosingType and namespace cannot be provided");t.namespace=t.enclosingType.namespace}let r=Oi.fullyQualifiedNameOf(t);if(this.frozen&&!this.generation.registry.isRegisteredTypeName(r)){let i=this.extraClassReferences.get(r);i||(i=new Set,this.extraClassReferences.set(r,i)),i.add(`${r} -
|
|
33
|
-
${Ui()}`)}return this.generation.registry.registerClassReference(t,r)}freezeClassReferences(){this.frozen=!0}getPropertyName(t,r){let i=this.model.getPropertyNameFor(r),o=this.model.origin(r);if(o){let p=t.getFieldName(o,i);if(p)return p}return i}class_(t){let r=t;return"reference"in t&&(r={...t.reference,...t}),new nt(r,this.generation)}testClass(t){return new Ni(t,this.generation)}annotation(t){return new gt(t,this.generation)}annotationGroup(t){return new yi(t,this.generation)}instantiateClass(t){return new Zr(t,this.generation)}invokeMethod(t){return new ii(t,this.generation)}codeblock(t){return new Mt(t,this.generation)}code(){return new vt({},this.generation)}anonymousFunction(t){return new gi(t)}parameter(t){return new Ye(t,this.generation)}interface_(t){return new Ii(t,this.generation)}enum_(t){return new Ai(t,this.generation)}dictionary(t){return new ei(t,this.generation)}list(t){return new ri(t,this.generation)}readOnlyMemory(t){return new ni(t,this.generation)}set(t){return new si(t,this.generation)}switch_(t){return new xi(t,this.generation)}ternary(t){return new Si(t,this.generation)}and(t){return new hi(t,this.generation)}or(t){return new bi(t,this.generation)}enumInstantiation(t){return new ti(t,this.generation)}string_(t){return new ai(t,this.generation)}xmlDocBlock(t){return new qt(t,this.generation)}xmlDocBlockOf(t){return t instanceof qt?t:new qt(t,this.generation)}validateReadOnlyMemoryTypes(){for(let t of this.generation.settings.readOnlyMemoryTypes)if(!this.VALID_READ_ONLY_MEMORY_TYPES.has(t))throw new Error(`Type "${t}" is not a valid 'read-only-memory-types' custom config option; expected one of ${JSON.stringify(this.VALID_READ_ONLY_MEMORY_TYPES)}.`)}};n();a();s();function J(e){let t={},r={};for(let[i,o]of Object.entries(e))o.length===0?Object.defineProperty(r,i,{get(){return i in t||(t[i]=o()),t[i]},enumerable:!0,configurable:!0}):r[i]=o;return r}n();a();s();var Ro=class{constructor(t){y(this,"generation");y(this,"System",J({Action:t=>this.csharp.classReference({name:"Action",namespace:"System",generics:t||void 0,multipartMethodName:null,multipartMethodNameForCollection:null,isReferenceType:!0}),Func:(t,r)=>this.csharp.classReference({name:"Func",namespace:"System",generics:t?r?[...t,r]:t:r?[r]:void 0,multipartMethodName:null,multipartMethodNameForCollection:null,isReferenceType:!0}),DateOnly:()=>this.csharp.classReference({name:"DateOnly",namespace:"System"}),DateTime:()=>this.csharp.classReference({name:"DateTime",namespace:"System"}),Enum:()=>this.csharp.classReference({name:"Enum",namespace:"System"}),Exception:()=>this.csharp.classReference({name:"Exception",namespace:"System"}),ReadOnlyMemory:t=>this.csharp.classReference({name:"ReadOnlyMemory",namespace:"System",generics:[t]}),Serializable:()=>this.csharp.classReference({name:"SerializableAttribute",namespace:"System"}),String:()=>this.csharp.classReference({name:"String",namespace:"System"}),Type:()=>this.csharp.classReference({name:"Type",namespace:"System",isReferenceType:!0,multipartMethodName:null,multipartMethodNameForCollection:null,fullyQualified:!0}),TimeSpan:()=>this.csharp.classReference({name:"TimeSpan",namespace:"System"}),Uri:()=>this.csharp.classReference({name:"Uri",namespace:"System"}),UriBuilder:()=>this.csharp.classReference({name:"UriBuilder",namespace:"System"}),Runtime:()=>J({Serialization:()=>J({EnumMember:()=>this.csharp.classReference({name:"EnumMemberAttribute",namespace:"System.Runtime.Serialization"})})}),Collections:()=>J({Generic:()=>J({IAsyncEnumerable:t=>this.csharp.classReference({name:"IAsyncEnumerable",namespace:"System.Collections.Generic",generics:t?[t]:void 0}),IEnumerable:t=>this.csharp.classReference({name:"IEnumerable",namespace:"System.Collections.Generic",generics:t?[t]:void 0}),KeyValuePair:(t,r)=>this.csharp.classReference({name:"KeyValuePair",namespace:"System.Collections.Generic",generics:t&&r?[t,r]:void 0}),List:t=>this.csharp.classReference({name:"List",namespace:"System.Collections.Generic",generics:t?[t]:void 0,isCollection:!0}),HashSet:t=>this.csharp.classReference({name:"HashSet",namespace:"System.Collections.Generic",generics:t?[t]:void 0,isCollection:!0}),Dictionary:(t,r)=>this.csharp.classReference({name:"Dictionary",namespace:"System.Collections.Generic",generics:t&&r?[t,r]:void 0,isCollection:!0}),IDictionary:(t,r)=>this.csharp.classReference({name:"IDictionary",namespace:"System.Collections.Generic",generics:[t,r]})}),Linq:()=>J({Enumerable:()=>this.csharp.classReference({name:"Enumerable",namespace:"System.Linq"})})}),Globalization:()=>J({DateTimeStyles:()=>this.csharp.classReference({name:"DateTimeStyles",namespace:"System.Globalization"})}),Linq:()=>J({Enumerable:()=>this.csharp.classReference({name:"Enumerable",namespace:"System.Linq"})}),Net:()=>J({Http:()=>J({HttpClient:()=>this.csharp.classReference({name:"HttpClient",namespace:"System.Net.Http"}),HttpMethod:()=>this.csharp.classReference({name:"HttpMethod",namespace:"System.Net.Http"}),HttpResponseHeaders:()=>this.csharp.classReference({name:"HttpResponseHeaders",namespace:"System.Net.Http.Headers"})}),ServerSentEvents:()=>J({SseEvent:()=>this.csharp.classReference({name:"SseEvent",namespace:"System.Net.ServerSentEvents"}),SseParser:()=>this.csharp.classReference({name:"SseParser",namespace:"System.Net.ServerSentEvents"})}),WebSockets:()=>J({ClientWebSocketOptions:()=>this.csharp.classReference({name:"ClientWebSocketOptions",namespace:"System.Net.WebSockets"})})}),IO:()=>J({MemoryStream:()=>this.csharp.classReference({name:"MemoryStream",namespace:"System.IO"}),Stream:()=>this.csharp.classReference({name:"Stream",namespace:"System.IO"}),StreamReader:()=>this.csharp.classReference({name:"StreamReader",namespace:"System.IO"})}),Text:()=>J({Encoding:()=>this.csharp.classReference({name:"Encoding",namespace:"System.Text"}),Encoding_UTF8:()=>this.csharp.classReference({name:"UTF8",enclosingType:this.csharp.classReference({name:"Encoding",namespace:"System.Text"})}),Json:()=>J({JsonElement:()=>this.csharp.classReference({name:"JsonElement",namespace:"System.Text.Json"}),JsonDocument:()=>this.csharp.classReference({name:"JsonDocument",namespace:"System.Text.Json"}),JsonException:()=>this.csharp.classReference({name:"JsonException",namespace:"System.Text.Json"}),Utf8JsonReader:()=>this.csharp.classReference({name:"Utf8JsonReader",namespace:"System.Text.Json"}),JsonSerializerOptions:()=>this.csharp.classReference({name:"JsonSerializerOptions",namespace:"System.Text.Json"}),JsonSerializer:()=>this.csharp.classReference({name:"JsonSerializer",namespace:"System.Text.Json"}),Utf8JsonWriter:()=>this.csharp.classReference({name:"Utf8JsonWriter",namespace:"System.Text.Json"}),Nodes:()=>J({JsonNode:()=>this.csharp.classReference({name:"JsonNode",namespace:"System.Text.Json.Nodes"}),JsonObject:()=>this.csharp.classReference({name:"JsonObject",namespace:"System.Text.Json.Nodes"})}),Serialization:()=>J({IJsonOnDeserialized:()=>this.csharp.classReference({name:"IJsonOnDeserialized",namespace:"System.Text.Json.Serialization"}),IJsonOnSerializing:()=>this.csharp.classReference({name:"IJsonOnSerializing",namespace:"System.Text.Json.Serialization"}),JsonOnDeserializedAttribute:()=>this.csharp.classReference({name:"JsonOnDeserializedAttribute",namespace:"System.Text.Json.Serialization"}),JsonExtensionData:()=>this.csharp.classReference({name:"JsonExtensionDataAttribute",namespace:"System.Text.Json.Serialization"}),JsonConverter:t=>this.csharp.classReference({name:"JsonConverter",namespace:"System.Text.Json.Serialization",generics:t?[t]:void 0}),JsonIgnore:()=>this.csharp.classReference({name:"JsonIgnoreAttribute",namespace:"System.Text.Json.Serialization"}),JsonPropertyName:()=>this.csharp.classReference({name:"JsonPropertyNameAttribute",namespace:"System.Text.Json.Serialization"})})})}),Threading:()=>J({CancellationToken:()=>this.csharp.classReference({name:"CancellationToken",namespace:"System.Threading"}),Tasks:()=>J({Task:t=>this.csharp.classReference({name:"Task",namespace:"System.Threading.Tasks",generics:t?[t]:void 0}),ValueTask:t=>this.csharp.classReference({name:"ValueTask",namespace:"System.Threading.Tasks",generics:t?[t]:void 0})})}),ComponentModel:()=>J({INotifyPropertyChanged:()=>this.csharp.classReference({name:"INotifyPropertyChanged",namespace:"System.ComponentModel"}),PropertyChangedEventHandler:()=>this.csharp.classReference({name:"PropertyChangedEventHandler",namespace:"System.ComponentModel"})}),IAsyncDisposable:()=>this.csharp.classReference({name:"IAsyncDisposable",namespace:"System"}),IDisposable:()=>this.csharp.classReference({name:"IDisposable",namespace:"System"})}));y(this,"NUnit",J({Framework:()=>J({TestFixture:()=>this.csharp.classReference({name:"TestFixture",namespace:"NUnit.Framework"}),Test:()=>this.csharp.classReference({name:"Test",namespace:"NUnit.Framework"}),OneTimeTearDown:()=>this.csharp.classReference({name:"OneTimeTearDown",namespace:"NUnit.Framework"}),OneTimeSetUp:()=>this.csharp.classReference({name:"OneTimeSetUp",namespace:"NUnit.Framework"}),SetUpFixture:()=>this.csharp.classReference({name:"SetUpFixture",namespace:"NUnit.Framework"}),Parallelizable:()=>this.csharp.classReference({name:"Parallelizable",namespace:"NUnit.Framework"})})}));y(this,"OneOf",J({OneOf:t=>this.csharp.classReference({name:"OneOf",namespace:"OneOf",generics:t}),OneOfBase:t=>this.csharp.classReference({name:"OneOfBase",namespace:"OneOf",generics:t})}));y(this,"Google",J({Protobuf:()=>J({ByteString:()=>this.csharp.classReference({name:"ByteString",namespace:"Google.Protobuf"}),WellKnownTypes:()=>J({Struct:()=>this.csharp.classReference({name:"Struct",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"}),Value:()=>this.csharp.classReference({name:"Value",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"}),ListValue:()=>this.csharp.classReference({name:"ListValue",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"}),Timestamp:()=>this.csharp.classReference({name:"Timestamp",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"})})})}));y(this,"WireMock",J({Server:()=>this.csharp.classReference({name:"WireMockServer",namespace:"WireMock.Server"}),WireMockServerSettings:()=>this.csharp.classReference({name:"WireMockServerSettings",namespace:"WireMock.Settings"}),WireMockConsoleLogger:()=>this.csharp.classReference({name:"WireMockConsoleLogger",namespace:"WireMock.Logging"})}));y(this,"Grpc",J({Core:()=>J({RpcException:()=>this.csharp.classReference({name:"RpcException",namespace:"Grpc.Core"})})}));this.generation=t}get csharp(){return this.generation.csharp}};n();a();s();var uc=new Set(["name","camelCase","snakeCase","screamingSnakeCase","pascalCase"]);function og(e,t){return uc.has(t)?e??"":e?`${e}.${t}`:t}var Oo=class{constructor(t,r){y(this,"generation");y(this,"indexByObject",new Map);y(this,"indexByPath",new Map);y(this,"explicitByObject",new Map);y(this,"explicitByPath",new Map);y(this,"root");y(this,"ir");this.generation=r,this.root=this.createIndex(t),this.ir=t}get csharp(){return this.generation.csharp}get registry(){return this.generation.registry}createIndex(t,r="",i){let o=og(i?.jsonPath,r);if(this.indexByPath.has(o)){i||de(`Parent provenance not found for node: ${JSON.stringify(t).substring(0,100)}`),this.indexByObject.set(t,i);let l=uc.has(r);for(let[b,w]of Object.entries(t))typeof w=="object"&&w!==null&&(l&&uc.has(b)?this.indexByObject.set(w,i):this.createIndex(w,b,i));return i}let p={jsonPath:o,name:r,node:t,parent:i};this.indexByObject.set(t,p),this.indexByPath.set(o,p);for(let[l,b]of Object.entries(t))typeof b=="object"&&b!==null&&this.createIndex(b,l,p);return p}staticExplicit(t){return this.explicit(this.ir,t)}explicit(t,r){let i=this.provenance(t)??de(`Provenance not found for node: ${JSON.stringify(t).substring(0,100)}`),o={...i,jsonPath:`${i.jsonPath}+${r}`,name:r,node:i.node,parent:i,explicit:!0},p=this.explicitByObject.get(i.node);return p?p.add(o):this.explicitByObject.set(i.node,new Set([o])),this.explicitByPath.set(o.jsonPath,o),o}provenance(t){if(t!==void 0)return v.string(t)?this.explicitByPath.get(t)??this.indexByPath.get(t):v.Provenance(t)?this.explicitByPath.get(t.jsonPath)??this.indexByPath.get(t.jsonPath):this.indexByObject.get(t)}origin(t){let r=this.provenance(t);return r?.explicit?r:r?.node}irNode(t){return this.provenance(t)?.node}jsonPath(t){return this.provenance(t)?.jsonPath}getEnumValueName(t,r){let i=v.IR.ExampleEnumType(r)?r.value:r,o=t.values.find(p=>this.nameEquals(p.name,i));return o?this.getPropertyNameFor(o):de(`Unexpected - can't find enum value ${JSON.stringify(i)} in enum`)}getPropertyNameFor(t){let r=this.registry.getFieldNameByOrigin(t);if(r)return r;if(v.Provenance(t))return t.name;if("name"in t){if(v.IR.NameAndWireValue(t.name))return this.generation.case.pascalSafe(t.name);if(v.IR.Name(t.name))return this.generation.case.pascalSafe(t.name);if(typeof t.name=="string")return this.generation.case.pascalSafe(t.name)}if("pascalCase"in t)return this.generation.case.pascalSafe(t);throw new Error(`Unknown property type: ${this.jsonPath(t)}`)}getClassNameFor(t){if(v.Provenance(t))return t.name;if("name"in t){if(v.IR.TypeDeclaration(t))return this.generation.case.pascalSafe(t.name.name);if(v.IR.NameAndWireValue(t.name))return this.generation.case.pascalSafe(t.name);if(v.IR.Name(t.name))return this.generation.case.pascalSafe(t.name);if(typeof t.name=="string")return this.generation.case.pascalSafe(t.name)}if("pascalCase"in t)return this.generation.case.pascalSafe(t);throw new Error(`Unknown property type: ${JSON.stringify(t)}`)}nameEquals(t,r){return this.generation.case.camelSafe(t)===this.generation.case.camelSafe(r)}dereferenceType(t){let r=v.string(t)?t:v.IR.NamedType(t)||v.IR.DeclaredTypeName(t)?t.typeId:v.IR.ExampleNamedType(t)?t.typeName.typeId:t.name.typeId,i=this.irNode(this.ir.types[r]);if(v.IR.TypeDeclaration(i))return{typeId:r,typeDeclaration:i};de(`dereferenceType: typeId ${r} not resolved.`)}};function Po(...e){return e.filter(Boolean).join("/")}var jn=class{constructor(t,r,i,o,p={makeRelativeFilePath:l=>l,makeAbsoluteFilePath:l=>l,getNamespaceForTypeId:l=>"",getDirectoryForTypeId:l=>"",getCoreAsIsFiles:()=>[],getCoreTestAsIsFiles:()=>[],getPublicCoreAsIsFiles:()=>[],getAsyncCoreAsIsFiles:()=>[],getChildNamespaceSegments:l=>[]}){y(this,"intermediateRepresentation");y(this,"apiName");y(this,"customConfig");y(this,"generatorConfig");y(this,"support");y(this,"ir");y(this,"dir");y(this,"csharp",new No(this));y(this,"registry",new Oi(this));y(this,"model");y(this,"case");y(this,"extern",new Ro(this));y(this,"settings",J({namespace:()=>this.customConfig.namespace??mo(ho(`${this.generatorConfig.organization}_${this.apiName}`)),readOnlyMemoryTypes:()=>this.customConfig["read-only-memory-types"]??[],simplifyObjectDictionaries:()=>this.customConfig["simplify-object-dictionaries"]??!1,useFullyQualifiedNamespaces:()=>this.customConfig["experimental-fully-qualified-namespaces"]??!1,useDotnetFormat:()=>this.customConfig["experimental-dotnet-format"]??!1,enableWebsockets:()=>this.customConfig["experimental-enable-websockets"]??!1,enableReadonlyConstants:()=>this.customConfig["experimental-readonly-constants"]??!1,generateLiterals:()=>this.customConfig["generate-literals"]??this.customConfig["experimental-readonly-constants"]??!1,enableExplicitNullableOptional:()=>this.customConfig["experimental-explicit-nullable-optional"]??!1,useDefaultRequestParameterValues:()=>this.customConfig["use-default-request-parameter-values"]??!1,redactResponseBodyOnError:()=>this.customConfig["redact-response-body-on-error"]??!1,enableInlineTypes:()=>this.customConfig["enable-inline-types"]??!1,temporaryWebsocketEnvironments:()=>this.customConfig["temporary-websocket-environments"]??{},baseApiExceptionClassName:()=>this.customConfig["base-api-exception-class-name"]??"",baseExceptionClassName:()=>this.customConfig["base-exception-class-name"]??"",shouldGeneratedDiscriminatedUnions:()=>this.customConfig["use-discriminated-unions"]??!0,shouldGenerateUndiscriminatedUnions:()=>this.customConfig["use-undiscriminated-unions"]??!1,dedupeUnionBaseProperties:()=>this.customConfig["dedupe-union-base-properties"]??!1,exportedClientClassName:()=>this.customConfig["exported-client-class-name"]??"",clientClassName:()=>this.customConfig["client-class-name"]??"",rootNamespaceForCoreClasses:()=>this.customConfig["root-namespace-for-core-classes"]??!0,packageId:()=>this.customConfig["package-id"]??"",isForwardCompatibleEnumsEnabled:()=>this.customConfig["enable-forward-compatible-enums"]??this.customConfig["experimental-enable-forward-compatible-enums"]??!0,websocketEnvironments:()=>this.customConfig["temporary-websocket-environments"]??{},customPagerName:()=>this.customConfig["custom-pager-name"]??"",usePageIndexSemantics:()=>this.customConfig["offset-semantics"]==="page-index",environmentClassName:()=>this.customConfig["environment-class-name"]??"",generateErrorTypes:()=>this.customConfig["generate-error-types"]??!0,shouldInlinePathParameters:()=>this.customConfig["inline-path-parameters"]??!0,includeExceptionHandler:()=>this.customConfig["include-exception-handler"]??!1,exceptionInterceptorClassName:()=>this.customConfig["exception-interceptor-class-name"]??"",shouldGenerateMockServerTests:()=>this.customConfig["generate-mock-server-tests"]??this.customConfig["enable-wire-tests"]??!0,rootClientAccess:()=>this.customConfig["root-client-class-access"]=="internal"?ge.Internal:ge.Public,extraDependencies:()=>this.customConfig["extra-dependencies"]??{},omitFernHeaders:()=>this.customConfig["omit-fern-headers"]??!1,includePlatformHeaders:()=>this.customConfig["include-platform-headers"]??!1,allowUserAgentAppInfo:()=>this.customConfig["allow-user-agent-app-info"]??!1,userAgentNameFromPackage:()=>this.customConfig["user-agent-name-from-package"]??!1,unifiedClientOptions:()=>this.customConfig["unified-client-options"]??!1,serverUrlVariables:()=>this.customConfig["server-url-variables"]??!0,pascalCaseEnvironments:()=>this.customConfig["pascal-case-environments"]??!0,slnFormat:()=>this.customConfig["sln-format"]??"slnx",explicitNamespaces:()=>this.customConfig["explicit-namespaces"]===!0,maxRetries:()=>this.customConfig.maxRetries,retryStatusCodes:()=>this.customConfig.retryStatusCodes??"legacy",defaultTimeoutInMilliseconds:()=>{let t=this.customConfig["default-timeout-in-milliseconds"];if(t!=null)return t;let r=this.customConfig["default-timeout-in-seconds"];if(r!=null)return r==="infinity"?"infinity":r*1e3},outputPath:()=>{let t=this.customConfig["output-path"];return t==null?{library:"src",test:"src",solution:".",other:"."}:typeof t=="string"?{library:t,test:t,solution:".",other:"."}:{library:t.library??"src",test:t.test??"src",solution:t.solution??".",other:t.other??"."}}}));y(this,"constants",{folders:J({mockServerTests:()=>this.support.makeRelativeFilePath("Unit/MockServer"),types:()=>"Types",exceptions:()=>"Exceptions",src:()=>"src",protobuf:()=>"proto",serializationTests:()=>this.support.makeRelativeFilePath("Unit/Serialization"),project:()=>this.support.makeRelativeFilePath(Po(this.constants.folders.sourceFiles,this.support.makeRelativeFilePath(this.names.files.project))),sourceFiles:()=>this.support.makeRelativeFilePath(this.constants.folders.src),coreFiles:()=>this.support.makeRelativeFilePath(Po(this.constants.folders.project,this.support.makeRelativeFilePath(this.constants.defaults.core))),publicCoreFiles:()=>this.support.makeRelativeFilePath(Po(this.constants.folders.project,this.support.makeRelativeFilePath(this.constants.defaults.core),this.support.makeRelativeFilePath(this.constants.defaults.publicCore))),testFiles:()=>this.support.makeRelativeFilePath(Po(this.constants.folders.sourceFiles,this.support.makeRelativeFilePath(this.names.files.testProject)))}),formatting:J({indent:()=>" "}),defaults:J({core:()=>"Core",publicCore:()=>"Public",version:()=>"0.0.0"})});y(this,"namespaces",J({root:()=>this.settings.namespace,core:()=>`${this.namespaces.root}.Core`,qualifiedRoot:()=>this.qualifyNamespace(this.namespaces.root),qualifiedCore:()=>this.qualifyNamespace(this.namespaces.core),test:()=>this.registry.canonicalizeNamespace(`${this.namespaces.root}.Test`),testUtils:()=>`${this.namespaces.test}.Utils`,mockServerTest:()=>`${this.namespaces.test}.Unit.MockServer`,publicCore:()=>this.namespaces.root,webSocketsCore:()=>`${this.namespaces.core}.WebSockets`,publicCoreTest:()=>`${this.namespaces.root}.Test.PublicCore`,asIsTestUtils:()=>`${this.namespaces.root}.Test.Utils`,publicCoreClasses:()=>this.settings.rootNamespaceForCoreClasses?this.namespaces.root:this.namespaces.core,implicit:()=>new Set(["System","System.Collections.Generic","System.IO","System.Linq","System.Threading","System.Threading.Tasks","System.Net.Http"])}));y(this,"names",{classes:J({baseApiException:()=>this.settings.baseApiExceptionClassName||`${this.names.project.clientPrefix}ApiException`,baseException:()=>this.settings.baseExceptionClassName||`${this.names.project.clientPrefix}Exception`,rootClient:()=>this.settings.clientClassName||`${this.names.project.clientPrefix}Client`,rootClientForSnippets:()=>this.settings.exportedClientClassName||this.names.classes.rootClient,customPager:()=>this.settings.customPagerName||`${this.names.project.packageId.replace(/[^a-zA-Z0-9]/g,"")}Pager`,environment:()=>this.settings.environmentClassName||`${this.names.project.clientPrefix}Environment`,exceptionInterceptor:()=>this.settings.exceptionInterceptorClassName||`${this.names.project.packageId.replace(/[^a-zA-Z0-9]/g,"")}ExceptionInterceptor`}),project:J({client:()=>mo(ho(`${this.generatorConfig.organization}_${this.generatorConfig.workspaceName}`)),clientPrefix:()=>this.settings.exportedClientClassName||this.settings.clientClassName||this.names.project.client,packageId:()=>this.settings.packageId||ud(this.ir)?.packageName||this.namespaces.root}),files:J({project:()=>this.namespaces.root,testProject:()=>`${this.namespaces.root}.Test`}),methods:J({mockOauth:()=>"MockOAuthEndpoint",mockInferredAuth:()=>"MockInferredAuthEndpoint",getAccessTokenAsync:()=>"GetAccessTokenAsync",getAuthHeadersAsync:()=>"GetAuthHeadersAsync"}),variables:J({client:()=>"client",response:()=>"response",httpRequest:()=>"httpRequest",sendRequest:()=>"sendRequest",responseBody:()=>"responseBody",query:()=>"_query",headers:()=>"_headers"}),parameters:J({cancellationToken:()=>"cancellationToken",requestOptions:()=>"options",idempotentOptions:()=>"options"})});y(this,"Types",J({Arbitrary:t=>new re.ArbitraryType(t,this),HttpMethodExtensions:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("HttpMethodExtensions")}),FormRequest:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("FormRequest")}),Optional:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("Optional")}),ClientOptions:()=>this.csharp.classReference({origin:this.model.staticExplicit("ClientOptions"),namespace:this.namespaces.publicCoreClasses}),AppInfo:()=>this.csharp.classReference({origin:this.model.staticExplicit("AppInfo"),namespace:this.namespaces.publicCoreClasses}),RawClient:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("RawClient")}),RequestOptions:()=>this.csharp.classReference({namespace:this.namespaces.publicCoreClasses,origin:this.model.staticExplicit("RequestOptions")}),RequestOptionsInterface:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("IRequestOptions")}),JsonRequest:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("JsonRequest")}),Version:()=>this.csharp.classReference({namespace:this.namespaces.publicCore,origin:this.model.staticExplicit("Version")}),ValueConvert:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("ValueConvert")}),FileParameter:()=>this.csharp.classReference({namespace:this.namespaces.publicCore,origin:this.model.staticExplicit("FileParameter"),multipartMethodName:"AddFileParameterPart",multipartMethodNameForCollection:"AddFileParameterParts",isReferenceType:!0}),DefaultHttpClientFactory:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("DefaultHttpClientFactory")}),Headers:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("Headers")}),HeaderValue:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("HeaderValue")}),RootClient:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.rootClient),namespace:this.namespaces.root}),RootClientForSnippets:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.rootClientForSnippets),namespace:this.namespaces.root}),BaseApiException:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.baseApiException),namespace:this.namespaces.publicCoreClasses}),BaseException:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.baseException),namespace:this.namespaces.publicCoreClasses}),ExceptionInterceptor:()=>this.csharp.classReference({origin:this.model.staticExplicit("IExceptionInterceptor"),namespace:this.namespaces.core}),ExceptionHandler:()=>this.csharp.classReference({origin:this.model.staticExplicit("ExceptionHandler"),namespace:this.namespaces.core}),CustomExceptionInterceptor:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.exceptionInterceptor),namespace:this.namespaces.core}),ProtoAnyMapper:()=>this.csharp.classReference({origin:this.model.staticExplicit("ProtoAnyMapper"),namespace:this.namespaces.core}),Constants:()=>this.csharp.classReference({origin:this.model.staticExplicit("Constants"),namespace:this.namespaces.core}),DateTimeSerializer:()=>this.csharp.classReference({origin:this.model.staticExplicit("DateTimeSerializer"),namespace:this.namespaces.core}),JsonUtils:()=>this.csharp.classReference({origin:this.model.staticExplicit("JsonUtils"),namespace:this.namespaces.core}),JsonAssert:()=>this.csharp.classReference({origin:this.model.staticExplicit("JsonAssert"),namespace:this.namespaces.testUtils}),CustomPagerFactory:()=>this.csharp.classReference({origin:this.model.staticExplicit(`${this.names.classes.customPager}Factory`),namespace:this.namespaces.core}),CustomPagerContext:()=>this.csharp.classReference({origin:this.model.staticExplicit(`${this.names.classes.customPager}Context`),namespace:this.namespaces.core}),Environments:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.environment),namespace:this.namespaces.publicCoreClasses}),TestClient:()=>this.csharp.classReference({origin:this.model.staticExplicit("TestClient"),namespace:this.namespaces.test}),BaseMockServerTest:()=>this.csharp.classReference({origin:this.model.staticExplicit("BaseMockServerTest"),namespace:this.namespaces.mockServerTest}),IdempotentRequestOptions:()=>this.csharp.classReference({origin:this.model.staticExplicit("IdempotentRequestOptions"),namespace:this.namespaces.publicCoreClasses}),IdempotentRequestOptionsInterface:()=>this.csharp.classReference({origin:this.model.staticExplicit("IIdempotentRequestOptions"),namespace:this.namespaces.core}),IStringEnum:()=>this.csharp.classReference({origin:this.model.staticExplicit("IStringEnum"),namespace:this.namespaces.core}),WebSocketClient:()=>this.csharp.classReference({origin:this.model.staticExplicit("WebSocketClient"),namespace:this.namespaces.webSocketsCore}),QueryBuilder:()=>this.csharp.classReference({origin:this.model.staticExplicit("Query"),namespace:this.namespaces.webSocketsCore}),QueryStringBuilder:()=>this.csharp.classReference({origin:this.model.staticExplicit("QueryStringBuilder"),namespace:this.namespaces.core}),QueryStringBuilderBuilder:()=>this.csharp.classReference({origin:this.model.staticExplicit("QueryStringBuilder.Builder"),namespace:this.namespaces.core}),OAuthTokenProvider:()=>this.csharp.classReference({origin:this.model.staticExplicit("OAuthTokenProvider"),namespace:this.namespaces.core}),InferredAuthTokenProvider:()=>this.csharp.classReference({origin:this.model.staticExplicit("InferredAuthTokenProvider"),namespace:this.namespaces.core}),ProtoConverter:()=>this.csharp.classReference({origin:this.model.staticExplicit("ProtoConverter"),namespace:this.namespaces.core}),RawGrpcClient:()=>this.csharp.classReference({origin:this.model.staticExplicit("RawGrpcClient"),namespace:this.namespaces.core}),Extensions:()=>this.csharp.classReference({origin:this.model.staticExplicit("Extensions"),namespace:this.namespaces.core}),GrpcRequestOptions:()=>this.csharp.classReference({origin:this.model.staticExplicit("GrpcRequestOptions"),namespace:this.namespaces.root}),GrpcChannelOptions:()=>this.csharp.classReference({origin:this.model.staticExplicit("GrpcChannelOptions"),namespace:"Grpc.Net.Client"}),StringEnum:t=>this.csharp.classReference({origin:this.model.staticExplicit("StringEnum"),namespace:this.namespaces.core,generics:t?[t]:void 0}),WebSocketEvent:t=>this.csharp.classReference({origin:this.model.staticExplicit("Event"),namespace:this.namespaces.webSocketsCore,generics:[t]}),ConnectionStatus:()=>this.csharp.classReference({origin:this.model.staticExplicit("ConnectionStatus"),namespace:this.namespaces.webSocketsCore}),WebSocketConnected:()=>this.csharp.classReference({origin:this.model.staticExplicit("Connected"),namespace:this.namespaces.webSocketsCore}),WebSocketClosed:()=>this.csharp.classReference({origin:this.model.staticExplicit("Closed"),namespace:this.namespaces.webSocketsCore}),ReconnectionInfo:()=>this.csharp.classReference({origin:this.model.staticExplicit("ReconnectionInfo"),namespace:this.namespaces.webSocketsCore}),CustomPagerClass:t=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.customPager),namespace:this.namespaces.core,generics:[t]}),Pager:t=>this.csharp.classReference({origin:this.model.staticExplicit("Pager"),namespace:this.namespaces.core,generics:[t]}),OffsetPager:({requestType:t,requestOptionsType:r,responseType:i,offsetType:o,stepType:p,itemType:l})=>this.csharp.classReference({origin:this.model.staticExplicit("OffsetPager"),namespace:this.namespaces.core,generics:[t,r,i,o,p,l]}),CursorPager:({requestType:t,requestOptionsType:r,responseType:i,cursorType:o,itemType:p})=>this.csharp.classReference({origin:this.model.staticExplicit("CursorPager"),namespace:this.namespaces.core,generics:[t,r,i,o,p]}),CollectionItemSerializer:(t,r)=>this.csharp.classReference({origin:this.model.staticExplicit("CollectionItemSerializer"),namespace:this.namespaces.core,generics:[t,r]}),OneOfSerializer:t=>this.csharp.classReference({origin:this.model.staticExplicit("OneOfSerializer"),namespace:this.namespaces.core,generics:[t]}),AdditionalProperties:t=>this.csharp.classReference({origin:this.model.staticExplicit("AdditionalProperties"),namespace:this.namespaces.publicCore,generics:t?[t]:void 0}),ReadOnlyAdditionalProperties:t=>this.csharp.classReference({origin:this.model.staticExplicit("ReadOnlyAdditionalProperties"),namespace:this.namespaces.publicCore,generics:t?[t]:void 0})}));y(this,"Primitive",J({string:()=>new re.String(this),boolean:()=>new re.Boolean(this),integer:()=>new re.Integer(this),long:()=>new re.Long(this),uint:()=>new re.Uint(this),ulong:()=>new re.ULong(this),float:()=>new re.Float(this),double:()=>new re.Double(this),object:()=>new re.Object(this)}));y(this,"Value",J({binary:()=>new Ue.Binary(this),dateOnly:()=>new Ue.DateOnly(this),dateTime:()=>new Ue.DateTime(this),uuid:()=>new Ue.Uuid(this),stringEnum:t=>new Ue.StringEnum(t,this)}));y(this,"Collection",J({array:t=>new we.Array(t,this),listType:t=>new we.ListType(t,this),list:t=>new we.List(t,this),set:t=>new we.Set(t,this),map:(t,r,i)=>new we.Map(t,r,this,i),idictionary:(t,r,i)=>new we.IDictionary(t,r,this,i),keyValuePair:(t,r)=>new we.KeyValuePair(t,r,this)}));y(this,"format",J({private:t=>`_${yo.camelCase(t)}`}));y(this,"initializers",J({implicitNamespaces:()=>{for(let t of this.namespaces.implicit)this.registry.addImplicitNamespace(t);return!0}}));this.intermediateRepresentation=t,this.apiName=r,this.customConfig=i,this.generatorConfig=o,this.support=p;let l=v.IR.IntermediateRepresentation(t)?t.casingsConfig:void 0;this.case=new Hi({generationLanguage:"csharp",keywords:l?.keywords,smartCasing:l?.smartCasing??!0}),this.model=new Oo(t,this),this.ir=v.IR.IntermediateRepresentation(t)?t:{},this.dir=v.DynamicIR.DynamicIntermediateRepresentation(t)?t:{}}initialize(){return this.initializers.implicitNamespaces}get System(){return this.extern.System}get NUnit(){return this.extern.NUnit}get OneOf(){return this.extern.OneOf}get Google(){return this.extern.Google}get Grpc(){return this.extern.Grpc}get WireMock(){return this.extern.WireMock}qualifyNamespace(t){let r=t.split(".")[0];return r&&this.registry.hasTypeNamespaceConflict(r)?`global::${t}`:t}};n();a();s();var Ze=class{constructor(t){y(this,"generation");this.generation=t}get csharp(){return this.generation.csharp}get case(){return this.generation.case}get settings(){return this.generation.settings}get constants(){return this.generation.constants}get namespaces(){return this.generation.namespaces}get names(){return this.generation.names}get model(){return this.generation.model}get format(){return this.generation.format}get registry(){return this.generation.registry}get Types(){return this.generation.Types}get System(){return this.generation.extern.System}get NUnit(){return this.generation.extern.NUnit}get OneOf(){return this.generation.extern.OneOf}get Google(){return this.generation.extern.Google}get Grpc(){return this.generation.extern.Grpc}get WireMock(){return this.generation.extern.WireMock}get Primitive(){return this.generation.Primitive}get Value(){return this.generation.Value}get Collection(){return this.generation.Collection}};n();a();s();var Co=class extends Ze{constructor({context:r}){super(r.generation);y(this,"context");this.context=r}convert(r){if(r.value===null)return this.context.isNullable(r.typeReference)?this.csharp.Literal.null():(this.context.errors.add({severity:te.Critical,message:"Expected non-null value, but got null"}),this.csharp.Literal.nop());if(r.value===void 0&&!r.fallbackToDefault)return this.csharp.Literal.nop();switch(r.typeReference.type){case"list":return this.convertList({list:r.typeReference.value,value:r.value,fallbackToDefault:r.fallbackToDefault});case"literal":return this.convertLiteral({literal:r.typeReference.value,fallbackToDefault:r.forceLiteral?r.fallbackToDefault:void 0,value:r.value,forceLiteral:r.forceLiteral});case"map":return this.convertMap({map:r.typeReference,value:r.value,fallbackToDefault:r.fallbackToDefault});case"named":{let i=this.context.resolveNamedType({typeId:r.typeReference.value});return i==null?this.csharp.Literal.nop():this.convertNamed({named:i,value:r.value,as:r.as,fallbackToDefault:r.fallbackToDefault})}case"nullable":return this.convert({typeReference:r.typeReference.value,value:r.value,as:r.as,forceLiteral:r.forceLiteral});case"optional":return this.convert({typeReference:r.typeReference.value,value:r.value,as:r.as,forceLiteral:r.forceLiteral});case"primitive":return this.convertPrimitive({primitive:r.typeReference.value,value:r.value,as:r.as,fallbackToDefault:r.fallbackToDefault});case"set":return this.convertSet({set:r.typeReference.value,value:r.value,fallbackToDefault:r.fallbackToDefault});case"unknown":return this.convertUnknown({value:r.value,fallbackToDefault:r.fallbackToDefault});default:ue(r.typeReference)}}convertList({list:r,value:i,fallbackToDefault:o}){return Array.isArray(i)?this.csharp.Literal.list({valueType:this.context.dynamicTypeMapper.convert({typeReference:r,unboxOptionals:!0}),values:i.map((p,l)=>{this.context.errors.scope({index:l});try{return this.convert({typeReference:r,value:p})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:te.Critical,message:`Expected array but got: ${typeof i}`}),this.csharp.Literal.nop())}convertLiteral({literal:r,value:i,fallbackToDefault:o,forceLiteral:p}){if(this.settings.generateLiterals&&!p)return this.csharp.Literal.nop();switch(r.type){case"boolean":{let l=this.context.getValueAsBoolean({value:i});return l==null?this.csharp.Literal.nop():this.csharp.Literal.boolean(l)}case"string":{let l=this.context.getValueAsString({value:i});return l==null?o?this.Primitive.string.getDeterminsticDefault(o):this.csharp.Literal.nop():this.csharp.Literal.string(l)}default:ue(r)}}convertSet({set:r,value:i,fallbackToDefault:o}){return Array.isArray(i)?this.csharp.Literal.set({valueType:this.context.dynamicTypeMapper.convert({typeReference:r,unboxOptionals:!0}),values:i.map((p,l)=>{this.context.errors.scope({index:l});try{return this.convert({typeReference:r,value:p})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:te.Critical,message:`Expected array but got: ${typeof i}`}),this.csharp.Literal.nop())}convertMap({map:r,value:i,fallbackToDefault:o}){return typeof i!="object"||i==null?(this.context.errors.add({severity:te.Critical,message:`Expected object but got: ${i==null?"null":typeof i}`}),this.csharp.Literal.nop()):this.csharp.Literal.dictionary({keyType:this.context.dynamicTypeMapper.convert({typeReference:r.key}),valueType:r.value.type==="unknown"?this.context.dynamicTypeMapper.convert({typeReference:r.value}).asOptional():this.context.dynamicTypeMapper.convert({typeReference:r.value}),entries:Object.entries(i).map(([p,l])=>{this.context.errors.scope(p);try{return{key:this.convert({typeReference:r.key,value:p,as:"key"}),value:this.convert({typeReference:r.value,value:l})}}finally{this.context.errors.unscope()}})})}convertNamed({named:r,value:i,as:o,fallbackToDefault:p}){switch(r.type){case"alias":return this.settings.generateLiterals&&r.typeReference.type==="literal"?this.csharp.Literal.reference(this.csharp.instantiateClass({classReference:this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),arguments_:[]})):this.convert({typeReference:r.typeReference,value:i,as:o,fallbackToDefault:p});case"discriminatedUnion":return this.settings.shouldGeneratedDiscriminatedUnions?this.convertDiscriminatedUnion({discriminatedUnion:r,value:i,fallbackToDefault:p}):this.convertUnknown({value:i,fallbackToDefault:p});case"enum":return this.getEnumValue(r,i);case"object":return this.convertObject({object_:r,value:i,fallbackToDefault:p});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:r,value:i,fallbackToDefault:p});default:ue(r)}}convertDiscriminatedUnion({discriminatedUnion:r,value:i,fallbackToDefault:o}){let p=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),l=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:r,value:i});if(l==null)return this.csharp.Literal.nop();let b=l.singleDiscriminatedUnionType,w=this.getBaseProperties({discriminatedUnionTypeInstance:l,singleDiscriminatedUnionType:b});switch(b.type){case"samePropertiesAsObject":{let A=this.context.resolveNamedType({typeId:b.typeId});return A==null?this.csharp.Literal.nop():this.instantiateUnionWithBaseProperties({classReference:p,baseProperties:w,arguments_:[this.convertNamed({named:A,value:l.value})]})}case"singleProperty":{if(this.context.getRecord(l.value)==null)return this.csharp.Literal.nop();try{let I=["Value","Type"].includes(b.discriminantValue.name.pascalCase.safeName)?`${b.discriminantValue.name.pascalCase.safeName}Inner`:b.discriminantValue.name.pascalCase.safeName;return this.context.errors.scope(b.discriminantValue.wireValue),this.instantiateUnionWithBaseProperties({classReference:p,baseProperties:w,arguments_:[this.csharp.instantiateClass({classReference:this.csharp.classReference({name:I,enclosingType:p}),arguments_:[this.convert({typeReference:b.typeReference,value:b.discriminantValue.wireValue})]})]})}finally{this.context.errors.unscope()}}case"noProperties":return this.instantiateUnionWithBaseProperties({classReference:p,baseProperties:w,arguments_:[this.csharp.instantiateClass({classReference:this.csharp.classReference({origin:l.discriminantValue,enclosingType:p}),arguments_:[]})]});default:ue(b)}}getBaseProperties({discriminatedUnionTypeInstance:r,singleDiscriminatedUnionType:i}){return this.context.associateByWireValue({parameters:i.properties??[],values:this.context.getRecord(r.value)??{},ignoreMissingParameters:!0}).map(p=>{this.context.errors.scope(p.name.wireValue);try{return{name:this.context.getPropertyName(p.name.name),assignment:this.convert(p)}}finally{this.context.errors.unscope()}})}instantiateUnionWithBaseProperties({classReference:r,arguments_:i,baseProperties:o}){let p=this.csharp.instantiateClass({classReference:r,arguments_:i,multiline:!0});return o.length===0?this.csharp.Literal.reference(p):this.csharp.Literal.reference(this.csharp.codeblock(l=>{l.write(p," "),l.pushScope();for(let b of o)l.write(b.name," = ",b.assignment,",");l.popScope(!1)}))}getEnumValue(r,i){if(typeof i!="string")return this.context.errors.add({severity:te.Critical,message:`Expected enum value string, got: ${typeof i}`}),this.csharp.Literal.nop();let o=r.values.find(b=>b.wireValue===i);if(o==null)return this.context.errors.add({severity:te.Critical,message:`An enum value named "${i}" does not exist in this context`}),this.csharp.Literal.nop();let p=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),l=p.registerField(this.model.getPropertyNameFor(o),o);return this.csharp.Literal.reference(this.csharp.enumInstantiation({reference:p,value:l}))}convertObject({object_:r,value:i,fallbackToDefault:o}){let p=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),l=this.getOmittedBasePropertyWireValues(r),b=l.size===0?r.properties:r.properties.filter(F=>!l.has(F.name.wireValue)),w=new Map;for(let F of b){let U=this.context.resolvePropertyName(p,F.name.name);w.set(F.name.wireValue,U)}let A=this.context.getRecord(i)??{},I=l.size===0?A:Object.fromEntries(Object.entries(A).filter(([F])=>!l.has(F))),L=this.context.associateByWireValue({parameters:b,values:I}).map(F=>{this.context.errors.scope(F.name.wireValue);try{return{name:w.get(F.name.wireValue)??this.context.getClassName(F.name.name),value:this.convert(F)}}finally{this.context.errors.unscope()}}),O=new Set(Object.keys(I));for(let F of b){let U=w.get(F.name.wireValue)??this.context.getClassName(F.name.name);if(O.has(F.name.wireValue)){if(this.isRequiredProperty(F.typeReference)){let M=L.find(W=>W.name===U);if(M!=null&&v.Literal.nop(M.value)){let W=this.getDefaultLiteralForType(F.typeReference);W!=null&&(M.value=W)}}continue}if(this.isRequiredProperty(F.typeReference)){let M=this.getDefaultLiteralForType(F.typeReference);M!=null&&L.push({name:U,value:M})}}return this.csharp.Literal.class_({reference:p,fields:L})}getOmittedBasePropertyWireValues(r){return this.settings.dedupeUnionBaseProperties?new Set((r.deferredUnionBaseProperties??[]).map(i=>i.wireValue)):new Set}isRequiredProperty(r){return!(this.context.isOptional(r)||this.context.isNullable(r)||r.type==="list"||r.type==="set"||r.type==="map")}getDefaultLiteralForType(r,i){switch(r.type){case"primitive":return this.getDefaultLiteralForPrimitive(r.value);case"literal":return this.convertLiteral({literal:r.value,value:r.value.value});case"named":{let o=this.context.resolveNamedType({typeId:r.value});if(o==null)return;if(o.type==="alias")return this.getDefaultLiteralForType(o.typeReference,i);if(o.type==="enum"&&o.values.length>0){let p=o.values[0];if(p!=null)return this.getEnumValue(o,p.wireValue)}return o.type==="undiscriminatedUnion"?this.getDefaultLiteralForUndiscriminatedUnion(o,i):o.type==="object"?this.getDefaultLiteralForObject(o,r.value,i):void 0}default:return}}getDefaultLiteralForObject(r,i,o){let p=o??new Set;if(p.has(i))return;p.add(i);let l=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),b=[];for(let w of r.properties)if(this.isRequiredProperty(w.typeReference)){let A=this.getDefaultLiteralForType(w.typeReference,p);A!=null&&b.push({name:this.context.resolvePropertyName(l,w.name.name),value:A})}return p.delete(i),this.csharp.Literal.class_({reference:l,fields:b})}getDefaultLiteralForUndiscriminatedUnion(r,i){for(let o of r.types){let p=this.getDefaultLiteralForType(o,i);if(p!=null)return p}}getDefaultLiteralForPrimitive(r){switch(r){case"INTEGER":return this.csharp.Literal.integer(0);case"LONG":return this.csharp.Literal.long(0);case"UINT":return this.csharp.Literal.uint(0);case"UINT_64":return this.csharp.Literal.ulong(0);case"FLOAT":return this.csharp.Literal.float(0);case"DOUBLE":return this.csharp.Literal.double(0);case"BOOLEAN":return this.csharp.Literal.boolean(!1);case"STRING":case"UUID":case"BASE_64":case"BIG_INTEGER":return this.csharp.Literal.string("");case"DATE":return this.csharp.Literal.date("0001-01-01");case"DATE_TIME":case"DATE_TIME_RFC_2822":return this.csharp.Literal.datetime("0001-01-01T00:00:00.000Z");default:ue(r)}}convertUndiscriminatedUnion({undiscriminatedUnion:r,value:i,fallbackToDefault:o}){let p=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:r,value:i});return p==null?this.csharp.Literal.nop():p.typeLiteral}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:r,value:i}){for(let o of r.types){let p=this.context.errors.size();try{let l=this.convert({typeReference:o,value:i});if(v.Literal.nop(l)||this.context.errors.size()>p){this.context.errors.truncate(p);continue}return{valueTypeReference:o,typeLiteral:l}}catch{this.context.errors.truncate(p);continue}}this.context.errors.add({severity:te.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof i}" value`})}convertUnknown({value:r,fallbackToDefault:i}){return this.csharp.Literal.unknown(r)}convertPrimitive({primitive:r,value:i,as:o,fallbackToDefault:p}){switch(r){case"INTEGER":{let l=this.getValueAsNumber({value:i,as:o});return l==null?p?this.Primitive.integer.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.integer(l)}case"LONG":{let l=this.getValueAsNumber({value:i,as:o});return l==null?p?this.Primitive.long.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.long(l)}case"UINT":{let l=this.getValueAsNumber({value:i,as:o});return l==null?p?this.Primitive.uint.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.uint(l)}case"UINT_64":{let l=this.getValueAsNumber({value:i,as:o});return l==null?p?this.Primitive.ulong.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.ulong(l)}case"FLOAT":{let l=this.getValueAsNumber({value:i,as:o});return l==null?p?this.Primitive.float.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.float(l)}case"DOUBLE":{let l=this.getValueAsNumber({value:i,as:o});return l==null?p?this.Primitive.double.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.double(l)}case"BOOLEAN":{let l=this.getValueAsBoolean({value:i,as:o});return l==null?p?this.Primitive.boolean.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.boolean(l)}case"STRING":{let l=this.context.getValueAsString({value:i});return l==null?p?this.Primitive.string.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.string(l)}case"DATE":{let l=this.context.getValueAsString({value:i});return l==null?p?this.Value.dateOnly.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.date(l)}case"DATE_TIME":case"DATE_TIME_RFC_2822":{let l=this.context.getValueAsString({value:i});return l==null?p?this.Value.dateTime.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.datetime(l)}case"UUID":{let l=this.context.getValueAsString({value:i});return l==null?p?this.Primitive.string.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.string(l)}case"BASE_64":{let l=this.context.getValueAsString({value:i});return l==null?p?this.Primitive.string.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.string(l)}case"BIG_INTEGER":{let l=this.context.getValueAsString({value:i});return l==null?p?this.Primitive.string.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.string(l)}default:ue(r)}}getValueAsNumber({value:r,as:i}){let o=i==="key"&&typeof r=="string"?Number(r):r;return this.context.getValueAsNumber({value:o})}getValueAsBoolean({value:r,as:i}){let o=i==="key"?typeof r=="string"?r==="true":r==="false"?!1:r:r;return this.context.getValueAsBoolean({value:o})}};n();a();s();var _o=class extends Ze{constructor({context:r}){super(r.generation);y(this,"context");this.context=r}convert(r){switch(r.typeReference.type){case"list":return this.Collection.list(this.convert({typeReference:r.typeReference.value,unboxOptionals:!0}));case"literal":return this.convertLiteral({literal:r.typeReference.value});case"map":return this.Collection.map(this.convert({typeReference:r.typeReference.key}),this.convert({typeReference:r.typeReference.value}));case"named":{let i=this.context.resolveNamedType({typeId:r.typeReference.value});return i==null?this.convertUnknown():this.convertNamed({named:i,typeId:r.typeReference.value})}case"optional":case"nullable":{let i=this.convert({typeReference:r.typeReference.value});return r.unboxOptionals?i.asNonOptional():i.asOptional()}case"primitive":return this.convertPrimitive({primitive:r.typeReference.value});case"set":return this.Collection.set(this.convert({typeReference:r.typeReference.value,unboxOptionals:!0}));case"unknown":return this.convertUnknown();default:ue(r.typeReference)}}convertToClassReference(r,i){return this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)})}convertNamed({named:r,typeId:i}){switch(r.type){case"alias":return this.settings.generateLiterals&&r.typeReference.type==="literal"?this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}):this.convert({typeReference:r.typeReference});case"enum":case"object":return this.convertToClassReference(r,i);case"discriminatedUnion":return this.settings.shouldGeneratedDiscriminatedUnions?this.convertToClassReference(r,i):this.Primitive.object;case"undiscriminatedUnion":return this.settings.shouldGenerateUndiscriminatedUnions?this.convertToClassReference(r,i):this.OneOf.OneOf(r.types.map(o=>this.convert({typeReference:o})));default:ue(r)}}convertLiteral({literal:r}){switch(r.type){case"boolean":return this.Primitive.boolean;case"string":return this.Primitive.string}}convertUnknown(){return this.Primitive.object}convertPrimitive({primitive:r}){switch(r){case"INTEGER":return this.Primitive.integer;case"UINT":return this.Primitive.uint;case"LONG":return this.Primitive.long;case"UINT_64":return this.Primitive.ulong;case"FLOAT":return this.Primitive.float;case"DOUBLE":return this.Primitive.double;case"BOOLEAN":return this.Primitive.boolean;case"STRING":return this.Primitive.string;case"DATE":return this.Value.dateOnly;case"DATE_TIME":case"DATE_TIME_RFC_2822":return this.Value.dateTime;case"UUID":return this.Primitive.string;case"BASE_64":return this.Primitive.string;case"BIG_INTEGER":return this.Primitive.string;default:ue(r)}}};n();a();s();var ko=class extends Ze{constructor({context:r}){super(r.generation);y(this,"context");this.context=r}getFilePropertyInfo({body:r,value:i}){let o={fileFields:[],bodyPropertyFields:[]},p=this.context.getRecord(i)??{};for(let l of r.properties)switch(l.type){case"file":v.Record.missingKey(p,l.wireValue)&&(p[l.wireValue]="[bytes]"),o.fileFields.push({name:this.context.getPropertyName(l.name),value:this.getSingleFileProperty({property:l,record:p})});break;case"fileArray":v.Record.missingKey(p,l.wireValue)&&(p[l.wireValue]=["[bytes]"]),o.fileFields.push({name:this.context.getPropertyName(l.name),value:this.getArrayFileProperty({property:l,record:p})});break;case"bodyProperty":if(v.Record.missingKey(p,l.name.wireValue))switch(l.typeReference.type){case"optional":break;case"primitive":{switch(l.typeReference.value.toLowerCase()){case"integer":{p[l.name.wireValue]=123;break}case"string":{p[l.name.wireValue]="[string]";break}case"boolean":{p[l.name.wireValue]=!0;break}case"double":{p[l.name.wireValue]=123.456;break}case"float":{p[l.name.wireValue]=123.456;break}case"long":{p[l.name.wireValue]=123456789;break}case"uint":{p[l.name.wireValue]=123;break}case"uint64":{p[l.name.wireValue]=12345;break}case"date":{p[l.name.wireValue]=new Date(2021,1,1);break}case"datetime":{p[l.name.wireValue]=new Date(2021,1,1,12,0,0);break}case"uuid":{p[l.name.wireValue]="123e4567-e89b-12d3-a456-426614174000";break}case"base64":{p[l.name.wireValue]="SGVsbG8gd29ybGQh";break}case"biginteger":{p[l.name.wireValue]="12345678901234567890";break}}break}default:break}o.bodyPropertyFields.push({name:this.context.getPropertyName(l.name.name),value:this.getBodyProperty({property:l,record:p})});break;default:ue(l)}return o}getSingleFileProperty({property:r,record:i}){let o=this.context.getSingleFileValue({property:r,record:i});return o==null?this.csharp.Literal.nop():this.context.getFileParameterForString(o)}getArrayFileProperty({property:r,record:i}){let o=this.context.getFileArrayValues({property:r,record:i});return o==null?this.csharp.Literal.nop():this.csharp.Literal.list({valueType:this.Types.FileParameter,values:o.map(p=>this.context.getFileParameterForString(p))})}getBodyProperty({property:r,record:i}){let o=i[r.name.wireValue];return o==null?this.csharp.Literal.nop():this.context.dynamicLiteralMapper.convert({typeReference:r.typeReference,value:o})}};var Fo=class e extends en{constructor({ir:r,config:i,options:o,generation:p}){super({ir:r,config:i,options:o});y(this,"ir");y(this,"dynamicTypeMapper");y(this,"dynamicLiteralMapper");y(this,"filePropertyMapper");y(this,"generation");this.ir=r,this.generation=p??new jn(r,i.workspaceName,i.customConfig!=null?i.customConfig:{},i),this.dynamicTypeMapper=new _o({context:this}),this.dynamicLiteralMapper=new Co({context:this}),this.filePropertyMapper=new ko({context:this})}get namespaces(){return this.generation.namespaces}get registry(){return this.generation.registry}get settings(){return this.generation.settings}get constants(){return this.generation.constants}get names(){return this.generation.names}get model(){return this.generation.model}get format(){return this.generation.format}get csharp(){return this.generation.csharp}get Types(){return this.generation.Types}get System(){return this.generation.extern.System}get NUnit(){return this.generation.extern.NUnit}get OneOf(){return this.generation.extern.OneOf}get Google(){return this.generation.extern.Google}get WireMock(){return this.generation.extern.WireMock}get Primitive(){return this.generation.Primitive}get Value(){return this.generation.Value}get Collection(){return this.generation.Collection}clone(){return new e({ir:this.ir,config:this.config,options:this.options,generation:this.generation})}getFileParameterForString(r){return this.csharp.Literal.reference(this.csharp.instantiateClass({classReference:this.Types.FileParameter,arguments_:[],properties:[{name:"Stream",value:this.getMemoryStreamForString(r)}],multiline:!0}))}getMemoryStreamForString(r){return this.System.IO.MemoryStream.new({arguments_:[this.csharp.invokeMethod({on:this.System.Text.Encoding_UTF8,method:"GetBytes",arguments_:[this.csharp.Literal.string(r)]})]})}getClassName(r){return r.pascalCase.safeName}getParameterName(r){return r.camelCase.safeName}getPropertyName(r){return r.pascalCase.safeName}resolvePropertyName(r,i){let o=i.pascalCase.safeName,p=r.scope.getRedirectedFieldName(o);return p||(r.scope.isField(o)?o:r.registerField(o))}getMethodName(r){return`${r.pascalCase.safeName}Async`}getNamespace(r,i){let o=this.getNamespaceSegments(r);return o=i!=null?[...o,i]:o,[this.namespaces.root,...o].join(".")}getEnvironmentTypeReferenceFromID(r){let i=this.resolveEnvironmentName(r);if(i!=null)return this.getEnvironmentClassReferenceForEnumName(i)}getEnvironmentClassReferenceForEnumName(r){return this.csharp.classReference({name:`${this.generation.Types.Environments.name}.${this.getClassName(r)}`,namespace:this.namespaces.root})}getNamespaceSegments(r){return(this.settings.explicitNamespaces?r.allParts:r.packagePath).map(o=>o.pascalCase.safeName)}precalculate(r){this.generation.initialize(),this.System.Collections.Generic.KeyValuePair(),this.System.Collections.Generic.IEnumerable(),this.System.Collections.Generic.IAsyncEnumerable(),this.System.Collections.Generic.HashSet(),this.System.Collections.Generic.List(),this.System.Collections.Generic.Dictionary(),this.System.Threading.Tasks.Task(),Object.entries(this.ir.types).sort((i,o)=>i[0].length-o[0].length).forEach(([i,o])=>{this.dynamicTypeMapper.convertToClassReference(o,i)});for(let[i,o]of r.entries())if(this.csharp.classReference({origin:this.model.staticExplicit(`Example${i}`),namespace:"Usage"}),o.endpoint){let p=this.resolveEndpointLocation(o.endpoint);for(let l of p)switch(l.request.type){case"inlined":this.csharp.classReference({origin:l.request.declaration.name,namespace:this.getNamespace(l.request.declaration.fernFilepath)});break;case"body":break}}this.generation.Types.ClientOptions,this.generation.Types.RootClientForSnippets,this.csharp.freezeClassReferences()}};n();a();s();var cd="request",Lo=class extends Ze{constructor({context:r}){super(r.generation);y(this,"context");this.context=r}async generateSnippet({endpoint:r,request:i,options:o}){return this.buildCodeBlock({endpoint:r,snippet:i,options:o}).toString({namespace:"Examples",generation:this.generation,allNamespaceSegments:new Set,allTypeClassReferences:new Map,skipGlobalQualifier:!0})}generateSnippetSync({endpoint:r,request:i,options:o}){return this.buildCodeBlock({endpoint:r,snippet:i,options:o}).toString({namespace:"Examples",generation:this.generation,allNamespaceSegments:new Set,allTypeClassReferences:new Map,skipGlobalQualifier:!0})}async generateSnippetAst({endpoint:r,request:i,options:o}){throw new Error("Unsupported")}buildCodeBlock({endpoint:r,snippet:i,options:o}){if(r.examples&&v.DynamicIR.EndpointExample(i)&&!r.examples.find(b=>b.id===i.id))throw new Error("Endpoint does not have an example that matches the snippet");let p=this.csharp.codeblock(b=>{b.writeNodeStatement(this.constructClient({endpoint:r,snippet:i})),b.newLine(),b.writeNodeStatement(this.callMethod({endpoint:r,snippet:i}))}),l=this.getStyle(o);switch(l){case Qt.Concise:return p;case Qt.Full:return this.buildFullCodeBlock({body:p,options:o});default:ue(l)}}buildFullCodeBlock({body:r,options:i}){let o=this.getConfig(i),p=o.fullStyleMethodName??o.fullStyleClassName??"Example",l=this.csharp.class_({name:"Examples",namespace:"Examples",partial:!0,skipNamespaceDeclaration:!0,access:Ri.Access.Public});return l.addNamespaceReference(this.Types.RootClientForSnippets.namespace),l.addMethod({name:p,access:Ri.Access.Public,isAsync:!0,parameters:[],body:r}),l}constructClient({endpoint:r,snippet:i}){return this.csharp.codeblock(o=>{o.write("var client = "),o.writeNode(this.getRootClientConstructorInvocation(this.getConstructorArgs({endpoint:r,snippet:i})))})}callMethod({endpoint:r,snippet:i}){let o=r.response?.type==="streaming"||r.response?.type==="streamParameter",p=this.csharp.invokeMethod({on:this.csharp.codeblock("client"),method:this.getMethod({endpoint:r}),arguments_:this.getMethodArgs({endpoint:r,snippet:i}),async:!0,configureAwait:!0,multiline:!0,isAsyncEnumerable:o});return o?this.csharp.codeblock(l=>{l.write("await foreach (var item in "),l.writeNode(p),l.writeLine(")"),l.pushScope(),l.writeLine("/* consume each item */"),l.popScope()}):p}getConstructorArgs({endpoint:r,snippet:i}){let o=[];r.auth!=null&&(i.auth!=null?o.push(...this.getConstructorAuthArgs({auth:r.auth,values:i.auth})):this.context.errors.add({severity:te.Warning,message:`Auth with ${r.auth.type} configuration is required for this endpoint`}));let p=[],l=this.getConstructorBaseUrlArgs({baseUrl:i.baseURL,environment:i.environment});l.length>0&&p.push(...l),this.context.errors.scope(tt.Headers);let b=[];if(this.context.ir.headers!=null&&i.headers!=null&&b.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:i.headers})),this.context.errors.unscope(),this.settings.unifiedClientOptions){let w=[...o.map(A=>({name:Le(A.name),assignment:A.assignment})),...b.map(A=>({name:Le(A.name),assignment:A.assignment})),...p.map(A=>({name:A.name,assignment:A.assignment}))];return w.length===0?[]:[{name:"clientOptions",assignment:this.csharp.instantiateClass({classReference:this.Types.ClientOptions,arguments_:w,multiline:!0})}]}return p.length===0?[...o,...b]:[...o,...b,{name:"clientOptions",assignment:this.csharp.instantiateClass({classReference:this.Types.ClientOptions,arguments_:p.map(w=>({name:w.name,assignment:w.assignment})),multiline:!0})}]}getConstructorBaseUrlArgs({baseUrl:r,environment:i}){let o=this.getBaseUrlArg({baseUrl:r,environment:i});return v.Literal.nop(o)?[]:[{name:this.getBaseUrlOptionName(),assignment:o}]}getBaseUrlArg({baseUrl:r,environment:i}){if(r!=null&&i!=null)return this.context.errors.add({severity:te.Critical,message:"Cannot specify both baseUrl and environment options"}),this.csharp.Literal.nop();if(r!=null)return this.context.ir.environments?.environments.type==="multipleBaseUrls"?(this.context.errors.add({severity:te.Critical,message:"The C# SDK doesn't support a baseUrl when multiple URL environments are configured"}),this.csharp.Literal.nop()):this.csharp.Literal.string(r);if(i!=null){if(this.context.isSingleEnvironmentID(i)){let o=this.context.getEnvironmentTypeReferenceFromID(i);return o==null?(this.context.errors.add({severity:te.Warning,message:`Environment ${JSON.stringify(i)} was not found`}),this.csharp.Literal.nop()):this.csharp.Literal.reference(o)}if(this.context.isMultiEnvironmentValues(i))return this.context.validateMultiEnvironmentUrlValues(i)?this.csharp.Literal.reference(this.csharp.instantiateClass({classReference:this.Types.Environments,arguments_:Object.entries(i).map(([o,p])=>({name:Le(lr(o)),assignment:this.context.dynamicLiteralMapper.convert({typeReference:{type:"primitive",value:"STRING"},value:p})})),multiline:!0})):this.csharp.Literal.nop()}return this.csharp.Literal.nop()}getConstructorAuthArgs({auth:r,values:i}){if(i.type!==r.type)return this.addError(this.context.newAuthMismatchError({auth:r,values:i}).message),[];switch(r.type){case"basic":return i.type==="basic"?this.getConstructorBasicAuthArg({auth:r,values:i}):[];case"bearer":return i.type==="bearer"?this.getConstructorBearerAuthArgs({auth:r,values:i}):[];case"header":return i.type==="header"?this.getConstructorHeaderAuthArgs({auth:r,values:i}):[];case"oauth":return i.type==="oauth"?this.getConstructorOAuthArgs({auth:r,values:i}):[];case"inferred":return i.type==="inferred"?this.getConstructorInferredAuthArgs({auth:r,values:i}):[];default:ue(r)}}addError(r){this.context.errors.add({severity:te.Critical,message:r})}addWarning(r){this.context.errors.add({severity:te.Warning,message:r})}getConstructorBasicAuthArg({auth:r,values:i}){let o=r,p=!!o.usernameOmit,l=!!o.passwordOmit,b=[];return p||b.push({name:this.context.getParameterName(r.username),assignment:this.csharp.Literal.string(i.username)}),l||b.push({name:this.context.getParameterName(r.password),assignment:this.csharp.Literal.string(i.password)}),b}getConstructorBearerAuthArgs({auth:r,values:i}){return[{name:this.context.getParameterName(r.token),assignment:this.csharp.Literal.string(i.token)}]}getConstructorHeaderAuthArgs({auth:r,values:i}){return[{name:this.context.getParameterName(r.header.name.name),assignment:this.context.dynamicLiteralMapper.convert({typeReference:r.header.typeReference,value:i.value,fallbackToDefault:r.header.name.wireValue})}]}getConstructorOAuthArgs({auth:r,values:i}){return[{name:this.context.getParameterName(r.clientId),assignment:this.csharp.Literal.string(i.clientId)},{name:this.context.getParameterName(r.clientSecret),assignment:this.csharp.Literal.string(i.clientSecret)}]}getConstructorInferredAuthArgs({auth:r,values:i}){let o=[];if(r.parameters!=null)for(let p of r.parameters){let l=p.name.wireValue,b=i.values?.[l];o.push({name:this.context.getParameterName(p.name.name),assignment:this.context.dynamicLiteralMapper.convert({typeReference:p.typeReference,value:b,fallbackToDefault:l})})}else this.context.errors.add({severity:te.Critical,message:"Inferred auth parameters are not defined in the IR. Please ensure you're using IR version 62.3.0 or later."});return o}getConstructorHeaderArgs({headers:r,values:i}){let o=[];for(let p of r){let l=i[p.name.wireValue],b=this.getConstructorHeaderArg({header:p,value:l});b!=null&&o.push({name:this.context.getParameterName(p.name.name),assignment:b})}return o}getConstructorHeaderArg({header:r,value:i}){let o=this.context.dynamicLiteralMapper.convert({typeReference:r.typeReference,value:i,fallbackToDefault:r.name.wireValue});if(!v.Literal.nop(o))return o}getMethodArgs({endpoint:r,snippet:i}){switch(r.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:r.request,snippet:i});case"body":return this.getMethodArgsForBodyRequest({request:r.request,snippet:i});default:ue(r.request)}}getMethodArgsForInlinedRequest({request:r,snippet:i}){this.context.errors.scope(tt.PathParameters);let o=[...this.context.ir.pathParameters??[],...r.pathParameters??[]],p=this.context.includePathParametersInWrappedRequest({request:r,inlinePathParameters:this.settings.shouldInlinePathParameters}),l=p?this.getPathParameters({namedParameters:o,snippet:i}):[],b=p?[]:this.getPathParameterArguments({namedParameters:o,snippet:i});this.context.errors.unscope(),this.context.errors.scope(tt.RequestBody);let w=this.getFilePropertyInfo({request:r,snippet:i});this.context.errors.unscope();let A=this.getInlinedRequestArg({request:r,snippet:i,pathParameterFields:l,filePropertyInfo:w});return b.length>0?[...b.map(I=>this.namedArgument({name:I.name,value:I.value})),this.namedArgument({name:cd,value:A})]:[A]}getFilePropertyInfo({request:r,snippet:i}){return r.body==null||!this.context.isFileUploadRequestBody(r.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:r.body,value:i.requestBody})}getInlinedRequestArg({request:r,snippet:i,pathParameterFields:o,filePropertyInfo:p}){let l=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)});this.context.errors.scope(tt.QueryParameters);let w=this.context.associateQueryParametersByWireValue({parameters:r.queryParameters??[],values:i.queryParameters??{}}).map(L=>({name:this.context.resolvePropertyName(l,L.name.name),value:this.context.dynamicLiteralMapper.convert(L)}));this.context.errors.unscope(),this.context.errors.scope(tt.Headers);let I=this.context.associateByWireValue({parameters:r.headers??[],values:i.headers??{}}).map(L=>({name:this.context.resolvePropertyName(l,L.name.name),value:this.context.dynamicLiteralMapper.convert({...L,fallbackToDefault:L.name.wireValue})}));this.context.errors.unscope(),this.context.errors.scope(tt.RequestBody);let P=r.body!=null?this.getInlinedRequestBodyConstructorFields({body:r.body,value:i.requestBody,filePropertyInfo:p,classReference:l}):[];return this.context.errors.unscope(),this.csharp.Literal.class_({reference:l,fields:[...o,...w,...I,...P]})}getInlinedRequestBodyConstructorFields({body:r,value:i,filePropertyInfo:o,classReference:p}){switch(r.type){case"properties":return this.getInlinedRequestBodyPropertyConstructorFields({parameters:r.value,value:i,classReference:p});case"referenced":return[this.getReferencedRequestBodyPropertyConstructorField({body:r,value:i,classReference:p})];case"fileUpload":return this.getFileUploadRequestBodyConstructorFields({filePropertyInfo:o});default:ue(r)}}getInlinedRequestBodyPropertyConstructorFields({parameters:r,value:i,classReference:o}){let p=[],l=this.context.associateByWireValue({parameters:r,values:this.context.getRecord(i)??{}});for(let b of l)p.push({name:this.context.resolvePropertyName(o,b.name.name),value:this.context.dynamicLiteralMapper.convert({...b,fallbackToDefault:b.name.wireValue})});return p}getFileUploadRequestBodyConstructorFields({filePropertyInfo:r}){return[...r.fileFields,...r.bodyPropertyFields]}getReferencedRequestBodyPropertyConstructorField({body:r,value:i,classReference:o}){return{name:this.context.resolvePropertyName(o,r.bodyKey),value:this.getReferencedRequestBodyPropertyLiteral({body:r.bodyType,value:i})}}getReferencedRequestBodyPropertyLiteral({body:r,value:i}){switch(r.type){case"bytes":return this.getBytesBodyRequestArg({value:i});case"typeReference":return this.context.dynamicLiteralMapper.convert({typeReference:r.value,value:i,fallbackToDefault:JSON.stringify(r.value)});default:ue(r)}}getMethodArgsForBodyRequest({request:r,snippet:i}){this.context.errors.scope(tt.PathParameters);let o=[...this.context.ir.pathParameters??[],...r.pathParameters??[]],p=this.getPathParameterArguments({namedParameters:o,snippet:i});this.context.errors.unscope(),this.context.errors.scope(tt.RequestBody);let l=r.body!=null?this.getBodyRequestArg({body:r.body,value:i.requestBody}):void 0;if(this.context.errors.unscope(),p.length>0&&l!=null)return[...p.map(w=>this.namedArgument({name:w.name,value:w.value})),this.namedArgument({name:cd,value:l})];let b=p.map(w=>w.value);return l!=null&&b.push(l),b}getPathParameterArguments({namedParameters:r,snippet:i}){return this.context.associateByWireValueOrDefault({parameters:r,values:i.pathParameters??{}}).map(p=>({name:this.context.getParameterName(p.name.name),value:this.context.dynamicLiteralMapper.convert({...p,fallbackToDefault:p.name.wireValue,forceLiteral:!0})}))}namedArgument({name:r,value:i}){return this.csharp.codeblock(o=>{o.write(`${r}: `),o.writeNode(i)})}getBodyRequestArg({body:r,value:i}){switch(r.type){case"bytes":return this.getBytesBodyRequestArg({value:i});case"typeReference":return r.value.type==="optional"&&i==null?this.csharp.Literal.null():this.context.dynamicLiteralMapper.convert({typeReference:r.value,value:i,fallbackToDefault:JSON.stringify(r.value)});default:ue(r)}}getBytesBodyRequestArg({value:r}){let i=this.context.getValueAsString({value:r});return i==null&&(this.context.errors.add({severity:te.Critical,message:"The bytes request body must be provided in string format"}),i="[bytes]"),this.csharp.Literal.reference(this.context.getMemoryStreamForString(i))}getRootClientConstructorInvocation(r){return this.csharp.instantiateClass({classReference:this.Types.RootClientForSnippets,arguments_:r,forceUseConstructor:!0,multiline:!0})}getPathParameters({namedParameters:r,snippet:i}){let o=[],p=this.context.associateByWireValueOrDefault({parameters:r,values:i.pathParameters??{}});for(let l of p)o.push({name:this.context.getPropertyName(l.name.name),value:this.context.dynamicLiteralMapper.convert({...l,fallbackToDefault:l.name.wireValue})});return o}getMethod({endpoint:r}){return r.declaration.fernFilepath.allParts.length>0?`${r.declaration.fernFilepath.allParts.map(i=>this.context.getClassName(i)).join(".")}.${this.context.getMethodName(r.declaration.name)}`:this.context.getMethodName(r.declaration.name)}getBaseUrlOptionName(){return this.context.ir.environments?.environments.type==="multipleBaseUrls"?"Environment":"BaseUrl"}getStyle(r){return r.style??this.context.options.style??Qt.Full}getConfig(r){return r.config??this.context.options.config??{}}};var cc=class extends Yi{constructor({ir:t,config:r,options:i={}}){super(new Fo({ir:t,config:r,options:i}))}precalculate(t){this.context.precalculate(t)}async generate(t,r={}){return super.generate(t,r)}generateSync(t,r={}){return super.generateSync(t,r)}async generateSnippetAst(t){return super.generateSnippetAst(t)}createSnippetGenerator(t){return new Lo({context:t})}};export{cc as DynamicSnippetsGenerator,Rd as buildSnippetTestGeneratorConfig};
|
|
33
|
+
${Ui()}`)}return this.generation.registry.registerClassReference(t,r)}freezeClassReferences(){this.frozen=!0}getPropertyName(t,r){let i=this.model.getPropertyNameFor(r),o=this.model.origin(r);if(o){let p=t.getFieldName(o,i);if(p)return p}return i}class_(t){let r=t;return"reference"in t&&(r={...t.reference,...t}),new nt(r,this.generation)}testClass(t){return new Ni(t,this.generation)}annotation(t){return new gt(t,this.generation)}annotationGroup(t){return new yi(t,this.generation)}instantiateClass(t){return new Zr(t,this.generation)}invokeMethod(t){return new ii(t,this.generation)}codeblock(t){return new Mt(t,this.generation)}code(){return new vt({},this.generation)}anonymousFunction(t){return new gi(t)}parameter(t){return new Ye(t,this.generation)}interface_(t){return new Ii(t,this.generation)}enum_(t){return new Ai(t,this.generation)}dictionary(t){return new ei(t,this.generation)}list(t){return new ri(t,this.generation)}readOnlyMemory(t){return new ni(t,this.generation)}set(t){return new si(t,this.generation)}switch_(t){return new xi(t,this.generation)}ternary(t){return new Si(t,this.generation)}and(t){return new hi(t,this.generation)}or(t){return new bi(t,this.generation)}enumInstantiation(t){return new ti(t,this.generation)}string_(t){return new ai(t,this.generation)}xmlDocBlock(t){return new qt(t,this.generation)}xmlDocBlockOf(t){return t instanceof qt?t:new qt(t,this.generation)}validateReadOnlyMemoryTypes(){for(let t of this.generation.settings.readOnlyMemoryTypes)if(!this.VALID_READ_ONLY_MEMORY_TYPES.has(t))throw new Error(`Type "${t}" is not a valid 'read-only-memory-types' custom config option; expected one of ${JSON.stringify(this.VALID_READ_ONLY_MEMORY_TYPES)}.`)}};n();a();s();function J(e){let t={},r={};for(let[i,o]of Object.entries(e))o.length===0?Object.defineProperty(r,i,{get(){return i in t||(t[i]=o()),t[i]},enumerable:!0,configurable:!0}):r[i]=o;return r}n();a();s();var Ro=class{constructor(t){y(this,"generation");y(this,"System",J({Action:t=>this.csharp.classReference({name:"Action",namespace:"System",generics:t||void 0,multipartMethodName:null,multipartMethodNameForCollection:null,isReferenceType:!0}),Func:(t,r)=>this.csharp.classReference({name:"Func",namespace:"System",generics:t?r?[...t,r]:t:r?[r]:void 0,multipartMethodName:null,multipartMethodNameForCollection:null,isReferenceType:!0}),DateOnly:()=>this.csharp.classReference({name:"DateOnly",namespace:"System"}),DateTime:()=>this.csharp.classReference({name:"DateTime",namespace:"System"}),Enum:()=>this.csharp.classReference({name:"Enum",namespace:"System"}),Exception:()=>this.csharp.classReference({name:"Exception",namespace:"System"}),ReadOnlyMemory:t=>this.csharp.classReference({name:"ReadOnlyMemory",namespace:"System",generics:[t]}),Serializable:()=>this.csharp.classReference({name:"SerializableAttribute",namespace:"System"}),String:()=>this.csharp.classReference({name:"String",namespace:"System"}),Type:()=>this.csharp.classReference({name:"Type",namespace:"System",isReferenceType:!0,multipartMethodName:null,multipartMethodNameForCollection:null,fullyQualified:!0}),TimeSpan:()=>this.csharp.classReference({name:"TimeSpan",namespace:"System"}),Uri:()=>this.csharp.classReference({name:"Uri",namespace:"System"}),UriBuilder:()=>this.csharp.classReference({name:"UriBuilder",namespace:"System"}),Runtime:()=>J({Serialization:()=>J({EnumMember:()=>this.csharp.classReference({name:"EnumMemberAttribute",namespace:"System.Runtime.Serialization"})})}),Collections:()=>J({Generic:()=>J({IAsyncEnumerable:t=>this.csharp.classReference({name:"IAsyncEnumerable",namespace:"System.Collections.Generic",generics:t?[t]:void 0}),IEnumerable:t=>this.csharp.classReference({name:"IEnumerable",namespace:"System.Collections.Generic",generics:t?[t]:void 0}),KeyValuePair:(t,r)=>this.csharp.classReference({name:"KeyValuePair",namespace:"System.Collections.Generic",generics:t&&r?[t,r]:void 0}),List:t=>this.csharp.classReference({name:"List",namespace:"System.Collections.Generic",generics:t?[t]:void 0,isCollection:!0}),HashSet:t=>this.csharp.classReference({name:"HashSet",namespace:"System.Collections.Generic",generics:t?[t]:void 0,isCollection:!0}),Dictionary:(t,r)=>this.csharp.classReference({name:"Dictionary",namespace:"System.Collections.Generic",generics:t&&r?[t,r]:void 0,isCollection:!0}),IDictionary:(t,r)=>this.csharp.classReference({name:"IDictionary",namespace:"System.Collections.Generic",generics:[t,r]})}),Linq:()=>J({Enumerable:()=>this.csharp.classReference({name:"Enumerable",namespace:"System.Linq"})})}),Globalization:()=>J({DateTimeStyles:()=>this.csharp.classReference({name:"DateTimeStyles",namespace:"System.Globalization"})}),Linq:()=>J({Enumerable:()=>this.csharp.classReference({name:"Enumerable",namespace:"System.Linq"})}),Net:()=>J({Http:()=>J({HttpClient:()=>this.csharp.classReference({name:"HttpClient",namespace:"System.Net.Http"}),HttpMethod:()=>this.csharp.classReference({name:"HttpMethod",namespace:"System.Net.Http"}),HttpResponseHeaders:()=>this.csharp.classReference({name:"HttpResponseHeaders",namespace:"System.Net.Http.Headers"})}),ServerSentEvents:()=>J({SseEvent:()=>this.csharp.classReference({name:"SseEvent",namespace:"System.Net.ServerSentEvents"}),SseParser:()=>this.csharp.classReference({name:"SseParser",namespace:"System.Net.ServerSentEvents"})}),WebSockets:()=>J({ClientWebSocketOptions:()=>this.csharp.classReference({name:"ClientWebSocketOptions",namespace:"System.Net.WebSockets"})})}),IO:()=>J({MemoryStream:()=>this.csharp.classReference({name:"MemoryStream",namespace:"System.IO"}),Stream:()=>this.csharp.classReference({name:"Stream",namespace:"System.IO"}),StreamReader:()=>this.csharp.classReference({name:"StreamReader",namespace:"System.IO"})}),Text:()=>J({Encoding:()=>this.csharp.classReference({name:"Encoding",namespace:"System.Text"}),Encoding_UTF8:()=>this.csharp.classReference({name:"UTF8",enclosingType:this.csharp.classReference({name:"Encoding",namespace:"System.Text"})}),Json:()=>J({JsonElement:()=>this.csharp.classReference({name:"JsonElement",namespace:"System.Text.Json"}),JsonDocument:()=>this.csharp.classReference({name:"JsonDocument",namespace:"System.Text.Json"}),JsonException:()=>this.csharp.classReference({name:"JsonException",namespace:"System.Text.Json"}),Utf8JsonReader:()=>this.csharp.classReference({name:"Utf8JsonReader",namespace:"System.Text.Json"}),JsonSerializerOptions:()=>this.csharp.classReference({name:"JsonSerializerOptions",namespace:"System.Text.Json"}),JsonSerializer:()=>this.csharp.classReference({name:"JsonSerializer",namespace:"System.Text.Json"}),Utf8JsonWriter:()=>this.csharp.classReference({name:"Utf8JsonWriter",namespace:"System.Text.Json"}),Nodes:()=>J({JsonNode:()=>this.csharp.classReference({name:"JsonNode",namespace:"System.Text.Json.Nodes"}),JsonObject:()=>this.csharp.classReference({name:"JsonObject",namespace:"System.Text.Json.Nodes"})}),Serialization:()=>J({IJsonOnDeserialized:()=>this.csharp.classReference({name:"IJsonOnDeserialized",namespace:"System.Text.Json.Serialization"}),IJsonOnSerializing:()=>this.csharp.classReference({name:"IJsonOnSerializing",namespace:"System.Text.Json.Serialization"}),JsonOnDeserializedAttribute:()=>this.csharp.classReference({name:"JsonOnDeserializedAttribute",namespace:"System.Text.Json.Serialization"}),JsonExtensionData:()=>this.csharp.classReference({name:"JsonExtensionDataAttribute",namespace:"System.Text.Json.Serialization"}),JsonConverter:t=>this.csharp.classReference({name:"JsonConverter",namespace:"System.Text.Json.Serialization",generics:t?[t]:void 0}),JsonIgnore:()=>this.csharp.classReference({name:"JsonIgnoreAttribute",namespace:"System.Text.Json.Serialization"}),JsonPropertyName:()=>this.csharp.classReference({name:"JsonPropertyNameAttribute",namespace:"System.Text.Json.Serialization"})})})}),Threading:()=>J({CancellationToken:()=>this.csharp.classReference({name:"CancellationToken",namespace:"System.Threading"}),Tasks:()=>J({Task:t=>this.csharp.classReference({name:"Task",namespace:"System.Threading.Tasks",generics:t?[t]:void 0}),ValueTask:t=>this.csharp.classReference({name:"ValueTask",namespace:"System.Threading.Tasks",generics:t?[t]:void 0})})}),ComponentModel:()=>J({INotifyPropertyChanged:()=>this.csharp.classReference({name:"INotifyPropertyChanged",namespace:"System.ComponentModel"}),PropertyChangedEventHandler:()=>this.csharp.classReference({name:"PropertyChangedEventHandler",namespace:"System.ComponentModel"})}),IAsyncDisposable:()=>this.csharp.classReference({name:"IAsyncDisposable",namespace:"System"}),IDisposable:()=>this.csharp.classReference({name:"IDisposable",namespace:"System"})}));y(this,"NUnit",J({Framework:()=>J({TestFixture:()=>this.csharp.classReference({name:"TestFixture",namespace:"NUnit.Framework"}),Test:()=>this.csharp.classReference({name:"Test",namespace:"NUnit.Framework"}),OneTimeTearDown:()=>this.csharp.classReference({name:"OneTimeTearDown",namespace:"NUnit.Framework"}),OneTimeSetUp:()=>this.csharp.classReference({name:"OneTimeSetUp",namespace:"NUnit.Framework"}),SetUpFixture:()=>this.csharp.classReference({name:"SetUpFixture",namespace:"NUnit.Framework"}),Parallelizable:()=>this.csharp.classReference({name:"Parallelizable",namespace:"NUnit.Framework"})})}));y(this,"OneOf",J({OneOf:t=>this.csharp.classReference({name:"OneOf",namespace:"OneOf",generics:t}),OneOfBase:t=>this.csharp.classReference({name:"OneOfBase",namespace:"OneOf",generics:t})}));y(this,"Google",J({Protobuf:()=>J({ByteString:()=>this.csharp.classReference({name:"ByteString",namespace:"Google.Protobuf"}),WellKnownTypes:()=>J({Struct:()=>this.csharp.classReference({name:"Struct",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"}),Value:()=>this.csharp.classReference({name:"Value",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"}),ListValue:()=>this.csharp.classReference({name:"ListValue",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"}),Timestamp:()=>this.csharp.classReference({name:"Timestamp",namespace:"Google.Protobuf.WellKnownTypes",namespaceAlias:"WellKnownProto"})})})}));y(this,"WireMock",J({Server:()=>this.csharp.classReference({name:"WireMockServer",namespace:"WireMock.Server"}),WireMockServerSettings:()=>this.csharp.classReference({name:"WireMockServerSettings",namespace:"WireMock.Settings"}),WireMockConsoleLogger:()=>this.csharp.classReference({name:"WireMockConsoleLogger",namespace:"WireMock.Logging"})}));y(this,"Grpc",J({Core:()=>J({RpcException:()=>this.csharp.classReference({name:"RpcException",namespace:"Grpc.Core"})})}));this.generation=t}get csharp(){return this.generation.csharp}};n();a();s();var uc=new Set(["name","camelCase","snakeCase","screamingSnakeCase","pascalCase"]);function og(e,t){return uc.has(t)?e??"":e?`${e}.${t}`:t}var Oo=class{constructor(t,r){y(this,"generation");y(this,"indexByObject",new Map);y(this,"indexByPath",new Map);y(this,"explicitByObject",new Map);y(this,"explicitByPath",new Map);y(this,"root");y(this,"ir");this.generation=r,this.root=this.createIndex(t),this.ir=t}get csharp(){return this.generation.csharp}get registry(){return this.generation.registry}createIndex(t,r="",i){let o=og(i?.jsonPath,r);if(this.indexByPath.has(o)){i||de(`Parent provenance not found for node: ${JSON.stringify(t).substring(0,100)}`),this.indexByObject.set(t,i);let l=uc.has(r);for(let[b,w]of Object.entries(t))typeof w=="object"&&w!==null&&(l&&uc.has(b)?this.indexByObject.set(w,i):this.createIndex(w,b,i));return i}let p={jsonPath:o,name:r,node:t,parent:i};this.indexByObject.set(t,p),this.indexByPath.set(o,p);for(let[l,b]of Object.entries(t))typeof b=="object"&&b!==null&&this.createIndex(b,l,p);return p}staticExplicit(t){return this.explicit(this.ir,t)}explicit(t,r){let i=this.provenance(t)??de(`Provenance not found for node: ${JSON.stringify(t).substring(0,100)}`),o={...i,jsonPath:`${i.jsonPath}+${r}`,name:r,node:i.node,parent:i,explicit:!0},p=this.explicitByObject.get(i.node);return p?p.add(o):this.explicitByObject.set(i.node,new Set([o])),this.explicitByPath.set(o.jsonPath,o),o}provenance(t){if(t!==void 0)return v.string(t)?this.explicitByPath.get(t)??this.indexByPath.get(t):v.Provenance(t)?this.explicitByPath.get(t.jsonPath)??this.indexByPath.get(t.jsonPath):this.indexByObject.get(t)}origin(t){let r=this.provenance(t);return r?.explicit?r:r?.node}irNode(t){return this.provenance(t)?.node}jsonPath(t){return this.provenance(t)?.jsonPath}getEnumValueName(t,r){let i=v.IR.ExampleEnumType(r)?r.value:r,o=t.values.find(p=>this.nameEquals(p.name,i));return o?this.getPropertyNameFor(o):de(`Unexpected - can't find enum value ${JSON.stringify(i)} in enum`)}getPropertyNameFor(t){let r=this.registry.getFieldNameByOrigin(t);if(r)return r;if(v.Provenance(t))return t.name;if("name"in t){if(v.IR.NameAndWireValue(t.name))return this.generation.case.pascalSafe(t.name);if(v.IR.Name(t.name))return this.generation.case.pascalSafe(t.name);if(typeof t.name=="string")return this.generation.case.pascalSafe(t.name)}if("pascalCase"in t)return this.generation.case.pascalSafe(t);throw new Error(`Unknown property type: ${this.jsonPath(t)}`)}getClassNameFor(t){if(v.Provenance(t))return t.name;if("name"in t){if(v.IR.TypeDeclaration(t))return this.generation.case.pascalSafe(t.name.name);if(v.IR.NameAndWireValue(t.name))return this.generation.case.pascalSafe(t.name);if(v.IR.Name(t.name))return this.generation.case.pascalSafe(t.name);if(typeof t.name=="string")return this.generation.case.pascalSafe(t.name)}if("pascalCase"in t)return this.generation.case.pascalSafe(t);throw new Error(`Unknown property type: ${JSON.stringify(t)}`)}nameEquals(t,r){return this.generation.case.camelSafe(t)===this.generation.case.camelSafe(r)}dereferenceType(t){let r=v.string(t)?t:v.IR.NamedType(t)||v.IR.DeclaredTypeName(t)?t.typeId:v.IR.ExampleNamedType(t)?t.typeName.typeId:t.name.typeId,i=this.irNode(this.ir.types[r]);if(v.IR.TypeDeclaration(i))return{typeId:r,typeDeclaration:i};de(`dereferenceType: typeId ${r} not resolved.`)}};function Po(...e){return e.filter(Boolean).join("/")}var jn=class{constructor(t,r,i,o,p={makeRelativeFilePath:l=>l,makeAbsoluteFilePath:l=>l,getNamespaceForTypeId:l=>"",getDirectoryForTypeId:l=>"",getCoreAsIsFiles:()=>[],getCoreTestAsIsFiles:()=>[],getPublicCoreAsIsFiles:()=>[],getAsyncCoreAsIsFiles:()=>[],getChildNamespaceSegments:l=>[]}){y(this,"intermediateRepresentation");y(this,"apiName");y(this,"customConfig");y(this,"generatorConfig");y(this,"support");y(this,"ir");y(this,"dir");y(this,"csharp",new No(this));y(this,"registry",new Oi(this));y(this,"model");y(this,"case");y(this,"extern",new Ro(this));y(this,"settings",J({namespace:()=>this.customConfig.namespace??mo(ho(`${this.generatorConfig.organization}_${this.apiName}`)),readOnlyMemoryTypes:()=>this.customConfig["read-only-memory-types"]??[],simplifyObjectDictionaries:()=>this.customConfig["simplify-object-dictionaries"]??!1,useFullyQualifiedNamespaces:()=>this.customConfig["experimental-fully-qualified-namespaces"]??!1,useDotnetFormat:()=>this.customConfig["experimental-dotnet-format"]??!1,enableWebsockets:()=>this.customConfig["experimental-enable-websockets"]??!1,enableReadonlyConstants:()=>this.customConfig["experimental-readonly-constants"]??!1,generateLiterals:()=>this.customConfig["generate-literals"]??this.customConfig["experimental-readonly-constants"]??!1,enableExplicitNullableOptional:()=>this.customConfig["experimental-explicit-nullable-optional"]??!1,useDefaultRequestParameterValues:()=>this.customConfig["use-default-request-parameter-values"]??!1,redactResponseBodyOnError:()=>this.customConfig["redact-response-body-on-error"]??!1,enableInlineTypes:()=>this.customConfig["enable-inline-types"]??!1,temporaryWebsocketEnvironments:()=>this.customConfig["temporary-websocket-environments"]??{},baseApiExceptionClassName:()=>this.customConfig["base-api-exception-class-name"]??"",baseExceptionClassName:()=>this.customConfig["base-exception-class-name"]??"",shouldGeneratedDiscriminatedUnions:()=>this.customConfig["use-discriminated-unions"]??!0,shouldGenerateUndiscriminatedUnions:()=>this.customConfig["use-undiscriminated-unions"]??!1,dedupeUnionBaseProperties:()=>this.customConfig["dedupe-union-base-properties"]??!1,exportedClientClassName:()=>this.customConfig["exported-client-class-name"]??"",clientClassName:()=>this.customConfig["client-class-name"]??"",rootNamespaceForCoreClasses:()=>this.customConfig["root-namespace-for-core-classes"]??!0,packageId:()=>this.customConfig["package-id"]??"",isForwardCompatibleEnumsEnabled:()=>this.customConfig["enable-forward-compatible-enums"]??this.customConfig["experimental-enable-forward-compatible-enums"]??!0,websocketEnvironments:()=>this.customConfig["temporary-websocket-environments"]??{},customPagerName:()=>this.customConfig["custom-pager-name"]??"",usePageIndexSemantics:()=>this.customConfig["offset-semantics"]==="page-index",environmentClassName:()=>this.customConfig["environment-class-name"]??"",generateErrorTypes:()=>this.customConfig["generate-error-types"]??!0,shouldInlinePathParameters:()=>this.customConfig["inline-path-parameters"]??!0,includeExceptionHandler:()=>this.customConfig["include-exception-handler"]??!1,exceptionInterceptorClassName:()=>this.customConfig["exception-interceptor-class-name"]??"",shouldGenerateMockServerTests:()=>this.customConfig["generate-mock-server-tests"]??this.customConfig["enable-wire-tests"]??!0,rootClientAccess:()=>this.customConfig["root-client-class-access"]=="internal"?ge.Internal:ge.Public,extraDependencies:()=>this.customConfig["extra-dependencies"]??{},omitFernHeaders:()=>this.customConfig["omit-fern-headers"]??!1,preferExplicitAuth:()=>this.customConfig["prefer-explicit-auth"]??!1,includePlatformHeaders:()=>this.customConfig["include-platform-headers"]??!1,allowUserAgentAppInfo:()=>this.customConfig["allow-user-agent-app-info"]??!1,userAgentNameFromPackage:()=>this.customConfig["user-agent-name-from-package"]??!1,unifiedClientOptions:()=>this.customConfig["unified-client-options"]??!1,serverUrlVariables:()=>this.customConfig["server-url-variables"]??!0,pascalCaseEnvironments:()=>this.customConfig["pascal-case-environments"]??!0,slnFormat:()=>this.customConfig["sln-format"]??"slnx",explicitNamespaces:()=>this.customConfig["explicit-namespaces"]===!0,maxRetries:()=>this.customConfig.maxRetries,retryStatusCodes:()=>this.customConfig.retryStatusCodes??"legacy",defaultTimeoutInMilliseconds:()=>{let t=this.customConfig["default-timeout-in-milliseconds"];if(t!=null)return t;let r=this.customConfig["default-timeout-in-seconds"];if(r!=null)return r==="infinity"?"infinity":r*1e3},outputPath:()=>{let t=this.customConfig["output-path"];return t==null?{library:"src",test:"src",solution:".",other:"."}:typeof t=="string"?{library:t,test:t,solution:".",other:"."}:{library:t.library??"src",test:t.test??"src",solution:t.solution??".",other:t.other??"."}}}));y(this,"constants",{folders:J({mockServerTests:()=>this.support.makeRelativeFilePath("Unit/MockServer"),types:()=>"Types",exceptions:()=>"Exceptions",src:()=>"src",protobuf:()=>"proto",serializationTests:()=>this.support.makeRelativeFilePath("Unit/Serialization"),project:()=>this.support.makeRelativeFilePath(Po(this.constants.folders.sourceFiles,this.support.makeRelativeFilePath(this.names.files.project))),sourceFiles:()=>this.support.makeRelativeFilePath(this.constants.folders.src),coreFiles:()=>this.support.makeRelativeFilePath(Po(this.constants.folders.project,this.support.makeRelativeFilePath(this.constants.defaults.core))),publicCoreFiles:()=>this.support.makeRelativeFilePath(Po(this.constants.folders.project,this.support.makeRelativeFilePath(this.constants.defaults.core),this.support.makeRelativeFilePath(this.constants.defaults.publicCore))),testFiles:()=>this.support.makeRelativeFilePath(Po(this.constants.folders.sourceFiles,this.support.makeRelativeFilePath(this.names.files.testProject)))}),formatting:J({indent:()=>" "}),defaults:J({core:()=>"Core",publicCore:()=>"Public",version:()=>"0.0.0"})});y(this,"namespaces",J({root:()=>this.settings.namespace,core:()=>`${this.namespaces.root}.Core`,qualifiedRoot:()=>this.qualifyNamespace(this.namespaces.root),qualifiedCore:()=>this.qualifyNamespace(this.namespaces.core),test:()=>this.registry.canonicalizeNamespace(`${this.namespaces.root}.Test`),testUtils:()=>`${this.namespaces.test}.Utils`,mockServerTest:()=>`${this.namespaces.test}.Unit.MockServer`,publicCore:()=>this.namespaces.root,webSocketsCore:()=>`${this.namespaces.core}.WebSockets`,publicCoreTest:()=>`${this.namespaces.root}.Test.PublicCore`,asIsTestUtils:()=>`${this.namespaces.root}.Test.Utils`,publicCoreClasses:()=>this.settings.rootNamespaceForCoreClasses?this.namespaces.root:this.namespaces.core,implicit:()=>new Set(["System","System.Collections.Generic","System.IO","System.Linq","System.Threading","System.Threading.Tasks","System.Net.Http"])}));y(this,"names",{classes:J({baseApiException:()=>this.settings.baseApiExceptionClassName||`${this.names.project.clientPrefix}ApiException`,baseException:()=>this.settings.baseExceptionClassName||`${this.names.project.clientPrefix}Exception`,rootClient:()=>this.settings.clientClassName||`${this.names.project.clientPrefix}Client`,rootClientForSnippets:()=>this.settings.exportedClientClassName||this.names.classes.rootClient,customPager:()=>this.settings.customPagerName||`${this.names.project.packageId.replace(/[^a-zA-Z0-9]/g,"")}Pager`,environment:()=>this.settings.environmentClassName||`${this.names.project.clientPrefix}Environment`,exceptionInterceptor:()=>this.settings.exceptionInterceptorClassName||`${this.names.project.packageId.replace(/[^a-zA-Z0-9]/g,"")}ExceptionInterceptor`}),project:J({client:()=>mo(ho(`${this.generatorConfig.organization}_${this.generatorConfig.workspaceName}`)),clientPrefix:()=>this.settings.exportedClientClassName||this.settings.clientClassName||this.names.project.client,packageId:()=>this.settings.packageId||ud(this.ir)?.packageName||this.namespaces.root}),files:J({project:()=>this.namespaces.root,testProject:()=>`${this.namespaces.root}.Test`}),methods:J({mockOauth:()=>"MockOAuthEndpoint",mockInferredAuth:()=>"MockInferredAuthEndpoint",getAccessTokenAsync:()=>"GetAccessTokenAsync",getAuthHeadersAsync:()=>"GetAuthHeadersAsync"}),variables:J({client:()=>"client",response:()=>"response",httpRequest:()=>"httpRequest",sendRequest:()=>"sendRequest",responseBody:()=>"responseBody",query:()=>"_query",headers:()=>"_headers"}),parameters:J({cancellationToken:()=>"cancellationToken",requestOptions:()=>"options",idempotentOptions:()=>"options"})});y(this,"Types",J({Arbitrary:t=>new re.ArbitraryType(t,this),HttpMethodExtensions:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("HttpMethodExtensions")}),FormRequest:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("FormRequest")}),Optional:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("Optional")}),ClientOptions:()=>this.csharp.classReference({origin:this.model.staticExplicit("ClientOptions"),namespace:this.namespaces.publicCoreClasses}),AppInfo:()=>this.csharp.classReference({origin:this.model.staticExplicit("AppInfo"),namespace:this.namespaces.publicCoreClasses}),RawClient:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("RawClient")}),RequestOptions:()=>this.csharp.classReference({namespace:this.namespaces.publicCoreClasses,origin:this.model.staticExplicit("RequestOptions")}),RequestOptionsInterface:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("IRequestOptions")}),JsonRequest:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("JsonRequest")}),Version:()=>this.csharp.classReference({namespace:this.namespaces.publicCore,origin:this.model.staticExplicit("Version")}),ValueConvert:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("ValueConvert")}),FileParameter:()=>this.csharp.classReference({namespace:this.namespaces.publicCore,origin:this.model.staticExplicit("FileParameter"),multipartMethodName:"AddFileParameterPart",multipartMethodNameForCollection:"AddFileParameterParts",isReferenceType:!0}),DefaultHttpClientFactory:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("DefaultHttpClientFactory")}),Headers:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("Headers")}),HeaderValue:()=>this.csharp.classReference({namespace:this.namespaces.core,origin:this.model.staticExplicit("HeaderValue")}),RootClient:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.rootClient),namespace:this.namespaces.root}),RootClientForSnippets:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.rootClientForSnippets),namespace:this.namespaces.root}),BaseApiException:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.baseApiException),namespace:this.namespaces.publicCoreClasses}),BaseException:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.baseException),namespace:this.namespaces.publicCoreClasses}),ExceptionInterceptor:()=>this.csharp.classReference({origin:this.model.staticExplicit("IExceptionInterceptor"),namespace:this.namespaces.core}),ExceptionHandler:()=>this.csharp.classReference({origin:this.model.staticExplicit("ExceptionHandler"),namespace:this.namespaces.core}),CustomExceptionInterceptor:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.exceptionInterceptor),namespace:this.namespaces.core}),ProtoAnyMapper:()=>this.csharp.classReference({origin:this.model.staticExplicit("ProtoAnyMapper"),namespace:this.namespaces.core}),Constants:()=>this.csharp.classReference({origin:this.model.staticExplicit("Constants"),namespace:this.namespaces.core}),DateTimeSerializer:()=>this.csharp.classReference({origin:this.model.staticExplicit("DateTimeSerializer"),namespace:this.namespaces.core}),JsonUtils:()=>this.csharp.classReference({origin:this.model.staticExplicit("JsonUtils"),namespace:this.namespaces.core}),JsonAssert:()=>this.csharp.classReference({origin:this.model.staticExplicit("JsonAssert"),namespace:this.namespaces.testUtils}),CustomPagerFactory:()=>this.csharp.classReference({origin:this.model.staticExplicit(`${this.names.classes.customPager}Factory`),namespace:this.namespaces.core}),CustomPagerContext:()=>this.csharp.classReference({origin:this.model.staticExplicit(`${this.names.classes.customPager}Context`),namespace:this.namespaces.core}),Environments:()=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.environment),namespace:this.namespaces.publicCoreClasses}),TestClient:()=>this.csharp.classReference({origin:this.model.staticExplicit("TestClient"),namespace:this.namespaces.test}),BaseMockServerTest:()=>this.csharp.classReference({origin:this.model.staticExplicit("BaseMockServerTest"),namespace:this.namespaces.mockServerTest}),IdempotentRequestOptions:()=>this.csharp.classReference({origin:this.model.staticExplicit("IdempotentRequestOptions"),namespace:this.namespaces.publicCoreClasses}),IdempotentRequestOptionsInterface:()=>this.csharp.classReference({origin:this.model.staticExplicit("IIdempotentRequestOptions"),namespace:this.namespaces.core}),IStringEnum:()=>this.csharp.classReference({origin:this.model.staticExplicit("IStringEnum"),namespace:this.namespaces.core}),WebSocketClient:()=>this.csharp.classReference({origin:this.model.staticExplicit("WebSocketClient"),namespace:this.namespaces.webSocketsCore}),QueryBuilder:()=>this.csharp.classReference({origin:this.model.staticExplicit("Query"),namespace:this.namespaces.webSocketsCore}),QueryStringBuilder:()=>this.csharp.classReference({origin:this.model.staticExplicit("QueryStringBuilder"),namespace:this.namespaces.core}),QueryStringBuilderBuilder:()=>this.csharp.classReference({origin:this.model.staticExplicit("QueryStringBuilder.Builder"),namespace:this.namespaces.core}),OAuthTokenProvider:()=>this.csharp.classReference({origin:this.model.staticExplicit("OAuthTokenProvider"),namespace:this.namespaces.core}),InferredAuthTokenProvider:()=>this.csharp.classReference({origin:this.model.staticExplicit("InferredAuthTokenProvider"),namespace:this.namespaces.core}),ProtoConverter:()=>this.csharp.classReference({origin:this.model.staticExplicit("ProtoConverter"),namespace:this.namespaces.core}),RawGrpcClient:()=>this.csharp.classReference({origin:this.model.staticExplicit("RawGrpcClient"),namespace:this.namespaces.core}),Extensions:()=>this.csharp.classReference({origin:this.model.staticExplicit("Extensions"),namespace:this.namespaces.core}),GrpcRequestOptions:()=>this.csharp.classReference({origin:this.model.staticExplicit("GrpcRequestOptions"),namespace:this.namespaces.root}),GrpcChannelOptions:()=>this.csharp.classReference({origin:this.model.staticExplicit("GrpcChannelOptions"),namespace:"Grpc.Net.Client"}),StringEnum:t=>this.csharp.classReference({origin:this.model.staticExplicit("StringEnum"),namespace:this.namespaces.core,generics:t?[t]:void 0}),WebSocketEvent:t=>this.csharp.classReference({origin:this.model.staticExplicit("Event"),namespace:this.namespaces.webSocketsCore,generics:[t]}),ConnectionStatus:()=>this.csharp.classReference({origin:this.model.staticExplicit("ConnectionStatus"),namespace:this.namespaces.webSocketsCore}),WebSocketConnected:()=>this.csharp.classReference({origin:this.model.staticExplicit("Connected"),namespace:this.namespaces.webSocketsCore}),WebSocketClosed:()=>this.csharp.classReference({origin:this.model.staticExplicit("Closed"),namespace:this.namespaces.webSocketsCore}),ReconnectionInfo:()=>this.csharp.classReference({origin:this.model.staticExplicit("ReconnectionInfo"),namespace:this.namespaces.webSocketsCore}),CustomPagerClass:t=>this.csharp.classReference({origin:this.model.staticExplicit(this.names.classes.customPager),namespace:this.namespaces.core,generics:[t]}),Pager:t=>this.csharp.classReference({origin:this.model.staticExplicit("Pager"),namespace:this.namespaces.core,generics:[t]}),OffsetPager:({requestType:t,requestOptionsType:r,responseType:i,offsetType:o,stepType:p,itemType:l})=>this.csharp.classReference({origin:this.model.staticExplicit("OffsetPager"),namespace:this.namespaces.core,generics:[t,r,i,o,p,l]}),CursorPager:({requestType:t,requestOptionsType:r,responseType:i,cursorType:o,itemType:p})=>this.csharp.classReference({origin:this.model.staticExplicit("CursorPager"),namespace:this.namespaces.core,generics:[t,r,i,o,p]}),CollectionItemSerializer:(t,r)=>this.csharp.classReference({origin:this.model.staticExplicit("CollectionItemSerializer"),namespace:this.namespaces.core,generics:[t,r]}),OneOfSerializer:t=>this.csharp.classReference({origin:this.model.staticExplicit("OneOfSerializer"),namespace:this.namespaces.core,generics:[t]}),AdditionalProperties:t=>this.csharp.classReference({origin:this.model.staticExplicit("AdditionalProperties"),namespace:this.namespaces.publicCore,generics:t?[t]:void 0}),ReadOnlyAdditionalProperties:t=>this.csharp.classReference({origin:this.model.staticExplicit("ReadOnlyAdditionalProperties"),namespace:this.namespaces.publicCore,generics:t?[t]:void 0})}));y(this,"Primitive",J({string:()=>new re.String(this),boolean:()=>new re.Boolean(this),integer:()=>new re.Integer(this),long:()=>new re.Long(this),uint:()=>new re.Uint(this),ulong:()=>new re.ULong(this),float:()=>new re.Float(this),double:()=>new re.Double(this),object:()=>new re.Object(this)}));y(this,"Value",J({binary:()=>new Ue.Binary(this),dateOnly:()=>new Ue.DateOnly(this),dateTime:()=>new Ue.DateTime(this),uuid:()=>new Ue.Uuid(this),stringEnum:t=>new Ue.StringEnum(t,this)}));y(this,"Collection",J({array:t=>new we.Array(t,this),listType:t=>new we.ListType(t,this),list:t=>new we.List(t,this),set:t=>new we.Set(t,this),map:(t,r,i)=>new we.Map(t,r,this,i),idictionary:(t,r,i)=>new we.IDictionary(t,r,this,i),keyValuePair:(t,r)=>new we.KeyValuePair(t,r,this)}));y(this,"format",J({private:t=>`_${yo.camelCase(t)}`}));y(this,"initializers",J({implicitNamespaces:()=>{for(let t of this.namespaces.implicit)this.registry.addImplicitNamespace(t);return!0}}));this.intermediateRepresentation=t,this.apiName=r,this.customConfig=i,this.generatorConfig=o,this.support=p;let l=v.IR.IntermediateRepresentation(t)?t.casingsConfig:void 0;this.case=new Hi({generationLanguage:"csharp",keywords:l?.keywords,smartCasing:l?.smartCasing??!0}),this.model=new Oo(t,this),this.ir=v.IR.IntermediateRepresentation(t)?t:{},this.dir=v.DynamicIR.DynamicIntermediateRepresentation(t)?t:{}}initialize(){return this.initializers.implicitNamespaces}get System(){return this.extern.System}get NUnit(){return this.extern.NUnit}get OneOf(){return this.extern.OneOf}get Google(){return this.extern.Google}get Grpc(){return this.extern.Grpc}get WireMock(){return this.extern.WireMock}qualifyNamespace(t){let r=t.split(".")[0];return r&&this.registry.hasTypeNamespaceConflict(r)?`global::${t}`:t}};n();a();s();var Ze=class{constructor(t){y(this,"generation");this.generation=t}get csharp(){return this.generation.csharp}get case(){return this.generation.case}get settings(){return this.generation.settings}get constants(){return this.generation.constants}get namespaces(){return this.generation.namespaces}get names(){return this.generation.names}get model(){return this.generation.model}get format(){return this.generation.format}get registry(){return this.generation.registry}get Types(){return this.generation.Types}get System(){return this.generation.extern.System}get NUnit(){return this.generation.extern.NUnit}get OneOf(){return this.generation.extern.OneOf}get Google(){return this.generation.extern.Google}get Grpc(){return this.generation.extern.Grpc}get WireMock(){return this.generation.extern.WireMock}get Primitive(){return this.generation.Primitive}get Value(){return this.generation.Value}get Collection(){return this.generation.Collection}};n();a();s();var Co=class extends Ze{constructor({context:r}){super(r.generation);y(this,"context");this.context=r}convert(r){if(r.value===null)return this.context.isNullable(r.typeReference)?this.csharp.Literal.null():(this.context.errors.add({severity:te.Critical,message:"Expected non-null value, but got null"}),this.csharp.Literal.nop());if(r.value===void 0&&!r.fallbackToDefault)return this.csharp.Literal.nop();switch(r.typeReference.type){case"list":return this.convertList({list:r.typeReference.value,value:r.value,fallbackToDefault:r.fallbackToDefault});case"literal":return this.convertLiteral({literal:r.typeReference.value,fallbackToDefault:r.forceLiteral?r.fallbackToDefault:void 0,value:r.value,forceLiteral:r.forceLiteral});case"map":return this.convertMap({map:r.typeReference,value:r.value,fallbackToDefault:r.fallbackToDefault});case"named":{let i=this.context.resolveNamedType({typeId:r.typeReference.value});return i==null?this.csharp.Literal.nop():this.convertNamed({named:i,value:r.value,as:r.as,fallbackToDefault:r.fallbackToDefault})}case"nullable":return this.convert({typeReference:r.typeReference.value,value:r.value,as:r.as,forceLiteral:r.forceLiteral});case"optional":return this.convert({typeReference:r.typeReference.value,value:r.value,as:r.as,forceLiteral:r.forceLiteral});case"primitive":return this.convertPrimitive({primitive:r.typeReference.value,value:r.value,as:r.as,fallbackToDefault:r.fallbackToDefault});case"set":return this.convertSet({set:r.typeReference.value,value:r.value,fallbackToDefault:r.fallbackToDefault});case"unknown":return this.convertUnknown({value:r.value,fallbackToDefault:r.fallbackToDefault});default:ue(r.typeReference)}}convertList({list:r,value:i,fallbackToDefault:o}){return Array.isArray(i)?this.csharp.Literal.list({valueType:this.context.dynamicTypeMapper.convert({typeReference:r,unboxOptionals:!0}),values:i.map((p,l)=>{this.context.errors.scope({index:l});try{return this.convert({typeReference:r,value:p})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:te.Critical,message:`Expected array but got: ${typeof i}`}),this.csharp.Literal.nop())}convertLiteral({literal:r,value:i,fallbackToDefault:o,forceLiteral:p}){if(this.settings.generateLiterals&&!p)return this.csharp.Literal.nop();switch(r.type){case"boolean":{let l=this.context.getValueAsBoolean({value:i});return l==null?this.csharp.Literal.nop():this.csharp.Literal.boolean(l)}case"string":{let l=this.context.getValueAsString({value:i});return l==null?o?this.Primitive.string.getDeterminsticDefault(o):this.csharp.Literal.nop():this.csharp.Literal.string(l)}default:ue(r)}}convertSet({set:r,value:i,fallbackToDefault:o}){return Array.isArray(i)?this.csharp.Literal.set({valueType:this.context.dynamicTypeMapper.convert({typeReference:r,unboxOptionals:!0}),values:i.map((p,l)=>{this.context.errors.scope({index:l});try{return this.convert({typeReference:r,value:p})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:te.Critical,message:`Expected array but got: ${typeof i}`}),this.csharp.Literal.nop())}convertMap({map:r,value:i,fallbackToDefault:o}){return typeof i!="object"||i==null?(this.context.errors.add({severity:te.Critical,message:`Expected object but got: ${i==null?"null":typeof i}`}),this.csharp.Literal.nop()):this.csharp.Literal.dictionary({keyType:this.context.dynamicTypeMapper.convert({typeReference:r.key}),valueType:r.value.type==="unknown"?this.context.dynamicTypeMapper.convert({typeReference:r.value}).asOptional():this.context.dynamicTypeMapper.convert({typeReference:r.value}),entries:Object.entries(i).map(([p,l])=>{this.context.errors.scope(p);try{return{key:this.convert({typeReference:r.key,value:p,as:"key"}),value:this.convert({typeReference:r.value,value:l})}}finally{this.context.errors.unscope()}})})}convertNamed({named:r,value:i,as:o,fallbackToDefault:p}){switch(r.type){case"alias":return this.settings.generateLiterals&&r.typeReference.type==="literal"?this.csharp.Literal.reference(this.csharp.instantiateClass({classReference:this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),arguments_:[]})):this.convert({typeReference:r.typeReference,value:i,as:o,fallbackToDefault:p});case"discriminatedUnion":return this.settings.shouldGeneratedDiscriminatedUnions?this.convertDiscriminatedUnion({discriminatedUnion:r,value:i,fallbackToDefault:p}):this.convertUnknown({value:i,fallbackToDefault:p});case"enum":return this.getEnumValue(r,i);case"object":return this.convertObject({object_:r,value:i,fallbackToDefault:p});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:r,value:i,fallbackToDefault:p});default:ue(r)}}convertDiscriminatedUnion({discriminatedUnion:r,value:i,fallbackToDefault:o}){let p=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),l=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:r,value:i});if(l==null)return this.csharp.Literal.nop();let b=l.singleDiscriminatedUnionType,w=this.getBaseProperties({discriminatedUnionTypeInstance:l,singleDiscriminatedUnionType:b});switch(b.type){case"samePropertiesAsObject":{let A=this.context.resolveNamedType({typeId:b.typeId});return A==null?this.csharp.Literal.nop():this.instantiateUnionWithBaseProperties({classReference:p,baseProperties:w,arguments_:[this.convertNamed({named:A,value:l.value})]})}case"singleProperty":{if(this.context.getRecord(l.value)==null)return this.csharp.Literal.nop();try{let I=["Value","Type"].includes(b.discriminantValue.name.pascalCase.safeName)?`${b.discriminantValue.name.pascalCase.safeName}Inner`:b.discriminantValue.name.pascalCase.safeName;return this.context.errors.scope(b.discriminantValue.wireValue),this.instantiateUnionWithBaseProperties({classReference:p,baseProperties:w,arguments_:[this.csharp.instantiateClass({classReference:this.csharp.classReference({name:I,enclosingType:p}),arguments_:[this.convert({typeReference:b.typeReference,value:b.discriminantValue.wireValue})]})]})}finally{this.context.errors.unscope()}}case"noProperties":return this.instantiateUnionWithBaseProperties({classReference:p,baseProperties:w,arguments_:[this.csharp.instantiateClass({classReference:this.csharp.classReference({origin:l.discriminantValue,enclosingType:p}),arguments_:[]})]});default:ue(b)}}getBaseProperties({discriminatedUnionTypeInstance:r,singleDiscriminatedUnionType:i}){return this.context.associateByWireValue({parameters:i.properties??[],values:this.context.getRecord(r.value)??{},ignoreMissingParameters:!0}).map(p=>{this.context.errors.scope(p.name.wireValue);try{return{name:this.context.getPropertyName(p.name.name),assignment:this.convert(p)}}finally{this.context.errors.unscope()}})}instantiateUnionWithBaseProperties({classReference:r,arguments_:i,baseProperties:o}){let p=this.csharp.instantiateClass({classReference:r,arguments_:i,multiline:!0});return o.length===0?this.csharp.Literal.reference(p):this.csharp.Literal.reference(this.csharp.codeblock(l=>{l.write(p," "),l.pushScope();for(let b of o)l.write(b.name," = ",b.assignment,",");l.popScope(!1)}))}getEnumValue(r,i){if(typeof i!="string")return this.context.errors.add({severity:te.Critical,message:`Expected enum value string, got: ${typeof i}`}),this.csharp.Literal.nop();let o=r.values.find(b=>b.wireValue===i);if(o==null)return this.context.errors.add({severity:te.Critical,message:`An enum value named "${i}" does not exist in this context`}),this.csharp.Literal.nop();let p=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),l=p.registerField(this.model.getPropertyNameFor(o),o);return this.csharp.Literal.reference(this.csharp.enumInstantiation({reference:p,value:l}))}convertObject({object_:r,value:i,fallbackToDefault:o}){let p=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),l=this.getOmittedBasePropertyWireValues(r),b=l.size===0?r.properties:r.properties.filter(F=>!l.has(F.name.wireValue)),w=new Map;for(let F of b){let U=this.context.resolvePropertyName(p,F.name.name);w.set(F.name.wireValue,U)}let A=this.context.getRecord(i)??{},I=l.size===0?A:Object.fromEntries(Object.entries(A).filter(([F])=>!l.has(F))),L=this.context.associateByWireValue({parameters:b,values:I}).map(F=>{this.context.errors.scope(F.name.wireValue);try{return{name:w.get(F.name.wireValue)??this.context.getClassName(F.name.name),value:this.convert(F)}}finally{this.context.errors.unscope()}}),O=new Set(Object.keys(I));for(let F of b){let U=w.get(F.name.wireValue)??this.context.getClassName(F.name.name);if(O.has(F.name.wireValue)){if(this.isRequiredProperty(F.typeReference)){let M=L.find(W=>W.name===U);if(M!=null&&v.Literal.nop(M.value)){let W=this.getDefaultLiteralForType(F.typeReference);W!=null&&(M.value=W)}}continue}if(this.isRequiredProperty(F.typeReference)){let M=this.getDefaultLiteralForType(F.typeReference);M!=null&&L.push({name:U,value:M})}}return this.csharp.Literal.class_({reference:p,fields:L})}getOmittedBasePropertyWireValues(r){return this.settings.dedupeUnionBaseProperties?new Set((r.deferredUnionBaseProperties??[]).map(i=>i.wireValue)):new Set}isRequiredProperty(r){return!(this.context.isOptional(r)||this.context.isNullable(r)||r.type==="list"||r.type==="set"||r.type==="map")}getDefaultLiteralForType(r,i){switch(r.type){case"primitive":return this.getDefaultLiteralForPrimitive(r.value);case"literal":return this.convertLiteral({literal:r.value,value:r.value.value});case"named":{let o=this.context.resolveNamedType({typeId:r.value});if(o==null)return;if(o.type==="alias")return this.getDefaultLiteralForType(o.typeReference,i);if(o.type==="enum"&&o.values.length>0){let p=o.values[0];if(p!=null)return this.getEnumValue(o,p.wireValue)}return o.type==="undiscriminatedUnion"?this.getDefaultLiteralForUndiscriminatedUnion(o,i):o.type==="object"?this.getDefaultLiteralForObject(o,r.value,i):void 0}default:return}}getDefaultLiteralForObject(r,i,o){let p=o??new Set;if(p.has(i))return;p.add(i);let l=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),b=[];for(let w of r.properties)if(this.isRequiredProperty(w.typeReference)){let A=this.getDefaultLiteralForType(w.typeReference,p);A!=null&&b.push({name:this.context.resolvePropertyName(l,w.name.name),value:A})}return p.delete(i),this.csharp.Literal.class_({reference:l,fields:b})}getDefaultLiteralForUndiscriminatedUnion(r,i){for(let o of r.types){let p=this.getDefaultLiteralForType(o,i);if(p!=null)return p}}getDefaultLiteralForPrimitive(r){switch(r){case"INTEGER":return this.csharp.Literal.integer(0);case"LONG":return this.csharp.Literal.long(0);case"UINT":return this.csharp.Literal.uint(0);case"UINT_64":return this.csharp.Literal.ulong(0);case"FLOAT":return this.csharp.Literal.float(0);case"DOUBLE":return this.csharp.Literal.double(0);case"BOOLEAN":return this.csharp.Literal.boolean(!1);case"STRING":case"UUID":case"BASE_64":case"BIG_INTEGER":return this.csharp.Literal.string("");case"DATE":return this.csharp.Literal.date("0001-01-01");case"DATE_TIME":case"DATE_TIME_RFC_2822":return this.csharp.Literal.datetime("0001-01-01T00:00:00.000Z");default:ue(r)}}convertUndiscriminatedUnion({undiscriminatedUnion:r,value:i,fallbackToDefault:o}){let p=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:r,value:i});return p==null?this.csharp.Literal.nop():p.typeLiteral}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:r,value:i}){for(let o of r.types){let p=this.context.errors.size();try{let l=this.convert({typeReference:o,value:i});if(v.Literal.nop(l)||this.context.errors.size()>p){this.context.errors.truncate(p);continue}return{valueTypeReference:o,typeLiteral:l}}catch{this.context.errors.truncate(p);continue}}this.context.errors.add({severity:te.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof i}" value`})}convertUnknown({value:r,fallbackToDefault:i}){return this.csharp.Literal.unknown(r)}convertPrimitive({primitive:r,value:i,as:o,fallbackToDefault:p}){switch(r){case"INTEGER":{let l=this.getValueAsNumber({value:i,as:o});return l==null?p?this.Primitive.integer.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.integer(l)}case"LONG":{let l=this.getValueAsNumber({value:i,as:o});return l==null?p?this.Primitive.long.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.long(l)}case"UINT":{let l=this.getValueAsNumber({value:i,as:o});return l==null?p?this.Primitive.uint.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.uint(l)}case"UINT_64":{let l=this.getValueAsNumber({value:i,as:o});return l==null?p?this.Primitive.ulong.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.ulong(l)}case"FLOAT":{let l=this.getValueAsNumber({value:i,as:o});return l==null?p?this.Primitive.float.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.float(l)}case"DOUBLE":{let l=this.getValueAsNumber({value:i,as:o});return l==null?p?this.Primitive.double.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.double(l)}case"BOOLEAN":{let l=this.getValueAsBoolean({value:i,as:o});return l==null?p?this.Primitive.boolean.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.boolean(l)}case"STRING":{let l=this.context.getValueAsString({value:i});return l==null?p?this.Primitive.string.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.string(l)}case"DATE":{let l=this.context.getValueAsString({value:i});return l==null?p?this.Value.dateOnly.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.date(l)}case"DATE_TIME":case"DATE_TIME_RFC_2822":{let l=this.context.getValueAsString({value:i});return l==null?p?this.Value.dateTime.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.datetime(l)}case"UUID":{let l=this.context.getValueAsString({value:i});return l==null?p?this.Primitive.string.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.string(l)}case"BASE_64":{let l=this.context.getValueAsString({value:i});return l==null?p?this.Primitive.string.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.string(l)}case"BIG_INTEGER":{let l=this.context.getValueAsString({value:i});return l==null?p?this.Primitive.string.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.string(l)}default:ue(r)}}getValueAsNumber({value:r,as:i}){let o=i==="key"&&typeof r=="string"?Number(r):r;return this.context.getValueAsNumber({value:o})}getValueAsBoolean({value:r,as:i}){let o=i==="key"?typeof r=="string"?r==="true":r==="false"?!1:r:r;return this.context.getValueAsBoolean({value:o})}};n();a();s();var _o=class extends Ze{constructor({context:r}){super(r.generation);y(this,"context");this.context=r}convert(r){switch(r.typeReference.type){case"list":return this.Collection.list(this.convert({typeReference:r.typeReference.value,unboxOptionals:!0}));case"literal":return this.convertLiteral({literal:r.typeReference.value});case"map":return this.Collection.map(this.convert({typeReference:r.typeReference.key}),this.convert({typeReference:r.typeReference.value}));case"named":{let i=this.context.resolveNamedType({typeId:r.typeReference.value});return i==null?this.convertUnknown():this.convertNamed({named:i,typeId:r.typeReference.value})}case"optional":case"nullable":{let i=this.convert({typeReference:r.typeReference.value});return r.unboxOptionals?i.asNonOptional():i.asOptional()}case"primitive":return this.convertPrimitive({primitive:r.typeReference.value});case"set":return this.Collection.set(this.convert({typeReference:r.typeReference.value,unboxOptionals:!0}));case"unknown":return this.convertUnknown();default:ue(r.typeReference)}}convertToClassReference(r,i){return this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)})}convertNamed({named:r,typeId:i}){switch(r.type){case"alias":return this.settings.generateLiterals&&r.typeReference.type==="literal"?this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}):this.convert({typeReference:r.typeReference});case"enum":case"object":return this.convertToClassReference(r,i);case"discriminatedUnion":return this.settings.shouldGeneratedDiscriminatedUnions?this.convertToClassReference(r,i):this.Primitive.object;case"undiscriminatedUnion":return this.settings.shouldGenerateUndiscriminatedUnions?this.convertToClassReference(r,i):this.OneOf.OneOf(r.types.map(o=>this.convert({typeReference:o})));default:ue(r)}}convertLiteral({literal:r}){switch(r.type){case"boolean":return this.Primitive.boolean;case"string":return this.Primitive.string}}convertUnknown(){return this.Primitive.object}convertPrimitive({primitive:r}){switch(r){case"INTEGER":return this.Primitive.integer;case"UINT":return this.Primitive.uint;case"LONG":return this.Primitive.long;case"UINT_64":return this.Primitive.ulong;case"FLOAT":return this.Primitive.float;case"DOUBLE":return this.Primitive.double;case"BOOLEAN":return this.Primitive.boolean;case"STRING":return this.Primitive.string;case"DATE":return this.Value.dateOnly;case"DATE_TIME":case"DATE_TIME_RFC_2822":return this.Value.dateTime;case"UUID":return this.Primitive.string;case"BASE_64":return this.Primitive.string;case"BIG_INTEGER":return this.Primitive.string;default:ue(r)}}};n();a();s();var ko=class extends Ze{constructor({context:r}){super(r.generation);y(this,"context");this.context=r}getFilePropertyInfo({body:r,value:i}){let o={fileFields:[],bodyPropertyFields:[]},p=this.context.getRecord(i)??{};for(let l of r.properties)switch(l.type){case"file":v.Record.missingKey(p,l.wireValue)&&(p[l.wireValue]="[bytes]"),o.fileFields.push({name:this.context.getPropertyName(l.name),value:this.getSingleFileProperty({property:l,record:p})});break;case"fileArray":v.Record.missingKey(p,l.wireValue)&&(p[l.wireValue]=["[bytes]"]),o.fileFields.push({name:this.context.getPropertyName(l.name),value:this.getArrayFileProperty({property:l,record:p})});break;case"bodyProperty":if(v.Record.missingKey(p,l.name.wireValue))switch(l.typeReference.type){case"optional":break;case"primitive":{switch(l.typeReference.value.toLowerCase()){case"integer":{p[l.name.wireValue]=123;break}case"string":{p[l.name.wireValue]="[string]";break}case"boolean":{p[l.name.wireValue]=!0;break}case"double":{p[l.name.wireValue]=123.456;break}case"float":{p[l.name.wireValue]=123.456;break}case"long":{p[l.name.wireValue]=123456789;break}case"uint":{p[l.name.wireValue]=123;break}case"uint64":{p[l.name.wireValue]=12345;break}case"date":{p[l.name.wireValue]=new Date(2021,1,1);break}case"datetime":{p[l.name.wireValue]=new Date(2021,1,1,12,0,0);break}case"uuid":{p[l.name.wireValue]="123e4567-e89b-12d3-a456-426614174000";break}case"base64":{p[l.name.wireValue]="SGVsbG8gd29ybGQh";break}case"biginteger":{p[l.name.wireValue]="12345678901234567890";break}}break}default:break}o.bodyPropertyFields.push({name:this.context.getPropertyName(l.name.name),value:this.getBodyProperty({property:l,record:p})});break;default:ue(l)}return o}getSingleFileProperty({property:r,record:i}){let o=this.context.getSingleFileValue({property:r,record:i});return o==null?this.csharp.Literal.nop():this.context.getFileParameterForString(o)}getArrayFileProperty({property:r,record:i}){let o=this.context.getFileArrayValues({property:r,record:i});return o==null?this.csharp.Literal.nop():this.csharp.Literal.list({valueType:this.Types.FileParameter,values:o.map(p=>this.context.getFileParameterForString(p))})}getBodyProperty({property:r,record:i}){let o=i[r.name.wireValue];return o==null?this.csharp.Literal.nop():this.context.dynamicLiteralMapper.convert({typeReference:r.typeReference,value:o})}};var Fo=class e extends en{constructor({ir:r,config:i,options:o,generation:p}){super({ir:r,config:i,options:o});y(this,"ir");y(this,"dynamicTypeMapper");y(this,"dynamicLiteralMapper");y(this,"filePropertyMapper");y(this,"generation");this.ir=r,this.generation=p??new jn(r,i.workspaceName,i.customConfig!=null?i.customConfig:{},i),this.dynamicTypeMapper=new _o({context:this}),this.dynamicLiteralMapper=new Co({context:this}),this.filePropertyMapper=new ko({context:this})}get namespaces(){return this.generation.namespaces}get registry(){return this.generation.registry}get settings(){return this.generation.settings}get constants(){return this.generation.constants}get names(){return this.generation.names}get model(){return this.generation.model}get format(){return this.generation.format}get csharp(){return this.generation.csharp}get Types(){return this.generation.Types}get System(){return this.generation.extern.System}get NUnit(){return this.generation.extern.NUnit}get OneOf(){return this.generation.extern.OneOf}get Google(){return this.generation.extern.Google}get WireMock(){return this.generation.extern.WireMock}get Primitive(){return this.generation.Primitive}get Value(){return this.generation.Value}get Collection(){return this.generation.Collection}clone(){return new e({ir:this.ir,config:this.config,options:this.options,generation:this.generation})}getFileParameterForString(r){return this.csharp.Literal.reference(this.csharp.instantiateClass({classReference:this.Types.FileParameter,arguments_:[],properties:[{name:"Stream",value:this.getMemoryStreamForString(r)}],multiline:!0}))}getMemoryStreamForString(r){return this.System.IO.MemoryStream.new({arguments_:[this.csharp.invokeMethod({on:this.System.Text.Encoding_UTF8,method:"GetBytes",arguments_:[this.csharp.Literal.string(r)]})]})}getClassName(r){return r.pascalCase.safeName}getParameterName(r){return r.camelCase.safeName}getPropertyName(r){return r.pascalCase.safeName}resolvePropertyName(r,i){let o=i.pascalCase.safeName,p=r.scope.getRedirectedFieldName(o);return p||(r.scope.isField(o)?o:r.registerField(o))}getMethodName(r){return`${r.pascalCase.safeName}Async`}getNamespace(r,i){let o=this.getNamespaceSegments(r);return o=i!=null?[...o,i]:o,[this.namespaces.root,...o].join(".")}getEnvironmentTypeReferenceFromID(r){let i=this.resolveEnvironmentName(r);if(i!=null)return this.getEnvironmentClassReferenceForEnumName(i)}getEnvironmentClassReferenceForEnumName(r){return this.csharp.classReference({name:`${this.generation.Types.Environments.name}.${this.getClassName(r)}`,namespace:this.namespaces.root})}getNamespaceSegments(r){return(this.settings.explicitNamespaces?r.allParts:r.packagePath).map(o=>o.pascalCase.safeName)}precalculate(r){this.generation.initialize(),this.System.Collections.Generic.KeyValuePair(),this.System.Collections.Generic.IEnumerable(),this.System.Collections.Generic.IAsyncEnumerable(),this.System.Collections.Generic.HashSet(),this.System.Collections.Generic.List(),this.System.Collections.Generic.Dictionary(),this.System.Threading.Tasks.Task(),Object.entries(this.ir.types).sort((i,o)=>i[0].length-o[0].length).forEach(([i,o])=>{this.dynamicTypeMapper.convertToClassReference(o,i)});for(let[i,o]of r.entries())if(this.csharp.classReference({origin:this.model.staticExplicit(`Example${i}`),namespace:"Usage"}),o.endpoint){let p=this.resolveEndpointLocation(o.endpoint);for(let l of p)switch(l.request.type){case"inlined":this.csharp.classReference({origin:l.request.declaration.name,namespace:this.getNamespace(l.request.declaration.fernFilepath)});break;case"body":break}}this.generation.Types.ClientOptions,this.generation.Types.RootClientForSnippets,this.csharp.freezeClassReferences()}};n();a();s();var cd="request",Lo=class extends Ze{constructor({context:r}){super(r.generation);y(this,"context");this.context=r}async generateSnippet({endpoint:r,request:i,options:o}){return this.buildCodeBlock({endpoint:r,snippet:i,options:o}).toString({namespace:"Examples",generation:this.generation,allNamespaceSegments:new Set,allTypeClassReferences:new Map,skipGlobalQualifier:!0})}generateSnippetSync({endpoint:r,request:i,options:o}){return this.buildCodeBlock({endpoint:r,snippet:i,options:o}).toString({namespace:"Examples",generation:this.generation,allNamespaceSegments:new Set,allTypeClassReferences:new Map,skipGlobalQualifier:!0})}async generateSnippetAst({endpoint:r,request:i,options:o}){throw new Error("Unsupported")}buildCodeBlock({endpoint:r,snippet:i,options:o}){if(r.examples&&v.DynamicIR.EndpointExample(i)&&!r.examples.find(b=>b.id===i.id))throw new Error("Endpoint does not have an example that matches the snippet");let p=this.csharp.codeblock(b=>{b.writeNodeStatement(this.constructClient({endpoint:r,snippet:i})),b.newLine(),b.writeNodeStatement(this.callMethod({endpoint:r,snippet:i}))}),l=this.getStyle(o);switch(l){case Qt.Concise:return p;case Qt.Full:return this.buildFullCodeBlock({body:p,options:o});default:ue(l)}}buildFullCodeBlock({body:r,options:i}){let o=this.getConfig(i),p=o.fullStyleMethodName??o.fullStyleClassName??"Example",l=this.csharp.class_({name:"Examples",namespace:"Examples",partial:!0,skipNamespaceDeclaration:!0,access:Ri.Access.Public});return l.addNamespaceReference(this.Types.RootClientForSnippets.namespace),l.addMethod({name:p,access:Ri.Access.Public,isAsync:!0,parameters:[],body:r}),l}constructClient({endpoint:r,snippet:i}){return this.csharp.codeblock(o=>{o.write("var client = "),o.writeNode(this.getRootClientConstructorInvocation(this.getConstructorArgs({endpoint:r,snippet:i})))})}callMethod({endpoint:r,snippet:i}){let o=r.response?.type==="streaming"||r.response?.type==="streamParameter",p=this.csharp.invokeMethod({on:this.csharp.codeblock("client"),method:this.getMethod({endpoint:r}),arguments_:this.getMethodArgs({endpoint:r,snippet:i}),async:!0,configureAwait:!0,multiline:!0,isAsyncEnumerable:o});return o?this.csharp.codeblock(l=>{l.write("await foreach (var item in "),l.writeNode(p),l.writeLine(")"),l.pushScope(),l.writeLine("/* consume each item */"),l.popScope()}):p}getConstructorArgs({endpoint:r,snippet:i}){let o=[];r.auth!=null&&(i.auth!=null?o.push(...this.getConstructorAuthArgs({auth:r.auth,values:i.auth})):this.context.errors.add({severity:te.Warning,message:`Auth with ${r.auth.type} configuration is required for this endpoint`}));let p=[],l=this.getConstructorBaseUrlArgs({baseUrl:i.baseURL,environment:i.environment});l.length>0&&p.push(...l),this.context.errors.scope(tt.Headers);let b=[];if(this.context.ir.headers!=null&&i.headers!=null&&b.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:i.headers})),this.context.errors.unscope(),this.settings.unifiedClientOptions){let w=[...o.map(A=>({name:Le(A.name),assignment:A.assignment})),...b.map(A=>({name:Le(A.name),assignment:A.assignment})),...p.map(A=>({name:A.name,assignment:A.assignment}))];return w.length===0?[]:[{name:"clientOptions",assignment:this.csharp.instantiateClass({classReference:this.Types.ClientOptions,arguments_:w,multiline:!0})}]}return p.length===0?[...o,...b]:[...o,...b,{name:"clientOptions",assignment:this.csharp.instantiateClass({classReference:this.Types.ClientOptions,arguments_:p.map(w=>({name:w.name,assignment:w.assignment})),multiline:!0})}]}getConstructorBaseUrlArgs({baseUrl:r,environment:i}){let o=this.getBaseUrlArg({baseUrl:r,environment:i});return v.Literal.nop(o)?[]:[{name:this.getBaseUrlOptionName(),assignment:o}]}getBaseUrlArg({baseUrl:r,environment:i}){if(r!=null&&i!=null)return this.context.errors.add({severity:te.Critical,message:"Cannot specify both baseUrl and environment options"}),this.csharp.Literal.nop();if(r!=null)return this.context.ir.environments?.environments.type==="multipleBaseUrls"?(this.context.errors.add({severity:te.Critical,message:"The C# SDK doesn't support a baseUrl when multiple URL environments are configured"}),this.csharp.Literal.nop()):this.csharp.Literal.string(r);if(i!=null){if(this.context.isSingleEnvironmentID(i)){let o=this.context.getEnvironmentTypeReferenceFromID(i);return o==null?(this.context.errors.add({severity:te.Warning,message:`Environment ${JSON.stringify(i)} was not found`}),this.csharp.Literal.nop()):this.csharp.Literal.reference(o)}if(this.context.isMultiEnvironmentValues(i))return this.context.validateMultiEnvironmentUrlValues(i)?this.csharp.Literal.reference(this.csharp.instantiateClass({classReference:this.Types.Environments,arguments_:Object.entries(i).map(([o,p])=>({name:Le(lr(o)),assignment:this.context.dynamicLiteralMapper.convert({typeReference:{type:"primitive",value:"STRING"},value:p})})),multiline:!0})):this.csharp.Literal.nop()}return this.csharp.Literal.nop()}getConstructorAuthArgs({auth:r,values:i}){if(i.type!==r.type)return this.addError(this.context.newAuthMismatchError({auth:r,values:i}).message),[];switch(r.type){case"basic":return i.type==="basic"?this.getConstructorBasicAuthArg({auth:r,values:i}):[];case"bearer":return i.type==="bearer"?this.getConstructorBearerAuthArgs({auth:r,values:i}):[];case"header":return i.type==="header"?this.getConstructorHeaderAuthArgs({auth:r,values:i}):[];case"oauth":return i.type==="oauth"?this.getConstructorOAuthArgs({auth:r,values:i}):[];case"inferred":return i.type==="inferred"?this.getConstructorInferredAuthArgs({auth:r,values:i}):[];default:ue(r)}}addError(r){this.context.errors.add({severity:te.Critical,message:r})}addWarning(r){this.context.errors.add({severity:te.Warning,message:r})}getConstructorBasicAuthArg({auth:r,values:i}){let o=r,p=!!o.usernameOmit,l=!!o.passwordOmit,b=[];return p||b.push({name:this.context.getParameterName(r.username),assignment:this.csharp.Literal.string(i.username)}),l||b.push({name:this.context.getParameterName(r.password),assignment:this.csharp.Literal.string(i.password)}),b}getConstructorBearerAuthArgs({auth:r,values:i}){return[{name:this.context.getParameterName(r.token),assignment:this.csharp.Literal.string(i.token)}]}getConstructorHeaderAuthArgs({auth:r,values:i}){return[{name:this.context.getParameterName(r.header.name.name),assignment:this.context.dynamicLiteralMapper.convert({typeReference:r.header.typeReference,value:i.value,fallbackToDefault:r.header.name.wireValue})}]}getConstructorOAuthArgs({auth:r,values:i}){return[{name:this.context.getParameterName(r.clientId),assignment:this.csharp.Literal.string(i.clientId)},{name:this.context.getParameterName(r.clientSecret),assignment:this.csharp.Literal.string(i.clientSecret)}]}getConstructorInferredAuthArgs({auth:r,values:i}){let o=[];if(r.parameters!=null)for(let p of r.parameters){let l=p.name.wireValue,b=i.values?.[l];o.push({name:this.context.getParameterName(p.name.name),assignment:this.context.dynamicLiteralMapper.convert({typeReference:p.typeReference,value:b,fallbackToDefault:l})})}else this.context.errors.add({severity:te.Critical,message:"Inferred auth parameters are not defined in the IR. Please ensure you're using IR version 62.3.0 or later."});return o}getConstructorHeaderArgs({headers:r,values:i}){let o=[];for(let p of r){let l=i[p.name.wireValue],b=this.getConstructorHeaderArg({header:p,value:l});b!=null&&o.push({name:this.context.getParameterName(p.name.name),assignment:b})}return o}getConstructorHeaderArg({header:r,value:i}){let o=this.context.dynamicLiteralMapper.convert({typeReference:r.typeReference,value:i,fallbackToDefault:r.name.wireValue});if(!v.Literal.nop(o))return o}getMethodArgs({endpoint:r,snippet:i}){switch(r.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:r.request,snippet:i});case"body":return this.getMethodArgsForBodyRequest({request:r.request,snippet:i});default:ue(r.request)}}getMethodArgsForInlinedRequest({request:r,snippet:i}){this.context.errors.scope(tt.PathParameters);let o=[...this.context.ir.pathParameters??[],...r.pathParameters??[]],p=this.context.includePathParametersInWrappedRequest({request:r,inlinePathParameters:this.settings.shouldInlinePathParameters}),l=p?this.getPathParameters({namedParameters:o,snippet:i}):[],b=p?[]:this.getPathParameterArguments({namedParameters:o,snippet:i});this.context.errors.unscope(),this.context.errors.scope(tt.RequestBody);let w=this.getFilePropertyInfo({request:r,snippet:i});this.context.errors.unscope();let A=this.getInlinedRequestArg({request:r,snippet:i,pathParameterFields:l,filePropertyInfo:w});return b.length>0?[...b.map(I=>this.namedArgument({name:I.name,value:I.value})),this.namedArgument({name:cd,value:A})]:[A]}getFilePropertyInfo({request:r,snippet:i}){return r.body==null||!this.context.isFileUploadRequestBody(r.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:r.body,value:i.requestBody})}getInlinedRequestArg({request:r,snippet:i,pathParameterFields:o,filePropertyInfo:p}){let l=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)});this.context.errors.scope(tt.QueryParameters);let w=this.context.associateQueryParametersByWireValue({parameters:r.queryParameters??[],values:i.queryParameters??{}}).map(L=>({name:this.context.resolvePropertyName(l,L.name.name),value:this.context.dynamicLiteralMapper.convert(L)}));this.context.errors.unscope(),this.context.errors.scope(tt.Headers);let I=this.context.associateByWireValue({parameters:r.headers??[],values:i.headers??{}}).map(L=>({name:this.context.resolvePropertyName(l,L.name.name),value:this.context.dynamicLiteralMapper.convert({...L,fallbackToDefault:L.name.wireValue})}));this.context.errors.unscope(),this.context.errors.scope(tt.RequestBody);let P=r.body!=null?this.getInlinedRequestBodyConstructorFields({body:r.body,value:i.requestBody,filePropertyInfo:p,classReference:l}):[];return this.context.errors.unscope(),this.csharp.Literal.class_({reference:l,fields:[...o,...w,...I,...P]})}getInlinedRequestBodyConstructorFields({body:r,value:i,filePropertyInfo:o,classReference:p}){switch(r.type){case"properties":return this.getInlinedRequestBodyPropertyConstructorFields({parameters:r.value,value:i,classReference:p});case"referenced":return[this.getReferencedRequestBodyPropertyConstructorField({body:r,value:i,classReference:p})];case"fileUpload":return this.getFileUploadRequestBodyConstructorFields({filePropertyInfo:o});default:ue(r)}}getInlinedRequestBodyPropertyConstructorFields({parameters:r,value:i,classReference:o}){let p=[],l=this.context.associateByWireValue({parameters:r,values:this.context.getRecord(i)??{}});for(let b of l)p.push({name:this.context.resolvePropertyName(o,b.name.name),value:this.context.dynamicLiteralMapper.convert({...b,fallbackToDefault:b.name.wireValue})});return p}getFileUploadRequestBodyConstructorFields({filePropertyInfo:r}){return[...r.fileFields,...r.bodyPropertyFields]}getReferencedRequestBodyPropertyConstructorField({body:r,value:i,classReference:o}){return{name:this.context.resolvePropertyName(o,r.bodyKey),value:this.getReferencedRequestBodyPropertyLiteral({body:r.bodyType,value:i})}}getReferencedRequestBodyPropertyLiteral({body:r,value:i}){switch(r.type){case"bytes":return this.getBytesBodyRequestArg({value:i});case"typeReference":return this.context.dynamicLiteralMapper.convert({typeReference:r.value,value:i,fallbackToDefault:JSON.stringify(r.value)});default:ue(r)}}getMethodArgsForBodyRequest({request:r,snippet:i}){this.context.errors.scope(tt.PathParameters);let o=[...this.context.ir.pathParameters??[],...r.pathParameters??[]],p=this.getPathParameterArguments({namedParameters:o,snippet:i});this.context.errors.unscope(),this.context.errors.scope(tt.RequestBody);let l=r.body!=null?this.getBodyRequestArg({body:r.body,value:i.requestBody}):void 0;if(this.context.errors.unscope(),p.length>0&&l!=null)return[...p.map(w=>this.namedArgument({name:w.name,value:w.value})),this.namedArgument({name:cd,value:l})];let b=p.map(w=>w.value);return l!=null&&b.push(l),b}getPathParameterArguments({namedParameters:r,snippet:i}){return this.context.associateByWireValueOrDefault({parameters:r,values:i.pathParameters??{}}).map(p=>({name:this.context.getParameterName(p.name.name),value:this.context.dynamicLiteralMapper.convert({...p,fallbackToDefault:p.name.wireValue,forceLiteral:!0})}))}namedArgument({name:r,value:i}){return this.csharp.codeblock(o=>{o.write(`${r}: `),o.writeNode(i)})}getBodyRequestArg({body:r,value:i}){switch(r.type){case"bytes":return this.getBytesBodyRequestArg({value:i});case"typeReference":return r.value.type==="optional"&&i==null?this.csharp.Literal.null():this.context.dynamicLiteralMapper.convert({typeReference:r.value,value:i,fallbackToDefault:JSON.stringify(r.value)});default:ue(r)}}getBytesBodyRequestArg({value:r}){let i=this.context.getValueAsString({value:r});return i==null&&(this.context.errors.add({severity:te.Critical,message:"The bytes request body must be provided in string format"}),i="[bytes]"),this.csharp.Literal.reference(this.context.getMemoryStreamForString(i))}getRootClientConstructorInvocation(r){return this.csharp.instantiateClass({classReference:this.Types.RootClientForSnippets,arguments_:r,forceUseConstructor:!0,multiline:!0})}getPathParameters({namedParameters:r,snippet:i}){let o=[],p=this.context.associateByWireValueOrDefault({parameters:r,values:i.pathParameters??{}});for(let l of p)o.push({name:this.context.getPropertyName(l.name.name),value:this.context.dynamicLiteralMapper.convert({...l,fallbackToDefault:l.name.wireValue})});return o}getMethod({endpoint:r}){return r.declaration.fernFilepath.allParts.length>0?`${r.declaration.fernFilepath.allParts.map(i=>this.context.getClassName(i)).join(".")}.${this.context.getMethodName(r.declaration.name)}`:this.context.getMethodName(r.declaration.name)}getBaseUrlOptionName(){return this.context.ir.environments?.environments.type==="multipleBaseUrls"?"Environment":"BaseUrl"}getStyle(r){return r.style??this.context.options.style??Qt.Full}getConfig(r){return r.config??this.context.options.config??{}}};var cc=class extends Yi{constructor({ir:t,config:r,options:i={}}){super(new Fo({ir:t,config:r,options:i}))}precalculate(t){this.context.precalculate(t)}async generate(t,r={}){return super.generate(t,r)}generateSync(t,r={}){return super.generateSync(t,r)}async generateSnippetAst(t){return super.generateSnippetAst(t)}createSnippetGenerator(t){return new Lo({context:t})}};export{cc as DynamicSnippetsGenerator,Rd as buildSnippetTestGeneratorConfig};
|
|
34
34
|
/*! Bundled license information:
|
|
35
35
|
|
|
36
36
|
@jspm/core/nodelibs/browser/chunk-DtuTasat.js:
|