@tma.js/sdk-solid 2.1.9 → 2.1.11
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/index.cjs +3 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +515 -529
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { createComponent as
|
|
2
|
-
var
|
|
3
|
-
function
|
|
1
|
+
import { createComponent as mt, mergeProps as pt, createContext as te, useContext as ee, createEffect as ut, onCleanup as lt, createResource as se, createMemo as dt, from as ne } from "solid-js";
|
|
2
|
+
var re = Object.defineProperty, ie = (e, t, s) => t in e ? re(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, c = (e, t, s) => ie(e, typeof t != "symbol" ? t + "" : t, s);
|
|
3
|
+
function bt(e, t) {
|
|
4
4
|
let s;
|
|
5
5
|
const n = () => {
|
|
6
6
|
s !== void 0 && t && t(s), s = void 0;
|
|
7
7
|
};
|
|
8
8
|
return [() => s === void 0 ? s = e(n) : s, n];
|
|
9
9
|
}
|
|
10
|
-
function
|
|
11
|
-
const t =
|
|
12
|
-
t.unsubscribe(e), s && !t.count &&
|
|
10
|
+
function vt(e) {
|
|
11
|
+
const t = H(), { count: s } = t;
|
|
12
|
+
t.unsubscribe(e), s && !t.count && xe();
|
|
13
13
|
}
|
|
14
|
-
function
|
|
15
|
-
return
|
|
14
|
+
function oe(e) {
|
|
15
|
+
return H().subscribe(e), () => vt(e);
|
|
16
16
|
}
|
|
17
|
-
class
|
|
17
|
+
class ae {
|
|
18
18
|
constructor(t, s = {}) {
|
|
19
19
|
this.scope = t, this.options = s;
|
|
20
20
|
}
|
|
@@ -54,18 +54,18 @@ class ce {
|
|
|
54
54
|
this.print("log", ...t);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
const X = new
|
|
57
|
+
const X = new ae("SDK", {
|
|
58
58
|
bgColor: "forestgreen",
|
|
59
59
|
textColor: "white"
|
|
60
60
|
});
|
|
61
61
|
let F = !1;
|
|
62
|
-
const
|
|
62
|
+
const _t = ({ name: e, payload: t }) => {
|
|
63
63
|
X.log("Event received:", t ? { name: e, payload: t } : { name: e });
|
|
64
64
|
};
|
|
65
|
-
function
|
|
66
|
-
F !== e && (F = e, e ?
|
|
65
|
+
function ce(e) {
|
|
66
|
+
F !== e && (F = e, e ? oe(_t) : vt(_t));
|
|
67
67
|
}
|
|
68
|
-
function
|
|
68
|
+
function he(...e) {
|
|
69
69
|
F && X.log(...e);
|
|
70
70
|
}
|
|
71
71
|
class k {
|
|
@@ -143,7 +143,7 @@ function Q(e, t, s) {
|
|
|
143
143
|
}
|
|
144
144
|
function tt(...e) {
|
|
145
145
|
let t = !1;
|
|
146
|
-
const s =
|
|
146
|
+
const s = e.flat(1);
|
|
147
147
|
return [
|
|
148
148
|
(n) => !t && s.push(n),
|
|
149
149
|
() => {
|
|
@@ -157,12 +157,12 @@ class $ extends Error {
|
|
|
157
157
|
super(s, { cause: n }), this.type = t, Object.setPrototypeOf(this, $.prototype);
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
-
function
|
|
160
|
+
function m(e, t, s) {
|
|
161
161
|
return new $(e, t, s);
|
|
162
162
|
}
|
|
163
|
-
const
|
|
163
|
+
const pe = "ERR_METHOD_UNSUPPORTED", ue = "ERR_METHOD_PARAMETER_UNSUPPORTED", le = "ERR_UNKNOWN_ENV", de = "ERR_INVOKE_CUSTOM_METHOD_RESPONSE", _e = "ERR_TIMED_OUT", ge = "ERR_UNEXPECTED_TYPE", yt = "ERR_PARSE", fe = "ERR_NAVIGATION_LIST_EMPTY", we = "ERR_NAVIGATION_CURSOR_INVALID", Js = "ERR_NAVIGATION_ITEM_INVALID", Fs = "ERR_SSR_INIT", me = "ERR_INVALID_PATH_BASE";
|
|
164
164
|
function S() {
|
|
165
|
-
return
|
|
165
|
+
return m(ge, "Value has unexpected type");
|
|
166
166
|
}
|
|
167
167
|
class L {
|
|
168
168
|
constructor(t, s, n) {
|
|
@@ -179,8 +179,8 @@ class L {
|
|
|
179
179
|
try {
|
|
180
180
|
return this.parser(t);
|
|
181
181
|
} catch (s) {
|
|
182
|
-
throw
|
|
183
|
-
|
|
182
|
+
throw m(
|
|
183
|
+
yt,
|
|
184
184
|
`Unable to parse value${this.type ? ` as ${this.type}` : ""}`,
|
|
185
185
|
s
|
|
186
186
|
);
|
|
@@ -203,7 +203,7 @@ const y = T((e) => {
|
|
|
203
203
|
return !1;
|
|
204
204
|
throw S();
|
|
205
205
|
}, "boolean");
|
|
206
|
-
function
|
|
206
|
+
function Et(e, t) {
|
|
207
207
|
const s = {};
|
|
208
208
|
for (const n in e) {
|
|
209
209
|
const r = e[n];
|
|
@@ -220,21 +220,21 @@ function Pt(e, t) {
|
|
|
220
220
|
const a = o(t(i));
|
|
221
221
|
a !== void 0 && (s[n] = a);
|
|
222
222
|
} catch (a) {
|
|
223
|
-
throw
|
|
223
|
+
throw m(yt, `Unable to parse field "${n}"`, a);
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
return s;
|
|
227
227
|
}
|
|
228
|
-
function
|
|
228
|
+
function Pt(e) {
|
|
229
229
|
let t = e;
|
|
230
230
|
if (typeof t == "string" && (t = JSON.parse(t)), typeof t != "object" || t === null || Array.isArray(t))
|
|
231
231
|
throw S();
|
|
232
232
|
return t;
|
|
233
233
|
}
|
|
234
|
-
function
|
|
234
|
+
function b(e, t) {
|
|
235
235
|
return new L((s) => {
|
|
236
|
-
const n =
|
|
237
|
-
return
|
|
236
|
+
const n = Pt(s);
|
|
237
|
+
return Et(e, (r) => n[r]);
|
|
238
238
|
}, !1, t);
|
|
239
239
|
}
|
|
240
240
|
const P = T((e) => {
|
|
@@ -246,43 +246,18 @@ const P = T((e) => {
|
|
|
246
246
|
return t;
|
|
247
247
|
}
|
|
248
248
|
throw S();
|
|
249
|
-
}, "number")
|
|
250
|
-
function st(e) {
|
|
251
|
-
return /^#[\da-f]{6}$/i.test(e);
|
|
252
|
-
}
|
|
253
|
-
function ve(e) {
|
|
254
|
-
return /^#[\da-f]{3}$/i.test(e);
|
|
255
|
-
}
|
|
256
|
-
function xt(e) {
|
|
257
|
-
const t = e.replace(/\s/g, "").toLowerCase();
|
|
258
|
-
if (st(t))
|
|
259
|
-
return t;
|
|
260
|
-
if (ve(t)) {
|
|
261
|
-
let n = "#";
|
|
262
|
-
for (let r = 0; r < 3; r += 1)
|
|
263
|
-
n += t[1 + r].repeat(2);
|
|
264
|
-
return n;
|
|
265
|
-
}
|
|
266
|
-
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}\)$/);
|
|
267
|
-
if (!s)
|
|
268
|
-
throw new Error(`Value "${e}" does not satisfy any of known RGB formats.`);
|
|
269
|
-
return s.slice(1).reduce((n, r) => {
|
|
270
|
-
const i = parseInt(r, 10).toString(16);
|
|
271
|
-
return n + (i.length === 1 ? "0" : "") + i;
|
|
272
|
-
}, "#");
|
|
273
|
-
}
|
|
274
|
-
const p = T((e) => {
|
|
249
|
+
}, "number"), p = T((e) => {
|
|
275
250
|
if (typeof e == "string" || typeof e == "number")
|
|
276
251
|
return e.toString();
|
|
277
252
|
throw S();
|
|
278
|
-
}, "string")
|
|
279
|
-
function
|
|
280
|
-
return
|
|
253
|
+
}, "string");
|
|
254
|
+
function xt(e) {
|
|
255
|
+
return b({
|
|
281
256
|
eventType: p(),
|
|
282
257
|
eventData: (t) => t
|
|
283
258
|
}).parse(e);
|
|
284
259
|
}
|
|
285
|
-
function
|
|
260
|
+
function be() {
|
|
286
261
|
["TelegramGameProxy_receiveEvent", "TelegramGameProxy", "Telegram"].forEach((e) => {
|
|
287
262
|
delete window[e];
|
|
288
263
|
});
|
|
@@ -294,7 +269,7 @@ function Y(e, t) {
|
|
|
294
269
|
source: window.parent
|
|
295
270
|
}));
|
|
296
271
|
}
|
|
297
|
-
function
|
|
272
|
+
function ve() {
|
|
298
273
|
[
|
|
299
274
|
["TelegramGameProxy_receiveEvent"],
|
|
300
275
|
// Windows Phone.
|
|
@@ -313,48 +288,38 @@ function Ee() {
|
|
|
313
288
|
});
|
|
314
289
|
});
|
|
315
290
|
}
|
|
316
|
-
const
|
|
317
|
-
clipboard_text_received:
|
|
291
|
+
const ye = {
|
|
292
|
+
clipboard_text_received: b({
|
|
318
293
|
req_id: p(),
|
|
319
294
|
data: (e) => e === null ? e : p().optional().parse(e)
|
|
320
295
|
}),
|
|
321
|
-
custom_method_invoked:
|
|
296
|
+
custom_method_invoked: b({
|
|
322
297
|
req_id: p(),
|
|
323
298
|
result: (e) => e,
|
|
324
299
|
error: p().optional()
|
|
325
300
|
}),
|
|
326
|
-
invoice_closed: f({ slug: p(), status: p() }),
|
|
327
|
-
phone_requested: f({ status: p() }),
|
|
328
301
|
popup_closed: {
|
|
329
302
|
parse(e) {
|
|
330
|
-
return
|
|
303
|
+
return b({
|
|
331
304
|
button_id: (t) => t == null ? void 0 : p().parse(t)
|
|
332
305
|
}).parse(e ?? {});
|
|
333
306
|
}
|
|
334
307
|
},
|
|
335
|
-
|
|
336
|
-
theme_changed: f({
|
|
337
|
-
theme_params: (e) => {
|
|
338
|
-
const t = Ct().optional();
|
|
339
|
-
return Object.entries(et(e)).reduce((s, [n, r]) => (s[n] = t.parse(r), s), {});
|
|
340
|
-
}
|
|
341
|
-
}),
|
|
342
|
-
viewport_changed: f({
|
|
308
|
+
viewport_changed: b({
|
|
343
309
|
height: P(),
|
|
344
310
|
width: (e) => e == null ? window.innerWidth : P().parse(e),
|
|
345
311
|
is_state_stable: y(),
|
|
346
312
|
is_expanded: y()
|
|
347
|
-
})
|
|
348
|
-
write_access_requested: f({ status: p() })
|
|
313
|
+
})
|
|
349
314
|
};
|
|
350
|
-
function
|
|
315
|
+
function Ee() {
|
|
351
316
|
const e = new k(), t = new k();
|
|
352
317
|
t.subscribe((n) => {
|
|
353
318
|
e.emit("event", { name: n.event, payload: n.args[0] });
|
|
354
|
-
}),
|
|
319
|
+
}), ve();
|
|
355
320
|
const [, s] = tt(
|
|
356
321
|
// Don't forget to remove created handlers.
|
|
357
|
-
|
|
322
|
+
be,
|
|
358
323
|
// Add "resize" event listener to make sure, we always have fresh viewport information.
|
|
359
324
|
// Desktop version of Telegram is sometimes not sending the viewport_changed
|
|
360
325
|
// event. For example, when the MainButton is shown. That's why we should
|
|
@@ -375,17 +340,19 @@ function xe() {
|
|
|
375
340
|
return;
|
|
376
341
|
let r;
|
|
377
342
|
try {
|
|
378
|
-
r =
|
|
343
|
+
r = xt(n.data);
|
|
379
344
|
} catch {
|
|
380
345
|
return;
|
|
381
346
|
}
|
|
382
|
-
const { eventType: i, eventData: o } = r, a =
|
|
347
|
+
const { eventType: i, eventData: o } = r, a = ye[i];
|
|
383
348
|
try {
|
|
384
349
|
const h = a ? a.parse(o) : o;
|
|
385
350
|
t.emit(...h ? [i, h] : [i]);
|
|
386
351
|
} catch (h) {
|
|
387
352
|
X.error(
|
|
388
|
-
`An error occurred processing the "${i}" event from the Telegram application.
|
|
353
|
+
`An error occurred processing the "${i}" event from the Telegram application.
|
|
354
|
+
Please, file an issue here:
|
|
355
|
+
https://github.com/Telegram-Mini-Apps/tma.js/issues/new/choose`,
|
|
389
356
|
r,
|
|
390
357
|
h
|
|
391
358
|
);
|
|
@@ -409,9 +376,9 @@ function xe() {
|
|
|
409
376
|
}
|
|
410
377
|
}, s];
|
|
411
378
|
}
|
|
412
|
-
const [
|
|
379
|
+
const [Pe, xe] = bt(
|
|
413
380
|
(e) => {
|
|
414
|
-
const [t, s] =
|
|
381
|
+
const [t, s] = Ee(), n = t.off.bind(t);
|
|
415
382
|
return t.off = (r, i) => {
|
|
416
383
|
const { count: o } = t;
|
|
417
384
|
n(r, i), o && !t.count && e();
|
|
@@ -419,19 +386,19 @@ const [Ce, Se] = vt(
|
|
|
419
386
|
},
|
|
420
387
|
([, e]) => e()
|
|
421
388
|
);
|
|
422
|
-
function
|
|
423
|
-
return
|
|
389
|
+
function H() {
|
|
390
|
+
return Pe()[0];
|
|
424
391
|
}
|
|
425
|
-
function
|
|
426
|
-
|
|
392
|
+
function U(e, t) {
|
|
393
|
+
H().off(e, t);
|
|
427
394
|
}
|
|
428
395
|
function v(e, t, s) {
|
|
429
|
-
return
|
|
396
|
+
return H().on(e, t, s);
|
|
430
397
|
}
|
|
431
|
-
function
|
|
398
|
+
function D(e) {
|
|
432
399
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
433
400
|
}
|
|
434
|
-
function
|
|
401
|
+
function Ce(e, t) {
|
|
435
402
|
const s = e.split("."), n = t.split("."), r = Math.max(s.length, n.length);
|
|
436
403
|
for (let i = 0; i < r; i += 1) {
|
|
437
404
|
const o = parseInt(s[i] || "0", 10), a = parseInt(n[i] || "0", 10);
|
|
@@ -440,21 +407,21 @@ function Te(e, t) {
|
|
|
440
407
|
}
|
|
441
408
|
return 0;
|
|
442
409
|
}
|
|
443
|
-
function
|
|
444
|
-
return
|
|
410
|
+
function w(e, t) {
|
|
411
|
+
return Ce(e, t) <= 0;
|
|
445
412
|
}
|
|
446
413
|
function x(e, t, s) {
|
|
447
414
|
if (typeof s == "string") {
|
|
448
415
|
if (e === "web_app_open_link") {
|
|
449
416
|
if (t === "try_instant_view")
|
|
450
|
-
return
|
|
417
|
+
return w("6.4", s);
|
|
451
418
|
if (t === "try_browser")
|
|
452
|
-
return
|
|
419
|
+
return w("7.6", s);
|
|
453
420
|
}
|
|
454
421
|
if (e === "web_app_set_header_color" && t === "color")
|
|
455
|
-
return
|
|
422
|
+
return w("6.9", s);
|
|
456
423
|
if (e === "web_app_close" && t === "return_back")
|
|
457
|
-
return
|
|
424
|
+
return w("7.6", s);
|
|
458
425
|
}
|
|
459
426
|
switch (e) {
|
|
460
427
|
case "web_app_open_tg_link":
|
|
@@ -463,27 +430,27 @@ function x(e, t, s) {
|
|
|
463
430
|
case "web_app_set_background_color":
|
|
464
431
|
case "web_app_set_header_color":
|
|
465
432
|
case "web_app_trigger_haptic_feedback":
|
|
466
|
-
return
|
|
433
|
+
return w("6.1", t);
|
|
467
434
|
case "web_app_open_popup":
|
|
468
|
-
return
|
|
435
|
+
return w("6.2", t);
|
|
469
436
|
case "web_app_close_scan_qr_popup":
|
|
470
437
|
case "web_app_open_scan_qr_popup":
|
|
471
438
|
case "web_app_read_text_from_clipboard":
|
|
472
|
-
return
|
|
439
|
+
return w("6.4", t);
|
|
473
440
|
case "web_app_switch_inline_query":
|
|
474
|
-
return
|
|
441
|
+
return w("6.7", t);
|
|
475
442
|
case "web_app_invoke_custom_method":
|
|
476
443
|
case "web_app_request_write_access":
|
|
477
444
|
case "web_app_request_phone":
|
|
478
|
-
return
|
|
445
|
+
return w("6.9", t);
|
|
479
446
|
case "web_app_setup_settings_button":
|
|
480
|
-
return
|
|
447
|
+
return w("6.10", t);
|
|
481
448
|
case "web_app_biometry_get_info":
|
|
482
449
|
case "web_app_biometry_open_settings":
|
|
483
450
|
case "web_app_biometry_request_access":
|
|
484
451
|
case "web_app_biometry_request_auth":
|
|
485
452
|
case "web_app_biometry_update_token":
|
|
486
|
-
return
|
|
453
|
+
return w("7.2", t);
|
|
487
454
|
default:
|
|
488
455
|
return [
|
|
489
456
|
"iframe_ready",
|
|
@@ -500,89 +467,88 @@ function x(e, t, s) {
|
|
|
500
467
|
].includes(e);
|
|
501
468
|
}
|
|
502
469
|
}
|
|
503
|
-
function
|
|
504
|
-
return "external" in e &&
|
|
470
|
+
function Ct(e) {
|
|
471
|
+
return "external" in e && D(e.external) && "notify" in e.external && typeof e.external.notify == "function";
|
|
505
472
|
}
|
|
506
|
-
function
|
|
507
|
-
return "TelegramWebviewProxy" in e &&
|
|
473
|
+
function St(e) {
|
|
474
|
+
return "TelegramWebviewProxy" in e && D(e.TelegramWebviewProxy) && "postEvent" in e.TelegramWebviewProxy && typeof e.TelegramWebviewProxy.postEvent == "function";
|
|
508
475
|
}
|
|
509
|
-
function
|
|
476
|
+
function et() {
|
|
510
477
|
try {
|
|
511
478
|
return window.self !== window.top;
|
|
512
479
|
} catch {
|
|
513
480
|
return !0;
|
|
514
481
|
}
|
|
515
482
|
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
483
|
+
const Se = "https://web.telegram.org";
|
|
484
|
+
let Tt = Se;
|
|
485
|
+
function Qs(e) {
|
|
486
|
+
Tt = e;
|
|
519
487
|
}
|
|
520
|
-
function
|
|
521
|
-
return
|
|
488
|
+
function Te() {
|
|
489
|
+
return Tt;
|
|
522
490
|
}
|
|
523
|
-
function
|
|
491
|
+
function O(e, t, s) {
|
|
524
492
|
let n = {}, r;
|
|
525
|
-
t
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
if (Tt(window)) {
|
|
493
|
+
if (!t && !s ? n = {} : t && s ? (n = s, r = t) : t && ("targetOrigin" in t ? n = t : r = t), he("Posting event:", r ? { event: e, data: r } : { event: e }), et())
|
|
494
|
+
return window.parent.postMessage(
|
|
495
|
+
JSON.stringify({ eventType: e, eventData: r }),
|
|
496
|
+
n.targetOrigin || Te()
|
|
497
|
+
);
|
|
498
|
+
if (Ct(window)) {
|
|
532
499
|
window.external.notify(JSON.stringify({ eventType: e, eventData: r }));
|
|
533
500
|
return;
|
|
534
501
|
}
|
|
535
|
-
if (
|
|
502
|
+
if (St(window)) {
|
|
536
503
|
window.TelegramWebviewProxy.postEvent(e, JSON.stringify(r));
|
|
537
504
|
return;
|
|
538
505
|
}
|
|
539
|
-
throw
|
|
540
|
-
|
|
541
|
-
"Unable to determine current environment and possible way to send event. You are probably trying to use Mini Apps method outside
|
|
506
|
+
throw m(
|
|
507
|
+
le,
|
|
508
|
+
"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."
|
|
542
509
|
);
|
|
543
510
|
}
|
|
544
|
-
function
|
|
511
|
+
function Re(e) {
|
|
545
512
|
return (t, s) => {
|
|
546
513
|
if (!x(t, e))
|
|
547
|
-
throw
|
|
548
|
-
if (
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
);
|
|
555
|
-
}
|
|
556
|
-
return q(t, s);
|
|
514
|
+
throw m(pe, `Method "${t}" is unsupported in Mini Apps version ${e}`);
|
|
515
|
+
if (D(s) && t === "web_app_set_header_color" && "color" in s && !x(t, "color", e))
|
|
516
|
+
throw m(
|
|
517
|
+
ue,
|
|
518
|
+
`Parameter "color" of "${t}" method is unsupported in Mini Apps version ${e}`
|
|
519
|
+
);
|
|
520
|
+
return O(t, s);
|
|
557
521
|
};
|
|
558
522
|
}
|
|
559
|
-
function
|
|
523
|
+
function Rt(e) {
|
|
560
524
|
return ({ req_id: t }) => t === e;
|
|
561
525
|
}
|
|
562
|
-
function
|
|
563
|
-
return
|
|
526
|
+
function At(e) {
|
|
527
|
+
return m(_e, `Timeout reached: ${e}ms`);
|
|
564
528
|
}
|
|
565
|
-
function
|
|
529
|
+
function It(e, t) {
|
|
566
530
|
return Promise.race([
|
|
567
531
|
typeof e == "function" ? e() : e,
|
|
568
532
|
new Promise((s, n) => {
|
|
569
533
|
setTimeout(() => {
|
|
570
|
-
n(
|
|
534
|
+
n(At(t));
|
|
571
535
|
}, t);
|
|
572
536
|
})
|
|
573
537
|
]);
|
|
574
538
|
}
|
|
575
|
-
async function
|
|
539
|
+
async function f(e) {
|
|
576
540
|
let t;
|
|
577
|
-
const s = new Promise((a) => {
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
541
|
+
const s = new Promise((a) => t = a), { event: n, capture: r, timeout: i } = e, [, o] = tt(
|
|
542
|
+
// We need to iterate over all tracked events, and create their event listeners.
|
|
543
|
+
(Array.isArray(n) ? n : [n]).map((a) => v(a, (h) => {
|
|
544
|
+
(!r || (Array.isArray(n) ? r({
|
|
545
|
+
event: a,
|
|
546
|
+
payload: h
|
|
547
|
+
}) : r(h))) && t(h);
|
|
548
|
+
}))
|
|
583
549
|
);
|
|
584
550
|
try {
|
|
585
|
-
return (e.postEvent ||
|
|
551
|
+
return (e.postEvent || O)(e.method, e.params), await (i ? It(s, i) : s);
|
|
586
552
|
} finally {
|
|
587
553
|
o();
|
|
588
554
|
}
|
|
@@ -591,7 +557,7 @@ async function A(e, t, s, n = {}) {
|
|
|
591
557
|
const {
|
|
592
558
|
result: r,
|
|
593
559
|
error: i
|
|
594
|
-
} = await
|
|
560
|
+
} = await f({
|
|
595
561
|
...n,
|
|
596
562
|
method: "web_app_invoke_custom_method",
|
|
597
563
|
event: "custom_method_invoked",
|
|
@@ -600,30 +566,54 @@ async function A(e, t, s, n = {}) {
|
|
|
600
566
|
params: t,
|
|
601
567
|
req_id: s
|
|
602
568
|
},
|
|
603
|
-
capture:
|
|
569
|
+
capture: Rt(s)
|
|
604
570
|
});
|
|
605
571
|
if (i)
|
|
606
|
-
throw
|
|
572
|
+
throw m(de, i);
|
|
607
573
|
return r;
|
|
608
574
|
}
|
|
609
575
|
function Z(...e) {
|
|
610
576
|
return e.map((t) => {
|
|
611
577
|
if (typeof t == "string")
|
|
612
578
|
return t;
|
|
613
|
-
if (
|
|
579
|
+
if (D(t))
|
|
614
580
|
return Z(Object.entries(t).map((s) => s[1] && s[0]));
|
|
615
581
|
if (Array.isArray(t))
|
|
616
582
|
return Z(...t);
|
|
617
583
|
}).filter(Boolean).join(" ");
|
|
618
584
|
}
|
|
619
|
-
function
|
|
620
|
-
return e.reduce((t, s) => (
|
|
585
|
+
function Ys(...e) {
|
|
586
|
+
return e.reduce((t, s) => (D(s) && Object.entries(s).forEach(([n, r]) => {
|
|
621
587
|
const i = Z(t[n], r);
|
|
622
588
|
i.length && (t[n] = i);
|
|
623
589
|
}), t), {});
|
|
624
590
|
}
|
|
591
|
+
function st(e) {
|
|
592
|
+
return /^#[\da-f]{6}$/i.test(e);
|
|
593
|
+
}
|
|
594
|
+
function Ae(e) {
|
|
595
|
+
return /^#[\da-f]{3}$/i.test(e);
|
|
596
|
+
}
|
|
597
|
+
function kt(e) {
|
|
598
|
+
const t = e.replace(/\s/g, "").toLowerCase();
|
|
599
|
+
if (st(t))
|
|
600
|
+
return t;
|
|
601
|
+
if (Ae(t)) {
|
|
602
|
+
let n = "#";
|
|
603
|
+
for (let r = 0; r < 3; r += 1)
|
|
604
|
+
n += t[1 + r].repeat(2);
|
|
605
|
+
return n;
|
|
606
|
+
}
|
|
607
|
+
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}\)$/);
|
|
608
|
+
if (!s)
|
|
609
|
+
throw new Error(`Value "${e}" does not satisfy any of known RGB formats.`);
|
|
610
|
+
return s.slice(1).reduce((n, r) => {
|
|
611
|
+
const i = parseInt(r, 10).toString(16);
|
|
612
|
+
return n + (i.length === 1 ? "0" : "") + i;
|
|
613
|
+
}, "#");
|
|
614
|
+
}
|
|
625
615
|
function Ot(e) {
|
|
626
|
-
const t =
|
|
616
|
+
const t = kt(e);
|
|
627
617
|
return Math.sqrt(
|
|
628
618
|
[0.299, 0.587, 0.114].reduce((s, n, r) => {
|
|
629
619
|
const i = parseInt(t.slice(1 + r * 2, 1 + (r + 1) * 2), 16);
|
|
@@ -652,25 +642,25 @@ class Ie {
|
|
|
652
642
|
return this.state[t];
|
|
653
643
|
}
|
|
654
644
|
}
|
|
655
|
-
class
|
|
645
|
+
class nt {
|
|
656
646
|
constructor(t) {
|
|
657
647
|
c(this, "state"), c(this, "get"), c(this, "set"), c(this, "clone"), this.state = new Ie(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);
|
|
658
648
|
}
|
|
659
649
|
}
|
|
660
|
-
function
|
|
650
|
+
function qt(e, t) {
|
|
661
651
|
return (s) => x(t[s], e);
|
|
662
652
|
}
|
|
663
|
-
class
|
|
653
|
+
class rt extends nt {
|
|
664
654
|
constructor(t, s, n) {
|
|
665
|
-
super(t), c(this, "supports"), this.supports =
|
|
655
|
+
super(t), c(this, "supports"), this.supports = qt(s, n);
|
|
666
656
|
}
|
|
667
657
|
}
|
|
668
|
-
class ke extends
|
|
658
|
+
class ke extends rt {
|
|
669
659
|
constructor(t, s, n) {
|
|
670
660
|
super({ isVisible: t }, s, {
|
|
671
661
|
show: "web_app_setup_back_button",
|
|
672
662
|
hide: "web_app_setup_back_button"
|
|
673
|
-
}), c(this, "on", (r, i) => r === "click" ? v("back_button_pressed", i) : this.state.on(r, i)), c(this, "off", (r, i) => r === "click" ?
|
|
663
|
+
}), c(this, "on", (r, i) => r === "click" ? v("back_button_pressed", i) : this.state.on(r, i)), c(this, "off", (r, i) => r === "click" ? U("back_button_pressed", i) : this.state.off(r, i)), this.postEvent = n;
|
|
674
664
|
}
|
|
675
665
|
set isVisible(t) {
|
|
676
666
|
this.set("isVisible", t), this.postEvent("web_app_setup_back_button", { is_visible: t });
|
|
@@ -694,19 +684,19 @@ class ke extends it {
|
|
|
694
684
|
this.isVisible = !0;
|
|
695
685
|
}
|
|
696
686
|
}
|
|
697
|
-
const
|
|
698
|
-
function
|
|
687
|
+
const Nt = T((e) => e instanceof Date ? e : new Date(P().parse(e) * 1e3), "Date");
|
|
688
|
+
function it(e, t) {
|
|
699
689
|
return new L((s) => {
|
|
700
690
|
if (typeof s != "string" && !(s instanceof URLSearchParams))
|
|
701
691
|
throw S();
|
|
702
692
|
const n = typeof s == "string" ? new URLSearchParams(s) : s;
|
|
703
|
-
return
|
|
693
|
+
return Et(e, (r) => {
|
|
704
694
|
const i = n.get(r);
|
|
705
695
|
return i === null ? void 0 : i;
|
|
706
696
|
});
|
|
707
697
|
}, !1, t);
|
|
708
698
|
}
|
|
709
|
-
const
|
|
699
|
+
const Oe = b({
|
|
710
700
|
id: P(),
|
|
711
701
|
type: p(),
|
|
712
702
|
title: p(),
|
|
@@ -715,7 +705,7 @@ const qe = f({
|
|
|
715
705
|
from: "photo_url"
|
|
716
706
|
},
|
|
717
707
|
username: p().optional()
|
|
718
|
-
}, "Chat").optional(),
|
|
708
|
+
}, "Chat").optional(), gt = b({
|
|
719
709
|
addedToAttachmentMenu: {
|
|
720
710
|
type: y().optional(),
|
|
721
711
|
from: "added_to_attachment_menu"
|
|
@@ -751,17 +741,17 @@ const qe = f({
|
|
|
751
741
|
},
|
|
752
742
|
username: p().optional()
|
|
753
743
|
}, "User").optional();
|
|
754
|
-
function
|
|
755
|
-
return
|
|
744
|
+
function Dt() {
|
|
745
|
+
return it({
|
|
756
746
|
authDate: {
|
|
757
|
-
type:
|
|
747
|
+
type: Nt(),
|
|
758
748
|
from: "auth_date"
|
|
759
749
|
},
|
|
760
750
|
canSendAfter: {
|
|
761
751
|
type: P().optional(),
|
|
762
752
|
from: "can_send_after"
|
|
763
753
|
},
|
|
764
|
-
chat:
|
|
754
|
+
chat: Oe,
|
|
765
755
|
chatInstance: {
|
|
766
756
|
type: p().optional(),
|
|
767
757
|
from: "chat_instance"
|
|
@@ -775,35 +765,36 @@ function Vt() {
|
|
|
775
765
|
type: p().optional(),
|
|
776
766
|
from: "query_id"
|
|
777
767
|
},
|
|
778
|
-
receiver:
|
|
768
|
+
receiver: gt,
|
|
779
769
|
startParam: {
|
|
780
770
|
type: p().optional(),
|
|
781
771
|
from: "start_param"
|
|
782
772
|
},
|
|
783
|
-
user:
|
|
773
|
+
user: gt
|
|
784
774
|
}, "InitData");
|
|
785
775
|
}
|
|
786
|
-
|
|
776
|
+
const qe = T((e) => kt(p().parse(e)), "rgb");
|
|
777
|
+
function Ne(e) {
|
|
787
778
|
return e.replace(/_[a-z]/g, (t) => t[1].toUpperCase());
|
|
788
779
|
}
|
|
789
|
-
function
|
|
780
|
+
function De(e) {
|
|
790
781
|
return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);
|
|
791
782
|
}
|
|
792
|
-
const
|
|
783
|
+
const Vt = T(
|
|
793
784
|
(e) => {
|
|
794
|
-
const t =
|
|
795
|
-
return Object.entries(
|
|
785
|
+
const t = qe().optional();
|
|
786
|
+
return Object.entries(Pt(e)).reduce((s, [n, r]) => (s[Ne(n)] = t.parse(r), s), {});
|
|
796
787
|
},
|
|
797
788
|
"ThemeParams"
|
|
798
789
|
);
|
|
799
|
-
function
|
|
800
|
-
return
|
|
790
|
+
function ot(e) {
|
|
791
|
+
return it({
|
|
801
792
|
botInline: {
|
|
802
793
|
type: y().optional(),
|
|
803
794
|
from: "tgWebAppBotInline"
|
|
804
795
|
},
|
|
805
796
|
initData: {
|
|
806
|
-
type:
|
|
797
|
+
type: Dt().optional(),
|
|
807
798
|
from: "tgWebAppData"
|
|
808
799
|
},
|
|
809
800
|
initDataRaw: {
|
|
@@ -823,7 +814,7 @@ function at(e) {
|
|
|
823
814
|
from: "tgWebAppStartParam"
|
|
824
815
|
},
|
|
825
816
|
themeParams: {
|
|
826
|
-
type:
|
|
817
|
+
type: Vt(),
|
|
827
818
|
from: "tgWebAppThemeParams"
|
|
828
819
|
},
|
|
829
820
|
version: {
|
|
@@ -832,47 +823,47 @@ function at(e) {
|
|
|
832
823
|
}
|
|
833
824
|
}).parse(e);
|
|
834
825
|
}
|
|
835
|
-
function
|
|
836
|
-
return
|
|
826
|
+
function Mt(e) {
|
|
827
|
+
return ot(
|
|
837
828
|
e.replace(/^[^?#]*[?#]/, "").replace(/[?#]/g, "&")
|
|
838
829
|
);
|
|
839
830
|
}
|
|
840
|
-
function
|
|
841
|
-
return
|
|
831
|
+
function Ve() {
|
|
832
|
+
return Mt(window.location.href);
|
|
842
833
|
}
|
|
843
|
-
function
|
|
834
|
+
function Bt() {
|
|
844
835
|
return performance.getEntriesByType("navigation")[0];
|
|
845
836
|
}
|
|
846
|
-
function
|
|
847
|
-
const e =
|
|
837
|
+
function Me() {
|
|
838
|
+
const e = Bt();
|
|
848
839
|
if (!e)
|
|
849
840
|
throw new Error("Unable to get first navigation entry.");
|
|
850
|
-
return
|
|
841
|
+
return Mt(e.name);
|
|
851
842
|
}
|
|
852
|
-
function
|
|
843
|
+
function $t(e) {
|
|
853
844
|
return `tma.js/${e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`)}`;
|
|
854
845
|
}
|
|
855
|
-
function
|
|
856
|
-
sessionStorage.setItem(
|
|
846
|
+
function Lt(e, t) {
|
|
847
|
+
sessionStorage.setItem($t(e), JSON.stringify(t));
|
|
857
848
|
}
|
|
858
849
|
function Ht(e) {
|
|
859
|
-
const t = sessionStorage.getItem(
|
|
850
|
+
const t = sessionStorage.getItem($t(e));
|
|
860
851
|
try {
|
|
861
852
|
return t ? JSON.parse(t) : void 0;
|
|
862
853
|
} catch {
|
|
863
854
|
}
|
|
864
855
|
}
|
|
865
|
-
function
|
|
866
|
-
return
|
|
856
|
+
function Be() {
|
|
857
|
+
return ot(Ht("launchParams") || "");
|
|
867
858
|
}
|
|
868
|
-
function
|
|
859
|
+
function Ut(e) {
|
|
869
860
|
return JSON.stringify(
|
|
870
861
|
Object.fromEntries(
|
|
871
|
-
Object.entries(e).map(([t, s]) => [
|
|
862
|
+
Object.entries(e).map(([t, s]) => [De(t), s])
|
|
872
863
|
)
|
|
873
864
|
);
|
|
874
865
|
}
|
|
875
|
-
function
|
|
866
|
+
function $e(e) {
|
|
876
867
|
const {
|
|
877
868
|
initDataRaw: t,
|
|
878
869
|
themeParams: s,
|
|
@@ -882,42 +873,42 @@ function Be(e) {
|
|
|
882
873
|
startParam: o,
|
|
883
874
|
botInline: a
|
|
884
875
|
} = e, h = new URLSearchParams();
|
|
885
|
-
return h.set("tgWebAppPlatform", n), h.set("tgWebAppThemeParams",
|
|
876
|
+
return h.set("tgWebAppPlatform", n), h.set("tgWebAppThemeParams", Ut(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();
|
|
886
877
|
}
|
|
887
|
-
function
|
|
888
|
-
|
|
878
|
+
function Wt(e) {
|
|
879
|
+
Lt("launchParams", $e(e));
|
|
889
880
|
}
|
|
890
|
-
function
|
|
881
|
+
function Le() {
|
|
891
882
|
for (const e of [
|
|
892
883
|
// Try to retrieve launch parameters from the current location. This method can return
|
|
893
884
|
// nothing in case, location was changed and then page was reloaded.
|
|
894
|
-
De,
|
|
895
|
-
// Then, try using the lower level API - window.performance.
|
|
896
885
|
Ve,
|
|
886
|
+
// Then, try using the lower level API - window.performance.
|
|
887
|
+
Me,
|
|
897
888
|
// Finally, try to extract launch parameters from the session storage.
|
|
898
|
-
|
|
889
|
+
Be
|
|
899
890
|
])
|
|
900
891
|
try {
|
|
901
892
|
const t = e();
|
|
902
|
-
return
|
|
893
|
+
return Wt(t), t;
|
|
903
894
|
} catch {
|
|
904
895
|
}
|
|
905
896
|
throw new Error("Unable to retrieve launch parameters from any known source.");
|
|
906
897
|
}
|
|
907
898
|
function Gt() {
|
|
908
|
-
const e =
|
|
899
|
+
const e = Bt();
|
|
909
900
|
return !!(e && e.type === "reload");
|
|
910
901
|
}
|
|
911
|
-
function
|
|
902
|
+
function He() {
|
|
912
903
|
let e = 0;
|
|
913
904
|
return () => (e += 1).toString();
|
|
914
905
|
}
|
|
915
|
-
const [Ue] =
|
|
906
|
+
const [Ue] = bt(He);
|
|
916
907
|
function d(e, t) {
|
|
917
908
|
return () => {
|
|
918
|
-
const s =
|
|
909
|
+
const s = Le(), n = {
|
|
919
910
|
...s,
|
|
920
|
-
postEvent:
|
|
911
|
+
postEvent: Re(s.version),
|
|
921
912
|
createRequestId: Ue()
|
|
922
913
|
};
|
|
923
914
|
if (typeof e == "function")
|
|
@@ -931,7 +922,7 @@ function d(e, t) {
|
|
|
931
922
|
addCleanup: r
|
|
932
923
|
}), h = (u) => (o || r(
|
|
933
924
|
u.on("change", (l) => {
|
|
934
|
-
|
|
925
|
+
Lt(e, l);
|
|
935
926
|
})
|
|
936
927
|
), u);
|
|
937
928
|
return [
|
|
@@ -940,17 +931,17 @@ function d(e, t) {
|
|
|
940
931
|
];
|
|
941
932
|
};
|
|
942
933
|
}
|
|
943
|
-
const
|
|
934
|
+
const We = d("backButton", ({
|
|
944
935
|
postEvent: e,
|
|
945
936
|
version: t,
|
|
946
937
|
state: s = { isVisible: !1 }
|
|
947
938
|
}) => new ke(s.isVisible, t, e));
|
|
948
|
-
class
|
|
939
|
+
class V extends rt {
|
|
949
940
|
constructor() {
|
|
950
941
|
super(...arguments), c(this, "on", this.state.on.bind(this.state)), c(this, "off", this.state.off.bind(this.state));
|
|
951
942
|
}
|
|
952
943
|
}
|
|
953
|
-
function
|
|
944
|
+
function jt(e) {
|
|
954
945
|
const t = e.available ? e : {
|
|
955
946
|
available: !1,
|
|
956
947
|
device_id: "",
|
|
@@ -968,7 +959,7 @@ function Kt(e) {
|
|
|
968
959
|
accessGranted: t.access_granted
|
|
969
960
|
};
|
|
970
961
|
}
|
|
971
|
-
class
|
|
962
|
+
class Ge extends V {
|
|
972
963
|
constructor({ postEvent: t, version: s, ...n }) {
|
|
973
964
|
super(n, s, {
|
|
974
965
|
auth: "web_app_biometry_request_auth",
|
|
@@ -1005,7 +996,7 @@ class We extends D {
|
|
|
1005
996
|
reason: t,
|
|
1006
997
|
...s
|
|
1007
998
|
}) {
|
|
1008
|
-
return this.authPromise || (this.authPromise =
|
|
999
|
+
return this.authPromise || (this.authPromise = f({
|
|
1009
1000
|
...s,
|
|
1010
1001
|
method: "web_app_biometry_request_auth",
|
|
1011
1002
|
event: "biometry_auth_requested",
|
|
@@ -1039,14 +1030,14 @@ class We extends D {
|
|
|
1039
1030
|
* @returns Promise with true, if access was granted.
|
|
1040
1031
|
*/
|
|
1041
1032
|
requestAccess({ reason: t, ...s } = {}) {
|
|
1042
|
-
return this.accessPromise || (this.accessPromise =
|
|
1033
|
+
return this.accessPromise || (this.accessPromise = f({
|
|
1043
1034
|
...s,
|
|
1044
1035
|
postEvent: this.postEvent,
|
|
1045
1036
|
method: "web_app_biometry_request_access",
|
|
1046
1037
|
event: "biometry_info_received",
|
|
1047
1038
|
params: { reason: t || "" }
|
|
1048
1039
|
}).then((n) => {
|
|
1049
|
-
const r =
|
|
1040
|
+
const r = jt(n);
|
|
1050
1041
|
return this.set(r), r.accessGranted;
|
|
1051
1042
|
}).finally(() => this.accessPromise = void 0)), this.accessPromise;
|
|
1052
1043
|
}
|
|
@@ -1068,7 +1059,7 @@ class We extends D {
|
|
|
1068
1059
|
*/
|
|
1069
1060
|
async updateToken({ token: t, ...s } = {}) {
|
|
1070
1061
|
return ["removed", "updated"].includes(
|
|
1071
|
-
(await
|
|
1062
|
+
(await f({
|
|
1072
1063
|
...s,
|
|
1073
1064
|
postEvent: this.postEvent,
|
|
1074
1065
|
method: "web_app_biometry_update_token",
|
|
@@ -1079,17 +1070,17 @@ class We extends D {
|
|
|
1079
1070
|
}
|
|
1080
1071
|
}
|
|
1081
1072
|
async function je(e) {
|
|
1082
|
-
return
|
|
1083
|
-
await
|
|
1073
|
+
return jt(
|
|
1074
|
+
await f({
|
|
1084
1075
|
...e || {},
|
|
1085
1076
|
method: "web_app_biometry_get_info",
|
|
1086
1077
|
event: "biometry_info_received"
|
|
1087
1078
|
})
|
|
1088
1079
|
);
|
|
1089
1080
|
}
|
|
1090
|
-
const
|
|
1081
|
+
const Ke = d(
|
|
1091
1082
|
"biometryManager",
|
|
1092
|
-
async ({ postEvent: e, version: t, state: s }) => new
|
|
1083
|
+
async ({ postEvent: e, version: t, state: s }) => new Ge({
|
|
1093
1084
|
...s || x("web_app_biometry_get_info", t) ? s || await je({ timeout: 1e3 }) : {
|
|
1094
1085
|
available: !1,
|
|
1095
1086
|
accessGranted: !1,
|
|
@@ -1101,12 +1092,12 @@ const Ge = d(
|
|
|
1101
1092
|
postEvent: e
|
|
1102
1093
|
})
|
|
1103
1094
|
);
|
|
1104
|
-
class
|
|
1095
|
+
class at extends nt {
|
|
1105
1096
|
constructor() {
|
|
1106
1097
|
super(...arguments), c(this, "on", this.state.on.bind(this.state)), c(this, "off", this.state.off.bind(this.state));
|
|
1107
1098
|
}
|
|
1108
1099
|
}
|
|
1109
|
-
class
|
|
1100
|
+
class ze extends at {
|
|
1110
1101
|
constructor(t, s) {
|
|
1111
1102
|
super({ isConfirmationNeeded: t }), this.postEvent = s;
|
|
1112
1103
|
}
|
|
@@ -1133,19 +1124,19 @@ class Ke extends ct {
|
|
|
1133
1124
|
this.isConfirmationNeeded = !0;
|
|
1134
1125
|
}
|
|
1135
1126
|
}
|
|
1136
|
-
const
|
|
1127
|
+
const Je = d(
|
|
1137
1128
|
"closingBehavior",
|
|
1138
1129
|
({
|
|
1139
1130
|
postEvent: e,
|
|
1140
1131
|
state: t = { isConfirmationNeeded: !1 }
|
|
1141
|
-
}) => new
|
|
1132
|
+
}) => new ze(t.isConfirmationNeeded, e)
|
|
1142
1133
|
);
|
|
1143
|
-
class
|
|
1134
|
+
class ct {
|
|
1144
1135
|
constructor(t, s) {
|
|
1145
|
-
c(this, "supports"), this.supports =
|
|
1136
|
+
c(this, "supports"), this.supports = qt(t, s);
|
|
1146
1137
|
}
|
|
1147
1138
|
}
|
|
1148
|
-
function
|
|
1139
|
+
function Fe(e) {
|
|
1149
1140
|
if (Array.isArray(e))
|
|
1150
1141
|
return e;
|
|
1151
1142
|
if (typeof e == "string")
|
|
@@ -1157,9 +1148,9 @@ function Je(e) {
|
|
|
1157
1148
|
}
|
|
1158
1149
|
throw S();
|
|
1159
1150
|
}
|
|
1160
|
-
class
|
|
1151
|
+
class Qe extends L {
|
|
1161
1152
|
constructor(t, s, n) {
|
|
1162
|
-
super(
|
|
1153
|
+
super(Fe, s, n), c(this, "itemParser"), this.itemParser = typeof t == "function" ? t : t.parse.bind(t);
|
|
1163
1154
|
}
|
|
1164
1155
|
/**
|
|
1165
1156
|
* Attempts to parse passed value
|
|
@@ -1175,13 +1166,13 @@ class Fe extends L {
|
|
|
1175
1166
|
return this.itemParser = typeof t == "function" ? t : t.parse.bind(t), this;
|
|
1176
1167
|
}
|
|
1177
1168
|
}
|
|
1178
|
-
function
|
|
1179
|
-
return new
|
|
1169
|
+
function Ye(e) {
|
|
1170
|
+
return new Qe((t) => t, !1, e);
|
|
1180
1171
|
}
|
|
1181
|
-
function
|
|
1172
|
+
function ft(e, t) {
|
|
1182
1173
|
return Object.fromEntries(e.map((s) => [s, t]));
|
|
1183
1174
|
}
|
|
1184
|
-
class
|
|
1175
|
+
class Ze extends ct {
|
|
1185
1176
|
constructor(t, s, n) {
|
|
1186
1177
|
super(t, {
|
|
1187
1178
|
delete: "web_app_invoke_custom_method",
|
|
@@ -1209,7 +1200,7 @@ class Ye extends ht {
|
|
|
1209
1200
|
* @param options - request execution options.
|
|
1210
1201
|
*/
|
|
1211
1202
|
async getKeys(t = {}) {
|
|
1212
|
-
return
|
|
1203
|
+
return Ye().of(p()).parse(
|
|
1213
1204
|
await A(
|
|
1214
1205
|
"getStorageKeys",
|
|
1215
1206
|
{},
|
|
@@ -1221,13 +1212,13 @@ class Ye extends ht {
|
|
|
1221
1212
|
async get(t, s = {}) {
|
|
1222
1213
|
const n = Array.isArray(t) ? t : [t];
|
|
1223
1214
|
if (!n.length)
|
|
1224
|
-
return
|
|
1215
|
+
return ft(n, "");
|
|
1225
1216
|
const r = await A(
|
|
1226
1217
|
"getStorageValues",
|
|
1227
1218
|
{ keys: n },
|
|
1228
1219
|
this.createRequestId(),
|
|
1229
1220
|
{ ...s, postEvent: this.postEvent }
|
|
1230
|
-
), i =
|
|
1221
|
+
), i = b(ft(n, p()), "CloudStorageData").parse(r);
|
|
1231
1222
|
return Array.isArray(t) ? i : i[t];
|
|
1232
1223
|
}
|
|
1233
1224
|
/**
|
|
@@ -1245,10 +1236,10 @@ class Ye extends ht {
|
|
|
1245
1236
|
);
|
|
1246
1237
|
}
|
|
1247
1238
|
}
|
|
1248
|
-
const
|
|
1249
|
-
({ createRequestId: e, postEvent: t, version: s }) => new
|
|
1239
|
+
const Xe = d(
|
|
1240
|
+
({ createRequestId: e, postEvent: t, version: s }) => new Ze(s, e, t)
|
|
1250
1241
|
);
|
|
1251
|
-
class
|
|
1242
|
+
class ts extends ct {
|
|
1252
1243
|
constructor(t, s) {
|
|
1253
1244
|
super(t, {
|
|
1254
1245
|
impactOccurred: "web_app_trigger_haptic_feedback",
|
|
@@ -1290,10 +1281,10 @@ class Xe extends ht {
|
|
|
1290
1281
|
this.postEvent("web_app_trigger_haptic_feedback", { type: "selection_change" });
|
|
1291
1282
|
}
|
|
1292
1283
|
}
|
|
1293
|
-
const
|
|
1294
|
-
({ version: e, postEvent: t }) => new
|
|
1284
|
+
const es = d(
|
|
1285
|
+
({ version: e, postEvent: t }) => new ts(e, t)
|
|
1295
1286
|
);
|
|
1296
|
-
class
|
|
1287
|
+
class ss {
|
|
1297
1288
|
constructor(t) {
|
|
1298
1289
|
this.initData = t;
|
|
1299
1290
|
}
|
|
@@ -1366,13 +1357,13 @@ class es {
|
|
|
1366
1357
|
return this.initData.user;
|
|
1367
1358
|
}
|
|
1368
1359
|
}
|
|
1369
|
-
const
|
|
1370
|
-
({ initData: e }) => e ? new
|
|
1360
|
+
const ns = d(
|
|
1361
|
+
({ initData: e }) => e ? new ss(e) : void 0
|
|
1371
1362
|
);
|
|
1372
|
-
function
|
|
1373
|
-
return
|
|
1363
|
+
function Zs(e) {
|
|
1364
|
+
return Dt().parse(e);
|
|
1374
1365
|
}
|
|
1375
|
-
class
|
|
1366
|
+
class rs extends V {
|
|
1376
1367
|
constructor(t, s, n) {
|
|
1377
1368
|
super({ isOpened: t }, s, { open: "web_app_open_invoice" }), this.postEvent = n;
|
|
1378
1369
|
}
|
|
@@ -1402,7 +1393,7 @@ class ns extends D {
|
|
|
1402
1393
|
}
|
|
1403
1394
|
this.isOpened = !0;
|
|
1404
1395
|
try {
|
|
1405
|
-
return (await
|
|
1396
|
+
return (await f({
|
|
1406
1397
|
method: "web_app_open_invoice",
|
|
1407
1398
|
event: "invoice_closed",
|
|
1408
1399
|
params: { slug: n },
|
|
@@ -1416,12 +1407,12 @@ class ns extends D {
|
|
|
1416
1407
|
}
|
|
1417
1408
|
}
|
|
1418
1409
|
}
|
|
1419
|
-
const
|
|
1420
|
-
({ version: e, postEvent: t }) => new
|
|
1410
|
+
const is = d(
|
|
1411
|
+
({ version: e, postEvent: t }) => new rs(!1, e, t)
|
|
1421
1412
|
);
|
|
1422
|
-
class
|
|
1413
|
+
class os extends nt {
|
|
1423
1414
|
constructor({ postEvent: t, ...s }) {
|
|
1424
|
-
super(s), c(this, "postEvent"), c(this, "on", (n, r) => n === "click" ? v("main_button_pressed", r) : this.state.on(n, r)), c(this, "off", (n, r) => n === "click" ?
|
|
1415
|
+
super(s), c(this, "postEvent"), c(this, "on", (n, r) => n === "click" ? v("main_button_pressed", r) : this.state.on(n, r)), c(this, "off", (n, r) => n === "click" ? U("main_button_pressed", r) : this.state.off(n, r)), this.postEvent = t;
|
|
1425
1416
|
}
|
|
1426
1417
|
/**
|
|
1427
1418
|
* The MainButton background color.
|
|
@@ -1550,7 +1541,7 @@ class is extends rt {
|
|
|
1550
1541
|
return this.get("textColor");
|
|
1551
1542
|
}
|
|
1552
1543
|
}
|
|
1553
|
-
const
|
|
1544
|
+
const as = d(
|
|
1554
1545
|
"mainButton",
|
|
1555
1546
|
({
|
|
1556
1547
|
postEvent: e,
|
|
@@ -1563,11 +1554,11 @@ const os = d(
|
|
|
1563
1554
|
textColor: t.buttonTextColor || "#ffffff",
|
|
1564
1555
|
bgColor: t.buttonColor || "#000000"
|
|
1565
1556
|
}
|
|
1566
|
-
}) => new
|
|
1557
|
+
}) => new os({ ...s, postEvent: e })
|
|
1567
1558
|
);
|
|
1568
|
-
function
|
|
1569
|
-
return
|
|
1570
|
-
contact:
|
|
1559
|
+
function cs() {
|
|
1560
|
+
return it({
|
|
1561
|
+
contact: b({
|
|
1571
1562
|
userId: {
|
|
1572
1563
|
type: P(),
|
|
1573
1564
|
from: "user_id"
|
|
@@ -1586,24 +1577,24 @@ function as() {
|
|
|
1586
1577
|
}
|
|
1587
1578
|
}),
|
|
1588
1579
|
authDate: {
|
|
1589
|
-
type:
|
|
1580
|
+
type: Nt(),
|
|
1590
1581
|
from: "auth_date"
|
|
1591
1582
|
},
|
|
1592
1583
|
hash: p()
|
|
1593
1584
|
}, "RequestedContact");
|
|
1594
1585
|
}
|
|
1595
|
-
function
|
|
1586
|
+
function Kt(e, t) {
|
|
1596
1587
|
return (s) => {
|
|
1597
1588
|
const [n, r] = t[s];
|
|
1598
1589
|
return x(n, r, e);
|
|
1599
1590
|
};
|
|
1600
1591
|
}
|
|
1601
|
-
function
|
|
1592
|
+
function hs(e) {
|
|
1602
1593
|
return new Promise((t) => {
|
|
1603
1594
|
setTimeout(t, e);
|
|
1604
1595
|
});
|
|
1605
1596
|
}
|
|
1606
|
-
class
|
|
1597
|
+
class ps extends V {
|
|
1607
1598
|
constructor({ postEvent: t, createRequestId: s, version: n, botInline: r, ...i }) {
|
|
1608
1599
|
super(i, n, {
|
|
1609
1600
|
requestPhoneAccess: "web_app_request_phone",
|
|
@@ -1613,7 +1604,7 @@ class hs extends D {
|
|
|
1613
1604
|
setBackgroundColor: "web_app_set_background_color"
|
|
1614
1605
|
}), c(this, "botInline"), c(this, "postEvent"), c(this, "createRequestId"), c(this, "requestPhoneAccessPromise"), c(this, "requestWriteAccessPromise"), c(this, "supportsParam"), this.createRequestId = s, this.postEvent = t, this.botInline = r;
|
|
1615
1606
|
const o = this.supports.bind(this);
|
|
1616
|
-
this.supports = (a) => o(a) ? a !== "switchInlineQuery" || r : !1, this.supportsParam =
|
|
1607
|
+
this.supports = (a) => o(a) ? a !== "switchInlineQuery" || r : !1, this.supportsParam = Kt(n, {
|
|
1617
1608
|
"setHeaderColor.color": ["web_app_set_header_color", "color"]
|
|
1618
1609
|
});
|
|
1619
1610
|
}
|
|
@@ -1624,7 +1615,7 @@ class hs extends D {
|
|
|
1624
1615
|
async getRequestedContact({
|
|
1625
1616
|
timeout: t = 1e4
|
|
1626
1617
|
} = {}) {
|
|
1627
|
-
return
|
|
1618
|
+
return cs().parse(
|
|
1628
1619
|
await A(
|
|
1629
1620
|
"getRequestedContact",
|
|
1630
1621
|
{},
|
|
@@ -1642,9 +1633,10 @@ class hs extends D {
|
|
|
1642
1633
|
}
|
|
1643
1634
|
/**
|
|
1644
1635
|
* Closes the Mini App.
|
|
1636
|
+
* @param returnBack - should the application be wrapped into the bottom bar.
|
|
1645
1637
|
*/
|
|
1646
|
-
close() {
|
|
1647
|
-
this.postEvent("web_app_close");
|
|
1638
|
+
close(t) {
|
|
1639
|
+
this.postEvent("web_app_close", { return_back: t });
|
|
1648
1640
|
}
|
|
1649
1641
|
/**
|
|
1650
1642
|
* The Mini App header color.
|
|
@@ -1661,7 +1653,7 @@ class hs extends D {
|
|
|
1661
1653
|
return this.botInline;
|
|
1662
1654
|
}
|
|
1663
1655
|
/**
|
|
1664
|
-
* True if current Mini App background color is recognized as dark.
|
|
1656
|
+
* True if the current Mini App background color is recognized as dark.
|
|
1665
1657
|
*/
|
|
1666
1658
|
get isDark() {
|
|
1667
1659
|
return Ot(this.bgColor);
|
|
@@ -1693,15 +1685,15 @@ class hs extends D {
|
|
|
1693
1685
|
throw new Error("Access denied.");
|
|
1694
1686
|
const s = Date.now() + t;
|
|
1695
1687
|
let n = 50;
|
|
1696
|
-
return
|
|
1688
|
+
return It(async () => {
|
|
1697
1689
|
for (; Date.now() < s; ) {
|
|
1698
1690
|
try {
|
|
1699
1691
|
return await this.getRequestedContact();
|
|
1700
1692
|
} catch {
|
|
1701
1693
|
}
|
|
1702
|
-
await
|
|
1694
|
+
await hs(n), n += 50;
|
|
1703
1695
|
}
|
|
1704
|
-
throw
|
|
1696
|
+
throw At(t);
|
|
1705
1697
|
}, t);
|
|
1706
1698
|
}
|
|
1707
1699
|
/**
|
|
@@ -1714,7 +1706,7 @@ class hs extends D {
|
|
|
1714
1706
|
* @see requestContact
|
|
1715
1707
|
*/
|
|
1716
1708
|
async requestPhoneAccess(t = {}) {
|
|
1717
|
-
return this.requestPhoneAccessPromise || (this.requestPhoneAccessPromise =
|
|
1709
|
+
return this.requestPhoneAccessPromise || (this.requestPhoneAccessPromise = f({
|
|
1718
1710
|
...t,
|
|
1719
1711
|
method: "web_app_request_phone",
|
|
1720
1712
|
event: "phone_requested",
|
|
@@ -1726,7 +1718,7 @@ class hs extends D {
|
|
|
1726
1718
|
* @param options - additional options.
|
|
1727
1719
|
*/
|
|
1728
1720
|
async requestWriteAccess(t = {}) {
|
|
1729
|
-
return this.requestWriteAccessPromise || (this.requestWriteAccessPromise =
|
|
1721
|
+
return this.requestWriteAccessPromise || (this.requestWriteAccessPromise = f({
|
|
1730
1722
|
...t,
|
|
1731
1723
|
method: "web_app_request_write_access",
|
|
1732
1724
|
event: "write_access_requested",
|
|
@@ -1784,7 +1776,7 @@ class hs extends D {
|
|
|
1784
1776
|
this.postEvent("web_app_switch_inline_query", { query: t, chat_types: s });
|
|
1785
1777
|
}
|
|
1786
1778
|
}
|
|
1787
|
-
const
|
|
1779
|
+
const us = d(
|
|
1788
1780
|
"miniApp",
|
|
1789
1781
|
({
|
|
1790
1782
|
themeParams: e,
|
|
@@ -1794,9 +1786,9 @@ const ps = d(
|
|
|
1794
1786
|
headerColor: e.headerBgColor || "#000000"
|
|
1795
1787
|
},
|
|
1796
1788
|
...n
|
|
1797
|
-
}) => new
|
|
1789
|
+
}) => new ps({ ...n, ...s, botInline: t })
|
|
1798
1790
|
);
|
|
1799
|
-
function
|
|
1791
|
+
function ls(e) {
|
|
1800
1792
|
const t = e.message.trim(), s = (e.title || "").trim(), n = e.buttons || [];
|
|
1801
1793
|
let r;
|
|
1802
1794
|
if (s.length > 64)
|
|
@@ -1820,7 +1812,7 @@ function us(e) {
|
|
|
1820
1812
|
return { ...i, id: o };
|
|
1821
1813
|
}) : r = [{ type: "close", id: "" }], { title: s, message: t, buttons: r };
|
|
1822
1814
|
}
|
|
1823
|
-
class
|
|
1815
|
+
class ds extends V {
|
|
1824
1816
|
constructor(t, s, n) {
|
|
1825
1817
|
super({ isOpened: t }, s, { open: "web_app_open_popup" }), this.postEvent = n;
|
|
1826
1818
|
}
|
|
@@ -1849,11 +1841,11 @@ class ls extends D {
|
|
|
1849
1841
|
throw new Error("Popup is already opened.");
|
|
1850
1842
|
this.isOpened = !0;
|
|
1851
1843
|
try {
|
|
1852
|
-
const { button_id: s = null } = await
|
|
1844
|
+
const { button_id: s = null } = await f({
|
|
1853
1845
|
event: "popup_closed",
|
|
1854
1846
|
method: "web_app_open_popup",
|
|
1855
1847
|
postEvent: this.postEvent,
|
|
1856
|
-
params:
|
|
1848
|
+
params: ls(t)
|
|
1857
1849
|
});
|
|
1858
1850
|
return s;
|
|
1859
1851
|
} finally {
|
|
@@ -1861,10 +1853,10 @@ class ls extends D {
|
|
|
1861
1853
|
}
|
|
1862
1854
|
}
|
|
1863
1855
|
}
|
|
1864
|
-
const
|
|
1865
|
-
({ postEvent: e, version: t }) => new
|
|
1856
|
+
const _s = d(
|
|
1857
|
+
({ postEvent: e, version: t }) => new ds(!1, t, e)
|
|
1866
1858
|
);
|
|
1867
|
-
class
|
|
1859
|
+
class gs extends V {
|
|
1868
1860
|
constructor(t, s, n) {
|
|
1869
1861
|
super({ isOpened: t }, s, {
|
|
1870
1862
|
close: "web_app_close_scan_qr_popup",
|
|
@@ -1872,7 +1864,7 @@ class _s extends D {
|
|
|
1872
1864
|
}), this.postEvent = n;
|
|
1873
1865
|
}
|
|
1874
1866
|
/**
|
|
1875
|
-
* Closes scanner.
|
|
1867
|
+
* Closes the scanner.
|
|
1876
1868
|
*/
|
|
1877
1869
|
close() {
|
|
1878
1870
|
this.postEvent("web_app_close_scan_qr_popup"), this.isOpened = !1;
|
|
@@ -1881,18 +1873,18 @@ class _s extends D {
|
|
|
1881
1873
|
this.set("isOpened", t);
|
|
1882
1874
|
}
|
|
1883
1875
|
/**
|
|
1884
|
-
* Returns true
|
|
1876
|
+
* Returns true if the scanner is currently opened.
|
|
1885
1877
|
*/
|
|
1886
1878
|
get isOpened() {
|
|
1887
1879
|
return this.get("isOpened");
|
|
1888
1880
|
}
|
|
1889
1881
|
async open(t) {
|
|
1890
1882
|
if (this.isOpened)
|
|
1891
|
-
throw new Error("
|
|
1883
|
+
throw new Error("The scanner is already opened");
|
|
1892
1884
|
const { text: s, capture: n } = (typeof t == "string" ? { text: t } : t) || {};
|
|
1893
1885
|
this.isOpened = !0;
|
|
1894
1886
|
try {
|
|
1895
|
-
const r = (await
|
|
1887
|
+
const r = (await f({
|
|
1896
1888
|
method: "web_app_open_scan_qr_popup",
|
|
1897
1889
|
event: ["qr_text_received", "scan_qr_popup_closed"],
|
|
1898
1890
|
postEvent: this.postEvent,
|
|
@@ -1902,20 +1894,21 @@ class _s extends D {
|
|
|
1902
1894
|
}
|
|
1903
1895
|
}) || {}).data || null;
|
|
1904
1896
|
return r && this.close(), r;
|
|
1905
|
-
}
|
|
1906
|
-
|
|
1897
|
+
} finally {
|
|
1898
|
+
this.isOpened = !1;
|
|
1907
1899
|
}
|
|
1908
1900
|
}
|
|
1901
|
+
// TODO: Streaming mode, allowing to scan several QRs until closed.
|
|
1909
1902
|
}
|
|
1910
|
-
const
|
|
1911
|
-
({ version: e, postEvent: t }) => new
|
|
1903
|
+
const fs = d(
|
|
1904
|
+
({ version: e, postEvent: t }) => new gs(!1, e, t)
|
|
1912
1905
|
);
|
|
1913
|
-
class
|
|
1906
|
+
class ws extends rt {
|
|
1914
1907
|
constructor(t, s, n) {
|
|
1915
1908
|
super({ isVisible: t }, s, {
|
|
1916
1909
|
show: "web_app_setup_settings_button",
|
|
1917
1910
|
hide: "web_app_setup_settings_button"
|
|
1918
|
-
}), c(this, "on", (r, i) => r === "click" ? v("settings_button_pressed", i) : this.state.on(r, i)), c(this, "off", (r, i) => r === "click" ?
|
|
1911
|
+
}), c(this, "on", (r, i) => r === "click" ? v("settings_button_pressed", i) : this.state.on(r, i)), c(this, "off", (r, i) => r === "click" ? U("settings_button_pressed", i) : this.state.off(r, i)), this.postEvent = n;
|
|
1919
1912
|
}
|
|
1920
1913
|
set isVisible(t) {
|
|
1921
1914
|
this.set("isVisible", t), this.postEvent("web_app_setup_settings_button", { is_visible: t });
|
|
@@ -1939,18 +1932,18 @@ class fs extends it {
|
|
|
1939
1932
|
this.isVisible = !0;
|
|
1940
1933
|
}
|
|
1941
1934
|
}
|
|
1942
|
-
const
|
|
1935
|
+
const ms = d(
|
|
1943
1936
|
"settingsButton",
|
|
1944
1937
|
({
|
|
1945
1938
|
version: e,
|
|
1946
1939
|
postEvent: t,
|
|
1947
1940
|
state: s = { isVisible: !1 }
|
|
1948
|
-
}) => new
|
|
1941
|
+
}) => new ws(s.isVisible, e, t)
|
|
1949
1942
|
);
|
|
1950
|
-
function
|
|
1951
|
-
return
|
|
1943
|
+
function zt(e) {
|
|
1944
|
+
return Vt().parse(e);
|
|
1952
1945
|
}
|
|
1953
|
-
class
|
|
1946
|
+
class bs extends at {
|
|
1954
1947
|
/**
|
|
1955
1948
|
* @since v6.10
|
|
1956
1949
|
*/
|
|
@@ -2021,7 +2014,7 @@ class ms extends ct {
|
|
|
2021
2014
|
*/
|
|
2022
2015
|
listen() {
|
|
2023
2016
|
return v("theme_changed", (t) => {
|
|
2024
|
-
this.set(
|
|
2017
|
+
this.set(zt(t.theme_params));
|
|
2025
2018
|
});
|
|
2026
2019
|
}
|
|
2027
2020
|
/**
|
|
@@ -2034,44 +2027,46 @@ class ms extends ct {
|
|
|
2034
2027
|
return this.get("textColor");
|
|
2035
2028
|
}
|
|
2036
2029
|
}
|
|
2037
|
-
const
|
|
2030
|
+
const vs = d(
|
|
2038
2031
|
"themeParams",
|
|
2039
2032
|
({ themeParams: e, state: t = e, addCleanup: s }) => {
|
|
2040
|
-
const n = new
|
|
2033
|
+
const n = new bs(t);
|
|
2041
2034
|
return s(n.listen()), n;
|
|
2042
2035
|
}
|
|
2043
2036
|
);
|
|
2044
|
-
function
|
|
2045
|
-
return
|
|
2037
|
+
function Xs(e = {}) {
|
|
2038
|
+
return f({
|
|
2046
2039
|
...e,
|
|
2047
2040
|
method: "web_app_request_theme",
|
|
2048
2041
|
event: "theme_changed"
|
|
2049
|
-
}).then(
|
|
2042
|
+
}).then(zt);
|
|
2043
|
+
}
|
|
2044
|
+
function q(e, t) {
|
|
2045
|
+
return e.startsWith(t) ? e : `${t}${e}`;
|
|
2050
2046
|
}
|
|
2051
|
-
|
|
2047
|
+
function N(e) {
|
|
2048
|
+
return new URL(
|
|
2049
|
+
typeof e == "string" ? e : `${e.pathname || ""}${q(e.search || "", "?")}${q(e.hash || "", "#")}`,
|
|
2050
|
+
"http://a"
|
|
2051
|
+
);
|
|
2052
|
+
}
|
|
2053
|
+
class ys extends ct {
|
|
2052
2054
|
constructor(t, s, n) {
|
|
2053
|
-
super(t, { readTextFromClipboard: "web_app_read_text_from_clipboard" }), c(this, "supportsParam"), this.version = t, this.createRequestId = s, this.postEvent = n, this.supportsParam =
|
|
2055
|
+
super(t, { readTextFromClipboard: "web_app_read_text_from_clipboard" }), c(this, "supportsParam"), this.version = t, this.createRequestId = s, this.postEvent = n, this.supportsParam = Kt(t, {
|
|
2054
2056
|
"openLink.tryInstantView": ["web_app_open_link", "try_instant_view"]
|
|
2055
2057
|
});
|
|
2056
2058
|
}
|
|
2057
|
-
/**
|
|
2058
|
-
* Opens a link in an external browser. The Mini App will not be closed.
|
|
2059
|
-
*
|
|
2060
|
-
* Note that this method can be called only in response to the user
|
|
2061
|
-
* interaction with the Mini App interface (e.g. click inside the Mini App
|
|
2062
|
-
* or on the main button).
|
|
2063
|
-
* @param url - URL to be opened.
|
|
2064
|
-
* @param tryInstantView
|
|
2065
|
-
*/
|
|
2066
2059
|
openLink(t, s) {
|
|
2067
|
-
const n =
|
|
2060
|
+
const n = N(t).toString();
|
|
2068
2061
|
if (!x("web_app_open_link", this.version)) {
|
|
2069
2062
|
window.open(n, "_blank");
|
|
2070
2063
|
return;
|
|
2071
2064
|
}
|
|
2065
|
+
const r = typeof s == "boolean" ? { tryInstantView: s } : s || {};
|
|
2072
2066
|
this.postEvent("web_app_open_link", {
|
|
2073
2067
|
url: n,
|
|
2074
|
-
|
|
2068
|
+
try_browser: r.tryBrowser,
|
|
2069
|
+
try_instant_view: r.tryInstantView
|
|
2075
2070
|
});
|
|
2076
2071
|
}
|
|
2077
2072
|
/**
|
|
@@ -2099,12 +2094,12 @@ class vs extends ht {
|
|
|
2099
2094
|
async readTextFromClipboard() {
|
|
2100
2095
|
const t = this.createRequestId(), {
|
|
2101
2096
|
data: s = null
|
|
2102
|
-
} = await
|
|
2097
|
+
} = await f({
|
|
2103
2098
|
method: "web_app_read_text_from_clipboard",
|
|
2104
2099
|
event: "clipboard_text_received",
|
|
2105
2100
|
postEvent: this.postEvent,
|
|
2106
2101
|
params: { req_id: t },
|
|
2107
|
-
capture:
|
|
2102
|
+
capture: Rt(t)
|
|
2108
2103
|
});
|
|
2109
2104
|
return s;
|
|
2110
2105
|
}
|
|
@@ -2120,19 +2115,19 @@ class vs extends ht {
|
|
|
2120
2115
|
*/
|
|
2121
2116
|
shareURL(t, s) {
|
|
2122
2117
|
this.openTelegramLink(
|
|
2123
|
-
"https://t.me/share/url?" + new URLSearchParams({ url: t, text: s || "" }).toString()
|
|
2118
|
+
"https://t.me/share/url?" + new URLSearchParams({ url: t, text: s || "" }).toString().replace(/\+/g, "%20")
|
|
2124
2119
|
);
|
|
2125
2120
|
}
|
|
2126
2121
|
}
|
|
2127
|
-
const
|
|
2128
|
-
({ version: e, postEvent: t, createRequestId: s }) => new
|
|
2122
|
+
const Es = d(
|
|
2123
|
+
({ version: e, postEvent: t, createRequestId: s }) => new ys(e, s, t)
|
|
2129
2124
|
);
|
|
2130
|
-
async function
|
|
2125
|
+
async function Jt(e = {}) {
|
|
2131
2126
|
const {
|
|
2132
2127
|
is_expanded: t,
|
|
2133
2128
|
is_state_stable: s,
|
|
2134
2129
|
...n
|
|
2135
|
-
} = await
|
|
2130
|
+
} = await f({
|
|
2136
2131
|
...e,
|
|
2137
2132
|
method: "web_app_request_viewport",
|
|
2138
2133
|
event: "viewport_changed"
|
|
@@ -2142,7 +2137,7 @@ async function Ft(e = {}) {
|
|
|
2142
2137
|
function R(e) {
|
|
2143
2138
|
return e < 0 ? 0 : e;
|
|
2144
2139
|
}
|
|
2145
|
-
class
|
|
2140
|
+
class Ps extends at {
|
|
2146
2141
|
constructor({ postEvent: t, stableHeight: s, height: n, width: r, isExpanded: i }) {
|
|
2147
2142
|
super({
|
|
2148
2143
|
height: R(n),
|
|
@@ -2157,7 +2152,7 @@ class Es extends ct {
|
|
|
2157
2152
|
* @param options - options to request fresh data.
|
|
2158
2153
|
*/
|
|
2159
2154
|
async sync(t) {
|
|
2160
|
-
const { isStateStable: s, ...n } = await
|
|
2155
|
+
const { isStateStable: s, ...n } = await Jt(t);
|
|
2161
2156
|
this.set({
|
|
2162
2157
|
...n,
|
|
2163
2158
|
stableHeight: s ? n.height : this.get("stableHeight")
|
|
@@ -2249,7 +2244,7 @@ class Es extends ct {
|
|
|
2249
2244
|
return this.stableHeight === this.height;
|
|
2250
2245
|
}
|
|
2251
2246
|
}
|
|
2252
|
-
const
|
|
2247
|
+
const xs = d(
|
|
2253
2248
|
"viewport",
|
|
2254
2249
|
async ({ state: e, platform: t, postEvent: s, addCleanup: n }) => {
|
|
2255
2250
|
let r = !1, i = 0, o = 0, a = 0;
|
|
@@ -2258,10 +2253,10 @@ const Ps = d(
|
|
|
2258
2253
|
else if (["macos", "tdesktop", "unigram", "webk", "weba", "web"].includes(t))
|
|
2259
2254
|
r = !0, i = window.innerHeight, o = window.innerWidth, a = window.innerHeight;
|
|
2260
2255
|
else {
|
|
2261
|
-
const u = await
|
|
2256
|
+
const u = await Jt({ timeout: 1e3, postEvent: s });
|
|
2262
2257
|
r = u.isExpanded, i = u.height, o = u.width, a = u.isStateStable ? i : 0;
|
|
2263
2258
|
}
|
|
2264
|
-
const h = new
|
|
2259
|
+
const h = new Ps({
|
|
2265
2260
|
postEvent: s,
|
|
2266
2261
|
height: i,
|
|
2267
2262
|
width: o,
|
|
@@ -2274,7 +2269,7 @@ const Ps = d(
|
|
|
2274
2269
|
function E(e, t) {
|
|
2275
2270
|
document.documentElement.style.setProperty(e, t);
|
|
2276
2271
|
}
|
|
2277
|
-
function
|
|
2272
|
+
function tn(e, t, s) {
|
|
2278
2273
|
s || (s = (a) => `--tg-${a}-color`);
|
|
2279
2274
|
const n = s("header"), r = s("bg"), i = () => {
|
|
2280
2275
|
const { headerColor: a } = e;
|
|
@@ -2291,7 +2286,7 @@ function Xs(e, t, s) {
|
|
|
2291
2286
|
];
|
|
2292
2287
|
return i(), () => o.forEach((a) => a());
|
|
2293
2288
|
}
|
|
2294
|
-
function
|
|
2289
|
+
function en(e, t) {
|
|
2295
2290
|
t || (t = (n) => `--tg-theme-${n.replace(/[A-Z]/g, (r) => `-${r.toLowerCase()}`)}`);
|
|
2296
2291
|
const s = () => {
|
|
2297
2292
|
Object.entries(e.getState()).forEach(([n, r]) => {
|
|
@@ -2300,7 +2295,7 @@ function tn(e, t) {
|
|
|
2300
2295
|
};
|
|
2301
2296
|
return s(), e.on("change", s);
|
|
2302
2297
|
}
|
|
2303
|
-
function
|
|
2298
|
+
function sn(e, t) {
|
|
2304
2299
|
t || (t = (u) => `--tg-viewport-${u}`);
|
|
2305
2300
|
const [
|
|
2306
2301
|
s,
|
|
@@ -2313,10 +2308,10 @@ function en(e, t) {
|
|
|
2313
2308
|
];
|
|
2314
2309
|
return i(), o(), a(), () => h.forEach((u) => u());
|
|
2315
2310
|
}
|
|
2316
|
-
function
|
|
2311
|
+
function Cs(e = !0) {
|
|
2317
2312
|
const t = [
|
|
2318
2313
|
v("reload_iframe", () => {
|
|
2319
|
-
|
|
2314
|
+
O("iframe_will_reload"), window.location.reload();
|
|
2320
2315
|
})
|
|
2321
2316
|
], s = () => t.forEach((n) => n());
|
|
2322
2317
|
if (e) {
|
|
@@ -2328,29 +2323,29 @@ function xs(e = !0) {
|
|
|
2328
2323
|
() => document.head.removeChild(n)
|
|
2329
2324
|
);
|
|
2330
2325
|
}
|
|
2331
|
-
return
|
|
2326
|
+
return O("iframe_ready", { reload_supported: !0 }), s;
|
|
2332
2327
|
}
|
|
2333
|
-
function
|
|
2328
|
+
function nn() {
|
|
2334
2329
|
return typeof window > "u";
|
|
2335
2330
|
}
|
|
2336
|
-
async function
|
|
2337
|
-
if (
|
|
2331
|
+
async function rn() {
|
|
2332
|
+
if (St(window))
|
|
2338
2333
|
return !0;
|
|
2339
2334
|
try {
|
|
2340
|
-
return await
|
|
2335
|
+
return await f({ method: "web_app_request_theme", event: "theme_changed", timeout: 100 }), !0;
|
|
2341
2336
|
} catch {
|
|
2342
2337
|
return !1;
|
|
2343
2338
|
}
|
|
2344
2339
|
}
|
|
2345
|
-
function
|
|
2346
|
-
const t = typeof e == "string" ?
|
|
2347
|
-
|
|
2340
|
+
function on(e) {
|
|
2341
|
+
const t = typeof e == "string" ? ot(e) : e;
|
|
2342
|
+
Wt(t);
|
|
2348
2343
|
function s(r) {
|
|
2349
2344
|
if (typeof r == "string")
|
|
2350
2345
|
try {
|
|
2351
|
-
const { eventType: i } =
|
|
2346
|
+
const { eventType: i } = xt(r);
|
|
2352
2347
|
i === "web_app_request_theme" && Y("theme_changed", {
|
|
2353
|
-
theme_params: JSON.parse(
|
|
2348
|
+
theme_params: JSON.parse(Ut(t.themeParams))
|
|
2354
2349
|
}), i === "web_app_request_viewport" && Y("viewport_changed", {
|
|
2355
2350
|
width: window.innerWidth,
|
|
2356
2351
|
height: window.innerHeight,
|
|
@@ -2360,14 +2355,14 @@ function rn(e) {
|
|
|
2360
2355
|
} catch {
|
|
2361
2356
|
}
|
|
2362
2357
|
}
|
|
2363
|
-
if (
|
|
2358
|
+
if (et()) {
|
|
2364
2359
|
const r = window.parent.postMessage.bind(window.parent);
|
|
2365
2360
|
window.parent.postMessage = (i) => {
|
|
2366
2361
|
s(i), r(i);
|
|
2367
2362
|
};
|
|
2368
2363
|
return;
|
|
2369
2364
|
}
|
|
2370
|
-
if (
|
|
2365
|
+
if (Ct(window)) {
|
|
2371
2366
|
const r = window.external.notify.bind(window.external);
|
|
2372
2367
|
window.external.notify = (i) => {
|
|
2373
2368
|
s(i), r(i);
|
|
@@ -2382,13 +2377,13 @@ function rn(e) {
|
|
|
2382
2377
|
}
|
|
2383
2378
|
};
|
|
2384
2379
|
}
|
|
2385
|
-
function
|
|
2380
|
+
function Ss(e) {
|
|
2386
2381
|
return e instanceof $;
|
|
2387
2382
|
}
|
|
2388
|
-
function
|
|
2389
|
-
return
|
|
2383
|
+
function an(e, t) {
|
|
2384
|
+
return Ss(e) && e.type === t;
|
|
2390
2385
|
}
|
|
2391
|
-
function
|
|
2386
|
+
function G(e, t) {
|
|
2392
2387
|
let s, n, r;
|
|
2393
2388
|
return typeof e == "string" ? s = e : (s = e.pathname === void 0 ? t : e.pathname, n = e.params, r = e.id), Object.freeze({
|
|
2394
2389
|
id: r || (Math.random() * 2 ** 14 | 0).toString(16),
|
|
@@ -2396,16 +2391,16 @@ function j(e, t) {
|
|
|
2396
2391
|
params: n
|
|
2397
2392
|
});
|
|
2398
2393
|
}
|
|
2399
|
-
class
|
|
2400
|
-
constructor(t, s, n =
|
|
2394
|
+
class Ts {
|
|
2395
|
+
constructor(t, s, n = O) {
|
|
2401
2396
|
if (c(this, "history"), c(this, "ee", new k()), c(this, "attached", !1), c(this, "back", () => this.go(-1)), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this._index = s, this.postEvent = n, t.length === 0)
|
|
2402
|
-
throw
|
|
2397
|
+
throw m(fe, "History should not be empty.");
|
|
2403
2398
|
if (s < 0 || s >= t.length)
|
|
2404
|
-
throw
|
|
2405
|
-
|
|
2399
|
+
throw m(
|
|
2400
|
+
we,
|
|
2406
2401
|
"Index should not be zero and higher or equal than history size."
|
|
2407
2402
|
);
|
|
2408
|
-
this.history = t.map((r) =>
|
|
2403
|
+
this.history = t.map((r) => G(r, ""));
|
|
2409
2404
|
}
|
|
2410
2405
|
/**
|
|
2411
2406
|
* Allows this navigator to control the `BackButton` visibility state. It also tracks the
|
|
@@ -2424,7 +2419,7 @@ class Ss {
|
|
|
2424
2419
|
* Prevents current navigator from controlling the BackButton visibility state.
|
|
2425
2420
|
*/
|
|
2426
2421
|
detach() {
|
|
2427
|
-
this.attached = !1,
|
|
2422
|
+
this.attached = !1, U("back_button_pressed", this.back);
|
|
2428
2423
|
}
|
|
2429
2424
|
/**
|
|
2430
2425
|
* Goes to the next history item.
|
|
@@ -2480,14 +2475,14 @@ class Ss {
|
|
|
2480
2475
|
* @param item - item to add.
|
|
2481
2476
|
*/
|
|
2482
2477
|
push(t) {
|
|
2483
|
-
this.hasNext && this.history.splice(this.index + 1), this.replaceAndMove(this.index + 1,
|
|
2478
|
+
this.hasNext && this.history.splice(this.index + 1), this.replaceAndMove(this.index + 1, G(t, this.current.pathname));
|
|
2484
2479
|
}
|
|
2485
2480
|
/**
|
|
2486
2481
|
* Replaces the current history item.
|
|
2487
2482
|
* @param item - item to replace the current item with.
|
|
2488
2483
|
*/
|
|
2489
2484
|
replace(t) {
|
|
2490
|
-
this.replaceAndMove(this.index,
|
|
2485
|
+
this.replaceAndMove(this.index, G(t, this.current.pathname));
|
|
2491
2486
|
}
|
|
2492
2487
|
/**
|
|
2493
2488
|
* Sets history item by the specified index.
|
|
@@ -2517,29 +2512,20 @@ class Ss {
|
|
|
2517
2512
|
this.postEvent("web_app_setup_back_button", { is_visible: !!this.index });
|
|
2518
2513
|
}
|
|
2519
2514
|
}
|
|
2520
|
-
function
|
|
2515
|
+
function j({
|
|
2521
2516
|
params: e,
|
|
2522
2517
|
...t
|
|
2523
2518
|
}) {
|
|
2524
2519
|
return { ...e || { hash: "", search: "" }, ...t };
|
|
2525
2520
|
}
|
|
2526
|
-
function O(e, t) {
|
|
2527
|
-
return e.startsWith(t) ? e : `${t}${e}`;
|
|
2528
|
-
}
|
|
2529
|
-
function M(e) {
|
|
2530
|
-
return new URL(
|
|
2531
|
-
typeof e == "string" ? e : `${e.pathname || ""}${O(e.search || "", "?")}${O(e.hash || "", "#")}`,
|
|
2532
|
-
"http://a"
|
|
2533
|
-
);
|
|
2534
|
-
}
|
|
2535
2521
|
function B(e) {
|
|
2536
|
-
const t = typeof e == "string" ? e.startsWith("/") : !!(e.pathname && e.pathname.startsWith("/")), s =
|
|
2522
|
+
const t = typeof e == "string" ? e.startsWith("/") : !!(e.pathname && e.pathname.startsWith("/")), s = N(e);
|
|
2537
2523
|
return `${t ? s.pathname : s.pathname.slice(1)}${s.search}${s.hash}`;
|
|
2538
2524
|
}
|
|
2539
2525
|
function K(e, t, s) {
|
|
2540
2526
|
let n, r;
|
|
2541
2527
|
typeof e == "string" ? n = e : (n = B(e), s = e.state, r = e.id);
|
|
2542
|
-
const { pathname: i, search: o, hash: a } = new URL(n, `http://a${
|
|
2528
|
+
const { pathname: i, search: o, hash: a } = new URL(n, `http://a${q(t, "/")}`);
|
|
2543
2529
|
return { id: r, pathname: i, params: { hash: a, search: o, state: s } };
|
|
2544
2530
|
}
|
|
2545
2531
|
async function I(e) {
|
|
@@ -2556,23 +2542,23 @@ async function I(e) {
|
|
|
2556
2542
|
})
|
|
2557
2543
|
]);
|
|
2558
2544
|
}
|
|
2559
|
-
async function
|
|
2545
|
+
async function Rs() {
|
|
2560
2546
|
if (window.history.length <= 1 || (window.history.pushState(null, ""), await I(1 - window.history.length)))
|
|
2561
2547
|
return;
|
|
2562
2548
|
let e = await I(-1);
|
|
2563
2549
|
for (; e; )
|
|
2564
2550
|
e = await I(-1);
|
|
2565
2551
|
}
|
|
2566
|
-
function
|
|
2567
|
-
return
|
|
2552
|
+
function Ft(e) {
|
|
2553
|
+
return N(e).pathname;
|
|
2568
2554
|
}
|
|
2569
|
-
const
|
|
2570
|
-
class
|
|
2555
|
+
const wt = 0, z = 1, J = 2;
|
|
2556
|
+
class Qt {
|
|
2571
2557
|
constructor(t, s, { postEvent: n, hashMode: r = "classic", base: i } = {}) {
|
|
2572
2558
|
c(this, "navigator"), c(this, "ee", new k()), c(this, "hashMode"), c(this, "base"), c(this, "attached", !1), c(this, "onPopState", ({ state: o }) => {
|
|
2573
2559
|
if (o === null)
|
|
2574
2560
|
return this.push(this.parsePath(window.location.href));
|
|
2575
|
-
o ===
|
|
2561
|
+
o === wt ? window.history.forward() : o === z && this.back(), o === J && this.forward();
|
|
2576
2562
|
}), c(this, "onNavigatorChange", async ({
|
|
2577
2563
|
to: o,
|
|
2578
2564
|
from: a,
|
|
@@ -2580,17 +2566,17 @@ class Yt {
|
|
|
2580
2566
|
}) => {
|
|
2581
2567
|
this.attached && await this.syncHistory(), this.ee.emit("change", {
|
|
2582
2568
|
delta: h,
|
|
2583
|
-
from:
|
|
2584
|
-
to:
|
|
2569
|
+
from: j(a),
|
|
2570
|
+
to: j(o),
|
|
2585
2571
|
navigator: this
|
|
2586
2572
|
});
|
|
2587
|
-
}), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this.navigator = new
|
|
2573
|
+
}), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this.navigator = new Ts(
|
|
2588
2574
|
t.map((o) => K(o, "/")),
|
|
2589
2575
|
s,
|
|
2590
2576
|
n
|
|
2591
2577
|
), this.navigator.on("change", (o) => {
|
|
2592
2578
|
this.onNavigatorChange(o);
|
|
2593
|
-
}), this.hashMode = r, this.base =
|
|
2579
|
+
}), this.hashMode = r, this.base = Ft(i || "");
|
|
2594
2580
|
}
|
|
2595
2581
|
/**
|
|
2596
2582
|
* Attaches current navigator to the browser history allowing navigator to manipulate it.
|
|
@@ -2674,7 +2660,7 @@ class Yt {
|
|
|
2674
2660
|
* Navigation history.
|
|
2675
2661
|
*/
|
|
2676
2662
|
get history() {
|
|
2677
|
-
return this.navigator.history.map(
|
|
2663
|
+
return this.navigator.history.map(j);
|
|
2678
2664
|
}
|
|
2679
2665
|
/**
|
|
2680
2666
|
* Path, including pathname, search and hash.
|
|
@@ -2717,8 +2703,8 @@ class Yt {
|
|
|
2717
2703
|
* // { pathname: '/tma', search: '?is=cool', hash: '#yeah' }
|
|
2718
2704
|
*/
|
|
2719
2705
|
parsePath(t) {
|
|
2720
|
-
let s =
|
|
2721
|
-
return this.hashMode && (s =
|
|
2706
|
+
let s = N(t);
|
|
2707
|
+
return this.hashMode && (s = N(s.hash.slice(1))), {
|
|
2722
2708
|
pathname: s.pathname,
|
|
2723
2709
|
search: s.search,
|
|
2724
2710
|
hash: s.hash
|
|
@@ -2738,8 +2724,8 @@ class Yt {
|
|
|
2738
2724
|
* @param value - path presented as string or URLLike.
|
|
2739
2725
|
*/
|
|
2740
2726
|
renderPath(t) {
|
|
2741
|
-
const s = (this.base.length === 1 ? "" : this.base) +
|
|
2742
|
-
return this.hashMode ?
|
|
2727
|
+
const s = (this.base.length === 1 ? "" : this.base) + q(B(t), "/");
|
|
2728
|
+
return this.hashMode ? q(s.slice(1), this.hashMode === "classic" ? "#" : "#/") : s;
|
|
2743
2729
|
}
|
|
2744
2730
|
/**
|
|
2745
2731
|
* Synchronizes current navigator state with browser history.
|
|
@@ -2747,7 +2733,7 @@ class Yt {
|
|
|
2747
2733
|
async syncHistory() {
|
|
2748
2734
|
window.removeEventListener("popstate", this.onPopState);
|
|
2749
2735
|
const { state: t } = this, s = this.renderPath(this);
|
|
2750
|
-
await
|
|
2736
|
+
await Rs(), this.hasPrev && this.hasNext ? (window.history.replaceState(z, ""), window.history.pushState(t, "", s), window.history.pushState(J, ""), await I(-1)) : this.hasPrev ? (window.history.replaceState(z, ""), window.history.pushState(t, "", s)) : this.hasNext ? (window.history.replaceState(t, s), window.history.pushState(J, ""), await I(-1)) : (window.history.replaceState(wt, ""), window.history.pushState(t, "", s)), window.addEventListener("popstate", this.onPopState);
|
|
2751
2737
|
}
|
|
2752
2738
|
/**
|
|
2753
2739
|
* Current query parameters.
|
|
@@ -2765,34 +2751,34 @@ class Yt {
|
|
|
2765
2751
|
return (this.navigator.current.params || {}).state;
|
|
2766
2752
|
}
|
|
2767
2753
|
}
|
|
2768
|
-
function
|
|
2754
|
+
function As(e) {
|
|
2769
2755
|
e || (e = {});
|
|
2770
2756
|
const { href: t, hash: s } = window.location;
|
|
2771
2757
|
let n = B(
|
|
2772
2758
|
e.hashMode === null ? t : s.includes("?") ? s.slice(1) : `?${s.slice(1)}`
|
|
2773
2759
|
);
|
|
2774
|
-
const r = e.base ?
|
|
2760
|
+
const r = e.base ? Ft(e.base) : void 0;
|
|
2775
2761
|
if (r) {
|
|
2776
2762
|
if (!n.startsWith(r))
|
|
2777
|
-
throw
|
|
2778
|
-
|
|
2763
|
+
throw m(
|
|
2764
|
+
me,
|
|
2779
2765
|
`Path "${n}" expected to be starting with "${r}"`
|
|
2780
2766
|
);
|
|
2781
2767
|
n = n.slice(r.length);
|
|
2782
2768
|
}
|
|
2783
|
-
return new
|
|
2769
|
+
return new Qt([n], 0, e);
|
|
2784
2770
|
}
|
|
2785
|
-
function
|
|
2771
|
+
function cn(e) {
|
|
2786
2772
|
const t = e.match(/#(.+)/);
|
|
2787
2773
|
return t ? t[1] : null;
|
|
2788
2774
|
}
|
|
2789
|
-
function
|
|
2775
|
+
function Is(e, t) {
|
|
2790
2776
|
if (Gt()) {
|
|
2791
2777
|
const s = sessionStorage.getItem(e);
|
|
2792
2778
|
if (s)
|
|
2793
2779
|
try {
|
|
2794
2780
|
const { index: n, history: r } = JSON.parse(s);
|
|
2795
|
-
return new
|
|
2781
|
+
return new Qt(
|
|
2796
2782
|
r,
|
|
2797
2783
|
n,
|
|
2798
2784
|
t
|
|
@@ -2801,34 +2787,34 @@ function As(e, t) {
|
|
|
2801
2787
|
console.error("Unable to restore hash navigator state.", n);
|
|
2802
2788
|
}
|
|
2803
2789
|
}
|
|
2804
|
-
return
|
|
2790
|
+
return As(t);
|
|
2805
2791
|
}
|
|
2806
|
-
function
|
|
2807
|
-
const s =
|
|
2792
|
+
function hn(e, t) {
|
|
2793
|
+
const s = Is(e, t), n = () => sessionStorage.setItem(e, JSON.stringify({
|
|
2808
2794
|
index: s.index,
|
|
2809
2795
|
history: s.history
|
|
2810
2796
|
}));
|
|
2811
2797
|
return s.on("change", n), n(), s;
|
|
2812
2798
|
}
|
|
2813
2799
|
function _(e) {
|
|
2814
|
-
return (t, s, ...n) => (r) =>
|
|
2800
|
+
return (t, s, ...n) => (r) => mt(s, pt(() => pt({
|
|
2815
2801
|
[t]: e(...n)
|
|
2816
2802
|
}, r)));
|
|
2817
2803
|
}
|
|
2818
|
-
const
|
|
2819
|
-
function
|
|
2820
|
-
const e =
|
|
2804
|
+
const Yt = te();
|
|
2805
|
+
function ks() {
|
|
2806
|
+
const e = ee(Yt);
|
|
2821
2807
|
if (!e)
|
|
2822
2808
|
throw new Error("useSDK was used outside of SDKProvider.");
|
|
2823
2809
|
return e;
|
|
2824
2810
|
}
|
|
2825
2811
|
function g(e) {
|
|
2826
2812
|
return (...t) => {
|
|
2827
|
-
const s =
|
|
2813
|
+
const s = ks()(e, ...t), n = () => s.signal();
|
|
2828
2814
|
return Object.defineProperty(n, "error", () => s.error), n;
|
|
2829
2815
|
};
|
|
2830
2816
|
}
|
|
2831
|
-
const
|
|
2817
|
+
const Os = g(We), pn = _(Os), qs = g(Ke), un = _(qs), Ns = g(Je), ln = _(Ns), Ds = g(Xe), dn = _(Ds), Vs = g(es), _n = _(Vs), Ms = g(ns), gn = _(Ms), Bs = g(is), fn = _(Bs), $s = g(as), wn = _($s), Ls = g(us), mn = _(Ls), Hs = g(_s), bn = _(Hs), Us = g(fs), vn = _(Us), Ws = g(ms), yn = _(Ws), Gs = g(vs), En = _(Gs), js = g(Es), Pn = _(js), Ks = g(xs), xn = _(Ks), Cn = (e) => {
|
|
2832
2818
|
const t = /* @__PURE__ */ new Map(), s = (n, ...r) => {
|
|
2833
2819
|
if (t.has(n))
|
|
2834
2820
|
return t.get(n);
|
|
@@ -2848,18 +2834,18 @@ const ks = g(He), hn = _(ks), qs = g(Ge), pn = _(qs), Os = g(ze), un = _(Os), Ns
|
|
|
2848
2834
|
}
|
|
2849
2835
|
let a;
|
|
2850
2836
|
Array.isArray(o) && ([o, a] = o);
|
|
2851
|
-
const [h] =
|
|
2837
|
+
const [h] = se(() => o), u = dt(() => {
|
|
2852
2838
|
if (h.state !== "ready")
|
|
2853
2839
|
return;
|
|
2854
2840
|
const l = h();
|
|
2855
2841
|
if (!l || !("on" in l))
|
|
2856
2842
|
return l;
|
|
2857
|
-
const
|
|
2843
|
+
const Zt = ne((M) => (M(l), l.on("change", () => M(l)))), Xt = Object.getPrototypeOf(l), W = {};
|
|
2858
2844
|
return new Proxy(l, {
|
|
2859
|
-
get(
|
|
2845
|
+
get(M, C) {
|
|
2860
2846
|
if (!(C in W)) {
|
|
2861
|
-
const
|
|
2862
|
-
W[C] =
|
|
2847
|
+
const ht = Reflect.getOwnPropertyDescriptor(Xt, C);
|
|
2848
|
+
W[C] = ht && "get" in ht ? dt(() => Zt()[C]) : () => Reflect.get(M, C);
|
|
2863
2849
|
}
|
|
2864
2850
|
return W[C]();
|
|
2865
2851
|
}
|
|
@@ -2877,13 +2863,13 @@ const ks = g(He), hn = _(ks), qs = g(Ge), pn = _(qs), Os = g(ze), un = _(Os), Ns
|
|
|
2877
2863
|
cleanup: a
|
|
2878
2864
|
});
|
|
2879
2865
|
};
|
|
2880
|
-
return
|
|
2881
|
-
|
|
2866
|
+
return ut(() => {
|
|
2867
|
+
ce(e.debug || !1);
|
|
2868
|
+
}), ut(() => {
|
|
2869
|
+
et() && lt(Cs(e.acceptCustomStyles));
|
|
2882
2870
|
}), lt(() => {
|
|
2883
|
-
nt() && dt(xs(e.acceptCustomStyles));
|
|
2884
|
-
}), dt(() => {
|
|
2885
2871
|
t.forEach((n) => n.cleanup && n.cleanup());
|
|
2886
|
-
}),
|
|
2872
|
+
}), mt(Yt.Provider, {
|
|
2887
2873
|
value: s,
|
|
2888
2874
|
get children() {
|
|
2889
2875
|
return e.children;
|
|
@@ -2892,138 +2878,138 @@ const ks = g(He), hn = _(ks), qs = g(Ge), pn = _(qs), Os = g(ze), un = _(Os), Ns
|
|
|
2892
2878
|
};
|
|
2893
2879
|
export {
|
|
2894
2880
|
ke as BackButton,
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2881
|
+
Ts as BasicNavigator,
|
|
2882
|
+
Ge as BiometryManager,
|
|
2883
|
+
Qt as BrowserNavigator,
|
|
2884
|
+
ze as ClosingBehavior,
|
|
2885
|
+
Ze as CloudStorage,
|
|
2886
|
+
me as ERR_INVALID_PATH_BASE,
|
|
2887
|
+
de as ERR_INVOKE_CUSTOM_METHOD_RESPONSE,
|
|
2888
|
+
ue as ERR_METHOD_PARAMETER_UNSUPPORTED,
|
|
2889
|
+
pe as ERR_METHOD_UNSUPPORTED,
|
|
2890
|
+
fe as ERR_NAVIGATION_HISTORY_EMPTY,
|
|
2891
|
+
we as ERR_NAVIGATION_INDEX_INVALID,
|
|
2892
|
+
Js as ERR_NAVIGATION_ITEM_INVALID,
|
|
2893
|
+
yt as ERR_PARSE,
|
|
2894
|
+
Fs as ERR_SSR_INIT,
|
|
2895
|
+
_e as ERR_TIMED_OUT,
|
|
2896
|
+
ge as ERR_UNEXPECTED_TYPE,
|
|
2897
|
+
le as ERR_UNKNOWN_ENV,
|
|
2912
2898
|
k as EventEmitter,
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2899
|
+
ts as HapticFeedback,
|
|
2900
|
+
ss as InitData,
|
|
2901
|
+
rs as Invoice,
|
|
2902
|
+
os as MainButton,
|
|
2903
|
+
ps as MiniApp,
|
|
2904
|
+
ds as Popup,
|
|
2905
|
+
gs as QRScanner,
|
|
2920
2906
|
$ as SDKError,
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2907
|
+
Cn as SDKProvider,
|
|
2908
|
+
ws as SettingsButton,
|
|
2909
|
+
bs as ThemeParams,
|
|
2910
|
+
ys as Utils,
|
|
2911
|
+
Ps as Viewport,
|
|
2912
|
+
Ye as array,
|
|
2913
|
+
tn as bindMiniAppCSSVars,
|
|
2914
|
+
en as bindThemeParamsCSSVars,
|
|
2915
|
+
sn as bindViewportCSSVars,
|
|
2930
2916
|
y as boolean,
|
|
2931
|
-
|
|
2917
|
+
Rt as captureSameReq,
|
|
2932
2918
|
Z as classNames,
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2919
|
+
Ce as compareVersions,
|
|
2920
|
+
As as createBrowserNavigatorFromLocation,
|
|
2921
|
+
Re as createPostEvent,
|
|
2922
|
+
N as createSafeURL,
|
|
2923
|
+
Nt as date,
|
|
2924
|
+
cn as getHash,
|
|
2925
|
+
Ft as getPathname,
|
|
2926
|
+
We as initBackButton,
|
|
2927
|
+
Ke as initBiometryManager,
|
|
2928
|
+
Je as initClosingBehavior,
|
|
2929
|
+
Xe as initCloudStorage,
|
|
2930
|
+
es as initHapticFeedback,
|
|
2931
|
+
ns as initInitData,
|
|
2932
|
+
is as initInvoice,
|
|
2933
|
+
as as initMainButton,
|
|
2934
|
+
us as initMiniApp,
|
|
2935
|
+
hn as initNavigator,
|
|
2936
|
+
_s as initPopup,
|
|
2937
|
+
fs as initQRScanner,
|
|
2938
|
+
ms as initSettingsButton,
|
|
2939
|
+
vs as initThemeParams,
|
|
2940
|
+
Es as initUtils,
|
|
2941
|
+
xs as initViewport,
|
|
2942
|
+
Cs as initWeb,
|
|
2957
2943
|
A as invokeCustomMethod,
|
|
2958
2944
|
Ot as isColorDark,
|
|
2959
|
-
|
|
2945
|
+
et as isIframe,
|
|
2960
2946
|
Gt as isPageReload,
|
|
2961
2947
|
st as isRGB,
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2969
|
-
|
|
2948
|
+
Ae as isRGBShort,
|
|
2949
|
+
Ss as isSDKError,
|
|
2950
|
+
an as isSDKErrorOfType,
|
|
2951
|
+
nn as isSSR,
|
|
2952
|
+
rn as isTMA,
|
|
2953
|
+
b as json,
|
|
2954
|
+
Ys as mergeClassNames,
|
|
2955
|
+
on as mockTelegramEnv,
|
|
2970
2956
|
P as number,
|
|
2971
|
-
|
|
2957
|
+
U as off,
|
|
2972
2958
|
v as on,
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2959
|
+
Zs as parseInitData,
|
|
2960
|
+
ot as parseLaunchParams,
|
|
2961
|
+
zt as parseThemeParams,
|
|
2962
|
+
O as postEvent,
|
|
2963
|
+
f as request,
|
|
2978
2964
|
je as requestBiometryInfo,
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2965
|
+
Xs as requestThemeParams,
|
|
2966
|
+
Jt as requestViewport,
|
|
2967
|
+
Le as retrieveLaunchParams,
|
|
2968
|
+
qe as rgb,
|
|
2969
|
+
it as searchParams,
|
|
2970
|
+
$e as serializeLaunchParams,
|
|
2971
|
+
Ut as serializeThemeParams,
|
|
2986
2972
|
E as setCSSVar,
|
|
2987
|
-
|
|
2988
|
-
|
|
2973
|
+
ce as setDebug,
|
|
2974
|
+
Qs as setTargetOrigin,
|
|
2989
2975
|
p as string,
|
|
2990
|
-
|
|
2976
|
+
oe as subscribe,
|
|
2991
2977
|
x as supports,
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2978
|
+
Te as targetOrigin,
|
|
2979
|
+
kt as toRGB,
|
|
2980
|
+
vt as unsubscribe,
|
|
2995
2981
|
B as urlToPath,
|
|
2996
|
-
|
|
2982
|
+
Os as useBackButton,
|
|
2997
2983
|
qs as useBiometryManager,
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
2984
|
+
Ns as useClosingBehavior,
|
|
2985
|
+
Ds as useCloudStorage,
|
|
2986
|
+
Vs as useHapticFeedback,
|
|
2987
|
+
Ms as useInitData,
|
|
2988
|
+
Bs as useInvoice,
|
|
2989
|
+
$s as useMainButton,
|
|
2990
|
+
Ls as useMiniApp,
|
|
2991
|
+
Hs as usePopup,
|
|
3006
2992
|
Us as useQRScanner,
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
2993
|
+
ks as useSDK,
|
|
2994
|
+
Ws as useSettingsButton,
|
|
2995
|
+
Gs as useThemeParams,
|
|
3010
2996
|
js as useUtils,
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
2997
|
+
Ks as useViewport,
|
|
2998
|
+
pn as withBackButton,
|
|
2999
|
+
un as withBiometryManager,
|
|
3000
|
+
ln as withClosingBehavior,
|
|
3001
|
+
dn as withCloudStorage,
|
|
3002
|
+
_n as withHapticFeedback,
|
|
3003
|
+
gn as withInitData,
|
|
3004
|
+
fn as withInvoice,
|
|
3005
|
+
wn as withMainButton,
|
|
3006
|
+
mn as withMiniApp,
|
|
3007
|
+
bn as withPopup,
|
|
3008
|
+
vn as withQRScanner,
|
|
3009
|
+
yn as withSettingsButton,
|
|
3010
|
+
En as withThemeParams,
|
|
3011
|
+
It as withTimeout,
|
|
3012
|
+
Pn as withUtils,
|
|
3013
|
+
xn as withViewport
|
|
3028
3014
|
};
|
|
3029
3015
|
//# sourceMappingURL=index.js.map
|