@tma.js/sdk-react 2.1.3 → 2.2.0

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