@flock/wirespec 0.8.47 → 0.8.50

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 (36) hide show
  1. package/arrow-arrow-atomic.js +16 -16
  2. package/arrow-arrow-continuations.js +3 -3
  3. package/arrow-arrow-core.js +109 -88
  4. package/arrow-arrow-core.js.map +1 -1
  5. package/clikt-clikt.js +6790 -0
  6. package/clikt-clikt.js.map +1 -0
  7. package/colormath-root-colormath.js +1403 -0
  8. package/colormath-root-colormath.js.map +1 -0
  9. package/kotlin-kotlin-stdlib-js-ir.js +4150 -2107
  10. package/kotlin-kotlin-stdlib-js-ir.js.map +1 -1
  11. package/kotlin-openapi-bindings.js +3574 -3574
  12. package/kotlin-openapi-bindings.js.map +1 -1
  13. package/kotlinx-serialization-kotlinx-serialization-core-js-ir.js +1551 -1550
  14. package/kotlinx-serialization-kotlinx-serialization-core-js-ir.js.map +1 -1
  15. package/kotlinx-serialization-kotlinx-serialization-json-js-ir.js +1183 -1172
  16. package/kotlinx-serialization-kotlinx-serialization-json-js-ir.js.map +1 -1
  17. package/markdown.js +6858 -0
  18. package/markdown.js.map +1 -0
  19. package/mordant-mordant.js +11604 -0
  20. package/mordant-mordant.js.map +1 -0
  21. package/package.json +3 -3
  22. package/wirespec-bin.js +3 -0
  23. package/wirespec-src-compiler-core.js +2436 -1676
  24. package/wirespec-src-compiler-core.js.map +1 -1
  25. package/wirespec-src-compiler-lib.js +674 -567
  26. package/wirespec-src-compiler-lib.js.map +1 -1
  27. package/wirespec-src-converter-openapi.js +571 -571
  28. package/wirespec-src-converter-openapi.js.map +1 -1
  29. package/wirespec-src-plugin-arguments.js +543 -0
  30. package/wirespec-src-plugin-arguments.js.map +1 -0
  31. package/wirespec-src-plugin-cli.js +1028 -0
  32. package/wirespec-src-plugin-cli.js.map +1 -0
  33. package/wirespec-src-plugin-npm.d.ts +380 -0
  34. package/wirespec-src-plugin-npm.js +57 -0
  35. package/wirespec-src-plugin-npm.js.map +1 -0
  36. package/wirespec-src-compiler-lib.d.ts +0 -356
@@ -0,0 +1,1028 @@
1
+ (function (root, factory) {
2
+ if (typeof define === 'function' && define.amd)
3
+ define(['exports', './kotlin-kotlin-stdlib-js-ir.js', './clikt-clikt.js', './wirespec-src-plugin-arguments.js', './wirespec-src-compiler-core.js', './wirespec-src-converter-openapi.js', './arrow-arrow-core.js', './wirespec-src-compiler-lib.js'], factory);
4
+ else if (typeof exports === 'object')
5
+ factory(module.exports, require('./kotlin-kotlin-stdlib-js-ir.js'), require('./clikt-clikt.js'), require('./wirespec-src-plugin-arguments.js'), require('./wirespec-src-compiler-core.js'), require('./wirespec-src-converter-openapi.js'), require('./arrow-arrow-core.js'), require('./wirespec-src-compiler-lib.js'));
6
+ else {
7
+ if (typeof this['kotlin-kotlin-stdlib-js-ir'] === 'undefined') {
8
+ throw new Error("Error loading module 'wirespec-src-plugin-cli'. Its dependency 'kotlin-kotlin-stdlib-js-ir' was not found. Please, check whether 'kotlin-kotlin-stdlib-js-ir' is loaded prior to 'wirespec-src-plugin-cli'.");
9
+ }
10
+ if (typeof this['clikt-clikt'] === 'undefined') {
11
+ throw new Error("Error loading module 'wirespec-src-plugin-cli'. Its dependency 'clikt-clikt' was not found. Please, check whether 'clikt-clikt' is loaded prior to 'wirespec-src-plugin-cli'.");
12
+ }
13
+ if (typeof this['wirespec-src-plugin-arguments'] === 'undefined') {
14
+ throw new Error("Error loading module 'wirespec-src-plugin-cli'. Its dependency 'wirespec-src-plugin-arguments' was not found. Please, check whether 'wirespec-src-plugin-arguments' is loaded prior to 'wirespec-src-plugin-cli'.");
15
+ }
16
+ if (typeof this['wirespec-src-compiler-core'] === 'undefined') {
17
+ throw new Error("Error loading module 'wirespec-src-plugin-cli'. Its dependency 'wirespec-src-compiler-core' was not found. Please, check whether 'wirespec-src-compiler-core' is loaded prior to 'wirespec-src-plugin-cli'.");
18
+ }
19
+ if (typeof this['wirespec-src-converter-openapi'] === 'undefined') {
20
+ throw new Error("Error loading module 'wirespec-src-plugin-cli'. Its dependency 'wirespec-src-converter-openapi' was not found. Please, check whether 'wirespec-src-converter-openapi' is loaded prior to 'wirespec-src-plugin-cli'.");
21
+ }
22
+ if (typeof this['arrow-arrow-core'] === 'undefined') {
23
+ throw new Error("Error loading module 'wirespec-src-plugin-cli'. Its dependency 'arrow-arrow-core' was not found. Please, check whether 'arrow-arrow-core' is loaded prior to 'wirespec-src-plugin-cli'.");
24
+ }
25
+ if (typeof this['wirespec-src-compiler-lib'] === 'undefined') {
26
+ throw new Error("Error loading module 'wirespec-src-plugin-cli'. Its dependency 'wirespec-src-compiler-lib' was not found. Please, check whether 'wirespec-src-compiler-lib' is loaded prior to 'wirespec-src-plugin-cli'.");
27
+ }
28
+ root['wirespec-src-plugin-cli'] = factory(typeof this['wirespec-src-plugin-cli'] === 'undefined' ? {} : this['wirespec-src-plugin-cli'], this['kotlin-kotlin-stdlib-js-ir'], this['clikt-clikt'], this['wirespec-src-plugin-arguments'], this['wirespec-src-compiler-core'], this['wirespec-src-converter-openapi'], this['arrow-arrow-core'], this['wirespec-src-compiler-lib']);
29
+ }
30
+ }(this, function (_, kotlin_kotlin, kotlin_clikt_clikt, kotlin_community_flock_wirespec_plugin_arguments_arguments, kotlin_community_flock_wirespec_compiler_core, kotlin_community_flock_wirespec_converter_openapi, kotlin_io_arrow_kt_arrow_core, kotlin_community_flock_wirespec_compiler_lib) {
31
+ 'use strict';
32
+ //region block: imports
33
+ var Unit_getInstance = kotlin_kotlin.$_$.t3;
34
+ var subcommands = kotlin_clikt_clikt.$_$.c;
35
+ var protoOf = kotlin_kotlin.$_$.q9;
36
+ var objectMeta = kotlin_kotlin.$_$.p9;
37
+ var VOID = kotlin_kotlin.$_$.ke;
38
+ var setMetadataFor = kotlin_kotlin.$_$.r9;
39
+ var NoOpCliktCommand = kotlin_clikt_clikt.$_$.b;
40
+ var classMeta = kotlin_kotlin.$_$.l8;
41
+ var option = kotlin_clikt_clikt.$_$.h;
42
+ var Companion_getInstance = kotlin_community_flock_wirespec_plugin_arguments_arguments.$_$.u;
43
+ var choice = kotlin_clikt_clikt.$_$.j;
44
+ var multiple = kotlin_clikt_clikt.$_$.g;
45
+ var Compile_getInstance = kotlin_community_flock_wirespec_plugin_arguments_arguments.$_$.v;
46
+ var toSet = kotlin_kotlin.$_$.o7;
47
+ var CompilerArguments = kotlin_community_flock_wirespec_plugin_arguments_arguments.$_$.a;
48
+ var argument = kotlin_clikt_clikt.$_$.d;
49
+ var values = kotlin_community_flock_wirespec_plugin_arguments_arguments.$_$.c;
50
+ var mapCapacity = kotlin_kotlin.$_$.m6;
51
+ var coerceAtLeast = kotlin_kotlin.$_$.aa;
52
+ var LinkedHashMap_init_$Create$ = kotlin_kotlin.$_$.r;
53
+ var choice_0 = kotlin_clikt_clikt.$_$.i;
54
+ var Spec_Wirespec_getInstance = kotlin_community_flock_wirespec_plugin_arguments_arguments.$_$.r;
55
+ var listOf = kotlin_kotlin.$_$.k6;
56
+ var Convert = kotlin_community_flock_wirespec_plugin_arguments_arguments.$_$.g;
57
+ var setOf = kotlin_kotlin.$_$.x6;
58
+ var CliktCommand = kotlin_clikt_clikt.$_$.a;
59
+ var get_DEFAULT_PACKAGE_NAME = kotlin_community_flock_wirespec_compiler_core.$_$.a;
60
+ var default_0 = kotlin_clikt_clikt.$_$.e;
61
+ var flag = kotlin_clikt_clikt.$_$.f;
62
+ var Companion_getInstance_0 = kotlin_community_flock_wirespec_plugin_arguments_arguments.$_$.t;
63
+ var FullDirPath = kotlin_community_flock_wirespec_plugin_arguments_arguments.$_$.d;
64
+ var Console_getInstance = kotlin_community_flock_wirespec_plugin_arguments_arguments.$_$.s;
65
+ var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.j1;
66
+ var Enum = kotlin_kotlin.$_$.cd;
67
+ var KProperty1 = kotlin_kotlin.$_$.ja;
68
+ var getPropertyCallableRef = kotlin_kotlin.$_$.r8;
69
+ var numberRangeToNumber = kotlin_kotlin.$_$.k9;
70
+ var ArrayList_init_$Create$ = kotlin_kotlin.$_$.j;
71
+ var copyToArray = kotlin_kotlin.$_$.d5;
72
+ var Logger = kotlin_community_flock_wirespec_compiler_core.$_$.d1;
73
+ var toString = kotlin_kotlin.$_$.v9;
74
+ var FileExtension_Wirespec_getInstance = kotlin_community_flock_wirespec_plugin_arguments_arguments.$_$.m;
75
+ var FullFilePath = kotlin_community_flock_wirespec_plugin_arguments_arguments.$_$.e;
76
+ var Console = kotlin_community_flock_wirespec_plugin_arguments_arguments.$_$.b;
77
+ var Compile = kotlin_community_flock_wirespec_plugin_arguments_arguments.$_$.f;
78
+ var THROW_CCE = kotlin_kotlin.$_$.ld;
79
+ var Companion_getInstance_1 = kotlin_community_flock_wirespec_converter_openapi.$_$.a;
80
+ var Companion_getInstance_2 = kotlin_community_flock_wirespec_converter_openapi.$_$.b;
81
+ var noWhenBranchMatchedException = kotlin_kotlin.$_$.ge;
82
+ var collectionSizeOrDefault = kotlin_kotlin.$_$.q4;
83
+ var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.i;
84
+ var to = kotlin_kotlin.$_$.je;
85
+ var charSequenceLength = kotlin_kotlin.$_$.j8;
86
+ var charSequenceGet = kotlin_kotlin.$_$.i8;
87
+ var toString_0 = kotlin_kotlin.$_$.v1;
88
+ var first = kotlin_kotlin.$_$.n5;
89
+ var Emitted = kotlin_community_flock_wirespec_compiler_core.$_$.b;
90
+ var print = kotlin_kotlin.$_$.b8;
91
+ var WirespecEmitter = kotlin_community_flock_wirespec_compiler_core.$_$.g;
92
+ var equals = kotlin_kotlin.$_$.o8;
93
+ var TypeScriptEmitter = kotlin_community_flock_wirespec_compiler_core.$_$.f;
94
+ var FileExtension_TypeScript_getInstance = kotlin_community_flock_wirespec_plugin_arguments_arguments.$_$.l;
95
+ var Script_TypeScript_getInstance = kotlin_community_flock_wirespec_plugin_arguments_arguments.$_$.q;
96
+ var ScalaEmitter = kotlin_community_flock_wirespec_compiler_core.$_$.e;
97
+ var FileExtension_Scala_getInstance = kotlin_community_flock_wirespec_plugin_arguments_arguments.$_$.k;
98
+ var Jvm_Scala_getInstance = kotlin_community_flock_wirespec_plugin_arguments_arguments.$_$.p;
99
+ var KotlinEmitter = kotlin_community_flock_wirespec_compiler_core.$_$.d;
100
+ var FileExtension_Kotlin_getInstance = kotlin_community_flock_wirespec_plugin_arguments_arguments.$_$.j;
101
+ var Jvm_Kotlin_getInstance = kotlin_community_flock_wirespec_plugin_arguments_arguments.$_$.o;
102
+ var JavaEmitter = kotlin_community_flock_wirespec_compiler_core.$_$.c;
103
+ var FileExtension_Java_getInstance = kotlin_community_flock_wirespec_plugin_arguments_arguments.$_$.h;
104
+ var Jvm_Java_getInstance = kotlin_community_flock_wirespec_plugin_arguments_arguments.$_$.n;
105
+ var Wirespec_getInstance = kotlin_community_flock_wirespec_compiler_core.$_$.k1;
106
+ var compile = kotlin_community_flock_wirespec_compiler_core.$_$.b1;
107
+ var Left = kotlin_io_arrow_kt_arrow_core.$_$.c;
108
+ var Companion_getInstance_3 = kotlin_community_flock_wirespec_compiler_core.$_$.j1;
109
+ var Right = kotlin_io_arrow_kt_arrow_core.$_$.d;
110
+ var println = kotlin_kotlin.$_$.z7;
111
+ var ensureNotNull = kotlin_kotlin.$_$.ae;
112
+ var _Char___init__impl__6a9atx = kotlin_kotlin.$_$.r1;
113
+ var charArrayOf = kotlin_kotlin.$_$.g8;
114
+ var split = kotlin_kotlin.$_$.ac;
115
+ var joinToString = kotlin_kotlin.$_$.x5;
116
+ var FileExtension_Json_getInstance = kotlin_community_flock_wirespec_plugin_arguments_arguments.$_$.i;
117
+ var parse = kotlin_community_flock_wirespec_compiler_core.$_$.c1;
118
+ var get_noLogger = kotlin_community_flock_wirespec_compiler_core.$_$.e1;
119
+ var Definition = kotlin_community_flock_wirespec_compiler_core.$_$.h;
120
+ var isInterface = kotlin_kotlin.$_$.d9;
121
+ var produce = kotlin_community_flock_wirespec_compiler_lib.$_$.b;
122
+ var endsWith = kotlin_kotlin.$_$.bb;
123
+ var dropLast = kotlin_kotlin.$_$.za;
124
+ var iterator = kotlin_kotlin.$_$.h9;
125
+ var asSequence = kotlin_kotlin.$_$.la;
126
+ var map = kotlin_kotlin.$_$.qa;
127
+ var filter = kotlin_kotlin.$_$.ma;
128
+ var toSet_0 = kotlin_kotlin.$_$.sa;
129
+ var split_0 = kotlin_kotlin.$_$.bc;
130
+ var Companion_getInstance_4 = kotlin_kotlin.$_$.o3;
131
+ var _Result___init__impl__xyqfz8 = kotlin_kotlin.$_$.w1;
132
+ var createFailure = kotlin_kotlin.$_$.zd;
133
+ var _Result___get_value__impl__bjfvqg = kotlin_kotlin.$_$.a2;
134
+ var isObject = kotlin_kotlin.$_$.f9;
135
+ var _Result___get_isFailure__impl__jpiriv = kotlin_kotlin.$_$.y1;
136
+ var isArray = kotlin_kotlin.$_$.v8;
137
+ //endregion
138
+ //region block: pre-declaration
139
+ setMetadataFor(Companion, 'Companion', objectMeta);
140
+ setMetadataFor(WirespecCli, 'WirespecCli', classMeta, NoOpCliktCommand);
141
+ setMetadataFor(CommonOptions, 'CommonOptions', classMeta, CliktCommand);
142
+ setMetadataFor(Compile_0, 'Compile', classMeta, CommonOptions);
143
+ setMetadataFor(Convert_0, 'Convert', classMeta, CommonOptions);
144
+ setMetadataFor(Options, 'Options', classMeta, Enum);
145
+ setMetadataFor(File, 'File', classMeta);
146
+ setMetadataFor(JavaFile, 'JavaFile', classMeta, File);
147
+ setMetadataFor(JsonFile, 'JsonFile', classMeta, File);
148
+ setMetadataFor(KotlinFile, 'KotlinFile', classMeta, File);
149
+ setMetadataFor(ScalaFile, 'ScalaFile', classMeta, File);
150
+ setMetadataFor(TypeScriptFile, 'TypeScriptFile', classMeta, File);
151
+ setMetadataFor(WirespecFile, 'WirespecFile', classMeta, File);
152
+ setMetadataFor(Directory, 'Directory', classMeta);
153
+ //endregion
154
+ function WirespecCli$main$ref($boundThis) {
155
+ var l = function (p0) {
156
+ $boundThis.t3g(p0);
157
+ return Unit_getInstance();
158
+ };
159
+ l.callableName = 'main';
160
+ return l;
161
+ }
162
+ function Companion() {
163
+ Companion_instance = this;
164
+ }
165
+ protoOf(Companion).t3s = function (compile, convert) {
166
+ return WirespecCli$main$ref(subcommands(new WirespecCli(), [new Compile_0(compile), new Convert_0(convert)]));
167
+ };
168
+ var Companion_instance;
169
+ function Companion_getInstance_5() {
170
+ if (Companion_instance == null)
171
+ new Companion();
172
+ return Companion_instance;
173
+ }
174
+ function WirespecCli() {
175
+ Companion_getInstance_5();
176
+ NoOpCliktCommand.call(this, VOID, VOID, 'wirespec');
177
+ }
178
+ function _get_languages__ojonze($this) {
179
+ return $this.s3t_1.v3p($this, languages$factory_0());
180
+ }
181
+ function Compile_0(block) {
182
+ CommonOptions.call(this);
183
+ this.r3t_1 = block;
184
+ this.s3t_1 = multiple(choice(option(this, Options_Language_getInstance().v3t_1.slice(), 'Language'), Companion_getInstance().k22()), VOID, true).x3q(this, languages$factory());
185
+ }
186
+ protoOf(Compile_0).u3g = function () {
187
+ // Inline function 'kotlin.let' call
188
+ var tmp0_let = new CompilerArguments(Compile_getInstance(), this.u3u(this.t3u()), this.v3u(), toSet(_get_languages__ojonze(this)), this.w3u(), this.x3u(), this.y3u());
189
+ // Inline function 'kotlin.contracts.contract' call
190
+ this.r3t_1(tmp0_let);
191
+ };
192
+ function _get_format__qlarck($this) {
193
+ return $this.x3v_1.v3p($this, format$factory_0());
194
+ }
195
+ function _get_languages__ojonze_0($this) {
196
+ return $this.y3v_1.v3p($this, languages$factory_2());
197
+ }
198
+ function Convert_0(block) {
199
+ CommonOptions.call(this);
200
+ this.w3v_1 = block;
201
+ var tmp = this;
202
+ // Inline function 'com.github.ajalt.clikt.parameters.types.enum' call
203
+ var tmp0_enum = argument(this, VOID, 'Input format');
204
+ // Inline function 'kotlin.collections.associateBy' call
205
+ // Inline function 'kotlin.enumValues' call
206
+ var tmp0_associateBy = values();
207
+ var capacity = coerceAtLeast(mapCapacity(tmp0_associateBy.length), 16);
208
+ // Inline function 'kotlin.collections.associateByTo' call
209
+ var tmp0_associateByTo = LinkedHashMap_init_$Create$(capacity);
210
+ var inductionVariable = 0;
211
+ var last = tmp0_associateBy.length;
212
+ while (inductionVariable < last) {
213
+ var element = tmp0_associateBy[inductionVariable];
214
+ inductionVariable = inductionVariable + 1 | 0;
215
+ var tmp$ret$2;
216
+ // Inline function 'com.github.ajalt.clikt.parameters.types.enum.<anonymous>' call
217
+ // Inline function 'com.github.ajalt.clikt.parameters.types.enum.<anonymous>' call
218
+ tmp$ret$2 = element.o5_1;
219
+ tmp0_associateByTo.n3(tmp$ret$2, element);
220
+ }
221
+ tmp.x3v_1 = choice_0(tmp0_enum, tmp0_associateByTo, true).b3p(this, format$factory());
222
+ this.y3v_1 = multiple(choice(option(this, Options_Language_getInstance().v3t_1.slice(), 'Language'), Companion_getInstance().k22(), VOID, true), listOf(Spec_Wirespec_getInstance())).x3q(this, languages$factory_1());
223
+ }
224
+ protoOf(Convert_0).u3g = function () {
225
+ if (this.t3u() == null)
226
+ null;
227
+ else {
228
+ // Inline function 'kotlin.let' call
229
+ // Inline function 'kotlin.contracts.contract' call
230
+ this.n3g('To convert, please specify a file', VOID, true);
231
+ }
232
+ // Inline function 'kotlin.let' call
233
+ var tmp = new Convert(_get_format__qlarck(this));
234
+ var tmp_0 = this.u3u(null);
235
+ var tmp_1 = this.v3u();
236
+ var tmp$ret$2;
237
+ // Inline function 'kotlin.collections.ifEmpty' call
238
+ var tmp0_ifEmpty = toSet(_get_languages__ojonze_0(this));
239
+ var tmp_2;
240
+ if (tmp0_ifEmpty.g()) {
241
+ // Inline function 'community.flock.wirespec.plugin.cli.Convert.run.<anonymous>' call
242
+ tmp_2 = setOf(Spec_Wirespec_getInstance());
243
+ } else {
244
+ tmp_2 = tmp0_ifEmpty;
245
+ }
246
+ tmp$ret$2 = tmp_2;
247
+ var tmp1_let = new CompilerArguments(tmp, tmp_0, tmp_1, tmp$ret$2, this.w3u(), this.x3u(), this.y3u());
248
+ // Inline function 'kotlin.contracts.contract' call
249
+ this.w3v_1(tmp1_let);
250
+ };
251
+ function _get_inputFile__x1bqj($this) {
252
+ return $this.n3u_1.v3p($this, inputFile$factory_0());
253
+ }
254
+ function CommonOptions() {
255
+ CliktCommand.call(this);
256
+ this.n3u_1 = option(this, Options_InputFile_getInstance().v3t_1.slice(), 'Input file').x3q(this, inputFile$factory());
257
+ this.o3u_1 = option(this, Options_InputDir_getInstance().v3t_1.slice(), 'Input directory').x3q(this, inputDir$factory());
258
+ this.p3u_1 = option(this, Options_OutputDir_getInstance().v3t_1.slice(), 'Output directory').x3q(this, outputDir$factory());
259
+ this.q3u_1 = default_0(option(this, Options_PackageName_getInstance().v3t_1.slice(), 'Package name'), get_DEFAULT_PACKAGE_NAME()).x3q(this, packageName$factory());
260
+ this.r3u_1 = flag(option(this, Options_Strict_getInstance().v3t_1.slice(), 'Strict mode'), []).x3q(this, strict$factory());
261
+ this.s3u_1 = flag(option(this, Options_Debug_getInstance().v3t_1.slice(), 'Debug mode'), []).x3q(this, debug$factory());
262
+ }
263
+ protoOf(CommonOptions).t3u = function () {
264
+ return this.o3u_1.v3p(this, inputDir$factory_0());
265
+ };
266
+ protoOf(CommonOptions).v3u = function () {
267
+ return this.p3u_1.v3p(this, outputDir$factory_0());
268
+ };
269
+ protoOf(CommonOptions).w3u = function () {
270
+ return this.q3u_1.v3p(this, packageName$factory_0());
271
+ };
272
+ protoOf(CommonOptions).x3u = function () {
273
+ return this.r3u_1.v3p(this, strict$factory_0());
274
+ };
275
+ protoOf(CommonOptions).y3u = function () {
276
+ return this.s3u_1.v3p(this, debug$factory_0());
277
+ };
278
+ protoOf(CommonOptions).u3u = function (inputDir) {
279
+ var tmp;
280
+ if (!(inputDir == null) ? !(_get_inputFile__x1bqj(this) == null) : false) {
281
+ throw IllegalStateException_init_$Create$('Choose either a file or a directory. Not Both.');
282
+ } else {
283
+ var tmp0_safe_receiver = _get_inputFile__x1bqj(this);
284
+ var tmp_0;
285
+ if (tmp0_safe_receiver == null) {
286
+ tmp_0 = null;
287
+ } else {
288
+ // Inline function 'kotlin.let' call
289
+ // Inline function 'kotlin.contracts.contract' call
290
+ tmp_0 = Companion_getInstance_0().a22(tmp0_safe_receiver);
291
+ }
292
+ var tmp2_elvis_lhs = tmp_0;
293
+ var tmp_1;
294
+ if (tmp2_elvis_lhs == null) {
295
+ var tmp_2;
296
+ if (inputDir == null) {
297
+ tmp_2 = null;
298
+ } else {
299
+ // Inline function 'kotlin.let' call
300
+ // Inline function 'kotlin.contracts.contract' call
301
+ tmp_2 = new FullDirPath(inputDir);
302
+ }
303
+ tmp_1 = tmp_2;
304
+ } else {
305
+ tmp_1 = tmp2_elvis_lhs;
306
+ }
307
+ var tmp3_elvis_lhs = tmp_1;
308
+ tmp = tmp3_elvis_lhs == null ? Console_getInstance() : tmp3_elvis_lhs;
309
+ }
310
+ return tmp;
311
+ };
312
+ var Options_InputDir_instance;
313
+ var Options_InputFile_instance;
314
+ var Options_OutputDir_instance;
315
+ var Options_Language_instance;
316
+ var Options_PackageName_instance;
317
+ var Options_Strict_instance;
318
+ var Options_Debug_instance;
319
+ var Options_entriesInitialized;
320
+ function Options_initEntries() {
321
+ if (Options_entriesInitialized)
322
+ return Unit_getInstance();
323
+ Options_entriesInitialized = true;
324
+ Options_InputDir_instance = new Options('InputDir', 0, ['-d', '--input-dir']);
325
+ Options_InputFile_instance = new Options('InputFile', 1, ['-f', '--input-file']);
326
+ Options_OutputDir_instance = new Options('OutputDir', 2, ['-o', '--output-dir']);
327
+ Options_Language_instance = new Options('Language', 3, ['-l', '--language']);
328
+ Options_PackageName_instance = new Options('PackageName', 4, ['-p', '--package']);
329
+ Options_Strict_instance = new Options('Strict', 5, ['--strict']);
330
+ Options_Debug_instance = new Options('Debug', 6, ['--debug']);
331
+ }
332
+ function Options(name, ordinal, flags) {
333
+ Enum.call(this, name, ordinal);
334
+ this.v3t_1 = flags;
335
+ }
336
+ function Options_InputDir_getInstance() {
337
+ Options_initEntries();
338
+ return Options_InputDir_instance;
339
+ }
340
+ function Options_InputFile_getInstance() {
341
+ Options_initEntries();
342
+ return Options_InputFile_instance;
343
+ }
344
+ function Options_OutputDir_getInstance() {
345
+ Options_initEntries();
346
+ return Options_OutputDir_instance;
347
+ }
348
+ function Options_Language_getInstance() {
349
+ Options_initEntries();
350
+ return Options_Language_instance;
351
+ }
352
+ function Options_PackageName_getInstance() {
353
+ Options_initEntries();
354
+ return Options_PackageName_instance;
355
+ }
356
+ function Options_Strict_getInstance() {
357
+ Options_initEntries();
358
+ return Options_Strict_instance;
359
+ }
360
+ function Options_Debug_getInstance() {
361
+ Options_initEntries();
362
+ return Options_Debug_instance;
363
+ }
364
+ function languages$factory() {
365
+ return getPropertyCallableRef('languages', 1, KProperty1, function (receiver) {
366
+ return _get_languages__ojonze(receiver);
367
+ }, null);
368
+ }
369
+ function languages$factory_0() {
370
+ return getPropertyCallableRef('languages', 1, KProperty1, function (receiver) {
371
+ return _get_languages__ojonze(receiver);
372
+ }, null);
373
+ }
374
+ function format$factory() {
375
+ return getPropertyCallableRef('format', 1, KProperty1, function (receiver) {
376
+ return _get_format__qlarck(receiver);
377
+ }, null);
378
+ }
379
+ function languages$factory_1() {
380
+ return getPropertyCallableRef('languages', 1, KProperty1, function (receiver) {
381
+ return _get_languages__ojonze_0(receiver);
382
+ }, null);
383
+ }
384
+ function format$factory_0() {
385
+ return getPropertyCallableRef('format', 1, KProperty1, function (receiver) {
386
+ return _get_format__qlarck(receiver);
387
+ }, null);
388
+ }
389
+ function languages$factory_2() {
390
+ return getPropertyCallableRef('languages', 1, KProperty1, function (receiver) {
391
+ return _get_languages__ojonze_0(receiver);
392
+ }, null);
393
+ }
394
+ function inputFile$factory() {
395
+ return getPropertyCallableRef('inputFile', 1, KProperty1, function (receiver) {
396
+ return _get_inputFile__x1bqj(receiver);
397
+ }, null);
398
+ }
399
+ function inputDir$factory() {
400
+ return getPropertyCallableRef('inputDir', 1, KProperty1, function (receiver) {
401
+ return receiver.t3u();
402
+ }, null);
403
+ }
404
+ function outputDir$factory() {
405
+ return getPropertyCallableRef('outputDir', 1, KProperty1, function (receiver) {
406
+ return receiver.v3u();
407
+ }, null);
408
+ }
409
+ function packageName$factory() {
410
+ return getPropertyCallableRef('packageName', 1, KProperty1, function (receiver) {
411
+ return receiver.w3u();
412
+ }, null);
413
+ }
414
+ function strict$factory() {
415
+ return getPropertyCallableRef('strict', 1, KProperty1, function (receiver) {
416
+ return receiver.x3u();
417
+ }, null);
418
+ }
419
+ function debug$factory() {
420
+ return getPropertyCallableRef('debug', 1, KProperty1, function (receiver) {
421
+ return receiver.y3u();
422
+ }, null);
423
+ }
424
+ function inputFile$factory_0() {
425
+ return getPropertyCallableRef('inputFile', 1, KProperty1, function (receiver) {
426
+ return _get_inputFile__x1bqj(receiver);
427
+ }, null);
428
+ }
429
+ function inputDir$factory_0() {
430
+ return getPropertyCallableRef('inputDir', 1, KProperty1, function (receiver) {
431
+ return receiver.t3u();
432
+ }, null);
433
+ }
434
+ function outputDir$factory_0() {
435
+ return getPropertyCallableRef('outputDir', 1, KProperty1, function (receiver) {
436
+ return receiver.v3u();
437
+ }, null);
438
+ }
439
+ function packageName$factory_0() {
440
+ return getPropertyCallableRef('packageName', 1, KProperty1, function (receiver) {
441
+ return receiver.w3u();
442
+ }, null);
443
+ }
444
+ function strict$factory_0() {
445
+ return getPropertyCallableRef('strict', 1, KProperty1, function (receiver) {
446
+ return receiver.x3u();
447
+ }, null);
448
+ }
449
+ function debug$factory_0() {
450
+ return getPropertyCallableRef('debug', 1, KProperty1, function (receiver) {
451
+ return receiver.y3u();
452
+ }, null);
453
+ }
454
+ function main(args) {
455
+ // Inline function 'kotlin.let' call
456
+ // Inline function 'kotlin.collections.toTypedArray' call
457
+ // Inline function 'kotlin.collections.mapNotNull' call
458
+ var tmp0_mapNotNull = numberRangeToNumber(0, 20);
459
+ // Inline function 'kotlin.collections.mapNotNullTo' call
460
+ var tmp0_mapNotNullTo = ArrayList_init_$Create$();
461
+ // Inline function 'kotlin.collections.forEach' call
462
+ var inductionVariable = tmp0_mapNotNull.a1_1;
463
+ var last = tmp0_mapNotNull.b1_1;
464
+ if (inductionVariable <= last)
465
+ do {
466
+ var element = inductionVariable;
467
+ inductionVariable = inductionVariable + 1 | 0;
468
+ // Inline function 'kotlin.collections.mapNotNullTo.<anonymous>' call
469
+ var tmp0_safe_receiver = orNull(args, element);
470
+ if (tmp0_safe_receiver == null)
471
+ null;
472
+ else {
473
+ // Inline function 'kotlin.let' call
474
+ // Inline function 'kotlin.contracts.contract' call
475
+ tmp0_mapNotNullTo.a(tmp0_safe_receiver);
476
+ }
477
+ }
478
+ while (!(element === last));
479
+ var tmp2_let = copyToArray(tmp0_mapNotNullTo);
480
+ var tmp = Companion_getInstance_5();
481
+ var tmp_0 = compile$ref();
482
+ // Inline function 'kotlin.contracts.contract' call
483
+ tmp.t3s(tmp_0, convert$ref())(tmp2_let);
484
+ }
485
+ function compile_0(arguments_0) {
486
+ var input = arguments_0.t21_1;
487
+ var output = arguments_0.u21_1;
488
+ var languages = arguments_0.v21_1;
489
+ var packageName = arguments_0.w21_1;
490
+ var logger = new Logger(arguments_0.y21_1);
491
+ var operation = arguments_0.s21_1;
492
+ if (operation instanceof Convert) {
493
+ var fullPath = input instanceof FullFilePath ? input : THROW_CCE();
494
+ var file = new JsonFile(fullPath);
495
+ var strict = arguments_0.x21_1;
496
+ var format = operation.z21_1;
497
+ var tmp;
498
+ switch (format.p5_1) {
499
+ case 0:
500
+ tmp = Companion_getInstance_1().m22(file.q11(), !strict);
501
+ break;
502
+ case 1:
503
+ tmp = Companion_getInstance_2().m22(file.q11(), !strict);
504
+ break;
505
+ default:
506
+ noWhenBranchMatchedException();
507
+ break;
508
+ }
509
+ var ast = tmp;
510
+ var path = out(fullPath, packageName, output);
511
+ // Inline function 'kotlin.collections.map' call
512
+ // Inline function 'kotlin.collections.map' call
513
+ var tmp0_map = emitters(languages, packageName, path, logger);
514
+ // Inline function 'kotlin.collections.mapTo' call
515
+ var tmp0_mapTo = ArrayList_init_$Create$_0(collectionSizeOrDefault(tmp0_map, 10));
516
+ var tmp0_iterator = tmp0_map.c();
517
+ while (tmp0_iterator.d()) {
518
+ var item = tmp0_iterator.e();
519
+ var tmp$ret$7;
520
+ // Inline function 'community.flock.wirespec.plugin.cli.compile.<anonymous>' call
521
+ var emitter = item.e3();
522
+ var file_0 = item.f3();
523
+ var results = emitter.y1q(ast);
524
+ var tmp_0;
525
+ if (!emitter.i1w()) {
526
+ var tmp$ret$6;
527
+ // Inline function 'kotlin.text.replaceFirstChar' call
528
+ var tmp0_replaceFirstChar = fullPath.f22_1;
529
+ var tmp_1;
530
+ // Inline function 'kotlin.text.isNotEmpty' call
531
+ if (charSequenceLength(tmp0_replaceFirstChar) > 0) {
532
+ var tmp$ret$3;
533
+ // Inline function 'kotlin.text.uppercase' call
534
+ var tmp1_uppercase = charSequenceGet(tmp0_replaceFirstChar, 0);
535
+ // Inline function 'kotlin.js.unsafeCast' call
536
+ // Inline function 'kotlin.js.asDynamic' call
537
+ tmp$ret$3 = toString_0(tmp1_uppercase).toUpperCase();
538
+ var tmp_2 = toString(tmp$ret$3);
539
+ // Inline function 'kotlin.text.substring' call
540
+ // Inline function 'kotlin.js.asDynamic' call
541
+ tmp_1 = tmp_2 + tmp0_replaceFirstChar.substring(1);
542
+ } else {
543
+ tmp_1 = tmp0_replaceFirstChar;
544
+ }
545
+ tmp$ret$6 = tmp_1;
546
+ tmp_0 = to(listOf(new Emitted(tmp$ret$6, first(results).p1s_1)), file_0);
547
+ } else {
548
+ tmp_0 = to(results, file_0);
549
+ }
550
+ tmp$ret$7 = tmp_0;
551
+ tmp0_mapTo.a(tmp$ret$7);
552
+ }
553
+ // Inline function 'kotlin.collections.mapTo' call
554
+ var tmp0_mapTo_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(tmp0_mapTo, 10));
555
+ var tmp0_iterator_0 = tmp0_mapTo.c();
556
+ while (tmp0_iterator_0.d()) {
557
+ var item_0 = tmp0_iterator_0.e();
558
+ var results_0 = item_0.e3();
559
+ var file_1 = item_0.f3();
560
+ write(results_0, file_1);
561
+ tmp0_mapTo_0.a(Unit_getInstance());
562
+ }
563
+ } else {
564
+ if (operation instanceof Compile) {
565
+ if (input instanceof Console) {
566
+ wirespec(input, languages, packageName, compile$lambda(output), logger);
567
+ } else {
568
+ if (input instanceof FullDirPath) {
569
+ // Inline function 'kotlin.collections.forEach' call
570
+ var tmp0_iterator_1 = (new Directory(input.j22_1)).b3w().c();
571
+ while (tmp0_iterator_1.d()) {
572
+ var element = tmp0_iterator_1.e();
573
+ // Inline function 'community.flock.wirespec.plugin.cli.compile.<anonymous>' call
574
+ wirespec(element, languages, packageName, out(element.z3v_1, packageName, output), logger);
575
+ }
576
+ } else {
577
+ if (input instanceof FullFilePath)
578
+ if (input.g22_1.equals(FileExtension_Wirespec_getInstance())) {
579
+ // Inline function 'kotlin.let' call
580
+ var tmp3_let = new WirespecFile(input);
581
+ // Inline function 'kotlin.contracts.contract' call
582
+ wirespec(tmp3_let, languages, packageName, out(tmp3_let.z3v_1, packageName, output), logger);
583
+ } else {
584
+ // Inline function 'kotlin.error' call
585
+ var tmp4_error = 'Path ' + input + ' is not a Wirespec file';
586
+ throw IllegalStateException_init_$Create$(toString(tmp4_error));
587
+ }
588
+ }
589
+ }
590
+ }
591
+ }
592
+ }
593
+ function convert(arguments_0) {
594
+ return compile_0(arguments_0);
595
+ }
596
+ function out(_this__u8e3s4, packageName, output) {
597
+ return out$lambda(output, _this__u8e3s4, packageName);
598
+ }
599
+ function write(output, file) {
600
+ // Inline function 'kotlin.collections.forEach' call
601
+ var tmp0_iterator = output.c();
602
+ while (tmp0_iterator.d()) {
603
+ var element = tmp0_iterator.e();
604
+ // Inline function 'community.flock.wirespec.plugin.cli.write.<anonymous>' call
605
+ var name = element.e3();
606
+ var result = element.f3();
607
+ var tmp1_safe_receiver = file == null ? null : file.n24(name);
608
+ var tmp;
609
+ if (tmp1_safe_receiver == null) {
610
+ tmp = null;
611
+ } else {
612
+ tmp1_safe_receiver.c3w(result);
613
+ tmp = Unit_getInstance();
614
+ }
615
+ if (tmp == null) {
616
+ print(result);
617
+ }
618
+ }
619
+ }
620
+ function emitters(_this__u8e3s4, packageName, path, logger) {
621
+ // Inline function 'kotlin.collections.map' call
622
+ // Inline function 'kotlin.collections.mapTo' call
623
+ var tmp0_mapTo = ArrayList_init_$Create$_0(collectionSizeOrDefault(_this__u8e3s4, 10));
624
+ var tmp0_iterator = _this__u8e3s4.c();
625
+ while (tmp0_iterator.d()) {
626
+ var item = tmp0_iterator.e();
627
+ var tmp$ret$10;
628
+ // Inline function 'community.flock.wirespec.plugin.cli.emitters.<anonymous>' call
629
+ var tmp;
630
+ if (equals(item, Jvm_Java_getInstance())) {
631
+ var tmp_0 = new JavaEmitter(packageName, logger);
632
+ var tmp_1;
633
+ if (path == null) {
634
+ tmp_1 = null;
635
+ } else {
636
+ // Inline function 'kotlin.let' call
637
+ // Inline function 'kotlin.contracts.contract' call
638
+ // Inline function 'community.flock.wirespec.plugin.cli.emitters.<anonymous>.<anonymous>' call
639
+ tmp_1 = new JavaFile(path(FileExtension_Java_getInstance()));
640
+ }
641
+ tmp = to(tmp_0, tmp_1);
642
+ } else if (equals(item, Jvm_Kotlin_getInstance())) {
643
+ var tmp_2 = new KotlinEmitter(packageName, logger);
644
+ var tmp_3;
645
+ if (path == null) {
646
+ tmp_3 = null;
647
+ } else {
648
+ // Inline function 'kotlin.let' call
649
+ // Inline function 'kotlin.contracts.contract' call
650
+ // Inline function 'community.flock.wirespec.plugin.cli.emitters.<anonymous>.<anonymous>' call
651
+ tmp_3 = new KotlinFile(path(FileExtension_Kotlin_getInstance()));
652
+ }
653
+ tmp = to(tmp_2, tmp_3);
654
+ } else if (equals(item, Jvm_Scala_getInstance())) {
655
+ var tmp_4 = new ScalaEmitter(packageName, logger);
656
+ var tmp_5;
657
+ if (path == null) {
658
+ tmp_5 = null;
659
+ } else {
660
+ // Inline function 'kotlin.let' call
661
+ // Inline function 'kotlin.contracts.contract' call
662
+ // Inline function 'community.flock.wirespec.plugin.cli.emitters.<anonymous>.<anonymous>' call
663
+ tmp_5 = new ScalaFile(path(FileExtension_Scala_getInstance()));
664
+ }
665
+ tmp = to(tmp_4, tmp_5);
666
+ } else if (equals(item, Script_TypeScript_getInstance())) {
667
+ var tmp_6 = new TypeScriptEmitter(logger);
668
+ var tmp_7;
669
+ if (path == null) {
670
+ tmp_7 = null;
671
+ } else {
672
+ // Inline function 'kotlin.let' call
673
+ // Inline function 'kotlin.contracts.contract' call
674
+ // Inline function 'community.flock.wirespec.plugin.cli.emitters.<anonymous>.<anonymous>' call
675
+ tmp_7 = new TypeScriptFile(path(FileExtension_TypeScript_getInstance()));
676
+ }
677
+ tmp = to(tmp_6, tmp_7);
678
+ } else if (equals(item, Spec_Wirespec_getInstance())) {
679
+ var tmp_8 = new WirespecEmitter(logger);
680
+ var tmp_9;
681
+ if (path == null) {
682
+ tmp_9 = null;
683
+ } else {
684
+ // Inline function 'kotlin.let' call
685
+ // Inline function 'kotlin.contracts.contract' call
686
+ // Inline function 'community.flock.wirespec.plugin.cli.emitters.<anonymous>.<anonymous>' call
687
+ tmp_9 = new WirespecFile(path(FileExtension_Wirespec_getInstance()));
688
+ }
689
+ tmp = to(tmp_8, tmp_9);
690
+ } else {
691
+ noWhenBranchMatchedException();
692
+ }
693
+ tmp$ret$10 = tmp;
694
+ tmp0_mapTo.a(tmp$ret$10);
695
+ }
696
+ return tmp0_mapTo;
697
+ }
698
+ function wirespec(_this__u8e3s4, languages, packageName, path, logger) {
699
+ // Inline function 'kotlin.collections.map' call
700
+ // Inline function 'kotlin.let' call
701
+ // Inline function 'kotlin.let' call
702
+ var tmp0_let = _this__u8e3s4.q11();
703
+ var tmp1_let_this = Wirespec_getInstance();
704
+ // Inline function 'kotlin.contracts.contract' call
705
+ var tmp2_let = compile(tmp1_let_this, tmp0_let)(logger);
706
+ // Inline function 'kotlin.contracts.contract' call
707
+ // Inline function 'community.flock.wirespec.plugin.cli.wirespec.<anonymous>' call
708
+ // Inline function 'kotlin.collections.map' call
709
+ var tmp0_map = emitters(languages, packageName, path, logger);
710
+ // Inline function 'kotlin.collections.mapTo' call
711
+ var tmp0_mapTo = ArrayList_init_$Create$_0(collectionSizeOrDefault(tmp0_map, 10));
712
+ var tmp0_iterator = tmp0_map.c();
713
+ while (tmp0_iterator.d()) {
714
+ var item = tmp0_iterator.e();
715
+ var tmp$ret$6;
716
+ // Inline function 'community.flock.wirespec.plugin.cli.wirespec.<anonymous>.<anonymous>' call
717
+ var emitter = item.e3();
718
+ var file = item.f3();
719
+ var results = tmp2_let(emitter);
720
+ var tmp;
721
+ if (!emitter.i1w()) {
722
+ var tmp$ret$5;
723
+ // Inline function 'arrow.core.Either.map' call
724
+ // Inline function 'kotlin.contracts.contract' call
725
+ // Inline function 'arrow.core.flatMap' call
726
+ // Inline function 'kotlin.contracts.contract' call
727
+ var tmp_0;
728
+ if (results instanceof Right) {
729
+ // Inline function 'arrow.core.Either.map.<anonymous>' call
730
+ var tmp0_anonymous = results.x1p_1;
731
+ var tmp$ret$2;
732
+ // Inline function 'community.flock.wirespec.plugin.cli.wirespec.<anonymous>.<anonymous>.<anonymous>' call
733
+ tmp$ret$2 = listOf(new Emitted(Companion_getInstance_3().z1r(path(FileExtension_Wirespec_getInstance()).f22_1), first(tmp0_anonymous).p1s_1));
734
+ tmp_0 = new Right(tmp$ret$2);
735
+ } else {
736
+ if (results instanceof Left) {
737
+ tmp_0 = results;
738
+ } else {
739
+ noWhenBranchMatchedException();
740
+ }
741
+ }
742
+ tmp$ret$5 = tmp_0;
743
+ tmp = to(tmp$ret$5, file);
744
+ } else {
745
+ tmp = to(results, file);
746
+ }
747
+ tmp$ret$6 = tmp;
748
+ tmp0_mapTo.a(tmp$ret$6);
749
+ }
750
+ // Inline function 'kotlin.collections.mapTo' call
751
+ var tmp0_mapTo_0 = ArrayList_init_$Create$_0(collectionSizeOrDefault(tmp0_mapTo, 10));
752
+ var tmp0_iterator_0 = tmp0_mapTo.c();
753
+ while (tmp0_iterator_0.d()) {
754
+ var item_0 = tmp0_iterator_0.e();
755
+ // Inline function 'community.flock.wirespec.plugin.cli.wirespec.<anonymous>' call
756
+ var results_0 = item_0.e3();
757
+ var file_0 = item_0.f3();
758
+ if (results_0 instanceof Right) {
759
+ write(results_0.x1p_1, file_0);
760
+ } else {
761
+ if (results_0 instanceof Left) {
762
+ println(results_0.r1p_1);
763
+ }
764
+ }
765
+ tmp0_mapTo_0.a(Unit_getInstance());
766
+ }
767
+ }
768
+ function compile$ref() {
769
+ var l = function (p0) {
770
+ compile_0(p0);
771
+ return Unit_getInstance();
772
+ };
773
+ l.callableName = 'compile';
774
+ return l;
775
+ }
776
+ function convert$ref() {
777
+ var l = function (p0) {
778
+ convert(p0);
779
+ return Unit_getInstance();
780
+ };
781
+ l.callableName = 'convert';
782
+ return l;
783
+ }
784
+ function compile$lambda($output) {
785
+ return function (it) {
786
+ return new FullFilePath(ensureNotNull($output), 'console', it);
787
+ };
788
+ }
789
+ function out$lambda($output, $this_out, $packageName) {
790
+ return function (extension) {
791
+ var tmp0_elvis_lhs = $output;
792
+ var tmp;
793
+ if (tmp0_elvis_lhs == null) {
794
+ var tmp$ret$1;
795
+ // Inline function 'kotlin.text.lowercase' call
796
+ var tmp0_lowercase = extension.o5_1;
797
+ var tmp$ret$0;
798
+ // Inline function 'kotlin.js.asDynamic' call
799
+ tmp$ret$0 = tmp0_lowercase;
800
+ tmp$ret$1 = tmp$ret$0.toLowerCase();
801
+ tmp = $this_out.e22_1 + '/out/' + tmp$ret$1;
802
+ } else {
803
+ tmp = tmp0_elvis_lhs;
804
+ }
805
+ var dir = tmp;
806
+ return $this_out.i22(dir + '/' + joinToString(split($packageName, charArrayOf([_Char___init__impl__6a9atx(46)])), '/'), VOID, extension);
807
+ };
808
+ }
809
+ function JavaFile(path) {
810
+ File.call(this, path.i22(VOID, VOID, FileExtension_Java_getInstance()));
811
+ }
812
+ protoOf(JavaFile).n24 = function (fileName) {
813
+ return new JavaFile(this.z3v_1.i22(VOID, fileName));
814
+ };
815
+ function JsonFile(path) {
816
+ File.call(this, path.i22(VOID, VOID, FileExtension_Json_getInstance()));
817
+ }
818
+ protoOf(JsonFile).n24 = function (fileName) {
819
+ return new JsonFile(this.z3v_1.i22(VOID, fileName));
820
+ };
821
+ function KotlinFile(path) {
822
+ File.call(this, path.i22(VOID, VOID, FileExtension_Kotlin_getInstance()));
823
+ }
824
+ protoOf(KotlinFile).n24 = function (fileName) {
825
+ return new KotlinFile(this.z3v_1.i22(VOID, fileName));
826
+ };
827
+ function ScalaFile(path) {
828
+ File.call(this, path.i22(VOID, VOID, FileExtension_Scala_getInstance()));
829
+ }
830
+ protoOf(ScalaFile).n24 = function (fileName) {
831
+ return new ScalaFile(this.z3v_1.i22(VOID, fileName));
832
+ };
833
+ function TypeScriptFile(path) {
834
+ File.call(this, path.i22(VOID, VOID, FileExtension_TypeScript_getInstance()));
835
+ }
836
+ protoOf(TypeScriptFile).n24 = function (fileName) {
837
+ return new TypeScriptFile(this.z3v_1.i22(VOID, fileName));
838
+ };
839
+ function WirespecFile(path) {
840
+ File.call(this, path.i22(VOID, VOID, FileExtension_Wirespec_getInstance()));
841
+ }
842
+ protoOf(WirespecFile).n24 = function (fileName) {
843
+ return new WirespecFile(this.z3v_1.i22(VOID, fileName));
844
+ };
845
+ function cli(args) {
846
+ main(args);
847
+ }
848
+ function parser(source) {
849
+ var tmp0_safe_receiver = parse(Wirespec_getInstance(), source)(get_noLogger()).w1p();
850
+ var tmp;
851
+ if (tmp0_safe_receiver == null) {
852
+ tmp = null;
853
+ } else {
854
+ // Inline function 'kotlin.collections.filterIsInstance' call
855
+ // Inline function 'kotlin.collections.filterIsInstanceTo' call
856
+ var tmp0_filterIsInstanceTo = ArrayList_init_$Create$();
857
+ var tmp0_iterator = tmp0_safe_receiver.c();
858
+ while (tmp0_iterator.d()) {
859
+ var element = tmp0_iterator.e();
860
+ if (!(element == null) ? isInterface(element, Definition) : false) {
861
+ tmp0_filterIsInstanceTo.a(element);
862
+ }
863
+ }
864
+ tmp = tmp0_filterIsInstanceTo;
865
+ }
866
+ var tmp1_safe_receiver = tmp;
867
+ var tmp_0;
868
+ if (tmp1_safe_receiver == null) {
869
+ tmp_0 = null;
870
+ } else {
871
+ // Inline function 'kotlin.collections.map' call
872
+ // Inline function 'kotlin.collections.mapTo' call
873
+ var tmp0_mapTo = ArrayList_init_$Create$_0(collectionSizeOrDefault(tmp1_safe_receiver, 10));
874
+ var tmp0_iterator_0 = tmp1_safe_receiver.c();
875
+ while (tmp0_iterator_0.d()) {
876
+ var item = tmp0_iterator_0.e();
877
+ var tmp$ret$2;
878
+ // Inline function 'community.flock.wirespec.plugin.cli.parser.<anonymous>' call
879
+ tmp$ret$2 = produce(item);
880
+ tmp0_mapTo.a(tmp$ret$2);
881
+ }
882
+ tmp_0 = tmp0_mapTo;
883
+ }
884
+ var tmp2_safe_receiver = tmp_0;
885
+ var tmp_1;
886
+ if (tmp2_safe_receiver == null) {
887
+ tmp_1 = null;
888
+ } else {
889
+ // Inline function 'kotlin.collections.toTypedArray' call
890
+ tmp_1 = copyToArray(tmp2_safe_receiver);
891
+ }
892
+ var tmp3_elvis_lhs = tmp_1;
893
+ var tmp_2;
894
+ if (tmp3_elvis_lhs == null) {
895
+ throw IllegalStateException_init_$Create$('Cannot parse source');
896
+ } else {
897
+ tmp_2 = tmp3_elvis_lhs;
898
+ }
899
+ return tmp_2;
900
+ }
901
+ function Directory$wirespecFiles$lambda(it) {
902
+ // Inline function 'kotlin.js.unsafeCast' call
903
+ return it;
904
+ }
905
+ function Directory$wirespecFiles$lambda_0(it) {
906
+ return endsWith(it, FileExtension_Wirespec_getInstance().d22_1);
907
+ }
908
+ function Directory$wirespecFiles$lambda_1(it) {
909
+ return dropLast(it, FileExtension_Wirespec_getInstance().d22_1.length + 1 | 0);
910
+ }
911
+ function Directory$wirespecFiles$lambda_2(this$0) {
912
+ return function (it) {
913
+ return new FullFilePath(this$0.a3w_1, it);
914
+ };
915
+ }
916
+ function WirespecFile$_init_$ref_cj1n5j() {
917
+ var l = function (p0) {
918
+ return new WirespecFile(p0);
919
+ };
920
+ l.callableName = '<init>';
921
+ return l;
922
+ }
923
+ function Directory(path) {
924
+ this.a3w_1 = path;
925
+ }
926
+ protoOf(Directory).b3w = function () {
927
+ var tmp = asSequence(iterator(get_fs().readdirSync(this.a3w_1, 'utf-8')));
928
+ var tmp_0 = map(tmp, Directory$wirespecFiles$lambda);
929
+ var tmp_1 = filter(tmp_0, Directory$wirespecFiles$lambda_0);
930
+ var tmp_2 = map(tmp_1, Directory$wirespecFiles$lambda_1);
931
+ var tmp_3 = map(tmp_2, Directory$wirespecFiles$lambda_2(this));
932
+ return toSet_0(map(tmp_3, WirespecFile$_init_$ref_cj1n5j()));
933
+ };
934
+ function File(path) {
935
+ this.z3v_1 = path;
936
+ }
937
+ protoOf(File).q11 = function () {
938
+ // Inline function 'kotlin.js.unsafeCast' call
939
+ return get_fs().readFileSync(this.z3v_1.toString(), 'utf-8');
940
+ };
941
+ protoOf(File).c3w = function (text) {
942
+ // Inline function 'kotlin.run' call
943
+ var tmp0_run = this.z3v_1.i22(joinToString(split_0(this.z3v_1.e22_1, ['out']), 'out/node'));
944
+ // Inline function 'kotlin.contracts.contract' call
945
+ // Inline function 'community.flock.wirespec.plugin.cli.io.File.write.<anonymous>' call
946
+ // Inline function 'kotlin.js.unsafeCast' call
947
+ if (!get_fs().existsSync(tmp0_run.e22_1)) {
948
+ get_fs().mkdirSync(tmp0_run.e22_1, {recursive: true});
949
+ }
950
+ get_fs().writeFileSync(tmp0_run.toString(), text);
951
+ };
952
+ function get_fs() {
953
+ _init_properties_JavaScriptBindings_kt__clolet();
954
+ return fs;
955
+ }
956
+ var fs;
957
+ var properties_initialized_JavaScriptBindings_kt_6og6hv;
958
+ function _init_properties_JavaScriptBindings_kt__clolet() {
959
+ if (!properties_initialized_JavaScriptBindings_kt_6og6hv) {
960
+ properties_initialized_JavaScriptBindings_kt_6og6hv = true;
961
+ fs = require('fs');
962
+ }
963
+ }
964
+ function get_nodeArgs() {
965
+ _init_properties_CommandLineArguments_kt__b5v7hl();
966
+ return nodeArgs;
967
+ }
968
+ var nodeArgs;
969
+ function orNull(_this__u8e3s4, idx) {
970
+ _init_properties_CommandLineArguments_kt__b5v7hl();
971
+ // Inline function 'kotlin.Result.getOrNull' call
972
+ // Inline function 'kotlin.runCatching' call
973
+ var tmp;
974
+ try {
975
+ // Inline function 'kotlin.Companion.success' call
976
+ Companion_getInstance_4();
977
+ // Inline function 'community.flock.wirespec.plugin.utils.orNull.<anonymous>' call
978
+ var tmp1_success = get_nodeArgs()[idx];
979
+ tmp = _Result___init__impl__xyqfz8(tmp1_success);
980
+ } catch ($p) {
981
+ var tmp_0;
982
+ if ($p instanceof Error) {
983
+ var e = $p;
984
+ // Inline function 'kotlin.Companion.failure' call
985
+ Companion_getInstance_4();
986
+ tmp_0 = _Result___init__impl__xyqfz8(createFailure(e));
987
+ } else {
988
+ throw $p;
989
+ }
990
+ tmp = tmp_0;
991
+ }
992
+ var tmp0_getOrNull = tmp;
993
+ var tmp_1;
994
+ if (_Result___get_isFailure__impl__jpiriv(tmp0_getOrNull)) {
995
+ tmp_1 = null;
996
+ } else {
997
+ var tmp_2 = _Result___get_value__impl__bjfvqg(tmp0_getOrNull);
998
+ tmp_1 = (tmp_2 == null ? true : isObject(tmp_2)) ? tmp_2 : THROW_CCE();
999
+ }
1000
+ return tmp_1;
1001
+ }
1002
+ var properties_initialized_CommandLineArguments_kt_ekn5uh;
1003
+ function _init_properties_CommandLineArguments_kt__b5v7hl() {
1004
+ if (!properties_initialized_CommandLineArguments_kt_ekn5uh) {
1005
+ properties_initialized_CommandLineArguments_kt_ekn5uh = true;
1006
+ var tmp = process.argv.slice(2);
1007
+ nodeArgs = (!(tmp == null) ? isArray(tmp) : false) ? tmp : THROW_CCE();
1008
+ }
1009
+ }
1010
+ //region block: exports
1011
+ function $jsExportAll$(_) {
1012
+ var $community = _.community || (_.community = {});
1013
+ var $community$flock = $community.flock || ($community.flock = {});
1014
+ var $community$flock$wirespec = $community$flock.wirespec || ($community$flock.wirespec = {});
1015
+ var $community$flock$wirespec$plugin = $community$flock$wirespec.plugin || ($community$flock$wirespec.plugin = {});
1016
+ var $community$flock$wirespec$plugin$cli = $community$flock$wirespec$plugin.cli || ($community$flock$wirespec$plugin.cli = {});
1017
+ $community$flock$wirespec$plugin$cli.cli = cli;
1018
+ $community$flock$wirespec$plugin$cli.parser = parser;
1019
+ }
1020
+ $jsExportAll$(_);
1021
+ _.$jsExportAll$ = $jsExportAll$;
1022
+ _.$_$ = _.$_$ || {};
1023
+ _.$_$.a = main;
1024
+ //endregion
1025
+ return _;
1026
+ }));
1027
+
1028
+ //# sourceMappingURL=wirespec-src-plugin-cli.js.map