@tma.js/sdk-react 2.2.0 → 2.2.1
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 +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +376 -335
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
var
|
|
4
|
-
function
|
|
1
|
+
import { jsx as yt } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as ie, useContext as oe, useState as Et, useEffect as S, useMemo as Pt, useRef as gt, useCallback as ae } from "react";
|
|
3
|
+
var ce = Object.defineProperty, he = (e, t, s) => t in e ? ce(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, c = (e, t, s) => (he(e, typeof t != "symbol" ? t + "" : t, s), s);
|
|
4
|
+
function Rt(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
|
|
11
|
+
function xt(e) {
|
|
12
12
|
const t = j(), { count: s } = t;
|
|
13
|
-
t.unsubscribe(e), s && !t.count &&
|
|
13
|
+
t.unsubscribe(e), s && !t.count && Ae();
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
return j().subscribe(e), () =>
|
|
15
|
+
function pe(e) {
|
|
16
|
+
return j().subscribe(e), () => xt(e);
|
|
17
17
|
}
|
|
18
|
-
class
|
|
18
|
+
class ue {
|
|
19
19
|
constructor(t, s = {}) {
|
|
20
20
|
this.scope = t, this.options = s;
|
|
21
21
|
}
|
|
@@ -55,19 +55,19 @@ class oe {
|
|
|
55
55
|
this.print("log", ...t);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
const
|
|
58
|
+
const nt = new ue("SDK", {
|
|
59
59
|
bgColor: "forestgreen",
|
|
60
60
|
textColor: "white"
|
|
61
61
|
});
|
|
62
62
|
let X = !1;
|
|
63
|
-
const
|
|
64
|
-
|
|
63
|
+
const ft = ({ name: e, payload: t }) => {
|
|
64
|
+
nt.log("Event received:", t ? { name: e, payload: t } : { name: e });
|
|
65
65
|
};
|
|
66
|
-
function
|
|
67
|
-
X !== e && (X = e, e ?
|
|
66
|
+
function le(e) {
|
|
67
|
+
X !== e && (X = e, e ? pe(ft) : xt(ft));
|
|
68
68
|
}
|
|
69
|
-
function
|
|
70
|
-
X &&
|
|
69
|
+
function de(...e) {
|
|
70
|
+
X && nt.log(...e);
|
|
71
71
|
}
|
|
72
72
|
class N {
|
|
73
73
|
constructor() {
|
|
@@ -142,7 +142,7 @@ class N {
|
|
|
142
142
|
function tt(e, t, s) {
|
|
143
143
|
return window.addEventListener(e, t, s), () => window.removeEventListener(e, t, s);
|
|
144
144
|
}
|
|
145
|
-
function
|
|
145
|
+
function Ct(...e) {
|
|
146
146
|
let t = !1;
|
|
147
147
|
const s = [...e];
|
|
148
148
|
return [
|
|
@@ -161,9 +161,9 @@ class W extends Error {
|
|
|
161
161
|
function m(e, t, s) {
|
|
162
162
|
return new W(e, t, s);
|
|
163
163
|
}
|
|
164
|
-
const
|
|
164
|
+
const _e = "ERR_METHOD_UNSUPPORTED", we = "ERR_METHOD_PARAMETER_UNSUPPORTED", ge = "ERR_UNKNOWN_ENV", fe = "ERR_INVOKE_CUSTOM_METHOD_RESPONSE", me = "ERR_TIMED_OUT", be = "ERR_UNEXPECTED_TYPE", St = "ERR_PARSE", ve = "ERR_NAVIGATION_LIST_EMPTY", ye = "ERR_NAVIGATION_CURSOR_INVALID", dn = "ERR_NAVIGATION_ITEM_INVALID", _n = "ERR_SSR_INIT", Ee = "ERR_INVALID_PATH_BASE";
|
|
165
165
|
function T() {
|
|
166
|
-
return m(
|
|
166
|
+
return m(be, "Value has unexpected type");
|
|
167
167
|
}
|
|
168
168
|
class G {
|
|
169
169
|
constructor(t, s, n) {
|
|
@@ -181,7 +181,7 @@ class G {
|
|
|
181
181
|
return this.parser(t);
|
|
182
182
|
} catch (s) {
|
|
183
183
|
throw m(
|
|
184
|
-
|
|
184
|
+
St,
|
|
185
185
|
`Unable to parse value${this.type ? ` as ${this.type}` : ""}`,
|
|
186
186
|
s
|
|
187
187
|
);
|
|
@@ -204,7 +204,7 @@ const P = A((e) => {
|
|
|
204
204
|
return !1;
|
|
205
205
|
throw T();
|
|
206
206
|
}, "boolean");
|
|
207
|
-
function
|
|
207
|
+
function Tt(e, t) {
|
|
208
208
|
const s = {};
|
|
209
209
|
for (const n in e) {
|
|
210
210
|
const r = e[n];
|
|
@@ -221,21 +221,21 @@ function xt(e, t) {
|
|
|
221
221
|
const a = o(t(i));
|
|
222
222
|
a !== void 0 && (s[n] = a);
|
|
223
223
|
} catch (a) {
|
|
224
|
-
throw m(
|
|
224
|
+
throw m(St, `Unable to parse field "${n}"`, a);
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
227
|
return s;
|
|
228
228
|
}
|
|
229
|
-
function
|
|
229
|
+
function rt(e) {
|
|
230
230
|
let t = e;
|
|
231
231
|
if (typeof t == "string" && (t = JSON.parse(t)), typeof t != "object" || t === null || Array.isArray(t))
|
|
232
232
|
throw T();
|
|
233
233
|
return t;
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function w(e, t) {
|
|
236
236
|
return new G((s) => {
|
|
237
|
-
const n =
|
|
238
|
-
return
|
|
237
|
+
const n = rt(s);
|
|
238
|
+
return Tt(e, (r) => n[r]);
|
|
239
239
|
}, !1, t);
|
|
240
240
|
}
|
|
241
241
|
const x = A((e) => {
|
|
@@ -248,17 +248,17 @@ const x = A((e) => {
|
|
|
248
248
|
}
|
|
249
249
|
throw T();
|
|
250
250
|
}, "number");
|
|
251
|
-
function
|
|
251
|
+
function it(e) {
|
|
252
252
|
return /^#[\da-f]{6}$/i.test(e);
|
|
253
253
|
}
|
|
254
|
-
function
|
|
254
|
+
function Pe(e) {
|
|
255
255
|
return /^#[\da-f]{3}$/i.test(e);
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function At(e) {
|
|
258
258
|
const t = e.replace(/\s/g, "").toLowerCase();
|
|
259
|
-
if (
|
|
259
|
+
if (it(t))
|
|
260
260
|
return t;
|
|
261
|
-
if (
|
|
261
|
+
if (Pe(t)) {
|
|
262
262
|
let n = "#";
|
|
263
263
|
for (let r = 0; r < 3; r += 1)
|
|
264
264
|
n += t[1 + r].repeat(2);
|
|
@@ -276,26 +276,26 @@ const p = A((e) => {
|
|
|
276
276
|
if (typeof e == "string" || typeof e == "number")
|
|
277
277
|
return e.toString();
|
|
278
278
|
throw T();
|
|
279
|
-
}, "string"),
|
|
280
|
-
function
|
|
281
|
-
return
|
|
279
|
+
}, "string"), It = A((e) => At(p().parse(e)), "rgb");
|
|
280
|
+
function kt(e) {
|
|
281
|
+
return w({
|
|
282
282
|
eventType: p(),
|
|
283
283
|
eventData: (t) => t
|
|
284
284
|
}).parse(e);
|
|
285
285
|
}
|
|
286
|
-
function
|
|
286
|
+
function Re() {
|
|
287
287
|
["TelegramGameProxy_receiveEvent", "TelegramGameProxy", "Telegram"].forEach((e) => {
|
|
288
288
|
delete window[e];
|
|
289
289
|
});
|
|
290
290
|
}
|
|
291
|
-
function
|
|
291
|
+
function et(e, t) {
|
|
292
292
|
window.dispatchEvent(new MessageEvent("message", {
|
|
293
293
|
data: JSON.stringify({ eventType: e, eventData: t }),
|
|
294
294
|
// We specify window.parent to imitate the case, the parent iframe sent us this event.
|
|
295
295
|
source: window.parent
|
|
296
296
|
}));
|
|
297
297
|
}
|
|
298
|
-
function
|
|
298
|
+
function xe() {
|
|
299
299
|
[
|
|
300
300
|
["TelegramGameProxy_receiveEvent"],
|
|
301
301
|
// Windows Phone.
|
|
@@ -307,55 +307,55 @@ function Ee() {
|
|
|
307
307
|
let t = window;
|
|
308
308
|
e.forEach((s, n, r) => {
|
|
309
309
|
if (n === r.length - 1) {
|
|
310
|
-
t[s] =
|
|
310
|
+
t[s] = et;
|
|
311
311
|
return;
|
|
312
312
|
}
|
|
313
313
|
s in t || (t[s] = {}), t = t[s];
|
|
314
314
|
});
|
|
315
315
|
});
|
|
316
316
|
}
|
|
317
|
-
const
|
|
318
|
-
clipboard_text_received:
|
|
317
|
+
const Ce = {
|
|
318
|
+
clipboard_text_received: w({
|
|
319
319
|
req_id: p(),
|
|
320
320
|
data: (e) => e === null ? e : p().optional().parse(e)
|
|
321
321
|
}),
|
|
322
|
-
custom_method_invoked:
|
|
322
|
+
custom_method_invoked: w({
|
|
323
323
|
req_id: p(),
|
|
324
324
|
result: (e) => e,
|
|
325
325
|
error: p().optional()
|
|
326
326
|
}),
|
|
327
|
-
invoice_closed:
|
|
328
|
-
phone_requested:
|
|
327
|
+
invoice_closed: w({ slug: p(), status: p() }),
|
|
328
|
+
phone_requested: w({ status: p() }),
|
|
329
329
|
popup_closed: {
|
|
330
330
|
parse(e) {
|
|
331
|
-
return
|
|
331
|
+
return w({
|
|
332
332
|
button_id: (t) => t == null ? void 0 : p().parse(t)
|
|
333
333
|
}).parse(e ?? {});
|
|
334
334
|
}
|
|
335
335
|
},
|
|
336
|
-
qr_text_received:
|
|
337
|
-
theme_changed:
|
|
336
|
+
qr_text_received: w({ data: p().optional() }),
|
|
337
|
+
theme_changed: w({
|
|
338
338
|
theme_params: (e) => {
|
|
339
|
-
const t =
|
|
340
|
-
return Object.entries(
|
|
339
|
+
const t = It().optional();
|
|
340
|
+
return Object.entries(rt(e)).reduce((s, [n, r]) => (s[n] = t.parse(r), s), {});
|
|
341
341
|
}
|
|
342
342
|
}),
|
|
343
|
-
viewport_changed:
|
|
343
|
+
viewport_changed: w({
|
|
344
344
|
height: x(),
|
|
345
345
|
width: (e) => e == null ? window.innerWidth : x().parse(e),
|
|
346
346
|
is_state_stable: P(),
|
|
347
347
|
is_expanded: P()
|
|
348
348
|
}),
|
|
349
|
-
write_access_requested:
|
|
349
|
+
write_access_requested: w({ status: p() })
|
|
350
350
|
};
|
|
351
|
-
function
|
|
351
|
+
function Se() {
|
|
352
352
|
const e = new N(), t = new N();
|
|
353
353
|
t.subscribe((n) => {
|
|
354
354
|
e.emit("event", { name: n.event, payload: n.args[0] });
|
|
355
|
-
}),
|
|
356
|
-
const [, s] =
|
|
355
|
+
}), xe();
|
|
356
|
+
const [, s] = Ct(
|
|
357
357
|
// Don't forget to remove created handlers.
|
|
358
|
-
|
|
358
|
+
Re,
|
|
359
359
|
// Add "resize" event listener to make sure, we always have fresh viewport information.
|
|
360
360
|
// Desktop version of Telegram is sometimes not sending the viewport_changed
|
|
361
361
|
// event. For example, when the MainButton is shown. That's why we should
|
|
@@ -376,16 +376,16 @@ function Re() {
|
|
|
376
376
|
return;
|
|
377
377
|
let r;
|
|
378
378
|
try {
|
|
379
|
-
r =
|
|
379
|
+
r = kt(n.data);
|
|
380
380
|
} catch {
|
|
381
381
|
return;
|
|
382
382
|
}
|
|
383
|
-
const { eventType: i, eventData: o } = r, a =
|
|
383
|
+
const { eventType: i, eventData: o } = r, a = Ce[i];
|
|
384
384
|
try {
|
|
385
385
|
const u = a ? a.parse(o) : o;
|
|
386
386
|
t.emit(...u ? [i, u] : [i]);
|
|
387
387
|
} catch (u) {
|
|
388
|
-
|
|
388
|
+
nt.error(
|
|
389
389
|
`An error occurred processing the "${i}" event from the Telegram application. Please, file an issue here: https://github.com/Telegram-Mini-Apps/tma.js/issues/new/choose`,
|
|
390
390
|
r,
|
|
391
391
|
u
|
|
@@ -410,9 +410,9 @@ function Re() {
|
|
|
410
410
|
}
|
|
411
411
|
}, s];
|
|
412
412
|
}
|
|
413
|
-
const [
|
|
413
|
+
const [Te, Ae] = Rt(
|
|
414
414
|
(e) => {
|
|
415
|
-
const [t, s] =
|
|
415
|
+
const [t, s] = Se(), n = t.off.bind(t);
|
|
416
416
|
return t.off = (r, i) => {
|
|
417
417
|
const { count: o } = t;
|
|
418
418
|
n(r, i), o && !t.count && e();
|
|
@@ -421,7 +421,7 @@ const [xe, Ce] = yt(
|
|
|
421
421
|
([, e]) => e()
|
|
422
422
|
);
|
|
423
423
|
function j() {
|
|
424
|
-
return
|
|
424
|
+
return Te()[0];
|
|
425
425
|
}
|
|
426
426
|
function z(e, t) {
|
|
427
427
|
j().off(e, t);
|
|
@@ -432,7 +432,7 @@ function E(e, t, s) {
|
|
|
432
432
|
function V(e) {
|
|
433
433
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
434
434
|
}
|
|
435
|
-
function
|
|
435
|
+
function Ie(e, t) {
|
|
436
436
|
const s = e.split("."), n = t.split("."), r = Math.max(s.length, n.length);
|
|
437
437
|
for (let i = 0; i < r; i += 1) {
|
|
438
438
|
const o = parseInt(s[i] || "0", 10), a = parseInt(n[i] || "0", 10);
|
|
@@ -442,7 +442,7 @@ function Se(e, t) {
|
|
|
442
442
|
return 0;
|
|
443
443
|
}
|
|
444
444
|
function y(e, t) {
|
|
445
|
-
return
|
|
445
|
+
return Ie(e, t) <= 0;
|
|
446
446
|
}
|
|
447
447
|
function C(e, t, s) {
|
|
448
448
|
if (typeof s == "string") {
|
|
@@ -495,79 +495,79 @@ function C(e, t, s) {
|
|
|
495
495
|
].includes(e);
|
|
496
496
|
}
|
|
497
497
|
}
|
|
498
|
-
function
|
|
498
|
+
function qt(e) {
|
|
499
499
|
return "external" in e && V(e.external) && "notify" in e.external && typeof e.external.notify == "function";
|
|
500
500
|
}
|
|
501
|
-
function
|
|
501
|
+
function Ot(e) {
|
|
502
502
|
return "TelegramWebviewProxy" in e && V(e.TelegramWebviewProxy) && "postEvent" in e.TelegramWebviewProxy && typeof e.TelegramWebviewProxy.postEvent == "function";
|
|
503
503
|
}
|
|
504
|
-
function
|
|
504
|
+
function ot() {
|
|
505
505
|
try {
|
|
506
506
|
return window.self !== window.top;
|
|
507
507
|
} catch {
|
|
508
508
|
return !0;
|
|
509
509
|
}
|
|
510
510
|
}
|
|
511
|
-
let
|
|
512
|
-
function
|
|
513
|
-
|
|
511
|
+
let Dt = "https://web.telegram.org";
|
|
512
|
+
function wn(e) {
|
|
513
|
+
Dt = e;
|
|
514
514
|
}
|
|
515
|
-
function
|
|
516
|
-
return
|
|
515
|
+
function ke() {
|
|
516
|
+
return Dt;
|
|
517
517
|
}
|
|
518
518
|
function B(e, t, s) {
|
|
519
519
|
let n = {}, r;
|
|
520
520
|
t === void 0 && s === void 0 ? n = {} : t !== void 0 && s !== void 0 ? (n = s, r = t) : t !== void 0 && ("targetOrigin" in t ? n = t : r = t);
|
|
521
|
-
const { targetOrigin: i =
|
|
522
|
-
if (
|
|
521
|
+
const { targetOrigin: i = ke() } = n;
|
|
522
|
+
if (de("Posting event:", r ? { event: e, data: r } : { event: e }), ot()) {
|
|
523
523
|
window.parent.postMessage(JSON.stringify({ eventType: e, eventData: r }), i);
|
|
524
524
|
return;
|
|
525
525
|
}
|
|
526
|
-
if (
|
|
526
|
+
if (qt(window)) {
|
|
527
527
|
window.external.notify(JSON.stringify({ eventType: e, eventData: r }));
|
|
528
528
|
return;
|
|
529
529
|
}
|
|
530
|
-
if (
|
|
530
|
+
if (Ot(window)) {
|
|
531
531
|
window.TelegramWebviewProxy.postEvent(e, JSON.stringify(r));
|
|
532
532
|
return;
|
|
533
533
|
}
|
|
534
534
|
throw m(
|
|
535
|
-
|
|
535
|
+
ge,
|
|
536
536
|
"Unable to determine current environment and possible way to send event. You are probably trying to use Mini Apps method outside of Telegram application environment."
|
|
537
537
|
);
|
|
538
538
|
}
|
|
539
|
-
function
|
|
539
|
+
function qe(e) {
|
|
540
540
|
return (t, s) => {
|
|
541
541
|
if (!C(t, e))
|
|
542
|
-
throw m(
|
|
542
|
+
throw m(_e, `Method "${t}" is unsupported in Mini Apps version ${e}`);
|
|
543
543
|
if (V(s)) {
|
|
544
544
|
let n;
|
|
545
545
|
if (t === "web_app_open_link" && "try_instant_view" in s ? n = "try_instant_view" : t === "web_app_set_header_color" && "color" in s && (n = "color"), n && !C(t, n, e))
|
|
546
546
|
throw m(
|
|
547
|
-
|
|
547
|
+
we,
|
|
548
548
|
`Parameter "${n}" of "${t}" method is unsupported in Mini Apps version ${e}`
|
|
549
549
|
);
|
|
550
550
|
}
|
|
551
551
|
return B(t, s);
|
|
552
552
|
};
|
|
553
553
|
}
|
|
554
|
-
function
|
|
554
|
+
function Nt(e) {
|
|
555
555
|
return ({ req_id: t }) => t === e;
|
|
556
556
|
}
|
|
557
|
-
function
|
|
558
|
-
return m(
|
|
557
|
+
function Bt(e) {
|
|
558
|
+
return m(me, `Timeout reached: ${e}ms`);
|
|
559
559
|
}
|
|
560
|
-
function
|
|
560
|
+
function Mt(e, t) {
|
|
561
561
|
return Promise.race([
|
|
562
562
|
typeof e == "function" ? e() : e,
|
|
563
563
|
new Promise((s, n) => {
|
|
564
564
|
setTimeout(() => {
|
|
565
|
-
n(
|
|
565
|
+
n(Bt(t));
|
|
566
566
|
}, t);
|
|
567
567
|
})
|
|
568
568
|
]);
|
|
569
569
|
}
|
|
570
|
-
async function
|
|
570
|
+
async function g(e) {
|
|
571
571
|
let t;
|
|
572
572
|
const s = new Promise((h) => {
|
|
573
573
|
t = h;
|
|
@@ -581,7 +581,7 @@ async function w(e) {
|
|
|
581
581
|
(h) => E(h, (v) => (!i || i(v)) && t(v))
|
|
582
582
|
);
|
|
583
583
|
try {
|
|
584
|
-
return o(n, e.params), await (a ?
|
|
584
|
+
return o(n, e.params), await (a ? Mt(s, a) : s);
|
|
585
585
|
} finally {
|
|
586
586
|
u.forEach((h) => h());
|
|
587
587
|
}
|
|
@@ -590,7 +590,7 @@ async function O(e, t, s, n = {}) {
|
|
|
590
590
|
const {
|
|
591
591
|
result: r,
|
|
592
592
|
error: i
|
|
593
|
-
} = await
|
|
593
|
+
} = await g({
|
|
594
594
|
...n,
|
|
595
595
|
method: "web_app_invoke_custom_method",
|
|
596
596
|
event: "custom_method_invoked",
|
|
@@ -599,30 +599,30 @@ async function O(e, t, s, n = {}) {
|
|
|
599
599
|
params: t,
|
|
600
600
|
req_id: s
|
|
601
601
|
},
|
|
602
|
-
capture:
|
|
602
|
+
capture: Nt(s)
|
|
603
603
|
});
|
|
604
604
|
if (i)
|
|
605
|
-
throw m(
|
|
605
|
+
throw m(fe, i);
|
|
606
606
|
return r;
|
|
607
607
|
}
|
|
608
|
-
function
|
|
608
|
+
function st(...e) {
|
|
609
609
|
return e.map((t) => {
|
|
610
610
|
if (typeof t == "string")
|
|
611
611
|
return t;
|
|
612
612
|
if (V(t))
|
|
613
|
-
return
|
|
613
|
+
return st(Object.entries(t).map((s) => s[1] && s[0]));
|
|
614
614
|
if (Array.isArray(t))
|
|
615
|
-
return
|
|
615
|
+
return st(...t);
|
|
616
616
|
}).filter(Boolean).join(" ");
|
|
617
617
|
}
|
|
618
|
-
function
|
|
618
|
+
function gn(...e) {
|
|
619
619
|
return e.reduce((t, s) => (V(s) && Object.entries(s).forEach(([n, r]) => {
|
|
620
|
-
const i =
|
|
620
|
+
const i = st(t[n], r);
|
|
621
621
|
i.length && (t[n] = i);
|
|
622
622
|
}), t), {});
|
|
623
623
|
}
|
|
624
|
-
function
|
|
625
|
-
const t =
|
|
624
|
+
function Vt(e) {
|
|
625
|
+
const t = At(e);
|
|
626
626
|
return Math.sqrt(
|
|
627
627
|
[0.299, 0.587, 0.114].reduce((s, n, r) => {
|
|
628
628
|
const i = parseInt(t.slice(1 + r * 2, 1 + (r + 1) * 2), 16);
|
|
@@ -630,7 +630,7 @@ function Dt(e) {
|
|
|
630
630
|
}, 0)
|
|
631
631
|
) < 120;
|
|
632
632
|
}
|
|
633
|
-
class
|
|
633
|
+
class Oe {
|
|
634
634
|
constructor(t) {
|
|
635
635
|
c(this, "ee", new N()), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this.state = t;
|
|
636
636
|
}
|
|
@@ -651,20 +651,20 @@ class ke {
|
|
|
651
651
|
return this.state[t];
|
|
652
652
|
}
|
|
653
653
|
}
|
|
654
|
-
class
|
|
654
|
+
class at {
|
|
655
655
|
constructor(t) {
|
|
656
|
-
c(this, "state"), c(this, "get"), c(this, "set"), c(this, "clone"), this.state = new
|
|
656
|
+
c(this, "state"), c(this, "get"), c(this, "set"), c(this, "clone"), this.state = new Oe(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);
|
|
657
657
|
}
|
|
658
658
|
}
|
|
659
|
-
function
|
|
659
|
+
function $t(e, t) {
|
|
660
660
|
return (s) => C(t[s], e);
|
|
661
661
|
}
|
|
662
|
-
class
|
|
662
|
+
class ct extends at {
|
|
663
663
|
constructor(t, s, n) {
|
|
664
|
-
super(t), c(this, "supports"), this.supports =
|
|
664
|
+
super(t), c(this, "supports"), this.supports = $t(s, n);
|
|
665
665
|
}
|
|
666
666
|
}
|
|
667
|
-
class
|
|
667
|
+
class De extends ct {
|
|
668
668
|
constructor(t, s, n) {
|
|
669
669
|
super({ isVisible: t }, s, {
|
|
670
670
|
show: "web_app_setup_back_button",
|
|
@@ -693,19 +693,19 @@ class qe extends ot {
|
|
|
693
693
|
this.isVisible = !0;
|
|
694
694
|
}
|
|
695
695
|
}
|
|
696
|
-
const
|
|
697
|
-
function
|
|
696
|
+
const Lt = A((e) => e instanceof Date ? e : new Date(x().parse(e) * 1e3), "Date");
|
|
697
|
+
function ht(e, t) {
|
|
698
698
|
return new G((s) => {
|
|
699
699
|
if (typeof s != "string" && !(s instanceof URLSearchParams))
|
|
700
700
|
throw T();
|
|
701
701
|
const n = typeof s == "string" ? new URLSearchParams(s) : s;
|
|
702
|
-
return
|
|
702
|
+
return Tt(e, (r) => {
|
|
703
703
|
const i = n.get(r);
|
|
704
704
|
return i === null ? void 0 : i;
|
|
705
705
|
});
|
|
706
706
|
}, !1, t);
|
|
707
707
|
}
|
|
708
|
-
const
|
|
708
|
+
const Ne = w({
|
|
709
709
|
id: x(),
|
|
710
710
|
type: p(),
|
|
711
711
|
title: p(),
|
|
@@ -714,7 +714,7 @@ const Oe = g({
|
|
|
714
714
|
from: "photo_url"
|
|
715
715
|
},
|
|
716
716
|
username: p().optional()
|
|
717
|
-
}, "Chat").optional(),
|
|
717
|
+
}, "Chat").optional(), mt = w({
|
|
718
718
|
addedToAttachmentMenu: {
|
|
719
719
|
type: P().optional(),
|
|
720
720
|
from: "added_to_attachment_menu"
|
|
@@ -750,17 +750,17 @@ const Oe = g({
|
|
|
750
750
|
},
|
|
751
751
|
username: p().optional()
|
|
752
752
|
}, "User").optional();
|
|
753
|
-
function
|
|
754
|
-
return
|
|
753
|
+
function Ht() {
|
|
754
|
+
return ht({
|
|
755
755
|
authDate: {
|
|
756
|
-
type:
|
|
756
|
+
type: Lt(),
|
|
757
757
|
from: "auth_date"
|
|
758
758
|
},
|
|
759
759
|
canSendAfter: {
|
|
760
760
|
type: x().optional(),
|
|
761
761
|
from: "can_send_after"
|
|
762
762
|
},
|
|
763
|
-
chat:
|
|
763
|
+
chat: Ne,
|
|
764
764
|
chatInstance: {
|
|
765
765
|
type: p().optional(),
|
|
766
766
|
from: "chat_instance"
|
|
@@ -774,35 +774,35 @@ function Mt() {
|
|
|
774
774
|
type: p().optional(),
|
|
775
775
|
from: "query_id"
|
|
776
776
|
},
|
|
777
|
-
receiver:
|
|
777
|
+
receiver: mt,
|
|
778
778
|
startParam: {
|
|
779
779
|
type: p().optional(),
|
|
780
780
|
from: "start_param"
|
|
781
781
|
},
|
|
782
|
-
user:
|
|
782
|
+
user: mt
|
|
783
783
|
}, "InitData");
|
|
784
784
|
}
|
|
785
|
-
function
|
|
785
|
+
function Be(e) {
|
|
786
786
|
return e.replace(/_[a-z]/g, (t) => t[1].toUpperCase());
|
|
787
787
|
}
|
|
788
|
-
function
|
|
788
|
+
function Me(e) {
|
|
789
789
|
return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);
|
|
790
790
|
}
|
|
791
|
-
const
|
|
791
|
+
const Ut = A(
|
|
792
792
|
(e) => {
|
|
793
|
-
const t =
|
|
794
|
-
return Object.entries(
|
|
793
|
+
const t = It().optional();
|
|
794
|
+
return Object.entries(rt(e)).reduce((s, [n, r]) => (s[Be(n)] = t.parse(r), s), {});
|
|
795
795
|
},
|
|
796
796
|
"ThemeParams"
|
|
797
797
|
);
|
|
798
|
-
function
|
|
799
|
-
return
|
|
798
|
+
function pt(e) {
|
|
799
|
+
return ht({
|
|
800
800
|
botInline: {
|
|
801
801
|
type: P().optional(),
|
|
802
802
|
from: "tgWebAppBotInline"
|
|
803
803
|
},
|
|
804
804
|
initData: {
|
|
805
|
-
type:
|
|
805
|
+
type: Ht().optional(),
|
|
806
806
|
from: "tgWebAppData"
|
|
807
807
|
},
|
|
808
808
|
initDataRaw: {
|
|
@@ -822,7 +822,7 @@ function $t(e) {
|
|
|
822
822
|
from: "tgWebAppStartParam"
|
|
823
823
|
},
|
|
824
824
|
themeParams: {
|
|
825
|
-
type:
|
|
825
|
+
type: Ut(),
|
|
826
826
|
from: "tgWebAppThemeParams"
|
|
827
827
|
},
|
|
828
828
|
version: {
|
|
@@ -831,47 +831,47 @@ function $t(e) {
|
|
|
831
831
|
}
|
|
832
832
|
}).parse(e);
|
|
833
833
|
}
|
|
834
|
-
function
|
|
835
|
-
return
|
|
834
|
+
function Wt(e) {
|
|
835
|
+
return pt(
|
|
836
836
|
e.replace(/^[^?#]*[?#]/, "").replace(/[?#]/g, "&")
|
|
837
837
|
);
|
|
838
838
|
}
|
|
839
|
-
function
|
|
840
|
-
return
|
|
839
|
+
function Ve() {
|
|
840
|
+
return Wt(window.location.href);
|
|
841
841
|
}
|
|
842
|
-
function
|
|
842
|
+
function Gt() {
|
|
843
843
|
return performance.getEntriesByType("navigation")[0];
|
|
844
844
|
}
|
|
845
|
-
function
|
|
846
|
-
const e =
|
|
845
|
+
function $e() {
|
|
846
|
+
const e = Gt();
|
|
847
847
|
if (!e)
|
|
848
848
|
throw new Error("Unable to get first navigation entry.");
|
|
849
|
-
return
|
|
849
|
+
return Wt(e.name);
|
|
850
850
|
}
|
|
851
|
-
function
|
|
851
|
+
function jt(e) {
|
|
852
852
|
return `tma.js/${e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`)}`;
|
|
853
853
|
}
|
|
854
|
-
function
|
|
855
|
-
sessionStorage.setItem(
|
|
854
|
+
function zt(e, t) {
|
|
855
|
+
sessionStorage.setItem(jt(e), JSON.stringify(t));
|
|
856
856
|
}
|
|
857
|
-
function
|
|
858
|
-
const t = sessionStorage.getItem(
|
|
857
|
+
function Kt(e) {
|
|
858
|
+
const t = sessionStorage.getItem(jt(e));
|
|
859
859
|
try {
|
|
860
860
|
return t ? JSON.parse(t) : void 0;
|
|
861
861
|
} catch {
|
|
862
862
|
}
|
|
863
863
|
}
|
|
864
|
-
function
|
|
865
|
-
return
|
|
864
|
+
function Le() {
|
|
865
|
+
return pt(Kt("launchParams") || "");
|
|
866
866
|
}
|
|
867
|
-
function
|
|
867
|
+
function Jt(e) {
|
|
868
868
|
return JSON.stringify(
|
|
869
869
|
Object.fromEntries(
|
|
870
|
-
Object.entries(e).map(([t, s]) => [
|
|
870
|
+
Object.entries(e).map(([t, s]) => [Me(t), s])
|
|
871
871
|
)
|
|
872
872
|
);
|
|
873
873
|
}
|
|
874
|
-
function
|
|
874
|
+
function He(e) {
|
|
875
875
|
const {
|
|
876
876
|
initDataRaw: t,
|
|
877
877
|
themeParams: s,
|
|
@@ -881,56 +881,56 @@ function Le(e) {
|
|
|
881
881
|
startParam: o,
|
|
882
882
|
botInline: a
|
|
883
883
|
} = e, u = new URLSearchParams();
|
|
884
|
-
return u.set("tgWebAppPlatform", n), u.set("tgWebAppThemeParams",
|
|
884
|
+
return u.set("tgWebAppPlatform", n), u.set("tgWebAppThemeParams", Jt(s)), u.set("tgWebAppVersion", r), t && u.set("tgWebAppData", t), o && u.set("tgWebAppStartParam", o), typeof i == "boolean" && u.set("tgWebAppShowSettings", i ? "1" : "0"), typeof a == "boolean" && u.set("tgWebAppBotInline", a ? "1" : "0"), u.toString();
|
|
885
885
|
}
|
|
886
|
-
function
|
|
887
|
-
|
|
886
|
+
function Ft(e) {
|
|
887
|
+
zt("launchParams", He(e));
|
|
888
888
|
}
|
|
889
|
-
function
|
|
889
|
+
function Qt() {
|
|
890
890
|
for (const e of [
|
|
891
891
|
// Try to retrieve launch parameters from the current location. This method can return
|
|
892
892
|
// nothing in case, location was changed and then page was reloaded.
|
|
893
|
-
|
|
893
|
+
Ve,
|
|
894
894
|
// Then, try using the lower level API - window.performance.
|
|
895
|
-
|
|
895
|
+
$e,
|
|
896
896
|
// Finally, try to extract launch parameters from the session storage.
|
|
897
|
-
|
|
897
|
+
Le
|
|
898
898
|
])
|
|
899
899
|
try {
|
|
900
900
|
const t = e();
|
|
901
|
-
return
|
|
901
|
+
return Ft(t), t;
|
|
902
902
|
} catch {
|
|
903
903
|
}
|
|
904
904
|
throw new Error("Unable to retrieve launch parameters from any known source.");
|
|
905
905
|
}
|
|
906
|
-
function
|
|
907
|
-
const e =
|
|
906
|
+
function Yt() {
|
|
907
|
+
const e = Gt();
|
|
908
908
|
return !!(e && e.type === "reload");
|
|
909
909
|
}
|
|
910
910
|
function Ue() {
|
|
911
911
|
let e = 0;
|
|
912
912
|
return () => (e += 1).toString();
|
|
913
913
|
}
|
|
914
|
-
const [We] =
|
|
914
|
+
const [We] = Rt(Ue);
|
|
915
915
|
function l(e, t) {
|
|
916
916
|
return () => {
|
|
917
|
-
const s =
|
|
917
|
+
const s = Qt(), n = {
|
|
918
918
|
...s,
|
|
919
|
-
postEvent:
|
|
919
|
+
postEvent: qe(s.version),
|
|
920
920
|
createRequestId: We()
|
|
921
921
|
};
|
|
922
922
|
if (typeof e == "function")
|
|
923
923
|
return e(n);
|
|
924
|
-
const [r, i, o] =
|
|
924
|
+
const [r, i, o] = Ct(), a = t({
|
|
925
925
|
...n,
|
|
926
926
|
// State should only be passed only in case, current page was reloaded. If we don't add
|
|
927
927
|
// this check, state restoration will work improperly in the web version of Telegram,
|
|
928
928
|
// when we are always working in the same "session" (tab).
|
|
929
|
-
state:
|
|
929
|
+
state: Yt() ? Kt(e) : void 0,
|
|
930
930
|
addCleanup: r
|
|
931
931
|
}), u = (h) => (o || r(
|
|
932
932
|
h.on("change", (v) => {
|
|
933
|
-
|
|
933
|
+
zt(e, v);
|
|
934
934
|
})
|
|
935
935
|
), h);
|
|
936
936
|
return [
|
|
@@ -943,13 +943,13 @@ const Ge = l("backButton", ({
|
|
|
943
943
|
postEvent: e,
|
|
944
944
|
version: t,
|
|
945
945
|
state: s = { isVisible: !1 }
|
|
946
|
-
}) => new
|
|
947
|
-
class $ extends
|
|
946
|
+
}) => new De(s.isVisible, t, e));
|
|
947
|
+
class $ extends ct {
|
|
948
948
|
constructor() {
|
|
949
949
|
super(...arguments), c(this, "on", this.state.on.bind(this.state)), c(this, "off", this.state.off.bind(this.state));
|
|
950
950
|
}
|
|
951
951
|
}
|
|
952
|
-
function
|
|
952
|
+
function Zt(e) {
|
|
953
953
|
const t = e.available ? e : {
|
|
954
954
|
available: !1,
|
|
955
955
|
device_id: "",
|
|
@@ -1004,7 +1004,7 @@ class je extends $ {
|
|
|
1004
1004
|
reason: t,
|
|
1005
1005
|
...s
|
|
1006
1006
|
}) {
|
|
1007
|
-
return this.authPromise || (this.authPromise =
|
|
1007
|
+
return this.authPromise || (this.authPromise = g({
|
|
1008
1008
|
...s,
|
|
1009
1009
|
method: "web_app_biometry_request_auth",
|
|
1010
1010
|
event: "biometry_auth_requested",
|
|
@@ -1038,14 +1038,14 @@ class je extends $ {
|
|
|
1038
1038
|
* @returns Promise with true, if access was granted.
|
|
1039
1039
|
*/
|
|
1040
1040
|
requestAccess({ reason: t, ...s } = {}) {
|
|
1041
|
-
return this.accessPromise || (this.accessPromise =
|
|
1041
|
+
return this.accessPromise || (this.accessPromise = g({
|
|
1042
1042
|
...s,
|
|
1043
1043
|
postEvent: this.postEvent,
|
|
1044
1044
|
method: "web_app_biometry_request_access",
|
|
1045
1045
|
event: "biometry_info_received",
|
|
1046
1046
|
params: { reason: t || "" }
|
|
1047
1047
|
}).then((n) => {
|
|
1048
|
-
const r =
|
|
1048
|
+
const r = Zt(n);
|
|
1049
1049
|
return this.set(r), r.accessGranted;
|
|
1050
1050
|
}).finally(() => this.accessPromise = void 0)), this.accessPromise;
|
|
1051
1051
|
}
|
|
@@ -1067,7 +1067,7 @@ class je extends $ {
|
|
|
1067
1067
|
*/
|
|
1068
1068
|
async updateToken({ token: t, ...s } = {}) {
|
|
1069
1069
|
return ["removed", "updated"].includes(
|
|
1070
|
-
(await
|
|
1070
|
+
(await g({
|
|
1071
1071
|
...s,
|
|
1072
1072
|
postEvent: this.postEvent,
|
|
1073
1073
|
method: "web_app_biometry_update_token",
|
|
@@ -1078,8 +1078,8 @@ class je extends $ {
|
|
|
1078
1078
|
}
|
|
1079
1079
|
}
|
|
1080
1080
|
async function ze(e) {
|
|
1081
|
-
return
|
|
1082
|
-
await
|
|
1081
|
+
return Zt(
|
|
1082
|
+
await g({
|
|
1083
1083
|
...e || {},
|
|
1084
1084
|
method: "web_app_biometry_get_info",
|
|
1085
1085
|
event: "biometry_info_received"
|
|
@@ -1100,12 +1100,12 @@ const Ke = l(
|
|
|
1100
1100
|
postEvent: e
|
|
1101
1101
|
})
|
|
1102
1102
|
);
|
|
1103
|
-
class
|
|
1103
|
+
class ut extends at {
|
|
1104
1104
|
constructor() {
|
|
1105
1105
|
super(...arguments), c(this, "on", this.state.on.bind(this.state)), c(this, "off", this.state.off.bind(this.state));
|
|
1106
1106
|
}
|
|
1107
1107
|
}
|
|
1108
|
-
class Je extends
|
|
1108
|
+
class Je extends ut {
|
|
1109
1109
|
constructor(t, s) {
|
|
1110
1110
|
super({ isConfirmationNeeded: t }), this.postEvent = s;
|
|
1111
1111
|
}
|
|
@@ -1139,9 +1139,9 @@ const Fe = l(
|
|
|
1139
1139
|
state: t = { isConfirmationNeeded: !1 }
|
|
1140
1140
|
}) => new Je(t.isConfirmationNeeded, e)
|
|
1141
1141
|
);
|
|
1142
|
-
class
|
|
1142
|
+
class lt {
|
|
1143
1143
|
constructor(t, s) {
|
|
1144
|
-
c(this, "supports"), this.supports =
|
|
1144
|
+
c(this, "supports"), this.supports = $t(t, s);
|
|
1145
1145
|
}
|
|
1146
1146
|
}
|
|
1147
1147
|
function Qe(e) {
|
|
@@ -1177,10 +1177,10 @@ class Ye extends G {
|
|
|
1177
1177
|
function Ze(e) {
|
|
1178
1178
|
return new Ye((t) => t, !1, e);
|
|
1179
1179
|
}
|
|
1180
|
-
function
|
|
1180
|
+
function bt(e, t) {
|
|
1181
1181
|
return Object.fromEntries(e.map((s) => [s, t]));
|
|
1182
1182
|
}
|
|
1183
|
-
class Xe extends
|
|
1183
|
+
class Xe extends lt {
|
|
1184
1184
|
constructor(t, s, n) {
|
|
1185
1185
|
super(t, {
|
|
1186
1186
|
delete: "web_app_invoke_custom_method",
|
|
@@ -1220,13 +1220,13 @@ class Xe extends ht {
|
|
|
1220
1220
|
async get(t, s = {}) {
|
|
1221
1221
|
const n = Array.isArray(t) ? t : [t];
|
|
1222
1222
|
if (!n.length)
|
|
1223
|
-
return
|
|
1223
|
+
return bt(n, "");
|
|
1224
1224
|
const r = await O(
|
|
1225
1225
|
"getStorageValues",
|
|
1226
1226
|
{ keys: n },
|
|
1227
1227
|
this.createRequestId(),
|
|
1228
1228
|
{ ...s, postEvent: this.postEvent }
|
|
1229
|
-
), i =
|
|
1229
|
+
), i = w(bt(n, p()), "CloudStorageData").parse(r);
|
|
1230
1230
|
return Array.isArray(t) ? i : i[t];
|
|
1231
1231
|
}
|
|
1232
1232
|
/**
|
|
@@ -1247,7 +1247,7 @@ class Xe extends ht {
|
|
|
1247
1247
|
const ts = l(
|
|
1248
1248
|
({ createRequestId: e, postEvent: t, version: s }) => new Xe(s, e, t)
|
|
1249
1249
|
);
|
|
1250
|
-
class es extends
|
|
1250
|
+
class es extends lt {
|
|
1251
1251
|
constructor(t, s) {
|
|
1252
1252
|
super(t, {
|
|
1253
1253
|
impactOccurred: "web_app_trigger_haptic_feedback",
|
|
@@ -1369,7 +1369,7 @@ const rs = l(
|
|
|
1369
1369
|
({ initData: e }) => e ? new ns(e) : void 0
|
|
1370
1370
|
);
|
|
1371
1371
|
function fn(e) {
|
|
1372
|
-
return
|
|
1372
|
+
return Ht().parse(e);
|
|
1373
1373
|
}
|
|
1374
1374
|
class is extends $ {
|
|
1375
1375
|
constructor(t, s, n) {
|
|
@@ -1401,7 +1401,7 @@ class is extends $ {
|
|
|
1401
1401
|
}
|
|
1402
1402
|
this.isOpened = !0;
|
|
1403
1403
|
try {
|
|
1404
|
-
return (await
|
|
1404
|
+
return (await g({
|
|
1405
1405
|
method: "web_app_open_invoice",
|
|
1406
1406
|
event: "invoice_closed",
|
|
1407
1407
|
params: { slug: n },
|
|
@@ -1418,7 +1418,7 @@ class is extends $ {
|
|
|
1418
1418
|
const os = l(
|
|
1419
1419
|
({ version: e, postEvent: t }) => new is(!1, e, t)
|
|
1420
1420
|
);
|
|
1421
|
-
class as extends
|
|
1421
|
+
class as extends at {
|
|
1422
1422
|
constructor({ postEvent: t, ...s }) {
|
|
1423
1423
|
super(s), c(this, "postEvent"), c(this, "on", (n, r) => n === "click" ? E("main_button_pressed", r) : this.state.on(n, r)), c(this, "off", (n, r) => n === "click" ? z("main_button_pressed", r) : this.state.off(n, r)), this.postEvent = t;
|
|
1424
1424
|
}
|
|
@@ -1565,8 +1565,8 @@ const cs = l(
|
|
|
1565
1565
|
}) => new as({ ...s, postEvent: e })
|
|
1566
1566
|
);
|
|
1567
1567
|
function hs() {
|
|
1568
|
-
return
|
|
1569
|
-
contact:
|
|
1568
|
+
return ht({
|
|
1569
|
+
contact: w({
|
|
1570
1570
|
userId: {
|
|
1571
1571
|
type: x(),
|
|
1572
1572
|
from: "user_id"
|
|
@@ -1585,13 +1585,13 @@ function hs() {
|
|
|
1585
1585
|
}
|
|
1586
1586
|
}),
|
|
1587
1587
|
authDate: {
|
|
1588
|
-
type:
|
|
1588
|
+
type: Lt(),
|
|
1589
1589
|
from: "auth_date"
|
|
1590
1590
|
},
|
|
1591
1591
|
hash: p()
|
|
1592
1592
|
}, "RequestedContact");
|
|
1593
1593
|
}
|
|
1594
|
-
function
|
|
1594
|
+
function Xt(e, t) {
|
|
1595
1595
|
return (s) => {
|
|
1596
1596
|
const [n, r] = t[s];
|
|
1597
1597
|
return C(n, r, e);
|
|
@@ -1612,7 +1612,7 @@ class us extends $ {
|
|
|
1612
1612
|
setBackgroundColor: "web_app_set_background_color"
|
|
1613
1613
|
}), 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;
|
|
1614
1614
|
const o = this.supports.bind(this);
|
|
1615
|
-
this.supports = (a) => o(a) ? a !== "switchInlineQuery" || r : !1, this.supportsParam =
|
|
1615
|
+
this.supports = (a) => o(a) ? a !== "switchInlineQuery" || r : !1, this.supportsParam = Xt(n, {
|
|
1616
1616
|
"setHeaderColor.color": ["web_app_set_header_color", "color"]
|
|
1617
1617
|
});
|
|
1618
1618
|
}
|
|
@@ -1663,7 +1663,7 @@ class us extends $ {
|
|
|
1663
1663
|
* True if current Mini App background color is recognized as dark.
|
|
1664
1664
|
*/
|
|
1665
1665
|
get isDark() {
|
|
1666
|
-
return
|
|
1666
|
+
return Vt(this.bgColor);
|
|
1667
1667
|
}
|
|
1668
1668
|
/**
|
|
1669
1669
|
* Informs the Telegram app that the Mini App is ready to be displayed.
|
|
@@ -1692,7 +1692,7 @@ class us extends $ {
|
|
|
1692
1692
|
throw new Error("Access denied.");
|
|
1693
1693
|
const s = Date.now() + t;
|
|
1694
1694
|
let n = 50;
|
|
1695
|
-
return
|
|
1695
|
+
return Mt(async () => {
|
|
1696
1696
|
for (; Date.now() < s; ) {
|
|
1697
1697
|
try {
|
|
1698
1698
|
return await this.getRequestedContact();
|
|
@@ -1700,7 +1700,7 @@ class us extends $ {
|
|
|
1700
1700
|
}
|
|
1701
1701
|
await ps(n), n += 50;
|
|
1702
1702
|
}
|
|
1703
|
-
throw
|
|
1703
|
+
throw Bt(t);
|
|
1704
1704
|
}, t);
|
|
1705
1705
|
}
|
|
1706
1706
|
/**
|
|
@@ -1713,7 +1713,7 @@ class us extends $ {
|
|
|
1713
1713
|
* @see requestContact
|
|
1714
1714
|
*/
|
|
1715
1715
|
async requestPhoneAccess(t = {}) {
|
|
1716
|
-
return this.requestPhoneAccessPromise || (this.requestPhoneAccessPromise =
|
|
1716
|
+
return this.requestPhoneAccessPromise || (this.requestPhoneAccessPromise = g({
|
|
1717
1717
|
...t,
|
|
1718
1718
|
method: "web_app_request_phone",
|
|
1719
1719
|
event: "phone_requested",
|
|
@@ -1725,7 +1725,7 @@ class us extends $ {
|
|
|
1725
1725
|
* @param options - additional options.
|
|
1726
1726
|
*/
|
|
1727
1727
|
async requestWriteAccess(t = {}) {
|
|
1728
|
-
return this.requestWriteAccessPromise || (this.requestWriteAccessPromise =
|
|
1728
|
+
return this.requestWriteAccessPromise || (this.requestWriteAccessPromise = g({
|
|
1729
1729
|
...t,
|
|
1730
1730
|
method: "web_app_request_write_access",
|
|
1731
1731
|
event: "write_access_requested",
|
|
@@ -1755,7 +1755,7 @@ class us extends $ {
|
|
|
1755
1755
|
* @param color - color key or RGB color.
|
|
1756
1756
|
*/
|
|
1757
1757
|
setHeaderColor(t) {
|
|
1758
|
-
this.postEvent("web_app_set_header_color",
|
|
1758
|
+
this.postEvent("web_app_set_header_color", it(t) ? { color: t } : { color_key: t }), this.set("headerColor", t);
|
|
1759
1759
|
}
|
|
1760
1760
|
/**
|
|
1761
1761
|
* Updates current Mini App background color.
|
|
@@ -1848,7 +1848,7 @@ class _s extends $ {
|
|
|
1848
1848
|
throw new Error("Popup is already opened.");
|
|
1849
1849
|
this.isOpened = !0;
|
|
1850
1850
|
try {
|
|
1851
|
-
const { button_id: s = null } = await
|
|
1851
|
+
const { button_id: s = null } = await g({
|
|
1852
1852
|
event: "popup_closed",
|
|
1853
1853
|
method: "web_app_open_popup",
|
|
1854
1854
|
postEvent: this.postEvent,
|
|
@@ -1860,10 +1860,10 @@ class _s extends $ {
|
|
|
1860
1860
|
}
|
|
1861
1861
|
}
|
|
1862
1862
|
}
|
|
1863
|
-
const
|
|
1863
|
+
const ws = l(
|
|
1864
1864
|
({ postEvent: e, version: t }) => new _s(!1, t, e)
|
|
1865
1865
|
);
|
|
1866
|
-
class
|
|
1866
|
+
class gs extends $ {
|
|
1867
1867
|
constructor(t, s, n) {
|
|
1868
1868
|
super({ isOpened: t }, s, {
|
|
1869
1869
|
close: "web_app_close_scan_qr_popup",
|
|
@@ -1896,7 +1896,7 @@ class ws extends $ {
|
|
|
1896
1896
|
throw new Error("QR scanner is already opened.");
|
|
1897
1897
|
this.isOpened = !0;
|
|
1898
1898
|
try {
|
|
1899
|
-
return (await
|
|
1899
|
+
return (await g({
|
|
1900
1900
|
method: "web_app_open_scan_qr_popup",
|
|
1901
1901
|
event: ["qr_text_received", "scan_qr_popup_closed"],
|
|
1902
1902
|
postEvent: this.postEvent,
|
|
@@ -1908,9 +1908,9 @@ class ws extends $ {
|
|
|
1908
1908
|
}
|
|
1909
1909
|
}
|
|
1910
1910
|
const fs = l(
|
|
1911
|
-
({ version: e, postEvent: t }) => new
|
|
1911
|
+
({ version: e, postEvent: t }) => new gs(!1, e, t)
|
|
1912
1912
|
);
|
|
1913
|
-
class ms extends
|
|
1913
|
+
class ms extends ct {
|
|
1914
1914
|
constructor(t, s, n) {
|
|
1915
1915
|
super({ isVisible: t }, s, {
|
|
1916
1916
|
show: "web_app_setup_settings_button",
|
|
@@ -1947,10 +1947,10 @@ const bs = l(
|
|
|
1947
1947
|
state: s = { isVisible: !1 }
|
|
1948
1948
|
}) => new ms(s.isVisible, e, t)
|
|
1949
1949
|
);
|
|
1950
|
-
function
|
|
1951
|
-
return
|
|
1950
|
+
function te(e) {
|
|
1951
|
+
return Ut().parse(e);
|
|
1952
1952
|
}
|
|
1953
|
-
class vs extends
|
|
1953
|
+
class vs extends ut {
|
|
1954
1954
|
/**
|
|
1955
1955
|
* @since v6.10
|
|
1956
1956
|
*/
|
|
@@ -1989,7 +1989,7 @@ class vs extends ct {
|
|
|
1989
1989
|
* value is calculated according to theme bg color.
|
|
1990
1990
|
*/
|
|
1991
1991
|
get isDark() {
|
|
1992
|
-
return !this.bgColor ||
|
|
1992
|
+
return !this.bgColor || Vt(this.bgColor);
|
|
1993
1993
|
}
|
|
1994
1994
|
get linkColor() {
|
|
1995
1995
|
return this.get("linkColor");
|
|
@@ -2015,7 +2015,7 @@ class vs extends ct {
|
|
|
2015
2015
|
*/
|
|
2016
2016
|
listen() {
|
|
2017
2017
|
return E("theme_changed", (t) => {
|
|
2018
|
-
this.set(
|
|
2018
|
+
this.set(te(t.theme_params));
|
|
2019
2019
|
});
|
|
2020
2020
|
}
|
|
2021
2021
|
/**
|
|
@@ -2036,15 +2036,15 @@ const ys = l(
|
|
|
2036
2036
|
}
|
|
2037
2037
|
);
|
|
2038
2038
|
function mn(e = {}) {
|
|
2039
|
-
return
|
|
2039
|
+
return g({
|
|
2040
2040
|
...e,
|
|
2041
2041
|
method: "web_app_request_theme",
|
|
2042
2042
|
event: "theme_changed"
|
|
2043
|
-
}).then(
|
|
2043
|
+
}).then(te);
|
|
2044
2044
|
}
|
|
2045
|
-
class Es extends
|
|
2045
|
+
class Es extends lt {
|
|
2046
2046
|
constructor(t, s, n) {
|
|
2047
|
-
super(t, { readTextFromClipboard: "web_app_read_text_from_clipboard" }), c(this, "supportsParam"), this.version = t, this.createRequestId = s, this.postEvent = n, this.supportsParam =
|
|
2047
|
+
super(t, { readTextFromClipboard: "web_app_read_text_from_clipboard" }), c(this, "supportsParam"), this.version = t, this.createRequestId = s, this.postEvent = n, this.supportsParam = Xt(t, {
|
|
2048
2048
|
"openLink.tryInstantView": ["web_app_open_link", "try_instant_view"]
|
|
2049
2049
|
});
|
|
2050
2050
|
}
|
|
@@ -2093,12 +2093,12 @@ class Es extends ht {
|
|
|
2093
2093
|
async readTextFromClipboard() {
|
|
2094
2094
|
const t = this.createRequestId(), {
|
|
2095
2095
|
data: s = null
|
|
2096
|
-
} = await
|
|
2096
|
+
} = await g({
|
|
2097
2097
|
method: "web_app_read_text_from_clipboard",
|
|
2098
2098
|
event: "clipboard_text_received",
|
|
2099
2099
|
postEvent: this.postEvent,
|
|
2100
2100
|
params: { req_id: t },
|
|
2101
|
-
capture:
|
|
2101
|
+
capture: Nt(t)
|
|
2102
2102
|
});
|
|
2103
2103
|
return s;
|
|
2104
2104
|
}
|
|
@@ -2106,12 +2106,12 @@ class Es extends ht {
|
|
|
2106
2106
|
const Ps = l(
|
|
2107
2107
|
({ version: e, postEvent: t, createRequestId: s }) => new Es(e, s, t)
|
|
2108
2108
|
);
|
|
2109
|
-
async function
|
|
2109
|
+
async function ee(e = {}) {
|
|
2110
2110
|
const {
|
|
2111
2111
|
is_expanded: t,
|
|
2112
2112
|
is_state_stable: s,
|
|
2113
2113
|
...n
|
|
2114
|
-
} = await
|
|
2114
|
+
} = await g({
|
|
2115
2115
|
...e,
|
|
2116
2116
|
method: "web_app_request_viewport",
|
|
2117
2117
|
event: "viewport_changed"
|
|
@@ -2121,7 +2121,7 @@ async function Qt(e = {}) {
|
|
|
2121
2121
|
function q(e) {
|
|
2122
2122
|
return e < 0 ? 0 : e;
|
|
2123
2123
|
}
|
|
2124
|
-
class Rs extends
|
|
2124
|
+
class Rs extends ut {
|
|
2125
2125
|
constructor({ postEvent: t, stableHeight: s, height: n, width: r, isExpanded: i }) {
|
|
2126
2126
|
super({
|
|
2127
2127
|
height: q(n),
|
|
@@ -2136,7 +2136,7 @@ class Rs extends ct {
|
|
|
2136
2136
|
* @param options - options to request fresh data.
|
|
2137
2137
|
*/
|
|
2138
2138
|
async sync(t) {
|
|
2139
|
-
const { isStateStable: s, ...n } = await
|
|
2139
|
+
const { isStateStable: s, ...n } = await ee(t);
|
|
2140
2140
|
this.set({
|
|
2141
2141
|
...n,
|
|
2142
2142
|
stableHeight: s ? n.height : this.get("stableHeight")
|
|
@@ -2237,7 +2237,7 @@ const xs = l(
|
|
|
2237
2237
|
else if (["macos", "tdesktop", "unigram", "webk", "weba", "web"].includes(t))
|
|
2238
2238
|
r = !0, i = window.innerHeight, o = window.innerWidth, a = window.innerHeight;
|
|
2239
2239
|
else {
|
|
2240
|
-
const h = await
|
|
2240
|
+
const h = await ee({ timeout: 1e3, postEvent: s });
|
|
2241
2241
|
r = h.isExpanded, i = h.height, o = h.width, a = h.isStateStable ? i : 0;
|
|
2242
2242
|
}
|
|
2243
2243
|
const u = new Rs({
|
|
@@ -2257,7 +2257,7 @@ function bn(e, t, s) {
|
|
|
2257
2257
|
s || (s = (a) => `--tg-${a}-color`);
|
|
2258
2258
|
const n = s("header"), r = s("bg"), i = () => {
|
|
2259
2259
|
const { headerColor: a } = e;
|
|
2260
|
-
if (
|
|
2260
|
+
if (it(a))
|
|
2261
2261
|
R(n, a);
|
|
2262
2262
|
else {
|
|
2263
2263
|
const { bgColor: u, secondaryBgColor: h } = t;
|
|
@@ -2313,18 +2313,58 @@ function Ss() {
|
|
|
2313
2313
|
return typeof window > "u";
|
|
2314
2314
|
}
|
|
2315
2315
|
async function En() {
|
|
2316
|
-
if (
|
|
2316
|
+
if (Ot(window))
|
|
2317
2317
|
return !0;
|
|
2318
2318
|
try {
|
|
2319
|
-
return await
|
|
2319
|
+
return await g({ method: "web_app_request_theme", event: "theme_changed", timeout: 100 }), !0;
|
|
2320
2320
|
} catch {
|
|
2321
2321
|
return !1;
|
|
2322
2322
|
}
|
|
2323
2323
|
}
|
|
2324
|
+
function Pn(e) {
|
|
2325
|
+
const t = typeof e == "string" ? pt(e) : e;
|
|
2326
|
+
Ft(t);
|
|
2327
|
+
function s(r) {
|
|
2328
|
+
if (typeof r == "string")
|
|
2329
|
+
try {
|
|
2330
|
+
const { eventType: i } = kt(r);
|
|
2331
|
+
i === "web_app_request_theme" && et("theme_changed", {
|
|
2332
|
+
theme_params: JSON.parse(Jt(t.themeParams))
|
|
2333
|
+
}), i === "web_app_request_viewport" && et("viewport_changed", {
|
|
2334
|
+
width: window.innerWidth,
|
|
2335
|
+
height: window.innerHeight,
|
|
2336
|
+
is_state_stable: !0,
|
|
2337
|
+
is_expanded: !0
|
|
2338
|
+
});
|
|
2339
|
+
} catch {
|
|
2340
|
+
}
|
|
2341
|
+
}
|
|
2342
|
+
if (ot()) {
|
|
2343
|
+
const r = window.parent.postMessage.bind(window.parent);
|
|
2344
|
+
window.parent.postMessage = (i) => {
|
|
2345
|
+
s(i), r(i);
|
|
2346
|
+
};
|
|
2347
|
+
return;
|
|
2348
|
+
}
|
|
2349
|
+
if (qt(window)) {
|
|
2350
|
+
const r = window.external.notify.bind(window.external);
|
|
2351
|
+
window.external.notify = (i) => {
|
|
2352
|
+
s(i), r(i);
|
|
2353
|
+
};
|
|
2354
|
+
return;
|
|
2355
|
+
}
|
|
2356
|
+
const n = window.TelegramWebviewProxy;
|
|
2357
|
+
window.TelegramWebviewProxy = {
|
|
2358
|
+
...n || {},
|
|
2359
|
+
postEvent(...r) {
|
|
2360
|
+
s(JSON.stringify({ eventType: r[0], eventData: r[1] })), n && n.postEvent(...r);
|
|
2361
|
+
}
|
|
2362
|
+
};
|
|
2363
|
+
}
|
|
2324
2364
|
function Ts(e) {
|
|
2325
2365
|
return e instanceof W;
|
|
2326
2366
|
}
|
|
2327
|
-
function
|
|
2367
|
+
function Rn(e, t) {
|
|
2328
2368
|
return Ts(e) && e.type === t;
|
|
2329
2369
|
}
|
|
2330
2370
|
function J(e, t) {
|
|
@@ -2338,10 +2378,10 @@ function J(e, t) {
|
|
|
2338
2378
|
class As {
|
|
2339
2379
|
constructor(t, s, n = B) {
|
|
2340
2380
|
if (c(this, "history"), c(this, "ee", new N()), 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)
|
|
2341
|
-
throw m(
|
|
2381
|
+
throw m(ve, "History should not be empty.");
|
|
2342
2382
|
if (s < 0 || s >= t.length)
|
|
2343
2383
|
throw m(
|
|
2344
|
-
|
|
2384
|
+
ye,
|
|
2345
2385
|
"Index should not be zero and higher or equal than history size."
|
|
2346
2386
|
);
|
|
2347
2387
|
this.history = t.map((r) => J(r, ""));
|
|
@@ -2502,16 +2542,16 @@ async function Is() {
|
|
|
2502
2542
|
for (; e; )
|
|
2503
2543
|
e = await D(-1);
|
|
2504
2544
|
}
|
|
2505
|
-
function
|
|
2545
|
+
function se(e) {
|
|
2506
2546
|
return H(e).pathname;
|
|
2507
2547
|
}
|
|
2508
|
-
const
|
|
2509
|
-
class
|
|
2548
|
+
const vt = 0, Y = 1, Z = 2;
|
|
2549
|
+
class ne {
|
|
2510
2550
|
constructor(t, s, { postEvent: n, hashMode: r = "classic", base: i } = {}) {
|
|
2511
2551
|
c(this, "navigator"), c(this, "ee", new N()), c(this, "hashMode"), c(this, "base"), c(this, "attached", !1), c(this, "onPopState", ({ state: o }) => {
|
|
2512
2552
|
if (o === null)
|
|
2513
2553
|
return this.push(this.parsePath(window.location.href));
|
|
2514
|
-
o ===
|
|
2554
|
+
o === vt ? window.history.forward() : o === Y && this.back(), o === Z && this.forward();
|
|
2515
2555
|
}), c(this, "onNavigatorChange", async ({
|
|
2516
2556
|
to: o,
|
|
2517
2557
|
from: a,
|
|
@@ -2527,7 +2567,7 @@ class Zt {
|
|
|
2527
2567
|
t.map((o) => Q(o, "/")),
|
|
2528
2568
|
s,
|
|
2529
2569
|
n
|
|
2530
|
-
), this.navigator.on("change", this.onNavigatorChange), this.hashMode = r, this.base =
|
|
2570
|
+
), this.navigator.on("change", this.onNavigatorChange), this.hashMode = r, this.base = se(i || "");
|
|
2531
2571
|
}
|
|
2532
2572
|
/**
|
|
2533
2573
|
* Attaches current navigator to the browser history allowing navigator to manipulate it.
|
|
@@ -2684,7 +2724,7 @@ class Zt {
|
|
|
2684
2724
|
async syncHistory() {
|
|
2685
2725
|
window.removeEventListener("popstate", this.onPopState);
|
|
2686
2726
|
const { state: t } = this, s = this.renderPath(this);
|
|
2687
|
-
await Is(), this.hasPrev && this.hasNext ? (window.history.replaceState(Y, ""), window.history.pushState(t, "", s), window.history.pushState(Z, ""), await D(-1)) : this.hasPrev ? (window.history.replaceState(Y, ""), window.history.pushState(t, "", s)) : this.hasNext ? (window.history.replaceState(t, s), window.history.pushState(Z, ""), await D(-1)) : (window.history.replaceState(
|
|
2727
|
+
await Is(), this.hasPrev && this.hasNext ? (window.history.replaceState(Y, ""), window.history.pushState(t, "", s), window.history.pushState(Z, ""), await D(-1)) : this.hasPrev ? (window.history.replaceState(Y, ""), window.history.pushState(t, "", s)) : this.hasNext ? (window.history.replaceState(t, s), window.history.pushState(Z, ""), await D(-1)) : (window.history.replaceState(vt, ""), window.history.pushState(t, "", s)), window.addEventListener("popstate", this.onPopState);
|
|
2688
2728
|
}
|
|
2689
2729
|
/**
|
|
2690
2730
|
* Current query parameters.
|
|
@@ -2708,35 +2748,35 @@ function ks(e) {
|
|
|
2708
2748
|
let n = U(
|
|
2709
2749
|
e.hashMode === null ? t : s.includes("?") ? s.slice(1) : `?${s.slice(1)}`
|
|
2710
2750
|
);
|
|
2711
|
-
const r = e.base ?
|
|
2751
|
+
const r = e.base ? se(e.base) : void 0;
|
|
2712
2752
|
if (r) {
|
|
2713
2753
|
if (!n.startsWith(r))
|
|
2714
2754
|
throw m(
|
|
2715
|
-
|
|
2755
|
+
Ee,
|
|
2716
2756
|
`Path "${n}" expected to be starting with "${r}"`
|
|
2717
2757
|
);
|
|
2718
2758
|
n = n.slice(r.length);
|
|
2719
2759
|
}
|
|
2720
|
-
return new
|
|
2760
|
+
return new ne([n], 0, e);
|
|
2721
2761
|
}
|
|
2722
|
-
function
|
|
2762
|
+
function xn(e) {
|
|
2723
2763
|
const t = e.match(/#(.+)/);
|
|
2724
2764
|
return t ? t[1] : null;
|
|
2725
2765
|
}
|
|
2726
2766
|
function qs(e, t) {
|
|
2727
|
-
if (
|
|
2767
|
+
if (Yt()) {
|
|
2728
2768
|
const s = sessionStorage.getItem(e);
|
|
2729
2769
|
if (s)
|
|
2730
2770
|
try {
|
|
2731
2771
|
const { index: n, history: r } = JSON.parse(s);
|
|
2732
|
-
return new
|
|
2772
|
+
return new ne(r, n, t);
|
|
2733
2773
|
} catch (n) {
|
|
2734
2774
|
console.error("Unable to restore hash navigator state.", n);
|
|
2735
2775
|
}
|
|
2736
2776
|
}
|
|
2737
2777
|
return ks(t);
|
|
2738
2778
|
}
|
|
2739
|
-
function
|
|
2779
|
+
function Cn(e, t) {
|
|
2740
2780
|
const s = qs(e, t), n = () => sessionStorage.setItem(e, JSON.stringify({
|
|
2741
2781
|
index: s.index,
|
|
2742
2782
|
history: s.history
|
|
@@ -2751,22 +2791,22 @@ function d(e, t) {
|
|
|
2751
2791
|
...u,
|
|
2752
2792
|
[i]: n(o)
|
|
2753
2793
|
};
|
|
2754
|
-
return /* @__PURE__ */
|
|
2794
|
+
return /* @__PURE__ */ yt(a, { ...h });
|
|
2755
2795
|
};
|
|
2756
2796
|
};
|
|
2757
2797
|
}
|
|
2758
2798
|
return [s(e), s(t)];
|
|
2759
2799
|
}
|
|
2760
|
-
const
|
|
2800
|
+
const re = ie(void 0);
|
|
2761
2801
|
function Os() {
|
|
2762
|
-
const e =
|
|
2802
|
+
const e = oe(re);
|
|
2763
2803
|
if (!e)
|
|
2764
2804
|
throw new Error("useSDK was used outside the SDKProvider.");
|
|
2765
2805
|
return e;
|
|
2766
2806
|
}
|
|
2767
2807
|
function _(e) {
|
|
2768
2808
|
function t(n) {
|
|
2769
|
-
const r = Os(), [i, o] =
|
|
2809
|
+
const r = Os(), [i, o] = Et(
|
|
2770
2810
|
n ? void 0 : () => {
|
|
2771
2811
|
if (Ss())
|
|
2772
2812
|
throw new Error("Using hooks on the server side, you must explicitly specify ssr = true option");
|
|
@@ -2787,40 +2827,40 @@ function _(e) {
|
|
|
2787
2827
|
}
|
|
2788
2828
|
return [t, s];
|
|
2789
2829
|
}
|
|
2790
|
-
const [Ds, Ns] = _(Ge), [
|
|
2830
|
+
const [Ds, Ns] = _(Ge), [Sn, Tn] = d(
|
|
2791
2831
|
Ds,
|
|
2792
2832
|
Ns
|
|
2793
|
-
), [Bs, Ms] = _(Ke), [
|
|
2833
|
+
), [Bs, Ms] = _(Ke), [An, In] = d(
|
|
2794
2834
|
Bs,
|
|
2795
2835
|
Ms
|
|
2796
|
-
), [Vs, $s] = _(Fe), [
|
|
2836
|
+
), [Vs, $s] = _(Fe), [kn, qn] = d(
|
|
2797
2837
|
Vs,
|
|
2798
2838
|
$s
|
|
2799
|
-
), [Ls, Hs] = _(ts), [
|
|
2839
|
+
), [Ls, Hs] = _(ts), [On, Dn] = d(
|
|
2800
2840
|
Ls,
|
|
2801
2841
|
Hs
|
|
2802
|
-
), [Us, Ws] = _(ss), [
|
|
2842
|
+
), [Us, Ws] = _(ss), [Nn, Bn] = d(
|
|
2803
2843
|
Us,
|
|
2804
2844
|
Ws
|
|
2805
|
-
), [Gs, js] = _(rs), [
|
|
2845
|
+
), [Gs, js] = _(rs), [Mn, Vn] = d(Gs, js), [zs, Ks] = _(os), [$n, Ln] = d(zs, Ks), [Js, Fs] = _(cs), [Hn, Un] = d(Js, Fs), [Qs, Ys] = _(ls), [Wn, Gn] = d(Qs, Ys), [Zs, Xs] = _(ws), [jn, zn] = d(Zs, Xs), [tn, en] = _(fs), [Kn, Jn] = d(tn, en), [sn, nn] = _(bs), [Fn, Qn] = d(
|
|
2806
2846
|
sn,
|
|
2807
2847
|
nn
|
|
2808
|
-
), [rn, on] = _(ys), [
|
|
2809
|
-
function
|
|
2810
|
-
return
|
|
2848
|
+
), [rn, on] = _(ys), [Yn, Zn] = d(rn, on);
|
|
2849
|
+
function Xn() {
|
|
2850
|
+
return Pt(Qt, []);
|
|
2811
2851
|
}
|
|
2812
|
-
const [an, cn] = _(Ps), [
|
|
2813
|
-
function
|
|
2814
|
-
const n =
|
|
2852
|
+
const [an, cn] = _(Ps), [tr, er] = d(an, cn), [hn, pn] = _(xs), [sr, nr] = d(hn, pn);
|
|
2853
|
+
function rr({ children: e, acceptCustomStyles: t, debug: s }) {
|
|
2854
|
+
const n = gt(!0), [r, i] = Et(/* @__PURE__ */ new Map()), o = gt(r), a = ae(
|
|
2815
2855
|
(h) => {
|
|
2816
2856
|
n.current && i((v) => (h && h(v), new Map(v)));
|
|
2817
2857
|
},
|
|
2818
2858
|
[]
|
|
2819
|
-
), u =
|
|
2859
|
+
), u = Pt(() => ({
|
|
2820
2860
|
use(h, ...v) {
|
|
2821
|
-
const
|
|
2822
|
-
if (
|
|
2823
|
-
return
|
|
2861
|
+
const dt = r.get(h);
|
|
2862
|
+
if (dt)
|
|
2863
|
+
return dt;
|
|
2824
2864
|
let b, K;
|
|
2825
2865
|
try {
|
|
2826
2866
|
b = h(...v);
|
|
@@ -2835,55 +2875,55 @@ function nr({ children: e, acceptCustomStyles: t, debug: s }) {
|
|
|
2835
2875
|
let I;
|
|
2836
2876
|
if (Array.isArray(b) && (I = b[1], b = b[0]), !b)
|
|
2837
2877
|
return L({ result: b, cleanup: I });
|
|
2838
|
-
function
|
|
2878
|
+
function _t(f) {
|
|
2839
2879
|
if ("on" in f) {
|
|
2840
|
-
const k = f.on("change", () => a()),
|
|
2880
|
+
const k = f.on("change", () => a()), wt = I;
|
|
2841
2881
|
I = () => {
|
|
2842
|
-
|
|
2882
|
+
wt && wt(), k();
|
|
2843
2883
|
};
|
|
2844
2884
|
}
|
|
2845
2885
|
return { result: f, cleanup: I };
|
|
2846
2886
|
}
|
|
2847
2887
|
return b instanceof Promise ? (b.then(
|
|
2848
|
-
(f) => a((k) => k.set(h,
|
|
2888
|
+
(f) => a((k) => k.set(h, _t(f))),
|
|
2849
2889
|
(f) => a((k) => k.set(h, { error: f }))
|
|
2850
|
-
), L({})) : L(
|
|
2890
|
+
), L({})) : L(_t(b));
|
|
2851
2891
|
}
|
|
2852
2892
|
}), [r]);
|
|
2853
2893
|
return S(() => (n.current = !0, () => {
|
|
2854
2894
|
n.current = !1;
|
|
2855
2895
|
}), []), S(() => {
|
|
2856
|
-
if (
|
|
2896
|
+
if (ot())
|
|
2857
2897
|
return Cs(t);
|
|
2858
2898
|
}, [t]), S(() => {
|
|
2859
|
-
|
|
2899
|
+
le(s || !1);
|
|
2860
2900
|
}, [s]), S(() => {
|
|
2861
2901
|
o.current = r;
|
|
2862
2902
|
}, [r]), S(() => () => {
|
|
2863
2903
|
o.current.forEach((h) => {
|
|
2864
2904
|
"cleanup" in h && h.cleanup && h.cleanup();
|
|
2865
2905
|
});
|
|
2866
|
-
}, []), /* @__PURE__ */
|
|
2906
|
+
}, []), /* @__PURE__ */ yt(re.Provider, { value: u, children: e });
|
|
2867
2907
|
}
|
|
2868
2908
|
export {
|
|
2869
|
-
|
|
2909
|
+
De as BackButton,
|
|
2870
2910
|
As as BasicNavigator,
|
|
2871
2911
|
je as BiometryManager,
|
|
2872
|
-
|
|
2912
|
+
ne as BrowserNavigator,
|
|
2873
2913
|
Je as ClosingBehavior,
|
|
2874
2914
|
Xe as CloudStorage,
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2915
|
+
Ee as ERR_INVALID_PATH_BASE,
|
|
2916
|
+
fe as ERR_INVOKE_CUSTOM_METHOD_RESPONSE,
|
|
2917
|
+
we as ERR_METHOD_PARAMETER_UNSUPPORTED,
|
|
2918
|
+
_e as ERR_METHOD_UNSUPPORTED,
|
|
2919
|
+
ve as ERR_NAVIGATION_HISTORY_EMPTY,
|
|
2920
|
+
ye as ERR_NAVIGATION_INDEX_INVALID,
|
|
2881
2921
|
dn as ERR_NAVIGATION_ITEM_INVALID,
|
|
2882
|
-
|
|
2922
|
+
St as ERR_PARSE,
|
|
2883
2923
|
_n as ERR_SSR_INIT,
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2924
|
+
me as ERR_TIMED_OUT,
|
|
2925
|
+
be as ERR_UNEXPECTED_TYPE,
|
|
2926
|
+
ge as ERR_UNKNOWN_ENV,
|
|
2887
2927
|
N as EventEmitter,
|
|
2888
2928
|
es as HapticFeedback,
|
|
2889
2929
|
ns as InitData,
|
|
@@ -2891,9 +2931,9 @@ export {
|
|
|
2891
2931
|
as as MainButton,
|
|
2892
2932
|
us as MiniApp,
|
|
2893
2933
|
_s as Popup,
|
|
2894
|
-
|
|
2934
|
+
gs as QRScanner,
|
|
2895
2935
|
W as SDKError,
|
|
2896
|
-
|
|
2936
|
+
rr as SDKProvider,
|
|
2897
2937
|
ms as SettingsButton,
|
|
2898
2938
|
vs as ThemeParams,
|
|
2899
2939
|
Es as Utils,
|
|
@@ -2903,15 +2943,15 @@ export {
|
|
|
2903
2943
|
vn as bindThemeParamsCSSVars,
|
|
2904
2944
|
yn as bindViewportCSSVars,
|
|
2905
2945
|
P as boolean,
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2946
|
+
Nt as captureSameReq,
|
|
2947
|
+
st as classNames,
|
|
2948
|
+
Ie as compareVersions,
|
|
2909
2949
|
ks as createBrowserNavigatorFromLocation,
|
|
2910
|
-
|
|
2950
|
+
qe as createPostEvent,
|
|
2911
2951
|
H as createSafeURL,
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2952
|
+
Lt as date,
|
|
2953
|
+
xn as getHash,
|
|
2954
|
+
se as getPathname,
|
|
2915
2955
|
Ge as initBackButton,
|
|
2916
2956
|
Ke as initBiometryManager,
|
|
2917
2957
|
Fe as initClosingBehavior,
|
|
@@ -2921,8 +2961,8 @@ export {
|
|
|
2921
2961
|
os as initInvoice,
|
|
2922
2962
|
cs as initMainButton,
|
|
2923
2963
|
ls as initMiniApp,
|
|
2924
|
-
|
|
2925
|
-
|
|
2964
|
+
Cn as initNavigator,
|
|
2965
|
+
ws as initPopup,
|
|
2926
2966
|
fs as initQRScanner,
|
|
2927
2967
|
bs as initSettingsButton,
|
|
2928
2968
|
ys as initThemeParams,
|
|
@@ -2930,42 +2970,43 @@ export {
|
|
|
2930
2970
|
xs as initViewport,
|
|
2931
2971
|
Cs as initWeb,
|
|
2932
2972
|
O as invokeCustomMethod,
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2973
|
+
Vt as isColorDark,
|
|
2974
|
+
ot as isIframe,
|
|
2975
|
+
Yt as isPageReload,
|
|
2976
|
+
it as isRGB,
|
|
2977
|
+
Pe as isRGBShort,
|
|
2938
2978
|
Ts as isSDKError,
|
|
2939
|
-
|
|
2979
|
+
Rn as isSDKErrorOfType,
|
|
2940
2980
|
Ss as isSSR,
|
|
2941
2981
|
En as isTMA,
|
|
2942
|
-
|
|
2943
|
-
|
|
2982
|
+
w as json,
|
|
2983
|
+
gn as mergeClassNames,
|
|
2984
|
+
Pn as mockTelegramEnv,
|
|
2944
2985
|
x as number,
|
|
2945
2986
|
z as off,
|
|
2946
2987
|
E as on,
|
|
2947
2988
|
fn as parseInitData,
|
|
2948
|
-
|
|
2949
|
-
|
|
2989
|
+
pt as parseLaunchParams,
|
|
2990
|
+
te as parseThemeParams,
|
|
2950
2991
|
B as postEvent,
|
|
2951
|
-
|
|
2992
|
+
g as request,
|
|
2952
2993
|
ze as requestBiometryInfo,
|
|
2953
2994
|
mn as requestThemeParams,
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2995
|
+
ee as requestViewport,
|
|
2996
|
+
Qt as retrieveLaunchParams,
|
|
2997
|
+
It as rgb,
|
|
2998
|
+
ht as searchParams,
|
|
2999
|
+
He as serializeLaunchParams,
|
|
3000
|
+
Jt as serializeThemeParams,
|
|
2960
3001
|
R as setCSSVar,
|
|
2961
|
-
|
|
2962
|
-
|
|
3002
|
+
le as setDebug,
|
|
3003
|
+
wn as setTargetOrigin,
|
|
2963
3004
|
p as string,
|
|
2964
|
-
|
|
3005
|
+
pe as subscribe,
|
|
2965
3006
|
C as supports,
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
3007
|
+
ke as targetOrigin,
|
|
3008
|
+
At as toRGB,
|
|
3009
|
+
xt as unsubscribe,
|
|
2969
3010
|
U as urlToPath,
|
|
2970
3011
|
Ns as useBackButton,
|
|
2971
3012
|
Ds as useBackButtonRaw,
|
|
@@ -2981,7 +3022,7 @@ export {
|
|
|
2981
3022
|
Gs as useInitDataRaw,
|
|
2982
3023
|
Ks as useInvoice,
|
|
2983
3024
|
zs as useInvoiceRaw,
|
|
2984
|
-
|
|
3025
|
+
Xn as useLaunchParams,
|
|
2985
3026
|
Fs as useMainButton,
|
|
2986
3027
|
Js as useMainButtonRaw,
|
|
2987
3028
|
Ys as useMiniApp,
|
|
@@ -2999,36 +3040,36 @@ export {
|
|
|
2999
3040
|
an as useUtilsRaw,
|
|
3000
3041
|
pn as useViewport,
|
|
3001
3042
|
hn as useViewportRaw,
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3043
|
+
Tn as withBackButton,
|
|
3044
|
+
Sn as withBackButtonRaw,
|
|
3045
|
+
In as withBiometryManager,
|
|
3046
|
+
An as withBiometryManagerRaw,
|
|
3047
|
+
qn as withClosingBehavior,
|
|
3048
|
+
kn as withClosingBehaviorRaw,
|
|
3049
|
+
Dn as withCloudStorage,
|
|
3050
|
+
On as withCloudStorageRaw,
|
|
3051
|
+
Bn as withHapticFeedback,
|
|
3052
|
+
Nn as withHapticFeedbackRaw,
|
|
3053
|
+
Vn as withInitData,
|
|
3054
|
+
Mn as withInitDataRaw,
|
|
3055
|
+
Ln as withInvoice,
|
|
3056
|
+
$n as withInvoiceRaw,
|
|
3057
|
+
Un as withMainButton,
|
|
3058
|
+
Hn as withMainButtonRaw,
|
|
3059
|
+
Gn as withMiniApp,
|
|
3060
|
+
Wn as withMiniAppRaw,
|
|
3061
|
+
zn as withPopup,
|
|
3062
|
+
jn as withPopupRaw,
|
|
3063
|
+
Jn as withQRScanner,
|
|
3064
|
+
Kn as withQRScannerRaw,
|
|
3065
|
+
Qn as withSettingsButton,
|
|
3066
|
+
Fn as withSettingsButtonRaw,
|
|
3067
|
+
Zn as withThemeParams,
|
|
3068
|
+
Yn as withThemeParamsRaw,
|
|
3069
|
+
Mt as withTimeout,
|
|
3070
|
+
er as withUtils,
|
|
3071
|
+
tr as withUtilsRaw,
|
|
3072
|
+
nr as withViewport,
|
|
3073
|
+
sr as withViewportRaw
|
|
3033
3074
|
};
|
|
3034
3075
|
//# sourceMappingURL=index.js.map
|