@naturalcycles/js-lib 14.277.0 → 15.0.1

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 (353) hide show
  1. package/cfg/frontend/tsconfig.json +3 -3
  2. package/dist/abort.js +1 -4
  3. package/dist/array/array.util.d.ts +1 -1
  4. package/dist/array/array.util.js +47 -88
  5. package/dist/array/range.d.ts +2 -2
  6. package/dist/array/range.js +7 -12
  7. package/dist/bot.js +6 -10
  8. package/dist/browser/adminService.d.ts +1 -1
  9. package/dist/browser/adminService.js +10 -14
  10. package/dist/browser/analytics.util.js +10 -15
  11. package/dist/browser/i18n/fetchTranslationLoader.d.ts +3 -3
  12. package/dist/browser/i18n/fetchTranslationLoader.js +1 -5
  13. package/dist/browser/i18n/translation.service.d.ts +1 -1
  14. package/dist/browser/i18n/translation.service.js +5 -10
  15. package/dist/browser/imageFitter.js +1 -5
  16. package/dist/browser/script.util.js +8 -12
  17. package/dist/browser/topbar.js +7 -10
  18. package/dist/datetime/dateInterval.d.ts +2 -2
  19. package/dist/datetime/dateInterval.js +7 -11
  20. package/dist/datetime/localDate.d.ts +3 -3
  21. package/dist/datetime/localDate.js +40 -44
  22. package/dist/datetime/localTime.d.ts +3 -3
  23. package/dist/datetime/localTime.js +36 -40
  24. package/dist/datetime/timeInterval.d.ts +2 -2
  25. package/dist/datetime/timeInterval.js +6 -10
  26. package/dist/datetime/wallTime.d.ts +3 -3
  27. package/dist/datetime/wallTime.js +5 -9
  28. package/dist/decorators/asyncMemo.decorator.d.ts +3 -3
  29. package/dist/decorators/asyncMemo.decorator.js +12 -17
  30. package/dist/decorators/createPromiseDecorator.js +3 -6
  31. package/dist/decorators/debounce.d.ts +1 -1
  32. package/dist/decorators/debounce.decorator.d.ts +1 -1
  33. package/dist/decorators/debounce.decorator.js +5 -9
  34. package/dist/decorators/debounce.js +2 -6
  35. package/dist/decorators/decorator.util.d.ts +1 -1
  36. package/dist/decorators/decorator.util.js +3 -8
  37. package/dist/decorators/logMethod.decorator.d.ts +1 -1
  38. package/dist/decorators/logMethod.decorator.js +11 -14
  39. package/dist/decorators/memo.decorator.d.ts +3 -3
  40. package/dist/decorators/memo.decorator.js +11 -16
  41. package/dist/decorators/memo.util.d.ts +2 -2
  42. package/dist/decorators/memo.util.js +11 -17
  43. package/dist/decorators/memoFn.d.ts +3 -3
  44. package/dist/decorators/memoFn.js +3 -6
  45. package/dist/decorators/memoFnAsync.d.ts +3 -3
  46. package/dist/decorators/memoFnAsync.js +5 -8
  47. package/dist/decorators/memoSimple.decorator.d.ts +1 -1
  48. package/dist/decorators/memoSimple.decorator.js +6 -10
  49. package/dist/decorators/retry.decorator.d.ts +1 -1
  50. package/dist/decorators/retry.decorator.js +3 -6
  51. package/dist/decorators/swarmSafe.decorator.js +3 -7
  52. package/dist/decorators/timeout.decorator.d.ts +1 -1
  53. package/dist/decorators/timeout.decorator.js +7 -10
  54. package/dist/define.d.ts +1 -1
  55. package/dist/define.js +11 -19
  56. package/dist/deviceIdService.js +7 -11
  57. package/dist/enum.util.d.ts +1 -1
  58. package/dist/enum.util.js +20 -42
  59. package/dist/env/buildInfo.d.ts +1 -1
  60. package/dist/env/buildInfo.js +3 -6
  61. package/dist/env.js +2 -6
  62. package/dist/error/assert.d.ts +3 -3
  63. package/dist/error/assert.js +30 -44
  64. package/dist/error/error.model.d.ts +2 -2
  65. package/dist/error/error.model.js +1 -2
  66. package/dist/error/error.util.d.ts +1 -1
  67. package/dist/error/error.util.js +25 -44
  68. package/dist/error/errorMode.js +2 -5
  69. package/dist/error/try.d.ts +2 -2
  70. package/dist/error/try.js +15 -23
  71. package/dist/error/tryCatch.d.ts +2 -2
  72. package/dist/error/tryCatch.js +6 -11
  73. package/dist/form.util.d.ts +1 -1
  74. package/dist/form.util.js +2 -6
  75. package/dist/http/fetcher.d.ts +3 -3
  76. package/dist/http/fetcher.js +48 -53
  77. package/dist/http/fetcher.model.d.ts +5 -5
  78. package/dist/http/fetcher.model.js +1 -2
  79. package/dist/http/http.model.js +1 -4
  80. package/dist/index.d.ts +96 -96
  81. package/dist/index.js +96 -99
  82. package/dist/is.util.d.ts +2 -2
  83. package/dist/is.util.js +12 -27
  84. package/dist/iter/asyncIterable2.d.ts +3 -3
  85. package/dist/iter/asyncIterable2.js +8 -12
  86. package/dist/iter/iterable2.d.ts +2 -2
  87. package/dist/iter/iterable2.js +8 -12
  88. package/dist/json-schema/from-data/generateJsonSchemaFromData.d.ts +1 -1
  89. package/dist/json-schema/from-data/generateJsonSchemaFromData.js +5 -8
  90. package/dist/json-schema/jsonSchema.cnst.d.ts +1 -1
  91. package/dist/json-schema/jsonSchema.cnst.js +1 -4
  92. package/dist/json-schema/jsonSchema.model.d.ts +1 -1
  93. package/dist/json-schema/jsonSchema.model.js +1 -2
  94. package/dist/json-schema/jsonSchema.util.d.ts +2 -2
  95. package/dist/json-schema/jsonSchema.util.js +5 -8
  96. package/dist/json-schema/jsonSchemaBuilder.d.ts +2 -2
  97. package/dist/json-schema/jsonSchemaBuilder.js +16 -25
  98. package/dist/json-schema/jsonSchemas.d.ts +2 -2
  99. package/dist/json-schema/jsonSchemas.js +5 -8
  100. package/dist/log/commonLogger.js +14 -21
  101. package/dist/math/accumulatingAverage.js +1 -5
  102. package/dist/math/math.util.js +11 -19
  103. package/dist/math/sma.js +1 -5
  104. package/dist/math/stack.util.js +11 -16
  105. package/dist/nanoid.js +2 -6
  106. package/dist/number/createDeterministicRandom.js +1 -4
  107. package/dist/number/number.util.d.ts +1 -1
  108. package/dist/number/number.util.js +9 -20
  109. package/dist/object/deepEquals.js +3 -8
  110. package/dist/object/map2.js +1 -5
  111. package/dist/object/object.util.d.ts +2 -2
  112. package/dist/object/object.util.js +40 -70
  113. package/dist/object/set2.js +1 -5
  114. package/dist/object/sortObject.d.ts +1 -1
  115. package/dist/object/sortObject.js +1 -4
  116. package/dist/object/sortObjectDeep.js +1 -4
  117. package/dist/polyfill.js +1 -4
  118. package/dist/promise/abortable.d.ts +1 -1
  119. package/dist/promise/abortable.js +2 -7
  120. package/dist/promise/pDefer.js +1 -4
  121. package/dist/promise/pDelay.d.ts +2 -2
  122. package/dist/promise/pDelay.js +4 -8
  123. package/dist/promise/pFilter.d.ts +1 -1
  124. package/dist/promise/pFilter.js +1 -4
  125. package/dist/promise/pHang.js +1 -4
  126. package/dist/promise/pMap.d.ts +2 -2
  127. package/dist/promise/pMap.js +17 -20
  128. package/dist/promise/pProps.js +1 -4
  129. package/dist/promise/pQueue.d.ts +2 -2
  130. package/dist/promise/pQueue.js +7 -11
  131. package/dist/promise/pRetry.d.ts +1 -1
  132. package/dist/promise/pRetry.js +8 -12
  133. package/dist/promise/pState.js +1 -4
  134. package/dist/promise/pTimeout.d.ts +3 -3
  135. package/dist/promise/pTimeout.js +7 -11
  136. package/dist/semver.d.ts +1 -1
  137. package/dist/semver.js +13 -18
  138. package/dist/string/case.js +9 -14
  139. package/dist/string/escape.js +2 -6
  140. package/dist/string/hash.util.d.ts +1 -1
  141. package/dist/string/hash.util.js +4 -10
  142. package/dist/string/json.util.d.ts +1 -1
  143. package/dist/string/json.util.js +5 -10
  144. package/dist/string/leven.js +1 -4
  145. package/dist/string/lodash/unicodeWords.js +1 -4
  146. package/dist/string/lodash/words.js +3 -6
  147. package/dist/string/pupa.d.ts +1 -1
  148. package/dist/string/pupa.js +4 -9
  149. package/dist/string/readingTime.d.ts +1 -1
  150. package/dist/string/readingTime.js +1 -4
  151. package/dist/string/regex.js +1 -4
  152. package/dist/string/safeJsonStringify.d.ts +1 -1
  153. package/dist/string/safeJsonStringify.js +1 -4
  154. package/dist/string/slugify.js +1 -4
  155. package/dist/string/string.util.js +15 -32
  156. package/dist/string/stringify.d.ts +1 -1
  157. package/dist/string/stringify.js +10 -14
  158. package/dist/string/url.util.d.ts +1 -1
  159. package/dist/string/url.util.js +2 -6
  160. package/dist/time/time.util.d.ts +1 -1
  161. package/dist/time/time.util.js +3 -8
  162. package/dist/typeFest.js +1 -2
  163. package/dist/types.d.ts +1 -1
  164. package/dist/types.js +17 -27
  165. package/dist/unit/size.util.js +5 -12
  166. package/dist/web.d.ts +1 -1
  167. package/dist/web.js +1 -5
  168. package/dist/zod/index.d.ts +2 -2
  169. package/dist/zod/index.js +4 -10
  170. package/dist/zod/zod.shared.schemas.js +36 -39
  171. package/dist/zod/zod.util.js +7 -14
  172. package/package.json +18 -30
  173. package/src/array/array.util.ts +3 -3
  174. package/src/array/range.ts +2 -2
  175. package/src/bot.ts +1 -1
  176. package/src/browser/adminService.ts +4 -4
  177. package/src/browser/analytics.util.ts +2 -2
  178. package/src/browser/i18n/fetchTranslationLoader.ts +3 -3
  179. package/src/browser/i18n/translation.service.ts +2 -2
  180. package/src/browser/script.util.ts +2 -2
  181. package/src/datetime/dateInterval.ts +3 -3
  182. package/src/datetime/localDate.ts +5 -5
  183. package/src/datetime/localTime.ts +6 -6
  184. package/src/datetime/timeInterval.ts +3 -3
  185. package/src/datetime/wallTime.ts +4 -4
  186. package/src/decorators/asyncMemo.decorator.ts +7 -7
  187. package/src/decorators/createPromiseDecorator.ts +1 -1
  188. package/src/decorators/debounce.decorator.ts +2 -2
  189. package/src/decorators/debounce.ts +1 -1
  190. package/src/decorators/decorator.util.ts +1 -1
  191. package/src/decorators/logMethod.decorator.ts +4 -4
  192. package/src/decorators/memo.decorator.ts +7 -7
  193. package/src/decorators/memo.util.ts +4 -4
  194. package/src/decorators/memoFn.ts +4 -4
  195. package/src/decorators/memoFnAsync.ts +5 -5
  196. package/src/decorators/memoSimple.decorator.ts +4 -4
  197. package/src/decorators/retry.decorator.ts +2 -2
  198. package/src/decorators/swarmSafe.decorator.ts +2 -2
  199. package/src/decorators/timeout.decorator.ts +4 -4
  200. package/src/define.ts +3 -3
  201. package/src/deviceIdService.ts +3 -3
  202. package/src/enum.util.ts +1 -1
  203. package/src/env/buildInfo.ts +2 -2
  204. package/src/error/assert.ts +7 -7
  205. package/src/error/error.model.ts +2 -2
  206. package/src/error/error.util.ts +5 -5
  207. package/src/error/try.ts +5 -5
  208. package/src/error/tryCatch.ts +3 -3
  209. package/src/form.util.ts +1 -1
  210. package/src/http/fetcher.model.ts +5 -5
  211. package/src/http/fetcher.ts +20 -15
  212. package/src/index.ts +96 -96
  213. package/src/is.util.ts +2 -2
  214. package/src/iter/asyncIterable2.ts +3 -3
  215. package/src/iter/iterable2.ts +2 -2
  216. package/src/json-schema/from-data/generateJsonSchemaFromData.ts +3 -3
  217. package/src/json-schema/jsonSchema.cnst.ts +1 -1
  218. package/src/json-schema/jsonSchema.model.ts +1 -1
  219. package/src/json-schema/jsonSchema.util.ts +4 -4
  220. package/src/json-schema/jsonSchemaBuilder.ts +5 -5
  221. package/src/json-schema/jsonSchemas.ts +2 -2
  222. package/src/math/math.util.ts +2 -2
  223. package/src/math/stack.util.ts +1 -1
  224. package/src/number/number.util.ts +1 -1
  225. package/src/object/object.util.ts +3 -3
  226. package/src/object/sortObject.ts +1 -1
  227. package/src/promise/abortable.ts +1 -1
  228. package/src/promise/pDelay.ts +3 -3
  229. package/src/promise/pFilter.ts +1 -1
  230. package/src/promise/pMap.ts +2 -2
  231. package/src/promise/pQueue.ts +4 -4
  232. package/src/promise/pRetry.ts +2 -2
  233. package/src/promise/pTimeout.ts +4 -4
  234. package/src/semver.ts +3 -3
  235. package/src/string/case.ts +2 -2
  236. package/src/string/hash.util.ts +1 -1
  237. package/src/string/json.util.ts +2 -2
  238. package/src/string/lodash/words.ts +1 -1
  239. package/src/string/pupa.ts +2 -2
  240. package/src/string/readingTime.ts +1 -1
  241. package/src/string/safeJsonStringify.ts +1 -1
  242. package/src/string/stringify.ts +4 -4
  243. package/src/string/url.util.ts +1 -1
  244. package/src/time/time.util.ts +1 -1
  245. package/src/types.ts +2 -2
  246. package/src/web.ts +1 -1
  247. package/src/zod/index.ts +2 -2
  248. package/src/zod/zod.util.ts +1 -1
  249. package/dist-esm/abort.js +0 -12
  250. package/dist-esm/array/array.util.js +0 -458
  251. package/dist-esm/array/range.js +0 -34
  252. package/dist-esm/bot.js +0 -130
  253. package/dist-esm/browser/adminService.js +0 -94
  254. package/dist-esm/browser/analytics.util.js +0 -54
  255. package/dist-esm/browser/i18n/fetchTranslationLoader.js +0 -13
  256. package/dist-esm/browser/i18n/translation.service.js +0 -56
  257. package/dist-esm/browser/imageFitter.js +0 -65
  258. package/dist-esm/browser/script.util.js +0 -46
  259. package/dist-esm/browser/topbar.js +0 -135
  260. package/dist-esm/datetime/dateInterval.js +0 -80
  261. package/dist-esm/datetime/localDate.js +0 -719
  262. package/dist-esm/datetime/localTime.js +0 -996
  263. package/dist-esm/datetime/timeInterval.js +0 -88
  264. package/dist-esm/datetime/wallTime.js +0 -70
  265. package/dist-esm/decorators/asyncMemo.decorator.js +0 -111
  266. package/dist-esm/decorators/createPromiseDecorator.js +0 -82
  267. package/dist-esm/decorators/debounce.decorator.js +0 -17
  268. package/dist-esm/decorators/debounce.js +0 -114
  269. package/dist-esm/decorators/decorator.util.js +0 -31
  270. package/dist-esm/decorators/logMethod.decorator.js +0 -85
  271. package/dist-esm/decorators/memo.decorator.js +0 -80
  272. package/dist-esm/decorators/memo.util.js +0 -97
  273. package/dist-esm/decorators/memoFn.js +0 -29
  274. package/dist-esm/decorators/memoFnAsync.js +0 -35
  275. package/dist-esm/decorators/memoSimple.decorator.js +0 -55
  276. package/dist-esm/decorators/retry.decorator.js +0 -9
  277. package/dist-esm/decorators/swarmSafe.decorator.js +0 -38
  278. package/dist-esm/decorators/timeout.decorator.js +0 -19
  279. package/dist-esm/define.js +0 -109
  280. package/dist-esm/deviceIdService.js +0 -105
  281. package/dist-esm/enum.util.js +0 -157
  282. package/dist-esm/env/buildInfo.js +0 -19
  283. package/dist-esm/env.js +0 -19
  284. package/dist-esm/error/assert.js +0 -122
  285. package/dist-esm/error/error.model.js +0 -1
  286. package/dist-esm/error/error.util.js +0 -337
  287. package/dist-esm/error/errorMode.js +0 -20
  288. package/dist-esm/error/try.js +0 -105
  289. package/dist-esm/error/tryCatch.js +0 -41
  290. package/dist-esm/form.util.js +0 -16
  291. package/dist-esm/http/fetcher.js +0 -704
  292. package/dist-esm/http/fetcher.model.js +0 -3
  293. package/dist-esm/http/http.model.js +0 -1
  294. package/dist-esm/index.js +0 -96
  295. package/dist-esm/is.util.js +0 -70
  296. package/dist-esm/iter/asyncIterable2.js +0 -103
  297. package/dist-esm/iter/iterable2.js +0 -87
  298. package/dist-esm/json-schema/from-data/generateJsonSchemaFromData.js +0 -86
  299. package/dist-esm/json-schema/jsonSchema.cnst.js +0 -38
  300. package/dist-esm/json-schema/jsonSchema.model.js +0 -1
  301. package/dist-esm/json-schema/jsonSchema.util.js +0 -27
  302. package/dist-esm/json-schema/jsonSchemaBuilder.js +0 -352
  303. package/dist-esm/json-schema/jsonSchemas.js +0 -6
  304. package/dist-esm/log/commonLogger.js +0 -78
  305. package/dist-esm/math/accumulatingAverage.js +0 -32
  306. package/dist-esm/math/math.util.js +0 -85
  307. package/dist-esm/math/sma.js +0 -43
  308. package/dist-esm/math/stack.util.js +0 -82
  309. package/dist-esm/nanoid.js +0 -57
  310. package/dist-esm/number/createDeterministicRandom.js +0 -18
  311. package/dist-esm/number/number.util.js +0 -109
  312. package/dist-esm/object/deepEquals.js +0 -170
  313. package/dist-esm/object/map2.js +0 -21
  314. package/dist-esm/object/object.util.js +0 -435
  315. package/dist-esm/object/set2.js +0 -15
  316. package/dist-esm/object/sortObject.js +0 -21
  317. package/dist-esm/object/sortObjectDeep.js +0 -17
  318. package/dist-esm/polyfill.js +0 -6
  319. package/dist-esm/promise/abortable.js +0 -31
  320. package/dist-esm/promise/pDefer.js +0 -17
  321. package/dist-esm/promise/pDelay.js +0 -37
  322. package/dist-esm/promise/pFilter.js +0 -5
  323. package/dist-esm/promise/pHang.js +0 -6
  324. package/dist-esm/promise/pMap.js +0 -174
  325. package/dist-esm/promise/pProps.js +0 -20
  326. package/dist-esm/promise/pQueue.js +0 -101
  327. package/dist-esm/promise/pRetry.js +0 -64
  328. package/dist-esm/promise/pState.js +0 -14
  329. package/dist-esm/promise/pTimeout.js +0 -64
  330. package/dist-esm/semver.js +0 -149
  331. package/dist-esm/string/case.js +0 -24
  332. package/dist-esm/string/escape.js +0 -49
  333. package/dist-esm/string/hash.util.js +0 -67
  334. package/dist-esm/string/json.util.js +0 -46
  335. package/dist-esm/string/leven.js +0 -77
  336. package/dist-esm/string/lodash/unicodeWords.js +0 -68
  337. package/dist-esm/string/lodash/words.js +0 -31
  338. package/dist-esm/string/pupa.js +0 -54
  339. package/dist-esm/string/readingTime.js +0 -102
  340. package/dist-esm/string/regex.js +0 -6
  341. package/dist-esm/string/safeJsonStringify.js +0 -39
  342. package/dist-esm/string/slugify.js +0 -66
  343. package/dist-esm/string/string.util.js +0 -99
  344. package/dist-esm/string/stringify.js +0 -133
  345. package/dist-esm/string/url.util.js +0 -42
  346. package/dist-esm/time/time.util.js +0 -61
  347. package/dist-esm/typeFest.js +0 -2
  348. package/dist-esm/types.js +0 -66
  349. package/dist-esm/unit/size.util.js +0 -43
  350. package/dist-esm/web.js +0 -40
  351. package/dist-esm/zod/index.js +0 -4
  352. package/dist-esm/zod/zod.shared.schemas.js +0 -92
  353. package/dist-esm/zod/zod.util.js +0 -52
@@ -6,10 +6,10 @@
6
6
  {
7
7
  "compilerOptions": {
8
8
  // Target/module
9
- "target": "es2020", // es2020+ browsers, adjust to your requirements!
9
+ "target": "es2023", // es2023+ browsers, adjust to your requirements!
10
10
  "lib": ["esnext", "dom", "dom.iterable"],
11
11
  "module": "esnext",
12
- "moduleResolution": "node",
12
+ "moduleResolution": "bundler",
13
13
  "moduleDetection": "force",
14
14
  // specifying these explicitly for better IDE compatibility (but they're on by default with module=nodenext)
15
15
  "esModuleInterop": true,
@@ -25,7 +25,7 @@
25
25
  // Otherwise since es2022 it defaults to true
26
26
  // and starts to produce different/unexpected behavior
27
27
  // https://angular.schule/blog/2022-11-use-define-for-class-fields
28
- "useDefineForClassFields": false,
28
+ "useDefineForClassFields": true,
29
29
  "importHelpers": true,
30
30
 
31
31
  // Strictness
package/dist/abort.js CHANGED
@@ -1,13 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createAbortableSignal = createAbortableSignal;
4
1
  /**
5
2
  * Creates AbortableSignal,
6
3
  * which is like AbortSignal, but can "abort itself" with `.abort()` method.
7
4
  *
8
5
  * @experimental
9
6
  */
10
- function createAbortableSignal() {
7
+ export function createAbortableSignal() {
11
8
  const ac = new AbortController();
12
9
  return Object.assign(ac.signal, {
13
10
  abort: ac.abort.bind(ac),
@@ -1,4 +1,4 @@
1
- import type { AbortablePredicate, FalsyValue, Mapper, Predicate, SortDirection, StringMap } from '../types';
1
+ import type { AbortablePredicate, FalsyValue, Mapper, Predicate, SortDirection, StringMap } from '../types.js';
2
2
  /**
3
3
  * Creates an array of elements split into groups the length of size. If collection can’t be split evenly, the
4
4
  * final chunk will be the remaining elements.
@@ -1,46 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._chunk = _chunk;
4
- exports._uniq = _uniq;
5
- exports._pushUniq = _pushUniq;
6
- exports._pushUniqBy = _pushUniqBy;
7
- exports._uniqBy = _uniqBy;
8
- exports._by = _by;
9
- exports._mapBy = _mapBy;
10
- exports._groupBy = _groupBy;
11
- exports._sortBy = _sortBy;
12
- exports._sortDescBy = _sortDescBy;
13
- exports._find = _find;
14
- exports._findLast = _findLast;
15
- exports._takeWhile = _takeWhile;
16
- exports._takeRightWhile = _takeRightWhile;
17
- exports._dropWhile = _dropWhile;
18
- exports._dropRightWhile = _dropRightWhile;
19
- exports._countAtLeast = _countAtLeast;
20
- exports._countLessThan = _countLessThan;
21
- exports._count = _count;
22
- exports._countBy = _countBy;
23
- exports._intersection = _intersection;
24
- exports._intersectsWith = _intersectsWith;
25
- exports._difference = _difference;
26
- exports._sum = _sum;
27
- exports._sumBy = _sumBy;
28
- exports._mapToObject = _mapToObject;
29
- exports._shuffle = _shuffle;
30
- exports._last = _last;
31
- exports._lastOrUndefined = _lastOrUndefined;
32
- exports._first = _first;
33
- exports._minOrUndefined = _minOrUndefined;
34
- exports._min = _min;
35
- exports._maxOrUndefined = _maxOrUndefined;
36
- exports._max = _max;
37
- exports._maxBy = _maxBy;
38
- exports._minBy = _minBy;
39
- exports._maxByOrUndefined = _maxByOrUndefined;
40
- exports._minByOrUndefined = _minByOrUndefined;
41
- exports._zip = _zip;
42
- const assert_1 = require("../error/assert");
43
- const types_1 = require("../types");
1
+ import { _assert } from '../error/assert.js';
2
+ import { END } from '../types.js';
44
3
  /**
45
4
  * Creates an array of elements split into groups the length of size. If collection can’t be split evenly, the
46
5
  * final chunk will be the remaining elements.
@@ -53,7 +12,7 @@ const types_1 = require("../types");
53
12
  *
54
13
  * Based on: https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_chunk
55
14
  */
56
- function _chunk(array, size = 1) {
15
+ export function _chunk(array, size = 1) {
57
16
  const a = [];
58
17
  for (let i = 0; i < array.length; i += size) {
59
18
  a.push(array.slice(i, i + size));
@@ -63,7 +22,7 @@ function _chunk(array, size = 1) {
63
22
  /**
64
23
  * Removes duplicates from given array.
65
24
  */
66
- function _uniq(a) {
25
+ export function _uniq(a) {
67
26
  return [...new Set(a)];
68
27
  }
69
28
  /**
@@ -79,7 +38,7 @@ function _uniq(a) {
79
38
  * // or
80
39
  * a = _uniq([...a, item])
81
40
  */
82
- function _pushUniq(a, ...items) {
41
+ export function _pushUniq(a, ...items) {
83
42
  for (const item of items) {
84
43
  if (!a.includes(item))
85
44
  a.push(item);
@@ -90,7 +49,7 @@ function _pushUniq(a, ...items) {
90
49
  * Like _pushUniq but uses a mapper to determine uniqueness (like _uniqBy).
91
50
  * Mutates the array (same as normal `push`).
92
51
  */
93
- function _pushUniqBy(a, mapper, ...items) {
52
+ export function _pushUniqBy(a, mapper, ...items) {
94
53
  const mappedSet = new Set(a.map((item, i) => mapper(item, i)));
95
54
  items.forEach((item, i) => {
96
55
  const mapped = mapper(item, i);
@@ -118,7 +77,7 @@ function _pushUniqBy(a, mapper, ...items) {
118
77
  *
119
78
  * Based on: https://stackoverflow.com/a/40808569/4919972
120
79
  */
121
- function _uniqBy(arr, mapper) {
80
+ export function _uniqBy(arr, mapper) {
122
81
  const map = new Map();
123
82
  for (const [i, item] of arr.entries()) {
124
83
  const key = item === undefined || item === null ? item : mapper(item, i);
@@ -147,13 +106,13 @@ function _uniqBy(arr, mapper) {
147
106
  *
148
107
  * Returning `undefined` from the Mapper will EXCLUDE the item.
149
108
  */
150
- function _by(items, mapper) {
109
+ export function _by(items, mapper) {
151
110
  return Object.fromEntries(items.map((item, i) => [mapper(item, i), item]).filter(([k]) => k !== undefined));
152
111
  }
153
112
  /**
154
113
  * Map an array of items by a key, that is calculated by a Mapper.
155
114
  */
156
- function _mapBy(items, mapper) {
115
+ export function _mapBy(items, mapper) {
157
116
  return new Map(items.map((item, i) => [mapper(item, i), item]).filter(([k]) => k !== undefined));
158
117
  }
159
118
  /**
@@ -167,7 +126,7 @@ function _mapBy(items, mapper) {
167
126
  *
168
127
  * Returning `undefined` from the Mapper will EXCLUDE the item.
169
128
  */
170
- function _groupBy(items, mapper) {
129
+ export function _groupBy(items, mapper) {
171
130
  const map = {};
172
131
  for (const [i, item] of items.entries()) {
173
132
  const key = mapper(item, i);
@@ -184,7 +143,7 @@ function _groupBy(items, mapper) {
184
143
  * Same:
185
144
  * _sortBy([{age: 20}, {age: 10}], o => o.age)
186
145
  */
187
- function _sortBy(items, mapper, mutate = false, dir = 'asc') {
146
+ export function _sortBy(items, mapper, mutate = false, dir = 'asc') {
188
147
  const mod = dir === 'desc' ? -1 : 1;
189
148
  return (mutate ? items : [...items]).sort((_a, _b) => {
190
149
  const [a, b] = [_a, _b].map(mapper);
@@ -196,7 +155,7 @@ function _sortBy(items, mapper, mutate = false, dir = 'asc') {
196
155
  /**
197
156
  * Alias for _sortBy with descending order.
198
157
  */
199
- function _sortDescBy(items, mapper, mutate = false) {
158
+ export function _sortDescBy(items, mapper, mutate = false) {
200
159
  return _sortBy(items, mapper, mutate, 'desc');
201
160
  }
202
161
  /**
@@ -204,10 +163,10 @@ function _sortDescBy(items, mapper, mutate = false) {
204
163
  *
205
164
  * Use `Array.find` if you don't need to stop the iteration early.
206
165
  */
207
- function _find(items, predicate) {
166
+ export function _find(items, predicate) {
208
167
  for (const [i, item] of items.entries()) {
209
168
  const result = predicate(item, i);
210
- if (result === types_1.END)
169
+ if (result === END)
211
170
  return;
212
171
  if (result)
213
172
  return item;
@@ -220,22 +179,22 @@ function _find(items, predicate) {
220
179
  * - in Node since 18+
221
180
  * - in iOS Safari since 15.4
222
181
  */
223
- function _findLast(items, predicate) {
182
+ export function _findLast(items, predicate) {
224
183
  return _find(items.slice().reverse(), predicate);
225
184
  }
226
- function _takeWhile(items, predicate) {
185
+ export function _takeWhile(items, predicate) {
227
186
  let proceed = true;
228
187
  return items.filter((v, index) => (proceed &&= predicate(v, index)));
229
188
  }
230
- function _takeRightWhile(items, predicate) {
189
+ export function _takeRightWhile(items, predicate) {
231
190
  let proceed = true;
232
191
  return [...items].reverse().filter((v, index) => (proceed &&= predicate(v, index)));
233
192
  }
234
- function _dropWhile(items, predicate) {
193
+ export function _dropWhile(items, predicate) {
235
194
  let proceed = false;
236
195
  return items.filter((v, index) => (proceed ||= !predicate(v, index)));
237
196
  }
238
- function _dropRightWhile(items, predicate) {
197
+ export function _dropRightWhile(items, predicate) {
239
198
  let proceed = false;
240
199
  return [...items]
241
200
  .reverse()
@@ -247,7 +206,7 @@ function _dropRightWhile(items, predicate) {
247
206
  * _count counts how many times the Predicate returns true, and stops
248
207
  * when it reaches the limit.
249
208
  */
250
- function _countAtLeast(items, predicate, limit) {
209
+ export function _countAtLeast(items, predicate, limit) {
251
210
  return _count(items, predicate, limit) >= limit;
252
211
  }
253
212
  /**
@@ -255,7 +214,7 @@ function _countAtLeast(items, predicate, limit) {
255
214
  * _count counts how many times the Predicate returns true, and stops
256
215
  * when it reaches the limit.
257
216
  */
258
- function _countLessThan(items, predicate, limit) {
217
+ export function _countLessThan(items, predicate, limit) {
259
218
  return _count(items, predicate, limit) < limit;
260
219
  }
261
220
  /**
@@ -263,14 +222,14 @@ function _countLessThan(items, predicate, limit) {
263
222
  *
264
223
  * `limit` allows to exit early when limit count is reached, skipping further iterations (perf optimization).
265
224
  */
266
- function _count(items, predicate, limit) {
225
+ export function _count(items, predicate, limit) {
267
226
  if (limit === 0)
268
227
  return 0;
269
228
  let count = 0;
270
229
  let i = 0;
271
230
  for (const item of items) {
272
231
  const r = predicate(item, i++);
273
- if (r === types_1.END)
232
+ if (r === END)
274
233
  break;
275
234
  if (r) {
276
235
  count++;
@@ -280,7 +239,7 @@ function _count(items, predicate, limit) {
280
239
  }
281
240
  return count;
282
241
  }
283
- function _countBy(items, mapper) {
242
+ export function _countBy(items, mapper) {
284
243
  const map = {};
285
244
  let i = 0;
286
245
  for (const item of items) {
@@ -301,7 +260,7 @@ function _countBy(items, mapper) {
301
260
  * _intersection([2, 1], [2, 3])
302
261
  * // [2]
303
262
  */
304
- function _intersection(a1, a2) {
263
+ export function _intersection(a1, a2) {
305
264
  const a2set = a2 instanceof Set ? a2 : new Set(a2);
306
265
  return a1.filter(v => a2set.has(v));
307
266
  }
@@ -313,7 +272,7 @@ function _intersection(a1, a2) {
313
272
  *
314
273
  * Passing second array as Set is more performant (it'll skip turning the array into Set in-place).
315
274
  */
316
- function _intersectsWith(a1, a2) {
275
+ export function _intersectsWith(a1, a2) {
317
276
  const a2set = a2 instanceof Set ? a2 : new Set(a2);
318
277
  return a1.some(v => a2set.has(v));
319
278
  }
@@ -326,21 +285,21 @@ function _intersectsWith(a1, a2) {
326
285
  *
327
286
  * Passing second array as Set is more performant (it'll skip turning the array into Set in-place).
328
287
  */
329
- function _difference(a1, a2) {
288
+ export function _difference(a1, a2) {
330
289
  const a2set = a2 instanceof Set ? a2 : new Set(a2);
331
290
  return a1.filter(v => !a2set.has(v));
332
291
  }
333
292
  /**
334
293
  * Returns the sum of items, or 0 for empty array.
335
294
  */
336
- function _sum(items) {
295
+ export function _sum(items) {
337
296
  let sum = 0;
338
297
  for (const n of items) {
339
298
  sum = (sum + n);
340
299
  }
341
300
  return sum;
342
301
  }
343
- function _sumBy(items, mapper) {
302
+ export function _sumBy(items, mapper) {
344
303
  let sum = 0;
345
304
  let i = 0;
346
305
  for (const n of items) {
@@ -365,7 +324,7 @@ function _sumBy(items, mapper) {
365
324
  * _mapToObject([1, 2, 3], n => [n, `id${n}`])
366
325
  * // { '1': 'id1, '2': 'id2', '3': 'id3' }
367
326
  */
368
- function _mapToObject(array, mapper) {
327
+ export function _mapToObject(array, mapper) {
369
328
  const m = {};
370
329
  for (const item of array) {
371
330
  const r = mapper(item);
@@ -380,7 +339,7 @@ function _mapToObject(array, mapper) {
380
339
  * Fisher–Yates algorithm.
381
340
  * Based on: https://stackoverflow.com/a/12646864/4919972
382
341
  */
383
- function _shuffle(array, mutate = false) {
342
+ export function _shuffle(array, mutate = false) {
384
343
  const a = mutate ? array : [...array];
385
344
  for (let i = a.length - 1; i > 0; i--) {
386
345
  const j = Math.floor(Math.random() * (i + 1));
@@ -392,7 +351,7 @@ function _shuffle(array, mutate = false) {
392
351
  * Returns last item of non-empty array.
393
352
  * Throws if array is empty.
394
353
  */
395
- function _last(array) {
354
+ export function _last(array) {
396
355
  if (!array.length)
397
356
  throw new Error('_last called on empty array');
398
357
  return array[array.length - 1];
@@ -400,19 +359,19 @@ function _last(array) {
400
359
  /**
401
360
  * Returns last item of the array (or undefined if array is empty).
402
361
  */
403
- function _lastOrUndefined(array) {
362
+ export function _lastOrUndefined(array) {
404
363
  return array[array.length - 1];
405
364
  }
406
365
  /**
407
366
  * Returns the first item of non-empty array.
408
367
  * Throws if array is empty.
409
368
  */
410
- function _first(array) {
369
+ export function _first(array) {
411
370
  if (!array.length)
412
371
  throw new Error('_first called on empty array');
413
372
  return array[0];
414
373
  }
415
- function _minOrUndefined(array) {
374
+ export function _minOrUndefined(array) {
416
375
  let min;
417
376
  for (const item of array) {
418
377
  if (item === undefined || item === null)
@@ -426,12 +385,12 @@ function _minOrUndefined(array) {
426
385
  /**
427
386
  * Filters out nullish values (undefined and null).
428
387
  */
429
- function _min(array) {
388
+ export function _min(array) {
430
389
  const min = _minOrUndefined(array);
431
- (0, assert_1._assert)(min !== undefined, '_min called on empty array');
390
+ _assert(min !== undefined, '_min called on empty array');
432
391
  return min;
433
392
  }
434
- function _maxOrUndefined(array) {
393
+ export function _maxOrUndefined(array) {
435
394
  let max;
436
395
  for (const item of array) {
437
396
  if (item === undefined || item === null)
@@ -445,23 +404,23 @@ function _maxOrUndefined(array) {
445
404
  /**
446
405
  * Filters out nullish values (undefined and null).
447
406
  */
448
- function _max(array) {
407
+ export function _max(array) {
449
408
  const max = _maxOrUndefined(array);
450
- (0, assert_1._assert)(max !== undefined, '_max called on empty array');
409
+ _assert(max !== undefined, '_max called on empty array');
451
410
  return max;
452
411
  }
453
- function _maxBy(array, mapper) {
412
+ export function _maxBy(array, mapper) {
454
413
  const max = _maxByOrUndefined(array, mapper);
455
- (0, assert_1._assert)(max !== undefined, '_maxBy returned undefined');
414
+ _assert(max !== undefined, '_maxBy returned undefined');
456
415
  return max;
457
416
  }
458
- function _minBy(array, mapper) {
417
+ export function _minBy(array, mapper) {
459
418
  const min = _minByOrUndefined(array, mapper);
460
- (0, assert_1._assert)(min !== undefined, '_minBy returned undefined');
419
+ _assert(min !== undefined, '_minBy returned undefined');
461
420
  return min;
462
421
  }
463
422
  // todo: looks like it _maxByOrUndefined/_minByOrUndefined can be DRYer
464
- function _maxByOrUndefined(array, mapper) {
423
+ export function _maxByOrUndefined(array, mapper) {
465
424
  if (!array.length)
466
425
  return;
467
426
  let maxItem;
@@ -475,7 +434,7 @@ function _maxByOrUndefined(array, mapper) {
475
434
  }
476
435
  return maxItem;
477
436
  }
478
- function _minByOrUndefined(array, mapper) {
437
+ export function _minByOrUndefined(array, mapper) {
479
438
  if (!array.length)
480
439
  return;
481
440
  let minItem;
@@ -489,7 +448,7 @@ function _minByOrUndefined(array, mapper) {
489
448
  }
490
449
  return minItem;
491
450
  }
492
- function _zip(array1, array2) {
451
+ export function _zip(array1, array2) {
493
452
  const len = Math.min(array1.length, array2.length);
494
453
  const res = [];
495
454
  for (let i = 0; i < len; i++) {
@@ -1,5 +1,5 @@
1
- import { AsyncIterable2 } from '../iter/asyncIterable2';
2
- import { Iterable2 } from '../iter/iterable2';
1
+ import { AsyncIterable2 } from '../iter/asyncIterable2.js';
2
+ import { Iterable2 } from '../iter/iterable2.js';
3
3
  /**
4
4
  * Returns an array with ranges from `from` up to (but not including) `to`.
5
5
  *
@@ -1,22 +1,17 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports._range = _range;
4
- exports._rangeIterable = _rangeIterable;
5
- exports._rangeAsyncIterable = _rangeAsyncIterable;
6
- const asyncIterable2_1 = require("../iter/asyncIterable2");
7
- const iterable2_1 = require("../iter/iterable2");
8
- function _range(fromIncl, toExcl, step = 1) {
1
+ import { AsyncIterable2 } from '../iter/asyncIterable2.js';
2
+ import { Iterable2 } from '../iter/iterable2.js';
3
+ export function _range(fromIncl, toExcl, step = 1) {
9
4
  if (toExcl === undefined) {
10
5
  return Array.from(new Array(fromIncl), (_, i) => i);
11
6
  }
12
7
  return Array.from({ length: Math.ceil((toExcl - fromIncl) / step) }, (_, i) => i * step + fromIncl);
13
8
  }
14
- function _rangeIterable(fromIncl, toExcl, step = 1) {
9
+ export function _rangeIterable(fromIncl, toExcl, step = 1) {
15
10
  if (toExcl === undefined) {
16
11
  toExcl = fromIncl;
17
12
  fromIncl = 0;
18
13
  }
19
- return iterable2_1.Iterable2.of({
14
+ return Iterable2.of({
20
15
  *[Symbol.iterator]() {
21
16
  for (let i = fromIncl; i < toExcl; i += step) {
22
17
  yield i;
@@ -24,12 +19,12 @@ function _rangeIterable(fromIncl, toExcl, step = 1) {
24
19
  },
25
20
  });
26
21
  }
27
- function _rangeAsyncIterable(fromIncl, toExcl, step = 1) {
22
+ export function _rangeAsyncIterable(fromIncl, toExcl, step = 1) {
28
23
  if (toExcl === undefined) {
29
24
  toExcl = fromIncl;
30
25
  fromIncl = 0;
31
26
  }
32
- return asyncIterable2_1.AsyncIterable2.of({
27
+ return AsyncIterable2.of({
33
28
  async *[Symbol.asyncIterator]() {
34
29
  for (let i = fromIncl; i < toExcl; i += step) {
35
30
  yield i;
package/dist/bot.js CHANGED
@@ -1,16 +1,13 @@
1
- "use strict";
2
1
  // Relevant material:
3
2
  // https://deviceandbrowserinfo.com/learning_zone/articles/detecting-headless-chrome-puppeteer-2024
4
- Object.defineProperty(exports, "__esModule", { value: true });
5
- exports.BotReason = exports.BotDetectionService = void 0;
6
- const env_1 = require("./env");
3
+ import { isServerSide } from './env.js';
7
4
  const botRegex = /bot|spider|crawl|headless|electron|phantom|slimer|proximic|cincraw|slurp|MicrosoftPreview|ahrefs|preview|lighthouse|facebookexternal|pinterest|screaming|apis-google|duplexweb-google|feedfetcher-google|google-read-aloud|googleweblight|mediapartners-google/i;
8
5
  /**
9
6
  * Service to detect bots and CDP (Chrome DevTools Protocol).
10
7
  *
11
8
  * @experimental
12
9
  */
13
- class BotDetectionService {
10
+ export class BotDetectionService {
14
11
  cfg;
15
12
  constructor(cfg = {}) {
16
13
  this.cfg = cfg;
@@ -39,7 +36,7 @@ class BotDetectionService {
39
36
  }
40
37
  detectBotReason() {
41
38
  // SSR - not a bot
42
- if ((0, env_1.isServerSide)())
39
+ if (isServerSide())
43
40
  return null;
44
41
  const { navigator } = globalThis;
45
42
  if (!navigator)
@@ -96,7 +93,7 @@ class BotDetectionService {
96
93
  return this.cdp;
97
94
  }
98
95
  detectCDP() {
99
- if ((0, env_1.isServerSide)())
96
+ if (isServerSide())
100
97
  return false;
101
98
  let cdpCheck1 = false;
102
99
  try {
@@ -120,8 +117,7 @@ class BotDetectionService {
120
117
  return cdpCheck1;
121
118
  }
122
119
  }
123
- exports.BotDetectionService = BotDetectionService;
124
- var BotReason;
120
+ export var BotReason;
125
121
  (function (BotReason) {
126
122
  BotReason[BotReason["NoNavigator"] = 1] = "NoNavigator";
127
123
  BotReason[BotReason["NoUserAgent"] = 2] = "NoUserAgent";
@@ -135,4 +131,4 @@ var BotReason;
135
131
  * By default it's not.
136
132
  */
137
133
  BotReason[BotReason["CDP"] = 8] = "CDP";
138
- })(BotReason || (exports.BotReason = BotReason = {}));
134
+ })(BotReason || (BotReason = {}));
@@ -1,4 +1,4 @@
1
- import type { Promisable } from '../typeFest';
1
+ import type { Promisable } from '../typeFest.js';
2
2
  export interface AdminModeCfg {
3
3
  /**
4
4
  * Function (predicate) to detect if needed keys are pressed.
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AdminService = void 0;
4
- const tslib_1 = require("tslib");
5
- const memo_decorator_1 = require("../decorators/memo.decorator");
6
- const env_1 = require("../env");
7
- const stringify_1 = require("../string/stringify");
1
+ import { __decorate } from "tslib";
2
+ import { _Memo } from '../decorators/memo.decorator.js';
3
+ import { isServerSide } from '../env.js';
4
+ import { _stringify } from '../string/stringify.js';
8
5
  const RED_DOT_ID = '__red-dot__';
9
6
  const NOOP = () => { };
10
7
  /**
@@ -15,7 +12,7 @@ const NOOP = () => { };
15
12
  *
16
13
  * todo: help with Authentication
17
14
  */
18
- class AdminService {
15
+ export class AdminService {
19
16
  constructor(cfg) {
20
17
  this.cfg = {
21
18
  predicate: e => e.ctrlKey && e.key === 'L',
@@ -35,7 +32,7 @@ class AdminService {
35
32
  * Start listening to keyboard events to toggle AdminMode when detected.
36
33
  */
37
34
  startListening() {
38
- if (this.listening || (0, env_1.isServerSide)())
35
+ if (this.listening || isServerSide())
39
36
  return;
40
37
  this.adminMode = !!localStorage.getItem(this.cfg.localStorageKey);
41
38
  if (this.adminMode)
@@ -44,7 +41,7 @@ class AdminService {
44
41
  this.listening = true;
45
42
  }
46
43
  stopListening() {
47
- if ((0, env_1.isServerSide)())
44
+ if (isServerSide())
48
45
  return;
49
46
  document.removeEventListener('keydown', this.keydownListener);
50
47
  this.listening = false;
@@ -64,7 +61,7 @@ class AdminService {
64
61
  catch (err) {
65
62
  console.error(err);
66
63
  // ok to show alert to Admins, it's not user-facing
67
- alert((0, stringify_1._stringify)(err));
64
+ alert(_stringify(err));
68
65
  return; // treat as "not allowed"
69
66
  }
70
67
  this.adminMode = !this.adminMode;
@@ -93,7 +90,6 @@ class AdminService {
93
90
  return el;
94
91
  }
95
92
  }
96
- exports.AdminService = AdminService;
97
- tslib_1.__decorate([
98
- (0, memo_decorator_1._Memo)()
93
+ __decorate([
94
+ _Memo()
99
95
  ], AdminService.prototype, "getRedDotElement", null);
@@ -1,16 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadGTag = loadGTag;
4
- exports.loadGTM = loadGTM;
5
- exports.loadHotjar = loadHotjar;
6
- const js_lib_1 = require("@naturalcycles/js-lib");
7
- const script_util_1 = require("./script.util");
1
+ import { isServerSide } from '../index.js';
2
+ import { loadScript } from './script.util.js';
8
3
  /* eslint-disable unicorn/prefer-global-this */
9
4
  /**
10
5
  * Pass enabled = false to only init window.gtag, but not load actual gtag script (e.g in dev mode).
11
6
  */
12
- async function loadGTag(gtagId, enabled = true) {
13
- if ((0, js_lib_1.isServerSide)())
7
+ export async function loadGTag(gtagId, enabled = true) {
8
+ if (isServerSide())
14
9
  return;
15
10
  window.dataLayer ||= [];
16
11
  window.gtag ||= function gtag() {
@@ -22,10 +17,10 @@ async function loadGTag(gtagId, enabled = true) {
22
17
  window.gtag('config', gtagId);
23
18
  if (!enabled)
24
19
  return;
25
- await (0, script_util_1.loadScript)(`https://www.googletagmanager.com/gtag/js?id=${gtagId}`);
20
+ await loadScript(`https://www.googletagmanager.com/gtag/js?id=${gtagId}`);
26
21
  }
27
- async function loadGTM(gtmId, enabled = true) {
28
- if ((0, js_lib_1.isServerSide)())
22
+ export async function loadGTM(gtmId, enabled = true) {
23
+ if (isServerSide())
29
24
  return;
30
25
  window.dataLayer ||= [];
31
26
  window.dataLayer.push({
@@ -34,10 +29,10 @@ async function loadGTM(gtmId, enabled = true) {
34
29
  });
35
30
  if (!enabled)
36
31
  return;
37
- await (0, script_util_1.loadScript)(`https://www.googletagmanager.com/gtm.js?id=${gtmId}`);
32
+ await loadScript(`https://www.googletagmanager.com/gtm.js?id=${gtmId}`);
38
33
  }
39
- function loadHotjar(hjid) {
40
- if ((0, js_lib_1.isServerSide)())
34
+ export function loadHotjar(hjid) {
35
+ if (isServerSide())
41
36
  return;
42
37
  ;
43
38
  ((h, o, t, j, a, r) => {
@@ -1,6 +1,6 @@
1
- import type { Fetcher } from '../../http/fetcher';
2
- import type { StringMap } from '../../types';
3
- import type { TranslationLoader } from './translation.service';
1
+ import type { Fetcher } from '../../http/fetcher.js';
2
+ import type { StringMap } from '../../types.js';
3
+ import type { TranslationLoader } from './translation.service.js';
4
4
  /**
5
5
  * Use `baseUrl` to prefix your language files.
6
6
  * Example URL structure:
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.FetchTranslationLoader = void 0;
4
1
  /**
5
2
  * Use `baseUrl` to prefix your language files.
6
3
  * Example URL structure:
7
4
  * ${baseUrl}/${locale}.json
8
5
  */
9
- class FetchTranslationLoader {
6
+ export class FetchTranslationLoader {
10
7
  fetcher;
11
8
  constructor(fetcher) {
12
9
  this.fetcher = fetcher;
@@ -15,4 +12,3 @@ class FetchTranslationLoader {
15
12
  return await this.fetcher.get(`${locale}.json`);
16
13
  }
17
14
  }
18
- exports.FetchTranslationLoader = FetchTranslationLoader;
@@ -1,4 +1,4 @@
1
- import type { StringMap } from '../../types';
1
+ import type { StringMap } from '../../types.js';
2
2
  export type MissingTranslationHandler = (key: string, params?: StringMap<any>) => string;
3
3
  export declare const defaultMissingTranslationHandler: MissingTranslationHandler;
4
4
  export interface TranslationServiceCfg {