@sddsjs/design-system-builder-cli 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/LICENSE +4 -0
  2. package/README.md +969 -2
  3. package/bin/dsbuilder.js +2 -0
  4. package/dist/kotlin/Kotlin-Immutable-Collections-kotlinx-collections-immutable.js +3170 -0
  5. package/dist/kotlin/Stately-stately-concurrency.js +32 -0
  6. package/dist/kotlin/Stately-stately-concurrent-collections.js +302 -0
  7. package/dist/kotlin/Stately-stately-strict.js +12 -0
  8. package/dist/kotlin/clikt-clikt-mordant.js +304 -0
  9. package/dist/kotlin/clikt-clikt.js +6960 -0
  10. package/dist/kotlin/colormath-root-colormath.js +1653 -0
  11. package/dist/kotlin/design-system-builder-frontend-analytics-metrica.js +1026 -0
  12. package/dist/kotlin/design-system-builder-frontend-cli.js +10690 -0
  13. package/dist/kotlin/design-system-builder-frontend-core-analytics.js +128 -0
  14. package/dist/kotlin/design-system-builder-frontend-core-application.js +3634 -0
  15. package/dist/kotlin/design-system-builder-frontend-core-auth.js +1772 -0
  16. package/dist/kotlin/design-system-builder-frontend-core-domain.js +501 -0
  17. package/dist/kotlin/design-system-builder-frontend-core-network.js +3318 -0
  18. package/dist/kotlin/design-system-builder-frontend-core-platform.js +972 -0
  19. package/dist/kotlin/design-system-builder-frontend-core-process.js +236 -0
  20. package/dist/kotlin/design-system-builder-frontend-core-workspace.js +1058 -0
  21. package/dist/kotlin/design-system-builder-frontend-feature-auth.js +1664 -0
  22. package/dist/kotlin/design-system-builder-frontend-feature-components.js +24819 -0
  23. package/dist/kotlin/design-system-builder-frontend-feature-docs.js +7625 -0
  24. package/dist/kotlin/design-system-builder-frontend-feature-ds.js +2219 -0
  25. package/dist/kotlin/design-system-builder-frontend-feature-init.js +318 -0
  26. package/dist/kotlin/design-system-builder-frontend-feature-projects.js +624 -0
  27. package/dist/kotlin/design-system-builder-frontend-feature-status.js +984 -0
  28. package/dist/kotlin/design-system-builder-frontend-feature-theme.js +10456 -0
  29. package/dist/kotlin/design-system-builder-frontend-feature-toolchain.js +586 -0
  30. package/dist/kotlin/design-system-builder-frontend-mcp-server-core.js +6878 -0
  31. package/dist/kotlin/design-system-builder-frontend-platform-android.js +451 -0
  32. package/dist/kotlin/design-system-builder-frontend-platform-ios.js +1858 -0
  33. package/dist/kotlin/design-system-builder-frontend-platform-web.js +1555 -0
  34. package/dist/kotlin/design-system-builder-frontend-runtime-node.js +1763 -0
  35. package/dist/kotlin/kotlin-kotlin-stdlib.js +17881 -0
  36. package/dist/kotlin/kotlin-logging.js +440 -0
  37. package/dist/kotlin/kotlin-sdk-kotlin-sdk-core.js +20228 -0
  38. package/dist/kotlin/kotlin-sdk-kotlin-sdk-server.js +2771 -0
  39. package/dist/kotlin/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.js +8 -0
  40. package/dist/kotlin/kotlinx-atomicfu.js +252 -0
  41. package/dist/kotlin/kotlinx-coroutines-core.js +10822 -0
  42. package/dist/kotlin/kotlinx-io-kotlinx-io-bytestring.js +203 -0
  43. package/dist/kotlin/kotlinx-io-kotlinx-io-core.js +2032 -0
  44. package/dist/kotlin/kotlinx-serialization-kotlinx-serialization-core.js +6171 -0
  45. package/dist/kotlin/kotlinx-serialization-kotlinx-serialization-json.js +5690 -0
  46. package/dist/kotlin/ktor-ktor-client-core.js +8382 -0
  47. package/dist/kotlin/ktor-ktor-events.js +80 -0
  48. package/dist/kotlin/ktor-ktor-http-cio.js +2252 -0
  49. package/dist/kotlin/ktor-ktor-http.js +3320 -0
  50. package/dist/kotlin/ktor-ktor-io.js +3328 -0
  51. package/dist/kotlin/ktor-ktor-serialization.js +8 -0
  52. package/dist/kotlin/ktor-ktor-server-core.js +12 -0
  53. package/dist/kotlin/ktor-ktor-server-sse.js +8 -0
  54. package/dist/kotlin/ktor-ktor-server-websockets.js +8 -0
  55. package/dist/kotlin/ktor-ktor-sse.js +8 -0
  56. package/dist/kotlin/ktor-ktor-utils.js +2524 -0
  57. package/dist/kotlin/ktor-ktor-websocket-serialization.js +8 -0
  58. package/dist/kotlin/ktor-ktor-websockets.js +433 -0
  59. package/dist/kotlin/mordant-mordant-omnibus.js +8 -0
  60. package/dist/kotlin/mordant-mordant.js +12111 -0
  61. package/dist/kotlin/okio-parent-okio.js +2335 -0
  62. package/dist/kotlin/projects-core-koin-core.js +1285 -0
  63. package/package.json +26 -5
@@ -0,0 +1,1763 @@
1
+ (function (_, kotlin_io_ktor_ktor_client_core, kotlin_design_system_builder_frontend_core_network, kotlin_design_system_builder_frontend_core_auth, kotlin_kotlin, kotlin_design_system_builder_frontend_core_application, kotlin_design_system_builder_frontend_core_workspace, kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core, kotlin_design_system_builder_frontend_core_process) {
2
+ 'use strict';
3
+ //region block: imports
4
+ var Js_instance = kotlin_io_ktor_ktor_client_core.$_$.c;
5
+ var HttpClient = kotlin_io_ktor_ktor_client_core.$_$.l;
6
+ var KtorAuthenticatedHttpClientFactory = kotlin_design_system_builder_frontend_core_network.$_$.j;
7
+ var FileCredentialStore = kotlin_design_system_builder_frontend_core_auth.$_$.j;
8
+ var KtorTokenClient = kotlin_design_system_builder_frontend_core_network.$_$.k;
9
+ var VOID = kotlin_kotlin.$_$.c;
10
+ var ClientRuntime = kotlin_design_system_builder_frontend_core_application.$_$.a;
11
+ var protoOf = kotlin_kotlin.$_$.te;
12
+ var equals = kotlin_kotlin.$_$.jd;
13
+ var FunctionAdapter = kotlin_kotlin.$_$.wc;
14
+ var isInterface = kotlin_kotlin.$_$.fe;
15
+ var EnvironmentReader = kotlin_design_system_builder_frontend_core_auth.$_$.i;
16
+ var hashCode = kotlin_kotlin.$_$.pd;
17
+ var initMetadataForClass = kotlin_kotlin.$_$.qd;
18
+ var Unit_instance = kotlin_kotlin.$_$.r5;
19
+ var ProcessCredentialStoreLock = kotlin_design_system_builder_frontend_core_auth.$_$.p;
20
+ var initMetadataForObject = kotlin_kotlin.$_$.wd;
21
+ var THROW_CCE = kotlin_kotlin.$_$.wk;
22
+ var fromInt = kotlin_kotlin.$_$.lc;
23
+ var listOf = kotlin_kotlin.$_$.f9;
24
+ var isArray = kotlin_kotlin.$_$.xd;
25
+ var toList = kotlin_kotlin.$_$.ma;
26
+ var convertToInt = kotlin_kotlin.$_$.hc;
27
+ var Long = kotlin_kotlin.$_$.qk;
28
+ var compare = kotlin_kotlin.$_$.fc;
29
+ var ArrayList_init_$Create$ = kotlin_kotlin.$_$.l;
30
+ var emptyList = kotlin_kotlin.$_$.y7;
31
+ var WorkspaceFileSystem = kotlin_design_system_builder_frontend_core_workspace.$_$.i;
32
+ var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.b2;
33
+ var Companion_instance = kotlin_kotlin.$_$.m5;
34
+ var createFailure = kotlin_kotlin.$_$.nl;
35
+ var _Result___init__impl__xyqfz8 = kotlin_kotlin.$_$.e3;
36
+ var CoroutineImpl = kotlin_kotlin.$_$.tb;
37
+ var get_COROUTINE_SUSPENDED = kotlin_kotlin.$_$.db;
38
+ var initMetadataForCoroutine = kotlin_kotlin.$_$.sd;
39
+ var PkceChallenge = kotlin_design_system_builder_frontend_core_auth.$_$.n;
40
+ var intercepted = kotlin_kotlin.$_$.gb;
41
+ var CancellableContinuationImpl = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.b1;
42
+ var numberToLong = kotlin_kotlin.$_$.qc;
43
+ var PkcePlatform = kotlin_design_system_builder_frontend_core_auth.$_$.o;
44
+ var LinkedHashMap_init_$Create$ = kotlin_kotlin.$_$.v;
45
+ var listOf_0 = kotlin_kotlin.$_$.e9;
46
+ var OAuthCallback = kotlin_design_system_builder_frontend_core_auth.$_$.l;
47
+ var returnIfSuspended = kotlin_kotlin.$_$.i;
48
+ var CompletableDeferred = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.e1;
49
+ var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.m;
50
+ var equals_0 = kotlin_kotlin.$_$.bh;
51
+ var startsWith = kotlin_kotlin.$_$.gi;
52
+ var endsWith = kotlin_kotlin.$_$.ah;
53
+ var plus = kotlin_kotlin.$_$.t9;
54
+ var joinToString = kotlin_kotlin.$_$.r8;
55
+ var copyToArray = kotlin_kotlin.$_$.s7;
56
+ var ProcessLaunchException = kotlin_design_system_builder_frontend_core_process.$_$.a;
57
+ var charSequenceLength = kotlin_kotlin.$_$.fd;
58
+ var charSequenceGet = kotlin_kotlin.$_$.ed;
59
+ var Char__toInt_impl_vasixd = kotlin_kotlin.$_$.c3;
60
+ var contains = kotlin_kotlin.$_$.sg;
61
+ var ProcessResult = kotlin_design_system_builder_frontend_core_process.$_$.c;
62
+ var CoroutineScope = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.j1;
63
+ var initMetadataForLambda = kotlin_kotlin.$_$.vd;
64
+ var NonCancellable_getInstance = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.o;
65
+ var withContext = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.f;
66
+ var withTimeoutOrNull = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.g;
67
+ var ensureActive = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.t1;
68
+ var ProcessRunner = kotlin_design_system_builder_frontend_core_process.$_$.d;
69
+ var toString = kotlin_kotlin.$_$.we;
70
+ var initMetadataForCompanion = kotlin_kotlin.$_$.rd;
71
+ //endregion
72
+ //region block: pre-declaration
73
+ initMetadataForClass(sam$com_dsbuilder_frontend_core_auth_EnvironmentReader$0, 'sam$com_dsbuilder_frontend_core_auth_EnvironmentReader$0', VOID, VOID, [EnvironmentReader, FunctionAdapter]);
74
+ initMetadataForObject(NodeCredentialStoreLock, 'NodeCredentialStoreLock', VOID, VOID, VOID, [2]);
75
+ initMetadataForObject(NodeCredentialLockPlatform, 'NodeCredentialLockPlatform');
76
+ initMetadataForObject(NodeCredentialStoreFileSystem, 'NodeCredentialStoreFileSystem');
77
+ initMetadataForObject(NodeWorkspaceFileSystem, 'NodeWorkspaceFileSystem', VOID, VOID, [WorkspaceFileSystem]);
78
+ initMetadataForCoroutine($listenCOROUTINE$, CoroutineImpl);
79
+ initMetadataForClass(NodePkcePlatform, 'NodePkcePlatform', VOID, VOID, [PkcePlatform], [0, 1]);
80
+ initMetadataForCoroutine($completeCOROUTINE$, CoroutineImpl);
81
+ initMetadataForClass(NodeCallbackListener, 'NodeCallbackListener', VOID, VOID, VOID, [0, 1]);
82
+ initMetadataForLambda(NodeProcessRunner$await$slambda, CoroutineImpl, VOID, [1]);
83
+ initMetadataForLambda(NodeProcessRunner$stopIfRunning$slambda, CoroutineImpl, VOID, [1]);
84
+ initMetadataForLambda(NodeProcessRunner$stopIfRunning$slambda_1, CoroutineImpl, VOID, [1]);
85
+ initMetadataForCoroutine($awaitCOROUTINE$, CoroutineImpl);
86
+ initMetadataForCoroutine($stopIfRunningCOROUTINE$, CoroutineImpl);
87
+ initMetadataForObject(NodeProcessRunner, 'NodeProcessRunner', VOID, VOID, [ProcessRunner], [1, 3, 2]);
88
+ initMetadataForClass(NodeProcessOutput, 'NodeProcessOutput', NodeProcessOutput);
89
+ initMetadataForClass(NodeStartedProcess, 'NodeStartedProcess');
90
+ initMetadataForCompanion(Companion);
91
+ initMetadataForClass(WindowsProcessOwner, 'WindowsProcessOwner');
92
+ initMetadataForObject(WindowsJobs, 'WindowsJobs');
93
+ //endregion
94
+ function nodeBytes(buffer) {
95
+ // Inline function 'kotlin.js.unsafeCast' call
96
+ return new Int8Array(buffer.buffer, buffer.byteOffset, buffer.length);
97
+ }
98
+ function nodeBuffer(bytes) {
99
+ return Buffer.from(bytes.buffer, bytes.byteOffset, bytes.length);
100
+ }
101
+ function get_nodeProcess() {
102
+ _init_properties_NodeClientRuntime_kt__exgouf();
103
+ return nodeProcess;
104
+ }
105
+ var nodeProcess;
106
+ function createNodeClientRuntime(renderLoginPage, loginPageHeaders) {
107
+ _init_properties_NodeClientRuntime_kt__exgouf();
108
+ var httpClient = HttpClient(Js_instance);
109
+ var tmp0_supportsIosToolchain = get_nodeProcess().platform == 'darwin';
110
+ var tmp = createNodeClientRuntime$lambda;
111
+ var tmp3_environmentReader = new sam$com_dsbuilder_frontend_core_auth_EnvironmentReader$0(tmp);
112
+ var tmp4_httpClientFactory = new KtorAuthenticatedHttpClientFactory(createNodeClientRuntime$lambda_0(httpClient));
113
+ var tmp5_credentialStore = new FileCredentialStore(NodeCredentialStoreFileSystem_instance, NodeCredentialStoreLock_getInstance());
114
+ var tmp6_tokenClient = new KtorTokenClient(httpClient);
115
+ var tmp7_pkcePlatform = new NodePkcePlatform(renderLoginPage, loginPageHeaders);
116
+ return new ClientRuntime(NodeWorkspaceFileSystem_instance, tmp3_environmentReader, tmp4_httpClientFactory, NodeProcessRunner_instance, tmp5_credentialStore, tmp6_tokenClient, createNodeClientRuntime$lambda_1(httpClient), VOID, tmp7_pkcePlatform, VOID, tmp0_supportsIosToolchain);
117
+ }
118
+ function sam$com_dsbuilder_frontend_core_auth_EnvironmentReader$0(function_0) {
119
+ this.pbu_1 = function_0;
120
+ }
121
+ protoOf(sam$com_dsbuilder_frontend_core_auth_EnvironmentReader$0).xd = function (name) {
122
+ return this.pbu_1(name);
123
+ };
124
+ protoOf(sam$com_dsbuilder_frontend_core_auth_EnvironmentReader$0).x2 = function () {
125
+ return this.pbu_1;
126
+ };
127
+ protoOf(sam$com_dsbuilder_frontend_core_auth_EnvironmentReader$0).equals = function (other) {
128
+ var tmp;
129
+ if (!(other == null) ? isInterface(other, EnvironmentReader) : false) {
130
+ var tmp_0;
131
+ if (!(other == null) ? isInterface(other, FunctionAdapter) : false) {
132
+ tmp_0 = equals(this.x2(), other.x2());
133
+ } else {
134
+ tmp_0 = false;
135
+ }
136
+ tmp = tmp_0;
137
+ } else {
138
+ tmp = false;
139
+ }
140
+ return tmp;
141
+ };
142
+ protoOf(sam$com_dsbuilder_frontend_core_auth_EnvironmentReader$0).hashCode = function () {
143
+ return hashCode(this.x2());
144
+ };
145
+ function createNodeClientRuntime$lambda(name) {
146
+ _init_properties_NodeClientRuntime_kt__exgouf();
147
+ var tmp = get_nodeProcess().env[name];
148
+ return (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : null;
149
+ }
150
+ function createNodeClientRuntime$lambda_0($httpClient) {
151
+ return function () {
152
+ return $httpClient;
153
+ };
154
+ }
155
+ function createNodeClientRuntime$lambda_1($httpClient) {
156
+ return function () {
157
+ $httpClient.p3();
158
+ return Unit_instance;
159
+ };
160
+ }
161
+ var properties_initialized_NodeClientRuntime_kt_ov6n23;
162
+ function _init_properties_NodeClientRuntime_kt__exgouf() {
163
+ if (!properties_initialized_NodeClientRuntime_kt_ov6n23) {
164
+ properties_initialized_NodeClientRuntime_kt_ov6n23 = true;
165
+ nodeProcess = process;
166
+ }
167
+ }
168
+ function get_lockFs() {
169
+ _init_properties_NodeCredentialLockPlatform_kt__rubr1z();
170
+ return lockFs;
171
+ }
172
+ var lockFs;
173
+ function get_lockPath() {
174
+ _init_properties_NodeCredentialLockPlatform_kt__rubr1z();
175
+ return lockPath;
176
+ }
177
+ var lockPath;
178
+ function NodeCredentialStoreLock() {
179
+ NodeCredentialStoreLock_instance = this;
180
+ this.qbu_1 = new ProcessCredentialStoreLock(NodeCredentialLockPlatform_instance);
181
+ }
182
+ protoOf(NodeCredentialStoreLock).s51 = function (lockPath, block, $completion) {
183
+ return this.qbu_1.s51(lockPath, block, $completion);
184
+ };
185
+ var NodeCredentialStoreLock_instance;
186
+ function NodeCredentialStoreLock_getInstance() {
187
+ if (NodeCredentialStoreLock_instance == null)
188
+ new NodeCredentialStoreLock();
189
+ return NodeCredentialStoreLock_instance;
190
+ }
191
+ function NodeCredentialLockPlatform() {
192
+ }
193
+ protoOf(NodeCredentialLockPlatform).a54 = function () {
194
+ var tmp = get_nodeProcess().pid;
195
+ return fromInt((!(tmp == null) ? typeof tmp === 'number' : false) ? tmp : THROW_CCE());
196
+ };
197
+ protoOf(NodeCredentialLockPlatform).f53 = function (directory) {
198
+ var tmp = get_lockPath().dirname(directory);
199
+ var parent = (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
200
+ get_lockFs().mkdirSync(parent, {recursive: true, mode: 448});
201
+ get_lockFs().chmodSync(parent, 448);
202
+ try {
203
+ get_lockFs().mkdirSync(directory, {mode: 448});
204
+ } catch ($p) {
205
+ if ($p instanceof Error) {
206
+ var error = $p;
207
+ // Inline function 'kotlin.js.asDynamic' call
208
+ if (error.code != 'EEXIST')
209
+ throw error;
210
+ if (this.l52(directory) == null)
211
+ return false;
212
+ } else {
213
+ throw $p;
214
+ }
215
+ }
216
+ get_lockFs().chmodSync(directory, 448);
217
+ return true;
218
+ };
219
+ protoOf(NodeCredentialLockPlatform).g53 = function (directory, owner) {
220
+ var tmp = get_lockPath().dirname(directory);
221
+ var parent = (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
222
+ get_lockFs().mkdirSync(parent, {recursive: true, mode: 448});
223
+ get_lockFs().chmodSync(parent, 448);
224
+ get_lockFs().mkdirSync(directory, {mode: 448});
225
+ get_lockFs().writeFileSync(get_lockPath().join(directory, owner), '', {flag: 'wx', mode: 384});
226
+ };
227
+ protoOf(NodeCredentialLockPlatform).h53 = function (candidate, target) {
228
+ var tmp;
229
+ try {
230
+ get_lockFs().renameSync(candidate, target);
231
+ tmp = true;
232
+ } catch ($p) {
233
+ var tmp_0;
234
+ if ($p instanceof Error) {
235
+ var error = $p;
236
+ var tmp_1;
237
+ var tmp_2 = listOf(['EEXIST', 'ENOTEMPTY', 'ENOTDIR', 'EISDIR', 'EPERM', 'EACCES']);
238
+ // Inline function 'kotlin.js.asDynamic' call
239
+ if (tmp_2.t(error.code)) {
240
+ tmp_1 = false;
241
+ } else {
242
+ throw error;
243
+ }
244
+ tmp_0 = tmp_1;
245
+ } else {
246
+ throw $p;
247
+ }
248
+ tmp = tmp_0;
249
+ }
250
+ return tmp;
251
+ };
252
+ protoOf(NodeCredentialLockPlatform).l52 = function (directory) {
253
+ var tmp;
254
+ try {
255
+ var tmp_0 = get_lockFs().readdirSync(directory);
256
+ tmp = toList((!(tmp_0 == null) ? isArray(tmp_0) : false) ? tmp_0 : THROW_CCE());
257
+ } catch ($p) {
258
+ var tmp_1;
259
+ if ($p instanceof Error) {
260
+ var error = $p;
261
+ var tmp_2;
262
+ var tmp_3 = listOf(['ENOENT', 'ENOTDIR']);
263
+ // Inline function 'kotlin.js.asDynamic' call
264
+ if (tmp_3.t(error.code)) {
265
+ tmp_2 = null;
266
+ } else {
267
+ throw error;
268
+ }
269
+ tmp_1 = tmp_2;
270
+ } else {
271
+ throw $p;
272
+ }
273
+ tmp = tmp_1;
274
+ }
275
+ return tmp;
276
+ };
277
+ protoOf(NodeCredentialLockPlatform).n52 = function (pid) {
278
+ var tmp;
279
+ try {
280
+ var tmp_0;
281
+ if (compare(pid, new Long(2147483647, 0)) > 0) {
282
+ tmp_0 = true;
283
+ } else {
284
+ get_nodeProcess().kill(convertToInt(pid), 0);
285
+ tmp_0 = true;
286
+ }
287
+ tmp = tmp_0;
288
+ } catch ($p) {
289
+ var tmp_1;
290
+ if ($p instanceof Error) {
291
+ var error = $p;
292
+ // Inline function 'kotlin.js.asDynamic' call
293
+ tmp_1 = error.code != 'ESRCH';
294
+ } else {
295
+ throw $p;
296
+ }
297
+ tmp = tmp_1;
298
+ }
299
+ return tmp;
300
+ };
301
+ protoOf(NodeCredentialLockPlatform).o52 = function (directory, owner) {
302
+ var tmp;
303
+ try {
304
+ get_lockFs().unlinkSync(get_lockPath().join(directory, owner));
305
+ tmp = true;
306
+ } catch ($p) {
307
+ var tmp_0;
308
+ if ($p instanceof Error) {
309
+ var error = $p;
310
+ var tmp_1;
311
+ var tmp_2 = listOf(['ENOENT', 'ENOTDIR']);
312
+ // Inline function 'kotlin.js.asDynamic' call
313
+ if (tmp_2.t(error.code)) {
314
+ tmp_1 = false;
315
+ } else {
316
+ throw error;
317
+ }
318
+ tmp_0 = tmp_1;
319
+ } else {
320
+ throw $p;
321
+ }
322
+ tmp = tmp_0;
323
+ }
324
+ return tmp;
325
+ };
326
+ protoOf(NodeCredentialLockPlatform).m52 = function (directory) {
327
+ try {
328
+ get_lockFs().rmdirSync(directory);
329
+ } catch ($p) {
330
+ if ($p instanceof Error) {
331
+ var error = $p;
332
+ var tmp = listOf(['ENOENT', 'ENOTDIR', 'ENOTEMPTY', 'EEXIST']);
333
+ // Inline function 'kotlin.js.asDynamic' call
334
+ if (!tmp.t(error.code))
335
+ throw error;
336
+ } else {
337
+ throw $p;
338
+ }
339
+ }
340
+ };
341
+ var NodeCredentialLockPlatform_instance;
342
+ function NodeCredentialLockPlatform_getInstance() {
343
+ return NodeCredentialLockPlatform_instance;
344
+ }
345
+ var properties_initialized_NodeCredentialLockPlatform_kt_c8xnll;
346
+ function _init_properties_NodeCredentialLockPlatform_kt__rubr1z() {
347
+ if (!properties_initialized_NodeCredentialLockPlatform_kt_c8xnll) {
348
+ properties_initialized_NodeCredentialLockPlatform_kt_c8xnll = true;
349
+ lockFs = require('fs');
350
+ lockPath = require('path');
351
+ }
352
+ }
353
+ function get_nodePath() {
354
+ _init_properties_NodeFileSystems_kt__1h5bhw();
355
+ return nodePath;
356
+ }
357
+ var nodePath;
358
+ function get_nodeOs() {
359
+ _init_properties_NodeFileSystems_kt__1h5bhw();
360
+ return nodeOs;
361
+ }
362
+ var nodeOs;
363
+ function get_nodeFs() {
364
+ _init_properties_NodeFileSystems_kt__1h5bhw();
365
+ return nodeFs;
366
+ }
367
+ var nodeFs;
368
+ function NodeCredentialStoreFileSystem() {
369
+ }
370
+ protoOf(NodeCredentialStoreFileSystem).j4z = function () {
371
+ var tmp = get_nodeOs().homedir();
372
+ return (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
373
+ };
374
+ protoOf(NodeCredentialStoreFileSystem).k4z = function (parent, child) {
375
+ var tmp = get_nodePath().resolve(parent, child);
376
+ return (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
377
+ };
378
+ protoOf(NodeCredentialStoreFileSystem).v4y = function (path) {
379
+ var tmp = get_nodeFs().existsSync(path);
380
+ return (!(tmp == null) ? typeof tmp === 'boolean' : false) ? tmp : THROW_CCE();
381
+ };
382
+ protoOf(NodeCredentialStoreFileSystem).w4y = function (path) {
383
+ get_nodeFs().mkdirSync(path, {recursive: true});
384
+ };
385
+ protoOf(NodeCredentialStoreFileSystem).a4z = function (path) {
386
+ var tmp = get_nodeFs().readFileSync(path, 'utf8');
387
+ return (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
388
+ };
389
+ protoOf(NodeCredentialStoreFileSystem).y4y = function (path, text) {
390
+ get_nodeFs().writeFileSync(path, text);
391
+ };
392
+ protoOf(NodeCredentialStoreFileSystem).z4y = function (source, target) {
393
+ get_nodeFs().renameSync(source, target);
394
+ };
395
+ protoOf(NodeCredentialStoreFileSystem).u4y = function (path) {
396
+ if (this.v4y(path)) {
397
+ get_nodeFs().unlinkSync(path);
398
+ }
399
+ };
400
+ protoOf(NodeCredentialStoreFileSystem).x4y = function (path, mode) {
401
+ get_nodeFs().chmodSync(path, parseInt(mode, 8));
402
+ };
403
+ var NodeCredentialStoreFileSystem_instance;
404
+ function NodeCredentialStoreFileSystem_getInstance() {
405
+ return NodeCredentialStoreFileSystem_instance;
406
+ }
407
+ function NodeWorkspaceFileSystem() {
408
+ }
409
+ protoOf(NodeWorkspaceFileSystem).v5n = function () {
410
+ var tmp = get_nodeProcess().cwd();
411
+ return (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
412
+ };
413
+ protoOf(NodeWorkspaceFileSystem).s5n = function (path) {
414
+ var tmp = get_nodePath().dirname(path);
415
+ // Inline function 'kotlin.takeIf' call
416
+ var this_0 = (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
417
+ var tmp_0;
418
+ if (!(this_0 === path)) {
419
+ tmp_0 = this_0;
420
+ } else {
421
+ tmp_0 = null;
422
+ }
423
+ return tmp_0;
424
+ };
425
+ protoOf(NodeWorkspaceFileSystem).k4z = function (parent, child) {
426
+ var tmp = get_nodePath().resolve(parent, child);
427
+ return (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
428
+ };
429
+ protoOf(NodeWorkspaceFileSystem).e5o = function (path) {
430
+ var tmp = get_nodePath().resolve(path);
431
+ return (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
432
+ };
433
+ protoOf(NodeWorkspaceFileSystem).v4y = function (path) {
434
+ var tmp = get_nodeFs().existsSync(path);
435
+ return (!(tmp == null) ? typeof tmp === 'boolean' : false) ? tmp : THROW_CCE();
436
+ };
437
+ protoOf(NodeWorkspaceFileSystem).w4y = function (path) {
438
+ get_nodeFs().mkdirSync(path, {recursive: true});
439
+ };
440
+ protoOf(NodeWorkspaceFileSystem).f5o = function (path) {
441
+ var tmp;
442
+ try {
443
+ var tmp_0 = get_nodeFs().readdirSync(path);
444
+ // Inline function 'kotlin.collections.map' call
445
+ var this_0 = (!(tmp_0 == null) ? isArray(tmp_0) : false) ? tmp_0 : THROW_CCE();
446
+ // Inline function 'kotlin.collections.mapTo' call
447
+ var destination = ArrayList_init_$Create$(this_0.length);
448
+ var inductionVariable = 0;
449
+ var last = this_0.length;
450
+ while (inductionVariable < last) {
451
+ var item = this_0[inductionVariable];
452
+ inductionVariable = inductionVariable + 1 | 0;
453
+ var tmp$ret$0 = NodeWorkspaceFileSystem_instance.k4z(path, item);
454
+ destination.j(tmp$ret$0);
455
+ }
456
+ tmp = destination;
457
+ } catch ($p) {
458
+ var tmp_1;
459
+ if ($p instanceof Error) {
460
+ var error = $p;
461
+ // Inline function 'kotlin.js.asDynamic' call
462
+ var tmp0_subject = error.code;
463
+ var tmp_2;
464
+ if (tmp0_subject == 'ENOENT' || tmp0_subject == 'ENOTDIR') {
465
+ tmp_2 = emptyList();
466
+ } else {
467
+ throw error;
468
+ }
469
+ tmp_1 = tmp_2;
470
+ } else {
471
+ throw $p;
472
+ }
473
+ tmp = tmp_1;
474
+ }
475
+ return tmp;
476
+ };
477
+ protoOf(NodeWorkspaceFileSystem).g5o = function (path) {
478
+ var tmp;
479
+ if (this.v4y(path)) {
480
+ var tmp_0 = get_nodeFs().statSync(path).isDirectory();
481
+ tmp = (!(tmp_0 == null) ? typeof tmp_0 === 'boolean' : false) ? tmp_0 : THROW_CCE();
482
+ } else {
483
+ tmp = false;
484
+ }
485
+ return tmp;
486
+ };
487
+ protoOf(NodeWorkspaceFileSystem).a4z = function (path) {
488
+ var tmp = get_nodeFs().readFileSync(path, 'utf8');
489
+ return (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
490
+ };
491
+ protoOf(NodeWorkspaceFileSystem).h5o = function (path) {
492
+ var buffer = get_nodeFs().readFileSync(path);
493
+ return nodeBytes(buffer);
494
+ };
495
+ protoOf(NodeWorkspaceFileSystem).y4y = function (path, text) {
496
+ get_nodeFs().writeFileSync(path, text);
497
+ };
498
+ protoOf(NodeWorkspaceFileSystem).i5o = function (path, bytes) {
499
+ var buffer = nodeBuffer(bytes);
500
+ get_nodeFs().writeFileSync(path, buffer);
501
+ };
502
+ protoOf(NodeWorkspaceFileSystem).u4y = function (path) {
503
+ if (this.v4y(path)) {
504
+ get_nodeFs().unlinkSync(path);
505
+ }
506
+ };
507
+ var NodeWorkspaceFileSystem_instance;
508
+ function NodeWorkspaceFileSystem_getInstance() {
509
+ return NodeWorkspaceFileSystem_instance;
510
+ }
511
+ var properties_initialized_NodeFileSystems_kt_4aqcwm;
512
+ function _init_properties_NodeFileSystems_kt__1h5bhw() {
513
+ if (!properties_initialized_NodeFileSystems_kt_4aqcwm) {
514
+ properties_initialized_NodeFileSystems_kt_4aqcwm = true;
515
+ nodePath = require('path');
516
+ nodeOs = require('os');
517
+ nodeFs = require('fs');
518
+ }
519
+ }
520
+ function get_crypto() {
521
+ _init_properties_NodePkcePlatform_kt__f9opyq();
522
+ return crypto;
523
+ }
524
+ var crypto;
525
+ function get_http() {
526
+ _init_properties_NodePkcePlatform_kt__f9opyq();
527
+ return http;
528
+ }
529
+ var http;
530
+ function get_childProcess() {
531
+ _init_properties_NodePkcePlatform_kt__f9opyq();
532
+ return childProcess;
533
+ }
534
+ var childProcess;
535
+ function get_process() {
536
+ _init_properties_NodePkcePlatform_kt__f9opyq();
537
+ return process_0;
538
+ }
539
+ var process_0;
540
+ function get_urls() {
541
+ _init_properties_NodePkcePlatform_kt__f9opyq();
542
+ return urls;
543
+ }
544
+ var urls;
545
+ function NodePkcePlatform$openBrowser$lambda($continuation) {
546
+ return function (_unused_var__etf5q3) {
547
+ var tmp;
548
+ if ($continuation.wv()) {
549
+ var tmp0 = $continuation;
550
+ // Inline function 'kotlin.coroutines.resumeWithException' call
551
+ // Inline function 'kotlin.Companion.failure' call
552
+ var exception = IllegalStateException_init_$Create$('\u0411\u0440\u0430\u0443\u0437\u0435\u0440 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D.');
553
+ var tmp$ret$0 = _Result___init__impl__xyqfz8(createFailure(exception));
554
+ tmp0.h9(tmp$ret$0);
555
+ tmp = Unit_instance;
556
+ }
557
+ return Unit_instance;
558
+ };
559
+ }
560
+ function NodePkcePlatform$openBrowser$lambda_0($continuation) {
561
+ return function (code) {
562
+ var tmp;
563
+ if ($continuation.wv()) {
564
+ var tmp_0;
565
+ if (code == 0) {
566
+ // Inline function 'kotlin.coroutines.resume' call
567
+ var this_0 = $continuation;
568
+ // Inline function 'kotlin.Companion.success' call
569
+ var tmp$ret$0 = _Result___init__impl__xyqfz8(Unit_instance);
570
+ this_0.h9(tmp$ret$0);
571
+ tmp_0 = Unit_instance;
572
+ } else {
573
+ var tmp0 = $continuation;
574
+ // Inline function 'kotlin.coroutines.resumeWithException' call
575
+ // Inline function 'kotlin.Companion.failure' call
576
+ var exception = IllegalStateException_init_$Create$('\u0411\u0440\u0430\u0443\u0437\u0435\u0440 \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D.');
577
+ var tmp$ret$2 = _Result___init__impl__xyqfz8(createFailure(exception));
578
+ tmp0.h9(tmp$ret$2);
579
+ tmp_0 = Unit_instance;
580
+ }
581
+ tmp = tmp_0;
582
+ }
583
+ return Unit_instance;
584
+ };
585
+ }
586
+ function NodePkcePlatform$openBrowser$lambda_1($child) {
587
+ return function (it) {
588
+ $child.kill();
589
+ return Unit_instance;
590
+ };
591
+ }
592
+ function $listenCOROUTINE$(_this__u8e3s4, resultContinuation) {
593
+ CoroutineImpl.call(this, resultContinuation);
594
+ this.zbu_1 = _this__u8e3s4;
595
+ }
596
+ protoOf($listenCOROUTINE$).e9 = function () {
597
+ var suspendResult = this.y8_1;
598
+ $sm: do
599
+ try {
600
+ var tmp = this.w8_1;
601
+ switch (tmp) {
602
+ case 0:
603
+ this.x8_1 = 2;
604
+ this.abv_1 = new NodeCallbackListener(this.zbu_1.bbv_1, this.zbu_1.cbv_1);
605
+ this.w8_1 = 1;
606
+ suspendResult = this.abv_1.e9i(this);
607
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
608
+ return suspendResult;
609
+ }
610
+
611
+ continue $sm;
612
+ case 1:
613
+ return this.abv_1;
614
+ case 2:
615
+ throw this.z8_1;
616
+ }
617
+ } catch ($p) {
618
+ var e = $p;
619
+ if (this.x8_1 === 2) {
620
+ throw e;
621
+ } else {
622
+ this.w8_1 = this.x8_1;
623
+ this.z8_1 = e;
624
+ }
625
+ }
626
+ while (true);
627
+ };
628
+ function NodePkcePlatform(renderPage, pageHeaders) {
629
+ this.bbv_1 = renderPage;
630
+ this.cbv_1 = pageHeaders;
631
+ }
632
+ protoOf(NodePkcePlatform).z51 = function () {
633
+ var tmp = get_crypto().randomBytes(64).toString('base64url');
634
+ var verifier = (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
635
+ var tmp_0 = get_crypto().createHash('sha256').update(verifier).digest('base64url');
636
+ var challenge = (!(tmp_0 == null) ? typeof tmp_0 === 'string' : false) ? tmp_0 : THROW_CCE();
637
+ var tmp_1 = get_crypto().randomBytes(32).toString('base64url');
638
+ return new PkceChallenge(verifier, challenge, (!(tmp_1 == null) ? typeof tmp_1 === 'string' : false) ? tmp_1 : THROW_CCE());
639
+ };
640
+ protoOf(NodePkcePlatform).a52 = function ($completion) {
641
+ var tmp = new $listenCOROUTINE$(this, $completion);
642
+ tmp.y8_1 = Unit_instance;
643
+ tmp.z8_1 = null;
644
+ return tmp.e9();
645
+ };
646
+ protoOf(NodePkcePlatform).b52 = function (url, $completion) {
647
+ var cancellable = new CancellableContinuationImpl(intercepted($completion), 1);
648
+ cancellable.g11();
649
+ var tmp = get_process().platform;
650
+ var platform = (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
651
+ var command;
652
+ switch (platform) {
653
+ case 'darwin':
654
+ command = 'open';
655
+ break;
656
+ case 'win32':
657
+ command = 'rundll32';
658
+ break;
659
+ default:
660
+ command = 'xdg-open';
661
+ break;
662
+ }
663
+ var tmp_0;
664
+ if (platform === 'win32') {
665
+ // Inline function 'kotlin.arrayOf' call
666
+ // Inline function 'kotlin.js.unsafeCast' call
667
+ // Inline function 'kotlin.js.asDynamic' call
668
+ tmp_0 = ['url.dll,FileProtocolHandler', url];
669
+ } else {
670
+ // Inline function 'kotlin.arrayOf' call
671
+ // Inline function 'kotlin.js.unsafeCast' call
672
+ // Inline function 'kotlin.js.asDynamic' call
673
+ tmp_0 = [url];
674
+ }
675
+ var args = tmp_0;
676
+ var child = get_childProcess().spawn(command, args, {stdio: 'ignore'});
677
+ child.once('error', NodePkcePlatform$openBrowser$lambda(cancellable));
678
+ child.once('exit', NodePkcePlatform$openBrowser$lambda_0(cancellable));
679
+ cancellable.rz(NodePkcePlatform$openBrowser$lambda_1(child));
680
+ return cancellable.ly();
681
+ };
682
+ protoOf(NodePkcePlatform).c52 = function () {
683
+ var tmp = Date.now();
684
+ return numberToLong((!(tmp == null) ? typeof tmp === 'number' : false) ? tmp : THROW_CCE());
685
+ };
686
+ function respond($this, response, status) {
687
+ // Inline function 'kotlin.collections.forEach' call
688
+ // Inline function 'kotlin.collections.iterator' call
689
+ var _iterator__ex2g4s = $this.ebv_1.w().l();
690
+ while (_iterator__ex2g4s.m()) {
691
+ var element = _iterator__ex2g4s.n();
692
+ // Inline function 'kotlin.collections.component1' call
693
+ var name = element.x();
694
+ // Inline function 'kotlin.collections.component2' call
695
+ var value = element.y();
696
+ response.setHeader(name, value);
697
+ }
698
+ response.writeHead(status);
699
+ }
700
+ function NodeCallbackListener$server$lambda(this$0) {
701
+ return function (request, response) {
702
+ var url = get_urls().parse(request.url, true);
703
+ // Inline function 'kotlin.collections.mutableMapOf' call
704
+ var params = LinkedHashMap_init_$Create$();
705
+ var query = url.query;
706
+ var tmp = Object.keys(query);
707
+ var keys = (!(tmp == null) ? isArray(tmp) : false) ? tmp : THROW_CCE();
708
+ var inductionVariable = 0;
709
+ var last = keys.length;
710
+ while (inductionVariable < last) {
711
+ var key = keys[inductionVariable];
712
+ inductionVariable = inductionVariable + 1 | 0;
713
+ var value = query[key];
714
+ var tmp_0;
715
+ var tmp_1 = Array.isArray(value);
716
+ if ((!(tmp_1 == null) ? typeof tmp_1 === 'boolean' : false) ? tmp_1 : THROW_CCE()) {
717
+ tmp_0 = toList((!(value == null) ? isArray(value) : false) ? value : THROW_CCE());
718
+ } else {
719
+ tmp_0 = listOf_0((!(value == null) ? typeof value === 'string' : false) ? value : THROW_CCE());
720
+ }
721
+ // Inline function 'kotlin.collections.set' call
722
+ var value_0 = tmp_0;
723
+ params.f2(key, value_0);
724
+ }
725
+ var tmp_2;
726
+ if (request.method == 'GET') {
727
+ var tmp_3 = url.pathname;
728
+ tmp_2 = (!(tmp_3 == null) ? typeof tmp_3 === 'string' : false) ? tmp_3 : THROW_CCE();
729
+ } else {
730
+ tmp_2 = '';
731
+ }
732
+ var path = tmp_2;
733
+ var tmp_4;
734
+ if (this$0.fbv_1.rw()) {
735
+ respond(this$0, response, 409);
736
+ tmp_4 = response.end(this$0.dbv_1(false));
737
+ } else {
738
+ this$0.gbv_1 = response;
739
+ tmp_4 = this$0.fbv_1.y12(new OAuthCallback(path, params));
740
+ }
741
+ return tmp_4;
742
+ };
743
+ }
744
+ function NodeCallbackListener$start$lambda($continuation) {
745
+ return function (_unused_var__etf5q3) {
746
+ var tmp;
747
+ if ($continuation.wv()) {
748
+ var tmp0 = $continuation;
749
+ // Inline function 'kotlin.coroutines.resumeWithException' call
750
+ // Inline function 'kotlin.Companion.failure' call
751
+ var exception = IllegalStateException_init_$Create$('Listener \u043D\u0435\u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D.');
752
+ var tmp$ret$0 = _Result___init__impl__xyqfz8(createFailure(exception));
753
+ tmp0.h9(tmp$ret$0);
754
+ tmp = Unit_instance;
755
+ }
756
+ return Unit_instance;
757
+ };
758
+ }
759
+ function NodeCallbackListener$start$lambda_0($continuation, this$0) {
760
+ return function () {
761
+ var tmp;
762
+ if ($continuation.wv()) {
763
+ // Inline function 'kotlin.coroutines.resume' call
764
+ var this_0 = $continuation;
765
+ // Inline function 'kotlin.Companion.success' call
766
+ var tmp$ret$0 = _Result___init__impl__xyqfz8(Unit_instance);
767
+ this_0.h9(tmp$ret$0);
768
+ tmp = Unit_instance;
769
+ } else {
770
+ tmp = this$0.ibv_1.close();
771
+ }
772
+ return tmp;
773
+ };
774
+ }
775
+ function NodeCallbackListener$start$lambda_1(this$0) {
776
+ return function (it) {
777
+ this$0.ibv_1.close();
778
+ return Unit_instance;
779
+ };
780
+ }
781
+ function NodeCallbackListener$complete$lambda($continuation) {
782
+ return function (_unused_var__etf5q3) {
783
+ var tmp;
784
+ if ($continuation.wv()) {
785
+ // Inline function 'kotlin.coroutines.resume' call
786
+ var this_0 = $continuation;
787
+ // Inline function 'kotlin.Companion.success' call
788
+ var tmp$ret$0 = _Result___init__impl__xyqfz8(Unit_instance);
789
+ this_0.h9(tmp$ret$0);
790
+ tmp = Unit_instance;
791
+ }
792
+ return Unit_instance;
793
+ };
794
+ }
795
+ function NodeCallbackListener$complete$lambda_0($continuation) {
796
+ return function () {
797
+ var tmp;
798
+ if ($continuation.wv()) {
799
+ // Inline function 'kotlin.coroutines.resume' call
800
+ var this_0 = $continuation;
801
+ // Inline function 'kotlin.Companion.success' call
802
+ var tmp$ret$0 = _Result___init__impl__xyqfz8(Unit_instance);
803
+ this_0.h9(tmp$ret$0);
804
+ tmp = Unit_instance;
805
+ }
806
+ return Unit_instance;
807
+ };
808
+ }
809
+ function $completeCOROUTINE$(_this__u8e3s4, success, resultContinuation) {
810
+ CoroutineImpl.call(this, resultContinuation);
811
+ this.rbv_1 = _this__u8e3s4;
812
+ this.sbv_1 = success;
813
+ }
814
+ protoOf($completeCOROUTINE$).e9 = function () {
815
+ var suspendResult = this.y8_1;
816
+ $sm: do
817
+ try {
818
+ var tmp = this.w8_1;
819
+ switch (tmp) {
820
+ case 0:
821
+ this.x8_1 = 2;
822
+ var tmp0_elvis_lhs = this.rbv_1.gbv_1;
823
+ var tmp_0;
824
+ if (tmp0_elvis_lhs == null) {
825
+ return Unit_instance;
826
+ } else {
827
+ tmp_0 = tmp0_elvis_lhs;
828
+ }
829
+
830
+ var response = tmp_0;
831
+ this.rbv_1.gbv_1 = null;
832
+ this.w8_1 = 1;
833
+ var cancellable = new CancellableContinuationImpl(intercepted(this), 1);
834
+ cancellable.g11();
835
+ response.once('error', NodeCallbackListener$complete$lambda(cancellable));
836
+ respond(this.rbv_1, response, this.sbv_1 ? 200 : 400);
837
+ var tmp_1 = this.rbv_1.dbv_1(this.sbv_1);
838
+ response.end(tmp_1, NodeCallbackListener$complete$lambda_0(cancellable));
839
+ suspendResult = returnIfSuspended(cancellable.ly(), this);
840
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
841
+ return suspendResult;
842
+ }
843
+
844
+ continue $sm;
845
+ case 1:
846
+ return Unit_instance;
847
+ case 2:
848
+ throw this.z8_1;
849
+ }
850
+ } catch ($p) {
851
+ var e = $p;
852
+ if (this.x8_1 === 2) {
853
+ throw e;
854
+ } else {
855
+ this.w8_1 = this.x8_1;
856
+ this.z8_1 = e;
857
+ }
858
+ }
859
+ while (true);
860
+ };
861
+ function NodeCallbackListener(renderPage, pageHeaders) {
862
+ this.dbv_1 = renderPage;
863
+ this.ebv_1 = pageHeaders;
864
+ this.fbv_1 = CompletableDeferred();
865
+ this.gbv_1 = null;
866
+ this.hbv_1 = false;
867
+ var tmp = this;
868
+ tmp.ibv_1 = get_http().createServer(NodeCallbackListener$server$lambda(this));
869
+ }
870
+ protoOf(NodeCallbackListener).l33 = function () {
871
+ var tmp = this.ibv_1.address().port;
872
+ return (!(tmp == null) ? typeof tmp === 'number' : false) ? tmp : THROW_CCE();
873
+ };
874
+ protoOf(NodeCallbackListener).e9i = function ($completion) {
875
+ var cancellable = new CancellableContinuationImpl(intercepted($completion), 1);
876
+ cancellable.g11();
877
+ this.ibv_1.once('error', NodeCallbackListener$start$lambda(cancellable));
878
+ this.ibv_1.listen(0, '127.0.0.1', NodeCallbackListener$start$lambda_0(cancellable, this));
879
+ cancellable.rz(NodeCallbackListener$start$lambda_1(this));
880
+ return cancellable.ly();
881
+ };
882
+ protoOf(NodeCallbackListener).tbv = function ($completion) {
883
+ return this.fbv_1.kz($completion);
884
+ };
885
+ protoOf(NodeCallbackListener).ubv = function (success, $completion) {
886
+ var tmp = new $completeCOROUTINE$(this, success, $completion);
887
+ tmp.y8_1 = Unit_instance;
888
+ tmp.z8_1 = null;
889
+ return tmp.e9();
890
+ };
891
+ protoOf(NodeCallbackListener).p3 = function () {
892
+ if (this.hbv_1)
893
+ return Unit_instance;
894
+ this.hbv_1 = true;
895
+ this.ibv_1.close();
896
+ this.ibv_1.closeAllConnections();
897
+ this.fbv_1.gx();
898
+ };
899
+ var properties_initialized_NodePkcePlatform_kt_o8poes;
900
+ function _init_properties_NodePkcePlatform_kt__f9opyq() {
901
+ if (!properties_initialized_NodePkcePlatform_kt_o8poes) {
902
+ properties_initialized_NodePkcePlatform_kt_o8poes = true;
903
+ crypto = require('crypto');
904
+ http = require('http');
905
+ childProcess = require('child_process');
906
+ process_0 = process;
907
+ urls = require('url');
908
+ }
909
+ }
910
+ function nodeProcessEnvironment(inherited, overrides, windows) {
911
+ var environment = Object.assign({}, inherited);
912
+ // Inline function 'kotlin.collections.forEach' call
913
+ // Inline function 'kotlin.collections.iterator' call
914
+ var _iterator__ex2g4s = overrides.w().l();
915
+ while (_iterator__ex2g4s.m()) {
916
+ var element = _iterator__ex2g4s.n();
917
+ // Inline function 'kotlin.collections.component1' call
918
+ var key = element.x();
919
+ // Inline function 'kotlin.collections.component2' call
920
+ var value = element.y();
921
+ if (windows) {
922
+ var tmp = Object.keys(environment);
923
+ // Inline function 'kotlin.collections.filter' call
924
+ var tmp0 = (!(tmp == null) ? isArray(tmp) : false) ? tmp : THROW_CCE();
925
+ // Inline function 'kotlin.collections.filterTo' call
926
+ var destination = ArrayList_init_$Create$_0();
927
+ var inductionVariable = 0;
928
+ var last = tmp0.length;
929
+ while (inductionVariable < last) {
930
+ var element_0 = tmp0[inductionVariable];
931
+ inductionVariable = inductionVariable + 1 | 0;
932
+ if (equals_0(element_0, key, true)) {
933
+ destination.j(element_0);
934
+ }
935
+ }
936
+ // Inline function 'kotlin.collections.forEach' call
937
+ var _iterator__ex2g4s_0 = destination.l();
938
+ while (_iterator__ex2g4s_0.m()) {
939
+ var element_1 = _iterator__ex2g4s_0.n();
940
+ Reflect.deleteProperty(environment, element_1);
941
+ }
942
+ }
943
+ environment[key] = value;
944
+ }
945
+ var tmp_0 = Object.keys(environment);
946
+ // Inline function 'kotlin.collections.filter' call
947
+ var tmp0_0 = (!(tmp_0 == null) ? isArray(tmp_0) : false) ? tmp_0 : THROW_CCE();
948
+ // Inline function 'kotlin.collections.filterTo' call
949
+ var destination_0 = ArrayList_init_$Create$_0();
950
+ var inductionVariable_0 = 0;
951
+ var last_0 = tmp0_0.length;
952
+ while (inductionVariable_0 < last_0) {
953
+ var element_2 = tmp0_0[inductionVariable_0];
954
+ inductionVariable_0 = inductionVariable_0 + 1 | 0;
955
+ if (startsWith(element_2, 'DSBUILDER_METRICA_', true)) {
956
+ destination_0.j(element_2);
957
+ }
958
+ }
959
+ // Inline function 'kotlin.collections.forEach' call
960
+ var _iterator__ex2g4s_1 = destination_0.l();
961
+ while (_iterator__ex2g4s_1.m()) {
962
+ var element_3 = _iterator__ex2g4s_1.n();
963
+ Reflect.deleteProperty(environment, element_3);
964
+ }
965
+ return environment;
966
+ }
967
+ function start($this, request, windows) {
968
+ var options = {};
969
+ options.cwd = request.o5o_1;
970
+ var tmp;
971
+ if (request.q5o_1) {
972
+ // Inline function 'kotlin.arrayOf' call
973
+ // Inline function 'kotlin.js.unsafeCast' call
974
+ // Inline function 'kotlin.js.asDynamic' call
975
+ tmp = ['ignore', 'inherit', 'inherit'];
976
+ } else {
977
+ // Inline function 'kotlin.arrayOf' call
978
+ // Inline function 'kotlin.js.unsafeCast' call
979
+ // Inline function 'kotlin.js.asDynamic' call
980
+ tmp = ['ignore', 'pipe', 'pipe'];
981
+ }
982
+ options.stdio = tmp;
983
+ options.detached = !windows;
984
+ options.env = nodeProcessEnvironment(get_nodeProcess().env, request.p5o_1, windows);
985
+ var batch = windows && (endsWith(request.m5o_1, '.cmd', true) || endsWith(request.m5o_1, '.bat', true));
986
+ var tmp_0;
987
+ if (batch) {
988
+ var tmp_1 = get_nodeProcess().env.ComSpec;
989
+ var tmp0_elvis_lhs = (!(tmp_1 == null) ? typeof tmp_1 === 'string' : false) ? tmp_1 : null;
990
+ tmp_0 = tmp0_elvis_lhs == null ? 'C:\\Windows\\System32\\cmd.exe' : tmp0_elvis_lhs;
991
+ } else {
992
+ tmp_0 = request.m5o_1;
993
+ }
994
+ var executable = tmp_0;
995
+ var tmp_2;
996
+ if (batch) {
997
+ var tmp_3 = plus(listOf_0(request.m5o_1), request.n5o_1);
998
+ var tokens = joinToString(tmp_3, ' ', VOID, VOID, VOID, VOID, NodeProcessRunner$start$lambda);
999
+ options.windowsVerbatimArguments = true;
1000
+ tmp_2 = listOf(['/d', '/v:off', '/s', '/c', '"' + tokens + '"']);
1001
+ } else {
1002
+ tmp_2 = request.n5o_1;
1003
+ }
1004
+ var args = tmp_2;
1005
+ var tmp_4;
1006
+ try {
1007
+ var tmp_5;
1008
+ if (windows) {
1009
+ var tmp_6 = Companion_getInstance();
1010
+ // Inline function 'kotlin.collections.toTypedArray' call
1011
+ var tmp$ret$6 = copyToArray(args);
1012
+ tmp_5 = tmp_6.xbv(executable, tmp$ret$6, options);
1013
+ } else {
1014
+ // Inline function 'kotlin.collections.toTypedArray' call
1015
+ var tmp$ret$7 = copyToArray(args);
1016
+ tmp_5 = new NodeStartedProcess(require('child_process').spawn(executable, tmp$ret$7, options));
1017
+ }
1018
+ tmp_4 = tmp_5;
1019
+ } catch ($p) {
1020
+ var tmp_7;
1021
+ if ($p instanceof Error) {
1022
+ var error = $p;
1023
+ throw new ProcessLaunchException('Cannot start process ' + request.m5o_1, error);
1024
+ } else {
1025
+ throw $p;
1026
+ }
1027
+ }
1028
+ return tmp_4;
1029
+ }
1030
+ function await_0($this, started, inheritStdio, executable, $completion) {
1031
+ var tmp = new $awaitCOROUTINE$($this, started, inheritStdio, executable, $completion);
1032
+ tmp.y8_1 = Unit_instance;
1033
+ tmp.z8_1 = null;
1034
+ return tmp.e9();
1035
+ }
1036
+ function stopIfRunning($this, started, closed, $completion) {
1037
+ var tmp = new $stopIfRunningCOROUTINE$($this, started, closed, $completion);
1038
+ tmp.y8_1 = Unit_instance;
1039
+ tmp.z8_1 = null;
1040
+ return tmp.e9();
1041
+ }
1042
+ function stop($this, started, signal) {
1043
+ var child = started.ebx_1;
1044
+ try {
1045
+ if (!(started.fbx_1 == null)) {
1046
+ started.fbx_1.jbx();
1047
+ } else {
1048
+ var tmp = child.pid;
1049
+ get_nodeProcess().kill(-((!(tmp == null) ? typeof tmp === 'number' : false) ? tmp : THROW_CCE()) | 0, signal);
1050
+ }
1051
+ } catch ($p) {
1052
+ if ($p instanceof Error) {
1053
+ var error = $p;
1054
+ // Inline function 'kotlin.js.asDynamic' call
1055
+ if (error.code != 'ESRCH') {
1056
+ child.kill(signal);
1057
+ }
1058
+ } else {
1059
+ throw $p;
1060
+ }
1061
+ }
1062
+ }
1063
+ function NodeProcessRunner$start$lambda(value) {
1064
+ var tmp$ret$3;
1065
+ $l$block: {
1066
+ // Inline function 'kotlin.text.any' call
1067
+ var inductionVariable = 0;
1068
+ while (inductionVariable < charSequenceLength(value)) {
1069
+ var element = charSequenceGet(value, inductionVariable);
1070
+ inductionVariable = inductionVariable + 1 | 0;
1071
+ var tmp;
1072
+ var tmp_0;
1073
+ // Inline function 'kotlin.code' call
1074
+ if (Char__toInt_impl_vasixd(element) < 32) {
1075
+ tmp_0 = true;
1076
+ } else {
1077
+ // Inline function 'kotlin.code' call
1078
+ tmp_0 = Char__toInt_impl_vasixd(element) === 127;
1079
+ }
1080
+ if (tmp_0) {
1081
+ tmp = true;
1082
+ } else {
1083
+ tmp = contains('"%^!', element);
1084
+ }
1085
+ if (tmp) {
1086
+ tmp$ret$3 = true;
1087
+ break $l$block;
1088
+ }
1089
+ }
1090
+ tmp$ret$3 = false;
1091
+ }
1092
+ if (tmp$ret$3) {
1093
+ throw new ProcessLaunchException('Windows batch arguments cannot contain quotes, expansion or control characters');
1094
+ }
1095
+ return '"' + value + '"';
1096
+ }
1097
+ function NodeProcessRunner$await$lambda($completed, $executable) {
1098
+ return function (error) {
1099
+ $completed.i13(new ProcessLaunchException('Cannot start process ' + $executable + ': ' + error.message));
1100
+ return Unit_instance;
1101
+ };
1102
+ }
1103
+ function NodeProcessRunner$await$lambda_0($inheritStdio, $output, $started, $completed, $executable, $closed) {
1104
+ return function (code, signal) {
1105
+ var signals = require('os').constants.signals;
1106
+ var tmp;
1107
+ if (code != null) {
1108
+ tmp = (!(code == null) ? typeof code === 'number' : false) ? code : THROW_CCE();
1109
+ } else {
1110
+ var tmp_0 = signals[signal];
1111
+ var tmp0_elvis_lhs = (!(tmp_0 == null) ? typeof tmp_0 === 'number' : false) ? tmp_0 : null;
1112
+ tmp = 128 + (tmp0_elvis_lhs == null ? 0 : tmp0_elvis_lhs) | 0;
1113
+ }
1114
+ var exitCode = tmp;
1115
+ var captured = $inheritStdio ? '' : $output.pbx();
1116
+ var tmp1_safe_receiver = $started.fbx_1;
1117
+ var launchFailure = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.qbx();
1118
+ if (launchFailure == null) {
1119
+ $completed.y12(new ProcessResult(exitCode, captured));
1120
+ } else {
1121
+ $completed.i13(new ProcessLaunchException('Cannot start process ' + $executable + ': ' + launchFailure));
1122
+ }
1123
+ $closed.y12(Unit_instance);
1124
+ return Unit_instance;
1125
+ };
1126
+ }
1127
+ function NodeProcessRunner$await$slambda($started, $closed, $child, $failure, $close, $inheritStdio, $output, resultContinuation) {
1128
+ this.zbx_1 = $started;
1129
+ this.aby_1 = $closed;
1130
+ this.bby_1 = $child;
1131
+ this.cby_1 = $failure;
1132
+ this.dby_1 = $close;
1133
+ this.eby_1 = $inheritStdio;
1134
+ this.fby_1 = $output;
1135
+ CoroutineImpl.call(this, resultContinuation);
1136
+ }
1137
+ protoOf(NodeProcessRunner$await$slambda).o1y = function ($this$withContext, $completion) {
1138
+ var tmp = this.p1y($this$withContext, $completion);
1139
+ tmp.y8_1 = Unit_instance;
1140
+ tmp.z8_1 = null;
1141
+ return tmp.e9();
1142
+ };
1143
+ protoOf(NodeProcessRunner$await$slambda).q9 = function (p1, $completion) {
1144
+ return this.o1y((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
1145
+ };
1146
+ protoOf(NodeProcessRunner$await$slambda).e9 = function () {
1147
+ var suspendResult = this.y8_1;
1148
+ $sm: do
1149
+ try {
1150
+ var tmp = this.w8_1;
1151
+ switch (tmp) {
1152
+ case 0:
1153
+ this.x8_1 = 5;
1154
+ this.w8_1 = 1;
1155
+ continue $sm;
1156
+ case 1:
1157
+ this.x8_1 = 4;
1158
+ this.w8_1 = 2;
1159
+ suspendResult = stopIfRunning(NodeProcessRunner_instance, this.zbx_1, this.aby_1, this);
1160
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1161
+ return suspendResult;
1162
+ }
1163
+
1164
+ continue $sm;
1165
+ case 2:
1166
+ this.x8_1 = 5;
1167
+ this.w8_1 = 3;
1168
+ continue $sm;
1169
+ case 3:
1170
+ this.x8_1 = 5;
1171
+ this.bby_1.removeListener('error', this.cby_1);
1172
+ this.bby_1.removeListener('close', this.dby_1);
1173
+ if (!this.eby_1) {
1174
+ this.bby_1.stdout.removeListener('data', this.fby_1.nbx_1);
1175
+ this.bby_1.stderr.removeListener('data', this.fby_1.obx_1);
1176
+ this.bby_1.stdout.destroy();
1177
+ this.bby_1.stderr.destroy();
1178
+ }
1179
+
1180
+ var tmp0_safe_receiver = this.zbx_1.fbx_1;
1181
+ if (tmp0_safe_receiver == null)
1182
+ null;
1183
+ else {
1184
+ tmp0_safe_receiver.p3();
1185
+ }
1186
+
1187
+ return Unit_instance;
1188
+ case 4:
1189
+ this.x8_1 = 5;
1190
+ var t = this.z8_1;
1191
+ this.bby_1.removeListener('error', this.cby_1);
1192
+ this.bby_1.removeListener('close', this.dby_1);
1193
+ if (!this.eby_1) {
1194
+ this.bby_1.stdout.removeListener('data', this.fby_1.nbx_1);
1195
+ this.bby_1.stderr.removeListener('data', this.fby_1.obx_1);
1196
+ this.bby_1.stdout.destroy();
1197
+ this.bby_1.stderr.destroy();
1198
+ }
1199
+
1200
+ var tmp0_safe_receiver_0 = this.zbx_1.fbx_1;
1201
+ if (tmp0_safe_receiver_0 == null)
1202
+ null;
1203
+ else {
1204
+ tmp0_safe_receiver_0.p3();
1205
+ }
1206
+
1207
+ throw t;
1208
+ case 5:
1209
+ throw this.z8_1;
1210
+ }
1211
+ } catch ($p) {
1212
+ var e = $p;
1213
+ if (this.x8_1 === 5) {
1214
+ throw e;
1215
+ } else {
1216
+ this.w8_1 = this.x8_1;
1217
+ this.z8_1 = e;
1218
+ }
1219
+ }
1220
+ while (true);
1221
+ };
1222
+ protoOf(NodeProcessRunner$await$slambda).p1y = function ($this$withContext, completion) {
1223
+ var i = new NodeProcessRunner$await$slambda(this.zbx_1, this.aby_1, this.bby_1, this.cby_1, this.dby_1, this.eby_1, this.fby_1, completion);
1224
+ i.gby_1 = $this$withContext;
1225
+ return i;
1226
+ };
1227
+ function NodeProcessRunner$await$slambda_0($started, $closed, $child, $failure, $close, $inheritStdio, $output, resultContinuation) {
1228
+ var i = new NodeProcessRunner$await$slambda($started, $closed, $child, $failure, $close, $inheritStdio, $output, resultContinuation);
1229
+ var l = function ($this$withContext, $completion) {
1230
+ return i.o1y($this$withContext, $completion);
1231
+ };
1232
+ l.$arity = 1;
1233
+ return l;
1234
+ }
1235
+ function NodeProcessRunner$stopIfRunning$slambda($closed, resultContinuation) {
1236
+ this.pby_1 = $closed;
1237
+ CoroutineImpl.call(this, resultContinuation);
1238
+ }
1239
+ protoOf(NodeProcessRunner$stopIfRunning$slambda).d4w = function ($this$withTimeoutOrNull, $completion) {
1240
+ var tmp = this.p1y($this$withTimeoutOrNull, $completion);
1241
+ tmp.y8_1 = Unit_instance;
1242
+ tmp.z8_1 = null;
1243
+ return tmp.e9();
1244
+ };
1245
+ protoOf(NodeProcessRunner$stopIfRunning$slambda).q9 = function (p1, $completion) {
1246
+ return this.d4w((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
1247
+ };
1248
+ protoOf(NodeProcessRunner$stopIfRunning$slambda).e9 = function () {
1249
+ var suspendResult = this.y8_1;
1250
+ $sm: do
1251
+ try {
1252
+ var tmp = this.w8_1;
1253
+ switch (tmp) {
1254
+ case 0:
1255
+ this.x8_1 = 2;
1256
+ this.w8_1 = 1;
1257
+ suspendResult = this.pby_1.kz(this);
1258
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1259
+ return suspendResult;
1260
+ }
1261
+
1262
+ continue $sm;
1263
+ case 1:
1264
+ return true;
1265
+ case 2:
1266
+ throw this.z8_1;
1267
+ }
1268
+ } catch ($p) {
1269
+ var e = $p;
1270
+ if (this.x8_1 === 2) {
1271
+ throw e;
1272
+ } else {
1273
+ this.w8_1 = this.x8_1;
1274
+ this.z8_1 = e;
1275
+ }
1276
+ }
1277
+ while (true);
1278
+ };
1279
+ protoOf(NodeProcessRunner$stopIfRunning$slambda).p1y = function ($this$withTimeoutOrNull, completion) {
1280
+ var i = new NodeProcessRunner$stopIfRunning$slambda(this.pby_1, completion);
1281
+ i.qby_1 = $this$withTimeoutOrNull;
1282
+ return i;
1283
+ };
1284
+ function NodeProcessRunner$stopIfRunning$slambda_0($closed, resultContinuation) {
1285
+ var i = new NodeProcessRunner$stopIfRunning$slambda($closed, resultContinuation);
1286
+ var l = function ($this$withTimeoutOrNull, $completion) {
1287
+ return i.d4w($this$withTimeoutOrNull, $completion);
1288
+ };
1289
+ l.$arity = 1;
1290
+ return l;
1291
+ }
1292
+ function NodeProcessRunner$stopIfRunning$slambda_1($closed, resultContinuation) {
1293
+ this.zby_1 = $closed;
1294
+ CoroutineImpl.call(this, resultContinuation);
1295
+ }
1296
+ protoOf(NodeProcessRunner$stopIfRunning$slambda_1).o1y = function ($this$withTimeoutOrNull, $completion) {
1297
+ var tmp = this.p1y($this$withTimeoutOrNull, $completion);
1298
+ tmp.y8_1 = Unit_instance;
1299
+ tmp.z8_1 = null;
1300
+ return tmp.e9();
1301
+ };
1302
+ protoOf(NodeProcessRunner$stopIfRunning$slambda_1).q9 = function (p1, $completion) {
1303
+ return this.o1y((!(p1 == null) ? isInterface(p1, CoroutineScope) : false) ? p1 : THROW_CCE(), $completion);
1304
+ };
1305
+ protoOf(NodeProcessRunner$stopIfRunning$slambda_1).e9 = function () {
1306
+ var suspendResult = this.y8_1;
1307
+ $sm: do
1308
+ try {
1309
+ var tmp = this.w8_1;
1310
+ switch (tmp) {
1311
+ case 0:
1312
+ this.x8_1 = 2;
1313
+ this.w8_1 = 1;
1314
+ suspendResult = this.zby_1.kz(this);
1315
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1316
+ return suspendResult;
1317
+ }
1318
+
1319
+ continue $sm;
1320
+ case 1:
1321
+ return Unit_instance;
1322
+ case 2:
1323
+ throw this.z8_1;
1324
+ }
1325
+ } catch ($p) {
1326
+ var e = $p;
1327
+ if (this.x8_1 === 2) {
1328
+ throw e;
1329
+ } else {
1330
+ this.w8_1 = this.x8_1;
1331
+ this.z8_1 = e;
1332
+ }
1333
+ }
1334
+ while (true);
1335
+ };
1336
+ protoOf(NodeProcessRunner$stopIfRunning$slambda_1).p1y = function ($this$withTimeoutOrNull, completion) {
1337
+ var i = new NodeProcessRunner$stopIfRunning$slambda_1(this.zby_1, completion);
1338
+ i.abz_1 = $this$withTimeoutOrNull;
1339
+ return i;
1340
+ };
1341
+ function NodeProcessRunner$stopIfRunning$slambda_2($closed, resultContinuation) {
1342
+ var i = new NodeProcessRunner$stopIfRunning$slambda_1($closed, resultContinuation);
1343
+ var l = function ($this$withTimeoutOrNull, $completion) {
1344
+ return i.o1y($this$withTimeoutOrNull, $completion);
1345
+ };
1346
+ l.$arity = 1;
1347
+ return l;
1348
+ }
1349
+ function $awaitCOROUTINE$(_this__u8e3s4, started, inheritStdio, executable, resultContinuation) {
1350
+ CoroutineImpl.call(this, resultContinuation);
1351
+ this.gbw_1 = _this__u8e3s4;
1352
+ this.hbw_1 = started;
1353
+ this.ibw_1 = inheritStdio;
1354
+ this.jbw_1 = executable;
1355
+ }
1356
+ protoOf($awaitCOROUTINE$).e9 = function () {
1357
+ var suspendResult = this.y8_1;
1358
+ $sm: do
1359
+ try {
1360
+ var tmp = this.w8_1;
1361
+ switch (tmp) {
1362
+ case 0:
1363
+ this.x8_1 = 10;
1364
+ this.obw_1 = this.hbw_1.ebx_1;
1365
+ this.sbw_1 = CompletableDeferred();
1366
+ this.pbw_1 = CompletableDeferred();
1367
+ this.lbw_1 = new NodeProcessOutput();
1368
+ var tmp_0 = this;
1369
+ tmp_0.nbw_1 = NodeProcessRunner$await$lambda(this.sbw_1, this.jbw_1);
1370
+ var tmp_1 = this;
1371
+ tmp_1.mbw_1 = NodeProcessRunner$await$lambda_0(this.ibw_1, this.lbw_1, this.hbw_1, this.sbw_1, this.jbw_1, this.pbw_1);
1372
+ this.obw_1.on('error', this.nbw_1);
1373
+ this.obw_1.on('close', this.mbw_1);
1374
+ if (!this.ibw_1) {
1375
+ this.obw_1.stdout.on('data', this.lbw_1.nbx_1);
1376
+ this.obw_1.stderr.on('data', this.lbw_1.obx_1);
1377
+ }
1378
+
1379
+ this.w8_1 = 1;
1380
+ continue $sm;
1381
+ case 1:
1382
+ this.w8_1 = 2;
1383
+ continue $sm;
1384
+ case 2:
1385
+ this.x8_1 = 8;
1386
+ this.w8_1 = 3;
1387
+ suspendResult = this.sbw_1.kz(this);
1388
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1389
+ return suspendResult;
1390
+ }
1391
+
1392
+ continue $sm;
1393
+ case 3:
1394
+ this.rbw_1 = suspendResult;
1395
+ this.x8_1 = 10;
1396
+ this.w8_1 = 4;
1397
+ var tmp_2 = this;
1398
+ continue $sm;
1399
+ case 4:
1400
+ this.qbw_1 = this.rbw_1;
1401
+ this.x8_1 = 10;
1402
+ this.w8_1 = 5;
1403
+ var tmp_3 = NonCancellable_getInstance();
1404
+ suspendResult = withContext(tmp_3, NodeProcessRunner$await$slambda_0(this.hbw_1, this.pbw_1, this.obw_1, this.nbw_1, this.mbw_1, this.ibw_1, this.lbw_1, null), this);
1405
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1406
+ return suspendResult;
1407
+ }
1408
+
1409
+ continue $sm;
1410
+ case 5:
1411
+ return this.qbw_1;
1412
+ case 6:
1413
+ this.x8_1 = 10;
1414
+ this.w8_1 = 7;
1415
+ var tmp_4 = NonCancellable_getInstance();
1416
+ suspendResult = withContext(tmp_4, NodeProcessRunner$await$slambda_0(this.hbw_1, this.pbw_1, this.obw_1, this.nbw_1, this.mbw_1, this.ibw_1, this.lbw_1, null), this);
1417
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1418
+ return suspendResult;
1419
+ }
1420
+
1421
+ continue $sm;
1422
+ case 7:
1423
+ return Unit_instance;
1424
+ case 8:
1425
+ this.x8_1 = 10;
1426
+ this.kbw_1 = this.z8_1;
1427
+ this.w8_1 = 9;
1428
+ var tmp_5 = NonCancellable_getInstance();
1429
+ suspendResult = withContext(tmp_5, NodeProcessRunner$await$slambda_0(this.hbw_1, this.pbw_1, this.obw_1, this.nbw_1, this.mbw_1, this.ibw_1, this.lbw_1, null), this);
1430
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1431
+ return suspendResult;
1432
+ }
1433
+
1434
+ continue $sm;
1435
+ case 9:
1436
+ throw this.kbw_1;
1437
+ case 10:
1438
+ throw this.z8_1;
1439
+ }
1440
+ } catch ($p) {
1441
+ var e = $p;
1442
+ if (this.x8_1 === 10) {
1443
+ throw e;
1444
+ } else {
1445
+ this.w8_1 = this.x8_1;
1446
+ this.z8_1 = e;
1447
+ }
1448
+ }
1449
+ while (true);
1450
+ };
1451
+ function $stopIfRunningCOROUTINE$(_this__u8e3s4, started, closed, resultContinuation) {
1452
+ CoroutineImpl.call(this, resultContinuation);
1453
+ this.bbx_1 = _this__u8e3s4;
1454
+ this.cbx_1 = started;
1455
+ this.dbx_1 = closed;
1456
+ }
1457
+ protoOf($stopIfRunningCOROUTINE$).e9 = function () {
1458
+ var suspendResult = this.y8_1;
1459
+ $sm: do
1460
+ try {
1461
+ var tmp = this.w8_1;
1462
+ switch (tmp) {
1463
+ case 0:
1464
+ this.x8_1 = 4;
1465
+ if (this.dbx_1.rw() || this.cbx_1.ebx_1.pid == null)
1466
+ return Unit_instance;
1467
+ stop(this.bbx_1, this.cbx_1, 'SIGTERM');
1468
+ this.w8_1 = 1;
1469
+ var tmp_0 = new Long(2000, 0);
1470
+ suspendResult = withTimeoutOrNull(tmp_0, NodeProcessRunner$stopIfRunning$slambda_0(this.dbx_1, null), this);
1471
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1472
+ return suspendResult;
1473
+ }
1474
+
1475
+ continue $sm;
1476
+ case 1:
1477
+ var stopped = suspendResult;
1478
+ if (this.cbx_1.fbx_1 == null || !(stopped === true)) {
1479
+ stop(this.bbx_1, this.cbx_1, 'SIGKILL');
1480
+ }
1481
+
1482
+ if (!(stopped === true)) {
1483
+ this.w8_1 = 2;
1484
+ var tmp_1 = new Long(3000, 0);
1485
+ suspendResult = withTimeoutOrNull(tmp_1, NodeProcessRunner$stopIfRunning$slambda_2(this.dbx_1, null), this);
1486
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1487
+ return suspendResult;
1488
+ }
1489
+ continue $sm;
1490
+ } else {
1491
+ this.w8_1 = 3;
1492
+ continue $sm;
1493
+ }
1494
+
1495
+ case 2:
1496
+ this.w8_1 = 3;
1497
+ continue $sm;
1498
+ case 3:
1499
+ return Unit_instance;
1500
+ case 4:
1501
+ throw this.z8_1;
1502
+ }
1503
+ } catch ($p) {
1504
+ var e = $p;
1505
+ if (this.x8_1 === 4) {
1506
+ throw e;
1507
+ } else {
1508
+ this.w8_1 = this.x8_1;
1509
+ this.z8_1 = e;
1510
+ }
1511
+ }
1512
+ while (true);
1513
+ };
1514
+ function NodeProcessRunner() {
1515
+ }
1516
+ protoOf(NodeProcessRunner).j5o = function (request, $completion) {
1517
+ // Inline function 'kotlin.js.getCoroutineContext' call
1518
+ var tmp$ret$0 = $completion.c9();
1519
+ ensureActive(tmp$ret$0);
1520
+ var windows = get_nodeProcess().platform == 'win32';
1521
+ var started = start(this, request, windows);
1522
+ return await_0(this, started, request.q5o_1, request.m5o_1, $completion);
1523
+ };
1524
+ var NodeProcessRunner_instance;
1525
+ function NodeProcessRunner_getInstance() {
1526
+ return NodeProcessRunner_instance;
1527
+ }
1528
+ function NodeProcessOutput$stdout$lambda(this$0) {
1529
+ return function (chunk) {
1530
+ this$0.kbx_1.push(this$0.lbx_1.write(chunk));
1531
+ return Unit_instance;
1532
+ };
1533
+ }
1534
+ function NodeProcessOutput$stderr$lambda(this$0) {
1535
+ return function (chunk) {
1536
+ this$0.kbx_1.push(this$0.mbx_1.write(chunk));
1537
+ return Unit_instance;
1538
+ };
1539
+ }
1540
+ function NodeProcessOutput() {
1541
+ this.kbx_1 = [];
1542
+ this.lbx_1 = new (require('string_decoder').StringDecoder)('utf8');
1543
+ this.mbx_1 = new (require('string_decoder').StringDecoder)('utf8');
1544
+ var tmp = this;
1545
+ tmp.nbx_1 = NodeProcessOutput$stdout$lambda(this);
1546
+ var tmp_0 = this;
1547
+ tmp_0.obx_1 = NodeProcessOutput$stderr$lambda(this);
1548
+ }
1549
+ protoOf(NodeProcessOutput).pbx = function () {
1550
+ var tmp = this.kbx_1.join('');
1551
+ var tmp_0 = (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
1552
+ var tmp_1 = this.lbx_1.end();
1553
+ var tmp_2 = tmp_0 + ((!(tmp_1 == null) ? typeof tmp_1 === 'string' : false) ? tmp_1 : THROW_CCE());
1554
+ var tmp_3 = this.mbx_1.end();
1555
+ return tmp_2 + ((!(tmp_3 == null) ? typeof tmp_3 === 'string' : false) ? tmp_3 : THROW_CCE());
1556
+ };
1557
+ function NodeStartedProcess(child, owner) {
1558
+ owner = owner === VOID ? null : owner;
1559
+ this.ebx_1 = child;
1560
+ this.fbx_1 = owner;
1561
+ }
1562
+ function WindowsProcessOwner$Companion$start$lambda(_unused_var__etf5q3) {
1563
+ return Unit_instance;
1564
+ }
1565
+ function Companion() {
1566
+ Companion_instance_0 = this;
1567
+ this.vbv_1 = require('fs');
1568
+ this.wbv_1 = "const fs = require('fs'), cp = require('child_process'), path = require('path');\nconst directory = process.argv[1], deadline = Date.now() + 10000;\nconst requestPath = path.join(directory, 'request.json');\nlet request;\ntry { request = JSON.parse(fs.readFileSync(requestPath, 'utf8')); }\ncatch (_) {\n fs.writeFileSync(path.join(directory, 'error'), 'cannot read launch request', {mode:384});\n process.exitCode = 126;\n} finally { fs.rmSync(requestPath, {force:true}); }\nif (!request) process.exit(126);\nconst timer = setInterval(() => {\n if (!fs.existsSync(path.join(directory, 'go'))) {\n if (Date.now() > deadline) {\n clearInterval(timer);\n fs.writeFileSync(path.join(directory, 'error'), 'handshake timeout', {mode:384});\n fs.rmSync(path.join(directory, 'request.json'), {force:true});\n process.exitCode = 126;\n }\n return;\n }\n clearInterval(timer);\n let failed = false;\n const failure = error => {\n failed = true;\n fs.writeFileSync(path.join(directory, 'error'), String(error.code || 'spawn failed'), {mode:384});\n process.exitCode = 126;\n };\n try {\n const child = cp.spawn(request.executable, request.args, {\n stdio:'inherit', env:request.environment, windowsVerbatimArguments:request.verbatim\n });\n child.on('error', failure);\n child.on('exit', (code, signal) => {\n if (!failed) process.exitCode = code == null\n ? 128 + (require('os').constants.signals[signal] || 0) : code;\n });\n } catch (error) { failure(error); }\n}, 10);";
1569
+ }
1570
+ protoOf(Companion).xbv = function (executable, args, options) {
1571
+ var job = WindowsJobs_getInstance().ebz_1(null, null);
1572
+ // Inline function 'kotlin.check' call
1573
+ if (!(job != null)) {
1574
+ var message = 'Cannot create process job';
1575
+ throw IllegalStateException_init_$Create$(toString(message));
1576
+ }
1577
+ var directory = null;
1578
+ var child = null;
1579
+ try {
1580
+ var limits = Buffer.alloc(WindowsJobs_getInstance().dbz_1 === 8 ? 144 : 112);
1581
+ limits.writeUInt32LE(8192, 16);
1582
+ // Inline function 'kotlin.check' call
1583
+ if (!(WindowsJobs_getInstance().fbz_1(job, 9, limits, limits.length) != 0)) {
1584
+ var message_0 = 'Cannot configure process job';
1585
+ throw IllegalStateException_init_$Create$(toString(message_0));
1586
+ }
1587
+ var tmp = this.vbv_1.mkdtempSync(require('os').tmpdir() + '/dsbuilder-process-');
1588
+ directory = (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
1589
+ var request = {};
1590
+ request.executable = executable;
1591
+ request.args = args;
1592
+ request.environment = options.env;
1593
+ request.verbatim = options.windowsVerbatimArguments == true;
1594
+ this.vbv_1.writeFileSync(directory + '/request.json', JSON.stringify(request), {mode: 384});
1595
+ var supervisorOptions = Object.assign({}, options);
1596
+ supervisorOptions.windowsVerbatimArguments = false;
1597
+ supervisorOptions.env = Object.assign({}, options.env);
1598
+ var tmp_0 = Object.keys(supervisorOptions.env);
1599
+ // Inline function 'kotlin.collections.filter' call
1600
+ var tmp0 = (!(tmp_0 == null) ? isArray(tmp_0) : false) ? tmp_0 : THROW_CCE();
1601
+ // Inline function 'kotlin.collections.filterTo' call
1602
+ var destination = ArrayList_init_$Create$_0();
1603
+ var inductionVariable = 0;
1604
+ var last = tmp0.length;
1605
+ while (inductionVariable < last) {
1606
+ var element = tmp0[inductionVariable];
1607
+ inductionVariable = inductionVariable + 1 | 0;
1608
+ if (equals_0(element, 'NODE_OPTIONS', true)) {
1609
+ destination.j(element);
1610
+ }
1611
+ }
1612
+ // Inline function 'kotlin.collections.forEach' call
1613
+ var _iterator__ex2g4s = destination.l();
1614
+ while (_iterator__ex2g4s.m()) {
1615
+ var element_0 = _iterator__ex2g4s.n();
1616
+ Reflect.deleteProperty(supervisorOptions.env, element_0);
1617
+ }
1618
+ var tmp_1 = get_nodeProcess().execPath;
1619
+ // Inline function 'kotlin.arrayOf' call
1620
+ // Inline function 'kotlin.js.unsafeCast' call
1621
+ // Inline function 'kotlin.js.asDynamic' call
1622
+ var tmp$ret$11 = ['-e', this.wbv_1, directory];
1623
+ child = require('child_process').spawn(tmp_1, tmp$ret$11, supervisorOptions);
1624
+ child.once('error', WindowsProcessOwner$Companion$start$lambda);
1625
+ var handle = WindowsJobs_getInstance().gbz_1(257, 0, child.pid);
1626
+ // Inline function 'kotlin.check' call
1627
+ if (!(handle != null)) {
1628
+ var message_1 = 'Cannot open process supervisor';
1629
+ throw IllegalStateException_init_$Create$(toString(message_1));
1630
+ }
1631
+ try {
1632
+ // Inline function 'kotlin.check' call
1633
+ if (!(WindowsJobs_getInstance().hbz_1(job, handle) != 0)) {
1634
+ var message_2 = 'Cannot own process supervisor';
1635
+ throw IllegalStateException_init_$Create$(toString(message_2));
1636
+ }
1637
+ }finally {
1638
+ WindowsJobs_getInstance().jbz_1(handle);
1639
+ }
1640
+ this.vbv_1.writeFileSync(directory + '/go', '', {mode: 384});
1641
+ return new NodeStartedProcess(child, new WindowsProcessOwner(directory, job));
1642
+ } catch ($p) {
1643
+ if ($p instanceof Error) {
1644
+ var error = $p;
1645
+ if (child != null) {
1646
+ child.kill('SIGKILL');
1647
+ }
1648
+ WindowsJobs_getInstance().jbz_1(job);
1649
+ if (!(directory == null)) {
1650
+ this.vbv_1.rmSync(directory, {recursive: true, force: true});
1651
+ }
1652
+ throw new ProcessLaunchException('Cannot start process ' + executable, error);
1653
+ } else {
1654
+ throw $p;
1655
+ }
1656
+ }
1657
+ };
1658
+ var Companion_instance_0;
1659
+ function Companion_getInstance() {
1660
+ if (Companion_instance_0 == null)
1661
+ new Companion();
1662
+ return Companion_instance_0;
1663
+ }
1664
+ function WindowsProcessOwner(directory, job) {
1665
+ Companion_getInstance();
1666
+ this.gbx_1 = directory;
1667
+ this.hbx_1 = job;
1668
+ this.ibx_1 = false;
1669
+ }
1670
+ protoOf(WindowsProcessOwner).qbx = function () {
1671
+ var path = this.gbx_1 + '/error';
1672
+ var tmp;
1673
+ var tmp_0 = Companion_getInstance().vbv_1.existsSync(path);
1674
+ if ((!(tmp_0 == null) ? typeof tmp_0 === 'boolean' : false) ? tmp_0 : THROW_CCE()) {
1675
+ var tmp_1 = Companion_getInstance().vbv_1.readFileSync(path, 'utf8');
1676
+ tmp = (!(tmp_1 == null) ? typeof tmp_1 === 'string' : false) ? tmp_1 : THROW_CCE();
1677
+ } else {
1678
+ tmp = null;
1679
+ }
1680
+ return tmp;
1681
+ };
1682
+ protoOf(WindowsProcessOwner).jbx = function () {
1683
+ if (!this.ibx_1) {
1684
+ // Inline function 'kotlin.check' call
1685
+ if (!(WindowsJobs_getInstance().ibz_1(this.hbx_1, 130) != 0)) {
1686
+ var message = 'Cannot terminate process job';
1687
+ throw IllegalStateException_init_$Create$(toString(message));
1688
+ }
1689
+ }
1690
+ };
1691
+ protoOf(WindowsProcessOwner).p3 = function () {
1692
+ if (this.ibx_1)
1693
+ return Unit_instance;
1694
+ this.ibx_1 = true;
1695
+ WindowsJobs_getInstance().jbz_1(this.hbx_1);
1696
+ Companion_getInstance().vbv_1.rmSync(this.gbx_1, {recursive: true, force: true});
1697
+ };
1698
+ function WindowsJobs() {
1699
+ WindowsJobs_instance = this;
1700
+ this.bbz_1 = require('koffi');
1701
+ this.cbz_1 = this.bbz_1.load('kernel32.dll');
1702
+ var tmp = this;
1703
+ var tmp_0 = this.bbz_1.sizeof('void *');
1704
+ tmp.dbz_1 = (!(tmp_0 == null) ? typeof tmp_0 === 'number' : false) ? tmp_0 : THROW_CCE();
1705
+ var tmp_1 = this;
1706
+ // Inline function 'kotlin.arrayOf' call
1707
+ // Inline function 'kotlin.js.unsafeCast' call
1708
+ // Inline function 'kotlin.js.asDynamic' call
1709
+ var tmp$ret$2 = ['void *', 'str16'];
1710
+ tmp_1.ebz_1 = this.cbz_1.func('__stdcall', 'CreateJobObjectW', 'void *', tmp$ret$2);
1711
+ var tmp_2 = this;
1712
+ // Inline function 'kotlin.arrayOf' call
1713
+ // Inline function 'kotlin.js.unsafeCast' call
1714
+ // Inline function 'kotlin.js.asDynamic' call
1715
+ var tmp$ret$5 = ['void *', 'int', 'void *', 'uint32_t'];
1716
+ tmp_2.fbz_1 = this.cbz_1.func('__stdcall', 'SetInformationJobObject', 'int', tmp$ret$5);
1717
+ var tmp_3 = this;
1718
+ // Inline function 'kotlin.arrayOf' call
1719
+ // Inline function 'kotlin.js.unsafeCast' call
1720
+ // Inline function 'kotlin.js.asDynamic' call
1721
+ var tmp$ret$8 = ['uint32_t', 'int', 'uint32_t'];
1722
+ tmp_3.gbz_1 = this.cbz_1.func('__stdcall', 'OpenProcess', 'void *', tmp$ret$8);
1723
+ var tmp_4 = this;
1724
+ // Inline function 'kotlin.arrayOf' call
1725
+ // Inline function 'kotlin.js.unsafeCast' call
1726
+ // Inline function 'kotlin.js.asDynamic' call
1727
+ var tmp$ret$11 = ['void *', 'void *'];
1728
+ tmp_4.hbz_1 = this.cbz_1.func('__stdcall', 'AssignProcessToJobObject', 'int', tmp$ret$11);
1729
+ var tmp_5 = this;
1730
+ // Inline function 'kotlin.arrayOf' call
1731
+ // Inline function 'kotlin.js.unsafeCast' call
1732
+ // Inline function 'kotlin.js.asDynamic' call
1733
+ var tmp$ret$14 = ['void *', 'uint32_t'];
1734
+ tmp_5.ibz_1 = this.cbz_1.func('__stdcall', 'TerminateJobObject', 'int', tmp$ret$14);
1735
+ var tmp_6 = this;
1736
+ // Inline function 'kotlin.arrayOf' call
1737
+ // Inline function 'kotlin.js.unsafeCast' call
1738
+ // Inline function 'kotlin.js.asDynamic' call
1739
+ var tmp$ret$17 = ['void *'];
1740
+ tmp_6.jbz_1 = this.cbz_1.func('__stdcall', 'CloseHandle', 'int', tmp$ret$17);
1741
+ }
1742
+ var WindowsJobs_instance;
1743
+ function WindowsJobs_getInstance() {
1744
+ if (WindowsJobs_instance == null)
1745
+ new WindowsJobs();
1746
+ return WindowsJobs_instance;
1747
+ }
1748
+ //region block: init
1749
+ NodeCredentialLockPlatform_instance = new NodeCredentialLockPlatform();
1750
+ NodeCredentialStoreFileSystem_instance = new NodeCredentialStoreFileSystem();
1751
+ NodeWorkspaceFileSystem_instance = new NodeWorkspaceFileSystem();
1752
+ NodeProcessRunner_instance = new NodeProcessRunner();
1753
+ //endregion
1754
+ //region block: exports
1755
+ _.$_$ = _.$_$ || {};
1756
+ _.$_$.a = createNodeClientRuntime;
1757
+ _.$_$.b = NodeCredentialStoreFileSystem_instance;
1758
+ _.$_$.c = NodeCredentialStoreLock_getInstance;
1759
+ //endregion
1760
+ return _;
1761
+ }(module.exports, require('./ktor-ktor-client-core.js'), require('./design-system-builder-frontend-core-network.js'), require('./design-system-builder-frontend-core-auth.js'), require('./kotlin-kotlin-stdlib.js'), require('./design-system-builder-frontend-core-application.js'), require('./design-system-builder-frontend-core-workspace.js'), require('./kotlinx-coroutines-core.js'), require('./design-system-builder-frontend-core-process.js')));
1762
+
1763
+ //# sourceMappingURL=design-system-builder-frontend-runtime-node.js.map