@dmarket/p2p-tracker-headless 0.0.0-bootstrap.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 (102) hide show
  1. package/Kotlin-DateTime-library-kotlinx-datetime.mjs +4 -0
  2. package/Kotlin-DateTime-library-kotlinx-datetime.mjs.map +1 -0
  3. package/VERSION +14 -0
  4. package/dmarket-p2p-tracker-core-domain.mjs +16699 -0
  5. package/dmarket-p2p-tracker-core-domain.mjs.map +1 -0
  6. package/index.d.ts +195 -0
  7. package/kotlin-kotlin-stdlib.mjs +18834 -0
  8. package/kotlin-kotlin-stdlib.mjs.map +1 -0
  9. package/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.mjs +4 -0
  10. package/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.mjs.map +1 -0
  11. package/kotlinx-atomicfu.mjs +251 -0
  12. package/kotlinx-atomicfu.mjs.map +1 -0
  13. package/kotlinx-browser.mjs +8 -0
  14. package/kotlinx-browser.mjs.map +1 -0
  15. package/kotlinx-coroutines-core.mjs +12437 -0
  16. package/kotlinx-coroutines-core.mjs.map +1 -0
  17. package/kotlinx-io-kotlinx-io-bytestring.mjs +202 -0
  18. package/kotlinx-io-kotlinx-io-bytestring.mjs.map +1 -0
  19. package/kotlinx-io-kotlinx-io-core.mjs +2034 -0
  20. package/kotlinx-io-kotlinx-io-core.mjs.map +1 -0
  21. package/kotlinx-serialization-kotlinx-serialization-core.mjs +6163 -0
  22. package/kotlinx-serialization-kotlinx-serialization-core.mjs.map +1 -0
  23. package/kotlinx-serialization-kotlinx-serialization-json-io.mjs +4 -0
  24. package/kotlinx-serialization-kotlinx-serialization-json-io.mjs.map +1 -0
  25. package/kotlinx-serialization-kotlinx-serialization-json.mjs +5957 -0
  26. package/kotlinx-serialization-kotlinx-serialization-json.mjs.map +1 -0
  27. package/ktor-ktor-client-content-negotiation.mjs +4 -0
  28. package/ktor-ktor-client-content-negotiation.mjs.map +1 -0
  29. package/ktor-ktor-client-core.mjs +9986 -0
  30. package/ktor-ktor-client-core.mjs.map +1 -0
  31. package/ktor-ktor-events.mjs +82 -0
  32. package/ktor-ktor-events.mjs.map +1 -0
  33. package/ktor-ktor-http-cio.mjs +2253 -0
  34. package/ktor-ktor-http-cio.mjs.map +1 -0
  35. package/ktor-ktor-http.mjs +3261 -0
  36. package/ktor-ktor-http.mjs.map +1 -0
  37. package/ktor-ktor-io.mjs +3546 -0
  38. package/ktor-ktor-io.mjs.map +1 -0
  39. package/ktor-ktor-openapi-schema.mjs +4 -0
  40. package/ktor-ktor-openapi-schema.mjs.map +1 -0
  41. package/ktor-ktor-serialization-kotlinx-json.mjs +4 -0
  42. package/ktor-ktor-serialization-kotlinx-json.mjs.map +1 -0
  43. package/ktor-ktor-serialization-kotlinx.mjs +4 -0
  44. package/ktor-ktor-serialization-kotlinx.mjs.map +1 -0
  45. package/ktor-ktor-serialization.mjs +4 -0
  46. package/ktor-ktor-serialization.mjs.map +1 -0
  47. package/ktor-ktor-sse.mjs +4 -0
  48. package/ktor-ktor-sse.mjs.map +1 -0
  49. package/ktor-ktor-utils.mjs +3427 -0
  50. package/ktor-ktor-utils.mjs.map +1 -0
  51. package/ktor-ktor-websocket-serialization.mjs +4 -0
  52. package/ktor-ktor-websocket-serialization.mjs.map +1 -0
  53. package/ktor-ktor-websockets.mjs +2589 -0
  54. package/ktor-ktor-websockets.mjs.map +1 -0
  55. package/p2p-tracker-core.mjs +41977 -0
  56. package/p2p-tracker-core.mjs.map +1 -0
  57. package/p2p-tracker-headless.mjs +4939 -0
  58. package/p2p-tracker-headless.mjs.map +1 -0
  59. package/package.json +58 -0
  60. package/pkg/README.md +104 -0
  61. package/pkg/client_wasm.d.ts +316 -0
  62. package/pkg/client_wasm.js +1199 -0
  63. package/pkg/client_wasm_bg.wasm +0 -0
  64. package/pkg/client_wasm_bg.wasm.d.ts +32 -0
  65. package/pkg/package.json +19 -0
  66. package/pkg/snippets/web-spawn-05868593a72e2d44/js/spawn.js +73 -0
  67. package/pkg/spawn.js +73 -0
  68. package/prover-child.mjs +2 -0
  69. package/transport/README.md +240 -0
  70. package/transport/dist/channel.d.ts +48 -0
  71. package/transport/dist/channel.d.ts.map +1 -0
  72. package/transport/dist/channel.js +150 -0
  73. package/transport/dist/channel.js.map +1 -0
  74. package/transport/dist/index.d.ts +10 -0
  75. package/transport/dist/index.d.ts.map +1 -0
  76. package/transport/dist/index.js +19 -0
  77. package/transport/dist/index.js.map +1 -0
  78. package/transport/dist/node.d.ts +4 -0
  79. package/transport/dist/node.d.ts.map +1 -0
  80. package/transport/dist/node.js +62 -0
  81. package/transport/dist/node.js.map +1 -0
  82. package/transport/dist/prover.d.ts +105 -0
  83. package/transport/dist/prover.d.ts.map +1 -0
  84. package/transport/dist/prover.js +139 -0
  85. package/transport/dist/prover.js.map +1 -0
  86. package/transport/dist/tcp.d.ts +38 -0
  87. package/transport/dist/tcp.d.ts.map +1 -0
  88. package/transport/dist/tcp.js +88 -0
  89. package/transport/dist/tcp.js.map +1 -0
  90. package/transport/dist/transport.d.ts +31 -0
  91. package/transport/dist/transport.d.ts.map +1 -0
  92. package/transport/dist/transport.js +75 -0
  93. package/transport/dist/transport.js.map +1 -0
  94. package/transport/dist/types.d.ts +162 -0
  95. package/transport/dist/types.d.ts.map +1 -0
  96. package/transport/dist/types.js +21 -0
  97. package/transport/dist/types.js.map +1 -0
  98. package/transport/dist/wasm-compat.d.ts +2 -0
  99. package/transport/dist/wasm-compat.d.ts.map +1 -0
  100. package/transport/dist/wasm-compat.js +15 -0
  101. package/transport/dist/wasm-compat.js.map +1 -0
  102. package/transport/package.json +34 -0
@@ -0,0 +1,4939 @@
1
+ import { join as join } from 'node:path';
2
+ import {
3
+ readFile as readFile,
4
+ mkdir as mkdir,
5
+ writeFile as writeFile,
6
+ rename as rename,
7
+ unlink as unlink,
8
+ } from 'node:fs/promises';
9
+ import { randomBytes as randomBytes } from 'node:crypto';
10
+ import {
11
+ noWhenBranchMatchedException2a6r7ubxgky5j as noWhenBranchMatchedException,
12
+ VOID3gxj6tk5isa35 as VOID,
13
+ Unit_instance3vdlo4e4f5ggx as Unit_instance,
14
+ to2cs3ny02qtbcb as to,
15
+ plus2lr02ok6jhhxu as plus,
16
+ protoOf180f3jzyo7rfj as protoOf,
17
+ listOf1jh22dvmctj1r as listOf,
18
+ collectionSizeOrDefault36dulx8yinfqm as collectionSizeOrDefault,
19
+ ArrayList_init_$Create$3o344dm0ee4ws as ArrayList_init_$Create$,
20
+ plus310ted5e4i90h as plus_0,
21
+ toMap1vec9topfei08 as toMap,
22
+ initMetadataForObject1cxne3s9w65el as initMetadataForObject,
23
+ coerceIn10f36k81le1mm as coerceIn,
24
+ Duration__times_impl_sfuzvp17ek9bs2u9cd6 as Duration__times_impl_sfuzvp,
25
+ Duration5ynfiptaqcrg as Duration,
26
+ minOf33o15vox9quzb as minOf,
27
+ numberRangeToNumber25vse2rgp6rs8 as numberRangeToNumber,
28
+ Companion_getInstance4z8fvmvpott5 as Companion_getInstance,
29
+ DurationUnit_SECONDS_getInstancehu17fry790z2 as DurationUnit_SECONDS_getInstance,
30
+ toDuration7gy6v749ektt as toDuration,
31
+ DurationUnit_MINUTES_getInstance3l9dh3bdonhtl as DurationUnit_MINUTES_getInstance,
32
+ initMetadataForCompanion1wyw17z38v6ac as initMetadataForCompanion,
33
+ Companion_getInstance10dt578q09swj as Companion_getInstance_0,
34
+ equals2au1ep9vhcato as equals,
35
+ initMetadataForClassbxx6q50dy2s7 as initMetadataForClass,
36
+ THROW_CCE2g6jy02ryeudk as THROW_CCE,
37
+ objectCreate1ve4bgxiu4x98 as objectCreate,
38
+ getStringHashCode26igk1bx568vk as getStringHashCode,
39
+ LazyThreadSafetyMode_PUBLICATION_getInstance20ynwq7b0awd8 as LazyThreadSafetyMode_PUBLICATION_getInstance,
40
+ lazy1261dae0bgscp as lazy,
41
+ toString30pk9tzaqopn as toString,
42
+ hashCodeq5arwsb9dgti as hashCode,
43
+ getKClass3t8tygqu4lcxf as getKClass,
44
+ initMetadataForInterface1egvbzx539z91 as initMetadataForInterface,
45
+ toString1pkumu07cwy4m as toString_0,
46
+ IllegalArgumentException_init_$Create$1mgk48flhjim3 as IllegalArgumentException_init_$Create$,
47
+ emptyList1g2z5xcrvp2zy as emptyList,
48
+ IllegalStateException_init_$Create$3394faf8tdm0h as IllegalStateException_init_$Create$,
49
+ CoroutineImpl2sn3kjnwmfr10 as CoroutineImpl,
50
+ get_COROUTINE_SUSPENDED3ujt3p13qm4iy as get_COROUTINE_SUSPENDED,
51
+ initMetadataForLambda3af3he42mmnh as initMetadataForLambda,
52
+ constructCallableReference23y65rf941mch as constructCallableReference,
53
+ Companion_instance1co2nkledm2ru as Companion_instance,
54
+ _Result___init__impl__xyqfz810za1hm0unrcw as _Result___init__impl__xyqfz8,
55
+ createFailure8paxfkfa5dc7 as createFailure,
56
+ isInterface3d6p8outrmvmk as isInterface,
57
+ _Duration___get_inWholeMilliseconds__impl__msfiry3vw6k01dbd1ii as _Duration___get_inWholeMilliseconds__impl__msfiry,
58
+ toNumberlmbpvqo27r53 as toNumber,
59
+ _Char___init__impl__6a9atx2yltdocdrxs4d as _Char___init__impl__6a9atx,
60
+ charArrayOf27f4r3dozbrk1 as charArrayOf,
61
+ split3d3yeauc4rm2n as split,
62
+ checkIndexOverflow3frtmheghr0th as checkIndexOverflow,
63
+ charSequenceLength3278n89t01tmv as charSequenceLength,
64
+ charCodeAt1yspne1d8erbm as charCodeAt,
65
+ toString336ienavfnzn0 as toString_1,
66
+ substring3saq8ornu0luv as substring,
67
+ joinToString1cxrrlmo0chqs as joinToString,
68
+ copyToArray2j022khrow2yi as copyToArray,
69
+ setOf45ia9pnfhe90 as setOf,
70
+ Regex_init_$Create$314aplwie2316 as Regex_init_$Create$,
71
+ isBlank1dvkhjjvox3p0 as isBlank,
72
+ startsWith26w8qjqapeeq6 as startsWith,
73
+ numberToLong345n6tb1n1i71 as numberToLong,
74
+ UnsupportedOperationException_init_$Create$2v432udyumtzy as UnsupportedOperationException_init_$Create$,
75
+ get_lastIndexx0qsydpfv3mu as get_lastIndex,
76
+ numberToInt1ygmcfwhs2fkq as numberToInt,
77
+ DurationUnit_MILLISECONDS_getInstancesewns20u1dyn as DurationUnit_MILLISECONDS_getInstance,
78
+ toDurationba1nlt78o6vu as toDuration_0,
79
+ initMetadataForCoroutine1i7lbatuf5bnt as initMetadataForCoroutine,
80
+ LinkedHashMap_init_$Create$3aeh9b8t1pf1j as LinkedHashMap_init_$Create$,
81
+ isCharSequence1ju9jr1w86plq as isCharSequence,
82
+ trim11nh7r46at6sx as trim,
83
+ CancellationException3b36o9qz53rgr as CancellationException,
84
+ Monotonic_instance2att21stfwfpk as Monotonic_instance,
85
+ Duration__minus_impl_q5cfm73tf66w97h2wg9 as Duration__minus_impl_q5cfm7,
86
+ ValueTimeMark__elapsedNow_impl_eonqvs593ou6p5l5hu as ValueTimeMark__elapsedNow_impl_eonqvs,
87
+ coerceAtLeast3jlgfquiyquc9 as coerceAtLeast,
88
+ _Result___get_value__impl__bjfvqgfu6uyyvgx74d as _Result___get_value__impl__bjfvqg,
89
+ _Result___get_isFailure__impl__jpirivaggyjf2c4e0j as _Result___get_isFailure__impl__jpiriv,
90
+ ValueTimeMark3e7hmed1q029a as ValueTimeMark,
91
+ ArrayDeque_init_$Create$2it6kiwkurn66 as ArrayDeque_init_$Create$,
92
+ LinkedHashSet_init_$Create$2y9omcalkfydw as LinkedHashSet_init_$Create$,
93
+ ArrayList_init_$Create$1z3aa4voswqq as ArrayList_init_$Create$_0,
94
+ trimEndvvzjdhan75g as trimEnd,
95
+ isNumberiramasdbon0i as isNumber,
96
+ last1vo29oleiqj36 as last,
97
+ dropLast1vpiyky649o34 as dropLast,
98
+ println2shhhgwwt4c61 as println,
99
+ add85si75olwt6n as add,
100
+ Long2qws0ah9gnpki as Long,
101
+ divide3tol6kxdi8xn6 as divide,
102
+ generateSequence118suk3hffuuw as generateSequence,
103
+ mapNotNull3b8ce5hky4k2l as mapNotNull,
104
+ distinct17vua5ffe1cfv as distinct,
105
+ joinToStringooja5rkatz3u as joinToString_0,
106
+ substringBeforeLastqh7oeuvefdek as substringBeforeLast,
107
+ substringAfterLast3r0t0my8cpqhk as substringAfterLast,
108
+ toInt2q8uldh7sc951 as toInt,
109
+ toIntOrNull3w2d066r9pvwm as toIntOrNull,
110
+ getBooleanHashCode1bbj3u6b3v0a7 as getBooleanHashCode,
111
+ getKClassFromExpression348iqjl4fnx2f as getKClassFromExpression,
112
+ } from './kotlin-kotlin-stdlib.mjs';
113
+ import {
114
+ Otheroaiiffqwbwqm as Other,
115
+ NotStartedi2yr0ufycywp as NotStarted,
116
+ ProverKilled3n2u5opbhpx2v as ProverKilled,
117
+ LimitsExceeded13lhhb4csmym7 as LimitsExceeded,
118
+ SteamFailed2b12wnnxt0g0r as SteamFailed,
119
+ VersionMismatch12kku7btsc8j6 as VersionMismatch,
120
+ NotaryUnreachable3fhhl7izgs2ic as NotaryUnreachable,
121
+ SessionClosedpflyeqz8g95z as SessionClosed,
122
+ UpgradeRefused1o7aa3kd9qh9u as UpgradeRefused,
123
+ Companion_instance19f1td8bgu51 as Companion_instance_0,
124
+ $serializer_getInstance3ty1ogwaciawb as $serializer_getInstance,
125
+ TradingApiSignature_getInstance3kjhvzg49o6yb as TradingApiSignature_getInstance,
126
+ SystemClock1i9y8r31b0lz0 as SystemClock,
127
+ NoOpEventObserver_instance2ksdq0da9phaw as NoOpEventObserver_instance,
128
+ HeadlessProving1m472lk1pjiao as HeadlessProving,
129
+ HeadlessPlatform2ymwlvzv2xhc9 as HeadlessPlatform,
130
+ HeadlessTracker2ps77trfrvf67 as HeadlessTracker,
131
+ KeyChange_SAME_getInstance21hdqt1m9x37m as KeyChange_SAME_getInstance,
132
+ Held46uv6gcfbvyw as Held,
133
+ Companion_getInstance3r5oaq032v9rg as Companion_getInstance_1,
134
+ Unverified1vu4hqtew74pb as Unverified,
135
+ AccountChangedxp8pmbpg3eps as AccountChanged,
136
+ Invalid1dqthncp1krq0 as Invalid,
137
+ Invalid2ctvx98mqxems as Invalid_0,
138
+ WrongAccount183ht5uld8ugu as WrongAccount,
139
+ Held1qp4s14eqwzca as Held_0,
140
+ Failed1ddud2jrs9obw as Failed,
141
+ Proved3aua8h9vgccoh as Proved,
142
+ KillCause_EXITED_getInstance3vh8sljpcmajr as KillCause_EXITED_getInstance,
143
+ KillCause_SESSION_DEADLINE_getInstanceqyd9dt9mjxet as KillCause_SESSION_DEADLINE_getInstance,
144
+ KillCause_CONNECT_DEADLINE_getInstance5cpw03hhsgx5 as KillCause_CONNECT_DEADLINE_getInstance,
145
+ KillCause_OUT_OF_MEMORY_getInstance1sg96w2m9dl88 as KillCause_OUT_OF_MEMORY_getInstance,
146
+ HostedProofRequest2s8lxzgwnniga as HostedProofRequest,
147
+ runHostedProof21xc2o0rixvpf as runHostedProof,
148
+ ProofFailurehuw18ojbsppr as ProofFailure,
149
+ ProofFailures_getInstance7rhnovblii70 as ProofFailures_getInstance,
150
+ WasmProverHostf3fxkwaj8qxb as WasmProverHost,
151
+ NotaryUpgradeHeaders3njot8fry1mt1 as NotaryUpgradeHeaders,
152
+ } from './p2p-tracker-core.mjs';
153
+ import {
154
+ Jsonsmkyu9xjl7fv as Json,
155
+ get_jsonObject2u4z2ch1uuca9 as get_jsonObject,
156
+ JsonPrimitiveolttw629wj53 as JsonPrimitive,
157
+ JsonObjectee06ihoeeiqj as JsonObject,
158
+ JsonNull_getInstance39w6eplghmtxw as JsonNull_getInstance,
159
+ } from './kotlinx-serialization-kotlinx-serialization-json.mjs';
160
+ import {
161
+ PluginGeneratedSerialDescriptorqdzeg5asqhfg as PluginGeneratedSerialDescriptor,
162
+ StringSerializer_getInstancerxlnwnlbnwri as StringSerializer_getInstance,
163
+ UnknownFieldException_init_$Create$1pljrg0i74g2b as UnknownFieldException_init_$Create$,
164
+ IntSerializer_getInstance3hkg1llvt1c0z as IntSerializer_getInstance,
165
+ get_nullable197rfua9r7fsz as get_nullable,
166
+ typeParametersSerializers2likxjr48tr7y as typeParametersSerializers,
167
+ GeneratedSerializer1f7t7hssdd2ws as GeneratedSerializer,
168
+ throwMissingFieldException2cmke0v3ynf14 as throwMissingFieldException,
169
+ LinkedHashMapSerializermaoj2nyji7op as LinkedHashMapSerializer,
170
+ SealedClassSerializer_init_$Create$29xgt9hvvvs1v as SealedClassSerializer_init_$Create$,
171
+ SerializerFactory1qv9hivitncuv as SerializerFactory,
172
+ SerializableWithd2dap36updxd as SerializableWith,
173
+ } from './kotlinx-serialization-kotlinx-serialization-core.mjs';
174
+ import {
175
+ NetworkRedaction_getInstance32w4gfwhub6p4 as NetworkRedaction_getInstance,
176
+ Companion_instance2ghkb2fw5q5xx as Companion_instance_1,
177
+ _SteamId___get_value__impl__qjh21ui52cho8l37uy as _SteamId___get_value__impl__qjh21u,
178
+ ProofSkipReason_NO_PROVER_getInstance27dm7r7p0dk6r as ProofSkipReason_NO_PROVER_getInstance,
179
+ get_entries1prsv0041m3vd as get_entries,
180
+ get_entriescav9rrsljuty as get_entries_0,
181
+ toWireJson1hjhi5mas3ze8 as toWireJson,
182
+ EventObserver1zt6y33x28kwa as EventObserver,
183
+ SteamId2we8mjre8dtws as SteamId,
184
+ _DealId___get_value__impl__ww6eoe1uvl7heuccoxi as _DealId___get_value__impl__ww6eoe,
185
+ NotaryConfig2xr051j1coej0 as NotaryConfig,
186
+ TrackerConfig8808dhq5s1br as TrackerConfig,
187
+ } from './dmarket-p2p-tracker-core-domain.mjs';
188
+ import {
189
+ cancel36mj9lv3a0whl as cancel,
190
+ SupervisorJobythnfxkr3jxc as SupervisorJob,
191
+ Dispatchers_getInstance20p7pyqnrepag as Dispatchers_getInstance,
192
+ CoroutineScopelux7s7zphw7e as CoroutineScope,
193
+ promise1ky6tawqaxbt4 as promise_0,
194
+ CoroutineScopefcb5f5dwqcas as CoroutineScope_0,
195
+ await3gx2tubo6ckuc as await_0,
196
+ withTimeoutOrNull2qr9d4v42lp0r as withTimeoutOrNull,
197
+ Mutex16li1l0asjv17 as Mutex,
198
+ ChannelResult2y4k69ac6y3du as ChannelResult,
199
+ Channel3r72atmcithql as Channel,
200
+ asyncz02dsa2nb2zt as async,
201
+ SelectImplementation59ci94k9x9wm as SelectImplementation,
202
+ CompletableDeferred2lnqvsbvx74d3 as CompletableDeferred,
203
+ coroutineScope39ukucf23mhsm as coroutineScope,
204
+ launch1c91vkjzdi9sd as launch,
205
+ } from './kotlinx-coroutines-core.mjs';
206
+ import com_dmarket_p2p_headless_node_nodePath_idbzon from 'node:path';
207
+ import com_dmarket_p2p_headless_node_nodeFs_vfkcsf from 'node:fs';
208
+ import com_dmarket_p2p_headless_node_nodeWorkerThreads_wezs9 from 'node:worker_threads';
209
+ import com_dmarket_p2p_headless_node_nodeBuffer_qg2cok from 'node:buffer';
210
+ import com_dmarket_p2p_headless_node_nodeChildProcess_579ejd from 'node:child_process';
211
+ import com_dmarket_p2p_headless_node_nodeUrl_k122d7 from 'node:url';
212
+ import com_dmarket_p2p_headless_node_nodeModule_vk8grk from 'node:module';
213
+ import com_dmarket_p2p_headless_node_wsWebSocket_w3og61 from 'ws';
214
+ import './ktor-ktor-client-core.mjs';
215
+ //region block: imports
216
+ var imul = Math.imul;
217
+ //endregion
218
+ //region block: pre-declaration
219
+ initMetadataForObject(ProofOutcomeJson, 'ProofOutcomeJson');
220
+ initMetadataForCompanion(Companion);
221
+ initMetadataForClass(ProverBackoff, 'ProverBackoff', ProverBackoff);
222
+ initMetadataForCompanion(Companion_0);
223
+ initMetadataForObject($serializer, '$serializer', VOID, VOID, [GeneratedSerializer]);
224
+ initMetadataForClass(ProverSettings, 'ProverSettings', VOID, VOID, VOID, VOID, VOID, {0: $serializer_getInstance_0});
225
+ initMetadataForObject(ProverIpc, 'ProverIpc');
226
+ initMetadataForCompanion(Companion_1);
227
+ initMetadataForObject($serializer_0, '$serializer', VOID, VOID, [GeneratedSerializer]);
228
+ initMetadataForCompanion(Companion_2);
229
+ initMetadataForObject($serializer_1, '$serializer', VOID, VOID, [GeneratedSerializer]);
230
+ initMetadataForInterface(ToChild, 'ToChild', VOID, VOID, VOID, VOID, VOID, {0: Companion_getInstance_6});
231
+ initMetadataForClass(Prove, 'Prove', VOID, VOID, [ToChild], VOID, VOID, {0: $serializer_getInstance_1});
232
+ initMetadataForClass(Headers, 'Headers', VOID, VOID, [ToChild], VOID, VOID, {0: $serializer_getInstance_2});
233
+ initMetadataForCompanion(Companion_3, VOID, [SerializerFactory]);
234
+ initMetadataForCompanion(Companion_4);
235
+ initMetadataForObject($serializer_2, '$serializer', VOID, VOID, [GeneratedSerializer]);
236
+ initMetadataForCompanion(Companion_5);
237
+ initMetadataForObject($serializer_3, '$serializer', VOID, VOID, [GeneratedSerializer]);
238
+ initMetadataForCompanion(Companion_6);
239
+ initMetadataForObject($serializer_4, '$serializer', VOID, VOID, [GeneratedSerializer]);
240
+ initMetadataForInterface(FromChild, 'FromChild', VOID, VOID, VOID, VOID, VOID, {0: Companion_getInstance_10});
241
+ initMetadataForClass(HeadersWanted, 'HeadersWanted', VOID, VOID, [FromChild], VOID, VOID, {0: $serializer_getInstance_3});
242
+ initMetadataForClass(Proved_0, 'Proved', VOID, VOID, [FromChild], VOID, VOID, {0: $serializer_getInstance_4});
243
+ initMetadataForClass(Failed_0, 'Failed', VOID, VOID, [FromChild], VOID, VOID, {0: $serializer_getInstance_5});
244
+ initMetadataForCompanion(Companion_7, VOID, [SerializerFactory]);
245
+ initMetadataForObject(ProverOutput, 'ProverOutput');
246
+ initMetadataForClass(TrackerEntry, 'TrackerEntry');
247
+ initMetadataForLambda(cycle$slambda, CoroutineImpl, VOID, [1]);
248
+ initMetadataForLambda(pushTradingApiKey$slambda, CoroutineImpl, VOID, [1]);
249
+ initMetadataForLambda(pushSteamToken$slambda, CoroutineImpl, VOID, [1]);
250
+ initMetadataForLambda(call$slambda, CoroutineImpl, VOID, [1]);
251
+ initMetadataForCompanion(Companion_8);
252
+ initMetadataForClass(HeadlessOptions$clock$1);
253
+ initMetadataForClass(HeadlessOptions$eventObserver$1, VOID, VOID, VOID, [EventObserver], [1]);
254
+ initMetadataForClass(HeadlessOptions, 'HeadlessOptions');
255
+ initMetadataForCompanion(Companion_9);
256
+ initMetadataForClass(ProverFiles, 'ProverFiles');
257
+ initMetadataForCompanion(Companion_10);
258
+ initMetadataForClass(ProverOptions, 'ProverOptions');
259
+ initMetadataForCompanion(Companion_11);
260
+ initMetadataForCoroutine($getCOROUTINE$, CoroutineImpl);
261
+ initMetadataForCoroutine($setCOROUTINE$, CoroutineImpl);
262
+ initMetadataForCoroutine($removeCOROUTINE$, CoroutineImpl);
263
+ initMetadataForClass(FileKeyValueStore, 'FileKeyValueStore', VOID, VOID, VOID, [1, 2]);
264
+ initMetadataForCompanion(Companion_12);
265
+ initMetadataForClass(AccountDirectories, 'AccountDirectories');
266
+ initMetadataForCompanion(Companion_13);
267
+ initMetadataForClass(ProverLimits, 'ProverLimits', ProverLimits);
268
+ initMetadataForLambda(ForkedProofHost$run$slambda, CoroutineImpl, VOID, [1]);
269
+ initMetadataForCoroutine($proveCOROUTINE$, CoroutineImpl);
270
+ initMetadataForCoroutine($runCOROUTINE$, CoroutineImpl);
271
+ initMetadataForClass(ForkedProofHost, 'ForkedProofHost', VOID, VOID, VOID, [2, 4]);
272
+ initMetadataForClass(Message, 'Message');
273
+ initMetadataForClass(Exited, 'Exited');
274
+ initMetadataForClass(ForkedChild, 'ForkedChild');
275
+ initMetadataForLambda(NodeWasmProver$prove$slambda$slambda, CoroutineImpl, VOID, [1]);
276
+ initMetadataForLambda(NodeWasmProver$prove$slambda$slambda_1, CoroutineImpl, VOID, [1]);
277
+ initMetadataForLambda(NodeWasmProver$prove$slambda$slambda_3, CoroutineImpl, VOID, [1]);
278
+ initMetadataForCompanion(Companion_14);
279
+ initMetadataForLambda(NodeWasmProver$prove$slambda, CoroutineImpl, VOID, [0]);
280
+ initMetadataForLambda(NodeWasmProver$prove$slambda_1, CoroutineImpl, VOID, [0]);
281
+ initMetadataForLambda(NodeWasmProver$prove$slambda_3, CoroutineImpl, VOID, [1]);
282
+ initMetadataForCoroutine($proveCOROUTINE$_0, CoroutineImpl);
283
+ initMetadataForClass(NodeWasmProver, 'NodeWasmProver', VOID, VOID, VOID, [2]);
284
+ initMetadataForCoroutine($compileWasmCOROUTINE$, CoroutineImpl);
285
+ initMetadataForClass(ProverSessionRecord, 'ProverSessionRecord', ProverSessionRecord);
286
+ initMetadataForClass(Proved_1, 'Proved');
287
+ initMetadataForClass(Failed_1, 'Failed');
288
+ initMetadataForLambda(runProverChild$lambda$slambda$slambda, CoroutineImpl, VOID, [0]);
289
+ initMetadataForLambda(runProverChild$lambda$slambda, CoroutineImpl, VOID, [1]);
290
+ //endregion
291
+ function redacted($this, $receiver) {
292
+ var tmp;
293
+ if ($receiver instanceof UpgradeRefused) {
294
+ tmp = $receiver;
295
+ } else {
296
+ if ($receiver instanceof SessionClosed) {
297
+ var tmp1_safe_receiver = $receiver.dat_1;
298
+ var tmp_0;
299
+ if (tmp1_safe_receiver == null) {
300
+ tmp_0 = null;
301
+ } else {
302
+ // Inline function 'kotlin.let' call
303
+ tmp_0 = ProverOutput_getInstance().k76(tmp1_safe_receiver);
304
+ }
305
+ tmp = $receiver.fau(VOID, tmp_0);
306
+ } else {
307
+ if ($receiver instanceof NotaryUnreachable) {
308
+ tmp = $receiver.gau(ProverOutput_getInstance().k76($receiver.gat_1));
309
+ } else {
310
+ if ($receiver instanceof VersionMismatch) {
311
+ tmp = $receiver.gau(ProverOutput_getInstance().k76($receiver.jat_1));
312
+ } else {
313
+ if ($receiver instanceof SteamFailed) {
314
+ tmp = $receiver.iau(VOID, ProverOutput_getInstance().k76($receiver.nat_1));
315
+ } else {
316
+ if ($receiver instanceof LimitsExceeded) {
317
+ tmp = $receiver.gau(ProverOutput_getInstance().k76($receiver.qat_1));
318
+ } else {
319
+ if ($receiver instanceof ProverKilled) {
320
+ var tmp2_safe_receiver = $receiver.wat_1;
321
+ var tmp_1;
322
+ if (tmp2_safe_receiver == null) {
323
+ tmp_1 = null;
324
+ } else {
325
+ // Inline function 'kotlin.let' call
326
+ tmp_1 = ProverOutput_getInstance().k76(tmp2_safe_receiver);
327
+ }
328
+ tmp = $receiver.nau(VOID, tmp_1);
329
+ } else {
330
+ if ($receiver instanceof NotStarted) {
331
+ tmp = $receiver.gau(ProverOutput_getInstance().k76($receiver.zat_1));
332
+ } else {
333
+ if ($receiver instanceof Other) {
334
+ tmp = $receiver.gau(ProverOutput_getInstance().k76($receiver.cau_1));
335
+ } else {
336
+ noWhenBranchMatchedException();
337
+ }
338
+ }
339
+ }
340
+ }
341
+ }
342
+ }
343
+ }
344
+ }
345
+ }
346
+ return tmp;
347
+ }
348
+ function ProofOutcomeJson$json$lambda($this$Json) {
349
+ $this$Json.c53_1 = 'type';
350
+ $this$Json.v52_1 = true;
351
+ return Unit_instance;
352
+ }
353
+ function ProofOutcomeJson() {
354
+ ProofOutcomeJson_instance = this;
355
+ var tmp = this;
356
+ tmp.hbx_1 = Json(VOID, ProofOutcomeJson$json$lambda);
357
+ }
358
+ protoOf(ProofOutcomeJson).ibx = function (failure) {
359
+ var fields = get_jsonObject(this.hbx_1.e52(Companion_instance_0.r54(), redacted(this, failure)));
360
+ return (new JsonObject(plus(fields, to('summary', JsonPrimitive(ProverOutput_getInstance().k76(failure.dau())))))).toString();
361
+ };
362
+ protoOf(ProofOutcomeJson).jbx = function (message, warning, fields) {
363
+ var head = listOf([to('msg', JsonPrimitive(message)), to('level', JsonPrimitive(warning ? 'warn' : 'info'))]);
364
+ // Inline function 'kotlin.collections.map' call
365
+ // Inline function 'kotlin.collections.mapTo' call
366
+ var destination = ArrayList_init_$Create$(collectionSizeOrDefault(fields, 10));
367
+ var _iterator__ex2g4s = fields.t();
368
+ while (_iterator__ex2g4s.u()) {
369
+ var item = _iterator__ex2g4s.v();
370
+ var key = item.eh();
371
+ var value = item.fh();
372
+ var tmp;
373
+ if (value == null) {
374
+ tmp = null;
375
+ } else {
376
+ // Inline function 'kotlin.let' call
377
+ tmp = JsonPrimitive(value);
378
+ }
379
+ var tmp1_elvis_lhs = tmp;
380
+ var tmp$ret$2 = to(key, tmp1_elvis_lhs == null ? JsonNull_getInstance() : tmp1_elvis_lhs);
381
+ destination.e1(tmp$ret$2);
382
+ }
383
+ var rest = destination;
384
+ return (new JsonObject(toMap(plus_0(head, rest)))).toString();
385
+ };
386
+ var ProofOutcomeJson_instance;
387
+ function ProofOutcomeJson_getInstance() {
388
+ if (ProofOutcomeJson_instance == null)
389
+ new ProofOutcomeJson();
390
+ return ProofOutcomeJson_instance;
391
+ }
392
+ function backoff($this, consecutive) {
393
+ var wait = $this.qbx_1;
394
+ // Inline function 'kotlin.repeat' call
395
+ var times = coerceIn(consecutive, 0, 10);
396
+ var inductionVariable = 0;
397
+ if (inductionVariable < times)
398
+ do {
399
+ var index = inductionVariable;
400
+ inductionVariable = inductionVariable + 1 | 0;
401
+ wait = Duration__times_impl_sfuzvp(wait, 2);
402
+ }
403
+ while (inductionVariable < times);
404
+ return minOf(new Duration(wait), new Duration($this.rbx_1)).jf_1;
405
+ }
406
+ function Companion() {
407
+ Companion_instance_2 = this;
408
+ this.kbx_1 = 401;
409
+ this.lbx_1 = 403;
410
+ this.mbx_1 = numberRangeToNumber(500, 599);
411
+ this.nbx_1 = 1013;
412
+ this.obx_1 = 4029;
413
+ this.pbx_1 = 10;
414
+ var tmp = this;
415
+ // Inline function 'kotlin.time.Companion.seconds' call
416
+ Companion_getInstance();
417
+ tmp.qbx_1 = toDuration(30, DurationUnit_SECONDS_getInstance());
418
+ var tmp_0 = this;
419
+ // Inline function 'kotlin.time.Companion.minutes' call
420
+ Companion_getInstance();
421
+ tmp_0.rbx_1 = toDuration(5, DurationUnit_MINUTES_getInstance());
422
+ var tmp_1 = this;
423
+ // Inline function 'kotlin.time.Companion.seconds' call
424
+ Companion_getInstance();
425
+ tmp_1.sbx_1 = toDuration(60, DurationUnit_SECONDS_getInstance());
426
+ }
427
+ protoOf(Companion).tbx = function (failure, consecutive) {
428
+ var tmp;
429
+ if (failure instanceof UpgradeRefused) {
430
+ var tmp1_subject = failure.zas_1;
431
+ var tmp_0;
432
+ var tmp_1;
433
+ if (tmp1_subject === 401) {
434
+ tmp_1 = true;
435
+ } else {
436
+ var progression = this.mbx_1;
437
+ var containsLower = progression.s1_1;
438
+ tmp_1 = tmp1_subject <= progression.t1_1 ? containsLower <= tmp1_subject : false;
439
+ }
440
+ if (tmp_1) {
441
+ tmp_0 = backoff(this, consecutive);
442
+ } else {
443
+ if (tmp1_subject === 403) {
444
+ tmp_0 = this.sbx_1;
445
+ } else {
446
+ tmp_0 = null;
447
+ }
448
+ }
449
+ tmp = tmp_0;
450
+ } else {
451
+ if (failure instanceof SessionClosed) {
452
+ switch (failure.cat_1) {
453
+ case 1013:
454
+ tmp = backoff(this, consecutive);
455
+ break;
456
+ case 4029:
457
+ tmp = this.sbx_1;
458
+ break;
459
+ default:
460
+ tmp = null;
461
+ break;
462
+ }
463
+ } else {
464
+ if (failure instanceof NotaryUnreachable) {
465
+ tmp = backoff(this, consecutive);
466
+ } else {
467
+ if (failure instanceof VersionMismatch) {
468
+ tmp = Companion_getInstance().lf_1;
469
+ } else {
470
+ tmp = null;
471
+ }
472
+ }
473
+ }
474
+ }
475
+ return tmp;
476
+ };
477
+ var Companion_instance_2;
478
+ function Companion_getInstance_2() {
479
+ if (Companion_instance_2 == null)
480
+ new Companion();
481
+ return Companion_instance_2;
482
+ }
483
+ function ProverBackoff() {
484
+ Companion_getInstance_2();
485
+ this.ubx_1 = null;
486
+ this.vbx_1 = 0;
487
+ this.wbx_1 = null;
488
+ }
489
+ protoOf(ProverBackoff).xbx = function (now) {
490
+ var tmp0_elvis_lhs = this.ubx_1;
491
+ var tmp;
492
+ if (tmp0_elvis_lhs == null) {
493
+ return null;
494
+ } else {
495
+ tmp = tmp0_elvis_lhs;
496
+ }
497
+ var until = tmp;
498
+ if (now.bp(until) >= 0)
499
+ return null;
500
+ var tmp1_elvis_lhs = this.wbx_1;
501
+ var after = tmp1_elvis_lhs == null ? 'a refusal' : tmp1_elvis_lhs;
502
+ var tmp_0;
503
+ if (until.equals(Companion_getInstance_0().uo())) {
504
+ tmp_0 = 'no proof until the SDK is updated, after ' + after;
505
+ } else {
506
+ tmp_0 = 'no proof until ' + until.toString() + ', after ' + after;
507
+ }
508
+ return tmp_0;
509
+ };
510
+ protoOf(ProverBackoff).ybx = function (failure, now) {
511
+ var tmp0_elvis_lhs = Companion_getInstance_2().tbx(failure, this.vbx_1);
512
+ var tmp;
513
+ var tmp_0 = tmp0_elvis_lhs;
514
+ if ((tmp_0 == null ? null : new Duration(tmp_0)) == null) {
515
+ return Unit_instance;
516
+ } else {
517
+ tmp = tmp0_elvis_lhs;
518
+ }
519
+ var wait = tmp;
520
+ this.vbx_1 = this.vbx_1 + 1 | 0;
521
+ this.wbx_1 = failure.dau();
522
+ this.ubx_1 = equals(wait, Companion_getInstance().lf_1) ? Companion_getInstance_0().uo() : now.yo(wait);
523
+ };
524
+ protoOf(ProverBackoff).zbx = function () {
525
+ this.ubx_1 = null;
526
+ this.vbx_1 = 0;
527
+ this.wbx_1 = null;
528
+ };
529
+ protoOf(ProverBackoff).aby = function () {
530
+ if (!equals(this.ubx_1, Companion_getInstance_0().uo())) {
531
+ this.zbx();
532
+ }
533
+ };
534
+ function Companion_0() {
535
+ this.bby_1 = 4;
536
+ this.cby_1 = 16;
537
+ this.dby_1 = 5;
538
+ }
539
+ var Companion_instance_3;
540
+ function Companion_getInstance_3() {
541
+ return Companion_instance_3;
542
+ }
543
+ function $serializer() {
544
+ $serializer_instance = this;
545
+ var tmp0_serialDesc = new PluginGeneratedSerialDescriptor('com.dmarket.p2p.headless.prover.ProverSettings', this, 5);
546
+ tmp0_serialDesc.z2i('notaryUrl', false);
547
+ tmp0_serialDesc.z2i('threadCount', false);
548
+ tmp0_serialDesc.z2i('assetsDir', false);
549
+ tmp0_serialDesc.z2i('rootStorePem', true);
550
+ tmp0_serialDesc.z2i('targetAddress', true);
551
+ this.eby_1 = tmp0_serialDesc;
552
+ }
553
+ protoOf($serializer).fby = function (encoder, value) {
554
+ var tmp0_desc = this.eby_1;
555
+ var tmp1_output = encoder.j2b(tmp0_desc);
556
+ tmp1_output.y2c(tmp0_desc, 0, value.gby_1);
557
+ tmp1_output.t2c(tmp0_desc, 1, value.hby_1);
558
+ tmp1_output.y2c(tmp0_desc, 2, value.iby_1);
559
+ if (tmp1_output.g2d(tmp0_desc, 3) ? true : !(value.jby_1 == null)) {
560
+ tmp1_output.c2d(tmp0_desc, 3, StringSerializer_getInstance(), value.jby_1);
561
+ }
562
+ if (tmp1_output.g2d(tmp0_desc, 4) ? true : !(value.kby_1 == null)) {
563
+ tmp1_output.c2d(tmp0_desc, 4, StringSerializer_getInstance(), value.kby_1);
564
+ }
565
+ tmp1_output.k2b(tmp0_desc);
566
+ };
567
+ protoOf($serializer).b28 = function (encoder, value) {
568
+ return this.fby(encoder, value instanceof ProverSettings ? value : THROW_CCE());
569
+ };
570
+ protoOf($serializer).c28 = function (decoder) {
571
+ var tmp0_desc = this.eby_1;
572
+ var tmp1_flag = true;
573
+ var tmp2_index = 0;
574
+ var tmp3_bitMask0 = 0;
575
+ var tmp4_local0 = null;
576
+ var tmp5_local1 = 0;
577
+ var tmp6_local2 = null;
578
+ var tmp7_local3 = null;
579
+ var tmp8_local4 = null;
580
+ var tmp9_input = decoder.j2b(tmp0_desc);
581
+ if (tmp9_input.z2b()) {
582
+ tmp4_local0 = tmp9_input.t2b(tmp0_desc, 0);
583
+ tmp3_bitMask0 = tmp3_bitMask0 | 1;
584
+ tmp5_local1 = tmp9_input.o2b(tmp0_desc, 1);
585
+ tmp3_bitMask0 = tmp3_bitMask0 | 2;
586
+ tmp6_local2 = tmp9_input.t2b(tmp0_desc, 2);
587
+ tmp3_bitMask0 = tmp3_bitMask0 | 4;
588
+ tmp7_local3 = tmp9_input.x2b(tmp0_desc, 3, StringSerializer_getInstance(), tmp7_local3);
589
+ tmp3_bitMask0 = tmp3_bitMask0 | 8;
590
+ tmp8_local4 = tmp9_input.x2b(tmp0_desc, 4, StringSerializer_getInstance(), tmp8_local4);
591
+ tmp3_bitMask0 = tmp3_bitMask0 | 16;
592
+ } else
593
+ while (tmp1_flag) {
594
+ tmp2_index = tmp9_input.a2c(tmp0_desc);
595
+ switch (tmp2_index) {
596
+ case -1:
597
+ tmp1_flag = false;
598
+ break;
599
+ case 0:
600
+ tmp4_local0 = tmp9_input.t2b(tmp0_desc, 0);
601
+ tmp3_bitMask0 = tmp3_bitMask0 | 1;
602
+ break;
603
+ case 1:
604
+ tmp5_local1 = tmp9_input.o2b(tmp0_desc, 1);
605
+ tmp3_bitMask0 = tmp3_bitMask0 | 2;
606
+ break;
607
+ case 2:
608
+ tmp6_local2 = tmp9_input.t2b(tmp0_desc, 2);
609
+ tmp3_bitMask0 = tmp3_bitMask0 | 4;
610
+ break;
611
+ case 3:
612
+ tmp7_local3 = tmp9_input.x2b(tmp0_desc, 3, StringSerializer_getInstance(), tmp7_local3);
613
+ tmp3_bitMask0 = tmp3_bitMask0 | 8;
614
+ break;
615
+ case 4:
616
+ tmp8_local4 = tmp9_input.x2b(tmp0_desc, 4, StringSerializer_getInstance(), tmp8_local4);
617
+ tmp3_bitMask0 = tmp3_bitMask0 | 16;
618
+ break;
619
+ default:
620
+ throw UnknownFieldException_init_$Create$(tmp2_index);
621
+ }
622
+ }
623
+ tmp9_input.k2b(tmp0_desc);
624
+ return ProverSettings_init_$Create$(tmp3_bitMask0, tmp4_local0, tmp5_local1, tmp6_local2, tmp7_local3, tmp8_local4, null);
625
+ };
626
+ protoOf($serializer).a28 = function () {
627
+ return this.eby_1;
628
+ };
629
+ protoOf($serializer).q2j = function () {
630
+ // Inline function 'kotlin.arrayOf' call
631
+ // Inline function 'kotlin.js.unsafeCast' call
632
+ // Inline function 'kotlin.js.asDynamic' call
633
+ return [StringSerializer_getInstance(), IntSerializer_getInstance(), StringSerializer_getInstance(), get_nullable(StringSerializer_getInstance()), get_nullable(StringSerializer_getInstance())];
634
+ };
635
+ var $serializer_instance;
636
+ function $serializer_getInstance_0() {
637
+ if ($serializer_instance == null)
638
+ new $serializer();
639
+ return $serializer_instance;
640
+ }
641
+ function ProverSettings_init_$Init$(seen0, notaryUrl, threadCount, assetsDir, rootStorePem, targetAddress, serializationConstructorMarker, $this) {
642
+ if (!(7 === (7 & seen0))) {
643
+ throwMissingFieldException(seen0, 7, $serializer_getInstance_0().eby_1);
644
+ }
645
+ $this.gby_1 = notaryUrl;
646
+ $this.hby_1 = threadCount;
647
+ $this.iby_1 = assetsDir;
648
+ if (0 === (seen0 & 8))
649
+ $this.jby_1 = null;
650
+ else
651
+ $this.jby_1 = rootStorePem;
652
+ if (0 === (seen0 & 16))
653
+ $this.kby_1 = null;
654
+ else
655
+ $this.kby_1 = targetAddress;
656
+ return $this;
657
+ }
658
+ function ProverSettings_init_$Create$(seen0, notaryUrl, threadCount, assetsDir, rootStorePem, targetAddress, serializationConstructorMarker) {
659
+ return ProverSettings_init_$Init$(seen0, notaryUrl, threadCount, assetsDir, rootStorePem, targetAddress, serializationConstructorMarker, objectCreate(protoOf(ProverSettings)));
660
+ }
661
+ function ProverSettings(notaryUrl, threadCount, assetsDir, rootStorePem, targetAddress) {
662
+ rootStorePem = rootStorePem === VOID ? null : rootStorePem;
663
+ targetAddress = targetAddress === VOID ? null : targetAddress;
664
+ this.gby_1 = notaryUrl;
665
+ this.hby_1 = threadCount;
666
+ this.iby_1 = assetsDir;
667
+ this.jby_1 = rootStorePem;
668
+ this.kby_1 = targetAddress;
669
+ }
670
+ protoOf(ProverSettings).toString = function () {
671
+ return 'ProverSettings(notaryUrl=' + this.gby_1 + ', threadCount=' + this.hby_1 + ', assetsDir=' + this.iby_1 + ', rootStorePem=' + this.jby_1 + ', targetAddress=' + this.kby_1 + ')';
672
+ };
673
+ protoOf(ProverSettings).hashCode = function () {
674
+ var result = getStringHashCode(this.gby_1);
675
+ result = imul(result, 31) + this.hby_1 | 0;
676
+ result = imul(result, 31) + getStringHashCode(this.iby_1) | 0;
677
+ result = imul(result, 31) + (this.jby_1 == null ? 0 : getStringHashCode(this.jby_1)) | 0;
678
+ result = imul(result, 31) + (this.kby_1 == null ? 0 : getStringHashCode(this.kby_1)) | 0;
679
+ return result;
680
+ };
681
+ protoOf(ProverSettings).equals = function (other) {
682
+ if (this === other)
683
+ return true;
684
+ if (!(other instanceof ProverSettings))
685
+ return false;
686
+ if (!(this.gby_1 === other.gby_1))
687
+ return false;
688
+ if (!(this.hby_1 === other.hby_1))
689
+ return false;
690
+ if (!(this.iby_1 === other.iby_1))
691
+ return false;
692
+ if (!(this.jby_1 == other.jby_1))
693
+ return false;
694
+ if (!(this.kby_1 == other.kby_1))
695
+ return false;
696
+ return true;
697
+ };
698
+ function ProverIpc$json$lambda($this$Json) {
699
+ $this$Json.c53_1 = 'type';
700
+ $this$Json.x52_1 = true;
701
+ $this$Json.v52_1 = false;
702
+ return Unit_instance;
703
+ }
704
+ function ProverIpc() {
705
+ ProverIpc_instance = this;
706
+ var tmp = this;
707
+ tmp.lby_1 = Json(VOID, ProverIpc$json$lambda);
708
+ }
709
+ protoOf(ProverIpc).mby = function (message) {
710
+ return this.lby_1.c52(Companion_instance_6.r54(), message);
711
+ };
712
+ protoOf(ProverIpc).nby = function (message) {
713
+ return this.lby_1.c52(Companion_instance_10.r54(), message);
714
+ };
715
+ protoOf(ProverIpc).oby = function (text) {
716
+ return this.lby_1.d52(Companion_instance_6.r54(), text);
717
+ };
718
+ protoOf(ProverIpc).pby = function (text) {
719
+ return this.lby_1.d52(Companion_instance_10.r54(), text);
720
+ };
721
+ var ProverIpc_instance;
722
+ function ProverIpc_getInstance() {
723
+ if (ProverIpc_instance == null)
724
+ new ProverIpc();
725
+ return ProverIpc_instance;
726
+ }
727
+ function Companion_1() {
728
+ }
729
+ var Companion_instance_4;
730
+ function Companion_getInstance_4() {
731
+ return Companion_instance_4;
732
+ }
733
+ function $serializer_0() {
734
+ $serializer_instance_0 = this;
735
+ var tmp0_serialDesc = new PluginGeneratedSerialDescriptor('prove', this, 5);
736
+ tmp0_serialDesc.z2i('id', false);
737
+ tmp0_serialDesc.z2i('request', false);
738
+ tmp0_serialDesc.z2i('steamAccessToken', false);
739
+ tmp0_serialDesc.z2i('steamSessionId', false);
740
+ tmp0_serialDesc.z2i('settings', false);
741
+ this.qby_1 = tmp0_serialDesc;
742
+ }
743
+ protoOf($serializer_0).rby = function (encoder, value) {
744
+ var tmp0_desc = this.qby_1;
745
+ var tmp1_output = encoder.j2b(tmp0_desc);
746
+ tmp1_output.t2c(tmp0_desc, 0, value.sby_1);
747
+ tmp1_output.a2d(tmp0_desc, 1, $serializer_getInstance(), value.tby_1);
748
+ tmp1_output.y2c(tmp0_desc, 2, value.uby_1);
749
+ tmp1_output.y2c(tmp0_desc, 3, value.vby_1);
750
+ tmp1_output.a2d(tmp0_desc, 4, $serializer_getInstance_0(), value.wby_1);
751
+ tmp1_output.k2b(tmp0_desc);
752
+ };
753
+ protoOf($serializer_0).b28 = function (encoder, value) {
754
+ return this.rby(encoder, value instanceof Prove ? value : THROW_CCE());
755
+ };
756
+ protoOf($serializer_0).c28 = function (decoder) {
757
+ var tmp0_desc = this.qby_1;
758
+ var tmp1_flag = true;
759
+ var tmp2_index = 0;
760
+ var tmp3_bitMask0 = 0;
761
+ var tmp4_local0 = 0;
762
+ var tmp5_local1 = null;
763
+ var tmp6_local2 = null;
764
+ var tmp7_local3 = null;
765
+ var tmp8_local4 = null;
766
+ var tmp9_input = decoder.j2b(tmp0_desc);
767
+ if (tmp9_input.z2b()) {
768
+ tmp4_local0 = tmp9_input.o2b(tmp0_desc, 0);
769
+ tmp3_bitMask0 = tmp3_bitMask0 | 1;
770
+ tmp5_local1 = tmp9_input.v2b(tmp0_desc, 1, $serializer_getInstance(), tmp5_local1);
771
+ tmp3_bitMask0 = tmp3_bitMask0 | 2;
772
+ tmp6_local2 = tmp9_input.t2b(tmp0_desc, 2);
773
+ tmp3_bitMask0 = tmp3_bitMask0 | 4;
774
+ tmp7_local3 = tmp9_input.t2b(tmp0_desc, 3);
775
+ tmp3_bitMask0 = tmp3_bitMask0 | 8;
776
+ tmp8_local4 = tmp9_input.v2b(tmp0_desc, 4, $serializer_getInstance_0(), tmp8_local4);
777
+ tmp3_bitMask0 = tmp3_bitMask0 | 16;
778
+ } else
779
+ while (tmp1_flag) {
780
+ tmp2_index = tmp9_input.a2c(tmp0_desc);
781
+ switch (tmp2_index) {
782
+ case -1:
783
+ tmp1_flag = false;
784
+ break;
785
+ case 0:
786
+ tmp4_local0 = tmp9_input.o2b(tmp0_desc, 0);
787
+ tmp3_bitMask0 = tmp3_bitMask0 | 1;
788
+ break;
789
+ case 1:
790
+ tmp5_local1 = tmp9_input.v2b(tmp0_desc, 1, $serializer_getInstance(), tmp5_local1);
791
+ tmp3_bitMask0 = tmp3_bitMask0 | 2;
792
+ break;
793
+ case 2:
794
+ tmp6_local2 = tmp9_input.t2b(tmp0_desc, 2);
795
+ tmp3_bitMask0 = tmp3_bitMask0 | 4;
796
+ break;
797
+ case 3:
798
+ tmp7_local3 = tmp9_input.t2b(tmp0_desc, 3);
799
+ tmp3_bitMask0 = tmp3_bitMask0 | 8;
800
+ break;
801
+ case 4:
802
+ tmp8_local4 = tmp9_input.v2b(tmp0_desc, 4, $serializer_getInstance_0(), tmp8_local4);
803
+ tmp3_bitMask0 = tmp3_bitMask0 | 16;
804
+ break;
805
+ default:
806
+ throw UnknownFieldException_init_$Create$(tmp2_index);
807
+ }
808
+ }
809
+ tmp9_input.k2b(tmp0_desc);
810
+ return Prove_init_$Create$(tmp3_bitMask0, tmp4_local0, tmp5_local1, tmp6_local2, tmp7_local3, tmp8_local4, null);
811
+ };
812
+ protoOf($serializer_0).a28 = function () {
813
+ return this.qby_1;
814
+ };
815
+ protoOf($serializer_0).q2j = function () {
816
+ // Inline function 'kotlin.arrayOf' call
817
+ // Inline function 'kotlin.js.unsafeCast' call
818
+ // Inline function 'kotlin.js.asDynamic' call
819
+ return [IntSerializer_getInstance(), $serializer_getInstance(), StringSerializer_getInstance(), StringSerializer_getInstance(), $serializer_getInstance_0()];
820
+ };
821
+ var $serializer_instance_0;
822
+ function $serializer_getInstance_1() {
823
+ if ($serializer_instance_0 == null)
824
+ new $serializer_0();
825
+ return $serializer_instance_0;
826
+ }
827
+ function Prove_init_$Init$(seen0, id, request, steamAccessToken, steamSessionId, settings, serializationConstructorMarker, $this) {
828
+ if (!(31 === (31 & seen0))) {
829
+ throwMissingFieldException(seen0, 31, $serializer_getInstance_1().qby_1);
830
+ }
831
+ $this.sby_1 = id;
832
+ $this.tby_1 = request;
833
+ $this.uby_1 = steamAccessToken;
834
+ $this.vby_1 = steamSessionId;
835
+ $this.wby_1 = settings;
836
+ return $this;
837
+ }
838
+ function Prove_init_$Create$(seen0, id, request, steamAccessToken, steamSessionId, settings, serializationConstructorMarker) {
839
+ return Prove_init_$Init$(seen0, id, request, steamAccessToken, steamSessionId, settings, serializationConstructorMarker, objectCreate(protoOf(Prove)));
840
+ }
841
+ function ToChild$Headers$Companion$$childSerializers$_anonymous__tbifd3() {
842
+ return new LinkedHashMapSerializer(StringSerializer_getInstance(), StringSerializer_getInstance());
843
+ }
844
+ function Companion_2() {
845
+ Companion_instance_5 = this;
846
+ var tmp = this;
847
+ var tmp_0 = LazyThreadSafetyMode_PUBLICATION_getInstance();
848
+ // Inline function 'kotlin.arrayOf' call
849
+ // Inline function 'kotlin.js.unsafeCast' call
850
+ // Inline function 'kotlin.js.asDynamic' call
851
+ tmp.xby_1 = [null, lazy(tmp_0, ToChild$Headers$Companion$$childSerializers$_anonymous__tbifd3), null];
852
+ }
853
+ var Companion_instance_5;
854
+ function Companion_getInstance_5() {
855
+ if (Companion_instance_5 == null)
856
+ new Companion_2();
857
+ return Companion_instance_5;
858
+ }
859
+ function $serializer_1() {
860
+ $serializer_instance_1 = this;
861
+ var tmp0_serialDesc = new PluginGeneratedSerialDescriptor('headers', this, 3);
862
+ tmp0_serialDesc.z2i('id', false);
863
+ tmp0_serialDesc.z2i('headers', true);
864
+ tmp0_serialDesc.z2i('error', true);
865
+ this.yby_1 = tmp0_serialDesc;
866
+ }
867
+ protoOf($serializer_1).zby = function (encoder, value) {
868
+ var tmp0_desc = this.yby_1;
869
+ var tmp1_output = encoder.j2b(tmp0_desc);
870
+ var tmp2_cached = Companion_getInstance_5().xby_1;
871
+ tmp1_output.t2c(tmp0_desc, 0, value.abz_1);
872
+ if (tmp1_output.g2d(tmp0_desc, 1) ? true : !(value.bbz_1 == null)) {
873
+ tmp1_output.c2d(tmp0_desc, 1, tmp2_cached[1].p1(), value.bbz_1);
874
+ }
875
+ if (tmp1_output.g2d(tmp0_desc, 2) ? true : !(value.cbz_1 == null)) {
876
+ tmp1_output.c2d(tmp0_desc, 2, StringSerializer_getInstance(), value.cbz_1);
877
+ }
878
+ tmp1_output.k2b(tmp0_desc);
879
+ };
880
+ protoOf($serializer_1).b28 = function (encoder, value) {
881
+ return this.zby(encoder, value instanceof Headers ? value : THROW_CCE());
882
+ };
883
+ protoOf($serializer_1).c28 = function (decoder) {
884
+ var tmp0_desc = this.yby_1;
885
+ var tmp1_flag = true;
886
+ var tmp2_index = 0;
887
+ var tmp3_bitMask0 = 0;
888
+ var tmp4_local0 = 0;
889
+ var tmp5_local1 = null;
890
+ var tmp6_local2 = null;
891
+ var tmp7_input = decoder.j2b(tmp0_desc);
892
+ var tmp8_cached = Companion_getInstance_5().xby_1;
893
+ if (tmp7_input.z2b()) {
894
+ tmp4_local0 = tmp7_input.o2b(tmp0_desc, 0);
895
+ tmp3_bitMask0 = tmp3_bitMask0 | 1;
896
+ tmp5_local1 = tmp7_input.x2b(tmp0_desc, 1, tmp8_cached[1].p1(), tmp5_local1);
897
+ tmp3_bitMask0 = tmp3_bitMask0 | 2;
898
+ tmp6_local2 = tmp7_input.x2b(tmp0_desc, 2, StringSerializer_getInstance(), tmp6_local2);
899
+ tmp3_bitMask0 = tmp3_bitMask0 | 4;
900
+ } else
901
+ while (tmp1_flag) {
902
+ tmp2_index = tmp7_input.a2c(tmp0_desc);
903
+ switch (tmp2_index) {
904
+ case -1:
905
+ tmp1_flag = false;
906
+ break;
907
+ case 0:
908
+ tmp4_local0 = tmp7_input.o2b(tmp0_desc, 0);
909
+ tmp3_bitMask0 = tmp3_bitMask0 | 1;
910
+ break;
911
+ case 1:
912
+ tmp5_local1 = tmp7_input.x2b(tmp0_desc, 1, tmp8_cached[1].p1(), tmp5_local1);
913
+ tmp3_bitMask0 = tmp3_bitMask0 | 2;
914
+ break;
915
+ case 2:
916
+ tmp6_local2 = tmp7_input.x2b(tmp0_desc, 2, StringSerializer_getInstance(), tmp6_local2);
917
+ tmp3_bitMask0 = tmp3_bitMask0 | 4;
918
+ break;
919
+ default:
920
+ throw UnknownFieldException_init_$Create$(tmp2_index);
921
+ }
922
+ }
923
+ tmp7_input.k2b(tmp0_desc);
924
+ return Headers_init_$Create$(tmp3_bitMask0, tmp4_local0, tmp5_local1, tmp6_local2, null);
925
+ };
926
+ protoOf($serializer_1).a28 = function () {
927
+ return this.yby_1;
928
+ };
929
+ protoOf($serializer_1).q2j = function () {
930
+ var tmp0_cached = Companion_getInstance_5().xby_1;
931
+ // Inline function 'kotlin.arrayOf' call
932
+ // Inline function 'kotlin.js.unsafeCast' call
933
+ // Inline function 'kotlin.js.asDynamic' call
934
+ return [IntSerializer_getInstance(), get_nullable(tmp0_cached[1].p1()), get_nullable(StringSerializer_getInstance())];
935
+ };
936
+ var $serializer_instance_1;
937
+ function $serializer_getInstance_2() {
938
+ if ($serializer_instance_1 == null)
939
+ new $serializer_1();
940
+ return $serializer_instance_1;
941
+ }
942
+ function Headers_init_$Init$(seen0, id, headers, error, serializationConstructorMarker, $this) {
943
+ if (!(1 === (1 & seen0))) {
944
+ throwMissingFieldException(seen0, 1, $serializer_getInstance_2().yby_1);
945
+ }
946
+ $this.abz_1 = id;
947
+ if (0 === (seen0 & 2))
948
+ $this.bbz_1 = null;
949
+ else
950
+ $this.bbz_1 = headers;
951
+ if (0 === (seen0 & 4))
952
+ $this.cbz_1 = null;
953
+ else
954
+ $this.cbz_1 = error;
955
+ return $this;
956
+ }
957
+ function Headers_init_$Create$(seen0, id, headers, error, serializationConstructorMarker) {
958
+ return Headers_init_$Init$(seen0, id, headers, error, serializationConstructorMarker, objectCreate(protoOf(Headers)));
959
+ }
960
+ function Prove(id, request, steamAccessToken, steamSessionId, settings) {
961
+ this.sby_1 = id;
962
+ this.tby_1 = request;
963
+ this.uby_1 = steamAccessToken;
964
+ this.vby_1 = steamSessionId;
965
+ this.wby_1 = settings;
966
+ }
967
+ protoOf(Prove).toString = function () {
968
+ return 'Prove(id=' + this.sby_1 + ', request=' + this.tby_1.toString() + ', steamAccessToken=<redacted>, steamSessionId=<redacted>)';
969
+ };
970
+ protoOf(Prove).hashCode = function () {
971
+ var result = this.sby_1;
972
+ result = imul(result, 31) + this.tby_1.hashCode() | 0;
973
+ result = imul(result, 31) + getStringHashCode(this.uby_1) | 0;
974
+ result = imul(result, 31) + getStringHashCode(this.vby_1) | 0;
975
+ result = imul(result, 31) + this.wby_1.hashCode() | 0;
976
+ return result;
977
+ };
978
+ protoOf(Prove).equals = function (other) {
979
+ if (this === other)
980
+ return true;
981
+ if (!(other instanceof Prove))
982
+ return false;
983
+ if (!(this.sby_1 === other.sby_1))
984
+ return false;
985
+ if (!this.tby_1.equals(other.tby_1))
986
+ return false;
987
+ if (!(this.uby_1 === other.uby_1))
988
+ return false;
989
+ if (!(this.vby_1 === other.vby_1))
990
+ return false;
991
+ if (!this.wby_1.equals(other.wby_1))
992
+ return false;
993
+ return true;
994
+ };
995
+ function Headers(id, headers, error) {
996
+ Companion_getInstance_5();
997
+ headers = headers === VOID ? null : headers;
998
+ error = error === VOID ? null : error;
999
+ this.abz_1 = id;
1000
+ this.bbz_1 = headers;
1001
+ this.cbz_1 = error;
1002
+ }
1003
+ protoOf(Headers).toString = function () {
1004
+ var tmp0_safe_receiver = this.bbz_1;
1005
+ return 'Headers(id=' + this.abz_1 + ', headers=' + toString(tmp0_safe_receiver == null ? null : tmp0_safe_receiver.x2()) + ': <redacted>, error=' + this.cbz_1 + ')';
1006
+ };
1007
+ protoOf(Headers).hashCode = function () {
1008
+ var result = this.abz_1;
1009
+ result = imul(result, 31) + (this.bbz_1 == null ? 0 : hashCode(this.bbz_1)) | 0;
1010
+ result = imul(result, 31) + (this.cbz_1 == null ? 0 : getStringHashCode(this.cbz_1)) | 0;
1011
+ return result;
1012
+ };
1013
+ protoOf(Headers).equals = function (other) {
1014
+ if (this === other)
1015
+ return true;
1016
+ if (!(other instanceof Headers))
1017
+ return false;
1018
+ if (!(this.abz_1 === other.abz_1))
1019
+ return false;
1020
+ if (!equals(this.bbz_1, other.bbz_1))
1021
+ return false;
1022
+ if (!(this.cbz_1 == other.cbz_1))
1023
+ return false;
1024
+ return true;
1025
+ };
1026
+ function Companion_3() {
1027
+ }
1028
+ protoOf(Companion_3).r54 = function () {
1029
+ var tmp = getKClass(ToChild);
1030
+ // Inline function 'kotlin.arrayOf' call
1031
+ // Inline function 'kotlin.js.unsafeCast' call
1032
+ // Inline function 'kotlin.js.asDynamic' call
1033
+ var tmp_0 = [getKClass(Headers), getKClass(Prove)];
1034
+ // Inline function 'kotlin.arrayOf' call
1035
+ // Inline function 'kotlin.js.unsafeCast' call
1036
+ // Inline function 'kotlin.js.asDynamic' call
1037
+ var tmp_1 = [$serializer_getInstance_2(), $serializer_getInstance_1()];
1038
+ // Inline function 'kotlin.arrayOf' call
1039
+ // Inline function 'kotlin.js.unsafeCast' call
1040
+ // Inline function 'kotlin.js.asDynamic' call
1041
+ var tmp$ret$6 = [];
1042
+ return SealedClassSerializer_init_$Create$('com.dmarket.p2p.headless.prover.ToChild', tmp, tmp_0, tmp_1, tmp$ret$6);
1043
+ };
1044
+ protoOf(Companion_3).b2k = function (typeParamsSerializers) {
1045
+ return this.r54();
1046
+ };
1047
+ var Companion_instance_6;
1048
+ function Companion_getInstance_6() {
1049
+ return Companion_instance_6;
1050
+ }
1051
+ function ToChild() {
1052
+ }
1053
+ function Companion_4() {
1054
+ }
1055
+ var Companion_instance_7;
1056
+ function Companion_getInstance_7() {
1057
+ return Companion_instance_7;
1058
+ }
1059
+ function $serializer_2() {
1060
+ $serializer_instance_2 = this;
1061
+ var tmp0_serialDesc = new PluginGeneratedSerialDescriptor('headers_wanted', this, 1);
1062
+ tmp0_serialDesc.z2i('id', false);
1063
+ this.dbz_1 = tmp0_serialDesc;
1064
+ }
1065
+ protoOf($serializer_2).ebz = function (encoder, value) {
1066
+ var tmp0_desc = this.dbz_1;
1067
+ var tmp1_output = encoder.j2b(tmp0_desc);
1068
+ tmp1_output.t2c(tmp0_desc, 0, value.fbz_1);
1069
+ tmp1_output.k2b(tmp0_desc);
1070
+ };
1071
+ protoOf($serializer_2).b28 = function (encoder, value) {
1072
+ return this.ebz(encoder, value instanceof HeadersWanted ? value : THROW_CCE());
1073
+ };
1074
+ protoOf($serializer_2).c28 = function (decoder) {
1075
+ var tmp0_desc = this.dbz_1;
1076
+ var tmp1_flag = true;
1077
+ var tmp2_index = 0;
1078
+ var tmp3_bitMask0 = 0;
1079
+ var tmp4_local0 = 0;
1080
+ var tmp5_input = decoder.j2b(tmp0_desc);
1081
+ if (tmp5_input.z2b()) {
1082
+ tmp4_local0 = tmp5_input.o2b(tmp0_desc, 0);
1083
+ tmp3_bitMask0 = tmp3_bitMask0 | 1;
1084
+ } else
1085
+ while (tmp1_flag) {
1086
+ tmp2_index = tmp5_input.a2c(tmp0_desc);
1087
+ switch (tmp2_index) {
1088
+ case -1:
1089
+ tmp1_flag = false;
1090
+ break;
1091
+ case 0:
1092
+ tmp4_local0 = tmp5_input.o2b(tmp0_desc, 0);
1093
+ tmp3_bitMask0 = tmp3_bitMask0 | 1;
1094
+ break;
1095
+ default:
1096
+ throw UnknownFieldException_init_$Create$(tmp2_index);
1097
+ }
1098
+ }
1099
+ tmp5_input.k2b(tmp0_desc);
1100
+ return HeadersWanted_init_$Create$(tmp3_bitMask0, tmp4_local0, null);
1101
+ };
1102
+ protoOf($serializer_2).a28 = function () {
1103
+ return this.dbz_1;
1104
+ };
1105
+ protoOf($serializer_2).q2j = function () {
1106
+ // Inline function 'kotlin.arrayOf' call
1107
+ // Inline function 'kotlin.js.unsafeCast' call
1108
+ // Inline function 'kotlin.js.asDynamic' call
1109
+ return [IntSerializer_getInstance()];
1110
+ };
1111
+ var $serializer_instance_2;
1112
+ function $serializer_getInstance_3() {
1113
+ if ($serializer_instance_2 == null)
1114
+ new $serializer_2();
1115
+ return $serializer_instance_2;
1116
+ }
1117
+ function HeadersWanted_init_$Init$(seen0, id, serializationConstructorMarker, $this) {
1118
+ if (!(1 === (1 & seen0))) {
1119
+ throwMissingFieldException(seen0, 1, $serializer_getInstance_3().dbz_1);
1120
+ }
1121
+ $this.fbz_1 = id;
1122
+ return $this;
1123
+ }
1124
+ function HeadersWanted_init_$Create$(seen0, id, serializationConstructorMarker) {
1125
+ return HeadersWanted_init_$Init$(seen0, id, serializationConstructorMarker, objectCreate(protoOf(HeadersWanted)));
1126
+ }
1127
+ function Companion_5() {
1128
+ }
1129
+ var Companion_instance_8;
1130
+ function Companion_getInstance_8() {
1131
+ return Companion_instance_8;
1132
+ }
1133
+ function $serializer_3() {
1134
+ $serializer_instance_3 = this;
1135
+ var tmp0_serialDesc = new PluginGeneratedSerialDescriptor('proved', this, 2);
1136
+ tmp0_serialDesc.z2i('id', false);
1137
+ tmp0_serialDesc.z2i('presentation', false);
1138
+ this.gbz_1 = tmp0_serialDesc;
1139
+ }
1140
+ protoOf($serializer_3).hbz = function (encoder, value) {
1141
+ var tmp0_desc = this.gbz_1;
1142
+ var tmp1_output = encoder.j2b(tmp0_desc);
1143
+ tmp1_output.t2c(tmp0_desc, 0, value.ibz_1);
1144
+ tmp1_output.y2c(tmp0_desc, 1, value.jbz_1);
1145
+ tmp1_output.k2b(tmp0_desc);
1146
+ };
1147
+ protoOf($serializer_3).b28 = function (encoder, value) {
1148
+ return this.hbz(encoder, value instanceof Proved_0 ? value : THROW_CCE());
1149
+ };
1150
+ protoOf($serializer_3).c28 = function (decoder) {
1151
+ var tmp0_desc = this.gbz_1;
1152
+ var tmp1_flag = true;
1153
+ var tmp2_index = 0;
1154
+ var tmp3_bitMask0 = 0;
1155
+ var tmp4_local0 = 0;
1156
+ var tmp5_local1 = null;
1157
+ var tmp6_input = decoder.j2b(tmp0_desc);
1158
+ if (tmp6_input.z2b()) {
1159
+ tmp4_local0 = tmp6_input.o2b(tmp0_desc, 0);
1160
+ tmp3_bitMask0 = tmp3_bitMask0 | 1;
1161
+ tmp5_local1 = tmp6_input.t2b(tmp0_desc, 1);
1162
+ tmp3_bitMask0 = tmp3_bitMask0 | 2;
1163
+ } else
1164
+ while (tmp1_flag) {
1165
+ tmp2_index = tmp6_input.a2c(tmp0_desc);
1166
+ switch (tmp2_index) {
1167
+ case -1:
1168
+ tmp1_flag = false;
1169
+ break;
1170
+ case 0:
1171
+ tmp4_local0 = tmp6_input.o2b(tmp0_desc, 0);
1172
+ tmp3_bitMask0 = tmp3_bitMask0 | 1;
1173
+ break;
1174
+ case 1:
1175
+ tmp5_local1 = tmp6_input.t2b(tmp0_desc, 1);
1176
+ tmp3_bitMask0 = tmp3_bitMask0 | 2;
1177
+ break;
1178
+ default:
1179
+ throw UnknownFieldException_init_$Create$(tmp2_index);
1180
+ }
1181
+ }
1182
+ tmp6_input.k2b(tmp0_desc);
1183
+ return Proved_init_$Create$(tmp3_bitMask0, tmp4_local0, tmp5_local1, null);
1184
+ };
1185
+ protoOf($serializer_3).a28 = function () {
1186
+ return this.gbz_1;
1187
+ };
1188
+ protoOf($serializer_3).q2j = function () {
1189
+ // Inline function 'kotlin.arrayOf' call
1190
+ // Inline function 'kotlin.js.unsafeCast' call
1191
+ // Inline function 'kotlin.js.asDynamic' call
1192
+ return [IntSerializer_getInstance(), StringSerializer_getInstance()];
1193
+ };
1194
+ var $serializer_instance_3;
1195
+ function $serializer_getInstance_4() {
1196
+ if ($serializer_instance_3 == null)
1197
+ new $serializer_3();
1198
+ return $serializer_instance_3;
1199
+ }
1200
+ function Proved_init_$Init$(seen0, id, presentation, serializationConstructorMarker, $this) {
1201
+ if (!(3 === (3 & seen0))) {
1202
+ throwMissingFieldException(seen0, 3, $serializer_getInstance_4().gbz_1);
1203
+ }
1204
+ $this.ibz_1 = id;
1205
+ $this.jbz_1 = presentation;
1206
+ return $this;
1207
+ }
1208
+ function Proved_init_$Create$(seen0, id, presentation, serializationConstructorMarker) {
1209
+ return Proved_init_$Init$(seen0, id, presentation, serializationConstructorMarker, objectCreate(protoOf(Proved_0)));
1210
+ }
1211
+ function FromChild$Failed$Companion$$childSerializers$_anonymous__8w30xx() {
1212
+ return Companion_instance_0.r54();
1213
+ }
1214
+ function Companion_6() {
1215
+ Companion_instance_9 = this;
1216
+ var tmp = this;
1217
+ var tmp_0 = LazyThreadSafetyMode_PUBLICATION_getInstance();
1218
+ // Inline function 'kotlin.arrayOf' call
1219
+ // Inline function 'kotlin.js.unsafeCast' call
1220
+ // Inline function 'kotlin.js.asDynamic' call
1221
+ tmp.kbz_1 = [null, lazy(tmp_0, FromChild$Failed$Companion$$childSerializers$_anonymous__8w30xx)];
1222
+ }
1223
+ var Companion_instance_9;
1224
+ function Companion_getInstance_9() {
1225
+ if (Companion_instance_9 == null)
1226
+ new Companion_6();
1227
+ return Companion_instance_9;
1228
+ }
1229
+ function $serializer_4() {
1230
+ $serializer_instance_4 = this;
1231
+ var tmp0_serialDesc = new PluginGeneratedSerialDescriptor('failed', this, 2);
1232
+ tmp0_serialDesc.z2i('id', false);
1233
+ tmp0_serialDesc.z2i('failure', false);
1234
+ this.lbz_1 = tmp0_serialDesc;
1235
+ }
1236
+ protoOf($serializer_4).mbz = function (encoder, value) {
1237
+ var tmp0_desc = this.lbz_1;
1238
+ var tmp1_output = encoder.j2b(tmp0_desc);
1239
+ var tmp2_cached = Companion_getInstance_9().kbz_1;
1240
+ tmp1_output.t2c(tmp0_desc, 0, value.nbz_1);
1241
+ tmp1_output.a2d(tmp0_desc, 1, tmp2_cached[1].p1(), value.obz_1);
1242
+ tmp1_output.k2b(tmp0_desc);
1243
+ };
1244
+ protoOf($serializer_4).b28 = function (encoder, value) {
1245
+ return this.mbz(encoder, value instanceof Failed_0 ? value : THROW_CCE());
1246
+ };
1247
+ protoOf($serializer_4).c28 = function (decoder) {
1248
+ var tmp0_desc = this.lbz_1;
1249
+ var tmp1_flag = true;
1250
+ var tmp2_index = 0;
1251
+ var tmp3_bitMask0 = 0;
1252
+ var tmp4_local0 = 0;
1253
+ var tmp5_local1 = null;
1254
+ var tmp6_input = decoder.j2b(tmp0_desc);
1255
+ var tmp7_cached = Companion_getInstance_9().kbz_1;
1256
+ if (tmp6_input.z2b()) {
1257
+ tmp4_local0 = tmp6_input.o2b(tmp0_desc, 0);
1258
+ tmp3_bitMask0 = tmp3_bitMask0 | 1;
1259
+ tmp5_local1 = tmp6_input.v2b(tmp0_desc, 1, tmp7_cached[1].p1(), tmp5_local1);
1260
+ tmp3_bitMask0 = tmp3_bitMask0 | 2;
1261
+ } else
1262
+ while (tmp1_flag) {
1263
+ tmp2_index = tmp6_input.a2c(tmp0_desc);
1264
+ switch (tmp2_index) {
1265
+ case -1:
1266
+ tmp1_flag = false;
1267
+ break;
1268
+ case 0:
1269
+ tmp4_local0 = tmp6_input.o2b(tmp0_desc, 0);
1270
+ tmp3_bitMask0 = tmp3_bitMask0 | 1;
1271
+ break;
1272
+ case 1:
1273
+ tmp5_local1 = tmp6_input.v2b(tmp0_desc, 1, tmp7_cached[1].p1(), tmp5_local1);
1274
+ tmp3_bitMask0 = tmp3_bitMask0 | 2;
1275
+ break;
1276
+ default:
1277
+ throw UnknownFieldException_init_$Create$(tmp2_index);
1278
+ }
1279
+ }
1280
+ tmp6_input.k2b(tmp0_desc);
1281
+ return Failed_init_$Create$(tmp3_bitMask0, tmp4_local0, tmp5_local1, null);
1282
+ };
1283
+ protoOf($serializer_4).a28 = function () {
1284
+ return this.lbz_1;
1285
+ };
1286
+ protoOf($serializer_4).q2j = function () {
1287
+ var tmp0_cached = Companion_getInstance_9().kbz_1;
1288
+ // Inline function 'kotlin.arrayOf' call
1289
+ // Inline function 'kotlin.js.unsafeCast' call
1290
+ // Inline function 'kotlin.js.asDynamic' call
1291
+ return [IntSerializer_getInstance(), tmp0_cached[1].p1()];
1292
+ };
1293
+ var $serializer_instance_4;
1294
+ function $serializer_getInstance_5() {
1295
+ if ($serializer_instance_4 == null)
1296
+ new $serializer_4();
1297
+ return $serializer_instance_4;
1298
+ }
1299
+ function Failed_init_$Init$(seen0, id, failure, serializationConstructorMarker, $this) {
1300
+ if (!(3 === (3 & seen0))) {
1301
+ throwMissingFieldException(seen0, 3, $serializer_getInstance_5().lbz_1);
1302
+ }
1303
+ $this.nbz_1 = id;
1304
+ $this.obz_1 = failure;
1305
+ return $this;
1306
+ }
1307
+ function Failed_init_$Create$(seen0, id, failure, serializationConstructorMarker) {
1308
+ return Failed_init_$Init$(seen0, id, failure, serializationConstructorMarker, objectCreate(protoOf(Failed_0)));
1309
+ }
1310
+ function HeadersWanted(id) {
1311
+ this.fbz_1 = id;
1312
+ }
1313
+ protoOf(HeadersWanted).p6b = function () {
1314
+ return this.fbz_1;
1315
+ };
1316
+ protoOf(HeadersWanted).toString = function () {
1317
+ return 'HeadersWanted(id=' + this.fbz_1 + ')';
1318
+ };
1319
+ protoOf(HeadersWanted).hashCode = function () {
1320
+ return this.fbz_1;
1321
+ };
1322
+ protoOf(HeadersWanted).equals = function (other) {
1323
+ if (this === other)
1324
+ return true;
1325
+ if (!(other instanceof HeadersWanted))
1326
+ return false;
1327
+ if (!(this.fbz_1 === other.fbz_1))
1328
+ return false;
1329
+ return true;
1330
+ };
1331
+ function Proved_0(id, presentation) {
1332
+ this.ibz_1 = id;
1333
+ this.jbz_1 = presentation;
1334
+ }
1335
+ protoOf(Proved_0).p6b = function () {
1336
+ return this.ibz_1;
1337
+ };
1338
+ protoOf(Proved_0).toString = function () {
1339
+ return 'Proved(id=' + this.ibz_1 + ', presentation=' + this.jbz_1 + ')';
1340
+ };
1341
+ protoOf(Proved_0).hashCode = function () {
1342
+ var result = this.ibz_1;
1343
+ result = imul(result, 31) + getStringHashCode(this.jbz_1) | 0;
1344
+ return result;
1345
+ };
1346
+ protoOf(Proved_0).equals = function (other) {
1347
+ if (this === other)
1348
+ return true;
1349
+ if (!(other instanceof Proved_0))
1350
+ return false;
1351
+ if (!(this.ibz_1 === other.ibz_1))
1352
+ return false;
1353
+ if (!(this.jbz_1 === other.jbz_1))
1354
+ return false;
1355
+ return true;
1356
+ };
1357
+ function Failed_0(id, failure) {
1358
+ Companion_getInstance_9();
1359
+ this.nbz_1 = id;
1360
+ this.obz_1 = failure;
1361
+ }
1362
+ protoOf(Failed_0).p6b = function () {
1363
+ return this.nbz_1;
1364
+ };
1365
+ protoOf(Failed_0).toString = function () {
1366
+ return 'Failed(id=' + this.nbz_1 + ', failure=' + toString_0(this.obz_1) + ')';
1367
+ };
1368
+ protoOf(Failed_0).hashCode = function () {
1369
+ var result = this.nbz_1;
1370
+ result = imul(result, 31) + hashCode(this.obz_1) | 0;
1371
+ return result;
1372
+ };
1373
+ protoOf(Failed_0).equals = function (other) {
1374
+ if (this === other)
1375
+ return true;
1376
+ if (!(other instanceof Failed_0))
1377
+ return false;
1378
+ if (!(this.nbz_1 === other.nbz_1))
1379
+ return false;
1380
+ if (!equals(this.obz_1, other.obz_1))
1381
+ return false;
1382
+ return true;
1383
+ };
1384
+ function Companion_7() {
1385
+ }
1386
+ protoOf(Companion_7).r54 = function () {
1387
+ var tmp = getKClass(FromChild);
1388
+ // Inline function 'kotlin.arrayOf' call
1389
+ // Inline function 'kotlin.js.unsafeCast' call
1390
+ // Inline function 'kotlin.js.asDynamic' call
1391
+ var tmp_0 = [getKClass(Failed_0), getKClass(HeadersWanted), getKClass(Proved_0)];
1392
+ // Inline function 'kotlin.arrayOf' call
1393
+ // Inline function 'kotlin.js.unsafeCast' call
1394
+ // Inline function 'kotlin.js.asDynamic' call
1395
+ var tmp_1 = [$serializer_getInstance_5(), $serializer_getInstance_3(), $serializer_getInstance_4()];
1396
+ // Inline function 'kotlin.arrayOf' call
1397
+ // Inline function 'kotlin.js.unsafeCast' call
1398
+ // Inline function 'kotlin.js.asDynamic' call
1399
+ var tmp$ret$6 = [];
1400
+ return SealedClassSerializer_init_$Create$('com.dmarket.p2p.headless.prover.FromChild', tmp, tmp_0, tmp_1, tmp$ret$6);
1401
+ };
1402
+ protoOf(Companion_7).b2k = function (typeParamsSerializers) {
1403
+ return this.r54();
1404
+ };
1405
+ var Companion_instance_10;
1406
+ function Companion_getInstance_10() {
1407
+ return Companion_instance_10;
1408
+ }
1409
+ function FromChild() {
1410
+ }
1411
+ function ProverOutput() {
1412
+ ProverOutput_instance = this;
1413
+ this.fbx_1 = NetworkRedaction_getInstance().l66('access_token');
1414
+ this.gbx_1 = 2000;
1415
+ }
1416
+ protoOf(ProverOutput).k76 = function (line) {
1417
+ // Inline function 'kotlin.text.orEmpty' call
1418
+ var tmp0_elvis_lhs = NetworkRedaction_getInstance().k66(TradingApiSignature_getInstance().k76(line), this.fbx_1, 2000);
1419
+ return tmp0_elvis_lhs == null ? '' : tmp0_elvis_lhs;
1420
+ };
1421
+ var ProverOutput_instance;
1422
+ function ProverOutput_getInstance() {
1423
+ if (ProverOutput_instance == null)
1424
+ new ProverOutput();
1425
+ return ProverOutput_instance;
1426
+ }
1427
+ function get_trackers() {
1428
+ _init_properties_HeadlessApi_kt__cjiogh();
1429
+ return trackers;
1430
+ }
1431
+ var trackers;
1432
+ function runProverChild() {
1433
+ _init_properties_HeadlessApi_kt__cjiogh();
1434
+ return runProverChild_0(new NodeWasmProver(new SystemClock()));
1435
+ }
1436
+ function headlessVersion() {
1437
+ _init_properties_HeadlessApi_kt__cjiogh();
1438
+ return '1.0.4-SNAPSHOT';
1439
+ }
1440
+ function createHeadlessTracker(options) {
1441
+ _init_properties_HeadlessApi_kt__cjiogh();
1442
+ return create(Companion_getInstance_11().rbz(options), null, null, null);
1443
+ }
1444
+ function start(handle) {
1445
+ _init_properties_HeadlessApi_kt__cjiogh();
1446
+ var entry = entryOf(handle);
1447
+ if (entry.vbz_1)
1448
+ return Unit_instance;
1449
+ entry.vbz_1 = true;
1450
+ entry.sbz_1.sb8();
1451
+ }
1452
+ function cycle(handle) {
1453
+ _init_properties_HeadlessApi_kt__cjiogh();
1454
+ return call(handle, cycle$slambda_0(null));
1455
+ }
1456
+ function stop(handle) {
1457
+ _init_properties_HeadlessApi_kt__cjiogh();
1458
+ var tmp0_elvis_lhs = lookup(handle);
1459
+ var tmp;
1460
+ if (tmp0_elvis_lhs == null) {
1461
+ return refused(IllegalArgumentException_init_$Create$('unknown tracker handle'));
1462
+ } else {
1463
+ tmp = tmp0_elvis_lhs;
1464
+ }
1465
+ var entry = tmp;
1466
+ if (!entry.wbz_1) {
1467
+ entry.wbz_1 = true;
1468
+ var tmp1_safe_receiver = entry.ubz_1;
1469
+ if (tmp1_safe_receiver == null)
1470
+ null;
1471
+ else {
1472
+ tmp1_safe_receiver.h4();
1473
+ }
1474
+ cancel(entry.tbz_1);
1475
+ }
1476
+ return Promise.resolve(Unit_instance);
1477
+ }
1478
+ function pushTradingApiKey(handle, publicKey, secretKey) {
1479
+ _init_properties_HeadlessApi_kt__cjiogh();
1480
+ if (!(typeof publicKey === 'string') || !(typeof secretKey === 'string')) {
1481
+ return refused(IllegalArgumentException_init_$Create$('publicKey and secretKey must be strings'));
1482
+ }
1483
+ return call(handle, pushTradingApiKey$slambda_0(publicKey, secretKey, null));
1484
+ }
1485
+ function pushSteamToken(handle, accessToken) {
1486
+ _init_properties_HeadlessApi_kt__cjiogh();
1487
+ if (!(typeof accessToken === 'string'))
1488
+ return refused(IllegalArgumentException_init_$Create$('accessToken must be a string'));
1489
+ return call(handle, pushSteamToken$slambda_0(accessToken, null));
1490
+ }
1491
+ function trackerState(handle) {
1492
+ _init_properties_HeadlessApi_kt__cjiogh();
1493
+ return toJs_1(entryOf(handle).sbz_1.vb7());
1494
+ }
1495
+ function create(options, httpEngine, background, proverPackageRoot) {
1496
+ _init_properties_HeadlessApi_kt__cjiogh();
1497
+ var tmp0_elvis_lhs = options.gc0();
1498
+ var clock = tmp0_elvis_lhs == null ? new SystemClock() : tmp0_elvis_lhs;
1499
+ var tmp1_safe_receiver = options.dc0_1;
1500
+ var tmp;
1501
+ if (tmp1_safe_receiver == null) {
1502
+ tmp = null;
1503
+ } else {
1504
+ // Inline function 'kotlin.let' call
1505
+ tmp = proofHost(options, tmp1_safe_receiver, Companion_instance_12.qc0(proverPackageRoot, tmp1_safe_receiver.lc0_1), clock);
1506
+ }
1507
+ var proofHost_0 = tmp;
1508
+ var scope = CoroutineScope(SupervisorJob().gj(Dispatchers_getInstance().y18_1));
1509
+ var accounts = new AccountDirectories(options.xbz_1);
1510
+ var tmp_0 = create$lambda(accounts);
1511
+ var tmp2_elvis_lhs = options.rc0();
1512
+ var tmp_1 = tmp2_elvis_lhs == null ? NoOpEventObserver_instance : tmp2_elvis_lhs;
1513
+ var tmp_2;
1514
+ if (proofHost_0 == null) {
1515
+ tmp_2 = null;
1516
+ } else {
1517
+ // Inline function 'kotlin.let' call
1518
+ var tmp0_safe_receiver = options.dc0_1;
1519
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.ic0_1;
1520
+ tmp_2 = new HeadlessProving(proofHost_0, tmp1_elvis_lhs == null ? 1 : tmp1_elvis_lhs);
1521
+ }
1522
+ var platform = new HeadlessPlatform(tmp_0, clock, tmp_1, httpEngine, VOID, tmp_2);
1523
+ var tmp_3 = background == null ? scope : background;
1524
+ // Inline function 'kotlin.let' call
1525
+ var it = Companion_instance_1.defaults();
1526
+ var tmp$ret$4 = it.copy(VOID, VOID, VOID, VOID, VOID, it.notary.copy(VOID, options.ac0_1));
1527
+ var tracker = new HeadlessTracker(platform, tmp_3, options.ybz_1, tmp$ret$4, options.zbz_1);
1528
+ var handle = Object.freeze(Object.create(null));
1529
+ get_trackers().set(handle, new TrackerEntry(tracker, scope, proofHost_0));
1530
+ return handle;
1531
+ }
1532
+ function proofHost(options, prover, files, clock) {
1533
+ _init_properties_HeadlessApi_kt__cjiogh();
1534
+ var onLine = options.fc0_1;
1535
+ var onOutcome = options.ec0_1;
1536
+ var tmp = emptyList();
1537
+ var tmp_0 = new ProverSettings(options.ac0_1, prover.kc0_1, files.tc0_1);
1538
+ var tmp_1 = new ProverLimits(prover.mc0_1, prover.nc0_1, prover.jc0_1);
1539
+ var tmp_2 = proofHost$lambda(onLine);
1540
+ var tmp_3 = proofHost$lambda_0(onLine);
1541
+ return new ForkedProofHost(files.sc0_1, tmp, tmp_0, clock, tmp_1, VOID, VOID, tmp_2, tmp_3, proofHost$lambda_1(onOutcome));
1542
+ }
1543
+ function proofOutcome(dealId, failure) {
1544
+ _init_properties_HeadlessApi_kt__cjiogh();
1545
+ var o = plainObject();
1546
+ o.dealId = dealId;
1547
+ var tmp;
1548
+ if (failure == null) {
1549
+ tmp = null;
1550
+ } else {
1551
+ // Inline function 'kotlin.let' call
1552
+ tmp = JSON.parse(ProofOutcomeJson_getInstance().ibx(failure));
1553
+ }
1554
+ o.failure = tmp;
1555
+ return o;
1556
+ }
1557
+ function TrackerEntry(tracker, scope, proofHost) {
1558
+ this.sbz_1 = tracker;
1559
+ this.tbz_1 = scope;
1560
+ this.ubz_1 = proofHost;
1561
+ this.vbz_1 = false;
1562
+ this.wbz_1 = false;
1563
+ }
1564
+ function lookup(handle) {
1565
+ _init_properties_HeadlessApi_kt__cjiogh();
1566
+ return typeof handle === 'object' && !(handle == null) ? get_trackers().get(handle) : null;
1567
+ }
1568
+ function entryOf(handle) {
1569
+ _init_properties_HeadlessApi_kt__cjiogh();
1570
+ var tmp0_elvis_lhs = lookup(handle);
1571
+ var tmp;
1572
+ if (tmp0_elvis_lhs == null) {
1573
+ throw IllegalArgumentException_init_$Create$('unknown tracker handle');
1574
+ } else {
1575
+ tmp = tmp0_elvis_lhs;
1576
+ }
1577
+ var entry = tmp;
1578
+ // Inline function 'kotlin.check' call
1579
+ if (!!entry.wbz_1) {
1580
+ var message = 'tracker stopped';
1581
+ throw IllegalStateException_init_$Create$(toString_0(message));
1582
+ }
1583
+ return entry;
1584
+ }
1585
+ function refused(error) {
1586
+ _init_properties_HeadlessApi_kt__cjiogh();
1587
+ // Inline function 'kotlin.js.unsafeCast' call
1588
+ // Inline function 'kotlin.js.asDynamic' call
1589
+ return Promise.reject(error);
1590
+ }
1591
+ function call(handle, block) {
1592
+ _init_properties_HeadlessApi_kt__cjiogh();
1593
+ var tmp;
1594
+ try {
1595
+ tmp = entryOf(handle);
1596
+ } catch ($p) {
1597
+ var tmp_0;
1598
+ if ($p instanceof Error) {
1599
+ var e = $p;
1600
+ return refused(e);
1601
+ } else {
1602
+ throw $p;
1603
+ }
1604
+ }
1605
+ var entry = tmp;
1606
+ return promise_0(entry.tbz_1, VOID, VOID, call$slambda_0(block, entry, null));
1607
+ }
1608
+ function cycle$slambda(resultContinuation) {
1609
+ CoroutineImpl.call(this, resultContinuation);
1610
+ }
1611
+ protoOf(cycle$slambda).dc1 = function ($this$call, $completion) {
1612
+ var tmp = this.ec1($this$call, $completion);
1613
+ tmp.i9_1 = Unit_instance;
1614
+ tmp.j9_1 = null;
1615
+ return tmp.o9();
1616
+ };
1617
+ protoOf(cycle$slambda).ba = function (p1, $completion) {
1618
+ return this.dc1(p1 instanceof TrackerEntry ? p1 : THROW_CCE(), $completion);
1619
+ };
1620
+ protoOf(cycle$slambda).o9 = function () {
1621
+ var suspendResult = this.i9_1;
1622
+ $sm: do
1623
+ try {
1624
+ var tmp = this.g9_1;
1625
+ switch (tmp) {
1626
+ case 0:
1627
+ this.h9_1 = 2;
1628
+ this.g9_1 = 1;
1629
+ suspendResult = this.cc1_1.sbz_1.nb3(this);
1630
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1631
+ return suspendResult;
1632
+ }
1633
+
1634
+ continue $sm;
1635
+ case 1:
1636
+ return Unit_instance;
1637
+ case 2:
1638
+ throw this.j9_1;
1639
+ }
1640
+ } catch ($p) {
1641
+ var e = $p;
1642
+ if (this.h9_1 === 2) {
1643
+ throw e;
1644
+ } else {
1645
+ this.g9_1 = this.h9_1;
1646
+ this.j9_1 = e;
1647
+ }
1648
+ }
1649
+ while (true);
1650
+ };
1651
+ protoOf(cycle$slambda).ec1 = function ($this$call, completion) {
1652
+ var i = new cycle$slambda(completion);
1653
+ i.cc1_1 = $this$call;
1654
+ return i;
1655
+ };
1656
+ function cycle$slambda_0(resultContinuation) {
1657
+ var i = new cycle$slambda(resultContinuation);
1658
+ return constructCallableReference(function ($this$call, $completion) {
1659
+ return i.dc1($this$call, $completion);
1660
+ }, 1);
1661
+ }
1662
+ function pushTradingApiKey$slambda($publicKey, $secretKey, resultContinuation) {
1663
+ this.nc1_1 = $publicKey;
1664
+ this.oc1_1 = $secretKey;
1665
+ CoroutineImpl.call(this, resultContinuation);
1666
+ }
1667
+ protoOf(pushTradingApiKey$slambda).qc1 = function ($this$call, $completion) {
1668
+ var tmp = this.ec1($this$call, $completion);
1669
+ tmp.i9_1 = Unit_instance;
1670
+ tmp.j9_1 = null;
1671
+ return tmp.o9();
1672
+ };
1673
+ protoOf(pushTradingApiKey$slambda).ba = function (p1, $completion) {
1674
+ return this.qc1(p1 instanceof TrackerEntry ? p1 : THROW_CCE(), $completion);
1675
+ };
1676
+ protoOf(pushTradingApiKey$slambda).o9 = function () {
1677
+ var suspendResult = this.i9_1;
1678
+ $sm: do
1679
+ try {
1680
+ var tmp = this.g9_1;
1681
+ switch (tmp) {
1682
+ case 0:
1683
+ this.h9_1 = 2;
1684
+ this.g9_1 = 1;
1685
+ suspendResult = this.pc1_1.sbz_1.tb8(this.nc1_1, this.oc1_1, this);
1686
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1687
+ return suspendResult;
1688
+ }
1689
+
1690
+ continue $sm;
1691
+ case 1:
1692
+ var push = suspendResult;
1693
+ var tmp_0;
1694
+ if (push instanceof Held) {
1695
+ tmp_0 = !push.o7v_1.equals(KeyChange_SAME_getInstance());
1696
+ } else {
1697
+ tmp_0 = false;
1698
+ }
1699
+
1700
+ if (tmp_0) {
1701
+ var tmp0_safe_receiver = this.pc1_1.ubz_1;
1702
+ if (tmp0_safe_receiver == null)
1703
+ null;
1704
+ else {
1705
+ tmp0_safe_receiver.aby();
1706
+ }
1707
+ }
1708
+
1709
+ return toJs(push);
1710
+ case 2:
1711
+ throw this.j9_1;
1712
+ }
1713
+ } catch ($p) {
1714
+ var e = $p;
1715
+ if (this.h9_1 === 2) {
1716
+ throw e;
1717
+ } else {
1718
+ this.g9_1 = this.h9_1;
1719
+ this.j9_1 = e;
1720
+ }
1721
+ }
1722
+ while (true);
1723
+ };
1724
+ protoOf(pushTradingApiKey$slambda).ec1 = function ($this$call, completion) {
1725
+ var i = new pushTradingApiKey$slambda(this.nc1_1, this.oc1_1, completion);
1726
+ i.pc1_1 = $this$call;
1727
+ return i;
1728
+ };
1729
+ function pushTradingApiKey$slambda_0($publicKey, $secretKey, resultContinuation) {
1730
+ var i = new pushTradingApiKey$slambda($publicKey, $secretKey, resultContinuation);
1731
+ return constructCallableReference(function ($this$call, $completion) {
1732
+ return i.qc1($this$call, $completion);
1733
+ }, 1);
1734
+ }
1735
+ function pushSteamToken$slambda($accessToken, resultContinuation) {
1736
+ this.zc1_1 = $accessToken;
1737
+ CoroutineImpl.call(this, resultContinuation);
1738
+ }
1739
+ protoOf(pushSteamToken$slambda).qc1 = function ($this$call, $completion) {
1740
+ var tmp = this.ec1($this$call, $completion);
1741
+ tmp.i9_1 = Unit_instance;
1742
+ tmp.j9_1 = null;
1743
+ return tmp.o9();
1744
+ };
1745
+ protoOf(pushSteamToken$slambda).ba = function (p1, $completion) {
1746
+ return this.qc1(p1 instanceof TrackerEntry ? p1 : THROW_CCE(), $completion);
1747
+ };
1748
+ protoOf(pushSteamToken$slambda).o9 = function () {
1749
+ var suspendResult = this.i9_1;
1750
+ $sm: do
1751
+ try {
1752
+ var tmp = this.g9_1;
1753
+ switch (tmp) {
1754
+ case 0:
1755
+ this.h9_1 = 2;
1756
+ this.g9_1 = 1;
1757
+ suspendResult = this.ac2_1.sbz_1.ub8(this.zc1_1, this);
1758
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1759
+ return suspendResult;
1760
+ }
1761
+
1762
+ continue $sm;
1763
+ case 1:
1764
+ var ARGUMENT = suspendResult;
1765
+ return toJs_0(ARGUMENT);
1766
+ case 2:
1767
+ throw this.j9_1;
1768
+ }
1769
+ } catch ($p) {
1770
+ var e = $p;
1771
+ if (this.h9_1 === 2) {
1772
+ throw e;
1773
+ } else {
1774
+ this.g9_1 = this.h9_1;
1775
+ this.j9_1 = e;
1776
+ }
1777
+ }
1778
+ while (true);
1779
+ };
1780
+ protoOf(pushSteamToken$slambda).ec1 = function ($this$call, completion) {
1781
+ var i = new pushSteamToken$slambda(this.zc1_1, completion);
1782
+ i.ac2_1 = $this$call;
1783
+ return i;
1784
+ };
1785
+ function pushSteamToken$slambda_0($accessToken, resultContinuation) {
1786
+ var i = new pushSteamToken$slambda($accessToken, resultContinuation);
1787
+ return constructCallableReference(function ($this$call, $completion) {
1788
+ return i.qc1($this$call, $completion);
1789
+ }, 1);
1790
+ }
1791
+ function create$lambda($accounts) {
1792
+ return function (it) {
1793
+ return $accounts.dc2(_SteamId___get_value__impl__qjh21u(it.p5w_1));
1794
+ };
1795
+ }
1796
+ function proofHost$lambda($onLine) {
1797
+ return function (_unused_var__etf5q3, stream, line) {
1798
+ var tmp0_safe_receiver = $onLine;
1799
+ if (tmp0_safe_receiver == null)
1800
+ null;
1801
+ else {
1802
+ // Inline function 'kotlin.let' call
1803
+ // Inline function 'kotlin.runCatching' call
1804
+ var tmp;
1805
+ try {
1806
+ tmp0_safe_receiver(stream, line);
1807
+ // Inline function 'kotlin.Companion.success' call
1808
+ tmp = _Result___init__impl__xyqfz8(Unit_instance);
1809
+ } catch ($p) {
1810
+ var tmp_0;
1811
+ if ($p instanceof Error) {
1812
+ var e = $p;
1813
+ // Inline function 'kotlin.Companion.failure' call
1814
+ tmp_0 = _Result___init__impl__xyqfz8(createFailure(e));
1815
+ } else {
1816
+ throw $p;
1817
+ }
1818
+ tmp = tmp_0;
1819
+ }
1820
+ }
1821
+ return Unit_instance;
1822
+ };
1823
+ }
1824
+ function proofHost$lambda_0($onLine) {
1825
+ return function (message, warning, fields) {
1826
+ var tmp0_safe_receiver = $onLine;
1827
+ if (tmp0_safe_receiver == null)
1828
+ null;
1829
+ else {
1830
+ // Inline function 'kotlin.let' call
1831
+ // Inline function 'kotlin.runCatching' call
1832
+ var tmp;
1833
+ try {
1834
+ tmp0_safe_receiver('host', ProofOutcomeJson_getInstance().jbx(message, warning, fields));
1835
+ // Inline function 'kotlin.Companion.success' call
1836
+ tmp = _Result___init__impl__xyqfz8(Unit_instance);
1837
+ } catch ($p) {
1838
+ var tmp_0;
1839
+ if ($p instanceof Error) {
1840
+ var e = $p;
1841
+ // Inline function 'kotlin.Companion.failure' call
1842
+ tmp_0 = _Result___init__impl__xyqfz8(createFailure(e));
1843
+ } else {
1844
+ throw $p;
1845
+ }
1846
+ tmp = tmp_0;
1847
+ }
1848
+ }
1849
+ return Unit_instance;
1850
+ };
1851
+ }
1852
+ function proofHost$lambda_1($onOutcome) {
1853
+ return function (dealId, failure) {
1854
+ var tmp0_safe_receiver = $onOutcome;
1855
+ if (tmp0_safe_receiver == null)
1856
+ null;
1857
+ else {
1858
+ // Inline function 'kotlin.let' call
1859
+ // Inline function 'kotlin.runCatching' call
1860
+ var tmp;
1861
+ try {
1862
+ tmp0_safe_receiver(proofOutcome(dealId, failure));
1863
+ // Inline function 'kotlin.Companion.success' call
1864
+ tmp = _Result___init__impl__xyqfz8(Unit_instance);
1865
+ } catch ($p) {
1866
+ var tmp_0;
1867
+ if ($p instanceof Error) {
1868
+ var e = $p;
1869
+ // Inline function 'kotlin.Companion.failure' call
1870
+ tmp_0 = _Result___init__impl__xyqfz8(createFailure(e));
1871
+ } else {
1872
+ throw $p;
1873
+ }
1874
+ tmp = tmp_0;
1875
+ }
1876
+ }
1877
+ return Unit_instance;
1878
+ };
1879
+ }
1880
+ function call$slambda($block, $entry, resultContinuation) {
1881
+ this.mc2_1 = $block;
1882
+ this.nc2_1 = $entry;
1883
+ CoroutineImpl.call(this, resultContinuation);
1884
+ }
1885
+ protoOf(call$slambda).pc2 = function ($this$promise, $completion) {
1886
+ var tmp = this.l1n($this$promise, $completion);
1887
+ tmp.i9_1 = Unit_instance;
1888
+ tmp.j9_1 = null;
1889
+ return tmp.o9();
1890
+ };
1891
+ protoOf(call$slambda).ba = function (p1, $completion) {
1892
+ return this.pc2((!(p1 == null) ? isInterface(p1, CoroutineScope_0) : false) ? p1 : THROW_CCE(), $completion);
1893
+ };
1894
+ protoOf(call$slambda).o9 = function () {
1895
+ var suspendResult = this.i9_1;
1896
+ $sm: do
1897
+ try {
1898
+ var tmp = this.g9_1;
1899
+ switch (tmp) {
1900
+ case 0:
1901
+ this.h9_1 = 2;
1902
+ this.g9_1 = 1;
1903
+ suspendResult = this.mc2_1(this.nc2_1, this);
1904
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1905
+ return suspendResult;
1906
+ }
1907
+
1908
+ continue $sm;
1909
+ case 1:
1910
+ return suspendResult;
1911
+ case 2:
1912
+ throw this.j9_1;
1913
+ }
1914
+ } catch ($p) {
1915
+ var e = $p;
1916
+ if (this.h9_1 === 2) {
1917
+ throw e;
1918
+ } else {
1919
+ this.g9_1 = this.h9_1;
1920
+ this.j9_1 = e;
1921
+ }
1922
+ }
1923
+ while (true);
1924
+ };
1925
+ protoOf(call$slambda).l1n = function ($this$promise, completion) {
1926
+ var i = new call$slambda(this.mc2_1, this.nc2_1, completion);
1927
+ i.oc2_1 = $this$promise;
1928
+ return i;
1929
+ };
1930
+ function call$slambda_0($block, $entry, resultContinuation) {
1931
+ var i = new call$slambda($block, $entry, resultContinuation);
1932
+ return constructCallableReference(function ($this$promise, $completion) {
1933
+ return i.pc2($this$promise, $completion);
1934
+ }, 1);
1935
+ }
1936
+ var properties_initialized_HeadlessApi_kt_422n3l;
1937
+ function _init_properties_HeadlessApi_kt__cjiogh() {
1938
+ if (!properties_initialized_HeadlessApi_kt_422n3l) {
1939
+ properties_initialized_HeadlessApi_kt_422n3l = true;
1940
+ trackers = new WeakMap();
1941
+ }
1942
+ }
1943
+ function get_REASONS() {
1944
+ _init_properties_HeadlessConstants_kt__7kny8s();
1945
+ return REASONS;
1946
+ }
1947
+ var REASONS;
1948
+ function get_FAILED_CANCEL_KINDS() {
1949
+ _init_properties_HeadlessConstants_kt__7kny8s();
1950
+ return FAILED_CANCEL_KINDS;
1951
+ }
1952
+ var FAILED_CANCEL_KINDS;
1953
+ function get_DIRECTIVE_ACTIONS() {
1954
+ _init_properties_HeadlessConstants_kt__7kny8s();
1955
+ return DIRECTIVE_ACTIONS;
1956
+ }
1957
+ var DIRECTIVE_ACTIONS;
1958
+ function reasons() {
1959
+ _init_properties_HeadlessConstants_kt__7kny8s();
1960
+ return get_REASONS();
1961
+ }
1962
+ function failedCancelKinds() {
1963
+ _init_properties_HeadlessConstants_kt__7kny8s();
1964
+ return get_FAILED_CANCEL_KINDS();
1965
+ }
1966
+ function directiveActions() {
1967
+ _init_properties_HeadlessConstants_kt__7kny8s();
1968
+ return get_DIRECTIVE_ACTIONS();
1969
+ }
1970
+ function steamNotLinkedCode() {
1971
+ _init_properties_HeadlessConstants_kt__7kny8s();
1972
+ return 'P2P_STEAM_NOT_LINKED';
1973
+ }
1974
+ function minWriteTokenLifetimeMs() {
1975
+ _init_properties_HeadlessConstants_kt__7kny8s();
1976
+ return toNumber(_Duration___get_inWholeMilliseconds__impl__msfiry(Companion_getInstance_1().ob3_1));
1977
+ }
1978
+ function maxClockSkewMs() {
1979
+ _init_properties_HeadlessConstants_kt__7kny8s();
1980
+ return toNumber(_Duration___get_inWholeMilliseconds__impl__msfiry(Companion_getInstance_1().rb3_1));
1981
+ }
1982
+ function defaultNotaryUrl() {
1983
+ _init_properties_HeadlessConstants_kt__7kny8s();
1984
+ return 'wss://api.dmarket.com/provenance/v1/';
1985
+ }
1986
+ function defaultBaseUrl() {
1987
+ _init_properties_HeadlessConstants_kt__7kny8s();
1988
+ return 'https://api.dmarket.com';
1989
+ }
1990
+ function frozen(entries) {
1991
+ _init_properties_HeadlessConstants_kt__7kny8s();
1992
+ var o = plainObject();
1993
+ // Inline function 'kotlin.collections.forEach' call
1994
+ var inductionVariable = 0;
1995
+ var last = entries.length;
1996
+ while (inductionVariable < last) {
1997
+ var element = entries[inductionVariable];
1998
+ inductionVariable = inductionVariable + 1 | 0;
1999
+ var key = element.eh();
2000
+ var value = element.fh();
2001
+ o[key] = value;
2002
+ }
2003
+ return Object.freeze(o);
2004
+ }
2005
+ function camelCase(_this__u8e3s4) {
2006
+ _init_properties_HeadlessConstants_kt__7kny8s();
2007
+ // Inline function 'kotlin.text.lowercase' call
2008
+ // Inline function 'kotlin.js.asDynamic' call
2009
+ var tmp$ret$0 = _this__u8e3s4.toLowerCase();
2010
+ // Inline function 'kotlin.collections.mapIndexed' call
2011
+ var this_0 = split(tmp$ret$0, charArrayOf([_Char___init__impl__6a9atx(95)]));
2012
+ // Inline function 'kotlin.collections.mapIndexedTo' call
2013
+ var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
2014
+ var index = 0;
2015
+ var _iterator__ex2g4s = this_0.t();
2016
+ while (_iterator__ex2g4s.u()) {
2017
+ var item = _iterator__ex2g4s.v();
2018
+ var _unary__edvuaz = index;
2019
+ index = _unary__edvuaz + 1 | 0;
2020
+ var tmp;
2021
+ if (checkIndexOverflow(_unary__edvuaz) === 0) {
2022
+ tmp = item;
2023
+ } else {
2024
+ // Inline function 'kotlin.text.replaceFirstChar' call
2025
+ var tmp_0;
2026
+ // Inline function 'kotlin.text.isNotEmpty' call
2027
+ if (charSequenceLength(item) > 0) {
2028
+ // Inline function 'kotlin.text.uppercase' call
2029
+ var this_1 = charCodeAt(item, 0);
2030
+ // Inline function 'kotlin.js.asDynamic' call
2031
+ // Inline function 'kotlin.js.unsafeCast' call
2032
+ var tmp$ret$7 = toString_1(this_1).toUpperCase();
2033
+ tmp_0 = toString_0(tmp$ret$7) + substring(item, 1);
2034
+ } else {
2035
+ tmp_0 = item;
2036
+ }
2037
+ tmp = tmp_0;
2038
+ }
2039
+ var tmp$ret$4 = tmp;
2040
+ destination.e1(tmp$ret$4);
2041
+ }
2042
+ return joinToString(destination, '');
2043
+ }
2044
+ var properties_initialized_HeadlessConstants_kt_kpx2y;
2045
+ function _init_properties_HeadlessConstants_kt__7kny8s() {
2046
+ if (!properties_initialized_HeadlessConstants_kt_kpx2y) {
2047
+ properties_initialized_HeadlessConstants_kt_kpx2y = true;
2048
+ REASONS = frozen([to('offerWritesDisabled', 'refused: offer writes are disabled on this client'), to('steamSessionMissing', 'not run: no usable Steam session on this client'), to('tokenExpiringDefer', 'the Steam token expires before a create could be confirmed'), to('proofTokenExpiring', 'the Steam token is too close to its expiry to start a proof'), to('noProver', ProofSkipReason_NO_PROVER_getInstance().r5t_1)]);
2049
+ // Inline function 'kotlin.collections.map' call
2050
+ var this_0 = get_entries();
2051
+ // Inline function 'kotlin.collections.mapTo' call
2052
+ var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
2053
+ var _iterator__ex2g4s = this_0.t();
2054
+ while (_iterator__ex2g4s.u()) {
2055
+ var item = _iterator__ex2g4s.v();
2056
+ var tmp$ret$2 = to(camelCase(item.z_1), item.r5s_1);
2057
+ destination.e1(tmp$ret$2);
2058
+ }
2059
+ // Inline function 'kotlin.collections.toTypedArray' call
2060
+ var tmp$ret$3 = copyToArray(destination);
2061
+ FAILED_CANCEL_KINDS = frozen(tmp$ret$3.slice());
2062
+ // Inline function 'kotlin.collections.map' call
2063
+ var this_1 = get_entries_0();
2064
+ // Inline function 'kotlin.collections.mapTo' call
2065
+ var destination_0 = ArrayList_init_$Create$(collectionSizeOrDefault(this_1, 10));
2066
+ var _iterator__ex2g4s_0 = this_1.t();
2067
+ while (_iterator__ex2g4s_0.u()) {
2068
+ var item_0 = _iterator__ex2g4s_0.v();
2069
+ var tmp$ret$2_0 = to(camelCase(item_0.z_1), item_0.q5r_1);
2070
+ destination_0.e1(tmp$ret$2_0);
2071
+ }
2072
+ // Inline function 'kotlin.collections.toTypedArray' call
2073
+ var tmp$ret$3_0 = copyToArray(destination_0);
2074
+ DIRECTIVE_ACTIONS = frozen(tmp$ret$3_0.slice());
2075
+ }
2076
+ }
2077
+ function safeName($this, key) {
2078
+ return $this.qbz_1.od(key) ? key : '(a key that is not an option name)';
2079
+ }
2080
+ function Companion_8() {
2081
+ Companion_instance_11 = this;
2082
+ this.pbz_1 = setOf(['dataDir', 'baseUrl', 'steamWrites', 'notaryUrl', 'onEvent', 'nowMs', 'prover', 'onProofOutcome', 'onProverLine']);
2083
+ this.qbz_1 = Regex_init_$Create$('^[A-Za-z][A-Za-z0-9]{0,39}$');
2084
+ }
2085
+ protoOf(Companion_8).rbz = function (options) {
2086
+ // Inline function 'kotlin.require' call
2087
+ if (!(typeof options === 'object' && options != null)) {
2088
+ var message = 'options must be an object';
2089
+ throw IllegalArgumentException_init_$Create$(toString_0(message));
2090
+ }
2091
+ this.qc2(options, this.pbz_1, '');
2092
+ var dataDir = options.dataDir;
2093
+ var tmp;
2094
+ if (typeof dataDir === 'string') {
2095
+ // Inline function 'kotlin.text.isNotBlank' call
2096
+ var this_0 = (!(dataDir == null) ? typeof dataDir === 'string' : false) ? dataDir : THROW_CCE();
2097
+ tmp = !isBlank(this_0);
2098
+ } else {
2099
+ tmp = false;
2100
+ }
2101
+ // Inline function 'kotlin.require' call
2102
+ if (!tmp) {
2103
+ var message_0 = 'dataDir must be a non-empty string';
2104
+ throw IllegalArgumentException_init_$Create$(toString_0(message_0));
2105
+ }
2106
+ var tmp0_elvis_lhs = this.rc2(options.baseUrl, 'baseUrl', 'string');
2107
+ var baseUrl = tmp0_elvis_lhs == null ? 'https://api.dmarket.com' : tmp0_elvis_lhs;
2108
+ // Inline function 'kotlin.require' call
2109
+ if (!(startsWith(baseUrl, 'https://') || startsWith(baseUrl, 'http://'))) {
2110
+ var message_1 = 'baseUrl must be an http:// or https:// URL';
2111
+ throw IllegalArgumentException_init_$Create$(toString_0(message_1));
2112
+ }
2113
+ var tmp1_elvis_lhs = this.rc2(options.notaryUrl, 'notaryUrl', 'string');
2114
+ var notaryUrl = tmp1_elvis_lhs == null ? 'wss://api.dmarket.com/provenance/v1/' : tmp1_elvis_lhs;
2115
+ // Inline function 'kotlin.require' call
2116
+ if (!(startsWith(notaryUrl, 'wss://') || startsWith(notaryUrl, 'ws://'))) {
2117
+ var message_2 = 'notaryUrl must be a ws:// or wss:// URL';
2118
+ throw IllegalArgumentException_init_$Create$(toString_0(message_2));
2119
+ }
2120
+ var tmp2_elvis_lhs = this.rc2(options.steamWrites, 'steamWrites', 'boolean');
2121
+ var steamWrites = tmp2_elvis_lhs == null ? true : tmp2_elvis_lhs;
2122
+ var onEvent = this.rc2(options.onEvent, 'onEvent', 'function');
2123
+ var nowMs = this.rc2(options.nowMs, 'nowMs', 'function');
2124
+ var proverOption = this.rc2(options.prover, 'prover', 'object');
2125
+ var prover = proverOption != null ? Companion_getInstance_13().rbz(proverOption) : null;
2126
+ var onProofOutcome = this.rc2(options.onProofOutcome, 'onProofOutcome', 'function');
2127
+ var onProverLine = this.rc2(options.onProverLine, 'onProverLine', 'function');
2128
+ var tmp4_elvis_lhs = prover == null ? null : prover.hc0_1;
2129
+ return new HeadlessOptions(dataDir, baseUrl, steamWrites, tmp4_elvis_lhs == null ? notaryUrl : tmp4_elvis_lhs, onEvent, nowMs, prover, onProofOutcome, onProverLine);
2130
+ };
2131
+ protoOf(Companion_8).qc2 = function (o, known, prefix) {
2132
+ // Inline function 'kotlin.js.unsafeCast' call
2133
+ var keys = Object.keys(o);
2134
+ var tmp$ret$1;
2135
+ $l$block: {
2136
+ // Inline function 'kotlin.collections.firstOrNull' call
2137
+ var inductionVariable = 0;
2138
+ var last = keys.length;
2139
+ while (inductionVariable < last) {
2140
+ var element = keys[inductionVariable];
2141
+ inductionVariable = inductionVariable + 1 | 0;
2142
+ if (!known.k1(element)) {
2143
+ tmp$ret$1 = element;
2144
+ break $l$block;
2145
+ }
2146
+ }
2147
+ tmp$ret$1 = null;
2148
+ }
2149
+ var tmp0_safe_receiver = tmp$ret$1;
2150
+ if (tmp0_safe_receiver == null)
2151
+ null;
2152
+ else {
2153
+ // Inline function 'kotlin.let' call
2154
+ throw IllegalArgumentException_init_$Create$('unknown option: ' + prefix + safeName(Companion_getInstance_11(), tmp0_safe_receiver));
2155
+ }
2156
+ };
2157
+ protoOf(Companion_8).rc2 = function (value, name, type) {
2158
+ if (value == null)
2159
+ return null;
2160
+ // Inline function 'kotlin.require' call
2161
+ if (!(typeof value === type)) {
2162
+ var message = name + ' must be ' + (type === 'object' ? 'an' : 'a') + ' ' + type;
2163
+ throw IllegalArgumentException_init_$Create$(toString_0(message));
2164
+ }
2165
+ // Inline function 'kotlin.js.unsafeCast' call
2166
+ return value;
2167
+ };
2168
+ var Companion_instance_11;
2169
+ function Companion_getInstance_11() {
2170
+ if (Companion_instance_11 == null)
2171
+ new Companion_8();
2172
+ return Companion_instance_11;
2173
+ }
2174
+ function HeadlessOptions$clock$1($now) {
2175
+ this.uc2_1 = $now;
2176
+ }
2177
+ protoOf(HeadlessOptions$clock$1).fo = function () {
2178
+ return Companion_getInstance_0().bf(numberToLong(this.uc2_1()));
2179
+ };
2180
+ function HeadlessOptions$eventObserver$1($callback) {
2181
+ this.vc2_1 = $callback;
2182
+ }
2183
+ protoOf(HeadlessOptions$eventObserver$1).w6a = function (event, $completion) {
2184
+ return this.vc2_1(toWireJson(event));
2185
+ };
2186
+ function HeadlessOptions(dataDir, baseUrl, steamWrites, notaryUrl, onEvent, nowMs, prover, onProofOutcome, onProverLine) {
2187
+ Companion_getInstance_11();
2188
+ this.xbz_1 = dataDir;
2189
+ this.ybz_1 = baseUrl;
2190
+ this.zbz_1 = steamWrites;
2191
+ this.ac0_1 = notaryUrl;
2192
+ this.bc0_1 = onEvent;
2193
+ this.cc0_1 = nowMs;
2194
+ this.dc0_1 = prover;
2195
+ this.ec0_1 = onProofOutcome;
2196
+ this.fc0_1 = onProverLine;
2197
+ }
2198
+ protoOf(HeadlessOptions).gc0 = function () {
2199
+ var tmp0_safe_receiver = this.cc0_1;
2200
+ var tmp;
2201
+ if (tmp0_safe_receiver == null) {
2202
+ tmp = null;
2203
+ } else {
2204
+ // Inline function 'kotlin.let' call
2205
+ tmp = new HeadlessOptions$clock$1(tmp0_safe_receiver);
2206
+ }
2207
+ return tmp;
2208
+ };
2209
+ protoOf(HeadlessOptions).rc0 = function () {
2210
+ var tmp0_safe_receiver = this.bc0_1;
2211
+ var tmp;
2212
+ if (tmp0_safe_receiver == null) {
2213
+ tmp = null;
2214
+ } else {
2215
+ // Inline function 'kotlin.let' call
2216
+ tmp = new HeadlessOptions$eventObserver$1(tmp0_safe_receiver);
2217
+ }
2218
+ return tmp;
2219
+ };
2220
+ function plainObject() {
2221
+ return {};
2222
+ }
2223
+ function epochMs(_this__u8e3s4) {
2224
+ var tmp1_safe_receiver = _this__u8e3s4 == null ? null : _this__u8e3s4.xo();
2225
+ return tmp1_safe_receiver == null ? null : toNumber(tmp1_safe_receiver);
2226
+ }
2227
+ function toJs(_this__u8e3s4) {
2228
+ var o = plainObject();
2229
+ if (_this__u8e3s4 instanceof Held) {
2230
+ o.type = 'held';
2231
+ o.publicKey = _this__u8e3s4.n7v_1;
2232
+ o.change = _this__u8e3s4.o7v_1.z_1;
2233
+ } else {
2234
+ if (_this__u8e3s4 instanceof Invalid) {
2235
+ o.type = 'invalid';
2236
+ o.reason = _this__u8e3s4.p7v_1;
2237
+ } else {
2238
+ if (_this__u8e3s4 instanceof AccountChanged) {
2239
+ o.type = 'accountChanged';
2240
+ o.publicKey = _this__u8e3s4.q7v_1;
2241
+ o.heldPublicKey = _this__u8e3s4.r7v_1;
2242
+ o.linkedSteamId = _SteamId___get_value__impl__qjh21u(_this__u8e3s4.s7v_1);
2243
+ var tmp1_safe_receiver = _this__u8e3s4.t7v_1;
2244
+ var tmp;
2245
+ var tmp_0 = tmp1_safe_receiver;
2246
+ if ((tmp_0 == null ? null : new SteamId(tmp_0)) == null) {
2247
+ tmp = null;
2248
+ } else {
2249
+ tmp = _SteamId___get_value__impl__qjh21u(tmp1_safe_receiver);
2250
+ }
2251
+ o.keyLinkedSteamId = tmp;
2252
+ } else {
2253
+ if (_this__u8e3s4 instanceof Unverified) {
2254
+ o.type = 'unverified';
2255
+ o.publicKey = _this__u8e3s4.u7v_1;
2256
+ o.reason = _this__u8e3s4.v7v_1;
2257
+ } else {
2258
+ noWhenBranchMatchedException();
2259
+ }
2260
+ }
2261
+ }
2262
+ }
2263
+ return o;
2264
+ }
2265
+ function toJs_0(_this__u8e3s4) {
2266
+ var o = plainObject();
2267
+ if (_this__u8e3s4 instanceof Held_0) {
2268
+ o.type = 'held';
2269
+ o.steamId = _SteamId___get_value__impl__qjh21u(_this__u8e3s4.d81_1);
2270
+ o.expiresAtMs = epochMs(_this__u8e3s4.e81_1);
2271
+ } else {
2272
+ if (_this__u8e3s4 instanceof WrongAccount) {
2273
+ o.type = 'wrongAccount';
2274
+ o.tokenSteamId = _SteamId___get_value__impl__qjh21u(_this__u8e3s4.f81_1);
2275
+ var tmp1_safe_receiver = _this__u8e3s4.g81_1;
2276
+ var tmp;
2277
+ var tmp_0 = tmp1_safe_receiver;
2278
+ if ((tmp_0 == null ? null : new SteamId(tmp_0)) == null) {
2279
+ tmp = null;
2280
+ } else {
2281
+ tmp = _SteamId___get_value__impl__qjh21u(tmp1_safe_receiver);
2282
+ }
2283
+ o.linkedSteamId = tmp;
2284
+ } else {
2285
+ if (_this__u8e3s4 instanceof Invalid_0) {
2286
+ o.type = 'invalid';
2287
+ o.reason = _this__u8e3s4.h81_1;
2288
+ } else {
2289
+ noWhenBranchMatchedException();
2290
+ }
2291
+ }
2292
+ }
2293
+ return o;
2294
+ }
2295
+ function toJs_1(_this__u8e3s4) {
2296
+ var o = plainObject();
2297
+ o.hasTradingApiKey = _this__u8e3s4.wb7_1;
2298
+ var tmp0_safe_receiver = _this__u8e3s4.xb7_1;
2299
+ var tmp;
2300
+ var tmp_0 = tmp0_safe_receiver;
2301
+ if ((tmp_0 == null ? null : new SteamId(tmp_0)) == null) {
2302
+ tmp = null;
2303
+ } else {
2304
+ tmp = _SteamId___get_value__impl__qjh21u(tmp0_safe_receiver);
2305
+ }
2306
+ o.steamTokenSteamId = tmp;
2307
+ o.steamTokenExpiresAtMs = epochMs(_this__u8e3s4.yb7_1);
2308
+ var tmp1_safe_receiver = _this__u8e3s4.zb7_1;
2309
+ var tmp_1;
2310
+ var tmp_2 = tmp1_safe_receiver;
2311
+ if ((tmp_2 == null ? null : new SteamId(tmp_2)) == null) {
2312
+ tmp_1 = null;
2313
+ } else {
2314
+ tmp_1 = _SteamId___get_value__impl__qjh21u(tmp1_safe_receiver);
2315
+ }
2316
+ o.linkedSteamId = tmp_1;
2317
+ o.readySinceMs = epochMs(_this__u8e3s4.ab8_1);
2318
+ // Inline function 'kotlin.collections.map' call
2319
+ var this_0 = _this__u8e3s4.bb8_1;
2320
+ // Inline function 'kotlin.collections.mapTo' call
2321
+ var destination = ArrayList_init_$Create$(collectionSizeOrDefault(this_0, 10));
2322
+ var _iterator__ex2g4s = this_0.t();
2323
+ while (_iterator__ex2g4s.u()) {
2324
+ var item = _iterator__ex2g4s.v();
2325
+ var it = item.r5r_1;
2326
+ var tmp$ret$2 = _DealId___get_value__impl__ww6eoe(it);
2327
+ destination.e1(tmp$ret$2);
2328
+ }
2329
+ // Inline function 'kotlin.collections.toTypedArray' call
2330
+ o.trackedDealIds = copyToArray(destination);
2331
+ var tmp2_safe_receiver = _this__u8e3s4.cb8_1;
2332
+ var tmp_3;
2333
+ var tmp_4 = tmp2_safe_receiver;
2334
+ if ((tmp_4 == null ? null : new Duration(tmp_4)) == null) {
2335
+ tmp_3 = null;
2336
+ } else {
2337
+ tmp_3 = _Duration___get_inWholeMilliseconds__impl__msfiry(tmp2_safe_receiver);
2338
+ }
2339
+ var tmp3_safe_receiver = tmp_3;
2340
+ o.clockOffsetMs = tmp3_safe_receiver == null ? null : toNumber(tmp3_safe_receiver);
2341
+ o.clockSkewed = _this__u8e3s4.hb8();
2342
+ o.steamNotLinked = _this__u8e3s4.db8_1;
2343
+ o.updateRequired = _this__u8e3s4.eb8_1;
2344
+ o.updateDueTimeMs = epochMs(_this__u8e3s4.fb8_1);
2345
+ var deadlines = plainObject();
2346
+ // Inline function 'kotlin.collections.forEach' call
2347
+ // Inline function 'kotlin.collections.iterator' call
2348
+ var _iterator__ex2g4s_0 = _this__u8e3s4.gb8_1.n1().t();
2349
+ while (_iterator__ex2g4s_0.u()) {
2350
+ var element = _iterator__ex2g4s_0.v();
2351
+ // Inline function 'kotlin.collections.component1' call
2352
+ var deal = element.o1().r5r_1;
2353
+ // Inline function 'kotlin.collections.component2' call
2354
+ var deadline = element.p1();
2355
+ deadlines[_DealId___get_value__impl__ww6eoe(deal)] = toNumber(deadline.xo());
2356
+ }
2357
+ o.dealDeadlines = deadlines;
2358
+ return o;
2359
+ }
2360
+ function installedRoot($this) {
2361
+ var tmp = get_nodeProcess().argv[1];
2362
+ var tmp0_safe_receiver = resolveInstalled('@dmarket/p2p-tracker-headless/package.json', (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : null);
2363
+ var tmp_0;
2364
+ if (tmp0_safe_receiver == null) {
2365
+ tmp_0 = null;
2366
+ } else {
2367
+ // Inline function 'kotlin.let' call
2368
+ var tmp_1 = com_dmarket_p2p_headless_node_nodePath_idbzon.dirname(tmp0_safe_receiver);
2369
+ tmp_0 = (!(tmp_1 == null) ? typeof tmp_1 === 'string' : false) ? tmp_1 : THROW_CCE();
2370
+ }
2371
+ return tmp_0;
2372
+ }
2373
+ function join_0($this, parts) {
2374
+ // Inline function 'kotlin.collections.reduce' call
2375
+ // Inline function 'kotlin.collections.isEmpty' call
2376
+ if (parts.length === 0)
2377
+ throw UnsupportedOperationException_init_$Create$("Empty array can't be reduced.");
2378
+ var accumulator = parts[0];
2379
+ var inductionVariable = 1;
2380
+ var last = get_lastIndex(parts);
2381
+ if (inductionVariable <= last)
2382
+ do {
2383
+ var index = inductionVariable;
2384
+ inductionVariable = inductionVariable + 1 | 0;
2385
+ var tmp0 = accumulator;
2386
+ var part = parts[index];
2387
+ var tmp = com_dmarket_p2p_headless_node_nodePath_idbzon.join(tmp0, part);
2388
+ accumulator = (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
2389
+ }
2390
+ while (!(index === last));
2391
+ return accumulator;
2392
+ }
2393
+ function Companion_9() {
2394
+ this.oc0_1 = '@dmarket/p2p-tracker-headless';
2395
+ this.pc0_1 = 'prover-child.mjs';
2396
+ }
2397
+ protoOf(Companion_9).qc0 = function (packageRoot, assetsDir) {
2398
+ var tmp1_elvis_lhs = packageRoot == null ? installedRoot(this) : packageRoot;
2399
+ var tmp;
2400
+ if (tmp1_elvis_lhs == null) {
2401
+ // Inline function 'kotlin.error' call
2402
+ var message = 'prover files not found: @dmarket/p2p-tracker-headless/package.json cannot be resolved';
2403
+ throw IllegalStateException_init_$Create$(toString_0(message));
2404
+ } else {
2405
+ tmp = tmp1_elvis_lhs;
2406
+ }
2407
+ var root = tmp;
2408
+ var tmp_0 = join_0(this, [root, 'prover-child.mjs']);
2409
+ var files = new ProverFiles(tmp_0, assetsDir == null ? root : assetsDir);
2410
+ var required = listOf([files.sc0_1, join_0(this, [files.tc0_1, 'pkg', 'client_wasm_bg.wasm']), join_0(this, [files.tc0_1, 'transport', 'dist', 'node.js'])]);
2411
+ var tmp$ret$1;
2412
+ $l$block: {
2413
+ // Inline function 'kotlin.collections.firstOrNull' call
2414
+ var _iterator__ex2g4s = required.t();
2415
+ while (_iterator__ex2g4s.u()) {
2416
+ var element = _iterator__ex2g4s.v();
2417
+ var tmp_1 = com_dmarket_p2p_headless_node_nodeFs_vfkcsf.existsSync(element);
2418
+ if (!((!(tmp_1 == null) ? typeof tmp_1 === 'boolean' : false) ? tmp_1 : THROW_CCE())) {
2419
+ tmp$ret$1 = element;
2420
+ break $l$block;
2421
+ }
2422
+ }
2423
+ tmp$ret$1 = null;
2424
+ }
2425
+ var tmp3_safe_receiver = tmp$ret$1;
2426
+ if (tmp3_safe_receiver == null)
2427
+ null;
2428
+ else {
2429
+ // Inline function 'kotlin.let' call
2430
+ // Inline function 'kotlin.error' call
2431
+ var message_0 = 'prover files not found: ' + tmp3_safe_receiver + ' is missing';
2432
+ throw IllegalStateException_init_$Create$(toString_0(message_0));
2433
+ }
2434
+ return files;
2435
+ };
2436
+ var Companion_instance_12;
2437
+ function Companion_getInstance_12() {
2438
+ return Companion_instance_12;
2439
+ }
2440
+ function ProverFiles(script, assetsDir) {
2441
+ this.sc0_1 = script;
2442
+ this.tc0_1 = assetsDir;
2443
+ }
2444
+ function whole($this, value, name, range) {
2445
+ var tmp0_elvis_lhs = Companion_getInstance_11().rc2(value, name, 'number');
2446
+ var tmp;
2447
+ if (tmp0_elvis_lhs == null) {
2448
+ return null;
2449
+ } else {
2450
+ tmp = tmp0_elvis_lhs;
2451
+ }
2452
+ var number = tmp;
2453
+ var tmp_0;
2454
+ var tmp_1 = Number.isInteger(number);
2455
+ if ((!(tmp_1 == null) ? typeof tmp_1 === 'boolean' : false) ? tmp_1 : THROW_CCE()) {
2456
+ var containsLower = range.s1_1;
2457
+ var containsUpper = range.t1_1;
2458
+ var containsArg = numberToInt(number);
2459
+ tmp_0 = containsLower <= containsArg ? containsArg <= containsUpper : false;
2460
+ } else {
2461
+ tmp_0 = false;
2462
+ }
2463
+ // Inline function 'kotlin.require' call
2464
+ if (!tmp_0) {
2465
+ var message = name + ' must be a whole number in ' + range.s1_1 + '..' + range.t1_1;
2466
+ throw IllegalArgumentException_init_$Create$(toString_0(message));
2467
+ }
2468
+ return numberToInt(number);
2469
+ }
2470
+ function milliseconds($this, value, name) {
2471
+ var tmp0_elvis_lhs = Companion_getInstance_11().rc2(value, name, 'number');
2472
+ var tmp;
2473
+ if (tmp0_elvis_lhs == null) {
2474
+ return null;
2475
+ } else {
2476
+ tmp = tmp0_elvis_lhs;
2477
+ }
2478
+ var number = tmp;
2479
+ var tmp_0;
2480
+ var tmp_1 = Number.isSafeInteger(number);
2481
+ if ((!(tmp_1 == null) ? typeof tmp_1 === 'boolean' : false) ? tmp_1 : THROW_CCE()) {
2482
+ tmp_0 = number > 0;
2483
+ } else {
2484
+ tmp_0 = false;
2485
+ }
2486
+ // Inline function 'kotlin.require' call
2487
+ if (!tmp_0) {
2488
+ var message = name + ' must be a positive whole number';
2489
+ throw IllegalArgumentException_init_$Create$(toString_0(message));
2490
+ }
2491
+ Companion_getInstance();
2492
+ // Inline function 'kotlin.time.Companion.milliseconds' call
2493
+ var this_0 = numberToLong(number);
2494
+ return toDuration_0(this_0, DurationUnit_MILLISECONDS_getInstance());
2495
+ }
2496
+ function Companion_10() {
2497
+ Companion_instance_13 = this;
2498
+ this.sc2_1 = setOf(['notaryUrl', 'maxConcurrency', 'proofsPerChild', 'threadCount', 'assetsDir', 'connectDeadlineMs', 'sessionDeadlineMs']);
2499
+ this.tc2_1 = new ProverLimits();
2500
+ }
2501
+ protoOf(Companion_10).rbz = function (prover) {
2502
+ var tmp = Array.isArray(prover);
2503
+ // Inline function 'kotlin.require' call
2504
+ if (!!((!(tmp == null) ? typeof tmp === 'boolean' : false) ? tmp : THROW_CCE())) {
2505
+ var message = 'prover must be an object';
2506
+ throw IllegalArgumentException_init_$Create$(toString_0(message));
2507
+ }
2508
+ Companion_getInstance_11().qc2(prover, this.sc2_1, 'prover.');
2509
+ var notaryUrl = Companion_getInstance_11().rc2(prover.notaryUrl, 'prover.notaryUrl', 'string');
2510
+ // Inline function 'kotlin.require' call
2511
+ if (!(notaryUrl == null || startsWith(notaryUrl, 'wss://') || startsWith(notaryUrl, 'ws://'))) {
2512
+ var message_0 = 'prover.notaryUrl must be a ws:// or wss:// URL';
2513
+ throw IllegalArgumentException_init_$Create$(toString_0(message_0));
2514
+ }
2515
+ var assetsDir = Companion_getInstance_11().rc2(prover.assetsDir, 'prover.assetsDir', 'string');
2516
+ var tmp_0;
2517
+ if (assetsDir == null) {
2518
+ tmp_0 = true;
2519
+ } else {
2520
+ // Inline function 'kotlin.text.isNotBlank' call
2521
+ tmp_0 = !isBlank(assetsDir);
2522
+ }
2523
+ // Inline function 'kotlin.require' call
2524
+ if (!tmp_0) {
2525
+ var message_1 = 'prover.assetsDir must be a non-empty string';
2526
+ throw IllegalArgumentException_init_$Create$(toString_0(message_1));
2527
+ }
2528
+ var tmp0_elvis_lhs = whole(this, prover.maxConcurrency, 'prover.maxConcurrency', numberRangeToNumber(1, 2));
2529
+ var tmp_1 = tmp0_elvis_lhs == null ? 1 : tmp0_elvis_lhs;
2530
+ var tmp1_elvis_lhs = whole(this, prover.proofsPerChild, 'prover.proofsPerChild', numberRangeToNumber(1, 5));
2531
+ var tmp_2 = tmp1_elvis_lhs == null ? 1 : tmp1_elvis_lhs;
2532
+ var tmp2_elvis_lhs = whole(this, prover.threadCount, 'prover.threadCount', numberRangeToNumber(1, 16));
2533
+ var tmp_3 = tmp2_elvis_lhs == null ? 4 : tmp2_elvis_lhs;
2534
+ var tmp3_elvis_lhs = milliseconds(this, prover.connectDeadlineMs, 'prover.connectDeadlineMs');
2535
+ var tmp_4;
2536
+ var tmp_5 = tmp3_elvis_lhs;
2537
+ if ((tmp_5 == null ? null : new Duration(tmp_5)) == null) {
2538
+ tmp_4 = this.tc2_1.wc2_1;
2539
+ } else {
2540
+ tmp_4 = tmp3_elvis_lhs;
2541
+ }
2542
+ var tmp_6 = tmp_4;
2543
+ var tmp4_elvis_lhs = milliseconds(this, prover.sessionDeadlineMs, 'prover.sessionDeadlineMs');
2544
+ var tmp_7;
2545
+ var tmp_8 = tmp4_elvis_lhs;
2546
+ if ((tmp_8 == null ? null : new Duration(tmp_8)) == null) {
2547
+ tmp_7 = this.tc2_1.xc2_1;
2548
+ } else {
2549
+ tmp_7 = tmp4_elvis_lhs;
2550
+ }
2551
+ return new ProverOptions(notaryUrl, tmp_1, tmp_2, tmp_3, assetsDir, tmp_6, tmp_7);
2552
+ };
2553
+ var Companion_instance_13;
2554
+ function Companion_getInstance_13() {
2555
+ if (Companion_instance_13 == null)
2556
+ new Companion_10();
2557
+ return Companion_instance_13;
2558
+ }
2559
+ function ProverOptions(notaryUrl, maxConcurrency, proofsPerChild, threadCount, assetsDir, connectDeadline, sessionDeadline) {
2560
+ Companion_getInstance_13();
2561
+ this.hc0_1 = notaryUrl;
2562
+ this.ic0_1 = maxConcurrency;
2563
+ this.jc0_1 = proofsPerChild;
2564
+ this.kc0_1 = threadCount;
2565
+ this.lc0_1 = assetsDir;
2566
+ this.mc0_1 = connectDeadline;
2567
+ this.nc0_1 = sessionDeadline;
2568
+ }
2569
+ function file($this, key) {
2570
+ // Inline function 'kotlin.require' call
2571
+ if (!!(key === 'steam_credential')) {
2572
+ var message = 'the Steam credential is never written to disk';
2573
+ throw IllegalArgumentException_init_$Create$(toString_0(message));
2574
+ }
2575
+ // Inline function 'kotlin.require' call
2576
+ if (!Companion_getInstance_14().ac3_1.od(key)) {
2577
+ var message_0 = 'storage key must be [A-Za-z0-9._-]+: ' + key;
2578
+ throw IllegalArgumentException_init_$Create$(toString_0(message_0));
2579
+ }
2580
+ return join($this.ec3_1, key);
2581
+ }
2582
+ function Companion_11() {
2583
+ Companion_instance_14 = this;
2584
+ this.ac3_1 = Regex_init_$Create$('^[A-Za-z0-9._-]+$');
2585
+ this.bc3_1 = 6;
2586
+ this.cc3_1 = 448;
2587
+ this.dc3_1 = 384;
2588
+ }
2589
+ var Companion_instance_14;
2590
+ function Companion_getInstance_14() {
2591
+ if (Companion_instance_14 == null)
2592
+ new Companion_11();
2593
+ return Companion_instance_14;
2594
+ }
2595
+ function $getCOROUTINE$(_this__u8e3s4, key, resultContinuation) {
2596
+ CoroutineImpl.call(this, resultContinuation);
2597
+ this.oc3_1 = _this__u8e3s4;
2598
+ this.pc3_1 = key;
2599
+ }
2600
+ protoOf($getCOROUTINE$).o9 = function () {
2601
+ var suspendResult = this.i9_1;
2602
+ $sm: do
2603
+ try {
2604
+ var tmp = this.g9_1;
2605
+ switch (tmp) {
2606
+ case 0:
2607
+ this.h9_1 = 3;
2608
+ this.h9_1 = 2;
2609
+ this.g9_1 = 1;
2610
+ suspendResult = await_0(readFile(file(this.oc3_1, this.pc3_1), 'utf8'), this);
2611
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
2612
+ return suspendResult;
2613
+ }
2614
+
2615
+ continue $sm;
2616
+ case 1:
2617
+ this.qc3_1 = suspendResult;
2618
+ this.h9_1 = 3;
2619
+ this.g9_1 = 4;
2620
+ continue $sm;
2621
+ case 2:
2622
+ this.h9_1 = 3;
2623
+ var tmp_0 = this.j9_1;
2624
+ if (tmp_0 instanceof Error) {
2625
+ var e = this.j9_1;
2626
+ var tmp_1 = this;
2627
+ var tmp_2;
2628
+ if (nodeErrorCode(e) === 'ENOENT') {
2629
+ tmp_2 = null;
2630
+ } else {
2631
+ throw e;
2632
+ }
2633
+ tmp_1.qc3_1 = tmp_2;
2634
+ this.g9_1 = 4;
2635
+ continue $sm;
2636
+ } else {
2637
+ throw this.j9_1;
2638
+ }
2639
+
2640
+ case 3:
2641
+ throw this.j9_1;
2642
+ case 4:
2643
+ this.h9_1 = 3;
2644
+ return this.qc3_1;
2645
+ }
2646
+ } catch ($p) {
2647
+ var e_0 = $p;
2648
+ if (this.h9_1 === 3) {
2649
+ throw e_0;
2650
+ } else {
2651
+ this.g9_1 = this.h9_1;
2652
+ this.j9_1 = e_0;
2653
+ }
2654
+ }
2655
+ while (true);
2656
+ };
2657
+ function $setCOROUTINE$(_this__u8e3s4, key, value, resultContinuation) {
2658
+ CoroutineImpl.call(this, resultContinuation);
2659
+ this.zc3_1 = _this__u8e3s4;
2660
+ this.ac4_1 = key;
2661
+ this.bc4_1 = value;
2662
+ }
2663
+ protoOf($setCOROUTINE$).o9 = function () {
2664
+ var suspendResult = this.i9_1;
2665
+ $sm: do
2666
+ try {
2667
+ var tmp = this.g9_1;
2668
+ switch (tmp) {
2669
+ case 0:
2670
+ this.h9_1 = 5;
2671
+ this.cc4_1 = file(this.zc3_1, this.ac4_1);
2672
+ if (!this.zc3_1.fc3_1) {
2673
+ this.g9_1 = 1;
2674
+ var this_0 = {};
2675
+ this_0.recursive = true;
2676
+ this_0.mode = 448;
2677
+ suspendResult = await_0(mkdir(this.zc3_1.ec3_1, this_0), this);
2678
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
2679
+ return suspendResult;
2680
+ }
2681
+ continue $sm;
2682
+ } else {
2683
+ this.g9_1 = 2;
2684
+ continue $sm;
2685
+ }
2686
+
2687
+ case 1:
2688
+ this.zc3_1.fc3_1 = true;
2689
+ this.g9_1 = 2;
2690
+ continue $sm;
2691
+ case 2:
2692
+ var tmp_0 = this;
2693
+ var tmp_1 = randomBytes(6).toString('hex');
2694
+ tmp_0.dc4_1 = this.cc4_1 + '.' + ((!(tmp_1 == null) ? typeof tmp_1 === 'string' : false) ? tmp_1 : THROW_CCE()) + '.tmp';
2695
+ this.g9_1 = 3;
2696
+ var this_1 = {};
2697
+ this_1.encoding = 'utf8';
2698
+ this_1.mode = 384;
2699
+ suspendResult = await_0(writeFile(this.dc4_1, this.bc4_1, this_1), this);
2700
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
2701
+ return suspendResult;
2702
+ }
2703
+
2704
+ continue $sm;
2705
+ case 3:
2706
+ this.g9_1 = 4;
2707
+ suspendResult = await_0(rename(this.dc4_1, this.cc4_1), this);
2708
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
2709
+ return suspendResult;
2710
+ }
2711
+
2712
+ continue $sm;
2713
+ case 4:
2714
+ return Unit_instance;
2715
+ case 5:
2716
+ throw this.j9_1;
2717
+ }
2718
+ } catch ($p) {
2719
+ var e = $p;
2720
+ if (this.h9_1 === 5) {
2721
+ throw e;
2722
+ } else {
2723
+ this.g9_1 = this.h9_1;
2724
+ this.j9_1 = e;
2725
+ }
2726
+ }
2727
+ while (true);
2728
+ };
2729
+ function $removeCOROUTINE$(_this__u8e3s4, key, resultContinuation) {
2730
+ CoroutineImpl.call(this, resultContinuation);
2731
+ this.mc4_1 = _this__u8e3s4;
2732
+ this.nc4_1 = key;
2733
+ }
2734
+ protoOf($removeCOROUTINE$).o9 = function () {
2735
+ var suspendResult = this.i9_1;
2736
+ $sm: do
2737
+ try {
2738
+ var tmp = this.g9_1;
2739
+ switch (tmp) {
2740
+ case 0:
2741
+ this.h9_1 = 3;
2742
+ this.h9_1 = 2;
2743
+ this.g9_1 = 1;
2744
+ suspendResult = await_0(unlink(file(this.mc4_1, this.nc4_1)), this);
2745
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
2746
+ return suspendResult;
2747
+ }
2748
+
2749
+ continue $sm;
2750
+ case 1:
2751
+ this.h9_1 = 3;
2752
+ this.g9_1 = 4;
2753
+ continue $sm;
2754
+ case 2:
2755
+ this.h9_1 = 3;
2756
+ var tmp_0 = this.j9_1;
2757
+ if (tmp_0 instanceof Error) {
2758
+ var e = this.j9_1;
2759
+ if (!(nodeErrorCode(e) === 'ENOENT'))
2760
+ throw e;
2761
+ this.g9_1 = 4;
2762
+ continue $sm;
2763
+ } else {
2764
+ throw this.j9_1;
2765
+ }
2766
+
2767
+ case 3:
2768
+ throw this.j9_1;
2769
+ case 4:
2770
+ this.h9_1 = 3;
2771
+ return Unit_instance;
2772
+ }
2773
+ } catch ($p) {
2774
+ var e_0 = $p;
2775
+ if (this.h9_1 === 3) {
2776
+ throw e_0;
2777
+ } else {
2778
+ this.g9_1 = this.h9_1;
2779
+ this.j9_1 = e_0;
2780
+ }
2781
+ }
2782
+ while (true);
2783
+ };
2784
+ function FileKeyValueStore(dir) {
2785
+ Companion_getInstance_14();
2786
+ this.ec3_1 = dir;
2787
+ this.fc3_1 = false;
2788
+ }
2789
+ protoOf(FileKeyValueStore).j6k = function (key, $completion) {
2790
+ var tmp = new $getCOROUTINE$(this, key, $completion);
2791
+ tmp.i9_1 = Unit_instance;
2792
+ tmp.j9_1 = null;
2793
+ return tmp.o9();
2794
+ };
2795
+ protoOf(FileKeyValueStore).k6k = function (key, value, $completion) {
2796
+ var tmp = new $setCOROUTINE$(this, key, value, $completion);
2797
+ tmp.i9_1 = Unit_instance;
2798
+ tmp.j9_1 = null;
2799
+ return tmp.o9();
2800
+ };
2801
+ protoOf(FileKeyValueStore).l6k = function (key, $completion) {
2802
+ var tmp = new $removeCOROUTINE$(this, key, $completion);
2803
+ tmp.i9_1 = Unit_instance;
2804
+ tmp.j9_1 = null;
2805
+ return tmp.o9();
2806
+ };
2807
+ function Companion_12() {
2808
+ Companion_instance_15 = this;
2809
+ this.oc4_1 = Regex_init_$Create$('^[0-9]{1,20}$');
2810
+ }
2811
+ var Companion_instance_15;
2812
+ function Companion_getInstance_15() {
2813
+ if (Companion_instance_15 == null)
2814
+ new Companion_12();
2815
+ return Companion_instance_15;
2816
+ }
2817
+ function AccountDirectories(dataDir) {
2818
+ Companion_getInstance_15();
2819
+ this.bc2_1 = dataDir;
2820
+ var tmp = this;
2821
+ // Inline function 'kotlin.collections.mutableMapOf' call
2822
+ tmp.cc2_1 = LinkedHashMap_init_$Create$();
2823
+ }
2824
+ protoOf(AccountDirectories).dc2 = function (steamId) {
2825
+ // Inline function 'kotlin.require' call
2826
+ if (!Companion_getInstance_15().oc4_1.od(steamId)) {
2827
+ var message = 'not a steamid64';
2828
+ throw IllegalArgumentException_init_$Create$(toString_0(message));
2829
+ }
2830
+ // Inline function 'kotlin.collections.getOrPut' call
2831
+ var this_0 = this.cc2_1;
2832
+ var value = this_0.w2(steamId);
2833
+ var tmp;
2834
+ if (value == null) {
2835
+ var answer = new FileKeyValueStore(join(this.bc2_1, steamId));
2836
+ this_0.f3(steamId, answer);
2837
+ tmp = answer;
2838
+ } else {
2839
+ tmp = value;
2840
+ }
2841
+ return tmp;
2842
+ };
2843
+ function nodeErrorCode(_this__u8e3s4) {
2844
+ var error = _this__u8e3s4;
2845
+ var tmp = error.code;
2846
+ return (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : null;
2847
+ }
2848
+ function get_nodeProcess() {
2849
+ return process;
2850
+ }
2851
+ function installBrowserWorker() {
2852
+ var global = globalThis;
2853
+ if (global.__dmarketBrowserWorker == true)
2854
+ return Unit_instance;
2855
+ if (global.self == undefined)
2856
+ global.self = global;
2857
+ if (global.addEventListener == undefined) {
2858
+ var scope = new EventTarget();
2859
+ global.addEventListener = scope.addEventListener.bind(scope);
2860
+ global.removeEventListener = scope.removeEventListener.bind(scope);
2861
+ global.dispatchEvent = scope.dispatchEvent.bind(scope);
2862
+ }
2863
+ // Inline function 'kotlin.text.trim' call
2864
+ var this_0 = "\n(function (require, boot, cls) {\n const threads = require('node:worker_threads');\n const { resolveObjectURL } = require('node:buffer');\n return class Worker extends EventTarget {\n constructor(url, options) {\n super();\n this.onmessage = null;\n this.onerror = null;\n this._pending = [];\n this._thread = null;\n const href = String(url instanceof URL ? url.href : url);\n const type = (options && options.type) || 'classic';\n const name = (options && options.name) || '';\n const start = (code) => {\n this._thread = new threads.Worker(boot, { eval: true, workerData: { href: href, type: type, name: name, code: code, boot: boot, cls: cls } });\n this._thread.on('message', (data) => {\n const event = new MessageEvent('message', { data: data });\n this.dispatchEvent(event);\n if (typeof this.onmessage === 'function') this.onmessage(event);\n });\n this._thread.on('error', (error) => {\n const event = new Event('error');\n event.error = error;\n event.message = error && error.message;\n this.dispatchEvent(event);\n if (typeof this.onerror === 'function') this.onerror(event);\n });\n for (const [data, transfer] of this._pending) this._thread.postMessage(data, transfer);\n this._pending = [];\n };\n if (href.startsWith('blob:')) {\n const blob = resolveObjectURL(href);\n if (!blob) throw new Error('worker script blob is gone: ' + href);\n blob.text().then(start, (error) => this.dispatchEvent(Object.assign(new Event('error'), { error: error })));\n } else {\n start(null);\n }\n }\n postMessage(data, transfer) {\n const list = Array.isArray(transfer) ? transfer : undefined;\n if (this._thread) this._thread.postMessage(data, list); else this._pending.push([data, list]);\n }\n terminate() {\n if (this._thread) this._thread.terminate();\n }\n };\n})\n";
2865
+ var workerClass = toString_0(trim(isCharSequence(this_0) ? this_0 : THROW_CCE()));
2866
+ var bootstrap = "\nconst { parentPort, workerData } = require('node:worker_threads');\nconst fs = require('node:fs');\nconst vm = require('node:vm');\nconst { fileURLToPath } = require('node:url');\nconst scope = new EventTarget();\nglobalThis.self = globalThis;\nglobalThis.name = workerData.name;\nglobalThis.addEventListener = scope.addEventListener.bind(scope);\nglobalThis.removeEventListener = scope.removeEventListener.bind(scope);\nglobalThis.dispatchEvent = scope.dispatchEvent.bind(scope);\nglobalThis.postMessage = (data, transfer) => parentPort.postMessage(data, Array.isArray(transfer) ? transfer : undefined);\nglobalThis.close = () => process.exit(0);\nglobalThis.WorkerGlobalScope = class WorkerGlobalScope { static [Symbol.hasInstance](value) { return value === globalThis; } };\nglobalThis.DedicatedWorkerGlobalScope = globalThis.WorkerGlobalScope;\nglobalThis.Worker = (new Function('return ' + workerData.cls.trim())())(require, workerData.boot, workerData.cls);\nconst nodeFetch = globalThis.fetch;\nlet sharedModule = null;\nglobalThis.fetch = async (input, init) => {\n const href = typeof input === 'string' ? input : (input instanceof URL ? input.href : input.url);\n if (href.endsWith('.wasm') && sharedModule) return sharedModule;\n if (href.startsWith('file:')) {\n const bytes = await fs.promises.readFile(fileURLToPath(href));\n const type = href.endsWith('.wasm') ? 'application/wasm' : 'application/octet-stream';\n return new Response(bytes, { headers: { 'content-type': type } });\n }\n return nodeFetch(input, init);\n};\nlet loaded = false;\nconst held = [];\nconst deliver = (data) => {\n const event = new MessageEvent('message', { data: data });\n scope.dispatchEvent(event);\n if (typeof globalThis.onmessage === 'function') globalThis.onmessage(event);\n};\nparentPort.on('message', (data) => {\n // web-spawn's start messages carry the compiled module the main thread instantiated: the init in this thread\n // instantiates that one rather than compiling the file again.\n const first = data && Array.isArray(data.data) ? data.data[0] : null;\n if (first instanceof WebAssembly.Module) sharedModule = first;\n if (loaded) deliver(data); else held.push(data);\n});\nconst load = async () => {\n const href = workerData.href;\n if (workerData.type === 'module') {\n await import(href);\n } else {\n let code = workerData.code;\n if (code === null) {\n code = href.startsWith('data:') ? decodeURIComponent(href.slice(href.indexOf(',') + 1)) : fs.readFileSync(fileURLToPath(href), 'utf8');\n }\n vm.runInThisContext(code, { filename: href.startsWith('file:') ? href : 'worker-script.js' });\n }\n};\nload().then(() => {\n loaded = true;\n for (const data of held.splice(0)) deliver(data);\n}, (error) => { throw error; });\n";
2867
+ var make = (new Function('return ' + workerClass))();
2868
+ global.Worker = make(mainThreadModule$ref(), bootstrap, workerClass);
2869
+ global.__dmarketBrowserWorker = true;
2870
+ }
2871
+ function mainThreadModule(name) {
2872
+ var tmp;
2873
+ switch (name) {
2874
+ case 'node:worker_threads':
2875
+ tmp = com_dmarket_p2p_headless_node_nodeWorkerThreads_wezs9;
2876
+ break;
2877
+ case 'node:buffer':
2878
+ tmp = com_dmarket_p2p_headless_node_nodeBuffer_qg2cok;
2879
+ break;
2880
+ default:
2881
+ // Inline function 'kotlin.error' call
2882
+
2883
+ var message = 'no module ' + name + " for the prover's worker";
2884
+ throw IllegalStateException_init_$Create$(toString_0(message));
2885
+ }
2886
+ return tmp;
2887
+ }
2888
+ function mainThreadModule$ref() {
2889
+ return constructCallableReference(function (p0) {
2890
+ return mainThreadModule(p0);
2891
+ }, 1, 0, 44, 'mainThreadModule');
2892
+ }
2893
+ function get_PROVER_ENV_ALLOWED() {
2894
+ _init_properties_ForkedProofHost_kt__xbrlvr();
2895
+ return PROVER_ENV_ALLOWED;
2896
+ }
2897
+ var PROVER_ENV_ALLOWED;
2898
+ function Companion_13() {
2899
+ this.pc4_1 = 5;
2900
+ }
2901
+ var Companion_instance_16;
2902
+ function Companion_getInstance_16() {
2903
+ return Companion_instance_16;
2904
+ }
2905
+ function ProverLimits(connectDeadline, sessionDeadline, proofsPerChild, exitGrace) {
2906
+ var tmp;
2907
+ if (connectDeadline === VOID) {
2908
+ // Inline function 'kotlin.time.Companion.seconds' call
2909
+ Companion_getInstance();
2910
+ tmp = toDuration(30, DurationUnit_SECONDS_getInstance());
2911
+ } else {
2912
+ tmp = connectDeadline;
2913
+ }
2914
+ connectDeadline = tmp;
2915
+ var tmp_0;
2916
+ if (sessionDeadline === VOID) {
2917
+ // Inline function 'kotlin.time.Companion.seconds' call
2918
+ Companion_getInstance();
2919
+ tmp_0 = toDuration(240, DurationUnit_SECONDS_getInstance());
2920
+ } else {
2921
+ tmp_0 = sessionDeadline;
2922
+ }
2923
+ sessionDeadline = tmp_0;
2924
+ proofsPerChild = proofsPerChild === VOID ? 1 : proofsPerChild;
2925
+ var tmp_1;
2926
+ if (exitGrace === VOID) {
2927
+ // Inline function 'kotlin.time.Companion.seconds' call
2928
+ Companion_getInstance();
2929
+ tmp_1 = toDuration(5, DurationUnit_SECONDS_getInstance());
2930
+ } else {
2931
+ tmp_1 = exitGrace;
2932
+ }
2933
+ exitGrace = tmp_1;
2934
+ this.wc2_1 = connectDeadline;
2935
+ this.xc2_1 = sessionDeadline;
2936
+ this.yc2_1 = proofsPerChild;
2937
+ this.zc2_1 = exitGrace;
2938
+ var containsArg = this.yc2_1;
2939
+ // Inline function 'kotlin.require' call
2940
+ if (!(1 <= containsArg ? containsArg <= 5 : false)) {
2941
+ var message = 'proofsPerChild must be 1..5, was ' + this.yc2_1;
2942
+ throw IllegalArgumentException_init_$Create$(toString_0(message));
2943
+ }
2944
+ }
2945
+ function run($this, child, id, proof, upgrade, $completion) {
2946
+ var tmp = new $runCOROUTINE$($this, child, id, proof, upgrade, $completion);
2947
+ tmp.i9_1 = Unit_instance;
2948
+ tmp.j9_1 = null;
2949
+ return tmp.o9();
2950
+ }
2951
+ function killed($this, cause, detail) {
2952
+ return new Failed(new ProverKilled(cause, detail));
2953
+ }
2954
+ function takeIdle($this) {
2955
+ while (true) {
2956
+ var tmp0_elvis_lhs = $this.sc5_1.ug();
2957
+ var tmp;
2958
+ if (tmp0_elvis_lhs == null) {
2959
+ return null;
2960
+ } else {
2961
+ tmp = tmp0_elvis_lhs;
2962
+ }
2963
+ var child = tmp;
2964
+ if (!child.cc6_1)
2965
+ return child;
2966
+ }
2967
+ }
2968
+ function release($this, child, outcome) {
2969
+ var tmp;
2970
+ if (outcome instanceof Failed) {
2971
+ var tmp_0 = outcome.vas_1;
2972
+ tmp = tmp_0 instanceof ProverKilled;
2973
+ } else {
2974
+ tmp = false;
2975
+ }
2976
+ var killed = tmp;
2977
+ if (killed || child.cc6_1 || child.bc6_1 >= $this.lc5_1.yc2_1) {
2978
+ $this.tc5_1.z2(child);
2979
+ child.ec6($this.lc5_1.zc2_1);
2980
+ } else {
2981
+ $this.sc5_1.sg(child);
2982
+ }
2983
+ }
2984
+ function fork($this) {
2985
+ var options = {};
2986
+ options.env = toJsObject($this.mc5_1);
2987
+ // Inline function 'kotlin.emptyArray' call
2988
+ options.execArgv = [];
2989
+ // Inline function 'kotlin.arrayOf' call
2990
+ // Inline function 'kotlin.js.unsafeCast' call
2991
+ // Inline function 'kotlin.js.asDynamic' call
2992
+ options.stdio = ['ignore', 'pipe', 'pipe', 'ipc'];
2993
+ options.serialization = 'json';
2994
+ // Inline function 'kotlin.collections.toTypedArray' call
2995
+ var this_0 = $this.ic5_1;
2996
+ var tmp$ret$4 = copyToArray(this_0);
2997
+ var process = com_dmarket_p2p_headless_node_nodeChildProcess_579ejd.fork($this.hc5_1, tmp$ret$4, options);
2998
+ $this.vc5_1 = $this.vc5_1 + 1 | 0;
2999
+ // Inline function 'kotlin.also' call
3000
+ var this_1 = new ForkedChild(process, $this.oc5_1, $this.pc5_1);
3001
+ // Inline function 'kotlin.collections.plusAssign' call
3002
+ $this.tc5_1.e1(this_1);
3003
+ return this_1;
3004
+ }
3005
+ function ForkedProofHost$_init_$lambda_p9fnmo(_unused_var__etf5q3, _unused_var__etf5q3_0, _unused_var__etf5q3_1) {
3006
+ return Unit_instance;
3007
+ }
3008
+ function ForkedProofHost$_init_$lambda_p9fnmo_0(_unused_var__etf5q3, _unused_var__etf5q3_0, _unused_var__etf5q3_1) {
3009
+ return Unit_instance;
3010
+ }
3011
+ function ForkedProofHost$_init_$lambda_p9fnmo_1(_unused_var__etf5q3, _unused_var__etf5q3_0) {
3012
+ return Unit_instance;
3013
+ }
3014
+ function ForkedProofHost$run$slambda($child, resultContinuation) {
3015
+ this.nc6_1 = $child;
3016
+ CoroutineImpl.call(this, resultContinuation);
3017
+ }
3018
+ protoOf(ForkedProofHost$run$slambda).pc6 = function ($this$withTimeoutOrNull, $completion) {
3019
+ var tmp = this.l1n($this$withTimeoutOrNull, $completion);
3020
+ tmp.i9_1 = Unit_instance;
3021
+ tmp.j9_1 = null;
3022
+ return tmp.o9();
3023
+ };
3024
+ protoOf(ForkedProofHost$run$slambda).ba = function (p1, $completion) {
3025
+ return this.pc6((!(p1 == null) ? isInterface(p1, CoroutineScope_0) : false) ? p1 : THROW_CCE(), $completion);
3026
+ };
3027
+ protoOf(ForkedProofHost$run$slambda).o9 = function () {
3028
+ var suspendResult = this.i9_1;
3029
+ $sm: do
3030
+ try {
3031
+ var tmp = this.g9_1;
3032
+ switch (tmp) {
3033
+ case 0:
3034
+ this.h9_1 = 2;
3035
+ this.g9_1 = 1;
3036
+ suspendResult = this.nc6_1.zc5_1.j1f(this);
3037
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
3038
+ return suspendResult;
3039
+ }
3040
+
3041
+ continue $sm;
3042
+ case 1:
3043
+ return suspendResult;
3044
+ case 2:
3045
+ throw this.j9_1;
3046
+ }
3047
+ } catch ($p) {
3048
+ var e = $p;
3049
+ if (this.h9_1 === 2) {
3050
+ throw e;
3051
+ } else {
3052
+ this.g9_1 = this.h9_1;
3053
+ this.j9_1 = e;
3054
+ }
3055
+ }
3056
+ while (true);
3057
+ };
3058
+ protoOf(ForkedProofHost$run$slambda).l1n = function ($this$withTimeoutOrNull, completion) {
3059
+ var i = new ForkedProofHost$run$slambda(this.nc6_1, completion);
3060
+ i.oc6_1 = $this$withTimeoutOrNull;
3061
+ return i;
3062
+ };
3063
+ function ForkedProofHost$run$slambda_0($child, resultContinuation) {
3064
+ var i = new ForkedProofHost$run$slambda($child, resultContinuation);
3065
+ return constructCallableReference(function ($this$withTimeoutOrNull, $completion) {
3066
+ return i.pc6($this$withTimeoutOrNull, $completion);
3067
+ }, 1);
3068
+ }
3069
+ function $proveCOROUTINE$(_this__u8e3s4, proof, upgrade, resultContinuation) {
3070
+ CoroutineImpl.call(this, resultContinuation);
3071
+ this.yc6_1 = _this__u8e3s4;
3072
+ this.zc6_1 = proof;
3073
+ this.ac7_1 = upgrade;
3074
+ }
3075
+ protoOf($proveCOROUTINE$).o9 = function () {
3076
+ var suspendResult = this.i9_1;
3077
+ $sm: do
3078
+ try {
3079
+ var tmp = this.g9_1;
3080
+ switch (tmp) {
3081
+ case 0:
3082
+ this.h9_1 = 6;
3083
+ this.cc7_1 = this.zc6_1.oau_1.dav_1;
3084
+ var tmp0_safe_receiver = this.yc6_1.nc5_1.xbx(this.yc6_1.kc5_1.fo());
3085
+ if (tmp0_safe_receiver == null)
3086
+ null;
3087
+ else {
3088
+ var held = new NotStarted(tmp0_safe_receiver);
3089
+ this.yc6_1.qc5_1(this.cc7_1, held);
3090
+ return new Failed(held);
3091
+ }
3092
+
3093
+ this.ic7_1 = this.yc6_1.rc5_1;
3094
+ this.hc7_1 = null;
3095
+ this.g9_1 = 1;
3096
+ suspendResult = this.ic7_1.c1t(this.hc7_1, this);
3097
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
3098
+ return suspendResult;
3099
+ }
3100
+
3101
+ continue $sm;
3102
+ case 1:
3103
+ var tmp$ret$0 = Unit_instance;
3104
+ l$ret$1: do {
3105
+ var tmp_0;
3106
+ try {
3107
+ var tmp0_elvis_lhs = takeIdle(this.yc6_1);
3108
+ var tmp_1 = tmp0_elvis_lhs == null ? fork(this.yc6_1) : tmp0_elvis_lhs;
3109
+ var _unary__edvuaz = this.yc6_1.uc5_1;
3110
+ this.yc6_1.uc5_1 = _unary__edvuaz + 1 | 0;
3111
+ tmp$ret$0 = to(tmp_1, _unary__edvuaz);
3112
+ break l$ret$1;
3113
+ } catch ($p) {
3114
+ var tmp_2;
3115
+ var t = $p;
3116
+ this.ic7_1.o1s(this.hc7_1);
3117
+ throw t;
3118
+ }
3119
+ }
3120
+ while (false);
3121
+ var tmp_3 = tmp$ret$0;
3122
+ this.ic7_1.o1s(this.hc7_1);
3123
+ this.dc7_1 = tmp_3.eh();
3124
+ var id = tmp_3.fh();
3125
+ this.yc6_1.pc5_1('proof started', false, listOf([to('dealId', this.cc7_1), to('pid', this.dc7_1.ac6_1)]));
3126
+ this.h9_1 = 3;
3127
+ this.g9_1 = 2;
3128
+ suspendResult = run(this.yc6_1, this.dc7_1, id, this.zc6_1, this.ac7_1, this);
3129
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
3130
+ return suspendResult;
3131
+ }
3132
+
3133
+ continue $sm;
3134
+ case 2:
3135
+ this.gc7_1 = suspendResult;
3136
+ this.h9_1 = 6;
3137
+ this.g9_1 = 4;
3138
+ continue $sm;
3139
+ case 3:
3140
+ this.h9_1 = 6;
3141
+ var tmp_4 = this.j9_1;
3142
+ if (tmp_4 instanceof CancellationException) {
3143
+ var e = this.j9_1;
3144
+ var tmp_5 = this;
3145
+ this.dc7_1.jc7();
3146
+ throw e;
3147
+ } else {
3148
+ throw this.j9_1;
3149
+ }
3150
+
3151
+ case 4:
3152
+ this.h9_1 = 6;
3153
+ this.bc7_1 = this.gc7_1;
3154
+ this.fc7_1 = this.yc6_1.rc5_1;
3155
+ this.ec7_1 = null;
3156
+ this.g9_1 = 5;
3157
+ suspendResult = this.fc7_1.c1t(this.ec7_1, this);
3158
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
3159
+ return suspendResult;
3160
+ }
3161
+
3162
+ continue $sm;
3163
+ case 5:
3164
+ l$ret$3: do {
3165
+ var tmp_6;
3166
+ try {
3167
+ release(this.yc6_1, this.dc7_1, this.bc7_1);
3168
+ break l$ret$3;
3169
+ } catch ($p_0) {
3170
+ var tmp_7;
3171
+ var t_0 = $p_0;
3172
+ this.fc7_1.o1s(this.ec7_1);
3173
+ throw t_0;
3174
+ }
3175
+ }
3176
+ while (false);
3177
+ this.fc7_1.o1s(this.ec7_1);
3178
+ var tmp1_subject = this.bc7_1;
3179
+ if (tmp1_subject instanceof Proved) {
3180
+ this.yc6_1.nc5_1.zbx();
3181
+ this.yc6_1.pc5_1('proof made', false, listOf([to('dealId', this.cc7_1), to('pid', this.dc7_1.ac6_1)]));
3182
+ this.yc6_1.qc5_1(this.cc7_1, null);
3183
+ } else {
3184
+ if (tmp1_subject instanceof Failed) {
3185
+ this.yc6_1.nc5_1.ybx(this.bc7_1.vas_1, this.yc6_1.kc5_1.fo());
3186
+ this.yc6_1.pc5_1('proof failed', true, listOf([to('dealId', this.cc7_1), to('pid', this.dc7_1.ac6_1), to('reason', ProverOutput_getInstance().k76(this.bc7_1.vas_1.dau()))]));
3187
+ this.yc6_1.qc5_1(this.cc7_1, this.bc7_1.vas_1);
3188
+ } else {
3189
+ noWhenBranchMatchedException();
3190
+ }
3191
+ }
3192
+
3193
+ return this.bc7_1;
3194
+ case 6:
3195
+ throw this.j9_1;
3196
+ }
3197
+ } catch ($p_1) {
3198
+ var e_0 = $p_1;
3199
+ if (this.h9_1 === 6) {
3200
+ throw e_0;
3201
+ } else {
3202
+ this.g9_1 = this.h9_1;
3203
+ this.j9_1 = e_0;
3204
+ }
3205
+ }
3206
+ while (true);
3207
+ };
3208
+ function $runCOROUTINE$(_this__u8e3s4, child, id, proof, upgrade, resultContinuation) {
3209
+ CoroutineImpl.call(this, resultContinuation);
3210
+ this.yc4_1 = _this__u8e3s4;
3211
+ this.zc4_1 = child;
3212
+ this.ac5_1 = id;
3213
+ this.bc5_1 = proof;
3214
+ this.cc5_1 = upgrade;
3215
+ }
3216
+ protoOf($runCOROUTINE$).o9 = function () {
3217
+ var suspendResult = this.i9_1;
3218
+ $sm: do
3219
+ try {
3220
+ var tmp = this.g9_1;
3221
+ switch (tmp) {
3222
+ case 0:
3223
+ this.h9_1 = 9;
3224
+ this.gc5_1 = Monotonic_instance.df();
3225
+ this.ec5_1 = null;
3226
+ if (!this.zc4_1.kc7(ProverIpc_getInstance().mby(new Prove(this.ac5_1, this.bc5_1.oau_1, this.bc5_1.pau_1, this.bc5_1.qau_1, this.yc4_1.jc5_1)))) {
3227
+ return killed(this.yc4_1, KillCause_EXITED_getInstance(), "the prover's channel was closed");
3228
+ }
3229
+
3230
+ var _receiver__tnumb7 = this.zc4_1;
3231
+ _receiver__tnumb7.bc6_1 = _receiver__tnumb7.bc6_1 + 1 | 0;
3232
+ this.g9_1 = 1;
3233
+ continue $sm;
3234
+ case 1:
3235
+ if (!true) {
3236
+ this.g9_1 = 10;
3237
+ continue $sm;
3238
+ }
3239
+
3240
+ var tmp0_safe_receiver = this.ec5_1;
3241
+ var tmp_0;
3242
+ if (tmp0_safe_receiver == null) {
3243
+ tmp_0 = null;
3244
+ } else {
3245
+ tmp_0 = Duration__minus_impl_q5cfm7(this.yc4_1.lc5_1.xc2_1, tmp0_safe_receiver.qp());
3246
+ }
3247
+
3248
+ var tmp1_elvis_lhs = tmp_0;
3249
+ var tmp_1;
3250
+ var tmp_2 = tmp1_elvis_lhs;
3251
+ if ((tmp_2 == null ? null : new Duration(tmp_2)) == null) {
3252
+ tmp_1 = Duration__minus_impl_q5cfm7(this.yc4_1.lc5_1.wc2_1, ValueTimeMark__elapsedNow_impl_eonqvs(this.gc5_1));
3253
+ } else {
3254
+ tmp_1 = tmp1_elvis_lhs;
3255
+ }
3256
+
3257
+ var left = tmp_1;
3258
+ this.g9_1 = 2;
3259
+ var tmp_3 = coerceAtLeast(new Duration(left), new Duration(Companion_getInstance().kf_1));
3260
+ suspendResult = withTimeoutOrNull(tmp_3.jf_1, ForkedProofHost$run$slambda_0(this.zc4_1, null), this);
3261
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
3262
+ return suspendResult;
3263
+ }
3264
+
3265
+ continue $sm;
3266
+ case 2:
3267
+ var event = suspendResult;
3268
+ if (event == null) {
3269
+ this.zc4_1.jc7();
3270
+ return killed(this.yc4_1, this.ec5_1 == null ? KillCause_CONNECT_DEADLINE_getInstance() : KillCause_SESSION_DEADLINE_getInstance(), null);
3271
+ }
3272
+
3273
+ if (event instanceof Exited) {
3274
+ return killed(this.yc4_1, event.pc7(), event.qc7());
3275
+ } else {
3276
+ if (event instanceof Message) {
3277
+ this.yc4_1;
3278
+ var tmp_4;
3279
+ try {
3280
+ var value = ProverIpc_getInstance().pby(event.lc7_1);
3281
+ tmp_4 = _Result___init__impl__xyqfz8(value);
3282
+ } catch ($p) {
3283
+ var tmp_5;
3284
+ if ($p instanceof Error) {
3285
+ var e = $p;
3286
+ tmp_5 = _Result___init__impl__xyqfz8(createFailure(e));
3287
+ } else {
3288
+ throw $p;
3289
+ }
3290
+ tmp_4 = tmp_5;
3291
+ }
3292
+ var this_0 = tmp_4;
3293
+ var tmp3_safe_receiver = _Result___get_isFailure__impl__jpiriv(this_0) ? null : _Result___get_value__impl__bjfvqg(this_0);
3294
+ var tmp_6;
3295
+ if (tmp3_safe_receiver == null) {
3296
+ tmp_6 = null;
3297
+ } else {
3298
+ var tmp_7;
3299
+ if (tmp3_safe_receiver.p6b() === this.ac5_1) {
3300
+ tmp_7 = tmp3_safe_receiver;
3301
+ } else {
3302
+ tmp_7 = null;
3303
+ }
3304
+ tmp_6 = tmp_7;
3305
+ }
3306
+ var tmp4_elvis_lhs = tmp_6;
3307
+ if (tmp4_elvis_lhs == null) {
3308
+ this.g9_1 = 1;
3309
+ var tmp_8 = this;
3310
+ continue $sm;
3311
+ } else {
3312
+ this.fc5_1 = tmp4_elvis_lhs;
3313
+ this.g9_1 = 3;
3314
+ continue $sm;
3315
+ }
3316
+ } else {
3317
+ noWhenBranchMatchedException();
3318
+ }
3319
+ }
3320
+
3321
+ break;
3322
+ case 3:
3323
+ var message = this.fc5_1;
3324
+ if (message instanceof HeadersWanted) {
3325
+ if (this.ec5_1 == null)
3326
+ this.ec5_1 = new ValueTimeMark(Monotonic_instance.df());
3327
+ this.h9_1 = 5;
3328
+ this.g9_1 = 4;
3329
+ suspendResult = this.cc5_1.n75(this);
3330
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
3331
+ return suspendResult;
3332
+ }
3333
+ continue $sm;
3334
+ } else {
3335
+ if (message instanceof Proved_0) {
3336
+ return new Proved(message.jbz_1);
3337
+ } else {
3338
+ if (message instanceof Failed_0) {
3339
+ return new Failed(message.obz_1);
3340
+ } else {
3341
+ noWhenBranchMatchedException();
3342
+ }
3343
+ }
3344
+ }
3345
+
3346
+ break;
3347
+ case 4:
3348
+ var ARGUMENT = suspendResult.rau_1;
3349
+ this.dc5_1 = new Headers(this.ac5_1, ARGUMENT);
3350
+ this.h9_1 = 9;
3351
+ this.g9_1 = 6;
3352
+ continue $sm;
3353
+ case 5:
3354
+ this.h9_1 = 9;
3355
+ var tmp_9 = this.j9_1;
3356
+ if (tmp_9 instanceof CancellationException) {
3357
+ var e_0 = this.j9_1;
3358
+ var tmp_10 = this;
3359
+ throw e_0;
3360
+ } else {
3361
+ var tmp_11 = this.j9_1;
3362
+ if (tmp_11 instanceof Error) {
3363
+ var e_1 = this.j9_1;
3364
+ var tmp_12 = this;
3365
+ var tmp6_elvis_lhs = e_1.message;
3366
+ tmp_12.dc5_1 = new Headers(this.ac5_1, VOID, 'the upgrade could not be signed: ' + (tmp6_elvis_lhs == null ? 'no detail' : tmp6_elvis_lhs));
3367
+ this.g9_1 = 6;
3368
+ continue $sm;
3369
+ } else {
3370
+ throw this.j9_1;
3371
+ }
3372
+ }
3373
+
3374
+ case 6:
3375
+ this.h9_1 = 9;
3376
+ var reply = this.dc5_1;
3377
+ if (!this.zc4_1.kc7(ProverIpc_getInstance().mby(reply)))
3378
+ return killed(this.yc4_1, KillCause_EXITED_getInstance(), "the prover's channel was closed");
3379
+ this.g9_1 = 7;
3380
+ continue $sm;
3381
+ case 7:
3382
+ this.g9_1 = 8;
3383
+ continue $sm;
3384
+ case 8:
3385
+ this.g9_1 = 1;
3386
+ continue $sm;
3387
+ case 9:
3388
+ throw this.j9_1;
3389
+ case 10:
3390
+ return Unit_instance;
3391
+ }
3392
+ } catch ($p_0) {
3393
+ var e_2 = $p_0;
3394
+ if (this.h9_1 === 9) {
3395
+ throw e_2;
3396
+ } else {
3397
+ this.g9_1 = this.h9_1;
3398
+ this.j9_1 = e_2;
3399
+ }
3400
+ }
3401
+ while (true);
3402
+ };
3403
+ function ForkedProofHost(script, args, settings, clock, limits, env, backoff, onLine, onNotice, onOutcome) {
3404
+ limits = limits === VOID ? new ProverLimits() : limits;
3405
+ env = env === VOID ? minimalProverEnv() : env;
3406
+ backoff = backoff === VOID ? new ProverBackoff() : backoff;
3407
+ var tmp;
3408
+ if (onLine === VOID) {
3409
+ tmp = ForkedProofHost$_init_$lambda_p9fnmo;
3410
+ } else {
3411
+ tmp = onLine;
3412
+ }
3413
+ onLine = tmp;
3414
+ var tmp_0;
3415
+ if (onNotice === VOID) {
3416
+ tmp_0 = ForkedProofHost$_init_$lambda_p9fnmo_0;
3417
+ } else {
3418
+ tmp_0 = onNotice;
3419
+ }
3420
+ onNotice = tmp_0;
3421
+ var tmp_1;
3422
+ if (onOutcome === VOID) {
3423
+ tmp_1 = ForkedProofHost$_init_$lambda_p9fnmo_1;
3424
+ } else {
3425
+ tmp_1 = onOutcome;
3426
+ }
3427
+ onOutcome = tmp_1;
3428
+ this.hc5_1 = script;
3429
+ this.ic5_1 = args;
3430
+ this.jc5_1 = settings;
3431
+ this.kc5_1 = clock;
3432
+ this.lc5_1 = limits;
3433
+ this.mc5_1 = env;
3434
+ this.nc5_1 = backoff;
3435
+ this.oc5_1 = onLine;
3436
+ this.pc5_1 = onNotice;
3437
+ this.qc5_1 = onOutcome;
3438
+ this.rc5_1 = Mutex();
3439
+ this.sc5_1 = ArrayDeque_init_$Create$();
3440
+ var tmp_2 = this;
3441
+ // Inline function 'kotlin.collections.mutableSetOf' call
3442
+ tmp_2.tc5_1 = LinkedHashSet_init_$Create$();
3443
+ this.uc5_1 = 1;
3444
+ this.vc5_1 = 0;
3445
+ }
3446
+ protoOf(ForkedProofHost).uas = function (proof, upgrade, $completion) {
3447
+ var tmp = new $proveCOROUTINE$(this, proof, upgrade, $completion);
3448
+ tmp.i9_1 = Unit_instance;
3449
+ tmp.j9_1 = null;
3450
+ return tmp.o9();
3451
+ };
3452
+ protoOf(ForkedProofHost).aby = function () {
3453
+ return this.nc5_1.aby();
3454
+ };
3455
+ protoOf(ForkedProofHost).h4 = function () {
3456
+ // Inline function 'kotlin.collections.forEach' call
3457
+ var _iterator__ex2g4s = this.tc5_1.t();
3458
+ while (_iterator__ex2g4s.u()) {
3459
+ var element = _iterator__ex2g4s.v();
3460
+ element.jc7();
3461
+ }
3462
+ this.tc5_1.a3();
3463
+ this.sc5_1.a3();
3464
+ };
3465
+ function minimalProverEnv(from) {
3466
+ from = from === VOID ? get_nodeProcess().env : from;
3467
+ _init_properties_ForkedProofHost_kt__xbrlvr();
3468
+ // Inline function 'kotlin.collections.mapNotNull' call
3469
+ var tmp0 = get_PROVER_ENV_ALLOWED();
3470
+ // Inline function 'kotlin.collections.mapNotNullTo' call
3471
+ var destination = ArrayList_init_$Create$_0();
3472
+ // Inline function 'kotlin.collections.forEach' call
3473
+ var _iterator__ex2g4s = tmp0.t();
3474
+ while (_iterator__ex2g4s.u()) {
3475
+ var element = _iterator__ex2g4s.v();
3476
+ var tmp = from[element];
3477
+ var tmp0_safe_receiver = (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : null;
3478
+ var tmp_0;
3479
+ if (tmp0_safe_receiver == null) {
3480
+ tmp_0 = null;
3481
+ } else {
3482
+ // Inline function 'kotlin.let' call
3483
+ tmp_0 = to(element, tmp0_safe_receiver);
3484
+ }
3485
+ var tmp0_safe_receiver_0 = tmp_0;
3486
+ if (tmp0_safe_receiver_0 == null)
3487
+ null;
3488
+ else {
3489
+ // Inline function 'kotlin.let' call
3490
+ destination.e1(tmp0_safe_receiver_0);
3491
+ }
3492
+ }
3493
+ return toMap(destination);
3494
+ }
3495
+ function toJsObject(_this__u8e3s4) {
3496
+ _init_properties_ForkedProofHost_kt__xbrlvr();
3497
+ var target = {};
3498
+ // Inline function 'kotlin.collections.forEach' call
3499
+ // Inline function 'kotlin.collections.iterator' call
3500
+ var _iterator__ex2g4s = _this__u8e3s4.n1().t();
3501
+ while (_iterator__ex2g4s.u()) {
3502
+ var element = _iterator__ex2g4s.v();
3503
+ // Inline function 'kotlin.collections.component1' call
3504
+ var key = element.o1();
3505
+ // Inline function 'kotlin.collections.component2' call
3506
+ var value = element.p1();
3507
+ target[key] = value;
3508
+ }
3509
+ return target;
3510
+ }
3511
+ function Message(text) {
3512
+ this.lc7_1 = text;
3513
+ }
3514
+ protoOf(Message).toString = function () {
3515
+ return 'Message(text=' + this.lc7_1 + ')';
3516
+ };
3517
+ protoOf(Message).hashCode = function () {
3518
+ return getStringHashCode(this.lc7_1);
3519
+ };
3520
+ protoOf(Message).equals = function (other) {
3521
+ if (this === other)
3522
+ return true;
3523
+ if (!(other instanceof Message))
3524
+ return false;
3525
+ if (!(this.lc7_1 === other.lc7_1))
3526
+ return false;
3527
+ return true;
3528
+ };
3529
+ function Exited(code, signal, error) {
3530
+ error = error === VOID ? null : error;
3531
+ this.mc7_1 = code;
3532
+ this.nc7_1 = signal;
3533
+ this.oc7_1 = error;
3534
+ }
3535
+ protoOf(Exited).pc7 = function () {
3536
+ return this.nc7_1 === 'SIGKILL' ? KillCause_OUT_OF_MEMORY_getInstance() : KillCause_EXITED_getInstance();
3537
+ };
3538
+ protoOf(Exited).qc7 = function () {
3539
+ var tmp0_elvis_lhs = this.oc7_1;
3540
+ var tmp;
3541
+ if (tmp0_elvis_lhs == null) {
3542
+ var tmp1_safe_receiver = this.nc7_1;
3543
+ var tmp_0;
3544
+ if (tmp1_safe_receiver == null) {
3545
+ tmp_0 = null;
3546
+ } else {
3547
+ // Inline function 'kotlin.let' call
3548
+ tmp_0 = 'signal ' + tmp1_safe_receiver;
3549
+ }
3550
+ tmp = tmp_0;
3551
+ } else {
3552
+ tmp = tmp0_elvis_lhs;
3553
+ }
3554
+ var tmp2_elvis_lhs = tmp;
3555
+ return tmp2_elvis_lhs == null ? 'exit code ' + this.mc7_1 : tmp2_elvis_lhs;
3556
+ };
3557
+ protoOf(Exited).toString = function () {
3558
+ return 'Exited(code=' + this.mc7_1 + ', signal=' + this.nc7_1 + ', error=' + this.oc7_1 + ')';
3559
+ };
3560
+ protoOf(Exited).hashCode = function () {
3561
+ var result = this.mc7_1 == null ? 0 : this.mc7_1;
3562
+ result = imul(result, 31) + (this.nc7_1 == null ? 0 : getStringHashCode(this.nc7_1)) | 0;
3563
+ result = imul(result, 31) + (this.oc7_1 == null ? 0 : getStringHashCode(this.oc7_1)) | 0;
3564
+ return result;
3565
+ };
3566
+ protoOf(Exited).equals = function (other) {
3567
+ if (this === other)
3568
+ return true;
3569
+ if (!(other instanceof Exited))
3570
+ return false;
3571
+ if (!(this.mc7_1 == other.mc7_1))
3572
+ return false;
3573
+ if (!(this.nc7_1 == other.nc7_1))
3574
+ return false;
3575
+ if (!(this.oc7_1 == other.oc7_1))
3576
+ return false;
3577
+ return true;
3578
+ };
3579
+ function pipe($this, stream, name) {
3580
+ if (stream == null)
3581
+ return Unit_instance;
3582
+ var pending = {_v: ''};
3583
+ stream.setEncoding('utf8');
3584
+ stream.on('data', ForkedChild$pipe$lambda(pending, $this, name));
3585
+ stream.on('end', ForkedChild$pipe$lambda_0(pending, $this, name));
3586
+ }
3587
+ function emit($this, stream, line) {
3588
+ var text = trimEnd(line, charArrayOf([_Char___init__impl__6a9atx(13)]));
3589
+ if (isBlank(text))
3590
+ return Unit_instance;
3591
+ $this.xc5_1($this.ac6_1, stream, ProverOutput_getInstance().k76(text));
3592
+ }
3593
+ function ForkedChild$lambda(this$0) {
3594
+ return function (message) {
3595
+ var tmp;
3596
+ if (typeof message === 'string') {
3597
+ // Inline function 'kotlin.js.unsafeCast' call
3598
+ this$0.zc5_1.h1f(new Message(message));
3599
+ tmp = Unit_instance;
3600
+ }
3601
+ return Unit_instance;
3602
+ };
3603
+ }
3604
+ function ForkedChild$lambda_0(this$0) {
3605
+ return function (code, signal) {
3606
+ this$0.cc6_1 = true;
3607
+ var tmp0_safe_receiver = isNumber(code) ? code : null;
3608
+ var tmp = tmp0_safe_receiver == null ? null : numberToInt(tmp0_safe_receiver);
3609
+ var exit = new Exited(tmp, (!(signal == null) ? typeof signal === 'string' : false) ? signal : null);
3610
+ var tmp_0 = to('pid', this$0.ac6_1);
3611
+ var tmp1_safe_receiver = exit.mc7_1;
3612
+ this$0.yc5_1('prover exited', false, listOf([tmp_0, to('code', tmp1_safe_receiver == null ? null : tmp1_safe_receiver.toString()), to('signal', exit.nc7_1), to('killedBySdk', this$0.dc6_1.toString())]));
3613
+ return new ChannelResult(this$0.zc5_1.h1f(exit));
3614
+ };
3615
+ }
3616
+ function ForkedChild$lambda_1(this$0) {
3617
+ return function (error) {
3618
+ this$0.cc6_1 = true;
3619
+ var tmp1_elvis_lhs = error == null ? null : error.message;
3620
+ return new ChannelResult(this$0.zc5_1.h1f(new Exited(null, null, 'the prover process failed: ' + (tmp1_elvis_lhs == null ? 'no detail' : tmp1_elvis_lhs))));
3621
+ };
3622
+ }
3623
+ function ForkedChild$end$lambda(this$0) {
3624
+ return function () {
3625
+ var tmp;
3626
+ if (!this$0.cc6_1) {
3627
+ this$0.jc7();
3628
+ tmp = Unit_instance;
3629
+ }
3630
+ return Unit_instance;
3631
+ };
3632
+ }
3633
+ function ForkedChild$pipe$lambda($pending, this$0, $name) {
3634
+ return function (chunk) {
3635
+ var lines = split($pending._v + chunk, charArrayOf([_Char___init__impl__6a9atx(10)]));
3636
+ $pending._v = last(lines);
3637
+ // Inline function 'kotlin.collections.forEach' call
3638
+ var _iterator__ex2g4s = dropLast(lines, 1).t();
3639
+ while (_iterator__ex2g4s.u()) {
3640
+ var element = _iterator__ex2g4s.v();
3641
+ emit(this$0, $name, element);
3642
+ }
3643
+ return Unit_instance;
3644
+ };
3645
+ }
3646
+ function ForkedChild$pipe$lambda_0($pending, this$0, $name) {
3647
+ return function () {
3648
+ var tmp;
3649
+ // Inline function 'kotlin.text.isNotEmpty' call
3650
+ var this_0 = $pending._v;
3651
+ if (charSequenceLength(this_0) > 0) {
3652
+ emit(this$0, $name, $pending._v);
3653
+ tmp = Unit_instance;
3654
+ }
3655
+ $pending._v = '';
3656
+ return Unit_instance;
3657
+ };
3658
+ }
3659
+ function ForkedChild(process, onLine, onNotice) {
3660
+ this.wc5_1 = process;
3661
+ this.xc5_1 = onLine;
3662
+ this.yc5_1 = onNotice;
3663
+ this.zc5_1 = Channel(2147483647);
3664
+ var tmp = this;
3665
+ var tmp_0 = this.wc5_1.pid;
3666
+ var tmp0_safe_receiver = isNumber(tmp_0) ? tmp_0 : null;
3667
+ var tmp1_elvis_lhs = tmp0_safe_receiver == null ? null : toString_0(tmp0_safe_receiver);
3668
+ tmp.ac6_1 = tmp1_elvis_lhs == null ? '?' : tmp1_elvis_lhs;
3669
+ this.bc6_1 = 0;
3670
+ this.cc6_1 = false;
3671
+ this.dc6_1 = false;
3672
+ this.wc5_1.on('message', ForkedChild$lambda(this));
3673
+ this.wc5_1.on('exit', ForkedChild$lambda_0(this));
3674
+ this.wc5_1.on('error', ForkedChild$lambda_1(this));
3675
+ pipe(this, this.wc5_1.stdout, 'stdout');
3676
+ pipe(this, this.wc5_1.stderr, 'stderr');
3677
+ }
3678
+ protoOf(ForkedChild).kc7 = function (text) {
3679
+ var tmp;
3680
+ try {
3681
+ var tmp_0;
3682
+ if (this.cc6_1 || this.wc5_1.connected != true) {
3683
+ tmp_0 = false;
3684
+ } else {
3685
+ this.wc5_1.send(text);
3686
+ tmp_0 = true;
3687
+ }
3688
+ tmp = tmp_0;
3689
+ } catch ($p) {
3690
+ var tmp_1;
3691
+ if ($p instanceof Error) {
3692
+ var _unused_var__etf5q3 = $p;
3693
+ tmp_1 = false;
3694
+ } else {
3695
+ throw $p;
3696
+ }
3697
+ tmp = tmp_1;
3698
+ }
3699
+ return tmp;
3700
+ };
3701
+ protoOf(ForkedChild).jc7 = function () {
3702
+ if (this.cc6_1)
3703
+ return Unit_instance;
3704
+ this.dc6_1 = true;
3705
+ // Inline function 'kotlin.runCatching' call
3706
+ var tmp;
3707
+ try {
3708
+ // Inline function 'kotlin.Companion.success' call
3709
+ var value = this.wc5_1.kill('SIGKILL');
3710
+ tmp = _Result___init__impl__xyqfz8(value);
3711
+ } catch ($p) {
3712
+ var tmp_0;
3713
+ if ($p instanceof Error) {
3714
+ var e = $p;
3715
+ // Inline function 'kotlin.Companion.failure' call
3716
+ tmp_0 = _Result___init__impl__xyqfz8(createFailure(e));
3717
+ } else {
3718
+ throw $p;
3719
+ }
3720
+ tmp = tmp_0;
3721
+ }
3722
+ };
3723
+ protoOf(ForkedChild).ec6 = function (grace) {
3724
+ if (this.cc6_1)
3725
+ return Unit_instance;
3726
+ // Inline function 'kotlin.runCatching' call
3727
+ var tmp;
3728
+ try {
3729
+ if (this.wc5_1.connected == true) {
3730
+ this.wc5_1.disconnect();
3731
+ }
3732
+ // Inline function 'kotlin.Companion.success' call
3733
+ tmp = _Result___init__impl__xyqfz8(Unit_instance);
3734
+ } catch ($p) {
3735
+ var tmp_0;
3736
+ if ($p instanceof Error) {
3737
+ var e = $p;
3738
+ // Inline function 'kotlin.Companion.failure' call
3739
+ tmp_0 = _Result___init__impl__xyqfz8(createFailure(e));
3740
+ } else {
3741
+ throw $p;
3742
+ }
3743
+ tmp = tmp_0;
3744
+ }
3745
+ var tmp_1 = setTimeout;
3746
+ var timer = tmp_1(ForkedChild$end$lambda(this), toNumber(_Duration___get_inWholeMilliseconds__impl__msfiry(grace)));
3747
+ // Inline function 'kotlin.runCatching' call
3748
+ var tmp_2;
3749
+ try {
3750
+ // Inline function 'kotlin.Companion.success' call
3751
+ var value = timer.unref();
3752
+ tmp_2 = _Result___init__impl__xyqfz8(value);
3753
+ } catch ($p_0) {
3754
+ var tmp_3;
3755
+ if ($p_0 instanceof Error) {
3756
+ var e_0 = $p_0;
3757
+ // Inline function 'kotlin.Companion.failure' call
3758
+ tmp_3 = _Result___init__impl__xyqfz8(createFailure(e_0));
3759
+ } else {
3760
+ throw $p_0;
3761
+ }
3762
+ tmp_2 = tmp_3;
3763
+ }
3764
+ };
3765
+ var properties_initialized_ForkedProofHost_kt_js7p1h;
3766
+ function _init_properties_ForkedProofHost_kt__xbrlvr() {
3767
+ if (!properties_initialized_ForkedProofHost_kt_js7p1h) {
3768
+ properties_initialized_ForkedProofHost_kt_js7p1h = true;
3769
+ PROVER_ENV_ALLOWED = listOf(['PATH', 'TZ', 'LANG', 'LC_ALL', 'TMPDIR', 'SYSTEMROOT']);
3770
+ }
3771
+ }
3772
+ function NodeWasmProver$prove$slambda$slambda$lambda(line) {
3773
+ println('prover: ' + line);
3774
+ return Unit_instance;
3775
+ }
3776
+ function NodeWasmProver$prove$slambda$slambda($proof, $config, $host, this$0, resultContinuation) {
3777
+ this.zc7_1 = $proof;
3778
+ this.ac8_1 = $config;
3779
+ this.bc8_1 = $host;
3780
+ this.cc8_1 = this$0;
3781
+ CoroutineImpl.call(this, resultContinuation);
3782
+ }
3783
+ protoOf(NodeWasmProver$prove$slambda$slambda).cbu = function ($this$async, $completion) {
3784
+ var tmp = this.l1n($this$async, $completion);
3785
+ tmp.i9_1 = Unit_instance;
3786
+ tmp.j9_1 = null;
3787
+ return tmp.o9();
3788
+ };
3789
+ protoOf(NodeWasmProver$prove$slambda$slambda).ba = function (p1, $completion) {
3790
+ return this.cbu((!(p1 == null) ? isInterface(p1, CoroutineScope_0) : false) ? p1 : THROW_CCE(), $completion);
3791
+ };
3792
+ protoOf(NodeWasmProver$prove$slambda$slambda).o9 = function () {
3793
+ var suspendResult = this.i9_1;
3794
+ $sm: do
3795
+ try {
3796
+ var tmp = this.g9_1;
3797
+ switch (tmp) {
3798
+ case 0:
3799
+ this.h9_1 = 2;
3800
+ this.g9_1 = 1;
3801
+ var tmp_0 = new HostedProofRequest(this.zc7_1.tby_1, this.zc7_1.uby_1, this.zc7_1.vby_1);
3802
+ var tmp_1 = this.cc8_1.ec8_1.fo();
3803
+ suspendResult = runHostedProof(tmp_0, this.ac8_1, this.bc8_1, tmp_1, NodeWasmProver$prove$slambda$slambda$lambda, this);
3804
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
3805
+ return suspendResult;
3806
+ }
3807
+
3808
+ continue $sm;
3809
+ case 1:
3810
+ return suspendResult;
3811
+ case 2:
3812
+ throw this.j9_1;
3813
+ }
3814
+ } catch ($p) {
3815
+ var e = $p;
3816
+ if (this.h9_1 === 2) {
3817
+ throw e;
3818
+ } else {
3819
+ this.g9_1 = this.h9_1;
3820
+ this.j9_1 = e;
3821
+ }
3822
+ }
3823
+ while (true);
3824
+ };
3825
+ protoOf(NodeWasmProver$prove$slambda$slambda).l1n = function ($this$async, completion) {
3826
+ var i = new NodeWasmProver$prove$slambda$slambda(this.zc7_1, this.ac8_1, this.bc8_1, this.cc8_1, completion);
3827
+ i.dc8_1 = $this$async;
3828
+ return i;
3829
+ };
3830
+ function NodeWasmProver$prove$slambda$slambda_0($proof, $config, $host, this$0, resultContinuation) {
3831
+ var i = new NodeWasmProver$prove$slambda$slambda($proof, $config, $host, this$0, resultContinuation);
3832
+ return constructCallableReference(function ($this$async, $completion) {
3833
+ return i.cbu($this$async, $completion);
3834
+ }, 1);
3835
+ }
3836
+ function NodeWasmProver$prove$slambda$slambda_1(resultContinuation) {
3837
+ CoroutineImpl.call(this, resultContinuation);
3838
+ }
3839
+ protoOf(NodeWasmProver$prove$slambda$slambda_1).oc8 = function (presentation, $completion) {
3840
+ var tmp = this.pc8(presentation, $completion);
3841
+ tmp.i9_1 = Unit_instance;
3842
+ tmp.j9_1 = null;
3843
+ return tmp.o9();
3844
+ };
3845
+ protoOf(NodeWasmProver$prove$slambda$slambda_1).ba = function (p1, $completion) {
3846
+ return this.oc8((!(p1 == null) ? typeof p1 === 'string' : false) ? p1 : THROW_CCE(), $completion);
3847
+ };
3848
+ protoOf(NodeWasmProver$prove$slambda$slambda_1).o9 = function () {
3849
+ var suspendResult = this.i9_1;
3850
+ $sm: do
3851
+ try {
3852
+ var tmp = this.g9_1;
3853
+ if (tmp === 0) {
3854
+ this.h9_1 = 1;
3855
+ return new Proved_1(this.nc8_1);
3856
+ } else if (tmp === 1) {
3857
+ throw this.j9_1;
3858
+ }
3859
+ } catch ($p) {
3860
+ var e = $p;
3861
+ throw e;
3862
+ }
3863
+ while (true);
3864
+ };
3865
+ protoOf(NodeWasmProver$prove$slambda$slambda_1).pc8 = function (presentation, completion) {
3866
+ var i = new NodeWasmProver$prove$slambda$slambda_1(completion);
3867
+ i.nc8_1 = presentation;
3868
+ return i;
3869
+ };
3870
+ function NodeWasmProver$prove$slambda$slambda_2(resultContinuation) {
3871
+ var i = new NodeWasmProver$prove$slambda$slambda_1(resultContinuation);
3872
+ return constructCallableReference(function (presentation, $completion) {
3873
+ return i.oc8(presentation, $completion);
3874
+ }, 1);
3875
+ }
3876
+ function NodeWasmProver$prove$slambda$slambda_3($proving, resultContinuation) {
3877
+ this.yc8_1 = $proving;
3878
+ CoroutineImpl.call(this, resultContinuation);
3879
+ }
3880
+ protoOf(NodeWasmProver$prove$slambda$slambda_3).ac9 = function (failure, $completion) {
3881
+ var tmp = this.bc9(failure, $completion);
3882
+ tmp.i9_1 = Unit_instance;
3883
+ tmp.j9_1 = null;
3884
+ return tmp.o9();
3885
+ };
3886
+ protoOf(NodeWasmProver$prove$slambda$slambda_3).ba = function (p1, $completion) {
3887
+ return this.ac9((!(p1 == null) ? isInterface(p1, ProofFailure) : false) ? p1 : THROW_CCE(), $completion);
3888
+ };
3889
+ protoOf(NodeWasmProver$prove$slambda$slambda_3).o9 = function () {
3890
+ var suspendResult = this.i9_1;
3891
+ $sm: do
3892
+ try {
3893
+ var tmp = this.g9_1;
3894
+ if (tmp === 0) {
3895
+ this.h9_1 = 1;
3896
+ this.yc8_1.sx();
3897
+ return new Failed_1(this.zc8_1, true);
3898
+ } else if (tmp === 1) {
3899
+ throw this.j9_1;
3900
+ }
3901
+ } catch ($p) {
3902
+ var e = $p;
3903
+ throw e;
3904
+ }
3905
+ while (true);
3906
+ };
3907
+ protoOf(NodeWasmProver$prove$slambda$slambda_3).bc9 = function (failure, completion) {
3908
+ var i = new NodeWasmProver$prove$slambda$slambda_3(this.yc8_1, completion);
3909
+ i.zc8_1 = failure;
3910
+ return i;
3911
+ };
3912
+ function NodeWasmProver$prove$slambda$slambda_4($proving, resultContinuation) {
3913
+ var i = new NodeWasmProver$prove$slambda$slambda_3($proving, resultContinuation);
3914
+ return constructCallableReference(function (failure, $completion) {
3915
+ return i.ac9(failure, $completion);
3916
+ }, 1);
3917
+ }
3918
+ function printStats($this, started) {
3919
+ var cpu = get_nodeProcess().cpuUsage(started);
3920
+ var tmp = get_nodeProcess().resourceUsage().maxRSS;
3921
+ var peakKb = numberToLong(isNumber(tmp) ? tmp : THROW_CCE());
3922
+ var tmp_0 = cpu.user;
3923
+ var tmp_1 = numberToLong(isNumber(tmp_0) ? tmp_0 : THROW_CCE());
3924
+ var tmp_2 = cpu.system;
3925
+ var cpuMs = divide(add(tmp_1, numberToLong(isNumber(tmp_2) ? tmp_2 : THROW_CCE())), new Long(1000, 0));
3926
+ println('prover: stats peakRssMb=' + divide(peakKb, new Long(1024, 0)).toString() + ' cpuMs=' + cpuMs.toString());
3927
+ }
3928
+ function classify($this, error, record) {
3929
+ var tmp = generateSequence(error, NodeWasmProver$classify$lambda);
3930
+ var message = joinToString_0(distinct(mapNotNull(tmp, NodeWasmProver$classify$lambda_0)), ': ');
3931
+ var tmp0_safe_receiver = record.jc9_1;
3932
+ if (tmp0_safe_receiver == null)
3933
+ null;
3934
+ else {
3935
+ // Inline function 'kotlin.let' call
3936
+ return new Other('the upgrade could not be signed: ' + tmp0_safe_receiver);
3937
+ }
3938
+ var tmp1_elvis_lhs = ProofFailures_getInstance().yau(record.ec9_1, record.fc9_1, record.gc9_1, record.ic9_1, record.hc9_1, !record.cc9_1 || record.dc9_1 || !(record.ec9_1 == null), message);
3939
+ return tmp1_elvis_lhs == null ? new Other(message) : tmp1_elvis_lhs;
3940
+ }
3941
+ function Companion_14() {
3942
+ Companion_instance_17 = this;
3943
+ this.lc9_1 = numberRangeToNumber(200, 299);
3944
+ this.mc9_1 = new Long(1000, 0);
3945
+ this.nc9_1 = new Long(1024, 0);
3946
+ }
3947
+ var Companion_instance_17;
3948
+ function Companion_getInstance_17() {
3949
+ if (Companion_instance_17 == null)
3950
+ new Companion_14();
3951
+ return Companion_instance_17;
3952
+ }
3953
+ function NodeWasmProver$prove$lambda($settings) {
3954
+ return function (path) {
3955
+ var tmp = com_dmarket_p2p_headless_node_nodePath_idbzon.join($settings.iby_1, path);
3956
+ return fileUrl((!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE());
3957
+ };
3958
+ }
3959
+ function NodeWasmProver$prove$slambda($settings, resultContinuation) {
3960
+ this.wc9_1 = $settings;
3961
+ CoroutineImpl.call(this, resultContinuation);
3962
+ }
3963
+ protoOf(NodeWasmProver$prove$slambda).xc9 = function ($completion) {
3964
+ var tmp = this.d31($completion);
3965
+ tmp.i9_1 = Unit_instance;
3966
+ tmp.j9_1 = null;
3967
+ return tmp.o9();
3968
+ };
3969
+ protoOf(NodeWasmProver$prove$slambda).aa = function ($completion) {
3970
+ return this.xc9($completion);
3971
+ };
3972
+ protoOf(NodeWasmProver$prove$slambda).o9 = function () {
3973
+ var suspendResult = this.i9_1;
3974
+ $sm: do
3975
+ try {
3976
+ var tmp = this.g9_1;
3977
+ switch (tmp) {
3978
+ case 0:
3979
+ this.h9_1 = 2;
3980
+ this.g9_1 = 1;
3981
+ var tmp_0 = com_dmarket_p2p_headless_node_nodePath_idbzon.join(this.wc9_1.iby_1, 'pkg', 'client_wasm_bg.wasm');
3982
+ suspendResult = compileWasm((!(tmp_0 == null) ? typeof tmp_0 === 'string' : false) ? tmp_0 : THROW_CCE(), this);
3983
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
3984
+ return suspendResult;
3985
+ }
3986
+
3987
+ continue $sm;
3988
+ case 1:
3989
+ return suspendResult;
3990
+ case 2:
3991
+ throw this.j9_1;
3992
+ }
3993
+ } catch ($p) {
3994
+ var e = $p;
3995
+ if (this.h9_1 === 2) {
3996
+ throw e;
3997
+ } else {
3998
+ this.g9_1 = this.h9_1;
3999
+ this.j9_1 = e;
4000
+ }
4001
+ }
4002
+ while (true);
4003
+ };
4004
+ protoOf(NodeWasmProver$prove$slambda).d31 = function (completion) {
4005
+ return new NodeWasmProver$prove$slambda(this.wc9_1, completion);
4006
+ };
4007
+ function NodeWasmProver$prove$slambda_0($settings, resultContinuation) {
4008
+ var i = new NodeWasmProver$prove$slambda($settings, resultContinuation);
4009
+ return constructCallableReference(function ($completion) {
4010
+ return i.xc9($completion);
4011
+ }, 0);
4012
+ }
4013
+ function NodeWasmProver$prove$slambda_1($record, $headers, resultContinuation) {
4014
+ this.gca_1 = $record;
4015
+ this.hca_1 = $headers;
4016
+ CoroutineImpl.call(this, resultContinuation);
4017
+ }
4018
+ protoOf(NodeWasmProver$prove$slambda_1).xc9 = function ($completion) {
4019
+ var tmp = this.d31($completion);
4020
+ tmp.i9_1 = Unit_instance;
4021
+ tmp.j9_1 = null;
4022
+ return tmp.o9();
4023
+ };
4024
+ protoOf(NodeWasmProver$prove$slambda_1).aa = function ($completion) {
4025
+ return this.xc9($completion);
4026
+ };
4027
+ protoOf(NodeWasmProver$prove$slambda_1).o9 = function () {
4028
+ var suspendResult = this.i9_1;
4029
+ $sm: do
4030
+ try {
4031
+ var tmp = this.g9_1;
4032
+ switch (tmp) {
4033
+ case 0:
4034
+ this.h9_1 = 4;
4035
+ this.gca_1.cc9_1 = true;
4036
+ this.h9_1 = 2;
4037
+ this.g9_1 = 1;
4038
+ suspendResult = this.hca_1(this);
4039
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
4040
+ return suspendResult;
4041
+ }
4042
+
4043
+ continue $sm;
4044
+ case 1:
4045
+ this.ica_1 = suspendResult;
4046
+ this.h9_1 = 4;
4047
+ this.g9_1 = 3;
4048
+ continue $sm;
4049
+ case 2:
4050
+ this.h9_1 = 4;
4051
+ var tmp_0 = this.j9_1;
4052
+ if (tmp_0 instanceof CancellationException) {
4053
+ var e = this.j9_1;
4054
+ var tmp_1 = this;
4055
+ throw e;
4056
+ } else {
4057
+ var tmp_2 = this.j9_1;
4058
+ if (tmp_2 instanceof Error) {
4059
+ var e_0 = this.j9_1;
4060
+ var tmp_3 = this;
4061
+ var tmp_4 = this.gca_1;
4062
+ var tmp0_elvis_lhs = e_0.message;
4063
+ tmp_4.jc9_1 = tmp0_elvis_lhs == null ? 'the upgrade could not be signed' : tmp0_elvis_lhs;
4064
+ throw e_0;
4065
+ } else {
4066
+ throw this.j9_1;
4067
+ }
4068
+ }
4069
+
4070
+ case 3:
4071
+ this.h9_1 = 4;
4072
+ var signed = this.ica_1;
4073
+ return headerWebSocket(signed.rau_1, this.gca_1);
4074
+ case 4:
4075
+ throw this.j9_1;
4076
+ }
4077
+ } catch ($p) {
4078
+ var e_1 = $p;
4079
+ if (this.h9_1 === 4) {
4080
+ throw e_1;
4081
+ } else {
4082
+ this.g9_1 = this.h9_1;
4083
+ this.j9_1 = e_1;
4084
+ }
4085
+ }
4086
+ while (true);
4087
+ };
4088
+ protoOf(NodeWasmProver$prove$slambda_1).d31 = function (completion) {
4089
+ return new NodeWasmProver$prove$slambda_1(this.gca_1, this.hca_1, completion);
4090
+ };
4091
+ function NodeWasmProver$prove$slambda_2($record, $headers, resultContinuation) {
4092
+ var i = new NodeWasmProver$prove$slambda_1($record, $headers, resultContinuation);
4093
+ return constructCallableReference(function ($completion) {
4094
+ return i.xc9($completion);
4095
+ }, 0);
4096
+ }
4097
+ function NodeWasmProver$prove$lambda_0($settings, $record, $targetConnector) {
4098
+ return function (serverName, port) {
4099
+ var tmp0_elvis_lhs = $settings.kby_1;
4100
+ return recordedTargetChannel(tmp0_elvis_lhs == null ? serverName + ':' + port : tmp0_elvis_lhs, $record, VOID, $targetConnector);
4101
+ };
4102
+ }
4103
+ function NodeWasmProver$prove$lambda_1($record) {
4104
+ return function (status) {
4105
+ $record.ic9_1 = status;
4106
+ var progression = Companion_getInstance_17().lc9_1;
4107
+ var containsLower = progression.s1_1;
4108
+ var containsUpper = progression.t1_1;
4109
+ // Inline function 'kotlin.check' call
4110
+ if (!(containsLower <= status ? status <= containsUpper : false)) {
4111
+ var message = 'Steam answered HTTP ' + status;
4112
+ throw IllegalStateException_init_$Create$(toString_0(message));
4113
+ }
4114
+ return Unit_instance;
4115
+ };
4116
+ }
4117
+ function NodeWasmProver$prove$lambda_2($refused) {
4118
+ return function (code, reason) {
4119
+ $refused.q14(new SessionClosed(code, reason));
4120
+ return Unit_instance;
4121
+ };
4122
+ }
4123
+ function NodeWasmProver$prove$slambda_3($refused, $proof, $config, $host, this$0, resultContinuation) {
4124
+ this.rca_1 = $refused;
4125
+ this.sca_1 = $proof;
4126
+ this.tca_1 = $config;
4127
+ this.uca_1 = $host;
4128
+ this.vca_1 = this$0;
4129
+ CoroutineImpl.call(this, resultContinuation);
4130
+ }
4131
+ protoOf(NodeWasmProver$prove$slambda_3).xca = function ($this$coroutineScope, $completion) {
4132
+ var tmp = this.l1n($this$coroutineScope, $completion);
4133
+ tmp.i9_1 = Unit_instance;
4134
+ tmp.j9_1 = null;
4135
+ return tmp.o9();
4136
+ };
4137
+ protoOf(NodeWasmProver$prove$slambda_3).ba = function (p1, $completion) {
4138
+ return this.xca((!(p1 == null) ? isInterface(p1, CoroutineScope_0) : false) ? p1 : THROW_CCE(), $completion);
4139
+ };
4140
+ protoOf(NodeWasmProver$prove$slambda_3).o9 = function () {
4141
+ var suspendResult = this.i9_1;
4142
+ $sm: do
4143
+ try {
4144
+ var tmp = this.g9_1;
4145
+ switch (tmp) {
4146
+ case 0:
4147
+ this.h9_1 = 2;
4148
+ var proving = async(this.wca_1, VOID, VOID, NodeWasmProver$prove$slambda$slambda_0(this.sca_1, this.tca_1, this.uca_1, this.vca_1, null));
4149
+ var $this$run = new SelectImplementation(this.m9());
4150
+ var tmp_0 = proving.l11();
4151
+ $this$run.a1s(tmp_0, NodeWasmProver$prove$slambda$slambda_2(null));
4152
+ var tmp_1 = this.rca_1.l11();
4153
+ $this$run.a1s(tmp_1, NodeWasmProver$prove$slambda$slambda_4(proving, null));
4154
+ this.g9_1 = 1;
4155
+ suspendResult = $this$run.z1r(this);
4156
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
4157
+ return suspendResult;
4158
+ }
4159
+
4160
+ continue $sm;
4161
+ case 1:
4162
+ return suspendResult;
4163
+ case 2:
4164
+ throw this.j9_1;
4165
+ }
4166
+ } catch ($p) {
4167
+ var e = $p;
4168
+ if (this.h9_1 === 2) {
4169
+ throw e;
4170
+ } else {
4171
+ this.g9_1 = this.h9_1;
4172
+ this.j9_1 = e;
4173
+ }
4174
+ }
4175
+ while (true);
4176
+ };
4177
+ protoOf(NodeWasmProver$prove$slambda_3).l1n = function ($this$coroutineScope, completion) {
4178
+ var i = new NodeWasmProver$prove$slambda_3(this.rca_1, this.sca_1, this.tca_1, this.uca_1, this.vca_1, completion);
4179
+ i.wca_1 = $this$coroutineScope;
4180
+ return i;
4181
+ };
4182
+ function NodeWasmProver$prove$slambda_4($refused, $proof, $config, $host, this$0, resultContinuation) {
4183
+ var i = new NodeWasmProver$prove$slambda_3($refused, $proof, $config, $host, this$0, resultContinuation);
4184
+ return constructCallableReference(function ($this$coroutineScope, $completion) {
4185
+ return i.xca($this$coroutineScope, $completion);
4186
+ }, 1);
4187
+ }
4188
+ function NodeWasmProver$classify$lambda(it) {
4189
+ return it.cause;
4190
+ }
4191
+ function NodeWasmProver$classify$lambda_0(it) {
4192
+ return it.message;
4193
+ }
4194
+ function $proveCOROUTINE$_0(_this__u8e3s4, proof, headers, resultContinuation) {
4195
+ CoroutineImpl.call(this, resultContinuation);
4196
+ this.gcb_1 = _this__u8e3s4;
4197
+ this.hcb_1 = proof;
4198
+ this.icb_1 = headers;
4199
+ }
4200
+ protoOf($proveCOROUTINE$_0).o9 = function () {
4201
+ var suspendResult = this.i9_1;
4202
+ $sm: do
4203
+ try {
4204
+ var tmp = this.g9_1;
4205
+ switch (tmp) {
4206
+ case 0:
4207
+ this.h9_1 = 6;
4208
+ installBrowserWorker();
4209
+ var settings = this.hcb_1.wby_1;
4210
+ this.lcb_1 = new ProverSessionRecord();
4211
+ var targetConnector = nodeTcpConnector(settings.iby_1);
4212
+ var tmp_0 = this;
4213
+ var tmp_1 = NodeWasmProver$prove$lambda(settings);
4214
+ var tmp_2 = NodeWasmProver$prove$slambda_0(settings, null);
4215
+ var tmp_3 = NodeWasmProver$prove$slambda_2(this.lcb_1, this.icb_1, null);
4216
+ var tmp_4 = NodeWasmProver$prove$lambda_0(settings, this.lcb_1, targetConnector);
4217
+ tmp_0.mcb_1 = new WasmProverHost(tmp_1, tmp_2, tmp_3, tmp_4, NodeWasmProver$prove$lambda_1(this.lcb_1));
4218
+ this.ncb_1 = new TrackerConfig(VOID, VOID, VOID, VOID, VOID, new NotaryConfig(VOID, settings.gby_1, VOID, VOID, VOID, VOID, settings.hby_1, VOID, VOID, VOID, settings.jby_1));
4219
+ this.jcb_1 = get_nodeProcess().cpuUsage();
4220
+ this.ocb_1 = CompletableDeferred();
4221
+ var tmp_5 = this.lcb_1;
4222
+ tmp_5.kc9_1 = NodeWasmProver$prove$lambda_2(this.ocb_1);
4223
+ this.g9_1 = 1;
4224
+ continue $sm;
4225
+ case 1:
4226
+ this.h9_1 = 4;
4227
+ this.h9_1 = 3;
4228
+ this.g9_1 = 2;
4229
+ suspendResult = coroutineScope(NodeWasmProver$prove$slambda_4(this.ocb_1, this.hcb_1, this.ncb_1, this.mcb_1, this.gcb_1, null), this);
4230
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
4231
+ return suspendResult;
4232
+ }
4233
+
4234
+ continue $sm;
4235
+ case 2:
4236
+ this.kcb_1 = suspendResult;
4237
+ this.h9_1 = 6;
4238
+ this.g9_1 = 5;
4239
+ continue $sm;
4240
+ case 3:
4241
+ this.h9_1 = 4;
4242
+ var tmp_6 = this.j9_1;
4243
+ if (tmp_6 instanceof CancellationException) {
4244
+ var e = this.j9_1;
4245
+ var tmp_7 = this;
4246
+ throw e;
4247
+ } else {
4248
+ var tmp_8 = this.j9_1;
4249
+ if (tmp_8 instanceof Error) {
4250
+ var e_0 = this.j9_1;
4251
+ var tmp_9 = this;
4252
+ tmp_9.kcb_1 = new Failed_1(classify(this.gcb_1, e_0, this.lcb_1));
4253
+ this.h9_1 = 6;
4254
+ this.g9_1 = 5;
4255
+ continue $sm;
4256
+ } else {
4257
+ throw this.j9_1;
4258
+ }
4259
+ }
4260
+
4261
+ case 4:
4262
+ this.h9_1 = 6;
4263
+ var t = this.j9_1;
4264
+ printStats(this.gcb_1, this.jcb_1);
4265
+ throw t;
4266
+ case 5:
4267
+ var tmp_10 = this.kcb_1;
4268
+ this.h9_1 = 6;
4269
+ printStats(this.gcb_1, this.jcb_1);
4270
+ return tmp_10;
4271
+ case 6:
4272
+ throw this.j9_1;
4273
+ }
4274
+ } catch ($p) {
4275
+ var e_1 = $p;
4276
+ if (this.h9_1 === 6) {
4277
+ throw e_1;
4278
+ } else {
4279
+ this.g9_1 = this.h9_1;
4280
+ this.j9_1 = e_1;
4281
+ }
4282
+ }
4283
+ while (true);
4284
+ };
4285
+ function NodeWasmProver(clock) {
4286
+ Companion_getInstance_17();
4287
+ this.ec8_1 = clock;
4288
+ }
4289
+ protoOf(NodeWasmProver).pcb = function (proof, headers, $completion) {
4290
+ var tmp = new $proveCOROUTINE$_0(this, proof, headers, $completion);
4291
+ tmp.i9_1 = Unit_instance;
4292
+ tmp.j9_1 = null;
4293
+ return tmp.o9();
4294
+ };
4295
+ function fileUrl(path) {
4296
+ var tmp = com_dmarket_p2p_headless_node_nodeUrl_k122d7.pathToFileURL(path).href;
4297
+ return (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
4298
+ }
4299
+ function compileWasm(path, $completion) {
4300
+ var tmp = new $compileWasmCOROUTINE$(path, $completion);
4301
+ tmp.i9_1 = Unit_instance;
4302
+ tmp.j9_1 = null;
4303
+ return tmp.o9();
4304
+ }
4305
+ function $compileWasmCOROUTINE$(path, resultContinuation) {
4306
+ CoroutineImpl.call(this, resultContinuation);
4307
+ this.ycb_1 = path;
4308
+ }
4309
+ protoOf($compileWasmCOROUTINE$).o9 = function () {
4310
+ var suspendResult = this.i9_1;
4311
+ $sm: do
4312
+ try {
4313
+ var tmp = this.g9_1;
4314
+ switch (tmp) {
4315
+ case 0:
4316
+ this.h9_1 = 3;
4317
+ this.g9_1 = 1;
4318
+ var this_0 = com_dmarket_p2p_headless_node_nodeFs_vfkcsf.promises.readFile(this.ycb_1);
4319
+ suspendResult = await_0(this_0, this);
4320
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
4321
+ return suspendResult;
4322
+ }
4323
+
4324
+ continue $sm;
4325
+ case 1:
4326
+ var bytes = suspendResult;
4327
+ var webAssembly = WebAssembly;
4328
+ this.g9_1 = 2;
4329
+ var this_1 = webAssembly.compile(bytes);
4330
+ suspendResult = await_0(this_1, this);
4331
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
4332
+ return suspendResult;
4333
+ }
4334
+
4335
+ continue $sm;
4336
+ case 2:
4337
+ return suspendResult;
4338
+ case 3:
4339
+ throw this.j9_1;
4340
+ }
4341
+ } catch ($p) {
4342
+ var e = $p;
4343
+ if (this.h9_1 === 3) {
4344
+ throw e;
4345
+ } else {
4346
+ this.g9_1 = this.h9_1;
4347
+ this.j9_1 = e;
4348
+ }
4349
+ }
4350
+ while (true);
4351
+ };
4352
+ function resolveInstalled(specifier, script) {
4353
+ // Inline function 'kotlin.runCatching' call
4354
+ var tmp;
4355
+ try {
4356
+ var tmp_0;
4357
+ if (typeof require == 'function') {
4358
+ tmp_0 = require.resolve;
4359
+ } else {
4360
+ tmp_0 = com_dmarket_p2p_headless_node_nodeModule_vk8grk.createRequire(script == null ? com_dmarket_p2p_headless_node_nodePath_idbzon.join(get_nodeProcess().cwd(), 'index.js') : script).resolve;
4361
+ }
4362
+ var resolve = tmp_0;
4363
+ var tmp_1 = resolve(specifier);
4364
+ // Inline function 'kotlin.Companion.success' call
4365
+ var value = (!(tmp_1 == null) ? typeof tmp_1 === 'string' : false) ? tmp_1 : THROW_CCE();
4366
+ tmp = _Result___init__impl__xyqfz8(value);
4367
+ } catch ($p) {
4368
+ var tmp_2;
4369
+ if ($p instanceof Error) {
4370
+ var e = $p;
4371
+ // Inline function 'kotlin.Companion.failure' call
4372
+ tmp_2 = _Result___init__impl__xyqfz8(createFailure(e));
4373
+ } else {
4374
+ throw $p;
4375
+ }
4376
+ tmp = tmp_2;
4377
+ }
4378
+ // Inline function 'kotlin.Result.getOrNull' call
4379
+ var this_0 = tmp;
4380
+ return _Result___get_isFailure__impl__jpiriv(this_0) ? null : _Result___get_value__impl__bjfvqg(this_0);
4381
+ }
4382
+ function get_UNDELIBERATE_CLOSES() {
4383
+ _init_properties_ProverChannels_kt__wlcf1i();
4384
+ return UNDELIBERATE_CLOSES;
4385
+ }
4386
+ var UNDELIBERATE_CLOSES;
4387
+ function get_UNEXPECTED_RESPONSE() {
4388
+ _init_properties_ProverChannels_kt__wlcf1i();
4389
+ return UNEXPECTED_RESPONSE;
4390
+ }
4391
+ var UNEXPECTED_RESPONSE;
4392
+ function ProverSessionRecord() {
4393
+ this.cc9_1 = false;
4394
+ this.dc9_1 = false;
4395
+ this.ec9_1 = null;
4396
+ this.fc9_1 = null;
4397
+ this.gc9_1 = null;
4398
+ this.hc9_1 = null;
4399
+ this.ic9_1 = null;
4400
+ this.jc9_1 = null;
4401
+ this.kc9_1 = null;
4402
+ }
4403
+ function headerWebSocket(headers_0, record) {
4404
+ _init_properties_ProverChannels_kt__wlcf1i();
4405
+ var headerObject = {};
4406
+ // Inline function 'kotlin.collections.forEach' call
4407
+ // Inline function 'kotlin.collections.iterator' call
4408
+ var _iterator__ex2g4s = headers_0.n1().t();
4409
+ while (_iterator__ex2g4s.u()) {
4410
+ var element = _iterator__ex2g4s.v();
4411
+ // Inline function 'kotlin.collections.component1' call
4412
+ var name = element.o1();
4413
+ // Inline function 'kotlin.collections.component2' call
4414
+ var value = element.p1();
4415
+ headerObject[name] = value;
4416
+ }
4417
+ var onOpen_0 = headerWebSocket$lambda(record);
4418
+ var onError_0 = headerWebSocket$lambda_0(record);
4419
+ var onClose_0 = headerWebSocket$lambda_1(record);
4420
+ var ws = com_dmarket_p2p_headless_node_wsWebSocket_w3og61;
4421
+ var factory = function (WebSocket, headers, onOpen, onError, onClose) {
4422
+ return function HeaderWebSocket(url, protocols) {
4423
+ const offered = (Array.isArray(protocols) ? protocols : [protocols]).filter((p) => typeof p === 'string' && !p.startsWith('bearer.'));
4424
+ const socket = new WebSocket(url, offered, {headers: headers});
4425
+ socket.on('open', () => onOpen());
4426
+ socket.on('error', (error) => onError(error && error.message));
4427
+ socket.on('close', (code, reason) => onClose(code, reason ? reason.toString() : null));
4428
+ return socket;
4429
+ };
4430
+ };
4431
+ return factory(ws, headerObject, onOpen_0, onError_0, onClose_0);
4432
+ }
4433
+ function recordedTargetChannel(address, record, dialTimeoutMs, connect) {
4434
+ dialTimeoutMs = dialTimeoutMs === VOID ? 15000 : dialTimeoutMs;
4435
+ _init_properties_ProverChannels_kt__wlcf1i();
4436
+ var host_0 = substringBeforeLast(address, _Char___init__impl__6a9atx(58));
4437
+ var port_0 = toInt(substringAfterLast(address, _Char___init__impl__6a9atx(58)));
4438
+ var onError_0 = recordedTargetChannel$lambda(record);
4439
+ var open = function (dial, host, port, timeoutMs, onError) {
4440
+ return new Promise((resolve, reject) => {
4441
+ let settled = false;
4442
+ const timer = setTimeout(() => {
4443
+ settled = true;
4444
+ const error = new Error('the Steam connection timed out after ' + timeoutMs + ' ms');
4445
+ onError(error.message);
4446
+ reject(error);
4447
+ }, timeoutMs);
4448
+ dial(host, port).then((io) => {
4449
+ clearTimeout(timer);
4450
+ if (settled) {
4451
+ io.close().catch(() => {});
4452
+ return;
4453
+ }
4454
+ settled = true;
4455
+ let closed = false;
4456
+ const watch = (promise) => promise.catch((error) => {
4457
+ if (!closed)
4458
+ onError(error && error.message);
4459
+ throw error;
4460
+ });
4461
+ resolve({read: () => watch(io.read()), write: (data) => watch(io.write(data)), close: () => {
4462
+ closed = true;
4463
+ return io.close();
4464
+ }});
4465
+ }, (error) => {
4466
+ clearTimeout(timer);
4467
+ if (settled)
4468
+ return;
4469
+ settled = true;
4470
+ onError(error && error.message);
4471
+ reject(error);
4472
+ });
4473
+ });
4474
+ };
4475
+ // Inline function 'kotlin.js.unsafeCast' call
4476
+ return open(connect, host_0, port_0, dialTimeoutMs, onError_0);
4477
+ }
4478
+ function nodeTcpConnector(assetsDir) {
4479
+ _init_properties_ProverChannels_kt__wlcf1i();
4480
+ var tmp = com_dmarket_p2p_headless_node_nodeUrl_k122d7.pathToFileURL(com_dmarket_p2p_headless_node_nodePath_idbzon.join(assetsDir, 'transport', 'dist', 'node.js')).href;
4481
+ var url_0 = (!(tmp == null) ? typeof tmp === 'string' : false) ? tmp : THROW_CCE();
4482
+ var dial = function (url) {
4483
+ let loading = null;
4484
+ return (host, port) => {
4485
+ if (loading === null)
4486
+ loading = import(url);
4487
+ return loading.then((module) => module.connectTcp(host, port));
4488
+ };
4489
+ };
4490
+ // Inline function 'kotlin.js.unsafeCast' call
4491
+ return dial(url_0);
4492
+ }
4493
+ function headerWebSocket$lambda($record) {
4494
+ return function () {
4495
+ $record.dc9_1 = true;
4496
+ var tmp = get_nodeProcess().memoryUsage().rss;
4497
+ println('prover: notary connected rssMb=' + divide(numberToLong(isNumber(tmp) ? tmp : THROW_CCE()), new Long(1048576, 0)).toString());
4498
+ return Unit_instance;
4499
+ };
4500
+ }
4501
+ function headerWebSocket$lambda_0($record) {
4502
+ return function (message) {
4503
+ var tmp = get_UNEXPECTED_RESPONSE();
4504
+ // Inline function 'kotlin.text.orEmpty' call
4505
+ var tmp$ret$0 = message == null ? '' : message;
4506
+ var tmp0_safe_receiver = tmp.rd(tmp$ret$0);
4507
+ var tmp1_safe_receiver = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.oe();
4508
+ var tmp2_safe_receiver = tmp1_safe_receiver == null ? null : tmp1_safe_receiver.h1(1);
4509
+ var tmp3_safe_receiver = tmp2_safe_receiver == null ? null : toIntOrNull(tmp2_safe_receiver);
4510
+ var tmp_0;
4511
+ if (tmp3_safe_receiver == null) {
4512
+ tmp_0 = null;
4513
+ } else {
4514
+ // Inline function 'kotlin.let' call
4515
+ $record.ec9_1 = tmp3_safe_receiver;
4516
+ tmp_0 = Unit_instance;
4517
+ }
4518
+ return tmp_0;
4519
+ };
4520
+ }
4521
+ function headerWebSocket$lambda_1($record) {
4522
+ return function (code, reason) {
4523
+ var tmp;
4524
+ if ($record.dc9_1) {
4525
+ $record.fc9_1 = code;
4526
+ var tmp_0 = $record;
4527
+ var tmp_1;
4528
+ if (reason == null) {
4529
+ tmp_1 = null;
4530
+ } else {
4531
+ // Inline function 'kotlin.takeIf' call
4532
+ var tmp_2;
4533
+ // Inline function 'kotlin.text.isNotBlank' call
4534
+ if (!isBlank(reason)) {
4535
+ tmp_2 = reason;
4536
+ } else {
4537
+ tmp_2 = null;
4538
+ }
4539
+ tmp_1 = tmp_2;
4540
+ }
4541
+ tmp_0.gc9_1 = tmp_1;
4542
+ var tmp_3;
4543
+ if (!get_UNDELIBERATE_CLOSES().k1(code)) {
4544
+ var tmp1_safe_receiver = $record.kc9_1;
4545
+ if (tmp1_safe_receiver == null)
4546
+ null;
4547
+ else
4548
+ tmp1_safe_receiver(code, $record.gc9_1);
4549
+ tmp_3 = Unit_instance;
4550
+ }
4551
+ tmp = tmp_3;
4552
+ }
4553
+ return Unit_instance;
4554
+ };
4555
+ }
4556
+ function recordedTargetChannel$lambda($record) {
4557
+ return function (message) {
4558
+ var tmp;
4559
+ if ($record.hc9_1 == null) {
4560
+ var tmp_0 = $record;
4561
+ tmp_0.hc9_1 = message == null ? 'the Steam connection failed' : message;
4562
+ tmp = Unit_instance;
4563
+ }
4564
+ return Unit_instance;
4565
+ };
4566
+ }
4567
+ var properties_initialized_ProverChannels_kt_vjbqx4;
4568
+ function _init_properties_ProverChannels_kt__wlcf1i() {
4569
+ if (!properties_initialized_ProverChannels_kt_vjbqx4) {
4570
+ properties_initialized_ProverChannels_kt_vjbqx4 = true;
4571
+ UNDELIBERATE_CLOSES = setOf([1000, 1005, 1006]);
4572
+ UNEXPECTED_RESPONSE = Regex_init_$Create$('Unexpected server response: (\\d{3})');
4573
+ }
4574
+ }
4575
+ function Proved_1(presentation) {
4576
+ this.zcb_1 = presentation;
4577
+ }
4578
+ protoOf(Proved_1).toString = function () {
4579
+ return 'Proved(presentation=' + this.zcb_1 + ')';
4580
+ };
4581
+ protoOf(Proved_1).hashCode = function () {
4582
+ return getStringHashCode(this.zcb_1);
4583
+ };
4584
+ protoOf(Proved_1).equals = function (other) {
4585
+ if (this === other)
4586
+ return true;
4587
+ if (!(other instanceof Proved_1))
4588
+ return false;
4589
+ if (!(this.zcb_1 === other.zcb_1))
4590
+ return false;
4591
+ return true;
4592
+ };
4593
+ function Failed_1(failure, exitAfter) {
4594
+ exitAfter = exitAfter === VOID ? false : exitAfter;
4595
+ this.acc_1 = failure;
4596
+ this.bcc_1 = exitAfter;
4597
+ }
4598
+ protoOf(Failed_1).toString = function () {
4599
+ return 'Failed(failure=' + toString_0(this.acc_1) + ', exitAfter=' + this.bcc_1 + ')';
4600
+ };
4601
+ protoOf(Failed_1).hashCode = function () {
4602
+ var result = hashCode(this.acc_1);
4603
+ result = imul(result, 31) + getBooleanHashCode(this.bcc_1) | 0;
4604
+ return result;
4605
+ };
4606
+ protoOf(Failed_1).equals = function (other) {
4607
+ if (this === other)
4608
+ return true;
4609
+ if (!(other instanceof Failed_1))
4610
+ return false;
4611
+ if (!equals(this.acc_1, other.acc_1))
4612
+ return false;
4613
+ if (!(this.bcc_1 === other.bcc_1))
4614
+ return false;
4615
+ return true;
4616
+ };
4617
+ function runProverChild_0(prover) {
4618
+ markFirstToKill();
4619
+ var scope = CoroutineScope(SupervisorJob().gj(Dispatchers_getInstance().y18_1));
4620
+ // Inline function 'kotlin.collections.mutableMapOf' call
4621
+ var waiting = LinkedHashMap_init_$Create$();
4622
+ var process = get_nodeProcess();
4623
+ process.on('message', runProverChild$lambda(waiting, scope, prover, process));
4624
+ process.on('disconnect', runProverChild$lambda_0(process));
4625
+ }
4626
+ function send(text) {
4627
+ // Inline function 'kotlin.runCatching' call
4628
+ var tmp;
4629
+ try {
4630
+ // Inline function 'kotlin.Companion.success' call
4631
+ var value = get_nodeProcess().send(text);
4632
+ tmp = _Result___init__impl__xyqfz8(value);
4633
+ } catch ($p) {
4634
+ var tmp_0;
4635
+ if ($p instanceof Error) {
4636
+ var e = $p;
4637
+ // Inline function 'kotlin.Companion.failure' call
4638
+ tmp_0 = _Result___init__impl__xyqfz8(createFailure(e));
4639
+ } else {
4640
+ throw $p;
4641
+ }
4642
+ tmp = tmp_0;
4643
+ }
4644
+ }
4645
+ function markFirstToKill() {
4646
+ if (get_nodeProcess().platform != 'linux')
4647
+ return Unit_instance;
4648
+ // Inline function 'kotlin.runCatching' call
4649
+ var tmp;
4650
+ try {
4651
+ // Inline function 'kotlin.Companion.success' call
4652
+ var value = com_dmarket_p2p_headless_node_nodeFs_vfkcsf.writeFileSync('/proc/self/oom_score_adj', '1000');
4653
+ tmp = _Result___init__impl__xyqfz8(value);
4654
+ } catch ($p) {
4655
+ var tmp_0;
4656
+ if ($p instanceof Error) {
4657
+ var e = $p;
4658
+ // Inline function 'kotlin.Companion.failure' call
4659
+ tmp_0 = _Result___init__impl__xyqfz8(createFailure(e));
4660
+ } else {
4661
+ throw $p;
4662
+ }
4663
+ tmp = tmp_0;
4664
+ }
4665
+ }
4666
+ function runProverChild$lambda$slambda$slambda($waiting, $message, resultContinuation) {
4667
+ this.kcc_1 = $waiting;
4668
+ this.lcc_1 = $message;
4669
+ CoroutineImpl.call(this, resultContinuation);
4670
+ }
4671
+ protoOf(runProverChild$lambda$slambda$slambda).mcc = function ($completion) {
4672
+ var tmp = this.d31($completion);
4673
+ tmp.i9_1 = Unit_instance;
4674
+ tmp.j9_1 = null;
4675
+ return tmp.o9();
4676
+ };
4677
+ protoOf(runProverChild$lambda$slambda$slambda).aa = function ($completion) {
4678
+ return this.mcc($completion);
4679
+ };
4680
+ protoOf(runProverChild$lambda$slambda$slambda).o9 = function () {
4681
+ var suspendResult = this.i9_1;
4682
+ $sm: do
4683
+ try {
4684
+ var tmp = this.g9_1;
4685
+ switch (tmp) {
4686
+ case 0:
4687
+ this.h9_1 = 2;
4688
+ var reply = CompletableDeferred();
4689
+ var tmp0 = this.kcc_1;
4690
+ var key = this.lcc_1.sby_1;
4691
+ tmp0.f3(key, reply);
4692
+ send(ProverIpc_getInstance().nby(new HeadersWanted(this.lcc_1.sby_1)));
4693
+ this.g9_1 = 1;
4694
+ suspendResult = reply.k11(this);
4695
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
4696
+ return suspendResult;
4697
+ }
4698
+
4699
+ continue $sm;
4700
+ case 1:
4701
+ var answer = suspendResult;
4702
+ var tmp0_elvis_lhs = answer.bbz_1;
4703
+ var tmp_0;
4704
+ if (tmp0_elvis_lhs == null) {
4705
+ var tmp1_elvis_lhs = answer.cbz_1;
4706
+ var message = tmp1_elvis_lhs == null ? 'the SDK sent no upgrade headers' : tmp1_elvis_lhs;
4707
+ throw IllegalStateException_init_$Create$(toString_0(message));
4708
+ } else {
4709
+ tmp_0 = tmp0_elvis_lhs;
4710
+ }
4711
+
4712
+ return new NotaryUpgradeHeaders(tmp_0);
4713
+ case 2:
4714
+ throw this.j9_1;
4715
+ }
4716
+ } catch ($p) {
4717
+ var e = $p;
4718
+ if (this.h9_1 === 2) {
4719
+ throw e;
4720
+ } else {
4721
+ this.g9_1 = this.h9_1;
4722
+ this.j9_1 = e;
4723
+ }
4724
+ }
4725
+ while (true);
4726
+ };
4727
+ protoOf(runProverChild$lambda$slambda$slambda).d31 = function (completion) {
4728
+ return new runProverChild$lambda$slambda$slambda(this.kcc_1, this.lcc_1, completion);
4729
+ };
4730
+ function runProverChild$lambda$slambda$slambda_0($waiting, $message, resultContinuation) {
4731
+ var i = new runProverChild$lambda$slambda$slambda($waiting, $message, resultContinuation);
4732
+ return constructCallableReference(function ($completion) {
4733
+ return i.mcc($completion);
4734
+ }, 0);
4735
+ }
4736
+ function runProverChild$lambda$slambda$lambda($process) {
4737
+ return function () {
4738
+ return $process.exit(0);
4739
+ };
4740
+ }
4741
+ function runProverChild$lambda$slambda($prover, $message, $waiting, $process, resultContinuation) {
4742
+ this.vcc_1 = $prover;
4743
+ this.wcc_1 = $message;
4744
+ this.xcc_1 = $waiting;
4745
+ this.ycc_1 = $process;
4746
+ CoroutineImpl.call(this, resultContinuation);
4747
+ }
4748
+ protoOf(runProverChild$lambda$slambda).k1n = function ($this$launch, $completion) {
4749
+ var tmp = this.l1n($this$launch, $completion);
4750
+ tmp.i9_1 = Unit_instance;
4751
+ tmp.j9_1 = null;
4752
+ return tmp.o9();
4753
+ };
4754
+ protoOf(runProverChild$lambda$slambda).ba = function (p1, $completion) {
4755
+ return this.k1n((!(p1 == null) ? isInterface(p1, CoroutineScope_0) : false) ? p1 : THROW_CCE(), $completion);
4756
+ };
4757
+ protoOf(runProverChild$lambda$slambda).o9 = function () {
4758
+ var suspendResult = this.i9_1;
4759
+ $sm: do
4760
+ try {
4761
+ var tmp = this.g9_1;
4762
+ switch (tmp) {
4763
+ case 0:
4764
+ this.h9_1 = 4;
4765
+ var headers = runProverChild$lambda$slambda$slambda_0(this.xcc_1, this.wcc_1, null);
4766
+ this.h9_1 = 2;
4767
+ this.g9_1 = 1;
4768
+ suspendResult = this.vcc_1.pcb(this.wcc_1, headers, this);
4769
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
4770
+ return suspendResult;
4771
+ }
4772
+
4773
+ continue $sm;
4774
+ case 1:
4775
+ this.acd_1 = suspendResult;
4776
+ this.h9_1 = 4;
4777
+ this.g9_1 = 3;
4778
+ continue $sm;
4779
+ case 2:
4780
+ this.h9_1 = 4;
4781
+ var tmp_0 = this.j9_1;
4782
+ if (tmp_0 instanceof Error) {
4783
+ var e = this.j9_1;
4784
+ var tmp_1 = this;
4785
+ var tmp0_elvis_lhs = e.message;
4786
+ var tmp1_elvis_lhs = tmp0_elvis_lhs == null ? getKClassFromExpression(e).o() : tmp0_elvis_lhs;
4787
+ tmp_1.acd_1 = new Failed_1(new Other(tmp1_elvis_lhs == null ? 'the prover failed' : tmp1_elvis_lhs));
4788
+ this.g9_1 = 3;
4789
+ continue $sm;
4790
+ } else {
4791
+ throw this.j9_1;
4792
+ }
4793
+
4794
+ case 3:
4795
+ this.h9_1 = 4;
4796
+ var result = this.acd_1;
4797
+ var tmp_2 = ProverIpc_getInstance();
4798
+ var tmp_3;
4799
+ if (result instanceof Proved_1) {
4800
+ tmp_3 = new Proved_0(this.wcc_1.sby_1, result.zcb_1);
4801
+ } else {
4802
+ if (result instanceof Failed_1) {
4803
+ tmp_3 = new Failed_0(this.wcc_1.sby_1, result.acc_1);
4804
+ } else {
4805
+ noWhenBranchMatchedException();
4806
+ }
4807
+ }
4808
+
4809
+ send(tmp_2.nby(tmp_3));
4810
+ var tmp_4;
4811
+ if (result instanceof Failed_1) {
4812
+ tmp_4 = result.bcc_1;
4813
+ } else {
4814
+ tmp_4 = false;
4815
+ }
4816
+
4817
+ if (tmp_4) {
4818
+ var tmp_5 = setTimeout;
4819
+ tmp_5(runProverChild$lambda$slambda$lambda(this.ycc_1), 200);
4820
+ }
4821
+
4822
+ return Unit_instance;
4823
+ case 4:
4824
+ throw this.j9_1;
4825
+ }
4826
+ } catch ($p) {
4827
+ var e_0 = $p;
4828
+ if (this.h9_1 === 4) {
4829
+ throw e_0;
4830
+ } else {
4831
+ this.g9_1 = this.h9_1;
4832
+ this.j9_1 = e_0;
4833
+ }
4834
+ }
4835
+ while (true);
4836
+ };
4837
+ protoOf(runProverChild$lambda$slambda).l1n = function ($this$launch, completion) {
4838
+ var i = new runProverChild$lambda$slambda(this.vcc_1, this.wcc_1, this.xcc_1, this.ycc_1, completion);
4839
+ i.zcc_1 = $this$launch;
4840
+ return i;
4841
+ };
4842
+ function runProverChild$lambda$slambda_0($prover, $message, $waiting, $process, resultContinuation) {
4843
+ var i = new runProverChild$lambda$slambda($prover, $message, $waiting, $process, resultContinuation);
4844
+ return constructCallableReference(function ($this$launch, $completion) {
4845
+ return i.k1n($this$launch, $completion);
4846
+ }, 1);
4847
+ }
4848
+ function runProverChild$lambda($waiting, $scope, $prover, $process) {
4849
+ return function (raw) {
4850
+ var tmp;
4851
+ if (!(typeof raw === 'string')) {
4852
+ return Unit_instance;
4853
+ }
4854
+ // Inline function 'kotlin.runCatching' call
4855
+ var tmp_0;
4856
+ try {
4857
+ var tmp_1 = ProverIpc_getInstance();
4858
+ // Inline function 'kotlin.js.unsafeCast' call
4859
+ // Inline function 'kotlin.Companion.success' call
4860
+ var value = tmp_1.oby(raw);
4861
+ tmp_0 = _Result___init__impl__xyqfz8(value);
4862
+ } catch ($p) {
4863
+ var tmp_2;
4864
+ if ($p instanceof Error) {
4865
+ var e = $p;
4866
+ // Inline function 'kotlin.Companion.failure' call
4867
+ tmp_2 = _Result___init__impl__xyqfz8(createFailure(e));
4868
+ } else {
4869
+ throw $p;
4870
+ }
4871
+ tmp_0 = tmp_2;
4872
+ }
4873
+ // Inline function 'kotlin.Result.getOrNull' call
4874
+ var this_0 = tmp_0;
4875
+ var message = _Result___get_isFailure__impl__jpiriv(this_0) ? null : _Result___get_value__impl__bjfvqg(this_0);
4876
+ if (message instanceof Headers) {
4877
+ var tmp0_safe_receiver = $waiting.g3(message.abz_1);
4878
+ if (tmp0_safe_receiver == null)
4879
+ null;
4880
+ else
4881
+ tmp0_safe_receiver.q14(message);
4882
+ } else {
4883
+ if (message instanceof Prove) {
4884
+ launch($scope, VOID, VOID, runProverChild$lambda$slambda_0($prover, message, $waiting, $process, null));
4885
+ } else {
4886
+ if (message != null) {
4887
+ noWhenBranchMatchedException();
4888
+ }
4889
+ }
4890
+ }
4891
+ return Unit_instance;
4892
+ };
4893
+ }
4894
+ function runProverChild$lambda_0($process) {
4895
+ return function () {
4896
+ return $process.exit(0);
4897
+ };
4898
+ }
4899
+ //region block: post-declaration
4900
+ protoOf($serializer).r2j = typeParametersSerializers;
4901
+ protoOf($serializer_0).r2j = typeParametersSerializers;
4902
+ protoOf($serializer_1).r2j = typeParametersSerializers;
4903
+ protoOf($serializer_2).r2j = typeParametersSerializers;
4904
+ protoOf($serializer_3).r2j = typeParametersSerializers;
4905
+ protoOf($serializer_4).r2j = typeParametersSerializers;
4906
+ //endregion
4907
+ //region block: init
4908
+ Companion_instance_3 = new Companion_0();
4909
+ Companion_instance_4 = new Companion_1();
4910
+ Companion_instance_6 = new Companion_3();
4911
+ Companion_instance_7 = new Companion_4();
4912
+ Companion_instance_8 = new Companion_5();
4913
+ Companion_instance_10 = new Companion_7();
4914
+ Companion_instance_12 = new Companion_9();
4915
+ Companion_instance_16 = new Companion_13();
4916
+ //endregion
4917
+ //region block: exports
4918
+ export {
4919
+ runProverChild as runProverChild,
4920
+ headlessVersion as headlessVersion,
4921
+ createHeadlessTracker as createHeadlessTracker,
4922
+ start as start,
4923
+ cycle as cycle,
4924
+ stop as stop,
4925
+ pushTradingApiKey as pushTradingApiKey,
4926
+ pushSteamToken as pushSteamToken,
4927
+ trackerState as trackerState,
4928
+ reasons as reasons,
4929
+ failedCancelKinds as failedCancelKinds,
4930
+ directiveActions as directiveActions,
4931
+ steamNotLinkedCode as steamNotLinkedCode,
4932
+ minWriteTokenLifetimeMs as minWriteTokenLifetimeMs,
4933
+ maxClockSkewMs as maxClockSkewMs,
4934
+ defaultNotaryUrl as defaultNotaryUrl,
4935
+ defaultBaseUrl as defaultBaseUrl,
4936
+ };
4937
+ //endregion
4938
+
4939
+ //# sourceMappingURL=p2p-tracker-headless.mjs.map