@tma.js/sdk-solid 2.1.1 → 2.1.3

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 mt, mergeProps as ht, createContext as Ft, useContext as Yt, createEffect as pt, onCleanup as Zt, createResource as Xt, createMemo as ut, from as te } from "solid-js";
2
- var ee = Object.defineProperty, se = (e, t, s) => t in e ? ee(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, c = (e, t, s) => (se(e, typeof t != "symbol" ? t + "" : t, s), s);
3
- function wt(e, t) {
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) {
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 bt(e) {
11
- const t = W(), { count: s } = t;
12
- t.unsubscribe(e), s && !t.count && Ce();
10
+ function mt(e) {
11
+ const t = U(), { count: s } = t;
12
+ t.unsubscribe(e), s && !t.count && Pe();
13
13
  }
14
- function ne(e) {
15
- return W().subscribe(e), () => bt(e);
14
+ function ee(e) {
15
+ return U().subscribe(e), () => mt(e);
16
16
  }
17
- class re {
17
+ class se {
18
18
  constructor(t, s = {}) {
19
19
  this.scope = t, this.options = s;
20
20
  }
@@ -54,21 +54,21 @@ class re {
54
54
  this.print("log", ...t);
55
55
  }
56
56
  }
57
- const $ = new re("SDK", {
57
+ const Z = new se("SDK", {
58
58
  bgColor: "forestgreen",
59
59
  textColor: "white"
60
60
  });
61
- let Y = !1;
62
- const dt = ({ event: e, args: [t] }) => {
63
- $.log("Event received:", t === void 0 ? { name: e } : { name: e, data: t });
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 });
64
64
  };
65
- function ie(e) {
66
- Y !== e && (Y = e, e ? ne(dt) : bt(dt));
65
+ function ne(e) {
66
+ Q !== e && (Q = e, e ? ee(ut) : mt(ut));
67
67
  }
68
- function oe(...e) {
69
- Y && $.log(...e);
68
+ function re(...e) {
69
+ Q && Z.log(...e);
70
70
  }
71
- class L {
71
+ class B {
72
72
  constructor() {
73
73
  c(this, "listeners", /* @__PURE__ */ new Map()), c(this, "listenersCount", 0), c(this, "subscribeListeners", []);
74
74
  }
@@ -138,22 +138,22 @@ class L {
138
138
  }
139
139
  }
140
140
  }
141
- function Z(e, t, s) {
141
+ function F(e, t, s) {
142
142
  return window.addEventListener(e, t, s), () => window.removeEventListener(e, t, s);
143
143
  }
144
- class U extends Error {
144
+ class $ extends Error {
145
145
  constructor(t, s, n) {
146
- super(s, { cause: n }), this.type = t, Object.setPrototypeOf(this, U.prototype);
146
+ super(s, { cause: n }), this.type = t, Object.setPrototypeOf(this, $.prototype);
147
147
  }
148
148
  }
149
- function d(e, t, s) {
150
- return new U(e, t, s);
149
+ function w(e, t, s) {
150
+ return new $(e, t, s);
151
151
  }
152
- const ae = "ERR_METHOD_UNSUPPORTED", ce = "ERR_METHOD_PARAMETER_UNSUPPORTED", he = "ERR_UNKNOWN_ENV", pe = "ERR_INVOKE_CUSTOM_METHOD_RESPONSE", ue = "ERR_TIMED_OUT", de = "ERR_UNEXPECTED_TYPE", vt = "ERR_PARSE", le = "ERR_NAVIGATION_LIST_EMPTY", _e = "ERR_NAVIGATION_CURSOR_INVALID", Fs = "ERR_NAVIGATION_ITEM_INVALID", tt = "ERR_SSR_INIT", ge = "ERR_SSR_POST_EVENT", fe = "ERR_INVALID_PATH_BASE";
153
- function C() {
154
- return d(de, "Value has unexpected type");
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";
153
+ function S() {
154
+ return w(pe, "Value has unexpected type");
155
155
  }
156
- class H {
156
+ class L {
157
157
  constructor(t, s, n) {
158
158
  this.parser = t, this.isOptional = s, this.type = n;
159
159
  }
@@ -168,8 +168,8 @@ class H {
168
168
  try {
169
169
  return this.parser(t);
170
170
  } catch (s) {
171
- throw d(
172
- vt,
171
+ throw w(
172
+ wt,
173
173
  `Unable to parse value${this.type ? ` as ${this.type}` : ""}`,
174
174
  s
175
175
  );
@@ -180,9 +180,9 @@ class H {
180
180
  }
181
181
  }
182
182
  function R(e, t) {
183
- return () => new H(e, !1, t);
183
+ return () => new L(e, !1, t);
184
184
  }
185
- const v = R((e) => {
185
+ const y = R((e) => {
186
186
  if (typeof e == "boolean")
187
187
  return e;
188
188
  const t = String(e);
@@ -190,9 +190,9 @@ const v = R((e) => {
190
190
  return !0;
191
191
  if (t === "0" || t === "false")
192
192
  return !1;
193
- throw C();
193
+ throw S();
194
194
  }, "boolean");
195
- function yt(e, t) {
195
+ function bt(e, t) {
196
196
  const s = {};
197
197
  for (const n in e) {
198
198
  const r = e[n];
@@ -209,24 +209,24 @@ function yt(e, t) {
209
209
  const a = o(t(i));
210
210
  a !== void 0 && (s[n] = a);
211
211
  } catch (a) {
212
- throw d(vt, `Unable to parse field "${n}"`, a);
212
+ throw w(wt, `Unable to parse field "${n}"`, a);
213
213
  }
214
214
  }
215
215
  return s;
216
216
  }
217
- function et(e) {
217
+ function X(e) {
218
218
  let t = e;
219
219
  if (typeof t == "string" && (t = JSON.parse(t)), typeof t != "object" || t === null || Array.isArray(t))
220
- throw C();
220
+ throw S();
221
221
  return t;
222
222
  }
223
223
  function f(e, t) {
224
- return new H((s) => {
225
- const n = et(s);
226
- return yt(e, (r) => n[r]);
224
+ return new L((s) => {
225
+ const n = X(s);
226
+ return bt(e, (r) => n[r]);
227
227
  }, !1, t);
228
228
  }
229
- const E = R((e) => {
229
+ const P = R((e) => {
230
230
  if (typeof e == "number")
231
231
  return e;
232
232
  if (typeof e == "string") {
@@ -234,19 +234,19 @@ const E = R((e) => {
234
234
  if (!Number.isNaN(t))
235
235
  return t;
236
236
  }
237
- throw C();
237
+ throw S();
238
238
  }, "number");
239
- function st(e) {
239
+ function tt(e) {
240
240
  return /^#[\da-f]{6}$/i.test(e);
241
241
  }
242
- function me(e) {
242
+ function _e(e) {
243
243
  return /^#[\da-f]{3}$/i.test(e);
244
244
  }
245
- function Et(e) {
245
+ function vt(e) {
246
246
  const t = e.replace(/\s/g, "").toLowerCase();
247
- if (st(t))
247
+ if (tt(t))
248
248
  return t;
249
- if (me(t)) {
249
+ if (_e(t)) {
250
250
  let n = "#";
251
251
  for (let r = 0; r < 3; r += 1)
252
252
  n += t[1 + r].repeat(2);
@@ -260,30 +260,30 @@ function Et(e) {
260
260
  return n + (i.length === 1 ? "0" : "") + i;
261
261
  }, "#");
262
262
  }
263
- const p = R((e) => {
263
+ const h = R((e) => {
264
264
  if (typeof e == "string" || typeof e == "number")
265
265
  return e.toString();
266
- throw C();
267
- }, "string"), Pt = R((e) => Et(p().parse(e)), "rgb");
268
- function we(e) {
266
+ throw S();
267
+ }, "string"), yt = R((e) => vt(h().parse(e)), "rgb");
268
+ function ge(e) {
269
269
  return f({
270
- eventType: p(),
270
+ eventType: h(),
271
271
  eventData: (t) => t
272
272
  }).parse(e);
273
273
  }
274
- function be() {
274
+ function fe() {
275
275
  ["TelegramGameProxy_receiveEvent", "TelegramGameProxy", "Telegram"].forEach((e) => {
276
276
  delete window[e];
277
277
  });
278
278
  }
279
- function ve(e, t) {
279
+ function me(e, t) {
280
280
  window.dispatchEvent(new MessageEvent("message", {
281
281
  data: JSON.stringify({ eventType: e, eventData: t }),
282
282
  // We specify window.parent to imitate the case, the parent iframe sent us this event.
283
283
  source: window.parent
284
284
  }));
285
285
  }
286
- function ye() {
286
+ function we() {
287
287
  [
288
288
  ["TelegramGameProxy_receiveEvent"],
289
289
  // Windows Phone.
@@ -295,66 +295,66 @@ function ye() {
295
295
  let t = window;
296
296
  e.forEach((s, n, r) => {
297
297
  if (n === r.length - 1) {
298
- t[s] = ve;
298
+ t[s] = me;
299
299
  return;
300
300
  }
301
301
  s in t || (t[s] = {}), t = t[s];
302
302
  });
303
303
  });
304
304
  }
305
- const Ee = f({
306
- button_id: (e) => e == null ? void 0 : p().parse(e)
307
- }), Pe = {
305
+ const be = f({
306
+ button_id: (e) => e == null ? void 0 : h().parse(e)
307
+ }), ve = {
308
308
  clipboard_text_received: f({
309
- req_id: p(),
310
- data: (e) => e === null ? e : p().optional().parse(e)
309
+ req_id: h(),
310
+ data: (e) => e === null ? e : h().optional().parse(e)
311
311
  }),
312
312
  custom_method_invoked: f({
313
- req_id: p(),
313
+ req_id: h(),
314
314
  result: (e) => e,
315
- error: p().optional()
315
+ error: h().optional()
316
316
  }),
317
317
  invoice_closed: f({
318
- slug: p(),
319
- status: p()
318
+ slug: h(),
319
+ status: h()
320
320
  }),
321
321
  phone_requested: f({
322
- status: p()
322
+ status: h()
323
323
  }),
324
324
  popup_closed: {
325
- parse: (e) => Ee.parse(e ?? {})
325
+ parse: (e) => be.parse(e ?? {})
326
326
  },
327
327
  qr_text_received: f({
328
- data: p().optional()
328
+ data: h().optional()
329
329
  }),
330
330
  theme_changed: f({
331
331
  theme_params: (e) => {
332
- const t = Pt().optional();
333
- return Object.entries(et(e)).reduce((s, [n, r]) => (s[n] = t.parse(r), s), {});
332
+ const t = yt().optional();
333
+ return Object.entries(X(e)).reduce((s, [n, r]) => (s[n] = t.parse(r), s), {});
334
334
  }
335
335
  }),
336
336
  viewport_changed: f({
337
- height: E(),
338
- width: (e) => e == null ? window.innerWidth : E().parse(e),
339
- is_state_stable: v(),
340
- is_expanded: v()
337
+ height: P(),
338
+ width: (e) => e == null ? window.innerWidth : P().parse(e),
339
+ is_state_stable: y(),
340
+ is_expanded: y()
341
341
  }),
342
342
  write_access_requested: f({
343
- status: p()
343
+ status: h()
344
344
  })
345
345
  };
346
- function xe() {
347
- const e = new L();
348
- ye();
346
+ function ye() {
347
+ const e = new B();
348
+ we();
349
349
  let t = [
350
350
  // Don't forget to remove created handlers.
351
- be,
351
+ fe,
352
352
  // Add "resize" event listener to make sure, we always have fresh viewport information.
353
353
  // Desktop version of Telegram is sometimes not sending the viewport_changed
354
354
  // event. For example, when the MainButton is shown. That's why we should
355
355
  // add our own listener to make sure, viewport information is always fresh.
356
356
  // Issue: https://github.com/Telegram-Mini-Apps/tma.js/issues/10
357
- Z("resize", () => {
357
+ F("resize", () => {
358
358
  e.emit("viewport_changed", {
359
359
  width: window.innerWidth,
360
360
  height: window.innerHeight,
@@ -364,21 +364,21 @@ function xe() {
364
364
  }),
365
365
  // Add listener, which handles events sent from the Telegram web application and also events
366
366
  // generated by the local emitEvent function.
367
- Z("message", (s) => {
367
+ F("message", (s) => {
368
368
  if (s.source !== window.parent)
369
369
  return;
370
370
  let n;
371
371
  try {
372
- n = we(s.data);
372
+ n = ge(s.data);
373
373
  } catch {
374
374
  return;
375
375
  }
376
- const { eventType: r, eventData: i } = n, o = Pe[r];
376
+ const { eventType: r, eventData: i } = n, o = ve[r];
377
377
  try {
378
378
  const a = o ? o.parse(i) : i;
379
379
  e.emit(...a ? [r, a] : [r]);
380
380
  } catch (a) {
381
- $.error(
381
+ Z.error(
382
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
383
  n,
384
384
  a
@@ -392,9 +392,9 @@ function xe() {
392
392
  t.forEach((s) => s()), t = [];
393
393
  }];
394
394
  }
395
- const [Se, Ce] = wt(
395
+ const [Ee, Pe] = ft(
396
396
  (e) => {
397
- const [t, s] = xe(), n = t.off.bind(t);
397
+ const [t, s] = ye(), n = t.off.bind(t);
398
398
  return t.off = (r, i) => {
399
399
  const { count: o } = t;
400
400
  n(r, i), o && !t.count && e();
@@ -402,19 +402,19 @@ const [Se, Ce] = wt(
402
402
  },
403
403
  ([, e]) => e()
404
404
  );
405
- function W() {
406
- return Se()[0];
405
+ function U() {
406
+ return Ee()[0];
407
407
  }
408
- function j(e, t) {
409
- W().off(e, t);
408
+ function H(e, t) {
409
+ U().off(e, t);
410
410
  }
411
- function b(e, t, s) {
412
- return W().on(e, t, s);
411
+ function v(e, t, s) {
412
+ return U().on(e, t, s);
413
413
  }
414
414
  function q(e) {
415
415
  return typeof e == "object" && e !== null && !Array.isArray(e);
416
416
  }
417
- function Re(e, t) {
417
+ function xe(e, t) {
418
418
  const s = e.split("."), n = t.split("."), r = Math.max(s.length, n.length);
419
419
  for (let i = 0; i < r; i += 1) {
420
420
  const o = parseInt(s[i] || "0", 10), a = parseInt(n[i] || "0", 10);
@@ -423,15 +423,15 @@ function Re(e, t) {
423
423
  }
424
424
  return 0;
425
425
  }
426
- function w(e, t) {
427
- return Re(e, t) <= 0;
426
+ function b(e, t) {
427
+ return xe(e, t) <= 0;
428
428
  }
429
- function x(e, t, s) {
429
+ function C(e, t, s) {
430
430
  if (typeof s == "string") {
431
431
  if (e === "web_app_open_link" && t === "try_instant_view")
432
- return w("6.4", s);
432
+ return b("6.4", s);
433
433
  if (e === "web_app_set_header_color" && t === "color")
434
- return w("6.9", s);
434
+ return b("6.9", s);
435
435
  }
436
436
  switch (e) {
437
437
  case "web_app_open_tg_link":
@@ -440,27 +440,27 @@ function x(e, t, s) {
440
440
  case "web_app_set_background_color":
441
441
  case "web_app_set_header_color":
442
442
  case "web_app_trigger_haptic_feedback":
443
- return w("6.1", t);
443
+ return b("6.1", t);
444
444
  case "web_app_open_popup":
445
- return w("6.2", t);
445
+ return b("6.2", t);
446
446
  case "web_app_close_scan_qr_popup":
447
447
  case "web_app_open_scan_qr_popup":
448
448
  case "web_app_read_text_from_clipboard":
449
- return w("6.4", t);
449
+ return b("6.4", t);
450
450
  case "web_app_switch_inline_query":
451
- return w("6.7", t);
451
+ return b("6.7", t);
452
452
  case "web_app_invoke_custom_method":
453
453
  case "web_app_request_write_access":
454
454
  case "web_app_request_phone":
455
- return w("6.9", t);
455
+ return b("6.9", t);
456
456
  case "web_app_setup_settings_button":
457
- return w("6.10", t);
457
+ return b("6.10", t);
458
458
  case "web_app_biometry_get_info":
459
459
  case "web_app_biometry_open_settings":
460
460
  case "web_app_biometry_request_access":
461
461
  case "web_app_biometry_request_auth":
462
462
  case "web_app_biometry_update_token":
463
- return w("7.2", t);
463
+ return b("7.2", t);
464
464
  default:
465
465
  return [
466
466
  "iframe_ready",
@@ -477,74 +477,74 @@ function x(e, t, s) {
477
477
  ].includes(e);
478
478
  }
479
479
  }
480
- function Te(e) {
480
+ function Ce(e) {
481
481
  return "external" in e && q(e.external) && "notify" in e.external && typeof e.external.notify == "function";
482
482
  }
483
- function xt(e) {
483
+ function Et(e) {
484
484
  return "TelegramWebviewProxy" in e && q(e.TelegramWebviewProxy) && "postEvent" in e.TelegramWebviewProxy && typeof e.TelegramWebviewProxy.postEvent == "function";
485
485
  }
486
- function St() {
486
+ function Pt() {
487
487
  try {
488
488
  return window.self !== window.top;
489
489
  } catch {
490
490
  return !0;
491
491
  }
492
492
  }
493
- let Ct = "https://web.telegram.org";
494
- function Ys(e) {
495
- Ct = e;
493
+ let xt = "https://web.telegram.org";
494
+ function Fs(e) {
495
+ xt = e;
496
496
  }
497
- function Ae() {
498
- return Ct;
497
+ function Se() {
498
+ return xt;
499
499
  }
500
500
  function k(e, t, s) {
501
501
  let n = {}, r;
502
502
  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 = Ae() } = n;
504
- if (oe("Posting event:", r ? { event: e, data: r } : { event: e }), St()) {
503
+ const { targetOrigin: i = Se() } = n;
504
+ if (re("Posting event:", r ? { event: e, data: r } : { event: e }), Pt()) {
505
505
  window.parent.postMessage(JSON.stringify({ eventType: e, eventData: r }), i);
506
506
  return;
507
507
  }
508
- if (Te(window)) {
508
+ if (Ce(window)) {
509
509
  window.external.notify(JSON.stringify({ eventType: e, eventData: r }));
510
510
  return;
511
511
  }
512
- if (xt(window)) {
512
+ if (Et(window)) {
513
513
  window.TelegramWebviewProxy.postEvent(e, JSON.stringify(r));
514
514
  return;
515
515
  }
516
- throw d(
517
- he,
516
+ throw w(
517
+ ae,
518
518
  "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
519
  );
520
520
  }
521
- function Ie(e) {
521
+ function Re(e) {
522
522
  return (t, s) => {
523
- if (!x(t, e))
524
- throw d(ae, `Method "${t}" is unsupported in Mini Apps version ${e}`);
523
+ if (!C(t, e))
524
+ throw w(ie, `Method "${t}" is unsupported in Mini Apps version ${e}`);
525
525
  if (q(s)) {
526
526
  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 && !x(t, n, e))
528
- throw d(
529
- ce,
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,
530
530
  `Parameter "${n}" of "${t}" method is unsupported in Mini Apps version ${e}`
531
531
  );
532
532
  }
533
533
  return k(t, s);
534
534
  };
535
535
  }
536
- function Rt(e) {
536
+ function Ct(e) {
537
537
  return ({ req_id: t }) => t === e;
538
538
  }
539
- function Tt(e) {
540
- return d(ue, `Timeout reached: ${e}ms`);
539
+ function St(e) {
540
+ return w(he, `Timeout reached: ${e}ms`);
541
541
  }
542
- function At(e, t) {
542
+ function Rt(e, t) {
543
543
  return Promise.race([
544
544
  typeof e == "function" ? e() : e,
545
545
  new Promise((s, n) => {
546
546
  setTimeout(() => {
547
- n(Tt(t));
547
+ n(St(t));
548
548
  }, t);
549
549
  })
550
550
  ]);
@@ -559,13 +559,13 @@ async function m(e) {
559
559
  capture: i,
560
560
  postEvent: o = k,
561
561
  timeout: a
562
- } = e, h = (Array.isArray(r) ? r : [r]).map(
563
- (u) => b(u, (D) => (!i || i(D)) && t(D))
562
+ } = e, p = (Array.isArray(r) ? r : [r]).map(
563
+ (u) => v(u, (l) => (!i || i(l)) && t(l))
564
564
  );
565
565
  try {
566
- return o(n, e.params), await (a ? At(s, a) : s);
566
+ return o(n, e.params), await (a ? Rt(s, a) : s);
567
567
  } finally {
568
- h.forEach((u) => u());
568
+ p.forEach((u) => u());
569
569
  }
570
570
  }
571
571
  async function A(e, t, s, n = {}) {
@@ -581,30 +581,30 @@ async function A(e, t, s, n = {}) {
581
581
  params: t,
582
582
  req_id: s
583
583
  },
584
- capture: Rt(s)
584
+ capture: Ct(s)
585
585
  });
586
586
  if (i)
587
- throw d(pe, i);
587
+ throw w(ce, i);
588
588
  return r;
589
589
  }
590
- function X(...e) {
590
+ function Y(...e) {
591
591
  return e.map((t) => {
592
592
  if (typeof t == "string")
593
593
  return t;
594
594
  if (q(t))
595
- return X(Object.entries(t).map((s) => s[1] && s[0]));
595
+ return Y(Object.entries(t).map((s) => s[1] && s[0]));
596
596
  if (Array.isArray(t))
597
- return X(...t);
597
+ return Y(...t);
598
598
  }).filter(Boolean).join(" ");
599
599
  }
600
- function Zs(...e) {
600
+ function Ys(...e) {
601
601
  return e.reduce((t, s) => (q(s) && Object.entries(s).forEach(([n, r]) => {
602
- const i = X(t[n], r);
602
+ const i = Y(t[n], r);
603
603
  i.length && (t[n] = i);
604
604
  }), t), {});
605
605
  }
606
- function It(e) {
607
- const t = Et(e);
606
+ function Tt(e) {
607
+ const t = vt(e);
608
608
  return Math.sqrt(
609
609
  [0.299, 0.587, 0.114].reduce((s, n, r) => {
610
610
  const i = parseInt(t.slice(1 + r * 2, 1 + (r + 1) * 2), 16);
@@ -612,9 +612,9 @@ function It(e) {
612
612
  }, 0)
613
613
  ) < 120;
614
614
  }
615
- class ke {
615
+ class Te {
616
616
  constructor(t) {
617
- c(this, "ee", new L()), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this.state = 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;
618
618
  }
619
619
  /**
620
620
  * Clones current state and returns its copy.
@@ -633,25 +633,25 @@ class ke {
633
633
  return this.state[t];
634
634
  }
635
635
  }
636
- class nt {
636
+ class et {
637
637
  constructor(t) {
638
- 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);
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);
639
639
  }
640
640
  }
641
- function kt(e, t) {
642
- return (s) => x(t[s], e);
641
+ function At(e, t) {
642
+ return (s) => C(t[s], e);
643
643
  }
644
- class rt extends nt {
644
+ class st extends et {
645
645
  constructor(t, s, n) {
646
- super(t), c(this, "supports"), this.supports = kt(s, n);
646
+ super(t), c(this, "supports"), this.supports = At(s, n);
647
647
  }
648
648
  }
649
- class Oe extends rt {
649
+ class Ae extends st {
650
650
  constructor(t, s, n) {
651
651
  super({ isVisible: t }, s, {
652
652
  show: "web_app_setup_back_button",
653
653
  hide: "web_app_setup_back_button"
654
- }), c(this, "on", (r, i) => r === "click" ? b("back_button_pressed", i) : this.state.on(r, i)), c(this, "off", (r, i) => r === "click" ? j("back_button_pressed", i) : this.state.off(r, i)), this.postEvent = n;
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;
655
655
  }
656
656
  set isVisible(t) {
657
657
  this.set("isVisible", t), this.postEvent("web_app_setup_back_button", { is_visible: t });
@@ -675,188 +675,185 @@ class Oe extends rt {
675
675
  this.isVisible = !0;
676
676
  }
677
677
  }
678
- function S() {
679
- return typeof window > "u";
680
- }
681
- const Ot = R((e) => e instanceof Date ? e : new Date(E().parse(e) * 1e3), "Date");
682
- function it(e, t) {
683
- return new H((s) => {
678
+ const It = R((e) => e instanceof Date ? e : new Date(P().parse(e) * 1e3), "Date");
679
+ function nt(e, t) {
680
+ return new L((s) => {
684
681
  if (typeof s != "string" && !(s instanceof URLSearchParams))
685
- throw C();
682
+ throw S();
686
683
  const n = typeof s == "string" ? new URLSearchParams(s) : s;
687
- return yt(e, (r) => {
684
+ return bt(e, (r) => {
688
685
  const i = n.get(r);
689
686
  return i === null ? void 0 : i;
690
687
  });
691
688
  }, !1, t);
692
689
  }
693
- const qe = f({
694
- id: E(),
695
- type: p(),
696
- title: p(),
690
+ const Ie = f({
691
+ id: P(),
692
+ type: h(),
693
+ title: h(),
697
694
  photoUrl: {
698
- type: p().optional(),
695
+ type: h().optional(),
699
696
  from: "photo_url"
700
697
  },
701
- username: p().optional()
698
+ username: h().optional()
702
699
  }, "Chat").optional(), lt = f({
703
700
  addedToAttachmentMenu: {
704
- type: v().optional(),
701
+ type: y().optional(),
705
702
  from: "added_to_attachment_menu"
706
703
  },
707
704
  allowsWriteToPm: {
708
- type: v().optional(),
705
+ type: y().optional(),
709
706
  from: "allows_write_to_pm"
710
707
  },
711
708
  firstName: {
712
- type: p(),
709
+ type: h(),
713
710
  from: "first_name"
714
711
  },
715
- id: E(),
712
+ id: P(),
716
713
  isBot: {
717
- type: v().optional(),
714
+ type: y().optional(),
718
715
  from: "is_bot"
719
716
  },
720
717
  isPremium: {
721
- type: v().optional(),
718
+ type: y().optional(),
722
719
  from: "is_premium"
723
720
  },
724
721
  languageCode: {
725
- type: p().optional(),
722
+ type: h().optional(),
726
723
  from: "language_code"
727
724
  },
728
725
  lastName: {
729
- type: p().optional(),
726
+ type: h().optional(),
730
727
  from: "last_name"
731
728
  },
732
729
  photoUrl: {
733
- type: p().optional(),
730
+ type: h().optional(),
734
731
  from: "photo_url"
735
732
  },
736
- username: p().optional()
733
+ username: h().optional()
737
734
  }, "User").optional();
738
- function qt() {
739
- return it({
735
+ function kt() {
736
+ return nt({
740
737
  authDate: {
741
- type: Ot(),
738
+ type: It(),
742
739
  from: "auth_date"
743
740
  },
744
741
  canSendAfter: {
745
- type: E().optional(),
742
+ type: P().optional(),
746
743
  from: "can_send_after"
747
744
  },
748
- chat: qe,
745
+ chat: Ie,
749
746
  chatInstance: {
750
- type: p().optional(),
747
+ type: h().optional(),
751
748
  from: "chat_instance"
752
749
  },
753
750
  chatType: {
754
- type: p().optional(),
751
+ type: h().optional(),
755
752
  from: "chat_type"
756
753
  },
757
- hash: p(),
754
+ hash: h(),
758
755
  queryId: {
759
- type: p().optional(),
756
+ type: h().optional(),
760
757
  from: "query_id"
761
758
  },
762
759
  receiver: lt,
763
760
  startParam: {
764
- type: p().optional(),
761
+ type: h().optional(),
765
762
  from: "start_param"
766
763
  },
767
764
  user: lt
768
765
  }, "InitData");
769
766
  }
770
- function Ne(e) {
767
+ function ke(e) {
771
768
  return e.replace(/_[a-z]/g, (t) => t[1].toUpperCase());
772
769
  }
773
- function De(e) {
770
+ function Oe(e) {
774
771
  return e.replace(/[A-Z]/g, (t) => `_${t.toLowerCase()}`);
775
772
  }
776
- const Nt = R(
773
+ const Ot = R(
777
774
  (e) => {
778
- const t = Pt().optional();
779
- return Object.entries(et(e)).reduce((s, [n, r]) => (s[Ne(n)] = t.parse(r), s), {});
775
+ const t = yt().optional();
776
+ return Object.entries(X(e)).reduce((s, [n, r]) => (s[ke(n)] = t.parse(r), s), {});
780
777
  },
781
778
  "ThemeParams"
782
779
  );
783
- function Dt(e) {
784
- return it({
780
+ function qt(e) {
781
+ return nt({
785
782
  botInline: {
786
- type: v().optional(),
783
+ type: y().optional(),
787
784
  from: "tgWebAppBotInline"
788
785
  },
789
786
  initData: {
790
- type: qt().optional(),
787
+ type: kt().optional(),
791
788
  from: "tgWebAppData"
792
789
  },
793
790
  initDataRaw: {
794
- type: p().optional(),
791
+ type: h().optional(),
795
792
  from: "tgWebAppData"
796
793
  },
797
794
  platform: {
798
- type: p(),
795
+ type: h(),
799
796
  from: "tgWebAppPlatform"
800
797
  },
801
798
  showSettings: {
802
- type: v().optional(),
799
+ type: y().optional(),
803
800
  from: "tgWebAppShowSettings"
804
801
  },
805
802
  startParam: {
806
- type: p().optional(),
803
+ type: h().optional(),
807
804
  from: "tgWebAppStartParam"
808
805
  },
809
806
  themeParams: {
810
- type: Nt(),
807
+ type: Ot(),
811
808
  from: "tgWebAppThemeParams"
812
809
  },
813
810
  version: {
814
- type: p(),
811
+ type: h(),
815
812
  from: "tgWebAppVersion"
816
813
  }
817
814
  }).parse(e);
818
815
  }
819
- function Vt(e) {
820
- return Dt(
816
+ function Dt(e) {
817
+ return qt(
821
818
  e.replace(/^[^?#]*[?#]/, "").replace(/[?#]/g, "&")
822
819
  );
823
820
  }
824
- function Ve() {
825
- return Vt(window.location.href);
821
+ function qe() {
822
+ return Dt(window.location.href);
826
823
  }
827
- function Mt() {
824
+ function Nt() {
828
825
  return performance.getEntriesByType("navigation")[0];
829
826
  }
830
- function Me() {
831
- const e = Mt();
827
+ function De() {
828
+ const e = Nt();
832
829
  if (!e)
833
830
  throw new Error("Unable to get first navigation entry.");
834
- return Vt(e.name);
831
+ return Dt(e.name);
835
832
  }
836
- function Bt(e) {
833
+ function Vt(e) {
837
834
  return `tma.js/${e.replace(/[A-Z]/g, (t) => `-${t.toLowerCase()}`)}`;
838
835
  }
839
- function $t(e, t) {
840
- sessionStorage.setItem(Bt(e), JSON.stringify(t));
836
+ function Mt(e, t) {
837
+ sessionStorage.setItem(Vt(e), JSON.stringify(t));
841
838
  }
842
- function Lt(e) {
843
- const t = sessionStorage.getItem(Bt(e));
839
+ function Bt(e) {
840
+ const t = sessionStorage.getItem(Vt(e));
844
841
  try {
845
842
  return t ? JSON.parse(t) : void 0;
846
843
  } catch {
847
844
  }
848
845
  }
849
- function Be() {
850
- return Dt(Lt("launchParams") || "");
846
+ function Ne() {
847
+ return qt(Bt("launchParams") || "");
851
848
  }
852
- function $e(e) {
849
+ function Ve(e) {
853
850
  return JSON.stringify(
854
851
  Object.fromEntries(
855
- Object.entries(e).map(([t, s]) => [De(t), s])
852
+ Object.entries(e).map(([t, s]) => [Oe(t), s])
856
853
  )
857
854
  );
858
855
  }
859
- function Le(e) {
856
+ function Me(e) {
860
857
  const {
861
858
  initDataRaw: t,
862
859
  themeParams: s,
@@ -865,82 +862,87 @@ function Le(e) {
865
862
  showSettings: i,
866
863
  startParam: o,
867
864
  botInline: a
868
- } = e, h = new URLSearchParams();
869
- return h.set("tgWebAppPlatform", n), h.set("tgWebAppThemeParams", $e(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();
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();
870
867
  }
871
- function Ue(e) {
872
- $t("launchParams", Le(e));
868
+ function Be(e) {
869
+ Mt("launchParams", Me(e));
873
870
  }
874
- function He() {
871
+ function $e() {
875
872
  for (const e of [
876
873
  // Try to retrieve launch parameters from the current location. This method can return
877
874
  // nothing in case, location was changed and then page was reloaded.
878
- Ve,
875
+ qe,
879
876
  // Then, try using the lower level API - window.performance.
880
- Me,
877
+ De,
881
878
  // Finally, try to extract launch parameters from the session storage.
882
- Be
879
+ Ne
883
880
  ])
884
881
  try {
885
882
  const t = e();
886
- return Ue(t), t;
883
+ return Be(t), t;
887
884
  } catch {
888
885
  }
889
886
  throw new Error("Unable to retrieve launch parameters from any known source.");
890
887
  }
891
- function Ut() {
892
- const e = Mt();
888
+ function $t() {
889
+ const e = Nt();
893
890
  return !!(e && e.type === "reload");
894
891
  }
895
- function We() {
892
+ function Le() {
896
893
  let e = 0;
897
894
  return () => (e += 1).toString();
898
895
  }
899
- const [je] = wt(We);
900
- function l(e, t) {
901
- return ({ ssr: s } = {}) => {
902
- let n;
903
- if (S()) {
904
- if (!s)
905
- throw d(
906
- tt,
907
- "ssr.options must be specified to initialize component on the server side"
908
- );
909
- n = s;
910
- } else
911
- n = He();
912
- const r = {
913
- ...n,
914
- postEvent: "version" in n ? Ie(n.version) : () => {
915
- throw d(
916
- ge,
917
- "postEvent function is forbidden to be called on the server side."
918
- );
919
- },
920
- createRequestId: je()
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) {
909
+ return () => {
910
+ const s = $e(), n = {
911
+ ...s,
912
+ postEvent: Re(s.version),
913
+ createRequestId: He()
921
914
  };
922
- if (S() || typeof e == "function")
923
- return typeof e == "function" ? e(r) : t(r);
924
- const i = t({
925
- ...r,
926
- state: Ut() ? Lt(e) : void 0
927
- }), o = (a) => (a.on("change", (h) => {
928
- $t(e, h);
929
- }), a);
930
- return i instanceof Promise ? i.then(o) : o(i);
915
+ if (typeof e == "function")
916
+ return e(n);
917
+ const [r, i, o] = Ue(), a = t({
918
+ ...n,
919
+ // State should only be passed only in case, current page was reloaded. If we don't add
920
+ // this check, state restoration will work improperly in the web version of Telegram,
921
+ // when we are always working in the same "session" (tab).
922
+ state: $t() ? Bt(e) : void 0,
923
+ addCleanup: r
924
+ }), p = (u) => (o || r(
925
+ u.on("change", (l) => {
926
+ Mt(e, l);
927
+ })
928
+ ), u);
929
+ return [
930
+ a instanceof Promise ? a.then(p) : p(a),
931
+ i
932
+ ];
931
933
  };
932
934
  }
933
- const Ge = l("backButton", ({
935
+ const We = d("backButton", ({
934
936
  postEvent: e,
935
937
  version: t,
936
938
  state: s = { isVisible: !1 }
937
- }) => new Oe(s.isVisible, t, e));
938
- class N extends rt {
939
+ }) => new Ae(s.isVisible, t, e));
940
+ class D extends st {
939
941
  constructor() {
940
942
  super(...arguments), c(this, "on", this.state.on.bind(this.state)), c(this, "off", this.state.off.bind(this.state));
941
943
  }
942
944
  }
943
- function Ht(e) {
945
+ function Lt(e) {
944
946
  const t = e.available ? e : {
945
947
  available: !1,
946
948
  device_id: "",
@@ -958,7 +960,7 @@ function Ht(e) {
958
960
  accessGranted: t.access_granted
959
961
  };
960
962
  }
961
- class _t extends N {
963
+ class je extends D {
962
964
  constructor({ postEvent: t, version: s, ...n }) {
963
965
  super(n, s, {
964
966
  auth: "web_app_biometry_request_auth",
@@ -1036,7 +1038,7 @@ class _t extends N {
1036
1038
  event: "biometry_info_received",
1037
1039
  params: { reason: t || "" }
1038
1040
  }).then((n) => {
1039
- const r = Ht(n);
1041
+ const r = Lt(n);
1040
1042
  return this.set(r), r.accessGranted;
1041
1043
  }).finally(() => this.accessPromise = void 0)), this.accessPromise;
1042
1044
  }
@@ -1068,8 +1070,8 @@ class _t extends N {
1068
1070
  );
1069
1071
  }
1070
1072
  }
1071
- async function ze(e) {
1072
- return Ht(
1073
+ async function Ge(e) {
1074
+ return Lt(
1073
1075
  await m({
1074
1076
  ...e || {},
1075
1077
  method: "web_app_biometry_get_info",
@@ -1077,26 +1079,20 @@ async function ze(e) {
1077
1079
  })
1078
1080
  );
1079
1081
  }
1080
- const Ke = l("biometryManager", async ({ postEvent: e, version: t, state: s }) => {
1081
- if (s)
1082
- return new _t({ ...s, version: t, postEvent: e });
1083
- if (S())
1084
- throw d(
1085
- tt,
1086
- "BiometryManager cannot be instantiated on the server side without passing the ssr.state object."
1087
- );
1088
- return new _t({
1089
- ...await ze({ timeout: 1e3 }),
1082
+ const Ke = d(
1083
+ "biometryManager",
1084
+ async ({ postEvent: e, version: t, state: s }) => new je({
1085
+ ...s || await Ge({ timeout: 1e3 }),
1090
1086
  version: t,
1091
1087
  postEvent: e
1092
- });
1093
- });
1094
- class ot extends nt {
1088
+ })
1089
+ );
1090
+ class rt extends et {
1095
1091
  constructor() {
1096
1092
  super(...arguments), c(this, "on", this.state.on.bind(this.state)), c(this, "off", this.state.off.bind(this.state));
1097
1093
  }
1098
1094
  }
1099
- class Je extends ot {
1095
+ class ze extends rt {
1100
1096
  constructor(t, s) {
1101
1097
  super({ isConfirmationNeeded: t }), this.postEvent = s;
1102
1098
  }
@@ -1123,16 +1119,19 @@ class Je extends ot {
1123
1119
  this.isConfirmationNeeded = !0;
1124
1120
  }
1125
1121
  }
1126
- const Qe = l("closingBehavior", ({
1127
- postEvent: e,
1128
- state: t = { isConfirmationNeeded: !1 }
1129
- }) => new Je(t.isConfirmationNeeded, e));
1130
- class at {
1122
+ const Je = d(
1123
+ "closingBehavior",
1124
+ ({
1125
+ postEvent: e,
1126
+ state: t = { isConfirmationNeeded: !1 }
1127
+ }) => new ze(t.isConfirmationNeeded, e)
1128
+ );
1129
+ class it {
1131
1130
  constructor(t, s) {
1132
- c(this, "supports"), this.supports = kt(t, s);
1131
+ c(this, "supports"), this.supports = At(t, s);
1133
1132
  }
1134
1133
  }
1135
- function Fe(e) {
1134
+ function Qe(e) {
1136
1135
  if (Array.isArray(e))
1137
1136
  return e;
1138
1137
  if (typeof e == "string")
@@ -1142,11 +1141,11 @@ function Fe(e) {
1142
1141
  return t;
1143
1142
  } catch {
1144
1143
  }
1145
- throw C();
1144
+ throw S();
1146
1145
  }
1147
- class Ye extends H {
1146
+ class Fe extends L {
1148
1147
  constructor(t, s, n) {
1149
- super(Fe, s, n), c(this, "itemParser"), this.itemParser = typeof t == "function" ? t : t.parse.bind(t);
1148
+ super(Qe, s, n), c(this, "itemParser"), this.itemParser = typeof t == "function" ? t : t.parse.bind(t);
1150
1149
  }
1151
1150
  /**
1152
1151
  * Attempts to parse passed value
@@ -1162,13 +1161,13 @@ class Ye extends H {
1162
1161
  return this.itemParser = typeof t == "function" ? t : t.parse.bind(t), this;
1163
1162
  }
1164
1163
  }
1165
- function Ze(e) {
1166
- return new Ye((t) => t, !1, e);
1164
+ function Ye(e) {
1165
+ return new Fe((t) => t, !1, e);
1167
1166
  }
1168
- function gt(e, t) {
1167
+ function dt(e, t) {
1169
1168
  return Object.fromEntries(e.map((s) => [s, t]));
1170
1169
  }
1171
- class Xe extends at {
1170
+ class Ze extends it {
1172
1171
  constructor(t, s, n) {
1173
1172
  super(t, {
1174
1173
  delete: "web_app_invoke_custom_method",
@@ -1196,7 +1195,7 @@ class Xe extends at {
1196
1195
  * @param options - request execution options.
1197
1196
  */
1198
1197
  async getKeys(t = {}) {
1199
- return Ze().of(p()).parse(
1198
+ return Ye().of(h()).parse(
1200
1199
  await A(
1201
1200
  "getStorageKeys",
1202
1201
  {},
@@ -1208,13 +1207,13 @@ class Xe extends at {
1208
1207
  async get(t, s = {}) {
1209
1208
  const n = Array.isArray(t) ? t : [t];
1210
1209
  if (!n.length)
1211
- return gt(n, "");
1210
+ return dt(n, "");
1212
1211
  const r = await A(
1213
1212
  "getStorageValues",
1214
1213
  { keys: n },
1215
1214
  this.createRequestId(),
1216
1215
  { ...s, postEvent: this.postEvent }
1217
- ), i = f(gt(n, p()), "CloudStorageData").parse(r);
1216
+ ), i = f(dt(n, h()), "CloudStorageData").parse(r);
1218
1217
  return Array.isArray(t) ? i : i[t];
1219
1218
  }
1220
1219
  /**
@@ -1232,10 +1231,10 @@ class Xe extends at {
1232
1231
  );
1233
1232
  }
1234
1233
  }
1235
- const ts = l(
1236
- ({ createRequestId: e, postEvent: t, version: s }) => new Xe(s, e, t)
1234
+ const Xe = d(
1235
+ ({ createRequestId: e, postEvent: t, version: s }) => new Ze(s, e, t)
1237
1236
  );
1238
- class es extends at {
1237
+ class ts extends it {
1239
1238
  constructor(t, s) {
1240
1239
  super(t, {
1241
1240
  impactOccurred: "web_app_trigger_haptic_feedback",
@@ -1277,10 +1276,10 @@ class es extends at {
1277
1276
  this.postEvent("web_app_trigger_haptic_feedback", { type: "selection_change" });
1278
1277
  }
1279
1278
  }
1280
- const ss = l(
1281
- ({ version: e, postEvent: t }) => new es(e, t)
1279
+ const es = d(
1280
+ ({ version: e, postEvent: t }) => new ts(e, t)
1282
1281
  );
1283
- class ns {
1282
+ class ss {
1284
1283
  constructor(t) {
1285
1284
  this.initData = t;
1286
1285
  }
@@ -1353,13 +1352,13 @@ class ns {
1353
1352
  return this.initData.user;
1354
1353
  }
1355
1354
  }
1356
- const rs = l(
1357
- ({ initData: e }) => e ? new ns(e) : void 0
1355
+ const ns = d(
1356
+ ({ initData: e }) => e ? new ss(e) : void 0
1358
1357
  );
1359
- function Xs(e) {
1360
- return qt().parse(e);
1358
+ function Zs(e) {
1359
+ return kt().parse(e);
1361
1360
  }
1362
- class is extends N {
1361
+ class rs extends D {
1363
1362
  constructor(t, s, n) {
1364
1363
  super({ isOpened: t }, s, { open: "web_app_open_invoice" }), this.postEvent = n;
1365
1364
  }
@@ -1403,12 +1402,12 @@ class is extends N {
1403
1402
  }
1404
1403
  }
1405
1404
  }
1406
- const os = l(
1407
- ({ version: e, postEvent: t }) => new is(!1, e, t)
1405
+ const is = d(
1406
+ ({ version: e, postEvent: t }) => new rs(!1, e, t)
1408
1407
  );
1409
- class as extends nt {
1408
+ class os extends et {
1410
1409
  constructor({ postEvent: t, ...s }) {
1411
- super(s), c(this, "postEvent"), c(this, "on", (n, r) => n === "click" ? b("main_button_pressed", r) : this.state.on(n, r)), c(this, "off", (n, r) => n === "click" ? j("main_button_pressed", r) : this.state.off(n, r)), this.postEvent = t;
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;
1412
1411
  }
1413
1412
  /**
1414
1413
  * Sends current local state to the Telegram application.
@@ -1537,57 +1536,60 @@ class as extends nt {
1537
1536
  return this.set(t), this.commit(), this;
1538
1537
  }
1539
1538
  }
1540
- const cs = l("mainButton", ({
1541
- postEvent: e,
1542
- themeParams: t,
1543
- state: s = {
1544
- isVisible: !1,
1545
- isEnabled: !1,
1546
- text: "",
1547
- isLoaderVisible: !1,
1548
- textColor: t.buttonTextColor || "#ffffff",
1549
- backgroundColor: t.buttonColor || "#000000"
1550
- }
1551
- }) => new as({ ...s, postEvent: e }));
1552
- function hs() {
1553
- return it({
1539
+ const as = d(
1540
+ "mainButton",
1541
+ ({
1542
+ postEvent: e,
1543
+ themeParams: t,
1544
+ state: s = {
1545
+ isVisible: !1,
1546
+ isEnabled: !1,
1547
+ text: "",
1548
+ isLoaderVisible: !1,
1549
+ textColor: t.buttonTextColor || "#ffffff",
1550
+ backgroundColor: t.buttonColor || "#000000"
1551
+ }
1552
+ }) => new os({ ...s, postEvent: e })
1553
+ );
1554
+ function cs() {
1555
+ return nt({
1554
1556
  contact: f({
1555
1557
  userId: {
1556
- type: E(),
1558
+ type: P(),
1557
1559
  from: "user_id"
1558
1560
  },
1559
1561
  phoneNumber: {
1560
- type: p(),
1562
+ type: h(),
1561
1563
  from: "phone_number"
1562
1564
  },
1563
1565
  firstName: {
1564
- type: p(),
1566
+ type: h(),
1565
1567
  from: "first_name"
1566
1568
  },
1567
1569
  lastName: {
1568
- type: p().optional(),
1570
+ type: h().optional(),
1569
1571
  from: "last_name"
1570
1572
  }
1571
1573
  }),
1572
1574
  authDate: {
1573
- type: Ot(),
1575
+ type: It(),
1574
1576
  from: "auth_date"
1575
1577
  },
1576
- hash: p()
1578
+ hash: h()
1577
1579
  }, "RequestedContact");
1578
1580
  }
1579
- function Wt(e, t) {
1581
+ function Ut(e, t) {
1580
1582
  return (s) => {
1581
1583
  const [n, r] = t[s];
1582
- return x(n, r, e);
1584
+ return C(n, r, e);
1583
1585
  };
1584
1586
  }
1585
- function ps(e) {
1587
+ function hs(e) {
1586
1588
  return new Promise((t) => {
1587
1589
  setTimeout(t, e);
1588
1590
  });
1589
1591
  }
1590
- class us extends N {
1592
+ class ps extends D {
1591
1593
  constructor({ postEvent: t, createRequestId: s, version: n, botInline: r, ...i }) {
1592
1594
  super(i, n, {
1593
1595
  requestPhoneAccess: "web_app_request_phone",
@@ -1597,7 +1599,7 @@ class us extends N {
1597
1599
  setBackgroundColor: "web_app_set_background_color"
1598
1600
  }), 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;
1599
1601
  const o = this.supports.bind(this);
1600
- this.supports = (a) => o(a) ? a !== "switchInlineQuery" || r : !1, this.supportsParam = Wt(n, {
1602
+ this.supports = (a) => o(a) ? a !== "switchInlineQuery" || r : !1, this.supportsParam = Ut(n, {
1601
1603
  "setHeaderColor.color": ["web_app_set_header_color", "color"]
1602
1604
  });
1603
1605
  }
@@ -1608,7 +1610,7 @@ class us extends N {
1608
1610
  async getRequestedContact({
1609
1611
  timeout: t = 1e4
1610
1612
  } = {}) {
1611
- return hs().parse(
1613
+ return cs().parse(
1612
1614
  await A(
1613
1615
  "getRequestedContact",
1614
1616
  {},
@@ -1648,7 +1650,7 @@ class us extends N {
1648
1650
  * True if current Mini App background color is recognized as dark.
1649
1651
  */
1650
1652
  get isDark() {
1651
- return It(this.bgColor);
1653
+ return Tt(this.bgColor);
1652
1654
  }
1653
1655
  /**
1654
1656
  * Informs the Telegram app that the Mini App is ready to be displayed.
@@ -1677,15 +1679,15 @@ class us extends N {
1677
1679
  throw new Error("Access denied.");
1678
1680
  const s = Date.now() + t;
1679
1681
  let n = 50;
1680
- return At(async () => {
1682
+ return Rt(async () => {
1681
1683
  for (; Date.now() < s; ) {
1682
1684
  try {
1683
1685
  return await this.getRequestedContact();
1684
1686
  } catch {
1685
1687
  }
1686
- await ps(n), n += 50;
1688
+ await hs(n), n += 50;
1687
1689
  }
1688
- throw Tt(t);
1690
+ throw St(t);
1689
1691
  }, t);
1690
1692
  }
1691
1693
  /**
@@ -1740,7 +1742,7 @@ class us extends N {
1740
1742
  * @param color - color key or RGB color.
1741
1743
  */
1742
1744
  setHeaderColor(t) {
1743
- this.postEvent("web_app_set_header_color", st(t) ? { color: t } : { color_key: t }), this.set("headerColor", t);
1745
+ this.postEvent("web_app_set_header_color", tt(t) ? { color: t } : { color_key: t }), this.set("headerColor", t);
1744
1746
  }
1745
1747
  /**
1746
1748
  * Updates current Mini App background color.
@@ -1768,15 +1770,18 @@ class us extends N {
1768
1770
  this.postEvent("web_app_switch_inline_query", { query: t, chat_types: s });
1769
1771
  }
1770
1772
  }
1771
- const ds = l("miniApp", ({
1772
- themeParams: e,
1773
- botInline: t = !1,
1774
- state: s = {
1775
- bgColor: e.bgColor || "#ffffff",
1776
- headerColor: e.headerBgColor || "#000000"
1777
- },
1778
- ...n
1779
- }) => new us({ ...n, ...s, botInline: t }));
1773
+ const us = d(
1774
+ "miniApp",
1775
+ ({
1776
+ themeParams: e,
1777
+ botInline: t = !1,
1778
+ state: s = {
1779
+ bgColor: e.bgColor || "#ffffff",
1780
+ headerColor: e.headerBgColor || "#000000"
1781
+ },
1782
+ ...n
1783
+ }) => new ps({ ...n, ...s, botInline: t })
1784
+ );
1780
1785
  function ls(e) {
1781
1786
  const t = e.message.trim(), s = (e.title || "").trim(), n = e.buttons || [];
1782
1787
  let r;
@@ -1793,15 +1798,15 @@ function ls(e) {
1793
1798
  if (!i.type || i.type === "default" || i.type === "destructive") {
1794
1799
  const a = i.text.trim();
1795
1800
  if (!a.length || a.length > 64) {
1796
- const h = i.type || "default";
1797
- throw new Error(`Button text with type "${h}" has incorrect size: ${i.text.length}`);
1801
+ const p = i.type || "default";
1802
+ throw new Error(`Button text with type "${p}" has incorrect size: ${i.text.length}`);
1798
1803
  }
1799
1804
  return { ...i, text: a, id: o };
1800
1805
  }
1801
1806
  return { ...i, id: o };
1802
1807
  }) : r = [{ type: "close", id: "" }], { title: s, message: t, buttons: r };
1803
1808
  }
1804
- class _s extends N {
1809
+ class ds extends D {
1805
1810
  constructor(t, s, n) {
1806
1811
  super({ isOpened: t }, s, { open: "web_app_open_popup" }), this.postEvent = n;
1807
1812
  }
@@ -1842,10 +1847,10 @@ class _s extends N {
1842
1847
  }
1843
1848
  }
1844
1849
  }
1845
- const gs = l(
1846
- ({ postEvent: e, version: t }) => new _s(!1, t, e)
1850
+ const _s = d(
1851
+ ({ postEvent: e, version: t }) => new ds(!1, t, e)
1847
1852
  );
1848
- class fs extends N {
1853
+ class gs extends D {
1849
1854
  constructor(t, s, n) {
1850
1855
  super({ isOpened: t }, s, {
1851
1856
  close: "web_app_close_scan_qr_popup",
@@ -1889,15 +1894,15 @@ class fs extends N {
1889
1894
  }
1890
1895
  }
1891
1896
  }
1892
- const ms = l(
1893
- ({ version: e, postEvent: t }) => new fs(!1, e, t)
1897
+ const fs = d(
1898
+ ({ version: e, postEvent: t }) => new gs(!1, e, t)
1894
1899
  );
1895
- class ws extends rt {
1900
+ class ms extends st {
1896
1901
  constructor(t, s, n) {
1897
1902
  super({ isVisible: t }, s, {
1898
1903
  show: "web_app_setup_settings_button",
1899
1904
  hide: "web_app_setup_settings_button"
1900
- }), c(this, "on", (r, i) => r === "click" ? b("settings_button_pressed", i) : this.state.on(r, i)), c(this, "off", (r, i) => r === "click" ? j("settings_button_pressed", i) : this.state.off(r, i)), this.postEvent = n;
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;
1901
1906
  }
1902
1907
  set isVisible(t) {
1903
1908
  this.set("isVisible", t), this.postEvent("web_app_setup_settings_button", { is_visible: t });
@@ -1921,15 +1926,18 @@ class ws extends rt {
1921
1926
  this.isVisible = !0;
1922
1927
  }
1923
1928
  }
1924
- const bs = l("settingsButton", ({
1925
- version: e,
1926
- postEvent: t,
1927
- state: s = { isVisible: !1 }
1928
- }) => new ws(s.isVisible, e, t));
1929
- function jt(e) {
1930
- return Nt().parse(e);
1929
+ const ws = d(
1930
+ "settingsButton",
1931
+ ({
1932
+ version: e,
1933
+ postEvent: t,
1934
+ state: s = { isVisible: !1 }
1935
+ }) => new ms(s.isVisible, e, t)
1936
+ );
1937
+ function Ht(e) {
1938
+ return Ot().parse(e);
1931
1939
  }
1932
- class vs extends ot {
1940
+ class bs extends rt {
1933
1941
  /**
1934
1942
  * @since v6.10
1935
1943
  */
@@ -1968,7 +1976,7 @@ class vs extends ot {
1968
1976
  * value is calculated according to theme bg color.
1969
1977
  */
1970
1978
  get isDark() {
1971
- return !this.bgColor || It(this.bgColor);
1979
+ return !this.bgColor || Tt(this.bgColor);
1972
1980
  }
1973
1981
  get linkColor() {
1974
1982
  return this.get("linkColor");
@@ -1993,8 +2001,8 @@ class vs extends ot {
1993
2001
  * @returns Function to stop listening.
1994
2002
  */
1995
2003
  listen() {
1996
- return b("theme_changed", (t) => {
1997
- this.set(jt(t.theme_params));
2004
+ return v("theme_changed", (t) => {
2005
+ this.set(Ht(t.theme_params));
1998
2006
  });
1999
2007
  }
2000
2008
  /**
@@ -2007,20 +2015,23 @@ class vs extends ot {
2007
2015
  return this.get("textColor");
2008
2016
  }
2009
2017
  }
2010
- const ys = l("themeParams", ({ themeParams: e, state: t = e }) => {
2011
- const s = new vs(t);
2012
- return S() || s.listen(), s;
2013
- });
2014
- function tn(e = {}) {
2018
+ const vs = d(
2019
+ "themeParams",
2020
+ ({ themeParams: e, state: t = e, addCleanup: s }) => {
2021
+ const n = new bs(t);
2022
+ return s(n.listen()), n;
2023
+ }
2024
+ );
2025
+ function Xs(e = {}) {
2015
2026
  return m({
2016
2027
  ...e,
2017
2028
  method: "web_app_request_theme",
2018
2029
  event: "theme_changed"
2019
- }).then(jt);
2030
+ }).then(Ht);
2020
2031
  }
2021
- class Es extends at {
2032
+ class ys extends it {
2022
2033
  constructor(t, s, n) {
2023
- super(t, { readTextFromClipboard: "web_app_read_text_from_clipboard" }), c(this, "supportsParam"), this.version = t, this.createRequestId = s, this.postEvent = n, this.supportsParam = Wt(t, {
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, {
2024
2035
  "openLink.tryInstantView": ["web_app_open_link", "try_instant_view"]
2025
2036
  });
2026
2037
  }
@@ -2035,7 +2046,7 @@ class Es extends at {
2035
2046
  */
2036
2047
  openLink(t, s) {
2037
2048
  const n = new URL(t, window.location.href).toString();
2038
- if (!x("web_app_open_link", this.version)) {
2049
+ if (!C("web_app_open_link", this.version)) {
2039
2050
  window.open(n, "_blank");
2040
2051
  return;
2041
2052
  }
@@ -2054,7 +2065,7 @@ class Es extends at {
2054
2065
  const { hostname: s, pathname: n, search: r } = new URL(t, window.location.href);
2055
2066
  if (s !== "t.me")
2056
2067
  throw new Error(`URL has not allowed hostname: ${s}. Only "t.me" is allowed`);
2057
- if (!x("web_app_open_tg_link", this.version)) {
2068
+ if (!C("web_app_open_tg_link", this.version)) {
2058
2069
  window.location.href = t;
2059
2070
  return;
2060
2071
  }
@@ -2074,15 +2085,15 @@ class Es extends at {
2074
2085
  event: "clipboard_text_received",
2075
2086
  postEvent: this.postEvent,
2076
2087
  params: { req_id: t },
2077
- capture: Rt(t)
2088
+ capture: Ct(t)
2078
2089
  });
2079
2090
  return s;
2080
2091
  }
2081
2092
  }
2082
- const Ps = l(
2083
- ({ version: e, postEvent: t, createRequestId: s }) => new Es(e, s, t)
2093
+ const Es = d(
2094
+ ({ version: e, postEvent: t, createRequestId: s }) => new ys(e, s, t)
2084
2095
  );
2085
- async function Gt(e = {}) {
2096
+ async function Wt(e = {}) {
2086
2097
  const {
2087
2098
  is_expanded: t,
2088
2099
  is_state_stable: s,
@@ -2097,7 +2108,7 @@ async function Gt(e = {}) {
2097
2108
  function T(e) {
2098
2109
  return e < 0 ? 0 : e;
2099
2110
  }
2100
- class zt extends ot {
2111
+ class Ps extends rt {
2101
2112
  constructor({ postEvent: t, stableHeight: s, height: n, width: r, isExpanded: i }) {
2102
2113
  super({
2103
2114
  height: T(n),
@@ -2112,7 +2123,7 @@ class zt extends ot {
2112
2123
  * @param options - options to request fresh data.
2113
2124
  */
2114
2125
  async sync(t) {
2115
- const { isStateStable: s, ...n } = await Gt(t);
2126
+ const { isStateStable: s, ...n } = await Wt(t);
2116
2127
  this.set({
2117
2128
  ...n,
2118
2129
  stableHeight: s ? n.height : this.get("stableHeight")
@@ -2159,7 +2170,7 @@ class zt extends ot {
2159
2170
  * @returns Function to stop listening.
2160
2171
  */
2161
2172
  listen() {
2162
- return b("viewport_changed", (t) => {
2173
+ return v("viewport_changed", (t) => {
2163
2174
  const {
2164
2175
  height: s,
2165
2176
  width: n,
@@ -2204,99 +2215,80 @@ class zt extends ot {
2204
2215
  return this.stableHeight === this.height;
2205
2216
  }
2206
2217
  }
2207
- async function xs(e, t = {}) {
2208
- const {
2209
- height: s,
2210
- width: n,
2211
- isExpanded: r,
2212
- isStateStable: i
2213
- } = await Gt({ ...t, postEvent: e });
2214
- return new zt({
2215
- postEvent: e,
2216
- height: s,
2217
- width: n,
2218
- isExpanded: r,
2219
- stableHeight: i ? s : 0
2220
- });
2221
- }
2222
- function Ss({
2223
- state: e,
2224
- platform: t,
2225
- postEvent: s
2226
- }) {
2227
- let n = !1, r = 0, i = 0, o = 0;
2228
- return e ? (n = e.isExpanded, r = e.height, i = e.width, o = e.stableHeight) : ["macos", "tdesktop", "unigram", "webk", "weba", "web"].includes(t) && (n = !0, r = window.innerHeight, i = window.innerWidth, o = window.innerHeight), new zt({
2229
- postEvent: s,
2230
- height: r,
2231
- width: i,
2232
- stableHeight: o,
2233
- isExpanded: n
2234
- });
2235
- }
2236
- const Cs = l(
2218
+ const xs = d(
2237
2219
  "viewport",
2238
- async (e) => {
2239
- if (S() && !e.state)
2240
- throw d(
2241
- tt,
2242
- "Viewport cannot be instantiated on the server side without passing the ssr.state object."
2243
- );
2244
- let t = Ss(e);
2245
- return S() || (t.width === 0 && await xs(e.postEvent, { timeout: 1e3 }).then((s) => t = s).catch((s) => $.error("Unable to sync viewport state", s)), t.listen()), t;
2220
+ async ({ state: e, platform: t, postEvent: s, addCleanup: n }) => {
2221
+ let r = !1, i = 0, o = 0, a = 0;
2222
+ if (e)
2223
+ r = e.isExpanded, i = e.height, o = e.width, a = e.stableHeight;
2224
+ else if (["macos", "tdesktop", "unigram", "webk", "weba", "web"].includes(t))
2225
+ r = !0, i = window.innerHeight, o = window.innerWidth, a = window.innerHeight;
2226
+ else {
2227
+ const u = await Wt({ timeout: 1e3, postEvent: s });
2228
+ r = u.isExpanded, i = u.height, o = u.width, a = u.isStateStable ? i : 0;
2229
+ }
2230
+ const p = new Ps({
2231
+ postEvent: s,
2232
+ height: i,
2233
+ width: o,
2234
+ stableHeight: a,
2235
+ isExpanded: r
2236
+ });
2237
+ return n(p.listen()), p;
2246
2238
  }
2247
2239
  );
2248
- function y(e, t) {
2240
+ function E(e, t) {
2249
2241
  document.documentElement.style.setProperty(e, t);
2250
2242
  }
2251
- function en(e, t, s) {
2243
+ function tn(e, t, s) {
2252
2244
  s || (s = (a) => `--tg-${a}-color`);
2253
2245
  const n = s("header"), r = s("bg"), i = () => {
2254
2246
  const { headerColor: a } = e;
2255
- if (st(a))
2256
- y(n, a);
2247
+ if (tt(a))
2248
+ E(n, a);
2257
2249
  else {
2258
- const { bgColor: h, secondaryBgColor: u } = t;
2259
- a === "bg_color" && h ? y(n, h) : a === "secondary_bg_color" && u && y(n, u);
2250
+ const { bgColor: p, secondaryBgColor: u } = t;
2251
+ a === "bg_color" && p ? E(n, p) : a === "secondary_bg_color" && u && E(n, u);
2260
2252
  }
2261
- y(r, e.bgColor);
2253
+ E(r, e.bgColor);
2262
2254
  }, o = [
2263
2255
  t.on("change", i),
2264
2256
  e.on("change", i)
2265
2257
  ];
2266
2258
  return i(), () => o.forEach((a) => a());
2267
2259
  }
2268
- function sn(e, t) {
2260
+ function en(e, t) {
2269
2261
  t || (t = (n) => `--tg-theme-${n.replace(/[A-Z]/g, (r) => `-${r.toLowerCase()}`)}`);
2270
2262
  const s = () => {
2271
2263
  Object.entries(e.getState()).forEach(([n, r]) => {
2272
- r && y(t(n), r);
2264
+ r && E(t(n), r);
2273
2265
  });
2274
2266
  };
2275
2267
  return s(), e.on("change", s);
2276
2268
  }
2277
- function nn(e, t) {
2269
+ function sn(e, t) {
2278
2270
  t || (t = (u) => `--tg-viewport-${u}`);
2279
2271
  const [
2280
2272
  s,
2281
2273
  n,
2282
2274
  r
2283
- ] = ["height", "width", "stable-height"].map((u) => t(u)), i = () => y(s, `${e.height}px`), o = () => y(n, `${e.width}px`), a = () => y(r, `${e.stableHeight}px`), h = [
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 = [
2284
2276
  e.on("change:height", i),
2285
2277
  e.on("change:width", o),
2286
2278
  e.on("change:stableHeight", a)
2287
2279
  ];
2288
- return i(), o(), a(), () => h.forEach((u) => u());
2280
+ return i(), o(), a(), () => p.forEach((u) => u());
2289
2281
  }
2290
- function Rs(e = !0) {
2282
+ function Cs(e = !0) {
2291
2283
  const t = [
2292
- b("reload_iframe", () => {
2284
+ v("reload_iframe", () => {
2293
2285
  k("iframe_will_reload"), window.location.reload();
2294
2286
  })
2295
2287
  ], s = () => t.forEach((n) => n());
2296
2288
  if (e) {
2297
2289
  const n = document.createElement("style");
2298
2290
  n.id = "telegram-custom-styles", document.head.appendChild(n), t.push(
2299
- b("set_custom_style", (r) => {
2291
+ v("set_custom_style", (r) => {
2300
2292
  n.innerHTML = r;
2301
2293
  }),
2302
2294
  () => document.head.removeChild(n)
@@ -2304,8 +2296,11 @@ function Rs(e = !0) {
2304
2296
  }
2305
2297
  return k("iframe_ready", { reload_supported: !0 }), s;
2306
2298
  }
2299
+ function nn() {
2300
+ return typeof window > "u";
2301
+ }
2307
2302
  async function rn() {
2308
- if (xt(window))
2303
+ if (Et(window))
2309
2304
  return !0;
2310
2305
  try {
2311
2306
  return await m({ method: "web_app_request_theme", event: "theme_changed", timeout: 100 }), !0;
@@ -2313,13 +2308,13 @@ async function rn() {
2313
2308
  return !1;
2314
2309
  }
2315
2310
  }
2316
- function Ts(e) {
2317
- return e instanceof U;
2311
+ function Ss(e) {
2312
+ return e instanceof $;
2318
2313
  }
2319
2314
  function on(e, t) {
2320
- return Ts(e) && e.type === t;
2315
+ return Ss(e) && e.type === t;
2321
2316
  }
2322
- function z(e, t) {
2317
+ function j(e, t) {
2323
2318
  let s, n, r;
2324
2319
  return typeof e == "string" ? s = e : (s = e.pathname === void 0 ? t : e.pathname, n = e.params, r = e.id), Object.freeze({
2325
2320
  id: r || (Math.random() * 2 ** 14 | 0).toString(16),
@@ -2327,23 +2322,23 @@ function z(e, t) {
2327
2322
  params: n
2328
2323
  });
2329
2324
  }
2330
- class As {
2325
+ class Rs {
2331
2326
  constructor(t, s, n = k) {
2332
- if (c(this, "history"), c(this, "ee", new L()), 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)
2333
- throw d(le, "History should not be empty.");
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.");
2334
2329
  if (s < 0 || s >= t.length)
2335
- throw d(
2336
- _e,
2330
+ throw w(
2331
+ le,
2337
2332
  "Index should not be zero and higher or equal than history size."
2338
2333
  );
2339
- this.history = t.map((r) => z(r, ""));
2334
+ this.history = t.map((r) => j(r, ""));
2340
2335
  }
2341
2336
  /**
2342
2337
  * Allows this navigator to control the `BackButton` visibility state. It also tracks the
2343
2338
  * `BackButton` clicks and calls the `back` method.
2344
2339
  */
2345
2340
  attach() {
2346
- this.attached || (this.attached = !0, this.sync(), b("back_button_pressed", this.back));
2341
+ this.attached || (this.attached = !0, this.sync(), v("back_button_pressed", this.back));
2347
2342
  }
2348
2343
  /**
2349
2344
  * Currently active history item.
@@ -2355,7 +2350,7 @@ class As {
2355
2350
  * Prevents current navigator from controlling the BackButton visibility state.
2356
2351
  */
2357
2352
  detach() {
2358
- this.attached = !1, j("back_button_pressed", this.back);
2353
+ this.attached = !1, H("back_button_pressed", this.back);
2359
2354
  }
2360
2355
  /**
2361
2356
  * Goes to the next history item.
@@ -2411,14 +2406,14 @@ class As {
2411
2406
  * @param item - item to add.
2412
2407
  */
2413
2408
  push(t) {
2414
- this.hasNext && this.history.splice(this.index + 1), this.replaceAndMove(this.index + 1, z(t, this.current.pathname));
2409
+ this.hasNext && this.history.splice(this.index + 1), this.replaceAndMove(this.index + 1, j(t, this.current.pathname));
2415
2410
  }
2416
2411
  /**
2417
2412
  * Replaces the current history item.
2418
2413
  * @param item - item to replace the current item with.
2419
2414
  */
2420
2415
  replace(t) {
2421
- this.replaceAndMove(this.index, z(t, this.current.pathname));
2416
+ this.replaceAndMove(this.index, j(t, this.current.pathname));
2422
2417
  }
2423
2418
  /**
2424
2419
  * Sets history item by the specified index.
@@ -2448,7 +2443,7 @@ class As {
2448
2443
  this.postEvent("web_app_setup_back_button", { is_visible: !!this.index });
2449
2444
  }
2450
2445
  }
2451
- function K({
2446
+ function G({
2452
2447
  params: e,
2453
2448
  ...t
2454
2449
  }) {
@@ -2457,26 +2452,26 @@ function K({
2457
2452
  function O(e, t) {
2458
2453
  return e.startsWith(t) ? e : `${t}${e}`;
2459
2454
  }
2460
- function M(e) {
2455
+ function V(e) {
2461
2456
  return new URL(
2462
2457
  typeof e == "string" ? e : `${e.pathname || ""}${O(e.search || "", "?")}${O(e.hash || "", "#")}`,
2463
2458
  "http://a"
2464
2459
  );
2465
2460
  }
2466
- function B(e) {
2467
- const t = typeof e == "string" ? e.startsWith("/") : !!(e.pathname && e.pathname.startsWith("/")), s = M(e);
2461
+ function M(e) {
2462
+ const t = typeof e == "string" ? e.startsWith("/") : !!(e.pathname && e.pathname.startsWith("/")), s = V(e);
2468
2463
  return `${t ? s.pathname : s.pathname.slice(1)}${s.search}${s.hash}`;
2469
2464
  }
2470
- function J(e, t, s) {
2465
+ function K(e, t, s) {
2471
2466
  let n, r;
2472
- typeof e == "string" ? n = e : (n = B(e), s = e.state, r = e.id);
2467
+ typeof e == "string" ? n = e : (n = M(e), s = e.state, r = e.id);
2473
2468
  const { pathname: i, search: o, hash: a } = new URL(n, `http://a${O(t, "/")}`);
2474
2469
  return { id: r, pathname: i, params: { hash: a, search: o, state: s } };
2475
2470
  }
2476
2471
  async function I(e) {
2477
2472
  return e === 0 ? !0 : Promise.race([
2478
2473
  new Promise((t) => {
2479
- const s = Z("popstate", () => {
2474
+ const s = F("popstate", () => {
2480
2475
  s(), t(!0);
2481
2476
  });
2482
2477
  window.history.go(e);
@@ -2487,39 +2482,39 @@ async function I(e) {
2487
2482
  })
2488
2483
  ]);
2489
2484
  }
2490
- async function Is() {
2485
+ async function Ts() {
2491
2486
  if (window.history.length <= 1 || (window.history.pushState(null, ""), await I(1 - window.history.length)))
2492
2487
  return;
2493
2488
  let e = await I(-1);
2494
2489
  for (; e; )
2495
2490
  e = await I(-1);
2496
2491
  }
2497
- function Kt(e) {
2498
- return M(e).pathname;
2492
+ function jt(e) {
2493
+ return V(e).pathname;
2499
2494
  }
2500
- const ft = 0, Q = 1, F = 2;
2501
- class Jt {
2502
- constructor(t, s, { postEvent: n, hashMode: r, base: i } = {}) {
2503
- c(this, "navigator"), c(this, "ee", new L()), c(this, "hashMode"), c(this, "base"), c(this, "attached", !1), c(this, "onPopState", ({ state: o }) => {
2495
+ const _t = 0, z = 1, J = 2;
2496
+ class Gt {
2497
+ 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 }) => {
2504
2499
  if (o === null)
2505
2500
  return this.push(this.parsePath(window.location.href));
2506
- o === ft ? window.history.forward() : o === Q && this.back(), o === F && this.forward();
2501
+ o === _t ? window.history.forward() : o === z && this.back(), o === J && this.forward();
2507
2502
  }), c(this, "onNavigatorChange", async ({
2508
2503
  to: o,
2509
2504
  from: a,
2510
- delta: h
2505
+ delta: p
2511
2506
  }) => {
2512
2507
  this.attached && await this.syncHistory(), this.ee.emit("change", {
2513
- delta: h,
2514
- from: K(a),
2515
- to: K(o),
2508
+ delta: p,
2509
+ from: G(a),
2510
+ to: G(o),
2516
2511
  navigator: this
2517
2512
  });
2518
- }), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this.navigator = new As(
2519
- t.map((o) => J(o, "/")),
2513
+ }), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this.navigator = new Rs(
2514
+ t.map((o) => K(o, "/")),
2520
2515
  s,
2521
2516
  n
2522
- ), this.navigator.on("change", this.onNavigatorChange), this.hashMode = r, this.base = Kt(i || "");
2517
+ ), this.navigator.on("change", this.onNavigatorChange), this.hashMode = r, this.base = jt(i || "");
2523
2518
  }
2524
2519
  /**
2525
2520
  * Attaches current navigator to the browser history allowing navigator to manipulate it.
@@ -2603,7 +2598,7 @@ class Jt {
2603
2598
  * Navigation history.
2604
2599
  */
2605
2600
  get history() {
2606
- return this.navigator.history.map(K);
2601
+ return this.navigator.history.map(G);
2607
2602
  }
2608
2603
  /**
2609
2604
  * Path, including pathname, search and hash.
@@ -2617,7 +2612,7 @@ class Jt {
2617
2612
  * "/pathname?search#hash"
2618
2613
  */
2619
2614
  get path() {
2620
- return B(this);
2615
+ return M(this);
2621
2616
  }
2622
2617
  /**
2623
2618
  * Current pathname. Always starts with the slash.
@@ -2646,19 +2641,19 @@ class Jt {
2646
2641
  * // { pathname: '/tma', search: '?is=cool', hash: '#yeah' }
2647
2642
  */
2648
2643
  parsePath(t) {
2649
- let s = M(t);
2650
- return this.hashMode && (s = M(s.hash.slice(1))), {
2644
+ let s = V(t);
2645
+ return this.hashMode && (s = V(s.hash.slice(1))), {
2651
2646
  pathname: s.pathname,
2652
2647
  search: s.search,
2653
2648
  hash: s.hash
2654
2649
  };
2655
2650
  }
2656
2651
  push(t, s) {
2657
- const n = J(t, this.path), { state: r = s } = n.params;
2652
+ const n = K(t, this.path), { state: r = s } = n.params;
2658
2653
  this.navigator.push({ ...n, params: { ...n.params, state: r } });
2659
2654
  }
2660
2655
  replace(t, s) {
2661
- const n = J(t, this.path), { state: r = s } = n.params;
2656
+ const n = K(t, this.path), { state: r = s } = n.params;
2662
2657
  this.navigator.replace({ ...n, params: { ...n.params, state: r } });
2663
2658
  }
2664
2659
  /**
@@ -2667,8 +2662,8 @@ class Jt {
2667
2662
  * @param value - path presented as string or URLLike.
2668
2663
  */
2669
2664
  renderPath(t) {
2670
- const s = (this.base.length === 1 ? "" : this.base) + O(B(t), "/");
2671
- return this.hashMode ? O(s.slice(1), this.hashMode === "default" ? "#" : "#/") : s;
2665
+ const s = (this.base.length === 1 ? "" : this.base) + O(M(t), "/");
2666
+ return this.hashMode ? O(s.slice(1), this.hashMode === "classic" ? "#" : "#/") : s;
2672
2667
  }
2673
2668
  /**
2674
2669
  * Synchronizes current navigator state with browser history.
@@ -2676,7 +2671,7 @@ class Jt {
2676
2671
  async syncHistory() {
2677
2672
  window.removeEventListener("popstate", this.onPopState);
2678
2673
  const { state: t } = this, s = this.renderPath(this);
2679
- await Is(), this.hasPrev && this.hasNext ? (window.history.replaceState(Q, ""), window.history.pushState(t, "", s), window.history.pushState(F, ""), await I(-1)) : this.hasPrev ? (window.history.replaceState(Q, ""), window.history.pushState(t, "", s)) : this.hasNext ? (window.history.replaceState(t, s), window.history.pushState(F, ""), await I(-1)) : (window.history.replaceState(ft, ""), window.history.pushState(t, "", s)), window.addEventListener("popstate", this.onPopState);
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);
2680
2675
  }
2681
2676
  /**
2682
2677
  * Current query parameters.
@@ -2694,109 +2689,121 @@ class Jt {
2694
2689
  return (this.navigator.current.params || {}).state;
2695
2690
  }
2696
2691
  }
2697
- function ks(e) {
2692
+ function As(e) {
2698
2693
  e || (e = {});
2699
2694
  const { href: t, hash: s } = window.location;
2700
- let n = B(
2701
- e.hashMode ? s.includes("?") ? s.slice(1) : `?${s.slice(1)}` : t
2695
+ let n = M(
2696
+ e.hashMode === null ? t : s.includes("?") ? s.slice(1) : `?${s.slice(1)}`
2702
2697
  );
2703
- const r = e.base ? Kt(e.base) : void 0;
2698
+ const r = e.base ? jt(e.base) : void 0;
2704
2699
  if (r) {
2705
2700
  if (!n.startsWith(r))
2706
- throw d(
2707
- fe,
2701
+ throw w(
2702
+ de,
2708
2703
  `Path "${n}" expected to be starting with "${r}"`
2709
2704
  );
2710
2705
  n = n.slice(r.length);
2711
2706
  }
2712
- return new Jt([n], 0, e);
2707
+ return new Gt([n], 0, e);
2713
2708
  }
2714
2709
  function an(e) {
2715
2710
  const t = e.match(/#(.+)/);
2716
2711
  return t ? t[1] : null;
2717
2712
  }
2718
- function Os(e, t) {
2719
- if (Ut()) {
2713
+ function Is(e, t) {
2714
+ if ($t()) {
2720
2715
  const s = sessionStorage.getItem(e);
2721
2716
  if (s)
2722
2717
  try {
2723
2718
  const { index: n, history: r } = JSON.parse(s);
2724
- return new Jt(r, n, t);
2719
+ return new Gt(r, n, t);
2725
2720
  } catch (n) {
2726
2721
  console.error("Unable to restore hash navigator state.", n);
2727
2722
  }
2728
2723
  }
2729
- return ks(t);
2724
+ return As(t);
2730
2725
  }
2731
2726
  function cn(e, t) {
2732
- const s = Os(e, t), n = () => sessionStorage.setItem(e, JSON.stringify({
2727
+ const s = Is(e, t), n = () => sessionStorage.setItem(e, JSON.stringify({
2733
2728
  index: s.index,
2734
2729
  history: s.history
2735
2730
  }));
2736
2731
  return s.on("change", n), n(), s;
2737
2732
  }
2738
2733
  function _(e) {
2739
- return (t, s, ...n) => (r) => mt(s, ht(() => ht({
2734
+ return (t, s, ...n) => (r) => gt(s, at(() => at({
2740
2735
  [t]: e(...n)
2741
2736
  }, r)));
2742
2737
  }
2743
- const Qt = Ft();
2744
- function qs() {
2745
- const e = Yt(Qt);
2738
+ const Kt = Qt();
2739
+ function ks() {
2740
+ const e = Ft(Kt);
2746
2741
  if (!e)
2747
2742
  throw new Error("useSDK was used outside of SDKProvider.");
2748
2743
  return e;
2749
2744
  }
2750
2745
  function g(e) {
2751
- return (...t) => qs()(e, ...t);
2746
+ return (...t) => {
2747
+ const s = ks()(e, ...t), n = () => s.signal();
2748
+ return Object.defineProperty(n, "error", () => s.error), n;
2749
+ };
2752
2750
  }
2753
- const Ns = g(Ge), hn = _(Ns), Ds = g(Ke), pn = _(Ds), Vs = g(Qe), un = _(Vs), Ms = g(ts), dn = _(Ms), Bs = g(ss), ln = _(Bs), $s = g(rs), _n = _($s), Ls = g(os), gn = _(Ls), Us = g(cs), fn = _(Us), Hs = g(ds), mn = _(Hs), Ws = g(gs), wn = _(Ws), js = g(ms), bn = _(js), Gs = g(bs), vn = _(Gs), zs = g(ys), yn = _(zs), Ks = g(Ps), En = _(Ks), Js = g(Cs), Pn = _(Js), xn = (e) => {
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) => {
2754
2752
  const t = /* @__PURE__ */ new Map(), s = (n, ...r) => {
2755
2753
  if (t.has(n))
2756
2754
  return t.get(n);
2757
- const [i] = Xt(() => {
2758
- try {
2759
- return n(...r);
2760
- } catch (h) {
2761
- return [h];
2762
- }
2763
- }), o = ut(() => {
2764
- if (i.error)
2765
- return [i.error];
2766
- if (i.state !== "ready")
2755
+ function i(l) {
2756
+ return t.set(n, l), l;
2757
+ }
2758
+ let o;
2759
+ try {
2760
+ o = n(...r);
2761
+ } catch (l) {
2762
+ return i({
2763
+ error: l,
2764
+ signal: () => {
2765
+ throw l;
2766
+ }
2767
+ });
2768
+ }
2769
+ let a;
2770
+ Array.isArray(o) && ([o, a] = o);
2771
+ const [p] = Yt(() => o), u = pt(() => {
2772
+ if (p.state !== "ready")
2767
2773
  return;
2768
- const h = i();
2769
- if (Array.isArray(h) || !h || !("on" in h))
2770
- return h;
2771
- const u = te((V) => (V(h), h.on("change", () => V(h)))), D = Object.getPrototypeOf(h), G = {};
2772
- return new Proxy(h, {
2773
- get(V, P) {
2774
- if (!(P in G)) {
2775
- const ct = Reflect.getOwnPropertyDescriptor(D, P);
2776
- G[P] = ct && "get" in ct ? ut(() => u()[P]) : () => Reflect.get(V, P);
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);
2777
2783
  }
2778
- return G[P]();
2784
+ return W[x]();
2779
2785
  }
2780
2786
  });
2781
2787
  });
2782
- function a() {
2783
- const h = o();
2784
- if (Array.isArray(h))
2785
- throw h[0];
2786
- return h;
2787
- }
2788
- return Object.defineProperty(a, "error", {
2789
- get() {
2790
- const h = o();
2791
- return Array.isArray(h) ? h[0] : void 0;
2792
- }
2793
- }), t.set(n, a), a;
2788
+ return i({
2789
+ signal() {
2790
+ if (p.error)
2791
+ throw p.error;
2792
+ return u();
2793
+ },
2794
+ get error() {
2795
+ return p.error;
2796
+ },
2797
+ cleanup: a
2798
+ });
2794
2799
  };
2795
- return pt(() => {
2796
- ie(e.debug || !1);
2797
- }), pt(() => {
2798
- St() && Zt(Rs(e.acceptCustomStyles));
2799
- }), mt(Qt.Provider, {
2800
+ return ct(() => {
2801
+ ne(e.debug || !1);
2802
+ }), ct(() => {
2803
+ Pt() && ht(Cs(e.acceptCustomStyles));
2804
+ }), ht(() => {
2805
+ t.forEach((n) => n.cleanup && n.cleanup());
2806
+ }), gt(Kt.Provider, {
2800
2807
  value: s,
2801
2808
  get children() {
2802
2809
  return e.children;
@@ -2804,129 +2811,128 @@ const Ns = g(Ge), hn = _(Ns), Ds = g(Ke), pn = _(Ds), Vs = g(Qe), un = _(Vs), Ms
2804
2811
  });
2805
2812
  };
2806
2813
  export {
2807
- Oe as BackButton,
2808
- As as BasicNavigator,
2809
- _t as BiometryManager,
2810
- Jt as BrowserNavigator,
2811
- Je as ClosingBehavior,
2812
- Xe as CloudStorage,
2813
- fe as ERR_INVALID_PATH_BASE,
2814
- pe as ERR_INVOKE_CUSTOM_METHOD_RESPONSE,
2815
- ce as ERR_METHOD_PARAMETER_UNSUPPORTED,
2816
- ae as ERR_METHOD_UNSUPPORTED,
2817
- le as ERR_NAVIGATION_HISTORY_EMPTY,
2818
- _e as ERR_NAVIGATION_INDEX_INVALID,
2819
- Fs as ERR_NAVIGATION_ITEM_INVALID,
2820
- vt as ERR_PARSE,
2821
- tt as ERR_SSR_INIT,
2822
- ge as ERR_SSR_POST_EVENT,
2823
- ue as ERR_TIMED_OUT,
2824
- de as ERR_UNEXPECTED_TYPE,
2825
- he as ERR_UNKNOWN_ENV,
2826
- L as EventEmitter,
2827
- es as HapticFeedback,
2828
- ns as InitData,
2829
- is as Invoice,
2830
- as as MainButton,
2831
- us as MiniApp,
2832
- _s as Popup,
2833
- fs as QRScanner,
2834
- U as SDKError,
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,
2838
+ ds as Popup,
2839
+ gs as QRScanner,
2840
+ $ as SDKError,
2835
2841
  xn as SDKProvider,
2836
- ws as SettingsButton,
2837
- vs as ThemeParams,
2838
- Es as Utils,
2839
- zt as Viewport,
2840
- Ze as array,
2841
- en as bindMiniAppCSSVars,
2842
- sn as bindThemeParamsCSSVars,
2843
- nn as bindViewportCSSVars,
2844
- v as boolean,
2845
- Rt as captureSameReq,
2846
- X as classNames,
2847
- Re as compareVersions,
2848
- ks as createBrowserNavigatorFromLocation,
2849
- Ie as createPostEvent,
2850
- M as createSafeURL,
2851
- Ot as date,
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,
2850
+ 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,
2852
2858
  an as getHash,
2853
- Kt as getPathname,
2854
- Ge as initBackButton,
2859
+ jt as getPathname,
2860
+ We as initBackButton,
2855
2861
  Ke as initBiometryManager,
2856
- Qe as initClosingBehavior,
2857
- ts as initCloudStorage,
2858
- ss as initHapticFeedback,
2859
- rs as initInitData,
2860
- os as initInvoice,
2861
- cs as initMainButton,
2862
- ds as initMiniApp,
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,
2863
2869
  cn as initNavigator,
2864
- gs as initPopup,
2865
- ms as initQRScanner,
2866
- bs as initSettingsButton,
2867
- ys as initThemeParams,
2868
- Ps as initUtils,
2869
- Cs as initViewport,
2870
- Rs as initWeb,
2870
+ _s as initPopup,
2871
+ fs as initQRScanner,
2872
+ ws as initSettingsButton,
2873
+ vs as initThemeParams,
2874
+ Es as initUtils,
2875
+ xs as initViewport,
2876
+ Cs as initWeb,
2871
2877
  A as invokeCustomMethod,
2872
- It as isColorDark,
2873
- St as isIframe,
2874
- Ut as isPageReload,
2875
- st as isRGB,
2876
- me as isRGBShort,
2877
- Ts as isSDKError,
2878
+ Tt as isColorDark,
2879
+ Pt as isIframe,
2880
+ $t as isPageReload,
2881
+ tt as isRGB,
2882
+ _e as isRGBShort,
2883
+ Ss as isSDKError,
2878
2884
  on as isSDKErrorOfType,
2879
- S as isSSR,
2885
+ nn as isSSR,
2880
2886
  rn as isTMA,
2881
2887
  f as json,
2882
- Zs as mergeClassNames,
2883
- E as number,
2884
- j as off,
2885
- b as on,
2886
- Xs as parseInitData,
2887
- Dt as parseLaunchParams,
2888
- jt as parseThemeParams,
2888
+ Ys as mergeClassNames,
2889
+ P as number,
2890
+ H as off,
2891
+ v as on,
2892
+ Zs as parseInitData,
2893
+ qt as parseLaunchParams,
2894
+ Ht as parseThemeParams,
2889
2895
  k as postEvent,
2890
2896
  m as request,
2891
- ze as requestBiometryInfo,
2892
- tn as requestThemeParams,
2893
- Gt as requestViewport,
2894
- He as retrieveLaunchParams,
2895
- Pt as rgb,
2896
- it as searchParams,
2897
- Le as serializeLaunchParams,
2898
- $e as serializeThemeParams,
2899
- y as setCSSVar,
2900
- ie as setDebug,
2901
- Ys as setTargetOrigin,
2902
- p as string,
2903
- ne as subscribe,
2904
- x as supports,
2905
- Ae as targetOrigin,
2906
- Et as toRGB,
2907
- bt as unsubscribe,
2908
- B as urlToPath,
2909
- Ns as useBackButton,
2910
- Ds as useBiometryManager,
2911
- Vs as useClosingBehavior,
2912
- Ms as useCloudStorage,
2913
- Bs as useHapticFeedback,
2914
- $s as useInitData,
2915
- Ls as useInvoice,
2916
- Us as useMainButton,
2917
- Hs as useMiniApp,
2918
- Ws as usePopup,
2919
- js as useQRScanner,
2920
- qs as useSDK,
2921
- Gs as useSettingsButton,
2922
- zs as useThemeParams,
2923
- Ks as useUtils,
2924
- Js as useViewport,
2897
+ Ge as requestBiometryInfo,
2898
+ Xs as requestThemeParams,
2899
+ Wt as requestViewport,
2900
+ $e as retrieveLaunchParams,
2901
+ yt as rgb,
2902
+ nt as searchParams,
2903
+ Me as serializeLaunchParams,
2904
+ Ve as serializeThemeParams,
2905
+ E as setCSSVar,
2906
+ ne as setDebug,
2907
+ 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,
2915
+ Os as useBackButton,
2916
+ qs as useBiometryManager,
2917
+ Ds as useClosingBehavior,
2918
+ 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,
2925
+ Hs as useQRScanner,
2926
+ ks as useSDK,
2927
+ Ws as useSettingsButton,
2928
+ js as useThemeParams,
2929
+ Gs as useUtils,
2930
+ Ks as useViewport,
2925
2931
  hn as withBackButton,
2926
2932
  pn as withBiometryManager,
2927
2933
  un as withClosingBehavior,
2928
- dn as withCloudStorage,
2929
- ln as withHapticFeedback,
2934
+ ln as withCloudStorage,
2935
+ dn as withHapticFeedback,
2930
2936
  _n as withInitData,
2931
2937
  gn as withInvoice,
2932
2938
  fn as withMainButton,
@@ -2935,7 +2941,7 @@ export {
2935
2941
  bn as withQRScanner,
2936
2942
  vn as withSettingsButton,
2937
2943
  yn as withThemeParams,
2938
- At as withTimeout,
2944
+ Rt as withTimeout,
2939
2945
  En as withUtils,
2940
2946
  Pn as withViewport
2941
2947
  };