@doordeck/doordeck-headless-sdk 0.28.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 (71) hide show
  1. package/README.md +2 -0
  2. package/kotlin/Kotlin-DateTime-library-kotlinx-datetime.js +5545 -0
  3. package/kotlin/Kotlin-DateTime-library-kotlinx-datetime.js.map +1 -0
  4. package/kotlin/KotlinMultiplatformLibsodium-multiplatform-crypto-libsodium-bindings.js +255 -0
  5. package/kotlin/KotlinMultiplatformLibsodium-multiplatform-crypto-libsodium-bindings.js.map +1 -0
  6. package/kotlin/MultiplatformSettings-multiplatform-settings.js +41 -0
  7. package/kotlin/MultiplatformSettings-multiplatform-settings.js.map +1 -0
  8. package/kotlin/Stately-stately-concurrency.js +32 -0
  9. package/kotlin/Stately-stately-concurrency.js.map +1 -0
  10. package/kotlin/Stately-stately-concurrent-collections.js +304 -0
  11. package/kotlin/Stately-stately-concurrent-collections.js.map +1 -0
  12. package/kotlin/Stately-stately-strict.js +12 -0
  13. package/kotlin/Stately-stately-strict.js.map +1 -0
  14. package/kotlin/doordeck-sdk.d.ts +1325 -0
  15. package/kotlin/doordeck-sdk.js +33503 -0
  16. package/kotlin/doordeck-sdk.js.map +1 -0
  17. package/kotlin/kotlin-kotlin-stdlib.js +14474 -0
  18. package/kotlin/kotlin-kotlin-stdlib.js.map +1 -0
  19. package/kotlin/kotlin-kotlinx-atomicfu-runtime.js +8 -0
  20. package/kotlin/kotlin-kotlinx-atomicfu-runtime.js.map +1 -0
  21. package/kotlin/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.js +8 -0
  22. package/kotlin/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.js.map +1 -0
  23. package/kotlin/kotlinx-atomicfu.js +249 -0
  24. package/kotlin/kotlinx-atomicfu.js.map +1 -0
  25. package/kotlin/kotlinx-coroutines-core.js +8784 -0
  26. package/kotlin/kotlinx-coroutines-core.js.map +1 -0
  27. package/kotlin/kotlinx-io-kotlinx-io-bytestring.js +8 -0
  28. package/kotlin/kotlinx-io-kotlinx-io-bytestring.js.map +1 -0
  29. package/kotlin/kotlinx-io-kotlinx-io-core.js +1333 -0
  30. package/kotlin/kotlinx-io-kotlinx-io-core.js.map +1 -0
  31. package/kotlin/kotlinx-serialization-kotlinx-serialization-core.js +5908 -0
  32. package/kotlin/kotlinx-serialization-kotlinx-serialization-core.js.map +1 -0
  33. package/kotlin/kotlinx-serialization-kotlinx-serialization-json.js +4740 -0
  34. package/kotlin/kotlinx-serialization-kotlinx-serialization-json.js.map +1 -0
  35. package/kotlin/ktor-ktor-client-ktor-client-core.js +8407 -0
  36. package/kotlin/ktor-ktor-client-ktor-client-core.js.map +1 -0
  37. package/kotlin/ktor-ktor-client-ktor-client-js.js +8 -0
  38. package/kotlin/ktor-ktor-client-ktor-client-js.js.map +1 -0
  39. package/kotlin/ktor-ktor-client-ktor-client-plugins-ktor-client-auth.js +1146 -0
  40. package/kotlin/ktor-ktor-client-ktor-client-plugins-ktor-client-auth.js.map +1 -0
  41. package/kotlin/ktor-ktor-client-ktor-client-plugins-ktor-client-content-negotiation.js +647 -0
  42. package/kotlin/ktor-ktor-client-ktor-client-plugins-ktor-client-content-negotiation.js.map +1 -0
  43. package/kotlin/ktor-ktor-client-ktor-client-plugins-ktor-client-encoding.js +8 -0
  44. package/kotlin/ktor-ktor-client-ktor-client-plugins-ktor-client-encoding.js.map +1 -0
  45. package/kotlin/ktor-ktor-client-ktor-client-plugins-ktor-client-logging.js +8 -0
  46. package/kotlin/ktor-ktor-client-ktor-client-plugins-ktor-client-logging.js.map +1 -0
  47. package/kotlin/ktor-ktor-http.js +3638 -0
  48. package/kotlin/ktor-ktor-http.js.map +1 -0
  49. package/kotlin/ktor-ktor-io.js +2249 -0
  50. package/kotlin/ktor-ktor-io.js.map +1 -0
  51. package/kotlin/ktor-ktor-shared-ktor-events.js +84 -0
  52. package/kotlin/ktor-ktor-shared-ktor-events.js.map +1 -0
  53. package/kotlin/ktor-ktor-shared-ktor-serialization-ktor-serialization-kotlinx-ktor-serialization-kotlinx-json.js +47 -0
  54. package/kotlin/ktor-ktor-shared-ktor-serialization-ktor-serialization-kotlinx-ktor-serialization-kotlinx-json.js.map +1 -0
  55. package/kotlin/ktor-ktor-shared-ktor-serialization-ktor-serialization-kotlinx.js +857 -0
  56. package/kotlin/ktor-ktor-shared-ktor-serialization-ktor-serialization-kotlinx.js.map +1 -0
  57. package/kotlin/ktor-ktor-shared-ktor-serialization.js +365 -0
  58. package/kotlin/ktor-ktor-shared-ktor-serialization.js.map +1 -0
  59. package/kotlin/ktor-ktor-shared-ktor-sse.js +8 -0
  60. package/kotlin/ktor-ktor-shared-ktor-sse.js.map +1 -0
  61. package/kotlin/ktor-ktor-shared-ktor-websocket-serialization.js +8 -0
  62. package/kotlin/ktor-ktor-shared-ktor-websocket-serialization.js.map +1 -0
  63. package/kotlin/ktor-ktor-shared-ktor-websockets.js +424 -0
  64. package/kotlin/ktor-ktor-shared-ktor-websockets.js.map +1 -0
  65. package/kotlin/ktor-ktor-utils.js +2393 -0
  66. package/kotlin/ktor-ktor-utils.js.map +1 -0
  67. package/kotlin/projects-core-koin-core.js +1134 -0
  68. package/kotlin/projects-core-koin-core.js.map +1 -0
  69. package/kotlin/uuid.js +152 -0
  70. package/kotlin/uuid.js.map +1 -0
  71. package/package.json +42 -0
@@ -0,0 +1,1146 @@
1
+ (function (_, kotlin_kotlin, kotlin_org_jetbrains_kotlinx_atomicfu, kotlin_io_ktor_ktor_utils, kotlin_io_ktor_ktor_client_core, kotlin_io_ktor_ktor_http, kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core) {
2
+ 'use strict';
3
+ //region block: imports
4
+ var ArrayList_init_$Create$ = kotlin_kotlin.$_$.n;
5
+ var protoOf = kotlin_kotlin.$_$.rb;
6
+ var initMetadataForClass = kotlin_kotlin.$_$.ra;
7
+ var atomic$int$1 = kotlin_org_jetbrains_kotlinx_atomicfu.$_$.e;
8
+ var toList = kotlin_kotlin.$_$.t8;
9
+ var ConcurrentMap = kotlin_io_ktor_ktor_utils.$_$.d;
10
+ var KtMutableMap = kotlin_kotlin.$_$.x5;
11
+ var getKClass = kotlin_kotlin.$_$.e;
12
+ var toString = kotlin_kotlin.$_$.vb;
13
+ var AttributeKey = kotlin_io_ktor_ktor_utils.$_$.o;
14
+ var Send_instance = kotlin_io_ktor_ktor_client_core.$_$.b;
15
+ var Unit_instance = kotlin_kotlin.$_$.k5;
16
+ var HttpHeaders_getInstance = kotlin_io_ktor_ktor_http.$_$.e;
17
+ var collectionSizeOrDefault = kotlin_kotlin.$_$.i6;
18
+ var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.m;
19
+ var parseAuthorizationHeaders = kotlin_io_ktor_ktor_http.$_$.k;
20
+ var flatten = kotlin_kotlin.$_$.j7;
21
+ var emptyList = kotlin_kotlin.$_$.b7;
22
+ var to = kotlin_kotlin.$_$.gg;
23
+ var first = kotlin_kotlin.$_$.i7;
24
+ var LinkedHashMap_init_$Create$ = kotlin_kotlin.$_$.w;
25
+ var CoroutineImpl = kotlin_kotlin.$_$.u9;
26
+ var THROW_CCE = kotlin_kotlin.$_$.ef;
27
+ var OnRequestContext = kotlin_io_ktor_ktor_client_core.$_$.e;
28
+ var HttpRequestBuilder = kotlin_io_ktor_ktor_client_core.$_$.o;
29
+ var VOID = kotlin_kotlin.$_$.f;
30
+ var get_COROUTINE_SUSPENDED = kotlin_kotlin.$_$.e9;
31
+ var initMetadataForLambda = kotlin_kotlin.$_$.wa;
32
+ var Sender = kotlin_io_ktor_ktor_client_core.$_$.f;
33
+ var Companion_getInstance = kotlin_io_ktor_ktor_http.$_$.h;
34
+ var HashSet_init_$Create$ = kotlin_kotlin.$_$.u;
35
+ var initMetadataForCoroutine = kotlin_kotlin.$_$.ta;
36
+ var KtorSimpleLogger = kotlin_io_ktor_ktor_utils.$_$.h;
37
+ var Unit = kotlin_kotlin.$_$.pf;
38
+ var createClientPlugin = kotlin_io_ktor_ktor_client_core.$_$.i;
39
+ var KtList = kotlin_kotlin.$_$.s5;
40
+ var initMetadataForInterface = kotlin_kotlin.$_$.va;
41
+ var CompletableDeferred = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.r;
42
+ var throwUninitializedPropertyAccessException = kotlin_kotlin.$_$.eg;
43
+ var CompletableDeferred_0 = kotlin_org_jetbrains_kotlinx_kotlinx_coroutines_core.$_$.q;
44
+ var atomic$ref$1 = kotlin_org_jetbrains_kotlinx_atomicfu.$_$.d;
45
+ var headers = kotlin_io_ktor_ktor_client_core.$_$.q;
46
+ var IllegalStateException_init_$Create$ = kotlin_kotlin.$_$.y1;
47
+ var Parameterized = kotlin_io_ktor_ktor_http.$_$.j;
48
+ //endregion
49
+ //region block: pre-declaration
50
+ initMetadataForClass(AuthConfig, 'AuthConfig', AuthConfig);
51
+ initMetadataForClass(AtomicCounter, 'AtomicCounter', AtomicCounter);
52
+ initMetadataForLambda(Auth$lambda$slambda, CoroutineImpl, VOID, [3]);
53
+ initMetadataForLambda(Auth$lambda$slambda_1, CoroutineImpl, VOID, [2]);
54
+ initMetadataForCoroutine($invoke$refreshTokenIfNeededCOROUTINE$0, CoroutineImpl);
55
+ initMetadataForCoroutine($invoke$executeWithNewTokenCOROUTINE$1, CoroutineImpl);
56
+ function sendWithoutRequest(request) {
57
+ return this.u3f();
58
+ }
59
+ function addRequestHeaders$default(request, authHeader, $completion, $super) {
60
+ authHeader = authHeader === VOID ? null : authHeader;
61
+ return $super === VOID ? this.t3f(request, authHeader, $completion) : $super.t3f.call(this, request, authHeader, $completion);
62
+ }
63
+ function refreshToken(response, $completion) {
64
+ return true;
65
+ }
66
+ initMetadataForInterface(AuthProvider, 'AuthProvider', VOID, VOID, VOID, [2, 1]);
67
+ initMetadataForCoroutine($loadTokenCOROUTINE$2, CoroutineImpl);
68
+ initMetadataForCoroutine($setTokenCOROUTINE$3, CoroutineImpl);
69
+ initMetadataForClass(AuthTokenHolder, 'AuthTokenHolder', VOID, VOID, VOID, [0, 1]);
70
+ initMetadataForLambda(BearerAuthConfig$_refreshTokens$slambda, CoroutineImpl, VOID, [1]);
71
+ initMetadataForLambda(BearerAuthConfig$_loadTokens$slambda, CoroutineImpl, VOID, [0]);
72
+ initMetadataForClass(BearerAuthConfig, 'BearerAuthConfig', BearerAuthConfig);
73
+ initMetadataForClass(RefreshTokensParams, 'RefreshTokensParams');
74
+ initMetadataForClass(BearerTokens, 'BearerTokens');
75
+ initMetadataForLambda(BearerAuthProvider$refreshToken$slambda, CoroutineImpl, VOID, [0]);
76
+ initMetadataForCoroutine($addRequestHeadersCOROUTINE$4, CoroutineImpl);
77
+ initMetadataForCoroutine($refreshTokenCOROUTINE$5, CoroutineImpl);
78
+ initMetadataForClass(BearerAuthProvider, 'BearerAuthProvider', VOID, VOID, [AuthProvider], [2, 1]);
79
+ //endregion
80
+ function get_LOGGER() {
81
+ _init_properties_Auth_kt__9ob1dk();
82
+ return LOGGER;
83
+ }
84
+ var LOGGER;
85
+ function get_AuthCircuitBreaker() {
86
+ _init_properties_Auth_kt__9ob1dk();
87
+ return AuthCircuitBreaker;
88
+ }
89
+ var AuthCircuitBreaker;
90
+ function get_Auth() {
91
+ _init_properties_Auth_kt__9ob1dk();
92
+ return Auth;
93
+ }
94
+ var Auth;
95
+ function get_AuthProvidersKey() {
96
+ _init_properties_Auth_kt__9ob1dk();
97
+ return AuthProvidersKey;
98
+ }
99
+ var AuthProvidersKey;
100
+ function AuthConfig() {
101
+ var tmp = this;
102
+ // Inline function 'kotlin.collections.mutableListOf' call
103
+ tmp.v3c_1 = ArrayList_init_$Create$();
104
+ }
105
+ function AtomicCounter() {
106
+ this.w3c_1 = atomic$int$1(0);
107
+ }
108
+ function AuthConfig$_init_$ref_ms3pb9() {
109
+ var l = function () {
110
+ return new AuthConfig();
111
+ };
112
+ l.callableName = '<init>';
113
+ return l;
114
+ }
115
+ function Auth$lambda($this$createClientPlugin) {
116
+ _init_properties_Auth_kt__9ob1dk();
117
+ var providers = toList($this$createClientPlugin.f2g_1.v3c_1);
118
+ $this$createClientPlugin.e2g_1.v25_1.t1j(get_AuthProvidersKey(), providers);
119
+ var tokenVersions = new ConcurrentMap();
120
+ // Inline function 'io.ktor.util.AttributeKey' call
121
+ var name = 'ProviderVersionAttributeKey';
122
+ var tokenVersionsAttributeKey = new AttributeKey(name, toString(getKClass(KtMutableMap)));
123
+ $this$createClientPlugin.f2y(Auth$lambda$slambda_0(providers, tokenVersions, tokenVersionsAttributeKey, null));
124
+ var tmp = Send_instance;
125
+ $this$createClientPlugin.i2g(tmp, Auth$lambda$slambda_2(providers, tokenVersions, tokenVersionsAttributeKey, null));
126
+ return Unit_instance;
127
+ }
128
+ function invoke$findProvider(call, candidateProviders) {
129
+ var headerValues = call.s26().s1v().d1l(HttpHeaders_getInstance().r1u_1);
130
+ var tmp;
131
+ if (headerValues == null) {
132
+ tmp = null;
133
+ } else {
134
+ // Inline function 'kotlin.collections.map' call
135
+ // Inline function 'kotlin.collections.mapTo' call
136
+ var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(headerValues, 10));
137
+ var tmp0_iterator = headerValues.j();
138
+ while (tmp0_iterator.k()) {
139
+ var item = tmp0_iterator.l();
140
+ // Inline function 'io.ktor.client.plugins.auth.Auth$lambda.invoke.findProvider.<anonymous>' call
141
+ var tmp$ret$0 = parseAuthorizationHeaders(item);
142
+ destination.e(tmp$ret$0);
143
+ }
144
+ tmp = destination;
145
+ }
146
+ var tmp1_safe_receiver = tmp;
147
+ var tmp0_elvis_lhs = tmp1_safe_receiver == null ? null : flatten(tmp1_safe_receiver);
148
+ var authHeaders = tmp0_elvis_lhs == null ? emptyList() : tmp0_elvis_lhs;
149
+ var tmp_0;
150
+ if (authHeaders.p() && candidateProviders.m() === 1) {
151
+ tmp_0 = to(first(candidateProviders), null);
152
+ } else if (authHeaders.p()) {
153
+ get_LOGGER().n1p('401 response ' + call.c2a().f2a().toString() + ' has no or empty "WWW-Authenticate" header. ' + 'Can not add or refresh token');
154
+ tmp_0 = null;
155
+ } else {
156
+ var tmp$ret$9;
157
+ $l$block_0: {
158
+ // Inline function 'kotlin.collections.firstNotNullOfOrNull' call
159
+ var tmp0_iterator_0 = authHeaders.j();
160
+ while (tmp0_iterator_0.k()) {
161
+ var element = tmp0_iterator_0.l();
162
+ // Inline function 'io.ktor.client.plugins.auth.Auth$lambda.invoke.findProvider.<anonymous>' call
163
+ // Inline function 'kotlin.collections.find' call
164
+ var tmp$ret$4;
165
+ $l$block: {
166
+ // Inline function 'kotlin.collections.firstOrNull' call
167
+ var tmp0_iterator_1 = candidateProviders.j();
168
+ while (tmp0_iterator_1.k()) {
169
+ var element_0 = tmp0_iterator_1.l();
170
+ // Inline function 'io.ktor.client.plugins.auth.Auth$lambda.invoke.findProvider.<anonymous>.<anonymous>' call
171
+ if (element_0.x3c(element)) {
172
+ tmp$ret$4 = element_0;
173
+ break $l$block;
174
+ }
175
+ }
176
+ tmp$ret$4 = null;
177
+ }
178
+ var tmp2_safe_receiver = tmp$ret$4;
179
+ var tmp_1;
180
+ if (tmp2_safe_receiver == null) {
181
+ tmp_1 = null;
182
+ } else {
183
+ // Inline function 'kotlin.let' call
184
+ // Inline function 'kotlin.contracts.contract' call
185
+ // Inline function 'io.ktor.client.plugins.auth.Auth$lambda.invoke.findProvider.<anonymous>.<anonymous>' call
186
+ tmp_1 = to(tmp2_safe_receiver, element);
187
+ }
188
+ var result = tmp_1;
189
+ if (!(result == null)) {
190
+ tmp$ret$9 = result;
191
+ break $l$block_0;
192
+ }
193
+ }
194
+ tmp$ret$9 = null;
195
+ }
196
+ tmp_0 = tmp$ret$9;
197
+ }
198
+ return tmp_0;
199
+ }
200
+ function invoke$refreshTokenIfNeeded(tokenVersions, tokenVersionsAttributeKey, call, provider, request, $completion) {
201
+ var tmp = new $invoke$refreshTokenIfNeededCOROUTINE$0(tokenVersions, tokenVersionsAttributeKey, call, provider, request, $completion);
202
+ tmp.c9_1 = Unit_instance;
203
+ tmp.d9_1 = null;
204
+ return tmp.i9();
205
+ }
206
+ function invoke$executeWithNewToken(_this__u8e3s4, call, provider, oldRequest, authHeader, $completion) {
207
+ var tmp = new $invoke$executeWithNewTokenCOROUTINE$1(_this__u8e3s4, call, provider, oldRequest, authHeader, $completion);
208
+ tmp.c9_1 = Unit_instance;
209
+ tmp.d9_1 = null;
210
+ return tmp.i9();
211
+ }
212
+ function Auth$lambda$slambda$lambda() {
213
+ return new AtomicCounter();
214
+ }
215
+ function Auth$lambda$slambda$lambda_0() {
216
+ // Inline function 'kotlin.collections.mutableMapOf' call
217
+ return LinkedHashMap_init_$Create$();
218
+ }
219
+ function Auth$lambda$slambda($providers, $tokenVersions, $tokenVersionsAttributeKey, resultContinuation) {
220
+ this.k3e_1 = $providers;
221
+ this.l3e_1 = $tokenVersions;
222
+ this.m3e_1 = $tokenVersionsAttributeKey;
223
+ CoroutineImpl.call(this, resultContinuation);
224
+ }
225
+ protoOf(Auth$lambda$slambda).s2y = function ($this$onRequest, request, _unused_var__etf5q3, $completion) {
226
+ var tmp = this.t2y($this$onRequest, request, _unused_var__etf5q3, $completion);
227
+ tmp.c9_1 = Unit_instance;
228
+ tmp.d9_1 = null;
229
+ return tmp.i9();
230
+ };
231
+ protoOf(Auth$lambda$slambda).u2y = function (p1, p2, p3, $completion) {
232
+ var tmp = p1 instanceof OnRequestContext ? p1 : THROW_CCE();
233
+ var tmp_0 = p2 instanceof HttpRequestBuilder ? p2 : THROW_CCE();
234
+ return this.s2y(tmp, tmp_0, !(p3 == null) ? p3 : THROW_CCE(), $completion);
235
+ };
236
+ protoOf(Auth$lambda$slambda).i9 = function () {
237
+ var suspendResult = this.c9_1;
238
+ $sm: do
239
+ try {
240
+ var tmp = this.a9_1;
241
+ switch (tmp) {
242
+ case 0:
243
+ this.b9_1 = 4;
244
+ var tmp_0 = this;
245
+ var this_0 = this.k3e_1;
246
+ var destination = ArrayList_init_$Create$();
247
+ var tmp0_iterator = this_0.j();
248
+ while (tmp0_iterator.k()) {
249
+ var element = tmp0_iterator.l();
250
+ if (element.w3e(this.o3e_1)) {
251
+ destination.e(element);
252
+ }
253
+ }
254
+
255
+ tmp_0.q3e_1 = destination;
256
+ this.r3e_1 = this.q3e_1.j();
257
+ this.a9_1 = 1;
258
+ continue $sm;
259
+ case 1:
260
+ if (!this.r3e_1.k()) {
261
+ this.a9_1 = 3;
262
+ continue $sm;
263
+ }
264
+
265
+ this.s3e_1 = this.r3e_1.l();
266
+ var tmp_1 = this;
267
+ tmp_1.t3e_1 = this.s3e_1;
268
+ get_LOGGER().n1p('Adding auth headers for ' + this.o3e_1.s27_1.toString() + ' from provider ' + toString(this.t3e_1));
269
+ var tmp_2 = this;
270
+ tmp_2.u3e_1 = this.l3e_1.f1p(this.t3e_1, Auth$lambda$slambda$lambda);
271
+ var tmp_3 = this;
272
+ tmp_3.v3e_1 = this.o3e_1.x27_1.v1j(this.m3e_1, Auth$lambda$slambda$lambda_0);
273
+ var this_1 = this.v3e_1;
274
+ var key = this.t3e_1;
275
+ var value = this.u3e_1.w3c_1.kotlinx$atomicfu$value;
276
+ this_1.i2(key, value);
277
+ this.a9_1 = 2;
278
+ suspendResult = this.t3e_1.x3e(this.o3e_1, VOID, this);
279
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
280
+ return suspendResult;
281
+ }
282
+
283
+ continue $sm;
284
+ case 2:
285
+ this.a9_1 = 1;
286
+ continue $sm;
287
+ case 3:
288
+ return Unit_instance;
289
+ case 4:
290
+ throw this.d9_1;
291
+ }
292
+ } catch ($p) {
293
+ var e = $p;
294
+ if (this.b9_1 === 4) {
295
+ throw e;
296
+ } else {
297
+ this.a9_1 = this.b9_1;
298
+ this.d9_1 = e;
299
+ }
300
+ }
301
+ while (true);
302
+ };
303
+ protoOf(Auth$lambda$slambda).t2y = function ($this$onRequest, request, _unused_var__etf5q3, completion) {
304
+ var i = new Auth$lambda$slambda(this.k3e_1, this.l3e_1, this.m3e_1, completion);
305
+ i.n3e_1 = $this$onRequest;
306
+ i.o3e_1 = request;
307
+ i.p3e_1 = _unused_var__etf5q3;
308
+ return i;
309
+ };
310
+ function Auth$lambda$slambda_0($providers, $tokenVersions, $tokenVersionsAttributeKey, resultContinuation) {
311
+ var i = new Auth$lambda$slambda($providers, $tokenVersions, $tokenVersionsAttributeKey, resultContinuation);
312
+ var l = function ($this$onRequest, request, _unused_var__etf5q3, $completion) {
313
+ return i.s2y($this$onRequest, request, _unused_var__etf5q3, $completion);
314
+ };
315
+ l.$arity = 3;
316
+ return l;
317
+ }
318
+ function Auth$lambda$slambda_1($providers, $tokenVersions, $tokenVersionsAttributeKey, resultContinuation) {
319
+ this.g3f_1 = $providers;
320
+ this.h3f_1 = $tokenVersions;
321
+ this.i3f_1 = $tokenVersionsAttributeKey;
322
+ CoroutineImpl.call(this, resultContinuation);
323
+ }
324
+ protoOf(Auth$lambda$slambda_1).z2o = function ($this$on, originalRequest, $completion) {
325
+ var tmp = this.a2p($this$on, originalRequest, $completion);
326
+ tmp.c9_1 = Unit_instance;
327
+ tmp.d9_1 = null;
328
+ return tmp.i9();
329
+ };
330
+ protoOf(Auth$lambda$slambda_1).t9 = function (p1, p2, $completion) {
331
+ var tmp = p1 instanceof Sender ? p1 : THROW_CCE();
332
+ return this.z2o(tmp, p2 instanceof HttpRequestBuilder ? p2 : THROW_CCE(), $completion);
333
+ };
334
+ protoOf(Auth$lambda$slambda_1).i9 = function () {
335
+ var suspendResult = this.c9_1;
336
+ $sm: do
337
+ try {
338
+ var tmp = this.a9_1;
339
+ switch (tmp) {
340
+ case 0:
341
+ this.b9_1 = 7;
342
+ this.a9_1 = 1;
343
+ suspendResult = this.j3f_1.d2p(this.k3f_1, this);
344
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
345
+ return suspendResult;
346
+ }
347
+
348
+ continue $sm;
349
+ case 1:
350
+ this.l3f_1 = suspendResult;
351
+ if (!this.l3f_1.s26().g2a().equals(Companion_getInstance().f1x_1))
352
+ return this.l3f_1;
353
+ if (this.l3f_1.c2a().h29().s1j(get_AuthCircuitBreaker()))
354
+ return this.l3f_1;
355
+ this.m3f_1 = this.l3f_1;
356
+ this.n3f_1 = HashSet_init_$Create$(this.g3f_1);
357
+ this.a9_1 = 2;
358
+ continue $sm;
359
+ case 2:
360
+ if (!this.m3f_1.s26().g2a().equals(Companion_getInstance().f1x_1)) {
361
+ this.a9_1 = 6;
362
+ continue $sm;
363
+ }
364
+
365
+ get_LOGGER().n1p('Received 401 for ' + this.m3f_1.c2a().f2a().toString());
366
+ var tmp_0 = this;
367
+ var tmp0_elvis_lhs = invoke$findProvider(this.m3f_1, this.n3f_1);
368
+ var tmp_1;
369
+ if (tmp0_elvis_lhs == null) {
370
+ this.j3f_1;
371
+ get_LOGGER().n1p('Can not find auth provider for ' + this.m3f_1.c2a().f2a().toString());
372
+ return this.m3f_1;
373
+ } else {
374
+ tmp_1 = tmp0_elvis_lhs;
375
+ }
376
+
377
+ tmp_0.o3f_1 = tmp_1;
378
+ this.p3f_1 = this.o3f_1.eg();
379
+ this.q3f_1 = this.o3f_1.fg();
380
+ get_LOGGER().n1p('Using provider ' + toString(this.p3f_1) + ' for ' + this.m3f_1.c2a().f2a().toString());
381
+ this.n3f_1.y1(this.p3f_1);
382
+ this.a9_1 = 3;
383
+ suspendResult = invoke$refreshTokenIfNeeded(this.h3f_1, this.i3f_1, this.m3f_1, this.p3f_1, this.k3f_1, this);
384
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
385
+ return suspendResult;
386
+ }
387
+
388
+ continue $sm;
389
+ case 3:
390
+ this.r3f_1 = suspendResult;
391
+ if (!this.r3f_1) {
392
+ return this.m3f_1;
393
+ } else {
394
+ this.a9_1 = 4;
395
+ continue $sm;
396
+ }
397
+
398
+ case 4:
399
+ this.a9_1 = 5;
400
+ suspendResult = invoke$executeWithNewToken(this.j3f_1, this.m3f_1, this.p3f_1, this.k3f_1, this.q3f_1, this);
401
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
402
+ return suspendResult;
403
+ }
404
+
405
+ continue $sm;
406
+ case 5:
407
+ this.m3f_1 = suspendResult;
408
+ this.a9_1 = 2;
409
+ continue $sm;
410
+ case 6:
411
+ return this.m3f_1;
412
+ case 7:
413
+ throw this.d9_1;
414
+ }
415
+ } catch ($p) {
416
+ var e = $p;
417
+ if (this.b9_1 === 7) {
418
+ throw e;
419
+ } else {
420
+ this.a9_1 = this.b9_1;
421
+ this.d9_1 = e;
422
+ }
423
+ }
424
+ while (true);
425
+ };
426
+ protoOf(Auth$lambda$slambda_1).a2p = function ($this$on, originalRequest, completion) {
427
+ var i = new Auth$lambda$slambda_1(this.g3f_1, this.h3f_1, this.i3f_1, completion);
428
+ i.j3f_1 = $this$on;
429
+ i.k3f_1 = originalRequest;
430
+ return i;
431
+ };
432
+ function Auth$lambda$slambda_2($providers, $tokenVersions, $tokenVersionsAttributeKey, resultContinuation) {
433
+ var i = new Auth$lambda$slambda_1($providers, $tokenVersions, $tokenVersionsAttributeKey, resultContinuation);
434
+ var l = function ($this$on, originalRequest, $completion) {
435
+ return i.z2o($this$on, originalRequest, $completion);
436
+ };
437
+ l.$arity = 2;
438
+ return l;
439
+ }
440
+ function Auth$lambda$refreshTokenIfNeeded$lambda() {
441
+ _init_properties_Auth_kt__9ob1dk();
442
+ return new AtomicCounter();
443
+ }
444
+ function Auth$lambda$refreshTokenIfNeeded$lambda_0() {
445
+ _init_properties_Auth_kt__9ob1dk();
446
+ // Inline function 'kotlin.collections.mutableMapOf' call
447
+ return LinkedHashMap_init_$Create$();
448
+ }
449
+ function $invoke$refreshTokenIfNeededCOROUTINE$0(tokenVersions, tokenVersionsAttributeKey, call, provider, request, resultContinuation) {
450
+ CoroutineImpl.call(this, resultContinuation);
451
+ this.g3d_1 = tokenVersions;
452
+ this.h3d_1 = tokenVersionsAttributeKey;
453
+ this.i3d_1 = call;
454
+ this.j3d_1 = provider;
455
+ this.k3d_1 = request;
456
+ }
457
+ protoOf($invoke$refreshTokenIfNeededCOROUTINE$0).i9 = function () {
458
+ var suspendResult = this.c9_1;
459
+ $sm: do
460
+ try {
461
+ var tmp = this.a9_1;
462
+ switch (tmp) {
463
+ case 0:
464
+ this.b9_1 = 4;
465
+ var tmp_0 = this;
466
+ tmp_0.l3d_1 = this.g3d_1.f1p(this.j3d_1, Auth$lambda$refreshTokenIfNeeded$lambda);
467
+ var tmp_1 = this;
468
+ tmp_1.m3d_1 = this.k3d_1.x27_1.v1j(this.h3d_1, Auth$lambda$refreshTokenIfNeeded$lambda_0);
469
+ this.n3d_1 = this.m3d_1.f2(this.j3d_1);
470
+ if (!(this.n3d_1 == null) && this.n3d_1 >= this.l3d_1.w3c_1.kotlinx$atomicfu$value) {
471
+ get_LOGGER().n1p('Refreshing token for ' + this.i3d_1.c2a().f2a().toString());
472
+ this.a9_1 = 1;
473
+ suspendResult = this.j3d_1.s3f(this.i3d_1.s26(), this);
474
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
475
+ return suspendResult;
476
+ }
477
+ continue $sm;
478
+ } else {
479
+ this.a9_1 = 3;
480
+ continue $sm;
481
+ }
482
+
483
+ case 1:
484
+ var ARGUMENT = suspendResult;
485
+ if (!ARGUMENT) {
486
+ get_LOGGER().n1p('Refreshing token failed for ' + this.i3d_1.c2a().f2a().toString());
487
+ return false;
488
+ } else {
489
+ var this_0 = this.m3d_1;
490
+ var key = this.j3d_1;
491
+ var value = this.l3d_1.w3c_1.atomicfu$incrementAndGet();
492
+ this_0.i2(key, value);
493
+ this.a9_1 = 2;
494
+ continue $sm;
495
+ }
496
+
497
+ case 2:
498
+ this.a9_1 = 3;
499
+ continue $sm;
500
+ case 3:
501
+ return true;
502
+ case 4:
503
+ throw this.d9_1;
504
+ }
505
+ } catch ($p) {
506
+ var e = $p;
507
+ if (this.b9_1 === 4) {
508
+ throw e;
509
+ } else {
510
+ this.a9_1 = this.b9_1;
511
+ this.d9_1 = e;
512
+ }
513
+ }
514
+ while (true);
515
+ };
516
+ function $invoke$executeWithNewTokenCOROUTINE$1(_this__u8e3s4, call, provider, oldRequest, authHeader, resultContinuation) {
517
+ CoroutineImpl.call(this, resultContinuation);
518
+ this.w3d_1 = _this__u8e3s4;
519
+ this.x3d_1 = call;
520
+ this.y3d_1 = provider;
521
+ this.z3d_1 = oldRequest;
522
+ this.a3e_1 = authHeader;
523
+ }
524
+ protoOf($invoke$executeWithNewTokenCOROUTINE$1).i9 = function () {
525
+ var suspendResult = this.c9_1;
526
+ $sm: do
527
+ try {
528
+ var tmp = this.a9_1;
529
+ switch (tmp) {
530
+ case 0:
531
+ this.b9_1 = 3;
532
+ this.b3e_1 = new HttpRequestBuilder();
533
+ this.b3e_1.s2d(this.z3d_1);
534
+ this.a9_1 = 1;
535
+ suspendResult = this.y3d_1.t3f(this.b3e_1, this.a3e_1, this);
536
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
537
+ return suspendResult;
538
+ }
539
+
540
+ continue $sm;
541
+ case 1:
542
+ this.b3e_1.x27_1.t1j(get_AuthCircuitBreaker(), Unit_instance);
543
+ get_LOGGER().n1p('Sending new request to ' + this.x3d_1.c2a().f2a().toString());
544
+ this.a9_1 = 2;
545
+ suspendResult = this.w3d_1.d2p(this.b3e_1, this);
546
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
547
+ return suspendResult;
548
+ }
549
+
550
+ continue $sm;
551
+ case 2:
552
+ return suspendResult;
553
+ case 3:
554
+ throw this.d9_1;
555
+ }
556
+ } catch ($p) {
557
+ var e = $p;
558
+ if (this.b9_1 === 3) {
559
+ throw e;
560
+ } else {
561
+ this.a9_1 = this.b9_1;
562
+ this.d9_1 = e;
563
+ }
564
+ }
565
+ while (true);
566
+ };
567
+ var properties_initialized_Auth_kt_7p5u22;
568
+ function _init_properties_Auth_kt__9ob1dk() {
569
+ if (!properties_initialized_Auth_kt_7p5u22) {
570
+ properties_initialized_Auth_kt_7p5u22 = true;
571
+ LOGGER = KtorSimpleLogger('io.ktor.client.plugins.auth.Auth');
572
+ // Inline function 'io.ktor.util.AttributeKey' call
573
+ var name = 'auth-request';
574
+ AuthCircuitBreaker = new AttributeKey(name, toString(getKClass(Unit)));
575
+ var tmp = AuthConfig$_init_$ref_ms3pb9();
576
+ Auth = createClientPlugin('Auth', tmp, Auth$lambda);
577
+ // Inline function 'io.ktor.util.AttributeKey' call
578
+ var name_0 = 'AuthProviders';
579
+ AuthProvidersKey = new AttributeKey(name_0, toString(getKClass(KtList)));
580
+ }
581
+ }
582
+ function AuthProvider() {
583
+ }
584
+ function $loadTokenCOROUTINE$2(_this__u8e3s4, resultContinuation) {
585
+ CoroutineImpl.call(this, resultContinuation);
586
+ this.d3g_1 = _this__u8e3s4;
587
+ }
588
+ protoOf($loadTokenCOROUTINE$2).i9 = function () {
589
+ var suspendResult = this.c9_1;
590
+ $sm: do
591
+ try {
592
+ var tmp = this.a9_1;
593
+ switch (tmp) {
594
+ case 0:
595
+ this.b9_1 = 5;
596
+ this.f3g_1 = null;
597
+ $l$loop: while (true) {
598
+ this.e3g_1 = this.d3g_1.i3g_1.kotlinx$atomicfu$value;
599
+ var tmp0_elvis_lhs = this.e3g_1;
600
+ var newValue = tmp0_elvis_lhs == null ? CompletableDeferred() : tmp0_elvis_lhs;
601
+ if (this.d3g_1.i3g_1.atomicfu$compareAndSet(this.e3g_1, newValue)) {
602
+ this.f3g_1 = newValue;
603
+ break $l$loop;
604
+ }
605
+ }
606
+
607
+ if (!(this.e3g_1 == null)) {
608
+ this.a9_1 = 4;
609
+ suspendResult = this.e3g_1.ap(this);
610
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
611
+ return suspendResult;
612
+ }
613
+ continue $sm;
614
+ } else {
615
+ this.a9_1 = 1;
616
+ continue $sm;
617
+ }
618
+
619
+ case 1:
620
+ this.b9_1 = 3;
621
+ this.a9_1 = 2;
622
+ suspendResult = this.d3g_1.g3g_1(this);
623
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
624
+ return suspendResult;
625
+ }
626
+
627
+ continue $sm;
628
+ case 2:
629
+ var newTokens = suspendResult;
630
+ var tmp_0;
631
+ if (this.f3g_1 == null) {
632
+ throwUninitializedPropertyAccessException('newDeferred');
633
+ } else {
634
+ tmp_0 = this.f3g_1;
635
+ }
636
+
637
+ tmp_0.ds(newTokens);
638
+ return newTokens;
639
+ case 3:
640
+ this.b9_1 = 5;
641
+ var tmp_1 = this.d9_1;
642
+ if (tmp_1 instanceof Error) {
643
+ var cause = this.d9_1;
644
+ var tmp_2;
645
+ if (this.f3g_1 == null) {
646
+ throwUninitializedPropertyAccessException('newDeferred');
647
+ } else {
648
+ tmp_2 = this.f3g_1;
649
+ }
650
+ tmp_2.fs(cause);
651
+ var tmp_3;
652
+ if (this.f3g_1 == null) {
653
+ throwUninitializedPropertyAccessException('newDeferred');
654
+ } else {
655
+ tmp_3 = this.f3g_1;
656
+ }
657
+ this.d3g_1.i3g_1.atomicfu$compareAndSet(tmp_3, null);
658
+ throw cause;
659
+ } else {
660
+ throw this.d9_1;
661
+ }
662
+
663
+ case 4:
664
+ return suspendResult;
665
+ case 5:
666
+ throw this.d9_1;
667
+ }
668
+ } catch ($p) {
669
+ var e = $p;
670
+ if (this.b9_1 === 5) {
671
+ throw e;
672
+ } else {
673
+ this.a9_1 = this.b9_1;
674
+ this.d9_1 = e;
675
+ }
676
+ }
677
+ while (true);
678
+ };
679
+ function $setTokenCOROUTINE$3(_this__u8e3s4, block, resultContinuation) {
680
+ CoroutineImpl.call(this, resultContinuation);
681
+ this.r3g_1 = _this__u8e3s4;
682
+ this.s3g_1 = block;
683
+ }
684
+ protoOf($setTokenCOROUTINE$3).i9 = function () {
685
+ var suspendResult = this.c9_1;
686
+ $sm: do
687
+ try {
688
+ var tmp = this.a9_1;
689
+ switch (tmp) {
690
+ case 0:
691
+ this.b9_1 = 5;
692
+ this.u3g_1 = null;
693
+ $l$loop: while (true) {
694
+ this.t3g_1 = this.r3g_1.h3g_1.kotlinx$atomicfu$value;
695
+ var tmp0_elvis_lhs = this.t3g_1;
696
+ var newValue = tmp0_elvis_lhs == null ? CompletableDeferred() : tmp0_elvis_lhs;
697
+ if (this.r3g_1.h3g_1.atomicfu$compareAndSet(this.t3g_1, newValue)) {
698
+ this.u3g_1 = newValue;
699
+ break $l$loop;
700
+ }
701
+ }
702
+
703
+ this.b9_1 = 4;
704
+ if (this.t3g_1 == null) {
705
+ this.a9_1 = 2;
706
+ suspendResult = this.s3g_1(this);
707
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
708
+ return suspendResult;
709
+ }
710
+ continue $sm;
711
+ } else {
712
+ this.a9_1 = 1;
713
+ suspendResult = this.t3g_1.ap(this);
714
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
715
+ return suspendResult;
716
+ }
717
+ continue $sm;
718
+ }
719
+
720
+ case 1:
721
+ this.v3g_1 = suspendResult;
722
+ this.a9_1 = 3;
723
+ continue $sm;
724
+ case 2:
725
+ var newTokens = suspendResult;
726
+ var tmp_0;
727
+ if (this.u3g_1 == null) {
728
+ throwUninitializedPropertyAccessException('newDeferred');
729
+ } else {
730
+ tmp_0 = this.u3g_1;
731
+ }
732
+
733
+ tmp_0.ds(newTokens);
734
+ this.r3g_1.h3g_1.kotlinx$atomicfu$value = null;
735
+ this.v3g_1 = newTokens;
736
+ this.a9_1 = 3;
737
+ continue $sm;
738
+ case 3:
739
+ var newToken = this.v3g_1;
740
+ this.r3g_1.i3g_1.kotlinx$atomicfu$value = CompletableDeferred_0(newToken);
741
+ return newToken;
742
+ case 4:
743
+ this.b9_1 = 5;
744
+ var tmp_1 = this.d9_1;
745
+ if (tmp_1 instanceof Error) {
746
+ var cause = this.d9_1;
747
+ var tmp_2;
748
+ if (this.u3g_1 == null) {
749
+ throwUninitializedPropertyAccessException('newDeferred');
750
+ } else {
751
+ tmp_2 = this.u3g_1;
752
+ }
753
+ tmp_2.fs(cause);
754
+ var tmp_3;
755
+ if (this.u3g_1 == null) {
756
+ throwUninitializedPropertyAccessException('newDeferred');
757
+ } else {
758
+ tmp_3 = this.u3g_1;
759
+ }
760
+ this.r3g_1.h3g_1.atomicfu$compareAndSet(tmp_3, null);
761
+ throw cause;
762
+ } else {
763
+ throw this.d9_1;
764
+ }
765
+
766
+ case 5:
767
+ throw this.d9_1;
768
+ }
769
+ } catch ($p) {
770
+ var e = $p;
771
+ if (this.b9_1 === 5) {
772
+ throw e;
773
+ } else {
774
+ this.a9_1 = this.b9_1;
775
+ this.d9_1 = e;
776
+ }
777
+ }
778
+ while (true);
779
+ };
780
+ function AuthTokenHolder(loadTokens) {
781
+ this.g3g_1 = loadTokens;
782
+ this.h3g_1 = atomic$ref$1(null);
783
+ this.i3g_1 = atomic$ref$1(null);
784
+ }
785
+ protoOf(AuthTokenHolder).w3g = function ($completion) {
786
+ var tmp = new $loadTokenCOROUTINE$2(this, $completion);
787
+ tmp.c9_1 = Unit_instance;
788
+ tmp.d9_1 = null;
789
+ return tmp.i9();
790
+ };
791
+ protoOf(AuthTokenHolder).x3g = function (block, $completion) {
792
+ var tmp = new $setTokenCOROUTINE$3(this, block, $completion);
793
+ tmp.c9_1 = Unit_instance;
794
+ tmp.d9_1 = null;
795
+ return tmp.i9();
796
+ };
797
+ function bearer(_this__u8e3s4, block) {
798
+ // Inline function 'kotlin.with' call
799
+ // Inline function 'kotlin.apply' call
800
+ var this_0 = new BearerAuthConfig();
801
+ // Inline function 'kotlin.contracts.contract' call
802
+ block(this_0);
803
+ // Inline function 'kotlin.contracts.contract' call
804
+ // Inline function 'io.ktor.client.plugins.auth.providers.bearer.<anonymous>' call
805
+ _this__u8e3s4.v3c_1.e(new BearerAuthProvider(this_0.y3g_1, this_0.z3g_1, this_0.a3h_1, this_0.b3h_1));
806
+ }
807
+ function BearerAuthConfig$_refreshTokens$slambda(resultContinuation) {
808
+ CoroutineImpl.call(this, resultContinuation);
809
+ }
810
+ protoOf(BearerAuthConfig$_refreshTokens$slambda).l3h = function (_this__u8e3s4, $completion) {
811
+ var tmp = this.m3h(_this__u8e3s4, $completion);
812
+ tmp.c9_1 = Unit_instance;
813
+ tmp.d9_1 = null;
814
+ return tmp.i9();
815
+ };
816
+ protoOf(BearerAuthConfig$_refreshTokens$slambda).s9 = function (p1, $completion) {
817
+ return this.l3h(p1 instanceof RefreshTokensParams ? p1 : THROW_CCE(), $completion);
818
+ };
819
+ protoOf(BearerAuthConfig$_refreshTokens$slambda).i9 = function () {
820
+ var suspendResult = this.c9_1;
821
+ $sm: do
822
+ try {
823
+ var tmp = this.a9_1;
824
+ if (tmp === 0) {
825
+ this.b9_1 = 1;
826
+ return null;
827
+ } else if (tmp === 1) {
828
+ throw this.d9_1;
829
+ }
830
+ } catch ($p) {
831
+ var e = $p;
832
+ throw e;
833
+ }
834
+ while (true);
835
+ };
836
+ protoOf(BearerAuthConfig$_refreshTokens$slambda).m3h = function (_this__u8e3s4, completion) {
837
+ var i = new BearerAuthConfig$_refreshTokens$slambda(completion);
838
+ i.k3h_1 = _this__u8e3s4;
839
+ return i;
840
+ };
841
+ function BearerAuthConfig$_refreshTokens$slambda_0(resultContinuation) {
842
+ var i = new BearerAuthConfig$_refreshTokens$slambda(resultContinuation);
843
+ var l = function (_this__u8e3s4, $completion) {
844
+ return i.l3h(_this__u8e3s4, $completion);
845
+ };
846
+ l.$arity = 1;
847
+ return l;
848
+ }
849
+ function BearerAuthConfig$_loadTokens$slambda(resultContinuation) {
850
+ CoroutineImpl.call(this, resultContinuation);
851
+ }
852
+ protoOf(BearerAuthConfig$_loadTokens$slambda).v3h = function ($completion) {
853
+ var tmp = this.w3h($completion);
854
+ tmp.c9_1 = Unit_instance;
855
+ tmp.d9_1 = null;
856
+ return tmp.i9();
857
+ };
858
+ protoOf(BearerAuthConfig$_loadTokens$slambda).pa = function ($completion) {
859
+ return this.v3h($completion);
860
+ };
861
+ protoOf(BearerAuthConfig$_loadTokens$slambda).i9 = function () {
862
+ var suspendResult = this.c9_1;
863
+ $sm: do
864
+ try {
865
+ var tmp = this.a9_1;
866
+ if (tmp === 0) {
867
+ this.b9_1 = 1;
868
+ return null;
869
+ } else if (tmp === 1) {
870
+ throw this.d9_1;
871
+ }
872
+ } catch ($p) {
873
+ var e = $p;
874
+ throw e;
875
+ }
876
+ while (true);
877
+ };
878
+ protoOf(BearerAuthConfig$_loadTokens$slambda).w3h = function (completion) {
879
+ return new BearerAuthConfig$_loadTokens$slambda(completion);
880
+ };
881
+ function BearerAuthConfig$_loadTokens$slambda_0(resultContinuation) {
882
+ var i = new BearerAuthConfig$_loadTokens$slambda(resultContinuation);
883
+ var l = function ($completion) {
884
+ return i.v3h($completion);
885
+ };
886
+ l.$arity = 0;
887
+ return l;
888
+ }
889
+ function BearerAuthConfig$_sendWithoutRequest$lambda(it) {
890
+ return true;
891
+ }
892
+ function BearerAuthConfig() {
893
+ var tmp = this;
894
+ tmp.y3g_1 = BearerAuthConfig$_refreshTokens$slambda_0(null);
895
+ var tmp_0 = this;
896
+ tmp_0.z3g_1 = BearerAuthConfig$_loadTokens$slambda_0(null);
897
+ var tmp_1 = this;
898
+ tmp_1.a3h_1 = BearerAuthConfig$_sendWithoutRequest$lambda;
899
+ this.b3h_1 = null;
900
+ }
901
+ protoOf(BearerAuthConfig).x3h = function (block) {
902
+ this.y3g_1 = block;
903
+ };
904
+ function RefreshTokensParams(client, response, oldTokens) {
905
+ this.y3h_1 = client;
906
+ this.z3h_1 = response;
907
+ this.a3i_1 = oldTokens;
908
+ }
909
+ function BearerTokens(accessToken, refreshToken) {
910
+ this.b3i_1 = accessToken;
911
+ this.c3i_1 = refreshToken;
912
+ }
913
+ function BearerAuthProvider$_init_$lambda_lcdiwf(it) {
914
+ return true;
915
+ }
916
+ function BearerAuthProvider$addRequestHeaders$lambda($token) {
917
+ return function ($this$headers) {
918
+ var tokenValue = 'Bearer ' + $token.b3i_1;
919
+ var tmp;
920
+ if ($this$headers.l1l(HttpHeaders_getInstance().y1r_1)) {
921
+ $this$headers.r1l(HttpHeaders_getInstance().y1r_1);
922
+ tmp = Unit_instance;
923
+ }
924
+ $this$headers.p1l(HttpHeaders_getInstance().y1r_1, tokenValue);
925
+ return Unit_instance;
926
+ };
927
+ }
928
+ function BearerAuthProvider$refreshToken$slambda(this$0, $response, resultContinuation) {
929
+ this.l3i_1 = this$0;
930
+ this.m3i_1 = $response;
931
+ CoroutineImpl.call(this, resultContinuation);
932
+ }
933
+ protoOf(BearerAuthProvider$refreshToken$slambda).r3i = function ($completion) {
934
+ var tmp = this.w3h($completion);
935
+ tmp.c9_1 = Unit_instance;
936
+ tmp.d9_1 = null;
937
+ return tmp.i9();
938
+ };
939
+ protoOf(BearerAuthProvider$refreshToken$slambda).pa = function ($completion) {
940
+ return this.r3i($completion);
941
+ };
942
+ protoOf(BearerAuthProvider$refreshToken$slambda).i9 = function () {
943
+ var suspendResult = this.c9_1;
944
+ $sm: do
945
+ try {
946
+ var tmp = this.a9_1;
947
+ switch (tmp) {
948
+ case 0:
949
+ this.b9_1 = 3;
950
+ this.n3i_1 = this.l3i_1.s3i_1;
951
+ this.o3i_1 = this.m3i_1.c2b().n26_1;
952
+ this.a9_1 = 1;
953
+ suspendResult = this.l3i_1.v3i_1.w3g(this);
954
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
955
+ return suspendResult;
956
+ }
957
+
958
+ continue $sm;
959
+ case 1:
960
+ this.p3i_1 = suspendResult;
961
+ this.q3i_1 = new RefreshTokensParams(this.o3i_1, this.m3i_1, this.p3i_1);
962
+ this.a9_1 = 2;
963
+ suspendResult = this.n3i_1(this.q3i_1, this);
964
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
965
+ return suspendResult;
966
+ }
967
+
968
+ continue $sm;
969
+ case 2:
970
+ return suspendResult;
971
+ case 3:
972
+ throw this.d9_1;
973
+ }
974
+ } catch ($p) {
975
+ var e = $p;
976
+ if (this.b9_1 === 3) {
977
+ throw e;
978
+ } else {
979
+ this.a9_1 = this.b9_1;
980
+ this.d9_1 = e;
981
+ }
982
+ }
983
+ while (true);
984
+ };
985
+ protoOf(BearerAuthProvider$refreshToken$slambda).w3h = function (completion) {
986
+ return new BearerAuthProvider$refreshToken$slambda(this.l3i_1, this.m3i_1, completion);
987
+ };
988
+ function BearerAuthProvider$refreshToken$slambda_0(this$0, $response, resultContinuation) {
989
+ var i = new BearerAuthProvider$refreshToken$slambda(this$0, $response, resultContinuation);
990
+ var l = function ($completion) {
991
+ return i.r3i($completion);
992
+ };
993
+ l.$arity = 0;
994
+ return l;
995
+ }
996
+ function $addRequestHeadersCOROUTINE$4(_this__u8e3s4, request, authHeader, resultContinuation) {
997
+ CoroutineImpl.call(this, resultContinuation);
998
+ this.e3j_1 = _this__u8e3s4;
999
+ this.f3j_1 = request;
1000
+ this.g3j_1 = authHeader;
1001
+ }
1002
+ protoOf($addRequestHeadersCOROUTINE$4).i9 = function () {
1003
+ var suspendResult = this.c9_1;
1004
+ $sm: do
1005
+ try {
1006
+ var tmp = this.a9_1;
1007
+ switch (tmp) {
1008
+ case 0:
1009
+ this.b9_1 = 2;
1010
+ this.a9_1 = 1;
1011
+ suspendResult = this.e3j_1.v3i_1.w3g(this);
1012
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1013
+ return suspendResult;
1014
+ }
1015
+
1016
+ continue $sm;
1017
+ case 1:
1018
+ var tmp0_elvis_lhs = suspendResult;
1019
+ var tmp_0;
1020
+ if (tmp0_elvis_lhs == null) {
1021
+ return Unit_instance;
1022
+ } else {
1023
+ tmp_0 = tmp0_elvis_lhs;
1024
+ }
1025
+
1026
+ var token = tmp_0;
1027
+ headers(this.f3j_1, BearerAuthProvider$addRequestHeaders$lambda(token));
1028
+ return Unit_instance;
1029
+ case 2:
1030
+ throw this.d9_1;
1031
+ }
1032
+ } catch ($p) {
1033
+ var e = $p;
1034
+ if (this.b9_1 === 2) {
1035
+ throw e;
1036
+ } else {
1037
+ this.a9_1 = this.b9_1;
1038
+ this.d9_1 = e;
1039
+ }
1040
+ }
1041
+ while (true);
1042
+ };
1043
+ function $refreshTokenCOROUTINE$5(_this__u8e3s4, response, resultContinuation) {
1044
+ CoroutineImpl.call(this, resultContinuation);
1045
+ this.p3j_1 = _this__u8e3s4;
1046
+ this.q3j_1 = response;
1047
+ }
1048
+ protoOf($refreshTokenCOROUTINE$5).i9 = function () {
1049
+ var suspendResult = this.c9_1;
1050
+ $sm: do
1051
+ try {
1052
+ var tmp = this.a9_1;
1053
+ switch (tmp) {
1054
+ case 0:
1055
+ this.b9_1 = 2;
1056
+ this.a9_1 = 1;
1057
+ suspendResult = this.p3j_1.v3i_1.x3g(BearerAuthProvider$refreshToken$slambda_0(this.p3j_1, this.q3j_1, null), this);
1058
+ if (suspendResult === get_COROUTINE_SUSPENDED()) {
1059
+ return suspendResult;
1060
+ }
1061
+
1062
+ continue $sm;
1063
+ case 1:
1064
+ var newToken = suspendResult;
1065
+ return !(newToken == null);
1066
+ case 2:
1067
+ throw this.d9_1;
1068
+ }
1069
+ } catch ($p) {
1070
+ var e = $p;
1071
+ if (this.b9_1 === 2) {
1072
+ throw e;
1073
+ } else {
1074
+ this.a9_1 = this.b9_1;
1075
+ this.d9_1 = e;
1076
+ }
1077
+ }
1078
+ while (true);
1079
+ };
1080
+ function BearerAuthProvider(refreshTokens, loadTokens, sendWithoutRequestCallback, realm) {
1081
+ var tmp;
1082
+ if (sendWithoutRequestCallback === VOID) {
1083
+ tmp = BearerAuthProvider$_init_$lambda_lcdiwf;
1084
+ } else {
1085
+ tmp = sendWithoutRequestCallback;
1086
+ }
1087
+ sendWithoutRequestCallback = tmp;
1088
+ this.s3i_1 = refreshTokens;
1089
+ this.t3i_1 = sendWithoutRequestCallback;
1090
+ this.u3i_1 = realm;
1091
+ this.v3i_1 = new AuthTokenHolder(loadTokens);
1092
+ }
1093
+ protoOf(BearerAuthProvider).u3f = function () {
1094
+ var message = 'Deprecated';
1095
+ throw IllegalStateException_init_$Create$(toString(message));
1096
+ };
1097
+ protoOf(BearerAuthProvider).w3e = function (request) {
1098
+ return this.t3i_1(request);
1099
+ };
1100
+ protoOf(BearerAuthProvider).x3c = function (auth) {
1101
+ if (!(auth.z20_1 === 'Bearer')) {
1102
+ get_LOGGER().n1p('Bearer Auth Provider is not applicable for ' + auth.toString());
1103
+ return false;
1104
+ }
1105
+ var tmp;
1106
+ if (this.u3i_1 == null) {
1107
+ tmp = true;
1108
+ } else {
1109
+ if (!(auth instanceof Parameterized)) {
1110
+ tmp = false;
1111
+ } else {
1112
+ tmp = auth.k1r('realm') == this.u3i_1;
1113
+ }
1114
+ }
1115
+ var isSameRealm = tmp;
1116
+ if (!isSameRealm) {
1117
+ get_LOGGER().n1p('Bearer Auth Provider is not applicable for this realm');
1118
+ }
1119
+ return isSameRealm;
1120
+ };
1121
+ protoOf(BearerAuthProvider).t3f = function (request, authHeader, $completion) {
1122
+ var tmp = new $addRequestHeadersCOROUTINE$4(this, request, authHeader, $completion);
1123
+ tmp.c9_1 = Unit_instance;
1124
+ tmp.d9_1 = null;
1125
+ return tmp.i9();
1126
+ };
1127
+ protoOf(BearerAuthProvider).s3f = function (response, $completion) {
1128
+ var tmp = new $refreshTokenCOROUTINE$5(this, response, $completion);
1129
+ tmp.c9_1 = Unit_instance;
1130
+ tmp.d9_1 = null;
1131
+ return tmp.i9();
1132
+ };
1133
+ //region block: post-declaration
1134
+ protoOf(BearerAuthProvider).x3e = addRequestHeaders$default;
1135
+ //endregion
1136
+ //region block: exports
1137
+ _.$_$ = _.$_$ || {};
1138
+ _.$_$.a = BearerTokens;
1139
+ _.$_$.b = RefreshTokensParams;
1140
+ _.$_$.c = bearer;
1141
+ _.$_$.d = get_Auth;
1142
+ //endregion
1143
+ return _;
1144
+ }(module.exports, require('./kotlin-kotlin-stdlib.js'), require('./kotlinx-atomicfu.js'), require('./ktor-ktor-utils.js'), require('./ktor-ktor-client-ktor-client-core.js'), require('./ktor-ktor-http.js'), require('./kotlinx-coroutines-core.js')));
1145
+
1146
+ //# sourceMappingURL=ktor-ktor-client-ktor-client-plugins-ktor-client-auth.js.map