@tma.js/sdk 3.0.4 → 3.0.6

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
@@ -3,8 +3,8 @@ var Le = (s, e, r) => e in s ? $e(s, e, { enumerable: !0, configurable: !0, writ
3
3
  var t = (s, e, r) => Le(s, typeof e != "symbol" ? e + "" : e, r);
4
4
  import { computed as w, signal as j, batch as Ct } from "@tma.js/signals";
5
5
  import { supports as ot, isTMAFp as Re, postEventFp as Pe, off as ct, on as Y, requestFp as Oe, invokeCustomMethodFp as De, retrieveRawInitDataFp as Ue, retrieveLaunchParamsFp as St, captureSameReq as Ge, logger as re } from "@tma.js/bridge";
6
- import { CancelledError as lo, InvalidLaunchParamsError as po, InvokeCustomMethodFailedError as ho, LaunchParamsRetrieveError as fo, MethodParameterUnsupportedError as _o, MethodUnsupportedError as mo, TimeoutError as bo, UnknownEnvError as go, applyPolyfills as wo, createLogger as Fo, createPostEvent as Co, createStartParam as So, createStartParamFp as vo, debug as yo, decodeBase64Url as ko, decodeBase64UrlFp as Eo, decodeStartParam as Ao, decodeStartParamFp as Io, deepSnakeToCamelObjKeys as Bo, emitEvent as xo, encodeBase64Url as qo, getReleaseVersion as Mo, isSafeToCreateStartParam as Vo, isTMA as To, isTMAFp as $o, logger as Lo, mockTelegramEnv as Ro, off as Po, offAll as Oo, on as Do, retrieveLaunchParams as Uo, retrieveLaunchParamsFp as Go, retrieveRawInitData as jo, retrieveRawInitDataFp as Ho, retrieveRawLaunchParams as Wo, retrieveRawLaunchParamsFp as Ko, setDebug as Qo, setTargetOrigin as zo, supports as No, targetOrigin as Jo } from "@tma.js/bridge";
7
- import { throwifyFpFn as yt, throwifyAnyEither as ce, getStorageValue as je, setStorageValue as He, snakeToKebab as We, createCbCollector as Lt, camelToKebab as le, BetterTaskEither as xt } from "@tma.js/toolkit";
6
+ import { CancelledError as lo, InvalidLaunchParamsError as po, InvokeCustomMethodFailedError as ho, LaunchParamsRetrieveError as fo, MethodParameterUnsupportedError as _o, MethodUnsupportedError as mo, TimeoutError as bo, UnknownEnvError as go, applyPolyfills as wo, createLogger as Fo, createPostEvent as Co, createStartParam as So, createStartParamFp as vo, debug as yo, decodeBase64Url as ko, decodeBase64UrlFp as Eo, decodeStartParam as Ao, decodeStartParamFp as Io, deepSnakeToCamelObjKeys as xo, emitEvent as Bo, encodeBase64Url as qo, getReleaseVersion as Mo, isSafeToCreateStartParam as Vo, isTMA as To, isTMAFp as $o, logger as Lo, mockTelegramEnv as Ro, off as Po, offAll as Oo, on as Do, retrieveLaunchParams as Uo, retrieveLaunchParamsFp as Go, retrieveRawInitData as jo, retrieveRawInitDataFp as Ho, retrieveRawLaunchParams as Wo, retrieveRawLaunchParamsFp as Ko, setDebug as Qo, setTargetOrigin as zo, supports as No, targetOrigin as Jo } from "@tma.js/bridge";
7
+ import { throwifyFpFn as yt, throwifyAnyEither as ce, getStorageValue as je, setStorageValue as He, snakeToKebab as We, createCbCollector as Lt, camelToKebab as le, BetterTaskEither as Bt } from "@tma.js/toolkit";
8
8
  import { BetterPromise as Ke } from "better-promises";
9
9
  import { toRGBFullFp as Qe, isRGB as Et, pipeQueryToSchema as ze, pipeJsonToSchema as Ne } from "@tma.js/transformers";
10
10
  import { isAnyRGB as Zo, isRGB as Xo, isRGBA as ti, isRGBAShort as ei, isRGBShort as si, parseInitDataQuery as ri, parseInitDataQueryFp as ni, parseLaunchParamsQuery as oi, parseLaunchParamsQueryFp as ii, serializeInitDataQuery as ai, serializeLaunchParamsQuery as ui, toRGB as ci, toRGBFp as li, toRGBFull as pi, toRGBFullFp as hi } from "@tma.js/transformers";
@@ -134,10 +134,10 @@ function Pt(s) {
134
134
  var V = me, I = be, as = /* @__PURE__ */ lt(2, function(s, e) {
135
135
  return rt(s) ? s : e(s.right);
136
136
  }), Ot = function(s, e) {
137
- return c(s, D(e));
137
+ return c(s, P(e));
138
138
  }, ge = function(s, e) {
139
139
  return c(s, ps(e));
140
- }, Dt = "Either", D = function(s) {
140
+ }, Dt = "Either", P = function(s) {
141
141
  return function(e) {
142
142
  return rt(e) ? e : I(s(e.right));
143
143
  };
@@ -172,11 +172,11 @@ var V = me, I = be, as = /* @__PURE__ */ lt(2, function(s, e) {
172
172
  return V(e(r));
173
173
  }
174
174
  }, ms = /* @__PURE__ */ cs(Rt), bs = /* @__PURE__ */ Pt(ds), ie = bs;
175
- function P(s) {
175
+ function O(s) {
176
176
  return typeof s == "function" ? s() : s;
177
177
  }
178
178
  function z(s, e) {
179
- return w(() => ot(s, P(e)));
179
+ return w(() => ot(s, O(e)));
180
180
  }
181
181
  var it = ss, ht = rs, gs = function(s, e) {
182
182
  return c(s, Cs(e));
@@ -207,10 +207,10 @@ var it = ss, ht = rs, gs = function(s, e) {
207
207
  function Is(s) {
208
208
  return _e(I, s.of);
209
209
  }
210
- function Bs(s) {
210
+ function xs(s) {
211
211
  return _e(V, s.of);
212
212
  }
213
- function xs(s) {
213
+ function Bs(s) {
214
214
  return is(s, us);
215
215
  }
216
216
  function qs(s) {
@@ -364,7 +364,7 @@ var Ut = function(s, e) {
364
364
  if (l[0] & 5) throw l[1];
365
365
  return { value: l[0] ? l[1] : void 0, done: !0 };
366
366
  }
367
- }, $ = /* @__PURE__ */ Bs(Se), q = /* @__PURE__ */ Is(Se), ve = Gt, Gs = /* @__PURE__ */ Ts(Ht), js = function(s, e) {
367
+ }, L = /* @__PURE__ */ xs(Se), q = /* @__PURE__ */ Is(Se), ve = Gt, Gs = /* @__PURE__ */ Ts(Ht), js = function(s, e) {
368
368
  return function() {
369
369
  return Ds(void 0, void 0, void 0, function() {
370
370
  var r;
@@ -386,10 +386,10 @@ var Ut = function(s, e) {
386
386
  });
387
387
  };
388
388
  }, Hs = function(s, e) {
389
- return c(s, x(e));
389
+ return c(s, B(e));
390
390
  }, Ws = function(s, e) {
391
391
  return c(s, Ks(e));
392
- }, x = /* @__PURE__ */ xs(Ht), Wt = /* @__PURE__ */ lt(3, Vs(Ht)), Ks = /* @__PURE__ */ qs(Ps), Kt = /* @__PURE__ */ lt(2, Ms(Os)), Qs = q, zs = "TaskEither", Ns = {
392
+ }, B = /* @__PURE__ */ Bs(Ht), Wt = /* @__PURE__ */ lt(3, Vs(Ht)), Ks = /* @__PURE__ */ qs(Ps), Kt = /* @__PURE__ */ lt(2, Ms(Os)), Qs = q, zs = "TaskEither", Ns = {
393
393
  URI: zs,
394
394
  map: Hs,
395
395
  ap: Ws,
@@ -460,7 +460,7 @@ class rr extends K(
460
460
  ) {
461
461
  }
462
462
  function A(s, e) {
463
- const r = w(() => P(e.version) || "100"), n = w(() => P(e.isTma)), { requires: i, returns: o } = e, u = i ? typeof i == "object" ? i : { every: [i] } : void 0, a = (f) => {
463
+ const r = w(() => O(e.version) || "100"), n = w(() => O(e.isTma)), { requires: i, returns: o } = e, u = i ? typeof i == "object" ? i : { every: [i] } : void 0, a = (f) => {
464
464
  if (!e.supports)
465
465
  return !0;
466
466
  const b = e.supports[f];
@@ -469,10 +469,10 @@ function A(s, e) {
469
469
  if (!u)
470
470
  return;
471
471
  const [f, b] = "every" in u ? ["every", u.every] : ["some", u.some];
472
- for (let h = 0; h < b.length; h++) {
473
- const B = b[h], R = typeof B == "function" ? B() : ot(B, r()) ? void 0 : `it is unsupported in Mini Apps version ${r()}`;
474
- if (R && (f === "every" || h === b.length - 1))
475
- return R;
472
+ for (let d = 0; d < b.length; d++) {
473
+ const x = b[d], $ = typeof x == "function" ? x() : ot(x, r()) ? void 0 : `it is unsupported in Mini Apps version ${r()}`;
474
+ if ($ && (f === "every" || d === b.length - 1))
475
+ return $;
476
476
  }
477
477
  }, l = (...f) => {
478
478
  for (const b in e.supports)
@@ -482,24 +482,24 @@ function A(s, e) {
482
482
  () => n() && _() && m() && g()
483
483
  ), y = (f) => {
484
484
  const b = new Xs(f);
485
- return ["task", "promise"].includes(e.returns) ? $(b) : V(b);
485
+ return ["task", "promise"].includes(e.returns) ? L(b) : V(b);
486
486
  }, S = (...f) => o === "plain" ? _s(() => s(...f), (b) => b) : o === "promise" ? js(() => s(...f), (b) => b) : s(...f);
487
487
  return Object.assign(
488
488
  (...f) => {
489
- var R;
489
+ var $;
490
490
  const b = "Unable to call function:";
491
491
  if (!n())
492
492
  return y(`${b} it can't be called outside Mini Apps`);
493
493
  if (!_())
494
494
  return y(`${b} the SDK was not initialized. Use the SDK init() function`);
495
- const h = p();
496
- if (h)
497
- return y(`${b} ${h}`);
498
- const B = l(...f);
499
- if (B)
500
- return y(`${b} ${B}`);
495
+ const d = p();
496
+ if (d)
497
+ return y(`${b} ${d}`);
498
+ const x = l(...f);
499
+ if (x)
500
+ return y(`${b} ${x}`);
501
501
  if (!g()) {
502
- const T = (R = e.isMounting) != null && R.call(e) ? "mounting. Wait for the mount completion" : "unmounted. Use the mount() method";
502
+ const T = ($ = e.isMounting) != null && $.call(e) ? "mounting. Wait for the mount completion" : "unmounted. Use the mount() method";
503
503
  return y(`${b} the component is ${T}`);
504
504
  }
505
505
  return S(...f);
@@ -518,7 +518,7 @@ function A(s, e) {
518
518
  function E(s) {
519
519
  return (e) => A(e, s);
520
520
  }
521
- function d(s) {
521
+ function h(s) {
522
522
  return Object.assign(yt(s), {
523
523
  ifAvailable(...e) {
524
524
  return c(
@@ -602,8 +602,8 @@ class dt {
602
602
  this.mount = () => {
603
603
  if (this.isMounted())
604
604
  return I(void 0);
605
- const u = P(o) ? r() : void 0, a = u ? I(u) : typeof n == "function" ? n() : I(n);
606
- return c(a, D((p) => {
605
+ const u = O(o) ? r() : void 0, a = u ? I(u) : typeof n == "function" ? n() : I(n);
606
+ return c(a, P((p) => {
607
607
  Ct(() => {
608
608
  this._isMounted.set(!0), e == null || e(p);
609
609
  });
@@ -729,22 +729,22 @@ class kt {
729
729
  const b = { ...this.state(), ...Mt(f) };
730
730
  return _.hasDiff(b) ? c(
731
731
  a(l, p(b)),
732
- D(() => {
732
+ P(() => {
733
733
  _.setState(b);
734
734
  })
735
735
  ) : I(void 0);
736
- }), this.setState = d(this.setStateFp), this.onClickFp = y(n), this.onClick = d(this.onClickFp), this.offClickFp = y(i), this.offClick = d(this.offClickFp), this.mountFp = y(() => {
736
+ }), this.setState = h(this.setStateFp), this.onClickFp = y(n), this.onClick = h(this.onClickFp), this.offClickFp = y(i), this.offClick = h(this.offClickFp), this.mountFp = y(() => {
737
737
  const f = () => {
738
738
  };
739
739
  return c(g.mount(), pt(f, f));
740
- }), this.mount = d(this.mountFp), this.unmount = g.unmount, this.stateSetters = (f) => {
741
- const b = S((h) => this.setStateFp({ [f]: h }));
742
- return [d(b), b];
740
+ }), this.mount = h(this.mountFp), this.unmount = g.unmount, this.stateSetters = (f) => {
741
+ const b = S((d) => this.setStateFp({ [f]: d }));
742
+ return [h(b), b];
743
743
  }, this.stateBoolSetters = (f) => {
744
- const [, b] = this.stateSetters(f), h = S(() => b(!1)), B = S(() => b(!0));
744
+ const [, b] = this.stateSetters(f), d = S(() => b(!1)), x = S(() => b(!0));
745
745
  return [
746
- [d(h), h],
747
- [d(B), B]
746
+ [h(d), d],
747
+ [h(x), x]
748
748
  ];
749
749
  };
750
750
  }
@@ -867,7 +867,7 @@ function ar() {
867
867
  return !!s && s.type === "reload";
868
868
  }
869
869
  function ft(s) {
870
- return (e) => ({ ...e, ...P(s) });
870
+ return (e) => ({ ...e, ...O(s) });
871
871
  }
872
872
  function et(s) {
873
873
  return ft({
@@ -879,14 +879,14 @@ function et(s) {
879
879
  function _t(s, e) {
880
880
  return j(s, e);
881
881
  }
882
- const ke = /* @__PURE__ */ _t(Pe), mt = (...s) => ke()(...s), ur = (...s) => ce(mt(...s)), L = ft({
882
+ const ke = /* @__PURE__ */ _t(Pe), mt = (...s) => ke()(...s), ur = (...s) => ce(mt(...s)), R = ft({
883
883
  postEvent: mt
884
884
  }), Vt = /* @__PURE__ */ _t("0.0"), v = ft({ version: Vt });
885
885
  function Nt(s, e) {
886
886
  return {
887
887
  ...c(
888
888
  F(),
889
- L,
889
+ R,
890
890
  v,
891
891
  et(s)
892
892
  ),
@@ -924,10 +924,10 @@ class Jt {
924
924
  this.mount = (u) => {
925
925
  if (this._isMounted())
926
926
  return q(void 0);
927
- const a = P(o) ? n() : void 0;
927
+ const a = O(o) ? n() : void 0;
928
928
  return c(
929
929
  a ? q(a) : e(u),
930
- x((p) => {
930
+ B((p) => {
931
931
  this._isMounted() || Ct(() => {
932
932
  this._isMounted.set(!0), r == null || r(p);
933
933
  });
@@ -1059,7 +1059,7 @@ class cr {
1059
1059
  initialState(f) {
1060
1060
  return c(
1061
1061
  r("web_app_biometry_get_info", "biometry_info_received", f),
1062
- x(It)
1062
+ B(It)
1063
1063
  );
1064
1064
  },
1065
1065
  isPageReload: p,
@@ -1086,15 +1086,15 @@ class cr {
1086
1086
  ...f,
1087
1087
  params: { reason: ((f || {}).reason || "").trim() }
1088
1088
  }),
1089
- x((b) => (m.setState({ token: b.token }), b))
1090
- ) : $(ue)), this.openSettingsFp = C(() => n("web_app_biometry_open_settings")), this.requestAccessFp = S((f) => c(
1089
+ B((b) => (m.setState({ token: b.token }), b))
1090
+ ) : L(ue)), this.openSettingsFp = C(() => n("web_app_biometry_open_settings")), this.requestAccessFp = S((f) => c(
1091
1091
  r("web_app_biometry_request_access", "biometry_info_received", {
1092
1092
  ...f,
1093
1093
  params: { reason: ((f || {}).reason || "").trim() }
1094
1094
  }),
1095
1095
  Z((b) => {
1096
- const h = It(b);
1097
- return h.available ? (m.setState(h), q(h.accessRequested)) : $(ue);
1096
+ const d = It(b);
1097
+ return d.available ? (m.setState(d), q(d.accessRequested)) : L(ue);
1098
1098
  })
1099
1099
  )), this.updateTokenFp = S((f = {}) => {
1100
1100
  var b;
@@ -1103,22 +1103,22 @@ class cr {
1103
1103
  ...f,
1104
1104
  params: { token: f.token || "", reason: (b = f.reason) == null ? void 0 : b.trim() }
1105
1105
  }),
1106
- x((h) => h.status)
1106
+ B((d) => d.status)
1107
1107
  );
1108
- }), this.authenticate = d(this.authenticateFp), this.openSettings = d(this.openSettingsFp), this.requestAccess = d(this.requestAccessFp), this.updateToken = d(this.updateTokenFp), this.mount = d(this.mountFp);
1108
+ }), this.authenticate = h(this.authenticateFp), this.openSettings = h(this.openSettingsFp), this.requestAccess = h(this.requestAccessFp), this.updateToken = h(this.updateTokenFp), this.mount = h(this.mountFp);
1109
1109
  }
1110
1110
  }
1111
1111
  const Ee = (s, e, r) => Oe(s, e, {
1112
1112
  postEvent: mt,
1113
1113
  ...r
1114
- }), kn = (...s) => Ke.fn(() => Ee(...s)()), U = ft({
1114
+ }), kn = (...s) => Ke.fn(() => Ee(...s)()), G = ft({
1115
1115
  request: Ee
1116
1116
  }), En = new cr({
1117
1117
  ...c(
1118
1118
  F(),
1119
- L,
1119
+ R,
1120
1120
  v,
1121
- U,
1121
+ G,
1122
1122
  et("biometry")
1123
1123
  ),
1124
1124
  offInfoReceived(s) {
@@ -1190,13 +1190,13 @@ class lr {
1190
1190
  const _ = () => {
1191
1191
  };
1192
1192
  return c(u.mount(), pt(_, _));
1193
- }), this.unmount = u.unmount, this.disableConfirmation = d(this.disableConfirmationFp), this.enableConfirmation = d(this.enableConfirmationFp), this.mount = d(this.mountFp);
1193
+ }), this.unmount = u.unmount, this.disableConfirmation = h(this.disableConfirmationFp), this.enableConfirmation = h(this.enableConfirmationFp), this.mount = h(this.mountFp);
1194
1194
  }
1195
1195
  }
1196
1196
  const An = new lr(c(
1197
1197
  F(),
1198
1198
  et("closingBehavior"),
1199
- L
1199
+ R
1200
1200
  ));
1201
1201
  class pr {
1202
1202
  constructor({ version: e, isTma: r, invokeCustomMethod: n }) {
@@ -1279,32 +1279,32 @@ class pr {
1279
1279
  const a = Array.isArray(o) ? o : [o];
1280
1280
  return c(
1281
1281
  a.length ? n("deleteStorageValues", { keys: a }, u) : q(void 0),
1282
- x(() => {
1282
+ B(() => {
1283
1283
  })
1284
1284
  );
1285
1285
  }), this.getItemFp = i((o, u) => c(
1286
1286
  this.getItemsFp([o], u),
1287
- x((a) => a[o] || "")
1287
+ B((a) => a[o] || "")
1288
1288
  )), this.getItemsFp = i((o, u) => c(
1289
1289
  o.length ? n("getStorageValues", { keys: o }, u) : q({}),
1290
- x((a) => ({
1290
+ B((a) => ({
1291
1291
  // Fulfill the response with probably missing keys.
1292
1292
  ...o.reduce((p, l) => (p[l] = "", p), {}),
1293
1293
  ...ne(Ye(J(), J()), a)
1294
1294
  }))
1295
1295
  )), this.getKeysFp = i((o) => c(
1296
1296
  n("getStorageKeys", {}, o),
1297
- x((u) => ne(Ze(J()), u))
1297
+ B((u) => ne(Ze(J()), u))
1298
1298
  )), this.setItemFp = i((o, u, a) => c(
1299
1299
  n("saveStorageValue", { key: o, value: u }, a),
1300
- x(() => {
1300
+ B(() => {
1301
1301
  })
1302
- )), this.clearFp = i((o) => c(this.getKeysFp(o), Z(this.deleteItemFp))), this.deleteItem = d(this.deleteItemFp), this.getItem = d(this.getItemFp), this.getItems = d(this.getItemsFp), this.getKeys = d(this.getKeysFp), this.setItem = d(this.setItemFp), this.clear = d(this.clearFp);
1302
+ )), this.clearFp = i((o) => c(this.getKeysFp(o), Z(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);
1303
1303
  }
1304
1304
  }
1305
- const Bt = /* @__PURE__ */ _t(0);
1305
+ const xt = /* @__PURE__ */ _t(0);
1306
1306
  function Ae() {
1307
- return Bt.set(Bt() + 1), Bt().toString();
1307
+ return xt.set(xt() + 1), xt().toString();
1308
1308
  }
1309
1309
  function hr(s, e, r) {
1310
1310
  return De(s, e, Ae(), {
@@ -1322,14 +1322,14 @@ const Yt = ft({
1322
1322
  function dr({ request: s, ...e }) {
1323
1323
  return A((r) => c(
1324
1324
  s("web_app_request_emoji_status_access", "emoji_status_access_requested", r),
1325
- x((n) => n.status)
1325
+ B((n) => n.status)
1326
1326
  ), { ...e, requires: "web_app_request_emoji_status_access", returns: "task" });
1327
1327
  }
1328
1328
  const fr = dr(c(
1329
1329
  F(),
1330
1330
  v,
1331
- U
1332
- )), Bn = d(fr);
1331
+ G
1332
+ )), xn = h(fr);
1333
1333
  function _r({ request: s, ...e }) {
1334
1334
  return A((r, n) => c(
1335
1335
  s("web_app_set_emoji_status", ["emoji_status_set", "emoji_status_failed"], {
@@ -1339,7 +1339,7 @@ function _r({ request: s, ...e }) {
1339
1339
  },
1340
1340
  ...n
1341
1341
  }),
1342
- at((i) => i && "error" in i ? $(new tr(i.error)) : q(void 0))
1342
+ at((i) => i && "error" in i ? L(new tr(i.error)) : q(void 0))
1343
1343
  ), {
1344
1344
  ...e,
1345
1345
  requires: "web_app_set_emoji_status",
@@ -1348,9 +1348,9 @@ function _r({ request: s, ...e }) {
1348
1348
  }
1349
1349
  const mr = _r(c(
1350
1350
  F(),
1351
- U,
1351
+ G,
1352
1352
  v
1353
- )), xn = d(mr);
1353
+ )), Bn = h(mr);
1354
1354
  class br {
1355
1355
  constructor({ postEvent: e, isTma: r, version: n }) {
1356
1356
  /**
@@ -1399,12 +1399,12 @@ class br {
1399
1399
  version: n,
1400
1400
  returns: "plain"
1401
1401
  });
1402
- this.isSupported = z(i, n), this.impactOccurredFp = o((u) => e(i, { type: "impact", impact_style: u })), this.notificationOccurredFp = o((u) => e(i, { type: "notification", notification_type: u })), this.selectionChangedFp = o(() => e(i, { type: "selection_change" })), this.impactOccurred = d(this.impactOccurredFp), this.notificationOccurred = d(this.notificationOccurredFp), this.selectionChanged = d(this.selectionChangedFp);
1402
+ this.isSupported = z(i, n), this.impactOccurredFp = o((u) => e(i, { type: "impact", impact_style: u })), this.notificationOccurredFp = o((u) => e(i, { type: "notification", notification_type: u })), this.selectionChangedFp = o(() => e(i, { type: "selection_change" })), this.impactOccurred = h(this.impactOccurredFp), this.notificationOccurred = h(this.notificationOccurredFp), this.selectionChanged = h(this.selectionChangedFp);
1403
1403
  }
1404
1404
  }
1405
1405
  const qn = new br(c(
1406
1406
  F(),
1407
- L,
1407
+ R,
1408
1408
  v
1409
1409
  ));
1410
1410
  function gr({ postEvent: s, ...e }) {
@@ -1413,19 +1413,19 @@ function gr({ postEvent: s, ...e }) {
1413
1413
  const wr = gr(c(
1414
1414
  F(),
1415
1415
  v,
1416
- L
1417
- )), Mn = d(wr);
1416
+ R
1417
+ )), Mn = h(wr);
1418
1418
  function Fr({ request: s, ...e }) {
1419
1419
  return A((r) => c(
1420
1420
  s("web_app_check_home_screen", "home_screen_checked", r),
1421
- x((n) => n.status || "unknown")
1421
+ B((n) => n.status || "unknown")
1422
1422
  ), { ...e, requires: "web_app_check_home_screen", returns: "task" });
1423
1423
  }
1424
1424
  const Cr = Fr(c(
1425
1425
  F(),
1426
1426
  v,
1427
- U
1428
- )), Vn = d(Cr);
1427
+ G
1428
+ )), Vn = h(Cr);
1429
1429
  class Sr {
1430
1430
  constructor({ retrieveInitData: e }) {
1431
1431
  t(this, "_state", j());
@@ -1500,7 +1500,7 @@ class Sr {
1500
1500
  t(this, "restore");
1501
1501
  this.restoreFp = () => c(
1502
1502
  e(),
1503
- D(Fe(() => {
1503
+ P(Fe(() => {
1504
1504
  }, ({ raw: r, obj: n }) => {
1505
1505
  this._state.set(n), this._raw.set(r);
1506
1506
  }))
@@ -1519,10 +1519,10 @@ const Tn = new Sr({
1519
1519
  ms,
1520
1520
  ie("obj", () => c(
1521
1521
  St(),
1522
- D(({ tgWebAppData: s }) => s ? ht(s) : it)
1522
+ P(({ tgWebAppData: s }) => s ? ht(s) : it)
1523
1523
  )),
1524
1524
  ie("raw", Ue),
1525
- D(({ obj: s, raw: e }) => c(
1525
+ P(({ obj: s, raw: e }) => c(
1526
1526
  As,
1527
1527
  ae("obj", () => s),
1528
1528
  ae("raw", () => e)
@@ -1575,7 +1575,7 @@ class vr {
1575
1575
  o.set(!1);
1576
1576
  };
1577
1577
  this.isSupported = z("web_app_open_invoice", e), this.isOpened = w(o), this.openSlugFp = i((a, p) => c(
1578
- this.isOpened() ? $(new zt("Invoice is already opened")) : q(void 0),
1578
+ this.isOpened() ? L(new zt("Invoice is already opened")) : q(void 0),
1579
1579
  Z(() => (o.set(!0), r("web_app_open_invoice", "invoice_closed", {
1580
1580
  ...p,
1581
1581
  params: { slug: a },
@@ -1585,15 +1585,15 @@ class vr {
1585
1585
  )), this.openUrlFp = i((a, p) => {
1586
1586
  const { hostname: l, pathname: m } = new URL(a, window.location.href);
1587
1587
  if (l !== "t.me")
1588
- return $(new Q(`Link has unexpected hostname: ${l}`));
1588
+ return L(new Q(`Link has unexpected hostname: ${l}`));
1589
1589
  const _ = m.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/);
1590
- return _ ? this.openSlugFp(_[2], p) : $(new Q(
1590
+ return _ ? this.openSlugFp(_[2], p) : L(new Q(
1591
1591
  'Expected to receive a link with a pathname in format "/invoice/{slug}" or "/${slug}"'
1592
1592
  ));
1593
- }), this.openUrl = d(this.openUrlFp), this.openSlug = d(this.openSlugFp);
1593
+ }), this.openUrl = h(this.openUrlFp), this.openSlug = h(this.openSlugFp);
1594
1594
  }
1595
1595
  }
1596
- const $n = new vr(c(F(), U, v));
1596
+ const $n = new vr(c(F(), G, v));
1597
1597
  function yr({ postEvent: s, ...e }) {
1598
1598
  return A((r, n = {}) => {
1599
1599
  if (typeof r == "string")
@@ -1611,19 +1611,19 @@ function yr({ postEvent: s, ...e }) {
1611
1611
  }
1612
1612
  const kr = yr(c(
1613
1613
  F(),
1614
- L
1615
- )), Ln = d(kr);
1614
+ R
1615
+ )), Ln = h(kr);
1616
1616
  function Er({ postEvent: s, version: e, ...r }) {
1617
1617
  return A((n) => {
1618
1618
  const i = n.toString();
1619
- return i.match(/^https:\/\/t.me\/.+/) ? ot("web_app_open_tg_link", P(e)) ? (n = new URL(n), s("web_app_open_tg_link", { path_full: n.pathname + n.search })) : (window.location.href = i, I(void 0)) : V(new Q(`"${i}" is invalid URL`));
1619
+ return i.match(/^https:\/\/t.me\/.+/) ? ot("web_app_open_tg_link", O(e)) ? (n = new URL(n), s("web_app_open_tg_link", { path_full: n.pathname + n.search })) : (window.location.href = i, I(void 0)) : V(new Q(`"${i}" is invalid URL`));
1620
1620
  }, { ...r, returns: "either" });
1621
1621
  }
1622
1622
  const Ie = Er(c(
1623
1623
  F(),
1624
- L,
1624
+ R,
1625
1625
  v
1626
- )), Rn = d(Ie);
1626
+ )), Rn = h(Ie);
1627
1627
  function Ar({ openTelegramLink: s, ...e }) {
1628
1628
  return A((r, n) => s(
1629
1629
  "https://t.me/share/url?" + new URLSearchParams({ url: r, text: n || "" }).toString().replace(/\+/g, "%20")
@@ -1632,8 +1632,8 @@ function Ar({ openTelegramLink: s, ...e }) {
1632
1632
  const Ir = Ar({
1633
1633
  ...F(),
1634
1634
  openTelegramLink: Ie
1635
- }), Pn = d(Ir);
1636
- function Br(s) {
1635
+ }), Pn = h(Ir);
1636
+ function xr(s) {
1637
1637
  let e = !1, r, n;
1638
1638
  return s.available && (e = !0, r = s.access_requested, n = s.access_granted), {
1639
1639
  available: e,
@@ -1641,7 +1641,7 @@ function Br(s) {
1641
1641
  accessRequested: r || !1
1642
1642
  };
1643
1643
  }
1644
- class xr {
1644
+ class Br {
1645
1645
  constructor({
1646
1646
  version: e,
1647
1647
  request: r,
@@ -1724,7 +1724,7 @@ class xr {
1724
1724
  initialState(C) {
1725
1725
  return c(
1726
1726
  r("web_app_check_location", "location_checked", C),
1727
- x(Br)
1727
+ B(xr)
1728
1728
  );
1729
1729
  }
1730
1730
  }), l = { version: e, requires: "web_app_check_location", isTma: o }, m = E({
@@ -1740,20 +1740,20 @@ class xr {
1740
1740
  });
1741
1741
  this.isAvailable = a.getter("available"), this.isAccessRequested = a.getter("accessRequested"), this.isAccessGranted = a.getter("accessGranted"), this.isSupported = z("web_app_check_location", e), this.isMounted = p.isMounted, this.state = a.state, this.unmount = p.unmount, this.mountFp = _(p.mount), this.openSettingsFp = m(() => n("web_app_open_location_settings")), this.requestLocationFp = g((C) => c(
1742
1742
  r("web_app_request_location", "location_requested", C),
1743
- x((y) => {
1743
+ B((y) => {
1744
1744
  if (!y.available)
1745
1745
  return a.setState({ available: !1 }), null;
1746
1746
  const { available: S, ...f } = y;
1747
1747
  return f;
1748
1748
  })
1749
- )), this.mount = d(this.mountFp), this.openSettings = d(this.openSettingsFp), this.requestLocation = d(this.requestLocationFp);
1749
+ )), this.mount = h(this.mountFp), this.openSettings = h(this.openSettingsFp), this.requestLocation = h(this.requestLocationFp);
1750
1750
  }
1751
1751
  }
1752
- const On = new xr(c(
1752
+ const On = new Br(c(
1753
1753
  F(),
1754
- L,
1754
+ R,
1755
1755
  v,
1756
- U,
1756
+ G,
1757
1757
  et("locationManager")
1758
1758
  ));
1759
1759
  class qr {
@@ -1967,7 +1967,7 @@ class qr {
1967
1967
  })
1968
1968
  }), i = (o, u) => {
1969
1969
  const a = n.stateGetter(o);
1970
- return w(() => a() || P(u));
1970
+ return w(() => a() || O(u));
1971
1971
  };
1972
1972
  this.bgColor = i("bgColor", e.bgColor), this.textColor = i("textColor", e.textColor), this.hasShineEffect = n.stateGetter("hasShineEffect"), this.isEnabled = n.stateGetter("isEnabled"), this.isLoaderVisible = n.stateGetter("isLoaderVisible"), this.text = n.stateGetter("text"), this.isVisible = n.stateGetter("isVisible"), this.isMounted = n.isMounted, this.state = n.state, [this.setBgColor, this.setBgColorFp] = n.stateSetters("bgColor"), [this.setTextColor, this.setTextColorFp] = n.stateSetters("textColor"), [
1973
1973
  [this.disableShineEffect, this.disableShineEffectFp],
@@ -1982,7 +1982,7 @@ class qr {
1982
1982
  }
1983
1983
  //#endregion
1984
1984
  }
1985
- function Be(s, e, r) {
1985
+ function xe(s, e, r) {
1986
1986
  return c(
1987
1987
  Nt(s, e),
1988
1988
  (n) => ({ ...n, defaults: r })
@@ -1998,7 +1998,7 @@ function Xt(s) {
1998
1998
  function Mr(s) {
1999
1999
  return c(
2000
2000
  Qe(s),
2001
- D((e) => Math.sqrt(
2001
+ P((e) => Math.sqrt(
2002
2002
  [0.299, 0.587, 0.114].reduce((r, n, i) => {
2003
2003
  const o = parseInt(e.slice(1 + i * 2, 1 + (i + 1) * 2), 16);
2004
2004
  return r + o * o * n;
@@ -2006,7 +2006,7 @@ function Mr(s) {
2006
2006
  ) < 120)
2007
2007
  );
2008
2008
  }
2009
- const xe = yt(Mr);
2009
+ const Be = yt(Mr);
2010
2010
  class Vr {
2011
2011
  constructor({
2012
2012
  initialState: e,
@@ -2096,7 +2096,7 @@ class Vr {
2096
2096
  */
2097
2097
  t(this, "isDark", w(() => {
2098
2098
  const e = this.bgColor();
2099
- return !e || xe(e);
2099
+ return !e || Be(e);
2100
2100
  }));
2101
2101
  //#endregion
2102
2102
  //#region Mounting.
@@ -2122,7 +2122,7 @@ class Vr {
2122
2122
  }), p = (C) => {
2123
2123
  a.setState(C.theme_params);
2124
2124
  }, l = new dt({
2125
- initialState: () => I(P(e)),
2125
+ initialState: () => I(O(e)),
2126
2126
  isPageReload: u,
2127
2127
  onMounted(C) {
2128
2128
  a.setState(C), r(p);
@@ -2140,8 +2140,8 @@ class Vr {
2140
2140
  return V(new Qt());
2141
2141
  C || (C = (f) => `--tg-theme-${We(f)}`);
2142
2142
  const y = (f) => {
2143
- Object.entries(a.state()).forEach(([b, h]) => {
2144
- h && f(b, h);
2143
+ Object.entries(a.state()).forEach(([b, d]) => {
2144
+ d && f(b, d);
2145
2145
  });
2146
2146
  }, S = () => {
2147
2147
  y((f, b) => {
@@ -2151,7 +2151,7 @@ class Vr {
2151
2151
  return S(), a.state.sub(S), this._isCssVarsBound.set(!0), I(() => {
2152
2152
  y(Xt), a.state.unsub(S), this._isCssVarsBound.set(!1);
2153
2153
  });
2154
- }), this.mountFp = _(l.mount), this.unmount = l.unmount, this.bindCssVars = d(this.bindCssVarsFp), this.mount = d(this.mountFp);
2154
+ }), this.mountFp = _(l.mount), this.unmount = l.unmount, this.bindCssVars = h(this.bindCssVarsFp), this.mount = h(this.mountFp);
2155
2155
  }
2156
2156
  //#endregion
2157
2157
  }
@@ -2168,7 +2168,7 @@ const vt = new Vr({
2168
2168
  },
2169
2169
  initialState: Tt
2170
2170
  }), Dn = new qr(
2171
- Be("mainButton", "main_button_pressed", {
2171
+ xe("mainButton", "main_button_pressed", {
2172
2172
  bgColor: w(() => vt.buttonColor() || "#2481cc"),
2173
2173
  textColor: w(() => vt.buttonTextColor() || "#ffffff")
2174
2174
  })
@@ -2194,7 +2194,7 @@ class Tr {
2194
2194
  */
2195
2195
  t(this, "isDark", w(() => {
2196
2196
  const e = this.bgColorRgb();
2197
- return e ? xe(e) : !1;
2197
+ return e ? Be(e) : !1;
2198
2198
  }));
2199
2199
  /**
2200
2200
  * Signal indicating if the mini app is currently active.
@@ -2352,33 +2352,32 @@ class Tr {
2352
2352
  * @see readyFp
2353
2353
  */
2354
2354
  t(this, "ready");
2355
- const l = (h) => {
2356
- g.setState({ isActive: h.is_visible });
2357
- }, m = (h) => {
2355
+ const l = (d) => {
2356
+ g.setState({ isActive: d.is_visible });
2357
+ }, m = (d) => {
2358
2358
  [
2359
2359
  [this.headerColor, "web_app_set_header_color"],
2360
2360
  [this.bgColor, "web_app_set_background_color"],
2361
2361
  [this.bottomBarColor, "web_app_set_bottom_bar_color"]
2362
- ].forEach(([B, R]) => {
2363
- const T = B();
2364
- if (!Et(T) && (R === "web_app_set_header_color" || !["bg_color", "secondary_bg_color"].includes(T))) {
2365
- const O = h[T];
2366
- O && i(R, { color: O });
2362
+ ].forEach(([x, $]) => {
2363
+ const T = x();
2364
+ if (console.log(T, $), !Et(T) && ($ !== "web_app_set_header_color" || !["bg_color", "secondary_bg_color"].includes(T))) {
2365
+ const D = d[T];
2366
+ D && i($, { color: D });
2367
2367
  }
2368
2368
  });
2369
2369
  }, _ = new dt({
2370
2370
  initialState() {
2371
- const h = P(u);
2372
2371
  return I({
2373
- bgColor: h.bg_color || "bg_color",
2374
- headerColor: h.header_bg_color || "header_bg_color",
2375
- bottomBarColor: h.bottom_bar_bg_color || "bottom_bar_bg_color",
2372
+ bgColor: "bg_color",
2373
+ headerColor: "header_bg_color",
2374
+ bottomBarColor: "bottom_bar_bg_color",
2376
2375
  isActive: !0
2377
2376
  });
2378
2377
  },
2379
2378
  isPageReload: r,
2380
- onMounted: (h) => {
2381
- this.setBgColorFp.ifAvailable(h.bgColor), this.setBottomBarColorFp.ifAvailable(h.bottomBarColor), this.setHeaderColorFp.ifAvailable(h.headerColor), a(l), u.sub(m), g.setState(h);
2379
+ onMounted: (d) => {
2380
+ a(l), u.sub(m), g.setState(d);
2382
2381
  },
2383
2382
  onUnmounted() {
2384
2383
  p(l), u.unsub(m);
@@ -2386,10 +2385,10 @@ class Tr {
2386
2385
  restoreState: e.get
2387
2386
  });
2388
2387
  this.isMounted = _.isMounted, this.mountFp = A(() => {
2389
- const h = () => {
2388
+ const d = () => {
2390
2389
  };
2391
- return c(_.mount(), pt(h, h));
2392
- }, { isTma: o, returns: "plain" }), this.mount = d(this.mountFp), this.unmount = _.unmount;
2390
+ return c(_.mount(), pt(d, d));
2391
+ }, { isTma: o, returns: "plain" }), this.mount = h(this.mountFp), this.unmount = _.unmount;
2393
2392
  const g = new tt({
2394
2393
  initialState: {
2395
2394
  bgColor: "bg_color",
@@ -2400,42 +2399,47 @@ class Tr {
2400
2399
  onChange: e.set
2401
2400
  });
2402
2401
  this.state = g.state;
2403
- const C = (h) => Et(h) ? h : P(u)[h], y = (h) => w(() => C(h()));
2402
+ const C = (d) => Et(d) ? d : O(u)[d], y = (d) => w(() => C(d()));
2404
2403
  this.isActive = g.getter("isActive"), this.isSupported = w(() => [
2405
2404
  "web_app_set_header_color",
2406
2405
  "web_app_set_background_color",
2407
2406
  "web_app_set_bottom_bar_color"
2408
- ].some((h) => ot(h, P(n))));
2407
+ ].some((d) => ot(d, O(n))));
2409
2408
  const S = j(!1);
2410
- this.isCssVarsBound = w(S), this.bindCssVarsFp = A((h) => {
2409
+ this.isCssVarsBound = w(S), this.bindCssVarsFp = A((d) => {
2411
2410
  if (S())
2412
2411
  return V(new Qt());
2413
- const [B, R] = Lt(() => {
2412
+ const [x, $] = Lt(() => {
2414
2413
  S.set(!1);
2415
- }), T = (O, G) => {
2414
+ }), T = (D, U) => {
2416
2415
  const H = () => {
2417
- Zt(O, G() || null);
2416
+ Zt(D, U() || null);
2418
2417
  };
2419
- H(), B(G.sub(H), Xt.bind(null, O));
2418
+ H(), x(U.sub(H), Xt.bind(null, D));
2420
2419
  };
2421
- return h || (h = (O) => `--tg-${le(O)}`), T(h("bgColor"), this.bgColorRgb), T(h("bottomBarColor"), this.bottomBarColorRgb), T(h("headerColor"), this.headerColorRgb), S.set(!0), I(R);
2422
- }, { isTma: o, returns: "either", isMounted: this.isMounted }), this.bindCssVars = d(this.bindCssVarsFp);
2423
- const f = (h) => {
2424
- const B = g.getter(h), R = y(B), T = {
2420
+ return d || (d = (D) => `--tg-${le(D)}`), T(d("bgColor"), this.bgColorRgb), T(d("bottomBarColor"), this.bottomBarColorRgb), T(d("headerColor"), this.headerColorRgb), S.set(!0), I($);
2421
+ }, { isTma: o, returns: "either", isMounted: this.isMounted }), this.bindCssVars = h(this.bindCssVarsFp);
2422
+ const f = (d) => {
2423
+ const x = g.getter(d), $ = y(x), T = {
2425
2424
  headerColor: "web_app_set_header_color",
2426
2425
  bgColor: "web_app_set_background_color",
2427
2426
  bottomBarColor: "web_app_set_bottom_bar_color"
2428
- }[h], O = A(
2429
- (G) => {
2430
- if (G === B())
2427
+ }[d], D = A(
2428
+ (U) => {
2429
+ if (U === x())
2431
2430
  return I(void 0);
2432
- if (T === "web_app_set_header_color" && (G === "bg_color" || G === "secondary_bg_color"))
2433
- return i("web_app_set_header_color", { color_key: G });
2434
- const H = C(G);
2431
+ if (T === "web_app_set_header_color" && (U === "bg_color" || U === "secondary_bg_color"))
2432
+ return c(
2433
+ i("web_app_set_header_color", { color_key: U }),
2434
+ P(() => {
2435
+ g.setState({ [d]: U });
2436
+ })
2437
+ );
2438
+ const H = C(U);
2435
2439
  return c(
2436
- H ? i(T, { color: H }) : V(new rr(G)),
2437
- D(() => {
2438
- g.setState({ [h]: H });
2440
+ H ? i(T, { color: H }) : V(new rr(U)),
2441
+ P(() => {
2442
+ g.setState({ [d]: H });
2439
2443
  })
2440
2444
  );
2441
2445
  },
@@ -2445,7 +2449,7 @@ class Tr {
2445
2449
  requires: T,
2446
2450
  isMounted: this.isMounted,
2447
2451
  returns: "either",
2448
- supports: h === "headerColor" ? {
2452
+ supports: d === "headerColor" ? {
2449
2453
  rgb: {
2450
2454
  method: "web_app_set_header_color",
2451
2455
  param: "color",
@@ -2454,7 +2458,7 @@ class Tr {
2454
2458
  } : void 0
2455
2459
  }
2456
2460
  );
2457
- return [B, R, d(O), O];
2461
+ return [x, $, h(D), D];
2458
2462
  };
2459
2463
  [
2460
2464
  this.bgColor,
@@ -2473,14 +2477,14 @@ class Tr {
2473
2477
  this.setBottomBarColorFp
2474
2478
  ] = f("bottomBarColor");
2475
2479
  const b = E({ isTma: o, returns: "either" });
2476
- this.closeFp = b((h) => i("web_app_close", { return_back: h })), this.close = d(this.closeFp), this.readyFp = b(() => i("web_app_ready")), this.ready = d(this.readyFp);
2480
+ this.closeFp = b((d) => i("web_app_close", { return_back: d })), this.close = h(this.closeFp), this.readyFp = b(() => i("web_app_ready")), this.ready = h(this.readyFp);
2477
2481
  }
2478
2482
  //#endregion
2479
2483
  }
2480
2484
  const $r = new Tr({
2481
2485
  ...c(
2482
2486
  F(),
2483
- L,
2487
+ R,
2484
2488
  v,
2485
2489
  et("miniApp")
2486
2490
  ),
@@ -2567,7 +2571,7 @@ class Rr {
2567
2571
  returns: "task"
2568
2572
  });
2569
2573
  this.isSupported = z("web_app_open_popup", e), this.isOpened = w(i), this.showFp = u((a) => c(
2570
- this.isOpened() ? $(new zt("A popup is already opened")) : q(void 0),
2574
+ this.isOpened() ? L(new zt("A popup is already opened")) : q(void 0),
2571
2575
  at(() => ve(Lr(a))),
2572
2576
  Z((p) => (i.set(!0), n("web_app_open_popup", "popup_closed", {
2573
2577
  ...a,
@@ -2577,21 +2581,21 @@ class Rr {
2577
2581
  (p) => (o(), p),
2578
2582
  (p) => (o(), p.button_id)
2579
2583
  )
2580
- )), this.show = d(this.showFp);
2584
+ )), this.show = h(this.showFp);
2581
2585
  }
2582
2586
  }
2583
- const Un = new Rr(c(F(), U, v));
2587
+ const Un = new Rr(c(F(), G, v));
2584
2588
  function Pr({ request: s, ...e }) {
2585
2589
  return A((r) => c(
2586
2590
  s("web_app_request_phone", "phone_requested", r),
2587
- x((n) => n.status)
2591
+ B((n) => n.status)
2588
2592
  ), { ...e, requires: "web_app_request_phone", returns: "task" });
2589
2593
  }
2590
2594
  const qe = Pr(c(
2591
2595
  F(),
2592
2596
  v,
2593
- U
2594
- )), Gn = d(qe);
2597
+ G
2598
+ )), Gn = h(qe);
2595
2599
  function Or({
2596
2600
  invokeCustomMethod: s,
2597
2601
  requestPhoneAccess: e,
@@ -2605,7 +2609,7 @@ function Or({
2605
2609
  at((a) => {
2606
2610
  const p = qt(J(), a);
2607
2611
  if (!p.success)
2608
- return $(new Ft(a, p.issues));
2612
+ return L(new Ft(a, p.issues));
2609
2613
  if (!p.output)
2610
2614
  return q(void 0);
2611
2615
  const l = qt(
@@ -2627,7 +2631,7 @@ function Or({
2627
2631
  ),
2628
2632
  p.output
2629
2633
  );
2630
- return l.success ? q({ raw: p.output, parsed: l.output }) : $(new Ft(p.output, l.issues));
2634
+ return l.success ? q({ raw: p.output, parsed: l.output }) : L(new Ft(p.output, l.issues));
2631
2635
  })
2632
2636
  ), i = (u) => c(
2633
2637
  n(u),
@@ -2638,7 +2642,7 @@ function Or({
2638
2642
  (a) => Ft.is(a) ? V(a) : I(void 0),
2639
2643
  (a) => I(a)
2640
2644
  )
2641
- ), o = (u) => xt(
2645
+ ), o = (u) => Bt(
2642
2646
  async (a, p, l) => {
2643
2647
  let m = 50;
2644
2648
  for (; !l.isRejected; ) {
@@ -2652,12 +2656,12 @@ function Or({
2652
2656
  },
2653
2657
  u
2654
2658
  );
2655
- return A((u) => xt.fn((a) => c(
2659
+ return A((u) => Bt.fn((a) => c(
2656
2660
  // Try to get the requested contact. Probably, we already requested it before.
2657
2661
  i(a),
2658
2662
  Z((p) => p ? q(p) : c(
2659
2663
  e(a),
2660
- at((l) => l === "sent" ? o(a) : $(new ye("User denied access")))
2664
+ at((l) => l === "sent" ? o(a) : L(new ye("User denied access")))
2661
2665
  ))
2662
2666
  ), u), { ...r, returns: "task", requires: "web_app_request_phone" });
2663
2667
  }
@@ -2670,26 +2674,26 @@ function Dr({ requestContact: s, ...e }) {
2670
2674
  const Me = Or({
2671
2675
  ...c(F(), Yt, v),
2672
2676
  requestPhoneAccess: qe
2673
- }), jn = d(Me), Ur = Dr({
2677
+ }), jn = h(Me), Ur = Dr({
2674
2678
  ...c(F(), v),
2675
2679
  requestContact(s) {
2676
2680
  return c(
2677
2681
  Me(s),
2678
- x((e) => e.parsed)
2682
+ B((e) => e.parsed)
2679
2683
  );
2680
2684
  }
2681
- }), Hn = d(Ur);
2685
+ }), Hn = h(Ur);
2682
2686
  function Gr({ request: s, ...e }) {
2683
2687
  return A((r) => c(
2684
2688
  s("web_app_request_write_access", "write_access_requested", r),
2685
- x((n) => n.status)
2689
+ B((n) => n.status)
2686
2690
  ), { ...e, requires: "web_app_request_write_access", returns: "task" });
2687
2691
  }
2688
2692
  const jr = Gr(c(
2689
2693
  F(),
2690
2694
  v,
2691
- U
2692
- )), Wn = d(jr);
2695
+ G
2696
+ )), Wn = h(jr);
2693
2697
  class Hr {
2694
2698
  constructor({
2695
2699
  version: e,
@@ -2716,7 +2720,7 @@ class Hr {
2716
2720
  * @since Mini Apps v6.4
2717
2721
  * @example
2718
2722
  * pipe(
2719
- * qrScanner.captureOneFp({
2723
+ * qrScanner.captureFp({
2720
2724
  * capture(scannedQr) {
2721
2725
  * return scannedQr === 'any expected by me qr';
2722
2726
  * }
@@ -2789,24 +2793,24 @@ class Hr {
2789
2793
  _.capture(C) && (g = C, this.close());
2790
2794
  }
2791
2795
  }),
2792
- x(() => g)
2796
+ B(() => g)
2793
2797
  );
2794
- }), this.closeFp = a(() => c(o("web_app_close_scan_qr_popup"), D(m))), this.openFp = p((_) => c(
2795
- this.isOpened() ? $(new zt("The QR Scanner is already opened")) : async () => o("web_app_open_scan_qr_popup", { text: _.text }),
2798
+ }), this.closeFp = a(() => c(o("web_app_close_scan_qr_popup"), P(m))), this.openFp = p((_) => c(
2799
+ this.isOpened() ? L(new zt("The QR Scanner is already opened")) : async () => o("web_app_open_scan_qr_popup", { text: _.text }),
2796
2800
  at(() => {
2797
2801
  const [g, C] = Lt(), y = (S) => (C(), S);
2798
2802
  return c(
2799
- xt((S) => {
2803
+ Bt((S) => {
2800
2804
  g(r(S), n(_.onCaptured));
2801
2805
  }, _),
2802
2806
  Wt(y, y)
2803
2807
  );
2804
2808
  })
2805
- )), this.open = d(this.openFp), this.capture = d(this.captureFp), this.close = d(this.closeFp);
2809
+ )), this.open = h(this.openFp), this.capture = h(this.captureFp), this.close = h(this.closeFp);
2806
2810
  }
2807
2811
  }
2808
2812
  const Kn = new Hr({
2809
- ...c(F(), L, v),
2813
+ ...c(F(), R, v),
2810
2814
  onClosed(s) {
2811
2815
  return Y("scan_qr_popup_closed", s);
2812
2816
  },
@@ -3063,7 +3067,7 @@ class Wr {
3063
3067
  })
3064
3068
  }), i = (o, u) => {
3065
3069
  const a = n.stateGetter(o);
3066
- return w(() => a() || P(u));
3070
+ return w(() => a() || O(u));
3067
3071
  };
3068
3072
  this.isSupported = z("web_app_setup_secondary_button", r.version), this.bgColor = i("bgColor", e.bgColor), this.textColor = i("textColor", e.textColor), this.position = n.stateGetter("position"), this.hasShineEffect = n.stateGetter("hasShineEffect"), this.isEnabled = n.stateGetter("isEnabled"), this.isLoaderVisible = n.stateGetter("isLoaderVisible"), this.text = n.stateGetter("text"), this.isVisible = n.stateGetter("isVisible"), this.isMounted = n.isMounted, this.state = n.state, [this.setPosition, this.setPositionFp] = n.stateSetters("position"), [this.setBgColor, this.setBgColorFp] = n.stateSetters("bgColor"), [this.setTextColor, this.setTextColorFp] = n.stateSetters("textColor"), [
3069
3073
  [this.disableShineEffect, this.disableShineEffectFp],
@@ -3079,7 +3083,7 @@ class Wr {
3079
3083
  //#endregion
3080
3084
  }
3081
3085
  const Qn = new Wr(
3082
- Be("secondaryButton", "secondary_button_pressed", {
3086
+ xe("secondaryButton", "secondary_button_pressed", {
3083
3087
  bgColor: w(() => $r.bottomBarColorRgb() || "#000000"),
3084
3088
  textColor: w(() => vt.buttonColor() || "#2481cc")
3085
3089
  })
@@ -3245,7 +3249,7 @@ class Qr {
3245
3249
  const C = { isVerticalEnabled: g };
3246
3250
  return u.hasDiff(C) ? c(
3247
3251
  e("web_app_setup_swipe_behavior", { allow_vertical_swipe: g }),
3248
- D(() => {
3252
+ P(() => {
3249
3253
  u.setState(C);
3250
3254
  })
3251
3255
  ) : I(void 0);
@@ -3254,12 +3258,12 @@ class Qr {
3254
3258
  const g = () => {
3255
3259
  };
3256
3260
  return c(a.mount(), pt(g, g));
3257
- }), this.unmount = a.unmount, this.disableVertical = d(this.disableVerticalFp), this.enableVertical = d(this.enableVerticalFp), this.mount = d(this.mountFp);
3261
+ }), this.unmount = a.unmount, this.disableVertical = h(this.disableVerticalFp), this.enableVertical = h(this.enableVerticalFp), this.mount = h(this.mountFp);
3258
3262
  }
3259
3263
  }
3260
3264
  const Nn = new Qr(c(
3261
3265
  F(),
3262
- L,
3266
+ R,
3263
3267
  v,
3264
3268
  et("swipeBehavior")
3265
3269
  ));
@@ -3285,14 +3289,14 @@ function zr({ request: s, ...e }) {
3285
3289
  "file_download_requested",
3286
3290
  { ...i, params: { url: r, file_name: n } }
3287
3291
  ),
3288
- Z((o) => o.status === "downloading" ? q(void 0) : $(new ye("User denied the action")))
3292
+ Z((o) => o.status === "downloading" ? q(void 0) : L(new ye("User denied the action")))
3289
3293
  ), { ...e, requires: "web_app_request_file_download", returns: "task" });
3290
3294
  }
3291
3295
  const Nr = zr(c(
3292
3296
  F(),
3293
- U,
3297
+ G,
3294
3298
  v
3295
- )), Yn = d(Nr);
3299
+ )), Yn = h(Nr);
3296
3300
  function Jr({ invokeCustomMethod: s, ...e }) {
3297
3301
  return A((r) => c(
3298
3302
  s("getCurrentTime", {}, r),
@@ -3301,7 +3305,7 @@ function Jr({ invokeCustomMethod: s, ...e }) {
3301
3305
  pe(fe(), ts(), he((o) => new Date(o * 1e3)), de()),
3302
3306
  n
3303
3307
  );
3304
- return i.success ? q(i.output) : $(new Ft(n, i.issues));
3308
+ return i.success ? q(i.output) : L(new Ft(n, i.issues));
3305
3309
  })
3306
3310
  ), { ...e, requires: "web_app_invoke_custom_method", returns: "task" });
3307
3311
  }
@@ -3309,15 +3313,15 @@ const Yr = Jr(c(
3309
3313
  F(),
3310
3314
  Yt,
3311
3315
  v
3312
- )), Zn = d(Yr);
3316
+ )), Zn = h(Yr);
3313
3317
  function Zr({ postEvent: s, ...e }) {
3314
3318
  return A(() => s("web_app_hide_keyboard"), { ...e, returns: "either", requires: "web_app_hide_keyboard" });
3315
3319
  }
3316
3320
  const Xr = Zr(c(
3317
3321
  F(),
3318
- L,
3322
+ R,
3319
3323
  v
3320
- )), Xn = d(Xr);
3324
+ )), Xn = h(Xr);
3321
3325
  function tn({ request: s, createRequestId: e, ...r }) {
3322
3326
  return A((n) => {
3323
3327
  const i = e();
@@ -3327,7 +3331,7 @@ function tn({ request: s, createRequestId: e, ...r }) {
3327
3331
  params: { req_id: i },
3328
3332
  capture: Ge(i)
3329
3333
  }),
3330
- x(({ data: o = null }) => o)
3334
+ B(({ data: o = null }) => o)
3331
3335
  );
3332
3336
  }, { ...r, requires: "web_app_read_text_from_clipboard", returns: "task" });
3333
3337
  }
@@ -3335,10 +3339,10 @@ const en = tn({
3335
3339
  ...c(
3336
3340
  F(),
3337
3341
  v,
3338
- U
3342
+ G
3339
3343
  ),
3340
3344
  createRequestId: Ae
3341
- }), to = d(en);
3345
+ }), to = h(en);
3342
3346
  function sn(s) {
3343
3347
  const e = {}, r = s.match(/Telegram-Android(?:\/([^ ]+))?(?: (\([^)]+\))?|$)/);
3344
3348
  if (r) {
@@ -3366,7 +3370,7 @@ function rn({ postEvent: s, ...e }) {
3366
3370
  ) : s("web_app_data_send", { data: r });
3367
3371
  }, { ...e, returns: "either" });
3368
3372
  }
3369
- const nn = rn(c(F(), L)), so = d(nn);
3373
+ const nn = rn(c(F(), R)), so = h(nn);
3370
3374
  function on({ request: s, ...e }) {
3371
3375
  return A((r, n) => c(
3372
3376
  s(
@@ -3377,14 +3381,14 @@ function on({ request: s, ...e }) {
3377
3381
  params: { id: r }
3378
3382
  }
3379
3383
  ),
3380
- Z((i) => i && "error" in i ? $(new sr(i.error)) : q(void 0))
3384
+ Z((i) => i && "error" in i ? L(new sr(i.error)) : q(void 0))
3381
3385
  ), { ...e, requires: "web_app_send_prepared_message", returns: "task" });
3382
3386
  }
3383
3387
  const an = on(c(
3384
3388
  F(),
3385
- U,
3389
+ G,
3386
3390
  v
3387
- )), ro = d(an);
3391
+ )), ro = h(an);
3388
3392
  function un({ postEvent: s, ...e }) {
3389
3393
  return A((r, n = {}) => s("web_app_share_to_story", {
3390
3394
  text: n.text,
@@ -3394,9 +3398,9 @@ function un({ postEvent: s, ...e }) {
3394
3398
  }
3395
3399
  const cn = un(c(
3396
3400
  F(),
3397
- L,
3401
+ R,
3398
3402
  v
3399
- )), no = d(cn), $t = /* @__PURE__ */ _t(!1);
3403
+ )), no = h(cn), $t = /* @__PURE__ */ _t(!1);
3400
3404
  function ln({ isInlineMode: s, postEvent: e, ...r }) {
3401
3405
  return A((n, i) => e("web_app_switch_inline_query", {
3402
3406
  query: n,
@@ -3404,7 +3408,7 @@ function ln({ isInlineMode: s, postEvent: e, ...r }) {
3404
3408
  }), {
3405
3409
  ...r,
3406
3410
  requires: {
3407
- every: ["web_app_switch_inline_query", () => P(s) ? void 0 : "The application must be launched in the inline mode"]
3411
+ every: ["web_app_switch_inline_query", () => O(s) ? void 0 : "The application must be launched in the inline mode"]
3408
3412
  },
3409
3413
  returns: "either"
3410
3414
  });
@@ -3412,11 +3416,11 @@ function ln({ isInlineMode: s, postEvent: e, ...r }) {
3412
3416
  const pn = ln({
3413
3417
  ...c(
3414
3418
  F(),
3415
- L,
3419
+ R,
3416
3420
  v
3417
3421
  ),
3418
3422
  isInlineMode: $t
3419
- }), oo = d(pn);
3423
+ }), oo = h(pn);
3420
3424
  class hn {
3421
3425
  constructor({
3422
3426
  storage: e,
@@ -3623,7 +3627,7 @@ class hn {
3623
3627
  * @see expandFp
3624
3628
  */
3625
3629
  t(this, "expand");
3626
- const b = { top: 0, right: 0, left: 0, bottom: 0 }, h = new tt({
3630
+ const b = { top: 0, right: 0, left: 0, bottom: 0 }, d = new tt({
3627
3631
  initialState: {
3628
3632
  contentSafeAreaInsets: b,
3629
3633
  height: 0,
@@ -3634,24 +3638,24 @@ class hn {
3634
3638
  width: 0
3635
3639
  },
3636
3640
  onChange: e.set
3637
- }), B = (k) => {
3638
- h.setState({
3641
+ }), x = (k) => {
3642
+ d.setState({
3639
3643
  isExpanded: k.is_expanded,
3640
3644
  height: k.height,
3641
3645
  width: k.width,
3642
3646
  stableHeight: k.is_state_stable ? k.height : void 0
3643
3647
  });
3644
- }, R = (k) => {
3645
- h.setState({ isFullscreen: k.is_fullscreen });
3648
+ }, $ = (k) => {
3649
+ d.setState({ isFullscreen: k.is_fullscreen });
3646
3650
  }, T = (k) => {
3647
- h.setState({ safeAreaInsets: k });
3648
- }, O = (k) => {
3649
- h.setState({ contentSafeAreaInsets: k });
3650
- }, G = new Jt({
3651
+ d.setState({ safeAreaInsets: k });
3652
+ }, D = (k) => {
3653
+ d.setState({ contentSafeAreaInsets: k });
3654
+ }, U = new Jt({
3651
3655
  initialState(k) {
3652
3656
  const st = (N) => () => {
3653
3657
  const [X, W] = N === "safe-area" ? ["web_app_request_safe_area", "safe_area_changed"] : ["web_app_request_content_safe_area", "content_safe_area_changed"];
3654
- return ot(X, P(S)) ? _(X, W, k) : q({ top: 0, left: 0, right: 0, bottom: 0 });
3658
+ return ot(X, O(S)) ? _(X, W, k) : q({ top: 0, left: 0, right: 0, bottom: 0 });
3655
3659
  }, M = (N) => () => typeof N == "boolean" ? q(N) : ve(N());
3656
3660
  return c(
3657
3661
  Js,
@@ -3667,7 +3671,7 @@ class hn {
3667
3671
  width: window.innerWidth
3668
3672
  }) : c(
3669
3673
  _("web_app_request_viewport", "viewport_changed", k),
3670
- x((W) => ({
3674
+ B((W) => ({
3671
3675
  ...X,
3672
3676
  height: W.height,
3673
3677
  isExpanded: W.is_expanded,
@@ -3679,14 +3683,14 @@ class hn {
3679
3683
  },
3680
3684
  isPageReload: r,
3681
3685
  onMounted(k) {
3682
- o(B), u(R), i(T), n(O), h.setState(k);
3686
+ o(x), u($), i(T), n(D), d.setState(k);
3683
3687
  },
3684
3688
  onUnmounted() {
3685
- m(B), p(R), l(T), a(O);
3689
+ m(x), p($), l(T), a(D);
3686
3690
  },
3687
3691
  restoreState: e.get
3688
3692
  }), H = (k) => w(() => this.safeAreaInsets()[k]), bt = (k) => w(() => this.contentSafeAreaInsets()[k]);
3689
- this.state = h.state, this.height = h.getter("height"), this.stableHeight = h.getter("stableHeight"), this.width = h.getter("width"), this.isExpanded = h.getter("isExpanded"), this.safeAreaInsets = h.getter("safeAreaInsets"), this.safeAreaInsetTop = H("top"), this.safeAreaInsetBottom = H("bottom"), this.safeAreaInsetLeft = H("left"), this.safeAreaInsetRight = H("right"), this.contentSafeAreaInsets = h.getter("contentSafeAreaInsets"), this.contentSafeAreaInsetTop = bt("top"), this.contentSafeAreaInsetBottom = bt("bottom"), this.contentSafeAreaInsetLeft = bt("left"), this.contentSafeAreaInsetRight = bt("right");
3693
+ this.state = d.state, this.height = d.getter("height"), this.stableHeight = d.getter("stableHeight"), this.width = d.getter("width"), this.isExpanded = d.getter("isExpanded"), this.safeAreaInsets = d.getter("safeAreaInsets"), this.safeAreaInsetTop = H("top"), this.safeAreaInsetBottom = H("bottom"), this.safeAreaInsetLeft = H("left"), this.safeAreaInsetRight = H("right"), this.contentSafeAreaInsets = d.getter("contentSafeAreaInsets"), this.contentSafeAreaInsetTop = bt("top"), this.contentSafeAreaInsetBottom = bt("bottom"), this.contentSafeAreaInsetLeft = bt("left"), this.contentSafeAreaInsetRight = bt("right");
3690
3694
  const Ve = E({ isTma: y, returns: "task" }), te = E({
3691
3695
  isTma: y,
3692
3696
  returns: "either"
@@ -3701,9 +3705,9 @@ class hn {
3701
3705
  ["fullscreen_changed", "fullscreen_failed"],
3702
3706
  st
3703
3707
  ),
3704
- Z((M) => "error" in M && M.error !== "ALREADY_FULLSCREEN" ? $(new er(M.error)) : (h.setState({ isFullscreen: "is_fullscreen" in M ? M.is_fullscreen : !0 }), q(void 0)))
3708
+ Z((M) => "error" in M && M.error !== "ALREADY_FULLSCREEN" ? L(new er(M.error)) : (d.setState({ isFullscreen: "is_fullscreen" in M ? M.is_fullscreen : !0 }), q(void 0)))
3705
3709
  ));
3706
- this.isMounted = G.isMounted, this.mountFp = Ve(G.mount), this.mount = d(this.mountFp), this.isFullscreen = h.getter("isFullscreen"), this.requestFullscreenFp = ee(!0), this.requestFullscreen = d(this.requestFullscreenFp), this.exitFullscreenFp = ee(!1), this.exitFullscreen = d(this.exitFullscreenFp);
3710
+ this.isMounted = U.isMounted, this.mountFp = Ve(U.mount), this.mount = h(this.mountFp), this.isFullscreen = d.getter("isFullscreen"), this.requestFullscreenFp = ee(!0), this.requestFullscreen = h(this.requestFullscreenFp), this.exitFullscreenFp = ee(!1), this.exitFullscreen = h(this.exitFullscreenFp);
3707
3711
  const gt = j(!1);
3708
3712
  this.isCssVarsBound = w(gt), this.bindCssVarsFp = te(
3709
3713
  (k) => {
@@ -3740,7 +3744,7 @@ class hn {
3740
3744
  }), gt.set(!1);
3741
3745
  });
3742
3746
  }
3743
- ), this.bindCssVars = d(this.bindCssVarsFp), this.expandFp = te(() => f("web_app_expand")), this.expand = d(this.expandFp);
3747
+ ), this.bindCssVars = h(this.bindCssVarsFp), this.expandFp = te(() => f("web_app_expand")), this.expand = h(this.expandFp);
3744
3748
  }
3745
3749
  //#endregion
3746
3750
  }
@@ -3758,14 +3762,14 @@ function dn() {
3758
3762
  F(),
3759
3763
  et("viewport"),
3760
3764
  v,
3761
- L,
3762
- U
3765
+ R,
3766
+ G
3763
3767
  ),
3764
3768
  isFullscreen() {
3765
- return c(St(), D((o) => !!o.tgWebAppFullscreen));
3769
+ return c(St(), P((o) => !!o.tgWebAppFullscreen));
3766
3770
  },
3767
3771
  isViewportStable() {
3768
- return c(St(), D((o) => ["macos", "tdesktop", "unigram", "webk", "weba", "web"].includes(o.tgWebAppPlatform)));
3772
+ return c(St(), P((o) => ["macos", "tdesktop", "unigram", "webk", "weba", "web"].includes(o.tgWebAppPlatform)));
3769
3773
  },
3770
3774
  offContentSafeAreaInsetsChanged: i.off,
3771
3775
  offFullscreenChanged: r.off,
@@ -3815,7 +3819,7 @@ function fn(s = {}) {
3815
3819
  }
3816
3820
  return c(
3817
3821
  mt("iframe_ready", { reload_supported: !0 }),
3818
- D(() => (re().log("The package was initialized"), o))
3822
+ P(() => (re().log("The package was initialized"), o))
3819
3823
  );
3820
3824
  }
3821
3825
  const ao = yt(fn);
@@ -3838,7 +3842,7 @@ export {
3838
3842
  vr as Invoice,
3839
3843
  ho as InvokeCustomMethodFailedError,
3840
3844
  fo as LaunchParamsRetrieveError,
3841
- xr as LocationManager,
3845
+ Br as LocationManager,
3842
3846
  qr as MainButton,
3843
3847
  _o as MethodParameterUnsupportedError,
3844
3848
  mo as MethodUnsupportedError,
@@ -3877,10 +3881,10 @@ export {
3877
3881
  Eo as decodeBase64UrlFp,
3878
3882
  Ao as decodeStartParam,
3879
3883
  Io as decodeStartParamFp,
3880
- Bo as deepSnakeToCamelObjKeys,
3884
+ xo as deepSnakeToCamelObjKeys,
3881
3885
  Yn as downloadFile,
3882
3886
  Nr as downloadFileFp,
3883
- xo as emitEvent,
3887
+ Bo as emitEvent,
3884
3888
  qo as encodeBase64Url,
3885
3889
  Zn as getCurrentTime,
3886
3890
  Yr as getCurrentTimeFp,
@@ -3894,7 +3898,7 @@ export {
3894
3898
  $n as invoice,
3895
3899
  hr as invokeCustomMethod,
3896
3900
  Zo as isAnyRGB,
3897
- xe as isColorDark,
3901
+ Be as isColorDark,
3898
3902
  Mr as isColorDarkFp,
3899
3903
  Xo as isRGB,
3900
3904
  ti as isRGBA,
@@ -3930,7 +3934,7 @@ export {
3930
3934
  jn as requestContactComplete,
3931
3935
  Me as requestContactCompleteFp,
3932
3936
  Ur as requestContactFp,
3933
- Bn as requestEmojiStatusAccess,
3937
+ xn as requestEmojiStatusAccess,
3934
3938
  fr as requestEmojiStatusAccessFp,
3935
3939
  Ee as requestFp,
3936
3940
  Gn as requestPhoneAccess,
@@ -3951,7 +3955,7 @@ export {
3951
3955
  ai as serializeInitDataQuery,
3952
3956
  ui as serializeLaunchParamsQuery,
3953
3957
  Qo as setDebug,
3954
- xn as setEmojiStatus,
3958
+ Bn as setEmojiStatus,
3955
3959
  mr as setEmojiStatusFp,
3956
3960
  zo as setTargetOrigin,
3957
3961
  zn as settingsButton,