@tma.js/sdk 1.4.0 → 1.4.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.mjs CHANGED
@@ -339,7 +339,7 @@ function wt() {
339
339
  user: rt().optional()
340
340
  }, "InitData");
341
341
  }
342
- function tr(r) {
342
+ function er(r) {
343
343
  return wt().parse(r);
344
344
  }
345
345
  function Nt(r) {
@@ -358,7 +358,7 @@ const _t = L(
358
358
  function bt(r) {
359
359
  return _t().parse(r);
360
360
  }
361
- function er(r = {}) {
361
+ function rr(r = {}) {
362
362
  return m("web_app_request_theme", "theme_changed", r).then(bt);
363
363
  }
364
364
  function Ut(r) {
@@ -695,7 +695,7 @@ function Ct() {
695
695
  const t = Yt();
696
696
  return window[st] = t, Zt(t.launchParams), t;
697
697
  }
698
- function rr() {
698
+ function sr() {
699
699
  try {
700
700
  return Ct(), !0;
701
701
  } catch {
@@ -782,14 +782,14 @@ class Pt {
782
782
  }
783
783
  let kt = "https://web.telegram.org";
784
784
  const V = new Pt("[SDK]", !1);
785
- function sr(r) {
785
+ function nr(r) {
786
786
  if (r) {
787
787
  V.enable();
788
788
  return;
789
789
  }
790
790
  V.disable();
791
791
  }
792
- function nr(r) {
792
+ function ir(r) {
793
793
  kt = r;
794
794
  }
795
795
  function ee() {
@@ -799,12 +799,15 @@ const re = f({
799
799
  eventType: u(),
800
800
  eventData: (r) => r
801
801
  });
802
- function se(r, t) {
802
+ function se(r) {
803
+ return re.parse(r);
804
+ }
805
+ function ne(r, t) {
803
806
  window.dispatchEvent(new MessageEvent("message", {
804
807
  data: JSON.stringify({ eventType: r, eventData: t })
805
808
  }));
806
809
  }
807
- function ne() {
810
+ function ie() {
808
811
  const r = window;
809
812
  "TelegramGameProxy_receiveEvent" in r || [
810
813
  ["TelegramGameProxy_receiveEvent"],
@@ -817,55 +820,55 @@ function ne() {
817
820
  let e = r;
818
821
  t.forEach((s, n, i) => {
819
822
  if (n === i.length - 1) {
820
- e[s] = se;
823
+ e[s] = ne;
821
824
  return;
822
825
  }
823
826
  s in e || (e[s] = {}), e = e[s];
824
827
  });
825
828
  });
826
829
  }
827
- function ie(r) {
828
- ne(), window.addEventListener("message", (t) => {
830
+ function oe(r) {
831
+ ie(), window.addEventListener("message", (t) => {
829
832
  try {
830
- const { eventType: e, eventData: s } = re.parse(t.data);
833
+ const { eventType: e, eventData: s } = se(t.data);
831
834
  r(e, s);
832
835
  } catch {
833
836
  }
834
837
  });
835
838
  }
836
- function oe() {
839
+ function ae() {
837
840
  return f({
838
841
  req_id: u(),
839
842
  data: (r) => r === null ? r : u().optional().parse(r)
840
843
  });
841
844
  }
842
- function ae() {
845
+ function ce() {
843
846
  return f({
844
847
  req_id: u(),
845
848
  result: (r) => r,
846
849
  error: u().optional()
847
850
  });
848
851
  }
849
- function ce() {
852
+ function ue() {
850
853
  return f({
851
854
  slug: u(),
852
855
  status: u()
853
856
  });
854
857
  }
855
- function ue() {
858
+ function he() {
856
859
  return f({ status: u() });
857
860
  }
858
- function he() {
861
+ function pe() {
859
862
  return f({
860
863
  button_id: (r) => r == null ? void 0 : u().parse(r)
861
864
  });
862
865
  }
863
- function pe() {
866
+ function le() {
864
867
  return f({
865
868
  data: u().optional()
866
869
  });
867
870
  }
868
- function le() {
871
+ function de() {
869
872
  return f({
870
873
  theme_params: (r) => {
871
874
  const t = gt().optional();
@@ -873,7 +876,7 @@ function le() {
873
876
  }
874
877
  });
875
878
  }
876
- function de() {
879
+ function fe() {
877
880
  return f({
878
881
  height: q(),
879
882
  width: (r) => r == null ? window.innerWidth : q().parse(r),
@@ -881,10 +884,10 @@ function de() {
881
884
  is_expanded: k()
882
885
  });
883
886
  }
884
- function fe() {
887
+ function ge() {
885
888
  return f({ status: u() });
886
889
  }
887
- function ge() {
890
+ function we() {
888
891
  const r = new w(), t = (e, ...s) => {
889
892
  V.log("Emitting processed event:", e, ...s), r.emit(e, ...s);
890
893
  };
@@ -895,33 +898,33 @@ function ge() {
895
898
  is_state_stable: !0,
896
899
  is_expanded: !0
897
900
  });
898
- }), ie((e, s) => {
901
+ }), oe((e, s) => {
899
902
  V.log("Received raw event:", e, s);
900
903
  try {
901
904
  switch (e) {
902
905
  case "viewport_changed":
903
- return t(e, de().parse(s));
906
+ return t(e, fe().parse(s));
904
907
  case "theme_changed":
905
- return t(e, le().parse(s));
908
+ return t(e, de().parse(s));
906
909
  case "popup_closed":
907
910
  return (
908
911
  // Sent on desktop.
909
- s == null ? t(e, {}) : t(e, he().parse(s))
912
+ s == null ? t(e, {}) : t(e, pe().parse(s))
910
913
  );
911
914
  case "set_custom_style":
912
915
  return t(e, u().parse(s));
913
916
  case "qr_text_received":
914
- return t(e, pe().parse(s));
917
+ return t(e, le().parse(s));
915
918
  case "clipboard_text_received":
916
- return t(e, oe().parse(s));
919
+ return t(e, ae().parse(s));
917
920
  case "invoice_closed":
918
- return t(e, ce().parse(s));
921
+ return t(e, ue().parse(s));
919
922
  case "phone_requested":
920
- return t("phone_requested", ue().parse(s));
923
+ return t("phone_requested", he().parse(s));
921
924
  case "custom_method_invoked":
922
- return t("custom_method_invoked", ae().parse(s));
925
+ return t("custom_method_invoked", ce().parse(s));
923
926
  case "write_access_requested":
924
- return t("write_access_requested", fe().parse(s));
927
+ return t("write_access_requested", ge().parse(s));
925
928
  case "main_button_pressed":
926
929
  case "back_button_pressed":
927
930
  case "settings_button_pressed":
@@ -939,7 +942,7 @@ function ge() {
939
942
  const Q = "telegram-mini-apps-cached-emitter";
940
943
  function U() {
941
944
  const r = window;
942
- return r[Q] === void 0 && (r[Q] = ge()), r[Q];
945
+ return r[Q] === void 0 && (r[Q] = we()), r[Q];
943
946
  }
944
947
  function $(r, t) {
945
948
  U().off(r, t);
@@ -947,16 +950,16 @@ function $(r, t) {
947
950
  function y(r, t) {
948
951
  return U().on(r, t), () => $(r, t);
949
952
  }
950
- function ir(r, t) {
953
+ function or(r, t) {
951
954
  return U().once(r, t), () => $(r, t);
952
955
  }
953
- function we(r) {
956
+ function _e(r) {
954
957
  U().unsubscribe(r);
955
958
  }
956
- function or(r) {
957
- return U().subscribe(r), () => we(r);
959
+ function ar(r) {
960
+ return U().subscribe(r), () => _e(r);
958
961
  }
959
- function _e(r, t) {
962
+ function be(r, t) {
960
963
  const e = r.split("."), s = t.split("."), n = Math.max(e.length, s.length);
961
964
  for (let i = 0; i < n; i += 1) {
962
965
  const a = parseInt(e[i] || "0", 10), c = parseInt(s[i] || "0", 10);
@@ -966,7 +969,7 @@ function _e(r, t) {
966
969
  return 0;
967
970
  }
968
971
  function P(r, t) {
969
- return _e(r, t) <= 0;
972
+ return be(r, t) <= 0;
970
973
  }
971
974
  function R(r, t, e) {
972
975
  if (typeof e == "string") {
@@ -1033,7 +1036,7 @@ function d(r, t, e) {
1033
1036
  "Unable to determine current environment and possible way to send event."
1034
1037
  );
1035
1038
  }
1036
- function be(r) {
1039
+ function me(r) {
1037
1040
  return (t, e) => {
1038
1041
  if (!R(t, r))
1039
1042
  throw new tt(t, r);
@@ -1050,15 +1053,15 @@ class J extends Error {
1050
1053
  super(`Async call timeout exceeded. Timeout: ${t}`), Object.setPrototypeOf(this, J.prototype);
1051
1054
  }
1052
1055
  }
1053
- function ar(r) {
1056
+ function cr(r) {
1054
1057
  return r instanceof J;
1055
1058
  }
1056
- function me(r) {
1059
+ function ye(r) {
1057
1060
  return new Promise((t) => {
1058
1061
  setTimeout(t, r);
1059
1062
  });
1060
1063
  }
1061
- function ye(r) {
1064
+ function Ee(r) {
1062
1065
  return new Promise((t, e) => {
1063
1066
  setTimeout(e, r, new J(r));
1064
1067
  });
@@ -1066,7 +1069,7 @@ function ye(r) {
1066
1069
  function xt(r, t) {
1067
1070
  return Promise.race([
1068
1071
  r(),
1069
- ye(t)
1072
+ Ee(t)
1070
1073
  ]);
1071
1074
  }
1072
1075
  function m(r, t, e, s) {
@@ -1099,7 +1102,7 @@ async function O(r, t, e, s = {}) {
1099
1102
  throw new Error(i);
1100
1103
  return n;
1101
1104
  }
1102
- class Ee {
1105
+ class Ce {
1103
1106
  constructor(t, e, s = d) {
1104
1107
  o(this, "ee", new w());
1105
1108
  o(this, "state");
@@ -1149,22 +1152,22 @@ class Ee {
1149
1152
  function nt(r, t) {
1150
1153
  return r + (r.length > 0 && t.length > 0 ? ` ${t}` : t);
1151
1154
  }
1152
- function Ce(...r) {
1155
+ function ve(...r) {
1153
1156
  return r.reduce((t, e) => {
1154
1157
  let s = "";
1155
1158
  return typeof e == "string" ? s = e : typeof e == "object" && e !== null && (s = Object.entries(e).reduce((n, [i, a]) => a ? nt(n, i) : n, "")), nt(t, s);
1156
1159
  }, "");
1157
1160
  }
1158
- function ve(r) {
1161
+ function Pe(r) {
1159
1162
  return typeof r == "object" && r !== null && !Array.isArray(null);
1160
1163
  }
1161
- function cr(...r) {
1162
- return r.reduce((t, e) => (ve(e) && Object.entries(e).forEach(([s, n]) => {
1163
- const i = Ce(t[s], n);
1164
+ function ur(...r) {
1165
+ return r.reduce((t, e) => (Pe(e) && Object.entries(e).forEach(([s, n]) => {
1166
+ const i = ve(t[s], n);
1164
1167
  i.length > 0 && (t[s] = i);
1165
1168
  }), t), {});
1166
1169
  }
1167
- class Pe {
1170
+ class ke {
1168
1171
  constructor(t, e = d) {
1169
1172
  o(this, "ee", new w());
1170
1173
  o(this, "state");
@@ -1206,7 +1209,7 @@ class Pe {
1206
1209
  function it(r, t) {
1207
1210
  return r.reduce((e, s) => (e[s] = t, e), {});
1208
1211
  }
1209
- class ke {
1212
+ class Se {
1210
1213
  constructor(t, e, s = d) {
1211
1214
  /**
1212
1215
  * Checks if specified method is supported by current component.
@@ -1275,7 +1278,7 @@ class ke {
1275
1278
  );
1276
1279
  }
1277
1280
  }
1278
- class Se {
1281
+ class xe {
1279
1282
  constructor(t, e = d) {
1280
1283
  /**
1281
1284
  * Checks if specified method is supported by current component.
@@ -1321,7 +1324,7 @@ class Se {
1321
1324
  this.postEvent("web_app_trigger_haptic_feedback", { type: "selection_change" });
1322
1325
  }
1323
1326
  }
1324
- function xe() {
1327
+ function qe() {
1325
1328
  const r = document.createElement("style");
1326
1329
  r.id = "telegram-custom-styles", document.head.appendChild(r), y("set_custom_style", (t) => {
1327
1330
  r.innerHTML = t;
@@ -1337,19 +1340,19 @@ function B(r) {
1337
1340
  const t = sessionStorage.getItem(qt(r));
1338
1341
  return t ? JSON.parse(t) : null;
1339
1342
  }
1340
- function qe(r, t, e) {
1341
- const { isVisible: s = !1 } = r ? B("back-button") || {} : {}, n = new Ee(s, t, e);
1343
+ function Ae(r, t, e) {
1344
+ const { isVisible: s = !1 } = r ? B("back-button") || {} : {}, n = new Ce(s, t, e);
1342
1345
  return n.on("change", () => {
1343
1346
  T("back-button", { isVisible: n.isVisible });
1344
1347
  }), n;
1345
1348
  }
1346
- function Ae(r, t) {
1347
- const { isConfirmationNeeded: e = !1 } = r ? B("closing-behavior") || {} : {}, s = new Pe(e, t);
1349
+ function Ve(r, t) {
1350
+ const { isConfirmationNeeded: e = !1 } = r ? B("closing-behavior") || {} : {}, s = new ke(e, t);
1348
1351
  return s.on("change", () => T("closing-behavior", {
1349
1352
  isConfirmationNeeded: s.isConfirmationNeeded
1350
1353
  })), s;
1351
1354
  }
1352
- class Ve {
1355
+ class Re {
1353
1356
  constructor(t) {
1354
1357
  o(this, "ee", new w());
1355
1358
  o(this, "state");
@@ -1514,7 +1517,7 @@ class Ve {
1514
1517
  return this.state.set(t), this.commit(), this;
1515
1518
  }
1516
1519
  }
1517
- function Re(r, t, e, s) {
1520
+ function Ie(r, t, e, s) {
1518
1521
  const {
1519
1522
  backgroundColor: n = t,
1520
1523
  isEnabled: i = !1,
@@ -1522,7 +1525,7 @@ function Re(r, t, e, s) {
1522
1525
  isLoaderVisible: c = !1,
1523
1526
  textColor: p = e,
1524
1527
  text: h = ""
1525
- } = r ? B("main-button") || {} : {}, g = new Ve({
1528
+ } = r ? B("main-button") || {} : {}, g = new Re({
1526
1529
  backgroundColor: n,
1527
1530
  isEnabled: i,
1528
1531
  isLoaderVisible: c,
@@ -1540,7 +1543,7 @@ function Re(r, t, e, s) {
1540
1543
  });
1541
1544
  return g.on("change", _), g;
1542
1545
  }
1543
- const Ie = X({
1546
+ const Le = X({
1544
1547
  contact: f({
1545
1548
  userId: {
1546
1549
  type: q(),
@@ -1565,7 +1568,7 @@ const Ie = X({
1565
1568
  },
1566
1569
  hash: u()
1567
1570
  });
1568
- class Le {
1571
+ class $e {
1569
1572
  constructor(t) {
1570
1573
  o(this, "ee", new w());
1571
1574
  o(this, "state");
@@ -1620,7 +1623,7 @@ class Le {
1620
1623
  postEvent: this.postEvent,
1621
1624
  timeout: 1e4
1622
1625
  }
1623
- ).then((t) => Ie.parse(t));
1626
+ ).then((t) => Le.parse(t));
1624
1627
  }
1625
1628
  /**
1626
1629
  * The Mini App background color.
@@ -1697,7 +1700,7 @@ class Le {
1697
1700
  return await this.getRequestedContact();
1698
1701
  } catch {
1699
1702
  }
1700
- await me(n), n += 50;
1703
+ await ye(n), n += 50;
1701
1704
  }
1702
1705
  throw new Error("Unable to retrieve requested contact.");
1703
1706
  }, t);
@@ -1783,11 +1786,11 @@ class Le {
1783
1786
  });
1784
1787
  }
1785
1788
  }
1786
- function $e(r, t, e, s, n, i) {
1789
+ function Te(r, t, e, s, n, i) {
1787
1790
  const {
1788
1791
  backgroundColor: a = t,
1789
1792
  headerColor: c = "bg_color"
1790
- } = r ? B("mini-app") || {} : {}, p = new Le({
1793
+ } = r ? B("mini-app") || {} : {}, p = new $e({
1791
1794
  headerColor: c,
1792
1795
  backgroundColor: a,
1793
1796
  version: e,
@@ -1800,11 +1803,11 @@ function $e(r, t, e, s, n, i) {
1800
1803
  });
1801
1804
  return p.on("change", h), p;
1802
1805
  }
1803
- function Te() {
1806
+ function Be() {
1804
1807
  let r = 0;
1805
1808
  return () => (r += 1, r.toString());
1806
1809
  }
1807
- class Be {
1810
+ class De {
1808
1811
  constructor(t, e, s = d) {
1809
1812
  o(this, "ee", new w());
1810
1813
  o(this, "state");
@@ -1851,17 +1854,17 @@ class Be {
1851
1854
  this.isVisible = !0;
1852
1855
  }
1853
1856
  }
1854
- function De(r, t, e) {
1855
- const { isVisible: s = !1 } = r ? B("settings-button") || {} : {}, n = new Be(s, t, e);
1857
+ function We(r, t, e) {
1858
+ const { isVisible: s = !1 } = r ? B("settings-button") || {} : {}, n = new De(s, t, e);
1856
1859
  return n.on("change", () => {
1857
1860
  T("settings-button", { isVisible: n.isVisible });
1858
1861
  }), n;
1859
1862
  }
1860
- function We(r) {
1863
+ function Oe(r) {
1861
1864
  const t = new Mt(r);
1862
1865
  return t.listen(), t;
1863
1866
  }
1864
- function Oe(r) {
1867
+ function Ne(r) {
1865
1868
  return ["macos", "tdesktop", "unigram", "web", "weba"].includes(r);
1866
1869
  }
1867
1870
  async function At(r) {
@@ -1876,7 +1879,7 @@ async function At(r) {
1876
1879
  function D(r) {
1877
1880
  return r < 0 ? 0 : r;
1878
1881
  }
1879
- class Ne {
1882
+ class He {
1880
1883
  constructor(t) {
1881
1884
  o(this, "ee", new w());
1882
1885
  o(this, "state");
@@ -2006,7 +2009,7 @@ class Ne {
2006
2009
  }
2007
2010
  }
2008
2011
  function j(r) {
2009
- const t = new Ne(r);
2012
+ const t = new He(r);
2010
2013
  return t.on("change", () => T("viewport", {
2011
2014
  height: t.height,
2012
2015
  isExpanded: t.isExpanded,
@@ -2014,11 +2017,11 @@ function j(r) {
2014
2017
  width: t.width
2015
2018
  })), t.listen(), t;
2016
2019
  }
2017
- function He(r, t, e, s) {
2020
+ function Ue(r, t, e, s) {
2018
2021
  const n = r ? B("viewport") : null;
2019
2022
  if (n)
2020
2023
  return j({ ...n, postEvent: e });
2021
- if (Oe(t))
2024
+ if (Ne(t))
2022
2025
  return j({
2023
2026
  height: window.innerHeight,
2024
2027
  isExpanded: !0,
@@ -2049,7 +2052,7 @@ function He(r, t, e, s) {
2049
2052
  function S(r, t) {
2050
2053
  document.documentElement.style.setProperty(r, t);
2051
2054
  }
2052
- function Ue(r, t) {
2055
+ function Me(r, t) {
2053
2056
  const e = () => {
2054
2057
  S("--tg-background-color", r.backgroundColor);
2055
2058
  }, s = () => {
@@ -2061,7 +2064,7 @@ function Ue(r, t) {
2061
2064
  };
2062
2065
  t.on("change", s), r.on("change:backgroundColor", e), r.on("change:headerColor", s), e(), s();
2063
2066
  }
2064
- function Me(r) {
2067
+ function je(r) {
2065
2068
  const t = () => {
2066
2069
  const e = r.getState();
2067
2070
  Object.entries(e).forEach(([s, n]) => {
@@ -2077,7 +2080,7 @@ function ot(r) {
2077
2080
  const t = () => S("--tg-viewport-height", `${r.height}px`), e = () => S("--tg-viewport-width", `${r.width}px`), s = () => S("--tg-viewport-height", `${r.stableHeight}px`);
2078
2081
  r.on("change:height", t), r.on("change:width", e), r.on("change:stableHeight", s), t(), e(), s();
2079
2082
  }
2080
- function je(r) {
2083
+ function Ge(r) {
2081
2084
  return typeof r == "object" ? r : r ? {
2082
2085
  themeParams: !0,
2083
2086
  viewport: !0,
@@ -2085,10 +2088,10 @@ function je(r) {
2085
2088
  } : {};
2086
2089
  }
2087
2090
  function at(r, t, e, s) {
2088
- const n = je(r);
2089
- n.miniApp && Ue(t, e), n.themeParams && Me(e), n.viewport && (s instanceof Promise ? s.then(ot) : ot(s));
2091
+ const n = Ge(r);
2092
+ n.miniApp && Me(t, e), n.themeParams && je(e), n.viewport && (s instanceof Promise ? s.then(ot) : ot(s));
2090
2093
  }
2091
- function Ge(r) {
2094
+ function Fe(r) {
2092
2095
  const { hostname: t, pathname: e } = new URL(r, window.location.href);
2093
2096
  if (t !== "t.me")
2094
2097
  throw new Error(`Incorrect hostname: ${t}`);
@@ -2097,7 +2100,7 @@ function Ge(r) {
2097
2100
  throw new Error('Link pathname has incorrect format. Expected to receive "/invoice/{slug}" or "/${slug}"');
2098
2101
  return s[2];
2099
2102
  }
2100
- class Fe {
2103
+ class ze {
2101
2104
  constructor(t, e = d) {
2102
2105
  o(this, "ee", new w());
2103
2106
  o(this, "state");
@@ -2127,7 +2130,7 @@ class Fe {
2127
2130
  async open(t, e) {
2128
2131
  if (this.isOpened)
2129
2132
  throw new Error("Invoice is already opened");
2130
- const s = e ? Ge(t) : t;
2133
+ const s = e ? Fe(t) : t;
2131
2134
  this.isOpened = !0;
2132
2135
  try {
2133
2136
  return (await m(
@@ -2146,7 +2149,7 @@ class Fe {
2146
2149
  }
2147
2150
  }
2148
2151
  }
2149
- function ze(r) {
2152
+ function Je(r) {
2150
2153
  const t = r.message.trim(), e = (r.title || "").trim(), s = r.buttons || [];
2151
2154
  let n;
2152
2155
  if (e.length > 64)
@@ -2170,7 +2173,7 @@ function ze(r) {
2170
2173
  return { ...i, id: a };
2171
2174
  }), { title: e, message: t, buttons: n };
2172
2175
  }
2173
- class Je {
2176
+ class Qe {
2174
2177
  constructor(t, e = d) {
2175
2178
  o(this, "ee", new w());
2176
2179
  o(this, "state");
@@ -2215,7 +2218,7 @@ class Je {
2215
2218
  throw new Error("Popup is already opened.");
2216
2219
  return this.isOpened = !0, m(
2217
2220
  "web_app_open_popup",
2218
- ze(t),
2221
+ Je(t),
2219
2222
  "popup_closed",
2220
2223
  { postEvent: this.postEvent }
2221
2224
  ).then(({ button_id: e = null }) => e).finally(() => {
@@ -2223,7 +2226,7 @@ class Je {
2223
2226
  });
2224
2227
  }
2225
2228
  }
2226
- class Qe {
2229
+ class Ze {
2227
2230
  constructor(t, e = d) {
2228
2231
  o(this, "ee", new w());
2229
2232
  o(this, "state");
@@ -2282,7 +2285,7 @@ class Qe {
2282
2285
  }
2283
2286
  }
2284
2287
  }
2285
- class Ze {
2288
+ class Ke {
2286
2289
  constructor(t, e, s = d) {
2287
2290
  /**
2288
2291
  * Checks if specified method is supported by current component.
@@ -2353,7 +2356,7 @@ class Ze {
2353
2356
  ).then(({ data: t = null }) => t);
2354
2357
  }
2355
2358
  }
2356
- function ur(r = {}) {
2359
+ function hr(r = {}) {
2357
2360
  const {
2358
2361
  async: t = !1,
2359
2362
  complete: e = t,
@@ -2371,22 +2374,22 @@ function ur(r = {}) {
2371
2374
  botInline: g = !1
2372
2375
  },
2373
2376
  isPageReload: _
2374
- } = Ct(), A = Te(), l = be(c);
2375
- vt() && (n && xe(), l("iframe_ready", { reload_supported: !0 }), y("reload_iframe", () => window.location.reload()));
2377
+ } = Ct(), A = Be(), l = me(c);
2378
+ vt() && (n && qe(), l("iframe_ready", { reload_supported: !0 }), y("reload_iframe", () => window.location.reload()));
2376
2379
  const C = {
2377
- backButton: qe(_, c, l),
2378
- closingBehavior: Ae(_, l),
2379
- cloudStorage: new ke(c, A, l),
2380
+ backButton: Ae(_, c, l),
2381
+ closingBehavior: Ve(_, l),
2382
+ cloudStorage: new Se(c, A, l),
2380
2383
  createRequestId: A,
2381
- hapticFeedback: new Se(c, l),
2382
- invoice: new Fe(c, l),
2383
- mainButton: Re(
2384
+ hapticFeedback: new xe(c, l),
2385
+ invoice: new ze(c, l),
2386
+ mainButton: Ie(
2384
2387
  _,
2385
2388
  h.buttonColor || "#000000",
2386
2389
  h.buttonTextColor || "#ffffff",
2387
2390
  l
2388
2391
  ),
2389
- miniApp: $e(
2392
+ miniApp: Te(
2390
2393
  _,
2391
2394
  h.backgroundColor || "#ffffff",
2392
2395
  c,
@@ -2394,17 +2397,17 @@ function ur(r = {}) {
2394
2397
  A,
2395
2398
  l
2396
2399
  ),
2397
- popup: new Je(c, l),
2400
+ popup: new Qe(c, l),
2398
2401
  postEvent: l,
2399
- qrScanner: new Qe(c, l),
2400
- settingsButton: De(_, c, l),
2401
- themeParams: We(h),
2402
- utils: new Ze(c, A, l),
2402
+ qrScanner: new Ze(c, l),
2403
+ settingsButton: We(_, c, l),
2404
+ themeParams: Oe(h),
2405
+ utils: new Ke(c, A, l),
2403
2406
  ...i ? {
2404
2407
  initData: new Ot(i),
2405
2408
  initDataRaw: a
2406
2409
  } : {}
2407
- }, x = He(_, p, l, e);
2410
+ }, x = Ue(_, p, l, e);
2408
2411
  return x instanceof Promise || e ? Promise.resolve(x).then((v) => (at(
2409
2412
  s,
2410
2413
  C.miniApp,
@@ -2425,7 +2428,7 @@ function ur(r = {}) {
2425
2428
  function W(r, t) {
2426
2429
  return r.startsWith(t) ? r : `${t}${r}`;
2427
2430
  }
2428
- function hr(r) {
2431
+ function pr(r) {
2429
2432
  const t = r.match(/#(.+)/);
2430
2433
  return t ? t[1] : null;
2431
2434
  }
@@ -2442,14 +2445,14 @@ async function N(r) {
2442
2445
  })
2443
2446
  ]);
2444
2447
  }
2445
- async function Ke() {
2448
+ async function Ye() {
2446
2449
  if (window.history.length <= 1 || (window.history.pushState(null, ""), await N(1 - window.history.length)))
2447
2450
  return;
2448
2451
  let t = await N(-1);
2449
2452
  for (; t; )
2450
2453
  t = await N(-1);
2451
2454
  }
2452
- class Ye {
2455
+ class Xe {
2453
2456
  constructor(t, e, {
2454
2457
  debug: s = !1,
2455
2458
  loggerPrefix: n = "Navigator"
@@ -2649,7 +2652,7 @@ class Ye {
2649
2652
  }
2650
2653
  }
2651
2654
  const ct = 0, Z = 1, K = 2;
2652
- class Vt extends Ye {
2655
+ class Vt extends Xe {
2653
2656
  constructor(e, s, n = {}) {
2654
2657
  super(e, s, {
2655
2658
  ...n,
@@ -2713,7 +2716,7 @@ class Vt extends Ye {
2713
2716
  async syncHistory() {
2714
2717
  window.removeEventListener("popstate", this.onPopState);
2715
2718
  const e = `#${this.path}`;
2716
- await Ke(), d("web_app_setup_back_button", { is_visible: this.canGoBack }), this.canGoBack && this.canGoForward ? (this.logger.log("Setting up history: [<-, *, ->]"), window.history.replaceState(Z, ""), window.history.pushState(null, "", e), window.history.pushState(K, ""), await N(-1)) : this.canGoBack ? (this.logger.log("Setting up history: [<-, *]"), window.history.replaceState(Z, ""), window.history.pushState(null, "", e)) : this.canGoForward ? (this.logger.log("Setting up history: [*, ->]"), window.history.replaceState(null, e), window.history.pushState(K, ""), await N(-1)) : (this.logger.log("Setting up history: [~, *]"), window.history.replaceState(ct, ""), window.history.pushState(null, "", e)), window.addEventListener("popstate", this.onPopState);
2719
+ await Ye(), d("web_app_setup_back_button", { is_visible: this.canGoBack }), this.canGoBack && this.canGoForward ? (this.logger.log("Setting up history: [<-, *, ->]"), window.history.replaceState(Z, ""), window.history.pushState(null, "", e), window.history.pushState(K, ""), await N(-1)) : this.canGoBack ? (this.logger.log("Setting up history: [<-, *]"), window.history.replaceState(Z, ""), window.history.pushState(null, "", e)) : this.canGoForward ? (this.logger.log("Setting up history: [*, ->]"), window.history.replaceState(null, e), window.history.pushState(K, ""), await N(-1)) : (this.logger.log("Setting up history: [~, *]"), window.history.replaceState(ct, ""), window.history.pushState(null, "", e)), window.addEventListener("popstate", this.onPopState);
2717
2720
  }
2718
2721
  emitChanged(e, s) {
2719
2722
  this.ee.emit("change", {
@@ -2737,31 +2740,36 @@ class Vt extends Ye {
2737
2740
  }
2738
2741
  }
2739
2742
  export {
2740
- Ee as BackButton,
2741
- Pe as ClosingBehavior,
2742
- ke as CloudStorage,
2743
- Se as HapticFeedback,
2743
+ Ce as BackButton,
2744
+ ke as ClosingBehavior,
2745
+ Se as CloudStorage,
2746
+ xe as HapticFeedback,
2744
2747
  Vt as HashNavigator,
2745
2748
  Ot as InitData,
2746
- Fe as Invoice,
2747
- Ve as MainButton,
2749
+ ze as Invoice,
2750
+ Re as MainButton,
2748
2751
  tt as MethodUnsupportedError,
2749
- Le as MiniApp,
2750
- Ye as Navigator,
2752
+ $e as MiniApp,
2753
+ Xe as Navigator,
2751
2754
  et as ParameterUnsupportedError,
2752
- Je as Popup,
2753
- Qe as QRScanner,
2754
- Be as SettingsButton,
2755
+ F as ParseError,
2756
+ G as ParseSchemaFieldError,
2757
+ Qe as Popup,
2758
+ Ze as QRScanner,
2759
+ De as SettingsButton,
2755
2760
  Mt as ThemeParams,
2756
2761
  J as TimeoutError,
2757
- Ze as Utils,
2758
- Ne as Viewport,
2762
+ Ke as Utils,
2763
+ He as Viewport,
2764
+ Bt as array,
2765
+ k as boolean,
2759
2766
  Wt as chatParser,
2760
- Ce as classNames,
2761
- _e as compareVersions,
2762
- be as createPostEvent,
2763
- hr as getHash,
2764
- ur as init,
2767
+ ve as classNames,
2768
+ be as compareVersions,
2769
+ me as createPostEvent,
2770
+ pt as date,
2771
+ pr as getHash,
2772
+ hr as init,
2765
2773
  wt as initDataParser,
2766
2774
  O as invokeCustomMethod,
2767
2775
  ft as isColorDark,
@@ -2769,31 +2777,37 @@ export {
2769
2777
  lt as isRGB,
2770
2778
  Dt as isRGBShort,
2771
2779
  H as isRecord,
2772
- Oe as isStableViewportPlatform,
2773
- rr as isTMA,
2774
- ar as isTimeoutError,
2780
+ Ne as isStableViewportPlatform,
2781
+ sr as isTMA,
2782
+ cr as isTimeoutError,
2783
+ f as json,
2775
2784
  mt as launchParamsParser,
2776
- cr as mergeClassNames,
2785
+ ur as mergeClassNames,
2786
+ q as number,
2777
2787
  $ as off,
2778
2788
  y as on,
2779
- ir as once,
2780
- tr as parseInitData,
2789
+ or as once,
2790
+ er as parseInitData,
2781
2791
  jt as parseLaunchParams,
2792
+ se as parseMessage,
2782
2793
  bt as parseThemeParams,
2783
2794
  d as postEvent,
2784
2795
  m as request,
2785
- er as requestThemeParams,
2796
+ rr as requestThemeParams,
2786
2797
  At as requestViewport,
2787
2798
  Ct as retrieveLaunchData,
2799
+ gt as rgb,
2800
+ X as searchParams,
2788
2801
  Jt as serializeLaunchParams,
2789
2802
  Ut as serializeThemeParams,
2790
- sr as setDebug,
2791
- nr as setTargetOrigin,
2792
- or as subscribe,
2803
+ nr as setDebug,
2804
+ ir as setTargetOrigin,
2805
+ u as string,
2806
+ ar as subscribe,
2793
2807
  R as supports,
2794
2808
  _t as themeParamsParser,
2795
2809
  dt as toRGB,
2796
- we as unsubscribe,
2810
+ _e as unsubscribe,
2797
2811
  rt as userParser,
2798
2812
  xt as withTimeout
2799
2813
  };