@tma.js/sdk-solid 2.1.8 → 2.1.10
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 +115 -102
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createComponent as bt, mergeProps as ut, createContext as ee, useContext as se, createEffect as
|
|
1
|
+
import { createComponent as bt, mergeProps as ut, createContext as ee, useContext as se, createEffect as lt, onCleanup as dt, createResource as ne, createMemo as _t, from as re } from "solid-js";
|
|
2
2
|
var ie = Object.defineProperty, oe = (e, t, s) => t in e ? ie(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, c = (e, t, s) => oe(e, typeof t != "symbol" ? t + "" : t, s);
|
|
3
3
|
function vt(e, t) {
|
|
4
4
|
let s;
|
|
@@ -157,12 +157,12 @@ class $ extends Error {
|
|
|
157
157
|
super(s, { cause: n }), this.type = t, Object.setPrototypeOf(this, $.prototype);
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
-
function
|
|
160
|
+
function b(e, t, s) {
|
|
161
161
|
return new $(e, t, s);
|
|
162
162
|
}
|
|
163
|
-
const ue = "ERR_METHOD_UNSUPPORTED",
|
|
163
|
+
const ue = "ERR_METHOD_UNSUPPORTED", le = "ERR_METHOD_PARAMETER_UNSUPPORTED", de = "ERR_UNKNOWN_ENV", _e = "ERR_INVOKE_CUSTOM_METHOD_RESPONSE", ge = "ERR_TIMED_OUT", fe = "ERR_UNEXPECTED_TYPE", Et = "ERR_PARSE", we = "ERR_NAVIGATION_LIST_EMPTY", me = "ERR_NAVIGATION_CURSOR_INVALID", zs = "ERR_NAVIGATION_ITEM_INVALID", Js = "ERR_SSR_INIT", be = "ERR_INVALID_PATH_BASE";
|
|
164
164
|
function S() {
|
|
165
|
-
return
|
|
165
|
+
return b(fe, "Value has unexpected type");
|
|
166
166
|
}
|
|
167
167
|
class L {
|
|
168
168
|
constructor(t, s, n) {
|
|
@@ -179,7 +179,7 @@ class L {
|
|
|
179
179
|
try {
|
|
180
180
|
return this.parser(t);
|
|
181
181
|
} catch (s) {
|
|
182
|
-
throw
|
|
182
|
+
throw b(
|
|
183
183
|
Et,
|
|
184
184
|
`Unable to parse value${this.type ? ` as ${this.type}` : ""}`,
|
|
185
185
|
s
|
|
@@ -190,10 +190,10 @@ class L {
|
|
|
190
190
|
return this.isOptional = !0, this;
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function T(e, t) {
|
|
194
194
|
return () => new L(e, !1, t);
|
|
195
195
|
}
|
|
196
|
-
const y =
|
|
196
|
+
const y = T((e) => {
|
|
197
197
|
if (typeof e == "boolean")
|
|
198
198
|
return e;
|
|
199
199
|
const t = String(e);
|
|
@@ -220,7 +220,7 @@ function Pt(e, t) {
|
|
|
220
220
|
const a = o(t(i));
|
|
221
221
|
a !== void 0 && (s[n] = a);
|
|
222
222
|
} catch (a) {
|
|
223
|
-
throw
|
|
223
|
+
throw b(Et, `Unable to parse field "${n}"`, a);
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
return s;
|
|
@@ -237,7 +237,7 @@ function f(e, t) {
|
|
|
237
237
|
return Pt(e, (r) => n[r]);
|
|
238
238
|
}, !1, t);
|
|
239
239
|
}
|
|
240
|
-
const P =
|
|
240
|
+
const P = T((e) => {
|
|
241
241
|
if (typeof e == "number")
|
|
242
242
|
return e;
|
|
243
243
|
if (typeof e == "string") {
|
|
@@ -271,11 +271,11 @@ function xt(e) {
|
|
|
271
271
|
return n + (i.length === 1 ? "0" : "") + i;
|
|
272
272
|
}, "#");
|
|
273
273
|
}
|
|
274
|
-
const p =
|
|
274
|
+
const p = T((e) => {
|
|
275
275
|
if (typeof e == "string" || typeof e == "number")
|
|
276
276
|
return e.toString();
|
|
277
277
|
throw S();
|
|
278
|
-
}, "string"), Ct =
|
|
278
|
+
}, "string"), Ct = T((e) => xt(p().parse(e)), "rgb");
|
|
279
279
|
function St(e) {
|
|
280
280
|
return f({
|
|
281
281
|
eventType: p(),
|
|
@@ -431,7 +431,7 @@ function v(e, t, s) {
|
|
|
431
431
|
function N(e) {
|
|
432
432
|
return typeof e == "object" && e !== null && !Array.isArray(e);
|
|
433
433
|
}
|
|
434
|
-
function
|
|
434
|
+
function Te(e, t) {
|
|
435
435
|
const s = e.split("."), n = t.split("."), r = Math.max(s.length, n.length);
|
|
436
436
|
for (let i = 0; i < r; i += 1) {
|
|
437
437
|
const o = parseInt(s[i] || "0", 10), a = parseInt(n[i] || "0", 10);
|
|
@@ -440,15 +440,21 @@ function Re(e, t) {
|
|
|
440
440
|
}
|
|
441
441
|
return 0;
|
|
442
442
|
}
|
|
443
|
-
function
|
|
444
|
-
return
|
|
443
|
+
function m(e, t) {
|
|
444
|
+
return Te(e, t) <= 0;
|
|
445
445
|
}
|
|
446
446
|
function x(e, t, s) {
|
|
447
447
|
if (typeof s == "string") {
|
|
448
|
-
if (e === "web_app_open_link"
|
|
449
|
-
|
|
448
|
+
if (e === "web_app_open_link") {
|
|
449
|
+
if (t === "try_instant_view")
|
|
450
|
+
return m("6.4", s);
|
|
451
|
+
if (t === "try_browser")
|
|
452
|
+
return m("7.6", s);
|
|
453
|
+
}
|
|
450
454
|
if (e === "web_app_set_header_color" && t === "color")
|
|
451
|
-
return
|
|
455
|
+
return m("6.9", s);
|
|
456
|
+
if (e === "web_app_close" && t === "return_back")
|
|
457
|
+
return m("7.6", s);
|
|
452
458
|
}
|
|
453
459
|
switch (e) {
|
|
454
460
|
case "web_app_open_tg_link":
|
|
@@ -457,27 +463,27 @@ function x(e, t, s) {
|
|
|
457
463
|
case "web_app_set_background_color":
|
|
458
464
|
case "web_app_set_header_color":
|
|
459
465
|
case "web_app_trigger_haptic_feedback":
|
|
460
|
-
return
|
|
466
|
+
return m("6.1", t);
|
|
461
467
|
case "web_app_open_popup":
|
|
462
|
-
return
|
|
468
|
+
return m("6.2", t);
|
|
463
469
|
case "web_app_close_scan_qr_popup":
|
|
464
470
|
case "web_app_open_scan_qr_popup":
|
|
465
471
|
case "web_app_read_text_from_clipboard":
|
|
466
|
-
return
|
|
472
|
+
return m("6.4", t);
|
|
467
473
|
case "web_app_switch_inline_query":
|
|
468
|
-
return
|
|
474
|
+
return m("6.7", t);
|
|
469
475
|
case "web_app_invoke_custom_method":
|
|
470
476
|
case "web_app_request_write_access":
|
|
471
477
|
case "web_app_request_phone":
|
|
472
|
-
return
|
|
478
|
+
return m("6.9", t);
|
|
473
479
|
case "web_app_setup_settings_button":
|
|
474
|
-
return
|
|
480
|
+
return m("6.10", t);
|
|
475
481
|
case "web_app_biometry_get_info":
|
|
476
482
|
case "web_app_biometry_open_settings":
|
|
477
483
|
case "web_app_biometry_request_access":
|
|
478
484
|
case "web_app_biometry_request_auth":
|
|
479
485
|
case "web_app_biometry_update_token":
|
|
480
|
-
return
|
|
486
|
+
return m("7.2", t);
|
|
481
487
|
default:
|
|
482
488
|
return [
|
|
483
489
|
"iframe_ready",
|
|
@@ -494,10 +500,10 @@ function x(e, t, s) {
|
|
|
494
500
|
].includes(e);
|
|
495
501
|
}
|
|
496
502
|
}
|
|
497
|
-
function
|
|
503
|
+
function Tt(e) {
|
|
498
504
|
return "external" in e && N(e.external) && "notify" in e.external && typeof e.external.notify == "function";
|
|
499
505
|
}
|
|
500
|
-
function
|
|
506
|
+
function Rt(e) {
|
|
501
507
|
return "TelegramWebviewProxy" in e && N(e.TelegramWebviewProxy) && "postEvent" in e.TelegramWebviewProxy && typeof e.TelegramWebviewProxy.postEvent == "function";
|
|
502
508
|
}
|
|
503
509
|
function nt() {
|
|
@@ -511,39 +517,39 @@ let At = "https://web.telegram.org";
|
|
|
511
517
|
function Fs(e) {
|
|
512
518
|
At = e;
|
|
513
519
|
}
|
|
514
|
-
function
|
|
520
|
+
function Re() {
|
|
515
521
|
return At;
|
|
516
522
|
}
|
|
517
523
|
function q(e, t, s) {
|
|
518
524
|
let n = {}, r;
|
|
519
525
|
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);
|
|
520
|
-
const { targetOrigin: i =
|
|
526
|
+
const { targetOrigin: i = Re() } = n;
|
|
521
527
|
if (pe("Posting event:", r ? { event: e, data: r } : { event: e }), nt()) {
|
|
522
528
|
window.parent.postMessage(JSON.stringify({ eventType: e, eventData: r }), i);
|
|
523
529
|
return;
|
|
524
530
|
}
|
|
525
|
-
if (
|
|
531
|
+
if (Tt(window)) {
|
|
526
532
|
window.external.notify(JSON.stringify({ eventType: e, eventData: r }));
|
|
527
533
|
return;
|
|
528
534
|
}
|
|
529
|
-
if (
|
|
535
|
+
if (Rt(window)) {
|
|
530
536
|
window.TelegramWebviewProxy.postEvent(e, JSON.stringify(r));
|
|
531
537
|
return;
|
|
532
538
|
}
|
|
533
|
-
throw
|
|
534
|
-
|
|
539
|
+
throw b(
|
|
540
|
+
de,
|
|
535
541
|
"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."
|
|
536
542
|
);
|
|
537
543
|
}
|
|
538
544
|
function Ae(e) {
|
|
539
545
|
return (t, s) => {
|
|
540
546
|
if (!x(t, e))
|
|
541
|
-
throw
|
|
547
|
+
throw b(ue, `Method "${t}" is unsupported in Mini Apps version ${e}`);
|
|
542
548
|
if (N(s)) {
|
|
543
549
|
let n;
|
|
544
550
|
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 && !x(t, n, e))
|
|
545
|
-
throw
|
|
546
|
-
|
|
551
|
+
throw b(
|
|
552
|
+
le,
|
|
547
553
|
`Parameter "${n}" of "${t}" method is unsupported in Mini Apps version ${e}`
|
|
548
554
|
);
|
|
549
555
|
}
|
|
@@ -554,7 +560,7 @@ function It(e) {
|
|
|
554
560
|
return ({ req_id: t }) => t === e;
|
|
555
561
|
}
|
|
556
562
|
function kt(e) {
|
|
557
|
-
return
|
|
563
|
+
return b(ge, `Timeout reached: ${e}ms`);
|
|
558
564
|
}
|
|
559
565
|
function qt(e, t) {
|
|
560
566
|
return Promise.race([
|
|
@@ -597,7 +603,7 @@ async function A(e, t, s, n = {}) {
|
|
|
597
603
|
capture: It(s)
|
|
598
604
|
});
|
|
599
605
|
if (i)
|
|
600
|
-
throw
|
|
606
|
+
throw b(_e, i);
|
|
601
607
|
return r;
|
|
602
608
|
}
|
|
603
609
|
function Z(...e) {
|
|
@@ -688,7 +694,7 @@ class ke extends it {
|
|
|
688
694
|
this.isVisible = !0;
|
|
689
695
|
}
|
|
690
696
|
}
|
|
691
|
-
const Dt =
|
|
697
|
+
const Dt = T((e) => e instanceof Date ? e : new Date(P().parse(e) * 1e3), "Date");
|
|
692
698
|
function ot(e, t) {
|
|
693
699
|
return new L((s) => {
|
|
694
700
|
if (typeof s != "string" && !(s instanceof URLSearchParams))
|
|
@@ -783,7 +789,7 @@ function Oe(e) {
|
|
|
783
789
|
function Ne(e) {
|
|
784
790
|
return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);
|
|
785
791
|
}
|
|
786
|
-
const Mt =
|
|
792
|
+
const Mt = T(
|
|
787
793
|
(e) => {
|
|
788
794
|
const t = Ct().optional();
|
|
789
795
|
return Object.entries(et(e)).reduce((s, [n, r]) => (s[Oe(n)] = t.parse(r), s), {});
|
|
@@ -907,7 +913,7 @@ function Le() {
|
|
|
907
913
|
return () => (e += 1).toString();
|
|
908
914
|
}
|
|
909
915
|
const [Ue] = vt(Le);
|
|
910
|
-
function
|
|
916
|
+
function d(e, t) {
|
|
911
917
|
return () => {
|
|
912
918
|
const s = $e(), n = {
|
|
913
919
|
...s,
|
|
@@ -924,8 +930,8 @@ function l(e, t) {
|
|
|
924
930
|
state: Gt() ? Ht(e) : void 0,
|
|
925
931
|
addCleanup: r
|
|
926
932
|
}), h = (u) => (o || r(
|
|
927
|
-
u.on("change", (
|
|
928
|
-
Ut(e,
|
|
933
|
+
u.on("change", (l) => {
|
|
934
|
+
Ut(e, l);
|
|
929
935
|
})
|
|
930
936
|
), u);
|
|
931
937
|
return [
|
|
@@ -934,7 +940,7 @@ function l(e, t) {
|
|
|
934
940
|
];
|
|
935
941
|
};
|
|
936
942
|
}
|
|
937
|
-
const He =
|
|
943
|
+
const He = d("backButton", ({
|
|
938
944
|
postEvent: e,
|
|
939
945
|
version: t,
|
|
940
946
|
state: s = { isVisible: !1 }
|
|
@@ -1081,7 +1087,7 @@ async function je(e) {
|
|
|
1081
1087
|
})
|
|
1082
1088
|
);
|
|
1083
1089
|
}
|
|
1084
|
-
const Ge =
|
|
1090
|
+
const Ge = d(
|
|
1085
1091
|
"biometryManager",
|
|
1086
1092
|
async ({ postEvent: e, version: t, state: s }) => new We({
|
|
1087
1093
|
...s || x("web_app_biometry_get_info", t) ? s || await je({ timeout: 1e3 }) : {
|
|
@@ -1127,7 +1133,7 @@ class Ke extends ct {
|
|
|
1127
1133
|
this.isConfirmationNeeded = !0;
|
|
1128
1134
|
}
|
|
1129
1135
|
}
|
|
1130
|
-
const ze =
|
|
1136
|
+
const ze = d(
|
|
1131
1137
|
"closingBehavior",
|
|
1132
1138
|
({
|
|
1133
1139
|
postEvent: e,
|
|
@@ -1239,7 +1245,7 @@ class Ye extends ht {
|
|
|
1239
1245
|
);
|
|
1240
1246
|
}
|
|
1241
1247
|
}
|
|
1242
|
-
const Ze =
|
|
1248
|
+
const Ze = d(
|
|
1243
1249
|
({ createRequestId: e, postEvent: t, version: s }) => new Ye(s, e, t)
|
|
1244
1250
|
);
|
|
1245
1251
|
class Xe extends ht {
|
|
@@ -1284,7 +1290,7 @@ class Xe extends ht {
|
|
|
1284
1290
|
this.postEvent("web_app_trigger_haptic_feedback", { type: "selection_change" });
|
|
1285
1291
|
}
|
|
1286
1292
|
}
|
|
1287
|
-
const ts =
|
|
1293
|
+
const ts = d(
|
|
1288
1294
|
({ version: e, postEvent: t }) => new Xe(e, t)
|
|
1289
1295
|
);
|
|
1290
1296
|
class es {
|
|
@@ -1360,7 +1366,7 @@ class es {
|
|
|
1360
1366
|
return this.initData.user;
|
|
1361
1367
|
}
|
|
1362
1368
|
}
|
|
1363
|
-
const ss =
|
|
1369
|
+
const ss = d(
|
|
1364
1370
|
({ initData: e }) => e ? new es(e) : void 0
|
|
1365
1371
|
);
|
|
1366
1372
|
function Ys(e) {
|
|
@@ -1410,7 +1416,7 @@ class ns extends D {
|
|
|
1410
1416
|
}
|
|
1411
1417
|
}
|
|
1412
1418
|
}
|
|
1413
|
-
const rs =
|
|
1419
|
+
const rs = d(
|
|
1414
1420
|
({ version: e, postEvent: t }) => new ns(!1, e, t)
|
|
1415
1421
|
);
|
|
1416
1422
|
class is extends rt {
|
|
@@ -1544,7 +1550,7 @@ class is extends rt {
|
|
|
1544
1550
|
return this.get("textColor");
|
|
1545
1551
|
}
|
|
1546
1552
|
}
|
|
1547
|
-
const os =
|
|
1553
|
+
const os = d(
|
|
1548
1554
|
"mainButton",
|
|
1549
1555
|
({
|
|
1550
1556
|
postEvent: e,
|
|
@@ -1778,7 +1784,7 @@ class hs extends D {
|
|
|
1778
1784
|
this.postEvent("web_app_switch_inline_query", { query: t, chat_types: s });
|
|
1779
1785
|
}
|
|
1780
1786
|
}
|
|
1781
|
-
const ps =
|
|
1787
|
+
const ps = d(
|
|
1782
1788
|
"miniApp",
|
|
1783
1789
|
({
|
|
1784
1790
|
themeParams: e,
|
|
@@ -1814,7 +1820,7 @@ function us(e) {
|
|
|
1814
1820
|
return { ...i, id: o };
|
|
1815
1821
|
}) : r = [{ type: "close", id: "" }], { title: s, message: t, buttons: r };
|
|
1816
1822
|
}
|
|
1817
|
-
class
|
|
1823
|
+
class ls extends D {
|
|
1818
1824
|
constructor(t, s, n) {
|
|
1819
1825
|
super({ isOpened: t }, s, { open: "web_app_open_popup" }), this.postEvent = n;
|
|
1820
1826
|
}
|
|
@@ -1855,8 +1861,8 @@ class ds extends D {
|
|
|
1855
1861
|
}
|
|
1856
1862
|
}
|
|
1857
1863
|
}
|
|
1858
|
-
const
|
|
1859
|
-
({ postEvent: e, version: t }) => new
|
|
1864
|
+
const ds = d(
|
|
1865
|
+
({ postEvent: e, version: t }) => new ls(!1, t, e)
|
|
1860
1866
|
);
|
|
1861
1867
|
class _s extends D {
|
|
1862
1868
|
constructor(t, s, n) {
|
|
@@ -1866,7 +1872,7 @@ class _s extends D {
|
|
|
1866
1872
|
}), this.postEvent = n;
|
|
1867
1873
|
}
|
|
1868
1874
|
/**
|
|
1869
|
-
* Closes scanner.
|
|
1875
|
+
* Closes the scanner.
|
|
1870
1876
|
*/
|
|
1871
1877
|
close() {
|
|
1872
1878
|
this.postEvent("web_app_close_scan_qr_popup"), this.isOpened = !1;
|
|
@@ -1875,14 +1881,14 @@ class _s extends D {
|
|
|
1875
1881
|
this.set("isOpened", t);
|
|
1876
1882
|
}
|
|
1877
1883
|
/**
|
|
1878
|
-
* Returns true
|
|
1884
|
+
* Returns true if the scanner is currently opened.
|
|
1879
1885
|
*/
|
|
1880
1886
|
get isOpened() {
|
|
1881
1887
|
return this.get("isOpened");
|
|
1882
1888
|
}
|
|
1883
1889
|
async open(t) {
|
|
1884
1890
|
if (this.isOpened)
|
|
1885
|
-
throw new Error("
|
|
1891
|
+
throw new Error("The scanner is already opened");
|
|
1886
1892
|
const { text: s, capture: n } = (typeof t == "string" ? { text: t } : t) || {};
|
|
1887
1893
|
this.isOpened = !0;
|
|
1888
1894
|
try {
|
|
@@ -1896,12 +1902,13 @@ class _s extends D {
|
|
|
1896
1902
|
}
|
|
1897
1903
|
}) || {}).data || null;
|
|
1898
1904
|
return r && this.close(), r;
|
|
1899
|
-
}
|
|
1900
|
-
|
|
1905
|
+
} finally {
|
|
1906
|
+
this.isOpened = !1;
|
|
1901
1907
|
}
|
|
1902
1908
|
}
|
|
1909
|
+
// TODO: Streaming mode, allowing to scan several QRs until closed.
|
|
1903
1910
|
}
|
|
1904
|
-
const gs =
|
|
1911
|
+
const gs = d(
|
|
1905
1912
|
({ version: e, postEvent: t }) => new _s(!1, e, t)
|
|
1906
1913
|
);
|
|
1907
1914
|
class fs extends it {
|
|
@@ -1933,7 +1940,7 @@ class fs extends it {
|
|
|
1933
1940
|
this.isVisible = !0;
|
|
1934
1941
|
}
|
|
1935
1942
|
}
|
|
1936
|
-
const ws =
|
|
1943
|
+
const ws = d(
|
|
1937
1944
|
"settingsButton",
|
|
1938
1945
|
({
|
|
1939
1946
|
version: e,
|
|
@@ -2003,6 +2010,12 @@ class ms extends ct {
|
|
|
2003
2010
|
get sectionHeaderTextColor() {
|
|
2004
2011
|
return this.get("sectionHeaderTextColor");
|
|
2005
2012
|
}
|
|
2013
|
+
/**
|
|
2014
|
+
* @since v7.6
|
|
2015
|
+
*/
|
|
2016
|
+
get sectionSeparatorColor() {
|
|
2017
|
+
return this.get("sectionHeaderTextColor");
|
|
2018
|
+
}
|
|
2006
2019
|
/**
|
|
2007
2020
|
* Starts listening to the external theme changes and applies them.
|
|
2008
2021
|
* @returns Function to stop listening.
|
|
@@ -2022,7 +2035,7 @@ class ms extends ct {
|
|
|
2022
2035
|
return this.get("textColor");
|
|
2023
2036
|
}
|
|
2024
2037
|
}
|
|
2025
|
-
const bs =
|
|
2038
|
+
const bs = d(
|
|
2026
2039
|
"themeParams",
|
|
2027
2040
|
({ themeParams: e, state: t = e, addCleanup: s }) => {
|
|
2028
2041
|
const n = new ms(t);
|
|
@@ -2112,7 +2125,7 @@ class vs extends ht {
|
|
|
2112
2125
|
);
|
|
2113
2126
|
}
|
|
2114
2127
|
}
|
|
2115
|
-
const ys =
|
|
2128
|
+
const ys = d(
|
|
2116
2129
|
({ version: e, postEvent: t, createRequestId: s }) => new vs(e, s, t)
|
|
2117
2130
|
);
|
|
2118
2131
|
async function Ft(e = {}) {
|
|
@@ -2127,16 +2140,16 @@ async function Ft(e = {}) {
|
|
|
2127
2140
|
});
|
|
2128
2141
|
return { ...n, isExpanded: t, isStateStable: s };
|
|
2129
2142
|
}
|
|
2130
|
-
function
|
|
2143
|
+
function R(e) {
|
|
2131
2144
|
return e < 0 ? 0 : e;
|
|
2132
2145
|
}
|
|
2133
2146
|
class Es extends ct {
|
|
2134
2147
|
constructor({ postEvent: t, stableHeight: s, height: n, width: r, isExpanded: i }) {
|
|
2135
2148
|
super({
|
|
2136
|
-
height:
|
|
2149
|
+
height: R(n),
|
|
2137
2150
|
isExpanded: i,
|
|
2138
|
-
stableHeight:
|
|
2139
|
-
width:
|
|
2151
|
+
stableHeight: R(s),
|
|
2152
|
+
width: R(r)
|
|
2140
2153
|
}), c(this, "postEvent"), this.postEvent = t;
|
|
2141
2154
|
}
|
|
2142
2155
|
/**
|
|
@@ -2198,11 +2211,11 @@ class Es extends ct {
|
|
|
2198
2211
|
width: n,
|
|
2199
2212
|
is_expanded: r,
|
|
2200
2213
|
is_state_stable: i
|
|
2201
|
-
} = t, o =
|
|
2214
|
+
} = t, o = R(s);
|
|
2202
2215
|
this.set({
|
|
2203
2216
|
height: o,
|
|
2204
2217
|
isExpanded: r,
|
|
2205
|
-
width:
|
|
2218
|
+
width: R(n),
|
|
2206
2219
|
...i ? { stableHeight: o } : {}
|
|
2207
2220
|
});
|
|
2208
2221
|
});
|
|
@@ -2237,7 +2250,7 @@ class Es extends ct {
|
|
|
2237
2250
|
return this.stableHeight === this.height;
|
|
2238
2251
|
}
|
|
2239
2252
|
}
|
|
2240
|
-
const Ps =
|
|
2253
|
+
const Ps = d(
|
|
2241
2254
|
"viewport",
|
|
2242
2255
|
async ({ state: e, platform: t, postEvent: s, addCleanup: n }) => {
|
|
2243
2256
|
let r = !1, i = 0, o = 0, a = 0;
|
|
@@ -2322,7 +2335,7 @@ function sn() {
|
|
|
2322
2335
|
return typeof window > "u";
|
|
2323
2336
|
}
|
|
2324
2337
|
async function nn() {
|
|
2325
|
-
if (
|
|
2338
|
+
if (Rt(window))
|
|
2326
2339
|
return !0;
|
|
2327
2340
|
try {
|
|
2328
2341
|
return await w({ method: "web_app_request_theme", event: "theme_changed", timeout: 100 }), !0;
|
|
@@ -2355,7 +2368,7 @@ function rn(e) {
|
|
|
2355
2368
|
};
|
|
2356
2369
|
return;
|
|
2357
2370
|
}
|
|
2358
|
-
if (
|
|
2371
|
+
if (Tt(window)) {
|
|
2359
2372
|
const r = window.external.notify.bind(window.external);
|
|
2360
2373
|
window.external.notify = (i) => {
|
|
2361
2374
|
s(i), r(i);
|
|
@@ -2387,9 +2400,9 @@ function j(e, t) {
|
|
|
2387
2400
|
class Ss {
|
|
2388
2401
|
constructor(t, s, n = q) {
|
|
2389
2402
|
if (c(this, "history"), c(this, "ee", new k()), c(this, "attached", !1), c(this, "back", () => this.go(-1)), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this._index = s, this.postEvent = n, t.length === 0)
|
|
2390
|
-
throw
|
|
2403
|
+
throw b(we, "History should not be empty.");
|
|
2391
2404
|
if (s < 0 || s >= t.length)
|
|
2392
|
-
throw
|
|
2405
|
+
throw b(
|
|
2393
2406
|
me,
|
|
2394
2407
|
"Index should not be zero and higher or equal than history size."
|
|
2395
2408
|
);
|
|
@@ -2544,7 +2557,7 @@ async function I(e) {
|
|
|
2544
2557
|
})
|
|
2545
2558
|
]);
|
|
2546
2559
|
}
|
|
2547
|
-
async function
|
|
2560
|
+
async function Ts() {
|
|
2548
2561
|
if (window.history.length <= 1 || (window.history.pushState(null, ""), await I(1 - window.history.length)))
|
|
2549
2562
|
return;
|
|
2550
2563
|
let e = await I(-1);
|
|
@@ -2735,7 +2748,7 @@ class Yt {
|
|
|
2735
2748
|
async syncHistory() {
|
|
2736
2749
|
window.removeEventListener("popstate", this.onPopState);
|
|
2737
2750
|
const { state: t } = this, s = this.renderPath(this);
|
|
2738
|
-
await
|
|
2751
|
+
await Ts(), this.hasPrev && this.hasNext ? (window.history.replaceState(z, ""), window.history.pushState(t, "", s), window.history.pushState(J, ""), await I(-1)) : this.hasPrev ? (window.history.replaceState(z, ""), window.history.pushState(t, "", s)) : this.hasNext ? (window.history.replaceState(t, s), window.history.pushState(J, ""), await I(-1)) : (window.history.replaceState(mt, ""), window.history.pushState(t, "", s)), window.addEventListener("popstate", this.onPopState);
|
|
2739
2752
|
}
|
|
2740
2753
|
/**
|
|
2741
2754
|
* Current query parameters.
|
|
@@ -2753,7 +2766,7 @@ class Yt {
|
|
|
2753
2766
|
return (this.navigator.current.params || {}).state;
|
|
2754
2767
|
}
|
|
2755
2768
|
}
|
|
2756
|
-
function
|
|
2769
|
+
function Rs(e) {
|
|
2757
2770
|
e || (e = {});
|
|
2758
2771
|
const { href: t, hash: s } = window.location;
|
|
2759
2772
|
let n = B(
|
|
@@ -2762,7 +2775,7 @@ function Ts(e) {
|
|
|
2762
2775
|
const r = e.base ? Qt(e.base) : void 0;
|
|
2763
2776
|
if (r) {
|
|
2764
2777
|
if (!n.startsWith(r))
|
|
2765
|
-
throw
|
|
2778
|
+
throw b(
|
|
2766
2779
|
be,
|
|
2767
2780
|
`Path "${n}" expected to be starting with "${r}"`
|
|
2768
2781
|
);
|
|
@@ -2789,7 +2802,7 @@ function As(e, t) {
|
|
|
2789
2802
|
console.error("Unable to restore hash navigator state.", n);
|
|
2790
2803
|
}
|
|
2791
2804
|
}
|
|
2792
|
-
return
|
|
2805
|
+
return Rs(t);
|
|
2793
2806
|
}
|
|
2794
2807
|
function cn(e, t) {
|
|
2795
2808
|
const s = As(e, t), n = () => sessionStorage.setItem(e, JSON.stringify({
|
|
@@ -2816,21 +2829,21 @@ function g(e) {
|
|
|
2816
2829
|
return Object.defineProperty(n, "error", () => s.error), n;
|
|
2817
2830
|
};
|
|
2818
2831
|
}
|
|
2819
|
-
const ks = g(He), hn = _(ks), qs = g(Ge), pn = _(qs), Os = g(ze), un = _(Os), Ns = g(Ze),
|
|
2832
|
+
const ks = g(He), hn = _(ks), qs = g(Ge), pn = _(qs), Os = g(ze), un = _(Os), Ns = g(Ze), ln = _(Ns), Ds = g(ts), dn = _(Ds), Vs = g(ss), _n = _(Vs), Ms = g(rs), gn = _(Ms), Bs = g(os), fn = _(Bs), $s = g(ps), wn = _($s), Ls = g(ds), mn = _(Ls), Us = g(gs), bn = _(Us), Hs = g(ws), vn = _(Hs), Ws = g(bs), yn = _(Ws), js = g(ys), En = _(js), Gs = g(Ps), Pn = _(Gs), xn = (e) => {
|
|
2820
2833
|
const t = /* @__PURE__ */ new Map(), s = (n, ...r) => {
|
|
2821
2834
|
if (t.has(n))
|
|
2822
2835
|
return t.get(n);
|
|
2823
|
-
function i(
|
|
2824
|
-
return t.set(n,
|
|
2836
|
+
function i(l) {
|
|
2837
|
+
return t.set(n, l), l;
|
|
2825
2838
|
}
|
|
2826
2839
|
let o;
|
|
2827
2840
|
try {
|
|
2828
2841
|
o = n(...r);
|
|
2829
|
-
} catch (
|
|
2842
|
+
} catch (l) {
|
|
2830
2843
|
return i({
|
|
2831
|
-
error:
|
|
2844
|
+
error: l,
|
|
2832
2845
|
signal: () => {
|
|
2833
|
-
throw
|
|
2846
|
+
throw l;
|
|
2834
2847
|
}
|
|
2835
2848
|
});
|
|
2836
2849
|
}
|
|
@@ -2839,11 +2852,11 @@ const ks = g(He), hn = _(ks), qs = g(Ge), pn = _(qs), Os = g(ze), un = _(Os), Ns
|
|
|
2839
2852
|
const [h] = ne(() => o), u = _t(() => {
|
|
2840
2853
|
if (h.state !== "ready")
|
|
2841
2854
|
return;
|
|
2842
|
-
const
|
|
2843
|
-
if (!
|
|
2844
|
-
return
|
|
2845
|
-
const Xt = re((V) => (V(
|
|
2846
|
-
return new Proxy(
|
|
2855
|
+
const l = h();
|
|
2856
|
+
if (!l || !("on" in l))
|
|
2857
|
+
return l;
|
|
2858
|
+
const Xt = re((V) => (V(l), l.on("change", () => V(l)))), te = Object.getPrototypeOf(l), W = {};
|
|
2859
|
+
return new Proxy(l, {
|
|
2847
2860
|
get(V, C) {
|
|
2848
2861
|
if (!(C in W)) {
|
|
2849
2862
|
const pt = Reflect.getOwnPropertyDescriptor(te, C);
|
|
@@ -2865,11 +2878,11 @@ const ks = g(He), hn = _(ks), qs = g(Ge), pn = _(qs), Os = g(ze), un = _(Os), Ns
|
|
|
2865
2878
|
cleanup: a
|
|
2866
2879
|
});
|
|
2867
2880
|
};
|
|
2868
|
-
return
|
|
2881
|
+
return lt(() => {
|
|
2869
2882
|
he(e.debug || !1);
|
|
2870
|
-
}), dt(() => {
|
|
2871
|
-
nt() && lt(xs(e.acceptCustomStyles));
|
|
2872
2883
|
}), lt(() => {
|
|
2884
|
+
nt() && dt(xs(e.acceptCustomStyles));
|
|
2885
|
+
}), dt(() => {
|
|
2873
2886
|
t.forEach((n) => n.cleanup && n.cleanup());
|
|
2874
2887
|
}), bt(Zt.Provider, {
|
|
2875
2888
|
value: s,
|
|
@@ -2887,7 +2900,7 @@ export {
|
|
|
2887
2900
|
Ye as CloudStorage,
|
|
2888
2901
|
be as ERR_INVALID_PATH_BASE,
|
|
2889
2902
|
_e as ERR_INVOKE_CUSTOM_METHOD_RESPONSE,
|
|
2890
|
-
|
|
2903
|
+
le as ERR_METHOD_PARAMETER_UNSUPPORTED,
|
|
2891
2904
|
ue as ERR_METHOD_UNSUPPORTED,
|
|
2892
2905
|
we as ERR_NAVIGATION_HISTORY_EMPTY,
|
|
2893
2906
|
me as ERR_NAVIGATION_INDEX_INVALID,
|
|
@@ -2896,14 +2909,14 @@ export {
|
|
|
2896
2909
|
Js as ERR_SSR_INIT,
|
|
2897
2910
|
ge as ERR_TIMED_OUT,
|
|
2898
2911
|
fe as ERR_UNEXPECTED_TYPE,
|
|
2899
|
-
|
|
2912
|
+
de as ERR_UNKNOWN_ENV,
|
|
2900
2913
|
k as EventEmitter,
|
|
2901
2914
|
Xe as HapticFeedback,
|
|
2902
2915
|
es as InitData,
|
|
2903
2916
|
ns as Invoice,
|
|
2904
2917
|
is as MainButton,
|
|
2905
2918
|
hs as MiniApp,
|
|
2906
|
-
|
|
2919
|
+
ls as Popup,
|
|
2907
2920
|
_s as QRScanner,
|
|
2908
2921
|
$ as SDKError,
|
|
2909
2922
|
xn as SDKProvider,
|
|
@@ -2918,8 +2931,8 @@ export {
|
|
|
2918
2931
|
y as boolean,
|
|
2919
2932
|
It as captureSameReq,
|
|
2920
2933
|
Z as classNames,
|
|
2921
|
-
|
|
2922
|
-
|
|
2934
|
+
Te as compareVersions,
|
|
2935
|
+
Rs as createBrowserNavigatorFromLocation,
|
|
2923
2936
|
Ae as createPostEvent,
|
|
2924
2937
|
M as createSafeURL,
|
|
2925
2938
|
Dt as date,
|
|
@@ -2935,7 +2948,7 @@ export {
|
|
|
2935
2948
|
os as initMainButton,
|
|
2936
2949
|
ps as initMiniApp,
|
|
2937
2950
|
cn as initNavigator,
|
|
2938
|
-
|
|
2951
|
+
ds as initPopup,
|
|
2939
2952
|
gs as initQRScanner,
|
|
2940
2953
|
ws as initSettingsButton,
|
|
2941
2954
|
bs as initThemeParams,
|
|
@@ -2977,7 +2990,7 @@ export {
|
|
|
2977
2990
|
p as string,
|
|
2978
2991
|
ae as subscribe,
|
|
2979
2992
|
x as supports,
|
|
2980
|
-
|
|
2993
|
+
Re as targetOrigin,
|
|
2981
2994
|
xt as toRGB,
|
|
2982
2995
|
yt as unsubscribe,
|
|
2983
2996
|
B as urlToPath,
|
|
@@ -3000,8 +3013,8 @@ export {
|
|
|
3000
3013
|
hn as withBackButton,
|
|
3001
3014
|
pn as withBiometryManager,
|
|
3002
3015
|
un as withClosingBehavior,
|
|
3003
|
-
|
|
3004
|
-
|
|
3016
|
+
ln as withCloudStorage,
|
|
3017
|
+
dn as withHapticFeedback,
|
|
3005
3018
|
_n as withInitData,
|
|
3006
3019
|
gn as withInvoice,
|
|
3007
3020
|
fn as withMainButton,
|