@tma.js/sdk 2.0.2 → 2.2.0

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.
Files changed (34) hide show
  1. package/dist/dts/bridge/events/types.d.ts +12 -6
  2. package/dist/dts/components/BackButton/initBackButton.d.ts +1 -1
  3. package/dist/dts/components/BiometryManager/initBiometryManager.d.ts +1 -1
  4. package/dist/dts/components/ClosingBehavior/initClosingBehavior.d.ts +1 -1
  5. package/dist/dts/components/CloudStorage/initCloudStorage.d.ts +1 -1
  6. package/dist/dts/components/HapticFeedback/initHapticFeedback.d.ts +1 -1
  7. package/dist/dts/components/InitData/initInitData.d.ts +1 -1
  8. package/dist/dts/components/Invoice/initInvoice.d.ts +1 -1
  9. package/dist/dts/components/MainButton/MainButton.d.ts +28 -28
  10. package/dist/dts/components/MainButton/initMainButton.d.ts +1 -1
  11. package/dist/dts/components/MainButton/types.d.ts +1 -1
  12. package/dist/dts/components/MiniApp/initMiniApp.d.ts +1 -1
  13. package/dist/dts/components/Popup/initPopup.d.ts +1 -1
  14. package/dist/dts/components/QRScanner/initQRScanner.d.ts +1 -1
  15. package/dist/dts/components/SettingsButton/initSettingsButton.d.ts +1 -1
  16. package/dist/dts/components/ThemeParams/initThemeParams.d.ts +1 -1
  17. package/dist/dts/components/Utils/initUtils.d.ts +1 -1
  18. package/dist/dts/components/Viewport/initViewport.d.ts +1 -2
  19. package/dist/dts/index.d.ts +1 -1
  20. package/dist/dts/misc/createCleanup.d.ts +11 -0
  21. package/dist/dts/misc/createComponentInitFn/createComponentInitFn.d.ts +7 -6
  22. package/dist/dts/misc/createComponentInitFn/types.d.ts +28 -20
  23. package/dist/dts/navigation/BrowserNavigator/BrowserNavigator.d.ts +1 -1
  24. package/dist/dts/navigation/BrowserNavigator/types.d.ts +5 -4
  25. package/dist/index.cjs +1 -1
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.iife.js +1 -1
  28. package/dist/index.iife.js.map +1 -1
  29. package/dist/index.js +671 -654
  30. package/dist/index.js.map +1 -1
  31. package/dist/index.low-level.iife.js +1 -1
  32. package/dist/index.low-level.iife.js.map +1 -1
  33. package/package.json +1 -1
  34. package/dist/dts/components/Viewport/initViewportFromRequest.d.ts +0 -10
package/dist/index.js CHANGED
@@ -1,21 +1,21 @@
1
- var Lt = Object.defineProperty;
2
- var Bt = (e, t, s) => t in e ? Lt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
- var c = (e, t, s) => (Bt(e, typeof t != "symbol" ? t + "" : t, s), s);
4
- function at(e, t) {
1
+ var Vt = Object.defineProperty;
2
+ var $t = (e, t, s) => t in e ? Vt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s;
3
+ var c = (e, t, s) => ($t(e, typeof t != "symbol" ? t + "" : t, s), s);
4
+ function it(e, t) {
5
5
  let s;
6
6
  const n = () => {
7
7
  s !== void 0 && t && t(s), s = void 0;
8
8
  };
9
9
  return [() => s === void 0 ? s = e(n) : s, n];
10
10
  }
11
- function ct(e) {
12
- const t = L(), { count: s } = t;
13
- t.unsubscribe(e), s && !t.count && ae();
11
+ function ot(e) {
12
+ const t = M(), { count: s } = t;
13
+ t.unsubscribe(e), s && !t.count && ne();
14
14
  }
15
- function Ot(e) {
16
- return L().subscribe(e), () => ct(e);
15
+ function Mt(e) {
16
+ return M().subscribe(e), () => ot(e);
17
17
  }
18
- class Ut {
18
+ class Lt {
19
19
  constructor(t, s = {}) {
20
20
  this.scope = t, this.options = s;
21
21
  }
@@ -31,12 +31,12 @@ class Ut {
31
31
  second: "2-digit",
32
32
  fractionalSecondDigits: 3,
33
33
  timeZone: "UTC"
34
- }).format(n), { textColor: i, bgColor: o } = this.options, a = "font-weight: bold;padding: 0 5px;border-radius:5px";
34
+ }).format(n), { textColor: i, bgColor: a } = this.options, o = "font-weight: bold;padding: 0 5px;border-radius:5px";
35
35
  console[t](
36
36
  `%c${r}%c / %c${this.scope}`,
37
- `${a};background-color: lightblue;color:black`,
37
+ `${o};background-color: lightblue;color:black`,
38
38
  "",
39
- `${a};${i ? `color:${i};` : ""}${o ? `background-color:${o}` : ""}`,
39
+ `${o};${i ? `color:${i};` : ""}${a ? `background-color:${a}` : ""}`,
40
40
  ...s
41
41
  );
42
42
  }
@@ -55,21 +55,21 @@ class Ut {
55
55
  this.print("log", ...t);
56
56
  }
57
57
  }
58
- const D = new Ut("SDK", {
58
+ const F = new Lt("SDK", {
59
59
  bgColor: "forestgreen",
60
60
  textColor: "white"
61
61
  });
62
- let j = !1;
63
- const st = ({ event: e, args: [t] }) => {
64
- D.log("Event received:", t === void 0 ? { name: e } : { name: e, data: t });
62
+ let G = !1;
63
+ const et = ({ name: e, payload: t }) => {
64
+ F.log("Event received:", t ? { name: e, payload: t } : { name: e });
65
65
  };
66
- function ts(e) {
67
- j !== e && (j = e, e ? Ot(st) : ct(st));
66
+ function Ye(e) {
67
+ G !== e && (G = e, e ? Mt(et) : ot(et));
68
68
  }
69
- function Wt(...e) {
70
- j && D.log(...e);
69
+ function Bt(...e) {
70
+ G && F.log(...e);
71
71
  }
72
- class V {
72
+ class R {
73
73
  constructor() {
74
74
  c(this, "listeners", /* @__PURE__ */ new Map());
75
75
  c(this, "listenersCount", 0);
@@ -141,22 +141,33 @@ class V {
141
141
  }
142
142
  }
143
143
  }
144
- function F(e, t, s) {
144
+ function j(e, t, s) {
145
145
  return window.addEventListener(e, t, s), () => window.removeEventListener(e, t, s);
146
146
  }
147
- class $ extends Error {
147
+ function at(...e) {
148
+ let t = !1;
149
+ const s = [...e];
150
+ return [
151
+ (n) => !t && s.push(n),
152
+ () => {
153
+ t || (t = !0, s.forEach((n) => n()));
154
+ },
155
+ t
156
+ ];
157
+ }
158
+ class V extends Error {
148
159
  constructor(t, s, n) {
149
- super(s, { cause: n }), this.type = t, Object.setPrototypeOf(this, $.prototype);
160
+ super(s, { cause: n }), this.type = t, Object.setPrototypeOf(this, V.prototype);
150
161
  }
151
162
  }
152
163
  function f(e, t, s) {
153
- return new $(e, t, s);
164
+ return new V(e, t, s);
154
165
  }
155
- const Ht = "ERR_METHOD_UNSUPPORTED", Gt = "ERR_METHOD_PARAMETER_UNSUPPORTED", jt = "ERR_UNKNOWN_ENV", Ft = "ERR_INVOKE_CUSTOM_METHOD_RESPONSE", zt = "ERR_TIMED_OUT", Jt = "ERR_UNEXPECTED_TYPE", ht = "ERR_PARSE", Qt = "ERR_NAVIGATION_LIST_EMPTY", Yt = "ERR_NAVIGATION_CURSOR_INVALID", es = "ERR_NAVIGATION_ITEM_INVALID", pt = "ERR_SSR_INIT", Zt = "ERR_INVALID_PATH_BASE";
156
- function P() {
157
- return f(Jt, "Value has unexpected type");
166
+ const Ot = "ERR_METHOD_UNSUPPORTED", Ut = "ERR_METHOD_PARAMETER_UNSUPPORTED", Wt = "ERR_UNKNOWN_ENV", Ht = "ERR_INVOKE_CUSTOM_METHOD_RESPONSE", Gt = "ERR_TIMED_OUT", jt = "ERR_UNEXPECTED_TYPE", ct = "ERR_PARSE", zt = "ERR_NAVIGATION_LIST_EMPTY", Ft = "ERR_NAVIGATION_CURSOR_INVALID", Ze = "ERR_NAVIGATION_ITEM_INVALID", Ke = "ERR_SSR_INIT", Jt = "ERR_INVALID_PATH_BASE";
167
+ function E() {
168
+ return f(jt, "Value has unexpected type");
158
169
  }
159
- class M {
170
+ class $ {
160
171
  constructor(t, s, n) {
161
172
  this.parser = t, this.isOptional = s, this.type = n;
162
173
  }
@@ -172,7 +183,7 @@ class M {
172
183
  return this.parser(t);
173
184
  } catch (s) {
174
185
  throw f(
175
- ht,
186
+ ct,
176
187
  `Unable to parse value${this.type ? ` as ${this.type}` : ""}`,
177
188
  s
178
189
  );
@@ -182,10 +193,10 @@ class M {
182
193
  return this.isOptional = !0, this;
183
194
  }
184
195
  }
185
- function x(e, t) {
186
- return () => new M(e, !1, t);
196
+ function P(e, t) {
197
+ return () => new $(e, !1, t);
187
198
  }
188
- const w = x((e) => {
199
+ const w = P((e) => {
189
200
  if (typeof e == "boolean")
190
201
  return e;
191
202
  const t = String(e);
@@ -193,26 +204,26 @@ const w = x((e) => {
193
204
  return !0;
194
205
  if (t === "0" || t === "false")
195
206
  return !1;
196
- throw P();
207
+ throw E();
197
208
  }, "boolean");
198
- function ut(e, t) {
209
+ function ht(e, t) {
199
210
  const s = {};
200
211
  for (const n in e) {
201
212
  const r = e[n];
202
213
  if (!r)
203
214
  continue;
204
- let i, o;
215
+ let i, a;
205
216
  if (typeof r == "function" || "parse" in r)
206
- i = n, o = typeof r == "function" ? r : r.parse.bind(r);
217
+ i = n, a = typeof r == "function" ? r : r.parse.bind(r);
207
218
  else {
208
- const { type: a } = r;
209
- i = r.from || n, o = typeof a == "function" ? a : a.parse.bind(a);
219
+ const { type: o } = r;
220
+ i = r.from || n, a = typeof o == "function" ? o : o.parse.bind(o);
210
221
  }
211
222
  try {
212
- const a = o(t(i));
213
- a !== void 0 && (s[n] = a);
214
- } catch (a) {
215
- throw f(ht, `Unable to parse field "${n}"`, a);
223
+ const o = a(t(i));
224
+ o !== void 0 && (s[n] = o);
225
+ } catch (o) {
226
+ throw f(ct, `Unable to parse field "${n}"`, o);
216
227
  }
217
228
  }
218
229
  return s;
@@ -220,16 +231,16 @@ function ut(e, t) {
220
231
  function J(e) {
221
232
  let t = e;
222
233
  if (typeof t == "string" && (t = JSON.parse(t)), typeof t != "object" || t === null || Array.isArray(t))
223
- throw P();
234
+ throw E();
224
235
  return t;
225
236
  }
226
237
  function d(e, t) {
227
- return new M((s) => {
238
+ return new $((s) => {
228
239
  const n = J(s);
229
- return ut(e, (r) => n[r]);
240
+ return ht(e, (r) => n[r]);
230
241
  }, !1, t);
231
242
  }
232
- const v = x((e) => {
243
+ const y = P((e) => {
233
244
  if (typeof e == "number")
234
245
  return e;
235
246
  if (typeof e == "string") {
@@ -237,19 +248,19 @@ const v = x((e) => {
237
248
  if (!Number.isNaN(t))
238
249
  return t;
239
250
  }
240
- throw P();
251
+ throw E();
241
252
  }, "number");
242
253
  function Q(e) {
243
254
  return /^#[\da-f]{6}$/i.test(e);
244
255
  }
245
- function Xt(e) {
256
+ function Qt(e) {
246
257
  return /^#[\da-f]{3}$/i.test(e);
247
258
  }
248
- function lt(e) {
259
+ function pt(e) {
249
260
  const t = e.replace(/\s/g, "").toLowerCase();
250
261
  if (Q(t))
251
262
  return t;
252
- if (Xt(t)) {
263
+ if (Qt(t)) {
253
264
  let n = "#";
254
265
  for (let r = 0; r < 3; r += 1)
255
266
  n += t[1 + r].repeat(2);
@@ -263,30 +274,30 @@ function lt(e) {
263
274
  return n + (i.length === 1 ? "0" : "") + i;
264
275
  }, "#");
265
276
  }
266
- const h = x((e) => {
277
+ const h = P((e) => {
267
278
  if (typeof e == "string" || typeof e == "number")
268
279
  return e.toString();
269
- throw P();
270
- }, "string"), dt = x((e) => lt(h().parse(e)), "rgb");
271
- function Kt(e) {
280
+ throw E();
281
+ }, "string"), ut = P((e) => pt(h().parse(e)), "rgb");
282
+ function Yt(e) {
272
283
  return d({
273
284
  eventType: h(),
274
285
  eventData: (t) => t
275
286
  }).parse(e);
276
287
  }
277
- function te() {
288
+ function Zt() {
278
289
  ["TelegramGameProxy_receiveEvent", "TelegramGameProxy", "Telegram"].forEach((e) => {
279
290
  delete window[e];
280
291
  });
281
292
  }
282
- function ee(e, t) {
293
+ function Kt(e, t) {
283
294
  window.dispatchEvent(new MessageEvent("message", {
284
295
  data: JSON.stringify({ eventType: e, eventData: t }),
285
296
  // We specify window.parent to imitate the case, the parent iframe sent us this event.
286
297
  source: window.parent
287
298
  }));
288
299
  }
289
- function se() {
300
+ function Xt() {
290
301
  [
291
302
  ["TelegramGameProxy_receiveEvent"],
292
303
  // Windows Phone.
@@ -298,16 +309,14 @@ function se() {
298
309
  let t = window;
299
310
  e.forEach((s, n, r) => {
300
311
  if (n === r.length - 1) {
301
- t[s] = ee;
312
+ t[s] = Kt;
302
313
  return;
303
314
  }
304
315
  s in t || (t[s] = {}), t = t[s];
305
316
  });
306
317
  });
307
318
  }
308
- const ne = d({
309
- button_id: (e) => e == null ? void 0 : h().parse(e)
310
- }), re = {
319
+ const te = {
311
320
  clipboard_text_received: d({
312
321
  req_id: h(),
313
322
  data: (e) => e === null ? e : h().optional().parse(e)
@@ -317,48 +326,45 @@ const ne = d({
317
326
  result: (e) => e,
318
327
  error: h().optional()
319
328
  }),
320
- invoice_closed: d({
321
- slug: h(),
322
- status: h()
323
- }),
324
- phone_requested: d({
325
- status: h()
326
- }),
329
+ invoice_closed: d({ slug: h(), status: h() }),
330
+ phone_requested: d({ status: h() }),
327
331
  popup_closed: {
328
- parse: (e) => ne.parse(e ?? {})
332
+ parse(e) {
333
+ return d({
334
+ button_id: (t) => t == null ? void 0 : h().parse(t)
335
+ }).parse(e ?? {});
336
+ }
329
337
  },
330
- qr_text_received: d({
331
- data: h().optional()
332
- }),
338
+ qr_text_received: d({ data: h().optional() }),
333
339
  theme_changed: d({
334
340
  theme_params: (e) => {
335
- const t = dt().optional();
341
+ const t = ut().optional();
336
342
  return Object.entries(J(e)).reduce((s, [n, r]) => (s[n] = t.parse(r), s), {});
337
343
  }
338
344
  }),
339
345
  viewport_changed: d({
340
- height: v(),
341
- width: (e) => e == null ? window.innerWidth : v().parse(e),
346
+ height: y(),
347
+ width: (e) => e == null ? window.innerWidth : y().parse(e),
342
348
  is_state_stable: w(),
343
349
  is_expanded: w()
344
350
  }),
345
- write_access_requested: d({
346
- status: h()
347
- })
351
+ write_access_requested: d({ status: h() })
348
352
  };
349
- function ie() {
350
- const e = new V();
351
- se();
352
- let t = [
353
+ function ee() {
354
+ const e = new R(), t = new R();
355
+ t.subscribe((n) => {
356
+ e.emit("event", { name: n.event, payload: n.args[0] });
357
+ }), Xt();
358
+ const [, s] = at(
353
359
  // Don't forget to remove created handlers.
354
- te,
360
+ Zt,
355
361
  // Add "resize" event listener to make sure, we always have fresh viewport information.
356
362
  // Desktop version of Telegram is sometimes not sending the viewport_changed
357
363
  // event. For example, when the MainButton is shown. That's why we should
358
364
  // add our own listener to make sure, viewport information is always fresh.
359
365
  // Issue: https://github.com/Telegram-Mini-Apps/tma.js/issues/10
360
- F("resize", () => {
361
- e.emit("viewport_changed", {
366
+ j("resize", () => {
367
+ t.emit("viewport_changed", {
362
368
  width: window.innerWidth,
363
369
  height: window.innerHeight,
364
370
  is_state_stable: !0,
@@ -367,69 +373,80 @@ function ie() {
367
373
  }),
368
374
  // Add listener, which handles events sent from the Telegram web application and also events
369
375
  // generated by the local emitEvent function.
370
- F("message", (s) => {
371
- if (s.source !== window.parent)
376
+ j("message", (n) => {
377
+ if (n.source !== window.parent)
372
378
  return;
373
- let n;
379
+ let r;
374
380
  try {
375
- n = Kt(s.data);
381
+ r = Yt(n.data);
376
382
  } catch {
377
383
  return;
378
384
  }
379
- const { eventType: r, eventData: i } = n, o = re[r];
385
+ const { eventType: i, eventData: a } = r, o = te[i];
380
386
  try {
381
- const a = o ? o.parse(i) : i;
382
- e.emit(...a ? [r, a] : [r]);
383
- } catch (a) {
384
- D.error(
385
- `An error occurred processing the "${r}" event from the Telegram application. Please, file an issue here: https://github.com/Telegram-Mini-Apps/tma.js/issues/new/choose`,
386
- n,
387
- a
387
+ const p = o ? o.parse(a) : a;
388
+ t.emit(...p ? [i, p] : [i]);
389
+ } catch (p) {
390
+ F.error(
391
+ `An error occurred processing the "${i}" event from the Telegram application. Please, file an issue here: https://github.com/Telegram-Mini-Apps/tma.js/issues/new/choose`,
392
+ r,
393
+ p
388
394
  );
389
395
  }
390
396
  }),
391
- // Clear emitter bound events.
392
- () => e.clear()
393
- ];
394
- return [e, () => {
395
- t.forEach((s) => s()), t = [];
396
- }];
397
+ // Clear emitters.
398
+ () => e.clear(),
399
+ () => t.clear()
400
+ );
401
+ return [{
402
+ on: t.on.bind(t),
403
+ off: t.off.bind(t),
404
+ subscribe(n) {
405
+ return e.on("event", n);
406
+ },
407
+ unsubscribe(n) {
408
+ e.off("event", n);
409
+ },
410
+ get count() {
411
+ return t.count + e.count;
412
+ }
413
+ }, s];
397
414
  }
398
- const [oe, ae] = at(
415
+ const [se, ne] = it(
399
416
  (e) => {
400
- const [t, s] = ie(), n = t.off.bind(t);
417
+ const [t, s] = ee(), n = t.off.bind(t);
401
418
  return t.off = (r, i) => {
402
- const { count: o } = t;
403
- n(r, i), o && !t.count && e();
419
+ const { count: a } = t;
420
+ n(r, i), a && !t.count && e();
404
421
  }, [t, s];
405
422
  },
406
423
  ([, e]) => e()
407
424
  );
408
- function L() {
409
- return oe()[0];
425
+ function M() {
426
+ return se()[0];
410
427
  }
411
- function B(e, t) {
412
- L().off(e, t);
428
+ function L(e, t) {
429
+ M().off(e, t);
413
430
  }
414
431
  function b(e, t, s) {
415
- return L().on(e, t, s);
432
+ return M().on(e, t, s);
416
433
  }
417
434
  function I(e) {
418
435
  return typeof e == "object" && e !== null && !Array.isArray(e);
419
436
  }
420
- function ce(e, t) {
437
+ function re(e, t) {
421
438
  const s = e.split("."), n = t.split("."), r = Math.max(s.length, n.length);
422
439
  for (let i = 0; i < r; i += 1) {
423
- const o = parseInt(s[i] || "0", 10), a = parseInt(n[i] || "0", 10);
424
- if (o !== a)
425
- return o > a ? 1 : -1;
440
+ const a = parseInt(s[i] || "0", 10), o = parseInt(n[i] || "0", 10);
441
+ if (a !== o)
442
+ return a > o ? 1 : -1;
426
443
  }
427
444
  return 0;
428
445
  }
429
446
  function g(e, t) {
430
- return ce(e, t) <= 0;
447
+ return re(e, t) <= 0;
431
448
  }
432
- function E(e, t, s) {
449
+ function v(e, t, s) {
433
450
  if (typeof s == "string") {
434
451
  if (e === "web_app_open_link" && t === "try_instant_view")
435
452
  return g("6.4", s);
@@ -480,98 +497,98 @@ function E(e, t, s) {
480
497
  ].includes(e);
481
498
  }
482
499
  }
483
- function he(e) {
500
+ function ie(e) {
484
501
  return "external" in e && I(e.external) && "notify" in e.external && typeof e.external.notify == "function";
485
502
  }
486
- function _t(e) {
503
+ function lt(e) {
487
504
  return "TelegramWebviewProxy" in e && I(e.TelegramWebviewProxy) && "postEvent" in e.TelegramWebviewProxy && typeof e.TelegramWebviewProxy.postEvent == "function";
488
505
  }
489
- function pe() {
506
+ function oe() {
490
507
  try {
491
508
  return window.self !== window.top;
492
509
  } catch {
493
510
  return !0;
494
511
  }
495
512
  }
496
- let ft = "https://web.telegram.org";
497
- function ss(e) {
498
- ft = e;
513
+ let dt = "https://web.telegram.org";
514
+ function Xe(e) {
515
+ dt = e;
499
516
  }
500
- function ue() {
501
- return ft;
517
+ function ae() {
518
+ return dt;
502
519
  }
503
520
  function A(e, t, s) {
504
521
  let n = {}, r;
505
522
  t === void 0 && s === void 0 ? n = {} : t !== void 0 && s !== void 0 ? (n = s, r = t) : t !== void 0 && ("targetOrigin" in t ? n = t : r = t);
506
- const { targetOrigin: i = ue() } = n;
507
- if (Wt("Posting event:", r ? { event: e, data: r } : { event: e }), pe()) {
523
+ const { targetOrigin: i = ae() } = n;
524
+ if (Bt("Posting event:", r ? { event: e, data: r } : { event: e }), oe()) {
508
525
  window.parent.postMessage(JSON.stringify({ eventType: e, eventData: r }), i);
509
526
  return;
510
527
  }
511
- if (he(window)) {
528
+ if (ie(window)) {
512
529
  window.external.notify(JSON.stringify({ eventType: e, eventData: r }));
513
530
  return;
514
531
  }
515
- if (_t(window)) {
532
+ if (lt(window)) {
516
533
  window.TelegramWebviewProxy.postEvent(e, JSON.stringify(r));
517
534
  return;
518
535
  }
519
536
  throw f(
520
- jt,
537
+ Wt,
521
538
  "Unable to determine current environment and possible way to send event. You are probably trying to use Mini Apps method outside of Telegram application environment."
522
539
  );
523
540
  }
524
- function le(e) {
541
+ function ce(e) {
525
542
  return (t, s) => {
526
- if (!E(t, e))
527
- throw f(Ht, `Method "${t}" is unsupported in Mini Apps version ${e}`);
543
+ if (!v(t, e))
544
+ throw f(Ot, `Method "${t}" is unsupported in Mini Apps version ${e}`);
528
545
  if (I(s)) {
529
546
  let n;
530
- if (t === "web_app_open_link" && "try_instant_view" in s ? n = "try_instant_view" : t === "web_app_set_header_color" && "color" in s && (n = "color"), n && !E(t, n, e))
547
+ if (t === "web_app_open_link" && "try_instant_view" in s ? n = "try_instant_view" : t === "web_app_set_header_color" && "color" in s && (n = "color"), n && !v(t, n, e))
531
548
  throw f(
532
- Gt,
549
+ Ut,
533
550
  `Parameter "${n}" of "${t}" method is unsupported in Mini Apps version ${e}`
534
551
  );
535
552
  }
536
553
  return A(t, s);
537
554
  };
538
555
  }
539
- function gt(e) {
556
+ function _t(e) {
540
557
  return ({ req_id: t }) => t === e;
541
558
  }
542
- function bt(e) {
543
- return f(zt, `Timeout reached: ${e}ms`);
559
+ function ft(e) {
560
+ return f(Gt, `Timeout reached: ${e}ms`);
544
561
  }
545
- function wt(e, t) {
562
+ function gt(e, t) {
546
563
  return Promise.race([
547
564
  typeof e == "function" ? e() : e,
548
565
  new Promise((s, n) => {
549
566
  setTimeout(() => {
550
- n(bt(t));
567
+ n(ft(t));
551
568
  }, t);
552
569
  })
553
570
  ]);
554
571
  }
555
572
  async function _(e) {
556
573
  let t;
557
- const s = new Promise((l) => {
558
- t = l;
574
+ const s = new Promise((u) => {
575
+ t = u;
559
576
  }), {
560
577
  method: n,
561
578
  event: r,
562
579
  capture: i,
563
- postEvent: o = A,
564
- timeout: a
580
+ postEvent: a = A,
581
+ timeout: o
565
582
  } = e, p = (Array.isArray(r) ? r : [r]).map(
566
- (l) => b(l, (et) => (!i || i(et)) && t(et))
583
+ (u) => b(u, (k) => (!i || i(k)) && t(k))
567
584
  );
568
585
  try {
569
- return o(n, e.params), await (a ? wt(s, a) : s);
586
+ return a(n, e.params), await (o ? gt(s, o) : s);
570
587
  } finally {
571
- p.forEach((l) => l());
588
+ p.forEach((u) => u());
572
589
  }
573
590
  }
574
- async function C(e, t, s, n = {}) {
591
+ async function S(e, t, s, n = {}) {
575
592
  const {
576
593
  result: r,
577
594
  error: i
@@ -584,10 +601,10 @@ async function C(e, t, s, n = {}) {
584
601
  params: t,
585
602
  req_id: s
586
603
  },
587
- capture: gt(s)
604
+ capture: _t(s)
588
605
  });
589
606
  if (i)
590
- throw f(Ft, i);
607
+ throw f(Ht, i);
591
608
  return r;
592
609
  }
593
610
  function z(...e) {
@@ -600,14 +617,14 @@ function z(...e) {
600
617
  return z(...t);
601
618
  }).filter(Boolean).join(" ");
602
619
  }
603
- function ns(...e) {
620
+ function ts(...e) {
604
621
  return e.reduce((t, s) => (I(s) && Object.entries(s).forEach(([n, r]) => {
605
622
  const i = z(t[n], r);
606
623
  i.length && (t[n] = i);
607
624
  }), t), {});
608
625
  }
609
- function mt(e) {
610
- const t = lt(e);
626
+ function bt(e) {
627
+ const t = pt(e);
611
628
  return Math.sqrt(
612
629
  [0.299, 0.587, 0.114].reduce((s, n, r) => {
613
630
  const i = parseInt(t.slice(1 + r * 2, 1 + (r + 1) * 2), 16);
@@ -615,9 +632,9 @@ function mt(e) {
615
632
  }, 0)
616
633
  ) < 120;
617
634
  }
618
- class de {
635
+ class he {
619
636
  constructor(t) {
620
- c(this, "ee", new V());
637
+ c(this, "ee", new R());
621
638
  /**
622
639
  * Adds new event listener.
623
640
  */
@@ -635,7 +652,7 @@ class de {
635
652
  return { ...this.state };
636
653
  }
637
654
  set(t, s) {
638
- Object.entries(typeof t == "string" ? { [t]: s } : t).reduce((r, [i, o]) => this.state[i] === o || o === void 0 ? r : (this.state[i] = o, this.ee.emit(`change:${i}`, o), !0), !1) && this.ee.emit("change", this.state);
655
+ Object.entries(typeof t == "string" ? { [t]: s } : t).reduce((r, [i, a]) => this.state[i] === a || a === void 0 ? r : (this.state[i] = a, this.ee.emit(`change:${i}`, a), !0), !1) && this.ee.emit("change", this.state);
639
656
  }
640
657
  /**
641
658
  * Returns value by specified key.
@@ -660,11 +677,11 @@ class Y {
660
677
  * Clones the current state.
661
678
  */
662
679
  c(this, "clone");
663
- this.state = new de(t), this.set = this.state.set.bind(this.state), this.get = this.state.get.bind(this.state), this.clone = this.state.clone.bind(this.state);
680
+ this.state = new he(t), this.set = this.state.set.bind(this.state), this.get = this.state.get.bind(this.state), this.clone = this.state.clone.bind(this.state);
664
681
  }
665
682
  }
666
- function yt(e, t) {
667
- return (s) => E(t[s], e);
683
+ function wt(e, t) {
684
+ return (s) => v(t[s], e);
668
685
  }
669
686
  class Z extends Y {
670
687
  constructor(s, n, r) {
@@ -673,10 +690,10 @@ class Z extends Y {
673
690
  * @returns True, if specified method is supported by the current component.
674
691
  */
675
692
  c(this, "supports");
676
- this.supports = yt(n, r);
693
+ this.supports = wt(n, r);
677
694
  }
678
695
  }
679
- class _e extends Z {
696
+ class pe extends Z {
680
697
  constructor(s, n, r) {
681
698
  super({ isVisible: s }, n, {
682
699
  show: "web_app_setup_back_button",
@@ -693,7 +710,7 @@ class _e extends Z {
693
710
  * @param event - event to listen.
694
711
  * @param listener - listener to remove.
695
712
  */
696
- c(this, "off", (s, n) => s === "click" ? B("back_button_pressed", n) : this.state.off(s, n));
713
+ c(this, "off", (s, n) => s === "click" ? L("back_button_pressed", n) : this.state.off(s, n));
697
714
  this.postEvent = r;
698
715
  }
699
716
  set isVisible(s) {
@@ -718,23 +735,20 @@ class _e extends Z {
718
735
  this.isVisible = !0;
719
736
  }
720
737
  }
721
- function y() {
722
- return typeof window > "u";
723
- }
724
- const vt = x((e) => e instanceof Date ? e : new Date(v().parse(e) * 1e3), "Date");
725
- function X(e, t) {
726
- return new M((s) => {
738
+ const mt = P((e) => e instanceof Date ? e : new Date(y().parse(e) * 1e3), "Date");
739
+ function K(e, t) {
740
+ return new $((s) => {
727
741
  if (typeof s != "string" && !(s instanceof URLSearchParams))
728
- throw P();
742
+ throw E();
729
743
  const n = typeof s == "string" ? new URLSearchParams(s) : s;
730
- return ut(e, (r) => {
744
+ return ht(e, (r) => {
731
745
  const i = n.get(r);
732
746
  return i === null ? void 0 : i;
733
747
  });
734
748
  }, !1, t);
735
749
  }
736
- const fe = d({
737
- id: v(),
750
+ const ue = d({
751
+ id: y(),
738
752
  type: h(),
739
753
  title: h(),
740
754
  photoUrl: {
@@ -742,7 +756,7 @@ const fe = d({
742
756
  from: "photo_url"
743
757
  },
744
758
  username: h().optional()
745
- }, "Chat").optional(), nt = d({
759
+ }, "Chat").optional(), st = d({
746
760
  addedToAttachmentMenu: {
747
761
  type: w().optional(),
748
762
  from: "added_to_attachment_menu"
@@ -755,7 +769,7 @@ const fe = d({
755
769
  type: h(),
756
770
  from: "first_name"
757
771
  },
758
- id: v(),
772
+ id: y(),
759
773
  isBot: {
760
774
  type: w().optional(),
761
775
  from: "is_bot"
@@ -778,17 +792,17 @@ const fe = d({
778
792
  },
779
793
  username: h().optional()
780
794
  }, "User").optional();
781
- function Et() {
782
- return X({
795
+ function yt() {
796
+ return K({
783
797
  authDate: {
784
- type: vt(),
798
+ type: mt(),
785
799
  from: "auth_date"
786
800
  },
787
801
  canSendAfter: {
788
- type: v().optional(),
802
+ type: y().optional(),
789
803
  from: "can_send_after"
790
804
  },
791
- chat: fe,
805
+ chat: ue,
792
806
  chatInstance: {
793
807
  type: h().optional(),
794
808
  from: "chat_instance"
@@ -802,35 +816,35 @@ function Et() {
802
816
  type: h().optional(),
803
817
  from: "query_id"
804
818
  },
805
- receiver: nt,
819
+ receiver: st,
806
820
  startParam: {
807
821
  type: h().optional(),
808
822
  from: "start_param"
809
823
  },
810
- user: nt
824
+ user: st
811
825
  }, "InitData");
812
826
  }
813
- function ge(e) {
827
+ function le(e) {
814
828
  return e.replace(/_[a-z]/g, (t) => t[1].toUpperCase());
815
829
  }
816
- function be(e) {
830
+ function de(e) {
817
831
  return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);
818
832
  }
819
- const Pt = x(
833
+ const vt = P(
820
834
  (e) => {
821
- const t = dt().optional();
822
- return Object.entries(J(e)).reduce((s, [n, r]) => (s[ge(n)] = t.parse(r), s), {});
835
+ const t = ut().optional();
836
+ return Object.entries(J(e)).reduce((s, [n, r]) => (s[le(n)] = t.parse(r), s), {});
823
837
  },
824
838
  "ThemeParams"
825
839
  );
826
- function xt(e) {
827
- return X({
840
+ function Et(e) {
841
+ return K({
828
842
  botInline: {
829
843
  type: w().optional(),
830
844
  from: "tgWebAppBotInline"
831
845
  },
832
846
  initData: {
833
- type: Et().optional(),
847
+ type: yt().optional(),
834
848
  from: "tgWebAppData"
835
849
  },
836
850
  initDataRaw: {
@@ -850,7 +864,7 @@ function xt(e) {
850
864
  from: "tgWebAppStartParam"
851
865
  },
852
866
  themeParams: {
853
- type: Pt(),
867
+ type: vt(),
854
868
  from: "tgWebAppThemeParams"
855
869
  },
856
870
  version: {
@@ -859,115 +873,119 @@ function xt(e) {
859
873
  }
860
874
  }).parse(e);
861
875
  }
862
- function St(e) {
863
- return xt(
876
+ function Pt(e) {
877
+ return Et(
864
878
  e.replace(/^[^?#]*[?#]/, "").replace(/[?#]/g, "&")
865
879
  );
866
880
  }
867
- function we() {
868
- return St(window.location.href);
881
+ function _e() {
882
+ return Pt(window.location.href);
869
883
  }
870
- function Ct() {
884
+ function xt() {
871
885
  return performance.getEntriesByType("navigation")[0];
872
886
  }
873
- function me() {
874
- const e = Ct();
887
+ function fe() {
888
+ const e = xt();
875
889
  if (!e)
876
890
  throw new Error("Unable to get first navigation entry.");
877
- return St(e.name);
891
+ return Pt(e.name);
878
892
  }
879
- function Rt(e) {
893
+ function St(e) {
880
894
  return `tma.js/${e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`)}`;
881
895
  }
882
- function At(e, t) {
883
- sessionStorage.setItem(Rt(e), JSON.stringify(t));
896
+ function Ct(e, t) {
897
+ sessionStorage.setItem(St(e), JSON.stringify(t));
884
898
  }
885
- function Tt(e) {
886
- const t = sessionStorage.getItem(Rt(e));
899
+ function Rt(e) {
900
+ const t = sessionStorage.getItem(St(e));
887
901
  try {
888
902
  return t ? JSON.parse(t) : void 0;
889
903
  } catch {
890
904
  }
891
905
  }
892
- function ye() {
893
- return xt(Tt("launchParams") || "");
906
+ function ge() {
907
+ return Et(Rt("launchParams") || "");
894
908
  }
895
- function ve(e) {
909
+ function be(e) {
896
910
  return JSON.stringify(
897
911
  Object.fromEntries(
898
- Object.entries(e).map(([t, s]) => [be(t), s])
912
+ Object.entries(e).map(([t, s]) => [de(t), s])
899
913
  )
900
914
  );
901
915
  }
902
- function Ee(e) {
916
+ function we(e) {
903
917
  const {
904
918
  initDataRaw: t,
905
919
  themeParams: s,
906
920
  platform: n,
907
921
  version: r,
908
922
  showSettings: i,
909
- startParam: o,
910
- botInline: a
923
+ startParam: a,
924
+ botInline: o
911
925
  } = e, p = new URLSearchParams();
912
- return p.set("tgWebAppPlatform", n), p.set("tgWebAppThemeParams", ve(s)), p.set("tgWebAppVersion", r), t && p.set("tgWebAppData", t), o && p.set("tgWebAppStartParam", o), typeof i == "boolean" && p.set("tgWebAppShowSettings", i ? "1" : "0"), typeof a == "boolean" && p.set("tgWebAppBotInline", a ? "1" : "0"), p.toString();
926
+ return p.set("tgWebAppPlatform", n), p.set("tgWebAppThemeParams", be(s)), p.set("tgWebAppVersion", r), t && p.set("tgWebAppData", t), a && p.set("tgWebAppStartParam", a), typeof i == "boolean" && p.set("tgWebAppShowSettings", i ? "1" : "0"), typeof o == "boolean" && p.set("tgWebAppBotInline", o ? "1" : "0"), p.toString();
913
927
  }
914
- function Pe(e) {
915
- At("launchParams", Ee(e));
928
+ function me(e) {
929
+ Ct("launchParams", we(e));
916
930
  }
917
- function xe() {
931
+ function ye() {
918
932
  for (const e of [
919
933
  // Try to retrieve launch parameters from the current location. This method can return
920
934
  // nothing in case, location was changed and then page was reloaded.
921
- we,
935
+ _e,
922
936
  // Then, try using the lower level API - window.performance.
923
- me,
937
+ fe,
924
938
  // Finally, try to extract launch parameters from the session storage.
925
- ye
939
+ ge
926
940
  ])
927
941
  try {
928
942
  const t = e();
929
- return Pe(t), t;
943
+ return me(t), t;
930
944
  } catch {
931
945
  }
932
946
  throw new Error("Unable to retrieve launch parameters from any known source.");
933
947
  }
934
- function It() {
935
- const e = Ct();
948
+ function At() {
949
+ const e = xt();
936
950
  return !!(e && e.type === "reload");
937
951
  }
938
- function Se() {
952
+ function ve() {
939
953
  let e = 0;
940
954
  return () => (e += 1).toString();
941
955
  }
942
- const [Ce] = at(Se);
943
- function u(e, t) {
944
- return ({ ssr: s } = {}) => {
945
- const n = y() ? {
946
- version: "6.0",
947
- themeParams: {},
948
- platform: "unknown",
949
- ...s || {}
950
- } : xe(), r = {
951
- ...n,
952
- postEvent: y() ? () => null : le(n.version),
953
- createRequestId: Ce()
956
+ const [Ee] = it(ve);
957
+ function l(e, t) {
958
+ return () => {
959
+ const s = ye(), n = {
960
+ ...s,
961
+ postEvent: ce(s.version),
962
+ createRequestId: Ee()
954
963
  };
955
- if (y() || typeof e == "function")
956
- return typeof e == "function" ? e(r) : t(r);
957
- const i = t({
958
- ...r,
959
- state: It() ? Tt(e) : void 0
960
- }), o = (a) => (a.on("change", (p) => {
961
- At(e, p);
962
- }), a);
963
- return i instanceof Promise ? i.then(o) : o(i);
964
+ if (typeof e == "function")
965
+ return e(n);
966
+ const [r, i, a] = at(), o = t({
967
+ ...n,
968
+ // State should only be passed only in case, current page was reloaded. If we don't add
969
+ // this check, state restoration will work improperly in the web version of Telegram,
970
+ // when we are always working in the same "session" (tab).
971
+ state: At() ? Rt(e) : void 0,
972
+ addCleanup: r
973
+ }), p = (u) => (a || r(
974
+ u.on("change", (k) => {
975
+ Ct(e, k);
976
+ })
977
+ ), u);
978
+ return [
979
+ o instanceof Promise ? o.then(p) : p(o),
980
+ i
981
+ ];
964
982
  };
965
983
  }
966
- const rs = u("backButton", ({
984
+ const es = l("backButton", ({
967
985
  postEvent: e,
968
986
  version: t,
969
987
  state: s = { isVisible: !1 }
970
- }) => new _e(s.isVisible, t, e));
988
+ }) => new pe(s.isVisible, t, e));
971
989
  class q extends Z {
972
990
  constructor() {
973
991
  super(...arguments);
@@ -981,7 +999,7 @@ class q extends Z {
981
999
  c(this, "off", this.state.off.bind(this.state));
982
1000
  }
983
1001
  }
984
- function qt(e) {
1002
+ function Tt(e) {
985
1003
  const t = e.available ? e : {
986
1004
  available: !1,
987
1005
  device_id: "",
@@ -999,7 +1017,7 @@ function qt(e) {
999
1017
  accessGranted: t.access_granted
1000
1018
  };
1001
1019
  }
1002
- class rt extends q {
1020
+ class Pe extends q {
1003
1021
  constructor({ postEvent: s, version: n, ...r }) {
1004
1022
  super(r, n, {
1005
1023
  auth: "web_app_biometry_request_auth",
@@ -1081,7 +1099,7 @@ class rt extends q {
1081
1099
  event: "biometry_info_received",
1082
1100
  params: { reason: s || "" }
1083
1101
  }).then((r) => {
1084
- const i = qt(r);
1102
+ const i = Tt(r);
1085
1103
  return this.set(i), i.accessGranted;
1086
1104
  }).finally(() => this.accessPromise = void 0)), this.accessPromise;
1087
1105
  }
@@ -1113,8 +1131,8 @@ class rt extends q {
1113
1131
  );
1114
1132
  }
1115
1133
  }
1116
- async function Re(e) {
1117
- return qt(
1134
+ async function xe(e) {
1135
+ return Tt(
1118
1136
  await _({
1119
1137
  ...e || {},
1120
1138
  method: "web_app_biometry_get_info",
@@ -1122,21 +1140,21 @@ async function Re(e) {
1122
1140
  })
1123
1141
  );
1124
1142
  }
1125
- const is = u("biometryManager", async ({ postEvent: e, version: t, state: s }) => {
1126
- if (s)
1127
- return new rt({ ...s, version: t, postEvent: e });
1128
- if (y())
1129
- throw f(
1130
- pt,
1131
- "BiometryManager cannot be instantiated on the server side without passing the ssr.state object."
1132
- );
1133
- return new rt({
1134
- ...await Re({ timeout: 1e3 }),
1143
+ const ss = l(
1144
+ "biometryManager",
1145
+ async ({ postEvent: e, version: t, state: s }) => new Pe({
1146
+ ...s || v("web_app_biometry_get_info", t) ? s || await xe({ timeout: 1e3 }) : {
1147
+ available: !1,
1148
+ accessGranted: !1,
1149
+ accessRequested: !1,
1150
+ tokenSaved: !1,
1151
+ deviceId: ""
1152
+ },
1135
1153
  version: t,
1136
1154
  postEvent: e
1137
- });
1138
- });
1139
- class K extends Y {
1155
+ })
1156
+ );
1157
+ class X extends Y {
1140
1158
  constructor() {
1141
1159
  super(...arguments);
1142
1160
  /**
@@ -1149,7 +1167,7 @@ class K extends Y {
1149
1167
  c(this, "off", this.state.off.bind(this.state));
1150
1168
  }
1151
1169
  }
1152
- class Ae extends K {
1170
+ class Se extends X {
1153
1171
  constructor(t, s) {
1154
1172
  super({ isConfirmationNeeded: t }), this.postEvent = s;
1155
1173
  }
@@ -1176,20 +1194,23 @@ class Ae extends K {
1176
1194
  this.isConfirmationNeeded = !0;
1177
1195
  }
1178
1196
  }
1179
- const os = u("closingBehavior", ({
1180
- postEvent: e,
1181
- state: t = { isConfirmationNeeded: !1 }
1182
- }) => new Ae(t.isConfirmationNeeded, e));
1197
+ const ns = l(
1198
+ "closingBehavior",
1199
+ ({
1200
+ postEvent: e,
1201
+ state: t = { isConfirmationNeeded: !1 }
1202
+ }) => new Se(t.isConfirmationNeeded, e)
1203
+ );
1183
1204
  class tt {
1184
1205
  constructor(t, s) {
1185
1206
  /**
1186
1207
  * @returns True, if specified method is supported by the current component.
1187
1208
  */
1188
1209
  c(this, "supports");
1189
- this.supports = yt(t, s);
1210
+ this.supports = wt(t, s);
1190
1211
  }
1191
1212
  }
1192
- function Te(e) {
1213
+ function Ce(e) {
1193
1214
  if (Array.isArray(e))
1194
1215
  return e;
1195
1216
  if (typeof e == "string")
@@ -1199,11 +1220,11 @@ function Te(e) {
1199
1220
  return t;
1200
1221
  } catch {
1201
1222
  }
1202
- throw P();
1223
+ throw E();
1203
1224
  }
1204
- class Ie extends M {
1225
+ class Re extends $ {
1205
1226
  constructor(s, n, r) {
1206
- super(Te, n, r);
1227
+ super(Ce, n, r);
1207
1228
  c(this, "itemParser");
1208
1229
  this.itemParser = typeof s == "function" ? s : s.parse.bind(s);
1209
1230
  }
@@ -1221,13 +1242,13 @@ class Ie extends M {
1221
1242
  return this.itemParser = typeof s == "function" ? s : s.parse.bind(s), this;
1222
1243
  }
1223
1244
  }
1224
- function qe(e) {
1225
- return new Ie((t) => t, !1, e);
1245
+ function Ae(e) {
1246
+ return new Re((t) => t, !1, e);
1226
1247
  }
1227
- function it(e, t) {
1248
+ function nt(e, t) {
1228
1249
  return Object.fromEntries(e.map((s) => [s, t]));
1229
1250
  }
1230
- class ke extends tt {
1251
+ class Te extends tt {
1231
1252
  constructor(t, s, n) {
1232
1253
  super(t, {
1233
1254
  delete: "web_app_invoke_custom_method",
@@ -1243,7 +1264,7 @@ class ke extends tt {
1243
1264
  */
1244
1265
  async delete(t, s = {}) {
1245
1266
  const n = Array.isArray(t) ? t : [t];
1246
- n.length && await C(
1267
+ n.length && await S(
1247
1268
  "deleteStorageValues",
1248
1269
  { keys: n },
1249
1270
  this.createRequestId(),
@@ -1255,8 +1276,8 @@ class ke extends tt {
1255
1276
  * @param options - request execution options.
1256
1277
  */
1257
1278
  async getKeys(t = {}) {
1258
- return qe().of(h()).parse(
1259
- await C(
1279
+ return Ae().of(h()).parse(
1280
+ await S(
1260
1281
  "getStorageKeys",
1261
1282
  {},
1262
1283
  this.createRequestId(),
@@ -1267,13 +1288,13 @@ class ke extends tt {
1267
1288
  async get(t, s = {}) {
1268
1289
  const n = Array.isArray(t) ? t : [t];
1269
1290
  if (!n.length)
1270
- return it(n, "");
1271
- const r = await C(
1291
+ return nt(n, "");
1292
+ const r = await S(
1272
1293
  "getStorageValues",
1273
1294
  { keys: n },
1274
1295
  this.createRequestId(),
1275
1296
  { ...s, postEvent: this.postEvent }
1276
- ), i = d(it(n, h()), "CloudStorageData").parse(r);
1297
+ ), i = d(nt(n, h()), "CloudStorageData").parse(r);
1277
1298
  return Array.isArray(t) ? i : i[t];
1278
1299
  }
1279
1300
  /**
@@ -1283,7 +1304,7 @@ class ke extends tt {
1283
1304
  * @param options - request execution options.
1284
1305
  */
1285
1306
  async set(t, s, n = {}) {
1286
- await C(
1307
+ await S(
1287
1308
  "saveStorageValue",
1288
1309
  { key: t, value: s },
1289
1310
  this.createRequestId(),
@@ -1291,10 +1312,10 @@ class ke extends tt {
1291
1312
  );
1292
1313
  }
1293
1314
  }
1294
- const as = u(
1295
- ({ createRequestId: e, postEvent: t, version: s }) => new ke(s, e, t)
1315
+ const rs = l(
1316
+ ({ createRequestId: e, postEvent: t, version: s }) => new Te(s, e, t)
1296
1317
  );
1297
- class Ne extends tt {
1318
+ class Ie extends tt {
1298
1319
  constructor(t, s) {
1299
1320
  super(t, {
1300
1321
  impactOccurred: "web_app_trigger_haptic_feedback",
@@ -1336,10 +1357,10 @@ class Ne extends tt {
1336
1357
  this.postEvent("web_app_trigger_haptic_feedback", { type: "selection_change" });
1337
1358
  }
1338
1359
  }
1339
- const cs = u(
1340
- ({ version: e, postEvent: t }) => new Ne(e, t)
1360
+ const is = l(
1361
+ ({ version: e, postEvent: t }) => new Ie(e, t)
1341
1362
  );
1342
- class De {
1363
+ class qe {
1343
1364
  constructor(t) {
1344
1365
  this.initData = t;
1345
1366
  }
@@ -1412,13 +1433,13 @@ class De {
1412
1433
  return this.initData.user;
1413
1434
  }
1414
1435
  }
1415
- const hs = u(
1416
- ({ initData: e }) => e ? new De(e) : void 0
1436
+ const os = l(
1437
+ ({ initData: e }) => e ? new qe(e) : void 0
1417
1438
  );
1418
- function ps(e) {
1419
- return Et().parse(e);
1439
+ function as(e) {
1440
+ return yt().parse(e);
1420
1441
  }
1421
- class Ve extends q {
1442
+ class ke extends q {
1422
1443
  constructor(t, s, n) {
1423
1444
  super({ isOpened: t }, s, { open: "web_app_open_invoice" }), this.postEvent = n;
1424
1445
  }
@@ -1441,10 +1462,10 @@ class Ve extends q {
1441
1462
  const { hostname: r, pathname: i } = new URL(t, window.location.href);
1442
1463
  if (r !== "t.me")
1443
1464
  throw new Error(`Incorrect hostname: ${r}`);
1444
- const o = i.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/);
1445
- if (!o)
1465
+ const a = i.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/);
1466
+ if (!a)
1446
1467
  throw new Error('Link pathname has incorrect format. Expected to receive "/invoice/{slug}" or "/${slug}"');
1447
- [, , n] = o;
1468
+ [, , n] = a;
1448
1469
  }
1449
1470
  this.isOpened = !0;
1450
1471
  try {
@@ -1462,10 +1483,10 @@ class Ve extends q {
1462
1483
  }
1463
1484
  }
1464
1485
  }
1465
- const us = u(
1466
- ({ version: e, postEvent: t }) => new Ve(!1, e, t)
1486
+ const cs = l(
1487
+ ({ version: e, postEvent: t }) => new ke(!1, e, t)
1467
1488
  );
1468
- class $e extends Y {
1489
+ class Ne extends Y {
1469
1490
  constructor({ postEvent: s, ...n }) {
1470
1491
  super(n);
1471
1492
  c(this, "postEvent");
@@ -1480,9 +1501,15 @@ class $e extends Y {
1480
1501
  * @param event - event to listen.
1481
1502
  * @param listener - listener to remove.
1482
1503
  */
1483
- c(this, "off", (s, n) => s === "click" ? B("main_button_pressed", n) : this.state.off(s, n));
1504
+ c(this, "off", (s, n) => s === "click" ? L("main_button_pressed", n) : this.state.off(s, n));
1484
1505
  this.postEvent = s;
1485
1506
  }
1507
+ /**
1508
+ * The MainButton background color.
1509
+ */
1510
+ get bgColor() {
1511
+ return this.get("bgColor");
1512
+ }
1486
1513
  /**
1487
1514
  * Sends current local state to the Telegram application.
1488
1515
  */
@@ -1492,10 +1519,35 @@ class $e extends Y {
1492
1519
  is_active: this.isEnabled,
1493
1520
  is_progress_visible: this.isLoaderVisible,
1494
1521
  text: this.text,
1495
- color: this.backgroundColor,
1522
+ color: this.bgColor,
1496
1523
  text_color: this.textColor
1497
1524
  });
1498
1525
  }
1526
+ /**
1527
+ * Disables the MainButton.
1528
+ * @see Does not work on Android: https://github.com/Telegram-Mini-Apps/issues/issues/1
1529
+ */
1530
+ disable() {
1531
+ return this.isEnabled = !1, this;
1532
+ }
1533
+ /**
1534
+ * Enables the MainButton.
1535
+ */
1536
+ enable() {
1537
+ return this.isEnabled = !0, this;
1538
+ }
1539
+ /**
1540
+ * Hides the MainButton.
1541
+ */
1542
+ hide() {
1543
+ return this.isVisible = !1, this;
1544
+ }
1545
+ /**
1546
+ * Hides the MainButton loading indicator.
1547
+ */
1548
+ hideLoader() {
1549
+ return this.isLoaderVisible = !1, this;
1550
+ }
1499
1551
  set isEnabled(s) {
1500
1552
  this.setParams({ isEnabled: s });
1501
1553
  }
@@ -1523,49 +1575,6 @@ class $e extends Y {
1523
1575
  get isVisible() {
1524
1576
  return this.get("isVisible");
1525
1577
  }
1526
- /**
1527
- * The MainButton background color.
1528
- */
1529
- get backgroundColor() {
1530
- return this.get("backgroundColor");
1531
- }
1532
- /**
1533
- * The MainButton text.
1534
- */
1535
- get text() {
1536
- return this.get("text");
1537
- }
1538
- /**
1539
- * The MainButton text color.
1540
- */
1541
- get textColor() {
1542
- return this.get("textColor");
1543
- }
1544
- /**
1545
- * Disables the MainButton.
1546
- * @see Does not work on Android: https://github.com/Telegram-Mini-Apps/issues/issues/1
1547
- */
1548
- disable() {
1549
- return this.isEnabled = !1, this;
1550
- }
1551
- /**
1552
- * Enables the MainButton.
1553
- */
1554
- enable() {
1555
- return this.isEnabled = !0, this;
1556
- }
1557
- /**
1558
- * Hides the MainButton.
1559
- */
1560
- hide() {
1561
- return this.isVisible = !1, this;
1562
- }
1563
- /**
1564
- * Hides the MainButton loading indicator.
1565
- */
1566
- hideLoader() {
1567
- return this.isLoaderVisible = !1, this;
1568
- }
1569
1578
  /**
1570
1579
  * Shows the MainButton.
1571
1580
  *
@@ -1597,10 +1606,10 @@ class $e extends Y {
1597
1606
  }
1598
1607
  /**
1599
1608
  * Updates current Main Button color.
1600
- * @param backgroundColor - color to set.
1609
+ * @param bgColor - color to set.
1601
1610
  */
1602
- setBackgroundColor(s) {
1603
- return this.setParams({ backgroundColor: s });
1611
+ setBgColor(s) {
1612
+ return this.setParams({ bgColor: s });
1604
1613
  }
1605
1614
  /**
1606
1615
  * Allows setting multiple Main Button parameters.
@@ -1609,24 +1618,39 @@ class $e extends Y {
1609
1618
  setParams(s) {
1610
1619
  return this.set(s), this.commit(), this;
1611
1620
  }
1621
+ /**
1622
+ * The MainButton text.
1623
+ */
1624
+ get text() {
1625
+ return this.get("text");
1626
+ }
1627
+ /**
1628
+ * The MainButton text color.
1629
+ */
1630
+ get textColor() {
1631
+ return this.get("textColor");
1632
+ }
1612
1633
  }
1613
- const ls = u("mainButton", ({
1614
- postEvent: e,
1615
- themeParams: t,
1616
- state: s = {
1617
- isVisible: !1,
1618
- isEnabled: !1,
1619
- text: "",
1620
- isLoaderVisible: !1,
1621
- textColor: t.buttonTextColor || "#ffffff",
1622
- backgroundColor: t.buttonColor || "#000000"
1623
- }
1624
- }) => new $e({ ...s, postEvent: e }));
1625
- function Me() {
1626
- return X({
1634
+ const hs = l(
1635
+ "mainButton",
1636
+ ({
1637
+ postEvent: e,
1638
+ themeParams: t,
1639
+ state: s = {
1640
+ isVisible: !1,
1641
+ isEnabled: !1,
1642
+ text: "",
1643
+ isLoaderVisible: !1,
1644
+ textColor: t.buttonTextColor || "#ffffff",
1645
+ bgColor: t.buttonColor || "#000000"
1646
+ }
1647
+ }) => new Ne({ ...s, postEvent: e })
1648
+ );
1649
+ function De() {
1650
+ return K({
1627
1651
  contact: d({
1628
1652
  userId: {
1629
- type: v(),
1653
+ type: y(),
1630
1654
  from: "user_id"
1631
1655
  },
1632
1656
  phoneNumber: {
@@ -1643,26 +1667,26 @@ function Me() {
1643
1667
  }
1644
1668
  }),
1645
1669
  authDate: {
1646
- type: vt(),
1670
+ type: mt(),
1647
1671
  from: "auth_date"
1648
1672
  },
1649
1673
  hash: h()
1650
1674
  }, "RequestedContact");
1651
1675
  }
1652
- function kt(e, t) {
1676
+ function It(e, t) {
1653
1677
  return (s) => {
1654
1678
  const [n, r] = t[s];
1655
- return E(n, r, e);
1679
+ return v(n, r, e);
1656
1680
  };
1657
1681
  }
1658
- function Le(e) {
1682
+ function Ve(e) {
1659
1683
  return new Promise((t) => {
1660
1684
  setTimeout(t, e);
1661
1685
  });
1662
1686
  }
1663
- class Be extends q {
1664
- constructor({ postEvent: s, createRequestId: n, version: r, botInline: i, ...o }) {
1665
- super(o, r, {
1687
+ class $e extends q {
1688
+ constructor({ postEvent: s, createRequestId: n, version: r, botInline: i, ...a }) {
1689
+ super(a, r, {
1666
1690
  requestPhoneAccess: "web_app_request_phone",
1667
1691
  requestWriteAccess: "web_app_request_write_access",
1668
1692
  switchInlineQuery: "web_app_switch_inline_query",
@@ -1679,8 +1703,8 @@ class Be extends q {
1679
1703
  */
1680
1704
  c(this, "supportsParam");
1681
1705
  this.createRequestId = n, this.postEvent = s, this.botInline = i;
1682
- const a = this.supports.bind(this);
1683
- this.supports = (p) => a(p) ? p !== "switchInlineQuery" || i : !1, this.supportsParam = kt(r, {
1706
+ const o = this.supports.bind(this);
1707
+ this.supports = (p) => o(p) ? p !== "switchInlineQuery" || i : !1, this.supportsParam = It(r, {
1684
1708
  "setHeaderColor.color": ["web_app_set_header_color", "color"]
1685
1709
  });
1686
1710
  }
@@ -1691,8 +1715,8 @@ class Be extends q {
1691
1715
  async getRequestedContact({
1692
1716
  timeout: s = 1e4
1693
1717
  } = {}) {
1694
- return Me().parse(
1695
- await C(
1718
+ return De().parse(
1719
+ await S(
1696
1720
  "getRequestedContact",
1697
1721
  {},
1698
1722
  this.createRequestId(),
@@ -1731,7 +1755,7 @@ class Be extends q {
1731
1755
  * True if current Mini App background color is recognized as dark.
1732
1756
  */
1733
1757
  get isDark() {
1734
- return mt(this.bgColor);
1758
+ return bt(this.bgColor);
1735
1759
  }
1736
1760
  /**
1737
1761
  * Informs the Telegram app that the Mini App is ready to be displayed.
@@ -1760,15 +1784,15 @@ class Be extends q {
1760
1784
  throw new Error("Access denied.");
1761
1785
  const r = Date.now() + s;
1762
1786
  let i = 50;
1763
- return wt(async () => {
1787
+ return gt(async () => {
1764
1788
  for (; Date.now() < r; ) {
1765
1789
  try {
1766
1790
  return await this.getRequestedContact();
1767
1791
  } catch {
1768
1792
  }
1769
- await Le(i), i += 50;
1793
+ await Ve(i), i += 50;
1770
1794
  }
1771
- throw bt(s);
1795
+ throw ft(s);
1772
1796
  }, s);
1773
1797
  }
1774
1798
  /**
@@ -1851,16 +1875,19 @@ class Be extends q {
1851
1875
  this.postEvent("web_app_switch_inline_query", { query: s, chat_types: n });
1852
1876
  }
1853
1877
  }
1854
- const ds = u("miniApp", ({
1855
- themeParams: e,
1856
- botInline: t = !1,
1857
- state: s = {
1858
- bgColor: e.bgColor || "#ffffff",
1859
- headerColor: e.headerBgColor || "#000000"
1860
- },
1861
- ...n
1862
- }) => new Be({ ...n, ...s, botInline: t }));
1863
- function Oe(e) {
1878
+ const ps = l(
1879
+ "miniApp",
1880
+ ({
1881
+ themeParams: e,
1882
+ botInline: t = !1,
1883
+ state: s = {
1884
+ bgColor: e.bgColor || "#ffffff",
1885
+ headerColor: e.headerBgColor || "#000000"
1886
+ },
1887
+ ...n
1888
+ }) => new $e({ ...n, ...s, botInline: t })
1889
+ );
1890
+ function Me(e) {
1864
1891
  const t = e.message.trim(), s = (e.title || "").trim(), n = e.buttons || [];
1865
1892
  let r;
1866
1893
  if (s.length > 64)
@@ -1870,21 +1897,21 @@ function Oe(e) {
1870
1897
  if (n.length > 3)
1871
1898
  throw new Error(`Buttons have incorrect size: ${n.length}`);
1872
1899
  return n.length ? r = n.map((i) => {
1873
- const { id: o = "" } = i;
1874
- if (o.length > 64)
1875
- throw new Error(`Button ID has incorrect size: ${o}`);
1900
+ const { id: a = "" } = i;
1901
+ if (a.length > 64)
1902
+ throw new Error(`Button ID has incorrect size: ${a}`);
1876
1903
  if (!i.type || i.type === "default" || i.type === "destructive") {
1877
- const a = i.text.trim();
1878
- if (!a.length || a.length > 64) {
1904
+ const o = i.text.trim();
1905
+ if (!o.length || o.length > 64) {
1879
1906
  const p = i.type || "default";
1880
1907
  throw new Error(`Button text with type "${p}" has incorrect size: ${i.text.length}`);
1881
1908
  }
1882
- return { ...i, text: a, id: o };
1909
+ return { ...i, text: o, id: a };
1883
1910
  }
1884
- return { ...i, id: o };
1911
+ return { ...i, id: a };
1885
1912
  }) : r = [{ type: "close", id: "" }], { title: s, message: t, buttons: r };
1886
1913
  }
1887
- class Ue extends q {
1914
+ class Le extends q {
1888
1915
  constructor(t, s, n) {
1889
1916
  super({ isOpened: t }, s, { open: "web_app_open_popup" }), this.postEvent = n;
1890
1917
  }
@@ -1917,7 +1944,7 @@ class Ue extends q {
1917
1944
  event: "popup_closed",
1918
1945
  method: "web_app_open_popup",
1919
1946
  postEvent: this.postEvent,
1920
- params: Oe(t)
1947
+ params: Me(t)
1921
1948
  });
1922
1949
  return s;
1923
1950
  } finally {
@@ -1925,10 +1952,10 @@ class Ue extends q {
1925
1952
  }
1926
1953
  }
1927
1954
  }
1928
- const _s = u(
1929
- ({ postEvent: e, version: t }) => new Ue(!1, t, e)
1955
+ const us = l(
1956
+ ({ postEvent: e, version: t }) => new Le(!1, t, e)
1930
1957
  );
1931
- class We extends q {
1958
+ class Be extends q {
1932
1959
  constructor(t, s, n) {
1933
1960
  super({ isOpened: t }, s, {
1934
1961
  close: "web_app_close_scan_qr_popup",
@@ -1972,10 +1999,10 @@ class We extends q {
1972
1999
  }
1973
2000
  }
1974
2001
  }
1975
- const fs = u(
1976
- ({ version: e, postEvent: t }) => new We(!1, e, t)
2002
+ const ls = l(
2003
+ ({ version: e, postEvent: t }) => new Be(!1, e, t)
1977
2004
  );
1978
- class He extends Z {
2005
+ class Oe extends Z {
1979
2006
  constructor(s, n, r) {
1980
2007
  super({ isVisible: s }, n, {
1981
2008
  show: "web_app_setup_settings_button",
@@ -1992,7 +2019,7 @@ class He extends Z {
1992
2019
  * @param event - event to listen.
1993
2020
  * @param listener - listener to remove.
1994
2021
  */
1995
- c(this, "off", (s, n) => s === "click" ? B("settings_button_pressed", n) : this.state.off(s, n));
2022
+ c(this, "off", (s, n) => s === "click" ? L("settings_button_pressed", n) : this.state.off(s, n));
1996
2023
  this.postEvent = r;
1997
2024
  }
1998
2025
  set isVisible(s) {
@@ -2017,15 +2044,18 @@ class He extends Z {
2017
2044
  this.isVisible = !0;
2018
2045
  }
2019
2046
  }
2020
- const gs = u("settingsButton", ({
2021
- version: e,
2022
- postEvent: t,
2023
- state: s = { isVisible: !1 }
2024
- }) => new He(s.isVisible, e, t));
2025
- function Nt(e) {
2026
- return Pt().parse(e);
2047
+ const ds = l(
2048
+ "settingsButton",
2049
+ ({
2050
+ version: e,
2051
+ postEvent: t,
2052
+ state: s = { isVisible: !1 }
2053
+ }) => new Oe(s.isVisible, e, t)
2054
+ );
2055
+ function qt(e) {
2056
+ return vt().parse(e);
2027
2057
  }
2028
- class Ge extends K {
2058
+ class Ue extends X {
2029
2059
  /**
2030
2060
  * @since v6.10
2031
2061
  */
@@ -2064,7 +2094,7 @@ class Ge extends K {
2064
2094
  * value is calculated according to theme bg color.
2065
2095
  */
2066
2096
  get isDark() {
2067
- return !this.bgColor || mt(this.bgColor);
2097
+ return !this.bgColor || bt(this.bgColor);
2068
2098
  }
2069
2099
  get linkColor() {
2070
2100
  return this.get("linkColor");
@@ -2090,7 +2120,7 @@ class Ge extends K {
2090
2120
  */
2091
2121
  listen() {
2092
2122
  return b("theme_changed", (t) => {
2093
- this.set(Nt(t.theme_params));
2123
+ this.set(qt(t.theme_params));
2094
2124
  });
2095
2125
  }
2096
2126
  /**
@@ -2103,25 +2133,28 @@ class Ge extends K {
2103
2133
  return this.get("textColor");
2104
2134
  }
2105
2135
  }
2106
- const bs = u("themeParams", ({ themeParams: e, state: t = e }) => {
2107
- const s = new Ge(t);
2108
- return y() || s.listen(), s;
2109
- });
2110
- function ws(e = {}) {
2136
+ const _s = l(
2137
+ "themeParams",
2138
+ ({ themeParams: e, state: t = e, addCleanup: s }) => {
2139
+ const n = new Ue(t);
2140
+ return s(n.listen()), n;
2141
+ }
2142
+ );
2143
+ function fs(e = {}) {
2111
2144
  return _({
2112
2145
  ...e,
2113
2146
  method: "web_app_request_theme",
2114
2147
  event: "theme_changed"
2115
- }).then(Nt);
2148
+ }).then(qt);
2116
2149
  }
2117
- class je extends tt {
2150
+ class We extends tt {
2118
2151
  constructor(s, n, r) {
2119
2152
  super(s, { readTextFromClipboard: "web_app_read_text_from_clipboard" });
2120
2153
  /**
2121
2154
  * Checks if specified method parameter is supported by current component.
2122
2155
  */
2123
2156
  c(this, "supportsParam");
2124
- this.version = s, this.createRequestId = n, this.postEvent = r, this.supportsParam = kt(s, {
2157
+ this.version = s, this.createRequestId = n, this.postEvent = r, this.supportsParam = It(s, {
2125
2158
  "openLink.tryInstantView": ["web_app_open_link", "try_instant_view"]
2126
2159
  });
2127
2160
  }
@@ -2136,7 +2169,7 @@ class je extends tt {
2136
2169
  */
2137
2170
  openLink(s, n) {
2138
2171
  const r = new URL(s, window.location.href).toString();
2139
- if (!E("web_app_open_link", this.version)) {
2172
+ if (!v("web_app_open_link", this.version)) {
2140
2173
  window.open(r, "_blank");
2141
2174
  return;
2142
2175
  }
@@ -2155,7 +2188,7 @@ class je extends tt {
2155
2188
  const { hostname: n, pathname: r, search: i } = new URL(s, window.location.href);
2156
2189
  if (n !== "t.me")
2157
2190
  throw new Error(`URL has not allowed hostname: ${n}. Only "t.me" is allowed`);
2158
- if (!E("web_app_open_tg_link", this.version)) {
2191
+ if (!v("web_app_open_tg_link", this.version)) {
2159
2192
  window.location.href = s;
2160
2193
  return;
2161
2194
  }
@@ -2175,15 +2208,15 @@ class je extends tt {
2175
2208
  event: "clipboard_text_received",
2176
2209
  postEvent: this.postEvent,
2177
2210
  params: { req_id: s },
2178
- capture: gt(s)
2211
+ capture: _t(s)
2179
2212
  });
2180
2213
  return n;
2181
2214
  }
2182
2215
  }
2183
- const ms = u(
2184
- ({ version: e, postEvent: t, createRequestId: s }) => new je(e, s, t)
2216
+ const gs = l(
2217
+ ({ version: e, postEvent: t, createRequestId: s }) => new We(e, s, t)
2185
2218
  );
2186
- async function Dt(e = {}) {
2219
+ async function kt(e = {}) {
2187
2220
  const {
2188
2221
  is_expanded: t,
2189
2222
  is_state_stable: s,
@@ -2195,16 +2228,16 @@ async function Dt(e = {}) {
2195
2228
  });
2196
2229
  return { ...n, isExpanded: t, isStateStable: s };
2197
2230
  }
2198
- function S(e) {
2231
+ function x(e) {
2199
2232
  return e < 0 ? 0 : e;
2200
2233
  }
2201
- class Vt extends K {
2202
- constructor({ postEvent: s, stableHeight: n, height: r, width: i, isExpanded: o }) {
2234
+ class He extends X {
2235
+ constructor({ postEvent: s, stableHeight: n, height: r, width: i, isExpanded: a }) {
2203
2236
  super({
2204
- height: S(r),
2205
- isExpanded: o,
2206
- stableHeight: S(n),
2207
- width: S(i)
2237
+ height: x(r),
2238
+ isExpanded: a,
2239
+ stableHeight: x(n),
2240
+ width: x(i)
2208
2241
  });
2209
2242
  c(this, "postEvent");
2210
2243
  this.postEvent = s;
@@ -2215,7 +2248,7 @@ class Vt extends K {
2215
2248
  * @param options - options to request fresh data.
2216
2249
  */
2217
2250
  async sync(s) {
2218
- const { isStateStable: n, ...r } = await Dt(s);
2251
+ const { isStateStable: n, ...r } = await kt(s);
2219
2252
  this.set({
2220
2253
  ...r,
2221
2254
  stableHeight: n ? r.height : this.get("stableHeight")
@@ -2267,13 +2300,13 @@ class Vt extends K {
2267
2300
  height: n,
2268
2301
  width: r,
2269
2302
  is_expanded: i,
2270
- is_state_stable: o
2271
- } = s, a = S(n);
2303
+ is_state_stable: a
2304
+ } = s, o = x(n);
2272
2305
  this.set({
2273
- height: a,
2306
+ height: o,
2274
2307
  isExpanded: i,
2275
- width: S(r),
2276
- ...o ? { stableHeight: a } : {}
2308
+ width: x(r),
2309
+ ...a ? { stableHeight: o } : {}
2277
2310
  });
2278
2311
  });
2279
2312
  }
@@ -2307,68 +2340,49 @@ class Vt extends K {
2307
2340
  return this.stableHeight === this.height;
2308
2341
  }
2309
2342
  }
2310
- async function Fe(e, t = {}) {
2311
- const {
2312
- height: s,
2313
- width: n,
2314
- isExpanded: r,
2315
- isStateStable: i
2316
- } = await Dt({ ...t, postEvent: e });
2317
- return new Vt({
2318
- postEvent: e,
2319
- height: s,
2320
- width: n,
2321
- isExpanded: r,
2322
- stableHeight: i ? s : 0
2323
- });
2324
- }
2325
- function ze({
2326
- state: e,
2327
- platform: t,
2328
- postEvent: s
2329
- }) {
2330
- let n = !1, r = 0, i = 0, o = 0;
2331
- return e ? (n = e.isExpanded, r = e.height, i = e.width, o = e.stableHeight) : ["macos", "tdesktop", "unigram", "webk", "weba", "web"].includes(t) && (n = !0, r = window.innerHeight, i = window.innerWidth, o = window.innerHeight), new Vt({
2332
- postEvent: s,
2333
- height: r,
2334
- width: i,
2335
- stableHeight: o,
2336
- isExpanded: n
2337
- });
2338
- }
2339
- const ys = u(
2343
+ const bs = l(
2340
2344
  "viewport",
2341
- async (e) => {
2342
- if (y() && !e.state)
2343
- throw f(
2344
- pt,
2345
- "Viewport cannot be instantiated on the server side without passing the ssr.state object."
2346
- );
2347
- let t = ze(e);
2348
- return y() || (t.width === 0 && await Fe(e.postEvent, { timeout: 1e3 }).then((s) => t = s).catch((s) => D.error("Unable to sync viewport state", s)), t.listen()), t;
2345
+ async ({ state: e, platform: t, postEvent: s, addCleanup: n }) => {
2346
+ let r = !1, i = 0, a = 0, o = 0;
2347
+ if (e)
2348
+ r = e.isExpanded, i = e.height, a = e.width, o = e.stableHeight;
2349
+ else if (["macos", "tdesktop", "unigram", "webk", "weba", "web"].includes(t))
2350
+ r = !0, i = window.innerHeight, a = window.innerWidth, o = window.innerHeight;
2351
+ else {
2352
+ const u = await kt({ timeout: 1e3, postEvent: s });
2353
+ r = u.isExpanded, i = u.height, a = u.width, o = u.isStateStable ? i : 0;
2354
+ }
2355
+ const p = new He({
2356
+ postEvent: s,
2357
+ height: i,
2358
+ width: a,
2359
+ stableHeight: o,
2360
+ isExpanded: r
2361
+ });
2362
+ return n(p.listen()), p;
2349
2363
  }
2350
2364
  );
2351
2365
  function m(e, t) {
2352
2366
  document.documentElement.style.setProperty(e, t);
2353
2367
  }
2354
- function vs(e, t, s) {
2355
- s || (s = (a) => `--tg-${a}-color`);
2368
+ function ws(e, t, s) {
2369
+ s || (s = (o) => `--tg-${o}-color`);
2356
2370
  const n = s("header"), r = s("bg"), i = () => {
2357
- const { headerColor: a } = e;
2358
- if (Q(a))
2359
- m(n, a);
2371
+ const { headerColor: o } = e;
2372
+ if (Q(o))
2373
+ m(n, o);
2360
2374
  else {
2361
- const { bgColor: p, secondaryBgColor: l } = t;
2362
- a === "bg_color" && p ? m(n, p) : a === "secondary_bg_color" && l && m(n, l);
2375
+ const { bgColor: p, secondaryBgColor: u } = t;
2376
+ o === "bg_color" && p ? m(n, p) : o === "secondary_bg_color" && u && m(n, u);
2363
2377
  }
2364
2378
  m(r, e.bgColor);
2365
- }, o = [
2379
+ }, a = [
2366
2380
  t.on("change", i),
2367
2381
  e.on("change", i)
2368
2382
  ];
2369
- return i(), () => o.forEach((a) => a());
2383
+ return i(), () => a.forEach((o) => o());
2370
2384
  }
2371
- function Es(e, t) {
2385
+ function ms(e, t) {
2372
2386
  t || (t = (n) => `--tg-theme-${n.replace(/[A-Z]/g, (r) => `-${r.toLowerCase()}`)}`);
2373
2387
  const s = () => {
2374
2388
  Object.entries(e.getState()).forEach(([n, r]) => {
@@ -2377,20 +2391,20 @@ function Es(e, t) {
2377
2391
  };
2378
2392
  return s(), e.on("change", s);
2379
2393
  }
2380
- function Ps(e, t) {
2381
- t || (t = (l) => `--tg-viewport-${l}`);
2394
+ function ys(e, t) {
2395
+ t || (t = (u) => `--tg-viewport-${u}`);
2382
2396
  const [
2383
2397
  s,
2384
2398
  n,
2385
2399
  r
2386
- ] = ["height", "width", "stable-height"].map((l) => t(l)), i = () => m(s, `${e.height}px`), o = () => m(n, `${e.width}px`), a = () => m(r, `${e.stableHeight}px`), p = [
2400
+ ] = ["height", "width", "stable-height"].map((u) => t(u)), i = () => m(s, `${e.height}px`), a = () => m(n, `${e.width}px`), o = () => m(r, `${e.stableHeight}px`), p = [
2387
2401
  e.on("change:height", i),
2388
- e.on("change:width", o),
2389
- e.on("change:stableHeight", a)
2402
+ e.on("change:width", a),
2403
+ e.on("change:stableHeight", o)
2390
2404
  ];
2391
- return i(), o(), a(), () => p.forEach((l) => l());
2405
+ return i(), a(), o(), () => p.forEach((u) => u());
2392
2406
  }
2393
- function xs(e = !0) {
2407
+ function vs(e = !0) {
2394
2408
  const t = [
2395
2409
  b("reload_iframe", () => {
2396
2410
  A("iframe_will_reload"), window.location.reload();
@@ -2407,8 +2421,11 @@ function xs(e = !0) {
2407
2421
  }
2408
2422
  return A("iframe_ready", { reload_supported: !0 }), s;
2409
2423
  }
2410
- async function Ss() {
2411
- if (_t(window))
2424
+ function Es() {
2425
+ return typeof window > "u";
2426
+ }
2427
+ async function Ps() {
2428
+ if (lt(window))
2412
2429
  return !0;
2413
2430
  try {
2414
2431
  return await _({ method: "web_app_request_theme", event: "theme_changed", timeout: 100 }), !0;
@@ -2416,13 +2433,13 @@ async function Ss() {
2416
2433
  return !1;
2417
2434
  }
2418
2435
  }
2419
- function Je(e) {
2420
- return e instanceof $;
2436
+ function Ge(e) {
2437
+ return e instanceof V;
2421
2438
  }
2422
- function Cs(e, t) {
2423
- return Je(e) && e.type === t;
2439
+ function xs(e, t) {
2440
+ return Ge(e) && e.type === t;
2424
2441
  }
2425
- function O(e, t) {
2442
+ function B(e, t) {
2426
2443
  let s, n, r;
2427
2444
  return typeof e == "string" ? s = e : (s = e.pathname === void 0 ? t : e.pathname, n = e.params, r = e.id), Object.freeze({
2428
2445
  id: r || (Math.random() * 2 ** 14 | 0).toString(16),
@@ -2430,13 +2447,13 @@ function O(e, t) {
2430
2447
  params: n
2431
2448
  });
2432
2449
  }
2433
- class Qe {
2450
+ class je {
2434
2451
  constructor(t, s, n = A) {
2435
2452
  /**
2436
2453
  * Navigation history.
2437
2454
  */
2438
2455
  c(this, "history");
2439
- c(this, "ee", new V());
2456
+ c(this, "ee", new R());
2440
2457
  /**
2441
2458
  * True, if current navigator is currently attached.
2442
2459
  */
@@ -2454,13 +2471,13 @@ class Qe {
2454
2471
  */
2455
2472
  c(this, "off", this.ee.off.bind(this.ee));
2456
2473
  if (this._index = s, this.postEvent = n, t.length === 0)
2457
- throw f(Qt, "History should not be empty.");
2474
+ throw f(zt, "History should not be empty.");
2458
2475
  if (s < 0 || s >= t.length)
2459
2476
  throw f(
2460
- Yt,
2477
+ Ft,
2461
2478
  "Index should not be zero and higher or equal than history size."
2462
2479
  );
2463
- this.history = t.map((r) => O(r, ""));
2480
+ this.history = t.map((r) => B(r, ""));
2464
2481
  }
2465
2482
  /**
2466
2483
  * Allows this navigator to control the `BackButton` visibility state. It also tracks the
@@ -2479,7 +2496,7 @@ class Qe {
2479
2496
  * Prevents current navigator from controlling the BackButton visibility state.
2480
2497
  */
2481
2498
  detach() {
2482
- this.attached = !1, B("back_button_pressed", this.back);
2499
+ this.attached = !1, L("back_button_pressed", this.back);
2483
2500
  }
2484
2501
  /**
2485
2502
  * Goes to the next history item.
@@ -2535,14 +2552,14 @@ class Qe {
2535
2552
  * @param item - item to add.
2536
2553
  */
2537
2554
  push(t) {
2538
- this.hasNext && this.history.splice(this.index + 1), this.replaceAndMove(this.index + 1, O(t, this.current.pathname));
2555
+ this.hasNext && this.history.splice(this.index + 1), this.replaceAndMove(this.index + 1, B(t, this.current.pathname));
2539
2556
  }
2540
2557
  /**
2541
2558
  * Replaces the current history item.
2542
2559
  * @param item - item to replace the current item with.
2543
2560
  */
2544
2561
  replace(t) {
2545
- this.replaceAndMove(this.index, O(t, this.current.pathname));
2562
+ this.replaceAndMove(this.index, B(t, this.current.pathname));
2546
2563
  }
2547
2564
  /**
2548
2565
  * Sets history item by the specified index.
@@ -2572,7 +2589,7 @@ class Qe {
2572
2589
  this.postEvent("web_app_setup_back_button", { is_visible: !!this.index });
2573
2590
  }
2574
2591
  }
2575
- function U({
2592
+ function O({
2576
2593
  params: e,
2577
2594
  ...t
2578
2595
  }) {
@@ -2581,26 +2598,26 @@ function U({
2581
2598
  function T(e, t) {
2582
2599
  return e.startsWith(t) ? e : `${t}${e}`;
2583
2600
  }
2584
- function k(e) {
2601
+ function N(e) {
2585
2602
  return new URL(
2586
2603
  typeof e == "string" ? e : `${e.pathname || ""}${T(e.search || "", "?")}${T(e.hash || "", "#")}`,
2587
2604
  "http://a"
2588
2605
  );
2589
2606
  }
2590
- function N(e) {
2591
- const t = typeof e == "string" ? e.startsWith("/") : !!(e.pathname && e.pathname.startsWith("/")), s = k(e);
2607
+ function D(e) {
2608
+ const t = typeof e == "string" ? e.startsWith("/") : !!(e.pathname && e.pathname.startsWith("/")), s = N(e);
2592
2609
  return `${t ? s.pathname : s.pathname.slice(1)}${s.search}${s.hash}`;
2593
2610
  }
2594
- function W(e, t, s) {
2611
+ function U(e, t, s) {
2595
2612
  let n, r;
2596
- typeof e == "string" ? n = e : (n = N(e), s = e.state, r = e.id);
2597
- const { pathname: i, search: o, hash: a } = new URL(n, `http://a${T(t, "/")}`);
2598
- return { id: r, pathname: i, params: { hash: a, search: o, state: s } };
2613
+ typeof e == "string" ? n = e : (n = D(e), s = e.state, r = e.id);
2614
+ const { pathname: i, search: a, hash: o } = new URL(n, `http://a${T(t, "/")}`);
2615
+ return { id: r, pathname: i, params: { hash: o, search: a, state: s } };
2599
2616
  }
2600
- async function R(e) {
2617
+ async function C(e) {
2601
2618
  return e === 0 ? !0 : Promise.race([
2602
2619
  new Promise((t) => {
2603
- const s = F("popstate", () => {
2620
+ const s = j("popstate", () => {
2604
2621
  s(), t(!0);
2605
2622
  });
2606
2623
  window.history.go(e);
@@ -2611,21 +2628,21 @@ async function R(e) {
2611
2628
  })
2612
2629
  ]);
2613
2630
  }
2614
- async function Ye() {
2615
- if (window.history.length <= 1 || (window.history.pushState(null, ""), await R(1 - window.history.length)))
2631
+ async function ze() {
2632
+ if (window.history.length <= 1 || (window.history.pushState(null, ""), await C(1 - window.history.length)))
2616
2633
  return;
2617
- let t = await R(-1);
2634
+ let t = await C(-1);
2618
2635
  for (; t; )
2619
- t = await R(-1);
2636
+ t = await C(-1);
2620
2637
  }
2621
- function $t(e) {
2622
- return k(e).pathname;
2638
+ function Nt(e) {
2639
+ return N(e).pathname;
2623
2640
  }
2624
- const ot = 0, H = 1, G = 2;
2625
- class Mt {
2626
- constructor(t, s, { postEvent: n, hashMode: r, base: i } = {}) {
2641
+ const rt = 0, W = 1, H = 2;
2642
+ class Dt {
2643
+ constructor(t, s, { postEvent: n, hashMode: r = "classic", base: i } = {}) {
2627
2644
  c(this, "navigator");
2628
- c(this, "ee", new V());
2645
+ c(this, "ee", new R());
2629
2646
  c(this, "hashMode");
2630
2647
  c(this, "base");
2631
2648
  /**
@@ -2639,7 +2656,7 @@ class Mt {
2639
2656
  c(this, "onPopState", ({ state: t }) => {
2640
2657
  if (t === null)
2641
2658
  return this.push(this.parsePath(window.location.href));
2642
- t === ot ? window.history.forward() : t === H && this.back(), t === G && this.forward();
2659
+ t === rt ? window.history.forward() : t === W && this.back(), t === H && this.forward();
2643
2660
  });
2644
2661
  /**
2645
2662
  * Underlying navigator change event listener.
@@ -2651,8 +2668,8 @@ class Mt {
2651
2668
  }) => {
2652
2669
  this.attached && await this.syncHistory(), this.ee.emit("change", {
2653
2670
  delta: n,
2654
- from: U(s),
2655
- to: U(t),
2671
+ from: O(s),
2672
+ to: O(t),
2656
2673
  navigator: this
2657
2674
  });
2658
2675
  });
@@ -2664,11 +2681,11 @@ class Mt {
2664
2681
  * Removes event listener.
2665
2682
  */
2666
2683
  c(this, "off", this.ee.off.bind(this.ee));
2667
- this.navigator = new Qe(
2668
- t.map((o) => W(o, "/")),
2684
+ this.navigator = new je(
2685
+ t.map((a) => U(a, "/")),
2669
2686
  s,
2670
2687
  n
2671
- ), this.navigator.on("change", this.onNavigatorChange), this.hashMode = r, this.base = $t(i || "");
2688
+ ), this.navigator.on("change", this.onNavigatorChange), this.hashMode = r, this.base = Nt(i || "");
2672
2689
  }
2673
2690
  /**
2674
2691
  * Attaches current navigator to the browser history allowing navigator to manipulate it.
@@ -2752,7 +2769,7 @@ class Mt {
2752
2769
  * Navigation history.
2753
2770
  */
2754
2771
  get history() {
2755
- return this.navigator.history.map(U);
2772
+ return this.navigator.history.map(O);
2756
2773
  }
2757
2774
  /**
2758
2775
  * Path, including pathname, search and hash.
@@ -2766,7 +2783,7 @@ class Mt {
2766
2783
  * "/pathname?search#hash"
2767
2784
  */
2768
2785
  get path() {
2769
- return N(this);
2786
+ return D(this);
2770
2787
  }
2771
2788
  /**
2772
2789
  * Current pathname. Always starts with the slash.
@@ -2795,19 +2812,19 @@ class Mt {
2795
2812
  * // { pathname: '/tma', search: '?is=cool', hash: '#yeah' }
2796
2813
  */
2797
2814
  parsePath(t) {
2798
- let s = k(t);
2799
- return this.hashMode && (s = k(s.hash.slice(1))), {
2815
+ let s = N(t);
2816
+ return this.hashMode && (s = N(s.hash.slice(1))), {
2800
2817
  pathname: s.pathname,
2801
2818
  search: s.search,
2802
2819
  hash: s.hash
2803
2820
  };
2804
2821
  }
2805
2822
  push(t, s) {
2806
- const n = W(t, this.path), { state: r = s } = n.params;
2823
+ const n = U(t, this.path), { state: r = s } = n.params;
2807
2824
  this.navigator.push({ ...n, params: { ...n.params, state: r } });
2808
2825
  }
2809
2826
  replace(t, s) {
2810
- const n = W(t, this.path), { state: r = s } = n.params;
2827
+ const n = U(t, this.path), { state: r = s } = n.params;
2811
2828
  this.navigator.replace({ ...n, params: { ...n.params, state: r } });
2812
2829
  }
2813
2830
  /**
@@ -2816,8 +2833,8 @@ class Mt {
2816
2833
  * @param value - path presented as string or URLLike.
2817
2834
  */
2818
2835
  renderPath(t) {
2819
- const s = (this.base.length === 1 ? "" : this.base) + T(N(t), "/");
2820
- return this.hashMode ? T(s.slice(1), this.hashMode === "default" ? "#" : "#/") : s;
2836
+ const s = (this.base.length === 1 ? "" : this.base) + T(D(t), "/");
2837
+ return this.hashMode ? T(s.slice(1), this.hashMode === "classic" ? "#" : "#/") : s;
2821
2838
  }
2822
2839
  /**
2823
2840
  * Synchronizes current navigator state with browser history.
@@ -2825,7 +2842,7 @@ class Mt {
2825
2842
  async syncHistory() {
2826
2843
  window.removeEventListener("popstate", this.onPopState);
2827
2844
  const { state: t } = this, s = this.renderPath(this);
2828
- await Ye(), this.hasPrev && this.hasNext ? (window.history.replaceState(H, ""), window.history.pushState(t, "", s), window.history.pushState(G, ""), await R(-1)) : this.hasPrev ? (window.history.replaceState(H, ""), window.history.pushState(t, "", s)) : this.hasNext ? (window.history.replaceState(t, s), window.history.pushState(G, ""), await R(-1)) : (window.history.replaceState(ot, ""), window.history.pushState(t, "", s)), window.addEventListener("popstate", this.onPopState);
2845
+ await ze(), this.hasPrev && this.hasNext ? (window.history.replaceState(W, ""), window.history.pushState(t, "", s), window.history.pushState(H, ""), await C(-1)) : this.hasPrev ? (window.history.replaceState(W, ""), window.history.pushState(t, "", s)) : this.hasNext ? (window.history.replaceState(t, s), window.history.pushState(H, ""), await C(-1)) : (window.history.replaceState(rt, ""), window.history.pushState(t, "", s)), window.addEventListener("popstate", this.onPopState);
2829
2846
  }
2830
2847
  /**
2831
2848
  * Current query parameters.
@@ -2843,148 +2860,148 @@ class Mt {
2843
2860
  return (this.navigator.current.params || {}).state;
2844
2861
  }
2845
2862
  }
2846
- function Ze(e) {
2863
+ function Fe(e) {
2847
2864
  e || (e = {});
2848
2865
  const { href: t, hash: s } = window.location;
2849
- let n = N(
2850
- e.hashMode ? s.includes("?") ? s.slice(1) : `?${s.slice(1)}` : t
2866
+ let n = D(
2867
+ e.hashMode === null ? t : s.includes("?") ? s.slice(1) : `?${s.slice(1)}`
2851
2868
  );
2852
- const r = e.base ? $t(e.base) : void 0;
2869
+ const r = e.base ? Nt(e.base) : void 0;
2853
2870
  if (r) {
2854
2871
  if (!n.startsWith(r))
2855
2872
  throw f(
2856
- Zt,
2873
+ Jt,
2857
2874
  `Path "${n}" expected to be starting with "${r}"`
2858
2875
  );
2859
2876
  n = n.slice(r.length);
2860
2877
  }
2861
- return new Mt([n], 0, e);
2878
+ return new Dt([n], 0, e);
2862
2879
  }
2863
- function Rs(e) {
2880
+ function Ss(e) {
2864
2881
  const t = e.match(/#(.+)/);
2865
2882
  return t ? t[1] : null;
2866
2883
  }
2867
- function Xe(e, t) {
2868
- if (It()) {
2884
+ function Je(e, t) {
2885
+ if (At()) {
2869
2886
  const s = sessionStorage.getItem(e);
2870
2887
  if (s)
2871
2888
  try {
2872
2889
  const { index: n, history: r } = JSON.parse(s);
2873
- return new Mt(r, n, t);
2890
+ return new Dt(r, n, t);
2874
2891
  } catch (n) {
2875
2892
  console.error("Unable to restore hash navigator state.", n);
2876
2893
  }
2877
2894
  }
2878
- return Ze(t);
2895
+ return Fe(t);
2879
2896
  }
2880
- function As(e, t) {
2881
- const s = Xe(e, t), n = () => sessionStorage.setItem(e, JSON.stringify({
2897
+ function Cs(e, t) {
2898
+ const s = Je(e, t), n = () => sessionStorage.setItem(e, JSON.stringify({
2882
2899
  index: s.index,
2883
2900
  history: s.history
2884
2901
  }));
2885
2902
  return s.on("change", n), n(), s;
2886
2903
  }
2887
2904
  export {
2888
- _e as BackButton,
2889
- Qe as BasicNavigator,
2890
- rt as BiometryManager,
2891
- Mt as BrowserNavigator,
2892
- Ae as ClosingBehavior,
2893
- ke as CloudStorage,
2894
- Zt as ERR_INVALID_PATH_BASE,
2895
- Ft as ERR_INVOKE_CUSTOM_METHOD_RESPONSE,
2896
- Gt as ERR_METHOD_PARAMETER_UNSUPPORTED,
2897
- Ht as ERR_METHOD_UNSUPPORTED,
2898
- Qt as ERR_NAVIGATION_HISTORY_EMPTY,
2899
- Yt as ERR_NAVIGATION_INDEX_INVALID,
2900
- es as ERR_NAVIGATION_ITEM_INVALID,
2901
- ht as ERR_PARSE,
2902
- pt as ERR_SSR_INIT,
2903
- zt as ERR_TIMED_OUT,
2904
- Jt as ERR_UNEXPECTED_TYPE,
2905
- jt as ERR_UNKNOWN_ENV,
2906
- V as EventEmitter,
2907
- Ne as HapticFeedback,
2908
- De as InitData,
2909
- Ve as Invoice,
2910
- $e as MainButton,
2911
- Be as MiniApp,
2912
- Ue as Popup,
2913
- We as QRScanner,
2914
- $ as SDKError,
2915
- He as SettingsButton,
2916
- Ge as ThemeParams,
2917
- je as Utils,
2918
- Vt as Viewport,
2919
- qe as array,
2920
- vs as bindMiniAppCSSVars,
2921
- Es as bindThemeParamsCSSVars,
2922
- Ps as bindViewportCSSVars,
2905
+ pe as BackButton,
2906
+ je as BasicNavigator,
2907
+ Pe as BiometryManager,
2908
+ Dt as BrowserNavigator,
2909
+ Se as ClosingBehavior,
2910
+ Te as CloudStorage,
2911
+ Jt as ERR_INVALID_PATH_BASE,
2912
+ Ht as ERR_INVOKE_CUSTOM_METHOD_RESPONSE,
2913
+ Ut as ERR_METHOD_PARAMETER_UNSUPPORTED,
2914
+ Ot as ERR_METHOD_UNSUPPORTED,
2915
+ zt as ERR_NAVIGATION_HISTORY_EMPTY,
2916
+ Ft as ERR_NAVIGATION_INDEX_INVALID,
2917
+ Ze as ERR_NAVIGATION_ITEM_INVALID,
2918
+ ct as ERR_PARSE,
2919
+ Ke as ERR_SSR_INIT,
2920
+ Gt as ERR_TIMED_OUT,
2921
+ jt as ERR_UNEXPECTED_TYPE,
2922
+ Wt as ERR_UNKNOWN_ENV,
2923
+ R as EventEmitter,
2924
+ Ie as HapticFeedback,
2925
+ qe as InitData,
2926
+ ke as Invoice,
2927
+ Ne as MainButton,
2928
+ $e as MiniApp,
2929
+ Le as Popup,
2930
+ Be as QRScanner,
2931
+ V as SDKError,
2932
+ Oe as SettingsButton,
2933
+ Ue as ThemeParams,
2934
+ We as Utils,
2935
+ He as Viewport,
2936
+ Ae as array,
2937
+ ws as bindMiniAppCSSVars,
2938
+ ms as bindThemeParamsCSSVars,
2939
+ ys as bindViewportCSSVars,
2923
2940
  w as boolean,
2924
- gt as captureSameReq,
2941
+ _t as captureSameReq,
2925
2942
  z as classNames,
2926
- ce as compareVersions,
2927
- Ze as createBrowserNavigatorFromLocation,
2928
- le as createPostEvent,
2929
- k as createSafeURL,
2930
- vt as date,
2931
- Rs as getHash,
2932
- $t as getPathname,
2933
- rs as initBackButton,
2934
- is as initBiometryManager,
2935
- os as initClosingBehavior,
2936
- as as initCloudStorage,
2937
- cs as initHapticFeedback,
2938
- hs as initInitData,
2939
- us as initInvoice,
2940
- ls as initMainButton,
2941
- ds as initMiniApp,
2942
- As as initNavigator,
2943
- _s as initPopup,
2944
- fs as initQRScanner,
2945
- gs as initSettingsButton,
2946
- bs as initThemeParams,
2947
- ms as initUtils,
2948
- ys as initViewport,
2949
- xs as initWeb,
2950
- C as invokeCustomMethod,
2951
- mt as isColorDark,
2952
- pe as isIframe,
2953
- It as isPageReload,
2943
+ re as compareVersions,
2944
+ Fe as createBrowserNavigatorFromLocation,
2945
+ ce as createPostEvent,
2946
+ N as createSafeURL,
2947
+ mt as date,
2948
+ Ss as getHash,
2949
+ Nt as getPathname,
2950
+ es as initBackButton,
2951
+ ss as initBiometryManager,
2952
+ ns as initClosingBehavior,
2953
+ rs as initCloudStorage,
2954
+ is as initHapticFeedback,
2955
+ os as initInitData,
2956
+ cs as initInvoice,
2957
+ hs as initMainButton,
2958
+ ps as initMiniApp,
2959
+ Cs as initNavigator,
2960
+ us as initPopup,
2961
+ ls as initQRScanner,
2962
+ ds as initSettingsButton,
2963
+ _s as initThemeParams,
2964
+ gs as initUtils,
2965
+ bs as initViewport,
2966
+ vs as initWeb,
2967
+ S as invokeCustomMethod,
2968
+ bt as isColorDark,
2969
+ oe as isIframe,
2970
+ At as isPageReload,
2954
2971
  Q as isRGB,
2955
- Xt as isRGBShort,
2956
- Je as isSDKError,
2957
- Cs as isSDKErrorOfType,
2958
- y as isSSR,
2959
- Ss as isTMA,
2972
+ Qt as isRGBShort,
2973
+ Ge as isSDKError,
2974
+ xs as isSDKErrorOfType,
2975
+ Es as isSSR,
2976
+ Ps as isTMA,
2960
2977
  d as json,
2961
- ns as mergeClassNames,
2962
- v as number,
2963
- B as off,
2978
+ ts as mergeClassNames,
2979
+ y as number,
2980
+ L as off,
2964
2981
  b as on,
2965
- ps as parseInitData,
2966
- xt as parseLaunchParams,
2967
- Nt as parseThemeParams,
2982
+ as as parseInitData,
2983
+ Et as parseLaunchParams,
2984
+ qt as parseThemeParams,
2968
2985
  A as postEvent,
2969
2986
  _ as request,
2970
- Re as requestBiometryInfo,
2971
- ws as requestThemeParams,
2972
- Dt as requestViewport,
2973
- xe as retrieveLaunchParams,
2974
- dt as rgb,
2975
- X as searchParams,
2976
- Ee as serializeLaunchParams,
2977
- ve as serializeThemeParams,
2987
+ xe as requestBiometryInfo,
2988
+ fs as requestThemeParams,
2989
+ kt as requestViewport,
2990
+ ye as retrieveLaunchParams,
2991
+ ut as rgb,
2992
+ K as searchParams,
2993
+ we as serializeLaunchParams,
2994
+ be as serializeThemeParams,
2978
2995
  m as setCSSVar,
2979
- ts as setDebug,
2980
- ss as setTargetOrigin,
2996
+ Ye as setDebug,
2997
+ Xe as setTargetOrigin,
2981
2998
  h as string,
2982
- Ot as subscribe,
2983
- E as supports,
2984
- ue as targetOrigin,
2985
- lt as toRGB,
2986
- ct as unsubscribe,
2987
- N as urlToPath,
2988
- wt as withTimeout
2999
+ Mt as subscribe,
3000
+ v as supports,
3001
+ ae as targetOrigin,
3002
+ pt as toRGB,
3003
+ ot as unsubscribe,
3004
+ D as urlToPath,
3005
+ gt as withTimeout
2989
3006
  };
2990
3007
  //# sourceMappingURL=index.js.map