@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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.iife.js","sources":["../../signals/dist/index.js","../../../node_modules/.pnpm/fp-ts@2.16.11/node_modules/fp-ts/es6/function.js","../../../node_modules/.pnpm/fp-ts@2.16.11/node_modules/fp-ts/es6/internal.js","../../../node_modules/.pnpm/fp-ts@2.16.11/node_modules/fp-ts/es6/Apply.js","../../../node_modules/.pnpm/fp-ts@2.16.11/node_modules/fp-ts/es6/Functor.js","../../../node_modules/.pnpm/fp-ts@2.16.11/node_modules/fp-ts/es6/Chain.js","../../../node_modules/.pnpm/fp-ts@2.16.11/node_modules/fp-ts/es6/Option.js","../../../node_modules/.pnpm/fp-ts@2.16.11/node_modules/fp-ts/es6/Either.js","../../../node_modules/.pnpm/fp-ts@2.16.11/node_modules/fp-ts/es6/EitherT.js","../../../node_modules/.pnpm/fp-ts@2.16.11/node_modules/fp-ts/es6/Json.js","../../../node_modules/.pnpm/fp-ts@2.16.11/node_modules/fp-ts/es6/Task.js","../../../node_modules/.pnpm/fp-ts@2.16.11/node_modules/fp-ts/es6/TaskEither.js","../src/helpers/access.ts","../src/composables/Mountable.ts","../src/helpers/removeUndefined.ts","../src/helpers/shallowEqual.ts","../src/composables/Stateful.ts","../../../node_modules/.pnpm/valibot@1.2.0_typescript@5.9.2/node_modules/valibot/dist/index.mjs","../../../node_modules/.pnpm/better-promises@1.0.0/node_modules/better-promises/dist/index.js","../../toolkit/dist/index.js","../../../node_modules/.pnpm/error-kid@1.0.2/node_modules/error-kid/dist/index.js","../../transformers/dist/index.js","../../../node_modules/.pnpm/mitt@3.0.1/node_modules/mitt/dist/mitt.mjs","../../bridge/dist/index.js","../src/helpers/createIsSupportedSignal.ts","../src/with-checks/throwifyWithChecksFp.ts","../src/errors.ts","../src/with-checks/withChecksFp.ts","../src/composables/Button.ts","../src/features/BackButton/BackButton.ts","../src/fn-options/sharedFeatureOptions.ts","../src/fn-options/createFnOption.ts","../src/globals/signals-registry.ts","../src/globals/postEvent.ts","../src/fn-options/withPostEvent.ts","../src/helpers/component-storage.ts","../src/helpers/navigation.ts","../src/fn-options/withStateRestore.ts","../src/globals/version.ts","../src/fn-options/withVersion.ts","../src/fn-options/buttonOptions.ts","../src/features/BackButton/instance.ts","../src/composables/AsyncMountable.ts","../src/features/Biometry/Biometry.ts","../src/globals/request.ts","../src/fn-options/withRequest.ts","../src/features/Biometry/instance.ts","../src/features/ClosingBehavior/ClosingBehavior.ts","../src/features/ClosingBehavior/instance.ts","../src/features/CloudStorage/CloudStorage.ts","../src/globals/createRequestId.ts","../src/globals/invokeCustomMethod.ts","../src/fn-options/withInvokeCustomMethod.ts","../src/features/CloudStorage/instance.ts","../src/features/DeviceStorage/DeviceStorage.ts","../src/fn-options/withCreateRequestId.ts","../src/features/DeviceStorage/instance.ts","../src/features/emoji-status/requestEmojiStatusAccess.ts","../src/features/emoji-status/setEmojiStatus.ts","../src/features/HapticFeedback/HapticFeedback.ts","../src/features/HapticFeedback/instance.ts","../src/features/home-screen/addToHomeScreen.ts","../src/features/home-screen/checkHomeScreenStatus.ts","../src/features/InitData/InitData.ts","../src/features/InitData/instance.ts","../src/features/Invoice/Invoice.ts","../src/features/Invoice/instance.ts","../src/features/links/openLink.ts","../src/features/links/openTelegramLink.ts","../src/features/links/shareURL.ts","../src/features/LocationManager/LocationManager.ts","../src/features/LocationManager/instance.ts","../src/features/MainButton/MainButton.ts","../src/helpers/css-vars.ts","../src/helpers/isColorDark.ts","../src/features/ThemeParams/ThemeParams.ts","../src/globals/themeParams.ts","../src/features/ThemeParams/instance.ts","../src/fn-options/bottomButtonOptions.ts","../src/features/MainButton/instance.ts","../src/features/MiniApp/MiniApp.ts","../src/features/MiniApp/instance.ts","../src/features/Notification/Notification.ts","../src/features/Notification/instance.ts","../src/features/Popup/prepareParams.ts","../src/features/Popup/Popup.ts","../src/features/Popup/instance.ts","../src/features/privacy/requestPhoneAccess.ts","../src/features/privacy/requestContact.ts","../src/features/privacy/requestWriteAccess.ts","../src/features/QrScanner/QrScanner.ts","../src/features/QrScanner/instance.ts","../src/features/Refresh/Refresh.ts","../src/features/Refresh/instance.ts","../src/features/SecondaryButton/SecondaryButton.ts","../src/features/SecondaryButton/instance.ts","../src/features/SecureStorage/SecureStorage.ts","../src/features/SecureStorage/instance.ts","../src/features/SettingsButton/SettingsButton.ts","../src/features/SettingsButton/instance.ts","../src/features/SwipeBehavior/SwipeBehavior.ts","../src/features/SwipeBehavior/instance.ts","../src/features/uncategorized/copyTextToClipboard.ts","../src/features/uncategorized/downloadFile.ts","../src/features/uncategorized/getCurrentTime.ts","../src/features/uncategorized/hideKeyboard.ts","../src/features/uncategorized/readTextFromClipboard.ts","../src/features/uncategorized/retrieveAndroidDeviceDataFrom.ts","../src/features/uncategorized/retrieveAndroidDeviceData.ts","../src/features/uncategorized/sendData.ts","../src/features/uncategorized/shareMessage.ts","../src/features/uncategorized/shareStory.ts","../src/globals/isInlineMode.ts","../src/features/uncategorized/switchInlineQuery.ts","../src/features/Viewport/Viewport.ts","../src/features/Viewport/instance.ts","../src/features/StoragePermission/StoragePermission.ts","../src/features/StoragePermission/instance.ts","../src/init.ts"],"sourcesContent":["let r;\nfunction y(e, c) {\n r ? r.set(e, c) : c();\n}\nfunction m(e) {\n if (r)\n return e();\n r = /* @__PURE__ */ new Map();\n try {\n e();\n } finally {\n r.forEach((c) => c()), r = void 0;\n }\n}\n// @__NO_SIDE_EFFECTS__\nfunction S(e, c) {\n c || (c = {});\n const g = c.equals || Object.is;\n let u = [], s = e;\n const i = (t) => {\n if (!g(s, t)) {\n const l = s;\n s = t, y(o, () => {\n [...u].forEach(([f, d]) => {\n f(t, l), d && n(f, !0);\n });\n });\n }\n };\n function a(t) {\n const l = typeof t != \"object\" ? { once: t } : t;\n return {\n once: l.once || !1,\n signal: l.signal || !1\n };\n }\n const n = (t, l) => {\n const f = a(l), d = u.findIndex(([h, p]) => h === t && p.once === f.once && p.signal === f.signal);\n d >= 0 && u.splice(d, 1);\n }, o = Object.assign(\n function() {\n return j(o), s;\n },\n {\n destroy() {\n u = [];\n },\n set: i,\n reset() {\n i(e);\n },\n sub(t, l) {\n return u.push([t, a(l)]), () => n(t, l);\n },\n unsub: n,\n unsubAll() {\n u = u.filter((t) => t[1].signal);\n }\n }\n );\n return o;\n}\nconst b = [];\nfunction j(e) {\n b.length && b[b.length - 1].add(e);\n}\n// @__NO_SIDE_EFFECTS__\nfunction x(e, c) {\n let g = /* @__PURE__ */ new Set(), u;\n function s() {\n return u || (u = /* @__PURE__ */ S(a(), c));\n }\n function i() {\n s().set(a());\n }\n function a() {\n g.forEach((t) => {\n t.unsub(i, { signal: !0 });\n });\n const n = /* @__PURE__ */ new Set();\n let o;\n b.push(n);\n try {\n o = e();\n } finally {\n b.pop();\n }\n return n.forEach((t) => {\n t.sub(i, { signal: !0 });\n }), g = n, o;\n }\n return Object.assign(function() {\n return s()();\n }, {\n destroy() {\n s().destroy();\n },\n sub(...n) {\n return s().sub(...n);\n },\n unsub(...n) {\n s().unsub(...n);\n },\n unsubAll(...n) {\n s().unsubAll(...n);\n }\n });\n}\nexport {\n m as batch,\n x as computed,\n S as signal\n};\n//# sourceMappingURL=index.js.map\n","var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\n// -------------------------------------------------------------------------------------\n// instances\n// -------------------------------------------------------------------------------------\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var getBooleanAlgebra = function (B) {\n return function () { return ({\n meet: function (x, y) { return function (a) { return B.meet(x(a), y(a)); }; },\n join: function (x, y) { return function (a) { return B.join(x(a), y(a)); }; },\n zero: function () { return B.zero; },\n one: function () { return B.one; },\n implies: function (x, y) { return function (a) { return B.implies(x(a), y(a)); }; },\n not: function (x) { return function (a) { return B.not(x(a)); }; }\n }); };\n};\n/**\n * Unary functions form a semigroup as long as you can provide a semigroup for the codomain.\n *\n * @example\n * import { Predicate, getSemigroup } from 'fp-ts/function'\n * import * as B from 'fp-ts/boolean'\n *\n * const f: Predicate<number> = (n) => n <= 2\n * const g: Predicate<number> = (n) => n >= 0\n *\n * const S1 = getSemigroup(B.SemigroupAll)<number>()\n *\n * assert.deepStrictEqual(S1.concat(f, g)(1), true)\n * assert.deepStrictEqual(S1.concat(f, g)(3), false)\n *\n * const S2 = getSemigroup(B.SemigroupAny)<number>()\n *\n * assert.deepStrictEqual(S2.concat(f, g)(1), true)\n * assert.deepStrictEqual(S2.concat(f, g)(3), true)\n *\n * @category instances\n * @since 2.10.0\n */\nexport var getSemigroup = function (S) {\n return function () { return ({\n concat: function (f, g) { return function (a) { return S.concat(f(a), g(a)); }; }\n }); };\n};\n/**\n * Unary functions form a monoid as long as you can provide a monoid for the codomain.\n *\n * @example\n * import { Predicate } from 'fp-ts/Predicate'\n * import { getMonoid } from 'fp-ts/function'\n * import * as B from 'fp-ts/boolean'\n *\n * const f: Predicate<number> = (n) => n <= 2\n * const g: Predicate<number> = (n) => n >= 0\n *\n * const M1 = getMonoid(B.MonoidAll)<number>()\n *\n * assert.deepStrictEqual(M1.concat(f, g)(1), true)\n * assert.deepStrictEqual(M1.concat(f, g)(3), false)\n *\n * const M2 = getMonoid(B.MonoidAny)<number>()\n *\n * assert.deepStrictEqual(M2.concat(f, g)(1), true)\n * assert.deepStrictEqual(M2.concat(f, g)(3), true)\n *\n * @category instances\n * @since 2.10.0\n */\nexport var getMonoid = function (M) {\n var getSemigroupM = getSemigroup(M);\n return function () { return ({\n concat: getSemigroupM().concat,\n empty: function () { return M.empty; }\n }); };\n};\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var getSemiring = function (S) { return ({\n add: function (f, g) { return function (x) { return S.add(f(x), g(x)); }; },\n zero: function () { return S.zero; },\n mul: function (f, g) { return function (x) { return S.mul(f(x), g(x)); }; },\n one: function () { return S.one; }\n}); };\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var getRing = function (R) {\n var S = getSemiring(R);\n return {\n add: S.add,\n mul: S.mul,\n one: S.one,\n zero: S.zero,\n sub: function (f, g) { return function (x) { return R.sub(f(x), g(x)); }; }\n };\n};\n// -------------------------------------------------------------------------------------\n// utils\n// -------------------------------------------------------------------------------------\n/**\n * @since 2.11.0\n */\nexport var apply = function (a) {\n return function (f) {\n return f(a);\n };\n};\n/**\n * @since 2.0.0\n */\nexport function identity(a) {\n return a;\n}\n/**\n * @since 2.0.0\n */\nexport var unsafeCoerce = identity;\n/**\n * @since 2.0.0\n */\nexport function constant(a) {\n return function () { return a; };\n}\n/**\n * A thunk that returns always `true`.\n *\n * @since 2.0.0\n */\nexport var constTrue = /*#__PURE__*/ constant(true);\n/**\n * A thunk that returns always `false`.\n *\n * @since 2.0.0\n */\nexport var constFalse = /*#__PURE__*/ constant(false);\n/**\n * A thunk that returns always `null`.\n *\n * @since 2.0.0\n */\nexport var constNull = /*#__PURE__*/ constant(null);\n/**\n * A thunk that returns always `undefined`.\n *\n * @since 2.0.0\n */\nexport var constUndefined = /*#__PURE__*/ constant(undefined);\n/**\n * A thunk that returns always `void`.\n *\n * @since 2.0.0\n */\nexport var constVoid = constUndefined;\nexport function flip(f) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n if (args.length > 1) {\n return f(args[1], args[0]);\n }\n return function (a) { return f(a)(args[0]); };\n };\n}\nexport function flow(ab, bc, cd, de, ef, fg, gh, hi, ij) {\n switch (arguments.length) {\n case 1:\n return ab;\n case 2:\n return function () {\n return bc(ab.apply(this, arguments));\n };\n case 3:\n return function () {\n return cd(bc(ab.apply(this, arguments)));\n };\n case 4:\n return function () {\n return de(cd(bc(ab.apply(this, arguments))));\n };\n case 5:\n return function () {\n return ef(de(cd(bc(ab.apply(this, arguments)))));\n };\n case 6:\n return function () {\n return fg(ef(de(cd(bc(ab.apply(this, arguments))))));\n };\n case 7:\n return function () {\n return gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))));\n };\n case 8:\n return function () {\n return hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments))))))));\n };\n case 9:\n return function () {\n return ij(hi(gh(fg(ef(de(cd(bc(ab.apply(this, arguments)))))))));\n };\n }\n return;\n}\n/**\n * @since 2.0.0\n */\nexport function tuple() {\n var t = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n t[_i] = arguments[_i];\n }\n return t;\n}\n/**\n * @since 2.0.0\n */\nexport function increment(n) {\n return n + 1;\n}\n/**\n * @since 2.0.0\n */\nexport function decrement(n) {\n return n - 1;\n}\n/**\n * @since 2.0.0\n */\nexport function absurd(_) {\n throw new Error('Called `absurd` function which should be uncallable');\n}\n/**\n * Creates a tupled version of this function: instead of `n` arguments, it accepts a single tuple argument.\n *\n * @example\n * import { tupled } from 'fp-ts/function'\n *\n * const add = tupled((x: number, y: number): number => x + y)\n *\n * assert.strictEqual(add([1, 2]), 3)\n *\n * @since 2.4.0\n */\nexport function tupled(f) {\n return function (a) { return f.apply(void 0, a); };\n}\n/**\n * Inverse function of `tupled`\n *\n * @since 2.4.0\n */\nexport function untupled(f) {\n return function () {\n var a = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n a[_i] = arguments[_i];\n }\n return f(a);\n };\n}\nexport function pipe(a, ab, bc, cd, de, ef, fg, gh, hi) {\n switch (arguments.length) {\n case 1:\n return a;\n case 2:\n return ab(a);\n case 3:\n return bc(ab(a));\n case 4:\n return cd(bc(ab(a)));\n case 5:\n return de(cd(bc(ab(a))));\n case 6:\n return ef(de(cd(bc(ab(a)))));\n case 7:\n return fg(ef(de(cd(bc(ab(a))))));\n case 8:\n return gh(fg(ef(de(cd(bc(ab(a)))))));\n case 9:\n return hi(gh(fg(ef(de(cd(bc(ab(a))))))));\n default: {\n var ret = arguments[0];\n for (var i = 1; i < arguments.length; i++) {\n ret = arguments[i](ret);\n }\n return ret;\n }\n }\n}\n/**\n * Type hole simulation\n *\n * @since 2.7.0\n */\nexport var hole = absurd;\n/**\n * @since 2.11.0\n */\nexport var SK = function (_, b) { return b; };\n/**\n * Use `Predicate` module instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport function not(predicate) {\n return function (a) { return !predicate(a); };\n}\n/**\n * Use `Endomorphism` module instead.\n *\n * @category zone of death\n * @since 2.10.0\n * @deprecated\n */\nexport var getEndomorphismMonoid = function () { return ({\n concat: function (first, second) { return flow(first, second); },\n empty: identity\n}); };\n/** @internal */\nexport var dual = function (arity, body) {\n var isDataFirst = typeof arity === 'number' ? function (args) { return args.length >= arity; } : arity;\n return function () {\n var args = Array.from(arguments);\n if (isDataFirst(arguments)) {\n return body.apply(this, args);\n }\n return function (self) { return body.apply(void 0, __spreadArray([self], args, false)); };\n };\n};\n","var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nimport { dual } from './function';\n// -------------------------------------------------------------------------------------\n// Option\n// -------------------------------------------------------------------------------------\n/** @internal */\nexport var isNone = function (fa) { return fa._tag === 'None'; };\n/** @internal */\nexport var isSome = function (fa) { return fa._tag === 'Some'; };\n/** @internal */\nexport var none = { _tag: 'None' };\n/** @internal */\nexport var some = function (a) { return ({ _tag: 'Some', value: a }); };\n// -------------------------------------------------------------------------------------\n// Either\n// -------------------------------------------------------------------------------------\n/** @internal */\nexport var isLeft = function (ma) { return ma._tag === 'Left'; };\n/** @internal */\nexport var isRight = function (ma) { return ma._tag === 'Right'; };\n/** @internal */\nexport var left = function (e) { return ({ _tag: 'Left', left: e }); };\n/** @internal */\nexport var right = function (a) { return ({ _tag: 'Right', right: a }); };\n// -------------------------------------------------------------------------------------\n// ReadonlyNonEmptyArray\n// -------------------------------------------------------------------------------------\n/** @internal */\nexport var singleton = function (a) { return [a]; };\n/** @internal */\nexport var isNonEmpty = function (as) { return as.length > 0; };\n/** @internal */\nexport var head = function (as) { return as[0]; };\n/** @internal */\nexport var tail = function (as) { return as.slice(1); };\n// -------------------------------------------------------------------------------------\n// empty\n// -------------------------------------------------------------------------------------\n/** @internal */\nexport var emptyReadonlyArray = [];\n/** @internal */\nexport var emptyRecord = {};\n// -------------------------------------------------------------------------------------\n// Record\n// -------------------------------------------------------------------------------------\n/** @internal */\nexport var has = Object.prototype.hasOwnProperty;\n// -------------------------------------------------------------------------------------\n// NonEmptyArray\n// -------------------------------------------------------------------------------------\n/** @internal */\nexport var fromReadonlyNonEmptyArray = function (as) { return __spreadArray([as[0]], as.slice(1), true); };\n/** @internal */\nexport var liftNullable = function (F) {\n return function (f, onNullable) {\n return function () {\n var a = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n a[_i] = arguments[_i];\n }\n var o = f.apply(void 0, a);\n return F.fromEither(o == null ? left(onNullable.apply(void 0, a)) : right(o));\n };\n };\n};\n/** @internal */\nexport var liftOption = function (F) {\n return function (f, onNone) {\n return function () {\n var a = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n a[_i] = arguments[_i];\n }\n var o = f.apply(void 0, a);\n return F.fromEither(isNone(o) ? left(onNone.apply(void 0, a)) : right(o.value));\n };\n };\n};\n/** @internal */\nexport var flatMapNullable = function (F, M) {\n return /*#__PURE__*/ dual(3, function (self, f, onNullable) {\n return M.flatMap(self, liftNullable(F)(f, onNullable));\n });\n};\n/** @internal */\nexport var flatMapOption = function (F, M) {\n return /*#__PURE__*/ dual(3, function (self, f, onNone) { return M.flatMap(self, liftOption(F)(f, onNone)); });\n};\n/** @internal */\nexport var flatMapEither = function (F, M) {\n return /*#__PURE__*/ dual(2, function (self, f) {\n return M.flatMap(self, function (a) { return F.fromEither(f(a)); });\n });\n};\n/** @internal */\nexport var flatMapIO = function (F, M) {\n return /*#__PURE__*/ dual(2, function (self, f) {\n return M.flatMap(self, function (a) { return F.fromIO(f(a)); });\n });\n};\n/** @internal */\nexport var flatMapTask = function (F, M) {\n return /*#__PURE__*/ dual(2, function (self, f) {\n return M.flatMap(self, function (a) { return F.fromTask(f(a)); });\n });\n};\n/** @internal */\nexport var flatMapReader = function (F, M) {\n return /*#__PURE__*/ dual(2, function (self, f) {\n return M.flatMap(self, function (a) { return F.fromReader(f(a)); });\n });\n};\n","/**\n * The `Apply` class provides the `ap` which is used to apply a function to an argument under a type constructor.\n *\n * `Apply` can be used to lift functions of two or more arguments to work on values wrapped with the type constructor\n * `f`.\n *\n * Instances must satisfy the following law in addition to the `Functor` laws:\n *\n * 1. Associative composition: `F.ap(F.ap(F.map(fbc, bc => ab => a => bc(ab(a))), fab), fa) <-> F.ap(fbc, F.ap(fab, fa))`\n *\n * Formally, `Apply` represents a strong lax semi-monoidal endofunctor.\n *\n * @example\n * import * as O from 'fp-ts/Option'\n * import { pipe } from 'fp-ts/function'\n *\n * const f = (a: string) => (b: number) => (c: boolean) => a + String(b) + String(c)\n * const fa: O.Option<string> = O.some('s')\n * const fb: O.Option<number> = O.some(1)\n * const fc: O.Option<boolean> = O.some(true)\n *\n * assert.deepStrictEqual(\n * pipe(\n * // lift a function\n * O.some(f),\n * // apply the first argument\n * O.ap(fa),\n * // apply the second argument\n * O.ap(fb),\n * // apply the third argument\n * O.ap(fc)\n * ),\n * O.some('s1true')\n * )\n *\n * @since 2.0.0\n */\nimport { tuple } from './function';\nimport * as _ from './internal';\nexport function ap(F, G) {\n return function (fa) {\n return function (fab) {\n return F.ap(F.map(fab, function (gab) { return function (ga) { return G.ap(gab, ga); }; }), fa);\n };\n };\n}\nexport function apFirst(A) {\n return function (second) { return function (first) {\n return A.ap(A.map(first, function (a) { return function () { return a; }; }), second);\n }; };\n}\nexport function apSecond(A) {\n return function (second) {\n return function (first) {\n return A.ap(A.map(first, function () { return function (b) { return b; }; }), second);\n };\n };\n}\nexport function apS(F) {\n return function (name, fb) {\n return function (fa) {\n return F.ap(F.map(fa, function (a) { return function (b) {\n var _a;\n return Object.assign({}, a, (_a = {}, _a[name] = b, _a));\n }; }), fb);\n };\n };\n}\nexport function getApplySemigroup(F) {\n return function (S) { return ({\n concat: function (first, second) {\n return F.ap(F.map(first, function (x) { return function (y) { return S.concat(x, y); }; }), second);\n }\n }); };\n}\nfunction curried(f, n, acc) {\n return function (x) {\n var combined = Array(acc.length + 1);\n for (var i = 0; i < acc.length; i++) {\n combined[i] = acc[i];\n }\n combined[acc.length] = x;\n return n === 0 ? f.apply(null, combined) : curried(f, n - 1, combined);\n };\n}\nvar tupleConstructors = {\n 1: function (a) { return [a]; },\n 2: function (a) { return function (b) { return [a, b]; }; },\n 3: function (a) { return function (b) { return function (c) { return [a, b, c]; }; }; },\n 4: function (a) { return function (b) { return function (c) { return function (d) { return [a, b, c, d]; }; }; }; },\n 5: function (a) { return function (b) { return function (c) { return function (d) { return function (e) { return [a, b, c, d, e]; }; }; }; }; }\n};\nfunction getTupleConstructor(len) {\n if (!_.has.call(tupleConstructors, len)) {\n tupleConstructors[len] = curried(tuple, len - 1, []);\n }\n return tupleConstructors[len];\n}\nexport function sequenceT(F) {\n return function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var len = args.length;\n var f = getTupleConstructor(len);\n var fas = F.map(args[0], f);\n for (var i = 1; i < len; i++) {\n fas = F.ap(fas, args[i]);\n }\n return fas;\n };\n}\nfunction getRecordConstructor(keys) {\n var len = keys.length;\n switch (len) {\n case 1:\n return function (a) {\n var _a;\n return (_a = {}, _a[keys[0]] = a, _a);\n };\n case 2:\n return function (a) { return function (b) {\n var _a;\n return (_a = {}, _a[keys[0]] = a, _a[keys[1]] = b, _a);\n }; };\n case 3:\n return function (a) { return function (b) { return function (c) {\n var _a;\n return (_a = {}, _a[keys[0]] = a, _a[keys[1]] = b, _a[keys[2]] = c, _a);\n }; }; };\n case 4:\n return function (a) { return function (b) { return function (c) { return function (d) {\n var _a;\n return (_a = {},\n _a[keys[0]] = a,\n _a[keys[1]] = b,\n _a[keys[2]] = c,\n _a[keys[3]] = d,\n _a);\n }; }; }; };\n case 5:\n return function (a) { return function (b) { return function (c) { return function (d) { return function (e) {\n var _a;\n return (_a = {},\n _a[keys[0]] = a,\n _a[keys[1]] = b,\n _a[keys[2]] = c,\n _a[keys[3]] = d,\n _a[keys[4]] = e,\n _a);\n }; }; }; }; };\n default:\n return curried(function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n var r = {};\n for (var i = 0; i < len; i++) {\n r[keys[i]] = args[i];\n }\n return r;\n }, len - 1, []);\n }\n}\nexport function sequenceS(F) {\n return function (r) {\n var keys = Object.keys(r);\n var len = keys.length;\n var f = getRecordConstructor(keys);\n var fr = F.map(r[keys[0]], f);\n for (var i = 1; i < len; i++) {\n fr = F.ap(fr, r[keys[i]]);\n }\n return fr;\n };\n}\n","/**\n * A `Functor` is a type constructor which supports a mapping operation `map`.\n *\n * `map` can be used to turn functions `a -> b` into functions `f a -> f b` whose argument and return types use the type\n * constructor `f` to represent some computational context.\n *\n * Instances must satisfy the following laws:\n *\n * 1. Identity: `F.map(fa, a => a) <-> fa`\n * 2. Composition: `F.map(fa, a => bc(ab(a))) <-> F.map(F.map(fa, ab), bc)`\n *\n * @since 2.0.0\n */\nimport { pipe } from './function';\nexport function map(F, G) {\n return function (f) { return function (fa) { return F.map(fa, function (ga) { return G.map(ga, f); }); }; };\n}\nexport function flap(F) {\n return function (a) { return function (fab) { return F.map(fab, function (f) { return f(a); }); }; };\n}\nexport function bindTo(F) {\n return function (name) { return function (fa) { return F.map(fa, function (a) {\n var _a;\n return (_a = {}, _a[name] = a, _a);\n }); }; };\n}\nfunction let_(F) {\n return function (name, f) { return function (fa) { return F.map(fa, function (a) {\n var _a;\n return Object.assign({}, a, (_a = {}, _a[name] = f(a), _a));\n }); }; };\n}\nexport { \n/**\n * @since 2.13.0\n */\nlet_ as let };\n/** @deprecated */\nexport function getFunctorComposition(F, G) {\n var _map = map(F, G);\n return {\n map: function (fga, f) { return pipe(fga, _map(f)); }\n };\n}\n/** @internal */\nexport function as(F) {\n return function (self, b) { return F.map(self, function () { return b; }); };\n}\n/** @internal */\nexport function asUnit(F) {\n var asM = as(F);\n return function (self) { return asM(self, undefined); };\n}\n","export function chainFirst(M) {\n var tapM = tap(M);\n return function (f) { return function (first) { return tapM(first, f); }; };\n}\n/** @internal */\nexport function tap(M) {\n return function (first, f) { return M.chain(first, function (a) { return M.map(f(a), function () { return a; }); }); };\n}\nexport function bind(M) {\n return function (name, f) { return function (ma) { return M.chain(ma, function (a) { return M.map(f(a), function (b) {\n var _a;\n return Object.assign({}, a, (_a = {}, _a[name] = b, _a));\n }); }); }; };\n}\n","import { getApplicativeMonoid } from './Applicative';\nimport { apFirst as apFirst_, apS as apS_, apSecond as apSecond_, getApplySemigroup as getApplySemigroup_ } from './Apply';\nimport * as chainable from './Chain';\nimport { chainEitherK as chainEitherK_, fromEitherK as fromEitherK_, tapEither as tapEither_ } from './FromEither';\nimport { constNull, constUndefined, dual, flow, identity, pipe } from './function';\nimport { as as as_, asUnit as asUnit_, bindTo as bindTo_, flap as flap_, let as let__ } from './Functor';\nimport * as _ from './internal';\nimport { not } from './Predicate';\nimport { first, last } from './Semigroup';\nimport { separated } from './Separated';\nimport { wiltDefault, witherDefault } from './Witherable';\nimport { guard as guard_ } from './Zero';\n// -------------------------------------------------------------------------------------\n// constructors\n// -------------------------------------------------------------------------------------\n/**\n * `None` doesn't have a constructor, instead you can use it directly as a value. Represents a missing value.\n *\n * @category constructors\n * @since 2.0.0\n */\nexport var none = _.none;\n/**\n * Constructs a `Some`. Represents an optional value that exists.\n *\n * @category constructors\n * @since 2.0.0\n */\nexport var some = _.some;\nexport function fromPredicate(predicate) {\n return function (a) { return (predicate(a) ? some(a) : none); };\n}\n/**\n * Returns the `Left` value of an `Either` if possible.\n *\n * @example\n * import { getLeft, none, some } from 'fp-ts/Option'\n * import { right, left } from 'fp-ts/Either'\n *\n * assert.deepStrictEqual(getLeft(right(1)), none)\n * assert.deepStrictEqual(getLeft(left('a')), some('a'))\n *\n * @category constructors\n * @since 2.0.0\n */\nexport var getLeft = function (ma) { return (ma._tag === 'Right' ? none : some(ma.left)); };\n/**\n * Returns the `Right` value of an `Either` if possible.\n *\n * @example\n * import { getRight, none, some } from 'fp-ts/Option'\n * import { right, left } from 'fp-ts/Either'\n *\n * assert.deepStrictEqual(getRight(right(1)), some(1))\n * assert.deepStrictEqual(getRight(left('a')), none)\n *\n * @category constructors\n * @since 2.0.0\n */\nexport var getRight = function (ma) { return (ma._tag === 'Left' ? none : some(ma.right)); };\nvar _map = function (fa, f) { return pipe(fa, map(f)); };\nvar _ap = function (fab, fa) { return pipe(fab, ap(fa)); };\nvar _reduce = function (fa, b, f) { return pipe(fa, reduce(b, f)); };\nvar _foldMap = function (M) {\n var foldMapM = foldMap(M);\n return function (fa, f) { return pipe(fa, foldMapM(f)); };\n};\nvar _reduceRight = function (fa, b, f) { return pipe(fa, reduceRight(b, f)); };\nvar _traverse = function (F) {\n var traverseF = traverse(F);\n return function (ta, f) { return pipe(ta, traverseF(f)); };\n};\n/* istanbul ignore next */\nvar _alt = function (fa, that) { return pipe(fa, alt(that)); };\nvar _filter = function (fa, predicate) { return pipe(fa, filter(predicate)); };\n/* istanbul ignore next */\nvar _filterMap = function (fa, f) { return pipe(fa, filterMap(f)); };\n/* istanbul ignore next */\nvar _extend = function (wa, f) { return pipe(wa, extend(f)); };\n/* istanbul ignore next */\nvar _partition = function (fa, predicate) {\n return pipe(fa, partition(predicate));\n};\n/* istanbul ignore next */\nvar _partitionMap = function (fa, f) { return pipe(fa, partitionMap(f)); };\n/**\n * @category type lambdas\n * @since 2.0.0\n */\nexport var URI = 'Option';\n/**\n * @category instances\n * @since 2.0.0\n */\nexport var getShow = function (S) { return ({\n show: function (ma) { return (isNone(ma) ? 'none' : \"some(\".concat(S.show(ma.value), \")\")); }\n}); };\n/**\n * @example\n * import { none, some, getEq } from 'fp-ts/Option'\n * import * as N from 'fp-ts/number'\n *\n * const E = getEq(N.Eq)\n * assert.strictEqual(E.equals(none, none), true)\n * assert.strictEqual(E.equals(none, some(1)), false)\n * assert.strictEqual(E.equals(some(1), none), false)\n * assert.strictEqual(E.equals(some(1), some(2)), false)\n * assert.strictEqual(E.equals(some(1), some(1)), true)\n *\n * @category instances\n * @since 2.0.0\n */\nexport var getEq = function (E) { return ({\n equals: function (x, y) { return x === y || (isNone(x) ? isNone(y) : isNone(y) ? false : E.equals(x.value, y.value)); }\n}); };\n/**\n * The `Ord` instance allows `Option` values to be compared with\n * `compare`, whenever there is an `Ord` instance for\n * the type the `Option` contains.\n *\n * `None` is considered to be less than any `Some` value.\n *\n *\n * @example\n * import { none, some, getOrd } from 'fp-ts/Option'\n * import * as N from 'fp-ts/number'\n *\n * const O = getOrd(N.Ord)\n * assert.strictEqual(O.compare(none, none), 0)\n * assert.strictEqual(O.compare(none, some(1)), -1)\n * assert.strictEqual(O.compare(some(1), none), 1)\n * assert.strictEqual(O.compare(some(1), some(2)), -1)\n * assert.strictEqual(O.compare(some(1), some(1)), 0)\n *\n * @category instances\n * @since 2.0.0\n */\nexport var getOrd = function (O) { return ({\n equals: getEq(O).equals,\n compare: function (x, y) { return (x === y ? 0 : isSome(x) ? (isSome(y) ? O.compare(x.value, y.value) : 1) : isSome(y) ? -1 : 0); }\n}); };\n/**\n * Monoid returning the left-most non-`None` value. If both operands are `Some`s then the inner values are\n * concatenated using the provided `Semigroup`\n *\n * | x | y | concat(x, y) |\n * | ------- | ------- | ------------------ |\n * | none | none | none |\n * | some(a) | none | some(a) |\n * | none | some(b) | some(b) |\n * | some(a) | some(b) | some(concat(a, b)) |\n *\n * @example\n * import { getMonoid, some, none } from 'fp-ts/Option'\n * import { SemigroupSum } from 'fp-ts/number'\n *\n * const M = getMonoid(SemigroupSum)\n * assert.deepStrictEqual(M.concat(none, none), none)\n * assert.deepStrictEqual(M.concat(some(1), none), some(1))\n * assert.deepStrictEqual(M.concat(none, some(1)), some(1))\n * assert.deepStrictEqual(M.concat(some(1), some(2)), some(3))\n *\n * @category instances\n * @since 2.0.0\n */\nexport var getMonoid = function (S) { return ({\n concat: function (x, y) { return (isNone(x) ? y : isNone(y) ? x : some(S.concat(x.value, y.value))); },\n empty: none\n}); };\n/**\n * @category mapping\n * @since 2.0.0\n */\nexport var map = function (f) { return function (fa) {\n return isNone(fa) ? none : some(f(fa.value));\n}; };\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Functor = {\n URI: URI,\n map: _map\n};\n/**\n * Maps the `Some` value of this `Option` to the specified constant value.\n *\n * @category mapping\n * @since 2.16.0\n */\nexport var as = dual(2, as_(Functor));\n/**\n * Maps the `Some` value of this `Option` to the void constant value.\n *\n * @category mapping\n * @since 2.16.0\n */\nexport var asUnit = asUnit_(Functor);\n/**\n * @category constructors\n * @since 2.7.0\n */\nexport var of = some;\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Pointed = {\n URI: URI,\n of: of\n};\n/**\n * @since 2.0.0\n */\nexport var ap = function (fa) { return function (fab) {\n return isNone(fab) ? none : isNone(fa) ? none : some(fab.value(fa.value));\n}; };\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Apply = {\n URI: URI,\n map: _map,\n ap: _ap\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Applicative = {\n URI: URI,\n map: _map,\n ap: _ap,\n of: of\n};\n/**\n * @category sequencing\n * @since 2.14.0\n */\nexport var flatMap = /*#__PURE__*/ dual(2, function (ma, f) { return (isNone(ma) ? none : f(ma.value)); });\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Chain = {\n URI: URI,\n map: _map,\n ap: _ap,\n chain: flatMap\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Monad = {\n URI: URI,\n map: _map,\n ap: _ap,\n of: of,\n chain: flatMap\n};\n/**\n * @category folding\n * @since 2.0.0\n */\nexport var reduce = function (b, f) { return function (fa) {\n return isNone(fa) ? b : f(b, fa.value);\n}; };\n/**\n * @category folding\n * @since 2.0.0\n */\nexport var foldMap = function (M) { return function (f) { return function (fa) {\n return isNone(fa) ? M.empty : f(fa.value);\n}; }; };\n/**\n * @category folding\n * @since 2.0.0\n */\nexport var reduceRight = function (b, f) { return function (fa) {\n return isNone(fa) ? b : f(fa.value, b);\n}; };\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Foldable = {\n URI: URI,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight\n};\n/**\n * Returns the provided `Option` `that` if `self` is `None`, otherwise returns `self`.\n *\n * @param self - The first `Option` to be checked.\n * @param that - The `Option` to return if `self` is `None`.\n *\n * @example\n * import * as O from \"fp-ts/Option\"\n *\n * assert.deepStrictEqual(O.orElse(O.none, () => O.none), O.none)\n * assert.deepStrictEqual(O.orElse(O.some(1), () => O.none), O.some(1))\n * assert.deepStrictEqual(O.orElse(O.none, () => O.some('b')), O.some('b'))\n * assert.deepStrictEqual(O.orElse(O.some(1), () => O.some('b')), O.some(1))\n *\n * @category error handling\n * @since 2.16.0\n */\nexport var orElse = dual(2, function (self, that) { return (isNone(self) ? that() : self); });\n/**\n * Alias of `orElse`.\n *\n * Less strict version of [`alt`](#alt).\n *\n * The `W` suffix (short for **W**idening) means that the return types will be merged.\n *\n * @category legacy\n * @since 2.9.0\n */\nexport var altW = orElse;\n/**\n * Alias of `orElse`.\n *\n * @category legacy\n * @since 2.0.0\n */\nexport var alt = orElse;\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Alt = {\n URI: URI,\n map: _map,\n alt: _alt\n};\n/**\n * @since 2.7.0\n */\nexport var zero = function () { return none; };\n/**\n * @category instances\n * @since 2.11.0\n */\nexport var Zero = {\n URI: URI,\n zero: zero\n};\n/**\n * @category do notation\n * @since 2.11.0\n */\nexport var guard = /*#__PURE__*/ guard_(Zero, Pointed);\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Alternative = {\n URI: URI,\n map: _map,\n ap: _ap,\n of: of,\n alt: _alt,\n zero: zero\n};\n/**\n * @since 2.0.0\n */\nexport var extend = function (f) { return function (wa) {\n return isNone(wa) ? none : some(f(wa));\n}; };\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Extend = {\n URI: URI,\n map: _map,\n extend: _extend\n};\n/**\n * @category filtering\n * @since 2.0.0\n */\nexport var compact = /*#__PURE__*/ flatMap(identity);\nvar defaultSeparated = /*#__PURE__*/ separated(none, none);\n/**\n * @category filtering\n * @since 2.0.0\n */\nexport var separate = function (ma) {\n return isNone(ma) ? defaultSeparated : separated(getLeft(ma.value), getRight(ma.value));\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Compactable = {\n URI: URI,\n compact: compact,\n separate: separate\n};\n/**\n * @category filtering\n * @since 2.0.0\n */\nexport var filter = function (predicate) {\n return function (fa) {\n return isNone(fa) ? none : predicate(fa.value) ? fa : none;\n };\n};\n/**\n * @category filtering\n * @since 2.0.0\n */\nexport var filterMap = function (f) { return function (fa) {\n return isNone(fa) ? none : f(fa.value);\n}; };\n/**\n * @category filtering\n * @since 2.0.0\n */\nexport var partition = function (predicate) {\n return function (fa) {\n return separated(_filter(fa, not(predicate)), _filter(fa, predicate));\n };\n};\n/**\n * @category filtering\n * @since 2.0.0\n */\nexport var partitionMap = function (f) { return flow(map(f), separate); };\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Filterable = {\n URI: URI,\n map: _map,\n compact: compact,\n separate: separate,\n filter: _filter,\n filterMap: _filterMap,\n partition: _partition,\n partitionMap: _partitionMap\n};\n/**\n * @category traversing\n * @since 2.6.3\n */\nexport var traverse = function (F) {\n return function (f) {\n return function (ta) {\n return isNone(ta) ? F.of(none) : F.map(f(ta.value), some);\n };\n };\n};\n/**\n * @category traversing\n * @since 2.6.3\n */\nexport var sequence = function (F) {\n return function (ta) {\n return isNone(ta) ? F.of(none) : F.map(ta.value, some);\n };\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Traversable = {\n URI: URI,\n map: _map,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n traverse: _traverse,\n sequence: sequence\n};\nvar _wither = /*#__PURE__*/ witherDefault(Traversable, Compactable);\nvar _wilt = /*#__PURE__*/ wiltDefault(Traversable, Compactable);\n/**\n * @category filtering\n * @since 2.6.5\n */\nexport var wither = function (F) {\n var _witherF = _wither(F);\n return function (f) { return function (fa) { return _witherF(fa, f); }; };\n};\n/**\n * @category filtering\n * @since 2.6.5\n */\nexport var wilt = function (F) {\n var _wiltF = _wilt(F);\n return function (f) { return function (fa) { return _wiltF(fa, f); }; };\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Witherable = {\n URI: URI,\n map: _map,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n traverse: _traverse,\n sequence: sequence,\n compact: compact,\n separate: separate,\n filter: _filter,\n filterMap: _filterMap,\n partition: _partition,\n partitionMap: _partitionMap,\n wither: _wither,\n wilt: _wilt\n};\n/**\n * @since 2.7.0\n */\nexport var throwError = function () { return none; };\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var MonadThrow = {\n URI: URI,\n map: _map,\n ap: _ap,\n of: of,\n chain: flatMap,\n throwError: throwError\n};\n/**\n * Transforms an `Either` to an `Option` discarding the error.\n *\n * Alias of [getRight](#getright)\n *\n * @category conversions\n * @since 2.0.0\n */\nexport var fromEither = getRight;\n/**\n * @category instances\n * @since 2.11.0\n */\nexport var FromEither = {\n URI: URI,\n fromEither: fromEither\n};\n// -------------------------------------------------------------------------------------\n// refinements\n// -------------------------------------------------------------------------------------\n/**\n * Returns `true` if the option is an instance of `Some`, `false` otherwise.\n *\n * @example\n * import { some, none, isSome } from 'fp-ts/Option'\n *\n * assert.strictEqual(isSome(some(1)), true)\n * assert.strictEqual(isSome(none), false)\n *\n * @category refinements\n * @since 2.0.0\n */\nexport var isSome = _.isSome;\n/**\n * Returns `true` if the option is `None`, `false` otherwise.\n *\n * @example\n * import { some, none, isNone } from 'fp-ts/Option'\n *\n * assert.strictEqual(isNone(some(1)), false)\n * assert.strictEqual(isNone(none), true)\n *\n * @category refinements\n * @since 2.0.0\n */\nexport var isNone = function (fa) { return fa._tag === 'None'; };\n/**\n * Less strict version of [`match`](#match).\n *\n * The `W` suffix (short for **W**idening) means that the handler return types will be merged.\n *\n * @category pattern matching\n * @since 2.10.0\n */\nexport var matchW = function (onNone, onSome) {\n return function (ma) {\n return isNone(ma) ? onNone() : onSome(ma.value);\n };\n};\n/**\n * Alias of [`matchW`](#matchw).\n *\n * @category pattern matching\n * @since 2.10.0\n */\nexport var foldW = matchW;\n/**\n * Takes a (lazy) default value, a function, and an `Option` value, if the `Option` value is `None` the default value is\n * returned, otherwise the function is applied to the value inside the `Some` and the result is returned.\n *\n * @example\n * import { some, none, match } from 'fp-ts/Option'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.strictEqual(\n * pipe(\n * some(1),\n * match(() => 'a none', a => `a some containing ${a}`)\n * ),\n * 'a some containing 1'\n * )\n *\n * assert.strictEqual(\n * pipe(\n * none,\n * match(() => 'a none', a => `a some containing ${a}`)\n * ),\n * 'a none'\n * )\n *\n * @category pattern matching\n * @since 2.10.0\n */\nexport var match = matchW;\n/**\n * Alias of [`match`](#match).\n *\n * @category pattern matching\n * @since 2.0.0\n */\nexport var fold = match;\n/**\n * Less strict version of [`getOrElse`](#getorelse).\n *\n * The `W` suffix (short for **W**idening) means that the handler return type will be merged.\n *\n * @category error handling\n * @since 2.6.0\n */\nexport var getOrElseW = function (onNone) {\n return function (ma) {\n return isNone(ma) ? onNone() : ma.value;\n };\n};\n/**\n * Extracts the value out of the structure, if it exists. Otherwise returns the given default value\n *\n * @example\n * import { some, none, getOrElse } from 'fp-ts/Option'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.strictEqual(\n * pipe(\n * some(1),\n * getOrElse(() => 0)\n * ),\n * 1\n * )\n * assert.strictEqual(\n * pipe(\n * none,\n * getOrElse(() => 0)\n * ),\n * 0\n * )\n *\n * @category error handling\n * @since 2.0.0\n */\nexport var getOrElse = getOrElseW;\n/**\n * @category mapping\n * @since 2.10.0\n */\nexport var flap = /*#__PURE__*/ flap_(Functor);\n/**\n * Combine two effectful actions, keeping only the result of the first.\n *\n * @since 2.0.0\n */\nexport var apFirst = /*#__PURE__*/ apFirst_(Apply);\n/**\n * Combine two effectful actions, keeping only the result of the second.\n *\n * @since 2.0.0\n */\nexport var apSecond = /*#__PURE__*/ apSecond_(Apply);\n/**\n * @category sequencing\n * @since 2.0.0\n */\nexport var flatten = compact;\n/**\n * Composes computations in sequence, using the return value of one computation to determine the next computation and\n * keeping only the result of the first.\n *\n * @category combinators\n * @since 2.15.0\n */\nexport var tap = /*#__PURE__*/ dual(2, chainable.tap(Chain));\n/**\n * Composes computations in sequence, using the return value of one computation to determine the next computation and\n * keeping only the result of the first.\n *\n * @example\n * import { pipe } from 'fp-ts/function'\n * import * as O from 'fp-ts/Option'\n * import * as E from 'fp-ts/Either'\n *\n * const compute = (value: number) => pipe(\n * O.of(value),\n * O.tapEither((value) => value > 0 ? E.right('ok') : E.left('error')),\n * )\n *\n * assert.deepStrictEqual(compute(1), O.of(1))\n * assert.deepStrictEqual(compute(-42), O.none)\n *\n * @category combinators\n * @since 2.16.0\n */\nexport var tapEither = /*#__PURE__*/ dual(2, tapEither_(FromEither, Chain));\n/**\n * @since 2.0.0\n */\nexport var duplicate = /*#__PURE__*/ extend(identity);\n/**\n * @category lifting\n * @since 2.11.0\n */\nexport var fromEitherK = /*#__PURE__*/ fromEitherK_(FromEither);\n/**\n * @category sequencing\n * @since 2.11.0\n */\nexport var chainEitherK = \n/*#__PURE__*/ chainEitherK_(FromEither, Chain);\n/**\n * Alias of `tapEither`.\n *\n * @category legacy\n * @since 2.12.0\n */\nexport var chainFirstEitherK = tapEither;\n/**\n * Constructs a new `Option` from a nullable type. If the value is `null` or `undefined`, returns `None`, otherwise\n * returns the value wrapped in a `Some`.\n *\n * @example\n * import { none, some, fromNullable } from 'fp-ts/Option'\n *\n * assert.deepStrictEqual(fromNullable(undefined), none)\n * assert.deepStrictEqual(fromNullable(null), none)\n * assert.deepStrictEqual(fromNullable(1), some(1))\n *\n * @category conversions\n * @since 2.0.0\n */\nexport var fromNullable = function (a) { return (a == null ? none : some(a)); };\n/**\n * Transforms an exception into an `Option`. If `f` throws, returns `None`, otherwise returns the output wrapped in a\n * `Some`.\n *\n * See also [`tryCatchK`](#trycatchk).\n *\n * @example\n * import { none, some, tryCatch } from 'fp-ts/Option'\n *\n * assert.deepStrictEqual(\n * tryCatch(() => {\n * throw new Error()\n * }),\n * none\n * )\n * assert.deepStrictEqual(tryCatch(() => 1), some(1))\n *\n * @category interop\n * @since 2.0.0\n */\nexport var tryCatch = function (f) {\n try {\n return some(f());\n }\n catch (e) {\n return none;\n }\n};\n/**\n * Converts a function that may throw to one returning a `Option`.\n *\n * @category interop\n * @since 2.10.0\n */\nexport var tryCatchK = function (f) {\n return function () {\n var a = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n a[_i] = arguments[_i];\n }\n return tryCatch(function () { return f.apply(void 0, a); });\n };\n};\n/**\n * Returns a *smart constructor* from a function that returns a nullable value.\n *\n * @example\n * import { fromNullableK, none, some } from 'fp-ts/Option'\n *\n * const f = (s: string): number | undefined => {\n * const n = parseFloat(s)\n * return isNaN(n) ? undefined : n\n * }\n *\n * const g = fromNullableK(f)\n *\n * assert.deepStrictEqual(g('1'), some(1))\n * assert.deepStrictEqual(g('a'), none)\n *\n * @category lifting\n * @since 2.9.0\n */\nexport var fromNullableK = function (f) { return flow(f, fromNullable); };\n/**\n * This is `chain` + `fromNullable`, useful when working with optional values.\n *\n * @example\n * import { some, none, fromNullable, chainNullableK } from 'fp-ts/Option'\n * import { pipe } from 'fp-ts/function'\n *\n * interface Employee {\n * readonly company?: {\n * readonly address?: {\n * readonly street?: {\n * readonly name?: string\n * }\n * }\n * }\n * }\n *\n * const employee1: Employee = { company: { address: { street: { name: 'high street' } } } }\n *\n * assert.deepStrictEqual(\n * pipe(\n * fromNullable(employee1.company),\n * chainNullableK(company => company.address),\n * chainNullableK(address => address.street),\n * chainNullableK(street => street.name)\n * ),\n * some('high street')\n * )\n *\n * const employee2: Employee = { company: { address: { street: {} } } }\n *\n * assert.deepStrictEqual(\n * pipe(\n * fromNullable(employee2.company),\n * chainNullableK(company => company.address),\n * chainNullableK(address => address.street),\n * chainNullableK(street => street.name)\n * ),\n * none\n * )\n *\n * @category sequencing\n * @since 2.9.0\n */\nexport var chainNullableK = function (f) {\n return function (ma) {\n return isNone(ma) ? none : fromNullable(f(ma.value));\n };\n};\n/**\n * Extracts the value out of the structure, if it exists. Otherwise returns `null`.\n *\n * @example\n * import { some, none, toNullable } from 'fp-ts/Option'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.strictEqual(\n * pipe(\n * some(1),\n * toNullable\n * ),\n * 1\n * )\n * assert.strictEqual(\n * pipe(\n * none,\n * toNullable\n * ),\n * null\n * )\n *\n * @category conversions\n * @since 2.0.0\n */\nexport var toNullable = /*#__PURE__*/ match(constNull, identity);\n/**\n * Extracts the value out of the structure, if it exists. Otherwise returns `undefined`.\n *\n * @example\n * import { some, none, toUndefined } from 'fp-ts/Option'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.strictEqual(\n * pipe(\n * some(1),\n * toUndefined\n * ),\n * 1\n * )\n * assert.strictEqual(\n * pipe(\n * none,\n * toUndefined\n * ),\n * undefined\n * )\n *\n * @category conversions\n * @since 2.0.0\n */\nexport var toUndefined = /*#__PURE__*/ match(constUndefined, identity);\nexport function elem(E) {\n return function (a, ma) {\n if (ma === undefined) {\n var elemE_1 = elem(E);\n return function (ma) { return elemE_1(a, ma); };\n }\n return isNone(ma) ? false : E.equals(a, ma.value);\n };\n}\n/**\n * Returns `true` if the predicate is satisfied by the wrapped value\n *\n * @example\n * import { some, none, exists } from 'fp-ts/Option'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.strictEqual(\n * pipe(\n * some(1),\n * exists(n => n > 0)\n * ),\n * true\n * )\n * assert.strictEqual(\n * pipe(\n * some(1),\n * exists(n => n > 1)\n * ),\n * false\n * )\n * assert.strictEqual(\n * pipe(\n * none,\n * exists(n => n > 0)\n * ),\n * false\n * )\n *\n * @since 2.0.0\n */\nexport var exists = function (predicate) {\n return function (ma) {\n return isNone(ma) ? false : predicate(ma.value);\n };\n};\n// -------------------------------------------------------------------------------------\n// do notation\n// -------------------------------------------------------------------------------------\n/**\n * @category do notation\n * @since 2.9.0\n */\nexport var Do = /*#__PURE__*/ of(_.emptyRecord);\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var bindTo = /*#__PURE__*/ bindTo_(Functor);\nvar let_ = /*#__PURE__*/ let__(Functor);\nexport { \n/**\n * @category do notation\n * @since 2.13.0\n */\nlet_ as let };\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var bind = /*#__PURE__*/ chainable.bind(Chain);\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var apS = /*#__PURE__*/ apS_(Apply);\n/**\n * @since 2.11.0\n */\nexport var ApT = /*#__PURE__*/ of(_.emptyReadonlyArray);\n// -------------------------------------------------------------------------------------\n// array utils\n// -------------------------------------------------------------------------------------\n/**\n * Equivalent to `ReadonlyNonEmptyArray#traverseWithIndex(Applicative)`.\n *\n * @category traversing\n * @since 2.11.0\n */\nexport var traverseReadonlyNonEmptyArrayWithIndex = function (f) {\n return function (as) {\n var o = f(0, _.head(as));\n if (isNone(o)) {\n return none;\n }\n var out = [o.value];\n for (var i = 1; i < as.length; i++) {\n var o_1 = f(i, as[i]);\n if (isNone(o_1)) {\n return none;\n }\n out.push(o_1.value);\n }\n return some(out);\n };\n};\n/**\n * Equivalent to `ReadonlyArray#traverseWithIndex(Applicative)`.\n *\n * @category traversing\n * @since 2.11.0\n */\nexport var traverseReadonlyArrayWithIndex = function (f) {\n var g = traverseReadonlyNonEmptyArrayWithIndex(f);\n return function (as) { return (_.isNonEmpty(as) ? g(as) : ApT); };\n};\n/**\n * Equivalent to `ReadonlyArray#traverseWithIndex(Applicative)`.\n *\n * @category traversing\n * @since 2.9.0\n */\nexport var traverseArrayWithIndex = traverseReadonlyArrayWithIndex;\n/**\n * Equivalent to `ReadonlyArray#traverse(Applicative)`.\n *\n * @category traversing\n * @since 2.9.0\n */\nexport var traverseArray = function (f) {\n return traverseReadonlyArrayWithIndex(function (_, a) { return f(a); });\n};\n/**\n * Equivalent to `ReadonlyArray#sequence(Applicative)`.\n *\n * @category traversing\n * @since 2.9.0\n */\nexport var sequenceArray = \n/*#__PURE__*/ traverseArray(identity);\n// -------------------------------------------------------------------------------------\n// legacy\n// -------------------------------------------------------------------------------------\n/**\n * Alias of `flatMap`.\n *\n * @category legacy\n * @since 2.0.0\n */\nexport var chain = flatMap;\n/**\n * Alias of `tap`.\n *\n * @category legacy\n * @since 2.0.0\n */\nexport var chainFirst = tap;\n// -------------------------------------------------------------------------------------\n// deprecated\n// -------------------------------------------------------------------------------------\n/**\n * Use `Refinement` module instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport function getRefinement(getOption) {\n return function (a) { return isSome(getOption(a)); };\n}\n/**\n * Use [`chainNullableK`](#chainnullablek) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var mapNullable = chainNullableK;\n/**\n * This instance is deprecated, use small, specific instances instead.\n * For example if a function needs a `Functor` instance, pass `O.Functor` instead of `O.option`\n * (where `O` is from `import O from 'fp-ts/Option'`)\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var option = {\n URI: URI,\n map: _map,\n of: of,\n ap: _ap,\n chain: flatMap,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n traverse: _traverse,\n sequence: sequence,\n zero: zero,\n alt: _alt,\n extend: _extend,\n compact: compact,\n separate: separate,\n filter: _filter,\n filterMap: _filterMap,\n partition: _partition,\n partitionMap: _partitionMap,\n wither: _wither,\n wilt: _wilt,\n throwError: throwError\n};\n/**\n * Use [`getApplySemigroup`](./Apply.ts.html#getapplysemigroup) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var getApplySemigroup = /*#__PURE__*/ getApplySemigroup_(Apply);\n/**\n * Use [`getApplicativeMonoid`](./Applicative.ts.html#getapplicativemonoid) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var getApplyMonoid = /*#__PURE__*/ getApplicativeMonoid(Applicative);\n/**\n * Use\n *\n * ```ts\n * import { first } from 'fp-ts/Semigroup'\n * import { getMonoid } from 'fp-ts/Option'\n *\n * getMonoid(first())\n * ```\n *\n * instead.\n *\n * Monoid returning the left-most non-`None` value\n *\n * | x | y | concat(x, y) |\n * | ------- | ------- | ------------ |\n * | none | none | none |\n * | some(a) | none | some(a) |\n * | none | some(b) | some(b) |\n * | some(a) | some(b) | some(a) |\n *\n * @example\n * import { getFirstMonoid, some, none } from 'fp-ts/Option'\n *\n * const M = getFirstMonoid<number>()\n * assert.deepStrictEqual(M.concat(none, none), none)\n * assert.deepStrictEqual(M.concat(some(1), none), some(1))\n * assert.deepStrictEqual(M.concat(none, some(2)), some(2))\n * assert.deepStrictEqual(M.concat(some(1), some(2)), some(1))\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var getFirstMonoid = function () { return getMonoid(first()); };\n/**\n * Use\n *\n * ```ts\n * import { last } from 'fp-ts/Semigroup'\n * import { getMonoid } from 'fp-ts/Option'\n *\n * getMonoid(last())\n * ```\n *\n * instead.\n *\n * Monoid returning the right-most non-`None` value\n *\n * | x | y | concat(x, y) |\n * | ------- | ------- | ------------ |\n * | none | none | none |\n * | some(a) | none | some(a) |\n * | none | some(b) | some(b) |\n * | some(a) | some(b) | some(b) |\n *\n * @example\n * import { getLastMonoid, some, none } from 'fp-ts/Option'\n *\n * const M = getLastMonoid<number>()\n * assert.deepStrictEqual(M.concat(none, none), none)\n * assert.deepStrictEqual(M.concat(some(1), none), some(1))\n * assert.deepStrictEqual(M.concat(none, some(2)), some(2))\n * assert.deepStrictEqual(M.concat(some(1), some(2)), some(2))\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var getLastMonoid = function () { return getMonoid(last()); };\n","import { getApplicativeMonoid } from './Applicative';\nimport { apFirst as apFirst_, apS as apS_, apSecond as apSecond_, getApplySemigroup as getApplySemigroup_ } from './Apply';\nimport * as chainable from './Chain';\nimport { tailRec } from './ChainRec';\nimport { chainOptionK as chainOptionK_, filterOrElse as filterOrElse_, fromOption as fromOption_, fromOptionK as fromOptionK_, fromPredicate as fromPredicate_ } from './FromEither';\nimport { dual, flow, identity, pipe } from './function';\nimport { as as as_, asUnit as asUnit_, bindTo as bindTo_, flap as flap_, let as let__ } from './Functor';\nimport * as _ from './internal';\nimport { separated } from './Separated';\nimport { wiltDefault, witherDefault } from './Witherable';\n// -------------------------------------------------------------------------------------\n// constructors\n// -------------------------------------------------------------------------------------\n/**\n * Constructs a new `Either` holding a `Left` value. This usually represents a failure, due to the right-bias of this\n * structure.\n *\n * @category constructors\n * @since 2.0.0\n */\nexport var left = _.left;\n/**\n * Constructs a new `Either` holding a `Right` value. This usually represents a successful value due to the right bias\n * of this structure.\n *\n * @category constructors\n * @since 2.0.0\n */\nexport var right = _.right;\n/**\n * @category sequencing\n * @since 2.14.0\n */\nexport var flatMap = /*#__PURE__*/ dual(2, function (ma, f) { return (isLeft(ma) ? ma : f(ma.right)); });\nvar _map = function (fa, f) { return pipe(fa, map(f)); };\nvar _ap = function (fab, fa) { return pipe(fab, ap(fa)); };\n/* istanbul ignore next */\nvar _reduce = function (fa, b, f) { return pipe(fa, reduce(b, f)); };\n/* istanbul ignore next */\nvar _foldMap = function (M) { return function (fa, f) {\n var foldMapM = foldMap(M);\n return pipe(fa, foldMapM(f));\n}; };\n/* istanbul ignore next */\nvar _reduceRight = function (fa, b, f) { return pipe(fa, reduceRight(b, f)); };\nvar _traverse = function (F) {\n var traverseF = traverse(F);\n return function (ta, f) { return pipe(ta, traverseF(f)); };\n};\nvar _bimap = function (fa, f, g) { return pipe(fa, bimap(f, g)); };\nvar _mapLeft = function (fa, f) { return pipe(fa, mapLeft(f)); };\n/* istanbul ignore next */\nvar _alt = function (fa, that) { return pipe(fa, alt(that)); };\n/* istanbul ignore next */\nvar _extend = function (wa, f) { return pipe(wa, extend(f)); };\nvar _chainRec = function (a, f) {\n return tailRec(f(a), function (e) {\n return isLeft(e) ? right(left(e.left)) : isLeft(e.right) ? left(f(e.right.left)) : right(right(e.right.right));\n });\n};\n/**\n * @category type lambdas\n * @since 2.0.0\n */\nexport var URI = 'Either';\n/**\n * @category instances\n * @since 2.0.0\n */\nexport var getShow = function (SE, SA) { return ({\n show: function (ma) { return (isLeft(ma) ? \"left(\".concat(SE.show(ma.left), \")\") : \"right(\".concat(SA.show(ma.right), \")\")); }\n}); };\n/**\n * @category instances\n * @since 2.0.0\n */\nexport var getEq = function (EL, EA) { return ({\n equals: function (x, y) {\n return x === y || (isLeft(x) ? isLeft(y) && EL.equals(x.left, y.left) : isRight(y) && EA.equals(x.right, y.right));\n }\n}); };\n/**\n * Semigroup returning the left-most non-`Left` value. If both operands are `Right`s then the inner values are\n * concatenated using the provided `Semigroup`\n *\n * @example\n * import { getSemigroup, left, right } from 'fp-ts/Either'\n * import { SemigroupSum } from 'fp-ts/number'\n *\n * const S = getSemigroup<string, number>(SemigroupSum)\n * assert.deepStrictEqual(S.concat(left('a'), left('b')), left('a'))\n * assert.deepStrictEqual(S.concat(left('a'), right(2)), right(2))\n * assert.deepStrictEqual(S.concat(right(1), left('b')), right(1))\n * assert.deepStrictEqual(S.concat(right(1), right(2)), right(3))\n *\n * @category instances\n * @since 2.0.0\n */\nexport var getSemigroup = function (S) { return ({\n concat: function (x, y) { return (isLeft(y) ? x : isLeft(x) ? y : right(S.concat(x.right, y.right))); }\n}); };\n/**\n * Builds a `Compactable` instance for `Either` given `Monoid` for the left side.\n *\n * @category filtering\n * @since 2.10.0\n */\nexport var getCompactable = function (M) {\n var empty = left(M.empty);\n return {\n URI: URI,\n _E: undefined,\n compact: function (ma) { return (isLeft(ma) ? ma : ma.right._tag === 'None' ? empty : right(ma.right.value)); },\n separate: function (ma) {\n return isLeft(ma)\n ? separated(ma, ma)\n : isLeft(ma.right)\n ? separated(right(ma.right.left), empty)\n : separated(empty, right(ma.right.right));\n }\n };\n};\n/**\n * Builds a `Filterable` instance for `Either` given `Monoid` for the left side\n *\n * @category filtering\n * @since 2.10.0\n */\nexport var getFilterable = function (M) {\n var empty = left(M.empty);\n var _a = getCompactable(M), compact = _a.compact, separate = _a.separate;\n var filter = function (ma, predicate) {\n return isLeft(ma) ? ma : predicate(ma.right) ? ma : empty;\n };\n var partition = function (ma, p) {\n return isLeft(ma)\n ? separated(ma, ma)\n : p(ma.right)\n ? separated(empty, right(ma.right))\n : separated(right(ma.right), empty);\n };\n return {\n URI: URI,\n _E: undefined,\n map: _map,\n compact: compact,\n separate: separate,\n filter: filter,\n filterMap: function (ma, f) {\n if (isLeft(ma)) {\n return ma;\n }\n var ob = f(ma.right);\n return ob._tag === 'None' ? empty : right(ob.value);\n },\n partition: partition,\n partitionMap: function (ma, f) {\n if (isLeft(ma)) {\n return separated(ma, ma);\n }\n var e = f(ma.right);\n return isLeft(e) ? separated(right(e.left), empty) : separated(empty, right(e.right));\n }\n };\n};\n/**\n * Builds `Witherable` instance for `Either` given `Monoid` for the left side\n *\n * @category filtering\n * @since 2.0.0\n */\nexport var getWitherable = function (M) {\n var F_ = getFilterable(M);\n var C = getCompactable(M);\n return {\n URI: URI,\n _E: undefined,\n map: _map,\n compact: F_.compact,\n separate: F_.separate,\n filter: F_.filter,\n filterMap: F_.filterMap,\n partition: F_.partition,\n partitionMap: F_.partitionMap,\n traverse: _traverse,\n sequence: sequence,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n wither: witherDefault(Traversable, C),\n wilt: wiltDefault(Traversable, C)\n };\n};\n/**\n * The default [`Applicative`](#applicative) instance returns the first error, if you want to\n * get all errors you need to provide a way to concatenate them via a `Semigroup`.\n *\n * @example\n * import * as A from 'fp-ts/Apply'\n * import * as E from 'fp-ts/Either'\n * import { pipe } from 'fp-ts/function'\n * import * as S from 'fp-ts/Semigroup'\n * import * as string from 'fp-ts/string'\n *\n * const parseString = (u: unknown): E.Either<string, string> =>\n * typeof u === 'string' ? E.right(u) : E.left('not a string')\n *\n * const parseNumber = (u: unknown): E.Either<string, number> =>\n * typeof u === 'number' ? E.right(u) : E.left('not a number')\n *\n * interface Person {\n * readonly name: string\n * readonly age: number\n * }\n *\n * const parsePerson = (\n * input: Record<string, unknown>\n * ): E.Either<string, Person> =>\n * pipe(\n * E.Do,\n * E.apS('name', parseString(input.name)),\n * E.apS('age', parseNumber(input.age))\n * )\n *\n * assert.deepStrictEqual(parsePerson({}), E.left('not a string')) // <= first error\n *\n * const Applicative = E.getApplicativeValidation(\n * pipe(string.Semigroup, S.intercalate(', '))\n * )\n *\n * const apS = A.apS(Applicative)\n *\n * const parsePersonAll = (\n * input: Record<string, unknown>\n * ): E.Either<string, Person> =>\n * pipe(\n * E.Do,\n * apS('name', parseString(input.name)),\n * apS('age', parseNumber(input.age))\n * )\n *\n * assert.deepStrictEqual(parsePersonAll({}), E.left('not a string, not a number')) // <= all errors\n *\n * @category error handling\n * @since 2.7.0\n */\nexport var getApplicativeValidation = function (SE) { return ({\n URI: URI,\n _E: undefined,\n map: _map,\n ap: function (fab, fa) {\n return isLeft(fab)\n ? isLeft(fa)\n ? left(SE.concat(fab.left, fa.left))\n : fab\n : isLeft(fa)\n ? fa\n : right(fab.right(fa.right));\n },\n of: of\n}); };\n/**\n * The default [`Alt`](#alt) instance returns the last error, if you want to\n * get all errors you need to provide a way to concatenate them via a `Semigroup`.\n *\n * @example\n * import * as E from 'fp-ts/Either'\n * import { pipe } from 'fp-ts/function'\n * import * as S from 'fp-ts/Semigroup'\n * import * as string from 'fp-ts/string'\n *\n * const parseString = (u: unknown): E.Either<string, string> =>\n * typeof u === 'string' ? E.right(u) : E.left('not a string')\n *\n * const parseNumber = (u: unknown): E.Either<string, number> =>\n * typeof u === 'number' ? E.right(u) : E.left('not a number')\n *\n * const parse = (u: unknown): E.Either<string, string | number> =>\n * pipe(\n * parseString(u),\n * E.alt<string, string | number>(() => parseNumber(u))\n * )\n *\n * assert.deepStrictEqual(parse(true), E.left('not a number')) // <= last error\n *\n * const Alt = E.getAltValidation(pipe(string.Semigroup, S.intercalate(', ')))\n *\n * const parseAll = (u: unknown): E.Either<string, string | number> =>\n * Alt.alt<string | number>(parseString(u), () => parseNumber(u))\n *\n * assert.deepStrictEqual(parseAll(true), E.left('not a string, not a number')) // <= all errors\n *\n * @category error handling\n * @since 2.7.0\n */\nexport var getAltValidation = function (SE) { return ({\n URI: URI,\n _E: undefined,\n map: _map,\n alt: function (me, that) {\n if (isRight(me)) {\n return me;\n }\n var ea = that();\n return isLeft(ea) ? left(SE.concat(me.left, ea.left)) : ea;\n }\n}); };\n/**\n * @category mapping\n * @since 2.0.0\n */\nexport var map = function (f) { return function (fa) {\n return isLeft(fa) ? fa : right(f(fa.right));\n}; };\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Functor = {\n URI: URI,\n map: _map\n};\n/**\n * Maps the `Right` value of this `Either` to the specified constant value.\n *\n * @category mapping\n * @since 2.16.0\n */\nexport var as = dual(2, as_(Functor));\n/**\n * Maps the `Right` value of this `Either` to the void constant value.\n *\n * @category mapping\n * @since 2.16.0\n */\nexport var asUnit = asUnit_(Functor);\n/**\n * @category constructors\n * @since 2.7.0\n */\nexport var of = right;\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Pointed = {\n URI: URI,\n of: of\n};\n/**\n * Less strict version of [`ap`](#ap).\n *\n * The `W` suffix (short for **W**idening) means that the error types will be merged.\n *\n * @since 2.8.0\n */\nexport var apW = function (fa) { return function (fab) {\n return isLeft(fab) ? fab : isLeft(fa) ? fa : right(fab.right(fa.right));\n}; };\n/**\n * @since 2.0.0\n */\nexport var ap = apW;\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Apply = {\n URI: URI,\n map: _map,\n ap: _ap\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Applicative = {\n URI: URI,\n map: _map,\n ap: _ap,\n of: of\n};\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Chain = {\n URI: URI,\n map: _map,\n ap: _ap,\n chain: flatMap\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Monad = {\n URI: URI,\n map: _map,\n ap: _ap,\n of: of,\n chain: flatMap\n};\n/**\n * Left-associative fold of a structure.\n *\n * @example\n * import { pipe } from 'fp-ts/function'\n * import * as E from 'fp-ts/Either'\n *\n * const startWith = 'prefix'\n * const concat = (a: string, b: string) => `${a}:${b}`\n *\n * assert.deepStrictEqual(\n * pipe(E.right('a'), E.reduce(startWith, concat)),\n * 'prefix:a'\n * )\n *\n * assert.deepStrictEqual(\n * pipe(E.left('e'), E.reduce(startWith, concat)),\n * 'prefix'\n * )\n *\n * @category folding\n * @since 2.0.0\n */\nexport var reduce = function (b, f) { return function (fa) {\n return isLeft(fa) ? b : f(b, fa.right);\n}; };\n/**\n * Map each element of the structure to a monoid, and combine the results.\n *\n * @example\n * import { pipe } from 'fp-ts/function'\n * import * as E from 'fp-ts/Either'\n * import * as S from 'fp-ts/string'\n *\n * const yell = (a: string) => `${a}!`\n *\n * assert.deepStrictEqual(\n * pipe(E.right('a'), E.foldMap(S.Monoid)(yell)),\n * 'a!'\n * )\n *\n * assert.deepStrictEqual(\n * pipe(E.left('e'), E.foldMap(S.Monoid)(yell)),\n * S.Monoid.empty\n * )\n *\n * @category folding\n * @since 2.0.0\n */\nexport var foldMap = function (M) { return function (f) { return function (fa) {\n return isLeft(fa) ? M.empty : f(fa.right);\n}; }; };\n/**\n * Right-associative fold of a structure.\n *\n * @example\n * import { pipe } from 'fp-ts/function'\n * import * as E from 'fp-ts/Either'\n *\n * const startWith = 'postfix'\n * const concat = (a: string, b: string) => `${a}:${b}`\n *\n * assert.deepStrictEqual(\n * pipe(E.right('a'), E.reduceRight(startWith, concat)),\n * 'a:postfix'\n * )\n *\n * assert.deepStrictEqual(\n * pipe(E.left('e'), E.reduceRight(startWith, concat)),\n * 'postfix'\n * )\n *\n * @category folding\n * @since 2.0.0\n */\nexport var reduceRight = function (b, f) { return function (fa) {\n return isLeft(fa) ? b : f(fa.right, b);\n}; };\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Foldable = {\n URI: URI,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight\n};\n/**\n * Map each element of a structure to an action, evaluate these actions from left to right, and collect the results.\n *\n * @example\n * import { pipe } from 'fp-ts/function'\n * import * as RA from 'fp-ts/ReadonlyArray'\n * import * as E from 'fp-ts/Either'\n * import * as O from 'fp-ts/Option'\n *\n * assert.deepStrictEqual(\n * pipe(E.right(['a']), E.traverse(O.Applicative)(RA.head)),\n * O.some(E.right('a'))\n * )\n *\n * assert.deepStrictEqual(\n * pipe(E.right([]), E.traverse(O.Applicative)(RA.head)),\n * O.none\n * )\n *\n * @category traversing\n * @since 2.6.3\n */\nexport var traverse = function (F) {\n return function (f) {\n return function (ta) {\n return isLeft(ta) ? F.of(left(ta.left)) : F.map(f(ta.right), right);\n };\n };\n};\n/**\n * Evaluate each monadic action in the structure from left to right, and collect the results.\n *\n * @example\n * import { pipe } from 'fp-ts/function'\n * import * as E from 'fp-ts/Either'\n * import * as O from 'fp-ts/Option'\n *\n * assert.deepStrictEqual(\n * pipe(E.right(O.some('a')), E.sequence(O.Applicative)),\n * O.some(E.right('a'))\n * )\n *\n * assert.deepStrictEqual(\n * pipe(E.right(O.none), E.sequence(O.Applicative)),\n * O.none\n * )\n *\n * @category traversing\n * @since 2.6.3\n */\nexport var sequence = function (F) {\n return function (ma) {\n return isLeft(ma) ? F.of(left(ma.left)) : F.map(ma.right, right);\n };\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Traversable = {\n URI: URI,\n map: _map,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n traverse: _traverse,\n sequence: sequence\n};\n/**\n * Map a pair of functions over the two type arguments of the bifunctor.\n *\n * @category mapping\n * @since 2.0.0\n */\nexport var bimap = function (f, g) { return function (fa) {\n return isLeft(fa) ? left(f(fa.left)) : right(g(fa.right));\n}; };\n/**\n * Map a function over the first type argument of a bifunctor.\n *\n * @category error handling\n * @since 2.0.0\n */\nexport var mapLeft = function (f) { return function (fa) {\n return isLeft(fa) ? left(f(fa.left)) : fa;\n}; };\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Bifunctor = {\n URI: URI,\n bimap: _bimap,\n mapLeft: _mapLeft\n};\n/**\n * Less strict version of [`alt`](#alt).\n *\n * The `W` suffix (short for **W**idening) means that the error and the return types will be merged.\n *\n * @category error handling\n * @since 2.9.0\n */\nexport var altW = function (that) { return function (fa) {\n return isLeft(fa) ? that() : fa;\n}; };\n/**\n * Identifies an associative operation on a type constructor. It is similar to `Semigroup`, except that it applies to\n * types of kind `* -> *`.\n *\n * In case of `Either` returns the left-most non-`Left` value (or the right-most `Left` value if both values are `Left`).\n *\n * | x | y | pipe(x, alt(() => y) |\n * | -------- | -------- | -------------------- |\n * | left(a) | left(b) | left(b) |\n * | left(a) | right(2) | right(2) |\n * | right(1) | left(b) | right(1) |\n * | right(1) | right(2) | right(1) |\n *\n * @example\n * import * as E from 'fp-ts/Either'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(\n * pipe(\n * E.left('a'),\n * E.alt(() => E.left('b'))\n * ),\n * E.left('b')\n * )\n * assert.deepStrictEqual(\n * pipe(\n * E.left('a'),\n * E.alt(() => E.right(2))\n * ),\n * E.right(2)\n * )\n * assert.deepStrictEqual(\n * pipe(\n * E.right(1),\n * E.alt(() => E.left('b'))\n * ),\n * E.right(1)\n * )\n * assert.deepStrictEqual(\n * pipe(\n * E.right(1),\n * E.alt(() => E.right(2))\n * ),\n * E.right(1)\n * )\n *\n * @category error handling\n * @since 2.0.0\n */\nexport var alt = altW;\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Alt = {\n URI: URI,\n map: _map,\n alt: _alt\n};\n/**\n * @since 2.0.0\n */\nexport var extend = function (f) { return function (wa) {\n return isLeft(wa) ? wa : right(f(wa));\n}; };\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Extend = {\n URI: URI,\n map: _map,\n extend: _extend\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var ChainRec = {\n URI: URI,\n map: _map,\n ap: _ap,\n chain: flatMap,\n chainRec: _chainRec\n};\n/**\n * @since 2.6.3\n */\nexport var throwError = left;\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var MonadThrow = {\n URI: URI,\n map: _map,\n ap: _ap,\n of: of,\n chain: flatMap,\n throwError: throwError\n};\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var FromEither = {\n URI: URI,\n fromEither: identity\n};\n/**\n * @example\n * import { fromPredicate, left, right } from 'fp-ts/Either'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(\n * pipe(\n * 1,\n * fromPredicate(\n * (n) => n > 0,\n * () => 'error'\n * )\n * ),\n * right(1)\n * )\n * assert.deepStrictEqual(\n * pipe(\n * -1,\n * fromPredicate(\n * (n) => n > 0,\n * () => 'error'\n * )\n * ),\n * left('error')\n * )\n *\n * @category lifting\n * @since 2.0.0\n */\nexport var fromPredicate = /*#__PURE__*/ fromPredicate_(FromEither);\n// -------------------------------------------------------------------------------------\n// conversions\n// -------------------------------------------------------------------------------------\n/**\n * @example\n * import * as E from 'fp-ts/Either'\n * import { pipe } from 'fp-ts/function'\n * import * as O from 'fp-ts/Option'\n *\n * assert.deepStrictEqual(\n * pipe(\n * O.some(1),\n * E.fromOption(() => 'error')\n * ),\n * E.right(1)\n * )\n * assert.deepStrictEqual(\n * pipe(\n * O.none,\n * E.fromOption(() => 'error')\n * ),\n * E.left('error')\n * )\n *\n * @category conversions\n * @since 2.0.0\n */\nexport var fromOption = \n/*#__PURE__*/ fromOption_(FromEither);\n// -------------------------------------------------------------------------------------\n// refinements\n// -------------------------------------------------------------------------------------\n/**\n * Returns `true` if the either is an instance of `Left`, `false` otherwise.\n *\n * @category refinements\n * @since 2.0.0\n */\nexport var isLeft = _.isLeft;\n/**\n * Returns `true` if the either is an instance of `Right`, `false` otherwise.\n *\n * @category refinements\n * @since 2.0.0\n */\nexport var isRight = _.isRight;\n/**\n * Less strict version of [`match`](#match).\n *\n * The `W` suffix (short for **W**idening) means that the handler return types will be merged.\n *\n * @category pattern matching\n * @since 2.10.0\n */\nexport var matchW = function (onLeft, onRight) {\n return function (ma) {\n return isLeft(ma) ? onLeft(ma.left) : onRight(ma.right);\n };\n};\n/**\n * Alias of [`matchW`](#matchw).\n *\n * @category pattern matching\n * @since 2.10.0\n */\nexport var foldW = matchW;\n/**\n * Takes two functions and an `Either` value, if the value is a `Left` the inner value is applied to the first function,\n * if the value is a `Right` the inner value is applied to the second function.\n *\n * @example\n * import { match, left, right } from 'fp-ts/Either'\n * import { pipe } from 'fp-ts/function'\n *\n * function onLeft(errors: Array<string>): string {\n * return `Errors: ${errors.join(', ')}`\n * }\n *\n * function onRight(value: number): string {\n * return `Ok: ${value}`\n * }\n *\n * assert.strictEqual(\n * pipe(\n * right(1),\n * match(onLeft, onRight)\n * ),\n * 'Ok: 1'\n * )\n * assert.strictEqual(\n * pipe(\n * left(['error 1', 'error 2']),\n * match(onLeft, onRight)\n * ),\n * 'Errors: error 1, error 2'\n * )\n *\n * @category pattern matching\n * @since 2.10.0\n */\nexport var match = matchW;\n/**\n * Alias of [`match`](#match).\n *\n * @category pattern matching\n * @since 2.0.0\n */\nexport var fold = match;\n/**\n * Less strict version of [`getOrElse`](#getorelse).\n *\n * The `W` suffix (short for **W**idening) means that the handler return type will be merged.\n *\n * @category error handling\n * @since 2.6.0\n */\nexport var getOrElseW = function (onLeft) {\n return function (ma) {\n return isLeft(ma) ? onLeft(ma.left) : ma.right;\n };\n};\n/**\n * Returns the wrapped value if it's a `Right` or a default value if is a `Left`.\n *\n * @example\n * import { getOrElse, left, right } from 'fp-ts/Either'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(\n * pipe(\n * right(1),\n * getOrElse(() => 0)\n * ),\n * 1\n * )\n * assert.deepStrictEqual(\n * pipe(\n * left('error'),\n * getOrElse(() => 0)\n * ),\n * 0\n * )\n *\n * @category error handling\n * @since 2.0.0\n */\nexport var getOrElse = getOrElseW;\n// -------------------------------------------------------------------------------------\n// combinators\n// -------------------------------------------------------------------------------------\n/**\n * @category mapping\n * @since 2.10.0\n */\nexport var flap = /*#__PURE__*/ flap_(Functor);\n/**\n * Combine two effectful actions, keeping only the result of the first.\n *\n * @since 2.0.0\n */\nexport var apFirst = /*#__PURE__*/ apFirst_(Apply);\n/**\n * Less strict version of [`apFirst`](#apfirst)\n *\n * The `W` suffix (short for **W**idening) means that the error types will be merged.\n *\n * @since 2.12.0\n */\nexport var apFirstW = apFirst;\n/**\n * Combine two effectful actions, keeping only the result of the second.\n *\n * @since 2.0.0\n */\nexport var apSecond = /*#__PURE__*/ apSecond_(Apply);\n/**\n * Less strict version of [`apSecond`](#apsecond)\n *\n * The `W` suffix (short for **W**idening) means that the error types will be merged.\n *\n * @since 2.12.0\n */\nexport var apSecondW = apSecond;\n/**\n * Composes computations in sequence, using the return value of one computation to determine the next computation and\n * keeping only the result of the first.\n *\n * @category combinators\n * @since 2.15.0\n */\nexport var tap = /*#__PURE__*/ dual(2, chainable.tap(Chain));\n/**\n * Less strict version of [`flatten`](#flatten).\n *\n * The `W` suffix (short for **W**idening) means that the error types will be merged.\n *\n * @category sequencing\n * @since 2.11.0\n */\nexport var flattenW = \n/*#__PURE__*/ flatMap(identity);\n/**\n * The `flatten` function is the conventional monad join operator. It is used to remove one level of monadic structure, projecting its bound argument into the outer level.\n *\n * @example\n * import * as E from 'fp-ts/Either'\n *\n * assert.deepStrictEqual(E.flatten(E.right(E.right('a'))), E.right('a'))\n * assert.deepStrictEqual(E.flatten(E.right(E.left('e'))), E.left('e'))\n * assert.deepStrictEqual(E.flatten(E.left('e')), E.left('e'))\n *\n * @category sequencing\n * @since 2.0.0\n */\nexport var flatten = flattenW;\n/**\n * @since 2.0.0\n */\nexport var duplicate = /*#__PURE__*/ extend(identity);\n/**\n * Use `liftOption`.\n *\n * @category legacy\n * @since 2.10.0\n */\nexport var fromOptionK = \n/*#__PURE__*/ fromOptionK_(FromEither);\n/**\n * Use `flatMapOption`.\n *\n * @category legacy\n * @since 2.11.0\n */\nexport var chainOptionK = /*#__PURE__*/ chainOptionK_(FromEither, Chain);\n/**\n * Use `flatMapOption`.\n *\n * @category legacy\n * @since 2.13.2\n */\nexport var chainOptionKW = chainOptionK;\n/** @internal */\nvar _FromEither = {\n fromEither: FromEither.fromEither\n};\n/**\n * @category lifting\n * @since 2.15.0\n */\nexport var liftNullable = /*#__PURE__*/ _.liftNullable(_FromEither);\n/**\n * @category lifting\n * @since 2.15.0\n */\nexport var liftOption = /*#__PURE__*/ _.liftOption(_FromEither);\n/** @internal */\nvar _FlatMap = {\n flatMap: flatMap\n};\n/**\n * @category sequencing\n * @since 2.15.0\n */\nexport var flatMapNullable = /*#__PURE__*/ _.flatMapNullable(_FromEither, _FlatMap);\n/**\n * @category sequencing\n * @since 2.15.0\n */\nexport var flatMapOption = /*#__PURE__*/ _.flatMapOption(_FromEither, _FlatMap);\n/**\n * @example\n * import * as E from 'fp-ts/Either'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(\n * pipe(\n * E.right(1),\n * E.filterOrElse(\n * (n) => n > 0,\n * () => 'error'\n * )\n * ),\n * E.right(1)\n * )\n * assert.deepStrictEqual(\n * pipe(\n * E.right(-1),\n * E.filterOrElse(\n * (n) => n > 0,\n * () => 'error'\n * )\n * ),\n * E.left('error')\n * )\n * assert.deepStrictEqual(\n * pipe(\n * E.left('a'),\n * E.filterOrElse(\n * (n) => n > 0,\n * () => 'error'\n * )\n * ),\n * E.left('a')\n * )\n *\n * @category filtering\n * @since 2.0.0\n */\nexport var filterOrElse = /*#__PURE__*/ filterOrElse_(FromEither, Chain);\n/**\n * Less strict version of [`filterOrElse`](#filterorelse).\n *\n * The `W` suffix (short for **W**idening) means that the error types will be merged.\n *\n * @category filtering\n * @since 2.9.0\n */\nexport var filterOrElseW = filterOrElse;\n/**\n * Returns a `Right` if is a `Left` (and vice versa).\n *\n * @since 2.0.0\n */\nexport var swap = function (ma) { return (isLeft(ma) ? right(ma.left) : left(ma.right)); };\n/**\n * Less strict version of [`orElse`](#orelse).\n *\n * The `W` suffix (short for **W**idening) means that the return types will be merged.\n *\n * @category error handling\n * @since 2.10.0\n */\nexport var orElseW = function (onLeft) {\n return function (ma) {\n return isLeft(ma) ? onLeft(ma.left) : ma;\n };\n};\n/**\n * Useful for recovering from errors.\n *\n * @category error handling\n * @since 2.0.0\n */\nexport var orElse = orElseW;\n/**\n * Takes a default and a nullable value, if the value is not nully, turn it into a `Right`, if the value is nully use\n * the provided default as a `Left`.\n *\n * @example\n * import { fromNullable, left, right } from 'fp-ts/Either'\n *\n * const parse = fromNullable('nully')\n *\n * assert.deepStrictEqual(parse(1), right(1))\n * assert.deepStrictEqual(parse(null), left('nully'))\n *\n * @category conversions\n * @since 2.0.0\n */\nexport var fromNullable = function (e) {\n return function (a) {\n return a == null ? left(e) : right(a);\n };\n};\n/**\n * Constructs a new `Either` from a function that might throw.\n *\n * See also [`tryCatchK`](#trycatchk).\n *\n * @example\n * import * as E from 'fp-ts/Either'\n *\n * const unsafeHead = <A>(as: ReadonlyArray<A>): A => {\n * if (as.length > 0) {\n * return as[0]\n * } else {\n * throw new Error('empty array')\n * }\n * }\n *\n * const head = <A>(as: ReadonlyArray<A>): E.Either<Error, A> =>\n * E.tryCatch(() => unsafeHead(as), e => (e instanceof Error ? e : new Error('unknown error')))\n *\n * assert.deepStrictEqual(head([]), E.left(new Error('empty array')))\n * assert.deepStrictEqual(head([1, 2, 3]), E.right(1))\n *\n * @category interop\n * @since 2.0.0\n */\nexport var tryCatch = function (f, onThrow) {\n try {\n return right(f());\n }\n catch (e) {\n return left(onThrow(e));\n }\n};\n/**\n * Converts a function that may throw to one returning a `Either`.\n *\n * @category interop\n * @since 2.10.0\n */\nexport var tryCatchK = function (f, onThrow) {\n return function () {\n var a = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n a[_i] = arguments[_i];\n }\n return tryCatch(function () { return f.apply(void 0, a); }, onThrow);\n };\n};\n/**\n * Use `liftNullable`.\n *\n * @category legacy\n * @since 2.9.0\n */\nexport var fromNullableK = function (e) {\n var from = fromNullable(e);\n return function (f) { return flow(f, from); };\n};\n/**\n * Use `flatMapNullable`.\n *\n * @category legacy\n * @since 2.9.0\n */\nexport var chainNullableK = function (e) {\n var from = fromNullableK(e);\n return function (f) { return flatMap(from(f)); };\n};\n/**\n * @category conversions\n * @since 2.10.0\n */\nexport var toUnion = /*#__PURE__*/ foldW(identity, identity);\n// -------------------------------------------------------------------------------------\n// utils\n// -------------------------------------------------------------------------------------\n/**\n * Default value for the `onError` argument of `tryCatch`\n *\n * @since 2.0.0\n */\nexport function toError(e) {\n try {\n return e instanceof Error ? e : new Error(String(e));\n }\n catch (error) {\n return new Error();\n }\n}\nexport function elem(E) {\n return function (a, ma) {\n if (ma === undefined) {\n var elemE_1 = elem(E);\n return function (ma) { return elemE_1(a, ma); };\n }\n return isLeft(ma) ? false : E.equals(a, ma.right);\n };\n}\n/**\n * Returns `false` if `Left` or returns the result of the application of the given predicate to the `Right` value.\n *\n * @example\n * import { exists, left, right } from 'fp-ts/Either'\n *\n * const gt2 = exists((n: number) => n > 2)\n *\n * assert.strictEqual(gt2(left('a')), false)\n * assert.strictEqual(gt2(right(1)), false)\n * assert.strictEqual(gt2(right(3)), true)\n *\n * @since 2.0.0\n */\nexport var exists = function (predicate) {\n return function (ma) {\n return isLeft(ma) ? false : predicate(ma.right);\n };\n};\n// -------------------------------------------------------------------------------------\n// do notation\n// -------------------------------------------------------------------------------------\n/**\n * @category do notation\n * @since 2.9.0\n */\nexport var Do = /*#__PURE__*/ of(_.emptyRecord);\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var bindTo = /*#__PURE__*/ bindTo_(Functor);\nvar let_ = /*#__PURE__*/ let__(Functor);\nexport { \n/**\n * @category do notation\n * @since 2.13.0\n */\nlet_ as let };\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var bind = /*#__PURE__*/ chainable.bind(Chain);\n/**\n * The `W` suffix (short for **W**idening) means that the error types will be merged.\n *\n * @category do notation\n * @since 2.8.0\n */\nexport var bindW = bind;\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var apS = /*#__PURE__*/ apS_(Apply);\n/**\n * Less strict version of [`apS`](#aps).\n *\n * The `W` suffix (short for **W**idening) means that the error types will be merged.\n *\n * @category do notation\n * @since 2.8.0\n */\nexport var apSW = apS;\n/**\n * @since 2.11.0\n */\nexport var ApT = /*#__PURE__*/ of(_.emptyReadonlyArray);\n// -------------------------------------------------------------------------------------\n// array utils\n// -------------------------------------------------------------------------------------\n/**\n * Equivalent to `ReadonlyNonEmptyArray#traverseWithIndex(Applicative)`.\n *\n * @category traversing\n * @since 2.11.0\n */\nexport var traverseReadonlyNonEmptyArrayWithIndex = function (f) {\n return function (as) {\n var e = f(0, _.head(as));\n if (isLeft(e)) {\n return e;\n }\n var out = [e.right];\n for (var i = 1; i < as.length; i++) {\n var e_1 = f(i, as[i]);\n if (isLeft(e_1)) {\n return e_1;\n }\n out.push(e_1.right);\n }\n return right(out);\n };\n};\n/**\n * Equivalent to `ReadonlyArray#traverseWithIndex(Applicative)`.\n *\n * @category traversing\n * @since 2.11.0\n */\nexport var traverseReadonlyArrayWithIndex = function (f) {\n var g = traverseReadonlyNonEmptyArrayWithIndex(f);\n return function (as) { return (_.isNonEmpty(as) ? g(as) : ApT); };\n};\n/**\n * Equivalent to `ReadonlyArray#traverseWithIndex(Applicative)`.\n *\n * @category traversing\n * @since 2.9.0\n */\nexport var traverseArrayWithIndex = traverseReadonlyArrayWithIndex;\n/**\n * Equivalent to `ReadonlyArray#traverse(Applicative)`.\n *\n * @category traversing\n * @since 2.9.0\n */\nexport var traverseArray = function (f) { return traverseReadonlyArrayWithIndex(function (_, a) { return f(a); }); };\n/**\n * Equivalent to `ReadonlyArray#sequence(Applicative)`.\n *\n * @category traversing\n * @since 2.9.0\n */\nexport var sequenceArray = \n/*#__PURE__*/ traverseArray(identity);\n// -------------------------------------------------------------------------------------\n// legacy\n// -------------------------------------------------------------------------------------\n/**\n * Alias of `flatMap`.\n *\n * @category legacy\n * @since 2.6.0\n */\nexport var chainW = flatMap;\n/**\n * Alias of `flatMap`.\n *\n * @category legacy\n * @since 2.0.0\n */\nexport var chain = flatMap;\n/**\n * Alias of `tap`.\n *\n * @category legacy\n * @since 2.0.0\n */\nexport var chainFirst = tap;\n/**\n * Alias of `tap`.\n *\n * @category legacy\n * @since 2.8.0\n */\nexport var chainFirstW = tap;\n/**\n * Use [`parse`](./Json.ts.html#parse) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport function parseJSON(s, onError) {\n return tryCatch(function () { return JSON.parse(s); }, onError);\n}\n/**\n * Use [`stringify`](./Json.ts.html#stringify) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var stringifyJSON = function (u, onError) {\n return tryCatch(function () {\n var s = JSON.stringify(u);\n if (typeof s !== 'string') {\n throw new Error('Converting unsupported structure to JSON');\n }\n return s;\n }, onError);\n};\n/**\n * This instance is deprecated, use small, specific instances instead.\n * For example if a function needs a `Functor` instance, pass `E.Functor` instead of `E.either`\n * (where `E` is from `import E from 'fp-ts/Either'`)\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var either = {\n URI: URI,\n map: _map,\n of: of,\n ap: _ap,\n chain: flatMap,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n traverse: _traverse,\n sequence: sequence,\n bimap: _bimap,\n mapLeft: _mapLeft,\n alt: _alt,\n extend: _extend,\n chainRec: _chainRec,\n throwError: throwError\n};\n/**\n * Use [`getApplySemigroup`](./Apply.ts.html#getapplysemigroup) instead.\n *\n * Semigroup returning the left-most `Left` value. If both operands are `Right`s then the inner values\n * are concatenated using the provided `Semigroup`\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var getApplySemigroup = \n/*#__PURE__*/ getApplySemigroup_(Apply);\n/**\n * Use [`getApplicativeMonoid`](./Applicative.ts.html#getapplicativemonoid) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var getApplyMonoid = \n/*#__PURE__*/ getApplicativeMonoid(Applicative);\n/**\n * Use [`getApplySemigroup`](./Apply.ts.html#getapplysemigroup) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var getValidationSemigroup = function (SE, SA) {\n return getApplySemigroup_(getApplicativeValidation(SE))(SA);\n};\n/**\n * Use [`getApplicativeMonoid`](./Applicative.ts.html#getapplicativemonoid) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var getValidationMonoid = function (SE, MA) {\n return getApplicativeMonoid(getApplicativeValidation(SE))(MA);\n};\n/**\n * Use [`getApplicativeValidation`](#getapplicativevalidation) and [`getAltValidation`](#getaltvalidation) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport function getValidation(SE) {\n var ap = getApplicativeValidation(SE).ap;\n var alt = getAltValidation(SE).alt;\n return {\n URI: URI,\n _E: undefined,\n map: _map,\n of: of,\n chain: flatMap,\n bimap: _bimap,\n mapLeft: _mapLeft,\n reduce: _reduce,\n foldMap: _foldMap,\n reduceRight: _reduceRight,\n extend: _extend,\n traverse: _traverse,\n sequence: sequence,\n chainRec: _chainRec,\n throwError: throwError,\n ap: ap,\n alt: alt\n };\n}\n","import { ap as ap_ } from './Apply';\nimport * as E from './Either';\nimport { flow, pipe } from './function';\nimport { map as map_ } from './Functor';\nexport function right(F) {\n return flow(E.right, F.of);\n}\nexport function left(F) {\n return flow(E.left, F.of);\n}\nexport function rightF(F) {\n return function (fa) { return F.map(fa, E.right); };\n}\nexport function leftF(F) {\n return function (fe) { return F.map(fe, E.left); };\n}\nexport function fromNullable(F) {\n return function (e) { return flow(E.fromNullable(e), F.of); };\n}\nexport function fromNullableK(F) {\n var fromNullableF = fromNullable(F);\n return function (e) {\n var fromNullableFE = fromNullableF(e);\n return function (f) { return flow(f, fromNullableFE); };\n };\n}\nexport function chainNullableK(M) {\n var chainM = chain(M);\n var fromNullableKM = fromNullableK(M);\n return function (e) {\n var fromNullableKMe = fromNullableKM(e);\n return function (f) { return chainM(fromNullableKMe(f)); };\n };\n}\nexport function map(F) {\n return map_(F, E.Functor);\n}\nexport function ap(F) {\n return ap_(F, E.Apply);\n}\nexport function chain(M) {\n var flatMapM = flatMap(M);\n return function (f) { return function (ma) { return flatMapM(ma, f); }; };\n}\n/** @internal */\nexport function flatMap(M) {\n return function (ma, f) { return M.chain(ma, function (e) { return (E.isLeft(e) ? M.of(e) : f(e.right)); }); };\n}\nexport function alt(M) {\n return function (second) { return function (first) { return M.chain(first, function (e) { return (E.isLeft(e) ? second() : M.of(e)); }); }; };\n}\nexport function bimap(F) {\n var mapBothF = mapBoth(F);\n return function (f, g) { return function (self) { return mapBothF(self, f, g); }; };\n}\n/** @internal */\nexport function mapBoth(F) {\n return function (self, f, g) { return F.map(self, E.bimap(f, g)); };\n}\nexport function mapLeft(F) {\n var mapErrorF = mapError(F);\n return function (f) { return function (self) { return mapErrorF(self, f); }; };\n}\n/** @internal */\nexport function mapError(F) {\n return function (self, f) { return F.map(self, E.mapLeft(f)); };\n}\nexport function altValidation(M, S) {\n return function (second) { return function (first) {\n return M.chain(first, E.match(function (e1) {\n return M.map(second(), E.mapLeft(function (e2) { return S.concat(e1, e2); }));\n }, right(M)));\n }; };\n}\nexport function match(F) {\n return function (onLeft, onRight) { return function (ma) { return F.map(ma, E.match(onLeft, onRight)); }; };\n}\nexport function matchE(M) {\n return function (onLeft, onRight) { return function (ma) { return M.chain(ma, E.match(onLeft, onRight)); }; };\n}\nexport function getOrElse(M) {\n return function (onLeft) { return function (ma) { return M.chain(ma, E.match(onLeft, M.of)); }; };\n}\nexport function orElse(M) {\n return function (onLeft) { return function (ma) { return M.chain(ma, function (e) { return (E.isLeft(e) ? onLeft(e.left) : M.of(e)); }); }; };\n}\nexport function orElseFirst(M) {\n var tapErrorM = tapError(M);\n return function (onLeft) { return function (ma) { return tapErrorM(ma, onLeft); }; };\n}\n/** @internal */\nexport function tapError(M) {\n var orElseM = orElse(M);\n return function (ma, onLeft) {\n return pipe(ma, orElseM(function (e) { return M.map(onLeft(e), function (eb) { return (E.isLeft(eb) ? eb : E.left(e)); }); }));\n };\n}\nexport function orLeft(M) {\n return function (onLeft) { return function (ma) {\n return M.chain(ma, E.match(function (e) { return M.map(onLeft(e), E.left); }, function (a) { return M.of(E.right(a)); }));\n }; };\n}\nexport function swap(F) {\n return function (ma) { return F.map(ma, E.swap); };\n}\nexport function toUnion(F) {\n return function (fa) { return F.map(fa, E.toUnion); };\n}\n/** @deprecated */\n/* istanbul ignore next */\nexport function getEitherM(M) {\n var _ap = ap(M);\n var _map = map(M);\n var _chain = chain(M);\n var _alt = alt(M);\n var _bimap = bimap(M);\n var _mapLeft = mapLeft(M);\n var _fold = matchE(M);\n var _getOrElse = getOrElse(M);\n var _orElse = orElse(M);\n return {\n map: function (fa, f) { return pipe(fa, _map(f)); },\n ap: function (fab, fa) { return pipe(fab, _ap(fa)); },\n of: right(M),\n chain: function (ma, f) { return pipe(ma, _chain(f)); },\n alt: function (fa, that) { return pipe(fa, _alt(that)); },\n bimap: function (fea, f, g) { return pipe(fea, _bimap(f, g)); },\n mapLeft: function (fea, f) { return pipe(fea, _mapLeft(f)); },\n fold: function (fa, onLeft, onRight) { return pipe(fa, _fold(onLeft, onRight)); },\n getOrElse: function (fa, onLeft) { return pipe(fa, _getOrElse(onLeft)); },\n orElse: function (fa, f) { return pipe(fa, _orElse(f)); },\n swap: swap(M),\n rightM: rightF(M),\n leftM: leftF(M),\n left: left(M)\n };\n}\n","/**\n * @since 2.10.0\n */\nimport { tryCatch } from './Either';\nimport { identity } from './function';\n/**\n * Converts a JavaScript Object Notation (JSON) string into a `Json` type.\n *\n * @example\n * import * as J from 'fp-ts/Json'\n * import * as E from 'fp-ts/Either'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(pipe('{\"a\":1}', J.parse), E.right({ a: 1 }))\n * assert.deepStrictEqual(pipe('{\"a\":}', J.parse), E.left(new SyntaxError(`Unexpected token '}', \"{\"a\":}\" is not valid JSON`)))\n *\n * @since 2.10.0\n */\nexport var parse = function (s) { return tryCatch(function () { return JSON.parse(s); }, identity); };\n/**\n * Converts a JavaScript value to a JavaScript Object Notation (JSON) string.\n *\n * @example\n * import * as E from 'fp-ts/Either'\n * import * as J from 'fp-ts/Json'\n * import { pipe } from 'fp-ts/function'\n *\n * assert.deepStrictEqual(J.stringify({ a: 1 }), E.right('{\"a\":1}'))\n * const circular: any = { ref: null }\n * circular.ref = circular\n * assert.deepStrictEqual(\n * pipe(\n * J.stringify(circular),\n * E.mapLeft(e => e instanceof Error && e.message.includes('Converting circular structure to JSON'))\n * ),\n * E.left(true)\n * )\n *\n * @since 2.10.0\n */\nexport var stringify = function (a) {\n return tryCatch(function () {\n var s = JSON.stringify(a);\n if (typeof s !== 'string') {\n throw new Error('Converting unsupported structure to JSON');\n }\n return s;\n }, identity);\n};\n","/**\n * ```ts\n * interface Task<A> {\n * (): Promise<A>\n * }\n * ```\n *\n * `Task<A>` represents an asynchronous computation that yields a value of type `A` and **never fails**.\n * If you want to represent an asynchronous computation that may fail, please see `TaskEither`.\n *\n * @since 2.0.0\n */\nimport { getApplicativeMonoid } from './Applicative';\nimport { apFirst as apFirst_, apS as apS_, apSecond as apSecond_, getApplySemigroup as getApplySemigroup_ } from './Apply';\nimport * as chainable from './Chain';\nimport { fromIOK as fromIOK_, tapIO as tapIO_ } from './FromIO';\nimport { dual, identity, pipe } from './function';\nimport { as as as_, asUnit as asUnit_, bindTo as bindTo_, flap as flap_, let as let__ } from './Functor';\nimport * as _ from './internal';\n// -------------------------------------------------------------------------------------\n// conversions\n// -------------------------------------------------------------------------------------\n/**\n * @category conversions\n * @since 2.0.0\n */\nexport var fromIO = function (ma) { return function () { return Promise.resolve().then(ma); }; };\n// -------------------------------------------------------------------------------------\n// combinators\n// -------------------------------------------------------------------------------------\n/**\n * Creates a task that will complete after a time delay\n *\n * @example\n * import { sequenceT } from 'fp-ts/Apply'\n * import * as T from 'fp-ts/Task'\n * import { takeRight } from 'fp-ts/Array'\n *\n * async function test() {\n * const log: Array<string> = []\n * const append = (message: string): T.Task<void> =>\n * T.fromIO(() => {\n * log.push(message)\n * })\n * const fa = append('a')\n * const fb = T.delay(20)(append('b'))\n * const fc = T.delay(10)(append('c'))\n * const fd = append('d')\n * await sequenceT(T.ApplyPar)(fa, fb, fc, fd)()\n * assert.deepStrictEqual(takeRight(2)(log), ['c', 'b'])\n * }\n *\n * test()\n *\n * @since 2.0.0\n */\nexport function delay(millis) {\n return function (ma) { return function () {\n return new Promise(function (resolve) {\n setTimeout(function () {\n Promise.resolve().then(ma).then(resolve);\n }, millis);\n });\n }; };\n}\nvar _map = function (fa, f) { return pipe(fa, map(f)); };\nvar _apPar = function (fab, fa) { return pipe(fab, ap(fa)); };\nvar _apSeq = function (fab, fa) { return flatMap(fab, function (f) { return pipe(fa, map(f)); }); };\n/**\n * `map` can be used to turn functions `(a: A) => B` into functions `(fa: F<A>) => F<B>` whose argument and return types\n * use the type constructor `F` to represent some computational context.\n *\n * @category mapping\n * @since 2.0.0\n */\nexport var map = function (f) { return function (fa) { return function () {\n return Promise.resolve().then(fa).then(f);\n}; }; };\n/**\n * @since 2.0.0\n */\nexport var ap = function (fa) { return function (fab) { return function () {\n return Promise.all([Promise.resolve().then(fab), Promise.resolve().then(fa)]).then(function (_a) {\n var f = _a[0], a = _a[1];\n return f(a);\n });\n}; }; };\n/**\n * @category constructors\n * @since 2.0.0\n */\nexport var of = function (a) { return function () { return Promise.resolve(a); }; };\n/**\n * @category sequencing\n * @since 2.14.0\n */\nexport var flatMap = /*#__PURE__*/ dual(2, function (ma, f) {\n return function () {\n return Promise.resolve()\n .then(ma)\n .then(function (a) { return f(a)(); });\n };\n});\n/**\n * @category sequencing\n * @since 2.0.0\n */\nexport var flatten = /*#__PURE__*/ flatMap(identity);\n/**\n * @category type lambdas\n * @since 2.0.0\n */\nexport var URI = 'Task';\n/**\n * Monoid returning the first completed task.\n *\n * Note: uses `Promise.race` internally.\n *\n * @example\n * import * as T from 'fp-ts/Task'\n *\n * async function test() {\n * const S = T.getRaceMonoid<string>()\n * const fa = T.delay(20)(T.of('a'))\n * const fb = T.delay(10)(T.of('b'))\n * assert.deepStrictEqual(await S.concat(fa, fb)(), 'b')\n * }\n *\n * test()\n *\n * @category instances\n * @since 2.0.0\n */\nexport function getRaceMonoid() {\n return {\n concat: function (x, y) { return function () { return Promise.race([Promise.resolve().then(x), Promise.resolve().then(y)]); }; },\n empty: never\n };\n}\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Functor = {\n URI: URI,\n map: _map\n};\n/**\n * Maps the value to the specified constant value.\n *\n * @category mapping\n * @since 2.16.0\n */\nexport var as = dual(2, as_(Functor));\n/**\n * Maps the value to the void constant value.\n *\n * @category mapping\n * @since 2.16.0\n */\nexport var asUnit = asUnit_(Functor);\n/**\n * @category mapping\n * @since 2.10.0\n */\nexport var flap = /*#__PURE__*/ flap_(Functor);\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Pointed = {\n URI: URI,\n of: of\n};\n/**\n * Runs computations in parallel.\n *\n * @category instances\n * @since 2.10.0\n */\nexport var ApplyPar = {\n URI: URI,\n map: _map,\n ap: _apPar\n};\n/**\n * Combine two effectful actions, keeping only the result of the first.\n *\n * @since 2.0.0\n */\nexport var apFirst = /*#__PURE__*/ apFirst_(ApplyPar);\n/**\n * Combine two effectful actions, keeping only the result of the second.\n *\n * @since 2.0.0\n */\nexport var apSecond = /*#__PURE__*/ apSecond_(ApplyPar);\n/**\n * Runs computations in parallel.\n *\n * @category instances\n * @since 2.7.0\n */\nexport var ApplicativePar = {\n URI: URI,\n map: _map,\n ap: _apPar,\n of: of\n};\n/**\n * Runs computations sequentially.\n *\n * @category instances\n * @since 2.10.0\n */\nexport var ApplySeq = {\n URI: URI,\n map: _map,\n ap: _apSeq\n};\n/**\n * Runs computations sequentially.\n *\n * @category instances\n * @since 2.7.0\n */\nexport var ApplicativeSeq = {\n URI: URI,\n map: _map,\n ap: _apSeq,\n of: of\n};\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Chain = {\n URI: URI,\n map: _map,\n ap: _apPar,\n chain: flatMap\n};\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Monad = {\n URI: URI,\n map: _map,\n of: of,\n ap: _apPar,\n chain: flatMap\n};\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var MonadIO = {\n URI: URI,\n map: _map,\n of: of,\n ap: _apPar,\n chain: flatMap,\n fromIO: fromIO\n};\n/**\n * @category zone of death\n * @since 2.7.0\n * @deprecated\n */\nexport var fromTask = identity;\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var MonadTask = {\n URI: URI,\n map: _map,\n of: of,\n ap: _apPar,\n chain: flatMap,\n fromIO: fromIO,\n fromTask: fromTask\n};\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var FromIO = {\n URI: URI,\n fromIO: fromIO\n};\n/** @internal */\nvar _FlatMap = {\n flatMap: flatMap\n};\n/** @internal */\nvar _FromIO = {\n fromIO: FromIO.fromIO\n};\n/**\n * @category sequencing\n * @since 2.16.0\n */\nexport var flatMapIO = _.flatMapIO(_FromIO, _FlatMap);\n/**\n * Composes computations in sequence, using the return value of one computation to determine the next computation and\n * keeping only the result of the first.\n *\n * @category combinators\n * @since 2.15.0\n */\nexport var tap = /*#__PURE__*/ dual(2, chainable.tap(Chain));\n/**\n * Composes computations in sequence, using the return value of one computation to determine the next computation and\n * keeping only the result of the first.\n *\n * @example\n * import { pipe } from 'fp-ts/function'\n * import * as T from 'fp-ts/Task'\n * import * as Console from 'fp-ts/Console'\n *\n * // Will produce `Hello, fp-ts` to the stdout\n * const effect = pipe(\n * T.of('fp-ts'),\n * T.tapIO((value) => Console.log(`Hello, ${value}`)),\n * )\n *\n * async function test() {\n * assert.deepStrictEqual(await effect(), 'fp-ts')\n * }\n *\n * test()\n *\n * @category combinators\n * @since 2.16.0\n */\nexport var tapIO = /*#__PURE__*/ dual(2, tapIO_(FromIO, Chain));\n/**\n * @category lifting\n * @since 2.4.0\n */\nexport var fromIOK = \n/*#__PURE__*/ fromIOK_(FromIO);\n/**\n * Alias of `flatMapIO`.\n *\n * @category legacy\n * @since 2.4.0\n */\nexport var chainIOK = flatMapIO;\n/**\n * Alias of `tapIO`.\n *\n * @category legacy\n * @since 2.10.0\n */\nexport var chainFirstIOK = tapIO;\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var FromTask = {\n URI: URI,\n fromIO: fromIO,\n fromTask: fromTask\n};\n// -------------------------------------------------------------------------------------\n// utils\n// -------------------------------------------------------------------------------------\n/**\n * A `Task` that never completes.\n *\n * @since 2.0.0\n */\nexport var never = function () { return new Promise(function (_) { return undefined; }); };\n// -------------------------------------------------------------------------------------\n// do notation\n// -------------------------------------------------------------------------------------\n/**\n * @category do notation\n * @since 2.9.0\n */\nexport var Do = /*#__PURE__*/ of(_.emptyRecord);\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var bindTo = /*#__PURE__*/ bindTo_(Functor);\nvar let_ = /*#__PURE__*/ let__(Functor);\nexport { \n/**\n * @category do notation\n * @since 2.13.0\n */\nlet_ as let };\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var bind = /*#__PURE__*/ chainable.bind(Chain);\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var apS = /*#__PURE__*/ apS_(ApplyPar);\n/**\n * @since 2.11.0\n */\nexport var ApT = /*#__PURE__*/ of(_.emptyReadonlyArray);\n// -------------------------------------------------------------------------------------\n// array utils\n// -------------------------------------------------------------------------------------\n/**\n * Equivalent to `ReadonlyNonEmptyArray#traverseWithIndex(ApplicativePar)`.\n *\n * @category traversing\n * @since 2.11.0\n */\nexport var traverseReadonlyNonEmptyArrayWithIndex = function (f) {\n return function (as) {\n return function () {\n return Promise.all(as.map(function (a, i) { return Promise.resolve().then(function () { return f(i, a)(); }); }));\n };\n };\n};\n/**\n * Equivalent to `ReadonlyArray#traverseWithIndex(ApplicativePar)`.\n *\n * @category traversing\n * @since 2.11.0\n */\nexport var traverseReadonlyArrayWithIndex = function (f) {\n var g = traverseReadonlyNonEmptyArrayWithIndex(f);\n return function (as) { return (_.isNonEmpty(as) ? g(as) : ApT); };\n};\n/**\n * Equivalent to `ReadonlyNonEmptyArray#traverseWithIndex(ApplicativeSeq)`.\n *\n * @category traversing\n * @since 2.11.0\n */\nexport var traverseReadonlyNonEmptyArrayWithIndexSeq = function (f) {\n return function (as) {\n return function () {\n return _.tail(as).reduce(function (acc, a, i) {\n return acc.then(function (bs) {\n return Promise.resolve()\n .then(f(i + 1, a))\n .then(function (b) {\n bs.push(b);\n return bs;\n });\n });\n }, Promise.resolve()\n .then(f(0, _.head(as)))\n .then(_.singleton));\n };\n };\n};\n/**\n * Equivalent to `ReadonlyArray#traverseWithIndex(ApplicativeSeq)`.\n *\n * @category traversing\n * @since 2.11.0\n */\nexport var traverseReadonlyArrayWithIndexSeq = function (f) {\n var g = traverseReadonlyNonEmptyArrayWithIndexSeq(f);\n return function (as) { return (_.isNonEmpty(as) ? g(as) : ApT); };\n};\n/**\n * Equivalent to `ReadonlyArray#traverseWithIndex(Applicative)`.\n *\n * @category traversing\n * @since 2.9.0\n */\nexport var traverseArrayWithIndex = traverseReadonlyArrayWithIndex;\n/**\n * Equivalent to `ReadonlyArray#traverse(Applicative)`.\n *\n * @category traversing\n * @since 2.9.0\n */\nexport var traverseArray = function (f) {\n return traverseReadonlyArrayWithIndex(function (_, a) { return f(a); });\n};\n/**\n * Equivalent to `ReadonlyArray#sequence(Applicative)`.\n *\n * @category traversing\n * @since 2.9.0\n */\nexport var sequenceArray = \n/*#__PURE__*/ traverseArray(identity);\n/**\n * Equivalent to `ReadonlyArray#traverseWithIndex(ApplicativeSeq)`.\n *\n * @category traversing\n * @since 2.9.0\n */\nexport var traverseSeqArrayWithIndex = traverseReadonlyArrayWithIndexSeq;\n/**\n * Equivalent to `ReadonlyArray#traverse(ApplicativeSeq)`.\n *\n * @category traversing\n * @since 2.9.0\n */\nexport var traverseSeqArray = function (f) {\n return traverseReadonlyArrayWithIndexSeq(function (_, a) { return f(a); });\n};\n/**\n * Equivalent to `ReadonlyArray#sequence(ApplicativeSeq)`.\n *\n * @category traversing\n * @since 2.9.0\n */\nexport var sequenceSeqArray = \n/*#__PURE__*/ traverseSeqArray(identity);\n// -------------------------------------------------------------------------------------\n// legacy\n// -------------------------------------------------------------------------------------\n/**\n * Alias of `flatMap`.\n *\n * @category legacy\n * @since 2.0.0\n */\nexport var chain = flatMap;\n/**\n * Alias of `tap`.\n *\n * @category legacy\n * @since 2.0.0\n */\nexport var chainFirst = tap;\n// -------------------------------------------------------------------------------------\n// deprecated\n// -------------------------------------------------------------------------------------\n/**\n * This instance is deprecated, use small, specific instances instead.\n * For example if a function needs a `Functor` instance, pass `T.Functor` instead of `T.task`\n * (where `T` is from `import T from 'fp-ts/Task'`)\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var task = {\n URI: URI,\n map: _map,\n of: of,\n ap: _apPar,\n chain: flatMap,\n fromIO: fromIO,\n fromTask: fromTask\n};\n/**\n * This instance is deprecated, use small, specific instances instead.\n * For example if a function needs a `Functor` instance, pass `T.Functor` instead of `T.taskSeq`\n * (where `T` is from `import T from 'fp-ts/Task'`)\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var taskSeq = {\n URI: URI,\n map: _map,\n of: of,\n ap: _apSeq,\n chain: flatMap,\n fromIO: fromIO,\n fromTask: fromTask\n};\n/**\n * Use [`getApplySemigroup`](./Apply.ts.html#getapplysemigroup) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var getSemigroup = /*#__PURE__*/ getApplySemigroup_(ApplySeq);\n/**\n * Use [`getApplicativeMonoid`](./Applicative.ts.html#getapplicativemonoid) instead.\n *\n * Lift a monoid into 'Task', the inner values are concatenated using the provided `Monoid`.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var getMonoid = /*#__PURE__*/ getApplicativeMonoid(ApplicativeSeq);\n","var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __generator = (this && this.__generator) || function (thisArg, body) {\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\n function verb(n) { return function (v) { return step([n, v]); }; }\n function step(op) {\n if (f) throw new TypeError(\"Generator is already executing.\");\n while (g && (g = 0, op[0] && (_ = 0)), _) try {\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\n if (y = 0, t) op = [op[0] & 2, t.value];\n switch (op[0]) {\n case 0: case 1: t = op; break;\n case 4: _.label++; return { value: op[1], done: false };\n case 5: _.label++; y = op[1]; op = [0]; continue;\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\n default:\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\n if (t[2]) _.ops.pop();\n _.trys.pop(); continue;\n }\n op = body.call(thisArg, _);\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\n }\n};\nimport { getApplicativeMonoid } from './Applicative';\nimport { ap as ap_, apFirst as apFirst_, apS as apS_, apSecond as apSecond_, getApplySemigroup as getApplySemigroup_ } from './Apply';\nimport * as chainable from './Chain';\nimport { compact as compact_, separate as separate_ } from './Compactable';\nimport * as E from './Either';\nimport * as ET from './EitherT';\nimport { filter as filter_, filterMap as filterMap_, partition as partition_, partitionMap as partitionMap_ } from './Filterable';\nimport { chainOptionK as chainOptionK_, filterOrElse as filterOrElse_, fromEitherK as fromEitherK_, fromOption as fromOption_, fromOptionK as fromOptionK_, fromPredicate as fromPredicate_, tapEither as tapEither_ } from './FromEither';\nimport { fromIOK as fromIOK_, tapIO as tapIO_ } from './FromIO';\nimport { fromTaskK as fromTaskK_, tapTask as tapTask_ } from './FromTask';\nimport { dual, flow, identity, pipe, SK } from './function';\nimport { as as as_, asUnit as asUnit_, bindTo as bindTo_, flap as flap_, let as let__ } from './Functor';\nimport * as _ from './internal';\nimport * as T from './Task';\n// -------------------------------------------------------------------------------------\n// constructors\n// -------------------------------------------------------------------------------------\n/**\n * @category constructors\n * @since 2.0.0\n */\nexport var left = /*#__PURE__*/ ET.left(T.Pointed);\n/**\n * @category constructors\n * @since 2.0.0\n */\nexport var right = /*#__PURE__*/ ET.right(T.Pointed);\n/**\n * @category constructors\n * @since 2.0.0\n */\nexport var rightTask = /*#__PURE__*/ ET.rightF(T.Functor);\n/**\n * @category constructors\n * @since 2.0.0\n */\nexport var leftTask = /*#__PURE__*/ ET.leftF(T.Functor);\n/**\n * @category constructors\n * @since 2.0.0\n */\nexport var rightIO = /*#__PURE__*/ flow(T.fromIO, rightTask);\n/**\n * @category constructors\n * @since 2.0.0\n */\nexport var leftIO = /*#__PURE__*/ flow(T.fromIO, leftTask);\n// -------------------------------------------------------------------------------------\n// conversions\n// -------------------------------------------------------------------------------------\n/**\n * @category conversions\n * @since 2.7.0\n */\nexport var fromIO = rightIO;\n/**\n * @category conversions\n * @since 2.7.0\n */\nexport var fromTask = rightTask;\n/**\n * @category conversions\n * @since 2.0.0\n */\nexport var fromEither = T.of;\n/**\n * @category conversions\n * @since 2.0.0\n */\nexport var fromIOEither = T.fromIO;\n/**\n * @category conversions\n * @since 2.11.0\n */\nexport var fromTaskOption = function (onNone) {\n return T.map(E.fromOption(onNone));\n};\n/**\n * @category pattern matching\n * @since 2.10.0\n */\nexport var match = \n/*#__PURE__*/ ET.match(T.Functor);\n/**\n * Less strict version of [`match`](#match).\n *\n * The `W` suffix (short for **W**idening) means that the handler return types will be merged.\n *\n * @category pattern matching\n * @since 2.10.0\n */\nexport var matchW = match;\n/**\n * The `E` suffix (short for **E**ffect) means that the handlers return an effect (`Task`).\n *\n * @category pattern matching\n * @since 2.10.0\n */\nexport var matchE = /*#__PURE__*/ ET.matchE(T.Monad);\n/**\n * Alias of [`matchE`](#matche).\n *\n * @category pattern matching\n * @since 2.0.0\n */\nexport var fold = matchE;\n/**\n * Less strict version of [`matchE`](#matche).\n *\n * The `W` suffix (short for **W**idening) means that the handler return types will be merged.\n *\n * @category pattern matching\n * @since 2.10.0\n */\nexport var matchEW = matchE;\n/**\n * Alias of [`matchEW`](#matchew).\n *\n * @category pattern matching\n * @since 2.10.0\n */\nexport var foldW = matchEW;\n/**\n * @category error handling\n * @since 2.0.0\n */\nexport var getOrElse = \n/*#__PURE__*/ ET.getOrElse(T.Monad);\n/**\n * Less strict version of [`getOrElse`](#getorelse).\n *\n * The `W` suffix (short for **W**idening) means that the handler return type will be merged.\n *\n * @category error handling\n * @since 2.6.0\n */\nexport var getOrElseW = getOrElse;\n/**\n * Transforms a `Promise` that may reject to a `Promise` that never rejects and returns an `Either` instead.\n *\n * See also [`tryCatchK`](#trycatchk).\n *\n * @example\n * import { left, right } from 'fp-ts/Either'\n * import { tryCatch } from 'fp-ts/TaskEither'\n *\n * tryCatch(() => Promise.resolve(1), String)().then(result => {\n * assert.deepStrictEqual(result, right(1))\n * })\n * tryCatch(() => Promise.reject('error'), String)().then(result => {\n * assert.deepStrictEqual(result, left('error'))\n * })\n *\n * @category interop\n * @since 2.0.0\n */\nexport var tryCatch = function (f, onRejected) {\n return function () { return __awaiter(void 0, void 0, void 0, function () {\n var reason_1;\n return __generator(this, function (_a) {\n switch (_a.label) {\n case 0:\n _a.trys.push([0, 2, , 3]);\n return [4 /*yield*/, f().then(_.right)];\n case 1: return [2 /*return*/, _a.sent()];\n case 2:\n reason_1 = _a.sent();\n return [2 /*return*/, _.left(onRejected(reason_1))];\n case 3: return [2 /*return*/];\n }\n });\n }); };\n};\n/**\n * Converts a function returning a `Promise` to one returning a `TaskEither`.\n *\n * @category interop\n * @since 2.5.0\n */\nexport var tryCatchK = function (f, onRejected) {\n return function () {\n var a = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n a[_i] = arguments[_i];\n }\n return tryCatch(function () { return f.apply(void 0, a); }, onRejected);\n };\n};\n/**\n * @category conversions\n * @since 2.10.0\n */\nexport var toUnion = /*#__PURE__*/ ET.toUnion(T.Functor);\n/**\n * @category conversions\n * @since 2.12.0\n */\nexport var fromNullable = /*#__PURE__*/ ET.fromNullable(T.Pointed);\n/**\n * Use `liftNullable`.\n *\n * @category legacy\n * @since 2.12.0\n */\nexport var fromNullableK = /*#__PURE__*/ ET.fromNullableK(T.Pointed);\n/**\n * Use `flatMapNullable`.\n *\n * @category legacy\n * @since 2.12.0\n */\nexport var chainNullableK = \n/*#__PURE__*/ ET.chainNullableK(T.Monad);\n// -------------------------------------------------------------------------------------\n// combinators\n// -------------------------------------------------------------------------------------\n/**\n * Returns `ma` if is a `Right` or the value returned by `onLeft` otherwise.\n *\n * See also [alt](#alt).\n *\n * @example\n * import * as E from 'fp-ts/Either'\n * import { pipe } from 'fp-ts/function'\n * import * as TE from 'fp-ts/TaskEither'\n *\n * async function test() {\n * const errorHandler = TE.orElse((error: string) => TE.right(`recovering from ${error}...`))\n * assert.deepStrictEqual(await pipe(TE.right('ok'), errorHandler)(), E.right('ok'))\n * assert.deepStrictEqual(await pipe(TE.left('ko'), errorHandler)(), E.right('recovering from ko...'))\n * }\n *\n * test()\n *\n * @category error handling\n * @since 2.0.0\n */\nexport var orElse = \n/*#__PURE__*/ ET.orElse(T.Monad);\n/**\n * Less strict version of [`orElse`](#orelse).\n *\n * The `W` suffix (short for **W**idening) means that the return types will be merged.\n *\n * @category error handling\n * @since 2.10.0\n */\nexport var orElseW = orElse;\n/**\n * Returns an effect that effectfully \"peeks\" at the failure of this effect.\n *\n * @category error handling\n * @since 2.15.0\n */\nexport var tapError = /*#__PURE__*/ dual(2, ET.tapError(T.Monad));\n/**\n * @category error handling\n * @since 2.12.0\n */\nexport var orElseFirstIOK = function (onLeft) { return tapError(fromIOK(onLeft)); };\n/**\n * @category error handling\n * @since 2.12.0\n */\nexport var orElseFirstTaskK = function (onLeft) { return tapError(fromTaskK(onLeft)); };\n/**\n * @category error handling\n * @since 2.11.0\n */\nexport var orLeft = \n/*#__PURE__*/ ET.orLeft(T.Monad);\n/**\n * @since 2.0.0\n */\nexport var swap = /*#__PURE__*/ ET.swap(T.Functor);\n/**\n * @category lifting\n * @since 2.11.0\n */\nexport var fromTaskOptionK = function (onNone) {\n var from = fromTaskOption(onNone);\n return function (f) { return flow(f, from); };\n};\n/**\n * Use `flatMapTaskOption`.\n *\n * The `W` suffix (short for **W**idening) means that the error types will be merged.\n *\n * @category legacy\n * @since 2.12.3\n */\nexport var chainTaskOptionKW = function (onNone) {\n return function (f) {\n return function (ma) {\n return flatMap(ma, fromTaskOptionK(onNone)(f));\n };\n };\n};\n/**\n * Use `flatMapTaskOption`.\n *\n * @category legacy\n * @since 2.11.0\n */\nexport var chainTaskOptionK = chainTaskOptionKW;\n/**\n * @category lifting\n * @since 2.4.0\n */\nexport var fromIOEitherK = function (f) { return flow(f, fromIOEither); };\nvar _map = function (fa, f) { return pipe(fa, map(f)); };\nvar _apPar = function (fab, fa) { return pipe(fab, ap(fa)); };\nvar _apSeq = function (fab, fa) { return flatMap(fab, function (f) { return pipe(fa, map(f)); }); };\n/* istanbul ignore next */\nvar _alt = function (fa, that) { return pipe(fa, alt(that)); };\n/**\n * `map` can be used to turn functions `(a: A) => B` into functions `(fa: F<A>) => F<B>` whose argument and return types\n * use the type constructor `F` to represent some computational context.\n *\n * @category mapping\n * @since 2.0.0\n */\nexport var map = /*#__PURE__*/ ET.map(T.Functor);\n/**\n * Returns a `TaskEither` whose failure and success channels have been mapped by the specified pair of functions, `f` and `g`.\n *\n * @example\n * import * as TaskEither from 'fp-ts/TaskEither'\n * import * as Either from 'fp-ts/Either'\n *\n * const f = (s: string) => new Error(s)\n * const g = (n: number) => n * 2\n *\n * async function test() {\n * assert.deepStrictEqual(await TaskEither.mapBoth(TaskEither.right(1), f, g)(), Either.right(2))\n * assert.deepStrictEqual(await TaskEither.mapBoth(TaskEither.left('err'), f, g)(), Either.left(new Error('err')))\n * }\n *\n * test()\n *\n * @category error handling\n * @since 2.16.0\n */\nexport var mapBoth = /*#__PURE__*/ dual(3, ET.mapBoth(T.Functor));\n/**\n * Alias of `mapBoth`.\n *\n * @category legacy\n * @since 2.0.0\n */\nexport var bimap = mapBoth;\n/**\n * Returns a `TaskEither` with its error channel mapped using the specified function.\n *\n * @example\n * import * as TaskEither from 'fp-ts/TaskEither'\n * import * as Either from 'fp-ts/Either'\n *\n * const f = (s: string) => new Error(s)\n *\n * async function test() {\n * assert.deepStrictEqual(await TaskEither.mapError(TaskEither.right(1), f)(), Either.right(1))\n * assert.deepStrictEqual(await TaskEither.mapError(TaskEither.left('err'), f)(), Either.left(new Error('err')))\n * }\n *\n * test()\n *\n * @category error handling\n * @since 2.16.0\n */\nexport var mapError = /*#__PURE__*/ dual(2, ET.mapError(T.Functor));\n/**\n * Alias of `mapError`.\n *\n * @category legacy\n * @since 2.0.0\n */\nexport var mapLeft = mapError;\n/**\n * @since 2.0.0\n */\nexport var ap = \n/*#__PURE__*/ ET.ap(T.ApplyPar);\n/**\n * Less strict version of [`ap`](#ap).\n *\n * The `W` suffix (short for **W**idening) means that the error types will be merged.\n *\n * @since 2.8.0\n */\nexport var apW = ap;\n/**\n * @category sequencing\n * @since 2.14.0\n */\nexport var flatMap = /*#__PURE__*/ dual(2, ET.flatMap(T.Monad));\n/**\n * Less strict version of [`flatten`](#flatten).\n *\n * The `W` suffix (short for **W**idening) means that the error types will be merged.\n *\n * @category sequencing\n * @since 2.11.0\n */\nexport var flattenW = \n/*#__PURE__*/ flatMap(identity);\n/**\n * @category sequencing\n * @since 2.0.0\n */\nexport var flatten = flattenW;\n/**\n * Identifies an associative operation on a type constructor. It is similar to `Semigroup`, except that it applies to\n * types of kind `* -> *`.\n *\n * In case of `TaskEither` returns `fa` if is a `Right` or the value returned by `that` otherwise.\n *\n * See also [orElse](#orelse).\n *\n * @example\n * import * as E from 'fp-ts/Either'\n * import { pipe } from 'fp-ts/function'\n * import * as TE from 'fp-ts/TaskEither'\n *\n * async function test() {\n * assert.deepStrictEqual(\n * await pipe(\n * TE.right(1),\n * TE.alt(() => TE.right(2))\n * )(),\n * E.right(1)\n * )\n * assert.deepStrictEqual(\n * await pipe(\n * TE.left('a'),\n * TE.alt(() => TE.right(2))\n * )(),\n * E.right(2)\n * )\n * assert.deepStrictEqual(\n * await pipe(\n * TE.left('a'),\n * TE.alt(() => TE.left('b'))\n * )(),\n * E.left('b')\n * )\n * }\n *\n * test()\n *\n * @category error handling\n * @since 2.0.0\n */\nexport var alt = \n/*#__PURE__*/ ET.alt(T.Monad);\n/**\n * Less strict version of [`alt`](#alt).\n *\n * The `W` suffix (short for **W**idening) means that the error and the return types will be merged.\n *\n * @category error handling\n * @since 2.9.0\n */\nexport var altW = alt;\n/**\n * @category constructors\n * @since 2.0.0\n */\nexport var of = right;\n/**\n * @since 2.7.0\n */\nexport var throwError = left;\n/**\n * @category type lambdas\n * @since 2.0.0\n */\nexport var URI = 'TaskEither';\n/**\n * The default [`ApplicativePar`](#applicativepar) instance returns the first error, if you want to\n * get all errors you need to provide a way to concatenate them via a `Semigroup`.\n *\n * @example\n * import * as E from 'fp-ts/Either'\n * import { pipe } from 'fp-ts/function'\n * import * as RA from 'fp-ts/ReadonlyArray'\n * import * as S from 'fp-ts/Semigroup'\n * import * as string from 'fp-ts/string'\n * import * as T from 'fp-ts/Task'\n * import * as TE from 'fp-ts/TaskEither'\n *\n * interface User {\n * readonly id: string\n * readonly name: string\n * }\n *\n * const remoteDatabase: ReadonlyArray<User> = [\n * { id: 'id1', name: 'John' },\n * { id: 'id2', name: 'Mary' },\n * { id: 'id3', name: 'Joey' }\n * ]\n *\n * const fetchUser = (id: string): TE.TaskEither<string, User> =>\n * pipe(\n * remoteDatabase,\n * RA.findFirst((user) => user.id === id),\n * TE.fromOption(() => `${id} not found`)\n * )\n *\n * async function test() {\n * assert.deepStrictEqual(\n * await pipe(['id4', 'id5'], RA.traverse(TE.ApplicativePar)(fetchUser))(),\n * E.left('id4 not found') // <= first error\n * )\n *\n * const Applicative = TE.getApplicativeTaskValidation(\n * T.ApplyPar,\n * pipe(string.Semigroup, S.intercalate(', '))\n * )\n *\n * assert.deepStrictEqual(\n * await pipe(['id4', 'id5'], RA.traverse(Applicative)(fetchUser))(),\n * E.left('id4 not found, id5 not found') // <= all errors\n * )\n * }\n *\n * test()\n *\n * @category error handling\n * @since 2.7.0\n */\nexport function getApplicativeTaskValidation(A, S) {\n var ap = ap_(A, E.getApplicativeValidation(S));\n return {\n URI: URI,\n _E: undefined,\n map: _map,\n ap: function (fab, fa) { return pipe(fab, ap(fa)); },\n of: of\n };\n}\n/**\n * The default [`Alt`](#alt) instance returns the last error, if you want to\n * get all errors you need to provide a way to concatenate them via a `Semigroup`.\n *\n * See [`getAltValidation`](./Either.ts.html#getaltvalidation).\n *\n * @category error handling\n * @since 2.7.0\n */\nexport function getAltTaskValidation(S) {\n var alt = ET.altValidation(T.Monad, S);\n return {\n URI: URI,\n _E: undefined,\n map: _map,\n alt: function (fa, that) { return pipe(fa, alt(that)); }\n };\n}\n/**\n * @category filtering\n * @since 2.10.0\n */\nexport var getCompactable = function (M) {\n var C = E.getCompactable(M);\n return {\n URI: URI,\n _E: undefined,\n compact: compact_(T.Functor, C),\n separate: separate_(T.Functor, C, E.Functor)\n };\n};\n/**\n * @category filtering\n * @since 2.1.0\n */\nexport function getFilterable(M) {\n var F = E.getFilterable(M);\n var C = getCompactable(M);\n var filter = filter_(T.Functor, F);\n var filterMap = filterMap_(T.Functor, F);\n var partition = partition_(T.Functor, F);\n var partitionMap = partitionMap_(T.Functor, F);\n return {\n URI: URI,\n _E: undefined,\n map: _map,\n compact: C.compact,\n separate: C.separate,\n filter: function (fa, predicate) { return pipe(fa, filter(predicate)); },\n filterMap: function (fa, f) { return pipe(fa, filterMap(f)); },\n partition: function (fa, predicate) { return pipe(fa, partition(predicate)); },\n partitionMap: function (fa, f) { return pipe(fa, partitionMap(f)); }\n };\n}\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Functor = {\n URI: URI,\n map: _map\n};\n/**\n * Maps the `Right` value of this `TaskEither` to the specified constant value.\n *\n * @category mapping\n * @since 2.16.0\n */\nexport var as = dual(2, as_(Functor));\n/**\n * Maps the `Right` value of this `TaskEither` to the void constant value.\n *\n * @category mapping\n * @since 2.16.0\n */\nexport var asUnit = asUnit_(Functor);\n/**\n * @category mapping\n * @since 2.10.0\n */\nexport var flap = /*#__PURE__*/ flap_(Functor);\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Pointed = {\n URI: URI,\n of: of\n};\n/**\n * Runs computations in parallel.\n *\n * @category instances\n * @since 2.10.0\n */\nexport var ApplyPar = {\n URI: URI,\n map: _map,\n ap: _apPar\n};\n/**\n * Combine two effectful actions, keeping only the result of the first.\n *\n * @since 2.0.0\n */\nexport var apFirst = /*#__PURE__*/ apFirst_(ApplyPar);\n/**\n * Less strict version of [`apFirst`](#apfirst).\n *\n * The `W` suffix (short for **W**idening) means that the error types will be merged.\n *\n * @since 2.12.0\n */\nexport var apFirstW = apFirst;\n/**\n * Combine two effectful actions, keeping only the result of the second.\n *\n * @since 2.0.0\n */\nexport var apSecond = /*#__PURE__*/ apSecond_(ApplyPar);\n/**\n * Less strict version of [`apSecond`](#apsecond).\n *\n * The `W` suffix (short for **W**idening) means that the error types will be merged.\n *\n * @since 2.12.0\n */\nexport var apSecondW = apSecond;\n/**\n * Runs computations in parallel.\n *\n * @category instances\n * @since 2.7.0\n */\nexport var ApplicativePar = {\n URI: URI,\n map: _map,\n ap: _apPar,\n of: of\n};\n/**\n * Runs computations sequentially.\n *\n * @category instances\n * @since 2.10.0\n */\nexport var ApplySeq = {\n URI: URI,\n map: _map,\n ap: _apSeq\n};\n/**\n * Runs computations sequentially.\n *\n * @category instances\n * @since 2.7.0\n */\nexport var ApplicativeSeq = {\n URI: URI,\n map: _map,\n ap: _apSeq,\n of: of\n};\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Chain = {\n URI: URI,\n map: _map,\n ap: _apPar,\n chain: flatMap\n};\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var Monad = {\n URI: URI,\n map: _map,\n ap: _apPar,\n chain: flatMap,\n of: of\n};\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var MonadIO = {\n URI: URI,\n map: _map,\n ap: _apPar,\n chain: flatMap,\n of: of,\n fromIO: fromIO\n};\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var MonadTask = {\n URI: URI,\n map: _map,\n ap: _apPar,\n chain: flatMap,\n of: of,\n fromIO: fromIO,\n fromTask: fromTask\n};\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var MonadThrow = {\n URI: URI,\n map: _map,\n ap: _apPar,\n chain: flatMap,\n of: of,\n throwError: throwError\n};\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var FromEither = {\n URI: URI,\n fromEither: fromEither\n};\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var FromIO = {\n URI: URI,\n fromIO: fromIO\n};\n/**\n * @category instances\n * @since 2.10.0\n */\nexport var FromTask = {\n URI: URI,\n fromIO: fromIO,\n fromTask: fromTask\n};\n/**\n * Composes computations in sequence, using the return value of one computation to determine the next computation and\n * keeping only the result of the first.\n *\n * @category combinators\n * @since 2.15.0\n */\nexport var tap = /*#__PURE__*/ dual(2, chainable.tap(Chain));\n/**\n * Composes computations in sequence, using the return value of one computation to determine the next computation and\n * keeping only the result of the first.\n *\n * @example\n * import * as E from 'fp-ts/Either'\n * import { pipe } from 'fp-ts/function'\n * import * as TE from 'fp-ts/TaskEither'\n *\n * const checkString = (value: string) => pipe(\n * TE.of(value),\n * TE.tapEither(() => value.length > 0 ? E.right('ok') : E.left('error'))\n * )\n *\n * async function test() {\n * assert.deepStrictEqual(await checkString('')(), E.left('error'))\n * assert.deepStrictEqual(await checkString('fp-ts')(), E.right('fp-ts'))\n * }\n *\n * test()\n *\n * @category combinators\n * @since 2.16.0\n */\nexport var tapEither = /*#__PURE__*/ dual(2, tapEither_(FromEither, Chain));\n/**\n * Composes computations in sequence, using the return value of one computation to determine the next computation and\n * keeping only the result of the first.\n *\n * @example\n * import { pipe } from 'fp-ts/function'\n * import * as TE from 'fp-ts/TaskEither'\n * import * as E from 'fp-ts/Either'\n * import * as Console from 'fp-ts/Console'\n *\n *\n * // Will produce `Hello, fp-ts` to the stdout\n * const effectA = TE.tapIO(\n * TE.of(1),\n * (value) => Console.log(`Hello, ${value}`)\n * )\n *\n * // No output to the stdout\n * const effectB = pipe(\n * TE.left('error'),\n * TE.tapIO((value) => Console.log(`Hello, ${value}`))\n * )\n *\n * async function test() {\n * assert.deepStrictEqual(await effectA(), E.of(1))\n * assert.deepStrictEqual(await effectB(), E.left('error'))\n * }\n *\n * test()\n *\n * @category combinators\n * @since 2.16.0\n */\nexport var tapIO = /*#__PURE__*/ dual(2, tapIO_(FromIO, Chain));\n/**\n * Composes computations in sequence, using the return value of one computation to determine the next computation and\n * keeping only the result of the first.\n *\n * @example\n * import * as TE from 'fp-ts/TaskEither'\n * import * as T from 'fp-ts/Task'\n * import * as E from 'fp-ts/Either'\n *\n *\n * const effect = TE.tapIO(\n * TE.of(1),\n * (value) => T.of(value + 1)\n * )\n *\n * async function test() {\n * assert.deepStrictEqual(await effect(), E.of(1))\n * }\n *\n * test()\n *\n * @category combinators\n * @since 2.16.0\n */\nexport var tapTask = /*#__PURE__*/ dual(2, tapTask_(FromTask, Chain));\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Bifunctor = {\n URI: URI,\n bimap: mapBoth,\n mapLeft: mapError\n};\n/**\n * @category instances\n * @since 2.7.0\n */\nexport var Alt = {\n URI: URI,\n map: _map,\n alt: _alt\n};\n/**\n * @category conversions\n * @since 2.0.0\n */\nexport var fromOption = \n/*#__PURE__*/ fromOption_(FromEither);\n/**\n * Use `liftOption`.\n *\n * @category legacy\n * @since 2.10.0\n */\nexport var fromOptionK = \n/*#__PURE__*/ fromOptionK_(FromEither);\n/**\n * Use `flatMapOption`.\n *\n * @category legacy\n * @since 2.10.0\n */\nexport var chainOptionK = /*#__PURE__*/ chainOptionK_(FromEither, Chain);\n/**\n * Use `flatMapOption`.\n *\n * @category legacy\n * @since 2.13.2\n */\nexport var chainOptionKW = chainOptionK;\n/** @internal */\nvar _FromEither = {\n fromEither: FromEither.fromEither\n};\n/**\n * @category lifting\n * @since 2.15.0\n */\nexport var liftNullable = /*#__PURE__*/ _.liftNullable(_FromEither);\n/**\n * @category lifting\n * @since 2.15.0\n */\nexport var liftOption = /*#__PURE__*/ _.liftOption(_FromEither);\n/** @internal */\nvar _FlatMap = {\n flatMap: flatMap\n};\n/** @internal */\nvar _FromIO = {\n fromIO: FromIO.fromIO\n};\n/** @internal */\nvar _FromTask = {\n fromTask: fromTask\n};\n/**\n * @category sequencing\n * @since 2.15.0\n */\nexport var flatMapNullable = /*#__PURE__*/ _.flatMapNullable(_FromEither, _FlatMap);\n/**\n * @category sequencing\n * @since 2.15.0\n */\nexport var flatMapOption = /*#__PURE__*/ _.flatMapOption(_FromEither, _FlatMap);\n/**\n * @category sequencing\n * @since 2.15.0\n */\nexport var flatMapEither = /*#__PURE__*/ _.flatMapEither(_FromEither, _FlatMap);\n/**\n * @category sequencing\n * @since 2.15.0\n */\nexport var flatMapIO = /*#__PURE__*/ _.flatMapIO(_FromIO, _FlatMap);\n/**\n * @category sequencing\n * @since 2.16.0\n */\nexport var flatMapTask = /*#__PURE__*/ _.flatMapTask(_FromTask, _FlatMap);\n/**\n * @category sequencing\n * @since 2.16.0\n */\nexport var flatMapIOEither = /*#__PURE__*/ dual(2, function (self, f) {\n return flatMap(self, fromIOEitherK(f));\n});\n/**\n * @category sequencing\n * @since 2.16.0\n */\nexport var flatMapTaskOption = /*#__PURE__*/ dual(3, function (self, f, onNone) {\n return flatMap(self, function (a) { return fromTaskOption(function () { return onNone(a); })(f(a)); });\n});\n/**\n * Alias of `flatMapEither`.\n *\n * @category legacy\n * @since 2.4.0\n */\nexport var chainEitherK = flatMapEither;\n/**\n * Alias of `flatMapEither`.\n *\n * @category legacy\n * @since 2.6.1\n */\nexport var chainEitherKW = flatMapEither;\n/**\n * Alias of `tapEither`.\n *\n * @category legacy\n * @since 2.12.0\n */\nexport var chainFirstEitherK = tapEither;\n/**\n * Alias of `tapEither`.\n *\n * Less strict version of [`chainFirstEitherK`](#chainfirsteitherk).\n *\n * The `W` suffix (short for **W**idening) means that the error types will be merged.\n *\n * @category legacy\n * @since 2.12.0\n */\nexport var chainFirstEitherKW = tapEither;\n/**\n * @category lifting\n * @since 2.0.0\n */\nexport var fromPredicate = /*#__PURE__*/ fromPredicate_(FromEither);\n/**\n * @category filtering\n * @since 2.0.0\n */\nexport var filterOrElse = /*#__PURE__*/ filterOrElse_(FromEither, Chain);\n/**\n * Less strict version of [`filterOrElse`](#filterorelse).\n *\n * The `W` suffix (short for **W**idening) means that the error types will be merged.\n *\n * @category filtering\n * @since 2.9.0\n */\nexport var filterOrElseW = filterOrElse;\n/**\n * @category lifting\n * @since 2.4.0\n */\nexport var fromEitherK = /*#__PURE__*/ fromEitherK_(FromEither);\n/**\n * @category lifting\n * @since 2.10.0\n */\nexport var fromIOK = /*#__PURE__*/ fromIOK_(FromIO);\n/**\n * Alias of `flatMapIO`.\n *\n * @category legacy\n * @since 2.10.0\n */\nexport var chainIOK = flatMapIO;\n/**\n * Alias of `tapIO`.\n *\n * @category legacy\n * @since 2.10.0\n */\nexport var chainFirstIOK = tapIO;\n/**\n * @category lifting\n * @since 2.10.0\n */\nexport var fromTaskK = /*#__PURE__*/ fromTaskK_(FromTask);\n/**\n * Alias of `flatMapTask`.\n *\n * @category legacy\n * @since 2.10.0\n */\nexport var chainTaskK = flatMapTask;\n/**\n * Alias of `tapTask`.\n *\n * @category legacy\n * @since 2.10.0\n */\nexport var chainFirstTaskK = tapTask;\n/**\n * Alias of `flatMapIOEither`.\n *\n * Less strict version of [`chainIOEitherK`](#chainioeitherk).\n *\n * The `W` suffix (short for **W**idening) means that the error types will be merged.\n *\n * @category legacy\n * @since 2.6.1\n */\nexport var chainIOEitherKW = flatMapIOEither;\n/**\n * Alias of `flatMapIOEither`.\n *\n * @category legacy\n * @since 2.4.0\n */\nexport var chainIOEitherK = flatMapIOEither;\nexport function taskify(f) {\n return function () {\n var args = Array.prototype.slice.call(arguments);\n return function () {\n return new Promise(function (resolve) {\n var cbResolver = function (e, r) { return (e != null ? resolve(_.left(e)) : resolve(_.right(r))); };\n f.apply(null, args.concat(cbResolver));\n });\n };\n };\n}\n/**\n * Make sure that a resource is cleaned up in the event of an exception (\\*). The release action is called regardless of\n * whether the body action throws (\\*) or returns.\n *\n * (\\*) i.e. returns a `Left`\n *\n * @since 2.0.0\n */\nexport var bracket = function (acquire, use, release) { return bracketW(acquire, use, release); };\n/**\n * Less strict version of [`bracket`](#bracket).\n *\n * The `W` suffix (short for **W**idening) means that the error types will be merged.\n *\n * @since 2.12.0\n */\nexport var bracketW = function (acquire, use, release) {\n return flatMap(acquire, function (a) { return T.flatMap(use(a), function (e) { return flatMap(release(a, e), function () { return T.of(e); }); }); });\n};\n// -------------------------------------------------------------------------------------\n// do notation\n// -------------------------------------------------------------------------------------\n/**\n * @category do notation\n * @since 2.9.0\n */\nexport var Do = /*#__PURE__*/ of(_.emptyRecord);\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var bindTo = /*#__PURE__*/ bindTo_(Functor);\nvar let_ = /*#__PURE__*/ let__(Functor);\nexport { \n/**\n * @category do notation\n * @since 2.13.0\n */\nlet_ as let };\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var bind = /*#__PURE__*/ chainable.bind(Chain);\n/**\n * The `W` suffix (short for **W**idening) means that the error types will be merged.\n *\n * @category do notation\n * @since 2.8.0\n */\nexport var bindW = bind;\n/**\n * @category do notation\n * @since 2.8.0\n */\nexport var apS = /*#__PURE__*/ apS_(ApplyPar);\n/**\n * Less strict version of [`apS`](#aps).\n *\n * The `W` suffix (short for **W**idening) means that the error types will be merged.\n *\n * @category do notation\n * @since 2.8.0\n */\nexport var apSW = apS;\n/**\n * @since 2.11.0\n */\nexport var ApT = /*#__PURE__*/ of(_.emptyReadonlyArray);\n// -------------------------------------------------------------------------------------\n// array utils\n// -------------------------------------------------------------------------------------\n/**\n * Equivalent to `ReadonlyNonEmptyArray#traverseWithIndex(ApplicativePar)`.\n *\n * @category traversing\n * @since 2.11.0\n */\nexport var traverseReadonlyNonEmptyArrayWithIndex = function (f) {\n return flow(T.traverseReadonlyNonEmptyArrayWithIndex(f), T.map(E.traverseReadonlyNonEmptyArrayWithIndex(SK)));\n};\n/**\n * Equivalent to `ReadonlyArray#traverseWithIndex(ApplicativePar)`.\n *\n * @category traversing\n * @since 2.11.0\n */\nexport var traverseReadonlyArrayWithIndex = function (f) {\n var g = traverseReadonlyNonEmptyArrayWithIndex(f);\n return function (as) { return (_.isNonEmpty(as) ? g(as) : ApT); };\n};\n/**\n * Equivalent to `ReadonlyArray#traverseWithIndex(ApplicativeSeq)`.\n *\n * @category traversing\n * @since 2.11.0\n */\nexport var traverseReadonlyNonEmptyArrayWithIndexSeq = function (f) {\n return function (as) {\n return function () {\n return _.tail(as).reduce(function (acc, a, i) {\n return acc.then(function (ebs) {\n return _.isLeft(ebs)\n ? acc\n : f(i + 1, a)().then(function (eb) {\n if (_.isLeft(eb)) {\n return eb;\n }\n ebs.right.push(eb.right);\n return ebs;\n });\n });\n }, f(0, _.head(as))().then(E.map(_.singleton)));\n };\n };\n};\n/**\n * Equivalent to `ReadonlyArray#traverseWithIndex(ApplicativeSeq)`.\n *\n * @category traversing\n * @since 2.11.0\n */\nexport var traverseReadonlyArrayWithIndexSeq = function (f) {\n var g = traverseReadonlyNonEmptyArrayWithIndexSeq(f);\n return function (as) { return (_.isNonEmpty(as) ? g(as) : ApT); };\n};\n/**\n * Equivalent to `ReadonlyArray#traverseWithIndex(Applicative)`.\n *\n * @category traversing\n * @since 2.9.0\n */\nexport var traverseArrayWithIndex = traverseReadonlyArrayWithIndex;\n/**\n * Equivalent to `ReadonlyArray#traverse(Applicative)`.\n *\n * @category traversing\n * @since 2.9.0\n */\nexport var traverseArray = function (f) { return traverseReadonlyArrayWithIndex(function (_, a) { return f(a); }); };\n/**\n * Equivalent to `ReadonlyArray#sequence(Applicative)`.\n *\n * @category traversing\n * @since 2.9.0\n */\nexport var sequenceArray = \n/*#__PURE__*/ traverseArray(identity);\n/**\n * Equivalent to `ReadonlyArray#traverseWithIndex(ApplicativeSeq)`.\n *\n * @category traversing\n * @since 2.9.0\n */\nexport var traverseSeqArrayWithIndex = traverseReadonlyArrayWithIndexSeq;\n/**\n * Equivalent to `ReadonlyArray#traverse(ApplicativeSeq)`.\n *\n * @category traversing\n * @since 2.9.0\n */\nexport var traverseSeqArray = function (f) { return traverseReadonlyArrayWithIndexSeq(function (_, a) { return f(a); }); };\n/**\n * Equivalent to `ReadonlyArray#sequence(ApplicativeSeq)`.\n *\n * @category traversing\n * @since 2.9.0\n */\nexport var sequenceSeqArray = \n/*#__PURE__*/ traverseSeqArray(identity);\n// -------------------------------------------------------------------------------------\n// legacy\n// -------------------------------------------------------------------------------------\n/**\n * Alias of `flatMap`.\n *\n * @category legacy\n * @since 2.0.0\n */\nexport var chain = flatMap;\n/**\n * Alias of `flatMap`.\n *\n * @category legacy\n * @since 2.6.0\n */\nexport var chainW = flatMap;\n/**\n * Alias of `tap`.\n *\n * @category legacy\n * @since 2.0.0\n */\nexport var chainFirst = tap;\n/**\n * Alias of `tap`.\n *\n * @category legacy\n * @since 2.8.0\n */\nexport var chainFirstW = tap;\n/**\n * Alias of `tapError`.\n *\n * @category legacy\n * @since 2.11.0\n */\nexport var orElseFirst = tapError;\n/**\n * Alias of `tapError`.\n *\n * @category legacy\n * @since 2.11.0\n */\nexport var orElseFirstW = tapError;\n// -------------------------------------------------------------------------------------\n// deprecated\n// -------------------------------------------------------------------------------------\n/**\n * This instance is deprecated, use small, specific instances instead.\n * For example if a function needs a `Functor` instance, pass `TE.Functor` instead of `TE.taskEither`\n * (where `TE` is from `import TE from 'fp-ts/TaskEither'`)\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var taskEither = {\n URI: URI,\n bimap: mapBoth,\n mapLeft: mapError,\n map: _map,\n of: of,\n ap: _apPar,\n chain: flatMap,\n alt: _alt,\n fromIO: fromIO,\n fromTask: fromTask,\n throwError: throwError\n};\n/**\n * This instance is deprecated, use small, specific instances instead.\n * For example if a function needs a `Functor` instance, pass `TE.Functor` instead of `TE.taskEitherSeq`\n * (where `TE` is from `import TE from 'fp-ts/TaskEither'`)\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var taskEitherSeq = {\n URI: URI,\n bimap: mapBoth,\n mapLeft: mapError,\n map: _map,\n of: of,\n ap: _apSeq,\n chain: flatMap,\n alt: _alt,\n fromIO: fromIO,\n fromTask: fromTask,\n throwError: throwError\n};\n/**\n * Use [`getApplySemigroup`](./Apply.ts.html#getapplysemigroup) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var getApplySemigroup = \n/*#__PURE__*/ getApplySemigroup_(ApplySeq);\n/**\n * Use [`getApplicativeMonoid`](./Applicative.ts.html#getapplicativemonoid) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var getApplyMonoid = \n/*#__PURE__*/ getApplicativeMonoid(ApplicativeSeq);\n/**\n * Use [`getApplySemigroup`](./Apply.ts.html#getapplysemigroup) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport var getSemigroup = function (S) {\n return getApplySemigroup_(T.ApplySeq)(E.getSemigroup(S));\n};\n/**\n * Use [`getApplicativeTaskValidation`](#getapplicativetaskvalidation) and [`getAltTaskValidation`](#getalttaskvalidation) instead.\n *\n * @category zone of death\n * @since 2.0.0\n * @deprecated\n */\nexport function getTaskValidation(SE) {\n var applicativeTaskValidation = getApplicativeTaskValidation(T.ApplicativePar, SE);\n var altTaskValidation = getAltTaskValidation(SE);\n return {\n URI: URI,\n _E: undefined,\n map: _map,\n ap: applicativeTaskValidation.ap,\n of: of,\n chain: flatMap,\n bimap: mapBoth,\n mapLeft: mapError,\n alt: altTaskValidation.alt,\n fromIO: fromIO,\n fromTask: fromTask,\n throwError: throwError\n };\n}\n","import type { MaybeAccessor } from '@/types.js';\n\nexport function access<T>(value: MaybeAccessor<T>): T {\n return typeof value === 'function' ? (value as any)() as T : value;\n}\n","import { batch, computed, signal } from '@vbotma/signals';\nimport { either as E, function as fn } from 'fp-ts';\n\nimport { access } from '@/helpers/access.js';\nimport type { MaybeAccessor } from '@/types.js';\n\nexport interface MountableOptions<S, Err> {\n /**\n * A state to use if the `restoreState` function returned falsy value or\n * `isPageReload` returned false.\n */\n initialState: S | (() => E.Either<Err, S>);\n /**\n * @returns True if the current page was reloaded.\n */\n isPageReload: MaybeAccessor<boolean>;\n /**\n * A function to call whenever the component was mounted.\n * @param state - restored state.\n */\n onMounted?: (state: S) => void;\n /**\n * A function to call whenever the component was unmounted.\n */\n onUnmounted?: VoidFunction;\n /**\n * Attempts to restore previously saved component state. This function\n * will only be called if the current page was reloaded.\n */\n restoreState: () => (S | undefined);\n}\n\nexport class Mountable<S extends object, Err = never> {\n constructor({\n onMounted,\n restoreState,\n initialState,\n onUnmounted,\n isPageReload,\n }: MountableOptions<S, Err>) {\n this.mount = () => {\n if (this.isMounted()) {\n return E.right(undefined);\n }\n const restored = access(isPageReload) ? restoreState() : undefined;\n const state = restored\n ? E.right(restored)\n : (typeof initialState === 'function' ? initialState() : E.right(initialState));\n\n return fn.pipe(state, E.map(s => {\n batch(() => {\n this._isMounted.set(true);\n onMounted?.(s);\n });\n }));\n };\n\n this.unmount = () => {\n if (this._isMounted()) {\n batch(() => {\n this._isMounted.set(false);\n onUnmounted?.();\n });\n }\n };\n }\n\n private readonly _isMounted = signal(false);\n\n /**\n * Signal indicating if the component is mounted.\n */\n readonly isMounted = computed(this._isMounted);\n\n /**\n * Mounts the component restoring its state and calling required side effects.\n */\n readonly mount: () => E.Either<Err, void>;\n\n /**\n * Unmounts the component.\n */\n readonly unmount: () => void;\n}\n","import type { UnionRequiredKeys } from '@vbotma/toolkit';\n\ntype RemoveUndefined<T> = {\n [K in UnionRequiredKeys<T>]-?: T[K]\n};\n\n/**\n * @returns Object with keys having undefined values.\n * @param value - an object to remove undefined values from.\n */\nexport function removeUndefined<T extends {}>(value: T): RemoveUndefined<T> {\n const result = {} as RemoveUndefined<T>;\n for (const k in value) {\n const v = value[k];\n v !== undefined && ((result as any)[k] = v);\n }\n return result;\n}\n","export function shallowEqual<T extends object>(a: T, b: T): boolean {\n const aKeys = Object.keys(a);\n const bKeys = Object.keys(b);\n return aKeys.length !== bKeys.length\n ? false\n : aKeys.every(aKey => {\n return Object.prototype.hasOwnProperty.call(b, aKey)\n && (a as any)[aKey] === (b as any)[aKey];\n });\n}\n","import { type Computed, computed, type Signal, signal } from '@vbotma/signals';\n\nimport { removeUndefined } from '@/helpers/removeUndefined.js';\nimport { shallowEqual } from '@/helpers/shallowEqual.js';\n\nexport interface StatefulOptions<S> {\n /**\n * The initial state.\n */\n initialState: S;\n /**\n * A function to call whenever the state changes.\n * @param state - updated state.\n */\n onChange: (state: S) => void;\n}\n\nexport class Stateful<S extends object> {\n constructor({ initialState, onChange }: StatefulOptions<S>) {\n this._state = signal(initialState, { equals: shallowEqual });\n this.state = computed(this._state);\n this.state.sub(onChange);\n }\n\n protected readonly _state: Signal<S>;\n\n /**\n * The current state.\n */\n readonly state: Computed<S>;\n\n /**\n * Creates a computed signal based on the state.\n * @param key - a state key to use as a source.\n */\n getter<K extends keyof S>(key: K): Computed<S[K]> {\n return computed(() => this._state()[key]);\n }\n\n /**\n * Updates the state.\n * @param state - updates to apply.\n */\n readonly setState = (state: Partial<S>): void => {\n const nextState = { ...this.state(), ...removeUndefined(state) };\n if (!shallowEqual(nextState, this.state())) {\n this._state.set(nextState);\n }\n };\n\n /**\n * @returns True if specified payload will update the state.\n * @param state\n */\n hasDiff(state: Partial<S>): boolean {\n return !shallowEqual({ ...this.state(), ...removeUndefined(state) }, this.state());\n }\n}\n","//#region src/storages/globalConfig/globalConfig.ts\nlet store$4;\n/**\n* Sets the global configuration.\n*\n* @param config The configuration.\n*/\nfunction setGlobalConfig(config$1) {\n\tstore$4 = {\n\t\t...store$4,\n\t\t...config$1\n\t};\n}\n/**\n* Returns the global configuration.\n*\n* @param config The config to merge.\n*\n* @returns The configuration.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction getGlobalConfig(config$1) {\n\treturn {\n\t\tlang: config$1?.lang ?? store$4?.lang,\n\t\tmessage: config$1?.message,\n\t\tabortEarly: config$1?.abortEarly ?? store$4?.abortEarly,\n\t\tabortPipeEarly: config$1?.abortPipeEarly ?? store$4?.abortPipeEarly\n\t};\n}\n/**\n* Deletes the global configuration.\n*/\nfunction deleteGlobalConfig() {\n\tstore$4 = void 0;\n}\n\n//#endregion\n//#region src/storages/globalMessage/globalMessage.ts\nlet store$3;\n/**\n* Sets a global error message.\n*\n* @param message The error message.\n* @param lang The language of the message.\n*/\nfunction setGlobalMessage(message$1, lang) {\n\tif (!store$3) store$3 = /* @__PURE__ */ new Map();\n\tstore$3.set(lang, message$1);\n}\n/**\n* Returns a global error message.\n*\n* @param lang The language of the message.\n*\n* @returns The error message.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction getGlobalMessage(lang) {\n\treturn store$3?.get(lang);\n}\n/**\n* Deletes a global error message.\n*\n* @param lang The language of the message.\n*/\nfunction deleteGlobalMessage(lang) {\n\tstore$3?.delete(lang);\n}\n\n//#endregion\n//#region src/storages/schemaMessage/schemaMessage.ts\nlet store$2;\n/**\n* Sets a schema error message.\n*\n* @param message The error message.\n* @param lang The language of the message.\n*/\nfunction setSchemaMessage(message$1, lang) {\n\tif (!store$2) store$2 = /* @__PURE__ */ new Map();\n\tstore$2.set(lang, message$1);\n}\n/**\n* Returns a schema error message.\n*\n* @param lang The language of the message.\n*\n* @returns The error message.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction getSchemaMessage(lang) {\n\treturn store$2?.get(lang);\n}\n/**\n* Deletes a schema error message.\n*\n* @param lang The language of the message.\n*/\nfunction deleteSchemaMessage(lang) {\n\tstore$2?.delete(lang);\n}\n\n//#endregion\n//#region src/storages/specificMessage/specificMessage.ts\nlet store$1;\n/**\n* Sets a specific error message.\n*\n* @param reference The identifier reference.\n* @param message The error message.\n* @param lang The language of the message.\n*/\nfunction setSpecificMessage(reference, message$1, lang) {\n\tif (!store$1) store$1 = /* @__PURE__ */ new Map();\n\tif (!store$1.get(reference)) store$1.set(reference, /* @__PURE__ */ new Map());\n\tstore$1.get(reference).set(lang, message$1);\n}\n/**\n* Returns a specific error message.\n*\n* @param reference The identifier reference.\n* @param lang The language of the message.\n*\n* @returns The error message.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction getSpecificMessage(reference, lang) {\n\treturn store$1?.get(reference)?.get(lang);\n}\n/**\n* Deletes a specific error message.\n*\n* @param reference The identifier reference.\n* @param lang The language of the message.\n*/\nfunction deleteSpecificMessage(reference, lang) {\n\tstore$1?.get(reference)?.delete(lang);\n}\n\n//#endregion\n//#region src/utils/_stringify/_stringify.ts\n/**\n* Stringifies an unknown input to a literal or type string.\n*\n* @param input The unknown input.\n*\n* @returns A literal or type string.\n*\n* @internal\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction _stringify(input) {\n\tconst type = typeof input;\n\tif (type === \"string\") return `\"${input}\"`;\n\tif (type === \"number\" || type === \"bigint\" || type === \"boolean\") return `${input}`;\n\tif (type === \"object\" || type === \"function\") return (input && Object.getPrototypeOf(input)?.constructor?.name) ?? \"null\";\n\treturn type;\n}\n\n//#endregion\n//#region src/utils/_addIssue/_addIssue.ts\n/**\n* Adds an issue to the dataset.\n*\n* @param context The issue context.\n* @param label The issue label.\n* @param dataset The input dataset.\n* @param config The configuration.\n* @param other The optional props.\n*\n* @internal\n*/\nfunction _addIssue(context, label, dataset, config$1, other) {\n\tconst input = other && \"input\" in other ? other.input : dataset.value;\n\tconst expected = other?.expected ?? context.expects ?? null;\n\tconst received = other?.received ?? /* @__PURE__ */ _stringify(input);\n\tconst issue = {\n\t\tkind: context.kind,\n\t\ttype: context.type,\n\t\tinput,\n\t\texpected,\n\t\treceived,\n\t\tmessage: `Invalid ${label}: ${expected ? `Expected ${expected} but r` : \"R\"}eceived ${received}`,\n\t\trequirement: context.requirement,\n\t\tpath: other?.path,\n\t\tissues: other?.issues,\n\t\tlang: config$1.lang,\n\t\tabortEarly: config$1.abortEarly,\n\t\tabortPipeEarly: config$1.abortPipeEarly\n\t};\n\tconst isSchema = context.kind === \"schema\";\n\tconst message$1 = other?.message ?? context.message ?? /* @__PURE__ */ getSpecificMessage(context.reference, issue.lang) ?? (isSchema ? /* @__PURE__ */ getSchemaMessage(issue.lang) : null) ?? config$1.message ?? /* @__PURE__ */ getGlobalMessage(issue.lang);\n\tif (message$1 !== void 0) issue.message = typeof message$1 === \"function\" ? message$1(issue) : message$1;\n\tif (isSchema) dataset.typed = false;\n\tif (dataset.issues) dataset.issues.push(issue);\n\telse dataset.issues = [issue];\n}\n\n//#endregion\n//#region src/utils/_getByteCount/_getByteCount.ts\nlet textEncoder;\n/**\n* Returns the byte count of the input.\n*\n* @param input The input to be measured.\n*\n* @returns The byte count.\n*\n* @internal\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction _getByteCount(input) {\n\tif (!textEncoder) textEncoder = new TextEncoder();\n\treturn textEncoder.encode(input).length;\n}\n\n//#endregion\n//#region src/utils/_getGraphemeCount/_getGraphemeCount.ts\nlet segmenter;\n/**\n* Returns the grapheme count of the input.\n*\n* @param input The input to be measured.\n*\n* @returns The grapheme count.\n*\n* @internal\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction _getGraphemeCount(input) {\n\tif (!segmenter) segmenter = new Intl.Segmenter();\n\tconst segments = segmenter.segment(input);\n\tlet count = 0;\n\tfor (const _ of segments) count++;\n\treturn count;\n}\n\n//#endregion\n//#region src/utils/_getLastMetadata/_getLastMetadata.ts\n/**\n* Returns the last top-level value of a given metadata type from a schema\n* using a breadth-first search that starts with the last item in the pipeline.\n*\n* @param schema The schema to search.\n* @param type The metadata type.\n*\n* @returns The value, if any.\n*\n* @internal\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction _getLastMetadata(schema, type) {\n\tif (\"pipe\" in schema) {\n\t\tconst nestedSchemas = [];\n\t\tfor (let index = schema.pipe.length - 1; index >= 0; index--) {\n\t\t\tconst item = schema.pipe[index];\n\t\t\tif (item.kind === \"schema\" && \"pipe\" in item) nestedSchemas.push(item);\n\t\t\telse if (item.kind === \"metadata\" && item.type === type) return item[type];\n\t\t}\n\t\tfor (const nestedSchema of nestedSchemas) {\n\t\t\tconst result = /* @__PURE__ */ _getLastMetadata(nestedSchema, type);\n\t\t\tif (result !== void 0) return result;\n\t\t}\n\t}\n}\n\n//#endregion\n//#region src/utils/_getStandardProps/_getStandardProps.ts\n/**\n* Returns the Standard Schema properties.\n*\n* @param context The schema context.\n*\n* @returns The Standard Schema properties.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction _getStandardProps(context) {\n\treturn {\n\t\tversion: 1,\n\t\tvendor: \"valibot\",\n\t\tvalidate(value$1) {\n\t\t\treturn context[\"~run\"]({ value: value$1 }, /* @__PURE__ */ getGlobalConfig());\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/utils/_getWordCount/_getWordCount.ts\nlet store;\n/**\n* Returns the word count of the input.\n*\n* @param locales The locales to be used.\n* @param input The input to be measured.\n*\n* @returns The word count.\n*\n* @internal\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction _getWordCount(locales, input) {\n\tif (!store) store = /* @__PURE__ */ new Map();\n\tif (!store.get(locales)) store.set(locales, new Intl.Segmenter(locales, { granularity: \"word\" }));\n\tconst segments = store.get(locales).segment(input);\n\tlet count = 0;\n\tfor (const segment of segments) if (segment.isWordLike) count++;\n\treturn count;\n}\n\n//#endregion\n//#region src/utils/_isLuhnAlgo/_isLuhnAlgo.ts\n/**\n* Non-digit regex.\n*/\nconst NON_DIGIT_REGEX = /\\D/gu;\n/**\n* Checks whether a string with numbers corresponds to the luhn algorithm.\n*\n* @param input The input to be checked.\n*\n* @returns Whether input is valid.\n*\n* @internal\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction _isLuhnAlgo(input) {\n\tconst number$1 = input.replace(NON_DIGIT_REGEX, \"\");\n\tlet length$1 = number$1.length;\n\tlet bit = 1;\n\tlet sum = 0;\n\twhile (length$1) {\n\t\tconst value$1 = +number$1[--length$1];\n\t\tbit ^= 1;\n\t\tsum += bit ? [\n\t\t\t0,\n\t\t\t2,\n\t\t\t4,\n\t\t\t6,\n\t\t\t8,\n\t\t\t1,\n\t\t\t3,\n\t\t\t5,\n\t\t\t7,\n\t\t\t9\n\t\t][value$1] : value$1;\n\t}\n\treturn sum % 10 === 0;\n}\n\n//#endregion\n//#region src/utils/_isValidObjectKey/_isValidObjectKey.ts\n/**\n* Disallows inherited object properties and prevents object prototype\n* pollution by disallowing certain keys.\n*\n* @param object The object to check.\n* @param key The key to check.\n*\n* @returns Whether the key is allowed.\n*\n* @internal\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction _isValidObjectKey(object$1, key) {\n\treturn Object.hasOwn(object$1, key) && key !== \"__proto__\" && key !== \"prototype\" && key !== \"constructor\";\n}\n\n//#endregion\n//#region src/utils/_joinExpects/_joinExpects.ts\n/**\n* Joins multiple `expects` values with the given separator.\n*\n* @param values The `expects` values.\n* @param separator The separator.\n*\n* @returns The joined `expects` property.\n*\n* @internal\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction _joinExpects(values$1, separator) {\n\tconst list = [...new Set(values$1)];\n\tif (list.length > 1) return `(${list.join(` ${separator} `)})`;\n\treturn list[0] ?? \"never\";\n}\n\n//#endregion\n//#region src/utils/entriesFromList/entriesFromList.ts\n/**\n* Creates an object entries definition from a list of keys and a schema.\n*\n* @param list A list of keys.\n* @param schema The schema of the keys.\n*\n* @returns The object entries.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction entriesFromList(list, schema) {\n\tconst entries$1 = {};\n\tfor (const key of list) entries$1[key] = schema;\n\treturn entries$1;\n}\n\n//#endregion\n//#region src/utils/entriesFromObjects/entriesFromObjects.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction entriesFromObjects(schemas) {\n\tconst entries$1 = {};\n\tfor (const schema of schemas) Object.assign(entries$1, schema.entries);\n\treturn entries$1;\n}\n\n//#endregion\n//#region src/utils/getDotPath/getDotPath.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction getDotPath(issue) {\n\tif (issue.path) {\n\t\tlet key = \"\";\n\t\tfor (const item of issue.path) if (typeof item.key === \"string\" || typeof item.key === \"number\") if (key) key += `.${item.key}`;\n\t\telse key += item.key;\n\t\telse return null;\n\t\treturn key;\n\t}\n\treturn null;\n}\n\n//#endregion\n//#region src/utils/isOfKind/isOfKind.ts\n/**\n* A generic type guard to check the kind of an object.\n*\n* @param kind The kind to check for.\n* @param object The object to check.\n*\n* @returns Whether it matches.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction isOfKind(kind, object$1) {\n\treturn object$1.kind === kind;\n}\n\n//#endregion\n//#region src/utils/isOfType/isOfType.ts\n/**\n* A generic type guard to check the type of an object.\n*\n* @param type The type to check for.\n* @param object The object to check.\n*\n* @returns Whether it matches.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction isOfType(type, object$1) {\n\treturn object$1.type === type;\n}\n\n//#endregion\n//#region src/utils/isValiError/isValiError.ts\n/**\n* A type guard to check if an error is a ValiError.\n*\n* @param error The error to check.\n*\n* @returns Whether its a ValiError.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction isValiError(error) {\n\treturn error instanceof ValiError;\n}\n\n//#endregion\n//#region src/utils/ValiError/ValiError.ts\n/**\n* A Valibot error with useful information.\n*/\nvar ValiError = class extends Error {\n\t/**\n\t* Creates a Valibot error with useful information.\n\t*\n\t* @param issues The error issues.\n\t*/\n\tconstructor(issues) {\n\t\tsuper(issues[0].message);\n\t\tthis.name = \"ValiError\";\n\t\tthis.issues = issues;\n\t}\n};\n\n//#endregion\n//#region src/actions/args/args.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction args(schema) {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"args\",\n\t\treference: args,\n\t\tasync: false,\n\t\tschema,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tconst func = dataset.value;\n\t\t\tdataset.value = (...args_) => {\n\t\t\t\tconst argsDataset = this.schema[\"~run\"]({ value: args_ }, config$1);\n\t\t\t\tif (argsDataset.issues) throw new ValiError(argsDataset.issues);\n\t\t\t\treturn func(...argsDataset.value);\n\t\t\t};\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/args/argsAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction argsAsync(schema) {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"args\",\n\t\treference: argsAsync,\n\t\tasync: false,\n\t\tschema,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tconst func = dataset.value;\n\t\t\tdataset.value = async (...args$1) => {\n\t\t\t\tconst argsDataset = await schema[\"~run\"]({ value: args$1 }, config$1);\n\t\t\t\tif (argsDataset.issues) throw new ValiError(argsDataset.issues);\n\t\t\t\treturn func(...argsDataset.value);\n\t\t\t};\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/await/awaitAsync.ts\n/**\n* Creates an await transformation action.\n*\n* @returns An await action.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction awaitAsync() {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"await\",\n\t\treference: awaitAsync,\n\t\tasync: true,\n\t\tasync \"~run\"(dataset) {\n\t\t\tdataset.value = await dataset.value;\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/regex.ts\n/**\n* [Base64](https://en.wikipedia.org/wiki/Base64) regex.\n*/\nconst BASE64_REGEX = /^(?:[\\da-z+/]{4})*(?:[\\da-z+/]{2}==|[\\da-z+/]{3}=)?$/iu;\n/**\n* [BIC](https://en.wikipedia.org/wiki/ISO_9362) regex.\n*/\nconst BIC_REGEX = /^[A-Z]{6}(?!00)[\\dA-Z]{2}(?:[\\dA-Z]{3})?$/u;\n/**\n* [Cuid2](https://github.com/paralleldrive/cuid2) regex.\n*/\nconst CUID2_REGEX = /^[a-z][\\da-z]*$/u;\n/**\n* [Decimal](https://en.wikipedia.org/wiki/Decimal) regex.\n*/\nconst DECIMAL_REGEX = /^[+-]?(?:\\d*\\.)?\\d+$/u;\n/**\n* [Digits](https://en.wikipedia.org/wiki/Numerical_digit) regex.\n*/\nconst DIGITS_REGEX = /^\\d+$/u;\n/**\n* [Email address](https://en.wikipedia.org/wiki/Email_address) regex.\n*/\nconst EMAIL_REGEX = /^[\\w+-]+(?:\\.[\\w+-]+)*@[\\da-z]+(?:[.-][\\da-z]+)*\\.[a-z]{2,}$/iu;\n/**\n* Emoji regex from [emoji-regex-xs](https://github.com/slevithan/emoji-regex-xs) v1.0.0 (MIT license).\n*\n* Hint: We decided against the newer `/^\\p{RGI_Emoji}+$/v` regex because it is\n* not supported in older runtimes and does not match all emoji.\n*/\nconst EMOJI_REGEX = /^(?:[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|(?![\\p{Emoji_Modifier_Base}\\u{1F1E6}-\\u{1F1FF}])\\p{Emoji_Presentation}))*)+$/u;\n/**\n* [Hexadecimal](https://en.wikipedia.org/wiki/Hexadecimal) regex.\n*\n* Hint: We decided against the `i` flag for better JSON Schema compatibility.\n*/\nconst HEXADECIMAL_REGEX = /^(?:0[hx])?[\\da-fA-F]+$/u;\n/**\n* [Hex color](https://en.wikipedia.org/wiki/Web_colors#Hex_triplet) regex.\n*\n* Hint: We decided against the `i` flag for better JSON Schema compatibility.\n*/\nconst HEX_COLOR_REGEX = /^#(?:[\\da-fA-F]{3,4}|[\\da-fA-F]{6}|[\\da-fA-F]{8})$/u;\n/**\n* [IMEI](https://en.wikipedia.org/wiki/International_Mobile_Equipment_Identity) regex.\n*/\nconst IMEI_REGEX = /^\\d{15}$|^\\d{2}-\\d{6}-\\d{6}-\\d$/u;\n/**\n* [IPv4](https://en.wikipedia.org/wiki/IPv4) regex.\n*/\nconst IPV4_REGEX = /^(?:(?:[1-9]|1\\d|2[0-4])?\\d|25[0-5])(?:\\.(?:(?:[1-9]|1\\d|2[0-4])?\\d|25[0-5])){3}$/u;\n/**\n* [IPv6](https://en.wikipedia.org/wiki/IPv6) regex.\n*/\nconst IPV6_REGEX = /^(?:(?:[\\da-f]{1,4}:){7}[\\da-f]{1,4}|(?:[\\da-f]{1,4}:){1,7}:|(?:[\\da-f]{1,4}:){1,6}:[\\da-f]{1,4}|(?:[\\da-f]{1,4}:){1,5}(?::[\\da-f]{1,4}){1,2}|(?:[\\da-f]{1,4}:){1,4}(?::[\\da-f]{1,4}){1,3}|(?:[\\da-f]{1,4}:){1,3}(?::[\\da-f]{1,4}){1,4}|(?:[\\da-f]{1,4}:){1,2}(?::[\\da-f]{1,4}){1,5}|[\\da-f]{1,4}:(?::[\\da-f]{1,4}){1,6}|:(?:(?::[\\da-f]{1,4}){1,7}|:)|fe80:(?::[\\da-f]{0,4}){0,4}%[\\da-z]+|::(?:f{4}(?::0{1,4})?:)?(?:(?:25[0-5]|(?:2[0-4]|1?\\d)?\\d)\\.){3}(?:25[0-5]|(?:2[0-4]|1?\\d)?\\d)|(?:[\\da-f]{1,4}:){1,4}:(?:(?:25[0-5]|(?:2[0-4]|1?\\d)?\\d)\\.){3}(?:25[0-5]|(?:2[0-4]|1?\\d)?\\d))$/iu;\n/**\n* [IP](https://en.wikipedia.org/wiki/IP_address) regex.\n*/\nconst IP_REGEX = /^(?:(?:[1-9]|1\\d|2[0-4])?\\d|25[0-5])(?:\\.(?:(?:[1-9]|1\\d|2[0-4])?\\d|25[0-5])){3}$|^(?:(?:[\\da-f]{1,4}:){7}[\\da-f]{1,4}|(?:[\\da-f]{1,4}:){1,7}:|(?:[\\da-f]{1,4}:){1,6}:[\\da-f]{1,4}|(?:[\\da-f]{1,4}:){1,5}(?::[\\da-f]{1,4}){1,2}|(?:[\\da-f]{1,4}:){1,4}(?::[\\da-f]{1,4}){1,3}|(?:[\\da-f]{1,4}:){1,3}(?::[\\da-f]{1,4}){1,4}|(?:[\\da-f]{1,4}:){1,2}(?::[\\da-f]{1,4}){1,5}|[\\da-f]{1,4}:(?::[\\da-f]{1,4}){1,6}|:(?:(?::[\\da-f]{1,4}){1,7}|:)|fe80:(?::[\\da-f]{0,4}){0,4}%[\\da-z]+|::(?:f{4}(?::0{1,4})?:)?(?:(?:25[0-5]|(?:2[0-4]|1?\\d)?\\d)\\.){3}(?:25[0-5]|(?:2[0-4]|1?\\d)?\\d)|(?:[\\da-f]{1,4}:){1,4}:(?:(?:25[0-5]|(?:2[0-4]|1?\\d)?\\d)\\.){3}(?:25[0-5]|(?:2[0-4]|1?\\d)?\\d))$/iu;\n/**\n* [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date regex.\n*/\nconst ISO_DATE_REGEX = /^\\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\\d|0[1-9]|3[01])$/u;\n/**\n* [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time regex.\n*/\nconst ISO_DATE_TIME_REGEX = /^\\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\\d|0[1-9]|3[01])[T ](?:0\\d|1\\d|2[0-3]):[0-5]\\d$/u;\n/**\n* [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time regex.\n*/\nconst ISO_TIME_REGEX = /^(?:0\\d|1\\d|2[0-3]):[0-5]\\d$/u;\n/**\n* [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time with seconds regex.\n*/\nconst ISO_TIME_SECOND_REGEX = /^(?:0\\d|1\\d|2[0-3])(?::[0-5]\\d){2}$/u;\n/**\n* [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp regex.\n*/\nconst ISO_TIMESTAMP_REGEX = /^\\d{4}-(?:0[1-9]|1[0-2])-(?:[12]\\d|0[1-9]|3[01])[T ](?:0\\d|1\\d|2[0-3])(?::[0-5]\\d){2}(?:\\.\\d{1,9})?(?:Z|[+-](?:0\\d|1\\d|2[0-3])(?::?[0-5]\\d)?)$/u;\n/**\n* [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) week regex.\n*/\nconst ISO_WEEK_REGEX = /^\\d{4}-W(?:0[1-9]|[1-4]\\d|5[0-3])$/u;\n/**\n* [MAC](https://en.wikipedia.org/wiki/MAC_address) 48 bit regex.\n*/\nconst MAC48_REGEX = /^(?:[\\da-f]{2}:){5}[\\da-f]{2}$|^(?:[\\da-f]{2}-){5}[\\da-f]{2}$|^(?:[\\da-f]{4}\\.){2}[\\da-f]{4}$/iu;\n/**\n* [MAC](https://en.wikipedia.org/wiki/MAC_address) 64 bit regex.\n*/\nconst MAC64_REGEX = /^(?:[\\da-f]{2}:){7}[\\da-f]{2}$|^(?:[\\da-f]{2}-){7}[\\da-f]{2}$|^(?:[\\da-f]{4}\\.){3}[\\da-f]{4}$|^(?:[\\da-f]{4}:){3}[\\da-f]{4}$/iu;\n/**\n* [MAC](https://en.wikipedia.org/wiki/MAC_address) regex.\n*/\nconst MAC_REGEX = /^(?:[\\da-f]{2}:){5}[\\da-f]{2}$|^(?:[\\da-f]{2}-){5}[\\da-f]{2}$|^(?:[\\da-f]{4}\\.){2}[\\da-f]{4}$|^(?:[\\da-f]{2}:){7}[\\da-f]{2}$|^(?:[\\da-f]{2}-){7}[\\da-f]{2}$|^(?:[\\da-f]{4}\\.){3}[\\da-f]{4}$|^(?:[\\da-f]{4}:){3}[\\da-f]{4}$/iu;\n/**\n* [Nano ID](https://github.com/ai/nanoid) regex.\n*/\nconst NANO_ID_REGEX = /^[\\w-]+$/u;\n/**\n* [Octal](https://en.wikipedia.org/wiki/Octal) regex.\n*/\nconst OCTAL_REGEX = /^(?:0o)?[0-7]+$/u;\n/**\n* [RFC 5322 email address](https://datatracker.ietf.org/doc/html/rfc5322#section-3.4.1) regex.\n*\n* Hint: This regex was taken from the [HTML Living Standard Specification](https://html.spec.whatwg.org/multipage/input.html#valid-e-mail-address) and does not perfectly represent RFC 5322.\n*/\nconst RFC_EMAIL_REGEX = /^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;\n/**\n* [Slug](https://en.wikipedia.org/wiki/Clean_URL#Slug) regex.\n*/\nconst SLUG_REGEX = /^[\\da-z]+(?:[-_][\\da-z]+)*$/u;\n/**\n* [ULID](https://github.com/ulid/spec) regex.\n*\n* Hint: We decided against the `i` flag for better JSON Schema compatibility.\n*/\nconst ULID_REGEX = /^[\\da-hjkmnp-tv-zA-HJKMNP-TV-Z]{26}$/u;\n/**\n* [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) regex.\n*/\nconst UUID_REGEX = /^[\\da-f]{8}(?:-[\\da-f]{4}){3}-[\\da-f]{12}$/iu;\n\n//#endregion\n//#region src/actions/base64/base64.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction base64(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"base64\",\n\t\treference: base64,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement: BASE64_REGEX,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"Base64\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/bic/bic.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction bic(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"bic\",\n\t\treference: bic,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement: BIC_REGEX,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"BIC\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/brand/brand.ts\n/**\n* Creates a brand transformation action.\n*\n* @param name The brand name.\n*\n* @returns A brand action.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction brand(name) {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"brand\",\n\t\treference: brand,\n\t\tasync: false,\n\t\tname,\n\t\t\"~run\"(dataset) {\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/bytes/bytes.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction bytes(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"bytes\",\n\t\treference: bytes,\n\t\tasync: false,\n\t\texpects: `${requirement}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed) {\n\t\t\t\tconst length$1 = /* @__PURE__ */ _getByteCount(dataset.value);\n\t\t\t\tif (length$1 !== this.requirement) _addIssue(this, \"bytes\", dataset, config$1, { received: `${length$1}` });\n\t\t\t}\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/check/check.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction check(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"check\",\n\t\treference: check,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, \"input\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/check/checkAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction checkAsync(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"check\",\n\t\treference: checkAsync,\n\t\tasync: true,\n\t\texpects: null,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !await this.requirement(dataset.value)) _addIssue(this, \"input\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/checkItems/checkItems.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction checkItems(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"check_items\",\n\t\treference: checkItems,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed) for (let index = 0; index < dataset.value.length; index++) {\n\t\t\t\tconst item = dataset.value[index];\n\t\t\t\tif (!this.requirement(item, index, dataset.value)) _addIssue(this, \"item\", dataset, config$1, {\n\t\t\t\t\tinput: item,\n\t\t\t\t\tpath: [{\n\t\t\t\t\t\ttype: \"array\",\n\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\tinput: dataset.value,\n\t\t\t\t\t\tkey: index,\n\t\t\t\t\t\tvalue: item\n\t\t\t\t\t}]\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/checkItems/checkItemsAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction checkItemsAsync(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"check_items\",\n\t\treference: checkItemsAsync,\n\t\tasync: true,\n\t\texpects: null,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed) {\n\t\t\t\tconst requirementResults = await Promise.all(dataset.value.map(this.requirement));\n\t\t\t\tfor (let index = 0; index < dataset.value.length; index++) if (!requirementResults[index]) {\n\t\t\t\t\tconst item = dataset.value[index];\n\t\t\t\t\t_addIssue(this, \"item\", dataset, config$1, {\n\t\t\t\t\t\tinput: item,\n\t\t\t\t\t\tpath: [{\n\t\t\t\t\t\t\ttype: \"array\",\n\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\tinput: dataset.value,\n\t\t\t\t\t\t\tkey: index,\n\t\t\t\t\t\t\tvalue: item\n\t\t\t\t\t\t}]\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/creditCard/creditCard.ts\n/**\n* Credit card regex.\n*/\nconst CREDIT_CARD_REGEX = /^(?:\\d{14,19}|\\d{4}(?: \\d{3,6}){2,4}|\\d{4}(?:-\\d{3,6}){2,4})$/u;\n/**\n* Sanitize regex.\n*/\nconst SANITIZE_REGEX = /[- ]/gu;\n/**\n* Provider regex list.\n*/\nconst PROVIDER_REGEX_LIST = [\n\t/^3[47]\\d{13}$/u,\n\t/^3(?:0[0-5]|[68]\\d)\\d{11,13}$/u,\n\t/^6(?:011|5\\d{2})\\d{12,15}$/u,\n\t/^(?:2131|1800|35\\d{3})\\d{11}$/u,\n\t/^5[1-5]\\d{2}|(?:222\\d|22[3-9]\\d|2[3-6]\\d{2}|27[01]\\d|2720)\\d{12}$/u,\n\t/^(?:6[27]\\d{14,17}|81\\d{14,17})$/u,\n\t/^4\\d{12}(?:\\d{3,6})?$/u\n];\n/* @__NO_SIDE_EFFECTS__ */\nfunction creditCard(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"credit_card\",\n\t\treference: creditCard,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement(input) {\n\t\t\tlet sanitized;\n\t\t\treturn CREDIT_CARD_REGEX.test(input) && (sanitized = input.replace(SANITIZE_REGEX, \"\")) && PROVIDER_REGEX_LIST.some((regex$1) => regex$1.test(sanitized)) && /* @__PURE__ */ _isLuhnAlgo(sanitized);\n\t\t},\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, \"credit card\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/cuid2/cuid2.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction cuid2(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"cuid2\",\n\t\treference: cuid2,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement: CUID2_REGEX,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"Cuid2\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/decimal/decimal.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction decimal(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"decimal\",\n\t\treference: decimal,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement: DECIMAL_REGEX,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"decimal\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/description/description.ts\n/**\n* Creates a description metadata action.\n*\n* @param description_ The description text.\n*\n* @returns A description action.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction description(description_) {\n\treturn {\n\t\tkind: \"metadata\",\n\t\ttype: \"description\",\n\t\treference: description,\n\t\tdescription: description_\n\t};\n}\n\n//#endregion\n//#region src/actions/digits/digits.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction digits(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"digits\",\n\t\treference: digits,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement: DIGITS_REGEX,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"digits\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/email/email.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction email(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"email\",\n\t\treference: email,\n\t\texpects: null,\n\t\tasync: false,\n\t\trequirement: EMAIL_REGEX,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"email\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/emoji/emoji.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction emoji(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"emoji\",\n\t\treference: emoji,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement: EMOJI_REGEX,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"emoji\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/empty/empty.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction empty(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"empty\",\n\t\treference: empty,\n\t\tasync: false,\n\t\texpects: \"0\",\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && dataset.value.length > 0) _addIssue(this, \"length\", dataset, config$1, { received: `${dataset.value.length}` });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/endsWith/endsWith.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction endsWith(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"ends_with\",\n\t\treference: endsWith,\n\t\tasync: false,\n\t\texpects: `\"${requirement}\"`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !dataset.value.endsWith(this.requirement)) _addIssue(this, \"end\", dataset, config$1, { received: `\"${dataset.value.slice(-this.requirement.length)}\"` });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/entries/entries.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction entries(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"entries\",\n\t\treference: entries,\n\t\tasync: false,\n\t\texpects: `${requirement}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (!dataset.typed) return dataset;\n\t\t\tconst count = Object.keys(dataset.value).length;\n\t\t\tif (dataset.typed && count !== this.requirement) _addIssue(this, \"entries\", dataset, config$1, { received: `${count}` });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/everyItem/everyItem.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction everyItem(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"every_item\",\n\t\treference: everyItem,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !dataset.value.every(this.requirement)) _addIssue(this, \"item\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/examples/examples.ts\n/**\n* Creates an examples metadata action.\n*\n* @param examples_ The examples.\n*\n* @returns An examples action.\n*\n* @beta\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction examples(examples_) {\n\treturn {\n\t\tkind: \"metadata\",\n\t\ttype: \"examples\",\n\t\treference: examples,\n\t\texamples: examples_\n\t};\n}\n\n//#endregion\n//#region src/actions/excludes/excludes.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction excludes(requirement, message$1) {\n\tconst received = /* @__PURE__ */ _stringify(requirement);\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"excludes\",\n\t\treference: excludes,\n\t\tasync: false,\n\t\texpects: `!${received}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && dataset.value.includes(this.requirement)) _addIssue(this, \"content\", dataset, config$1, { received });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/filterItems/filterItems.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction filterItems(operation) {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"filter_items\",\n\t\treference: filterItems,\n\t\tasync: false,\n\t\toperation,\n\t\t\"~run\"(dataset) {\n\t\t\tdataset.value = dataset.value.filter(this.operation);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/findItem/findItem.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction findItem(operation) {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"find_item\",\n\t\treference: findItem,\n\t\tasync: false,\n\t\toperation,\n\t\t\"~run\"(dataset) {\n\t\t\tdataset.value = dataset.value.find(this.operation);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/finite/finite.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction finite(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"finite\",\n\t\treference: finite,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement: Number.isFinite,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, \"finite\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/flavor/flavor.ts\n/**\n* Creates a flavor transformation action.\n*\n* @param name The flavor name.\n*\n* @returns A flavor action.\n*\n* @beta\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction flavor(name) {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"flavor\",\n\t\treference: flavor,\n\t\tasync: false,\n\t\tname,\n\t\t\"~run\"(dataset) {\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/graphemes/graphemes.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction graphemes(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"graphemes\",\n\t\treference: graphemes,\n\t\tasync: false,\n\t\texpects: `${requirement}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed) {\n\t\t\t\tconst count = /* @__PURE__ */ _getGraphemeCount(dataset.value);\n\t\t\t\tif (count !== this.requirement) _addIssue(this, \"graphemes\", dataset, config$1, { received: `${count}` });\n\t\t\t}\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/gtValue/gtValue.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction gtValue(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"gt_value\",\n\t\treference: gtValue,\n\t\tasync: false,\n\t\texpects: `>${requirement instanceof Date ? requirement.toJSON() : /* @__PURE__ */ _stringify(requirement)}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !(dataset.value > this.requirement)) _addIssue(this, \"value\", dataset, config$1, { received: dataset.value instanceof Date ? dataset.value.toJSON() : /* @__PURE__ */ _stringify(dataset.value) });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/hash/hash.ts\n/**\n* Hash lengths object.\n*/\nconst HASH_LENGTHS = {\n\tmd4: 32,\n\tmd5: 32,\n\tsha1: 40,\n\tsha256: 64,\n\tsha384: 96,\n\tsha512: 128,\n\tripemd128: 32,\n\tripemd160: 40,\n\ttiger128: 32,\n\ttiger160: 40,\n\ttiger192: 48,\n\tcrc32: 8,\n\tcrc32b: 8,\n\tadler32: 8\n};\n/* @__NO_SIDE_EFFECTS__ */\nfunction hash(types, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"hash\",\n\t\treference: hash,\n\t\texpects: null,\n\t\tasync: false,\n\t\trequirement: RegExp(types.map((type) => `^[a-f0-9]{${HASH_LENGTHS[type]}}$`).join(\"|\"), \"iu\"),\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"hash\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/hexadecimal/hexadecimal.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction hexadecimal(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"hexadecimal\",\n\t\treference: hexadecimal,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement: HEXADECIMAL_REGEX,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"hexadecimal\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/hexColor/hexColor.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction hexColor(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"hex_color\",\n\t\treference: hexColor,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement: HEX_COLOR_REGEX,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"hex color\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/imei/imei.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction imei(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"imei\",\n\t\treference: imei,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement(input) {\n\t\t\treturn IMEI_REGEX.test(input) && /* @__PURE__ */ _isLuhnAlgo(input);\n\t\t},\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, \"IMEI\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/includes/includes.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction includes(requirement, message$1) {\n\tconst expects = /* @__PURE__ */ _stringify(requirement);\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"includes\",\n\t\treference: includes,\n\t\tasync: false,\n\t\texpects,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !dataset.value.includes(this.requirement)) _addIssue(this, \"content\", dataset, config$1, { received: `!${expects}` });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/integer/integer.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction integer(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"integer\",\n\t\treference: integer,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement: Number.isInteger,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, \"integer\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/ip/ip.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction ip(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"ip\",\n\t\treference: ip,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement: IP_REGEX,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"IP\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/ipv4/ipv4.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction ipv4(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"ipv4\",\n\t\treference: ipv4,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement: IPV4_REGEX,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"IPv4\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/ipv6/ipv6.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction ipv6(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"ipv6\",\n\t\treference: ipv6,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement: IPV6_REGEX,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"IPv6\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/isoDate/isoDate.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction isoDate(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"iso_date\",\n\t\treference: isoDate,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement: ISO_DATE_REGEX,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"date\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/isoDateTime/isoDateTime.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction isoDateTime(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"iso_date_time\",\n\t\treference: isoDateTime,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement: ISO_DATE_TIME_REGEX,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"date-time\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/isoTime/isoTime.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction isoTime(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"iso_time\",\n\t\treference: isoTime,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement: ISO_TIME_REGEX,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"time\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/isoTimeSecond/isoTimeSecond.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction isoTimeSecond(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"iso_time_second\",\n\t\treference: isoTimeSecond,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement: ISO_TIME_SECOND_REGEX,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"time-second\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/isoTimestamp/isoTimestamp.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction isoTimestamp(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"iso_timestamp\",\n\t\treference: isoTimestamp,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement: ISO_TIMESTAMP_REGEX,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"timestamp\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/isoWeek/isoWeek.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction isoWeek(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"iso_week\",\n\t\treference: isoWeek,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement: ISO_WEEK_REGEX,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"week\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/length/length.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction length(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"length\",\n\t\treference: length,\n\t\tasync: false,\n\t\texpects: `${requirement}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && dataset.value.length !== this.requirement) _addIssue(this, \"length\", dataset, config$1, { received: `${dataset.value.length}` });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/ltValue/ltValue.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction ltValue(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"lt_value\",\n\t\treference: ltValue,\n\t\tasync: false,\n\t\texpects: `<${requirement instanceof Date ? requirement.toJSON() : /* @__PURE__ */ _stringify(requirement)}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !(dataset.value < this.requirement)) _addIssue(this, \"value\", dataset, config$1, { received: dataset.value instanceof Date ? dataset.value.toJSON() : /* @__PURE__ */ _stringify(dataset.value) });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/mac/mac.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction mac(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"mac\",\n\t\treference: mac,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement: MAC_REGEX,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"MAC\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/mac48/mac48.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction mac48(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"mac48\",\n\t\treference: mac48,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement: MAC48_REGEX,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"48-bit MAC\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/mac64/mac64.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction mac64(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"mac64\",\n\t\treference: mac64,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement: MAC64_REGEX,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"64-bit MAC\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/mapItems/mapItems.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction mapItems(operation) {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"map_items\",\n\t\treference: mapItems,\n\t\tasync: false,\n\t\toperation,\n\t\t\"~run\"(dataset) {\n\t\t\tdataset.value = dataset.value.map(this.operation);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/maxBytes/maxBytes.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction maxBytes(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"max_bytes\",\n\t\treference: maxBytes,\n\t\tasync: false,\n\t\texpects: `<=${requirement}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed) {\n\t\t\t\tconst length$1 = /* @__PURE__ */ _getByteCount(dataset.value);\n\t\t\t\tif (length$1 > this.requirement) _addIssue(this, \"bytes\", dataset, config$1, { received: `${length$1}` });\n\t\t\t}\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/maxEntries/maxEntries.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction maxEntries(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"max_entries\",\n\t\treference: maxEntries,\n\t\tasync: false,\n\t\texpects: `<=${requirement}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (!dataset.typed) return dataset;\n\t\t\tconst count = Object.keys(dataset.value).length;\n\t\t\tif (dataset.typed && count > this.requirement) _addIssue(this, \"entries\", dataset, config$1, { received: `${count}` });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/maxGraphemes/maxGraphemes.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction maxGraphemes(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"max_graphemes\",\n\t\treference: maxGraphemes,\n\t\tasync: false,\n\t\texpects: `<=${requirement}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed) {\n\t\t\t\tconst count = /* @__PURE__ */ _getGraphemeCount(dataset.value);\n\t\t\t\tif (count > this.requirement) _addIssue(this, \"graphemes\", dataset, config$1, { received: `${count}` });\n\t\t\t}\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/maxLength/maxLength.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction maxLength(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"max_length\",\n\t\treference: maxLength,\n\t\tasync: false,\n\t\texpects: `<=${requirement}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && dataset.value.length > this.requirement) _addIssue(this, \"length\", dataset, config$1, { received: `${dataset.value.length}` });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/maxSize/maxSize.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction maxSize(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"max_size\",\n\t\treference: maxSize,\n\t\tasync: false,\n\t\texpects: `<=${requirement}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && dataset.value.size > this.requirement) _addIssue(this, \"size\", dataset, config$1, { received: `${dataset.value.size}` });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/maxValue/maxValue.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction maxValue(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"max_value\",\n\t\treference: maxValue,\n\t\tasync: false,\n\t\texpects: `<=${requirement instanceof Date ? requirement.toJSON() : /* @__PURE__ */ _stringify(requirement)}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !(dataset.value <= this.requirement)) _addIssue(this, \"value\", dataset, config$1, { received: dataset.value instanceof Date ? dataset.value.toJSON() : /* @__PURE__ */ _stringify(dataset.value) });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/maxWords/maxWords.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction maxWords(locales, requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"max_words\",\n\t\treference: maxWords,\n\t\tasync: false,\n\t\texpects: `<=${requirement}`,\n\t\tlocales,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed) {\n\t\t\t\tconst count = /* @__PURE__ */ _getWordCount(this.locales, dataset.value);\n\t\t\t\tif (count > this.requirement) _addIssue(this, \"words\", dataset, config$1, { received: `${count}` });\n\t\t\t}\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/metadata/metadata.ts\n/**\n* Creates a custom metadata action.\n*\n* @param metadata_ The metadata object.\n*\n* @returns A metadata action.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction metadata(metadata_) {\n\treturn {\n\t\tkind: \"metadata\",\n\t\ttype: \"metadata\",\n\t\treference: metadata,\n\t\tmetadata: metadata_\n\t};\n}\n\n//#endregion\n//#region src/actions/mimeType/mimeType.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction mimeType(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"mime_type\",\n\t\treference: mimeType,\n\t\tasync: false,\n\t\texpects: /* @__PURE__ */ _joinExpects(requirement.map((option) => `\"${option}\"`), \"|\"),\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.includes(dataset.value.type)) _addIssue(this, \"MIME type\", dataset, config$1, { received: `\"${dataset.value.type}\"` });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/minBytes/minBytes.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction minBytes(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"min_bytes\",\n\t\treference: minBytes,\n\t\tasync: false,\n\t\texpects: `>=${requirement}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed) {\n\t\t\t\tconst length$1 = /* @__PURE__ */ _getByteCount(dataset.value);\n\t\t\t\tif (length$1 < this.requirement) _addIssue(this, \"bytes\", dataset, config$1, { received: `${length$1}` });\n\t\t\t}\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/minEntries/minEntries.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction minEntries(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"min_entries\",\n\t\treference: minEntries,\n\t\tasync: false,\n\t\texpects: `>=${requirement}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (!dataset.typed) return dataset;\n\t\t\tconst count = Object.keys(dataset.value).length;\n\t\t\tif (dataset.typed && count < this.requirement) _addIssue(this, \"entries\", dataset, config$1, { received: `${count}` });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/minGraphemes/minGraphemes.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction minGraphemes(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"min_graphemes\",\n\t\treference: minGraphemes,\n\t\tasync: false,\n\t\texpects: `>=${requirement}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed) {\n\t\t\t\tconst count = /* @__PURE__ */ _getGraphemeCount(dataset.value);\n\t\t\t\tif (count < this.requirement) _addIssue(this, \"graphemes\", dataset, config$1, { received: `${count}` });\n\t\t\t}\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/minLength/minLength.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction minLength(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"min_length\",\n\t\treference: minLength,\n\t\tasync: false,\n\t\texpects: `>=${requirement}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && dataset.value.length < this.requirement) _addIssue(this, \"length\", dataset, config$1, { received: `${dataset.value.length}` });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/minSize/minSize.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction minSize(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"min_size\",\n\t\treference: minSize,\n\t\tasync: false,\n\t\texpects: `>=${requirement}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && dataset.value.size < this.requirement) _addIssue(this, \"size\", dataset, config$1, { received: `${dataset.value.size}` });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/minValue/minValue.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction minValue(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"min_value\",\n\t\treference: minValue,\n\t\tasync: false,\n\t\texpects: `>=${requirement instanceof Date ? requirement.toJSON() : /* @__PURE__ */ _stringify(requirement)}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !(dataset.value >= this.requirement)) _addIssue(this, \"value\", dataset, config$1, { received: dataset.value instanceof Date ? dataset.value.toJSON() : /* @__PURE__ */ _stringify(dataset.value) });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/minWords/minWords.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction minWords(locales, requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"min_words\",\n\t\treference: minWords,\n\t\tasync: false,\n\t\texpects: `>=${requirement}`,\n\t\tlocales,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed) {\n\t\t\t\tconst count = /* @__PURE__ */ _getWordCount(this.locales, dataset.value);\n\t\t\t\tif (count < this.requirement) _addIssue(this, \"words\", dataset, config$1, { received: `${count}` });\n\t\t\t}\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/multipleOf/multipleOf.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction multipleOf(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"multiple_of\",\n\t\treference: multipleOf,\n\t\tasync: false,\n\t\texpects: `%${requirement}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && dataset.value % this.requirement != 0) _addIssue(this, \"multiple\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/nanoid/nanoid.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction nanoid(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"nanoid\",\n\t\treference: nanoid,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement: NANO_ID_REGEX,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"Nano ID\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/nonEmpty/nonEmpty.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction nonEmpty(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"non_empty\",\n\t\treference: nonEmpty,\n\t\tasync: false,\n\t\texpects: \"!0\",\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && dataset.value.length === 0) _addIssue(this, \"length\", dataset, config$1, { received: \"0\" });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/normalize/normalize.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction normalize(form) {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"normalize\",\n\t\treference: normalize,\n\t\tasync: false,\n\t\tform,\n\t\t\"~run\"(dataset) {\n\t\t\tdataset.value = dataset.value.normalize(this.form);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/notBytes/notBytes.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction notBytes(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"not_bytes\",\n\t\treference: notBytes,\n\t\tasync: false,\n\t\texpects: `!${requirement}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed) {\n\t\t\t\tconst length$1 = /* @__PURE__ */ _getByteCount(dataset.value);\n\t\t\t\tif (length$1 === this.requirement) _addIssue(this, \"bytes\", dataset, config$1, { received: `${length$1}` });\n\t\t\t}\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/notEntries/notEntries.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction notEntries(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"not_entries\",\n\t\treference: notEntries,\n\t\tasync: false,\n\t\texpects: `!${requirement}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (!dataset.typed) return dataset;\n\t\t\tconst count = Object.keys(dataset.value).length;\n\t\t\tif (dataset.typed && count === this.requirement) _addIssue(this, \"entries\", dataset, config$1, { received: `${count}` });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/notGraphemes/notGraphemes.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction notGraphemes(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"not_graphemes\",\n\t\treference: notGraphemes,\n\t\tasync: false,\n\t\texpects: `!${requirement}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed) {\n\t\t\t\tconst count = /* @__PURE__ */ _getGraphemeCount(dataset.value);\n\t\t\t\tif (count === this.requirement) _addIssue(this, \"graphemes\", dataset, config$1, { received: `${count}` });\n\t\t\t}\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/notLength/notLength.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction notLength(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"not_length\",\n\t\treference: notLength,\n\t\tasync: false,\n\t\texpects: `!${requirement}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && dataset.value.length === this.requirement) _addIssue(this, \"length\", dataset, config$1, { received: `${dataset.value.length}` });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/notSize/notSize.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction notSize(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"not_size\",\n\t\treference: notSize,\n\t\tasync: false,\n\t\texpects: `!${requirement}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && dataset.value.size === this.requirement) _addIssue(this, \"size\", dataset, config$1, { received: `${dataset.value.size}` });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/notValue/notValue.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction notValue(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"not_value\",\n\t\treference: notValue,\n\t\tasync: false,\n\t\texpects: requirement instanceof Date ? `!${requirement.toJSON()}` : `!${/* @__PURE__ */ _stringify(requirement)}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && this.requirement <= dataset.value && this.requirement >= dataset.value) _addIssue(this, \"value\", dataset, config$1, { received: dataset.value instanceof Date ? dataset.value.toJSON() : /* @__PURE__ */ _stringify(dataset.value) });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/notValues/notValues.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction notValues(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"not_values\",\n\t\treference: notValues,\n\t\tasync: false,\n\t\texpects: `!${/* @__PURE__ */ _joinExpects(requirement.map((value$1) => value$1 instanceof Date ? value$1.toJSON() : /* @__PURE__ */ _stringify(value$1)), \"|\")}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && this.requirement.some((value$1) => value$1 <= dataset.value && value$1 >= dataset.value)) _addIssue(this, \"value\", dataset, config$1, { received: dataset.value instanceof Date ? dataset.value.toJSON() : /* @__PURE__ */ _stringify(dataset.value) });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/notWords/notWords.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction notWords(locales, requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"not_words\",\n\t\treference: notWords,\n\t\tasync: false,\n\t\texpects: `!${requirement}`,\n\t\tlocales,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed) {\n\t\t\t\tconst count = /* @__PURE__ */ _getWordCount(this.locales, dataset.value);\n\t\t\t\tif (count === this.requirement) _addIssue(this, \"words\", dataset, config$1, { received: `${count}` });\n\t\t\t}\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/octal/octal.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction octal(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"octal\",\n\t\treference: octal,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement: OCTAL_REGEX,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"octal\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/parseJson/parseJson.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction parseJson(config$1, message$1) {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"parse_json\",\n\t\treference: parseJson,\n\t\tconfig: config$1,\n\t\tmessage: message$1,\n\t\tasync: false,\n\t\t\"~run\"(dataset, config$2) {\n\t\t\ttry {\n\t\t\t\tdataset.value = JSON.parse(dataset.value, this.config?.reviver);\n\t\t\t} catch (error) {\n\t\t\t\tif (error instanceof Error) {\n\t\t\t\t\t_addIssue(this, \"JSON\", dataset, config$2, { received: `\"${error.message}\"` });\n\t\t\t\t\tdataset.typed = false;\n\t\t\t\t} else throw error;\n\t\t\t}\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/partialCheck/utils/_isPartiallyTyped/_isPartiallyTyped.ts\n/**\n* Checks if a dataset is partially typed.\n*\n* @param dataset The dataset to check.\n* @param paths The paths to check.\n*\n* @returns Whether it is partially typed.\n*\n* @internal\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction _isPartiallyTyped(dataset, paths) {\n\tif (dataset.issues) for (const path of paths) for (const issue of dataset.issues) {\n\t\tlet typed = false;\n\t\tconst bound = Math.min(path.length, issue.path?.length ?? 0);\n\t\tfor (let index = 0; index < bound; index++) if (path[index] !== issue.path[index].key && (path[index] !== \"$\" || issue.path[index].type !== \"array\")) {\n\t\t\ttyped = true;\n\t\t\tbreak;\n\t\t}\n\t\tif (!typed) return false;\n\t}\n\treturn true;\n}\n\n//#endregion\n//#region src/actions/partialCheck/partialCheck.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction partialCheck(paths, requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"partial_check\",\n\t\treference: partialCheck,\n\t\tasync: false,\n\t\texpects: null,\n\t\tpaths,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif ((dataset.typed || /* @__PURE__ */ _isPartiallyTyped(dataset, paths)) && !this.requirement(dataset.value)) _addIssue(this, \"input\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/partialCheck/partialCheckAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction partialCheckAsync(paths, requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"partial_check\",\n\t\treference: partialCheckAsync,\n\t\tasync: true,\n\t\texpects: null,\n\t\tpaths,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tif ((dataset.typed || /* @__PURE__ */ _isPartiallyTyped(dataset, paths)) && !await this.requirement(dataset.value)) _addIssue(this, \"input\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/rawCheck/rawCheck.ts\n/**\n* Creates a raw check validation action.\n*\n* @param action The validation action.\n*\n* @returns A raw check action.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction rawCheck(action) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"raw_check\",\n\t\treference: rawCheck,\n\t\tasync: false,\n\t\texpects: null,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\taction({\n\t\t\t\tdataset,\n\t\t\t\tconfig: config$1,\n\t\t\t\taddIssue: (info) => _addIssue(this, info?.label ?? \"input\", dataset, config$1, info)\n\t\t\t});\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/rawCheck/rawCheckAsync.ts\n/**\n* Creates a raw check validation action.\n*\n* @param action The validation action.\n*\n* @returns A raw check action.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction rawCheckAsync(action) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"raw_check\",\n\t\treference: rawCheckAsync,\n\t\tasync: true,\n\t\texpects: null,\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tawait action({\n\t\t\t\tdataset,\n\t\t\t\tconfig: config$1,\n\t\t\t\taddIssue: (info) => _addIssue(this, info?.label ?? \"input\", dataset, config$1, info)\n\t\t\t});\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/rawTransform/rawTransform.ts\n/**\n* Creates a raw transformation action.\n*\n* @param action The transformation action.\n*\n* @returns A raw transform action.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction rawTransform(action) {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"raw_transform\",\n\t\treference: rawTransform,\n\t\tasync: false,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tconst output = action({\n\t\t\t\tdataset,\n\t\t\t\tconfig: config$1,\n\t\t\t\taddIssue: (info) => _addIssue(this, info?.label ?? \"input\", dataset, config$1, info),\n\t\t\t\tNEVER: null\n\t\t\t});\n\t\t\tif (dataset.issues) dataset.typed = false;\n\t\t\telse dataset.value = output;\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/rawTransform/rawTransformAsync.ts\n/**\n* Creates a raw transformation action.\n*\n* @param action The transformation action.\n*\n* @returns A raw transform action.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction rawTransformAsync(action) {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"raw_transform\",\n\t\treference: rawTransformAsync,\n\t\tasync: true,\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tconst output = await action({\n\t\t\t\tdataset,\n\t\t\t\tconfig: config$1,\n\t\t\t\taddIssue: (info) => _addIssue(this, info?.label ?? \"input\", dataset, config$1, info),\n\t\t\t\tNEVER: null\n\t\t\t});\n\t\t\tif (dataset.issues) dataset.typed = false;\n\t\t\telse dataset.value = output;\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/readonly/readonly.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction readonly() {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"readonly\",\n\t\treference: readonly,\n\t\tasync: false,\n\t\t\"~run\"(dataset) {\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/reduceItems/reduceItems.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction reduceItems(operation, initial) {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"reduce_items\",\n\t\treference: reduceItems,\n\t\tasync: false,\n\t\toperation,\n\t\tinitial,\n\t\t\"~run\"(dataset) {\n\t\t\tdataset.value = dataset.value.reduce(this.operation, this.initial);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/regex/regex.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction regex(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"regex\",\n\t\treference: regex,\n\t\tasync: false,\n\t\texpects: `${requirement}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"format\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/returns/returns.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction returns(schema) {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"returns\",\n\t\treference: returns,\n\t\tasync: false,\n\t\tschema,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tconst func = dataset.value;\n\t\t\tdataset.value = (...args_) => {\n\t\t\t\tconst returnsDataset = this.schema[\"~run\"]({ value: func(...args_) }, config$1);\n\t\t\t\tif (returnsDataset.issues) throw new ValiError(returnsDataset.issues);\n\t\t\t\treturn returnsDataset.value;\n\t\t\t};\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/returns/returnsAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction returnsAsync(schema) {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"returns\",\n\t\treference: returnsAsync,\n\t\tasync: false,\n\t\tschema,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tconst func = dataset.value;\n\t\t\tdataset.value = async (...args_) => {\n\t\t\t\tconst returnsDataset = await this.schema[\"~run\"]({ value: await func(...args_) }, config$1);\n\t\t\t\tif (returnsDataset.issues) throw new ValiError(returnsDataset.issues);\n\t\t\t\treturn returnsDataset.value;\n\t\t\t};\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/rfcEmail/rfcEmail.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction rfcEmail(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"rfc_email\",\n\t\treference: rfcEmail,\n\t\texpects: null,\n\t\tasync: false,\n\t\trequirement: RFC_EMAIL_REGEX,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"email\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/safeInteger/safeInteger.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction safeInteger(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"safe_integer\",\n\t\treference: safeInteger,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement: Number.isSafeInteger,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, \"safe integer\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/size/size.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction size(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"size\",\n\t\treference: size,\n\t\tasync: false,\n\t\texpects: `${requirement}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && dataset.value.size !== this.requirement) _addIssue(this, \"size\", dataset, config$1, { received: `${dataset.value.size}` });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/slug/slug.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction slug(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"slug\",\n\t\treference: slug,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement: SLUG_REGEX,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"slug\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/someItem/someItem.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction someItem(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"some_item\",\n\t\treference: someItem,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !dataset.value.some(this.requirement)) _addIssue(this, \"item\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/sortItems/sortItems.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction sortItems(operation) {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"sort_items\",\n\t\treference: sortItems,\n\t\tasync: false,\n\t\toperation,\n\t\t\"~run\"(dataset) {\n\t\t\tdataset.value = dataset.value.sort(this.operation);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/startsWith/startsWith.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction startsWith(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"starts_with\",\n\t\treference: startsWith,\n\t\tasync: false,\n\t\texpects: `\"${requirement}\"`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !dataset.value.startsWith(this.requirement)) _addIssue(this, \"start\", dataset, config$1, { received: `\"${dataset.value.slice(0, this.requirement.length)}\"` });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/stringifyJson/stringifyJson.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction stringifyJson(config$1, message$1) {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"stringify_json\",\n\t\treference: stringifyJson,\n\t\tmessage: message$1,\n\t\tconfig: config$1,\n\t\tasync: false,\n\t\t\"~run\"(dataset, config$2) {\n\t\t\ttry {\n\t\t\t\tconst output = JSON.stringify(dataset.value, this.config?.replacer, this.config?.space);\n\t\t\t\tif (output === void 0) {\n\t\t\t\t\t_addIssue(this, \"JSON\", dataset, config$2);\n\t\t\t\t\tdataset.typed = false;\n\t\t\t\t}\n\t\t\t\tdataset.value = output;\n\t\t\t} catch (error) {\n\t\t\t\tif (error instanceof Error) {\n\t\t\t\t\t_addIssue(this, \"JSON\", dataset, config$2, { received: `\"${error.message}\"` });\n\t\t\t\t\tdataset.typed = false;\n\t\t\t\t} else throw error;\n\t\t\t}\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/title/title.ts\n/**\n* Creates a title metadata action.\n*\n* @param title_ The title text.\n*\n* @returns A title action.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction title(title_) {\n\treturn {\n\t\tkind: \"metadata\",\n\t\ttype: \"title\",\n\t\treference: title,\n\t\ttitle: title_\n\t};\n}\n\n//#endregion\n//#region src/actions/toBigint/toBigint.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction toBigint(message$1) {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"to_bigint\",\n\t\treference: toBigint,\n\t\tasync: false,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\ttry {\n\t\t\t\tdataset.value = BigInt(dataset.value);\n\t\t\t} catch {\n\t\t\t\t_addIssue(this, \"bigint\", dataset, config$1);\n\t\t\t\tdataset.typed = false;\n\t\t\t}\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/toBoolean/toBoolean.ts\n/**\n* Creates a to boolean transformation action.\n*\n* @returns A to boolean action.\n*\n* @beta\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction toBoolean() {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"to_boolean\",\n\t\treference: toBoolean,\n\t\tasync: false,\n\t\t\"~run\"(dataset) {\n\t\t\tdataset.value = Boolean(dataset.value);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/toDate/toDate.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction toDate(message$1) {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"to_date\",\n\t\treference: toDate,\n\t\tasync: false,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\ttry {\n\t\t\t\tdataset.value = new Date(dataset.value);\n\t\t\t\tif (isNaN(dataset.value)) {\n\t\t\t\t\t_addIssue(this, \"date\", dataset, config$1, { received: \"\\\"Invalid Date\\\"\" });\n\t\t\t\t\tdataset.typed = false;\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t_addIssue(this, \"date\", dataset, config$1);\n\t\t\t\tdataset.typed = false;\n\t\t\t}\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/toLowerCase/toLowerCase.ts\n/**\n* Creates a to lower case transformation action.\n*\n* @returns A to lower case action.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction toLowerCase() {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"to_lower_case\",\n\t\treference: toLowerCase,\n\t\tasync: false,\n\t\t\"~run\"(dataset) {\n\t\t\tdataset.value = dataset.value.toLowerCase();\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/toMaxValue/toMaxValue.ts\n/**\n* Creates a to max value transformation action.\n*\n* @param requirement The maximum value.\n*\n* @returns A to max value action.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction toMaxValue(requirement) {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"to_max_value\",\n\t\treference: toMaxValue,\n\t\tasync: false,\n\t\trequirement,\n\t\t\"~run\"(dataset) {\n\t\t\tdataset.value = dataset.value > this.requirement ? this.requirement : dataset.value;\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/toMinValue/toMinValue.ts\n/**\n* Creates a to min value transformation action.\n*\n* @param requirement The minimum value.\n*\n* @returns A to min value action.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction toMinValue(requirement) {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"to_min_value\",\n\t\treference: toMinValue,\n\t\tasync: false,\n\t\trequirement,\n\t\t\"~run\"(dataset) {\n\t\t\tdataset.value = dataset.value < this.requirement ? this.requirement : dataset.value;\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/toNumber/toNumber.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction toNumber(message$1) {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"to_number\",\n\t\treference: toNumber,\n\t\tasync: false,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\ttry {\n\t\t\t\tdataset.value = Number(dataset.value);\n\t\t\t\tif (isNaN(dataset.value)) {\n\t\t\t\t\t_addIssue(this, \"number\", dataset, config$1);\n\t\t\t\t\tdataset.typed = false;\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t_addIssue(this, \"number\", dataset, config$1);\n\t\t\t\tdataset.typed = false;\n\t\t\t}\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/toString/toString.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction toString(message$1) {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"to_string\",\n\t\treference: toString,\n\t\tasync: false,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\ttry {\n\t\t\t\tdataset.value = String(dataset.value);\n\t\t\t} catch {\n\t\t\t\t_addIssue(this, \"string\", dataset, config$1);\n\t\t\t\tdataset.typed = false;\n\t\t\t}\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/toUpperCase/toUpperCase.ts\n/**\n* Creates a to upper case transformation action.\n*\n* @returns A to upper case action.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction toUpperCase() {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"to_upper_case\",\n\t\treference: toUpperCase,\n\t\tasync: false,\n\t\t\"~run\"(dataset) {\n\t\t\tdataset.value = dataset.value.toUpperCase();\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/transform/transform.ts\n/**\n* Creates a custom transformation action.\n*\n* @param operation The transformation operation.\n*\n* @returns A transform action.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction transform(operation) {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"transform\",\n\t\treference: transform,\n\t\tasync: false,\n\t\toperation,\n\t\t\"~run\"(dataset) {\n\t\t\tdataset.value = this.operation(dataset.value);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/transform/transformAsync.ts\n/**\n* Creates a custom transformation action.\n*\n* @param operation The transformation operation.\n*\n* @returns A transform action.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction transformAsync(operation) {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"transform\",\n\t\treference: transformAsync,\n\t\tasync: true,\n\t\toperation,\n\t\tasync \"~run\"(dataset) {\n\t\t\tdataset.value = await this.operation(dataset.value);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/trim/trim.ts\n/**\n* Creates a trim transformation action.\n*\n* @returns A trim action.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction trim() {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"trim\",\n\t\treference: trim,\n\t\tasync: false,\n\t\t\"~run\"(dataset) {\n\t\t\tdataset.value = dataset.value.trim();\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/trimEnd/trimEnd.ts\n/**\n* Creates a trim end transformation action.\n*\n* @returns A trim end action.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction trimEnd() {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"trim_end\",\n\t\treference: trimEnd,\n\t\tasync: false,\n\t\t\"~run\"(dataset) {\n\t\t\tdataset.value = dataset.value.trimEnd();\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/trimStart/trimStart.ts\n/**\n* Creates a trim start transformation action.\n*\n* @returns A trim start action.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction trimStart() {\n\treturn {\n\t\tkind: \"transformation\",\n\t\ttype: \"trim_start\",\n\t\treference: trimStart,\n\t\tasync: false,\n\t\t\"~run\"(dataset) {\n\t\t\tdataset.value = dataset.value.trimStart();\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/ulid/ulid.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction ulid(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"ulid\",\n\t\treference: ulid,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement: ULID_REGEX,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"ULID\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/url/url.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction url(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"url\",\n\t\treference: url,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement(input) {\n\t\t\ttry {\n\t\t\t\tnew URL(input);\n\t\t\t\treturn true;\n\t\t\t} catch {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t},\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement(dataset.value)) _addIssue(this, \"URL\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/uuid/uuid.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction uuid(message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"uuid\",\n\t\treference: uuid,\n\t\tasync: false,\n\t\texpects: null,\n\t\trequirement: UUID_REGEX,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.test(dataset.value)) _addIssue(this, \"UUID\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/value/value.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction value(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"value\",\n\t\treference: value,\n\t\tasync: false,\n\t\texpects: requirement instanceof Date ? requirement.toJSON() : /* @__PURE__ */ _stringify(requirement),\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !(this.requirement <= dataset.value && this.requirement >= dataset.value)) _addIssue(this, \"value\", dataset, config$1, { received: dataset.value instanceof Date ? dataset.value.toJSON() : /* @__PURE__ */ _stringify(dataset.value) });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/values/values.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction values(requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"values\",\n\t\treference: values,\n\t\tasync: false,\n\t\texpects: `${/* @__PURE__ */ _joinExpects(requirement.map((value$1) => value$1 instanceof Date ? value$1.toJSON() : /* @__PURE__ */ _stringify(value$1)), \"|\")}`,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed && !this.requirement.some((value$1) => value$1 <= dataset.value && value$1 >= dataset.value)) _addIssue(this, \"value\", dataset, config$1, { received: dataset.value instanceof Date ? dataset.value.toJSON() : /* @__PURE__ */ _stringify(dataset.value) });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/actions/words/words.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction words(locales, requirement, message$1) {\n\treturn {\n\t\tkind: \"validation\",\n\t\ttype: \"words\",\n\t\treference: words,\n\t\tasync: false,\n\t\texpects: `${requirement}`,\n\t\tlocales,\n\t\trequirement,\n\t\tmessage: message$1,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.typed) {\n\t\t\t\tconst count = /* @__PURE__ */ _getWordCount(this.locales, dataset.value);\n\t\t\t\tif (count !== this.requirement) _addIssue(this, \"words\", dataset, config$1, { received: `${count}` });\n\t\t\t}\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/methods/assert/assert.ts\n/**\n* Checks if the input matches the schema. As this is an assertion function, it\n* can be used as a type guard.\n*\n* @param schema The schema to be used.\n* @param input The input to be tested.\n*/\nfunction assert(schema, input) {\n\tconst issues = schema[\"~run\"]({ value: input }, { abortEarly: true }).issues;\n\tif (issues) throw new ValiError(issues);\n}\n\n//#endregion\n//#region src/methods/config/config.ts\n/**\n* Changes the local configuration of a schema.\n*\n* @param schema The schema to configure.\n* @param config The parse configuration.\n*\n* @returns The configured schema.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction config(schema, config$1) {\n\treturn {\n\t\t...schema,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config_) {\n\t\t\treturn schema[\"~run\"](dataset, {\n\t\t\t\t...config_,\n\t\t\t\t...config$1\n\t\t\t});\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/methods/getFallback/getFallback.ts\n/**\n* Returns the fallback value of the schema.\n*\n* @param schema The schema to get it from.\n* @param dataset The output dataset if available.\n* @param config The config if available.\n*\n* @returns The fallback value.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction getFallback(schema, dataset, config$1) {\n\treturn typeof schema.fallback === \"function\" ? schema.fallback(dataset, config$1) : schema.fallback;\n}\n\n//#endregion\n//#region src/methods/fallback/fallback.ts\n/**\n* Returns a fallback value as output if the input does not match the schema.\n*\n* @param schema The schema to catch.\n* @param fallback The fallback value.\n*\n* @returns The passed schema.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction fallback(schema, fallback$1) {\n\treturn {\n\t\t...schema,\n\t\tfallback: fallback$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tconst outputDataset = schema[\"~run\"](dataset, config$1);\n\t\t\treturn outputDataset.issues ? {\n\t\t\t\ttyped: true,\n\t\t\t\tvalue: /* @__PURE__ */ getFallback(this, outputDataset, config$1)\n\t\t\t} : outputDataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/methods/fallback/fallbackAsync.ts\n/**\n* Returns a fallback value as output if the input does not match the schema.\n*\n* @param schema The schema to catch.\n* @param fallback The fallback value.\n*\n* @returns The passed schema.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction fallbackAsync(schema, fallback$1) {\n\treturn {\n\t\t...schema,\n\t\tfallback: fallback$1,\n\t\tasync: true,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tconst outputDataset = await schema[\"~run\"](dataset, config$1);\n\t\t\treturn outputDataset.issues ? {\n\t\t\t\ttyped: true,\n\t\t\t\tvalue: await /* @__PURE__ */ getFallback(this, outputDataset, config$1)\n\t\t\t} : outputDataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/methods/flatten/flatten.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction flatten(issues) {\n\tconst flatErrors = {};\n\tfor (const issue of issues) if (issue.path) {\n\t\tconst dotPath = /* @__PURE__ */ getDotPath(issue);\n\t\tif (dotPath) {\n\t\t\tif (!flatErrors.nested) flatErrors.nested = {};\n\t\t\tif (flatErrors.nested[dotPath]) flatErrors.nested[dotPath].push(issue.message);\n\t\t\telse flatErrors.nested[dotPath] = [issue.message];\n\t\t} else if (flatErrors.other) flatErrors.other.push(issue.message);\n\t\telse flatErrors.other = [issue.message];\n\t} else if (flatErrors.root) flatErrors.root.push(issue.message);\n\telse flatErrors.root = [issue.message];\n\treturn flatErrors;\n}\n\n//#endregion\n//#region src/methods/forward/forward.ts\n/**\n* Forwards the issues of the passed validation action.\n*\n* @param action The validation action.\n* @param path The path to forward the issues to.\n*\n* @returns The modified action.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction forward(action, path) {\n\treturn {\n\t\t...action,\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tconst prevIssues = dataset.issues && [...dataset.issues];\n\t\t\tdataset = action[\"~run\"](dataset, config$1);\n\t\t\tif (dataset.issues) {\n\t\t\t\tfor (const issue of dataset.issues) if (!prevIssues?.includes(issue)) {\n\t\t\t\t\tlet pathInput = dataset.value;\n\t\t\t\t\tfor (const key of path) {\n\t\t\t\t\t\tconst pathValue = pathInput[key];\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"unknown\",\n\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\tinput: pathInput,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tvalue: pathValue\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (issue.path) issue.path.push(pathItem);\n\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\tif (!pathValue) break;\n\t\t\t\t\t\tpathInput = pathValue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/methods/forward/forwardAsync.ts\n/**\n* Forwards the issues of the passed validation action.\n*\n* @param action The validation action.\n* @param path The path to forward the issues to.\n*\n* @returns The modified action.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction forwardAsync(action, path) {\n\treturn {\n\t\t...action,\n\t\tasync: true,\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tconst prevIssues = dataset.issues && [...dataset.issues];\n\t\t\tdataset = await action[\"~run\"](dataset, config$1);\n\t\t\tif (dataset.issues) {\n\t\t\t\tfor (const issue of dataset.issues) if (!prevIssues?.includes(issue)) {\n\t\t\t\t\tlet pathInput = dataset.value;\n\t\t\t\t\tfor (const key of path) {\n\t\t\t\t\t\tconst pathValue = pathInput[key];\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"unknown\",\n\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\tinput: pathInput,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tvalue: pathValue\n\t\t\t\t\t\t};\n\t\t\t\t\t\tif (issue.path) issue.path.push(pathItem);\n\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\tif (!pathValue) break;\n\t\t\t\t\t\tpathInput = pathValue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/methods/getDefault/getDefault.ts\n/**\n* Returns the default value of the schema.\n*\n* @param schema The schema to get it from.\n* @param dataset The input dataset if available.\n* @param config The config if available.\n*\n* @returns The default value.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction getDefault(schema, dataset, config$1) {\n\treturn typeof schema.default === \"function\" ? schema.default(dataset, config$1) : schema.default;\n}\n\n//#endregion\n//#region src/methods/getDefaults/getDefaults.ts\n/**\n* Returns the default values of the schema.\n*\n* Hint: The difference to `getDefault` is that for object and tuple schemas\n* this function recursively returns the default values of the subschemas\n* instead of `undefined`.\n*\n* @param schema The schema to get them from.\n*\n* @returns The default values.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction getDefaults(schema) {\n\tif (\"entries\" in schema) {\n\t\tconst object$1 = {};\n\t\tfor (const key in schema.entries) object$1[key] = /* @__PURE__ */ getDefaults(schema.entries[key]);\n\t\treturn object$1;\n\t}\n\tif (\"items\" in schema) return schema.items.map(getDefaults);\n\treturn /* @__PURE__ */ getDefault(schema);\n}\n\n//#endregion\n//#region src/methods/getDefaults/getDefaultsAsync.ts\n/**\n* Returns the default values of the schema.\n*\n* Hint: The difference to `getDefault` is that for object and tuple schemas\n* this function recursively returns the default values of the subschemas\n* instead of `undefined`.\n*\n* @param schema The schema to get them from.\n*\n* @returns The default values.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nasync function getDefaultsAsync(schema) {\n\tif (\"entries\" in schema) return Object.fromEntries(await Promise.all(Object.entries(schema.entries).map(async ([key, value$1]) => [key, await /* @__PURE__ */ getDefaultsAsync(value$1)])));\n\tif (\"items\" in schema) return Promise.all(schema.items.map(getDefaultsAsync));\n\treturn /* @__PURE__ */ getDefault(schema);\n}\n\n//#endregion\n//#region src/methods/getDescription/getDescription.ts\n/**\n* Returns the description of the schema.\n*\n* If multiple descriptions are defined, the last one of the highest level is\n* returned. If no description is defined, `undefined` is returned.\n*\n* @param schema The schema to get the description from.\n*\n* @returns The description, if any.\n*\n* @beta\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction getDescription(schema) {\n\treturn /* @__PURE__ */ _getLastMetadata(schema, \"description\");\n}\n\n//#endregion\n//#region src/methods/getExamples/getExamples.ts\n/**\n* Returns the examples of a schema.\n*\n* If multiple examples are defined, it concatenates them using depth-first\n* search. If no examples are defined, an empty array is returned.\n*\n* @param schema The schema to get the examples from.\n*\n* @returns The examples, if any.\n*\n* @beta\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction getExamples(schema) {\n\tconst examples$1 = [];\n\tfunction depthFirstCollect(schema$1) {\n\t\tif (\"pipe\" in schema$1) {\n\t\t\tfor (const item of schema$1.pipe) if (item.kind === \"schema\" && \"pipe\" in item) depthFirstCollect(item);\n\t\t\telse if (item.kind === \"metadata\" && item.type === \"examples\") examples$1.push(...item.examples);\n\t\t}\n\t}\n\tdepthFirstCollect(schema);\n\treturn examples$1;\n}\n\n//#endregion\n//#region src/methods/getFallbacks/getFallbacks.ts\n/**\n* Returns the fallback values of the schema.\n*\n* Hint: The difference to `getFallback` is that for object and tuple schemas\n* this function recursively returns the fallback values of the subschemas\n* instead of `undefined`.\n*\n* @param schema The schema to get them from.\n*\n* @returns The fallback values.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction getFallbacks(schema) {\n\tif (\"entries\" in schema) {\n\t\tconst object$1 = {};\n\t\tfor (const key in schema.entries) object$1[key] = /* @__PURE__ */ getFallbacks(schema.entries[key]);\n\t\treturn object$1;\n\t}\n\tif (\"items\" in schema) return schema.items.map(getFallbacks);\n\treturn /* @__PURE__ */ getFallback(schema);\n}\n\n//#endregion\n//#region src/methods/getFallbacks/getFallbacksAsync.ts\n/**\n* Returns the fallback values of the schema.\n*\n* Hint: The difference to `getFallback` is that for object and tuple schemas\n* this function recursively returns the fallback values of the subschemas\n* instead of `undefined`.\n*\n* @param schema The schema to get them from.\n*\n* @returns The fallback values.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nasync function getFallbacksAsync(schema) {\n\tif (\"entries\" in schema) return Object.fromEntries(await Promise.all(Object.entries(schema.entries).map(async ([key, value$1]) => [key, await /* @__PURE__ */ getFallbacksAsync(value$1)])));\n\tif (\"items\" in schema) return Promise.all(schema.items.map(getFallbacksAsync));\n\treturn /* @__PURE__ */ getFallback(schema);\n}\n\n//#endregion\n//#region src/methods/getMetadata/getMetadata.ts\n/**\n* Returns the metadata of a schema.\n*\n* If multiple metadata are defined, it shallowly merges them using depth-first\n* search. If no metadata is defined, an empty object is returned.\n*\n* @param schema Schema to get the metadata from.\n*\n* @returns The metadata, if any.\n*\n* @beta\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction getMetadata(schema) {\n\tconst result = {};\n\tfunction depthFirstMerge(schema$1) {\n\t\tif (\"pipe\" in schema$1) {\n\t\t\tfor (const item of schema$1.pipe) if (item.kind === \"schema\" && \"pipe\" in item) depthFirstMerge(item);\n\t\t\telse if (item.kind === \"metadata\" && item.type === \"metadata\") Object.assign(result, item.metadata);\n\t\t}\n\t}\n\tdepthFirstMerge(schema);\n\treturn result;\n}\n\n//#endregion\n//#region src/methods/getTitle/getTitle.ts\n/**\n* Returns the title of the schema.\n*\n* If multiple titles are defined, the last one of the highest level is\n* returned. If no title is defined, `undefined` is returned.\n*\n* @param schema The schema to get the title from.\n*\n* @returns The title, if any.\n*\n* @beta\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction getTitle(schema) {\n\treturn /* @__PURE__ */ _getLastMetadata(schema, \"title\");\n}\n\n//#endregion\n//#region src/methods/is/is.ts\n/**\n* Checks if the input matches the schema. By using a type predicate, this\n* function can be used as a type guard.\n*\n* @param schema The schema to be used.\n* @param input The input to be tested.\n*\n* @returns Whether the input matches the schema.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction is(schema, input) {\n\treturn !schema[\"~run\"]({ value: input }, { abortEarly: true }).issues;\n}\n\n//#endregion\n//#region src/schemas/any/any.ts\n/**\n* Creates an any schema.\n*\n* Hint: This schema function exists only for completeness and is not\n* recommended in practice. Instead, `unknown` should be used to accept\n* unknown data.\n*\n* @returns An any schema.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction any() {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"any\",\n\t\treference: any,\n\t\texpects: \"any\",\n\t\tasync: false,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset) {\n\t\t\tdataset.typed = true;\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/array/array.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction array(item, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"array\",\n\t\treference: array,\n\t\texpects: \"Array\",\n\t\tasync: false,\n\t\titem,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tconst input = dataset.value;\n\t\t\tif (Array.isArray(input)) {\n\t\t\t\tdataset.typed = true;\n\t\t\t\tdataset.value = [];\n\t\t\t\tfor (let key = 0; key < input.length; key++) {\n\t\t\t\t\tconst value$1 = input[key];\n\t\t\t\t\tconst itemDataset = this.item[\"~run\"]({ value: value$1 }, config$1);\n\t\t\t\t\tif (itemDataset.issues) {\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"array\",\n\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tvalue: value$1\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (const issue of itemDataset.issues) {\n\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!dataset.issues) dataset.issues = itemDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!itemDataset.typed) dataset.typed = false;\n\t\t\t\t\tdataset.value.push(itemDataset.value);\n\t\t\t\t}\n\t\t\t} else _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/array/arrayAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction arrayAsync(item, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"array\",\n\t\treference: arrayAsync,\n\t\texpects: \"Array\",\n\t\tasync: true,\n\t\titem,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tconst input = dataset.value;\n\t\t\tif (Array.isArray(input)) {\n\t\t\t\tdataset.typed = true;\n\t\t\t\tdataset.value = [];\n\t\t\t\tconst itemDatasets = await Promise.all(input.map((value$1) => this.item[\"~run\"]({ value: value$1 }, config$1)));\n\t\t\t\tfor (let key = 0; key < itemDatasets.length; key++) {\n\t\t\t\t\tconst itemDataset = itemDatasets[key];\n\t\t\t\t\tif (itemDataset.issues) {\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"array\",\n\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tvalue: input[key]\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (const issue of itemDataset.issues) {\n\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!dataset.issues) dataset.issues = itemDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!itemDataset.typed) dataset.typed = false;\n\t\t\t\t\tdataset.value.push(itemDataset.value);\n\t\t\t\t}\n\t\t\t} else _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/bigint/bigint.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction bigint(message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"bigint\",\n\t\treference: bigint,\n\t\texpects: \"bigint\",\n\t\tasync: false,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (typeof dataset.value === \"bigint\") dataset.typed = true;\n\t\t\telse _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/blob/blob.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction blob(message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"blob\",\n\t\treference: blob,\n\t\texpects: \"Blob\",\n\t\tasync: false,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.value instanceof Blob) dataset.typed = true;\n\t\t\telse _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/boolean/boolean.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction boolean(message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"boolean\",\n\t\treference: boolean,\n\t\texpects: \"boolean\",\n\t\tasync: false,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (typeof dataset.value === \"boolean\") dataset.typed = true;\n\t\t\telse _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/custom/custom.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction custom(check$1, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"custom\",\n\t\treference: custom,\n\t\texpects: \"unknown\",\n\t\tasync: false,\n\t\tcheck: check$1,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (this.check(dataset.value)) dataset.typed = true;\n\t\t\telse _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/custom/customAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction customAsync(check$1, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"custom\",\n\t\treference: customAsync,\n\t\texpects: \"unknown\",\n\t\tasync: true,\n\t\tcheck: check$1,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tif (await this.check(dataset.value)) dataset.typed = true;\n\t\t\telse _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/date/date.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction date(message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"date\",\n\t\treference: date,\n\t\texpects: \"Date\",\n\t\tasync: false,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.value instanceof Date) if (!isNaN(dataset.value)) dataset.typed = true;\n\t\t\telse _addIssue(this, \"type\", dataset, config$1, { received: \"\\\"Invalid Date\\\"\" });\n\t\t\telse _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/enum/enum.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction enum_(enum__, message$1) {\n\tconst options = [];\n\tfor (const key in enum__) if (`${+key}` !== key || typeof enum__[key] !== \"string\" || !Object.is(enum__[enum__[key]], +key)) options.push(enum__[key]);\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"enum\",\n\t\treference: enum_,\n\t\texpects: /* @__PURE__ */ _joinExpects(options.map(_stringify), \"|\"),\n\t\tasync: false,\n\t\tenum: enum__,\n\t\toptions,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (this.options.includes(dataset.value)) dataset.typed = true;\n\t\t\telse _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/exactOptional/exactOptional.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction exactOptional(wrapped, default_) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"exact_optional\",\n\t\treference: exactOptional,\n\t\texpects: wrapped.expects,\n\t\tasync: false,\n\t\twrapped,\n\t\tdefault: default_,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\treturn this.wrapped[\"~run\"](dataset, config$1);\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/exactOptional/exactOptionalAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction exactOptionalAsync(wrapped, default_) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"exact_optional\",\n\t\treference: exactOptionalAsync,\n\t\texpects: wrapped.expects,\n\t\tasync: true,\n\t\twrapped,\n\t\tdefault: default_,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\treturn this.wrapped[\"~run\"](dataset, config$1);\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/file/file.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction file(message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"file\",\n\t\treference: file,\n\t\texpects: \"File\",\n\t\tasync: false,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.value instanceof File) dataset.typed = true;\n\t\t\telse _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/function/function.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction function_(message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"function\",\n\t\treference: function_,\n\t\texpects: \"Function\",\n\t\tasync: false,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (typeof dataset.value === \"function\") dataset.typed = true;\n\t\t\telse _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/instance/instance.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction instance(class_, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"instance\",\n\t\treference: instance,\n\t\texpects: class_.name,\n\t\tasync: false,\n\t\tclass: class_,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.value instanceof this.class) dataset.typed = true;\n\t\t\telse _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/intersect/utils/_merge/_merge.ts\n/**\n* Merges two values into one single output.\n*\n* @param value1 First value.\n* @param value2 Second value.\n*\n* @returns The merge dataset.\n*\n* @internal\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction _merge(value1, value2) {\n\tif (typeof value1 === typeof value2) {\n\t\tif (value1 === value2 || value1 instanceof Date && value2 instanceof Date && +value1 === +value2) return { value: value1 };\n\t\tif (value1 && value2 && value1.constructor === Object && value2.constructor === Object) {\n\t\t\tfor (const key in value2) if (key in value1) {\n\t\t\t\tconst dataset = /* @__PURE__ */ _merge(value1[key], value2[key]);\n\t\t\t\tif (dataset.issue) return dataset;\n\t\t\t\tvalue1[key] = dataset.value;\n\t\t\t} else value1[key] = value2[key];\n\t\t\treturn { value: value1 };\n\t\t}\n\t\tif (Array.isArray(value1) && Array.isArray(value2)) {\n\t\t\tif (value1.length === value2.length) {\n\t\t\t\tfor (let index = 0; index < value1.length; index++) {\n\t\t\t\t\tconst dataset = /* @__PURE__ */ _merge(value1[index], value2[index]);\n\t\t\t\t\tif (dataset.issue) return dataset;\n\t\t\t\t\tvalue1[index] = dataset.value;\n\t\t\t\t}\n\t\t\t\treturn { value: value1 };\n\t\t\t}\n\t\t}\n\t}\n\treturn { issue: true };\n}\n\n//#endregion\n//#region src/schemas/intersect/intersect.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction intersect(options, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"intersect\",\n\t\treference: intersect,\n\t\texpects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), \"&\"),\n\t\tasync: false,\n\t\toptions,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (this.options.length) {\n\t\t\t\tconst input = dataset.value;\n\t\t\t\tlet outputs;\n\t\t\t\tdataset.typed = true;\n\t\t\t\tfor (const schema of this.options) {\n\t\t\t\t\tconst optionDataset = schema[\"~run\"]({ value: input }, config$1);\n\t\t\t\t\tif (optionDataset.issues) {\n\t\t\t\t\t\tif (dataset.issues) dataset.issues.push(...optionDataset.issues);\n\t\t\t\t\t\telse dataset.issues = optionDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!optionDataset.typed) dataset.typed = false;\n\t\t\t\t\tif (dataset.typed) if (outputs) outputs.push(optionDataset.value);\n\t\t\t\t\telse outputs = [optionDataset.value];\n\t\t\t\t}\n\t\t\t\tif (dataset.typed) {\n\t\t\t\t\tdataset.value = outputs[0];\n\t\t\t\t\tfor (let index = 1; index < outputs.length; index++) {\n\t\t\t\t\t\tconst mergeDataset = /* @__PURE__ */ _merge(dataset.value, outputs[index]);\n\t\t\t\t\t\tif (mergeDataset.issue) {\n\t\t\t\t\t\t\t_addIssue(this, \"type\", dataset, config$1, { received: \"unknown\" });\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdataset.value = mergeDataset.value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/intersect/intersectAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction intersectAsync(options, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"intersect\",\n\t\treference: intersectAsync,\n\t\texpects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), \"&\"),\n\t\tasync: true,\n\t\toptions,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tif (this.options.length) {\n\t\t\t\tconst input = dataset.value;\n\t\t\t\tlet outputs;\n\t\t\t\tdataset.typed = true;\n\t\t\t\tconst optionDatasets = await Promise.all(this.options.map((schema) => schema[\"~run\"]({ value: input }, config$1)));\n\t\t\t\tfor (const optionDataset of optionDatasets) {\n\t\t\t\t\tif (optionDataset.issues) {\n\t\t\t\t\t\tif (dataset.issues) dataset.issues.push(...optionDataset.issues);\n\t\t\t\t\t\telse dataset.issues = optionDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!optionDataset.typed) dataset.typed = false;\n\t\t\t\t\tif (dataset.typed) if (outputs) outputs.push(optionDataset.value);\n\t\t\t\t\telse outputs = [optionDataset.value];\n\t\t\t\t}\n\t\t\t\tif (dataset.typed) {\n\t\t\t\t\tdataset.value = outputs[0];\n\t\t\t\t\tfor (let index = 1; index < outputs.length; index++) {\n\t\t\t\t\t\tconst mergeDataset = /* @__PURE__ */ _merge(dataset.value, outputs[index]);\n\t\t\t\t\t\tif (mergeDataset.issue) {\n\t\t\t\t\t\t\t_addIssue(this, \"type\", dataset, config$1, { received: \"unknown\" });\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdataset.value = mergeDataset.value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/lazy/lazy.ts\n/**\n* Creates a lazy schema.\n*\n* @param getter The schema getter.\n*\n* @returns A lazy schema.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction lazy(getter) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"lazy\",\n\t\treference: lazy,\n\t\texpects: \"unknown\",\n\t\tasync: false,\n\t\tgetter,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\treturn this.getter(dataset.value)[\"~run\"](dataset, config$1);\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/lazy/lazyAsync.ts\n/**\n* Creates a lazy schema.\n*\n* @param getter The schema getter.\n*\n* @returns A lazy schema.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction lazyAsync(getter) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"lazy\",\n\t\treference: lazyAsync,\n\t\texpects: \"unknown\",\n\t\tasync: true,\n\t\tgetter,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\treturn (await this.getter(dataset.value))[\"~run\"](dataset, config$1);\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/literal/literal.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction literal(literal_, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"literal\",\n\t\treference: literal,\n\t\texpects: /* @__PURE__ */ _stringify(literal_),\n\t\tasync: false,\n\t\tliteral: literal_,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.value === this.literal) dataset.typed = true;\n\t\t\telse _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/looseObject/looseObject.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction looseObject(entries$1, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"loose_object\",\n\t\treference: looseObject,\n\t\texpects: \"Object\",\n\t\tasync: false,\n\t\tentries: entries$1,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tconst input = dataset.value;\n\t\t\tif (input && typeof input === \"object\") {\n\t\t\t\tdataset.typed = true;\n\t\t\t\tdataset.value = {};\n\t\t\t\tfor (const key in this.entries) {\n\t\t\t\t\tconst valueSchema = this.entries[key];\n\t\t\t\t\tif (key in input || (valueSchema.type === \"exact_optional\" || valueSchema.type === \"optional\" || valueSchema.type === \"nullish\") && valueSchema.default !== void 0) {\n\t\t\t\t\t\tconst value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);\n\t\t\t\t\t\tconst valueDataset = valueSchema[\"~run\"]({ value: value$1 }, config$1);\n\t\t\t\t\t\tif (valueDataset.issues) {\n\t\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\tvalue: value$1\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tfor (const issue of valueDataset.issues) {\n\t\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!dataset.issues) dataset.issues = valueDataset.issues;\n\t\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!valueDataset.typed) dataset.typed = false;\n\t\t\t\t\t\tdataset.value[key] = valueDataset.value;\n\t\t\t\t\t} else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);\n\t\t\t\t\telse if (valueSchema.type !== \"exact_optional\" && valueSchema.type !== \"optional\" && valueSchema.type !== \"nullish\") {\n\t\t\t\t\t\t_addIssue(this, \"key\", dataset, config$1, {\n\t\t\t\t\t\t\tinput: void 0,\n\t\t\t\t\t\t\texpected: `\"${key}\"`,\n\t\t\t\t\t\t\tpath: [{\n\t\t\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\t\t\torigin: \"key\",\n\t\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\tvalue: input[key]\n\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif (config$1.abortEarly) break;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!dataset.issues || !config$1.abortEarly) {\n\t\t\t\t\tfor (const key in input) if (/* @__PURE__ */ _isValidObjectKey(input, key) && !(key in this.entries)) dataset.value[key] = input[key];\n\t\t\t\t}\n\t\t\t} else _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/looseObject/looseObjectAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction looseObjectAsync(entries$1, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"loose_object\",\n\t\treference: looseObjectAsync,\n\t\texpects: \"Object\",\n\t\tasync: true,\n\t\tentries: entries$1,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tconst input = dataset.value;\n\t\t\tif (input && typeof input === \"object\") {\n\t\t\t\tdataset.typed = true;\n\t\t\t\tdataset.value = {};\n\t\t\t\tconst valueDatasets = await Promise.all(Object.entries(this.entries).map(async ([key, valueSchema]) => {\n\t\t\t\t\tif (key in input || (valueSchema.type === \"exact_optional\" || valueSchema.type === \"optional\" || valueSchema.type === \"nullish\") && valueSchema.default !== void 0) {\n\t\t\t\t\t\tconst value$1 = key in input ? input[key] : await /* @__PURE__ */ getDefault(valueSchema);\n\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tvalue$1,\n\t\t\t\t\t\t\tvalueSchema,\n\t\t\t\t\t\t\tawait valueSchema[\"~run\"]({ value: value$1 }, config$1)\n\t\t\t\t\t\t];\n\t\t\t\t\t}\n\t\t\t\t\treturn [\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tinput[key],\n\t\t\t\t\t\tvalueSchema,\n\t\t\t\t\t\tnull\n\t\t\t\t\t];\n\t\t\t\t}));\n\t\t\t\tfor (const [key, value$1, valueSchema, valueDataset] of valueDatasets) if (valueDataset) {\n\t\t\t\t\tif (valueDataset.issues) {\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tvalue: value$1\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (const issue of valueDataset.issues) {\n\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!dataset.issues) dataset.issues = valueDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!valueDataset.typed) dataset.typed = false;\n\t\t\t\t\tdataset.value[key] = valueDataset.value;\n\t\t\t\t} else if (valueSchema.fallback !== void 0) dataset.value[key] = await /* @__PURE__ */ getFallback(valueSchema);\n\t\t\t\telse if (valueSchema.type !== \"exact_optional\" && valueSchema.type !== \"optional\" && valueSchema.type !== \"nullish\") {\n\t\t\t\t\t_addIssue(this, \"key\", dataset, config$1, {\n\t\t\t\t\t\tinput: void 0,\n\t\t\t\t\t\texpected: `\"${key}\"`,\n\t\t\t\t\t\tpath: [{\n\t\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\t\torigin: \"key\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tvalue: value$1\n\t\t\t\t\t\t}]\n\t\t\t\t\t});\n\t\t\t\t\tif (config$1.abortEarly) break;\n\t\t\t\t}\n\t\t\t\tif (!dataset.issues || !config$1.abortEarly) {\n\t\t\t\t\tfor (const key in input) if (/* @__PURE__ */ _isValidObjectKey(input, key) && !(key in this.entries)) dataset.value[key] = input[key];\n\t\t\t\t}\n\t\t\t} else _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/looseTuple/looseTuple.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction looseTuple(items, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"loose_tuple\",\n\t\treference: looseTuple,\n\t\texpects: \"Array\",\n\t\tasync: false,\n\t\titems,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tconst input = dataset.value;\n\t\t\tif (Array.isArray(input)) {\n\t\t\t\tdataset.typed = true;\n\t\t\t\tdataset.value = [];\n\t\t\t\tfor (let key = 0; key < this.items.length; key++) {\n\t\t\t\t\tconst value$1 = input[key];\n\t\t\t\t\tconst itemDataset = this.items[key][\"~run\"]({ value: value$1 }, config$1);\n\t\t\t\t\tif (itemDataset.issues) {\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"array\",\n\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tvalue: value$1\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (const issue of itemDataset.issues) {\n\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!dataset.issues) dataset.issues = itemDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!itemDataset.typed) dataset.typed = false;\n\t\t\t\t\tdataset.value.push(itemDataset.value);\n\t\t\t\t}\n\t\t\t\tif (!dataset.issues || !config$1.abortEarly) for (let key = this.items.length; key < input.length; key++) dataset.value.push(input[key]);\n\t\t\t} else _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/looseTuple/looseTupleAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction looseTupleAsync(items, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"loose_tuple\",\n\t\treference: looseTupleAsync,\n\t\texpects: \"Array\",\n\t\tasync: true,\n\t\titems,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tconst input = dataset.value;\n\t\t\tif (Array.isArray(input)) {\n\t\t\t\tdataset.typed = true;\n\t\t\t\tdataset.value = [];\n\t\t\t\tconst itemDatasets = await Promise.all(this.items.map(async (item, key) => {\n\t\t\t\t\tconst value$1 = input[key];\n\t\t\t\t\treturn [\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tvalue$1,\n\t\t\t\t\t\tawait item[\"~run\"]({ value: value$1 }, config$1)\n\t\t\t\t\t];\n\t\t\t\t}));\n\t\t\t\tfor (const [key, value$1, itemDataset] of itemDatasets) {\n\t\t\t\t\tif (itemDataset.issues) {\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"array\",\n\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tvalue: value$1\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (const issue of itemDataset.issues) {\n\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!dataset.issues) dataset.issues = itemDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!itemDataset.typed) dataset.typed = false;\n\t\t\t\t\tdataset.value.push(itemDataset.value);\n\t\t\t\t}\n\t\t\t\tif (!dataset.issues || !config$1.abortEarly) for (let key = this.items.length; key < input.length; key++) dataset.value.push(input[key]);\n\t\t\t} else _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/map/map.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction map(key, value$1, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"map\",\n\t\treference: map,\n\t\texpects: \"Map\",\n\t\tasync: false,\n\t\tkey,\n\t\tvalue: value$1,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tconst input = dataset.value;\n\t\t\tif (input instanceof Map) {\n\t\t\t\tdataset.typed = true;\n\t\t\t\tdataset.value = /* @__PURE__ */ new Map();\n\t\t\t\tfor (const [inputKey, inputValue] of input) {\n\t\t\t\t\tconst keyDataset = this.key[\"~run\"]({ value: inputKey }, config$1);\n\t\t\t\t\tif (keyDataset.issues) {\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"map\",\n\t\t\t\t\t\t\torigin: \"key\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey: inputKey,\n\t\t\t\t\t\t\tvalue: inputValue\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (const issue of keyDataset.issues) {\n\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!dataset.issues) dataset.issues = keyDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tconst valueDataset = this.value[\"~run\"]({ value: inputValue }, config$1);\n\t\t\t\t\tif (valueDataset.issues) {\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"map\",\n\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey: inputKey,\n\t\t\t\t\t\t\tvalue: inputValue\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (const issue of valueDataset.issues) {\n\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!dataset.issues) dataset.issues = valueDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!keyDataset.typed || !valueDataset.typed) dataset.typed = false;\n\t\t\t\t\tdataset.value.set(keyDataset.value, valueDataset.value);\n\t\t\t\t}\n\t\t\t} else _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/map/mapAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction mapAsync(key, value$1, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"map\",\n\t\treference: mapAsync,\n\t\texpects: \"Map\",\n\t\tasync: true,\n\t\tkey,\n\t\tvalue: value$1,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tconst input = dataset.value;\n\t\t\tif (input instanceof Map) {\n\t\t\t\tdataset.typed = true;\n\t\t\t\tdataset.value = /* @__PURE__ */ new Map();\n\t\t\t\tconst datasets = await Promise.all([...input].map(([inputKey, inputValue]) => Promise.all([\n\t\t\t\t\tinputKey,\n\t\t\t\t\tinputValue,\n\t\t\t\t\tthis.key[\"~run\"]({ value: inputKey }, config$1),\n\t\t\t\t\tthis.value[\"~run\"]({ value: inputValue }, config$1)\n\t\t\t\t])));\n\t\t\t\tfor (const [inputKey, inputValue, keyDataset, valueDataset] of datasets) {\n\t\t\t\t\tif (keyDataset.issues) {\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"map\",\n\t\t\t\t\t\t\torigin: \"key\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey: inputKey,\n\t\t\t\t\t\t\tvalue: inputValue\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (const issue of keyDataset.issues) {\n\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!dataset.issues) dataset.issues = keyDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (valueDataset.issues) {\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"map\",\n\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey: inputKey,\n\t\t\t\t\t\t\tvalue: inputValue\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (const issue of valueDataset.issues) {\n\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!dataset.issues) dataset.issues = valueDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!keyDataset.typed || !valueDataset.typed) dataset.typed = false;\n\t\t\t\t\tdataset.value.set(keyDataset.value, valueDataset.value);\n\t\t\t\t}\n\t\t\t} else _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/nan/nan.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction nan(message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"nan\",\n\t\treference: nan,\n\t\texpects: \"NaN\",\n\t\tasync: false,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (Number.isNaN(dataset.value)) dataset.typed = true;\n\t\t\telse _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/never/never.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction never(message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"never\",\n\t\treference: never,\n\t\texpects: \"never\",\n\t\tasync: false,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\t_addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/nonNullable/nonNullable.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction nonNullable(wrapped, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"non_nullable\",\n\t\treference: nonNullable,\n\t\texpects: \"!null\",\n\t\tasync: false,\n\t\twrapped,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.value !== null) dataset = this.wrapped[\"~run\"](dataset, config$1);\n\t\t\tif (dataset.value === null) _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/nonNullable/nonNullableAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction nonNullableAsync(wrapped, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"non_nullable\",\n\t\treference: nonNullableAsync,\n\t\texpects: \"!null\",\n\t\tasync: true,\n\t\twrapped,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tif (dataset.value !== null) dataset = await this.wrapped[\"~run\"](dataset, config$1);\n\t\t\tif (dataset.value === null) _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/nonNullish/nonNullish.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction nonNullish(wrapped, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"non_nullish\",\n\t\treference: nonNullish,\n\t\texpects: \"(!null & !undefined)\",\n\t\tasync: false,\n\t\twrapped,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (!(dataset.value === null || dataset.value === void 0)) dataset = this.wrapped[\"~run\"](dataset, config$1);\n\t\t\tif (dataset.value === null || dataset.value === void 0) _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/nonNullish/nonNullishAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction nonNullishAsync(wrapped, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"non_nullish\",\n\t\treference: nonNullishAsync,\n\t\texpects: \"(!null & !undefined)\",\n\t\tasync: true,\n\t\twrapped,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tif (!(dataset.value === null || dataset.value === void 0)) dataset = await this.wrapped[\"~run\"](dataset, config$1);\n\t\t\tif (dataset.value === null || dataset.value === void 0) _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/nonOptional/nonOptional.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction nonOptional(wrapped, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"non_optional\",\n\t\treference: nonOptional,\n\t\texpects: \"!undefined\",\n\t\tasync: false,\n\t\twrapped,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.value !== void 0) dataset = this.wrapped[\"~run\"](dataset, config$1);\n\t\t\tif (dataset.value === void 0) _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/nonOptional/nonOptionalAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction nonOptionalAsync(wrapped, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"non_optional\",\n\t\treference: nonOptionalAsync,\n\t\texpects: \"!undefined\",\n\t\tasync: true,\n\t\twrapped,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tif (dataset.value !== void 0) dataset = await this.wrapped[\"~run\"](dataset, config$1);\n\t\t\tif (dataset.value === void 0) _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/null/null.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction null_(message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"null\",\n\t\treference: null_,\n\t\texpects: \"null\",\n\t\tasync: false,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.value === null) dataset.typed = true;\n\t\t\telse _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/nullable/nullable.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction nullable(wrapped, default_) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"nullable\",\n\t\treference: nullable,\n\t\texpects: `(${wrapped.expects} | null)`,\n\t\tasync: false,\n\t\twrapped,\n\t\tdefault: default_,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.value === null) {\n\t\t\t\tif (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);\n\t\t\t\tif (dataset.value === null) {\n\t\t\t\t\tdataset.typed = true;\n\t\t\t\t\treturn dataset;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn this.wrapped[\"~run\"](dataset, config$1);\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/nullable/nullableAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction nullableAsync(wrapped, default_) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"nullable\",\n\t\treference: nullableAsync,\n\t\texpects: `(${wrapped.expects} | null)`,\n\t\tasync: true,\n\t\twrapped,\n\t\tdefault: default_,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tif (dataset.value === null) {\n\t\t\t\tif (this.default !== void 0) dataset.value = await /* @__PURE__ */ getDefault(this, dataset, config$1);\n\t\t\t\tif (dataset.value === null) {\n\t\t\t\t\tdataset.typed = true;\n\t\t\t\t\treturn dataset;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn this.wrapped[\"~run\"](dataset, config$1);\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/nullish/nullish.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction nullish(wrapped, default_) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"nullish\",\n\t\treference: nullish,\n\t\texpects: `(${wrapped.expects} | null | undefined)`,\n\t\tasync: false,\n\t\twrapped,\n\t\tdefault: default_,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.value === null || dataset.value === void 0) {\n\t\t\t\tif (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);\n\t\t\t\tif (dataset.value === null || dataset.value === void 0) {\n\t\t\t\t\tdataset.typed = true;\n\t\t\t\t\treturn dataset;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn this.wrapped[\"~run\"](dataset, config$1);\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/nullish/nullishAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction nullishAsync(wrapped, default_) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"nullish\",\n\t\treference: nullishAsync,\n\t\texpects: `(${wrapped.expects} | null | undefined)`,\n\t\tasync: true,\n\t\twrapped,\n\t\tdefault: default_,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tif (dataset.value === null || dataset.value === void 0) {\n\t\t\t\tif (this.default !== void 0) dataset.value = await /* @__PURE__ */ getDefault(this, dataset, config$1);\n\t\t\t\tif (dataset.value === null || dataset.value === void 0) {\n\t\t\t\t\tdataset.typed = true;\n\t\t\t\t\treturn dataset;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn this.wrapped[\"~run\"](dataset, config$1);\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/number/number.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction number(message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"number\",\n\t\treference: number,\n\t\texpects: \"number\",\n\t\tasync: false,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (typeof dataset.value === \"number\" && !isNaN(dataset.value)) dataset.typed = true;\n\t\t\telse _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/object/object.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction object(entries$1, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"object\",\n\t\treference: object,\n\t\texpects: \"Object\",\n\t\tasync: false,\n\t\tentries: entries$1,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tconst input = dataset.value;\n\t\t\tif (input && typeof input === \"object\") {\n\t\t\t\tdataset.typed = true;\n\t\t\t\tdataset.value = {};\n\t\t\t\tfor (const key in this.entries) {\n\t\t\t\t\tconst valueSchema = this.entries[key];\n\t\t\t\t\tif (key in input || (valueSchema.type === \"exact_optional\" || valueSchema.type === \"optional\" || valueSchema.type === \"nullish\") && valueSchema.default !== void 0) {\n\t\t\t\t\t\tconst value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);\n\t\t\t\t\t\tconst valueDataset = valueSchema[\"~run\"]({ value: value$1 }, config$1);\n\t\t\t\t\t\tif (valueDataset.issues) {\n\t\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\tvalue: value$1\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tfor (const issue of valueDataset.issues) {\n\t\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!dataset.issues) dataset.issues = valueDataset.issues;\n\t\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!valueDataset.typed) dataset.typed = false;\n\t\t\t\t\t\tdataset.value[key] = valueDataset.value;\n\t\t\t\t\t} else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);\n\t\t\t\t\telse if (valueSchema.type !== \"exact_optional\" && valueSchema.type !== \"optional\" && valueSchema.type !== \"nullish\") {\n\t\t\t\t\t\t_addIssue(this, \"key\", dataset, config$1, {\n\t\t\t\t\t\t\tinput: void 0,\n\t\t\t\t\t\t\texpected: `\"${key}\"`,\n\t\t\t\t\t\t\tpath: [{\n\t\t\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\t\t\torigin: \"key\",\n\t\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\tvalue: input[key]\n\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif (config$1.abortEarly) break;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/object/objectAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction objectAsync(entries$1, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"object\",\n\t\treference: objectAsync,\n\t\texpects: \"Object\",\n\t\tasync: true,\n\t\tentries: entries$1,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tconst input = dataset.value;\n\t\t\tif (input && typeof input === \"object\") {\n\t\t\t\tdataset.typed = true;\n\t\t\t\tdataset.value = {};\n\t\t\t\tconst valueDatasets = await Promise.all(Object.entries(this.entries).map(async ([key, valueSchema]) => {\n\t\t\t\t\tif (key in input || (valueSchema.type === \"exact_optional\" || valueSchema.type === \"optional\" || valueSchema.type === \"nullish\") && valueSchema.default !== void 0) {\n\t\t\t\t\t\tconst value$1 = key in input ? input[key] : await /* @__PURE__ */ getDefault(valueSchema);\n\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tvalue$1,\n\t\t\t\t\t\t\tvalueSchema,\n\t\t\t\t\t\t\tawait valueSchema[\"~run\"]({ value: value$1 }, config$1)\n\t\t\t\t\t\t];\n\t\t\t\t\t}\n\t\t\t\t\treturn [\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tinput[key],\n\t\t\t\t\t\tvalueSchema,\n\t\t\t\t\t\tnull\n\t\t\t\t\t];\n\t\t\t\t}));\n\t\t\t\tfor (const [key, value$1, valueSchema, valueDataset] of valueDatasets) if (valueDataset) {\n\t\t\t\t\tif (valueDataset.issues) {\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tvalue: value$1\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (const issue of valueDataset.issues) {\n\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!dataset.issues) dataset.issues = valueDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!valueDataset.typed) dataset.typed = false;\n\t\t\t\t\tdataset.value[key] = valueDataset.value;\n\t\t\t\t} else if (valueSchema.fallback !== void 0) dataset.value[key] = await /* @__PURE__ */ getFallback(valueSchema);\n\t\t\t\telse if (valueSchema.type !== \"exact_optional\" && valueSchema.type !== \"optional\" && valueSchema.type !== \"nullish\") {\n\t\t\t\t\t_addIssue(this, \"key\", dataset, config$1, {\n\t\t\t\t\t\tinput: void 0,\n\t\t\t\t\t\texpected: `\"${key}\"`,\n\t\t\t\t\t\tpath: [{\n\t\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\t\torigin: \"key\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tvalue: value$1\n\t\t\t\t\t\t}]\n\t\t\t\t\t});\n\t\t\t\t\tif (config$1.abortEarly) break;\n\t\t\t\t}\n\t\t\t} else _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/objectWithRest/objectWithRest.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction objectWithRest(entries$1, rest, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"object_with_rest\",\n\t\treference: objectWithRest,\n\t\texpects: \"Object\",\n\t\tasync: false,\n\t\tentries: entries$1,\n\t\trest,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tconst input = dataset.value;\n\t\t\tif (input && typeof input === \"object\") {\n\t\t\t\tdataset.typed = true;\n\t\t\t\tdataset.value = {};\n\t\t\t\tfor (const key in this.entries) {\n\t\t\t\t\tconst valueSchema = this.entries[key];\n\t\t\t\t\tif (key in input || (valueSchema.type === \"exact_optional\" || valueSchema.type === \"optional\" || valueSchema.type === \"nullish\") && valueSchema.default !== void 0) {\n\t\t\t\t\t\tconst value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);\n\t\t\t\t\t\tconst valueDataset = valueSchema[\"~run\"]({ value: value$1 }, config$1);\n\t\t\t\t\t\tif (valueDataset.issues) {\n\t\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\tvalue: value$1\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tfor (const issue of valueDataset.issues) {\n\t\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!dataset.issues) dataset.issues = valueDataset.issues;\n\t\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!valueDataset.typed) dataset.typed = false;\n\t\t\t\t\t\tdataset.value[key] = valueDataset.value;\n\t\t\t\t\t} else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);\n\t\t\t\t\telse if (valueSchema.type !== \"exact_optional\" && valueSchema.type !== \"optional\" && valueSchema.type !== \"nullish\") {\n\t\t\t\t\t\t_addIssue(this, \"key\", dataset, config$1, {\n\t\t\t\t\t\t\tinput: void 0,\n\t\t\t\t\t\t\texpected: `\"${key}\"`,\n\t\t\t\t\t\t\tpath: [{\n\t\t\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\t\t\torigin: \"key\",\n\t\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\tvalue: input[key]\n\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif (config$1.abortEarly) break;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!dataset.issues || !config$1.abortEarly) {\n\t\t\t\t\tfor (const key in input) if (/* @__PURE__ */ _isValidObjectKey(input, key) && !(key in this.entries)) {\n\t\t\t\t\t\tconst valueDataset = this.rest[\"~run\"]({ value: input[key] }, config$1);\n\t\t\t\t\t\tif (valueDataset.issues) {\n\t\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\tvalue: input[key]\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tfor (const issue of valueDataset.issues) {\n\t\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!dataset.issues) dataset.issues = valueDataset.issues;\n\t\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!valueDataset.typed) dataset.typed = false;\n\t\t\t\t\t\tdataset.value[key] = valueDataset.value;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/objectWithRest/objectWithRestAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction objectWithRestAsync(entries$1, rest, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"object_with_rest\",\n\t\treference: objectWithRestAsync,\n\t\texpects: \"Object\",\n\t\tasync: true,\n\t\tentries: entries$1,\n\t\trest,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tconst input = dataset.value;\n\t\t\tif (input && typeof input === \"object\") {\n\t\t\t\tdataset.typed = true;\n\t\t\t\tdataset.value = {};\n\t\t\t\tconst [normalDatasets, restDatasets] = await Promise.all([Promise.all(Object.entries(this.entries).map(async ([key, valueSchema]) => {\n\t\t\t\t\tif (key in input || (valueSchema.type === \"exact_optional\" || valueSchema.type === \"optional\" || valueSchema.type === \"nullish\") && valueSchema.default !== void 0) {\n\t\t\t\t\t\tconst value$1 = key in input ? input[key] : await /* @__PURE__ */ getDefault(valueSchema);\n\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tvalue$1,\n\t\t\t\t\t\t\tvalueSchema,\n\t\t\t\t\t\t\tawait valueSchema[\"~run\"]({ value: value$1 }, config$1)\n\t\t\t\t\t\t];\n\t\t\t\t\t}\n\t\t\t\t\treturn [\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tinput[key],\n\t\t\t\t\t\tvalueSchema,\n\t\t\t\t\t\tnull\n\t\t\t\t\t];\n\t\t\t\t})), Promise.all(Object.entries(input).filter(([key]) => /* @__PURE__ */ _isValidObjectKey(input, key) && !(key in this.entries)).map(async ([key, value$1]) => [\n\t\t\t\t\tkey,\n\t\t\t\t\tvalue$1,\n\t\t\t\t\tawait this.rest[\"~run\"]({ value: value$1 }, config$1)\n\t\t\t\t]))]);\n\t\t\t\tfor (const [key, value$1, valueSchema, valueDataset] of normalDatasets) if (valueDataset) {\n\t\t\t\t\tif (valueDataset.issues) {\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tvalue: value$1\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (const issue of valueDataset.issues) {\n\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!dataset.issues) dataset.issues = valueDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!valueDataset.typed) dataset.typed = false;\n\t\t\t\t\tdataset.value[key] = valueDataset.value;\n\t\t\t\t} else if (valueSchema.fallback !== void 0) dataset.value[key] = await /* @__PURE__ */ getFallback(valueSchema);\n\t\t\t\telse if (valueSchema.type !== \"exact_optional\" && valueSchema.type !== \"optional\" && valueSchema.type !== \"nullish\") {\n\t\t\t\t\t_addIssue(this, \"key\", dataset, config$1, {\n\t\t\t\t\t\tinput: void 0,\n\t\t\t\t\t\texpected: `\"${key}\"`,\n\t\t\t\t\t\tpath: [{\n\t\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\t\torigin: \"key\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tvalue: value$1\n\t\t\t\t\t\t}]\n\t\t\t\t\t});\n\t\t\t\t\tif (config$1.abortEarly) break;\n\t\t\t\t}\n\t\t\t\tif (!dataset.issues || !config$1.abortEarly) for (const [key, value$1, valueDataset] of restDatasets) {\n\t\t\t\t\tif (valueDataset.issues) {\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tvalue: value$1\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (const issue of valueDataset.issues) {\n\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!dataset.issues) dataset.issues = valueDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!valueDataset.typed) dataset.typed = false;\n\t\t\t\t\tdataset.value[key] = valueDataset.value;\n\t\t\t\t}\n\t\t\t} else _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/optional/optional.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction optional(wrapped, default_) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"optional\",\n\t\treference: optional,\n\t\texpects: `(${wrapped.expects} | undefined)`,\n\t\tasync: false,\n\t\twrapped,\n\t\tdefault: default_,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.value === void 0) {\n\t\t\t\tif (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);\n\t\t\t\tif (dataset.value === void 0) {\n\t\t\t\t\tdataset.typed = true;\n\t\t\t\t\treturn dataset;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn this.wrapped[\"~run\"](dataset, config$1);\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/optional/optionalAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction optionalAsync(wrapped, default_) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"optional\",\n\t\treference: optionalAsync,\n\t\texpects: `(${wrapped.expects} | undefined)`,\n\t\tasync: true,\n\t\twrapped,\n\t\tdefault: default_,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tif (dataset.value === void 0) {\n\t\t\t\tif (this.default !== void 0) dataset.value = await /* @__PURE__ */ getDefault(this, dataset, config$1);\n\t\t\t\tif (dataset.value === void 0) {\n\t\t\t\t\tdataset.typed = true;\n\t\t\t\t\treturn dataset;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn this.wrapped[\"~run\"](dataset, config$1);\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/picklist/picklist.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction picklist(options, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"picklist\",\n\t\treference: picklist,\n\t\texpects: /* @__PURE__ */ _joinExpects(options.map(_stringify), \"|\"),\n\t\tasync: false,\n\t\toptions,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (this.options.includes(dataset.value)) dataset.typed = true;\n\t\t\telse _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/promise/promise.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction promise(message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"promise\",\n\t\treference: promise,\n\t\texpects: \"Promise\",\n\t\tasync: false,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.value instanceof Promise) dataset.typed = true;\n\t\t\telse _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/record/record.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction record(key, value$1, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"record\",\n\t\treference: record,\n\t\texpects: \"Object\",\n\t\tasync: false,\n\t\tkey,\n\t\tvalue: value$1,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tconst input = dataset.value;\n\t\t\tif (input && typeof input === \"object\") {\n\t\t\t\tdataset.typed = true;\n\t\t\t\tdataset.value = {};\n\t\t\t\tfor (const entryKey in input) if (/* @__PURE__ */ _isValidObjectKey(input, entryKey)) {\n\t\t\t\t\tconst entryValue = input[entryKey];\n\t\t\t\t\tconst keyDataset = this.key[\"~run\"]({ value: entryKey }, config$1);\n\t\t\t\t\tif (keyDataset.issues) {\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\t\torigin: \"key\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey: entryKey,\n\t\t\t\t\t\t\tvalue: entryValue\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (const issue of keyDataset.issues) {\n\t\t\t\t\t\t\tissue.path = [pathItem];\n\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!dataset.issues) dataset.issues = keyDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tconst valueDataset = this.value[\"~run\"]({ value: entryValue }, config$1);\n\t\t\t\t\tif (valueDataset.issues) {\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey: entryKey,\n\t\t\t\t\t\t\tvalue: entryValue\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (const issue of valueDataset.issues) {\n\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!dataset.issues) dataset.issues = valueDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!keyDataset.typed || !valueDataset.typed) dataset.typed = false;\n\t\t\t\t\tif (keyDataset.typed) dataset.value[keyDataset.value] = valueDataset.value;\n\t\t\t\t}\n\t\t\t} else _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/record/recordAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction recordAsync(key, value$1, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"record\",\n\t\treference: recordAsync,\n\t\texpects: \"Object\",\n\t\tasync: true,\n\t\tkey,\n\t\tvalue: value$1,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tconst input = dataset.value;\n\t\t\tif (input && typeof input === \"object\") {\n\t\t\t\tdataset.typed = true;\n\t\t\t\tdataset.value = {};\n\t\t\t\tconst datasets = await Promise.all(Object.entries(input).filter(([key$1]) => /* @__PURE__ */ _isValidObjectKey(input, key$1)).map(([entryKey, entryValue]) => Promise.all([\n\t\t\t\t\tentryKey,\n\t\t\t\t\tentryValue,\n\t\t\t\t\tthis.key[\"~run\"]({ value: entryKey }, config$1),\n\t\t\t\t\tthis.value[\"~run\"]({ value: entryValue }, config$1)\n\t\t\t\t])));\n\t\t\t\tfor (const [entryKey, entryValue, keyDataset, valueDataset] of datasets) {\n\t\t\t\t\tif (keyDataset.issues) {\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\t\torigin: \"key\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey: entryKey,\n\t\t\t\t\t\t\tvalue: entryValue\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (const issue of keyDataset.issues) {\n\t\t\t\t\t\t\tissue.path = [pathItem];\n\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!dataset.issues) dataset.issues = keyDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (valueDataset.issues) {\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey: entryKey,\n\t\t\t\t\t\t\tvalue: entryValue\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (const issue of valueDataset.issues) {\n\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!dataset.issues) dataset.issues = valueDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!keyDataset.typed || !valueDataset.typed) dataset.typed = false;\n\t\t\t\t\tif (keyDataset.typed) dataset.value[keyDataset.value] = valueDataset.value;\n\t\t\t\t}\n\t\t\t} else _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/set/set.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction set(value$1, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"set\",\n\t\treference: set,\n\t\texpects: \"Set\",\n\t\tasync: false,\n\t\tvalue: value$1,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tconst input = dataset.value;\n\t\t\tif (input instanceof Set) {\n\t\t\t\tdataset.typed = true;\n\t\t\t\tdataset.value = /* @__PURE__ */ new Set();\n\t\t\t\tfor (const inputValue of input) {\n\t\t\t\t\tconst valueDataset = this.value[\"~run\"]({ value: inputValue }, config$1);\n\t\t\t\t\tif (valueDataset.issues) {\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"set\",\n\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey: null,\n\t\t\t\t\t\t\tvalue: inputValue\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (const issue of valueDataset.issues) {\n\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!dataset.issues) dataset.issues = valueDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!valueDataset.typed) dataset.typed = false;\n\t\t\t\t\tdataset.value.add(valueDataset.value);\n\t\t\t\t}\n\t\t\t} else _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/set/setAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction setAsync(value$1, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"set\",\n\t\treference: setAsync,\n\t\texpects: \"Set\",\n\t\tasync: true,\n\t\tvalue: value$1,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tconst input = dataset.value;\n\t\t\tif (input instanceof Set) {\n\t\t\t\tdataset.typed = true;\n\t\t\t\tdataset.value = /* @__PURE__ */ new Set();\n\t\t\t\tconst valueDatasets = await Promise.all([...input].map(async (inputValue) => [inputValue, await this.value[\"~run\"]({ value: inputValue }, config$1)]));\n\t\t\t\tfor (const [inputValue, valueDataset] of valueDatasets) {\n\t\t\t\t\tif (valueDataset.issues) {\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"set\",\n\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey: null,\n\t\t\t\t\t\t\tvalue: inputValue\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (const issue of valueDataset.issues) {\n\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!dataset.issues) dataset.issues = valueDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!valueDataset.typed) dataset.typed = false;\n\t\t\t\t\tdataset.value.add(valueDataset.value);\n\t\t\t\t}\n\t\t\t} else _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/strictObject/strictObject.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction strictObject(entries$1, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"strict_object\",\n\t\treference: strictObject,\n\t\texpects: \"Object\",\n\t\tasync: false,\n\t\tentries: entries$1,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tconst input = dataset.value;\n\t\t\tif (input && typeof input === \"object\") {\n\t\t\t\tdataset.typed = true;\n\t\t\t\tdataset.value = {};\n\t\t\t\tfor (const key in this.entries) {\n\t\t\t\t\tconst valueSchema = this.entries[key];\n\t\t\t\t\tif (key in input || (valueSchema.type === \"exact_optional\" || valueSchema.type === \"optional\" || valueSchema.type === \"nullish\") && valueSchema.default !== void 0) {\n\t\t\t\t\t\tconst value$1 = key in input ? input[key] : /* @__PURE__ */ getDefault(valueSchema);\n\t\t\t\t\t\tconst valueDataset = valueSchema[\"~run\"]({ value: value$1 }, config$1);\n\t\t\t\t\t\tif (valueDataset.issues) {\n\t\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\tvalue: value$1\n\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\tfor (const issue of valueDataset.issues) {\n\t\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (!dataset.issues) dataset.issues = valueDataset.issues;\n\t\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!valueDataset.typed) dataset.typed = false;\n\t\t\t\t\t\tdataset.value[key] = valueDataset.value;\n\t\t\t\t\t} else if (valueSchema.fallback !== void 0) dataset.value[key] = /* @__PURE__ */ getFallback(valueSchema);\n\t\t\t\t\telse if (valueSchema.type !== \"exact_optional\" && valueSchema.type !== \"optional\" && valueSchema.type !== \"nullish\") {\n\t\t\t\t\t\t_addIssue(this, \"key\", dataset, config$1, {\n\t\t\t\t\t\t\tinput: void 0,\n\t\t\t\t\t\t\texpected: `\"${key}\"`,\n\t\t\t\t\t\t\tpath: [{\n\t\t\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\t\t\torigin: \"key\",\n\t\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\tvalue: input[key]\n\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t});\n\t\t\t\t\t\tif (config$1.abortEarly) break;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!dataset.issues || !config$1.abortEarly) {\n\t\t\t\t\tfor (const key in input) if (!(key in this.entries)) {\n\t\t\t\t\t\t_addIssue(this, \"key\", dataset, config$1, {\n\t\t\t\t\t\t\tinput: key,\n\t\t\t\t\t\t\texpected: \"never\",\n\t\t\t\t\t\t\tpath: [{\n\t\t\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\t\t\torigin: \"key\",\n\t\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\tvalue: input[key]\n\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/strictObject/strictObjectAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction strictObjectAsync(entries$1, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"strict_object\",\n\t\treference: strictObjectAsync,\n\t\texpects: \"Object\",\n\t\tasync: true,\n\t\tentries: entries$1,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tconst input = dataset.value;\n\t\t\tif (input && typeof input === \"object\") {\n\t\t\t\tdataset.typed = true;\n\t\t\t\tdataset.value = {};\n\t\t\t\tconst valueDatasets = await Promise.all(Object.entries(this.entries).map(async ([key, valueSchema]) => {\n\t\t\t\t\tif (key in input || (valueSchema.type === \"exact_optional\" || valueSchema.type === \"optional\" || valueSchema.type === \"nullish\") && valueSchema.default !== void 0) {\n\t\t\t\t\t\tconst value$1 = key in input ? input[key] : await /* @__PURE__ */ getDefault(valueSchema);\n\t\t\t\t\t\treturn [\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tvalue$1,\n\t\t\t\t\t\t\tvalueSchema,\n\t\t\t\t\t\t\tawait valueSchema[\"~run\"]({ value: value$1 }, config$1)\n\t\t\t\t\t\t];\n\t\t\t\t\t}\n\t\t\t\t\treturn [\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tinput[key],\n\t\t\t\t\t\tvalueSchema,\n\t\t\t\t\t\tnull\n\t\t\t\t\t];\n\t\t\t\t}));\n\t\t\t\tfor (const [key, value$1, valueSchema, valueDataset] of valueDatasets) if (valueDataset) {\n\t\t\t\t\tif (valueDataset.issues) {\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tvalue: value$1\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (const issue of valueDataset.issues) {\n\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!dataset.issues) dataset.issues = valueDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!valueDataset.typed) dataset.typed = false;\n\t\t\t\t\tdataset.value[key] = valueDataset.value;\n\t\t\t\t} else if (valueSchema.fallback !== void 0) dataset.value[key] = await /* @__PURE__ */ getFallback(valueSchema);\n\t\t\t\telse if (valueSchema.type !== \"exact_optional\" && valueSchema.type !== \"optional\" && valueSchema.type !== \"nullish\") {\n\t\t\t\t\t_addIssue(this, \"key\", dataset, config$1, {\n\t\t\t\t\t\tinput: void 0,\n\t\t\t\t\t\texpected: `\"${key}\"`,\n\t\t\t\t\t\tpath: [{\n\t\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\t\torigin: \"key\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tvalue: value$1\n\t\t\t\t\t\t}]\n\t\t\t\t\t});\n\t\t\t\t\tif (config$1.abortEarly) break;\n\t\t\t\t}\n\t\t\t\tif (!dataset.issues || !config$1.abortEarly) {\n\t\t\t\t\tfor (const key in input) if (!(key in this.entries)) {\n\t\t\t\t\t\t_addIssue(this, \"key\", dataset, config$1, {\n\t\t\t\t\t\t\tinput: key,\n\t\t\t\t\t\t\texpected: \"never\",\n\t\t\t\t\t\t\tpath: [{\n\t\t\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\t\t\torigin: \"key\",\n\t\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\t\tvalue: input[key]\n\t\t\t\t\t\t\t}]\n\t\t\t\t\t\t});\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/strictTuple/strictTuple.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction strictTuple(items, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"strict_tuple\",\n\t\treference: strictTuple,\n\t\texpects: \"Array\",\n\t\tasync: false,\n\t\titems,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tconst input = dataset.value;\n\t\t\tif (Array.isArray(input)) {\n\t\t\t\tdataset.typed = true;\n\t\t\t\tdataset.value = [];\n\t\t\t\tfor (let key = 0; key < this.items.length; key++) {\n\t\t\t\t\tconst value$1 = input[key];\n\t\t\t\t\tconst itemDataset = this.items[key][\"~run\"]({ value: value$1 }, config$1);\n\t\t\t\t\tif (itemDataset.issues) {\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"array\",\n\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tvalue: value$1\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (const issue of itemDataset.issues) {\n\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!dataset.issues) dataset.issues = itemDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!itemDataset.typed) dataset.typed = false;\n\t\t\t\t\tdataset.value.push(itemDataset.value);\n\t\t\t\t}\n\t\t\t\tif (!(dataset.issues && config$1.abortEarly) && this.items.length < input.length) _addIssue(this, \"type\", dataset, config$1, {\n\t\t\t\t\tinput: input[this.items.length],\n\t\t\t\t\texpected: \"never\",\n\t\t\t\t\tpath: [{\n\t\t\t\t\t\ttype: \"array\",\n\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\tinput,\n\t\t\t\t\t\tkey: this.items.length,\n\t\t\t\t\t\tvalue: input[this.items.length]\n\t\t\t\t\t}]\n\t\t\t\t});\n\t\t\t} else _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/strictTuple/strictTupleAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction strictTupleAsync(items, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"strict_tuple\",\n\t\treference: strictTupleAsync,\n\t\texpects: \"Array\",\n\t\tasync: true,\n\t\titems,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tconst input = dataset.value;\n\t\t\tif (Array.isArray(input)) {\n\t\t\t\tdataset.typed = true;\n\t\t\t\tdataset.value = [];\n\t\t\t\tconst itemDatasets = await Promise.all(this.items.map(async (item, key) => {\n\t\t\t\t\tconst value$1 = input[key];\n\t\t\t\t\treturn [\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tvalue$1,\n\t\t\t\t\t\tawait item[\"~run\"]({ value: value$1 }, config$1)\n\t\t\t\t\t];\n\t\t\t\t}));\n\t\t\t\tfor (const [key, value$1, itemDataset] of itemDatasets) {\n\t\t\t\t\tif (itemDataset.issues) {\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"array\",\n\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tvalue: value$1\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (const issue of itemDataset.issues) {\n\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!dataset.issues) dataset.issues = itemDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!itemDataset.typed) dataset.typed = false;\n\t\t\t\t\tdataset.value.push(itemDataset.value);\n\t\t\t\t}\n\t\t\t\tif (!(dataset.issues && config$1.abortEarly) && this.items.length < input.length) _addIssue(this, \"type\", dataset, config$1, {\n\t\t\t\t\tinput: input[this.items.length],\n\t\t\t\t\texpected: \"never\",\n\t\t\t\t\tpath: [{\n\t\t\t\t\t\ttype: \"array\",\n\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\tinput,\n\t\t\t\t\t\tkey: this.items.length,\n\t\t\t\t\t\tvalue: input[this.items.length]\n\t\t\t\t\t}]\n\t\t\t\t});\n\t\t\t} else _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/string/string.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction string(message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"string\",\n\t\treference: string,\n\t\texpects: \"string\",\n\t\tasync: false,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (typeof dataset.value === \"string\") dataset.typed = true;\n\t\t\telse _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/symbol/symbol.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction symbol(message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"symbol\",\n\t\treference: symbol,\n\t\texpects: \"symbol\",\n\t\tasync: false,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (typeof dataset.value === \"symbol\") dataset.typed = true;\n\t\t\telse _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/tuple/tuple.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction tuple(items, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"tuple\",\n\t\treference: tuple,\n\t\texpects: \"Array\",\n\t\tasync: false,\n\t\titems,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tconst input = dataset.value;\n\t\t\tif (Array.isArray(input)) {\n\t\t\t\tdataset.typed = true;\n\t\t\t\tdataset.value = [];\n\t\t\t\tfor (let key = 0; key < this.items.length; key++) {\n\t\t\t\t\tconst value$1 = input[key];\n\t\t\t\t\tconst itemDataset = this.items[key][\"~run\"]({ value: value$1 }, config$1);\n\t\t\t\t\tif (itemDataset.issues) {\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"array\",\n\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tvalue: value$1\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (const issue of itemDataset.issues) {\n\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!dataset.issues) dataset.issues = itemDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!itemDataset.typed) dataset.typed = false;\n\t\t\t\t\tdataset.value.push(itemDataset.value);\n\t\t\t\t}\n\t\t\t} else _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/tuple/tupleAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction tupleAsync(items, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"tuple\",\n\t\treference: tupleAsync,\n\t\texpects: \"Array\",\n\t\tasync: true,\n\t\titems,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tconst input = dataset.value;\n\t\t\tif (Array.isArray(input)) {\n\t\t\t\tdataset.typed = true;\n\t\t\t\tdataset.value = [];\n\t\t\t\tconst itemDatasets = await Promise.all(this.items.map(async (item, key) => {\n\t\t\t\t\tconst value$1 = input[key];\n\t\t\t\t\treturn [\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tvalue$1,\n\t\t\t\t\t\tawait item[\"~run\"]({ value: value$1 }, config$1)\n\t\t\t\t\t];\n\t\t\t\t}));\n\t\t\t\tfor (const [key, value$1, itemDataset] of itemDatasets) {\n\t\t\t\t\tif (itemDataset.issues) {\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"array\",\n\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tvalue: value$1\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (const issue of itemDataset.issues) {\n\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!dataset.issues) dataset.issues = itemDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!itemDataset.typed) dataset.typed = false;\n\t\t\t\t\tdataset.value.push(itemDataset.value);\n\t\t\t\t}\n\t\t\t} else _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/tupleWithRest/tupleWithRest.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction tupleWithRest(items, rest, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"tuple_with_rest\",\n\t\treference: tupleWithRest,\n\t\texpects: \"Array\",\n\t\tasync: false,\n\t\titems,\n\t\trest,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tconst input = dataset.value;\n\t\t\tif (Array.isArray(input)) {\n\t\t\t\tdataset.typed = true;\n\t\t\t\tdataset.value = [];\n\t\t\t\tfor (let key = 0; key < this.items.length; key++) {\n\t\t\t\t\tconst value$1 = input[key];\n\t\t\t\t\tconst itemDataset = this.items[key][\"~run\"]({ value: value$1 }, config$1);\n\t\t\t\t\tif (itemDataset.issues) {\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"array\",\n\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tvalue: value$1\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (const issue of itemDataset.issues) {\n\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!dataset.issues) dataset.issues = itemDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!itemDataset.typed) dataset.typed = false;\n\t\t\t\t\tdataset.value.push(itemDataset.value);\n\t\t\t\t}\n\t\t\t\tif (!dataset.issues || !config$1.abortEarly) for (let key = this.items.length; key < input.length; key++) {\n\t\t\t\t\tconst value$1 = input[key];\n\t\t\t\t\tconst itemDataset = this.rest[\"~run\"]({ value: value$1 }, config$1);\n\t\t\t\t\tif (itemDataset.issues) {\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"array\",\n\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tvalue: value$1\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (const issue of itemDataset.issues) {\n\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!dataset.issues) dataset.issues = itemDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!itemDataset.typed) dataset.typed = false;\n\t\t\t\t\tdataset.value.push(itemDataset.value);\n\t\t\t\t}\n\t\t\t} else _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/tupleWithRest/tupleWithRestAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction tupleWithRestAsync(items, rest, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"tuple_with_rest\",\n\t\treference: tupleWithRestAsync,\n\t\texpects: \"Array\",\n\t\tasync: true,\n\t\titems,\n\t\trest,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tconst input = dataset.value;\n\t\t\tif (Array.isArray(input)) {\n\t\t\t\tdataset.typed = true;\n\t\t\t\tdataset.value = [];\n\t\t\t\tconst [normalDatasets, restDatasets] = await Promise.all([Promise.all(this.items.map(async (item, key) => {\n\t\t\t\t\tconst value$1 = input[key];\n\t\t\t\t\treturn [\n\t\t\t\t\t\tkey,\n\t\t\t\t\t\tvalue$1,\n\t\t\t\t\t\tawait item[\"~run\"]({ value: value$1 }, config$1)\n\t\t\t\t\t];\n\t\t\t\t})), Promise.all(input.slice(this.items.length).map(async (value$1, key) => {\n\t\t\t\t\treturn [\n\t\t\t\t\t\tkey + this.items.length,\n\t\t\t\t\t\tvalue$1,\n\t\t\t\t\t\tawait this.rest[\"~run\"]({ value: value$1 }, config$1)\n\t\t\t\t\t];\n\t\t\t\t}))]);\n\t\t\t\tfor (const [key, value$1, itemDataset] of normalDatasets) {\n\t\t\t\t\tif (itemDataset.issues) {\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"array\",\n\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tvalue: value$1\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (const issue of itemDataset.issues) {\n\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!dataset.issues) dataset.issues = itemDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!itemDataset.typed) dataset.typed = false;\n\t\t\t\t\tdataset.value.push(itemDataset.value);\n\t\t\t\t}\n\t\t\t\tif (!dataset.issues || !config$1.abortEarly) for (const [key, value$1, itemDataset] of restDatasets) {\n\t\t\t\t\tif (itemDataset.issues) {\n\t\t\t\t\t\tconst pathItem = {\n\t\t\t\t\t\t\ttype: \"array\",\n\t\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\t\tinput,\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\tvalue: value$1\n\t\t\t\t\t\t};\n\t\t\t\t\t\tfor (const issue of itemDataset.issues) {\n\t\t\t\t\t\t\tif (issue.path) issue.path.unshift(pathItem);\n\t\t\t\t\t\t\telse issue.path = [pathItem];\n\t\t\t\t\t\t\tdataset.issues?.push(issue);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!dataset.issues) dataset.issues = itemDataset.issues;\n\t\t\t\t\t\tif (config$1.abortEarly) {\n\t\t\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (!itemDataset.typed) dataset.typed = false;\n\t\t\t\t\tdataset.value.push(itemDataset.value);\n\t\t\t\t}\n\t\t\t} else _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/undefined/undefined.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction undefined_(message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"undefined\",\n\t\treference: undefined_,\n\t\texpects: \"undefined\",\n\t\tasync: false,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.value === void 0) dataset.typed = true;\n\t\t\telse _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/undefinedable/undefinedable.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction undefinedable(wrapped, default_) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"undefinedable\",\n\t\treference: undefinedable,\n\t\texpects: `(${wrapped.expects} | undefined)`,\n\t\tasync: false,\n\t\twrapped,\n\t\tdefault: default_,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.value === void 0) {\n\t\t\t\tif (this.default !== void 0) dataset.value = /* @__PURE__ */ getDefault(this, dataset, config$1);\n\t\t\t\tif (dataset.value === void 0) {\n\t\t\t\t\tdataset.typed = true;\n\t\t\t\t\treturn dataset;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn this.wrapped[\"~run\"](dataset, config$1);\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/undefinedable/undefinedableAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction undefinedableAsync(wrapped, default_) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"undefinedable\",\n\t\treference: undefinedableAsync,\n\t\texpects: `(${wrapped.expects} | undefined)`,\n\t\tasync: true,\n\t\twrapped,\n\t\tdefault: default_,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tif (dataset.value === void 0) {\n\t\t\t\tif (this.default !== void 0) dataset.value = await /* @__PURE__ */ getDefault(this, dataset, config$1);\n\t\t\t\tif (dataset.value === void 0) {\n\t\t\t\t\tdataset.typed = true;\n\t\t\t\t\treturn dataset;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn this.wrapped[\"~run\"](dataset, config$1);\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/union/utils/_subIssues/_subIssues.ts\n/**\n* Returns the sub issues of the provided datasets for the union issue.\n*\n* @param datasets The datasets.\n*\n* @returns The sub issues.\n*\n* @internal\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction _subIssues(datasets) {\n\tlet issues;\n\tif (datasets) for (const dataset of datasets) if (issues) issues.push(...dataset.issues);\n\telse issues = dataset.issues;\n\treturn issues;\n}\n\n//#endregion\n//#region src/schemas/union/union.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction union(options, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"union\",\n\t\treference: union,\n\t\texpects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), \"|\"),\n\t\tasync: false,\n\t\toptions,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tlet validDataset;\n\t\t\tlet typedDatasets;\n\t\t\tlet untypedDatasets;\n\t\t\tfor (const schema of this.options) {\n\t\t\t\tconst optionDataset = schema[\"~run\"]({ value: dataset.value }, config$1);\n\t\t\t\tif (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);\n\t\t\t\telse typedDatasets = [optionDataset];\n\t\t\t\telse {\n\t\t\t\t\tvalidDataset = optionDataset;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if (untypedDatasets) untypedDatasets.push(optionDataset);\n\t\t\t\telse untypedDatasets = [optionDataset];\n\t\t\t}\n\t\t\tif (validDataset) return validDataset;\n\t\t\tif (typedDatasets) {\n\t\t\t\tif (typedDatasets.length === 1) return typedDatasets[0];\n\t\t\t\t_addIssue(this, \"type\", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });\n\t\t\t\tdataset.typed = true;\n\t\t\t} else if (untypedDatasets?.length === 1) return untypedDatasets[0];\n\t\t\telse _addIssue(this, \"type\", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/union/unionAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction unionAsync(options, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"union\",\n\t\treference: unionAsync,\n\t\texpects: /* @__PURE__ */ _joinExpects(options.map((option) => option.expects), \"|\"),\n\t\tasync: true,\n\t\toptions,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tlet validDataset;\n\t\t\tlet typedDatasets;\n\t\t\tlet untypedDatasets;\n\t\t\tfor (const schema of this.options) {\n\t\t\t\tconst optionDataset = await schema[\"~run\"]({ value: dataset.value }, config$1);\n\t\t\t\tif (optionDataset.typed) if (optionDataset.issues) if (typedDatasets) typedDatasets.push(optionDataset);\n\t\t\t\telse typedDatasets = [optionDataset];\n\t\t\t\telse {\n\t\t\t\t\tvalidDataset = optionDataset;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse if (untypedDatasets) untypedDatasets.push(optionDataset);\n\t\t\t\telse untypedDatasets = [optionDataset];\n\t\t\t}\n\t\t\tif (validDataset) return validDataset;\n\t\t\tif (typedDatasets) {\n\t\t\t\tif (typedDatasets.length === 1) return typedDatasets[0];\n\t\t\t\t_addIssue(this, \"type\", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(typedDatasets) });\n\t\t\t\tdataset.typed = true;\n\t\t\t} else if (untypedDatasets?.length === 1) return untypedDatasets[0];\n\t\t\telse _addIssue(this, \"type\", dataset, config$1, { issues: /* @__PURE__ */ _subIssues(untypedDatasets) });\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/unknown/unknown.ts\n/**\n* Creates a unknown schema.\n*\n* @returns A unknown schema.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction unknown() {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"unknown\",\n\t\treference: unknown,\n\t\texpects: \"unknown\",\n\t\tasync: false,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset) {\n\t\t\tdataset.typed = true;\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/variant/variant.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction variant(key, options, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"variant\",\n\t\treference: variant,\n\t\texpects: \"Object\",\n\t\tasync: false,\n\t\tkey,\n\t\toptions,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tconst input = dataset.value;\n\t\t\tif (input && typeof input === \"object\") {\n\t\t\t\tlet outputDataset;\n\t\t\t\tlet maxDiscriminatorPriority = 0;\n\t\t\t\tlet invalidDiscriminatorKey = this.key;\n\t\t\t\tlet expectedDiscriminators = [];\n\t\t\t\tconst parseOptions = (variant$1, allKeys) => {\n\t\t\t\t\tfor (const schema of variant$1.options) {\n\t\t\t\t\t\tif (schema.type === \"variant\") parseOptions(schema, new Set(allKeys).add(schema.key));\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tlet keysAreValid = true;\n\t\t\t\t\t\t\tlet currentPriority = 0;\n\t\t\t\t\t\t\tfor (const currentKey of allKeys) {\n\t\t\t\t\t\t\t\tconst discriminatorSchema = schema.entries[currentKey];\n\t\t\t\t\t\t\t\tif (currentKey in input ? discriminatorSchema[\"~run\"]({\n\t\t\t\t\t\t\t\t\ttyped: false,\n\t\t\t\t\t\t\t\t\tvalue: input[currentKey]\n\t\t\t\t\t\t\t\t}, { abortEarly: true }).issues : discriminatorSchema.type !== \"exact_optional\" && discriminatorSchema.type !== \"optional\" && discriminatorSchema.type !== \"nullish\") {\n\t\t\t\t\t\t\t\t\tkeysAreValid = false;\n\t\t\t\t\t\t\t\t\tif (invalidDiscriminatorKey !== currentKey && (maxDiscriminatorPriority < currentPriority || maxDiscriminatorPriority === currentPriority && currentKey in input && !(invalidDiscriminatorKey in input))) {\n\t\t\t\t\t\t\t\t\t\tmaxDiscriminatorPriority = currentPriority;\n\t\t\t\t\t\t\t\t\t\tinvalidDiscriminatorKey = currentKey;\n\t\t\t\t\t\t\t\t\t\texpectedDiscriminators = [];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (invalidDiscriminatorKey === currentKey) expectedDiscriminators.push(schema.entries[currentKey].expects);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcurrentPriority++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (keysAreValid) {\n\t\t\t\t\t\t\t\tconst optionDataset = schema[\"~run\"]({ value: input }, config$1);\n\t\t\t\t\t\t\t\tif (!outputDataset || !outputDataset.typed && optionDataset.typed) outputDataset = optionDataset;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (outputDataset && !outputDataset.issues) break;\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tparseOptions(this, new Set([this.key]));\n\t\t\t\tif (outputDataset) return outputDataset;\n\t\t\t\t_addIssue(this, \"type\", dataset, config$1, {\n\t\t\t\t\tinput: input[invalidDiscriminatorKey],\n\t\t\t\t\texpected: /* @__PURE__ */ _joinExpects(expectedDiscriminators, \"|\"),\n\t\t\t\t\tpath: [{\n\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\tinput,\n\t\t\t\t\t\tkey: invalidDiscriminatorKey,\n\t\t\t\t\t\tvalue: input[invalidDiscriminatorKey]\n\t\t\t\t\t}]\n\t\t\t\t});\n\t\t\t} else _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/variant/variantAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction variantAsync(key, options, message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"variant\",\n\t\treference: variantAsync,\n\t\texpects: \"Object\",\n\t\tasync: true,\n\t\tkey,\n\t\toptions,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tconst input = dataset.value;\n\t\t\tif (input && typeof input === \"object\") {\n\t\t\t\tlet outputDataset;\n\t\t\t\tlet maxDiscriminatorPriority = 0;\n\t\t\t\tlet invalidDiscriminatorKey = this.key;\n\t\t\t\tlet expectedDiscriminators = [];\n\t\t\t\tconst parseOptions = async (variant$1, allKeys) => {\n\t\t\t\t\tfor (const schema of variant$1.options) {\n\t\t\t\t\t\tif (schema.type === \"variant\") await parseOptions(schema, new Set(allKeys).add(schema.key));\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tlet keysAreValid = true;\n\t\t\t\t\t\t\tlet currentPriority = 0;\n\t\t\t\t\t\t\tfor (const currentKey of allKeys) {\n\t\t\t\t\t\t\t\tconst discriminatorSchema = schema.entries[currentKey];\n\t\t\t\t\t\t\t\tif (currentKey in input ? (await discriminatorSchema[\"~run\"]({\n\t\t\t\t\t\t\t\t\ttyped: false,\n\t\t\t\t\t\t\t\t\tvalue: input[currentKey]\n\t\t\t\t\t\t\t\t}, { abortEarly: true })).issues : discriminatorSchema.type !== \"exact_optional\" && discriminatorSchema.type !== \"optional\" && discriminatorSchema.type !== \"nullish\") {\n\t\t\t\t\t\t\t\t\tkeysAreValid = false;\n\t\t\t\t\t\t\t\t\tif (invalidDiscriminatorKey !== currentKey && (maxDiscriminatorPriority < currentPriority || maxDiscriminatorPriority === currentPriority && currentKey in input && !(invalidDiscriminatorKey in input))) {\n\t\t\t\t\t\t\t\t\t\tmaxDiscriminatorPriority = currentPriority;\n\t\t\t\t\t\t\t\t\t\tinvalidDiscriminatorKey = currentKey;\n\t\t\t\t\t\t\t\t\t\texpectedDiscriminators = [];\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (invalidDiscriminatorKey === currentKey) expectedDiscriminators.push(schema.entries[currentKey].expects);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tcurrentPriority++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif (keysAreValid) {\n\t\t\t\t\t\t\t\tconst optionDataset = await schema[\"~run\"]({ value: input }, config$1);\n\t\t\t\t\t\t\t\tif (!outputDataset || !outputDataset.typed && optionDataset.typed) outputDataset = optionDataset;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (outputDataset && !outputDataset.issues) break;\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tawait parseOptions(this, new Set([this.key]));\n\t\t\t\tif (outputDataset) return outputDataset;\n\t\t\t\t_addIssue(this, \"type\", dataset, config$1, {\n\t\t\t\t\tinput: input[invalidDiscriminatorKey],\n\t\t\t\t\texpected: /* @__PURE__ */ _joinExpects(expectedDiscriminators, \"|\"),\n\t\t\t\t\tpath: [{\n\t\t\t\t\t\ttype: \"object\",\n\t\t\t\t\t\torigin: \"value\",\n\t\t\t\t\t\tinput,\n\t\t\t\t\t\tkey: invalidDiscriminatorKey,\n\t\t\t\t\t\tvalue: input[invalidDiscriminatorKey]\n\t\t\t\t\t}]\n\t\t\t\t});\n\t\t\t} else _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/schemas/void/void.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction void_(message$1) {\n\treturn {\n\t\tkind: \"schema\",\n\t\ttype: \"void\",\n\t\treference: void_,\n\t\texpects: \"void\",\n\t\tasync: false,\n\t\tmessage: message$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tif (dataset.value === void 0) dataset.typed = true;\n\t\t\telse _addIssue(this, \"type\", dataset, config$1);\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/methods/keyof/keyof.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction keyof(schema, message$1) {\n\treturn /* @__PURE__ */ picklist(Object.keys(schema.entries), message$1);\n}\n\n//#endregion\n//#region src/methods/message/message.ts\n/**\n* Changes the local message configuration of a schema.\n*\n* @param schema The schema to configure.\n* @param message_ The error message.\n*\n* @returns The configured schema.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction message(schema, message_) {\n\treturn {\n\t\t...schema,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\treturn schema[\"~run\"](dataset, {\n\t\t\t\t...config$1,\n\t\t\t\tmessage: message_\n\t\t\t});\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/methods/omit/omit.ts\n/**\n* Creates a modified copy of an object schema that does not contain the\n* selected entries.\n*\n* @param schema The schema to omit from.\n* @param keys The selected entries.\n*\n* @returns An object schema.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction omit(schema, keys) {\n\tconst entries$1 = { ...schema.entries };\n\tfor (const key of keys) delete entries$1[key];\n\treturn {\n\t\t...schema,\n\t\tentries: entries$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/methods/parse/parse.ts\n/**\n* Parses an unknown input based on a schema.\n*\n* @param schema The schema to be used.\n* @param input The input to be parsed.\n* @param config The parse configuration.\n*\n* @returns The parsed input.\n*/\nfunction parse(schema, input, config$1) {\n\tconst dataset = schema[\"~run\"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));\n\tif (dataset.issues) throw new ValiError(dataset.issues);\n\treturn dataset.value;\n}\n\n//#endregion\n//#region src/methods/parse/parseAsync.ts\n/**\n* Parses an unknown input based on a schema.\n*\n* @param schema The schema to be used.\n* @param input The input to be parsed.\n* @param config The parse configuration.\n*\n* @returns The parsed input.\n*/\nasync function parseAsync(schema, input, config$1) {\n\tconst dataset = await schema[\"~run\"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));\n\tif (dataset.issues) throw new ValiError(dataset.issues);\n\treturn dataset.value;\n}\n\n//#endregion\n//#region src/methods/parser/parser.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction parser(schema, config$1) {\n\tconst func = (input) => parse(schema, input, config$1);\n\tfunc.schema = schema;\n\tfunc.config = config$1;\n\treturn func;\n}\n\n//#endregion\n//#region src/methods/parser/parserAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction parserAsync(schema, config$1) {\n\tconst func = (input) => parseAsync(schema, input, config$1);\n\tfunc.schema = schema;\n\tfunc.config = config$1;\n\treturn func;\n}\n\n//#endregion\n//#region src/methods/partial/partial.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction partial(schema, keys) {\n\tconst entries$1 = {};\n\tfor (const key in schema.entries) entries$1[key] = !keys || keys.includes(key) ? /* @__PURE__ */ optional(schema.entries[key]) : schema.entries[key];\n\treturn {\n\t\t...schema,\n\t\tentries: entries$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/methods/partial/partialAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction partialAsync(schema, keys) {\n\tconst entries$1 = {};\n\tfor (const key in schema.entries) entries$1[key] = !keys || keys.includes(key) ? /* @__PURE__ */ optionalAsync(schema.entries[key]) : schema.entries[key];\n\treturn {\n\t\t...schema,\n\t\tentries: entries$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/methods/pick/pick.ts\n/**\n* Creates a modified copy of an object schema that contains only the selected\n* entries.\n*\n* @param schema The schema to pick from.\n* @param keys The selected entries.\n*\n* @returns An object schema.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction pick(schema, keys) {\n\tconst entries$1 = {};\n\tfor (const key of keys) entries$1[key] = schema.entries[key];\n\treturn {\n\t\t...schema,\n\t\tentries: entries$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/methods/pipe/pipe.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction pipe(...pipe$1) {\n\treturn {\n\t\t...pipe$1[0],\n\t\tpipe: pipe$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\t\"~run\"(dataset, config$1) {\n\t\t\tfor (const item of pipe$1) if (item.kind !== \"metadata\") {\n\t\t\t\tif (dataset.issues && (item.kind === \"schema\" || item.kind === \"transformation\")) {\n\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly) dataset = item[\"~run\"](dataset, config$1);\n\t\t\t}\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/methods/pipe/pipeAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction pipeAsync(...pipe$1) {\n\treturn {\n\t\t...pipe$1[0],\n\t\tpipe: pipe$1,\n\t\tasync: true,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t},\n\t\tasync \"~run\"(dataset, config$1) {\n\t\t\tfor (const item of pipe$1) if (item.kind !== \"metadata\") {\n\t\t\t\tif (dataset.issues && (item.kind === \"schema\" || item.kind === \"transformation\")) {\n\t\t\t\t\tdataset.typed = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (!dataset.issues || !config$1.abortEarly && !config$1.abortPipeEarly) dataset = await item[\"~run\"](dataset, config$1);\n\t\t\t}\n\t\t\treturn dataset;\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/methods/required/required.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction required(schema, arg2, arg3) {\n\tconst keys = Array.isArray(arg2) ? arg2 : void 0;\n\tconst message$1 = Array.isArray(arg2) ? arg3 : arg2;\n\tconst entries$1 = {};\n\tfor (const key in schema.entries) entries$1[key] = !keys || keys.includes(key) ? /* @__PURE__ */ nonOptional(schema.entries[key], message$1) : schema.entries[key];\n\treturn {\n\t\t...schema,\n\t\tentries: entries$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/methods/required/requiredAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction requiredAsync(schema, arg2, arg3) {\n\tconst keys = Array.isArray(arg2) ? arg2 : void 0;\n\tconst message$1 = Array.isArray(arg2) ? arg3 : arg2;\n\tconst entries$1 = {};\n\tfor (const key in schema.entries) entries$1[key] = !keys || keys.includes(key) ? /* @__PURE__ */ nonOptionalAsync(schema.entries[key], message$1) : schema.entries[key];\n\treturn {\n\t\t...schema,\n\t\tentries: entries$1,\n\t\tget \"~standard\"() {\n\t\t\treturn /* @__PURE__ */ _getStandardProps(this);\n\t\t}\n\t};\n}\n\n//#endregion\n//#region src/methods/safeParse/safeParse.ts\n/**\n* Parses an unknown input based on a schema.\n*\n* @param schema The schema to be used.\n* @param input The input to be parsed.\n* @param config The parse configuration.\n*\n* @returns The parse result.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction safeParse(schema, input, config$1) {\n\tconst dataset = schema[\"~run\"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));\n\treturn {\n\t\ttyped: dataset.typed,\n\t\tsuccess: !dataset.issues,\n\t\toutput: dataset.value,\n\t\tissues: dataset.issues\n\t};\n}\n\n//#endregion\n//#region src/methods/safeParse/safeParseAsync.ts\n/**\n* Parses an unknown input based on a schema.\n*\n* @param schema The schema to be used.\n* @param input The input to be parsed.\n* @param config The parse configuration.\n*\n* @returns The parse result.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nasync function safeParseAsync(schema, input, config$1) {\n\tconst dataset = await schema[\"~run\"]({ value: input }, /* @__PURE__ */ getGlobalConfig(config$1));\n\treturn {\n\t\ttyped: dataset.typed,\n\t\tsuccess: !dataset.issues,\n\t\toutput: dataset.value,\n\t\tissues: dataset.issues\n\t};\n}\n\n//#endregion\n//#region src/methods/safeParser/safeParser.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction safeParser(schema, config$1) {\n\tconst func = (input) => /* @__PURE__ */ safeParse(schema, input, config$1);\n\tfunc.schema = schema;\n\tfunc.config = config$1;\n\treturn func;\n}\n\n//#endregion\n//#region src/methods/safeParser/safeParserAsync.ts\n/* @__NO_SIDE_EFFECTS__ */\nfunction safeParserAsync(schema, config$1) {\n\tconst func = (input) => /* @__PURE__ */ safeParseAsync(schema, input, config$1);\n\tfunc.schema = schema;\n\tfunc.config = config$1;\n\treturn func;\n}\n\n//#endregion\n//#region src/methods/summarize/summarize.ts\n/**\n* Summarize the error messages of issues in a pretty-printable multi-line string.\n*\n* @param issues The list of issues.\n*\n* @returns A summary of the issues.\n*\n* @beta\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction summarize(issues) {\n\tlet summary = \"\";\n\tfor (const issue of issues) {\n\t\tif (summary) summary += \"\\n\";\n\t\tsummary += `× ${issue.message}`;\n\t\tconst dotPath = /* @__PURE__ */ getDotPath(issue);\n\t\tif (dotPath) summary += `\\n → at ${dotPath}`;\n\t}\n\treturn summary;\n}\n\n//#endregion\n//#region src/methods/unwrap/unwrap.ts\n/**\n* Unwraps the wrapped schema.\n*\n* @param schema The schema to be unwrapped.\n*\n* @returns The unwrapped schema.\n*/\n/* @__NO_SIDE_EFFECTS__ */\nfunction unwrap(schema) {\n\treturn schema.wrapped;\n}\n\n//#endregion\nexport { BASE64_REGEX, BIC_REGEX, CUID2_REGEX, DECIMAL_REGEX, DIGITS_REGEX, EMAIL_REGEX, EMOJI_REGEX, HEXADECIMAL_REGEX, HEX_COLOR_REGEX, IMEI_REGEX, IPV4_REGEX, IPV6_REGEX, IP_REGEX, ISO_DATE_REGEX, ISO_DATE_TIME_REGEX, ISO_TIMESTAMP_REGEX, ISO_TIME_REGEX, ISO_TIME_SECOND_REGEX, ISO_WEEK_REGEX, MAC48_REGEX, MAC64_REGEX, MAC_REGEX, NANO_ID_REGEX, OCTAL_REGEX, RFC_EMAIL_REGEX, SLUG_REGEX, ULID_REGEX, UUID_REGEX, ValiError, _addIssue, _getByteCount, _getGraphemeCount, _getLastMetadata, _getStandardProps, _getWordCount, _isLuhnAlgo, _isValidObjectKey, _joinExpects, _stringify, any, args, argsAsync, array, arrayAsync, assert, awaitAsync, base64, bic, bigint, blob, boolean, brand, bytes, check, checkAsync, checkItems, checkItemsAsync, config, creditCard, cuid2, custom, customAsync, date, decimal, deleteGlobalConfig, deleteGlobalMessage, deleteSchemaMessage, deleteSpecificMessage, description, digits, email, emoji, empty, endsWith, entries, entriesFromList, entriesFromObjects, enum_ as enum, enum_, everyItem, exactOptional, exactOptionalAsync, examples, excludes, fallback, fallbackAsync, file, filterItems, findItem, finite, flatten, flavor, forward, forwardAsync, function_ as function, function_, getDefault, getDefaults, getDefaultsAsync, getDescription, getDotPath, getExamples, getFallback, getFallbacks, getFallbacksAsync, getGlobalConfig, getGlobalMessage, getMetadata, getSchemaMessage, getSpecificMessage, getTitle, graphemes, gtValue, hash, hexColor, hexadecimal, imei, includes, instance, integer, intersect, intersectAsync, ip, ipv4, ipv6, is, isOfKind, isOfType, isValiError, isoDate, isoDateTime, isoTime, isoTimeSecond, isoTimestamp, isoWeek, keyof, lazy, lazyAsync, length, literal, looseObject, looseObjectAsync, looseTuple, looseTupleAsync, ltValue, mac, mac48, mac64, map, mapAsync, mapItems, maxBytes, maxEntries, maxGraphemes, maxLength, maxSize, maxValue, maxWords, message, metadata, mimeType, minBytes, minEntries, minGraphemes, minLength, minSize, minValue, minWords, multipleOf, nan, nanoid, never, nonEmpty, nonNullable, nonNullableAsync, nonNullish, nonNullishAsync, nonOptional, nonOptionalAsync, normalize, notBytes, notEntries, notGraphemes, notLength, notSize, notValue, notValues, notWords, null_ as null, null_, nullable, nullableAsync, nullish, nullishAsync, number, object, objectAsync, objectWithRest, objectWithRestAsync, octal, omit, optional, optionalAsync, parse, parseAsync, parseJson, parser, parserAsync, partial, partialAsync, partialCheck, partialCheckAsync, pick, picklist, pipe, pipeAsync, promise, rawCheck, rawCheckAsync, rawTransform, rawTransformAsync, readonly, record, recordAsync, reduceItems, regex, required, requiredAsync, returns, returnsAsync, rfcEmail, safeInteger, safeParse, safeParseAsync, safeParser, safeParserAsync, set, setAsync, setGlobalConfig, setGlobalMessage, setSchemaMessage, setSpecificMessage, size, slug, someItem, sortItems, startsWith, strictObject, strictObjectAsync, strictTuple, strictTupleAsync, string, stringifyJson, summarize, symbol, title, toBigint, toBoolean, toDate, toLowerCase, toMaxValue, toMinValue, toNumber, toString, toUpperCase, transform, transformAsync, trim, trimEnd, trimStart, tuple, tupleAsync, tupleWithRest, tupleWithRestAsync, ulid, undefined_ as undefined, undefined_, undefinedable, undefinedableAsync, union, unionAsync, unknown, unwrap, url, uuid, value, values, variant, variantAsync, void_ as void, void_, words };","var $ = Object.defineProperty;\nvar q = (r, e, t) => e in r ? $(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;\nvar w = (r, e, t) => q(r, typeof e != \"symbol\" ? e + \"\" : e, t);\nvar D = Object.defineProperty, G = (r, e, t) => e in r ? D(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t, E = (r, e, t) => G(r, typeof e != \"symbol\" ? e + \"\" : e, t);\nfunction I(r) {\n return (e) => e instanceof r;\n}\nfunction L(r, e) {\n const t = class extends Error {\n constructor(...d) {\n const l = typeof e == \"function\" ? e(...d) : typeof e == \"string\" ? [e] : e || [];\n super(...l), this.name = r;\n }\n };\n E(t, \"is\", I(t));\n let c = t;\n return Object.defineProperty(c, \"name\", { value: r }), c;\n}\nfunction H(r, e, t) {\n const c = class extends L(r, t) {\n constructor(...l) {\n super(...l), E(this, \"data\"), this.data = e(...l);\n }\n };\n E(c, \"is\", I(c));\n let o = c;\n return Object.defineProperty(o, \"name\", { value: r }), o;\n}\nclass J extends L(\"CancelledError\", \"Promise was canceled\") {\n}\nclass K extends H(\n \"TimeoutError\",\n (e) => ({ timeout: e }),\n (e, t) => [`Timeout reached: ${e}ms`, { cause: t }]\n) {\n}\nconst S = Symbol(\"resolved\");\nfunction V(r) {\n return typeof r == \"object\" && !!r && \"tag\" in r && r.tag === S;\n}\nfunction M(r) {\n return { tag: S, value: r };\n}\nfunction C(r, e) {\n return r.reject = e.reject, r.resolve = e.resolve, r;\n}\nclass g extends Promise {\n constructor(t, c) {\n let o, d, l, p;\n typeof t == \"function\" ? (l = t, p = c || {}) : p = t || {};\n let u, a;\n const x = () => !!a, O = () => !!u;\n let f = {};\n const b = [], T = () => {\n b.forEach((m) => m()), b.splice(0, b.length), f = {};\n }, y = new AbortController(), k = () => O() || x();\n super((m, F) => {\n const { abortOnResolve: P = !0, abortOnReject: A = !0 } = p;\n d = (n) => {\n var h, s;\n k() || (m(n), u = [n], (h = f.resolved) == null || h.forEach((i) => i(n)), (s = f.finalized) == null || s.forEach((i) => i({ kind: \"resolved\", result: n })), T(), P && y.abort(M(n)));\n }, o = (n) => {\n var h, s;\n k() || (F(n), a = [n], (h = f.rejected) == null || h.forEach((i) => i(n)), (s = f.finalized) == null || s.forEach((i) => i({ kind: \"rejected\", reason: n })), T(), A && y.abort(n));\n };\n const { abortSignal: j } = p;\n if (j) {\n if (j.aborted)\n return o(j.reason);\n const n = () => {\n o(j.reason);\n };\n j.addEventListener(\"abort\", n, !0), b.push(() => {\n j.removeEventListener(\"abort\", n, !0);\n });\n }\n const { timeout: R } = p;\n if (R) {\n const n = setTimeout(() => {\n o(new K(R));\n }, R);\n b.push(() => {\n clearTimeout(n);\n });\n }\n try {\n const n = () => {\n }, h = l && l(d, o, {\n abortSignal: y.signal,\n get isRejected() {\n return x();\n },\n get isResolved() {\n return O();\n },\n on(s, i) {\n if (u || a) {\n if (s === \"finalized\") {\n const v = u ? { kind: \"resolved\", result: u[0] } : { kind: \"rejected\", reason: a[0] };\n i(v);\n } else s === \"resolved\" && u ? i(u[0]) : s === \"rejected\" && a && i(a[0]);\n return n;\n }\n return f[s] || (f[s] = []), f[s].push(i), () => {\n const v = f[s] || [], z = v.indexOf(i);\n z >= 0 && v.splice(z, 1);\n };\n },\n get result() {\n return u == null ? void 0 : u[0];\n },\n get rejectReason() {\n return a == null ? void 0 : a[0];\n },\n throwIfRejected() {\n if (a)\n throw a[0];\n }\n });\n h instanceof Promise && h.catch(o);\n } catch (n) {\n o(n);\n }\n });\n /**\n * Rejects the initially created promise.\n *\n * This method not only aborts the signal passed to the executor, but also rejects the\n * promise itself calling all chained listeners.\n *\n * The reason passed to the method is being passed as-is to the executor's context.\n */\n w(this, \"reject\");\n /**\n * Resolves the promise.\n */\n w(this, \"resolve\");\n this.reject = o, this.resolve = d;\n }\n static fn(t, c) {\n return new g(async (o, d, l) => {\n try {\n o(await t(l));\n } catch (p) {\n d(p);\n }\n }, c);\n }\n static resolve(t) {\n return this.fn(() => t);\n }\n /**\n * @see Promise.reject\n */\n static reject(t) {\n return new g((c, o) => {\n o(t);\n });\n }\n /**\n * Rejects the promise with the `CancelledError` error.\n */\n cancel() {\n this.reject(new J());\n }\n /**\n * @see Promise.catch\n */\n catch(t) {\n return this.then(void 0, t);\n }\n /**\n * @see Promise.finally\n */\n finally(t) {\n return C(super.finally(t), this);\n }\n /**\n * @see Promise.then\n */\n then(t, c) {\n return C(\n super.then(t, c),\n this\n );\n }\n}\nexport {\n g as BetterPromise,\n J as CancelledError,\n K as TimeoutError,\n V as isResolved,\n M as withResolved\n};\n//# sourceMappingURL=index.js.map\n","import { BetterPromise as d } from \"better-promises\";\nimport { function as f, taskEither as i, either as u } from \"fp-ts\";\nfunction L(t) {\n return t.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);\n}\nfunction $(t) {\n return t.replace(/[A-Z]/g, (e) => `_${e.toLowerCase()}`);\n}\nfunction x(t) {\n return Object.entries(t).reduce((e, [o, r]) => (e[$(o)] = r, e), {});\n}\nfunction k(t) {\n return t.replace(/_[a-z]/g, (e) => e[1].toUpperCase());\n}\nfunction S(t) {\n return Object.entries(t).reduce((e, [o, r]) => (e[k(o)] = r, e), {});\n}\nfunction m(t) {\n const e = S(t);\n for (const o in e) {\n const r = e[o];\n r && typeof r == \"object\" && !(r instanceof Date) && (e[o] = Array.isArray(r) ? r.map(m) : m(r));\n }\n return e;\n}\nfunction A(t) {\n return t.replace(/_([a-z])/g, (e, o) => `-${o.toLowerCase()}`);\n}\nfunction h(t) {\n return `tapps/${t}`;\n}\nfunction K(t, e) {\n sessionStorage.setItem(h(t), JSON.stringify(e));\n}\nfunction _(t) {\n const e = sessionStorage.getItem(h(t));\n try {\n return e ? JSON.parse(e) : void 0;\n } catch {\n }\n}\nfunction v(...t) {\n const e = t.flat(1);\n return [\n e.push.bind(e),\n () => {\n e.forEach((o) => {\n o();\n });\n }\n ];\n}\n// @__NO_SIDE_EFFECTS__\nfunction D(t, e) {\n e || (e = {});\n const {\n textColor: o,\n bgColor: r,\n shouldLog: c\n } = e, n = c === void 0 ? !0 : c, b = typeof n == \"boolean\" ? () => n : n, g = (a, s, ...l) => {\n if (s || b()) {\n const p = \"font-weight:bold;padding:0 5px;border-radius:100px\", [y, C, w] = {\n log: [\"#0089c3\", \"white\", \"INFO\"],\n error: [\"#ff0000F0\", \"white\", \"ERR\"],\n warn: [\"#D38E15\", \"white\", \"WARN\"]\n }[a];\n console[a](\n `%c${w} ${Intl.DateTimeFormat(\"en-GB\", {\n hour: \"2-digit\",\n minute: \"2-digit\",\n second: \"2-digit\",\n fractionalSecondDigits: 3,\n timeZone: \"UTC\"\n }).format(/* @__PURE__ */ new Date())}%c %c${t}`,\n `${p};background-color:${y};color:${C}`,\n \"\",\n `${p};${o ? `color:${o};` : \"\"}${r ? `background-color:${r}` : \"\"}`,\n ...l\n );\n }\n };\n return [\n [\"log\", \"forceLog\"],\n [\"warn\", \"forceWarn\"],\n [\"error\", \"forceError\"]\n ].reduce((a, [s, l]) => (a[s] = g.bind(void 0, s, !1), a[l] = g.bind(void 0, s, !0), a), {});\n}\nfunction T(t) {\n const e = (o) => {\n throw o;\n };\n return typeof t == \"function\" ? d.resolve(f.pipe(t, i.match(e, (o) => o))()) : f.pipe(t, u.match(e, (o) => o));\n}\n// @__NO_SIDE_EFFECTS__\nfunction F(t) {\n return Object.assign(\n (...e) => T(t(...e)),\n t\n );\n}\nconst O = /* @__PURE__ */ Object.assign(\n (t, e) => f.pipe(\n i.tryCatch(\n () => new d((o, r, c) => t(\n (n) => o(u.right(n)),\n (n) => o(u.left(n)),\n c\n ), e),\n (o) => o\n ),\n i.chainW(u.match(i.left, i.right))\n ),\n {\n fn: (t, e) => O((o, r, c) => {\n const n = t(c);\n f.pipe(\n typeof n == \"function\" ? n : i.fromEither(n),\n i.matchW(r, o)\n )();\n }, e)\n }\n);\nexport {\n O as BetterTaskEither,\n L as camelToKebab,\n $ as camelToSnake,\n x as camelToSnakeObjKeys,\n v as createCbCollector,\n D as createLogger,\n m as deepSnakeToCamelObjKeys,\n _ as getStorageValue,\n K as setStorageValue,\n k as snakeToCamel,\n S as snakeToCamelObjKeys,\n A as snakeToKebab,\n T as throwifyAnyEither,\n F as throwifyFpFn\n};\n//# sourceMappingURL=index.js.map\n","var l = Object.defineProperty;\nvar o = (e, t, n) => t in e ? l(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;\nvar c = (e, t, n) => o(e, typeof t != \"symbol\" ? t + \"\" : t, n);\nfunction f(e) {\n return (t) => t instanceof e;\n}\nfunction u(e, t) {\n const s = class s extends Error {\n constructor(...d) {\n const i = typeof t == \"function\" ? t(...d) : typeof t == \"string\" ? [t] : t || [];\n super(...i), this.name = e;\n }\n };\n c(s, \"is\", f(s));\n let n = s;\n return Object.defineProperty(n, \"name\", { value: e }), n;\n}\nfunction y(e, t, n) {\n const a = class a extends u(e, n) {\n constructor(...r) {\n super(...r);\n c(this, \"data\");\n this.data = t(...r);\n }\n };\n c(a, \"is\", f(a));\n let s = a;\n return Object.defineProperty(s, \"name\", { value: e }), s;\n}\nexport {\n u as errorClass,\n y as errorClassWithData\n};\n//# sourceMappingURL=index.js.map\n","import { throwifyFpFn as l } from \"@vbotma/toolkit\";\nimport { function as C, either as s } from \"fp-ts\";\nimport { pipe as u, string as e, check as y, transform as f, union as g, instance as D, parse as S, looseObject as p, optional as n, integer as G, date as T, number as _, boolean as d, is as W, unknown as F, record as I } from \"valibot\";\nfunction J(t) {\n const r = (a) => {\n const i = {};\n return new URLSearchParams(a).forEach((o, m) => {\n const h = i[m];\n Array.isArray(h) ? h.push(o) : h === void 0 ? i[m] = o : i[m] = [h, o];\n }), S(t, i);\n };\n return u(\n g([e(), D(URLSearchParams)]),\n y((a) => {\n try {\n return r(a), !0;\n } catch {\n return !1;\n }\n }, \"The value doesn't match required schema\"),\n f(r)\n );\n}\nfunction N(t) {\n return u(\n e(),\n y((r) => {\n try {\n return JSON.parse(r), !0;\n } catch {\n return !1;\n }\n }, \"Input is not a valid JSON value\"),\n f(JSON.parse),\n t\n );\n}\nfunction c(t) {\n return u(e(), N(t));\n}\nfunction P(t) {\n return u(\n g([e(), D(URLSearchParams)]),\n J(t)\n );\n}\nfunction b(t) {\n return (r) => t.test(r);\n}\nconst O = b(/^#[\\da-f]{3}$/i), U = b(/^#[\\da-f]{4}$/i), z = b(/^#[\\da-f]{6}$/i), E = b(/^#[\\da-f]{8}$/i);\nfunction V(t) {\n return [z, E, O, U].some((r) => r(t));\n}\nfunction A(t) {\n let r = \"#\";\n for (let a = 0; a < t.length - 1; a += 1)\n r += t[1 + a].repeat(2);\n return r;\n}\nfunction B(t) {\n const r = t.replace(/\\s/g, \"\").toLowerCase();\n if (/^#[\\da-f]{3}$/i.test(r))\n return s.right(A(r.toLowerCase() + \"f\"));\n if (/^#[\\da-f]{4}$/i.test(r))\n return s.right(A(r.toLowerCase()));\n if (/^#[\\da-f]{6}$/i.test(r))\n return s.right(r.toLowerCase() + \"ff\");\n if (/^#[\\da-f]{8}$/i.test(r))\n return s.right(r.toLowerCase());\n const a = r.match(/^rgb\\((\\d{1,3}),(\\d{1,3}),(\\d{1,3})\\)$/) || r.match(/^rgba\\((\\d{1,3}),(\\d{1,3}),(\\d{1,3}),(\\d{1,3})\\)$/);\n return a ? s.right(\n a.slice(1).reduce(\n (i, o) => i + parseInt(o, 10).toString(16).padStart(2, \"0\"),\n \"#\"\n ).padEnd(9, \"f\")\n ) : s.left(new Error(`Value \"${t}\" does not satisfy any of known RGB formats.`));\n}\nfunction j(t) {\n return C.pipe(\n B(t),\n s.map((r) => r.slice(0, 7))\n );\n}\nconst tt = l(j), rt = l(B);\nfunction q() {\n return p({\n id: _(),\n photo_url: n(e()),\n type: e(),\n title: e(),\n username: n(e())\n });\n}\nfunction w() {\n return p({\n added_to_attachment_menu: n(d()),\n allows_write_to_pm: n(d()),\n first_name: e(),\n id: _(),\n is_bot: n(d()),\n is_premium: n(d()),\n last_name: n(e()),\n language_code: n(e()),\n photo_url: n(e()),\n username: n(e())\n });\n}\nfunction x() {\n return p({\n projectCode: e(),\n uid: e(),\n sessionId: e(),\n rootToken: e()\n });\n}\nfunction M() {\n return p({\n auth_date: u(\n e(),\n f((t) => new Date(Number(t) * 1e3)),\n T()\n ),\n can_send_after: n(u(e(), f(Number), G())),\n chat: n(c(q())),\n chat_type: n(e()),\n chat_instance: n(e()),\n hash: n(e()),\n query_id: n(e()),\n receiver: n(c(w())),\n start_param: n(e()),\n signature: n(e()),\n user: n(c(w())),\n auth: n(c(x()))\n });\n}\nfunction L() {\n return P(M());\n}\nfunction R() {\n return I(\n e(),\n u(\n g([e(), _()]),\n f((t) => typeof t == \"number\" ? `#${(t & 16777215).toString(16).padStart(6, \"0\")}` : t),\n y(V)\n )\n );\n}\nfunction k() {\n const t = n(u(e(), f((r) => r === \"1\")));\n return p({\n vbWebAppBotInline: t,\n vbWebAppData: n(L()),\n vbWebAppDefaultColors: n(c(R())),\n vbWebAppFullscreen: t,\n vbWebAppPlatform: e(),\n vbWebAppShowSettings: t,\n vbWebAppStartParam: n(e()),\n vbWebAppThemeParams: c(R()),\n vbWebAppVersion: e()\n });\n}\nfunction Q() {\n return P(k());\n}\nfunction et(t) {\n try {\n return W(Q(), t);\n } catch {\n return !1;\n }\n}\nfunction nt() {\n return p({\n eventType: e(),\n eventData: n(F())\n });\n}\nfunction v(t) {\n return s.tryCatch(\n () => S(L(), t),\n (r) => r\n );\n}\nfunction H(t) {\n return s.tryCatch(\n () => S(Q(), t),\n (r) => r\n );\n}\nconst at = l(v), ot = l(H);\nfunction $(t, r) {\n return r || (r = (a, i) => JSON.stringify(i)), new URLSearchParams(\n Object.entries(t).reduce((a, [i, o]) => (Array.isArray(o) ? a.push(...o.map((m) => [i, String(m)])) : o != null && a.push([\n i,\n o instanceof Date ? (o.getTime() / 1e3 | 0).toString() : typeof o == \"string\" || typeof o == \"number\" ? String(o) : typeof o == \"boolean\" ? o ? \"1\" : \"0\" : r(i, o)\n ]), a), [])\n ).toString();\n}\nfunction K(t) {\n return $(t);\n}\nfunction it(t) {\n return $(t, (r, a) => r === \"vbWebAppData\" ? K(a) : JSON.stringify(a));\n}\nexport {\n M as initData,\n x as initDataAuth,\n q as initDataChat,\n L as initDataQuery,\n w as initDataUser,\n V as isAnyRGB,\n et as isLaunchParamsQuery,\n z as isRGB,\n E as isRGBA,\n U as isRGBAShort,\n O as isRGBShort,\n k as launchParams,\n Q as launchParamsQuery,\n nt as miniAppsMessage,\n at as parseInitDataQuery,\n v as parseInitDataQueryFp,\n ot as parseLaunchParamsQuery,\n H as parseLaunchParamsQueryFp,\n c as pipeJsonToSchema,\n P as pipeQueryToSchema,\n K as serializeInitDataQuery,\n it as serializeLaunchParamsQuery,\n R as themeParams,\n tt as toRGB,\n j as toRGBFp,\n rt as toRGBFull,\n B as toRGBFullFp\n};\n//# sourceMappingURL=index.js.map\n","export default function(n){return{all:n=n||new Map,on:function(t,e){var i=n.get(t);i?i.push(e):n.set(t,[e])},off:function(t,e){var i=n.get(t);i&&(e?i.splice(i.indexOf(e)>>>0,1):n.set(t,[]))},emit:function(t,e){var i=n.get(t);i&&i.slice().map(function(n){n(e)}),(i=n.get(\"*\"))&&i.slice().map(function(n){n(t,e)})}}}\n//# sourceMappingURL=mitt.mjs.map\n","import { is as L, looseObject as m, function as Y, nullish as v, boolean as j, number as U, string as E, optional as I, unknown as me, parse as B, any as we } from \"valibot\";\nimport { throwifyFpFn as A, getStorageValue as de, setStorageValue as X, createLogger as be, throwifyAnyEither as C, createCbCollector as Z, BetterTaskEither as ee } from \"@vbotma/toolkit\";\nimport { createLogger as yt, deepSnakeToCamelObjKeys as vt } from \"@vbotma/toolkit\";\nimport { BetterPromise as te, TimeoutError as he } from \"better-promises\";\nimport { CancelledError as Pt, TimeoutError as kt } from \"better-promises\";\nimport { function as l, either as c, option as F, taskEither as w, json as ge } from \"fp-ts\";\nimport { errorClassWithData as ye, errorClass as k } from \"error-kid\";\nimport { parseLaunchParamsQueryFp as re, themeParams as ve, pipeJsonToSchema as ne, miniAppsMessage as oe, serializeLaunchParamsQuery as Ee, parseLaunchParamsQuery as Pe } from \"@vbotma/transformers\";\nimport { signal as h, computed as ae } from \"@vbotma/signals\";\nimport ke from \"mitt\";\nfunction se(e) {\n return L(\n m({ VBotWebviewProxy: m({ postEvent: Y() }) }),\n e\n );\n}\nfunction ie() {\n try {\n return window.self !== window.top;\n } catch {\n return !0;\n }\n}\nclass xe extends (/* @__PURE__ */ k(\"MethodUnsupportedError\", (t, r) => [\n `Method \"${t}\" is unsupported in Mini Apps version ${r}`\n])) {\n}\nclass Se extends (/* @__PURE__ */ k(\"MethodParameterUnsupportedError\", (t, r, n) => [\n `Parameter \"${r}\" of \"${t}\" method is unsupported in Mini Apps version ${n}`\n])) {\n}\nclass Ae extends (/* @__PURE__ */ ye(\n \"LaunchParamsRetrieveError\",\n (t) => ({ errors: t }),\n (t) => [\n [\n \"Unable to retrieve launch parameters from any known source. Perhaps, you have opened your app outside Telegram?\",\n \"📖 Refer to docs for more information:\",\n \"https://docs.vbot-mini-apps.com/packages/tma-js-bridge/environment\",\n \"\",\n \"Collected errors:\",\n ...t.map(({ source: r, error: n }) => `Source: ${r} / ${n instanceof Error ? n.message : String(n)}`)\n ].join(`\n`)\n ]\n)) {\n}\nclass Ce extends (/* @__PURE__ */ k(\"InvalidLaunchParamsError\", (t, r) => [\n `Invalid value for launch params: ${t}`,\n { cause: r }\n])) {\n}\nclass pe extends (/* @__PURE__ */ k(\"UnknownEnvError\")) {\n}\nclass Me extends (/* @__PURE__ */ k(\n \"InvokeCustomMethodError\",\n (t) => [`Server returned error: ${t}`]\n)) {\n}\nconst $ = \"launchParams\";\nfunction z(e) {\n return e.replace(/^[^?#]*[?#]/, \"\").replace(/[?#]/g, \"&\");\n}\nfunction qe() {\n return l.pipe(\n M(),\n c.chainW(re)\n );\n}\nconst tt = A(qe);\nfunction Ve() {\n return l.pipe(\n M(),\n c.map((e) => {\n const t = new URLSearchParams(e).get(\"vbWebAppData\");\n return t ? F.some(t) : F.none;\n })\n );\n}\nfunction rt() {\n return l.pipe(\n Ve(),\n c.fold((e) => {\n throw e;\n }, (e) => e),\n F.match(() => {\n }, (e) => e)\n );\n}\nfunction M() {\n const e = [];\n for (const [t, r] of [\n // Try to retrieve launch parameters from the current location. This method\n // can return nothing in case, location was changed, and then the page was\n // reloaded.\n [() => z(window.location.href), \"window.location.href\"],\n // Then, try using the lower level API - window.performance.\n [() => {\n const n = performance.getEntriesByType(\"navigation\")[0];\n return n && z(n.name);\n }, \"performance navigation entries\"],\n // Finally, try using the session storage.\n [() => de($), \"local storage\"]\n ]) {\n const n = t();\n if (!n) {\n e.push({ source: r, error: new Error(\"Source is empty\") });\n continue;\n }\n const a = l.pipe(\n re(n),\n c.foldW((o) => o, () => !0)\n );\n if (typeof a != \"boolean\") {\n e.push({ source: r, error: a });\n continue;\n }\n return X($, n), c.right(n);\n }\n return c.left(new Ae(e));\n}\nconst nt = A(M);\nfunction We(e, t) {\n const r = /* @__PURE__ */ new Map(), n = ke(), a = (o, s, p = !1) => {\n const _ = r.get(o) || /* @__PURE__ */ new Map();\n r.set(o, _);\n const i = _.get(s) || [];\n _.set(s, i);\n const u = i.findIndex((f) => f[1] === p);\n if (u >= 0 && (n.off(o, i[u][0]), i.splice(u, 1), !i.length && (_.delete(s), !_.size))) {\n const f = r.size;\n r.delete(o), f && !r.size && t();\n }\n };\n return {\n on(o, s, p) {\n !r.size && e();\n const _ = () => {\n a(o, s, p);\n }, i = (...d) => {\n p && _(), o === \"*\" ? s({ name: d[0], payload: d[1] }) : s(...d);\n };\n n.on(o, i);\n const u = r.get(o) || /* @__PURE__ */ new Map();\n r.set(o, u);\n const f = u.get(s) || [];\n return u.set(s, f), f.push([i, p || !1]), _;\n },\n off: a,\n // eslint-disable-next-line @typescript-eslint/unbound-method\n emit: n.emit,\n clear() {\n const o = r.size;\n n.all.clear(), r.clear(), o && t();\n }\n };\n}\nfunction V(e, t) {\n window.dispatchEvent(new MessageEvent(\"message\", {\n data: JSON.stringify({ eventType: e, eventData: t }),\n // We specify this kind of source here in order to allow the package's \"on\" function to\n // capture it. The reason is this function always checks the event source and relies on\n // it to be the parent window.\n source: window.parent\n }));\n}\nconst S = h(!1), T = h(\"https://web.telegram.org\"), Be = (e) => {\n b().log(\"Event received:\", e);\n}, ce = ae(S);\nfunction ot(e) {\n e !== S() && (S.set(e), (e ? O : Le)(\"*\", Be));\n}\nconst _e = ae(T);\nfunction at(e) {\n T.set(e), b().log(\"New target origin set\", e);\n}\nconst P = h((...e) => {\n window.parent.postMessage(...e);\n}), b = h(be(\"Bridge\", {\n bgColor: \"#9147ff\",\n textColor: \"white\",\n shouldLog: ce\n}));\nfunction st() {\n Oe(), [P, T, _e, S, ce, b].forEach((e) => {\n e.unsubAll(), \"reset\" in e && e.reset();\n });\n}\nfunction W(e, t, r) {\n const n = [r], a = e[t];\n typeof a == \"function\" && n.push(a);\n const o = (...p) => {\n n.forEach((_) => _(...p));\n }, s = Object.assign((...p) => {\n o(...p);\n }, {\n // Unwraps the composer.\n unwrap() {\n const { length: p } = n;\n if (p === 1) {\n delete e[t];\n return;\n }\n if (p === 2) {\n D(e, t, n[1]);\n return;\n }\n n.unshift(1), D(e, t, o);\n }\n });\n ue(\n e,\n t,\n () => s,\n (p) => n.push(p)\n );\n}\nfunction G(e, t) {\n const r = e[t];\n ue(e, t, () => r, (n) => {\n Object.entries(n).forEach(([a, o]) => {\n r[a] = o;\n });\n });\n}\nfunction ue(e, t, r, n) {\n Object.defineProperty(e, t, {\n enumerable: !0,\n configurable: !0,\n get: r,\n set: n\n });\n}\nfunction D(e, t, r) {\n Object.defineProperty(e, t, {\n enumerable: !0,\n configurable: !0,\n writable: !0,\n value: r\n });\n}\nconst Fe = {\n clipboard_text_received: m({\n req_id: E(),\n data: v(E())\n }),\n custom_method_invoked: m({\n req_id: E(),\n result: I(me()),\n error: I(E())\n }),\n popup_closed: v(\n m({ button_id: v(E(), () => {\n }) }),\n {}\n ),\n viewport_changed: v(\n m({\n height: U(),\n width: v(U(), () => window.innerWidth),\n is_state_stable: j(),\n is_expanded: j()\n }),\n // TODO: At the moment, macOS has a bug with the invalid event payload - it is always equal to\n // null. Leaving this default value until the bug is fixed.\n () => ({\n height: window.innerHeight,\n is_state_stable: !0,\n is_expanded: !0\n })\n ),\n theme_changed: m({\n theme_params: ve()\n })\n};\nfunction J(e) {\n if (e.source !== window.parent)\n return;\n let t;\n try {\n t = B(ne(oe()), e.data);\n } catch {\n return;\n }\n const { eventType: r, eventData: n } = t, a = Fe[r];\n let o;\n try {\n o = a ? B(a, n) : n;\n } catch (s) {\n return b().forceError(\n [\n `An error occurred processing the \"${r}\" event from the VBot application.`,\n \"Please, file an issue here:\",\n \"https://github.com/Telegram-Mini-Apps/tma.js/issues/new/choose\"\n ].join(`\n`),\n t,\n s\n );\n }\n Te(r, o);\n}\nconst {\n on: O,\n off: Le,\n emit: Te,\n clear: Oe\n} = We(\n () => {\n const e = window;\n !e.TelegramGameProxy && (e.TelegramGameProxy = {}), W(e.TelegramGameProxy, \"receiveEvent\", V), G(e, \"TelegramGameProxy\"), !e.Telegram && (e.Telegram = {}), !e.VBot.WebView && (e.VBot.WebView = {}), W(e.VBot.WebView, \"receiveEvent\", V), G(e.Telegram, \"WebView\"), W(e, \"TelegramGameProxy_receiveEvent\", V), window.addEventListener(\"message\", J);\n },\n () => {\n [\n [\"TelegramGameProxy_receiveEvent\"],\n [\"TelegramGameProxy\", \"receiveEvent\"],\n [\"Telegram\", \"WebView\", \"receiveEvent\"]\n ].forEach((e) => {\n const t = window;\n let r = [void 0, t];\n for (const o of e)\n if (r = [r[1], r[1][o]], !r[1])\n return;\n const [n, a] = r;\n \"unwrap\" in a && (a.unwrap(), n && n !== t && !Object.keys(n).length && delete t[e[0]]);\n }), window.removeEventListener(\"message\", J);\n }\n), Re = (...e) => P()(...e);\nfunction je(e, t) {\n l.pipe(\n x(\n // @ts-expect-error It's ok, TS can't determine a specific override.\n e,\n t\n ),\n c.mapLeft((r) => {\n throw r;\n })\n );\n}\nfunction x(e, t) {\n b().log(\"Posting event:\", t ? { eventType: e, eventData: t } : { eventType: e });\n const r = window, n = JSON.stringify({ eventType: e, eventData: t });\n return ie() ? (Re(n, _e()), c.right(void 0)) : se(r) ? (r.VBotWebviewProxy.postEvent(e, JSON.stringify(t)), c.right(void 0)) : L(m({ external: m({ notify: Y() }) }), r) ? (r.external.notify(n), c.right(void 0)) : c.left(new pe());\n}\nfunction R(e, t, r = {}) {\n const {\n // If no capture function was passed, we capture the first compatible event.\n capture: n = () => !0,\n postEvent: a = x\n } = r, o = h(), [s, p] = Z();\n (Array.isArray(t) ? t : [t]).forEach((i) => {\n s(\n O(i, (u) => {\n const f = Array.isArray(t);\n n(f ? { event: i, payload: u } : u) && o.set([\n f ? { event: i, payload: u } : u\n ]);\n })\n );\n });\n const _ = (i) => (p(), i);\n return l.pipe(\n async () => a(e, r.params),\n w.chainW(() => ee((i, u, f) => {\n const d = o();\n if (d)\n return i(d[0]);\n const g = (y) => {\n y && i(y[0]);\n }, q = () => {\n o.unsub(g);\n };\n o.sub(g), f.on(\"finalized\", q);\n }, r)),\n w.mapBoth(_, _)\n );\n}\nfunction it(e, t, r) {\n const { postEvent: n } = r || {};\n return C(\n // @ts-expect-error TypeScript will not be able to handle our overrides here.\n R(e, t, {\n ...r,\n postEvent: n ? (...a) => {\n try {\n return n(...a), c.right(void 0);\n } catch (o) {\n return c.left(o);\n }\n } : x\n })\n );\n}\nfunction pt(e, t) {\n const r = Ue(\n // @ts-expect-error TS doesn't get what override we are going to use.\n e,\n t\n );\n return typeof r == \"function\" ? te.fn(() => C(r)) : r;\n}\nfunction Ue(e, t) {\n const r = se(window);\n if (!e)\n return r || l.pipe(M(), c.match(() => !1, () => !0));\n if (r)\n return w.right(!0);\n const { timeout: n = 100 } = t || {};\n return l.pipe(\n R(\"web_app_request_theme\", \"theme_changed\", { ...t, timeout: n }),\n w.match(\n (a) => he.is(a) || pe.is(a) ? c.right(!1) : c.left(a),\n () => c.right(!0)\n )\n );\n}\nfunction ct({ launchParams: e, onEvent: t, resetPostMessage: r } = {}) {\n if (e) {\n const o = typeof e == \"string\" || e instanceof URLSearchParams ? e.toString() : (\n // Here we have to trick serializeLaunchParamsQuery into thinking, it serializes a valid\n // value. We are doing it because we are working with vbWebAppData presented as a\n // string, not an object as serializeLaunchParamsQuery requires.\n Ee({ ...e, vbWebAppData: void 0 }) + (e.vbWebAppData ? `&vbWebAppData=${encodeURIComponent(e.vbWebAppData.toString())}` : \"\")\n );\n try {\n Pe(o);\n } catch (s) {\n throw new Ce(o, s);\n }\n X(\"launchParams\", o);\n }\n if (ie()) {\n if (!t)\n return;\n r && P.reset();\n const o = P();\n P.set((...s) => {\n const [p] = s, _ = () => {\n o(...s);\n };\n try {\n const i = B(ne(oe()), p);\n t({ name: i.eventType, params: i.eventData }, _);\n } catch {\n _();\n }\n });\n return;\n }\n const n = window.VBotWebviewProxy || {}, a = n.postEvent || (() => {\n });\n window.VBotWebviewProxy = {\n ...n,\n postEvent(o, s) {\n const p = () => {\n a(o, s);\n };\n t ? t({\n name: o,\n params: s ? JSON.parse(s) : void 0\n }, p) : p();\n }\n }, b().log(\"Environment was mocked by the mockVBotEnv function\");\n}\nfunction Ie(e) {\n return ({ req_id: t }) => t === e;\n}\nconst N = {\n \"6.0\": [\n \"iframe_ready\",\n \"iframe_will_reload\",\n \"web_app_close\",\n \"web_app_data_send\",\n \"web_app_expand\",\n \"web_app_open_link\",\n \"web_app_ready\",\n \"web_app_request_theme\",\n \"web_app_request_viewport\",\n \"web_app_setup_main_button\",\n \"web_app_setup_closing_behavior\"\n ],\n 6.1: [\n \"web_app_open_tg_link\",\n \"web_app_open_invoice\",\n \"web_app_setup_back_button\",\n \"web_app_set_background_color\",\n \"web_app_set_header_color\",\n \"web_app_trigger_haptic_feedback\"\n ],\n 6.2: [\"web_app_open_popup\"],\n 6.4: [\n \"web_app_close_scan_qr_popup\",\n \"web_app_open_scan_qr_popup\",\n \"web_app_read_text_from_clipboard\",\n { method: \"web_app_open_link\", param: \"try_instant_view\" }\n ],\n 6.7: [\"web_app_switch_inline_query\"],\n 6.9: [\n \"web_app_invoke_custom_method\",\n \"web_app_request_write_access\",\n \"web_app_request_phone\",\n { method: \"web_app_set_header_color\", param: \"color\" }\n ],\n \"6.10\": [\"web_app_setup_settings_button\"],\n 7.2: [\n \"web_app_biometry_get_info\",\n \"web_app_biometry_open_settings\",\n \"web_app_biometry_request_access\",\n \"web_app_biometry_request_auth\",\n \"web_app_biometry_update_token\"\n ],\n 7.6: [\n { method: \"web_app_open_link\", param: \"try_browser\" },\n { method: \"web_app_close\", param: \"return_back\" }\n ],\n 7.7: [\"web_app_setup_swipe_behavior\"],\n 7.8: [\"web_app_share_to_story\"],\n \"7.10\": [\n \"web_app_setup_secondary_button\",\n \"web_app_set_bottom_bar_color\",\n { method: \"web_app_setup_main_button\", param: \"has_shine_effect\" }\n ],\n \"8.0\": [\n \"web_app_request_safe_area\",\n \"web_app_request_content_safe_area\",\n \"web_app_request_fullscreen\",\n \"web_app_exit_fullscreen\",\n \"web_app_set_emoji_status\",\n \"web_app_add_to_home_screen\",\n \"web_app_check_home_screen\",\n \"web_app_request_emoji_status_access\",\n \"web_app_check_location\",\n \"web_app_open_location_settings\",\n \"web_app_request_file_download\",\n \"web_app_request_location\",\n \"web_app_send_prepared_message\",\n \"web_app_start_accelerometer\",\n \"web_app_start_device_orientation\",\n \"web_app_start_gyroscope\",\n \"web_app_stop_accelerometer\",\n \"web_app_stop_device_orientation\",\n \"web_app_stop_gyroscope\",\n \"web_app_toggle_orientation_lock\"\n ],\n \"9.0\": [\n \"web_app_device_storage_clear\",\n \"web_app_device_storage_get_key\",\n \"web_app_device_storage_save_key\",\n \"web_app_secure_storage_clear\",\n \"web_app_secure_storage_get_key\",\n \"web_app_secure_storage_restore_key\",\n \"web_app_secure_storage_save_key\"\n ],\n 9.1: [\"web_app_hide_keyboard\"],\n 9.2: [\n \"web_app_send_notification\",\n \"web_app_finish_refresh\"\n ]\n};\nfunction Q(e, t) {\n return Object.keys(N).find((n) => N[n].some((a) => t ? typeof a == \"object\" && a.method === e && a.param === t : a === e)) || null;\n}\nfunction H(e) {\n return e.split(\".\").map(Number);\n}\nfunction $e(e, t) {\n const r = H(e), n = H(t), a = Math.max(r.length, n.length);\n for (let o = 0; o < a; o += 1) {\n const s = r[o] || 0, p = n[o] || 0;\n if (s !== p)\n return s > p ? 1 : -1;\n }\n return 0;\n}\nfunction K(e, t, r) {\n const n = r ? Q(\n e,\n t\n ) : Q(e);\n return n ? $e(n, r || t) <= 0 : !1;\n}\nfunction _t(e, t = \"strict\") {\n const r = typeof t == \"function\" ? t : (n) => {\n const { method: a, version: o } = n, s = \"param\" in n ? new Se(a, n.param, o) : new xe(a, o);\n if (t === \"strict\")\n throw s;\n return b().forceWarn(s.message);\n };\n return ((n, a) => K(n, e) ? n === \"web_app_set_header_color\" && L(m({ color: we() }), a) && !K(n, \"color\", e) ? r({ version: e, method: n, param: \"color\" }) : je(n, a) : r({ version: e, method: n }));\n}\nfunction ze(e, t, r, n) {\n return l.pipe(\n R(\"web_app_invoke_custom_method\", \"custom_method_invoked\", {\n ...n || {},\n params: { method: e, params: t, req_id: r },\n capture: Ie(r)\n }),\n w.chain(({ result: a, error: o }) => o ? w.left(new Me(o)) : w.right(a))\n );\n}\nfunction ut(e, t, r, n) {\n return te.fn(() => l.pipe(\n // @ts-expect-error TypeScript is unable to determine required override.\n ze(e, t, r, n),\n w.match(\n (a) => {\n throw a;\n },\n (a) => a\n )\n )());\n}\nfunction Ge(e, t, r = {}) {\n const {\n // If no capture function was passed, we capture the first compatible event.\n capture: n = () => !0,\n postEvent: a = x\n } = r, o = h(), [s, p] = Z();\n (Array.isArray(t) ? t : [t]).forEach((i) => {\n s(\n O(i, (u) => {\n (Array.isArray(t) ? n({ event: i, payload: u }) : n(u)) && o.set([u]);\n })\n );\n });\n const _ = (i) => (p(), i);\n return l.pipe(\n async () => a(e, r.params),\n w.chainW(() => ee((i, u, f) => {\n const d = o();\n if (d)\n return i(d[0]);\n const g = (y) => {\n y && i(y[0]);\n }, q = () => {\n o.unsub(g);\n };\n o.sub(g), f.on(\"finalized\", q);\n }, r)),\n w.mapBoth(_, _)\n );\n}\nfunction ft(e, t, r) {\n const { postEvent: n } = r || {};\n return C(\n // @ts-expect-error TypeScript will not be able to handle our overrides here.\n Ge(e, t, {\n ...r,\n postEvent: n ? (...a) => {\n try {\n return n(...a), c.right(void 0);\n } catch (o) {\n return c.left(o);\n }\n } : x\n })\n );\n}\nfunction lt() {\n Object.hasOwn || (Object.hasOwn = function(e, t) {\n return Object.prototype.hasOwnProperty.call(e, t);\n });\n}\nfunction fe(e) {\n return c.tryCatch(() => decodeURIComponent(\n atob(\n e.replace(/-/g, \"+\").replace(/_/g, \"/\")\n ).split(\"\").map((t) => \"%\" + (\"00\" + t.charCodeAt(0).toString(16)).slice(-2)).join(\"\")\n ), (t) => t);\n}\nconst mt = A(fe);\nfunction le(e) {\n return btoa(\n encodeURIComponent(e).replace(/%([0-9A-F]{2})/g, (t, r) => String.fromCharCode(parseInt(`0x${r}`)))\n ).replace(/\\+/g, \"-\").replace(/\\//g, \"_\");\n}\nfunction De(e) {\n const t = le(typeof e == \"string\" ? e : JSON.stringify(e));\n return t.length > 512 ? c.left(new Error(\"Value is too long for start parameter\")) : c.right(t);\n}\nconst wt = A(De);\nfunction dt(e, t) {\n return C(\n Je(\n e,\n // @ts-expect-error TypeScript is unable to detect a correct override.\n typeof t == \"function\" ? (r) => c.tryCatch(() => t(r), (n) => n) : t\n )\n );\n}\nfunction Je(e, t) {\n return l.pipe(\n fe(e),\n c.chain((r) => t ? typeof t == \"function\" ? t(r) : ge.parse(r) : c.right(r))\n );\n}\nfunction bt(e) {\n return le(e).length <= 512;\n}\nexport {\n Pt as CancelledError,\n Ce as InvalidLaunchParamsError,\n Me as InvokeCustomMethodFailedError,\n Ae as LaunchParamsRetrieveError,\n Se as MethodParameterUnsupportedError,\n xe as MethodUnsupportedError,\n kt as TimeoutError,\n pe as UnknownEnvError,\n lt as applyPolyfills,\n Ie as captureSameReq,\n $e as compareVersions,\n yt as createLogger,\n _t as createPostEvent,\n wt as createStartParam,\n De as createStartParamFp,\n ce as debug,\n mt as decodeBase64Url,\n fe as decodeBase64UrlFp,\n dt as decodeStartParam,\n Je as decodeStartParamFp,\n vt as deepSnakeToCamelObjKeys,\n V as emitEvent,\n le as encodeBase64Url,\n Q as getReleaseVersion,\n se as hasWebviewProxy,\n ut as invokeCustomMethod,\n ze as invokeCustomMethodFp,\n ie as isIframe,\n bt as isSafeToCreateStartParam,\n pt as isVBMA,\n Ue as isVBMAFp,\n b as logger,\n ct as mockVBotEnv,\n Le as off,\n Oe as offAll,\n O as on,\n je as postEvent,\n x as postEventFp,\n Re as postMessage,\n P as postMessageImpl,\n ft as request,\n it as request2,\n R as request2Fp,\n Ge as requestFp,\n st as resetGlobals,\n tt as retrieveLaunchParams,\n qe as retrieveLaunchParamsFp,\n rt as retrieveRawInitData,\n Ve as retrieveRawInitDataFp,\n nt as retrieveRawLaunchParams,\n M as retrieveRawLaunchParamsFp,\n ot as setDebug,\n at as setTargetOrigin,\n K as supports,\n _e as targetOrigin\n};\n//# sourceMappingURL=index.js.map\n","import { type MethodName, supports } from '@vbotma/bridge';\nimport { type Computed, computed } from '@vbotma/signals';\nimport type { Version } from '@vbotma/types';\n\nimport { access } from '@/helpers/access.js';\nimport type { MaybeAccessor } from '@/types.js';\n\nexport function createIsSupportedSignal(\n method: MethodName,\n version: MaybeAccessor<Version>,\n): Computed<boolean> {\n return computed(() => supports(method, access(version)));\n}\n","import { throwifyFpFn, throwifyAnyEither, type AnyFn } from '@vbotma/toolkit';\nimport { function as fn, option as O } from 'fp-ts';\n\nimport type { WithChecksFp, WithChecks } from '@/with-checks/withChecksFp.js';\n\n// #__NO_SIDE_EFFECTS__\nexport function throwifyWithChecksFp<\n Fn extends AnyFn,\n HasSupportCheck extends boolean,\n SupportsMapKeySchema extends string,\n>(\n fn_: WithChecksFp<Fn, HasSupportCheck, SupportsMapKeySchema>,\n): WithChecks<Fn, HasSupportCheck, SupportsMapKeySchema> {\n return Object.assign(throwifyFpFn(fn_), {\n ifAvailable(...args: Parameters<Fn>) {\n return fn.pipe(\n fn_.ifAvailable(...args),\n O.match(\n () => ({ ok: false }),\n data => ({\n ok: true,\n data: throwifyAnyEither(data),\n }),\n ),\n );\n },\n }) as unknown as WithChecks<Fn, HasSupportCheck, SupportsMapKeySchema>;\n}\n","import { errorClass, errorClassWithData } from 'error-kid';\nimport type { BaseIssue } from 'valibot';\n\nfunction msgToTuple(message?: string): [string?] {\n return [message];\n}\n\nexport class ValidationError extends /* #__PURE__ */ errorClassWithData<\n { input: unknown; issues: BaseIssue<any>[] },\n [input: unknown, issues: BaseIssue<any>[]]\n>(\n 'ValidationError',\n (input, issues) => ({ input, issues }),\n 'Validation error',\n) {\n}\n\nexport class CSSVarsBoundError extends /* #__PURE__ */ errorClass(\n 'CSSVarsBoundError',\n 'CSS variables are already bound',\n) {\n}\n\nexport class DeviceStorageMethodError extends /* #__PURE__ */ errorClassWithData<\n { error: string },\n [error: string]\n>('DeviceStorageMethodError', error => ({ error }), error => [error]) {\n}\n\nexport class SecureStorageMethodError extends /* #__PURE__ */ errorClassWithData<\n { error: string },\n [error: string]\n>('SecureStorageMethodError', error => ({ error }), error => [error]) {\n}\n\nexport class NotAvailableError extends /* #__PURE__ */ errorClass<[message: string]>(\n 'NotAvailableError',\n msgToTuple,\n) {\n}\n\nexport class InvalidEnvError extends /* #__PURE__ */ errorClass<[message?: string]>(\n 'InvalidEnvError',\n msgToTuple,\n) {\n}\n\nexport class FunctionUnavailableError extends /* #__PURE__ */ errorClass<[message?: string]>(\n 'FunctionNotAvailableError',\n msgToTuple,\n) {\n}\n\nexport class InvalidArgumentsError extends /* #__PURE__ */ errorClass<[message: string, cause?: unknown]>(\n 'InvalidArgumentsError',\n (message, cause) => [message, { cause }],\n) {\n}\n\nexport class ConcurrentCallError extends /* #__PURE__ */ errorClass<[message: string]>(\n 'ConcurrentCallError',\n msgToTuple,\n) {\n}\n\nexport class SetEmojiStatusError extends /* #__PURE__ */ errorClass<[error: string]>(\n 'SetEmojiStatusError',\n error => [`Failed to set emoji status: ${error}`],\n) {\n}\n\nexport class AccessDeniedError extends /* #__PURE__ */ errorClass<[message: string]>(\n 'AccessDeniedError',\n msgToTuple,\n) {\n}\n\nexport class FullscreenFailedError extends /* #__PURE__ */ errorClass<[message: string]>(\n 'FullscreenFailedError',\n msgToTuple,\n) {\n}\n\nexport class ShareMessageError extends /* #__PURE__ */ errorClass<[error: string]>(\n 'ShareMessageError',\n msgToTuple,\n) {\n}\n\nexport class UnknownThemeParamsKeyError extends /* #__PURE__ */ errorClass<[key: string]>(\n 'UnknownThemeParamsKeyError',\n key => [`Unknown theme params key passed: ${key}`],\n) {\n}\n","import {\n type MethodName,\n supports,\n type MethodNameWithVersionedParams,\n type MethodVersionedParams,\n} from '@vbotma/bridge';\nimport { type Computed, computed } from '@vbotma/signals';\nimport type {\n If,\n IsNever,\n AnyFnAnyEither,\n RightOfReturn,\n LeftOfReturn,\n MaybeMonadReturnTypeToCommon,\n MaybeCommonReturnTypeToMonad,\n AnyFn,\n} from '@vbotma/toolkit';\nimport type { Version } from '@vbotma/types';\nimport { either as E, option as O, taskEither as TE } from 'fp-ts';\n\nimport { FunctionUnavailableError } from '@/errors.js';\nimport { access } from '@/helpers/access.js';\nimport type { MaybeAccessor } from '@/types.js';\n\ntype IfReturnsTask<Fn extends AnyFnAnyEither, A, B> =\n ReturnType<Fn> extends TE.TaskEither<any, any> ? A : B;\n\ntype OptionsBasedRequires<O extends WithChecksOptions<any>> = O extends { requires: any }\n ? true : false;\n\ntype OptionsBasedSupports<O extends WithChecksOptions<any>> = O extends { supports: any }\n ? Extract<keyof O['supports'], string> : never;\n\ntype OptionsBasedFn<Opts extends WithChecksOptions<any>> = (...args: any[]) => (\n Opts['returns'] extends 'plain'\n ? any\n : Opts['returns'] extends 'promise'\n ? PromiseLike<any>\n : Opts['returns'] extends 'task'\n ? TE.TaskEither<any, any>\n : E.Either<any, any>\n);\n\n/**\n * @returns Error text if something is wrong.\n */\nexport type CustomSupportFn = () => string | undefined;\n\nexport type Require =\n | MethodName\n | CustomSupportFn\n | { every: (MethodName | CustomSupportFn)[] }\n | { some: (MethodName | CustomSupportFn)[] };\n\n/**\n * A map where the key is a method name with versioned parameters, and the value is a tuple\n * containing the method and parameter names. The third tuple value is a function accepting\n * the wrapped function arguments and returning true if support check must be applied.\n */\nexport type SupportsMap<Args extends any[]> = {\n [OptionName: string]: {\n [M in MethodNameWithVersionedParams]: {\n /**\n * Method name.\n * @example 'web_app_set_header_color'\n */\n method: M;\n /**\n * Method version-dependent parameter.\n * @example `color`\n */\n param: MethodVersionedParams<M>;\n /**\n * @returns True if the support function should be called.\n * @param args - function arguments.\n */\n shouldCheck: (...args: Args) => boolean;\n };\n }[MethodNameWithVersionedParams];\n};\n\ntype WrappedFnReturnType<Fn extends AnyFn> = ReturnType<Fn> extends E.Either<any, any>\n ? E.Either<FunctionUnavailableError | LeftOfReturn<Fn>, RightOfReturn<Fn>>\n : ReturnType<Fn> extends TE.TaskEither<any, any>\n ? TE.TaskEither<FunctionUnavailableError | LeftOfReturn<Fn>, RightOfReturn<Fn>>\n : ReturnType<Fn> extends PromiseLike<infer U>\n ? TE.TaskEither<FunctionUnavailableError, U>\n : E.Either<FunctionUnavailableError, ReturnType<Fn>>;\n\nexport type WrappedFn<Fn extends AnyFn> = (...args: Parameters<Fn>) => WrappedFnReturnType<Fn>;\n\nexport type WithChecksFp<\n Fn extends AnyFn,\n HasSupportCheck extends boolean,\n SupportsMapKeySchema extends string = never,\n> =\n & WrappedFn<Fn>\n & {\n /**\n * A signal returning `true` if the function is available in the current environment and\n * conditions.\n *\n * To be more accurate, the method checks the following:\n * 1. The current environment is VBot Mini Apps.\n * 2. The SDK package is initialized (if this requirement is specified).\n * 3. If passed, the `isSupported` signal returned true.\n * 4. If passed, the `isMounted` signal returned true.\n *\n * *You should use this function when possible because it provides must-have code security\n * mechanisms and makes a developer sure that he is using the package properly.*\n *\n * @returns True if the function is available in the current environment.\n * @example\n * if (backButton.show.isAvailable()) {\n * backButton.show();\n * }\n */\n isAvailable: Computed<boolean>;\n /**\n * Calls the function only in case it is available.\n *\n * It uses the `isAvailable` internally to check if the function is available for call.\n * @example\n * backButton.show.ifAvailable();\n */\n ifAvailable(...args: Parameters<Fn>): O.Option<MaybeCommonReturnTypeToMonad<Fn>>;\n }\n & If<HasSupportCheck, {\n /**\n * The signal returning `true` if the function is supported by the VBot client,\n * including some possible additional conditions.\n *\n * It is highly recommended to use this signal only in certain narrow cases when only the\n * function support check is required, but not its availability.\n *\n * This signal is not applying additional operations like checking if the current environment\n * is Mini Apps and the SDK is initialized.\n *\n * To check if the function is available for use, use the `isAvailable` signal.\n *\n * @returns True if this function is supported.\n * @see isAvailable\n * @example\n * if (backButton.show.isSupported()) {\n * console.log('The method is supported');\n * }\n */\n isSupported: Computed<boolean>;\n }, {}>\n & If<IsNever<SupportsMapKeySchema>, {}, {\n /**\n * A map where the key is the function-specific option name and value is a signal indicating\n * if it is supported by the current environment.\n * @example\n * if (miniApp.setHeaderColor.isAvailable()) {\n * if (miniApp.setHeaderColor.supports('rgb')) {\n * miniApp.setHeaderColor('#ffaabb');\n * } else {\n * miniApp.setHeaderColor('bg_color');\n * }\n * }\n */\n supports: (key: SupportsMapKeySchema) => boolean;\n }>;\n\nexport type WithChecks<\n Fn extends AnyFn,\n HasSupportCheck extends boolean,\n SupportsMapKeySchema extends string = never,\n> =\n & ((...args: Parameters<Fn>) => MaybeMonadReturnTypeToCommon<Fn>)\n & Omit<WithChecksFp<Fn, HasSupportCheck, SupportsMapKeySchema>, 'ifAvailable'>\n & {\n /**\n * Calls the function only in case it is available.\n *\n * It uses the `isAvailable` internally to check if the function is available for call.\n * @example\n * backButton.show.ifAvailable();\n */\n ifAvailable(...args: Parameters<Fn>):\n | { ok: true; data: MaybeMonadReturnTypeToCommon<Fn> }\n | { ok: false };\n };\n\nexport interface WithChecksOptions<Fn extends AnyFn> {\n /**\n * Signal returning true if the owning component is mounted.\n */\n isMounted?: () => boolean;\n /**\n * Signal returning true if the owning component is mounting.\n */\n isMounting?: () => boolean;\n /**\n * A value determining the function requirements. This will enable additional checks for\n * the function before being called.\n */\n requires?: Require;\n /**\n * A signal to retrieve the current VBot Mini Apps version or the value itself.\n */\n isTma: MaybeAccessor<boolean>;\n /**\n * A map where the key is a method name with versioned parameters, and the value is a tuple\n * containing the method and parameter names. The third tuple value is a function accepting\n * the wrapped function arguments and returning true if support check must be applied.\n */\n supports?: SupportsMap<Parameters<Fn>>;\n /**\n * A signal to retrieve the current VBot Mini Apps version or the value itself.\n */\n version?: MaybeAccessor<Version>;\n /**\n * Allows to determine what exactly should be returned from the function - TaskEither or Either.\n * There is no other way to know it until the function itself is called, but we need to perform\n * some checks before calling it and return a valid value based on the function return type.\n */\n returns: Fn extends AnyFnAnyEither\n ? IfReturnsTask<Fn, 'task', 'either'>\n : ReturnType<Fn> extends PromiseLike<any> ? 'promise' : 'plain';\n}\n\nexport function withChecksFp<Fn extends AnyFn, O extends WithChecksOptions<Fn>>(\n fn: Fn,\n options: O,\n): WithChecksFp<Fn, OptionsBasedRequires<O>, OptionsBasedSupports<O>> {\n const version = computed(() => access(options.version) || '100');\n const isTma = computed(() => access(options.isTma));\n\n // Simplify the isSupported value to work with an array of validators or a single object.\n const { requires: optionsIsSupported, returns } = options;\n const isSupportedSimplified = optionsIsSupported\n ? typeof optionsIsSupported === 'object'\n ? optionsIsSupported\n : { every: [optionsIsSupported] }\n : undefined;\n\n /**\n * @param optionName - target option.\n * @returns True if specified option is supported.\n */\n const isOptionSupported = (optionName: string): boolean => {\n if (!options.supports) {\n return true;\n }\n const optionSettings = options.supports[optionName];\n return supports(optionSettings.method, optionSettings.param, version());\n };\n\n /**\n * @returns All found errors according to the isSupported variable value.\n */\n const calculateSupportError = (): string | undefined => {\n // isSupported was not specified. In this case, we assume that the function has no\n // dependencies and is always supported.\n if (!isSupportedSimplified) {\n return;\n }\n const [mode, requirements] = 'every' in isSupportedSimplified\n ? ['every', isSupportedSimplified.every] as const\n : ['some', isSupportedSimplified.some] as const;\n\n for (let i = 0; i < requirements.length; i++) {\n const requirement = requirements[i];\n const error = typeof requirement === 'function'\n ? requirement()\n : supports(requirement, version())\n ? undefined\n : `it is unsupported in Mini Apps version ${version()}`;\n // Return only if there was an error and all requirements must be satisfied, or\n // this was the last one requirement (when some of the requirements must be met).\n if (error && (mode === 'every' || i === requirements.length - 1)) {\n return error;\n }\n }\n };\n\n /**\n * @returns An error related to supports.<name> check.\n */\n const calculateOptionSupportError = (\n ...args: Parameters<Fn>\n ): string | undefined => {\n for (const k in options.supports) {\n if (options.supports[k].shouldCheck(...args) && !isOptionSupported(k)) {\n return `option ${k} is not supported in Mini Apps version ${version()}`;\n }\n }\n };\n\n const isSupported = computed(() => !calculateSupportError());\n const isInitialized = computed(() => version() !== '0.0');\n const isMounted = computed(() => (options.isMounted ? options.isMounted() : true));\n const isAvailable = computed(\n () => isTma()\n && isInitialized()\n && isSupported()\n && isMounted(),\n );\n\n const wrapError = (message: string): WrappedFnReturnType<Fn> => {\n const err = new FunctionUnavailableError(message);\n return (['task', 'promise'].includes(options.returns)\n ? TE.left(err)\n : E.left(err)) as WrappedFnReturnType<Fn>;\n };\n\n const call = (...args: Parameters<Fn>): MaybeCommonReturnTypeToMonad<Fn> => {\n if (returns === 'plain') {\n return E.tryCatch(() => fn(...args), e => e) as MaybeCommonReturnTypeToMonad<Fn>;\n }\n if (returns === 'promise') {\n return TE.tryCatch(() => fn(...args), e => e) as MaybeCommonReturnTypeToMonad<Fn>;\n }\n return fn(...args);\n };\n\n return Object.assign(\n (...args: Parameters<Fn>): WrappedFnReturnType<Fn> => {\n const errMessagePrefix = 'Unable to call function:';\n if (!isTma()) {\n return wrapError(`${errMessagePrefix} it can't be called outside Mini Apps`);\n }\n if (!isInitialized()) {\n return wrapError(`${errMessagePrefix} the SDK was not initialized. Use the SDK init() function`);\n }\n const supportErr = calculateSupportError();\n if (supportErr) {\n return wrapError(`${errMessagePrefix} ${supportErr}`);\n }\n const supportsOptionErr = calculateOptionSupportError(...args);\n if (supportsOptionErr) {\n return wrapError(`${errMessagePrefix} ${supportsOptionErr}`);\n }\n if (!isMounted()) {\n const message = options.isMounting?.()\n ? 'mounting. Wait for the mount completion'\n : 'unmounted. Use the mount() method';\n return wrapError(`${errMessagePrefix} the component is ${message}`);\n }\n return call(...args) as WrappedFnReturnType<Fn>;\n },\n fn,\n {\n isAvailable,\n ifAvailable(...args: Parameters<Fn>): O.Option<MaybeCommonReturnTypeToMonad<Fn>> {\n return isAvailable() ? O.some(call(...args)) : O.none;\n },\n },\n isSupportedSimplified ? { isSupported } : {},\n options.supports ? { supports: isOptionSupported } : {},\n );\n}\n\nexport function createWithChecksFp<O extends WithChecksOptions<any>>(options: O) {\n return <Fn extends OptionsBasedFn<O>>(fn: Fn): WithChecksFp<\n Fn,\n OptionsBasedRequires<O>,\n OptionsBasedSupports<O>\n > => withChecksFp(fn, options);\n}\n","import type { PostEventError, MethodName, MethodParams } from '@vbotma/bridge';\nimport { computed, type Computed } from '@vbotma/signals';\nimport { either as E, function as fn } from 'fp-ts';\n\nimport { Mountable } from '@/composables/Mountable.js';\nimport { Stateful } from '@/composables/Stateful.js';\nimport type { SharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\nimport type { WithPostEvent } from '@/fn-options/withPostEvent.js';\nimport type { WithStateRestore } from '@/fn-options/withStateRestore.js';\nimport type { WithVersion } from '@/fn-options/withVersion.js';\nimport { createIsSupportedSignal } from '@/helpers/createIsSupportedSignal.js';\nimport { removeUndefined } from '@/helpers/removeUndefined.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport {\n type WithChecksFp,\n type WithChecks,\n createWithChecksFp,\n} from '@/with-checks/withChecksFp.js';\n\ntype ButtonEither = E.Either<PostEventError, void>;\n\ntype BoolFields<S> = {\n [K in keyof S]-?: S[K] extends boolean ? K : never;\n}[keyof S];\n\nexport interface ButtonOptions<S, M extends MethodName>\n extends SharedFeatureOptions,\n WithStateRestore<S>,\n WithPostEvent,\n WithVersion {\n /**\n * The initial button state.\n */\n initialState: S;\n /**\n * Removes a component click listener.\n * @param listener - a listener to remove.\n * @param once - should the listener be called only once.\n */\n offClick: (listener: VoidFunction, once?: boolean) => void;\n /**\n * Adds a component click listener.\n * @returns A function to remove listener.\n * @param listener - a listener to add.\n * @param once - should the listener be called only once.\n */\n onClick: (listener: VoidFunction, once?: boolean) => VoidFunction;\n /**\n * A Mini Apps method to commit changes.\n */\n method: M;\n /**\n * A function to create method payload.\n * @param state\n */\n payload: (state: S) => MethodParams<M>;\n}\n\nexport class Button<S extends object, M extends MethodName> {\n constructor({\n isTma,\n storage,\n onClick,\n offClick,\n initialState,\n isPageReload,\n postEvent,\n payload,\n method,\n version,\n }: ButtonOptions<S, M>) {\n const stateful = new Stateful({\n initialState,\n onChange(state) {\n storage.set(state);\n },\n });\n const mountable = new Mountable<S>({\n initialState,\n isPageReload,\n onMounted: stateful.setState,\n restoreState: storage.get,\n });\n\n const wrapOptions = { version, requires: method, isTma };\n const wrapSupportedPlain = createWithChecksFp({\n ...wrapOptions,\n returns: 'plain',\n });\n const wrapMountedEither = createWithChecksFp({\n ...wrapOptions,\n returns: 'either',\n isMounted: mountable.isMounted,\n });\n\n this.isMounted = mountable.isMounted;\n this.isSupported = createIsSupportedSignal(method, version);\n this.state = stateful.state;\n\n this.setStateFp = wrapMountedEither(state => {\n const nextState = { ...this.state(), ...removeUndefined(state) };\n if (!stateful.hasDiff(nextState)) {\n return E.right(undefined);\n }\n return fn.pipe(\n postEvent(method as any, payload(nextState)),\n E.map(() => {\n stateful.setState(nextState);\n }),\n );\n });\n this.setState = throwifyWithChecksFp(this.setStateFp);\n this.onClickFp = wrapSupportedPlain(onClick);\n this.onClick = throwifyWithChecksFp(this.onClickFp);\n this.offClickFp = wrapSupportedPlain(offClick);\n this.offClick = throwifyWithChecksFp(this.offClickFp);\n this.mountFp = wrapSupportedPlain(() => {\n const nothing = () => undefined;\n return fn.pipe(mountable.mount(), E.match(nothing, nothing));\n });\n this.mount = throwifyWithChecksFp(this.mountFp);\n this.unmount = mountable.unmount;\n this.stateSetters = key => {\n const wrapped = wrapMountedEither(value => {\n return this.setStateFp({ [key]: value } as unknown as Partial<S>);\n });\n return [throwifyWithChecksFp(wrapped), wrapped];\n };\n this.stateBoolSetters = <K extends keyof S>(key: K) => {\n const [, setFp] = this.stateSetters(key);\n const setFalse = wrapMountedEither(() => setFp(false as S[K]));\n const setTrue = wrapMountedEither(() => setFp(true as S[K]));\n return [\n [throwifyWithChecksFp(setFalse), setFalse],\n [throwifyWithChecksFp(setTrue), setTrue],\n ];\n };\n }\n\n /**\n * Signal indicating if the component is currently mounted.\n */\n readonly isMounted: Computed<boolean>;\n\n /**\n * Signal indicating if the component is supported.\n */\n readonly isSupported: Computed<boolean>;\n\n /**\n * Complete button state.\n */\n readonly state: Computed<S>;\n\n /**\n * @returns A computed based on the specified state and its related key.\n * @param key - a key to use.\n */\n stateGetter<K extends keyof S>(key: K): Computed<S[K]> {\n return computed(() => this.state()[key]);\n }\n\n /**\n * @returns A setter with checks for the specified key.\n * @param key\n */\n readonly stateSetters: <K extends keyof S>(key: K) => [\n throwing: WithChecks<(value: S[K]) => void, true>,\n fp: WithChecksFp<(value: S[K]) => ButtonEither, true>,\n ];\n\n /**\n * @returns Setters with checks to set a specified boolean key.\n * @param key\n */\n readonly stateBoolSetters: <K extends BoolFields<S>>(key: K) => [\n setFalse: [\n throwing: WithChecks<() => void, true>,\n fp: WithChecksFp<() => ButtonEither, true>,\n ],\n setTrue: [\n throwing: WithChecks<() => void, true>,\n fp: WithChecksFp<() => ButtonEither, true>,\n ],\n ];\n\n /**\n * Updates the button state.\n */\n readonly setStateFp: WithChecksFp<(state: Partial<S>) => ButtonEither, true>;\n\n /**\n * @see setStateFp\n */\n readonly setState: WithChecks<(state: Partial<S>) => void, true>;\n\n /**\n * Adds a new button listener.\n * @param listener - event listener.\n * @param once - should the listener be called only once.\n * @returns A function to remove bound listener.\n * @example\n * const off = button.onClick(() => {\n * console.log('User clicked the button');\n * off();\n * });\n */\n readonly onClickFp: WithChecksFp<(listener: VoidFunction, once?: boolean) => VoidFunction, true>;\n\n /**\n * @see onClickFp\n */\n readonly onClick: WithChecks<(listener: VoidFunction, once?: boolean) => VoidFunction, true>;\n\n /**\n * Removes the button click listener.\n * @param listener - event listener.\n * @param once - should the listener be called only once.\n * @example\n * function listener() {\n * console.log('User clicked the button');\n * button.offClick(listener);\n * }\n * button.onClick(listener);\n */\n readonly offClickFp: WithChecksFp<\n (listener: VoidFunction, once?: boolean) => void,\n true\n >;\n\n /**\n * @see offClickFp\n */\n readonly offClick: WithChecks<(listener: VoidFunction, once?: boolean) => void, true>;\n\n /**\n * Mounts the component restoring its state.\n * @since Mini Apps v6.1\n */\n readonly mountFp: WithChecksFp<() => void, true>;\n\n /**\n * @see mountFp\n */\n readonly mount: WithChecks<() => void, true>;\n\n /**\n * Unmounts the component.\n *\n * Note that this function does not remove listeners added via the `onClick`\n * function, so you have to remove them on your own.\n * @see onClick\n */\n readonly unmount: () => void;\n}\n","import type { PostEventError } from '@vbotma/bridge';\nimport type { Computed } from '@vbotma/signals';\nimport { either as E } from 'fp-ts';\n\nimport { Button, type ButtonOptions } from '@/composables/Button.js';\nimport type { WithChecksFp, WithChecks } from '@/with-checks/withChecksFp.js';\n\nexport interface BackButtonState {\n isVisible: boolean;\n}\n\nexport type BackButtonOptions = Omit<\n ButtonOptions<BackButtonState, 'web_app_setup_back_button'>,\n 'method' | 'payload' | 'initialState'\n>;\n\n/**\n * @since Mini Apps v6.1\n */\nexport class BackButton {\n constructor(options: BackButtonOptions) {\n const button = new Button({\n ...options,\n method: 'web_app_setup_back_button',\n payload: state => ({ is_visible: state.isVisible }),\n initialState: { isVisible: false },\n });\n\n this.isVisible = button.stateGetter('isVisible');\n this.isMounted = button.isMounted;\n this.isSupported = button.isSupported;\n [[this.hide, this.hideFp], [this.show, this.showFp]] = button.stateBoolSetters('isVisible');\n this.onClick = button.onClick;\n this.onClickFp = button.onClickFp;\n this.offClick = button.offClick;\n this.offClickFp = button.offClickFp;\n this.mount = button.mount;\n this.mountFp = button.mountFp;\n this.unmount = button.unmount;\n }\n\n /**\n * Signal indicating if the component is currently visible.\n */\n readonly isVisible: Computed<boolean>;\n\n /**\n * Signal indicating if the component is currently mounted.\n */\n readonly isMounted: Computed<boolean>;\n\n /**\n * Signal indicating if the component is supported.\n */\n readonly isSupported: Computed<boolean>;\n\n /**\n * Hides the button.\n * @since Mini Apps v6.1\n */\n readonly hideFp: WithChecksFp<() => E.Either<PostEventError, void>, true>;\n\n /**\n * @see hideFp\n */\n readonly hide: WithChecks<() => void, true>;\n\n /**\n * Shows the button.\n * @since Mini Apps v6.1\n */\n readonly showFp: WithChecksFp<() => E.Either<PostEventError, void>, true>;\n\n /**\n * @see showFp\n */\n readonly show: WithChecks<() => void, true>;\n\n /**\n * Adds a new button listener.\n * @param listener - event listener.\n * @param once - should the listener be called only once.\n * @returns A function to remove bound listener.\n * @since Mini Apps v6.1\n * @example\n * const off = button.onClick(() => {\n * console.log('User clicked the button');\n * off();\n * });\n */\n readonly onClickFp: WithChecksFp<\n (listener: VoidFunction, once?: boolean) => VoidFunction,\n true\n >;\n\n /**\n * @see onClickFp\n */\n readonly onClick: WithChecks<(listener: VoidFunction, once?: boolean) => VoidFunction, true>;\n\n /**\n * Removes the button click listener.\n * @param listener - event listener.\n * @param once - should the listener be called only once.\n * @since Mini Apps v6.1\n * @example\n * function listener() {\n * console.log('User clicked the button');\n * button.offClick(listener);\n * }\n * button.onClick(listener);\n */\n readonly offClickFp: WithChecksFp<\n (listener: VoidFunction, once?: boolean) => void,\n true\n >;\n\n /**\n * @see offClickFp\n */\n readonly offClick: WithChecks<(listener: VoidFunction, once?: boolean) => void, true>;\n\n /**\n * Mounts the component restoring its state.\n * @since Mini Apps v6.1\n */\n readonly mountFp: WithChecksFp<() => void, true>;\n\n /**\n * @see mountFp\n */\n readonly mount: WithChecks<() => void, true>;\n\n /**\n * Unmounts the component.\n *\n * Note that this function does not remove listeners added via the `onClick`\n * function, so you have to remove them on your own.\n * @see onClick\n */\n readonly unmount: () => void;\n}\n","import { isVBMAFp } from '@vbotma/bridge';\nimport { computed } from '@vbotma/signals';\n\nimport type { MaybeAccessor } from '@/types.js';\n\nexport interface SharedFeatureOptions {\n /**\n * True if the current environment is VBot Mini Apps.\n */\n isTma: MaybeAccessor<boolean>;\n}\n\nexport function sharedFeatureOptions(): SharedFeatureOptions {\n return { isTma: computed(() => isVBMAFp()) };\n}\n","import { access } from '@/helpers/access.js';\nimport type { MaybeAccessor } from '@/types.js';\n\nexport function createFnOption<T>(mix: MaybeAccessor<T>) {\n return <O extends object>(obj: O) => {\n return { ...obj, ...access(mix) };\n };\n}\n","import {\n computed,\n type Computed,\n type Signal,\n signal,\n type SignalOptions,\n} from '@vbotma/signals';\n\nexport type SignalsTuple<T> = [Signal<T>, Computed<T>];\n\nconst signals: (Signal<any> | Computed<any>)[] = [];\n\n/**\n * Creates a new signal with the initial value.\n * @param initialValue - the initial value.\n * @param options - additional options.\n */\nexport function createSignal<T>(\n initialValue: T,\n options?: SignalOptions<T>,\n): Signal<T>;\n\n/**\n * Creates a new signal without the initial value.\n * @param initialValue - the initial value.\n * @param options - additional options.\n */\nexport function createSignal<T>(\n initialValue?: T,\n options?: SignalOptions<T | undefined>,\n): Signal<T | undefined>;\n\n// #__NO_SIDE_EFFECTS__\nexport function createSignal<T>(\n initialValue?: T,\n options?: SignalOptions<T | undefined>,\n): Signal<T | undefined> {\n const s = signal(initialValue, options);\n signals.push(s);\n return s;\n}\n\n/**\n * Creates a signal, which wil be automatically updated if some of its dependant signals were\n * modified.\n * @param fn - computation function.\n * @param options - additional functions.\n */\n// #__NO_SIDE_EFFECTS__\nexport function createComputed<T>(fn: (prev?: T) => T, options?: SignalOptions<T>): Computed<T> {\n const s = computed(fn, options);\n signals.push(s);\n return s;\n}\n\n/**\n * Resets all signals states.\n */\nexport function resetSignals() {\n signals.forEach(s => {\n s.unsubAll();\n 'reset' in s && s.reset();\n });\n}\n\n/**\n * @returns A tuple, containing a manual and computed signals. The computed signal is based on\n * the manual one.\n * @param initialValue - the initial value.\n * @param options - additional options.\n */\nexport function createSignalsTuple<T>(\n initialValue: T,\n options?: SignalOptions<T>,\n): SignalsTuple<T>;\n\n/**\n * @returns A tuple, containing a manual and computed signals. The computed signal is based on\n * the manual one.\n * @param initialValue - an initial value.\n * @param options - additional options.\n */\nexport function createSignalsTuple<T>(\n initialValue?: T,\n options?: SignalOptions<T | undefined>,\n): SignalsTuple<T | undefined>;\n\n// #__NO_SIDE_EFFECTS__\nexport function createSignalsTuple<T>(\n initialValue?: T,\n options?: SignalOptions<T | undefined>,\n): SignalsTuple<T | undefined> {\n const s = createSignal(initialValue, options);\n return [s, createComputed(s)];\n}\n","import { postEventFp as _postEventFp, type PostEventFpFn, type PostEventFn } from '@vbotma/bridge';\nimport { throwifyAnyEither } from '@vbotma/toolkit';\n\nimport { createSignal } from '@/globals/signals-registry.js';\n\nexport const postEventFpSignal = createSignal(_postEventFp);\n\nexport const postEventFp: PostEventFpFn = (...args: any[]) => {\n return (postEventFpSignal as any)()(...args);\n};\n\nexport const postEvent: PostEventFn = (...args: any[]) => {\n return throwifyAnyEither((postEventFp as any)(...args));\n};\n","import { type PostEventFpFn } from '@vbotma/bridge';\n\nimport { createFnOption } from '@/fn-options/createFnOption.js';\nimport { postEventFp } from '@/globals/postEvent.js';\n\nexport interface WithPostEvent {\n /**\n * A postEvent function to use to call Mini Apps methods.\n */\n postEvent: PostEventFpFn;\n}\n\nexport const withPostEvent = createFnOption<WithPostEvent>({\n postEvent: postEventFp,\n});\n","import { getStorageValue, setStorageValue } from '@vbotma/toolkit';\n\nexport interface ComponentStorage<T> {\n get: () => T | undefined;\n set: (value: T) => void;\n}\n\n/**\n * Creates a new sessionStorage-based component storage.\n * @param key - session storage key to use.\n */\nexport function createComponentSessionStorage<T>(key: string): ComponentStorage<T> {\n return {\n get: () => getStorageValue<T>(key),\n set(value) {\n setStorageValue<T>(key, value);\n },\n };\n}\n","/**\n * Returns the first navigation entry from window.performance.\n * @returns First navigation entry or null, in case performance functionality is not supported\n * or navigation entry was not found.\n */\nfunction getFirstNavigationEntry(): PerformanceNavigationTiming | undefined {\n return performance.getEntriesByType('navigation')[0] as PerformanceNavigationTiming | undefined;\n}\n\n/**\n * @returns True, if the current page was reloaded.\n * @see https://stackoverflow.com/a/36444134/11894710\n */\nexport function isPageReload(): boolean {\n const entry = getFirstNavigationEntry();\n return !!entry && entry.type === 'reload';\n}\n","import { createFnOption } from '@/fn-options/createFnOption.js';\nimport { type ComponentStorage, createComponentSessionStorage } from '@/helpers/component-storage.js';\nimport { isPageReload } from '@/helpers/navigation.js';\nimport type { MaybeAccessor } from '@/types.js';\n\nexport interface WithStateRestore<T> {\n /**\n * A storage the component could use to store its data.\n */\n storage: ComponentStorage<T>;\n /**\n * True if the current page is reloaded.\n */\n isPageReload: MaybeAccessor<boolean>;\n}\n\nexport function withStateRestore<S>(storageName: string) {\n return createFnOption<WithStateRestore<S>>({\n storage: createComponentSessionStorage<S>(storageName),\n isPageReload,\n });\n}\n","import type { Version } from '@vbotma/types';\n\nimport { createSignal } from '@/globals/signals-registry.js';\n\n/**\n * The current Mini Apps version.\n */\nexport const version = createSignal<Version>('0.0');\n","import type { Version } from '@vbotma/types';\n\nimport { createFnOption } from '@/fn-options/createFnOption.js';\nimport { version } from '@/globals/version.js';\nimport type { MaybeAccessor } from '@/types.js';\n\nexport interface WithVersion {\n /**\n * The currently supported VBot Mini Apps version by the VBot client.\n */\n version: MaybeAccessor<Version>;\n}\n\nexport const withVersion = createFnOption<WithVersion>({ version });\n","import { on, off, type EventName } from '@vbotma/bridge';\nimport { function as fn } from 'fp-ts';\n\nimport { sharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\nimport { withPostEvent } from '@/fn-options/withPostEvent.js';\nimport { withStateRestore } from '@/fn-options/withStateRestore.js';\nimport { withVersion } from '@/fn-options/withVersion.js';\n\n// @__NO_SIDE_EFFECTS__\nexport function buttonOptions<S>(storageName: string, trackedClickEvent: EventName) {\n return {\n ...fn.pipe(\n sharedFeatureOptions(),\n withPostEvent,\n withVersion,\n withStateRestore<S>(storageName),\n ),\n onClick(listener: VoidFunction, once?: boolean): VoidFunction {\n return on(trackedClickEvent, listener, once);\n },\n offClick(listener: VoidFunction, once?: boolean): void {\n off(trackedClickEvent, listener, once);\n },\n };\n}\n","import { BackButton } from '@/features/BackButton/BackButton.js';\nimport { buttonOptions } from '@/fn-options/buttonOptions.js';\n\nexport const backButton = /* @__PURE__*/ new BackButton(\n buttonOptions('backButton', 'back_button_pressed'),\n);\n","import { batch, computed, signal } from '@vbotma/signals';\nimport { taskEither as TE, function as fn } from 'fp-ts';\n\nimport { access } from '@/helpers/access.js';\nimport type { AsyncOptions, MaybeAccessor } from '@/types.js';\n\nexport interface AsyncMountableOptions<S, E> {\n /**\n * A function to retrieve the initial state.\n * @param options - additional options.\n */\n initialState: (options?: AsyncOptions) => TE.TaskEither<E, S>;\n /**\n * @returns True if the current page was reloaded.\n */\n isPageReload: MaybeAccessor<boolean>;\n /**\n * A function to call whenever the component was mounted.\n * @param state - restored state.\n */\n onMounted?: (state: S) => void;\n /**\n * A function to call whenever the component was unmounted.\n */\n onUnmounted?: VoidFunction;\n /**\n * Attempts to restore previously saved component state. This function\n * will only be called if the current page was reloaded.\n */\n restoreState: () => (S | undefined);\n}\n\nexport class AsyncMountable<S extends object, E> {\n constructor({\n initialState,\n onMounted,\n restoreState,\n onUnmounted,\n isPageReload,\n }: AsyncMountableOptions<S, E>) {\n this.mount = options => {\n if (this._isMounted()) {\n return TE.right(undefined);\n }\n const restored = access(isPageReload) ? restoreState() : undefined;\n return fn.pipe(\n restored ? TE.right(restored) : initialState(options),\n TE.map(state => {\n // The user could call mount several times in a row while the\n // component was still mounting. We should prevent calling the\n // same hooks several times in this case.\n if (!this._isMounted()) {\n batch(() => {\n this._isMounted.set(true);\n onMounted?.(state);\n });\n }\n }),\n );\n };\n\n this.unmount = () => {\n if (this._isMounted()) {\n batch(() => {\n this._isMounted.set(false);\n onUnmounted?.();\n });\n }\n };\n }\n\n private readonly _isMounted = signal(false);\n\n /**\n * Signal indicating if the component is mounted.\n */\n readonly isMounted = computed(this._isMounted);\n\n /**\n * Mounts the component restoring its state and calling required side effects.\n * @param options - additional execution options.\n */\n readonly mount: (options?: AsyncOptions) => TE.TaskEither<E, void>;\n\n /**\n * Unmounts the component.\n */\n readonly unmount: () => void;\n}\n","import type {\n RequestError,\n PostEventError,\n EventPayload,\n BiometryAuthRequestStatus,\n EventListener,\n BiometryTokenUpdateStatus,\n} from '@vbotma/bridge';\nimport type { Computed } from '@vbotma/signals';\nimport { BetterPromise } from 'better-promises';\nimport { either as E, taskEither as TE, function as fn } from 'fp-ts';\n\nimport { AsyncMountable } from '@/composables/AsyncMountable.js';\nimport { Stateful } from '@/composables/Stateful.js';\nimport { NotAvailableError } from '@/errors.js';\nimport type {\n BiometryAuthenticateOptions, BiometryOptions,\n BiometryRequestAccessOptions,\n BiometryState,\n BiometryUpdateTokenOptions,\n} from '@/features/Biometry/types.js';\nimport { createIsSupportedSignal } from '@/helpers/createIsSupportedSignal.js';\nimport type { AsyncOptions } from '@/types.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport { createWithChecksFp, WithChecks, WithChecksFp } from '@/with-checks/withChecksFp.js';\n\ntype BiometryTask<T> = TE.TaskEither<RequestError, T>;\n\ninterface AuthenticateResult {\n /**\n * Authentication status.\n */\n status: BiometryAuthRequestStatus;\n /**\n * Token from the local secure storage saved previously.\n */\n token?: string;\n}\n\nfunction createNotAvailableError() {\n return new NotAvailableError('Biometry is not available');\n}\n\nfunction eventToState(event: EventPayload<'biometry_info_received'>): BiometryState {\n let available = false;\n let tokenSaved = false;\n let deviceId = '';\n let accessRequested = false;\n let type = '';\n let accessGranted = false;\n if (event.available) {\n available = true;\n tokenSaved = event.token_saved;\n deviceId = event.device_id;\n accessRequested = event.access_requested;\n type = event.type;\n accessGranted = event.access_granted;\n }\n return { available, tokenSaved, deviceId, type, accessGranted, accessRequested };\n}\n\n/**\n * @since Mini Apps v7.2\n */\nexport class Biometry {\n constructor({\n version,\n request,\n postEvent,\n storage,\n onInfoReceived,\n offInfoReceived,\n isTma,\n isPageReload,\n }: BiometryOptions) {\n const listener: EventListener<'biometry_info_received'> = event => {\n stateful.setState(eventToState(event));\n };\n\n const stateful = new Stateful<BiometryState>({\n initialState: {\n available: false,\n type: 'unknown',\n accessGranted: false,\n accessRequested: false,\n deviceId: '',\n tokenSaved: false,\n },\n onChange: storage.set,\n });\n const mountable = new AsyncMountable({\n initialState(options) {\n return fn.pipe(\n request('web_app_biometry_get_info', 'biometry_info_received', options),\n TE.map(eventToState),\n );\n },\n isPageReload,\n onMounted(state) {\n stateful.setState(state);\n onInfoReceived(listener);\n },\n onUnmounted() {\n offInfoReceived(listener);\n },\n restoreState: storage.get,\n });\n\n const wrapOptions = { version, requires: 'web_app_biometry_request_auth', isTma } as const;\n const wrapSupportedEither = createWithChecksFp({\n ...wrapOptions,\n returns: 'either',\n });\n const wrapSupportedTask = createWithChecksFp({\n ...wrapOptions,\n returns: 'task',\n });\n const wrapMountedTask = createWithChecksFp({\n ...wrapOptions,\n isMounted: mountable.isMounted,\n returns: 'task',\n });\n\n this.isAvailable = stateful.getter('available');\n this.isMounted = mountable.isMounted;\n this.isSupported = createIsSupportedSignal('web_app_biometry_request_auth', version);\n this.state = stateful.state;\n this.unmount = mountable.unmount;\n this.mountFp = wrapSupportedTask(mountable.mount);\n\n this.authenticateFp = wrapMountedTask(options => {\n return !this.isAvailable()\n ? TE.left(createNotAvailableError())\n : fn.pipe(\n request('web_app_biometry_request_auth', 'biometry_auth_requested', {\n ...options,\n params: { reason: ((options || {}).reason || '').trim() },\n }),\n TE.map(response => {\n stateful.setState({ token: response.token });\n return response;\n }),\n );\n });\n\n this.openSettingsFp = wrapSupportedEither(() => postEvent('web_app_biometry_open_settings'));\n\n this.requestAccessFp = wrapMountedTask(options => {\n return fn.pipe(\n request('web_app_biometry_request_access', 'biometry_info_received', {\n ...options,\n params: { reason: ((options || {}).reason || '').trim() },\n }),\n TE.chain(response => {\n const state = eventToState(response);\n if (!state.available) {\n return TE.left(createNotAvailableError());\n }\n stateful.setState(state);\n return TE.right(state.accessRequested);\n }),\n );\n });\n\n this.updateTokenFp = wrapMountedTask((options = {}) => {\n return fn.pipe(\n request('web_app_biometry_update_token', 'biometry_token_updated', {\n ...options,\n params: { token: options.token || '', reason: options.reason?.trim() },\n }),\n TE.map(response => response.status),\n );\n });\n\n this.authenticate = throwifyWithChecksFp(this.authenticateFp);\n this.openSettings = throwifyWithChecksFp(this.openSettingsFp);\n this.requestAccess = throwifyWithChecksFp(this.requestAccessFp);\n this.updateToken = throwifyWithChecksFp(this.updateTokenFp);\n this.mount = throwifyWithChecksFp(this.mountFp);\n }\n\n /**\n * Signal indicating if biometry is available.\n */\n readonly isAvailable: Computed<boolean>;\n\n /**\n * Signal indicating if the component is supported.\n */\n readonly isSupported: Computed<boolean>;\n\n /**\n * Signal indicating if the component is mounted.\n */\n readonly isMounted: Computed<boolean>;\n\n /**\n * Complete component state.\n */\n readonly state: Computed<BiometryState>;\n\n /**\n * Attempts to authenticate a user using biometrics and fetch a previously stored secure token.\n * @param options - method options.\n * @since Mini Apps v7.2\n * @returns Token from the local secure storage saved previously or undefined.\n * @example\n * const { status, token } = await biometry.authenticate({\n * reason: 'Authenticate to open wallet',\n * });\n */\n readonly authenticateFp: WithChecksFp<(options?: BiometryAuthenticateOptions) => BiometryTask<{\n /**\n * Authentication status.\n */\n status: BiometryAuthRequestStatus;\n /**\n * Token from the local secure storage saved previously.\n */\n token?: string;\n }>, true>;\n\n /**\n * @see authenticateFp\n */\n readonly authenticate: WithChecks<\n (options?: BiometryAuthenticateOptions) => BetterPromise<AuthenticateResult>,\n true\n >;\n\n /**\n * Opens the biometric access settings for bots. Useful when you need to request biometrics\n * access to users who haven't granted it yet.\n *\n * _Note that this method can be called only in response to user interaction with the Mini App\n * interface (e.g. a click inside the Mini App or on the main button)_.\n * @since Mini Apps v7.2\n */\n readonly openSettingsFp: WithChecksFp<() => E.Either<PostEventError, void>, true>;\n\n /**\n * @see openSettingsFp\n */\n readonly openSettings: WithChecks<() => void, true>;\n\n /**\n * Requests permission to use biometrics.\n * @since Mini Apps v7.2\n * @returns Promise with true, if access was granted.\n * @example\n * const accessGranted = await biometry.requestAccess({\n * reason: 'Authenticate to open wallet',\n * });\n */\n readonly requestAccessFp: WithChecksFp<\n (options?: BiometryRequestAccessOptions) => BiometryTask<boolean>,\n true\n >;\n\n /**\n * @see requestAccessFp\n */\n readonly requestAccess: WithChecks<\n (options?: BiometryRequestAccessOptions) => BetterPromise<boolean>,\n true\n >;\n\n /**\n * Updates the biometric token in a secure storage on the device.\n * @since Mini Apps v7.2\n * @returns Promise with `true`, if token was updated.\n * @example Setting a new token\n * biometry.updateToken({\n * token: 'abcdef',\n * })\n * @example Deleting the token\n * biometry.updateToken();\n */\n readonly updateTokenFp: WithChecksFp<\n (options?: BiometryUpdateTokenOptions) => BiometryTask<BiometryTokenUpdateStatus>,\n true\n >;\n\n /**\n * @see updateTokenFp\n */\n readonly updateToken: WithChecks<\n (options?: BiometryUpdateTokenOptions) => BetterPromise<BiometryTokenUpdateStatus>,\n true\n >;\n\n /**\n * Mounts the component restoring its state.\n * @since Mini Apps v7.2\n */\n readonly mountFp: WithChecksFp<(options?: AsyncOptions) => BiometryTask<void>, true>;\n\n /**\n * @see mountFp\n */\n readonly mount: WithChecks<(options?: AsyncOptions) => BetterPromise<void>, true>;\n\n /**\n * Unmounts the component.\n */\n readonly unmount: () => void;\n}\n","import {\n requestFp as _requestFp,\n request2Fp as _request2Fp,\n type RequestFpFn,\n type RequestFn,\n type Request2FpFn,\n type Request2Fn,\n} from '@vbotma/bridge';\nimport { BetterPromise } from 'better-promises';\n\nimport { postEventFp } from '@/globals/postEvent.js';\n\n/**\n * @deprecated To be removed in the next major update. Use `request2fp` instead, it provides\n * a proper way of handling multiple events.\n */\nexport const requestFp: RequestFpFn = (method: any, events: any, options: any) => {\n return _requestFp(method, events, {\n postEvent: postEventFp,\n ...options,\n });\n};\n\nexport const request2Fp: Request2FpFn = (method: any, events: any, options: any) => {\n return _request2Fp(method, events, {\n postEvent: postEventFp,\n ...options,\n });\n};\n\n/**\n * @deprecated To be removed in the next major update. Use `request` instead, it provides\n * a proper way of handling multiple events.\n */\nexport const request: RequestFn = (...args: any[]) => {\n return BetterPromise.fn(() => (requestFp as any)(...args)());\n};\n\nexport const request2: Request2Fn = (...args: any[]) => {\n return BetterPromise.fn(() => (request2Fp as any)(...args)());\n};\n","import type { Request2FpFn } from '@vbotma/bridge';\n\nimport { createFnOption } from '@/fn-options/createFnOption.js';\nimport { request2Fp } from '@/globals/request.js';\n\nexport interface WithRequest {\n /**\n * A request function to use to call Mini Apps methods.\n */\n request: Request2FpFn;\n}\n\nexport const withRequest = createFnOption<WithRequest>({ request: request2Fp });\n","import { on, off } from '@vbotma/bridge';\nimport { function as fn } from 'fp-ts';\n\nimport { Biometry } from '@/features/Biometry/Biometry.js';\nimport type { BiometryState } from '@/features/Biometry/types.js';\nimport { sharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\nimport { withPostEvent } from '@/fn-options/withPostEvent.js';\nimport { withRequest } from '@/fn-options/withRequest.js';\nimport { withStateRestore } from '@/fn-options/withStateRestore.js';\nimport { withVersion } from '@/fn-options/withVersion.js';\n\nfunction instantiate() {\n return new Biometry({\n ...fn.pipe(\n sharedFeatureOptions(),\n withPostEvent,\n withVersion,\n withRequest,\n withStateRestore<BiometryState>('biometry'),\n ),\n offInfoReceived(listener) {\n off('biometry_info_received', listener);\n },\n onInfoReceived(listener) {\n return on('biometry_info_received', listener);\n },\n });\n}\n\nexport const biometry = /* @__PURE__*/ instantiate();\n","import type { PostEventError } from '@vbotma/bridge';\nimport type { Computed } from '@vbotma/signals';\nimport { either as E, function as fn } from 'fp-ts';\n\nimport { Mountable } from '@/composables/Mountable.js';\nimport { Stateful } from '@/composables/Stateful.js';\nimport type { SharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\nimport type { WithPostEvent } from '@/fn-options/withPostEvent.js';\nimport type { WithStateRestore } from '@/fn-options/withStateRestore.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport {\n createWithChecksFp,\n type WithChecks,\n type WithChecksFp,\n} from '@/with-checks/withChecksFp.js';\n\nexport interface ClosingBehaviorState {\n isConfirmationEnabled: boolean;\n}\n\nexport interface ClosingBehaviorOptions\n extends WithStateRestore<ClosingBehaviorState>,\n WithPostEvent,\n SharedFeatureOptions {\n}\n\nexport class ClosingBehavior {\n constructor({ postEvent, storage, isTma, isPageReload }: ClosingBehaviorOptions) {\n const stateful = new Stateful({\n initialState: { isConfirmationEnabled: false },\n onChange(state) {\n storage.set(state);\n },\n });\n const mountable = new Mountable({\n onMounted: stateful.setState,\n restoreState: storage.get,\n initialState: { isConfirmationEnabled: false },\n isPageReload,\n });\n\n const wrapOptions = { requires: 'web_app_setup_closing_behavior', isTma } as const;\n const wrapSupportedPlain = createWithChecksFp({\n ...wrapOptions,\n returns: 'plain',\n });\n const wrapMountedEither = createWithChecksFp({\n ...wrapOptions,\n returns: 'either',\n isMounted: mountable.isMounted,\n });\n\n const setClosingConfirmation = (isConfirmationEnabled: boolean) => {\n if (isConfirmationEnabled === this.isConfirmationEnabled()) {\n return E.right(undefined);\n }\n stateful.setState({ isConfirmationEnabled });\n return postEvent('web_app_setup_closing_behavior', {\n need_confirmation: isConfirmationEnabled,\n });\n };\n\n this.isConfirmationEnabled = stateful.getter('isConfirmationEnabled');\n this.isMounted = mountable.isMounted;\n\n this.disableConfirmationFp = wrapMountedEither(() => {\n return setClosingConfirmation(false);\n });\n this.enableConfirmationFp = wrapMountedEither(() => {\n return setClosingConfirmation(true);\n });\n this.mountFp = wrapSupportedPlain(() => {\n const nothing = () => undefined;\n return fn.pipe(mountable.mount(), E.match(nothing, nothing));\n });\n this.unmount = mountable.unmount;\n\n this.disableConfirmation = throwifyWithChecksFp(this.disableConfirmationFp);\n this.enableConfirmation = throwifyWithChecksFp(this.enableConfirmationFp);\n this.mount = throwifyWithChecksFp(this.mountFp);\n }\n\n /**\n * Signal indicating if closing confirmation dialog is currently enabled.\n */\n readonly isConfirmationEnabled: Computed<boolean>;\n\n /**\n * Signal indicating if the component is currently mounted.\n */\n readonly isMounted: Computed<boolean>;\n\n /**\n * Mounts the component restoring its state.\n */\n readonly mountFp: WithChecksFp<() => void, false>;\n\n /**\n * @see mountFp\n */\n readonly mount: WithChecks<() => void, false>;\n\n /**\n * Unmounts the component.\n */\n readonly unmount: () => void;\n\n /**\n * Disables the closing confirmation dialog.\n */\n readonly disableConfirmationFp: WithChecksFp<() => E.Either<PostEventError, void>, false>;\n\n /**\n * @see disableConfirmationFp\n */\n readonly disableConfirmation: WithChecks<() => void, false>;\n\n /**\n * Enables the closing confirmation dialog.\n */\n readonly enableConfirmationFp: WithChecksFp<() => E.Either<PostEventError, void>, false>;\n\n /**\n * @see enableConfirmationFp\n */\n readonly enableConfirmation: WithChecks<() => void, false>;\n}\n","import { function as fn } from 'fp-ts';\n\nimport {\n ClosingBehavior,\n type ClosingBehaviorState,\n} from '@/features/ClosingBehavior/ClosingBehavior.js';\nimport { sharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\nimport { withPostEvent } from '@/fn-options/withPostEvent.js';\nimport { withStateRestore } from '@/fn-options/withStateRestore.js';\n\nfunction instantiate() {\n return new ClosingBehavior(fn.pipe(\n sharedFeatureOptions(),\n withStateRestore<ClosingBehaviorState>('closingBehavior'),\n withPostEvent,\n ));\n}\n\nexport const closingBehavior = /* @__PURE__*/ instantiate();\n","import type { InvokeCustomMethodFpOptions, RequestError } from '@vbotma/bridge';\nimport type { Computed } from '@vbotma/signals';\nimport { BetterPromise } from 'better-promises';\nimport { taskEither as TE, function as fn } from 'fp-ts';\nimport { array, parse, record, string } from 'valibot';\n\nimport type { SharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\nimport type { WithInvokeCustomMethod } from '@/fn-options/withInvokeCustomMethod.js';\nimport type { WithVersion } from '@/fn-options/withVersion.js';\nimport { createIsSupportedSignal } from '@/helpers/createIsSupportedSignal.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport { createWithChecksFp, type WithChecks, type WithChecksFp } from '@/with-checks/withChecksFp.js';\n\ntype CloudStorageTask<T> = TE.TaskEither<RequestError, T>;\n\nexport interface CloudStorageOptions extends WithVersion,\n WithInvokeCustomMethod,\n SharedFeatureOptions {\n}\n\n/**\n * @since Mini Apps v6.9\n */\nexport class CloudStorage {\n constructor({ version, isTma, invokeCustomMethod }: CloudStorageOptions) {\n const wrapSupportedTask = createWithChecksFp({\n version,\n requires: 'web_app_invoke_custom_method',\n isTma,\n returns: 'task',\n });\n\n this.isSupported = createIsSupportedSignal('web_app_invoke_custom_method', version);\n this.deleteItemFp = wrapSupportedTask((keyOrKeys, options) => {\n const keys = Array.isArray(keyOrKeys) ? keyOrKeys : [keyOrKeys];\n return fn.pipe(\n keys.length\n ? invokeCustomMethod('deleteStorageValues', { keys }, options)\n : TE.right(undefined),\n TE.map(() => undefined),\n );\n });\n this.getItemFp = wrapSupportedTask((key, options) => {\n return fn.pipe(\n this.getItemsFp([key], options),\n TE.map(values => values[key] || ''),\n );\n });\n this.getItemsFp = wrapSupportedTask((keys, options) => {\n return fn.pipe(\n keys.length ? invokeCustomMethod('getStorageValues', { keys }, options) : TE.right({}),\n TE.map(data => {\n return {\n // Fulfill the response with probably missing keys.\n ...keys.reduce<Record<string, string>>((acc, key) => {\n acc[key] = '';\n return acc;\n }, {}),\n ...parse(record(string(), string()), data),\n };\n }),\n );\n });\n this.getKeysFp = wrapSupportedTask(options => {\n return fn.pipe(\n invokeCustomMethod('getStorageKeys', {}, options),\n TE.map(data => parse(array(string()), data)),\n );\n });\n this.setItemFp = wrapSupportedTask((key, value, options) => {\n return fn.pipe(\n invokeCustomMethod('saveStorageValue', { key, value }, options),\n TE.map(() => undefined),\n );\n });\n this.clearFp = wrapSupportedTask(options => {\n return fn.pipe(this.getKeysFp(options), TE.chain(this.deleteItemFp));\n });\n\n this.deleteItem = throwifyWithChecksFp(this.deleteItemFp);\n this.getItem = throwifyWithChecksFp(this.getItemFp);\n this.getItems = throwifyWithChecksFp(this.getItemsFp);\n this.getKeys = throwifyWithChecksFp(this.getKeysFp);\n this.setItem = throwifyWithChecksFp(this.setItemFp);\n this.clear = throwifyWithChecksFp(this.clearFp);\n }\n\n /**\n * Signal indicating if the component is supported.\n */\n readonly isSupported: Computed<boolean>;\n\n /**\n * Deletes specified key or keys from the cloud storage.\n * @param keyOrKeys - key or keys to delete.\n * @param options - request execution options.\n * @since Mini Apps v6.9\n */\n readonly deleteItemFp: WithChecksFp<\n (keyOrKeys: string | string[], options?: InvokeCustomMethodFpOptions) => CloudStorageTask<void>,\n true\n >;\n\n readonly deleteItem: WithChecks<\n (keyOrKeys: string | string[], options?: InvokeCustomMethodFpOptions) => BetterPromise<void>,\n true\n >;\n\n /**\n * Gets a single key value from the cloud storage.\n * @param key - a key to get.\n * @param options - request execution options.\n * @returns A key value as a string.\n * @since Mini Apps v6.9\n */\n readonly getItemFp: WithChecksFp<\n (key: string, options?: InvokeCustomMethodFpOptions) => CloudStorageTask<string>,\n true\n >;\n\n /**\n * @see getItemFp\n */\n readonly getItem: WithChecks<{\n <K extends string>(\n keys: K[],\n options?: InvokeCustomMethodFpOptions,\n ): BetterPromise<Record<K, string>>;\n (key: string, options?: InvokeCustomMethodFpOptions): BetterPromise<string>;\n }, true>;\n\n /**\n * Gets multiple keys' values from the cloud storage.\n * @param keys - keys list.\n * @param options - request execution options.\n * @returns A map, where a key is one of the specified in the `keys` argument,\n * and a value is a corresponding storage value if an array of keys was passed.\n * @since Mini Apps v6.9\n */\n readonly getItemsFp: WithChecksFp<\n <K extends string>(\n keys: K[],\n options?: InvokeCustomMethodFpOptions,\n ) => CloudStorageTask<Record<K, string>>,\n true\n >;\n\n /**\n * @see getItemsFp\n */\n readonly getItems: WithChecks<\n <K extends string>(\n keys: K[],\n options?: InvokeCustomMethodFpOptions,\n ) => BetterPromise<Record<K, string>>,\n true\n >;\n\n /**\n * Returns a list of all keys presented in the cloud storage.\n * @param options - request execution options.\n * @since Mini Apps v6.9\n */\n readonly getKeysFp: WithChecksFp<\n (options?: InvokeCustomMethodFpOptions) => CloudStorageTask<string[]>,\n true\n >;\n\n /**\n * @see getKeysFp\n */\n readonly getKeys: WithChecks<\n (options?: InvokeCustomMethodFpOptions) => BetterPromise<string[]>,\n true\n >;\n\n /**\n * Saves the specified value by a key.\n * @param key - storage key.\n * @param value - storage value.\n * @param options - request execution options.\n * @since Mini Apps v6.9\n */\n readonly setItemFp: WithChecksFp<\n (key: string, value: string, options?: InvokeCustomMethodFpOptions) => CloudStorageTask<void>,\n true\n >;\n\n /**\n * @see setItemFp\n */\n readonly setItem: WithChecks<\n (key: string, value: string, options?: InvokeCustomMethodFpOptions) => BetterPromise<void>,\n true\n >;\n\n /**\n * Clears the cloud storage.\n * @param options - additional options.\n * @since Mini Apps v6.9\n */\n readonly clearFp: WithChecksFp<\n (options?: InvokeCustomMethodFpOptions) => CloudStorageTask<void>,\n true\n >;\n\n /**\n * @see clearFp\n */\n readonly clear: WithChecks<(options?: InvokeCustomMethodFpOptions) => BetterPromise<void>, true>;\n}\n","import { createSignal } from '@/globals/signals-registry.js';\n\nconst lastRequestId = createSignal(0);\n\n/**\n * @returns A new request identifier.\n */\nexport function createRequestId(): string {\n lastRequestId.set(lastRequestId() + 1);\n return lastRequestId().toString();\n}\n","import {\n type RequestError,\n type CustomMethodName,\n type CustomMethodParams,\n type InvokeCustomMethodOptions,\n invokeCustomMethodFp,\n} from '@vbotma/bridge';\nimport { taskEither as TE } from 'fp-ts';\n\nimport { createRequestId } from '@/globals/createRequestId.js';\nimport { postEventFp } from '@/globals/postEvent.js';\n\n/**\n * Invokes known custom method. Returns method execution result.\n * @param method - method name.\n * @param params - method parameters.\n * @param options - additional options.\n */\nexport function invokeCustomMethod<M extends CustomMethodName>(\n method: M,\n params: CustomMethodParams<M>,\n options?: InvokeCustomMethodOptions,\n): TE.TaskEither<RequestError, unknown>;\n\n/**\n * Invokes unknown custom method. Returns method execution result.\n * @param method - method name.\n * @param params - method parameters.\n * @param options - additional options.\n */\nexport function invokeCustomMethod(\n method: string,\n params: object,\n options?: InvokeCustomMethodOptions,\n): TE.TaskEither<RequestError, unknown>;\n\nexport function invokeCustomMethod(\n method: string,\n params: object,\n options?: InvokeCustomMethodOptions,\n): TE.TaskEither<RequestError, unknown> {\n return invokeCustomMethodFp(method, params, createRequestId(), {\n ...options || {},\n postEvent: postEventFp,\n });\n}\n","import type {\n CustomMethodParams,\n CustomMethodName,\n InvokeCustomMethodError,\n InvokeCustomMethodFpOptions,\n RequestError,\n} from '@vbotma/bridge';\nimport type * as TE from 'fp-ts/TaskEither';\n\nimport { createFnOption } from '@/fn-options/createFnOption.js';\nimport { invokeCustomMethod } from '@/globals/invokeCustomMethod.js';\n\nexport type { InvokeCustomMethodError };\n\nexport interface InvokeCustomMethodNoRequestIdFn {\n <M extends CustomMethodName>(\n this: void,\n method: M,\n params: CustomMethodParams<M>,\n options?: InvokeCustomMethodFpOptions,\n ): TE.TaskEither<InvokeCustomMethodError, unknown>;\n\n (\n this: void,\n method: string,\n params: object,\n options?: InvokeCustomMethodFpOptions,\n ): TE.TaskEither<RequestError, unknown>;\n}\n\nexport interface WithInvokeCustomMethod {\n invokeCustomMethod: InvokeCustomMethodNoRequestIdFn;\n}\n\nexport const withInvokeCustomMethod = createFnOption<WithInvokeCustomMethod>({\n invokeCustomMethod,\n});\n","import { function as fn } from 'fp-ts';\n\nimport { CloudStorage } from '@/features/CloudStorage/CloudStorage.js';\nimport { sharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\nimport { withInvokeCustomMethod } from '@/fn-options/withInvokeCustomMethod.js';\nimport { withVersion } from '@/fn-options/withVersion.js';\n\nfunction instantiate() {\n return new CloudStorage(fn.pipe(\n sharedFeatureOptions(),\n withVersion,\n withInvokeCustomMethod,\n ));\n}\n\nexport const cloudStorage = /* @__PURE__*/ instantiate();\n","import { EventPayload, type MethodParams, type Request2CaptureFn, RequestError } from '@vbotma/bridge';\nimport { taskEither as TE, function as fn } from 'fp-ts';\n\nimport { DeviceStorageMethodError } from '@/errors.js';\nimport type { SharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\nimport type { WithCreateRequestId } from '@/fn-options/withCreateRequestId.js';\nimport type { WithRequest } from '@/fn-options/withRequest.js';\nimport type { WithVersion } from '@/fn-options/withVersion.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport {\n createWithChecksFp,\n type WithChecks,\n type WithChecksFp,\n} from '@/with-checks/withChecksFp.js';\n\nexport type DeviceStorageError = RequestError | DeviceStorageMethodError;\n\nexport interface DeviceStorageOptions extends SharedFeatureOptions,\n WithVersion,\n WithRequest,\n WithCreateRequestId {\n}\n\n/**\n * @since Mini Apps v9.0\n */\nexport class DeviceStorage {\n constructor({ isTma, request, version, createRequestId }: DeviceStorageOptions) {\n const wrapSupportedTask = createWithChecksFp({\n version,\n requires: 'web_app_device_storage_get_key',\n isTma,\n returns: 'task',\n });\n\n const invokeMethod = <\n M extends (\n | 'web_app_device_storage_save_key'\n | 'web_app_device_storage_get_key'\n | 'web_app_device_storage_save_key'\n | 'web_app_device_storage_clear'\n ),\n E extends (\n | 'device_storage_key_saved'\n | 'device_storage_key_received'\n | 'device_storage_cleared'\n ),\n >(\n method: M,\n event: E,\n params: Omit<MethodParams<M>, 'req_id'>,\n ): TE.TaskEither<DeviceStorageError, EventPayload<E>> => {\n const requestId = createRequestId();\n return fn.pipe(\n request<M, ('device_storage_failed' | E)[]>(method, ['device_storage_failed', event], {\n params: { ...params, req_id: requestId },\n capture: (event => {\n return 'payload' in event ? event.payload.req_id === requestId : true;\n }) as Request2CaptureFn<('device_storage_failed' | E)[]>,\n }),\n TE.chain(response => (\n response.event === 'device_storage_failed'\n ? TE.left(new DeviceStorageMethodError(response.payload.error || 'UNKNOWN_ERROR'))\n : TE.right(response.payload as EventPayload<E>)\n )),\n );\n };\n\n this.getItemFp = wrapSupportedTask(key => {\n return fn.pipe(\n invokeMethod('web_app_device_storage_get_key', 'device_storage_key_received', { key }),\n TE.map(payload => payload.value),\n );\n });\n this.setItemFp = wrapSupportedTask((key, value) => {\n return fn.pipe(\n invokeMethod('web_app_device_storage_save_key', 'device_storage_key_saved', { key, value }),\n TE.map(() => undefined),\n );\n });\n this.deleteItemFp = wrapSupportedTask(key => {\n return this.setItemFp(key, null);\n });\n this.clearFp = wrapSupportedTask(() => {\n return fn.pipe(\n invokeMethod('web_app_device_storage_clear', 'device_storage_cleared', {}),\n TE.map(() => undefined),\n );\n });\n\n this.getItem = throwifyWithChecksFp(this.getItemFp);\n this.setItem = throwifyWithChecksFp(this.setItemFp);\n this.deleteItem = throwifyWithChecksFp(this.deleteItemFp);\n this.clear = throwifyWithChecksFp(this.clearFp);\n }\n\n /**\n * Retrieves an item using its key.\n * @since Mini Apps v9.0\n */\n readonly getItemFp: WithChecksFp<\n (key: string) => TE.TaskEither<DeviceStorageError, string | null>,\n true\n >;\n\n /**\n * @see getItemFp\n */\n readonly getItem: WithChecks<(key: string) => Promise<string | null>, true>;\n\n /**\n * Sets a new item in the storage.\n * @since Mini Apps v9.0\n */\n readonly setItemFp: WithChecksFp<\n (key: string, value: string | null) => TE.TaskEither<DeviceStorageError, void>,\n true\n >;\n\n /**\n * @see setItemFp\n */\n readonly setItem: WithChecks<(key: string, value: string | null) => Promise<void>, true>;\n\n /**\n * Removes a key from the storage.\n * @since Mini Apps v9.0\n */\n readonly deleteItemFp: WithChecksFp<\n (key: string) => TE.TaskEither<DeviceStorageError, void>,\n true\n >;\n\n /**\n * @see deleteItemFp\n */\n readonly deleteItem: WithChecks<(key: string) => Promise<void>, true>;\n\n /**\n * Removes all keys from the storage.\n * @since Mini Apps v9.0\n */\n readonly clearFp: WithChecksFp<() => TE.TaskEither<DeviceStorageError, void>, true>;\n\n /**\n * @see clearFp\n */\n readonly clear: WithChecks<() => Promise<void>, true>;\n}\n","import { createFnOption } from '@/fn-options/createFnOption.js';\nimport { createRequestId } from '@/globals/createRequestId.js';\n\nexport interface WithCreateRequestId {\n /**\n * A function generating a request identifier.\n */\n createRequestId: () => string;\n}\n\nexport const withCreateRequestId = createFnOption<WithCreateRequestId>({ createRequestId });\n","import { function as fn } from 'fp-ts';\n\nimport { sharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\nimport { withCreateRequestId } from '@/fn-options/withCreateRequestId.js';\nimport { withRequest } from '@/fn-options/withRequest.js';\nimport { withVersion } from '@/fn-options/withVersion.js';\n\nimport { DeviceStorage } from './DeviceStorage.js';\n\nfunction instantiate() {\n return new DeviceStorage(fn.pipe(\n sharedFeatureOptions(),\n withVersion,\n withRequest,\n withCreateRequestId,\n ));\n}\n\nexport const deviceStorage = /* @__PURE__*/ instantiate();\n","import type { EmojiStatusAccessRequestedStatus, RequestError } from '@vbotma/bridge';\nimport { taskEither as TE, function as fn } from 'fp-ts';\n\nimport {\n sharedFeatureOptions,\n type SharedFeatureOptions,\n} from '@/fn-options/sharedFeatureOptions.js';\nimport { withRequest, type WithRequest } from '@/fn-options/withRequest.js';\nimport { withVersion, type WithVersion } from '@/fn-options/withVersion.js';\nimport type { AsyncOptions } from '@/types.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport { withChecksFp } from '@/with-checks/withChecksFp.js';\n\ninterface CreateOptions extends SharedFeatureOptions, WithVersion, WithRequest {\n}\n\nfunction create({ request, ...rest }: CreateOptions) {\n return withChecksFp((\n options: AsyncOptions,\n ): TE.TaskEither<RequestError, EmojiStatusAccessRequestedStatus> => {\n return fn.pipe(\n request('web_app_request_emoji_status_access', 'emoji_status_access_requested', options),\n TE.map(response => response.status),\n );\n }, { ...rest, requires: 'web_app_request_emoji_status_access', returns: 'task' });\n}\n\n// #__NO_SIDE_EFFECTS__\nfunction instantiate() {\n return create(fn.pipe(\n sharedFeatureOptions(),\n withVersion,\n withRequest,\n ));\n}\n\n/**\n * Shows a native popup requesting permission for the bot to manage user's emoji status.\n * @param options - additional options.\n * @returns Emoji status access status.\n * @since Mini Apps v8.0\n * @example\n * const status = await requestEmojiStatusAccess();\n */\nexport const requestEmojiStatusAccessFp = instantiate();\n\n/**\n * @see requestEmojiStatusAccessFp\n */\nexport const requestEmojiStatusAccess = throwifyWithChecksFp(requestEmojiStatusAccessFp);\n","import { RequestError } from '@vbotma/bridge';\nimport { taskEither as TE, function as fn } from 'fp-ts';\n\nimport { SetEmojiStatusError } from '@/errors.js';\nimport {\n type SharedFeatureOptions,\n sharedFeatureOptions,\n} from '@/fn-options/sharedFeatureOptions.js';\nimport { withRequest, type WithRequest } from '@/fn-options/withRequest.js';\nimport { withVersion, type WithVersion } from '@/fn-options/withVersion.js';\nimport type { AsyncOptions } from '@/types.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport { withChecksFp } from '@/with-checks/withChecksFp.js';\n\nexport interface SetEmojiStatusOptions extends AsyncOptions {\n duration?: number;\n}\n\ninterface CreateOptions extends SharedFeatureOptions, WithRequest, WithVersion {\n}\n\nfunction create({ request, ...rest }: CreateOptions) {\n return withChecksFp((\n customEmojiId: string,\n options?: SetEmojiStatusOptions,\n ): TE.TaskEither<RequestError | SetEmojiStatusError, void> => {\n return fn.pipe(\n request('web_app_set_emoji_status', ['emoji_status_set', 'emoji_status_failed'], {\n params: {\n custom_emoji_id: customEmojiId,\n duration: (options || {}).duration,\n },\n ...options,\n }),\n TE.chainW(response => (\n response.event === 'emoji_status_failed'\n ? TE.left(new SetEmojiStatusError(response.payload.error))\n : TE.right(undefined)\n )),\n );\n }, {\n ...rest,\n requires: 'web_app_set_emoji_status',\n returns: 'task',\n });\n}\n\n// #__NO_SIDE_EFFECTS__\nfunction instantiate() {\n return create(fn.pipe(\n sharedFeatureOptions(),\n withRequest,\n withVersion,\n ));\n}\n\n/**\n * Opens a dialog allowing the user to set the specified custom emoji as their status.\n * @returns Nothing if status set was successful.\n * @param options - additional options.\n * @since Mini Apps v8.0\n * @example\n * fn.pipe(\n * setEmojiStatusFp('5361800828313167608'),\n * TE.match(error => {\n * console.error('Error occurred', error);\n * }, () => {\n * console.log('Status set');\n * }),\n * );\n * const statusSet = await setEmojiStatus('5361800828313167608');\n */\nexport const setEmojiStatusFp = instantiate();\n\n/**\n * @see setEmojiStatusFp\n */\nexport const setEmojiStatus = throwifyWithChecksFp(setEmojiStatusFp);\n","import type {\n ImpactHapticFeedbackStyle,\n NotificationHapticFeedbackType,\n PostEventError,\n} from '@vbotma/bridge';\nimport type { Computed } from '@vbotma/signals';\nimport { either as E } from 'fp-ts';\n\nimport type { SharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\nimport type { WithPostEvent } from '@/fn-options/withPostEvent.js';\nimport type { WithVersion } from '@/fn-options/withVersion.js';\nimport { createIsSupportedSignal } from '@/helpers/createIsSupportedSignal.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport { createWithChecksFp, type WithChecksFp, type WithChecks } from '@/with-checks/withChecksFp.js';\n\ntype HapticFeedbackEither = E.Either<PostEventError, void>;\n\nexport interface HapticFeedbackOptions extends WithVersion, WithPostEvent, SharedFeatureOptions {\n}\n\n/**\n * @since Mini Apps v6.1\n */\nexport class HapticFeedback {\n constructor({ postEvent, isTma, version }: HapticFeedbackOptions) {\n const HAPTIC_METHOD_NAME = 'web_app_trigger_haptic_feedback';\n const wrapSupported = createWithChecksFp({\n requires: HAPTIC_METHOD_NAME,\n isTma,\n version,\n returns: 'plain',\n });\n\n this.isSupported = createIsSupportedSignal(HAPTIC_METHOD_NAME, version);\n this.impactOccurredFp = wrapSupported(style => {\n return postEvent(HAPTIC_METHOD_NAME, { type: 'impact', impact_style: style });\n });\n this.notificationOccurredFp = wrapSupported(type => {\n return postEvent(HAPTIC_METHOD_NAME, { type: 'notification', notification_type: type });\n });\n this.selectionChangedFp = wrapSupported(() => {\n return postEvent(HAPTIC_METHOD_NAME, { type: 'selection_change' });\n });\n\n this.impactOccurred = throwifyWithChecksFp(this.impactOccurredFp);\n this.notificationOccurred = throwifyWithChecksFp(this.notificationOccurredFp);\n this.selectionChanged = throwifyWithChecksFp(this.selectionChangedFp);\n }\n\n /**\n * Signal indicating if the component is supported.\n */\n readonly isSupported: Computed<boolean>;\n\n /**\n * A method that tells if an impact occurred. The Telegram app may play the\n * appropriate haptics based on style value passed.\n * @param style - impact style.\n * @since Mini Apps v6.1\n */\n impactOccurredFp: WithChecksFp<(style: ImpactHapticFeedbackStyle) => HapticFeedbackEither, true>;\n\n /**\n * @see impactOccurredFp\n */\n impactOccurred: WithChecks<(style: ImpactHapticFeedbackStyle) => void, true>;\n\n /**\n * A method tells that a task or action has succeeded, failed, or produced\n * a warning. The Telegram app may play the appropriate haptics based on type\n * value passed.\n * @param type - notification type.\n * @since Mini Apps v6.1\n */\n notificationOccurredFp: WithChecksFp<\n (type: NotificationHapticFeedbackType) => HapticFeedbackEither,\n true\n >;\n\n /**\n * @see notificationOccurredFp\n */\n notificationOccurred: WithChecks<(type: NotificationHapticFeedbackType) => void, true>;\n\n /**\n * A method tells that the user has changed a selection. The Telegram app may\n * play the appropriate haptics.\n *\n * Do not use this feedback when the user makes or confirms a selection; use\n * it only when the selection changes.\n * @since Mini Apps v6.1\n */\n selectionChangedFp: WithChecksFp<() => HapticFeedbackEither, true>;\n\n /**\n * @see selectionChangedFp\n */\n selectionChanged: WithChecks<() => void, true>;\n}\n","import { function as fn } from 'fp-ts';\n\nimport { HapticFeedback } from '@/features/HapticFeedback/HapticFeedback.js';\nimport { sharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\nimport { withPostEvent } from '@/fn-options/withPostEvent.js';\nimport { withVersion } from '@/fn-options/withVersion.js';\n\nfunction instantiate() {\n return new HapticFeedback(fn.pipe(\n sharedFeatureOptions(),\n withPostEvent,\n withVersion,\n ));\n}\n\nexport const hapticFeedback = /* @__PURE__*/ instantiate();\n","import type { PostEventError } from '@vbotma/bridge';\nimport { function as fn } from 'fp-ts';\nimport type * as E from 'fp-ts/Either';\n\nimport {\n sharedFeatureOptions,\n type SharedFeatureOptions,\n} from '@/fn-options/sharedFeatureOptions.js';\nimport { withPostEvent, type WithPostEvent } from '@/fn-options/withPostEvent.js';\nimport { withVersion, type WithVersion } from '@/fn-options/withVersion.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport { withChecksFp } from '@/with-checks/withChecksFp.js';\n\ninterface CreateOptions extends SharedFeatureOptions, WithPostEvent, WithVersion {\n}\n\nfunction create({ postEvent, ...rest }: CreateOptions) {\n return withChecksFp((): E.Either<PostEventError, void> => {\n return postEvent('web_app_add_to_home_screen');\n }, { ...rest, requires: 'web_app_add_to_home_screen', returns: 'either' });\n}\n\n// #__NO_SIDE_EFFECTS__\nfunction instantiate() {\n return create(fn.pipe(\n sharedFeatureOptions(),\n withVersion,\n withPostEvent,\n ));\n}\n\n/**\n * Prompts the user to add the Mini App to the home screen.\n * @since Mini Apps v8.0\n */\nexport const addToHomeScreenFp = instantiate();\n\n/**\n * @see addToHomeScreenFp\n */\nexport const addToHomeScreen = throwifyWithChecksFp(addToHomeScreenFp);\n","import type { HomeScreenStatus, RequestError } from '@vbotma/bridge';\nimport { taskEither as TE, function as fn } from 'fp-ts';\n\nimport {\n sharedFeatureOptions,\n type SharedFeatureOptions,\n} from '@/fn-options/sharedFeatureOptions.js';\nimport { withRequest, type WithRequest } from '@/fn-options/withRequest.js';\nimport { withVersion, type WithVersion } from '@/fn-options/withVersion.js';\nimport type { AsyncOptions } from '@/types.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport { withChecksFp } from '@/with-checks/withChecksFp.js';\n\ninterface CreateOptions extends SharedFeatureOptions, WithRequest, WithVersion {\n}\n\nfunction create({ request, ...rest }: CreateOptions) {\n return withChecksFp((options?: AsyncOptions): TE.TaskEither<RequestError, HomeScreenStatus> => {\n return fn.pipe(\n request('web_app_check_home_screen', 'home_screen_checked', options),\n TE.map(response => response.status || 'unknown'),\n );\n }, { ...rest, requires: 'web_app_check_home_screen', returns: 'task' });\n}\n\n// #__NO_SIDE_EFFECTS__\nfunction instantiate() {\n return create(fn.pipe(\n sharedFeatureOptions(),\n withVersion,\n withRequest,\n ));\n}\n\n/**\n * Sends a request to the native VBot application to check if the current mini\n * application is added to the device's home screen.\n * @param options - additional options.\n * @since Mini Apps v8.0\n */\nexport const checkHomeScreenStatusFp = instantiate();\n\n/**\n * @see checkHomeScreenStatusFp\n */\nexport const checkHomeScreenStatus = throwifyWithChecksFp(checkHomeScreenStatusFp);\n","import { computed, type Computed, signal } from '@vbotma/signals';\nimport { throwifyFpFn } from '@vbotma/toolkit';\nimport type { InitData as InitDataType } from '@vbotma/types';\nimport { either as E, option as O, function as fn } from 'fp-ts';\n\nexport interface InitDataOptions<Err> {\n /**\n * Retrieves init data from the current environment.\n */\n retrieveInitData: () => E.Either<Err, O.Option<{\n raw: string;\n obj: InitDataType;\n }>>;\n}\n\nexport class InitData<Err extends Error> {\n constructor({ retrieveInitData }: InitDataOptions<Err>) {\n this.restoreFp = () => {\n return fn.pipe(\n retrieveInitData(),\n E.map(O.match(() => undefined, ({ raw, obj }) => {\n this._state.set(obj);\n this._raw.set(raw);\n })),\n );\n };\n this.restore = throwifyFpFn(this.restoreFp);\n }\n\n private fromState<K extends keyof InitDataType>(key: K): Computed<InitDataType[K] | undefined> {\n return computed(() => {\n const s = this._state();\n return s ? s[key] : undefined;\n });\n }\n\n private readonly _state = signal<InitDataType>();\n\n private readonly _raw = signal<string>();\n\n /**\n * Complete component state.\n */\n readonly state = computed(this._state);\n\n /**\n * @see InitDataType.auth_date\n */\n readonly authDate = this.fromState('auth_date');\n\n /**\n * @see InitDataType.can_send_after\n */\n readonly canSendAfter = this.fromState('can_send_after');\n\n /**\n * Date after which it is allowed to call\n * the [answerWebAppQuery](https://core.telegram.org/bots/api#answerwebappquery) method.\n */\n readonly canSendAfterDate = computed(() => {\n const authDateValue = this.authDate();\n const canSendAfterValue = this.canSendAfter();\n\n return canSendAfterValue && authDateValue\n ? new Date(authDateValue.getTime() + (canSendAfterValue * 1000))\n : undefined;\n });\n\n /**\n * @see InitDataType.chat\n */\n readonly chat = this.fromState('chat');\n\n /**\n * @see InitDataType.chat_type\n */\n readonly chatType = this.fromState('chat_type');\n\n /**\n * @see InitDataType.chat_instance\n */\n readonly chatInstance = this.fromState('chat_instance');\n\n /**\n * @see InitDataType.hash\n */\n readonly hash = this.fromState('hash');\n\n /**\n * @see InitDataType.query_id\n */\n readonly queryId = this.fromState('query_id');\n\n /**\n * Raw representation of init data.\n */\n readonly raw = computed(this._raw);\n\n /**\n * @see InitDataType.receiver\n */\n readonly receiver = this.fromState('receiver');\n\n /**\n * @see InitDataType.signature\n */\n readonly signature = this.fromState('signature');\n\n /**\n * @see InitDataType.start_param\n */\n readonly startParam = this.fromState('start_param');\n\n /**\n * @see InitDataType.auth\n */\n readonly auth = this.fromState(\"auth\")\n\n /**\n * @see InitDataType.user\n */\n readonly user = this.fromState('user');\n\n /**\n * Restores the component state.\n */\n readonly restoreFp: () => E.Either<Err, void>;\n\n /**\n * @see restoreFp\n */\n readonly restore: () => void;\n}\n","import { retrieveRawInitDataFp, retrieveLaunchParamsFp } from '@vbotma/bridge';\nimport { either as E, function as fn, option as O } from 'fp-ts';\n\nimport { InitData } from '@/features/InitData/InitData.js';\n\nfunction instantiate() {\n return new InitData({\n retrieveInitData() {\n return fn.pipe(\n E.Do,\n E.bindW('obj', () => fn.pipe(\n retrieveLaunchParamsFp(),\n E.map(({ vbWebAppData }) => {\n return vbWebAppData ? O.some(vbWebAppData) : O.none;\n }),\n )),\n E.bindW('raw', retrieveRawInitDataFp),\n E.map(({ obj, raw }) => {\n return fn.pipe(\n O.Do,\n O.bind('obj', () => obj),\n O.bind('raw', () => raw),\n );\n }),\n );\n },\n });\n}\n\nexport const initData = /* @__PURE__*/ instantiate();\n","import type { InvoiceStatus, RequestError } from '@vbotma/bridge';\nimport { computed, type Computed, signal } from '@vbotma/signals';\nimport { BetterPromise } from 'better-promises';\nimport { taskEither as TE, function as fn } from 'fp-ts';\n\nimport { ConcurrentCallError, InvalidArgumentsError } from '@/errors.js';\nimport type { SharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\nimport type { WithRequest } from '@/fn-options/withRequest.js';\nimport type { WithVersion } from '@/fn-options/withVersion.js';\nimport { createIsSupportedSignal } from '@/helpers/createIsSupportedSignal.js';\nimport type { AsyncOptions } from '@/types.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport { createWithChecksFp, type WithChecks, type WithChecksFp } from '@/with-checks/withChecksFp.js';\n\ntype InvoiceTask<E, T> = TE.TaskEither<RequestError | ConcurrentCallError | E, T>;\n\nexport interface InvoiceOptions extends WithVersion, WithRequest, SharedFeatureOptions {\n}\n\n/**\n * @since Mini Apps v6.1\n */\nexport class Invoice {\n constructor({ version, request, isTma }: InvoiceOptions) {\n const wrapSupportedTask = createWithChecksFp({\n version,\n isTma,\n requires: 'web_app_open_invoice',\n returns: 'task',\n });\n\n const isOpened = signal(false);\n const toggleClosed = () => {\n isOpened.set(false);\n };\n\n this.isSupported = createIsSupportedSignal('web_app_open_invoice', version);\n this.isOpened = computed(isOpened);\n this.openSlugFp = wrapSupportedTask((slug, options) => {\n return fn.pipe(\n this.isOpened()\n ? TE.left(new ConcurrentCallError('Invoice is already opened'))\n : TE.right(undefined as never),\n TE.chain(() => {\n isOpened.set(true);\n return request('web_app_open_invoice', 'invoice_closed', {\n ...options,\n params: { slug },\n capture: data => slug === data.slug,\n });\n }),\n TE.mapBoth(err => {\n toggleClosed();\n return err;\n }, data => {\n toggleClosed();\n return data.status;\n }),\n );\n });\n this.openUrlFp = wrapSupportedTask((url, options) => {\n const { hostname, pathname } = new URL(url, window.location.href);\n if (hostname !== 't.me') {\n return TE.left(new InvalidArgumentsError(`Link has unexpected hostname: ${hostname}`));\n }\n\n // Valid examples:\n // \"/invoice/my-slug\"\n // \"/$my-slug\"\n const match = pathname.match(/^\\/(\\$|invoice\\/)([A-Za-z0-9\\-_=]+)$/);\n if (!match) {\n return TE.left(new InvalidArgumentsError(\n 'Expected to receive a link with a pathname in format \"/invoice/{slug}\" or \"/${slug}\"',\n ));\n }\n return this.openSlugFp(match[2], options);\n });\n\n this.openUrl = throwifyWithChecksFp(this.openUrlFp);\n this.openSlug = throwifyWithChecksFp(this.openSlugFp);\n }\n\n /**\n * Signal indicating if any invoice is currently opened.\n */\n readonly isOpened: Computed<boolean>;\n\n /**\n * Signal indicating if the component is supported.\n */\n readonly isSupported: Computed<boolean>;\n\n /**\n * Opens an invoice using its slug or URL.\n * @param slug - invoice slug.\n * @param options - additional options.\n * @since Mini Apps v6.1\n * @example\n * const status = await invoice.openSlug('kJNFS331');\n */\n readonly openSlugFp: WithChecksFp<\n (slug: string, options?: AsyncOptions) => InvoiceTask<never, InvoiceStatus>,\n true\n >;\n\n /**\n * @see openSlugFp\n */\n readonly openSlug: WithChecks<\n (slug: string, options?: AsyncOptions) => BetterPromise<InvoiceStatus>,\n true\n >;\n\n /**\n * Opens an invoice using its URL.\n * @param url - invoice URL.\n * @param options - additional options.\n * @since Mini Apps v6.1\n * @example\n * const status = await invoice.openUrl('https://t.me/$kJNFS331');\n */\n readonly openUrlFp: WithChecksFp<\n (url: string, options?: AsyncOptions) => (\n InvoiceTask<InvalidArgumentsError, InvoiceStatus>\n ),\n true\n >;\n\n /**\n * @see openUrlFp\n */\n readonly openUrl: WithChecks<\n (url: string, options?: AsyncOptions) => BetterPromise<InvoiceStatus>,\n true\n >;\n}\n","import { function as fn } from 'fp-ts';\n\nimport { Invoice } from '@/features/Invoice/Invoice.js';\nimport { sharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\nimport { withRequest } from '@/fn-options/withRequest.js';\nimport { withVersion } from '@/fn-options/withVersion.js';\n\nfunction instantiate() {\n return new Invoice(fn.pipe(sharedFeatureOptions(), withRequest, withVersion));\n}\n\nexport const invoice = /* @__PURE__*/ instantiate();\n","import type { OpenLinkBrowser, PostEventError } from '@vbotma/bridge';\nimport { either as E, function as fn } from 'fp-ts';\n\nimport { InvalidArgumentsError } from '@/errors.js';\nimport {\n type SharedFeatureOptions,\n sharedFeatureOptions,\n} from '@/fn-options/sharedFeatureOptions.js';\nimport { type WithPostEvent, withPostEvent } from '@/fn-options/withPostEvent.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport { withChecksFp } from '@/with-checks/withChecksFp.js';\n\ninterface CreateOptions extends SharedFeatureOptions, WithPostEvent {\n}\n\nexport interface OpenLinkOptions {\n /**\n * Attempts to use the instant view mode.\n */\n tryInstantView?: boolean;\n /**\n * A preferred browser to open the link in.\n */\n tryBrowser?: OpenLinkBrowser;\n}\n\nexport type OpenLinkError = PostEventError | InvalidArgumentsError;\n\nfunction create({ postEvent, ...rest }: CreateOptions) {\n return withChecksFp((\n url: string | URL,\n options: OpenLinkOptions = {},\n ): E.Either<OpenLinkError, void> => {\n if (typeof url === 'string') {\n try {\n url = new URL(url);\n } catch (e) {\n return E.left(new InvalidArgumentsError(`\"${url.toString()}\" is invalid URL`, e));\n }\n }\n return postEvent('web_app_open_link', {\n url: url.toString(),\n try_browser: options.tryBrowser,\n try_instant_view: options.tryInstantView,\n });\n }, { ...rest, returns: 'either' });\n}\n\n// #__NO_SIDE_EFFECTS__\nfunction instantiate() {\n return create(fn.pipe(sharedFeatureOptions(), withPostEvent));\n}\n\n/**\n * Opens a link.\n *\n * The Mini App will not be closed.\n *\n * Note that this method can be called only in response to the user\n * interaction with the Mini App interface (e.g. click inside the Mini App or on the main button).\n * @param url - URL to be opened.\n * @param options - additional options.\n * @example\n * openLink('https://google.com', {\n * tryInstantView: true,\n * tryBrowser: 'chrome',\n * });\n */\nexport const openLinkFp = instantiate();\n\nexport const openLink = throwifyWithChecksFp(openLinkFp);\n","import { supports, type PostEventError } from '@vbotma/bridge';\nimport { either as E, function as fn } from 'fp-ts';\n\nimport { InvalidArgumentsError } from '@/errors.js';\nimport {\n type SharedFeatureOptions,\n sharedFeatureOptions,\n} from '@/fn-options/sharedFeatureOptions.js';\nimport { withPostEvent, type WithPostEvent } from '@/fn-options/withPostEvent.js';\nimport { withVersion, type WithVersion } from '@/fn-options/withVersion.js';\nimport { access } from '@/helpers/access.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport { withChecksFp } from '@/with-checks/withChecksFp.js';\n\ninterface CreateOptions extends SharedFeatureOptions, WithPostEvent, WithVersion {\n}\n\nexport type OpenTelegramLinkError = PostEventError | InvalidArgumentsError;\n\nfunction create({ postEvent, version, ...rest }: CreateOptions) {\n return withChecksFp((\n url: string | URL,\n ): E.Either<OpenTelegramLinkError, void> => {\n const urlString = url.toString();\n if (!urlString.match(/^https:\\/\\/t.me\\/.+/)) {\n return E.left(new InvalidArgumentsError(`\"${urlString}\" is invalid URL`));\n }\n\n if (supports('web_app_open_tg_link', access(version))) {\n url = new URL(url);\n return postEvent('web_app_open_tg_link', { path_full: url.pathname + url.search });\n }\n\n window.location.href = urlString;\n return E.right(undefined);\n }, { ...rest, returns: 'either' });\n}\n\n// #__NO_SIDE_EFFECTS__\nfunction instantiate() {\n return create(fn.pipe(\n sharedFeatureOptions(),\n withPostEvent,\n withVersion,\n ));\n}\n\n/**\n * Opens a Telegram link inside the Telegram app. The function expects passing a link in a full\n * format using the hostname \"t.me\".\n *\n * The Mini App will be closed.\n * @param url - URL to be opened.\n * @example\n * openTelegramLink('https://t.me/heyqbnk');\n */\nexport const openTelegramLinkFp = instantiate();\n\n/**\n * @see openTelegramLinkFp\n */\nexport const openTelegramLink = throwifyWithChecksFp(openTelegramLinkFp);\n","import type { PostEventError } from '@vbotma/bridge';\nimport type { either as E } from 'fp-ts';\n\nimport { openTelegramLinkFp } from '@/features/links/openTelegramLink.js';\nimport {\n sharedFeatureOptions,\n type SharedFeatureOptions,\n} from '@/fn-options/sharedFeatureOptions.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport { withChecksFp } from '@/with-checks/withChecksFp.js';\n\ninterface CreateOptions extends SharedFeatureOptions {\n openTelegramLink: (url: string) => E.Either<PostEventError, void>;\n}\n\nexport type ShareURLError = PostEventError;\n\nfunction create({ openTelegramLink, ...rest }: CreateOptions) {\n return withChecksFp((url: string, text?: string): E.Either<ShareURLError, void> => {\n return openTelegramLink(\n 'https://t.me/share/url?' + new URLSearchParams({ url, text: text || '' })\n .toString()\n // By default, URL search params encode spaces with \"+\".\n // We are replacing them with \"%20\", because plus symbols are working incorrectly\n // in Telegram.\n .replace(/\\+/g, '%20'),\n );\n }, { ...rest, returns: 'either' });\n}\n\n// #__NO_SIDE_EFFECTS__\nfunction instantiate() {\n return create({\n ...sharedFeatureOptions(),\n openTelegramLink: openTelegramLinkFp,\n });\n}\n\n/**\n * Shares the specified URL with the passed to the chats, selected by user.\n * After being called, it closes the mini application.\n *\n * This method uses Telegram's Share Links.\n * @param url - URL to share.\n * @param text - text to append after the URL.\n * @see https://core.telegram.org/api/links#share-links\n * @see https://core.telegram.org/widgets/share#custom-buttons\n */\nexport const shareURLFp = instantiate();\n\n/**\n * @see shareURLFp\n */\nexport const shareURL = throwifyWithChecksFp(shareURLFp);\n","import type { EventPayload, RequestError, PostEventError } from '@vbotma/bridge';\nimport type { Computed } from '@vbotma/signals';\nimport type { Maybe } from '@vbotma/toolkit';\nimport { BetterPromise } from 'better-promises';\nimport { either as E, taskEither as TE, function as fn } from 'fp-ts';\n\nimport { AsyncMountable } from '@/composables/AsyncMountable.js';\nimport { Stateful } from '@/composables/Stateful.js';\nimport type {\n LocationManagerOptions,\n LocationManagerRequestLocationResponse,\n LocationManagerState,\n} from '@/features/LocationManager/types.js';\nimport { createIsSupportedSignal } from '@/helpers/createIsSupportedSignal.js';\nimport type { AsyncOptions } from '@/types.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport { createWithChecksFp, type WithChecks, type WithChecksFp } from '@/with-checks/withChecksFp.js';\n\nfunction eventToState(event: EventPayload<'location_checked'>): LocationManagerState {\n let available = false;\n let accessRequested: Maybe<boolean>;\n let accessGranted: Maybe<boolean>;\n if (event.available) {\n available = true;\n accessRequested = event.access_requested;\n accessGranted = event.access_granted;\n }\n return {\n available,\n accessGranted: accessGranted || false,\n accessRequested: accessRequested || false,\n };\n}\n\n/**\n * @since Mini Apps v8.0\n */\nexport class LocationManager {\n constructor({\n version,\n request,\n postEvent,\n storage,\n isTma,\n isPageReload,\n }: LocationManagerOptions) {\n const stateful = new Stateful({\n initialState: {\n available: false,\n accessGranted: false,\n accessRequested: false,\n },\n onChange: storage.set,\n });\n const mountable = new AsyncMountable<LocationManagerState, RequestError>({\n isPageReload,\n restoreState: storage.get,\n onMounted: stateful.setState,\n initialState(options) {\n return fn.pipe(\n request('web_app_check_location', 'location_checked', options),\n TE.map(eventToState),\n );\n },\n });\n\n const wrapOptions = { version, requires: 'web_app_check_location', isTma } as const;\n const wrapSupportedEither = createWithChecksFp({\n ...wrapOptions,\n returns: 'either',\n });\n const wrapSupportedTask = createWithChecksFp({\n ...wrapOptions,\n returns: 'task',\n });\n const wrapMountedTask = createWithChecksFp({\n ...wrapOptions,\n returns: 'task',\n isMounted: mountable.isMounted,\n });\n\n this.isAvailable = stateful.getter('available');\n this.isAccessRequested = stateful.getter('accessRequested');\n this.isAccessGranted = stateful.getter('accessGranted');\n this.isSupported = createIsSupportedSignal('web_app_check_location', version);\n this.isMounted = mountable.isMounted;\n this.state = stateful.state;\n\n this.unmount = mountable.unmount;\n this.mountFp = wrapSupportedTask(mountable.mount);\n this.openSettingsFp = wrapSupportedEither(() => {\n return postEvent('web_app_open_location_settings');\n });\n this.requestLocationFp = wrapMountedTask(options => {\n return fn.pipe(\n request('web_app_request_location', 'location_requested', options),\n TE.map(response => {\n if (!response.available) {\n stateful.setState({ available: false });\n return null;\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n const { available, ...rest } = response;\n return rest;\n }),\n );\n });\n\n this.mount = throwifyWithChecksFp(this.mountFp);\n this.openSettings = throwifyWithChecksFp(this.openSettingsFp);\n this.requestLocation = throwifyWithChecksFp(this.requestLocationFp);\n }\n\n /**\n * Complete location manager state.\n */\n readonly state: Computed<LocationManagerState>;\n\n /**\n * Signal indicating whether the location data tracking is currently available.\n */\n readonly isAvailable: Computed<boolean>;\n\n /**\n * Signal indicating whether the user has granted the app permission to track location data.\n */\n readonly isAccessGranted: Computed<boolean>;\n\n /**\n * Signal indicating whether the app has previously requested permission to track location data.\n */\n readonly isAccessRequested: Computed<boolean>;\n\n /**\n * Signal indicating if the component is currently mounted.\n */\n readonly isMounted: Computed<boolean>;\n\n /**\n * Signal indicating if the component is supported.\n */\n readonly isSupported: Computed<boolean>;\n\n /**\n * Opens the location access settings for bots. Useful when you need to request location access\n * from users who haven't granted it yet.\n *\n * Note that this method can be called only in response to user interaction with the Mini App\n * interface (e.g., a click inside the Mini App or on the main button).\n * @since Mini Apps v8.0\n */\n readonly openSettingsFp: WithChecksFp<() => E.Either<PostEventError, void>, true>;\n\n /**\n * @see openSettingsFp\n */\n readonly openSettings: WithChecks<() => void, true>;\n\n /**\n * Requests location data.\n * @since Mini Apps v8.0\n * @returns Promise with location data or null it access was not granted.\n */\n readonly requestLocationFp: WithChecksFp<\n (options?: AsyncOptions) => (\n TE.TaskEither<RequestError, LocationManagerRequestLocationResponse | null>\n ),\n true\n >;\n\n /**\n * @see requestLocationFp\n */\n readonly requestLocation: WithChecks<\n (options?: AsyncOptions) => BetterPromise<LocationManagerRequestLocationResponse | null>,\n true\n >;\n\n /**\n * Mounts the component restoring its state.\n * @since Mini Apps v8.0\n */\n readonly mountFp: WithChecksFp<\n (options?: AsyncOptions) => TE.TaskEither<RequestError, void>,\n true\n >;\n\n /**\n * @see mountFp\n */\n readonly mount: WithChecks<(options?: AsyncOptions) => BetterPromise<void>, true>;\n\n /**\n * Unmounts the component.\n */\n readonly unmount: () => void;\n}\n","import { function as fn } from 'fp-ts';\n\nimport { LocationManager } from '@/features/LocationManager/LocationManager.js';\nimport type { LocationManagerState } from '@/features/LocationManager/types.js';\nimport { sharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\nimport { withPostEvent } from '@/fn-options/withPostEvent.js';\nimport { withRequest } from '@/fn-options/withRequest.js';\nimport { withStateRestore } from '@/fn-options/withStateRestore.js';\nimport { withVersion } from '@/fn-options/withVersion.js';\n\nfunction instantiate() {\n return new LocationManager(fn.pipe(\n sharedFeatureOptions(),\n withPostEvent,\n withVersion,\n withRequest,\n withStateRestore<LocationManagerState>('locationManager'),\n ));\n}\n\nexport const locationManager = /* @__PURE__*/ instantiate();\n","import type { PostEventError } from '@vbotma/bridge';\nimport { computed, type Computed } from '@vbotma/signals';\nimport type { RGB } from '@vbotma/types';\nimport { either as E } from 'fp-ts';\n\nimport { Button, type ButtonOptions } from '@/composables/Button.js';\nimport { access } from '@/helpers/access.js';\nimport type { MaybeAccessor } from '@/types.js';\nimport type { WithChecks, WithChecksFp } from '@/with-checks/withChecksFp.js';\n\ntype MainButtonEither = E.Either<PostEventError, void>;\n\nexport interface MainButtonState {\n isVisible: boolean;\n bgColor?: RGB;\n hasShineEffect: boolean;\n isEnabled: boolean;\n isLoaderVisible: boolean;\n text: string;\n textColor?: RGB;\n}\n\nexport interface MainButtonOptions extends Omit<\n ButtonOptions<MainButtonState, 'web_app_setup_main_button'>,\n 'initialState' | 'method' | 'payload' | 'version'\n> {\n /**\n * Default values for different kinds of the button properties.\n */\n defaults: {\n bgColor: MaybeAccessor<RGB>;\n textColor: MaybeAccessor<RGB>;\n };\n}\n\nexport class MainButton {\n constructor({ defaults, ...options }: MainButtonOptions) {\n const button = new Button({\n ...options,\n version: '100',\n initialState: {\n hasShineEffect: false,\n isEnabled: true,\n isLoaderVisible: false,\n isVisible: false,\n text: 'Continue',\n },\n method: 'web_app_setup_main_button',\n payload: state => ({\n has_shine_effect: state.hasShineEffect,\n is_visible: state.isVisible,\n is_active: state.isEnabled,\n is_progress_visible: state.isLoaderVisible,\n text: state.text,\n color: state.bgColor,\n text_color: state.textColor,\n }),\n });\n\n const withDefault = (\n field: 'bgColor' | 'textColor',\n getDefault: MaybeAccessor<RGB>,\n ) => {\n const fromState = button.stateGetter(field);\n return computed(() => fromState() || access(getDefault));\n };\n\n this.bgColor = withDefault('bgColor', defaults.bgColor);\n this.textColor = withDefault('textColor', defaults.textColor);\n this.hasShineEffect = button.stateGetter('hasShineEffect');\n this.isEnabled = button.stateGetter('isEnabled');\n this.isLoaderVisible = button.stateGetter('isLoaderVisible');\n this.text = button.stateGetter('text');\n this.isVisible = button.stateGetter('isVisible');\n this.isMounted = button.isMounted;\n this.state = button.state;\n\n [this.setBgColor, this.setBgColorFp] = button.stateSetters('bgColor');\n [this.setTextColor, this.setTextColorFp] = button.stateSetters('textColor');\n [\n [this.disableShineEffect, this.disableShineEffectFp],\n [this.enableShineEffect, this.enableShineEffectFp],\n ] = button.stateBoolSetters('hasShineEffect');\n [\n [this.disable, this.disableFp],\n [this.enable, this.enableFp],\n ] = button.stateBoolSetters('isEnabled');\n [\n [this.hideLoader, this.hideLoaderFp],\n [this.showLoader, this.showLoaderFp],\n ] = button.stateBoolSetters('isLoaderVisible');\n\n [this.setText, this.setTextFp] = button.stateSetters('text');\n [[this.hide, this.hideFp], [this.show, this.showFp]] = button.stateBoolSetters('isVisible');\n this.setParams = button.setState;\n this.setParamsFp = button.setStateFp;\n this.onClick = button.onClick;\n this.onClickFp = button.onClickFp;\n this.offClick = button.offClick;\n this.offClickFp = button.offClickFp;\n this.mount = button.mount;\n this.mountFp = button.mountFp;\n this.unmount = button.unmount;\n }\n\n //#region Properties.\n /**\n * The button background color.\n */\n readonly bgColor: Computed<RGB>;\n\n /**\n * True if the button has a shining effect.\n */\n readonly hasShineEffect: Computed<boolean>;\n\n /**\n * True if the button is clickable.\n */\n readonly isEnabled: Computed<boolean>;\n\n /**\n * True if the button loader is visible.\n */\n readonly isLoaderVisible: Computed<boolean>;\n\n /**\n * True if the button is visible.\n */\n readonly isVisible: Computed<boolean>;\n\n /**\n * Signal indicating if the component is currently mounted.\n */\n readonly isMounted: Computed<boolean>;\n\n /**\n * The complete button state.\n */\n readonly state: Computed<MainButtonState>;\n\n /**\n * The button displayed text.\n */\n readonly text: Computed<string>;\n\n /**\n * The button text color.\n *\n * Note that this value is computed based on the external defaults. For\n * example, if not explicitly set, this value may be equal to one of theme\n * params colors.\n */\n readonly textColor: Computed<RGB>;\n //#endregion\n\n //#region Methods.\n /**\n * Shows the button.\n */\n readonly showFp: WithChecksFp<() => MainButtonEither, false>;\n\n /**\n * @see showFp\n */\n readonly show: WithChecks<() => void, false>;\n\n /**\n * Hides the button.\n */\n readonly hideFp: WithChecksFp<() => MainButtonEither, false>;\n\n /**\n * @see hideFp\n */\n readonly hide: WithChecks<() => void, false>;\n\n /**\n * Enables the button.\n */\n readonly enableFp: WithChecksFp<() => MainButtonEither, false>;\n\n /**\n * @see enableFp\n */\n readonly enable: WithChecks<() => void, false>;\n\n /**\n * Enables the button.\n */\n readonly enableShineEffectFp: WithChecksFp<() => MainButtonEither, false>;\n\n /**\n * @see enableShineEffectFp\n */\n readonly enableShineEffect: WithChecks<() => void, false>;\n\n /**\n * Disables the button.\n */\n readonly disableFp: WithChecksFp<() => MainButtonEither, false>;\n\n /**\n * @see disableFp\n */\n readonly disable: WithChecks<() => void, false>;\n\n /**\n * Enables the button.\n */\n readonly disableShineEffectFp: WithChecksFp<() => MainButtonEither, false>;\n\n /**\n * @see disableShineEffectFp\n */\n readonly disableShineEffect: WithChecks<() => void, false>;\n\n /**\n * Updates the button background color.\n */\n readonly setBgColorFp: WithChecksFp<(value: RGB) => MainButtonEither, false>;\n\n /**\n * @see setBgColorFp\n */\n readonly setBgColor: WithChecks<(value: RGB) => void, false>;\n\n /**\n * Updates the button text color.\n */\n readonly setTextColorFp: WithChecksFp<(value: RGB) => MainButtonEither, false>;\n\n /**\n * @see setTextColorFp\n */\n readonly setTextColor: WithChecks<(value: RGB) => void, false>;\n\n /**\n * Updates the button text.\n */\n readonly setTextFp: WithChecksFp<(value: string) => MainButtonEither, false>;\n\n /**\n * @see setTextFp\n */\n readonly setText: WithChecks<(value: string) => void, false>;\n\n /**\n * Shows the button loader.\n */\n readonly showLoaderFp: WithChecksFp<() => MainButtonEither, false>;\n\n /**\n * @see showLoaderFp\n */\n readonly showLoader: WithChecks<() => void, false>;\n\n /**\n * Hides the button loader.\n */\n readonly hideLoaderFp: WithChecksFp<() => MainButtonEither, false>;\n\n /**\n * @see hideLoaderFp\n */\n readonly hideLoader: WithChecks<() => void, false>;\n\n /**\n * Updates the button state.\n * @param state - updates to apply.\n * @example\n * button.setParams({\n * text: 'Submit',\n * isEnabled: true,\n * hasShineEffect: true,\n * });\n */\n readonly setParamsFp: WithChecksFp<(state: Partial<MainButtonState>) => MainButtonEither, false>;\n\n readonly setParams: WithChecks<(state: Partial<MainButtonState>) => void, false>;\n\n /**\n * Mounts the component restoring its state.\n */\n readonly mountFp: WithChecksFp<() => void, false>;\n\n /**\n * @see mountFp\n */\n readonly mount: WithChecks<() => void, false>;\n\n /**\n * Unmounts the component.\n */\n readonly unmount: () => void;\n\n /**\n * Adds a new button listener.\n * @param listener - event listener.\n * @param once - should the listener be called only once.\n * @returns A function to remove bound listener.\n * @example\n * const off = button.onClick(() => {\n * console.log('User clicked the button');\n * off();\n * });\n */\n readonly onClickFp: WithChecksFp<(listener: VoidFunction, once?: boolean) => VoidFunction, false>;\n\n /**\n * @see onClickFp\n */\n readonly onClick: WithChecks<(listener: VoidFunction, once?: boolean) => VoidFunction, false>;\n\n /**\n * Removes the button click listener.\n * @param listener - event listener.\n * @param once - should the listener be called only once.\n * @example\n * function listener() {\n * console.log('User clicked the button');\n * button.offClick(listener);\n * }\n * button.onClick(listener);\n */\n readonly offClickFp: WithChecksFp<(listener: VoidFunction, once?: boolean) => void, false>;\n\n /**\n * @see offClickFp\n */\n readonly offClick: WithChecks<(listener: VoidFunction, once?: boolean) => void, false>;\n //#endregion\n}\n","/**\n * Sets CSS variable globally.\n * @param name - variable name.\n * @param value - variable value.\n */\nexport function setCssVar(name: string, value: string | null): void {\n document.documentElement.style.setProperty(name, value);\n}\n\n/**\n * Deletes specified CSS variable.\n * @param name - variable name.\n */\nexport function deleteCssVar(name: string): void {\n document.documentElement.style.removeProperty(name);\n}\n","import { throwifyFpFn } from '@vbotma/toolkit';\nimport { toRGBFullFp } from '@vbotma/transformers';\nimport { either as E, function as fn } from 'fp-ts';\n\n/**\n * @param color - color in any format acceptable by the `toRGB` function.\n * @returns True if the color is recognized as dark.\n * @see toRGB\n */\nexport function isColorDarkFp(color: string): E.Either<Error, boolean> {\n return fn.pipe(\n toRGBFullFp(color),\n E.map(rgb => {\n // Actual formula: hsp = Math.sqrt(0.299 * r * r + 0.587 * g * g + 0.114 * b * b)\n // See: https://stackoverflow.com/a/596243\n return Math.sqrt(\n [0.299, 0.587, 0.114].reduce<number>((acc, modifier, idx) => {\n // Extract part of #RRGGBB pattern and convert it to DEC.\n const dec = parseInt(rgb.slice(1 + (idx * 2), 1 + ((idx + 1) * 2)), 16);\n return acc + (dec * dec * modifier);\n }, 0),\n ) < 120;\n }),\n );\n}\n\n/**\n * @see isColorDarkFp\n */\nexport const isColorDark = throwifyFpFn(isColorDarkFp);\n","import type { EventListener } from '@vbotma/bridge';\nimport { computed, type Computed, signal } from '@vbotma/signals';\nimport { snakeToKebab } from '@vbotma/toolkit';\nimport type { ThemeParams as ThemeParamsType, RGB } from '@vbotma/types';\nimport { either as E } from 'fp-ts';\n\nimport { Mountable } from '@/composables/Mountable.js';\nimport { Stateful } from '@/composables/Stateful.js';\nimport { CSSVarsBoundError } from '@/errors.js';\nimport type { SharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\nimport type { WithStateRestore } from '@/fn-options/withStateRestore.js';\nimport { access } from '@/helpers/access.js';\nimport { deleteCssVar, setCssVar } from '@/helpers/css-vars.js';\nimport { isColorDark } from '@/helpers/isColorDark.js';\nimport type { MaybeAccessor } from '@/types.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport {\n createWithChecksFp,\n type WithChecks,\n type WithChecksFp,\n} from '@/with-checks/withChecksFp.js';\n\nexport type ThemeParamsState = ThemeParamsType;\n\nexport interface ThemeParamsOptions extends WithStateRestore<ThemeParamsState>,\n SharedFeatureOptions {\n /**\n * Removes a theme change listener.\n * @param listener - a listener to remove.\n */\n offChange: (listener: EventListener<'theme_changed'>) => void;\n /**\n * Adds a theme change listener.\n * @returns A function to remove listener.\n * @param listener - a listener to add.\n */\n onChange: (listener: EventListener<'theme_changed'>) => void;\n /**\n * Theme parameters initial state.\n */\n initialState: MaybeAccessor<ThemeParamsType>;\n}\n\nexport interface ThemeParamsGetCssVarNameFn {\n /**\n * @param property - palette key.\n * @returns Computed complete CSS variable name.\n */\n (property: Extract<keyof ThemeParamsType, string>): string;\n}\n\nexport class ThemeParams {\n constructor({\n initialState,\n onChange,\n offChange,\n isTma,\n storage,\n isPageReload,\n }: ThemeParamsOptions) {\n const stateful = new Stateful<ThemeParamsState>({\n initialState: {},\n onChange: storage.set,\n });\n const listener: EventListener<'theme_changed'> = event => {\n stateful.setState(event.theme_params);\n };\n const mountable = new Mountable<ThemeParamsType>({\n initialState: () => E.right(access(initialState)),\n isPageReload,\n onMounted(state) {\n stateful.setState(state);\n onChange(listener);\n },\n onUnmounted() {\n offChange(listener);\n },\n restoreState: storage.get,\n });\n\n const wrapOptions = { isTma, returns: 'either' } as const;\n const wrapSupportedEither = createWithChecksFp(wrapOptions);\n const wrapMountedEither = createWithChecksFp({\n ...wrapOptions,\n isMounted: mountable.isMounted,\n });\n\n // Colors.\n this.accentTextColor = stateful.getter('accent_text_color');\n this.bgColor = stateful.getter('bg_color');\n this.buttonColor = stateful.getter('button_color');\n this.buttonTextColor = stateful.getter('button_text_color');\n this.bottomBarBgColor = stateful.getter('bottom_bar_bg_color');\n this.destructiveTextColor = stateful.getter('destructive_text_color');\n this.headerBgColor = stateful.getter('header_bg_color');\n this.hintColor = stateful.getter('hint_color');\n this.linkColor = stateful.getter('link_color');\n this.secondaryBgColor = stateful.getter('secondary_bg_color');\n this.sectionBgColor = stateful.getter('section_bg_color');\n this.sectionHeaderTextColor = stateful.getter('section_header_text_color');\n this.sectionSeparatorColor = stateful.getter('section_separator_color');\n this.subtitleTextColor = stateful.getter('subtitle_text_color');\n this.textColor = stateful.getter('text_color');\n\n // Other public signals.\n this.state = stateful.state;\n this.isMounted = mountable.isMounted;\n this.bindCssVarsFp = wrapMountedEither(getCSSVarName => {\n if (this._isCssVarsBound()) {\n return E.left(new CSSVarsBoundError());\n }\n getCSSVarName ||= prop => `--tg-theme-${snakeToKebab(prop)}`;\n\n const forEachEntry = (fn: (key: string, value: RGB) => void): void => {\n Object.entries(stateful.state()).forEach(([k, v]) => {\n v && fn(k, v);\n });\n };\n\n const actualize = (): void => {\n forEachEntry((k, v) => {\n setCssVar(getCSSVarName(k), v);\n });\n };\n\n actualize();\n stateful.state.sub(actualize);\n this._isCssVarsBound.set(true);\n\n return E.right(() => {\n forEachEntry(deleteCssVar);\n stateful.state.unsub(actualize);\n this._isCssVarsBound.set(false);\n });\n });\n this.mountFp = wrapSupportedEither(mountable.mount);\n this.unmount = mountable.unmount;\n\n this.bindCssVars = throwifyWithChecksFp(this.bindCssVarsFp);\n this.mount = throwifyWithChecksFp(this.mountFp);\n }\n\n //#region Colors.\n /**\n * @since v6.10\n */\n readonly accentTextColor: Computed<RGB | undefined>;\n\n readonly bgColor: Computed<RGB | undefined>;\n\n readonly buttonColor: Computed<RGB | undefined>;\n\n readonly buttonTextColor: Computed<RGB | undefined>;\n\n /**\n * @since v7.10\n */\n readonly bottomBarBgColor: Computed<RGB | undefined>;\n\n readonly destructiveTextColor: Computed<RGB | undefined>;\n\n /**\n * @since v6.10\n */\n readonly headerBgColor: Computed<RGB | undefined>;\n\n readonly hintColor: Computed<RGB | undefined>;\n\n readonly linkColor: Computed<RGB | undefined>;\n\n readonly secondaryBgColor: Computed<RGB | undefined>;\n\n /**\n * @since v6.10\n */\n readonly sectionBgColor: Computed<RGB | undefined>;\n\n /**\n * @since v6.10\n */\n readonly sectionHeaderTextColor: Computed<RGB | undefined>;\n\n /**\n * @since v7.6\n */\n readonly sectionSeparatorColor: Computed<RGB | undefined>;\n\n /**\n * @since v6.10\n */\n readonly subtitleTextColor: Computed<RGB | undefined>;\n\n readonly textColor: Computed<RGB | undefined>;\n //#endregion\n\n //#region CSS variables.\n private readonly _isCssVarsBound = signal(false);\n\n /**\n * True if CSS variables are currently bound.\n */\n readonly isCssVarsBound = computed(this._isCssVarsBound);\n\n /**\n * Creates CSS variables connected with the current theme parameters.\n *\n * By default, created CSS variables names are following the pattern \"--tg-theme-{name}\", where\n * {name} is a theme parameters key name converted from snake case to kebab case.\n *\n * Default variables:\n * - `--tg-theme-bg-color`\n * - `--tg-theme-secondary-text-color`\n *\n * Variables are being automatically updated if theme parameters were changed.\n *\n * @param getCSSVarName - function, returning complete CSS variable name for the specified\n * theme parameters key.\n * @returns Function to stop updating variables.\n * @throws {CSSVarsBoundError} CSS variables are already bound\n * @example Using custom CSS vars generator\n * themeParams.bindCssVars(key => `--my-prefix-${key}`);\n */\n readonly bindCssVarsFp: WithChecksFp<\n (getCSSVarName?: ThemeParamsGetCssVarNameFn) => E.Either<CSSVarsBoundError, VoidFunction>,\n false\n >;\n\n /**\n * @see bindCssVarsFp\n */\n readonly bindCssVars: WithChecks<\n (getCSSVarName?: ThemeParamsGetCssVarNameFn) => VoidFunction,\n false\n >;\n //#endregion\n\n //#region Other public signals.\n /**\n * Complete component state.\n */\n readonly state: Computed<ThemeParamsType>;\n\n /**\n * @returns True if the current color scheme is recognized as dark.\n * This value is calculated based on the current theme's background color.\n */\n readonly isDark = computed(() => {\n const color = this.bgColor();\n return !color || isColorDark(color);\n });\n //#endregion\n\n //#region Mounting.\n /**\n * Signal indicating if the component is currently mounted.\n */\n readonly isMounted: Computed<boolean>;\n\n /**\n * Mounts the component restoring its state.\n */\n readonly mountFp: WithChecksFp<() => E.Either<never, void>, false>;\n\n /**\n * @see mountFp\n */\n readonly mount: WithChecks<() => void, false>;\n\n /**\n * Unmounts the component.\n */\n readonly unmount: () => void;\n //#endregion\n}\n","import type { ThemeParams } from '@vbotma/types';\n\nimport { createSignal } from '@/globals/signals-registry.js';\n\n/**\n * Mini application's theme parameters.\n */\nexport const themeParams = createSignal<ThemeParams>({});\n","import { on, off } from '@vbotma/bridge';\nimport { function as fn } from 'fp-ts';\n\nimport { ThemeParams, type ThemeParamsState } from '@/features/ThemeParams/ThemeParams.js';\nimport { sharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\nimport { withStateRestore } from '@/fn-options/withStateRestore.js';\nimport { themeParams as globalThemeParams } from '@/globals/themeParams.js';\n\nfunction instantiate() {\n return new ThemeParams({\n ...fn.pipe(\n sharedFeatureOptions(),\n withStateRestore<ThemeParamsState>('themeParams'),\n ),\n offChange(listener) {\n off('theme_changed', listener);\n },\n onChange(listener) {\n on('theme_changed', listener);\n },\n initialState: globalThemeParams,\n });\n}\n\nexport const themeParams = /* @__PURE__*/ instantiate();\n","import type { EventName } from '@vbotma/bridge';\nimport { function as fn } from 'fp-ts';\n\nimport { buttonOptions } from '@/fn-options/buttonOptions.js';\n\n// @__NO_SIDE_EFFECTS__\nexport function bottomButtonOptions<S, D>(\n storageName: string,\n trackedClickEvent: EventName,\n defaults: D,\n) {\n return fn.pipe(\n buttonOptions<S>(storageName, trackedClickEvent),\n obj => ({ ...obj, defaults }),\n );\n}\n","import { computed } from '@vbotma/signals';\n\nimport { MainButton } from '@/features/MainButton/MainButton.js';\nimport { themeParams } from '@/features/ThemeParams/instance.js';\nimport { bottomButtonOptions } from '@/fn-options/bottomButtonOptions.js';\n\nexport const mainButton = /* @__PURE__*/ new MainButton(\n bottomButtonOptions('mainButton', 'main_button_pressed', {\n bgColor: computed(() => themeParams.buttonColor() || '#2481cc'),\n textColor: computed(() => themeParams.buttonTextColor() || '#ffffff'),\n }),\n);\n","import {\n supports,\n type PostEventError,\n type EventPayload,\n type EventListener,\n} from '@vbotma/bridge';\nimport { type Computed, computed } from '@vbotma/signals';\nimport { signal } from '@vbotma/signals';\nimport { createCbCollector, camelToKebab } from '@vbotma/toolkit';\nimport { isRGB } from '@vbotma/transformers';\nimport type { KnownThemeParamsKey, RGB, ThemeParams } from '@vbotma/types';\nimport { either as E, function as fn } from 'fp-ts';\n\nimport { Mountable } from '@/composables/Mountable.js';\nimport { Stateful } from '@/composables/Stateful.js';\nimport { CSSVarsBoundError, UnknownThemeParamsKeyError } from '@/errors.js';\nimport type { SharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\nimport type { WithPostEvent } from '@/fn-options/withPostEvent.js';\nimport type { WithStateRestore } from '@/fn-options/withStateRestore.js';\nimport type { WithVersion } from '@/fn-options/withVersion.js';\nimport { access } from '@/helpers/access.js';\nimport { deleteCssVar, setCssVar } from '@/helpers/css-vars.js';\nimport { isColorDark } from '@/helpers/isColorDark.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport {\n createWithChecksFp,\n type WithChecks,\n withChecksFp,\n type WithChecksFp,\n} from '@/with-checks/withChecksFp.js';\n\ntype AnyColor = RGB | KnownThemeParamsKey | string;\n\nexport interface MiniAppState {\n bgColor: AnyColor;\n bottomBarColor: AnyColor;\n headerColor: AnyColor;\n isActive: boolean;\n}\n\nexport interface MiniAppGetCssVarNameFn {\n /**\n * @param property - mini app property.\n * @returns Computed complete CSS variable name.\n */\n (property: 'bgColor' | 'bottomBarColor' | 'headerColor'): string;\n}\n\ntype WithListeners<Handlers extends string, Payload> = {\n [K in Handlers]: (listener: (payload: Payload) => void) => void;\n};\n\nexport interface MiniAppOptions extends WithPostEvent,\n WithVersion,\n WithStateRestore<MiniAppState>,\n WithListeners<'onVisibilityChanged' | 'offVisibilityChanged', EventPayload<'visibility_changed'>>,\n SharedFeatureOptions {\n /**\n * The current theme parameters.\n */\n theme: Computed<ThemeParams>;\n}\n\n/**\n * @since Mini Apps v6.1\n */\nexport class MiniApp {\n constructor({\n storage,\n isPageReload,\n version,\n postEvent,\n isTma,\n theme,\n onVisibilityChanged,\n offVisibilityChanged,\n }: MiniAppOptions) {\n //#region Mounting.\n const visibilityChangedListener: EventListener<'visibility_changed'> = event => {\n stateful.setState({ isActive: event.is_visible });\n };\n const themeChangedListener = (theme: ThemeParams) => {\n // Sometimes we may have the following colors to be specified as some theme params keys.\n // Due to the Mini Apps nature, we are not really allowed to do that, but we want to provide\n // such an opportunity to developers.\n //\n // So if the developer specified some field as a reference to some theme params key, we\n // should find an according RGB color for it and send it to the VBot client. We have one\n // exclusion here - the method 'web_app_set_header_color' may accept values 'bg_color'\n // and 'secondary_bg_color'. Other methods accept only RGB values.\n ([\n [this.headerColor, 'web_app_set_header_color'],\n [this.bgColor, 'web_app_set_background_color'],\n [this.bottomBarColor, 'web_app_set_bottom_bar_color'],\n ] as const).forEach(([signal, method]) => {\n const color = signal();\n // The value is already in RGB format, we have nothing to update here.\n if (isRGB(color)) {\n return;\n }\n // The real RGB value should only be extracted for the following methods:\n // - 'web_app_set_background_color'\n // - 'web_app_set_bottom_bar_color'\n // We should also do it in case of the 'web_app_set_header_color' method, if the value\n // specified is not 'bg_color' and 'secondary_bg_color' (unknown key to\n // the VBot client).\n if (\n method !== 'web_app_set_header_color'\n || !['bg_color', 'secondary_bg_color'].includes(color)\n ) {\n const rgb = theme[color];\n if (rgb) {\n postEvent(method, { color: rgb });\n }\n }\n });\n };\n const mountable = new Mountable({\n initialState() {\n return E.right({\n bgColor: 'bg_color',\n headerColor: 'header_bg_color',\n bottomBarColor: 'bottom_bar_bg_color',\n isActive: true,\n });\n },\n isPageReload,\n onMounted: state => {\n onVisibilityChanged(visibilityChangedListener);\n theme.sub(themeChangedListener);\n stateful.setState(state);\n },\n onUnmounted() {\n offVisibilityChanged(visibilityChangedListener);\n theme.unsub(themeChangedListener);\n },\n restoreState: storage.get,\n });\n this.isMounted = mountable.isMounted;\n this.mountFp = withChecksFp(() => {\n const nothing = () => undefined;\n return fn.pipe(mountable.mount(), E.match(nothing, nothing));\n }, { isTma, returns: 'plain' });\n this.mount = throwifyWithChecksFp(this.mountFp);\n this.unmount = mountable.unmount;\n //#endregion\n\n //#region State.\n const stateful = new Stateful({\n initialState: {\n bgColor: 'bg_color',\n bottomBarColor: 'bottom_bar_bg_color',\n headerColor: 'bg_color',\n isActive: false,\n },\n onChange: storage.set,\n });\n this.state = stateful.state;\n\n const rgbBasedOn = (color: AnyColor): RGB | undefined => {\n return isRGB(color) ? color : access(theme)[color];\n };\n const computedRgbBasedOn = (signal: Computed<AnyColor>): Computed<RGB | undefined> => {\n return computed(() => rgbBasedOn(signal()));\n };\n //#endregion\n\n //#region Other properties.\n this.isActive = stateful.getter('isActive');\n this.isSupported = computed(() => {\n return ([\n 'web_app_set_header_color',\n 'web_app_set_background_color',\n 'web_app_set_bottom_bar_color',\n ] as const).some(method => supports(method, access(version)));\n });\n //#endregion\n\n //#region Css vars.\n const isCssVarsBound = signal(false);\n this.isCssVarsBound = computed(isCssVarsBound);\n this.bindCssVarsFp = withChecksFp(getCSSVarName => {\n if (isCssVarsBound()) {\n return E.left(new CSSVarsBoundError());\n }\n const [addCleanup, cleanup] = createCbCollector(() => {\n isCssVarsBound.set(false);\n });\n\n const bind = (cssVar: string, signal: Computed<RGB | undefined>) => {\n const update = () => {\n setCssVar(cssVar, signal() || null);\n };\n update();\n addCleanup(signal.sub(update), deleteCssVar.bind(null, cssVar));\n };\n\n getCSSVarName ||= prop => `--tg-${camelToKebab(prop)}`;\n bind(getCSSVarName('bgColor'), this.bgColorRgb);\n bind(getCSSVarName('bottomBarColor'), this.bottomBarColorRgb);\n bind(getCSSVarName('headerColor'), this.headerColorRgb);\n\n isCssVarsBound.set(true);\n\n return E.right(cleanup);\n }, { isTma, returns: 'either', isMounted: this.isMounted });\n this.bindCssVars = throwifyWithChecksFp(this.bindCssVarsFp);\n //#endregion\n\n //#region Colors.\n type GenColorToolsetResult<K extends Exclude<keyof MiniAppState, 'isActive'>> = [\n rawColor: Computed<AnyColor>,\n rgbColor: Computed<RGB | undefined>,\n throwing: WithChecks<\n (color: AnyColor) => void,\n true,\n K extends 'headerColor' ? 'rgb' : never\n >,\n fp: WithChecksFp<\n (color: AnyColor) => E.Either<UnknownThemeParamsKeyError | PostEventError, void>,\n true,\n K extends 'headerColor' ? 'rgb' : never\n >,\n ];\n const genColorToolset = <K extends Exclude<keyof MiniAppState, 'isActive'>>(\n stateKey: K,\n ): GenColorToolsetResult<K> => {\n const rawColor = stateful.getter(stateKey);\n const rgbColor = computedRgbBasedOn(rawColor);\n const method = ({\n headerColor: 'web_app_set_header_color',\n bgColor: 'web_app_set_background_color',\n bottomBarColor: 'web_app_set_bottom_bar_color',\n } as const)[stateKey];\n\n const fp = withChecksFp(\n (color: AnyColor): E.Either<UnknownThemeParamsKeyError | PostEventError, void> => {\n if (color === rawColor()) {\n return E.right(undefined);\n }\n if (\n method === 'web_app_set_header_color'\n && (color === 'bg_color' || color === 'secondary_bg_color')\n ) {\n return fn.pipe(\n postEvent('web_app_set_header_color', { color_key: color }),\n E.map(() => {\n stateful.setState({ [stateKey]: color });\n }),\n );\n }\n const rgb = rgbBasedOn(color);\n return fn.pipe(\n rgb\n ? postEvent(method, { color: rgb })\n : E.left(new UnknownThemeParamsKeyError(color)),\n E.map(() => {\n stateful.setState({ [stateKey]: color });\n }),\n );\n },\n {\n isTma,\n version,\n requires: method,\n isMounted: this.isMounted,\n returns: 'either',\n supports: stateKey === 'headerColor'\n ? {\n rgb: {\n method: 'web_app_set_header_color',\n param: 'color',\n shouldCheck: isRGB,\n },\n }\n : undefined,\n },\n );\n\n return [rawColor, rgbColor, throwifyWithChecksFp(fp), fp] as GenColorToolsetResult<K>;\n };\n [\n this.bgColor,\n this.bgColorRgb,\n this.setBgColor,\n this.setBgColorFp,\n ] = genColorToolset('bgColor');\n [\n this.headerColor,\n this.headerColorRgb,\n this.setHeaderColor,\n this.setHeaderColorFp,\n ] = genColorToolset('headerColor');\n [\n this.bottomBarColor,\n this.bottomBarColorRgb,\n this.setBottomBarColor,\n this.setBottomBarColorFp,\n ] = genColorToolset('bottomBarColor');\n //#endregion\n\n //#region Other methods.\n const withBasicEither = createWithChecksFp({ isTma, returns: 'either' });\n this.closeFp = withBasicEither(returnBack => {\n return postEvent('web_app_close', { return_back: returnBack });\n });\n this.close = throwifyWithChecksFp(this.closeFp);\n\n this.readyFp = withBasicEither(() => postEvent('web_app_ready'));\n this.ready = throwifyWithChecksFp(this.readyFp);\n //#endregion\n }\n\n //#region Other properties.\n /**\n * Signal indicating if the component is supported.\n */\n readonly isSupported: Computed<boolean>;\n\n /**\n * True if the current Mini App background color is recognized as dark.\n */\n readonly isDark = computed(() => {\n const color = this.bgColorRgb();\n return color ? isColorDark(color) : false;\n });\n\n /**\n * Signal indicating if the mini app is currently active.\n */\n readonly isActive: Computed<boolean>;\n\n /**\n * Complete component state.\n */\n readonly state: Computed<MiniAppState>;\n //#endregion\n\n //#region CSS variables.\n /**\n * True if the CSS variables are currently bound.\n */\n readonly isCssVarsBound: Computed<boolean>;\n\n /**\n * Creates CSS variables connected with the mini app.\n *\n * Default variables:\n * - `--tg-bg-color`\n * - `--tg-header-color`\n * - `--tg-bottom-bar-color`\n *\n * Variables are being automatically updated if theme parameters were changed.\n *\n * @param getCSSVarName - function, returning complete CSS variable name for the specified\n * mini app key.\n * @returns Function to stop updating variables.\n * @example Using no arguments\n * miniApp.bindCssVars();\n * @example Using custom CSS vars generator\n * miniApp.bindCssVars(key => `--my-prefix-${key}`);\n */\n readonly bindCssVarsFp: WithChecksFp<\n (getCssVarName?: MiniAppGetCssVarNameFn) => E.Either<CSSVarsBoundError, VoidFunction>,\n false\n >;\n\n readonly bindCssVars: WithChecks<(getCssVarName?: MiniAppGetCssVarNameFn) => VoidFunction, false>;\n //#endregion\n\n //#region Mounting.\n /**\n * Signal indicating if the component is mounted.\n */\n readonly isMounted: Computed<boolean>;\n\n /**\n * Mounts the component.\n *\n * This function restores the component state and is automatically saving it in the local storage\n * if it changed.\n * @since Mini Apps v6.1\n */\n readonly mountFp: WithChecksFp<() => void, false>;\n\n /**\n * @see mount\n */\n readonly mount: WithChecks<() => void, false>;\n\n /**\n * Unmounts the component.\n */\n readonly unmount: () => void;\n //#endregion\n\n //#region Background color.\n /**\n * The Mini App background color.\n *\n * Represents an RGB color, or theme parameters key, like \"bg_color\", \"secondary_bg_color\", etc.\n *\n * Note that using a theme parameters key, background color becomes bound to the current\n * theme parameters, making it automatically being updated whenever theme parameters change.\n * In order to remove this bind, use an explicit RGB color.\n */\n readonly bgColor: Computed<AnyColor>;\n\n /**\n * RGB representation of the background color.\n *\n * This value requires the Theme Params component to be mounted to extract a valid RGB value\n * of the color key.\n */\n readonly bgColorRgb: Computed<RGB | undefined>;\n\n /**\n * Updates the mini app background color.\n * @since Mini Apps v6.1\n */\n readonly setBgColorFp: WithChecksFp<\n (color: AnyColor) => E.Either<PostEventError | UnknownThemeParamsKeyError, void>,\n true\n >;\n\n /**\n * @see setBgColorFp\n */\n readonly setBgColor: WithChecks<(color: AnyColor) => void, true>;\n //#endregion\n\n //#region Header color.\n /**\n * The Mini App header color.\n */\n readonly headerColor: Computed<AnyColor>;\n\n /**\n * RGB representation of the header color.\n *\n * This value requires the Theme Params component to be mounted to extract a valid RGB value\n * of the color key.\n */\n readonly headerColorRgb: Computed<RGB | undefined>;\n\n /**\n * Updates the mini app header color.\n * @since Mini Apps v6.1\n */\n readonly setHeaderColorFp: WithChecksFp<\n (color: AnyColor) => E.Either<PostEventError | UnknownThemeParamsKeyError, void>,\n true,\n 'rgb'\n >;\n\n /**\n * @see setHeaderColorFp\n */\n readonly setHeaderColor: WithChecks<(color: AnyColor) => void, true, 'rgb'>;\n //#endregion\n\n //#region Bottom bar background color.\n /**\n * The Mini App bottom bar background color.\n */\n readonly bottomBarColor: Computed<AnyColor>;\n\n /**\n * RGB representation of the bottom bar background color.\n *\n * This value requires the Theme Params component to be mounted to extract a valid RGB value\n * of the color key.\n */\n readonly bottomBarColorRgb: Computed<RGB | undefined>;\n\n /**\n * Updates the mini app bottom bar bg color.\n * @since Mini Apps v7.10\n */\n readonly setBottomBarColorFp: WithChecksFp<\n (color: AnyColor) => E.Either<PostEventError | UnknownThemeParamsKeyError, void>,\n true\n >;\n\n /**\n * @see setBottomBarColorFp\n */\n readonly setBottomBarColor: WithChecks<(color: AnyColor) => void, true>;\n //#endregion\n\n //#region Other methods.\n /**\n * Closes the Mini App.\n * @param returnBack - should the client return to the previous activity.\n */\n readonly closeFp: WithChecksFp<(returnBack?: boolean) => E.Either<PostEventError, void>, false>;\n\n /**\n * @see closeFp\n */\n readonly close: WithChecks<(returnBack?: boolean) => void, false>;\n\n /**\n * Informs the Telegram app that the Mini App is ready to be displayed.\n *\n * It is recommended to call this method as early as possible, as soon as all\n * essential interface elements loaded.\n *\n * Once this method is called, the loading placeholder is hidden and the Mini\n * App shown.\n *\n * If the method is not called, the placeholder will be hidden only when the\n * page was fully loaded.\n */\n readonly readyFp: WithChecksFp<() => E.Either<PostEventError, void>, false>;\n\n /**\n * @see readyFp\n */\n readonly ready: WithChecks<() => void, false>;\n //#endregion\n}\n","import { on, off } from '@vbotma/bridge';\nimport { function as fn } from 'fp-ts';\n\nimport { MiniApp, type MiniAppState } from '@/features/MiniApp/MiniApp.js';\nimport { themeParams } from '@/features/ThemeParams/instance.js';\nimport { sharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\nimport { withPostEvent } from '@/fn-options/withPostEvent.js';\nimport { withStateRestore } from '@/fn-options/withStateRestore.js';\nimport { withVersion } from '@/fn-options/withVersion.js';\n\nfunction instantiate() {\n return new MiniApp({\n ...fn.pipe(\n sharedFeatureOptions(),\n withPostEvent,\n withVersion,\n withStateRestore<MiniAppState>('miniApp'),\n ),\n offVisibilityChanged(listener) {\n off('visibility_changed', listener);\n },\n onVisibilityChanged(listener) {\n on('visibility_changed', listener);\n },\n theme: themeParams.state,\n });\n}\n\nexport const miniApp = /* @__PURE__*/ instantiate();\n","import { postEventFp, type UnknownEnvError } from '@vbotma/bridge';\r\nimport type { BetterPromise } from 'better-promises';\r\nimport { taskEither as TE, function as fn } from 'fp-ts';\r\n\r\nimport type { NotificationOptions, SendNotificationOptions } from '@/features/Notification/types.js';\r\n\r\n/**\r\n * Generates a unique notification ID using timestamp and random string.\r\n */\r\nfunction generateNotificationId(): string {\r\n const timestamp = Date.now();\r\n const random = Math.random().toString(36).substring(2, 9);\r\n return `notif_${timestamp}_${random}`;\r\n}\r\n\r\n/**\r\n * Notification feature class.\r\n * @since v9.2\r\n */\r\nexport class Notification {\r\n constructor({ }: NotificationOptions) {\r\n this.sendFp = (options: SendNotificationOptions): TE.TaskEither<UnknownEnvError, void> => {\r\n return fn.pipe(\r\n TE.fromEither(\r\n postEventFp('web_app_send_notification', {\r\n id: generateNotificationId(),\r\n message: options.message,\r\n title: options.title,\r\n type: options.type ?? 'default',\r\n })\r\n ),\r\n TE.map(() => undefined)\r\n );\r\n };\r\n\r\n this.send = (options: SendNotificationOptions): BetterPromise<void> => {\r\n const task = this.sendFp(options);\r\n return (task() as Promise<any>).then(result => {\r\n if (result._tag === 'Left') {\r\n throw result.left;\r\n }\r\n return result.right;\r\n }) as BetterPromise<void>;\r\n };\r\n }\r\n\r\n /**\r\n * Sends a notification to the native app.\r\n * @param options - notification options including message, optional title, and optional type (defaults to 'default')\r\n * @since v9.2\r\n */\r\n readonly sendFp: (options: SendNotificationOptions) => TE.TaskEither<UnknownEnvError, void>;\r\n\r\n /**\r\n * @see sendFp\r\n */\r\n readonly send: (options: SendNotificationOptions) => BetterPromise<void>;\r\n}\r\n","import { function as fn } from 'fp-ts';\r\n\r\nimport { Notification } from '@/features/Notification/Notification.js';\r\nimport { sharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\r\n\r\nfunction instantiate() {\r\n return new Notification(fn.pipe(sharedFeatureOptions()));\r\n}\r\n\r\nexport const notification = /* @__PURE__*/ instantiate();\r\n","import type { PopupParams, PopupButton } from '@vbotma/bridge';\nimport { either as E } from 'fp-ts';\n\nimport { InvalidArgumentsError } from '@/errors.js';\nimport type { ShowOptions } from '@/features/Popup/types.js';\n\n/**\n * Prepares popup parameters before sending them to native app.\n * @param params - popup parameters.\n */\nexport function prepareParams(params: ShowOptions): E.Either<InvalidArgumentsError, PopupParams> {\n const message = params.message.trim();\n const title = (params.title || '').trim();\n const paramsButtons = params.buttons || [];\n\n if (title.length > 64) {\n return E.left(new InvalidArgumentsError(`Invalid title: ${title}`));\n }\n if (!message || message.length > 256) {\n return E.left(new InvalidArgumentsError(`Invalid message: ${message}`));\n }\n if (paramsButtons.length > 3) {\n return E.left(new InvalidArgumentsError(`Invalid buttons count: ${paramsButtons.length}`));\n }\n\n const buttons: PopupButton[] = [];\n if (!paramsButtons.length) {\n buttons.push({ type: 'close', id: '' });\n } else {\n for (let i = 0; i < paramsButtons.length; i++) {\n const button = paramsButtons[i];\n const id = button.id || '';\n if (id.length > 64) {\n return E.left(new InvalidArgumentsError(`Button with index ${i} has invalid id: ${id}`));\n }\n\n if (!button.type || button.type === 'default' || button.type === 'destructive') {\n const text = button.text.trim();\n if (!text || text.length > 64) {\n return E.left(new InvalidArgumentsError(`Button with index ${i} has invalid text: ${text}`));\n }\n buttons.push({ type: button.type, text, id });\n } else {\n buttons.push({ type: button.type, id });\n }\n }\n }\n\n return E.right({ title, message, buttons });\n}\n","import type { RequestError } from '@vbotma/bridge';\nimport { type Computed, signal, computed } from '@vbotma/signals';\nimport type { BetterPromise } from 'better-promises';\nimport { taskEither as TE, function as fn } from 'fp-ts';\n\nimport { ConcurrentCallError, type InvalidArgumentsError } from '@/errors.js';\nimport { prepareParams } from '@/features/Popup/prepareParams.js';\nimport type { ShowOptions } from '@/features/Popup/types.js';\nimport type { SharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\nimport type { WithRequest } from '@/fn-options/withRequest.js';\nimport type { WithVersion } from '@/fn-options/withVersion.js';\nimport { createIsSupportedSignal } from '@/helpers/createIsSupportedSignal.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport { createWithChecksFp, type WithChecksFp, type WithChecks } from '@/with-checks/withChecksFp.js';\n\nexport interface PopupOptions extends SharedFeatureOptions, WithVersion, WithRequest {\n}\n\n/**\n * @since Mini Apps v6.2\n */\nexport class Popup {\n constructor({ version, isTma, request }: PopupOptions) {\n const isOpened = signal(false);\n const toggleClosed = () => {\n isOpened.set(false);\n };\n\n const wrapSupportedTask = createWithChecksFp({\n version,\n isTma,\n requires: 'web_app_open_popup',\n returns: 'task',\n });\n\n this.isSupported = createIsSupportedSignal('web_app_open_popup', version);\n this.isOpened = computed(isOpened);\n this.showFp = wrapSupportedTask(options => {\n return fn.pipe(\n this.isOpened()\n ? TE.left(new ConcurrentCallError('A popup is already opened'))\n : TE.right(undefined as never),\n TE.chainW(() => TE.fromEither(prepareParams(options))),\n TE.chain(preparedOptions => {\n isOpened.set(true);\n return request('web_app_open_popup', 'popup_closed', {\n ...options,\n params: preparedOptions,\n });\n }),\n TE.mapBoth(\n err => {\n toggleClosed();\n return err;\n },\n response => {\n toggleClosed();\n return response.button_id;\n },\n ),\n );\n });\n this.show = throwifyWithChecksFp(this.showFp);\n }\n\n /**\n * Signal indicating if any popup is currently opened.\n */\n readonly isOpened: Computed<boolean>;\n\n /**\n * Signal indicating if the component is supported.\n */\n readonly isSupported: Computed<boolean>;\n\n /**\n * A method that shows a native popup described by the `params` argument.\n * The promise will be resolved when the popup is closed. Resolved value will have\n * an identifier of the pressed button.\n *\n * If a user clicked outside the popup or clicked the top right popup close\n * button, null will be resolved.\n *\n * @param options - popup parameters.\n * @since Mini Apps v6.2\n * @example\n * fn.pipe(\n * popup.showFp({\n * title: 'Confirm action',\n * message: 'Do you really want to buy this burger?',\n * buttons: [\n * { id: 'yes', text: 'Yes' },\n * { id: 'no', type: 'destructive', text: 'No' },\n * ],\n * }),\n * TE.map(buttonId => {\n * console.log('User clicked a button with ID', buttonId);\n * }),\n * );\n */\n readonly showFp: WithChecksFp<\n (options: ShowOptions) => TE.TaskEither<\n RequestError | InvalidArgumentsError | ConcurrentCallError,\n string | undefined\n >,\n true\n >;\n\n /**\n * @see showFp\n */\n readonly show: WithChecks<(options: ShowOptions) => BetterPromise<string | undefined>, true>;\n}\n","import { function as fn } from 'fp-ts';\n\nimport { Popup } from '@/features/Popup/Popup.js';\nimport { sharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\nimport { withRequest } from '@/fn-options/withRequest.js';\nimport { withVersion } from '@/fn-options/withVersion.js';\n\nfunction instantiate() {\n return new Popup(fn.pipe(sharedFeatureOptions(), withRequest, withVersion));\n}\n\nexport const popup = /* @__PURE__*/ instantiate();\n","import type { PhoneRequestedStatus, RequestError } from '@vbotma/bridge';\nimport { taskEither as TE, function as fn } from 'fp-ts';\n\nimport {\n sharedFeatureOptions,\n type SharedFeatureOptions,\n} from '@/fn-options/sharedFeatureOptions.js';\nimport { withRequest, type WithRequest } from '@/fn-options/withRequest.js';\nimport { withVersion, type WithVersion } from '@/fn-options/withVersion.js';\nimport type { AsyncOptions } from '@/types.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport { withChecksFp } from '@/with-checks/withChecksFp.js';\n\ninterface CreateOptions extends SharedFeatureOptions, WithRequest, WithVersion {\n}\n\nexport type RequestPhoneAccessError = RequestError;\n\nfunction create({ request, ...rest }: CreateOptions) {\n return withChecksFp((\n options?: AsyncOptions,\n ): TE.TaskEither<RequestPhoneAccessError, PhoneRequestedStatus> => {\n return fn.pipe(\n request('web_app_request_phone', 'phone_requested', options),\n TE.map(response => response.status),\n );\n }, { ...rest, requires: 'web_app_request_phone', returns: 'task' });\n}\n\n// #__NO_SIDE_EFFECTS__\nfunction instantiate() {\n return create(fn.pipe(\n sharedFeatureOptions(),\n withVersion,\n withRequest,\n ));\n}\n\n/**\n * Requests current user phone access. Method returns promise, which resolves\n * status of the request. In case, user accepted the request, Mini App bot will receive\n * the according notification.\n *\n * To obtain the retrieved information instead, utilize the `requestContact` method.\n * @param options - additional options.\n * @since Mini Apps v6.9\n * @see requestContact\n */\nexport const requestPhoneAccessFp = instantiate();\n\n/**\n * @see requestPhoneAccessFp\n */\nexport const requestPhoneAccess = throwifyWithChecksFp(requestPhoneAccessFp);\n","import { PhoneRequestedStatus } from '@vbotma/bridge';\nimport { BetterTaskEither, type BetterTaskEitherError } from '@vbotma/toolkit';\nimport { pipeJsonToSchema, pipeQueryToSchema } from '@vbotma/transformers';\nimport { either as E, taskEither as TE, function as fn } from 'fp-ts';\nimport {\n safeParse,\n pipe as valiPipe,\n date,\n looseObject,\n number,\n optional,\n string,\n transform,\n} from 'valibot';\n\nimport { AccessDeniedError, ValidationError } from '@/errors.js';\nimport {\n sharedFeatureOptions,\n type SharedFeatureOptions,\n} from '@/fn-options/sharedFeatureOptions.js';\n\nimport {\n withInvokeCustomMethod,\n type WithInvokeCustomMethod,\n InvokeCustomMethodError,\n} from '@/fn-options/withInvokeCustomMethod.js';\n\nimport { withVersion, type WithVersion } from '@/fn-options/withVersion.js';\nimport type { AsyncOptions } from '@/types.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\n\nimport { withChecksFp } from '@/with-checks/withChecksFp.js';\n\nimport { type RequestPhoneAccessError, requestPhoneAccessFp } from './requestPhoneAccess.js';\n\n/**\n * Requested contact information.\n */\nexport interface RequestedContact {\n contact: {\n user_id: number;\n phone_number: string;\n first_name: string;\n last_name?: string;\n [key: string]: unknown;\n };\n auth_date: Date;\n hash: string;\n [key: string]: unknown;\n}\n\n/**\n * Requested contact complete data.\n */\nexport interface RequestedContactCompleteData {\n /**\n * Raw original representation of the contact data returned from the Telegram server.\n */\n raw: string;\n /**\n * Parsed representation of the contact data.\n */\n parsed: RequestedContact;\n}\n\ninterface CreateCompleteOptions extends SharedFeatureOptions, WithInvokeCustomMethod, WithVersion {\n requestPhoneAccess: (options?: AsyncOptions) => (\n TE.TaskEither<RequestPhoneAccessError, PhoneRequestedStatus>\n );\n}\n\ninterface CreateParsedOptions extends SharedFeatureOptions, WithVersion {\n requestContact: (options?: AsyncOptions) => TE.TaskEither<RequestContactError, RequestedContact>;\n}\n\nexport type RequestContactError =\n | InvokeCustomMethodError\n | AccessDeniedError\n | ValidationError\n | BetterTaskEitherError;\n\nfunction createComplete({\n invokeCustomMethod,\n requestPhoneAccess,\n ...rest\n}: CreateCompleteOptions) {\n type GetRequestedContactError = InvokeCustomMethodError | ValidationError;\n\n // Attempts to get previously requested contact.\n const getContact = (\n options?: AsyncOptions,\n ): TE.TaskEither<GetRequestedContactError, RequestedContactCompleteData | undefined> => {\n return fn.pipe(\n invokeCustomMethod('getRequestedContact', {}, {\n ...options,\n timeout: (options || {}).timeout || 5000,\n }),\n TE.chainW(response => {\n const toStringResult = safeParse(string(), response);\n if (!toStringResult.success) {\n return TE.left(new ValidationError(response, toStringResult.issues));\n }\n\n if (!toStringResult.output) {\n return TE.right(undefined);\n }\n\n const toParsedResult = safeParse(\n pipeQueryToSchema(\n looseObject({\n contact: pipeJsonToSchema(looseObject({\n user_id: number(),\n phone_number: string(),\n first_name: string(),\n last_name: optional(string()),\n })),\n auth_date: valiPipe(\n string(),\n transform(input => new Date(Number(input) * 1000)),\n date(),\n ),\n hash: string(),\n }),\n ),\n toStringResult.output,\n );\n return toParsedResult.success\n ? TE.right({ raw: toStringResult.output, parsed: toParsedResult.output })\n : TE.left(new ValidationError(toStringResult.output, toParsedResult.issues));\n }),\n );\n };\n\n // Attempts to get previously requested contact, but ignores all errors except validation error.\n const getContactWithErrorsIgnore = (\n options?: AsyncOptions,\n ): TE.TaskEither<ValidationError, RequestedContactCompleteData | undefined> => {\n return fn.pipe(\n getContact(options),\n TE.match(\n // All other errors except validation ones should be ignored. Receiving validation error\n // means that we have some data, but we are unable to parse it properly. So, there is no\n // need to make some more requests further, the problem is local.\n error => (ValidationError.is(error) ? E.left(error) : E.right(undefined)),\n contact => E.right(contact),\n ),\n );\n };\n\n // Polls previously requested contact with increasing timeout between requests.\n const pollContact = (ctx: {\n isRejected: boolean;\n rejectReason: unknown;\n abortSignal: AbortSignal;\n }): TE.TaskEither<BetterTaskEitherError | ValidationError, RequestedContactCompleteData> => {\n return BetterTaskEither<ValidationError, RequestedContactCompleteData>(\n async (res, rej, context) => {\n // Time to wait before executing the next request.\n let sleepTime = 50;\n\n // We are trying to retrieve the requested contact until the deadline was reached.\n while (!context.isRejected) {\n const result = await getContactWithErrorsIgnore(context)();\n if (result._tag === 'Left') {\n return rej(result.left);\n }\n if (result.right) {\n return res(result.right);\n }\n await new Promise(resolve => setTimeout(resolve, sleepTime));\n sleepTime += 50;\n }\n },\n ctx,\n );\n };\n\n return withChecksFp((\n options?: AsyncOptions,\n ): TE.TaskEither<RequestContactError, RequestedContactCompleteData> => {\n return BetterTaskEither.fn(context => {\n return fn.pipe(\n // Try to get the requested contact. Probably, we already requested it before.\n getContactWithErrorsIgnore(context),\n TE.chain(contact => {\n if (contact) {\n return TE.right(contact);\n }\n return fn.pipe(\n requestPhoneAccess(context),\n TE.chainW(status => {\n return status === 'sent'\n ? pollContact(context)\n : TE.left(new AccessDeniedError('User denied access'));\n }),\n );\n }),\n );\n }, options);\n }, { ...rest, returns: 'task', requires: 'web_app_request_phone' });\n}\n\n// #__NO_SIDE_EFFECTS__\nfunction instantiateComplete() {\n return createComplete({\n ...fn.pipe(sharedFeatureOptions(), withInvokeCustomMethod, withVersion),\n requestPhoneAccess: requestPhoneAccessFp,\n });\n}\n\nfunction createParsed({ requestContact, ...rest }: CreateParsedOptions) {\n return withChecksFp(\n requestContact,\n { ...rest, returns: 'task', requires: 'web_app_request_phone' },\n );\n}\n\n// #__NO_SIDE_EFFECTS__\nfunction instantiateParsed() {\n return createParsed({\n ...fn.pipe(sharedFeatureOptions(), withVersion),\n requestContact(options) {\n return fn.pipe(\n requestContactCompleteFp(options),\n TE.map(contact => contact.parsed),\n );\n },\n });\n}\n\n/**\n * Requests current user contact information.\n *\n * This function returns an object, containing both raw and parsed representations of a response,\n * received from the VBot client.\n * @param options - additional options.\n * @since Mini Apps v6.9\n */\nexport const requestContactCompleteFp = instantiateComplete();\n\n/**\n * @see requestContactCompleteFp\n */\nexport const requestContactComplete = throwifyWithChecksFp(requestContactCompleteFp);\n\n/**\n * Works the same way as the `requestContactCompleteFp` function, but returns only parsed\n * representation of the contact data.\n * @see requestContactCompleteFp\n * @param options - additional options.\n * @since Mini Apps v6.9\n */\nexport const requestContactFp = instantiateParsed();\n\n/**\n * @see requestContactFp\n */\nexport const requestContact = throwifyWithChecksFp(requestContactFp);\n","import type { WriteAccessRequestedStatus, RequestError } from '@vbotma/bridge';\nimport { taskEither as TE, function as fn } from 'fp-ts';\n\nimport {\n sharedFeatureOptions,\n type SharedFeatureOptions,\n} from '@/fn-options/sharedFeatureOptions.js';\nimport { withRequest, type WithRequest } from '@/fn-options/withRequest.js';\nimport { withVersion, type WithVersion } from '@/fn-options/withVersion.js';\nimport type { AsyncOptions } from '@/types.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport { withChecksFp } from '@/with-checks/withChecksFp.js';\n\ninterface CreateOptions extends SharedFeatureOptions, WithRequest, WithVersion {\n}\n\nexport type RequestWriteAccessError = RequestError;\n\nfunction create({ request, ...rest }: CreateOptions) {\n return withChecksFp((\n options?: AsyncOptions,\n ): TE.TaskEither<RequestWriteAccessError, WriteAccessRequestedStatus> => {\n return fn.pipe(\n request('web_app_request_write_access', 'write_access_requested', options),\n TE.map(response => response.status),\n );\n }, { ...rest, requires: 'web_app_request_write_access', returns: 'task' });\n}\n\n// #__NO_SIDE_EFFECTS__\nfunction instantiate() {\n return create(fn.pipe(\n sharedFeatureOptions(),\n withVersion,\n withRequest,\n ));\n}\n\n/**\n * Requests write message access to the current user.\n * @param options - additional options.\n * @since Mini Apps v6.9\n */\nexport const requestWriteAccessFp = instantiate();\n\n/**\n * @see requestWriteAccessFp\n */\nexport const requestWriteAccess = throwifyWithChecksFp(requestWriteAccessFp);\n","import type { PostEventError } from '@vbotma/bridge';\nimport { computed, type Computed, signal } from '@vbotma/signals';\nimport { createCbCollector, BetterTaskEither, type BetterTaskEitherError } from '@vbotma/toolkit';\nimport { BetterPromise } from 'better-promises';\nimport { either as E, taskEither as TE, function as fn } from 'fp-ts';\n\nimport { ConcurrentCallError } from '@/errors.js';\nimport type { SharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\nimport type { WithPostEvent } from '@/fn-options/withPostEvent.js';\nimport type { WithVersion } from '@/fn-options/withVersion.js';\nimport { createIsSupportedSignal } from '@/helpers/createIsSupportedSignal.js';\nimport type { AsyncOptions } from '@/types.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport {\n createWithChecksFp,\n type WithChecks,\n type WithChecksFp,\n} from '@/with-checks/withChecksFp.js';\n\nexport interface QrScannerOptions extends WithVersion, WithPostEvent, SharedFeatureOptions {\n /**\n * A function to add a listener to the event determining if the QR scanner\n * was closed.\n * @param listener - a listener to add.\n * @returns A function to remove the listener.\n */\n onClosed: (listener: VoidFunction) => VoidFunction;\n /**\n * A function to add a listener to the event containing a scanned QR content.\n * @param listener - a listener to add.\n * @returns A function to remove the listener.\n */\n onTextReceived: (listener: (data: string) => void) => VoidFunction;\n}\n\ninterface SharedOptions extends AsyncOptions {\n /**\n * Title to be displayed in the scanner.\n */\n text?: string;\n}\n\ninterface CaptureOptions extends SharedOptions {\n /**\n * @returns True if the passed QR code should be captured.\n * @param qr - scanned QR content.\n */\n capture: (qr: string) => boolean;\n}\n\ninterface OpenOptions extends SharedOptions {\n /**\n * Function which will be called if a QR code was scanned.\n * @param qr - scanned QR content.\n */\n onCaptured: (qr: string) => void;\n}\n\n/**\n * @since Mini Apps v6.4\n */\nexport class QrScanner {\n constructor({\n version,\n onClosed,\n onTextReceived,\n isTma,\n postEvent,\n }: QrScannerOptions) {\n const wrapOptions = { version, requires: 'web_app_open_scan_qr_popup', isTma } as const;\n const wrapSupportedEither = createWithChecksFp({ ...wrapOptions, returns: 'either' });\n const wrapSupportedTask = createWithChecksFp({ ...wrapOptions, returns: 'task' });\n\n const isOpened = signal(false);\n const setClosed = () => {\n isOpened.set(false);\n };\n\n this.isSupported = createIsSupportedSignal('web_app_open_scan_qr_popup', version);\n this.isOpened = computed(isOpened);\n\n this.captureFp = wrapSupportedTask(options => {\n let captured: string | undefined;\n return fn.pipe(\n this.openFp({\n ...options,\n onCaptured: qr => {\n if (options.capture(qr)) {\n captured = qr;\n this.close();\n }\n },\n }),\n TE.map(() => captured),\n );\n });\n this.closeFp = wrapSupportedEither(() => {\n return fn.pipe(postEvent('web_app_close_scan_qr_popup'), E.map(setClosed));\n });\n this.openFp = wrapSupportedTask(options => {\n return fn.pipe(\n isOpened()\n ? TE.left(new ConcurrentCallError('The QR Scanner is already opened'))\n : async () => postEvent('web_app_open_scan_qr_popup', { text: options.text }),\n TE.chainW(() => {\n isOpened.set(true);\n const [addToCleanup, cleanup] = createCbCollector();\n const onSettled = <T>(value: T): T => {\n cleanup();\n isOpened.set(false);\n return value;\n };\n\n return fn.pipe(\n BetterTaskEither<never, void>(resolve => {\n addToCleanup(\n // The scanner was closed externally.\n onClosed(resolve),\n // The scanner was closed internally.\n isOpened.sub(isOpenedValue => {\n if (!isOpenedValue) {\n resolve();\n }\n }),\n onTextReceived(options.onCaptured),\n );\n }, options),\n TE.mapBoth(onSettled, onSettled),\n );\n }),\n );\n });\n\n this.open = throwifyWithChecksFp(this.openFp);\n this.capture = throwifyWithChecksFp(this.captureFp);\n this.close = throwifyWithChecksFp(this.closeFp);\n }\n\n /**\n * Signal indicating if the scanner is currently opened.\n */\n readonly isOpened: Computed<boolean>;\n\n /**\n * Signal indicating if the component is supported.\n */\n readonly isSupported: Computed<boolean>;\n\n /**\n * Opens the scanner and returns a task which will be completed with the QR content if the\n * passed `capture` function returned true.\n *\n * Task may also be completed with undefined if the scanner was closed.\n * @param options - method options.\n * @returns A promise with QR content presented as string or undefined if the scanner was closed.\n * @since Mini Apps v6.4\n * @example\n * fn.pipe(\n * qrScanner.captureFp({\n * capture(scannedQr) {\n * return scannedQr === 'any expected by me qr';\n * }\n * }),\n * TE.match(\n * error => {\n * console.error(error);\n * },\n * qr => {\n * console.log('My QR:'), qr;\n * }\n * ),\n * );\n */\n readonly captureFp: WithChecksFp<\n (options: CaptureOptions) => (\n TE.TaskEither<PostEventError | BetterTaskEitherError, string | undefined>\n ),\n true\n >;\n\n /**\n * @see captureFp\n */\n readonly capture: WithChecks<\n (options: CaptureOptions) => BetterPromise<string | undefined>,\n true\n >;\n\n /**\n * Closes the scanner.\n * @since Mini Apps v6.4\n */\n readonly closeFp: WithChecksFp<() => E.Either<PostEventError, void>, true>;\n\n /**\n * @see close\n */\n readonly close: WithChecks<() => void, true>;\n\n /**\n * Opens the scanner and returns a task which will be completed when the scanner was closed.\n * @param options - method options.\n * @since Mini Apps v6.4\n * @example Without `capture` option\n * if (qrScanner.open.isAvailable()) {\n * const qr = await qrScanner.open({ text: 'Scan any QR' });\n * }\n * @example\n * fn.pipe(\n * qrScanner.openFp({\n * onCaptured(scannedQr) {\n * if (scannedQr === 'any expected by me qr') {\n * qrScanner.close();\n * }\n * }\n * }),\n * TE.match(\n * error => {\n * console.error(error);\n * },\n * () => {\n * console.log('The scanner was closed');\n * }\n * ),\n * );\n */\n readonly openFp: WithChecksFp<\n (options: OpenOptions) => TE.TaskEither<PostEventError, void>,\n true\n >;\n\n /**\n * @see openFp\n */\n readonly open: WithChecks<(options: OpenOptions) => BetterPromise<void>, true>;\n}\n","import { on } from '@vbotma/bridge';\nimport { function as fn } from 'fp-ts';\n\nimport { QrScanner } from '@/features/QrScanner/QrScanner.js';\nimport { sharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\nimport { withPostEvent } from '@/fn-options/withPostEvent.js';\nimport { withVersion } from '@/fn-options/withVersion.js';\n\nfunction instantiate() {\n return new QrScanner({\n ...fn.pipe(sharedFeatureOptions(), withPostEvent, withVersion),\n onClosed(listener) {\n return on('scan_qr_popup_closed', listener);\n },\n onTextReceived(listener) {\n return on('qr_text_received', event => {\n listener(event.data);\n });\n },\n });\n}\n\nexport const qrScanner = /* @__PURE__*/ instantiate();\n","import { on, postEventFp, type UnknownEnvError, type EventListener } from '@vbotma/bridge';\r\nimport { signal, type Computed, computed } from '@vbotma/signals';\r\nimport type { BetterPromise } from 'better-promises';\r\nimport { taskEither as TE, function as fn } from 'fp-ts';\r\n\r\nimport type { RefreshOptions, RefreshRequestListener } from '@/features/Refresh/types.js';\r\n\r\n/**\r\n * Refresh feature class.\r\n * @since v9.2\r\n */\r\nexport class Refresh {\r\n constructor({ }: RefreshOptions) {\r\n const isRefreshing = signal(false);\r\n\r\n // Listen to refresh_requested event from native\r\n on('refresh_requested', () => {\r\n isRefreshing.set(true);\r\n });\r\n\r\n this.isRefreshing = computed(isRefreshing);\r\n\r\n this.finishRefreshFp = (): TE.TaskEither<UnknownEnvError, void> => {\r\n return fn.pipe(\r\n TE.fromEither(postEventFp('web_app_finish_refresh', {\r\n isRefreshed: true,\r\n })),\r\n TE.map(() => {\r\n isRefreshing.set(false);\r\n return undefined;\r\n })\r\n );\r\n };\r\n\r\n this.finishRefresh = (): BetterPromise<void> => {\r\n const task = this.finishRefreshFp();\r\n return (task() as Promise<any>).then(result => {\r\n if (result._tag === 'Left') {\r\n throw result.left;\r\n }\r\n return result.right;\r\n }) as BetterPromise<void>;\r\n };\r\n\r\n this.onRefreshRequest = (listener: RefreshRequestListener) => {\r\n const eventListener: EventListener<'refresh_requested'> = () => {\r\n listener();\r\n };\r\n return on('refresh_requested', eventListener);\r\n };\r\n }\r\n\r\n /**\r\n * Signal indicating if refresh is currently in progress.\r\n */\r\n readonly isRefreshing: Computed<boolean>;\r\n\r\n /**\r\n * Notifies native app that refresh has completed.\r\n * @since v9.2\r\n */\r\n readonly finishRefreshFp: () => TE.TaskEither<UnknownEnvError, void>;\r\n\r\n /**\r\n * @see finishRefreshFp\r\n */\r\n readonly finishRefresh: () => BetterPromise<void>;\r\n\r\n /**\r\n * Subscribes to refresh request events from native app.\r\n * @param listener - callback function to execute when refresh is requested\r\n * @returns unsubscribe function\r\n * @since v9.2\r\n * @example\r\n * const unsubscribe = refresh.onRefreshRequest(() => {\r\n * // Fetch new data\r\n * fetchData().then(() => {\r\n * refresh.finishRefresh();\r\n * });\r\n * });\r\n */\r\n readonly onRefreshRequest: (listener: RefreshRequestListener) => VoidFunction;\r\n}\r\n","import { function as fn } from 'fp-ts';\r\n\r\nimport { Refresh } from '@/features/Refresh/Refresh.js';\r\nimport { sharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\r\n\r\nfunction instantiate() {\r\n return new Refresh(fn.pipe(sharedFeatureOptions()));\r\n}\r\n\r\nexport const refresh = /* @__PURE__*/ instantiate();\r\n","import type { PostEventError, SecondaryButtonPosition } from '@vbotma/bridge';\nimport { computed, type Computed } from '@vbotma/signals';\nimport type { RGB } from '@vbotma/types';\nimport { either as E } from 'fp-ts';\n\nimport { Button, type ButtonOptions } from '@/composables/Button.js';\nimport { access } from '@/helpers/access.js';\nimport { createIsSupportedSignal } from '@/helpers/createIsSupportedSignal.js';\nimport type { MaybeAccessor } from '@/types.js';\nimport type { WithChecks, WithChecksFp } from '@/with-checks/withChecksFp.js';\n\ntype SecondaryButtonEither = E.Either<PostEventError, void>;\n\nexport interface SecondaryButtonState {\n isVisible: boolean;\n bgColor?: RGB;\n hasShineEffect: boolean;\n isEnabled: boolean;\n isLoaderVisible: boolean;\n text: string;\n textColor?: RGB;\n position: SecondaryButtonPosition;\n}\n\nexport interface SecondaryButtonOptions extends Omit<\n ButtonOptions<SecondaryButtonState, 'web_app_setup_secondary_button'>,\n 'initialState' | 'method' | 'payload'\n> {\n /**\n * Default values for different kinds of the button properties.\n */\n defaults: {\n bgColor: MaybeAccessor<RGB>;\n textColor: MaybeAccessor<RGB>;\n };\n}\n\n/**\n * @since Mini Apps v7.10\n */\nexport class SecondaryButton {\n constructor({ defaults, ...options }: SecondaryButtonOptions) {\n const button = new Button({\n ...options,\n initialState: {\n hasShineEffect: false,\n isEnabled: true,\n isLoaderVisible: false,\n isVisible: false,\n text: 'Cancel',\n position: 'left',\n },\n method: 'web_app_setup_secondary_button',\n payload: state => ({\n has_shine_effect: state.hasShineEffect,\n is_visible: state.isVisible,\n is_active: state.isEnabled,\n is_progress_visible: state.isLoaderVisible,\n text: state.text,\n color: state.bgColor,\n text_color: state.textColor,\n position: state.position,\n }),\n });\n\n const withDefault = (\n field: 'bgColor' | 'textColor',\n getDefault: MaybeAccessor<RGB>,\n ) => {\n const fromState = button.stateGetter(field);\n return computed(() => fromState() || access(getDefault));\n };\n\n this.isSupported = createIsSupportedSignal('web_app_setup_secondary_button', options.version);\n this.bgColor = withDefault('bgColor', defaults.bgColor);\n this.textColor = withDefault('textColor', defaults.textColor);\n this.position = button.stateGetter('position');\n this.hasShineEffect = button.stateGetter('hasShineEffect');\n this.isEnabled = button.stateGetter('isEnabled');\n this.isLoaderVisible = button.stateGetter('isLoaderVisible');\n this.text = button.stateGetter('text');\n this.isVisible = button.stateGetter('isVisible');\n this.isMounted = button.isMounted;\n this.state = button.state;\n\n [this.setPosition, this.setPositionFp] = button.stateSetters('position');\n [this.setBgColor, this.setBgColorFp] = button.stateSetters('bgColor');\n [this.setTextColor, this.setTextColorFp] = button.stateSetters('textColor');\n [\n [this.disableShineEffect, this.disableShineEffectFp],\n [this.enableShineEffect, this.enableShineEffectFp],\n ] = button.stateBoolSetters('hasShineEffect');\n [\n [this.disable, this.disableFp],\n [this.enable, this.enableFp],\n ] = button.stateBoolSetters('isEnabled');\n [\n [this.hideLoader, this.hideLoaderFp],\n [this.showLoader, this.showLoaderFp],\n ] = button.stateBoolSetters('isLoaderVisible');\n\n [this.setText, this.setTextFp] = button.stateSetters('text');\n [[this.hide, this.hideFp], [this.show, this.showFp]] = button.stateBoolSetters('isVisible');\n this.setParams = button.setState;\n this.setParamsFp = button.setStateFp;\n this.onClick = button.onClick;\n this.onClickFp = button.onClickFp;\n this.offClick = button.offClick;\n this.offClickFp = button.offClickFp;\n this.mount = button.mount;\n this.mountFp = button.mountFp;\n this.unmount = button.unmount;\n }\n\n //#region Properties.\n /**\n * Signal indicating if the component is supported.\n */\n readonly isSupported: Computed<boolean>;\n\n /**\n * The button position relative to the main one.\n */\n readonly position: Computed<SecondaryButtonPosition>;\n\n /**\n * The button background color.\n */\n readonly bgColor: Computed<RGB>;\n\n /**\n * True if the button has a shining effect.\n */\n readonly hasShineEffect: Computed<boolean>;\n\n /**\n * True if the button is clickable.\n */\n readonly isEnabled: Computed<boolean>;\n\n /**\n * True if the button loader is visible.\n */\n readonly isLoaderVisible: Computed<boolean>;\n\n /**\n * True if the button is visible.\n */\n readonly isVisible: Computed<boolean>;\n\n /**\n * Signal indicating if the component is currently mounted.\n */\n readonly isMounted: Computed<boolean>;\n\n /**\n * The complete button state.\n */\n readonly state: Computed<SecondaryButtonState>;\n\n /**\n * The button displayed text.\n */\n readonly text: Computed<string>;\n\n /**\n * The button text color.\n *\n * Note that this value is computed based on the external defaults. For\n * example, if not explicitly set, this value may be equal to one of theme\n * params colors.\n */\n readonly textColor: Computed<RGB>;\n //#endregion\n\n //#region Methods.\n /**\n * Shows the button.\n * @since Mini Apps v7.10\n */\n readonly showFp: WithChecksFp<() => SecondaryButtonEither, true>;\n\n /**\n * @see showFp\n */\n readonly show: WithChecks<() => void, true>;\n\n /**\n * Hides the button.\n * @since Mini Apps v7.10\n */\n readonly hideFp: WithChecksFp<() => SecondaryButtonEither, true>;\n\n /**\n * @see hideFp\n */\n readonly hide: WithChecks<() => void, true>;\n\n /**\n * Enables the button.\n * @since Mini Apps v7.10\n */\n readonly enableFp: WithChecksFp<() => SecondaryButtonEither, true>;\n\n /**\n * @see enableFp\n */\n readonly enable: WithChecks<() => void, true>;\n\n /**\n * Enables the button.\n * @since Mini Apps v7.10\n */\n readonly enableShineEffectFp: WithChecksFp<() => SecondaryButtonEither, true>;\n\n /**\n * @see enableShineEffectFp\n */\n readonly enableShineEffect: WithChecks<() => void, true>;\n\n /**\n * Disables the button.\n * @since Mini Apps v7.10\n */\n readonly disableFp: WithChecksFp<() => SecondaryButtonEither, true>;\n\n /**\n * @see disableFp\n */\n readonly disable: WithChecks<() => void, true>;\n\n /**\n * Enables the button.\n * @since Mini Apps v7.10\n */\n readonly disableShineEffectFp: WithChecksFp<() => SecondaryButtonEither, true>;\n\n /**\n * @see disableShineEffectFp\n */\n readonly disableShineEffect: WithChecks<() => void, true>;\n\n /**\n * Updates the button background color.\n * @since Mini Apps v7.10\n */\n readonly setBgColorFp: WithChecksFp<(value: RGB) => SecondaryButtonEither, true>;\n\n /**\n * @see setBgColorFp\n */\n readonly setBgColor: WithChecks<(value: RGB) => void, true>;\n\n /**\n * Updates the button text color.\n * @since Mini Apps v7.10\n */\n readonly setTextColorFp: WithChecksFp<(value: RGB) => SecondaryButtonEither, true>;\n\n /**\n * @see setTextColorFp\n */\n readonly setTextColor: WithChecks<(value: RGB) => void, true>;\n\n /**\n * Updates the button text.\n * @since Mini Apps v7.10\n */\n readonly setTextFp: WithChecksFp<(value: string) => SecondaryButtonEither, true>;\n\n /**\n * @see setTextFp\n */\n readonly setText: WithChecks<(value: string) => void, true>;\n\n /**\n * Updates the button position.\n * @since Mini Apps v7.10\n */\n readonly setPositionFp: WithChecksFp<\n (position: SecondaryButtonPosition) => SecondaryButtonEither,\n true\n >;\n\n /**\n * @see setPositionFp\n */\n readonly setPosition: WithChecks<(position: SecondaryButtonPosition) => void, true>;\n\n /**\n * Shows the button loader.\n * @since Mini Apps v7.10\n */\n readonly showLoaderFp: WithChecksFp<() => SecondaryButtonEither, true>;\n\n /**\n * @see showLoaderFp\n */\n readonly showLoader: WithChecks<() => void, true>;\n\n /**\n * Hides the button loader.\n * @since Mini Apps v7.10\n */\n readonly hideLoaderFp: WithChecksFp<() => SecondaryButtonEither, true>;\n\n /**\n * @see hideLoaderFp\n */\n readonly hideLoader: WithChecks<() => void, true>;\n\n /**\n * Updates the button state.\n * @param state - updates to apply.\n * @since Mini Apps v7.10\n * @example\n * button.setParams({\n * text: 'Submit',\n * isEnabled: true,\n * hasShineEffect: true,\n * });\n */\n readonly setParamsFp: WithChecksFp<\n (state: Partial<SecondaryButtonState>) => SecondaryButtonEither,\n true\n >;\n\n /**\n * @see setParamsFp\n */\n readonly setParams: WithChecks<(state: Partial<SecondaryButtonState>) => void, true>;\n\n /**\n * Mounts the component restoring its state.\n * @since Mini Apps v7.10\n */\n readonly mountFp: WithChecksFp<() => void, true>;\n\n /**\n * @see mountFp\n */\n readonly mount: WithChecks<() => void, true>;\n\n /**\n * Unmounts the component.\n */\n readonly unmount: () => void;\n\n /**\n * Adds a new button listener.\n * @param listener - event listener.\n * @param once - should the listener be called only once.\n * @returns A function to remove bound listener.\n * @since Mini Apps v7.10\n * @example\n * const off = button.onClick(() => {\n * console.log('User clicked the button');\n * off();\n * });\n */\n readonly onClickFp: WithChecksFp<(listener: VoidFunction, once?: boolean) => VoidFunction, true>;\n\n /**\n * @see onClick\n */\n readonly onClick: WithChecks<(listener: VoidFunction, once?: boolean) => VoidFunction, true>;\n\n /**\n * Removes the button click listener.\n * @param listener - event listener.\n * @param once - should the listener be called only once.\n * @since Mini Apps v7.10\n * @example\n * function listener() {\n * console.log('User clicked the button');\n * button.offClick(listener);\n * }\n * button.onClick(listener);\n */\n readonly offClickFp: WithChecksFp<(listener: VoidFunction, once?: boolean) => void, true>;\n\n /**\n * @see offClick\n */\n readonly offClick: WithChecks<(listener: VoidFunction, once?: boolean) => void, true>;\n //#endregion\n}\n","import { computed } from '@vbotma/signals';\n\nimport { miniApp } from '@/features/MiniApp/instance.js';\nimport { SecondaryButton } from '@/features/SecondaryButton/SecondaryButton.js';\nimport { themeParams } from '@/features/ThemeParams/instance.js';\nimport { bottomButtonOptions } from '@/fn-options/bottomButtonOptions.js';\n\nfunction instantiate() {\n return new SecondaryButton(\n bottomButtonOptions('secondaryButton', 'secondary_button_pressed', {\n bgColor: computed(() => miniApp.bottomBarColorRgb() || '#000000'),\n textColor: computed(() => themeParams.buttonColor() || '#2481cc'),\n }),\n );\n}\n\nexport const secondaryButton = /* @__PURE__*/ instantiate();\n","import { EventPayload, type MethodParams, type Request2CaptureFn, RequestError } from '@vbotma/bridge';\nimport { taskEither as TE, function as fn } from 'fp-ts';\n\nimport { SecureStorageMethodError } from '@/errors.js';\nimport type { SharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\nimport type { WithCreateRequestId } from '@/fn-options/withCreateRequestId.js';\nimport type { WithRequest } from '@/fn-options/withRequest.js';\nimport type { WithVersion } from '@/fn-options/withVersion.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport {\n createWithChecksFp,\n type WithChecks,\n type WithChecksFp,\n} from '@/with-checks/withChecksFp.js';\n\nexport type SecureStorageError = RequestError | SecureStorageMethodError;\n\nexport interface SecureStorageOptions extends SharedFeatureOptions,\n WithVersion,\n WithRequest,\n WithCreateRequestId {\n}\n\n/**\n * @since Mini Apps v9.0\n */\nexport class SecureStorage {\n constructor({ isTma, request, version, createRequestId }: SecureStorageOptions) {\n const wrapSupportedTask = createWithChecksFp({\n version,\n requires: 'web_app_secure_storage_get_key',\n isTma,\n returns: 'task',\n });\n\n const invokeMethod = <\n M extends (\n | 'web_app_secure_storage_save_key'\n | 'web_app_secure_storage_get_key'\n | 'web_app_secure_storage_restore_key'\n | 'web_app_secure_storage_save_key'\n | 'web_app_secure_storage_clear'\n ),\n E extends (\n | 'secure_storage_key_saved'\n | 'secure_storage_key_received'\n | 'secure_storage_key_restored'\n | 'secure_storage_cleared'\n ),\n >(\n method: M,\n event: E,\n params: Omit<MethodParams<M>, 'req_id'>,\n ): TE.TaskEither<SecureStorageError, EventPayload<E>> => {\n const requestId = createRequestId();\n return fn.pipe(\n request<M, ('secure_storage_failed' | E)[]>(method, ['secure_storage_failed', event], {\n params: { ...params, req_id: requestId },\n capture: (event => {\n return 'payload' in event ? event.payload.req_id === requestId : true;\n }) as Request2CaptureFn<('secure_storage_failed' | E)[]>,\n }),\n TE.chain(response => (\n response.event === 'secure_storage_failed'\n ? TE.left(new SecureStorageMethodError(response.payload.error || 'UNKNOWN_ERROR'))\n : TE.right(response.payload as EventPayload<E>)\n )),\n );\n };\n\n this.getItemFp = wrapSupportedTask(key => {\n return fn.pipe(\n invokeMethod('web_app_secure_storage_get_key', 'secure_storage_key_received', { key }),\n TE.map(payload => ({\n value: payload.value,\n canRestore: !!payload.can_restore,\n })),\n );\n });\n this.setItemFp = wrapSupportedTask((key, value) => {\n return fn.pipe(\n invokeMethod('web_app_secure_storage_save_key', 'secure_storage_key_saved', { key, value }),\n TE.map(() => undefined),\n );\n });\n this.deleteItemFp = wrapSupportedTask(key => {\n return this.setItemFp(key, null);\n });\n this.clearFp = wrapSupportedTask(() => {\n return fn.pipe(\n invokeMethod('web_app_secure_storage_clear', 'secure_storage_cleared', {}),\n TE.map(() => undefined),\n );\n });\n this.restoreItemFp = wrapSupportedTask(key => {\n return fn.pipe(\n invokeMethod('web_app_secure_storage_restore_key', 'secure_storage_key_restored', { key }),\n TE.map(payload => payload.value),\n );\n });\n\n this.getItem = throwifyWithChecksFp(this.getItemFp);\n this.setItem = throwifyWithChecksFp(this.setItemFp);\n this.deleteItem = throwifyWithChecksFp(this.deleteItemFp);\n this.clear = throwifyWithChecksFp(this.clearFp);\n this.restoreItem = throwifyWithChecksFp(this.restoreItemFp);\n }\n\n /**\n * Retrieves an item using its key.\n * @since Mini Apps v9.0\n */\n readonly getItemFp: WithChecksFp<\n (key: string) => TE.TaskEither<SecureStorageError, {\n value: string | null;\n canRestore: boolean;\n }>,\n true\n >;\n\n /**\n * @see getItemFp\n */\n readonly getItem: WithChecks<\n (key: string) => Promise<{ value: string | null; canRestore: boolean }>,\n true\n >;\n\n /**\n * Restores an item from the storage.\n * @since Mini Apps v9.0\n */\n readonly restoreItemFp: WithChecksFp<\n (key: string) => TE.TaskEither<SecureStorageError, string | null>,\n true\n >;\n\n /**\n * @see restoreItemFp\n */\n readonly restoreItem: WithChecks<(key: string) => Promise<string | null>, true>;\n\n /**\n * Sets a new item in the storage.\n * @since Mini Apps v9.0\n */\n readonly setItemFp: WithChecksFp<\n (key: string, value: string | null) => TE.TaskEither<SecureStorageError, void>,\n true\n >;\n\n /**\n * @see setItemFp\n */\n readonly setItem: WithChecks<(key: string, value: string | null) => Promise<void>, true>;\n\n /**\n * Removes a key from the storage.\n * @since Mini Apps v9.0\n */\n readonly deleteItemFp: WithChecksFp<\n (key: string) => TE.TaskEither<SecureStorageError, void>,\n true\n >;\n\n /**\n * @see deleteItemFp\n */\n readonly deleteItem: WithChecks<(key: string) => Promise<void>, true>;\n\n /**\n * Removes all keys from the storage.\n * @since Mini Apps v9.0\n */\n readonly clearFp: WithChecksFp<() => TE.TaskEither<SecureStorageError, void>, true>;\n\n /**\n * @see clearFp\n */\n readonly clear: WithChecks<() => Promise<void>, true>;\n}\n","import { function as fn } from 'fp-ts';\n\nimport { sharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\nimport { withCreateRequestId } from '@/fn-options/withCreateRequestId.js';\nimport { withRequest } from '@/fn-options/withRequest.js';\nimport { withVersion } from '@/fn-options/withVersion.js';\n\nimport { SecureStorage } from './SecureStorage.js';\n\nfunction instantiate() {\n return new SecureStorage(fn.pipe(\n sharedFeatureOptions(),\n withVersion,\n withRequest,\n withCreateRequestId,\n ));\n}\n\nexport const secureStorage = /* @__PURE__*/ instantiate();\n","import type { PostEventError } from '@vbotma/bridge';\nimport type { Computed } from '@vbotma/signals';\nimport { either as E } from 'fp-ts';\n\nimport { Button, type ButtonOptions } from '@/composables/Button.js';\nimport type { WithChecksFp, WithChecks } from '@/with-checks/withChecksFp.js';\n\nexport interface SettingsButtonState {\n isVisible: boolean;\n}\n\nexport type SettingsButtonOptions = Omit<\n ButtonOptions<SettingsButtonState, 'web_app_setup_settings_button'>,\n 'method' | 'payload' | 'initialState'\n>;\n\n/**\n * @since Mini Apps v6.10\n */\nexport class SettingsButton {\n constructor(options: SettingsButtonOptions) {\n const button = new Button({\n ...options,\n method: 'web_app_setup_settings_button',\n payload: state => ({ is_visible: state.isVisible }),\n initialState: { isVisible: false },\n });\n\n this.isVisible = button.stateGetter('isVisible');\n this.isMounted = button.isMounted;\n this.isSupported = button.isSupported;\n [[this.hide, this.hideFp], [this.show, this.showFp]] = button.stateBoolSetters('isVisible');\n this.onClick = button.onClick;\n this.onClickFp = button.onClickFp;\n this.offClick = button.offClick;\n this.offClickFp = button.offClickFp;\n this.mount = button.mount;\n this.mountFp = button.mountFp;\n this.unmount = button.unmount;\n }\n\n /**\n * Signal indicating if the component is currently visible.\n */\n readonly isVisible: Computed<boolean>;\n\n /**\n * Signal indicating if the component is currently mounted.\n */\n readonly isMounted: Computed<boolean>;\n\n /**\n * Signal indicating if the component is supported.\n */\n readonly isSupported: Computed<boolean>;\n\n /**\n * Hides the button.\n * @since Mini Apps v6.10\n */\n readonly hideFp: WithChecksFp<() => E.Either<PostEventError, void>, true>;\n\n /**\n * @see hideFp\n */\n readonly hide: WithChecks<() => void, true>;\n\n /**\n * Shows the button.\n * @since Mini Apps v6.10\n */\n readonly showFp: WithChecksFp<() => E.Either<PostEventError, void>, true>;\n\n /**\n * @see showFp\n */\n readonly show: WithChecks<() => void, true>;\n\n /**\n * Adds a new button listener.\n * @param listener - event listener.\n * @param once - should the listener be called only once.\n * @returns A function to remove bound listener.\n * @since Mini Apps v6.10\n * @example\n * const off = button.onClick(() => {\n * console.log('User clicked the button');\n * off();\n * });\n */\n readonly onClickFp: WithChecksFp<\n (listener: VoidFunction, once?: boolean) => VoidFunction,\n true\n >;\n\n /**\n * @see onClickFp\n */\n readonly onClick: WithChecks<(listener: VoidFunction, once?: boolean) => VoidFunction, true>;\n\n /**\n * Removes the button click listener.\n * @param listener - event listener.\n * @param once - should the listener be called only once.\n * @since Mini Apps v6.10\n * @example\n * function listener() {\n * console.log('User clicked the button');\n * button.offClick(listener);\n * }\n * button.onClick(listener);\n */\n readonly offClickFp: WithChecksFp<\n (listener: VoidFunction, once?: boolean) => void,\n true\n >;\n\n /**\n * @see offClickFp\n */\n readonly offClick: WithChecks<(listener: VoidFunction, once?: boolean) => void, true>;\n\n /**\n * Mounts the component restoring its state.\n * @since Mini Apps v6.10\n */\n readonly mountFp: WithChecksFp<() => void, true>;\n\n /**\n * @see mountFp\n */\n readonly mount: WithChecks<() => void, true>;\n\n /**\n * Unmounts the component.\n *\n * Note that this function does not remove listeners added via the `onClick`\n * function, so you have to remove them on your own.\n * @see onClick\n */\n readonly unmount: () => void;\n}\n","import { SettingsButton } from '@/features/SettingsButton/SettingsButton.js';\nimport { buttonOptions } from '@/fn-options/buttonOptions.js';\n\nexport const settingsButton = /* @__PURE__*/ new SettingsButton(\n buttonOptions('settingsButton', 'settings_button_pressed'),\n);\n","import type { PostEventError } from '@vbotma/bridge';\nimport type { Computed } from '@vbotma/signals';\nimport { either as E, function as fn } from 'fp-ts';\n\nimport { Mountable } from '@/composables/Mountable.js';\nimport { Stateful } from '@/composables/Stateful.js';\nimport type { SharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\nimport type { WithPostEvent } from '@/fn-options/withPostEvent.js';\nimport type { WithStateRestore } from '@/fn-options/withStateRestore.js';\nimport type { WithVersion } from '@/fn-options/withVersion.js';\nimport { createIsSupportedSignal } from '@/helpers/createIsSupportedSignal.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport { createWithChecksFp, type WithChecks, type WithChecksFp } from '@/with-checks/withChecksFp.js';\n\nexport interface SwipeBehaviorState {\n isVerticalEnabled: boolean;\n}\n\nexport interface SwipeBehaviorOptions\n extends WithStateRestore<SwipeBehaviorState>,\n WithVersion,\n WithPostEvent,\n SharedFeatureOptions {\n}\n\n/**\n * @since Mini Apps v7.7\n */\nexport class SwipeBehavior {\n constructor({ postEvent, storage, isTma, isPageReload, version }: SwipeBehaviorOptions) {\n const initialState = { isVerticalEnabled: true };\n const stateful = new Stateful({\n initialState,\n onChange(state) {\n storage.set(state);\n },\n });\n const mountable = new Mountable({\n initialState,\n isPageReload,\n onMounted: stateful.setState,\n restoreState: storage.get,\n });\n\n const wrapOptions = { requires: 'web_app_setup_swipe_behavior', isTma, version } as const;\n const wrapSupportedPlain = createWithChecksFp({\n ...wrapOptions,\n returns: 'plain',\n });\n const wrapMountedEither = createWithChecksFp({\n ...wrapOptions,\n isMounted: mountable.isMounted,\n returns: 'either',\n });\n\n const setVerticalEnabled = (isVerticalEnabled: boolean) => {\n const update = { isVerticalEnabled };\n if (!stateful.hasDiff(update)) {\n return E.right(undefined);\n }\n return fn.pipe(\n postEvent('web_app_setup_swipe_behavior', { allow_vertical_swipe: isVerticalEnabled }),\n E.map(() => {\n stateful.setState(update);\n }),\n );\n };\n\n this.isSupported = createIsSupportedSignal('web_app_setup_swipe_behavior', version);\n this.isVerticalEnabled = stateful.getter('isVerticalEnabled');\n this.isMounted = mountable.isMounted;\n this.disableVerticalFp = wrapMountedEither(() => {\n return setVerticalEnabled(false);\n });\n this.enableVerticalFp = wrapMountedEither(() => {\n return setVerticalEnabled(true);\n });\n this.mountFp = wrapSupportedPlain(() => {\n const nothing = () => undefined;\n return fn.pipe(mountable.mount(), E.match(nothing, nothing));\n });\n this.unmount = mountable.unmount;\n\n this.disableVertical = throwifyWithChecksFp(this.disableVerticalFp);\n this.enableVertical = throwifyWithChecksFp(this.enableVerticalFp);\n this.mount = throwifyWithChecksFp(this.mountFp);\n }\n\n /**\n * Signal indicating if the component is supported.\n */\n readonly isSupported: Computed<boolean>;\n\n /**\n * Signal indicating if vertical swipes are enabled.\n */\n readonly isVerticalEnabled: Computed<boolean>;\n\n /**\n * Signal indicating if the component is currently mounted.\n */\n readonly isMounted: Computed<boolean>;\n\n /**\n * Mounts the component restoring its state.\n * @since Mini Apps v7.7\n */\n readonly mountFp: WithChecksFp<() => void, true>;\n\n /**\n * @see mountFp\n */\n readonly mount: WithChecks<() => void, true>;\n\n /**\n * Unmounts the component.\n */\n readonly unmount: () => void;\n\n /**\n * Disables the closing confirmation dialog.\n * @since Mini Apps v7.7\n */\n readonly disableVerticalFp: WithChecksFp<() => E.Either<PostEventError, void>, true>;\n\n /**\n * @see disableVerticalFp\n */\n readonly disableVertical: WithChecks<() => void, true>;\n\n /**\n * Enables the closing confirmation dialog.\n * @since Mini Apps v7.7\n */\n readonly enableVerticalFp: WithChecksFp<() => E.Either<PostEventError, void>, true>;\n\n /**\n * @see enableVerticalFp\n */\n readonly enableVertical: WithChecks<() => void, true>;\n}\n","import { function as fn } from 'fp-ts';\n\nimport { SwipeBehavior, type SwipeBehaviorState } from '@/features/SwipeBehavior/SwipeBehavior.js';\nimport { sharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\nimport { withPostEvent } from '@/fn-options/withPostEvent.js';\nimport { withStateRestore } from '@/fn-options/withStateRestore.js';\nimport { withVersion } from '@/fn-options/withVersion.js';\n\nfunction instantiate() {\n return new SwipeBehavior(fn.pipe(\n sharedFeatureOptions(),\n withPostEvent,\n withVersion,\n withStateRestore<SwipeBehaviorState>('swipeBehavior'),\n ));\n}\n\nexport const swipeBehavior = /* @__PURE__*/ instantiate();\n","/**\n * Copies specified text to the clipboard.\n * @param text - text to copy.\n */\nexport async function copyTextToClipboard(text: string): Promise<void> {\n try {\n const { clipboard } = navigator;\n if (clipboard) {\n return await clipboard.writeText(text);\n }\n } catch {\n }\n const textArea = document.createElement('textarea');\n textArea.value = text;\n\n // Avoid scrolling to bottom\n textArea.style.top = '0';\n textArea.style.left = '0';\n textArea.style.position = 'fixed';\n\n document.body.appendChild(textArea);\n textArea.focus();\n textArea.select();\n\n try {\n document.execCommand('copy');\n } finally {\n document.body.removeChild(textArea);\n }\n}\n","import { RequestError } from '@vbotma/bridge';\nimport { taskEither as TE, function as fn } from 'fp-ts';\n\nimport { AccessDeniedError } from '@/errors.js';\nimport {\n sharedFeatureOptions,\n type SharedFeatureOptions,\n} from '@/fn-options/sharedFeatureOptions.js';\nimport { withRequest, type WithRequest } from '@/fn-options/withRequest.js';\nimport { withVersion, type WithVersion } from '@/fn-options/withVersion.js';\nimport type { AsyncOptions } from '@/types.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport { withChecksFp } from '@/with-checks/withChecksFp.js';\n\ninterface CreateOptions extends SharedFeatureOptions, WithRequest, WithVersion {\n}\n\nexport type DownloadFileError = RequestError | AccessDeniedError;\n\nfunction create({ request, ...rest }: CreateOptions) {\n return withChecksFp((\n url: string,\n fileName: string,\n options?: AsyncOptions,\n ): TE.TaskEither<DownloadFileError, void> => {\n return fn.pipe(\n request(\n 'web_app_request_file_download',\n 'file_download_requested',\n { ...options, params: { url, file_name: fileName } },\n ),\n TE.chain(response => {\n return response.status === 'downloading'\n ? TE.right(undefined)\n : TE.left(new AccessDeniedError('User denied the action'));\n }),\n );\n }, { ...rest, requires: 'web_app_request_file_download', returns: 'task' });\n}\n\n// #__NO_SIDE_EFFECTS__\nfunction instantiate() {\n return create(fn.pipe(\n sharedFeatureOptions(),\n withRequest,\n withVersion,\n ));\n}\n\n/**\n * Displays a native popup prompting the user to download a file.\n * @param url - the HTTPS URL of the file to be downloaded.\n * @param file - the suggested name for the downloaded file.\n * @param options - additional request execution options.\n * @since Mini Apps v8.0\n * @example\n * fn.pipe(\n * downloadFileFp('https://telegram.org/js/telegram-web-app.js', 'telegram-sdk.js'),\n * TE.map(() => {\n * console.log('Downloading');\n * })\n * )\n */\nexport const downloadFileFp = instantiate();\n\nexport const downloadFile = throwifyWithChecksFp(downloadFileFp);\n","import { taskEither as TE, function as fn } from 'fp-ts';\nimport { date, integer, number, transform, pipe as valiPipe, safeParse } from 'valibot';\n\nimport { ValidationError } from '@/errors.js';\nimport {\n type SharedFeatureOptions,\n sharedFeatureOptions,\n} from '@/fn-options/sharedFeatureOptions.js';\nimport {\n type WithInvokeCustomMethod,\n withInvokeCustomMethod,\n type InvokeCustomMethodError,\n} from '@/fn-options/withInvokeCustomMethod.js';\nimport { type WithVersion, withVersion } from '@/fn-options/withVersion.js';\nimport type { AsyncOptions } from '@/types.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport { withChecksFp } from '@/with-checks/withChecksFp.js';\n\ninterface CreateOptions extends SharedFeatureOptions, WithInvokeCustomMethod, WithVersion {\n}\n\nexport type GetCurrentTimeError = InvokeCustomMethodError | ValidationError;\n\nfunction create({ invokeCustomMethod, ...rest }: CreateOptions) {\n return withChecksFp((options?: AsyncOptions): TE.TaskEither<GetCurrentTimeError, Date> => {\n return fn.pipe(\n invokeCustomMethod('getCurrentTime', {}, options),\n TE.chain(response => {\n const parsed = safeParse(\n valiPipe(number(), integer(), transform(v => new Date(v * 1000)), date()),\n response,\n );\n return parsed.success\n ? TE.right(parsed.output)\n : TE.left(new ValidationError(response, parsed.issues));\n }),\n );\n }, { ...rest, requires: 'web_app_invoke_custom_method', returns: 'task' });\n}\n\n// #__NO_SIDE_EFFECTS__\nfunction instantiate() {\n return create(fn.pipe(\n sharedFeatureOptions(),\n withInvokeCustomMethod,\n withVersion,\n ));\n}\n\n/**\n * @returns The current time according to the Telegram server time.\n * @param options - additional options.\n * @since Mini Apps v6.9\n */\nexport const getCurrentTimeFp = instantiate();\n\n/**\n * @see getCurrentTimeFp\n */\nexport const getCurrentTime = throwifyWithChecksFp(getCurrentTimeFp);\n","import type { PostEventError } from '@vbotma/bridge';\nimport { either as E, function as fn } from 'fp-ts';\n\nimport {\n sharedFeatureOptions,\n type SharedFeatureOptions,\n} from '@/fn-options/sharedFeatureOptions.js';\nimport { withPostEvent, type WithPostEvent } from '@/fn-options/withPostEvent.js';\nimport { withVersion, type WithVersion } from '@/fn-options/withVersion.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport { withChecksFp } from '@/with-checks/withChecksFp.js';\n\ninterface CreateOptions extends SharedFeatureOptions, WithPostEvent, WithVersion {\n}\n\nexport type HideKeyboardError = PostEventError;\n\nfunction create({ postEvent, ...rest }: CreateOptions) {\n return withChecksFp((): E.Either<HideKeyboardError, void> => {\n return postEvent('web_app_hide_keyboard');\n }, { ...rest, returns: 'either', requires: 'web_app_hide_keyboard' });\n}\n\n// #__NO_SIDE_EFFECTS__\nfunction instantiate() {\n return create(fn.pipe(\n sharedFeatureOptions(),\n withPostEvent,\n withVersion,\n ));\n}\n\n/**\n * Hides the on-screen keyboard, if it is currently visible. Does nothing if the keyboard is\n * not active.\n * @since Mini Apps v9.1\n */\nexport const hideKeyboardFp = instantiate();\n\n/**\n * @see hideKeyboardFp\n */\nexport const hideKeyboard = throwifyWithChecksFp(hideKeyboardFp);\n","import { captureSameReq, type RequestError } from '@vbotma/bridge';\nimport { taskEither as TE, function as fn } from 'fp-ts';\n\nimport {\n sharedFeatureOptions,\n type SharedFeatureOptions,\n} from '@/fn-options/sharedFeatureOptions.js';\nimport { withRequest, type WithRequest } from '@/fn-options/withRequest.js';\nimport { withVersion, type WithVersion } from '@/fn-options/withVersion.js';\nimport { createRequestId } from '@/globals/createRequestId.js';\nimport type { AsyncOptions } from '@/types.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport { withChecksFp } from '@/with-checks/withChecksFp.js';\n\ninterface CreateOptions extends SharedFeatureOptions, WithVersion, WithRequest {\n createRequestId: () => string;\n}\n\nexport type ReadTextFromClipboardError = RequestError;\n\nfunction create({ request, createRequestId, ...rest }: CreateOptions) {\n return withChecksFp((\n options?: AsyncOptions,\n ): TE.TaskEither<ReadTextFromClipboardError, string | null> => {\n const reqId = createRequestId();\n return fn.pipe(\n request('web_app_read_text_from_clipboard', 'clipboard_text_received', {\n ...options,\n params: { req_id: reqId },\n capture: captureSameReq(reqId),\n }),\n TE.map(({ data = null }) => data),\n );\n }, { ...rest, requires: 'web_app_read_text_from_clipboard', returns: 'task' });\n}\n\n// #__NO_SIDE_EFFECTS__\nfunction instantiate() {\n return create({\n ...fn.pipe(\n sharedFeatureOptions(),\n withVersion,\n withRequest,\n ),\n createRequestId,\n });\n}\n\n/**\n * Reads a text from the clipboard and returns a `string` or `null`. `null` is returned\n * in one of the following cases:\n * - A value in the clipboard is not a text.\n * - Access to the clipboard is not granted.\n * @since Mini Apps v6.4\n */\nexport const readTextFromClipboardFp = instantiate();\n\nexport const readTextFromClipboard = throwifyWithChecksFp(readTextFromClipboardFp);\n","export interface AndroidDeviceData {\n appVersion?: string;\n manufacturer?: string;\n model?: string;\n androidVersion?: string;\n sdkVersion?: number;\n performanceClass?: 'LOW' | 'AVERAGE' | 'HIGH' | string;\n}\n\n/**\n * Retrieves Android device data from the specified User Agent.\n * @see https://core.telegram.org/bots/webapps#additional-data-in-user-agent\n * @param userAgent - user agent.\n */\nexport function retrieveAndroidDeviceDataFrom(userAgent: string): AndroidDeviceData {\n const result: AndroidDeviceData = {};\n const match = userAgent.match(/Telegram-Android(?:\\/([^ ]+))?(?: (\\([^)]+\\))?|$)/);\n if (match) {\n const [, appVersion, systemInfo] = match;\n appVersion && (result.appVersion = appVersion);\n systemInfo && systemInfo\n .slice(1, systemInfo.length - 1)\n .split(';')\n .forEach(item => {\n const [key, value] = item.trim().split(' ');\n if (key === 'Android') {\n result.androidVersion = value;\n } else if (key === 'SDK') {\n const parsed = parseInt(value, 10);\n parsed && (result.sdkVersion = parsed);\n } else if (value) {\n result.manufacturer = key;\n result.model = value;\n } else {\n result.performanceClass = key;\n }\n });\n }\n return result;\n}\n","import {\n type AndroidDeviceData,\n retrieveAndroidDeviceDataFrom,\n} from './retrieveAndroidDeviceDataFrom.js';\n\n/**\n * Retrieves Android device data from the navigator.userAgent.\n * @see https://core.telegram.org/bots/webapps#additional-data-in-user-agent\n */\nexport function retrieveAndroidDeviceData(): AndroidDeviceData {\n return retrieveAndroidDeviceDataFrom(navigator.userAgent);\n}\n","import type { PostEventError } from '@vbotma/bridge';\nimport { either as E, function as fn } from 'fp-ts';\n\nimport { InvalidArgumentsError } from '@/errors.js';\nimport {\n sharedFeatureOptions,\n type SharedFeatureOptions,\n} from '@/fn-options/sharedFeatureOptions.js';\nimport { withPostEvent, type WithPostEvent } from '@/fn-options/withPostEvent.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport { withChecksFp } from '@/with-checks/withChecksFp.js';\n\ninterface CreateOptions extends SharedFeatureOptions, WithPostEvent {\n}\n\nexport type SendDataError = PostEventError | InvalidArgumentsError;\n\nfunction create({ postEvent, ...rest }: CreateOptions) {\n return withChecksFp((data: string): E.Either<SendDataError, void> => {\n const { size } = new Blob([data]);\n if (!size || size > 4096) {\n return E.left(\n new InvalidArgumentsError(size\n ? 'Maximum size of data to send is 4096 bytes'\n : 'Attempted to send empty data'),\n );\n }\n return postEvent('web_app_data_send', { data });\n }, { ...rest, returns: 'either' });\n}\n\n// #__NO_SIDE_EFFECTS__\nfunction instantiate() {\n return create(fn.pipe(sharedFeatureOptions(), withPostEvent));\n}\n\n/**\n * Sends data to the bot.\n *\n * When this method called, a service message sent to the bot containing the data of the length\n * up to 4096 bytes, and the Mini App closed.\n *\n * See the field `web_app_data` in the class [Message](https://core.telegram.org/bots/api#message).\n *\n * This method is only available for Mini Apps launched via a Keyboard button.\n * @param data - data to send to bot.\n */\nexport const sendDataFp = instantiate();\n\n/**\n * @see sendDataFp\n */\nexport const sendData = throwifyWithChecksFp(sendDataFp);\n","import { RequestError } from '@vbotma/bridge';\nimport { taskEither as TE, function as fn } from 'fp-ts';\n\nimport { ShareMessageError } from '@/errors.js';\nimport {\n sharedFeatureOptions,\n type SharedFeatureOptions,\n} from '@/fn-options/sharedFeatureOptions.js';\nimport { withRequest, type WithRequest } from '@/fn-options/withRequest.js';\nimport { withVersion, type WithVersion } from '@/fn-options/withVersion.js';\nimport type { AsyncOptions } from '@/types.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport { withChecksFp } from '@/with-checks/withChecksFp.js';\n\ninterface CreateOptions extends SharedFeatureOptions, WithRequest, WithVersion {\n}\n\nexport type ShareMessageFnError = RequestError | ShareMessageError;\n\nfunction create({ request, ...rest }: CreateOptions) {\n return withChecksFp((\n messageId: string,\n options?: AsyncOptions,\n ): TE.TaskEither<ShareMessageFnError, void> => {\n return fn.pipe(\n request(\n 'web_app_send_prepared_message',\n ['prepared_message_failed', 'prepared_message_sent'],\n {\n ...options,\n params: { id: messageId },\n },\n ),\n TE.chain(response => (\n response.event === 'prepared_message_failed'\n ? TE.left(new ShareMessageError(response.payload.error))\n : TE.right(undefined)\n )),\n );\n }, { ...rest, requires: 'web_app_send_prepared_message', returns: 'task' });\n}\n\n// #__NO_SIDE_EFFECTS__\nfunction instantiate() {\n return create(fn.pipe(\n sharedFeatureOptions(),\n withRequest,\n withVersion,\n ));\n}\n\n/**\n * Opens a dialog allowing the user to share a message provided by the bot.\n * @since Mini Apps v8.0\n */\nexport const shareMessageFp = instantiate();\n\n/**\n * @see shareMessageFp\n */\nexport const shareMessage = throwifyWithChecksFp(shareMessageFp);\n","import type { PostEventError } from '@vbotma/bridge';\nimport { either as E, function as fn } from 'fp-ts';\n\nimport {\n sharedFeatureOptions,\n type SharedFeatureOptions,\n} from '@/fn-options/sharedFeatureOptions.js';\nimport { withPostEvent, type WithPostEvent } from '@/fn-options/withPostEvent.js';\nimport { withVersion, type WithVersion } from '@/fn-options/withVersion.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport { withChecksFp } from '@/with-checks/withChecksFp.js';\n\ninterface CreateOptions extends SharedFeatureOptions, WithPostEvent, WithVersion {\n}\n\nexport interface ShareStoryOptions {\n /**\n * The caption to be added to the media.\n * 0-200 characters for regular users and 0-2048 characters for premium subscribers.\n * @see https://telegram.org/faq_premium#telegram-premium\n */\n text?: string;\n /**\n * An object that describes a widget link to be included in the story.\n * Note that only premium subscribers can post stories with links.\n * @see https://telegram.org/faq_premium#telegram-premium\n */\n widgetLink?: {\n /**\n * The URL to be included in the story.\n */\n url: string;\n /**\n * The name to be displayed for the widget link, 0-48 characters.\n */\n name?: string;\n };\n}\n\nexport type ShareStoryError = PostEventError;\n\nfunction create({ postEvent, ...rest }: CreateOptions) {\n return withChecksFp((\n mediaUrl: string,\n options: ShareStoryOptions = {},\n ): E.Either<ShareStoryError, void> => {\n return postEvent('web_app_share_to_story', {\n text: options.text,\n media_url: mediaUrl,\n widget_link: options.widgetLink,\n });\n }, { ...rest, requires: 'web_app_share_to_story', returns: 'either' });\n}\n\n// #__NO_SIDE_EFFECTS__\nfunction instantiate() {\n return create(fn.pipe(\n sharedFeatureOptions(),\n withPostEvent,\n withVersion,\n ));\n}\n\n/**\n * Opens the native story editor.\n * @since Mini Apps v7.8\n * @example\n * fn.pipe(\n * shareStory('https://example.com/background.png', {\n * text: 'Look at this cool group!',\n * widgetLink: {\n * url: 'https://t.me/heyqbnk',\n * name: 'Vlad\\'s community',\n * },\n * }),\n * TE.match(error => {\n * console.error('Something went wrong', error);\n * }, () => {\n * console.log('Call was successful');\n * }),\n * );\n */\nexport const shareStoryFp = instantiate();\n\n/**\n * @see shareStoryFp\n */\nexport const shareStory = throwifyWithChecksFp(shareStoryFp);\n","import { createSignal } from '@/globals/signals-registry.js';\n\n/**\n * True if the application is launched in inline mode.\n */\nexport const isInlineMode = createSignal(false);\n","import type { PostEventError, SwitchInlineQueryChatType } from '@vbotma/bridge';\nimport { either as E, function as fn } from 'fp-ts';\n\nimport {\n sharedFeatureOptions,\n type SharedFeatureOptions,\n} from '@/fn-options/sharedFeatureOptions.js';\nimport { withPostEvent, type WithPostEvent } from '@/fn-options/withPostEvent.js';\nimport { withVersion, type WithVersion } from '@/fn-options/withVersion.js';\nimport { isInlineMode } from '@/globals/isInlineMode.js';\nimport { access } from '@/helpers/access.js';\nimport type { MaybeAccessor } from '@/types.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport { withChecksFp } from '@/with-checks/withChecksFp.js';\n\ninterface CreateOptions extends SharedFeatureOptions, WithPostEvent, WithVersion {\n isInlineMode: MaybeAccessor<boolean>;\n}\n\nexport type SwitchInlineQueryError = PostEventError;\n\nfunction create({ isInlineMode, postEvent, ...rest }: CreateOptions) {\n return withChecksFp((\n query: string,\n chatTypes?: SwitchInlineQueryChatType[],\n ): E.Either<SwitchInlineQueryError, void> => {\n return postEvent('web_app_switch_inline_query', {\n query: query,\n chat_types: chatTypes || [],\n });\n }, {\n ...rest,\n requires: {\n every: ['web_app_switch_inline_query', () => {\n return access(isInlineMode)\n ? undefined\n : 'The application must be launched in the inline mode';\n }],\n },\n returns: 'either',\n });\n}\n\n// #__NO_SIDE_EFFECTS__\nfunction instantiate() {\n return create({\n ...fn.pipe(\n sharedFeatureOptions(),\n withPostEvent,\n withVersion,\n ),\n isInlineMode,\n });\n}\n\n/**\n * Inserts the bot's username and the specified inline query in the current chat's input field.\n * Query may be empty, in which case only the bot's username will be inserted. The client prompts\n * the user to choose a specific chat, then opens that chat and inserts the bot's username and\n * the specified inline query in the input field.\n * @param query - text which should be inserted in the input after the current bot name. Max\n * length is 256 symbols.\n * @param chatTypes - List of chat types which could be chosen to send the message. Could be an\n * empty list.\n * @since Mini Apps v6.7\n * @example\n * fn.pipe(\n * switchInlineQuery('my query goes here', ['users']),\n * E.match(error => {\n * console.error('Something went wrong', error);\n * }, () => {\n * console.log('Call was successful');\n * }),\n * );\n */\nexport const switchInlineQueryFp = instantiate();\n\n/**\n * @see switchInlineQueryFp\n */\nexport const switchInlineQuery = throwifyWithChecksFp(switchInlineQueryFp);\n","import {\n type SafeAreaInsets,\n type EventListener,\n supports,\n type RequestError,\n type PostEventError,\n} from '@vbotma/bridge';\nimport { Computed, computed, signal } from '@vbotma/signals';\nimport { camelToKebab } from '@vbotma/toolkit';\nimport { BetterPromise } from 'better-promises';\nimport { either as E, taskEither as TE, function as fn } from 'fp-ts';\n\nimport { AsyncMountable } from '@/composables/AsyncMountable.js';\nimport { Stateful } from '@/composables/Stateful.js';\nimport { CSSVarsBoundError, FullscreenFailedError } from '@/errors.js';\nimport { SharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\nimport { WithPostEvent } from '@/fn-options/withPostEvent.js';\nimport { WithRequest } from '@/fn-options/withRequest.js';\nimport { WithStateRestore } from '@/fn-options/withStateRestore.js';\nimport { WithVersion } from '@/fn-options/withVersion.js';\nimport { access } from '@/helpers/access.js';\nimport { deleteCssVar, setCssVar } from '@/helpers/css-vars.js';\nimport { AsyncOptions } from '@/types.js';\nimport { throwifyWithChecksFp } from '@/with-checks/throwifyWithChecksFp.js';\nimport { createWithChecksFp, WithChecks, WithChecksFp } from '@/with-checks/withChecksFp.js';\n\ntype FullscreenError = FullscreenFailedError | RequestError;\ntype ViewportChangedEventListener = EventListener<'viewport_changed'>;\ntype FullscreenChangedEventListener = EventListener<'fullscreen_changed'>;\ntype SafeAreaInsetsChangedEventListener = EventListener<'safe_area_changed'>;\ntype SafeAreaInsetCSSVarKey = `safeAreaInset${Capitalize<keyof SafeAreaInsets>}`;\n\nexport type GetCSSVarNameKey =\n | 'width'\n | 'height'\n | 'stableHeight'\n | SafeAreaInsetCSSVarKey\n | `content${Capitalize<SafeAreaInsetCSSVarKey>}`;\n\nexport type GetCSSVarNameFn = (key: GetCSSVarNameKey) => string | null | undefined | false;\n\nexport interface ViewportState {\n contentSafeAreaInsets: SafeAreaInsets;\n height: number;\n isExpanded: boolean;\n isFullscreen: boolean;\n safeAreaInsets: SafeAreaInsets;\n stableHeight: number;\n width: number;\n}\n\ntype WithListeners<On extends string, Off extends string, L> = {\n [K in On | Off]: (listener: L) => void;\n};\n\nexport interface ViewportOptions<EViewportStable, EFullscreen>\n extends WithStateRestore<ViewportState>,\n WithVersion,\n WithRequest,\n WithPostEvent,\n WithListeners<'onViewportChanged', 'offViewportChanged', ViewportChangedEventListener>,\n WithListeners<'onFullscreenChanged', 'offFullscreenChanged', FullscreenChangedEventListener>,\n WithListeners<'onSafeAreaInsetsChanged', 'offSafeAreaInsetsChanged', SafeAreaInsetsChangedEventListener>,\n WithListeners<'onContentSafeAreaInsetsChanged', 'offContentSafeAreaInsetsChanged', SafeAreaInsetsChangedEventListener>,\n SharedFeatureOptions {\n /**\n * True if the viewport is stable.\n */\n isViewportStable: boolean | (() => E.Either<EViewportStable, boolean>);\n /**\n * True if the application was opened in fullscreen initially.\n */\n isFullscreen: boolean | (() => E.Either<EFullscreen, boolean>);\n}\n\nexport class Viewport<EViewportStable, EFullscreen> {\n constructor({\n storage,\n isPageReload,\n onContentSafeAreaInsetsChanged,\n onSafeAreaInsetsChanged,\n onViewportChanged,\n onFullscreenChanged,\n offContentSafeAreaInsetsChanged,\n offFullscreenChanged,\n offSafeAreaInsetsChanged,\n offViewportChanged,\n request,\n isViewportStable,\n isFullscreen,\n isTma,\n version,\n postEvent,\n }: ViewportOptions<EViewportStable, EFullscreen>) {\n const initialInsets: SafeAreaInsets = { top: 0, right: 0, left: 0, bottom: 0 };\n const stateful = new Stateful<ViewportState>({\n initialState: {\n contentSafeAreaInsets: initialInsets,\n height: 0,\n isExpanded: false,\n isFullscreen: false,\n safeAreaInsets: initialInsets,\n stableHeight: 0,\n width: 0,\n },\n onChange: storage.set,\n });\n\n const viewportChangedListener: ViewportChangedEventListener = event => {\n stateful.setState({\n isExpanded: event.is_expanded,\n height: event.height,\n width: event.width,\n stableHeight: event.is_state_stable ? event.height : undefined,\n });\n };\n const fullscreenChangedListener: FullscreenChangedEventListener = event => {\n stateful.setState({ isFullscreen: event.is_fullscreen });\n };\n const safeAreaInsetsChangedListener: SafeAreaInsetsChangedEventListener = event => {\n stateful.setState({ safeAreaInsets: event });\n };\n const contentSafeAreaInsetsChangedListener: SafeAreaInsetsChangedEventListener = event => {\n stateful.setState({ contentSafeAreaInsets: event });\n };\n\n const mountable = new AsyncMountable({\n initialState(options) {\n const genRequestInsets = (kind: 'safe-area' | 'content-safe-area') => {\n return () => {\n const [method, event] = kind === 'safe-area'\n ? ['web_app_request_safe_area', 'safe_area_changed'] as const\n : ['web_app_request_content_safe_area', 'content_safe_area_changed'] as const;\n\n if (!supports(method, access(version))) {\n return TE.right({ top: 0, left: 0, right: 0, bottom: 0 });\n }\n return request(method, event, options);\n };\n };\n const genFlag = <E>(flag: boolean | (() => E.Either<E, boolean>)) => {\n return () => (\n typeof flag === 'boolean'\n ? TE.right(flag)\n : TE.fromEither(flag())\n );\n };\n\n return fn.pipe(\n TE.Do,\n TE.bindW('safeAreaInsets', genRequestInsets('safe-area')),\n TE.bindW('contentSafeAreaInsets', genRequestInsets('content-safe-area')),\n TE.bindW('isFullscreen', genFlag(isFullscreen)),\n TE.bindW('isViewportStable', genFlag(isViewportStable)),\n TE.chainW(({ isViewportStable, ...shared }) => {\n if (isViewportStable) {\n return TE.right({\n ...shared,\n height: window.innerHeight,\n isExpanded: true,\n stableHeight: window.innerHeight,\n width: window.innerWidth,\n });\n }\n return fn.pipe(\n request('web_app_request_viewport', 'viewport_changed', options),\n TE.map(viewport => ({\n ...shared,\n height: viewport.height,\n isExpanded: viewport.is_expanded,\n stableHeight: viewport.is_state_stable ? viewport.height : 0,\n width: viewport.width,\n })),\n );\n }),\n );\n },\n isPageReload,\n onMounted(state) {\n onViewportChanged(viewportChangedListener);\n onFullscreenChanged(fullscreenChangedListener);\n onSafeAreaInsetsChanged(safeAreaInsetsChangedListener);\n onContentSafeAreaInsetsChanged(contentSafeAreaInsetsChangedListener);\n stateful.setState(state);\n },\n onUnmounted() {\n offViewportChanged(viewportChangedListener);\n offFullscreenChanged(fullscreenChangedListener);\n offSafeAreaInsetsChanged(safeAreaInsetsChangedListener);\n offContentSafeAreaInsetsChanged(contentSafeAreaInsetsChangedListener);\n },\n restoreState: storage.get,\n });\n\n const saBased = <K extends keyof SafeAreaInsets>(key: K) => {\n return computed(() => this.safeAreaInsets()[key]);\n };\n const csaBased = <K extends keyof SafeAreaInsets>(key: K) => {\n return computed(() => this.contentSafeAreaInsets()[key]);\n };\n\n this.state = stateful.state;\n this.height = stateful.getter('height');\n this.stableHeight = stateful.getter('stableHeight');\n this.width = stateful.getter('width');\n this.isExpanded = stateful.getter('isExpanded');\n this.safeAreaInsets = stateful.getter('safeAreaInsets');\n this.safeAreaInsetTop = saBased('top');\n this.safeAreaInsetBottom = saBased('bottom');\n this.safeAreaInsetLeft = saBased('left');\n this.safeAreaInsetRight = saBased('right');\n this.contentSafeAreaInsets = stateful.getter('contentSafeAreaInsets');\n this.contentSafeAreaInsetTop = csaBased('top');\n this.contentSafeAreaInsetBottom = csaBased('bottom');\n this.contentSafeAreaInsetLeft = csaBased('left');\n this.contentSafeAreaInsetRight = csaBased('right');\n\n const wrapTask = createWithChecksFp({ isTma, returns: 'task' });\n const wrapMountedEither = createWithChecksFp({\n isTma,\n returns: 'either',\n });\n const wrapFullscreenTask = createWithChecksFp({\n isTma,\n requires: 'web_app_request_fullscreen',\n version,\n returns: 'task',\n });\n const genFullscreenFn = (enable: boolean) => {\n return wrapFullscreenTask((options?: AsyncOptions) => {\n return fn.pipe(\n request(\n enable ? 'web_app_request_fullscreen' : 'web_app_exit_fullscreen',\n ['fullscreen_changed', 'fullscreen_failed'],\n options,\n ),\n TE.chain(response => {\n if (\n response.event === 'fullscreen_failed'\n && response.payload.error !== 'ALREADY_FULLSCREEN'\n ) {\n return TE.left(new FullscreenFailedError(response.payload.error));\n }\n stateful.setState({\n isFullscreen: 'is_fullscreen' in response.payload\n ? response.payload.is_fullscreen\n : true,\n });\n return TE.right(undefined);\n }),\n );\n });\n };\n\n // Mount.\n this.isMounted = mountable.isMounted;\n this.mountFp = wrapTask(mountable.mount);\n this.mount = throwifyWithChecksFp(this.mountFp);\n\n // Fullscreen.\n this.isFullscreen = stateful.getter('isFullscreen');\n this.requestFullscreenFp = genFullscreenFn(true);\n this.requestFullscreen = throwifyWithChecksFp(this.requestFullscreenFp);\n this.exitFullscreenFp = genFullscreenFn(false);\n this.exitFullscreen = throwifyWithChecksFp(this.exitFullscreenFp);\n\n // CSS vars.\n const isCssVarsBound = signal(false);\n this.isCssVarsBound = computed(isCssVarsBound);\n this.bindCssVarsFp = wrapMountedEither(\n (getCSSVarName?: GetCSSVarNameFn) => {\n if (isCssVarsBound()) {\n return E.left(new CSSVarsBoundError());\n }\n getCSSVarName ||= prop => `--tg-viewport-${camelToKebab(prop)}`;\n\n const settings = ([\n ['height', this.height],\n ['stableHeight', this.stableHeight],\n ['width', this.width],\n ['safeAreaInsetTop', this.safeAreaInsetTop],\n ['safeAreaInsetBottom', this.safeAreaInsetBottom],\n ['safeAreaInsetLeft', this.safeAreaInsetLeft],\n ['safeAreaInsetRight', this.safeAreaInsetRight],\n ['contentSafeAreaInsetTop', this.contentSafeAreaInsetTop],\n ['contentSafeAreaInsetBottom', this.contentSafeAreaInsetBottom],\n ['contentSafeAreaInsetLeft', this.contentSafeAreaInsetLeft],\n ['contentSafeAreaInsetRight', this.contentSafeAreaInsetRight],\n ] as const).reduce<{\n update: VoidFunction;\n removeListener: VoidFunction;\n cssVar: string;\n }[]>((acc, [key, signal]) => {\n const cssVar = getCSSVarName(key);\n if (cssVar) {\n const update = () => {\n setCssVar(cssVar, `${signal()}px`);\n };\n acc.push({ update, removeListener: signal.sub(update), cssVar });\n }\n return acc;\n }, []);\n\n settings.forEach(setting => {\n setting.update();\n });\n isCssVarsBound.set(true);\n\n return E.right(() => {\n settings.forEach(s => {\n s.removeListener();\n deleteCssVar(s.cssVar);\n });\n isCssVarsBound.set(false);\n });\n },\n );\n this.bindCssVars = throwifyWithChecksFp(this.bindCssVarsFp);\n\n // Other methods.\n this.expandFp = wrapMountedEither(() => postEvent('web_app_expand'));\n this.expand = throwifyWithChecksFp(this.expandFp);\n }\n\n //#region Other properties.\n /**\n * Complete component state.\n */\n readonly state: Computed<ViewportState>;\n\n /**\n * Signal containing the current height of the **visible area** of the Mini App.\n *\n * The application can display just the top part of the Mini App, with its\n * lower part remaining outside the screen area. From this position, the user\n * can \"pull\" the Mini App to its maximum height, while the bot can do the same\n * by calling `expand` method. As the position of the Mini App changes, the\n * current height value of the visible area will be updated in real time.\n *\n * Please note that the refresh rate of this value is not sufficient to\n * smoothly follow the lower border of the window. It should not be used to pin\n * interface elements to the bottom of the visible area. It's more appropriate\n * to use the value of the `stableHeight` field for this purpose.\n *\n * @see stableHeight\n */\n readonly height: Computed<number>;\n\n /**\n * Signal containing the height of the visible area of the Mini App in its last stable state.\n *\n * The application can display just the top part of the Mini App, with its\n * lower part remaining outside the screen area. From this position, the user\n * can \"pull\" the Mini App to its maximum height, while the application can do\n * the same by calling `expand` method.\n *\n * Unlike the value of `height`, the value of `stableHeight` does not change as\n * the position of the Mini App changes with user gestures or during\n * animations. The value of `stableHeight` will be updated after all gestures\n * and animations are completed and the Mini App reaches its final size.\n *\n * @see height\n */\n readonly stableHeight: Computed<number>;\n\n /**\n * Signal containing the currently visible area width.\n */\n readonly width: Computed<number>;\n\n /**\n * Signal indicating if the Mini App is expanded to the maximum available height. Otherwise,\n * if the Mini App occupies part of the screen and can be expanded to the full\n * height using the `expand` method.\n */\n readonly isExpanded: Computed<boolean>;\n\n /**\n * Signal indicating if the current viewport height is stable and is not going to change in\n * the next moment.\n */\n readonly isStable = computed(() => this.height() === this.stableHeight());\n //#endregion\n\n //#region Content safe area insets.\n /**\n * Signal containing content safe area insets.\n */\n readonly contentSafeAreaInsets: Computed<SafeAreaInsets>;\n\n /**\n * Signal containing top content safe area inset.\n */\n readonly contentSafeAreaInsetTop: Computed<number>;\n\n /**\n * Signal containing left content safe area inset.\n */\n readonly contentSafeAreaInsetLeft: Computed<number>;\n\n /**\n * Signal containing right content safe area inset.\n */\n readonly contentSafeAreaInsetRight: Computed<number>;\n\n /**\n * Signal containing bottom content safe area inset.\n */\n readonly contentSafeAreaInsetBottom: Computed<number>;\n //#endregion\n\n //#region Safe area insets.\n /**\n * Signal containing safe area insets.\n */\n readonly safeAreaInsets: Computed<SafeAreaInsets>;\n\n /**\n * Signal containing top safe area inset.\n */\n readonly safeAreaInsetTop: Computed<number>;\n\n /**\n * Signal containing left safe area inset.\n */\n readonly safeAreaInsetLeft: Computed<number>;\n\n /**\n * Signal containing right safe area inset.\n */\n readonly safeAreaInsetRight: Computed<number>;\n\n /**\n * Signal containing bottom safe area inset.\n */\n readonly safeAreaInsetBottom: Computed<number>;\n //#endregion\n\n //#region Fullscreen.\n /**\n * Signal indicating if the viewport is currently in fullscreen mode.\n */\n readonly isFullscreen: Computed<boolean>;\n\n /**\n * Requests fullscreen mode for the mini application.\n * @since Mini Apps v8.0\n */\n readonly requestFullscreenFp: WithChecksFp<\n (options?: AsyncOptions) => TE.TaskEither<FullscreenError, void>,\n true\n >;\n\n /**\n * @see requestFullscreenFp\n */\n readonly requestFullscreen: WithChecks<(options?: AsyncOptions) => BetterPromise<void>, true>;\n\n /**\n * Exits mini application from the fullscreen mode.\n * @since Mini Apps v8.0\n */\n readonly exitFullscreenFp: WithChecksFp<\n (options?: AsyncOptions) => TE.TaskEither<FullscreenError, void>,\n true\n >;\n\n /**\n * @see exitFullscreenFp\n */\n readonly exitFullscreen: WithChecks<(options?: AsyncOptions) => BetterPromise<void>, true>;\n //#endregion\n\n //#region CSS Vars.\n /**\n * Signal indicating if CSS variables are bound.\n */\n readonly isCssVarsBound: Computed<boolean>;\n\n /**\n * Creates CSS variables connected with the current viewport.\n *\n * By default, created CSS variables names are following the pattern \"--tg-theme-{name}\", where\n * {name} is a viewport property name converted from camel case to kebab case.\n *\n * Default variables:\n * - `--tg-viewport-height`\n * - `--tg-viewport-width`\n * - `--tg-viewport-stable-height`\n * - `--tg-viewport-content-safe-area-inset-top`\n * - `--tg-viewport-content-safe-area-inset-bottom`\n * - `--tg-viewport-content-safe-area-inset-left`\n * - `--tg-viewport-content-safe-area-inset-right`\n * - `--tg-viewport-safe-area-inset-top`\n * - `--tg-viewport-safe-area-inset-bottom`\n * - `--tg-viewport-safe-area-inset-left`\n * - `--tg-viewport-safe-area-inset-right`\n *\n * Variables are being automatically updated if the viewport was changed.\n *\n * @param getCSSVarName - function, returning computed complete CSS variable name. The CSS\n * variable will only be defined if the function returned non-empty string value.\n * @returns Function to stop updating variables.\n * @example Using no arguments\n * bindCssVarsFp();\n * @example Using custom CSS vars generator\n * bindCssVarsFp(key => `--my-prefix-${key}`);\n */\n readonly bindCssVarsFp: WithChecksFp<(getCSSVarName?: GetCSSVarNameFn) => (\n E.Either<CSSVarsBoundError, VoidFunction>\n ), false>;\n\n /**\n * @see bindCssVarsFp\n */\n readonly bindCssVars: WithChecks<(getCSSVarName?: GetCSSVarNameFn) => VoidFunction, false>;\n //#endregion\n\n //#region Mount.\n /**\n * Signal indicating if the component is currently mounted.\n */\n readonly isMounted: Computed<boolean>;\n\n /**\n * Mounts the component.\n */\n readonly mountFp: WithChecksFp<(options?: AsyncOptions) => (\n TE.TaskEither<EFullscreen | EViewportStable | RequestError, void>\n ), false>;\n\n /**\n * @see mountFp\n */\n readonly mount: WithChecks<(options?: AsyncOptions) => BetterPromise<void>, false>;\n //#endregion\n\n //#region Other methods.\n /**\n * A method that expands the Mini App to the maximum available height. To find\n * out if the Mini App is expanded to the maximum height, refer to the value of\n * the `isExpanded`.\n */\n readonly expandFp: WithChecksFp<() => E.Either<PostEventError, void>, false>;\n\n /**\n * @see expandFp\n */\n readonly expand: WithChecks<() => void, false>;\n //#endregion\n}\n","import { retrieveLaunchParamsFp, on, off, type EventName, EventListener } from '@vbotma/bridge';\nimport { either as E, function as fn } from 'fp-ts';\n\nimport { Viewport, type ViewportState } from '@/features/Viewport/Viewport.js';\nimport { sharedFeatureOptions } from '@/fn-options/sharedFeatureOptions.js';\nimport { withPostEvent } from '@/fn-options/withPostEvent.js';\nimport { withRequest } from '@/fn-options/withRequest.js';\nimport { withStateRestore } from '@/fn-options/withStateRestore.js';\nimport { withVersion } from '@/fn-options/withVersion.js';\n\nfunction create() {\n const createListeners = <E extends EventName>(event: E) => {\n return {\n on: (listener: EventListener<E>) => {\n on(event, listener);\n },\n off: (listener: EventListener<E>) => {\n off(event, listener);\n },\n };\n };\n const viewportListeners = createListeners('viewport_changed');\n const fullscreenListeners = createListeners('fullscreen_changed');\n const safeAreaListeners = createListeners('safe_area_changed');\n const contentSafeAreaListeners = createListeners('content_safe_area_changed');\n\n return new Viewport({\n ...fn.pipe(\n sharedFeatureOptions(),\n withStateRestore<ViewportState>('viewport'),\n withVersion,\n withPostEvent,\n withRequest,\n ),\n isFullscreen() {\n return fn.pipe(retrieveLaunchParamsFp(), E.map(lp => !!lp.vbWebAppFullscreen));\n },\n isViewportStable() {\n return fn.pipe(retrieveLaunchParamsFp(), E.map(lp => {\n return ['macos', 'tdesktop', 'unigram', 'webk', 'weba', 'web'].includes(lp.vbWebAppPlatform);\n }));\n },\n offContentSafeAreaInsetsChanged: contentSafeAreaListeners.off,\n offFullscreenChanged: fullscreenListeners.off,\n offSafeAreaInsetsChanged: safeAreaListeners.off,\n offViewportChanged: viewportListeners.off,\n onContentSafeAreaInsetsChanged: contentSafeAreaListeners.on,\n onFullscreenChanged: fullscreenListeners.on,\n onSafeAreaInsetsChanged: safeAreaListeners.on,\n onViewportChanged: viewportListeners.on,\n });\n}\n\nexport const viewport = /* @__PURE__*/ create();\n","import { type RequestError } from '@vbotma/bridge';\r\nimport type { BetterPromise } from 'better-promises';\r\nimport { taskEither as TE, function as fn } from 'fp-ts';\r\n\r\nimport type {\r\n StoragePermissionOptions,\r\n RequestStorageAccessOptions,\r\n StorageAccessResult,\r\n} from '@/features/StoragePermission/types.js';\r\n\r\n/**\r\n * Storage Permission feature class.\r\n * Allows requesting access to device storage to select files or folders.\r\n * @since v9.3\r\n */\r\nexport class StoragePermission {\r\n constructor({ request }: StoragePermissionOptions) {\r\n this.requestAccessFp = (\r\n options: RequestStorageAccessOptions\r\n ): TE.TaskEither<RequestError, StorageAccessResult> => {\r\n return fn.pipe(\r\n request('web_app_request_storage_access' as any, 'storage_access_granted' as any, {\r\n params: {\r\n access_type: options.accessType,\r\n multiple: options.multiple,\r\n accept: options.accept,\r\n max_file_size: options.maxFileSize,\r\n read_content: options.readContent,\r\n }\r\n }),\r\n TE.map((event: any) => ({\r\n accessType: event.access_type,\r\n items: event.items.map((item: any) => ({\r\n name: item.name,\r\n path: item.path,\r\n size: item.size,\r\n type: item.type,\r\n content: item.content,\r\n lastModified: item.last_modified,\r\n })),\r\n }))\r\n );\r\n };\r\n\r\n this.requestAccess = (\r\n options: RequestStorageAccessOptions\r\n ): BetterPromise<StorageAccessResult> => {\r\n const task = this.requestAccessFp(options);\r\n return (task() as Promise<any>).then((result) => {\r\n if (result._tag === 'Left') {\r\n throw result.left;\r\n }\r\n return result.right;\r\n }) as BetterPromise<StorageAccessResult>;\r\n };\r\n\r\n // Convenience methods\r\n this.selectFile = (options?: {\r\n accept?: string[];\r\n maxFileSize?: number;\r\n readContent?: boolean;\r\n }): BetterPromise<StorageAccessResult> => {\r\n return this.requestAccess({\r\n accessType: 'file',\r\n multiple: false,\r\n ...options,\r\n });\r\n };\r\n\r\n this.selectFiles = (options?: {\r\n accept?: string[];\r\n maxFileSize?: number;\r\n readContent?: boolean;\r\n }): BetterPromise<StorageAccessResult> => {\r\n return this.requestAccess({\r\n accessType: 'file',\r\n multiple: true,\r\n ...options,\r\n });\r\n };\r\n\r\n this.selectFolder = (): BetterPromise<StorageAccessResult> => {\r\n return this.requestAccess({\r\n accessType: 'folder',\r\n });\r\n };\r\n }\r\n\r\n /**\r\n * Requests storage access with specified options.\r\n * Returns a promise that resolves with selected files/folders.\r\n * @param options - Storage access options\r\n * @since v9.3\r\n */\r\n readonly requestAccessFp: (\r\n options: RequestStorageAccessOptions\r\n ) => TE.TaskEither<RequestError, StorageAccessResult>;\r\n\r\n /**\r\n * @see requestAccessFp\r\n */\r\n readonly requestAccess: (\r\n options: RequestStorageAccessOptions\r\n ) => BetterPromise<StorageAccessResult>;\r\n\r\n /**\r\n * Convenience method to select a single file.\r\n * @param options - Optional file selection options\r\n */\r\n readonly selectFile: (options?: {\r\n accept?: string[];\r\n maxFileSize?: number;\r\n readContent?: boolean;\r\n }) => BetterPromise<StorageAccessResult>;\r\n\r\n /**\r\n * Convenience method to select multiple files.\r\n * @param options - Optional file selection options\r\n */\r\n readonly selectFiles: (options?: {\r\n accept?: string[];\r\n maxFileSize?: number;\r\n readContent?: boolean;\r\n }) => BetterPromise<StorageAccessResult>;\r\n\r\n /**\r\n * Convenience method to select a folder.\r\n */\r\n readonly selectFolder: () => BetterPromise<StorageAccessResult>;\r\n}\r\n","import { request2Fp } from '@vbotma/bridge';\r\nimport { StoragePermission } from './StoragePermission.js';\r\n\r\nfunction instantiate() {\r\n return new StoragePermission({\r\n request: request2Fp,\r\n });\r\n}\r\n\r\nexport const storagePermission = /* @__PURE__ */ instantiate();\r\n","import {\n on,\n logger,\n retrieveLaunchParamsFp,\n type RetrieveLaunchParamsError,\n type PostEventError,\n type PostEventFpFn,\n} from '@vbotma/bridge';\nimport { createCbCollector, throwifyFpFn } from '@vbotma/toolkit';\nimport type { Version, ThemeParams } from '@vbotma/types';\nimport { either as E, function as fn } from 'fp-ts';\n\nimport { isInlineMode } from '@/globals/isInlineMode.js';\nimport { postEventFpSignal, postEventFp, postEvent } from '@/globals/postEvent.js';\nimport { themeParams } from '@/globals/themeParams.js';\nimport { version } from '@/globals/version.js';\n\nexport interface InitOptions {\n /**\n * True if SDK should accept styles sent from the VBot application.\n * @default true\n */\n acceptCustomStyles?: boolean;\n /**\n * True if the application is launched in inline mode.\n * @default Will be calculated based on the launch parameters' vbWebAppBotInline field.\n */\n isInlineMode?: boolean;\n /**\n * A custom `postEvent` function to use across the package.\n * @default tma.js/bridge's postEventFp function will be used.\n */\n postEvent?: PostEventFpFn;\n /**\n * Mini application theme parameters.\n * @default Will be calculated based on the launch parameters' vbWebAppThemeParams field.\n */\n themeParams?: ThemeParams;\n /**\n * VBot Mini Apps version supported by the VBot client.\n * @default Will be calculated based on the launch parameters' vbWebAppVersion field.\n */\n version?: Version;\n}\n\n/**\n * Initializes the SDK allowing it to properly handle events, sent from the native Telegram\n * application. This function also configure the package's global dependencies (functions,\n * variables used across the package).\n * @param options - function options.\n * @returns A function, to perform a cleanup.\n */\nexport function initFp(\n options: InitOptions = {},\n): E.Either<RetrieveLaunchParamsError | PostEventError, VoidFunction> {\n const {\n version: optionsVersion,\n isInlineMode: optionsInlineMode,\n themeParams: optionsThemeParams,\n } = options;\n\n if (optionsVersion && typeof optionsInlineMode === 'boolean' && optionsThemeParams) {\n version.set(optionsVersion);\n isInlineMode.set(optionsInlineMode);\n themeParams.set(optionsThemeParams);\n } else {\n const error = fn.pipe(retrieveLaunchParamsFp(), E.matchW(\n err => err,\n lp => {\n version.set(optionsVersion || lp.vbWebAppVersion);\n isInlineMode.set(typeof optionsInlineMode === 'boolean'\n ? optionsInlineMode\n : !!lp.vbWebAppBotInline);\n themeParams.set(optionsThemeParams || lp.vbWebAppThemeParams);\n },\n ));\n if (error) {\n return E.left(error);\n }\n }\n if (options.postEvent) {\n postEventFpSignal.set(options.postEvent);\n }\n\n const [addCleanup, cleanup] = createCbCollector(\n on('reload_iframe', () => {\n logger().log('Received a request to reload the page');\n postEvent('iframe_will_reload');\n window.location.reload();\n }),\n );\n\n const { acceptCustomStyles = true } = options;\n if (acceptCustomStyles) {\n const style = document.createElement('style');\n style.id = 'telegram-custom-styles';\n document.head.appendChild(style);\n\n addCleanup(\n on('set_custom_style', html => {\n // It is safe to use innerHTML here as long as style tag has a special behavior related\n // to the specified content.\n // In case any script will be passed here, it will not be executed, so XSS is not possible.\n style.innerHTML = html;\n }),\n () => {\n document.head.removeChild(style);\n },\n );\n }\n\n // Notify Telegram that the application is ready.\n //\n // This will result in sending style tag html content from the Telegram web application.\n // We should call this method also to start receiving \"reload_iframe\" events from the Telegram\n // application.\n //\n // It really has no effect outside non-Telegram web environment.\n return fn.pipe(\n postEventFp('iframe_ready', { reload_supported: true }),\n E.map(() => {\n logger().log('The package was initialized');\n return cleanup;\n }),\n );\n}\n\n/**\n * @see initFp\n */\nexport const init = throwifyFpFn(initFp);\n"],"names":["r","y","e","c","m","S","g","u","s","i","t","l","o","f","d","n","h","p","j","b","x","__spreadArray","to","from","pack","ar","identity","a","flow","ab","bc","cd","de","ef","fg","gh","hi","ij","pipe","ret","dual","arity","body","isDataFirst","args","self","none","some","isLeft","ma","left","right","emptyRecord","ap","F","G","fa","fab","gab","ga","map","bind","M","name","_a","_.none","_.some","_map","_ap","URI","isNone","of","flatMap","Chain","matchW","onNone","onSome","match","Do","_.emptyRecord","chainable.bind","_.left","_.right","Functor","apW","Apply","bimap","mapLeft","_.isLeft","onLeft","onRight","foldW","fold","tryCatch","onThrow","bindW","chainW","chain","E.right","E.left","map_","E.Functor","ap_","E.Apply","E.isLeft","mapBoth","E.bimap","E.match","parse","_apPar","Pointed","ApplyPar","Monad","__awaiter","thisArg","_arguments","P","generator","adopt","value","resolve","reject","fulfilled","step","rejected","result","__generator","_","verb","v","op","ET.left","T.Pointed","ET.right","fromEither","T.of","ET.match","T.Functor","onRejected","reason_1","ET.map","ET.mapBoth","ET.ap","T.ApplyPar","ET.flatMap","T.Monad","access","Mountable","onMounted","restoreState","initialState","onUnmounted","isPageReload","__publicField","signal","computed","restored","state","fn.pipe","E.map","batch","removeUndefined","k","shallowEqual","aKeys","bKeys","aKey","Stateful","onChange","nextState","key","store$4","getGlobalConfig","config$1","store$3","getGlobalMessage","lang","store$2","getSchemaMessage","store$1","getSpecificMessage","reference","_stringify","input","type","_b","_addIssue","context","label","dataset","other","expected","received","issue","isSchema","message$1","_getStandardProps","value$1","_isValidObjectKey","object$1","_joinExpects","values$1","separator","list","ValiError","issues","check","requirement","integer","transform","operation","getFallback","schema","getDefault","is","any","array","item","itemDataset","pathItem","boolean","date","function_","instance","class_","looseObject","entries$1","valueSchema","valueDataset","nullish","wrapped","default_","number","optional","record","entryKey","entryValue","keyDataset","string","_subIssues","datasets","union","options","option","validDataset","typedDatasets","untypedDatasets","optionDataset","unknown","pipe$1","safeParse","$","q","w","D","E","I","L","H","C","O","T","A","R","K","z","J","f.pipe","i.match","u.match","i.tryCatch","u.right","u.left","i.chainW","i.left","i.right","i.fromEither","i.matchW","N","U","V","B","s.right","s.left","C.pipe","s.map","tt","rt","Q","nt","s.tryCatch","at","ot","it","ke","se","Y","ie","xe","Se","Ae","ye","Ce","pe","Me","qe","l.pipe","c.chainW","re","Ve","c.map","F.some","F.none","c.fold","F.match","c.foldW","X","c.right","c.left","We","Be","ce","ae","Le","_e","be","W","ue","Fe","me","ve","ne","oe","Te","Oe","Re","je","c.mapLeft","Z","w.chainW","ee","w.mapBoth","pt","Ue","te","c.match","w.right","w.match","he","ct","Ee","Pe","Ie","$e","_t","we","ze","w.chain","w.left","Ge","lt","fe","c.tryCatch","mt","le","De","wt","dt","Je","c.chain","ge.parse","bt","createIsSupportedSignal","method","version","supports","throwifyWithChecksFp","fn_","throwifyFpFn","O.match","data","throwifyAnyEither","msgToTuple","message","ValidationError","errorClassWithData","CSSVarsBoundError","errorClass","DeviceStorageMethodError","error","SecureStorageMethodError","NotAvailableError","InvalidEnvError","FunctionUnavailableError","InvalidArgumentsError","cause","ConcurrentCallError","SetEmojiStatusError","AccessDeniedError","FullscreenFailedError","ShareMessageError","UnknownThemeParamsKeyError","withChecksFp","fn","isTma","optionsIsSupported","returns","isSupportedSimplified","isOptionSupported","optionName","optionSettings","calculateSupportError","mode","requirements","calculateOptionSupportError","isSupported","isInitialized","isMounted","isAvailable","wrapError","err","TE.left","call","E.tryCatch","TE.tryCatch","errMessagePrefix","supportErr","supportsOptionErr","O.some","O.none","createWithChecksFp","Button","storage","onClick","offClick","postEvent","payload","stateful","mountable","wrapOptions","wrapSupportedPlain","wrapMountedEither","nothing","setFp","setFalse","setTrue","BackButton","button","sharedFeatureOptions","isVBMAFp","createFnOption","mix","obj","createSignal","initialValue","postEventFpSignal","_postEventFp","postEventFp","withPostEvent","createComponentSessionStorage","getStorageValue","setStorageValue","getFirstNavigationEntry","entry","withStateRestore","storageName","withVersion","buttonOptions","trackedClickEvent","listener","once","on","off","backButton","AsyncMountable","TE.right","TE.map","createNotAvailableError","eventToState","event","available","tokenSaved","deviceId","accessRequested","accessGranted","Biometry","request","onInfoReceived","offInfoReceived","wrapSupportedEither","wrapSupportedTask","wrapMountedTask","response","TE.chain","requestFp","events","_requestFp","request2Fp","_request2Fp","BetterPromise","request2","withRequest","instantiate","biometry","ClosingBehavior","setClosingConfirmation","isConfirmationEnabled","closingBehavior","CloudStorage","invokeCustomMethod","keyOrKeys","keys","values","acc","lastRequestId","createRequestId","params","invokeCustomMethodFp","withInvokeCustomMethod","cloudStorage","DeviceStorage","invokeMethod","requestId","withCreateRequestId","deviceStorage","create","rest","requestEmojiStatusAccessFp","requestEmojiStatusAccess","customEmojiId","TE.chainW","setEmojiStatusFp","setEmojiStatus","HapticFeedback","HAPTIC_METHOD_NAME","wrapSupported","style","hapticFeedback","addToHomeScreenFp","addToHomeScreen","checkHomeScreenStatusFp","checkHomeScreenStatus","InitData","retrieveInitData","authDateValue","canSendAfterValue","raw","E.Do","E.bindW","retrieveLaunchParamsFp","vbWebAppData","retrieveRawInitDataFp","O.Do","O.bind","initData","Invoice","isOpened","toggleClosed","slug","TE.mapBoth","url","hostname","pathname","invoice","openLinkFp","openLink","urlString","openTelegramLinkFp","openTelegramLink","text","shareURLFp","shareURL","LocationManager","locationManager","MainButton","defaults","withDefault","field","fromState","setCssVar","deleteCssVar","isColorDarkFp","color","toRGBFullFp","rgb","modifier","idx","dec","isColorDark","ThemeParams","offChange","getCSSVarName","prop","snakeToKebab","forEachEntry","actualize","themeParams","globalThemeParams","bottomButtonOptions","mainButton","MiniApp","theme","onVisibilityChanged","offVisibilityChanged","visibilityChangedListener","themeChangedListener","isRGB","rgbBasedOn","computedRgbBasedOn","isCssVarsBound","addCleanup","cleanup","createCbCollector","cssVar","update","camelToKebab","genColorToolset","stateKey","rawColor","rgbColor","fp","withBasicEither","returnBack","miniApp","generateNotificationId","timestamp","random","Notification","TE.fromEither","notification","prepareParams","title","paramsButtons","buttons","id","Popup","preparedOptions","popup","requestPhoneAccessFp","requestPhoneAccess","createComplete","getContact","toStringResult","toParsedResult","pipeQueryToSchema","pipeJsonToSchema","valiPipe","getContactWithErrorsIgnore","TE.match","contact","pollContact","ctx","BetterTaskEither","res","rej","sleepTime","status","instantiateComplete","createParsed","requestContact","instantiateParsed","requestContactCompleteFp","requestContactComplete","requestContactFp","requestWriteAccessFp","requestWriteAccess","QrScanner","onClosed","onTextReceived","setClosed","captured","qr","addToCleanup","onSettled","isOpenedValue","qrScanner","Refresh","isRefreshing","refresh","SecondaryButton","secondaryButton","SecureStorage","secureStorage","SettingsButton","settingsButton","SwipeBehavior","setVerticalEnabled","isVerticalEnabled","swipeBehavior","copyTextToClipboard","clipboard","textArea","fileName","downloadFileFp","downloadFile","parsed","getCurrentTimeFp","getCurrentTime","hideKeyboardFp","hideKeyboard","reqId","captureSameReq","readTextFromClipboardFp","readTextFromClipboard","retrieveAndroidDeviceDataFrom","userAgent","appVersion","systemInfo","retrieveAndroidDeviceData","size","sendDataFp","sendData","messageId","shareMessageFp","shareMessage","mediaUrl","shareStoryFp","shareStory","isInlineMode","query","chatTypes","switchInlineQueryFp","switchInlineQuery","Viewport","onContentSafeAreaInsetsChanged","onSafeAreaInsetsChanged","onViewportChanged","onFullscreenChanged","offContentSafeAreaInsetsChanged","offFullscreenChanged","offSafeAreaInsetsChanged","offViewportChanged","isViewportStable","isFullscreen","initialInsets","viewportChangedListener","fullscreenChangedListener","safeAreaInsetsChangedListener","contentSafeAreaInsetsChangedListener","genRequestInsets","kind","genFlag","flag","TE.Do","TE.bindW","shared","viewport","saBased","csaBased","wrapTask","wrapFullscreenTask","genFullscreenFn","enable","settings","setting","createListeners","viewportListeners","fullscreenListeners","safeAreaListeners","contentSafeAreaListeners","lp","StoragePermission","storagePermission","initFp","optionsVersion","optionsIn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