@vbotma/sdk 3.1.8

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.
Files changed (145) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +64 -0
  3. package/dist/dts/composables/AsyncMountable.d.ts +44 -0
  4. package/dist/dts/composables/Button.d.ts +140 -0
  5. package/dist/dts/composables/Mountable.d.ts +43 -0
  6. package/dist/dts/composables/Stateful.d.ts +35 -0
  7. package/dist/dts/errors.d.ts +51 -0
  8. package/dist/dts/features/BackButton/BackButton.d.ts +96 -0
  9. package/dist/dts/features/BackButton/exports.d.ts +2 -0
  10. package/dist/dts/features/BackButton/instance.d.ts +2 -0
  11. package/dist/dts/features/Biometry/Biometry.d.ts +121 -0
  12. package/dist/dts/features/Biometry/exports.d.ts +3 -0
  13. package/dist/dts/features/Biometry/instance.d.ts +2 -0
  14. package/dist/dts/features/Biometry/types.d.ts +84 -0
  15. package/dist/dts/features/ClosingBehavior/ClosingBehavior.d.ts +51 -0
  16. package/dist/dts/features/ClosingBehavior/exports.d.ts +2 -0
  17. package/dist/dts/features/ClosingBehavior/instance.d.ts +2 -0
  18. package/dist/dts/features/CloudStorage/CloudStorage.d.ts +90 -0
  19. package/dist/dts/features/CloudStorage/exports.d.ts +2 -0
  20. package/dist/dts/features/CloudStorage/instance.d.ts +2 -0
  21. package/dist/dts/features/DeviceStorage/DeviceStorage.d.ts +53 -0
  22. package/dist/dts/features/DeviceStorage/exports.d.ts +2 -0
  23. package/dist/dts/features/DeviceStorage/instance.d.ts +2 -0
  24. package/dist/dts/features/HapticFeedback/HapticFeedback.d.ts +57 -0
  25. package/dist/dts/features/HapticFeedback/exports.d.ts +2 -0
  26. package/dist/dts/features/HapticFeedback/instance.d.ts +2 -0
  27. package/dist/dts/features/InitData/InitData.d.ts +87 -0
  28. package/dist/dts/features/InitData/exports.d.ts +2 -0
  29. package/dist/dts/features/InitData/instance.d.ts +2 -0
  30. package/dist/dts/features/Invoice/Invoice.d.ts +54 -0
  31. package/dist/dts/features/Invoice/exports.d.ts +2 -0
  32. package/dist/dts/features/Invoice/instance.d.ts +2 -0
  33. package/dist/dts/features/LocationManager/LocationManager.d.ts +73 -0
  34. package/dist/dts/features/LocationManager/exports.d.ts +3 -0
  35. package/dist/dts/features/LocationManager/instance.d.ts +2 -0
  36. package/dist/dts/features/LocationManager/types.d.ts +65 -0
  37. package/dist/dts/features/MainButton/MainButton.d.ts +214 -0
  38. package/dist/dts/features/MainButton/exports.d.ts +2 -0
  39. package/dist/dts/features/MainButton/instance.d.ts +2 -0
  40. package/dist/dts/features/MiniApp/MiniApp.d.ts +192 -0
  41. package/dist/dts/features/MiniApp/exports.d.ts +2 -0
  42. package/dist/dts/features/MiniApp/instance.d.ts +2 -0
  43. package/dist/dts/features/Notification/Notification.d.ts +21 -0
  44. package/dist/dts/features/Notification/exports.d.ts +3 -0
  45. package/dist/dts/features/Notification/instance.d.ts +2 -0
  46. package/dist/dts/features/Notification/types.d.ts +19 -0
  47. package/dist/dts/features/Popup/Popup.d.ts +56 -0
  48. package/dist/dts/features/Popup/exports.d.ts +3 -0
  49. package/dist/dts/features/Popup/instance.d.ts +2 -0
  50. package/dist/dts/features/Popup/prepareParams.d.ts +9 -0
  51. package/dist/dts/features/Popup/types.d.ts +54 -0
  52. package/dist/dts/features/QrScanner/QrScanner.d.ts +131 -0
  53. package/dist/dts/features/QrScanner/exports.d.ts +2 -0
  54. package/dist/dts/features/QrScanner/instance.d.ts +2 -0
  55. package/dist/dts/features/Refresh/Refresh.d.ts +39 -0
  56. package/dist/dts/features/Refresh/exports.d.ts +3 -0
  57. package/dist/dts/features/Refresh/instance.d.ts +2 -0
  58. package/dist/dts/features/Refresh/types.d.ts +7 -0
  59. package/dist/dts/features/SecondaryButton/SecondaryButton.d.ts +253 -0
  60. package/dist/dts/features/SecondaryButton/exports.d.ts +2 -0
  61. package/dist/dts/features/SecondaryButton/instance.d.ts +2 -0
  62. package/dist/dts/features/SecureStorage/SecureStorage.d.ts +68 -0
  63. package/dist/dts/features/SecureStorage/exports.d.ts +2 -0
  64. package/dist/dts/features/SecureStorage/instance.d.ts +2 -0
  65. package/dist/dts/features/SettingsButton/SettingsButton.d.ts +96 -0
  66. package/dist/dts/features/SettingsButton/exports.d.ts +2 -0
  67. package/dist/dts/features/SettingsButton/instance.d.ts +2 -0
  68. package/dist/dts/features/StoragePermission/StoragePermission.d.ts +45 -0
  69. package/dist/dts/features/StoragePermission/exports.d.ts +3 -0
  70. package/dist/dts/features/StoragePermission/instance.d.ts +2 -0
  71. package/dist/dts/features/StoragePermission/types.d.ts +51 -0
  72. package/dist/dts/features/SwipeBehavior/SwipeBehavior.d.ts +62 -0
  73. package/dist/dts/features/SwipeBehavior/exports.d.ts +2 -0
  74. package/dist/dts/features/SwipeBehavior/instance.d.ts +2 -0
  75. package/dist/dts/features/ThemeParams/ThemeParams.d.ts +127 -0
  76. package/dist/dts/features/ThemeParams/exports.d.ts +2 -0
  77. package/dist/dts/features/ThemeParams/instance.d.ts +2 -0
  78. package/dist/dts/features/Viewport/Viewport.d.ts +219 -0
  79. package/dist/dts/features/Viewport/exports.d.ts +2 -0
  80. package/dist/dts/features/Viewport/instance.d.ts +2 -0
  81. package/dist/dts/features/emoji-status/exports.d.ts +2 -0
  82. package/dist/dts/features/emoji-status/requestEmojiStatusAccess.d.ts +16 -0
  83. package/dist/dts/features/emoji-status/setEmojiStatus.d.ts +28 -0
  84. package/dist/dts/features/home-screen/addToHomeScreen.d.ts +11 -0
  85. package/dist/dts/features/home-screen/checkHomeScreenStatus.d.ts +14 -0
  86. package/dist/dts/features/home-screen/exports.d.ts +2 -0
  87. package/dist/dts/features/links/exports.d.ts +3 -0
  88. package/dist/dts/features/links/openLink.d.ts +31 -0
  89. package/dist/dts/features/links/openTelegramLink.d.ts +18 -0
  90. package/dist/dts/features/links/shareURL.d.ts +18 -0
  91. package/dist/dts/features/privacy/exports.d.ts +3 -0
  92. package/dist/dts/features/privacy/requestContact.d.ts +59 -0
  93. package/dist/dts/features/privacy/requestPhoneAccess.d.ts +19 -0
  94. package/dist/dts/features/privacy/requestWriteAccess.d.ts +14 -0
  95. package/dist/dts/features/uncategorized/copyTextToClipboard.d.ts +5 -0
  96. package/dist/dts/features/uncategorized/downloadFile.d.ts +21 -0
  97. package/dist/dts/features/uncategorized/exports.d.ts +11 -0
  98. package/dist/dts/features/uncategorized/getCurrentTime.d.ts +15 -0
  99. package/dist/dts/features/uncategorized/hideKeyboard.d.ts +13 -0
  100. package/dist/dts/features/uncategorized/readTextFromClipboard.d.ts +13 -0
  101. package/dist/dts/features/uncategorized/retrieveAndroidDeviceData.d.ts +6 -0
  102. package/dist/dts/features/uncategorized/retrieveAndroidDeviceDataFrom.d.ts +14 -0
  103. package/dist/dts/features/uncategorized/sendData.d.ts +20 -0
  104. package/dist/dts/features/uncategorized/shareMessage.d.ts +14 -0
  105. package/dist/dts/features/uncategorized/shareStory.d.ts +50 -0
  106. package/dist/dts/features/uncategorized/switchInlineQuery.d.ts +28 -0
  107. package/dist/dts/fn-options/bottomButtonOptions.d.ts +11 -0
  108. package/dist/dts/fn-options/buttonOptions.d.ts +10 -0
  109. package/dist/dts/fn-options/createFnOption.d.ts +2 -0
  110. package/dist/dts/fn-options/sharedFeatureOptions.d.ts +8 -0
  111. package/dist/dts/fn-options/withCreateRequestId.d.ts +7 -0
  112. package/dist/dts/fn-options/withInvokeCustomMethod.d.ts +11 -0
  113. package/dist/dts/fn-options/withPostEvent.d.ts +8 -0
  114. package/dist/dts/fn-options/withRequest.d.ts +8 -0
  115. package/dist/dts/fn-options/withStateRestore.d.ts +13 -0
  116. package/dist/dts/fn-options/withVersion.d.ts +9 -0
  117. package/dist/dts/globals/createRequestId.d.ts +4 -0
  118. package/dist/dts/globals/invokeCustomMethod.d.ts +16 -0
  119. package/dist/dts/globals/isInlineMode.d.ts +4 -0
  120. package/dist/dts/globals/postEvent.d.ts +4 -0
  121. package/dist/dts/globals/request.d.ts +13 -0
  122. package/dist/dts/globals/resetGlobals.d.ts +4 -0
  123. package/dist/dts/globals/signals-registry.d.ts +39 -0
  124. package/dist/dts/globals/themeParams.d.ts +4 -0
  125. package/dist/dts/globals/version.d.ts +4 -0
  126. package/dist/dts/helpers/access.d.ts +2 -0
  127. package/dist/dts/helpers/component-storage.d.ts +9 -0
  128. package/dist/dts/helpers/createIsSupportedSignal.d.ts +5 -0
  129. package/dist/dts/helpers/css-vars.d.ts +11 -0
  130. package/dist/dts/helpers/isColorDark.d.ts +11 -0
  131. package/dist/dts/helpers/navigation.d.ts +5 -0
  132. package/dist/dts/helpers/removeUndefined.d.ts +10 -0
  133. package/dist/dts/helpers/shallowEqual.d.ts +1 -0
  134. package/dist/dts/index.d.ts +38 -0
  135. package/dist/dts/init.d.ts +42 -0
  136. package/dist/dts/types.d.ts +6 -0
  137. package/dist/dts/with-checks/throwifyWithChecksFp.d.ts +3 -0
  138. package/dist/dts/with-checks/withChecksFp.d.ts +170 -0
  139. package/dist/index.cjs +2 -0
  140. package/dist/index.cjs.map +1 -0
  141. package/dist/index.iife.js +4 -0
  142. package/dist/index.iife.js.map +1 -0
  143. package/dist/index.js +4088 -0
  144. package/dist/index.js.map +1 -0
  145. package/package.json +54 -0
package/dist/index.js ADDED
@@ -0,0 +1,4088 @@
1
+ var at = Object.defineProperty;
2
+ var pt = (r, t, s) => t in r ? at(r, t, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[t] = s;
3
+ var e = (r, t, s) => pt(r, typeof t != "symbol" ? t + "" : t, s);
4
+ import { batch as ue, signal as O, computed as w } from "@vbotma/signals";
5
+ import { supports as ee, isVBMAFp as ut, postEventFp as ke, off as re, on as G, request2Fp as je, requestFp as ct, invokeCustomMethodFp as lt, retrieveLaunchParamsFp as ce, retrieveRawInitDataFp as ht, captureSameReq as dt, logger as Pe } from "@vbotma/bridge";
6
+ import { CancelledError as Rn, InvalidLaunchParamsError as Ln, InvokeCustomMethodFailedError as $n, LaunchParamsRetrieveError as Pn, MethodParameterUnsupportedError as On, MethodUnsupportedError as Dn, TimeoutError as Gn, UnknownEnvError as jn, applyPolyfills as Un, createLogger as Wn, createPostEvent as Hn, createStartParam as zn, createStartParamFp as Kn, debug as Nn, decodeBase64Url as Qn, decodeBase64UrlFp as Jn, decodeStartParam as Yn, decodeStartParamFp as Zn, deepSnakeToCamelObjKeys as Xn, emitEvent as ei, encodeBase64Url as ti, getReleaseVersion as si, isSafeToCreateStartParam as ri, isVBMA as ni, isVBMAFp as ii, logger as oi, mockVBotEnv as ai, off as pi, offAll as ui, on as ci, retrieveLaunchParams as li, retrieveLaunchParamsFp as hi, retrieveRawInitData as di, retrieveRawInitDataFp as fi, retrieveRawLaunchParams as _i, retrieveRawLaunchParamsFp as mi, setDebug as bi, setTargetOrigin as gi, supports as Fi, targetOrigin as wi } from "@vbotma/bridge";
7
+ import { throwifyFpFn as he, throwifyAnyEither as Ue, setStorageValue as ft, getStorageValue as _t, snakeToKebab as mt, createCbCollector as ye, camelToKebab as We, BetterTaskEither as ge } from "@vbotma/toolkit";
8
+ import { BetterPromise as He } from "better-promises";
9
+ import { toRGBFullFp as bt, isRGB as fe, pipeQueryToSchema as gt, pipeJsonToSchema as Ft } from "@vbotma/transformers";
10
+ import { isAnyRGB as Si, isRGB as vi, isRGBA as ki, isRGBAShort as yi, isRGBShort as Ii, parseInitDataQuery as Ei, parseInitDataQueryFp as qi, parseLaunchParamsQuery as Ai, parseLaunchParamsQueryFp as Bi, serializeInitDataQuery as xi, serializeLaunchParamsQuery as Mi, toRGB as Vi, toRGBFp as Ti, toRGBFull as Ri, toRGBFullFp as Li } from "@vbotma/transformers";
11
+ import { either as b, function as p, option as N, taskEither as c } from "fp-ts";
12
+ import { errorClass as j, errorClassWithData as Ie } from "error-kid";
13
+ import { parse as Oe, record as wt, string as K, array as Ct, safeParse as Fe, looseObject as De, pipe as ze, transform as Ke, date as Ne, optional as St, number as Qe, integer as vt } from "valibot";
14
+ function $(r) {
15
+ return typeof r == "function" ? r() : r;
16
+ }
17
+ class ne {
18
+ constructor({
19
+ onMounted: t,
20
+ restoreState: s,
21
+ initialState: n,
22
+ onUnmounted: i,
23
+ isPageReload: a
24
+ }) {
25
+ e(this, "_isMounted", O(!1));
26
+ /**
27
+ * Signal indicating if the component is mounted.
28
+ */
29
+ e(this, "isMounted", w(this._isMounted));
30
+ /**
31
+ * Mounts the component restoring its state and calling required side effects.
32
+ */
33
+ e(this, "mount");
34
+ /**
35
+ * Unmounts the component.
36
+ */
37
+ e(this, "unmount");
38
+ this.mount = () => {
39
+ if (this.isMounted())
40
+ return b.right(void 0);
41
+ const u = $(a) ? s() : void 0, o = u ? b.right(u) : typeof n == "function" ? n() : b.right(n);
42
+ return p.pipe(o, b.map((l) => {
43
+ ue(() => {
44
+ this._isMounted.set(!0), t == null || t(l);
45
+ });
46
+ }));
47
+ }, this.unmount = () => {
48
+ this._isMounted() && ue(() => {
49
+ this._isMounted.set(!1), i == null || i();
50
+ });
51
+ };
52
+ }
53
+ }
54
+ function we(r) {
55
+ const t = {};
56
+ for (const s in r) {
57
+ const n = r[s];
58
+ n !== void 0 && (t[s] = n);
59
+ }
60
+ return t;
61
+ }
62
+ function _e(r, t) {
63
+ const s = Object.keys(r), n = Object.keys(t);
64
+ return s.length !== n.length ? !1 : s.every((i) => Object.prototype.hasOwnProperty.call(t, i) && r[i] === t[i]);
65
+ }
66
+ class J {
67
+ constructor({ initialState: t, onChange: s }) {
68
+ e(this, "_state");
69
+ /**
70
+ * The current state.
71
+ */
72
+ e(this, "state");
73
+ /**
74
+ * Updates the state.
75
+ * @param state - updates to apply.
76
+ */
77
+ e(this, "setState", (t) => {
78
+ const s = { ...this.state(), ...we(t) };
79
+ _e(s, this.state()) || this._state.set(s);
80
+ });
81
+ this._state = O(t, { equals: _e }), this.state = w(this._state), this.state.sub(s);
82
+ }
83
+ /**
84
+ * Creates a computed signal based on the state.
85
+ * @param key - a state key to use as a source.
86
+ */
87
+ getter(t) {
88
+ return w(() => this._state()[t]);
89
+ }
90
+ /**
91
+ * @returns True if specified payload will update the state.
92
+ * @param state
93
+ */
94
+ hasDiff(t) {
95
+ return !_e({ ...this.state(), ...we(t) }, this.state());
96
+ }
97
+ }
98
+ function H(r, t) {
99
+ return w(() => ee(r, $(t)));
100
+ }
101
+ // @__NO_SIDE_EFFECTS__
102
+ function h(r) {
103
+ return Object.assign(he(r), {
104
+ ifAvailable(...t) {
105
+ return p.pipe(
106
+ r.ifAvailable(...t),
107
+ N.match(
108
+ () => ({ ok: !1 }),
109
+ (s) => ({
110
+ ok: !0,
111
+ data: Ue(s)
112
+ })
113
+ )
114
+ );
115
+ }
116
+ });
117
+ }
118
+ function X(r) {
119
+ return [r];
120
+ }
121
+ class pe extends (/* @__PURE__ */ Ie(
122
+ "ValidationError",
123
+ (t, s) => ({ input: t, issues: s }),
124
+ "Validation error"
125
+ )) {
126
+ }
127
+ class Ee extends (/* @__PURE__ */ j(
128
+ "CSSVarsBoundError",
129
+ "CSS variables are already bound"
130
+ )) {
131
+ }
132
+ class kt extends (/* @__PURE__ */ Ie("DeviceStorageMethodError", (t) => ({ error: t }), (t) => [t])) {
133
+ }
134
+ class yt extends (/* @__PURE__ */ Ie("SecureStorageMethodError", (t) => ({ error: t }), (t) => [t])) {
135
+ }
136
+ class It extends (/* @__PURE__ */ j(
137
+ "NotAvailableError",
138
+ X
139
+ )) {
140
+ }
141
+ class Gr extends (/* @__PURE__ */ j(
142
+ "InvalidEnvError",
143
+ X
144
+ )) {
145
+ }
146
+ class Et extends (/* @__PURE__ */ j(
147
+ "FunctionNotAvailableError",
148
+ X
149
+ )) {
150
+ }
151
+ class W extends (/* @__PURE__ */ j(
152
+ "InvalidArgumentsError",
153
+ (t, s) => [t, { cause: s }]
154
+ )) {
155
+ }
156
+ class qe extends (/* @__PURE__ */ j(
157
+ "ConcurrentCallError",
158
+ X
159
+ )) {
160
+ }
161
+ class qt extends (/* @__PURE__ */ j(
162
+ "SetEmojiStatusError",
163
+ (t) => [`Failed to set emoji status: ${t}`]
164
+ )) {
165
+ }
166
+ class Je extends (/* @__PURE__ */ j(
167
+ "AccessDeniedError",
168
+ X
169
+ )) {
170
+ }
171
+ class At extends (/* @__PURE__ */ j(
172
+ "FullscreenFailedError",
173
+ X
174
+ )) {
175
+ }
176
+ class Bt extends (/* @__PURE__ */ j(
177
+ "ShareMessageError",
178
+ X
179
+ )) {
180
+ }
181
+ class xt extends (/* @__PURE__ */ j(
182
+ "UnknownThemeParamsKeyError",
183
+ (t) => [`Unknown theme params key passed: ${t}`]
184
+ )) {
185
+ }
186
+ function A(r, t) {
187
+ const s = w(() => $(t.version) || "100"), n = w(() => $(t.isTma)), { requires: i, returns: a } = t, u = i ? typeof i == "object" ? i : { every: [i] } : void 0, o = (m) => {
188
+ if (!t.supports)
189
+ return !0;
190
+ const g = t.supports[m];
191
+ return ee(g.method, g.param, s());
192
+ }, l = () => {
193
+ if (!u)
194
+ return;
195
+ const [m, g] = "every" in u ? ["every", u.every] : ["some", u.some];
196
+ for (let d = 0; d < g.length; d++) {
197
+ const B = g[d], T = typeof B == "function" ? B() : ee(B, s()) ? void 0 : `it is unsupported in Mini Apps version ${s()}`;
198
+ if (T && (m === "every" || d === g.length - 1))
199
+ return T;
200
+ }
201
+ }, _ = (...m) => {
202
+ for (const g in t.supports)
203
+ if (t.supports[g].shouldCheck(...m) && !o(g))
204
+ return `option ${g} is not supported in Mini Apps version ${s()}`;
205
+ }, F = w(() => !l()), f = w(() => s() !== "0.0"), v = w(() => t.isMounted ? t.isMounted() : !0), C = w(
206
+ () => n() && f() && F() && v()
207
+ ), k = (m) => {
208
+ const g = new Et(m);
209
+ return ["task", "promise"].includes(t.returns) ? c.left(g) : b.left(g);
210
+ }, y = (...m) => a === "plain" ? b.tryCatch(() => r(...m), (g) => g) : a === "promise" ? c.tryCatch(() => r(...m), (g) => g) : r(...m);
211
+ return Object.assign(
212
+ (...m) => {
213
+ var T;
214
+ const g = "Unable to call function:";
215
+ if (!n())
216
+ return k(`${g} it can't be called outside Mini Apps`);
217
+ if (!f())
218
+ return k(`${g} the SDK was not initialized. Use the SDK init() function`);
219
+ const d = l();
220
+ if (d)
221
+ return k(`${g} ${d}`);
222
+ const B = _(...m);
223
+ if (B)
224
+ return k(`${g} ${B}`);
225
+ if (!v()) {
226
+ const M = (T = t.isMounting) != null && T.call(t) ? "mounting. Wait for the mount completion" : "unmounted. Use the mount() method";
227
+ return k(`${g} the component is ${M}`);
228
+ }
229
+ return y(...m);
230
+ },
231
+ r,
232
+ {
233
+ isAvailable: C,
234
+ ifAvailable(...m) {
235
+ return C() ? N.some(y(...m)) : N.none;
236
+ }
237
+ },
238
+ u ? { isSupported: F } : {},
239
+ t.supports ? { supports: o } : {}
240
+ );
241
+ }
242
+ function E(r) {
243
+ return (t) => A(t, r);
244
+ }
245
+ class de {
246
+ constructor({
247
+ isTma: t,
248
+ storage: s,
249
+ onClick: n,
250
+ offClick: i,
251
+ initialState: a,
252
+ isPageReload: u,
253
+ postEvent: o,
254
+ payload: l,
255
+ method: _,
256
+ version: F
257
+ }) {
258
+ /**
259
+ * Signal indicating if the component is currently mounted.
260
+ */
261
+ e(this, "isMounted");
262
+ /**
263
+ * Signal indicating if the component is supported.
264
+ */
265
+ e(this, "isSupported");
266
+ /**
267
+ * Complete button state.
268
+ */
269
+ e(this, "state");
270
+ /**
271
+ * @returns A setter with checks for the specified key.
272
+ * @param key
273
+ */
274
+ e(this, "stateSetters");
275
+ /**
276
+ * @returns Setters with checks to set a specified boolean key.
277
+ * @param key
278
+ */
279
+ e(this, "stateBoolSetters");
280
+ /**
281
+ * Updates the button state.
282
+ */
283
+ e(this, "setStateFp");
284
+ /**
285
+ * @see setStateFp
286
+ */
287
+ e(this, "setState");
288
+ /**
289
+ * Adds a new button listener.
290
+ * @param listener - event listener.
291
+ * @param once - should the listener be called only once.
292
+ * @returns A function to remove bound listener.
293
+ * @example
294
+ * const off = button.onClick(() => {
295
+ * console.log('User clicked the button');
296
+ * off();
297
+ * });
298
+ */
299
+ e(this, "onClickFp");
300
+ /**
301
+ * @see onClickFp
302
+ */
303
+ e(this, "onClick");
304
+ /**
305
+ * Removes the button click listener.
306
+ * @param listener - event listener.
307
+ * @param once - should the listener be called only once.
308
+ * @example
309
+ * function listener() {
310
+ * console.log('User clicked the button');
311
+ * button.offClick(listener);
312
+ * }
313
+ * button.onClick(listener);
314
+ */
315
+ e(this, "offClickFp");
316
+ /**
317
+ * @see offClickFp
318
+ */
319
+ e(this, "offClick");
320
+ /**
321
+ * Mounts the component restoring its state.
322
+ * @since Mini Apps v6.1
323
+ */
324
+ e(this, "mountFp");
325
+ /**
326
+ * @see mountFp
327
+ */
328
+ e(this, "mount");
329
+ /**
330
+ * Unmounts the component.
331
+ *
332
+ * Note that this function does not remove listeners added via the `onClick`
333
+ * function, so you have to remove them on your own.
334
+ * @see onClick
335
+ */
336
+ e(this, "unmount");
337
+ const f = new J({
338
+ initialState: a,
339
+ onChange(m) {
340
+ s.set(m);
341
+ }
342
+ }), v = new ne({
343
+ initialState: a,
344
+ isPageReload: u,
345
+ onMounted: f.setState,
346
+ restoreState: s.get
347
+ }), C = { version: F, requires: _, isTma: t }, k = E({
348
+ ...C,
349
+ returns: "plain"
350
+ }), y = E({
351
+ ...C,
352
+ returns: "either",
353
+ isMounted: v.isMounted
354
+ });
355
+ this.isMounted = v.isMounted, this.isSupported = H(_, F), this.state = f.state, this.setStateFp = y((m) => {
356
+ const g = { ...this.state(), ...we(m) };
357
+ return f.hasDiff(g) ? p.pipe(
358
+ o(_, l(g)),
359
+ b.map(() => {
360
+ f.setState(g);
361
+ })
362
+ ) : b.right(void 0);
363
+ }), this.setState = /* @__PURE__ */ h(this.setStateFp), this.onClickFp = k(n), this.onClick = /* @__PURE__ */ h(this.onClickFp), this.offClickFp = k(i), this.offClick = /* @__PURE__ */ h(this.offClickFp), this.mountFp = k(() => {
364
+ const m = () => {
365
+ };
366
+ return p.pipe(v.mount(), b.match(m, m));
367
+ }), this.mount = /* @__PURE__ */ h(this.mountFp), this.unmount = v.unmount, this.stateSetters = (m) => {
368
+ const g = y((d) => this.setStateFp({ [m]: d }));
369
+ return [/* @__PURE__ */ h(g), g];
370
+ }, this.stateBoolSetters = (m) => {
371
+ const [, g] = this.stateSetters(m), d = y(() => g(!1)), B = y(() => g(!0));
372
+ return [
373
+ [/* @__PURE__ */ h(d), d],
374
+ [/* @__PURE__ */ h(B), B]
375
+ ];
376
+ };
377
+ }
378
+ /**
379
+ * @returns A computed based on the specified state and its related key.
380
+ * @param key - a key to use.
381
+ */
382
+ stateGetter(t) {
383
+ return w(() => this.state()[t]);
384
+ }
385
+ }
386
+ class Mt {
387
+ constructor(t) {
388
+ /**
389
+ * Signal indicating if the component is currently visible.
390
+ */
391
+ e(this, "isVisible");
392
+ /**
393
+ * Signal indicating if the component is currently mounted.
394
+ */
395
+ e(this, "isMounted");
396
+ /**
397
+ * Signal indicating if the component is supported.
398
+ */
399
+ e(this, "isSupported");
400
+ /**
401
+ * Hides the button.
402
+ * @since Mini Apps v6.1
403
+ */
404
+ e(this, "hideFp");
405
+ /**
406
+ * @see hideFp
407
+ */
408
+ e(this, "hide");
409
+ /**
410
+ * Shows the button.
411
+ * @since Mini Apps v6.1
412
+ */
413
+ e(this, "showFp");
414
+ /**
415
+ * @see showFp
416
+ */
417
+ e(this, "show");
418
+ /**
419
+ * Adds a new button listener.
420
+ * @param listener - event listener.
421
+ * @param once - should the listener be called only once.
422
+ * @returns A function to remove bound listener.
423
+ * @since Mini Apps v6.1
424
+ * @example
425
+ * const off = button.onClick(() => {
426
+ * console.log('User clicked the button');
427
+ * off();
428
+ * });
429
+ */
430
+ e(this, "onClickFp");
431
+ /**
432
+ * @see onClickFp
433
+ */
434
+ e(this, "onClick");
435
+ /**
436
+ * Removes the button click listener.
437
+ * @param listener - event listener.
438
+ * @param once - should the listener be called only once.
439
+ * @since Mini Apps v6.1
440
+ * @example
441
+ * function listener() {
442
+ * console.log('User clicked the button');
443
+ * button.offClick(listener);
444
+ * }
445
+ * button.onClick(listener);
446
+ */
447
+ e(this, "offClickFp");
448
+ /**
449
+ * @see offClickFp
450
+ */
451
+ e(this, "offClick");
452
+ /**
453
+ * Mounts the component restoring its state.
454
+ * @since Mini Apps v6.1
455
+ */
456
+ e(this, "mountFp");
457
+ /**
458
+ * @see mountFp
459
+ */
460
+ e(this, "mount");
461
+ /**
462
+ * Unmounts the component.
463
+ *
464
+ * Note that this function does not remove listeners added via the `onClick`
465
+ * function, so you have to remove them on your own.
466
+ * @see onClick
467
+ */
468
+ e(this, "unmount");
469
+ const s = new de({
470
+ ...t,
471
+ method: "web_app_setup_back_button",
472
+ payload: (n) => ({ is_visible: n.isVisible }),
473
+ initialState: { isVisible: !1 }
474
+ });
475
+ this.isVisible = s.stateGetter("isVisible"), this.isMounted = s.isMounted, this.isSupported = s.isSupported, [[this.hide, this.hideFp], [this.show, this.showFp]] = s.stateBoolSetters("isVisible"), this.onClick = s.onClick, this.onClickFp = s.onClickFp, this.offClick = s.offClick, this.offClickFp = s.offClickFp, this.mount = s.mount, this.mountFp = s.mountFp, this.unmount = s.unmount;
476
+ }
477
+ }
478
+ function S() {
479
+ return { isTma: w(() => ut()) };
480
+ }
481
+ function te(r) {
482
+ return (t) => ({ ...t, ...$(r) });
483
+ }
484
+ // @__NO_SIDE_EFFECTS__
485
+ function ie(r, t) {
486
+ return O(r, t);
487
+ }
488
+ const Ye = /* @__PURE__ */ ie(ke), se = (...r) => Ye()(...r), Vt = (...r) => Ue(se(...r)), V = te({
489
+ postEvent: se
490
+ });
491
+ function Tt(r) {
492
+ return {
493
+ get: () => _t(r),
494
+ set(t) {
495
+ ft(r, t);
496
+ }
497
+ };
498
+ }
499
+ function Rt() {
500
+ return performance.getEntriesByType("navigation")[0];
501
+ }
502
+ function Lt() {
503
+ const r = Rt();
504
+ return !!r && r.type === "reload";
505
+ }
506
+ function Y(r) {
507
+ return te({
508
+ storage: Tt(r),
509
+ isPageReload: Lt
510
+ });
511
+ }
512
+ const Ce = /* @__PURE__ */ ie("0.0"), I = te({ version: Ce });
513
+ // @__NO_SIDE_EFFECTS__
514
+ function Ae(r, t) {
515
+ return {
516
+ ...p.pipe(
517
+ S(),
518
+ V,
519
+ I,
520
+ Y(r)
521
+ ),
522
+ onClick(s, n) {
523
+ return G(t, s, n);
524
+ },
525
+ offClick(s, n) {
526
+ re(t, s, n);
527
+ }
528
+ };
529
+ }
530
+ const jr = /* @__PURE__ */ new Mt(
531
+ /* @__PURE__ */ Ae("backButton", "back_button_pressed")
532
+ );
533
+ class Be {
534
+ constructor({
535
+ initialState: t,
536
+ onMounted: s,
537
+ restoreState: n,
538
+ onUnmounted: i,
539
+ isPageReload: a
540
+ }) {
541
+ e(this, "_isMounted", O(!1));
542
+ /**
543
+ * Signal indicating if the component is mounted.
544
+ */
545
+ e(this, "isMounted", w(this._isMounted));
546
+ /**
547
+ * Mounts the component restoring its state and calling required side effects.
548
+ * @param options - additional execution options.
549
+ */
550
+ e(this, "mount");
551
+ /**
552
+ * Unmounts the component.
553
+ */
554
+ e(this, "unmount");
555
+ this.mount = (u) => {
556
+ if (this._isMounted())
557
+ return c.right(void 0);
558
+ const o = $(a) ? n() : void 0;
559
+ return p.pipe(
560
+ o ? c.right(o) : t(u),
561
+ c.map((l) => {
562
+ this._isMounted() || ue(() => {
563
+ this._isMounted.set(!0), s == null || s(l);
564
+ });
565
+ })
566
+ );
567
+ }, this.unmount = () => {
568
+ this._isMounted() && ue(() => {
569
+ this._isMounted.set(!1), i == null || i();
570
+ });
571
+ };
572
+ }
573
+ }
574
+ function Ge() {
575
+ return new It("Biometry is not available");
576
+ }
577
+ function me(r) {
578
+ let t = !1, s = !1, n = "", i = !1, a = "", u = !1;
579
+ return r.available && (t = !0, s = r.token_saved, n = r.device_id, i = r.access_requested, a = r.type, u = r.access_granted), { available: t, tokenSaved: s, deviceId: n, type: a, accessGranted: u, accessRequested: i };
580
+ }
581
+ class $t {
582
+ constructor({
583
+ version: t,
584
+ request: s,
585
+ postEvent: n,
586
+ storage: i,
587
+ onInfoReceived: a,
588
+ offInfoReceived: u,
589
+ isTma: o,
590
+ isPageReload: l
591
+ }) {
592
+ /**
593
+ * Signal indicating if biometry is available.
594
+ */
595
+ e(this, "isAvailable");
596
+ /**
597
+ * Signal indicating if the component is supported.
598
+ */
599
+ e(this, "isSupported");
600
+ /**
601
+ * Signal indicating if the component is mounted.
602
+ */
603
+ e(this, "isMounted");
604
+ /**
605
+ * Complete component state.
606
+ */
607
+ e(this, "state");
608
+ /**
609
+ * Attempts to authenticate a user using biometrics and fetch a previously stored secure token.
610
+ * @param options - method options.
611
+ * @since Mini Apps v7.2
612
+ * @returns Token from the local secure storage saved previously or undefined.
613
+ * @example
614
+ * const { status, token } = await biometry.authenticate({
615
+ * reason: 'Authenticate to open wallet',
616
+ * });
617
+ */
618
+ e(this, "authenticateFp");
619
+ /**
620
+ * @see authenticateFp
621
+ */
622
+ e(this, "authenticate");
623
+ /**
624
+ * Opens the biometric access settings for bots. Useful when you need to request biometrics
625
+ * access to users who haven't granted it yet.
626
+ *
627
+ * _Note that this method can be called only in response to user interaction with the Mini App
628
+ * interface (e.g. a click inside the Mini App or on the main button)_.
629
+ * @since Mini Apps v7.2
630
+ */
631
+ e(this, "openSettingsFp");
632
+ /**
633
+ * @see openSettingsFp
634
+ */
635
+ e(this, "openSettings");
636
+ /**
637
+ * Requests permission to use biometrics.
638
+ * @since Mini Apps v7.2
639
+ * @returns Promise with true, if access was granted.
640
+ * @example
641
+ * const accessGranted = await biometry.requestAccess({
642
+ * reason: 'Authenticate to open wallet',
643
+ * });
644
+ */
645
+ e(this, "requestAccessFp");
646
+ /**
647
+ * @see requestAccessFp
648
+ */
649
+ e(this, "requestAccess");
650
+ /**
651
+ * Updates the biometric token in a secure storage on the device.
652
+ * @since Mini Apps v7.2
653
+ * @returns Promise with `true`, if token was updated.
654
+ * @example Setting a new token
655
+ * biometry.updateToken({
656
+ * token: 'abcdef',
657
+ * })
658
+ * @example Deleting the token
659
+ * biometry.updateToken();
660
+ */
661
+ e(this, "updateTokenFp");
662
+ /**
663
+ * @see updateTokenFp
664
+ */
665
+ e(this, "updateToken");
666
+ /**
667
+ * Mounts the component restoring its state.
668
+ * @since Mini Apps v7.2
669
+ */
670
+ e(this, "mountFp");
671
+ /**
672
+ * @see mountFp
673
+ */
674
+ e(this, "mount");
675
+ /**
676
+ * Unmounts the component.
677
+ */
678
+ e(this, "unmount");
679
+ const _ = (m) => {
680
+ F.setState(me(m));
681
+ }, F = new J({
682
+ initialState: {
683
+ available: !1,
684
+ type: "unknown",
685
+ accessGranted: !1,
686
+ accessRequested: !1,
687
+ deviceId: "",
688
+ tokenSaved: !1
689
+ },
690
+ onChange: i.set
691
+ }), f = new Be({
692
+ initialState(m) {
693
+ return p.pipe(
694
+ s("web_app_biometry_get_info", "biometry_info_received", m),
695
+ c.map(me)
696
+ );
697
+ },
698
+ isPageReload: l,
699
+ onMounted(m) {
700
+ F.setState(m), a(_);
701
+ },
702
+ onUnmounted() {
703
+ u(_);
704
+ },
705
+ restoreState: i.get
706
+ }), v = { version: t, requires: "web_app_biometry_request_auth", isTma: o }, C = E({
707
+ ...v,
708
+ returns: "either"
709
+ }), k = E({
710
+ ...v,
711
+ returns: "task"
712
+ }), y = E({
713
+ ...v,
714
+ isMounted: f.isMounted,
715
+ returns: "task"
716
+ });
717
+ this.isAvailable = F.getter("available"), this.isMounted = f.isMounted, this.isSupported = H("web_app_biometry_request_auth", t), this.state = F.state, this.unmount = f.unmount, this.mountFp = k(f.mount), this.authenticateFp = y((m) => this.isAvailable() ? p.pipe(
718
+ s("web_app_biometry_request_auth", "biometry_auth_requested", {
719
+ ...m,
720
+ params: { reason: ((m || {}).reason || "").trim() }
721
+ }),
722
+ c.map((g) => (F.setState({ token: g.token }), g))
723
+ ) : c.left(Ge())), this.openSettingsFp = C(() => n("web_app_biometry_open_settings")), this.requestAccessFp = y((m) => p.pipe(
724
+ s("web_app_biometry_request_access", "biometry_info_received", {
725
+ ...m,
726
+ params: { reason: ((m || {}).reason || "").trim() }
727
+ }),
728
+ c.chain((g) => {
729
+ const d = me(g);
730
+ return d.available ? (F.setState(d), c.right(d.accessRequested)) : c.left(Ge());
731
+ })
732
+ )), this.updateTokenFp = y((m = {}) => {
733
+ var g;
734
+ return p.pipe(
735
+ s("web_app_biometry_update_token", "biometry_token_updated", {
736
+ ...m,
737
+ params: { token: m.token || "", reason: (g = m.reason) == null ? void 0 : g.trim() }
738
+ }),
739
+ c.map((d) => d.status)
740
+ );
741
+ }), this.authenticate = /* @__PURE__ */ h(this.authenticateFp), this.openSettings = /* @__PURE__ */ h(this.openSettingsFp), this.requestAccess = /* @__PURE__ */ h(this.requestAccessFp), this.updateToken = /* @__PURE__ */ h(this.updateTokenFp), this.mount = /* @__PURE__ */ h(this.mountFp);
742
+ }
743
+ }
744
+ const Pt = (r, t, s) => ct(r, t, {
745
+ postEvent: se,
746
+ ...s
747
+ }), Ze = (r, t, s) => je(r, t, {
748
+ postEvent: se,
749
+ ...s
750
+ }), Ur = (...r) => He.fn(() => Pt(...r)()), Wr = (...r) => He.fn(() => Ze(...r)()), R = te({ request: Ze });
751
+ function Ot() {
752
+ return new $t({
753
+ ...p.pipe(
754
+ S(),
755
+ V,
756
+ I,
757
+ R,
758
+ Y("biometry")
759
+ ),
760
+ offInfoReceived(r) {
761
+ re("biometry_info_received", r);
762
+ },
763
+ onInfoReceived(r) {
764
+ return G("biometry_info_received", r);
765
+ }
766
+ });
767
+ }
768
+ const Hr = /* @__PURE__ */ Ot();
769
+ class Dt {
770
+ constructor({ postEvent: t, storage: s, isTma: n, isPageReload: i }) {
771
+ /**
772
+ * Signal indicating if closing confirmation dialog is currently enabled.
773
+ */
774
+ e(this, "isConfirmationEnabled");
775
+ /**
776
+ * Signal indicating if the component is currently mounted.
777
+ */
778
+ e(this, "isMounted");
779
+ /**
780
+ * Mounts the component restoring its state.
781
+ */
782
+ e(this, "mountFp");
783
+ /**
784
+ * @see mountFp
785
+ */
786
+ e(this, "mount");
787
+ /**
788
+ * Unmounts the component.
789
+ */
790
+ e(this, "unmount");
791
+ /**
792
+ * Disables the closing confirmation dialog.
793
+ */
794
+ e(this, "disableConfirmationFp");
795
+ /**
796
+ * @see disableConfirmationFp
797
+ */
798
+ e(this, "disableConfirmation");
799
+ /**
800
+ * Enables the closing confirmation dialog.
801
+ */
802
+ e(this, "enableConfirmationFp");
803
+ /**
804
+ * @see enableConfirmationFp
805
+ */
806
+ e(this, "enableConfirmation");
807
+ const a = new J({
808
+ initialState: { isConfirmationEnabled: !1 },
809
+ onChange(f) {
810
+ s.set(f);
811
+ }
812
+ }), u = new ne({
813
+ onMounted: a.setState,
814
+ restoreState: s.get,
815
+ initialState: { isConfirmationEnabled: !1 },
816
+ isPageReload: i
817
+ }), o = { requires: "web_app_setup_closing_behavior", isTma: n }, l = E({
818
+ ...o,
819
+ returns: "plain"
820
+ }), _ = E({
821
+ ...o,
822
+ returns: "either",
823
+ isMounted: u.isMounted
824
+ }), F = (f) => f === this.isConfirmationEnabled() ? b.right(void 0) : (a.setState({ isConfirmationEnabled: f }), t("web_app_setup_closing_behavior", {
825
+ need_confirmation: f
826
+ }));
827
+ this.isConfirmationEnabled = a.getter("isConfirmationEnabled"), this.isMounted = u.isMounted, this.disableConfirmationFp = _(() => F(!1)), this.enableConfirmationFp = _(() => F(!0)), this.mountFp = l(() => {
828
+ const f = () => {
829
+ };
830
+ return p.pipe(u.mount(), b.match(f, f));
831
+ }), this.unmount = u.unmount, this.disableConfirmation = /* @__PURE__ */ h(this.disableConfirmationFp), this.enableConfirmation = /* @__PURE__ */ h(this.enableConfirmationFp), this.mount = /* @__PURE__ */ h(this.mountFp);
832
+ }
833
+ }
834
+ function Gt() {
835
+ return new Dt(p.pipe(
836
+ S(),
837
+ Y("closingBehavior"),
838
+ V
839
+ ));
840
+ }
841
+ const zr = /* @__PURE__ */ Gt();
842
+ class jt {
843
+ constructor({ version: t, isTma: s, invokeCustomMethod: n }) {
844
+ /**
845
+ * Signal indicating if the component is supported.
846
+ */
847
+ e(this, "isSupported");
848
+ /**
849
+ * Deletes specified key or keys from the cloud storage.
850
+ * @param keyOrKeys - key or keys to delete.
851
+ * @param options - request execution options.
852
+ * @since Mini Apps v6.9
853
+ */
854
+ e(this, "deleteItemFp");
855
+ e(this, "deleteItem");
856
+ /**
857
+ * Gets a single key value from the cloud storage.
858
+ * @param key - a key to get.
859
+ * @param options - request execution options.
860
+ * @returns A key value as a string.
861
+ * @since Mini Apps v6.9
862
+ */
863
+ e(this, "getItemFp");
864
+ /**
865
+ * @see getItemFp
866
+ */
867
+ e(this, "getItem");
868
+ /**
869
+ * Gets multiple keys' values from the cloud storage.
870
+ * @param keys - keys list.
871
+ * @param options - request execution options.
872
+ * @returns A map, where a key is one of the specified in the `keys` argument,
873
+ * and a value is a corresponding storage value if an array of keys was passed.
874
+ * @since Mini Apps v6.9
875
+ */
876
+ e(this, "getItemsFp");
877
+ /**
878
+ * @see getItemsFp
879
+ */
880
+ e(this, "getItems");
881
+ /**
882
+ * Returns a list of all keys presented in the cloud storage.
883
+ * @param options - request execution options.
884
+ * @since Mini Apps v6.9
885
+ */
886
+ e(this, "getKeysFp");
887
+ /**
888
+ * @see getKeysFp
889
+ */
890
+ e(this, "getKeys");
891
+ /**
892
+ * Saves the specified value by a key.
893
+ * @param key - storage key.
894
+ * @param value - storage value.
895
+ * @param options - request execution options.
896
+ * @since Mini Apps v6.9
897
+ */
898
+ e(this, "setItemFp");
899
+ /**
900
+ * @see setItemFp
901
+ */
902
+ e(this, "setItem");
903
+ /**
904
+ * Clears the cloud storage.
905
+ * @param options - additional options.
906
+ * @since Mini Apps v6.9
907
+ */
908
+ e(this, "clearFp");
909
+ /**
910
+ * @see clearFp
911
+ */
912
+ e(this, "clear");
913
+ const i = E({
914
+ version: t,
915
+ requires: "web_app_invoke_custom_method",
916
+ isTma: s,
917
+ returns: "task"
918
+ });
919
+ this.isSupported = H("web_app_invoke_custom_method", t), this.deleteItemFp = i((a, u) => {
920
+ const o = Array.isArray(a) ? a : [a];
921
+ return p.pipe(
922
+ o.length ? n("deleteStorageValues", { keys: o }, u) : c.right(void 0),
923
+ c.map(() => {
924
+ })
925
+ );
926
+ }), this.getItemFp = i((a, u) => p.pipe(
927
+ this.getItemsFp([a], u),
928
+ c.map((o) => o[a] || "")
929
+ )), this.getItemsFp = i((a, u) => p.pipe(
930
+ a.length ? n("getStorageValues", { keys: a }, u) : c.right({}),
931
+ c.map((o) => ({
932
+ // Fulfill the response with probably missing keys.
933
+ ...a.reduce((l, _) => (l[_] = "", l), {}),
934
+ ...Oe(wt(K(), K()), o)
935
+ }))
936
+ )), this.getKeysFp = i((a) => p.pipe(
937
+ n("getStorageKeys", {}, a),
938
+ c.map((u) => Oe(Ct(K()), u))
939
+ )), this.setItemFp = i((a, u, o) => p.pipe(
940
+ n("saveStorageValue", { key: a, value: u }, o),
941
+ c.map(() => {
942
+ })
943
+ )), this.clearFp = i((a) => p.pipe(this.getKeysFp(a), c.chain(this.deleteItemFp))), this.deleteItem = /* @__PURE__ */ h(this.deleteItemFp), this.getItem = /* @__PURE__ */ h(this.getItemFp), this.getItems = /* @__PURE__ */ h(this.getItemsFp), this.getKeys = /* @__PURE__ */ h(this.getKeysFp), this.setItem = /* @__PURE__ */ h(this.setItemFp), this.clear = /* @__PURE__ */ h(this.clearFp);
944
+ }
945
+ }
946
+ const be = /* @__PURE__ */ ie(0);
947
+ function xe() {
948
+ return be.set(be() + 1), be().toString();
949
+ }
950
+ function Ut(r, t, s) {
951
+ return lt(r, t, xe(), {
952
+ ...s || {},
953
+ postEvent: se
954
+ });
955
+ }
956
+ const Me = te({
957
+ invokeCustomMethod: Ut
958
+ });
959
+ function Wt() {
960
+ return new jt(p.pipe(
961
+ S(),
962
+ I,
963
+ Me
964
+ ));
965
+ }
966
+ const Kr = /* @__PURE__ */ Wt();
967
+ class Ht {
968
+ constructor({ isTma: t, request: s, version: n, createRequestId: i }) {
969
+ /**
970
+ * Retrieves an item using its key.
971
+ * @since Mini Apps v9.0
972
+ */
973
+ e(this, "getItemFp");
974
+ /**
975
+ * @see getItemFp
976
+ */
977
+ e(this, "getItem");
978
+ /**
979
+ * Sets a new item in the storage.
980
+ * @since Mini Apps v9.0
981
+ */
982
+ e(this, "setItemFp");
983
+ /**
984
+ * @see setItemFp
985
+ */
986
+ e(this, "setItem");
987
+ /**
988
+ * Removes a key from the storage.
989
+ * @since Mini Apps v9.0
990
+ */
991
+ e(this, "deleteItemFp");
992
+ /**
993
+ * @see deleteItemFp
994
+ */
995
+ e(this, "deleteItem");
996
+ /**
997
+ * Removes all keys from the storage.
998
+ * @since Mini Apps v9.0
999
+ */
1000
+ e(this, "clearFp");
1001
+ /**
1002
+ * @see clearFp
1003
+ */
1004
+ e(this, "clear");
1005
+ const a = E({
1006
+ version: n,
1007
+ requires: "web_app_device_storage_get_key",
1008
+ isTma: t,
1009
+ returns: "task"
1010
+ }), u = (o, l, _) => {
1011
+ const F = i();
1012
+ return p.pipe(
1013
+ s(o, ["device_storage_failed", l], {
1014
+ params: { ..._, req_id: F },
1015
+ capture: ((f) => "payload" in f ? f.payload.req_id === F : !0)
1016
+ }),
1017
+ c.chain((f) => f.event === "device_storage_failed" ? c.left(new kt(f.payload.error || "UNKNOWN_ERROR")) : c.right(f.payload))
1018
+ );
1019
+ };
1020
+ this.getItemFp = a((o) => p.pipe(
1021
+ u("web_app_device_storage_get_key", "device_storage_key_received", { key: o }),
1022
+ c.map((l) => l.value)
1023
+ )), this.setItemFp = a((o, l) => p.pipe(
1024
+ u("web_app_device_storage_save_key", "device_storage_key_saved", { key: o, value: l }),
1025
+ c.map(() => {
1026
+ })
1027
+ )), this.deleteItemFp = a((o) => this.setItemFp(o, null)), this.clearFp = a(() => p.pipe(
1028
+ u("web_app_device_storage_clear", "device_storage_cleared", {}),
1029
+ c.map(() => {
1030
+ })
1031
+ )), this.getItem = /* @__PURE__ */ h(this.getItemFp), this.setItem = /* @__PURE__ */ h(this.setItemFp), this.deleteItem = /* @__PURE__ */ h(this.deleteItemFp), this.clear = /* @__PURE__ */ h(this.clearFp);
1032
+ }
1033
+ }
1034
+ const Xe = te({ createRequestId: xe });
1035
+ function zt() {
1036
+ return new Ht(p.pipe(
1037
+ S(),
1038
+ I,
1039
+ R,
1040
+ Xe
1041
+ ));
1042
+ }
1043
+ const Nr = /* @__PURE__ */ zt();
1044
+ function Kt({ request: r, ...t }) {
1045
+ return A((s) => p.pipe(
1046
+ r("web_app_request_emoji_status_access", "emoji_status_access_requested", s),
1047
+ c.map((n) => n.status)
1048
+ ), { ...t, requires: "web_app_request_emoji_status_access", returns: "task" });
1049
+ }
1050
+ // @__NO_SIDE_EFFECTS__
1051
+ function Nt() {
1052
+ return Kt(p.pipe(
1053
+ S(),
1054
+ I,
1055
+ R
1056
+ ));
1057
+ }
1058
+ const Qt = /* @__PURE__ */ Nt(), Qr = /* @__PURE__ */ h(Qt);
1059
+ function Jt({ request: r, ...t }) {
1060
+ return A((s, n) => p.pipe(
1061
+ r("web_app_set_emoji_status", ["emoji_status_set", "emoji_status_failed"], {
1062
+ params: {
1063
+ custom_emoji_id: s,
1064
+ duration: (n || {}).duration
1065
+ },
1066
+ ...n
1067
+ }),
1068
+ c.chainW((i) => i.event === "emoji_status_failed" ? c.left(new qt(i.payload.error)) : c.right(void 0))
1069
+ ), {
1070
+ ...t,
1071
+ requires: "web_app_set_emoji_status",
1072
+ returns: "task"
1073
+ });
1074
+ }
1075
+ // @__NO_SIDE_EFFECTS__
1076
+ function Yt() {
1077
+ return Jt(p.pipe(
1078
+ S(),
1079
+ R,
1080
+ I
1081
+ ));
1082
+ }
1083
+ const Zt = /* @__PURE__ */ Yt(), Jr = /* @__PURE__ */ h(Zt);
1084
+ class Xt {
1085
+ constructor({ postEvent: t, isTma: s, version: n }) {
1086
+ /**
1087
+ * Signal indicating if the component is supported.
1088
+ */
1089
+ e(this, "isSupported");
1090
+ /**
1091
+ * A method that tells if an impact occurred. The Telegram app may play the
1092
+ * appropriate haptics based on style value passed.
1093
+ * @param style - impact style.
1094
+ * @since Mini Apps v6.1
1095
+ */
1096
+ e(this, "impactOccurredFp");
1097
+ /**
1098
+ * @see impactOccurredFp
1099
+ */
1100
+ e(this, "impactOccurred");
1101
+ /**
1102
+ * A method tells that a task or action has succeeded, failed, or produced
1103
+ * a warning. The Telegram app may play the appropriate haptics based on type
1104
+ * value passed.
1105
+ * @param type - notification type.
1106
+ * @since Mini Apps v6.1
1107
+ */
1108
+ e(this, "notificationOccurredFp");
1109
+ /**
1110
+ * @see notificationOccurredFp
1111
+ */
1112
+ e(this, "notificationOccurred");
1113
+ /**
1114
+ * A method tells that the user has changed a selection. The Telegram app may
1115
+ * play the appropriate haptics.
1116
+ *
1117
+ * Do not use this feedback when the user makes or confirms a selection; use
1118
+ * it only when the selection changes.
1119
+ * @since Mini Apps v6.1
1120
+ */
1121
+ e(this, "selectionChangedFp");
1122
+ /**
1123
+ * @see selectionChangedFp
1124
+ */
1125
+ e(this, "selectionChanged");
1126
+ const i = "web_app_trigger_haptic_feedback", a = E({
1127
+ requires: i,
1128
+ isTma: s,
1129
+ version: n,
1130
+ returns: "plain"
1131
+ });
1132
+ this.isSupported = H(i, n), this.impactOccurredFp = a((u) => t(i, { type: "impact", impact_style: u })), this.notificationOccurredFp = a((u) => t(i, { type: "notification", notification_type: u })), this.selectionChangedFp = a(() => t(i, { type: "selection_change" })), this.impactOccurred = /* @__PURE__ */ h(this.impactOccurredFp), this.notificationOccurred = /* @__PURE__ */ h(this.notificationOccurredFp), this.selectionChanged = /* @__PURE__ */ h(this.selectionChangedFp);
1133
+ }
1134
+ }
1135
+ function es() {
1136
+ return new Xt(p.pipe(
1137
+ S(),
1138
+ V,
1139
+ I
1140
+ ));
1141
+ }
1142
+ const Yr = /* @__PURE__ */ es();
1143
+ function ts({ postEvent: r, ...t }) {
1144
+ return A(() => r("web_app_add_to_home_screen"), { ...t, requires: "web_app_add_to_home_screen", returns: "either" });
1145
+ }
1146
+ // @__NO_SIDE_EFFECTS__
1147
+ function ss() {
1148
+ return ts(p.pipe(
1149
+ S(),
1150
+ I,
1151
+ V
1152
+ ));
1153
+ }
1154
+ const rs = /* @__PURE__ */ ss(), Zr = /* @__PURE__ */ h(rs);
1155
+ function ns({ request: r, ...t }) {
1156
+ return A((s) => p.pipe(
1157
+ r("web_app_check_home_screen", "home_screen_checked", s),
1158
+ c.map((n) => n.status || "unknown")
1159
+ ), { ...t, requires: "web_app_check_home_screen", returns: "task" });
1160
+ }
1161
+ // @__NO_SIDE_EFFECTS__
1162
+ function is() {
1163
+ return ns(p.pipe(
1164
+ S(),
1165
+ I,
1166
+ R
1167
+ ));
1168
+ }
1169
+ const os = /* @__PURE__ */ is(), Xr = /* @__PURE__ */ h(os);
1170
+ class as {
1171
+ constructor({ retrieveInitData: t }) {
1172
+ e(this, "_state", O());
1173
+ e(this, "_raw", O());
1174
+ /**
1175
+ * Complete component state.
1176
+ */
1177
+ e(this, "state", w(this._state));
1178
+ /**
1179
+ * @see InitDataType.auth_date
1180
+ */
1181
+ e(this, "authDate", this.fromState("auth_date"));
1182
+ /**
1183
+ * @see InitDataType.can_send_after
1184
+ */
1185
+ e(this, "canSendAfter", this.fromState("can_send_after"));
1186
+ /**
1187
+ * Date after which it is allowed to call
1188
+ * the [answerWebAppQuery](https://core.telegram.org/bots/api#answerwebappquery) method.
1189
+ */
1190
+ e(this, "canSendAfterDate", w(() => {
1191
+ const t = this.authDate(), s = this.canSendAfter();
1192
+ return s && t ? new Date(t.getTime() + s * 1e3) : void 0;
1193
+ }));
1194
+ /**
1195
+ * @see InitDataType.chat
1196
+ */
1197
+ e(this, "chat", this.fromState("chat"));
1198
+ /**
1199
+ * @see InitDataType.chat_type
1200
+ */
1201
+ e(this, "chatType", this.fromState("chat_type"));
1202
+ /**
1203
+ * @see InitDataType.chat_instance
1204
+ */
1205
+ e(this, "chatInstance", this.fromState("chat_instance"));
1206
+ /**
1207
+ * @see InitDataType.hash
1208
+ */
1209
+ e(this, "hash", this.fromState("hash"));
1210
+ /**
1211
+ * @see InitDataType.query_id
1212
+ */
1213
+ e(this, "queryId", this.fromState("query_id"));
1214
+ /**
1215
+ * Raw representation of init data.
1216
+ */
1217
+ e(this, "raw", w(this._raw));
1218
+ /**
1219
+ * @see InitDataType.receiver
1220
+ */
1221
+ e(this, "receiver", this.fromState("receiver"));
1222
+ /**
1223
+ * @see InitDataType.signature
1224
+ */
1225
+ e(this, "signature", this.fromState("signature"));
1226
+ /**
1227
+ * @see InitDataType.start_param
1228
+ */
1229
+ e(this, "startParam", this.fromState("start_param"));
1230
+ /**
1231
+ * @see InitDataType.auth
1232
+ */
1233
+ e(this, "auth", this.fromState("auth"));
1234
+ /**
1235
+ * @see InitDataType.user
1236
+ */
1237
+ e(this, "user", this.fromState("user"));
1238
+ /**
1239
+ * Restores the component state.
1240
+ */
1241
+ e(this, "restoreFp");
1242
+ /**
1243
+ * @see restoreFp
1244
+ */
1245
+ e(this, "restore");
1246
+ this.restoreFp = () => p.pipe(
1247
+ t(),
1248
+ b.map(N.match(() => {
1249
+ }, ({ raw: s, obj: n }) => {
1250
+ this._state.set(n), this._raw.set(s);
1251
+ }))
1252
+ ), this.restore = he(this.restoreFp);
1253
+ }
1254
+ fromState(t) {
1255
+ return w(() => {
1256
+ const s = this._state();
1257
+ return s ? s[t] : void 0;
1258
+ });
1259
+ }
1260
+ }
1261
+ function ps() {
1262
+ return new as({
1263
+ retrieveInitData() {
1264
+ return p.pipe(
1265
+ b.Do,
1266
+ b.bindW("obj", () => p.pipe(
1267
+ ce(),
1268
+ b.map(({ vbWebAppData: r }) => r ? N.some(r) : N.none)
1269
+ )),
1270
+ b.bindW("raw", ht),
1271
+ b.map(({ obj: r, raw: t }) => p.pipe(
1272
+ N.Do,
1273
+ N.bind("obj", () => r),
1274
+ N.bind("raw", () => t)
1275
+ ))
1276
+ );
1277
+ }
1278
+ });
1279
+ }
1280
+ const en = /* @__PURE__ */ ps();
1281
+ class us {
1282
+ constructor({ version: t, request: s, isTma: n }) {
1283
+ /**
1284
+ * Signal indicating if any invoice is currently opened.
1285
+ */
1286
+ e(this, "isOpened");
1287
+ /**
1288
+ * Signal indicating if the component is supported.
1289
+ */
1290
+ e(this, "isSupported");
1291
+ /**
1292
+ * Opens an invoice using its slug or URL.
1293
+ * @param slug - invoice slug.
1294
+ * @param options - additional options.
1295
+ * @since Mini Apps v6.1
1296
+ * @example
1297
+ * const status = await invoice.openSlug('kJNFS331');
1298
+ */
1299
+ e(this, "openSlugFp");
1300
+ /**
1301
+ * @see openSlugFp
1302
+ */
1303
+ e(this, "openSlug");
1304
+ /**
1305
+ * Opens an invoice using its URL.
1306
+ * @param url - invoice URL.
1307
+ * @param options - additional options.
1308
+ * @since Mini Apps v6.1
1309
+ * @example
1310
+ * const status = await invoice.openUrl('https://t.me/$kJNFS331');
1311
+ */
1312
+ e(this, "openUrlFp");
1313
+ /**
1314
+ * @see openUrlFp
1315
+ */
1316
+ e(this, "openUrl");
1317
+ const i = E({
1318
+ version: t,
1319
+ isTma: n,
1320
+ requires: "web_app_open_invoice",
1321
+ returns: "task"
1322
+ }), a = O(!1), u = () => {
1323
+ a.set(!1);
1324
+ };
1325
+ this.isSupported = H("web_app_open_invoice", t), this.isOpened = w(a), this.openSlugFp = i((o, l) => p.pipe(
1326
+ this.isOpened() ? c.left(new qe("Invoice is already opened")) : c.right(void 0),
1327
+ c.chain(() => (a.set(!0), s("web_app_open_invoice", "invoice_closed", {
1328
+ ...l,
1329
+ params: { slug: o },
1330
+ capture: (_) => o === _.slug
1331
+ }))),
1332
+ c.mapBoth((_) => (u(), _), (_) => (u(), _.status))
1333
+ )), this.openUrlFp = i((o, l) => {
1334
+ const { hostname: _, pathname: F } = new URL(o, window.location.href);
1335
+ if (_ !== "t.me")
1336
+ return c.left(new W(`Link has unexpected hostname: ${_}`));
1337
+ const f = F.match(/^\/(\$|invoice\/)([A-Za-z0-9\-_=]+)$/);
1338
+ return f ? this.openSlugFp(f[2], l) : c.left(new W(
1339
+ 'Expected to receive a link with a pathname in format "/invoice/{slug}" or "/${slug}"'
1340
+ ));
1341
+ }), this.openUrl = /* @__PURE__ */ h(this.openUrlFp), this.openSlug = /* @__PURE__ */ h(this.openSlugFp);
1342
+ }
1343
+ }
1344
+ function cs() {
1345
+ return new us(p.pipe(S(), R, I));
1346
+ }
1347
+ const tn = /* @__PURE__ */ cs();
1348
+ function ls({ postEvent: r, ...t }) {
1349
+ return A((s, n = {}) => {
1350
+ if (typeof s == "string")
1351
+ try {
1352
+ s = new URL(s);
1353
+ } catch (i) {
1354
+ return b.left(new W(`"${s.toString()}" is invalid URL`, i));
1355
+ }
1356
+ return r("web_app_open_link", {
1357
+ url: s.toString(),
1358
+ try_browser: n.tryBrowser,
1359
+ try_instant_view: n.tryInstantView
1360
+ });
1361
+ }, { ...t, returns: "either" });
1362
+ }
1363
+ // @__NO_SIDE_EFFECTS__
1364
+ function hs() {
1365
+ return ls(p.pipe(S(), V));
1366
+ }
1367
+ const ds = /* @__PURE__ */ hs(), sn = /* @__PURE__ */ h(ds);
1368
+ function fs({ postEvent: r, version: t, ...s }) {
1369
+ return A((n) => {
1370
+ const i = n.toString();
1371
+ return i.match(/^https:\/\/t.me\/.+/) ? ee("web_app_open_tg_link", $(t)) ? (n = new URL(n), r("web_app_open_tg_link", { path_full: n.pathname + n.search })) : (window.location.href = i, b.right(void 0)) : b.left(new W(`"${i}" is invalid URL`));
1372
+ }, { ...s, returns: "either" });
1373
+ }
1374
+ // @__NO_SIDE_EFFECTS__
1375
+ function _s() {
1376
+ return fs(p.pipe(
1377
+ S(),
1378
+ V,
1379
+ I
1380
+ ));
1381
+ }
1382
+ const et = /* @__PURE__ */ _s(), rn = /* @__PURE__ */ h(et);
1383
+ function ms({ openTelegramLink: r, ...t }) {
1384
+ return A((s, n) => r(
1385
+ "https://t.me/share/url?" + new URLSearchParams({ url: s, text: n || "" }).toString().replace(/\+/g, "%20")
1386
+ ), { ...t, returns: "either" });
1387
+ }
1388
+ // @__NO_SIDE_EFFECTS__
1389
+ function bs() {
1390
+ return ms({
1391
+ ...S(),
1392
+ openTelegramLink: et
1393
+ });
1394
+ }
1395
+ const gs = /* @__PURE__ */ bs(), nn = /* @__PURE__ */ h(gs);
1396
+ function Fs(r) {
1397
+ let t = !1, s, n;
1398
+ return r.available && (t = !0, s = r.access_requested, n = r.access_granted), {
1399
+ available: t,
1400
+ accessGranted: n || !1,
1401
+ accessRequested: s || !1
1402
+ };
1403
+ }
1404
+ class ws {
1405
+ constructor({
1406
+ version: t,
1407
+ request: s,
1408
+ postEvent: n,
1409
+ storage: i,
1410
+ isTma: a,
1411
+ isPageReload: u
1412
+ }) {
1413
+ /**
1414
+ * Complete location manager state.
1415
+ */
1416
+ e(this, "state");
1417
+ /**
1418
+ * Signal indicating whether the location data tracking is currently available.
1419
+ */
1420
+ e(this, "isAvailable");
1421
+ /**
1422
+ * Signal indicating whether the user has granted the app permission to track location data.
1423
+ */
1424
+ e(this, "isAccessGranted");
1425
+ /**
1426
+ * Signal indicating whether the app has previously requested permission to track location data.
1427
+ */
1428
+ e(this, "isAccessRequested");
1429
+ /**
1430
+ * Signal indicating if the component is currently mounted.
1431
+ */
1432
+ e(this, "isMounted");
1433
+ /**
1434
+ * Signal indicating if the component is supported.
1435
+ */
1436
+ e(this, "isSupported");
1437
+ /**
1438
+ * Opens the location access settings for bots. Useful when you need to request location access
1439
+ * from users who haven't granted it yet.
1440
+ *
1441
+ * Note that this method can be called only in response to user interaction with the Mini App
1442
+ * interface (e.g., a click inside the Mini App or on the main button).
1443
+ * @since Mini Apps v8.0
1444
+ */
1445
+ e(this, "openSettingsFp");
1446
+ /**
1447
+ * @see openSettingsFp
1448
+ */
1449
+ e(this, "openSettings");
1450
+ /**
1451
+ * Requests location data.
1452
+ * @since Mini Apps v8.0
1453
+ * @returns Promise with location data or null it access was not granted.
1454
+ */
1455
+ e(this, "requestLocationFp");
1456
+ /**
1457
+ * @see requestLocationFp
1458
+ */
1459
+ e(this, "requestLocation");
1460
+ /**
1461
+ * Mounts the component restoring its state.
1462
+ * @since Mini Apps v8.0
1463
+ */
1464
+ e(this, "mountFp");
1465
+ /**
1466
+ * @see mountFp
1467
+ */
1468
+ e(this, "mount");
1469
+ /**
1470
+ * Unmounts the component.
1471
+ */
1472
+ e(this, "unmount");
1473
+ const o = new J({
1474
+ initialState: {
1475
+ available: !1,
1476
+ accessGranted: !1,
1477
+ accessRequested: !1
1478
+ },
1479
+ onChange: i.set
1480
+ }), l = new Be({
1481
+ isPageReload: u,
1482
+ restoreState: i.get,
1483
+ onMounted: o.setState,
1484
+ initialState(C) {
1485
+ return p.pipe(
1486
+ s("web_app_check_location", "location_checked", C),
1487
+ c.map(Fs)
1488
+ );
1489
+ }
1490
+ }), _ = { version: t, requires: "web_app_check_location", isTma: a }, F = E({
1491
+ ..._,
1492
+ returns: "either"
1493
+ }), f = E({
1494
+ ..._,
1495
+ returns: "task"
1496
+ }), v = E({
1497
+ ..._,
1498
+ returns: "task",
1499
+ isMounted: l.isMounted
1500
+ });
1501
+ this.isAvailable = o.getter("available"), this.isAccessRequested = o.getter("accessRequested"), this.isAccessGranted = o.getter("accessGranted"), this.isSupported = H("web_app_check_location", t), this.isMounted = l.isMounted, this.state = o.state, this.unmount = l.unmount, this.mountFp = f(l.mount), this.openSettingsFp = F(() => n("web_app_open_location_settings")), this.requestLocationFp = v((C) => p.pipe(
1502
+ s("web_app_request_location", "location_requested", C),
1503
+ c.map((k) => {
1504
+ if (!k.available)
1505
+ return o.setState({ available: !1 }), null;
1506
+ const { available: y, ...m } = k;
1507
+ return m;
1508
+ })
1509
+ )), this.mount = /* @__PURE__ */ h(this.mountFp), this.openSettings = /* @__PURE__ */ h(this.openSettingsFp), this.requestLocation = /* @__PURE__ */ h(this.requestLocationFp);
1510
+ }
1511
+ }
1512
+ function Cs() {
1513
+ return new ws(p.pipe(
1514
+ S(),
1515
+ V,
1516
+ I,
1517
+ R,
1518
+ Y("locationManager")
1519
+ ));
1520
+ }
1521
+ const on = /* @__PURE__ */ Cs();
1522
+ class Ss {
1523
+ constructor({ defaults: t, ...s }) {
1524
+ //#region Properties.
1525
+ /**
1526
+ * The button background color.
1527
+ */
1528
+ e(this, "bgColor");
1529
+ /**
1530
+ * True if the button has a shining effect.
1531
+ */
1532
+ e(this, "hasShineEffect");
1533
+ /**
1534
+ * True if the button is clickable.
1535
+ */
1536
+ e(this, "isEnabled");
1537
+ /**
1538
+ * True if the button loader is visible.
1539
+ */
1540
+ e(this, "isLoaderVisible");
1541
+ /**
1542
+ * True if the button is visible.
1543
+ */
1544
+ e(this, "isVisible");
1545
+ /**
1546
+ * Signal indicating if the component is currently mounted.
1547
+ */
1548
+ e(this, "isMounted");
1549
+ /**
1550
+ * The complete button state.
1551
+ */
1552
+ e(this, "state");
1553
+ /**
1554
+ * The button displayed text.
1555
+ */
1556
+ e(this, "text");
1557
+ /**
1558
+ * The button text color.
1559
+ *
1560
+ * Note that this value is computed based on the external defaults. For
1561
+ * example, if not explicitly set, this value may be equal to one of theme
1562
+ * params colors.
1563
+ */
1564
+ e(this, "textColor");
1565
+ //#endregion
1566
+ //#region Methods.
1567
+ /**
1568
+ * Shows the button.
1569
+ */
1570
+ e(this, "showFp");
1571
+ /**
1572
+ * @see showFp
1573
+ */
1574
+ e(this, "show");
1575
+ /**
1576
+ * Hides the button.
1577
+ */
1578
+ e(this, "hideFp");
1579
+ /**
1580
+ * @see hideFp
1581
+ */
1582
+ e(this, "hide");
1583
+ /**
1584
+ * Enables the button.
1585
+ */
1586
+ e(this, "enableFp");
1587
+ /**
1588
+ * @see enableFp
1589
+ */
1590
+ e(this, "enable");
1591
+ /**
1592
+ * Enables the button.
1593
+ */
1594
+ e(this, "enableShineEffectFp");
1595
+ /**
1596
+ * @see enableShineEffectFp
1597
+ */
1598
+ e(this, "enableShineEffect");
1599
+ /**
1600
+ * Disables the button.
1601
+ */
1602
+ e(this, "disableFp");
1603
+ /**
1604
+ * @see disableFp
1605
+ */
1606
+ e(this, "disable");
1607
+ /**
1608
+ * Enables the button.
1609
+ */
1610
+ e(this, "disableShineEffectFp");
1611
+ /**
1612
+ * @see disableShineEffectFp
1613
+ */
1614
+ e(this, "disableShineEffect");
1615
+ /**
1616
+ * Updates the button background color.
1617
+ */
1618
+ e(this, "setBgColorFp");
1619
+ /**
1620
+ * @see setBgColorFp
1621
+ */
1622
+ e(this, "setBgColor");
1623
+ /**
1624
+ * Updates the button text color.
1625
+ */
1626
+ e(this, "setTextColorFp");
1627
+ /**
1628
+ * @see setTextColorFp
1629
+ */
1630
+ e(this, "setTextColor");
1631
+ /**
1632
+ * Updates the button text.
1633
+ */
1634
+ e(this, "setTextFp");
1635
+ /**
1636
+ * @see setTextFp
1637
+ */
1638
+ e(this, "setText");
1639
+ /**
1640
+ * Shows the button loader.
1641
+ */
1642
+ e(this, "showLoaderFp");
1643
+ /**
1644
+ * @see showLoaderFp
1645
+ */
1646
+ e(this, "showLoader");
1647
+ /**
1648
+ * Hides the button loader.
1649
+ */
1650
+ e(this, "hideLoaderFp");
1651
+ /**
1652
+ * @see hideLoaderFp
1653
+ */
1654
+ e(this, "hideLoader");
1655
+ /**
1656
+ * Updates the button state.
1657
+ * @param state - updates to apply.
1658
+ * @example
1659
+ * button.setParams({
1660
+ * text: 'Submit',
1661
+ * isEnabled: true,
1662
+ * hasShineEffect: true,
1663
+ * });
1664
+ */
1665
+ e(this, "setParamsFp");
1666
+ e(this, "setParams");
1667
+ /**
1668
+ * Mounts the component restoring its state.
1669
+ */
1670
+ e(this, "mountFp");
1671
+ /**
1672
+ * @see mountFp
1673
+ */
1674
+ e(this, "mount");
1675
+ /**
1676
+ * Unmounts the component.
1677
+ */
1678
+ e(this, "unmount");
1679
+ /**
1680
+ * Adds a new button listener.
1681
+ * @param listener - event listener.
1682
+ * @param once - should the listener be called only once.
1683
+ * @returns A function to remove bound listener.
1684
+ * @example
1685
+ * const off = button.onClick(() => {
1686
+ * console.log('User clicked the button');
1687
+ * off();
1688
+ * });
1689
+ */
1690
+ e(this, "onClickFp");
1691
+ /**
1692
+ * @see onClickFp
1693
+ */
1694
+ e(this, "onClick");
1695
+ /**
1696
+ * Removes the button click listener.
1697
+ * @param listener - event listener.
1698
+ * @param once - should the listener be called only once.
1699
+ * @example
1700
+ * function listener() {
1701
+ * console.log('User clicked the button');
1702
+ * button.offClick(listener);
1703
+ * }
1704
+ * button.onClick(listener);
1705
+ */
1706
+ e(this, "offClickFp");
1707
+ /**
1708
+ * @see offClickFp
1709
+ */
1710
+ e(this, "offClick");
1711
+ const n = new de({
1712
+ ...s,
1713
+ version: "100",
1714
+ initialState: {
1715
+ hasShineEffect: !1,
1716
+ isEnabled: !0,
1717
+ isLoaderVisible: !1,
1718
+ isVisible: !1,
1719
+ text: "Continue"
1720
+ },
1721
+ method: "web_app_setup_main_button",
1722
+ payload: (a) => ({
1723
+ has_shine_effect: a.hasShineEffect,
1724
+ is_visible: a.isVisible,
1725
+ is_active: a.isEnabled,
1726
+ is_progress_visible: a.isLoaderVisible,
1727
+ text: a.text,
1728
+ color: a.bgColor,
1729
+ text_color: a.textColor
1730
+ })
1731
+ }), i = (a, u) => {
1732
+ const o = n.stateGetter(a);
1733
+ return w(() => o() || $(u));
1734
+ };
1735
+ this.bgColor = i("bgColor", t.bgColor), this.textColor = i("textColor", t.textColor), this.hasShineEffect = n.stateGetter("hasShineEffect"), this.isEnabled = n.stateGetter("isEnabled"), this.isLoaderVisible = n.stateGetter("isLoaderVisible"), this.text = n.stateGetter("text"), this.isVisible = n.stateGetter("isVisible"), this.isMounted = n.isMounted, this.state = n.state, [this.setBgColor, this.setBgColorFp] = n.stateSetters("bgColor"), [this.setTextColor, this.setTextColorFp] = n.stateSetters("textColor"), [
1736
+ [this.disableShineEffect, this.disableShineEffectFp],
1737
+ [this.enableShineEffect, this.enableShineEffectFp]
1738
+ ] = n.stateBoolSetters("hasShineEffect"), [
1739
+ [this.disable, this.disableFp],
1740
+ [this.enable, this.enableFp]
1741
+ ] = n.stateBoolSetters("isEnabled"), [
1742
+ [this.hideLoader, this.hideLoaderFp],
1743
+ [this.showLoader, this.showLoaderFp]
1744
+ ] = n.stateBoolSetters("isLoaderVisible"), [this.setText, this.setTextFp] = n.stateSetters("text"), [[this.hide, this.hideFp], [this.show, this.showFp]] = n.stateBoolSetters("isVisible"), this.setParams = n.setState, this.setParamsFp = n.setStateFp, this.onClick = n.onClick, this.onClickFp = n.onClickFp, this.offClick = n.offClick, this.offClickFp = n.offClickFp, this.mount = n.mount, this.mountFp = n.mountFp, this.unmount = n.unmount;
1745
+ }
1746
+ //#endregion
1747
+ }
1748
+ function Ve(r, t) {
1749
+ document.documentElement.style.setProperty(r, t);
1750
+ }
1751
+ function Te(r) {
1752
+ document.documentElement.style.removeProperty(r);
1753
+ }
1754
+ function vs(r) {
1755
+ return p.pipe(
1756
+ bt(r),
1757
+ b.map((t) => Math.sqrt(
1758
+ [0.299, 0.587, 0.114].reduce((s, n, i) => {
1759
+ const a = parseInt(t.slice(1 + i * 2, 1 + (i + 1) * 2), 16);
1760
+ return s + a * a * n;
1761
+ }, 0)
1762
+ ) < 120)
1763
+ );
1764
+ }
1765
+ const tt = he(vs);
1766
+ class ks {
1767
+ constructor({
1768
+ initialState: t,
1769
+ onChange: s,
1770
+ offChange: n,
1771
+ isTma: i,
1772
+ storage: a,
1773
+ isPageReload: u
1774
+ }) {
1775
+ //#region Colors.
1776
+ /**
1777
+ * @since v6.10
1778
+ */
1779
+ e(this, "accentTextColor");
1780
+ e(this, "bgColor");
1781
+ e(this, "buttonColor");
1782
+ e(this, "buttonTextColor");
1783
+ /**
1784
+ * @since v7.10
1785
+ */
1786
+ e(this, "bottomBarBgColor");
1787
+ e(this, "destructiveTextColor");
1788
+ /**
1789
+ * @since v6.10
1790
+ */
1791
+ e(this, "headerBgColor");
1792
+ e(this, "hintColor");
1793
+ e(this, "linkColor");
1794
+ e(this, "secondaryBgColor");
1795
+ /**
1796
+ * @since v6.10
1797
+ */
1798
+ e(this, "sectionBgColor");
1799
+ /**
1800
+ * @since v6.10
1801
+ */
1802
+ e(this, "sectionHeaderTextColor");
1803
+ /**
1804
+ * @since v7.6
1805
+ */
1806
+ e(this, "sectionSeparatorColor");
1807
+ /**
1808
+ * @since v6.10
1809
+ */
1810
+ e(this, "subtitleTextColor");
1811
+ e(this, "textColor");
1812
+ //#endregion
1813
+ //#region CSS variables.
1814
+ e(this, "_isCssVarsBound", O(!1));
1815
+ /**
1816
+ * True if CSS variables are currently bound.
1817
+ */
1818
+ e(this, "isCssVarsBound", w(this._isCssVarsBound));
1819
+ /**
1820
+ * Creates CSS variables connected with the current theme parameters.
1821
+ *
1822
+ * By default, created CSS variables names are following the pattern "--tg-theme-{name}", where
1823
+ * {name} is a theme parameters key name converted from snake case to kebab case.
1824
+ *
1825
+ * Default variables:
1826
+ * - `--tg-theme-bg-color`
1827
+ * - `--tg-theme-secondary-text-color`
1828
+ *
1829
+ * Variables are being automatically updated if theme parameters were changed.
1830
+ *
1831
+ * @param getCSSVarName - function, returning complete CSS variable name for the specified
1832
+ * theme parameters key.
1833
+ * @returns Function to stop updating variables.
1834
+ * @throws {CSSVarsBoundError} CSS variables are already bound
1835
+ * @example Using custom CSS vars generator
1836
+ * themeParams.bindCssVars(key => `--my-prefix-${key}`);
1837
+ */
1838
+ e(this, "bindCssVarsFp");
1839
+ /**
1840
+ * @see bindCssVarsFp
1841
+ */
1842
+ e(this, "bindCssVars");
1843
+ //#endregion
1844
+ //#region Other public signals.
1845
+ /**
1846
+ * Complete component state.
1847
+ */
1848
+ e(this, "state");
1849
+ /**
1850
+ * @returns True if the current color scheme is recognized as dark.
1851
+ * This value is calculated based on the current theme's background color.
1852
+ */
1853
+ e(this, "isDark", w(() => {
1854
+ const t = this.bgColor();
1855
+ return !t || tt(t);
1856
+ }));
1857
+ //#endregion
1858
+ //#region Mounting.
1859
+ /**
1860
+ * Signal indicating if the component is currently mounted.
1861
+ */
1862
+ e(this, "isMounted");
1863
+ /**
1864
+ * Mounts the component restoring its state.
1865
+ */
1866
+ e(this, "mountFp");
1867
+ /**
1868
+ * @see mountFp
1869
+ */
1870
+ e(this, "mount");
1871
+ /**
1872
+ * Unmounts the component.
1873
+ */
1874
+ e(this, "unmount");
1875
+ const o = new J({
1876
+ initialState: {},
1877
+ onChange: a.set
1878
+ }), l = (C) => {
1879
+ o.setState(C.theme_params);
1880
+ }, _ = new ne({
1881
+ initialState: () => b.right($(t)),
1882
+ isPageReload: u,
1883
+ onMounted(C) {
1884
+ o.setState(C), s(l);
1885
+ },
1886
+ onUnmounted() {
1887
+ n(l);
1888
+ },
1889
+ restoreState: a.get
1890
+ }), F = { isTma: i, returns: "either" }, f = E(F), v = E({
1891
+ ...F,
1892
+ isMounted: _.isMounted
1893
+ });
1894
+ this.accentTextColor = o.getter("accent_text_color"), this.bgColor = o.getter("bg_color"), this.buttonColor = o.getter("button_color"), this.buttonTextColor = o.getter("button_text_color"), this.bottomBarBgColor = o.getter("bottom_bar_bg_color"), this.destructiveTextColor = o.getter("destructive_text_color"), this.headerBgColor = o.getter("header_bg_color"), this.hintColor = o.getter("hint_color"), this.linkColor = o.getter("link_color"), this.secondaryBgColor = o.getter("secondary_bg_color"), this.sectionBgColor = o.getter("section_bg_color"), this.sectionHeaderTextColor = o.getter("section_header_text_color"), this.sectionSeparatorColor = o.getter("section_separator_color"), this.subtitleTextColor = o.getter("subtitle_text_color"), this.textColor = o.getter("text_color"), this.state = o.state, this.isMounted = _.isMounted, this.bindCssVarsFp = v((C) => {
1895
+ if (this._isCssVarsBound())
1896
+ return b.left(new Ee());
1897
+ C || (C = (m) => `--tg-theme-${mt(m)}`);
1898
+ const k = (m) => {
1899
+ Object.entries(o.state()).forEach(([g, d]) => {
1900
+ d && m(g, d);
1901
+ });
1902
+ }, y = () => {
1903
+ k((m, g) => {
1904
+ Ve(C(m), g);
1905
+ });
1906
+ };
1907
+ return y(), o.state.sub(y), this._isCssVarsBound.set(!0), b.right(() => {
1908
+ k(Te), o.state.unsub(y), this._isCssVarsBound.set(!1);
1909
+ });
1910
+ }), this.mountFp = f(_.mount), this.unmount = _.unmount, this.bindCssVars = /* @__PURE__ */ h(this.bindCssVarsFp), this.mount = /* @__PURE__ */ h(this.mountFp);
1911
+ }
1912
+ //#endregion
1913
+ }
1914
+ const Se = /* @__PURE__ */ ie({});
1915
+ function ys() {
1916
+ return new ks({
1917
+ ...p.pipe(
1918
+ S(),
1919
+ Y("themeParams")
1920
+ ),
1921
+ offChange(r) {
1922
+ re("theme_changed", r);
1923
+ },
1924
+ onChange(r) {
1925
+ G("theme_changed", r);
1926
+ },
1927
+ initialState: Se
1928
+ });
1929
+ }
1930
+ const le = /* @__PURE__ */ ys();
1931
+ // @__NO_SIDE_EFFECTS__
1932
+ function st(r, t, s) {
1933
+ return p.pipe(
1934
+ /* @__PURE__ */ Ae(r, t),
1935
+ (n) => ({ ...n, defaults: s })
1936
+ );
1937
+ }
1938
+ const an = /* @__PURE__ */ new Ss(
1939
+ /* @__PURE__ */ st("mainButton", "main_button_pressed", {
1940
+ bgColor: w(() => le.buttonColor() || "#2481cc"),
1941
+ textColor: w(() => le.buttonTextColor() || "#ffffff")
1942
+ })
1943
+ );
1944
+ class Is {
1945
+ constructor({
1946
+ storage: t,
1947
+ isPageReload: s,
1948
+ version: n,
1949
+ postEvent: i,
1950
+ isTma: a,
1951
+ theme: u,
1952
+ onVisibilityChanged: o,
1953
+ offVisibilityChanged: l
1954
+ }) {
1955
+ //#region Other properties.
1956
+ /**
1957
+ * Signal indicating if the component is supported.
1958
+ */
1959
+ e(this, "isSupported");
1960
+ /**
1961
+ * True if the current Mini App background color is recognized as dark.
1962
+ */
1963
+ e(this, "isDark", w(() => {
1964
+ const t = this.bgColorRgb();
1965
+ return t ? tt(t) : !1;
1966
+ }));
1967
+ /**
1968
+ * Signal indicating if the mini app is currently active.
1969
+ */
1970
+ e(this, "isActive");
1971
+ /**
1972
+ * Complete component state.
1973
+ */
1974
+ e(this, "state");
1975
+ //#endregion
1976
+ //#region CSS variables.
1977
+ /**
1978
+ * True if the CSS variables are currently bound.
1979
+ */
1980
+ e(this, "isCssVarsBound");
1981
+ /**
1982
+ * Creates CSS variables connected with the mini app.
1983
+ *
1984
+ * Default variables:
1985
+ * - `--tg-bg-color`
1986
+ * - `--tg-header-color`
1987
+ * - `--tg-bottom-bar-color`
1988
+ *
1989
+ * Variables are being automatically updated if theme parameters were changed.
1990
+ *
1991
+ * @param getCSSVarName - function, returning complete CSS variable name for the specified
1992
+ * mini app key.
1993
+ * @returns Function to stop updating variables.
1994
+ * @example Using no arguments
1995
+ * miniApp.bindCssVars();
1996
+ * @example Using custom CSS vars generator
1997
+ * miniApp.bindCssVars(key => `--my-prefix-${key}`);
1998
+ */
1999
+ e(this, "bindCssVarsFp");
2000
+ e(this, "bindCssVars");
2001
+ //#endregion
2002
+ //#region Mounting.
2003
+ /**
2004
+ * Signal indicating if the component is mounted.
2005
+ */
2006
+ e(this, "isMounted");
2007
+ /**
2008
+ * Mounts the component.
2009
+ *
2010
+ * This function restores the component state and is automatically saving it in the local storage
2011
+ * if it changed.
2012
+ * @since Mini Apps v6.1
2013
+ */
2014
+ e(this, "mountFp");
2015
+ /**
2016
+ * @see mount
2017
+ */
2018
+ e(this, "mount");
2019
+ /**
2020
+ * Unmounts the component.
2021
+ */
2022
+ e(this, "unmount");
2023
+ //#endregion
2024
+ //#region Background color.
2025
+ /**
2026
+ * The Mini App background color.
2027
+ *
2028
+ * Represents an RGB color, or theme parameters key, like "bg_color", "secondary_bg_color", etc.
2029
+ *
2030
+ * Note that using a theme parameters key, background color becomes bound to the current
2031
+ * theme parameters, making it automatically being updated whenever theme parameters change.
2032
+ * In order to remove this bind, use an explicit RGB color.
2033
+ */
2034
+ e(this, "bgColor");
2035
+ /**
2036
+ * RGB representation of the background color.
2037
+ *
2038
+ * This value requires the Theme Params component to be mounted to extract a valid RGB value
2039
+ * of the color key.
2040
+ */
2041
+ e(this, "bgColorRgb");
2042
+ /**
2043
+ * Updates the mini app background color.
2044
+ * @since Mini Apps v6.1
2045
+ */
2046
+ e(this, "setBgColorFp");
2047
+ /**
2048
+ * @see setBgColorFp
2049
+ */
2050
+ e(this, "setBgColor");
2051
+ //#endregion
2052
+ //#region Header color.
2053
+ /**
2054
+ * The Mini App header color.
2055
+ */
2056
+ e(this, "headerColor");
2057
+ /**
2058
+ * RGB representation of the header color.
2059
+ *
2060
+ * This value requires the Theme Params component to be mounted to extract a valid RGB value
2061
+ * of the color key.
2062
+ */
2063
+ e(this, "headerColorRgb");
2064
+ /**
2065
+ * Updates the mini app header color.
2066
+ * @since Mini Apps v6.1
2067
+ */
2068
+ e(this, "setHeaderColorFp");
2069
+ /**
2070
+ * @see setHeaderColorFp
2071
+ */
2072
+ e(this, "setHeaderColor");
2073
+ //#endregion
2074
+ //#region Bottom bar background color.
2075
+ /**
2076
+ * The Mini App bottom bar background color.
2077
+ */
2078
+ e(this, "bottomBarColor");
2079
+ /**
2080
+ * RGB representation of the bottom bar background color.
2081
+ *
2082
+ * This value requires the Theme Params component to be mounted to extract a valid RGB value
2083
+ * of the color key.
2084
+ */
2085
+ e(this, "bottomBarColorRgb");
2086
+ /**
2087
+ * Updates the mini app bottom bar bg color.
2088
+ * @since Mini Apps v7.10
2089
+ */
2090
+ e(this, "setBottomBarColorFp");
2091
+ /**
2092
+ * @see setBottomBarColorFp
2093
+ */
2094
+ e(this, "setBottomBarColor");
2095
+ //#endregion
2096
+ //#region Other methods.
2097
+ /**
2098
+ * Closes the Mini App.
2099
+ * @param returnBack - should the client return to the previous activity.
2100
+ */
2101
+ e(this, "closeFp");
2102
+ /**
2103
+ * @see closeFp
2104
+ */
2105
+ e(this, "close");
2106
+ /**
2107
+ * Informs the Telegram app that the Mini App is ready to be displayed.
2108
+ *
2109
+ * It is recommended to call this method as early as possible, as soon as all
2110
+ * essential interface elements loaded.
2111
+ *
2112
+ * Once this method is called, the loading placeholder is hidden and the Mini
2113
+ * App shown.
2114
+ *
2115
+ * If the method is not called, the placeholder will be hidden only when the
2116
+ * page was fully loaded.
2117
+ */
2118
+ e(this, "readyFp");
2119
+ /**
2120
+ * @see readyFp
2121
+ */
2122
+ e(this, "ready");
2123
+ const _ = (d) => {
2124
+ v.setState({ isActive: d.is_visible });
2125
+ }, F = (d) => {
2126
+ [
2127
+ [this.headerColor, "web_app_set_header_color"],
2128
+ [this.bgColor, "web_app_set_background_color"],
2129
+ [this.bottomBarColor, "web_app_set_bottom_bar_color"]
2130
+ ].forEach(([B, T]) => {
2131
+ const M = B();
2132
+ if (!fe(M) && (T !== "web_app_set_header_color" || !["bg_color", "secondary_bg_color"].includes(M))) {
2133
+ const P = d[M];
2134
+ P && i(T, { color: P });
2135
+ }
2136
+ });
2137
+ }, f = new ne({
2138
+ initialState() {
2139
+ return b.right({
2140
+ bgColor: "bg_color",
2141
+ headerColor: "header_bg_color",
2142
+ bottomBarColor: "bottom_bar_bg_color",
2143
+ isActive: !0
2144
+ });
2145
+ },
2146
+ isPageReload: s,
2147
+ onMounted: (d) => {
2148
+ o(_), u.sub(F), v.setState(d);
2149
+ },
2150
+ onUnmounted() {
2151
+ l(_), u.unsub(F);
2152
+ },
2153
+ restoreState: t.get
2154
+ });
2155
+ this.isMounted = f.isMounted, this.mountFp = A(() => {
2156
+ const d = () => {
2157
+ };
2158
+ return p.pipe(f.mount(), b.match(d, d));
2159
+ }, { isTma: a, returns: "plain" }), this.mount = /* @__PURE__ */ h(this.mountFp), this.unmount = f.unmount;
2160
+ const v = new J({
2161
+ initialState: {
2162
+ bgColor: "bg_color",
2163
+ bottomBarColor: "bottom_bar_bg_color",
2164
+ headerColor: "bg_color",
2165
+ isActive: !1
2166
+ },
2167
+ onChange: t.set
2168
+ });
2169
+ this.state = v.state;
2170
+ const C = (d) => fe(d) ? d : $(u)[d], k = (d) => w(() => C(d()));
2171
+ this.isActive = v.getter("isActive"), this.isSupported = w(() => [
2172
+ "web_app_set_header_color",
2173
+ "web_app_set_background_color",
2174
+ "web_app_set_bottom_bar_color"
2175
+ ].some((d) => ee(d, $(n))));
2176
+ const y = O(!1);
2177
+ this.isCssVarsBound = w(y), this.bindCssVarsFp = A((d) => {
2178
+ if (y())
2179
+ return b.left(new Ee());
2180
+ const [B, T] = ye(() => {
2181
+ y.set(!1);
2182
+ }), M = (P, L) => {
2183
+ const U = () => {
2184
+ Ve(P, L() || null);
2185
+ };
2186
+ U(), B(L.sub(U), Te.bind(null, P));
2187
+ };
2188
+ return d || (d = (P) => `--tg-${We(P)}`), M(d("bgColor"), this.bgColorRgb), M(d("bottomBarColor"), this.bottomBarColorRgb), M(d("headerColor"), this.headerColorRgb), y.set(!0), b.right(T);
2189
+ }, { isTma: a, returns: "either", isMounted: this.isMounted }), this.bindCssVars = /* @__PURE__ */ h(this.bindCssVarsFp);
2190
+ const m = (d) => {
2191
+ const B = v.getter(d), T = k(B), M = {
2192
+ headerColor: "web_app_set_header_color",
2193
+ bgColor: "web_app_set_background_color",
2194
+ bottomBarColor: "web_app_set_bottom_bar_color"
2195
+ }[d], P = A(
2196
+ (L) => {
2197
+ if (L === B())
2198
+ return b.right(void 0);
2199
+ if (M === "web_app_set_header_color" && (L === "bg_color" || L === "secondary_bg_color"))
2200
+ return p.pipe(
2201
+ i("web_app_set_header_color", { color_key: L }),
2202
+ b.map(() => {
2203
+ v.setState({ [d]: L });
2204
+ })
2205
+ );
2206
+ const U = C(L);
2207
+ return p.pipe(
2208
+ U ? i(M, { color: U }) : b.left(new xt(L)),
2209
+ b.map(() => {
2210
+ v.setState({ [d]: L });
2211
+ })
2212
+ );
2213
+ },
2214
+ {
2215
+ isTma: a,
2216
+ version: n,
2217
+ requires: M,
2218
+ isMounted: this.isMounted,
2219
+ returns: "either",
2220
+ supports: d === "headerColor" ? {
2221
+ rgb: {
2222
+ method: "web_app_set_header_color",
2223
+ param: "color",
2224
+ shouldCheck: fe
2225
+ }
2226
+ } : void 0
2227
+ }
2228
+ );
2229
+ return [B, T, /* @__PURE__ */ h(P), P];
2230
+ };
2231
+ [
2232
+ this.bgColor,
2233
+ this.bgColorRgb,
2234
+ this.setBgColor,
2235
+ this.setBgColorFp
2236
+ ] = m("bgColor"), [
2237
+ this.headerColor,
2238
+ this.headerColorRgb,
2239
+ this.setHeaderColor,
2240
+ this.setHeaderColorFp
2241
+ ] = m("headerColor"), [
2242
+ this.bottomBarColor,
2243
+ this.bottomBarColorRgb,
2244
+ this.setBottomBarColor,
2245
+ this.setBottomBarColorFp
2246
+ ] = m("bottomBarColor");
2247
+ const g = E({ isTma: a, returns: "either" });
2248
+ this.closeFp = g((d) => i("web_app_close", { return_back: d })), this.close = /* @__PURE__ */ h(this.closeFp), this.readyFp = g(() => i("web_app_ready")), this.ready = /* @__PURE__ */ h(this.readyFp);
2249
+ }
2250
+ //#endregion
2251
+ }
2252
+ function Es() {
2253
+ return new Is({
2254
+ ...p.pipe(
2255
+ S(),
2256
+ V,
2257
+ I,
2258
+ Y("miniApp")
2259
+ ),
2260
+ offVisibilityChanged(r) {
2261
+ re("visibility_changed", r);
2262
+ },
2263
+ onVisibilityChanged(r) {
2264
+ G("visibility_changed", r);
2265
+ },
2266
+ theme: le.state
2267
+ });
2268
+ }
2269
+ const qs = /* @__PURE__ */ Es();
2270
+ function As() {
2271
+ const r = Date.now(), t = Math.random().toString(36).substring(2, 9);
2272
+ return `notif_${r}_${t}`;
2273
+ }
2274
+ class Bs {
2275
+ constructor({}) {
2276
+ /**
2277
+ * Sends a notification to the native app.
2278
+ * @param options - notification options including message, optional title, and optional type (defaults to 'default')
2279
+ * @since v9.2
2280
+ */
2281
+ e(this, "sendFp");
2282
+ /**
2283
+ * @see sendFp
2284
+ */
2285
+ e(this, "send");
2286
+ this.sendFp = (t) => p.pipe(
2287
+ c.fromEither(
2288
+ ke("web_app_send_notification", {
2289
+ id: As(),
2290
+ message: t.message,
2291
+ title: t.title,
2292
+ type: t.type ?? "default"
2293
+ })
2294
+ ),
2295
+ c.map(() => {
2296
+ })
2297
+ ), this.send = (t) => this.sendFp(t)().then((n) => {
2298
+ if (n._tag === "Left")
2299
+ throw n.left;
2300
+ return n.right;
2301
+ });
2302
+ }
2303
+ }
2304
+ function xs() {
2305
+ return new Bs(p.pipe(S()));
2306
+ }
2307
+ const pn = /* @__PURE__ */ xs();
2308
+ function Ms(r) {
2309
+ const t = r.message.trim(), s = (r.title || "").trim(), n = r.buttons || [];
2310
+ if (s.length > 64)
2311
+ return b.left(new W(`Invalid title: ${s}`));
2312
+ if (!t || t.length > 256)
2313
+ return b.left(new W(`Invalid message: ${t}`));
2314
+ if (n.length > 3)
2315
+ return b.left(new W(`Invalid buttons count: ${n.length}`));
2316
+ const i = [];
2317
+ if (!n.length)
2318
+ i.push({ type: "close", id: "" });
2319
+ else
2320
+ for (let a = 0; a < n.length; a++) {
2321
+ const u = n[a], o = u.id || "";
2322
+ if (o.length > 64)
2323
+ return b.left(new W(`Button with index ${a} has invalid id: ${o}`));
2324
+ if (!u.type || u.type === "default" || u.type === "destructive") {
2325
+ const l = u.text.trim();
2326
+ if (!l || l.length > 64)
2327
+ return b.left(new W(`Button with index ${a} has invalid text: ${l}`));
2328
+ i.push({ type: u.type, text: l, id: o });
2329
+ } else
2330
+ i.push({ type: u.type, id: o });
2331
+ }
2332
+ return b.right({ title: s, message: t, buttons: i });
2333
+ }
2334
+ class Vs {
2335
+ constructor({ version: t, isTma: s, request: n }) {
2336
+ /**
2337
+ * Signal indicating if any popup is currently opened.
2338
+ */
2339
+ e(this, "isOpened");
2340
+ /**
2341
+ * Signal indicating if the component is supported.
2342
+ */
2343
+ e(this, "isSupported");
2344
+ /**
2345
+ * A method that shows a native popup described by the `params` argument.
2346
+ * The promise will be resolved when the popup is closed. Resolved value will have
2347
+ * an identifier of the pressed button.
2348
+ *
2349
+ * If a user clicked outside the popup or clicked the top right popup close
2350
+ * button, null will be resolved.
2351
+ *
2352
+ * @param options - popup parameters.
2353
+ * @since Mini Apps v6.2
2354
+ * @example
2355
+ * fn.pipe(
2356
+ * popup.showFp({
2357
+ * title: 'Confirm action',
2358
+ * message: 'Do you really want to buy this burger?',
2359
+ * buttons: [
2360
+ * { id: 'yes', text: 'Yes' },
2361
+ * { id: 'no', type: 'destructive', text: 'No' },
2362
+ * ],
2363
+ * }),
2364
+ * TE.map(buttonId => {
2365
+ * console.log('User clicked a button with ID', buttonId);
2366
+ * }),
2367
+ * );
2368
+ */
2369
+ e(this, "showFp");
2370
+ /**
2371
+ * @see showFp
2372
+ */
2373
+ e(this, "show");
2374
+ const i = O(!1), a = () => {
2375
+ i.set(!1);
2376
+ }, u = E({
2377
+ version: t,
2378
+ isTma: s,
2379
+ requires: "web_app_open_popup",
2380
+ returns: "task"
2381
+ });
2382
+ this.isSupported = H("web_app_open_popup", t), this.isOpened = w(i), this.showFp = u((o) => p.pipe(
2383
+ this.isOpened() ? c.left(new qe("A popup is already opened")) : c.right(void 0),
2384
+ c.chainW(() => c.fromEither(Ms(o))),
2385
+ c.chain((l) => (i.set(!0), n("web_app_open_popup", "popup_closed", {
2386
+ ...o,
2387
+ params: l
2388
+ }))),
2389
+ c.mapBoth(
2390
+ (l) => (a(), l),
2391
+ (l) => (a(), l.button_id)
2392
+ )
2393
+ )), this.show = /* @__PURE__ */ h(this.showFp);
2394
+ }
2395
+ }
2396
+ function Ts() {
2397
+ return new Vs(p.pipe(S(), R, I));
2398
+ }
2399
+ const un = /* @__PURE__ */ Ts();
2400
+ function Rs({ request: r, ...t }) {
2401
+ return A((s) => p.pipe(
2402
+ r("web_app_request_phone", "phone_requested", s),
2403
+ c.map((n) => n.status)
2404
+ ), { ...t, requires: "web_app_request_phone", returns: "task" });
2405
+ }
2406
+ // @__NO_SIDE_EFFECTS__
2407
+ function Ls() {
2408
+ return Rs(p.pipe(
2409
+ S(),
2410
+ I,
2411
+ R
2412
+ ));
2413
+ }
2414
+ const rt = /* @__PURE__ */ Ls(), cn = /* @__PURE__ */ h(rt);
2415
+ function $s({
2416
+ invokeCustomMethod: r,
2417
+ requestPhoneAccess: t,
2418
+ ...s
2419
+ }) {
2420
+ const n = (u) => p.pipe(
2421
+ r("getRequestedContact", {}, {
2422
+ ...u,
2423
+ timeout: (u || {}).timeout || 5e3
2424
+ }),
2425
+ c.chainW((o) => {
2426
+ const l = Fe(K(), o);
2427
+ if (!l.success)
2428
+ return c.left(new pe(o, l.issues));
2429
+ if (!l.output)
2430
+ return c.right(void 0);
2431
+ const _ = Fe(
2432
+ gt(
2433
+ De({
2434
+ contact: Ft(De({
2435
+ user_id: Qe(),
2436
+ phone_number: K(),
2437
+ first_name: K(),
2438
+ last_name: St(K())
2439
+ })),
2440
+ auth_date: ze(
2441
+ K(),
2442
+ Ke((F) => new Date(Number(F) * 1e3)),
2443
+ Ne()
2444
+ ),
2445
+ hash: K()
2446
+ })
2447
+ ),
2448
+ l.output
2449
+ );
2450
+ return _.success ? c.right({ raw: l.output, parsed: _.output }) : c.left(new pe(l.output, _.issues));
2451
+ })
2452
+ ), i = (u) => p.pipe(
2453
+ n(u),
2454
+ c.match(
2455
+ // All other errors except validation ones should be ignored. Receiving validation error
2456
+ // means that we have some data, but we are unable to parse it properly. So, there is no
2457
+ // need to make some more requests further, the problem is local.
2458
+ (o) => pe.is(o) ? b.left(o) : b.right(void 0),
2459
+ (o) => b.right(o)
2460
+ )
2461
+ ), a = (u) => ge(
2462
+ async (o, l, _) => {
2463
+ let F = 50;
2464
+ for (; !_.isRejected; ) {
2465
+ const f = await i(_)();
2466
+ if (f._tag === "Left")
2467
+ return l(f.left);
2468
+ if (f.right)
2469
+ return o(f.right);
2470
+ await new Promise((v) => setTimeout(v, F)), F += 50;
2471
+ }
2472
+ },
2473
+ u
2474
+ );
2475
+ return A((u) => ge.fn((o) => p.pipe(
2476
+ // Try to get the requested contact. Probably, we already requested it before.
2477
+ i(o),
2478
+ c.chain((l) => l ? c.right(l) : p.pipe(
2479
+ t(o),
2480
+ c.chainW((_) => _ === "sent" ? a(o) : c.left(new Je("User denied access")))
2481
+ ))
2482
+ ), u), { ...s, returns: "task", requires: "web_app_request_phone" });
2483
+ }
2484
+ // @__NO_SIDE_EFFECTS__
2485
+ function Ps() {
2486
+ return $s({
2487
+ ...p.pipe(S(), Me, I),
2488
+ requestPhoneAccess: rt
2489
+ });
2490
+ }
2491
+ function Os({ requestContact: r, ...t }) {
2492
+ return A(
2493
+ r,
2494
+ { ...t, returns: "task", requires: "web_app_request_phone" }
2495
+ );
2496
+ }
2497
+ // @__NO_SIDE_EFFECTS__
2498
+ function Ds() {
2499
+ return Os({
2500
+ ...p.pipe(S(), I),
2501
+ requestContact(r) {
2502
+ return p.pipe(
2503
+ nt(r),
2504
+ c.map((t) => t.parsed)
2505
+ );
2506
+ }
2507
+ });
2508
+ }
2509
+ const nt = /* @__PURE__ */ Ps(), ln = /* @__PURE__ */ h(nt), Gs = /* @__PURE__ */ Ds(), hn = /* @__PURE__ */ h(Gs);
2510
+ function js({ request: r, ...t }) {
2511
+ return A((s) => p.pipe(
2512
+ r("web_app_request_write_access", "write_access_requested", s),
2513
+ c.map((n) => n.status)
2514
+ ), { ...t, requires: "web_app_request_write_access", returns: "task" });
2515
+ }
2516
+ // @__NO_SIDE_EFFECTS__
2517
+ function Us() {
2518
+ return js(p.pipe(
2519
+ S(),
2520
+ I,
2521
+ R
2522
+ ));
2523
+ }
2524
+ const Ws = /* @__PURE__ */ Us(), dn = /* @__PURE__ */ h(Ws);
2525
+ class Hs {
2526
+ constructor({
2527
+ version: t,
2528
+ onClosed: s,
2529
+ onTextReceived: n,
2530
+ isTma: i,
2531
+ postEvent: a
2532
+ }) {
2533
+ /**
2534
+ * Signal indicating if the scanner is currently opened.
2535
+ */
2536
+ e(this, "isOpened");
2537
+ /**
2538
+ * Signal indicating if the component is supported.
2539
+ */
2540
+ e(this, "isSupported");
2541
+ /**
2542
+ * Opens the scanner and returns a task which will be completed with the QR content if the
2543
+ * passed `capture` function returned true.
2544
+ *
2545
+ * Task may also be completed with undefined if the scanner was closed.
2546
+ * @param options - method options.
2547
+ * @returns A promise with QR content presented as string or undefined if the scanner was closed.
2548
+ * @since Mini Apps v6.4
2549
+ * @example
2550
+ * fn.pipe(
2551
+ * qrScanner.captureFp({
2552
+ * capture(scannedQr) {
2553
+ * return scannedQr === 'any expected by me qr';
2554
+ * }
2555
+ * }),
2556
+ * TE.match(
2557
+ * error => {
2558
+ * console.error(error);
2559
+ * },
2560
+ * qr => {
2561
+ * console.log('My QR:'), qr;
2562
+ * }
2563
+ * ),
2564
+ * );
2565
+ */
2566
+ e(this, "captureFp");
2567
+ /**
2568
+ * @see captureFp
2569
+ */
2570
+ e(this, "capture");
2571
+ /**
2572
+ * Closes the scanner.
2573
+ * @since Mini Apps v6.4
2574
+ */
2575
+ e(this, "closeFp");
2576
+ /**
2577
+ * @see close
2578
+ */
2579
+ e(this, "close");
2580
+ /**
2581
+ * Opens the scanner and returns a task which will be completed when the scanner was closed.
2582
+ * @param options - method options.
2583
+ * @since Mini Apps v6.4
2584
+ * @example Without `capture` option
2585
+ * if (qrScanner.open.isAvailable()) {
2586
+ * const qr = await qrScanner.open({ text: 'Scan any QR' });
2587
+ * }
2588
+ * @example
2589
+ * fn.pipe(
2590
+ * qrScanner.openFp({
2591
+ * onCaptured(scannedQr) {
2592
+ * if (scannedQr === 'any expected by me qr') {
2593
+ * qrScanner.close();
2594
+ * }
2595
+ * }
2596
+ * }),
2597
+ * TE.match(
2598
+ * error => {
2599
+ * console.error(error);
2600
+ * },
2601
+ * () => {
2602
+ * console.log('The scanner was closed');
2603
+ * }
2604
+ * ),
2605
+ * );
2606
+ */
2607
+ e(this, "openFp");
2608
+ /**
2609
+ * @see openFp
2610
+ */
2611
+ e(this, "open");
2612
+ const u = { version: t, requires: "web_app_open_scan_qr_popup", isTma: i }, o = E({ ...u, returns: "either" }), l = E({ ...u, returns: "task" }), _ = O(!1), F = () => {
2613
+ _.set(!1);
2614
+ };
2615
+ this.isSupported = H("web_app_open_scan_qr_popup", t), this.isOpened = w(_), this.captureFp = l((f) => {
2616
+ let v;
2617
+ return p.pipe(
2618
+ this.openFp({
2619
+ ...f,
2620
+ onCaptured: (C) => {
2621
+ f.capture(C) && (v = C, this.close());
2622
+ }
2623
+ }),
2624
+ c.map(() => v)
2625
+ );
2626
+ }), this.closeFp = o(() => p.pipe(a("web_app_close_scan_qr_popup"), b.map(F))), this.openFp = l((f) => p.pipe(
2627
+ _() ? c.left(new qe("The QR Scanner is already opened")) : async () => a("web_app_open_scan_qr_popup", { text: f.text }),
2628
+ c.chainW(() => {
2629
+ _.set(!0);
2630
+ const [v, C] = ye(), k = (y) => (C(), _.set(!1), y);
2631
+ return p.pipe(
2632
+ ge((y) => {
2633
+ v(
2634
+ // The scanner was closed externally.
2635
+ s(y),
2636
+ // The scanner was closed internally.
2637
+ _.sub((m) => {
2638
+ m || y();
2639
+ }),
2640
+ n(f.onCaptured)
2641
+ );
2642
+ }, f),
2643
+ c.mapBoth(k, k)
2644
+ );
2645
+ })
2646
+ )), this.open = /* @__PURE__ */ h(this.openFp), this.capture = /* @__PURE__ */ h(this.captureFp), this.close = /* @__PURE__ */ h(this.closeFp);
2647
+ }
2648
+ }
2649
+ function zs() {
2650
+ return new Hs({
2651
+ ...p.pipe(S(), V, I),
2652
+ onClosed(r) {
2653
+ return G("scan_qr_popup_closed", r);
2654
+ },
2655
+ onTextReceived(r) {
2656
+ return G("qr_text_received", (t) => {
2657
+ r(t.data);
2658
+ });
2659
+ }
2660
+ });
2661
+ }
2662
+ const fn = /* @__PURE__ */ zs();
2663
+ class Ks {
2664
+ constructor({}) {
2665
+ /**
2666
+ * Signal indicating if refresh is currently in progress.
2667
+ */
2668
+ e(this, "isRefreshing");
2669
+ /**
2670
+ * Notifies native app that refresh has completed.
2671
+ * @since v9.2
2672
+ */
2673
+ e(this, "finishRefreshFp");
2674
+ /**
2675
+ * @see finishRefreshFp
2676
+ */
2677
+ e(this, "finishRefresh");
2678
+ /**
2679
+ * Subscribes to refresh request events from native app.
2680
+ * @param listener - callback function to execute when refresh is requested
2681
+ * @returns unsubscribe function
2682
+ * @since v9.2
2683
+ * @example
2684
+ * const unsubscribe = refresh.onRefreshRequest(() => {
2685
+ * // Fetch new data
2686
+ * fetchData().then(() => {
2687
+ * refresh.finishRefresh();
2688
+ * });
2689
+ * });
2690
+ */
2691
+ e(this, "onRefreshRequest");
2692
+ const t = O(!1);
2693
+ G("refresh_requested", () => {
2694
+ t.set(!0);
2695
+ }), this.isRefreshing = w(t), this.finishRefreshFp = () => p.pipe(
2696
+ c.fromEither(ke("web_app_finish_refresh", {
2697
+ isRefreshed: !0
2698
+ })),
2699
+ c.map(() => {
2700
+ t.set(!1);
2701
+ })
2702
+ ), this.finishRefresh = () => this.finishRefreshFp()().then((n) => {
2703
+ if (n._tag === "Left")
2704
+ throw n.left;
2705
+ return n.right;
2706
+ }), this.onRefreshRequest = (s) => G("refresh_requested", () => {
2707
+ s();
2708
+ });
2709
+ }
2710
+ }
2711
+ function Ns() {
2712
+ return new Ks(p.pipe(S()));
2713
+ }
2714
+ const _n = /* @__PURE__ */ Ns();
2715
+ class Qs {
2716
+ constructor({ defaults: t, ...s }) {
2717
+ //#region Properties.
2718
+ /**
2719
+ * Signal indicating if the component is supported.
2720
+ */
2721
+ e(this, "isSupported");
2722
+ /**
2723
+ * The button position relative to the main one.
2724
+ */
2725
+ e(this, "position");
2726
+ /**
2727
+ * The button background color.
2728
+ */
2729
+ e(this, "bgColor");
2730
+ /**
2731
+ * True if the button has a shining effect.
2732
+ */
2733
+ e(this, "hasShineEffect");
2734
+ /**
2735
+ * True if the button is clickable.
2736
+ */
2737
+ e(this, "isEnabled");
2738
+ /**
2739
+ * True if the button loader is visible.
2740
+ */
2741
+ e(this, "isLoaderVisible");
2742
+ /**
2743
+ * True if the button is visible.
2744
+ */
2745
+ e(this, "isVisible");
2746
+ /**
2747
+ * Signal indicating if the component is currently mounted.
2748
+ */
2749
+ e(this, "isMounted");
2750
+ /**
2751
+ * The complete button state.
2752
+ */
2753
+ e(this, "state");
2754
+ /**
2755
+ * The button displayed text.
2756
+ */
2757
+ e(this, "text");
2758
+ /**
2759
+ * The button text color.
2760
+ *
2761
+ * Note that this value is computed based on the external defaults. For
2762
+ * example, if not explicitly set, this value may be equal to one of theme
2763
+ * params colors.
2764
+ */
2765
+ e(this, "textColor");
2766
+ //#endregion
2767
+ //#region Methods.
2768
+ /**
2769
+ * Shows the button.
2770
+ * @since Mini Apps v7.10
2771
+ */
2772
+ e(this, "showFp");
2773
+ /**
2774
+ * @see showFp
2775
+ */
2776
+ e(this, "show");
2777
+ /**
2778
+ * Hides the button.
2779
+ * @since Mini Apps v7.10
2780
+ */
2781
+ e(this, "hideFp");
2782
+ /**
2783
+ * @see hideFp
2784
+ */
2785
+ e(this, "hide");
2786
+ /**
2787
+ * Enables the button.
2788
+ * @since Mini Apps v7.10
2789
+ */
2790
+ e(this, "enableFp");
2791
+ /**
2792
+ * @see enableFp
2793
+ */
2794
+ e(this, "enable");
2795
+ /**
2796
+ * Enables the button.
2797
+ * @since Mini Apps v7.10
2798
+ */
2799
+ e(this, "enableShineEffectFp");
2800
+ /**
2801
+ * @see enableShineEffectFp
2802
+ */
2803
+ e(this, "enableShineEffect");
2804
+ /**
2805
+ * Disables the button.
2806
+ * @since Mini Apps v7.10
2807
+ */
2808
+ e(this, "disableFp");
2809
+ /**
2810
+ * @see disableFp
2811
+ */
2812
+ e(this, "disable");
2813
+ /**
2814
+ * Enables the button.
2815
+ * @since Mini Apps v7.10
2816
+ */
2817
+ e(this, "disableShineEffectFp");
2818
+ /**
2819
+ * @see disableShineEffectFp
2820
+ */
2821
+ e(this, "disableShineEffect");
2822
+ /**
2823
+ * Updates the button background color.
2824
+ * @since Mini Apps v7.10
2825
+ */
2826
+ e(this, "setBgColorFp");
2827
+ /**
2828
+ * @see setBgColorFp
2829
+ */
2830
+ e(this, "setBgColor");
2831
+ /**
2832
+ * Updates the button text color.
2833
+ * @since Mini Apps v7.10
2834
+ */
2835
+ e(this, "setTextColorFp");
2836
+ /**
2837
+ * @see setTextColorFp
2838
+ */
2839
+ e(this, "setTextColor");
2840
+ /**
2841
+ * Updates the button text.
2842
+ * @since Mini Apps v7.10
2843
+ */
2844
+ e(this, "setTextFp");
2845
+ /**
2846
+ * @see setTextFp
2847
+ */
2848
+ e(this, "setText");
2849
+ /**
2850
+ * Updates the button position.
2851
+ * @since Mini Apps v7.10
2852
+ */
2853
+ e(this, "setPositionFp");
2854
+ /**
2855
+ * @see setPositionFp
2856
+ */
2857
+ e(this, "setPosition");
2858
+ /**
2859
+ * Shows the button loader.
2860
+ * @since Mini Apps v7.10
2861
+ */
2862
+ e(this, "showLoaderFp");
2863
+ /**
2864
+ * @see showLoaderFp
2865
+ */
2866
+ e(this, "showLoader");
2867
+ /**
2868
+ * Hides the button loader.
2869
+ * @since Mini Apps v7.10
2870
+ */
2871
+ e(this, "hideLoaderFp");
2872
+ /**
2873
+ * @see hideLoaderFp
2874
+ */
2875
+ e(this, "hideLoader");
2876
+ /**
2877
+ * Updates the button state.
2878
+ * @param state - updates to apply.
2879
+ * @since Mini Apps v7.10
2880
+ * @example
2881
+ * button.setParams({
2882
+ * text: 'Submit',
2883
+ * isEnabled: true,
2884
+ * hasShineEffect: true,
2885
+ * });
2886
+ */
2887
+ e(this, "setParamsFp");
2888
+ /**
2889
+ * @see setParamsFp
2890
+ */
2891
+ e(this, "setParams");
2892
+ /**
2893
+ * Mounts the component restoring its state.
2894
+ * @since Mini Apps v7.10
2895
+ */
2896
+ e(this, "mountFp");
2897
+ /**
2898
+ * @see mountFp
2899
+ */
2900
+ e(this, "mount");
2901
+ /**
2902
+ * Unmounts the component.
2903
+ */
2904
+ e(this, "unmount");
2905
+ /**
2906
+ * Adds a new button listener.
2907
+ * @param listener - event listener.
2908
+ * @param once - should the listener be called only once.
2909
+ * @returns A function to remove bound listener.
2910
+ * @since Mini Apps v7.10
2911
+ * @example
2912
+ * const off = button.onClick(() => {
2913
+ * console.log('User clicked the button');
2914
+ * off();
2915
+ * });
2916
+ */
2917
+ e(this, "onClickFp");
2918
+ /**
2919
+ * @see onClick
2920
+ */
2921
+ e(this, "onClick");
2922
+ /**
2923
+ * Removes the button click listener.
2924
+ * @param listener - event listener.
2925
+ * @param once - should the listener be called only once.
2926
+ * @since Mini Apps v7.10
2927
+ * @example
2928
+ * function listener() {
2929
+ * console.log('User clicked the button');
2930
+ * button.offClick(listener);
2931
+ * }
2932
+ * button.onClick(listener);
2933
+ */
2934
+ e(this, "offClickFp");
2935
+ /**
2936
+ * @see offClick
2937
+ */
2938
+ e(this, "offClick");
2939
+ const n = new de({
2940
+ ...s,
2941
+ initialState: {
2942
+ hasShineEffect: !1,
2943
+ isEnabled: !0,
2944
+ isLoaderVisible: !1,
2945
+ isVisible: !1,
2946
+ text: "Cancel",
2947
+ position: "left"
2948
+ },
2949
+ method: "web_app_setup_secondary_button",
2950
+ payload: (a) => ({
2951
+ has_shine_effect: a.hasShineEffect,
2952
+ is_visible: a.isVisible,
2953
+ is_active: a.isEnabled,
2954
+ is_progress_visible: a.isLoaderVisible,
2955
+ text: a.text,
2956
+ color: a.bgColor,
2957
+ text_color: a.textColor,
2958
+ position: a.position
2959
+ })
2960
+ }), i = (a, u) => {
2961
+ const o = n.stateGetter(a);
2962
+ return w(() => o() || $(u));
2963
+ };
2964
+ this.isSupported = H("web_app_setup_secondary_button", s.version), this.bgColor = i("bgColor", t.bgColor), this.textColor = i("textColor", t.textColor), this.position = n.stateGetter("position"), this.hasShineEffect = n.stateGetter("hasShineEffect"), this.isEnabled = n.stateGetter("isEnabled"), this.isLoaderVisible = n.stateGetter("isLoaderVisible"), this.text = n.stateGetter("text"), this.isVisible = n.stateGetter("isVisible"), this.isMounted = n.isMounted, this.state = n.state, [this.setPosition, this.setPositionFp] = n.stateSetters("position"), [this.setBgColor, this.setBgColorFp] = n.stateSetters("bgColor"), [this.setTextColor, this.setTextColorFp] = n.stateSetters("textColor"), [
2965
+ [this.disableShineEffect, this.disableShineEffectFp],
2966
+ [this.enableShineEffect, this.enableShineEffectFp]
2967
+ ] = n.stateBoolSetters("hasShineEffect"), [
2968
+ [this.disable, this.disableFp],
2969
+ [this.enable, this.enableFp]
2970
+ ] = n.stateBoolSetters("isEnabled"), [
2971
+ [this.hideLoader, this.hideLoaderFp],
2972
+ [this.showLoader, this.showLoaderFp]
2973
+ ] = n.stateBoolSetters("isLoaderVisible"), [this.setText, this.setTextFp] = n.stateSetters("text"), [[this.hide, this.hideFp], [this.show, this.showFp]] = n.stateBoolSetters("isVisible"), this.setParams = n.setState, this.setParamsFp = n.setStateFp, this.onClick = n.onClick, this.onClickFp = n.onClickFp, this.offClick = n.offClick, this.offClickFp = n.offClickFp, this.mount = n.mount, this.mountFp = n.mountFp, this.unmount = n.unmount;
2974
+ }
2975
+ //#endregion
2976
+ }
2977
+ function Js() {
2978
+ return new Qs(
2979
+ /* @__PURE__ */ st("secondaryButton", "secondary_button_pressed", {
2980
+ bgColor: w(() => qs.bottomBarColorRgb() || "#000000"),
2981
+ textColor: w(() => le.buttonColor() || "#2481cc")
2982
+ })
2983
+ );
2984
+ }
2985
+ const mn = /* @__PURE__ */ Js();
2986
+ class Ys {
2987
+ constructor({ isTma: t, request: s, version: n, createRequestId: i }) {
2988
+ /**
2989
+ * Retrieves an item using its key.
2990
+ * @since Mini Apps v9.0
2991
+ */
2992
+ e(this, "getItemFp");
2993
+ /**
2994
+ * @see getItemFp
2995
+ */
2996
+ e(this, "getItem");
2997
+ /**
2998
+ * Restores an item from the storage.
2999
+ * @since Mini Apps v9.0
3000
+ */
3001
+ e(this, "restoreItemFp");
3002
+ /**
3003
+ * @see restoreItemFp
3004
+ */
3005
+ e(this, "restoreItem");
3006
+ /**
3007
+ * Sets a new item in the storage.
3008
+ * @since Mini Apps v9.0
3009
+ */
3010
+ e(this, "setItemFp");
3011
+ /**
3012
+ * @see setItemFp
3013
+ */
3014
+ e(this, "setItem");
3015
+ /**
3016
+ * Removes a key from the storage.
3017
+ * @since Mini Apps v9.0
3018
+ */
3019
+ e(this, "deleteItemFp");
3020
+ /**
3021
+ * @see deleteItemFp
3022
+ */
3023
+ e(this, "deleteItem");
3024
+ /**
3025
+ * Removes all keys from the storage.
3026
+ * @since Mini Apps v9.0
3027
+ */
3028
+ e(this, "clearFp");
3029
+ /**
3030
+ * @see clearFp
3031
+ */
3032
+ e(this, "clear");
3033
+ const a = E({
3034
+ version: n,
3035
+ requires: "web_app_secure_storage_get_key",
3036
+ isTma: t,
3037
+ returns: "task"
3038
+ }), u = (o, l, _) => {
3039
+ const F = i();
3040
+ return p.pipe(
3041
+ s(o, ["secure_storage_failed", l], {
3042
+ params: { ..._, req_id: F },
3043
+ capture: ((f) => "payload" in f ? f.payload.req_id === F : !0)
3044
+ }),
3045
+ c.chain((f) => f.event === "secure_storage_failed" ? c.left(new yt(f.payload.error || "UNKNOWN_ERROR")) : c.right(f.payload))
3046
+ );
3047
+ };
3048
+ this.getItemFp = a((o) => p.pipe(
3049
+ u("web_app_secure_storage_get_key", "secure_storage_key_received", { key: o }),
3050
+ c.map((l) => ({
3051
+ value: l.value,
3052
+ canRestore: !!l.can_restore
3053
+ }))
3054
+ )), this.setItemFp = a((o, l) => p.pipe(
3055
+ u("web_app_secure_storage_save_key", "secure_storage_key_saved", { key: o, value: l }),
3056
+ c.map(() => {
3057
+ })
3058
+ )), this.deleteItemFp = a((o) => this.setItemFp(o, null)), this.clearFp = a(() => p.pipe(
3059
+ u("web_app_secure_storage_clear", "secure_storage_cleared", {}),
3060
+ c.map(() => {
3061
+ })
3062
+ )), this.restoreItemFp = a((o) => p.pipe(
3063
+ u("web_app_secure_storage_restore_key", "secure_storage_key_restored", { key: o }),
3064
+ c.map((l) => l.value)
3065
+ )), this.getItem = /* @__PURE__ */ h(this.getItemFp), this.setItem = /* @__PURE__ */ h(this.setItemFp), this.deleteItem = /* @__PURE__ */ h(this.deleteItemFp), this.clear = /* @__PURE__ */ h(this.clearFp), this.restoreItem = /* @__PURE__ */ h(this.restoreItemFp);
3066
+ }
3067
+ }
3068
+ function Zs() {
3069
+ return new Ys(p.pipe(
3070
+ S(),
3071
+ I,
3072
+ R,
3073
+ Xe
3074
+ ));
3075
+ }
3076
+ const bn = /* @__PURE__ */ Zs();
3077
+ class Xs {
3078
+ constructor(t) {
3079
+ /**
3080
+ * Signal indicating if the component is currently visible.
3081
+ */
3082
+ e(this, "isVisible");
3083
+ /**
3084
+ * Signal indicating if the component is currently mounted.
3085
+ */
3086
+ e(this, "isMounted");
3087
+ /**
3088
+ * Signal indicating if the component is supported.
3089
+ */
3090
+ e(this, "isSupported");
3091
+ /**
3092
+ * Hides the button.
3093
+ * @since Mini Apps v6.10
3094
+ */
3095
+ e(this, "hideFp");
3096
+ /**
3097
+ * @see hideFp
3098
+ */
3099
+ e(this, "hide");
3100
+ /**
3101
+ * Shows the button.
3102
+ * @since Mini Apps v6.10
3103
+ */
3104
+ e(this, "showFp");
3105
+ /**
3106
+ * @see showFp
3107
+ */
3108
+ e(this, "show");
3109
+ /**
3110
+ * Adds a new button listener.
3111
+ * @param listener - event listener.
3112
+ * @param once - should the listener be called only once.
3113
+ * @returns A function to remove bound listener.
3114
+ * @since Mini Apps v6.10
3115
+ * @example
3116
+ * const off = button.onClick(() => {
3117
+ * console.log('User clicked the button');
3118
+ * off();
3119
+ * });
3120
+ */
3121
+ e(this, "onClickFp");
3122
+ /**
3123
+ * @see onClickFp
3124
+ */
3125
+ e(this, "onClick");
3126
+ /**
3127
+ * Removes the button click listener.
3128
+ * @param listener - event listener.
3129
+ * @param once - should the listener be called only once.
3130
+ * @since Mini Apps v6.10
3131
+ * @example
3132
+ * function listener() {
3133
+ * console.log('User clicked the button');
3134
+ * button.offClick(listener);
3135
+ * }
3136
+ * button.onClick(listener);
3137
+ */
3138
+ e(this, "offClickFp");
3139
+ /**
3140
+ * @see offClickFp
3141
+ */
3142
+ e(this, "offClick");
3143
+ /**
3144
+ * Mounts the component restoring its state.
3145
+ * @since Mini Apps v6.10
3146
+ */
3147
+ e(this, "mountFp");
3148
+ /**
3149
+ * @see mountFp
3150
+ */
3151
+ e(this, "mount");
3152
+ /**
3153
+ * Unmounts the component.
3154
+ *
3155
+ * Note that this function does not remove listeners added via the `onClick`
3156
+ * function, so you have to remove them on your own.
3157
+ * @see onClick
3158
+ */
3159
+ e(this, "unmount");
3160
+ const s = new de({
3161
+ ...t,
3162
+ method: "web_app_setup_settings_button",
3163
+ payload: (n) => ({ is_visible: n.isVisible }),
3164
+ initialState: { isVisible: !1 }
3165
+ });
3166
+ this.isVisible = s.stateGetter("isVisible"), this.isMounted = s.isMounted, this.isSupported = s.isSupported, [[this.hide, this.hideFp], [this.show, this.showFp]] = s.stateBoolSetters("isVisible"), this.onClick = s.onClick, this.onClickFp = s.onClickFp, this.offClick = s.offClick, this.offClickFp = s.offClickFp, this.mount = s.mount, this.mountFp = s.mountFp, this.unmount = s.unmount;
3167
+ }
3168
+ }
3169
+ const gn = /* @__PURE__ */ new Xs(
3170
+ /* @__PURE__ */ Ae("settingsButton", "settings_button_pressed")
3171
+ );
3172
+ class er {
3173
+ constructor({ postEvent: t, storage: s, isTma: n, isPageReload: i, version: a }) {
3174
+ /**
3175
+ * Signal indicating if the component is supported.
3176
+ */
3177
+ e(this, "isSupported");
3178
+ /**
3179
+ * Signal indicating if vertical swipes are enabled.
3180
+ */
3181
+ e(this, "isVerticalEnabled");
3182
+ /**
3183
+ * Signal indicating if the component is currently mounted.
3184
+ */
3185
+ e(this, "isMounted");
3186
+ /**
3187
+ * Mounts the component restoring its state.
3188
+ * @since Mini Apps v7.7
3189
+ */
3190
+ e(this, "mountFp");
3191
+ /**
3192
+ * @see mountFp
3193
+ */
3194
+ e(this, "mount");
3195
+ /**
3196
+ * Unmounts the component.
3197
+ */
3198
+ e(this, "unmount");
3199
+ /**
3200
+ * Disables the closing confirmation dialog.
3201
+ * @since Mini Apps v7.7
3202
+ */
3203
+ e(this, "disableVerticalFp");
3204
+ /**
3205
+ * @see disableVerticalFp
3206
+ */
3207
+ e(this, "disableVertical");
3208
+ /**
3209
+ * Enables the closing confirmation dialog.
3210
+ * @since Mini Apps v7.7
3211
+ */
3212
+ e(this, "enableVerticalFp");
3213
+ /**
3214
+ * @see enableVerticalFp
3215
+ */
3216
+ e(this, "enableVertical");
3217
+ const u = { isVerticalEnabled: !0 }, o = new J({
3218
+ initialState: u,
3219
+ onChange(C) {
3220
+ s.set(C);
3221
+ }
3222
+ }), l = new ne({
3223
+ initialState: u,
3224
+ isPageReload: i,
3225
+ onMounted: o.setState,
3226
+ restoreState: s.get
3227
+ }), _ = { requires: "web_app_setup_swipe_behavior", isTma: n, version: a }, F = E({
3228
+ ..._,
3229
+ returns: "plain"
3230
+ }), f = E({
3231
+ ..._,
3232
+ isMounted: l.isMounted,
3233
+ returns: "either"
3234
+ }), v = (C) => {
3235
+ const k = { isVerticalEnabled: C };
3236
+ return o.hasDiff(k) ? p.pipe(
3237
+ t("web_app_setup_swipe_behavior", { allow_vertical_swipe: C }),
3238
+ b.map(() => {
3239
+ o.setState(k);
3240
+ })
3241
+ ) : b.right(void 0);
3242
+ };
3243
+ this.isSupported = H("web_app_setup_swipe_behavior", a), this.isVerticalEnabled = o.getter("isVerticalEnabled"), this.isMounted = l.isMounted, this.disableVerticalFp = f(() => v(!1)), this.enableVerticalFp = f(() => v(!0)), this.mountFp = F(() => {
3244
+ const C = () => {
3245
+ };
3246
+ return p.pipe(l.mount(), b.match(C, C));
3247
+ }), this.unmount = l.unmount, this.disableVertical = /* @__PURE__ */ h(this.disableVerticalFp), this.enableVertical = /* @__PURE__ */ h(this.enableVerticalFp), this.mount = /* @__PURE__ */ h(this.mountFp);
3248
+ }
3249
+ }
3250
+ function tr() {
3251
+ return new er(p.pipe(
3252
+ S(),
3253
+ V,
3254
+ I,
3255
+ Y("swipeBehavior")
3256
+ ));
3257
+ }
3258
+ const Fn = /* @__PURE__ */ tr();
3259
+ async function wn(r) {
3260
+ try {
3261
+ const { clipboard: s } = navigator;
3262
+ if (s)
3263
+ return await s.writeText(r);
3264
+ } catch {
3265
+ }
3266
+ const t = document.createElement("textarea");
3267
+ t.value = r, t.style.top = "0", t.style.left = "0", t.style.position = "fixed", document.body.appendChild(t), t.focus(), t.select();
3268
+ try {
3269
+ document.execCommand("copy");
3270
+ } finally {
3271
+ document.body.removeChild(t);
3272
+ }
3273
+ }
3274
+ function sr({ request: r, ...t }) {
3275
+ return A((s, n, i) => p.pipe(
3276
+ r(
3277
+ "web_app_request_file_download",
3278
+ "file_download_requested",
3279
+ { ...i, params: { url: s, file_name: n } }
3280
+ ),
3281
+ c.chain((a) => a.status === "downloading" ? c.right(void 0) : c.left(new Je("User denied the action")))
3282
+ ), { ...t, requires: "web_app_request_file_download", returns: "task" });
3283
+ }
3284
+ // @__NO_SIDE_EFFECTS__
3285
+ function rr() {
3286
+ return sr(p.pipe(
3287
+ S(),
3288
+ R,
3289
+ I
3290
+ ));
3291
+ }
3292
+ const nr = /* @__PURE__ */ rr(), Cn = /* @__PURE__ */ h(nr);
3293
+ function ir({ invokeCustomMethod: r, ...t }) {
3294
+ return A((s) => p.pipe(
3295
+ r("getCurrentTime", {}, s),
3296
+ c.chain((n) => {
3297
+ const i = Fe(
3298
+ ze(Qe(), vt(), Ke((a) => new Date(a * 1e3)), Ne()),
3299
+ n
3300
+ );
3301
+ return i.success ? c.right(i.output) : c.left(new pe(n, i.issues));
3302
+ })
3303
+ ), { ...t, requires: "web_app_invoke_custom_method", returns: "task" });
3304
+ }
3305
+ // @__NO_SIDE_EFFECTS__
3306
+ function or() {
3307
+ return ir(p.pipe(
3308
+ S(),
3309
+ Me,
3310
+ I
3311
+ ));
3312
+ }
3313
+ const ar = /* @__PURE__ */ or(), Sn = /* @__PURE__ */ h(ar);
3314
+ function pr({ postEvent: r, ...t }) {
3315
+ return A(() => r("web_app_hide_keyboard"), { ...t, returns: "either", requires: "web_app_hide_keyboard" });
3316
+ }
3317
+ // @__NO_SIDE_EFFECTS__
3318
+ function ur() {
3319
+ return pr(p.pipe(
3320
+ S(),
3321
+ V,
3322
+ I
3323
+ ));
3324
+ }
3325
+ const cr = /* @__PURE__ */ ur(), vn = /* @__PURE__ */ h(cr);
3326
+ function lr({ request: r, createRequestId: t, ...s }) {
3327
+ return A((n) => {
3328
+ const i = t();
3329
+ return p.pipe(
3330
+ r("web_app_read_text_from_clipboard", "clipboard_text_received", {
3331
+ ...n,
3332
+ params: { req_id: i },
3333
+ capture: dt(i)
3334
+ }),
3335
+ c.map(({ data: a = null }) => a)
3336
+ );
3337
+ }, { ...s, requires: "web_app_read_text_from_clipboard", returns: "task" });
3338
+ }
3339
+ // @__NO_SIDE_EFFECTS__
3340
+ function hr() {
3341
+ return lr({
3342
+ ...p.pipe(
3343
+ S(),
3344
+ I,
3345
+ R
3346
+ ),
3347
+ createRequestId: xe
3348
+ });
3349
+ }
3350
+ const dr = /* @__PURE__ */ hr(), kn = /* @__PURE__ */ h(dr);
3351
+ function fr(r) {
3352
+ const t = {}, s = r.match(/Telegram-Android(?:\/([^ ]+))?(?: (\([^)]+\))?|$)/);
3353
+ if (s) {
3354
+ const [, n, i] = s;
3355
+ n && (t.appVersion = n), i && i.slice(1, i.length - 1).split(";").forEach((a) => {
3356
+ const [u, o] = a.trim().split(" ");
3357
+ if (u === "Android")
3358
+ t.androidVersion = o;
3359
+ else if (u === "SDK") {
3360
+ const l = parseInt(o, 10);
3361
+ l && (t.sdkVersion = l);
3362
+ } else o ? (t.manufacturer = u, t.model = o) : t.performanceClass = u;
3363
+ });
3364
+ }
3365
+ return t;
3366
+ }
3367
+ function yn() {
3368
+ return fr(navigator.userAgent);
3369
+ }
3370
+ function _r({ postEvent: r, ...t }) {
3371
+ return A((s) => {
3372
+ const { size: n } = new Blob([s]);
3373
+ return !n || n > 4096 ? b.left(
3374
+ new W(n ? "Maximum size of data to send is 4096 bytes" : "Attempted to send empty data")
3375
+ ) : r("web_app_data_send", { data: s });
3376
+ }, { ...t, returns: "either" });
3377
+ }
3378
+ // @__NO_SIDE_EFFECTS__
3379
+ function mr() {
3380
+ return _r(p.pipe(S(), V));
3381
+ }
3382
+ const br = /* @__PURE__ */ mr(), In = /* @__PURE__ */ h(br);
3383
+ function gr({ request: r, ...t }) {
3384
+ return A((s, n) => p.pipe(
3385
+ r(
3386
+ "web_app_send_prepared_message",
3387
+ ["prepared_message_failed", "prepared_message_sent"],
3388
+ {
3389
+ ...n,
3390
+ params: { id: s }
3391
+ }
3392
+ ),
3393
+ c.chain((i) => i.event === "prepared_message_failed" ? c.left(new Bt(i.payload.error)) : c.right(void 0))
3394
+ ), { ...t, requires: "web_app_send_prepared_message", returns: "task" });
3395
+ }
3396
+ // @__NO_SIDE_EFFECTS__
3397
+ function Fr() {
3398
+ return gr(p.pipe(
3399
+ S(),
3400
+ R,
3401
+ I
3402
+ ));
3403
+ }
3404
+ const wr = /* @__PURE__ */ Fr(), En = /* @__PURE__ */ h(wr);
3405
+ function Cr({ postEvent: r, ...t }) {
3406
+ return A((s, n = {}) => r("web_app_share_to_story", {
3407
+ text: n.text,
3408
+ media_url: s,
3409
+ widget_link: n.widgetLink
3410
+ }), { ...t, requires: "web_app_share_to_story", returns: "either" });
3411
+ }
3412
+ // @__NO_SIDE_EFFECTS__
3413
+ function Sr() {
3414
+ return Cr(p.pipe(
3415
+ S(),
3416
+ V,
3417
+ I
3418
+ ));
3419
+ }
3420
+ const vr = /* @__PURE__ */ Sr(), qn = /* @__PURE__ */ h(vr), ve = /* @__PURE__ */ ie(!1);
3421
+ function kr({ isInlineMode: r, postEvent: t, ...s }) {
3422
+ return A((n, i) => t("web_app_switch_inline_query", {
3423
+ query: n,
3424
+ chat_types: i || []
3425
+ }), {
3426
+ ...s,
3427
+ requires: {
3428
+ every: ["web_app_switch_inline_query", () => $(r) ? void 0 : "The application must be launched in the inline mode"]
3429
+ },
3430
+ returns: "either"
3431
+ });
3432
+ }
3433
+ // @__NO_SIDE_EFFECTS__
3434
+ function yr() {
3435
+ return kr({
3436
+ ...p.pipe(
3437
+ S(),
3438
+ V,
3439
+ I
3440
+ ),
3441
+ isInlineMode: ve
3442
+ });
3443
+ }
3444
+ const Ir = /* @__PURE__ */ yr(), An = /* @__PURE__ */ h(Ir);
3445
+ class Er {
3446
+ constructor({
3447
+ storage: t,
3448
+ isPageReload: s,
3449
+ onContentSafeAreaInsetsChanged: n,
3450
+ onSafeAreaInsetsChanged: i,
3451
+ onViewportChanged: a,
3452
+ onFullscreenChanged: u,
3453
+ offContentSafeAreaInsetsChanged: o,
3454
+ offFullscreenChanged: l,
3455
+ offSafeAreaInsetsChanged: _,
3456
+ offViewportChanged: F,
3457
+ request: f,
3458
+ isViewportStable: v,
3459
+ isFullscreen: C,
3460
+ isTma: k,
3461
+ version: y,
3462
+ postEvent: m
3463
+ }) {
3464
+ //#region Other properties.
3465
+ /**
3466
+ * Complete component state.
3467
+ */
3468
+ e(this, "state");
3469
+ /**
3470
+ * Signal containing the current height of the **visible area** of the Mini App.
3471
+ *
3472
+ * The application can display just the top part of the Mini App, with its
3473
+ * lower part remaining outside the screen area. From this position, the user
3474
+ * can "pull" the Mini App to its maximum height, while the bot can do the same
3475
+ * by calling `expand` method. As the position of the Mini App changes, the
3476
+ * current height value of the visible area will be updated in real time.
3477
+ *
3478
+ * Please note that the refresh rate of this value is not sufficient to
3479
+ * smoothly follow the lower border of the window. It should not be used to pin
3480
+ * interface elements to the bottom of the visible area. It's more appropriate
3481
+ * to use the value of the `stableHeight` field for this purpose.
3482
+ *
3483
+ * @see stableHeight
3484
+ */
3485
+ e(this, "height");
3486
+ /**
3487
+ * Signal containing the height of the visible area of the Mini App in its last stable state.
3488
+ *
3489
+ * The application can display just the top part of the Mini App, with its
3490
+ * lower part remaining outside the screen area. From this position, the user
3491
+ * can "pull" the Mini App to its maximum height, while the application can do
3492
+ * the same by calling `expand` method.
3493
+ *
3494
+ * Unlike the value of `height`, the value of `stableHeight` does not change as
3495
+ * the position of the Mini App changes with user gestures or during
3496
+ * animations. The value of `stableHeight` will be updated after all gestures
3497
+ * and animations are completed and the Mini App reaches its final size.
3498
+ *
3499
+ * @see height
3500
+ */
3501
+ e(this, "stableHeight");
3502
+ /**
3503
+ * Signal containing the currently visible area width.
3504
+ */
3505
+ e(this, "width");
3506
+ /**
3507
+ * Signal indicating if the Mini App is expanded to the maximum available height. Otherwise,
3508
+ * if the Mini App occupies part of the screen and can be expanded to the full
3509
+ * height using the `expand` method.
3510
+ */
3511
+ e(this, "isExpanded");
3512
+ /**
3513
+ * Signal indicating if the current viewport height is stable and is not going to change in
3514
+ * the next moment.
3515
+ */
3516
+ e(this, "isStable", w(() => this.height() === this.stableHeight()));
3517
+ //#endregion
3518
+ //#region Content safe area insets.
3519
+ /**
3520
+ * Signal containing content safe area insets.
3521
+ */
3522
+ e(this, "contentSafeAreaInsets");
3523
+ /**
3524
+ * Signal containing top content safe area inset.
3525
+ */
3526
+ e(this, "contentSafeAreaInsetTop");
3527
+ /**
3528
+ * Signal containing left content safe area inset.
3529
+ */
3530
+ e(this, "contentSafeAreaInsetLeft");
3531
+ /**
3532
+ * Signal containing right content safe area inset.
3533
+ */
3534
+ e(this, "contentSafeAreaInsetRight");
3535
+ /**
3536
+ * Signal containing bottom content safe area inset.
3537
+ */
3538
+ e(this, "contentSafeAreaInsetBottom");
3539
+ //#endregion
3540
+ //#region Safe area insets.
3541
+ /**
3542
+ * Signal containing safe area insets.
3543
+ */
3544
+ e(this, "safeAreaInsets");
3545
+ /**
3546
+ * Signal containing top safe area inset.
3547
+ */
3548
+ e(this, "safeAreaInsetTop");
3549
+ /**
3550
+ * Signal containing left safe area inset.
3551
+ */
3552
+ e(this, "safeAreaInsetLeft");
3553
+ /**
3554
+ * Signal containing right safe area inset.
3555
+ */
3556
+ e(this, "safeAreaInsetRight");
3557
+ /**
3558
+ * Signal containing bottom safe area inset.
3559
+ */
3560
+ e(this, "safeAreaInsetBottom");
3561
+ //#endregion
3562
+ //#region Fullscreen.
3563
+ /**
3564
+ * Signal indicating if the viewport is currently in fullscreen mode.
3565
+ */
3566
+ e(this, "isFullscreen");
3567
+ /**
3568
+ * Requests fullscreen mode for the mini application.
3569
+ * @since Mini Apps v8.0
3570
+ */
3571
+ e(this, "requestFullscreenFp");
3572
+ /**
3573
+ * @see requestFullscreenFp
3574
+ */
3575
+ e(this, "requestFullscreen");
3576
+ /**
3577
+ * Exits mini application from the fullscreen mode.
3578
+ * @since Mini Apps v8.0
3579
+ */
3580
+ e(this, "exitFullscreenFp");
3581
+ /**
3582
+ * @see exitFullscreenFp
3583
+ */
3584
+ e(this, "exitFullscreen");
3585
+ //#endregion
3586
+ //#region CSS Vars.
3587
+ /**
3588
+ * Signal indicating if CSS variables are bound.
3589
+ */
3590
+ e(this, "isCssVarsBound");
3591
+ /**
3592
+ * Creates CSS variables connected with the current viewport.
3593
+ *
3594
+ * By default, created CSS variables names are following the pattern "--tg-theme-{name}", where
3595
+ * {name} is a viewport property name converted from camel case to kebab case.
3596
+ *
3597
+ * Default variables:
3598
+ * - `--tg-viewport-height`
3599
+ * - `--tg-viewport-width`
3600
+ * - `--tg-viewport-stable-height`
3601
+ * - `--tg-viewport-content-safe-area-inset-top`
3602
+ * - `--tg-viewport-content-safe-area-inset-bottom`
3603
+ * - `--tg-viewport-content-safe-area-inset-left`
3604
+ * - `--tg-viewport-content-safe-area-inset-right`
3605
+ * - `--tg-viewport-safe-area-inset-top`
3606
+ * - `--tg-viewport-safe-area-inset-bottom`
3607
+ * - `--tg-viewport-safe-area-inset-left`
3608
+ * - `--tg-viewport-safe-area-inset-right`
3609
+ *
3610
+ * Variables are being automatically updated if the viewport was changed.
3611
+ *
3612
+ * @param getCSSVarName - function, returning computed complete CSS variable name. The CSS
3613
+ * variable will only be defined if the function returned non-empty string value.
3614
+ * @returns Function to stop updating variables.
3615
+ * @example Using no arguments
3616
+ * bindCssVarsFp();
3617
+ * @example Using custom CSS vars generator
3618
+ * bindCssVarsFp(key => `--my-prefix-${key}`);
3619
+ */
3620
+ e(this, "bindCssVarsFp");
3621
+ /**
3622
+ * @see bindCssVarsFp
3623
+ */
3624
+ e(this, "bindCssVars");
3625
+ //#endregion
3626
+ //#region Mount.
3627
+ /**
3628
+ * Signal indicating if the component is currently mounted.
3629
+ */
3630
+ e(this, "isMounted");
3631
+ /**
3632
+ * Mounts the component.
3633
+ */
3634
+ e(this, "mountFp");
3635
+ /**
3636
+ * @see mountFp
3637
+ */
3638
+ e(this, "mount");
3639
+ //#endregion
3640
+ //#region Other methods.
3641
+ /**
3642
+ * A method that expands the Mini App to the maximum available height. To find
3643
+ * out if the Mini App is expanded to the maximum height, refer to the value of
3644
+ * the `isExpanded`.
3645
+ */
3646
+ e(this, "expandFp");
3647
+ /**
3648
+ * @see expandFp
3649
+ */
3650
+ e(this, "expand");
3651
+ const g = { top: 0, right: 0, left: 0, bottom: 0 }, d = new J({
3652
+ initialState: {
3653
+ contentSafeAreaInsets: g,
3654
+ height: 0,
3655
+ isExpanded: !1,
3656
+ isFullscreen: !1,
3657
+ safeAreaInsets: g,
3658
+ stableHeight: 0,
3659
+ width: 0
3660
+ },
3661
+ onChange: t.set
3662
+ }), B = (q) => {
3663
+ d.setState({
3664
+ isExpanded: q.is_expanded,
3665
+ height: q.height,
3666
+ width: q.width,
3667
+ stableHeight: q.is_state_stable ? q.height : void 0
3668
+ });
3669
+ }, T = (q) => {
3670
+ d.setState({ isFullscreen: q.is_fullscreen });
3671
+ }, M = (q) => {
3672
+ d.setState({ safeAreaInsets: q });
3673
+ }, P = (q) => {
3674
+ d.setState({ contentSafeAreaInsets: q });
3675
+ }, L = new Be({
3676
+ initialState(q) {
3677
+ const Z = (z) => () => {
3678
+ const [Q, D] = z === "safe-area" ? ["web_app_request_safe_area", "safe_area_changed"] : ["web_app_request_content_safe_area", "content_safe_area_changed"];
3679
+ return ee(Q, $(y)) ? f(Q, D, q) : c.right({ top: 0, left: 0, right: 0, bottom: 0 });
3680
+ }, x = (z) => () => typeof z == "boolean" ? c.right(z) : c.fromEither(z());
3681
+ return p.pipe(
3682
+ c.Do,
3683
+ c.bindW("safeAreaInsets", Z("safe-area")),
3684
+ c.bindW("contentSafeAreaInsets", Z("content-safe-area")),
3685
+ c.bindW("isFullscreen", x(C)),
3686
+ c.bindW("isViewportStable", x(v)),
3687
+ c.chainW(({ isViewportStable: z, ...Q }) => z ? c.right({
3688
+ ...Q,
3689
+ height: window.innerHeight,
3690
+ isExpanded: !0,
3691
+ stableHeight: window.innerHeight,
3692
+ width: window.innerWidth
3693
+ }) : p.pipe(
3694
+ f("web_app_request_viewport", "viewport_changed", q),
3695
+ c.map((D) => ({
3696
+ ...Q,
3697
+ height: D.height,
3698
+ isExpanded: D.is_expanded,
3699
+ stableHeight: D.is_state_stable ? D.height : 0,
3700
+ width: D.width
3701
+ }))
3702
+ ))
3703
+ );
3704
+ },
3705
+ isPageReload: s,
3706
+ onMounted(q) {
3707
+ a(B), u(T), i(M), n(P), d.setState(q);
3708
+ },
3709
+ onUnmounted() {
3710
+ F(B), l(T), _(M), o(P);
3711
+ },
3712
+ restoreState: t.get
3713
+ }), U = (q) => w(() => this.safeAreaInsets()[q]), oe = (q) => w(() => this.contentSafeAreaInsets()[q]);
3714
+ this.state = d.state, this.height = d.getter("height"), this.stableHeight = d.getter("stableHeight"), this.width = d.getter("width"), this.isExpanded = d.getter("isExpanded"), this.safeAreaInsets = d.getter("safeAreaInsets"), this.safeAreaInsetTop = U("top"), this.safeAreaInsetBottom = U("bottom"), this.safeAreaInsetLeft = U("left"), this.safeAreaInsetRight = U("right"), this.contentSafeAreaInsets = d.getter("contentSafeAreaInsets"), this.contentSafeAreaInsetTop = oe("top"), this.contentSafeAreaInsetBottom = oe("bottom"), this.contentSafeAreaInsetLeft = oe("left"), this.contentSafeAreaInsetRight = oe("right");
3715
+ const it = E({ isTma: k, returns: "task" }), Re = E({
3716
+ isTma: k,
3717
+ returns: "either"
3718
+ }), ot = E({
3719
+ isTma: k,
3720
+ requires: "web_app_request_fullscreen",
3721
+ version: y,
3722
+ returns: "task"
3723
+ }), Le = (q) => ot((Z) => p.pipe(
3724
+ f(
3725
+ q ? "web_app_request_fullscreen" : "web_app_exit_fullscreen",
3726
+ ["fullscreen_changed", "fullscreen_failed"],
3727
+ Z
3728
+ ),
3729
+ c.chain((x) => x.event === "fullscreen_failed" && x.payload.error !== "ALREADY_FULLSCREEN" ? c.left(new At(x.payload.error)) : (d.setState({
3730
+ isFullscreen: "is_fullscreen" in x.payload ? x.payload.is_fullscreen : !0
3731
+ }), c.right(void 0)))
3732
+ ));
3733
+ this.isMounted = L.isMounted, this.mountFp = it(L.mount), this.mount = /* @__PURE__ */ h(this.mountFp), this.isFullscreen = d.getter("isFullscreen"), this.requestFullscreenFp = Le(!0), this.requestFullscreen = /* @__PURE__ */ h(this.requestFullscreenFp), this.exitFullscreenFp = Le(!1), this.exitFullscreen = /* @__PURE__ */ h(this.exitFullscreenFp);
3734
+ const ae = O(!1);
3735
+ this.isCssVarsBound = w(ae), this.bindCssVarsFp = Re(
3736
+ (q) => {
3737
+ if (ae())
3738
+ return b.left(new Ee());
3739
+ q || (q = (x) => `--tg-viewport-${We(x)}`);
3740
+ const Z = [
3741
+ ["height", this.height],
3742
+ ["stableHeight", this.stableHeight],
3743
+ ["width", this.width],
3744
+ ["safeAreaInsetTop", this.safeAreaInsetTop],
3745
+ ["safeAreaInsetBottom", this.safeAreaInsetBottom],
3746
+ ["safeAreaInsetLeft", this.safeAreaInsetLeft],
3747
+ ["safeAreaInsetRight", this.safeAreaInsetRight],
3748
+ ["contentSafeAreaInsetTop", this.contentSafeAreaInsetTop],
3749
+ ["contentSafeAreaInsetBottom", this.contentSafeAreaInsetBottom],
3750
+ ["contentSafeAreaInsetLeft", this.contentSafeAreaInsetLeft],
3751
+ ["contentSafeAreaInsetRight", this.contentSafeAreaInsetRight]
3752
+ ].reduce((x, [z, Q]) => {
3753
+ const D = q(z);
3754
+ if (D) {
3755
+ const $e = () => {
3756
+ Ve(D, `${Q()}px`);
3757
+ };
3758
+ x.push({ update: $e, removeListener: Q.sub($e), cssVar: D });
3759
+ }
3760
+ return x;
3761
+ }, []);
3762
+ return Z.forEach((x) => {
3763
+ x.update();
3764
+ }), ae.set(!0), b.right(() => {
3765
+ Z.forEach((x) => {
3766
+ x.removeListener(), Te(x.cssVar);
3767
+ }), ae.set(!1);
3768
+ });
3769
+ }
3770
+ ), this.bindCssVars = /* @__PURE__ */ h(this.bindCssVarsFp), this.expandFp = Re(() => m("web_app_expand")), this.expand = /* @__PURE__ */ h(this.expandFp);
3771
+ }
3772
+ //#endregion
3773
+ }
3774
+ function qr() {
3775
+ const r = (a) => ({
3776
+ on: (u) => {
3777
+ G(a, u);
3778
+ },
3779
+ off: (u) => {
3780
+ re(a, u);
3781
+ }
3782
+ }), t = r("viewport_changed"), s = r("fullscreen_changed"), n = r("safe_area_changed"), i = r("content_safe_area_changed");
3783
+ return new Er({
3784
+ ...p.pipe(
3785
+ S(),
3786
+ Y("viewport"),
3787
+ I,
3788
+ V,
3789
+ R
3790
+ ),
3791
+ isFullscreen() {
3792
+ return p.pipe(ce(), b.map((a) => !!a.vbWebAppFullscreen));
3793
+ },
3794
+ isViewportStable() {
3795
+ return p.pipe(ce(), b.map((a) => ["macos", "tdesktop", "unigram", "webk", "weba", "web"].includes(a.vbWebAppPlatform)));
3796
+ },
3797
+ offContentSafeAreaInsetsChanged: i.off,
3798
+ offFullscreenChanged: s.off,
3799
+ offSafeAreaInsetsChanged: n.off,
3800
+ offViewportChanged: t.off,
3801
+ onContentSafeAreaInsetsChanged: i.on,
3802
+ onFullscreenChanged: s.on,
3803
+ onSafeAreaInsetsChanged: n.on,
3804
+ onViewportChanged: t.on
3805
+ });
3806
+ }
3807
+ const Bn = /* @__PURE__ */ qr();
3808
+ class Ar {
3809
+ constructor({ request: t }) {
3810
+ /**
3811
+ * Requests storage access with specified options.
3812
+ * Returns a promise that resolves with selected files/folders.
3813
+ * @param options - Storage access options
3814
+ * @since v9.3
3815
+ */
3816
+ e(this, "requestAccessFp");
3817
+ /**
3818
+ * @see requestAccessFp
3819
+ */
3820
+ e(this, "requestAccess");
3821
+ /**
3822
+ * Convenience method to select a single file.
3823
+ * @param options - Optional file selection options
3824
+ */
3825
+ e(this, "selectFile");
3826
+ /**
3827
+ * Convenience method to select multiple files.
3828
+ * @param options - Optional file selection options
3829
+ */
3830
+ e(this, "selectFiles");
3831
+ /**
3832
+ * Convenience method to select a folder.
3833
+ */
3834
+ e(this, "selectFolder");
3835
+ this.requestAccessFp = (s) => p.pipe(
3836
+ t("web_app_request_storage_access", "storage_access_granted", {
3837
+ params: {
3838
+ access_type: s.accessType,
3839
+ multiple: s.multiple,
3840
+ accept: s.accept,
3841
+ max_file_size: s.maxFileSize,
3842
+ read_content: s.readContent
3843
+ }
3844
+ }),
3845
+ c.map((n) => ({
3846
+ accessType: n.access_type,
3847
+ items: n.items.map((i) => ({
3848
+ name: i.name,
3849
+ path: i.path,
3850
+ size: i.size,
3851
+ type: i.type,
3852
+ content: i.content,
3853
+ lastModified: i.last_modified
3854
+ }))
3855
+ }))
3856
+ ), this.requestAccess = (s) => this.requestAccessFp(s)().then((i) => {
3857
+ if (i._tag === "Left")
3858
+ throw i.left;
3859
+ return i.right;
3860
+ }), this.selectFile = (s) => this.requestAccess({
3861
+ accessType: "file",
3862
+ multiple: !1,
3863
+ ...s
3864
+ }), this.selectFiles = (s) => this.requestAccess({
3865
+ accessType: "file",
3866
+ multiple: !0,
3867
+ ...s
3868
+ }), this.selectFolder = () => this.requestAccess({
3869
+ accessType: "folder"
3870
+ });
3871
+ }
3872
+ }
3873
+ function Br() {
3874
+ return new Ar({
3875
+ request: je
3876
+ });
3877
+ }
3878
+ const xn = /* @__PURE__ */ Br();
3879
+ function xr(r = {}) {
3880
+ const {
3881
+ version: t,
3882
+ isInlineMode: s,
3883
+ themeParams: n
3884
+ } = r;
3885
+ if (t && typeof s == "boolean" && n)
3886
+ Ce.set(t), ve.set(s), Se.set(n);
3887
+ else {
3888
+ const o = p.pipe(ce(), b.matchW(
3889
+ (l) => l,
3890
+ (l) => {
3891
+ Ce.set(t || l.vbWebAppVersion), ve.set(typeof s == "boolean" ? s : !!l.vbWebAppBotInline), Se.set(n || l.vbWebAppThemeParams);
3892
+ }
3893
+ ));
3894
+ if (o)
3895
+ return b.left(o);
3896
+ }
3897
+ r.postEvent && Ye.set(r.postEvent);
3898
+ const [i, a] = ye(
3899
+ G("reload_iframe", () => {
3900
+ Pe().log("Received a request to reload the page"), Vt("iframe_will_reload"), window.location.reload();
3901
+ })
3902
+ ), { acceptCustomStyles: u = !0 } = r;
3903
+ if (u) {
3904
+ const o = document.createElement("style");
3905
+ o.id = "telegram-custom-styles", document.head.appendChild(o), i(
3906
+ G("set_custom_style", (l) => {
3907
+ o.innerHTML = l;
3908
+ }),
3909
+ () => {
3910
+ document.head.removeChild(o);
3911
+ }
3912
+ );
3913
+ }
3914
+ return p.pipe(
3915
+ se("iframe_ready", { reload_supported: !0 }),
3916
+ b.map(() => (Pe().log("The package was initialized"), a))
3917
+ );
3918
+ }
3919
+ const Mn = he(xr);
3920
+ export {
3921
+ Je as AccessDeniedError,
3922
+ Mt as BackButton,
3923
+ $t as Biometry,
3924
+ Ee as CSSVarsBoundError,
3925
+ Rn as CancelledError,
3926
+ Dt as ClosingBehavior,
3927
+ jt as CloudStorage,
3928
+ qe as ConcurrentCallError,
3929
+ Ht as DeviceStorage,
3930
+ kt as DeviceStorageMethodError,
3931
+ At as FullscreenFailedError,
3932
+ Et as FunctionUnavailableError,
3933
+ Xt as HapticFeedback,
3934
+ as as InitData,
3935
+ W as InvalidArgumentsError,
3936
+ Gr as InvalidEnvError,
3937
+ Ln as InvalidLaunchParamsError,
3938
+ us as Invoice,
3939
+ $n as InvokeCustomMethodFailedError,
3940
+ Pn as LaunchParamsRetrieveError,
3941
+ ws as LocationManager,
3942
+ Ss as MainButton,
3943
+ On as MethodParameterUnsupportedError,
3944
+ Dn as MethodUnsupportedError,
3945
+ Is as MiniApp,
3946
+ It as NotAvailableError,
3947
+ Bs as Notification,
3948
+ Vs as Popup,
3949
+ Hs as QrScanner,
3950
+ Ks as Refresh,
3951
+ Qs as SecondaryButton,
3952
+ Ys as SecureStorage,
3953
+ yt as SecureStorageMethodError,
3954
+ qt as SetEmojiStatusError,
3955
+ Xs as SettingsButton,
3956
+ Bt as ShareMessageError,
3957
+ Ar as StoragePermission,
3958
+ er as SwipeBehavior,
3959
+ ks as ThemeParams,
3960
+ Gn as TimeoutError,
3961
+ jn as UnknownEnvError,
3962
+ xt as UnknownThemeParamsKeyError,
3963
+ pe as ValidationError,
3964
+ Er as Viewport,
3965
+ Zr as addToHomeScreen,
3966
+ rs as addToHomeScreenFp,
3967
+ Un as applyPolyfills,
3968
+ jr as backButton,
3969
+ Hr as biometry,
3970
+ Xr as checkHomeScreenStatus,
3971
+ os as checkHomeScreenStatusFp,
3972
+ zr as closingBehavior,
3973
+ Kr as cloudStorage,
3974
+ wn as copyTextToClipboard,
3975
+ Wn as createLogger,
3976
+ Hn as createPostEvent,
3977
+ xe as createRequestId,
3978
+ zn as createStartParam,
3979
+ Kn as createStartParamFp,
3980
+ Nn as debug,
3981
+ Qn as decodeBase64Url,
3982
+ Jn as decodeBase64UrlFp,
3983
+ Yn as decodeStartParam,
3984
+ Zn as decodeStartParamFp,
3985
+ Xn as deepSnakeToCamelObjKeys,
3986
+ Nr as deviceStorage,
3987
+ Cn as downloadFile,
3988
+ nr as downloadFileFp,
3989
+ ei as emitEvent,
3990
+ ti as encodeBase64Url,
3991
+ Sn as getCurrentTime,
3992
+ ar as getCurrentTimeFp,
3993
+ si as getReleaseVersion,
3994
+ Yr as hapticFeedback,
3995
+ vn as hideKeyboard,
3996
+ cr as hideKeyboardFp,
3997
+ Mn as init,
3998
+ en as initData,
3999
+ xr as initFp,
4000
+ tn as invoice,
4001
+ Ut as invokeCustomMethod,
4002
+ Si as isAnyRGB,
4003
+ tt as isColorDark,
4004
+ vs as isColorDarkFp,
4005
+ vi as isRGB,
4006
+ ki as isRGBA,
4007
+ yi as isRGBAShort,
4008
+ Ii as isRGBShort,
4009
+ ri as isSafeToCreateStartParam,
4010
+ ni as isVBMA,
4011
+ ii as isVBMAFp,
4012
+ on as locationManager,
4013
+ oi as logger,
4014
+ an as mainButton,
4015
+ qs as miniApp,
4016
+ ai as mockVBotEnv,
4017
+ pn as notification,
4018
+ pi as off,
4019
+ ui as offAll,
4020
+ ci as on,
4021
+ sn as openLink,
4022
+ ds as openLinkFp,
4023
+ rn as openTelegramLink,
4024
+ et as openTelegramLinkFp,
4025
+ Ei as parseInitDataQuery,
4026
+ qi as parseInitDataQueryFp,
4027
+ Ai as parseLaunchParamsQuery,
4028
+ Bi as parseLaunchParamsQueryFp,
4029
+ un as popup,
4030
+ Vt as postEvent,
4031
+ se as postEventFp,
4032
+ fn as qrScanner,
4033
+ kn as readTextFromClipboard,
4034
+ dr as readTextFromClipboardFp,
4035
+ _n as refresh,
4036
+ Ur as request,
4037
+ Wr as request2,
4038
+ Ze as request2Fp,
4039
+ hn as requestContact,
4040
+ ln as requestContactComplete,
4041
+ nt as requestContactCompleteFp,
4042
+ Gs as requestContactFp,
4043
+ Qr as requestEmojiStatusAccess,
4044
+ Qt as requestEmojiStatusAccessFp,
4045
+ Pt as requestFp,
4046
+ cn as requestPhoneAccess,
4047
+ rt as requestPhoneAccessFp,
4048
+ dn as requestWriteAccess,
4049
+ Ws as requestWriteAccessFp,
4050
+ yn as retrieveAndroidDeviceData,
4051
+ fr as retrieveAndroidDeviceDataFrom,
4052
+ li as retrieveLaunchParams,
4053
+ hi as retrieveLaunchParamsFp,
4054
+ di as retrieveRawInitData,
4055
+ fi as retrieveRawInitDataFp,
4056
+ _i as retrieveRawLaunchParams,
4057
+ mi as retrieveRawLaunchParamsFp,
4058
+ mn as secondaryButton,
4059
+ bn as secureStorage,
4060
+ In as sendData,
4061
+ br as sendDataFp,
4062
+ xi as serializeInitDataQuery,
4063
+ Mi as serializeLaunchParamsQuery,
4064
+ bi as setDebug,
4065
+ Jr as setEmojiStatus,
4066
+ Zt as setEmojiStatusFp,
4067
+ gi as setTargetOrigin,
4068
+ gn as settingsButton,
4069
+ En as shareMessage,
4070
+ wr as shareMessageFp,
4071
+ qn as shareStory,
4072
+ vr as shareStoryFp,
4073
+ nn as shareURL,
4074
+ gs as shareURLFp,
4075
+ xn as storagePermission,
4076
+ Fi as supports,
4077
+ Fn as swipeBehavior,
4078
+ An as switchInlineQuery,
4079
+ Ir as switchInlineQueryFp,
4080
+ wi as targetOrigin,
4081
+ le as themeParams,
4082
+ Vi as toRGB,
4083
+ Ti as toRGBFp,
4084
+ Ri as toRGBFull,
4085
+ Li as toRGBFullFp,
4086
+ Bn as viewport
4087
+ };
4088
+ //# sourceMappingURL=index.js.map