@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
@@ -1,17 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TranslationService = exports.defaultMissingTranslationHandler = void 0;
4
- const pMap_1 = require("../../promise/pMap");
5
- const defaultMissingTranslationHandler = key => {
1
+ import { pMap } from '../../promise/pMap.js';
2
+ export const defaultMissingTranslationHandler = key => {
6
3
  console.warn(`[tr] missing: ${key}`);
7
4
  return `[${key}]`;
8
5
  };
9
- exports.defaultMissingTranslationHandler = defaultMissingTranslationHandler;
10
- class TranslationService {
6
+ export class TranslationService {
11
7
  constructor(cfg, preloadedLocales = {}) {
12
8
  this.cfg = {
13
9
  ...cfg,
14
- missingTranslationHandler: exports.defaultMissingTranslationHandler,
10
+ missingTranslationHandler: defaultMissingTranslationHandler,
15
11
  };
16
12
  this.locales = {
17
13
  ...preloadedLocales,
@@ -39,7 +35,7 @@ class TranslationService {
39
35
  */
40
36
  async loadLocale(locale) {
41
37
  const locales = Array.isArray(locale) ? locale : [locale];
42
- await (0, pMap_1.pMap)(locales, async (locale) => {
38
+ await pMap(locales, async (locale) => {
43
39
  if (this.locales[locale])
44
40
  return; // already loaded
45
41
  this.locales[locale] = await this.cfg.translationLoader.load(locale);
@@ -64,4 +60,3 @@ class TranslationService {
64
60
  return this.locales[this.currentLocale]?.[key] || this.locales[this.cfg.defaultLocale]?.[key];
65
61
  }
66
62
  }
67
- exports.TranslationService = TranslationService;
@@ -1,6 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ImageFitter = void 0;
4
1
  /**
5
2
  * Calculates the width/height of the images to fit in the layout.
6
3
  *
@@ -8,7 +5,7 @@ exports.ImageFitter = void 0;
8
5
  *
9
6
  * @experimental
10
7
  */
11
- class ImageFitter {
8
+ export class ImageFitter {
12
9
  constructor(cfg) {
13
10
  this.cfg = {
14
11
  maxHeight: 300,
@@ -68,4 +65,3 @@ class ImageFitter {
68
65
  });
69
66
  }
70
67
  }
71
- exports.ImageFitter = ImageFitter;
@@ -1,18 +1,14 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loadScript = loadScript;
4
- exports.loadCSS = loadCSS;
5
- const env_1 = require("../env");
6
- const types_1 = require("../types");
1
+ import { isServerSide } from '../env.js';
2
+ import { _objectAssign } from '../types.js';
7
3
  /**
8
4
  * opt.async defaults to `true`.
9
5
  * No other options are set by default.
10
6
  */
11
- async function loadScript(src, opt) {
12
- if ((0, env_1.isServerSide)())
7
+ export async function loadScript(src, opt) {
8
+ if (isServerSide())
13
9
  return;
14
10
  return await new Promise((resolve, reject) => {
15
- const s = (0, types_1._objectAssign)(document.createElement('script'), {
11
+ const s = _objectAssign(document.createElement('script'), {
16
12
  src,
17
13
  async: true,
18
14
  ...opt,
@@ -30,11 +26,11 @@ async function loadScript(src, opt) {
30
26
  *
31
27
  * No other options are set by default.
32
28
  */
33
- async function loadCSS(href, opt) {
34
- if ((0, env_1.isServerSide)())
29
+ export async function loadCSS(href, opt) {
30
+ if (isServerSide())
35
31
  return;
36
32
  return await new Promise((resolve, reject) => {
37
- const link = (0, types_1._objectAssign)(document.createElement('link'), {
33
+ const link = _objectAssign(document.createElement('link'), {
38
34
  href,
39
35
  rel: 'stylesheet',
40
36
  // type seems to be unnecessary: https://stackoverflow.com/a/5409146/4919972
@@ -1,9 +1,6 @@
1
- "use strict";
2
1
  // Modified version of topbar:
3
2
  // http://buunguyen.github.io/topbar
4
3
  /* eslint-disable */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.topbar = void 0;
7
4
  const browser = typeof window !== 'undefined';
8
5
  let canvas;
9
6
  let progressTimerId;
@@ -60,7 +57,7 @@ const createCanvas = () => {
60
57
  document.body.appendChild(canvas);
61
58
  addEvent(window, 'resize', repaint);
62
59
  };
63
- exports.topbar = {
60
+ export const topbar = {
64
61
  config(opts) {
65
62
  for (const key in opts) {
66
63
  if (options.hasOwnProperty(key)) {
@@ -71,17 +68,17 @@ exports.topbar = {
71
68
  },
72
69
  set(show, opts) {
73
70
  if (show) {
74
- exports.topbar.show(opts);
71
+ topbar.show(opts);
75
72
  }
76
73
  else {
77
- exports.topbar.hide();
74
+ topbar.hide();
78
75
  }
79
76
  },
80
77
  show(opts) {
81
78
  if (!browser)
82
79
  return; // ssr protection
83
80
  if (opts)
84
- exports.topbar.config(opts);
81
+ topbar.config(opts);
85
82
  if (showing)
86
83
  return;
87
84
  showing = true;
@@ -92,12 +89,12 @@ exports.topbar = {
92
89
  createCanvas();
93
90
  canvas.style.opacity = 1;
94
91
  canvas.style.display = 'block';
95
- exports.topbar.progress(0);
92
+ topbar.progress(0);
96
93
  if (options.autoRun) {
97
94
  ;
98
95
  (function loop() {
99
96
  progressTimerId = window.requestAnimationFrame(loop);
100
- exports.topbar.progress('+' + 0.05 * (1 - Math.sqrt(currentProgress)) ** 2);
97
+ topbar.progress('+' + 0.05 * (1 - Math.sqrt(currentProgress)) ** 2);
101
98
  })();
102
99
  }
103
100
  },
@@ -124,7 +121,7 @@ exports.topbar = {
124
121
  }
125
122
  ;
126
123
  (function loop() {
127
- if (exports.topbar.progress('+.1') >= 1) {
124
+ if (topbar.progress('+.1') >= 1) {
128
125
  canvas.style.opacity -= 0.05;
129
126
  if (canvas.style.opacity <= 0.05) {
130
127
  canvas.style.display = 'none';
@@ -1,5 +1,5 @@
1
- import type { Inclusiveness } from '../types';
2
- import type { LocalDate, LocalDateInput, LocalDateUnit } from './localDate';
1
+ import type { Inclusiveness } from '../types.js';
2
+ import type { LocalDate, LocalDateInput, LocalDateUnit } from './localDate.js';
3
3
  export type DateIntervalConfig = DateInterval | DateIntervalString;
4
4
  export type DateIntervalString = string;
5
5
  /**
@@ -1,13 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DateInterval = void 0;
4
- const localDate_1 = require("./localDate");
1
+ import { localDate } from './localDate.js';
5
2
  /**
6
3
  * Class that supports ISO8601 "Time interval" standard that looks like `2022-02-24/2022-03-30`.
7
4
  *
8
5
  * @experimental
9
6
  */
10
- class DateInterval {
7
+ export class DateInterval {
11
8
  start;
12
9
  end;
13
10
  constructor(start, end) {
@@ -15,7 +12,7 @@ class DateInterval {
15
12
  this.end = end;
16
13
  }
17
14
  static of(start, end) {
18
- return new DateInterval((0, localDate_1.localDate)(start), (0, localDate_1.localDate)(end));
15
+ return new DateInterval(localDate(start), localDate(end));
19
16
  }
20
17
  /**
21
18
  * Parses string like `2022-02-24/2023-03-30` into a DateInterval.
@@ -27,7 +24,7 @@ class DateInterval {
27
24
  if (!end || !start) {
28
25
  throw new Error(`Cannot parse "${d}" into DateInterval`);
29
26
  }
30
- return new DateInterval((0, localDate_1.localDate)(start), (0, localDate_1.localDate)(end));
27
+ return new DateInterval(localDate(start), localDate(end));
31
28
  }
32
29
  isSame(d) {
33
30
  return this.cmp(d) === 0;
@@ -50,7 +47,7 @@ class DateInterval {
50
47
  * Ranges of DateInterval (start, end) are INCLUSIVE.
51
48
  */
52
49
  includes(d, incl = '[]') {
53
- d = (0, localDate_1.localDate)(d);
50
+ d = localDate(d);
54
51
  // eslint-disable-next-line @typescript-eslint/prefer-string-starts-ends-with
55
52
  return d.isAfter(this.start, incl[0] === '[') && d.isBefore(this.end, incl[1] === ']');
56
53
  }
@@ -68,13 +65,13 @@ class DateInterval {
68
65
  return this.start.compare(d.start) || this.end.compare(d.end);
69
66
  }
70
67
  getDays(incl = '[]') {
71
- return localDate_1.localDate.range(this.start, this.end, incl, 1, 'day');
68
+ return localDate.range(this.start, this.end, incl, 1, 'day');
72
69
  }
73
70
  /**
74
71
  * Returns an array of LocalDates that are included in the interval.
75
72
  */
76
73
  range(incl = '[]', step = 1, stepUnit = 'day') {
77
- return localDate_1.localDate.range(this.start, this.end, incl, step, stepUnit);
74
+ return localDate.range(this.start, this.end, incl, step, stepUnit);
78
75
  }
79
76
  toString() {
80
77
  return [this.start, this.end].join('/');
@@ -83,4 +80,3 @@ class DateInterval {
83
80
  return this.toString();
84
81
  }
85
82
  }
86
- exports.DateInterval = DateInterval;
@@ -1,6 +1,6 @@
1
- import { Iterable2 } from '../iter/iterable2';
2
- import type { Inclusiveness, IsoDate, IsoDateTime, MonthId, SortDirection, UnixTimestamp, UnixTimestampMillis } from '../types';
3
- import type { DateObject, ISODayOfWeek, LocalTime } from './localTime';
1
+ import { Iterable2 } from '../iter/iterable2.js';
2
+ import type { Inclusiveness, IsoDate, IsoDateTime, MonthId, SortDirection, UnixTimestamp, UnixTimestampMillis } from '../types.js';
3
+ import type { DateObject, ISODayOfWeek, LocalTime } from './localTime.js';
4
4
  export type LocalDateUnit = LocalDateUnitStrict | 'week';
5
5
  export type LocalDateUnitStrict = 'year' | 'month' | 'day';
6
6
  export type LocalDateInput = LocalDate | Date | IsoDate;
@@ -1,9 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.localDate = exports.LocalDate = void 0;
4
- const assert_1 = require("../error/assert");
5
- const iterable2_1 = require("../iter/iterable2");
6
- const localTime_1 = require("./localTime");
1
+ import { _assert } from '../error/assert.js';
2
+ import { Iterable2 } from '../iter/iterable2.js';
3
+ import { localTime, VALID_DAYS_OF_WEEK } from './localTime.js';
7
4
  const MDAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
8
5
  /**
9
6
  * Regex is open-ended (no $ at the end) to support e.g Date+Time string to be parsed (time part will be dropped)
@@ -14,7 +11,7 @@ const COMPACT_DATE_REGEX = /^(\d\d\d\d)(\d\d)(\d\d)$/;
14
11
  * LocalDate represents a date without time.
15
12
  * It is timezone-independent.
16
13
  */
17
- class LocalDate {
14
+ export class LocalDate {
18
15
  year;
19
16
  month;
20
17
  day;
@@ -57,7 +54,7 @@ class LocalDate {
57
54
  * relation to `this`.
58
55
  */
59
56
  setDayOfWeek(dow) {
60
- (0, assert_1._assert)(localTime_1.VALID_DAYS_OF_WEEK.has(dow), `Invalid dayOfWeek: ${dow}`);
57
+ _assert(VALID_DAYS_OF_WEEK.has(dow), `Invalid dayOfWeek: ${dow}`);
61
58
  const delta = dow - this.dayOfWeek;
62
59
  return this.plus(delta, 'day');
63
60
  }
@@ -67,14 +64,14 @@ class LocalDate {
67
64
  * If this LocalDate is Monday, and desired DoW is also Monday - `this` is returned.
68
65
  */
69
66
  setNextDayOfWeek(dow) {
70
- (0, assert_1._assert)(localTime_1.VALID_DAYS_OF_WEEK.has(dow), `Invalid dayOfWeek: ${dow}`);
67
+ _assert(VALID_DAYS_OF_WEEK.has(dow), `Invalid dayOfWeek: ${dow}`);
71
68
  let delta = dow - this.dayOfWeek;
72
69
  if (delta < 0)
73
70
  delta += 7;
74
71
  return this.plus(delta, 'day');
75
72
  }
76
73
  isSame(d) {
77
- d = exports.localDate.fromInput(d);
74
+ d = localDate.fromInput(d);
78
75
  return this.day === d.day && this.month === d.month && this.year === d.year;
79
76
  }
80
77
  isBefore(d, inclusive = false) {
@@ -111,13 +108,13 @@ class LocalDate {
111
108
  * Third argument allows to override "today".
112
109
  */
113
110
  isOlderThan(n, unit, today) {
114
- return this.isBefore(exports.localDate.fromInput(today || new Date()).plus(-n, unit));
111
+ return this.isBefore(localDate.fromInput(today || new Date()).plus(-n, unit));
115
112
  }
116
113
  /**
117
114
  * Checks if this localDate is same or older (<=) than "today" by X units.
118
115
  */
119
116
  isSameOrOlderThan(n, unit, today) {
120
- return this.isSameOrBefore(exports.localDate.fromInput(today || new Date()).plus(-n, unit));
117
+ return this.isSameOrBefore(localDate.fromInput(today || new Date()).plus(-n, unit));
121
118
  }
122
119
  /**
123
120
  * Checks if this localDate is younger (>) than "today" by X units.
@@ -129,28 +126,28 @@ class LocalDate {
129
126
  * Third argument allows to override "today".
130
127
  */
131
128
  isYoungerThan(n, unit, today) {
132
- return this.isAfter(exports.localDate.fromInput(today || new Date()).plus(-n, unit));
129
+ return this.isAfter(localDate.fromInput(today || new Date()).plus(-n, unit));
133
130
  }
134
131
  /**
135
132
  * Checks if this localDate is same or younger (>=) than "today" by X units.
136
133
  */
137
134
  isSameOrYoungerThan(n, unit, today) {
138
- return this.isSameOrAfter(exports.localDate.fromInput(today || new Date()).plus(-n, unit));
135
+ return this.isSameOrAfter(localDate.fromInput(today || new Date()).plus(-n, unit));
139
136
  }
140
137
  isToday() {
141
- return this.isSame(exports.localDate.today());
138
+ return this.isSame(localDate.today());
142
139
  }
143
140
  isAfterToday() {
144
- return this.isAfter(exports.localDate.today());
141
+ return this.isAfter(localDate.today());
145
142
  }
146
143
  isSameOrAfterToday() {
147
- return this.isSameOrAfter(exports.localDate.today());
144
+ return this.isSameOrAfter(localDate.today());
148
145
  }
149
146
  isBeforeToday() {
150
- return this.isBefore(exports.localDate.today());
147
+ return this.isBefore(localDate.today());
151
148
  }
152
149
  isSameOrBeforeToday() {
153
- return this.isSameOrBefore(exports.localDate.today());
150
+ return this.isSameOrBefore(localDate.today());
154
151
  }
155
152
  getAgeInYears(today) {
156
153
  return this.getAgeIn('year', today);
@@ -162,7 +159,7 @@ class LocalDate {
162
159
  return this.getAgeIn('day', today);
163
160
  }
164
161
  getAgeIn(unit, today) {
165
- return exports.localDate.fromInput(today || new Date()).diff(this, unit);
162
+ return localDate.fromInput(today || new Date()).diff(this, unit);
166
163
  }
167
164
  /**
168
165
  * Returns 1 if this > d
@@ -170,7 +167,7 @@ class LocalDate {
170
167
  * returns -1 if this < d
171
168
  */
172
169
  compare(d) {
173
- d = exports.localDate.fromInput(d);
170
+ d = localDate.fromInput(d);
174
171
  if (this.year < d.year)
175
172
  return -1;
176
173
  if (this.year > d.year)
@@ -197,7 +194,7 @@ class LocalDate {
197
194
  * a.diff(b) means "a minus b"
198
195
  */
199
196
  diff(d, unit) {
200
- d = exports.localDate.fromInput(d);
197
+ d = localDate.fromInput(d);
201
198
  const sign = this.compare(d);
202
199
  if (!sign)
203
200
  return 0;
@@ -208,8 +205,8 @@ class LocalDate {
208
205
  if (big.month < small.month ||
209
206
  (big.month === small.month &&
210
207
  big.day < small.day &&
211
- !(big.day === exports.localDate.getMonthLength(big.year, big.month) &&
212
- small.day === exports.localDate.getMonthLength(small.year, small.month)))) {
208
+ !(big.day === localDate.getMonthLength(big.year, big.month) &&
209
+ small.day === localDate.getMonthLength(small.year, small.month)))) {
213
210
  years--;
214
211
  }
215
212
  return years * sign || 0;
@@ -217,7 +214,7 @@ class LocalDate {
217
214
  if (unit === 'month') {
218
215
  let months = (big.year - small.year) * 12 + (big.month - small.month);
219
216
  if (big.day < small.day) {
220
- const bigMonthLen = exports.localDate.getMonthLength(big.year, big.month);
217
+ const bigMonthLen = localDate.getMonthLength(big.year, big.month);
221
218
  if (big.day !== bigMonthLen || small.day < bigMonthLen) {
222
219
  months--;
223
220
  }
@@ -229,16 +226,16 @@ class LocalDate {
229
226
  // If small date is after 1st of March - next year's "leapness" should be used
230
227
  const offsetYear = small.month >= 3 ? 1 : 0;
231
228
  for (let year = small.year; year < big.year; year++) {
232
- days += exports.localDate.getYearLength(year + offsetYear);
229
+ days += localDate.getYearLength(year + offsetYear);
233
230
  }
234
231
  if (small.month < big.month) {
235
232
  for (let month = small.month; month < big.month; month++) {
236
- days += exports.localDate.getMonthLength(big.year, month);
233
+ days += localDate.getMonthLength(big.year, month);
237
234
  }
238
235
  }
239
236
  else if (big.month < small.month) {
240
237
  for (let month = big.month; month < small.month; month++) {
241
- days -= exports.localDate.getMonthLength(big.year, month);
238
+ days -= localDate.getMonthLength(big.year, month);
242
239
  }
243
240
  }
244
241
  if (unit === 'week') {
@@ -304,11 +301,11 @@ class LocalDate {
304
301
  year -= 1;
305
302
  month += 12;
306
303
  }
307
- day += exports.localDate.getMonthLength(year, month);
304
+ day += localDate.getMonthLength(year, month);
308
305
  }
309
306
  }
310
307
  else {
311
- let monLen = exports.localDate.getMonthLength(year, month);
308
+ let monLen = localDate.getMonthLength(year, month);
312
309
  if (unit !== 'day') {
313
310
  if (day > monLen) {
314
311
  // Case of 2022-05-31 plus 1 month should be 2022-06-30, not 31
@@ -323,7 +320,7 @@ class LocalDate {
323
320
  year += 1;
324
321
  month -= 12;
325
322
  }
326
- monLen = exports.localDate.getMonthLength(year, month);
323
+ monLen = localDate.getMonthLength(year, month);
327
324
  }
328
325
  }
329
326
  }
@@ -350,7 +347,7 @@ class LocalDate {
350
347
  if (unit === 'day')
351
348
  return this;
352
349
  if (unit === 'month') {
353
- return new LocalDate(this.year, this.month, exports.localDate.getMonthLength(this.year, this.month));
350
+ return new LocalDate(this.year, this.month, localDate.getMonthLength(this.year, this.month));
354
351
  }
355
352
  // year
356
353
  return new LocalDate(this.year, 12, 31);
@@ -360,7 +357,7 @@ class LocalDate {
360
357
  * E.g 31 for January.
361
358
  */
362
359
  get daysInMonth() {
363
- return exports.localDate.getMonthLength(this.year, this.month);
360
+ return localDate.getMonthLength(this.year, this.month);
364
361
  }
365
362
  clone() {
366
363
  return new LocalDate(this.year, this.month, this.day);
@@ -393,7 +390,7 @@ class LocalDate {
393
390
  * LocalTime's Date will be in local timezone.
394
391
  */
395
392
  toLocalTime() {
396
- return localTime_1.localTime.fromDate(this.toDate());
393
+ return localTime.fromDate(this.toDate());
397
394
  }
398
395
  /**
399
396
  * Returns e.g: `1984-06-21`
@@ -460,7 +457,6 @@ class LocalDate {
460
457
  return fmt(this);
461
458
  }
462
459
  }
463
- exports.LocalDate = LocalDate;
464
460
  class LocalDateFactory {
465
461
  /**
466
462
  * Creates a LocalDate from the input, unless it's falsy - then returns undefined.
@@ -566,7 +562,7 @@ class LocalDateFactory {
566
562
  */
567
563
  parseToLocalDate(regex, s) {
568
564
  const ld = this.parseToLocalDateOrUndefined(regex, s);
569
- (0, assert_1._assert)(ld, `Cannot parse "${s}" into LocalDate`);
565
+ _assert(ld, `Cannot parse "${s}" into LocalDate`);
570
566
  return ld;
571
567
  }
572
568
  /**
@@ -589,7 +585,7 @@ class LocalDateFactory {
589
585
  * Throws on invalid value.
590
586
  */
591
587
  validateDateObject(o) {
592
- (0, assert_1._assert)(this.isDateObjectValid(o), `Cannot construct LocalDate from: ${o.year}-${o.month}-${o.day}`);
588
+ _assert(this.isDateObjectValid(o), `Cannot construct LocalDate from: ${o.year}-${o.month}-${o.day}`);
593
589
  }
594
590
  isDateObjectValid({ year, month, day }) {
595
591
  return (!!year && month >= 1 && month <= 12 && day >= 1 && day <= this.getMonthLength(year, month));
@@ -599,7 +595,7 @@ class LocalDateFactory {
599
595
  * Takes Date as-is, in its timezone - local or UTC.
600
596
  */
601
597
  fromDate(d) {
602
- (0, assert_1._assert)(!Number.isNaN(d.getDate()), 'localDate.fromDate is called on Date object that is invalid');
598
+ _assert(!Number.isNaN(d.getDate()), 'localDate.fromDate is called on Date object that is invalid');
603
599
  return new LocalDate(d.getFullYear(), d.getMonth() + 1, d.getDate());
604
600
  }
605
601
  /**
@@ -607,7 +603,7 @@ class LocalDateFactory {
607
603
  * Takes Date's year/month/day components in UTC, using getUTCFullYear, getUTCMonth, getUTCDate.
608
604
  */
609
605
  fromDateInUTC(d) {
610
- (0, assert_1._assert)(!Number.isNaN(d.getDate()), 'localDate.fromDateInUTC is called on Date object that is invalid');
606
+ _assert(!Number.isNaN(d.getDate()), 'localDate.fromDateInUTC is called on Date object that is invalid');
611
607
  return new LocalDate(d.getUTCFullYear(), d.getUTCMonth() + 1, d.getUTCDate());
612
608
  }
613
609
  fromDateObject(o) {
@@ -642,7 +638,7 @@ class LocalDateFactory {
642
638
  */
643
639
  min(items) {
644
640
  const min = this.minOrUndefined(items);
645
- (0, assert_1._assert)(min, 'localDate.min called on empty array');
641
+ _assert(min, 'localDate.min called on empty array');
646
642
  return min;
647
643
  }
648
644
  /**
@@ -666,7 +662,7 @@ class LocalDateFactory {
666
662
  */
667
663
  max(items) {
668
664
  const max = this.maxOrUndefined(items);
669
- (0, assert_1._assert)(max, 'localDate.max called on empty array');
665
+ _assert(max, 'localDate.max called on empty array');
670
666
  return max;
671
667
  }
672
668
  /**
@@ -696,7 +692,7 @@ class LocalDateFactory {
696
692
  value.plus(1, stepUnit, true);
697
693
  }
698
694
  const rightInclusive = incl[1] === ']';
699
- return iterable2_1.Iterable2.of({
695
+ return Iterable2.of({
700
696
  *[Symbol.iterator]() {
701
697
  while (value.isBefore($max, rightInclusive)) {
702
698
  yield value;
@@ -720,7 +716,7 @@ class LocalDateFactory {
720
716
  }
721
717
  }
722
718
  const localDateFactory = new LocalDateFactory();
723
- exports.localDate = localDateFactory.fromInput.bind(localDateFactory);
719
+ export const localDate = localDateFactory.fromInput.bind(localDateFactory);
724
720
  // The line below is the blackest of black magic I have ever written in 2024.
725
721
  // And probably 2023 as well.
726
- Object.setPrototypeOf(exports.localDate, localDateFactory);
722
+ Object.setPrototypeOf(localDate, localDateFactory);
@@ -1,6 +1,6 @@
1
- import type { IANATimezone, Inclusiveness, IsoDate, IsoDateTime, MonthId, NumberOfHours, NumberOfMinutes, SortDirection, UnixTimestamp, UnixTimestampMillis } from '../types';
2
- import type { LocalDate } from './localDate';
3
- import { WallTime } from './wallTime';
1
+ import type { IANATimezone, Inclusiveness, IsoDate, IsoDateTime, MonthId, NumberOfHours, NumberOfMinutes, SortDirection, UnixTimestamp, UnixTimestampMillis } from '../types.js';
2
+ import type { LocalDate } from './localDate.js';
3
+ import { WallTime } from './wallTime.js';
4
4
  export type LocalTimeUnit = 'year' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second';
5
5
  export declare enum ISODayOfWeek {
6
6
  MONDAY = 1,