@tma.js/sdk 3.0.2 → 3.0.4
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/dts/with-checks/withChecksFp.d.ts +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.iife.js +3 -3
- package/dist/index.iife.js.map +1 -1
- package/dist/index.js +351 -352
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -74,8 +74,8 @@ function c(s, e, r, n, i, o, u, a, p) {
|
|
|
74
74
|
case 9:
|
|
75
75
|
return p(a(u(o(i(n(r(e(s))))))));
|
|
76
76
|
default: {
|
|
77
|
-
for (var l = arguments[0],
|
|
78
|
-
l = arguments[
|
|
77
|
+
for (var l = arguments[0], m = 1; m < arguments.length; m++)
|
|
78
|
+
l = arguments[m](l);
|
|
79
79
|
return l;
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -131,7 +131,7 @@ function Pt(s) {
|
|
|
131
131
|
};
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
|
-
var
|
|
134
|
+
var V = me, I = be, as = /* @__PURE__ */ lt(2, function(s, e) {
|
|
135
135
|
return rt(s) ? s : e(s.right);
|
|
136
136
|
}), Ot = function(s, e) {
|
|
137
137
|
return c(s, D(e));
|
|
@@ -159,7 +159,7 @@ var M = me, I = be, as = /* @__PURE__ */ lt(2, function(s, e) {
|
|
|
159
159
|
chain: as
|
|
160
160
|
}, fs = function(s, e) {
|
|
161
161
|
return function(r) {
|
|
162
|
-
return rt(r) ?
|
|
162
|
+
return rt(r) ? V(s(r.left)) : I(e(r.right));
|
|
163
163
|
};
|
|
164
164
|
}, rt = ns, we = function(s, e) {
|
|
165
165
|
return function(r) {
|
|
@@ -169,14 +169,14 @@ var M = me, I = be, as = /* @__PURE__ */ lt(2, function(s, e) {
|
|
|
169
169
|
try {
|
|
170
170
|
return I(s());
|
|
171
171
|
} catch (r) {
|
|
172
|
-
return
|
|
172
|
+
return V(e(r));
|
|
173
173
|
}
|
|
174
174
|
}, ms = /* @__PURE__ */ cs(Rt), bs = /* @__PURE__ */ Pt(ds), ie = bs;
|
|
175
|
-
function
|
|
175
|
+
function P(s) {
|
|
176
176
|
return typeof s == "function" ? s() : s;
|
|
177
177
|
}
|
|
178
178
|
function z(s, e) {
|
|
179
|
-
return w(() => ot(s,
|
|
179
|
+
return w(() => ot(s, P(e)));
|
|
180
180
|
}
|
|
181
181
|
var it = ss, ht = rs, gs = function(s, e) {
|
|
182
182
|
return c(s, Cs(e));
|
|
@@ -208,7 +208,7 @@ function Is(s) {
|
|
|
208
208
|
return _e(I, s.of);
|
|
209
209
|
}
|
|
210
210
|
function Bs(s) {
|
|
211
|
-
return _e(
|
|
211
|
+
return _e(V, s.of);
|
|
212
212
|
}
|
|
213
213
|
function xs(s) {
|
|
214
214
|
return is(s, us);
|
|
@@ -286,22 +286,22 @@ var Ut = function(s, e) {
|
|
|
286
286
|
});
|
|
287
287
|
}
|
|
288
288
|
return new (r || (r = Promise))(function(o, u) {
|
|
289
|
-
function a(
|
|
289
|
+
function a(m) {
|
|
290
290
|
try {
|
|
291
|
-
l(n.next(
|
|
292
|
-
} catch (
|
|
293
|
-
u(
|
|
291
|
+
l(n.next(m));
|
|
292
|
+
} catch (_) {
|
|
293
|
+
u(_);
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
|
-
function p(
|
|
296
|
+
function p(m) {
|
|
297
297
|
try {
|
|
298
|
-
l(n.throw(
|
|
299
|
-
} catch (
|
|
300
|
-
u(
|
|
298
|
+
l(n.throw(m));
|
|
299
|
+
} catch (_) {
|
|
300
|
+
u(_);
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
|
-
function l(
|
|
304
|
-
|
|
303
|
+
function l(m) {
|
|
304
|
+
m.done ? o(m.value) : i(m.value).then(a, p);
|
|
305
305
|
}
|
|
306
306
|
l((n = n.apply(s, e || [])).next());
|
|
307
307
|
});
|
|
@@ -314,8 +314,8 @@ var Ut = function(s, e) {
|
|
|
314
314
|
return this;
|
|
315
315
|
}), u;
|
|
316
316
|
function a(l) {
|
|
317
|
-
return function(
|
|
318
|
-
return p([l,
|
|
317
|
+
return function(m) {
|
|
318
|
+
return p([l, m]);
|
|
319
319
|
};
|
|
320
320
|
}
|
|
321
321
|
function p(l) {
|
|
@@ -356,15 +356,15 @@ var Ut = function(s, e) {
|
|
|
356
356
|
continue;
|
|
357
357
|
}
|
|
358
358
|
l = e.call(s, r);
|
|
359
|
-
} catch (
|
|
360
|
-
l = [6,
|
|
359
|
+
} catch (m) {
|
|
360
|
+
l = [6, m], i = 0;
|
|
361
361
|
} finally {
|
|
362
362
|
n = o = 0;
|
|
363
363
|
}
|
|
364
364
|
if (l[0] & 5) throw l[1];
|
|
365
365
|
return { value: l[0] ? l[1] : void 0, done: !0 };
|
|
366
366
|
}
|
|
367
|
-
},
|
|
367
|
+
}, $ = /* @__PURE__ */ Bs(Se), q = /* @__PURE__ */ Is(Se), ve = Gt, Gs = /* @__PURE__ */ Ts(Ht), js = function(s, e) {
|
|
368
368
|
return function() {
|
|
369
369
|
return Ds(void 0, void 0, void 0, function() {
|
|
370
370
|
var r;
|
|
@@ -386,10 +386,10 @@ var Ut = function(s, e) {
|
|
|
386
386
|
});
|
|
387
387
|
};
|
|
388
388
|
}, Hs = function(s, e) {
|
|
389
|
-
return c(s,
|
|
389
|
+
return c(s, x(e));
|
|
390
390
|
}, Ws = function(s, e) {
|
|
391
391
|
return c(s, Ks(e));
|
|
392
|
-
},
|
|
392
|
+
}, x = /* @__PURE__ */ xs(Ht), Wt = /* @__PURE__ */ lt(3, Vs(Ht)), Ks = /* @__PURE__ */ qs(Ps), Kt = /* @__PURE__ */ lt(2, Ms(Os)), Qs = q, zs = "TaskEither", Ns = {
|
|
393
393
|
URI: zs,
|
|
394
394
|
map: Hs,
|
|
395
395
|
ap: Ws,
|
|
@@ -460,60 +460,59 @@ class rr extends K(
|
|
|
460
460
|
) {
|
|
461
461
|
}
|
|
462
462
|
function A(s, e) {
|
|
463
|
-
const r = w(() =>
|
|
463
|
+
const r = w(() => P(e.version) || "100"), n = w(() => P(e.isTma)), { requires: i, returns: o } = e, u = i ? typeof i == "object" ? i : { every: [i] } : void 0, a = (f) => {
|
|
464
464
|
if (!e.supports)
|
|
465
465
|
return !0;
|
|
466
|
-
const b = e.supports[
|
|
466
|
+
const b = e.supports[f];
|
|
467
467
|
return ot(b.method, b.param, r());
|
|
468
|
-
},
|
|
469
|
-
if (!
|
|
468
|
+
}, p = () => {
|
|
469
|
+
if (!u)
|
|
470
470
|
return;
|
|
471
|
-
const [
|
|
472
|
-
for (let
|
|
473
|
-
const
|
|
474
|
-
if (
|
|
475
|
-
return
|
|
471
|
+
const [f, b] = "every" in u ? ["every", u.every] : ["some", u.some];
|
|
472
|
+
for (let h = 0; h < b.length; h++) {
|
|
473
|
+
const B = b[h], R = typeof B == "function" ? B() : ot(B, r()) ? void 0 : `it is unsupported in Mini Apps version ${r()}`;
|
|
474
|
+
if (R && (f === "every" || h === b.length - 1))
|
|
475
|
+
return R;
|
|
476
476
|
}
|
|
477
|
-
},
|
|
477
|
+
}, l = (...f) => {
|
|
478
478
|
for (const b in e.supports)
|
|
479
|
-
if (e.supports[b].shouldCheck(...
|
|
479
|
+
if (e.supports[b].shouldCheck(...f) && !a(b))
|
|
480
480
|
return `option ${b} is not supported in Mini Apps version ${r()}`;
|
|
481
|
-
},
|
|
482
|
-
() => n() && _() &&
|
|
483
|
-
),
|
|
484
|
-
const b = new Xs(
|
|
485
|
-
return ["task", "promise"].includes(e.returns) ?
|
|
486
|
-
};
|
|
481
|
+
}, m = w(() => !p()), _ = w(() => r() !== "0.0"), g = w(() => e.isMounted ? e.isMounted() : !0), C = w(
|
|
482
|
+
() => n() && _() && m() && g()
|
|
483
|
+
), y = (f) => {
|
|
484
|
+
const b = new Xs(f);
|
|
485
|
+
return ["task", "promise"].includes(e.returns) ? $(b) : V(b);
|
|
486
|
+
}, S = (...f) => o === "plain" ? _s(() => s(...f), (b) => b) : o === "promise" ? js(() => s(...f), (b) => b) : s(...f);
|
|
487
487
|
return Object.assign(
|
|
488
|
-
(...
|
|
489
|
-
var
|
|
488
|
+
(...f) => {
|
|
489
|
+
var R;
|
|
490
490
|
const b = "Unable to call function:";
|
|
491
491
|
if (!n())
|
|
492
|
-
return
|
|
492
|
+
return y(`${b} it can't be called outside Mini Apps`);
|
|
493
493
|
if (!_())
|
|
494
|
-
return
|
|
495
|
-
const
|
|
496
|
-
if (
|
|
497
|
-
return
|
|
498
|
-
const
|
|
499
|
-
if (
|
|
500
|
-
return
|
|
501
|
-
if (!
|
|
502
|
-
const
|
|
503
|
-
return
|
|
494
|
+
return y(`${b} the SDK was not initialized. Use the SDK init() function`);
|
|
495
|
+
const h = p();
|
|
496
|
+
if (h)
|
|
497
|
+
return y(`${b} ${h}`);
|
|
498
|
+
const B = l(...f);
|
|
499
|
+
if (B)
|
|
500
|
+
return y(`${b} ${B}`);
|
|
501
|
+
if (!g()) {
|
|
502
|
+
const T = (R = e.isMounting) != null && R.call(e) ? "mounting. Wait for the mount completion" : "unmounted. Use the mount() method";
|
|
503
|
+
return y(`${b} the component is ${T}`);
|
|
504
504
|
}
|
|
505
|
-
|
|
506
|
-
return h === "plain" ? _s(() => s(...F), (L) => L) : h === "promise" ? js(() => s(...F), (L) => L) : s(...F);
|
|
505
|
+
return S(...f);
|
|
507
506
|
},
|
|
508
507
|
s,
|
|
509
508
|
{
|
|
510
|
-
isAvailable:
|
|
511
|
-
ifAvailable(...
|
|
512
|
-
return
|
|
509
|
+
isAvailable: C,
|
|
510
|
+
ifAvailable(...f) {
|
|
511
|
+
return C() ? ht(S(...f)) : it;
|
|
513
512
|
}
|
|
514
513
|
},
|
|
515
|
-
|
|
516
|
-
e.supports ? { supports:
|
|
514
|
+
u ? { isSupported: m } : {},
|
|
515
|
+
e.supports ? { supports: a } : {}
|
|
517
516
|
);
|
|
518
517
|
}
|
|
519
518
|
function E(s) {
|
|
@@ -603,7 +602,7 @@ class dt {
|
|
|
603
602
|
this.mount = () => {
|
|
604
603
|
if (this.isMounted())
|
|
605
604
|
return I(void 0);
|
|
606
|
-
const u =
|
|
605
|
+
const u = P(o) ? r() : void 0, a = u ? I(u) : typeof n == "function" ? n() : I(n);
|
|
607
606
|
return c(a, D((p) => {
|
|
608
607
|
Ct(() => {
|
|
609
608
|
this._isMounted.set(!0), e == null || e(p);
|
|
@@ -627,7 +626,7 @@ class kt {
|
|
|
627
626
|
postEvent: a,
|
|
628
627
|
payload: p,
|
|
629
628
|
method: l,
|
|
630
|
-
version:
|
|
629
|
+
version: m
|
|
631
630
|
}) {
|
|
632
631
|
/**
|
|
633
632
|
* Signal indicating if the component is currently mounted.
|
|
@@ -708,44 +707,44 @@ class kt {
|
|
|
708
707
|
* @see onClick
|
|
709
708
|
*/
|
|
710
709
|
t(this, "unmount");
|
|
711
|
-
const
|
|
710
|
+
const _ = new tt({
|
|
712
711
|
initialState: o,
|
|
713
|
-
onChange(
|
|
714
|
-
r.set(
|
|
712
|
+
onChange(f) {
|
|
713
|
+
r.set(f);
|
|
715
714
|
}
|
|
716
715
|
}), g = new dt({
|
|
717
716
|
initialState: o,
|
|
718
717
|
isPageReload: u,
|
|
719
|
-
onMounted:
|
|
718
|
+
onMounted: _.setState,
|
|
720
719
|
restoreState: r.get
|
|
721
|
-
}), C = { version:
|
|
720
|
+
}), C = { version: m, requires: l, isTma: e }, y = E({
|
|
722
721
|
...C,
|
|
723
722
|
returns: "plain"
|
|
724
|
-
}),
|
|
723
|
+
}), S = E({
|
|
725
724
|
...C,
|
|
726
725
|
returns: "either",
|
|
727
726
|
isMounted: g.isMounted
|
|
728
727
|
});
|
|
729
|
-
this.isMounted = g.isMounted, this.isSupported = z(l,
|
|
730
|
-
const
|
|
731
|
-
return
|
|
732
|
-
a(l, p(
|
|
728
|
+
this.isMounted = g.isMounted, this.isSupported = z(l, m), this.state = _.state, this.setStateFp = S((f) => {
|
|
729
|
+
const b = { ...this.state(), ...Mt(f) };
|
|
730
|
+
return _.hasDiff(b) ? c(
|
|
731
|
+
a(l, p(b)),
|
|
733
732
|
D(() => {
|
|
734
|
-
|
|
733
|
+
_.setState(b);
|
|
735
734
|
})
|
|
736
735
|
) : I(void 0);
|
|
737
|
-
}), this.setState = d(this.setStateFp), this.onClickFp =
|
|
738
|
-
const
|
|
736
|
+
}), this.setState = d(this.setStateFp), this.onClickFp = y(n), this.onClick = d(this.onClickFp), this.offClickFp = y(i), this.offClick = d(this.offClickFp), this.mountFp = y(() => {
|
|
737
|
+
const f = () => {
|
|
739
738
|
};
|
|
740
|
-
return c(g.mount(), pt(
|
|
741
|
-
}), this.mount = d(this.mountFp), this.unmount = g.unmount, this.stateSetters = (
|
|
742
|
-
const
|
|
743
|
-
return [d(
|
|
744
|
-
}, this.stateBoolSetters = (
|
|
745
|
-
const [,
|
|
739
|
+
return c(g.mount(), pt(f, f));
|
|
740
|
+
}), this.mount = d(this.mountFp), this.unmount = g.unmount, this.stateSetters = (f) => {
|
|
741
|
+
const b = S((h) => this.setStateFp({ [f]: h }));
|
|
742
|
+
return [d(b), b];
|
|
743
|
+
}, this.stateBoolSetters = (f) => {
|
|
744
|
+
const [, b] = this.stateSetters(f), h = S(() => b(!1)), B = S(() => b(!0));
|
|
746
745
|
return [
|
|
747
746
|
[d(h), h],
|
|
748
|
-
[d(
|
|
747
|
+
[d(B), B]
|
|
749
748
|
];
|
|
750
749
|
};
|
|
751
750
|
}
|
|
@@ -849,7 +848,7 @@ class nr {
|
|
|
849
848
|
this.isVisible = r.stateGetter("isVisible"), this.isMounted = r.isMounted, this.isSupported = r.isSupported, [[this.hide, this.hideFp], [this.show, this.showFp]] = r.stateBoolSetters("isVisible"), this.onClick = r.onClick, this.onClickFp = r.onClickFp, this.offClick = r.offClick, this.offClickFp = r.offClickFp, this.mount = r.mount, this.mountFp = r.mountFp, this.unmount = r.unmount;
|
|
850
849
|
}
|
|
851
850
|
}
|
|
852
|
-
function
|
|
851
|
+
function F() {
|
|
853
852
|
return { isTma: w(() => Re()) };
|
|
854
853
|
}
|
|
855
854
|
function or(s) {
|
|
@@ -868,7 +867,7 @@ function ar() {
|
|
|
868
867
|
return !!s && s.type === "reload";
|
|
869
868
|
}
|
|
870
869
|
function ft(s) {
|
|
871
|
-
return (e) => ({ ...e, ...
|
|
870
|
+
return (e) => ({ ...e, ...P(s) });
|
|
872
871
|
}
|
|
873
872
|
function et(s) {
|
|
874
873
|
return ft({
|
|
@@ -880,15 +879,15 @@ function et(s) {
|
|
|
880
879
|
function _t(s, e) {
|
|
881
880
|
return j(s, e);
|
|
882
881
|
}
|
|
883
|
-
const ke = /* @__PURE__ */ _t(Pe), mt = (...s) => ke()(...s), ur = (...s) => ce(mt(...s)),
|
|
882
|
+
const ke = /* @__PURE__ */ _t(Pe), mt = (...s) => ke()(...s), ur = (...s) => ce(mt(...s)), L = ft({
|
|
884
883
|
postEvent: mt
|
|
885
|
-
}), Vt = /* @__PURE__ */ _t("0.0"),
|
|
884
|
+
}), Vt = /* @__PURE__ */ _t("0.0"), v = ft({ version: Vt });
|
|
886
885
|
function Nt(s, e) {
|
|
887
886
|
return {
|
|
888
887
|
...c(
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
888
|
+
F(),
|
|
889
|
+
L,
|
|
890
|
+
v,
|
|
892
891
|
et(s)
|
|
893
892
|
),
|
|
894
893
|
onClick(r, n) {
|
|
@@ -924,11 +923,11 @@ class Jt {
|
|
|
924
923
|
t(this, "unmount");
|
|
925
924
|
this.mount = (u) => {
|
|
926
925
|
if (this._isMounted())
|
|
927
|
-
return
|
|
928
|
-
const a =
|
|
926
|
+
return q(void 0);
|
|
927
|
+
const a = P(o) ? n() : void 0;
|
|
929
928
|
return c(
|
|
930
|
-
a ?
|
|
931
|
-
|
|
929
|
+
a ? q(a) : e(u),
|
|
930
|
+
x((p) => {
|
|
932
931
|
this._isMounted() || Ct(() => {
|
|
933
932
|
this._isMounted.set(!0), r == null || r(p);
|
|
934
933
|
});
|
|
@@ -1044,9 +1043,9 @@ class cr {
|
|
|
1044
1043
|
* Unmounts the component.
|
|
1045
1044
|
*/
|
|
1046
1045
|
t(this, "unmount");
|
|
1047
|
-
const l = (
|
|
1048
|
-
|
|
1049
|
-
},
|
|
1046
|
+
const l = (f) => {
|
|
1047
|
+
m.setState(It(f));
|
|
1048
|
+
}, m = new tt({
|
|
1050
1049
|
initialState: {
|
|
1051
1050
|
available: !1,
|
|
1052
1051
|
type: "unknown",
|
|
@@ -1056,16 +1055,16 @@ class cr {
|
|
|
1056
1055
|
tokenSaved: !1
|
|
1057
1056
|
},
|
|
1058
1057
|
onChange: i.set
|
|
1059
|
-
}),
|
|
1060
|
-
initialState(
|
|
1058
|
+
}), _ = new Jt({
|
|
1059
|
+
initialState(f) {
|
|
1061
1060
|
return c(
|
|
1062
|
-
r("web_app_biometry_get_info", "biometry_info_received",
|
|
1063
|
-
|
|
1061
|
+
r("web_app_biometry_get_info", "biometry_info_received", f),
|
|
1062
|
+
x(It)
|
|
1064
1063
|
);
|
|
1065
1064
|
},
|
|
1066
1065
|
isPageReload: p,
|
|
1067
|
-
onMounted(
|
|
1068
|
-
|
|
1066
|
+
onMounted(f) {
|
|
1067
|
+
m.setState(f), o(l);
|
|
1069
1068
|
},
|
|
1070
1069
|
onUnmounted() {
|
|
1071
1070
|
u(l);
|
|
@@ -1074,37 +1073,37 @@ class cr {
|
|
|
1074
1073
|
}), g = { version: e, requires: "web_app_biometry_request_auth", isTma: a }, C = E({
|
|
1075
1074
|
...g,
|
|
1076
1075
|
returns: "either"
|
|
1077
|
-
}),
|
|
1076
|
+
}), y = E({
|
|
1078
1077
|
...g,
|
|
1079
1078
|
returns: "task"
|
|
1080
|
-
}),
|
|
1079
|
+
}), S = E({
|
|
1081
1080
|
...g,
|
|
1082
|
-
isMounted:
|
|
1081
|
+
isMounted: _.isMounted,
|
|
1083
1082
|
returns: "task"
|
|
1084
1083
|
});
|
|
1085
|
-
this.isAvailable =
|
|
1084
|
+
this.isAvailable = m.getter("available"), this.isMounted = _.isMounted, this.isSupported = z("web_app_biometry_request_auth", e), this.state = m.state, this.unmount = _.unmount, this.mountFp = y(_.mount), this.authenticateFp = S((f) => this.isAvailable() ? c(
|
|
1086
1085
|
r("web_app_biometry_request_auth", "biometry_auth_requested", {
|
|
1087
|
-
...
|
|
1088
|
-
params: { reason: ((
|
|
1086
|
+
...f,
|
|
1087
|
+
params: { reason: ((f || {}).reason || "").trim() }
|
|
1089
1088
|
}),
|
|
1090
|
-
|
|
1091
|
-
) :
|
|
1089
|
+
x((b) => (m.setState({ token: b.token }), b))
|
|
1090
|
+
) : $(ue)), this.openSettingsFp = C(() => n("web_app_biometry_open_settings")), this.requestAccessFp = S((f) => c(
|
|
1092
1091
|
r("web_app_biometry_request_access", "biometry_info_received", {
|
|
1093
|
-
...
|
|
1094
|
-
params: { reason: ((
|
|
1092
|
+
...f,
|
|
1093
|
+
params: { reason: ((f || {}).reason || "").trim() }
|
|
1095
1094
|
}),
|
|
1096
|
-
Z((
|
|
1097
|
-
const h = It(
|
|
1098
|
-
return h.available ? (
|
|
1095
|
+
Z((b) => {
|
|
1096
|
+
const h = It(b);
|
|
1097
|
+
return h.available ? (m.setState(h), q(h.accessRequested)) : $(ue);
|
|
1099
1098
|
})
|
|
1100
|
-
)), this.updateTokenFp =
|
|
1101
|
-
var
|
|
1099
|
+
)), this.updateTokenFp = S((f = {}) => {
|
|
1100
|
+
var b;
|
|
1102
1101
|
return c(
|
|
1103
1102
|
r("web_app_biometry_update_token", "biometry_token_updated", {
|
|
1104
|
-
...
|
|
1105
|
-
params: { token:
|
|
1103
|
+
...f,
|
|
1104
|
+
params: { token: f.token || "", reason: (b = f.reason) == null ? void 0 : b.trim() }
|
|
1106
1105
|
}),
|
|
1107
|
-
|
|
1106
|
+
x((h) => h.status)
|
|
1108
1107
|
);
|
|
1109
1108
|
}), this.authenticate = d(this.authenticateFp), this.openSettings = d(this.openSettingsFp), this.requestAccess = d(this.requestAccessFp), this.updateToken = d(this.updateTokenFp), this.mount = d(this.mountFp);
|
|
1110
1109
|
}
|
|
@@ -1116,9 +1115,9 @@ const Ee = (s, e, r) => Oe(s, e, {
|
|
|
1116
1115
|
request: Ee
|
|
1117
1116
|
}), En = new cr({
|
|
1118
1117
|
...c(
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1118
|
+
F(),
|
|
1119
|
+
L,
|
|
1120
|
+
v,
|
|
1122
1121
|
U,
|
|
1123
1122
|
et("biometry")
|
|
1124
1123
|
),
|
|
@@ -1169,8 +1168,8 @@ class lr {
|
|
|
1169
1168
|
t(this, "enableConfirmation");
|
|
1170
1169
|
const o = new tt({
|
|
1171
1170
|
initialState: { isConfirmationEnabled: !1 },
|
|
1172
|
-
onChange(
|
|
1173
|
-
r.set(
|
|
1171
|
+
onChange(_) {
|
|
1172
|
+
r.set(_);
|
|
1174
1173
|
}
|
|
1175
1174
|
}), u = new dt({
|
|
1176
1175
|
onMounted: o.setState,
|
|
@@ -1184,20 +1183,20 @@ class lr {
|
|
|
1184
1183
|
...a,
|
|
1185
1184
|
returns: "either",
|
|
1186
1185
|
isMounted: u.isMounted
|
|
1187
|
-
}),
|
|
1188
|
-
need_confirmation:
|
|
1186
|
+
}), m = (_) => _ === this.isConfirmationEnabled() ? I(void 0) : (o.setState({ isConfirmationEnabled: _ }), e("web_app_setup_closing_behavior", {
|
|
1187
|
+
need_confirmation: _
|
|
1189
1188
|
}));
|
|
1190
|
-
this.isConfirmationEnabled = o.getter("isConfirmationEnabled"), this.isMounted = u.isMounted, this.disableConfirmationFp = l(() =>
|
|
1191
|
-
const
|
|
1189
|
+
this.isConfirmationEnabled = o.getter("isConfirmationEnabled"), this.isMounted = u.isMounted, this.disableConfirmationFp = l(() => m(!1)), this.enableConfirmationFp = l(() => m(!0)), this.mountFp = p(() => {
|
|
1190
|
+
const _ = () => {
|
|
1192
1191
|
};
|
|
1193
|
-
return c(u.mount(), pt(
|
|
1192
|
+
return c(u.mount(), pt(_, _));
|
|
1194
1193
|
}), this.unmount = u.unmount, this.disableConfirmation = d(this.disableConfirmationFp), this.enableConfirmation = d(this.enableConfirmationFp), this.mount = d(this.mountFp);
|
|
1195
1194
|
}
|
|
1196
1195
|
}
|
|
1197
1196
|
const An = new lr(c(
|
|
1198
|
-
|
|
1197
|
+
F(),
|
|
1199
1198
|
et("closingBehavior"),
|
|
1200
|
-
|
|
1199
|
+
L
|
|
1201
1200
|
));
|
|
1202
1201
|
class pr {
|
|
1203
1202
|
constructor({ version: e, isTma: r, invokeCustomMethod: n }) {
|
|
@@ -1279,26 +1278,26 @@ class pr {
|
|
|
1279
1278
|
this.isSupported = z("web_app_invoke_custom_method", e), this.deleteItemFp = i((o, u) => {
|
|
1280
1279
|
const a = Array.isArray(o) ? o : [o];
|
|
1281
1280
|
return c(
|
|
1282
|
-
a.length ? n("deleteStorageValues", { keys: a }, u) :
|
|
1283
|
-
|
|
1281
|
+
a.length ? n("deleteStorageValues", { keys: a }, u) : q(void 0),
|
|
1282
|
+
x(() => {
|
|
1284
1283
|
})
|
|
1285
1284
|
);
|
|
1286
1285
|
}), this.getItemFp = i((o, u) => c(
|
|
1287
1286
|
this.getItemsFp([o], u),
|
|
1288
|
-
|
|
1287
|
+
x((a) => a[o] || "")
|
|
1289
1288
|
)), this.getItemsFp = i((o, u) => c(
|
|
1290
|
-
o.length ? n("getStorageValues", { keys: o }, u) :
|
|
1291
|
-
|
|
1289
|
+
o.length ? n("getStorageValues", { keys: o }, u) : q({}),
|
|
1290
|
+
x((a) => ({
|
|
1292
1291
|
// Fulfill the response with probably missing keys.
|
|
1293
1292
|
...o.reduce((p, l) => (p[l] = "", p), {}),
|
|
1294
1293
|
...ne(Ye(J(), J()), a)
|
|
1295
1294
|
}))
|
|
1296
1295
|
)), this.getKeysFp = i((o) => c(
|
|
1297
1296
|
n("getStorageKeys", {}, o),
|
|
1298
|
-
|
|
1297
|
+
x((u) => ne(Ze(J()), u))
|
|
1299
1298
|
)), this.setItemFp = i((o, u, a) => c(
|
|
1300
1299
|
n("saveStorageValue", { key: o, value: u }, a),
|
|
1301
|
-
|
|
1300
|
+
x(() => {
|
|
1302
1301
|
})
|
|
1303
1302
|
)), this.clearFp = i((o) => c(this.getKeysFp(o), Z(this.deleteItemFp))), this.deleteItem = d(this.deleteItemFp), this.getItem = d(this.getItemFp), this.getItems = d(this.getItemsFp), this.getKeys = d(this.getKeysFp), this.setItem = d(this.setItemFp), this.clear = d(this.clearFp);
|
|
1304
1303
|
}
|
|
@@ -1316,19 +1315,19 @@ function hr(s, e, r) {
|
|
|
1316
1315
|
const Yt = ft({
|
|
1317
1316
|
invokeCustomMethod: hr
|
|
1318
1317
|
}), In = new pr(c(
|
|
1319
|
-
|
|
1320
|
-
|
|
1318
|
+
F(),
|
|
1319
|
+
v,
|
|
1321
1320
|
Yt
|
|
1322
1321
|
));
|
|
1323
1322
|
function dr({ request: s, ...e }) {
|
|
1324
1323
|
return A((r) => c(
|
|
1325
1324
|
s("web_app_request_emoji_status_access", "emoji_status_access_requested", r),
|
|
1326
|
-
|
|
1325
|
+
x((n) => n.status)
|
|
1327
1326
|
), { ...e, requires: "web_app_request_emoji_status_access", returns: "task" });
|
|
1328
1327
|
}
|
|
1329
1328
|
const fr = dr(c(
|
|
1330
|
-
|
|
1331
|
-
|
|
1329
|
+
F(),
|
|
1330
|
+
v,
|
|
1332
1331
|
U
|
|
1333
1332
|
)), Bn = d(fr);
|
|
1334
1333
|
function _r({ request: s, ...e }) {
|
|
@@ -1340,7 +1339,7 @@ function _r({ request: s, ...e }) {
|
|
|
1340
1339
|
},
|
|
1341
1340
|
...n
|
|
1342
1341
|
}),
|
|
1343
|
-
at((i) => i && "error" in i ?
|
|
1342
|
+
at((i) => i && "error" in i ? $(new tr(i.error)) : q(void 0))
|
|
1344
1343
|
), {
|
|
1345
1344
|
...e,
|
|
1346
1345
|
requires: "web_app_set_emoji_status",
|
|
@@ -1348,9 +1347,9 @@ function _r({ request: s, ...e }) {
|
|
|
1348
1347
|
});
|
|
1349
1348
|
}
|
|
1350
1349
|
const mr = _r(c(
|
|
1351
|
-
|
|
1350
|
+
F(),
|
|
1352
1351
|
U,
|
|
1353
|
-
|
|
1352
|
+
v
|
|
1354
1353
|
)), xn = d(mr);
|
|
1355
1354
|
class br {
|
|
1356
1355
|
constructor({ postEvent: e, isTma: r, version: n }) {
|
|
@@ -1404,27 +1403,27 @@ class br {
|
|
|
1404
1403
|
}
|
|
1405
1404
|
}
|
|
1406
1405
|
const qn = new br(c(
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1406
|
+
F(),
|
|
1407
|
+
L,
|
|
1408
|
+
v
|
|
1410
1409
|
));
|
|
1411
1410
|
function gr({ postEvent: s, ...e }) {
|
|
1412
1411
|
return A(() => s("web_app_add_to_home_screen"), { ...e, requires: "web_app_add_to_home_screen", returns: "either" });
|
|
1413
1412
|
}
|
|
1414
1413
|
const wr = gr(c(
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1414
|
+
F(),
|
|
1415
|
+
v,
|
|
1416
|
+
L
|
|
1418
1417
|
)), Mn = d(wr);
|
|
1419
1418
|
function Fr({ request: s, ...e }) {
|
|
1420
1419
|
return A((r) => c(
|
|
1421
1420
|
s("web_app_check_home_screen", "home_screen_checked", r),
|
|
1422
|
-
|
|
1421
|
+
x((n) => n.status || "unknown")
|
|
1423
1422
|
), { ...e, requires: "web_app_check_home_screen", returns: "task" });
|
|
1424
1423
|
}
|
|
1425
1424
|
const Cr = Fr(c(
|
|
1426
|
-
|
|
1427
|
-
|
|
1425
|
+
F(),
|
|
1426
|
+
v,
|
|
1428
1427
|
U
|
|
1429
1428
|
)), Vn = d(Cr);
|
|
1430
1429
|
class Sr {
|
|
@@ -1576,7 +1575,7 @@ class vr {
|
|
|
1576
1575
|
o.set(!1);
|
|
1577
1576
|
};
|
|
1578
1577
|
this.isSupported = z("web_app_open_invoice", e), this.isOpened = w(o), this.openSlugFp = i((a, p) => c(
|
|
1579
|
-
this.isOpened() ?
|
|
1578
|
+
this.isOpened() ? $(new zt("Invoice is already opened")) : q(void 0),
|
|
1580
1579
|
Z(() => (o.set(!0), r("web_app_open_invoice", "invoice_closed", {
|
|
1581
1580
|
...p,
|
|
1582
1581
|
params: { slug: a },
|
|
@@ -1584,24 +1583,24 @@ class vr {
|
|
|
1584
1583
|
}))),
|
|
1585
1584
|
Wt((l) => (u(), l), (l) => (u(), l.status))
|
|
1586
1585
|
)), this.openUrlFp = i((a, p) => {
|
|
1587
|
-
const { hostname: l, pathname:
|
|
1586
|
+
const { hostname: l, pathname: m } = new URL(a, window.location.href);
|
|
1588
1587
|
if (l !== "t.me")
|
|
1589
|
-
return
|
|
1590
|
-
const
|
|
1591
|
-
return
|
|
1588
|
+
return $(new Q(`Link has unexpected hostname: ${l}`));
|
|
1589
|
+
const _ = m.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/);
|
|
1590
|
+
return _ ? this.openSlugFp(_[2], p) : $(new Q(
|
|
1592
1591
|
'Expected to receive a link with a pathname in format "/invoice/{slug}" or "/${slug}"'
|
|
1593
1592
|
));
|
|
1594
1593
|
}), this.openUrl = d(this.openUrlFp), this.openSlug = d(this.openSlugFp);
|
|
1595
1594
|
}
|
|
1596
1595
|
}
|
|
1597
|
-
const $n = new vr(c(
|
|
1596
|
+
const $n = new vr(c(F(), U, v));
|
|
1598
1597
|
function yr({ postEvent: s, ...e }) {
|
|
1599
1598
|
return A((r, n = {}) => {
|
|
1600
1599
|
if (typeof r == "string")
|
|
1601
1600
|
try {
|
|
1602
1601
|
r = new URL(r);
|
|
1603
1602
|
} catch (i) {
|
|
1604
|
-
return
|
|
1603
|
+
return V(new Q(`"${r.toString()}" is invalid URL`, i));
|
|
1605
1604
|
}
|
|
1606
1605
|
return s("web_app_open_link", {
|
|
1607
1606
|
url: r.toString(),
|
|
@@ -1611,19 +1610,19 @@ function yr({ postEvent: s, ...e }) {
|
|
|
1611
1610
|
}, { ...e, returns: "either" });
|
|
1612
1611
|
}
|
|
1613
1612
|
const kr = yr(c(
|
|
1614
|
-
|
|
1615
|
-
|
|
1613
|
+
F(),
|
|
1614
|
+
L
|
|
1616
1615
|
)), Ln = d(kr);
|
|
1617
1616
|
function Er({ postEvent: s, version: e, ...r }) {
|
|
1618
1617
|
return A((n) => {
|
|
1619
1618
|
const i = n.toString();
|
|
1620
|
-
return i.match(/^https:\/\/t.me\/.+/) ? ot("web_app_open_tg_link",
|
|
1619
|
+
return i.match(/^https:\/\/t.me\/.+/) ? ot("web_app_open_tg_link", P(e)) ? (n = new URL(n), s("web_app_open_tg_link", { path_full: n.pathname + n.search })) : (window.location.href = i, I(void 0)) : V(new Q(`"${i}" is invalid URL`));
|
|
1621
1620
|
}, { ...r, returns: "either" });
|
|
1622
1621
|
}
|
|
1623
1622
|
const Ie = Er(c(
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1623
|
+
F(),
|
|
1624
|
+
L,
|
|
1625
|
+
v
|
|
1627
1626
|
)), Rn = d(Ie);
|
|
1628
1627
|
function Ar({ openTelegramLink: s, ...e }) {
|
|
1629
1628
|
return A((r, n) => s(
|
|
@@ -1631,7 +1630,7 @@ function Ar({ openTelegramLink: s, ...e }) {
|
|
|
1631
1630
|
), { ...e, returns: "either" });
|
|
1632
1631
|
}
|
|
1633
1632
|
const Ir = Ar({
|
|
1634
|
-
...
|
|
1633
|
+
...F(),
|
|
1635
1634
|
openTelegramLink: Ie
|
|
1636
1635
|
}), Pn = d(Ir);
|
|
1637
1636
|
function Br(s) {
|
|
@@ -1725,13 +1724,13 @@ class xr {
|
|
|
1725
1724
|
initialState(C) {
|
|
1726
1725
|
return c(
|
|
1727
1726
|
r("web_app_check_location", "location_checked", C),
|
|
1728
|
-
|
|
1727
|
+
x(Br)
|
|
1729
1728
|
);
|
|
1730
1729
|
}
|
|
1731
|
-
}), l = { version: e, requires: "web_app_check_location", isTma: o },
|
|
1730
|
+
}), l = { version: e, requires: "web_app_check_location", isTma: o }, m = E({
|
|
1732
1731
|
...l,
|
|
1733
1732
|
returns: "either"
|
|
1734
|
-
}),
|
|
1733
|
+
}), _ = E({
|
|
1735
1734
|
...l,
|
|
1736
1735
|
returns: "task"
|
|
1737
1736
|
}), g = E({
|
|
@@ -1739,21 +1738,21 @@ class xr {
|
|
|
1739
1738
|
returns: "task",
|
|
1740
1739
|
isMounted: p.isMounted
|
|
1741
1740
|
});
|
|
1742
|
-
this.isAvailable = a.getter("available"), this.isAccessRequested = a.getter("accessRequested"), this.isAccessGranted = a.getter("accessGranted"), this.isSupported = z("web_app_check_location", e), this.isMounted = p.isMounted, this.state = a.state, this.unmount = p.unmount, this.mountFp =
|
|
1741
|
+
this.isAvailable = a.getter("available"), this.isAccessRequested = a.getter("accessRequested"), this.isAccessGranted = a.getter("accessGranted"), this.isSupported = z("web_app_check_location", e), this.isMounted = p.isMounted, this.state = a.state, this.unmount = p.unmount, this.mountFp = _(p.mount), this.openSettingsFp = m(() => n("web_app_open_location_settings")), this.requestLocationFp = g((C) => c(
|
|
1743
1742
|
r("web_app_request_location", "location_requested", C),
|
|
1744
|
-
|
|
1745
|
-
if (!
|
|
1743
|
+
x((y) => {
|
|
1744
|
+
if (!y.available)
|
|
1746
1745
|
return a.setState({ available: !1 }), null;
|
|
1747
|
-
const { available:
|
|
1748
|
-
return
|
|
1746
|
+
const { available: S, ...f } = y;
|
|
1747
|
+
return f;
|
|
1749
1748
|
})
|
|
1750
1749
|
)), this.mount = d(this.mountFp), this.openSettings = d(this.openSettingsFp), this.requestLocation = d(this.requestLocationFp);
|
|
1751
1750
|
}
|
|
1752
1751
|
}
|
|
1753
1752
|
const On = new xr(c(
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1753
|
+
F(),
|
|
1754
|
+
L,
|
|
1755
|
+
v,
|
|
1757
1756
|
U,
|
|
1758
1757
|
et("locationManager")
|
|
1759
1758
|
));
|
|
@@ -1968,7 +1967,7 @@ class qr {
|
|
|
1968
1967
|
})
|
|
1969
1968
|
}), i = (o, u) => {
|
|
1970
1969
|
const a = n.stateGetter(o);
|
|
1971
|
-
return w(() => a() ||
|
|
1970
|
+
return w(() => a() || P(u));
|
|
1972
1971
|
};
|
|
1973
1972
|
this.bgColor = i("bgColor", e.bgColor), this.textColor = i("textColor", e.textColor), this.hasShineEffect = n.stateGetter("hasShineEffect"), this.isEnabled = n.stateGetter("isEnabled"), this.isLoaderVisible = n.stateGetter("isLoaderVisible"), this.text = n.stateGetter("text"), this.isVisible = n.stateGetter("isVisible"), this.isMounted = n.isMounted, this.state = n.state, [this.setBgColor, this.setBgColorFp] = n.stateSetters("bgColor"), [this.setTextColor, this.setTextColorFp] = n.stateSetters("textColor"), [
|
|
1974
1973
|
[this.disableShineEffect, this.disableShineEffectFp],
|
|
@@ -2123,7 +2122,7 @@ class Vr {
|
|
|
2123
2122
|
}), p = (C) => {
|
|
2124
2123
|
a.setState(C.theme_params);
|
|
2125
2124
|
}, l = new dt({
|
|
2126
|
-
initialState: () => I(
|
|
2125
|
+
initialState: () => I(P(e)),
|
|
2127
2126
|
isPageReload: u,
|
|
2128
2127
|
onMounted(C) {
|
|
2129
2128
|
a.setState(C), r(p);
|
|
@@ -2132,33 +2131,33 @@ class Vr {
|
|
|
2132
2131
|
n(p);
|
|
2133
2132
|
},
|
|
2134
2133
|
restoreState: o.get
|
|
2135
|
-
}),
|
|
2136
|
-
...
|
|
2134
|
+
}), m = { isTma: i, returns: "either" }, _ = E(m), g = E({
|
|
2135
|
+
...m,
|
|
2137
2136
|
isMounted: l.isMounted
|
|
2138
2137
|
});
|
|
2139
2138
|
this.accentTextColor = a.getter("accent_text_color"), this.bgColor = a.getter("bg_color"), this.buttonColor = a.getter("button_color"), this.buttonTextColor = a.getter("button_text_color"), this.bottomBarBgColor = a.getter("bottom_bar_bg_color"), this.destructiveTextColor = a.getter("destructive_text_color"), this.headerBgColor = a.getter("header_bg_color"), this.hintColor = a.getter("hint_color"), this.linkColor = a.getter("link_color"), this.secondaryBgColor = a.getter("secondary_bg_color"), this.sectionBgColor = a.getter("section_bg_color"), this.sectionHeaderTextColor = a.getter("section_header_text_color"), this.sectionSeparatorColor = a.getter("section_separator_color"), this.subtitleTextColor = a.getter("subtitle_text_color"), this.textColor = a.getter("text_color"), this.state = a.state, this.isMounted = l.isMounted, this.bindCssVarsFp = g((C) => {
|
|
2140
2139
|
if (this._isCssVarsBound())
|
|
2141
|
-
return
|
|
2142
|
-
C || (C = (
|
|
2143
|
-
const
|
|
2144
|
-
Object.entries(a.state()).forEach(([
|
|
2145
|
-
h &&
|
|
2140
|
+
return V(new Qt());
|
|
2141
|
+
C || (C = (f) => `--tg-theme-${We(f)}`);
|
|
2142
|
+
const y = (f) => {
|
|
2143
|
+
Object.entries(a.state()).forEach(([b, h]) => {
|
|
2144
|
+
h && f(b, h);
|
|
2146
2145
|
});
|
|
2147
|
-
},
|
|
2148
|
-
|
|
2149
|
-
Zt(C(
|
|
2146
|
+
}, S = () => {
|
|
2147
|
+
y((f, b) => {
|
|
2148
|
+
Zt(C(f), b);
|
|
2150
2149
|
});
|
|
2151
2150
|
};
|
|
2152
|
-
return
|
|
2153
|
-
|
|
2151
|
+
return S(), a.state.sub(S), this._isCssVarsBound.set(!0), I(() => {
|
|
2152
|
+
y(Xt), a.state.unsub(S), this._isCssVarsBound.set(!1);
|
|
2154
2153
|
});
|
|
2155
|
-
}), this.mountFp =
|
|
2154
|
+
}), this.mountFp = _(l.mount), this.unmount = l.unmount, this.bindCssVars = d(this.bindCssVarsFp), this.mount = d(this.mountFp);
|
|
2156
2155
|
}
|
|
2157
2156
|
//#endregion
|
|
2158
2157
|
}
|
|
2159
2158
|
const vt = new Vr({
|
|
2160
2159
|
...c(
|
|
2161
|
-
|
|
2160
|
+
F(),
|
|
2162
2161
|
et("themeParams")
|
|
2163
2162
|
),
|
|
2164
2163
|
offChange(s) {
|
|
@@ -2355,21 +2354,21 @@ class Tr {
|
|
|
2355
2354
|
t(this, "ready");
|
|
2356
2355
|
const l = (h) => {
|
|
2357
2356
|
g.setState({ isActive: h.is_visible });
|
|
2358
|
-
},
|
|
2357
|
+
}, m = (h) => {
|
|
2359
2358
|
[
|
|
2360
2359
|
[this.headerColor, "web_app_set_header_color"],
|
|
2361
2360
|
[this.bgColor, "web_app_set_background_color"],
|
|
2362
2361
|
[this.bottomBarColor, "web_app_set_bottom_bar_color"]
|
|
2363
|
-
].forEach(([
|
|
2364
|
-
const
|
|
2365
|
-
if (!Et(
|
|
2366
|
-
const O = h[
|
|
2367
|
-
O && i(
|
|
2362
|
+
].forEach(([B, R]) => {
|
|
2363
|
+
const T = B();
|
|
2364
|
+
if (!Et(T) && (R === "web_app_set_header_color" || !["bg_color", "secondary_bg_color"].includes(T))) {
|
|
2365
|
+
const O = h[T];
|
|
2366
|
+
O && i(R, { color: O });
|
|
2368
2367
|
}
|
|
2369
2368
|
});
|
|
2370
|
-
},
|
|
2369
|
+
}, _ = new dt({
|
|
2371
2370
|
initialState() {
|
|
2372
|
-
const h =
|
|
2371
|
+
const h = P(u);
|
|
2373
2372
|
return I({
|
|
2374
2373
|
bgColor: h.bg_color || "bg_color",
|
|
2375
2374
|
headerColor: h.header_bg_color || "header_bg_color",
|
|
@@ -2379,18 +2378,18 @@ class Tr {
|
|
|
2379
2378
|
},
|
|
2380
2379
|
isPageReload: r,
|
|
2381
2380
|
onMounted: (h) => {
|
|
2382
|
-
this.setBgColorFp.ifAvailable(h.bgColor), this.setBottomBarColorFp.ifAvailable(h.bottomBarColor), this.setHeaderColorFp.ifAvailable(h.headerColor), a(l), u.sub(
|
|
2381
|
+
this.setBgColorFp.ifAvailable(h.bgColor), this.setBottomBarColorFp.ifAvailable(h.bottomBarColor), this.setHeaderColorFp.ifAvailable(h.headerColor), a(l), u.sub(m), g.setState(h);
|
|
2383
2382
|
},
|
|
2384
2383
|
onUnmounted() {
|
|
2385
|
-
p(l), u.unsub(
|
|
2384
|
+
p(l), u.unsub(m);
|
|
2386
2385
|
},
|
|
2387
2386
|
restoreState: e.get
|
|
2388
2387
|
});
|
|
2389
|
-
this.isMounted =
|
|
2388
|
+
this.isMounted = _.isMounted, this.mountFp = A(() => {
|
|
2390
2389
|
const h = () => {
|
|
2391
2390
|
};
|
|
2392
|
-
return c(
|
|
2393
|
-
}, { isTma: o, returns: "plain" }), this.mount = d(this.mountFp), this.unmount =
|
|
2391
|
+
return c(_.mount(), pt(h, h));
|
|
2392
|
+
}, { isTma: o, returns: "plain" }), this.mount = d(this.mountFp), this.unmount = _.unmount;
|
|
2394
2393
|
const g = new tt({
|
|
2395
2394
|
initialState: {
|
|
2396
2395
|
bgColor: "bg_color",
|
|
@@ -2401,40 +2400,40 @@ class Tr {
|
|
|
2401
2400
|
onChange: e.set
|
|
2402
2401
|
});
|
|
2403
2402
|
this.state = g.state;
|
|
2404
|
-
const C = (h) => Et(h) ? h :
|
|
2403
|
+
const C = (h) => Et(h) ? h : P(u)[h], y = (h) => w(() => C(h()));
|
|
2405
2404
|
this.isActive = g.getter("isActive"), this.isSupported = w(() => [
|
|
2406
2405
|
"web_app_set_header_color",
|
|
2407
2406
|
"web_app_set_background_color",
|
|
2408
2407
|
"web_app_set_bottom_bar_color"
|
|
2409
|
-
].some((h) => ot(h,
|
|
2410
|
-
const
|
|
2411
|
-
this.isCssVarsBound = w(
|
|
2412
|
-
if (
|
|
2413
|
-
return
|
|
2414
|
-
const [
|
|
2415
|
-
|
|
2416
|
-
}),
|
|
2408
|
+
].some((h) => ot(h, P(n))));
|
|
2409
|
+
const S = j(!1);
|
|
2410
|
+
this.isCssVarsBound = w(S), this.bindCssVarsFp = A((h) => {
|
|
2411
|
+
if (S())
|
|
2412
|
+
return V(new Qt());
|
|
2413
|
+
const [B, R] = Lt(() => {
|
|
2414
|
+
S.set(!1);
|
|
2415
|
+
}), T = (O, G) => {
|
|
2417
2416
|
const H = () => {
|
|
2418
2417
|
Zt(O, G() || null);
|
|
2419
2418
|
};
|
|
2420
|
-
H(),
|
|
2419
|
+
H(), B(G.sub(H), Xt.bind(null, O));
|
|
2421
2420
|
};
|
|
2422
|
-
return h || (h = (O) => `--tg-${le(O)}`),
|
|
2421
|
+
return h || (h = (O) => `--tg-${le(O)}`), T(h("bgColor"), this.bgColorRgb), T(h("bottomBarColor"), this.bottomBarColorRgb), T(h("headerColor"), this.headerColorRgb), S.set(!0), I(R);
|
|
2423
2422
|
}, { isTma: o, returns: "either", isMounted: this.isMounted }), this.bindCssVars = d(this.bindCssVarsFp);
|
|
2424
|
-
const
|
|
2425
|
-
const
|
|
2423
|
+
const f = (h) => {
|
|
2424
|
+
const B = g.getter(h), R = y(B), T = {
|
|
2426
2425
|
headerColor: "web_app_set_header_color",
|
|
2427
2426
|
bgColor: "web_app_set_background_color",
|
|
2428
2427
|
bottomBarColor: "web_app_set_bottom_bar_color"
|
|
2429
2428
|
}[h], O = A(
|
|
2430
2429
|
(G) => {
|
|
2431
|
-
if (G ===
|
|
2430
|
+
if (G === B())
|
|
2432
2431
|
return I(void 0);
|
|
2433
|
-
if (
|
|
2432
|
+
if (T === "web_app_set_header_color" && (G === "bg_color" || G === "secondary_bg_color"))
|
|
2434
2433
|
return i("web_app_set_header_color", { color_key: G });
|
|
2435
2434
|
const H = C(G);
|
|
2436
2435
|
return c(
|
|
2437
|
-
H ? i(
|
|
2436
|
+
H ? i(T, { color: H }) : V(new rr(G)),
|
|
2438
2437
|
D(() => {
|
|
2439
2438
|
g.setState({ [h]: H });
|
|
2440
2439
|
})
|
|
@@ -2443,7 +2442,7 @@ class Tr {
|
|
|
2443
2442
|
{
|
|
2444
2443
|
isTma: o,
|
|
2445
2444
|
version: n,
|
|
2446
|
-
requires:
|
|
2445
|
+
requires: T,
|
|
2447
2446
|
isMounted: this.isMounted,
|
|
2448
2447
|
returns: "either",
|
|
2449
2448
|
supports: h === "headerColor" ? {
|
|
@@ -2455,34 +2454,34 @@ class Tr {
|
|
|
2455
2454
|
} : void 0
|
|
2456
2455
|
}
|
|
2457
2456
|
);
|
|
2458
|
-
return [
|
|
2457
|
+
return [B, R, d(O), O];
|
|
2459
2458
|
};
|
|
2460
2459
|
[
|
|
2461
2460
|
this.bgColor,
|
|
2462
2461
|
this.bgColorRgb,
|
|
2463
2462
|
this.setBgColor,
|
|
2464
2463
|
this.setBgColorFp
|
|
2465
|
-
] =
|
|
2464
|
+
] = f("bgColor"), [
|
|
2466
2465
|
this.headerColor,
|
|
2467
2466
|
this.headerColorRgb,
|
|
2468
2467
|
this.setHeaderColor,
|
|
2469
2468
|
this.setHeaderColorFp
|
|
2470
|
-
] =
|
|
2469
|
+
] = f("headerColor"), [
|
|
2471
2470
|
this.bottomBarColor,
|
|
2472
2471
|
this.bottomBarColorRgb,
|
|
2473
2472
|
this.setBottomBarColor,
|
|
2474
2473
|
this.setBottomBarColorFp
|
|
2475
|
-
] =
|
|
2476
|
-
const
|
|
2477
|
-
this.closeFp =
|
|
2474
|
+
] = f("bottomBarColor");
|
|
2475
|
+
const b = E({ isTma: o, returns: "either" });
|
|
2476
|
+
this.closeFp = b((h) => i("web_app_close", { return_back: h })), this.close = d(this.closeFp), this.readyFp = b(() => i("web_app_ready")), this.ready = d(this.readyFp);
|
|
2478
2477
|
}
|
|
2479
2478
|
//#endregion
|
|
2480
2479
|
}
|
|
2481
2480
|
const $r = new Tr({
|
|
2482
2481
|
...c(
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2482
|
+
F(),
|
|
2483
|
+
L,
|
|
2484
|
+
v,
|
|
2486
2485
|
et("miniApp")
|
|
2487
2486
|
),
|
|
2488
2487
|
offVisibilityChanged(s) {
|
|
@@ -2496,11 +2495,11 @@ const $r = new Tr({
|
|
|
2496
2495
|
function Lr(s) {
|
|
2497
2496
|
const e = s.message.trim(), r = (s.title || "").trim(), n = s.buttons || [];
|
|
2498
2497
|
if (r.length > 64)
|
|
2499
|
-
return
|
|
2498
|
+
return V(new Q(`Invalid title: ${r}`));
|
|
2500
2499
|
if (!e || e.length > 256)
|
|
2501
|
-
return
|
|
2500
|
+
return V(new Q(`Invalid message: ${e}`));
|
|
2502
2501
|
if (n.length > 3)
|
|
2503
|
-
return
|
|
2502
|
+
return V(new Q(`Invalid buttons count: ${n.length}`));
|
|
2504
2503
|
const i = [];
|
|
2505
2504
|
if (!n.length)
|
|
2506
2505
|
i.push({ type: "close", id: "" });
|
|
@@ -2508,11 +2507,11 @@ function Lr(s) {
|
|
|
2508
2507
|
for (let o = 0; o < n.length; o++) {
|
|
2509
2508
|
const u = n[o], a = u.id || "";
|
|
2510
2509
|
if (a.length > 64)
|
|
2511
|
-
return
|
|
2510
|
+
return V(new Q(`Button with index ${o} has invalid id: ${a}`));
|
|
2512
2511
|
if (!u.type || u.type === "default" || u.type === "destructive") {
|
|
2513
2512
|
const p = u.text.trim();
|
|
2514
2513
|
if (!p || p.length > 64)
|
|
2515
|
-
return
|
|
2514
|
+
return V(new Q(`Button with index ${o} has invalid text: ${p}`));
|
|
2516
2515
|
i.push({ type: u.type, text: p, id: a });
|
|
2517
2516
|
} else
|
|
2518
2517
|
i.push({ type: u.type, id: a });
|
|
@@ -2568,7 +2567,7 @@ class Rr {
|
|
|
2568
2567
|
returns: "task"
|
|
2569
2568
|
});
|
|
2570
2569
|
this.isSupported = z("web_app_open_popup", e), this.isOpened = w(i), this.showFp = u((a) => c(
|
|
2571
|
-
this.isOpened() ?
|
|
2570
|
+
this.isOpened() ? $(new zt("A popup is already opened")) : q(void 0),
|
|
2572
2571
|
at(() => ve(Lr(a))),
|
|
2573
2572
|
Z((p) => (i.set(!0), n("web_app_open_popup", "popup_closed", {
|
|
2574
2573
|
...a,
|
|
@@ -2581,16 +2580,16 @@ class Rr {
|
|
|
2581
2580
|
)), this.show = d(this.showFp);
|
|
2582
2581
|
}
|
|
2583
2582
|
}
|
|
2584
|
-
const Un = new Rr(c(
|
|
2583
|
+
const Un = new Rr(c(F(), U, v));
|
|
2585
2584
|
function Pr({ request: s, ...e }) {
|
|
2586
2585
|
return A((r) => c(
|
|
2587
2586
|
s("web_app_request_phone", "phone_requested", r),
|
|
2588
|
-
|
|
2587
|
+
x((n) => n.status)
|
|
2589
2588
|
), { ...e, requires: "web_app_request_phone", returns: "task" });
|
|
2590
2589
|
}
|
|
2591
2590
|
const qe = Pr(c(
|
|
2592
|
-
|
|
2593
|
-
|
|
2591
|
+
F(),
|
|
2592
|
+
v,
|
|
2594
2593
|
U
|
|
2595
2594
|
)), Gn = d(qe);
|
|
2596
2595
|
function Or({
|
|
@@ -2606,9 +2605,9 @@ function Or({
|
|
|
2606
2605
|
at((a) => {
|
|
2607
2606
|
const p = qt(J(), a);
|
|
2608
2607
|
if (!p.success)
|
|
2609
|
-
return
|
|
2608
|
+
return $(new Ft(a, p.issues));
|
|
2610
2609
|
if (!p.output)
|
|
2611
|
-
return
|
|
2610
|
+
return q(void 0);
|
|
2612
2611
|
const l = qt(
|
|
2613
2612
|
ze(
|
|
2614
2613
|
oe({
|
|
@@ -2620,7 +2619,7 @@ function Or({
|
|
|
2620
2619
|
})),
|
|
2621
2620
|
auth_date: pe(
|
|
2622
2621
|
J(),
|
|
2623
|
-
he((
|
|
2622
|
+
he((m) => new Date(Number(m) * 1e3)),
|
|
2624
2623
|
de()
|
|
2625
2624
|
),
|
|
2626
2625
|
hash: J()
|
|
@@ -2628,7 +2627,7 @@ function Or({
|
|
|
2628
2627
|
),
|
|
2629
2628
|
p.output
|
|
2630
2629
|
);
|
|
2631
|
-
return l.success ?
|
|
2630
|
+
return l.success ? q({ raw: p.output, parsed: l.output }) : $(new Ft(p.output, l.issues));
|
|
2632
2631
|
})
|
|
2633
2632
|
), i = (u) => c(
|
|
2634
2633
|
n(u),
|
|
@@ -2636,19 +2635,19 @@ function Or({
|
|
|
2636
2635
|
// All other errors except validation ones should be ignored. Receiving validation error
|
|
2637
2636
|
// means that we have some data, but we are unable to parse it properly. So, there is no
|
|
2638
2637
|
// need to make some more requests further, the problem is local.
|
|
2639
|
-
(a) => Ft.is(a) ?
|
|
2638
|
+
(a) => Ft.is(a) ? V(a) : I(void 0),
|
|
2640
2639
|
(a) => I(a)
|
|
2641
2640
|
)
|
|
2642
2641
|
), o = (u) => xt(
|
|
2643
2642
|
async (a, p, l) => {
|
|
2644
|
-
let
|
|
2643
|
+
let m = 50;
|
|
2645
2644
|
for (; !l.isRejected; ) {
|
|
2646
|
-
const
|
|
2647
|
-
if (
|
|
2648
|
-
return p(
|
|
2649
|
-
if (
|
|
2650
|
-
return a(
|
|
2651
|
-
await new Promise((g) => setTimeout(g,
|
|
2645
|
+
const _ = await i(l)();
|
|
2646
|
+
if (_._tag === "Left")
|
|
2647
|
+
return p(_.left);
|
|
2648
|
+
if (_.right)
|
|
2649
|
+
return a(_.right);
|
|
2650
|
+
await new Promise((g) => setTimeout(g, m)), m += 50;
|
|
2652
2651
|
}
|
|
2653
2652
|
},
|
|
2654
2653
|
u
|
|
@@ -2656,9 +2655,9 @@ function Or({
|
|
|
2656
2655
|
return A((u) => xt.fn((a) => c(
|
|
2657
2656
|
// Try to get the requested contact. Probably, we already requested it before.
|
|
2658
2657
|
i(a),
|
|
2659
|
-
Z((p) => p ?
|
|
2658
|
+
Z((p) => p ? q(p) : c(
|
|
2660
2659
|
e(a),
|
|
2661
|
-
at((l) => l === "sent" ? o(a) :
|
|
2660
|
+
at((l) => l === "sent" ? o(a) : $(new ye("User denied access")))
|
|
2662
2661
|
))
|
|
2663
2662
|
), u), { ...r, returns: "task", requires: "web_app_request_phone" });
|
|
2664
2663
|
}
|
|
@@ -2669,26 +2668,26 @@ function Dr({ requestContact: s, ...e }) {
|
|
|
2669
2668
|
);
|
|
2670
2669
|
}
|
|
2671
2670
|
const Me = Or({
|
|
2672
|
-
...c(
|
|
2671
|
+
...c(F(), Yt, v),
|
|
2673
2672
|
requestPhoneAccess: qe
|
|
2674
2673
|
}), jn = d(Me), Ur = Dr({
|
|
2675
|
-
...c(
|
|
2674
|
+
...c(F(), v),
|
|
2676
2675
|
requestContact(s) {
|
|
2677
2676
|
return c(
|
|
2678
2677
|
Me(s),
|
|
2679
|
-
|
|
2678
|
+
x((e) => e.parsed)
|
|
2680
2679
|
);
|
|
2681
2680
|
}
|
|
2682
2681
|
}), Hn = d(Ur);
|
|
2683
2682
|
function Gr({ request: s, ...e }) {
|
|
2684
2683
|
return A((r) => c(
|
|
2685
2684
|
s("web_app_request_write_access", "write_access_requested", r),
|
|
2686
|
-
|
|
2685
|
+
x((n) => n.status)
|
|
2687
2686
|
), { ...e, requires: "web_app_request_write_access", returns: "task" });
|
|
2688
2687
|
}
|
|
2689
2688
|
const jr = Gr(c(
|
|
2690
|
-
|
|
2691
|
-
|
|
2689
|
+
F(),
|
|
2690
|
+
v,
|
|
2692
2691
|
U
|
|
2693
2692
|
)), Wn = d(jr);
|
|
2694
2693
|
class Hr {
|
|
@@ -2778,36 +2777,36 @@ class Hr {
|
|
|
2778
2777
|
* @see openFp
|
|
2779
2778
|
*/
|
|
2780
2779
|
t(this, "open");
|
|
2781
|
-
const u = { version: e, requires: "web_app_open_scan_qr_popup", isTma: i }, a = E({ ...u, returns: "either" }), p = E({ ...u, returns: "task" }), l = j(!1),
|
|
2780
|
+
const u = { version: e, requires: "web_app_open_scan_qr_popup", isTma: i }, a = E({ ...u, returns: "either" }), p = E({ ...u, returns: "task" }), l = j(!1), m = () => {
|
|
2782
2781
|
l.set(!1);
|
|
2783
2782
|
};
|
|
2784
|
-
this.isSupported = z("web_app_open_scan_qr_popup", e), this.isOpened = w(l), this.captureFp = p((
|
|
2783
|
+
this.isSupported = z("web_app_open_scan_qr_popup", e), this.isOpened = w(l), this.captureFp = p((_) => {
|
|
2785
2784
|
let g;
|
|
2786
2785
|
return c(
|
|
2787
2786
|
this.openFp({
|
|
2788
|
-
...
|
|
2787
|
+
..._,
|
|
2789
2788
|
onCaptured: (C) => {
|
|
2790
|
-
|
|
2789
|
+
_.capture(C) && (g = C, this.close());
|
|
2791
2790
|
}
|
|
2792
2791
|
}),
|
|
2793
|
-
|
|
2792
|
+
x(() => g)
|
|
2794
2793
|
);
|
|
2795
|
-
}), this.closeFp = a(() => c(o("web_app_close_scan_qr_popup"), D(
|
|
2796
|
-
this.isOpened() ?
|
|
2794
|
+
}), this.closeFp = a(() => c(o("web_app_close_scan_qr_popup"), D(m))), this.openFp = p((_) => c(
|
|
2795
|
+
this.isOpened() ? $(new zt("The QR Scanner is already opened")) : async () => o("web_app_open_scan_qr_popup", { text: _.text }),
|
|
2797
2796
|
at(() => {
|
|
2798
|
-
const [g, C] = Lt(),
|
|
2797
|
+
const [g, C] = Lt(), y = (S) => (C(), S);
|
|
2799
2798
|
return c(
|
|
2800
|
-
xt((
|
|
2801
|
-
g(r(
|
|
2802
|
-
},
|
|
2803
|
-
Wt(
|
|
2799
|
+
xt((S) => {
|
|
2800
|
+
g(r(S), n(_.onCaptured));
|
|
2801
|
+
}, _),
|
|
2802
|
+
Wt(y, y)
|
|
2804
2803
|
);
|
|
2805
2804
|
})
|
|
2806
2805
|
)), this.open = d(this.openFp), this.capture = d(this.captureFp), this.close = d(this.closeFp);
|
|
2807
2806
|
}
|
|
2808
2807
|
}
|
|
2809
2808
|
const Kn = new Hr({
|
|
2810
|
-
...c(
|
|
2809
|
+
...c(F(), L, v),
|
|
2811
2810
|
onClosed(s) {
|
|
2812
2811
|
return Y("scan_qr_popup_closed", s);
|
|
2813
2812
|
},
|
|
@@ -3064,7 +3063,7 @@ class Wr {
|
|
|
3064
3063
|
})
|
|
3065
3064
|
}), i = (o, u) => {
|
|
3066
3065
|
const a = n.stateGetter(o);
|
|
3067
|
-
return w(() => a() ||
|
|
3066
|
+
return w(() => a() || P(u));
|
|
3068
3067
|
};
|
|
3069
3068
|
this.isSupported = z("web_app_setup_secondary_button", r.version), this.bgColor = i("bgColor", e.bgColor), this.textColor = i("textColor", e.textColor), this.position = n.stateGetter("position"), this.hasShineEffect = n.stateGetter("hasShineEffect"), this.isEnabled = n.stateGetter("isEnabled"), this.isLoaderVisible = n.stateGetter("isLoaderVisible"), this.text = n.stateGetter("text"), this.isVisible = n.stateGetter("isVisible"), this.isMounted = n.isMounted, this.state = n.state, [this.setPosition, this.setPositionFp] = n.stateSetters("position"), [this.setBgColor, this.setBgColorFp] = n.stateSetters("bgColor"), [this.setTextColor, this.setTextColorFp] = n.stateSetters("textColor"), [
|
|
3070
3069
|
[this.disableShineEffect, this.disableShineEffectFp],
|
|
@@ -3238,11 +3237,11 @@ class Qr {
|
|
|
3238
3237
|
}), p = { requires: "web_app_setup_swipe_behavior", isTma: n, version: o }, l = E({
|
|
3239
3238
|
...p,
|
|
3240
3239
|
returns: "plain"
|
|
3241
|
-
}),
|
|
3240
|
+
}), m = E({
|
|
3242
3241
|
...p,
|
|
3243
3242
|
isMounted: a.isMounted,
|
|
3244
3243
|
returns: "either"
|
|
3245
|
-
}),
|
|
3244
|
+
}), _ = (g) => {
|
|
3246
3245
|
const C = { isVerticalEnabled: g };
|
|
3247
3246
|
return u.hasDiff(C) ? c(
|
|
3248
3247
|
e("web_app_setup_swipe_behavior", { allow_vertical_swipe: g }),
|
|
@@ -3251,7 +3250,7 @@ class Qr {
|
|
|
3251
3250
|
})
|
|
3252
3251
|
) : I(void 0);
|
|
3253
3252
|
};
|
|
3254
|
-
this.isSupported = z("web_app_setup_swipe_behavior", o), this.isVerticalEnabled = u.getter("isVerticalEnabled"), this.isMounted = a.isMounted, this.disableVerticalFp =
|
|
3253
|
+
this.isSupported = z("web_app_setup_swipe_behavior", o), this.isVerticalEnabled = u.getter("isVerticalEnabled"), this.isMounted = a.isMounted, this.disableVerticalFp = m(() => _(!1)), this.enableVerticalFp = m(() => _(!0)), this.mountFp = l(() => {
|
|
3255
3254
|
const g = () => {
|
|
3256
3255
|
};
|
|
3257
3256
|
return c(a.mount(), pt(g, g));
|
|
@@ -3259,9 +3258,9 @@ class Qr {
|
|
|
3259
3258
|
}
|
|
3260
3259
|
}
|
|
3261
3260
|
const Nn = new Qr(c(
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3261
|
+
F(),
|
|
3262
|
+
L,
|
|
3263
|
+
v,
|
|
3265
3264
|
et("swipeBehavior")
|
|
3266
3265
|
));
|
|
3267
3266
|
async function Jn(s) {
|
|
@@ -3286,13 +3285,13 @@ function zr({ request: s, ...e }) {
|
|
|
3286
3285
|
"file_download_requested",
|
|
3287
3286
|
{ ...i, params: { url: r, file_name: n } }
|
|
3288
3287
|
),
|
|
3289
|
-
Z((o) => o.status === "downloading" ?
|
|
3288
|
+
Z((o) => o.status === "downloading" ? q(void 0) : $(new ye("User denied the action")))
|
|
3290
3289
|
), { ...e, requires: "web_app_request_file_download", returns: "task" });
|
|
3291
3290
|
}
|
|
3292
3291
|
const Nr = zr(c(
|
|
3293
|
-
|
|
3292
|
+
F(),
|
|
3294
3293
|
U,
|
|
3295
|
-
|
|
3294
|
+
v
|
|
3296
3295
|
)), Yn = d(Nr);
|
|
3297
3296
|
function Jr({ invokeCustomMethod: s, ...e }) {
|
|
3298
3297
|
return A((r) => c(
|
|
@@ -3302,22 +3301,22 @@ function Jr({ invokeCustomMethod: s, ...e }) {
|
|
|
3302
3301
|
pe(fe(), ts(), he((o) => new Date(o * 1e3)), de()),
|
|
3303
3302
|
n
|
|
3304
3303
|
);
|
|
3305
|
-
return i.success ?
|
|
3304
|
+
return i.success ? q(i.output) : $(new Ft(n, i.issues));
|
|
3306
3305
|
})
|
|
3307
3306
|
), { ...e, requires: "web_app_invoke_custom_method", returns: "task" });
|
|
3308
3307
|
}
|
|
3309
3308
|
const Yr = Jr(c(
|
|
3310
|
-
|
|
3309
|
+
F(),
|
|
3311
3310
|
Yt,
|
|
3312
|
-
|
|
3311
|
+
v
|
|
3313
3312
|
)), Zn = d(Yr);
|
|
3314
3313
|
function Zr({ postEvent: s, ...e }) {
|
|
3315
3314
|
return A(() => s("web_app_hide_keyboard"), { ...e, returns: "either", requires: "web_app_hide_keyboard" });
|
|
3316
3315
|
}
|
|
3317
3316
|
const Xr = Zr(c(
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3317
|
+
F(),
|
|
3318
|
+
L,
|
|
3319
|
+
v
|
|
3321
3320
|
)), Xn = d(Xr);
|
|
3322
3321
|
function tn({ request: s, createRequestId: e, ...r }) {
|
|
3323
3322
|
return A((n) => {
|
|
@@ -3328,14 +3327,14 @@ function tn({ request: s, createRequestId: e, ...r }) {
|
|
|
3328
3327
|
params: { req_id: i },
|
|
3329
3328
|
capture: Ge(i)
|
|
3330
3329
|
}),
|
|
3331
|
-
|
|
3330
|
+
x(({ data: o = null }) => o)
|
|
3332
3331
|
);
|
|
3333
3332
|
}, { ...r, requires: "web_app_read_text_from_clipboard", returns: "task" });
|
|
3334
3333
|
}
|
|
3335
3334
|
const en = tn({
|
|
3336
3335
|
...c(
|
|
3337
|
-
|
|
3338
|
-
|
|
3336
|
+
F(),
|
|
3337
|
+
v,
|
|
3339
3338
|
U
|
|
3340
3339
|
),
|
|
3341
3340
|
createRequestId: Ae
|
|
@@ -3362,12 +3361,12 @@ function eo() {
|
|
|
3362
3361
|
function rn({ postEvent: s, ...e }) {
|
|
3363
3362
|
return A((r) => {
|
|
3364
3363
|
const { size: n } = new Blob([r]);
|
|
3365
|
-
return !n || n > 4096 ?
|
|
3364
|
+
return !n || n > 4096 ? V(
|
|
3366
3365
|
new Q(n ? "Maximum size of data to send is 4096 bytes" : "Attempted to send empty data")
|
|
3367
3366
|
) : s("web_app_data_send", { data: r });
|
|
3368
3367
|
}, { ...e, returns: "either" });
|
|
3369
3368
|
}
|
|
3370
|
-
const nn = rn(c(
|
|
3369
|
+
const nn = rn(c(F(), L)), so = d(nn);
|
|
3371
3370
|
function on({ request: s, ...e }) {
|
|
3372
3371
|
return A((r, n) => c(
|
|
3373
3372
|
s(
|
|
@@ -3378,13 +3377,13 @@ function on({ request: s, ...e }) {
|
|
|
3378
3377
|
params: { id: r }
|
|
3379
3378
|
}
|
|
3380
3379
|
),
|
|
3381
|
-
Z((i) => i && "error" in i ?
|
|
3380
|
+
Z((i) => i && "error" in i ? $(new sr(i.error)) : q(void 0))
|
|
3382
3381
|
), { ...e, requires: "web_app_send_prepared_message", returns: "task" });
|
|
3383
3382
|
}
|
|
3384
3383
|
const an = on(c(
|
|
3385
|
-
|
|
3384
|
+
F(),
|
|
3386
3385
|
U,
|
|
3387
|
-
|
|
3386
|
+
v
|
|
3388
3387
|
)), ro = d(an);
|
|
3389
3388
|
function un({ postEvent: s, ...e }) {
|
|
3390
3389
|
return A((r, n = {}) => s("web_app_share_to_story", {
|
|
@@ -3394,9 +3393,9 @@ function un({ postEvent: s, ...e }) {
|
|
|
3394
3393
|
}), { ...e, requires: "web_app_share_to_story", returns: "either" });
|
|
3395
3394
|
}
|
|
3396
3395
|
const cn = un(c(
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3396
|
+
F(),
|
|
3397
|
+
L,
|
|
3398
|
+
v
|
|
3400
3399
|
)), no = d(cn), $t = /* @__PURE__ */ _t(!1);
|
|
3401
3400
|
function ln({ isInlineMode: s, postEvent: e, ...r }) {
|
|
3402
3401
|
return A((n, i) => e("web_app_switch_inline_query", {
|
|
@@ -3405,16 +3404,16 @@ function ln({ isInlineMode: s, postEvent: e, ...r }) {
|
|
|
3405
3404
|
}), {
|
|
3406
3405
|
...r,
|
|
3407
3406
|
requires: {
|
|
3408
|
-
every: ["web_app_switch_inline_query", () =>
|
|
3407
|
+
every: ["web_app_switch_inline_query", () => P(s) ? void 0 : "The application must be launched in the inline mode"]
|
|
3409
3408
|
},
|
|
3410
3409
|
returns: "either"
|
|
3411
3410
|
});
|
|
3412
3411
|
}
|
|
3413
3412
|
const pn = ln({
|
|
3414
3413
|
...c(
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3414
|
+
F(),
|
|
3415
|
+
L,
|
|
3416
|
+
v
|
|
3418
3417
|
),
|
|
3419
3418
|
isInlineMode: $t
|
|
3420
3419
|
}), oo = d(pn);
|
|
@@ -3429,13 +3428,13 @@ class hn {
|
|
|
3429
3428
|
offContentSafeAreaInsetsChanged: a,
|
|
3430
3429
|
offFullscreenChanged: p,
|
|
3431
3430
|
offSafeAreaInsetsChanged: l,
|
|
3432
|
-
offViewportChanged:
|
|
3433
|
-
request:
|
|
3431
|
+
offViewportChanged: m,
|
|
3432
|
+
request: _,
|
|
3434
3433
|
isViewportStable: g,
|
|
3435
3434
|
isFullscreen: C,
|
|
3436
|
-
isTma:
|
|
3437
|
-
version:
|
|
3438
|
-
postEvent:
|
|
3435
|
+
isTma: y,
|
|
3436
|
+
version: S,
|
|
3437
|
+
postEvent: f
|
|
3439
3438
|
}) {
|
|
3440
3439
|
//#region Other properties.
|
|
3441
3440
|
/**
|
|
@@ -3624,27 +3623,27 @@ class hn {
|
|
|
3624
3623
|
* @see expandFp
|
|
3625
3624
|
*/
|
|
3626
3625
|
t(this, "expand");
|
|
3627
|
-
const
|
|
3626
|
+
const b = { top: 0, right: 0, left: 0, bottom: 0 }, h = new tt({
|
|
3628
3627
|
initialState: {
|
|
3629
|
-
contentSafeAreaInsets:
|
|
3628
|
+
contentSafeAreaInsets: b,
|
|
3630
3629
|
height: 0,
|
|
3631
3630
|
isExpanded: !1,
|
|
3632
3631
|
isFullscreen: !1,
|
|
3633
|
-
safeAreaInsets:
|
|
3632
|
+
safeAreaInsets: b,
|
|
3634
3633
|
stableHeight: 0,
|
|
3635
3634
|
width: 0
|
|
3636
3635
|
},
|
|
3637
3636
|
onChange: e.set
|
|
3638
|
-
}),
|
|
3637
|
+
}), B = (k) => {
|
|
3639
3638
|
h.setState({
|
|
3640
3639
|
isExpanded: k.is_expanded,
|
|
3641
3640
|
height: k.height,
|
|
3642
3641
|
width: k.width,
|
|
3643
3642
|
stableHeight: k.is_state_stable ? k.height : void 0
|
|
3644
3643
|
});
|
|
3645
|
-
},
|
|
3644
|
+
}, R = (k) => {
|
|
3646
3645
|
h.setState({ isFullscreen: k.is_fullscreen });
|
|
3647
|
-
},
|
|
3646
|
+
}, T = (k) => {
|
|
3648
3647
|
h.setState({ safeAreaInsets: k });
|
|
3649
3648
|
}, O = (k) => {
|
|
3650
3649
|
h.setState({ contentSafeAreaInsets: k });
|
|
@@ -3652,23 +3651,23 @@ class hn {
|
|
|
3652
3651
|
initialState(k) {
|
|
3653
3652
|
const st = (N) => () => {
|
|
3654
3653
|
const [X, W] = N === "safe-area" ? ["web_app_request_safe_area", "safe_area_changed"] : ["web_app_request_content_safe_area", "content_safe_area_changed"];
|
|
3655
|
-
return ot(X,
|
|
3656
|
-
},
|
|
3654
|
+
return ot(X, P(S)) ? _(X, W, k) : q({ top: 0, left: 0, right: 0, bottom: 0 });
|
|
3655
|
+
}, M = (N) => () => typeof N == "boolean" ? q(N) : ve(N());
|
|
3657
3656
|
return c(
|
|
3658
3657
|
Js,
|
|
3659
3658
|
wt("safeAreaInsets", st("safe-area")),
|
|
3660
3659
|
wt("contentSafeAreaInsets", st("content-safe-area")),
|
|
3661
|
-
wt("isFullscreen",
|
|
3662
|
-
wt("isViewportStable",
|
|
3663
|
-
at(({ isViewportStable: N, ...X }) => N ?
|
|
3660
|
+
wt("isFullscreen", M(C)),
|
|
3661
|
+
wt("isViewportStable", M(g)),
|
|
3662
|
+
at(({ isViewportStable: N, ...X }) => N ? q({
|
|
3664
3663
|
...X,
|
|
3665
3664
|
height: window.innerHeight,
|
|
3666
3665
|
isExpanded: !0,
|
|
3667
3666
|
stableHeight: window.innerHeight,
|
|
3668
3667
|
width: window.innerWidth
|
|
3669
3668
|
}) : c(
|
|
3670
|
-
|
|
3671
|
-
|
|
3669
|
+
_("web_app_request_viewport", "viewport_changed", k),
|
|
3670
|
+
x((W) => ({
|
|
3672
3671
|
...X,
|
|
3673
3672
|
height: W.height,
|
|
3674
3673
|
isExpanded: W.is_expanded,
|
|
@@ -3680,37 +3679,37 @@ class hn {
|
|
|
3680
3679
|
},
|
|
3681
3680
|
isPageReload: r,
|
|
3682
3681
|
onMounted(k) {
|
|
3683
|
-
o(
|
|
3682
|
+
o(B), u(R), i(T), n(O), h.setState(k);
|
|
3684
3683
|
},
|
|
3685
3684
|
onUnmounted() {
|
|
3686
|
-
|
|
3685
|
+
m(B), p(R), l(T), a(O);
|
|
3687
3686
|
},
|
|
3688
3687
|
restoreState: e.get
|
|
3689
3688
|
}), H = (k) => w(() => this.safeAreaInsets()[k]), bt = (k) => w(() => this.contentSafeAreaInsets()[k]);
|
|
3690
3689
|
this.state = h.state, this.height = h.getter("height"), this.stableHeight = h.getter("stableHeight"), this.width = h.getter("width"), this.isExpanded = h.getter("isExpanded"), this.safeAreaInsets = h.getter("safeAreaInsets"), this.safeAreaInsetTop = H("top"), this.safeAreaInsetBottom = H("bottom"), this.safeAreaInsetLeft = H("left"), this.safeAreaInsetRight = H("right"), this.contentSafeAreaInsets = h.getter("contentSafeAreaInsets"), this.contentSafeAreaInsetTop = bt("top"), this.contentSafeAreaInsetBottom = bt("bottom"), this.contentSafeAreaInsetLeft = bt("left"), this.contentSafeAreaInsetRight = bt("right");
|
|
3691
|
-
const Ve = E({ isTma:
|
|
3692
|
-
isTma:
|
|
3690
|
+
const Ve = E({ isTma: y, returns: "task" }), te = E({
|
|
3691
|
+
isTma: y,
|
|
3693
3692
|
returns: "either"
|
|
3694
3693
|
}), Te = E({
|
|
3695
|
-
isTma:
|
|
3694
|
+
isTma: y,
|
|
3696
3695
|
requires: "web_app_request_fullscreen",
|
|
3697
|
-
version:
|
|
3696
|
+
version: S,
|
|
3698
3697
|
returns: "task"
|
|
3699
3698
|
}), ee = (k) => Te((st) => c(
|
|
3700
|
-
|
|
3699
|
+
_(
|
|
3701
3700
|
k ? "web_app_request_fullscreen" : "web_app_exit_fullscreen",
|
|
3702
3701
|
["fullscreen_changed", "fullscreen_failed"],
|
|
3703
3702
|
st
|
|
3704
3703
|
),
|
|
3705
|
-
Z((
|
|
3704
|
+
Z((M) => "error" in M && M.error !== "ALREADY_FULLSCREEN" ? $(new er(M.error)) : (h.setState({ isFullscreen: "is_fullscreen" in M ? M.is_fullscreen : !0 }), q(void 0)))
|
|
3706
3705
|
));
|
|
3707
3706
|
this.isMounted = G.isMounted, this.mountFp = Ve(G.mount), this.mount = d(this.mountFp), this.isFullscreen = h.getter("isFullscreen"), this.requestFullscreenFp = ee(!0), this.requestFullscreen = d(this.requestFullscreenFp), this.exitFullscreenFp = ee(!1), this.exitFullscreen = d(this.exitFullscreenFp);
|
|
3708
3707
|
const gt = j(!1);
|
|
3709
3708
|
this.isCssVarsBound = w(gt), this.bindCssVarsFp = te(
|
|
3710
3709
|
(k) => {
|
|
3711
3710
|
if (gt())
|
|
3712
|
-
return
|
|
3713
|
-
k || (k = (
|
|
3711
|
+
return V(new Qt());
|
|
3712
|
+
k || (k = (M) => `--tg-viewport-${le(M)}`);
|
|
3714
3713
|
const st = [
|
|
3715
3714
|
["height", this.height],
|
|
3716
3715
|
["stableHeight", this.stableHeight],
|
|
@@ -3723,25 +3722,25 @@ class hn {
|
|
|
3723
3722
|
["contentSafeAreaInsetBottom", this.contentSafeAreaInsetBottom],
|
|
3724
3723
|
["contentSafeAreaInsetLeft", this.contentSafeAreaInsetLeft],
|
|
3725
3724
|
["contentSafeAreaInsetRight", this.contentSafeAreaInsetRight]
|
|
3726
|
-
].reduce((
|
|
3725
|
+
].reduce((M, [N, X]) => {
|
|
3727
3726
|
const W = k(N);
|
|
3728
3727
|
if (W) {
|
|
3729
3728
|
const se = () => {
|
|
3730
3729
|
Zt(W, `${X()}px`);
|
|
3731
3730
|
};
|
|
3732
|
-
|
|
3731
|
+
M.push({ update: se, removeListener: X.sub(se), cssVar: W });
|
|
3733
3732
|
}
|
|
3734
|
-
return
|
|
3733
|
+
return M;
|
|
3735
3734
|
}, []);
|
|
3736
|
-
return st.forEach((
|
|
3737
|
-
|
|
3735
|
+
return st.forEach((M) => {
|
|
3736
|
+
M.update();
|
|
3738
3737
|
}), gt.set(!0), I(() => {
|
|
3739
|
-
st.forEach((
|
|
3740
|
-
|
|
3738
|
+
st.forEach((M) => {
|
|
3739
|
+
M.removeListener(), Xt(M.cssVar);
|
|
3741
3740
|
}), gt.set(!1);
|
|
3742
3741
|
});
|
|
3743
3742
|
}
|
|
3744
|
-
), this.bindCssVars = d(this.bindCssVarsFp), this.expandFp = te(() =>
|
|
3743
|
+
), this.bindCssVars = d(this.bindCssVarsFp), this.expandFp = te(() => f("web_app_expand")), this.expand = d(this.expandFp);
|
|
3745
3744
|
}
|
|
3746
3745
|
//#endregion
|
|
3747
3746
|
}
|
|
@@ -3756,10 +3755,10 @@ function dn() {
|
|
|
3756
3755
|
}), e = s("viewport_changed"), r = s("fullscreen_changed"), n = s("safe_area_changed"), i = s("content_safe_area_changed");
|
|
3757
3756
|
return new hn({
|
|
3758
3757
|
...c(
|
|
3759
|
-
|
|
3758
|
+
F(),
|
|
3760
3759
|
et("viewport"),
|
|
3761
|
-
|
|
3762
|
-
|
|
3760
|
+
v,
|
|
3761
|
+
L,
|
|
3763
3762
|
U
|
|
3764
3763
|
),
|
|
3765
3764
|
isFullscreen() {
|
|
@@ -3795,7 +3794,7 @@ function fn(s = {}) {
|
|
|
3795
3794
|
}
|
|
3796
3795
|
));
|
|
3797
3796
|
if (a)
|
|
3798
|
-
return
|
|
3797
|
+
return V(a);
|
|
3799
3798
|
}
|
|
3800
3799
|
s.postEvent && ke.set(s.postEvent);
|
|
3801
3800
|
const [i, o] = Lt(
|