@tma.js/sdk 1.4.9 → 1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
- var Re = Object.defineProperty;
2
- var Ie = (r, e, t) => e in r ? Re(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
- var o = (r, e, t) => (Ie(r, typeof e != "symbol" ? e + "" : e, t), t);
4
- class ue {
1
+ var Ie = Object.defineProperty;
2
+ var Te = (r, e, t) => e in r ? Ie(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var o = (r, e, t) => (Te(r, typeof e != "symbol" ? e + "" : e, t), t);
4
+ class he {
5
5
  constructor(e, t) {
6
6
  this.prefix = e, this.enabled = t;
7
7
  }
@@ -56,53 +56,53 @@ class ue {
56
56
  this.print("warn", ...e);
57
57
  }
58
58
  }
59
- let pe = "https://web.telegram.org";
60
- const q = new ue("[SDK]", !1);
61
- function Zt(r) {
59
+ let ue = "https://web.telegram.org";
60
+ const k = new he("[SDK]", !1);
61
+ function Qt(r) {
62
62
  if (r) {
63
- q.enable();
63
+ k.enable();
64
64
  return;
65
65
  }
66
- q.disable();
66
+ k.disable();
67
67
  }
68
- function Kt(r) {
69
- pe = r;
68
+ function Zt(r) {
69
+ ue = r;
70
70
  }
71
- function Le() {
72
- return pe;
71
+ function $e() {
72
+ return ue;
73
73
  }
74
- function le() {
74
+ function pe() {
75
75
  try {
76
76
  return window.self !== window.top;
77
77
  } catch {
78
78
  return !0;
79
79
  }
80
80
  }
81
- function R(r) {
81
+ function W(r) {
82
82
  return typeof r == "object" && r !== null && !Array.isArray(r);
83
83
  }
84
- function Te(r) {
85
- return "external" in r && R(r.external) && "notify" in r.external && typeof r.external.notify == "function";
84
+ function Le(r) {
85
+ return "external" in r && W(r.external) && "notify" in r.external && typeof r.external.notify == "function";
86
86
  }
87
- function $e(r) {
88
- return "TelegramWebviewProxy" in r && R(r.TelegramWebviewProxy) && "postEvent" in r.TelegramWebviewProxy && typeof r.TelegramWebviewProxy.postEvent == "function";
87
+ function Be(r) {
88
+ return "TelegramWebviewProxy" in r && W(r.TelegramWebviewProxy) && "postEvent" in r.TelegramWebviewProxy && typeof r.TelegramWebviewProxy.postEvent == "function";
89
89
  }
90
90
  function d(r, e, t) {
91
91
  let s = {}, n;
92
92
  e === void 0 && t === void 0 ? s = {} : e !== void 0 && t !== void 0 ? (s = t, n = e) : e !== void 0 && ("targetOrigin" in e ? s = e : n = e);
93
- const { targetOrigin: i = Le() } = s;
94
- if (q.log(`Calling method "${r}"`, n), le()) {
93
+ const { targetOrigin: i = $e() } = s;
94
+ if (k.log(`Calling method "${r}"`, n), pe()) {
95
95
  window.parent.postMessage(JSON.stringify({
96
96
  eventType: r,
97
97
  eventData: n
98
98
  }), i);
99
99
  return;
100
100
  }
101
- if (Te(window)) {
101
+ if (Le(window)) {
102
102
  window.external.notify(JSON.stringify({ eventType: r, eventData: n }));
103
103
  return;
104
104
  }
105
- if ($e(window)) {
105
+ if (Be(window)) {
106
106
  window.TelegramWebviewProxy.postEvent(r, JSON.stringify(n));
107
107
  return;
108
108
  }
@@ -110,7 +110,7 @@ function d(r, e, t) {
110
110
  "Unable to determine current environment and possible way to send event."
111
111
  );
112
112
  }
113
- function Be(r, e) {
113
+ function Oe(r, e) {
114
114
  const t = r.split("."), s = e.split("."), n = Math.max(t.length, s.length);
115
115
  for (let i = 0; i < n; i += 1) {
116
116
  const a = parseInt(t[i] || "0", 10), c = parseInt(s[i] || "0", 10);
@@ -119,15 +119,15 @@ function Be(r, e) {
119
119
  }
120
120
  return 0;
121
121
  }
122
- function P(r, e) {
123
- return Be(r, e) <= 0;
122
+ function v(r, e) {
123
+ return Oe(r, e) <= 0;
124
124
  }
125
- function I(r, e, t) {
125
+ function A(r, e, t) {
126
126
  if (typeof t == "string") {
127
127
  if (r === "web_app_open_link" && e === "try_instant_view")
128
- return P("6.4", t);
128
+ return v("6.4", t);
129
129
  if (r === "web_app_set_header_color" && e === "color")
130
- return P("6.9", t);
130
+ return v("6.9", t);
131
131
  }
132
132
  switch (r) {
133
133
  case "web_app_open_tg_link":
@@ -136,60 +136,63 @@ function I(r, e, t) {
136
136
  case "web_app_set_background_color":
137
137
  case "web_app_set_header_color":
138
138
  case "web_app_trigger_haptic_feedback":
139
- return P("6.1", e);
139
+ return v("6.1", e);
140
140
  case "web_app_open_popup":
141
- return P("6.2", e);
141
+ return v("6.2", e);
142
142
  case "web_app_close_scan_qr_popup":
143
143
  case "web_app_open_scan_qr_popup":
144
144
  case "web_app_read_text_from_clipboard":
145
- return P("6.4", e);
145
+ return v("6.4", e);
146
146
  case "web_app_switch_inline_query":
147
- return P("6.7", e);
147
+ return v("6.7", e);
148
148
  case "web_app_invoke_custom_method":
149
149
  case "web_app_request_write_access":
150
150
  case "web_app_request_phone":
151
- return P("6.9", e);
151
+ return v("6.9", e);
152
152
  case "web_app_setup_settings_button":
153
- return P("6.10", e);
153
+ return v("6.10", e);
154
154
  default:
155
155
  return !0;
156
156
  }
157
157
  }
158
- class Y extends Error {
158
+ class K extends Error {
159
159
  constructor(e, t) {
160
- super(`Method "${e}" is unsupported in the Mini Apps version ${t}.`), Object.setPrototypeOf(this, Y.prototype);
160
+ super(`Method "${e}" is unsupported in the Mini Apps version ${t}.`), Object.setPrototypeOf(this, K.prototype);
161
161
  }
162
162
  }
163
- class X extends Error {
163
+ class Y extends Error {
164
164
  constructor(e, t, s) {
165
- super(`Parameter "${t}" in method "${e}" is unsupported in the Mini Apps version ${s}.`), Object.setPrototypeOf(this, X.prototype);
165
+ super(`Parameter "${t}" in method "${e}" is unsupported in the Mini Apps version ${s}.`), Object.setPrototypeOf(this, Y.prototype);
166
166
  }
167
167
  }
168
168
  function De(r) {
169
169
  return (e, t) => {
170
- if (!I(e, r))
171
- throw new Y(e, r);
172
- if (R(t)) {
170
+ if (!A(e, r))
171
+ throw new K(e, r);
172
+ if (W(t)) {
173
173
  let s;
174
- if (e === "web_app_open_link" && "try_instant_view" in t ? s = "try_instant_view" : e === "web_app_set_header_color" && "color" in t && (s = "color"), s && !I(e, s, r))
175
- throw new X(e, s, r);
174
+ if (e === "web_app_open_link" && "try_instant_view" in t ? s = "try_instant_view" : e === "web_app_set_header_color" && "color" in t && (s = "color"), s && !A(e, s, r))
175
+ throw new Y(e, s, r);
176
176
  }
177
177
  return d(e, t);
178
178
  };
179
179
  }
180
- class F extends Error {
180
+ function le(r) {
181
+ return ({ req_id: e }) => e === r;
182
+ }
183
+ class j extends Error {
181
184
  constructor(t, { cause: s, type: n } = {}) {
182
185
  super(`Unable to parse value${n ? ` as ${n}` : ""}`, { cause: s });
183
186
  /**
184
187
  * Parser name.
185
188
  */
186
189
  o(this, "type");
187
- this.value = t, Object.setPrototypeOf(this, F.prototype), this.type = n;
190
+ this.value = t, Object.setPrototypeOf(this, j.prototype), this.type = n;
188
191
  }
189
192
  }
190
- class j extends Error {
193
+ class G extends Error {
191
194
  constructor(e, { cause: t, type: s } = {}) {
192
- super(`Unable to parse field "${e}"${s ? ` as ${s}` : ""}`, { cause: t }), Object.setPrototypeOf(this, j.prototype);
195
+ super(`Unable to parse field "${e}"${s ? ` as ${s}` : ""}`, { cause: t }), Object.setPrototypeOf(this, G.prototype);
193
196
  }
194
197
  }
195
198
  function de(r, e) {
@@ -210,25 +213,25 @@ function de(r, e) {
210
213
  try {
211
214
  c = a(u);
212
215
  } catch (p) {
213
- throw p instanceof F ? new j(i, {
216
+ throw p instanceof j ? new G(i, {
214
217
  type: p.type,
215
218
  cause: p
216
- }) : new j(i, { cause: p });
219
+ }) : new G(i, { cause: p });
217
220
  }
218
221
  c !== void 0 && (t[s] = c);
219
222
  }
220
223
  return t;
221
224
  }
222
- function L() {
225
+ function V() {
223
226
  return new TypeError("Value has unexpected type");
224
227
  }
225
- function ee(r) {
228
+ function X(r) {
226
229
  let e = r;
227
230
  if (typeof e == "string" && (e = JSON.parse(e)), typeof e != "object" || e === null || Array.isArray(e))
228
- throw L();
231
+ throw V();
229
232
  return e;
230
233
  }
231
- class z {
234
+ class F {
232
235
  constructor(e, t, s) {
233
236
  this.parser = e, this.isOptional = t, this.type = s;
234
237
  }
@@ -237,7 +240,7 @@ class z {
237
240
  try {
238
241
  return this.parser(e);
239
242
  } catch (t) {
240
- throw new F(e, { type: this.type, cause: t });
243
+ throw new j(e, { type: this.type, cause: t });
241
244
  }
242
245
  }
243
246
  optional() {
@@ -245,24 +248,24 @@ class z {
245
248
  }
246
249
  }
247
250
  function f(r, e) {
248
- return new z((t) => {
249
- const s = ee(t);
251
+ return new F((t) => {
252
+ const s = X(t);
250
253
  return de(r, (n) => s[n]);
251
254
  }, !1, e);
252
255
  }
253
- function T(r, e) {
254
- return () => new z(r, !1, e);
256
+ function R(r, e) {
257
+ return () => new F(r, !1, e);
255
258
  }
256
- const h = T((r) => {
259
+ const h = R((r) => {
257
260
  if (typeof r == "string" || typeof r == "number")
258
261
  return r.toString();
259
- throw L();
260
- }, "string"), We = f({
261
- eventType: h(),
262
- eventData: (r) => r
263
- });
264
- function Oe(r) {
265
- return We.parse(r);
262
+ throw V();
263
+ }, "string");
264
+ function We(r) {
265
+ return f({
266
+ eventType: h(),
267
+ eventData: (e) => e
268
+ }).parse(r);
266
269
  }
267
270
  function He(r, e) {
268
271
  window.dispatchEvent(new MessageEvent("message", {
@@ -295,7 +298,7 @@ function Ue(r) {
295
298
  Ne(), window.addEventListener("message", (e) => {
296
299
  if (e.source === window.parent)
297
300
  try {
298
- const { eventType: t, eventData: s } = Oe(e.data);
301
+ const { eventType: t, eventData: s } = We(e.data);
299
302
  r(t, s);
300
303
  } catch {
301
304
  }
@@ -333,7 +336,7 @@ function Je() {
333
336
  data: h().optional()
334
337
  });
335
338
  }
336
- function te(r) {
339
+ function ee(r) {
337
340
  return /^#[\da-f]{6}$/i.test(r);
338
341
  }
339
342
  function Qe(r) {
@@ -341,7 +344,7 @@ function Qe(r) {
341
344
  }
342
345
  function fe(r) {
343
346
  const e = r.replace(/\s/g, "").toLowerCase();
344
- if (te(e))
347
+ if (ee(e))
345
348
  return e;
346
349
  if (Qe(e)) {
347
350
  let s = "#";
@@ -357,16 +360,16 @@ function fe(r) {
357
360
  return s + (i.length === 1 ? "0" : "") + i;
358
361
  }, "#");
359
362
  }
360
- const ge = T((r) => fe(h().parse(r)), "rgb");
363
+ const ge = R((r) => fe(h().parse(r)), "rgb");
361
364
  function Ze() {
362
365
  return f({
363
366
  theme_params: (r) => {
364
367
  const e = ge().optional();
365
- return Object.entries(ee(r)).reduce((t, [s, n]) => (t[s] = e.parse(n), t), {});
368
+ return Object.entries(X(r)).reduce((t, [s, n]) => (t[s] = e.parse(n), t), {});
366
369
  }
367
370
  });
368
371
  }
369
- const k = T((r) => {
372
+ const P = R((r) => {
370
373
  if (typeof r == "boolean")
371
374
  return r;
372
375
  const e = String(r);
@@ -374,8 +377,8 @@ const k = T((r) => {
374
377
  return !0;
375
378
  if (e === "0" || e === "false")
376
379
  return !1;
377
- throw L();
378
- }, "boolean"), A = T((r) => {
380
+ throw V();
381
+ }, "boolean"), x = R((r) => {
379
382
  if (typeof r == "number")
380
383
  return r;
381
384
  if (typeof r == "string") {
@@ -383,14 +386,14 @@ const k = T((r) => {
383
386
  if (!Number.isNaN(e))
384
387
  return e;
385
388
  }
386
- throw L();
389
+ throw V();
387
390
  }, "number");
388
391
  function Ke() {
389
392
  return f({
390
- height: A(),
391
- width: (r) => r == null ? window.innerWidth : A().parse(r),
392
- is_state_stable: k(),
393
- is_expanded: k()
393
+ height: x(),
394
+ width: (r) => r == null ? window.innerWidth : x().parse(r),
395
+ is_state_stable: P(),
396
+ is_expanded: P()
394
397
  });
395
398
  }
396
399
  function Ye() {
@@ -480,7 +483,7 @@ class w {
480
483
  }
481
484
  function Xe() {
482
485
  const r = new w(), e = (t, ...s) => {
483
- q.log("Emitting processed event:", t, ...s), r.emit(t, ...s);
486
+ k.log("Emitting processed event:", t, ...s), r.emit(t, ...s);
484
487
  };
485
488
  return window.addEventListener("resize", () => {
486
489
  e("viewport_changed", {
@@ -490,7 +493,7 @@ function Xe() {
490
493
  is_expanded: !0
491
494
  });
492
495
  }), Ue((t, s) => {
493
- q.log("Received raw event:", t, s);
496
+ k.log("Received raw event:", t, s);
494
497
  try {
495
498
  switch (t) {
496
499
  case "viewport_changed":
@@ -526,92 +529,99 @@ function Xe() {
526
529
  return e(t, s);
527
530
  }
528
531
  } catch (n) {
529
- q.error("Error processing event:", n);
532
+ k.error("Error processing event:", n);
530
533
  }
531
534
  }), r;
532
535
  }
533
- const Q = "telegram-mini-apps-cached-emitter";
534
- function U() {
536
+ const J = "telegram-mini-apps-cached-emitter";
537
+ function H() {
535
538
  const r = window;
536
- return r[Q] === void 0 && (r[Q] = Xe()), r[Q];
539
+ return r[J] === void 0 && (r[J] = Xe()), r[J];
537
540
  }
538
- function $(r, e) {
539
- U().off(r, e);
541
+ function I(r, e) {
542
+ H().off(r, e);
540
543
  }
541
- function y(r, e) {
542
- return U().on(r, e), () => $(r, e);
544
+ function E(r, e) {
545
+ return H().on(r, e), () => I(r, e);
543
546
  }
544
- class J extends Error {
547
+ class z extends Error {
545
548
  constructor(e) {
546
- super(`Async call timeout exceeded. Timeout: ${e}`), Object.setPrototypeOf(this, J.prototype);
549
+ super(`Async call timeout exceeded. Timeout: ${e}`), Object.setPrototypeOf(this, z.prototype);
547
550
  }
548
551
  }
549
552
  function et(r) {
550
553
  return new Promise((e, t) => {
551
- setTimeout(t, r, new J(r));
554
+ setTimeout(t, r, new z(r));
552
555
  });
553
556
  }
554
557
  function we(r, e) {
555
558
  return Promise.race([
556
- r(),
559
+ typeof r == "function" ? r() : r,
557
560
  et(e)
558
561
  ]);
559
562
  }
560
- function m(r, e, t, s) {
561
- let n, i, a, c;
562
- typeof e == "string" || Array.isArray(e) ? (a = Array.isArray(e) ? e : [e], n = t) : (i = e, a = Array.isArray(t) ? t : [t], n = s), R(i) && typeof i.req_id == "string" && (c = i.req_id);
563
- const { postEvent: u = d, timeout: p } = n || {}, g = n && "capture" in n ? n.capture : null, _ = () => new Promise((V, l) => {
564
- const C = a.map((v) => y(v, (M) => {
565
- c && (!R(M) || M.req_id !== c) || typeof g == "function" && !g(M) || (x(), V(M));
566
- })), x = () => C.forEach((v) => v());
567
- try {
568
- u(r, i);
569
- } catch (v) {
570
- x(), l(v);
571
- }
572
- });
573
- return typeof p == "number" ? we(_, p) : _();
563
+ async function y(r, e, t) {
564
+ let s;
565
+ const n = new Promise((b) => {
566
+ s = b;
567
+ }), i = e ? {
568
+ ...t,
569
+ event: e,
570
+ method: r
571
+ } : r, {
572
+ method: a,
573
+ event: c,
574
+ capture: u,
575
+ postEvent: p = d,
576
+ timeout: g
577
+ } = i, _ = (Array.isArray(c) ? c : [c]).map(
578
+ (b) => E(b, (l) => (!u || u(l)) && s(l))
579
+ );
580
+ try {
581
+ return p(a, i.params), await (g ? we(n, g) : n);
582
+ } finally {
583
+ _.forEach((b) => b());
584
+ }
574
585
  }
575
- async function H(r, e, t, s = {}) {
576
- const { result: n, error: i } = await m(
577
- "web_app_invoke_custom_method",
578
- {
586
+ async function O(r, e, t, s = {}) {
587
+ const {
588
+ result: n,
589
+ error: i
590
+ } = await y("web_app_invoke_custom_method", "custom_method_invoked", {
591
+ ...s,
592
+ params: {
579
593
  method: r,
580
594
  params: e,
581
595
  req_id: t
582
596
  },
583
- "custom_method_invoked",
584
- s
585
- );
597
+ capture: le(t)
598
+ });
586
599
  if (i)
587
600
  throw new Error(i);
588
601
  return n;
589
602
  }
590
- function Yt(r, e) {
591
- return U().once(r, e), () => $(r, e);
603
+ function Kt(r, e) {
604
+ return H().once(r, e), () => I(r, e);
592
605
  }
593
606
  function tt(r) {
594
- U().unsubscribe(r);
607
+ H().unsubscribe(r);
595
608
  }
596
- function Xt(r) {
597
- return U().subscribe(r), () => tt(r);
609
+ function Yt(r) {
610
+ return H().subscribe(r), () => tt(r);
598
611
  }
599
- function ne(r, e) {
600
- return r + (r.length > 0 && e.length > 0 ? ` ${e}` : e);
612
+ function U(r, e) {
613
+ return r + (r.length && e.length ? ` ${e}` : e);
601
614
  }
602
- function rt(...r) {
603
- return r.reduce((e, t) => {
604
- let s = "";
605
- return typeof t == "string" ? s = t : typeof t == "object" && t !== null && (s = Object.entries(t).reduce((n, [i, a]) => a ? ne(n, i) : n, "")), ne(e, s);
606
- }, "");
615
+ function _e(...r) {
616
+ return r.reduce((e, t) => typeof t == "string" ? U(e, t) : W(t) ? U(e, Object.entries(t).reduce((s, n) => n[1] ? U(s, n[0]) : s, "")) : Array.isArray(t) ? U(e, _e(...t)) : e, "");
607
617
  }
608
- function er(...r) {
609
- return r.reduce((e, t) => (R(t) && Object.entries(t).forEach(([s, n]) => {
610
- const i = rt(e[s], n);
618
+ function Xt(...r) {
619
+ return r.reduce((e, t) => (W(t) && Object.entries(t).forEach(([s, n]) => {
620
+ const i = _e(e[s], n);
611
621
  i.length > 0 && (e[s] = i);
612
622
  }), e), {});
613
623
  }
614
- function _e(r) {
624
+ function be(r) {
615
625
  const e = fe(r);
616
626
  return Math.sqrt(
617
627
  [0.299, 0.587, 0.114].reduce((s, n, i) => {
@@ -620,7 +630,7 @@ function _e(r) {
620
630
  }, 0)
621
631
  ) < 120;
622
632
  }
623
- class b {
633
+ class m {
624
634
  constructor(e, t) {
625
635
  this.state = e, this.ee = t;
626
636
  }
@@ -650,6 +660,56 @@ class b {
650
660
  return this.state[e];
651
661
  }
652
662
  }
663
+ function C(r, e) {
664
+ return (t) => A(e[t], r);
665
+ }
666
+ class rt {
667
+ constructor(e, t, s = d) {
668
+ o(this, "ee", new w());
669
+ o(this, "state");
670
+ /**
671
+ * Adds event listener.
672
+ * @param event - event name.
673
+ * @param listener - event listener.
674
+ */
675
+ o(this, "on", (e, t) => e === "click" ? E("back_button_pressed", t) : this.ee.on(e, t));
676
+ /**
677
+ * Removes event listener.
678
+ * @param event - event name.
679
+ * @param listener - event listener.
680
+ */
681
+ o(this, "off", (e, t) => e === "click" ? I("back_button_pressed", t) : this.ee.off(e, t));
682
+ /**
683
+ * Checks if specified method is supported by current component.
684
+ */
685
+ o(this, "supports");
686
+ this.postEvent = s, this.state = new m({ isVisible: e }, this.ee), this.supports = C(t, {
687
+ show: "web_app_setup_back_button",
688
+ hide: "web_app_setup_back_button"
689
+ });
690
+ }
691
+ set isVisible(e) {
692
+ this.state.set("isVisible", e), this.postEvent("web_app_setup_back_button", { is_visible: e });
693
+ }
694
+ /**
695
+ * True if BackButton is currently visible.
696
+ */
697
+ get isVisible() {
698
+ return this.state.get("isVisible");
699
+ }
700
+ /**
701
+ * Hides the BackButton.
702
+ */
703
+ hide() {
704
+ this.isVisible = !1;
705
+ }
706
+ /**
707
+ * Shows the BackButton.
708
+ */
709
+ show() {
710
+ this.isVisible = !0;
711
+ }
712
+ }
653
713
  class st {
654
714
  constructor(e, t = d) {
655
715
  o(this, "ee", new w());
@@ -662,7 +722,7 @@ class st {
662
722
  * Removes event listener.
663
723
  */
664
724
  o(this, "off", this.ee.off.bind(this.ee));
665
- this.postEvent = t, this.state = new b({ isConfirmationNeeded: e }, this.ee);
725
+ this.postEvent = t, this.state = new m({ isConfirmationNeeded: e }, this.ee);
666
726
  }
667
727
  set isConfirmationNeeded(e) {
668
728
  this.state.set("isConfirmationNeeded", e), this.postEvent("web_app_setup_closing_behavior", { need_confirmation: e });
@@ -699,9 +759,9 @@ function nt(r) {
699
759
  return e;
700
760
  } catch {
701
761
  }
702
- throw L();
762
+ throw V();
703
763
  }
704
- class it extends z {
764
+ class it extends F {
705
765
  constructor(t, s, n) {
706
766
  super(nt, s, n);
707
767
  o(this, "itemParser");
@@ -718,10 +778,7 @@ class it extends z {
718
778
  function ot(r) {
719
779
  return new it((e) => e, !1, r);
720
780
  }
721
- function E(r, e) {
722
- return (t) => I(e[t], r);
723
- }
724
- function ie(r, e) {
781
+ function ne(r, e) {
725
782
  return r.reduce((t, s) => (t[s] = e, t), {});
726
783
  }
727
784
  class at {
@@ -730,7 +787,7 @@ class at {
730
787
  * Checks if specified method is supported by current component.
731
788
  */
732
789
  o(this, "supports");
733
- this.createRequestId = t, this.postEvent = s, this.supports = E(e, {
790
+ this.createRequestId = t, this.postEvent = s, this.supports = C(e, {
734
791
  delete: "web_app_invoke_custom_method",
735
792
  get: "web_app_invoke_custom_method",
736
793
  getKeys: "web_app_invoke_custom_method",
@@ -744,7 +801,7 @@ class at {
744
801
  */
745
802
  async delete(e, t = {}) {
746
803
  const s = Array.isArray(e) ? e : [e];
747
- s.length !== 0 && await H(
804
+ s.length !== 0 && await O(
748
805
  "deleteStorageValues",
749
806
  { keys: s },
750
807
  this.createRequestId(),
@@ -756,7 +813,7 @@ class at {
756
813
  * @param options - request execution options.
757
814
  */
758
815
  async getKeys(e = {}) {
759
- const t = await H(
816
+ const t = await O(
760
817
  "getStorageKeys",
761
818
  {},
762
819
  this.createRequestId(),
@@ -767,10 +824,10 @@ class at {
767
824
  async get(e, t = {}) {
768
825
  const s = Array.isArray(e) ? e : [e];
769
826
  if (s.length === 0)
770
- return ie(s, "");
827
+ return ne(s, "");
771
828
  const n = f(
772
- ie(s, h())
773
- ), i = await H(
829
+ ne(s, h())
830
+ ), i = await O(
774
831
  "getStorageValues",
775
832
  { keys: s },
776
833
  this.createRequestId(),
@@ -785,7 +842,7 @@ class at {
785
842
  * @param options - request execution options.
786
843
  */
787
844
  async set(e, t, s = {}) {
788
- await H(
845
+ await O(
789
846
  "saveStorageValue",
790
847
  { key: e, value: t },
791
848
  this.createRequestId(),
@@ -799,7 +856,7 @@ class ct {
799
856
  * Checks if specified method is supported by current component.
800
857
  */
801
858
  o(this, "supports");
802
- this.postEvent = t, this.supports = E(e, {
859
+ this.postEvent = t, this.supports = C(e, {
803
860
  impactOccurred: "web_app_trigger_haptic_feedback",
804
861
  notificationOccurred: "web_app_trigger_haptic_feedback",
805
862
  selectionChanged: "web_app_trigger_haptic_feedback"
@@ -841,7 +898,7 @@ class ct {
841
898
  }
842
899
  function ht() {
843
900
  return f({
844
- id: A(),
901
+ id: x(),
845
902
  type: h(),
846
903
  title: h(),
847
904
  photoUrl: {
@@ -924,27 +981,27 @@ class ut {
924
981
  return this.initData.user;
925
982
  }
926
983
  }
927
- function oe() {
984
+ function ie() {
928
985
  return f({
929
986
  addedToAttachmentMenu: {
930
- type: k().optional(),
987
+ type: P().optional(),
931
988
  from: "added_to_attachment_menu"
932
989
  },
933
990
  allowsWriteToPm: {
934
- type: k().optional(),
991
+ type: P().optional(),
935
992
  from: "allows_write_to_pm"
936
993
  },
937
994
  firstName: {
938
995
  type: h(),
939
996
  from: "first_name"
940
997
  },
941
- id: A(),
998
+ id: x(),
942
999
  isBot: {
943
- type: k().optional(),
1000
+ type: P().optional(),
944
1001
  from: "is_bot"
945
1002
  },
946
1003
  isPremium: {
947
- type: k().optional(),
1004
+ type: P().optional(),
948
1005
  from: "is_premium"
949
1006
  },
950
1007
  languageCode: {
@@ -962,11 +1019,11 @@ function oe() {
962
1019
  username: h().optional()
963
1020
  }, "User");
964
1021
  }
965
- const be = T((r) => r instanceof Date ? r : new Date(A().parse(r) * 1e3), "Date");
966
- function re(r, e) {
967
- return new z((t) => {
1022
+ const me = R((r) => r instanceof Date ? r : new Date(x().parse(r) * 1e3), "Date");
1023
+ function te(r, e) {
1024
+ return new F((t) => {
968
1025
  if (typeof t != "string" && !(t instanceof URLSearchParams))
969
- throw L();
1026
+ throw V();
970
1027
  const s = typeof t == "string" ? new URLSearchParams(t) : t;
971
1028
  return de(r, (n) => {
972
1029
  const i = s.get(n);
@@ -974,14 +1031,14 @@ function re(r, e) {
974
1031
  });
975
1032
  }, !1, e);
976
1033
  }
977
- function me() {
978
- return re({
1034
+ function ye() {
1035
+ return te({
979
1036
  authDate: {
980
- type: be(),
1037
+ type: me(),
981
1038
  from: "auth_date"
982
1039
  },
983
1040
  canSendAfter: {
984
- type: A().optional(),
1041
+ type: x().optional(),
985
1042
  from: "can_send_after"
986
1043
  },
987
1044
  chat: ht().optional(),
@@ -998,16 +1055,16 @@ function me() {
998
1055
  type: h().optional(),
999
1056
  from: "query_id"
1000
1057
  },
1001
- receiver: oe().optional(),
1058
+ receiver: ie().optional(),
1002
1059
  startParam: {
1003
1060
  type: h().optional(),
1004
1061
  from: "start_param"
1005
1062
  },
1006
- user: oe().optional()
1063
+ user: ie().optional()
1007
1064
  }, "InitData");
1008
1065
  }
1009
- function tr(r) {
1010
- return me().parse(r);
1066
+ function er(r) {
1067
+ return ye().parse(r);
1011
1068
  }
1012
1069
  function pt(r) {
1013
1070
  const { hostname: e, pathname: t } = new URL(r, window.location.href);
@@ -1034,7 +1091,7 @@ class lt {
1034
1091
  * Checks if specified method is supported by current component.
1035
1092
  */
1036
1093
  o(this, "supports");
1037
- this.postEvent = t, this.state = new b({ isOpened: !1 }, this.ee), this.supports = E(e, { open: "web_app_open_invoice" });
1094
+ this.postEvent = t, this.state = new m({ isOpened: !1 }, this.ee), this.supports = C(e, { open: "web_app_open_invoice" });
1038
1095
  }
1039
1096
  set isOpened(e) {
1040
1097
  this.state.set("isOpened", e);
@@ -1051,17 +1108,13 @@ class lt {
1051
1108
  const s = t ? pt(e) : e;
1052
1109
  this.isOpened = !0;
1053
1110
  try {
1054
- return (await m(
1055
- "web_app_open_invoice",
1056
- { slug: s },
1057
- "invoice_closed",
1058
- {
1059
- postEvent: this.postEvent,
1060
- capture(i) {
1061
- return s === i.slug;
1062
- }
1111
+ return (await y("web_app_open_invoice", "invoice_closed", {
1112
+ params: { slug: s },
1113
+ postEvent: this.postEvent,
1114
+ capture(i) {
1115
+ return s === i.slug;
1063
1116
  }
1064
- )).status;
1117
+ })).status;
1065
1118
  } finally {
1066
1119
  this.isOpened = !1;
1067
1120
  }
@@ -1081,14 +1134,14 @@ class dt {
1081
1134
  // FIXME: Event 'main_button_pressed' is still being received on Android
1082
1135
  // even if the main button is disabled.
1083
1136
  // Issue: https://github.com/Telegram-Mini-Apps/tma.js/issues/3
1084
- e === "click" ? y("main_button_pressed", t) : this.ee.on(e, t)
1137
+ e === "click" ? E("main_button_pressed", t) : this.ee.on(e, t)
1085
1138
  ));
1086
1139
  /**
1087
1140
  * Removes event listener.
1088
1141
  * @param event - event name.
1089
1142
  * @param listener - event listener.
1090
1143
  */
1091
- o(this, "off", (e, t) => e === "click" ? $("main_button_pressed", t) : this.ee.off(e, t));
1144
+ o(this, "off", (e, t) => e === "click" ? I("main_button_pressed", t) : this.ee.off(e, t));
1092
1145
  const {
1093
1146
  postEvent: t = d,
1094
1147
  text: s,
@@ -1098,7 +1151,7 @@ class dt {
1098
1151
  isVisible: c,
1099
1152
  isLoaderVisible: u
1100
1153
  } = e;
1101
- this.postEvent = t, this.state = new b({
1154
+ this.postEvent = t, this.state = new m({
1102
1155
  backgroundColor: i,
1103
1156
  isEnabled: a,
1104
1157
  isVisible: c,
@@ -1232,10 +1285,10 @@ class dt {
1232
1285
  return this.state.set(e), this.commit(), this;
1233
1286
  }
1234
1287
  }
1235
- const ft = re({
1288
+ const ft = te({
1236
1289
  contact: f({
1237
1290
  userId: {
1238
- type: A(),
1291
+ type: x(),
1239
1292
  from: "user_id"
1240
1293
  },
1241
1294
  phoneNumber: {
@@ -1252,15 +1305,15 @@ const ft = re({
1252
1305
  }
1253
1306
  }),
1254
1307
  authDate: {
1255
- type: be(),
1308
+ type: me(),
1256
1309
  from: "auth_date"
1257
1310
  },
1258
1311
  hash: h()
1259
1312
  });
1260
- function ye(r, e) {
1313
+ function Ee(r, e) {
1261
1314
  return (t) => {
1262
1315
  const [s, n] = e[t];
1263
- return I(s, n, r);
1316
+ return A(s, n, r);
1264
1317
  };
1265
1318
  }
1266
1319
  function gt(r) {
@@ -1300,14 +1353,14 @@ class wt {
1300
1353
  version: i,
1301
1354
  botInline: a,
1302
1355
  createRequestId: c
1303
- } = e, u = E(i, {
1356
+ } = e, u = C(i, {
1304
1357
  requestPhoneAccess: "web_app_request_phone",
1305
1358
  requestWriteAccess: "web_app_request_write_access",
1306
1359
  switchInlineQuery: "web_app_switch_inline_query",
1307
1360
  setHeaderColor: "web_app_set_header_color",
1308
1361
  setBackgroundColor: "web_app_set_background_color"
1309
1362
  });
1310
- this.postEvent = t, this.botInline = a, this.createRequestId = c, this.supports = (p) => !(!u(p) || p === "switchInlineQuery" && !a), this.state = new b({ backgroundColor: n, headerColor: s }, this.ee), this.supportsParam = ye(i, {
1363
+ this.postEvent = t, this.botInline = a, this.createRequestId = c, this.supports = (p) => !(!u(p) || p === "switchInlineQuery" && !a), this.state = new m({ backgroundColor: n, headerColor: s }, this.ee), this.supportsParam = Ee(i, {
1311
1364
  "setHeaderColor.color": ["web_app_set_header_color", "color"]
1312
1365
  });
1313
1366
  }
@@ -1315,7 +1368,7 @@ class wt {
1315
1368
  * Attempts to get requested contact.
1316
1369
  */
1317
1370
  async getRequestedContact() {
1318
- return H(
1371
+ return O(
1319
1372
  "getRequestedContact",
1320
1373
  {},
1321
1374
  this.createRequestId(),
@@ -1353,7 +1406,7 @@ class wt {
1353
1406
  * True if current Mini App background color recognized as dark.
1354
1407
  */
1355
1408
  get isDark() {
1356
- return _e(this.backgroundColor);
1409
+ return be(this.backgroundColor);
1357
1410
  }
1358
1411
  /**
1359
1412
  * True if phone access is currently being requested.
@@ -1417,7 +1470,7 @@ class wt {
1417
1470
  requestPhoneAccess(e = {}) {
1418
1471
  if (this.requestingPhoneAccess)
1419
1472
  throw new Error("Phone access is already being requested.");
1420
- return this.requestingPhoneAccess = !0, m("web_app_request_phone", "phone_requested", {
1473
+ return this.requestingPhoneAccess = !0, y("web_app_request_phone", "phone_requested", {
1421
1474
  ...e,
1422
1475
  postEvent: this.postEvent
1423
1476
  }).then((t) => t.status).finally(() => {
@@ -1431,7 +1484,7 @@ class wt {
1431
1484
  requestWriteAccess(e = {}) {
1432
1485
  if (this.requestingWriteAccess)
1433
1486
  throw new Error("Write access is already being requested.");
1434
- return this.requestingWriteAccess = !0, m("web_app_request_write_access", "write_access_requested", {
1487
+ return this.requestingWriteAccess = !0, y("web_app_request_write_access", "write_access_requested", {
1435
1488
  ...e,
1436
1489
  postEvent: this.postEvent
1437
1490
  }).then((t) => t.status).finally(() => {
@@ -1458,7 +1511,7 @@ class wt {
1458
1511
  * @param color - color key or RGB color.
1459
1512
  */
1460
1513
  setHeaderColor(e) {
1461
- this.postEvent("web_app_set_header_color", te(e) ? { color: e } : { color_key: e }), this.state.set("headerColor", e);
1514
+ this.postEvent("web_app_set_header_color", ee(e) ? { color: e } : { color_key: e }), this.state.set("headerColor", e);
1462
1515
  }
1463
1516
  /**
1464
1517
  * Updates current Mini App background color.
@@ -1526,7 +1579,7 @@ class bt {
1526
1579
  * Checks if specified method is supported by current component.
1527
1580
  */
1528
1581
  o(this, "supports");
1529
- this.postEvent = t, this.state = new b({ isOpened: !1 }, this.ee), this.supports = E(e, { open: "web_app_open_popup" });
1582
+ this.postEvent = t, this.state = new m({ isOpened: !1 }, this.ee), this.supports = C(e, { open: "web_app_open_popup" });
1530
1583
  }
1531
1584
  set isOpened(e) {
1532
1585
  this.state.set("isOpened", e);
@@ -1553,12 +1606,10 @@ class bt {
1553
1606
  open(e) {
1554
1607
  if (this.isOpened)
1555
1608
  throw new Error("Popup is already opened.");
1556
- return this.isOpened = !0, m(
1557
- "web_app_open_popup",
1558
- _t(e),
1559
- "popup_closed",
1560
- { postEvent: this.postEvent }
1561
- ).then(({ button_id: t = null }) => t).finally(() => {
1609
+ return this.isOpened = !0, y("web_app_open_popup", "popup_closed", {
1610
+ postEvent: this.postEvent,
1611
+ params: _t(e)
1612
+ }).then(({ button_id: t = null }) => t).finally(() => {
1562
1613
  this.isOpened = !1;
1563
1614
  });
1564
1615
  }
@@ -1579,7 +1630,7 @@ class mt {
1579
1630
  * Checks if specified method is supported by current component.
1580
1631
  */
1581
1632
  o(this, "supports");
1582
- this.postEvent = t, this.state = new b({ isOpened: !1 }, this.ee), this.supports = E(e, {
1633
+ this.postEvent = t, this.state = new m({ isOpened: !1 }, this.ee), this.supports = C(e, {
1583
1634
  close: "web_app_close_scan_qr_popup",
1584
1635
  open: "web_app_open_scan_qr_popup"
1585
1636
  });
@@ -1610,11 +1661,13 @@ class mt {
1610
1661
  throw new Error("QR scanner is already opened.");
1611
1662
  this.isOpened = !0;
1612
1663
  try {
1613
- const t = await m(
1664
+ const t = await y(
1614
1665
  "web_app_open_scan_qr_popup",
1615
- { text: e },
1616
1666
  ["qr_text_received", "scan_qr_popup_closed"],
1617
- { postEvent: this.postEvent }
1667
+ {
1668
+ postEvent: this.postEvent,
1669
+ params: { text: e }
1670
+ }
1618
1671
  );
1619
1672
  return typeof t == "object" && typeof t.data == "string" ? t.data : null;
1620
1673
  } finally {
@@ -1631,18 +1684,18 @@ class yt {
1631
1684
  * @param event - event name.
1632
1685
  * @param listener - event listener.
1633
1686
  */
1634
- o(this, "on", (e, t) => e === "click" ? y("settings_button_pressed", t) : this.ee.on(e, t));
1687
+ o(this, "on", (e, t) => e === "click" ? E("settings_button_pressed", t) : this.ee.on(e, t));
1635
1688
  /**
1636
1689
  * Removes event listener.
1637
1690
  * @param event - event name.
1638
1691
  * @param listener - event listener.
1639
1692
  */
1640
- o(this, "off", (e, t) => e === "click" ? $("settings_button_pressed", t) : this.ee.off(e, t));
1693
+ o(this, "off", (e, t) => e === "click" ? I("settings_button_pressed", t) : this.ee.off(e, t));
1641
1694
  /**
1642
1695
  * Checks if specified method is supported by current component.
1643
1696
  */
1644
1697
  o(this, "supports");
1645
- this.postEvent = s, this.state = new b({ isVisible: e }, this.ee), this.supports = E(t, {
1698
+ this.postEvent = s, this.state = new m({ isVisible: e }, this.ee), this.supports = C(t, {
1646
1699
  show: "web_app_setup_settings_button",
1647
1700
  hide: "web_app_setup_settings_button"
1648
1701
  });
@@ -1675,18 +1728,18 @@ function Et(r) {
1675
1728
  function Ct(r) {
1676
1729
  return r.replace(/[A-Z]/g, (e) => `_${e.toLowerCase()}`).replace(/(^|_)background/, (e, t) => `${t}bg`);
1677
1730
  }
1678
- const Ee = T(
1731
+ const Ce = R(
1679
1732
  (r) => {
1680
1733
  const e = ge().optional();
1681
- return Object.entries(ee(r)).reduce((t, [s, n]) => (t[Et(s)] = e.parse(n), t), {});
1734
+ return Object.entries(X(r)).reduce((t, [s, n]) => (t[Et(s)] = e.parse(n), t), {});
1682
1735
  },
1683
1736
  "ThemeParams"
1684
1737
  );
1685
- function Ce(r) {
1686
- return Ee().parse(r);
1738
+ function ve(r) {
1739
+ return Ce().parse(r);
1687
1740
  }
1688
- function rr(r = {}) {
1689
- return m("web_app_request_theme", "theme_changed", r).then(Ce);
1741
+ function tr(r) {
1742
+ return y("web_app_request_theme", "theme_changed", r).then(ve);
1690
1743
  }
1691
1744
  function vt(r) {
1692
1745
  return JSON.stringify(
@@ -1705,7 +1758,7 @@ class Pt {
1705
1758
  * Removes event listener.
1706
1759
  */
1707
1760
  o(this, "off", this.ee.off.bind(this.ee));
1708
- this.state = new b(e, this.ee);
1761
+ this.state = new m(e, this.ee);
1709
1762
  }
1710
1763
  /**
1711
1764
  * @since v6.10
@@ -1752,7 +1805,7 @@ class Pt {
1752
1805
  * value is calculated according to theme background color.
1753
1806
  */
1754
1807
  get isDark() {
1755
- return !this.backgroundColor || _e(this.backgroundColor);
1808
+ return !this.backgroundColor || be(this.backgroundColor);
1756
1809
  }
1757
1810
  get linkColor() {
1758
1811
  return this.get("linkColor");
@@ -1777,8 +1830,8 @@ class Pt {
1777
1830
  * @returns Function to stop listening.
1778
1831
  */
1779
1832
  listen() {
1780
- return y("theme_changed", (e) => {
1781
- this.state.set(Ce(e.theme_params));
1833
+ return E("theme_changed", (e) => {
1834
+ this.state.set(ve(e.theme_params));
1782
1835
  });
1783
1836
  }
1784
1837
  /**
@@ -1791,7 +1844,7 @@ class Pt {
1791
1844
  return this.get("textColor");
1792
1845
  }
1793
1846
  }
1794
- class kt {
1847
+ class St {
1795
1848
  constructor(e, t, s = d) {
1796
1849
  /**
1797
1850
  * Checks if specified method is supported by current component.
@@ -1801,9 +1854,9 @@ class kt {
1801
1854
  * Checks if specified method parameter is supported by current component.
1802
1855
  */
1803
1856
  o(this, "supportsParam");
1804
- this.version = e, this.createRequestId = t, this.postEvent = s, this.supports = E(e, {
1857
+ this.version = e, this.createRequestId = t, this.postEvent = s, this.supports = C(e, {
1805
1858
  readTextFromClipboard: "web_app_read_text_from_clipboard"
1806
- }), this.supportsParam = ye(e, {
1859
+ }), this.supportsParam = Ee(e, {
1807
1860
  "openLink.tryInstantView": ["web_app_open_link", "try_instant_view"]
1808
1861
  });
1809
1862
  }
@@ -1818,7 +1871,7 @@ class kt {
1818
1871
  */
1819
1872
  openLink(e, t) {
1820
1873
  const s = new URL(e, window.location.href).toString();
1821
- if (!I("web_app_open_link", this.version)) {
1874
+ if (!A("web_app_open_link", this.version)) {
1822
1875
  window.open(s, "_blank");
1823
1876
  return;
1824
1877
  }
@@ -1841,7 +1894,7 @@ class kt {
1841
1894
  } = new URL(e, window.location.href);
1842
1895
  if (t !== "t.me")
1843
1896
  throw new Error(`URL has not allowed hostname: ${t}. Only "t.me" is allowed`);
1844
- if (!I("web_app_open_tg_link", this.version)) {
1897
+ if (!A("web_app_open_tg_link", this.version)) {
1845
1898
  window.location.href = e;
1846
1899
  return;
1847
1900
  }
@@ -1853,20 +1906,22 @@ class kt {
1853
1906
  * - Value in clipboard is not text
1854
1907
  * - Access to clipboard is not allowed
1855
1908
  */
1856
- readTextFromClipboard() {
1857
- return m(
1858
- "web_app_read_text_from_clipboard",
1859
- { req_id: this.createRequestId() },
1860
- "clipboard_text_received",
1861
- { postEvent: this.postEvent }
1862
- ).then(({ data: e = null }) => e);
1909
+ async readTextFromClipboard() {
1910
+ const e = this.createRequestId(), {
1911
+ data: t = null
1912
+ } = await y("web_app_read_text_from_clipboard", "clipboard_text_received", {
1913
+ postEvent: this.postEvent,
1914
+ params: { req_id: e },
1915
+ capture: le(e)
1916
+ });
1917
+ return t;
1863
1918
  }
1864
1919
  }
1865
- function St(r) {
1920
+ function kt(r) {
1866
1921
  return ["macos", "tdesktop", "unigram", "web", "weba"].includes(r);
1867
1922
  }
1868
- async function ve(r) {
1869
- const e = await m("web_app_request_viewport", "viewport_changed", r);
1923
+ async function Pe(r) {
1924
+ const e = await y("web_app_request_viewport", "viewport_changed", r);
1870
1925
  return {
1871
1926
  height: e.height,
1872
1927
  width: e.width,
@@ -1874,7 +1929,7 @@ async function ve(r) {
1874
1929
  isStateStable: e.is_state_stable
1875
1930
  };
1876
1931
  }
1877
- function W(r) {
1932
+ function L(r) {
1878
1933
  return r < 0 ? 0 : r;
1879
1934
  }
1880
1935
  class xt {
@@ -1897,11 +1952,11 @@ class xt {
1897
1952
  stableHeight: i,
1898
1953
  postEvent: a = d
1899
1954
  } = e;
1900
- this.postEvent = a, this.state = new b({
1901
- height: W(t),
1955
+ this.postEvent = a, this.state = new m({
1956
+ height: L(t),
1902
1957
  isExpanded: s,
1903
- stableHeight: W(i),
1904
- width: W(n)
1958
+ stableHeight: L(i),
1959
+ width: L(n)
1905
1960
  }, this.ee);
1906
1961
  }
1907
1962
  /**
@@ -1910,7 +1965,7 @@ class xt {
1910
1965
  * @param options - options to request fresh data.
1911
1966
  */
1912
1967
  sync(e) {
1913
- return ve(e).then(({ height: t, isExpanded: s, width: n, isStateStable: i }) => {
1968
+ return Pe(e).then(({ height: t, isExpanded: s, width: n, isStateStable: i }) => {
1914
1969
  this.state.set({
1915
1970
  height: t,
1916
1971
  width: n,
@@ -1960,16 +2015,16 @@ class xt {
1960
2015
  * @returns Function to stop listening.
1961
2016
  */
1962
2017
  listen() {
1963
- return y("viewport_changed", (e) => {
2018
+ return E("viewport_changed", (e) => {
1964
2019
  const {
1965
2020
  height: t,
1966
2021
  width: s,
1967
2022
  is_expanded: n,
1968
2023
  is_state_stable: i
1969
2024
  } = e, a = {
1970
- height: W(t),
2025
+ height: L(t),
1971
2026
  isExpanded: n,
1972
- width: W(s)
2027
+ width: L(s)
1973
2028
  };
1974
2029
  i && (a.stableHeight = a.height), this.state.set(a);
1975
2030
  });
@@ -2017,7 +2072,7 @@ function qt(r, e) {
2017
2072
  backgroundColor: n,
2018
2073
  secondaryBackgroundColor: i
2019
2074
  } = e;
2020
- if (te(r.headerColor)) {
2075
+ if (ee(r.headerColor)) {
2021
2076
  S("--tg-header-color", r.headerColor);
2022
2077
  return;
2023
2078
  }
@@ -2041,82 +2096,35 @@ function At(r) {
2041
2096
  };
2042
2097
  r.on("change", e), e();
2043
2098
  }
2044
- function ae(r) {
2099
+ function oe(r) {
2045
2100
  const e = () => S("--tg-viewport-height", `${r.height}px`), t = () => S("--tg-viewport-width", `${r.width}px`), s = () => S("--tg-viewport-stable-height", `${r.stableHeight}px`);
2046
2101
  r.on("change:height", e), r.on("change:width", t), r.on("change:stableHeight", s), e(), t(), s();
2047
2102
  }
2048
2103
  function Vt() {
2049
2104
  const r = document.createElement("style");
2050
- r.id = "telegram-custom-styles", document.head.appendChild(r), y("set_custom_style", (e) => {
2105
+ r.id = "telegram-custom-styles", document.head.appendChild(r), E("set_custom_style", (e) => {
2051
2106
  r.innerHTML = e;
2052
2107
  });
2053
2108
  }
2054
- class Rt {
2055
- constructor(e, t, s = d) {
2056
- o(this, "ee", new w());
2057
- o(this, "state");
2058
- /**
2059
- * Adds event listener.
2060
- * @param event - event name.
2061
- * @param listener - event listener.
2062
- */
2063
- o(this, "on", (e, t) => e === "click" ? y("back_button_pressed", t) : this.ee.on(e, t));
2064
- /**
2065
- * Removes event listener.
2066
- * @param event - event name.
2067
- * @param listener - event listener.
2068
- */
2069
- o(this, "off", (e, t) => e === "click" ? $("back_button_pressed", t) : this.ee.off(e, t));
2070
- /**
2071
- * Checks if specified method is supported by current component.
2072
- */
2073
- o(this, "supports");
2074
- this.postEvent = s, this.state = new b({ isVisible: e }, this.ee), this.supports = E(t, {
2075
- show: "web_app_setup_back_button",
2076
- hide: "web_app_setup_back_button"
2077
- });
2078
- }
2079
- set isVisible(e) {
2080
- this.state.set("isVisible", e), this.postEvent("web_app_setup_back_button", { is_visible: e });
2081
- }
2082
- /**
2083
- * True if BackButton is currently visible.
2084
- */
2085
- get isVisible() {
2086
- return this.state.get("isVisible");
2087
- }
2088
- /**
2089
- * Hides the BackButton.
2090
- */
2091
- hide() {
2092
- this.isVisible = !1;
2093
- }
2094
- /**
2095
- * Shows the BackButton.
2096
- */
2097
- show() {
2098
- this.isVisible = !0;
2099
- }
2100
- }
2101
- function Pe(r) {
2109
+ function Se(r) {
2102
2110
  return `telegram-mini-apps-${r}`;
2103
2111
  }
2104
- function B(r, e) {
2105
- sessionStorage.setItem(Pe(r), JSON.stringify(e));
2112
+ function T(r, e) {
2113
+ sessionStorage.setItem(Se(r), JSON.stringify(e));
2106
2114
  }
2107
- function D(r) {
2108
- const e = sessionStorage.getItem(Pe(r));
2115
+ function $(r) {
2116
+ const e = sessionStorage.getItem(Se(r));
2109
2117
  return e ? JSON.parse(e) : null;
2110
2118
  }
2111
- function It(r, e, t) {
2112
- const { isVisible: s = !1 } = r ? D("back-button") || {} : {}, n = new Rt(s, e, t);
2119
+ function Rt(r, e, t) {
2120
+ const { isVisible: s = !1 } = r ? $("back-button") || {} : {}, n = new rt(s, e, t);
2113
2121
  return n.on("change", () => {
2114
- B("back-button", { isVisible: n.isVisible });
2122
+ T("back-button", { isVisible: n.isVisible });
2115
2123
  }), n;
2116
2124
  }
2117
- function Lt(r, e) {
2118
- const { isConfirmationNeeded: t = !1 } = r ? D("closing-behavior") || {} : {}, s = new st(t, e);
2119
- return s.on("change", () => B("closing-behavior", {
2125
+ function It(r, e) {
2126
+ const { isConfirmationNeeded: t = !1 } = r ? $("closing-behavior") || {} : {}, s = new st(t, e);
2127
+ return s.on("change", () => T("closing-behavior", {
2120
2128
  isConfirmationNeeded: s.isConfirmationNeeded
2121
2129
  })), s;
2122
2130
  }
@@ -2128,7 +2136,7 @@ function Tt(r, e, t, s) {
2128
2136
  isLoaderVisible: c = !1,
2129
2137
  textColor: u = t,
2130
2138
  text: p = ""
2131
- } = r ? D("main-button") || {} : {}, g = new dt({
2139
+ } = r ? $("main-button") || {} : {}, g = new dt({
2132
2140
  backgroundColor: n,
2133
2141
  isEnabled: i,
2134
2142
  isLoaderVisible: c,
@@ -2136,7 +2144,7 @@ function Tt(r, e, t, s) {
2136
2144
  postEvent: s,
2137
2145
  text: p,
2138
2146
  textColor: u
2139
- }), _ = () => B("main-button", {
2147
+ }), _ = () => T("main-button", {
2140
2148
  backgroundColor: g.backgroundColor,
2141
2149
  isEnabled: g.isEnabled,
2142
2150
  isLoaderVisible: g.isLoaderVisible,
@@ -2150,48 +2158,48 @@ function $t(r, e, t, s, n, i) {
2150
2158
  const {
2151
2159
  backgroundColor: a = e,
2152
2160
  headerColor: c = "bg_color"
2153
- } = r ? D("mini-app") || {} : {}, u = new wt({
2161
+ } = r ? $("mini-app") || {} : {}, u = new wt({
2154
2162
  headerColor: c,
2155
2163
  backgroundColor: a,
2156
2164
  version: t,
2157
2165
  botInline: s,
2158
2166
  createRequestId: n,
2159
2167
  postEvent: i
2160
- }), p = () => B("mini-app", {
2168
+ }), p = () => T("mini-app", {
2161
2169
  backgroundColor: u.backgroundColor,
2162
2170
  headerColor: u.headerColor
2163
2171
  });
2164
2172
  return u.on("change", p), u;
2165
2173
  }
2166
- function Bt() {
2174
+ function Lt() {
2167
2175
  let r = 0;
2168
2176
  return () => (r += 1, r.toString());
2169
2177
  }
2170
- function Dt(r, e, t) {
2171
- const { isVisible: s = !1 } = r ? D("settings-button") || {} : {}, n = new yt(s, e, t);
2178
+ function Bt(r, e, t) {
2179
+ const { isVisible: s = !1 } = r ? $("settings-button") || {} : {}, n = new yt(s, e, t);
2172
2180
  return n.on("change", () => {
2173
- B("settings-button", { isVisible: n.isVisible });
2181
+ T("settings-button", { isVisible: n.isVisible });
2174
2182
  }), n;
2175
2183
  }
2176
- function Wt(r) {
2184
+ function Ot(r) {
2177
2185
  const e = new Pt(r);
2178
2186
  return e.listen(), e;
2179
2187
  }
2180
- function G(r) {
2188
+ function M(r) {
2181
2189
  const e = new xt(r);
2182
- return e.on("change", () => B("viewport", {
2190
+ return e.on("change", () => T("viewport", {
2183
2191
  height: e.height,
2184
2192
  isExpanded: e.isExpanded,
2185
2193
  stableHeight: e.stableHeight,
2186
2194
  width: e.width
2187
2195
  })), e.listen(), e;
2188
2196
  }
2189
- function Ot(r, e, t, s) {
2190
- const n = r ? D("viewport") : null;
2197
+ function Dt(r, e, t, s) {
2198
+ const n = r ? $("viewport") : null;
2191
2199
  if (n)
2192
- return G({ ...n, postEvent: t });
2193
- if (St(e))
2194
- return G({
2200
+ return M({ ...n, postEvent: t });
2201
+ if (kt(e))
2202
+ return M({
2195
2203
  height: window.innerHeight,
2196
2204
  isExpanded: !0,
2197
2205
  postEvent: t,
@@ -2199,15 +2207,15 @@ function Ot(r, e, t, s) {
2199
2207
  width: window.innerWidth
2200
2208
  });
2201
2209
  if (s)
2202
- return ve({
2210
+ return Pe({
2203
2211
  postEvent: t,
2204
2212
  timeout: 5e3
2205
- }).then(({ height: a, isStateStable: c, ...u }) => G({
2213
+ }).then(({ height: a, isStateStable: c, ...u }) => M({
2206
2214
  ...u,
2207
2215
  height: a,
2208
2216
  stableHeight: c ? a : 0
2209
2217
  }));
2210
- const i = G({
2218
+ const i = M({
2211
2219
  width: 0,
2212
2220
  height: 0,
2213
2221
  isExpanded: !1,
@@ -2218,25 +2226,25 @@ function Ot(r, e, t, s) {
2218
2226
  console.error("Unable to actualize viewport state", a);
2219
2227
  }), i;
2220
2228
  }
2221
- function Ht(r) {
2229
+ function Wt(r) {
2222
2230
  return typeof r == "object" ? r : r ? {
2223
2231
  themeParams: !0,
2224
2232
  viewport: !0,
2225
2233
  miniApp: !0
2226
2234
  } : {};
2227
2235
  }
2228
- function ce(r, e, t, s) {
2229
- const n = Ht(r);
2230
- n.miniApp && qt(e, t), n.themeParams && At(t), n.viewport && (s instanceof Promise ? s.then(ae) : ae(s));
2236
+ function ae(r, e, t, s) {
2237
+ const n = Wt(r);
2238
+ n.miniApp && qt(e, t), n.themeParams && At(t), n.viewport && (s instanceof Promise ? s.then(oe) : oe(s));
2231
2239
  }
2232
- function Nt() {
2233
- return re({
2240
+ function Ht() {
2241
+ return te({
2234
2242
  botInline: {
2235
- type: k().optional(),
2243
+ type: P().optional(),
2236
2244
  from: "tgWebAppBotInline"
2237
2245
  },
2238
2246
  initData: {
2239
- type: me().optional(),
2247
+ type: ye().optional(),
2240
2248
  from: "tgWebAppData"
2241
2249
  },
2242
2250
  initDataRaw: {
@@ -2248,7 +2256,7 @@ function Nt() {
2248
2256
  from: "tgWebAppPlatform"
2249
2257
  },
2250
2258
  showSettings: {
2251
- type: k().optional(),
2259
+ type: P().optional(),
2252
2260
  from: "tgWebAppShowSettings"
2253
2261
  },
2254
2262
  startParam: {
@@ -2256,7 +2264,7 @@ function Nt() {
2256
2264
  from: "tgWebAppStartParam"
2257
2265
  },
2258
2266
  themeParams: {
2259
- type: Ee(),
2267
+ type: Ce(),
2260
2268
  from: "tgWebAppThemeParams"
2261
2269
  },
2262
2270
  version: {
@@ -2266,25 +2274,25 @@ function Nt() {
2266
2274
  }, "LaunchParams");
2267
2275
  }
2268
2276
  function ke(r) {
2269
- return Nt().parse(r);
2277
+ return Ht().parse(r);
2270
2278
  }
2271
- function Se(r) {
2279
+ function xe(r) {
2272
2280
  const e = r.includes("?") ? r.replace("#", "&").slice(r.indexOf("?") + 1) : r.slice(r.indexOf("#") + 1);
2273
2281
  return ke(e);
2274
2282
  }
2275
- function Ut() {
2276
- return Se(window.location.href);
2283
+ function Nt() {
2284
+ return xe(window.location.href);
2277
2285
  }
2278
- function xe() {
2286
+ function qe() {
2279
2287
  return performance.getEntriesByType("navigation")[0];
2280
2288
  }
2281
- function Mt() {
2282
- const r = xe();
2289
+ function Ut() {
2290
+ const r = qe();
2283
2291
  if (!r)
2284
2292
  throw new Error("Unable to get first navigation entry.");
2285
- return Se(r.name);
2293
+ return xe(r.name);
2286
2294
  }
2287
- function Gt(r) {
2295
+ function Mt(r) {
2288
2296
  const {
2289
2297
  initDataRaw: e,
2290
2298
  themeParams: t,
@@ -2296,37 +2304,37 @@ function Gt(r) {
2296
2304
  } = r, u = new URLSearchParams();
2297
2305
  return e && u.set("tgWebAppData", e), u.set("tgWebAppPlatform", s), u.set("tgWebAppThemeParams", vt(t)), u.set("tgWebAppVersion", n), a && u.set("tgWebAppStartParam", n), typeof i == "boolean" && u.set("tgWebAppShowSettings", i ? "1" : "0"), typeof c == "boolean" && u.set("tgWebAppBotInline", c ? "1" : "0"), u.toString();
2298
2306
  }
2299
- const qe = "telegram-mini-apps-launch-params";
2300
- function jt() {
2301
- return ke(sessionStorage.getItem(qe) || "");
2307
+ const Ae = "telegram-mini-apps-launch-params";
2308
+ function Gt() {
2309
+ return ke(sessionStorage.getItem(Ae) || "");
2302
2310
  }
2303
- function Ft(r) {
2304
- sessionStorage.setItem(qe, Gt(r));
2311
+ function jt(r) {
2312
+ sessionStorage.setItem(Ae, Mt(r));
2305
2313
  }
2306
- function se() {
2314
+ function re() {
2307
2315
  const r = [];
2308
2316
  for (const e of [
2309
2317
  // Try to retrieve launch parameters from the current location. This method can return
2310
2318
  // nothing in case, location was changed and then page was reloaded.
2311
- Ut,
2319
+ Nt,
2312
2320
  // Then, try using the lower level API - window.performance.
2313
- Mt,
2321
+ Ut,
2314
2322
  // Finally, try to extract launch parameters from the session storage.
2315
- jt
2323
+ Gt
2316
2324
  ])
2317
2325
  try {
2318
2326
  const t = e();
2319
- return Ft(t), t;
2327
+ return jt(t), t;
2320
2328
  } catch (t) {
2321
2329
  r.push(t);
2322
2330
  }
2323
- throw q.error("Unable to extract launch parameters. Received errors:", r), new Error("Unable to retrieve launch parameters from any known source.");
2331
+ throw k.error("Unable to extract launch parameters. Received errors:", r), new Error("Unable to retrieve launch parameters from any known source.");
2324
2332
  }
2325
- function Ae() {
2333
+ function Ve() {
2326
2334
  var r;
2327
- return ((r = xe()) == null ? void 0 : r.type) === "reload";
2335
+ return ((r = qe()) == null ? void 0 : r.type) === "reload";
2328
2336
  }
2329
- function sr(r = {}) {
2337
+ function rr(r = {}) {
2330
2338
  const {
2331
2339
  async: e = !1,
2332
2340
  complete: t = e,
@@ -2341,15 +2349,15 @@ function sr(r = {}) {
2341
2349
  platform: u,
2342
2350
  themeParams: p,
2343
2351
  botInline: g = !1
2344
- } = se(), _ = Ae(), V = Bt(), l = De(c);
2345
- le() && (n && Vt(), l("iframe_ready", { reload_supported: !0 }), y("reload_iframe", () => {
2352
+ } = re(), _ = Ve(), b = Lt(), l = De(c);
2353
+ pe() && (n && Vt(), l("iframe_ready", { reload_supported: !0 }), E("reload_iframe", () => {
2346
2354
  l("iframe_will_reload"), window.location.reload();
2347
2355
  }));
2348
- const C = {
2349
- backButton: It(_, c, l),
2350
- closingBehavior: Lt(_, l),
2351
- cloudStorage: new at(c, V, l),
2352
- createRequestId: V,
2356
+ const q = {
2357
+ backButton: Rt(_, c, l),
2358
+ closingBehavior: It(_, l),
2359
+ cloudStorage: new at(c, b, l),
2360
+ createRequestId: b,
2353
2361
  hapticFeedback: new ct(c, l),
2354
2362
  invoice: new lt(c, l),
2355
2363
  mainButton: Tt(
@@ -2363,55 +2371,55 @@ function sr(r = {}) {
2363
2371
  p.backgroundColor || "#ffffff",
2364
2372
  c,
2365
2373
  g,
2366
- V,
2374
+ b,
2367
2375
  l
2368
2376
  ),
2369
2377
  popup: new bt(c, l),
2370
2378
  postEvent: l,
2371
2379
  qrScanner: new mt(c, l),
2372
- settingsButton: Dt(_, c, l),
2373
- themeParams: Wt(p),
2374
- utils: new kt(c, V, l),
2380
+ settingsButton: Bt(_, c, l),
2381
+ themeParams: Ot(p),
2382
+ utils: new St(c, b, l),
2375
2383
  ...i ? {
2376
2384
  initData: new ut(i),
2377
2385
  initDataRaw: a
2378
2386
  } : {}
2379
- }, x = Ot(_, u, l, t);
2380
- return x instanceof Promise || t ? Promise.resolve(x).then((v) => (ce(
2387
+ }, N = Dt(_, u, l, t);
2388
+ return N instanceof Promise || t ? Promise.resolve(N).then((se) => (ae(
2381
2389
  s,
2382
- C.miniApp,
2383
- C.themeParams,
2384
- v
2385
- ), { ...C, viewport: v })) : (ce(
2390
+ q.miniApp,
2391
+ q.themeParams,
2392
+ se
2393
+ ), { ...q, viewport: se })) : (ae(
2386
2394
  s,
2387
- C.miniApp,
2388
- C.themeParams,
2389
- x
2390
- ), { ...C, viewport: x });
2395
+ q.miniApp,
2396
+ q.themeParams,
2397
+ N
2398
+ ), { ...q, viewport: N });
2391
2399
  } catch (i) {
2392
2400
  if (t)
2393
2401
  return Promise.reject(i);
2394
2402
  throw i;
2395
2403
  }
2396
2404
  }
2397
- function nr() {
2405
+ function sr() {
2398
2406
  return {
2399
- launchParams: se(),
2400
- isPageReload: Ae()
2407
+ launchParams: re(),
2408
+ isPageReload: Ve()
2401
2409
  };
2402
2410
  }
2403
- function ir() {
2411
+ function nr() {
2404
2412
  try {
2405
- return se(), !0;
2413
+ return re(), !0;
2406
2414
  } catch {
2407
2415
  return !1;
2408
2416
  }
2409
2417
  }
2410
- function or(r) {
2418
+ function ir(r) {
2411
2419
  const e = r.match(/#(.+)/);
2412
2420
  return e ? e[1] : null;
2413
2421
  }
2414
- async function N(r) {
2422
+ async function D(r) {
2415
2423
  return r === 0 ? !0 : Promise.race([
2416
2424
  new Promise((e) => {
2417
2425
  window.addEventListener("popstate", function t() {
@@ -2424,17 +2432,17 @@ async function N(r) {
2424
2432
  })
2425
2433
  ]);
2426
2434
  }
2427
- async function zt() {
2428
- if (window.history.length <= 1 || (window.history.pushState(null, ""), await N(1 - window.history.length)))
2435
+ async function Ft() {
2436
+ if (window.history.length <= 1 || (window.history.pushState(null, ""), await D(1 - window.history.length)))
2429
2437
  return;
2430
- let e = await N(-1);
2438
+ let e = await D(-1);
2431
2439
  for (; e; )
2432
- e = await N(-1);
2440
+ e = await D(-1);
2433
2441
  }
2434
- function O(r, e) {
2442
+ function B(r, e) {
2435
2443
  return r.startsWith(e) ? r : `${e}${r}`;
2436
2444
  }
2437
- class Jt {
2445
+ class zt {
2438
2446
  constructor(e, t, {
2439
2447
  debug: s = !1,
2440
2448
  loggerPrefix: n = "Navigator"
@@ -2449,11 +2457,11 @@ class Jt {
2449
2457
  if (!i.startsWith("/") && i.length > 0)
2450
2458
  throw new Error('Pathname should start with "/"');
2451
2459
  return {
2452
- pathname: O(i, "/"),
2453
- search: a ? O(a, "?") : "",
2454
- hash: c ? O(c, "#") : ""
2460
+ pathname: B(i, "/"),
2461
+ search: a ? B(a, "?") : "",
2462
+ hash: c ? B(c, "#") : ""
2455
2463
  };
2456
- }), this.logger = new ue(`[${n}]`, s);
2464
+ }), this.logger = new he(`[${n}]`, s);
2457
2465
  }
2458
2466
  /**
2459
2467
  * Converts entry to the navigation entry.
@@ -2469,7 +2477,7 @@ class Jt {
2469
2477
  search: c,
2470
2478
  hash: u
2471
2479
  } = e;
2472
- t = a + (c ? O(c, "?") : "") + (u ? O(u, "#") : "");
2480
+ t = a + (c ? B(c, "?") : "") + (u ? B(u, "#") : "");
2473
2481
  }
2474
2482
  const {
2475
2483
  pathname: s,
@@ -2633,8 +2641,8 @@ class Jt {
2633
2641
  return this.entry.search;
2634
2642
  }
2635
2643
  }
2636
- const he = 0, Z = 1, K = 2;
2637
- class Ve extends Jt {
2644
+ const ce = 0, Q = 1, Z = 2;
2645
+ class Re extends zt {
2638
2646
  constructor(t, s, n = {}) {
2639
2647
  super(t, s, {
2640
2648
  ...n,
@@ -2649,13 +2657,13 @@ class Ve extends Jt {
2649
2657
  o(this, "onPopState", async ({ state: t }) => {
2650
2658
  if (this.logger.log('"popstate" event received. State:', t), t === null)
2651
2659
  return this.push(window.location.hash.slice(1));
2652
- if (t === he) {
2660
+ if (t === ce) {
2653
2661
  this.logger.log("Void reached. Moving history forward"), window.history.forward();
2654
2662
  return;
2655
2663
  }
2656
- if (t === Z)
2664
+ if (t === Q)
2657
2665
  return this.back();
2658
- if (t === K)
2666
+ if (t === Z)
2659
2667
  return this.forward();
2660
2668
  });
2661
2669
  o(this, "back", () => super.back());
@@ -2681,7 +2689,7 @@ class Ve extends Jt {
2681
2689
  window.location.hash.slice(1),
2682
2690
  window.location.href
2683
2691
  );
2684
- return new Ve([{ search: s, pathname: n, hash: i }], 0, t);
2692
+ return new Re([{ search: s, pathname: n, hash: i }], 0, t);
2685
2693
  }
2686
2694
  async performGo(t) {
2687
2695
  t.updated && (this.attached && await this.syncHistory(), this.emitChanged(t.before, t.after));
@@ -2698,7 +2706,7 @@ class Ve extends Jt {
2698
2706
  async syncHistory() {
2699
2707
  window.removeEventListener("popstate", this.onPopState);
2700
2708
  const t = `#${this.path}`;
2701
- await zt(), 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, "", t), window.history.pushState(K, ""), await N(-1)) : this.canGoBack ? (this.logger.log("Setting up history: [<-, *]"), window.history.replaceState(Z, ""), window.history.pushState(null, "", t)) : this.canGoForward ? (this.logger.log("Setting up history: [*, ->]"), window.history.replaceState(null, t), window.history.pushState(K, ""), await N(-1)) : (this.logger.log("Setting up history: [~, *]"), window.history.replaceState(he, ""), window.history.pushState(null, "", t)), window.addEventListener("popstate", this.onPopState);
2709
+ await Ft(), d("web_app_setup_back_button", { is_visible: this.canGoBack }), this.canGoBack && this.canGoForward ? (this.logger.log("Setting up history: [<-, *, ->]"), window.history.replaceState(Q, ""), window.history.pushState(null, "", t), window.history.pushState(Z, ""), await D(-1)) : this.canGoBack ? (this.logger.log("Setting up history: [<-, *]"), window.history.replaceState(Q, ""), window.history.pushState(null, "", t)) : this.canGoForward ? (this.logger.log("Setting up history: [*, ->]"), window.history.replaceState(null, t), window.history.pushState(Z, ""), await D(-1)) : (this.logger.log("Setting up history: [~, *]"), window.history.replaceState(ce, ""), window.history.pushState(null, "", t)), window.addEventListener("popstate", this.onPopState);
2702
2710
  }
2703
2711
  emitChanged(t, s) {
2704
2712
  this.ee.emit("change", {
@@ -2712,92 +2720,93 @@ class Ve extends Jt {
2712
2720
  */
2713
2721
  async attach() {
2714
2722
  if (!this.attached)
2715
- return this.logger.log("Attaching", this), this.attached = !0, y("back_button_pressed", this.back), this.syncHistory();
2723
+ return this.logger.log("Attaching", this), this.attached = !0, E("back_button_pressed", this.back), this.syncHistory();
2716
2724
  }
2717
2725
  /**
2718
2726
  * Detaches current navigator from the browser history.
2719
2727
  */
2720
2728
  detach() {
2721
- this.attached && (this.logger.log("Detaching", this), this.attached = !1, window.removeEventListener("popstate", this.onPopState), $("back_button_pressed", this.back));
2729
+ this.attached && (this.logger.log("Detaching", this), this.attached = !1, window.removeEventListener("popstate", this.onPopState), I("back_button_pressed", this.back));
2722
2730
  }
2723
2731
  }
2724
- function ar(r) {
2725
- return r instanceof J;
2732
+ function or(r) {
2733
+ return r instanceof z;
2726
2734
  }
2727
2735
  export {
2736
+ rt as BackButton,
2728
2737
  st as ClosingBehavior,
2729
2738
  at as CloudStorage,
2730
2739
  ct as HapticFeedback,
2731
- Ve as HashNavigator,
2740
+ Re as HashNavigator,
2732
2741
  ut as InitData,
2733
2742
  lt as Invoice,
2734
2743
  dt as MainButton,
2735
- Y as MethodUnsupportedError,
2744
+ K as MethodUnsupportedError,
2736
2745
  wt as MiniApp,
2737
- Jt as Navigator,
2738
- X as ParameterUnsupportedError,
2739
- F as ParseError,
2740
- j as ParseSchemaFieldError,
2746
+ zt as Navigator,
2747
+ Y as ParameterUnsupportedError,
2748
+ j as ParseError,
2749
+ G as ParseSchemaFieldError,
2741
2750
  bt as Popup,
2742
2751
  mt as QRScanner,
2743
2752
  yt as SettingsButton,
2744
2753
  Pt as ThemeParams,
2745
- J as TimeoutError,
2746
- kt as Utils,
2754
+ z as TimeoutError,
2755
+ St as Utils,
2747
2756
  xt as Viewport,
2748
2757
  ot as array,
2749
2758
  qt as bindMiniAppCSSVars,
2750
2759
  At as bindThemeCSSVars,
2751
- ae as bindViewportCSSVars,
2752
- k as boolean,
2760
+ oe as bindViewportCSSVars,
2761
+ P as boolean,
2753
2762
  ht as chatParser,
2754
- rt as classNames,
2755
- Be as compareVersions,
2763
+ _e as classNames,
2764
+ Oe as compareVersions,
2756
2765
  De as createPostEvent,
2757
- be as date,
2758
- or as getHash,
2759
- sr as init,
2760
- me as initDataParser,
2761
- H as invokeCustomMethod,
2762
- _e as isColorDark,
2763
- le as isIframe,
2764
- Ae as isPageReload,
2765
- te as isRGB,
2766
+ me as date,
2767
+ ir as getHash,
2768
+ rr as init,
2769
+ ye as initDataParser,
2770
+ O as invokeCustomMethod,
2771
+ be as isColorDark,
2772
+ pe as isIframe,
2773
+ Ve as isPageReload,
2774
+ ee as isRGB,
2766
2775
  Qe as isRGBShort,
2767
- R as isRecord,
2768
- St as isStableViewportPlatform,
2769
- ir as isTMA,
2770
- ar as isTimeoutError,
2776
+ W as isRecord,
2777
+ kt as isStableViewportPlatform,
2778
+ nr as isTMA,
2779
+ or as isTimeoutError,
2771
2780
  f as json,
2772
- Nt as launchParamsParser,
2773
- er as mergeClassNames,
2774
- A as number,
2775
- $ as off,
2776
- y as on,
2777
- Yt as once,
2778
- tr as parseInitData,
2781
+ Ht as launchParamsParser,
2782
+ Xt as mergeClassNames,
2783
+ x as number,
2784
+ I as off,
2785
+ E as on,
2786
+ Kt as once,
2787
+ er as parseInitData,
2779
2788
  ke as parseLaunchParams,
2780
- Oe as parseMessage,
2781
- Ce as parseThemeParams,
2789
+ We as parseMessage,
2790
+ ve as parseThemeParams,
2782
2791
  d as postEvent,
2783
- m as request,
2784
- rr as requestThemeParams,
2785
- ve as requestViewport,
2786
- nr as retrieveLaunchData,
2787
- se as retrieveLaunchParams,
2792
+ y as request,
2793
+ tr as requestThemeParams,
2794
+ Pe as requestViewport,
2795
+ sr as retrieveLaunchData,
2796
+ re as retrieveLaunchParams,
2788
2797
  ge as rgb,
2789
- re as searchParams,
2790
- Gt as serializeLaunchParams,
2798
+ te as searchParams,
2799
+ Mt as serializeLaunchParams,
2791
2800
  vt as serializeThemeParams,
2792
2801
  S as setCSSVar,
2793
- Zt as setDebug,
2794
- Kt as setTargetOrigin,
2802
+ Qt as setDebug,
2803
+ Zt as setTargetOrigin,
2795
2804
  h as string,
2796
- Xt as subscribe,
2797
- I as supports,
2798
- Ee as themeParamsParser,
2805
+ Yt as subscribe,
2806
+ A as supports,
2807
+ Ce as themeParamsParser,
2799
2808
  fe as toRGB,
2800
2809
  tt as unsubscribe,
2801
- oe as userParser,
2810
+ ie as userParser,
2802
2811
  we as withTimeout
2803
2812
  };