@flock/wirespec 0.17.20 → 0.18.1-RC.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/arrow-arrow-annotations.mjs.map +1 -1
  2. package/arrow-arrow-atomic.mjs +13 -13
  3. package/arrow-arrow-atomic.mjs.map +1 -1
  4. package/arrow-arrow-core.mjs +588 -431
  5. package/arrow-arrow-core.mjs.map +1 -1
  6. package/arrow-arrow-exception-utils.mjs +30 -0
  7. package/arrow-arrow-exception-utils.mjs.map +1 -0
  8. package/clikt-clikt-mordant.mjs +318 -0
  9. package/clikt-clikt-mordant.mjs.map +1 -0
  10. package/clikt-clikt.mjs +3834 -3696
  11. package/clikt-clikt.mjs.map +1 -1
  12. package/colormath-root-colormath.mjs +619 -682
  13. package/colormath-root-colormath.mjs.map +1 -1
  14. package/kotlin-js-core.mjs +4 -0
  15. package/kotlin-js-core.mjs.map +1 -0
  16. package/kotlin-js.mjs +4 -0
  17. package/kotlin-js.mjs.map +1 -0
  18. package/kotlin-kotlin-stdlib.mjs +6284 -5825
  19. package/kotlin-kotlin-stdlib.mjs.map +1 -1
  20. package/kotlin-openapi-bindings.mjs +8163 -8198
  21. package/kotlin-openapi-bindings.mjs.map +1 -1
  22. package/kotlin-plugins-js-plain-objects-runtime.mjs +4 -0
  23. package/kotlin-plugins-js-plain-objects-runtime.mjs.map +1 -0
  24. package/kotlin-rgxgen.mjs +2007 -2062
  25. package/kotlin-rgxgen.mjs.map +1 -1
  26. package/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.mjs.map +1 -1
  27. package/kotlinx-atomicfu.mjs +4 -0
  28. package/kotlinx-atomicfu.mjs.map +1 -0
  29. package/kotlinx-coroutines-core.mjs +4 -0
  30. package/kotlinx-coroutines-core.mjs.map +1 -0
  31. package/kotlinx-io-kotlinx-io-bytestring.mjs.map +1 -1
  32. package/kotlinx-io-kotlinx-io-core.mjs +803 -839
  33. package/kotlinx-io-kotlinx-io-core.mjs.map +1 -1
  34. package/kotlinx-serialization-kotlinx-serialization-core.mjs +2483 -2553
  35. package/kotlinx-serialization-kotlinx-serialization-core.mjs.map +1 -1
  36. package/kotlinx-serialization-kotlinx-serialization-json.mjs +1861 -1928
  37. package/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -1
  38. package/mordant-mordant-omnibus.mjs +4 -0
  39. package/mordant-mordant-omnibus.mjs.map +1 -0
  40. package/mordant-mordant.mjs +2525 -4426
  41. package/mordant-mordant.mjs.map +1 -1
  42. package/package.json +4 -7
  43. package/seskar-core.mjs +4 -0
  44. package/seskar-core.mjs.map +1 -0
  45. package/wirespec-bin.mjs +13 -1
  46. package/wirespec-fetch.d.ts +4 -1
  47. package/wirespec-fetch.mjs +34 -0
  48. package/wirespec-serialization.d.ts +13 -2
  49. package/wirespec-serialization.mjs +22 -1
  50. package/wirespec-src-compiler-core.mjs +2857 -3909
  51. package/wirespec-src-compiler-core.mjs.map +1 -1
  52. package/wirespec-src-compiler-emitters-java.mjs +1370 -413
  53. package/wirespec-src-compiler-emitters-java.mjs.map +1 -1
  54. package/wirespec-src-compiler-emitters-kotlin.mjs +1015 -337
  55. package/wirespec-src-compiler-emitters-kotlin.mjs.map +1 -1
  56. package/wirespec-src-compiler-emitters-python.mjs +1465 -387
  57. package/wirespec-src-compiler-emitters-python.mjs.map +1 -1
  58. package/wirespec-src-compiler-emitters-rust.mjs +2461 -0
  59. package/wirespec-src-compiler-emitters-rust.mjs.map +1 -0
  60. package/wirespec-src-compiler-emitters-scala.mjs +1010 -0
  61. package/wirespec-src-compiler-emitters-scala.mjs.map +1 -0
  62. package/wirespec-src-compiler-emitters-typescript.mjs +1533 -450
  63. package/wirespec-src-compiler-emitters-typescript.mjs.map +1 -1
  64. package/wirespec-src-compiler-emitters-wirespec.mjs +122 -144
  65. package/wirespec-src-compiler-emitters-wirespec.mjs.map +1 -1
  66. package/wirespec-src-compiler-ir.mjs +17369 -0
  67. package/wirespec-src-compiler-ir.mjs.map +1 -0
  68. package/wirespec-src-compiler-lib.mjs +662 -728
  69. package/wirespec-src-compiler-lib.mjs.map +1 -1
  70. package/wirespec-src-converter-avro.mjs +630 -656
  71. package/wirespec-src-converter-avro.mjs.map +1 -1
  72. package/wirespec-src-converter-common.mjs.map +1 -1
  73. package/wirespec-src-converter-openapi.mjs +1705 -2024
  74. package/wirespec-src-converter-openapi.mjs.map +1 -1
  75. package/wirespec-src-plugin-arguments.mjs +418 -459
  76. package/wirespec-src-plugin-arguments.mjs.map +1 -1
  77. package/wirespec-src-plugin-cli.mjs +367 -331
  78. package/wirespec-src-plugin-cli.mjs.map +1 -1
  79. package/{wirespec-src-plugin-npm.d.ts → wirespec-src-plugin-npm.d.mts} +247 -0
  80. package/wirespec-src-plugin-npm.mjs +166 -359
  81. package/wirespec-src-plugin-npm.mjs.map +1 -1
  82. package/wirespec-src-tools-generator.mjs +79 -106
  83. package/wirespec-src-tools-generator.mjs.map +1 -1
  84. package/arrow-arrow-continuations.mjs +0 -18
  85. package/arrow-arrow-continuations.mjs.map +0 -1
  86. package/markdown.mjs +0 -6756
  87. package/markdown.mjs.map +0 -1
@@ -0,0 +1,2461 @@
1
+ import {
2
+ Custom2si7lto3wompr as Custom,
3
+ Namespace345pal554qu3j as Namespace,
4
+ File3dimy4iqmuock as File,
5
+ transformChildrend9p91tpcqdkx as transformChildren,
6
+ RawElement2yts1x2rbem1g as RawElement,
7
+ Companion_getInstance3gvtuyxc9uhxj as Companion_getInstance,
8
+ Enumlszg09mwd24f as Enum,
9
+ Interface3pn84xq686t2r as Interface,
10
+ TransformScopeyrd3lf4zrk76 as TransformScope,
11
+ TransformerBuildera6a1gvlhjj9b as TransformerBuilder,
12
+ transform3eti8i2bqvifx as transform,
13
+ Elementitq62jg6fid3 as Element,
14
+ Function21cuq8qizkin7 as Function,
15
+ generateRust223y8gad7tpbz as generateRust,
16
+ import5uhkz67bd8tt as import_0,
17
+ VariableReference2vlynnhaw1i64 as VariableReference,
18
+ FieldCall1iz7z2fx2xo4p as FieldCall,
19
+ convertConstraintkgpvomct0x0s as convertConstraint,
20
+ function12vu2kapzno4w as function_0,
21
+ requestParameters1z8fdizgtviyb as requestParameters,
22
+ flattenNestedStructs3rzqu1ggdb6h2 as flattenNestedStructs,
23
+ Union38f3pecvfcpxh as Union,
24
+ Struct39wf79cwtn4ty as Struct,
25
+ Nameoqr8dt2fim9d as Name,
26
+ transformChildren2mszeagj5nq4c as transformChildren_0,
27
+ sanitizeFieldName1ptgy1kxy8u2m as sanitizeFieldName,
28
+ ConstructorStatement1x4n4sr59iy4n as ConstructorStatement,
29
+ SanitizationConfig11mmn3p2c03c1 as SanitizationConfig,
30
+ interface24qlavvm81r6z as interface_0,
31
+ convert13xvfhgrf57n5 as convert,
32
+ Importdjdfxu3pjkxa as Import,
33
+ RawExpression2bo7ldfrptjia as RawExpression,
34
+ transformChildren2m3cpkz6zusq1 as transformChildren_1,
35
+ Boolean_instance27opaqtiiiysz as Boolean_instance,
36
+ String_instance3uxvo48ki208u as String_instance,
37
+ Switch3a1zi3na98deu as Switch,
38
+ Case2i7oahw4alz6h as Case,
39
+ FunctionCall30872kpnbr7op as FunctionCall,
40
+ RustGenerator_instance1aobjdt0upvy as RustGenerator_instance,
41
+ emit3bzdcd0f6nwtj as emit,
42
+ emitn3eihixilqyh as emit_0,
43
+ convertWithValidation3ar3nbcqsbkpn as convertWithValidation,
44
+ sanitizeNames2wqmyf8vafp9x as sanitizeNames,
45
+ convert11ert2po54h1y as convert_0,
46
+ convert37aabdzvtv9vg as convert_1,
47
+ convert17zcptkz4mhr4 as convert_2,
48
+ convert32tuiui3czihh as convert_3,
49
+ convert1cn4bolzoed8c as convert_4,
50
+ emit1oxjujel6f3jb as emit_1,
51
+ IrEmitterh2m93ojzvkep as IrEmitter,
52
+ Parameteruqoxd4rzw7ga as Parameter,
53
+ Nullable3wjn6l6q3h6o as Nullable,
54
+ Number3azxs9q1cyulb as Number_0,
55
+ Integer1uwg1wvo5lp6z as Integer,
56
+ Boolean3l1woojgw3q17 as Boolean_0,
57
+ String4gxjl3f3e5ya as String_0,
58
+ Literal50s1y3607cdv as Literal,
59
+ ArrayIndexCall31gemxjfuldqy as ArrayIndexCall,
60
+ StringLiteral3ffeojfhsbsmg as StringLiteral,
61
+ IntegerLiteral32u4pkji3telv as IntegerLiteral,
62
+ Wildcard_instance2ga1ytfwj78ra as Wildcard_instance,
63
+ Reflect_instance3i17lxiopj78t as Reflect_instance,
64
+ Bytes_instance3edm2lhbrwd51 as Bytes_instance,
65
+ Any_instance2998xag3cdzh3 as Any_instance,
66
+ Unit_instanceyaei45a6t5rv as Unit_instance,
67
+ Dict22iqrhoo0g8et as Dict,
68
+ Array2goj74t0aak7b as Array_0,
69
+ } from './wirespec-src-compiler-ir.mjs';
70
+ import {
71
+ Unit_instance28fytmsmm6r23 as Unit_instance_0,
72
+ VOID3gxj6tk5isa35 as VOID,
73
+ ArrayList_init_$Create$1jemgvhi5v0js as ArrayList_init_$Create$,
74
+ first58ocm7j58k3q as first,
75
+ plus310ted5e4i90h as plus,
76
+ listOfvhqybd2zx248 as listOf,
77
+ THROW_CCE2g6jy02ryeudk as THROW_CCE,
78
+ KtMap140uvy3s5zad8 as KtMap,
79
+ isInterface3d6p8outrmvmk as isInterface,
80
+ ensureNotNull1e947j3ixpazm as ensureNotNull,
81
+ addAll1k27qatfgp3k5 as addAll,
82
+ plus20p0vtfmu0596 as plus_0,
83
+ Collection1k04j3hzsbod0 as Collection,
84
+ joinToString1cxrrlmo0chqs as joinToString,
85
+ _Char___init__impl__6a9atx1csff5kwtduxl as _Char___init__impl__6a9atx,
86
+ charArrayOf27f4r3dozbrk1 as charArrayOf,
87
+ trimEndvvzjdhan75g as trimEnd,
88
+ KProperty1ca4yb4wlo496 as KProperty1,
89
+ getPropertyCallableRef3hckxc0xueiaj as getPropertyCallableRef,
90
+ split2bvyvnrlcifjv as split,
91
+ collectionSizeOrDefault36dulx8yinfqm as collectionSizeOrDefault,
92
+ ArrayList_init_$Create$3ivpeip4ouddx as ArrayList_init_$Create$_0,
93
+ checkIndexOverflow3frtmheghr0th as checkIndexOverflow,
94
+ StringBuilder_init_$Create$322n630qt3r8c as StringBuilder_init_$Create$,
95
+ charSequenceLength3278n89t01tmv as charSequenceLength,
96
+ charSequenceGet1vxk1y5n17t1z as charSequenceGet,
97
+ isLetterOrDigit2kuxd9e198haf as isLetterOrDigit,
98
+ firstOrNulltrxqttxfxqju as firstOrNull,
99
+ isDigit3mimrri4wkzop as isDigit,
100
+ Char19o2r8palgjof as Char,
101
+ noWhenBranchMatchedException2a6r7ubxgky5j as noWhenBranchMatchedException,
102
+ HashSet_init_$Create$33p49hmosnvr4 as HashSet_init_$Create$,
103
+ to2cs3ny02qtbcb as to,
104
+ firstOrNull1982767dljvdy as firstOrNull_0,
105
+ emptyList1g2z5xcrvp2zy as emptyList,
106
+ trimIndent1qytc1wvt8suh as trimIndent,
107
+ setOf45ia9pnfhe90 as setOf,
108
+ protoOf180f3jzyo7rfj as protoOf,
109
+ initMetadataForCompanion1wyw17z38v6ac as initMetadataForCompanion,
110
+ equals2au1ep9vhcato as equals,
111
+ FunctionAdapter3lcrrz3moet5b as FunctionAdapter,
112
+ Comparator2b3maoeh98xtg as Comparator,
113
+ hashCodeq5arwsb9dgti as hashCode,
114
+ initMetadataForClassbxx6q50dy2s7 as initMetadataForClass,
115
+ toMap1vec9topfei08 as toMap,
116
+ minus165a8u1e0x1lu as minus,
117
+ listOf1jh22dvmctj1r as listOf_0,
118
+ mapOf1xd03cq9cnmy8 as mapOf,
119
+ compareValues1n2ayl87ihzfk as compareValues,
120
+ contains3ue2qo8xhmpf1 as contains,
121
+ charCodeAt1yspne1d8erbm as charCodeAt,
122
+ uppercaseChar6lahngw3wvwg as uppercaseChar,
123
+ substring3saq8ornu0luv as substring,
124
+ toString3dhdjl9yf50de as toString,
125
+ removePrefix279df90bhrqqg as removePrefix,
126
+ startsWith26w8qjqapeeq6 as startsWith,
127
+ mapCapacity1h45rc3eh9p2l as mapCapacity,
128
+ LinkedHashMap_init_$Create$1s75e1k23v4xj as LinkedHashMap_init_$Create$,
129
+ mapOf2zpbbmyqk8xpf as mapOf_0,
130
+ lazy2hsh8ze7j6ikd as lazy,
131
+ sortedWith2csnbbb21k0lg as sortedWith,
132
+ toSet2orjxp16sotqu as toSet,
133
+ Regex_init_$Create$9xrx4twz2i6q as Regex_init_$Create$,
134
+ getKClassFromExpression348iqjl4fnx2f as getKClassFromExpression,
135
+ toString1pkumu07cwy4m as toString_0,
136
+ IllegalStateException_init_$Create$2429fvs1h56dm as IllegalStateException_init_$Create$,
137
+ initMetadataForObject1cxne3s9w65el as initMetadataForObject,
138
+ } from './kotlin-kotlin-stdlib.mjs';
139
+ import {
140
+ Companion_instancebcq57hoyp8c2 as Companion_instance,
141
+ FieldIdentifier34k7iphndcnl0 as FieldIdentifier,
142
+ Channel2fhxi4a4pwb64 as Channel,
143
+ Endpoint1jsq06yr3xdhp as Endpoint,
144
+ Unionccsavx6nrdr2 as Union_0,
145
+ Type12n1gx16iqtcu as Type,
146
+ Refined1lkzc0dg6wey7 as Refined,
147
+ Enum3l2iuc342kle6 as Enum_0,
148
+ importReferencesy4xv7r53sjjs as importReferences,
149
+ String1czvr8pxnm6on as String_1,
150
+ Shared1uygqfbd22ukz as Shared,
151
+ Paramvfwnys2w6aj1 as Param,
152
+ Literal331hu9r04vptz as Literal_0,
153
+ Companion_instance1a2xqc448tlhh as Companion_instance_0,
154
+ Companion_instance2ryk3262e300f as Companion_instance_1,
155
+ FileExtension_Rust_getInstance2x338tl89inw as FileExtension_Rust_getInstance,
156
+ Model1nx3had6rojzt as Model,
157
+ plus3lrm73de10b42 as plus_1,
158
+ plus14o24vdaiongg as plus_2,
159
+ } from './wirespec-src-compiler-core.mjs';
160
+ import {
161
+ NonEmptyList3ak25ihy2gcvs as NonEmptyList,
162
+ toNonEmptyListOrNull2ovnnazjb3msz as toNonEmptyListOrNull,
163
+ NonEmptyList__plus_impl_xqmb92tle8a7jcf2wm as NonEmptyList__plus_impl_xqmb9,
164
+ } from './arrow-arrow-core.mjs';
165
+ //region block: imports
166
+ //endregion
167
+ //region block: pre-declaration
168
+ initMetadataForCompanion(Companion);
169
+ initMetadataForClass(sam$kotlin_Comparator$0, 'sam$kotlin_Comparator$0', VOID, VOID, [Comparator, FunctionAdapter]);
170
+ initMetadataForClass(RustIrEmitter$shared$1);
171
+ initMetadataForClass(RustIrEmitter, 'RustIrEmitter', RustIrEmitter, VOID, [IrEmitter]);
172
+ initMetadataForObject(RustTransform, 'RustTransform');
173
+ //endregion
174
+ function get_selfParam() {
175
+ _init_properties_RustIrEmitter_kt__j995rl();
176
+ return selfParam;
177
+ }
178
+ var selfParam;
179
+ function get_RESPONSE_PATTERN() {
180
+ _init_properties_RustIrEmitter_kt__j995rl();
181
+ return RESPONSE_PATTERN;
182
+ }
183
+ var RESPONSE_PATTERN;
184
+ function RustIrEmitter$shared$o$requestHeaders$lambda($this$interface) {
185
+ $this$interface.e1j(new Custom('Headers'));
186
+ return Unit_instance_0;
187
+ }
188
+ function RustIrEmitter$shared$o$responseHeaders$lambda($this$interface) {
189
+ $this$interface.e1j(new Custom('Headers'));
190
+ return Unit_instance_0;
191
+ }
192
+ function RustIrEmitter$shared$o$enumTrait$lambda($this$interface) {
193
+ $this$interface.e1j(new Custom('Sized'));
194
+ $this$interface.b1i('label', VOID, VOID, RustIrEmitter$shared$o$enumTrait$lambda$lambda);
195
+ $this$interface.b1i('from_label', true, VOID, RustIrEmitter$shared$o$enumTrait$lambda$lambda_0);
196
+ return Unit_instance_0;
197
+ }
198
+ function RustIrEmitter$shared$o$enumTrait$lambda$lambda($this$function) {
199
+ $this$function.l1i('&self', new Custom(''));
200
+ $this$function.k1i(new Custom('&str'));
201
+ return Unit_instance_0;
202
+ }
203
+ function RustIrEmitter$shared$o$enumTrait$lambda$lambda_0($this$function) {
204
+ $this$function.l1i('s', new Custom('&str'));
205
+ $this$function.k1i(new Custom('Option<Self>'));
206
+ return Unit_instance_0;
207
+ }
208
+ function RustIrEmitter$shared$o$refinedTrait$lambda($this$interface) {
209
+ $this$interface.a1i($this$interface.t1h('T', []), []);
210
+ $this$interface.b1i('value', VOID, VOID, RustIrEmitter$shared$o$refinedTrait$lambda$lambda);
211
+ $this$interface.b1i('validate', VOID, VOID, RustIrEmitter$shared$o$refinedTrait$lambda$lambda_0);
212
+ return Unit_instance_0;
213
+ }
214
+ function RustIrEmitter$shared$o$refinedTrait$lambda$lambda($this$function) {
215
+ $this$function.l1i('&self', new Custom(''));
216
+ $this$function.k1i(borrow($this$function.t1h('T', [])));
217
+ return Unit_instance_0;
218
+ }
219
+ function RustIrEmitter$shared$o$refinedTrait$lambda$lambda_0($this$function) {
220
+ $this$function.l1i('&self', new Custom(''));
221
+ $this$function.k1i($this$function.s1i());
222
+ return Unit_instance_0;
223
+ }
224
+ function RustIrEmitter$shared$o$requestTrait$lambda($this$interface) {
225
+ $this$interface.a1i($this$interface.t1h('T', []), []);
226
+ $this$interface.m1i('path', borrowDyn($this$interface.t1h('Path', [])));
227
+ $this$interface.m1i('method', borrow($this$interface.t1h('Method', [])));
228
+ $this$interface.m1i('queries', borrowDyn($this$interface.t1h('Queries', [])));
229
+ $this$interface.m1i('headers', borrowDyn($this$interface.t1h('RequestHeaders', [])));
230
+ $this$interface.m1i('body', borrow($this$interface.t1h('T', [])));
231
+ return Unit_instance_0;
232
+ }
233
+ function RustIrEmitter$shared$o$responseTrait$lambda($this$interface) {
234
+ $this$interface.a1i($this$interface.t1h('T', []), []);
235
+ $this$interface.m1i('status', $this$interface.n1t());
236
+ $this$interface.m1i('headers', borrowDyn($this$interface.t1h('ResponseHeaders', [])));
237
+ $this$interface.m1i('body', borrow($this$interface.t1h('T', [])));
238
+ return Unit_instance_0;
239
+ }
240
+ function RustIrEmitter$shared$o$transportationTrait$lambda($this$interface) {
241
+ $this$interface.o1j('transport', VOID, VOID, RustIrEmitter$shared$o$transportationTrait$lambda$lambda);
242
+ return Unit_instance_0;
243
+ }
244
+ function RustIrEmitter$shared$o$transportationTrait$lambda$lambda($this$asyncFunction) {
245
+ $this$asyncFunction.l1i('&self', new Custom(''));
246
+ $this$asyncFunction.l1i('request', borrow($this$asyncFunction.t1h('RawRequest', [])));
247
+ $this$asyncFunction.k1i($this$asyncFunction.t1h('RawResponse', []));
248
+ return Unit_instance_0;
249
+ }
250
+ function RustIrEmitter$shared$o$wirespecFile$lambda(this$0) {
251
+ return function (element, transformer) {
252
+ var tmp;
253
+ if (element instanceof File) {
254
+ // Inline function 'kotlin.collections.filterIsInstance' call
255
+ var tmp0 = element.u1m_1;
256
+ // Inline function 'kotlin.collections.filterIsInstanceTo' call
257
+ var destination = ArrayList_init_$Create$();
258
+ var _iterator__ex2g4s = tmp0.t();
259
+ while (_iterator__ex2g4s.u()) {
260
+ var element_0 = _iterator__ex2g4s.v();
261
+ if (element_0 instanceof Namespace) {
262
+ destination.x(element_0);
263
+ }
264
+ }
265
+ var namespace = first(destination);
266
+ tmp = element.x1m(VOID, plus(this$0.s1y_1, namespace.a1n_1));
267
+ } else {
268
+ tmp = element;
269
+ }
270
+ var transformed = tmp;
271
+ return transformChildren(transformed, transformer);
272
+ };
273
+ }
274
+ function RustIrEmitter$shared$o$wirespecFile$lambda_0(element, transformer) {
275
+ var tmp;
276
+ if (element instanceof Enum) {
277
+ var tmp_0;
278
+ if (element.d1o_1.equals(Companion_getInstance().m1h('Method'))) {
279
+ tmp_0 = new RawElement('#[derive(Debug, Clone, Default, PartialEq)]\npub enum Method {\n #[default]\n GET,\n PUT,\n POST,\n DELETE,\n OPTIONS,\n HEAD,\n PATCH,\n TRACE,\n}');
280
+ } else {
281
+ tmp_0 = element;
282
+ }
283
+ tmp = tmp_0;
284
+ } else {
285
+ tmp = element;
286
+ }
287
+ var transformed = tmp;
288
+ return transformChildren(transformed, transformer);
289
+ }
290
+ function RustIrEmitter$shared$o$wirespecFile$lambda_1(this$0) {
291
+ return function (element, transformer) {
292
+ var tmp;
293
+ if (element instanceof File) {
294
+ // Inline function 'kotlin.collections.flatMap' call
295
+ var tmp0 = element.u1m_1;
296
+ // Inline function 'kotlin.collections.flatMapTo' call
297
+ var destination = ArrayList_init_$Create$();
298
+ var _iterator__ex2g4s = tmp0.t();
299
+ while (_iterator__ex2g4s.u()) {
300
+ var element_0 = _iterator__ex2g4s.v();
301
+ var tmp_0;
302
+ if (element_0 instanceof Interface) {
303
+ var name = element_0.m1o_1.x1l();
304
+ var tmp_1;
305
+ // Inline function 'kotlin.collections.contains' call
306
+ // Inline function 'kotlin.collections.containsKey' call
307
+ var this_0 = this$0.d1z_1;
308
+ if ((isInterface(this_0, KtMap) ? this_0 : THROW_CCE()).n2(name)) {
309
+ // Inline function 'kotlin.collections.buildList' call
310
+ // Inline function 'kotlin.collections.buildListInternal' call
311
+ // Inline function 'kotlin.apply' call
312
+ var this_1 = ArrayList_init_$Create$();
313
+ this_1.x(ensureNotNull(this$0.d1z_1.p2(name)));
314
+ if (name === 'Request') {
315
+ this_1.x(this$0.t1y_1);
316
+ }
317
+ if (name === 'Response') {
318
+ this_1.x(this$0.u1y_1);
319
+ }
320
+ tmp_1 = this_1.o5();
321
+ } else {
322
+ // Inline function 'kotlin.collections.contains' call
323
+ // Inline function 'kotlin.collections.containsKey' call
324
+ var this_2 = this$0.b1z_1;
325
+ if ((isInterface(this_2, KtMap) ? this_2 : THROW_CCE()).n2(name)) {
326
+ tmp_1 = listOf(ensureNotNull(this$0.b1z_1.p2(name)));
327
+ } else {
328
+ tmp_1 = listOf(element_0);
329
+ }
330
+ }
331
+ tmp_0 = tmp_1;
332
+ } else {
333
+ tmp_0 = listOf(element_0);
334
+ }
335
+ var list = tmp_0;
336
+ addAll(destination, list);
337
+ }
338
+ var newElements = plus_0(plus_0(destination, this$0.v1y_1), this$0.w1y_1);
339
+ tmp = element.x1m(VOID, newElements);
340
+ } else {
341
+ tmp = element;
342
+ }
343
+ var transformed = tmp;
344
+ return transformChildren(transformed, transformer);
345
+ };
346
+ }
347
+ function RustIrEmitter$shared$o$source$lambda(element, transformer) {
348
+ var tmp;
349
+ if (element instanceof Interface) {
350
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
351
+ var scope = new TransformScope(element);
352
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
353
+ var tmp_0 = scope;
354
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
355
+ var this_0 = scope.z1t_1;
356
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
357
+ // Inline function 'kotlin.apply' call
358
+ var this_1 = new TransformerBuilder();
359
+ this_1.d1h(RustIrEmitter$shared$o$source$lambda$lambda);
360
+ var tmp$ret$2 = this_1.e1h();
361
+ tmp_0.z1t_1 = transform(this_0, tmp$ret$2);
362
+ var tmp_1 = scope.z1t_1;
363
+ tmp = isInterface(tmp_1, Element) ? tmp_1 : THROW_CCE();
364
+ } else {
365
+ tmp = element;
366
+ }
367
+ var transformed = tmp;
368
+ return transformChildren(transformed, transformer);
369
+ }
370
+ function RustIrEmitter$shared$o$source$lambda$lambda(element, transformer) {
371
+ var tmp;
372
+ if (element instanceof Function) {
373
+ var tmp0 = element.v1j_1;
374
+ var tmp$ret$0;
375
+ $l$block_0: {
376
+ // Inline function 'kotlin.collections.any' call
377
+ var tmp_0;
378
+ if (isInterface(tmp0, Collection)) {
379
+ tmp_0 = tmp0.r();
380
+ } else {
381
+ tmp_0 = false;
382
+ }
383
+ if (tmp_0) {
384
+ tmp$ret$0 = false;
385
+ break $l$block_0;
386
+ }
387
+ var _iterator__ex2g4s = tmp0.t();
388
+ while (_iterator__ex2g4s.u()) {
389
+ var element_0 = _iterator__ex2g4s.v();
390
+ if (element_0.v1n_1.s1h() === '&self' || element_0.v1n_1.s1h() === 'self') {
391
+ tmp$ret$0 = true;
392
+ break $l$block_0;
393
+ }
394
+ }
395
+ tmp$ret$0 = false;
396
+ }
397
+ var hasSelf = tmp$ret$0;
398
+ var tmp_1;
399
+ if (!hasSelf && !element.z1j_1) {
400
+ tmp_1 = element.b1k(VOID, VOID, plus(listOf(get_selfParam()), element.v1j_1));
401
+ } else {
402
+ tmp_1 = element;
403
+ }
404
+ tmp = tmp_1;
405
+ } else {
406
+ tmp = element;
407
+ }
408
+ var transformed = tmp;
409
+ return transformChildren(transformed, transformer);
410
+ }
411
+ function RustIrEmitter$shared$o$source$lambda_0(group) {
412
+ return trimEnd(joinToString(group, '', VOID, VOID, VOID, VOID, RustIrEmitter$shared$o$source$lambda$lambda_0), charArrayOf([_Char___init__impl__6a9atx(10)]));
413
+ }
414
+ function RustIrEmitter$shared$o$source$lambda$lambda_0(it) {
415
+ return generateRust(it);
416
+ }
417
+ function _get_sanitizationConfig__sns434($this) {
418
+ var tmp0 = $this.k1z_1;
419
+ var tmp = KProperty1;
420
+ // Inline function 'kotlin.getValue' call
421
+ getPropertyCallableRef('sanitizationConfig', 1, tmp, RustIrEmitter$_get_sanitizationConfig_$ref_17ypni(), null);
422
+ return tmp0.l1();
423
+ }
424
+ function sanitize($this, _this__u8e3s4) {
425
+ // Inline function 'kotlin.collections.mapIndexed' call
426
+ var this_0 = split(_this__u8e3s4.l1(), ['.', ' ']);
427
+ // Inline function 'kotlin.collections.mapIndexedTo' call
428
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
429
+ var index = 0;
430
+ var _iterator__ex2g4s = this_0.t();
431
+ while (_iterator__ex2g4s.u()) {
432
+ var item = _iterator__ex2g4s.v();
433
+ var _unary__edvuaz = index;
434
+ index = _unary__edvuaz + 1 | 0;
435
+ var tmp$ret$0 = checkIndexOverflow(_unary__edvuaz) > 0 ? Companion_instance.oq(item) : item;
436
+ destination.x(tmp$ret$0);
437
+ }
438
+ // Inline function 'kotlin.text.filter' call
439
+ var tmp0 = joinToString(destination, '');
440
+ // Inline function 'kotlin.text.filterTo' call
441
+ var destination_0 = StringBuilder_init_$Create$();
442
+ var inductionVariable = 0;
443
+ var last = charSequenceLength(tmp0);
444
+ if (inductionVariable < last)
445
+ do {
446
+ var index_0 = inductionVariable;
447
+ inductionVariable = inductionVariable + 1 | 0;
448
+ var element = charSequenceGet(tmp0, index_0);
449
+ if (isLetterOrDigit(element) || element === _Char___init__impl__6a9atx(95)) {
450
+ destination_0.s(element);
451
+ }
452
+ }
453
+ while (inductionVariable < last);
454
+ // Inline function 'kotlin.let' call
455
+ var it = destination_0.toString();
456
+ var tmp;
457
+ var tmp0_safe_receiver = firstOrNull(it);
458
+ var tmp_0;
459
+ var tmp_1 = tmp0_safe_receiver;
460
+ if ((tmp_1 == null ? null : new Char(tmp_1)) == null) {
461
+ tmp_0 = null;
462
+ } else {
463
+ tmp_0 = isDigit(tmp0_safe_receiver);
464
+ }
465
+ if (tmp_0 === true) {
466
+ tmp = '_' + it;
467
+ } else {
468
+ tmp = it;
469
+ }
470
+ // Inline function 'kotlin.let' call
471
+ var it_0 = tmp;
472
+ var tmp_2;
473
+ if (_this__u8e3s4 instanceof FieldIdentifier) {
474
+ tmp_2 = sanitizeKeywords($this, it_0);
475
+ } else {
476
+ tmp_2 = it_0;
477
+ }
478
+ var tmp$ret$9 = tmp_2;
479
+ return toSnakeCase($this, tmp$ret$9);
480
+ }
481
+ function toSnakeCase($this, _this__u8e3s4) {
482
+ return Companion_getInstance().m1h(_this__u8e3s4).y1l();
483
+ }
484
+ function toPascalCase($this, _this__u8e3s4) {
485
+ var tmp = split(_this__u8e3s4, ['_']);
486
+ return joinToString(tmp, '', VOID, VOID, VOID, VOID, RustIrEmitter$toPascalCase$lambda);
487
+ }
488
+ function sanitizeKeywords($this, _this__u8e3s4) {
489
+ return Companion_getInstance_0().o1z_1.u1(_this__u8e3s4) ? 'r#' + _this__u8e3s4 : _this__u8e3s4;
490
+ }
491
+ function sanitizeEnum($this, _this__u8e3s4) {
492
+ // Inline function 'kotlin.let' call
493
+ var it = toPascalCase($this, joinToString(split(_this__u8e3s4, ['-', ', ', '.', ' ', '//']), '_'));
494
+ var tmp;
495
+ var tmp0_safe_receiver = firstOrNull(it);
496
+ var tmp_0;
497
+ var tmp_1 = tmp0_safe_receiver;
498
+ if ((tmp_1 == null ? null : new Char(tmp_1)) == null) {
499
+ tmp_0 = null;
500
+ } else {
501
+ tmp_0 = isDigit(tmp0_safe_receiver);
502
+ }
503
+ if (tmp_0 === true) {
504
+ tmp = '_' + it;
505
+ } else {
506
+ tmp = it;
507
+ }
508
+ return tmp;
509
+ }
510
+ function sort($this, definition) {
511
+ var tmp;
512
+ if (definition instanceof Enum_0) {
513
+ tmp = 1;
514
+ } else {
515
+ if (definition instanceof Refined) {
516
+ tmp = 2;
517
+ } else {
518
+ if (definition instanceof Type) {
519
+ tmp = 3;
520
+ } else {
521
+ if (definition instanceof Union_0) {
522
+ tmp = 4;
523
+ } else {
524
+ if (definition instanceof Endpoint) {
525
+ tmp = 5;
526
+ } else {
527
+ if (definition instanceof Channel) {
528
+ tmp = 6;
529
+ } else {
530
+ noWhenBranchMatchedException();
531
+ }
532
+ }
533
+ }
534
+ }
535
+ }
536
+ }
537
+ return tmp;
538
+ }
539
+ function prependImports($this, _this__u8e3s4, imports) {
540
+ var tmp;
541
+ // Inline function 'kotlin.collections.isNotEmpty' call
542
+ if (!imports.r()) {
543
+ tmp = _this__u8e3s4.x1m(VOID, plus(imports, _this__u8e3s4.u1m_1));
544
+ } else {
545
+ tmp = _this__u8e3s4;
546
+ }
547
+ return tmp;
548
+ }
549
+ function buildModelImports($this, _this__u8e3s4) {
550
+ // Inline function 'kotlin.collections.distinctBy' call
551
+ var this_0 = importReferences(_this__u8e3s4);
552
+ var set = HashSet_init_$Create$();
553
+ var list = ArrayList_init_$Create$();
554
+ var _iterator__ex2g4s = this_0.t();
555
+ while (_iterator__ex2g4s.u()) {
556
+ var e = _iterator__ex2g4s.v();
557
+ var key = e.lu_1;
558
+ if (set.x(key)) {
559
+ list.x(e);
560
+ }
561
+ }
562
+ // Inline function 'kotlin.collections.map' call
563
+ // Inline function 'kotlin.collections.mapTo' call
564
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(list, 10));
565
+ var _iterator__ex2g4s_0 = list.t();
566
+ while (_iterator__ex2g4s_0.u()) {
567
+ var item = _iterator__ex2g4s_0.v();
568
+ var tmp$ret$2 = import_0('super::' + toSnakeCase($this, item.lu_1), item.lu_1);
569
+ destination.x(tmp$ret$2);
570
+ }
571
+ return destination;
572
+ }
573
+ function buildEndpointImports($this, _this__u8e3s4) {
574
+ // Inline function 'kotlin.collections.distinctBy' call
575
+ var this_0 = importReferences(_this__u8e3s4);
576
+ var set = HashSet_init_$Create$();
577
+ var list = ArrayList_init_$Create$();
578
+ var _iterator__ex2g4s = this_0.t();
579
+ while (_iterator__ex2g4s.u()) {
580
+ var e = _iterator__ex2g4s.v();
581
+ var key = e.lu_1;
582
+ if (set.x(key)) {
583
+ list.x(e);
584
+ }
585
+ }
586
+ // Inline function 'kotlin.collections.map' call
587
+ // Inline function 'kotlin.collections.mapTo' call
588
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(list, 10));
589
+ var _iterator__ex2g4s_0 = list.t();
590
+ while (_iterator__ex2g4s_0.u()) {
591
+ var item = _iterator__ex2g4s_0.v();
592
+ var tmp$ret$2 = import_0('super::super::model::' + toSnakeCase($this, item.lu_1), item.lu_1);
593
+ destination.x(tmp$ret$2);
594
+ }
595
+ return destination;
596
+ }
597
+ function injectSelfReceiver($this, _this__u8e3s4, fieldNames) {
598
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
599
+ var scope = new TransformScope(_this__u8e3s4);
600
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
601
+ var tmp = scope;
602
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
603
+ var this_0 = scope.z1t_1;
604
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
605
+ // Inline function 'kotlin.apply' call
606
+ var this_1 = new TransformerBuilder();
607
+ this_1.d1h(RustIrEmitter$injectSelfReceiver$lambda(fieldNames));
608
+ var tmp$ret$2 = this_1.e1h();
609
+ tmp.z1t_1 = transform(this_0, tmp$ret$2);
610
+ var tmp_0 = scope.z1t_1;
611
+ return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
612
+ }
613
+ function stripWirespecPrefix($this, _this__u8e3s4) {
614
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
615
+ var scope = new TransformScope(_this__u8e3s4);
616
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matching' call
617
+ var tmp = scope;
618
+ // Inline function 'community.flock.wirespec.ir.core.transformMatching' call
619
+ var this_0 = scope.z1t_1;
620
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
621
+ // Inline function 'kotlin.apply' call
622
+ var this_1 = new TransformerBuilder();
623
+ this_1.f1u(RustIrEmitter$stripWirespecPrefix$lambda);
624
+ var tmp$ret$2 = this_1.e1h();
625
+ tmp.z1t_1 = transform(this_0, tmp$ret$2);
626
+ var tmp_0 = scope.z1t_1;
627
+ return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
628
+ }
629
+ function buildValidateFunction($this, refined) {
630
+ var constraintExpr = convertConstraint(refined.cr_1, new FieldCall(new VariableReference(Companion_getInstance().m1h('self')), Companion_getInstance().m1h('value')));
631
+ return function_0('validate', VOID, VOID, RustIrEmitter$buildValidateFunction$lambda(constraintExpr));
632
+ }
633
+ function buildToStringFunction($this, refined) {
634
+ var tmp;
635
+ if (refined.cr_1.pu_1 instanceof String_1) {
636
+ tmp = 'self.value.clone()';
637
+ } else {
638
+ tmp = 'format!("{}", self.value)';
639
+ }
640
+ var expr = tmp;
641
+ return function_0('to_string', VOID, VOID, RustIrEmitter$buildToStringFunction$lambda(expr));
642
+ }
643
+ function buildClientParams($this, _this__u8e3s4) {
644
+ var params = requestParameters(_this__u8e3s4);
645
+ var tmp;
646
+ // Inline function 'kotlin.collections.isNotEmpty' call
647
+ if (!params.r()) {
648
+ tmp = ', ' + joinToString(params, ', ', VOID, VOID, VOID, VOID, RustIrEmitter$buildClientParams$lambda($this));
649
+ } else {
650
+ tmp = '';
651
+ }
652
+ var paramsStr = tmp;
653
+ var tmp_0;
654
+ // Inline function 'kotlin.collections.isNotEmpty' call
655
+ if (!params.r()) {
656
+ tmp_0 = joinToString(params, ', ', VOID, VOID, VOID, VOID, RustIrEmitter$buildClientParams$lambda_0($this));
657
+ } else {
658
+ tmp_0 = '';
659
+ }
660
+ var argsStr = tmp_0;
661
+ return to(paramsStr, argsStr);
662
+ }
663
+ function flattenForRust($this, _this__u8e3s4) {
664
+ // Inline function 'community.flock.wirespec.ir.core.findElement' call
665
+ // Inline function 'kotlin.collections.filterIsInstance' call
666
+ var tmp0 = _this__u8e3s4.v1m();
667
+ // Inline function 'kotlin.collections.filterIsInstanceTo' call
668
+ var destination = ArrayList_init_$Create$();
669
+ var _iterator__ex2g4s = tmp0.t();
670
+ while (_iterator__ex2g4s.u()) {
671
+ var element = _iterator__ex2g4s.v();
672
+ if (element instanceof Namespace) {
673
+ destination.x(element);
674
+ }
675
+ }
676
+ var tmp$ret$2 = firstOrNull_0(destination);
677
+ var namespace = ensureNotNull(tmp$ret$2);
678
+ var flattened = flattenNestedStructs(namespace);
679
+ // Inline function 'kotlin.collections.filter' call
680
+ var tmp0_0 = flattened.a1n_1;
681
+ // Inline function 'kotlin.collections.filterTo' call
682
+ var destination_0 = ArrayList_init_$Create$();
683
+ var _iterator__ex2g4s_0 = tmp0_0.t();
684
+ while (_iterator__ex2g4s_0.u()) {
685
+ var element_0 = _iterator__ex2g4s_0.v();
686
+ var tmp;
687
+ if (element_0 instanceof Struct) {
688
+ tmp = true;
689
+ } else {
690
+ tmp = element_0 instanceof Union;
691
+ }
692
+ if (tmp) {
693
+ destination_0.x(element_0);
694
+ }
695
+ }
696
+ // Inline function 'kotlin.collections.map' call
697
+ // Inline function 'kotlin.collections.mapTo' call
698
+ var destination_1 = ArrayList_init_$Create$_0(collectionSizeOrDefault(destination_0, 10));
699
+ var _iterator__ex2g4s_1 = destination_0.t();
700
+ while (_iterator__ex2g4s_1.u()) {
701
+ var item = _iterator__ex2g4s_1.v();
702
+ var tmp_0;
703
+ var tmp_1;
704
+ if (item instanceof Union) {
705
+ tmp_1 = item.d1q_1.x1l() === 'Response';
706
+ } else {
707
+ tmp_1 = false;
708
+ }
709
+ if (tmp_1) {
710
+ // Inline function 'kotlin.collections.filterIsInstance' call
711
+ var tmp0_1 = flattened.a1n_1;
712
+ // Inline function 'kotlin.collections.filterIsInstanceTo' call
713
+ var destination_2 = ArrayList_init_$Create$();
714
+ var _iterator__ex2g4s_2 = tmp0_1.t();
715
+ while (_iterator__ex2g4s_2.u()) {
716
+ var element_1 = _iterator__ex2g4s_2.v();
717
+ if (element_1 instanceof Struct) {
718
+ destination_2.x(element_1);
719
+ }
720
+ }
721
+ // Inline function 'kotlin.collections.map' call
722
+ // Inline function 'kotlin.collections.mapTo' call
723
+ var destination_3 = ArrayList_init_$Create$_0(collectionSizeOrDefault(destination_2, 10));
724
+ var _iterator__ex2g4s_3 = destination_2.t();
725
+ while (_iterator__ex2g4s_3.u()) {
726
+ var item_0 = _iterator__ex2g4s_3.v();
727
+ var tmp$ret$8 = item_0.f1n_1.x1l();
728
+ destination_3.x(tmp$ret$8);
729
+ }
730
+ // Inline function 'kotlin.collections.filter' call
731
+ // Inline function 'kotlin.collections.filterTo' call
732
+ var destination_4 = ArrayList_init_$Create$();
733
+ var _iterator__ex2g4s_4 = destination_3.t();
734
+ while (_iterator__ex2g4s_4.u()) {
735
+ var element_2 = _iterator__ex2g4s_4.v();
736
+ if (get_RESPONSE_PATTERN().nc(element_2)) {
737
+ destination_4.x(element_2);
738
+ }
739
+ }
740
+ // Inline function 'kotlin.collections.map' call
741
+ // Inline function 'kotlin.collections.mapTo' call
742
+ var destination_5 = ArrayList_init_$Create$_0(collectionSizeOrDefault(destination_4, 10));
743
+ var _iterator__ex2g4s_5 = destination_4.t();
744
+ while (_iterator__ex2g4s_5.u()) {
745
+ var item_1 = _iterator__ex2g4s_5.v();
746
+ var tmp$ret$14 = new Custom(item_1);
747
+ destination_5.x(tmp$ret$14);
748
+ }
749
+ var members = destination_5;
750
+ tmp_0 = item.i1q(VOID, VOID, members, emptyList());
751
+ } else {
752
+ if (item instanceof Union) {
753
+ tmp_0 = item.i1q(VOID, VOID, VOID, emptyList());
754
+ } else {
755
+ tmp_0 = item;
756
+ }
757
+ }
758
+ var tmp$ret$17 = tmp_0;
759
+ destination_1.x(tmp$ret$17);
760
+ }
761
+ var moduleElements = destination_1;
762
+ // Inline function 'kotlin.collections.filterNot' call
763
+ var tmp0_2 = flattened.a1n_1;
764
+ // Inline function 'kotlin.collections.filterNotTo' call
765
+ var destination_6 = ArrayList_init_$Create$();
766
+ var _iterator__ex2g4s_6 = tmp0_2.t();
767
+ while (_iterator__ex2g4s_6.u()) {
768
+ var element_3 = _iterator__ex2g4s_6.v();
769
+ var tmp_2;
770
+ if (element_3 instanceof Struct) {
771
+ tmp_2 = true;
772
+ } else {
773
+ tmp_2 = element_3 instanceof Union;
774
+ }
775
+ if (!tmp_2) {
776
+ destination_6.x(element_3);
777
+ }
778
+ }
779
+ var classElements = destination_6;
780
+ return new File(namespace.z1m_1, plus_0(moduleElements, new Namespace(namespace.z1m_1, classElements, namespace.b1n_1)));
781
+ }
782
+ function fixResponseSwitchPatterns($this) {
783
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
784
+ // Inline function 'kotlin.apply' call
785
+ var this_0 = new TransformerBuilder();
786
+ this_0.g1u(RustIrEmitter$fixResponseSwitchPatterns$lambda);
787
+ return this_0.e1h();
788
+ }
789
+ function fixConstructorCalls($this) {
790
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
791
+ // Inline function 'kotlin.apply' call
792
+ var this_0 = new TransformerBuilder();
793
+ this_0.i1u(RustIrEmitter$fixConstructorCalls$lambda);
794
+ return this_0.e1h();
795
+ }
796
+ function stripHandlerExtends($this, _this__u8e3s4) {
797
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
798
+ var scope = new TransformScope(_this__u8e3s4);
799
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
800
+ var tmp = scope;
801
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
802
+ var this_0 = scope.z1t_1;
803
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
804
+ // Inline function 'kotlin.apply' call
805
+ var this_1 = new TransformerBuilder();
806
+ this_1.d1h(RustIrEmitter$stripHandlerExtends$lambda);
807
+ var tmp$ret$2 = this_1.e1h();
808
+ tmp.z1t_1 = transform(this_0, tmp$ret$2);
809
+ var tmp_0 = scope.z1t_1;
810
+ return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
811
+ }
812
+ function stripResponseGenerics($this, _this__u8e3s4) {
813
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
814
+ var scope = new TransformScope(_this__u8e3s4);
815
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matching' call
816
+ var tmp = scope;
817
+ // Inline function 'community.flock.wirespec.ir.core.transformMatching' call
818
+ var this_0 = scope.z1t_1;
819
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
820
+ // Inline function 'kotlin.apply' call
821
+ var this_1 = new TransformerBuilder();
822
+ this_1.f1u(RustIrEmitter$stripResponseGenerics$lambda);
823
+ var tmp$ret$2 = this_1.e1h();
824
+ tmp.z1t_1 = transform(this_0, tmp$ret$2);
825
+ var tmp_0 = scope.z1t_1;
826
+ return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
827
+ }
828
+ function injectSelfToHandlerMethods($this, _this__u8e3s4) {
829
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
830
+ var scope = new TransformScope(_this__u8e3s4);
831
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
832
+ var tmp = scope;
833
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
834
+ var this_0 = scope.z1t_1;
835
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
836
+ // Inline function 'kotlin.apply' call
837
+ var this_1 = new TransformerBuilder();
838
+ this_1.d1h(RustIrEmitter$injectSelfToHandlerMethods$lambda);
839
+ var tmp$ret$2 = this_1.e1h();
840
+ tmp.z1t_1 = transform(this_0, tmp$ret$2);
841
+ var tmp_0 = scope.z1t_1;
842
+ return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
843
+ }
844
+ function injectHandlerImplForClient($this, _this__u8e3s4, endpoint) {
845
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
846
+ var scope = new TransformScope(_this__u8e3s4);
847
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
848
+ var tmp = scope;
849
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
850
+ var this_0 = scope.z1t_1;
851
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
852
+ // Inline function 'kotlin.apply' call
853
+ var this_1 = new TransformerBuilder();
854
+ this_1.d1h(RustIrEmitter$injectHandlerImplForClient$lambda);
855
+ var tmp$ret$2 = this_1.e1h();
856
+ tmp.z1t_1 = transform(this_0, tmp$ret$2);
857
+ var tmp_0 = scope.z1t_1;
858
+ return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
859
+ }
860
+ function injectResponseFromImpls($this, _this__u8e3s4) {
861
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
862
+ var scope = new TransformScope(_this__u8e3s4);
863
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
864
+ var tmp = scope;
865
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
866
+ var this_0 = scope.z1t_1;
867
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
868
+ // Inline function 'kotlin.apply' call
869
+ var this_1 = new TransformerBuilder();
870
+ this_1.d1h(RustIrEmitter$injectResponseFromImpls$lambda);
871
+ var tmp$ret$2 = this_1.e1h();
872
+ tmp.z1t_1 = transform(this_0, tmp$ret$2);
873
+ var tmp_0 = scope.z1t_1;
874
+ return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
875
+ }
876
+ function buildApiStruct($this, endpoint) {
877
+ return new RawElement(generateApiStruct($this, endpoint));
878
+ }
879
+ function generateApiStruct($this, _this__u8e3s4) {
880
+ // Inline function 'kotlin.let' call
881
+ var pathTemplate = '/' + joinToString(_this__u8e3s4.gp_1, '/', VOID, VOID, VOID, VOID, RustIrEmitter$generateApiStruct$lambda);
882
+ var methodName = _this__u8e3s4.fp_1.a3_1;
883
+ return trimIndent('\n pub struct Api;\n impl Server for Api {\n type Req = Request;\n type Res = Response;\n fn path_template(&self) -> &\'static str { "' + pathTemplate + '" }\n fn method(&self) -> Method { Method::' + methodName + ' }\n }\n ');
884
+ }
885
+ function Companion() {
886
+ Companion_instance_2 = this;
887
+ this.o1z_1 = setOf(['as', 'break', 'const', 'continue', 'crate', 'else', 'enum', 'extern', 'false', 'fn', 'for', 'if', 'impl', 'in', 'let', 'loop', 'match', 'mod', 'move', 'mut', 'pub', 'ref', 'return', 'self', 'Self', 'static', 'struct', 'super', 'trait', 'true', 'type', 'unsafe', 'use', 'where', 'while', 'async', 'await', 'dyn', 'abstract', 'become', 'box', 'do', 'final', 'macro', 'override', 'priv', 'typeof', 'unsized', 'virtual', 'yield', 'try']);
888
+ }
889
+ var Companion_instance_2;
890
+ function Companion_getInstance_0() {
891
+ if (Companion_instance_2 == null)
892
+ new Companion();
893
+ return Companion_instance_2;
894
+ }
895
+ function sam$kotlin_Comparator$0(function_0) {
896
+ this.p1z_1 = function_0;
897
+ }
898
+ protoOf(sam$kotlin_Comparator$0).qd = function (a, b) {
899
+ return this.p1z_1(a, b);
900
+ };
901
+ protoOf(sam$kotlin_Comparator$0).compare = function (a, b) {
902
+ return this.qd(a, b);
903
+ };
904
+ protoOf(sam$kotlin_Comparator$0).l3 = function () {
905
+ return this.p1z_1;
906
+ };
907
+ protoOf(sam$kotlin_Comparator$0).equals = function (other) {
908
+ var tmp;
909
+ if (!(other == null) ? isInterface(other, Comparator) : false) {
910
+ var tmp_0;
911
+ if (!(other == null) ? isInterface(other, FunctionAdapter) : false) {
912
+ tmp_0 = equals(this.l3(), other.l3());
913
+ } else {
914
+ tmp_0 = false;
915
+ }
916
+ tmp = tmp_0;
917
+ } else {
918
+ tmp = false;
919
+ }
920
+ return tmp;
921
+ };
922
+ protoOf(sam$kotlin_Comparator$0).hashCode = function () {
923
+ return hashCode(this.l3());
924
+ };
925
+ function RustIrEmitter$sanitizationConfig$delegate$lambda$lambda(it) {
926
+ return 'r#' + it;
927
+ }
928
+ function RustIrEmitter$sanitizationConfig$delegate$lambda$lambda_0(name) {
929
+ return Companion_getInstance().m1h((new Name(name.n1h_1)).y1l());
930
+ }
931
+ function RustIrEmitter$sanitizationConfig$delegate$lambda$lambda_1(name) {
932
+ var value = name.s1h();
933
+ switch (value) {
934
+ case 'self':
935
+ case '&self':
936
+ return name;
937
+ default:
938
+ return Companion_getInstance().m1h((new Name(name.n1h_1)).y1l());
939
+ }
940
+ }
941
+ function RustIrEmitter$sanitizationConfig$delegate$lambda$lambda_2(it) {
942
+ return it;
943
+ }
944
+ function RustIrEmitter$sanitizationConfig$delegate$lambda$lambda_3(this$0) {
945
+ return function (stmt, tr) {
946
+ var tmp;
947
+ if (stmt instanceof ConstructorStatement) {
948
+ var tmp_0 = tr.r1t(stmt.p1m_1);
949
+ // Inline function 'kotlin.collections.map' call
950
+ var this_0 = stmt.q1m_1;
951
+ // Inline function 'kotlin.collections.mapTo' call
952
+ var destination = ArrayList_init_$Create$_0(this_0.a1());
953
+ // Inline function 'kotlin.collections.iterator' call
954
+ var _iterator__ex2g4s = this_0.j1().t();
955
+ while (_iterator__ex2g4s.u()) {
956
+ var item = _iterator__ex2g4s.v();
957
+ // Inline function 'kotlin.collections.component1' call
958
+ var k = item.k1();
959
+ // Inline function 'kotlin.collections.component2' call
960
+ var v = item.l1();
961
+ var tmp$ret$3 = to(sanitizeFieldName(_get_sanitizationConfig__sns434(this$0), k), tr.u1t(v));
962
+ destination.x(tmp$ret$3);
963
+ }
964
+ tmp = new ConstructorStatement(tmp_0, toMap(destination));
965
+ } else {
966
+ tmp = transformChildren_0(stmt, tr);
967
+ }
968
+ return tmp;
969
+ };
970
+ }
971
+ function RustIrEmitter$sanitizationConfig$delegate$lambda(this$0) {
972
+ return function () {
973
+ var tmp0_reservedKeywords = minus(Companion_getInstance_0().o1z_1, setOf(['self', 'Self']));
974
+ var tmp = RustIrEmitter$sanitizationConfig$delegate$lambda$lambda;
975
+ var tmp_0 = RustIrEmitter$sanitizationConfig$delegate$lambda$lambda_0;
976
+ var tmp_1 = RustIrEmitter$sanitizationConfig$delegate$lambda$lambda_1;
977
+ var tmp_2 = RustIrEmitter$sanitizationConfig$delegate$lambda$lambda_2;
978
+ return new SanitizationConfig(tmp0_reservedKeywords, tmp, tmp_0, tmp_1, tmp_2, RustIrEmitter$sanitizationConfig$delegate$lambda$lambda_3(this$0), true);
979
+ };
980
+ }
981
+ function RustIrEmitter$_get_sanitizationConfig_$ref_17ypni() {
982
+ return function (p0) {
983
+ return _get_sanitizationConfig__sns434(p0);
984
+ };
985
+ }
986
+ function RustIrEmitter$shared$1() {
987
+ this.r1y_1 = 'shared';
988
+ this.s1y_1 = listOf_0([import_0('std::any', 'TypeId'), import_0('std::collections', 'HashMap')]);
989
+ var tmp = this;
990
+ tmp.t1y_1 = interface_0('RequestHeaders', VOID, RustIrEmitter$shared$o$requestHeaders$lambda);
991
+ var tmp_0 = this;
992
+ tmp_0.u1y_1 = interface_0('ResponseHeaders', VOID, RustIrEmitter$shared$o$responseHeaders$lambda);
993
+ this.v1y_1 = new RawElement('pub trait Client {\n type Transport: Transportation;\n type Ser: Serialization;\n fn transport(&self) -> &Self::Transport;\n fn serialization(&self) -> &Self::Ser;\n}');
994
+ this.w1y_1 = new RawElement("pub trait Server {\n type Req;\n type Res;\n fn path_template(&self) -> &'static str;\n fn method(&self) -> Method;\n}");
995
+ var tmp_1 = this;
996
+ tmp_1.x1y_1 = interface_0('Enum', VOID, RustIrEmitter$shared$o$enumTrait$lambda);
997
+ var tmp_2 = this;
998
+ tmp_2.y1y_1 = interface_0('Refined', VOID, RustIrEmitter$shared$o$refinedTrait$lambda);
999
+ var tmp_3 = this;
1000
+ tmp_3.z1y_1 = interface_0('Request', VOID, RustIrEmitter$shared$o$requestTrait$lambda);
1001
+ var tmp_4 = this;
1002
+ tmp_4.a1z_1 = interface_0('Response', VOID, RustIrEmitter$shared$o$responseTrait$lambda);
1003
+ this.b1z_1 = mapOf([to('BodySerializer', new RawElement("pub trait BodySerializer {\n fn serialize_body<T: 'static>(&self, t: &T, r#type: TypeId) -> Vec<u8>;\n}")), to('BodyDeserializer', new RawElement("pub trait BodyDeserializer {\n fn deserialize_body<T: 'static>(&self, raw: &[u8], r#type: TypeId) -> T;\n}")), to('PathSerializer', new RawElement('pub trait PathSerializer {\n fn serialize_path<T: std::fmt::Display>(&self, t: &T, r#type: TypeId) -> String;\n}')), to('PathDeserializer', new RawElement('pub trait PathDeserializer {\n fn deserialize_path<T: std::str::FromStr>(&self, raw: &str, r#type: TypeId) -> T where T::Err: std::fmt::Debug;\n}')), to('ParamSerializer', new RawElement("pub trait ParamSerializer {\n fn serialize_param<T: 'static>(&self, value: &T, r#type: TypeId) -> Vec<String>;\n}")), to('ParamDeserializer', new RawElement("pub trait ParamDeserializer {\n fn deserialize_param<T: 'static>(&self, values: &[String], r#type: TypeId) -> T;\n}"))]);
1004
+ var tmp_5 = this;
1005
+ tmp_5.c1z_1 = interface_0('Transportation', VOID, RustIrEmitter$shared$o$transportationTrait$lambda);
1006
+ this.d1z_1 = mapOf([to('Enum', this.x1y_1), to('Refined', this.y1y_1), to('Request', this.z1y_1), to('Response', this.a1z_1), to('Transportation', this.c1z_1)]);
1007
+ var tmp_6 = this;
1008
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
1009
+ var this_0 = convert(new Shared(this.r1y_1));
1010
+ var scope = new TransformScope(this_0);
1011
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
1012
+ var tmp_7 = scope;
1013
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1014
+ var this_1 = scope.z1t_1;
1015
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
1016
+ // Inline function 'kotlin.apply' call
1017
+ var this_2 = new TransformerBuilder();
1018
+ this_2.d1h(RustIrEmitter$shared$o$wirespecFile$lambda(this));
1019
+ var tmp$ret$2 = this_2.e1h();
1020
+ tmp_7.z1t_1 = transform(this_1, tmp$ret$2);
1021
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
1022
+ var tmp_8 = scope;
1023
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1024
+ var this_3 = scope.z1t_1;
1025
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
1026
+ // Inline function 'kotlin.apply' call
1027
+ var this_4 = new TransformerBuilder();
1028
+ this_4.d1h(RustIrEmitter$shared$o$wirespecFile$lambda_0);
1029
+ var tmp$ret$7 = this_4.e1h();
1030
+ tmp_8.z1t_1 = transform(this_3, tmp$ret$7);
1031
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
1032
+ var tmp_9 = scope;
1033
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1034
+ var this_5 = scope.z1t_1;
1035
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
1036
+ // Inline function 'kotlin.apply' call
1037
+ var this_6 = new TransformerBuilder();
1038
+ this_6.d1h(RustIrEmitter$shared$o$wirespecFile$lambda_1(this));
1039
+ var tmp$ret$12 = this_6.e1h();
1040
+ tmp_9.z1t_1 = transform(this_5, tmp$ret$12);
1041
+ var tmp_10 = scope.z1t_1;
1042
+ // Inline function 'kotlin.let' call
1043
+ var file = isInterface(tmp_10, Element) ? tmp_10 : THROW_CCE();
1044
+ // Inline function 'kotlin.collections.flatMap' call
1045
+ var tmp0 = file.u1m_1;
1046
+ // Inline function 'kotlin.collections.flatMapTo' call
1047
+ var destination = ArrayList_init_$Create$();
1048
+ var _iterator__ex2g4s = tmp0.t();
1049
+ while (_iterator__ex2g4s.u()) {
1050
+ var element = _iterator__ex2g4s.v();
1051
+ var tmp_11;
1052
+ if (element instanceof Struct) {
1053
+ var derive;
1054
+ switch (element.f1n_1.x1l()) {
1055
+ case 'RawRequest':
1056
+ case 'RawResponse':
1057
+ derive = '#[derive(Debug, Clone, PartialEq)]';
1058
+ break;
1059
+ default:
1060
+ derive = '#[derive(Debug, Clone, Default, PartialEq)]';
1061
+ break;
1062
+ }
1063
+ tmp_11 = listOf(new File(element.f1n_1, listOf_0([new RawElement(derive), element])));
1064
+ } else {
1065
+ tmp_11 = listOf(element);
1066
+ }
1067
+ var list = tmp_11;
1068
+ addAll(destination, list);
1069
+ }
1070
+ var tmp0_0 = new File(file.t1m_1, destination);
1071
+ // Inline function 'kotlin.let' call
1072
+ tmp_6.e1z_1 = RustTransform_getInstance().w1z(tmp0_0);
1073
+ var tmp_12 = this;
1074
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
1075
+ var this_7 = this.e1z_1;
1076
+ var scope_0 = new TransformScope(this_7);
1077
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
1078
+ var tmp_13 = scope_0;
1079
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1080
+ var this_8 = scope_0.z1t_1;
1081
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
1082
+ // Inline function 'kotlin.apply' call
1083
+ var this_9 = new TransformerBuilder();
1084
+ this_9.d1h(RustIrEmitter$shared$o$source$lambda);
1085
+ var tmp$ret$26 = this_9.e1h();
1086
+ tmp_13.z1t_1 = transform(this_8, tmp$ret$26);
1087
+ var tmp_14 = scope_0.z1t_1;
1088
+ // Inline function 'kotlin.let' call
1089
+ var file_0 = isInterface(tmp_14, Element) ? tmp_14 : THROW_CCE();
1090
+ // Inline function 'kotlin.collections.mutableListOf' call
1091
+ var groups = ArrayList_init_$Create$();
1092
+ // Inline function 'kotlin.collections.mutableListOf' call
1093
+ var current = ArrayList_init_$Create$();
1094
+ var _iterator__ex2g4s_0 = file_0.u1m_1.t();
1095
+ while (_iterator__ex2g4s_0.u()) {
1096
+ var element_0 = _iterator__ex2g4s_0.v();
1097
+ if (element_0 instanceof Import) {
1098
+ current.x(element_0);
1099
+ } else {
1100
+ // Inline function 'kotlin.collections.isNotEmpty' call
1101
+ if (!current.r()) {
1102
+ groups.x(current);
1103
+ // Inline function 'kotlin.collections.mutableListOf' call
1104
+ current = ArrayList_init_$Create$();
1105
+ }
1106
+ groups.x(listOf(element_0));
1107
+ }
1108
+ }
1109
+ // Inline function 'kotlin.collections.isNotEmpty' call
1110
+ if (!current.r()) {
1111
+ groups.x(current);
1112
+ }
1113
+ tmp_12.f1z_1 = joinToString(groups, '\n\n', VOID, VOID, VOID, VOID, RustIrEmitter$shared$o$source$lambda_0) + '\n';
1114
+ }
1115
+ protoOf(RustIrEmitter$shared$1).r1w = function () {
1116
+ return this.f1z_1;
1117
+ };
1118
+ function RustIrEmitter$emit$lambda(this$0) {
1119
+ return function (a, b) {
1120
+ // Inline function 'kotlin.comparisons.compareValuesBy' call
1121
+ var this_0 = this$0;
1122
+ var tmp = sort(this_0, a);
1123
+ var this_1 = this$0;
1124
+ var tmp$ret$1 = sort(this_1, b);
1125
+ return compareValues(tmp, tmp$ret$1);
1126
+ };
1127
+ }
1128
+ function emit$emitMod(this$0, def) {
1129
+ return 'pub mod ' + sanitize(this$0, def.vq()) + ';';
1130
+ }
1131
+ function RustIrEmitter$emit$lambda_0(this$0) {
1132
+ return function (it) {
1133
+ return emit$emitMod(this$0, it);
1134
+ };
1135
+ }
1136
+ function RustIrEmitter$emit$lambda_1(this$0) {
1137
+ return function (it) {
1138
+ return emit$emitMod(this$0, it);
1139
+ };
1140
+ }
1141
+ function RustIrEmitter$emit$lambda_2(this$0) {
1142
+ return function (element, transformer) {
1143
+ var tmp;
1144
+ if (element instanceof Enum) {
1145
+ // Inline function 'kotlin.collections.map' call
1146
+ var this_0 = element.f1o_1;
1147
+ // Inline function 'kotlin.collections.mapTo' call
1148
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
1149
+ var _iterator__ex2g4s = this_0.t();
1150
+ while (_iterator__ex2g4s.u()) {
1151
+ var item = _iterator__ex2g4s.v();
1152
+ var tmp$ret$0 = item.c1o(Companion_getInstance().m1h(sanitizeKeywords(this$0, sanitizeEnum(this$0, item.z1n_1.s1h()))));
1153
+ destination.x(tmp$ret$0);
1154
+ }
1155
+ tmp = element.k1o(VOID, VOID, destination);
1156
+ } else {
1157
+ tmp = element;
1158
+ }
1159
+ var transformed = tmp;
1160
+ return transformChildren(transformed, transformer);
1161
+ };
1162
+ }
1163
+ function RustIrEmitter$emit$lambda_3(this$0, $refined) {
1164
+ return function (element, transformer) {
1165
+ var tmp;
1166
+ if (element instanceof Struct) {
1167
+ tmp = element.l1n(VOID, VOID, VOID, VOID, listOf_0([buildValidateFunction(this$0, $refined), buildToStringFunction(this$0, $refined)]));
1168
+ } else {
1169
+ tmp = element;
1170
+ }
1171
+ var transformed = tmp;
1172
+ return transformChildren(transformed, transformer);
1173
+ };
1174
+ }
1175
+ function RustIrEmitter$emit$lambda_4($identifierPattern) {
1176
+ return function (s, t) {
1177
+ var tmp;
1178
+ var tmp_0;
1179
+ var tmp_1;
1180
+ if (s instanceof RawExpression) {
1181
+ tmp_1 = $identifierPattern.nc(s.c1p_1);
1182
+ } else {
1183
+ tmp_1 = false;
1184
+ }
1185
+ if (tmp_1) {
1186
+ tmp_0 = !contains(s.c1p_1, '.');
1187
+ } else {
1188
+ tmp_0 = false;
1189
+ }
1190
+ if (tmp_0) {
1191
+ tmp = new VariableReference(Companion_getInstance().m1h(s.c1p_1));
1192
+ } else {
1193
+ tmp = transformChildren_0(s, t);
1194
+ }
1195
+ return tmp;
1196
+ };
1197
+ }
1198
+ function RustIrEmitter$emit$lambda_5(this$0, $endpoint) {
1199
+ return function (element, transformer) {
1200
+ var tmp;
1201
+ if (element instanceof Namespace) {
1202
+ tmp = element.d1n(VOID, plus(element.a1n_1, listOf(buildApiStruct(this$0, $endpoint))));
1203
+ } else {
1204
+ tmp = element;
1205
+ }
1206
+ var transformed = tmp;
1207
+ return transformChildren(transformed, transformer);
1208
+ };
1209
+ }
1210
+ function RustIrEmitter$emitClient$lambda(this$0) {
1211
+ return function (endpoint) {
1212
+ return 'pub mod ' + toSnakeCase(this$0, endpoint.ep_1.l1() + 'Client') + ';';
1213
+ };
1214
+ }
1215
+ function RustIrEmitter$toPascalCase$lambda(s) {
1216
+ // Inline function 'kotlin.text.replaceFirstChar' call
1217
+ var tmp;
1218
+ // Inline function 'kotlin.text.isNotEmpty' call
1219
+ if (charSequenceLength(s) > 0) {
1220
+ var it = charCodeAt(s, 0);
1221
+ var tmp0 = uppercaseChar(it);
1222
+ // Inline function 'kotlin.text.plus' call
1223
+ var other = substring(s, 1);
1224
+ tmp = toString(tmp0) + other;
1225
+ } else {
1226
+ tmp = s;
1227
+ }
1228
+ return tmp;
1229
+ }
1230
+ function RustIrEmitter$injectSelfReceiver$lambda$lambda($fieldNames) {
1231
+ return function (s, t) {
1232
+ var tmp;
1233
+ var tmp_0;
1234
+ var tmp_1;
1235
+ if (s instanceof FieldCall) {
1236
+ tmp_1 = s.i1p_1 == null;
1237
+ } else {
1238
+ tmp_1 = false;
1239
+ }
1240
+ if (tmp_1) {
1241
+ tmp_0 = $fieldNames.u1(s.j1p_1.r1l());
1242
+ } else {
1243
+ tmp_0 = false;
1244
+ }
1245
+ if (tmp_0) {
1246
+ tmp = new FieldCall(new VariableReference(Companion_getInstance().m1h('self')), s.j1p_1);
1247
+ } else {
1248
+ tmp = transformChildren_0(s, t);
1249
+ }
1250
+ return tmp;
1251
+ };
1252
+ }
1253
+ function RustIrEmitter$injectSelfReceiver$lambda($fieldNames) {
1254
+ return function (element, transformer) {
1255
+ var tmp;
1256
+ if (element instanceof Function) {
1257
+ var tmp_0;
1258
+ if (element.t1j_1.equals(Companion_getInstance().m1h('validate'))) {
1259
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
1260
+ var this_0 = element.b1k(VOID, VOID, listOf(get_selfParam()));
1261
+ var scope = new TransformScope(this_0);
1262
+ scope.i1u(RustIrEmitter$injectSelfReceiver$lambda$lambda($fieldNames));
1263
+ var tmp_1 = scope.z1t_1;
1264
+ tmp_0 = isInterface(tmp_1, Element) ? tmp_1 : THROW_CCE();
1265
+ } else {
1266
+ tmp_0 = element;
1267
+ }
1268
+ tmp = tmp_0;
1269
+ } else {
1270
+ tmp = element;
1271
+ }
1272
+ var transformed = tmp;
1273
+ return transformChildren(transformed, transformer);
1274
+ };
1275
+ }
1276
+ function RustIrEmitter$stripWirespecPrefix$lambda(type, transformer) {
1277
+ var tmp;
1278
+ if (type instanceof Custom) {
1279
+ tmp = startsWith(type.q1h_1, 'Wirespec.') ? type.n1m(removePrefix(type.q1h_1, 'Wirespec.')) : type;
1280
+ } else {
1281
+ tmp = type;
1282
+ }
1283
+ var transformed = tmp;
1284
+ return transformChildren_1(transformed, transformer);
1285
+ }
1286
+ function RustIrEmitter$buildValidateFunction$lambda($constraintExpr) {
1287
+ return function ($this$function) {
1288
+ $this$function.l1i('&self', new Custom(''));
1289
+ $this$function.k1i(Boolean_instance);
1290
+ $this$function.j1k($constraintExpr);
1291
+ return Unit_instance_0;
1292
+ };
1293
+ }
1294
+ function RustIrEmitter$buildToStringFunction$lambda($expr) {
1295
+ return function ($this$function) {
1296
+ $this$function.l1i('&self', new Custom(''));
1297
+ $this$function.k1i(String_instance);
1298
+ $this$function.j1k(new RawExpression($expr));
1299
+ return Unit_instance_0;
1300
+ };
1301
+ }
1302
+ function RustIrEmitter$buildClientParams$lambda(this$0) {
1303
+ return function (_destruct__k2r9zo) {
1304
+ var name = _destruct__k2r9zo.ne();
1305
+ var type = _destruct__k2r9zo.oe();
1306
+ var tmp = sanitizeKeywords(this$0, name.y1l());
1307
+ // Inline function 'kotlin.with' call
1308
+ return tmp + ': ' + RustTransform_getInstance().x1z(type);
1309
+ };
1310
+ }
1311
+ function RustIrEmitter$buildClientParams$lambda_0(this$0) {
1312
+ return function (_destruct__k2r9zo) {
1313
+ var name = _destruct__k2r9zo.ne();
1314
+ return sanitizeKeywords(this$0, name.y1l());
1315
+ };
1316
+ }
1317
+ function RustIrEmitter$fixResponseSwitchPatterns$lambda(s, t) {
1318
+ var tmp;
1319
+ var tmp_0;
1320
+ if (s instanceof Switch) {
1321
+ var tmp0_safe_receiver = s.p1p_1;
1322
+ tmp_0 = (tmp0_safe_receiver == null ? null : tmp0_safe_receiver.r1l()) === 'r';
1323
+ } else {
1324
+ tmp_0 = false;
1325
+ }
1326
+ if (tmp_0) {
1327
+ // Inline function 'kotlin.collections.map' call
1328
+ var this_0 = s.n1p_1;
1329
+ // Inline function 'kotlin.collections.mapTo' call
1330
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
1331
+ var _iterator__ex2g4s = this_0.t();
1332
+ while (_iterator__ex2g4s.u()) {
1333
+ var item = _iterator__ex2g4s.v();
1334
+ var tmp_1 = item.a1q_1;
1335
+ var tmp0_safe_receiver_0 = tmp_1 instanceof Custom ? tmp_1 : null;
1336
+ var typeName = tmp0_safe_receiver_0 == null ? null : tmp0_safe_receiver_0.q1h_1;
1337
+ var tmp_2;
1338
+ if (!(typeName == null) && get_RESPONSE_PATTERN().nc(typeName)) {
1339
+ var tmp_3 = new RawExpression('Response::' + typeName + '(' + ensureNotNull(s.p1p_1).y1l() + ')');
1340
+ // Inline function 'kotlin.collections.map' call
1341
+ var this_1 = item.z1p_1;
1342
+ // Inline function 'kotlin.collections.mapTo' call
1343
+ var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_1, 10));
1344
+ var _iterator__ex2g4s_0 = this_1.t();
1345
+ while (_iterator__ex2g4s_0.u()) {
1346
+ var item_0 = _iterator__ex2g4s_0.v();
1347
+ var tmp$ret$0 = t.t1t(item_0);
1348
+ destination_0.x(tmp$ret$0);
1349
+ }
1350
+ tmp_2 = new Case(tmp_3, destination_0, null);
1351
+ } else {
1352
+ var tmp_4 = t.u1t(item.y1p_1);
1353
+ // Inline function 'kotlin.collections.map' call
1354
+ var this_2 = item.z1p_1;
1355
+ // Inline function 'kotlin.collections.mapTo' call
1356
+ var destination_1 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_2, 10));
1357
+ var _iterator__ex2g4s_1 = this_2.t();
1358
+ while (_iterator__ex2g4s_1.u()) {
1359
+ var item_1 = _iterator__ex2g4s_1.v();
1360
+ var tmp$ret$3 = t.t1t(item_1);
1361
+ destination_1.x(tmp$ret$3);
1362
+ }
1363
+ var tmp_5 = destination_1;
1364
+ var tmp1_safe_receiver = item.a1q_1;
1365
+ var tmp_6;
1366
+ if (tmp1_safe_receiver == null) {
1367
+ tmp_6 = null;
1368
+ } else {
1369
+ // Inline function 'kotlin.let' call
1370
+ tmp_6 = t.r1t(tmp1_safe_receiver);
1371
+ }
1372
+ tmp_2 = new Case(tmp_4, tmp_5, tmp_6);
1373
+ }
1374
+ var tmp$ret$8 = tmp_2;
1375
+ destination.x(tmp$ret$8);
1376
+ }
1377
+ var transformedCases = destination;
1378
+ tmp = s.r1p(t.u1t(s.m1p_1), transformedCases, null);
1379
+ } else {
1380
+ tmp = transformChildren_0(s, t);
1381
+ }
1382
+ return tmp;
1383
+ }
1384
+ function RustIrEmitter$fixConstructorCalls$lambda(s, t) {
1385
+ var tmp;
1386
+ if (s instanceof ConstructorStatement) {
1387
+ var tmp_0 = s.p1m_1;
1388
+ var tmp0_safe_receiver = tmp_0 instanceof Custom ? tmp_0 : null;
1389
+ var typeName = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.q1h_1;
1390
+ // Inline function 'kotlin.collections.mapValues' call
1391
+ var this_0 = s.q1m_1;
1392
+ // Inline function 'kotlin.collections.mapValuesTo' call
1393
+ var destination = LinkedHashMap_init_$Create$(mapCapacity(this_0.a1()));
1394
+ // Inline function 'kotlin.collections.associateByTo' call
1395
+ var _iterator__ex2g4s = this_0.j1().t();
1396
+ while (_iterator__ex2g4s.u()) {
1397
+ var element = _iterator__ex2g4s.v();
1398
+ var tmp_1 = element.k1();
1399
+ var tmp$ret$1 = t.u1t(element.l1());
1400
+ destination.w2(tmp_1, tmp$ret$1);
1401
+ }
1402
+ var transformedArgs = destination;
1403
+ var tmp_2;
1404
+ if (!(typeName == null) && get_RESPONSE_PATTERN().nc(typeName)) {
1405
+ tmp_2 = new FunctionCall(VOID, VOID, new Name(listOf('Response::' + typeName)), mapOf_0(to(Companion_getInstance().m1h('inner'), new FunctionCall(VOID, VOID, new Name(listOf(typeName + '::new')), transformedArgs))));
1406
+ } else if (typeName === 'Request') {
1407
+ tmp_2 = new FunctionCall(VOID, VOID, new Name(listOf('Request::new')), transformedArgs);
1408
+ } else {
1409
+ tmp_2 = transformChildren_0(s, t);
1410
+ }
1411
+ tmp = tmp_2;
1412
+ } else {
1413
+ tmp = transformChildren_0(s, t);
1414
+ }
1415
+ return tmp;
1416
+ }
1417
+ function RustIrEmitter$stripHandlerExtends$lambda(element, transformer) {
1418
+ var tmp;
1419
+ if (element instanceof Interface) {
1420
+ tmp = element.m1o_1.equals(Companion_getInstance().m1h('Handler')) || element.m1o_1.equals(Companion_getInstance().m1h('Call')) ? element.t1o(VOID, VOID, emptyList()) : element;
1421
+ } else {
1422
+ tmp = element;
1423
+ }
1424
+ var transformed = tmp;
1425
+ return transformChildren(transformed, transformer);
1426
+ }
1427
+ function RustIrEmitter$stripResponseGenerics$lambda(type, transformer) {
1428
+ var tmp;
1429
+ if (type instanceof Custom) {
1430
+ var tmp_0;
1431
+ var tmp_1;
1432
+ if (startsWith(type.q1h_1, 'Response')) {
1433
+ // Inline function 'kotlin.collections.isNotEmpty' call
1434
+ tmp_1 = !type.r1h_1.r();
1435
+ } else {
1436
+ tmp_1 = false;
1437
+ }
1438
+ if (tmp_1) {
1439
+ tmp_0 = type.n1m(VOID, emptyList());
1440
+ } else {
1441
+ tmp_0 = type;
1442
+ }
1443
+ tmp = tmp_0;
1444
+ } else {
1445
+ tmp = type;
1446
+ }
1447
+ var transformed = tmp;
1448
+ return transformChildren_1(transformed, transformer);
1449
+ }
1450
+ function RustIrEmitter$injectSelfToHandlerMethods$lambda(element, transformer) {
1451
+ var tmp;
1452
+ if (element instanceof Interface) {
1453
+ var tmp_0;
1454
+ if (element.m1o_1.equals(Companion_getInstance().m1h('Handler')) || element.m1o_1.equals(Companion_getInstance().m1h('Call'))) {
1455
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
1456
+ var scope = new TransformScope(element);
1457
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
1458
+ var tmp_1 = scope;
1459
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1460
+ var this_0 = scope.z1t_1;
1461
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
1462
+ // Inline function 'kotlin.apply' call
1463
+ var this_1 = new TransformerBuilder();
1464
+ this_1.d1h(RustIrEmitter$injectSelfToHandlerMethods$lambda$lambda);
1465
+ var tmp$ret$2 = this_1.e1h();
1466
+ tmp_1.z1t_1 = transform(this_0, tmp$ret$2);
1467
+ var tmp_2 = scope.z1t_1;
1468
+ tmp_0 = isInterface(tmp_2, Element) ? tmp_2 : THROW_CCE();
1469
+ } else {
1470
+ tmp_0 = element;
1471
+ }
1472
+ tmp = tmp_0;
1473
+ } else {
1474
+ tmp = element;
1475
+ }
1476
+ var transformed = tmp;
1477
+ return transformChildren(transformed, transformer);
1478
+ }
1479
+ function RustIrEmitter$injectSelfToHandlerMethods$lambda$lambda(element, transformer) {
1480
+ var tmp;
1481
+ if (element instanceof Function) {
1482
+ tmp = element.b1k(Companion_getInstance().m1h(element.t1j_1.y1l()), VOID, plus(listOf(get_selfParam()), element.v1j_1));
1483
+ } else {
1484
+ tmp = element;
1485
+ }
1486
+ var transformed = tmp;
1487
+ return transformChildren(transformed, transformer);
1488
+ }
1489
+ function RustIrEmitter$injectHandlerImplForClient$lambda(element, transformer) {
1490
+ var tmp;
1491
+ if (element instanceof Namespace) {
1492
+ // Inline function 'kotlin.collections.filterIsInstance' call
1493
+ var tmp0 = element.a1n_1;
1494
+ // Inline function 'kotlin.collections.filterIsInstanceTo' call
1495
+ var destination = ArrayList_init_$Create$();
1496
+ var _iterator__ex2g4s = tmp0.t();
1497
+ while (_iterator__ex2g4s.u()) {
1498
+ var element_0 = _iterator__ex2g4s.v();
1499
+ if (element_0 instanceof Interface) {
1500
+ destination.x(element_0);
1501
+ }
1502
+ }
1503
+ var tmp$ret$3;
1504
+ $l$block: {
1505
+ // Inline function 'kotlin.collections.firstOrNull' call
1506
+ var _iterator__ex2g4s_0 = destination.t();
1507
+ while (_iterator__ex2g4s_0.u()) {
1508
+ var element_1 = _iterator__ex2g4s_0.v();
1509
+ if (element_1.m1o_1.equals(Companion_getInstance().m1h('Handler'))) {
1510
+ tmp$ret$3 = element_1;
1511
+ break $l$block;
1512
+ }
1513
+ }
1514
+ tmp$ret$3 = null;
1515
+ }
1516
+ var handler = tmp$ret$3;
1517
+ var tmp_0;
1518
+ if (!(handler == null)) {
1519
+ // Inline function 'kotlin.collections.filterIsInstance' call
1520
+ var tmp0_0 = handler.n1o_1;
1521
+ // Inline function 'kotlin.collections.filterIsInstanceTo' call
1522
+ var destination_0 = ArrayList_init_$Create$();
1523
+ var _iterator__ex2g4s_1 = tmp0_0.t();
1524
+ while (_iterator__ex2g4s_1.u()) {
1525
+ var element_2 = _iterator__ex2g4s_1.v();
1526
+ if (element_2 instanceof Function) {
1527
+ destination_0.x(element_2);
1528
+ }
1529
+ }
1530
+ var method = firstOrNull_0(destination_0);
1531
+ var tmp_1;
1532
+ if (!(method == null)) {
1533
+ var methodName = method.t1j_1.y1l();
1534
+ tmp_1 = element.d1n(VOID, plus(element.a1n_1, listOf(new RawElement(trimIndent('\n impl<C: Client> Handler for C {\n async fn ' + methodName + '(&self, request: Request) -> Response {\n let raw = to_raw_request(self.serialization(), request);\n let resp = self.transport().transport(&raw).await;\n from_raw_response(self.serialization(), resp)\n }\n }\n ')))));
1535
+ } else {
1536
+ tmp_1 = element;
1537
+ }
1538
+ tmp_0 = tmp_1;
1539
+ } else {
1540
+ tmp_0 = element;
1541
+ }
1542
+ tmp = tmp_0;
1543
+ } else {
1544
+ tmp = element;
1545
+ }
1546
+ var transformed = tmp;
1547
+ return transformChildren(transformed, transformer);
1548
+ }
1549
+ function RustIrEmitter$injectResponseFromImpls$lambda(element, transformer) {
1550
+ var tmp;
1551
+ if (element instanceof File) {
1552
+ // Inline function 'kotlin.collections.flatMap' call
1553
+ var tmp0 = element.u1m_1;
1554
+ // Inline function 'kotlin.collections.flatMapTo' call
1555
+ var destination = ArrayList_init_$Create$();
1556
+ var _iterator__ex2g4s = tmp0.t();
1557
+ while (_iterator__ex2g4s.u()) {
1558
+ var element_0 = _iterator__ex2g4s.v();
1559
+ var tmp_0;
1560
+ var tmp_1;
1561
+ var tmp_2;
1562
+ if (element_0 instanceof Union) {
1563
+ tmp_2 = element_0.d1q_1.x1l() === 'Response';
1564
+ } else {
1565
+ tmp_2 = false;
1566
+ }
1567
+ if (tmp_2) {
1568
+ // Inline function 'kotlin.collections.isNotEmpty' call
1569
+ tmp_1 = !element_0.f1q_1.r();
1570
+ } else {
1571
+ tmp_1 = false;
1572
+ }
1573
+ if (tmp_1) {
1574
+ var tmp_3 = listOf(element_0);
1575
+ // Inline function 'kotlin.collections.map' call
1576
+ var this_0 = element_0.f1q_1;
1577
+ // Inline function 'kotlin.collections.mapTo' call
1578
+ var destination_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
1579
+ var _iterator__ex2g4s_0 = this_0.t();
1580
+ while (_iterator__ex2g4s_0.u()) {
1581
+ var item = _iterator__ex2g4s_0.v();
1582
+ var tmp$ret$1 = new RawElement('impl From<' + item.q1h_1 + '> for Response { fn from(value: ' + item.q1h_1 + ') -> Self { Response::' + item.q1h_1 + '(value) } }\n');
1583
+ destination_0.x(tmp$ret$1);
1584
+ }
1585
+ tmp_0 = plus(tmp_3, destination_0);
1586
+ } else {
1587
+ tmp_0 = listOf(element_0);
1588
+ }
1589
+ var list = tmp_0;
1590
+ addAll(destination, list);
1591
+ }
1592
+ tmp = element.x1m(VOID, destination);
1593
+ } else {
1594
+ tmp = element;
1595
+ }
1596
+ var transformed = tmp;
1597
+ return transformChildren(transformed, transformer);
1598
+ }
1599
+ function RustIrEmitter$generateApiStruct$lambda(segment) {
1600
+ var tmp;
1601
+ if (segment instanceof Literal_0) {
1602
+ tmp = segment.hq_1;
1603
+ } else {
1604
+ if (segment instanceof Param) {
1605
+ tmp = '{' + segment.lp_1.l1() + '}';
1606
+ } else {
1607
+ noWhenBranchMatchedException();
1608
+ }
1609
+ }
1610
+ return tmp;
1611
+ }
1612
+ function RustIrEmitter(packageName, emitShared) {
1613
+ Companion_getInstance_0();
1614
+ packageName = packageName === VOID ? Companion_instance_0.lr('community.flock.wirespec.generated') : packageName;
1615
+ emitShared = emitShared === VOID ? Companion_instance_1.go() : emitShared;
1616
+ this.g1z_1 = packageName;
1617
+ this.h1z_1 = emitShared;
1618
+ this.i1z_1 = RustGenerator_instance;
1619
+ this.j1z_1 = FileExtension_Rust_getInstance();
1620
+ var tmp = this;
1621
+ tmp.k1z_1 = lazy(RustIrEmitter$sanitizationConfig$delegate$lambda(this));
1622
+ this.l1z_1 = listOf_0([import_0('super::super::wirespec', '*'), import_0('', 'regex')]);
1623
+ this.m1z_1 = listOf_0([import_0('super::super::wirespec', '*'), import_0('', 'regex')]);
1624
+ var tmp_0 = this;
1625
+ tmp_0.n1z_1 = new RustIrEmitter$shared$1();
1626
+ }
1627
+ protoOf(RustIrEmitter).m1u = function () {
1628
+ return this.i1z_1;
1629
+ };
1630
+ protoOf(RustIrEmitter).eq = function () {
1631
+ return this.j1z_1;
1632
+ };
1633
+ protoOf(RustIrEmitter).t1v = function () {
1634
+ return this.n1z_1;
1635
+ };
1636
+ protoOf(RustIrEmitter).n1u = function (module_0, logger) {
1637
+ // Inline function 'kotlin.collections.sortedBy' call
1638
+ var this_0 = new NonEmptyList(module_0.dq_1);
1639
+ // Inline function 'kotlin.comparisons.compareBy' call
1640
+ var tmp = RustIrEmitter$emit$lambda(this);
1641
+ var tmp$ret$0 = new sam$kotlin_Comparator$0(tmp);
1642
+ var tmp$ret$1 = sortedWith(this_0, tmp$ret$0);
1643
+ var tmp_0 = toNonEmptyListOrNull(tmp$ret$1);
1644
+ var statements = ensureNotNull(tmp_0 == null ? null : new NonEmptyList(tmp_0)).yl_1;
1645
+ // Inline function 'kotlin.let' call
1646
+ var files = emit.call(this, module_0.wu(VOID, statements), logger);
1647
+ // Inline function 'kotlin.collections.filterIsInstance' call
1648
+ var tmp0 = new NonEmptyList(module_0.dq_1);
1649
+ // Inline function 'kotlin.collections.filterIsInstanceTo' call
1650
+ var destination = ArrayList_init_$Create$();
1651
+ var _iterator__ex2g4s = tmp0.t();
1652
+ while (_iterator__ex2g4s.u()) {
1653
+ var element = _iterator__ex2g4s.v();
1654
+ if (element instanceof Endpoint) {
1655
+ destination.x(element);
1656
+ }
1657
+ }
1658
+ var endpoints = destination;
1659
+ var endpointMods = joinToString(endpoints, '\n', VOID, VOID, VOID, VOID, RustIrEmitter$emit$lambda_0(this));
1660
+ var tmp_1;
1661
+ // Inline function 'kotlin.collections.isNotEmpty' call
1662
+ if (!endpoints.r()) {
1663
+ tmp_1 = '\npub mod client;';
1664
+ } else {
1665
+ tmp_1 = '';
1666
+ }
1667
+ var clientMod = tmp_1;
1668
+ var modRs = new File(Companion_getInstance().m1h(this.g1z_1.or() + 'mod'), listOf(new RawElement('#![allow(warnings)]\npub mod model;\npub mod endpoint;' + clientMod + '\npub mod wirespec;')));
1669
+ var modEndpoint = new File(Companion_getInstance().m1h(this.g1z_1.or() + 'endpoint/' + 'mod'), listOf(new RawElement(endpointMods)));
1670
+ var tmp_2 = Companion_getInstance().m1h(this.g1z_1.or() + 'model/' + 'mod');
1671
+ // Inline function 'kotlin.collections.filterIsInstance' call
1672
+ var tmp0_0 = new NonEmptyList(module_0.dq_1);
1673
+ // Inline function 'kotlin.collections.filterIsInstanceTo' call
1674
+ var destination_0 = ArrayList_init_$Create$();
1675
+ var _iterator__ex2g4s_0 = tmp0_0.t();
1676
+ while (_iterator__ex2g4s_0.u()) {
1677
+ var element_0 = _iterator__ex2g4s_0.v();
1678
+ if (!(element_0 == null) ? isInterface(element_0, Model) : false) {
1679
+ destination_0.x(element_0);
1680
+ }
1681
+ }
1682
+ var tmp_3 = destination_0;
1683
+ var modModel = new File(tmp_2, listOf(new RawElement(joinToString(tmp_3, '\n', VOID, VOID, VOID, VOID, RustIrEmitter$emit$lambda_1(this)))));
1684
+ var shared = new File(Companion_getInstance().m1h(this.g1z_1.or() + 'wirespec'), listOf(new RawElement(this.t1v().r1w())));
1685
+ return this.h1z_1.ho_1 ? NonEmptyList__plus_impl_xqmb9(NonEmptyList__plus_impl_xqmb9(NonEmptyList__plus_impl_xqmb9(NonEmptyList__plus_impl_xqmb9(files, modRs), modEndpoint), modModel), shared) : NonEmptyList__plus_impl_xqmb9(files, modRs);
1686
+ };
1687
+ protoOf(RustIrEmitter).uq = function (definition, module_0, logger) {
1688
+ var subPackageName = plus_1(this.g1z_1, definition);
1689
+ var tmp;
1690
+ if (definition instanceof Endpoint) {
1691
+ tmp = this.m1z_1;
1692
+ } else {
1693
+ tmp = this.l1z_1;
1694
+ }
1695
+ var importHeader = tmp;
1696
+ var tmp0 = emit_0.call(this, definition, module_0, logger);
1697
+ // Inline function 'kotlin.let' call
1698
+ var file = RustTransform_getInstance().w1z(tmp0);
1699
+ var tmp_0 = Companion_getInstance().m1h(subPackageName.or() + toSnakeCase(this, file.t1m_1.x1l()));
1700
+ // Inline function 'kotlin.collections.flatMap' call
1701
+ var tmp0_0 = file.u1m_1;
1702
+ // Inline function 'kotlin.collections.flatMapTo' call
1703
+ var destination = ArrayList_init_$Create$();
1704
+ var _iterator__ex2g4s = tmp0_0.t();
1705
+ while (_iterator__ex2g4s.u()) {
1706
+ var element = _iterator__ex2g4s.v();
1707
+ var tmp_1;
1708
+ if (element instanceof Struct) {
1709
+ tmp_1 = listOf_0([new RawElement('#[derive(Debug, Clone, Default, PartialEq)]'), element]);
1710
+ } else {
1711
+ tmp_1 = listOf(element);
1712
+ }
1713
+ var list = tmp_1;
1714
+ addAll(destination, list);
1715
+ }
1716
+ return new File(tmp_0, plus(importHeader, destination));
1717
+ };
1718
+ protoOf(RustIrEmitter).up = function (type, module_0) {
1719
+ var tmp = convertWithValidation(type, module_0);
1720
+ // Inline function 'kotlin.collections.map' call
1721
+ var this_0 = type.wo_1.so_1;
1722
+ // Inline function 'kotlin.collections.mapTo' call
1723
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
1724
+ var _iterator__ex2g4s = this_0.t();
1725
+ while (_iterator__ex2g4s.u()) {
1726
+ var item = _iterator__ex2g4s.v();
1727
+ var tmp$ret$0 = item.ap_1.l1();
1728
+ destination.x(tmp$ret$0);
1729
+ }
1730
+ return prependImports(this, sanitizeNames(injectSelfReceiver(this, tmp, toSet(destination)), _get_sanitizationConfig__sns434(this)), buildModelImports(this, type));
1731
+ };
1732
+ protoOf(RustIrEmitter).ir = function (enum_0, module_0) {
1733
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
1734
+ var this_0 = convert_0(enum_0);
1735
+ var scope = new TransformScope(this_0);
1736
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
1737
+ var tmp = scope;
1738
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1739
+ var this_1 = scope.z1t_1;
1740
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
1741
+ // Inline function 'kotlin.apply' call
1742
+ var this_2 = new TransformerBuilder();
1743
+ this_2.d1h(RustIrEmitter$emit$lambda_2(this));
1744
+ var tmp$ret$2 = this_2.e1h();
1745
+ tmp.z1t_1 = transform(this_1, tmp$ret$2);
1746
+ var tmp_0 = scope.z1t_1;
1747
+ return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
1748
+ };
1749
+ protoOf(RustIrEmitter).yq = function (union) {
1750
+ return convert_1(union);
1751
+ };
1752
+ protoOf(RustIrEmitter).dr = function (refined) {
1753
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
1754
+ var this_0 = convert_2(refined);
1755
+ var scope = new TransformScope(this_0);
1756
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
1757
+ var tmp = scope;
1758
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1759
+ var this_1 = scope.z1t_1;
1760
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
1761
+ // Inline function 'kotlin.apply' call
1762
+ var this_2 = new TransformerBuilder();
1763
+ this_2.d1h(RustIrEmitter$emit$lambda_3(this, refined));
1764
+ var tmp$ret$2 = this_2.e1h();
1765
+ tmp.z1t_1 = transform(this_1, tmp$ret$2);
1766
+ var tmp_0 = scope.z1t_1;
1767
+ return isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
1768
+ };
1769
+ protoOf(RustIrEmitter).jr = function (endpoint) {
1770
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
1771
+ var this_0 = stripWirespecPrefix(this, flattenForRust(this, convert_3(endpoint)));
1772
+ var scope = new TransformScope(this_0);
1773
+ var identifierPattern = Regex_init_$Create$('[a-zA-Z_][a-zA-Z0-9_]*');
1774
+ scope.i1u(RustIrEmitter$emit$lambda_4(identifierPattern));
1775
+ var tmp = scope.z1t_1;
1776
+ var tmp$ret$1 = isInterface(tmp, Element) ? tmp : THROW_CCE();
1777
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
1778
+ var this_1 = stripResponseGenerics(this, stripHandlerExtends(this, tmp$ret$1));
1779
+ var scope_0 = new TransformScope(this_1);
1780
+ scope_0.e1u(fixResponseSwitchPatterns(this));
1781
+ var tmp_0 = scope_0.z1t_1;
1782
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
1783
+ var this_2 = isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
1784
+ var scope_1 = new TransformScope(this_2);
1785
+ scope_1.e1u(fixConstructorCalls(this));
1786
+ var tmp_1 = scope_1.z1t_1;
1787
+ var tmp$ret$5 = isInterface(tmp_1, Element) ? tmp_1 : THROW_CCE();
1788
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
1789
+ var this_3 = injectResponseFromImpls(this, injectHandlerImplForClient(this, injectSelfToHandlerMethods(this, tmp$ret$5), endpoint));
1790
+ var scope_2 = new TransformScope(this_3);
1791
+ // Inline function 'community.flock.wirespec.ir.core.TransformScope.matchingElements' call
1792
+ var tmp_2 = scope_2;
1793
+ // Inline function 'community.flock.wirespec.ir.core.transformMatchingElements' call
1794
+ var this_4 = scope_2.z1t_1;
1795
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
1796
+ // Inline function 'kotlin.apply' call
1797
+ var this_5 = new TransformerBuilder();
1798
+ this_5.d1h(RustIrEmitter$emit$lambda_5(this, endpoint));
1799
+ var tmp$ret$8 = this_5.e1h();
1800
+ tmp_2.z1t_1 = transform(this_4, tmp$ret$8);
1801
+ var tmp_3 = scope_2.z1t_1;
1802
+ var tmp$ret$12 = isInterface(tmp_3, Element) ? tmp_3 : THROW_CCE();
1803
+ return prependImports(this, sanitizeNames(tmp$ret$12, _get_sanitizationConfig__sns434(this)), buildEndpointImports(this, endpoint));
1804
+ };
1805
+ protoOf(RustIrEmitter).xq = function (channel) {
1806
+ return convert_4(channel);
1807
+ };
1808
+ protoOf(RustIrEmitter).q1u = function (endpoint) {
1809
+ var endpointName = endpoint.ep_1.l1();
1810
+ var endpointModuleName = toSnakeCase(this, endpointName);
1811
+ var clientName = endpointName + 'Client';
1812
+ var methodName = toSnakeCase(this, endpointName);
1813
+ var _destruct__k2r9zo = buildClientParams(this, endpoint);
1814
+ var paramsStr = _destruct__k2r9zo.ne();
1815
+ var requestArgs = _destruct__k2r9zo.oe();
1816
+ var requestConstruction = endpointModuleName + '::Request::new(' + requestArgs + ')';
1817
+ // Inline function 'kotlin.collections.distinctBy' call
1818
+ var this_0 = importReferences(endpoint);
1819
+ var set = HashSet_init_$Create$();
1820
+ var list = ArrayList_init_$Create$();
1821
+ var _iterator__ex2g4s = this_0.t();
1822
+ while (_iterator__ex2g4s.u()) {
1823
+ var e = _iterator__ex2g4s.v();
1824
+ var key = e.lu_1;
1825
+ if (set.x(key)) {
1826
+ list.x(e);
1827
+ }
1828
+ }
1829
+ // Inline function 'kotlin.collections.map' call
1830
+ // Inline function 'kotlin.collections.mapTo' call
1831
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(list, 10));
1832
+ var _iterator__ex2g4s_0 = list.t();
1833
+ while (_iterator__ex2g4s_0.u()) {
1834
+ var item = _iterator__ex2g4s_0.v();
1835
+ var tmp$ret$2 = import_0('super::super::model::' + toSnakeCase(this, item.lu_1), item.lu_1);
1836
+ destination.x(tmp$ret$2);
1837
+ }
1838
+ var modelImports = destination;
1839
+ var namespacePath = endpointModuleName + '::' + endpointName;
1840
+ // Inline function 'kotlin.collections.buildList' call
1841
+ // Inline function 'kotlin.collections.buildListInternal' call
1842
+ // Inline function 'kotlin.apply' call
1843
+ var this_1 = ArrayList_init_$Create$();
1844
+ this_1.x('pub struct ' + clientName + "<'a, S: Serialization, T: Transportation> {");
1845
+ this_1.x(" pub serialization: &'a S,");
1846
+ this_1.x(" pub transportation: &'a T,");
1847
+ this_1.x('}');
1848
+ this_1.x("impl<'a, S: Serialization, T: Transportation> " + namespacePath + '::Call for ' + clientName + "<'a, S, T> {");
1849
+ this_1.x(' async fn ' + methodName + '(&self' + paramsStr + ') -> ' + endpointModuleName + '::Response {');
1850
+ this_1.x(' let request = ' + requestConstruction + ';');
1851
+ this_1.x(' let raw_request = ' + namespacePath + '::to_raw_request(self.serialization, request);');
1852
+ this_1.x(' let raw_response = self.transportation.transport(&raw_request).await;');
1853
+ this_1.x(' ' + namespacePath + '::from_raw_response(self.serialization, raw_response)');
1854
+ this_1.x(' }');
1855
+ this_1.x('}');
1856
+ var tmp$ret$8 = this_1.o5();
1857
+ var code = joinToString(tmp$ret$8, '\n');
1858
+ var subPackageName = plus_2(this.g1z_1, 'client');
1859
+ var tmp = Companion_getInstance().m1h(subPackageName.or() + toSnakeCase(this, clientName));
1860
+ // Inline function 'kotlin.collections.buildList' call
1861
+ // Inline function 'kotlin.collections.buildListInternal' call
1862
+ // Inline function 'kotlin.apply' call
1863
+ var this_2 = ArrayList_init_$Create$();
1864
+ this_2.x(import_0('super::super::wirespec', '*'));
1865
+ this_2.x(import_0('super::super::endpoint', endpointModuleName));
1866
+ this_2.e1(modelImports);
1867
+ this_2.x(new RawElement(code));
1868
+ var tmp$ret$12 = this_2.o5();
1869
+ return new File(tmp, tmp$ret$12);
1870
+ };
1871
+ protoOf(RustIrEmitter).p1u = function (endpoints, logger) {
1872
+ logger.sq('Emitting main Client for ' + endpoints.a1() + ' endpoints');
1873
+ var modDeclarations = joinToString(endpoints, '\n', VOID, VOID, VOID, VOID, RustIrEmitter$emitClient$lambda(this));
1874
+ // Inline function 'kotlin.collections.flatMap' call
1875
+ // Inline function 'kotlin.collections.flatMapTo' call
1876
+ var destination = ArrayList_init_$Create$();
1877
+ var _iterator__ex2g4s = endpoints.t();
1878
+ while (_iterator__ex2g4s.u()) {
1879
+ var element = _iterator__ex2g4s.v();
1880
+ var list = importReferences(element);
1881
+ addAll(destination, list);
1882
+ }
1883
+ // Inline function 'kotlin.collections.distinctBy' call
1884
+ var set = HashSet_init_$Create$();
1885
+ var list_0 = ArrayList_init_$Create$();
1886
+ var _iterator__ex2g4s_0 = destination.t();
1887
+ while (_iterator__ex2g4s_0.u()) {
1888
+ var e = _iterator__ex2g4s_0.v();
1889
+ var key = e.lu_1;
1890
+ if (set.x(key)) {
1891
+ list_0.x(e);
1892
+ }
1893
+ }
1894
+ // Inline function 'kotlin.collections.filter' call
1895
+ // Inline function 'kotlin.collections.filterTo' call
1896
+ var destination_0 = ArrayList_init_$Create$();
1897
+ var _iterator__ex2g4s_1 = list_0.t();
1898
+ while (_iterator__ex2g4s_1.u()) {
1899
+ var element_0 = _iterator__ex2g4s_1.v();
1900
+ var tmp$ret$5;
1901
+ $l$block_0: {
1902
+ // Inline function 'kotlin.collections.none' call
1903
+ var tmp;
1904
+ if (isInterface(endpoints, Collection)) {
1905
+ tmp = endpoints.r();
1906
+ } else {
1907
+ tmp = false;
1908
+ }
1909
+ if (tmp) {
1910
+ tmp$ret$5 = true;
1911
+ break $l$block_0;
1912
+ }
1913
+ var _iterator__ex2g4s_2 = endpoints.t();
1914
+ while (_iterator__ex2g4s_2.u()) {
1915
+ var element_1 = _iterator__ex2g4s_2.v();
1916
+ if (element_1.ep_1.l1() === element_0.lu_1) {
1917
+ tmp$ret$5 = false;
1918
+ break $l$block_0;
1919
+ }
1920
+ }
1921
+ tmp$ret$5 = true;
1922
+ }
1923
+ if (tmp$ret$5) {
1924
+ destination_0.x(element_0);
1925
+ }
1926
+ }
1927
+ // Inline function 'kotlin.collections.map' call
1928
+ // Inline function 'kotlin.collections.mapTo' call
1929
+ var destination_1 = ArrayList_init_$Create$_0(collectionSizeOrDefault(destination_0, 10));
1930
+ var _iterator__ex2g4s_3 = destination_0.t();
1931
+ while (_iterator__ex2g4s_3.u()) {
1932
+ var item = _iterator__ex2g4s_3.v();
1933
+ var tmp$ret$10 = import_0('super::model::' + toSnakeCase(this, item.lu_1), item.lu_1);
1934
+ destination_1.x(tmp$ret$10);
1935
+ }
1936
+ var modelImports = destination_1;
1937
+ // Inline function 'kotlin.collections.flatMap' call
1938
+ // Inline function 'kotlin.collections.flatMapTo' call
1939
+ var destination_2 = ArrayList_init_$Create$();
1940
+ var _iterator__ex2g4s_4 = endpoints.t();
1941
+ while (_iterator__ex2g4s_4.u()) {
1942
+ var element_2 = _iterator__ex2g4s_4.v();
1943
+ var endpointModuleName = toSnakeCase(this, element_2.ep_1.l1());
1944
+ var clientModuleName = toSnakeCase(this, element_2.ep_1.l1() + 'Client');
1945
+ var list_1 = listOf_0([import_0('super::endpoint', endpointModuleName), import_0(clientModuleName, element_2.ep_1.l1() + 'Client')]);
1946
+ addAll(destination_2, list_1);
1947
+ }
1948
+ var endpointAndClientImports = destination_2;
1949
+ // Inline function 'kotlin.collections.flatMap' call
1950
+ // Inline function 'kotlin.collections.flatMapTo' call
1951
+ var destination_3 = ArrayList_init_$Create$();
1952
+ var _iterator__ex2g4s_5 = endpoints.t();
1953
+ while (_iterator__ex2g4s_5.u()) {
1954
+ var element_3 = _iterator__ex2g4s_5.v();
1955
+ var endpointName = element_3.ep_1.l1();
1956
+ var endpointModuleName_0 = toSnakeCase(this, endpointName);
1957
+ var namespacePath = endpointModuleName_0 + '::' + endpointName;
1958
+ var methodName = toSnakeCase(this, endpointName);
1959
+ var _destruct__k2r9zo = buildClientParams(this, element_3);
1960
+ var paramsStr = _destruct__k2r9zo.ne();
1961
+ var callArgs = _destruct__k2r9zo.oe();
1962
+ var tmp_0;
1963
+ // Inline function 'kotlin.text.isNotEmpty' call
1964
+ if (charSequenceLength(callArgs) > 0) {
1965
+ tmp_0 = endpointName + 'Client { serialization: &self.serialization, transportation: &self.transportation }\n .' + methodName + '(' + callArgs + ').await';
1966
+ } else {
1967
+ tmp_0 = endpointName + 'Client { serialization: &self.serialization, transportation: &self.transportation }\n .' + methodName + '().await';
1968
+ }
1969
+ var delegateCall = tmp_0;
1970
+ var list_2 = listOf_0(['impl<S: Serialization, T: Transportation> ' + namespacePath + '::Call for Client<S, T> {', ' async fn ' + methodName + '(&self' + paramsStr + ') -> ' + endpointModuleName_0 + '::Response {', ' ' + delegateCall, ' }', '}']);
1971
+ addAll(destination_3, list_2);
1972
+ }
1973
+ var implBlocks = destination_3;
1974
+ var code = joinToString(plus(listOf_0(['pub struct Client<S: Serialization, T: Transportation> {', ' pub serialization: S,', ' pub transportation: T,', '}']), implBlocks), '\n');
1975
+ var tmp_1 = Companion_getInstance().m1h(this.g1z_1.or() + 'client');
1976
+ // Inline function 'kotlin.collections.buildList' call
1977
+ // Inline function 'kotlin.collections.buildListInternal' call
1978
+ // Inline function 'kotlin.apply' call
1979
+ var this_0 = ArrayList_init_$Create$();
1980
+ this_0.x(new RawElement(modDeclarations));
1981
+ this_0.x(import_0('super::wirespec', '*'));
1982
+ this_0.e1(modelImports);
1983
+ this_0.e1(endpointAndClientImports);
1984
+ this_0.x(new RawElement(code));
1985
+ var tmp$ret$23 = this_0.o5();
1986
+ return new File(tmp_1, tmp$ret$23);
1987
+ };
1988
+ var properties_initialized_RustIrEmitter_kt_scscwh;
1989
+ function _init_properties_RustIrEmitter_kt__j995rl() {
1990
+ if (!properties_initialized_RustIrEmitter_kt_scscwh) {
1991
+ properties_initialized_RustIrEmitter_kt_scscwh = true;
1992
+ selfParam = new Parameter(Companion_getInstance().m1h('&self'), new Custom(''));
1993
+ RESPONSE_PATTERN = Regex_init_$Create$('Response(\\d+|Default)');
1994
+ }
1995
+ }
1996
+ function borrowParamsOf($this, fn) {
1997
+ // Inline function 'kotlin.collections.map' call
1998
+ var this_0 = fn.v1j_1;
1999
+ // Inline function 'kotlin.collections.mapTo' call
2000
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
2001
+ var _iterator__ex2g4s = this_0.t();
2002
+ while (_iterator__ex2g4s.u()) {
2003
+ var item = _iterator__ex2g4s.v();
2004
+ var tmp;
2005
+ if (RustTransform_getInstance().y1z(item.v1n_1)) {
2006
+ tmp = item;
2007
+ } else {
2008
+ tmp = item.y1n(VOID, applyBorrowRule(RustTransform_getInstance(), item.w1n_1));
2009
+ }
2010
+ var tmp$ret$0 = tmp;
2011
+ destination.x(tmp$ret$0);
2012
+ }
2013
+ return fn.b1k(VOID, VOID, destination);
2014
+ }
2015
+ function applyBorrowRule($this, type) {
2016
+ var tmp;
2017
+ if (type instanceof Nullable) {
2018
+ tmp = new Nullable(applyBorrowRule($this, type.o1h_1));
2019
+ } else {
2020
+ if (equals(type, String_instance)) {
2021
+ tmp = new Custom('&str');
2022
+ } else {
2023
+ if (type instanceof Custom) {
2024
+ tmp = $this.a20(type) ? type : $this.z1z(type) ? borrowImpl(type) : type;
2025
+ } else {
2026
+ tmp = type;
2027
+ }
2028
+ }
2029
+ }
2030
+ return tmp;
2031
+ }
2032
+ function toBorrowedRaw($this, _this__u8e3s4) {
2033
+ return new RawExpression('&' + toRawCode($this, _this__u8e3s4));
2034
+ }
2035
+ function sanitizeKeywords_0($this, _this__u8e3s4) {
2036
+ return Companion_getInstance_0().o1z_1.u1(_this__u8e3s4) ? 'r#' + _this__u8e3s4 : _this__u8e3s4;
2037
+ }
2038
+ function toRawCode($this, _this__u8e3s4) {
2039
+ var tmp;
2040
+ if (_this__u8e3s4 instanceof VariableReference) {
2041
+ tmp = sanitizeKeywords_0($this, _this__u8e3s4.u1o_1.y1l());
2042
+ } else {
2043
+ if (_this__u8e3s4 instanceof FieldCall) {
2044
+ var tmp1_safe_receiver = _this__u8e3s4.i1p_1;
2045
+ var tmp_0;
2046
+ if (tmp1_safe_receiver == null) {
2047
+ tmp_0 = null;
2048
+ } else {
2049
+ // Inline function 'kotlin.let' call
2050
+ tmp_0 = toRawCode(RustTransform_getInstance(), tmp1_safe_receiver) + '.';
2051
+ }
2052
+ var tmp2_elvis_lhs = tmp_0;
2053
+ var recv = tmp2_elvis_lhs == null ? '' : tmp2_elvis_lhs;
2054
+ tmp = recv + sanitizeKeywords_0($this, _this__u8e3s4.j1p_1.y1l());
2055
+ } else {
2056
+ if (_this__u8e3s4 instanceof ArrayIndexCall) {
2057
+ var tmp_1 = _this__u8e3s4.m1q_1;
2058
+ var lit = tmp_1 instanceof Literal ? tmp_1 : null;
2059
+ var tmp_2;
2060
+ var tmp_3;
2061
+ if (!(lit == null)) {
2062
+ var tmp_4;
2063
+ var tmp_5 = lit.e1p_1;
2064
+ if (tmp_5 instanceof Integer) {
2065
+ tmp_4 = true;
2066
+ } else {
2067
+ var tmp_6 = lit.e1p_1;
2068
+ tmp_4 = tmp_6 instanceof Number_0;
2069
+ }
2070
+ tmp_3 = tmp_4;
2071
+ } else {
2072
+ tmp_3 = false;
2073
+ }
2074
+ if (tmp_3) {
2075
+ tmp_2 = toString_0(lit.d1p_1);
2076
+ } else {
2077
+ var tmp_7;
2078
+ if (!(lit == null)) {
2079
+ var tmp_8 = lit.e1p_1;
2080
+ tmp_7 = tmp_8 instanceof String_0;
2081
+ } else {
2082
+ tmp_7 = false;
2083
+ }
2084
+ if (tmp_7) {
2085
+ tmp_2 = '"' + toString_0(lit.d1p_1) + '"';
2086
+ } else {
2087
+ tmp_2 = toRawCode($this, _this__u8e3s4.m1q_1);
2088
+ }
2089
+ }
2090
+ var idx = tmp_2;
2091
+ tmp = toRawCode($this, _this__u8e3s4.l1q_1) + '[' + idx + ']';
2092
+ } else {
2093
+ if (_this__u8e3s4 instanceof ConstructorStatement) {
2094
+ var tmp_9 = _this__u8e3s4.p1m_1;
2095
+ var tmp3_safe_receiver = tmp_9 instanceof Custom ? tmp_9 : null;
2096
+ var tmp4_elvis_lhs = tmp3_safe_receiver == null ? null : tmp3_safe_receiver.q1h_1;
2097
+ var typeName = tmp4_elvis_lhs == null ? toString_0(_this__u8e3s4.p1m_1) : tmp4_elvis_lhs;
2098
+ var tmp_10 = _this__u8e3s4.q1m_1.j1();
2099
+ var args = joinToString(tmp_10, ', ', VOID, VOID, VOID, VOID, RustTransform$toRawCode$lambda);
2100
+ var tmp_11;
2101
+ // Inline function 'kotlin.text.isEmpty' call
2102
+ if (charSequenceLength(args) === 0) {
2103
+ tmp_11 = typeName + ' {}';
2104
+ } else {
2105
+ tmp_11 = typeName + ' { ' + args + ' }';
2106
+ }
2107
+ tmp = tmp_11;
2108
+ } else {
2109
+ if (_this__u8e3s4 instanceof Literal) {
2110
+ var tmp_12;
2111
+ var tmp_13 = _this__u8e3s4.e1p_1;
2112
+ if (tmp_13 instanceof String_0) {
2113
+ tmp_12 = 'String::from("' + toString_0(_this__u8e3s4.d1p_1) + '")';
2114
+ } else {
2115
+ var tmp_14 = _this__u8e3s4.e1p_1;
2116
+ if (tmp_14 instanceof Boolean_0) {
2117
+ tmp_12 = toString_0(_this__u8e3s4.d1p_1);
2118
+ } else {
2119
+ var tmp_15 = _this__u8e3s4.e1p_1;
2120
+ if (tmp_15 instanceof Integer) {
2121
+ tmp_12 = toString_0(_this__u8e3s4.d1p_1);
2122
+ } else {
2123
+ var tmp_16 = _this__u8e3s4.e1p_1;
2124
+ if (tmp_16 instanceof Number_0) {
2125
+ tmp_12 = toString_0(_this__u8e3s4.d1p_1);
2126
+ } else {
2127
+ tmp_12 = toString_0(_this__u8e3s4.d1p_1);
2128
+ }
2129
+ }
2130
+ }
2131
+ }
2132
+ tmp = tmp_12;
2133
+ } else {
2134
+ if (_this__u8e3s4 instanceof RawExpression) {
2135
+ tmp = _this__u8e3s4.c1p_1;
2136
+ } else {
2137
+ var message = 'Unsupported expression type in toRawCode: ' + getKClassFromExpression(_this__u8e3s4).o();
2138
+ throw IllegalStateException_init_$Create$(toString_0(message));
2139
+ }
2140
+ }
2141
+ }
2142
+ }
2143
+ }
2144
+ }
2145
+ return tmp;
2146
+ }
2147
+ function RustTransform$primitivesToCustom$lambda(t, tr) {
2148
+ var tmp;
2149
+ if (equals(t, Any_instance)) {
2150
+ tmp = new Custom('Box<dyn std::any::Any>');
2151
+ } else {
2152
+ if (equals(t, Bytes_instance)) {
2153
+ tmp = new Custom('Vec<u8>');
2154
+ } else {
2155
+ if (equals(t, Reflect_instance)) {
2156
+ tmp = new Custom('std::any::TypeId');
2157
+ } else {
2158
+ if (equals(t, Wildcard_instance)) {
2159
+ tmp = new Custom('_');
2160
+ } else {
2161
+ if (t instanceof IntegerLiteral) {
2162
+ tmp = new Custom('i32');
2163
+ } else {
2164
+ if (t instanceof StringLiteral) {
2165
+ tmp = new Custom('String');
2166
+ } else {
2167
+ tmp = transformChildren_1(t, tr);
2168
+ }
2169
+ }
2170
+ }
2171
+ }
2172
+ }
2173
+ }
2174
+ return tmp;
2175
+ }
2176
+ function RustTransform$borrow$lambda(element, tr) {
2177
+ var tmp;
2178
+ if (element instanceof Interface) {
2179
+ var tmp_0;
2180
+ if (element.m1o_1.equals(Companion_getInstance().m1h('Call'))) {
2181
+ tmp_0 = element;
2182
+ } else {
2183
+ // Inline function 'kotlin.collections.map' call
2184
+ var this_0 = element.n1o_1;
2185
+ // Inline function 'kotlin.collections.mapTo' call
2186
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
2187
+ var _iterator__ex2g4s = this_0.t();
2188
+ while (_iterator__ex2g4s.u()) {
2189
+ var item = _iterator__ex2g4s.v();
2190
+ var tmp_1;
2191
+ if (item instanceof Function) {
2192
+ tmp_1 = borrowParamsOf(RustTransform_getInstance(), item);
2193
+ } else {
2194
+ tmp_1 = item;
2195
+ }
2196
+ var tmp$ret$0 = tmp_1;
2197
+ destination.x(tmp$ret$0);
2198
+ }
2199
+ var borrowed = destination;
2200
+ tmp_0 = transformChildren(element.t1o(VOID, borrowed), tr);
2201
+ }
2202
+ tmp = tmp_0;
2203
+ } else {
2204
+ if (element instanceof Function) {
2205
+ tmp = transformChildren(borrowParamsOf(RustTransform_getInstance(), element), tr);
2206
+ } else {
2207
+ tmp = transformChildren(element, tr);
2208
+ }
2209
+ }
2210
+ return tmp;
2211
+ }
2212
+ function RustTransform$serializationArgs$lambda(s, t) {
2213
+ var tmp;
2214
+ var tmp_0;
2215
+ if (s instanceof FunctionCall) {
2216
+ tmp_0 = RustTransform_getInstance().t1z_1.u1(s.b1m_1.y1l());
2217
+ } else {
2218
+ tmp_0 = false;
2219
+ }
2220
+ if (tmp_0) {
2221
+ // Inline function 'kotlin.collections.mapIndexed' call
2222
+ var this_0 = s.c1m_1.j1();
2223
+ // Inline function 'kotlin.collections.mapIndexedTo' call
2224
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
2225
+ var index = 0;
2226
+ var _iterator__ex2g4s = this_0.t();
2227
+ while (_iterator__ex2g4s.u()) {
2228
+ var item = _iterator__ex2g4s.v();
2229
+ var _unary__edvuaz = index;
2230
+ index = _unary__edvuaz + 1 | 0;
2231
+ var idx = checkIndexOverflow(_unary__edvuaz);
2232
+ // Inline function 'kotlin.collections.component1' call
2233
+ var key = item.k1();
2234
+ // Inline function 'kotlin.collections.component2' call
2235
+ var value = item.l1();
2236
+ var transformed = t.u1t(value);
2237
+ var tmp_1;
2238
+ var tmp_2;
2239
+ if (idx === 0) {
2240
+ var tmp_3;
2241
+ if (transformed instanceof VariableReference) {
2242
+ tmp_3 = transformed.u1o_1.s1h() === 'it';
2243
+ } else {
2244
+ tmp_3 = false;
2245
+ }
2246
+ tmp_2 = !tmp_3;
2247
+ } else {
2248
+ tmp_2 = false;
2249
+ }
2250
+ if (tmp_2) {
2251
+ tmp_1 = to(key, toBorrowedRaw(RustTransform_getInstance(), transformed));
2252
+ } else {
2253
+ tmp_1 = to(key, transformed);
2254
+ }
2255
+ var tmp$ret$2 = tmp_1;
2256
+ destination.x(tmp$ret$2);
2257
+ }
2258
+ var newArgs = toMap(destination);
2259
+ tmp = s.f1m(VOID, VOID, VOID, newArgs);
2260
+ } else {
2261
+ tmp = transformChildren_0(s, t);
2262
+ }
2263
+ return tmp;
2264
+ }
2265
+ function RustTransform$rustName$lambda(it) {
2266
+ return RustTransform_getInstance().x1z(it);
2267
+ }
2268
+ function RustTransform$toRawCode$lambda(it) {
2269
+ return it.k1().y1l() + ': ' + toRawCode(RustTransform_getInstance(), it.l1());
2270
+ }
2271
+ function RustTransform() {
2272
+ RustTransform_instance = this;
2273
+ var tmp = this;
2274
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
2275
+ // Inline function 'kotlin.apply' call
2276
+ var this_0 = new TransformerBuilder();
2277
+ this_0.f1u(RustTransform$primitivesToCustom$lambda);
2278
+ tmp.q1z_1 = this_0.e1h();
2279
+ var tmp_0 = this;
2280
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
2281
+ // Inline function 'kotlin.apply' call
2282
+ var this_1 = new TransformerBuilder();
2283
+ this_1.d1h(RustTransform$borrow$lambda);
2284
+ tmp_0.r1z_1 = this_1.e1h();
2285
+ var tmp_1 = this;
2286
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
2287
+ // Inline function 'kotlin.apply' call
2288
+ tmp_1.s1z_1 = (new TransformerBuilder()).e1h();
2289
+ this.t1z_1 = setOf(['serialize_path', 'serialize_param', 'serialize_body', 'deserialize_path', 'deserialize_param', 'deserialize_body']);
2290
+ var tmp_2 = this;
2291
+ // Inline function 'community.flock.wirespec.ir.core.transformer' call
2292
+ // Inline function 'kotlin.apply' call
2293
+ var this_2 = new TransformerBuilder();
2294
+ this_2.i1u(RustTransform$serializationArgs$lambda);
2295
+ tmp_2.u1z_1 = this_2.e1h();
2296
+ this.v1z_1 = setOf(['i32', 'i64', 'f32', 'f64', 'bool', 'u8', 'u16', 'u32', 'u64', 'usize', 'isize', '()']);
2297
+ }
2298
+ protoOf(RustTransform).w1z = function (element) {
2299
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
2300
+ var scope = new TransformScope(element);
2301
+ scope.e1u(RustTransform_getInstance().q1z_1);
2302
+ var tmp = scope.z1t_1;
2303
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
2304
+ var this_0 = isInterface(tmp, Element) ? tmp : THROW_CCE();
2305
+ var scope_0 = new TransformScope(this_0);
2306
+ scope_0.e1u(RustTransform_getInstance().r1z_1);
2307
+ var tmp_0 = scope_0.z1t_1;
2308
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
2309
+ var this_1 = isInterface(tmp_0, Element) ? tmp_0 : THROW_CCE();
2310
+ var scope_1 = new TransformScope(this_1);
2311
+ scope_1.e1u(RustTransform_getInstance().s1z_1);
2312
+ var tmp_1 = scope_1.z1t_1;
2313
+ // Inline function 'community.flock.wirespec.ir.core.transform' call
2314
+ var this_2 = isInterface(tmp_1, Element) ? tmp_1 : THROW_CCE();
2315
+ var scope_2 = new TransformScope(this_2);
2316
+ scope_2.e1u(RustTransform_getInstance().u1z_1);
2317
+ var tmp_2 = scope_2.z1t_1;
2318
+ return isInterface(tmp_2, Element) ? tmp_2 : THROW_CCE();
2319
+ };
2320
+ protoOf(RustTransform).x1z = function (_this__u8e3s4) {
2321
+ var tmp;
2322
+ if (_this__u8e3s4 instanceof Custom) {
2323
+ var tmp_0;
2324
+ if (_this__u8e3s4.r1h_1.r()) {
2325
+ tmp_0 = _this__u8e3s4.q1h_1;
2326
+ } else {
2327
+ tmp_0 = _this__u8e3s4.q1h_1 + '<' + joinToString(_this__u8e3s4.r1h_1, ', ', VOID, VOID, VOID, VOID, RustTransform$rustName$lambda) + '>';
2328
+ }
2329
+ tmp = tmp_0;
2330
+ } else {
2331
+ if (equals(_this__u8e3s4, String_instance)) {
2332
+ tmp = 'String';
2333
+ } else {
2334
+ if (_this__u8e3s4 instanceof Nullable) {
2335
+ tmp = 'Option<' + this.x1z(_this__u8e3s4.o1h_1) + '>';
2336
+ } else {
2337
+ if (_this__u8e3s4 instanceof Array_0) {
2338
+ tmp = 'Vec<' + this.x1z(_this__u8e3s4.p1h_1) + '>';
2339
+ } else {
2340
+ if (_this__u8e3s4 instanceof Dict) {
2341
+ tmp = 'std::collections::HashMap<' + this.x1z(_this__u8e3s4.j1m_1) + ', ' + this.x1z(_this__u8e3s4.k1m_1) + '>';
2342
+ } else {
2343
+ if (equals(_this__u8e3s4, Any_instance)) {
2344
+ tmp = 'Box<dyn std::any::Any>';
2345
+ } else {
2346
+ if (equals(_this__u8e3s4, Bytes_instance)) {
2347
+ tmp = 'Vec<u8>';
2348
+ } else {
2349
+ if (equals(_this__u8e3s4, Unit_instance)) {
2350
+ tmp = '()';
2351
+ } else {
2352
+ if (equals(_this__u8e3s4, Boolean_instance)) {
2353
+ tmp = 'bool';
2354
+ } else {
2355
+ if (equals(_this__u8e3s4, Wildcard_instance)) {
2356
+ tmp = '_';
2357
+ } else {
2358
+ if (equals(_this__u8e3s4, Reflect_instance)) {
2359
+ tmp = 'std::any::TypeId';
2360
+ } else {
2361
+ if (_this__u8e3s4 instanceof Integer) {
2362
+ var tmp_1;
2363
+ switch (_this__u8e3s4.g1m_1.b3_1) {
2364
+ case 0:
2365
+ tmp_1 = 'i32';
2366
+ break;
2367
+ case 1:
2368
+ tmp_1 = 'i64';
2369
+ break;
2370
+ default:
2371
+ noWhenBranchMatchedException();
2372
+ break;
2373
+ }
2374
+ tmp = tmp_1;
2375
+ } else {
2376
+ if (_this__u8e3s4 instanceof Number_0) {
2377
+ var tmp_2;
2378
+ switch (_this__u8e3s4.h1m_1.b3_1) {
2379
+ case 0:
2380
+ tmp_2 = 'f32';
2381
+ break;
2382
+ case 1:
2383
+ tmp_2 = 'f64';
2384
+ break;
2385
+ default:
2386
+ noWhenBranchMatchedException();
2387
+ break;
2388
+ }
2389
+ tmp = tmp_2;
2390
+ } else {
2391
+ if (_this__u8e3s4 instanceof IntegerLiteral) {
2392
+ tmp = 'i32';
2393
+ } else {
2394
+ if (_this__u8e3s4 instanceof StringLiteral) {
2395
+ tmp = 'String';
2396
+ } else {
2397
+ noWhenBranchMatchedException();
2398
+ }
2399
+ }
2400
+ }
2401
+ }
2402
+ }
2403
+ }
2404
+ }
2405
+ }
2406
+ }
2407
+ }
2408
+ }
2409
+ }
2410
+ }
2411
+ }
2412
+ }
2413
+ return tmp;
2414
+ };
2415
+ protoOf(RustTransform).a20 = function (_this__u8e3s4) {
2416
+ var tmp;
2417
+ if (_this__u8e3s4 instanceof Custom) {
2418
+ tmp = startsWith(_this__u8e3s4.q1h_1, '&') || startsWith(_this__u8e3s4.q1h_1, '&dyn ') || startsWith(_this__u8e3s4.q1h_1, '&impl ') || startsWith(_this__u8e3s4.q1h_1, '&mut ');
2419
+ } else {
2420
+ tmp = false;
2421
+ }
2422
+ return tmp;
2423
+ };
2424
+ protoOf(RustTransform).z1z = function (_this__u8e3s4) {
2425
+ return _this__u8e3s4.q1h_1 === 'Serializer' || _this__u8e3s4.q1h_1 === 'Deserializer';
2426
+ };
2427
+ protoOf(RustTransform).y1z = function (_this__u8e3s4) {
2428
+ var v = _this__u8e3s4.s1h();
2429
+ switch (v) {
2430
+ case 'self':
2431
+ case '&self':
2432
+ return true;
2433
+ default:
2434
+ return v === '&mut self';
2435
+ }
2436
+ };
2437
+ var RustTransform_instance;
2438
+ function RustTransform_getInstance() {
2439
+ if (RustTransform_instance == null)
2440
+ new RustTransform();
2441
+ return RustTransform_instance;
2442
+ }
2443
+ function borrow(_this__u8e3s4) {
2444
+ return _this__u8e3s4.n1m('&' + _this__u8e3s4.q1h_1);
2445
+ }
2446
+ function borrowDyn(_this__u8e3s4) {
2447
+ return _this__u8e3s4.n1m('&dyn ' + _this__u8e3s4.q1h_1);
2448
+ }
2449
+ function borrowImpl(_this__u8e3s4) {
2450
+ return _this__u8e3s4.n1m('&impl ' + _this__u8e3s4.q1h_1);
2451
+ }
2452
+ //region block: post-declaration
2453
+ protoOf(RustIrEmitter).on = emit_1;
2454
+ //endregion
2455
+ //region block: exports
2456
+ export {
2457
+ RustIrEmitter as RustIrEmitterluw00jp360tz,
2458
+ };
2459
+ //endregion
2460
+
2461
+ //# sourceMappingURL=wirespec-src-compiler-emitters-rust.mjs.map