@tma.js/sdk 1.4.6 → 1.4.8
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/bridge/env/index.d.ts +0 -1
- package/dist/dts/index.d.ts +3 -3
- package/dist/dts/launch-params/index.d.ts +1 -4
- package/dist/dts/launch-params/retrieveFromLocation.d.ts +2 -2
- package/dist/dts/launch-params/retrieveFromPerformance.d.ts +3 -4
- package/dist/dts/launch-params/retrieveFromUrl.d.ts +3 -2
- package/dist/dts/launch-params/retrieveLaunchData.d.ts +1 -0
- package/dist/dts/launch-params/retrieveLaunchParams.d.ts +6 -0
- package/dist/dts/launch-params/storage.d.ts +3 -5
- package/dist/dts/{launch-params → misc}/getFirstNavigationEntry.d.ts +1 -1
- package/dist/dts/misc/index.d.ts +3 -0
- package/dist/dts/{bridge/env → misc}/isIframe.d.ts +1 -1
- package/dist/dts/misc/isPageReload.d.ts +5 -0
- package/dist/index.cjs +1 -1
- package/dist/index.iife.js +1 -1
- package/dist/index.mjs +843 -865
- package/package.json +1 -1
- package/dist/dts/launch-params/computeLaunchData.d.ts +0 -6
- package/dist/dts/launch-params/computePageReload.d.ts +0 -6
- package/dist/dts/launch-params/retrieveCurrent.d.ts +0 -5
package/dist/index.mjs
CHANGED
|
@@ -1,81 +1,88 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var o = (r,
|
|
4
|
-
function
|
|
5
|
-
return
|
|
1
|
+
var Re = Object.defineProperty;
|
|
2
|
+
var Ie = (r, e, t) => e in r ? Re(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
|
|
3
|
+
var o = (r, e, t) => (Ie(r, typeof e != "symbol" ? e + "" : e, t), t);
|
|
4
|
+
function ue() {
|
|
5
|
+
return performance.getEntriesByType("navigation")[0];
|
|
6
6
|
}
|
|
7
|
-
function
|
|
8
|
-
|
|
7
|
+
function pe() {
|
|
8
|
+
try {
|
|
9
|
+
return window.self !== window.top;
|
|
10
|
+
} catch {
|
|
11
|
+
return !0;
|
|
12
|
+
}
|
|
9
13
|
}
|
|
10
|
-
function
|
|
11
|
-
|
|
12
|
-
return r ? r.type === "reload"
|
|
14
|
+
function le() {
|
|
15
|
+
var r;
|
|
16
|
+
return ((r = ue()) == null ? void 0 : r.type) === "reload";
|
|
17
|
+
}
|
|
18
|
+
function R(r) {
|
|
19
|
+
return typeof r == "object" && r !== null && !Array.isArray(r);
|
|
13
20
|
}
|
|
14
21
|
function L() {
|
|
15
22
|
return new TypeError("Value has unexpected type");
|
|
16
23
|
}
|
|
17
24
|
class F extends Error {
|
|
18
|
-
constructor(
|
|
25
|
+
constructor(t, { cause: s, type: n } = {}) {
|
|
19
26
|
super(`Unable to parse value${n ? ` as ${n}` : ""}`, { cause: s });
|
|
20
27
|
/**
|
|
21
28
|
* Parser name.
|
|
22
29
|
*/
|
|
23
30
|
o(this, "type");
|
|
24
|
-
this.value =
|
|
31
|
+
this.value = t, Object.setPrototypeOf(this, F.prototype), this.type = n;
|
|
25
32
|
}
|
|
26
33
|
}
|
|
27
34
|
class z {
|
|
28
|
-
constructor(
|
|
29
|
-
this.parser =
|
|
35
|
+
constructor(e, t, s) {
|
|
36
|
+
this.parser = e, this.isOptional = t, this.type = s;
|
|
30
37
|
}
|
|
31
|
-
parse(
|
|
32
|
-
if (!(this.isOptional &&
|
|
38
|
+
parse(e) {
|
|
39
|
+
if (!(this.isOptional && e === void 0))
|
|
33
40
|
try {
|
|
34
|
-
return this.parser(
|
|
35
|
-
} catch (
|
|
36
|
-
throw new F(
|
|
41
|
+
return this.parser(e);
|
|
42
|
+
} catch (t) {
|
|
43
|
+
throw new F(e, { type: this.type, cause: t });
|
|
37
44
|
}
|
|
38
45
|
}
|
|
39
46
|
optional() {
|
|
40
47
|
return this.isOptional = !0, this;
|
|
41
48
|
}
|
|
42
49
|
}
|
|
43
|
-
function
|
|
50
|
+
function Le(r) {
|
|
44
51
|
if (Array.isArray(r))
|
|
45
52
|
return r;
|
|
46
53
|
if (typeof r == "string")
|
|
47
54
|
try {
|
|
48
|
-
const
|
|
49
|
-
if (Array.isArray(
|
|
50
|
-
return
|
|
55
|
+
const e = JSON.parse(r);
|
|
56
|
+
if (Array.isArray(e))
|
|
57
|
+
return e;
|
|
51
58
|
} catch {
|
|
52
59
|
}
|
|
53
60
|
throw L();
|
|
54
61
|
}
|
|
55
|
-
class
|
|
56
|
-
constructor(
|
|
57
|
-
super(
|
|
62
|
+
class Te extends z {
|
|
63
|
+
constructor(t, s, n) {
|
|
64
|
+
super(Le, s, n);
|
|
58
65
|
o(this, "itemParser");
|
|
59
|
-
this.itemParser = typeof
|
|
66
|
+
this.itemParser = typeof t == "function" ? t : t.parse.bind(t);
|
|
60
67
|
}
|
|
61
|
-
parse(
|
|
62
|
-
const s = super.parse(
|
|
68
|
+
parse(t) {
|
|
69
|
+
const s = super.parse(t);
|
|
63
70
|
return s === void 0 ? s : s.map(this.itemParser);
|
|
64
71
|
}
|
|
65
|
-
of(
|
|
66
|
-
return this.itemParser = typeof
|
|
72
|
+
of(t) {
|
|
73
|
+
return this.itemParser = typeof t == "function" ? t : t.parse.bind(t), this;
|
|
67
74
|
}
|
|
68
75
|
}
|
|
69
|
-
function
|
|
70
|
-
return () => new z(r, !1,
|
|
76
|
+
function T(r, e) {
|
|
77
|
+
return () => new z(r, !1, e);
|
|
71
78
|
}
|
|
72
79
|
class j extends Error {
|
|
73
|
-
constructor(
|
|
74
|
-
super(`Unable to parse field "${
|
|
80
|
+
constructor(e, { cause: t, type: s } = {}) {
|
|
81
|
+
super(`Unable to parse field "${e}"${s ? ` as ${s}` : ""}`, { cause: t }), Object.setPrototypeOf(this, j.prototype);
|
|
75
82
|
}
|
|
76
83
|
}
|
|
77
|
-
function
|
|
78
|
-
const
|
|
84
|
+
function de(r, e) {
|
|
85
|
+
const t = {};
|
|
79
86
|
for (const s in r) {
|
|
80
87
|
const n = r[s];
|
|
81
88
|
if (!n)
|
|
@@ -84,121 +91,121 @@ function pt(r, t) {
|
|
|
84
91
|
if (typeof n == "function" || "parse" in n)
|
|
85
92
|
i = s, a = typeof n == "function" ? n : n.parse.bind(n);
|
|
86
93
|
else {
|
|
87
|
-
const { type:
|
|
88
|
-
i = n.from || s, a = typeof
|
|
94
|
+
const { type: p } = n;
|
|
95
|
+
i = n.from || s, a = typeof p == "function" ? p : p.parse.bind(p);
|
|
89
96
|
}
|
|
90
97
|
let c;
|
|
91
|
-
const
|
|
98
|
+
const u = e(i);
|
|
92
99
|
try {
|
|
93
|
-
c = a(
|
|
94
|
-
} catch (
|
|
95
|
-
throw
|
|
96
|
-
type:
|
|
97
|
-
cause:
|
|
98
|
-
}) : new j(i, { cause:
|
|
100
|
+
c = a(u);
|
|
101
|
+
} catch (p) {
|
|
102
|
+
throw p instanceof F ? new j(i, {
|
|
103
|
+
type: p.type,
|
|
104
|
+
cause: p
|
|
105
|
+
}) : new j(i, { cause: p });
|
|
99
106
|
}
|
|
100
|
-
c !== void 0 && (
|
|
107
|
+
c !== void 0 && (t[s] = c);
|
|
101
108
|
}
|
|
102
|
-
return
|
|
109
|
+
return t;
|
|
103
110
|
}
|
|
104
|
-
function
|
|
105
|
-
return new
|
|
111
|
+
function $e(r) {
|
|
112
|
+
return new Te((e) => e, !1, r);
|
|
106
113
|
}
|
|
107
|
-
const k =
|
|
114
|
+
const k = T((r) => {
|
|
108
115
|
if (typeof r == "boolean")
|
|
109
116
|
return r;
|
|
110
|
-
const
|
|
111
|
-
if (
|
|
117
|
+
const e = String(r);
|
|
118
|
+
if (e === "1" || e === "true")
|
|
112
119
|
return !0;
|
|
113
|
-
if (
|
|
120
|
+
if (e === "0" || e === "false")
|
|
114
121
|
return !1;
|
|
115
122
|
throw L();
|
|
116
|
-
}, "boolean"),
|
|
123
|
+
}, "boolean"), A = T((r) => {
|
|
117
124
|
if (typeof r == "number")
|
|
118
125
|
return r;
|
|
119
126
|
if (typeof r == "string") {
|
|
120
|
-
const
|
|
121
|
-
if (!Number.isNaN(
|
|
122
|
-
return
|
|
127
|
+
const e = Number(r);
|
|
128
|
+
if (!Number.isNaN(e))
|
|
129
|
+
return e;
|
|
123
130
|
}
|
|
124
131
|
throw L();
|
|
125
|
-
}, "number"),
|
|
132
|
+
}, "number"), fe = T((r) => r instanceof Date ? r : new Date(A().parse(r) * 1e3), "Date");
|
|
126
133
|
function Y(r) {
|
|
127
|
-
let
|
|
128
|
-
if (typeof
|
|
134
|
+
let e = r;
|
|
135
|
+
if (typeof e == "string" && (e = JSON.parse(e)), typeof e != "object" || e === null || Array.isArray(e))
|
|
129
136
|
throw L();
|
|
130
|
-
return
|
|
137
|
+
return e;
|
|
131
138
|
}
|
|
132
|
-
function f(r,
|
|
133
|
-
return new z((
|
|
134
|
-
const s = Y(
|
|
135
|
-
return
|
|
136
|
-
}, !1,
|
|
139
|
+
function f(r, e) {
|
|
140
|
+
return new z((t) => {
|
|
141
|
+
const s = Y(t);
|
|
142
|
+
return de(r, (n) => s[n]);
|
|
143
|
+
}, !1, e);
|
|
137
144
|
}
|
|
138
145
|
function X(r) {
|
|
139
146
|
return /^#[\da-f]{6}$/i.test(r);
|
|
140
147
|
}
|
|
141
|
-
function
|
|
148
|
+
function Be(r) {
|
|
142
149
|
return /^#[\da-f]{3}$/i.test(r);
|
|
143
150
|
}
|
|
144
|
-
function
|
|
145
|
-
const
|
|
146
|
-
if (X(
|
|
147
|
-
return
|
|
148
|
-
if (
|
|
151
|
+
function ge(r) {
|
|
152
|
+
const e = r.replace(/\s/g, "").toLowerCase();
|
|
153
|
+
if (X(e))
|
|
154
|
+
return e;
|
|
155
|
+
if (Be(e)) {
|
|
149
156
|
let s = "#";
|
|
150
157
|
for (let n = 0; n < 3; n += 1)
|
|
151
|
-
s +=
|
|
158
|
+
s += e[1 + n].repeat(2);
|
|
152
159
|
return s;
|
|
153
160
|
}
|
|
154
|
-
const
|
|
155
|
-
if (
|
|
161
|
+
const t = e.match(/^rgb\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/) || e.match(/^rgba\((\d{1,3}),(\d{1,3}),(\d{1,3}),\d{1,3}\)$/);
|
|
162
|
+
if (t === null)
|
|
156
163
|
throw new Error(`Value "${r}" does not satisfy any of known RGB formats.`);
|
|
157
|
-
return
|
|
164
|
+
return t.slice(1).reduce((s, n) => {
|
|
158
165
|
const i = parseInt(n, 10).toString(16);
|
|
159
166
|
return s + (i.length === 1 ? "0" : "") + i;
|
|
160
167
|
}, "#");
|
|
161
168
|
}
|
|
162
|
-
function
|
|
163
|
-
const
|
|
169
|
+
function we(r) {
|
|
170
|
+
const e = ge(r);
|
|
164
171
|
return Math.sqrt(
|
|
165
172
|
[0.299, 0.587, 0.114].reduce((s, n, i) => {
|
|
166
|
-
const a = parseInt(
|
|
173
|
+
const a = parseInt(e.slice(1 + i * 2, 1 + (i + 1) * 2), 16);
|
|
167
174
|
return s + a * a * n;
|
|
168
175
|
}, 0)
|
|
169
176
|
) < 120;
|
|
170
177
|
}
|
|
171
|
-
const
|
|
178
|
+
const h = T((r) => {
|
|
172
179
|
if (typeof r == "string" || typeof r == "number")
|
|
173
180
|
return r.toString();
|
|
174
181
|
throw L();
|
|
175
|
-
}, "string"),
|
|
176
|
-
function
|
|
177
|
-
return new z((
|
|
178
|
-
if (typeof
|
|
182
|
+
}, "string"), _e = T((r) => ge(h().parse(r)), "rgb");
|
|
183
|
+
function ee(r, e) {
|
|
184
|
+
return new z((t) => {
|
|
185
|
+
if (typeof t != "string" && !(t instanceof URLSearchParams))
|
|
179
186
|
throw L();
|
|
180
|
-
const s = typeof
|
|
181
|
-
return
|
|
187
|
+
const s = typeof t == "string" ? new URLSearchParams(t) : t;
|
|
188
|
+
return de(r, (n) => {
|
|
182
189
|
const i = s.get(n);
|
|
183
190
|
return i === null ? void 0 : i;
|
|
184
191
|
});
|
|
185
|
-
}, !1,
|
|
192
|
+
}, !1, e);
|
|
186
193
|
}
|
|
187
|
-
function
|
|
194
|
+
function De() {
|
|
188
195
|
return f({
|
|
189
|
-
id:
|
|
190
|
-
type:
|
|
191
|
-
title:
|
|
196
|
+
id: A(),
|
|
197
|
+
type: h(),
|
|
198
|
+
title: h(),
|
|
192
199
|
photoUrl: {
|
|
193
|
-
type:
|
|
200
|
+
type: h().optional(),
|
|
194
201
|
from: "photo_url"
|
|
195
202
|
},
|
|
196
|
-
username:
|
|
203
|
+
username: h().optional()
|
|
197
204
|
}, "Chat");
|
|
198
205
|
}
|
|
199
|
-
class
|
|
200
|
-
constructor(
|
|
201
|
-
this.initData =
|
|
206
|
+
class We {
|
|
207
|
+
constructor(e) {
|
|
208
|
+
this.initData = e;
|
|
202
209
|
}
|
|
203
210
|
/**
|
|
204
211
|
* @see InitDataParsed.authDate
|
|
@@ -217,8 +224,8 @@ class Nt {
|
|
|
217
224
|
* the [answerWebAppQuery](https://core.telegram.org/bots/api#answerwebappquery) method.
|
|
218
225
|
*/
|
|
219
226
|
get canSendAfterDate() {
|
|
220
|
-
const { canSendAfter:
|
|
221
|
-
return
|
|
227
|
+
const { canSendAfter: e } = this;
|
|
228
|
+
return e === void 0 ? void 0 : new Date(this.authDate.getTime() + e * 1e3);
|
|
222
229
|
}
|
|
223
230
|
/**
|
|
224
231
|
* @see InitDataParsed.chat
|
|
@@ -269,7 +276,7 @@ class Nt {
|
|
|
269
276
|
return this.initData.user;
|
|
270
277
|
}
|
|
271
278
|
}
|
|
272
|
-
function
|
|
279
|
+
function ne() {
|
|
273
280
|
return f({
|
|
274
281
|
addedToAttachmentMenu: {
|
|
275
282
|
type: k().optional(),
|
|
@@ -280,10 +287,10 @@ function st() {
|
|
|
280
287
|
from: "allows_write_to_pm"
|
|
281
288
|
},
|
|
282
289
|
firstName: {
|
|
283
|
-
type:
|
|
290
|
+
type: h(),
|
|
284
291
|
from: "first_name"
|
|
285
292
|
},
|
|
286
|
-
id:
|
|
293
|
+
id: A(),
|
|
287
294
|
isBot: {
|
|
288
295
|
type: k().optional(),
|
|
289
296
|
from: "is_bot"
|
|
@@ -293,77 +300,77 @@ function st() {
|
|
|
293
300
|
from: "is_premium"
|
|
294
301
|
},
|
|
295
302
|
languageCode: {
|
|
296
|
-
type:
|
|
303
|
+
type: h().optional(),
|
|
297
304
|
from: "language_code"
|
|
298
305
|
},
|
|
299
306
|
lastName: {
|
|
300
|
-
type:
|
|
307
|
+
type: h().optional(),
|
|
301
308
|
from: "last_name"
|
|
302
309
|
},
|
|
303
310
|
photoUrl: {
|
|
304
|
-
type:
|
|
311
|
+
type: h().optional(),
|
|
305
312
|
from: "photo_url"
|
|
306
313
|
},
|
|
307
|
-
username:
|
|
314
|
+
username: h().optional()
|
|
308
315
|
}, "User");
|
|
309
316
|
}
|
|
310
|
-
function
|
|
311
|
-
return
|
|
317
|
+
function be() {
|
|
318
|
+
return ee({
|
|
312
319
|
authDate: {
|
|
313
|
-
type:
|
|
320
|
+
type: fe(),
|
|
314
321
|
from: "auth_date"
|
|
315
322
|
},
|
|
316
323
|
canSendAfter: {
|
|
317
|
-
type:
|
|
324
|
+
type: A().optional(),
|
|
318
325
|
from: "can_send_after"
|
|
319
326
|
},
|
|
320
|
-
chat:
|
|
327
|
+
chat: De().optional(),
|
|
321
328
|
chatInstance: {
|
|
322
|
-
type:
|
|
329
|
+
type: h().optional(),
|
|
323
330
|
from: "chat_instance"
|
|
324
331
|
},
|
|
325
332
|
chatType: {
|
|
326
|
-
type:
|
|
333
|
+
type: h().optional(),
|
|
327
334
|
from: "chat_type"
|
|
328
335
|
},
|
|
329
|
-
hash:
|
|
336
|
+
hash: h(),
|
|
330
337
|
queryId: {
|
|
331
|
-
type:
|
|
338
|
+
type: h().optional(),
|
|
332
339
|
from: "query_id"
|
|
333
340
|
},
|
|
334
|
-
receiver:
|
|
341
|
+
receiver: ne().optional(),
|
|
335
342
|
startParam: {
|
|
336
|
-
type:
|
|
343
|
+
type: h().optional(),
|
|
337
344
|
from: "start_param"
|
|
338
345
|
},
|
|
339
|
-
user:
|
|
346
|
+
user: ne().optional()
|
|
340
347
|
}, "InitData");
|
|
341
348
|
}
|
|
342
|
-
function
|
|
343
|
-
return
|
|
349
|
+
function Zt(r) {
|
|
350
|
+
return be().parse(r);
|
|
344
351
|
}
|
|
345
|
-
function
|
|
346
|
-
return r.replace(/(^|_)bg/, (
|
|
352
|
+
function Oe(r) {
|
|
353
|
+
return r.replace(/(^|_)bg/, (e, t) => `${t}background`).replace(/_([a-z])/g, (e, t) => t.toUpperCase());
|
|
347
354
|
}
|
|
348
|
-
function
|
|
349
|
-
return r.replace(/[A-Z]/g, (
|
|
355
|
+
function He(r) {
|
|
356
|
+
return r.replace(/[A-Z]/g, (e) => `_${e.toLowerCase()}`).replace(/(^|_)background/, (e, t) => `${t}bg`);
|
|
350
357
|
}
|
|
351
|
-
const
|
|
358
|
+
const me = T(
|
|
352
359
|
(r) => {
|
|
353
|
-
const
|
|
354
|
-
return Object.entries(Y(r)).reduce((
|
|
360
|
+
const e = _e().optional();
|
|
361
|
+
return Object.entries(Y(r)).reduce((t, [s, n]) => (t[Oe(s)] = e.parse(n), t), {});
|
|
355
362
|
},
|
|
356
363
|
"ThemeParams"
|
|
357
364
|
);
|
|
358
|
-
function
|
|
359
|
-
return
|
|
365
|
+
function ye(r) {
|
|
366
|
+
return me().parse(r);
|
|
360
367
|
}
|
|
361
|
-
function
|
|
362
|
-
return m("web_app_request_theme", "theme_changed", r).then(
|
|
368
|
+
function Kt(r = {}) {
|
|
369
|
+
return m("web_app_request_theme", "theme_changed", r).then(ye);
|
|
363
370
|
}
|
|
364
|
-
function
|
|
371
|
+
function Ne(r) {
|
|
365
372
|
return JSON.stringify(
|
|
366
|
-
Object.entries(r).reduce((
|
|
373
|
+
Object.entries(r).reduce((e, [t, s]) => (s && (e[He(t)] = s), e), {})
|
|
367
374
|
);
|
|
368
375
|
}
|
|
369
376
|
class w {
|
|
@@ -377,15 +384,15 @@ class w {
|
|
|
377
384
|
* @param listener - event listener.
|
|
378
385
|
* @param once - should listener called only once.
|
|
379
386
|
*/
|
|
380
|
-
addListener(
|
|
381
|
-
let n = this.listeners.get(
|
|
382
|
-
return n || (n = [], this.listeners.set(
|
|
387
|
+
addListener(e, t, s) {
|
|
388
|
+
let n = this.listeners.get(e);
|
|
389
|
+
return n || (n = [], this.listeners.set(e, n)), n.push([t, s]), () => this.off(e, t);
|
|
383
390
|
}
|
|
384
|
-
emit(
|
|
385
|
-
this.subscribeListeners.forEach((n) => n(
|
|
386
|
-
const s = this.listeners.get(
|
|
391
|
+
emit(e, ...t) {
|
|
392
|
+
this.subscribeListeners.forEach((n) => n(e, ...t));
|
|
393
|
+
const s = this.listeners.get(e);
|
|
387
394
|
s && s.forEach(([n, i], a) => {
|
|
388
|
-
n(...
|
|
395
|
+
n(...t), i && s.splice(a, 1);
|
|
389
396
|
});
|
|
390
397
|
}
|
|
391
398
|
/**
|
|
@@ -394,8 +401,8 @@ class w {
|
|
|
394
401
|
* @param listener - event listener.
|
|
395
402
|
* @returns Function to remove event listener.
|
|
396
403
|
*/
|
|
397
|
-
on(
|
|
398
|
-
return this.addListener(
|
|
404
|
+
on(e, t) {
|
|
405
|
+
return this.addListener(e, t, !1);
|
|
399
406
|
}
|
|
400
407
|
/**
|
|
401
408
|
* Adds event listener following the logic, described in `on` method, but calls specified
|
|
@@ -405,8 +412,8 @@ class w {
|
|
|
405
412
|
* @returns Function to remove event listener.
|
|
406
413
|
* @see on
|
|
407
414
|
*/
|
|
408
|
-
once(
|
|
409
|
-
return this.addListener(
|
|
415
|
+
once(e, t) {
|
|
416
|
+
return this.addListener(e, t, !0);
|
|
410
417
|
}
|
|
411
418
|
/**
|
|
412
419
|
* Removes event listener. In case, specified listener was bound several times, it removes
|
|
@@ -414,11 +421,11 @@ class w {
|
|
|
414
421
|
* @param event - event name.
|
|
415
422
|
* @param listener - event listener.
|
|
416
423
|
*/
|
|
417
|
-
off(
|
|
418
|
-
const s = this.listeners.get(
|
|
424
|
+
off(e, t) {
|
|
425
|
+
const s = this.listeners.get(e);
|
|
419
426
|
if (s) {
|
|
420
427
|
for (let n = 0; n < s.length; n += 1)
|
|
421
|
-
if (
|
|
428
|
+
if (t === s[n][0]) {
|
|
422
429
|
s.splice(n, 1);
|
|
423
430
|
return;
|
|
424
431
|
}
|
|
@@ -431,8 +438,8 @@ class w {
|
|
|
431
438
|
* @see on
|
|
432
439
|
* @see once
|
|
433
440
|
*/
|
|
434
|
-
subscribe(
|
|
435
|
-
return this.subscribeListeners.push(
|
|
441
|
+
subscribe(e) {
|
|
442
|
+
return this.subscribeListeners.push(e), () => this.unsubscribe(e);
|
|
436
443
|
}
|
|
437
444
|
/**
|
|
438
445
|
* Removes global event listener. In case, specified listener was bound several times, it removes
|
|
@@ -440,20 +447,20 @@ class w {
|
|
|
440
447
|
* @param listener - events listener.
|
|
441
448
|
* @returns Function to remove event listener.
|
|
442
449
|
*/
|
|
443
|
-
unsubscribe(
|
|
444
|
-
for (let
|
|
445
|
-
if (this.subscribeListeners[
|
|
446
|
-
this.subscribeListeners.splice(
|
|
450
|
+
unsubscribe(e) {
|
|
451
|
+
for (let t = 0; t < this.subscribeListeners.length; t += 1)
|
|
452
|
+
if (this.subscribeListeners[t] === e) {
|
|
453
|
+
this.subscribeListeners.splice(t, 1);
|
|
447
454
|
return;
|
|
448
455
|
}
|
|
449
456
|
}
|
|
450
457
|
}
|
|
451
458
|
class b {
|
|
452
|
-
constructor(
|
|
453
|
-
this.state =
|
|
459
|
+
constructor(e, t) {
|
|
460
|
+
this.state = e, this.ee = t;
|
|
454
461
|
}
|
|
455
|
-
internalSet(
|
|
456
|
-
return this.state[
|
|
462
|
+
internalSet(e, t) {
|
|
463
|
+
return this.state[e] === t || t === void 0 ? !1 : (this.state[e] = t, this.ee.emit(`change:${e}`, t), !0);
|
|
457
464
|
}
|
|
458
465
|
/**
|
|
459
466
|
* Returns copy of current state.
|
|
@@ -461,25 +468,25 @@ class b {
|
|
|
461
468
|
clone() {
|
|
462
469
|
return { ...this.state };
|
|
463
470
|
}
|
|
464
|
-
set(
|
|
471
|
+
set(e, t) {
|
|
465
472
|
let s = !1;
|
|
466
|
-
if (typeof
|
|
467
|
-
s = this.internalSet(
|
|
473
|
+
if (typeof e == "string")
|
|
474
|
+
s = this.internalSet(e, t);
|
|
468
475
|
else
|
|
469
|
-
for (const n in
|
|
470
|
-
this.internalSet(n,
|
|
476
|
+
for (const n in e)
|
|
477
|
+
this.internalSet(n, e[n]) && (s = !0);
|
|
471
478
|
s && this.ee.emit("change");
|
|
472
479
|
}
|
|
473
480
|
/**
|
|
474
481
|
* Returns value by specified key.
|
|
475
482
|
* @param key - state key.
|
|
476
483
|
*/
|
|
477
|
-
get(
|
|
478
|
-
return this.state[
|
|
484
|
+
get(e) {
|
|
485
|
+
return this.state[e];
|
|
479
486
|
}
|
|
480
487
|
}
|
|
481
|
-
class
|
|
482
|
-
constructor(
|
|
488
|
+
class Ue {
|
|
489
|
+
constructor(e) {
|
|
483
490
|
o(this, "ee", new w());
|
|
484
491
|
o(this, "state");
|
|
485
492
|
/**
|
|
@@ -490,7 +497,7 @@ class Mt {
|
|
|
490
497
|
* Removes event listener.
|
|
491
498
|
*/
|
|
492
499
|
o(this, "off", this.ee.off.bind(this.ee));
|
|
493
|
-
this.state = new b(
|
|
500
|
+
this.state = new b(e, this.ee);
|
|
494
501
|
}
|
|
495
502
|
/**
|
|
496
503
|
* @since v6.10
|
|
@@ -514,8 +521,8 @@ class Mt {
|
|
|
514
521
|
* Retrieves palette color value by its name.
|
|
515
522
|
* @param key - palette key name.
|
|
516
523
|
*/
|
|
517
|
-
get(
|
|
518
|
-
return this.state.get(
|
|
524
|
+
get(e) {
|
|
525
|
+
return this.state.get(e);
|
|
519
526
|
}
|
|
520
527
|
/**
|
|
521
528
|
* Returns the copy of the internal state of the current component instance.
|
|
@@ -537,7 +544,7 @@ class Mt {
|
|
|
537
544
|
* value is calculated according to theme background color.
|
|
538
545
|
*/
|
|
539
546
|
get isDark() {
|
|
540
|
-
return !this.backgroundColor ||
|
|
547
|
+
return !this.backgroundColor || we(this.backgroundColor);
|
|
541
548
|
}
|
|
542
549
|
get linkColor() {
|
|
543
550
|
return this.get("linkColor");
|
|
@@ -562,8 +569,8 @@ class Mt {
|
|
|
562
569
|
* @returns Function to stop listening.
|
|
563
570
|
*/
|
|
564
571
|
listen() {
|
|
565
|
-
return y("theme_changed", (
|
|
566
|
-
this.state.set(
|
|
572
|
+
return y("theme_changed", (e) => {
|
|
573
|
+
this.state.set(ye(e.theme_params));
|
|
567
574
|
});
|
|
568
575
|
}
|
|
569
576
|
/**
|
|
@@ -576,22 +583,22 @@ class Mt {
|
|
|
576
583
|
return this.get("textColor");
|
|
577
584
|
}
|
|
578
585
|
}
|
|
579
|
-
function
|
|
580
|
-
return
|
|
586
|
+
function Me() {
|
|
587
|
+
return ee({
|
|
581
588
|
botInline: {
|
|
582
589
|
type: k().optional(),
|
|
583
590
|
from: "tgWebAppBotInline"
|
|
584
591
|
},
|
|
585
592
|
initData: {
|
|
586
|
-
type:
|
|
593
|
+
type: be().optional(),
|
|
587
594
|
from: "tgWebAppData"
|
|
588
595
|
},
|
|
589
596
|
initDataRaw: {
|
|
590
|
-
type:
|
|
597
|
+
type: h().optional(),
|
|
591
598
|
from: "tgWebAppData"
|
|
592
599
|
},
|
|
593
600
|
platform: {
|
|
594
|
-
type:
|
|
601
|
+
type: h(),
|
|
595
602
|
from: "tgWebAppPlatform"
|
|
596
603
|
},
|
|
597
604
|
showSettings: {
|
|
@@ -599,142 +606,45 @@ function mt() {
|
|
|
599
606
|
from: "tgWebAppShowSettings"
|
|
600
607
|
},
|
|
601
608
|
startParam: {
|
|
602
|
-
type:
|
|
609
|
+
type: h().optional(),
|
|
603
610
|
from: "tgWebAppStartParam"
|
|
604
611
|
},
|
|
605
612
|
themeParams: {
|
|
606
|
-
type:
|
|
613
|
+
type: me(),
|
|
607
614
|
from: "tgWebAppThemeParams"
|
|
608
615
|
},
|
|
609
616
|
version: {
|
|
610
|
-
type:
|
|
617
|
+
type: h(),
|
|
611
618
|
from: "tgWebAppVersion"
|
|
612
619
|
}
|
|
613
620
|
}, "LaunchParams");
|
|
614
621
|
}
|
|
615
|
-
function
|
|
616
|
-
return
|
|
622
|
+
function Ee(r) {
|
|
623
|
+
return Me().parse(r);
|
|
617
624
|
}
|
|
618
|
-
function
|
|
619
|
-
const
|
|
620
|
-
return
|
|
625
|
+
function Ce(r) {
|
|
626
|
+
const e = r.includes("?") ? r.replace("#", "&").slice(r.indexOf("?") + 1) : r.slice(r.indexOf("#") + 1);
|
|
627
|
+
return Ee(e);
|
|
621
628
|
}
|
|
622
|
-
function
|
|
623
|
-
return
|
|
629
|
+
function Ge() {
|
|
630
|
+
return Ce(window.location.href);
|
|
624
631
|
}
|
|
625
|
-
function
|
|
626
|
-
const r =
|
|
632
|
+
function je() {
|
|
633
|
+
const r = ue();
|
|
627
634
|
if (!r)
|
|
628
635
|
throw new Error("Unable to get first navigation entry.");
|
|
629
|
-
return
|
|
630
|
-
}
|
|
631
|
-
function zt() {
|
|
632
|
-
try {
|
|
633
|
-
return Ft();
|
|
634
|
-
} catch {
|
|
635
|
-
}
|
|
636
|
-
try {
|
|
637
|
-
return jt();
|
|
638
|
-
} catch {
|
|
639
|
-
}
|
|
640
|
-
return null;
|
|
641
|
-
}
|
|
642
|
-
function Jt(r) {
|
|
643
|
-
const {
|
|
644
|
-
initDataRaw: t,
|
|
645
|
-
themeParams: e,
|
|
646
|
-
platform: s,
|
|
647
|
-
version: n,
|
|
648
|
-
showSettings: i,
|
|
649
|
-
botInline: a
|
|
650
|
-
} = r, c = new URLSearchParams();
|
|
651
|
-
return t && c.set("tgWebAppData", t), c.set("tgWebAppPlatform", s), c.set("tgWebAppThemeParams", Ut(e)), c.set("tgWebAppVersion", n), typeof i == "boolean" && c.set("tgWebAppShowSettings", i ? "1" : "0"), typeof a == "boolean" && c.set("tgWebAppBotInline", a ? "1" : "0"), c.toString();
|
|
652
|
-
}
|
|
653
|
-
const Et = "telegram-mini-apps-launch-params";
|
|
654
|
-
function Qt() {
|
|
655
|
-
const r = sessionStorage.getItem(Et);
|
|
656
|
-
return r ? mt().parse(r) : null;
|
|
657
|
-
}
|
|
658
|
-
function Zt(r) {
|
|
659
|
-
sessionStorage.setItem(Et, Jt(r));
|
|
660
|
-
}
|
|
661
|
-
function Kt() {
|
|
662
|
-
try {
|
|
663
|
-
return window.self !== window.top;
|
|
664
|
-
} catch {
|
|
665
|
-
return !0;
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
function Yt() {
|
|
669
|
-
const r = Qt(), t = zt(), e = Lt();
|
|
670
|
-
if (r) {
|
|
671
|
-
if (t)
|
|
672
|
-
return {
|
|
673
|
-
launchParams: t,
|
|
674
|
-
isPageReload: Kt() ? e || r.initDataRaw === t.initDataRaw : !0
|
|
675
|
-
};
|
|
676
|
-
if (e)
|
|
677
|
-
return {
|
|
678
|
-
launchParams: r,
|
|
679
|
-
isPageReload: e
|
|
680
|
-
};
|
|
681
|
-
throw new Error("Unable to retrieve current launch parameters, which must exist.");
|
|
682
|
-
}
|
|
683
|
-
if (t)
|
|
684
|
-
return {
|
|
685
|
-
launchParams: t,
|
|
686
|
-
isPageReload: !1
|
|
687
|
-
};
|
|
688
|
-
throw new Error("Unable to retrieve any launch parameters.");
|
|
689
|
-
}
|
|
690
|
-
const nt = "tmajsLaunchData";
|
|
691
|
-
function Ct() {
|
|
692
|
-
const r = window[nt];
|
|
693
|
-
if (r)
|
|
694
|
-
return r;
|
|
695
|
-
const t = Yt();
|
|
696
|
-
return window[nt] = t, Zt(t.launchParams), t;
|
|
697
|
-
}
|
|
698
|
-
function rr() {
|
|
699
|
-
try {
|
|
700
|
-
return Ct(), !0;
|
|
701
|
-
} catch {
|
|
702
|
-
return !1;
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
function Xt(r) {
|
|
706
|
-
return "external" in r && R(r.external) && "notify" in r.external && typeof r.external.notify == "function";
|
|
707
|
-
}
|
|
708
|
-
function te(r) {
|
|
709
|
-
return "TelegramWebviewProxy" in r && R(r.TelegramWebviewProxy) && "postEvent" in r.TelegramWebviewProxy && typeof r.TelegramWebviewProxy.postEvent == "function";
|
|
710
|
-
}
|
|
711
|
-
function vt() {
|
|
712
|
-
try {
|
|
713
|
-
return window.self !== window.top;
|
|
714
|
-
} catch {
|
|
715
|
-
return !0;
|
|
716
|
-
}
|
|
636
|
+
return Ce(r.name);
|
|
717
637
|
}
|
|
718
|
-
class
|
|
719
|
-
constructor(
|
|
720
|
-
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
class rt extends Error {
|
|
724
|
-
constructor(t, e, s) {
|
|
725
|
-
super(`Parameter "${e}" in method "${t}" is unsupported in the Mini Apps version ${s}.`), Object.setPrototypeOf(this, rt.prototype);
|
|
726
|
-
}
|
|
727
|
-
}
|
|
728
|
-
class Pt {
|
|
729
|
-
constructor(t, e) {
|
|
730
|
-
this.prefix = t, this.enabled = e;
|
|
638
|
+
class ve {
|
|
639
|
+
constructor(e, t) {
|
|
640
|
+
this.prefix = e, this.enabled = t;
|
|
731
641
|
}
|
|
732
642
|
/**
|
|
733
643
|
* Prints message into a console in case, logger is currently enabled.
|
|
734
644
|
* @param level - log level.
|
|
735
645
|
* @param args - arguments.
|
|
736
646
|
*/
|
|
737
|
-
print(
|
|
647
|
+
print(e, ...t) {
|
|
738
648
|
if (!this.enabled)
|
|
739
649
|
return;
|
|
740
650
|
const s = /* @__PURE__ */ new Date(), n = Intl.DateTimeFormat("en-GB", {
|
|
@@ -744,7 +654,7 @@ class Pt {
|
|
|
744
654
|
fractionalSecondDigits: 3,
|
|
745
655
|
timeZone: "UTC"
|
|
746
656
|
}).format(s);
|
|
747
|
-
console[
|
|
657
|
+
console[e](`[${n}]`, this.prefix, ...t);
|
|
748
658
|
}
|
|
749
659
|
/**
|
|
750
660
|
* Disables the logger.
|
|
@@ -756,8 +666,8 @@ class Pt {
|
|
|
756
666
|
* Prints error message into a console.
|
|
757
667
|
* @param args
|
|
758
668
|
*/
|
|
759
|
-
error(...
|
|
760
|
-
this.print("error", ...
|
|
669
|
+
error(...e) {
|
|
670
|
+
this.print("error", ...e);
|
|
761
671
|
}
|
|
762
672
|
/**
|
|
763
673
|
* Enables the logger.
|
|
@@ -769,47 +679,114 @@ class Pt {
|
|
|
769
679
|
* Prints log message into a console.
|
|
770
680
|
* @param args
|
|
771
681
|
*/
|
|
772
|
-
log(...
|
|
773
|
-
this.print("log", ...
|
|
682
|
+
log(...e) {
|
|
683
|
+
this.print("log", ...e);
|
|
774
684
|
}
|
|
775
685
|
/**
|
|
776
686
|
* Prints warning message into a console.
|
|
777
687
|
* @param args
|
|
778
688
|
*/
|
|
779
|
-
warn(...
|
|
780
|
-
this.print("warn", ...
|
|
689
|
+
warn(...e) {
|
|
690
|
+
this.print("warn", ...e);
|
|
781
691
|
}
|
|
782
692
|
}
|
|
783
|
-
let
|
|
784
|
-
const
|
|
785
|
-
function
|
|
693
|
+
let Pe = "https://web.telegram.org";
|
|
694
|
+
const q = new ve("[SDK]", !1);
|
|
695
|
+
function Yt(r) {
|
|
786
696
|
if (r) {
|
|
787
|
-
|
|
697
|
+
q.enable();
|
|
788
698
|
return;
|
|
789
699
|
}
|
|
790
|
-
|
|
700
|
+
q.disable();
|
|
791
701
|
}
|
|
792
|
-
function
|
|
793
|
-
|
|
702
|
+
function Xt(r) {
|
|
703
|
+
Pe = r;
|
|
704
|
+
}
|
|
705
|
+
function Fe() {
|
|
706
|
+
return Pe;
|
|
707
|
+
}
|
|
708
|
+
function ze(r) {
|
|
709
|
+
const {
|
|
710
|
+
initDataRaw: e,
|
|
711
|
+
themeParams: t,
|
|
712
|
+
platform: s,
|
|
713
|
+
version: n,
|
|
714
|
+
showSettings: i,
|
|
715
|
+
startParam: a,
|
|
716
|
+
botInline: c
|
|
717
|
+
} = r, u = new URLSearchParams();
|
|
718
|
+
return e && u.set("tgWebAppData", e), u.set("tgWebAppPlatform", s), u.set("tgWebAppThemeParams", Ne(t)), u.set("tgWebAppVersion", n), a && u.set("tgWebAppStartParam", n), typeof i == "boolean" && u.set("tgWebAppShowSettings", i ? "1" : "0"), typeof c == "boolean" && u.set("tgWebAppBotInline", c ? "1" : "0"), u.toString();
|
|
719
|
+
}
|
|
720
|
+
const ke = "telegram-mini-apps-launch-params";
|
|
721
|
+
function Je() {
|
|
722
|
+
return Ee(sessionStorage.getItem(ke) || "");
|
|
723
|
+
}
|
|
724
|
+
function Qe(r) {
|
|
725
|
+
sessionStorage.setItem(ke, ze(r));
|
|
726
|
+
}
|
|
727
|
+
function te() {
|
|
728
|
+
const r = [];
|
|
729
|
+
for (const e of [
|
|
730
|
+
// Try to retrieve launch parameters from the current location. This method can return
|
|
731
|
+
// nothing in case, location was changed and then page was reloaded.
|
|
732
|
+
Ge,
|
|
733
|
+
// Then, try using the lower level API - window.performance.
|
|
734
|
+
je,
|
|
735
|
+
// Finally, try to extract launch parameters from the session storage.
|
|
736
|
+
Je
|
|
737
|
+
])
|
|
738
|
+
try {
|
|
739
|
+
const t = e();
|
|
740
|
+
return Qe(t), t;
|
|
741
|
+
} catch (t) {
|
|
742
|
+
r.push(t);
|
|
743
|
+
}
|
|
744
|
+
throw q.error("Unable to extract launch parameters. Received errors:", r), new Error("Unable to retrieve launch parameters from any known source.");
|
|
745
|
+
}
|
|
746
|
+
function er() {
|
|
747
|
+
return {
|
|
748
|
+
launchParams: te(),
|
|
749
|
+
isPageReload: le()
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
function tr() {
|
|
753
|
+
try {
|
|
754
|
+
return te(), !0;
|
|
755
|
+
} catch {
|
|
756
|
+
return !1;
|
|
757
|
+
}
|
|
794
758
|
}
|
|
795
|
-
function
|
|
796
|
-
return
|
|
759
|
+
function Ze(r) {
|
|
760
|
+
return "external" in r && R(r.external) && "notify" in r.external && typeof r.external.notify == "function";
|
|
761
|
+
}
|
|
762
|
+
function Ke(r) {
|
|
763
|
+
return "TelegramWebviewProxy" in r && R(r.TelegramWebviewProxy) && "postEvent" in r.TelegramWebviewProxy && typeof r.TelegramWebviewProxy.postEvent == "function";
|
|
764
|
+
}
|
|
765
|
+
class re extends Error {
|
|
766
|
+
constructor(e, t) {
|
|
767
|
+
super(`Method "${e}" is unsupported in the Mini Apps version ${t}.`), Object.setPrototypeOf(this, re.prototype);
|
|
768
|
+
}
|
|
797
769
|
}
|
|
798
|
-
|
|
799
|
-
|
|
770
|
+
class se extends Error {
|
|
771
|
+
constructor(e, t, s) {
|
|
772
|
+
super(`Parameter "${t}" in method "${e}" is unsupported in the Mini Apps version ${s}.`), Object.setPrototypeOf(this, se.prototype);
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
const Ye = f({
|
|
776
|
+
eventType: h(),
|
|
800
777
|
eventData: (r) => r
|
|
801
778
|
});
|
|
802
|
-
function
|
|
803
|
-
return
|
|
779
|
+
function Xe(r) {
|
|
780
|
+
return Ye.parse(r);
|
|
804
781
|
}
|
|
805
|
-
function
|
|
782
|
+
function et(r, e) {
|
|
806
783
|
window.dispatchEvent(new MessageEvent("message", {
|
|
807
|
-
data: JSON.stringify({ eventType: r, eventData:
|
|
784
|
+
data: JSON.stringify({ eventType: r, eventData: e }),
|
|
808
785
|
// We specify window.parent to imitate the case, it sent us this event.
|
|
809
786
|
source: window.parent
|
|
810
787
|
}));
|
|
811
788
|
}
|
|
812
|
-
function
|
|
789
|
+
function tt() {
|
|
813
790
|
const r = window;
|
|
814
791
|
"TelegramGameProxy_receiveEvent" in r || [
|
|
815
792
|
["TelegramGameProxy_receiveEvent"],
|
|
@@ -818,168 +795,168 @@ function ie() {
|
|
|
818
795
|
// Desktop.
|
|
819
796
|
["Telegram", "WebView", "receiveEvent"]
|
|
820
797
|
// Android and iOS.
|
|
821
|
-
].forEach((
|
|
822
|
-
let
|
|
823
|
-
|
|
798
|
+
].forEach((e) => {
|
|
799
|
+
let t = r;
|
|
800
|
+
e.forEach((s, n, i) => {
|
|
824
801
|
if (n === i.length - 1) {
|
|
825
|
-
|
|
802
|
+
t[s] = et;
|
|
826
803
|
return;
|
|
827
804
|
}
|
|
828
|
-
s in
|
|
805
|
+
s in t || (t[s] = {}), t = t[s];
|
|
829
806
|
});
|
|
830
807
|
});
|
|
831
808
|
}
|
|
832
|
-
function
|
|
833
|
-
|
|
834
|
-
if (
|
|
809
|
+
function rt(r) {
|
|
810
|
+
tt(), window.addEventListener("message", (e) => {
|
|
811
|
+
if (e.source === window.parent)
|
|
835
812
|
try {
|
|
836
|
-
const { eventType:
|
|
837
|
-
r(
|
|
813
|
+
const { eventType: t, eventData: s } = Xe(e.data);
|
|
814
|
+
r(t, s);
|
|
838
815
|
} catch {
|
|
839
816
|
}
|
|
840
817
|
});
|
|
841
818
|
}
|
|
842
|
-
function
|
|
819
|
+
function st() {
|
|
843
820
|
return f({
|
|
844
|
-
req_id:
|
|
845
|
-
data: (r) => r === null ? r :
|
|
821
|
+
req_id: h(),
|
|
822
|
+
data: (r) => r === null ? r : h().optional().parse(r)
|
|
846
823
|
});
|
|
847
824
|
}
|
|
848
|
-
function
|
|
825
|
+
function nt() {
|
|
849
826
|
return f({
|
|
850
|
-
req_id:
|
|
827
|
+
req_id: h(),
|
|
851
828
|
result: (r) => r,
|
|
852
|
-
error:
|
|
829
|
+
error: h().optional()
|
|
853
830
|
});
|
|
854
831
|
}
|
|
855
|
-
function
|
|
832
|
+
function it() {
|
|
856
833
|
return f({
|
|
857
|
-
slug:
|
|
858
|
-
status:
|
|
834
|
+
slug: h(),
|
|
835
|
+
status: h()
|
|
859
836
|
});
|
|
860
837
|
}
|
|
861
|
-
function
|
|
862
|
-
return f({ status:
|
|
838
|
+
function ot() {
|
|
839
|
+
return f({ status: h() });
|
|
863
840
|
}
|
|
864
|
-
function
|
|
841
|
+
function at() {
|
|
865
842
|
return f({
|
|
866
|
-
button_id: (r) => r == null ? void 0 :
|
|
843
|
+
button_id: (r) => r == null ? void 0 : h().parse(r)
|
|
867
844
|
});
|
|
868
845
|
}
|
|
869
|
-
function
|
|
846
|
+
function ct() {
|
|
870
847
|
return f({
|
|
871
|
-
data:
|
|
848
|
+
data: h().optional()
|
|
872
849
|
});
|
|
873
850
|
}
|
|
874
|
-
function
|
|
851
|
+
function ht() {
|
|
875
852
|
return f({
|
|
876
853
|
theme_params: (r) => {
|
|
877
|
-
const
|
|
878
|
-
return Object.entries(Y(r)).reduce((
|
|
854
|
+
const e = _e().optional();
|
|
855
|
+
return Object.entries(Y(r)).reduce((t, [s, n]) => (t[s] = e.parse(n), t), {});
|
|
879
856
|
}
|
|
880
857
|
});
|
|
881
858
|
}
|
|
882
|
-
function
|
|
859
|
+
function ut() {
|
|
883
860
|
return f({
|
|
884
|
-
height:
|
|
885
|
-
width: (r) => r == null ? window.innerWidth :
|
|
861
|
+
height: A(),
|
|
862
|
+
width: (r) => r == null ? window.innerWidth : A().parse(r),
|
|
886
863
|
is_state_stable: k(),
|
|
887
864
|
is_expanded: k()
|
|
888
865
|
});
|
|
889
866
|
}
|
|
890
|
-
function
|
|
891
|
-
return f({ status:
|
|
867
|
+
function pt() {
|
|
868
|
+
return f({ status: h() });
|
|
892
869
|
}
|
|
893
|
-
function
|
|
894
|
-
const r = new w(),
|
|
895
|
-
|
|
870
|
+
function lt() {
|
|
871
|
+
const r = new w(), e = (t, ...s) => {
|
|
872
|
+
q.log("Emitting processed event:", t, ...s), r.emit(t, ...s);
|
|
896
873
|
};
|
|
897
874
|
return window.addEventListener("resize", () => {
|
|
898
|
-
|
|
875
|
+
e("viewport_changed", {
|
|
899
876
|
width: window.innerWidth,
|
|
900
877
|
height: window.innerHeight,
|
|
901
878
|
is_state_stable: !0,
|
|
902
879
|
is_expanded: !0
|
|
903
880
|
});
|
|
904
|
-
}),
|
|
905
|
-
|
|
881
|
+
}), rt((t, s) => {
|
|
882
|
+
q.log("Received raw event:", t, s);
|
|
906
883
|
try {
|
|
907
|
-
switch (
|
|
884
|
+
switch (t) {
|
|
908
885
|
case "viewport_changed":
|
|
909
|
-
return t
|
|
886
|
+
return e(t, ut().parse(s));
|
|
910
887
|
case "theme_changed":
|
|
911
|
-
return t
|
|
888
|
+
return e(t, ht().parse(s));
|
|
912
889
|
case "popup_closed":
|
|
913
890
|
return (
|
|
914
891
|
// Sent on desktop.
|
|
915
|
-
s == null ? t
|
|
892
|
+
s == null ? e(t, {}) : e(t, at().parse(s))
|
|
916
893
|
);
|
|
917
894
|
case "set_custom_style":
|
|
918
|
-
return t
|
|
895
|
+
return e(t, h().parse(s));
|
|
919
896
|
case "qr_text_received":
|
|
920
|
-
return t
|
|
897
|
+
return e(t, ct().parse(s));
|
|
921
898
|
case "clipboard_text_received":
|
|
922
|
-
return t
|
|
899
|
+
return e(t, st().parse(s));
|
|
923
900
|
case "invoice_closed":
|
|
924
|
-
return t
|
|
901
|
+
return e(t, it().parse(s));
|
|
925
902
|
case "phone_requested":
|
|
926
|
-
return
|
|
903
|
+
return e("phone_requested", ot().parse(s));
|
|
927
904
|
case "custom_method_invoked":
|
|
928
|
-
return
|
|
905
|
+
return e("custom_method_invoked", nt().parse(s));
|
|
929
906
|
case "write_access_requested":
|
|
930
|
-
return
|
|
907
|
+
return e("write_access_requested", pt().parse(s));
|
|
931
908
|
case "main_button_pressed":
|
|
932
909
|
case "back_button_pressed":
|
|
933
910
|
case "settings_button_pressed":
|
|
934
911
|
case "scan_qr_popup_closed":
|
|
935
912
|
case "reload_iframe":
|
|
936
|
-
return t
|
|
913
|
+
return e(t);
|
|
937
914
|
default:
|
|
938
|
-
return t
|
|
915
|
+
return e(t, s);
|
|
939
916
|
}
|
|
940
917
|
} catch (n) {
|
|
941
|
-
|
|
918
|
+
q.error("Error processing event:", n);
|
|
942
919
|
}
|
|
943
920
|
}), r;
|
|
944
921
|
}
|
|
945
922
|
const Q = "telegram-mini-apps-cached-emitter";
|
|
946
923
|
function U() {
|
|
947
924
|
const r = window;
|
|
948
|
-
return r[Q] === void 0 && (r[Q] =
|
|
925
|
+
return r[Q] === void 0 && (r[Q] = lt()), r[Q];
|
|
949
926
|
}
|
|
950
|
-
function
|
|
951
|
-
U().off(r,
|
|
927
|
+
function $(r, e) {
|
|
928
|
+
U().off(r, e);
|
|
952
929
|
}
|
|
953
|
-
function y(r,
|
|
954
|
-
return U().on(r,
|
|
930
|
+
function y(r, e) {
|
|
931
|
+
return U().on(r, e), () => $(r, e);
|
|
955
932
|
}
|
|
956
|
-
function
|
|
957
|
-
return U().once(r,
|
|
933
|
+
function rr(r, e) {
|
|
934
|
+
return U().once(r, e), () => $(r, e);
|
|
958
935
|
}
|
|
959
|
-
function
|
|
936
|
+
function dt(r) {
|
|
960
937
|
U().unsubscribe(r);
|
|
961
938
|
}
|
|
962
|
-
function
|
|
963
|
-
return U().subscribe(r), () =>
|
|
939
|
+
function sr(r) {
|
|
940
|
+
return U().subscribe(r), () => dt(r);
|
|
964
941
|
}
|
|
965
|
-
function
|
|
966
|
-
const
|
|
942
|
+
function ft(r, e) {
|
|
943
|
+
const t = r.split("."), s = e.split("."), n = Math.max(t.length, s.length);
|
|
967
944
|
for (let i = 0; i < n; i += 1) {
|
|
968
|
-
const a = parseInt(
|
|
945
|
+
const a = parseInt(t[i] || "0", 10), c = parseInt(s[i] || "0", 10);
|
|
969
946
|
if (a !== c)
|
|
970
947
|
return a > c ? 1 : -1;
|
|
971
948
|
}
|
|
972
949
|
return 0;
|
|
973
950
|
}
|
|
974
|
-
function P(r,
|
|
975
|
-
return
|
|
951
|
+
function P(r, e) {
|
|
952
|
+
return ft(r, e) <= 0;
|
|
976
953
|
}
|
|
977
|
-
function I(r,
|
|
978
|
-
if (typeof
|
|
979
|
-
if (r === "web_app_open_link" &&
|
|
980
|
-
return P("6.4",
|
|
981
|
-
if (r === "web_app_set_header_color" &&
|
|
982
|
-
return P("6.9",
|
|
954
|
+
function I(r, e, t) {
|
|
955
|
+
if (typeof t == "string") {
|
|
956
|
+
if (r === "web_app_open_link" && e === "try_instant_view")
|
|
957
|
+
return P("6.4", t);
|
|
958
|
+
if (r === "web_app_set_header_color" && e === "color")
|
|
959
|
+
return P("6.9", t);
|
|
983
960
|
}
|
|
984
961
|
switch (r) {
|
|
985
962
|
case "web_app_open_tg_link":
|
|
@@ -988,50 +965,50 @@ function I(r, t, e) {
|
|
|
988
965
|
case "web_app_set_background_color":
|
|
989
966
|
case "web_app_set_header_color":
|
|
990
967
|
case "web_app_trigger_haptic_feedback":
|
|
991
|
-
return P("6.1",
|
|
968
|
+
return P("6.1", e);
|
|
992
969
|
case "web_app_open_popup":
|
|
993
|
-
return P("6.2",
|
|
970
|
+
return P("6.2", e);
|
|
994
971
|
case "web_app_close_scan_qr_popup":
|
|
995
972
|
case "web_app_open_scan_qr_popup":
|
|
996
973
|
case "web_app_read_text_from_clipboard":
|
|
997
|
-
return P("6.4",
|
|
974
|
+
return P("6.4", e);
|
|
998
975
|
case "web_app_switch_inline_query":
|
|
999
|
-
return P("6.7",
|
|
976
|
+
return P("6.7", e);
|
|
1000
977
|
case "web_app_invoke_custom_method":
|
|
1001
978
|
case "web_app_request_write_access":
|
|
1002
979
|
case "web_app_request_phone":
|
|
1003
|
-
return P("6.9",
|
|
980
|
+
return P("6.9", e);
|
|
1004
981
|
case "web_app_setup_settings_button":
|
|
1005
|
-
return P("6.10",
|
|
982
|
+
return P("6.10", e);
|
|
1006
983
|
default:
|
|
1007
984
|
return !0;
|
|
1008
985
|
}
|
|
1009
986
|
}
|
|
1010
|
-
function E(r,
|
|
1011
|
-
return (
|
|
987
|
+
function E(r, e) {
|
|
988
|
+
return (t) => I(e[t], r);
|
|
1012
989
|
}
|
|
1013
|
-
function
|
|
1014
|
-
return (
|
|
1015
|
-
const [s, n] = t
|
|
990
|
+
function Se(r, e) {
|
|
991
|
+
return (t) => {
|
|
992
|
+
const [s, n] = e[t];
|
|
1016
993
|
return I(s, n, r);
|
|
1017
994
|
};
|
|
1018
995
|
}
|
|
1019
|
-
function d(r,
|
|
996
|
+
function d(r, e, t) {
|
|
1020
997
|
let s = {}, n;
|
|
1021
|
-
|
|
1022
|
-
const { targetOrigin: i =
|
|
1023
|
-
if (
|
|
998
|
+
e === void 0 && t === void 0 ? s = {} : e !== void 0 && t !== void 0 ? (s = t, n = e) : e !== void 0 && ("targetOrigin" in e ? s = e : n = e);
|
|
999
|
+
const { targetOrigin: i = Fe() } = s;
|
|
1000
|
+
if (q.log(`Calling method "${r}"`, n), pe()) {
|
|
1024
1001
|
window.parent.postMessage(JSON.stringify({
|
|
1025
1002
|
eventType: r,
|
|
1026
1003
|
eventData: n
|
|
1027
1004
|
}), i);
|
|
1028
1005
|
return;
|
|
1029
1006
|
}
|
|
1030
|
-
if (
|
|
1007
|
+
if (Ze(window)) {
|
|
1031
1008
|
window.external.notify(JSON.stringify({ eventType: r, eventData: n }));
|
|
1032
1009
|
return;
|
|
1033
1010
|
}
|
|
1034
|
-
if (
|
|
1011
|
+
if (Ke(window)) {
|
|
1035
1012
|
window.TelegramWebviewProxy.postEvent(r, JSON.stringify(n));
|
|
1036
1013
|
return;
|
|
1037
1014
|
}
|
|
@@ -1039,64 +1016,64 @@ function d(r, t, e) {
|
|
|
1039
1016
|
"Unable to determine current environment and possible way to send event."
|
|
1040
1017
|
);
|
|
1041
1018
|
}
|
|
1042
|
-
function
|
|
1043
|
-
return (
|
|
1044
|
-
if (!I(
|
|
1045
|
-
throw new
|
|
1046
|
-
if (R(
|
|
1019
|
+
function gt(r) {
|
|
1020
|
+
return (e, t) => {
|
|
1021
|
+
if (!I(e, r))
|
|
1022
|
+
throw new re(e, r);
|
|
1023
|
+
if (R(t)) {
|
|
1047
1024
|
let s;
|
|
1048
|
-
if (
|
|
1049
|
-
throw new
|
|
1025
|
+
if (e === "web_app_open_link" && "try_instant_view" in t ? s = "try_instant_view" : e === "web_app_set_header_color" && "color" in t && (s = "color"), s && !I(e, s, r))
|
|
1026
|
+
throw new se(e, s, r);
|
|
1050
1027
|
}
|
|
1051
|
-
return d(
|
|
1028
|
+
return d(e, t);
|
|
1052
1029
|
};
|
|
1053
1030
|
}
|
|
1054
1031
|
class J extends Error {
|
|
1055
|
-
constructor(
|
|
1056
|
-
super(`Async call timeout exceeded. Timeout: ${
|
|
1032
|
+
constructor(e) {
|
|
1033
|
+
super(`Async call timeout exceeded. Timeout: ${e}`), Object.setPrototypeOf(this, J.prototype);
|
|
1057
1034
|
}
|
|
1058
1035
|
}
|
|
1059
|
-
function
|
|
1036
|
+
function nr(r) {
|
|
1060
1037
|
return r instanceof J;
|
|
1061
1038
|
}
|
|
1062
|
-
function
|
|
1063
|
-
return new Promise((
|
|
1064
|
-
setTimeout(
|
|
1039
|
+
function wt(r) {
|
|
1040
|
+
return new Promise((e) => {
|
|
1041
|
+
setTimeout(e, r);
|
|
1065
1042
|
});
|
|
1066
1043
|
}
|
|
1067
|
-
function
|
|
1068
|
-
return new Promise((
|
|
1069
|
-
setTimeout(
|
|
1044
|
+
function _t(r) {
|
|
1045
|
+
return new Promise((e, t) => {
|
|
1046
|
+
setTimeout(t, r, new J(r));
|
|
1070
1047
|
});
|
|
1071
1048
|
}
|
|
1072
|
-
function
|
|
1049
|
+
function xe(r, e) {
|
|
1073
1050
|
return Promise.race([
|
|
1074
1051
|
r(),
|
|
1075
|
-
|
|
1052
|
+
_t(e)
|
|
1076
1053
|
]);
|
|
1077
1054
|
}
|
|
1078
|
-
function m(r,
|
|
1055
|
+
function m(r, e, t, s) {
|
|
1079
1056
|
let n, i, a, c;
|
|
1080
|
-
typeof
|
|
1081
|
-
const { postEvent:
|
|
1057
|
+
typeof e == "string" || Array.isArray(e) ? (a = Array.isArray(e) ? e : [e], n = t) : (i = e, a = Array.isArray(t) ? t : [t], n = s), R(i) && typeof i.req_id == "string" && (c = i.req_id);
|
|
1058
|
+
const { postEvent: u = d, timeout: p } = n || {}, g = n && "capture" in n ? n.capture : null, _ = () => new Promise((V, l) => {
|
|
1082
1059
|
const C = a.map((v) => y(v, (M) => {
|
|
1083
|
-
c && (!R(M) || M.req_id !== c) || typeof g == "function" && !g(M) || (x(),
|
|
1060
|
+
c && (!R(M) || M.req_id !== c) || typeof g == "function" && !g(M) || (x(), V(M));
|
|
1084
1061
|
})), x = () => C.forEach((v) => v());
|
|
1085
1062
|
try {
|
|
1086
|
-
|
|
1063
|
+
u(r, i);
|
|
1087
1064
|
} catch (v) {
|
|
1088
1065
|
x(), l(v);
|
|
1089
1066
|
}
|
|
1090
1067
|
});
|
|
1091
|
-
return typeof
|
|
1068
|
+
return typeof p == "number" ? xe(_, p) : _();
|
|
1092
1069
|
}
|
|
1093
|
-
async function
|
|
1070
|
+
async function H(r, e, t, s = {}) {
|
|
1094
1071
|
const { result: n, error: i } = await m(
|
|
1095
1072
|
"web_app_invoke_custom_method",
|
|
1096
1073
|
{
|
|
1097
1074
|
method: r,
|
|
1098
|
-
params:
|
|
1099
|
-
req_id:
|
|
1075
|
+
params: e,
|
|
1076
|
+
req_id: t
|
|
1100
1077
|
},
|
|
1101
1078
|
"custom_method_invoked",
|
|
1102
1079
|
s
|
|
@@ -1105,8 +1082,8 @@ async function O(r, t, e, s = {}) {
|
|
|
1105
1082
|
throw new Error(i);
|
|
1106
1083
|
return n;
|
|
1107
1084
|
}
|
|
1108
|
-
class
|
|
1109
|
-
constructor(
|
|
1085
|
+
class bt {
|
|
1086
|
+
constructor(e, t, s = d) {
|
|
1110
1087
|
o(this, "ee", new w());
|
|
1111
1088
|
o(this, "state");
|
|
1112
1089
|
/**
|
|
@@ -1114,24 +1091,24 @@ class Ce {
|
|
|
1114
1091
|
* @param event - event name.
|
|
1115
1092
|
* @param listener - event listener.
|
|
1116
1093
|
*/
|
|
1117
|
-
o(this, "on", (
|
|
1094
|
+
o(this, "on", (e, t) => e === "click" ? y("back_button_pressed", t) : this.ee.on(e, t));
|
|
1118
1095
|
/**
|
|
1119
1096
|
* Removes event listener.
|
|
1120
1097
|
* @param event - event name.
|
|
1121
1098
|
* @param listener - event listener.
|
|
1122
1099
|
*/
|
|
1123
|
-
o(this, "off", (
|
|
1100
|
+
o(this, "off", (e, t) => e === "click" ? $("back_button_pressed", t) : this.ee.off(e, t));
|
|
1124
1101
|
/**
|
|
1125
1102
|
* Checks if specified method is supported by current component.
|
|
1126
1103
|
*/
|
|
1127
1104
|
o(this, "supports");
|
|
1128
|
-
this.postEvent = s, this.state = new b({ isVisible:
|
|
1105
|
+
this.postEvent = s, this.state = new b({ isVisible: e }, this.ee), this.supports = E(t, {
|
|
1129
1106
|
show: "web_app_setup_back_button",
|
|
1130
1107
|
hide: "web_app_setup_back_button"
|
|
1131
1108
|
});
|
|
1132
1109
|
}
|
|
1133
|
-
set isVisible(
|
|
1134
|
-
this.state.set("isVisible",
|
|
1110
|
+
set isVisible(e) {
|
|
1111
|
+
this.state.set("isVisible", e), this.postEvent("web_app_setup_back_button", { is_visible: e });
|
|
1135
1112
|
}
|
|
1136
1113
|
/**
|
|
1137
1114
|
* True if BackButton is currently visible.
|
|
@@ -1152,23 +1129,23 @@ class Ce {
|
|
|
1152
1129
|
this.isVisible = !0;
|
|
1153
1130
|
}
|
|
1154
1131
|
}
|
|
1155
|
-
function
|
|
1156
|
-
return r + (r.length > 0 &&
|
|
1132
|
+
function ie(r, e) {
|
|
1133
|
+
return r + (r.length > 0 && e.length > 0 ? ` ${e}` : e);
|
|
1157
1134
|
}
|
|
1158
|
-
function
|
|
1159
|
-
return r.reduce((
|
|
1135
|
+
function mt(...r) {
|
|
1136
|
+
return r.reduce((e, t) => {
|
|
1160
1137
|
let s = "";
|
|
1161
|
-
return typeof
|
|
1138
|
+
return typeof t == "string" ? s = t : typeof t == "object" && t !== null && (s = Object.entries(t).reduce((n, [i, a]) => a ? ie(n, i) : n, "")), ie(e, s);
|
|
1162
1139
|
}, "");
|
|
1163
1140
|
}
|
|
1164
|
-
function
|
|
1165
|
-
return r.reduce((
|
|
1166
|
-
const i =
|
|
1167
|
-
i.length > 0 && (
|
|
1168
|
-
}),
|
|
1141
|
+
function ir(...r) {
|
|
1142
|
+
return r.reduce((e, t) => (R(t) && Object.entries(t).forEach(([s, n]) => {
|
|
1143
|
+
const i = mt(e[s], n);
|
|
1144
|
+
i.length > 0 && (e[s] = i);
|
|
1145
|
+
}), e), {});
|
|
1169
1146
|
}
|
|
1170
|
-
class
|
|
1171
|
-
constructor(
|
|
1147
|
+
class yt {
|
|
1148
|
+
constructor(e, t = d) {
|
|
1172
1149
|
o(this, "ee", new w());
|
|
1173
1150
|
o(this, "state");
|
|
1174
1151
|
/**
|
|
@@ -1179,10 +1156,10 @@ class Pe {
|
|
|
1179
1156
|
* Removes event listener.
|
|
1180
1157
|
*/
|
|
1181
1158
|
o(this, "off", this.ee.off.bind(this.ee));
|
|
1182
|
-
this.postEvent =
|
|
1159
|
+
this.postEvent = t, this.state = new b({ isConfirmationNeeded: e }, this.ee);
|
|
1183
1160
|
}
|
|
1184
|
-
set isConfirmationNeeded(
|
|
1185
|
-
this.state.set("isConfirmationNeeded",
|
|
1161
|
+
set isConfirmationNeeded(e) {
|
|
1162
|
+
this.state.set("isConfirmationNeeded", e), this.postEvent("web_app_setup_closing_behavior", { need_confirmation: e });
|
|
1186
1163
|
}
|
|
1187
1164
|
/**
|
|
1188
1165
|
* Returns true, if the confirmation dialog enabled while the user is trying
|
|
@@ -1206,16 +1183,16 @@ class Pe {
|
|
|
1206
1183
|
this.isConfirmationNeeded = !0;
|
|
1207
1184
|
}
|
|
1208
1185
|
}
|
|
1209
|
-
function
|
|
1210
|
-
return r.reduce((
|
|
1186
|
+
function oe(r, e) {
|
|
1187
|
+
return r.reduce((t, s) => (t[s] = e, t), {});
|
|
1211
1188
|
}
|
|
1212
|
-
class
|
|
1213
|
-
constructor(
|
|
1189
|
+
class Et {
|
|
1190
|
+
constructor(e, t, s = d) {
|
|
1214
1191
|
/**
|
|
1215
1192
|
* Checks if specified method is supported by current component.
|
|
1216
1193
|
*/
|
|
1217
1194
|
o(this, "supports");
|
|
1218
|
-
this.createRequestId =
|
|
1195
|
+
this.createRequestId = t, this.postEvent = s, this.supports = E(e, {
|
|
1219
1196
|
delete: "web_app_invoke_custom_method",
|
|
1220
1197
|
get: "web_app_invoke_custom_method",
|
|
1221
1198
|
getKeys: "web_app_invoke_custom_method",
|
|
@@ -1227,41 +1204,41 @@ class ke {
|
|
|
1227
1204
|
* @param keyOrKeys - key or keys to delete.
|
|
1228
1205
|
* @param options - request execution options.
|
|
1229
1206
|
*/
|
|
1230
|
-
async delete(
|
|
1231
|
-
const s = Array.isArray(
|
|
1232
|
-
s.length !== 0 && await
|
|
1207
|
+
async delete(e, t = {}) {
|
|
1208
|
+
const s = Array.isArray(e) ? e : [e];
|
|
1209
|
+
s.length !== 0 && await H(
|
|
1233
1210
|
"deleteStorageValues",
|
|
1234
1211
|
{ keys: s },
|
|
1235
1212
|
this.createRequestId(),
|
|
1236
|
-
{ ...
|
|
1213
|
+
{ ...t, postEvent: this.postEvent }
|
|
1237
1214
|
);
|
|
1238
1215
|
}
|
|
1239
1216
|
/**
|
|
1240
1217
|
* Returns list of all keys presented in the cloud storage.
|
|
1241
1218
|
* @param options - request execution options.
|
|
1242
1219
|
*/
|
|
1243
|
-
async getKeys(
|
|
1244
|
-
const
|
|
1220
|
+
async getKeys(e = {}) {
|
|
1221
|
+
const t = await H(
|
|
1245
1222
|
"getStorageKeys",
|
|
1246
1223
|
{},
|
|
1247
1224
|
this.createRequestId(),
|
|
1248
|
-
{ ...
|
|
1225
|
+
{ ...e, postEvent: this.postEvent }
|
|
1249
1226
|
);
|
|
1250
|
-
return
|
|
1227
|
+
return $e().of(h()).parse(t);
|
|
1251
1228
|
}
|
|
1252
|
-
async get(
|
|
1253
|
-
const s = Array.isArray(
|
|
1229
|
+
async get(e, t = {}) {
|
|
1230
|
+
const s = Array.isArray(e) ? e : [e];
|
|
1254
1231
|
if (s.length === 0)
|
|
1255
|
-
return
|
|
1232
|
+
return oe(s, "");
|
|
1256
1233
|
const n = f(
|
|
1257
|
-
|
|
1258
|
-
), i = await
|
|
1234
|
+
oe(s, h())
|
|
1235
|
+
), i = await H(
|
|
1259
1236
|
"getStorageValues",
|
|
1260
1237
|
{ keys: s },
|
|
1261
1238
|
this.createRequestId(),
|
|
1262
|
-
{ ...
|
|
1239
|
+
{ ...t, postEvent: this.postEvent }
|
|
1263
1240
|
).then((a) => n.parse(a));
|
|
1264
|
-
return Array.isArray(
|
|
1241
|
+
return Array.isArray(e) ? i : i[e];
|
|
1265
1242
|
}
|
|
1266
1243
|
/**
|
|
1267
1244
|
* Saves specified value by key.
|
|
@@ -1269,26 +1246,26 @@ class ke {
|
|
|
1269
1246
|
* @param value - storage value.
|
|
1270
1247
|
* @param options - request execution options.
|
|
1271
1248
|
*/
|
|
1272
|
-
async set(
|
|
1273
|
-
await
|
|
1249
|
+
async set(e, t, s = {}) {
|
|
1250
|
+
await H(
|
|
1274
1251
|
"saveStorageValue",
|
|
1275
|
-
{ key:
|
|
1252
|
+
{ key: e, value: t },
|
|
1276
1253
|
this.createRequestId(),
|
|
1277
1254
|
{ ...s, postEvent: this.postEvent }
|
|
1278
1255
|
);
|
|
1279
1256
|
}
|
|
1280
1257
|
}
|
|
1281
|
-
function S(r,
|
|
1282
|
-
document.documentElement.style.setProperty(r,
|
|
1258
|
+
function S(r, e) {
|
|
1259
|
+
document.documentElement.style.setProperty(r, e);
|
|
1283
1260
|
}
|
|
1284
|
-
function
|
|
1285
|
-
const
|
|
1261
|
+
function Ct(r, e) {
|
|
1262
|
+
const t = () => {
|
|
1286
1263
|
S("--tg-background-color", r.backgroundColor);
|
|
1287
1264
|
}, s = () => {
|
|
1288
1265
|
const {
|
|
1289
1266
|
backgroundColor: n,
|
|
1290
1267
|
secondaryBackgroundColor: i
|
|
1291
|
-
} =
|
|
1268
|
+
} = e;
|
|
1292
1269
|
if (X(r.headerColor)) {
|
|
1293
1270
|
S("--tg-header-color", r.headerColor);
|
|
1294
1271
|
return;
|
|
@@ -1299,31 +1276,31 @@ function Se(r, t) {
|
|
|
1299
1276
|
}
|
|
1300
1277
|
r.headerColor === "secondary_bg_color" && i && S("--tg-header-color", i);
|
|
1301
1278
|
};
|
|
1302
|
-
|
|
1279
|
+
e.on("change", s), r.on("change:backgroundColor", t), r.on("change:headerColor", s), t(), s();
|
|
1303
1280
|
}
|
|
1304
|
-
function
|
|
1305
|
-
const
|
|
1306
|
-
const
|
|
1307
|
-
Object.entries(
|
|
1281
|
+
function vt(r) {
|
|
1282
|
+
const e = () => {
|
|
1283
|
+
const t = r.getState();
|
|
1284
|
+
Object.entries(t).forEach(([s, n]) => {
|
|
1308
1285
|
if (n) {
|
|
1309
1286
|
const i = s.replace(/[A-Z]/g, (a) => `-${a.toLowerCase()}`);
|
|
1310
1287
|
S(`--tg-theme-${i}`, n);
|
|
1311
1288
|
}
|
|
1312
1289
|
});
|
|
1313
1290
|
};
|
|
1314
|
-
r.on("change",
|
|
1291
|
+
r.on("change", e), e();
|
|
1315
1292
|
}
|
|
1316
|
-
function
|
|
1317
|
-
const
|
|
1318
|
-
r.on("change:height",
|
|
1293
|
+
function ae(r) {
|
|
1294
|
+
const e = () => S("--tg-viewport-height", `${r.height}px`), t = () => S("--tg-viewport-width", `${r.width}px`), s = () => S("--tg-viewport-stable-height", `${r.stableHeight}px`);
|
|
1295
|
+
r.on("change:height", e), r.on("change:width", t), r.on("change:stableHeight", s), e(), t(), s();
|
|
1319
1296
|
}
|
|
1320
|
-
class
|
|
1321
|
-
constructor(
|
|
1297
|
+
class Pt {
|
|
1298
|
+
constructor(e, t = d) {
|
|
1322
1299
|
/**
|
|
1323
1300
|
* Checks if specified method is supported by current component.
|
|
1324
1301
|
*/
|
|
1325
1302
|
o(this, "supports");
|
|
1326
|
-
this.postEvent =
|
|
1303
|
+
this.postEvent = t, this.supports = E(e, {
|
|
1327
1304
|
impactOccurred: "web_app_trigger_haptic_feedback",
|
|
1328
1305
|
notificationOccurred: "web_app_trigger_haptic_feedback",
|
|
1329
1306
|
selectionChanged: "web_app_trigger_haptic_feedback"
|
|
@@ -1334,10 +1311,10 @@ class qe {
|
|
|
1334
1311
|
* appropriate haptics based on style value passed.
|
|
1335
1312
|
* @param style - impact style.
|
|
1336
1313
|
*/
|
|
1337
|
-
impactOccurred(
|
|
1314
|
+
impactOccurred(e) {
|
|
1338
1315
|
this.postEvent("web_app_trigger_haptic_feedback", {
|
|
1339
1316
|
type: "impact",
|
|
1340
|
-
impact_style:
|
|
1317
|
+
impact_style: e
|
|
1341
1318
|
});
|
|
1342
1319
|
}
|
|
1343
1320
|
/**
|
|
@@ -1346,10 +1323,10 @@ class qe {
|
|
|
1346
1323
|
* type value passed.
|
|
1347
1324
|
* @param type - notification type.
|
|
1348
1325
|
*/
|
|
1349
|
-
notificationOccurred(
|
|
1326
|
+
notificationOccurred(e) {
|
|
1350
1327
|
this.postEvent("web_app_trigger_haptic_feedback", {
|
|
1351
1328
|
type: "notification",
|
|
1352
|
-
notification_type:
|
|
1329
|
+
notification_type: e
|
|
1353
1330
|
});
|
|
1354
1331
|
}
|
|
1355
1332
|
/**
|
|
@@ -1363,36 +1340,36 @@ class qe {
|
|
|
1363
1340
|
this.postEvent("web_app_trigger_haptic_feedback", { type: "selection_change" });
|
|
1364
1341
|
}
|
|
1365
1342
|
}
|
|
1366
|
-
function
|
|
1343
|
+
function kt() {
|
|
1367
1344
|
const r = document.createElement("style");
|
|
1368
|
-
r.id = "telegram-custom-styles", document.head.appendChild(r), y("set_custom_style", (
|
|
1369
|
-
r.innerHTML =
|
|
1345
|
+
r.id = "telegram-custom-styles", document.head.appendChild(r), y("set_custom_style", (e) => {
|
|
1346
|
+
r.innerHTML = e;
|
|
1370
1347
|
});
|
|
1371
1348
|
}
|
|
1372
|
-
function
|
|
1349
|
+
function qe(r) {
|
|
1373
1350
|
return `telegram-mini-apps-${r}`;
|
|
1374
1351
|
}
|
|
1375
|
-
function B(r,
|
|
1376
|
-
sessionStorage.setItem(
|
|
1352
|
+
function B(r, e) {
|
|
1353
|
+
sessionStorage.setItem(qe(r), JSON.stringify(e));
|
|
1377
1354
|
}
|
|
1378
1355
|
function D(r) {
|
|
1379
|
-
const
|
|
1380
|
-
return
|
|
1356
|
+
const e = sessionStorage.getItem(qe(r));
|
|
1357
|
+
return e ? JSON.parse(e) : null;
|
|
1381
1358
|
}
|
|
1382
|
-
function
|
|
1383
|
-
const { isVisible: s = !1 } = r ? D("back-button") || {} : {}, n = new
|
|
1359
|
+
function St(r, e, t) {
|
|
1360
|
+
const { isVisible: s = !1 } = r ? D("back-button") || {} : {}, n = new bt(s, e, t);
|
|
1384
1361
|
return n.on("change", () => {
|
|
1385
1362
|
B("back-button", { isVisible: n.isVisible });
|
|
1386
1363
|
}), n;
|
|
1387
1364
|
}
|
|
1388
|
-
function
|
|
1389
|
-
const { isConfirmationNeeded:
|
|
1365
|
+
function xt(r, e) {
|
|
1366
|
+
const { isConfirmationNeeded: t = !1 } = r ? D("closing-behavior") || {} : {}, s = new yt(t, e);
|
|
1390
1367
|
return s.on("change", () => B("closing-behavior", {
|
|
1391
1368
|
isConfirmationNeeded: s.isConfirmationNeeded
|
|
1392
1369
|
})), s;
|
|
1393
1370
|
}
|
|
1394
|
-
class
|
|
1395
|
-
constructor(
|
|
1371
|
+
class qt {
|
|
1372
|
+
constructor(e) {
|
|
1396
1373
|
o(this, "ee", new w());
|
|
1397
1374
|
o(this, "state");
|
|
1398
1375
|
o(this, "postEvent");
|
|
@@ -1401,32 +1378,32 @@ class Ie {
|
|
|
1401
1378
|
* @param event - event name.
|
|
1402
1379
|
* @param listener - event listener.
|
|
1403
1380
|
*/
|
|
1404
|
-
o(this, "on", (
|
|
1381
|
+
o(this, "on", (e, t) => (
|
|
1405
1382
|
// FIXME: Event 'main_button_pressed' is still being received on Android
|
|
1406
1383
|
// even if the main button is disabled.
|
|
1407
1384
|
// Issue: https://github.com/Telegram-Mini-Apps/tma.js/issues/3
|
|
1408
|
-
|
|
1385
|
+
e === "click" ? y("main_button_pressed", t) : this.ee.on(e, t)
|
|
1409
1386
|
));
|
|
1410
1387
|
/**
|
|
1411
1388
|
* Removes event listener.
|
|
1412
1389
|
* @param event - event name.
|
|
1413
1390
|
* @param listener - event listener.
|
|
1414
1391
|
*/
|
|
1415
|
-
o(this, "off", (
|
|
1392
|
+
o(this, "off", (e, t) => e === "click" ? $("main_button_pressed", t) : this.ee.off(e, t));
|
|
1416
1393
|
const {
|
|
1417
|
-
postEvent:
|
|
1394
|
+
postEvent: t = d,
|
|
1418
1395
|
text: s,
|
|
1419
1396
|
textColor: n,
|
|
1420
1397
|
backgroundColor: i,
|
|
1421
1398
|
isEnabled: a,
|
|
1422
1399
|
isVisible: c,
|
|
1423
|
-
isLoaderVisible:
|
|
1424
|
-
} =
|
|
1425
|
-
this.postEvent =
|
|
1400
|
+
isLoaderVisible: u
|
|
1401
|
+
} = e;
|
|
1402
|
+
this.postEvent = t, this.state = new b({
|
|
1426
1403
|
backgroundColor: i,
|
|
1427
1404
|
isEnabled: a,
|
|
1428
1405
|
isVisible: c,
|
|
1429
|
-
isLoaderVisible:
|
|
1406
|
+
isLoaderVisible: u,
|
|
1430
1407
|
text: s,
|
|
1431
1408
|
textColor: n
|
|
1432
1409
|
}, this.ee);
|
|
@@ -1444,8 +1421,8 @@ class Ie {
|
|
|
1444
1421
|
text_color: this.textColor
|
|
1445
1422
|
});
|
|
1446
1423
|
}
|
|
1447
|
-
set isEnabled(
|
|
1448
|
-
this.setParams({ isEnabled:
|
|
1424
|
+
set isEnabled(e) {
|
|
1425
|
+
this.setParams({ isEnabled: e });
|
|
1449
1426
|
}
|
|
1450
1427
|
/**
|
|
1451
1428
|
* True if the Main Button is currently enabled.
|
|
@@ -1453,8 +1430,8 @@ class Ie {
|
|
|
1453
1430
|
get isEnabled() {
|
|
1454
1431
|
return this.state.get("isEnabled");
|
|
1455
1432
|
}
|
|
1456
|
-
set isLoaderVisible(
|
|
1457
|
-
this.setParams({ isLoaderVisible:
|
|
1433
|
+
set isLoaderVisible(e) {
|
|
1434
|
+
this.setParams({ isLoaderVisible: e });
|
|
1458
1435
|
}
|
|
1459
1436
|
/**
|
|
1460
1437
|
* True if the Main Button loader is currently visible.
|
|
@@ -1462,8 +1439,8 @@ class Ie {
|
|
|
1462
1439
|
get isLoaderVisible() {
|
|
1463
1440
|
return this.state.get("isLoaderVisible");
|
|
1464
1441
|
}
|
|
1465
|
-
set isVisible(
|
|
1466
|
-
this.setParams({ isVisible:
|
|
1442
|
+
set isVisible(e) {
|
|
1443
|
+
this.setParams({ isVisible: e });
|
|
1467
1444
|
}
|
|
1468
1445
|
/**
|
|
1469
1446
|
* True if the Main Button is currently visible.
|
|
@@ -1531,47 +1508,47 @@ class Ie {
|
|
|
1531
1508
|
* Sets new Main Button text. Minimal length for text is 1 symbol, and maximum is 64 symbols.
|
|
1532
1509
|
* @param text - new text.
|
|
1533
1510
|
*/
|
|
1534
|
-
setText(
|
|
1535
|
-
return this.setParams({ text:
|
|
1511
|
+
setText(e) {
|
|
1512
|
+
return this.setParams({ text: e });
|
|
1536
1513
|
}
|
|
1537
1514
|
/**
|
|
1538
1515
|
* Sets new Main Button text color.
|
|
1539
1516
|
* @param textColor - new text color.
|
|
1540
1517
|
*/
|
|
1541
|
-
setTextColor(
|
|
1542
|
-
return this.setParams({ textColor:
|
|
1518
|
+
setTextColor(e) {
|
|
1519
|
+
return this.setParams({ textColor: e });
|
|
1543
1520
|
}
|
|
1544
1521
|
/**
|
|
1545
1522
|
* Updates current Main Button color.
|
|
1546
1523
|
* @param backgroundColor - color to set.
|
|
1547
1524
|
*/
|
|
1548
|
-
setBackgroundColor(
|
|
1549
|
-
return this.setParams({ backgroundColor:
|
|
1525
|
+
setBackgroundColor(e) {
|
|
1526
|
+
return this.setParams({ backgroundColor: e });
|
|
1550
1527
|
}
|
|
1551
1528
|
/**
|
|
1552
1529
|
* Allows setting multiple Main Button parameters.
|
|
1553
1530
|
* @param params - Main Button parameters.
|
|
1554
1531
|
*/
|
|
1555
|
-
setParams(
|
|
1556
|
-
return this.state.set(
|
|
1532
|
+
setParams(e) {
|
|
1533
|
+
return this.state.set(e), this.commit(), this;
|
|
1557
1534
|
}
|
|
1558
1535
|
}
|
|
1559
|
-
function
|
|
1536
|
+
function At(r, e, t, s) {
|
|
1560
1537
|
const {
|
|
1561
|
-
backgroundColor: n =
|
|
1538
|
+
backgroundColor: n = e,
|
|
1562
1539
|
isEnabled: i = !1,
|
|
1563
1540
|
isVisible: a = !1,
|
|
1564
1541
|
isLoaderVisible: c = !1,
|
|
1565
|
-
textColor:
|
|
1566
|
-
text:
|
|
1567
|
-
} = r ? D("main-button") || {} : {}, g = new
|
|
1542
|
+
textColor: u = t,
|
|
1543
|
+
text: p = ""
|
|
1544
|
+
} = r ? D("main-button") || {} : {}, g = new qt({
|
|
1568
1545
|
backgroundColor: n,
|
|
1569
1546
|
isEnabled: i,
|
|
1570
1547
|
isLoaderVisible: c,
|
|
1571
1548
|
isVisible: a,
|
|
1572
1549
|
postEvent: s,
|
|
1573
|
-
text:
|
|
1574
|
-
textColor:
|
|
1550
|
+
text: p,
|
|
1551
|
+
textColor: u
|
|
1575
1552
|
}), _ = () => B("main-button", {
|
|
1576
1553
|
backgroundColor: g.backgroundColor,
|
|
1577
1554
|
isEnabled: g.isEnabled,
|
|
@@ -1582,33 +1559,33 @@ function Le(r, t, e, s) {
|
|
|
1582
1559
|
});
|
|
1583
1560
|
return g.on("change", _), g;
|
|
1584
1561
|
}
|
|
1585
|
-
const
|
|
1562
|
+
const Vt = ee({
|
|
1586
1563
|
contact: f({
|
|
1587
1564
|
userId: {
|
|
1588
|
-
type:
|
|
1565
|
+
type: A(),
|
|
1589
1566
|
from: "user_id"
|
|
1590
1567
|
},
|
|
1591
1568
|
phoneNumber: {
|
|
1592
|
-
type:
|
|
1569
|
+
type: h(),
|
|
1593
1570
|
from: "phone_number"
|
|
1594
1571
|
},
|
|
1595
1572
|
firstName: {
|
|
1596
|
-
type:
|
|
1573
|
+
type: h(),
|
|
1597
1574
|
from: "first_name"
|
|
1598
1575
|
},
|
|
1599
1576
|
lastName: {
|
|
1600
|
-
type:
|
|
1577
|
+
type: h().optional(),
|
|
1601
1578
|
from: "last_name"
|
|
1602
1579
|
}
|
|
1603
1580
|
}),
|
|
1604
1581
|
authDate: {
|
|
1605
|
-
type:
|
|
1582
|
+
type: fe(),
|
|
1606
1583
|
from: "auth_date"
|
|
1607
1584
|
},
|
|
1608
|
-
hash:
|
|
1585
|
+
hash: h()
|
|
1609
1586
|
});
|
|
1610
|
-
class
|
|
1611
|
-
constructor(
|
|
1587
|
+
class Rt {
|
|
1588
|
+
constructor(e) {
|
|
1612
1589
|
o(this, "ee", new w());
|
|
1613
1590
|
o(this, "state");
|
|
1614
1591
|
o(this, "botInline");
|
|
@@ -1633,20 +1610,20 @@ class Te {
|
|
|
1633
1610
|
*/
|
|
1634
1611
|
o(this, "supportsParam");
|
|
1635
1612
|
const {
|
|
1636
|
-
postEvent:
|
|
1613
|
+
postEvent: t = d,
|
|
1637
1614
|
headerColor: s,
|
|
1638
1615
|
backgroundColor: n,
|
|
1639
1616
|
version: i,
|
|
1640
1617
|
botInline: a,
|
|
1641
1618
|
createRequestId: c
|
|
1642
|
-
} =
|
|
1619
|
+
} = e, u = E(i, {
|
|
1643
1620
|
requestPhoneAccess: "web_app_request_phone",
|
|
1644
1621
|
requestWriteAccess: "web_app_request_write_access",
|
|
1645
1622
|
switchInlineQuery: "web_app_switch_inline_query",
|
|
1646
1623
|
setHeaderColor: "web_app_set_header_color",
|
|
1647
1624
|
setBackgroundColor: "web_app_set_background_color"
|
|
1648
1625
|
});
|
|
1649
|
-
this.postEvent =
|
|
1626
|
+
this.postEvent = t, this.botInline = a, this.createRequestId = c, this.supports = (p) => !(!u(p) || p === "switchInlineQuery" && !a), this.state = new b({ backgroundColor: n, headerColor: s }, this.ee), this.supportsParam = Se(i, {
|
|
1650
1627
|
"setHeaderColor.color": ["web_app_set_header_color", "color"]
|
|
1651
1628
|
});
|
|
1652
1629
|
}
|
|
@@ -1654,7 +1631,7 @@ class Te {
|
|
|
1654
1631
|
* Attempts to get requested contact.
|
|
1655
1632
|
*/
|
|
1656
1633
|
async getRequestedContact() {
|
|
1657
|
-
return
|
|
1634
|
+
return H(
|
|
1658
1635
|
"getRequestedContact",
|
|
1659
1636
|
{},
|
|
1660
1637
|
this.createRequestId(),
|
|
@@ -1662,7 +1639,7 @@ class Te {
|
|
|
1662
1639
|
postEvent: this.postEvent,
|
|
1663
1640
|
timeout: 1e4
|
|
1664
1641
|
}
|
|
1665
|
-
).then((
|
|
1642
|
+
).then((e) => Vt.parse(e));
|
|
1666
1643
|
}
|
|
1667
1644
|
/**
|
|
1668
1645
|
* The Mini App background color.
|
|
@@ -1692,7 +1669,7 @@ class Te {
|
|
|
1692
1669
|
* True if current Mini App background color recognized as dark.
|
|
1693
1670
|
*/
|
|
1694
1671
|
get isDark() {
|
|
1695
|
-
return
|
|
1672
|
+
return we(this.backgroundColor);
|
|
1696
1673
|
}
|
|
1697
1674
|
/**
|
|
1698
1675
|
* True if phone access is currently being requested.
|
|
@@ -1724,25 +1701,25 @@ class Te {
|
|
|
1724
1701
|
* failed.
|
|
1725
1702
|
* @param options - additional options.
|
|
1726
1703
|
*/
|
|
1727
|
-
async requestContact({ timeout:
|
|
1704
|
+
async requestContact({ timeout: e = 5e3 } = {}) {
|
|
1728
1705
|
try {
|
|
1729
1706
|
return await this.getRequestedContact();
|
|
1730
1707
|
} catch {
|
|
1731
1708
|
}
|
|
1732
1709
|
if (await this.requestPhoneAccess() !== "sent")
|
|
1733
1710
|
throw new Error("Access denied.");
|
|
1734
|
-
const s = Date.now() +
|
|
1711
|
+
const s = Date.now() + e;
|
|
1735
1712
|
let n = 50;
|
|
1736
|
-
return
|
|
1713
|
+
return xe(async () => {
|
|
1737
1714
|
for (; Date.now() < s; ) {
|
|
1738
1715
|
try {
|
|
1739
1716
|
return await this.getRequestedContact();
|
|
1740
1717
|
} catch {
|
|
1741
1718
|
}
|
|
1742
|
-
await
|
|
1719
|
+
await wt(n), n += 50;
|
|
1743
1720
|
}
|
|
1744
1721
|
throw new Error("Unable to retrieve requested contact.");
|
|
1745
|
-
},
|
|
1722
|
+
}, e);
|
|
1746
1723
|
}
|
|
1747
1724
|
/**
|
|
1748
1725
|
* Requests current user phone access. Method returns promise, which resolves
|
|
@@ -1753,13 +1730,13 @@ class Te {
|
|
|
1753
1730
|
* @param options - additional options.
|
|
1754
1731
|
* @see requestContact
|
|
1755
1732
|
*/
|
|
1756
|
-
requestPhoneAccess(
|
|
1733
|
+
requestPhoneAccess(e = {}) {
|
|
1757
1734
|
if (this.requestingPhoneAccess)
|
|
1758
1735
|
throw new Error("Phone access is already being requested.");
|
|
1759
1736
|
return this.requestingPhoneAccess = !0, m("web_app_request_phone", "phone_requested", {
|
|
1760
|
-
...
|
|
1737
|
+
...e,
|
|
1761
1738
|
postEvent: this.postEvent
|
|
1762
|
-
}).then((
|
|
1739
|
+
}).then((t) => t.status).finally(() => {
|
|
1763
1740
|
this.requestingPhoneAccess = !1;
|
|
1764
1741
|
});
|
|
1765
1742
|
}
|
|
@@ -1767,13 +1744,13 @@ class Te {
|
|
|
1767
1744
|
* Requests write message access to current user.
|
|
1768
1745
|
* @param options - additional options.
|
|
1769
1746
|
*/
|
|
1770
|
-
requestWriteAccess(
|
|
1747
|
+
requestWriteAccess(e = {}) {
|
|
1771
1748
|
if (this.requestingWriteAccess)
|
|
1772
1749
|
throw new Error("Write access is already being requested.");
|
|
1773
1750
|
return this.requestingWriteAccess = !0, m("web_app_request_write_access", "write_access_requested", {
|
|
1774
|
-
...
|
|
1751
|
+
...e,
|
|
1775
1752
|
postEvent: this.postEvent
|
|
1776
|
-
}).then((
|
|
1753
|
+
}).then((t) => t.status).finally(() => {
|
|
1777
1754
|
this.requestingWriteAccess = !1;
|
|
1778
1755
|
});
|
|
1779
1756
|
}
|
|
@@ -1786,25 +1763,25 @@ class Te {
|
|
|
1786
1763
|
* @param data - data to send to bot.
|
|
1787
1764
|
* @throws {Error} data has incorrect size.
|
|
1788
1765
|
*/
|
|
1789
|
-
sendData(
|
|
1790
|
-
const { size:
|
|
1791
|
-
if (
|
|
1792
|
-
throw new Error(`Passed data has incorrect size: ${
|
|
1793
|
-
this.postEvent("web_app_data_send", { data:
|
|
1766
|
+
sendData(e) {
|
|
1767
|
+
const { size: t } = new Blob([e]);
|
|
1768
|
+
if (t === 0 || t > 4096)
|
|
1769
|
+
throw new Error(`Passed data has incorrect size: ${t}`);
|
|
1770
|
+
this.postEvent("web_app_data_send", { data: e });
|
|
1794
1771
|
}
|
|
1795
1772
|
/**
|
|
1796
1773
|
* Updates current Mini App header color.
|
|
1797
1774
|
* @param color - color key or RGB color.
|
|
1798
1775
|
*/
|
|
1799
|
-
setHeaderColor(
|
|
1800
|
-
this.postEvent("web_app_set_header_color", X(
|
|
1776
|
+
setHeaderColor(e) {
|
|
1777
|
+
this.postEvent("web_app_set_header_color", X(e) ? { color: e } : { color_key: e }), this.state.set("headerColor", e);
|
|
1801
1778
|
}
|
|
1802
1779
|
/**
|
|
1803
1780
|
* Updates current Mini App background color.
|
|
1804
1781
|
* @param color - RGB color.
|
|
1805
1782
|
*/
|
|
1806
|
-
setBackgroundColor(
|
|
1807
|
-
this.postEvent("web_app_set_background_color", { color:
|
|
1783
|
+
setBackgroundColor(e) {
|
|
1784
|
+
this.postEvent("web_app_set_background_color", { color: e }), this.state.set("backgroundColor", e);
|
|
1808
1785
|
}
|
|
1809
1786
|
/**
|
|
1810
1787
|
* Inserts the bot's username and the specified inline query in the current chat's input field.
|
|
@@ -1816,38 +1793,38 @@ class Te {
|
|
|
1816
1793
|
* @param chatTypes - List of chat types which could be chosen to send the message. Could be
|
|
1817
1794
|
* empty list.
|
|
1818
1795
|
*/
|
|
1819
|
-
switchInlineQuery(
|
|
1796
|
+
switchInlineQuery(e, t = []) {
|
|
1820
1797
|
if (!this.supports("switchInlineQuery") && !this.isBotInline)
|
|
1821
1798
|
throw new Error("Method is unsupported because Mini App should be launched in inline mode.");
|
|
1822
1799
|
this.postEvent("web_app_switch_inline_query", {
|
|
1823
|
-
query:
|
|
1824
|
-
chat_types:
|
|
1800
|
+
query: e,
|
|
1801
|
+
chat_types: t
|
|
1825
1802
|
});
|
|
1826
1803
|
}
|
|
1827
1804
|
}
|
|
1828
|
-
function
|
|
1805
|
+
function It(r, e, t, s, n, i) {
|
|
1829
1806
|
const {
|
|
1830
|
-
backgroundColor: a =
|
|
1807
|
+
backgroundColor: a = e,
|
|
1831
1808
|
headerColor: c = "bg_color"
|
|
1832
|
-
} = r ? D("mini-app") || {} : {},
|
|
1809
|
+
} = r ? D("mini-app") || {} : {}, u = new Rt({
|
|
1833
1810
|
headerColor: c,
|
|
1834
1811
|
backgroundColor: a,
|
|
1835
|
-
version:
|
|
1812
|
+
version: t,
|
|
1836
1813
|
botInline: s,
|
|
1837
1814
|
createRequestId: n,
|
|
1838
1815
|
postEvent: i
|
|
1839
|
-
}),
|
|
1840
|
-
backgroundColor:
|
|
1841
|
-
headerColor:
|
|
1816
|
+
}), p = () => B("mini-app", {
|
|
1817
|
+
backgroundColor: u.backgroundColor,
|
|
1818
|
+
headerColor: u.headerColor
|
|
1842
1819
|
});
|
|
1843
|
-
return
|
|
1820
|
+
return u.on("change", p), u;
|
|
1844
1821
|
}
|
|
1845
|
-
function
|
|
1822
|
+
function Lt() {
|
|
1846
1823
|
let r = 0;
|
|
1847
1824
|
return () => (r += 1, r.toString());
|
|
1848
1825
|
}
|
|
1849
|
-
class
|
|
1850
|
-
constructor(
|
|
1826
|
+
class Tt {
|
|
1827
|
+
constructor(e, t, s = d) {
|
|
1851
1828
|
o(this, "ee", new w());
|
|
1852
1829
|
o(this, "state");
|
|
1853
1830
|
/**
|
|
@@ -1855,24 +1832,24 @@ class We {
|
|
|
1855
1832
|
* @param event - event name.
|
|
1856
1833
|
* @param listener - event listener.
|
|
1857
1834
|
*/
|
|
1858
|
-
o(this, "on", (
|
|
1835
|
+
o(this, "on", (e, t) => e === "click" ? y("settings_button_pressed", t) : this.ee.on(e, t));
|
|
1859
1836
|
/**
|
|
1860
1837
|
* Removes event listener.
|
|
1861
1838
|
* @param event - event name.
|
|
1862
1839
|
* @param listener - event listener.
|
|
1863
1840
|
*/
|
|
1864
|
-
o(this, "off", (
|
|
1841
|
+
o(this, "off", (e, t) => e === "click" ? $("settings_button_pressed", t) : this.ee.off(e, t));
|
|
1865
1842
|
/**
|
|
1866
1843
|
* Checks if specified method is supported by current component.
|
|
1867
1844
|
*/
|
|
1868
1845
|
o(this, "supports");
|
|
1869
|
-
this.postEvent = s, this.state = new b({ isVisible:
|
|
1846
|
+
this.postEvent = s, this.state = new b({ isVisible: e }, this.ee), this.supports = E(t, {
|
|
1870
1847
|
show: "web_app_setup_settings_button",
|
|
1871
1848
|
hide: "web_app_setup_settings_button"
|
|
1872
1849
|
});
|
|
1873
1850
|
}
|
|
1874
|
-
set isVisible(
|
|
1875
|
-
this.state.set("isVisible",
|
|
1851
|
+
set isVisible(e) {
|
|
1852
|
+
this.state.set("isVisible", e), this.postEvent("web_app_setup_settings_button", { is_visible: e });
|
|
1876
1853
|
}
|
|
1877
1854
|
/**
|
|
1878
1855
|
* True if SettingsButton is currently visible.
|
|
@@ -1893,33 +1870,33 @@ class We {
|
|
|
1893
1870
|
this.isVisible = !0;
|
|
1894
1871
|
}
|
|
1895
1872
|
}
|
|
1896
|
-
function
|
|
1897
|
-
const { isVisible: s = !1 } = r ? D("settings-button") || {} : {}, n = new
|
|
1873
|
+
function $t(r, e, t) {
|
|
1874
|
+
const { isVisible: s = !1 } = r ? D("settings-button") || {} : {}, n = new Tt(s, e, t);
|
|
1898
1875
|
return n.on("change", () => {
|
|
1899
1876
|
B("settings-button", { isVisible: n.isVisible });
|
|
1900
1877
|
}), n;
|
|
1901
1878
|
}
|
|
1902
|
-
function
|
|
1903
|
-
const
|
|
1904
|
-
return
|
|
1879
|
+
function Bt(r) {
|
|
1880
|
+
const e = new Ue(r);
|
|
1881
|
+
return e.listen(), e;
|
|
1905
1882
|
}
|
|
1906
|
-
function
|
|
1883
|
+
function Dt(r) {
|
|
1907
1884
|
return ["macos", "tdesktop", "unigram", "web", "weba"].includes(r);
|
|
1908
1885
|
}
|
|
1909
|
-
async function
|
|
1910
|
-
const
|
|
1886
|
+
async function Ae(r) {
|
|
1887
|
+
const e = await m("web_app_request_viewport", "viewport_changed", r);
|
|
1911
1888
|
return {
|
|
1912
|
-
height:
|
|
1913
|
-
width:
|
|
1914
|
-
isExpanded:
|
|
1915
|
-
isStateStable:
|
|
1889
|
+
height: e.height,
|
|
1890
|
+
width: e.width,
|
|
1891
|
+
isExpanded: e.is_expanded,
|
|
1892
|
+
isStateStable: e.is_state_stable
|
|
1916
1893
|
};
|
|
1917
1894
|
}
|
|
1918
1895
|
function W(r) {
|
|
1919
1896
|
return r < 0 ? 0 : r;
|
|
1920
1897
|
}
|
|
1921
|
-
class
|
|
1922
|
-
constructor(
|
|
1898
|
+
class Wt {
|
|
1899
|
+
constructor(e) {
|
|
1923
1900
|
o(this, "ee", new w());
|
|
1924
1901
|
o(this, "state");
|
|
1925
1902
|
o(this, "postEvent");
|
|
@@ -1932,14 +1909,14 @@ class Ue {
|
|
|
1932
1909
|
*/
|
|
1933
1910
|
o(this, "off", this.ee.off.bind(this.ee));
|
|
1934
1911
|
const {
|
|
1935
|
-
height:
|
|
1912
|
+
height: t,
|
|
1936
1913
|
isExpanded: s,
|
|
1937
1914
|
width: n,
|
|
1938
1915
|
stableHeight: i,
|
|
1939
1916
|
postEvent: a = d
|
|
1940
|
-
} =
|
|
1917
|
+
} = e;
|
|
1941
1918
|
this.postEvent = a, this.state = new b({
|
|
1942
|
-
height: W(
|
|
1919
|
+
height: W(t),
|
|
1943
1920
|
isExpanded: s,
|
|
1944
1921
|
stableHeight: W(i),
|
|
1945
1922
|
width: W(n)
|
|
@@ -1950,13 +1927,13 @@ class Ue {
|
|
|
1950
1927
|
* instance.
|
|
1951
1928
|
* @param options - options to request fresh data.
|
|
1952
1929
|
*/
|
|
1953
|
-
sync(
|
|
1954
|
-
return
|
|
1930
|
+
sync(e) {
|
|
1931
|
+
return Ae(e).then(({ height: t, isExpanded: s, width: n, isStateStable: i }) => {
|
|
1955
1932
|
this.state.set({
|
|
1956
|
-
height:
|
|
1933
|
+
height: t,
|
|
1957
1934
|
width: n,
|
|
1958
1935
|
isExpanded: s,
|
|
1959
|
-
stableHeight: i ?
|
|
1936
|
+
stableHeight: i ? t : this.state.get("stableHeight")
|
|
1960
1937
|
});
|
|
1961
1938
|
});
|
|
1962
1939
|
}
|
|
@@ -2001,14 +1978,14 @@ class Ue {
|
|
|
2001
1978
|
* @returns Function to stop listening.
|
|
2002
1979
|
*/
|
|
2003
1980
|
listen() {
|
|
2004
|
-
return y("viewport_changed", (
|
|
1981
|
+
return y("viewport_changed", (e) => {
|
|
2005
1982
|
const {
|
|
2006
|
-
height:
|
|
1983
|
+
height: t,
|
|
2007
1984
|
width: s,
|
|
2008
1985
|
is_expanded: n,
|
|
2009
1986
|
is_state_stable: i
|
|
2010
|
-
} =
|
|
2011
|
-
height: W(
|
|
1987
|
+
} = e, a = {
|
|
1988
|
+
height: W(t),
|
|
2012
1989
|
isExpanded: n,
|
|
2013
1990
|
width: W(s)
|
|
2014
1991
|
};
|
|
@@ -2048,32 +2025,32 @@ class Ue {
|
|
|
2048
2025
|
}
|
|
2049
2026
|
}
|
|
2050
2027
|
function G(r) {
|
|
2051
|
-
const
|
|
2052
|
-
return
|
|
2053
|
-
height:
|
|
2054
|
-
isExpanded:
|
|
2055
|
-
stableHeight:
|
|
2056
|
-
width:
|
|
2057
|
-
})),
|
|
2058
|
-
}
|
|
2059
|
-
function
|
|
2028
|
+
const e = new Wt(r);
|
|
2029
|
+
return e.on("change", () => B("viewport", {
|
|
2030
|
+
height: e.height,
|
|
2031
|
+
isExpanded: e.isExpanded,
|
|
2032
|
+
stableHeight: e.stableHeight,
|
|
2033
|
+
width: e.width
|
|
2034
|
+
})), e.listen(), e;
|
|
2035
|
+
}
|
|
2036
|
+
function Ot(r, e, t, s) {
|
|
2060
2037
|
const n = r ? D("viewport") : null;
|
|
2061
2038
|
if (n)
|
|
2062
|
-
return G({ ...n, postEvent:
|
|
2063
|
-
if (
|
|
2039
|
+
return G({ ...n, postEvent: t });
|
|
2040
|
+
if (Dt(e))
|
|
2064
2041
|
return G({
|
|
2065
2042
|
height: window.innerHeight,
|
|
2066
2043
|
isExpanded: !0,
|
|
2067
|
-
postEvent:
|
|
2044
|
+
postEvent: t,
|
|
2068
2045
|
stableHeight: window.innerHeight,
|
|
2069
2046
|
width: window.innerWidth
|
|
2070
2047
|
});
|
|
2071
2048
|
if (s)
|
|
2072
|
-
return
|
|
2073
|
-
postEvent:
|
|
2049
|
+
return Ae({
|
|
2050
|
+
postEvent: t,
|
|
2074
2051
|
timeout: 5e3
|
|
2075
|
-
}).then(({ height: a, isStateStable: c, ...
|
|
2076
|
-
...
|
|
2052
|
+
}).then(({ height: a, isStateStable: c, ...u }) => G({
|
|
2053
|
+
...u,
|
|
2077
2054
|
height: a,
|
|
2078
2055
|
stableHeight: c ? a : 0
|
|
2079
2056
|
}));
|
|
@@ -2081,35 +2058,35 @@ function Me(r, t, e, s) {
|
|
|
2081
2058
|
width: 0,
|
|
2082
2059
|
height: 0,
|
|
2083
2060
|
isExpanded: !1,
|
|
2084
|
-
postEvent:
|
|
2061
|
+
postEvent: t,
|
|
2085
2062
|
stableHeight: 0
|
|
2086
2063
|
});
|
|
2087
|
-
return i.sync({ postEvent:
|
|
2064
|
+
return i.sync({ postEvent: t, timeout: 5e3 }).catch((a) => {
|
|
2088
2065
|
console.error("Unable to actualize viewport state", a);
|
|
2089
2066
|
}), i;
|
|
2090
2067
|
}
|
|
2091
|
-
function
|
|
2068
|
+
function Ht(r) {
|
|
2092
2069
|
return typeof r == "object" ? r : r ? {
|
|
2093
2070
|
themeParams: !0,
|
|
2094
2071
|
viewport: !0,
|
|
2095
2072
|
miniApp: !0
|
|
2096
2073
|
} : {};
|
|
2097
2074
|
}
|
|
2098
|
-
function
|
|
2099
|
-
const n =
|
|
2100
|
-
n.miniApp &&
|
|
2075
|
+
function ce(r, e, t, s) {
|
|
2076
|
+
const n = Ht(r);
|
|
2077
|
+
n.miniApp && Ct(e, t), n.themeParams && vt(t), n.viewport && (s instanceof Promise ? s.then(ae) : ae(s));
|
|
2101
2078
|
}
|
|
2102
|
-
function
|
|
2103
|
-
const { hostname:
|
|
2104
|
-
if (
|
|
2105
|
-
throw new Error(`Incorrect hostname: ${
|
|
2106
|
-
const s =
|
|
2079
|
+
function Nt(r) {
|
|
2080
|
+
const { hostname: e, pathname: t } = new URL(r, window.location.href);
|
|
2081
|
+
if (e !== "t.me")
|
|
2082
|
+
throw new Error(`Incorrect hostname: ${e}`);
|
|
2083
|
+
const s = t.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/);
|
|
2107
2084
|
if (s === null)
|
|
2108
2085
|
throw new Error('Link pathname has incorrect format. Expected to receive "/invoice/{slug}" or "/${slug}"');
|
|
2109
2086
|
return s[2];
|
|
2110
2087
|
}
|
|
2111
|
-
class
|
|
2112
|
-
constructor(
|
|
2088
|
+
class Ut {
|
|
2089
|
+
constructor(e, t = d) {
|
|
2113
2090
|
o(this, "ee", new w());
|
|
2114
2091
|
o(this, "state");
|
|
2115
2092
|
/**
|
|
@@ -2124,10 +2101,10 @@ class Fe {
|
|
|
2124
2101
|
* Checks if specified method is supported by current component.
|
|
2125
2102
|
*/
|
|
2126
2103
|
o(this, "supports");
|
|
2127
|
-
this.postEvent =
|
|
2104
|
+
this.postEvent = t, this.state = new b({ isOpened: !1 }, this.ee), this.supports = E(e, { open: "web_app_open_invoice" });
|
|
2128
2105
|
}
|
|
2129
|
-
set isOpened(
|
|
2130
|
-
this.state.set("isOpened",
|
|
2106
|
+
set isOpened(e) {
|
|
2107
|
+
this.state.set("isOpened", e);
|
|
2131
2108
|
}
|
|
2132
2109
|
/**
|
|
2133
2110
|
* True if invoice is currently opened.
|
|
@@ -2135,10 +2112,10 @@ class Fe {
|
|
|
2135
2112
|
get isOpened() {
|
|
2136
2113
|
return this.state.get("isOpened");
|
|
2137
2114
|
}
|
|
2138
|
-
async open(
|
|
2115
|
+
async open(e, t) {
|
|
2139
2116
|
if (this.isOpened)
|
|
2140
2117
|
throw new Error("Invoice is already opened");
|
|
2141
|
-
const s =
|
|
2118
|
+
const s = t ? Nt(e) : e;
|
|
2142
2119
|
this.isOpened = !0;
|
|
2143
2120
|
try {
|
|
2144
2121
|
return (await m(
|
|
@@ -2157,13 +2134,13 @@ class Fe {
|
|
|
2157
2134
|
}
|
|
2158
2135
|
}
|
|
2159
2136
|
}
|
|
2160
|
-
function
|
|
2161
|
-
const
|
|
2137
|
+
function Mt(r) {
|
|
2138
|
+
const e = r.message.trim(), t = (r.title || "").trim(), s = r.buttons || [];
|
|
2162
2139
|
let n;
|
|
2163
|
-
if (
|
|
2164
|
-
throw new Error(`Title has incorrect size: ${
|
|
2165
|
-
if (
|
|
2166
|
-
throw new Error(`Message has incorrect size: ${
|
|
2140
|
+
if (t.length > 64)
|
|
2141
|
+
throw new Error(`Title has incorrect size: ${t.length}`);
|
|
2142
|
+
if (e.length === 0 || e.length > 256)
|
|
2143
|
+
throw new Error(`Message has incorrect size: ${e.length}`);
|
|
2167
2144
|
if (s.length > 3)
|
|
2168
2145
|
throw new Error(`Buttons have incorrect size: ${s.length}`);
|
|
2169
2146
|
return s.length === 0 ? n = [{ type: "close", id: "" }] : n = s.map((i) => {
|
|
@@ -2173,16 +2150,16 @@ function ze(r) {
|
|
|
2173
2150
|
if (i.type === void 0 || i.type === "default" || i.type === "destructive") {
|
|
2174
2151
|
const c = i.text.trim();
|
|
2175
2152
|
if (c.length === 0 || c.length > 64) {
|
|
2176
|
-
const
|
|
2177
|
-
throw new Error(`Button text with type "${
|
|
2153
|
+
const u = i.type || "default";
|
|
2154
|
+
throw new Error(`Button text with type "${u}" has incorrect size: ${i.text.length}`);
|
|
2178
2155
|
}
|
|
2179
2156
|
return { ...i, text: c, id: a };
|
|
2180
2157
|
}
|
|
2181
2158
|
return { ...i, id: a };
|
|
2182
|
-
}), { title:
|
|
2159
|
+
}), { title: t, message: e, buttons: n };
|
|
2183
2160
|
}
|
|
2184
|
-
class
|
|
2185
|
-
constructor(
|
|
2161
|
+
class Gt {
|
|
2162
|
+
constructor(e, t = d) {
|
|
2186
2163
|
o(this, "ee", new w());
|
|
2187
2164
|
o(this, "state");
|
|
2188
2165
|
/**
|
|
@@ -2197,10 +2174,10 @@ class Je {
|
|
|
2197
2174
|
* Checks if specified method is supported by current component.
|
|
2198
2175
|
*/
|
|
2199
2176
|
o(this, "supports");
|
|
2200
|
-
this.postEvent =
|
|
2177
|
+
this.postEvent = t, this.state = new b({ isOpened: !1 }, this.ee), this.supports = E(e, { open: "web_app_open_popup" });
|
|
2201
2178
|
}
|
|
2202
|
-
set isOpened(
|
|
2203
|
-
this.state.set("isOpened",
|
|
2179
|
+
set isOpened(e) {
|
|
2180
|
+
this.state.set("isOpened", e);
|
|
2204
2181
|
}
|
|
2205
2182
|
/**
|
|
2206
2183
|
* True if popup is currently opened.
|
|
@@ -2221,21 +2198,21 @@ class Je {
|
|
|
2221
2198
|
* @param options - popup parameters.
|
|
2222
2199
|
* @throws {Error} Popup is already opened.
|
|
2223
2200
|
*/
|
|
2224
|
-
open(
|
|
2201
|
+
open(e) {
|
|
2225
2202
|
if (this.isOpened)
|
|
2226
2203
|
throw new Error("Popup is already opened.");
|
|
2227
2204
|
return this.isOpened = !0, m(
|
|
2228
2205
|
"web_app_open_popup",
|
|
2229
|
-
|
|
2206
|
+
Mt(e),
|
|
2230
2207
|
"popup_closed",
|
|
2231
2208
|
{ postEvent: this.postEvent }
|
|
2232
|
-
).then(({ button_id:
|
|
2209
|
+
).then(({ button_id: t = null }) => t).finally(() => {
|
|
2233
2210
|
this.isOpened = !1;
|
|
2234
2211
|
});
|
|
2235
2212
|
}
|
|
2236
2213
|
}
|
|
2237
|
-
class
|
|
2238
|
-
constructor(
|
|
2214
|
+
class jt {
|
|
2215
|
+
constructor(e, t = d) {
|
|
2239
2216
|
o(this, "ee", new w());
|
|
2240
2217
|
o(this, "state");
|
|
2241
2218
|
/**
|
|
@@ -2250,7 +2227,7 @@ class Qe {
|
|
|
2250
2227
|
* Checks if specified method is supported by current component.
|
|
2251
2228
|
*/
|
|
2252
2229
|
o(this, "supports");
|
|
2253
|
-
this.postEvent =
|
|
2230
|
+
this.postEvent = t, this.state = new b({ isOpened: !1 }, this.ee), this.supports = E(e, {
|
|
2254
2231
|
close: "web_app_close_scan_qr_popup",
|
|
2255
2232
|
open: "web_app_open_scan_qr_popup"
|
|
2256
2233
|
});
|
|
@@ -2261,8 +2238,8 @@ class Qe {
|
|
|
2261
2238
|
close() {
|
|
2262
2239
|
this.postEvent("web_app_close_scan_qr_popup"), this.isOpened = !1;
|
|
2263
2240
|
}
|
|
2264
|
-
set isOpened(
|
|
2265
|
-
this.state.set("isOpened",
|
|
2241
|
+
set isOpened(e) {
|
|
2242
|
+
this.state.set("isOpened", e);
|
|
2266
2243
|
}
|
|
2267
2244
|
/**
|
|
2268
2245
|
* Returns true in case, QR scanner is currently opened.
|
|
@@ -2276,25 +2253,25 @@ class Qe {
|
|
|
2276
2253
|
* case, scanner was closed.
|
|
2277
2254
|
* @param text - title to display.
|
|
2278
2255
|
*/
|
|
2279
|
-
async open(
|
|
2256
|
+
async open(e) {
|
|
2280
2257
|
if (this.isOpened)
|
|
2281
2258
|
throw new Error("QR scanner is already opened.");
|
|
2282
2259
|
this.isOpened = !0;
|
|
2283
2260
|
try {
|
|
2284
|
-
const
|
|
2261
|
+
const t = await m(
|
|
2285
2262
|
"web_app_open_scan_qr_popup",
|
|
2286
|
-
{ text:
|
|
2263
|
+
{ text: e },
|
|
2287
2264
|
["qr_text_received", "scan_qr_popup_closed"],
|
|
2288
2265
|
{ postEvent: this.postEvent }
|
|
2289
2266
|
);
|
|
2290
|
-
return typeof
|
|
2267
|
+
return typeof t == "object" && typeof t.data == "string" ? t.data : null;
|
|
2291
2268
|
} finally {
|
|
2292
2269
|
this.isOpened = !1;
|
|
2293
2270
|
}
|
|
2294
2271
|
}
|
|
2295
2272
|
}
|
|
2296
|
-
class
|
|
2297
|
-
constructor(
|
|
2273
|
+
class Ft {
|
|
2274
|
+
constructor(e, t, s = d) {
|
|
2298
2275
|
/**
|
|
2299
2276
|
* Checks if specified method is supported by current component.
|
|
2300
2277
|
*/
|
|
@@ -2303,9 +2280,9 @@ class Ze {
|
|
|
2303
2280
|
* Checks if specified method parameter is supported by current component.
|
|
2304
2281
|
*/
|
|
2305
2282
|
o(this, "supportsParam");
|
|
2306
|
-
this.version =
|
|
2283
|
+
this.version = e, this.createRequestId = t, this.postEvent = s, this.supports = E(e, {
|
|
2307
2284
|
readTextFromClipboard: "web_app_read_text_from_clipboard"
|
|
2308
|
-
}), this.supportsParam =
|
|
2285
|
+
}), this.supportsParam = Se(e, {
|
|
2309
2286
|
"openLink.tryInstantView": ["web_app_open_link", "try_instant_view"]
|
|
2310
2287
|
});
|
|
2311
2288
|
}
|
|
@@ -2318,15 +2295,15 @@ class Ze {
|
|
|
2318
2295
|
* @param url - URL to be opened.
|
|
2319
2296
|
* @param tryInstantView
|
|
2320
2297
|
*/
|
|
2321
|
-
openLink(
|
|
2322
|
-
const s = new URL(
|
|
2298
|
+
openLink(e, t) {
|
|
2299
|
+
const s = new URL(e, window.location.href).toString();
|
|
2323
2300
|
if (!I("web_app_open_link", this.version)) {
|
|
2324
2301
|
window.open(s, "_blank");
|
|
2325
2302
|
return;
|
|
2326
2303
|
}
|
|
2327
2304
|
this.postEvent("web_app_open_link", {
|
|
2328
2305
|
url: s,
|
|
2329
|
-
...typeof
|
|
2306
|
+
...typeof t == "boolean" ? { try_instant_view: t } : {}
|
|
2330
2307
|
});
|
|
2331
2308
|
}
|
|
2332
2309
|
/**
|
|
@@ -2335,16 +2312,16 @@ class Ze {
|
|
|
2335
2312
|
* @param url - URL to be opened.
|
|
2336
2313
|
* @throws {Error} URL has not allowed hostname.
|
|
2337
2314
|
*/
|
|
2338
|
-
openTelegramLink(
|
|
2315
|
+
openTelegramLink(e) {
|
|
2339
2316
|
const {
|
|
2340
|
-
hostname:
|
|
2317
|
+
hostname: t,
|
|
2341
2318
|
pathname: s,
|
|
2342
2319
|
search: n
|
|
2343
|
-
} = new URL(
|
|
2344
|
-
if (
|
|
2345
|
-
throw new Error(`URL has not allowed hostname: ${
|
|
2320
|
+
} = new URL(e, window.location.href);
|
|
2321
|
+
if (t !== "t.me")
|
|
2322
|
+
throw new Error(`URL has not allowed hostname: ${t}. Only "t.me" is allowed`);
|
|
2346
2323
|
if (!I("web_app_open_tg_link", this.version)) {
|
|
2347
|
-
window.location.href =
|
|
2324
|
+
window.location.href = e;
|
|
2348
2325
|
return;
|
|
2349
2326
|
}
|
|
2350
2327
|
this.postEvent("web_app_open_tg_link", { path_full: s + n });
|
|
@@ -2361,147 +2338,146 @@ class Ze {
|
|
|
2361
2338
|
{ req_id: this.createRequestId() },
|
|
2362
2339
|
"clipboard_text_received",
|
|
2363
2340
|
{ postEvent: this.postEvent }
|
|
2364
|
-
).then(({ data:
|
|
2341
|
+
).then(({ data: e = null }) => e);
|
|
2365
2342
|
}
|
|
2366
2343
|
}
|
|
2367
|
-
function
|
|
2344
|
+
function or(r = {}) {
|
|
2368
2345
|
const {
|
|
2369
|
-
async:
|
|
2370
|
-
complete:
|
|
2346
|
+
async: e = !1,
|
|
2347
|
+
complete: t = e,
|
|
2371
2348
|
cssVars: s = !1,
|
|
2372
2349
|
acceptCustomStyles: n = !1
|
|
2373
2350
|
} = r;
|
|
2374
2351
|
try {
|
|
2375
2352
|
const {
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
}
|
|
2386
|
-
vt() && (n && Ae(), l("iframe_ready", { reload_supported: !0 }), y("reload_iframe", () => window.location.reload()));
|
|
2353
|
+
initData: i,
|
|
2354
|
+
initDataRaw: a,
|
|
2355
|
+
version: c,
|
|
2356
|
+
platform: u,
|
|
2357
|
+
themeParams: p,
|
|
2358
|
+
botInline: g = !1
|
|
2359
|
+
} = te(), _ = le(), V = Lt(), l = gt(c);
|
|
2360
|
+
pe() && (n && kt(), l("iframe_ready", { reload_supported: !0 }), y("reload_iframe", () => {
|
|
2361
|
+
l("iframe_will_reload"), window.location.reload();
|
|
2362
|
+
}));
|
|
2387
2363
|
const C = {
|
|
2388
|
-
backButton:
|
|
2389
|
-
closingBehavior:
|
|
2390
|
-
cloudStorage: new
|
|
2391
|
-
createRequestId:
|
|
2392
|
-
hapticFeedback: new
|
|
2393
|
-
invoice: new
|
|
2394
|
-
mainButton:
|
|
2364
|
+
backButton: St(_, c, l),
|
|
2365
|
+
closingBehavior: xt(_, l),
|
|
2366
|
+
cloudStorage: new Et(c, V, l),
|
|
2367
|
+
createRequestId: V,
|
|
2368
|
+
hapticFeedback: new Pt(c, l),
|
|
2369
|
+
invoice: new Ut(c, l),
|
|
2370
|
+
mainButton: At(
|
|
2395
2371
|
_,
|
|
2396
|
-
|
|
2397
|
-
|
|
2372
|
+
p.buttonColor || "#000000",
|
|
2373
|
+
p.buttonTextColor || "#ffffff",
|
|
2398
2374
|
l
|
|
2399
2375
|
),
|
|
2400
|
-
miniApp:
|
|
2376
|
+
miniApp: It(
|
|
2401
2377
|
_,
|
|
2402
|
-
|
|
2378
|
+
p.backgroundColor || "#ffffff",
|
|
2403
2379
|
c,
|
|
2404
2380
|
g,
|
|
2405
|
-
|
|
2381
|
+
V,
|
|
2406
2382
|
l
|
|
2407
2383
|
),
|
|
2408
|
-
popup: new
|
|
2384
|
+
popup: new Gt(c, l),
|
|
2409
2385
|
postEvent: l,
|
|
2410
|
-
qrScanner: new
|
|
2411
|
-
settingsButton:
|
|
2412
|
-
themeParams:
|
|
2413
|
-
utils: new
|
|
2386
|
+
qrScanner: new jt(c, l),
|
|
2387
|
+
settingsButton: $t(_, c, l),
|
|
2388
|
+
themeParams: Bt(p),
|
|
2389
|
+
utils: new Ft(c, V, l),
|
|
2414
2390
|
...i ? {
|
|
2415
|
-
initData: new
|
|
2391
|
+
initData: new We(i),
|
|
2416
2392
|
initDataRaw: a
|
|
2417
2393
|
} : {}
|
|
2418
|
-
}, x =
|
|
2419
|
-
return x instanceof Promise ||
|
|
2394
|
+
}, x = Ot(_, u, l, t);
|
|
2395
|
+
return x instanceof Promise || t ? Promise.resolve(x).then((v) => (ce(
|
|
2420
2396
|
s,
|
|
2421
2397
|
C.miniApp,
|
|
2422
2398
|
C.themeParams,
|
|
2423
2399
|
v
|
|
2424
|
-
), { ...C, viewport: v })) : (
|
|
2400
|
+
), { ...C, viewport: v })) : (ce(
|
|
2425
2401
|
s,
|
|
2426
2402
|
C.miniApp,
|
|
2427
2403
|
C.themeParams,
|
|
2428
2404
|
x
|
|
2429
2405
|
), { ...C, viewport: x });
|
|
2430
2406
|
} catch (i) {
|
|
2431
|
-
if (
|
|
2407
|
+
if (t)
|
|
2432
2408
|
return Promise.reject(i);
|
|
2433
2409
|
throw i;
|
|
2434
2410
|
}
|
|
2435
2411
|
}
|
|
2436
|
-
function
|
|
2437
|
-
return r.startsWith(
|
|
2412
|
+
function O(r, e) {
|
|
2413
|
+
return r.startsWith(e) ? r : `${e}${r}`;
|
|
2438
2414
|
}
|
|
2439
|
-
function
|
|
2440
|
-
const
|
|
2441
|
-
return
|
|
2415
|
+
function ar(r) {
|
|
2416
|
+
const e = r.match(/#(.+)/);
|
|
2417
|
+
return e ? e[1] : null;
|
|
2442
2418
|
}
|
|
2443
|
-
async function
|
|
2419
|
+
async function N(r) {
|
|
2444
2420
|
return r === 0 ? !0 : Promise.race([
|
|
2445
|
-
new Promise((
|
|
2446
|
-
window.addEventListener("popstate", function
|
|
2447
|
-
window.removeEventListener("popstate",
|
|
2421
|
+
new Promise((e) => {
|
|
2422
|
+
window.addEventListener("popstate", function t() {
|
|
2423
|
+
window.removeEventListener("popstate", t), e(!0);
|
|
2448
2424
|
}), window.history.go(r);
|
|
2449
2425
|
}),
|
|
2450
2426
|
// Usually, it takes about 1ms to emit this event, but we use some buffer.
|
|
2451
|
-
new Promise((
|
|
2452
|
-
setTimeout(
|
|
2427
|
+
new Promise((e) => {
|
|
2428
|
+
setTimeout(e, 50, !1);
|
|
2453
2429
|
})
|
|
2454
2430
|
]);
|
|
2455
2431
|
}
|
|
2456
|
-
async function
|
|
2457
|
-
if (window.history.length <= 1 || (window.history.pushState(null, ""), await
|
|
2432
|
+
async function zt() {
|
|
2433
|
+
if (window.history.length <= 1 || (window.history.pushState(null, ""), await N(1 - window.history.length)))
|
|
2458
2434
|
return;
|
|
2459
|
-
let
|
|
2460
|
-
for (;
|
|
2461
|
-
|
|
2435
|
+
let e = await N(-1);
|
|
2436
|
+
for (; e; )
|
|
2437
|
+
e = await N(-1);
|
|
2462
2438
|
}
|
|
2463
|
-
class
|
|
2464
|
-
constructor(
|
|
2439
|
+
class Jt {
|
|
2440
|
+
constructor(e, t, {
|
|
2465
2441
|
debug: s = !1,
|
|
2466
2442
|
loggerPrefix: n = "Navigator"
|
|
2467
2443
|
}) {
|
|
2468
2444
|
o(this, "logger");
|
|
2469
2445
|
o(this, "entries");
|
|
2470
|
-
if (this.entriesCursor =
|
|
2446
|
+
if (this.entriesCursor = t, e.length === 0)
|
|
2471
2447
|
throw new Error("Entries list should not be empty.");
|
|
2472
|
-
if (
|
|
2448
|
+
if (t >= e.length)
|
|
2473
2449
|
throw new Error("Cursor should be less than entries count.");
|
|
2474
|
-
this.entries =
|
|
2450
|
+
this.entries = e.map(({ pathname: i = "", search: a, hash: c }) => {
|
|
2475
2451
|
if (!i.startsWith("/") && i.length > 0)
|
|
2476
2452
|
throw new Error('Pathname should start with "/"');
|
|
2477
2453
|
return {
|
|
2478
|
-
pathname:
|
|
2479
|
-
search: a ?
|
|
2480
|
-
hash: c ?
|
|
2454
|
+
pathname: O(i, "/"),
|
|
2455
|
+
search: a ? O(a, "?") : "",
|
|
2456
|
+
hash: c ? O(c, "#") : ""
|
|
2481
2457
|
};
|
|
2482
|
-
}), this.logger = new
|
|
2458
|
+
}), this.logger = new ve(`[${n}]`, s);
|
|
2483
2459
|
}
|
|
2484
2460
|
/**
|
|
2485
2461
|
* Converts entry to the navigation entry.
|
|
2486
2462
|
* @param entry - entry data
|
|
2487
2463
|
*/
|
|
2488
|
-
formatEntry(
|
|
2489
|
-
let
|
|
2490
|
-
if (typeof
|
|
2491
|
-
|
|
2464
|
+
formatEntry(e) {
|
|
2465
|
+
let t;
|
|
2466
|
+
if (typeof e == "string")
|
|
2467
|
+
t = e;
|
|
2492
2468
|
else {
|
|
2493
2469
|
const {
|
|
2494
2470
|
pathname: a = "",
|
|
2495
2471
|
search: c,
|
|
2496
|
-
hash:
|
|
2497
|
-
} =
|
|
2498
|
-
|
|
2472
|
+
hash: u
|
|
2473
|
+
} = e;
|
|
2474
|
+
t = a + (c ? O(c, "?") : "") + (u ? O(u, "#") : "");
|
|
2499
2475
|
}
|
|
2500
2476
|
const {
|
|
2501
2477
|
pathname: s,
|
|
2502
2478
|
search: n,
|
|
2503
2479
|
hash: i
|
|
2504
|
-
} = new URL(
|
|
2480
|
+
} = new URL(t, `https://localhost${this.path}`);
|
|
2505
2481
|
return {
|
|
2506
2482
|
pathname: s,
|
|
2507
2483
|
search: n,
|
|
@@ -2548,23 +2524,23 @@ class Ye {
|
|
|
2548
2524
|
* Moves entries cursor by specified delta.
|
|
2549
2525
|
* @param delta - cursor delta.
|
|
2550
2526
|
*/
|
|
2551
|
-
go(
|
|
2552
|
-
this.logger.log(`called go(${
|
|
2553
|
-
const
|
|
2527
|
+
go(e) {
|
|
2528
|
+
this.logger.log(`called go(${e})`);
|
|
2529
|
+
const t = Math.min(
|
|
2554
2530
|
this.entries.length - 1,
|
|
2555
|
-
Math.max(this.entriesCursor +
|
|
2531
|
+
Math.max(this.entriesCursor + e, 0)
|
|
2556
2532
|
);
|
|
2557
|
-
if (this.entriesCursor ===
|
|
2533
|
+
if (this.entriesCursor === t)
|
|
2558
2534
|
return this.performGo({
|
|
2559
2535
|
updated: !1,
|
|
2560
|
-
delta:
|
|
2536
|
+
delta: e
|
|
2561
2537
|
});
|
|
2562
2538
|
const s = this.entry;
|
|
2563
|
-
this.entriesCursor =
|
|
2539
|
+
this.entriesCursor = t;
|
|
2564
2540
|
const n = this.entry;
|
|
2565
2541
|
return this.logger.log("State changed", { before: s, after: n }), this.performGo({
|
|
2566
2542
|
updated: !0,
|
|
2567
|
-
delta:
|
|
2543
|
+
delta: e,
|
|
2568
2544
|
before: s,
|
|
2569
2545
|
after: n
|
|
2570
2546
|
});
|
|
@@ -2573,7 +2549,7 @@ class Ye {
|
|
|
2573
2549
|
* Returns copy of navigator entries.
|
|
2574
2550
|
*/
|
|
2575
2551
|
getEntries() {
|
|
2576
|
-
return this.entries.map((
|
|
2552
|
+
return this.entries.map((e) => ({ ...e }));
|
|
2577
2553
|
}
|
|
2578
2554
|
/**
|
|
2579
2555
|
* Current hash.
|
|
@@ -2604,10 +2580,10 @@ class Ye {
|
|
|
2604
2580
|
* push("#my-hash"); // "/home" -> "/home#my-hash"
|
|
2605
2581
|
* push("johny#my-hash"); // "/home/root" -> "/home/johny#my-hash"
|
|
2606
2582
|
*/
|
|
2607
|
-
push(
|
|
2583
|
+
push(e) {
|
|
2608
2584
|
this.entriesCursor !== this.entries.length - 1 && this.entries.splice(this.entriesCursor + 1);
|
|
2609
|
-
const
|
|
2610
|
-
this.entriesCursor += 1, this.entries[this.entriesCursor] =
|
|
2585
|
+
const t = this.formatEntry(e), s = this.entry;
|
|
2586
|
+
this.entriesCursor += 1, this.entries[this.entriesCursor] = t;
|
|
2611
2587
|
const n = this.entry;
|
|
2612
2588
|
return this.logger.log("State changed", { before: s, after: n }), this.performPush({
|
|
2613
2589
|
before: s,
|
|
@@ -2634,15 +2610,15 @@ class Ye {
|
|
|
2634
2610
|
* @see push
|
|
2635
2611
|
* @returns True if changes were done.
|
|
2636
2612
|
*/
|
|
2637
|
-
replace(
|
|
2638
|
-
const
|
|
2639
|
-
if (this.search ===
|
|
2613
|
+
replace(e) {
|
|
2614
|
+
const t = this.formatEntry(e);
|
|
2615
|
+
if (this.search === t.search && this.pathname === t.pathname && this.hash === t.hash)
|
|
2640
2616
|
return this.performReplace({
|
|
2641
2617
|
updated: !1,
|
|
2642
|
-
entry:
|
|
2618
|
+
entry: t
|
|
2643
2619
|
});
|
|
2644
2620
|
const s = this.entry;
|
|
2645
|
-
this.entries[this.entriesCursor] =
|
|
2621
|
+
this.entries[this.entriesCursor] = t;
|
|
2646
2622
|
const n = this.entry;
|
|
2647
2623
|
return this.logger.log("State changed", { before: s, after: n }), this.performReplace({
|
|
2648
2624
|
updated: !0,
|
|
@@ -2659,10 +2635,10 @@ class Ye {
|
|
|
2659
2635
|
return this.entry.search;
|
|
2660
2636
|
}
|
|
2661
2637
|
}
|
|
2662
|
-
const
|
|
2663
|
-
class
|
|
2664
|
-
constructor(
|
|
2665
|
-
super(
|
|
2638
|
+
const he = 0, Z = 1, K = 2;
|
|
2639
|
+
class Ve extends Jt {
|
|
2640
|
+
constructor(t, s, n = {}) {
|
|
2641
|
+
super(t, s, {
|
|
2666
2642
|
...n,
|
|
2667
2643
|
loggerPrefix: "HashNavigator"
|
|
2668
2644
|
});
|
|
@@ -2672,16 +2648,16 @@ class Vt extends Ye {
|
|
|
2672
2648
|
* Handles window "popstate" event.
|
|
2673
2649
|
* @param state - event state.
|
|
2674
2650
|
*/
|
|
2675
|
-
o(this, "onPopState", async ({ state:
|
|
2676
|
-
if (this.logger.log('"popstate" event received. State:',
|
|
2651
|
+
o(this, "onPopState", async ({ state: t }) => {
|
|
2652
|
+
if (this.logger.log('"popstate" event received. State:', t), t === null)
|
|
2677
2653
|
return this.push(window.location.hash.slice(1));
|
|
2678
|
-
if (
|
|
2654
|
+
if (t === he) {
|
|
2679
2655
|
this.logger.log("Void reached. Moving history forward"), window.history.forward();
|
|
2680
2656
|
return;
|
|
2681
2657
|
}
|
|
2682
|
-
if (
|
|
2658
|
+
if (t === Z)
|
|
2683
2659
|
return this.back();
|
|
2684
|
-
if (
|
|
2660
|
+
if (t === K)
|
|
2685
2661
|
return this.forward();
|
|
2686
2662
|
});
|
|
2687
2663
|
o(this, "back", () => super.back());
|
|
@@ -2698,7 +2674,7 @@ class Vt extends Ye {
|
|
|
2698
2674
|
* Creates navigator from current window location hash.
|
|
2699
2675
|
* @param options - options passed to constructor.
|
|
2700
2676
|
*/
|
|
2701
|
-
static fromLocation(
|
|
2677
|
+
static fromLocation(t) {
|
|
2702
2678
|
const {
|
|
2703
2679
|
search: s,
|
|
2704
2680
|
pathname: n,
|
|
@@ -2707,29 +2683,29 @@ class Vt extends Ye {
|
|
|
2707
2683
|
window.location.hash.slice(1),
|
|
2708
2684
|
window.location.href
|
|
2709
2685
|
);
|
|
2710
|
-
return new
|
|
2686
|
+
return new Ve([{ search: s, pathname: n, hash: i }], 0, t);
|
|
2711
2687
|
}
|
|
2712
|
-
async performGo(
|
|
2713
|
-
|
|
2688
|
+
async performGo(t) {
|
|
2689
|
+
t.updated && (this.attached && await this.syncHistory(), this.emitChanged(t.before, t.after));
|
|
2714
2690
|
}
|
|
2715
|
-
async performPush({ before:
|
|
2716
|
-
this.attached && await this.syncHistory(), this.emitChanged(
|
|
2691
|
+
async performPush({ before: t, after: s }) {
|
|
2692
|
+
this.attached && await this.syncHistory(), this.emitChanged(t, s);
|
|
2717
2693
|
}
|
|
2718
|
-
async performReplace(
|
|
2719
|
-
|
|
2694
|
+
async performReplace(t) {
|
|
2695
|
+
t.updated && (this.attached && window.history.replaceState(null, "", `#${this.path}`), this.emitChanged(t.before, t.after));
|
|
2720
2696
|
}
|
|
2721
2697
|
/**
|
|
2722
2698
|
* Synchronizes current navigator state with browser history.
|
|
2723
2699
|
*/
|
|
2724
2700
|
async syncHistory() {
|
|
2725
2701
|
window.removeEventListener("popstate", this.onPopState);
|
|
2726
|
-
const
|
|
2727
|
-
await
|
|
2702
|
+
const t = `#${this.path}`;
|
|
2703
|
+
await zt(), d("web_app_setup_back_button", { is_visible: this.canGoBack }), this.canGoBack && this.canGoForward ? (this.logger.log("Setting up history: [<-, *, ->]"), window.history.replaceState(Z, ""), window.history.pushState(null, "", t), window.history.pushState(K, ""), await N(-1)) : this.canGoBack ? (this.logger.log("Setting up history: [<-, *]"), window.history.replaceState(Z, ""), window.history.pushState(null, "", t)) : this.canGoForward ? (this.logger.log("Setting up history: [*, ->]"), window.history.replaceState(null, t), window.history.pushState(K, ""), await N(-1)) : (this.logger.log("Setting up history: [~, *]"), window.history.replaceState(he, ""), window.history.pushState(null, "", t)), window.addEventListener("popstate", this.onPopState);
|
|
2728
2704
|
}
|
|
2729
|
-
emitChanged(
|
|
2705
|
+
emitChanged(t, s) {
|
|
2730
2706
|
this.ee.emit("change", {
|
|
2731
2707
|
navigator: this,
|
|
2732
|
-
from:
|
|
2708
|
+
from: t,
|
|
2733
2709
|
to: s
|
|
2734
2710
|
});
|
|
2735
2711
|
}
|
|
@@ -2744,82 +2720,84 @@ class Vt extends Ye {
|
|
|
2744
2720
|
* Detaches current navigator from the browser history.
|
|
2745
2721
|
*/
|
|
2746
2722
|
detach() {
|
|
2747
|
-
this.attached && (this.logger.log("Detaching", this), this.attached = !1, window.removeEventListener("popstate", this.onPopState),
|
|
2723
|
+
this.attached && (this.logger.log("Detaching", this), this.attached = !1, window.removeEventListener("popstate", this.onPopState), $("back_button_pressed", this.back));
|
|
2748
2724
|
}
|
|
2749
2725
|
}
|
|
2750
2726
|
export {
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2727
|
+
bt as BackButton,
|
|
2728
|
+
yt as ClosingBehavior,
|
|
2729
|
+
Et as CloudStorage,
|
|
2730
|
+
Pt as HapticFeedback,
|
|
2731
|
+
Ve as HashNavigator,
|
|
2732
|
+
We as InitData,
|
|
2733
|
+
Ut as Invoice,
|
|
2734
|
+
qt as MainButton,
|
|
2735
|
+
re as MethodUnsupportedError,
|
|
2736
|
+
Rt as MiniApp,
|
|
2737
|
+
Jt as Navigator,
|
|
2738
|
+
se as ParameterUnsupportedError,
|
|
2763
2739
|
F as ParseError,
|
|
2764
2740
|
j as ParseSchemaFieldError,
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2741
|
+
Gt as Popup,
|
|
2742
|
+
jt as QRScanner,
|
|
2743
|
+
Tt as SettingsButton,
|
|
2744
|
+
Ue as ThemeParams,
|
|
2769
2745
|
J as TimeoutError,
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2746
|
+
Ft as Utils,
|
|
2747
|
+
Wt as Viewport,
|
|
2748
|
+
$e as array,
|
|
2749
|
+
Ct as bindMiniAppCSSVars,
|
|
2750
|
+
vt as bindThemeCSSVars,
|
|
2751
|
+
ae as bindViewportCSSVars,
|
|
2776
2752
|
k as boolean,
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2753
|
+
De as chatParser,
|
|
2754
|
+
mt as classNames,
|
|
2755
|
+
ft as compareVersions,
|
|
2756
|
+
gt as createPostEvent,
|
|
2757
|
+
fe as date,
|
|
2758
|
+
ar as getHash,
|
|
2759
|
+
or as init,
|
|
2760
|
+
be as initDataParser,
|
|
2761
|
+
H as invokeCustomMethod,
|
|
2762
|
+
we as isColorDark,
|
|
2763
|
+
pe as isIframe,
|
|
2764
|
+
le as isPageReload,
|
|
2788
2765
|
X as isRGB,
|
|
2789
|
-
|
|
2766
|
+
Be as isRGBShort,
|
|
2790
2767
|
R as isRecord,
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2768
|
+
Dt as isStableViewportPlatform,
|
|
2769
|
+
tr as isTMA,
|
|
2770
|
+
nr as isTimeoutError,
|
|
2794
2771
|
f as json,
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2772
|
+
Me as launchParamsParser,
|
|
2773
|
+
ir as mergeClassNames,
|
|
2774
|
+
A as number,
|
|
2775
|
+
$ as off,
|
|
2799
2776
|
y as on,
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2777
|
+
rr as once,
|
|
2778
|
+
Zt as parseInitData,
|
|
2779
|
+
Ee as parseLaunchParams,
|
|
2780
|
+
Xe as parseMessage,
|
|
2781
|
+
ye as parseThemeParams,
|
|
2805
2782
|
d as postEvent,
|
|
2806
2783
|
m as request,
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2784
|
+
Kt as requestThemeParams,
|
|
2785
|
+
Ae as requestViewport,
|
|
2786
|
+
er as retrieveLaunchData,
|
|
2787
|
+
te as retrieveLaunchParams,
|
|
2788
|
+
_e as rgb,
|
|
2789
|
+
ee as searchParams,
|
|
2790
|
+
ze as serializeLaunchParams,
|
|
2791
|
+
Ne as serializeThemeParams,
|
|
2814
2792
|
S as setCSSVar,
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2793
|
+
Yt as setDebug,
|
|
2794
|
+
Xt as setTargetOrigin,
|
|
2795
|
+
h as string,
|
|
2796
|
+
sr as subscribe,
|
|
2819
2797
|
I as supports,
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2798
|
+
me as themeParamsParser,
|
|
2799
|
+
ge as toRGB,
|
|
2800
|
+
dt as unsubscribe,
|
|
2801
|
+
ne as userParser,
|
|
2802
|
+
xe as withTimeout
|
|
2825
2803
|
};
|