@fern-api/csharp-dynamic-snippets 2.71.2 → 2.72.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 +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -30,7 +30,7 @@ ${Di(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_:c,body:x,noBody:w,bodyType:A,summary:I,doc:P,type:F,classReference:N,parameters:j,typeParameters:M,annotations:D,codeExample:G,interfaceReference:Q,origin:oe,enclosingType:X},K){super({enclosingType:X},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=c,this.noBody=w??!1,this.body=x,this.bodyType=A??e.BodyType.Statement,this.summary=I,this.doc=this.csharp.xmlDocBlockOf(P??{summary:I,codeExample:G}),this.type=F??Xe.INSTANCE,this.reference=N,this.parameters=j??[],this.typeParameters=M??[],this.annotations=(D??[]).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 Si=class extends Be{constructor({name:r,namespace:i,access:o,partial:p,interfaceReferences:c,enclosingType:x,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=x?this.csharp.classReference({name:r,enclosingType:x}):this.csharp.classReference({name:r,namespace:i||de("Class/Interface: Namespace or enclosingType is required ")}),this.access=o,this.partial=p??!1,this.interfaceReferences=c??[]}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 xi(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 We(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 Si{constructor({name:r,namespace:i,access:o,static_:p,abstract_:c,sealed:x,partial:w,readonly:A,parentClassReference:I,interfaceReferences:P,enclosingType:F,type:N,summary:j,doc:M,annotations:D,primaryConstructor:G,skipNamespaceDeclaration:Q,origin:oe},X){super({name:r,namespace:i,access:o,partial:w,interfaceReferences:P,enclosingType:F,origin:oe},X);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_=c??!1,this.sealed=x??!1,this.readonly=A??!1,this.type=N??ve.ClassType.Class,this.summary=j,this.doc=this.csharp.xmlDocBlockOf(M??{summary:j}),this.parentClassReference=I,this.annotations=(D??[]).map(K=>K instanceof _e?this.csharp.annotation({reference:K}):K),this.primaryConstructor=G}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(),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.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(wi).sort(Qu).filter(this.fieldConstFilter())})}writeFieldFields(r){this.writeFields({writer:r,fields:this.getFields().sort(wi).sort(Qu).filter(this.fieldFieldFilter())})}writeProperties(r){this.writeFields({writer:r,fields:this.getFields().sort(wi).sort(Qu).filter(this.fieldPropertyFilter())})}writeMethods(r){this.methods.sort(wi).sort(vy).sort(My).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(wi).forEach((i,o)=>{i.write(r),r.writeNewLineIfLastLineNot(),o<this.fields.length-1&&r.newLine()})}writeNestedInterfaces(r){this.nestedInterfaces.sort(wi).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,c)=>{p.write(r),c<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:c,access:x,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=c??[],this.access=x??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 Ym(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 wi(e,t){return Ym(e.access)-Ym(t.access)}function Qu(e,t){return e.isStatic===t.isStatic?0:e.isStatic?-1:1}function My(e,t){return e.type===Xe.STATIC&&t.type!==Xe.STATIC?-1:e.type!==Xe.STATIC&&t.type===Xe.STATIC?1:0}function vy(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 Ti=class extends Be{constructor({name:r,namespace:i,access:o,annotations:p,origin:c},x){super(c,x);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:c}),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(Gi(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(Gi(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 Ei=class extends Si{constructor({name:t,namespace:r,access:i,partial:o,interfaceReferences:p,enclosingType:c,origin:x},w){super({name:t,namespace:r,access:i,partial:o,interfaceReferences:p,enclosingType:c,origin:x},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 Ai=class extends Be{constructor({name:r,namespace:i,parentClassReference:o,origin:p},c){super(p,c);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();n();a();s();n();a();s();n();a();s();var Yu={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 Vy=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 zy=new Set(["from","where","select","orderby","groupby","into","let","join","on","equals"]),qy=new Set(["async","await"]),Gy=new Set(["yield"]),Wy=new Set(["var","dynamic"]),$y=new Set(["using","alias"]);var Hy=new Set(["required","scoped","unmanaged","managed"]),Jy=new Set(["when","and","or","not"]),Ky=new Set(["Equals","GetHashCode","ToString","GetType","MemberwiseClone","Finalize"]),Qy=new Set([...Vy,...zy,...qy,...Gy,...Wy,...$y,...Hy,...Jy]),yo=class{constructor(t,r,i){y(this,"registry");y(this,"name");y(this,"jsonPath");this.registry=t,this.name=r,this.jsonPath=i}};var go=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)}},Xu=class extends yo{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 go(this),this.methods=new go(this)}isKeyword(r){return Qy.has(r)}isBuiltinMemberName(r){return Ky.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 c=this.fields.getByName(r);if(c&&p===c.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 bo(this.registry,r,this,p,o)),this.registry.setFieldNameShortcut(p,r),r}let x=this.getAlternativeName(r);return this.fields.set(new bo(this.registry,x,this,p,o)),this.fields.redirect(r,x),this.registry.setFieldNameShortcut(p,x),x}getFieldName(r,i){let o=this.getFieldByJsonPath(this.registry.model.jsonPath(r))?.name;if(o)return o;if(v.Provenance(r)){let x=this.getRedirectedFieldName(i);if(x)return x;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 c=this.getRedirectedFieldName(i);if(c)return c;this.isMethod(i)}},Zu=class extends yo{constructor(r,i,o,p){super(r,i,p);y(this,"scope");this.scope=o}},bo=class extends Zu{constructor(r,i,o,p,c){super(r,i,o,p);y(this,"field");this.field=c}};var Ni=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,"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(Yu))t.split(".").forEach(i=>this.knownBuiltInIdentifiers.add(i)),r.forEach(i=>this.knownBuiltInIdentifiers.add(i));for(let[t,r]of Object.entries(Yu)){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)}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:c,origin:x}=t;if(x){let w=this.model.jsonPath(x)??de(`JsonPath not found for origin: ${JSON.stringify(x).substring(0,100)}`);this.classReferenceByJsonPath.set(w,t)}if(r&&r!==c&&!this.typeRegistry.has(r)&&this.typeRegistry.set(r,t),!this.typeRegistry.has(c)){this.typeRegistry.set(c,t);for(let w of this.allNamespacesOf(o))this.registerNamespace(w,w);p||this.trackTypeName(i,o);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:c}=t,x=this.model.jsonPath(c),w=(x?this.classReferenceByJsonPath.get(x):void 0)??this.typeRegistry.get(r),A=this.model.jsonPath(w?.origin),I=A&&x?A===x?"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??c,isCollection:w.isCollection,isReferenceType:w.isReferenceType,multipartMethodName:w.multipartMethodName,multipartMethodNameForCollection:w.multipartMethodNameForCollection},w.scope,this.generation);let P=!1,F=this.resolveNamespace(o);F!==o&&(o=F,P=!0);let N;e:for(;;){N=e.fullyQualifiedNameOf({name:i,namespace:o,enclosingType:p});let j="",M=o.split(".");for(let D=0;D<M.length;D++)if(j=j?`${j}.${M[D]}`:`${M[D]}`,this.typeRegistry.has(j)){M[D]=`${M[D]}_`,o=M.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(N)){i=`${i}_`,P=!0;continue e}if(this.typeRegistry.has(N)){i=`${i}_`,P=!0;continue e}if(p){let D=N.replaceAll("+",".");if(this.typeRegistry.has(D)){i=`${i}_`,P=!0;continue e}if(this.namespaceRegistry.has(D)){i=`${i}_`,P=!0;continue e}}else{let D=N.split(".");for(let G=1;G<D.length;G++){let Q=D.slice(0,G).join(".")+"+"+D.slice(G).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:N,origin:c,isCollection:t.isCollection,isReferenceType:t.isReferenceType,multipartMethodName:t.multipartMethodName,multipartMethodNameForCollection:t.multipartMethodNameForCollection},new Xu(this,i,o,N),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 c=this.namespaceRegistry.get(p);if(c!==void 0){let x=i.slice(o).join("."),w=`${c}.${x}`;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="",c=o.split(".");for(let x=0;x<c.length;x++)if(p=p?`${p}.${c[x]}`:`${c[x]}`,this.typeRegistry.has(p)){c[x]=`${c[x]}_`,o=c.join("."),i=!0;continue e}break}return i&&this.registerNamespace(t,o),o}};var xo=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 J.Class_(t,r,this.generation),dictionary:({keyType:t,valueType:r,entries:i})=>new J.Dictionary(t,r,i,this.generation),list:({valueType:t,values:r})=>new J.List(t,r,this.generation),set:({valueType:t,values:r})=>new J.Set(t,r,this.generation),boolean:t=>new J.Boolean(t,this.generation),float:t=>new J.Float(t,this.generation),date:t=>new J.Date(t,this.generation),datetime:t=>new J.DateTime(t,this.generation),decimal:t=>new J.Decimal(t,this.generation),double:t=>new J.Double(t,this.generation),integer:t=>new J.Integer(t,this.generation),long:t=>new J.Long(t,this.generation),uint:t=>new J.Uint(t,this.generation),ulong:t=>new J.Ulong(t,this.generation),reference:t=>new J.Reference(t,this.generation),string:t=>new J.String(t,this.generation),null:()=>new J.Null(this.generation),nop:()=>new J.Nop(this.generation),unknown:t=>new J.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=Ni.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
|
-
${Bi()}`)}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 Ai(t,this.generation)}annotation(t){return new gt(t,this.generation)}annotationGroup(t){return new di(t,this.generation)}instantiateClass(t){return new Yr(t,this.generation)}invokeMethod(t){return new ti(t,this.generation)}codeblock(t){return new Mt(t,this.generation)}code(){return new vt({},this.generation)}anonymousFunction(t){return new hi(t)}parameter(t){return new Ye(t,this.generation)}interface_(t){return new Ei(t,this.generation)}enum_(t){return new Ti(t,this.generation)}dictionary(t){return new Xr(t,this.generation)}list(t){return new ei(t,this.generation)}readOnlyMemory(t){return new ri(t,this.generation)}set(t){return new ii(t,this.generation)}switch_(t){return new gi(t,this.generation)}ternary(t){return new bi(t,this.generation)}and(t){return new mi(t,this.generation)}or(t){return new yi(t,this.generation)}enumInstantiation(t){return new Zr(t,this.generation)}string_(t){return new ni(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 $(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 So=class{constructor(t){y(this,"generation");y(this,"System",$({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:()=>$({Serialization:()=>$({EnumMember:()=>this.csharp.classReference({name:"EnumMemberAttribute",namespace:"System.Runtime.Serialization"})})}),Collections:()=>$({Generic:()=>$({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:()=>$({Enumerable:()=>this.csharp.classReference({name:"Enumerable",namespace:"System.Linq"})})}),Globalization:()=>$({DateTimeStyles:()=>this.csharp.classReference({name:"DateTimeStyles",namespace:"System.Globalization"})}),Linq:()=>$({Enumerable:()=>this.csharp.classReference({name:"Enumerable",namespace:"System.Linq"})}),Net:()=>$({Http:()=>$({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:()=>$({SseEvent:()=>this.csharp.classReference({name:"SseEvent",namespace:"System.Net.ServerSentEvents"}),SseParser:()=>this.csharp.classReference({name:"SseParser",namespace:"System.Net.ServerSentEvents"})}),WebSockets:()=>$({ClientWebSocketOptions:()=>this.csharp.classReference({name:"ClientWebSocketOptions",namespace:"System.Net.WebSockets"})})}),IO:()=>$({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:()=>$({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:()=>$({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:()=>$({JsonNode:()=>this.csharp.classReference({name:"JsonNode",namespace:"System.Text.Json.Nodes"}),JsonObject:()=>this.csharp.classReference({name:"JsonObject",namespace:"System.Text.Json.Nodes"})}),Serialization:()=>$({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:()=>$({CancellationToken:()=>this.csharp.classReference({name:"CancellationToken",namespace:"System.Threading"}),Tasks:()=>$({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:()=>$({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",$({Framework:()=>$({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",$({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",$({Protobuf:()=>$({ByteString:()=>this.csharp.classReference({name:"ByteString",namespace:"Google.Protobuf"}),WellKnownTypes:()=>$({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",$({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",$({Core:()=>$({RpcException:()=>this.csharp.classReference({name:"RpcException",namespace:"Grpc.Core"})})}));this.generation=t}get csharp(){return this.generation.csharp}};n();a();s();var ec=new Set(["name","camelCase","snakeCase","screamingSnakeCase","pascalCase"]);function Yy(e,t){return ec.has(t)?e??"":e?`${e}.${t}`:t}var wo=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=Yy(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 c=ec.has(r);for(let[x,w]of Object.entries(t))typeof w=="object"&&w!==null&&(c&&ec.has(x)?this.indexByObject.set(w,i):this.createIndex(w,x,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[c,x]of Object.entries(t))typeof x=="object"&&x!==null&&this.createIndex(x,c,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 To(...e){return e.filter(Boolean).join("/")}var Fn=class{constructor(t,r,i,o,p={makeRelativeFilePath:c=>c,makeAbsoluteFilePath:c=>c,getNamespaceForTypeId:c=>"",getDirectoryForTypeId:c=>"",getCoreAsIsFiles:()=>[],getCoreTestAsIsFiles:()=>[],getPublicCoreAsIsFiles:()=>[],getAsyncCoreAsIsFiles:()=>[],getChildNamespaceSegments:c=>[]}){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 xo(this));y(this,"registry",new Ni(this));y(this,"model");y(this,"case");y(this,"extern",new So(this));y(this,"settings",$({namespace:()=>this.customConfig.namespace??ao(oo(`${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,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,userAgentNameFromPackage:()=>this.customConfig["user-agent-name-from-package"]??!1,unifiedClientOptions:()=>this.customConfig["unified-client-options"]??!1,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",defaultTimeoutInSeconds:()=>this.customConfig["default-timeout-in-seconds"],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:$({mockServerTests:()=>this.support.makeRelativeFilePath("Unit/MockServer"),types:()=>"Types",exceptions:()=>"Exceptions",src:()=>"src",protobuf:()=>"proto",serializationTests:()=>this.support.makeRelativeFilePath("Unit/Serialization"),project:()=>this.support.makeRelativeFilePath(To(this.constants.folders.sourceFiles,this.support.makeRelativeFilePath(this.names.files.project))),sourceFiles:()=>this.support.makeRelativeFilePath(this.constants.folders.src),coreFiles:()=>this.support.makeRelativeFilePath(To(this.constants.folders.project,this.support.makeRelativeFilePath(this.constants.defaults.core))),publicCoreFiles:()=>this.support.makeRelativeFilePath(To(this.constants.folders.project,this.support.makeRelativeFilePath(this.constants.defaults.core),this.support.makeRelativeFilePath(this.constants.defaults.publicCore))),testFiles:()=>this.support.makeRelativeFilePath(To(this.constants.folders.sourceFiles,this.support.makeRelativeFilePath(this.names.files.testProject)))}),formatting:$({indent:()=>" "}),defaults:$({core:()=>"Core",publicCore:()=>"Public",version:()=>"0.0.0"})});y(this,"namespaces",$({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:$({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:$({client:()=>ao(oo(`${this.generatorConfig.organization}_${this.generatorConfig.workspaceName}`)),clientPrefix:()=>this.settings.exportedClientClassName||this.settings.clientClassName||this.names.project.client,packageId:()=>this.settings.packageId||this.namespaces.root}),files:$({project:()=>this.namespaces.root,testProject:()=>`${this.namespaces.root}.Test`}),methods:$({mockOauth:()=>"MockOAuthEndpoint",mockInferredAuth:()=>"MockInferredAuthEndpoint",getAccessTokenAsync:()=>"GetAccessTokenAsync",getAuthHeadersAsync:()=>"GetAuthHeadersAsync"}),variables:$({client:()=>"client",response:()=>"response",httpRequest:()=>"httpRequest",sendRequest:()=>"sendRequest",responseBody:()=>"responseBody",query:()=>"_query",headers:()=>"_headers"}),parameters:$({cancellationToken:()=>"cancellationToken",requestOptions:()=>"options",idempotentOptions:()=>"options"})});y(this,"Types",$({Arbitrary:t=>new te.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}),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}),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:c})=>this.csharp.classReference({origin:this.model.staticExplicit("OffsetPager"),namespace:this.namespaces.core,generics:[t,r,i,o,p,c]}),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",$({string:()=>new te.String(this),boolean:()=>new te.Boolean(this),integer:()=>new te.Integer(this),long:()=>new te.Long(this),uint:()=>new te.Uint(this),ulong:()=>new te.ULong(this),float:()=>new te.Float(this),double:()=>new te.Double(this),object:()=>new te.Object(this)}));y(this,"Value",$({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",$({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",$({private:t=>`_${uo.camelCase(t)}`}));y(this,"initializers",$({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 c=v.IR.IntermediateRepresentation(t)?t.casingsConfig:void 0;this.case=new Wi({generationLanguage:"csharp",keywords:c?.keywords,smartCasing:c?.smartCasing??!0}),this.model=new wo(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 Eo=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:ee.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,c)=>{this.context.errors.scope({index:c});try{return this.convert({typeReference:r,value:p})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:ee.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 c=this.context.getValueAsBoolean({value:i});return c==null?this.csharp.Literal.nop():this.csharp.Literal.boolean(c)}case"string":{let c=this.context.getValueAsString({value:i});return c==null?o?this.Primitive.string.getDeterminsticDefault(o):this.csharp.Literal.nop():this.csharp.Literal.string(c)}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,c)=>{this.context.errors.scope({index:c});try{return this.convert({typeReference:r,value:p})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:ee.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:ee.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,c])=>{this.context.errors.scope(p);try{return{key:this.convert({typeReference:r.key,value:p,as:"key"}),value:this.convert({typeReference:r.value,value:c})}}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)}),c=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:r,value:i});if(c==null)return this.csharp.Literal.nop();let x=c.singleDiscriminatedUnionType,w=this.getBaseProperties({discriminatedUnionTypeInstance:c,singleDiscriminatedUnionType:x});switch(x.type){case"samePropertiesAsObject":{let A=this.context.resolveNamedType({typeId:x.typeId});return A==null?this.csharp.Literal.nop():this.instantiateUnionWithBaseProperties({classReference:p,baseProperties:w,arguments_:[this.convertNamed({named:A,value:c.value})]})}case"singleProperty":{if(this.context.getRecord(c.value)==null)return this.csharp.Literal.nop();try{let I=["Value","Type"].includes(x.discriminantValue.name.pascalCase.safeName)?`${x.discriminantValue.name.pascalCase.safeName}Inner`:x.discriminantValue.name.pascalCase.safeName;return this.context.errors.scope(x.discriminantValue.wireValue),this.instantiateUnionWithBaseProperties({classReference:p,baseProperties:w,arguments_:[this.csharp.instantiateClass({classReference:this.csharp.classReference({name:I,enclosingType:p}),arguments_:[this.convert({typeReference:x.typeReference,value:x.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:c.discriminantValue,enclosingType:p}),arguments_:[]})]});default:ue(x)}}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(c=>{c.write(p," "),c.pushScope();for(let x of o)c.write(x.name," = ",x.assignment,",");c.popScope(!1)}))}getEnumValue(r,i){if(typeof i!="string")return this.context.errors.add({severity:ee.Critical,message:`Expected enum value string, got: ${typeof i}`}),this.csharp.Literal.nop();let o=r.values.find(x=>x.wireValue===i);if(o==null)return this.context.errors.add({severity:ee.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)}),c=p.registerField(this.model.getPropertyNameFor(o),o);return this.csharp.Literal.reference(this.csharp.enumInstantiation({reference:p,value:c}))}convertObject({object_:r,value:i,fallbackToDefault:o}){let p=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),c=new Map;for(let P of r.properties){let F=this.context.resolvePropertyName(p,P.name.name);c.set(P.name.wireValue,F)}let x=this.context.getRecord(i)??{},A=this.context.associateByWireValue({parameters:r.properties,values:x}).map(P=>{this.context.errors.scope(P.name.wireValue);try{return{name:c.get(P.name.wireValue)??this.context.getClassName(P.name.name),value:this.convert(P)}}finally{this.context.errors.unscope()}}),I=new Set(Object.keys(x));for(let P of r.properties){let F=c.get(P.name.wireValue)??this.context.getClassName(P.name.name);if(I.has(P.name.wireValue)){if(this.isRequiredProperty(P.typeReference)){let N=A.find(j=>j.name===F);if(N!=null&&v.Literal.nop(N.value)){let j=this.getDefaultLiteralForType(P.typeReference);j!=null&&(N.value=j)}}continue}if(this.isRequiredProperty(P.typeReference)){let N=this.getDefaultLiteralForType(P.typeReference);N!=null&&A.push({name:F,value:N})}}return this.csharp.Literal.class_({reference:p,fields:A})}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 c=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),x=[];for(let w of r.properties)if(this.isRequiredProperty(w.typeReference)){let A=this.getDefaultLiteralForType(w.typeReference,p);A!=null&&x.push({name:this.context.resolvePropertyName(c,w.name.name),value:A})}return p.delete(i),this.csharp.Literal.class_({reference:c,fields:x})}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 c=this.convert({typeReference:o,value:i});if(v.Literal.nop(c)||this.context.errors.size()>p){this.context.errors.truncate(p);continue}return{valueTypeReference:o,typeLiteral:c}}catch{this.context.errors.truncate(p);continue}}this.context.errors.add({severity:ee.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 c=this.getValueAsNumber({value:i,as:o});return c==null?p?this.Primitive.integer.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.integer(c)}case"LONG":{let c=this.getValueAsNumber({value:i,as:o});return c==null?p?this.Primitive.long.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.long(c)}case"UINT":{let c=this.getValueAsNumber({value:i,as:o});return c==null?p?this.Primitive.uint.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.uint(c)}case"UINT_64":{let c=this.getValueAsNumber({value:i,as:o});return c==null?p?this.Primitive.ulong.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.ulong(c)}case"FLOAT":{let c=this.getValueAsNumber({value:i,as:o});return c==null?p?this.Primitive.float.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.float(c)}case"DOUBLE":{let c=this.getValueAsNumber({value:i,as:o});return c==null?p?this.Primitive.double.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.double(c)}case"BOOLEAN":{let c=this.getValueAsBoolean({value:i,as:o});return c==null?p?this.Primitive.boolean.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.boolean(c)}case"STRING":{let c=this.context.getValueAsString({value:i});return c==null?p?this.Primitive.string.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.string(c)}case"DATE":{let c=this.context.getValueAsString({value:i});return c==null?p?this.Value.dateOnly.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.date(c)}case"DATE_TIME":case"DATE_TIME_RFC_2822":{let c=this.context.getValueAsString({value:i});return c==null?p?this.Value.dateTime.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.datetime(c)}case"UUID":{let c=this.context.getValueAsString({value:i});return c==null?p?this.Primitive.string.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.string(c)}case"BASE_64":{let c=this.context.getValueAsString({value:i});return c==null?p?this.Primitive.string.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.string(c)}case"BIG_INTEGER":{let c=this.context.getValueAsString({value:i});return c==null?p?this.Primitive.string.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.string(c)}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 Ao=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 Io=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 c of r.properties)switch(c.type){case"file":v.Record.missingKey(p,c.wireValue)&&(p[c.wireValue]="[bytes]"),o.fileFields.push({name:this.context.getPropertyName(c.name),value:this.getSingleFileProperty({property:c,record:p})});break;case"fileArray":v.Record.missingKey(p,c.wireValue)&&(p[c.wireValue]=["[bytes]"]),o.fileFields.push({name:this.context.getPropertyName(c.name),value:this.getArrayFileProperty({property:c,record:p})});break;case"bodyProperty":if(v.Record.missingKey(p,c.name.wireValue))switch(c.typeReference.type){case"optional":break;case"primitive":{switch(c.typeReference.value.toLowerCase()){case"integer":{p[c.name.wireValue]=123;break}case"string":{p[c.name.wireValue]="[string]";break}case"boolean":{p[c.name.wireValue]=!0;break}case"double":{p[c.name.wireValue]=123.456;break}case"float":{p[c.name.wireValue]=123.456;break}case"long":{p[c.name.wireValue]=123456789;break}case"uint":{p[c.name.wireValue]=123;break}case"uint64":{p[c.name.wireValue]=12345;break}case"date":{p[c.name.wireValue]=new Date(2021,1,1);break}case"datetime":{p[c.name.wireValue]=new Date(2021,1,1,12,0,0);break}case"uuid":{p[c.name.wireValue]="123e4567-e89b-12d3-a456-426614174000";break}case"base64":{p[c.name.wireValue]="SGVsbG8gd29ybGQh";break}case"biginteger":{p[c.name.wireValue]="12345678901234567890";break}}break}default:break}o.bodyPropertyFields.push({name:this.context.getPropertyName(c.name.name),value:this.getBodyProperty({property:c,record:p})});break;default:ue(c)}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 No=class e extends Xi{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 Fn(r,i.workspaceName,i.customConfig!=null?i.customConfig:{},i),this.dynamicTypeMapper=new Ao({context:this}),this.dynamicLiteralMapper=new Eo({context:this}),this.filePropertyMapper=new Io({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 c of p)switch(c.request.type){case"inlined":this.csharp.classReference({origin:c.request.declaration.name,namespace:this.getNamespace(c.request.declaration.fernFilepath)});break;case"body":break}}this.generation.Types.ClientOptions,this.generation.Types.RootClientForSnippets,this.csharp.freezeClassReferences()}};n();a();s();var Xm="request",Ro=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(x=>x.id===i.id))throw new Error("Endpoint does not have an example that matches the snippet");let p=this.csharp.codeblock(x=>{x.writeNodeStatement(this.constructClient({endpoint:r,snippet:i})),x.newLine(),x.writeNodeStatement(this.callMethod({endpoint:r,snippet:i}))}),c=this.getStyle(o);switch(c){case Qt.Concise:return p;case Qt.Full:return this.buildFullCodeBlock({body:p,options:o});default:ue(c)}}buildFullCodeBlock({body:r,options:i}){let o=this.getConfig(i),p=o.fullStyleMethodName??o.fullStyleClassName??"Example",c=this.csharp.class_({name:"Examples",namespace:"Examples",partial:!0,skipNamespaceDeclaration:!0,access:Ii.Access.Public});return c.addNamespaceReference(this.Types.RootClientForSnippets.namespace),c.addMethod({name:p,access:Ii.Access.Public,isAsync:!0,parameters:[],body:r}),c}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(c=>{c.write("await foreach (var item in "),c.writeNode(p),c.writeLine(")"),c.pushScope(),c.writeLine("/* consume each item */"),c.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:ee.Warning,message:`Auth with ${r.auth.type} configuration is required for this endpoint`}));let p=[],c=this.getConstructorBaseUrlArgs({baseUrl:i.baseURL,environment:i.environment});c.length>0&&p.push(...c),this.context.errors.scope(tt.Headers);let x=[];if(this.context.ir.headers!=null&&i.headers!=null&&x.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})),...x.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,...x]:[...o,...x,{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:ee.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:ee.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:ee.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:ee.Critical,message:r})}addWarning(r){this.context.errors.add({severity:ee.Warning,message:r})}getConstructorBasicAuthArg({auth:r,values:i}){let o=r,p=!!o.usernameOmit,c=!!o.passwordOmit,x=[];return p||x.push({name:this.context.getParameterName(r.username),assignment:this.csharp.Literal.string(i.username)}),c||x.push({name:this.context.getParameterName(r.password),assignment:this.csharp.Literal.string(i.password)}),x}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 c=p.name.wireValue,x=i.values?.[c];o.push({name:this.context.getParameterName(p.name.name),assignment:this.context.dynamicLiteralMapper.convert({typeReference:p.typeReference,value:x,fallbackToDefault:c})})}else this.context.errors.add({severity:ee.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 c=i[p.name.wireValue],x=this.getConstructorHeaderArg({header:p,value:c});x!=null&&o.push({name:this.context.getParameterName(p.name.name),assignment:x})}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}),c=p?this.getPathParameters({namedParameters:o,snippet:i}):[],x=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:c,filePropertyInfo:w});return x.length>0?[...x.map(I=>this.namedArgument({name:I.name,value:I.value})),this.namedArgument({name:Xm,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 c=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(F=>({name:this.context.resolvePropertyName(c,F.name.name),value:this.context.dynamicLiteralMapper.convert(F)}));this.context.errors.unscope(),this.context.errors.scope(tt.Headers);let I=this.context.associateByWireValue({parameters:r.headers??[],values:i.headers??{}}).map(F=>({name:this.context.resolvePropertyName(c,F.name.name),value:this.context.dynamicLiteralMapper.convert({...F,fallbackToDefault:F.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:c}):[];return this.context.errors.unscope(),this.csharp.Literal.class_({reference:c,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=[],c=this.context.associateByWireValue({parameters:r,values:this.context.getRecord(i)??{}});for(let x of c)p.push({name:this.context.resolvePropertyName(o,x.name.name),value:this.context.dynamicLiteralMapper.convert({...x,fallbackToDefault:x.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 c=r.body!=null?this.getBodyRequestArg({body:r.body,value:i.requestBody}):void 0;if(this.context.errors.unscope(),p.length>0&&c!=null)return[...p.map(w=>this.namedArgument({name:w.name,value:w.value})),this.namedArgument({name:Xm,value:c})];let x=p.map(w=>w.value);return c!=null&&x.push(c),x}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:ee.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 c of p)o.push({name:this.context.getPropertyName(c.name.name),value:this.context.dynamicLiteralMapper.convert({...c,fallbackToDefault:c.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 Oo=class extends Ki{constructor({ir:t,config:r,options:i={}}){super(new No({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 Ro({context:t})}};0&&(module.exports={DynamicSnippetsGenerator,buildSnippetTestGeneratorConfig});
|
|
33
|
+
${Bi()}`)}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 Ai(t,this.generation)}annotation(t){return new gt(t,this.generation)}annotationGroup(t){return new di(t,this.generation)}instantiateClass(t){return new Yr(t,this.generation)}invokeMethod(t){return new ti(t,this.generation)}codeblock(t){return new Mt(t,this.generation)}code(){return new vt({},this.generation)}anonymousFunction(t){return new hi(t)}parameter(t){return new Ye(t,this.generation)}interface_(t){return new Ei(t,this.generation)}enum_(t){return new Ti(t,this.generation)}dictionary(t){return new Xr(t,this.generation)}list(t){return new ei(t,this.generation)}readOnlyMemory(t){return new ri(t,this.generation)}set(t){return new ii(t,this.generation)}switch_(t){return new gi(t,this.generation)}ternary(t){return new bi(t,this.generation)}and(t){return new mi(t,this.generation)}or(t){return new yi(t,this.generation)}enumInstantiation(t){return new Zr(t,this.generation)}string_(t){return new ni(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 $(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 So=class{constructor(t){y(this,"generation");y(this,"System",$({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:()=>$({Serialization:()=>$({EnumMember:()=>this.csharp.classReference({name:"EnumMemberAttribute",namespace:"System.Runtime.Serialization"})})}),Collections:()=>$({Generic:()=>$({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:()=>$({Enumerable:()=>this.csharp.classReference({name:"Enumerable",namespace:"System.Linq"})})}),Globalization:()=>$({DateTimeStyles:()=>this.csharp.classReference({name:"DateTimeStyles",namespace:"System.Globalization"})}),Linq:()=>$({Enumerable:()=>this.csharp.classReference({name:"Enumerable",namespace:"System.Linq"})}),Net:()=>$({Http:()=>$({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:()=>$({SseEvent:()=>this.csharp.classReference({name:"SseEvent",namespace:"System.Net.ServerSentEvents"}),SseParser:()=>this.csharp.classReference({name:"SseParser",namespace:"System.Net.ServerSentEvents"})}),WebSockets:()=>$({ClientWebSocketOptions:()=>this.csharp.classReference({name:"ClientWebSocketOptions",namespace:"System.Net.WebSockets"})})}),IO:()=>$({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:()=>$({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:()=>$({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:()=>$({JsonNode:()=>this.csharp.classReference({name:"JsonNode",namespace:"System.Text.Json.Nodes"}),JsonObject:()=>this.csharp.classReference({name:"JsonObject",namespace:"System.Text.Json.Nodes"})}),Serialization:()=>$({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:()=>$({CancellationToken:()=>this.csharp.classReference({name:"CancellationToken",namespace:"System.Threading"}),Tasks:()=>$({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:()=>$({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",$({Framework:()=>$({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",$({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",$({Protobuf:()=>$({ByteString:()=>this.csharp.classReference({name:"ByteString",namespace:"Google.Protobuf"}),WellKnownTypes:()=>$({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",$({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",$({Core:()=>$({RpcException:()=>this.csharp.classReference({name:"RpcException",namespace:"Grpc.Core"})})}));this.generation=t}get csharp(){return this.generation.csharp}};n();a();s();var ec=new Set(["name","camelCase","snakeCase","screamingSnakeCase","pascalCase"]);function Yy(e,t){return ec.has(t)?e??"":e?`${e}.${t}`:t}var wo=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=Yy(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 c=ec.has(r);for(let[x,w]of Object.entries(t))typeof w=="object"&&w!==null&&(c&&ec.has(x)?this.indexByObject.set(w,i):this.createIndex(w,x,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[c,x]of Object.entries(t))typeof x=="object"&&x!==null&&this.createIndex(x,c,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 To(...e){return e.filter(Boolean).join("/")}var Fn=class{constructor(t,r,i,o,p={makeRelativeFilePath:c=>c,makeAbsoluteFilePath:c=>c,getNamespaceForTypeId:c=>"",getDirectoryForTypeId:c=>"",getCoreAsIsFiles:()=>[],getCoreTestAsIsFiles:()=>[],getPublicCoreAsIsFiles:()=>[],getAsyncCoreAsIsFiles:()=>[],getChildNamespaceSegments:c=>[]}){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 xo(this));y(this,"registry",new Ni(this));y(this,"model");y(this,"case");y(this,"extern",new So(this));y(this,"settings",$({namespace:()=>this.customConfig.namespace??ao(oo(`${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,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,userAgentNameFromPackage:()=>this.customConfig["user-agent-name-from-package"]??!1,unifiedClientOptions:()=>this.customConfig["unified-client-options"]??!1,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:$({mockServerTests:()=>this.support.makeRelativeFilePath("Unit/MockServer"),types:()=>"Types",exceptions:()=>"Exceptions",src:()=>"src",protobuf:()=>"proto",serializationTests:()=>this.support.makeRelativeFilePath("Unit/Serialization"),project:()=>this.support.makeRelativeFilePath(To(this.constants.folders.sourceFiles,this.support.makeRelativeFilePath(this.names.files.project))),sourceFiles:()=>this.support.makeRelativeFilePath(this.constants.folders.src),coreFiles:()=>this.support.makeRelativeFilePath(To(this.constants.folders.project,this.support.makeRelativeFilePath(this.constants.defaults.core))),publicCoreFiles:()=>this.support.makeRelativeFilePath(To(this.constants.folders.project,this.support.makeRelativeFilePath(this.constants.defaults.core),this.support.makeRelativeFilePath(this.constants.defaults.publicCore))),testFiles:()=>this.support.makeRelativeFilePath(To(this.constants.folders.sourceFiles,this.support.makeRelativeFilePath(this.names.files.testProject)))}),formatting:$({indent:()=>" "}),defaults:$({core:()=>"Core",publicCore:()=>"Public",version:()=>"0.0.0"})});y(this,"namespaces",$({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:$({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:$({client:()=>ao(oo(`${this.generatorConfig.organization}_${this.generatorConfig.workspaceName}`)),clientPrefix:()=>this.settings.exportedClientClassName||this.settings.clientClassName||this.names.project.client,packageId:()=>this.settings.packageId||this.namespaces.root}),files:$({project:()=>this.namespaces.root,testProject:()=>`${this.namespaces.root}.Test`}),methods:$({mockOauth:()=>"MockOAuthEndpoint",mockInferredAuth:()=>"MockInferredAuthEndpoint",getAccessTokenAsync:()=>"GetAccessTokenAsync",getAuthHeadersAsync:()=>"GetAuthHeadersAsync"}),variables:$({client:()=>"client",response:()=>"response",httpRequest:()=>"httpRequest",sendRequest:()=>"sendRequest",responseBody:()=>"responseBody",query:()=>"_query",headers:()=>"_headers"}),parameters:$({cancellationToken:()=>"cancellationToken",requestOptions:()=>"options",idempotentOptions:()=>"options"})});y(this,"Types",$({Arbitrary:t=>new te.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}),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}),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:c})=>this.csharp.classReference({origin:this.model.staticExplicit("OffsetPager"),namespace:this.namespaces.core,generics:[t,r,i,o,p,c]}),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",$({string:()=>new te.String(this),boolean:()=>new te.Boolean(this),integer:()=>new te.Integer(this),long:()=>new te.Long(this),uint:()=>new te.Uint(this),ulong:()=>new te.ULong(this),float:()=>new te.Float(this),double:()=>new te.Double(this),object:()=>new te.Object(this)}));y(this,"Value",$({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",$({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",$({private:t=>`_${uo.camelCase(t)}`}));y(this,"initializers",$({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 c=v.IR.IntermediateRepresentation(t)?t.casingsConfig:void 0;this.case=new Wi({generationLanguage:"csharp",keywords:c?.keywords,smartCasing:c?.smartCasing??!0}),this.model=new wo(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 Eo=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:ee.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,c)=>{this.context.errors.scope({index:c});try{return this.convert({typeReference:r,value:p})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:ee.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 c=this.context.getValueAsBoolean({value:i});return c==null?this.csharp.Literal.nop():this.csharp.Literal.boolean(c)}case"string":{let c=this.context.getValueAsString({value:i});return c==null?o?this.Primitive.string.getDeterminsticDefault(o):this.csharp.Literal.nop():this.csharp.Literal.string(c)}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,c)=>{this.context.errors.scope({index:c});try{return this.convert({typeReference:r,value:p})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:ee.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:ee.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,c])=>{this.context.errors.scope(p);try{return{key:this.convert({typeReference:r.key,value:p,as:"key"}),value:this.convert({typeReference:r.value,value:c})}}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)}),c=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:r,value:i});if(c==null)return this.csharp.Literal.nop();let x=c.singleDiscriminatedUnionType,w=this.getBaseProperties({discriminatedUnionTypeInstance:c,singleDiscriminatedUnionType:x});switch(x.type){case"samePropertiesAsObject":{let A=this.context.resolveNamedType({typeId:x.typeId});return A==null?this.csharp.Literal.nop():this.instantiateUnionWithBaseProperties({classReference:p,baseProperties:w,arguments_:[this.convertNamed({named:A,value:c.value})]})}case"singleProperty":{if(this.context.getRecord(c.value)==null)return this.csharp.Literal.nop();try{let I=["Value","Type"].includes(x.discriminantValue.name.pascalCase.safeName)?`${x.discriminantValue.name.pascalCase.safeName}Inner`:x.discriminantValue.name.pascalCase.safeName;return this.context.errors.scope(x.discriminantValue.wireValue),this.instantiateUnionWithBaseProperties({classReference:p,baseProperties:w,arguments_:[this.csharp.instantiateClass({classReference:this.csharp.classReference({name:I,enclosingType:p}),arguments_:[this.convert({typeReference:x.typeReference,value:x.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:c.discriminantValue,enclosingType:p}),arguments_:[]})]});default:ue(x)}}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(c=>{c.write(p," "),c.pushScope();for(let x of o)c.write(x.name," = ",x.assignment,",");c.popScope(!1)}))}getEnumValue(r,i){if(typeof i!="string")return this.context.errors.add({severity:ee.Critical,message:`Expected enum value string, got: ${typeof i}`}),this.csharp.Literal.nop();let o=r.values.find(x=>x.wireValue===i);if(o==null)return this.context.errors.add({severity:ee.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)}),c=p.registerField(this.model.getPropertyNameFor(o),o);return this.csharp.Literal.reference(this.csharp.enumInstantiation({reference:p,value:c}))}convertObject({object_:r,value:i,fallbackToDefault:o}){let p=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),c=new Map;for(let P of r.properties){let F=this.context.resolvePropertyName(p,P.name.name);c.set(P.name.wireValue,F)}let x=this.context.getRecord(i)??{},A=this.context.associateByWireValue({parameters:r.properties,values:x}).map(P=>{this.context.errors.scope(P.name.wireValue);try{return{name:c.get(P.name.wireValue)??this.context.getClassName(P.name.name),value:this.convert(P)}}finally{this.context.errors.unscope()}}),I=new Set(Object.keys(x));for(let P of r.properties){let F=c.get(P.name.wireValue)??this.context.getClassName(P.name.name);if(I.has(P.name.wireValue)){if(this.isRequiredProperty(P.typeReference)){let N=A.find(j=>j.name===F);if(N!=null&&v.Literal.nop(N.value)){let j=this.getDefaultLiteralForType(P.typeReference);j!=null&&(N.value=j)}}continue}if(this.isRequiredProperty(P.typeReference)){let N=this.getDefaultLiteralForType(P.typeReference);N!=null&&A.push({name:F,value:N})}}return this.csharp.Literal.class_({reference:p,fields:A})}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 c=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),x=[];for(let w of r.properties)if(this.isRequiredProperty(w.typeReference)){let A=this.getDefaultLiteralForType(w.typeReference,p);A!=null&&x.push({name:this.context.resolvePropertyName(c,w.name.name),value:A})}return p.delete(i),this.csharp.Literal.class_({reference:c,fields:x})}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 c=this.convert({typeReference:o,value:i});if(v.Literal.nop(c)||this.context.errors.size()>p){this.context.errors.truncate(p);continue}return{valueTypeReference:o,typeLiteral:c}}catch{this.context.errors.truncate(p);continue}}this.context.errors.add({severity:ee.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 c=this.getValueAsNumber({value:i,as:o});return c==null?p?this.Primitive.integer.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.integer(c)}case"LONG":{let c=this.getValueAsNumber({value:i,as:o});return c==null?p?this.Primitive.long.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.long(c)}case"UINT":{let c=this.getValueAsNumber({value:i,as:o});return c==null?p?this.Primitive.uint.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.uint(c)}case"UINT_64":{let c=this.getValueAsNumber({value:i,as:o});return c==null?p?this.Primitive.ulong.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.ulong(c)}case"FLOAT":{let c=this.getValueAsNumber({value:i,as:o});return c==null?p?this.Primitive.float.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.float(c)}case"DOUBLE":{let c=this.getValueAsNumber({value:i,as:o});return c==null?p?this.Primitive.double.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.double(c)}case"BOOLEAN":{let c=this.getValueAsBoolean({value:i,as:o});return c==null?p?this.Primitive.boolean.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.boolean(c)}case"STRING":{let c=this.context.getValueAsString({value:i});return c==null?p?this.Primitive.string.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.string(c)}case"DATE":{let c=this.context.getValueAsString({value:i});return c==null?p?this.Value.dateOnly.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.date(c)}case"DATE_TIME":case"DATE_TIME_RFC_2822":{let c=this.context.getValueAsString({value:i});return c==null?p?this.Value.dateTime.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.datetime(c)}case"UUID":{let c=this.context.getValueAsString({value:i});return c==null?p?this.Primitive.string.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.string(c)}case"BASE_64":{let c=this.context.getValueAsString({value:i});return c==null?p?this.Primitive.string.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.string(c)}case"BIG_INTEGER":{let c=this.context.getValueAsString({value:i});return c==null?p?this.Primitive.string.getDeterminsticDefault(p):this.csharp.Literal.nop():this.csharp.Literal.string(c)}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 Ao=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 Io=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 c of r.properties)switch(c.type){case"file":v.Record.missingKey(p,c.wireValue)&&(p[c.wireValue]="[bytes]"),o.fileFields.push({name:this.context.getPropertyName(c.name),value:this.getSingleFileProperty({property:c,record:p})});break;case"fileArray":v.Record.missingKey(p,c.wireValue)&&(p[c.wireValue]=["[bytes]"]),o.fileFields.push({name:this.context.getPropertyName(c.name),value:this.getArrayFileProperty({property:c,record:p})});break;case"bodyProperty":if(v.Record.missingKey(p,c.name.wireValue))switch(c.typeReference.type){case"optional":break;case"primitive":{switch(c.typeReference.value.toLowerCase()){case"integer":{p[c.name.wireValue]=123;break}case"string":{p[c.name.wireValue]="[string]";break}case"boolean":{p[c.name.wireValue]=!0;break}case"double":{p[c.name.wireValue]=123.456;break}case"float":{p[c.name.wireValue]=123.456;break}case"long":{p[c.name.wireValue]=123456789;break}case"uint":{p[c.name.wireValue]=123;break}case"uint64":{p[c.name.wireValue]=12345;break}case"date":{p[c.name.wireValue]=new Date(2021,1,1);break}case"datetime":{p[c.name.wireValue]=new Date(2021,1,1,12,0,0);break}case"uuid":{p[c.name.wireValue]="123e4567-e89b-12d3-a456-426614174000";break}case"base64":{p[c.name.wireValue]="SGVsbG8gd29ybGQh";break}case"biginteger":{p[c.name.wireValue]="12345678901234567890";break}}break}default:break}o.bodyPropertyFields.push({name:this.context.getPropertyName(c.name.name),value:this.getBodyProperty({property:c,record:p})});break;default:ue(c)}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 No=class e extends Xi{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 Fn(r,i.workspaceName,i.customConfig!=null?i.customConfig:{},i),this.dynamicTypeMapper=new Ao({context:this}),this.dynamicLiteralMapper=new Eo({context:this}),this.filePropertyMapper=new Io({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 c of p)switch(c.request.type){case"inlined":this.csharp.classReference({origin:c.request.declaration.name,namespace:this.getNamespace(c.request.declaration.fernFilepath)});break;case"body":break}}this.generation.Types.ClientOptions,this.generation.Types.RootClientForSnippets,this.csharp.freezeClassReferences()}};n();a();s();var Xm="request",Ro=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(x=>x.id===i.id))throw new Error("Endpoint does not have an example that matches the snippet");let p=this.csharp.codeblock(x=>{x.writeNodeStatement(this.constructClient({endpoint:r,snippet:i})),x.newLine(),x.writeNodeStatement(this.callMethod({endpoint:r,snippet:i}))}),c=this.getStyle(o);switch(c){case Qt.Concise:return p;case Qt.Full:return this.buildFullCodeBlock({body:p,options:o});default:ue(c)}}buildFullCodeBlock({body:r,options:i}){let o=this.getConfig(i),p=o.fullStyleMethodName??o.fullStyleClassName??"Example",c=this.csharp.class_({name:"Examples",namespace:"Examples",partial:!0,skipNamespaceDeclaration:!0,access:Ii.Access.Public});return c.addNamespaceReference(this.Types.RootClientForSnippets.namespace),c.addMethod({name:p,access:Ii.Access.Public,isAsync:!0,parameters:[],body:r}),c}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(c=>{c.write("await foreach (var item in "),c.writeNode(p),c.writeLine(")"),c.pushScope(),c.writeLine("/* consume each item */"),c.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:ee.Warning,message:`Auth with ${r.auth.type} configuration is required for this endpoint`}));let p=[],c=this.getConstructorBaseUrlArgs({baseUrl:i.baseURL,environment:i.environment});c.length>0&&p.push(...c),this.context.errors.scope(tt.Headers);let x=[];if(this.context.ir.headers!=null&&i.headers!=null&&x.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})),...x.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,...x]:[...o,...x,{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:ee.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:ee.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:ee.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:ee.Critical,message:r})}addWarning(r){this.context.errors.add({severity:ee.Warning,message:r})}getConstructorBasicAuthArg({auth:r,values:i}){let o=r,p=!!o.usernameOmit,c=!!o.passwordOmit,x=[];return p||x.push({name:this.context.getParameterName(r.username),assignment:this.csharp.Literal.string(i.username)}),c||x.push({name:this.context.getParameterName(r.password),assignment:this.csharp.Literal.string(i.password)}),x}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 c=p.name.wireValue,x=i.values?.[c];o.push({name:this.context.getParameterName(p.name.name),assignment:this.context.dynamicLiteralMapper.convert({typeReference:p.typeReference,value:x,fallbackToDefault:c})})}else this.context.errors.add({severity:ee.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 c=i[p.name.wireValue],x=this.getConstructorHeaderArg({header:p,value:c});x!=null&&o.push({name:this.context.getParameterName(p.name.name),assignment:x})}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}),c=p?this.getPathParameters({namedParameters:o,snippet:i}):[],x=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:c,filePropertyInfo:w});return x.length>0?[...x.map(I=>this.namedArgument({name:I.name,value:I.value})),this.namedArgument({name:Xm,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 c=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(F=>({name:this.context.resolvePropertyName(c,F.name.name),value:this.context.dynamicLiteralMapper.convert(F)}));this.context.errors.unscope(),this.context.errors.scope(tt.Headers);let I=this.context.associateByWireValue({parameters:r.headers??[],values:i.headers??{}}).map(F=>({name:this.context.resolvePropertyName(c,F.name.name),value:this.context.dynamicLiteralMapper.convert({...F,fallbackToDefault:F.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:c}):[];return this.context.errors.unscope(),this.csharp.Literal.class_({reference:c,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=[],c=this.context.associateByWireValue({parameters:r,values:this.context.getRecord(i)??{}});for(let x of c)p.push({name:this.context.resolvePropertyName(o,x.name.name),value:this.context.dynamicLiteralMapper.convert({...x,fallbackToDefault:x.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 c=r.body!=null?this.getBodyRequestArg({body:r.body,value:i.requestBody}):void 0;if(this.context.errors.unscope(),p.length>0&&c!=null)return[...p.map(w=>this.namedArgument({name:w.name,value:w.value})),this.namedArgument({name:Xm,value:c})];let x=p.map(w=>w.value);return c!=null&&x.push(c),x}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:ee.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 c of p)o.push({name:this.context.getPropertyName(c.name.name),value:this.context.dynamicLiteralMapper.convert({...c,fallbackToDefault:c.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 Oo=class extends Ki{constructor({ir:t,config:r,options:i={}}){super(new No({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 Ro({context:t})}};0&&(module.exports={DynamicSnippetsGenerator,buildSnippetTestGeneratorConfig});
|
|
34
34
|
/*! Bundled license information:
|
|
35
35
|
|
|
36
36
|
@jspm/core/nodelibs/browser/chunk-DtuTasat.js:
|