@tma.js/sdk-solid 2.1.3 → 2.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,20 +1,20 @@
1
- import { createComponent as gt, mergeProps as at, createContext as Qt, useContext as Ft, createEffect as ct, onCleanup as ht, createResource as Yt, createMemo as pt, from as Zt } from "solid-js";
2
- var Xt = Object.defineProperty, te = (e, t, s) => t in e ? Xt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, c = (e, t, s) => (te(e, typeof t != "symbol" ? t + "" : t, s), s);
3
- function ft(e, t) {
1
+ import { createComponent as mt, mergeProps as pt, createContext as ee, useContext as se, createEffect as ut, onCleanup as dt, createResource as ne, createMemo as lt, from as re } from "solid-js";
2
+ var ie = Object.defineProperty, oe = (e, t, s) => t in e ? ie(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, c = (e, t, s) => (oe(e, typeof t != "symbol" ? t + "" : t, s), s);
3
+ function bt(e, t) {
4
4
  let s;
5
5
  const n = () => {
6
6
  s !== void 0 && t && t(s), s = void 0;
7
7
  };
8
8
  return [() => s === void 0 ? s = e(n) : s, n];
9
9
  }
10
- function mt(e) {
11
- const t = U(), { count: s } = t;
12
- t.unsubscribe(e), s && !t.count && Pe();
10
+ function vt(e) {
11
+ const t = H(), { count: s } = t;
12
+ t.unsubscribe(e), s && !t.count && Se();
13
13
  }
14
- function ee(e) {
15
- return U().subscribe(e), () => mt(e);
14
+ function ae(e) {
15
+ return H().subscribe(e), () => vt(e);
16
16
  }
17
- class se {
17
+ class ce {
18
18
  constructor(t, s = {}) {
19
19
  this.scope = t, this.options = s;
20
20
  }
@@ -54,21 +54,21 @@ class se {
54
54
  this.print("log", ...t);
55
55
  }
56
56
  }
57
- const Z = new se("SDK", {
57
+ const X = new ce("SDK", {
58
58
  bgColor: "forestgreen",
59
59
  textColor: "white"
60
60
  });
61
- let Q = !1;
62
- const ut = ({ event: e, args: [t] }) => {
63
- Z.log("Event received:", t === void 0 ? { name: e } : { name: e, data: t });
61
+ let F = !1;
62
+ const _t = ({ name: e, payload: t }) => {
63
+ X.log("Event received:", t ? { name: e, payload: t } : { name: e });
64
64
  };
65
- function ne(e) {
66
- Q !== e && (Q = e, e ? ee(ut) : mt(ut));
65
+ function he(e) {
66
+ F !== e && (F = e, e ? ae(_t) : vt(_t));
67
67
  }
68
- function re(...e) {
69
- Q && Z.log(...e);
68
+ function pe(...e) {
69
+ F && X.log(...e);
70
70
  }
71
- class B {
71
+ class O {
72
72
  constructor() {
73
73
  c(this, "listeners", /* @__PURE__ */ new Map()), c(this, "listenersCount", 0), c(this, "subscribeListeners", []);
74
74
  }
@@ -138,20 +138,31 @@ class B {
138
138
  }
139
139
  }
140
140
  }
141
- function F(e, t, s) {
141
+ function Q(e, t, s) {
142
142
  return window.addEventListener(e, t, s), () => window.removeEventListener(e, t, s);
143
143
  }
144
+ function yt(...e) {
145
+ let t = !1;
146
+ const s = [...e];
147
+ return [
148
+ (n) => !t && s.push(n),
149
+ () => {
150
+ t || (t = !0, s.forEach((n) => n()));
151
+ },
152
+ t
153
+ ];
154
+ }
144
155
  class $ extends Error {
145
156
  constructor(t, s, n) {
146
157
  super(s, { cause: n }), this.type = t, Object.setPrototypeOf(this, $.prototype);
147
158
  }
148
159
  }
149
- function w(e, t, s) {
160
+ function m(e, t, s) {
150
161
  return new $(e, t, s);
151
162
  }
152
- const ie = "ERR_METHOD_UNSUPPORTED", oe = "ERR_METHOD_PARAMETER_UNSUPPORTED", ae = "ERR_UNKNOWN_ENV", ce = "ERR_INVOKE_CUSTOM_METHOD_RESPONSE", he = "ERR_TIMED_OUT", pe = "ERR_UNEXPECTED_TYPE", wt = "ERR_PARSE", ue = "ERR_NAVIGATION_LIST_EMPTY", le = "ERR_NAVIGATION_CURSOR_INVALID", Js = "ERR_NAVIGATION_ITEM_INVALID", Qs = "ERR_SSR_INIT", de = "ERR_INVALID_PATH_BASE";
163
+ const ue = "ERR_METHOD_UNSUPPORTED", de = "ERR_METHOD_PARAMETER_UNSUPPORTED", le = "ERR_UNKNOWN_ENV", _e = "ERR_INVOKE_CUSTOM_METHOD_RESPONSE", ge = "ERR_TIMED_OUT", fe = "ERR_UNEXPECTED_TYPE", Et = "ERR_PARSE", we = "ERR_NAVIGATION_LIST_EMPTY", me = "ERR_NAVIGATION_CURSOR_INVALID", zs = "ERR_NAVIGATION_ITEM_INVALID", Js = "ERR_SSR_INIT", be = "ERR_INVALID_PATH_BASE";
153
164
  function S() {
154
- return w(pe, "Value has unexpected type");
165
+ return m(fe, "Value has unexpected type");
155
166
  }
156
167
  class L {
157
168
  constructor(t, s, n) {
@@ -168,8 +179,8 @@ class L {
168
179
  try {
169
180
  return this.parser(t);
170
181
  } catch (s) {
171
- throw w(
172
- wt,
182
+ throw m(
183
+ Et,
173
184
  `Unable to parse value${this.type ? ` as ${this.type}` : ""}`,
174
185
  s
175
186
  );
@@ -179,10 +190,10 @@ class L {
179
190
  return this.isOptional = !0, this;
180
191
  }
181
192
  }
182
- function R(e, t) {
193
+ function T(e, t) {
183
194
  return () => new L(e, !1, t);
184
195
  }
185
- const y = R((e) => {
196
+ const y = T((e) => {
186
197
  if (typeof e == "boolean")
187
198
  return e;
188
199
  const t = String(e);
@@ -192,7 +203,7 @@ const y = R((e) => {
192
203
  return !1;
193
204
  throw S();
194
205
  }, "boolean");
195
- function bt(e, t) {
206
+ function Pt(e, t) {
196
207
  const s = {};
197
208
  for (const n in e) {
198
209
  const r = e[n];
@@ -209,12 +220,12 @@ function bt(e, t) {
209
220
  const a = o(t(i));
210
221
  a !== void 0 && (s[n] = a);
211
222
  } catch (a) {
212
- throw w(wt, `Unable to parse field "${n}"`, a);
223
+ throw m(Et, `Unable to parse field "${n}"`, a);
213
224
  }
214
225
  }
215
226
  return s;
216
227
  }
217
- function X(e) {
228
+ function tt(e) {
218
229
  let t = e;
219
230
  if (typeof t == "string" && (t = JSON.parse(t)), typeof t != "object" || t === null || Array.isArray(t))
220
231
  throw S();
@@ -222,11 +233,11 @@ function X(e) {
222
233
  }
223
234
  function f(e, t) {
224
235
  return new L((s) => {
225
- const n = X(s);
226
- return bt(e, (r) => n[r]);
236
+ const n = tt(s);
237
+ return Pt(e, (r) => n[r]);
227
238
  }, !1, t);
228
239
  }
229
- const P = R((e) => {
240
+ const P = T((e) => {
230
241
  if (typeof e == "number")
231
242
  return e;
232
243
  if (typeof e == "string") {
@@ -236,17 +247,17 @@ const P = R((e) => {
236
247
  }
237
248
  throw S();
238
249
  }, "number");
239
- function tt(e) {
250
+ function et(e) {
240
251
  return /^#[\da-f]{6}$/i.test(e);
241
252
  }
242
- function _e(e) {
253
+ function ve(e) {
243
254
  return /^#[\da-f]{3}$/i.test(e);
244
255
  }
245
- function vt(e) {
256
+ function xt(e) {
246
257
  const t = e.replace(/\s/g, "").toLowerCase();
247
- if (tt(t))
258
+ if (et(t))
248
259
  return t;
249
- if (_e(t)) {
260
+ if (ve(t)) {
250
261
  let n = "#";
251
262
  for (let r = 0; r < 3; r += 1)
252
263
  n += t[1 + r].repeat(2);
@@ -260,30 +271,30 @@ function vt(e) {
260
271
  return n + (i.length === 1 ? "0" : "") + i;
261
272
  }, "#");
262
273
  }
263
- const h = R((e) => {
274
+ const p = T((e) => {
264
275
  if (typeof e == "string" || typeof e == "number")
265
276
  return e.toString();
266
277
  throw S();
267
- }, "string"), yt = R((e) => vt(h().parse(e)), "rgb");
268
- function ge(e) {
278
+ }, "string"), Ct = T((e) => xt(p().parse(e)), "rgb");
279
+ function St(e) {
269
280
  return f({
270
- eventType: h(),
281
+ eventType: p(),
271
282
  eventData: (t) => t
272
283
  }).parse(e);
273
284
  }
274
- function fe() {
285
+ function ye() {
275
286
  ["TelegramGameProxy_receiveEvent", "TelegramGameProxy", "Telegram"].forEach((e) => {
276
287
  delete window[e];
277
288
  });
278
289
  }
279
- function me(e, t) {
290
+ function Y(e, t) {
280
291
  window.dispatchEvent(new MessageEvent("message", {
281
292
  data: JSON.stringify({ eventType: e, eventData: t }),
282
293
  // We specify window.parent to imitate the case, the parent iframe sent us this event.
283
294
  source: window.parent
284
295
  }));
285
296
  }
286
- function we() {
297
+ function Ee() {
287
298
  [
288
299
  ["TelegramGameProxy_receiveEvent"],
289
300
  // Windows Phone.
@@ -295,42 +306,37 @@ function we() {
295
306
  let t = window;
296
307
  e.forEach((s, n, r) => {
297
308
  if (n === r.length - 1) {
298
- t[s] = me;
309
+ t[s] = Y;
299
310
  return;
300
311
  }
301
312
  s in t || (t[s] = {}), t = t[s];
302
313
  });
303
314
  });
304
315
  }
305
- const be = f({
306
- button_id: (e) => e == null ? void 0 : h().parse(e)
307
- }), ve = {
316
+ const Pe = {
308
317
  clipboard_text_received: f({
309
- req_id: h(),
310
- data: (e) => e === null ? e : h().optional().parse(e)
318
+ req_id: p(),
319
+ data: (e) => e === null ? e : p().optional().parse(e)
311
320
  }),
312
321
  custom_method_invoked: f({
313
- req_id: h(),
322
+ req_id: p(),
314
323
  result: (e) => e,
315
- error: h().optional()
316
- }),
317
- invoice_closed: f({
318
- slug: h(),
319
- status: h()
320
- }),
321
- phone_requested: f({
322
- status: h()
324
+ error: p().optional()
323
325
  }),
326
+ invoice_closed: f({ slug: p(), status: p() }),
327
+ phone_requested: f({ status: p() }),
324
328
  popup_closed: {
325
- parse: (e) => be.parse(e ?? {})
329
+ parse(e) {
330
+ return f({
331
+ button_id: (t) => t == null ? void 0 : p().parse(t)
332
+ }).parse(e ?? {});
333
+ }
326
334
  },
327
- qr_text_received: f({
328
- data: h().optional()
329
- }),
335
+ qr_text_received: f({ data: p().optional() }),
330
336
  theme_changed: f({
331
337
  theme_params: (e) => {
332
- const t = yt().optional();
333
- return Object.entries(X(e)).reduce((s, [n, r]) => (s[n] = t.parse(r), s), {});
338
+ const t = Ct().optional();
339
+ return Object.entries(tt(e)).reduce((s, [n, r]) => (s[n] = t.parse(r), s), {});
334
340
  }
335
341
  }),
336
342
  viewport_changed: f({
@@ -339,23 +345,23 @@ const be = f({
339
345
  is_state_stable: y(),
340
346
  is_expanded: y()
341
347
  }),
342
- write_access_requested: f({
343
- status: h()
344
- })
348
+ write_access_requested: f({ status: p() })
345
349
  };
346
- function ye() {
347
- const e = new B();
348
- we();
349
- let t = [
350
+ function xe() {
351
+ const e = new O(), t = new O();
352
+ t.subscribe((n) => {
353
+ e.emit("event", { name: n.event, payload: n.args[0] });
354
+ }), Ee();
355
+ const [, s] = yt(
350
356
  // Don't forget to remove created handlers.
351
- fe,
357
+ ye,
352
358
  // Add "resize" event listener to make sure, we always have fresh viewport information.
353
359
  // Desktop version of Telegram is sometimes not sending the viewport_changed
354
360
  // event. For example, when the MainButton is shown. That's why we should
355
361
  // add our own listener to make sure, viewport information is always fresh.
356
362
  // Issue: https://github.com/Telegram-Mini-Apps/tma.js/issues/10
357
- F("resize", () => {
358
- e.emit("viewport_changed", {
363
+ Q("resize", () => {
364
+ t.emit("viewport_changed", {
359
365
  width: window.innerWidth,
360
366
  height: window.innerHeight,
361
367
  is_state_stable: !0,
@@ -364,37 +370,48 @@ function ye() {
364
370
  }),
365
371
  // Add listener, which handles events sent from the Telegram web application and also events
366
372
  // generated by the local emitEvent function.
367
- F("message", (s) => {
368
- if (s.source !== window.parent)
373
+ Q("message", (n) => {
374
+ if (n.source !== window.parent)
369
375
  return;
370
- let n;
376
+ let r;
371
377
  try {
372
- n = ge(s.data);
378
+ r = St(n.data);
373
379
  } catch {
374
380
  return;
375
381
  }
376
- const { eventType: r, eventData: i } = n, o = ve[r];
382
+ const { eventType: i, eventData: o } = r, a = Pe[i];
377
383
  try {
378
- const a = o ? o.parse(i) : i;
379
- e.emit(...a ? [r, a] : [r]);
380
- } catch (a) {
381
- Z.error(
382
- `An error occurred processing the "${r}" event from the Telegram application. Please, file an issue here: https://github.com/Telegram-Mini-Apps/tma.js/issues/new/choose`,
383
- n,
384
- a
384
+ const h = a ? a.parse(o) : o;
385
+ t.emit(...h ? [i, h] : [i]);
386
+ } catch (h) {
387
+ X.error(
388
+ `An error occurred processing the "${i}" event from the Telegram application. Please, file an issue here: https://github.com/Telegram-Mini-Apps/tma.js/issues/new/choose`,
389
+ r,
390
+ h
385
391
  );
386
392
  }
387
393
  }),
388
- // Clear emitter bound events.
389
- () => e.clear()
390
- ];
391
- return [e, () => {
392
- t.forEach((s) => s()), t = [];
393
- }];
394
+ // Clear emitters.
395
+ () => e.clear(),
396
+ () => t.clear()
397
+ );
398
+ return [{
399
+ on: t.on.bind(t),
400
+ off: t.off.bind(t),
401
+ subscribe(n) {
402
+ return e.on("event", n);
403
+ },
404
+ unsubscribe(n) {
405
+ e.off("event", n);
406
+ },
407
+ get count() {
408
+ return t.count + e.count;
409
+ }
410
+ }, s];
394
411
  }
395
- const [Ee, Pe] = ft(
412
+ const [Ce, Se] = bt(
396
413
  (e) => {
397
- const [t, s] = ye(), n = t.off.bind(t);
414
+ const [t, s] = xe(), n = t.off.bind(t);
398
415
  return t.off = (r, i) => {
399
416
  const { count: o } = t;
400
417
  n(r, i), o && !t.count && e();
@@ -402,19 +419,19 @@ const [Ee, Pe] = ft(
402
419
  },
403
420
  ([, e]) => e()
404
421
  );
405
- function U() {
406
- return Ee()[0];
422
+ function H() {
423
+ return Ce()[0];
407
424
  }
408
- function H(e, t) {
409
- U().off(e, t);
425
+ function U(e, t) {
426
+ H().off(e, t);
410
427
  }
411
428
  function v(e, t, s) {
412
- return U().on(e, t, s);
429
+ return H().on(e, t, s);
413
430
  }
414
- function q(e) {
431
+ function N(e) {
415
432
  return typeof e == "object" && e !== null && !Array.isArray(e);
416
433
  }
417
- function xe(e, t) {
434
+ function Te(e, t) {
418
435
  const s = e.split("."), n = t.split("."), r = Math.max(s.length, n.length);
419
436
  for (let i = 0; i < r; i += 1) {
420
437
  const o = parseInt(s[i] || "0", 10), a = parseInt(n[i] || "0", 10);
@@ -424,9 +441,9 @@ function xe(e, t) {
424
441
  return 0;
425
442
  }
426
443
  function b(e, t) {
427
- return xe(e, t) <= 0;
444
+ return Te(e, t) <= 0;
428
445
  }
429
- function C(e, t, s) {
446
+ function x(e, t, s) {
430
447
  if (typeof s == "string") {
431
448
  if (e === "web_app_open_link" && t === "try_instant_view")
432
449
  return b("6.4", s);
@@ -477,79 +494,79 @@ function C(e, t, s) {
477
494
  ].includes(e);
478
495
  }
479
496
  }
480
- function Ce(e) {
481
- return "external" in e && q(e.external) && "notify" in e.external && typeof e.external.notify == "function";
497
+ function Tt(e) {
498
+ return "external" in e && N(e.external) && "notify" in e.external && typeof e.external.notify == "function";
482
499
  }
483
- function Et(e) {
484
- return "TelegramWebviewProxy" in e && q(e.TelegramWebviewProxy) && "postEvent" in e.TelegramWebviewProxy && typeof e.TelegramWebviewProxy.postEvent == "function";
500
+ function Rt(e) {
501
+ return "TelegramWebviewProxy" in e && N(e.TelegramWebviewProxy) && "postEvent" in e.TelegramWebviewProxy && typeof e.TelegramWebviewProxy.postEvent == "function";
485
502
  }
486
- function Pt() {
503
+ function st() {
487
504
  try {
488
505
  return window.self !== window.top;
489
506
  } catch {
490
507
  return !0;
491
508
  }
492
509
  }
493
- let xt = "https://web.telegram.org";
510
+ let At = "https://web.telegram.org";
494
511
  function Fs(e) {
495
- xt = e;
512
+ At = e;
496
513
  }
497
- function Se() {
498
- return xt;
514
+ function Re() {
515
+ return At;
499
516
  }
500
- function k(e, t, s) {
517
+ function q(e, t, s) {
501
518
  let n = {}, r;
502
519
  t === void 0 && s === void 0 ? n = {} : t !== void 0 && s !== void 0 ? (n = s, r = t) : t !== void 0 && ("targetOrigin" in t ? n = t : r = t);
503
- const { targetOrigin: i = Se() } = n;
504
- if (re("Posting event:", r ? { event: e, data: r } : { event: e }), Pt()) {
520
+ const { targetOrigin: i = Re() } = n;
521
+ if (pe("Posting event:", r ? { event: e, data: r } : { event: e }), st()) {
505
522
  window.parent.postMessage(JSON.stringify({ eventType: e, eventData: r }), i);
506
523
  return;
507
524
  }
508
- if (Ce(window)) {
525
+ if (Tt(window)) {
509
526
  window.external.notify(JSON.stringify({ eventType: e, eventData: r }));
510
527
  return;
511
528
  }
512
- if (Et(window)) {
529
+ if (Rt(window)) {
513
530
  window.TelegramWebviewProxy.postEvent(e, JSON.stringify(r));
514
531
  return;
515
532
  }
516
- throw w(
517
- ae,
533
+ throw m(
534
+ le,
518
535
  "Unable to determine current environment and possible way to send event. You are probably trying to use Mini Apps method outside of Telegram application environment."
519
536
  );
520
537
  }
521
- function Re(e) {
538
+ function Ae(e) {
522
539
  return (t, s) => {
523
- if (!C(t, e))
524
- throw w(ie, `Method "${t}" is unsupported in Mini Apps version ${e}`);
525
- if (q(s)) {
540
+ if (!x(t, e))
541
+ throw m(ue, `Method "${t}" is unsupported in Mini Apps version ${e}`);
542
+ if (N(s)) {
526
543
  let n;
527
- if (t === "web_app_open_link" && "try_instant_view" in s ? n = "try_instant_view" : t === "web_app_set_header_color" && "color" in s && (n = "color"), n && !C(t, n, e))
528
- throw w(
529
- oe,
544
+ if (t === "web_app_open_link" && "try_instant_view" in s ? n = "try_instant_view" : t === "web_app_set_header_color" && "color" in s && (n = "color"), n && !x(t, n, e))
545
+ throw m(
546
+ de,
530
547
  `Parameter "${n}" of "${t}" method is unsupported in Mini Apps version ${e}`
531
548
  );
532
549
  }
533
- return k(t, s);
550
+ return q(t, s);
534
551
  };
535
552
  }
536
- function Ct(e) {
553
+ function It(e) {
537
554
  return ({ req_id: t }) => t === e;
538
555
  }
539
- function St(e) {
540
- return w(he, `Timeout reached: ${e}ms`);
556
+ function Ot(e) {
557
+ return m(ge, `Timeout reached: ${e}ms`);
541
558
  }
542
- function Rt(e, t) {
559
+ function qt(e, t) {
543
560
  return Promise.race([
544
561
  typeof e == "function" ? e() : e,
545
562
  new Promise((s, n) => {
546
563
  setTimeout(() => {
547
- n(St(t));
564
+ n(Ot(t));
548
565
  }, t);
549
566
  })
550
567
  ]);
551
568
  }
552
- async function m(e) {
569
+ async function w(e) {
553
570
  let t;
554
571
  const s = new Promise((u) => {
555
572
  t = u;
@@ -557,22 +574,22 @@ async function m(e) {
557
574
  method: n,
558
575
  event: r,
559
576
  capture: i,
560
- postEvent: o = k,
577
+ postEvent: o = q,
561
578
  timeout: a
562
- } = e, p = (Array.isArray(r) ? r : [r]).map(
563
- (u) => v(u, (l) => (!i || i(l)) && t(l))
579
+ } = e, h = (Array.isArray(r) ? r : [r]).map(
580
+ (u) => v(u, (d) => (!i || i(d)) && t(d))
564
581
  );
565
582
  try {
566
- return o(n, e.params), await (a ? Rt(s, a) : s);
583
+ return o(n, e.params), await (a ? qt(s, a) : s);
567
584
  } finally {
568
- p.forEach((u) => u());
585
+ h.forEach((u) => u());
569
586
  }
570
587
  }
571
588
  async function A(e, t, s, n = {}) {
572
589
  const {
573
590
  result: r,
574
591
  error: i
575
- } = await m({
592
+ } = await w({
576
593
  ...n,
577
594
  method: "web_app_invoke_custom_method",
578
595
  event: "custom_method_invoked",
@@ -581,30 +598,30 @@ async function A(e, t, s, n = {}) {
581
598
  params: t,
582
599
  req_id: s
583
600
  },
584
- capture: Ct(s)
601
+ capture: It(s)
585
602
  });
586
603
  if (i)
587
- throw w(ce, i);
604
+ throw m(_e, i);
588
605
  return r;
589
606
  }
590
- function Y(...e) {
607
+ function Z(...e) {
591
608
  return e.map((t) => {
592
609
  if (typeof t == "string")
593
610
  return t;
594
- if (q(t))
595
- return Y(Object.entries(t).map((s) => s[1] && s[0]));
611
+ if (N(t))
612
+ return Z(Object.entries(t).map((s) => s[1] && s[0]));
596
613
  if (Array.isArray(t))
597
- return Y(...t);
614
+ return Z(...t);
598
615
  }).filter(Boolean).join(" ");
599
616
  }
600
- function Ys(...e) {
601
- return e.reduce((t, s) => (q(s) && Object.entries(s).forEach(([n, r]) => {
602
- const i = Y(t[n], r);
617
+ function Qs(...e) {
618
+ return e.reduce((t, s) => (N(s) && Object.entries(s).forEach(([n, r]) => {
619
+ const i = Z(t[n], r);
603
620
  i.length && (t[n] = i);
604
621
  }), t), {});
605
622
  }
606
- function Tt(e) {
607
- const t = vt(e);
623
+ function kt(e) {
624
+ const t = xt(e);
608
625
  return Math.sqrt(
609
626
  [0.299, 0.587, 0.114].reduce((s, n, r) => {
610
627
  const i = parseInt(t.slice(1 + r * 2, 1 + (r + 1) * 2), 16);
@@ -612,9 +629,9 @@ function Tt(e) {
612
629
  }, 0)
613
630
  ) < 120;
614
631
  }
615
- class Te {
632
+ class Ie {
616
633
  constructor(t) {
617
- c(this, "ee", new B()), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this.state = t;
634
+ c(this, "ee", new O()), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this.state = t;
618
635
  }
619
636
  /**
620
637
  * Clones current state and returns its copy.
@@ -633,25 +650,25 @@ class Te {
633
650
  return this.state[t];
634
651
  }
635
652
  }
636
- class et {
653
+ class nt {
637
654
  constructor(t) {
638
- c(this, "state"), c(this, "get"), c(this, "set"), c(this, "clone"), this.state = new Te(t), this.set = this.state.set.bind(this.state), this.get = this.state.get.bind(this.state), this.clone = this.state.clone.bind(this.state);
655
+ c(this, "state"), c(this, "get"), c(this, "set"), c(this, "clone"), this.state = new Ie(t), this.set = this.state.set.bind(this.state), this.get = this.state.get.bind(this.state), this.clone = this.state.clone.bind(this.state);
639
656
  }
640
657
  }
641
- function At(e, t) {
642
- return (s) => C(t[s], e);
658
+ function Nt(e, t) {
659
+ return (s) => x(t[s], e);
643
660
  }
644
- class st extends et {
661
+ class rt extends nt {
645
662
  constructor(t, s, n) {
646
- super(t), c(this, "supports"), this.supports = At(s, n);
663
+ super(t), c(this, "supports"), this.supports = Nt(s, n);
647
664
  }
648
665
  }
649
- class Ae extends st {
666
+ class Oe extends rt {
650
667
  constructor(t, s, n) {
651
668
  super({ isVisible: t }, s, {
652
669
  show: "web_app_setup_back_button",
653
670
  hide: "web_app_setup_back_button"
654
- }), c(this, "on", (r, i) => r === "click" ? v("back_button_pressed", i) : this.state.on(r, i)), c(this, "off", (r, i) => r === "click" ? H("back_button_pressed", i) : this.state.off(r, i)), this.postEvent = n;
671
+ }), c(this, "on", (r, i) => r === "click" ? v("back_button_pressed", i) : this.state.on(r, i)), c(this, "off", (r, i) => r === "click" ? U("back_button_pressed", i) : this.state.off(r, i)), this.postEvent = n;
655
672
  }
656
673
  set isVisible(t) {
657
674
  this.set("isVisible", t), this.postEvent("web_app_setup_back_button", { is_visible: t });
@@ -675,28 +692,28 @@ class Ae extends st {
675
692
  this.isVisible = !0;
676
693
  }
677
694
  }
678
- const It = R((e) => e instanceof Date ? e : new Date(P().parse(e) * 1e3), "Date");
679
- function nt(e, t) {
695
+ const Dt = T((e) => e instanceof Date ? e : new Date(P().parse(e) * 1e3), "Date");
696
+ function it(e, t) {
680
697
  return new L((s) => {
681
698
  if (typeof s != "string" && !(s instanceof URLSearchParams))
682
699
  throw S();
683
700
  const n = typeof s == "string" ? new URLSearchParams(s) : s;
684
- return bt(e, (r) => {
701
+ return Pt(e, (r) => {
685
702
  const i = n.get(r);
686
703
  return i === null ? void 0 : i;
687
704
  });
688
705
  }, !1, t);
689
706
  }
690
- const Ie = f({
707
+ const qe = f({
691
708
  id: P(),
692
- type: h(),
693
- title: h(),
709
+ type: p(),
710
+ title: p(),
694
711
  photoUrl: {
695
- type: h().optional(),
712
+ type: p().optional(),
696
713
  from: "photo_url"
697
714
  },
698
- username: h().optional()
699
- }, "Chat").optional(), lt = f({
715
+ username: p().optional()
716
+ }, "Chat").optional(), gt = f({
700
717
  addedToAttachmentMenu: {
701
718
  type: y().optional(),
702
719
  from: "added_to_attachment_menu"
@@ -706,7 +723,7 @@ const Ie = f({
706
723
  from: "allows_write_to_pm"
707
724
  },
708
725
  firstName: {
709
- type: h(),
726
+ type: p(),
710
727
  from: "first_name"
711
728
  },
712
729
  id: P(),
@@ -719,80 +736,80 @@ const Ie = f({
719
736
  from: "is_premium"
720
737
  },
721
738
  languageCode: {
722
- type: h().optional(),
739
+ type: p().optional(),
723
740
  from: "language_code"
724
741
  },
725
742
  lastName: {
726
- type: h().optional(),
743
+ type: p().optional(),
727
744
  from: "last_name"
728
745
  },
729
746
  photoUrl: {
730
- type: h().optional(),
747
+ type: p().optional(),
731
748
  from: "photo_url"
732
749
  },
733
- username: h().optional()
750
+ username: p().optional()
734
751
  }, "User").optional();
735
- function kt() {
736
- return nt({
752
+ function Vt() {
753
+ return it({
737
754
  authDate: {
738
- type: It(),
755
+ type: Dt(),
739
756
  from: "auth_date"
740
757
  },
741
758
  canSendAfter: {
742
759
  type: P().optional(),
743
760
  from: "can_send_after"
744
761
  },
745
- chat: Ie,
762
+ chat: qe,
746
763
  chatInstance: {
747
- type: h().optional(),
764
+ type: p().optional(),
748
765
  from: "chat_instance"
749
766
  },
750
767
  chatType: {
751
- type: h().optional(),
768
+ type: p().optional(),
752
769
  from: "chat_type"
753
770
  },
754
- hash: h(),
771
+ hash: p(),
755
772
  queryId: {
756
- type: h().optional(),
773
+ type: p().optional(),
757
774
  from: "query_id"
758
775
  },
759
- receiver: lt,
776
+ receiver: gt,
760
777
  startParam: {
761
- type: h().optional(),
778
+ type: p().optional(),
762
779
  from: "start_param"
763
780
  },
764
- user: lt
781
+ user: gt
765
782
  }, "InitData");
766
783
  }
767
784
  function ke(e) {
768
785
  return e.replace(/_[a-z]/g, (t) => t[1].toUpperCase());
769
786
  }
770
- function Oe(e) {
787
+ function Ne(e) {
771
788
  return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);
772
789
  }
773
- const Ot = R(
790
+ const Mt = T(
774
791
  (e) => {
775
- const t = yt().optional();
776
- return Object.entries(X(e)).reduce((s, [n, r]) => (s[ke(n)] = t.parse(r), s), {});
792
+ const t = Ct().optional();
793
+ return Object.entries(tt(e)).reduce((s, [n, r]) => (s[ke(n)] = t.parse(r), s), {});
777
794
  },
778
795
  "ThemeParams"
779
796
  );
780
- function qt(e) {
781
- return nt({
797
+ function ot(e) {
798
+ return it({
782
799
  botInline: {
783
800
  type: y().optional(),
784
801
  from: "tgWebAppBotInline"
785
802
  },
786
803
  initData: {
787
- type: kt().optional(),
804
+ type: Vt().optional(),
788
805
  from: "tgWebAppData"
789
806
  },
790
807
  initDataRaw: {
791
- type: h().optional(),
808
+ type: p().optional(),
792
809
  from: "tgWebAppData"
793
810
  },
794
811
  platform: {
795
- type: h(),
812
+ type: p(),
796
813
  from: "tgWebAppPlatform"
797
814
  },
798
815
  showSettings: {
@@ -800,60 +817,60 @@ function qt(e) {
800
817
  from: "tgWebAppShowSettings"
801
818
  },
802
819
  startParam: {
803
- type: h().optional(),
820
+ type: p().optional(),
804
821
  from: "tgWebAppStartParam"
805
822
  },
806
823
  themeParams: {
807
- type: Ot(),
824
+ type: Mt(),
808
825
  from: "tgWebAppThemeParams"
809
826
  },
810
827
  version: {
811
- type: h(),
828
+ type: p(),
812
829
  from: "tgWebAppVersion"
813
830
  }
814
831
  }).parse(e);
815
832
  }
816
- function Dt(e) {
817
- return qt(
833
+ function Bt(e) {
834
+ return ot(
818
835
  e.replace(/^[^?#]*[?#]/, "").replace(/[?#]/g, "&")
819
836
  );
820
837
  }
821
- function qe() {
822
- return Dt(window.location.href);
838
+ function De() {
839
+ return Bt(window.location.href);
823
840
  }
824
- function Nt() {
841
+ function $t() {
825
842
  return performance.getEntriesByType("navigation")[0];
826
843
  }
827
- function De() {
828
- const e = Nt();
844
+ function Ve() {
845
+ const e = $t();
829
846
  if (!e)
830
847
  throw new Error("Unable to get first navigation entry.");
831
- return Dt(e.name);
848
+ return Bt(e.name);
832
849
  }
833
- function Vt(e) {
850
+ function Lt(e) {
834
851
  return `tma.js/${e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`)}`;
835
852
  }
836
- function Mt(e, t) {
837
- sessionStorage.setItem(Vt(e), JSON.stringify(t));
853
+ function Ht(e, t) {
854
+ sessionStorage.setItem(Lt(e), JSON.stringify(t));
838
855
  }
839
- function Bt(e) {
840
- const t = sessionStorage.getItem(Vt(e));
856
+ function Ut(e) {
857
+ const t = sessionStorage.getItem(Lt(e));
841
858
  try {
842
859
  return t ? JSON.parse(t) : void 0;
843
860
  } catch {
844
861
  }
845
862
  }
846
- function Ne() {
847
- return qt(Bt("launchParams") || "");
863
+ function Me() {
864
+ return ot(Ut("launchParams") || "");
848
865
  }
849
- function Ve(e) {
866
+ function Wt(e) {
850
867
  return JSON.stringify(
851
868
  Object.fromEntries(
852
- Object.entries(e).map(([t, s]) => [Oe(t), s])
869
+ Object.entries(e).map(([t, s]) => [Ne(t), s])
853
870
  )
854
871
  );
855
872
  }
856
- function Me(e) {
873
+ function Be(e) {
857
874
  const {
858
875
  initDataRaw: t,
859
876
  themeParams: s,
@@ -862,87 +879,76 @@ function Me(e) {
862
879
  showSettings: i,
863
880
  startParam: o,
864
881
  botInline: a
865
- } = e, p = new URLSearchParams();
866
- return p.set("tgWebAppPlatform", n), p.set("tgWebAppThemeParams", Ve(s)), p.set("tgWebAppVersion", r), t && p.set("tgWebAppData", t), o && p.set("tgWebAppStartParam", o), typeof i == "boolean" && p.set("tgWebAppShowSettings", i ? "1" : "0"), typeof a == "boolean" && p.set("tgWebAppBotInline", a ? "1" : "0"), p.toString();
882
+ } = e, h = new URLSearchParams();
883
+ return h.set("tgWebAppPlatform", n), h.set("tgWebAppThemeParams", Wt(s)), h.set("tgWebAppVersion", r), t && h.set("tgWebAppData", t), o && h.set("tgWebAppStartParam", o), typeof i == "boolean" && h.set("tgWebAppShowSettings", i ? "1" : "0"), typeof a == "boolean" && h.set("tgWebAppBotInline", a ? "1" : "0"), h.toString();
867
884
  }
868
- function Be(e) {
869
- Mt("launchParams", Me(e));
885
+ function jt(e) {
886
+ Ht("launchParams", Be(e));
870
887
  }
871
888
  function $e() {
872
889
  for (const e of [
873
890
  // Try to retrieve launch parameters from the current location. This method can return
874
891
  // nothing in case, location was changed and then page was reloaded.
875
- qe,
876
- // Then, try using the lower level API - window.performance.
877
892
  De,
893
+ // Then, try using the lower level API - window.performance.
894
+ Ve,
878
895
  // Finally, try to extract launch parameters from the session storage.
879
- Ne
896
+ Me
880
897
  ])
881
898
  try {
882
899
  const t = e();
883
- return Be(t), t;
900
+ return jt(t), t;
884
901
  } catch {
885
902
  }
886
903
  throw new Error("Unable to retrieve launch parameters from any known source.");
887
904
  }
888
- function $t() {
889
- const e = Nt();
905
+ function Gt() {
906
+ const e = $t();
890
907
  return !!(e && e.type === "reload");
891
908
  }
892
909
  function Le() {
893
910
  let e = 0;
894
911
  return () => (e += 1).toString();
895
912
  }
896
- function Ue() {
897
- let e = !1;
898
- const t = [];
899
- return [
900
- (s) => !e && t.push(s),
901
- () => {
902
- e || (e = !0, t.forEach((s) => s()));
903
- },
904
- e
905
- ];
906
- }
907
- const [He] = ft(Le);
908
- function d(e, t) {
913
+ const [He] = bt(Le);
914
+ function l(e, t) {
909
915
  return () => {
910
916
  const s = $e(), n = {
911
917
  ...s,
912
- postEvent: Re(s.version),
918
+ postEvent: Ae(s.version),
913
919
  createRequestId: He()
914
920
  };
915
921
  if (typeof e == "function")
916
922
  return e(n);
917
- const [r, i, o] = Ue(), a = t({
923
+ const [r, i, o] = yt(), a = t({
918
924
  ...n,
919
925
  // State should only be passed only in case, current page was reloaded. If we don't add
920
926
  // this check, state restoration will work improperly in the web version of Telegram,
921
927
  // when we are always working in the same "session" (tab).
922
- state: $t() ? Bt(e) : void 0,
928
+ state: Gt() ? Ut(e) : void 0,
923
929
  addCleanup: r
924
- }), p = (u) => (o || r(
925
- u.on("change", (l) => {
926
- Mt(e, l);
930
+ }), h = (u) => (o || r(
931
+ u.on("change", (d) => {
932
+ Ht(e, d);
927
933
  })
928
934
  ), u);
929
935
  return [
930
- a instanceof Promise ? a.then(p) : p(a),
936
+ a instanceof Promise ? a.then(h) : h(a),
931
937
  i
932
938
  ];
933
939
  };
934
940
  }
935
- const We = d("backButton", ({
941
+ const Ue = l("backButton", ({
936
942
  postEvent: e,
937
943
  version: t,
938
944
  state: s = { isVisible: !1 }
939
- }) => new Ae(s.isVisible, t, e));
940
- class D extends st {
945
+ }) => new Oe(s.isVisible, t, e));
946
+ class D extends rt {
941
947
  constructor() {
942
948
  super(...arguments), c(this, "on", this.state.on.bind(this.state)), c(this, "off", this.state.off.bind(this.state));
943
949
  }
944
950
  }
945
- function Lt(e) {
951
+ function Kt(e) {
946
952
  const t = e.available ? e : {
947
953
  available: !1,
948
954
  device_id: "",
@@ -960,7 +966,7 @@ function Lt(e) {
960
966
  accessGranted: t.access_granted
961
967
  };
962
968
  }
963
- class je extends D {
969
+ class We extends D {
964
970
  constructor({ postEvent: t, version: s, ...n }) {
965
971
  super(n, s, {
966
972
  auth: "web_app_biometry_request_auth",
@@ -997,7 +1003,7 @@ class je extends D {
997
1003
  reason: t,
998
1004
  ...s
999
1005
  }) {
1000
- return this.authPromise || (this.authPromise = m({
1006
+ return this.authPromise || (this.authPromise = w({
1001
1007
  ...s,
1002
1008
  method: "web_app_biometry_request_auth",
1003
1009
  event: "biometry_auth_requested",
@@ -1031,14 +1037,14 @@ class je extends D {
1031
1037
  * @returns Promise with true, if access was granted.
1032
1038
  */
1033
1039
  requestAccess({ reason: t, ...s } = {}) {
1034
- return this.accessPromise || (this.accessPromise = m({
1040
+ return this.accessPromise || (this.accessPromise = w({
1035
1041
  ...s,
1036
1042
  postEvent: this.postEvent,
1037
1043
  method: "web_app_biometry_request_access",
1038
1044
  event: "biometry_info_received",
1039
1045
  params: { reason: t || "" }
1040
1046
  }).then((n) => {
1041
- const r = Lt(n);
1047
+ const r = Kt(n);
1042
1048
  return this.set(r), r.accessGranted;
1043
1049
  }).finally(() => this.accessPromise = void 0)), this.accessPromise;
1044
1050
  }
@@ -1060,7 +1066,7 @@ class je extends D {
1060
1066
  */
1061
1067
  async updateToken({ token: t, ...s } = {}) {
1062
1068
  return ["removed", "updated"].includes(
1063
- (await m({
1069
+ (await w({
1064
1070
  ...s,
1065
1071
  postEvent: this.postEvent,
1066
1072
  method: "web_app_biometry_update_token",
@@ -1070,29 +1076,35 @@ class je extends D {
1070
1076
  );
1071
1077
  }
1072
1078
  }
1073
- async function Ge(e) {
1074
- return Lt(
1075
- await m({
1079
+ async function je(e) {
1080
+ return Kt(
1081
+ await w({
1076
1082
  ...e || {},
1077
1083
  method: "web_app_biometry_get_info",
1078
1084
  event: "biometry_info_received"
1079
1085
  })
1080
1086
  );
1081
1087
  }
1082
- const Ke = d(
1088
+ const Ge = l(
1083
1089
  "biometryManager",
1084
- async ({ postEvent: e, version: t, state: s }) => new je({
1085
- ...s || await Ge({ timeout: 1e3 }),
1090
+ async ({ postEvent: e, version: t, state: s }) => new We({
1091
+ ...s || x("web_app_biometry_get_info", t) ? s || await je({ timeout: 1e3 }) : {
1092
+ available: !1,
1093
+ accessGranted: !1,
1094
+ accessRequested: !1,
1095
+ tokenSaved: !1,
1096
+ deviceId: ""
1097
+ },
1086
1098
  version: t,
1087
1099
  postEvent: e
1088
1100
  })
1089
1101
  );
1090
- class rt extends et {
1102
+ class at extends nt {
1091
1103
  constructor() {
1092
1104
  super(...arguments), c(this, "on", this.state.on.bind(this.state)), c(this, "off", this.state.off.bind(this.state));
1093
1105
  }
1094
1106
  }
1095
- class ze extends rt {
1107
+ class Ke extends at {
1096
1108
  constructor(t, s) {
1097
1109
  super({ isConfirmationNeeded: t }), this.postEvent = s;
1098
1110
  }
@@ -1119,19 +1131,19 @@ class ze extends rt {
1119
1131
  this.isConfirmationNeeded = !0;
1120
1132
  }
1121
1133
  }
1122
- const Je = d(
1134
+ const ze = l(
1123
1135
  "closingBehavior",
1124
1136
  ({
1125
1137
  postEvent: e,
1126
1138
  state: t = { isConfirmationNeeded: !1 }
1127
- }) => new ze(t.isConfirmationNeeded, e)
1139
+ }) => new Ke(t.isConfirmationNeeded, e)
1128
1140
  );
1129
- class it {
1141
+ class ct {
1130
1142
  constructor(t, s) {
1131
- c(this, "supports"), this.supports = At(t, s);
1143
+ c(this, "supports"), this.supports = Nt(t, s);
1132
1144
  }
1133
1145
  }
1134
- function Qe(e) {
1146
+ function Je(e) {
1135
1147
  if (Array.isArray(e))
1136
1148
  return e;
1137
1149
  if (typeof e == "string")
@@ -1145,7 +1157,7 @@ function Qe(e) {
1145
1157
  }
1146
1158
  class Fe extends L {
1147
1159
  constructor(t, s, n) {
1148
- super(Qe, s, n), c(this, "itemParser"), this.itemParser = typeof t == "function" ? t : t.parse.bind(t);
1160
+ super(Je, s, n), c(this, "itemParser"), this.itemParser = typeof t == "function" ? t : t.parse.bind(t);
1149
1161
  }
1150
1162
  /**
1151
1163
  * Attempts to parse passed value
@@ -1161,13 +1173,13 @@ class Fe extends L {
1161
1173
  return this.itemParser = typeof t == "function" ? t : t.parse.bind(t), this;
1162
1174
  }
1163
1175
  }
1164
- function Ye(e) {
1176
+ function Qe(e) {
1165
1177
  return new Fe((t) => t, !1, e);
1166
1178
  }
1167
- function dt(e, t) {
1179
+ function ft(e, t) {
1168
1180
  return Object.fromEntries(e.map((s) => [s, t]));
1169
1181
  }
1170
- class Ze extends it {
1182
+ class Ye extends ct {
1171
1183
  constructor(t, s, n) {
1172
1184
  super(t, {
1173
1185
  delete: "web_app_invoke_custom_method",
@@ -1195,7 +1207,7 @@ class Ze extends it {
1195
1207
  * @param options - request execution options.
1196
1208
  */
1197
1209
  async getKeys(t = {}) {
1198
- return Ye().of(h()).parse(
1210
+ return Qe().of(p()).parse(
1199
1211
  await A(
1200
1212
  "getStorageKeys",
1201
1213
  {},
@@ -1207,13 +1219,13 @@ class Ze extends it {
1207
1219
  async get(t, s = {}) {
1208
1220
  const n = Array.isArray(t) ? t : [t];
1209
1221
  if (!n.length)
1210
- return dt(n, "");
1222
+ return ft(n, "");
1211
1223
  const r = await A(
1212
1224
  "getStorageValues",
1213
1225
  { keys: n },
1214
1226
  this.createRequestId(),
1215
1227
  { ...s, postEvent: this.postEvent }
1216
- ), i = f(dt(n, h()), "CloudStorageData").parse(r);
1228
+ ), i = f(ft(n, p()), "CloudStorageData").parse(r);
1217
1229
  return Array.isArray(t) ? i : i[t];
1218
1230
  }
1219
1231
  /**
@@ -1231,10 +1243,10 @@ class Ze extends it {
1231
1243
  );
1232
1244
  }
1233
1245
  }
1234
- const Xe = d(
1235
- ({ createRequestId: e, postEvent: t, version: s }) => new Ze(s, e, t)
1246
+ const Ze = l(
1247
+ ({ createRequestId: e, postEvent: t, version: s }) => new Ye(s, e, t)
1236
1248
  );
1237
- class ts extends it {
1249
+ class Xe extends ct {
1238
1250
  constructor(t, s) {
1239
1251
  super(t, {
1240
1252
  impactOccurred: "web_app_trigger_haptic_feedback",
@@ -1276,10 +1288,10 @@ class ts extends it {
1276
1288
  this.postEvent("web_app_trigger_haptic_feedback", { type: "selection_change" });
1277
1289
  }
1278
1290
  }
1279
- const es = d(
1280
- ({ version: e, postEvent: t }) => new ts(e, t)
1291
+ const ts = l(
1292
+ ({ version: e, postEvent: t }) => new Xe(e, t)
1281
1293
  );
1282
- class ss {
1294
+ class es {
1283
1295
  constructor(t) {
1284
1296
  this.initData = t;
1285
1297
  }
@@ -1352,13 +1364,13 @@ class ss {
1352
1364
  return this.initData.user;
1353
1365
  }
1354
1366
  }
1355
- const ns = d(
1356
- ({ initData: e }) => e ? new ss(e) : void 0
1367
+ const ss = l(
1368
+ ({ initData: e }) => e ? new es(e) : void 0
1357
1369
  );
1358
- function Zs(e) {
1359
- return kt().parse(e);
1370
+ function Ys(e) {
1371
+ return Vt().parse(e);
1360
1372
  }
1361
- class rs extends D {
1373
+ class ns extends D {
1362
1374
  constructor(t, s, n) {
1363
1375
  super({ isOpened: t }, s, { open: "web_app_open_invoice" }), this.postEvent = n;
1364
1376
  }
@@ -1388,7 +1400,7 @@ class rs extends D {
1388
1400
  }
1389
1401
  this.isOpened = !0;
1390
1402
  try {
1391
- return (await m({
1403
+ return (await w({
1392
1404
  method: "web_app_open_invoice",
1393
1405
  event: "invoice_closed",
1394
1406
  params: { slug: n },
@@ -1402,12 +1414,18 @@ class rs extends D {
1402
1414
  }
1403
1415
  }
1404
1416
  }
1405
- const is = d(
1406
- ({ version: e, postEvent: t }) => new rs(!1, e, t)
1417
+ const rs = l(
1418
+ ({ version: e, postEvent: t }) => new ns(!1, e, t)
1407
1419
  );
1408
- class os extends et {
1420
+ class is extends nt {
1409
1421
  constructor({ postEvent: t, ...s }) {
1410
- super(s), c(this, "postEvent"), c(this, "on", (n, r) => n === "click" ? v("main_button_pressed", r) : this.state.on(n, r)), c(this, "off", (n, r) => n === "click" ? H("main_button_pressed", r) : this.state.off(n, r)), this.postEvent = t;
1422
+ super(s), c(this, "postEvent"), c(this, "on", (n, r) => n === "click" ? v("main_button_pressed", r) : this.state.on(n, r)), c(this, "off", (n, r) => n === "click" ? U("main_button_pressed", r) : this.state.off(n, r)), this.postEvent = t;
1423
+ }
1424
+ /**
1425
+ * The MainButton background color.
1426
+ */
1427
+ get bgColor() {
1428
+ return this.get("bgColor");
1411
1429
  }
1412
1430
  /**
1413
1431
  * Sends current local state to the Telegram application.
@@ -1418,10 +1436,35 @@ class os extends et {
1418
1436
  is_active: this.isEnabled,
1419
1437
  is_progress_visible: this.isLoaderVisible,
1420
1438
  text: this.text,
1421
- color: this.backgroundColor,
1439
+ color: this.bgColor,
1422
1440
  text_color: this.textColor
1423
1441
  });
1424
1442
  }
1443
+ /**
1444
+ * Disables the MainButton.
1445
+ * @see Does not work on Android: https://github.com/Telegram-Mini-Apps/issues/issues/1
1446
+ */
1447
+ disable() {
1448
+ return this.isEnabled = !1, this;
1449
+ }
1450
+ /**
1451
+ * Enables the MainButton.
1452
+ */
1453
+ enable() {
1454
+ return this.isEnabled = !0, this;
1455
+ }
1456
+ /**
1457
+ * Hides the MainButton.
1458
+ */
1459
+ hide() {
1460
+ return this.isVisible = !1, this;
1461
+ }
1462
+ /**
1463
+ * Hides the MainButton loading indicator.
1464
+ */
1465
+ hideLoader() {
1466
+ return this.isLoaderVisible = !1, this;
1467
+ }
1425
1468
  set isEnabled(t) {
1426
1469
  this.setParams({ isEnabled: t });
1427
1470
  }
@@ -1449,49 +1492,6 @@ class os extends et {
1449
1492
  get isVisible() {
1450
1493
  return this.get("isVisible");
1451
1494
  }
1452
- /**
1453
- * The MainButton background color.
1454
- */
1455
- get backgroundColor() {
1456
- return this.get("backgroundColor");
1457
- }
1458
- /**
1459
- * The MainButton text.
1460
- */
1461
- get text() {
1462
- return this.get("text");
1463
- }
1464
- /**
1465
- * The MainButton text color.
1466
- */
1467
- get textColor() {
1468
- return this.get("textColor");
1469
- }
1470
- /**
1471
- * Disables the MainButton.
1472
- * @see Does not work on Android: https://github.com/Telegram-Mini-Apps/issues/issues/1
1473
- */
1474
- disable() {
1475
- return this.isEnabled = !1, this;
1476
- }
1477
- /**
1478
- * Enables the MainButton.
1479
- */
1480
- enable() {
1481
- return this.isEnabled = !0, this;
1482
- }
1483
- /**
1484
- * Hides the MainButton.
1485
- */
1486
- hide() {
1487
- return this.isVisible = !1, this;
1488
- }
1489
- /**
1490
- * Hides the MainButton loading indicator.
1491
- */
1492
- hideLoader() {
1493
- return this.isLoaderVisible = !1, this;
1494
- }
1495
1495
  /**
1496
1496
  * Shows the MainButton.
1497
1497
  *
@@ -1523,10 +1523,10 @@ class os extends et {
1523
1523
  }
1524
1524
  /**
1525
1525
  * Updates current Main Button color.
1526
- * @param backgroundColor - color to set.
1526
+ * @param bgColor - color to set.
1527
1527
  */
1528
- setBackgroundColor(t) {
1529
- return this.setParams({ backgroundColor: t });
1528
+ setBgColor(t) {
1529
+ return this.setParams({ bgColor: t });
1530
1530
  }
1531
1531
  /**
1532
1532
  * Allows setting multiple Main Button parameters.
@@ -1535,8 +1535,20 @@ class os extends et {
1535
1535
  setParams(t) {
1536
1536
  return this.set(t), this.commit(), this;
1537
1537
  }
1538
+ /**
1539
+ * The MainButton text.
1540
+ */
1541
+ get text() {
1542
+ return this.get("text");
1543
+ }
1544
+ /**
1545
+ * The MainButton text color.
1546
+ */
1547
+ get textColor() {
1548
+ return this.get("textColor");
1549
+ }
1538
1550
  }
1539
- const as = d(
1551
+ const os = l(
1540
1552
  "mainButton",
1541
1553
  ({
1542
1554
  postEvent: e,
@@ -1547,49 +1559,49 @@ const as = d(
1547
1559
  text: "",
1548
1560
  isLoaderVisible: !1,
1549
1561
  textColor: t.buttonTextColor || "#ffffff",
1550
- backgroundColor: t.buttonColor || "#000000"
1562
+ bgColor: t.buttonColor || "#000000"
1551
1563
  }
1552
- }) => new os({ ...s, postEvent: e })
1564
+ }) => new is({ ...s, postEvent: e })
1553
1565
  );
1554
- function cs() {
1555
- return nt({
1566
+ function as() {
1567
+ return it({
1556
1568
  contact: f({
1557
1569
  userId: {
1558
1570
  type: P(),
1559
1571
  from: "user_id"
1560
1572
  },
1561
1573
  phoneNumber: {
1562
- type: h(),
1574
+ type: p(),
1563
1575
  from: "phone_number"
1564
1576
  },
1565
1577
  firstName: {
1566
- type: h(),
1578
+ type: p(),
1567
1579
  from: "first_name"
1568
1580
  },
1569
1581
  lastName: {
1570
- type: h().optional(),
1582
+ type: p().optional(),
1571
1583
  from: "last_name"
1572
1584
  }
1573
1585
  }),
1574
1586
  authDate: {
1575
- type: It(),
1587
+ type: Dt(),
1576
1588
  from: "auth_date"
1577
1589
  },
1578
- hash: h()
1590
+ hash: p()
1579
1591
  }, "RequestedContact");
1580
1592
  }
1581
- function Ut(e, t) {
1593
+ function zt(e, t) {
1582
1594
  return (s) => {
1583
1595
  const [n, r] = t[s];
1584
- return C(n, r, e);
1596
+ return x(n, r, e);
1585
1597
  };
1586
1598
  }
1587
- function hs(e) {
1599
+ function cs(e) {
1588
1600
  return new Promise((t) => {
1589
1601
  setTimeout(t, e);
1590
1602
  });
1591
1603
  }
1592
- class ps extends D {
1604
+ class hs extends D {
1593
1605
  constructor({ postEvent: t, createRequestId: s, version: n, botInline: r, ...i }) {
1594
1606
  super(i, n, {
1595
1607
  requestPhoneAccess: "web_app_request_phone",
@@ -1599,7 +1611,7 @@ class ps extends D {
1599
1611
  setBackgroundColor: "web_app_set_background_color"
1600
1612
  }), c(this, "botInline"), c(this, "postEvent"), c(this, "createRequestId"), c(this, "requestPhoneAccessPromise"), c(this, "requestWriteAccessPromise"), c(this, "supportsParam"), this.createRequestId = s, this.postEvent = t, this.botInline = r;
1601
1613
  const o = this.supports.bind(this);
1602
- this.supports = (a) => o(a) ? a !== "switchInlineQuery" || r : !1, this.supportsParam = Ut(n, {
1614
+ this.supports = (a) => o(a) ? a !== "switchInlineQuery" || r : !1, this.supportsParam = zt(n, {
1603
1615
  "setHeaderColor.color": ["web_app_set_header_color", "color"]
1604
1616
  });
1605
1617
  }
@@ -1610,7 +1622,7 @@ class ps extends D {
1610
1622
  async getRequestedContact({
1611
1623
  timeout: t = 1e4
1612
1624
  } = {}) {
1613
- return cs().parse(
1625
+ return as().parse(
1614
1626
  await A(
1615
1627
  "getRequestedContact",
1616
1628
  {},
@@ -1650,7 +1662,7 @@ class ps extends D {
1650
1662
  * True if current Mini App background color is recognized as dark.
1651
1663
  */
1652
1664
  get isDark() {
1653
- return Tt(this.bgColor);
1665
+ return kt(this.bgColor);
1654
1666
  }
1655
1667
  /**
1656
1668
  * Informs the Telegram app that the Mini App is ready to be displayed.
@@ -1679,15 +1691,15 @@ class ps extends D {
1679
1691
  throw new Error("Access denied.");
1680
1692
  const s = Date.now() + t;
1681
1693
  let n = 50;
1682
- return Rt(async () => {
1694
+ return qt(async () => {
1683
1695
  for (; Date.now() < s; ) {
1684
1696
  try {
1685
1697
  return await this.getRequestedContact();
1686
1698
  } catch {
1687
1699
  }
1688
- await hs(n), n += 50;
1700
+ await cs(n), n += 50;
1689
1701
  }
1690
- throw St(t);
1702
+ throw Ot(t);
1691
1703
  }, t);
1692
1704
  }
1693
1705
  /**
@@ -1700,7 +1712,7 @@ class ps extends D {
1700
1712
  * @see requestContact
1701
1713
  */
1702
1714
  async requestPhoneAccess(t = {}) {
1703
- return this.requestPhoneAccessPromise || (this.requestPhoneAccessPromise = m({
1715
+ return this.requestPhoneAccessPromise || (this.requestPhoneAccessPromise = w({
1704
1716
  ...t,
1705
1717
  method: "web_app_request_phone",
1706
1718
  event: "phone_requested",
@@ -1712,7 +1724,7 @@ class ps extends D {
1712
1724
  * @param options - additional options.
1713
1725
  */
1714
1726
  async requestWriteAccess(t = {}) {
1715
- return this.requestWriteAccessPromise || (this.requestWriteAccessPromise = m({
1727
+ return this.requestWriteAccessPromise || (this.requestWriteAccessPromise = w({
1716
1728
  ...t,
1717
1729
  method: "web_app_request_write_access",
1718
1730
  event: "write_access_requested",
@@ -1742,7 +1754,7 @@ class ps extends D {
1742
1754
  * @param color - color key or RGB color.
1743
1755
  */
1744
1756
  setHeaderColor(t) {
1745
- this.postEvent("web_app_set_header_color", tt(t) ? { color: t } : { color_key: t }), this.set("headerColor", t);
1757
+ this.postEvent("web_app_set_header_color", et(t) ? { color: t } : { color_key: t }), this.set("headerColor", t);
1746
1758
  }
1747
1759
  /**
1748
1760
  * Updates current Mini App background color.
@@ -1770,7 +1782,7 @@ class ps extends D {
1770
1782
  this.postEvent("web_app_switch_inline_query", { query: t, chat_types: s });
1771
1783
  }
1772
1784
  }
1773
- const us = d(
1785
+ const ps = l(
1774
1786
  "miniApp",
1775
1787
  ({
1776
1788
  themeParams: e,
@@ -1780,9 +1792,9 @@ const us = d(
1780
1792
  headerColor: e.headerBgColor || "#000000"
1781
1793
  },
1782
1794
  ...n
1783
- }) => new ps({ ...n, ...s, botInline: t })
1795
+ }) => new hs({ ...n, ...s, botInline: t })
1784
1796
  );
1785
- function ls(e) {
1797
+ function us(e) {
1786
1798
  const t = e.message.trim(), s = (e.title || "").trim(), n = e.buttons || [];
1787
1799
  let r;
1788
1800
  if (s.length > 64)
@@ -1798,8 +1810,8 @@ function ls(e) {
1798
1810
  if (!i.type || i.type === "default" || i.type === "destructive") {
1799
1811
  const a = i.text.trim();
1800
1812
  if (!a.length || a.length > 64) {
1801
- const p = i.type || "default";
1802
- throw new Error(`Button text with type "${p}" has incorrect size: ${i.text.length}`);
1813
+ const h = i.type || "default";
1814
+ throw new Error(`Button text with type "${h}" has incorrect size: ${i.text.length}`);
1803
1815
  }
1804
1816
  return { ...i, text: a, id: o };
1805
1817
  }
@@ -1835,11 +1847,11 @@ class ds extends D {
1835
1847
  throw new Error("Popup is already opened.");
1836
1848
  this.isOpened = !0;
1837
1849
  try {
1838
- const { button_id: s = null } = await m({
1850
+ const { button_id: s = null } = await w({
1839
1851
  event: "popup_closed",
1840
1852
  method: "web_app_open_popup",
1841
1853
  postEvent: this.postEvent,
1842
- params: ls(t)
1854
+ params: us(t)
1843
1855
  });
1844
1856
  return s;
1845
1857
  } finally {
@@ -1847,10 +1859,10 @@ class ds extends D {
1847
1859
  }
1848
1860
  }
1849
1861
  }
1850
- const _s = d(
1862
+ const ls = l(
1851
1863
  ({ postEvent: e, version: t }) => new ds(!1, t, e)
1852
1864
  );
1853
- class gs extends D {
1865
+ class _s extends D {
1854
1866
  constructor(t, s, n) {
1855
1867
  super({ isOpened: t }, s, {
1856
1868
  close: "web_app_close_scan_qr_popup",
@@ -1883,7 +1895,7 @@ class gs extends D {
1883
1895
  throw new Error("QR scanner is already opened.");
1884
1896
  this.isOpened = !0;
1885
1897
  try {
1886
- return (await m({
1898
+ return (await w({
1887
1899
  method: "web_app_open_scan_qr_popup",
1888
1900
  event: ["qr_text_received", "scan_qr_popup_closed"],
1889
1901
  postEvent: this.postEvent,
@@ -1894,15 +1906,15 @@ class gs extends D {
1894
1906
  }
1895
1907
  }
1896
1908
  }
1897
- const fs = d(
1898
- ({ version: e, postEvent: t }) => new gs(!1, e, t)
1909
+ const gs = l(
1910
+ ({ version: e, postEvent: t }) => new _s(!1, e, t)
1899
1911
  );
1900
- class ms extends st {
1912
+ class fs extends rt {
1901
1913
  constructor(t, s, n) {
1902
1914
  super({ isVisible: t }, s, {
1903
1915
  show: "web_app_setup_settings_button",
1904
1916
  hide: "web_app_setup_settings_button"
1905
- }), c(this, "on", (r, i) => r === "click" ? v("settings_button_pressed", i) : this.state.on(r, i)), c(this, "off", (r, i) => r === "click" ? H("settings_button_pressed", i) : this.state.off(r, i)), this.postEvent = n;
1917
+ }), c(this, "on", (r, i) => r === "click" ? v("settings_button_pressed", i) : this.state.on(r, i)), c(this, "off", (r, i) => r === "click" ? U("settings_button_pressed", i) : this.state.off(r, i)), this.postEvent = n;
1906
1918
  }
1907
1919
  set isVisible(t) {
1908
1920
  this.set("isVisible", t), this.postEvent("web_app_setup_settings_button", { is_visible: t });
@@ -1926,18 +1938,18 @@ class ms extends st {
1926
1938
  this.isVisible = !0;
1927
1939
  }
1928
1940
  }
1929
- const ws = d(
1941
+ const ws = l(
1930
1942
  "settingsButton",
1931
1943
  ({
1932
1944
  version: e,
1933
1945
  postEvent: t,
1934
1946
  state: s = { isVisible: !1 }
1935
- }) => new ms(s.isVisible, e, t)
1947
+ }) => new fs(s.isVisible, e, t)
1936
1948
  );
1937
- function Ht(e) {
1938
- return Ot().parse(e);
1949
+ function Jt(e) {
1950
+ return Mt().parse(e);
1939
1951
  }
1940
- class bs extends rt {
1952
+ class ms extends at {
1941
1953
  /**
1942
1954
  * @since v6.10
1943
1955
  */
@@ -1976,7 +1988,7 @@ class bs extends rt {
1976
1988
  * value is calculated according to theme bg color.
1977
1989
  */
1978
1990
  get isDark() {
1979
- return !this.bgColor || Tt(this.bgColor);
1991
+ return !this.bgColor || kt(this.bgColor);
1980
1992
  }
1981
1993
  get linkColor() {
1982
1994
  return this.get("linkColor");
@@ -2002,7 +2014,7 @@ class bs extends rt {
2002
2014
  */
2003
2015
  listen() {
2004
2016
  return v("theme_changed", (t) => {
2005
- this.set(Ht(t.theme_params));
2017
+ this.set(Jt(t.theme_params));
2006
2018
  });
2007
2019
  }
2008
2020
  /**
@@ -2015,23 +2027,23 @@ class bs extends rt {
2015
2027
  return this.get("textColor");
2016
2028
  }
2017
2029
  }
2018
- const vs = d(
2030
+ const bs = l(
2019
2031
  "themeParams",
2020
2032
  ({ themeParams: e, state: t = e, addCleanup: s }) => {
2021
- const n = new bs(t);
2033
+ const n = new ms(t);
2022
2034
  return s(n.listen()), n;
2023
2035
  }
2024
2036
  );
2025
- function Xs(e = {}) {
2026
- return m({
2037
+ function Zs(e = {}) {
2038
+ return w({
2027
2039
  ...e,
2028
2040
  method: "web_app_request_theme",
2029
2041
  event: "theme_changed"
2030
- }).then(Ht);
2042
+ }).then(Jt);
2031
2043
  }
2032
- class ys extends it {
2044
+ class vs extends ct {
2033
2045
  constructor(t, s, n) {
2034
- super(t, { readTextFromClipboard: "web_app_read_text_from_clipboard" }), c(this, "supportsParam"), this.version = t, this.createRequestId = s, this.postEvent = n, this.supportsParam = Ut(t, {
2046
+ super(t, { readTextFromClipboard: "web_app_read_text_from_clipboard" }), c(this, "supportsParam"), this.version = t, this.createRequestId = s, this.postEvent = n, this.supportsParam = zt(t, {
2035
2047
  "openLink.tryInstantView": ["web_app_open_link", "try_instant_view"]
2036
2048
  });
2037
2049
  }
@@ -2046,7 +2058,7 @@ class ys extends it {
2046
2058
  */
2047
2059
  openLink(t, s) {
2048
2060
  const n = new URL(t, window.location.href).toString();
2049
- if (!C("web_app_open_link", this.version)) {
2061
+ if (!x("web_app_open_link", this.version)) {
2050
2062
  window.open(n, "_blank");
2051
2063
  return;
2052
2064
  }
@@ -2065,7 +2077,7 @@ class ys extends it {
2065
2077
  const { hostname: s, pathname: n, search: r } = new URL(t, window.location.href);
2066
2078
  if (s !== "t.me")
2067
2079
  throw new Error(`URL has not allowed hostname: ${s}. Only "t.me" is allowed`);
2068
- if (!C("web_app_open_tg_link", this.version)) {
2080
+ if (!x("web_app_open_tg_link", this.version)) {
2069
2081
  window.location.href = t;
2070
2082
  return;
2071
2083
  }
@@ -2080,41 +2092,41 @@ class ys extends it {
2080
2092
  async readTextFromClipboard() {
2081
2093
  const t = this.createRequestId(), {
2082
2094
  data: s = null
2083
- } = await m({
2095
+ } = await w({
2084
2096
  method: "web_app_read_text_from_clipboard",
2085
2097
  event: "clipboard_text_received",
2086
2098
  postEvent: this.postEvent,
2087
2099
  params: { req_id: t },
2088
- capture: Ct(t)
2100
+ capture: It(t)
2089
2101
  });
2090
2102
  return s;
2091
2103
  }
2092
2104
  }
2093
- const Es = d(
2094
- ({ version: e, postEvent: t, createRequestId: s }) => new ys(e, s, t)
2105
+ const ys = l(
2106
+ ({ version: e, postEvent: t, createRequestId: s }) => new vs(e, s, t)
2095
2107
  );
2096
- async function Wt(e = {}) {
2108
+ async function Ft(e = {}) {
2097
2109
  const {
2098
2110
  is_expanded: t,
2099
2111
  is_state_stable: s,
2100
2112
  ...n
2101
- } = await m({
2113
+ } = await w({
2102
2114
  ...e,
2103
2115
  method: "web_app_request_viewport",
2104
2116
  event: "viewport_changed"
2105
2117
  });
2106
2118
  return { ...n, isExpanded: t, isStateStable: s };
2107
2119
  }
2108
- function T(e) {
2120
+ function R(e) {
2109
2121
  return e < 0 ? 0 : e;
2110
2122
  }
2111
- class Ps extends rt {
2123
+ class Es extends at {
2112
2124
  constructor({ postEvent: t, stableHeight: s, height: n, width: r, isExpanded: i }) {
2113
2125
  super({
2114
- height: T(n),
2126
+ height: R(n),
2115
2127
  isExpanded: i,
2116
- stableHeight: T(s),
2117
- width: T(r)
2128
+ stableHeight: R(s),
2129
+ width: R(r)
2118
2130
  }), c(this, "postEvent"), this.postEvent = t;
2119
2131
  }
2120
2132
  /**
@@ -2123,7 +2135,7 @@ class Ps extends rt {
2123
2135
  * @param options - options to request fresh data.
2124
2136
  */
2125
2137
  async sync(t) {
2126
- const { isStateStable: s, ...n } = await Wt(t);
2138
+ const { isStateStable: s, ...n } = await Ft(t);
2127
2139
  this.set({
2128
2140
  ...n,
2129
2141
  stableHeight: s ? n.height : this.get("stableHeight")
@@ -2176,11 +2188,11 @@ class Ps extends rt {
2176
2188
  width: n,
2177
2189
  is_expanded: r,
2178
2190
  is_state_stable: i
2179
- } = t, o = T(s);
2191
+ } = t, o = R(s);
2180
2192
  this.set({
2181
2193
  height: o,
2182
2194
  isExpanded: r,
2183
- width: T(n),
2195
+ width: R(n),
2184
2196
  ...i ? { stableHeight: o } : {}
2185
2197
  });
2186
2198
  });
@@ -2215,7 +2227,7 @@ class Ps extends rt {
2215
2227
  return this.stableHeight === this.height;
2216
2228
  }
2217
2229
  }
2218
- const xs = d(
2230
+ const Ps = l(
2219
2231
  "viewport",
2220
2232
  async ({ state: e, platform: t, postEvent: s, addCleanup: n }) => {
2221
2233
  let r = !1, i = 0, o = 0, a = 0;
@@ -2224,31 +2236,31 @@ const xs = d(
2224
2236
  else if (["macos", "tdesktop", "unigram", "webk", "weba", "web"].includes(t))
2225
2237
  r = !0, i = window.innerHeight, o = window.innerWidth, a = window.innerHeight;
2226
2238
  else {
2227
- const u = await Wt({ timeout: 1e3, postEvent: s });
2239
+ const u = await Ft({ timeout: 1e3, postEvent: s });
2228
2240
  r = u.isExpanded, i = u.height, o = u.width, a = u.isStateStable ? i : 0;
2229
2241
  }
2230
- const p = new Ps({
2242
+ const h = new Es({
2231
2243
  postEvent: s,
2232
2244
  height: i,
2233
2245
  width: o,
2234
2246
  stableHeight: a,
2235
2247
  isExpanded: r
2236
2248
  });
2237
- return n(p.listen()), p;
2249
+ return n(h.listen()), h;
2238
2250
  }
2239
2251
  );
2240
2252
  function E(e, t) {
2241
2253
  document.documentElement.style.setProperty(e, t);
2242
2254
  }
2243
- function tn(e, t, s) {
2255
+ function Xs(e, t, s) {
2244
2256
  s || (s = (a) => `--tg-${a}-color`);
2245
2257
  const n = s("header"), r = s("bg"), i = () => {
2246
2258
  const { headerColor: a } = e;
2247
- if (tt(a))
2259
+ if (et(a))
2248
2260
  E(n, a);
2249
2261
  else {
2250
- const { bgColor: p, secondaryBgColor: u } = t;
2251
- a === "bg_color" && p ? E(n, p) : a === "secondary_bg_color" && u && E(n, u);
2262
+ const { bgColor: h, secondaryBgColor: u } = t;
2263
+ a === "bg_color" && h ? E(n, h) : a === "secondary_bg_color" && u && E(n, u);
2252
2264
  }
2253
2265
  E(r, e.bgColor);
2254
2266
  }, o = [
@@ -2257,7 +2269,7 @@ function tn(e, t, s) {
2257
2269
  ];
2258
2270
  return i(), () => o.forEach((a) => a());
2259
2271
  }
2260
- function en(e, t) {
2272
+ function tn(e, t) {
2261
2273
  t || (t = (n) => `--tg-theme-${n.replace(/[A-Z]/g, (r) => `-${r.toLowerCase()}`)}`);
2262
2274
  const s = () => {
2263
2275
  Object.entries(e.getState()).forEach(([n, r]) => {
@@ -2266,23 +2278,23 @@ function en(e, t) {
2266
2278
  };
2267
2279
  return s(), e.on("change", s);
2268
2280
  }
2269
- function sn(e, t) {
2281
+ function en(e, t) {
2270
2282
  t || (t = (u) => `--tg-viewport-${u}`);
2271
2283
  const [
2272
2284
  s,
2273
2285
  n,
2274
2286
  r
2275
- ] = ["height", "width", "stable-height"].map((u) => t(u)), i = () => E(s, `${e.height}px`), o = () => E(n, `${e.width}px`), a = () => E(r, `${e.stableHeight}px`), p = [
2287
+ ] = ["height", "width", "stable-height"].map((u) => t(u)), i = () => E(s, `${e.height}px`), o = () => E(n, `${e.width}px`), a = () => E(r, `${e.stableHeight}px`), h = [
2276
2288
  e.on("change:height", i),
2277
2289
  e.on("change:width", o),
2278
2290
  e.on("change:stableHeight", a)
2279
2291
  ];
2280
- return i(), o(), a(), () => p.forEach((u) => u());
2292
+ return i(), o(), a(), () => h.forEach((u) => u());
2281
2293
  }
2282
- function Cs(e = !0) {
2294
+ function xs(e = !0) {
2283
2295
  const t = [
2284
2296
  v("reload_iframe", () => {
2285
- k("iframe_will_reload"), window.location.reload();
2297
+ q("iframe_will_reload"), window.location.reload();
2286
2298
  })
2287
2299
  ], s = () => t.forEach((n) => n());
2288
2300
  if (e) {
@@ -2294,25 +2306,65 @@ function Cs(e = !0) {
2294
2306
  () => document.head.removeChild(n)
2295
2307
  );
2296
2308
  }
2297
- return k("iframe_ready", { reload_supported: !0 }), s;
2309
+ return q("iframe_ready", { reload_supported: !0 }), s;
2298
2310
  }
2299
- function nn() {
2311
+ function sn() {
2300
2312
  return typeof window > "u";
2301
2313
  }
2302
- async function rn() {
2303
- if (Et(window))
2314
+ async function nn() {
2315
+ if (Rt(window))
2304
2316
  return !0;
2305
2317
  try {
2306
- return await m({ method: "web_app_request_theme", event: "theme_changed", timeout: 100 }), !0;
2318
+ return await w({ method: "web_app_request_theme", event: "theme_changed", timeout: 100 }), !0;
2307
2319
  } catch {
2308
2320
  return !1;
2309
2321
  }
2310
2322
  }
2311
- function Ss(e) {
2323
+ function rn(e) {
2324
+ const t = typeof e == "string" ? ot(e) : e;
2325
+ jt(t);
2326
+ function s(r) {
2327
+ if (typeof r == "string")
2328
+ try {
2329
+ const { eventType: i } = St(r);
2330
+ i === "web_app_request_theme" && Y("theme_changed", {
2331
+ theme_params: JSON.parse(Wt(t.themeParams))
2332
+ }), i === "web_app_request_viewport" && Y("viewport_changed", {
2333
+ width: window.innerWidth,
2334
+ height: window.innerHeight,
2335
+ is_state_stable: !0,
2336
+ is_expanded: !0
2337
+ });
2338
+ } catch {
2339
+ }
2340
+ }
2341
+ if (st()) {
2342
+ const r = window.parent.postMessage.bind(window.parent);
2343
+ window.parent.postMessage = (i) => {
2344
+ s(i), r(i);
2345
+ };
2346
+ return;
2347
+ }
2348
+ if (Tt(window)) {
2349
+ const r = window.external.notify.bind(window.external);
2350
+ window.external.notify = (i) => {
2351
+ s(i), r(i);
2352
+ };
2353
+ return;
2354
+ }
2355
+ const n = window.TelegramWebviewProxy;
2356
+ window.TelegramWebviewProxy = {
2357
+ ...n || {},
2358
+ postEvent(...r) {
2359
+ s(JSON.stringify({ eventType: r[0], eventData: r[1] })), n && n.postEvent(...r);
2360
+ }
2361
+ };
2362
+ }
2363
+ function Cs(e) {
2312
2364
  return e instanceof $;
2313
2365
  }
2314
2366
  function on(e, t) {
2315
- return Ss(e) && e.type === t;
2367
+ return Cs(e) && e.type === t;
2316
2368
  }
2317
2369
  function j(e, t) {
2318
2370
  let s, n, r;
@@ -2322,13 +2374,13 @@ function j(e, t) {
2322
2374
  params: n
2323
2375
  });
2324
2376
  }
2325
- class Rs {
2326
- constructor(t, s, n = k) {
2327
- if (c(this, "history"), c(this, "ee", new B()), c(this, "attached", !1), c(this, "back", () => this.go(-1)), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this._index = s, this.postEvent = n, t.length === 0)
2328
- throw w(ue, "History should not be empty.");
2377
+ class Ss {
2378
+ constructor(t, s, n = q) {
2379
+ if (c(this, "history"), c(this, "ee", new O()), c(this, "attached", !1), c(this, "back", () => this.go(-1)), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this._index = s, this.postEvent = n, t.length === 0)
2380
+ throw m(we, "History should not be empty.");
2329
2381
  if (s < 0 || s >= t.length)
2330
- throw w(
2331
- le,
2382
+ throw m(
2383
+ me,
2332
2384
  "Index should not be zero and higher or equal than history size."
2333
2385
  );
2334
2386
  this.history = t.map((r) => j(r, ""));
@@ -2350,7 +2402,7 @@ class Rs {
2350
2402
  * Prevents current navigator from controlling the BackButton visibility state.
2351
2403
  */
2352
2404
  detach() {
2353
- this.attached = !1, H("back_button_pressed", this.back);
2405
+ this.attached = !1, U("back_button_pressed", this.back);
2354
2406
  }
2355
2407
  /**
2356
2408
  * Goes to the next history item.
@@ -2449,29 +2501,29 @@ function G({
2449
2501
  }) {
2450
2502
  return { ...e || { hash: "", search: "" }, ...t };
2451
2503
  }
2452
- function O(e, t) {
2504
+ function k(e, t) {
2453
2505
  return e.startsWith(t) ? e : `${t}${e}`;
2454
2506
  }
2455
- function V(e) {
2507
+ function M(e) {
2456
2508
  return new URL(
2457
- typeof e == "string" ? e : `${e.pathname || ""}${O(e.search || "", "?")}${O(e.hash || "", "#")}`,
2509
+ typeof e == "string" ? e : `${e.pathname || ""}${k(e.search || "", "?")}${k(e.hash || "", "#")}`,
2458
2510
  "http://a"
2459
2511
  );
2460
2512
  }
2461
- function M(e) {
2462
- const t = typeof e == "string" ? e.startsWith("/") : !!(e.pathname && e.pathname.startsWith("/")), s = V(e);
2513
+ function B(e) {
2514
+ const t = typeof e == "string" ? e.startsWith("/") : !!(e.pathname && e.pathname.startsWith("/")), s = M(e);
2463
2515
  return `${t ? s.pathname : s.pathname.slice(1)}${s.search}${s.hash}`;
2464
2516
  }
2465
2517
  function K(e, t, s) {
2466
2518
  let n, r;
2467
- typeof e == "string" ? n = e : (n = M(e), s = e.state, r = e.id);
2468
- const { pathname: i, search: o, hash: a } = new URL(n, `http://a${O(t, "/")}`);
2519
+ typeof e == "string" ? n = e : (n = B(e), s = e.state, r = e.id);
2520
+ const { pathname: i, search: o, hash: a } = new URL(n, `http://a${k(t, "/")}`);
2469
2521
  return { id: r, pathname: i, params: { hash: a, search: o, state: s } };
2470
2522
  }
2471
2523
  async function I(e) {
2472
2524
  return e === 0 ? !0 : Promise.race([
2473
2525
  new Promise((t) => {
2474
- const s = F("popstate", () => {
2526
+ const s = Q("popstate", () => {
2475
2527
  s(), t(!0);
2476
2528
  });
2477
2529
  window.history.go(e);
@@ -2489,32 +2541,32 @@ async function Ts() {
2489
2541
  for (; e; )
2490
2542
  e = await I(-1);
2491
2543
  }
2492
- function jt(e) {
2493
- return V(e).pathname;
2544
+ function Qt(e) {
2545
+ return M(e).pathname;
2494
2546
  }
2495
- const _t = 0, z = 1, J = 2;
2496
- class Gt {
2547
+ const wt = 0, z = 1, J = 2;
2548
+ class Yt {
2497
2549
  constructor(t, s, { postEvent: n, hashMode: r = "classic", base: i } = {}) {
2498
- c(this, "navigator"), c(this, "ee", new B()), c(this, "hashMode"), c(this, "base"), c(this, "attached", !1), c(this, "onPopState", ({ state: o }) => {
2550
+ c(this, "navigator"), c(this, "ee", new O()), c(this, "hashMode"), c(this, "base"), c(this, "attached", !1), c(this, "onPopState", ({ state: o }) => {
2499
2551
  if (o === null)
2500
2552
  return this.push(this.parsePath(window.location.href));
2501
- o === _t ? window.history.forward() : o === z && this.back(), o === J && this.forward();
2553
+ o === wt ? window.history.forward() : o === z && this.back(), o === J && this.forward();
2502
2554
  }), c(this, "onNavigatorChange", async ({
2503
2555
  to: o,
2504
2556
  from: a,
2505
- delta: p
2557
+ delta: h
2506
2558
  }) => {
2507
2559
  this.attached && await this.syncHistory(), this.ee.emit("change", {
2508
- delta: p,
2560
+ delta: h,
2509
2561
  from: G(a),
2510
2562
  to: G(o),
2511
2563
  navigator: this
2512
2564
  });
2513
- }), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this.navigator = new Rs(
2565
+ }), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this.navigator = new Ss(
2514
2566
  t.map((o) => K(o, "/")),
2515
2567
  s,
2516
2568
  n
2517
- ), this.navigator.on("change", this.onNavigatorChange), this.hashMode = r, this.base = jt(i || "");
2569
+ ), this.navigator.on("change", this.onNavigatorChange), this.hashMode = r, this.base = Qt(i || "");
2518
2570
  }
2519
2571
  /**
2520
2572
  * Attaches current navigator to the browser history allowing navigator to manipulate it.
@@ -2612,7 +2664,7 @@ class Gt {
2612
2664
  * "/pathname?search#hash"
2613
2665
  */
2614
2666
  get path() {
2615
- return M(this);
2667
+ return B(this);
2616
2668
  }
2617
2669
  /**
2618
2670
  * Current pathname. Always starts with the slash.
@@ -2641,8 +2693,8 @@ class Gt {
2641
2693
  * // { pathname: '/tma', search: '?is=cool', hash: '#yeah' }
2642
2694
  */
2643
2695
  parsePath(t) {
2644
- let s = V(t);
2645
- return this.hashMode && (s = V(s.hash.slice(1))), {
2696
+ let s = M(t);
2697
+ return this.hashMode && (s = M(s.hash.slice(1))), {
2646
2698
  pathname: s.pathname,
2647
2699
  search: s.search,
2648
2700
  hash: s.hash
@@ -2662,8 +2714,8 @@ class Gt {
2662
2714
  * @param value - path presented as string or URLLike.
2663
2715
  */
2664
2716
  renderPath(t) {
2665
- const s = (this.base.length === 1 ? "" : this.base) + O(M(t), "/");
2666
- return this.hashMode ? O(s.slice(1), this.hashMode === "classic" ? "#" : "#/") : s;
2717
+ const s = (this.base.length === 1 ? "" : this.base) + k(B(t), "/");
2718
+ return this.hashMode ? k(s.slice(1), this.hashMode === "classic" ? "#" : "#/") : s;
2667
2719
  }
2668
2720
  /**
2669
2721
  * Synchronizes current navigator state with browser history.
@@ -2671,7 +2723,7 @@ class Gt {
2671
2723
  async syncHistory() {
2672
2724
  window.removeEventListener("popstate", this.onPopState);
2673
2725
  const { state: t } = this, s = this.renderPath(this);
2674
- await Ts(), this.hasPrev && this.hasNext ? (window.history.replaceState(z, ""), window.history.pushState(t, "", s), window.history.pushState(J, ""), await I(-1)) : this.hasPrev ? (window.history.replaceState(z, ""), window.history.pushState(t, "", s)) : this.hasNext ? (window.history.replaceState(t, s), window.history.pushState(J, ""), await I(-1)) : (window.history.replaceState(_t, ""), window.history.pushState(t, "", s)), window.addEventListener("popstate", this.onPopState);
2726
+ await Ts(), this.hasPrev && this.hasNext ? (window.history.replaceState(z, ""), window.history.pushState(t, "", s), window.history.pushState(J, ""), await I(-1)) : this.hasPrev ? (window.history.replaceState(z, ""), window.history.pushState(t, "", s)) : this.hasNext ? (window.history.replaceState(t, s), window.history.pushState(J, ""), await I(-1)) : (window.history.replaceState(wt, ""), window.history.pushState(t, "", s)), window.addEventListener("popstate", this.onPopState);
2675
2727
  }
2676
2728
  /**
2677
2729
  * Current query parameters.
@@ -2689,121 +2741,121 @@ class Gt {
2689
2741
  return (this.navigator.current.params || {}).state;
2690
2742
  }
2691
2743
  }
2692
- function As(e) {
2744
+ function Rs(e) {
2693
2745
  e || (e = {});
2694
2746
  const { href: t, hash: s } = window.location;
2695
- let n = M(
2747
+ let n = B(
2696
2748
  e.hashMode === null ? t : s.includes("?") ? s.slice(1) : `?${s.slice(1)}`
2697
2749
  );
2698
- const r = e.base ? jt(e.base) : void 0;
2750
+ const r = e.base ? Qt(e.base) : void 0;
2699
2751
  if (r) {
2700
2752
  if (!n.startsWith(r))
2701
- throw w(
2702
- de,
2753
+ throw m(
2754
+ be,
2703
2755
  `Path "${n}" expected to be starting with "${r}"`
2704
2756
  );
2705
2757
  n = n.slice(r.length);
2706
2758
  }
2707
- return new Gt([n], 0, e);
2759
+ return new Yt([n], 0, e);
2708
2760
  }
2709
2761
  function an(e) {
2710
2762
  const t = e.match(/#(.+)/);
2711
2763
  return t ? t[1] : null;
2712
2764
  }
2713
- function Is(e, t) {
2714
- if ($t()) {
2765
+ function As(e, t) {
2766
+ if (Gt()) {
2715
2767
  const s = sessionStorage.getItem(e);
2716
2768
  if (s)
2717
2769
  try {
2718
2770
  const { index: n, history: r } = JSON.parse(s);
2719
- return new Gt(r, n, t);
2771
+ return new Yt(r, n, t);
2720
2772
  } catch (n) {
2721
2773
  console.error("Unable to restore hash navigator state.", n);
2722
2774
  }
2723
2775
  }
2724
- return As(t);
2776
+ return Rs(t);
2725
2777
  }
2726
2778
  function cn(e, t) {
2727
- const s = Is(e, t), n = () => sessionStorage.setItem(e, JSON.stringify({
2779
+ const s = As(e, t), n = () => sessionStorage.setItem(e, JSON.stringify({
2728
2780
  index: s.index,
2729
2781
  history: s.history
2730
2782
  }));
2731
2783
  return s.on("change", n), n(), s;
2732
2784
  }
2733
2785
  function _(e) {
2734
- return (t, s, ...n) => (r) => gt(s, at(() => at({
2786
+ return (t, s, ...n) => (r) => mt(s, pt(() => pt({
2735
2787
  [t]: e(...n)
2736
2788
  }, r)));
2737
2789
  }
2738
- const Kt = Qt();
2739
- function ks() {
2740
- const e = Ft(Kt);
2790
+ const Zt = ee();
2791
+ function Is() {
2792
+ const e = se(Zt);
2741
2793
  if (!e)
2742
2794
  throw new Error("useSDK was used outside of SDKProvider.");
2743
2795
  return e;
2744
2796
  }
2745
2797
  function g(e) {
2746
2798
  return (...t) => {
2747
- const s = ks()(e, ...t), n = () => s.signal();
2799
+ const s = Is()(e, ...t), n = () => s.signal();
2748
2800
  return Object.defineProperty(n, "error", () => s.error), n;
2749
2801
  };
2750
2802
  }
2751
- const Os = g(We), hn = _(Os), qs = g(Ke), pn = _(qs), Ds = g(Je), un = _(Ds), Ns = g(Xe), ln = _(Ns), Vs = g(es), dn = _(Vs), Ms = g(ns), _n = _(Ms), Bs = g(is), gn = _(Bs), $s = g(as), fn = _($s), Ls = g(us), mn = _(Ls), Us = g(_s), wn = _(Us), Hs = g(fs), bn = _(Hs), Ws = g(ws), vn = _(Ws), js = g(vs), yn = _(js), Gs = g(Es), En = _(Gs), Ks = g(xs), Pn = _(Ks), xn = (e) => {
2803
+ const Os = g(Ue), hn = _(Os), qs = g(Ge), pn = _(qs), ks = g(ze), un = _(ks), Ns = g(Ze), dn = _(Ns), Ds = g(ts), ln = _(Ds), Vs = g(ss), _n = _(Vs), Ms = g(rs), gn = _(Ms), Bs = g(os), fn = _(Bs), $s = g(ps), wn = _($s), Ls = g(ls), mn = _(Ls), Hs = g(gs), bn = _(Hs), Us = g(ws), vn = _(Us), Ws = g(bs), yn = _(Ws), js = g(ys), En = _(js), Gs = g(Ps), Pn = _(Gs), xn = (e) => {
2752
2804
  const t = /* @__PURE__ */ new Map(), s = (n, ...r) => {
2753
2805
  if (t.has(n))
2754
2806
  return t.get(n);
2755
- function i(l) {
2756
- return t.set(n, l), l;
2807
+ function i(d) {
2808
+ return t.set(n, d), d;
2757
2809
  }
2758
2810
  let o;
2759
2811
  try {
2760
2812
  o = n(...r);
2761
- } catch (l) {
2813
+ } catch (d) {
2762
2814
  return i({
2763
- error: l,
2815
+ error: d,
2764
2816
  signal: () => {
2765
- throw l;
2817
+ throw d;
2766
2818
  }
2767
2819
  });
2768
2820
  }
2769
2821
  let a;
2770
2822
  Array.isArray(o) && ([o, a] = o);
2771
- const [p] = Yt(() => o), u = pt(() => {
2772
- if (p.state !== "ready")
2823
+ const [h] = ne(() => o), u = lt(() => {
2824
+ if (h.state !== "ready")
2773
2825
  return;
2774
- const l = p();
2775
- if (!l || !("on" in l))
2776
- return l;
2777
- const zt = Zt((N) => (N(l), l.on("change", () => N(l)))), Jt = Object.getPrototypeOf(l), W = {};
2778
- return new Proxy(l, {
2779
- get(N, x) {
2780
- if (!(x in W)) {
2781
- const ot = Reflect.getOwnPropertyDescriptor(Jt, x);
2782
- W[x] = ot && "get" in ot ? pt(() => zt()[x]) : () => Reflect.get(N, x);
2826
+ const d = h();
2827
+ if (!d || !("on" in d))
2828
+ return d;
2829
+ const Xt = re((V) => (V(d), d.on("change", () => V(d)))), te = Object.getPrototypeOf(d), W = {};
2830
+ return new Proxy(d, {
2831
+ get(V, C) {
2832
+ if (!(C in W)) {
2833
+ const ht = Reflect.getOwnPropertyDescriptor(te, C);
2834
+ W[C] = ht && "get" in ht ? lt(() => Xt()[C]) : () => Reflect.get(V, C);
2783
2835
  }
2784
- return W[x]();
2836
+ return W[C]();
2785
2837
  }
2786
2838
  });
2787
2839
  });
2788
2840
  return i({
2789
2841
  signal() {
2790
- if (p.error)
2791
- throw p.error;
2842
+ if (h.error)
2843
+ throw h.error;
2792
2844
  return u();
2793
2845
  },
2794
2846
  get error() {
2795
- return p.error;
2847
+ return h.error;
2796
2848
  },
2797
2849
  cleanup: a
2798
2850
  });
2799
2851
  };
2800
- return ct(() => {
2801
- ne(e.debug || !1);
2802
- }), ct(() => {
2803
- Pt() && ht(Cs(e.acceptCustomStyles));
2804
- }), ht(() => {
2852
+ return ut(() => {
2853
+ he(e.debug || !1);
2854
+ }), ut(() => {
2855
+ st() && dt(xs(e.acceptCustomStyles));
2856
+ }), dt(() => {
2805
2857
  t.forEach((n) => n.cleanup && n.cleanup());
2806
- }), gt(Kt.Provider, {
2858
+ }), mt(Zt.Provider, {
2807
2859
  value: s,
2808
2860
  get children() {
2809
2861
  return e.children;
@@ -2811,137 +2863,138 @@ const Os = g(We), hn = _(Os), qs = g(Ke), pn = _(qs), Ds = g(Je), un = _(Ds), Ns
2811
2863
  });
2812
2864
  };
2813
2865
  export {
2814
- Ae as BackButton,
2815
- Rs as BasicNavigator,
2816
- je as BiometryManager,
2817
- Gt as BrowserNavigator,
2818
- ze as ClosingBehavior,
2819
- Ze as CloudStorage,
2820
- de as ERR_INVALID_PATH_BASE,
2821
- ce as ERR_INVOKE_CUSTOM_METHOD_RESPONSE,
2822
- oe as ERR_METHOD_PARAMETER_UNSUPPORTED,
2823
- ie as ERR_METHOD_UNSUPPORTED,
2824
- ue as ERR_NAVIGATION_HISTORY_EMPTY,
2825
- le as ERR_NAVIGATION_INDEX_INVALID,
2826
- Js as ERR_NAVIGATION_ITEM_INVALID,
2827
- wt as ERR_PARSE,
2828
- Qs as ERR_SSR_INIT,
2829
- he as ERR_TIMED_OUT,
2830
- pe as ERR_UNEXPECTED_TYPE,
2831
- ae as ERR_UNKNOWN_ENV,
2832
- B as EventEmitter,
2833
- ts as HapticFeedback,
2834
- ss as InitData,
2835
- rs as Invoice,
2836
- os as MainButton,
2837
- ps as MiniApp,
2866
+ Oe as BackButton,
2867
+ Ss as BasicNavigator,
2868
+ We as BiometryManager,
2869
+ Yt as BrowserNavigator,
2870
+ Ke as ClosingBehavior,
2871
+ Ye as CloudStorage,
2872
+ be as ERR_INVALID_PATH_BASE,
2873
+ _e as ERR_INVOKE_CUSTOM_METHOD_RESPONSE,
2874
+ de as ERR_METHOD_PARAMETER_UNSUPPORTED,
2875
+ ue as ERR_METHOD_UNSUPPORTED,
2876
+ we as ERR_NAVIGATION_HISTORY_EMPTY,
2877
+ me as ERR_NAVIGATION_INDEX_INVALID,
2878
+ zs as ERR_NAVIGATION_ITEM_INVALID,
2879
+ Et as ERR_PARSE,
2880
+ Js as ERR_SSR_INIT,
2881
+ ge as ERR_TIMED_OUT,
2882
+ fe as ERR_UNEXPECTED_TYPE,
2883
+ le as ERR_UNKNOWN_ENV,
2884
+ O as EventEmitter,
2885
+ Xe as HapticFeedback,
2886
+ es as InitData,
2887
+ ns as Invoice,
2888
+ is as MainButton,
2889
+ hs as MiniApp,
2838
2890
  ds as Popup,
2839
- gs as QRScanner,
2891
+ _s as QRScanner,
2840
2892
  $ as SDKError,
2841
2893
  xn as SDKProvider,
2842
- ms as SettingsButton,
2843
- bs as ThemeParams,
2844
- ys as Utils,
2845
- Ps as Viewport,
2846
- Ye as array,
2847
- tn as bindMiniAppCSSVars,
2848
- en as bindThemeParamsCSSVars,
2849
- sn as bindViewportCSSVars,
2894
+ fs as SettingsButton,
2895
+ ms as ThemeParams,
2896
+ vs as Utils,
2897
+ Es as Viewport,
2898
+ Qe as array,
2899
+ Xs as bindMiniAppCSSVars,
2900
+ tn as bindThemeParamsCSSVars,
2901
+ en as bindViewportCSSVars,
2850
2902
  y as boolean,
2851
- Ct as captureSameReq,
2852
- Y as classNames,
2853
- xe as compareVersions,
2854
- As as createBrowserNavigatorFromLocation,
2855
- Re as createPostEvent,
2856
- V as createSafeURL,
2857
- It as date,
2903
+ It as captureSameReq,
2904
+ Z as classNames,
2905
+ Te as compareVersions,
2906
+ Rs as createBrowserNavigatorFromLocation,
2907
+ Ae as createPostEvent,
2908
+ M as createSafeURL,
2909
+ Dt as date,
2858
2910
  an as getHash,
2859
- jt as getPathname,
2860
- We as initBackButton,
2861
- Ke as initBiometryManager,
2862
- Je as initClosingBehavior,
2863
- Xe as initCloudStorage,
2864
- es as initHapticFeedback,
2865
- ns as initInitData,
2866
- is as initInvoice,
2867
- as as initMainButton,
2868
- us as initMiniApp,
2911
+ Qt as getPathname,
2912
+ Ue as initBackButton,
2913
+ Ge as initBiometryManager,
2914
+ ze as initClosingBehavior,
2915
+ Ze as initCloudStorage,
2916
+ ts as initHapticFeedback,
2917
+ ss as initInitData,
2918
+ rs as initInvoice,
2919
+ os as initMainButton,
2920
+ ps as initMiniApp,
2869
2921
  cn as initNavigator,
2870
- _s as initPopup,
2871
- fs as initQRScanner,
2922
+ ls as initPopup,
2923
+ gs as initQRScanner,
2872
2924
  ws as initSettingsButton,
2873
- vs as initThemeParams,
2874
- Es as initUtils,
2875
- xs as initViewport,
2876
- Cs as initWeb,
2925
+ bs as initThemeParams,
2926
+ ys as initUtils,
2927
+ Ps as initViewport,
2928
+ xs as initWeb,
2877
2929
  A as invokeCustomMethod,
2878
- Tt as isColorDark,
2879
- Pt as isIframe,
2880
- $t as isPageReload,
2881
- tt as isRGB,
2882
- _e as isRGBShort,
2883
- Ss as isSDKError,
2930
+ kt as isColorDark,
2931
+ st as isIframe,
2932
+ Gt as isPageReload,
2933
+ et as isRGB,
2934
+ ve as isRGBShort,
2935
+ Cs as isSDKError,
2884
2936
  on as isSDKErrorOfType,
2885
- nn as isSSR,
2886
- rn as isTMA,
2937
+ sn as isSSR,
2938
+ nn as isTMA,
2887
2939
  f as json,
2888
- Ys as mergeClassNames,
2940
+ Qs as mergeClassNames,
2941
+ rn as mockTelegramEnv,
2889
2942
  P as number,
2890
- H as off,
2943
+ U as off,
2891
2944
  v as on,
2892
- Zs as parseInitData,
2893
- qt as parseLaunchParams,
2894
- Ht as parseThemeParams,
2895
- k as postEvent,
2896
- m as request,
2897
- Ge as requestBiometryInfo,
2898
- Xs as requestThemeParams,
2899
- Wt as requestViewport,
2945
+ Ys as parseInitData,
2946
+ ot as parseLaunchParams,
2947
+ Jt as parseThemeParams,
2948
+ q as postEvent,
2949
+ w as request,
2950
+ je as requestBiometryInfo,
2951
+ Zs as requestThemeParams,
2952
+ Ft as requestViewport,
2900
2953
  $e as retrieveLaunchParams,
2901
- yt as rgb,
2902
- nt as searchParams,
2903
- Me as serializeLaunchParams,
2904
- Ve as serializeThemeParams,
2954
+ Ct as rgb,
2955
+ it as searchParams,
2956
+ Be as serializeLaunchParams,
2957
+ Wt as serializeThemeParams,
2905
2958
  E as setCSSVar,
2906
- ne as setDebug,
2959
+ he as setDebug,
2907
2960
  Fs as setTargetOrigin,
2908
- h as string,
2909
- ee as subscribe,
2910
- C as supports,
2911
- Se as targetOrigin,
2912
- vt as toRGB,
2913
- mt as unsubscribe,
2914
- M as urlToPath,
2961
+ p as string,
2962
+ ae as subscribe,
2963
+ x as supports,
2964
+ Re as targetOrigin,
2965
+ xt as toRGB,
2966
+ vt as unsubscribe,
2967
+ B as urlToPath,
2915
2968
  Os as useBackButton,
2916
2969
  qs as useBiometryManager,
2917
- Ds as useClosingBehavior,
2970
+ ks as useClosingBehavior,
2918
2971
  Ns as useCloudStorage,
2919
- Vs as useHapticFeedback,
2920
- Ms as useInitData,
2921
- Bs as useInvoice,
2922
- $s as useMainButton,
2923
- Ls as useMiniApp,
2924
- Us as usePopup,
2972
+ Ds as useHapticFeedback,
2973
+ Vs as useInitData,
2974
+ Ms as useInvoice,
2975
+ Bs as useMainButton,
2976
+ $s as useMiniApp,
2977
+ Ls as usePopup,
2925
2978
  Hs as useQRScanner,
2926
- ks as useSDK,
2927
- Ws as useSettingsButton,
2928
- js as useThemeParams,
2929
- Gs as useUtils,
2930
- Ks as useViewport,
2979
+ Is as useSDK,
2980
+ Us as useSettingsButton,
2981
+ Ws as useThemeParams,
2982
+ js as useUtils,
2983
+ Gs as useViewport,
2931
2984
  hn as withBackButton,
2932
2985
  pn as withBiometryManager,
2933
2986
  un as withClosingBehavior,
2934
- ln as withCloudStorage,
2935
- dn as withHapticFeedback,
2987
+ dn as withCloudStorage,
2988
+ ln as withHapticFeedback,
2936
2989
  _n as withInitData,
2937
2990
  gn as withInvoice,
2938
2991
  fn as withMainButton,
2939
- mn as withMiniApp,
2940
- wn as withPopup,
2992
+ wn as withMiniApp,
2993
+ mn as withPopup,
2941
2994
  bn as withQRScanner,
2942
2995
  vn as withSettingsButton,
2943
2996
  yn as withThemeParams,
2944
- Rt as withTimeout,
2997
+ qt as withTimeout,
2945
2998
  En as withUtils,
2946
2999
  Pn as withViewport
2947
3000
  };