@tma.js/sdk 3.1.0 → 3.1.1

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
@@ -8,7 +8,7 @@ import { throwifyFpFn as ye, throwifyAnyEither as lt, getStorageValue as Wt, set
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++)
@@ -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,8 +199,8 @@ 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((p) => {
204
204
  Ce(() => {
205
205
  this._isMounted.set(!0), t == null || t(p);
206
206
  });
@@ -257,7 +257,7 @@ 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
263
  return c(s, vs(t));
@@ -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,58 +510,58 @@ 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 = (m) => {
565
565
  if (!t.supports)
566
566
  return !0;
567
567
  const b = t.supports[m];
@@ -733,7 +733,7 @@ class ke {
733
733
  const b = { ...this.state(), ...Me(m) };
734
734
  return d.hasDiff(b) ? c(
735
735
  a(l, p(b)),
736
- O(() => {
736
+ D(() => {
737
737
  d.setState(b);
738
738
  })
739
739
  ) : x(void 0);
@@ -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) {
@@ -929,7 +929,7 @@ 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
935
  k((p) => {
@@ -1097,7 +1097,7 @@ class hr {
1097
1097
  ...m,
1098
1098
  params: { reason: ((m || {}).reason || "").trim() }
1099
1099
  }),
1100
- N((b) => {
1100
+ K((b) => {
1101
1101
  const f = Ae(b);
1102
1102
  return f.available ? (_.setState(f), q(f.accessRequested)) : V(pt);
1103
1103
  })
@@ -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);
@@ -1375,7 +1375,7 @@ class gr {
1375
1375
  params: { ...l, req_id: _ },
1376
1376
  capture: (d) => "payload" in d ? d.payload.req_id === _ : !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(
@@ -1579,7 +1579,7 @@ class Ar {
1579
1579
  e(this, "restore");
1580
1580
  this.restoreFp = () => c(
1581
1581
  t(),
1582
- O(vt(() => {
1582
+ D(vt(() => {
1583
1583
  }, ({ raw: r, obj: n }) => {
1584
1584
  this._state.set(n), this._raw.set(r);
1585
1585
  }))
@@ -1598,10 +1598,10 @@ const Gn = new Ar({
1598
1598
  bs,
1599
1599
  ut("obj", () => c(
1600
1600
  ve(),
1601
- O(({ tgWebAppData: s }) => s ? _e(s) : ie)
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)
@@ -1655,7 +1655,7 @@ class xr {
1655
1655
  };
1656
1656
  this.isSupported = z("web_app_open_invoice", t), this.isOpened = F(o), this.openSlugFp = i((a, p) => 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", {
1658
+ K(() => (o.set(!0), r("web_app_open_invoice", "invoice_closed", {
1659
1659
  ...p,
1660
1660
  params: { slug: a },
1661
1661
  capture: (l) => a === l.slug
@@ -1695,7 +1695,7 @@ 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(
@@ -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;
@@ -2194,7 +2194,7 @@ class Or {
2194
2194
  }), p = (g) => {
2195
2195
  a.setState(g.theme_params);
2196
2196
  }, l = new fe({
2197
- initialState: () => x(D(t)),
2197
+ initialState: () => x(U(t)),
2198
2198
  isPageReload: u,
2199
2199
  onMounted(g) {
2200
2200
  a.setState(g), r(p);
@@ -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({
@@ -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], v = (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))));
2486
+ ].some((f) => oe(f, U(n))));
2487
2487
  const y = j(!1);
2488
2488
  this.isCssVarsBound = F(y), this.bindCssVarsFp = A((f) => {
2489
2489
  if (y())
2490
2490
  return T(new Qe());
2491
2491
  const [B, L] = Re(() => {
2492
2492
  y.set(!1);
2493
- }), $ = (U, G) => {
2494
- const H = () => {
2495
- et(U, G() || null);
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), y.set(!0), x(L);
2500
2500
  }, { isTma: o, returns: "either", isMounted: this.isMounted }), this.bindCssVars = h(this.bindCssVarsFp);
2501
2501
  const m = (f) => {
2502
2502
  const B = w.getter(f), L = v(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,7 +2537,7 @@ 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,
@@ -2652,7 +2652,7 @@ 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((p) => (i.set(!0), n("web_app_open_popup", "popup_closed", {
2656
2656
  ...a,
2657
2657
  params: p
2658
2658
  }))),
@@ -2738,7 +2738,7 @@ 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((p) => p ? q(p) : c(
2742
2742
  t(a),
2743
2743
  ae((l) => l === "sent" ? o(a) : V(new It("User denied access")))
2744
2744
  ))
@@ -2874,7 +2874,7 @@ 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(
2877
+ }), this.closeFp = a(() => c(o("web_app_close_scan_qr_popup"), D(_))), this.openFp = p((d) => c(
2878
2878
  this.isOpened() ? V(new ze("The QR Scanner is already opened")) : async () => o("web_app_open_scan_qr_popup", { text: d.text }),
2879
2879
  ae(() => {
2880
2880
  const [w, g] = Re(), v = (y) => (g(), y);
@@ -3146,7 +3146,7 @@ class Yr {
3146
3146
  })
3147
3147
  }), i = (o, u) => {
3148
3148
  const a = n.stateGetter(o);
3149
- return F(() => a() || D(u));
3149
+ return F(() => a() || U(u));
3150
3150
  };
3151
3151
  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
3152
  [this.disableShineEffect, this.disableShineEffectFp],
@@ -3226,7 +3226,7 @@ class Zr {
3226
3226
  params: { ...l, req_id: _ },
3227
3227
  capture: (d) => "payload" in d ? d.payload.req_id === _ : !0
3228
3228
  }),
3229
- N((d) => d.event === "secure_storage_failed" ? V(new er(d.payload.error || "UNKNOWN_ERROR")) : q(d.payload))
3229
+ K((d) => d.event === "secure_storage_failed" ? V(new er(d.payload.error || "UNKNOWN_ERROR")) : q(d.payload))
3230
3230
  );
3231
3231
  };
3232
3232
  this.getItemFp = o((a) => c(
@@ -3416,7 +3416,7 @@ class en {
3416
3416
  const v = { isVerticalEnabled: g };
3417
3417
  return a.hasDiff(v) ? c(
3418
3418
  t("web_app_setup_swipe_behavior", { allow_vertical_swipe: g }),
3419
- O(() => {
3419
+ D(() => {
3420
3420
  a.setState(v);
3421
3421
  })
3422
3422
  ) : x(void 0);
@@ -3456,7 +3456,7 @@ function tn({ request: s, ...t }) {
3456
3456
  "file_download_requested",
3457
3457
  { ...i, params: { url: r, file_name: n } }
3458
3458
  ),
3459
- N((o) => o.status === "downloading" ? q(void 0) : V(new It("User denied the action")))
3459
+ K((o) => o.status === "downloading" ? q(void 0) : V(new It("User denied the action")))
3460
3460
  ), { ...t, requires: "web_app_request_file_download", returns: "task" });
3461
3461
  }
3462
3462
  const sn = tn(c(
@@ -3467,7 +3467,7 @@ const sn = tn(c(
3467
3467
  function rn({ invokeCustomMethod: s, ...t }) {
3468
3468
  return A((r) => c(
3469
3469
  s("getCurrentTime", {}, r),
3470
- N((n) => {
3470
+ K((n) => {
3471
3471
  const i = Be(
3472
3472
  dt(mt(), ts(), ft((o) => new Date(o * 1e3)), _t()),
3473
3473
  n
@@ -3548,7 +3548,7 @@ function dn({ request: s, ...t }) {
3548
3548
  params: { id: r }
3549
3549
  }
3550
3550
  ),
3551
- N((i) => i.event === "prepared_message_failed" ? V(new or(i.payload.error)) : q(void 0))
3551
+ K((i) => i.event === "prepared_message_failed" ? V(new or(i.payload.error)) : q(void 0))
3552
3552
  ), { ...t, requires: "web_app_send_prepared_message", returns: "task" });
3553
3553
  }
3554
3554
  const fn = dn(c(
@@ -3575,7 +3575,7 @@ function bn({ isInlineMode: s, postEvent: t, ...r }) {
3575
3575
  }), {
3576
3576
  ...r,
3577
3577
  requires: {
3578
- every: ["web_app_switch_inline_query", () => D(s) ? void 0 : "The application must be launched in the inline mode"]
3578
+ every: ["web_app_switch_inline_query", () => U(s) ? void 0 : "The application must be launched in the inline mode"]
3579
3579
  },
3580
3580
  returns: "either"
3581
3581
  });
@@ -3816,13 +3816,13 @@ class Fn {
3816
3816
  f.setState({ isFullscreen: E.is_fullscreen });
3817
3817
  }, $ = (E) => {
3818
3818
  f.setState({ safeAreaInsets: E });
3819
- }, U = (E) => {
3819
+ }, G = (E) => {
3820
3820
  f.setState({ contentSafeAreaInsets: E });
3821
- }, G = new Ye({
3821
+ }, O = new Ye({
3822
3822
  initialState(E) {
3823
3823
  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 });
3824
+ const [X, H] = 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, U(y)) ? d(X, H, E) : q({ top: 0, left: 0, right: 0, bottom: 0 });
3826
3826
  }, M = (J) => () => typeof J == "boolean" ? q(J) : kt(J());
3827
3827
  return c(
3828
3828
  Ys,
@@ -3838,26 +3838,26 @@ class Fn {
3838
3838
  width: window.innerWidth
3839
3839
  }) : c(
3840
3840
  d("web_app_request_viewport", "viewport_changed", E),
3841
- k((W) => ({
3841
+ k((H) => ({
3842
3842
  ...X,
3843
- height: W.height,
3844
- isExpanded: W.is_expanded,
3845
- stableHeight: W.is_state_stable ? W.height : 0,
3846
- width: W.width
3843
+ height: H.height,
3844
+ isExpanded: H.is_expanded,
3845
+ stableHeight: H.is_state_stable ? H.height : 0,
3846
+ width: H.width
3847
3847
  }))
3848
3848
  ))
3849
3849
  );
3850
3850
  },
3851
3851
  isPageReload: r,
3852
3852
  onMounted(E) {
3853
- o(B), u(L), i($), n(U), f.setState(E);
3853
+ o(B), u(L), i($), n(G), f.setState(E);
3854
3854
  },
3855
3855
  onUnmounted() {
3856
- _(B), p(L), l($), a(U);
3856
+ _(B), p(L), l($), a(G);
3857
3857
  },
3858
3858
  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");
3859
+ }), N = (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 = 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");
3861
3861
  const Vt = I({ isTma: v, returns: "task" }), st = I({
3862
3862
  isTma: v,
3863
3863
  returns: "either"
@@ -3872,11 +3872,11 @@ class Fn {
3872
3872
  ["fullscreen_changed", "fullscreen_failed"],
3873
3873
  se
3874
3874
  ),
3875
- N((M) => M.event === "fullscreen_failed" && M.payload.error !== "ALREADY_FULLSCREEN" ? V(new nr(M.payload.error)) : (f.setState({
3875
+ K((M) => M.event === "fullscreen_failed" && M.payload.error !== "ALREADY_FULLSCREEN" ? V(new nr(M.payload.error)) : (f.setState({
3876
3876
  isFullscreen: "is_fullscreen" in M.payload ? M.payload.is_fullscreen : !0
3877
3877
  }), q(void 0)))
3878
3878
  ));
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);
3879
+ 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
3880
  const ge = j(!1);
3881
3881
  this.isCssVarsBound = F(ge), this.bindCssVarsFp = st(
3882
3882
  (E) => {
@@ -3896,12 +3896,12 @@ class Fn {
3896
3896
  ["contentSafeAreaInsetLeft", this.contentSafeAreaInsetLeft],
3897
3897
  ["contentSafeAreaInsetRight", this.contentSafeAreaInsetRight]
3898
3898
  ].reduce((M, [J, X]) => {
3899
- const W = E(J);
3900
- if (W) {
3899
+ const H = E(J);
3900
+ if (H) {
3901
3901
  const nt = () => {
3902
- et(W, `${X()}px`);
3902
+ et(H, `${X()}px`);
3903
3903
  };
3904
- M.push({ update: nt, removeListener: X.sub(nt), cssVar: W });
3904
+ M.push({ update: nt, removeListener: X.sub(nt), cssVar: H });
3905
3905
  }
3906
3906
  return M;
3907
3907
  }, []);
@@ -3935,10 +3935,10 @@ function wn() {
3935
3935
  P
3936
3936
  ),
3937
3937
  isFullscreen() {
3938
- return c(ve(), O((o) => !!o.tgWebAppFullscreen));
3938
+ return c(ve(), D((o) => !!o.tgWebAppFullscreen));
3939
3939
  },
3940
3940
  isViewportStable() {
3941
- return c(ve(), O((o) => ["macos", "tdesktop", "unigram", "webk", "weba", "web"].includes(o.tgWebAppPlatform)));
3941
+ return c(ve(), D((o) => ["macos", "tdesktop", "unigram", "webk", "weba", "web"].includes(o.tgWebAppPlatform)));
3942
3942
  },
3943
3943
  offContentSafeAreaInsetsChanged: i.off,
3944
3944
  offFullscreenChanged: r.off,
@@ -3988,7 +3988,7 @@ function Cn(s = {}) {
3988
3988
  }
3989
3989
  return c(
3990
3990
  ce("iframe_ready", { reload_supported: !0 }),
3991
- O(() => (ot().log("The package was initialized"), o))
3991
+ D(() => (ot().log("The package was initialized"), o))
3992
3992
  );
3993
3993
  }
3994
3994
  const bo = ye(Cn);