@tma.js/sdk-solid 2.1.5 → 2.1.6

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,18 +1,18 @@
1
- import { createComponent as mt, mergeProps as pt, createContext as ee, useContext as se, createEffect as ut, onCleanup as dt, createResource as ne, createMemo as lt, from as re } from "solid-js";
1
+ import { createComponent as bt, mergeProps as ut, createContext as ee, useContext as se, createEffect as dt, onCleanup as lt, createResource as ne, createMemo as _t, from as re } from "solid-js";
2
2
  var ie = Object.defineProperty, oe = (e, t, s) => t in e ? ie(e, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : e[t] = s, c = (e, t, s) => (oe(e, typeof t != "symbol" ? t + "" : t, s), s);
3
- function bt(e, t) {
3
+ function vt(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 vt(e) {
10
+ function yt(e) {
11
11
  const t = H(), { count: s } = t;
12
12
  t.unsubscribe(e), s && !t.count && Se();
13
13
  }
14
14
  function ae(e) {
15
- return H().subscribe(e), () => vt(e);
15
+ return H().subscribe(e), () => yt(e);
16
16
  }
17
17
  class ce {
18
18
  constructor(t, s = {}) {
@@ -59,16 +59,16 @@ const X = new ce("SDK", {
59
59
  textColor: "white"
60
60
  });
61
61
  let F = !1;
62
- const _t = ({ name: e, payload: t }) => {
62
+ const gt = ({ name: e, payload: t }) => {
63
63
  X.log("Event received:", t ? { name: e, payload: t } : { name: e });
64
64
  };
65
65
  function he(e) {
66
- F !== e && (F = e, e ? ae(_t) : vt(_t));
66
+ F !== e && (F = e, e ? ae(gt) : yt(gt));
67
67
  }
68
68
  function pe(...e) {
69
69
  F && X.log(...e);
70
70
  }
71
- class O {
71
+ class k {
72
72
  constructor() {
73
73
  c(this, "listeners", /* @__PURE__ */ new Map()), c(this, "listenersCount", 0), c(this, "subscribeListeners", []);
74
74
  }
@@ -141,7 +141,7 @@ class O {
141
141
  function Q(e, t, s) {
142
142
  return window.addEventListener(e, t, s), () => window.removeEventListener(e, t, s);
143
143
  }
144
- function yt(...e) {
144
+ function tt(...e) {
145
145
  let t = !1;
146
146
  const s = [...e];
147
147
  return [
@@ -225,7 +225,7 @@ function Pt(e, t) {
225
225
  }
226
226
  return s;
227
227
  }
228
- function tt(e) {
228
+ function et(e) {
229
229
  let t = e;
230
230
  if (typeof t == "string" && (t = JSON.parse(t)), typeof t != "object" || t === null || Array.isArray(t))
231
231
  throw S();
@@ -233,7 +233,7 @@ function tt(e) {
233
233
  }
234
234
  function f(e, t) {
235
235
  return new L((s) => {
236
- const n = tt(s);
236
+ const n = et(s);
237
237
  return Pt(e, (r) => n[r]);
238
238
  }, !1, t);
239
239
  }
@@ -247,7 +247,7 @@ const P = T((e) => {
247
247
  }
248
248
  throw S();
249
249
  }, "number");
250
- function et(e) {
250
+ function st(e) {
251
251
  return /^#[\da-f]{6}$/i.test(e);
252
252
  }
253
253
  function ve(e) {
@@ -255,7 +255,7 @@ function ve(e) {
255
255
  }
256
256
  function xt(e) {
257
257
  const t = e.replace(/\s/g, "").toLowerCase();
258
- if (et(t))
258
+ if (st(t))
259
259
  return t;
260
260
  if (ve(t)) {
261
261
  let n = "#";
@@ -336,7 +336,7 @@ const Pe = {
336
336
  theme_changed: f({
337
337
  theme_params: (e) => {
338
338
  const t = Ct().optional();
339
- return Object.entries(tt(e)).reduce((s, [n, r]) => (s[n] = t.parse(r), s), {});
339
+ return Object.entries(et(e)).reduce((s, [n, r]) => (s[n] = t.parse(r), s), {});
340
340
  }
341
341
  }),
342
342
  viewport_changed: f({
@@ -348,11 +348,11 @@ const Pe = {
348
348
  write_access_requested: f({ status: p() })
349
349
  };
350
350
  function xe() {
351
- const e = new O(), t = new O();
351
+ const e = new k(), t = new k();
352
352
  t.subscribe((n) => {
353
353
  e.emit("event", { name: n.event, payload: n.args[0] });
354
354
  }), Ee();
355
- const [, s] = yt(
355
+ const [, s] = tt(
356
356
  // Don't forget to remove created handlers.
357
357
  ye,
358
358
  // Add "resize" event listener to make sure, we always have fresh viewport information.
@@ -409,7 +409,7 @@ function xe() {
409
409
  }
410
410
  }, s];
411
411
  }
412
- const [Ce, Se] = bt(
412
+ const [Ce, Se] = vt(
413
413
  (e) => {
414
414
  const [t, s] = xe(), n = t.off.bind(t);
415
415
  return t.off = (r, i) => {
@@ -500,7 +500,7 @@ function Tt(e) {
500
500
  function Rt(e) {
501
501
  return "TelegramWebviewProxy" in e && N(e.TelegramWebviewProxy) && "postEvent" in e.TelegramWebviewProxy && typeof e.TelegramWebviewProxy.postEvent == "function";
502
502
  }
503
- function st() {
503
+ function nt() {
504
504
  try {
505
505
  return window.self !== window.top;
506
506
  } catch {
@@ -518,7 +518,7 @@ function q(e, t, s) {
518
518
  let n = {}, r;
519
519
  t === void 0 && s === void 0 ? n = {} : t !== void 0 && s !== void 0 ? (n = s, r = t) : t !== void 0 && ("targetOrigin" in t ? n = t : r = t);
520
520
  const { targetOrigin: i = Re() } = n;
521
- if (pe("Posting event:", r ? { event: e, data: r } : { event: e }), st()) {
521
+ if (pe("Posting event:", r ? { event: e, data: r } : { event: e }), nt()) {
522
522
  window.parent.postMessage(JSON.stringify({ eventType: e, eventData: r }), i);
523
523
  return;
524
524
  }
@@ -553,7 +553,7 @@ function Ae(e) {
553
553
  function It(e) {
554
554
  return ({ req_id: t }) => t === e;
555
555
  }
556
- function Ot(e) {
556
+ function kt(e) {
557
557
  return m(ge, `Timeout reached: ${e}ms`);
558
558
  }
559
559
  function qt(e, t) {
@@ -561,28 +561,24 @@ function qt(e, t) {
561
561
  typeof e == "function" ? e() : e,
562
562
  new Promise((s, n) => {
563
563
  setTimeout(() => {
564
- n(Ot(t));
564
+ n(kt(t));
565
565
  }, t);
566
566
  })
567
567
  ]);
568
568
  }
569
569
  async function w(e) {
570
570
  let t;
571
- const s = new Promise((u) => {
572
- t = u;
573
- }), {
574
- method: n,
575
- event: r,
576
- capture: i,
577
- postEvent: o = q,
578
- timeout: a
579
- } = e, h = (Array.isArray(r) ? r : [r]).map(
580
- (u) => v(u, (d) => (!i || i(d)) && t(d))
571
+ const s = new Promise((a) => {
572
+ t = a;
573
+ }), { event: n, capture: r, timeout: i } = e, [, o] = tt(
574
+ ...(Array.isArray(n) ? n : [n]).map(
575
+ (a) => v(a, (h) => (!r || r(h)) && t(h))
576
+ )
581
577
  );
582
578
  try {
583
- return o(n, e.params), await (a ? qt(s, a) : s);
579
+ return (e.postEvent || q)(e.method, e.params), await (i ? qt(s, i) : s);
584
580
  } finally {
585
- h.forEach((u) => u());
581
+ o();
586
582
  }
587
583
  }
588
584
  async function A(e, t, s, n = {}) {
@@ -620,7 +616,7 @@ function Qs(...e) {
620
616
  i.length && (t[n] = i);
621
617
  }), t), {});
622
618
  }
623
- function kt(e) {
619
+ function Ot(e) {
624
620
  const t = xt(e);
625
621
  return Math.sqrt(
626
622
  [0.299, 0.587, 0.114].reduce((s, n, r) => {
@@ -631,7 +627,7 @@ function kt(e) {
631
627
  }
632
628
  class Ie {
633
629
  constructor(t) {
634
- c(this, "ee", new O()), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this.state = t;
630
+ c(this, "ee", new k()), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this.state = t;
635
631
  }
636
632
  /**
637
633
  * Clones current state and returns its copy.
@@ -650,7 +646,7 @@ class Ie {
650
646
  return this.state[t];
651
647
  }
652
648
  }
653
- class nt {
649
+ class rt {
654
650
  constructor(t) {
655
651
  c(this, "state"), c(this, "get"), c(this, "set"), c(this, "clone"), this.state = new Ie(t), this.set = this.state.set.bind(this.state), this.get = this.state.get.bind(this.state), this.clone = this.state.clone.bind(this.state);
656
652
  }
@@ -658,12 +654,12 @@ class nt {
658
654
  function Nt(e, t) {
659
655
  return (s) => x(t[s], e);
660
656
  }
661
- class rt extends nt {
657
+ class it extends rt {
662
658
  constructor(t, s, n) {
663
659
  super(t), c(this, "supports"), this.supports = Nt(s, n);
664
660
  }
665
661
  }
666
- class Oe extends rt {
662
+ class ke extends it {
667
663
  constructor(t, s, n) {
668
664
  super({ isVisible: t }, s, {
669
665
  show: "web_app_setup_back_button",
@@ -693,7 +689,7 @@ class Oe extends rt {
693
689
  }
694
690
  }
695
691
  const Dt = T((e) => e instanceof Date ? e : new Date(P().parse(e) * 1e3), "Date");
696
- function it(e, t) {
692
+ function ot(e, t) {
697
693
  return new L((s) => {
698
694
  if (typeof s != "string" && !(s instanceof URLSearchParams))
699
695
  throw S();
@@ -713,7 +709,7 @@ const qe = f({
713
709
  from: "photo_url"
714
710
  },
715
711
  username: p().optional()
716
- }, "Chat").optional(), gt = f({
712
+ }, "Chat").optional(), ft = f({
717
713
  addedToAttachmentMenu: {
718
714
  type: y().optional(),
719
715
  from: "added_to_attachment_menu"
@@ -750,7 +746,7 @@ const qe = f({
750
746
  username: p().optional()
751
747
  }, "User").optional();
752
748
  function Vt() {
753
- return it({
749
+ return ot({
754
750
  authDate: {
755
751
  type: Dt(),
756
752
  from: "auth_date"
@@ -773,15 +769,15 @@ function Vt() {
773
769
  type: p().optional(),
774
770
  from: "query_id"
775
771
  },
776
- receiver: gt,
772
+ receiver: ft,
777
773
  startParam: {
778
774
  type: p().optional(),
779
775
  from: "start_param"
780
776
  },
781
- user: gt
777
+ user: ft
782
778
  }, "InitData");
783
779
  }
784
- function ke(e) {
780
+ function Oe(e) {
785
781
  return e.replace(/_[a-z]/g, (t) => t[1].toUpperCase());
786
782
  }
787
783
  function Ne(e) {
@@ -790,12 +786,12 @@ function Ne(e) {
790
786
  const Mt = T(
791
787
  (e) => {
792
788
  const t = Ct().optional();
793
- return Object.entries(tt(e)).reduce((s, [n, r]) => (s[ke(n)] = t.parse(r), s), {});
789
+ return Object.entries(et(e)).reduce((s, [n, r]) => (s[Oe(n)] = t.parse(r), s), {});
794
790
  },
795
791
  "ThemeParams"
796
792
  );
797
- function ot(e) {
798
- return it({
793
+ function at(e) {
794
+ return ot({
799
795
  botInline: {
800
796
  type: y().optional(),
801
797
  from: "tgWebAppBotInline"
@@ -831,7 +827,7 @@ function ot(e) {
831
827
  }).parse(e);
832
828
  }
833
829
  function Bt(e) {
834
- return ot(
830
+ return at(
835
831
  e.replace(/^[^?#]*[?#]/, "").replace(/[?#]/g, "&")
836
832
  );
837
833
  }
@@ -861,7 +857,7 @@ function Ut(e) {
861
857
  }
862
858
  }
863
859
  function Me() {
864
- return ot(Ut("launchParams") || "");
860
+ return at(Ut("launchParams") || "");
865
861
  }
866
862
  function Wt(e) {
867
863
  return JSON.stringify(
@@ -910,7 +906,7 @@ function Le() {
910
906
  let e = 0;
911
907
  return () => (e += 1).toString();
912
908
  }
913
- const [He] = bt(Le);
909
+ const [He] = vt(Le);
914
910
  function l(e, t) {
915
911
  return () => {
916
912
  const s = $e(), n = {
@@ -920,7 +916,7 @@ function l(e, t) {
920
916
  };
921
917
  if (typeof e == "function")
922
918
  return e(n);
923
- const [r, i, o] = yt(), a = t({
919
+ const [r, i, o] = tt(), a = t({
924
920
  ...n,
925
921
  // State should only be passed only in case, current page was reloaded. If we don't add
926
922
  // this check, state restoration will work improperly in the web version of Telegram,
@@ -942,8 +938,8 @@ const Ue = l("backButton", ({
942
938
  postEvent: e,
943
939
  version: t,
944
940
  state: s = { isVisible: !1 }
945
- }) => new Oe(s.isVisible, t, e));
946
- class D extends rt {
941
+ }) => new ke(s.isVisible, t, e));
942
+ class D extends it {
947
943
  constructor() {
948
944
  super(...arguments), c(this, "on", this.state.on.bind(this.state)), c(this, "off", this.state.off.bind(this.state));
949
945
  }
@@ -1099,12 +1095,12 @@ const Ge = l(
1099
1095
  postEvent: e
1100
1096
  })
1101
1097
  );
1102
- class at extends nt {
1098
+ class ct extends rt {
1103
1099
  constructor() {
1104
1100
  super(...arguments), c(this, "on", this.state.on.bind(this.state)), c(this, "off", this.state.off.bind(this.state));
1105
1101
  }
1106
1102
  }
1107
- class Ke extends at {
1103
+ class Ke extends ct {
1108
1104
  constructor(t, s) {
1109
1105
  super({ isConfirmationNeeded: t }), this.postEvent = s;
1110
1106
  }
@@ -1138,7 +1134,7 @@ const ze = l(
1138
1134
  state: t = { isConfirmationNeeded: !1 }
1139
1135
  }) => new Ke(t.isConfirmationNeeded, e)
1140
1136
  );
1141
- class ct {
1137
+ class ht {
1142
1138
  constructor(t, s) {
1143
1139
  c(this, "supports"), this.supports = Nt(t, s);
1144
1140
  }
@@ -1176,10 +1172,10 @@ class Fe extends L {
1176
1172
  function Qe(e) {
1177
1173
  return new Fe((t) => t, !1, e);
1178
1174
  }
1179
- function ft(e, t) {
1175
+ function wt(e, t) {
1180
1176
  return Object.fromEntries(e.map((s) => [s, t]));
1181
1177
  }
1182
- class Ye extends ct {
1178
+ class Ye extends ht {
1183
1179
  constructor(t, s, n) {
1184
1180
  super(t, {
1185
1181
  delete: "web_app_invoke_custom_method",
@@ -1219,13 +1215,13 @@ class Ye extends ct {
1219
1215
  async get(t, s = {}) {
1220
1216
  const n = Array.isArray(t) ? t : [t];
1221
1217
  if (!n.length)
1222
- return ft(n, "");
1218
+ return wt(n, "");
1223
1219
  const r = await A(
1224
1220
  "getStorageValues",
1225
1221
  { keys: n },
1226
1222
  this.createRequestId(),
1227
1223
  { ...s, postEvent: this.postEvent }
1228
- ), i = f(ft(n, p()), "CloudStorageData").parse(r);
1224
+ ), i = f(wt(n, p()), "CloudStorageData").parse(r);
1229
1225
  return Array.isArray(t) ? i : i[t];
1230
1226
  }
1231
1227
  /**
@@ -1246,7 +1242,7 @@ class Ye extends ct {
1246
1242
  const Ze = l(
1247
1243
  ({ createRequestId: e, postEvent: t, version: s }) => new Ye(s, e, t)
1248
1244
  );
1249
- class Xe extends ct {
1245
+ class Xe extends ht {
1250
1246
  constructor(t, s) {
1251
1247
  super(t, {
1252
1248
  impactOccurred: "web_app_trigger_haptic_feedback",
@@ -1417,7 +1413,7 @@ class ns extends D {
1417
1413
  const rs = l(
1418
1414
  ({ version: e, postEvent: t }) => new ns(!1, e, t)
1419
1415
  );
1420
- class is extends nt {
1416
+ class is extends rt {
1421
1417
  constructor({ postEvent: t, ...s }) {
1422
1418
  super(s), c(this, "postEvent"), c(this, "on", (n, r) => n === "click" ? v("main_button_pressed", r) : this.state.on(n, r)), c(this, "off", (n, r) => n === "click" ? U("main_button_pressed", r) : this.state.off(n, r)), this.postEvent = t;
1423
1419
  }
@@ -1564,7 +1560,7 @@ const os = l(
1564
1560
  }) => new is({ ...s, postEvent: e })
1565
1561
  );
1566
1562
  function as() {
1567
- return it({
1563
+ return ot({
1568
1564
  contact: f({
1569
1565
  userId: {
1570
1566
  type: P(),
@@ -1662,7 +1658,7 @@ class hs extends D {
1662
1658
  * True if current Mini App background color is recognized as dark.
1663
1659
  */
1664
1660
  get isDark() {
1665
- return kt(this.bgColor);
1661
+ return Ot(this.bgColor);
1666
1662
  }
1667
1663
  /**
1668
1664
  * Informs the Telegram app that the Mini App is ready to be displayed.
@@ -1699,7 +1695,7 @@ class hs extends D {
1699
1695
  }
1700
1696
  await cs(n), n += 50;
1701
1697
  }
1702
- throw Ot(t);
1698
+ throw kt(t);
1703
1699
  }, t);
1704
1700
  }
1705
1701
  /**
@@ -1754,7 +1750,7 @@ class hs extends D {
1754
1750
  * @param color - color key or RGB color.
1755
1751
  */
1756
1752
  setHeaderColor(t) {
1757
- this.postEvent("web_app_set_header_color", et(t) ? { color: t } : { color_key: t }), this.set("headerColor", t);
1753
+ this.postEvent("web_app_set_header_color", st(t) ? { color: t } : { color_key: t }), this.set("headerColor", t);
1758
1754
  }
1759
1755
  /**
1760
1756
  * Updates current Mini App background color.
@@ -1884,32 +1880,31 @@ class _s extends D {
1884
1880
  get isOpened() {
1885
1881
  return this.get("isOpened");
1886
1882
  }
1887
- /**
1888
- * Opens scanner with specified title shown to user. Method returns promise
1889
- * with scanned QR content in case, it was scanned. It will contain null in
1890
- * case, scanner was closed.
1891
- * @param text - title to display.
1892
- */
1893
1883
  async open(t) {
1894
1884
  if (this.isOpened)
1895
1885
  throw new Error("QR scanner is already opened.");
1886
+ const { text: s, capture: n } = (typeof t == "string" ? { text: t } : t) || {};
1896
1887
  this.isOpened = !0;
1897
1888
  try {
1898
- return (await w({
1889
+ const r = (await w({
1899
1890
  method: "web_app_open_scan_qr_popup",
1900
1891
  event: ["qr_text_received", "scan_qr_popup_closed"],
1901
1892
  postEvent: this.postEvent,
1902
- params: { text: t }
1893
+ params: { text: s },
1894
+ capture(i) {
1895
+ return i.event === "scan_qr_popup_closed" || !n || n(i.payload);
1896
+ }
1903
1897
  }) || {}).data || null;
1904
- } finally {
1905
- this.isOpened = !1;
1898
+ return r && this.close(), r;
1899
+ } catch (r) {
1900
+ throw this.isOpened = !1, r;
1906
1901
  }
1907
1902
  }
1908
1903
  }
1909
1904
  const gs = l(
1910
1905
  ({ version: e, postEvent: t }) => new _s(!1, e, t)
1911
1906
  );
1912
- class fs extends rt {
1907
+ class fs extends it {
1913
1908
  constructor(t, s, n) {
1914
1909
  super({ isVisible: t }, s, {
1915
1910
  show: "web_app_setup_settings_button",
@@ -1949,7 +1944,7 @@ const ws = l(
1949
1944
  function Jt(e) {
1950
1945
  return Mt().parse(e);
1951
1946
  }
1952
- class ms extends at {
1947
+ class ms extends ct {
1953
1948
  /**
1954
1949
  * @since v6.10
1955
1950
  */
@@ -1988,7 +1983,7 @@ class ms extends at {
1988
1983
  * value is calculated according to theme bg color.
1989
1984
  */
1990
1985
  get isDark() {
1991
- return !this.bgColor || kt(this.bgColor);
1986
+ return !this.bgColor || Ot(this.bgColor);
1992
1987
  }
1993
1988
  get linkColor() {
1994
1989
  return this.get("linkColor");
@@ -2041,7 +2036,7 @@ function Zs(e = {}) {
2041
2036
  event: "theme_changed"
2042
2037
  }).then(Jt);
2043
2038
  }
2044
- class vs extends ct {
2039
+ class vs extends ht {
2045
2040
  constructor(t, s, n) {
2046
2041
  super(t, { readTextFromClipboard: "web_app_read_text_from_clipboard" }), c(this, "supportsParam"), this.version = t, this.createRequestId = s, this.postEvent = n, this.supportsParam = zt(t, {
2047
2042
  "openLink.tryInstantView": ["web_app_open_link", "try_instant_view"]
@@ -2120,7 +2115,7 @@ async function Ft(e = {}) {
2120
2115
  function R(e) {
2121
2116
  return e < 0 ? 0 : e;
2122
2117
  }
2123
- class Es extends at {
2118
+ class Es extends ct {
2124
2119
  constructor({ postEvent: t, stableHeight: s, height: n, width: r, isExpanded: i }) {
2125
2120
  super({
2126
2121
  height: R(n),
@@ -2256,7 +2251,7 @@ function Xs(e, t, s) {
2256
2251
  s || (s = (a) => `--tg-${a}-color`);
2257
2252
  const n = s("header"), r = s("bg"), i = () => {
2258
2253
  const { headerColor: a } = e;
2259
- if (et(a))
2254
+ if (st(a))
2260
2255
  E(n, a);
2261
2256
  else {
2262
2257
  const { bgColor: h, secondaryBgColor: u } = t;
@@ -2321,7 +2316,7 @@ async function nn() {
2321
2316
  }
2322
2317
  }
2323
2318
  function rn(e) {
2324
- const t = typeof e == "string" ? ot(e) : e;
2319
+ const t = typeof e == "string" ? at(e) : e;
2325
2320
  jt(t);
2326
2321
  function s(r) {
2327
2322
  if (typeof r == "string")
@@ -2338,7 +2333,7 @@ function rn(e) {
2338
2333
  } catch {
2339
2334
  }
2340
2335
  }
2341
- if (st()) {
2336
+ if (nt()) {
2342
2337
  const r = window.parent.postMessage.bind(window.parent);
2343
2338
  window.parent.postMessage = (i) => {
2344
2339
  s(i), r(i);
@@ -2376,7 +2371,7 @@ function j(e, t) {
2376
2371
  }
2377
2372
  class Ss {
2378
2373
  constructor(t, s, n = q) {
2379
- if (c(this, "history"), c(this, "ee", new O()), c(this, "attached", !1), c(this, "back", () => this.go(-1)), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this._index = s, this.postEvent = n, t.length === 0)
2374
+ if (c(this, "history"), c(this, "ee", new k()), c(this, "attached", !1), c(this, "back", () => this.go(-1)), c(this, "on", this.ee.on.bind(this.ee)), c(this, "off", this.ee.off.bind(this.ee)), this._index = s, this.postEvent = n, t.length === 0)
2380
2375
  throw m(we, "History should not be empty.");
2381
2376
  if (s < 0 || s >= t.length)
2382
2377
  throw m(
@@ -2501,12 +2496,12 @@ function G({
2501
2496
  }) {
2502
2497
  return { ...e || { hash: "", search: "" }, ...t };
2503
2498
  }
2504
- function k(e, t) {
2499
+ function O(e, t) {
2505
2500
  return e.startsWith(t) ? e : `${t}${e}`;
2506
2501
  }
2507
2502
  function M(e) {
2508
2503
  return new URL(
2509
- typeof e == "string" ? e : `${e.pathname || ""}${k(e.search || "", "?")}${k(e.hash || "", "#")}`,
2504
+ typeof e == "string" ? e : `${e.pathname || ""}${O(e.search || "", "?")}${O(e.hash || "", "#")}`,
2510
2505
  "http://a"
2511
2506
  );
2512
2507
  }
@@ -2517,7 +2512,7 @@ function B(e) {
2517
2512
  function K(e, t, s) {
2518
2513
  let n, r;
2519
2514
  typeof e == "string" ? n = e : (n = B(e), s = e.state, r = e.id);
2520
- const { pathname: i, search: o, hash: a } = new URL(n, `http://a${k(t, "/")}`);
2515
+ const { pathname: i, search: o, hash: a } = new URL(n, `http://a${O(t, "/")}`);
2521
2516
  return { id: r, pathname: i, params: { hash: a, search: o, state: s } };
2522
2517
  }
2523
2518
  async function I(e) {
@@ -2544,13 +2539,13 @@ async function Ts() {
2544
2539
  function Qt(e) {
2545
2540
  return M(e).pathname;
2546
2541
  }
2547
- const wt = 0, z = 1, J = 2;
2542
+ const mt = 0, z = 1, J = 2;
2548
2543
  class Yt {
2549
2544
  constructor(t, s, { postEvent: n, hashMode: r = "classic", base: i } = {}) {
2550
- c(this, "navigator"), c(this, "ee", new O()), c(this, "hashMode"), c(this, "base"), c(this, "attached", !1), c(this, "onPopState", ({ state: o }) => {
2545
+ c(this, "navigator"), c(this, "ee", new k()), c(this, "hashMode"), c(this, "base"), c(this, "attached", !1), c(this, "onPopState", ({ state: o }) => {
2551
2546
  if (o === null)
2552
2547
  return this.push(this.parsePath(window.location.href));
2553
- o === wt ? window.history.forward() : o === z && this.back(), o === J && this.forward();
2548
+ o === mt ? window.history.forward() : o === z && this.back(), o === J && this.forward();
2554
2549
  }), c(this, "onNavigatorChange", async ({
2555
2550
  to: o,
2556
2551
  from: a,
@@ -2714,8 +2709,8 @@ class Yt {
2714
2709
  * @param value - path presented as string or URLLike.
2715
2710
  */
2716
2711
  renderPath(t) {
2717
- const s = (this.base.length === 1 ? "" : this.base) + k(B(t), "/");
2718
- return this.hashMode ? k(s.slice(1), this.hashMode === "classic" ? "#" : "#/") : s;
2712
+ const s = (this.base.length === 1 ? "" : this.base) + O(B(t), "/");
2713
+ return this.hashMode ? O(s.slice(1), this.hashMode === "classic" ? "#" : "#/") : s;
2719
2714
  }
2720
2715
  /**
2721
2716
  * Synchronizes current navigator state with browser history.
@@ -2723,7 +2718,7 @@ class Yt {
2723
2718
  async syncHistory() {
2724
2719
  window.removeEventListener("popstate", this.onPopState);
2725
2720
  const { state: t } = this, s = this.renderPath(this);
2726
- await Ts(), this.hasPrev && this.hasNext ? (window.history.replaceState(z, ""), window.history.pushState(t, "", s), window.history.pushState(J, ""), await I(-1)) : this.hasPrev ? (window.history.replaceState(z, ""), window.history.pushState(t, "", s)) : this.hasNext ? (window.history.replaceState(t, s), window.history.pushState(J, ""), await I(-1)) : (window.history.replaceState(wt, ""), window.history.pushState(t, "", s)), window.addEventListener("popstate", this.onPopState);
2721
+ 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(mt, ""), window.history.pushState(t, "", s)), window.addEventListener("popstate", this.onPopState);
2727
2722
  }
2728
2723
  /**
2729
2724
  * Current query parameters.
@@ -2783,7 +2778,7 @@ function cn(e, t) {
2783
2778
  return s.on("change", n), n(), s;
2784
2779
  }
2785
2780
  function _(e) {
2786
- return (t, s, ...n) => (r) => mt(s, pt(() => pt({
2781
+ return (t, s, ...n) => (r) => bt(s, ut(() => ut({
2787
2782
  [t]: e(...n)
2788
2783
  }, r)));
2789
2784
  }
@@ -2800,7 +2795,7 @@ function g(e) {
2800
2795
  return Object.defineProperty(n, "error", () => s.error), n;
2801
2796
  };
2802
2797
  }
2803
- const Os = g(Ue), hn = _(Os), qs = g(Ge), pn = _(qs), ks = g(ze), un = _(ks), Ns = g(Ze), dn = _(Ns), Ds = g(ts), ln = _(Ds), Vs = g(ss), _n = _(Vs), Ms = g(rs), gn = _(Ms), Bs = g(os), fn = _(Bs), $s = g(ps), wn = _($s), Ls = g(ls), mn = _(Ls), Hs = g(gs), bn = _(Hs), Us = g(ws), vn = _(Us), Ws = g(bs), yn = _(Ws), js = g(ys), En = _(js), Gs = g(Ps), Pn = _(Gs), xn = (e) => {
2798
+ const ks = g(Ue), hn = _(ks), qs = g(Ge), pn = _(qs), Os = g(ze), un = _(Os), Ns = g(Ze), dn = _(Ns), Ds = g(ts), ln = _(Ds), Vs = g(ss), _n = _(Vs), Ms = g(rs), gn = _(Ms), Bs = g(os), fn = _(Bs), $s = g(ps), wn = _($s), Ls = g(ls), mn = _(Ls), Hs = g(gs), bn = _(Hs), Us = g(ws), vn = _(Us), Ws = g(bs), yn = _(Ws), js = g(ys), En = _(js), Gs = g(Ps), Pn = _(Gs), xn = (e) => {
2804
2799
  const t = /* @__PURE__ */ new Map(), s = (n, ...r) => {
2805
2800
  if (t.has(n))
2806
2801
  return t.get(n);
@@ -2820,7 +2815,7 @@ const Os = g(Ue), hn = _(Os), qs = g(Ge), pn = _(qs), ks = g(ze), un = _(ks), Ns
2820
2815
  }
2821
2816
  let a;
2822
2817
  Array.isArray(o) && ([o, a] = o);
2823
- const [h] = ne(() => o), u = lt(() => {
2818
+ const [h] = ne(() => o), u = _t(() => {
2824
2819
  if (h.state !== "ready")
2825
2820
  return;
2826
2821
  const d = h();
@@ -2830,8 +2825,8 @@ const Os = g(Ue), hn = _(Os), qs = g(Ge), pn = _(qs), ks = g(ze), un = _(ks), Ns
2830
2825
  return new Proxy(d, {
2831
2826
  get(V, C) {
2832
2827
  if (!(C in W)) {
2833
- const ht = Reflect.getOwnPropertyDescriptor(te, C);
2834
- W[C] = ht && "get" in ht ? lt(() => Xt()[C]) : () => Reflect.get(V, C);
2828
+ const pt = Reflect.getOwnPropertyDescriptor(te, C);
2829
+ W[C] = pt && "get" in pt ? _t(() => Xt()[C]) : () => Reflect.get(V, C);
2835
2830
  }
2836
2831
  return W[C]();
2837
2832
  }
@@ -2849,13 +2844,13 @@ const Os = g(Ue), hn = _(Os), qs = g(Ge), pn = _(qs), ks = g(ze), un = _(ks), Ns
2849
2844
  cleanup: a
2850
2845
  });
2851
2846
  };
2852
- return ut(() => {
2847
+ return dt(() => {
2853
2848
  he(e.debug || !1);
2854
- }), ut(() => {
2855
- st() && dt(xs(e.acceptCustomStyles));
2856
2849
  }), dt(() => {
2850
+ nt() && lt(xs(e.acceptCustomStyles));
2851
+ }), lt(() => {
2857
2852
  t.forEach((n) => n.cleanup && n.cleanup());
2858
- }), mt(Zt.Provider, {
2853
+ }), bt(Zt.Provider, {
2859
2854
  value: s,
2860
2855
  get children() {
2861
2856
  return e.children;
@@ -2863,7 +2858,7 @@ const Os = g(Ue), hn = _(Os), qs = g(Ge), pn = _(qs), ks = g(ze), un = _(ks), Ns
2863
2858
  });
2864
2859
  };
2865
2860
  export {
2866
- Oe as BackButton,
2861
+ ke as BackButton,
2867
2862
  Ss as BasicNavigator,
2868
2863
  We as BiometryManager,
2869
2864
  Yt as BrowserNavigator,
@@ -2881,7 +2876,7 @@ export {
2881
2876
  ge as ERR_TIMED_OUT,
2882
2877
  fe as ERR_UNEXPECTED_TYPE,
2883
2878
  le as ERR_UNKNOWN_ENV,
2884
- O as EventEmitter,
2879
+ k as EventEmitter,
2885
2880
  Xe as HapticFeedback,
2886
2881
  es as InitData,
2887
2882
  ns as Invoice,
@@ -2927,10 +2922,10 @@ export {
2927
2922
  Ps as initViewport,
2928
2923
  xs as initWeb,
2929
2924
  A as invokeCustomMethod,
2930
- kt as isColorDark,
2931
- st as isIframe,
2925
+ Ot as isColorDark,
2926
+ nt as isIframe,
2932
2927
  Gt as isPageReload,
2933
- et as isRGB,
2928
+ st as isRGB,
2934
2929
  ve as isRGBShort,
2935
2930
  Cs as isSDKError,
2936
2931
  on as isSDKErrorOfType,
@@ -2943,7 +2938,7 @@ export {
2943
2938
  U as off,
2944
2939
  v as on,
2945
2940
  Ys as parseInitData,
2946
- ot as parseLaunchParams,
2941
+ at as parseLaunchParams,
2947
2942
  Jt as parseThemeParams,
2948
2943
  q as postEvent,
2949
2944
  w as request,
@@ -2952,7 +2947,7 @@ export {
2952
2947
  Ft as requestViewport,
2953
2948
  $e as retrieveLaunchParams,
2954
2949
  Ct as rgb,
2955
- it as searchParams,
2950
+ ot as searchParams,
2956
2951
  Be as serializeLaunchParams,
2957
2952
  Wt as serializeThemeParams,
2958
2953
  E as setCSSVar,
@@ -2963,11 +2958,11 @@ export {
2963
2958
  x as supports,
2964
2959
  Re as targetOrigin,
2965
2960
  xt as toRGB,
2966
- vt as unsubscribe,
2961
+ yt as unsubscribe,
2967
2962
  B as urlToPath,
2968
- Os as useBackButton,
2963
+ ks as useBackButton,
2969
2964
  qs as useBiometryManager,
2970
- ks as useClosingBehavior,
2965
+ Os as useClosingBehavior,
2971
2966
  Ns as useCloudStorage,
2972
2967
  Ds as useHapticFeedback,
2973
2968
  Vs as useInitData,