@fern-api/csharp-dynamic-snippets 2.10.0 → 2.11.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.
Files changed (46) hide show
  1. package/cjs/DynamicSnippetsGenerator.cjs +1 -1
  2. package/cjs/DynamicSnippetsGenerator.cjs.map +1 -1
  3. package/cjs/DynamicSnippetsGenerator.d.cts +1 -1
  4. package/cjs/{DynamicSnippetsGeneratorContext-Dz9RlVgp.d.cts → DynamicSnippetsGeneratorContext-pehoeH_w.d.cts} +3 -0
  5. package/cjs/EndpointSnippetGenerator.d.cts +1 -1
  6. package/cjs/context/DynamicLiteralMapper.d.cts +1 -1
  7. package/cjs/context/DynamicSnippetsGeneratorContext.cjs +1 -1
  8. package/cjs/context/DynamicSnippetsGeneratorContext.cjs.map +1 -1
  9. package/cjs/context/DynamicSnippetsGeneratorContext.d.cts +1 -1
  10. package/cjs/context/DynamicTypeMapper.d.cts +1 -1
  11. package/cjs/context/FilePropertyMapper.d.cts +1 -1
  12. package/cjs/index.cjs +1 -1
  13. package/cjs/index.cjs.map +1 -1
  14. package/cjs/index.d.cts +1 -1
  15. package/esm/DynamicSnippetsGenerator.d.ts +1 -1
  16. package/esm/DynamicSnippetsGenerator.js +1 -1
  17. package/esm/{DynamicSnippetsGeneratorContext-Dz9RlVgp.d.ts → DynamicSnippetsGeneratorContext-pehoeH_w.d.ts} +3 -0
  18. package/esm/EndpointSnippetGenerator.d.ts +1 -1
  19. package/esm/EndpointSnippetGenerator.js +1 -1
  20. package/esm/{chunk-BHXOAZDW.js → chunk-3XDW3MPR.js} +2 -2
  21. package/esm/{chunk-RHB5YSP4.js → chunk-CEB5TOCF.js} +2 -2
  22. package/esm/{chunk-RHB5YSP4.js.map → chunk-CEB5TOCF.js.map} +1 -1
  23. package/esm/{chunk-54PJL32I.js → chunk-DBQMCX7L.js} +2 -2
  24. package/esm/{chunk-ONI3ZPJV.js → chunk-EC2FLIE6.js} +2 -2
  25. package/esm/{chunk-JXSLTUG5.js → chunk-EUEE2577.js} +2 -2
  26. package/esm/{chunk-3AKTWPYH.js → chunk-GEII674B.js} +2 -2
  27. package/esm/{chunk-4A2AR7IK.js → chunk-KFPJC632.js} +2 -2
  28. package/esm/{chunk-VBCDESX3.js → chunk-KIW23CQ5.js} +2 -2
  29. package/esm/context/DynamicLiteralMapper.d.ts +1 -1
  30. package/esm/context/DynamicLiteralMapper.js +1 -1
  31. package/esm/context/DynamicSnippetsGeneratorContext.d.ts +1 -1
  32. package/esm/context/DynamicSnippetsGeneratorContext.js +1 -1
  33. package/esm/context/DynamicTypeMapper.d.ts +1 -1
  34. package/esm/context/DynamicTypeMapper.js +1 -1
  35. package/esm/context/FilePropertyMapper.d.ts +1 -1
  36. package/esm/context/FilePropertyMapper.js +1 -1
  37. package/esm/index.d.ts +1 -1
  38. package/esm/index.js +1 -1
  39. package/package.json +1 -1
  40. /package/esm/{chunk-BHXOAZDW.js.map → chunk-3XDW3MPR.js.map} +0 -0
  41. /package/esm/{chunk-54PJL32I.js.map → chunk-DBQMCX7L.js.map} +0 -0
  42. /package/esm/{chunk-ONI3ZPJV.js.map → chunk-EC2FLIE6.js.map} +0 -0
  43. /package/esm/{chunk-JXSLTUG5.js.map → chunk-EUEE2577.js.map} +0 -0
  44. /package/esm/{chunk-3AKTWPYH.js.map → chunk-GEII674B.js.map} +0 -0
  45. /package/esm/{chunk-4A2AR7IK.js.map → chunk-KFPJC632.js.map} +0 -0
  46. /package/esm/{chunk-VBCDESX3.js.map → chunk-KIW23CQ5.js.map} +0 -0
@@ -4,4 +4,4 @@ import '@fern-api/csharp-codegen/lib/context/model-navigator';
4
4
  import '@fern-api/csharp-codegen';
5
5
  import '@fern-api/browser-compatible-base-generator';
6
6
  import '@fern-api/dynamic-ir-sdk';
7
- export { D as DynamicSnippetsGeneratorContext } from '../DynamicSnippetsGeneratorContext-Dz9RlVgp.cjs';
7
+ export { D as DynamicSnippetsGeneratorContext } from '../DynamicSnippetsGeneratorContext-pehoeH_w.cjs';
@@ -1,6 +1,6 @@
1
1
  import '@fern-api/csharp-codegen';
2
2
  import '@fern-api/dynamic-ir-sdk';
3
- export { b as DynamicTypeMapper } from '../DynamicSnippetsGeneratorContext-Dz9RlVgp.cjs';
3
+ export { b as DynamicTypeMapper } from '../DynamicSnippetsGeneratorContext-pehoeH_w.cjs';
4
4
  import '@fern-api/csharp-codegen/lib/ast';
5
5
  import '@fern-api/csharp-codegen/lib/ast/types/Type';
6
6
  import '@fern-api/csharp-codegen/lib/context/model-navigator';
@@ -1,6 +1,6 @@
1
1
  import '@fern-api/csharp-codegen';
2
2
  import '@fern-api/dynamic-ir-sdk';
3
- export { F as FilePropertyInfo, c as FilePropertyMapper } from '../DynamicSnippetsGeneratorContext-Dz9RlVgp.cjs';
3
+ export { F as FilePropertyInfo, c as FilePropertyMapper } from '../DynamicSnippetsGeneratorContext-pehoeH_w.cjs';
4
4
  import '@fern-api/csharp-codegen/lib/ast';
5
5
  import '@fern-api/csharp-codegen/lib/ast/types/Type';
6
6
  import '@fern-api/csharp-codegen/lib/context/model-navigator';
package/cjs/index.cjs CHANGED
@@ -29,7 +29,7 @@ ${yi(this).map(r=>` ${r.fn} - ${r.path}:${r.position}`).join(`
29
29
  `),this.hasSameAccess(this.init)||r.write(`${this.init} `),r.writeTextStatement("init"),r.writeNoIndent(`#else
30
30
  `),r.writeTextStatement("set"),r.writeNoIndent(`#endif
31
31
  `)):(this.hasSameAccess(this.init)||r.write(`${this.init} `),(l=this.accessors)!=null&&l.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} `),(p=this.accessors)!=null&&p.set?(r.write("set"),r.write(" => "),this.accessors.set(r),r.writeTextStatement("")):r.write("set; ")),r.write("}")),this.initializer!=null?(a?r.write(" => "):r.write(" = "),this.initializer.write(r),r.writeLine(";")):!this.skipDefaultInitializer&&!n&&i?v.Type(this.type)&&this.type.writeEmptyCollectionInitializer(r):!this.get&&!this.init&&r.writeLine(";")}hasSameAccess(r){return r===!0||r===this.access}};var $e;(function(e){e[e.INSTANCE=0]="INSTANCE",e[e.STATIC=1]="STATIC"})($e||($e={}));var qr=class e extends wr{constructor({name:r,isAsync:n,override:i,access:a,return_:c,body:l,noBody:p,bodyType:h,summary:y,doc:P,type:T,classReference:M,parameters:J,typeParameters:G,annotations:X,codeExample:te,interfaceReference:re,origin:He,enclosingType:D},K){super({enclosingType:D},He,K);o(this,"name");o(this,"isAsync");o(this,"access");o(this,"return");o(this,"noBody");o(this,"body");o(this,"bodyType");o(this,"summary");o(this,"doc");o(this,"type");o(this,"reference");o(this,"override");o(this,"parameters");o(this,"typeParameters");o(this,"annotations");o(this,"interfaceReference");this.name=r,this.isAsync=n!=null?n:!1,this.override=i!=null?i:!1,this.access=a,this.return=c,this.noBody=p!=null?p:!1,this.body=l,this.bodyType=h!=null?h:e.BodyType.Statement,this.summary=y,this.doc=this.csharp.xmlDocBlockOf(P!=null?P:{summary:y,codeExample:te}),this.type=T!=null?T:$e.INSTANCE,this.reference=M,this.parameters=J!=null?J:[],this.typeParameters=G!=null?G:[],this.annotations=(X!=null?X:[]).map(d=>d instanceof me?this.csharp.annotation({reference:d}):d),this.interfaceReference=re}get isAsyncEnumerable(){return v.AsyncEnumerable(this.return)}addParameter(r){return r instanceof We||(r=new We(r,this.generation)),this.parameters.push(r),r}write(r){var n,i;if(r.writeNode(this.doc),this.annotations.forEach(a=>{a.write(r)}),r.writeNewLineIfLastLineNot(),this.access&&r.write(`${this.access} `),this.type===$e.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((a,c)=>{a.write(r),c<this.typeParameters.length-1&&r.write(", ")}),r.write(">")),r.write("("),this.parameters.forEach((a,c)=>{a.write(r),c<this.parameters.length-1&&r.write(", ")}),r.write(")"),this.noBody)r.writeLine(";");else switch(this.bodyType){case e.BodyType.Statement:r.write(" "),r.pushScope(),(n=this.body)==null||n.write(r),r.popScope();break;case e.BodyType.Expression:r.write(" => "),(i=this.body)==null||i.write(r),r.writeSemicolonIfLastCharacterIsNot();break;default:W(this.bodyType)}}getParameters(){return this.parameters}};(function(e){e.BodyType={Statement:"statement",Expression:"expression"}})(qr||(qr={}));var ri=class extends ve{constructor({name:r,namespace:n,access:i,partial:a,interfaceReferences:c,enclosingType:l,origin:p},h){super(p,h);o(this,"access");o(this,"partial");o(this,"reference");o(this,"interfaceReferences");o(this,"fields",[]);o(this,"methods",[]);r=r||(p?this.model.getClassNameFor(p):(0,Qi.fail)("Class/Interface name or origin is required")),this.reference=l?this.csharp.classReference({name:r,enclosingType:l}):this.csharp.classReference({name:r,namespace:n||(0,Qi.fail)("Class/Interface: Namespace or enclosingType is required ")}),this.access=i,this.partial=a!=null?a:!1,this.interfaceReferences=c!=null?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):(0,Qi.fail)(`Cannot create explicit named member '${r}' on '${this.name}' because the class is not bound to an origin.`)}getField(r){return this.fields.find(n=>{var i;return((i=this.model.provenance(n.origin))==null?void 0:i.jsonPath)===r.jsonPath})}addField(r){r.enclosingType=this.reference;let n=new ti(r,this.generation);return this.fields.push(n),n}addMethod(r){r.enclosingType=this.reference;let n=new qr(r,this.generation);return this.methods.push(n),n}get multipartMethodName(){return"AddJsonPart"}get multipartMethodNameForCollection(){return"AddJsonParts"}get isOptional(){return!1}get isCollection(){return!1}get isReferenceType(){}asOptional(){return new De(this,this.generation)}asNonOptional(){return this}get defaultValue(){return this.csharp.Literal.null()}get fullyQualifiedName(){return this.reference.fullyQualifiedName}};var Ne=class Ne extends ri{constructor({name:r,namespace:n,access:i,static_:a,abstract_:c,sealed:l,partial:p,readonly:h,parentClassReference:y,interfaceReferences:P,enclosingType:T,type:M,summary:J,doc:G,annotations:X,primaryConstructor:te,origin:re},He){super({name:r,namespace:n,access:i,partial:p,interfaceReferences:P,enclosingType:T,origin:re},He);o(this,"static_");o(this,"abstract_");o(this,"sealed");o(this,"readonly");o(this,"parentClassReference");o(this,"type");o(this,"summary");o(this,"doc");o(this,"annotations",[]);o(this,"primaryConstructor");o(this,"namespaceReferences",[]);o(this,"constructors",[]);o(this,"operators",[]);o(this,"nestedClasses",[]);o(this,"nestedInterfaces",[]);this.static_=a!=null?a:!1,this.abstract_=c!=null?c:!1,this.sealed=l!=null?l:!1,this.readonly=h!=null?h:!1,this.type=M!=null?M:Ne.ClassType.Class,this.summary=J,this.doc=this.csharp.xmlDocBlockOf(G!=null?G:{summary:J}),this.parentClassReference=y,this.annotations=(X!=null?X:[]).map(D=>D instanceof me?this.csharp.annotation({reference:D}):D),this.primaryConstructor=te}addConstructor(r){let n=new Ne.Constructor(r,this.generation);return this.constructors.push(n),n}addNestedClass(r){if(r instanceof Ne||(r.enclosingType=this.reference,r=new Ne(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(n=>{n instanceof Ne?this.addNestedClass(n):this.addNestedClass(n)})}addAnnotation(r){return r instanceof Pr||(r=new Pr(r,this.generation)),this.annotations.push(r),r}addOperator(r){this.operators.push(r)}addOperators(r){r.forEach(n=>this.addOperator(n))}write(r){if(this.namespaceReferences.forEach(n=>{r.addNamespace(n)}),this.isNested||(r.writeLine(`namespace ${this.namespace};`),r.newLine()),r.writeNode(this.doc),this.annotations.forEach(n=>{n.write(r)}),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 n=this.primaryConstructor;r.write("("),n.parameters.forEach((i,a)=>{a>0&&r.write(","),i.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 n=this.primaryConstructor;r.write("("),this.primaryConstructor.superClassArguments.forEach((i,a)=>{i.write(r),a<n.superClassArguments.length-1&&r.write(", ")}),r.write(")")}this.interfaceReferences.forEach((n,i)=>{n.write(r),i<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.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}writeConstructors(r){this.constructors.forEach(n=>{r.writeNode(this.csharp.xmlDocBlockOf(n.doc)),r.write(`${n.access} ${this.name} (`),n.parameters.forEach((i,a)=>{i.write(r),a<n.parameters.length-1&&r.write(", ")}),r.write(")"),n.baseConstructorCall!=null&&(r.write(" : "),n.baseConstructorCall.write(r)),r.pushScope(),n.body.write(r),r.popScope(),r.newLine()})}writeFields({writer:r,fields:n}){n.forEach((i,a)=>{i.write(r),r.writeNewLineIfLastLineNot(),a<this.fields.length-1&&r.newLine()})}writeConsts(r){this.writeFields({writer:r,fields:this.getFields().sort(ni).sort(ia).filter(this.fieldConstFilter())})}writeFieldFields(r){this.writeFields({writer:r,fields:this.getFields().sort(ni).sort(ia).filter(this.fieldFieldFilter())})}writeProperties(r){this.writeFields({writer:r,fields:this.getFields().sort(ni).sort(ia).filter(this.fieldPropertyFilter())})}writeMethods(r){this.methods.sort(ni).sort(sE).sort(iE).forEach(n=>{n.write(r),r.writeNewLineIfLastLineNot(),r.newLine()})}writeOperators(r){this.operators.forEach(n=>{this.writeOperator({writer:r,operator:n}),r.newLine()})}writeNestedClasses(r){this.nestedClasses.sort(ni).forEach((n,i)=>{n.write(r),r.writeNewLineIfLastLineNot(),i<this.fields.length-1&&r.newLine()})}writeNestedInterfaces(r){this.nestedInterfaces.sort(ni).forEach((n,i)=>{n.write(r),r.writeNewLineIfLastLineNot(),i<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===Ne.ClassType.Class||this.type===Ne.ClassType.Record}writeOperator({writer:r,operator:n}){var i;if(r.write("public static "),n.type===Ne.CastOperator.Type.Explicit||n.type===Ne.CastOperator.Type.Implicit){r.write(`${n.type} `),r.write("operator ");let a=(i=n.to)!=null?i:this.reference;r.writeNode(a),r.write("("),n.parameter.write(r)}else{let a=n;a.return.write(r),r.write(" operator "),r.write(`${n.type}(`),a.parameters.forEach((c,l)=>{c.write(r),l<a.parameters.length-1&&r.write(", ")})}n.useExpressionBody?(r.write(") => "),r.writeNodeStatement(n.body)):(r.write(") {"),r.writeNode(n.body),r.writeLine("}"))}addNamespaceReference(r){this.namespaceReferences.push(r)}};o(Ne,"ClassType",{Class:"class",Record:"record",Struct:"struct",RecordStruct:"record struct"}),o(Ne,"Access",ee);var hr=Ne;(function(e){class t{constructor({doc:i,body:a,parameters:c,access:l,baseConstructorCall:p},h){o(this,"generation");o(this,"doc");o(this,"body");o(this,"parameters");o(this,"access");o(this,"baseConstructorCall");this.generation=h,this.parameters=c!=null?c:[],this.access=l!=null?l:ee.Public,this.doc=i,this.body=new Ar({},this.generation),a!=null&&this.body.append(a),this.baseConstructorCall=p}addParameter(i){let a=new We(i,this.generation);return this.parameters.push(a),a}}e.Constructor=t;let r;(function(n){n.Type={Implicit:"implicit",Explicit:"explicit"}})(r=e.CastOperator||(e.CastOperator={}))})(hr||(hr={}));function Sj(e){switch(e){case void 0:return 0;case ee.Private:return 1;case ee.Protected:return 2;case ee.Internal:return 3;case ee.Public:return 4}}function ni(e,t){return Sj(e.access)-Sj(t.access)}function ia(e,t){return e.isStatic===t.isStatic?0:e.isStatic?-1:1}function iE(e,t){return e.type===$e.STATIC&&t.type!==$e.STATIC?-1:e.type!==$e.STATIC&&t.type===$e.STATIC?1:0}function sE(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}var ii=class extends ve{constructor({name:r,namespace:n,access:i,annotations:a,origin:c},l){super(c,l);o(this,"access");o(this,"reference");o(this,"annotations");o(this,"fields",[]);this.reference=this.csharp.classReference({name:r,namespace:n,origin:c}),this.access=i,this.annotations=a!=null?a:[]}get name(){return this.reference.name}get namespace(){return this.reference.namespace}getNamespace(){return this.namespace}addMember(r){this.fields.push({name:r.name,value:this.csharp.annotation({reference:this.System.Runtime.Serialization.EnumMember,argument:this.csharp.codeblock(n=>{n.write("Value = "),n.writeNode(this.csharp.string_({string:r.value}))})})})}write(r){r.writeLine(`namespace ${this.namespace};`),r.newLine();for(let n of this.annotations)n.write(r);r.writeNewLineIfLastLineNot(),r.write(`${this.access} `),r.write("enum "),r.writeLine(`${this.name}`),r.pushScope(),this.fields.forEach((n,i)=>{n.value.write(r),r.write(n.name),i<this.fields.length-1&&(r.writeLine(","),r.newLine())}),r.writeNewLineIfLastLineNot(),r.popScope()}};var si=class extends ri{constructor({name:t,namespace:r,access:n,partial:i,interfaceReferences:a,enclosingType:c,origin:l},p){super({name:t,namespace:r,access:n,partial:i,interfaceReferences:a,enclosingType:c,origin:l},p)}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,n)=>{r.write(t),n<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()}};var ai=class extends ve{constructor({name:r,namespace:n,parentClassReference:i,origin:a},c){super(a,c);o(this,"reference");o(this,"parentClassReference");o(this,"testMethods",[]);this.reference=this.csharp.classReference({name:r,namespace:n,origin:a}),this.parentClassReference=i}get name(){return this.reference.name}get namespace(){return this.reference.namespace}write(r){r.writeNode(this.getClass())}getClass(){let r=new hr({access:ee.Public,name:this.name,namespace:this.namespace,annotations:[this.NUnit.Framework.TestFixture],parentClassReference:this.parentClassReference,origin:this.origin},this.generation);for(let n of this.testMethods)r.addMethod({access:ee.Public,isAsync:n.isAsync,name:n.name,parameters:[],body:n.body,annotations:[this.NUnit.Framework.Test]});return r}addTestMethod(r){this.testMethods.push(r)}};var qi=require("path");var Mj=require("assert");var vn=require("assert");var sa={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 aE=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 oE=new Set(["from","where","select","orderby","groupby","into","let","join","on","equals"]),uE=new Set(["async","await"]),cE=new Set(["yield"]),lE=new Set(["var","dynamic"]),fE=new Set(["using","alias"]);var pE=new Set(["required","scoped","unmanaged","managed"]),dE=new Set(["when","and","or","not"]),hE=new Set(["Equals","GetHashCode","ToString","GetType","MemberwiseClone","Finalize"]),yE=new Set([...aE,...oE,...uE,...cE,...lE,...fE,...pE,...dE]),Xi=class{constructor(t,r,n){o(this,"registry");o(this,"name");o(this,"jsonPath");this.registry=t,this.name=r,this.jsonPath=n}};var Yi=class{constructor(t){o(this,"scope");o(this,"byName",new Map);o(this,"byPath",new Map);o(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)&&(0,vn.fail)(`set: ${t.name} in ${this.scope.fullyQualifiedName} already exists`),t.jsonPath&&this.byPath.has(t.jsonPath)&&(0,vn.fail)(`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)&&(0,vn.fail)(`redirect: ${t} in ${this.scope.fullyQualifiedName} already has a redirect`),this.redirections.set(t,r)}},aa=class extends Xi{constructor(r,n,i,a){super(r,n);o(this,"namespace");o(this,"fullyQualifiedName");o(this,"fields");o(this,"methods");this.namespace=i,this.fullyQualifiedName=a,this.fields=new Yi(this),this.methods=new Yi(this)}isKeyword(r){return yE.has(r)}isBuiltinMemberName(r){return hE.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 n=`${r}_`,i=2;for(;this.nameBlocked(n);)n=`${r}_${i}`,i++;return n}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,n,i){let a=this.registry.model.jsonPath(n);if(a){let p=this.fields.getByJsonPath(a);if(p)return p.name}let c=this.fields.getByName(r);if(c&&a===c.jsonPath)return r;switch(this.nameBlocked(r)){case"field":n&&v.Provenance(n)&&n.explicit||(0,vn.fail)(`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 Zi(this.registry,r,this,a,i)),this.registry.setFieldNameShortcut(a,r),r}let l=this.getAlternativeName(r);return this.fields.set(new Zi(this.registry,l,this,a,i)),this.fields.redirect(r,l),this.registry.setFieldNameShortcut(a,l),l}getFieldName(r,n){var l;let i=(l=this.getFieldByJsonPath(this.registry.model.jsonPath(r)))==null?void 0:l.name;if(i)return i;if(v.Provenance(r)){let p=this.getRedirectedFieldName(n);if(p)return p;let h=this.getFieldByName(n);if(h){let y=this.registry.model.provenance(h.jsonPath);return y!=null&&y.explicit?n:`${n}_`}return n}let a=this.getFieldByName(n);if(a){let p=this.registry.model.provenance(a.jsonPath);return p!=null&&p.explicit?n:a.name}let c=this.getRedirectedFieldName(n);if(c)return c;this.isMethod(n)}},oa=class extends Xi{constructor(r,n,i,a){super(r,n,a);o(this,"scope");this.scope=i}},Zi=class extends oa{constructor(r,n,i,a,c){super(r,n,i,a);o(this,"field");this.field=c}};var oi=class e{constructor(t){o(this,"generation");o(this,"classReferenceByJsonPath",new Map);o(this,"typeRegistry",new Map);o(this,"namespaceRegistry",new Map);o(this,"typeNames",new Map);o(this,"namespaceNames",new Map);o(this,"implicitNamespaces",new Set);o(this,"shortcuts",new Map);o(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(sa))t.split(".").forEach(n=>this.knownBuiltInIdentifiers.add(n)),r.forEach(n=>this.knownBuiltInIdentifiers.add(n));for(let[t,r]of Object.entries(sa)){for(let i of r)this.typeNames.set(i,new Set([t]));let n=t.split(".")[0];n&&this.typeNames.set(n,new Set([t]))}this.typeNames.set("System",new Set(["System"])),this.typeNames.set("NUnit",new Set(["NUnit"])),this.typeNames.set("OneOf",new Set(["OneOf"]))}setFieldNameShortcut(t,r){if(t){let n=this.shortcuts.get(t);n&&n!==r&&(0,vn.fail)(`BAD_BAD_BAD setFieldNameShortcut: ${t} already has a name: ${n} - 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){var r;return this.shortcuts.get((r=this.model.jsonPath(t))!=null?r:">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){var r,n;return t?((n=(r=this.typeNames.get(t))==null?void 0:r.size)!=null?n:0)>1:!1}isAmbiguousNamespaceName(t){var r,n;return t?((n=(r=this.namespaceNames.get(t))==null?void 0:r.size)!=null?n:0)>1:!1}static fullyQualifiedNameOf(t){return t.enclosingType?`${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){var p;let{name:n,namespace:i,enclosingType:a,fullyQualifiedName:c,origin:l}=t;if(l){let h=(p=this.model.jsonPath(l))!=null?p:(0,vn.fail)(`JsonPath not found for origin: ${JSON.stringify(l).substring(0,100)}`);this.classReferenceByJsonPath.set(h,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 h of this.allNamespacesOf(i))this.registerNamespace(h,h);a||this.trackTypeName(n,i);for(let h of[this.generation.namespaces.root,...this.implicitNamespaces])if(i.startsWith(h)){let y=i.split(".")[h.split(".").length];y&&this.trackTypeName(y,i)}}return t}addImplicitNamespace(t){this.implicitNamespaces.add(t)}isNamespaceImplicit(t){return this.implicitNamespaces.has(t)}get implicitlyImportedNamespaces(){return[...this.implicitNamespaces]}trackTypeName(t,r){var a,c;this.typeNames.has(t)?(a=this.typeNames.get(t))==null||a.add(r):this.typeNames.set(t,new Set([r]));let n=r.split("."),i="";for(let l of n)this.namespaceNames.has(l)?(c=this.namespaceNames.get(l))==null||c.add(i):this.namespaceNames.set(l,new Set([i])),i=i?`${i}.${l}`:l}allNamespacesOf(t){if(!t||typeof t!="string")return new Set;let r="",n=new Set;for(let i of t.split("."))i.trim()&&(r=r?`${r}.${i}`:`${i}`,n.add(r));return n}registerClassReference(t,r){var J,G;let{name:n,namespace:i,enclosingType:a,origin:c}=t,l=this.model.jsonPath(c),p=(J=l?this.classReferenceByJsonPath.get(l):void 0)!=null?J:this.typeRegistry.get(r),h=this.model.jsonPath(p==null?void 0:p.origin),y=h&&l?h===l?"match":"mismatch":"no origin";if(p&&y!=="mismatch")return new me({name:p.name,namespace:p.namespace,enclosingType:p.enclosingType,fullyQualifiedName:p.fullyQualifiedName,namespaceAlias:t.namespaceAlias,fullyQualified:t.fullyQualified,generics:t.generics,global:t.global,origin:(G=p.origin)!=null?G:c,isCollection:p.isCollection,isReferenceType:p.isReferenceType,multipartMethodName:p.multipartMethodName,multipartMethodNameForCollection:p.multipartMethodNameForCollection},p.scope,this.generation);let P=!1,T=this.resolveNamespace(i);T!==i&&(i=T,P=!0);let M;e:for(;;){M=e.fullyQualifiedNameOf({name:n,namespace:i,enclosingType:a});let X="",te=i.split(".");for(let re=0;re<te.length;re++)if(X=X?`${X}.${te[re]}`:`${te[re]}`,this.typeRegistry.has(X)){te[re]=`${te[re]}_`,i=te.join("."),P=!0;continue e}if(P&&this.registerNamespace(t.namespace,i),y==="mismatch"&&(p==null?void 0:p.name)===n){n=`${n}_`,P=!0;continue e}if(this.namespaceRegistry.has(M)){n=`${n}_`,P=!0;continue e}break}return this.trackType(new me({name:n,namespace:i,enclosingType:a,namespaceAlias:t.namespaceAlias,fullyQualified:t.fullyQualified,generics:t.generics,global:t.global,fullyQualifiedName:M,origin:c,isCollection:t.isCollection,isReferenceType:t.isReferenceType,multipartMethodName:t.multipartMethodName,multipartMethodNameForCollection:t.multipartMethodNameForCollection},new aa(this,n,i,M),this.generation),r)}resolveNamespace(t){let r=this.namespaceRegistry.get(t);if(r!==void 0)return r;let n=t.split(".");for(let i=n.length-1;i>=0;i--){let a=n.slice(0,i).join(".");if(this.namespaceRegistry.has(a)){let c=this.namespaceRegistry.get(a);if(c!==void 0){let l=n.slice(i).join("."),p=`${c}.${l}`;return this.registerNamespace(t,p),p}}}return t}canonicalizeNamespace(t){let r=this.namespaceRegistry.get(t);if(r!==void 0)return r;let n=!1,i=t;e:for(;;){let a="",c=i.split(".");for(let l=0;l<c.length;l++)if(a=a?`${a}.${c[l]}`:`${c[l]}`,this.typeRegistry.has(a)){c[l]=`${c[l]}_`,i=c.join("."),n=!0;continue e}break}return n&&this.registerNamespace(t,i),i}};var ki=class{constructor(t){o(this,"generation");o(this,"frozen",!1);o(this,"extraClassReferences",new Map);o(this,"InstantiatedPrimitive",{string:t=>new pe({type:"string",value:t},this.generation),boolean:t=>new pe({type:"boolean",value:t},this.generation),integer:t=>new pe({type:"integer",value:t},this.generation),long:t=>new pe({type:"long",value:t},this.generation),uint:t=>new pe({type:"uint",value:t},this.generation),ulong:t=>new pe({type:"ulong",value:t},this.generation),float:t=>new pe({type:"float",value:t},this.generation),double:t=>new pe({type:"double",value:t},this.generation),date:t=>new pe({type:"date",value:t},this.generation),dateTime:(t,r=!0)=>new pe({type:"dateTime",value:t,parse:r},this.generation),uuid:t=>new pe({type:"uuid",value:t},this.generation),null:()=>new pe({type:"null"},this.generation)});o(this,"Literal",{class_:({reference:t,fields:r})=>new E.Class_(t,r,this.generation),dictionary:({keyType:t,valueType:r,entries:n})=>new E.Dictionary(t,r,n,this.generation),list:({valueType:t,values:r})=>new E.List(t,r,this.generation),set:({valueType:t,values:r})=>new E.Set(t,r,this.generation),boolean:t=>new E.Boolean(t,this.generation),float:t=>new E.Float(t,this.generation),date:t=>new E.Date(t,this.generation),datetime:t=>new E.DateTime(t,this.generation),decimal:t=>new E.Decimal(t,this.generation),double:t=>new E.Double(t,this.generation),integer:t=>new E.Integer(t,this.generation),long:t=>new E.Long(t,this.generation),uint:t=>new E.Uint(t,this.generation),ulong:t=>new E.Ulong(t,this.generation),reference:t=>new E.Reference(t,this.generation),string:t=>new E.String(t,this.generation),null:()=>new E.Null(this.generation),nop:()=>new E.Nop(this.generation),unknown:t=>new E.Unknown(t,this.generation)});o(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)throw new Error("ClassReference: Both enclosingType and namespace cannot be provided");t.namespace=t.enclosingType.namespace}let r=oi.fullyQualifiedNameOf(t);if(this.frozen&&!this.generation.registry.isRegisteredTypeName(r)){let n=this.extraClassReferences.get(r);n||(n=new Set,this.extraClassReferences.set(r,n)),n.add(`${r} -
32
- ${hi()}`)}return this.generation.registry.registerClassReference(t,r)}freezeClassReferences(){this.frozen=!0}getPropertyName(t,r){var c;let n=this.model.getPropertyNameFor(r),i=(c=this.model.origin(r))!=null?c:(0,Mj.fail)(`Origin not found for property: ${JSON.stringify(r).substring(0,100)}`),a=t.getFieldName(i,n);return a||n}class_(t){let r=t;return"reference"in t&&(r=Pe(Pe({},t.reference),t)),new hr(r,this.generation)}testClass(t){return new ai(t,this.generation)}annotation(t){return new Pr(t,this.generation)}instantiateClass(t){return new Vn(t,this.generation)}invokeMethod(t){return new Hn(t,this.generation)}codeblock(t){return new Nr(t,this.generation)}code(){return new Ar({},this.generation)}anonymousFunction(t){return new Yn(t)}parameter(t){return new We(t,this.generation)}interface_(t){return new si(t,this.generation)}enum_(t){return new ii(t,this.generation)}dictionary(t){return new Wn(t,this.generation)}list(t){return new Gn(t,this.generation)}readOnlyMemory(t){return new Kn(t,this.generation)}set(t){return new zn(t,this.generation)}switch_(t){return new kn(t,this.generation)}ternary(t){return new ei(t,this.generation)}and(t){return new Xn(t,this.generation)}or(t){return new Zn(t,this.generation)}enumInstantiation(t){return new $n(t,this.generation)}string_(t){return new Jn(t,this.generation)}xmlDocBlock(t){return new Cr(t,this.generation)}xmlDocBlockOf(t){return t instanceof Cr?t:new Cr(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)}.`)}};function R(e){let t={},r={};for(let[n,i]of Object.entries(e))i.length===0?Object.defineProperty(r,n,{get(){return n in t||(t[n]=i()),t[n]},enumerable:!0,configurable:!0}):r[n]=i;return r}var es=class{constructor(t){o(this,"generation");o(this,"System",R({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:"Serializable",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:()=>R({Serialization:()=>R({EnumMember:()=>this.csharp.classReference({name:"EnumMember",namespace:"System.Runtime.Serialization"})})}),Collections:()=>R({Generic:()=>R({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:()=>R({Enumerable:()=>this.csharp.classReference({name:"Enumerable",namespace:"System.Linq"})})}),Globalization:()=>R({DateTimeStyles:()=>this.csharp.classReference({name:"DateTimeStyles",namespace:"System.Globalization"})}),Linq:()=>R({Enumerable:()=>this.csharp.classReference({name:"Enumerable",namespace:"System.Linq"})}),Net:()=>R({Http:()=>R({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:()=>R({SseEvent:()=>this.csharp.classReference({name:"SseEvent",namespace:"System.Net.ServerSentEvents"}),SseParser:()=>this.csharp.classReference({name:"SseParser",namespace:"System.Net.ServerSentEvents"})}),WebSockets:()=>R({ClientWebSocketOptions:()=>this.csharp.classReference({name:"ClientWebSocketOptions",namespace:"System.Net.WebSockets"})})}),IO:()=>R({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:()=>R({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:()=>R({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:()=>R({JsonNode:()=>this.csharp.classReference({name:"JsonNode",namespace:"System.Text.Json.Nodes"}),JsonObject:()=>this.csharp.classReference({name:"JsonObject",namespace:"System.Text.Json.Nodes"})}),Serialization:()=>R({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:"JsonExtensionData",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:"JsonIgnore",namespace:"System.Text.Json.Serialization"}),JsonPropertyName:()=>this.csharp.classReference({name:"JsonPropertyName",namespace:"System.Text.Json.Serialization"})})})}),Threading:()=>R({CancellationToken:()=>this.csharp.classReference({name:"CancellationToken",namespace:"System.Threading"}),Tasks:()=>R({Task:t=>this.csharp.classReference({name:"Task",namespace:"System.Threading.Tasks",generics:t?[t]:void 0})})})}));o(this,"NUnit",R({Framework:()=>R({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"})})}));o(this,"OneOf",R({OneOf:t=>this.csharp.classReference({name:"OneOf",namespace:"OneOf",generics:t}),OneOfBase:t=>this.csharp.classReference({name:"OneOfBase",namespace:"OneOf",generics:t})}));o(this,"Google",R({Protobuf:()=>R({WellKnownTypes:()=>R({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"})})})}));o(this,"WireMock",R({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"})}));o(this,"Grpc",R({Core:()=>R({RpcException:()=>this.csharp.classReference({name:"RpcException",namespace:"Grpc.Core"})})}));this.generation=t}get csharp(){return this.generation.csharp}};var Ci=require("assert");function Tj(e){return e.split(".").filter(t=>!["name","camelCase","snakeCase","screamingSnakeCase","pascalCase"].includes(t)).join(".")}var ts=class{constructor(t,r){o(this,"generation");o(this,"indexByObject",new Map);o(this,"indexByPath",new Map);o(this,"explicitByObject",new Map);o(this,"explicitByPath",new Map);o(this,"root");o(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="",n){let i=Tj(n!=null&&n.jsonPath?`${n.jsonPath}.${r}`:r);if(this.indexByPath.has(i)){n||(0,Ci.fail)(`Parent provenance not found for node: ${JSON.stringify(t).substring(0,100)}`),this.indexByObject.set(t,n);for(let[c,l]of Object.entries(t))typeof l=="object"&&l!==null&&this.createIndex(l,c,n);return n}let a={jsonPath:i,name:r,node:t,parent:n};this.indexByObject.set(t,a),this.indexByPath.set(i,a);for(let[c,l]of Object.entries(t))typeof l=="object"&&l!==null&&this.createIndex(l,c,a);return a}staticExplicit(t){return this.explicit(this.ir,t)}explicit(t,r){var c;let n=(c=this.provenance(t))!=null?c:(0,Ci.fail)(`Provenance not found for node: ${JSON.stringify(t).substring(0,100)}`),i=Fe(Pe({},n),{jsonPath:Tj(`${n.jsonPath}+${r}`),name:r,node:n.node,parent:n,explicit:!0}),a=this.explicitByObject.get(n.node);return a?a.add(i):this.explicitByObject.set(n.node,new Set([i])),this.explicitByPath.set(i.jsonPath,i),i}provenance(t){var r,n;if(t!==void 0)return v.string(t)?(r=this.explicitByPath.get(t))!=null?r:this.indexByPath.get(t):v.Provenance(t)?(n=this.explicitByPath.get(t.jsonPath))!=null?n:this.indexByPath.get(t.jsonPath):this.indexByObject.get(t)}origin(t){let r=this.provenance(t);return r!=null&&r.explicit?r:r==null?void 0:r.node}irNode(t){var r;return(r=this.provenance(t))==null?void 0:r.node}jsonPath(t){var r;return(r=this.provenance(t))==null?void 0:r.jsonPath}getEnumValueName(t,r){let n=v.IR.ExampleEnumType(r)?r.value.name:r.name,i=t.values.find(a=>this.nameEquals(a.name.name,n));return i?this.getPropertyNameFor(i):(0,Ci.fail)(`Unexpected - can't find enum value ${n} 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 t.name.name.pascalCase.safeName;if(v.IR.Name(t.name))return t.name.pascalCase.safeName;if(typeof t.name=="string")return t.name}if("pascalCase"in t)return t.pascalCase.safeName;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)||v.IR.NameAndWireValue(t.name))return t.name.name.pascalCase.safeName;if(v.IR.Name(t.name))return t.name.pascalCase.safeName;if(typeof t.name=="string")return t.name}if("pascalCase"in t)return t.pascalCase.safeName;throw new Error(`Unknown property type: ${JSON.stringify(t)}`)}nameEquals(t,r){return t.camelCase.safeName===r.camelCase.safeName}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,n=this.irNode(this.ir.types[r]);if(v.IR.TypeDeclaration(n))return{typeId:r,typeDeclaration:n};(0,Ci.fail)(`dereferenceType: typeId ${r} not resolved.`)}};var Ii=class{constructor(t,r,n,i,a={makeRelativeFilePath:c=>c,makeAbsoluteFilePath:c=>c,getNamespaceForTypeId:c=>"",getDirectoryForTypeId:c=>"",getCoreAsIsFiles:()=>[],getCoreTestAsIsFiles:()=>[],getPublicCoreAsIsFiles:()=>[],getAsyncCoreAsIsFiles:()=>[],getChildNamespaceSegments:c=>[]}){o(this,"intermediateRepresentation");o(this,"apiName");o(this,"customConfig");o(this,"generatorConfig");o(this,"support");o(this,"ir");o(this,"dir");o(this,"csharp",new ki(this));o(this,"registry",new oi(this));o(this,"model");o(this,"extern",new es(this));o(this,"settings",R({namespace:()=>{var t;return(t=this.customConfig.namespace)!=null?t:zi(Ji(`${this.generatorConfig.organization}_${this.apiName}`))},readOnlyMemoryTypes:()=>{var t;return(t=this.customConfig["read-only-memory-types"])!=null?t:[]},simplifyObjectDictionaries:()=>{var t;return(t=this.customConfig["simplify-object-dictionaries"])!=null?t:!1},useFullyQualifiedNamespaces:()=>{var t;return(t=this.customConfig["experimental-fully-qualified-namespaces"])!=null?t:!1},useDotnetFormat:()=>{var t;return(t=this.customConfig["experimental-dotnet-format"])!=null?t:!1},enableWebsockets:()=>{var t;return(t=this.customConfig["experimental-enable-websockets"])!=null?t:!1},enableReadonlyConstants:()=>{var t;return(t=this.customConfig["experimental-readonly-constants"])!=null?t:!1},temporaryWebsocketEnvironments:()=>{var t;return(t=this.customConfig["temporary-websocket-environments"])!=null?t:{}},baseApiExceptionClassName:()=>{var t;return(t=this.customConfig["base-api-exception-class-name"])!=null?t:""},baseExceptionClassName:()=>{var t;return(t=this.customConfig["base-exception-class-name"])!=null?t:""},shouldGeneratedDiscriminatedUnions:()=>{var t;return(t=this.customConfig["use-discriminated-unions"])!=null?t:!0},exportedClientClassName:()=>{var t;return(t=this.customConfig["exported-client-class-name"])!=null?t:""},clientClassName:()=>{var t;return(t=this.customConfig["client-class-name"])!=null?t:""},rootNamespaceForCoreClasses:()=>{var t;return(t=this.customConfig["root-namespace-for-core-classes"])!=null?t:!0},packageId:()=>{var t;return(t=this.customConfig["package-id"])!=null?t:""},isForwardCompatibleEnumsEnabled:()=>{var t,r;return(r=(t=this.customConfig["enable-forward-compatible-enums"])!=null?t:this.customConfig["experimental-enable-forward-compatible-enums"])!=null?r:!0},websocketEnvironments:()=>{var t;return(t=this.customConfig["temporary-websocket-environments"])!=null?t:{}},generateNewAdditionalProperties:()=>{var t,r;return(r=(t=this.customConfig["additional-properties"])!=null?t:this.customConfig["experimental-additional-properties"])!=null?r:!0},customPagerName:()=>{var t;return(t=this.customConfig["custom-pager-name"])!=null?t:""},environmentClassName:()=>{var t;return(t=this.customConfig["environment-class-name"])!=null?t:""},generateErrorTypes:()=>{var t;return(t=this.customConfig["generate-error-types"])!=null?t:!0},shouldInlinePathParameters:()=>{var t;return(t=this.customConfig["inline-path-parameters"])!=null?t:!0},includeExceptionHandler:()=>{var t;return(t=this.customConfig["include-exception-handler"])!=null?t:!1},shouldGenerateMockServerTests:()=>{var t,r;return(r=(t=this.customConfig["generate-mock-server-tests"])!=null?t:this.customConfig["enable-wire-tests"])!=null?r:!0},rootClientAccess:()=>this.customConfig["root-client-class-access"]=="internal"?ee.Internal:ee.Public,extraDependencies:()=>{var t;return(t=this.customConfig["extra-dependencies"])!=null?t:{}},pascalCaseEnvironments:()=>{var t;return(t=this.customConfig["pascal-case-environments"])!=null?t:!0},explicitNamespaces:()=>this.customConfig["explicit-namespaces"]===!0,outputPath:()=>{var r,n,i,a;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:(r=t.library)!=null?r:"src",test:(n=t.test)!=null?n:"src",solution:(i=t.solution)!=null?i:".",other:(a=t.other)!=null?a:"."}}}));o(this,"constants",{folders:R({mockServerTests:()=>this.support.makeRelativeFilePath("Unit/MockServer"),types:()=>"Types",exceptions:()=>"Exceptions",src:()=>"src",protobuf:()=>"proto",serializationTests:()=>this.support.makeRelativeFilePath("Unit/Serialization"),project:()=>this.support.makeRelativeFilePath((0,qi.join)(this.constants.folders.sourceFiles,this.support.makeRelativeFilePath(this.names.files.project))),sourceFiles:()=>this.support.makeRelativeFilePath(this.constants.folders.src),coreFiles:()=>this.support.makeRelativeFilePath((0,qi.join)(this.constants.folders.project,this.support.makeRelativeFilePath(this.constants.defaults.core))),publicCoreFiles:()=>this.support.makeRelativeFilePath((0,qi.join)(this.constants.folders.project,this.support.makeRelativeFilePath(this.constants.defaults.core),this.support.makeRelativeFilePath(this.constants.defaults.publicCore))),testFiles:()=>this.support.makeRelativeFilePath((0,qi.join)(this.constants.folders.sourceFiles,this.support.makeRelativeFilePath(this.names.files.testProject)))}),formatting:R({indent:()=>" "}),defaults:R({core:()=>"Core",publicCore:()=>"Public",version:()=>"0.0.0"})});o(this,"namespaces",R({root:()=>this.settings.namespace,core:()=>`${this.namespaces.root}.Core`,test:()=>this.registry.canonicalizeNamespace(`${this.namespaces.root}.Test`),testUtils:()=>`${this.namespaces.test}.Utils`,mockServerTest:()=>`${this.namespaces.test}.Unit.MockServer`,publicCore:()=>this.namespaces.root,asyncCore:()=>`${this.namespaces.core}.Async`,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"])}));o(this,"names",{classes:R({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`}),project:R({client:()=>zi(Ji(`${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:R({project:()=>this.namespaces.root,testProject:()=>`${this.namespaces.root}.Test`}),methods:R({mockOauth:()=>"MockOAuthEndpoint",getAccessTokenAsync:()=>"GetAccessTokenAsync"}),variables:R({client:()=>"client",response:()=>"response",httpRequest:()=>"httpRequest",sendRequest:()=>"sendRequest",responseBody:()=>"responseBody",query:()=>"_query",headers:()=>"_headers"}),parameters:R({cancellationToken:()=>"cancellationToken",requestOptions:()=>"options",idempotentOptions:()=>"options"})});o(this,"Types",R({Arbitrary:t=>new B.AribitraryType(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")}),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}),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}),EnumSerializer:()=>this.csharp.classReference({origin:this.model.staticExplicit("EnumSerializer"),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}),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}),AsyncApiOptions:()=>this.csharp.classReference({origin:this.model.staticExplicit("AsyncApiOptions"),namespace:`${this.namespaces.asyncCore}.Models`}),QueryBuilder:()=>this.csharp.classReference({origin:this.model.staticExplicit("Query"),namespace:this.namespaces.asyncCore}),OAuthTokenProvider:()=>this.csharp.classReference({origin:this.model.staticExplicit("OAuthTokenProvider"),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}),AsyncApi:t=>this.csharp.classReference({origin:this.model.staticExplicit("AsyncApi"),namespace:this.namespaces.asyncCore,generics:[t]}),AsyncEvent:t=>this.csharp.classReference({origin:this.model.staticExplicit("Event"),namespace:`${this.namespaces.asyncCore}.Events`,generics:[t]}),StringEnumSerializer:t=>this.csharp.classReference({origin:this.model.staticExplicit("StringEnumSerializer"),namespace:this.namespaces.core,generics:[t]}),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:n,offsetType:i,stepType:a,itemType:c})=>this.csharp.classReference({origin:this.model.staticExplicit("OffsetPager"),namespace:this.namespaces.core,generics:[t,r,n,i,a,c]}),CursorPager:({requestType:t,requestOptionsType:r,responseType:n,cursorType:i,itemType:a})=>this.csharp.classReference({origin:this.model.staticExplicit("CursorPager"),namespace:this.namespaces.core,generics:[t,r,n,i,a]}),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})}));o(this,"Primitive",R({string:()=>new B.String(this),boolean:()=>new B.Boolean(this),integer:()=>new B.Integer(this),long:()=>new B.Long(this),uint:()=>new B.Uint(this),ulong:()=>new B.ULong(this),float:()=>new B.Float(this),double:()=>new B.Double(this),object:()=>new B.Object(this)}));o(this,"Value",R({binary:()=>new Ee.Binary(this),dateOnly:()=>new Ee.DateOnly(this),dateTime:()=>new Ee.DateTime(this),uuid:()=>new Ee.Uuid(this),stringEnum:t=>new Ee.StringEnum(t,this)}));o(this,"Collection",R({array:t=>new ue.Array(t,this),listType:t=>new ue.ListType(t,this),list:t=>new ue.List(t,this),set:t=>new ue.Set(t,this),map:(t,r,n)=>new ue.Map(t,r,this,n),idictionary:(t,r,n)=>new ue.IDictionary(t,r,this,n),keyValuePair:(t,r)=>new ue.KeyValuePair(t,r,this)}));o(this,"format",R({private:t=>`_${Ni.camelCase(t)}`}));o(this,"initializers",R({implicitNamespaces:()=>{for(let t of this.namespaces.implicit)this.registry.addImplicitNamespace(t);return!0}}));this.intermediateRepresentation=t,this.apiName=r,this.customConfig=n,this.generatorConfig=i,this.support=a,this.model=new ts(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}};var Ge=class{constructor(t){o(this,"generation");this.generation=t}get csharp(){return this.generation.csharp}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}};var rs=class extends Ge{constructor({context:r}){super(r.generation);o(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:I.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,value:r.value});case"map":return this.convertMap({map:r.typeReference,value:r.value,fallbackToDefault:r.fallbackToDefault});case"named":{let n=this.context.resolveNamedType({typeId:r.typeReference.value});return n==null?this.csharp.Literal.nop():this.convertNamed({named:n,value:r.value,as:r.as,fallbackToDefault:r.fallbackToDefault})}case"nullable":return this.convert({typeReference:r.typeReference.value,value:r.value,as:r.as});case"optional":return this.convert({typeReference:r.typeReference.value,value:r.value,as:r.as});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:W(r.typeReference)}}convertList({list:r,value:n,fallbackToDefault:i}){return Array.isArray(n)?this.csharp.Literal.list({valueType:this.context.dynamicTypeMapper.convert({typeReference:r,unboxOptionals:!0}),values:n.map((a,c)=>{this.context.errors.scope({index:c});try{return this.convert({typeReference:r,value:a})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:I.Critical,message:`Expected array but got: ${typeof n}`}),this.csharp.Literal.nop())}convertLiteral({literal:r,value:n,fallbackToDefault:i}){switch(r.type){case"boolean":{let a=this.context.getValueAsBoolean({value:n});return a==null?this.csharp.Literal.nop():this.csharp.Literal.boolean(a)}case"string":{let a=this.context.getValueAsString({value:n});return a==null?i?this.Primitive.string.getDeterminsticDefault(i):this.csharp.Literal.nop():this.csharp.Literal.string(a)}default:W(r)}}convertSet({set:r,value:n,fallbackToDefault:i}){return Array.isArray(n)?this.csharp.Literal.set({valueType:this.context.dynamicTypeMapper.convert({typeReference:r,unboxOptionals:!0}),values:n.map((a,c)=>{this.context.errors.scope({index:c});try{return this.convert({typeReference:r,value:a})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:I.Critical,message:`Expected array but got: ${typeof n}`}),this.csharp.Literal.nop())}convertMap({map:r,value:n,fallbackToDefault:i}){return typeof n!="object"||n==null?(this.context.errors.add({severity:I.Critical,message:`Expected object but got: ${n==null?"null":typeof n}`}),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(n).map(([a,c])=>{this.context.errors.scope(a);try{return{key:this.convert({typeReference:r.key,value:a,as:"key"}),value:this.convert({typeReference:r.value,value:c})}}finally{this.context.errors.unscope()}})})}convertNamed({named:r,value:n,as:i,fallbackToDefault:a}){switch(r.type){case"alias":return this.convert({typeReference:r.typeReference,value:n,as:i,fallbackToDefault:a});case"discriminatedUnion":return this.settings.shouldGeneratedDiscriminatedUnions?this.convertDiscriminatedUnion({discriminatedUnion:r,value:n,fallbackToDefault:a}):this.convertUnknown({value:n,fallbackToDefault:a});case"enum":return this.getEnumValue(r,n);case"object":return this.convertObject({object_:r,value:n,fallbackToDefault:a});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:r,value:n,fallbackToDefault:a});default:W(r)}}convertDiscriminatedUnion({discriminatedUnion:r,value:n,fallbackToDefault:i}){let a=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),c=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:r,value:n});if(c==null)return this.csharp.Literal.nop();let l=c.singleDiscriminatedUnionType,p=this.getBaseProperties({discriminatedUnionTypeInstance:c,singleDiscriminatedUnionType:l});switch(l.type){case"samePropertiesAsObject":{let h=this.context.resolveNamedType({typeId:l.typeId});return h==null?this.csharp.Literal.nop():this.instantiateUnionWithBaseProperties({classReference:a,baseProperties:p,arguments_:[this.convertNamed({named:h,value:c.value})]})}case"singleProperty":{if(this.context.getRecord(c.value)==null)return this.csharp.Literal.nop();try{let y=["Value","Type"].includes(l.discriminantValue.name.pascalCase.safeName)?`${l.discriminantValue.name.pascalCase.safeName}Inner`:l.discriminantValue.name.pascalCase.safeName;return this.context.errors.scope(l.discriminantValue.wireValue),this.instantiateUnionWithBaseProperties({classReference:a,baseProperties:p,arguments_:[this.csharp.instantiateClass({classReference:this.csharp.classReference({name:y,enclosingType:a}),arguments_:[this.convert({typeReference:l.typeReference,value:l.discriminantValue.wireValue})]})]})}finally{this.context.errors.unscope()}}case"noProperties":return this.instantiateUnionWithBaseProperties({classReference:a,baseProperties:p,arguments_:[this.csharp.instantiateClass({classReference:this.csharp.classReference({origin:c.discriminantValue,enclosingType:a}),arguments_:[]})]});default:W(l)}}getBaseProperties({discriminatedUnionTypeInstance:r,singleDiscriminatedUnionType:n}){var a,c;return this.context.associateByWireValue({parameters:(a=n.properties)!=null?a:[],values:(c=this.context.getRecord(r.value))!=null?c:{},ignoreMissingParameters:!0}).map(l=>{this.context.errors.scope(l.name.wireValue);try{return{name:this.context.getPropertyName(l.name.name),assignment:this.convert(l)}}finally{this.context.errors.unscope()}})}instantiateUnionWithBaseProperties({classReference:r,arguments_:n,baseProperties:i}){let a=this.csharp.instantiateClass({classReference:r,arguments_:n,multiline:!0});return i.length===0?this.csharp.Literal.reference(a):this.csharp.Literal.reference(this.csharp.codeblock(c=>{c.write(a," "),c.pushScope();for(let l of i)c.write(l.name," = ",l.assignment,",");c.popScope(!1)}))}getEnumValue(r,n){if(typeof n!="string")return this.context.errors.add({severity:I.Critical,message:`Expected enum value string, got: ${typeof n}`}),this.csharp.Literal.nop();let i=r.values.find(l=>l.wireValue===n);if(i==null)return this.context.errors.add({severity:I.Critical,message:`An enum value named "${n}" does not exist in this context`}),this.csharp.Literal.nop();let a=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),c=a.registerField(this.model.getPropertyNameFor(i),i);return this.csharp.Literal.reference(this.csharp.enumInstantiation({reference:a,value:c}))}convertObject({object_:r,value:n,fallbackToDefault:i}){var c;let a=this.context.associateByWireValue({parameters:r.properties,values:(c=this.context.getRecord(n))!=null?c:{}});return this.csharp.Literal.class_({reference:this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),fields:a.map(l=>{this.context.errors.scope(l.name.wireValue);try{return{name:this.context.getClassName(l.name.name),value:this.convert(l)}}finally{this.context.errors.unscope()}})})}convertUndiscriminatedUnion({undiscriminatedUnion:r,value:n,fallbackToDefault:i}){let a=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:r,value:n});return a==null?this.csharp.Literal.nop():a.typeLiteral}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:r,value:n}){for(let i of r.types)try{let a=this.convert({typeReference:i,value:n});return{valueTypeReference:i,typeLiteral:a}}catch(a){continue}this.context.errors.add({severity:I.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof n}" value`})}convertUnknown({value:r,fallbackToDefault:n}){return this.csharp.Literal.unknown(r)}convertPrimitive({primitive:r,value:n,as:i,fallbackToDefault:a}){switch(r){case"INTEGER":{let c=this.getValueAsNumber({value:n,as:i});return c==null?a?this.Primitive.integer.getDeterminsticDefault(a):this.csharp.Literal.nop():this.csharp.Literal.integer(c)}case"LONG":{let c=this.getValueAsNumber({value:n,as:i});return c==null?a?this.Primitive.long.getDeterminsticDefault(a):this.csharp.Literal.nop():this.csharp.Literal.long(c)}case"UINT":{let c=this.getValueAsNumber({value:n,as:i});return c==null?a?this.Primitive.uint.getDeterminsticDefault(a):this.csharp.Literal.nop():this.csharp.Literal.uint(c)}case"UINT_64":{let c=this.getValueAsNumber({value:n,as:i});return c==null?a?this.Primitive.ulong.getDeterminsticDefault(a):this.csharp.Literal.nop():this.csharp.Literal.ulong(c)}case"FLOAT":{let c=this.getValueAsNumber({value:n,as:i});return c==null?a?this.Primitive.float.getDeterminsticDefault(a):this.csharp.Literal.nop():this.csharp.Literal.float(c)}case"DOUBLE":{let c=this.getValueAsNumber({value:n,as:i});return c==null?a?this.Primitive.double.getDeterminsticDefault(a):this.csharp.Literal.nop():this.csharp.Literal.double(c)}case"BOOLEAN":{let c=this.getValueAsBoolean({value:n,as:i});return c==null?a?this.Primitive.boolean.getDeterminsticDefault(a):this.csharp.Literal.nop():this.csharp.Literal.boolean(c)}case"STRING":{let c=this.context.getValueAsString({value:n});return c==null?a?this.Primitive.string.getDeterminsticDefault(a):this.csharp.Literal.nop():this.csharp.Literal.string(c)}case"DATE":{let c=this.context.getValueAsString({value:n});return c==null?a?this.Value.dateOnly.getDeterminsticDefault(a):this.csharp.Literal.nop():this.csharp.Literal.date(c)}case"DATE_TIME":{let c=this.context.getValueAsString({value:n});return c==null?a?this.Value.dateTime.getDeterminsticDefault(a):this.csharp.Literal.nop():this.csharp.Literal.datetime(c)}case"UUID":{let c=this.context.getValueAsString({value:n});return c==null?a?this.Primitive.string.getDeterminsticDefault(a):this.csharp.Literal.nop():this.csharp.Literal.string(c)}case"BASE_64":{let c=this.context.getValueAsString({value:n});return c==null?a?this.Primitive.string.getDeterminsticDefault(a):this.csharp.Literal.nop():this.csharp.Literal.string(c)}case"BIG_INTEGER":{let c=this.context.getValueAsString({value:n});return c==null?a?this.Primitive.string.getDeterminsticDefault(a):this.csharp.Literal.nop():this.csharp.Literal.string(c)}default:W(r)}}getValueAsNumber({value:r,as:n}){let i=n==="key"&&typeof r=="string"?Number(r):r;return this.context.getValueAsNumber({value:i})}getValueAsBoolean({value:r,as:n}){let i=n==="key"?typeof r=="string"?r==="true":r==="false"?!1:r:r;return this.context.getValueAsBoolean({value:i})}};var ns=class extends Ge{constructor({context:r}){super(r.generation);o(this,"context");this.context=r}convert(r){switch(r.typeReference.type){case"list":return this.Collection.list(this.convert({typeReference:r.typeReference,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 n=this.context.resolveNamedType({typeId:r.typeReference.value});return n==null?this.convertUnknown():this.convertNamed({named:n})}case"optional":case"nullable":{let n=this.convert({typeReference:r.typeReference.value});return r.unboxOptionals?n.asNonOptional():n.asOptional()}case"primitive":return this.convertPrimitive({primitive:r.typeReference.value});case"set":return this.Collection.set(this.convert({typeReference:r.typeReference,unboxOptionals:!0}));case"unknown":return this.convertUnknown();default:W(r.typeReference)}}convertToClassReference(r){return this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)})}convertNamed({named:r}){switch(r.type){case"alias":return this.convert({typeReference:r.typeReference});case"enum":case"object":return this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)});case"discriminatedUnion":return this.settings.shouldGeneratedDiscriminatedUnions?this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}):this.Primitive.object;case"undiscriminatedUnion":return this.OneOf.OneOf(r.types.map(n=>this.convert({typeReference:n})));default:W(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":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:W(r)}}};var is=class extends Ge{constructor({context:r}){super(r.generation);o(this,"context");this.context=r}getFilePropertyInfo({body:r,value:n}){var c;let i={fileFields:[],bodyPropertyFields:[]},a=(c=this.context.getRecord(n))!=null?c:{};for(let l of r.properties)switch(l.type){case"file":v.Record.missingKey(a,l.wireValue)&&(a[l.wireValue]="[bytes]"),i.fileFields.push({name:this.context.getPropertyName(l.name),value:this.getSingleFileProperty({property:l,record:a})});break;case"fileArray":v.Record.missingKey(a,l.wireValue)&&(a[l.wireValue]=["[bytes]"]),i.fileFields.push({name:this.context.getPropertyName(l.name),value:this.getArrayFileProperty({property:l,record:a})});break;case"bodyProperty":if(v.Record.missingKey(a,l.name.wireValue))switch(l.typeReference.type){case"optional":break;case"primitive":{switch(l.typeReference.value.toLowerCase()){case"integer":{a[l.name.wireValue]=123;break}case"string":{a[l.name.wireValue]="[string]";break}case"boolean":{a[l.name.wireValue]=!0;break}case"double":{a[l.name.wireValue]=123.456;break}case"float":{a[l.name.wireValue]=123.456;break}case"long":{a[l.name.wireValue]=123456789;break}case"uint":{a[l.name.wireValue]=123;break}case"uint64":{a[l.name.wireValue]=12345;break}case"date":{a[l.name.wireValue]=new Date(2021,1,1);break}case"datetime":{a[l.name.wireValue]=new Date(2021,1,1,12,0,0);break}case"uuid":{a[l.name.wireValue]="123e4567-e89b-12d3-a456-426614174000";break}case"base64":{a[l.name.wireValue]="SGVsbG8gd29ybGQh";break}case"biginteger":{a[l.name.wireValue]="12345678901234567890";break}}break}default:break}i.bodyPropertyFields.push({name:this.context.getPropertyName(l.name.name),value:this.getBodyProperty({property:l,record:a})});break;default:W(l)}return i}getSingleFileProperty({property:r,record:n}){let i=this.context.getSingleFileValue({property:r,record:n});return i==null?this.csharp.Literal.nop():this.context.getFileParameterForString(i)}getArrayFileProperty({property:r,record:n}){let i=this.context.getFileArrayValues({property:r,record:n});return i==null?this.csharp.Literal.nop():this.csharp.Literal.list({valueType:this.Types.FileParameter,values:i.map(a=>this.context.getFileParameterForString(a))})}getBodyProperty({property:r,record:n}){let i=n[r.name.wireValue];return i==null?this.csharp.Literal.nop():this.context.dynamicLiteralMapper.convert({typeReference:r.typeReference,value:i})}};var ss=class e extends ji{constructor({ir:r,config:n,options:i,generation:a}){super({ir:r,config:n,options:i});o(this,"ir");o(this,"dynamicTypeMapper");o(this,"dynamicLiteralMapper");o(this,"filePropertyMapper");o(this,"generation");this.ir=r,this.generation=a!=null?a:new Ii(r,n.workspaceName,n.customConfig!=null?n.customConfig:{},n),this.dynamicTypeMapper=new ns({context:this}),this.dynamicLiteralMapper=new rs({context:this}),this.filePropertyMapper=new is({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}getMethodName(r){return`${r.pascalCase.safeName}Async`}getNamespace(r,n){let i=this.getNamespaceSegments(r);return i=n!=null?[...i,n]:i,[this.namespaces.root,...i].join(".")}getEnvironmentTypeReferenceFromID(r){let n=this.resolveEnvironmentName(r);if(n!=null)return this.getEnvironmentClassReferenceForEnumName(n)}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(i=>i.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((n,i)=>n[0].length-i[0].length).forEach(([n,i])=>{this.dynamicTypeMapper.convertToClassReference(i)});for(let[n,i]of r.entries())if(this.csharp.classReference({origin:this.model.staticExplicit(`Example${n}`),namespace:"Usage"}),i.endpoint){let a=this.resolveEndpointLocation(i.endpoint);for(let c of a)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.RootClient,this.csharp.freezeClassReferences()}};var as=class extends Ge{constructor({context:r}){super(r.generation);o(this,"context");this.context=r}async generateSnippet({endpoint:r,request:n,options:i}){return this.buildCodeBlock({endpoint:r,snippet:n,options:i}).toString({namespace:"Usage",generation:this.generation,allNamespaceSegments:new Set,allTypeClassReferences:new Map})}generateSnippetSync({endpoint:r,request:n,options:i}){return this.buildCodeBlock({endpoint:r,snippet:n,options:i}).toString({namespace:"Usage",generation:this.generation,allNamespaceSegments:new Set,allTypeClassReferences:new Map})}async generateSnippetAst({endpoint:r,request:n,options:i}){throw new Error("Unsupported")}buildCodeBlock({endpoint:r,snippet:n,options:i}){var l;if(r.examples&&!((l=r.examples)!=null&&l.find(p=>v.DynamicIR.EndpointExample(n)&&p.id===n.id)))throw new Error("Endpoint does not have an example that matches the snippet");let a=this.csharp.codeblock(p=>{p.writeNodeStatement(this.constructClient({endpoint:r,snippet:n})),p.newLine(),p.writeNodeStatement(this.callMethod({endpoint:r,snippet:n}))}),c=this.getStyle(i);switch(c){case Br.Concise:return a;case Br.Full:return this.buildFullCodeBlock({body:a,options:i});default:W(c)}}buildFullCodeBlock({body:r,options:n}){var c;let i=this.getConfig(n),a=this.csharp.class_({name:(c=i.fullStyleClassName)!=null?c:"Example",namespace:"Usage",access:wn.Access.Public});return a.addNamespaceReference(this.Types.RootClient.namespace),a.addMethod({name:"Do",access:wn.Access.Public,isAsync:!0,parameters:[],body:r}),a}constructClient({endpoint:r,snippet:n}){return this.csharp.codeblock(i=>{i.write("var client = "),i.writeNode(this.getRootClientConstructorInvocation(this.getConstructorArgs({endpoint:r,snippet:n})))})}callMethod({endpoint:r,snippet:n}){var c,l;let i=((c=r.response)==null?void 0:c.type)==="streaming"||((l=r.response)==null?void 0:l.type)==="streamParameter",a=this.csharp.invokeMethod({on:this.csharp.codeblock("client"),method:this.getMethod({endpoint:r}),arguments_:this.getMethodArgs({endpoint:r,snippet:n}),async:!0,configureAwait:!0,multiline:!0,isAsyncEnumerable:i});return i?this.csharp.codeblock(p=>{p.write("await foreach (var item in "),p.writeNode(a),p.writeLine(")"),p.pushScope(),p.writeLine("/* consume each item */"),p.popScope()}):a}getConstructorArgs({endpoint:r,snippet:n}){let i=[];r.auth!=null&&(n.auth!=null?i.push(...this.getConstructorAuthArgs({auth:r.auth,values:n.auth})):this.context.errors.add({severity:I.Warning,message:`Auth with ${r.auth.type} configuration is required for this endpoint`}));let a=[],c=this.getConstructorBaseUrlArgs({baseUrl:n.baseURL,environment:n.environment});c.length>0&&a.push(...c),this.context.errors.scope(Ke.Headers);let l=[];return this.context.ir.headers!=null&&n.headers!=null&&l.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:n.headers})),this.context.errors.unscope(),a.length===0?[...i,...l]:[...i,...l,{name:"clientOptions",assignment:this.csharp.instantiateClass({classReference:this.Types.ClientOptions,arguments_:a.map(p=>({name:p.name,assignment:p.assignment})),multiline:!0})}]}getConstructorBaseUrlArgs({baseUrl:r,environment:n}){let i=this.getBaseUrlArg({baseUrl:r,environment:n});return v.Literal.nop(i)?[]:[{name:this.getBaseUrlOptionName(),assignment:i}]}getBaseUrlArg({baseUrl:r,environment:n}){var i;if(r!=null&&n!=null)return this.context.errors.add({severity:I.Critical,message:"Cannot specify both baseUrl and environment options"}),this.csharp.Literal.nop();if(r!=null)return((i=this.context.ir.environments)==null?void 0:i.environments.type)==="multipleBaseUrls"?(this.context.errors.add({severity:I.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(n!=null){if(this.context.isSingleEnvironmentID(n)){let a=this.context.getEnvironmentTypeReferenceFromID(n);return a==null?(this.context.errors.add({severity:I.Warning,message:`Environment ${JSON.stringify(n)} was not found`}),this.csharp.Literal.nop()):this.csharp.Literal.reference(a)}if(this.context.isMultiEnvironmentValues(n))return this.context.validateMultiEnvironmentUrlValues(n)?this.csharp.Literal.reference(this.csharp.instantiateClass({classReference:this.Types.Environments,arguments_:Object.entries(n).map(([a,c])=>({name:li(ds(a)),assignment:this.context.dynamicLiteralMapper.convert({typeReference:{type:"primitive",value:"STRING"},value:c})})),multiline:!0})):this.csharp.Literal.nop()}return this.csharp.Literal.nop()}getConstructorAuthArgs({auth:r,values:n}){if(n.type!==r.type)return this.addError(this.context.newAuthMismatchError({auth:r,values:n}).message),[];switch(r.type){case"basic":return n.type==="basic"?this.getConstructorBasicAuthArg({auth:r,values:n}):[];case"bearer":return n.type==="bearer"?this.getConstructorBearerAuthArgs({auth:r,values:n}):[];case"header":return n.type==="header"?this.getConstructorHeaderAuthArgs({auth:r,values:n}):[];case"oauth":return n.type==="oauth"?this.getConstructorOAuthArgs({auth:r,values:n}):[];case"inferred":return this.addWarning("The C# SDK Generator does not support Inferred auth scheme yet"),[];default:W(r)}}addError(r){this.context.errors.add({severity:I.Critical,message:r})}addWarning(r){this.context.errors.add({severity:I.Warning,message:r})}getConstructorBasicAuthArg({auth:r,values:n}){return[{name:this.context.getParameterName(r.username),assignment:this.csharp.Literal.string(n.username)},{name:this.context.getParameterName(r.password),assignment:this.csharp.Literal.string(n.password)}]}getConstructorBearerAuthArgs({auth:r,values:n}){return[{name:this.context.getParameterName(r.token),assignment:this.csharp.Literal.string(n.token)}]}getConstructorHeaderAuthArgs({auth:r,values:n}){return[{name:this.context.getParameterName(r.header.name.name),assignment:this.context.dynamicLiteralMapper.convert({typeReference:r.header.typeReference,value:n.value,fallbackToDefault:r.header.name.wireValue})}]}getConstructorOAuthArgs({auth:r,values:n}){return[{name:this.context.getParameterName(r.clientId),assignment:this.csharp.Literal.string(n.clientId)},{name:this.context.getParameterName(r.clientSecret),assignment:this.csharp.Literal.string(n.clientSecret)}]}getConstructorHeaderArgs({headers:r,values:n}){let i=[];for(let a of r){let c=this.getConstructorHeaderArg({header:a,value:n.value});c!=null&&i.push({name:this.context.getParameterName(a.name.name),assignment:c})}return i}getConstructorHeaderArg({header:r,value:n}){let i=this.context.dynamicLiteralMapper.convert({typeReference:r.typeReference,value:n,fallbackToDefault:r.name.wireValue});if(!v.Literal.nop(i))return i}getMethodArgs({endpoint:r,snippet:n}){switch(r.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:r.request,snippet:n});case"body":return this.getMethodArgsForBodyRequest({request:r.request,snippet:n});default:W(r.request)}}getMethodArgsForInlinedRequest({request:r,snippet:n}){var p,h;let i=[];this.context.errors.scope(Ke.PathParameters);let a=[],c=[...(p=this.context.ir.pathParameters)!=null?p:[],...(h=r.pathParameters)!=null?h:[]];c.length>0&&a.push(...this.getPathParameters({namedParameters:c,snippet:n})),this.context.errors.unscope(),this.context.errors.scope(Ke.RequestBody);let l=this.getFilePropertyInfo({request:r,snippet:n});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:r,inlinePathParameters:this.settings.shouldInlinePathParameters})||i.push(...a.map(y=>y.value)),i.push(this.getInlinedRequestArg({request:r,snippet:n,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:r,inlinePathParameters:this.settings.shouldInlinePathParameters})?a:[],filePropertyInfo:l})),i}getFilePropertyInfo({request:r,snippet:n}){return r.body==null||!this.context.isFileUploadRequestBody(r.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:r.body,value:n.requestBody})}getInlinedRequestArg({request:r,snippet:n,pathParameterFields:i,filePropertyInfo:a}){var P,T,M,J;this.context.errors.scope(Ke.QueryParameters);let l=this.context.associateQueryParametersByWireValue({parameters:(P=r.queryParameters)!=null?P:[],values:(T=n.queryParameters)!=null?T:{}}).map(G=>({name:this.context.getPropertyName(G.name.name),value:this.context.dynamicLiteralMapper.convert(G)}));this.context.errors.unscope(),this.context.errors.scope(Ke.Headers);let h=this.context.associateByWireValue({parameters:(M=r.headers)!=null?M:[],values:(J=n.headers)!=null?J:{}}).map(G=>({name:this.context.getPropertyName(G.name.name),value:this.context.dynamicLiteralMapper.convert(Fe(Pe({},G),{fallbackToDefault:G.name.wireValue}))}));this.context.errors.unscope(),this.context.errors.scope(Ke.RequestBody);let y=r.body!=null?this.getInlinedRequestBodyConstructorFields({body:r.body,value:n.requestBody,filePropertyInfo:a}):[];return this.context.errors.unscope(),this.csharp.Literal.class_({reference:this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),fields:[...i,...l,...h,...y]})}getInlinedRequestBodyConstructorFields({body:r,value:n,filePropertyInfo:i}){switch(r.type){case"properties":return this.getInlinedRequestBodyPropertyConstructorFields({parameters:r.value,value:n});case"referenced":return[this.getReferencedRequestBodyPropertyConstructorField({body:r,value:n})];case"fileUpload":return this.getFileUploadRequestBodyConstructorFields({filePropertyInfo:i});default:W(r)}}getInlinedRequestBodyPropertyConstructorFields({parameters:r,value:n}){var c;let i=[],a=this.context.associateByWireValue({parameters:r,values:(c=this.context.getRecord(n))!=null?c:{}});for(let l of a)i.push({name:this.context.getPropertyName(l.name.name),value:this.context.dynamicLiteralMapper.convert(Fe(Pe({},l),{fallbackToDefault:l.name.wireValue}))});return i}getFileUploadRequestBodyConstructorFields({filePropertyInfo:r}){return[...r.fileFields,...r.bodyPropertyFields]}getReferencedRequestBodyPropertyConstructorField({body:r,value:n}){return{name:this.context.getPropertyName(r.bodyKey),value:this.getReferencedRequestBodyPropertyLiteral({body:r.bodyType,value:n})}}getReferencedRequestBodyPropertyLiteral({body:r,value:n}){switch(r.type){case"bytes":return this.getBytesBodyRequestArg({value:n});case"typeReference":return this.context.dynamicLiteralMapper.convert({typeReference:r.value,value:n,fallbackToDefault:JSON.stringify(r.value)});default:W(r)}}getMethodArgsForBodyRequest({request:r,snippet:n}){var c,l;let i=[];this.context.errors.scope(Ke.PathParameters);let a=[...(c=this.context.ir.pathParameters)!=null?c:[],...(l=r.pathParameters)!=null?l:[]];return a.length>0&&i.push(...this.getPathParameters({namedParameters:a,snippet:n}).map(p=>p.value)),this.context.errors.unscope(),this.context.errors.scope(Ke.RequestBody),r.body!=null&&i.push(this.getBodyRequestArg({body:r.body,value:n.requestBody})),this.context.errors.unscope(),i}getBodyRequestArg({body:r,value:n}){switch(r.type){case"bytes":return this.getBytesBodyRequestArg({value:n});case"typeReference":return r.value.type==="optional"&&n==null?this.csharp.Literal.null():this.context.dynamicLiteralMapper.convert({typeReference:r.value,value:n,fallbackToDefault:JSON.stringify(r.value)});default:W(r)}}getBytesBodyRequestArg({value:r}){let n=this.context.getValueAsString({value:r});return n==null&&(this.context.errors.add({severity:I.Critical,message:"The bytes request body must be provided in string format"}),n="[bytes]"),this.csharp.Literal.reference(this.context.getMemoryStreamForString(n))}getRootClientConstructorInvocation(r){return this.csharp.instantiateClass({classReference:this.Types.RootClient,arguments_:r,forceUseConstructor:!0,multiline:!0})}getPathParameters({namedParameters:r,snippet:n}){var c;let i=[],a=this.context.associateByWireValueOrDefault({parameters:r,values:(c=n.pathParameters)!=null?c:{}});for(let l of a)i.push({name:this.context.getPropertyName(l.name.name),value:this.context.dynamicLiteralMapper.convert(Fe(Pe({},l),{fallbackToDefault:l.name.wireValue}))});return i}getMethod({endpoint:r}){return r.declaration.fernFilepath.allParts.length>0?`${r.declaration.fernFilepath.allParts.map(n=>this.context.getClassName(n)).join(".")}.${this.context.getMethodName(r.declaration.name)}`:this.context.getMethodName(r.declaration.name)}getBaseUrlOptionName(){var r;return((r=this.context.ir.environments)==null?void 0:r.environments.type)==="multipleBaseUrls"?"Environment":"BaseUrl"}getStyle(r){var n,i;return(i=(n=r.style)!=null?n:this.context.options.style)!=null?i:Br.Full}getConfig(r){var n,i;return(i=(n=r.config)!=null?n:this.context.options.config)!=null?i:{}}};var os=class extends bi{constructor({ir:t,config:r,options:n={}}){super(new ss({ir:t,config:r,options:n}))}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 as({context:t})}};0&&(module.exports={DynamicSnippetsGenerator});
32
+ ${hi()}`)}return this.generation.registry.registerClassReference(t,r)}freezeClassReferences(){this.frozen=!0}getPropertyName(t,r){var c;let n=this.model.getPropertyNameFor(r),i=(c=this.model.origin(r))!=null?c:(0,Mj.fail)(`Origin not found for property: ${JSON.stringify(r).substring(0,100)}`),a=t.getFieldName(i,n);return a||n}class_(t){let r=t;return"reference"in t&&(r=Pe(Pe({},t.reference),t)),new hr(r,this.generation)}testClass(t){return new ai(t,this.generation)}annotation(t){return new Pr(t,this.generation)}instantiateClass(t){return new Vn(t,this.generation)}invokeMethod(t){return new Hn(t,this.generation)}codeblock(t){return new Nr(t,this.generation)}code(){return new Ar({},this.generation)}anonymousFunction(t){return new Yn(t)}parameter(t){return new We(t,this.generation)}interface_(t){return new si(t,this.generation)}enum_(t){return new ii(t,this.generation)}dictionary(t){return new Wn(t,this.generation)}list(t){return new Gn(t,this.generation)}readOnlyMemory(t){return new Kn(t,this.generation)}set(t){return new zn(t,this.generation)}switch_(t){return new kn(t,this.generation)}ternary(t){return new ei(t,this.generation)}and(t){return new Xn(t,this.generation)}or(t){return new Zn(t,this.generation)}enumInstantiation(t){return new $n(t,this.generation)}string_(t){return new Jn(t,this.generation)}xmlDocBlock(t){return new Cr(t,this.generation)}xmlDocBlockOf(t){return t instanceof Cr?t:new Cr(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)}.`)}};function R(e){let t={},r={};for(let[n,i]of Object.entries(e))i.length===0?Object.defineProperty(r,n,{get(){return n in t||(t[n]=i()),t[n]},enumerable:!0,configurable:!0}):r[n]=i;return r}var es=class{constructor(t){o(this,"generation");o(this,"System",R({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:"Serializable",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:()=>R({Serialization:()=>R({EnumMember:()=>this.csharp.classReference({name:"EnumMember",namespace:"System.Runtime.Serialization"})})}),Collections:()=>R({Generic:()=>R({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:()=>R({Enumerable:()=>this.csharp.classReference({name:"Enumerable",namespace:"System.Linq"})})}),Globalization:()=>R({DateTimeStyles:()=>this.csharp.classReference({name:"DateTimeStyles",namespace:"System.Globalization"})}),Linq:()=>R({Enumerable:()=>this.csharp.classReference({name:"Enumerable",namespace:"System.Linq"})}),Net:()=>R({Http:()=>R({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:()=>R({SseEvent:()=>this.csharp.classReference({name:"SseEvent",namespace:"System.Net.ServerSentEvents"}),SseParser:()=>this.csharp.classReference({name:"SseParser",namespace:"System.Net.ServerSentEvents"})}),WebSockets:()=>R({ClientWebSocketOptions:()=>this.csharp.classReference({name:"ClientWebSocketOptions",namespace:"System.Net.WebSockets"})})}),IO:()=>R({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:()=>R({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:()=>R({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:()=>R({JsonNode:()=>this.csharp.classReference({name:"JsonNode",namespace:"System.Text.Json.Nodes"}),JsonObject:()=>this.csharp.classReference({name:"JsonObject",namespace:"System.Text.Json.Nodes"})}),Serialization:()=>R({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:"JsonExtensionData",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:"JsonIgnore",namespace:"System.Text.Json.Serialization"}),JsonPropertyName:()=>this.csharp.classReference({name:"JsonPropertyName",namespace:"System.Text.Json.Serialization"})})})}),Threading:()=>R({CancellationToken:()=>this.csharp.classReference({name:"CancellationToken",namespace:"System.Threading"}),Tasks:()=>R({Task:t=>this.csharp.classReference({name:"Task",namespace:"System.Threading.Tasks",generics:t?[t]:void 0})})})}));o(this,"NUnit",R({Framework:()=>R({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"})})}));o(this,"OneOf",R({OneOf:t=>this.csharp.classReference({name:"OneOf",namespace:"OneOf",generics:t}),OneOfBase:t=>this.csharp.classReference({name:"OneOfBase",namespace:"OneOf",generics:t})}));o(this,"Google",R({Protobuf:()=>R({WellKnownTypes:()=>R({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"})})})}));o(this,"WireMock",R({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"})}));o(this,"Grpc",R({Core:()=>R({RpcException:()=>this.csharp.classReference({name:"RpcException",namespace:"Grpc.Core"})})}));this.generation=t}get csharp(){return this.generation.csharp}};var Ci=require("assert");function Tj(e){return e.split(".").filter(t=>!["name","camelCase","snakeCase","screamingSnakeCase","pascalCase"].includes(t)).join(".")}var ts=class{constructor(t,r){o(this,"generation");o(this,"indexByObject",new Map);o(this,"indexByPath",new Map);o(this,"explicitByObject",new Map);o(this,"explicitByPath",new Map);o(this,"root");o(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="",n){let i=Tj(n!=null&&n.jsonPath?`${n.jsonPath}.${r}`:r);if(this.indexByPath.has(i)){n||(0,Ci.fail)(`Parent provenance not found for node: ${JSON.stringify(t).substring(0,100)}`),this.indexByObject.set(t,n);for(let[c,l]of Object.entries(t))typeof l=="object"&&l!==null&&this.createIndex(l,c,n);return n}let a={jsonPath:i,name:r,node:t,parent:n};this.indexByObject.set(t,a),this.indexByPath.set(i,a);for(let[c,l]of Object.entries(t))typeof l=="object"&&l!==null&&this.createIndex(l,c,a);return a}staticExplicit(t){return this.explicit(this.ir,t)}explicit(t,r){var c;let n=(c=this.provenance(t))!=null?c:(0,Ci.fail)(`Provenance not found for node: ${JSON.stringify(t).substring(0,100)}`),i=Fe(Pe({},n),{jsonPath:Tj(`${n.jsonPath}+${r}`),name:r,node:n.node,parent:n,explicit:!0}),a=this.explicitByObject.get(n.node);return a?a.add(i):this.explicitByObject.set(n.node,new Set([i])),this.explicitByPath.set(i.jsonPath,i),i}provenance(t){var r,n;if(t!==void 0)return v.string(t)?(r=this.explicitByPath.get(t))!=null?r:this.indexByPath.get(t):v.Provenance(t)?(n=this.explicitByPath.get(t.jsonPath))!=null?n:this.indexByPath.get(t.jsonPath):this.indexByObject.get(t)}origin(t){let r=this.provenance(t);return r!=null&&r.explicit?r:r==null?void 0:r.node}irNode(t){var r;return(r=this.provenance(t))==null?void 0:r.node}jsonPath(t){var r;return(r=this.provenance(t))==null?void 0:r.jsonPath}getEnumValueName(t,r){let n=v.IR.ExampleEnumType(r)?r.value.name:r.name,i=t.values.find(a=>this.nameEquals(a.name.name,n));return i?this.getPropertyNameFor(i):(0,Ci.fail)(`Unexpected - can't find enum value ${n} 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 t.name.name.pascalCase.safeName;if(v.IR.Name(t.name))return t.name.pascalCase.safeName;if(typeof t.name=="string")return t.name}if("pascalCase"in t)return t.pascalCase.safeName;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)||v.IR.NameAndWireValue(t.name))return t.name.name.pascalCase.safeName;if(v.IR.Name(t.name))return t.name.pascalCase.safeName;if(typeof t.name=="string")return t.name}if("pascalCase"in t)return t.pascalCase.safeName;throw new Error(`Unknown property type: ${JSON.stringify(t)}`)}nameEquals(t,r){return t.camelCase.safeName===r.camelCase.safeName}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,n=this.irNode(this.ir.types[r]);if(v.IR.TypeDeclaration(n))return{typeId:r,typeDeclaration:n};(0,Ci.fail)(`dereferenceType: typeId ${r} not resolved.`)}};var Ii=class{constructor(t,r,n,i,a={makeRelativeFilePath:c=>c,makeAbsoluteFilePath:c=>c,getNamespaceForTypeId:c=>"",getDirectoryForTypeId:c=>"",getCoreAsIsFiles:()=>[],getCoreTestAsIsFiles:()=>[],getPublicCoreAsIsFiles:()=>[],getAsyncCoreAsIsFiles:()=>[],getChildNamespaceSegments:c=>[]}){o(this,"intermediateRepresentation");o(this,"apiName");o(this,"customConfig");o(this,"generatorConfig");o(this,"support");o(this,"ir");o(this,"dir");o(this,"csharp",new ki(this));o(this,"registry",new oi(this));o(this,"model");o(this,"extern",new es(this));o(this,"settings",R({namespace:()=>{var t;return(t=this.customConfig.namespace)!=null?t:zi(Ji(`${this.generatorConfig.organization}_${this.apiName}`))},readOnlyMemoryTypes:()=>{var t;return(t=this.customConfig["read-only-memory-types"])!=null?t:[]},simplifyObjectDictionaries:()=>{var t;return(t=this.customConfig["simplify-object-dictionaries"])!=null?t:!1},useFullyQualifiedNamespaces:()=>{var t;return(t=this.customConfig["experimental-fully-qualified-namespaces"])!=null?t:!1},useDotnetFormat:()=>{var t;return(t=this.customConfig["experimental-dotnet-format"])!=null?t:!1},enableWebsockets:()=>{var t;return(t=this.customConfig["experimental-enable-websockets"])!=null?t:!1},enableReadonlyConstants:()=>{var t;return(t=this.customConfig["experimental-readonly-constants"])!=null?t:!1},temporaryWebsocketEnvironments:()=>{var t;return(t=this.customConfig["temporary-websocket-environments"])!=null?t:{}},baseApiExceptionClassName:()=>{var t;return(t=this.customConfig["base-api-exception-class-name"])!=null?t:""},baseExceptionClassName:()=>{var t;return(t=this.customConfig["base-exception-class-name"])!=null?t:""},shouldGeneratedDiscriminatedUnions:()=>{var t;return(t=this.customConfig["use-discriminated-unions"])!=null?t:!0},exportedClientClassName:()=>{var t;return(t=this.customConfig["exported-client-class-name"])!=null?t:""},clientClassName:()=>{var t;return(t=this.customConfig["client-class-name"])!=null?t:""},rootNamespaceForCoreClasses:()=>{var t;return(t=this.customConfig["root-namespace-for-core-classes"])!=null?t:!0},packageId:()=>{var t;return(t=this.customConfig["package-id"])!=null?t:""},isForwardCompatibleEnumsEnabled:()=>{var t,r;return(r=(t=this.customConfig["enable-forward-compatible-enums"])!=null?t:this.customConfig["experimental-enable-forward-compatible-enums"])!=null?r:!0},websocketEnvironments:()=>{var t;return(t=this.customConfig["temporary-websocket-environments"])!=null?t:{}},generateNewAdditionalProperties:()=>{var t,r;return(r=(t=this.customConfig["additional-properties"])!=null?t:this.customConfig["experimental-additional-properties"])!=null?r:!0},customPagerName:()=>{var t;return(t=this.customConfig["custom-pager-name"])!=null?t:""},environmentClassName:()=>{var t;return(t=this.customConfig["environment-class-name"])!=null?t:""},generateErrorTypes:()=>{var t;return(t=this.customConfig["generate-error-types"])!=null?t:!0},shouldInlinePathParameters:()=>{var t;return(t=this.customConfig["inline-path-parameters"])!=null?t:!0},includeExceptionHandler:()=>{var t;return(t=this.customConfig["include-exception-handler"])!=null?t:!1},exceptionInterceptorClassName:()=>{var t;return(t=this.customConfig["exception-interceptor-class-name"])!=null?t:""},shouldGenerateMockServerTests:()=>{var t,r;return(r=(t=this.customConfig["generate-mock-server-tests"])!=null?t:this.customConfig["enable-wire-tests"])!=null?r:!0},rootClientAccess:()=>this.customConfig["root-client-class-access"]=="internal"?ee.Internal:ee.Public,extraDependencies:()=>{var t;return(t=this.customConfig["extra-dependencies"])!=null?t:{}},pascalCaseEnvironments:()=>{var t;return(t=this.customConfig["pascal-case-environments"])!=null?t:!0},explicitNamespaces:()=>this.customConfig["explicit-namespaces"]===!0,outputPath:()=>{var r,n,i,a;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:(r=t.library)!=null?r:"src",test:(n=t.test)!=null?n:"src",solution:(i=t.solution)!=null?i:".",other:(a=t.other)!=null?a:"."}}}));o(this,"constants",{folders:R({mockServerTests:()=>this.support.makeRelativeFilePath("Unit/MockServer"),types:()=>"Types",exceptions:()=>"Exceptions",src:()=>"src",protobuf:()=>"proto",serializationTests:()=>this.support.makeRelativeFilePath("Unit/Serialization"),project:()=>this.support.makeRelativeFilePath((0,qi.join)(this.constants.folders.sourceFiles,this.support.makeRelativeFilePath(this.names.files.project))),sourceFiles:()=>this.support.makeRelativeFilePath(this.constants.folders.src),coreFiles:()=>this.support.makeRelativeFilePath((0,qi.join)(this.constants.folders.project,this.support.makeRelativeFilePath(this.constants.defaults.core))),publicCoreFiles:()=>this.support.makeRelativeFilePath((0,qi.join)(this.constants.folders.project,this.support.makeRelativeFilePath(this.constants.defaults.core),this.support.makeRelativeFilePath(this.constants.defaults.publicCore))),testFiles:()=>this.support.makeRelativeFilePath((0,qi.join)(this.constants.folders.sourceFiles,this.support.makeRelativeFilePath(this.names.files.testProject)))}),formatting:R({indent:()=>" "}),defaults:R({core:()=>"Core",publicCore:()=>"Public",version:()=>"0.0.0"})});o(this,"namespaces",R({root:()=>this.settings.namespace,core:()=>`${this.namespaces.root}.Core`,test:()=>this.registry.canonicalizeNamespace(`${this.namespaces.root}.Test`),testUtils:()=>`${this.namespaces.test}.Utils`,mockServerTest:()=>`${this.namespaces.test}.Unit.MockServer`,publicCore:()=>this.namespaces.root,asyncCore:()=>`${this.namespaces.core}.Async`,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"])}));o(this,"names",{classes:R({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:R({client:()=>zi(Ji(`${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:R({project:()=>this.namespaces.root,testProject:()=>`${this.namespaces.root}.Test`}),methods:R({mockOauth:()=>"MockOAuthEndpoint",getAccessTokenAsync:()=>"GetAccessTokenAsync"}),variables:R({client:()=>"client",response:()=>"response",httpRequest:()=>"httpRequest",sendRequest:()=>"sendRequest",responseBody:()=>"responseBody",query:()=>"_query",headers:()=>"_headers"}),parameters:R({cancellationToken:()=>"cancellationToken",requestOptions:()=>"options",idempotentOptions:()=>"options"})});o(this,"Types",R({Arbitrary:t=>new B.AribitraryType(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")}),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}),EnumSerializer:()=>this.csharp.classReference({origin:this.model.staticExplicit("EnumSerializer"),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}),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}),AsyncApiOptions:()=>this.csharp.classReference({origin:this.model.staticExplicit("AsyncApiOptions"),namespace:`${this.namespaces.asyncCore}.Models`}),QueryBuilder:()=>this.csharp.classReference({origin:this.model.staticExplicit("Query"),namespace:this.namespaces.asyncCore}),OAuthTokenProvider:()=>this.csharp.classReference({origin:this.model.staticExplicit("OAuthTokenProvider"),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}),AsyncApi:t=>this.csharp.classReference({origin:this.model.staticExplicit("AsyncApi"),namespace:this.namespaces.asyncCore,generics:[t]}),AsyncEvent:t=>this.csharp.classReference({origin:this.model.staticExplicit("Event"),namespace:`${this.namespaces.asyncCore}.Events`,generics:[t]}),StringEnumSerializer:t=>this.csharp.classReference({origin:this.model.staticExplicit("StringEnumSerializer"),namespace:this.namespaces.core,generics:[t]}),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:n,offsetType:i,stepType:a,itemType:c})=>this.csharp.classReference({origin:this.model.staticExplicit("OffsetPager"),namespace:this.namespaces.core,generics:[t,r,n,i,a,c]}),CursorPager:({requestType:t,requestOptionsType:r,responseType:n,cursorType:i,itemType:a})=>this.csharp.classReference({origin:this.model.staticExplicit("CursorPager"),namespace:this.namespaces.core,generics:[t,r,n,i,a]}),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})}));o(this,"Primitive",R({string:()=>new B.String(this),boolean:()=>new B.Boolean(this),integer:()=>new B.Integer(this),long:()=>new B.Long(this),uint:()=>new B.Uint(this),ulong:()=>new B.ULong(this),float:()=>new B.Float(this),double:()=>new B.Double(this),object:()=>new B.Object(this)}));o(this,"Value",R({binary:()=>new Ee.Binary(this),dateOnly:()=>new Ee.DateOnly(this),dateTime:()=>new Ee.DateTime(this),uuid:()=>new Ee.Uuid(this),stringEnum:t=>new Ee.StringEnum(t,this)}));o(this,"Collection",R({array:t=>new ue.Array(t,this),listType:t=>new ue.ListType(t,this),list:t=>new ue.List(t,this),set:t=>new ue.Set(t,this),map:(t,r,n)=>new ue.Map(t,r,this,n),idictionary:(t,r,n)=>new ue.IDictionary(t,r,this,n),keyValuePair:(t,r)=>new ue.KeyValuePair(t,r,this)}));o(this,"format",R({private:t=>`_${Ni.camelCase(t)}`}));o(this,"initializers",R({implicitNamespaces:()=>{for(let t of this.namespaces.implicit)this.registry.addImplicitNamespace(t);return!0}}));this.intermediateRepresentation=t,this.apiName=r,this.customConfig=n,this.generatorConfig=i,this.support=a,this.model=new ts(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}};var Ge=class{constructor(t){o(this,"generation");this.generation=t}get csharp(){return this.generation.csharp}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}};var rs=class extends Ge{constructor({context:r}){super(r.generation);o(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:I.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,value:r.value});case"map":return this.convertMap({map:r.typeReference,value:r.value,fallbackToDefault:r.fallbackToDefault});case"named":{let n=this.context.resolveNamedType({typeId:r.typeReference.value});return n==null?this.csharp.Literal.nop():this.convertNamed({named:n,value:r.value,as:r.as,fallbackToDefault:r.fallbackToDefault})}case"nullable":return this.convert({typeReference:r.typeReference.value,value:r.value,as:r.as});case"optional":return this.convert({typeReference:r.typeReference.value,value:r.value,as:r.as});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:W(r.typeReference)}}convertList({list:r,value:n,fallbackToDefault:i}){return Array.isArray(n)?this.csharp.Literal.list({valueType:this.context.dynamicTypeMapper.convert({typeReference:r,unboxOptionals:!0}),values:n.map((a,c)=>{this.context.errors.scope({index:c});try{return this.convert({typeReference:r,value:a})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:I.Critical,message:`Expected array but got: ${typeof n}`}),this.csharp.Literal.nop())}convertLiteral({literal:r,value:n,fallbackToDefault:i}){switch(r.type){case"boolean":{let a=this.context.getValueAsBoolean({value:n});return a==null?this.csharp.Literal.nop():this.csharp.Literal.boolean(a)}case"string":{let a=this.context.getValueAsString({value:n});return a==null?i?this.Primitive.string.getDeterminsticDefault(i):this.csharp.Literal.nop():this.csharp.Literal.string(a)}default:W(r)}}convertSet({set:r,value:n,fallbackToDefault:i}){return Array.isArray(n)?this.csharp.Literal.set({valueType:this.context.dynamicTypeMapper.convert({typeReference:r,unboxOptionals:!0}),values:n.map((a,c)=>{this.context.errors.scope({index:c});try{return this.convert({typeReference:r,value:a})}finally{this.context.errors.unscope()}})}):(this.context.errors.add({severity:I.Critical,message:`Expected array but got: ${typeof n}`}),this.csharp.Literal.nop())}convertMap({map:r,value:n,fallbackToDefault:i}){return typeof n!="object"||n==null?(this.context.errors.add({severity:I.Critical,message:`Expected object but got: ${n==null?"null":typeof n}`}),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(n).map(([a,c])=>{this.context.errors.scope(a);try{return{key:this.convert({typeReference:r.key,value:a,as:"key"}),value:this.convert({typeReference:r.value,value:c})}}finally{this.context.errors.unscope()}})})}convertNamed({named:r,value:n,as:i,fallbackToDefault:a}){switch(r.type){case"alias":return this.convert({typeReference:r.typeReference,value:n,as:i,fallbackToDefault:a});case"discriminatedUnion":return this.settings.shouldGeneratedDiscriminatedUnions?this.convertDiscriminatedUnion({discriminatedUnion:r,value:n,fallbackToDefault:a}):this.convertUnknown({value:n,fallbackToDefault:a});case"enum":return this.getEnumValue(r,n);case"object":return this.convertObject({object_:r,value:n,fallbackToDefault:a});case"undiscriminatedUnion":return this.convertUndiscriminatedUnion({undiscriminatedUnion:r,value:n,fallbackToDefault:a});default:W(r)}}convertDiscriminatedUnion({discriminatedUnion:r,value:n,fallbackToDefault:i}){let a=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),c=this.context.resolveDiscriminatedUnionTypeInstance({discriminatedUnion:r,value:n});if(c==null)return this.csharp.Literal.nop();let l=c.singleDiscriminatedUnionType,p=this.getBaseProperties({discriminatedUnionTypeInstance:c,singleDiscriminatedUnionType:l});switch(l.type){case"samePropertiesAsObject":{let h=this.context.resolveNamedType({typeId:l.typeId});return h==null?this.csharp.Literal.nop():this.instantiateUnionWithBaseProperties({classReference:a,baseProperties:p,arguments_:[this.convertNamed({named:h,value:c.value})]})}case"singleProperty":{if(this.context.getRecord(c.value)==null)return this.csharp.Literal.nop();try{let y=["Value","Type"].includes(l.discriminantValue.name.pascalCase.safeName)?`${l.discriminantValue.name.pascalCase.safeName}Inner`:l.discriminantValue.name.pascalCase.safeName;return this.context.errors.scope(l.discriminantValue.wireValue),this.instantiateUnionWithBaseProperties({classReference:a,baseProperties:p,arguments_:[this.csharp.instantiateClass({classReference:this.csharp.classReference({name:y,enclosingType:a}),arguments_:[this.convert({typeReference:l.typeReference,value:l.discriminantValue.wireValue})]})]})}finally{this.context.errors.unscope()}}case"noProperties":return this.instantiateUnionWithBaseProperties({classReference:a,baseProperties:p,arguments_:[this.csharp.instantiateClass({classReference:this.csharp.classReference({origin:c.discriminantValue,enclosingType:a}),arguments_:[]})]});default:W(l)}}getBaseProperties({discriminatedUnionTypeInstance:r,singleDiscriminatedUnionType:n}){var a,c;return this.context.associateByWireValue({parameters:(a=n.properties)!=null?a:[],values:(c=this.context.getRecord(r.value))!=null?c:{},ignoreMissingParameters:!0}).map(l=>{this.context.errors.scope(l.name.wireValue);try{return{name:this.context.getPropertyName(l.name.name),assignment:this.convert(l)}}finally{this.context.errors.unscope()}})}instantiateUnionWithBaseProperties({classReference:r,arguments_:n,baseProperties:i}){let a=this.csharp.instantiateClass({classReference:r,arguments_:n,multiline:!0});return i.length===0?this.csharp.Literal.reference(a):this.csharp.Literal.reference(this.csharp.codeblock(c=>{c.write(a," "),c.pushScope();for(let l of i)c.write(l.name," = ",l.assignment,",");c.popScope(!1)}))}getEnumValue(r,n){if(typeof n!="string")return this.context.errors.add({severity:I.Critical,message:`Expected enum value string, got: ${typeof n}`}),this.csharp.Literal.nop();let i=r.values.find(l=>l.wireValue===n);if(i==null)return this.context.errors.add({severity:I.Critical,message:`An enum value named "${n}" does not exist in this context`}),this.csharp.Literal.nop();let a=this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),c=a.registerField(this.model.getPropertyNameFor(i),i);return this.csharp.Literal.reference(this.csharp.enumInstantiation({reference:a,value:c}))}convertObject({object_:r,value:n,fallbackToDefault:i}){var c;let a=this.context.associateByWireValue({parameters:r.properties,values:(c=this.context.getRecord(n))!=null?c:{}});return this.csharp.Literal.class_({reference:this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),fields:a.map(l=>{this.context.errors.scope(l.name.wireValue);try{return{name:this.context.getClassName(l.name.name),value:this.convert(l)}}finally{this.context.errors.unscope()}})})}convertUndiscriminatedUnion({undiscriminatedUnion:r,value:n,fallbackToDefault:i}){let a=this.findMatchingUndiscriminatedUnionType({undiscriminatedUnion:r,value:n});return a==null?this.csharp.Literal.nop():a.typeLiteral}findMatchingUndiscriminatedUnionType({undiscriminatedUnion:r,value:n}){for(let i of r.types)try{let a=this.convert({typeReference:i,value:n});return{valueTypeReference:i,typeLiteral:a}}catch(a){continue}this.context.errors.add({severity:I.Critical,message:`None of the types in the undiscriminated union matched the given "${typeof n}" value`})}convertUnknown({value:r,fallbackToDefault:n}){return this.csharp.Literal.unknown(r)}convertPrimitive({primitive:r,value:n,as:i,fallbackToDefault:a}){switch(r){case"INTEGER":{let c=this.getValueAsNumber({value:n,as:i});return c==null?a?this.Primitive.integer.getDeterminsticDefault(a):this.csharp.Literal.nop():this.csharp.Literal.integer(c)}case"LONG":{let c=this.getValueAsNumber({value:n,as:i});return c==null?a?this.Primitive.long.getDeterminsticDefault(a):this.csharp.Literal.nop():this.csharp.Literal.long(c)}case"UINT":{let c=this.getValueAsNumber({value:n,as:i});return c==null?a?this.Primitive.uint.getDeterminsticDefault(a):this.csharp.Literal.nop():this.csharp.Literal.uint(c)}case"UINT_64":{let c=this.getValueAsNumber({value:n,as:i});return c==null?a?this.Primitive.ulong.getDeterminsticDefault(a):this.csharp.Literal.nop():this.csharp.Literal.ulong(c)}case"FLOAT":{let c=this.getValueAsNumber({value:n,as:i});return c==null?a?this.Primitive.float.getDeterminsticDefault(a):this.csharp.Literal.nop():this.csharp.Literal.float(c)}case"DOUBLE":{let c=this.getValueAsNumber({value:n,as:i});return c==null?a?this.Primitive.double.getDeterminsticDefault(a):this.csharp.Literal.nop():this.csharp.Literal.double(c)}case"BOOLEAN":{let c=this.getValueAsBoolean({value:n,as:i});return c==null?a?this.Primitive.boolean.getDeterminsticDefault(a):this.csharp.Literal.nop():this.csharp.Literal.boolean(c)}case"STRING":{let c=this.context.getValueAsString({value:n});return c==null?a?this.Primitive.string.getDeterminsticDefault(a):this.csharp.Literal.nop():this.csharp.Literal.string(c)}case"DATE":{let c=this.context.getValueAsString({value:n});return c==null?a?this.Value.dateOnly.getDeterminsticDefault(a):this.csharp.Literal.nop():this.csharp.Literal.date(c)}case"DATE_TIME":{let c=this.context.getValueAsString({value:n});return c==null?a?this.Value.dateTime.getDeterminsticDefault(a):this.csharp.Literal.nop():this.csharp.Literal.datetime(c)}case"UUID":{let c=this.context.getValueAsString({value:n});return c==null?a?this.Primitive.string.getDeterminsticDefault(a):this.csharp.Literal.nop():this.csharp.Literal.string(c)}case"BASE_64":{let c=this.context.getValueAsString({value:n});return c==null?a?this.Primitive.string.getDeterminsticDefault(a):this.csharp.Literal.nop():this.csharp.Literal.string(c)}case"BIG_INTEGER":{let c=this.context.getValueAsString({value:n});return c==null?a?this.Primitive.string.getDeterminsticDefault(a):this.csharp.Literal.nop():this.csharp.Literal.string(c)}default:W(r)}}getValueAsNumber({value:r,as:n}){let i=n==="key"&&typeof r=="string"?Number(r):r;return this.context.getValueAsNumber({value:i})}getValueAsBoolean({value:r,as:n}){let i=n==="key"?typeof r=="string"?r==="true":r==="false"?!1:r:r;return this.context.getValueAsBoolean({value:i})}};var ns=class extends Ge{constructor({context:r}){super(r.generation);o(this,"context");this.context=r}convert(r){switch(r.typeReference.type){case"list":return this.Collection.list(this.convert({typeReference:r.typeReference,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 n=this.context.resolveNamedType({typeId:r.typeReference.value});return n==null?this.convertUnknown():this.convertNamed({named:n})}case"optional":case"nullable":{let n=this.convert({typeReference:r.typeReference.value});return r.unboxOptionals?n.asNonOptional():n.asOptional()}case"primitive":return this.convertPrimitive({primitive:r.typeReference.value});case"set":return this.Collection.set(this.convert({typeReference:r.typeReference,unboxOptionals:!0}));case"unknown":return this.convertUnknown();default:W(r.typeReference)}}convertToClassReference(r){return this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)})}convertNamed({named:r}){switch(r.type){case"alias":return this.convert({typeReference:r.typeReference});case"enum":case"object":return this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)});case"discriminatedUnion":return this.settings.shouldGeneratedDiscriminatedUnions?this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}):this.Primitive.object;case"undiscriminatedUnion":return this.OneOf.OneOf(r.types.map(n=>this.convert({typeReference:n})));default:W(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":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:W(r)}}};var is=class extends Ge{constructor({context:r}){super(r.generation);o(this,"context");this.context=r}getFilePropertyInfo({body:r,value:n}){var c;let i={fileFields:[],bodyPropertyFields:[]},a=(c=this.context.getRecord(n))!=null?c:{};for(let l of r.properties)switch(l.type){case"file":v.Record.missingKey(a,l.wireValue)&&(a[l.wireValue]="[bytes]"),i.fileFields.push({name:this.context.getPropertyName(l.name),value:this.getSingleFileProperty({property:l,record:a})});break;case"fileArray":v.Record.missingKey(a,l.wireValue)&&(a[l.wireValue]=["[bytes]"]),i.fileFields.push({name:this.context.getPropertyName(l.name),value:this.getArrayFileProperty({property:l,record:a})});break;case"bodyProperty":if(v.Record.missingKey(a,l.name.wireValue))switch(l.typeReference.type){case"optional":break;case"primitive":{switch(l.typeReference.value.toLowerCase()){case"integer":{a[l.name.wireValue]=123;break}case"string":{a[l.name.wireValue]="[string]";break}case"boolean":{a[l.name.wireValue]=!0;break}case"double":{a[l.name.wireValue]=123.456;break}case"float":{a[l.name.wireValue]=123.456;break}case"long":{a[l.name.wireValue]=123456789;break}case"uint":{a[l.name.wireValue]=123;break}case"uint64":{a[l.name.wireValue]=12345;break}case"date":{a[l.name.wireValue]=new Date(2021,1,1);break}case"datetime":{a[l.name.wireValue]=new Date(2021,1,1,12,0,0);break}case"uuid":{a[l.name.wireValue]="123e4567-e89b-12d3-a456-426614174000";break}case"base64":{a[l.name.wireValue]="SGVsbG8gd29ybGQh";break}case"biginteger":{a[l.name.wireValue]="12345678901234567890";break}}break}default:break}i.bodyPropertyFields.push({name:this.context.getPropertyName(l.name.name),value:this.getBodyProperty({property:l,record:a})});break;default:W(l)}return i}getSingleFileProperty({property:r,record:n}){let i=this.context.getSingleFileValue({property:r,record:n});return i==null?this.csharp.Literal.nop():this.context.getFileParameterForString(i)}getArrayFileProperty({property:r,record:n}){let i=this.context.getFileArrayValues({property:r,record:n});return i==null?this.csharp.Literal.nop():this.csharp.Literal.list({valueType:this.Types.FileParameter,values:i.map(a=>this.context.getFileParameterForString(a))})}getBodyProperty({property:r,record:n}){let i=n[r.name.wireValue];return i==null?this.csharp.Literal.nop():this.context.dynamicLiteralMapper.convert({typeReference:r.typeReference,value:i})}};var ss=class e extends ji{constructor({ir:r,config:n,options:i,generation:a}){super({ir:r,config:n,options:i});o(this,"ir");o(this,"dynamicTypeMapper");o(this,"dynamicLiteralMapper");o(this,"filePropertyMapper");o(this,"generation");this.ir=r,this.generation=a!=null?a:new Ii(r,n.workspaceName,n.customConfig!=null?n.customConfig:{},n),this.dynamicTypeMapper=new ns({context:this}),this.dynamicLiteralMapper=new rs({context:this}),this.filePropertyMapper=new is({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}getMethodName(r){return`${r.pascalCase.safeName}Async`}getNamespace(r,n){let i=this.getNamespaceSegments(r);return i=n!=null?[...i,n]:i,[this.namespaces.root,...i].join(".")}getEnvironmentTypeReferenceFromID(r){let n=this.resolveEnvironmentName(r);if(n!=null)return this.getEnvironmentClassReferenceForEnumName(n)}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(i=>i.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((n,i)=>n[0].length-i[0].length).forEach(([n,i])=>{this.dynamicTypeMapper.convertToClassReference(i)});for(let[n,i]of r.entries())if(this.csharp.classReference({origin:this.model.staticExplicit(`Example${n}`),namespace:"Usage"}),i.endpoint){let a=this.resolveEndpointLocation(i.endpoint);for(let c of a)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.RootClient,this.csharp.freezeClassReferences()}};var as=class extends Ge{constructor({context:r}){super(r.generation);o(this,"context");this.context=r}async generateSnippet({endpoint:r,request:n,options:i}){return this.buildCodeBlock({endpoint:r,snippet:n,options:i}).toString({namespace:"Usage",generation:this.generation,allNamespaceSegments:new Set,allTypeClassReferences:new Map})}generateSnippetSync({endpoint:r,request:n,options:i}){return this.buildCodeBlock({endpoint:r,snippet:n,options:i}).toString({namespace:"Usage",generation:this.generation,allNamespaceSegments:new Set,allTypeClassReferences:new Map})}async generateSnippetAst({endpoint:r,request:n,options:i}){throw new Error("Unsupported")}buildCodeBlock({endpoint:r,snippet:n,options:i}){var l;if(r.examples&&!((l=r.examples)!=null&&l.find(p=>v.DynamicIR.EndpointExample(n)&&p.id===n.id)))throw new Error("Endpoint does not have an example that matches the snippet");let a=this.csharp.codeblock(p=>{p.writeNodeStatement(this.constructClient({endpoint:r,snippet:n})),p.newLine(),p.writeNodeStatement(this.callMethod({endpoint:r,snippet:n}))}),c=this.getStyle(i);switch(c){case Br.Concise:return a;case Br.Full:return this.buildFullCodeBlock({body:a,options:i});default:W(c)}}buildFullCodeBlock({body:r,options:n}){var c;let i=this.getConfig(n),a=this.csharp.class_({name:(c=i.fullStyleClassName)!=null?c:"Example",namespace:"Usage",access:wn.Access.Public});return a.addNamespaceReference(this.Types.RootClient.namespace),a.addMethod({name:"Do",access:wn.Access.Public,isAsync:!0,parameters:[],body:r}),a}constructClient({endpoint:r,snippet:n}){return this.csharp.codeblock(i=>{i.write("var client = "),i.writeNode(this.getRootClientConstructorInvocation(this.getConstructorArgs({endpoint:r,snippet:n})))})}callMethod({endpoint:r,snippet:n}){var c,l;let i=((c=r.response)==null?void 0:c.type)==="streaming"||((l=r.response)==null?void 0:l.type)==="streamParameter",a=this.csharp.invokeMethod({on:this.csharp.codeblock("client"),method:this.getMethod({endpoint:r}),arguments_:this.getMethodArgs({endpoint:r,snippet:n}),async:!0,configureAwait:!0,multiline:!0,isAsyncEnumerable:i});return i?this.csharp.codeblock(p=>{p.write("await foreach (var item in "),p.writeNode(a),p.writeLine(")"),p.pushScope(),p.writeLine("/* consume each item */"),p.popScope()}):a}getConstructorArgs({endpoint:r,snippet:n}){let i=[];r.auth!=null&&(n.auth!=null?i.push(...this.getConstructorAuthArgs({auth:r.auth,values:n.auth})):this.context.errors.add({severity:I.Warning,message:`Auth with ${r.auth.type} configuration is required for this endpoint`}));let a=[],c=this.getConstructorBaseUrlArgs({baseUrl:n.baseURL,environment:n.environment});c.length>0&&a.push(...c),this.context.errors.scope(Ke.Headers);let l=[];return this.context.ir.headers!=null&&n.headers!=null&&l.push(...this.getConstructorHeaderArgs({headers:this.context.ir.headers,values:n.headers})),this.context.errors.unscope(),a.length===0?[...i,...l]:[...i,...l,{name:"clientOptions",assignment:this.csharp.instantiateClass({classReference:this.Types.ClientOptions,arguments_:a.map(p=>({name:p.name,assignment:p.assignment})),multiline:!0})}]}getConstructorBaseUrlArgs({baseUrl:r,environment:n}){let i=this.getBaseUrlArg({baseUrl:r,environment:n});return v.Literal.nop(i)?[]:[{name:this.getBaseUrlOptionName(),assignment:i}]}getBaseUrlArg({baseUrl:r,environment:n}){var i;if(r!=null&&n!=null)return this.context.errors.add({severity:I.Critical,message:"Cannot specify both baseUrl and environment options"}),this.csharp.Literal.nop();if(r!=null)return((i=this.context.ir.environments)==null?void 0:i.environments.type)==="multipleBaseUrls"?(this.context.errors.add({severity:I.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(n!=null){if(this.context.isSingleEnvironmentID(n)){let a=this.context.getEnvironmentTypeReferenceFromID(n);return a==null?(this.context.errors.add({severity:I.Warning,message:`Environment ${JSON.stringify(n)} was not found`}),this.csharp.Literal.nop()):this.csharp.Literal.reference(a)}if(this.context.isMultiEnvironmentValues(n))return this.context.validateMultiEnvironmentUrlValues(n)?this.csharp.Literal.reference(this.csharp.instantiateClass({classReference:this.Types.Environments,arguments_:Object.entries(n).map(([a,c])=>({name:li(ds(a)),assignment:this.context.dynamicLiteralMapper.convert({typeReference:{type:"primitive",value:"STRING"},value:c})})),multiline:!0})):this.csharp.Literal.nop()}return this.csharp.Literal.nop()}getConstructorAuthArgs({auth:r,values:n}){if(n.type!==r.type)return this.addError(this.context.newAuthMismatchError({auth:r,values:n}).message),[];switch(r.type){case"basic":return n.type==="basic"?this.getConstructorBasicAuthArg({auth:r,values:n}):[];case"bearer":return n.type==="bearer"?this.getConstructorBearerAuthArgs({auth:r,values:n}):[];case"header":return n.type==="header"?this.getConstructorHeaderAuthArgs({auth:r,values:n}):[];case"oauth":return n.type==="oauth"?this.getConstructorOAuthArgs({auth:r,values:n}):[];case"inferred":return this.addWarning("The C# SDK Generator does not support Inferred auth scheme yet"),[];default:W(r)}}addError(r){this.context.errors.add({severity:I.Critical,message:r})}addWarning(r){this.context.errors.add({severity:I.Warning,message:r})}getConstructorBasicAuthArg({auth:r,values:n}){return[{name:this.context.getParameterName(r.username),assignment:this.csharp.Literal.string(n.username)},{name:this.context.getParameterName(r.password),assignment:this.csharp.Literal.string(n.password)}]}getConstructorBearerAuthArgs({auth:r,values:n}){return[{name:this.context.getParameterName(r.token),assignment:this.csharp.Literal.string(n.token)}]}getConstructorHeaderAuthArgs({auth:r,values:n}){return[{name:this.context.getParameterName(r.header.name.name),assignment:this.context.dynamicLiteralMapper.convert({typeReference:r.header.typeReference,value:n.value,fallbackToDefault:r.header.name.wireValue})}]}getConstructorOAuthArgs({auth:r,values:n}){return[{name:this.context.getParameterName(r.clientId),assignment:this.csharp.Literal.string(n.clientId)},{name:this.context.getParameterName(r.clientSecret),assignment:this.csharp.Literal.string(n.clientSecret)}]}getConstructorHeaderArgs({headers:r,values:n}){let i=[];for(let a of r){let c=this.getConstructorHeaderArg({header:a,value:n.value});c!=null&&i.push({name:this.context.getParameterName(a.name.name),assignment:c})}return i}getConstructorHeaderArg({header:r,value:n}){let i=this.context.dynamicLiteralMapper.convert({typeReference:r.typeReference,value:n,fallbackToDefault:r.name.wireValue});if(!v.Literal.nop(i))return i}getMethodArgs({endpoint:r,snippet:n}){switch(r.request.type){case"inlined":return this.getMethodArgsForInlinedRequest({request:r.request,snippet:n});case"body":return this.getMethodArgsForBodyRequest({request:r.request,snippet:n});default:W(r.request)}}getMethodArgsForInlinedRequest({request:r,snippet:n}){var p,h;let i=[];this.context.errors.scope(Ke.PathParameters);let a=[],c=[...(p=this.context.ir.pathParameters)!=null?p:[],...(h=r.pathParameters)!=null?h:[]];c.length>0&&a.push(...this.getPathParameters({namedParameters:c,snippet:n})),this.context.errors.unscope(),this.context.errors.scope(Ke.RequestBody);let l=this.getFilePropertyInfo({request:r,snippet:n});return this.context.errors.unscope(),this.context.includePathParametersInWrappedRequest({request:r,inlinePathParameters:this.settings.shouldInlinePathParameters})||i.push(...a.map(y=>y.value)),i.push(this.getInlinedRequestArg({request:r,snippet:n,pathParameterFields:this.context.includePathParametersInWrappedRequest({request:r,inlinePathParameters:this.settings.shouldInlinePathParameters})?a:[],filePropertyInfo:l})),i}getFilePropertyInfo({request:r,snippet:n}){return r.body==null||!this.context.isFileUploadRequestBody(r.body)?{fileFields:[],bodyPropertyFields:[]}:this.context.filePropertyMapper.getFilePropertyInfo({body:r.body,value:n.requestBody})}getInlinedRequestArg({request:r,snippet:n,pathParameterFields:i,filePropertyInfo:a}){var P,T,M,J;this.context.errors.scope(Ke.QueryParameters);let l=this.context.associateQueryParametersByWireValue({parameters:(P=r.queryParameters)!=null?P:[],values:(T=n.queryParameters)!=null?T:{}}).map(G=>({name:this.context.getPropertyName(G.name.name),value:this.context.dynamicLiteralMapper.convert(G)}));this.context.errors.unscope(),this.context.errors.scope(Ke.Headers);let h=this.context.associateByWireValue({parameters:(M=r.headers)!=null?M:[],values:(J=n.headers)!=null?J:{}}).map(G=>({name:this.context.getPropertyName(G.name.name),value:this.context.dynamicLiteralMapper.convert(Fe(Pe({},G),{fallbackToDefault:G.name.wireValue}))}));this.context.errors.unscope(),this.context.errors.scope(Ke.RequestBody);let y=r.body!=null?this.getInlinedRequestBodyConstructorFields({body:r.body,value:n.requestBody,filePropertyInfo:a}):[];return this.context.errors.unscope(),this.csharp.Literal.class_({reference:this.csharp.classReference({origin:r.declaration,namespace:this.context.getNamespace(r.declaration.fernFilepath)}),fields:[...i,...l,...h,...y]})}getInlinedRequestBodyConstructorFields({body:r,value:n,filePropertyInfo:i}){switch(r.type){case"properties":return this.getInlinedRequestBodyPropertyConstructorFields({parameters:r.value,value:n});case"referenced":return[this.getReferencedRequestBodyPropertyConstructorField({body:r,value:n})];case"fileUpload":return this.getFileUploadRequestBodyConstructorFields({filePropertyInfo:i});default:W(r)}}getInlinedRequestBodyPropertyConstructorFields({parameters:r,value:n}){var c;let i=[],a=this.context.associateByWireValue({parameters:r,values:(c=this.context.getRecord(n))!=null?c:{}});for(let l of a)i.push({name:this.context.getPropertyName(l.name.name),value:this.context.dynamicLiteralMapper.convert(Fe(Pe({},l),{fallbackToDefault:l.name.wireValue}))});return i}getFileUploadRequestBodyConstructorFields({filePropertyInfo:r}){return[...r.fileFields,...r.bodyPropertyFields]}getReferencedRequestBodyPropertyConstructorField({body:r,value:n}){return{name:this.context.getPropertyName(r.bodyKey),value:this.getReferencedRequestBodyPropertyLiteral({body:r.bodyType,value:n})}}getReferencedRequestBodyPropertyLiteral({body:r,value:n}){switch(r.type){case"bytes":return this.getBytesBodyRequestArg({value:n});case"typeReference":return this.context.dynamicLiteralMapper.convert({typeReference:r.value,value:n,fallbackToDefault:JSON.stringify(r.value)});default:W(r)}}getMethodArgsForBodyRequest({request:r,snippet:n}){var c,l;let i=[];this.context.errors.scope(Ke.PathParameters);let a=[...(c=this.context.ir.pathParameters)!=null?c:[],...(l=r.pathParameters)!=null?l:[]];return a.length>0&&i.push(...this.getPathParameters({namedParameters:a,snippet:n}).map(p=>p.value)),this.context.errors.unscope(),this.context.errors.scope(Ke.RequestBody),r.body!=null&&i.push(this.getBodyRequestArg({body:r.body,value:n.requestBody})),this.context.errors.unscope(),i}getBodyRequestArg({body:r,value:n}){switch(r.type){case"bytes":return this.getBytesBodyRequestArg({value:n});case"typeReference":return r.value.type==="optional"&&n==null?this.csharp.Literal.null():this.context.dynamicLiteralMapper.convert({typeReference:r.value,value:n,fallbackToDefault:JSON.stringify(r.value)});default:W(r)}}getBytesBodyRequestArg({value:r}){let n=this.context.getValueAsString({value:r});return n==null&&(this.context.errors.add({severity:I.Critical,message:"The bytes request body must be provided in string format"}),n="[bytes]"),this.csharp.Literal.reference(this.context.getMemoryStreamForString(n))}getRootClientConstructorInvocation(r){return this.csharp.instantiateClass({classReference:this.Types.RootClient,arguments_:r,forceUseConstructor:!0,multiline:!0})}getPathParameters({namedParameters:r,snippet:n}){var c;let i=[],a=this.context.associateByWireValueOrDefault({parameters:r,values:(c=n.pathParameters)!=null?c:{}});for(let l of a)i.push({name:this.context.getPropertyName(l.name.name),value:this.context.dynamicLiteralMapper.convert(Fe(Pe({},l),{fallbackToDefault:l.name.wireValue}))});return i}getMethod({endpoint:r}){return r.declaration.fernFilepath.allParts.length>0?`${r.declaration.fernFilepath.allParts.map(n=>this.context.getClassName(n)).join(".")}.${this.context.getMethodName(r.declaration.name)}`:this.context.getMethodName(r.declaration.name)}getBaseUrlOptionName(){var r;return((r=this.context.ir.environments)==null?void 0:r.environments.type)==="multipleBaseUrls"?"Environment":"BaseUrl"}getStyle(r){var n,i;return(i=(n=r.style)!=null?n:this.context.options.style)!=null?i:Br.Full}getConfig(r){var n,i;return(i=(n=r.config)!=null?n:this.context.options.config)!=null?i:{}}};var os=class extends bi{constructor({ir:t,config:r,options:n={}}){super(new ss({ir:t,config:r,options:n}))}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 as({context:t})}};0&&(module.exports={DynamicSnippetsGenerator});
33
33
  /*! Bundled license information:
34
34
 
35
35
  lodash-es/lodash.js: