@tma.js/sdk-solid 2.1.7 → 2.1.9
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 +112 -99
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { createComponent as bt, mergeProps as ut, createContext as ee, useContext as se, createEffect as
|
|
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) =>
|
|
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
|
+
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;
|
|
5
5
|
const n = () => {
|
|
@@ -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) {
|
|
@@ -1901,7 +1907,7 @@ class _s extends D {
|
|
|
1901
1907
|
}
|
|
1902
1908
|
}
|
|
1903
1909
|
}
|
|
1904
|
-
const gs =
|
|
1910
|
+
const gs = d(
|
|
1905
1911
|
({ version: e, postEvent: t }) => new _s(!1, e, t)
|
|
1906
1912
|
);
|
|
1907
1913
|
class fs extends it {
|
|
@@ -1933,7 +1939,7 @@ class fs extends it {
|
|
|
1933
1939
|
this.isVisible = !0;
|
|
1934
1940
|
}
|
|
1935
1941
|
}
|
|
1936
|
-
const ws =
|
|
1942
|
+
const ws = d(
|
|
1937
1943
|
"settingsButton",
|
|
1938
1944
|
({
|
|
1939
1945
|
version: e,
|
|
@@ -2003,6 +2009,12 @@ class ms extends ct {
|
|
|
2003
2009
|
get sectionHeaderTextColor() {
|
|
2004
2010
|
return this.get("sectionHeaderTextColor");
|
|
2005
2011
|
}
|
|
2012
|
+
/**
|
|
2013
|
+
* @since v7.6
|
|
2014
|
+
*/
|
|
2015
|
+
get sectionSeparatorColor() {
|
|
2016
|
+
return this.get("sectionHeaderTextColor");
|
|
2017
|
+
}
|
|
2006
2018
|
/**
|
|
2007
2019
|
* Starts listening to the external theme changes and applies them.
|
|
2008
2020
|
* @returns Function to stop listening.
|
|
@@ -2022,7 +2034,7 @@ class ms extends ct {
|
|
|
2022
2034
|
return this.get("textColor");
|
|
2023
2035
|
}
|
|
2024
2036
|
}
|
|
2025
|
-
const bs =
|
|
2037
|
+
const bs = d(
|
|
2026
2038
|
"themeParams",
|
|
2027
2039
|
({ themeParams: e, state: t = e, addCleanup: s }) => {
|
|
2028
2040
|
const n = new ms(t);
|
|
@@ -2104,14 +2116,15 @@ class vs extends ht {
|
|
|
2104
2116
|
* @param url - URL to share.
|
|
2105
2117
|
* @param text - text to append after the URL.
|
|
2106
2118
|
* @see https://core.telegram.org/api/links#share-links
|
|
2119
|
+
* @see https://core.telegram.org/widgets/share#custom-buttons
|
|
2107
2120
|
*/
|
|
2108
2121
|
shareURL(t, s) {
|
|
2109
2122
|
this.openTelegramLink(
|
|
2110
|
-
"https://t.me/share?" + new URLSearchParams({ url: t, text: s || "" }).toString()
|
|
2123
|
+
"https://t.me/share/url?" + new URLSearchParams({ url: t, text: s || "" }).toString()
|
|
2111
2124
|
);
|
|
2112
2125
|
}
|
|
2113
2126
|
}
|
|
2114
|
-
const ys =
|
|
2127
|
+
const ys = d(
|
|
2115
2128
|
({ version: e, postEvent: t, createRequestId: s }) => new vs(e, s, t)
|
|
2116
2129
|
);
|
|
2117
2130
|
async function Ft(e = {}) {
|
|
@@ -2126,16 +2139,16 @@ async function Ft(e = {}) {
|
|
|
2126
2139
|
});
|
|
2127
2140
|
return { ...n, isExpanded: t, isStateStable: s };
|
|
2128
2141
|
}
|
|
2129
|
-
function
|
|
2142
|
+
function R(e) {
|
|
2130
2143
|
return e < 0 ? 0 : e;
|
|
2131
2144
|
}
|
|
2132
2145
|
class Es extends ct {
|
|
2133
2146
|
constructor({ postEvent: t, stableHeight: s, height: n, width: r, isExpanded: i }) {
|
|
2134
2147
|
super({
|
|
2135
|
-
height:
|
|
2148
|
+
height: R(n),
|
|
2136
2149
|
isExpanded: i,
|
|
2137
|
-
stableHeight:
|
|
2138
|
-
width:
|
|
2150
|
+
stableHeight: R(s),
|
|
2151
|
+
width: R(r)
|
|
2139
2152
|
}), c(this, "postEvent"), this.postEvent = t;
|
|
2140
2153
|
}
|
|
2141
2154
|
/**
|
|
@@ -2197,11 +2210,11 @@ class Es extends ct {
|
|
|
2197
2210
|
width: n,
|
|
2198
2211
|
is_expanded: r,
|
|
2199
2212
|
is_state_stable: i
|
|
2200
|
-
} = t, o =
|
|
2213
|
+
} = t, o = R(s);
|
|
2201
2214
|
this.set({
|
|
2202
2215
|
height: o,
|
|
2203
2216
|
isExpanded: r,
|
|
2204
|
-
width:
|
|
2217
|
+
width: R(n),
|
|
2205
2218
|
...i ? { stableHeight: o } : {}
|
|
2206
2219
|
});
|
|
2207
2220
|
});
|
|
@@ -2236,7 +2249,7 @@ class Es extends ct {
|
|
|
2236
2249
|
return this.stableHeight === this.height;
|
|
2237
2250
|
}
|
|
2238
2251
|
}
|
|
2239
|
-
const Ps =
|
|
2252
|
+
const Ps = d(
|
|
2240
2253
|
"viewport",
|
|
2241
2254
|
async ({ state: e, platform: t, postEvent: s, addCleanup: n }) => {
|
|
2242
2255
|
let r = !1, i = 0, o = 0, a = 0;
|
|
@@ -2321,7 +2334,7 @@ function sn() {
|
|
|
2321
2334
|
return typeof window > "u";
|
|
2322
2335
|
}
|
|
2323
2336
|
async function nn() {
|
|
2324
|
-
if (
|
|
2337
|
+
if (Rt(window))
|
|
2325
2338
|
return !0;
|
|
2326
2339
|
try {
|
|
2327
2340
|
return await w({ method: "web_app_request_theme", event: "theme_changed", timeout: 100 }), !0;
|
|
@@ -2354,7 +2367,7 @@ function rn(e) {
|
|
|
2354
2367
|
};
|
|
2355
2368
|
return;
|
|
2356
2369
|
}
|
|
2357
|
-
if (
|
|
2370
|
+
if (Tt(window)) {
|
|
2358
2371
|
const r = window.external.notify.bind(window.external);
|
|
2359
2372
|
window.external.notify = (i) => {
|
|
2360
2373
|
s(i), r(i);
|
|
@@ -2386,9 +2399,9 @@ function j(e, t) {
|
|
|
2386
2399
|
class Ss {
|
|
2387
2400
|
constructor(t, s, n = q) {
|
|
2388
2401
|
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)
|
|
2389
|
-
throw
|
|
2402
|
+
throw b(we, "History should not be empty.");
|
|
2390
2403
|
if (s < 0 || s >= t.length)
|
|
2391
|
-
throw
|
|
2404
|
+
throw b(
|
|
2392
2405
|
me,
|
|
2393
2406
|
"Index should not be zero and higher or equal than history size."
|
|
2394
2407
|
);
|
|
@@ -2543,7 +2556,7 @@ async function I(e) {
|
|
|
2543
2556
|
})
|
|
2544
2557
|
]);
|
|
2545
2558
|
}
|
|
2546
|
-
async function
|
|
2559
|
+
async function Ts() {
|
|
2547
2560
|
if (window.history.length <= 1 || (window.history.pushState(null, ""), await I(1 - window.history.length)))
|
|
2548
2561
|
return;
|
|
2549
2562
|
let e = await I(-1);
|
|
@@ -2734,7 +2747,7 @@ class Yt {
|
|
|
2734
2747
|
async syncHistory() {
|
|
2735
2748
|
window.removeEventListener("popstate", this.onPopState);
|
|
2736
2749
|
const { state: t } = this, s = this.renderPath(this);
|
|
2737
|
-
await
|
|
2750
|
+
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);
|
|
2738
2751
|
}
|
|
2739
2752
|
/**
|
|
2740
2753
|
* Current query parameters.
|
|
@@ -2752,7 +2765,7 @@ class Yt {
|
|
|
2752
2765
|
return (this.navigator.current.params || {}).state;
|
|
2753
2766
|
}
|
|
2754
2767
|
}
|
|
2755
|
-
function
|
|
2768
|
+
function Rs(e) {
|
|
2756
2769
|
e || (e = {});
|
|
2757
2770
|
const { href: t, hash: s } = window.location;
|
|
2758
2771
|
let n = B(
|
|
@@ -2761,7 +2774,7 @@ function Ts(e) {
|
|
|
2761
2774
|
const r = e.base ? Qt(e.base) : void 0;
|
|
2762
2775
|
if (r) {
|
|
2763
2776
|
if (!n.startsWith(r))
|
|
2764
|
-
throw
|
|
2777
|
+
throw b(
|
|
2765
2778
|
be,
|
|
2766
2779
|
`Path "${n}" expected to be starting with "${r}"`
|
|
2767
2780
|
);
|
|
@@ -2788,7 +2801,7 @@ function As(e, t) {
|
|
|
2788
2801
|
console.error("Unable to restore hash navigator state.", n);
|
|
2789
2802
|
}
|
|
2790
2803
|
}
|
|
2791
|
-
return
|
|
2804
|
+
return Rs(t);
|
|
2792
2805
|
}
|
|
2793
2806
|
function cn(e, t) {
|
|
2794
2807
|
const s = As(e, t), n = () => sessionStorage.setItem(e, JSON.stringify({
|
|
@@ -2815,21 +2828,21 @@ function g(e) {
|
|
|
2815
2828
|
return Object.defineProperty(n, "error", () => s.error), n;
|
|
2816
2829
|
};
|
|
2817
2830
|
}
|
|
2818
|
-
const ks = g(He), hn = _(ks), qs = g(Ge), pn = _(qs), Os = g(ze), un = _(Os), Ns = g(Ze),
|
|
2831
|
+
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) => {
|
|
2819
2832
|
const t = /* @__PURE__ */ new Map(), s = (n, ...r) => {
|
|
2820
2833
|
if (t.has(n))
|
|
2821
2834
|
return t.get(n);
|
|
2822
|
-
function i(
|
|
2823
|
-
return t.set(n,
|
|
2835
|
+
function i(l) {
|
|
2836
|
+
return t.set(n, l), l;
|
|
2824
2837
|
}
|
|
2825
2838
|
let o;
|
|
2826
2839
|
try {
|
|
2827
2840
|
o = n(...r);
|
|
2828
|
-
} catch (
|
|
2841
|
+
} catch (l) {
|
|
2829
2842
|
return i({
|
|
2830
|
-
error:
|
|
2843
|
+
error: l,
|
|
2831
2844
|
signal: () => {
|
|
2832
|
-
throw
|
|
2845
|
+
throw l;
|
|
2833
2846
|
}
|
|
2834
2847
|
});
|
|
2835
2848
|
}
|
|
@@ -2838,11 +2851,11 @@ const ks = g(He), hn = _(ks), qs = g(Ge), pn = _(qs), Os = g(ze), un = _(Os), Ns
|
|
|
2838
2851
|
const [h] = ne(() => o), u = _t(() => {
|
|
2839
2852
|
if (h.state !== "ready")
|
|
2840
2853
|
return;
|
|
2841
|
-
const
|
|
2842
|
-
if (!
|
|
2843
|
-
return
|
|
2844
|
-
const Xt = re((V) => (V(
|
|
2845
|
-
return new Proxy(
|
|
2854
|
+
const l = h();
|
|
2855
|
+
if (!l || !("on" in l))
|
|
2856
|
+
return l;
|
|
2857
|
+
const Xt = re((V) => (V(l), l.on("change", () => V(l)))), te = Object.getPrototypeOf(l), W = {};
|
|
2858
|
+
return new Proxy(l, {
|
|
2846
2859
|
get(V, C) {
|
|
2847
2860
|
if (!(C in W)) {
|
|
2848
2861
|
const pt = Reflect.getOwnPropertyDescriptor(te, C);
|
|
@@ -2864,11 +2877,11 @@ const ks = g(He), hn = _(ks), qs = g(Ge), pn = _(qs), Os = g(ze), un = _(Os), Ns
|
|
|
2864
2877
|
cleanup: a
|
|
2865
2878
|
});
|
|
2866
2879
|
};
|
|
2867
|
-
return
|
|
2880
|
+
return lt(() => {
|
|
2868
2881
|
he(e.debug || !1);
|
|
2869
|
-
}), dt(() => {
|
|
2870
|
-
nt() && lt(xs(e.acceptCustomStyles));
|
|
2871
2882
|
}), lt(() => {
|
|
2883
|
+
nt() && dt(xs(e.acceptCustomStyles));
|
|
2884
|
+
}), dt(() => {
|
|
2872
2885
|
t.forEach((n) => n.cleanup && n.cleanup());
|
|
2873
2886
|
}), bt(Zt.Provider, {
|
|
2874
2887
|
value: s,
|
|
@@ -2886,7 +2899,7 @@ export {
|
|
|
2886
2899
|
Ye as CloudStorage,
|
|
2887
2900
|
be as ERR_INVALID_PATH_BASE,
|
|
2888
2901
|
_e as ERR_INVOKE_CUSTOM_METHOD_RESPONSE,
|
|
2889
|
-
|
|
2902
|
+
le as ERR_METHOD_PARAMETER_UNSUPPORTED,
|
|
2890
2903
|
ue as ERR_METHOD_UNSUPPORTED,
|
|
2891
2904
|
we as ERR_NAVIGATION_HISTORY_EMPTY,
|
|
2892
2905
|
me as ERR_NAVIGATION_INDEX_INVALID,
|
|
@@ -2895,14 +2908,14 @@ export {
|
|
|
2895
2908
|
Js as ERR_SSR_INIT,
|
|
2896
2909
|
ge as ERR_TIMED_OUT,
|
|
2897
2910
|
fe as ERR_UNEXPECTED_TYPE,
|
|
2898
|
-
|
|
2911
|
+
de as ERR_UNKNOWN_ENV,
|
|
2899
2912
|
k as EventEmitter,
|
|
2900
2913
|
Xe as HapticFeedback,
|
|
2901
2914
|
es as InitData,
|
|
2902
2915
|
ns as Invoice,
|
|
2903
2916
|
is as MainButton,
|
|
2904
2917
|
hs as MiniApp,
|
|
2905
|
-
|
|
2918
|
+
ls as Popup,
|
|
2906
2919
|
_s as QRScanner,
|
|
2907
2920
|
$ as SDKError,
|
|
2908
2921
|
xn as SDKProvider,
|
|
@@ -2917,8 +2930,8 @@ export {
|
|
|
2917
2930
|
y as boolean,
|
|
2918
2931
|
It as captureSameReq,
|
|
2919
2932
|
Z as classNames,
|
|
2920
|
-
|
|
2921
|
-
|
|
2933
|
+
Te as compareVersions,
|
|
2934
|
+
Rs as createBrowserNavigatorFromLocation,
|
|
2922
2935
|
Ae as createPostEvent,
|
|
2923
2936
|
M as createSafeURL,
|
|
2924
2937
|
Dt as date,
|
|
@@ -2934,7 +2947,7 @@ export {
|
|
|
2934
2947
|
os as initMainButton,
|
|
2935
2948
|
ps as initMiniApp,
|
|
2936
2949
|
cn as initNavigator,
|
|
2937
|
-
|
|
2950
|
+
ds as initPopup,
|
|
2938
2951
|
gs as initQRScanner,
|
|
2939
2952
|
ws as initSettingsButton,
|
|
2940
2953
|
bs as initThemeParams,
|
|
@@ -2976,7 +2989,7 @@ export {
|
|
|
2976
2989
|
p as string,
|
|
2977
2990
|
ae as subscribe,
|
|
2978
2991
|
x as supports,
|
|
2979
|
-
|
|
2992
|
+
Re as targetOrigin,
|
|
2980
2993
|
xt as toRGB,
|
|
2981
2994
|
yt as unsubscribe,
|
|
2982
2995
|
B as urlToPath,
|
|
@@ -2999,8 +3012,8 @@ export {
|
|
|
2999
3012
|
hn as withBackButton,
|
|
3000
3013
|
pn as withBiometryManager,
|
|
3001
3014
|
un as withClosingBehavior,
|
|
3002
|
-
|
|
3003
|
-
|
|
3015
|
+
ln as withCloudStorage,
|
|
3016
|
+
dn as withHapticFeedback,
|
|
3004
3017
|
_n as withInitData,
|
|
3005
3018
|
gn as withInvoice,
|
|
3006
3019
|
fn as withMainButton,
|