@tma.js/sdk 3.1.0 → 3.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2,20 +2,20 @@ var Rt = Object.defineProperty;
2
2
  var Lt = (s, t, r) => t in s ? Rt(s, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : s[t] = r;
3
3
  var e = (s, t, r) => Lt(s, typeof t != "symbol" ? t + "" : t, r);
4
4
  import { batch as Ce, signal as j, computed as F } from "@tma.js/signals";
5
- import { supports as oe, isTMAFp as Pt, postEventFp as Ot, off as le, on as Z, requestFp as Dt, request2Fp as Ut, invokeCustomMethodFp as Gt, retrieveRawInitDataFp as jt, retrieveLaunchParamsFp as ve, captureSameReq as Ht, logger as ot } from "@tma.js/bridge";
6
- import { CancelledError as wo, InvalidLaunchParamsError as Co, InvokeCustomMethodFailedError as vo, LaunchParamsRetrieveError as So, MethodParameterUnsupportedError as yo, MethodUnsupportedError as ko, TimeoutError as Io, UnknownEnvError as Eo, applyPolyfills as Ao, createLogger as xo, createPostEvent as qo, createStartParam as Bo, createStartParamFp as Mo, debug as To, decodeBase64Url as Vo, decodeBase64UrlFp as $o, decodeStartParam as Ro, decodeStartParamFp as Lo, deepSnakeToCamelObjKeys as Po, emitEvent as Oo, encodeBase64Url as Do, getReleaseVersion as Uo, isSafeToCreateStartParam as Go, isTMA as jo, isTMAFp as Ho, logger as Wo, mockTelegramEnv as Ko, off as No, offAll as Qo, on as zo, retrieveLaunchParams as Jo, retrieveLaunchParamsFp as Yo, retrieveRawInitData as Zo, retrieveRawInitDataFp as Xo, retrieveRawLaunchParams as ei, retrieveRawLaunchParamsFp as ti, setDebug as si, setTargetOrigin as ri, supports as ni, targetOrigin as oi } from "@tma.js/bridge";
5
+ import { supports as oe, isTMAFp as Pt, postEventFp as Ot, off as le, on as Z, requestFp as Dt, request2Fp as Ut, invokeCustomMethodFp as Gt, retrieveRawInitDataFp as jt, retrieveLaunchParamsFp as Se, captureSameReq as Ht, logger as ot } from "@tma.js/bridge";
6
+ import { CancelledError as wo, InvalidLaunchParamsError as Co, InvokeCustomMethodFailedError as So, LaunchParamsRetrieveError as vo, MethodParameterUnsupportedError as yo, MethodUnsupportedError as ko, TimeoutError as Io, UnknownEnvError as Eo, applyPolyfills as Ao, createLogger as xo, createPostEvent as qo, createStartParam as Bo, createStartParamFp as Mo, debug as To, decodeBase64Url as Vo, decodeBase64UrlFp as $o, decodeStartParam as Ro, decodeStartParamFp as Lo, deepSnakeToCamelObjKeys as Po, emitEvent as Oo, encodeBase64Url as Do, getReleaseVersion as Uo, isSafeToCreateStartParam as Go, isTMA as jo, isTMAFp as Ho, logger as Wo, mockTelegramEnv as Ko, off as No, offAll as Qo, on as zo, retrieveLaunchParams as Jo, retrieveLaunchParamsFp as Yo, retrieveRawInitData as Zo, retrieveRawInitDataFp as Xo, retrieveRawLaunchParams as ei, retrieveRawLaunchParamsFp as ti, setDebug as si, setTargetOrigin as ri, supports as ni, targetOrigin as oi } from "@tma.js/bridge";
7
7
  import { throwifyFpFn as ye, throwifyAnyEither as lt, getStorageValue as Wt, setStorageValue as Kt, snakeToKebab as Nt, createCbCollector as Re, camelToKebab as ht, BetterTaskEither as qe } from "@tma.js/toolkit";
8
8
  import { BetterPromise as Qt } from "better-promises";
9
9
  import { toRGBFullFp as zt, isRGB as Ie, pipeQueryToSchema as Jt, pipeJsonToSchema as Yt } from "@tma.js/transformers";
10
10
  import { isAnyRGB as ai, isRGB as ui, isRGBA as ci, isRGBAShort as pi, isRGBShort as li, parseInitDataQuery as hi, parseInitDataQueryFp as di, parseLaunchParamsQuery as fi, parseLaunchParamsQueryFp as _i, serializeInitDataQuery as mi, serializeLaunchParamsQuery as bi, toRGB as gi, toRGBFp as Fi, toRGBFull as wi, toRGBFullFp as Ci } from "@tma.js/transformers";
11
- import { errorClassWithData as Le, errorClass as K } from "error-kid";
11
+ import { errorClassWithData as Le, errorClass as W } from "error-kid";
12
12
  import { parse as it, record as Zt, string as Y, array as Xt, safeParse as Be, looseObject as at, pipe as dt, transform as ft, date as _t, optional as es, number as mt, integer as ts } from "valibot";
13
13
  var ss = function(s, t, r) {
14
14
  if (r || arguments.length === 2) for (var n = 0, i = t.length, o; n < i; n++)
15
15
  (o || !(n in t)) && (o || (o = Array.prototype.slice.call(t, 0, n)), o[n] = t[n]);
16
16
  return s.concat(o || Array.prototype.slice.call(t));
17
17
  };
18
- function bt(s, t, r, n, i, o, u, a, p) {
18
+ function bt(s, t, r, n, i, o, u, a, l) {
19
19
  switch (arguments.length) {
20
20
  case 1:
21
21
  return s;
@@ -49,11 +49,11 @@ function bt(s, t, r, n, i, o, u, a, p) {
49
49
  };
50
50
  case 9:
51
51
  return function() {
52
- return p(a(u(o(i(n(r(t(s.apply(this, arguments)))))))));
52
+ return l(a(u(o(i(n(r(t(s.apply(this, arguments)))))))));
53
53
  };
54
54
  }
55
55
  }
56
- function c(s, t, r, n, i, o, u, a, p) {
56
+ function c(s, t, r, n, i, o, u, a, l) {
57
57
  switch (arguments.length) {
58
58
  case 1:
59
59
  return s;
@@ -72,11 +72,11 @@ function c(s, t, r, n, i, o, u, a, p) {
72
72
  case 8:
73
73
  return a(u(o(i(n(r(t(s)))))));
74
74
  case 9:
75
- return p(a(u(o(i(n(r(t(s))))))));
75
+ return l(a(u(o(i(n(r(t(s))))))));
76
76
  default: {
77
- for (var l = arguments[0], _ = 1; _ < arguments.length; _++)
78
- l = arguments[_](l);
79
- return l;
77
+ for (var p = arguments[0], m = 1; m < arguments.length; m++)
78
+ p = arguments[m](p);
79
+ return p;
80
80
  }
81
81
  }
82
82
  }
@@ -134,10 +134,10 @@ function Oe(s) {
134
134
  var T = gt, x = Ft, us = /* @__PURE__ */ he(2, function(s, t) {
135
135
  return re(s) ? s : t(s.right);
136
136
  }), De = function(s, t) {
137
- return c(s, O(t));
137
+ return c(s, D(t));
138
138
  }, wt = function(s, t) {
139
139
  return c(s, hs(t));
140
- }, Ue = "Either", O = function(s) {
140
+ }, Ue = "Either", D = function(s) {
141
141
  return function(t) {
142
142
  return re(t) ? t : x(s(t.right));
143
143
  };
@@ -172,7 +172,7 @@ var T = gt, x = Ft, us = /* @__PURE__ */ he(2, function(s, t) {
172
172
  return T(t(r));
173
173
  }
174
174
  }, bs = /* @__PURE__ */ ps(Pe), gs = /* @__PURE__ */ Oe(fs), ut = gs;
175
- function D(s) {
175
+ function U(s) {
176
176
  return typeof s == "function" ? s() : s;
177
177
  }
178
178
  class fe {
@@ -199,10 +199,10 @@ class fe {
199
199
  this.mount = () => {
200
200
  if (this.isMounted())
201
201
  return x(void 0);
202
- const u = D(o) ? r() : void 0, a = u ? x(u) : typeof n == "function" ? n() : x(n);
203
- return c(a, O((p) => {
202
+ const u = U(o) ? r() : void 0, a = u ? x(u) : typeof n == "function" ? n() : x(n);
203
+ return c(a, D((l) => {
204
204
  Ce(() => {
205
- this._isMounted.set(!0), t == null || t(p);
205
+ this._isMounted.set(!0), t == null || t(l);
206
206
  });
207
207
  }));
208
208
  }, this.unmount = () => {
@@ -257,17 +257,17 @@ class ee {
257
257
  }
258
258
  }
259
259
  function z(s, t) {
260
- return F(() => oe(s, D(t)));
260
+ return F(() => oe(s, U(t)));
261
261
  }
262
262
  var ie = rs, _e = ns, Fs = function(s, t) {
263
- return c(s, vs(t));
263
+ return c(s, Ss(t));
264
264
  }, ws = function(s, t) {
265
265
  return c(s, ys(t));
266
- }, Cs = "Option", vs = function(s) {
266
+ }, Cs = "Option", Ss = function(s) {
267
267
  return function(t) {
268
268
  return pe(t) ? ie : _e(s(t.value));
269
269
  };
270
- }, Ss = _e, ys = function(s) {
270
+ }, vs = _e, ys = function(s) {
271
271
  return function(t) {
272
272
  return pe(t) || pe(s) ? ie : _e(t.value(s.value));
273
273
  };
@@ -284,13 +284,13 @@ var ie = rs, _e = ns, Fs = function(s, t) {
284
284
  return function(r) {
285
285
  return pe(r) ? s() : t(r.value);
286
286
  };
287
- }, vt = Es, As = /* @__PURE__ */ Ss(Pe), ct = /* @__PURE__ */ Oe(Is);
287
+ }, St = Es, As = /* @__PURE__ */ vs(Pe), ct = /* @__PURE__ */ Oe(Is);
288
288
  function h(s) {
289
289
  return Object.assign(ye(s), {
290
290
  ifAvailable(...t) {
291
291
  return c(
292
292
  s.ifAvailable(...t),
293
- vt(
293
+ St(
294
294
  () => ({ ok: !1 }),
295
295
  (r) => ({
296
296
  ok: !0,
@@ -334,7 +334,7 @@ function $s(s) {
334
334
  }
335
335
  var Ge = function(s, t) {
336
336
  return c(s, Rs(t));
337
- }, St = function(s, t) {
337
+ }, vt = function(s, t) {
338
338
  return c(s, Ls(t));
339
339
  }, Rs = function(s) {
340
340
  return function(t) {
@@ -369,12 +369,12 @@ var Ge = function(s, t) {
369
369
  }, Os = {
370
370
  URI: He,
371
371
  map: Ge,
372
- ap: St
372
+ ap: vt
373
373
  }, Ds = {
374
374
  URI: He,
375
375
  map: Ge,
376
376
  of: je,
377
- ap: St,
377
+ ap: vt,
378
378
  chain: Ps
379
379
  }, Us = function(s, t, r, n) {
380
380
  function i(o) {
@@ -383,24 +383,24 @@ var Ge = function(s, t) {
383
383
  });
384
384
  }
385
385
  return new (r || (r = Promise))(function(o, u) {
386
- function a(_) {
386
+ function a(m) {
387
387
  try {
388
- l(n.next(_));
388
+ p(n.next(m));
389
389
  } catch (d) {
390
390
  u(d);
391
391
  }
392
392
  }
393
- function p(_) {
393
+ function l(m) {
394
394
  try {
395
- l(n.throw(_));
395
+ p(n.throw(m));
396
396
  } catch (d) {
397
397
  u(d);
398
398
  }
399
399
  }
400
- function l(_) {
401
- _.done ? o(_.value) : i(_.value).then(a, p);
400
+ function p(m) {
401
+ m.done ? o(m.value) : i(m.value).then(a, l);
402
402
  }
403
- l((n = n.apply(s, t || [])).next());
403
+ p((n = n.apply(s, t || [])).next());
404
404
  });
405
405
  }, Gs = function(s, t) {
406
406
  var r = { label: 0, sent: function() {
@@ -410,56 +410,56 @@ var Ge = function(s, t) {
410
410
  return u = { next: a(0), throw: a(1), return: a(2) }, typeof Symbol == "function" && (u[Symbol.iterator] = function() {
411
411
  return this;
412
412
  }), u;
413
- function a(l) {
414
- return function(_) {
415
- return p([l, _]);
413
+ function a(p) {
414
+ return function(m) {
415
+ return l([p, m]);
416
416
  };
417
417
  }
418
- function p(l) {
418
+ function l(p) {
419
419
  if (n) throw new TypeError("Generator is already executing.");
420
- for (; u && (u = 0, l[0] && (r = 0)), r; ) try {
421
- if (n = 1, i && (o = l[0] & 2 ? i.return : l[0] ? i.throw || ((o = i.return) && o.call(i), 0) : i.next) && !(o = o.call(i, l[1])).done) return o;
422
- switch (i = 0, o && (l = [l[0] & 2, o.value]), l[0]) {
420
+ for (; u && (u = 0, p[0] && (r = 0)), r; ) try {
421
+ if (n = 1, i && (o = p[0] & 2 ? i.return : p[0] ? i.throw || ((o = i.return) && o.call(i), 0) : i.next) && !(o = o.call(i, p[1])).done) return o;
422
+ switch (i = 0, o && (p = [p[0] & 2, o.value]), p[0]) {
423
423
  case 0:
424
424
  case 1:
425
- o = l;
425
+ o = p;
426
426
  break;
427
427
  case 4:
428
- return r.label++, { value: l[1], done: !1 };
428
+ return r.label++, { value: p[1], done: !1 };
429
429
  case 5:
430
- r.label++, i = l[1], l = [0];
430
+ r.label++, i = p[1], p = [0];
431
431
  continue;
432
432
  case 7:
433
- l = r.ops.pop(), r.trys.pop();
433
+ p = r.ops.pop(), r.trys.pop();
434
434
  continue;
435
435
  default:
436
- if (o = r.trys, !(o = o.length > 0 && o[o.length - 1]) && (l[0] === 6 || l[0] === 2)) {
436
+ if (o = r.trys, !(o = o.length > 0 && o[o.length - 1]) && (p[0] === 6 || p[0] === 2)) {
437
437
  r = 0;
438
438
  continue;
439
439
  }
440
- if (l[0] === 3 && (!o || l[1] > o[0] && l[1] < o[3])) {
441
- r.label = l[1];
440
+ if (p[0] === 3 && (!o || p[1] > o[0] && p[1] < o[3])) {
441
+ r.label = p[1];
442
442
  break;
443
443
  }
444
- if (l[0] === 6 && r.label < o[1]) {
445
- r.label = o[1], o = l;
444
+ if (p[0] === 6 && r.label < o[1]) {
445
+ r.label = o[1], o = p;
446
446
  break;
447
447
  }
448
448
  if (o && r.label < o[2]) {
449
- r.label = o[2], r.ops.push(l);
449
+ r.label = o[2], r.ops.push(p);
450
450
  break;
451
451
  }
452
452
  o[2] && r.ops.pop(), r.trys.pop();
453
453
  continue;
454
454
  }
455
- l = t.call(s, r);
456
- } catch (_) {
457
- l = [6, _], i = 0;
455
+ p = t.call(s, r);
456
+ } catch (m) {
457
+ p = [6, m], i = 0;
458
458
  } finally {
459
459
  n = o = 0;
460
460
  }
461
- if (l[0] & 5) throw l[1];
462
- return { value: l[0] ? l[1] : void 0, done: !0 };
461
+ if (p[0] & 5) throw p[1];
462
+ return { value: p[0] ? p[1] : void 0, done: !0 };
463
463
  }
464
464
  }, V = /* @__PURE__ */ qs(yt), q = /* @__PURE__ */ xs(yt), kt = je, js = /* @__PURE__ */ $s(We), Hs = function(s, t) {
465
465
  return function() {
@@ -491,7 +491,7 @@ var Ge = function(s, t) {
491
491
  map: Ws,
492
492
  ap: Ks,
493
493
  chain: Ne
494
- }, Ys = /* @__PURE__ */ Qs(Pe), Zs = /* @__PURE__ */ Oe(Js), Fe = Zs, N = Ne, ae = Ne;
494
+ }, Ys = /* @__PURE__ */ Qs(Pe), Zs = /* @__PURE__ */ Oe(Js), Fe = Zs, K = Ne, ae = Ne;
495
495
  function ne(s) {
496
496
  return [s];
497
497
  }
@@ -501,7 +501,7 @@ class we extends Le(
501
501
  "Validation error"
502
502
  ) {
503
503
  }
504
- class Qe extends K(
504
+ class Qe extends W(
505
505
  "CSSVarsBoundError",
506
506
  "CSS variables are already bound"
507
507
  ) {
@@ -510,109 +510,109 @@ class Xs extends Le("DeviceStorageMethodError", (t) => ({ error: t }), (t) => [t
510
510
  }
511
511
  class er extends Le("SecureStorageMethodError", (t) => ({ error: t }), (t) => [t]) {
512
512
  }
513
- class tr extends K(
513
+ class tr extends W(
514
514
  "NotAvailableError",
515
515
  ne
516
516
  ) {
517
517
  }
518
- class qn extends K(
518
+ class qn extends W(
519
519
  "InvalidEnvError",
520
520
  ne
521
521
  ) {
522
522
  }
523
- class sr extends K(
523
+ class sr extends W(
524
524
  "FunctionNotAvailableError",
525
525
  ne
526
526
  ) {
527
527
  }
528
- class Q extends K(
528
+ class Q extends W(
529
529
  "InvalidArgumentsError",
530
530
  (t, r) => [t, { cause: r }]
531
531
  ) {
532
532
  }
533
- class ze extends K(
533
+ class ze extends W(
534
534
  "ConcurrentCallError",
535
535
  ne
536
536
  ) {
537
537
  }
538
- class rr extends K(
538
+ class rr extends W(
539
539
  "SetEmojiStatusError",
540
540
  (t) => [`Failed to set emoji status: ${t}`]
541
541
  ) {
542
542
  }
543
- class It extends K(
543
+ class It extends W(
544
544
  "AccessDeniedError",
545
545
  ne
546
546
  ) {
547
547
  }
548
- class nr extends K(
548
+ class nr extends W(
549
549
  "FullscreenFailedError",
550
550
  ne
551
551
  ) {
552
552
  }
553
- class or extends K(
553
+ class or extends W(
554
554
  "ShareMessageError",
555
555
  ne
556
556
  ) {
557
557
  }
558
- class ir extends K(
558
+ class ir extends W(
559
559
  "UnknownThemeParamsKeyError",
560
560
  (t) => [`Unknown theme params key passed: ${t}`]
561
561
  ) {
562
562
  }
563
563
  function A(s, t) {
564
- const r = F(() => D(t.version) || "100"), n = F(() => D(t.isTma)), { requires: i, returns: o } = t, u = i ? typeof i == "object" ? i : { every: [i] } : void 0, a = (m) => {
564
+ const r = F(() => U(t.version) || "100"), n = F(() => U(t.isTma)), { requires: i, returns: o } = t, u = i ? typeof i == "object" ? i : { every: [i] } : void 0, a = (_) => {
565
565
  if (!t.supports)
566
566
  return !0;
567
- const b = t.supports[m];
567
+ const b = t.supports[_];
568
568
  return oe(b.method, b.param, r());
569
- }, p = () => {
569
+ }, l = () => {
570
570
  if (!u)
571
571
  return;
572
- const [m, b] = "every" in u ? ["every", u.every] : ["some", u.some];
572
+ const [_, b] = "every" in u ? ["every", u.every] : ["some", u.some];
573
573
  for (let f = 0; f < b.length; f++) {
574
574
  const B = b[f], L = typeof B == "function" ? B() : oe(B, r()) ? void 0 : `it is unsupported in Mini Apps version ${r()}`;
575
- if (L && (m === "every" || f === b.length - 1))
575
+ if (L && (_ === "every" || f === b.length - 1))
576
576
  return L;
577
577
  }
578
- }, l = (...m) => {
578
+ }, p = (..._) => {
579
579
  for (const b in t.supports)
580
- if (t.supports[b].shouldCheck(...m) && !a(b))
580
+ if (t.supports[b].shouldCheck(..._) && !a(b))
581
581
  return `option ${b} is not supported in Mini Apps version ${r()}`;
582
- }, _ = F(() => !p()), d = F(() => r() !== "0.0"), w = F(() => t.isMounted ? t.isMounted() : !0), g = F(
583
- () => n() && d() && _() && w()
584
- ), v = (m) => {
585
- const b = new sr(m);
582
+ }, m = F(() => !l()), d = F(() => r() !== "0.0"), w = F(() => t.isMounted ? t.isMounted() : !0), g = F(
583
+ () => n() && d() && m() && w()
584
+ ), S = (_) => {
585
+ const b = new sr(_);
586
586
  return ["task", "promise"].includes(t.returns) ? V(b) : T(b);
587
- }, y = (...m) => o === "plain" ? ms(() => s(...m), (b) => b) : o === "promise" ? Hs(() => s(...m), (b) => b) : s(...m);
587
+ }, v = (..._) => o === "plain" ? ms(() => s(..._), (b) => b) : o === "promise" ? Hs(() => s(..._), (b) => b) : s(..._);
588
588
  return Object.assign(
589
- (...m) => {
589
+ (..._) => {
590
590
  var L;
591
591
  const b = "Unable to call function:";
592
592
  if (!n())
593
- return v(`${b} it can't be called outside Mini Apps`);
593
+ return S(`${b} it can't be called outside Mini Apps`);
594
594
  if (!d())
595
- return v(`${b} the SDK was not initialized. Use the SDK init() function`);
596
- const f = p();
595
+ return S(`${b} the SDK was not initialized. Use the SDK init() function`);
596
+ const f = l();
597
597
  if (f)
598
- return v(`${b} ${f}`);
599
- const B = l(...m);
598
+ return S(`${b} ${f}`);
599
+ const B = p(..._);
600
600
  if (B)
601
- return v(`${b} ${B}`);
601
+ return S(`${b} ${B}`);
602
602
  if (!w()) {
603
603
  const $ = (L = t.isMounting) != null && L.call(t) ? "mounting. Wait for the mount completion" : "unmounted. Use the mount() method";
604
- return v(`${b} the component is ${$}`);
604
+ return S(`${b} the component is ${$}`);
605
605
  }
606
- return y(...m);
606
+ return v(..._);
607
607
  },
608
608
  s,
609
609
  {
610
610
  isAvailable: g,
611
- ifAvailable(...m) {
612
- return g() ? _e(y(...m)) : ie;
611
+ ifAvailable(..._) {
612
+ return g() ? _e(v(..._)) : ie;
613
613
  }
614
614
  },
615
- u ? { isSupported: _ } : {},
615
+ u ? { isSupported: m } : {},
616
616
  t.supports ? { supports: a } : {}
617
617
  );
618
618
  }
@@ -628,9 +628,9 @@ class ke {
628
628
  initialState: o,
629
629
  isPageReload: u,
630
630
  postEvent: a,
631
- payload: p,
632
- method: l,
633
- version: _
631
+ payload: l,
632
+ method: p,
633
+ version: m
634
634
  }) {
635
635
  /**
636
636
  * Signal indicating if the component is currently mounted.
@@ -713,39 +713,39 @@ class ke {
713
713
  e(this, "unmount");
714
714
  const d = new ee({
715
715
  initialState: o,
716
- onChange(m) {
717
- r.set(m);
716
+ onChange(_) {
717
+ r.set(_);
718
718
  }
719
719
  }), w = new fe({
720
720
  initialState: o,
721
721
  isPageReload: u,
722
722
  onMounted: d.setState,
723
723
  restoreState: r.get
724
- }), g = { version: _, requires: l, isTma: t }, v = I({
724
+ }), g = { version: m, requires: p, isTma: t }, S = I({
725
725
  ...g,
726
726
  returns: "plain"
727
- }), y = I({
727
+ }), v = I({
728
728
  ...g,
729
729
  returns: "either",
730
730
  isMounted: w.isMounted
731
731
  });
732
- this.isMounted = w.isMounted, this.isSupported = z(l, _), this.state = d.state, this.setStateFp = y((m) => {
733
- const b = { ...this.state(), ...Me(m) };
732
+ this.isMounted = w.isMounted, this.isSupported = z(p, m), this.state = d.state, this.setStateFp = v((_) => {
733
+ const b = { ...this.state(), ...Me(_) };
734
734
  return d.hasDiff(b) ? c(
735
- a(l, p(b)),
736
- O(() => {
735
+ a(p, l(b)),
736
+ D(() => {
737
737
  d.setState(b);
738
738
  })
739
739
  ) : x(void 0);
740
- }), this.setState = h(this.setStateFp), this.onClickFp = v(n), this.onClick = h(this.onClickFp), this.offClickFp = v(i), this.offClick = h(this.offClickFp), this.mountFp = v(() => {
741
- const m = () => {
740
+ }), this.setState = h(this.setStateFp), this.onClickFp = S(n), this.onClick = h(this.onClickFp), this.offClickFp = S(i), this.offClick = h(this.offClickFp), this.mountFp = S(() => {
741
+ const _ = () => {
742
742
  };
743
- return c(w.mount(), de(m, m));
744
- }), this.mount = h(this.mountFp), this.unmount = w.unmount, this.stateSetters = (m) => {
745
- const b = y((f) => this.setStateFp({ [m]: f }));
743
+ return c(w.mount(), de(_, _));
744
+ }), this.mount = h(this.mountFp), this.unmount = w.unmount, this.stateSetters = (_) => {
745
+ const b = v((f) => this.setStateFp({ [_]: f }));
746
746
  return [h(b), b];
747
- }, this.stateBoolSetters = (m) => {
748
- const [, b] = this.stateSetters(m), f = y(() => b(!1)), B = y(() => b(!0));
747
+ }, this.stateBoolSetters = (_) => {
748
+ const [, b] = this.stateSetters(_), f = v(() => b(!1)), B = v(() => b(!0));
749
749
  return [
750
750
  [h(f), f],
751
751
  [h(B), B]
@@ -856,7 +856,7 @@ function C() {
856
856
  return { isTma: F(() => Pt()) };
857
857
  }
858
858
  function ue(s) {
859
- return (t) => ({ ...t, ...D(s) });
859
+ return (t) => ({ ...t, ...U(s) });
860
860
  }
861
861
  // @__NO_SIDE_EFFECTS__
862
862
  function me(s, t) {
@@ -886,13 +886,13 @@ function te(s) {
886
886
  isPageReload: lr
887
887
  });
888
888
  }
889
- const Te = /* @__PURE__ */ me("0.0"), S = ue({ version: Te });
889
+ const Te = /* @__PURE__ */ me("0.0"), y = ue({ version: Te });
890
890
  function Je(s, t) {
891
891
  return {
892
892
  ...c(
893
893
  C(),
894
894
  R,
895
- S,
895
+ y,
896
896
  te(s)
897
897
  ),
898
898
  onClick(r, n) {
@@ -929,12 +929,12 @@ class Ye {
929
929
  this.mount = (u) => {
930
930
  if (this._isMounted())
931
931
  return q(void 0);
932
- const a = D(o) ? n() : void 0;
932
+ const a = U(o) ? n() : void 0;
933
933
  return c(
934
934
  a ? q(a) : t(u),
935
- k((p) => {
935
+ k((l) => {
936
936
  this._isMounted() || Ce(() => {
937
- this._isMounted.set(!0), r == null || r(p);
937
+ this._isMounted.set(!0), r == null || r(l);
938
938
  });
939
939
  })
940
940
  );
@@ -959,7 +959,7 @@ class hr {
959
959
  onInfoReceived: o,
960
960
  offInfoReceived: u,
961
961
  isTma: a,
962
- isPageReload: p
962
+ isPageReload: l
963
963
  }) {
964
964
  /**
965
965
  * Signal indicating if biometry is available.
@@ -1048,9 +1048,9 @@ class hr {
1048
1048
  * Unmounts the component.
1049
1049
  */
1050
1050
  e(this, "unmount");
1051
- const l = (m) => {
1052
- _.setState(Ae(m));
1053
- }, _ = new ee({
1051
+ const p = (_) => {
1052
+ m.setState(Ae(_));
1053
+ }, m = new ee({
1054
1054
  initialState: {
1055
1055
  available: !1,
1056
1056
  type: "unknown",
@@ -1061,52 +1061,52 @@ class hr {
1061
1061
  },
1062
1062
  onChange: i.set
1063
1063
  }), d = new Ye({
1064
- initialState(m) {
1064
+ initialState(_) {
1065
1065
  return c(
1066
- r("web_app_biometry_get_info", "biometry_info_received", m),
1066
+ r("web_app_biometry_get_info", "biometry_info_received", _),
1067
1067
  k(Ae)
1068
1068
  );
1069
1069
  },
1070
- isPageReload: p,
1071
- onMounted(m) {
1072
- _.setState(m), o(l);
1070
+ isPageReload: l,
1071
+ onMounted(_) {
1072
+ m.setState(_), o(p);
1073
1073
  },
1074
1074
  onUnmounted() {
1075
- u(l);
1075
+ u(p);
1076
1076
  },
1077
1077
  restoreState: i.get
1078
1078
  }), w = { version: t, requires: "web_app_biometry_request_auth", isTma: a }, g = I({
1079
1079
  ...w,
1080
1080
  returns: "either"
1081
- }), v = I({
1081
+ }), S = I({
1082
1082
  ...w,
1083
1083
  returns: "task"
1084
- }), y = I({
1084
+ }), v = I({
1085
1085
  ...w,
1086
1086
  isMounted: d.isMounted,
1087
1087
  returns: "task"
1088
1088
  });
1089
- this.isAvailable = _.getter("available"), this.isMounted = d.isMounted, this.isSupported = z("web_app_biometry_request_auth", t), this.state = _.state, this.unmount = d.unmount, this.mountFp = v(d.mount), this.authenticateFp = y((m) => this.isAvailable() ? c(
1089
+ this.isAvailable = m.getter("available"), this.isMounted = d.isMounted, this.isSupported = z("web_app_biometry_request_auth", t), this.state = m.state, this.unmount = d.unmount, this.mountFp = S(d.mount), this.authenticateFp = v((_) => this.isAvailable() ? c(
1090
1090
  r("web_app_biometry_request_auth", "biometry_auth_requested", {
1091
- ...m,
1092
- params: { reason: ((m || {}).reason || "").trim() }
1091
+ ..._,
1092
+ params: { reason: ((_ || {}).reason || "").trim() }
1093
1093
  }),
1094
- k((b) => (_.setState({ token: b.token }), b))
1095
- ) : V(pt)), this.openSettingsFp = g(() => n("web_app_biometry_open_settings")), this.requestAccessFp = y((m) => c(
1094
+ k((b) => (m.setState({ token: b.token }), b))
1095
+ ) : V(pt)), this.openSettingsFp = g(() => n("web_app_biometry_open_settings")), this.requestAccessFp = v((_) => c(
1096
1096
  r("web_app_biometry_request_access", "biometry_info_received", {
1097
- ...m,
1098
- params: { reason: ((m || {}).reason || "").trim() }
1097
+ ..._,
1098
+ params: { reason: ((_ || {}).reason || "").trim() }
1099
1099
  }),
1100
- N((b) => {
1100
+ K((b) => {
1101
1101
  const f = Ae(b);
1102
- return f.available ? (_.setState(f), q(f.accessRequested)) : V(pt);
1102
+ return f.available ? (m.setState(f), q(f.accessRequested)) : V(pt);
1103
1103
  })
1104
- )), this.updateTokenFp = y((m = {}) => {
1104
+ )), this.updateTokenFp = v((_ = {}) => {
1105
1105
  var b;
1106
1106
  return c(
1107
1107
  r("web_app_biometry_update_token", "biometry_token_updated", {
1108
- ...m,
1109
- params: { token: m.token || "", reason: (b = m.reason) == null ? void 0 : b.trim() }
1108
+ ..._,
1109
+ params: { token: _.token || "", reason: (b = _.reason) == null ? void 0 : b.trim() }
1110
1110
  }),
1111
1111
  k((f) => f.status)
1112
1112
  );
@@ -1123,7 +1123,7 @@ const dr = (s, t, r) => Dt(s, t, {
1123
1123
  ...c(
1124
1124
  C(),
1125
1125
  R,
1126
- S,
1126
+ y,
1127
1127
  P,
1128
1128
  te("biometry")
1129
1129
  ),
@@ -1182,17 +1182,17 @@ class _r {
1182
1182
  restoreState: r.get,
1183
1183
  initialState: { isConfirmationEnabled: !1 },
1184
1184
  isPageReload: i
1185
- }), a = { requires: "web_app_setup_closing_behavior", isTma: n }, p = I({
1185
+ }), a = { requires: "web_app_setup_closing_behavior", isTma: n }, l = I({
1186
1186
  ...a,
1187
1187
  returns: "plain"
1188
- }), l = I({
1188
+ }), p = I({
1189
1189
  ...a,
1190
1190
  returns: "either",
1191
1191
  isMounted: u.isMounted
1192
- }), _ = (d) => d === this.isConfirmationEnabled() ? x(void 0) : (o.setState({ isConfirmationEnabled: d }), t("web_app_setup_closing_behavior", {
1192
+ }), m = (d) => d === this.isConfirmationEnabled() ? x(void 0) : (o.setState({ isConfirmationEnabled: d }), t("web_app_setup_closing_behavior", {
1193
1193
  need_confirmation: d
1194
1194
  }));
1195
- this.isConfirmationEnabled = o.getter("isConfirmationEnabled"), this.isMounted = u.isMounted, this.disableConfirmationFp = l(() => _(!1)), this.enableConfirmationFp = l(() => _(!0)), this.mountFp = p(() => {
1195
+ this.isConfirmationEnabled = o.getter("isConfirmationEnabled"), this.isMounted = u.isMounted, this.disableConfirmationFp = p(() => m(!1)), this.enableConfirmationFp = p(() => m(!0)), this.mountFp = l(() => {
1196
1196
  const d = () => {
1197
1197
  };
1198
1198
  return c(u.mount(), de(d, d));
@@ -1295,7 +1295,7 @@ class mr {
1295
1295
  o.length ? n("getStorageValues", { keys: o }, u) : q({}),
1296
1296
  k((a) => ({
1297
1297
  // Fulfill the response with probably missing keys.
1298
- ...o.reduce((p, l) => (p[l] = "", p), {}),
1298
+ ...o.reduce((l, p) => (l[p] = "", l), {}),
1299
1299
  ...it(Zt(Y(), Y()), a)
1300
1300
  }))
1301
1301
  )), this.getKeysFp = i((o) => c(
@@ -1305,7 +1305,7 @@ class mr {
1305
1305
  n("saveStorageValue", { key: o, value: u }, a),
1306
1306
  k(() => {
1307
1307
  })
1308
- )), this.clearFp = i((o) => c(this.getKeysFp(o), N(this.deleteItemFp))), this.deleteItem = h(this.deleteItemFp), this.getItem = h(this.getItemFp), this.getItems = h(this.getItemsFp), this.getKeys = h(this.getKeysFp), this.setItem = h(this.setItemFp), this.clear = h(this.clearFp);
1308
+ )), this.clearFp = i((o) => c(this.getKeysFp(o), K(this.deleteItemFp))), this.deleteItem = h(this.deleteItemFp), this.getItem = h(this.getItemFp), this.getItems = h(this.getItemsFp), this.getKeys = h(this.getKeysFp), this.setItem = h(this.setItemFp), this.clear = h(this.clearFp);
1309
1309
  }
1310
1310
  }
1311
1311
  const xe = /* @__PURE__ */ me(0);
@@ -1322,7 +1322,7 @@ const Xe = ue({
1322
1322
  invokeCustomMethod: br
1323
1323
  }), $n = new mr(c(
1324
1324
  C(),
1325
- S,
1325
+ y,
1326
1326
  Xe
1327
1327
  ));
1328
1328
  class gr {
@@ -1368,21 +1368,21 @@ class gr {
1368
1368
  requires: "web_app_device_storage_get_key",
1369
1369
  isTma: t,
1370
1370
  returns: "task"
1371
- }), u = (a, p, l) => {
1372
- const _ = i();
1371
+ }), u = (a, l, p) => {
1372
+ const m = i();
1373
1373
  return c(
1374
- r(a, ["device_storage_failed", p], {
1375
- params: { ...l, req_id: _ },
1376
- capture: (d) => "payload" in d ? d.payload.req_id === _ : !0
1374
+ r(a, ["device_storage_failed", l], {
1375
+ params: { ...p, req_id: m },
1376
+ capture: (d) => "payload" in d ? d.payload.req_id === m : !0
1377
1377
  }),
1378
- N((d) => d.event === "device_storage_failed" ? V(new Xs(d.payload.error || "UNKNOWN_ERROR")) : q(d.payload))
1378
+ K((d) => d.event === "device_storage_failed" ? V(new Xs(d.payload.error || "UNKNOWN_ERROR")) : q(d.payload))
1379
1379
  );
1380
1380
  };
1381
1381
  this.getItemFp = o((a) => c(
1382
1382
  u("web_app_device_storage_get_key", "device_storage_key_received", { key: a }),
1383
- k((p) => p.value)
1384
- )), this.setItemFp = o((a, p) => c(
1385
- u("web_app_device_storage_save_key", "device_storage_key_saved", { key: a, value: p }),
1383
+ k((l) => l.value)
1384
+ )), this.setItemFp = o((a, l) => c(
1385
+ u("web_app_device_storage_save_key", "device_storage_key_saved", { key: a, value: l }),
1386
1386
  k(() => {
1387
1387
  })
1388
1388
  )), this.deleteItemFp = o((a) => this.setItemFp(a, null)), this.clearFp = o(() => c(
@@ -1394,7 +1394,7 @@ class gr {
1394
1394
  }
1395
1395
  const At = ue({ createRequestId: Ze }), Rn = new gr(c(
1396
1396
  C(),
1397
- S,
1397
+ y,
1398
1398
  P,
1399
1399
  At
1400
1400
  ));
@@ -1406,7 +1406,7 @@ function Fr({ request: s, ...t }) {
1406
1406
  }
1407
1407
  const wr = Fr(c(
1408
1408
  C(),
1409
- S,
1409
+ y,
1410
1410
  P
1411
1411
  )), Ln = h(wr);
1412
1412
  function Cr({ request: s, ...t }) {
@@ -1425,12 +1425,12 @@ function Cr({ request: s, ...t }) {
1425
1425
  returns: "task"
1426
1426
  });
1427
1427
  }
1428
- const vr = Cr(c(
1428
+ const Sr = Cr(c(
1429
1429
  C(),
1430
1430
  P,
1431
- S
1432
- )), Pn = h(vr);
1433
- class Sr {
1431
+ y
1432
+ )), Pn = h(Sr);
1433
+ class vr {
1434
1434
  constructor({ postEvent: t, isTma: r, version: n }) {
1435
1435
  /**
1436
1436
  * Signal indicating if the component is supported.
@@ -1481,17 +1481,17 @@ class Sr {
1481
1481
  this.isSupported = z(i, n), this.impactOccurredFp = o((u) => t(i, { type: "impact", impact_style: u })), this.notificationOccurredFp = o((u) => t(i, { type: "notification", notification_type: u })), this.selectionChangedFp = o(() => t(i, { type: "selection_change" })), this.impactOccurred = h(this.impactOccurredFp), this.notificationOccurred = h(this.notificationOccurredFp), this.selectionChanged = h(this.selectionChangedFp);
1482
1482
  }
1483
1483
  }
1484
- const On = new Sr(c(
1484
+ const On = new vr(c(
1485
1485
  C(),
1486
1486
  R,
1487
- S
1487
+ y
1488
1488
  ));
1489
1489
  function yr({ postEvent: s, ...t }) {
1490
1490
  return A(() => s("web_app_add_to_home_screen"), { ...t, requires: "web_app_add_to_home_screen", returns: "either" });
1491
1491
  }
1492
1492
  const kr = yr(c(
1493
1493
  C(),
1494
- S,
1494
+ y,
1495
1495
  R
1496
1496
  )), Dn = h(kr);
1497
1497
  function Ir({ request: s, ...t }) {
@@ -1502,7 +1502,7 @@ function Ir({ request: s, ...t }) {
1502
1502
  }
1503
1503
  const Er = Ir(c(
1504
1504
  C(),
1505
- S,
1505
+ y,
1506
1506
  P
1507
1507
  )), Un = h(Er);
1508
1508
  class Ar {
@@ -1579,7 +1579,7 @@ class Ar {
1579
1579
  e(this, "restore");
1580
1580
  this.restoreFp = () => c(
1581
1581
  t(),
1582
- O(vt(() => {
1582
+ D(St(() => {
1583
1583
  }, ({ raw: r, obj: n }) => {
1584
1584
  this._state.set(n), this._raw.set(r);
1585
1585
  }))
@@ -1597,11 +1597,11 @@ const Gn = new Ar({
1597
1597
  return c(
1598
1598
  bs,
1599
1599
  ut("obj", () => c(
1600
- ve(),
1601
- O(({ tgWebAppData: s }) => s ? _e(s) : ie)
1600
+ Se(),
1601
+ D(({ tgWebAppData: s }) => s ? _e(s) : ie)
1602
1602
  )),
1603
1603
  ut("raw", jt),
1604
- O(({ obj: s, raw: t }) => c(
1604
+ D(({ obj: s, raw: t }) => c(
1605
1605
  As,
1606
1606
  ct("obj", () => s),
1607
1607
  ct("raw", () => t)
@@ -1653,26 +1653,26 @@ class xr {
1653
1653
  }), o = j(!1), u = () => {
1654
1654
  o.set(!1);
1655
1655
  };
1656
- this.isSupported = z("web_app_open_invoice", t), this.isOpened = F(o), this.openSlugFp = i((a, p) => c(
1656
+ this.isSupported = z("web_app_open_invoice", t), this.isOpened = F(o), this.openSlugFp = i((a, l) => c(
1657
1657
  this.isOpened() ? V(new ze("Invoice is already opened")) : q(void 0),
1658
- N(() => (o.set(!0), r("web_app_open_invoice", "invoice_closed", {
1659
- ...p,
1658
+ K(() => (o.set(!0), r("web_app_open_invoice", "invoice_closed", {
1659
+ ...l,
1660
1660
  params: { slug: a },
1661
- capture: (l) => a === l.slug
1661
+ capture: (p) => a === p.slug
1662
1662
  }))),
1663
- Ke((l) => (u(), l), (l) => (u(), l.status))
1664
- )), this.openUrlFp = i((a, p) => {
1665
- const { hostname: l, pathname: _ } = new URL(a, window.location.href);
1666
- if (l !== "t.me")
1667
- return V(new Q(`Link has unexpected hostname: ${l}`));
1668
- const d = _.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/);
1669
- return d ? this.openSlugFp(d[2], p) : V(new Q(
1663
+ Ke((p) => (u(), p), (p) => (u(), p.status))
1664
+ )), this.openUrlFp = i((a, l) => {
1665
+ const { hostname: p, pathname: m } = new URL(a, window.location.href);
1666
+ if (p !== "t.me")
1667
+ return V(new Q(`Link has unexpected hostname: ${p}`));
1668
+ const d = m.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/);
1669
+ return d ? this.openSlugFp(d[2], l) : V(new Q(
1670
1670
  'Expected to receive a link with a pathname in format "/invoice/{slug}" or "/${slug}"'
1671
1671
  ));
1672
1672
  }), this.openUrl = h(this.openUrlFp), this.openSlug = h(this.openSlugFp);
1673
1673
  }
1674
1674
  }
1675
- const jn = new xr(c(C(), P, S));
1675
+ const jn = new xr(c(C(), P, y));
1676
1676
  function qr({ postEvent: s, ...t }) {
1677
1677
  return A((r, n = {}) => {
1678
1678
  if (typeof r == "string")
@@ -1695,13 +1695,13 @@ const Br = qr(c(
1695
1695
  function Mr({ postEvent: s, version: t, ...r }) {
1696
1696
  return A((n) => {
1697
1697
  const i = n.toString();
1698
- return i.match(/^https:\/\/t.me\/.+/) ? oe("web_app_open_tg_link", D(t)) ? (n = new URL(n), s("web_app_open_tg_link", { path_full: n.pathname + n.search })) : (window.location.href = i, x(void 0)) : T(new Q(`"${i}" is invalid URL`));
1698
+ return i.match(/^https:\/\/t.me\/.+/) ? oe("web_app_open_tg_link", U(t)) ? (n = new URL(n), s("web_app_open_tg_link", { path_full: n.pathname + n.search })) : (window.location.href = i, x(void 0)) : T(new Q(`"${i}" is invalid URL`));
1699
1699
  }, { ...r, returns: "either" });
1700
1700
  }
1701
1701
  const xt = Mr(c(
1702
1702
  C(),
1703
1703
  R,
1704
- S
1704
+ y
1705
1705
  )), Wn = h(xt);
1706
1706
  function Tr({ openTelegramLink: s, ...t }) {
1707
1707
  return A((r, n) => s(
@@ -1796,7 +1796,7 @@ class Rr {
1796
1796
  accessRequested: !1
1797
1797
  },
1798
1798
  onChange: i.set
1799
- }), p = new Ye({
1799
+ }), l = new Ye({
1800
1800
  isPageReload: u,
1801
1801
  restoreState: i.get,
1802
1802
  onMounted: a.setState,
@@ -1806,24 +1806,24 @@ class Rr {
1806
1806
  k($r)
1807
1807
  );
1808
1808
  }
1809
- }), l = { version: t, requires: "web_app_check_location", isTma: o }, _ = I({
1810
- ...l,
1809
+ }), p = { version: t, requires: "web_app_check_location", isTma: o }, m = I({
1810
+ ...p,
1811
1811
  returns: "either"
1812
1812
  }), d = I({
1813
- ...l,
1813
+ ...p,
1814
1814
  returns: "task"
1815
1815
  }), w = I({
1816
- ...l,
1816
+ ...p,
1817
1817
  returns: "task",
1818
- isMounted: p.isMounted
1818
+ isMounted: l.isMounted
1819
1819
  });
1820
- this.isAvailable = a.getter("available"), this.isAccessRequested = a.getter("accessRequested"), this.isAccessGranted = a.getter("accessGranted"), this.isSupported = z("web_app_check_location", t), this.isMounted = p.isMounted, this.state = a.state, this.unmount = p.unmount, this.mountFp = d(p.mount), this.openSettingsFp = _(() => n("web_app_open_location_settings")), this.requestLocationFp = w((g) => c(
1820
+ this.isAvailable = a.getter("available"), this.isAccessRequested = a.getter("accessRequested"), this.isAccessGranted = a.getter("accessGranted"), this.isSupported = z("web_app_check_location", t), this.isMounted = l.isMounted, this.state = a.state, this.unmount = l.unmount, this.mountFp = d(l.mount), this.openSettingsFp = m(() => n("web_app_open_location_settings")), this.requestLocationFp = w((g) => c(
1821
1821
  r("web_app_request_location", "location_requested", g),
1822
- k((v) => {
1823
- if (!v.available)
1822
+ k((S) => {
1823
+ if (!S.available)
1824
1824
  return a.setState({ available: !1 }), null;
1825
- const { available: y, ...m } = v;
1826
- return m;
1825
+ const { available: v, ..._ } = S;
1826
+ return _;
1827
1827
  })
1828
1828
  )), this.mount = h(this.mountFp), this.openSettings = h(this.openSettingsFp), this.requestLocation = h(this.requestLocationFp);
1829
1829
  }
@@ -1831,7 +1831,7 @@ class Rr {
1831
1831
  const Nn = new Rr(c(
1832
1832
  C(),
1833
1833
  R,
1834
- S,
1834
+ y,
1835
1835
  P,
1836
1836
  te("locationManager")
1837
1837
  ));
@@ -2046,7 +2046,7 @@ class Lr {
2046
2046
  })
2047
2047
  }), i = (o, u) => {
2048
2048
  const a = n.stateGetter(o);
2049
- return F(() => a() || D(u));
2049
+ return F(() => a() || U(u));
2050
2050
  };
2051
2051
  this.bgColor = i("bgColor", t.bgColor), this.textColor = i("textColor", t.textColor), this.hasShineEffect = n.stateGetter("hasShineEffect"), this.isEnabled = n.stateGetter("isEnabled"), this.isLoaderVisible = n.stateGetter("isLoaderVisible"), this.text = n.stateGetter("text"), this.isVisible = n.stateGetter("isVisible"), this.isMounted = n.isMounted, this.state = n.state, [this.setBgColor, this.setBgColorFp] = n.stateSetters("bgColor"), [this.setTextColor, this.setTextColorFp] = n.stateSetters("textColor"), [
2052
2052
  [this.disableShineEffect, this.disableShineEffectFp],
@@ -2070,7 +2070,7 @@ function tt(s) {
2070
2070
  function Pr(s) {
2071
2071
  return c(
2072
2072
  zt(s),
2073
- O((t) => Math.sqrt(
2073
+ D((t) => Math.sqrt(
2074
2074
  [0.299, 0.587, 0.114].reduce((r, n, i) => {
2075
2075
  const o = parseInt(t.slice(1 + i * 2, 1 + (i + 1) * 2), 16);
2076
2076
  return r + o * o * n;
@@ -2191,43 +2191,43 @@ class Or {
2191
2191
  const a = new ee({
2192
2192
  initialState: {},
2193
2193
  onChange: o.set
2194
- }), p = (g) => {
2194
+ }), l = (g) => {
2195
2195
  a.setState(g.theme_params);
2196
- }, l = new fe({
2197
- initialState: () => x(D(t)),
2196
+ }, p = new fe({
2197
+ initialState: () => x(U(t)),
2198
2198
  isPageReload: u,
2199
2199
  onMounted(g) {
2200
- a.setState(g), r(p);
2200
+ a.setState(g), r(l);
2201
2201
  },
2202
2202
  onUnmounted() {
2203
- n(p);
2203
+ n(l);
2204
2204
  },
2205
2205
  restoreState: o.get
2206
- }), _ = { isTma: i, returns: "either" }, d = I(_), w = I({
2207
- ..._,
2208
- isMounted: l.isMounted
2206
+ }), m = { isTma: i, returns: "either" }, d = I(m), w = I({
2207
+ ...m,
2208
+ isMounted: p.isMounted
2209
2209
  });
2210
- this.accentTextColor = a.getter("accent_text_color"), this.bgColor = a.getter("bg_color"), this.buttonColor = a.getter("button_color"), this.buttonTextColor = a.getter("button_text_color"), this.bottomBarBgColor = a.getter("bottom_bar_bg_color"), this.destructiveTextColor = a.getter("destructive_text_color"), this.headerBgColor = a.getter("header_bg_color"), this.hintColor = a.getter("hint_color"), this.linkColor = a.getter("link_color"), this.secondaryBgColor = a.getter("secondary_bg_color"), this.sectionBgColor = a.getter("section_bg_color"), this.sectionHeaderTextColor = a.getter("section_header_text_color"), this.sectionSeparatorColor = a.getter("section_separator_color"), this.subtitleTextColor = a.getter("subtitle_text_color"), this.textColor = a.getter("text_color"), this.state = a.state, this.isMounted = l.isMounted, this.bindCssVarsFp = w((g) => {
2210
+ this.accentTextColor = a.getter("accent_text_color"), this.bgColor = a.getter("bg_color"), this.buttonColor = a.getter("button_color"), this.buttonTextColor = a.getter("button_text_color"), this.bottomBarBgColor = a.getter("bottom_bar_bg_color"), this.destructiveTextColor = a.getter("destructive_text_color"), this.headerBgColor = a.getter("header_bg_color"), this.hintColor = a.getter("hint_color"), this.linkColor = a.getter("link_color"), this.secondaryBgColor = a.getter("secondary_bg_color"), this.sectionBgColor = a.getter("section_bg_color"), this.sectionHeaderTextColor = a.getter("section_header_text_color"), this.sectionSeparatorColor = a.getter("section_separator_color"), this.subtitleTextColor = a.getter("subtitle_text_color"), this.textColor = a.getter("text_color"), this.state = a.state, this.isMounted = p.isMounted, this.bindCssVarsFp = w((g) => {
2211
2211
  if (this._isCssVarsBound())
2212
2212
  return T(new Qe());
2213
- g || (g = (m) => `--tg-theme-${Nt(m)}`);
2214
- const v = (m) => {
2213
+ g || (g = (_) => `--tg-theme-${Nt(_)}`);
2214
+ const S = (_) => {
2215
2215
  Object.entries(a.state()).forEach(([b, f]) => {
2216
- f && m(b, f);
2216
+ f && _(b, f);
2217
2217
  });
2218
- }, y = () => {
2219
- v((m, b) => {
2220
- et(g(m), b);
2218
+ }, v = () => {
2219
+ S((_, b) => {
2220
+ et(g(_), b);
2221
2221
  });
2222
2222
  };
2223
- return y(), a.state.sub(y), this._isCssVarsBound.set(!0), x(() => {
2224
- v(tt), a.state.unsub(y), this._isCssVarsBound.set(!1);
2223
+ return v(), a.state.sub(v), this._isCssVarsBound.set(!0), x(() => {
2224
+ S(tt), a.state.unsub(v), this._isCssVarsBound.set(!1);
2225
2225
  });
2226
- }), this.mountFp = d(l.mount), this.unmount = l.unmount, this.bindCssVars = h(this.bindCssVarsFp), this.mount = h(this.mountFp);
2226
+ }), this.mountFp = d(p.mount), this.unmount = p.unmount, this.bindCssVars = h(this.bindCssVarsFp), this.mount = h(this.mountFp);
2227
2227
  }
2228
2228
  //#endregion
2229
2229
  }
2230
- const Ve = /* @__PURE__ */ me({}), Se = new Or({
2230
+ const Ve = /* @__PURE__ */ me({}), ve = new Or({
2231
2231
  ...c(
2232
2232
  C(),
2233
2233
  te("themeParams")
@@ -2248,8 +2248,8 @@ function Bt(s, t, r) {
2248
2248
  }
2249
2249
  const Qn = new Lr(
2250
2250
  Bt("mainButton", "main_button_pressed", {
2251
- bgColor: F(() => Se.buttonColor() || "#2481cc"),
2252
- textColor: F(() => Se.buttonTextColor() || "#ffffff")
2251
+ bgColor: F(() => ve.buttonColor() || "#2481cc"),
2252
+ textColor: F(() => ve.buttonTextColor() || "#ffffff")
2253
2253
  })
2254
2254
  );
2255
2255
  class Dr {
@@ -2261,7 +2261,7 @@ class Dr {
2261
2261
  isTma: o,
2262
2262
  theme: u,
2263
2263
  onVisibilityChanged: a,
2264
- offVisibilityChanged: p
2264
+ offVisibilityChanged: l
2265
2265
  }) {
2266
2266
  //#region Other properties.
2267
2267
  /**
@@ -2431,9 +2431,9 @@ class Dr {
2431
2431
  * @see readyFp
2432
2432
  */
2433
2433
  e(this, "ready");
2434
- const l = (f) => {
2434
+ const p = (f) => {
2435
2435
  w.setState({ isActive: f.is_visible });
2436
- }, _ = (f) => {
2436
+ }, m = (f) => {
2437
2437
  [
2438
2438
  [this.headerColor, "web_app_set_header_color"],
2439
2439
  [this.bgColor, "web_app_set_background_color"],
@@ -2441,8 +2441,8 @@ class Dr {
2441
2441
  ].forEach(([B, L]) => {
2442
2442
  const $ = B();
2443
2443
  if (!Ie($) && (L !== "web_app_set_header_color" || !["bg_color", "secondary_bg_color"].includes($))) {
2444
- const U = f[$];
2445
- U && i(L, { color: U });
2444
+ const G = f[$];
2445
+ G && i(L, { color: G });
2446
2446
  }
2447
2447
  });
2448
2448
  }, d = new fe({
@@ -2456,10 +2456,10 @@ class Dr {
2456
2456
  },
2457
2457
  isPageReload: r,
2458
2458
  onMounted: (f) => {
2459
- a(l), u.sub(_), w.setState(f);
2459
+ a(p), u.sub(m), w.setState(f);
2460
2460
  },
2461
2461
  onUnmounted() {
2462
- p(l), u.unsub(_);
2462
+ l(p), u.unsub(m);
2463
2463
  },
2464
2464
  restoreState: t.get
2465
2465
  });
@@ -2478,47 +2478,47 @@ class Dr {
2478
2478
  onChange: t.set
2479
2479
  });
2480
2480
  this.state = w.state;
2481
- const g = (f) => Ie(f) ? f : D(u)[f], v = (f) => F(() => g(f()));
2481
+ const g = (f) => Ie(f) ? f : U(u)[f], S = (f) => F(() => g(f()));
2482
2482
  this.isActive = w.getter("isActive"), this.isSupported = F(() => [
2483
2483
  "web_app_set_header_color",
2484
2484
  "web_app_set_background_color",
2485
2485
  "web_app_set_bottom_bar_color"
2486
- ].some((f) => oe(f, D(n))));
2487
- const y = j(!1);
2488
- this.isCssVarsBound = F(y), this.bindCssVarsFp = A((f) => {
2489
- if (y())
2486
+ ].some((f) => oe(f, U(n))));
2487
+ const v = j(!1);
2488
+ this.isCssVarsBound = F(v), this.bindCssVarsFp = A((f) => {
2489
+ if (v())
2490
2490
  return T(new Qe());
2491
2491
  const [B, L] = Re(() => {
2492
- y.set(!1);
2493
- }), $ = (U, G) => {
2494
- const H = () => {
2495
- et(U, G() || null);
2492
+ v.set(!1);
2493
+ }), $ = (G, O) => {
2494
+ const N = () => {
2495
+ et(G, O() || null);
2496
2496
  };
2497
- H(), B(G.sub(H), tt.bind(null, U));
2497
+ N(), B(O.sub(N), tt.bind(null, G));
2498
2498
  };
2499
- return f || (f = (U) => `--tg-${ht(U)}`), $(f("bgColor"), this.bgColorRgb), $(f("bottomBarColor"), this.bottomBarColorRgb), $(f("headerColor"), this.headerColorRgb), y.set(!0), x(L);
2499
+ return f || (f = (G) => `--tg-${ht(G)}`), $(f("bgColor"), this.bgColorRgb), $(f("bottomBarColor"), this.bottomBarColorRgb), $(f("headerColor"), this.headerColorRgb), v.set(!0), x(L);
2500
2500
  }, { isTma: o, returns: "either", isMounted: this.isMounted }), this.bindCssVars = h(this.bindCssVarsFp);
2501
- const m = (f) => {
2502
- const B = w.getter(f), L = v(B), $ = {
2501
+ const _ = (f) => {
2502
+ const B = w.getter(f), L = S(B), $ = {
2503
2503
  headerColor: "web_app_set_header_color",
2504
2504
  bgColor: "web_app_set_background_color",
2505
2505
  bottomBarColor: "web_app_set_bottom_bar_color"
2506
- }[f], U = A(
2507
- (G) => {
2508
- if (G === B())
2506
+ }[f], G = A(
2507
+ (O) => {
2508
+ if (O === B())
2509
2509
  return x(void 0);
2510
- if ($ === "web_app_set_header_color" && (G === "bg_color" || G === "secondary_bg_color"))
2510
+ if ($ === "web_app_set_header_color" && (O === "bg_color" || O === "secondary_bg_color"))
2511
2511
  return c(
2512
- i("web_app_set_header_color", { color_key: G }),
2513
- O(() => {
2514
- w.setState({ [f]: G });
2512
+ i("web_app_set_header_color", { color_key: O }),
2513
+ D(() => {
2514
+ w.setState({ [f]: O });
2515
2515
  })
2516
2516
  );
2517
- const H = g(G);
2517
+ const N = g(O);
2518
2518
  return c(
2519
- H ? i($, { color: H }) : T(new ir(G)),
2520
- O(() => {
2521
- w.setState({ [f]: H });
2519
+ N ? i($, { color: N }) : T(new ir(O)),
2520
+ D(() => {
2521
+ w.setState({ [f]: O });
2522
2522
  })
2523
2523
  );
2524
2524
  },
@@ -2537,24 +2537,24 @@ class Dr {
2537
2537
  } : void 0
2538
2538
  }
2539
2539
  );
2540
- return [B, L, h(U), U];
2540
+ return [B, L, h(G), G];
2541
2541
  };
2542
2542
  [
2543
2543
  this.bgColor,
2544
2544
  this.bgColorRgb,
2545
2545
  this.setBgColor,
2546
2546
  this.setBgColorFp
2547
- ] = m("bgColor"), [
2547
+ ] = _("bgColor"), [
2548
2548
  this.headerColor,
2549
2549
  this.headerColorRgb,
2550
2550
  this.setHeaderColor,
2551
2551
  this.setHeaderColorFp
2552
- ] = m("headerColor"), [
2552
+ ] = _("headerColor"), [
2553
2553
  this.bottomBarColor,
2554
2554
  this.bottomBarColorRgb,
2555
2555
  this.setBottomBarColor,
2556
2556
  this.setBottomBarColorFp
2557
- ] = m("bottomBarColor");
2557
+ ] = _("bottomBarColor");
2558
2558
  const b = I({ isTma: o, returns: "either" });
2559
2559
  this.closeFp = b((f) => i("web_app_close", { return_back: f })), this.close = h(this.closeFp), this.readyFp = b(() => i("web_app_ready")), this.ready = h(this.readyFp);
2560
2560
  }
@@ -2564,7 +2564,7 @@ const Ur = new Dr({
2564
2564
  ...c(
2565
2565
  C(),
2566
2566
  R,
2567
- S,
2567
+ y,
2568
2568
  te("miniApp")
2569
2569
  ),
2570
2570
  offVisibilityChanged(s) {
@@ -2573,7 +2573,7 @@ const Ur = new Dr({
2573
2573
  onVisibilityChanged(s) {
2574
2574
  Z("visibility_changed", s);
2575
2575
  },
2576
- theme: Se.state
2576
+ theme: ve.state
2577
2577
  });
2578
2578
  function Gr(s) {
2579
2579
  const t = s.message.trim(), r = (s.title || "").trim(), n = s.buttons || [];
@@ -2592,10 +2592,10 @@ function Gr(s) {
2592
2592
  if (a.length > 64)
2593
2593
  return T(new Q(`Button with index ${o} has invalid id: ${a}`));
2594
2594
  if (!u.type || u.type === "default" || u.type === "destructive") {
2595
- const p = u.text.trim();
2596
- if (!p || p.length > 64)
2597
- return T(new Q(`Button with index ${o} has invalid text: ${p}`));
2598
- i.push({ type: u.type, text: p, id: a });
2595
+ const l = u.text.trim();
2596
+ if (!l || l.length > 64)
2597
+ return T(new Q(`Button with index ${o} has invalid text: ${l}`));
2598
+ i.push({ type: u.type, text: l, id: a });
2599
2599
  } else
2600
2600
  i.push({ type: u.type, id: a });
2601
2601
  }
@@ -2652,18 +2652,18 @@ class jr {
2652
2652
  this.isSupported = z("web_app_open_popup", t), this.isOpened = F(i), this.showFp = u((a) => c(
2653
2653
  this.isOpened() ? V(new ze("A popup is already opened")) : q(void 0),
2654
2654
  ae(() => kt(Gr(a))),
2655
- N((p) => (i.set(!0), n("web_app_open_popup", "popup_closed", {
2655
+ K((l) => (i.set(!0), n("web_app_open_popup", "popup_closed", {
2656
2656
  ...a,
2657
- params: p
2657
+ params: l
2658
2658
  }))),
2659
2659
  Ke(
2660
- (p) => (o(), p),
2661
- (p) => (o(), p.button_id)
2660
+ (l) => (o(), l),
2661
+ (l) => (o(), l.button_id)
2662
2662
  )
2663
2663
  )), this.show = h(this.showFp);
2664
2664
  }
2665
2665
  }
2666
- const zn = new jr(c(C(), P, S));
2666
+ const zn = new jr(c(C(), P, y));
2667
2667
  function Hr({ request: s, ...t }) {
2668
2668
  return A((r) => c(
2669
2669
  s("web_app_request_phone", "phone_requested", r),
@@ -2672,7 +2672,7 @@ function Hr({ request: s, ...t }) {
2672
2672
  }
2673
2673
  const Mt = Hr(c(
2674
2674
  C(),
2675
- S,
2675
+ y,
2676
2676
  P
2677
2677
  )), Jn = h(Mt);
2678
2678
  function Wr({
@@ -2686,12 +2686,12 @@ function Wr({
2686
2686
  timeout: (u || {}).timeout || 5e3
2687
2687
  }),
2688
2688
  ae((a) => {
2689
- const p = Be(Y(), a);
2690
- if (!p.success)
2691
- return V(new we(a, p.issues));
2692
- if (!p.output)
2689
+ const l = Be(Y(), a);
2690
+ if (!l.success)
2691
+ return V(new we(a, l.issues));
2692
+ if (!l.output)
2693
2693
  return q(void 0);
2694
- const l = Be(
2694
+ const p = Be(
2695
2695
  Jt(
2696
2696
  at({
2697
2697
  contact: Yt(at({
@@ -2702,15 +2702,15 @@ function Wr({
2702
2702
  })),
2703
2703
  auth_date: dt(
2704
2704
  Y(),
2705
- ft((_) => new Date(Number(_) * 1e3)),
2705
+ ft((m) => new Date(Number(m) * 1e3)),
2706
2706
  _t()
2707
2707
  ),
2708
2708
  hash: Y()
2709
2709
  })
2710
2710
  ),
2711
- p.output
2711
+ l.output
2712
2712
  );
2713
- return l.success ? q({ raw: p.output, parsed: l.output }) : V(new we(p.output, l.issues));
2713
+ return p.success ? q({ raw: l.output, parsed: p.output }) : V(new we(l.output, p.issues));
2714
2714
  })
2715
2715
  ), i = (u) => c(
2716
2716
  n(u),
@@ -2722,15 +2722,15 @@ function Wr({
2722
2722
  (a) => x(a)
2723
2723
  )
2724
2724
  ), o = (u) => qe(
2725
- async (a, p, l) => {
2726
- let _ = 50;
2727
- for (; !l.isRejected; ) {
2728
- const d = await i(l)();
2725
+ async (a, l, p) => {
2726
+ let m = 50;
2727
+ for (; !p.isRejected; ) {
2728
+ const d = await i(p)();
2729
2729
  if (d._tag === "Left")
2730
- return p(d.left);
2730
+ return l(d.left);
2731
2731
  if (d.right)
2732
2732
  return a(d.right);
2733
- await new Promise((w) => setTimeout(w, _)), _ += 50;
2733
+ await new Promise((w) => setTimeout(w, m)), m += 50;
2734
2734
  }
2735
2735
  },
2736
2736
  u
@@ -2738,9 +2738,9 @@ function Wr({
2738
2738
  return A((u) => qe.fn((a) => c(
2739
2739
  // Try to get the requested contact. Probably, we already requested it before.
2740
2740
  i(a),
2741
- N((p) => p ? q(p) : c(
2741
+ K((l) => l ? q(l) : c(
2742
2742
  t(a),
2743
- ae((l) => l === "sent" ? o(a) : V(new It("User denied access")))
2743
+ ae((p) => p === "sent" ? o(a) : V(new It("User denied access")))
2744
2744
  ))
2745
2745
  ), u), { ...r, returns: "task", requires: "web_app_request_phone" });
2746
2746
  }
@@ -2751,10 +2751,10 @@ function Kr({ requestContact: s, ...t }) {
2751
2751
  );
2752
2752
  }
2753
2753
  const Tt = Wr({
2754
- ...c(C(), Xe, S),
2754
+ ...c(C(), Xe, y),
2755
2755
  requestPhoneAccess: Mt
2756
2756
  }), Yn = h(Tt), Nr = Kr({
2757
- ...c(C(), S),
2757
+ ...c(C(), y),
2758
2758
  requestContact(s) {
2759
2759
  return c(
2760
2760
  Tt(s),
@@ -2770,7 +2770,7 @@ function Qr({ request: s, ...t }) {
2770
2770
  }
2771
2771
  const zr = Qr(c(
2772
2772
  C(),
2773
- S,
2773
+ y,
2774
2774
  P
2775
2775
  )), Xn = h(zr);
2776
2776
  class Jr {
@@ -2860,10 +2860,10 @@ class Jr {
2860
2860
  * @see openFp
2861
2861
  */
2862
2862
  e(this, "open");
2863
- const u = { version: t, requires: "web_app_open_scan_qr_popup", isTma: i }, a = I({ ...u, returns: "either" }), p = I({ ...u, returns: "task" }), l = j(!1), _ = () => {
2864
- l.set(!1);
2863
+ const u = { version: t, requires: "web_app_open_scan_qr_popup", isTma: i }, a = I({ ...u, returns: "either" }), l = I({ ...u, returns: "task" }), p = j(!1), m = () => {
2864
+ p.set(!1);
2865
2865
  };
2866
- this.isSupported = z("web_app_open_scan_qr_popup", t), this.isOpened = F(l), this.captureFp = p((d) => {
2866
+ this.isSupported = z("web_app_open_scan_qr_popup", t), this.isOpened = F(p), this.captureFp = l((d) => {
2867
2867
  let w;
2868
2868
  return c(
2869
2869
  this.openFp({
@@ -2874,22 +2874,31 @@ class Jr {
2874
2874
  }),
2875
2875
  k(() => w)
2876
2876
  );
2877
- }), this.closeFp = a(() => c(o("web_app_close_scan_qr_popup"), O(_))), this.openFp = p((d) => c(
2878
- this.isOpened() ? V(new ze("The QR Scanner is already opened")) : async () => o("web_app_open_scan_qr_popup", { text: d.text }),
2877
+ }), this.closeFp = a(() => c(o("web_app_close_scan_qr_popup"), D(m))), this.openFp = l((d) => c(
2878
+ p() ? V(new ze("The QR Scanner is already opened")) : async () => o("web_app_open_scan_qr_popup", { text: d.text }),
2879
2879
  ae(() => {
2880
- const [w, g] = Re(), v = (y) => (g(), y);
2880
+ p.set(!0);
2881
+ const [w, g] = Re(), S = (v) => (g(), p.set(!1), v);
2881
2882
  return c(
2882
- qe((y) => {
2883
- w(r(y), n(d.onCaptured));
2883
+ qe((v) => {
2884
+ w(
2885
+ // The scanner was closed externally.
2886
+ r(v),
2887
+ // The scanner was closed internally.
2888
+ p.sub((_) => {
2889
+ _ || v();
2890
+ }),
2891
+ n(d.onCaptured)
2892
+ );
2884
2893
  }, d),
2885
- Ke(v, v)
2894
+ Ke(S, S)
2886
2895
  );
2887
2896
  })
2888
2897
  )), this.open = h(this.openFp), this.capture = h(this.captureFp), this.close = h(this.closeFp);
2889
2898
  }
2890
2899
  }
2891
2900
  const eo = new Jr({
2892
- ...c(C(), R, S),
2901
+ ...c(C(), R, y),
2893
2902
  onClosed(s) {
2894
2903
  return Z("scan_qr_popup_closed", s);
2895
2904
  },
@@ -3146,7 +3155,7 @@ class Yr {
3146
3155
  })
3147
3156
  }), i = (o, u) => {
3148
3157
  const a = n.stateGetter(o);
3149
- return F(() => a() || D(u));
3158
+ return F(() => a() || U(u));
3150
3159
  };
3151
3160
  this.isSupported = z("web_app_setup_secondary_button", r.version), this.bgColor = i("bgColor", t.bgColor), this.textColor = i("textColor", t.textColor), this.position = n.stateGetter("position"), this.hasShineEffect = n.stateGetter("hasShineEffect"), this.isEnabled = n.stateGetter("isEnabled"), this.isLoaderVisible = n.stateGetter("isLoaderVisible"), this.text = n.stateGetter("text"), this.isVisible = n.stateGetter("isVisible"), this.isMounted = n.isMounted, this.state = n.state, [this.setPosition, this.setPositionFp] = n.stateSetters("position"), [this.setBgColor, this.setBgColorFp] = n.stateSetters("bgColor"), [this.setTextColor, this.setTextColorFp] = n.stateSetters("textColor"), [
3152
3161
  [this.disableShineEffect, this.disableShineEffectFp],
@@ -3164,7 +3173,7 @@ class Yr {
3164
3173
  const to = new Yr(
3165
3174
  Bt("secondaryButton", "secondary_button_pressed", {
3166
3175
  bgColor: F(() => Ur.bottomBarColorRgb() || "#000000"),
3167
- textColor: F(() => Se.buttonColor() || "#2481cc")
3176
+ textColor: F(() => ve.buttonColor() || "#2481cc")
3168
3177
  })
3169
3178
  );
3170
3179
  class Zr {
@@ -3219,24 +3228,24 @@ class Zr {
3219
3228
  requires: "web_app_secure_storage_get_key",
3220
3229
  isTma: t,
3221
3230
  returns: "task"
3222
- }), u = (a, p, l) => {
3223
- const _ = i();
3231
+ }), u = (a, l, p) => {
3232
+ const m = i();
3224
3233
  return c(
3225
- r(a, ["secure_storage_failed", p], {
3226
- params: { ...l, req_id: _ },
3227
- capture: (d) => "payload" in d ? d.payload.req_id === _ : !0
3234
+ r(a, ["secure_storage_failed", l], {
3235
+ params: { ...p, req_id: m },
3236
+ capture: (d) => "payload" in d ? d.payload.req_id === m : !0
3228
3237
  }),
3229
- N((d) => d.event === "secure_storage_failed" ? V(new er(d.payload.error || "UNKNOWN_ERROR")) : q(d.payload))
3238
+ K((d) => d.event === "secure_storage_failed" ? V(new er(d.payload.error || "UNKNOWN_ERROR")) : q(d.payload))
3230
3239
  );
3231
3240
  };
3232
3241
  this.getItemFp = o((a) => c(
3233
3242
  u("web_app_secure_storage_get_key", "secure_storage_key_received", { key: a }),
3234
- k((p) => ({
3235
- value: p.value,
3236
- canRestore: !!p.can_restore
3243
+ k((l) => ({
3244
+ value: l.value,
3245
+ canRestore: !!l.can_restore
3237
3246
  }))
3238
- )), this.setItemFp = o((a, p) => c(
3239
- u("web_app_secure_storage_save_key", "secure_storage_key_saved", { key: a, value: p }),
3247
+ )), this.setItemFp = o((a, l) => c(
3248
+ u("web_app_secure_storage_save_key", "secure_storage_key_saved", { key: a, value: l }),
3240
3249
  k(() => {
3241
3250
  })
3242
3251
  )), this.deleteItemFp = o((a) => this.setItemFp(a, null)), this.clearFp = o(() => c(
@@ -3245,13 +3254,13 @@ class Zr {
3245
3254
  })
3246
3255
  )), this.restoreItemFp = o((a) => c(
3247
3256
  u("web_app_secure_storage_restore_key", "secure_storage_key_restored", { key: a }),
3248
- k((p) => p.value)
3257
+ k((l) => l.value)
3249
3258
  )), this.getItem = h(this.getItemFp), this.setItem = h(this.setItemFp), this.deleteItem = h(this.deleteItemFp), this.clear = h(this.clearFp), this.restoreItem = h(this.restoreItemFp);
3250
3259
  }
3251
3260
  }
3252
3261
  const so = new Zr(c(
3253
3262
  C(),
3254
- S,
3263
+ y,
3255
3264
  P,
3256
3265
  At
3257
3266
  ));
@@ -3400,38 +3409,38 @@ class en {
3400
3409
  onChange(g) {
3401
3410
  r.set(g);
3402
3411
  }
3403
- }), p = new fe({
3412
+ }), l = new fe({
3404
3413
  initialState: u,
3405
3414
  isPageReload: i,
3406
3415
  onMounted: a.setState,
3407
3416
  restoreState: r.get
3408
- }), l = { requires: "web_app_setup_swipe_behavior", isTma: n, version: o }, _ = I({
3409
- ...l,
3417
+ }), p = { requires: "web_app_setup_swipe_behavior", isTma: n, version: o }, m = I({
3418
+ ...p,
3410
3419
  returns: "plain"
3411
3420
  }), d = I({
3412
- ...l,
3413
- isMounted: p.isMounted,
3421
+ ...p,
3422
+ isMounted: l.isMounted,
3414
3423
  returns: "either"
3415
3424
  }), w = (g) => {
3416
- const v = { isVerticalEnabled: g };
3417
- return a.hasDiff(v) ? c(
3425
+ const S = { isVerticalEnabled: g };
3426
+ return a.hasDiff(S) ? c(
3418
3427
  t("web_app_setup_swipe_behavior", { allow_vertical_swipe: g }),
3419
- O(() => {
3420
- a.setState(v);
3428
+ D(() => {
3429
+ a.setState(S);
3421
3430
  })
3422
3431
  ) : x(void 0);
3423
3432
  };
3424
- this.isSupported = z("web_app_setup_swipe_behavior", o), this.isVerticalEnabled = a.getter("isVerticalEnabled"), this.isMounted = p.isMounted, this.disableVerticalFp = d(() => w(!1)), this.enableVerticalFp = d(() => w(!0)), this.mountFp = _(() => {
3433
+ this.isSupported = z("web_app_setup_swipe_behavior", o), this.isVerticalEnabled = a.getter("isVerticalEnabled"), this.isMounted = l.isMounted, this.disableVerticalFp = d(() => w(!1)), this.enableVerticalFp = d(() => w(!0)), this.mountFp = m(() => {
3425
3434
  const g = () => {
3426
3435
  };
3427
- return c(p.mount(), de(g, g));
3428
- }), this.unmount = p.unmount, this.disableVertical = h(this.disableVerticalFp), this.enableVertical = h(this.enableVerticalFp), this.mount = h(this.mountFp);
3436
+ return c(l.mount(), de(g, g));
3437
+ }), this.unmount = l.unmount, this.disableVertical = h(this.disableVerticalFp), this.enableVertical = h(this.enableVerticalFp), this.mount = h(this.mountFp);
3429
3438
  }
3430
3439
  }
3431
3440
  const no = new en(c(
3432
3441
  C(),
3433
3442
  R,
3434
- S,
3443
+ y,
3435
3444
  te("swipeBehavior")
3436
3445
  ));
3437
3446
  async function oo(s) {
@@ -3456,18 +3465,18 @@ function tn({ request: s, ...t }) {
3456
3465
  "file_download_requested",
3457
3466
  { ...i, params: { url: r, file_name: n } }
3458
3467
  ),
3459
- N((o) => o.status === "downloading" ? q(void 0) : V(new It("User denied the action")))
3468
+ K((o) => o.status === "downloading" ? q(void 0) : V(new It("User denied the action")))
3460
3469
  ), { ...t, requires: "web_app_request_file_download", returns: "task" });
3461
3470
  }
3462
3471
  const sn = tn(c(
3463
3472
  C(),
3464
3473
  P,
3465
- S
3474
+ y
3466
3475
  )), io = h(sn);
3467
3476
  function rn({ invokeCustomMethod: s, ...t }) {
3468
3477
  return A((r) => c(
3469
3478
  s("getCurrentTime", {}, r),
3470
- N((n) => {
3479
+ K((n) => {
3471
3480
  const i = Be(
3472
3481
  dt(mt(), ts(), ft((o) => new Date(o * 1e3)), _t()),
3473
3482
  n
@@ -3479,7 +3488,7 @@ function rn({ invokeCustomMethod: s, ...t }) {
3479
3488
  const nn = rn(c(
3480
3489
  C(),
3481
3490
  Xe,
3482
- S
3491
+ y
3483
3492
  )), ao = h(nn);
3484
3493
  function on({ postEvent: s, ...t }) {
3485
3494
  return A(() => s("web_app_hide_keyboard"), { ...t, returns: "either", requires: "web_app_hide_keyboard" });
@@ -3487,7 +3496,7 @@ function on({ postEvent: s, ...t }) {
3487
3496
  const an = on(c(
3488
3497
  C(),
3489
3498
  R,
3490
- S
3499
+ y
3491
3500
  )), uo = h(an);
3492
3501
  function un({ request: s, createRequestId: t, ...r }) {
3493
3502
  return A((n) => {
@@ -3505,7 +3514,7 @@ function un({ request: s, createRequestId: t, ...r }) {
3505
3514
  const cn = un({
3506
3515
  ...c(
3507
3516
  C(),
3508
- S,
3517
+ y,
3509
3518
  P
3510
3519
  ),
3511
3520
  createRequestId: Ze
@@ -3519,8 +3528,8 @@ function pn(s) {
3519
3528
  if (u === "Android")
3520
3529
  t.androidVersion = a;
3521
3530
  else if (u === "SDK") {
3522
- const p = parseInt(a, 10);
3523
- p && (t.sdkVersion = p);
3531
+ const l = parseInt(a, 10);
3532
+ l && (t.sdkVersion = l);
3524
3533
  } else a ? (t.manufacturer = u, t.model = a) : t.performanceClass = u;
3525
3534
  });
3526
3535
  }
@@ -3548,13 +3557,13 @@ function dn({ request: s, ...t }) {
3548
3557
  params: { id: r }
3549
3558
  }
3550
3559
  ),
3551
- N((i) => i.event === "prepared_message_failed" ? V(new or(i.payload.error)) : q(void 0))
3560
+ K((i) => i.event === "prepared_message_failed" ? V(new or(i.payload.error)) : q(void 0))
3552
3561
  ), { ...t, requires: "web_app_send_prepared_message", returns: "task" });
3553
3562
  }
3554
3563
  const fn = dn(c(
3555
3564
  C(),
3556
3565
  P,
3557
- S
3566
+ y
3558
3567
  )), ho = h(fn);
3559
3568
  function _n({ postEvent: s, ...t }) {
3560
3569
  return A((r, n = {}) => s("web_app_share_to_story", {
@@ -3566,7 +3575,7 @@ function _n({ postEvent: s, ...t }) {
3566
3575
  const mn = _n(c(
3567
3576
  C(),
3568
3577
  R,
3569
- S
3578
+ y
3570
3579
  )), fo = h(mn), $e = /* @__PURE__ */ me(!1);
3571
3580
  function bn({ isInlineMode: s, postEvent: t, ...r }) {
3572
3581
  return A((n, i) => t("web_app_switch_inline_query", {
@@ -3575,7 +3584,7 @@ function bn({ isInlineMode: s, postEvent: t, ...r }) {
3575
3584
  }), {
3576
3585
  ...r,
3577
3586
  requires: {
3578
- every: ["web_app_switch_inline_query", () => D(s) ? void 0 : "The application must be launched in the inline mode"]
3587
+ every: ["web_app_switch_inline_query", () => U(s) ? void 0 : "The application must be launched in the inline mode"]
3579
3588
  },
3580
3589
  returns: "either"
3581
3590
  });
@@ -3584,7 +3593,7 @@ const gn = bn({
3584
3593
  ...c(
3585
3594
  C(),
3586
3595
  R,
3587
- S
3596
+ y
3588
3597
  ),
3589
3598
  isInlineMode: $e
3590
3599
  }), _o = h(gn);
@@ -3597,15 +3606,15 @@ class Fn {
3597
3606
  onViewportChanged: o,
3598
3607
  onFullscreenChanged: u,
3599
3608
  offContentSafeAreaInsetsChanged: a,
3600
- offFullscreenChanged: p,
3601
- offSafeAreaInsetsChanged: l,
3602
- offViewportChanged: _,
3609
+ offFullscreenChanged: l,
3610
+ offSafeAreaInsetsChanged: p,
3611
+ offViewportChanged: m,
3603
3612
  request: d,
3604
3613
  isViewportStable: w,
3605
3614
  isFullscreen: g,
3606
- isTma: v,
3607
- version: y,
3608
- postEvent: m
3615
+ isTma: S,
3616
+ version: v,
3617
+ postEvent: _
3609
3618
  }) {
3610
3619
  //#region Other properties.
3611
3620
  /**
@@ -3816,13 +3825,13 @@ class Fn {
3816
3825
  f.setState({ isFullscreen: E.is_fullscreen });
3817
3826
  }, $ = (E) => {
3818
3827
  f.setState({ safeAreaInsets: E });
3819
- }, U = (E) => {
3828
+ }, G = (E) => {
3820
3829
  f.setState({ contentSafeAreaInsets: E });
3821
- }, G = new Ye({
3830
+ }, O = new Ye({
3822
3831
  initialState(E) {
3823
3832
  const se = (J) => () => {
3824
- const [X, W] = J === "safe-area" ? ["web_app_request_safe_area", "safe_area_changed"] : ["web_app_request_content_safe_area", "content_safe_area_changed"];
3825
- return oe(X, D(y)) ? d(X, W, E) : q({ top: 0, left: 0, right: 0, bottom: 0 });
3833
+ const [X, H] = J === "safe-area" ? ["web_app_request_safe_area", "safe_area_changed"] : ["web_app_request_content_safe_area", "content_safe_area_changed"];
3834
+ return oe(X, U(v)) ? d(X, H, E) : q({ top: 0, left: 0, right: 0, bottom: 0 });
3826
3835
  }, M = (J) => () => typeof J == "boolean" ? q(J) : kt(J());
3827
3836
  return c(
3828
3837
  Ys,
@@ -3838,33 +3847,33 @@ class Fn {
3838
3847
  width: window.innerWidth
3839
3848
  }) : c(
3840
3849
  d("web_app_request_viewport", "viewport_changed", E),
3841
- k((W) => ({
3850
+ k((H) => ({
3842
3851
  ...X,
3843
- height: W.height,
3844
- isExpanded: W.is_expanded,
3845
- stableHeight: W.is_state_stable ? W.height : 0,
3846
- width: W.width
3852
+ height: H.height,
3853
+ isExpanded: H.is_expanded,
3854
+ stableHeight: H.is_state_stable ? H.height : 0,
3855
+ width: H.width
3847
3856
  }))
3848
3857
  ))
3849
3858
  );
3850
3859
  },
3851
3860
  isPageReload: r,
3852
3861
  onMounted(E) {
3853
- o(B), u(L), i($), n(U), f.setState(E);
3862
+ o(B), u(L), i($), n(G), f.setState(E);
3854
3863
  },
3855
3864
  onUnmounted() {
3856
- _(B), p(L), l($), a(U);
3865
+ m(B), l(L), p($), a(G);
3857
3866
  },
3858
3867
  restoreState: t.get
3859
- }), H = (E) => F(() => this.safeAreaInsets()[E]), be = (E) => F(() => this.contentSafeAreaInsets()[E]);
3860
- this.state = f.state, this.height = f.getter("height"), this.stableHeight = f.getter("stableHeight"), this.width = f.getter("width"), this.isExpanded = f.getter("isExpanded"), this.safeAreaInsets = f.getter("safeAreaInsets"), this.safeAreaInsetTop = H("top"), this.safeAreaInsetBottom = H("bottom"), this.safeAreaInsetLeft = H("left"), this.safeAreaInsetRight = H("right"), this.contentSafeAreaInsets = f.getter("contentSafeAreaInsets"), this.contentSafeAreaInsetTop = be("top"), this.contentSafeAreaInsetBottom = be("bottom"), this.contentSafeAreaInsetLeft = be("left"), this.contentSafeAreaInsetRight = be("right");
3861
- const Vt = I({ isTma: v, returns: "task" }), st = I({
3862
- isTma: v,
3868
+ }), N = (E) => F(() => this.safeAreaInsets()[E]), be = (E) => F(() => this.contentSafeAreaInsets()[E]);
3869
+ this.state = f.state, this.height = f.getter("height"), this.stableHeight = f.getter("stableHeight"), this.width = f.getter("width"), this.isExpanded = f.getter("isExpanded"), this.safeAreaInsets = f.getter("safeAreaInsets"), this.safeAreaInsetTop = N("top"), this.safeAreaInsetBottom = N("bottom"), this.safeAreaInsetLeft = N("left"), this.safeAreaInsetRight = N("right"), this.contentSafeAreaInsets = f.getter("contentSafeAreaInsets"), this.contentSafeAreaInsetTop = be("top"), this.contentSafeAreaInsetBottom = be("bottom"), this.contentSafeAreaInsetLeft = be("left"), this.contentSafeAreaInsetRight = be("right");
3870
+ const Vt = I({ isTma: S, returns: "task" }), st = I({
3871
+ isTma: S,
3863
3872
  returns: "either"
3864
3873
  }), $t = I({
3865
- isTma: v,
3874
+ isTma: S,
3866
3875
  requires: "web_app_request_fullscreen",
3867
- version: y,
3876
+ version: v,
3868
3877
  returns: "task"
3869
3878
  }), rt = (E) => $t((se) => c(
3870
3879
  d(
@@ -3872,11 +3881,11 @@ class Fn {
3872
3881
  ["fullscreen_changed", "fullscreen_failed"],
3873
3882
  se
3874
3883
  ),
3875
- N((M) => M.event === "fullscreen_failed" && M.payload.error !== "ALREADY_FULLSCREEN" ? V(new nr(M.payload.error)) : (f.setState({
3884
+ K((M) => M.event === "fullscreen_failed" && M.payload.error !== "ALREADY_FULLSCREEN" ? V(new nr(M.payload.error)) : (f.setState({
3876
3885
  isFullscreen: "is_fullscreen" in M.payload ? M.payload.is_fullscreen : !0
3877
3886
  }), q(void 0)))
3878
3887
  ));
3879
- this.isMounted = G.isMounted, this.mountFp = Vt(G.mount), this.mount = h(this.mountFp), this.isFullscreen = f.getter("isFullscreen"), this.requestFullscreenFp = rt(!0), this.requestFullscreen = h(this.requestFullscreenFp), this.exitFullscreenFp = rt(!1), this.exitFullscreen = h(this.exitFullscreenFp);
3888
+ this.isMounted = O.isMounted, this.mountFp = Vt(O.mount), this.mount = h(this.mountFp), this.isFullscreen = f.getter("isFullscreen"), this.requestFullscreenFp = rt(!0), this.requestFullscreen = h(this.requestFullscreenFp), this.exitFullscreenFp = rt(!1), this.exitFullscreen = h(this.exitFullscreenFp);
3880
3889
  const ge = j(!1);
3881
3890
  this.isCssVarsBound = F(ge), this.bindCssVarsFp = st(
3882
3891
  (E) => {
@@ -3896,12 +3905,12 @@ class Fn {
3896
3905
  ["contentSafeAreaInsetLeft", this.contentSafeAreaInsetLeft],
3897
3906
  ["contentSafeAreaInsetRight", this.contentSafeAreaInsetRight]
3898
3907
  ].reduce((M, [J, X]) => {
3899
- const W = E(J);
3900
- if (W) {
3908
+ const H = E(J);
3909
+ if (H) {
3901
3910
  const nt = () => {
3902
- et(W, `${X()}px`);
3911
+ et(H, `${X()}px`);
3903
3912
  };
3904
- M.push({ update: nt, removeListener: X.sub(nt), cssVar: W });
3913
+ M.push({ update: nt, removeListener: X.sub(nt), cssVar: H });
3905
3914
  }
3906
3915
  return M;
3907
3916
  }, []);
@@ -3913,7 +3922,7 @@ class Fn {
3913
3922
  }), ge.set(!1);
3914
3923
  });
3915
3924
  }
3916
- ), this.bindCssVars = h(this.bindCssVarsFp), this.expandFp = st(() => m("web_app_expand")), this.expand = h(this.expandFp);
3925
+ ), this.bindCssVars = h(this.bindCssVarsFp), this.expandFp = st(() => _("web_app_expand")), this.expand = h(this.expandFp);
3917
3926
  }
3918
3927
  //#endregion
3919
3928
  }
@@ -3930,15 +3939,15 @@ function wn() {
3930
3939
  ...c(
3931
3940
  C(),
3932
3941
  te("viewport"),
3933
- S,
3942
+ y,
3934
3943
  R,
3935
3944
  P
3936
3945
  ),
3937
3946
  isFullscreen() {
3938
- return c(ve(), O((o) => !!o.tgWebAppFullscreen));
3947
+ return c(Se(), D((o) => !!o.tgWebAppFullscreen));
3939
3948
  },
3940
3949
  isViewportStable() {
3941
- return c(ve(), O((o) => ["macos", "tdesktop", "unigram", "webk", "weba", "web"].includes(o.tgWebAppPlatform)));
3950
+ return c(Se(), D((o) => ["macos", "tdesktop", "unigram", "webk", "weba", "web"].includes(o.tgWebAppPlatform)));
3942
3951
  },
3943
3952
  offContentSafeAreaInsetsChanged: i.off,
3944
3953
  offFullscreenChanged: r.off,
@@ -3960,10 +3969,10 @@ function Cn(s = {}) {
3960
3969
  if (t && typeof r == "boolean" && n)
3961
3970
  Te.set(t), $e.set(r), Ve.set(n);
3962
3971
  else {
3963
- const a = c(ve(), Ct(
3964
- (p) => p,
3965
- (p) => {
3966
- Te.set(t || p.tgWebAppVersion), $e.set(typeof r == "boolean" ? r : !!p.tgWebAppBotInline), Ve.set(n || p.tgWebAppThemeParams);
3972
+ const a = c(Se(), Ct(
3973
+ (l) => l,
3974
+ (l) => {
3975
+ Te.set(t || l.tgWebAppVersion), $e.set(typeof r == "boolean" ? r : !!l.tgWebAppBotInline), Ve.set(n || l.tgWebAppThemeParams);
3967
3976
  }
3968
3977
  ));
3969
3978
  if (a)
@@ -3978,8 +3987,8 @@ function Cn(s = {}) {
3978
3987
  if (u) {
3979
3988
  const a = document.createElement("style");
3980
3989
  a.id = "telegram-custom-styles", document.head.appendChild(a), i(
3981
- Z("set_custom_style", (p) => {
3982
- a.innerHTML = p;
3990
+ Z("set_custom_style", (l) => {
3991
+ a.innerHTML = l;
3983
3992
  }),
3984
3993
  () => {
3985
3994
  document.head.removeChild(a);
@@ -3988,7 +3997,7 @@ function Cn(s = {}) {
3988
3997
  }
3989
3998
  return c(
3990
3999
  ce("iframe_ready", { reload_supported: !0 }),
3991
- O(() => (ot().log("The package was initialized"), o))
4000
+ D(() => (ot().log("The package was initialized"), o))
3992
4001
  );
3993
4002
  }
3994
4003
  const bo = ye(Cn);
@@ -4005,14 +4014,14 @@ export {
4005
4014
  Xs as DeviceStorageMethodError,
4006
4015
  nr as FullscreenFailedError,
4007
4016
  sr as FunctionUnavailableError,
4008
- Sr as HapticFeedback,
4017
+ vr as HapticFeedback,
4009
4018
  Ar as InitData,
4010
4019
  Q as InvalidArgumentsError,
4011
4020
  qn as InvalidEnvError,
4012
4021
  Co as InvalidLaunchParamsError,
4013
4022
  xr as Invoice,
4014
- vo as InvokeCustomMethodFailedError,
4015
- So as LaunchParamsRetrieveError,
4023
+ So as InvokeCustomMethodFailedError,
4024
+ vo as LaunchParamsRetrieveError,
4016
4025
  Rr as LocationManager,
4017
4026
  Lr as MainButton,
4018
4027
  yo as MethodParameterUnsupportedError,
@@ -4131,7 +4140,7 @@ export {
4131
4140
  bi as serializeLaunchParamsQuery,
4132
4141
  si as setDebug,
4133
4142
  Pn as setEmojiStatus,
4134
- vr as setEmojiStatusFp,
4143
+ Sr as setEmojiStatusFp,
4135
4144
  ri as setTargetOrigin,
4136
4145
  ro as settingsButton,
4137
4146
  ho as shareMessage,
@@ -4145,7 +4154,7 @@ export {
4145
4154
  _o as switchInlineQuery,
4146
4155
  gn as switchInlineQueryFp,
4147
4156
  oi as targetOrigin,
4148
- Se as themeParams,
4157
+ ve as themeParams,
4149
4158
  gi as toRGB,
4150
4159
  Fi as toRGBFp,
4151
4160
  wi as toRGBFull,