@tma.js/sdk 1.4.2 → 1.4.4

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
@@ -1,17 +1,17 @@
1
1
  var Rt = Object.defineProperty;
2
2
  var It = (r, t, e) => t in r ? Rt(r, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : r[t] = e;
3
3
  var o = (r, t, e) => (It(r, typeof t != "symbol" ? t + "" : t, e), e);
4
- function H(r) {
4
+ function R(r) {
5
5
  return typeof r == "object" && r !== null && !Array.isArray(r);
6
6
  }
7
- function ut() {
7
+ function ht() {
8
8
  return performance.getEntriesByType("navigation")[0] || null;
9
9
  }
10
10
  function Lt() {
11
- const r = ut();
11
+ const r = ht();
12
12
  return r ? r.type === "reload" : null;
13
13
  }
14
- function I() {
14
+ function L() {
15
15
  return new TypeError("Value has unexpected type");
16
16
  }
17
17
  class F extends Error {
@@ -50,7 +50,7 @@ function $t(r) {
50
50
  return t;
51
51
  } catch {
52
52
  }
53
- throw I();
53
+ throw L();
54
54
  }
55
55
  class Tt extends z {
56
56
  constructor(e, s, n) {
@@ -66,15 +66,15 @@ class Tt extends z {
66
66
  return this.itemParser = typeof e == "function" ? e : e.parse.bind(e), this;
67
67
  }
68
68
  }
69
- function L(r, t) {
69
+ function $(r, t) {
70
70
  return () => new z(r, !1, t);
71
71
  }
72
- class G extends Error {
72
+ class j extends Error {
73
73
  constructor(t, { cause: e, type: s } = {}) {
74
- super(`Unable to parse field "${t}"${s ? ` as ${s}` : ""}`, { cause: e }), Object.setPrototypeOf(this, G.prototype);
74
+ super(`Unable to parse field "${t}"${s ? ` as ${s}` : ""}`, { cause: e }), Object.setPrototypeOf(this, j.prototype);
75
75
  }
76
76
  }
77
- function ht(r, t) {
77
+ function pt(r, t) {
78
78
  const e = {};
79
79
  for (const s in r) {
80
80
  const n = r[s];
@@ -92,10 +92,10 @@ function ht(r, t) {
92
92
  try {
93
93
  c = a(p);
94
94
  } catch (h) {
95
- throw h instanceof F ? new G(i, {
95
+ throw h instanceof F ? new j(i, {
96
96
  type: h.type,
97
97
  cause: h
98
- }) : new G(i, { cause: h });
98
+ }) : new j(i, { cause: h });
99
99
  }
100
100
  c !== void 0 && (e[s] = c);
101
101
  }
@@ -104,7 +104,7 @@ function ht(r, t) {
104
104
  function Bt(r) {
105
105
  return new Tt((t) => t, !1, r);
106
106
  }
107
- const k = L((r) => {
107
+ const k = $((r) => {
108
108
  if (typeof r == "boolean")
109
109
  return r;
110
110
  const t = String(r);
@@ -112,8 +112,8 @@ const k = L((r) => {
112
112
  return !0;
113
113
  if (t === "0" || t === "false")
114
114
  return !1;
115
- throw I();
116
- }, "boolean"), q = L((r) => {
115
+ throw L();
116
+ }, "boolean"), q = $((r) => {
117
117
  if (typeof r == "number")
118
118
  return r;
119
119
  if (typeof r == "string") {
@@ -121,21 +121,21 @@ const k = L((r) => {
121
121
  if (!Number.isNaN(t))
122
122
  return t;
123
123
  }
124
- throw I();
125
- }, "number"), pt = L((r) => r instanceof Date ? r : new Date(q().parse(r) * 1e3), "Date");
124
+ throw L();
125
+ }, "number"), lt = $((r) => r instanceof Date ? r : new Date(q().parse(r) * 1e3), "Date");
126
126
  function Y(r) {
127
127
  let t = r;
128
128
  if (typeof t == "string" && (t = JSON.parse(t)), typeof t != "object" || t === null || Array.isArray(t))
129
- throw I();
129
+ throw L();
130
130
  return t;
131
131
  }
132
132
  function f(r, t) {
133
133
  return new z((e) => {
134
134
  const s = Y(e);
135
- return ht(r, (n) => s[n]);
135
+ return pt(r, (n) => s[n]);
136
136
  }, !1, t);
137
137
  }
138
- function lt(r) {
138
+ function X(r) {
139
139
  return /^#[\da-f]{6}$/i.test(r);
140
140
  }
141
141
  function Dt(r) {
@@ -143,7 +143,7 @@ function Dt(r) {
143
143
  }
144
144
  function dt(r) {
145
145
  const t = r.replace(/\s/g, "").toLowerCase();
146
- if (lt(t))
146
+ if (X(t))
147
147
  return t;
148
148
  if (Dt(t)) {
149
149
  let s = "#";
@@ -168,17 +168,17 @@ function ft(r) {
168
168
  }, 0)
169
169
  ) < 120;
170
170
  }
171
- const u = L((r) => {
171
+ const u = $((r) => {
172
172
  if (typeof r == "string" || typeof r == "number")
173
173
  return r.toString();
174
- throw I();
175
- }, "string"), gt = L((r) => dt(u().parse(r)), "rgb");
176
- function X(r, t) {
174
+ throw L();
175
+ }, "string"), gt = $((r) => dt(u().parse(r)), "rgb");
176
+ function tt(r, t) {
177
177
  return new z((e) => {
178
178
  if (typeof e != "string" && !(e instanceof URLSearchParams))
179
- throw I();
179
+ throw L();
180
180
  const s = typeof e == "string" ? new URLSearchParams(e) : e;
181
- return ht(r, (n) => {
181
+ return pt(r, (n) => {
182
182
  const i = s.get(n);
183
183
  return i === null ? void 0 : i;
184
184
  });
@@ -196,7 +196,7 @@ function Wt() {
196
196
  username: u().optional()
197
197
  }, "Chat");
198
198
  }
199
- class Ot {
199
+ class Nt {
200
200
  constructor(t) {
201
201
  this.initData = t;
202
202
  }
@@ -269,7 +269,7 @@ class Ot {
269
269
  return this.initData.user;
270
270
  }
271
271
  }
272
- function rt() {
272
+ function st() {
273
273
  return f({
274
274
  addedToAttachmentMenu: {
275
275
  type: k().optional(),
@@ -308,9 +308,9 @@ function rt() {
308
308
  }, "User");
309
309
  }
310
310
  function wt() {
311
- return X({
311
+ return tt({
312
312
  authDate: {
313
- type: pt(),
313
+ type: lt(),
314
314
  from: "auth_date"
315
315
  },
316
316
  canSendAfter: {
@@ -331,34 +331,34 @@ function wt() {
331
331
  type: u().optional(),
332
332
  from: "query_id"
333
333
  },
334
- receiver: rt().optional(),
334
+ receiver: st().optional(),
335
335
  startParam: {
336
336
  type: u().optional(),
337
337
  from: "start_param"
338
338
  },
339
- user: rt().optional()
339
+ user: st().optional()
340
340
  }, "InitData");
341
341
  }
342
- function er(r) {
342
+ function tr(r) {
343
343
  return wt().parse(r);
344
344
  }
345
- function Nt(r) {
345
+ function Ot(r) {
346
346
  return r.replace(/(^|_)bg/, (t, e) => `${e}background`).replace(/_([a-z])/g, (t, e) => e.toUpperCase());
347
347
  }
348
348
  function Ht(r) {
349
349
  return r.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`).replace(/(^|_)background/, (t, e) => `${e}bg`);
350
350
  }
351
- const _t = L(
351
+ const _t = $(
352
352
  (r) => {
353
353
  const t = gt().optional();
354
- return Object.entries(Y(r)).reduce((e, [s, n]) => (e[Nt(s)] = t.parse(n), e), {});
354
+ return Object.entries(Y(r)).reduce((e, [s, n]) => (e[Ot(s)] = t.parse(n), e), {});
355
355
  },
356
356
  "ThemeParams"
357
357
  );
358
358
  function bt(r) {
359
359
  return _t().parse(r);
360
360
  }
361
- function rr(r = {}) {
361
+ function er(r = {}) {
362
362
  return m("web_app_request_theme", "theme_changed", r).then(bt);
363
363
  }
364
364
  function Ut(r) {
@@ -577,7 +577,7 @@ class Mt {
577
577
  }
578
578
  }
579
579
  function mt() {
580
- return X({
580
+ return tt({
581
581
  botInline: {
582
582
  type: k().optional(),
583
583
  from: "tgWebAppBotInline"
@@ -612,18 +612,18 @@ function mt() {
612
612
  }
613
613
  }, "LaunchParams");
614
614
  }
615
- function jt(r) {
615
+ function Gt(r) {
616
616
  return mt().parse(r);
617
617
  }
618
618
  function yt(r) {
619
619
  const t = r.includes("?") ? r.replace("#", "&").slice(r.indexOf("?") + 1) : r.slice(r.indexOf("#") + 1);
620
- return jt(t);
620
+ return Gt(t);
621
621
  }
622
- function Gt() {
622
+ function jt() {
623
623
  return yt(window.location.href);
624
624
  }
625
625
  function Ft() {
626
- const r = ut();
626
+ const r = ht();
627
627
  if (!r)
628
628
  throw new Error("Unable to get first navigation entry.");
629
629
  return yt(r.name);
@@ -634,7 +634,7 @@ function zt() {
634
634
  } catch {
635
635
  }
636
636
  try {
637
- return Gt();
637
+ return jt();
638
638
  } catch {
639
639
  }
640
640
  return null;
@@ -687,15 +687,15 @@ function Yt() {
687
687
  };
688
688
  throw new Error("Unable to retrieve any launch parameters.");
689
689
  }
690
- const st = "tmajsLaunchData";
690
+ const nt = "tmajsLaunchData";
691
691
  function Ct() {
692
- const r = window[st];
692
+ const r = window[nt];
693
693
  if (r)
694
694
  return r;
695
695
  const t = Yt();
696
- return window[st] = t, Zt(t.launchParams), t;
696
+ return window[nt] = t, Zt(t.launchParams), t;
697
697
  }
698
- function sr() {
698
+ function rr() {
699
699
  try {
700
700
  return Ct(), !0;
701
701
  } catch {
@@ -703,10 +703,10 @@ function sr() {
703
703
  }
704
704
  }
705
705
  function Xt(r) {
706
- return "external" in r && H(r.external) && "notify" in r.external && typeof r.external.notify == "function";
706
+ return "external" in r && R(r.external) && "notify" in r.external && typeof r.external.notify == "function";
707
707
  }
708
708
  function te(r) {
709
- return "TelegramWebviewProxy" in r && H(r.TelegramWebviewProxy) && "postEvent" in r.TelegramWebviewProxy && typeof r.TelegramWebviewProxy.postEvent == "function";
709
+ return "TelegramWebviewProxy" in r && R(r.TelegramWebviewProxy) && "postEvent" in r.TelegramWebviewProxy && typeof r.TelegramWebviewProxy.postEvent == "function";
710
710
  }
711
711
  function vt() {
712
712
  try {
@@ -715,14 +715,14 @@ function vt() {
715
715
  return !0;
716
716
  }
717
717
  }
718
- class tt extends Error {
718
+ class et extends Error {
719
719
  constructor(t, e) {
720
- super(`Method "${t}" is unsupported in the Mini Apps version ${e}.`), Object.setPrototypeOf(this, tt.prototype);
720
+ super(`Method "${t}" is unsupported in the Mini Apps version ${e}.`), Object.setPrototypeOf(this, et.prototype);
721
721
  }
722
722
  }
723
- class et extends Error {
723
+ class rt extends Error {
724
724
  constructor(t, e, s) {
725
- super(`Parameter "${e}" in method "${t}" is unsupported in the Mini Apps version ${s}.`), Object.setPrototypeOf(this, et.prototype);
725
+ super(`Parameter "${e}" in method "${t}" is unsupported in the Mini Apps version ${s}.`), Object.setPrototypeOf(this, rt.prototype);
726
726
  }
727
727
  }
728
728
  class Pt {
@@ -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 nr(r) {
785
+ function sr(r) {
786
786
  if (r) {
787
787
  V.enable();
788
788
  return;
789
789
  }
790
790
  V.disable();
791
791
  }
792
- function ir(r) {
792
+ function nr(r) {
793
793
  kt = r;
794
794
  }
795
795
  function ee() {
@@ -804,7 +804,9 @@ function se(r) {
804
804
  }
805
805
  function ne(r, t) {
806
806
  window.dispatchEvent(new MessageEvent("message", {
807
- data: JSON.stringify({ eventType: r, eventData: t })
807
+ data: JSON.stringify({ eventType: r, eventData: t }),
808
+ // We specify window.parent to imitate the case, it sent us this event.
809
+ source: window.parent
808
810
  }));
809
811
  }
810
812
  function ie() {
@@ -829,11 +831,12 @@ function ie() {
829
831
  }
830
832
  function oe(r) {
831
833
  ie(), window.addEventListener("message", (t) => {
832
- try {
833
- const { eventType: e, eventData: s } = se(t.data);
834
- r(e, s);
835
- } catch {
836
- }
834
+ if (t.source === window.parent)
835
+ try {
836
+ const { eventType: e, eventData: s } = se(t.data);
837
+ r(e, s);
838
+ } catch {
839
+ }
837
840
  });
838
841
  }
839
842
  function ae() {
@@ -944,19 +947,19 @@ function U() {
944
947
  const r = window;
945
948
  return r[Q] === void 0 && (r[Q] = we()), r[Q];
946
949
  }
947
- function $(r, t) {
950
+ function T(r, t) {
948
951
  U().off(r, t);
949
952
  }
950
953
  function y(r, t) {
951
- return U().on(r, t), () => $(r, t);
954
+ return U().on(r, t), () => T(r, t);
952
955
  }
953
- function or(r, t) {
954
- return U().once(r, t), () => $(r, t);
956
+ function ir(r, t) {
957
+ return U().once(r, t), () => T(r, t);
955
958
  }
956
959
  function _e(r) {
957
960
  U().unsubscribe(r);
958
961
  }
959
- function ar(r) {
962
+ function or(r) {
960
963
  return U().subscribe(r), () => _e(r);
961
964
  }
962
965
  function be(r, t) {
@@ -971,7 +974,7 @@ function be(r, t) {
971
974
  function P(r, t) {
972
975
  return be(r, t) <= 0;
973
976
  }
974
- function R(r, t, e) {
977
+ function I(r, t, e) {
975
978
  if (typeof e == "string") {
976
979
  if (r === "web_app_open_link" && t === "try_instant_view")
977
980
  return P("6.4", e);
@@ -1005,12 +1008,12 @@ function R(r, t, e) {
1005
1008
  }
1006
1009
  }
1007
1010
  function E(r, t) {
1008
- return (e) => R(t[e], r);
1011
+ return (e) => I(t[e], r);
1009
1012
  }
1010
1013
  function St(r, t) {
1011
1014
  return (e) => {
1012
1015
  const [s, n] = t[e];
1013
- return R(s, n, r);
1016
+ return I(s, n, r);
1014
1017
  };
1015
1018
  }
1016
1019
  function d(r, t, e) {
@@ -1038,12 +1041,12 @@ function d(r, t, e) {
1038
1041
  }
1039
1042
  function me(r) {
1040
1043
  return (t, e) => {
1041
- if (!R(t, r))
1042
- throw new tt(t, r);
1043
- if (H(e)) {
1044
+ if (!I(t, r))
1045
+ throw new et(t, r);
1046
+ if (R(e)) {
1044
1047
  let s;
1045
- if (t === "web_app_open_link" && "try_instant_view" in e ? s = "try_instant_view" : t === "web_app_set_header_color" && "color" in e && (s = "color"), s && !R(t, s, r))
1046
- throw new et(t, s, r);
1048
+ if (t === "web_app_open_link" && "try_instant_view" in e ? s = "try_instant_view" : t === "web_app_set_header_color" && "color" in e && (s = "color"), s && !I(t, s, r))
1049
+ throw new rt(t, s, r);
1047
1050
  }
1048
1051
  return d(t, e);
1049
1052
  };
@@ -1053,7 +1056,7 @@ class J extends Error {
1053
1056
  super(`Async call timeout exceeded. Timeout: ${t}`), Object.setPrototypeOf(this, J.prototype);
1054
1057
  }
1055
1058
  }
1056
- function cr(r) {
1059
+ function ar(r) {
1057
1060
  return r instanceof J;
1058
1061
  }
1059
1062
  function ye(r) {
@@ -1074,10 +1077,10 @@ function xt(r, t) {
1074
1077
  }
1075
1078
  function m(r, t, e, s) {
1076
1079
  let n, i, a, c;
1077
- typeof t == "string" || Array.isArray(t) ? (a = Array.isArray(t) ? t : [t], n = e) : (i = t, a = Array.isArray(e) ? e : [e], n = s), H(i) && typeof i.req_id == "string" && (c = i.req_id);
1080
+ typeof t == "string" || Array.isArray(t) ? (a = Array.isArray(t) ? t : [t], n = e) : (i = t, a = Array.isArray(e) ? e : [e], n = s), R(i) && typeof i.req_id == "string" && (c = i.req_id);
1078
1081
  const { postEvent: p = d, timeout: h } = n || {}, g = n && "capture" in n ? n.capture : null, _ = () => new Promise((A, l) => {
1079
1082
  const C = a.map((v) => y(v, (M) => {
1080
- c && (!H(M) || M.req_id !== c) || typeof g == "function" && !g(M) || (x(), A(M));
1083
+ c && (!R(M) || M.req_id !== c) || typeof g == "function" && !g(M) || (x(), A(M));
1081
1084
  })), x = () => C.forEach((v) => v());
1082
1085
  try {
1083
1086
  p(r, i);
@@ -1117,7 +1120,7 @@ class Ce {
1117
1120
  * @param event - event name.
1118
1121
  * @param listener - event listener.
1119
1122
  */
1120
- o(this, "off", (t, e) => t === "click" ? $("back_button_pressed", e) : this.ee.off(t, e));
1123
+ o(this, "off", (t, e) => t === "click" ? T("back_button_pressed", e) : this.ee.off(t, e));
1121
1124
  /**
1122
1125
  * Checks if specified method is supported by current component.
1123
1126
  */
@@ -1149,25 +1152,22 @@ class Ce {
1149
1152
  this.isVisible = !0;
1150
1153
  }
1151
1154
  }
1152
- function nt(r, t) {
1155
+ function it(r, t) {
1153
1156
  return r + (r.length > 0 && t.length > 0 ? ` ${t}` : t);
1154
1157
  }
1155
1158
  function ve(...r) {
1156
1159
  return r.reduce((t, e) => {
1157
1160
  let s = "";
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);
1161
+ return typeof e == "string" ? s = e : typeof e == "object" && e !== null && (s = Object.entries(e).reduce((n, [i, a]) => a ? it(n, i) : n, "")), it(t, s);
1159
1162
  }, "");
1160
1163
  }
1161
- function Pe(r) {
1162
- return typeof r == "object" && r !== null && !Array.isArray(null);
1163
- }
1164
- function ur(...r) {
1165
- return r.reduce((t, e) => (Pe(e) && Object.entries(e).forEach(([s, n]) => {
1164
+ function cr(...r) {
1165
+ return r.reduce((t, e) => (R(e) && Object.entries(e).forEach(([s, n]) => {
1166
1166
  const i = ve(t[s], n);
1167
1167
  i.length > 0 && (t[s] = i);
1168
1168
  }), t), {});
1169
1169
  }
1170
- class ke {
1170
+ class Pe {
1171
1171
  constructor(t, e = d) {
1172
1172
  o(this, "ee", new w());
1173
1173
  o(this, "state");
@@ -1206,10 +1206,10 @@ class ke {
1206
1206
  this.isConfirmationNeeded = !0;
1207
1207
  }
1208
1208
  }
1209
- function it(r, t) {
1209
+ function ot(r, t) {
1210
1210
  return r.reduce((e, s) => (e[s] = t, e), {});
1211
1211
  }
1212
- class Se {
1212
+ class ke {
1213
1213
  constructor(t, e, s = d) {
1214
1214
  /**
1215
1215
  * Checks if specified method is supported by current component.
@@ -1252,9 +1252,9 @@ class Se {
1252
1252
  async get(t, e = {}) {
1253
1253
  const s = Array.isArray(t) ? t : [t];
1254
1254
  if (s.length === 0)
1255
- return it(s, "");
1255
+ return ot(s, "");
1256
1256
  const n = f(
1257
- it(s, u())
1257
+ ot(s, u())
1258
1258
  ), i = await O(
1259
1259
  "getStorageValues",
1260
1260
  { keys: s },
@@ -1278,7 +1278,46 @@ class Se {
1278
1278
  );
1279
1279
  }
1280
1280
  }
1281
- class xe {
1281
+ function S(r, t) {
1282
+ document.documentElement.style.setProperty(r, t);
1283
+ }
1284
+ function Se(r, t) {
1285
+ const e = () => {
1286
+ S("--tg-background-color", r.backgroundColor);
1287
+ }, s = () => {
1288
+ const {
1289
+ backgroundColor: n,
1290
+ secondaryBackgroundColor: i
1291
+ } = t;
1292
+ if (X(r.headerColor)) {
1293
+ S("--tg-header-color", r.headerColor);
1294
+ return;
1295
+ }
1296
+ if (r.headerColor === "bg_color" && n) {
1297
+ S("--tg-header-color", n);
1298
+ return;
1299
+ }
1300
+ r.headerColor === "secondary_bg_color" && i && S("--tg-header-color", i);
1301
+ };
1302
+ t.on("change", s), r.on("change:backgroundColor", e), r.on("change:headerColor", s), e(), s();
1303
+ }
1304
+ function xe(r) {
1305
+ const t = () => {
1306
+ const e = r.getState();
1307
+ Object.entries(e).forEach(([s, n]) => {
1308
+ if (n) {
1309
+ const i = s.replace(/[A-Z]/g, (a) => `-${a.toLowerCase()}`);
1310
+ S(`--tg-theme-${i}`, n);
1311
+ }
1312
+ });
1313
+ };
1314
+ r.on("change", t), t();
1315
+ }
1316
+ function at(r) {
1317
+ const t = () => S("--tg-viewport-height", `${r.height}px`), e = () => S("--tg-viewport-width", `${r.width}px`), s = () => S("--tg-viewport-stable-height", `${r.stableHeight}px`);
1318
+ r.on("change:height", t), r.on("change:width", e), r.on("change:stableHeight", s), t(), e(), s();
1319
+ }
1320
+ class qe {
1282
1321
  constructor(t, e = d) {
1283
1322
  /**
1284
1323
  * Checks if specified method is supported by current component.
@@ -1324,7 +1363,7 @@ class xe {
1324
1363
  this.postEvent("web_app_trigger_haptic_feedback", { type: "selection_change" });
1325
1364
  }
1326
1365
  }
1327
- function qe() {
1366
+ function Ae() {
1328
1367
  const r = document.createElement("style");
1329
1368
  r.id = "telegram-custom-styles", document.head.appendChild(r), y("set_custom_style", (t) => {
1330
1369
  r.innerHTML = t;
@@ -1333,26 +1372,26 @@ function qe() {
1333
1372
  function qt(r) {
1334
1373
  return `telegram-mini-apps-${r}`;
1335
1374
  }
1336
- function T(r, t) {
1375
+ function B(r, t) {
1337
1376
  sessionStorage.setItem(qt(r), JSON.stringify(t));
1338
1377
  }
1339
- function B(r) {
1378
+ function D(r) {
1340
1379
  const t = sessionStorage.getItem(qt(r));
1341
1380
  return t ? JSON.parse(t) : null;
1342
1381
  }
1343
- function Ae(r, t, e) {
1344
- const { isVisible: s = !1 } = r ? B("back-button") || {} : {}, n = new Ce(s, t, e);
1382
+ function Ve(r, t, e) {
1383
+ const { isVisible: s = !1 } = r ? D("back-button") || {} : {}, n = new Ce(s, t, e);
1345
1384
  return n.on("change", () => {
1346
- T("back-button", { isVisible: n.isVisible });
1385
+ B("back-button", { isVisible: n.isVisible });
1347
1386
  }), n;
1348
1387
  }
1349
- function Ve(r, t) {
1350
- const { isConfirmationNeeded: e = !1 } = r ? B("closing-behavior") || {} : {}, s = new ke(e, t);
1351
- return s.on("change", () => T("closing-behavior", {
1388
+ function Re(r, t) {
1389
+ const { isConfirmationNeeded: e = !1 } = r ? D("closing-behavior") || {} : {}, s = new Pe(e, t);
1390
+ return s.on("change", () => B("closing-behavior", {
1352
1391
  isConfirmationNeeded: s.isConfirmationNeeded
1353
1392
  })), s;
1354
1393
  }
1355
- class Re {
1394
+ class Ie {
1356
1395
  constructor(t) {
1357
1396
  o(this, "ee", new w());
1358
1397
  o(this, "state");
@@ -1373,7 +1412,7 @@ class Re {
1373
1412
  * @param event - event name.
1374
1413
  * @param listener - event listener.
1375
1414
  */
1376
- o(this, "off", (t, e) => t === "click" ? $("main_button_pressed", e) : this.ee.off(t, e));
1415
+ o(this, "off", (t, e) => t === "click" ? T("main_button_pressed", e) : this.ee.off(t, e));
1377
1416
  const {
1378
1417
  postEvent: e = d,
1379
1418
  text: s,
@@ -1517,7 +1556,7 @@ class Re {
1517
1556
  return this.state.set(t), this.commit(), this;
1518
1557
  }
1519
1558
  }
1520
- function Ie(r, t, e, s) {
1559
+ function Le(r, t, e, s) {
1521
1560
  const {
1522
1561
  backgroundColor: n = t,
1523
1562
  isEnabled: i = !1,
@@ -1525,7 +1564,7 @@ function Ie(r, t, e, s) {
1525
1564
  isLoaderVisible: c = !1,
1526
1565
  textColor: p = e,
1527
1566
  text: h = ""
1528
- } = r ? B("main-button") || {} : {}, g = new Re({
1567
+ } = r ? D("main-button") || {} : {}, g = new Ie({
1529
1568
  backgroundColor: n,
1530
1569
  isEnabled: i,
1531
1570
  isLoaderVisible: c,
@@ -1533,7 +1572,7 @@ function Ie(r, t, e, s) {
1533
1572
  postEvent: s,
1534
1573
  text: h,
1535
1574
  textColor: p
1536
- }), _ = () => T("main-button", {
1575
+ }), _ = () => B("main-button", {
1537
1576
  backgroundColor: g.backgroundColor,
1538
1577
  isEnabled: g.isEnabled,
1539
1578
  isLoaderVisible: g.isLoaderVisible,
@@ -1543,7 +1582,7 @@ function Ie(r, t, e, s) {
1543
1582
  });
1544
1583
  return g.on("change", _), g;
1545
1584
  }
1546
- const Le = X({
1585
+ const $e = tt({
1547
1586
  contact: f({
1548
1587
  userId: {
1549
1588
  type: q(),
@@ -1563,12 +1602,12 @@ const Le = X({
1563
1602
  }
1564
1603
  }),
1565
1604
  authDate: {
1566
- type: pt(),
1605
+ type: lt(),
1567
1606
  from: "auth_date"
1568
1607
  },
1569
1608
  hash: u()
1570
1609
  });
1571
- class $e {
1610
+ class Te {
1572
1611
  constructor(t) {
1573
1612
  o(this, "ee", new w());
1574
1613
  o(this, "state");
@@ -1623,7 +1662,7 @@ class $e {
1623
1662
  postEvent: this.postEvent,
1624
1663
  timeout: 1e4
1625
1664
  }
1626
- ).then((t) => Le.parse(t));
1665
+ ).then((t) => $e.parse(t));
1627
1666
  }
1628
1667
  /**
1629
1668
  * The Mini App background color.
@@ -1758,7 +1797,7 @@ class $e {
1758
1797
  * @param color - color key or RGB color.
1759
1798
  */
1760
1799
  setHeaderColor(t) {
1761
- this.postEvent("web_app_set_header_color", lt(t) ? { color: t } : { color_key: t }), this.state.set("headerColor", t);
1800
+ this.postEvent("web_app_set_header_color", X(t) ? { color: t } : { color_key: t }), this.state.set("headerColor", t);
1762
1801
  }
1763
1802
  /**
1764
1803
  * Updates current Mini App background color.
@@ -1786,28 +1825,28 @@ class $e {
1786
1825
  });
1787
1826
  }
1788
1827
  }
1789
- function Te(r, t, e, s, n, i) {
1828
+ function Be(r, t, e, s, n, i) {
1790
1829
  const {
1791
1830
  backgroundColor: a = t,
1792
1831
  headerColor: c = "bg_color"
1793
- } = r ? B("mini-app") || {} : {}, p = new $e({
1832
+ } = r ? D("mini-app") || {} : {}, p = new Te({
1794
1833
  headerColor: c,
1795
1834
  backgroundColor: a,
1796
1835
  version: e,
1797
1836
  botInline: s,
1798
1837
  createRequestId: n,
1799
1838
  postEvent: i
1800
- }), h = () => T("mini-app", {
1839
+ }), h = () => B("mini-app", {
1801
1840
  backgroundColor: p.backgroundColor,
1802
1841
  headerColor: p.headerColor
1803
1842
  });
1804
1843
  return p.on("change", h), p;
1805
1844
  }
1806
- function Be() {
1845
+ function De() {
1807
1846
  let r = 0;
1808
1847
  return () => (r += 1, r.toString());
1809
1848
  }
1810
- class De {
1849
+ class We {
1811
1850
  constructor(t, e, s = d) {
1812
1851
  o(this, "ee", new w());
1813
1852
  o(this, "state");
@@ -1822,7 +1861,7 @@ class De {
1822
1861
  * @param event - event name.
1823
1862
  * @param listener - event listener.
1824
1863
  */
1825
- o(this, "off", (t, e) => t === "click" ? $("settings_button_pressed", e) : this.ee.off(t, e));
1864
+ o(this, "off", (t, e) => t === "click" ? T("settings_button_pressed", e) : this.ee.off(t, e));
1826
1865
  /**
1827
1866
  * Checks if specified method is supported by current component.
1828
1867
  */
@@ -1854,17 +1893,17 @@ class De {
1854
1893
  this.isVisible = !0;
1855
1894
  }
1856
1895
  }
1857
- function We(r, t, e) {
1858
- const { isVisible: s = !1 } = r ? B("settings-button") || {} : {}, n = new De(s, t, e);
1896
+ function Ne(r, t, e) {
1897
+ const { isVisible: s = !1 } = r ? D("settings-button") || {} : {}, n = new We(s, t, e);
1859
1898
  return n.on("change", () => {
1860
- T("settings-button", { isVisible: n.isVisible });
1899
+ B("settings-button", { isVisible: n.isVisible });
1861
1900
  }), n;
1862
1901
  }
1863
1902
  function Oe(r) {
1864
1903
  const t = new Mt(r);
1865
1904
  return t.listen(), t;
1866
1905
  }
1867
- function Ne(r) {
1906
+ function He(r) {
1868
1907
  return ["macos", "tdesktop", "unigram", "web", "weba"].includes(r);
1869
1908
  }
1870
1909
  async function At(r) {
@@ -1876,10 +1915,10 @@ async function At(r) {
1876
1915
  isStateStable: t.is_state_stable
1877
1916
  };
1878
1917
  }
1879
- function D(r) {
1918
+ function W(r) {
1880
1919
  return r < 0 ? 0 : r;
1881
1920
  }
1882
- class He {
1921
+ class Ue {
1883
1922
  constructor(t) {
1884
1923
  o(this, "ee", new w());
1885
1924
  o(this, "state");
@@ -1900,10 +1939,10 @@ class He {
1900
1939
  postEvent: a = d
1901
1940
  } = t;
1902
1941
  this.postEvent = a, this.state = new b({
1903
- height: D(e),
1942
+ height: W(e),
1904
1943
  isExpanded: s,
1905
- stableHeight: D(i),
1906
- width: D(n)
1944
+ stableHeight: W(i),
1945
+ width: W(n)
1907
1946
  }, this.ee);
1908
1947
  }
1909
1948
  /**
@@ -1969,9 +2008,9 @@ class He {
1969
2008
  is_expanded: n,
1970
2009
  is_state_stable: i
1971
2010
  } = t, a = {
1972
- height: D(e),
2011
+ height: W(e),
1973
2012
  isExpanded: n,
1974
- width: D(s)
2013
+ width: W(s)
1975
2014
  };
1976
2015
  i && (a.stableHeight = a.height), this.state.set(a);
1977
2016
  });
@@ -2008,21 +2047,21 @@ class He {
2008
2047
  return this.stableHeight === this.height;
2009
2048
  }
2010
2049
  }
2011
- function j(r) {
2012
- const t = new He(r);
2013
- return t.on("change", () => T("viewport", {
2050
+ function G(r) {
2051
+ const t = new Ue(r);
2052
+ return t.on("change", () => B("viewport", {
2014
2053
  height: t.height,
2015
2054
  isExpanded: t.isExpanded,
2016
2055
  stableHeight: t.stableHeight,
2017
2056
  width: t.width
2018
2057
  })), t.listen(), t;
2019
2058
  }
2020
- function Ue(r, t, e, s) {
2021
- const n = r ? B("viewport") : null;
2059
+ function Me(r, t, e, s) {
2060
+ const n = r ? D("viewport") : null;
2022
2061
  if (n)
2023
- return j({ ...n, postEvent: e });
2024
- if (Ne(t))
2025
- return j({
2062
+ return G({ ...n, postEvent: e });
2063
+ if (He(t))
2064
+ return G({
2026
2065
  height: window.innerHeight,
2027
2066
  isExpanded: !0,
2028
2067
  postEvent: e,
@@ -2033,12 +2072,12 @@ function Ue(r, t, e, s) {
2033
2072
  return At({
2034
2073
  postEvent: e,
2035
2074
  timeout: 5e3
2036
- }).then(({ height: a, isStateStable: c, ...p }) => j({
2075
+ }).then(({ height: a, isStateStable: c, ...p }) => G({
2037
2076
  ...p,
2038
2077
  height: a,
2039
2078
  stableHeight: c ? a : 0
2040
2079
  }));
2041
- const i = j({
2080
+ const i = G({
2042
2081
  width: 0,
2043
2082
  height: 0,
2044
2083
  isExpanded: !1,
@@ -2049,37 +2088,6 @@ function Ue(r, t, e, s) {
2049
2088
  console.error("Unable to actualize viewport state", a);
2050
2089
  }), i;
2051
2090
  }
2052
- function S(r, t) {
2053
- document.documentElement.style.setProperty(r, t);
2054
- }
2055
- function Me(r, t) {
2056
- const e = () => {
2057
- S("--tg-background-color", r.backgroundColor);
2058
- }, s = () => {
2059
- const {
2060
- backgroundColor: n,
2061
- secondaryBackgroundColor: i
2062
- } = t;
2063
- r.headerColor === "bg_color" ? n && S("--tg-header-color", n) : r.headerColor === "secondary_bg_color" ? i && S("--tg-header-color", i) : S("--tg-header-color", r.headerColor);
2064
- };
2065
- t.on("change", s), r.on("change:backgroundColor", e), r.on("change:headerColor", s), e(), s();
2066
- }
2067
- function je(r) {
2068
- const t = () => {
2069
- const e = r.getState();
2070
- Object.entries(e).forEach(([s, n]) => {
2071
- if (n) {
2072
- const i = s.replace(/[A-Z]/g, (a) => `-${a.toLowerCase()}`);
2073
- S(`--tg-theme-${i}`, n);
2074
- }
2075
- });
2076
- };
2077
- r.on("change", t), t();
2078
- }
2079
- function ot(r) {
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`);
2081
- r.on("change:height", t), r.on("change:width", e), r.on("change:stableHeight", s), t(), e(), s();
2082
- }
2083
2091
  function Ge(r) {
2084
2092
  return typeof r == "object" ? r : r ? {
2085
2093
  themeParams: !0,
@@ -2087,11 +2095,11 @@ function Ge(r) {
2087
2095
  miniApp: !0
2088
2096
  } : {};
2089
2097
  }
2090
- function at(r, t, e, s) {
2098
+ function ct(r, t, e, s) {
2091
2099
  const n = Ge(r);
2092
- n.miniApp && Me(t, e), n.themeParams && je(e), n.viewport && (s instanceof Promise ? s.then(ot) : ot(s));
2100
+ n.miniApp && Se(t, e), n.themeParams && xe(e), n.viewport && (s instanceof Promise ? s.then(at) : at(s));
2093
2101
  }
2094
- function Fe(r) {
2102
+ function je(r) {
2095
2103
  const { hostname: t, pathname: e } = new URL(r, window.location.href);
2096
2104
  if (t !== "t.me")
2097
2105
  throw new Error(`Incorrect hostname: ${t}`);
@@ -2100,7 +2108,7 @@ function Fe(r) {
2100
2108
  throw new Error('Link pathname has incorrect format. Expected to receive "/invoice/{slug}" or "/${slug}"');
2101
2109
  return s[2];
2102
2110
  }
2103
- class ze {
2111
+ class Fe {
2104
2112
  constructor(t, e = d) {
2105
2113
  o(this, "ee", new w());
2106
2114
  o(this, "state");
@@ -2130,7 +2138,7 @@ class ze {
2130
2138
  async open(t, e) {
2131
2139
  if (this.isOpened)
2132
2140
  throw new Error("Invoice is already opened");
2133
- const s = e ? Fe(t) : t;
2141
+ const s = e ? je(t) : t;
2134
2142
  this.isOpened = !0;
2135
2143
  try {
2136
2144
  return (await m(
@@ -2149,7 +2157,7 @@ class ze {
2149
2157
  }
2150
2158
  }
2151
2159
  }
2152
- function Je(r) {
2160
+ function ze(r) {
2153
2161
  const t = r.message.trim(), e = (r.title || "").trim(), s = r.buttons || [];
2154
2162
  let n;
2155
2163
  if (e.length > 64)
@@ -2173,7 +2181,7 @@ function Je(r) {
2173
2181
  return { ...i, id: a };
2174
2182
  }), { title: e, message: t, buttons: n };
2175
2183
  }
2176
- class Qe {
2184
+ class Je {
2177
2185
  constructor(t, e = d) {
2178
2186
  o(this, "ee", new w());
2179
2187
  o(this, "state");
@@ -2218,7 +2226,7 @@ class Qe {
2218
2226
  throw new Error("Popup is already opened.");
2219
2227
  return this.isOpened = !0, m(
2220
2228
  "web_app_open_popup",
2221
- Je(t),
2229
+ ze(t),
2222
2230
  "popup_closed",
2223
2231
  { postEvent: this.postEvent }
2224
2232
  ).then(({ button_id: e = null }) => e).finally(() => {
@@ -2226,7 +2234,7 @@ class Qe {
2226
2234
  });
2227
2235
  }
2228
2236
  }
2229
- class Ze {
2237
+ class Qe {
2230
2238
  constructor(t, e = d) {
2231
2239
  o(this, "ee", new w());
2232
2240
  o(this, "state");
@@ -2285,7 +2293,7 @@ class Ze {
2285
2293
  }
2286
2294
  }
2287
2295
  }
2288
- class Ke {
2296
+ class Ze {
2289
2297
  constructor(t, e, s = d) {
2290
2298
  /**
2291
2299
  * Checks if specified method is supported by current component.
@@ -2312,7 +2320,7 @@ class Ke {
2312
2320
  */
2313
2321
  openLink(t, e) {
2314
2322
  const s = new URL(t, window.location.href).toString();
2315
- if (!R("web_app_open_link", this.version)) {
2323
+ if (!I("web_app_open_link", this.version)) {
2316
2324
  window.open(s, "_blank");
2317
2325
  return;
2318
2326
  }
@@ -2335,7 +2343,7 @@ class Ke {
2335
2343
  } = new URL(t, window.location.href);
2336
2344
  if (e !== "t.me")
2337
2345
  throw new Error(`URL has not allowed hostname: ${e}. Only "t.me" is allowed`);
2338
- if (!R("web_app_open_tg_link", this.version)) {
2346
+ if (!I("web_app_open_tg_link", this.version)) {
2339
2347
  window.location.href = t;
2340
2348
  return;
2341
2349
  }
@@ -2356,7 +2364,7 @@ class Ke {
2356
2364
  ).then(({ data: t = null }) => t);
2357
2365
  }
2358
2366
  }
2359
- function hr(r = {}) {
2367
+ function ur(r = {}) {
2360
2368
  const {
2361
2369
  async: t = !1,
2362
2370
  complete: e = t,
@@ -2374,22 +2382,22 @@ function hr(r = {}) {
2374
2382
  botInline: g = !1
2375
2383
  },
2376
2384
  isPageReload: _
2377
- } = Ct(), A = Be(), l = me(c);
2378
- vt() && (n && qe(), l("iframe_ready", { reload_supported: !0 }), y("reload_iframe", () => window.location.reload()));
2385
+ } = Ct(), A = De(), l = me(c);
2386
+ vt() && (n && Ae(), l("iframe_ready", { reload_supported: !0 }), y("reload_iframe", () => window.location.reload()));
2379
2387
  const C = {
2380
- backButton: Ae(_, c, l),
2381
- closingBehavior: Ve(_, l),
2382
- cloudStorage: new Se(c, A, l),
2388
+ backButton: Ve(_, c, l),
2389
+ closingBehavior: Re(_, l),
2390
+ cloudStorage: new ke(c, A, l),
2383
2391
  createRequestId: A,
2384
- hapticFeedback: new xe(c, l),
2385
- invoice: new ze(c, l),
2386
- mainButton: Ie(
2392
+ hapticFeedback: new qe(c, l),
2393
+ invoice: new Fe(c, l),
2394
+ mainButton: Le(
2387
2395
  _,
2388
2396
  h.buttonColor || "#000000",
2389
2397
  h.buttonTextColor || "#ffffff",
2390
2398
  l
2391
2399
  ),
2392
- miniApp: Te(
2400
+ miniApp: Be(
2393
2401
  _,
2394
2402
  h.backgroundColor || "#ffffff",
2395
2403
  c,
@@ -2397,23 +2405,23 @@ function hr(r = {}) {
2397
2405
  A,
2398
2406
  l
2399
2407
  ),
2400
- popup: new Qe(c, l),
2408
+ popup: new Je(c, l),
2401
2409
  postEvent: l,
2402
- qrScanner: new Ze(c, l),
2403
- settingsButton: We(_, c, l),
2410
+ qrScanner: new Qe(c, l),
2411
+ settingsButton: Ne(_, c, l),
2404
2412
  themeParams: Oe(h),
2405
- utils: new Ke(c, A, l),
2413
+ utils: new Ze(c, A, l),
2406
2414
  ...i ? {
2407
- initData: new Ot(i),
2415
+ initData: new Nt(i),
2408
2416
  initDataRaw: a
2409
2417
  } : {}
2410
- }, x = Ue(_, p, l, e);
2411
- return x instanceof Promise || e ? Promise.resolve(x).then((v) => (at(
2418
+ }, x = Me(_, p, l, e);
2419
+ return x instanceof Promise || e ? Promise.resolve(x).then((v) => (ct(
2412
2420
  s,
2413
2421
  C.miniApp,
2414
2422
  C.themeParams,
2415
2423
  v
2416
- ), { ...C, viewport: v })) : (at(
2424
+ ), { ...C, viewport: v })) : (ct(
2417
2425
  s,
2418
2426
  C.miniApp,
2419
2427
  C.themeParams,
@@ -2425,14 +2433,14 @@ function hr(r = {}) {
2425
2433
  throw i;
2426
2434
  }
2427
2435
  }
2428
- function W(r, t) {
2436
+ function N(r, t) {
2429
2437
  return r.startsWith(t) ? r : `${t}${r}`;
2430
2438
  }
2431
- function pr(r) {
2439
+ function hr(r) {
2432
2440
  const t = r.match(/#(.+)/);
2433
2441
  return t ? t[1] : null;
2434
2442
  }
2435
- async function N(r) {
2443
+ async function H(r) {
2436
2444
  return r === 0 ? !0 : Promise.race([
2437
2445
  new Promise((t) => {
2438
2446
  window.addEventListener("popstate", function e() {
@@ -2445,14 +2453,14 @@ async function N(r) {
2445
2453
  })
2446
2454
  ]);
2447
2455
  }
2448
- async function Ye() {
2449
- if (window.history.length <= 1 || (window.history.pushState(null, ""), await N(1 - window.history.length)))
2456
+ async function Ke() {
2457
+ if (window.history.length <= 1 || (window.history.pushState(null, ""), await H(1 - window.history.length)))
2450
2458
  return;
2451
- let t = await N(-1);
2459
+ let t = await H(-1);
2452
2460
  for (; t; )
2453
- t = await N(-1);
2461
+ t = await H(-1);
2454
2462
  }
2455
- class Xe {
2463
+ class Ye {
2456
2464
  constructor(t, e, {
2457
2465
  debug: s = !1,
2458
2466
  loggerPrefix: n = "Navigator"
@@ -2467,9 +2475,9 @@ class Xe {
2467
2475
  if (!i.startsWith("/") && i.length > 0)
2468
2476
  throw new Error('Pathname should start with "/"');
2469
2477
  return {
2470
- pathname: W(i, "/"),
2471
- search: a ? W(a, "?") : "",
2472
- hash: c ? W(c, "#") : ""
2478
+ pathname: N(i, "/"),
2479
+ search: a ? N(a, "?") : "",
2480
+ hash: c ? N(c, "#") : ""
2473
2481
  };
2474
2482
  }), this.logger = new Pt(`[${n}]`, s);
2475
2483
  }
@@ -2487,7 +2495,7 @@ class Xe {
2487
2495
  search: c,
2488
2496
  hash: p
2489
2497
  } = t;
2490
- e = a + (c ? W(c, "?") : "") + (p ? W(p, "#") : "");
2498
+ e = a + (c ? N(c, "?") : "") + (p ? N(p, "#") : "");
2491
2499
  }
2492
2500
  const {
2493
2501
  pathname: s,
@@ -2651,8 +2659,8 @@ class Xe {
2651
2659
  return this.entry.search;
2652
2660
  }
2653
2661
  }
2654
- const ct = 0, Z = 1, K = 2;
2655
- class Vt extends Xe {
2662
+ const ut = 0, Z = 1, K = 2;
2663
+ class Vt extends Ye {
2656
2664
  constructor(e, s, n = {}) {
2657
2665
  super(e, s, {
2658
2666
  ...n,
@@ -2667,7 +2675,7 @@ class Vt extends Xe {
2667
2675
  o(this, "onPopState", async ({ state: e }) => {
2668
2676
  if (this.logger.log('"popstate" event received. State:', e), e === null)
2669
2677
  return this.push(window.location.hash.slice(1));
2670
- if (e === ct) {
2678
+ if (e === ut) {
2671
2679
  this.logger.log("Void reached. Moving history forward"), window.history.forward();
2672
2680
  return;
2673
2681
  }
@@ -2716,7 +2724,7 @@ class Vt extends Xe {
2716
2724
  async syncHistory() {
2717
2725
  window.removeEventListener("popstate", this.onPopState);
2718
2726
  const e = `#${this.path}`;
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);
2727
+ 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 H(-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 H(-1)) : (this.logger.log("Setting up history: [~, *]"), window.history.replaceState(ut, ""), window.history.pushState(null, "", e)), window.addEventListener("popstate", this.onPopState);
2720
2728
  }
2721
2729
  emitChanged(e, s) {
2722
2730
  this.ee.emit("change", {
@@ -2736,79 +2744,83 @@ class Vt extends Xe {
2736
2744
  * Detaches current navigator from the browser history.
2737
2745
  */
2738
2746
  detach() {
2739
- this.attached && (this.logger.log("Detaching", this), this.attached = !1, window.removeEventListener("popstate", this.onPopState), $("back_button_pressed", this.back));
2747
+ this.attached && (this.logger.log("Detaching", this), this.attached = !1, window.removeEventListener("popstate", this.onPopState), T("back_button_pressed", this.back));
2740
2748
  }
2741
2749
  }
2742
2750
  export {
2743
2751
  Ce as BackButton,
2744
- ke as ClosingBehavior,
2745
- Se as CloudStorage,
2746
- xe as HapticFeedback,
2752
+ Pe as ClosingBehavior,
2753
+ ke as CloudStorage,
2754
+ qe as HapticFeedback,
2747
2755
  Vt as HashNavigator,
2748
- Ot as InitData,
2749
- ze as Invoice,
2750
- Re as MainButton,
2751
- tt as MethodUnsupportedError,
2752
- $e as MiniApp,
2753
- Xe as Navigator,
2754
- et as ParameterUnsupportedError,
2756
+ Nt as InitData,
2757
+ Fe as Invoice,
2758
+ Ie as MainButton,
2759
+ et as MethodUnsupportedError,
2760
+ Te as MiniApp,
2761
+ Ye as Navigator,
2762
+ rt as ParameterUnsupportedError,
2755
2763
  F as ParseError,
2756
- G as ParseSchemaFieldError,
2757
- Qe as Popup,
2758
- Ze as QRScanner,
2759
- De as SettingsButton,
2764
+ j as ParseSchemaFieldError,
2765
+ Je as Popup,
2766
+ Qe as QRScanner,
2767
+ We as SettingsButton,
2760
2768
  Mt as ThemeParams,
2761
2769
  J as TimeoutError,
2762
- Ke as Utils,
2763
- He as Viewport,
2770
+ Ze as Utils,
2771
+ Ue as Viewport,
2764
2772
  Bt as array,
2773
+ Se as bindMiniAppCSSVars,
2774
+ xe as bindThemeCSSVars,
2775
+ at as bindViewportCSSVars,
2765
2776
  k as boolean,
2766
2777
  Wt as chatParser,
2767
2778
  ve as classNames,
2768
2779
  be as compareVersions,
2769
2780
  me as createPostEvent,
2770
- pt as date,
2771
- pr as getHash,
2772
- hr as init,
2781
+ lt as date,
2782
+ hr as getHash,
2783
+ ur as init,
2773
2784
  wt as initDataParser,
2774
2785
  O as invokeCustomMethod,
2775
2786
  ft as isColorDark,
2776
2787
  vt as isIframe,
2777
- lt as isRGB,
2788
+ X as isRGB,
2778
2789
  Dt as isRGBShort,
2779
- H as isRecord,
2780
- Ne as isStableViewportPlatform,
2781
- sr as isTMA,
2782
- cr as isTimeoutError,
2790
+ R as isRecord,
2791
+ He as isStableViewportPlatform,
2792
+ rr as isTMA,
2793
+ ar as isTimeoutError,
2783
2794
  f as json,
2784
2795
  mt as launchParamsParser,
2785
- ur as mergeClassNames,
2796
+ cr as mergeClassNames,
2786
2797
  q as number,
2787
- $ as off,
2798
+ T as off,
2788
2799
  y as on,
2789
- or as once,
2790
- er as parseInitData,
2791
- jt as parseLaunchParams,
2800
+ ir as once,
2801
+ tr as parseInitData,
2802
+ Gt as parseLaunchParams,
2792
2803
  se as parseMessage,
2793
2804
  bt as parseThemeParams,
2794
2805
  d as postEvent,
2795
2806
  m as request,
2796
- rr as requestThemeParams,
2807
+ er as requestThemeParams,
2797
2808
  At as requestViewport,
2798
2809
  Ct as retrieveLaunchData,
2799
2810
  gt as rgb,
2800
- X as searchParams,
2811
+ tt as searchParams,
2801
2812
  Jt as serializeLaunchParams,
2802
2813
  Ut as serializeThemeParams,
2803
- nr as setDebug,
2804
- ir as setTargetOrigin,
2814
+ S as setCSSVar,
2815
+ sr as setDebug,
2816
+ nr as setTargetOrigin,
2805
2817
  u as string,
2806
- ar as subscribe,
2807
- R as supports,
2818
+ or as subscribe,
2819
+ I as supports,
2808
2820
  _t as themeParamsParser,
2809
2821
  dt as toRGB,
2810
2822
  _e as unsubscribe,
2811
- rt as userParser,
2823
+ st as userParser,
2812
2824
  xt as withTimeout
2813
2825
  };
2814
2826
  //# sourceMappingURL=index.mjs.map