@bereasoftware/time-guard 2.6.1 → 2.7.0

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 (98) hide show
  1. package/README.en.md +232 -0
  2. package/README.md +259 -4
  3. package/dist/angular/index.cjs +148 -0
  4. package/dist/angular/index.d.ts +2 -0
  5. package/dist/angular/index.es.js +143 -0
  6. package/dist/angular.d.ts +59 -0
  7. package/dist/calendars/index.cjs +357 -2
  8. package/dist/calendars/index.es.js +99 -68
  9. package/dist/chunk-Ddh6569R.cjs +36 -0
  10. package/dist/core-BAd7GYfw.js +1809 -0
  11. package/dist/core-CafqOI7W.cjs +1892 -0
  12. package/dist/core.d.ts +224 -0
  13. package/dist/index.d.ts +9 -0
  14. package/dist/locales/african.locale.d.ts +7 -0
  15. package/dist/locales/index.cjs +7 -1
  16. package/dist/{types/locales → locales}/index.d.ts +2 -2
  17. package/dist/locales/index.es.js +3 -3
  18. package/dist/locales/south-american.locale.d.ts +7 -0
  19. package/dist/locales-C2-lOmC8.cjs +3537 -0
  20. package/dist/{locales-DSBvgSaw.js → locales-CcuSu4P1.js} +749 -33
  21. package/dist/native/index.cjs +48 -0
  22. package/dist/native/index.d.ts +2 -0
  23. package/dist/native/index.es.js +18 -0
  24. package/dist/native.d.ts +9 -0
  25. package/dist/plugins/advanced-format.cjs +105 -2
  26. package/dist/plugins/advanced-format.es.js +63 -45
  27. package/dist/plugins/duration.cjs +258 -2
  28. package/dist/plugins/duration.es.js +165 -61
  29. package/dist/plugins/relative-time.cjs +166 -2
  30. package/dist/plugins/relative-time.es.js +74 -37
  31. package/dist/qwik/index.cjs +104 -0
  32. package/dist/qwik/index.d.ts +2 -0
  33. package/dist/qwik/index.es.js +100 -0
  34. package/dist/qwik.d.ts +32 -0
  35. package/dist/react/index.cjs +112 -0
  36. package/dist/react/index.d.ts +2 -0
  37. package/dist/react/index.es.js +103 -0
  38. package/dist/react.d.ts +46 -0
  39. package/dist/solid/index.cjs +127 -0
  40. package/dist/solid/index.d.ts +2 -0
  41. package/dist/solid/index.es.js +122 -0
  42. package/dist/solid.d.ts +53 -0
  43. package/dist/svelte/index.cjs +398 -0
  44. package/dist/svelte/index.d.ts +2 -0
  45. package/dist/svelte/index.es.js +393 -0
  46. package/dist/svelte.d.ts +88 -0
  47. package/dist/time-guard.cjs +7359 -4
  48. package/dist/time-guard.es.js +3625 -8085
  49. package/dist/time-guard.iife.js +13549 -4
  50. package/dist/time-guard.umd.js +13550 -4
  51. package/dist/types/index.d.ts +651 -127
  52. package/dist/vue/index.cjs +143 -0
  53. package/dist/vue/index.d.ts +2 -0
  54. package/dist/vue/index.es.js +137 -0
  55. package/dist/vue.d.ts +35 -0
  56. package/package.json +107 -27
  57. package/dist/calendars/index.cjs.map +0 -1
  58. package/dist/calendars/index.es.js.map +0 -1
  59. package/dist/locales-DSBvgSaw.js.map +0 -1
  60. package/dist/locales-ybx7jS8G.cjs +0 -2
  61. package/dist/locales-ybx7jS8G.cjs.map +0 -1
  62. package/dist/plugins/advanced-format.cjs.map +0 -1
  63. package/dist/plugins/advanced-format.es.js.map +0 -1
  64. package/dist/plugins/duration.cjs.map +0 -1
  65. package/dist/plugins/duration.es.js.map +0 -1
  66. package/dist/plugins/relative-time.cjs.map +0 -1
  67. package/dist/plugins/relative-time.es.js.map +0 -1
  68. package/dist/time-guard.cjs.map +0 -1
  69. package/dist/time-guard.es.js.map +0 -1
  70. package/dist/time-guard.iife.js.map +0 -1
  71. package/dist/time-guard.umd.js.map +0 -1
  72. package/dist/types/types/index.d.ts +0 -641
  73. /package/dist/{types/adapters → adapters}/temporal.adapter.d.ts +0 -0
  74. /package/dist/{types/calendars → calendars}/calendar.manager.d.ts +0 -0
  75. /package/dist/{types/calendars → calendars}/index.d.ts +0 -0
  76. /package/dist/{types/formatters → formatters}/date.formatter.d.ts +0 -0
  77. /package/dist/{types/locales → locales}/additional.locale.d.ts +0 -0
  78. /package/dist/{types/locales → locales}/asian.locale.d.ts +0 -0
  79. /package/dist/{types/locales → locales}/english.locale.d.ts +0 -0
  80. /package/dist/{types/locales → locales}/european.locale.d.ts +0 -0
  81. /package/dist/{types/locales → locales}/locale.manager.d.ts +0 -0
  82. /package/dist/{types/locales → locales}/middle-eastern.locale.d.ts +0 -0
  83. /package/dist/{types/locales → locales}/nordic.locale.d.ts +0 -0
  84. /package/dist/{types/locales → locales}/romance.locale.d.ts +0 -0
  85. /package/dist/{types/locales → locales}/slavic.locale.d.ts +0 -0
  86. /package/dist/{types/locales → locales}/spanish.locale.d.ts +0 -0
  87. /package/dist/{types/plugins → plugins}/advanced-format/index.d.ts +0 -0
  88. /package/dist/{types/plugins → plugins}/advanced-format.d.ts +0 -0
  89. /package/dist/{types/plugins → plugins}/duration/index.d.ts +0 -0
  90. /package/dist/{types/plugins → plugins}/duration/types.d.ts +0 -0
  91. /package/dist/{types/plugins → plugins}/duration.d.ts +0 -0
  92. /package/dist/{types/plugins → plugins}/index.d.ts +0 -0
  93. /package/dist/{types/plugins → plugins}/manager.d.ts +0 -0
  94. /package/dist/{types/plugins → plugins}/relative-time/index.d.ts +0 -0
  95. /package/dist/{types/plugins → plugins}/relative-time/types.d.ts +0 -0
  96. /package/dist/{types/plugins → plugins}/relative-time.d.ts +0 -0
  97. /package/dist/{types/time-guard.d.ts → time-guard.d.ts} +0 -0
  98. /package/dist/{types/utils → utils}/duration-locale.d.ts +0 -0
@@ -0,0 +1,143 @@
1
+ /*! time-guard v2.7.0 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/time-guard */
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const require_core = require("../core-CafqOI7W.cjs");
4
+ let vue = require("vue");
5
+ //#region src/vue.ts
6
+ /**
7
+ * Unique symbol key for injecting TimeGuard global configuration.
8
+ */
9
+ var TimeGuardConfigKey = Symbol("TimeGuardConfig");
10
+ /**
11
+ * Vue Directive for dynamically and reactively formatting dates.
12
+ * Usage:
13
+ * - `<span v-time-guard:format="date" data-pattern="YYYY-MM-DD"></span>`
14
+ * - `<span v-time-guard:relative="date" data-locale="es"></span>`
15
+ */
16
+ /** Internal WeakMap to track interval timers per element (avoids `any` casts). */
17
+ var directiveTimerMap = /* @__PURE__ */ new WeakMap();
18
+ var vTimeGuard = {
19
+ mounted(el, binding) {
20
+ updateDirective(el, binding);
21
+ },
22
+ updated(el, binding) {
23
+ updateDirective(el, binding);
24
+ },
25
+ unmounted(el) {
26
+ const timer = directiveTimerMap.get(el);
27
+ if (timer) {
28
+ clearInterval(timer);
29
+ directiveTimerMap.delete(el);
30
+ }
31
+ }
32
+ };
33
+ function updateDirective(el, binding) {
34
+ const existingTimer = directiveTimerMap.get(el);
35
+ if (existingTimer) {
36
+ clearInterval(existingTimer);
37
+ directiveTimerMap.delete(el);
38
+ }
39
+ const value = binding.value;
40
+ if (value === void 0 || value === null) {
41
+ el.textContent = "";
42
+ return;
43
+ }
44
+ const mode = binding.arg || "format";
45
+ const pattern = el.getAttribute("data-pattern") || "YYYY-MM-DD HH:mm:ss";
46
+ const locale = el.getAttribute("data-locale") || void 0;
47
+ const intervalMs = parseInt(el.getAttribute("data-interval") || "60000", 10);
48
+ const numeric = el.getAttribute("data-numeric") || void 0;
49
+ const render = () => {
50
+ try {
51
+ const tg = require_core.TimeGuard.from(value);
52
+ if (mode === "relative") {
53
+ const now = require_core.TimeGuard.now();
54
+ el.textContent = tg.since(now).humanize({
55
+ locale,
56
+ numeric
57
+ });
58
+ } else el.textContent = locale ? tg.locale(locale).format(pattern) : tg.format(pattern);
59
+ } catch {
60
+ el.textContent = String(value);
61
+ }
62
+ };
63
+ render();
64
+ if (mode === "relative" || el.getAttribute("data-live") === "true") directiveTimerMap.set(el, setInterval(render, intervalMs));
65
+ }
66
+ /**
67
+ * Vue Plugin to register a global TimeGuard configuration and register v-time-guard directive.
68
+ */
69
+ var TimeGuardVuePlugin = { install(app, options) {
70
+ app.provide(TimeGuardConfigKey, options);
71
+ app.directive("time-guard", vTimeGuard);
72
+ } };
73
+ /**
74
+ * Vue Composable to create a reactive Ref of a TimeGuard instance.
75
+ * Automatically updates when input or configuration changes.
76
+ * Inherits global injected configuration as fallback.
77
+ */
78
+ function useTimeGuard(input, config) {
79
+ const globalConfig = (0, vue.inject)(TimeGuardConfigKey, void 0);
80
+ const activeConfig = config ?? globalConfig;
81
+ const tg = (0, vue.ref)(require_core.TimeGuard.from(input, activeConfig));
82
+ (0, vue.watch)([() => input, () => activeConfig ? JSON.stringify(activeConfig) : void 0], () => {
83
+ tg.value = require_core.TimeGuard.from(input, activeConfig);
84
+ }, { deep: true });
85
+ return tg;
86
+ }
87
+ /**
88
+ * Vue Composable to get a reactive TimeGuard Ref representing the current time.
89
+ * Automatically updates on a specified interval (default: 1000ms).
90
+ * Inherits global injected configuration as fallback.
91
+ */
92
+ function useCurrentTime(options) {
93
+ const globalConfig = (0, vue.inject)(TimeGuardConfigKey, void 0);
94
+ const activeConfig = options?.config ?? globalConfig;
95
+ const interval = options?.interval ?? 1e3;
96
+ const time = (0, vue.ref)(require_core.TimeGuard.now(activeConfig));
97
+ const timer = setInterval(() => {
98
+ time.value = require_core.TimeGuard.now(activeConfig);
99
+ }, interval);
100
+ (0, vue.onUnmounted)(() => {
101
+ clearInterval(timer);
102
+ });
103
+ return time;
104
+ }
105
+ /**
106
+ * Vue Composable that returns a reactive relative time Ref updating periodically.
107
+ * Inherits global injected configuration as fallback.
108
+ */
109
+ function useRelativeTime(date, options) {
110
+ const globalConfig = (0, vue.inject)(TimeGuardConfigKey, void 0);
111
+ const interval = options?.interval ?? 6e4;
112
+ const locale = options?.locale ?? globalConfig?.locale;
113
+ const numeric = options?.numeric;
114
+ const relative = (0, vue.ref)("");
115
+ const update = () => {
116
+ const tgDate = require_core.TimeGuard.from(date);
117
+ const now = require_core.TimeGuard.now();
118
+ relative.value = tgDate.since(now).humanize({
119
+ locale,
120
+ numeric
121
+ });
122
+ };
123
+ update();
124
+ const timer = setInterval(update, interval);
125
+ (0, vue.watch)([
126
+ () => date,
127
+ () => locale,
128
+ () => numeric
129
+ ], () => {
130
+ update();
131
+ }, { deep: true });
132
+ (0, vue.onUnmounted)(() => {
133
+ clearInterval(timer);
134
+ });
135
+ return relative;
136
+ }
137
+ //#endregion
138
+ exports.TimeGuardConfigKey = TimeGuardConfigKey;
139
+ exports.TimeGuardVuePlugin = TimeGuardVuePlugin;
140
+ exports.useCurrentTime = useCurrentTime;
141
+ exports.useRelativeTime = useRelativeTime;
142
+ exports.useTimeGuard = useTimeGuard;
143
+ exports.vTimeGuard = vTimeGuard;
@@ -0,0 +1,2 @@
1
+ export * from '../vue'
2
+ export {}
@@ -0,0 +1,137 @@
1
+ /*! time-guard v2.7.0 | (c) 2026 Berea-Soft | MIT License | https://github.com/Berea-Soft/time-guard */
2
+ import { n as TimeGuard } from "../core-BAd7GYfw.js";
3
+ import { inject, onUnmounted, ref, watch } from "vue";
4
+ //#region src/vue.ts
5
+ /**
6
+ * Unique symbol key for injecting TimeGuard global configuration.
7
+ */
8
+ var TimeGuardConfigKey = Symbol("TimeGuardConfig");
9
+ /**
10
+ * Vue Directive for dynamically and reactively formatting dates.
11
+ * Usage:
12
+ * - `<span v-time-guard:format="date" data-pattern="YYYY-MM-DD"></span>`
13
+ * - `<span v-time-guard:relative="date" data-locale="es"></span>`
14
+ */
15
+ /** Internal WeakMap to track interval timers per element (avoids `any` casts). */
16
+ var directiveTimerMap = /* @__PURE__ */ new WeakMap();
17
+ var vTimeGuard = {
18
+ mounted(el, binding) {
19
+ updateDirective(el, binding);
20
+ },
21
+ updated(el, binding) {
22
+ updateDirective(el, binding);
23
+ },
24
+ unmounted(el) {
25
+ const timer = directiveTimerMap.get(el);
26
+ if (timer) {
27
+ clearInterval(timer);
28
+ directiveTimerMap.delete(el);
29
+ }
30
+ }
31
+ };
32
+ function updateDirective(el, binding) {
33
+ const existingTimer = directiveTimerMap.get(el);
34
+ if (existingTimer) {
35
+ clearInterval(existingTimer);
36
+ directiveTimerMap.delete(el);
37
+ }
38
+ const value = binding.value;
39
+ if (value === void 0 || value === null) {
40
+ el.textContent = "";
41
+ return;
42
+ }
43
+ const mode = binding.arg || "format";
44
+ const pattern = el.getAttribute("data-pattern") || "YYYY-MM-DD HH:mm:ss";
45
+ const locale = el.getAttribute("data-locale") || void 0;
46
+ const intervalMs = parseInt(el.getAttribute("data-interval") || "60000", 10);
47
+ const numeric = el.getAttribute("data-numeric") || void 0;
48
+ const render = () => {
49
+ try {
50
+ const tg = TimeGuard.from(value);
51
+ if (mode === "relative") {
52
+ const now = TimeGuard.now();
53
+ el.textContent = tg.since(now).humanize({
54
+ locale,
55
+ numeric
56
+ });
57
+ } else el.textContent = locale ? tg.locale(locale).format(pattern) : tg.format(pattern);
58
+ } catch {
59
+ el.textContent = String(value);
60
+ }
61
+ };
62
+ render();
63
+ if (mode === "relative" || el.getAttribute("data-live") === "true") directiveTimerMap.set(el, setInterval(render, intervalMs));
64
+ }
65
+ /**
66
+ * Vue Plugin to register a global TimeGuard configuration and register v-time-guard directive.
67
+ */
68
+ var TimeGuardVuePlugin = { install(app, options) {
69
+ app.provide(TimeGuardConfigKey, options);
70
+ app.directive("time-guard", vTimeGuard);
71
+ } };
72
+ /**
73
+ * Vue Composable to create a reactive Ref of a TimeGuard instance.
74
+ * Automatically updates when input or configuration changes.
75
+ * Inherits global injected configuration as fallback.
76
+ */
77
+ function useTimeGuard(input, config) {
78
+ const globalConfig = inject(TimeGuardConfigKey, void 0);
79
+ const activeConfig = config ?? globalConfig;
80
+ const tg = ref(TimeGuard.from(input, activeConfig));
81
+ watch([() => input, () => activeConfig ? JSON.stringify(activeConfig) : void 0], () => {
82
+ tg.value = TimeGuard.from(input, activeConfig);
83
+ }, { deep: true });
84
+ return tg;
85
+ }
86
+ /**
87
+ * Vue Composable to get a reactive TimeGuard Ref representing the current time.
88
+ * Automatically updates on a specified interval (default: 1000ms).
89
+ * Inherits global injected configuration as fallback.
90
+ */
91
+ function useCurrentTime(options) {
92
+ const globalConfig = inject(TimeGuardConfigKey, void 0);
93
+ const activeConfig = options?.config ?? globalConfig;
94
+ const interval = options?.interval ?? 1e3;
95
+ const time = ref(TimeGuard.now(activeConfig));
96
+ const timer = setInterval(() => {
97
+ time.value = TimeGuard.now(activeConfig);
98
+ }, interval);
99
+ onUnmounted(() => {
100
+ clearInterval(timer);
101
+ });
102
+ return time;
103
+ }
104
+ /**
105
+ * Vue Composable that returns a reactive relative time Ref updating periodically.
106
+ * Inherits global injected configuration as fallback.
107
+ */
108
+ function useRelativeTime(date, options) {
109
+ const globalConfig = inject(TimeGuardConfigKey, void 0);
110
+ const interval = options?.interval ?? 6e4;
111
+ const locale = options?.locale ?? globalConfig?.locale;
112
+ const numeric = options?.numeric;
113
+ const relative = ref("");
114
+ const update = () => {
115
+ const tgDate = TimeGuard.from(date);
116
+ const now = TimeGuard.now();
117
+ relative.value = tgDate.since(now).humanize({
118
+ locale,
119
+ numeric
120
+ });
121
+ };
122
+ update();
123
+ const timer = setInterval(update, interval);
124
+ watch([
125
+ () => date,
126
+ () => locale,
127
+ () => numeric
128
+ ], () => {
129
+ update();
130
+ }, { deep: true });
131
+ onUnmounted(() => {
132
+ clearInterval(timer);
133
+ });
134
+ return relative;
135
+ }
136
+ //#endregion
137
+ export { TimeGuardConfigKey, TimeGuardVuePlugin, useCurrentTime, useRelativeTime, useTimeGuard, vTimeGuard };
package/dist/vue.d.ts ADDED
@@ -0,0 +1,35 @@
1
+ import { Ref, Plugin, Directive } from 'vue';
2
+ import { TimeGuard, ITimeGuardConfig } from './core';
3
+ /**
4
+ * Unique symbol key for injecting TimeGuard global configuration.
5
+ */
6
+ export declare const TimeGuardConfigKey: unique symbol;
7
+ export declare const vTimeGuard: Directive<HTMLElement, unknown>;
8
+ /**
9
+ * Vue Plugin to register a global TimeGuard configuration and register v-time-guard directive.
10
+ */
11
+ export declare const TimeGuardVuePlugin: Plugin;
12
+ /**
13
+ * Vue Composable to create a reactive Ref of a TimeGuard instance.
14
+ * Automatically updates when input or configuration changes.
15
+ * Inherits global injected configuration as fallback.
16
+ */
17
+ export declare function useTimeGuard(input?: unknown, config?: ITimeGuardConfig): Ref<TimeGuard>;
18
+ /**
19
+ * Vue Composable to get a reactive TimeGuard Ref representing the current time.
20
+ * Automatically updates on a specified interval (default: 1000ms).
21
+ * Inherits global injected configuration as fallback.
22
+ */
23
+ export declare function useCurrentTime(options?: {
24
+ interval?: number;
25
+ config?: ITimeGuardConfig;
26
+ }): Ref<TimeGuard>;
27
+ /**
28
+ * Vue Composable that returns a reactive relative time Ref updating periodically.
29
+ * Inherits global injected configuration as fallback.
30
+ */
31
+ export declare function useRelativeTime(date: unknown, options?: {
32
+ interval?: number;
33
+ locale?: string;
34
+ numeric?: 'always' | 'auto';
35
+ }): Ref<string>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bereasoftware/time-guard",
3
3
  "private": false,
4
- "version": "2.6.1",
4
+ "version": "2.7.0",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "main": "./dist/time-guard.cjs",
@@ -19,6 +19,48 @@
19
19
  "require": "./dist/time-guard.cjs",
20
20
  "default": "./dist/time-guard.es.js"
21
21
  },
22
+ "./native": {
23
+ "types": "./dist/types/native.d.ts",
24
+ "import": "./dist/native/index.es.js",
25
+ "require": "./dist/native/index.cjs",
26
+ "default": "./dist/native/index.es.js"
27
+ },
28
+ "./react": {
29
+ "types": "./dist/types/react.d.ts",
30
+ "import": "./dist/react/index.es.js",
31
+ "require": "./dist/react/index.cjs",
32
+ "default": "./dist/react/index.es.js"
33
+ },
34
+ "./vue": {
35
+ "types": "./dist/types/vue.d.ts",
36
+ "import": "./dist/vue/index.es.js",
37
+ "require": "./dist/vue/index.cjs",
38
+ "default": "./dist/vue/index.es.js"
39
+ },
40
+ "./angular": {
41
+ "types": "./dist/types/angular.d.ts",
42
+ "import": "./dist/angular/index.es.js",
43
+ "require": "./dist/angular/index.cjs",
44
+ "default": "./dist/angular/index.es.js"
45
+ },
46
+ "./svelte": {
47
+ "types": "./dist/types/svelte.d.ts",
48
+ "import": "./dist/svelte/index.es.js",
49
+ "require": "./dist/svelte/index.cjs",
50
+ "default": "./dist/svelte/index.es.js"
51
+ },
52
+ "./solid": {
53
+ "types": "./dist/types/solid.d.ts",
54
+ "import": "./dist/solid/index.es.js",
55
+ "require": "./dist/solid/index.cjs",
56
+ "default": "./dist/solid/index.es.js"
57
+ },
58
+ "./qwik": {
59
+ "types": "./dist/types/qwik.d.ts",
60
+ "import": "./dist/qwik/index.es.js",
61
+ "require": "./dist/qwik/index.cjs",
62
+ "default": "./dist/qwik/index.es.js"
63
+ },
22
64
  "./locales": {
23
65
  "types": "./dist/types/locales/index.d.ts",
24
66
  "import": "./dist/locales/index.es.js",
@@ -57,7 +99,7 @@
57
99
  "registry": "https://registry.npmjs.org/",
58
100
  "access": "public"
59
101
  },
60
- "packageManager": "pnpm@10.21.0",
102
+ "packageManager": "pnpm@11.0.9",
61
103
  "keywords": [
62
104
  "time-guard",
63
105
  "typescript",
@@ -104,9 +146,14 @@
104
146
  ],
105
147
  "homepage": "https://github.com/Berea-Soft/time-guard#readme",
106
148
  "scripts": {
107
- "dev": "vite --config playground/vite.config.ts",
108
- "build-v2": "tsc -p tsconfig.build.json && vite build",
109
- "build": "vite build && vite build --mode umd",
149
+ "dev:docs": "pnpm --prefix docs-app install && pnpm --prefix docs-app dev",
150
+ "build:docs": "pnpm --prefix docs-app build",
151
+ "typecheck:docs": "pnpm --prefix docs-app typecheck",
152
+ "format:docs": "prettier --write \"docs-app/src/**/*.{ts,js,vue,css,json}\" \"docs-app/*.{json,js}\"",
153
+ "format:docs:check": "prettier --check \"docs-app/src/**/*.{ts,js,vue,css,json}\" \"docs-app/*.{json,js}\"",
154
+ "lint:docs": "pnpm --prefix docs-app lint",
155
+ "lint:docs:fix": "pnpm --prefix docs-app lint:fix",
156
+ "build": "vite build && vite build --mode umd && vite build --mode angular",
110
157
  "build:all": "pnpm build",
111
158
  "test": "vitest run",
112
159
  "test:watch": "vitest",
@@ -117,35 +164,68 @@
117
164
  "format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
118
165
  "format:check": "prettier --check \"src/**/*.ts\" \"test/**/*.ts\"",
119
166
  "typecheck": "tsc --noEmit",
120
- "prepublishOnly": "pnpm build"
167
+ "prepublishOnly": "pnpm build",
168
+ "prepare": "husky"
121
169
  },
122
170
  "dependencies": {
123
- "@js-temporal/polyfill": "^0.5.1"
171
+ "@js-temporal/polyfill": "^0.5.1",
172
+ "vue-icons-plus": "^0.1.9"
173
+ },
174
+ "peerDependencies": {
175
+ "@angular/core": ">=21.2.14",
176
+ "react": ">=19.2.6",
177
+ "rxjs": ">=7.8.2",
178
+ "vue": ">=3.5.34",
179
+ "svelte": ">=5.55.9",
180
+ "solid-js": ">=1.9.13",
181
+ "@builder.io/qwik": ">=1.20.0"
182
+ },
183
+ "peerDependenciesMeta": {
184
+ "react": {
185
+ "optional": true
186
+ },
187
+ "vue": {
188
+ "optional": true
189
+ },
190
+ "@angular/core": {
191
+ "optional": true
192
+ },
193
+ "rxjs": {
194
+ "optional": true
195
+ },
196
+ "svelte": {
197
+ "optional": true
198
+ },
199
+ "solid-js": {
200
+ "optional": true
201
+ },
202
+ "@builder.io/qwik": {
203
+ "optional": true
204
+ }
124
205
  },
125
206
  "devDependencies": {
207
+ "@angular/core": "^21.2.14",
126
208
  "@semantic-release/changelog": "^6.0.3",
127
209
  "@semantic-release/git": "^10.0.1",
128
- "@semantic-release/github": "^12.0.6",
210
+ "@semantic-release/github": "^12.0.8",
129
211
  "@semantic-release/npm": "^13.1.5",
130
- "@types/node": "^25.6.0",
131
- "@typescript-eslint/eslint-plugin": "^8.0.0",
132
- "@typescript-eslint/parser": "^8.0.0",
133
- "@vitest/coverage-v8": "^4.1.4",
134
- "@vitest/ui": "^4.1.4",
135
- "eslint": "^9.0.0",
136
- "husky": "^9.0.0",
137
- "lint-staged": "^15.0.0",
138
- "prettier": "^3.8.2",
212
+ "@types/node": "^25.9.1",
213
+ "@types/react": "^19.2.15",
214
+ "@typescript-eslint/eslint-plugin": "^8.59.4",
215
+ "@typescript-eslint/parser": "^8.59.4",
216
+ "@vitest/coverage-v8": "^4.1.7",
217
+ "@vitest/ui": "^4.1.7",
218
+ "eslint": "^10.4.0",
219
+ "husky": "^9.1.7",
220
+ "lint-staged": "^17.0.5",
221
+ "prettier": "^3.8.3",
222
+ "react": "^19.2.6",
223
+ "rxjs": "^7.8.2",
139
224
  "semantic-release": "^25.0.3",
140
- "typescript": "~6.0.2",
141
- "vite": "^8.0.8",
142
- "vite-plugin-dts": "^4.5.4",
143
- "vitest": "^4.1.4"
144
- },
145
- "lint-staged": {
146
- "*.ts": [
147
- "prettier --write",
148
- "eslint --fix --max-warnings=0"
149
- ]
225
+ "typescript": "~6.0.3",
226
+ "vite": "^8.0.14",
227
+ "vite-plugin-dts": "^5.0.1",
228
+ "vitest": "^4.1.7",
229
+ "vue": "^3.5.34"
150
230
  }
151
231
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../../src/calendars/index.ts"],"sourcesContent":["/**\n * Alternative Calendar Systems\n * Extended calendar support for international use\n */\n\nimport type { ICalendarSystem } from '../types';\n\n/**\n * Islamic Calendar (Hijri)\n * @experimental Uses simplified calculations. May not be accurate for all dates.\n */\nexport class IslamicCalendar implements ICalendarSystem {\n readonly id = 'islamic';\n readonly name = 'Islamic Calendar (Hijri)';\n readonly locale = 'ar';\n\n private monthNames = [\n 'Muharram',\n 'Safar',\n 'Rabi al-awwal',\n 'Rabi al-thani',\n 'Jumada al-awwal',\n 'Jumada al-thani',\n 'Rajab',\n \"Sha'ban\",\n 'Ramadan',\n 'Shawwal',\n \"Dhu al-Qi'dah\",\n 'Dhu al-Hijjah',\n ];\n\n getMonthName(month: number): string {\n return this.monthNames[Math.max(0, Math.min(11, month - 1))];\n }\n\n getWeekdayName(day: number, short: boolean = false): string {\n const weekdays = short\n ? ['Ahd', 'Ith', 'Sel', 'Rab', 'Kha', 'Jum', 'Sab']\n : ['Ahad', 'Ithnayn', 'Salasa', 'Rabi', 'Khamis', 'Jumah', 'Sabt'];\n return weekdays[Math.max(0, Math.min(6, day - 1))];\n }\n\n isLeapYear(year: number): boolean {\n // Islamic leap year: years 2, 5, 7, 10, 13, 16, 18, 21, 24, 26, 29 in 30-year cycle\n return [2, 5, 7, 10, 13, 16, 18, 21, 24, 26, 29].includes(year % 30);\n }\n\n daysInMonth(year: number, month: number): number {\n // Islamic months: odd months have 30 days, even months have 29 days\n // except last month which has 30 on leap years\n if (month % 2 === 1) {\n return 30;\n }\n if (month === 12 && this.isLeapYear(year)) {\n return 30;\n }\n return 29;\n }\n\n daysInYear(year: number): number {\n return this.isLeapYear(year) ? 355 : 354;\n }\n}\n\n/**\n * Hebrew Calendar\n * @experimental Uses simplified calculations. May not be accurate for all dates.\n */\nexport class HebrewCalendar implements ICalendarSystem {\n readonly id = 'hebrew';\n readonly name = 'Hebrew Calendar';\n readonly locale = 'he';\n\n private monthNames = [\n 'Tishrei',\n 'Cheshvan',\n 'Kislev',\n 'Tevet',\n 'Shevat',\n 'Adar',\n 'Nisan',\n 'Iyar',\n 'Sivan',\n 'Tammuz',\n 'Av',\n 'Elul',\n ];\n\n getMonthName(month: number): string {\n return this.monthNames[Math.max(0, Math.min(11, month - 1))];\n }\n\n getWeekdayName(day: number, short: boolean = false): string {\n const weekdays = short\n ? ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']\n : [\n 'Sunday',\n 'Monday',\n 'Tuesday',\n 'Wednesday',\n 'Thursday',\n 'Friday',\n 'Saturday',\n ];\n return weekdays[Math.max(0, Math.min(6, day - 1))];\n }\n\n isLeapYear(year: number): boolean {\n // Hebrew leap year: years 3, 6, 8, 11, 14, 17, 19 in 19-year cycle\n return [3, 6, 8, 11, 14, 17, 19].includes(year % 19);\n }\n\n daysInMonth(_year: number, month: number): number {\n // Simplified version - actual Hebrew calendar is more complex\n const daysPerMonth = [30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29];\n return daysPerMonth[Math.max(0, Math.min(11, month - 1))];\n }\n\n daysInYear(year: number): number {\n return this.isLeapYear(year) ? 384 : 354;\n }\n}\n\n/**\n * Chinese Calendar\n * @experimental Uses simplified calculations. May not be accurate for all dates.\n */\nexport class ChineseCalendar implements ICalendarSystem {\n readonly id = 'chinese';\n readonly name = 'Chinese Calendar';\n readonly locale = 'zh';\n\n private monthNames = [\n '正月',\n '二月',\n '三月',\n '四月',\n '五月',\n '六月',\n '七月',\n '八月',\n '九月',\n '十月',\n '冬月',\n '腊月',\n ];\n\n private terrestrialBranches = [\n '子',\n '丑',\n '寅',\n '卯',\n '辰',\n '巳',\n '午',\n '未',\n '申',\n '酉',\n '戌',\n '亥',\n ];\n\n getMonthName(month: number): string {\n return this.monthNames[Math.max(0, Math.min(11, month - 1))];\n }\n\n getWeekdayName(day: number, short: boolean = false): string {\n const weekdays = short\n ? ['日', '一', '二', '三', '四', '五', '六']\n : ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];\n return weekdays[Math.max(0, Math.min(6, day - 1))];\n }\n\n isLeapYear(year: number): boolean {\n // Chinese leap year follows a different cycle\n return year % 3 === 0;\n }\n\n daysInMonth(_year: number, month: number): number {\n return month % 2 === 0 ? 30 : 29;\n }\n\n daysInYear(year: number): number {\n return this.isLeapYear(year) ? 384 : 354;\n }\n\n /**\n * Get zodiac sign for year\n */\n getZodiacSign(year: number): string {\n return this.terrestrialBranches[year % 12];\n }\n}\n\n/**\n * Japanese Calendar\n * @experimental Uses Gregorian rules post-1873. Historical dates may not be accurate.\n */\nexport class JapaneseCalendar implements ICalendarSystem {\n readonly id = 'japanese';\n readonly name = 'Japanese Calendar';\n readonly locale = 'ja';\n\n private monthNames = [\n '1月',\n '2月',\n '3月',\n '4月',\n '5月',\n '6月',\n '7月',\n '8月',\n '9月',\n '10月',\n '11月',\n '12月',\n ];\n\n getMonthName(month: number): string {\n return this.monthNames[Math.max(0, Math.min(11, month - 1))];\n }\n\n getWeekdayName(day: number, short: boolean = false): string {\n const weekdays = short\n ? ['日', '月', '火', '水', '木', '金', '土']\n : ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日'];\n return weekdays[Math.max(0, Math.min(6, day - 1))];\n }\n\n isLeapYear(year: number): boolean {\n // Japanese calendar adopted Gregorian calendar in 1873\n // Uses same leap year rules as Gregorian\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n }\n\n daysInMonth(year: number, month: number): number {\n const daysPerMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n if (month === 2 && this.isLeapYear(year)) {\n return 29;\n }\n return daysPerMonth[Math.max(0, Math.min(11, month - 1))];\n }\n\n daysInYear(year: number): number {\n return this.isLeapYear(year) ? 366 : 365;\n }\n}\n\n/**\n * Buddhist Calendar\n * @experimental Uses Gregorian rules with BE year offset (CE + 543).\n */\nexport class BuddhistCalendar implements ICalendarSystem {\n readonly id = 'buddhist';\n readonly name = 'Buddhist Calendar';\n readonly locale = 'th';\n\n private monthNames = [\n 'January',\n 'February',\n 'March',\n 'April',\n 'May',\n 'June',\n 'July',\n 'August',\n 'September',\n 'October',\n 'November',\n 'December',\n ];\n\n getMonthName(month: number): string {\n return this.monthNames[Math.max(0, Math.min(11, month - 1))];\n }\n\n getWeekdayName(day: number): string {\n return [\n 'Sunday',\n 'Monday',\n 'Tuesday',\n 'Wednesday',\n 'Thursday',\n 'Friday',\n 'Saturday',\n ][Math.max(0, Math.min(6, day - 1))];\n }\n\n isLeapYear(year: number): boolean {\n // Buddhist Era = CE + 543\n const ceYear = year - 543;\n return (ceYear % 4 === 0 && ceYear % 100 !== 0) || ceYear % 400 === 0;\n }\n\n daysInMonth(year: number, month: number): number {\n // Same as Gregorian\n const daysPerMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n if (month === 2 && this.isLeapYear(year)) {\n return 29;\n }\n return daysPerMonth[Math.max(0, Math.min(11, month - 1))];\n }\n\n daysInYear(year: number): number {\n return this.isLeapYear(year) ? 366 : 365;\n }\n}\n"],"mappings":"mEAWA,IAAa,EAAb,KAAwD,CACtD,GAAc,UACd,KAAgB,2BAChB,OAAkB,KAElB,WAAqB,CACnB,WACA,QACA,gBACA,gBACA,kBACA,kBACA,QACA,UACA,UACA,UACA,gBACA,eACF,EAEA,aAAa,EAAuB,CAClC,OAAO,KAAK,WAAW,KAAK,IAAI,EAAG,KAAK,IAAI,GAAI,EAAQ,CAAC,CAAC,EAC5D,CAEA,eAAe,EAAa,EAAiB,GAAe,CAI1D,OAHiB,EACb,CAAC,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,KAAK,EAChD,CAAC,OAAQ,UAAW,SAAU,OAAQ,SAAU,QAAS,MAAM,GACnD,KAAK,IAAI,EAAG,KAAK,IAAI,EAAG,EAAM,CAAC,CAAC,EAClD,CAEA,WAAW,EAAuB,CAEhC,MAAO,CAAC,EAAG,EAAG,EAAG,GAAI,GAAI,GAAI,GAAI,GAAI,GAAI,GAAI,EAAE,EAAE,SAAS,EAAO,EAAE,CACrE,CAEA,YAAY,EAAc,EAAuB,CAS/C,OANI,EAAQ,GAAM,GAGd,IAAU,IAAM,KAAK,WAAW,CAAI,EAC/B,GAEF,EACT,CAEA,WAAW,EAAsB,CAC/B,OAAO,KAAK,WAAW,CAAI,EAAI,IAAM,GACvC,CACF,EAMa,EAAb,KAAuD,CACrD,GAAc,SACd,KAAgB,kBAChB,OAAkB,KAElB,WAAqB,CACnB,UACA,WACA,SACA,QACA,SACA,OACA,QACA,OACA,QACA,SACA,KACA,MACF,EAEA,aAAa,EAAuB,CAClC,OAAO,KAAK,WAAW,KAAK,IAAI,EAAG,KAAK,IAAI,GAAI,EAAQ,CAAC,CAAC,EAC5D,CAEA,eAAe,EAAa,EAAiB,GAAe,CAY1D,OAXiB,EACb,CAAC,MAAO,MAAO,MAAO,MAAO,MAAO,MAAO,KAAK,EAChD,CACE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AM,CAAC,CAAC,EACpC,CAEA,WAAW,EAAuB,CAEhC,IAAM,EAAS,EAAO,IACtB,OAAQ,EAAS,GAAM,GAAK,EAAS,KAAQ,GAAM,EAAS,KAAQ,CACtE,CAEA,YAAY,EAAc,EAAuB,CAM/C,OAHI,IAAU,GAAK,KAAK,WAAW,CAAI,EAC9B,GAEF,CAJe,GAAI,GAAI,GAAI,GAAI,GAAI,GAAI,GAAI,GAAI,GAAI,GAAI,GAAI,EAI3D,EAAa,KAAK,IAAI,EAAG,KAAK,IAAI,GAAI,EAAQ,CAAC,CAAC,EACzD,CAEA,WAAW,EAAsB,CAC/B,OAAO,KAAK,WAAW,CAAI,EAAI,IAAM,GACvC,CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.es.js","names":[],"sources":["../../src/calendars/index.ts"],"sourcesContent":["/**\n * Alternative Calendar Systems\n * Extended calendar support for international use\n */\n\nimport type { ICalendarSystem } from '../types';\n\n/**\n * Islamic Calendar (Hijri)\n * @experimental Uses simplified calculations. May not be accurate for all dates.\n */\nexport class IslamicCalendar implements ICalendarSystem {\n readonly id = 'islamic';\n readonly name = 'Islamic Calendar (Hijri)';\n readonly locale = 'ar';\n\n private monthNames = [\n 'Muharram',\n 'Safar',\n 'Rabi al-awwal',\n 'Rabi al-thani',\n 'Jumada al-awwal',\n 'Jumada al-thani',\n 'Rajab',\n \"Sha'ban\",\n 'Ramadan',\n 'Shawwal',\n \"Dhu al-Qi'dah\",\n 'Dhu al-Hijjah',\n ];\n\n getMonthName(month: number): string {\n return this.monthNames[Math.max(0, Math.min(11, month - 1))];\n }\n\n getWeekdayName(day: number, short: boolean = false): string {\n const weekdays = short\n ? ['Ahd', 'Ith', 'Sel', 'Rab', 'Kha', 'Jum', 'Sab']\n : ['Ahad', 'Ithnayn', 'Salasa', 'Rabi', 'Khamis', 'Jumah', 'Sabt'];\n return weekdays[Math.max(0, Math.min(6, day - 1))];\n }\n\n isLeapYear(year: number): boolean {\n // Islamic leap year: years 2, 5, 7, 10, 13, 16, 18, 21, 24, 26, 29 in 30-year cycle\n return [2, 5, 7, 10, 13, 16, 18, 21, 24, 26, 29].includes(year % 30);\n }\n\n daysInMonth(year: number, month: number): number {\n // Islamic months: odd months have 30 days, even months have 29 days\n // except last month which has 30 on leap years\n if (month % 2 === 1) {\n return 30;\n }\n if (month === 12 && this.isLeapYear(year)) {\n return 30;\n }\n return 29;\n }\n\n daysInYear(year: number): number {\n return this.isLeapYear(year) ? 355 : 354;\n }\n}\n\n/**\n * Hebrew Calendar\n * @experimental Uses simplified calculations. May not be accurate for all dates.\n */\nexport class HebrewCalendar implements ICalendarSystem {\n readonly id = 'hebrew';\n readonly name = 'Hebrew Calendar';\n readonly locale = 'he';\n\n private monthNames = [\n 'Tishrei',\n 'Cheshvan',\n 'Kislev',\n 'Tevet',\n 'Shevat',\n 'Adar',\n 'Nisan',\n 'Iyar',\n 'Sivan',\n 'Tammuz',\n 'Av',\n 'Elul',\n ];\n\n getMonthName(month: number): string {\n return this.monthNames[Math.max(0, Math.min(11, month - 1))];\n }\n\n getWeekdayName(day: number, short: boolean = false): string {\n const weekdays = short\n ? ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']\n : [\n 'Sunday',\n 'Monday',\n 'Tuesday',\n 'Wednesday',\n 'Thursday',\n 'Friday',\n 'Saturday',\n ];\n return weekdays[Math.max(0, Math.min(6, day - 1))];\n }\n\n isLeapYear(year: number): boolean {\n // Hebrew leap year: years 3, 6, 8, 11, 14, 17, 19 in 19-year cycle\n return [3, 6, 8, 11, 14, 17, 19].includes(year % 19);\n }\n\n daysInMonth(_year: number, month: number): number {\n // Simplified version - actual Hebrew calendar is more complex\n const daysPerMonth = [30, 29, 30, 29, 30, 29, 30, 29, 30, 29, 30, 29];\n return daysPerMonth[Math.max(0, Math.min(11, month - 1))];\n }\n\n daysInYear(year: number): number {\n return this.isLeapYear(year) ? 384 : 354;\n }\n}\n\n/**\n * Chinese Calendar\n * @experimental Uses simplified calculations. May not be accurate for all dates.\n */\nexport class ChineseCalendar implements ICalendarSystem {\n readonly id = 'chinese';\n readonly name = 'Chinese Calendar';\n readonly locale = 'zh';\n\n private monthNames = [\n '正月',\n '二月',\n '三月',\n '四月',\n '五月',\n '六月',\n '七月',\n '八月',\n '九月',\n '十月',\n '冬月',\n '腊月',\n ];\n\n private terrestrialBranches = [\n '子',\n '丑',\n '寅',\n '卯',\n '辰',\n '巳',\n '午',\n '未',\n '申',\n '酉',\n '戌',\n '亥',\n ];\n\n getMonthName(month: number): string {\n return this.monthNames[Math.max(0, Math.min(11, month - 1))];\n }\n\n getWeekdayName(day: number, short: boolean = false): string {\n const weekdays = short\n ? ['日', '一', '二', '三', '四', '五', '六']\n : ['星期日', '星期一', '星期二', '星期三', '星期四', '星期五', '星期六'];\n return weekdays[Math.max(0, Math.min(6, day - 1))];\n }\n\n isLeapYear(year: number): boolean {\n // Chinese leap year follows a different cycle\n return year % 3 === 0;\n }\n\n daysInMonth(_year: number, month: number): number {\n return month % 2 === 0 ? 30 : 29;\n }\n\n daysInYear(year: number): number {\n return this.isLeapYear(year) ? 384 : 354;\n }\n\n /**\n * Get zodiac sign for year\n */\n getZodiacSign(year: number): string {\n return this.terrestrialBranches[year % 12];\n }\n}\n\n/**\n * Japanese Calendar\n * @experimental Uses Gregorian rules post-1873. Historical dates may not be accurate.\n */\nexport class JapaneseCalendar implements ICalendarSystem {\n readonly id = 'japanese';\n readonly name = 'Japanese Calendar';\n readonly locale = 'ja';\n\n private monthNames = [\n '1月',\n '2月',\n '3月',\n '4月',\n '5月',\n '6月',\n '7月',\n '8月',\n '9月',\n '10月',\n '11月',\n '12月',\n ];\n\n getMonthName(month: number): string {\n return this.monthNames[Math.max(0, Math.min(11, month - 1))];\n }\n\n getWeekdayName(day: number, short: boolean = false): string {\n const weekdays = short\n ? ['日', '月', '火', '水', '木', '金', '土']\n : ['日曜日', '月曜日', '火曜日', '水曜日', '木曜日', '金曜日', '土曜日'];\n return weekdays[Math.max(0, Math.min(6, day - 1))];\n }\n\n isLeapYear(year: number): boolean {\n // Japanese calendar adopted Gregorian calendar in 1873\n // Uses same leap year rules as Gregorian\n return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;\n }\n\n daysInMonth(year: number, month: number): number {\n const daysPerMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n if (month === 2 && this.isLeapYear(year)) {\n return 29;\n }\n return daysPerMonth[Math.max(0, Math.min(11, month - 1))];\n }\n\n daysInYear(year: number): number {\n return this.isLeapYear(year) ? 366 : 365;\n }\n}\n\n/**\n * Buddhist Calendar\n * @experimental Uses Gregorian rules with BE year offset (CE + 543).\n */\nexport class BuddhistCalendar implements ICalendarSystem {\n readonly id = 'buddhist';\n readonly name = 'Buddhist Calendar';\n readonly locale = 'th';\n\n private monthNames = [\n 'January',\n 'February',\n 'March',\n 'April',\n 'May',\n 'June',\n 'July',\n 'August',\n 'September',\n 'October',\n 'November',\n 'December',\n ];\n\n getMonthName(month: number): string {\n return this.monthNames[Math.max(0, Math.min(11, month - 1))];\n }\n\n getWeekdayName(day: number): string {\n return [\n 'Sunday',\n 'Monday',\n 'Tuesday',\n 'Wednesday',\n 'Thursday',\n 'Friday',\n 'Saturday',\n ][Math.max(0, Math.min(6, day - 1))];\n }\n\n isLeapYear(year: number): boolean {\n // Buddhist Era = CE + 543\n const ceYear = year - 543;\n return (ceYear % 4 === 0 && ceYear % 100 !== 0) || ceYear % 400 === 0;\n }\n\n daysInMonth(year: number, month: number): number {\n // Same as Gregorian\n const daysPerMonth = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];\n if (month === 2 && this.isLeapYear(year)) {\n return 29;\n }\n return daysPerMonth[Math.max(0, Math.min(11, month - 1))];\n }\n\n daysInYear(year: number): number {\n return this.isLeapYear(year) ? 366 : 365;\n }\n}\n"],"mappings":";;AAWA,IAAa,IAAb,MAAwD;CACtD,KAAc;CACd,OAAgB;CAChB,SAAkB;CAElB,aAAq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