@tma.js/sdk 2.6.0 → 2.7.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.
- package/dist/dts/bridge/{utils/invokeCustomMethod.d.ts → invokeCustomMethod.d.ts} +2 -2
- package/dist/dts/bridge/methods/createPostEvent.d.ts +3 -2
- package/dist/dts/bridge/methods/postEvent.d.ts +5 -3
- package/dist/dts/bridge/request.d.ts +53 -0
- package/dist/dts/bridge/target-origin.d.ts +8 -3
- package/dist/dts/components/MiniApp/MiniApp.d.ts +3 -2
- package/dist/dts/components/QRScanner/QRScanner.d.ts +6 -8
- package/dist/dts/components/QRScanner/types.d.ts +2 -2
- package/dist/dts/components/Utils/Utils.d.ts +27 -4
- package/dist/dts/env/hasWebviewProxy.d.ts +1 -1
- package/dist/dts/index.d.ts +4 -4
- package/dist/dts/index.low-level.d.ts +3 -3
- package/dist/dts/misc/createCleanup.d.ts +2 -2
- package/dist/index.cjs +3 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.iife.js +3 -1
- package/dist/index.iife.js.map +1 -1
- package/dist/index.js +505 -519
- package/dist/index.js.map +1 -1
- package/dist/index.low-level.iife.js +3 -1
- package/dist/index.low-level.iife.js.map +1 -1
- package/package.json +1 -1
- package/dist/dts/bridge/utils/request.d.ts +0 -47
- /package/dist/dts/bridge/{utils/captureSameReq.d.ts → captureSameReq.d.ts} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var c = (e, t, s) =>
|
|
4
|
-
function
|
|
1
|
+
var Wt = Object.defineProperty;
|
|
2
|
+
var Ut = (e, t, s) => t in e ? Wt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
|
|
3
|
+
var c = (e, t, s) => Ut(e, typeof t != "symbol" ? t + "" : t, s);
|
|
4
|
+
function ot(e, t) {
|
|
5
5
|
let s;
|
|
6
6
|
const n = () => {
|
|
7
7
|
s !== void 0 && t && t(s), s = void 0;
|
|
8
8
|
};
|
|
9
9
|
return [() => s === void 0 ? s = e(n) : s, n];
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
const t =
|
|
13
|
-
t.unsubscribe(e), s && !t.count &&
|
|
11
|
+
function at(e) {
|
|
12
|
+
const t = V(), { count: s } = t;
|
|
13
|
+
t.unsubscribe(e), s && !t.count && ie();
|
|
14
14
|
}
|
|
15
15
|
function Ht(e) {
|
|
16
|
-
return
|
|
16
|
+
return V().subscribe(e), () => at(e);
|
|
17
17
|
}
|
|
18
|
-
class
|
|
18
|
+
class Ot {
|
|
19
19
|
constructor(t, s = {}) {
|
|
20
20
|
this.scope = t, this.options = s;
|
|
21
21
|
}
|
|
@@ -55,19 +55,19 @@ class Gt {
|
|
|
55
55
|
this.print("log", ...t);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
const F = new
|
|
58
|
+
const F = new Ot("SDK", {
|
|
59
59
|
bgColor: "forestgreen",
|
|
60
60
|
textColor: "white"
|
|
61
61
|
});
|
|
62
|
-
let
|
|
63
|
-
const
|
|
62
|
+
let O = !1;
|
|
63
|
+
const st = ({ name: e, payload: t }) => {
|
|
64
64
|
F.log("Event received:", t ? { name: e, payload: t } : { name: e });
|
|
65
65
|
};
|
|
66
|
-
function
|
|
67
|
-
|
|
66
|
+
function Ze(e) {
|
|
67
|
+
O !== e && (O = e, e ? Ht(st) : at(st));
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
|
|
69
|
+
function Gt(...e) {
|
|
70
|
+
O && F.log(...e);
|
|
71
71
|
}
|
|
72
72
|
class T {
|
|
73
73
|
constructor() {
|
|
@@ -146,7 +146,7 @@ function G(e, t, s) {
|
|
|
146
146
|
}
|
|
147
147
|
function J(...e) {
|
|
148
148
|
let t = !1;
|
|
149
|
-
const s =
|
|
149
|
+
const s = e.flat(1);
|
|
150
150
|
return [
|
|
151
151
|
(n) => !t && s.push(n),
|
|
152
152
|
() => {
|
|
@@ -160,12 +160,12 @@ class D extends Error {
|
|
|
160
160
|
super(s, { cause: n }), this.type = t, Object.setPrototypeOf(this, D.prototype);
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function f(e, t, s) {
|
|
164
164
|
return new D(e, t, s);
|
|
165
165
|
}
|
|
166
|
-
const
|
|
166
|
+
const jt = "ERR_METHOD_UNSUPPORTED", zt = "ERR_METHOD_PARAMETER_UNSUPPORTED", Ft = "ERR_UNKNOWN_ENV", Jt = "ERR_INVOKE_CUSTOM_METHOD_RESPONSE", Qt = "ERR_TIMED_OUT", Yt = "ERR_UNEXPECTED_TYPE", ct = "ERR_PARSE", Zt = "ERR_NAVIGATION_LIST_EMPTY", Kt = "ERR_NAVIGATION_CURSOR_INVALID", Ke = "ERR_NAVIGATION_ITEM_INVALID", Xe = "ERR_SSR_INIT", Xt = "ERR_INVALID_PATH_BASE";
|
|
167
167
|
function E() {
|
|
168
|
-
return
|
|
168
|
+
return f(Yt, "Value has unexpected type");
|
|
169
169
|
}
|
|
170
170
|
class M {
|
|
171
171
|
constructor(t, s, n) {
|
|
@@ -182,8 +182,8 @@ class M {
|
|
|
182
182
|
try {
|
|
183
183
|
return this.parser(t);
|
|
184
184
|
} catch (s) {
|
|
185
|
-
throw
|
|
186
|
-
|
|
185
|
+
throw f(
|
|
186
|
+
ct,
|
|
187
187
|
`Unable to parse value${this.type ? ` as ${this.type}` : ""}`,
|
|
188
188
|
s
|
|
189
189
|
);
|
|
@@ -206,7 +206,7 @@ const w = x((e) => {
|
|
|
206
206
|
return !1;
|
|
207
207
|
throw E();
|
|
208
208
|
}, "boolean");
|
|
209
|
-
function
|
|
209
|
+
function ht(e, t) {
|
|
210
210
|
const s = {};
|
|
211
211
|
for (const n in e) {
|
|
212
212
|
const r = e[n];
|
|
@@ -223,21 +223,21 @@ function pt(e, t) {
|
|
|
223
223
|
const a = o(t(i));
|
|
224
224
|
a !== void 0 && (s[n] = a);
|
|
225
225
|
} catch (a) {
|
|
226
|
-
throw
|
|
226
|
+
throw f(ct, `Unable to parse field "${n}"`, a);
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
return s;
|
|
230
230
|
}
|
|
231
|
-
function
|
|
231
|
+
function pt(e) {
|
|
232
232
|
let t = e;
|
|
233
233
|
if (typeof t == "string" && (t = JSON.parse(t)), typeof t != "object" || t === null || Array.isArray(t))
|
|
234
234
|
throw E();
|
|
235
235
|
return t;
|
|
236
236
|
}
|
|
237
|
-
function
|
|
237
|
+
function g(e, t) {
|
|
238
238
|
return new M((s) => {
|
|
239
|
-
const n =
|
|
240
|
-
return
|
|
239
|
+
const n = pt(s);
|
|
240
|
+
return ht(e, (r) => n[r]);
|
|
241
241
|
}, !1, t);
|
|
242
242
|
}
|
|
243
243
|
const y = x((e) => {
|
|
@@ -249,43 +249,18 @@ const y = x((e) => {
|
|
|
249
249
|
return t;
|
|
250
250
|
}
|
|
251
251
|
throw E();
|
|
252
|
-
}, "number")
|
|
253
|
-
function Y(e) {
|
|
254
|
-
return /^#[\da-f]{6}$/i.test(e);
|
|
255
|
-
}
|
|
256
|
-
function ee(e) {
|
|
257
|
-
return /^#[\da-f]{3}$/i.test(e);
|
|
258
|
-
}
|
|
259
|
-
function ut(e) {
|
|
260
|
-
const t = e.replace(/\s/g, "").toLowerCase();
|
|
261
|
-
if (Y(t))
|
|
262
|
-
return t;
|
|
263
|
-
if (ee(t)) {
|
|
264
|
-
let n = "#";
|
|
265
|
-
for (let r = 0; r < 3; r += 1)
|
|
266
|
-
n += t[1 + r].repeat(2);
|
|
267
|
-
return n;
|
|
268
|
-
}
|
|
269
|
-
const s = t.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/) || t.match(/^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),\d{1,3}\)$/);
|
|
270
|
-
if (!s)
|
|
271
|
-
throw new Error(`Value "${e}" does not satisfy any of known RGB formats.`);
|
|
272
|
-
return s.slice(1).reduce((n, r) => {
|
|
273
|
-
const i = parseInt(r, 10).toString(16);
|
|
274
|
-
return n + (i.length === 1 ? "0" : "") + i;
|
|
275
|
-
}, "#");
|
|
276
|
-
}
|
|
277
|
-
const h = x((e) => {
|
|
252
|
+
}, "number"), p = x((e) => {
|
|
278
253
|
if (typeof e == "string" || typeof e == "number")
|
|
279
254
|
return e.toString();
|
|
280
255
|
throw E();
|
|
281
|
-
}, "string")
|
|
282
|
-
function
|
|
283
|
-
return
|
|
284
|
-
eventType:
|
|
256
|
+
}, "string");
|
|
257
|
+
function ut(e) {
|
|
258
|
+
return g({
|
|
259
|
+
eventType: p(),
|
|
285
260
|
eventData: (t) => t
|
|
286
261
|
}).parse(e);
|
|
287
262
|
}
|
|
288
|
-
function
|
|
263
|
+
function te() {
|
|
289
264
|
["TelegramGameProxy_receiveEvent", "TelegramGameProxy", "Telegram"].forEach((e) => {
|
|
290
265
|
delete window[e];
|
|
291
266
|
});
|
|
@@ -297,7 +272,7 @@ function j(e, t) {
|
|
|
297
272
|
source: window.parent
|
|
298
273
|
}));
|
|
299
274
|
}
|
|
300
|
-
function
|
|
275
|
+
function ee() {
|
|
301
276
|
[
|
|
302
277
|
["TelegramGameProxy_receiveEvent"],
|
|
303
278
|
// Windows Phone.
|
|
@@ -316,48 +291,38 @@ function ne() {
|
|
|
316
291
|
});
|
|
317
292
|
});
|
|
318
293
|
}
|
|
319
|
-
const
|
|
320
|
-
clipboard_text_received:
|
|
321
|
-
req_id:
|
|
322
|
-
data: (e) => e === null ? e :
|
|
294
|
+
const se = {
|
|
295
|
+
clipboard_text_received: g({
|
|
296
|
+
req_id: p(),
|
|
297
|
+
data: (e) => e === null ? e : p().optional().parse(e)
|
|
323
298
|
}),
|
|
324
|
-
custom_method_invoked:
|
|
325
|
-
req_id:
|
|
299
|
+
custom_method_invoked: g({
|
|
300
|
+
req_id: p(),
|
|
326
301
|
result: (e) => e,
|
|
327
|
-
error:
|
|
302
|
+
error: p().optional()
|
|
328
303
|
}),
|
|
329
|
-
invoice_closed: d({ slug: h(), status: h() }),
|
|
330
|
-
phone_requested: d({ status: h() }),
|
|
331
304
|
popup_closed: {
|
|
332
305
|
parse(e) {
|
|
333
|
-
return
|
|
334
|
-
button_id: (t) => t == null ? void 0 :
|
|
306
|
+
return g({
|
|
307
|
+
button_id: (t) => t == null ? void 0 : p().parse(t)
|
|
335
308
|
}).parse(e ?? {});
|
|
336
309
|
}
|
|
337
310
|
},
|
|
338
|
-
|
|
339
|
-
theme_changed: d({
|
|
340
|
-
theme_params: (e) => {
|
|
341
|
-
const t = lt().optional();
|
|
342
|
-
return Object.entries(Q(e)).reduce((s, [n, r]) => (s[n] = t.parse(r), s), {});
|
|
343
|
-
}
|
|
344
|
-
}),
|
|
345
|
-
viewport_changed: d({
|
|
311
|
+
viewport_changed: g({
|
|
346
312
|
height: y(),
|
|
347
313
|
width: (e) => e == null ? window.innerWidth : y().parse(e),
|
|
348
314
|
is_state_stable: w(),
|
|
349
315
|
is_expanded: w()
|
|
350
|
-
})
|
|
351
|
-
write_access_requested: d({ status: h() })
|
|
316
|
+
})
|
|
352
317
|
};
|
|
353
|
-
function
|
|
318
|
+
function ne() {
|
|
354
319
|
const e = new T(), t = new T();
|
|
355
320
|
t.subscribe((n) => {
|
|
356
321
|
e.emit("event", { name: n.event, payload: n.args[0] });
|
|
357
|
-
}),
|
|
322
|
+
}), ee();
|
|
358
323
|
const [, s] = J(
|
|
359
324
|
// Don't forget to remove created handlers.
|
|
360
|
-
|
|
325
|
+
te,
|
|
361
326
|
// Add "resize" event listener to make sure, we always have fresh viewport information.
|
|
362
327
|
// Desktop version of Telegram is sometimes not sending the viewport_changed
|
|
363
328
|
// event. For example, when the MainButton is shown. That's why we should
|
|
@@ -378,19 +343,21 @@ function ie() {
|
|
|
378
343
|
return;
|
|
379
344
|
let r;
|
|
380
345
|
try {
|
|
381
|
-
r =
|
|
346
|
+
r = ut(n.data);
|
|
382
347
|
} catch {
|
|
383
348
|
return;
|
|
384
349
|
}
|
|
385
|
-
const { eventType: i, eventData: o } = r, a =
|
|
350
|
+
const { eventType: i, eventData: o } = r, a = se[i];
|
|
386
351
|
try {
|
|
387
|
-
const
|
|
388
|
-
t.emit(...
|
|
389
|
-
} catch (
|
|
352
|
+
const h = a ? a.parse(o) : o;
|
|
353
|
+
t.emit(...h ? [i, h] : [i]);
|
|
354
|
+
} catch (h) {
|
|
390
355
|
F.error(
|
|
391
|
-
`An error occurred processing the "${i}" event from the Telegram application.
|
|
356
|
+
`An error occurred processing the "${i}" event from the Telegram application.
|
|
357
|
+
Please, file an issue here:
|
|
358
|
+
https://github.com/Telegram-Mini-Apps/tma.js/issues/new/choose`,
|
|
392
359
|
r,
|
|
393
|
-
|
|
360
|
+
h
|
|
394
361
|
);
|
|
395
362
|
}
|
|
396
363
|
}),
|
|
@@ -412,9 +379,9 @@ function ie() {
|
|
|
412
379
|
}
|
|
413
380
|
}, s];
|
|
414
381
|
}
|
|
415
|
-
const [
|
|
382
|
+
const [re, ie] = ot(
|
|
416
383
|
(e) => {
|
|
417
|
-
const [t, s] =
|
|
384
|
+
const [t, s] = ne(), n = t.off.bind(t);
|
|
418
385
|
return t.off = (r, i) => {
|
|
419
386
|
const { count: o } = t;
|
|
420
387
|
n(r, i), o && !t.count && e();
|
|
@@ -422,19 +389,19 @@ const [oe, ae] = at(
|
|
|
422
389
|
},
|
|
423
390
|
([, e]) => e()
|
|
424
391
|
);
|
|
425
|
-
function
|
|
426
|
-
return
|
|
392
|
+
function V() {
|
|
393
|
+
return re()[0];
|
|
427
394
|
}
|
|
428
|
-
function
|
|
429
|
-
|
|
395
|
+
function L(e, t) {
|
|
396
|
+
V().off(e, t);
|
|
430
397
|
}
|
|
431
398
|
function b(e, t, s) {
|
|
432
|
-
return
|
|
399
|
+
return V().on(e, t, s);
|
|
433
400
|
}
|
|
434
|
-
function
|
|
401
|
+
function q(e) {
|
|
435
402
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
436
403
|
}
|
|
437
|
-
function
|
|
404
|
+
function oe(e, t) {
|
|
438
405
|
const s = e.split("."), n = t.split("."), r = Math.max(s.length, n.length);
|
|
439
406
|
for (let i = 0; i < r; i += 1) {
|
|
440
407
|
const o = parseInt(s[i] || "0", 10), a = parseInt(n[i] || "0", 10);
|
|
@@ -443,21 +410,21 @@ function ce(e, t) {
|
|
|
443
410
|
}
|
|
444
411
|
return 0;
|
|
445
412
|
}
|
|
446
|
-
function
|
|
447
|
-
return
|
|
413
|
+
function _(e, t) {
|
|
414
|
+
return oe(e, t) <= 0;
|
|
448
415
|
}
|
|
449
416
|
function v(e, t, s) {
|
|
450
417
|
if (typeof s == "string") {
|
|
451
418
|
if (e === "web_app_open_link") {
|
|
452
419
|
if (t === "try_instant_view")
|
|
453
|
-
return
|
|
420
|
+
return _("6.4", s);
|
|
454
421
|
if (t === "try_browser")
|
|
455
|
-
return
|
|
422
|
+
return _("7.6", s);
|
|
456
423
|
}
|
|
457
424
|
if (e === "web_app_set_header_color" && t === "color")
|
|
458
|
-
return
|
|
425
|
+
return _("6.9", s);
|
|
459
426
|
if (e === "web_app_close" && t === "return_back")
|
|
460
|
-
return
|
|
427
|
+
return _("7.6", s);
|
|
461
428
|
}
|
|
462
429
|
switch (e) {
|
|
463
430
|
case "web_app_open_tg_link":
|
|
@@ -466,27 +433,27 @@ function v(e, t, s) {
|
|
|
466
433
|
case "web_app_set_background_color":
|
|
467
434
|
case "web_app_set_header_color":
|
|
468
435
|
case "web_app_trigger_haptic_feedback":
|
|
469
|
-
return
|
|
436
|
+
return _("6.1", t);
|
|
470
437
|
case "web_app_open_popup":
|
|
471
|
-
return
|
|
438
|
+
return _("6.2", t);
|
|
472
439
|
case "web_app_close_scan_qr_popup":
|
|
473
440
|
case "web_app_open_scan_qr_popup":
|
|
474
441
|
case "web_app_read_text_from_clipboard":
|
|
475
|
-
return
|
|
442
|
+
return _("6.4", t);
|
|
476
443
|
case "web_app_switch_inline_query":
|
|
477
|
-
return
|
|
444
|
+
return _("6.7", t);
|
|
478
445
|
case "web_app_invoke_custom_method":
|
|
479
446
|
case "web_app_request_write_access":
|
|
480
447
|
case "web_app_request_phone":
|
|
481
|
-
return
|
|
448
|
+
return _("6.9", t);
|
|
482
449
|
case "web_app_setup_settings_button":
|
|
483
|
-
return
|
|
450
|
+
return _("6.10", t);
|
|
484
451
|
case "web_app_biometry_get_info":
|
|
485
452
|
case "web_app_biometry_open_settings":
|
|
486
453
|
case "web_app_biometry_request_access":
|
|
487
454
|
case "web_app_biometry_request_auth":
|
|
488
455
|
case "web_app_biometry_update_token":
|
|
489
|
-
return
|
|
456
|
+
return _("7.2", t);
|
|
490
457
|
default:
|
|
491
458
|
return [
|
|
492
459
|
"iframe_ready",
|
|
@@ -503,89 +470,88 @@ function v(e, t, s) {
|
|
|
503
470
|
].includes(e);
|
|
504
471
|
}
|
|
505
472
|
}
|
|
506
|
-
function
|
|
507
|
-
return "external" in e &&
|
|
473
|
+
function lt(e) {
|
|
474
|
+
return "external" in e && q(e.external) && "notify" in e.external && typeof e.external.notify == "function";
|
|
508
475
|
}
|
|
509
|
-
function
|
|
510
|
-
return "TelegramWebviewProxy" in e &&
|
|
476
|
+
function dt(e) {
|
|
477
|
+
return "TelegramWebviewProxy" in e && q(e.TelegramWebviewProxy) && "postEvent" in e.TelegramWebviewProxy && typeof e.TelegramWebviewProxy.postEvent == "function";
|
|
511
478
|
}
|
|
512
|
-
function
|
|
479
|
+
function _t() {
|
|
513
480
|
try {
|
|
514
481
|
return window.self !== window.top;
|
|
515
482
|
} catch {
|
|
516
483
|
return !0;
|
|
517
484
|
}
|
|
518
485
|
}
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
486
|
+
const ae = "https://web.telegram.org";
|
|
487
|
+
let ft = ae;
|
|
488
|
+
function ts(e) {
|
|
489
|
+
ft = e;
|
|
522
490
|
}
|
|
523
|
-
function
|
|
524
|
-
return
|
|
491
|
+
function ce() {
|
|
492
|
+
return ft;
|
|
525
493
|
}
|
|
526
494
|
function R(e, t, s) {
|
|
527
495
|
let n = {}, r;
|
|
528
|
-
t
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
if (_t(window)) {
|
|
496
|
+
if (!t && !s ? n = {} : t && s ? (n = s, r = t) : t && ("targetOrigin" in t ? n = t : r = t), Gt("Posting event:", r ? { event: e, data: r } : { event: e }), _t())
|
|
497
|
+
return window.parent.postMessage(
|
|
498
|
+
JSON.stringify({ eventType: e, eventData: r }),
|
|
499
|
+
n.targetOrigin || ce()
|
|
500
|
+
);
|
|
501
|
+
if (lt(window)) {
|
|
535
502
|
window.external.notify(JSON.stringify({ eventType: e, eventData: r }));
|
|
536
503
|
return;
|
|
537
504
|
}
|
|
538
|
-
if (
|
|
505
|
+
if (dt(window)) {
|
|
539
506
|
window.TelegramWebviewProxy.postEvent(e, JSON.stringify(r));
|
|
540
507
|
return;
|
|
541
508
|
}
|
|
542
|
-
throw
|
|
543
|
-
|
|
544
|
-
"Unable to determine current environment and possible way to send event. You are probably trying to use Mini Apps method outside
|
|
509
|
+
throw f(
|
|
510
|
+
Ft,
|
|
511
|
+
"Unable to determine current environment and possible way to send event. You are probably trying to use Mini Apps method outside the Telegram application environment."
|
|
545
512
|
);
|
|
546
513
|
}
|
|
547
|
-
function
|
|
514
|
+
function he(e) {
|
|
548
515
|
return (t, s) => {
|
|
549
516
|
if (!v(t, e))
|
|
550
|
-
throw
|
|
551
|
-
if (
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
`Parameter "${n}" of "${t}" method is unsupported in Mini Apps version ${e}`
|
|
557
|
-
);
|
|
558
|
-
}
|
|
517
|
+
throw f(jt, `Method "${t}" is unsupported in Mini Apps version ${e}`);
|
|
518
|
+
if (q(s) && t === "web_app_set_header_color" && "color" in s && !v(t, "color", e))
|
|
519
|
+
throw f(
|
|
520
|
+
zt,
|
|
521
|
+
`Parameter "color" of "${t}" method is unsupported in Mini Apps version ${e}`
|
|
522
|
+
);
|
|
559
523
|
return R(t, s);
|
|
560
524
|
};
|
|
561
525
|
}
|
|
562
|
-
function
|
|
526
|
+
function gt(e) {
|
|
563
527
|
return ({ req_id: t }) => t === e;
|
|
564
528
|
}
|
|
565
|
-
function
|
|
566
|
-
return
|
|
529
|
+
function bt(e) {
|
|
530
|
+
return f(Qt, `Timeout reached: ${e}ms`);
|
|
567
531
|
}
|
|
568
|
-
function
|
|
532
|
+
function wt(e, t) {
|
|
569
533
|
return Promise.race([
|
|
570
534
|
typeof e == "function" ? e() : e,
|
|
571
535
|
new Promise((s, n) => {
|
|
572
536
|
setTimeout(() => {
|
|
573
|
-
n(
|
|
537
|
+
n(bt(t));
|
|
574
538
|
}, t);
|
|
575
539
|
})
|
|
576
540
|
]);
|
|
577
541
|
}
|
|
578
|
-
async function
|
|
542
|
+
async function d(e) {
|
|
579
543
|
let t;
|
|
580
|
-
const s = new Promise((a) => {
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
544
|
+
const s = new Promise((a) => t = a), { event: n, capture: r, timeout: i } = e, [, o] = J(
|
|
545
|
+
// We need to iterate over all tracked events, and create their event listeners.
|
|
546
|
+
(Array.isArray(n) ? n : [n]).map((a) => b(a, (h) => {
|
|
547
|
+
(!r || (Array.isArray(n) ? r({
|
|
548
|
+
event: a,
|
|
549
|
+
payload: h
|
|
550
|
+
}) : r(h))) && t(h);
|
|
551
|
+
}))
|
|
586
552
|
);
|
|
587
553
|
try {
|
|
588
|
-
return (e.postEvent || R)(e.method, e.params), await (i ?
|
|
554
|
+
return (e.postEvent || R)(e.method, e.params), await (i ? wt(s, i) : s);
|
|
589
555
|
} finally {
|
|
590
556
|
o();
|
|
591
557
|
}
|
|
@@ -594,7 +560,7 @@ async function S(e, t, s, n = {}) {
|
|
|
594
560
|
const {
|
|
595
561
|
result: r,
|
|
596
562
|
error: i
|
|
597
|
-
} = await
|
|
563
|
+
} = await d({
|
|
598
564
|
...n,
|
|
599
565
|
method: "web_app_invoke_custom_method",
|
|
600
566
|
event: "custom_method_invoked",
|
|
@@ -603,30 +569,54 @@ async function S(e, t, s, n = {}) {
|
|
|
603
569
|
params: t,
|
|
604
570
|
req_id: s
|
|
605
571
|
},
|
|
606
|
-
capture:
|
|
572
|
+
capture: gt(s)
|
|
607
573
|
});
|
|
608
574
|
if (i)
|
|
609
|
-
throw
|
|
575
|
+
throw f(Jt, i);
|
|
610
576
|
return r;
|
|
611
577
|
}
|
|
612
578
|
function z(...e) {
|
|
613
579
|
return e.map((t) => {
|
|
614
580
|
if (typeof t == "string")
|
|
615
581
|
return t;
|
|
616
|
-
if (
|
|
582
|
+
if (q(t))
|
|
617
583
|
return z(Object.entries(t).map((s) => s[1] && s[0]));
|
|
618
584
|
if (Array.isArray(t))
|
|
619
585
|
return z(...t);
|
|
620
586
|
}).filter(Boolean).join(" ");
|
|
621
587
|
}
|
|
622
|
-
function
|
|
623
|
-
return e.reduce((t, s) => (
|
|
588
|
+
function es(...e) {
|
|
589
|
+
return e.reduce((t, s) => (q(s) && Object.entries(s).forEach(([n, r]) => {
|
|
624
590
|
const i = z(t[n], r);
|
|
625
591
|
i.length && (t[n] = i);
|
|
626
592
|
}), t), {});
|
|
627
593
|
}
|
|
628
|
-
function
|
|
629
|
-
|
|
594
|
+
function Q(e) {
|
|
595
|
+
return /^#[\da-f]{6}$/i.test(e);
|
|
596
|
+
}
|
|
597
|
+
function pe(e) {
|
|
598
|
+
return /^#[\da-f]{3}$/i.test(e);
|
|
599
|
+
}
|
|
600
|
+
function mt(e) {
|
|
601
|
+
const t = e.replace(/\s/g, "").toLowerCase();
|
|
602
|
+
if (Q(t))
|
|
603
|
+
return t;
|
|
604
|
+
if (pe(t)) {
|
|
605
|
+
let n = "#";
|
|
606
|
+
for (let r = 0; r < 3; r += 1)
|
|
607
|
+
n += t[1 + r].repeat(2);
|
|
608
|
+
return n;
|
|
609
|
+
}
|
|
610
|
+
const s = t.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/) || t.match(/^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),\d{1,3}\)$/);
|
|
611
|
+
if (!s)
|
|
612
|
+
throw new Error(`Value "${e}" does not satisfy any of known RGB formats.`);
|
|
613
|
+
return s.slice(1).reduce((n, r) => {
|
|
614
|
+
const i = parseInt(r, 10).toString(16);
|
|
615
|
+
return n + (i.length === 1 ? "0" : "") + i;
|
|
616
|
+
}, "#");
|
|
617
|
+
}
|
|
618
|
+
function yt(e) {
|
|
619
|
+
const t = mt(e);
|
|
630
620
|
return Math.sqrt(
|
|
631
621
|
[0.299, 0.587, 0.114].reduce((s, n, r) => {
|
|
632
622
|
const i = parseInt(t.slice(1 + r * 2, 1 + (r + 1) * 2), 16);
|
|
@@ -664,7 +654,7 @@ class ue {
|
|
|
664
654
|
return this.state[t];
|
|
665
655
|
}
|
|
666
656
|
}
|
|
667
|
-
class
|
|
657
|
+
class Y {
|
|
668
658
|
constructor(t) {
|
|
669
659
|
c(this, "state");
|
|
670
660
|
/**
|
|
@@ -682,20 +672,20 @@ class Z {
|
|
|
682
672
|
this.state = new ue(t), this.set = this.state.set.bind(this.state), this.get = this.state.get.bind(this.state), this.clone = this.state.clone.bind(this.state);
|
|
683
673
|
}
|
|
684
674
|
}
|
|
685
|
-
function
|
|
675
|
+
function vt(e, t) {
|
|
686
676
|
return (s) => v(t[s], e);
|
|
687
677
|
}
|
|
688
|
-
class
|
|
678
|
+
class Z extends Y {
|
|
689
679
|
constructor(s, n, r) {
|
|
690
680
|
super(s);
|
|
691
681
|
/**
|
|
692
682
|
* @returns True, if specified method is supported by the current component.
|
|
693
683
|
*/
|
|
694
684
|
c(this, "supports");
|
|
695
|
-
this.supports =
|
|
685
|
+
this.supports = vt(n, r);
|
|
696
686
|
}
|
|
697
687
|
}
|
|
698
|
-
class le extends
|
|
688
|
+
class le extends Z {
|
|
699
689
|
constructor(s, n, r) {
|
|
700
690
|
super({ isVisible: s }, n, {
|
|
701
691
|
show: "web_app_setup_back_button",
|
|
@@ -712,7 +702,7 @@ class le extends K {
|
|
|
712
702
|
* @param event - event to listen.
|
|
713
703
|
* @param listener - listener to remove.
|
|
714
704
|
*/
|
|
715
|
-
c(this, "off", (s, n) => s === "click" ?
|
|
705
|
+
c(this, "off", (s, n) => s === "click" ? L("back_button_pressed", n) : this.state.off(s, n));
|
|
716
706
|
this.postEvent = r;
|
|
717
707
|
}
|
|
718
708
|
set isVisible(s) {
|
|
@@ -737,28 +727,28 @@ class le extends K {
|
|
|
737
727
|
this.isVisible = !0;
|
|
738
728
|
}
|
|
739
729
|
}
|
|
740
|
-
const
|
|
741
|
-
function
|
|
730
|
+
const Et = x((e) => e instanceof Date ? e : new Date(y().parse(e) * 1e3), "Date");
|
|
731
|
+
function K(e, t) {
|
|
742
732
|
return new M((s) => {
|
|
743
733
|
if (typeof s != "string" && !(s instanceof URLSearchParams))
|
|
744
734
|
throw E();
|
|
745
735
|
const n = typeof s == "string" ? new URLSearchParams(s) : s;
|
|
746
|
-
return
|
|
736
|
+
return ht(e, (r) => {
|
|
747
737
|
const i = n.get(r);
|
|
748
738
|
return i === null ? void 0 : i;
|
|
749
739
|
});
|
|
750
740
|
}, !1, t);
|
|
751
741
|
}
|
|
752
|
-
const de =
|
|
742
|
+
const de = g({
|
|
753
743
|
id: y(),
|
|
754
|
-
type:
|
|
755
|
-
title:
|
|
744
|
+
type: p(),
|
|
745
|
+
title: p(),
|
|
756
746
|
photoUrl: {
|
|
757
|
-
type:
|
|
747
|
+
type: p().optional(),
|
|
758
748
|
from: "photo_url"
|
|
759
749
|
},
|
|
760
|
-
username:
|
|
761
|
-
}, "Chat").optional(),
|
|
750
|
+
username: p().optional()
|
|
751
|
+
}, "Chat").optional(), nt = g({
|
|
762
752
|
addedToAttachmentMenu: {
|
|
763
753
|
type: w().optional(),
|
|
764
754
|
from: "added_to_attachment_menu"
|
|
@@ -768,7 +758,7 @@ const de = d({
|
|
|
768
758
|
from: "allows_write_to_pm"
|
|
769
759
|
},
|
|
770
760
|
firstName: {
|
|
771
|
-
type:
|
|
761
|
+
type: p(),
|
|
772
762
|
from: "first_name"
|
|
773
763
|
},
|
|
774
764
|
id: y(),
|
|
@@ -781,23 +771,23 @@ const de = d({
|
|
|
781
771
|
from: "is_premium"
|
|
782
772
|
},
|
|
783
773
|
languageCode: {
|
|
784
|
-
type:
|
|
774
|
+
type: p().optional(),
|
|
785
775
|
from: "language_code"
|
|
786
776
|
},
|
|
787
777
|
lastName: {
|
|
788
|
-
type:
|
|
778
|
+
type: p().optional(),
|
|
789
779
|
from: "last_name"
|
|
790
780
|
},
|
|
791
781
|
photoUrl: {
|
|
792
|
-
type:
|
|
782
|
+
type: p().optional(),
|
|
793
783
|
from: "photo_url"
|
|
794
784
|
},
|
|
795
|
-
username:
|
|
785
|
+
username: p().optional()
|
|
796
786
|
}, "User").optional();
|
|
797
|
-
function
|
|
798
|
-
return
|
|
787
|
+
function xt() {
|
|
788
|
+
return K({
|
|
799
789
|
authDate: {
|
|
800
|
-
type:
|
|
790
|
+
type: Et(),
|
|
801
791
|
from: "auth_date"
|
|
802
792
|
},
|
|
803
793
|
canSendAfter: {
|
|
@@ -806,55 +796,56 @@ function Pt() {
|
|
|
806
796
|
},
|
|
807
797
|
chat: de,
|
|
808
798
|
chatInstance: {
|
|
809
|
-
type:
|
|
799
|
+
type: p().optional(),
|
|
810
800
|
from: "chat_instance"
|
|
811
801
|
},
|
|
812
802
|
chatType: {
|
|
813
|
-
type:
|
|
803
|
+
type: p().optional(),
|
|
814
804
|
from: "chat_type"
|
|
815
805
|
},
|
|
816
|
-
hash:
|
|
806
|
+
hash: p(),
|
|
817
807
|
queryId: {
|
|
818
|
-
type:
|
|
808
|
+
type: p().optional(),
|
|
819
809
|
from: "query_id"
|
|
820
810
|
},
|
|
821
|
-
receiver:
|
|
811
|
+
receiver: nt,
|
|
822
812
|
startParam: {
|
|
823
|
-
type:
|
|
813
|
+
type: p().optional(),
|
|
824
814
|
from: "start_param"
|
|
825
815
|
},
|
|
826
|
-
user:
|
|
816
|
+
user: nt
|
|
827
817
|
}, "InitData");
|
|
828
818
|
}
|
|
829
|
-
|
|
819
|
+
const _e = x((e) => mt(p().parse(e)), "rgb");
|
|
820
|
+
function fe(e) {
|
|
830
821
|
return e.replace(/_[a-z]/g, (t) => t[1].toUpperCase());
|
|
831
822
|
}
|
|
832
|
-
function
|
|
823
|
+
function ge(e) {
|
|
833
824
|
return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);
|
|
834
825
|
}
|
|
835
|
-
const
|
|
826
|
+
const Pt = x(
|
|
836
827
|
(e) => {
|
|
837
|
-
const t =
|
|
838
|
-
return Object.entries(
|
|
828
|
+
const t = _e().optional();
|
|
829
|
+
return Object.entries(pt(e)).reduce((s, [n, r]) => (s[fe(n)] = t.parse(r), s), {});
|
|
839
830
|
},
|
|
840
831
|
"ThemeParams"
|
|
841
832
|
);
|
|
842
|
-
function
|
|
843
|
-
return
|
|
833
|
+
function X(e) {
|
|
834
|
+
return K({
|
|
844
835
|
botInline: {
|
|
845
836
|
type: w().optional(),
|
|
846
837
|
from: "tgWebAppBotInline"
|
|
847
838
|
},
|
|
848
839
|
initData: {
|
|
849
|
-
type:
|
|
840
|
+
type: xt().optional(),
|
|
850
841
|
from: "tgWebAppData"
|
|
851
842
|
},
|
|
852
843
|
initDataRaw: {
|
|
853
|
-
type:
|
|
844
|
+
type: p().optional(),
|
|
854
845
|
from: "tgWebAppData"
|
|
855
846
|
},
|
|
856
847
|
platform: {
|
|
857
|
-
type:
|
|
848
|
+
type: p(),
|
|
858
849
|
from: "tgWebAppPlatform"
|
|
859
850
|
},
|
|
860
851
|
showSettings: {
|
|
@@ -862,60 +853,60 @@ function tt(e) {
|
|
|
862
853
|
from: "tgWebAppShowSettings"
|
|
863
854
|
},
|
|
864
855
|
startParam: {
|
|
865
|
-
type:
|
|
856
|
+
type: p().optional(),
|
|
866
857
|
from: "tgWebAppStartParam"
|
|
867
858
|
},
|
|
868
859
|
themeParams: {
|
|
869
|
-
type:
|
|
860
|
+
type: Pt(),
|
|
870
861
|
from: "tgWebAppThemeParams"
|
|
871
862
|
},
|
|
872
863
|
version: {
|
|
873
|
-
type:
|
|
864
|
+
type: p(),
|
|
874
865
|
from: "tgWebAppVersion"
|
|
875
866
|
}
|
|
876
867
|
}).parse(e);
|
|
877
868
|
}
|
|
878
|
-
function
|
|
879
|
-
return
|
|
869
|
+
function St(e) {
|
|
870
|
+
return X(
|
|
880
871
|
e.replace(/^[^?#]*[?#]/, "").replace(/[?#]/g, "&")
|
|
881
872
|
);
|
|
882
873
|
}
|
|
883
|
-
function
|
|
884
|
-
return
|
|
874
|
+
function be() {
|
|
875
|
+
return St(window.location.href);
|
|
885
876
|
}
|
|
886
|
-
function
|
|
877
|
+
function Ct() {
|
|
887
878
|
return performance.getEntriesByType("navigation")[0];
|
|
888
879
|
}
|
|
889
|
-
function
|
|
890
|
-
const e =
|
|
880
|
+
function we() {
|
|
881
|
+
const e = Ct();
|
|
891
882
|
if (!e)
|
|
892
883
|
throw new Error("Unable to get first navigation entry.");
|
|
893
|
-
return
|
|
884
|
+
return St(e.name);
|
|
894
885
|
}
|
|
895
|
-
function
|
|
886
|
+
function Tt(e) {
|
|
896
887
|
return `tma.js/${e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`)}`;
|
|
897
888
|
}
|
|
898
|
-
function
|
|
899
|
-
sessionStorage.setItem(
|
|
889
|
+
function Rt(e, t) {
|
|
890
|
+
sessionStorage.setItem(Tt(e), JSON.stringify(t));
|
|
900
891
|
}
|
|
901
|
-
function
|
|
902
|
-
const t = sessionStorage.getItem(
|
|
892
|
+
function At(e) {
|
|
893
|
+
const t = sessionStorage.getItem(Tt(e));
|
|
903
894
|
try {
|
|
904
895
|
return t ? JSON.parse(t) : void 0;
|
|
905
896
|
} catch {
|
|
906
897
|
}
|
|
907
898
|
}
|
|
908
|
-
function
|
|
909
|
-
return
|
|
899
|
+
function me() {
|
|
900
|
+
return X(At("launchParams") || "");
|
|
910
901
|
}
|
|
911
|
-
function
|
|
902
|
+
function It(e) {
|
|
912
903
|
return JSON.stringify(
|
|
913
904
|
Object.fromEntries(
|
|
914
|
-
Object.entries(e).map(([t, s]) => [
|
|
905
|
+
Object.entries(e).map(([t, s]) => [ge(t), s])
|
|
915
906
|
)
|
|
916
907
|
);
|
|
917
908
|
}
|
|
918
|
-
function
|
|
909
|
+
function ye(e) {
|
|
919
910
|
const {
|
|
920
911
|
initDataRaw: t,
|
|
921
912
|
themeParams: s,
|
|
@@ -924,44 +915,44 @@ function me(e) {
|
|
|
924
915
|
showSettings: i,
|
|
925
916
|
startParam: o,
|
|
926
917
|
botInline: a
|
|
927
|
-
} = e,
|
|
928
|
-
return
|
|
918
|
+
} = e, h = new URLSearchParams();
|
|
919
|
+
return h.set("tgWebAppPlatform", n), h.set("tgWebAppThemeParams", It(s)), h.set("tgWebAppVersion", r), t && h.set("tgWebAppData", t), o && h.set("tgWebAppStartParam", o), typeof i == "boolean" && h.set("tgWebAppShowSettings", i ? "1" : "0"), typeof a == "boolean" && h.set("tgWebAppBotInline", a ? "1" : "0"), h.toString();
|
|
929
920
|
}
|
|
930
|
-
function
|
|
931
|
-
|
|
921
|
+
function qt(e) {
|
|
922
|
+
Rt("launchParams", ye(e));
|
|
932
923
|
}
|
|
933
|
-
function
|
|
924
|
+
function ve() {
|
|
934
925
|
for (const e of [
|
|
935
926
|
// Try to retrieve launch parameters from the current location. This method can return
|
|
936
927
|
// nothing in case, location was changed and then page was reloaded.
|
|
937
|
-
ge,
|
|
938
|
-
// Then, try using the lower level API - window.performance.
|
|
939
928
|
be,
|
|
929
|
+
// Then, try using the lower level API - window.performance.
|
|
930
|
+
we,
|
|
940
931
|
// Finally, try to extract launch parameters from the session storage.
|
|
941
|
-
|
|
932
|
+
me
|
|
942
933
|
])
|
|
943
934
|
try {
|
|
944
935
|
const t = e();
|
|
945
|
-
return
|
|
936
|
+
return qt(t), t;
|
|
946
937
|
} catch {
|
|
947
938
|
}
|
|
948
939
|
throw new Error("Unable to retrieve launch parameters from any known source.");
|
|
949
940
|
}
|
|
950
|
-
function
|
|
951
|
-
const e =
|
|
941
|
+
function kt() {
|
|
942
|
+
const e = Ct();
|
|
952
943
|
return !!(e && e.type === "reload");
|
|
953
944
|
}
|
|
954
|
-
function
|
|
945
|
+
function Ee() {
|
|
955
946
|
let e = 0;
|
|
956
947
|
return () => (e += 1).toString();
|
|
957
948
|
}
|
|
958
|
-
const [
|
|
949
|
+
const [xe] = ot(Ee);
|
|
959
950
|
function l(e, t) {
|
|
960
951
|
return () => {
|
|
961
|
-
const s =
|
|
952
|
+
const s = ve(), n = {
|
|
962
953
|
...s,
|
|
963
|
-
postEvent:
|
|
964
|
-
createRequestId:
|
|
954
|
+
postEvent: he(s.version),
|
|
955
|
+
createRequestId: xe()
|
|
965
956
|
};
|
|
966
957
|
if (typeof e == "function")
|
|
967
958
|
return e(n);
|
|
@@ -970,25 +961,25 @@ function l(e, t) {
|
|
|
970
961
|
// State should only be passed only in case, current page was reloaded. If we don't add
|
|
971
962
|
// this check, state restoration will work improperly in the web version of Telegram,
|
|
972
963
|
// when we are always working in the same "session" (tab).
|
|
973
|
-
state:
|
|
964
|
+
state: kt() ? At(e) : void 0,
|
|
974
965
|
addCleanup: r
|
|
975
|
-
}),
|
|
976
|
-
u.on("change", (
|
|
977
|
-
|
|
966
|
+
}), h = (u) => (o || r(
|
|
967
|
+
u.on("change", (Bt) => {
|
|
968
|
+
Rt(e, Bt);
|
|
978
969
|
})
|
|
979
970
|
), u);
|
|
980
971
|
return [
|
|
981
|
-
a instanceof Promise ? a.then(
|
|
972
|
+
a instanceof Promise ? a.then(h) : h(a),
|
|
982
973
|
i
|
|
983
974
|
];
|
|
984
975
|
};
|
|
985
976
|
}
|
|
986
|
-
const
|
|
977
|
+
const ss = l("backButton", ({
|
|
987
978
|
postEvent: e,
|
|
988
979
|
version: t,
|
|
989
980
|
state: s = { isVisible: !1 }
|
|
990
981
|
}) => new le(s.isVisible, t, e));
|
|
991
|
-
class
|
|
982
|
+
class k extends Z {
|
|
992
983
|
constructor() {
|
|
993
984
|
super(...arguments);
|
|
994
985
|
/**
|
|
@@ -1001,7 +992,7 @@ class q extends K {
|
|
|
1001
992
|
c(this, "off", this.state.off.bind(this.state));
|
|
1002
993
|
}
|
|
1003
994
|
}
|
|
1004
|
-
function
|
|
995
|
+
function Nt(e) {
|
|
1005
996
|
const t = e.available ? e : {
|
|
1006
997
|
available: !1,
|
|
1007
998
|
device_id: "",
|
|
@@ -1019,7 +1010,7 @@ function Dt(e) {
|
|
|
1019
1010
|
accessGranted: t.access_granted
|
|
1020
1011
|
};
|
|
1021
1012
|
}
|
|
1022
|
-
class
|
|
1013
|
+
class Pe extends k {
|
|
1023
1014
|
constructor({ postEvent: s, version: n, ...r }) {
|
|
1024
1015
|
super(r, n, {
|
|
1025
1016
|
auth: "web_app_biometry_request_auth",
|
|
@@ -1060,7 +1051,7 @@ class xe extends q {
|
|
|
1060
1051
|
reason: s,
|
|
1061
1052
|
...n
|
|
1062
1053
|
}) {
|
|
1063
|
-
return this.authPromise || (this.authPromise =
|
|
1054
|
+
return this.authPromise || (this.authPromise = d({
|
|
1064
1055
|
...n,
|
|
1065
1056
|
method: "web_app_biometry_request_auth",
|
|
1066
1057
|
event: "biometry_auth_requested",
|
|
@@ -1094,14 +1085,14 @@ class xe extends q {
|
|
|
1094
1085
|
* @returns Promise with true, if access was granted.
|
|
1095
1086
|
*/
|
|
1096
1087
|
requestAccess({ reason: s, ...n } = {}) {
|
|
1097
|
-
return this.accessPromise || (this.accessPromise =
|
|
1088
|
+
return this.accessPromise || (this.accessPromise = d({
|
|
1098
1089
|
...n,
|
|
1099
1090
|
postEvent: this.postEvent,
|
|
1100
1091
|
method: "web_app_biometry_request_access",
|
|
1101
1092
|
event: "biometry_info_received",
|
|
1102
1093
|
params: { reason: s || "" }
|
|
1103
1094
|
}).then((r) => {
|
|
1104
|
-
const i =
|
|
1095
|
+
const i = Nt(r);
|
|
1105
1096
|
return this.set(i), i.accessGranted;
|
|
1106
1097
|
}).finally(() => this.accessPromise = void 0)), this.accessPromise;
|
|
1107
1098
|
}
|
|
@@ -1123,7 +1114,7 @@ class xe extends q {
|
|
|
1123
1114
|
*/
|
|
1124
1115
|
async updateToken({ token: s, ...n } = {}) {
|
|
1125
1116
|
return ["removed", "updated"].includes(
|
|
1126
|
-
(await
|
|
1117
|
+
(await d({
|
|
1127
1118
|
...n,
|
|
1128
1119
|
postEvent: this.postEvent,
|
|
1129
1120
|
method: "web_app_biometry_update_token",
|
|
@@ -1133,19 +1124,19 @@ class xe extends q {
|
|
|
1133
1124
|
);
|
|
1134
1125
|
}
|
|
1135
1126
|
}
|
|
1136
|
-
async function
|
|
1137
|
-
return
|
|
1138
|
-
await
|
|
1127
|
+
async function Se(e) {
|
|
1128
|
+
return Nt(
|
|
1129
|
+
await d({
|
|
1139
1130
|
...e || {},
|
|
1140
1131
|
method: "web_app_biometry_get_info",
|
|
1141
1132
|
event: "biometry_info_received"
|
|
1142
1133
|
})
|
|
1143
1134
|
);
|
|
1144
1135
|
}
|
|
1145
|
-
const
|
|
1136
|
+
const ns = l(
|
|
1146
1137
|
"biometryManager",
|
|
1147
|
-
async ({ postEvent: e, version: t, state: s }) => new
|
|
1148
|
-
...s || v("web_app_biometry_get_info", t) ? s || await
|
|
1138
|
+
async ({ postEvent: e, version: t, state: s }) => new Pe({
|
|
1139
|
+
...s || v("web_app_biometry_get_info", t) ? s || await Se({ timeout: 1e3 }) : {
|
|
1149
1140
|
available: !1,
|
|
1150
1141
|
accessGranted: !1,
|
|
1151
1142
|
accessRequested: !1,
|
|
@@ -1156,7 +1147,7 @@ const ss = l(
|
|
|
1156
1147
|
postEvent: e
|
|
1157
1148
|
})
|
|
1158
1149
|
);
|
|
1159
|
-
class
|
|
1150
|
+
class tt extends Y {
|
|
1160
1151
|
constructor() {
|
|
1161
1152
|
super(...arguments);
|
|
1162
1153
|
/**
|
|
@@ -1169,7 +1160,7 @@ class et extends Z {
|
|
|
1169
1160
|
c(this, "off", this.state.off.bind(this.state));
|
|
1170
1161
|
}
|
|
1171
1162
|
}
|
|
1172
|
-
class
|
|
1163
|
+
class Ce extends tt {
|
|
1173
1164
|
constructor(t, s) {
|
|
1174
1165
|
super({ isConfirmationNeeded: t }), this.postEvent = s;
|
|
1175
1166
|
}
|
|
@@ -1196,23 +1187,23 @@ class Se extends et {
|
|
|
1196
1187
|
this.isConfirmationNeeded = !0;
|
|
1197
1188
|
}
|
|
1198
1189
|
}
|
|
1199
|
-
const
|
|
1190
|
+
const rs = l(
|
|
1200
1191
|
"closingBehavior",
|
|
1201
1192
|
({
|
|
1202
1193
|
postEvent: e,
|
|
1203
1194
|
state: t = { isConfirmationNeeded: !1 }
|
|
1204
|
-
}) => new
|
|
1195
|
+
}) => new Ce(t.isConfirmationNeeded, e)
|
|
1205
1196
|
);
|
|
1206
|
-
class
|
|
1197
|
+
class et {
|
|
1207
1198
|
constructor(t, s) {
|
|
1208
1199
|
/**
|
|
1209
1200
|
* @returns True, if specified method is supported by the current component.
|
|
1210
1201
|
*/
|
|
1211
1202
|
c(this, "supports");
|
|
1212
|
-
this.supports =
|
|
1203
|
+
this.supports = vt(t, s);
|
|
1213
1204
|
}
|
|
1214
1205
|
}
|
|
1215
|
-
function
|
|
1206
|
+
function Te(e) {
|
|
1216
1207
|
if (Array.isArray(e))
|
|
1217
1208
|
return e;
|
|
1218
1209
|
if (typeof e == "string")
|
|
@@ -1224,9 +1215,9 @@ function Ce(e) {
|
|
|
1224
1215
|
}
|
|
1225
1216
|
throw E();
|
|
1226
1217
|
}
|
|
1227
|
-
class
|
|
1218
|
+
class Re extends M {
|
|
1228
1219
|
constructor(s, n, r) {
|
|
1229
|
-
super(
|
|
1220
|
+
super(Te, n, r);
|
|
1230
1221
|
c(this, "itemParser");
|
|
1231
1222
|
this.itemParser = typeof s == "function" ? s : s.parse.bind(s);
|
|
1232
1223
|
}
|
|
@@ -1244,13 +1235,13 @@ class Te extends M {
|
|
|
1244
1235
|
return this.itemParser = typeof s == "function" ? s : s.parse.bind(s), this;
|
|
1245
1236
|
}
|
|
1246
1237
|
}
|
|
1247
|
-
function
|
|
1248
|
-
return new
|
|
1238
|
+
function Ae(e) {
|
|
1239
|
+
return new Re((t) => t, !1, e);
|
|
1249
1240
|
}
|
|
1250
|
-
function
|
|
1241
|
+
function rt(e, t) {
|
|
1251
1242
|
return Object.fromEntries(e.map((s) => [s, t]));
|
|
1252
1243
|
}
|
|
1253
|
-
class
|
|
1244
|
+
class Ie extends et {
|
|
1254
1245
|
constructor(t, s, n) {
|
|
1255
1246
|
super(t, {
|
|
1256
1247
|
delete: "web_app_invoke_custom_method",
|
|
@@ -1278,7 +1269,7 @@ class Ae extends st {
|
|
|
1278
1269
|
* @param options - request execution options.
|
|
1279
1270
|
*/
|
|
1280
1271
|
async getKeys(t = {}) {
|
|
1281
|
-
return
|
|
1272
|
+
return Ae().of(p()).parse(
|
|
1282
1273
|
await S(
|
|
1283
1274
|
"getStorageKeys",
|
|
1284
1275
|
{},
|
|
@@ -1290,13 +1281,13 @@ class Ae extends st {
|
|
|
1290
1281
|
async get(t, s = {}) {
|
|
1291
1282
|
const n = Array.isArray(t) ? t : [t];
|
|
1292
1283
|
if (!n.length)
|
|
1293
|
-
return
|
|
1284
|
+
return rt(n, "");
|
|
1294
1285
|
const r = await S(
|
|
1295
1286
|
"getStorageValues",
|
|
1296
1287
|
{ keys: n },
|
|
1297
1288
|
this.createRequestId(),
|
|
1298
1289
|
{ ...s, postEvent: this.postEvent }
|
|
1299
|
-
), i =
|
|
1290
|
+
), i = g(rt(n, p()), "CloudStorageData").parse(r);
|
|
1300
1291
|
return Array.isArray(t) ? i : i[t];
|
|
1301
1292
|
}
|
|
1302
1293
|
/**
|
|
@@ -1314,10 +1305,10 @@ class Ae extends st {
|
|
|
1314
1305
|
);
|
|
1315
1306
|
}
|
|
1316
1307
|
}
|
|
1317
|
-
const
|
|
1318
|
-
({ createRequestId: e, postEvent: t, version: s }) => new
|
|
1308
|
+
const is = l(
|
|
1309
|
+
({ createRequestId: e, postEvent: t, version: s }) => new Ie(s, e, t)
|
|
1319
1310
|
);
|
|
1320
|
-
class
|
|
1311
|
+
class qe extends et {
|
|
1321
1312
|
constructor(t, s) {
|
|
1322
1313
|
super(t, {
|
|
1323
1314
|
impactOccurred: "web_app_trigger_haptic_feedback",
|
|
@@ -1359,10 +1350,10 @@ class Ie extends st {
|
|
|
1359
1350
|
this.postEvent("web_app_trigger_haptic_feedback", { type: "selection_change" });
|
|
1360
1351
|
}
|
|
1361
1352
|
}
|
|
1362
|
-
const
|
|
1363
|
-
({ version: e, postEvent: t }) => new
|
|
1353
|
+
const os = l(
|
|
1354
|
+
({ version: e, postEvent: t }) => new qe(e, t)
|
|
1364
1355
|
);
|
|
1365
|
-
class
|
|
1356
|
+
class ke {
|
|
1366
1357
|
constructor(t) {
|
|
1367
1358
|
this.initData = t;
|
|
1368
1359
|
}
|
|
@@ -1435,13 +1426,13 @@ class qe {
|
|
|
1435
1426
|
return this.initData.user;
|
|
1436
1427
|
}
|
|
1437
1428
|
}
|
|
1438
|
-
const
|
|
1439
|
-
({ initData: e }) => e ? new
|
|
1429
|
+
const as = l(
|
|
1430
|
+
({ initData: e }) => e ? new ke(e) : void 0
|
|
1440
1431
|
);
|
|
1441
|
-
function
|
|
1442
|
-
return
|
|
1432
|
+
function cs(e) {
|
|
1433
|
+
return xt().parse(e);
|
|
1443
1434
|
}
|
|
1444
|
-
class
|
|
1435
|
+
class Ne extends k {
|
|
1445
1436
|
constructor(t, s, n) {
|
|
1446
1437
|
super({ isOpened: t }, s, { open: "web_app_open_invoice" }), this.postEvent = n;
|
|
1447
1438
|
}
|
|
@@ -1471,7 +1462,7 @@ class ke extends q {
|
|
|
1471
1462
|
}
|
|
1472
1463
|
this.isOpened = !0;
|
|
1473
1464
|
try {
|
|
1474
|
-
return (await
|
|
1465
|
+
return (await d({
|
|
1475
1466
|
method: "web_app_open_invoice",
|
|
1476
1467
|
event: "invoice_closed",
|
|
1477
1468
|
params: { slug: n },
|
|
@@ -1485,10 +1476,10 @@ class ke extends q {
|
|
|
1485
1476
|
}
|
|
1486
1477
|
}
|
|
1487
1478
|
}
|
|
1488
|
-
const
|
|
1489
|
-
({ version: e, postEvent: t }) => new
|
|
1479
|
+
const hs = l(
|
|
1480
|
+
({ version: e, postEvent: t }) => new Ne(!1, e, t)
|
|
1490
1481
|
);
|
|
1491
|
-
class
|
|
1482
|
+
class De extends Y {
|
|
1492
1483
|
constructor({ postEvent: s, ...n }) {
|
|
1493
1484
|
super(n);
|
|
1494
1485
|
c(this, "postEvent");
|
|
@@ -1503,7 +1494,7 @@ class Ne extends Z {
|
|
|
1503
1494
|
* @param event - event to listen.
|
|
1504
1495
|
* @param listener - listener to remove.
|
|
1505
1496
|
*/
|
|
1506
|
-
c(this, "off", (s, n) => s === "click" ?
|
|
1497
|
+
c(this, "off", (s, n) => s === "click" ? L("main_button_pressed", n) : this.state.off(s, n));
|
|
1507
1498
|
this.postEvent = s;
|
|
1508
1499
|
}
|
|
1509
1500
|
/**
|
|
@@ -1633,7 +1624,7 @@ class Ne extends Z {
|
|
|
1633
1624
|
return this.get("textColor");
|
|
1634
1625
|
}
|
|
1635
1626
|
}
|
|
1636
|
-
const
|
|
1627
|
+
const ps = l(
|
|
1637
1628
|
"mainButton",
|
|
1638
1629
|
({
|
|
1639
1630
|
postEvent: e,
|
|
@@ -1646,47 +1637,47 @@ const hs = l(
|
|
|
1646
1637
|
textColor: t.buttonTextColor || "#ffffff",
|
|
1647
1638
|
bgColor: t.buttonColor || "#000000"
|
|
1648
1639
|
}
|
|
1649
|
-
}) => new
|
|
1640
|
+
}) => new De({ ...s, postEvent: e })
|
|
1650
1641
|
);
|
|
1651
|
-
function
|
|
1652
|
-
return
|
|
1653
|
-
contact:
|
|
1642
|
+
function Me() {
|
|
1643
|
+
return K({
|
|
1644
|
+
contact: g({
|
|
1654
1645
|
userId: {
|
|
1655
1646
|
type: y(),
|
|
1656
1647
|
from: "user_id"
|
|
1657
1648
|
},
|
|
1658
1649
|
phoneNumber: {
|
|
1659
|
-
type:
|
|
1650
|
+
type: p(),
|
|
1660
1651
|
from: "phone_number"
|
|
1661
1652
|
},
|
|
1662
1653
|
firstName: {
|
|
1663
|
-
type:
|
|
1654
|
+
type: p(),
|
|
1664
1655
|
from: "first_name"
|
|
1665
1656
|
},
|
|
1666
1657
|
lastName: {
|
|
1667
|
-
type:
|
|
1658
|
+
type: p().optional(),
|
|
1668
1659
|
from: "last_name"
|
|
1669
1660
|
}
|
|
1670
1661
|
}),
|
|
1671
1662
|
authDate: {
|
|
1672
|
-
type:
|
|
1663
|
+
type: Et(),
|
|
1673
1664
|
from: "auth_date"
|
|
1674
1665
|
},
|
|
1675
|
-
hash:
|
|
1666
|
+
hash: p()
|
|
1676
1667
|
}, "RequestedContact");
|
|
1677
1668
|
}
|
|
1678
|
-
function
|
|
1669
|
+
function Dt(e, t) {
|
|
1679
1670
|
return (s) => {
|
|
1680
1671
|
const [n, r] = t[s];
|
|
1681
1672
|
return v(n, r, e);
|
|
1682
1673
|
};
|
|
1683
1674
|
}
|
|
1684
|
-
function
|
|
1675
|
+
function Ve(e) {
|
|
1685
1676
|
return new Promise((t) => {
|
|
1686
1677
|
setTimeout(t, e);
|
|
1687
1678
|
});
|
|
1688
1679
|
}
|
|
1689
|
-
class Le extends
|
|
1680
|
+
class Le extends k {
|
|
1690
1681
|
constructor({ postEvent: s, createRequestId: n, version: r, botInline: i, ...o }) {
|
|
1691
1682
|
super(o, r, {
|
|
1692
1683
|
requestPhoneAccess: "web_app_request_phone",
|
|
@@ -1706,7 +1697,7 @@ class Le extends q {
|
|
|
1706
1697
|
c(this, "supportsParam");
|
|
1707
1698
|
this.createRequestId = n, this.postEvent = s, this.botInline = i;
|
|
1708
1699
|
const a = this.supports.bind(this);
|
|
1709
|
-
this.supports = (
|
|
1700
|
+
this.supports = (h) => a(h) ? h !== "switchInlineQuery" || i : !1, this.supportsParam = Dt(r, {
|
|
1710
1701
|
"setHeaderColor.color": ["web_app_set_header_color", "color"]
|
|
1711
1702
|
});
|
|
1712
1703
|
}
|
|
@@ -1717,7 +1708,7 @@ class Le extends q {
|
|
|
1717
1708
|
async getRequestedContact({
|
|
1718
1709
|
timeout: s = 1e4
|
|
1719
1710
|
} = {}) {
|
|
1720
|
-
return
|
|
1711
|
+
return Me().parse(
|
|
1721
1712
|
await S(
|
|
1722
1713
|
"getRequestedContact",
|
|
1723
1714
|
{},
|
|
@@ -1735,9 +1726,10 @@ class Le extends q {
|
|
|
1735
1726
|
}
|
|
1736
1727
|
/**
|
|
1737
1728
|
* Closes the Mini App.
|
|
1729
|
+
* @param returnBack - should the application be wrapped into the bottom bar.
|
|
1738
1730
|
*/
|
|
1739
|
-
close() {
|
|
1740
|
-
this.postEvent("web_app_close");
|
|
1731
|
+
close(s) {
|
|
1732
|
+
this.postEvent("web_app_close", { return_back: s });
|
|
1741
1733
|
}
|
|
1742
1734
|
/**
|
|
1743
1735
|
* The Mini App header color.
|
|
@@ -1754,10 +1746,10 @@ class Le extends q {
|
|
|
1754
1746
|
return this.botInline;
|
|
1755
1747
|
}
|
|
1756
1748
|
/**
|
|
1757
|
-
* True if current Mini App background color is recognized as dark.
|
|
1749
|
+
* True if the current Mini App background color is recognized as dark.
|
|
1758
1750
|
*/
|
|
1759
1751
|
get isDark() {
|
|
1760
|
-
return
|
|
1752
|
+
return yt(this.bgColor);
|
|
1761
1753
|
}
|
|
1762
1754
|
/**
|
|
1763
1755
|
* Informs the Telegram app that the Mini App is ready to be displayed.
|
|
@@ -1786,15 +1778,15 @@ class Le extends q {
|
|
|
1786
1778
|
throw new Error("Access denied.");
|
|
1787
1779
|
const r = Date.now() + s;
|
|
1788
1780
|
let i = 50;
|
|
1789
|
-
return
|
|
1781
|
+
return wt(async () => {
|
|
1790
1782
|
for (; Date.now() < r; ) {
|
|
1791
1783
|
try {
|
|
1792
1784
|
return await this.getRequestedContact();
|
|
1793
1785
|
} catch {
|
|
1794
1786
|
}
|
|
1795
|
-
await
|
|
1787
|
+
await Ve(i), i += 50;
|
|
1796
1788
|
}
|
|
1797
|
-
throw
|
|
1789
|
+
throw bt(s);
|
|
1798
1790
|
}, s);
|
|
1799
1791
|
}
|
|
1800
1792
|
/**
|
|
@@ -1807,7 +1799,7 @@ class Le extends q {
|
|
|
1807
1799
|
* @see requestContact
|
|
1808
1800
|
*/
|
|
1809
1801
|
async requestPhoneAccess(s = {}) {
|
|
1810
|
-
return this.requestPhoneAccessPromise || (this.requestPhoneAccessPromise =
|
|
1802
|
+
return this.requestPhoneAccessPromise || (this.requestPhoneAccessPromise = d({
|
|
1811
1803
|
...s,
|
|
1812
1804
|
method: "web_app_request_phone",
|
|
1813
1805
|
event: "phone_requested",
|
|
@@ -1819,7 +1811,7 @@ class Le extends q {
|
|
|
1819
1811
|
* @param options - additional options.
|
|
1820
1812
|
*/
|
|
1821
1813
|
async requestWriteAccess(s = {}) {
|
|
1822
|
-
return this.requestWriteAccessPromise || (this.requestWriteAccessPromise =
|
|
1814
|
+
return this.requestWriteAccessPromise || (this.requestWriteAccessPromise = d({
|
|
1823
1815
|
...s,
|
|
1824
1816
|
method: "web_app_request_write_access",
|
|
1825
1817
|
event: "write_access_requested",
|
|
@@ -1849,7 +1841,7 @@ class Le extends q {
|
|
|
1849
1841
|
* @param color - color key or RGB color.
|
|
1850
1842
|
*/
|
|
1851
1843
|
setHeaderColor(s) {
|
|
1852
|
-
this.postEvent("web_app_set_header_color",
|
|
1844
|
+
this.postEvent("web_app_set_header_color", Q(s) ? { color: s } : { color_key: s }), this.set("headerColor", s);
|
|
1853
1845
|
}
|
|
1854
1846
|
/**
|
|
1855
1847
|
* Updates current Mini App background color.
|
|
@@ -1877,7 +1869,7 @@ class Le extends q {
|
|
|
1877
1869
|
this.postEvent("web_app_switch_inline_query", { query: s, chat_types: n });
|
|
1878
1870
|
}
|
|
1879
1871
|
}
|
|
1880
|
-
const
|
|
1872
|
+
const us = l(
|
|
1881
1873
|
"miniApp",
|
|
1882
1874
|
({
|
|
1883
1875
|
themeParams: e,
|
|
@@ -1889,7 +1881,7 @@ const ps = l(
|
|
|
1889
1881
|
...n
|
|
1890
1882
|
}) => new Le({ ...n, ...s, botInline: t })
|
|
1891
1883
|
);
|
|
1892
|
-
function
|
|
1884
|
+
function $e(e) {
|
|
1893
1885
|
const t = e.message.trim(), s = (e.title || "").trim(), n = e.buttons || [];
|
|
1894
1886
|
let r;
|
|
1895
1887
|
if (s.length > 64)
|
|
@@ -1905,15 +1897,15 @@ function Ve(e) {
|
|
|
1905
1897
|
if (!i.type || i.type === "default" || i.type === "destructive") {
|
|
1906
1898
|
const a = i.text.trim();
|
|
1907
1899
|
if (!a.length || a.length > 64) {
|
|
1908
|
-
const
|
|
1909
|
-
throw new Error(`Button text with type "${
|
|
1900
|
+
const h = i.type || "default";
|
|
1901
|
+
throw new Error(`Button text with type "${h}" has incorrect size: ${i.text.length}`);
|
|
1910
1902
|
}
|
|
1911
1903
|
return { ...i, text: a, id: o };
|
|
1912
1904
|
}
|
|
1913
1905
|
return { ...i, id: o };
|
|
1914
1906
|
}) : r = [{ type: "close", id: "" }], { title: s, message: t, buttons: r };
|
|
1915
1907
|
}
|
|
1916
|
-
class
|
|
1908
|
+
class Be extends k {
|
|
1917
1909
|
constructor(t, s, n) {
|
|
1918
1910
|
super({ isOpened: t }, s, { open: "web_app_open_popup" }), this.postEvent = n;
|
|
1919
1911
|
}
|
|
@@ -1942,11 +1934,11 @@ class $e extends q {
|
|
|
1942
1934
|
throw new Error("Popup is already opened.");
|
|
1943
1935
|
this.isOpened = !0;
|
|
1944
1936
|
try {
|
|
1945
|
-
const { button_id: s = null } = await
|
|
1937
|
+
const { button_id: s = null } = await d({
|
|
1946
1938
|
event: "popup_closed",
|
|
1947
1939
|
method: "web_app_open_popup",
|
|
1948
1940
|
postEvent: this.postEvent,
|
|
1949
|
-
params:
|
|
1941
|
+
params: $e(t)
|
|
1950
1942
|
});
|
|
1951
1943
|
return s;
|
|
1952
1944
|
} finally {
|
|
@@ -1954,10 +1946,10 @@ class $e extends q {
|
|
|
1954
1946
|
}
|
|
1955
1947
|
}
|
|
1956
1948
|
}
|
|
1957
|
-
const
|
|
1958
|
-
({ postEvent: e, version: t }) => new
|
|
1949
|
+
const ls = l(
|
|
1950
|
+
({ postEvent: e, version: t }) => new Be(!1, t, e)
|
|
1959
1951
|
);
|
|
1960
|
-
class
|
|
1952
|
+
class We extends k {
|
|
1961
1953
|
constructor(t, s, n) {
|
|
1962
1954
|
super({ isOpened: t }, s, {
|
|
1963
1955
|
close: "web_app_close_scan_qr_popup",
|
|
@@ -1965,7 +1957,7 @@ class Be extends q {
|
|
|
1965
1957
|
}), this.postEvent = n;
|
|
1966
1958
|
}
|
|
1967
1959
|
/**
|
|
1968
|
-
* Closes scanner.
|
|
1960
|
+
* Closes the scanner.
|
|
1969
1961
|
*/
|
|
1970
1962
|
close() {
|
|
1971
1963
|
this.postEvent("web_app_close_scan_qr_popup"), this.isOpened = !1;
|
|
@@ -1974,18 +1966,18 @@ class Be extends q {
|
|
|
1974
1966
|
this.set("isOpened", t);
|
|
1975
1967
|
}
|
|
1976
1968
|
/**
|
|
1977
|
-
* Returns true
|
|
1969
|
+
* Returns true if the scanner is currently opened.
|
|
1978
1970
|
*/
|
|
1979
1971
|
get isOpened() {
|
|
1980
1972
|
return this.get("isOpened");
|
|
1981
1973
|
}
|
|
1982
1974
|
async open(t) {
|
|
1983
1975
|
if (this.isOpened)
|
|
1984
|
-
throw new Error("
|
|
1976
|
+
throw new Error("The scanner is already opened");
|
|
1985
1977
|
const { text: s, capture: n } = (typeof t == "string" ? { text: t } : t) || {};
|
|
1986
1978
|
this.isOpened = !0;
|
|
1987
1979
|
try {
|
|
1988
|
-
const i = (await
|
|
1980
|
+
const i = (await d({
|
|
1989
1981
|
method: "web_app_open_scan_qr_popup",
|
|
1990
1982
|
event: ["qr_text_received", "scan_qr_popup_closed"],
|
|
1991
1983
|
postEvent: this.postEvent,
|
|
@@ -1995,15 +1987,16 @@ class Be extends q {
|
|
|
1995
1987
|
}
|
|
1996
1988
|
}) || {}).data || null;
|
|
1997
1989
|
return i && this.close(), i;
|
|
1998
|
-
}
|
|
1999
|
-
|
|
1990
|
+
} finally {
|
|
1991
|
+
this.isOpened = !1;
|
|
2000
1992
|
}
|
|
2001
1993
|
}
|
|
1994
|
+
// TODO: Streaming mode, allowing to scan several QRs until closed.
|
|
2002
1995
|
}
|
|
2003
|
-
const
|
|
2004
|
-
({ version: e, postEvent: t }) => new
|
|
1996
|
+
const ds = l(
|
|
1997
|
+
({ version: e, postEvent: t }) => new We(!1, e, t)
|
|
2005
1998
|
);
|
|
2006
|
-
class
|
|
1999
|
+
class Ue extends Z {
|
|
2007
2000
|
constructor(s, n, r) {
|
|
2008
2001
|
super({ isVisible: s }, n, {
|
|
2009
2002
|
show: "web_app_setup_settings_button",
|
|
@@ -2020,7 +2013,7 @@ class We extends K {
|
|
|
2020
2013
|
* @param event - event to listen.
|
|
2021
2014
|
* @param listener - listener to remove.
|
|
2022
2015
|
*/
|
|
2023
|
-
c(this, "off", (s, n) => s === "click" ?
|
|
2016
|
+
c(this, "off", (s, n) => s === "click" ? L("settings_button_pressed", n) : this.state.off(s, n));
|
|
2024
2017
|
this.postEvent = r;
|
|
2025
2018
|
}
|
|
2026
2019
|
set isVisible(s) {
|
|
@@ -2045,18 +2038,18 @@ class We extends K {
|
|
|
2045
2038
|
this.isVisible = !0;
|
|
2046
2039
|
}
|
|
2047
2040
|
}
|
|
2048
|
-
const
|
|
2041
|
+
const _s = l(
|
|
2049
2042
|
"settingsButton",
|
|
2050
2043
|
({
|
|
2051
2044
|
version: e,
|
|
2052
2045
|
postEvent: t,
|
|
2053
2046
|
state: s = { isVisible: !1 }
|
|
2054
|
-
}) => new
|
|
2047
|
+
}) => new Ue(s.isVisible, e, t)
|
|
2055
2048
|
);
|
|
2056
|
-
function
|
|
2057
|
-
return
|
|
2049
|
+
function Mt(e) {
|
|
2050
|
+
return Pt().parse(e);
|
|
2058
2051
|
}
|
|
2059
|
-
class
|
|
2052
|
+
class He extends tt {
|
|
2060
2053
|
/**
|
|
2061
2054
|
* @since v6.10
|
|
2062
2055
|
*/
|
|
@@ -2095,7 +2088,7 @@ class Ue extends et {
|
|
|
2095
2088
|
* value is calculated according to theme bg color.
|
|
2096
2089
|
*/
|
|
2097
2090
|
get isDark() {
|
|
2098
|
-
return !this.bgColor ||
|
|
2091
|
+
return !this.bgColor || yt(this.bgColor);
|
|
2099
2092
|
}
|
|
2100
2093
|
get linkColor() {
|
|
2101
2094
|
return this.get("linkColor");
|
|
@@ -2127,7 +2120,7 @@ class Ue extends et {
|
|
|
2127
2120
|
*/
|
|
2128
2121
|
listen() {
|
|
2129
2122
|
return b("theme_changed", (t) => {
|
|
2130
|
-
this.set(
|
|
2123
|
+
this.set(Mt(t.theme_params));
|
|
2131
2124
|
});
|
|
2132
2125
|
}
|
|
2133
2126
|
/**
|
|
@@ -2140,49 +2133,51 @@ class Ue extends et {
|
|
|
2140
2133
|
return this.get("textColor");
|
|
2141
2134
|
}
|
|
2142
2135
|
}
|
|
2143
|
-
const
|
|
2136
|
+
const fs = l(
|
|
2144
2137
|
"themeParams",
|
|
2145
2138
|
({ themeParams: e, state: t = e, addCleanup: s }) => {
|
|
2146
|
-
const n = new
|
|
2139
|
+
const n = new He(t);
|
|
2147
2140
|
return s(n.listen()), n;
|
|
2148
2141
|
}
|
|
2149
2142
|
);
|
|
2150
|
-
function
|
|
2151
|
-
return
|
|
2143
|
+
function gs(e = {}) {
|
|
2144
|
+
return d({
|
|
2152
2145
|
...e,
|
|
2153
2146
|
method: "web_app_request_theme",
|
|
2154
2147
|
event: "theme_changed"
|
|
2155
|
-
}).then(
|
|
2148
|
+
}).then(Mt);
|
|
2156
2149
|
}
|
|
2157
|
-
|
|
2150
|
+
function A(e, t) {
|
|
2151
|
+
return e.startsWith(t) ? e : `${t}${e}`;
|
|
2152
|
+
}
|
|
2153
|
+
function I(e) {
|
|
2154
|
+
return new URL(
|
|
2155
|
+
typeof e == "string" ? e : `${e.pathname || ""}${A(e.search || "", "?")}${A(e.hash || "", "#")}`,
|
|
2156
|
+
"http://a"
|
|
2157
|
+
);
|
|
2158
|
+
}
|
|
2159
|
+
class Oe extends et {
|
|
2158
2160
|
constructor(s, n, r) {
|
|
2159
2161
|
super(s, { readTextFromClipboard: "web_app_read_text_from_clipboard" });
|
|
2160
2162
|
/**
|
|
2161
2163
|
* Checks if specified method parameter is supported by current component.
|
|
2162
2164
|
*/
|
|
2163
2165
|
c(this, "supportsParam");
|
|
2164
|
-
this.version = s, this.createRequestId = n, this.postEvent = r, this.supportsParam =
|
|
2166
|
+
this.version = s, this.createRequestId = n, this.postEvent = r, this.supportsParam = Dt(s, {
|
|
2165
2167
|
"openLink.tryInstantView": ["web_app_open_link", "try_instant_view"]
|
|
2166
2168
|
});
|
|
2167
2169
|
}
|
|
2168
|
-
/**
|
|
2169
|
-
* Opens a link in an external browser. The Mini App will not be closed.
|
|
2170
|
-
*
|
|
2171
|
-
* Note that this method can be called only in response to the user
|
|
2172
|
-
* interaction with the Mini App interface (e.g. click inside the Mini App
|
|
2173
|
-
* or on the main button).
|
|
2174
|
-
* @param url - URL to be opened.
|
|
2175
|
-
* @param tryInstantView
|
|
2176
|
-
*/
|
|
2177
2170
|
openLink(s, n) {
|
|
2178
|
-
const r =
|
|
2171
|
+
const r = I(s).toString();
|
|
2179
2172
|
if (!v("web_app_open_link", this.version)) {
|
|
2180
2173
|
window.open(r, "_blank");
|
|
2181
2174
|
return;
|
|
2182
2175
|
}
|
|
2176
|
+
const i = typeof n == "boolean" ? { tryInstantView: n } : n || {};
|
|
2183
2177
|
this.postEvent("web_app_open_link", {
|
|
2184
2178
|
url: r,
|
|
2185
|
-
|
|
2179
|
+
try_browser: i.tryBrowser,
|
|
2180
|
+
try_instant_view: i.tryInstantView
|
|
2186
2181
|
});
|
|
2187
2182
|
}
|
|
2188
2183
|
/**
|
|
@@ -2210,12 +2205,12 @@ class Oe extends st {
|
|
|
2210
2205
|
async readTextFromClipboard() {
|
|
2211
2206
|
const s = this.createRequestId(), {
|
|
2212
2207
|
data: n = null
|
|
2213
|
-
} = await
|
|
2208
|
+
} = await d({
|
|
2214
2209
|
method: "web_app_read_text_from_clipboard",
|
|
2215
2210
|
event: "clipboard_text_received",
|
|
2216
2211
|
postEvent: this.postEvent,
|
|
2217
2212
|
params: { req_id: s },
|
|
2218
|
-
capture:
|
|
2213
|
+
capture: gt(s)
|
|
2219
2214
|
});
|
|
2220
2215
|
return n;
|
|
2221
2216
|
}
|
|
@@ -2231,11 +2226,11 @@ class Oe extends st {
|
|
|
2231
2226
|
*/
|
|
2232
2227
|
shareURL(s, n) {
|
|
2233
2228
|
this.openTelegramLink(
|
|
2234
|
-
"https://t.me/share/url?" + new URLSearchParams({ url: s, text: n || "" }).toString()
|
|
2229
|
+
"https://t.me/share/url?" + new URLSearchParams({ url: s, text: n || "" }).toString().replace(/\+/g, "%20")
|
|
2235
2230
|
);
|
|
2236
2231
|
}
|
|
2237
2232
|
}
|
|
2238
|
-
const
|
|
2233
|
+
const bs = l(
|
|
2239
2234
|
({ version: e, postEvent: t, createRequestId: s }) => new Oe(e, s, t)
|
|
2240
2235
|
);
|
|
2241
2236
|
async function Vt(e = {}) {
|
|
@@ -2243,7 +2238,7 @@ async function Vt(e = {}) {
|
|
|
2243
2238
|
is_expanded: t,
|
|
2244
2239
|
is_state_stable: s,
|
|
2245
2240
|
...n
|
|
2246
|
-
} = await
|
|
2241
|
+
} = await d({
|
|
2247
2242
|
...e,
|
|
2248
2243
|
method: "web_app_request_viewport",
|
|
2249
2244
|
event: "viewport_changed"
|
|
@@ -2253,7 +2248,7 @@ async function Vt(e = {}) {
|
|
|
2253
2248
|
function P(e) {
|
|
2254
2249
|
return e < 0 ? 0 : e;
|
|
2255
2250
|
}
|
|
2256
|
-
class
|
|
2251
|
+
class Ge extends tt {
|
|
2257
2252
|
constructor({ postEvent: s, stableHeight: n, height: r, width: i, isExpanded: o }) {
|
|
2258
2253
|
super({
|
|
2259
2254
|
height: P(r),
|
|
@@ -2362,7 +2357,7 @@ class He extends et {
|
|
|
2362
2357
|
return this.stableHeight === this.height;
|
|
2363
2358
|
}
|
|
2364
2359
|
}
|
|
2365
|
-
const
|
|
2360
|
+
const ws = l(
|
|
2366
2361
|
"viewport",
|
|
2367
2362
|
async ({ state: e, platform: t, postEvent: s, addCleanup: n }) => {
|
|
2368
2363
|
let r = !1, i = 0, o = 0, a = 0;
|
|
@@ -2374,28 +2369,28 @@ const bs = l(
|
|
|
2374
2369
|
const u = await Vt({ timeout: 1e3, postEvent: s });
|
|
2375
2370
|
r = u.isExpanded, i = u.height, o = u.width, a = u.isStateStable ? i : 0;
|
|
2376
2371
|
}
|
|
2377
|
-
const
|
|
2372
|
+
const h = new Ge({
|
|
2378
2373
|
postEvent: s,
|
|
2379
2374
|
height: i,
|
|
2380
2375
|
width: o,
|
|
2381
2376
|
stableHeight: a,
|
|
2382
2377
|
isExpanded: r
|
|
2383
2378
|
});
|
|
2384
|
-
return n(
|
|
2379
|
+
return n(h.listen()), h;
|
|
2385
2380
|
}
|
|
2386
2381
|
);
|
|
2387
2382
|
function m(e, t) {
|
|
2388
2383
|
document.documentElement.style.setProperty(e, t);
|
|
2389
2384
|
}
|
|
2390
|
-
function
|
|
2385
|
+
function ms(e, t, s) {
|
|
2391
2386
|
s || (s = (a) => `--tg-${a}-color`);
|
|
2392
2387
|
const n = s("header"), r = s("bg"), i = () => {
|
|
2393
2388
|
const { headerColor: a } = e;
|
|
2394
|
-
if (
|
|
2389
|
+
if (Q(a))
|
|
2395
2390
|
m(n, a);
|
|
2396
2391
|
else {
|
|
2397
|
-
const { bgColor:
|
|
2398
|
-
a === "bg_color" &&
|
|
2392
|
+
const { bgColor: h, secondaryBgColor: u } = t;
|
|
2393
|
+
a === "bg_color" && h ? m(n, h) : a === "secondary_bg_color" && u && m(n, u);
|
|
2399
2394
|
}
|
|
2400
2395
|
m(r, e.bgColor);
|
|
2401
2396
|
}, o = [
|
|
@@ -2404,7 +2399,7 @@ function ws(e, t, s) {
|
|
|
2404
2399
|
];
|
|
2405
2400
|
return i(), () => o.forEach((a) => a());
|
|
2406
2401
|
}
|
|
2407
|
-
function
|
|
2402
|
+
function ys(e, t) {
|
|
2408
2403
|
t || (t = (n) => `--tg-theme-${n.replace(/[A-Z]/g, (r) => `-${r.toLowerCase()}`)}`);
|
|
2409
2404
|
const s = () => {
|
|
2410
2405
|
Object.entries(e.getState()).forEach(([n, r]) => {
|
|
@@ -2413,20 +2408,20 @@ function ms(e, t) {
|
|
|
2413
2408
|
};
|
|
2414
2409
|
return s(), e.on("change", s);
|
|
2415
2410
|
}
|
|
2416
|
-
function
|
|
2411
|
+
function vs(e, t) {
|
|
2417
2412
|
t || (t = (u) => `--tg-viewport-${u}`);
|
|
2418
2413
|
const [
|
|
2419
2414
|
s,
|
|
2420
2415
|
n,
|
|
2421
2416
|
r
|
|
2422
|
-
] = ["height", "width", "stable-height"].map((u) => t(u)), i = () => m(s, `${e.height}px`), o = () => m(n, `${e.width}px`), a = () => m(r, `${e.stableHeight}px`),
|
|
2417
|
+
] = ["height", "width", "stable-height"].map((u) => t(u)), i = () => m(s, `${e.height}px`), o = () => m(n, `${e.width}px`), a = () => m(r, `${e.stableHeight}px`), h = [
|
|
2423
2418
|
e.on("change:height", i),
|
|
2424
2419
|
e.on("change:width", o),
|
|
2425
2420
|
e.on("change:stableHeight", a)
|
|
2426
2421
|
];
|
|
2427
|
-
return i(), o(), a(), () =>
|
|
2422
|
+
return i(), o(), a(), () => h.forEach((u) => u());
|
|
2428
2423
|
}
|
|
2429
|
-
function
|
|
2424
|
+
function Es(e = !0) {
|
|
2430
2425
|
const t = [
|
|
2431
2426
|
b("reload_iframe", () => {
|
|
2432
2427
|
R("iframe_will_reload"), window.location.reload();
|
|
@@ -2443,27 +2438,27 @@ function vs(e = !0) {
|
|
|
2443
2438
|
}
|
|
2444
2439
|
return R("iframe_ready", { reload_supported: !0 }), s;
|
|
2445
2440
|
}
|
|
2446
|
-
function
|
|
2441
|
+
function xs() {
|
|
2447
2442
|
return typeof window > "u";
|
|
2448
2443
|
}
|
|
2449
|
-
async function
|
|
2450
|
-
if (
|
|
2444
|
+
async function Ps() {
|
|
2445
|
+
if (dt(window))
|
|
2451
2446
|
return !0;
|
|
2452
2447
|
try {
|
|
2453
|
-
return await
|
|
2448
|
+
return await d({ method: "web_app_request_theme", event: "theme_changed", timeout: 100 }), !0;
|
|
2454
2449
|
} catch {
|
|
2455
2450
|
return !1;
|
|
2456
2451
|
}
|
|
2457
2452
|
}
|
|
2458
|
-
function
|
|
2459
|
-
const t = typeof e == "string" ?
|
|
2460
|
-
|
|
2453
|
+
function Ss(e) {
|
|
2454
|
+
const t = typeof e == "string" ? X(e) : e;
|
|
2455
|
+
qt(t);
|
|
2461
2456
|
function s(r) {
|
|
2462
2457
|
if (typeof r == "string")
|
|
2463
2458
|
try {
|
|
2464
|
-
const { eventType: i } =
|
|
2459
|
+
const { eventType: i } = ut(r);
|
|
2465
2460
|
i === "web_app_request_theme" && j("theme_changed", {
|
|
2466
|
-
theme_params: JSON.parse(
|
|
2461
|
+
theme_params: JSON.parse(It(t.themeParams))
|
|
2467
2462
|
}), i === "web_app_request_viewport" && j("viewport_changed", {
|
|
2468
2463
|
width: window.innerWidth,
|
|
2469
2464
|
height: window.innerHeight,
|
|
@@ -2473,14 +2468,14 @@ function Ps(e) {
|
|
|
2473
2468
|
} catch {
|
|
2474
2469
|
}
|
|
2475
2470
|
}
|
|
2476
|
-
if (
|
|
2471
|
+
if (_t()) {
|
|
2477
2472
|
const r = window.parent.postMessage.bind(window.parent);
|
|
2478
2473
|
window.parent.postMessage = (i) => {
|
|
2479
2474
|
s(i), r(i);
|
|
2480
2475
|
};
|
|
2481
2476
|
return;
|
|
2482
2477
|
}
|
|
2483
|
-
if (
|
|
2478
|
+
if (lt(window)) {
|
|
2484
2479
|
const r = window.external.notify.bind(window.external);
|
|
2485
2480
|
window.external.notify = (i) => {
|
|
2486
2481
|
s(i), r(i);
|
|
@@ -2495,11 +2490,11 @@ function Ps(e) {
|
|
|
2495
2490
|
}
|
|
2496
2491
|
};
|
|
2497
2492
|
}
|
|
2498
|
-
function
|
|
2493
|
+
function je(e) {
|
|
2499
2494
|
return e instanceof D;
|
|
2500
2495
|
}
|
|
2501
|
-
function
|
|
2502
|
-
return
|
|
2496
|
+
function Cs(e, t) {
|
|
2497
|
+
return je(e) && e.type === t;
|
|
2503
2498
|
}
|
|
2504
2499
|
function $(e, t) {
|
|
2505
2500
|
let s, n, r;
|
|
@@ -2509,7 +2504,7 @@ function $(e, t) {
|
|
|
2509
2504
|
params: n
|
|
2510
2505
|
});
|
|
2511
2506
|
}
|
|
2512
|
-
class
|
|
2507
|
+
class ze {
|
|
2513
2508
|
constructor(t, s, n = R) {
|
|
2514
2509
|
/**
|
|
2515
2510
|
* Navigation history.
|
|
@@ -2533,10 +2528,10 @@ class je {
|
|
|
2533
2528
|
*/
|
|
2534
2529
|
c(this, "off", this.ee.off.bind(this.ee));
|
|
2535
2530
|
if (this._index = s, this.postEvent = n, t.length === 0)
|
|
2536
|
-
throw
|
|
2531
|
+
throw f(Zt, "History should not be empty.");
|
|
2537
2532
|
if (s < 0 || s >= t.length)
|
|
2538
|
-
throw
|
|
2539
|
-
|
|
2533
|
+
throw f(
|
|
2534
|
+
Kt,
|
|
2540
2535
|
"Index should not be zero and higher or equal than history size."
|
|
2541
2536
|
);
|
|
2542
2537
|
this.history = t.map((r) => $(r, ""));
|
|
@@ -2558,7 +2553,7 @@ class je {
|
|
|
2558
2553
|
* Prevents current navigator from controlling the BackButton visibility state.
|
|
2559
2554
|
*/
|
|
2560
2555
|
detach() {
|
|
2561
|
-
this.attached = !1,
|
|
2556
|
+
this.attached = !1, L("back_button_pressed", this.back);
|
|
2562
2557
|
}
|
|
2563
2558
|
/**
|
|
2564
2559
|
* Goes to the next history item.
|
|
@@ -2657,17 +2652,8 @@ function B({
|
|
|
2657
2652
|
}) {
|
|
2658
2653
|
return { ...e || { hash: "", search: "" }, ...t };
|
|
2659
2654
|
}
|
|
2660
|
-
function A(e, t) {
|
|
2661
|
-
return e.startsWith(t) ? e : `${t}${e}`;
|
|
2662
|
-
}
|
|
2663
|
-
function k(e) {
|
|
2664
|
-
return new URL(
|
|
2665
|
-
typeof e == "string" ? e : `${e.pathname || ""}${A(e.search || "", "?")}${A(e.hash || "", "#")}`,
|
|
2666
|
-
"http://a"
|
|
2667
|
-
);
|
|
2668
|
-
}
|
|
2669
2655
|
function N(e) {
|
|
2670
|
-
const t = typeof e == "string" ? e.startsWith("/") : !!(e.pathname && e.pathname.startsWith("/")), s =
|
|
2656
|
+
const t = typeof e == "string" ? e.startsWith("/") : !!(e.pathname && e.pathname.startsWith("/")), s = I(e);
|
|
2671
2657
|
return `${t ? s.pathname : s.pathname.slice(1)}${s.search}${s.hash}`;
|
|
2672
2658
|
}
|
|
2673
2659
|
function W(e, t, s) {
|
|
@@ -2690,18 +2676,18 @@ async function C(e) {
|
|
|
2690
2676
|
})
|
|
2691
2677
|
]);
|
|
2692
2678
|
}
|
|
2693
|
-
async function
|
|
2679
|
+
async function Fe() {
|
|
2694
2680
|
if (window.history.length <= 1 || (window.history.pushState(null, ""), await C(1 - window.history.length)))
|
|
2695
2681
|
return;
|
|
2696
2682
|
let t = await C(-1);
|
|
2697
2683
|
for (; t; )
|
|
2698
2684
|
t = await C(-1);
|
|
2699
2685
|
}
|
|
2700
|
-
function
|
|
2701
|
-
return
|
|
2686
|
+
function Lt(e) {
|
|
2687
|
+
return I(e).pathname;
|
|
2702
2688
|
}
|
|
2703
|
-
const
|
|
2704
|
-
class
|
|
2689
|
+
const it = 0, U = 1, H = 2;
|
|
2690
|
+
class $t {
|
|
2705
2691
|
constructor(t, s, { postEvent: n, hashMode: r = "classic", base: i } = {}) {
|
|
2706
2692
|
c(this, "navigator");
|
|
2707
2693
|
c(this, "ee", new T());
|
|
@@ -2718,7 +2704,7 @@ class Bt {
|
|
|
2718
2704
|
c(this, "onPopState", ({ state: t }) => {
|
|
2719
2705
|
if (t === null)
|
|
2720
2706
|
return this.push(this.parsePath(window.location.href));
|
|
2721
|
-
t ===
|
|
2707
|
+
t === it ? window.history.forward() : t === U && this.back(), t === H && this.forward();
|
|
2722
2708
|
});
|
|
2723
2709
|
/**
|
|
2724
2710
|
* Underlying navigator change event listener.
|
|
@@ -2743,13 +2729,13 @@ class Bt {
|
|
|
2743
2729
|
* Removes event listener.
|
|
2744
2730
|
*/
|
|
2745
2731
|
c(this, "off", this.ee.off.bind(this.ee));
|
|
2746
|
-
this.navigator = new
|
|
2732
|
+
this.navigator = new ze(
|
|
2747
2733
|
t.map((o) => W(o, "/")),
|
|
2748
2734
|
s,
|
|
2749
2735
|
n
|
|
2750
2736
|
), this.navigator.on("change", (o) => {
|
|
2751
2737
|
this.onNavigatorChange(o);
|
|
2752
|
-
}), this.hashMode = r, this.base =
|
|
2738
|
+
}), this.hashMode = r, this.base = Lt(i || "");
|
|
2753
2739
|
}
|
|
2754
2740
|
/**
|
|
2755
2741
|
* Attaches current navigator to the browser history allowing navigator to manipulate it.
|
|
@@ -2876,8 +2862,8 @@ class Bt {
|
|
|
2876
2862
|
* // { pathname: '/tma', search: '?is=cool', hash: '#yeah' }
|
|
2877
2863
|
*/
|
|
2878
2864
|
parsePath(t) {
|
|
2879
|
-
let s =
|
|
2880
|
-
return this.hashMode && (s =
|
|
2865
|
+
let s = I(t);
|
|
2866
|
+
return this.hashMode && (s = I(s.hash.slice(1))), {
|
|
2881
2867
|
pathname: s.pathname,
|
|
2882
2868
|
search: s.search,
|
|
2883
2869
|
hash: s.hash
|
|
@@ -2906,7 +2892,7 @@ class Bt {
|
|
|
2906
2892
|
async syncHistory() {
|
|
2907
2893
|
window.removeEventListener("popstate", this.onPopState);
|
|
2908
2894
|
const { state: t } = this, s = this.renderPath(this);
|
|
2909
|
-
await
|
|
2895
|
+
await Fe(), this.hasPrev && this.hasNext ? (window.history.replaceState(U, ""), window.history.pushState(t, "", s), window.history.pushState(H, ""), await C(-1)) : this.hasPrev ? (window.history.replaceState(U, ""), window.history.pushState(t, "", s)) : this.hasNext ? (window.history.replaceState(t, s), window.history.pushState(H, ""), await C(-1)) : (window.history.replaceState(it, ""), window.history.pushState(t, "", s)), window.addEventListener("popstate", this.onPopState);
|
|
2910
2896
|
}
|
|
2911
2897
|
/**
|
|
2912
2898
|
* Current query parameters.
|
|
@@ -2924,34 +2910,34 @@ class Bt {
|
|
|
2924
2910
|
return (this.navigator.current.params || {}).state;
|
|
2925
2911
|
}
|
|
2926
2912
|
}
|
|
2927
|
-
function
|
|
2913
|
+
function Je(e) {
|
|
2928
2914
|
e || (e = {});
|
|
2929
2915
|
const { href: t, hash: s } = window.location;
|
|
2930
2916
|
let n = N(
|
|
2931
2917
|
e.hashMode === null ? t : s.includes("?") ? s.slice(1) : `?${s.slice(1)}`
|
|
2932
2918
|
);
|
|
2933
|
-
const r = e.base ?
|
|
2919
|
+
const r = e.base ? Lt(e.base) : void 0;
|
|
2934
2920
|
if (r) {
|
|
2935
2921
|
if (!n.startsWith(r))
|
|
2936
|
-
throw
|
|
2937
|
-
|
|
2922
|
+
throw f(
|
|
2923
|
+
Xt,
|
|
2938
2924
|
`Path "${n}" expected to be starting with "${r}"`
|
|
2939
2925
|
);
|
|
2940
2926
|
n = n.slice(r.length);
|
|
2941
2927
|
}
|
|
2942
|
-
return new
|
|
2928
|
+
return new $t([n], 0, e);
|
|
2943
2929
|
}
|
|
2944
|
-
function
|
|
2930
|
+
function Ts(e) {
|
|
2945
2931
|
const t = e.match(/#(.+)/);
|
|
2946
2932
|
return t ? t[1] : null;
|
|
2947
2933
|
}
|
|
2948
|
-
function
|
|
2949
|
-
if (
|
|
2934
|
+
function Qe(e, t) {
|
|
2935
|
+
if (kt()) {
|
|
2950
2936
|
const s = sessionStorage.getItem(e);
|
|
2951
2937
|
if (s)
|
|
2952
2938
|
try {
|
|
2953
2939
|
const { index: n, history: r } = JSON.parse(s);
|
|
2954
|
-
return new
|
|
2940
|
+
return new $t(
|
|
2955
2941
|
r,
|
|
2956
2942
|
n,
|
|
2957
2943
|
t
|
|
@@ -2960,10 +2946,10 @@ function Je(e, t) {
|
|
|
2960
2946
|
console.error("Unable to restore hash navigator state.", n);
|
|
2961
2947
|
}
|
|
2962
2948
|
}
|
|
2963
|
-
return
|
|
2949
|
+
return Je(t);
|
|
2964
2950
|
}
|
|
2965
|
-
function
|
|
2966
|
-
const s =
|
|
2951
|
+
function Rs(e, t) {
|
|
2952
|
+
const s = Qe(e, t), n = () => sessionStorage.setItem(e, JSON.stringify({
|
|
2967
2953
|
index: s.index,
|
|
2968
2954
|
history: s.history
|
|
2969
2955
|
}));
|
|
@@ -2971,106 +2957,106 @@ function Ts(e, t) {
|
|
|
2971
2957
|
}
|
|
2972
2958
|
export {
|
|
2973
2959
|
le as BackButton,
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2960
|
+
ze as BasicNavigator,
|
|
2961
|
+
Pe as BiometryManager,
|
|
2962
|
+
$t as BrowserNavigator,
|
|
2963
|
+
Ce as ClosingBehavior,
|
|
2964
|
+
Ie as CloudStorage,
|
|
2965
|
+
Xt as ERR_INVALID_PATH_BASE,
|
|
2966
|
+
Jt as ERR_INVOKE_CUSTOM_METHOD_RESPONSE,
|
|
2967
|
+
zt as ERR_METHOD_PARAMETER_UNSUPPORTED,
|
|
2968
|
+
jt as ERR_METHOD_UNSUPPORTED,
|
|
2969
|
+
Zt as ERR_NAVIGATION_HISTORY_EMPTY,
|
|
2970
|
+
Kt as ERR_NAVIGATION_INDEX_INVALID,
|
|
2971
|
+
Ke as ERR_NAVIGATION_ITEM_INVALID,
|
|
2972
|
+
ct as ERR_PARSE,
|
|
2973
|
+
Xe as ERR_SSR_INIT,
|
|
2974
|
+
Qt as ERR_TIMED_OUT,
|
|
2975
|
+
Yt as ERR_UNEXPECTED_TYPE,
|
|
2976
|
+
Ft as ERR_UNKNOWN_ENV,
|
|
2991
2977
|
T as EventEmitter,
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2978
|
+
qe as HapticFeedback,
|
|
2979
|
+
ke as InitData,
|
|
2980
|
+
Ne as Invoice,
|
|
2981
|
+
De as MainButton,
|
|
2996
2982
|
Le as MiniApp,
|
|
2997
|
-
|
|
2998
|
-
|
|
2983
|
+
Be as Popup,
|
|
2984
|
+
We as QRScanner,
|
|
2999
2985
|
D as SDKError,
|
|
3000
|
-
|
|
3001
|
-
|
|
2986
|
+
Ue as SettingsButton,
|
|
2987
|
+
He as ThemeParams,
|
|
3002
2988
|
Oe as Utils,
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
2989
|
+
Ge as Viewport,
|
|
2990
|
+
Ae as array,
|
|
2991
|
+
ms as bindMiniAppCSSVars,
|
|
2992
|
+
ys as bindThemeParamsCSSVars,
|
|
2993
|
+
vs as bindViewportCSSVars,
|
|
3008
2994
|
w as boolean,
|
|
3009
|
-
|
|
2995
|
+
gt as captureSameReq,
|
|
3010
2996
|
z as classNames,
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
2997
|
+
oe as compareVersions,
|
|
2998
|
+
Je as createBrowserNavigatorFromLocation,
|
|
2999
|
+
he as createPostEvent,
|
|
3000
|
+
I as createSafeURL,
|
|
3001
|
+
Et as date,
|
|
3002
|
+
Ts as getHash,
|
|
3003
|
+
Lt as getPathname,
|
|
3004
|
+
ss as initBackButton,
|
|
3005
|
+
ns as initBiometryManager,
|
|
3006
|
+
rs as initClosingBehavior,
|
|
3007
|
+
is as initCloudStorage,
|
|
3008
|
+
os as initHapticFeedback,
|
|
3009
|
+
as as initInitData,
|
|
3010
|
+
hs as initInvoice,
|
|
3011
|
+
ps as initMainButton,
|
|
3012
|
+
us as initMiniApp,
|
|
3013
|
+
Rs as initNavigator,
|
|
3014
|
+
ls as initPopup,
|
|
3015
|
+
ds as initQRScanner,
|
|
3016
|
+
_s as initSettingsButton,
|
|
3017
|
+
fs as initThemeParams,
|
|
3018
|
+
bs as initUtils,
|
|
3019
|
+
ws as initViewport,
|
|
3020
|
+
Es as initWeb,
|
|
3035
3021
|
S as invokeCustomMethod,
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3022
|
+
yt as isColorDark,
|
|
3023
|
+
_t as isIframe,
|
|
3024
|
+
kt as isPageReload,
|
|
3025
|
+
Q as isRGB,
|
|
3026
|
+
pe as isRGBShort,
|
|
3027
|
+
je as isSDKError,
|
|
3028
|
+
Cs as isSDKErrorOfType,
|
|
3029
|
+
xs as isSSR,
|
|
3030
|
+
Ps as isTMA,
|
|
3031
|
+
g as json,
|
|
3032
|
+
es as mergeClassNames,
|
|
3033
|
+
Ss as mockTelegramEnv,
|
|
3048
3034
|
y as number,
|
|
3049
|
-
|
|
3035
|
+
L as off,
|
|
3050
3036
|
b as on,
|
|
3051
|
-
|
|
3052
|
-
|
|
3053
|
-
|
|
3037
|
+
cs as parseInitData,
|
|
3038
|
+
X as parseLaunchParams,
|
|
3039
|
+
Mt as parseThemeParams,
|
|
3054
3040
|
R as postEvent,
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3041
|
+
d as request,
|
|
3042
|
+
Se as requestBiometryInfo,
|
|
3043
|
+
gs as requestThemeParams,
|
|
3058
3044
|
Vt as requestViewport,
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3045
|
+
ve as retrieveLaunchParams,
|
|
3046
|
+
_e as rgb,
|
|
3047
|
+
K as searchParams,
|
|
3048
|
+
ye as serializeLaunchParams,
|
|
3049
|
+
It as serializeThemeParams,
|
|
3064
3050
|
m as setCSSVar,
|
|
3065
|
-
|
|
3066
|
-
|
|
3067
|
-
|
|
3051
|
+
Ze as setDebug,
|
|
3052
|
+
ts as setTargetOrigin,
|
|
3053
|
+
p as string,
|
|
3068
3054
|
Ht as subscribe,
|
|
3069
3055
|
v as supports,
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3056
|
+
ce as targetOrigin,
|
|
3057
|
+
mt as toRGB,
|
|
3058
|
+
at as unsubscribe,
|
|
3073
3059
|
N as urlToPath,
|
|
3074
|
-
|
|
3060
|
+
wt as withTimeout
|
|
3075
3061
|
};
|
|
3076
3062
|
//# sourceMappingURL=index.js.map
|