@tma.js/sdk-solid 2.1.1 → 2.1.2
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 +382 -393
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { createComponent as
|
|
1
|
+
import { createComponent as ft, mergeProps as ct, createContext as Ft, useContext as Yt, createEffect as ht, onCleanup as Zt, createResource as Xt, createMemo as pt, from as te } from "solid-js";
|
|
2
2
|
var ee = Object.defineProperty, se = (e, t, s) => t in e ? ee(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, c = (e, t, s) => (se(e, typeof t != "symbol" ? t + "" : t, s), s);
|
|
3
|
-
function
|
|
3
|
+
function mt(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
|
|
10
|
+
function wt(e) {
|
|
11
11
|
const t = W(), { count: s } = t;
|
|
12
12
|
t.unsubscribe(e), s && !t.count && Ce();
|
|
13
13
|
}
|
|
14
14
|
function ne(e) {
|
|
15
|
-
return W().subscribe(e), () =>
|
|
15
|
+
return W().subscribe(e), () => wt(e);
|
|
16
16
|
}
|
|
17
17
|
class re {
|
|
18
18
|
constructor(t, s = {}) {
|
|
@@ -59,11 +59,11 @@ const $ = new re("SDK", {
|
|
|
59
59
|
textColor: "white"
|
|
60
60
|
});
|
|
61
61
|
let Y = !1;
|
|
62
|
-
const
|
|
62
|
+
const ut = ({ event: e, args: [t] }) => {
|
|
63
63
|
$.log("Event received:", t === void 0 ? { name: e } : { name: e, data: t });
|
|
64
64
|
};
|
|
65
65
|
function ie(e) {
|
|
66
|
-
Y !== e && (Y = e, e ? ne(
|
|
66
|
+
Y !== e && (Y = e, e ? ne(ut) : wt(ut));
|
|
67
67
|
}
|
|
68
68
|
function oe(...e) {
|
|
69
69
|
Y && $.log(...e);
|
|
@@ -146,12 +146,12 @@ class U extends Error {
|
|
|
146
146
|
super(s, { cause: n }), this.type = t, Object.setPrototypeOf(this, U.prototype);
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function m(e, t, s) {
|
|
150
150
|
return new U(e, t, s);
|
|
151
151
|
}
|
|
152
|
-
const ae = "ERR_METHOD_UNSUPPORTED", ce = "ERR_METHOD_PARAMETER_UNSUPPORTED", he = "ERR_UNKNOWN_ENV", pe = "ERR_INVOKE_CUSTOM_METHOD_RESPONSE", ue = "ERR_TIMED_OUT", de = "ERR_UNEXPECTED_TYPE",
|
|
153
|
-
function
|
|
154
|
-
return
|
|
152
|
+
const ae = "ERR_METHOD_UNSUPPORTED", ce = "ERR_METHOD_PARAMETER_UNSUPPORTED", he = "ERR_UNKNOWN_ENV", pe = "ERR_INVOKE_CUSTOM_METHOD_RESPONSE", ue = "ERR_TIMED_OUT", de = "ERR_UNEXPECTED_TYPE", bt = "ERR_PARSE", le = "ERR_NAVIGATION_LIST_EMPTY", _e = "ERR_NAVIGATION_CURSOR_INVALID", Qs = "ERR_NAVIGATION_ITEM_INVALID", vt = "ERR_SSR_INIT", ge = "ERR_INVALID_PATH_BASE";
|
|
153
|
+
function S() {
|
|
154
|
+
return m(de, "Value has unexpected type");
|
|
155
155
|
}
|
|
156
156
|
class H {
|
|
157
157
|
constructor(t, s, n) {
|
|
@@ -168,8 +168,8 @@ class H {
|
|
|
168
168
|
try {
|
|
169
169
|
return this.parser(t);
|
|
170
170
|
} catch (s) {
|
|
171
|
-
throw
|
|
172
|
-
|
|
171
|
+
throw m(
|
|
172
|
+
bt,
|
|
173
173
|
`Unable to parse value${this.type ? ` as ${this.type}` : ""}`,
|
|
174
174
|
s
|
|
175
175
|
);
|
|
@@ -190,7 +190,7 @@ const v = R((e) => {
|
|
|
190
190
|
return !0;
|
|
191
191
|
if (t === "0" || t === "false")
|
|
192
192
|
return !1;
|
|
193
|
-
throw
|
|
193
|
+
throw S();
|
|
194
194
|
}, "boolean");
|
|
195
195
|
function yt(e, t) {
|
|
196
196
|
const s = {};
|
|
@@ -209,24 +209,24 @@ function yt(e, t) {
|
|
|
209
209
|
const a = o(t(i));
|
|
210
210
|
a !== void 0 && (s[n] = a);
|
|
211
211
|
} catch (a) {
|
|
212
|
-
throw
|
|
212
|
+
throw m(bt, `Unable to parse field "${n}"`, a);
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
return s;
|
|
216
216
|
}
|
|
217
|
-
function
|
|
217
|
+
function tt(e) {
|
|
218
218
|
let t = e;
|
|
219
219
|
if (typeof t == "string" && (t = JSON.parse(t)), typeof t != "object" || t === null || Array.isArray(t))
|
|
220
|
-
throw
|
|
220
|
+
throw S();
|
|
221
221
|
return t;
|
|
222
222
|
}
|
|
223
|
-
function
|
|
223
|
+
function g(e, t) {
|
|
224
224
|
return new H((s) => {
|
|
225
|
-
const n =
|
|
225
|
+
const n = tt(s);
|
|
226
226
|
return yt(e, (r) => n[r]);
|
|
227
227
|
}, !1, t);
|
|
228
228
|
}
|
|
229
|
-
const
|
|
229
|
+
const P = R((e) => {
|
|
230
230
|
if (typeof e == "number")
|
|
231
231
|
return e;
|
|
232
232
|
if (typeof e == "string") {
|
|
@@ -234,19 +234,19 @@ const E = R((e) => {
|
|
|
234
234
|
if (!Number.isNaN(t))
|
|
235
235
|
return t;
|
|
236
236
|
}
|
|
237
|
-
throw
|
|
237
|
+
throw S();
|
|
238
238
|
}, "number");
|
|
239
|
-
function
|
|
239
|
+
function et(e) {
|
|
240
240
|
return /^#[\da-f]{6}$/i.test(e);
|
|
241
241
|
}
|
|
242
|
-
function
|
|
242
|
+
function fe(e) {
|
|
243
243
|
return /^#[\da-f]{3}$/i.test(e);
|
|
244
244
|
}
|
|
245
245
|
function Et(e) {
|
|
246
246
|
const t = e.replace(/\s/g, "").toLowerCase();
|
|
247
|
-
if (
|
|
247
|
+
if (et(t))
|
|
248
248
|
return t;
|
|
249
|
-
if (
|
|
249
|
+
if (fe(t)) {
|
|
250
250
|
let n = "#";
|
|
251
251
|
for (let r = 0; r < 3; r += 1)
|
|
252
252
|
n += t[1 + r].repeat(2);
|
|
@@ -263,27 +263,27 @@ function Et(e) {
|
|
|
263
263
|
const p = R((e) => {
|
|
264
264
|
if (typeof e == "string" || typeof e == "number")
|
|
265
265
|
return e.toString();
|
|
266
|
-
throw
|
|
266
|
+
throw S();
|
|
267
267
|
}, "string"), Pt = R((e) => Et(p().parse(e)), "rgb");
|
|
268
|
-
function
|
|
269
|
-
return
|
|
268
|
+
function me(e) {
|
|
269
|
+
return g({
|
|
270
270
|
eventType: p(),
|
|
271
271
|
eventData: (t) => t
|
|
272
272
|
}).parse(e);
|
|
273
273
|
}
|
|
274
|
-
function
|
|
274
|
+
function we() {
|
|
275
275
|
["TelegramGameProxy_receiveEvent", "TelegramGameProxy", "Telegram"].forEach((e) => {
|
|
276
276
|
delete window[e];
|
|
277
277
|
});
|
|
278
278
|
}
|
|
279
|
-
function
|
|
279
|
+
function be(e, t) {
|
|
280
280
|
window.dispatchEvent(new MessageEvent("message", {
|
|
281
281
|
data: JSON.stringify({ eventType: e, eventData: t }),
|
|
282
282
|
// We specify window.parent to imitate the case, the parent iframe sent us this event.
|
|
283
283
|
source: window.parent
|
|
284
284
|
}));
|
|
285
285
|
}
|
|
286
|
-
function
|
|
286
|
+
function ve() {
|
|
287
287
|
[
|
|
288
288
|
["TelegramGameProxy_receiveEvent"],
|
|
289
289
|
// Windows Phone.
|
|
@@ -295,60 +295,60 @@ function ye() {
|
|
|
295
295
|
let t = window;
|
|
296
296
|
e.forEach((s, n, r) => {
|
|
297
297
|
if (n === r.length - 1) {
|
|
298
|
-
t[s] =
|
|
298
|
+
t[s] = be;
|
|
299
299
|
return;
|
|
300
300
|
}
|
|
301
301
|
s in t || (t[s] = {}), t = t[s];
|
|
302
302
|
});
|
|
303
303
|
});
|
|
304
304
|
}
|
|
305
|
-
const
|
|
305
|
+
const ye = g({
|
|
306
306
|
button_id: (e) => e == null ? void 0 : p().parse(e)
|
|
307
|
-
}),
|
|
308
|
-
clipboard_text_received:
|
|
307
|
+
}), Ee = {
|
|
308
|
+
clipboard_text_received: g({
|
|
309
309
|
req_id: p(),
|
|
310
310
|
data: (e) => e === null ? e : p().optional().parse(e)
|
|
311
311
|
}),
|
|
312
|
-
custom_method_invoked:
|
|
312
|
+
custom_method_invoked: g({
|
|
313
313
|
req_id: p(),
|
|
314
314
|
result: (e) => e,
|
|
315
315
|
error: p().optional()
|
|
316
316
|
}),
|
|
317
|
-
invoice_closed:
|
|
317
|
+
invoice_closed: g({
|
|
318
318
|
slug: p(),
|
|
319
319
|
status: p()
|
|
320
320
|
}),
|
|
321
|
-
phone_requested:
|
|
321
|
+
phone_requested: g({
|
|
322
322
|
status: p()
|
|
323
323
|
}),
|
|
324
324
|
popup_closed: {
|
|
325
|
-
parse: (e) =>
|
|
325
|
+
parse: (e) => ye.parse(e ?? {})
|
|
326
326
|
},
|
|
327
|
-
qr_text_received:
|
|
327
|
+
qr_text_received: g({
|
|
328
328
|
data: p().optional()
|
|
329
329
|
}),
|
|
330
|
-
theme_changed:
|
|
330
|
+
theme_changed: g({
|
|
331
331
|
theme_params: (e) => {
|
|
332
332
|
const t = Pt().optional();
|
|
333
|
-
return Object.entries(
|
|
333
|
+
return Object.entries(tt(e)).reduce((s, [n, r]) => (s[n] = t.parse(r), s), {});
|
|
334
334
|
}
|
|
335
335
|
}),
|
|
336
|
-
viewport_changed:
|
|
337
|
-
height:
|
|
338
|
-
width: (e) => e == null ? window.innerWidth :
|
|
336
|
+
viewport_changed: g({
|
|
337
|
+
height: P(),
|
|
338
|
+
width: (e) => e == null ? window.innerWidth : P().parse(e),
|
|
339
339
|
is_state_stable: v(),
|
|
340
340
|
is_expanded: v()
|
|
341
341
|
}),
|
|
342
|
-
write_access_requested:
|
|
342
|
+
write_access_requested: g({
|
|
343
343
|
status: p()
|
|
344
344
|
})
|
|
345
345
|
};
|
|
346
|
-
function
|
|
346
|
+
function Pe() {
|
|
347
347
|
const e = new L();
|
|
348
|
-
|
|
348
|
+
ve();
|
|
349
349
|
let t = [
|
|
350
350
|
// Don't forget to remove created handlers.
|
|
351
|
-
|
|
351
|
+
we,
|
|
352
352
|
// Add "resize" event listener to make sure, we always have fresh viewport information.
|
|
353
353
|
// Desktop version of Telegram is sometimes not sending the viewport_changed
|
|
354
354
|
// event. For example, when the MainButton is shown. That's why we should
|
|
@@ -369,11 +369,11 @@ function xe() {
|
|
|
369
369
|
return;
|
|
370
370
|
let n;
|
|
371
371
|
try {
|
|
372
|
-
n =
|
|
372
|
+
n = me(s.data);
|
|
373
373
|
} catch {
|
|
374
374
|
return;
|
|
375
375
|
}
|
|
376
|
-
const { eventType: r, eventData: i } = n, o =
|
|
376
|
+
const { eventType: r, eventData: i } = n, o = Ee[r];
|
|
377
377
|
try {
|
|
378
378
|
const a = o ? o.parse(i) : i;
|
|
379
379
|
e.emit(...a ? [r, a] : [r]);
|
|
@@ -392,9 +392,9 @@ function xe() {
|
|
|
392
392
|
t.forEach((s) => s()), t = [];
|
|
393
393
|
}];
|
|
394
394
|
}
|
|
395
|
-
const [
|
|
395
|
+
const [xe, Ce] = mt(
|
|
396
396
|
(e) => {
|
|
397
|
-
const [t, s] =
|
|
397
|
+
const [t, s] = Pe(), n = t.off.bind(t);
|
|
398
398
|
return t.off = (r, i) => {
|
|
399
399
|
const { count: o } = t;
|
|
400
400
|
n(r, i), o && !t.count && e();
|
|
@@ -403,7 +403,7 @@ const [Se, Ce] = wt(
|
|
|
403
403
|
([, e]) => e()
|
|
404
404
|
);
|
|
405
405
|
function W() {
|
|
406
|
-
return
|
|
406
|
+
return xe()[0];
|
|
407
407
|
}
|
|
408
408
|
function j(e, t) {
|
|
409
409
|
W().off(e, t);
|
|
@@ -414,7 +414,7 @@ function b(e, t, s) {
|
|
|
414
414
|
function q(e) {
|
|
415
415
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
416
416
|
}
|
|
417
|
-
function
|
|
417
|
+
function Se(e, t) {
|
|
418
418
|
const s = e.split("."), n = t.split("."), r = Math.max(s.length, n.length);
|
|
419
419
|
for (let i = 0; i < r; i += 1) {
|
|
420
420
|
const o = parseInt(s[i] || "0", 10), a = parseInt(n[i] || "0", 10);
|
|
@@ -424,9 +424,9 @@ function Re(e, t) {
|
|
|
424
424
|
return 0;
|
|
425
425
|
}
|
|
426
426
|
function w(e, t) {
|
|
427
|
-
return
|
|
427
|
+
return Se(e, t) <= 0;
|
|
428
428
|
}
|
|
429
|
-
function
|
|
429
|
+
function C(e, t, s) {
|
|
430
430
|
if (typeof s == "string") {
|
|
431
431
|
if (e === "web_app_open_link" && t === "try_instant_view")
|
|
432
432
|
return w("6.4", s);
|
|
@@ -477,35 +477,35 @@ function x(e, t, s) {
|
|
|
477
477
|
].includes(e);
|
|
478
478
|
}
|
|
479
479
|
}
|
|
480
|
-
function
|
|
480
|
+
function Re(e) {
|
|
481
481
|
return "external" in e && q(e.external) && "notify" in e.external && typeof e.external.notify == "function";
|
|
482
482
|
}
|
|
483
483
|
function xt(e) {
|
|
484
484
|
return "TelegramWebviewProxy" in e && q(e.TelegramWebviewProxy) && "postEvent" in e.TelegramWebviewProxy && typeof e.TelegramWebviewProxy.postEvent == "function";
|
|
485
485
|
}
|
|
486
|
-
function
|
|
486
|
+
function Ct() {
|
|
487
487
|
try {
|
|
488
488
|
return window.self !== window.top;
|
|
489
489
|
} catch {
|
|
490
490
|
return !0;
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
|
-
let
|
|
494
|
-
function
|
|
495
|
-
|
|
493
|
+
let St = "https://web.telegram.org";
|
|
494
|
+
function Fs(e) {
|
|
495
|
+
St = e;
|
|
496
496
|
}
|
|
497
497
|
function Ae() {
|
|
498
|
-
return
|
|
498
|
+
return St;
|
|
499
499
|
}
|
|
500
500
|
function k(e, t, s) {
|
|
501
501
|
let n = {}, r;
|
|
502
502
|
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);
|
|
503
503
|
const { targetOrigin: i = Ae() } = n;
|
|
504
|
-
if (oe("Posting event:", r ? { event: e, data: r } : { event: e }),
|
|
504
|
+
if (oe("Posting event:", r ? { event: e, data: r } : { event: e }), Ct()) {
|
|
505
505
|
window.parent.postMessage(JSON.stringify({ eventType: e, eventData: r }), i);
|
|
506
506
|
return;
|
|
507
507
|
}
|
|
508
|
-
if (
|
|
508
|
+
if (Re(window)) {
|
|
509
509
|
window.external.notify(JSON.stringify({ eventType: e, eventData: r }));
|
|
510
510
|
return;
|
|
511
511
|
}
|
|
@@ -513,19 +513,19 @@ function k(e, t, s) {
|
|
|
513
513
|
window.TelegramWebviewProxy.postEvent(e, JSON.stringify(r));
|
|
514
514
|
return;
|
|
515
515
|
}
|
|
516
|
-
throw
|
|
516
|
+
throw m(
|
|
517
517
|
he,
|
|
518
518
|
"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."
|
|
519
519
|
);
|
|
520
520
|
}
|
|
521
|
-
function
|
|
521
|
+
function Te(e) {
|
|
522
522
|
return (t, s) => {
|
|
523
|
-
if (!
|
|
524
|
-
throw
|
|
523
|
+
if (!C(t, e))
|
|
524
|
+
throw m(ae, `Method "${t}" is unsupported in Mini Apps version ${e}`);
|
|
525
525
|
if (q(s)) {
|
|
526
526
|
let n;
|
|
527
|
-
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 && !
|
|
528
|
-
throw
|
|
527
|
+
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))
|
|
528
|
+
throw m(
|
|
529
529
|
ce,
|
|
530
530
|
`Parameter "${n}" of "${t}" method is unsupported in Mini Apps version ${e}`
|
|
531
531
|
);
|
|
@@ -536,20 +536,20 @@ function Ie(e) {
|
|
|
536
536
|
function Rt(e) {
|
|
537
537
|
return ({ req_id: t }) => t === e;
|
|
538
538
|
}
|
|
539
|
-
function
|
|
540
|
-
return
|
|
539
|
+
function At(e) {
|
|
540
|
+
return m(ue, `Timeout reached: ${e}ms`);
|
|
541
541
|
}
|
|
542
|
-
function
|
|
542
|
+
function Tt(e, t) {
|
|
543
543
|
return Promise.race([
|
|
544
544
|
typeof e == "function" ? e() : e,
|
|
545
545
|
new Promise((s, n) => {
|
|
546
546
|
setTimeout(() => {
|
|
547
|
-
n(
|
|
547
|
+
n(At(t));
|
|
548
548
|
}, t);
|
|
549
549
|
})
|
|
550
550
|
]);
|
|
551
551
|
}
|
|
552
|
-
async function
|
|
552
|
+
async function f(e) {
|
|
553
553
|
let t;
|
|
554
554
|
const s = new Promise((u) => {
|
|
555
555
|
t = u;
|
|
@@ -560,19 +560,19 @@ async function m(e) {
|
|
|
560
560
|
postEvent: o = k,
|
|
561
561
|
timeout: a
|
|
562
562
|
} = e, h = (Array.isArray(r) ? r : [r]).map(
|
|
563
|
-
(u) => b(u, (
|
|
563
|
+
(u) => b(u, (N) => (!i || i(N)) && t(N))
|
|
564
564
|
);
|
|
565
565
|
try {
|
|
566
|
-
return o(n, e.params), await (a ?
|
|
566
|
+
return o(n, e.params), await (a ? Tt(s, a) : s);
|
|
567
567
|
} finally {
|
|
568
568
|
h.forEach((u) => u());
|
|
569
569
|
}
|
|
570
570
|
}
|
|
571
|
-
async function
|
|
571
|
+
async function T(e, t, s, n = {}) {
|
|
572
572
|
const {
|
|
573
573
|
result: r,
|
|
574
574
|
error: i
|
|
575
|
-
} = await
|
|
575
|
+
} = await f({
|
|
576
576
|
...n,
|
|
577
577
|
method: "web_app_invoke_custom_method",
|
|
578
578
|
event: "custom_method_invoked",
|
|
@@ -584,7 +584,7 @@ async function A(e, t, s, n = {}) {
|
|
|
584
584
|
capture: Rt(s)
|
|
585
585
|
});
|
|
586
586
|
if (i)
|
|
587
|
-
throw
|
|
587
|
+
throw m(pe, i);
|
|
588
588
|
return r;
|
|
589
589
|
}
|
|
590
590
|
function X(...e) {
|
|
@@ -597,7 +597,7 @@ function X(...e) {
|
|
|
597
597
|
return X(...t);
|
|
598
598
|
}).filter(Boolean).join(" ");
|
|
599
599
|
}
|
|
600
|
-
function
|
|
600
|
+
function Ys(...e) {
|
|
601
601
|
return e.reduce((t, s) => (q(s) && Object.entries(s).forEach(([n, r]) => {
|
|
602
602
|
const i = X(t[n], r);
|
|
603
603
|
i.length && (t[n] = i);
|
|
@@ -612,7 +612,7 @@ function It(e) {
|
|
|
612
612
|
}, 0)
|
|
613
613
|
) < 120;
|
|
614
614
|
}
|
|
615
|
-
class
|
|
615
|
+
class Ie {
|
|
616
616
|
constructor(t) {
|
|
617
617
|
c(this, "ee", new L()), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this.state = t;
|
|
618
618
|
}
|
|
@@ -633,20 +633,20 @@ class ke {
|
|
|
633
633
|
return this.state[t];
|
|
634
634
|
}
|
|
635
635
|
}
|
|
636
|
-
class
|
|
636
|
+
class st {
|
|
637
637
|
constructor(t) {
|
|
638
|
-
c(this, "state"), c(this, "get"), c(this, "set"), c(this, "clone"), this.state = new
|
|
638
|
+
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);
|
|
639
639
|
}
|
|
640
640
|
}
|
|
641
641
|
function kt(e, t) {
|
|
642
|
-
return (s) =>
|
|
642
|
+
return (s) => C(t[s], e);
|
|
643
643
|
}
|
|
644
|
-
class
|
|
644
|
+
class nt extends st {
|
|
645
645
|
constructor(t, s, n) {
|
|
646
646
|
super(t), c(this, "supports"), this.supports = kt(s, n);
|
|
647
647
|
}
|
|
648
648
|
}
|
|
649
|
-
class
|
|
649
|
+
class ke extends nt {
|
|
650
650
|
constructor(t, s, n) {
|
|
651
651
|
super({ isVisible: t }, s, {
|
|
652
652
|
show: "web_app_setup_back_button",
|
|
@@ -675,14 +675,14 @@ class Oe extends rt {
|
|
|
675
675
|
this.isVisible = !0;
|
|
676
676
|
}
|
|
677
677
|
}
|
|
678
|
-
function
|
|
678
|
+
function E() {
|
|
679
679
|
return typeof window > "u";
|
|
680
680
|
}
|
|
681
|
-
const Ot = R((e) => e instanceof Date ? e : new Date(
|
|
682
|
-
function
|
|
681
|
+
const Ot = R((e) => e instanceof Date ? e : new Date(P().parse(e) * 1e3), "Date");
|
|
682
|
+
function rt(e, t) {
|
|
683
683
|
return new H((s) => {
|
|
684
684
|
if (typeof s != "string" && !(s instanceof URLSearchParams))
|
|
685
|
-
throw
|
|
685
|
+
throw S();
|
|
686
686
|
const n = typeof s == "string" ? new URLSearchParams(s) : s;
|
|
687
687
|
return yt(e, (r) => {
|
|
688
688
|
const i = n.get(r);
|
|
@@ -690,8 +690,8 @@ function it(e, t) {
|
|
|
690
690
|
});
|
|
691
691
|
}, !1, t);
|
|
692
692
|
}
|
|
693
|
-
const
|
|
694
|
-
id:
|
|
693
|
+
const Oe = g({
|
|
694
|
+
id: P(),
|
|
695
695
|
type: p(),
|
|
696
696
|
title: p(),
|
|
697
697
|
photoUrl: {
|
|
@@ -699,7 +699,7 @@ const qe = f({
|
|
|
699
699
|
from: "photo_url"
|
|
700
700
|
},
|
|
701
701
|
username: p().optional()
|
|
702
|
-
}, "Chat").optional(),
|
|
702
|
+
}, "Chat").optional(), dt = g({
|
|
703
703
|
addedToAttachmentMenu: {
|
|
704
704
|
type: v().optional(),
|
|
705
705
|
from: "added_to_attachment_menu"
|
|
@@ -712,7 +712,7 @@ const qe = f({
|
|
|
712
712
|
type: p(),
|
|
713
713
|
from: "first_name"
|
|
714
714
|
},
|
|
715
|
-
id:
|
|
715
|
+
id: P(),
|
|
716
716
|
isBot: {
|
|
717
717
|
type: v().optional(),
|
|
718
718
|
from: "is_bot"
|
|
@@ -736,16 +736,16 @@ const qe = f({
|
|
|
736
736
|
username: p().optional()
|
|
737
737
|
}, "User").optional();
|
|
738
738
|
function qt() {
|
|
739
|
-
return
|
|
739
|
+
return rt({
|
|
740
740
|
authDate: {
|
|
741
741
|
type: Ot(),
|
|
742
742
|
from: "auth_date"
|
|
743
743
|
},
|
|
744
744
|
canSendAfter: {
|
|
745
|
-
type:
|
|
745
|
+
type: P().optional(),
|
|
746
746
|
from: "can_send_after"
|
|
747
747
|
},
|
|
748
|
-
chat:
|
|
748
|
+
chat: Oe,
|
|
749
749
|
chatInstance: {
|
|
750
750
|
type: p().optional(),
|
|
751
751
|
from: "chat_instance"
|
|
@@ -759,29 +759,29 @@ function qt() {
|
|
|
759
759
|
type: p().optional(),
|
|
760
760
|
from: "query_id"
|
|
761
761
|
},
|
|
762
|
-
receiver:
|
|
762
|
+
receiver: dt,
|
|
763
763
|
startParam: {
|
|
764
764
|
type: p().optional(),
|
|
765
765
|
from: "start_param"
|
|
766
766
|
},
|
|
767
|
-
user:
|
|
767
|
+
user: dt
|
|
768
768
|
}, "InitData");
|
|
769
769
|
}
|
|
770
|
-
function
|
|
770
|
+
function qe(e) {
|
|
771
771
|
return e.replace(/_[a-z]/g, (t) => t[1].toUpperCase());
|
|
772
772
|
}
|
|
773
773
|
function De(e) {
|
|
774
774
|
return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);
|
|
775
775
|
}
|
|
776
|
-
const
|
|
776
|
+
const Dt = R(
|
|
777
777
|
(e) => {
|
|
778
778
|
const t = Pt().optional();
|
|
779
|
-
return Object.entries(
|
|
779
|
+
return Object.entries(tt(e)).reduce((s, [n, r]) => (s[qe(n)] = t.parse(r), s), {});
|
|
780
780
|
},
|
|
781
781
|
"ThemeParams"
|
|
782
782
|
);
|
|
783
|
-
function
|
|
784
|
-
return
|
|
783
|
+
function Nt(e) {
|
|
784
|
+
return rt({
|
|
785
785
|
botInline: {
|
|
786
786
|
type: v().optional(),
|
|
787
787
|
from: "tgWebAppBotInline"
|
|
@@ -807,7 +807,7 @@ function Dt(e) {
|
|
|
807
807
|
from: "tgWebAppStartParam"
|
|
808
808
|
},
|
|
809
809
|
themeParams: {
|
|
810
|
-
type:
|
|
810
|
+
type: Dt(),
|
|
811
811
|
from: "tgWebAppThemeParams"
|
|
812
812
|
},
|
|
813
813
|
version: {
|
|
@@ -817,17 +817,17 @@ function Dt(e) {
|
|
|
817
817
|
}).parse(e);
|
|
818
818
|
}
|
|
819
819
|
function Vt(e) {
|
|
820
|
-
return
|
|
820
|
+
return Nt(
|
|
821
821
|
e.replace(/^[^?#]*[?#]/, "").replace(/[?#]/g, "&")
|
|
822
822
|
);
|
|
823
823
|
}
|
|
824
|
-
function
|
|
824
|
+
function Ne() {
|
|
825
825
|
return Vt(window.location.href);
|
|
826
826
|
}
|
|
827
827
|
function Mt() {
|
|
828
828
|
return performance.getEntriesByType("navigation")[0];
|
|
829
829
|
}
|
|
830
|
-
function
|
|
830
|
+
function Ve() {
|
|
831
831
|
const e = Mt();
|
|
832
832
|
if (!e)
|
|
833
833
|
throw new Error("Unable to get first navigation entry.");
|
|
@@ -846,17 +846,17 @@ function Lt(e) {
|
|
|
846
846
|
} catch {
|
|
847
847
|
}
|
|
848
848
|
}
|
|
849
|
-
function
|
|
850
|
-
return
|
|
849
|
+
function Me() {
|
|
850
|
+
return Nt(Lt("launchParams") || "");
|
|
851
851
|
}
|
|
852
|
-
function
|
|
852
|
+
function Be(e) {
|
|
853
853
|
return JSON.stringify(
|
|
854
854
|
Object.fromEntries(
|
|
855
855
|
Object.entries(e).map(([t, s]) => [De(t), s])
|
|
856
856
|
)
|
|
857
857
|
);
|
|
858
858
|
}
|
|
859
|
-
function
|
|
859
|
+
function $e(e) {
|
|
860
860
|
const {
|
|
861
861
|
initDataRaw: t,
|
|
862
862
|
themeParams: s,
|
|
@@ -866,24 +866,24 @@ function Le(e) {
|
|
|
866
866
|
startParam: o,
|
|
867
867
|
botInline: a
|
|
868
868
|
} = e, h = new URLSearchParams();
|
|
869
|
-
return h.set("tgWebAppPlatform", n), h.set("tgWebAppThemeParams",
|
|
869
|
+
return h.set("tgWebAppPlatform", n), h.set("tgWebAppThemeParams", Be(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();
|
|
870
870
|
}
|
|
871
|
-
function
|
|
872
|
-
$t("launchParams",
|
|
871
|
+
function Le(e) {
|
|
872
|
+
$t("launchParams", $e(e));
|
|
873
873
|
}
|
|
874
|
-
function
|
|
874
|
+
function Ue() {
|
|
875
875
|
for (const e of [
|
|
876
876
|
// Try to retrieve launch parameters from the current location. This method can return
|
|
877
877
|
// nothing in case, location was changed and then page was reloaded.
|
|
878
|
-
|
|
878
|
+
Ne,
|
|
879
879
|
// Then, try using the lower level API - window.performance.
|
|
880
|
-
|
|
880
|
+
Ve,
|
|
881
881
|
// Finally, try to extract launch parameters from the session storage.
|
|
882
|
-
|
|
882
|
+
Me
|
|
883
883
|
])
|
|
884
884
|
try {
|
|
885
885
|
const t = e();
|
|
886
|
-
return
|
|
886
|
+
return Le(t), t;
|
|
887
887
|
} catch {
|
|
888
888
|
}
|
|
889
889
|
throw new Error("Unable to retrieve launch parameters from any known source.");
|
|
@@ -892,34 +892,24 @@ function Ut() {
|
|
|
892
892
|
const e = Mt();
|
|
893
893
|
return !!(e && e.type === "reload");
|
|
894
894
|
}
|
|
895
|
-
function
|
|
895
|
+
function He() {
|
|
896
896
|
let e = 0;
|
|
897
897
|
return () => (e += 1).toString();
|
|
898
898
|
}
|
|
899
|
-
const [
|
|
900
|
-
function
|
|
899
|
+
const [We] = mt(He);
|
|
900
|
+
function d(e, t) {
|
|
901
901
|
return ({ ssr: s } = {}) => {
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
);
|
|
909
|
-
n = s;
|
|
910
|
-
} else
|
|
911
|
-
n = He();
|
|
912
|
-
const r = {
|
|
902
|
+
const n = E() ? {
|
|
903
|
+
version: "6.0",
|
|
904
|
+
themeParams: {},
|
|
905
|
+
platform: "unknown",
|
|
906
|
+
...s || {}
|
|
907
|
+
} : Ue(), r = {
|
|
913
908
|
...n,
|
|
914
|
-
postEvent:
|
|
915
|
-
|
|
916
|
-
ge,
|
|
917
|
-
"postEvent function is forbidden to be called on the server side."
|
|
918
|
-
);
|
|
919
|
-
},
|
|
920
|
-
createRequestId: je()
|
|
909
|
+
postEvent: E() ? () => null : Te(n.version),
|
|
910
|
+
createRequestId: We()
|
|
921
911
|
};
|
|
922
|
-
if (
|
|
912
|
+
if (E() || typeof e == "function")
|
|
923
913
|
return typeof e == "function" ? e(r) : t(r);
|
|
924
914
|
const i = t({
|
|
925
915
|
...r,
|
|
@@ -930,12 +920,12 @@ function l(e, t) {
|
|
|
930
920
|
return i instanceof Promise ? i.then(o) : o(i);
|
|
931
921
|
};
|
|
932
922
|
}
|
|
933
|
-
const
|
|
923
|
+
const je = d("backButton", ({
|
|
934
924
|
postEvent: e,
|
|
935
925
|
version: t,
|
|
936
926
|
state: s = { isVisible: !1 }
|
|
937
|
-
}) => new
|
|
938
|
-
class
|
|
927
|
+
}) => new ke(s.isVisible, t, e));
|
|
928
|
+
class D extends nt {
|
|
939
929
|
constructor() {
|
|
940
930
|
super(...arguments), c(this, "on", this.state.on.bind(this.state)), c(this, "off", this.state.off.bind(this.state));
|
|
941
931
|
}
|
|
@@ -958,7 +948,7 @@ function Ht(e) {
|
|
|
958
948
|
accessGranted: t.access_granted
|
|
959
949
|
};
|
|
960
950
|
}
|
|
961
|
-
class
|
|
951
|
+
class lt extends D {
|
|
962
952
|
constructor({ postEvent: t, version: s, ...n }) {
|
|
963
953
|
super(n, s, {
|
|
964
954
|
auth: "web_app_biometry_request_auth",
|
|
@@ -995,7 +985,7 @@ class _t extends N {
|
|
|
995
985
|
reason: t,
|
|
996
986
|
...s
|
|
997
987
|
}) {
|
|
998
|
-
return this.authPromise || (this.authPromise =
|
|
988
|
+
return this.authPromise || (this.authPromise = f({
|
|
999
989
|
...s,
|
|
1000
990
|
method: "web_app_biometry_request_auth",
|
|
1001
991
|
event: "biometry_auth_requested",
|
|
@@ -1029,7 +1019,7 @@ class _t extends N {
|
|
|
1029
1019
|
* @returns Promise with true, if access was granted.
|
|
1030
1020
|
*/
|
|
1031
1021
|
requestAccess({ reason: t, ...s } = {}) {
|
|
1032
|
-
return this.accessPromise || (this.accessPromise =
|
|
1022
|
+
return this.accessPromise || (this.accessPromise = f({
|
|
1033
1023
|
...s,
|
|
1034
1024
|
postEvent: this.postEvent,
|
|
1035
1025
|
method: "web_app_biometry_request_access",
|
|
@@ -1058,7 +1048,7 @@ class _t extends N {
|
|
|
1058
1048
|
*/
|
|
1059
1049
|
async updateToken({ token: t, ...s } = {}) {
|
|
1060
1050
|
return ["removed", "updated"].includes(
|
|
1061
|
-
(await
|
|
1051
|
+
(await f({
|
|
1062
1052
|
...s,
|
|
1063
1053
|
postEvent: this.postEvent,
|
|
1064
1054
|
method: "web_app_biometry_update_token",
|
|
@@ -1068,35 +1058,35 @@ class _t extends N {
|
|
|
1068
1058
|
);
|
|
1069
1059
|
}
|
|
1070
1060
|
}
|
|
1071
|
-
async function
|
|
1061
|
+
async function Ge(e) {
|
|
1072
1062
|
return Ht(
|
|
1073
|
-
await
|
|
1063
|
+
await f({
|
|
1074
1064
|
...e || {},
|
|
1075
1065
|
method: "web_app_biometry_get_info",
|
|
1076
1066
|
event: "biometry_info_received"
|
|
1077
1067
|
})
|
|
1078
1068
|
);
|
|
1079
1069
|
}
|
|
1080
|
-
const
|
|
1070
|
+
const ze = d("biometryManager", async ({ postEvent: e, version: t, state: s }) => {
|
|
1081
1071
|
if (s)
|
|
1082
|
-
return new
|
|
1083
|
-
if (
|
|
1084
|
-
throw
|
|
1085
|
-
|
|
1072
|
+
return new lt({ ...s, version: t, postEvent: e });
|
|
1073
|
+
if (E())
|
|
1074
|
+
throw m(
|
|
1075
|
+
vt,
|
|
1086
1076
|
"BiometryManager cannot be instantiated on the server side without passing the ssr.state object."
|
|
1087
1077
|
);
|
|
1088
|
-
return new
|
|
1089
|
-
...await
|
|
1078
|
+
return new lt({
|
|
1079
|
+
...await Ge({ timeout: 1e3 }),
|
|
1090
1080
|
version: t,
|
|
1091
1081
|
postEvent: e
|
|
1092
1082
|
});
|
|
1093
1083
|
});
|
|
1094
|
-
class
|
|
1084
|
+
class it extends st {
|
|
1095
1085
|
constructor() {
|
|
1096
1086
|
super(...arguments), c(this, "on", this.state.on.bind(this.state)), c(this, "off", this.state.off.bind(this.state));
|
|
1097
1087
|
}
|
|
1098
1088
|
}
|
|
1099
|
-
class
|
|
1089
|
+
class Ke extends it {
|
|
1100
1090
|
constructor(t, s) {
|
|
1101
1091
|
super({ isConfirmationNeeded: t }), this.postEvent = s;
|
|
1102
1092
|
}
|
|
@@ -1123,16 +1113,16 @@ class Je extends ot {
|
|
|
1123
1113
|
this.isConfirmationNeeded = !0;
|
|
1124
1114
|
}
|
|
1125
1115
|
}
|
|
1126
|
-
const
|
|
1116
|
+
const Je = d("closingBehavior", ({
|
|
1127
1117
|
postEvent: e,
|
|
1128
1118
|
state: t = { isConfirmationNeeded: !1 }
|
|
1129
|
-
}) => new
|
|
1130
|
-
class
|
|
1119
|
+
}) => new Ke(t.isConfirmationNeeded, e));
|
|
1120
|
+
class ot {
|
|
1131
1121
|
constructor(t, s) {
|
|
1132
1122
|
c(this, "supports"), this.supports = kt(t, s);
|
|
1133
1123
|
}
|
|
1134
1124
|
}
|
|
1135
|
-
function
|
|
1125
|
+
function Qe(e) {
|
|
1136
1126
|
if (Array.isArray(e))
|
|
1137
1127
|
return e;
|
|
1138
1128
|
if (typeof e == "string")
|
|
@@ -1142,11 +1132,11 @@ function Fe(e) {
|
|
|
1142
1132
|
return t;
|
|
1143
1133
|
} catch {
|
|
1144
1134
|
}
|
|
1145
|
-
throw
|
|
1135
|
+
throw S();
|
|
1146
1136
|
}
|
|
1147
|
-
class
|
|
1137
|
+
class Fe extends H {
|
|
1148
1138
|
constructor(t, s, n) {
|
|
1149
|
-
super(
|
|
1139
|
+
super(Qe, s, n), c(this, "itemParser"), this.itemParser = typeof t == "function" ? t : t.parse.bind(t);
|
|
1150
1140
|
}
|
|
1151
1141
|
/**
|
|
1152
1142
|
* Attempts to parse passed value
|
|
@@ -1162,13 +1152,13 @@ class Ye extends H {
|
|
|
1162
1152
|
return this.itemParser = typeof t == "function" ? t : t.parse.bind(t), this;
|
|
1163
1153
|
}
|
|
1164
1154
|
}
|
|
1165
|
-
function
|
|
1166
|
-
return new
|
|
1155
|
+
function Ye(e) {
|
|
1156
|
+
return new Fe((t) => t, !1, e);
|
|
1167
1157
|
}
|
|
1168
|
-
function
|
|
1158
|
+
function _t(e, t) {
|
|
1169
1159
|
return Object.fromEntries(e.map((s) => [s, t]));
|
|
1170
1160
|
}
|
|
1171
|
-
class
|
|
1161
|
+
class Ze extends ot {
|
|
1172
1162
|
constructor(t, s, n) {
|
|
1173
1163
|
super(t, {
|
|
1174
1164
|
delete: "web_app_invoke_custom_method",
|
|
@@ -1184,7 +1174,7 @@ class Xe extends at {
|
|
|
1184
1174
|
*/
|
|
1185
1175
|
async delete(t, s = {}) {
|
|
1186
1176
|
const n = Array.isArray(t) ? t : [t];
|
|
1187
|
-
n.length && await
|
|
1177
|
+
n.length && await T(
|
|
1188
1178
|
"deleteStorageValues",
|
|
1189
1179
|
{ keys: n },
|
|
1190
1180
|
this.createRequestId(),
|
|
@@ -1196,8 +1186,8 @@ class Xe extends at {
|
|
|
1196
1186
|
* @param options - request execution options.
|
|
1197
1187
|
*/
|
|
1198
1188
|
async getKeys(t = {}) {
|
|
1199
|
-
return
|
|
1200
|
-
await
|
|
1189
|
+
return Ye().of(p()).parse(
|
|
1190
|
+
await T(
|
|
1201
1191
|
"getStorageKeys",
|
|
1202
1192
|
{},
|
|
1203
1193
|
this.createRequestId(),
|
|
@@ -1208,13 +1198,13 @@ class Xe extends at {
|
|
|
1208
1198
|
async get(t, s = {}) {
|
|
1209
1199
|
const n = Array.isArray(t) ? t : [t];
|
|
1210
1200
|
if (!n.length)
|
|
1211
|
-
return
|
|
1212
|
-
const r = await
|
|
1201
|
+
return _t(n, "");
|
|
1202
|
+
const r = await T(
|
|
1213
1203
|
"getStorageValues",
|
|
1214
1204
|
{ keys: n },
|
|
1215
1205
|
this.createRequestId(),
|
|
1216
1206
|
{ ...s, postEvent: this.postEvent }
|
|
1217
|
-
), i =
|
|
1207
|
+
), i = g(_t(n, p()), "CloudStorageData").parse(r);
|
|
1218
1208
|
return Array.isArray(t) ? i : i[t];
|
|
1219
1209
|
}
|
|
1220
1210
|
/**
|
|
@@ -1224,7 +1214,7 @@ class Xe extends at {
|
|
|
1224
1214
|
* @param options - request execution options.
|
|
1225
1215
|
*/
|
|
1226
1216
|
async set(t, s, n = {}) {
|
|
1227
|
-
await
|
|
1217
|
+
await T(
|
|
1228
1218
|
"saveStorageValue",
|
|
1229
1219
|
{ key: t, value: s },
|
|
1230
1220
|
this.createRequestId(),
|
|
@@ -1232,10 +1222,10 @@ class Xe extends at {
|
|
|
1232
1222
|
);
|
|
1233
1223
|
}
|
|
1234
1224
|
}
|
|
1235
|
-
const
|
|
1236
|
-
({ createRequestId: e, postEvent: t, version: s }) => new
|
|
1225
|
+
const Xe = d(
|
|
1226
|
+
({ createRequestId: e, postEvent: t, version: s }) => new Ze(s, e, t)
|
|
1237
1227
|
);
|
|
1238
|
-
class
|
|
1228
|
+
class ts extends ot {
|
|
1239
1229
|
constructor(t, s) {
|
|
1240
1230
|
super(t, {
|
|
1241
1231
|
impactOccurred: "web_app_trigger_haptic_feedback",
|
|
@@ -1277,10 +1267,10 @@ class es extends at {
|
|
|
1277
1267
|
this.postEvent("web_app_trigger_haptic_feedback", { type: "selection_change" });
|
|
1278
1268
|
}
|
|
1279
1269
|
}
|
|
1280
|
-
const
|
|
1281
|
-
({ version: e, postEvent: t }) => new
|
|
1270
|
+
const es = d(
|
|
1271
|
+
({ version: e, postEvent: t }) => new ts(e, t)
|
|
1282
1272
|
);
|
|
1283
|
-
class
|
|
1273
|
+
class ss {
|
|
1284
1274
|
constructor(t) {
|
|
1285
1275
|
this.initData = t;
|
|
1286
1276
|
}
|
|
@@ -1353,13 +1343,13 @@ class ns {
|
|
|
1353
1343
|
return this.initData.user;
|
|
1354
1344
|
}
|
|
1355
1345
|
}
|
|
1356
|
-
const
|
|
1357
|
-
({ initData: e }) => e ? new
|
|
1346
|
+
const ns = d(
|
|
1347
|
+
({ initData: e }) => e ? new ss(e) : void 0
|
|
1358
1348
|
);
|
|
1359
|
-
function
|
|
1349
|
+
function Zs(e) {
|
|
1360
1350
|
return qt().parse(e);
|
|
1361
1351
|
}
|
|
1362
|
-
class
|
|
1352
|
+
class rs extends D {
|
|
1363
1353
|
constructor(t, s, n) {
|
|
1364
1354
|
super({ isOpened: t }, s, { open: "web_app_open_invoice" }), this.postEvent = n;
|
|
1365
1355
|
}
|
|
@@ -1389,7 +1379,7 @@ class is extends N {
|
|
|
1389
1379
|
}
|
|
1390
1380
|
this.isOpened = !0;
|
|
1391
1381
|
try {
|
|
1392
|
-
return (await
|
|
1382
|
+
return (await f({
|
|
1393
1383
|
method: "web_app_open_invoice",
|
|
1394
1384
|
event: "invoice_closed",
|
|
1395
1385
|
params: { slug: n },
|
|
@@ -1403,10 +1393,10 @@ class is extends N {
|
|
|
1403
1393
|
}
|
|
1404
1394
|
}
|
|
1405
1395
|
}
|
|
1406
|
-
const
|
|
1407
|
-
({ version: e, postEvent: t }) => new
|
|
1396
|
+
const is = d(
|
|
1397
|
+
({ version: e, postEvent: t }) => new rs(!1, e, t)
|
|
1408
1398
|
);
|
|
1409
|
-
class
|
|
1399
|
+
class os extends st {
|
|
1410
1400
|
constructor({ postEvent: t, ...s }) {
|
|
1411
1401
|
super(s), c(this, "postEvent"), c(this, "on", (n, r) => n === "click" ? b("main_button_pressed", r) : this.state.on(n, r)), c(this, "off", (n, r) => n === "click" ? j("main_button_pressed", r) : this.state.off(n, r)), this.postEvent = t;
|
|
1412
1402
|
}
|
|
@@ -1537,7 +1527,7 @@ class as extends nt {
|
|
|
1537
1527
|
return this.set(t), this.commit(), this;
|
|
1538
1528
|
}
|
|
1539
1529
|
}
|
|
1540
|
-
const
|
|
1530
|
+
const as = d("mainButton", ({
|
|
1541
1531
|
postEvent: e,
|
|
1542
1532
|
themeParams: t,
|
|
1543
1533
|
state: s = {
|
|
@@ -1548,12 +1538,12 @@ const cs = l("mainButton", ({
|
|
|
1548
1538
|
textColor: t.buttonTextColor || "#ffffff",
|
|
1549
1539
|
backgroundColor: t.buttonColor || "#000000"
|
|
1550
1540
|
}
|
|
1551
|
-
}) => new
|
|
1552
|
-
function
|
|
1553
|
-
return
|
|
1554
|
-
contact:
|
|
1541
|
+
}) => new os({ ...s, postEvent: e }));
|
|
1542
|
+
function cs() {
|
|
1543
|
+
return rt({
|
|
1544
|
+
contact: g({
|
|
1555
1545
|
userId: {
|
|
1556
|
-
type:
|
|
1546
|
+
type: P(),
|
|
1557
1547
|
from: "user_id"
|
|
1558
1548
|
},
|
|
1559
1549
|
phoneNumber: {
|
|
@@ -1579,15 +1569,15 @@ function hs() {
|
|
|
1579
1569
|
function Wt(e, t) {
|
|
1580
1570
|
return (s) => {
|
|
1581
1571
|
const [n, r] = t[s];
|
|
1582
|
-
return
|
|
1572
|
+
return C(n, r, e);
|
|
1583
1573
|
};
|
|
1584
1574
|
}
|
|
1585
|
-
function
|
|
1575
|
+
function hs(e) {
|
|
1586
1576
|
return new Promise((t) => {
|
|
1587
1577
|
setTimeout(t, e);
|
|
1588
1578
|
});
|
|
1589
1579
|
}
|
|
1590
|
-
class
|
|
1580
|
+
class ps extends D {
|
|
1591
1581
|
constructor({ postEvent: t, createRequestId: s, version: n, botInline: r, ...i }) {
|
|
1592
1582
|
super(i, n, {
|
|
1593
1583
|
requestPhoneAccess: "web_app_request_phone",
|
|
@@ -1608,8 +1598,8 @@ class us extends N {
|
|
|
1608
1598
|
async getRequestedContact({
|
|
1609
1599
|
timeout: t = 1e4
|
|
1610
1600
|
} = {}) {
|
|
1611
|
-
return
|
|
1612
|
-
await
|
|
1601
|
+
return cs().parse(
|
|
1602
|
+
await T(
|
|
1613
1603
|
"getRequestedContact",
|
|
1614
1604
|
{},
|
|
1615
1605
|
this.createRequestId(),
|
|
@@ -1677,15 +1667,15 @@ class us extends N {
|
|
|
1677
1667
|
throw new Error("Access denied.");
|
|
1678
1668
|
const s = Date.now() + t;
|
|
1679
1669
|
let n = 50;
|
|
1680
|
-
return
|
|
1670
|
+
return Tt(async () => {
|
|
1681
1671
|
for (; Date.now() < s; ) {
|
|
1682
1672
|
try {
|
|
1683
1673
|
return await this.getRequestedContact();
|
|
1684
1674
|
} catch {
|
|
1685
1675
|
}
|
|
1686
|
-
await
|
|
1676
|
+
await hs(n), n += 50;
|
|
1687
1677
|
}
|
|
1688
|
-
throw
|
|
1678
|
+
throw At(t);
|
|
1689
1679
|
}, t);
|
|
1690
1680
|
}
|
|
1691
1681
|
/**
|
|
@@ -1698,7 +1688,7 @@ class us extends N {
|
|
|
1698
1688
|
* @see requestContact
|
|
1699
1689
|
*/
|
|
1700
1690
|
async requestPhoneAccess(t = {}) {
|
|
1701
|
-
return this.requestPhoneAccessPromise || (this.requestPhoneAccessPromise =
|
|
1691
|
+
return this.requestPhoneAccessPromise || (this.requestPhoneAccessPromise = f({
|
|
1702
1692
|
...t,
|
|
1703
1693
|
method: "web_app_request_phone",
|
|
1704
1694
|
event: "phone_requested",
|
|
@@ -1710,7 +1700,7 @@ class us extends N {
|
|
|
1710
1700
|
* @param options - additional options.
|
|
1711
1701
|
*/
|
|
1712
1702
|
async requestWriteAccess(t = {}) {
|
|
1713
|
-
return this.requestWriteAccessPromise || (this.requestWriteAccessPromise =
|
|
1703
|
+
return this.requestWriteAccessPromise || (this.requestWriteAccessPromise = f({
|
|
1714
1704
|
...t,
|
|
1715
1705
|
method: "web_app_request_write_access",
|
|
1716
1706
|
event: "write_access_requested",
|
|
@@ -1740,7 +1730,7 @@ class us extends N {
|
|
|
1740
1730
|
* @param color - color key or RGB color.
|
|
1741
1731
|
*/
|
|
1742
1732
|
setHeaderColor(t) {
|
|
1743
|
-
this.postEvent("web_app_set_header_color",
|
|
1733
|
+
this.postEvent("web_app_set_header_color", et(t) ? { color: t } : { color_key: t }), this.set("headerColor", t);
|
|
1744
1734
|
}
|
|
1745
1735
|
/**
|
|
1746
1736
|
* Updates current Mini App background color.
|
|
@@ -1768,7 +1758,7 @@ class us extends N {
|
|
|
1768
1758
|
this.postEvent("web_app_switch_inline_query", { query: t, chat_types: s });
|
|
1769
1759
|
}
|
|
1770
1760
|
}
|
|
1771
|
-
const
|
|
1761
|
+
const us = d("miniApp", ({
|
|
1772
1762
|
themeParams: e,
|
|
1773
1763
|
botInline: t = !1,
|
|
1774
1764
|
state: s = {
|
|
@@ -1776,8 +1766,8 @@ const ds = l("miniApp", ({
|
|
|
1776
1766
|
headerColor: e.headerBgColor || "#000000"
|
|
1777
1767
|
},
|
|
1778
1768
|
...n
|
|
1779
|
-
}) => new
|
|
1780
|
-
function
|
|
1769
|
+
}) => new ps({ ...n, ...s, botInline: t }));
|
|
1770
|
+
function ds(e) {
|
|
1781
1771
|
const t = e.message.trim(), s = (e.title || "").trim(), n = e.buttons || [];
|
|
1782
1772
|
let r;
|
|
1783
1773
|
if (s.length > 64)
|
|
@@ -1801,7 +1791,7 @@ function ls(e) {
|
|
|
1801
1791
|
return { ...i, id: o };
|
|
1802
1792
|
}) : r = [{ type: "close", id: "" }], { title: s, message: t, buttons: r };
|
|
1803
1793
|
}
|
|
1804
|
-
class
|
|
1794
|
+
class ls extends D {
|
|
1805
1795
|
constructor(t, s, n) {
|
|
1806
1796
|
super({ isOpened: t }, s, { open: "web_app_open_popup" }), this.postEvent = n;
|
|
1807
1797
|
}
|
|
@@ -1830,11 +1820,11 @@ class _s extends N {
|
|
|
1830
1820
|
throw new Error("Popup is already opened.");
|
|
1831
1821
|
this.isOpened = !0;
|
|
1832
1822
|
try {
|
|
1833
|
-
const { button_id: s = null } = await
|
|
1823
|
+
const { button_id: s = null } = await f({
|
|
1834
1824
|
event: "popup_closed",
|
|
1835
1825
|
method: "web_app_open_popup",
|
|
1836
1826
|
postEvent: this.postEvent,
|
|
1837
|
-
params:
|
|
1827
|
+
params: ds(t)
|
|
1838
1828
|
});
|
|
1839
1829
|
return s;
|
|
1840
1830
|
} finally {
|
|
@@ -1842,10 +1832,10 @@ class _s extends N {
|
|
|
1842
1832
|
}
|
|
1843
1833
|
}
|
|
1844
1834
|
}
|
|
1845
|
-
const
|
|
1846
|
-
({ postEvent: e, version: t }) => new
|
|
1835
|
+
const _s = d(
|
|
1836
|
+
({ postEvent: e, version: t }) => new ls(!1, t, e)
|
|
1847
1837
|
);
|
|
1848
|
-
class
|
|
1838
|
+
class gs extends D {
|
|
1849
1839
|
constructor(t, s, n) {
|
|
1850
1840
|
super({ isOpened: t }, s, {
|
|
1851
1841
|
close: "web_app_close_scan_qr_popup",
|
|
@@ -1878,7 +1868,7 @@ class fs extends N {
|
|
|
1878
1868
|
throw new Error("QR scanner is already opened.");
|
|
1879
1869
|
this.isOpened = !0;
|
|
1880
1870
|
try {
|
|
1881
|
-
return (await
|
|
1871
|
+
return (await f({
|
|
1882
1872
|
method: "web_app_open_scan_qr_popup",
|
|
1883
1873
|
event: ["qr_text_received", "scan_qr_popup_closed"],
|
|
1884
1874
|
postEvent: this.postEvent,
|
|
@@ -1889,10 +1879,10 @@ class fs extends N {
|
|
|
1889
1879
|
}
|
|
1890
1880
|
}
|
|
1891
1881
|
}
|
|
1892
|
-
const
|
|
1893
|
-
({ version: e, postEvent: t }) => new
|
|
1882
|
+
const fs = d(
|
|
1883
|
+
({ version: e, postEvent: t }) => new gs(!1, e, t)
|
|
1894
1884
|
);
|
|
1895
|
-
class
|
|
1885
|
+
class ms extends nt {
|
|
1896
1886
|
constructor(t, s, n) {
|
|
1897
1887
|
super({ isVisible: t }, s, {
|
|
1898
1888
|
show: "web_app_setup_settings_button",
|
|
@@ -1921,15 +1911,15 @@ class ws extends rt {
|
|
|
1921
1911
|
this.isVisible = !0;
|
|
1922
1912
|
}
|
|
1923
1913
|
}
|
|
1924
|
-
const
|
|
1914
|
+
const ws = d("settingsButton", ({
|
|
1925
1915
|
version: e,
|
|
1926
1916
|
postEvent: t,
|
|
1927
1917
|
state: s = { isVisible: !1 }
|
|
1928
|
-
}) => new
|
|
1918
|
+
}) => new ms(s.isVisible, e, t));
|
|
1929
1919
|
function jt(e) {
|
|
1930
|
-
return
|
|
1920
|
+
return Dt().parse(e);
|
|
1931
1921
|
}
|
|
1932
|
-
class
|
|
1922
|
+
class bs extends it {
|
|
1933
1923
|
/**
|
|
1934
1924
|
* @since v6.10
|
|
1935
1925
|
*/
|
|
@@ -2007,18 +1997,18 @@ class vs extends ot {
|
|
|
2007
1997
|
return this.get("textColor");
|
|
2008
1998
|
}
|
|
2009
1999
|
}
|
|
2010
|
-
const
|
|
2011
|
-
const s = new
|
|
2012
|
-
return
|
|
2000
|
+
const vs = d("themeParams", ({ themeParams: e, state: t = e }) => {
|
|
2001
|
+
const s = new bs(t);
|
|
2002
|
+
return E() || s.listen(), s;
|
|
2013
2003
|
});
|
|
2014
|
-
function
|
|
2015
|
-
return
|
|
2004
|
+
function Xs(e = {}) {
|
|
2005
|
+
return f({
|
|
2016
2006
|
...e,
|
|
2017
2007
|
method: "web_app_request_theme",
|
|
2018
2008
|
event: "theme_changed"
|
|
2019
2009
|
}).then(jt);
|
|
2020
2010
|
}
|
|
2021
|
-
class
|
|
2011
|
+
class ys extends ot {
|
|
2022
2012
|
constructor(t, s, n) {
|
|
2023
2013
|
super(t, { readTextFromClipboard: "web_app_read_text_from_clipboard" }), c(this, "supportsParam"), this.version = t, this.createRequestId = s, this.postEvent = n, this.supportsParam = Wt(t, {
|
|
2024
2014
|
"openLink.tryInstantView": ["web_app_open_link", "try_instant_view"]
|
|
@@ -2035,7 +2025,7 @@ class Es extends at {
|
|
|
2035
2025
|
*/
|
|
2036
2026
|
openLink(t, s) {
|
|
2037
2027
|
const n = new URL(t, window.location.href).toString();
|
|
2038
|
-
if (!
|
|
2028
|
+
if (!C("web_app_open_link", this.version)) {
|
|
2039
2029
|
window.open(n, "_blank");
|
|
2040
2030
|
return;
|
|
2041
2031
|
}
|
|
@@ -2054,7 +2044,7 @@ class Es extends at {
|
|
|
2054
2044
|
const { hostname: s, pathname: n, search: r } = new URL(t, window.location.href);
|
|
2055
2045
|
if (s !== "t.me")
|
|
2056
2046
|
throw new Error(`URL has not allowed hostname: ${s}. Only "t.me" is allowed`);
|
|
2057
|
-
if (!
|
|
2047
|
+
if (!C("web_app_open_tg_link", this.version)) {
|
|
2058
2048
|
window.location.href = t;
|
|
2059
2049
|
return;
|
|
2060
2050
|
}
|
|
@@ -2069,7 +2059,7 @@ class Es extends at {
|
|
|
2069
2059
|
async readTextFromClipboard() {
|
|
2070
2060
|
const t = this.createRequestId(), {
|
|
2071
2061
|
data: s = null
|
|
2072
|
-
} = await
|
|
2062
|
+
} = await f({
|
|
2073
2063
|
method: "web_app_read_text_from_clipboard",
|
|
2074
2064
|
event: "clipboard_text_received",
|
|
2075
2065
|
postEvent: this.postEvent,
|
|
@@ -2079,31 +2069,31 @@ class Es extends at {
|
|
|
2079
2069
|
return s;
|
|
2080
2070
|
}
|
|
2081
2071
|
}
|
|
2082
|
-
const
|
|
2083
|
-
({ version: e, postEvent: t, createRequestId: s }) => new
|
|
2072
|
+
const Es = d(
|
|
2073
|
+
({ version: e, postEvent: t, createRequestId: s }) => new ys(e, s, t)
|
|
2084
2074
|
);
|
|
2085
2075
|
async function Gt(e = {}) {
|
|
2086
2076
|
const {
|
|
2087
2077
|
is_expanded: t,
|
|
2088
2078
|
is_state_stable: s,
|
|
2089
2079
|
...n
|
|
2090
|
-
} = await
|
|
2080
|
+
} = await f({
|
|
2091
2081
|
...e,
|
|
2092
2082
|
method: "web_app_request_viewport",
|
|
2093
2083
|
event: "viewport_changed"
|
|
2094
2084
|
});
|
|
2095
2085
|
return { ...n, isExpanded: t, isStateStable: s };
|
|
2096
2086
|
}
|
|
2097
|
-
function
|
|
2087
|
+
function A(e) {
|
|
2098
2088
|
return e < 0 ? 0 : e;
|
|
2099
2089
|
}
|
|
2100
|
-
class zt extends
|
|
2090
|
+
class zt extends it {
|
|
2101
2091
|
constructor({ postEvent: t, stableHeight: s, height: n, width: r, isExpanded: i }) {
|
|
2102
2092
|
super({
|
|
2103
|
-
height:
|
|
2093
|
+
height: A(n),
|
|
2104
2094
|
isExpanded: i,
|
|
2105
|
-
stableHeight:
|
|
2106
|
-
width:
|
|
2095
|
+
stableHeight: A(s),
|
|
2096
|
+
width: A(r)
|
|
2107
2097
|
}), c(this, "postEvent"), this.postEvent = t;
|
|
2108
2098
|
}
|
|
2109
2099
|
/**
|
|
@@ -2165,11 +2155,11 @@ class zt extends ot {
|
|
|
2165
2155
|
width: n,
|
|
2166
2156
|
is_expanded: r,
|
|
2167
2157
|
is_state_stable: i
|
|
2168
|
-
} = t, o =
|
|
2158
|
+
} = t, o = A(s);
|
|
2169
2159
|
this.set({
|
|
2170
2160
|
height: o,
|
|
2171
2161
|
isExpanded: r,
|
|
2172
|
-
width:
|
|
2162
|
+
width: A(n),
|
|
2173
2163
|
...i ? { stableHeight: o } : {}
|
|
2174
2164
|
});
|
|
2175
2165
|
});
|
|
@@ -2204,7 +2194,7 @@ class zt extends ot {
|
|
|
2204
2194
|
return this.stableHeight === this.height;
|
|
2205
2195
|
}
|
|
2206
2196
|
}
|
|
2207
|
-
async function
|
|
2197
|
+
async function Ps(e, t = {}) {
|
|
2208
2198
|
const {
|
|
2209
2199
|
height: s,
|
|
2210
2200
|
width: n,
|
|
@@ -2219,7 +2209,7 @@ async function xs(e, t = {}) {
|
|
|
2219
2209
|
stableHeight: i ? s : 0
|
|
2220
2210
|
});
|
|
2221
2211
|
}
|
|
2222
|
-
function
|
|
2212
|
+
function xs({
|
|
2223
2213
|
state: e,
|
|
2224
2214
|
platform: t,
|
|
2225
2215
|
postEvent: s
|
|
@@ -2233,26 +2223,26 @@ function Ss({
|
|
|
2233
2223
|
isExpanded: n
|
|
2234
2224
|
});
|
|
2235
2225
|
}
|
|
2236
|
-
const Cs =
|
|
2226
|
+
const Cs = d(
|
|
2237
2227
|
"viewport",
|
|
2238
2228
|
async (e) => {
|
|
2239
|
-
if (
|
|
2240
|
-
throw
|
|
2241
|
-
|
|
2229
|
+
if (E() && !e.state)
|
|
2230
|
+
throw m(
|
|
2231
|
+
vt,
|
|
2242
2232
|
"Viewport cannot be instantiated on the server side without passing the ssr.state object."
|
|
2243
2233
|
);
|
|
2244
|
-
let t =
|
|
2245
|
-
return
|
|
2234
|
+
let t = xs(e);
|
|
2235
|
+
return E() || (t.width === 0 && await Ps(e.postEvent, { timeout: 1e3 }).then((s) => t = s).catch((s) => $.error("Unable to sync viewport state", s)), t.listen()), t;
|
|
2246
2236
|
}
|
|
2247
2237
|
);
|
|
2248
2238
|
function y(e, t) {
|
|
2249
2239
|
document.documentElement.style.setProperty(e, t);
|
|
2250
2240
|
}
|
|
2251
|
-
function
|
|
2241
|
+
function tn(e, t, s) {
|
|
2252
2242
|
s || (s = (a) => `--tg-${a}-color`);
|
|
2253
2243
|
const n = s("header"), r = s("bg"), i = () => {
|
|
2254
2244
|
const { headerColor: a } = e;
|
|
2255
|
-
if (
|
|
2245
|
+
if (et(a))
|
|
2256
2246
|
y(n, a);
|
|
2257
2247
|
else {
|
|
2258
2248
|
const { bgColor: h, secondaryBgColor: u } = t;
|
|
@@ -2265,7 +2255,7 @@ function en(e, t, s) {
|
|
|
2265
2255
|
];
|
|
2266
2256
|
return i(), () => o.forEach((a) => a());
|
|
2267
2257
|
}
|
|
2268
|
-
function
|
|
2258
|
+
function en(e, t) {
|
|
2269
2259
|
t || (t = (n) => `--tg-theme-${n.replace(/[A-Z]/g, (r) => `-${r.toLowerCase()}`)}`);
|
|
2270
2260
|
const s = () => {
|
|
2271
2261
|
Object.entries(e.getState()).forEach(([n, r]) => {
|
|
@@ -2274,7 +2264,7 @@ function sn(e, t) {
|
|
|
2274
2264
|
};
|
|
2275
2265
|
return s(), e.on("change", s);
|
|
2276
2266
|
}
|
|
2277
|
-
function
|
|
2267
|
+
function sn(e, t) {
|
|
2278
2268
|
t || (t = (u) => `--tg-viewport-${u}`);
|
|
2279
2269
|
const [
|
|
2280
2270
|
s,
|
|
@@ -2287,7 +2277,7 @@ function nn(e, t) {
|
|
|
2287
2277
|
];
|
|
2288
2278
|
return i(), o(), a(), () => h.forEach((u) => u());
|
|
2289
2279
|
}
|
|
2290
|
-
function
|
|
2280
|
+
function Ss(e = !0) {
|
|
2291
2281
|
const t = [
|
|
2292
2282
|
b("reload_iframe", () => {
|
|
2293
2283
|
k("iframe_will_reload"), window.location.reload();
|
|
@@ -2304,20 +2294,20 @@ function Rs(e = !0) {
|
|
|
2304
2294
|
}
|
|
2305
2295
|
return k("iframe_ready", { reload_supported: !0 }), s;
|
|
2306
2296
|
}
|
|
2307
|
-
async function
|
|
2297
|
+
async function nn() {
|
|
2308
2298
|
if (xt(window))
|
|
2309
2299
|
return !0;
|
|
2310
2300
|
try {
|
|
2311
|
-
return await
|
|
2301
|
+
return await f({ method: "web_app_request_theme", event: "theme_changed", timeout: 100 }), !0;
|
|
2312
2302
|
} catch {
|
|
2313
2303
|
return !1;
|
|
2314
2304
|
}
|
|
2315
2305
|
}
|
|
2316
|
-
function
|
|
2306
|
+
function Rs(e) {
|
|
2317
2307
|
return e instanceof U;
|
|
2318
2308
|
}
|
|
2319
|
-
function
|
|
2320
|
-
return
|
|
2309
|
+
function rn(e, t) {
|
|
2310
|
+
return Rs(e) && e.type === t;
|
|
2321
2311
|
}
|
|
2322
2312
|
function z(e, t) {
|
|
2323
2313
|
let s, n, r;
|
|
@@ -2330,9 +2320,9 @@ function z(e, t) {
|
|
|
2330
2320
|
class As {
|
|
2331
2321
|
constructor(t, s, n = k) {
|
|
2332
2322
|
if (c(this, "history"), c(this, "ee", new L()), 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)
|
|
2333
|
-
throw
|
|
2323
|
+
throw m(le, "History should not be empty.");
|
|
2334
2324
|
if (s < 0 || s >= t.length)
|
|
2335
|
-
throw
|
|
2325
|
+
throw m(
|
|
2336
2326
|
_e,
|
|
2337
2327
|
"Index should not be zero and higher or equal than history size."
|
|
2338
2328
|
);
|
|
@@ -2487,7 +2477,7 @@ async function I(e) {
|
|
|
2487
2477
|
})
|
|
2488
2478
|
]);
|
|
2489
2479
|
}
|
|
2490
|
-
async function
|
|
2480
|
+
async function Ts() {
|
|
2491
2481
|
if (window.history.length <= 1 || (window.history.pushState(null, ""), await I(1 - window.history.length)))
|
|
2492
2482
|
return;
|
|
2493
2483
|
let e = await I(-1);
|
|
@@ -2497,13 +2487,13 @@ async function Is() {
|
|
|
2497
2487
|
function Kt(e) {
|
|
2498
2488
|
return M(e).pathname;
|
|
2499
2489
|
}
|
|
2500
|
-
const
|
|
2490
|
+
const gt = 0, Q = 1, F = 2;
|
|
2501
2491
|
class Jt {
|
|
2502
2492
|
constructor(t, s, { postEvent: n, hashMode: r, base: i } = {}) {
|
|
2503
2493
|
c(this, "navigator"), c(this, "ee", new L()), c(this, "hashMode"), c(this, "base"), c(this, "attached", !1), c(this, "onPopState", ({ state: o }) => {
|
|
2504
2494
|
if (o === null)
|
|
2505
2495
|
return this.push(this.parsePath(window.location.href));
|
|
2506
|
-
o ===
|
|
2496
|
+
o === gt ? window.history.forward() : o === Q && this.back(), o === F && this.forward();
|
|
2507
2497
|
}), c(this, "onNavigatorChange", async ({
|
|
2508
2498
|
to: o,
|
|
2509
2499
|
from: a,
|
|
@@ -2676,7 +2666,7 @@ class Jt {
|
|
|
2676
2666
|
async syncHistory() {
|
|
2677
2667
|
window.removeEventListener("popstate", this.onPopState);
|
|
2678
2668
|
const { state: t } = this, s = this.renderPath(this);
|
|
2679
|
-
await
|
|
2669
|
+
await Ts(), this.hasPrev && this.hasNext ? (window.history.replaceState(Q, ""), window.history.pushState(t, "", s), window.history.pushState(F, ""), await I(-1)) : this.hasPrev ? (window.history.replaceState(Q, ""), window.history.pushState(t, "", s)) : this.hasNext ? (window.history.replaceState(t, s), window.history.pushState(F, ""), await I(-1)) : (window.history.replaceState(gt, ""), window.history.pushState(t, "", s)), window.addEventListener("popstate", this.onPopState);
|
|
2680
2670
|
}
|
|
2681
2671
|
/**
|
|
2682
2672
|
* Current query parameters.
|
|
@@ -2694,7 +2684,7 @@ class Jt {
|
|
|
2694
2684
|
return (this.navigator.current.params || {}).state;
|
|
2695
2685
|
}
|
|
2696
2686
|
}
|
|
2697
|
-
function
|
|
2687
|
+
function Is(e) {
|
|
2698
2688
|
e || (e = {});
|
|
2699
2689
|
const { href: t, hash: s } = window.location;
|
|
2700
2690
|
let n = B(
|
|
@@ -2703,19 +2693,19 @@ function ks(e) {
|
|
|
2703
2693
|
const r = e.base ? Kt(e.base) : void 0;
|
|
2704
2694
|
if (r) {
|
|
2705
2695
|
if (!n.startsWith(r))
|
|
2706
|
-
throw
|
|
2707
|
-
|
|
2696
|
+
throw m(
|
|
2697
|
+
ge,
|
|
2708
2698
|
`Path "${n}" expected to be starting with "${r}"`
|
|
2709
2699
|
);
|
|
2710
2700
|
n = n.slice(r.length);
|
|
2711
2701
|
}
|
|
2712
2702
|
return new Jt([n], 0, e);
|
|
2713
2703
|
}
|
|
2714
|
-
function
|
|
2704
|
+
function on(e) {
|
|
2715
2705
|
const t = e.match(/#(.+)/);
|
|
2716
2706
|
return t ? t[1] : null;
|
|
2717
2707
|
}
|
|
2718
|
-
function
|
|
2708
|
+
function ks(e, t) {
|
|
2719
2709
|
if (Ut()) {
|
|
2720
2710
|
const s = sessionStorage.getItem(e);
|
|
2721
2711
|
if (s)
|
|
@@ -2726,31 +2716,31 @@ function Os(e, t) {
|
|
|
2726
2716
|
console.error("Unable to restore hash navigator state.", n);
|
|
2727
2717
|
}
|
|
2728
2718
|
}
|
|
2729
|
-
return
|
|
2719
|
+
return Is(t);
|
|
2730
2720
|
}
|
|
2731
|
-
function
|
|
2732
|
-
const s =
|
|
2721
|
+
function an(e, t) {
|
|
2722
|
+
const s = ks(e, t), n = () => sessionStorage.setItem(e, JSON.stringify({
|
|
2733
2723
|
index: s.index,
|
|
2734
2724
|
history: s.history
|
|
2735
2725
|
}));
|
|
2736
2726
|
return s.on("change", n), n(), s;
|
|
2737
2727
|
}
|
|
2738
|
-
function
|
|
2739
|
-
return (t, s, ...n) => (r) =>
|
|
2728
|
+
function l(e) {
|
|
2729
|
+
return (t, s, ...n) => (r) => ft(s, ct(() => ct({
|
|
2740
2730
|
[t]: e(...n)
|
|
2741
2731
|
}, r)));
|
|
2742
2732
|
}
|
|
2743
2733
|
const Qt = Ft();
|
|
2744
|
-
function
|
|
2734
|
+
function Os() {
|
|
2745
2735
|
const e = Yt(Qt);
|
|
2746
2736
|
if (!e)
|
|
2747
2737
|
throw new Error("useSDK was used outside of SDKProvider.");
|
|
2748
2738
|
return e;
|
|
2749
2739
|
}
|
|
2750
|
-
function
|
|
2751
|
-
return (...t) =>
|
|
2740
|
+
function _(e) {
|
|
2741
|
+
return (...t) => Os()(e, ...t);
|
|
2752
2742
|
}
|
|
2753
|
-
const
|
|
2743
|
+
const qs = _(je), cn = l(qs), Ds = _(ze), hn = l(Ds), Ns = _(Je), pn = l(Ns), Vs = _(Xe), un = l(Vs), Ms = _(es), dn = l(Ms), Bs = _(ns), ln = l(Bs), $s = _(is), _n = l($s), Ls = _(as), gn = l(Ls), Us = _(us), fn = l(Us), Hs = _(_s), mn = l(Hs), Ws = _(fs), wn = l(Ws), js = _(ws), bn = l(js), Gs = _(vs), vn = l(Gs), zs = _(Es), yn = l(zs), Ks = _(Cs), En = l(Ks), Pn = (e) => {
|
|
2754
2744
|
const t = /* @__PURE__ */ new Map(), s = (n, ...r) => {
|
|
2755
2745
|
if (t.has(n))
|
|
2756
2746
|
return t.get(n);
|
|
@@ -2760,7 +2750,7 @@ const Ns = g(Ge), hn = _(Ns), Ds = g(Ke), pn = _(Ds), Vs = g(Qe), un = _(Vs), Ms
|
|
|
2760
2750
|
} catch (h) {
|
|
2761
2751
|
return [h];
|
|
2762
2752
|
}
|
|
2763
|
-
}), o =
|
|
2753
|
+
}), o = pt(() => {
|
|
2764
2754
|
if (i.error)
|
|
2765
2755
|
return [i.error];
|
|
2766
2756
|
if (i.state !== "ready")
|
|
@@ -2768,14 +2758,14 @@ const Ns = g(Ge), hn = _(Ns), Ds = g(Ke), pn = _(Ds), Vs = g(Qe), un = _(Vs), Ms
|
|
|
2768
2758
|
const h = i();
|
|
2769
2759
|
if (Array.isArray(h) || !h || !("on" in h))
|
|
2770
2760
|
return h;
|
|
2771
|
-
const u = te((V) => (V(h), h.on("change", () => V(h)))),
|
|
2761
|
+
const u = te((V) => (V(h), h.on("change", () => V(h)))), N = Object.getPrototypeOf(h), G = {};
|
|
2772
2762
|
return new Proxy(h, {
|
|
2773
|
-
get(V,
|
|
2774
|
-
if (!(
|
|
2775
|
-
const
|
|
2776
|
-
G[
|
|
2763
|
+
get(V, x) {
|
|
2764
|
+
if (!(x in G)) {
|
|
2765
|
+
const at = Reflect.getOwnPropertyDescriptor(N, x);
|
|
2766
|
+
G[x] = at && "get" in at ? pt(() => u()[x]) : () => Reflect.get(V, x);
|
|
2777
2767
|
}
|
|
2778
|
-
return G[
|
|
2768
|
+
return G[x]();
|
|
2779
2769
|
}
|
|
2780
2770
|
});
|
|
2781
2771
|
});
|
|
@@ -2792,11 +2782,11 @@ const Ns = g(Ge), hn = _(Ns), Ds = g(Ke), pn = _(Ds), Vs = g(Qe), un = _(Vs), Ms
|
|
|
2792
2782
|
}
|
|
2793
2783
|
}), t.set(n, a), a;
|
|
2794
2784
|
};
|
|
2795
|
-
return
|
|
2785
|
+
return ht(() => {
|
|
2796
2786
|
ie(e.debug || !1);
|
|
2797
|
-
}),
|
|
2798
|
-
|
|
2799
|
-
}),
|
|
2787
|
+
}), ht(() => {
|
|
2788
|
+
Ct() && Zt(Ss(e.acceptCustomStyles));
|
|
2789
|
+
}), ft(Qt.Provider, {
|
|
2800
2790
|
value: s,
|
|
2801
2791
|
get children() {
|
|
2802
2792
|
return e.children;
|
|
@@ -2804,139 +2794,138 @@ const Ns = g(Ge), hn = _(Ns), Ds = g(Ke), pn = _(Ds), Vs = g(Qe), un = _(Vs), Ms
|
|
|
2804
2794
|
});
|
|
2805
2795
|
};
|
|
2806
2796
|
export {
|
|
2807
|
-
|
|
2797
|
+
ke as BackButton,
|
|
2808
2798
|
As as BasicNavigator,
|
|
2809
|
-
|
|
2799
|
+
lt as BiometryManager,
|
|
2810
2800
|
Jt as BrowserNavigator,
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2801
|
+
Ke as ClosingBehavior,
|
|
2802
|
+
Ze as CloudStorage,
|
|
2803
|
+
ge as ERR_INVALID_PATH_BASE,
|
|
2814
2804
|
pe as ERR_INVOKE_CUSTOM_METHOD_RESPONSE,
|
|
2815
2805
|
ce as ERR_METHOD_PARAMETER_UNSUPPORTED,
|
|
2816
2806
|
ae as ERR_METHOD_UNSUPPORTED,
|
|
2817
2807
|
le as ERR_NAVIGATION_HISTORY_EMPTY,
|
|
2818
2808
|
_e as ERR_NAVIGATION_INDEX_INVALID,
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
ge as ERR_SSR_POST_EVENT,
|
|
2809
|
+
Qs as ERR_NAVIGATION_ITEM_INVALID,
|
|
2810
|
+
bt as ERR_PARSE,
|
|
2811
|
+
vt as ERR_SSR_INIT,
|
|
2823
2812
|
ue as ERR_TIMED_OUT,
|
|
2824
2813
|
de as ERR_UNEXPECTED_TYPE,
|
|
2825
2814
|
he as ERR_UNKNOWN_ENV,
|
|
2826
2815
|
L as EventEmitter,
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2816
|
+
ts as HapticFeedback,
|
|
2817
|
+
ss as InitData,
|
|
2818
|
+
rs as Invoice,
|
|
2819
|
+
os as MainButton,
|
|
2820
|
+
ps as MiniApp,
|
|
2821
|
+
ls as Popup,
|
|
2822
|
+
gs as QRScanner,
|
|
2834
2823
|
U as SDKError,
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2824
|
+
Pn as SDKProvider,
|
|
2825
|
+
ms as SettingsButton,
|
|
2826
|
+
bs as ThemeParams,
|
|
2827
|
+
ys as Utils,
|
|
2839
2828
|
zt as Viewport,
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2829
|
+
Ye as array,
|
|
2830
|
+
tn as bindMiniAppCSSVars,
|
|
2831
|
+
en as bindThemeParamsCSSVars,
|
|
2832
|
+
sn as bindViewportCSSVars,
|
|
2844
2833
|
v as boolean,
|
|
2845
2834
|
Rt as captureSameReq,
|
|
2846
2835
|
X as classNames,
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2836
|
+
Se as compareVersions,
|
|
2837
|
+
Is as createBrowserNavigatorFromLocation,
|
|
2838
|
+
Te as createPostEvent,
|
|
2850
2839
|
M as createSafeURL,
|
|
2851
2840
|
Ot as date,
|
|
2852
|
-
|
|
2841
|
+
on as getHash,
|
|
2853
2842
|
Kt as getPathname,
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2843
|
+
je as initBackButton,
|
|
2844
|
+
ze as initBiometryManager,
|
|
2845
|
+
Je as initClosingBehavior,
|
|
2846
|
+
Xe as initCloudStorage,
|
|
2847
|
+
es as initHapticFeedback,
|
|
2848
|
+
ns as initInitData,
|
|
2849
|
+
is as initInvoice,
|
|
2850
|
+
as as initMainButton,
|
|
2851
|
+
us as initMiniApp,
|
|
2852
|
+
an as initNavigator,
|
|
2853
|
+
_s as initPopup,
|
|
2854
|
+
fs as initQRScanner,
|
|
2855
|
+
ws as initSettingsButton,
|
|
2856
|
+
vs as initThemeParams,
|
|
2857
|
+
Es as initUtils,
|
|
2869
2858
|
Cs as initViewport,
|
|
2870
|
-
|
|
2871
|
-
|
|
2859
|
+
Ss as initWeb,
|
|
2860
|
+
T as invokeCustomMethod,
|
|
2872
2861
|
It as isColorDark,
|
|
2873
|
-
|
|
2862
|
+
Ct as isIframe,
|
|
2874
2863
|
Ut as isPageReload,
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2864
|
+
et as isRGB,
|
|
2865
|
+
fe as isRGBShort,
|
|
2866
|
+
Rs as isSDKError,
|
|
2867
|
+
rn as isSDKErrorOfType,
|
|
2868
|
+
E as isSSR,
|
|
2869
|
+
nn as isTMA,
|
|
2870
|
+
g as json,
|
|
2871
|
+
Ys as mergeClassNames,
|
|
2872
|
+
P as number,
|
|
2884
2873
|
j as off,
|
|
2885
2874
|
b as on,
|
|
2886
|
-
|
|
2887
|
-
|
|
2875
|
+
Zs as parseInitData,
|
|
2876
|
+
Nt as parseLaunchParams,
|
|
2888
2877
|
jt as parseThemeParams,
|
|
2889
2878
|
k as postEvent,
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2879
|
+
f as request,
|
|
2880
|
+
Ge as requestBiometryInfo,
|
|
2881
|
+
Xs as requestThemeParams,
|
|
2893
2882
|
Gt as requestViewport,
|
|
2894
|
-
|
|
2883
|
+
Ue as retrieveLaunchParams,
|
|
2895
2884
|
Pt as rgb,
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2885
|
+
rt as searchParams,
|
|
2886
|
+
$e as serializeLaunchParams,
|
|
2887
|
+
Be as serializeThemeParams,
|
|
2899
2888
|
y as setCSSVar,
|
|
2900
2889
|
ie as setDebug,
|
|
2901
|
-
|
|
2890
|
+
Fs as setTargetOrigin,
|
|
2902
2891
|
p as string,
|
|
2903
2892
|
ne as subscribe,
|
|
2904
|
-
|
|
2893
|
+
C as supports,
|
|
2905
2894
|
Ae as targetOrigin,
|
|
2906
2895
|
Et as toRGB,
|
|
2907
|
-
|
|
2896
|
+
wt as unsubscribe,
|
|
2908
2897
|
B as urlToPath,
|
|
2909
|
-
|
|
2898
|
+
qs as useBackButton,
|
|
2910
2899
|
Ds as useBiometryManager,
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2900
|
+
Ns as useClosingBehavior,
|
|
2901
|
+
Vs as useCloudStorage,
|
|
2902
|
+
Ms as useHapticFeedback,
|
|
2903
|
+
Bs as useInitData,
|
|
2904
|
+
$s as useInvoice,
|
|
2905
|
+
Ls as useMainButton,
|
|
2906
|
+
Us as useMiniApp,
|
|
2907
|
+
Hs as usePopup,
|
|
2908
|
+
Ws as useQRScanner,
|
|
2909
|
+
Os as useSDK,
|
|
2910
|
+
js as useSettingsButton,
|
|
2911
|
+
Gs as useThemeParams,
|
|
2912
|
+
zs as useUtils,
|
|
2913
|
+
Ks as useViewport,
|
|
2914
|
+
cn as withBackButton,
|
|
2915
|
+
hn as withBiometryManager,
|
|
2916
|
+
pn as withClosingBehavior,
|
|
2917
|
+
un as withCloudStorage,
|
|
2918
|
+
dn as withHapticFeedback,
|
|
2919
|
+
ln as withInitData,
|
|
2920
|
+
_n as withInvoice,
|
|
2921
|
+
gn as withMainButton,
|
|
2922
|
+
fn as withMiniApp,
|
|
2923
|
+
mn as withPopup,
|
|
2924
|
+
wn as withQRScanner,
|
|
2925
|
+
bn as withSettingsButton,
|
|
2926
|
+
vn as withThemeParams,
|
|
2927
|
+
Tt as withTimeout,
|
|
2928
|
+
yn as withUtils,
|
|
2929
|
+
En as withViewport
|
|
2941
2930
|
};
|
|
2942
2931
|
//# sourceMappingURL=index.js.map
|