mutts 1.0.1 → 1.0.3

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 (111) hide show
  1. package/README.md +36 -6
  2. package/dist/chunks/_tslib-BgjropY9.js +81 -0
  3. package/dist/chunks/_tslib-BgjropY9.js.map +1 -0
  4. package/dist/chunks/_tslib-Mzh1rNsX.esm.js +75 -0
  5. package/dist/chunks/_tslib-Mzh1rNsX.esm.js.map +1 -0
  6. package/dist/chunks/{decorator-8qjFb7dw.js → decorator-DLvrD0UF.js} +103 -14
  7. package/dist/chunks/decorator-DLvrD0UF.js.map +1 -0
  8. package/dist/chunks/{decorator-AbRkXM5O.esm.js → decorator-DqiszP7i.esm.js} +100 -15
  9. package/dist/chunks/decorator-DqiszP7i.esm.js.map +1 -0
  10. package/dist/chunks/index-DzUDtFc7.esm.js +4841 -0
  11. package/dist/chunks/index-DzUDtFc7.esm.js.map +1 -0
  12. package/dist/chunks/index-HNVqPzjz.js +4891 -0
  13. package/dist/chunks/index-HNVqPzjz.js.map +1 -0
  14. package/dist/decorator.d.ts +57 -0
  15. package/dist/decorator.esm.js +1 -1
  16. package/dist/decorator.js +1 -1
  17. package/dist/destroyable.d.ts +43 -1
  18. package/dist/destroyable.esm.js +19 -1
  19. package/dist/destroyable.esm.js.map +1 -1
  20. package/dist/destroyable.js +19 -1
  21. package/dist/destroyable.js.map +1 -1
  22. package/dist/devtools/devtools.html +9 -0
  23. package/dist/devtools/devtools.js +5 -0
  24. package/dist/devtools/devtools.js.map +1 -0
  25. package/dist/devtools/manifest.json +8 -0
  26. package/dist/devtools/panel.css +72 -0
  27. package/dist/devtools/panel.html +31 -0
  28. package/dist/devtools/panel.js +13048 -0
  29. package/dist/devtools/panel.js.map +1 -0
  30. package/dist/eventful.d.ts +10 -1
  31. package/dist/eventful.esm.js +5 -27
  32. package/dist/eventful.esm.js.map +1 -1
  33. package/dist/eventful.js +15 -37
  34. package/dist/eventful.js.map +1 -1
  35. package/dist/index.d.ts +18 -14
  36. package/dist/index.esm.js +4 -3
  37. package/dist/index.esm.js.map +1 -1
  38. package/dist/index.js +44 -5
  39. package/dist/index.js.map +1 -1
  40. package/dist/indexable.d.ts +213 -1
  41. package/dist/indexable.esm.js +203 -3
  42. package/dist/indexable.esm.js.map +1 -1
  43. package/dist/indexable.js +204 -2
  44. package/dist/indexable.js.map +1 -1
  45. package/dist/mutts.umd.js +1 -1
  46. package/dist/mutts.umd.js.map +1 -1
  47. package/dist/mutts.umd.min.js +1 -1
  48. package/dist/mutts.umd.min.js.map +1 -1
  49. package/dist/promiseChain.d.ts +10 -0
  50. package/dist/promiseChain.esm.js +6 -0
  51. package/dist/promiseChain.esm.js.map +1 -1
  52. package/dist/promiseChain.js +6 -0
  53. package/dist/promiseChain.js.map +1 -1
  54. package/dist/reactive.d.ts +774 -33
  55. package/dist/reactive.esm.js +4 -1458
  56. package/dist/reactive.esm.js.map +1 -1
  57. package/dist/reactive.js +53 -1474
  58. package/dist/reactive.js.map +1 -1
  59. package/dist/std-decorators.d.ts +35 -0
  60. package/dist/std-decorators.esm.js +36 -1
  61. package/dist/std-decorators.esm.js.map +1 -1
  62. package/dist/std-decorators.js +36 -1
  63. package/dist/std-decorators.js.map +1 -1
  64. package/docs/ai/api-reference.md +133 -0
  65. package/docs/ai/manual.md +105 -0
  66. package/docs/iterableWeak.md +646 -0
  67. package/docs/mixin.md +229 -0
  68. package/docs/reactive/advanced.md +1280 -0
  69. package/docs/reactive/collections.md +767 -0
  70. package/docs/reactive/core.md +973 -0
  71. package/docs/reactive.md +21 -2688
  72. package/package.json +18 -5
  73. package/src/decorator.ts +266 -0
  74. package/src/destroyable.ts +199 -0
  75. package/src/eventful.ts +77 -0
  76. package/src/index.d.ts +9 -0
  77. package/src/index.ts +9 -0
  78. package/src/indexable.ts +484 -0
  79. package/src/introspection.ts +59 -0
  80. package/src/iterableWeak.ts +233 -0
  81. package/src/mixins.ts +123 -0
  82. package/src/promiseChain.ts +110 -0
  83. package/src/reactive/array.ts +414 -0
  84. package/src/reactive/change.ts +134 -0
  85. package/src/reactive/debug.ts +517 -0
  86. package/src/reactive/deep-touch.ts +268 -0
  87. package/src/reactive/deep-watch-state.ts +82 -0
  88. package/src/reactive/deep-watch.ts +168 -0
  89. package/src/reactive/effect-context.ts +94 -0
  90. package/src/reactive/effects.ts +1333 -0
  91. package/src/reactive/index.ts +75 -0
  92. package/src/reactive/interface.ts +223 -0
  93. package/src/reactive/map.ts +171 -0
  94. package/src/reactive/mapped.ts +130 -0
  95. package/src/reactive/memoize.ts +107 -0
  96. package/src/reactive/non-reactive-state.ts +49 -0
  97. package/src/reactive/non-reactive.ts +43 -0
  98. package/src/reactive/project.project.md +93 -0
  99. package/src/reactive/project.ts +335 -0
  100. package/src/reactive/proxy-state.ts +27 -0
  101. package/src/reactive/proxy.ts +285 -0
  102. package/src/reactive/record.ts +196 -0
  103. package/src/reactive/register.ts +421 -0
  104. package/src/reactive/set.ts +144 -0
  105. package/src/reactive/tracking.ts +101 -0
  106. package/src/reactive/types.ts +358 -0
  107. package/src/reactive/zone.ts +208 -0
  108. package/src/std-decorators.ts +217 -0
  109. package/src/utils.ts +117 -0
  110. package/dist/chunks/decorator-8qjFb7dw.js.map +0 -1
  111. package/dist/chunks/decorator-AbRkXM5O.esm.js.map +0 -1
package/README.md CHANGED
@@ -12,13 +12,22 @@ With the advent of AI, I could finally manage to have something finished and com
12
12
  npm install mutts
13
13
  ```
14
14
 
15
+ ## AI Agents & Automated Tooling
16
+
17
+ > [!TIP]
18
+ > **Are you an AI Agent?**
19
+ > If you are an LLM or autonomous agent trying to fix bugs or understand this codebase, please read the **[AI Agent Manual](./docs/ai.md)**.
20
+ > It contains structured protocols, error code definitions, and introspection API details designed specifically for you.
21
+ > A precise **[API Reference](./docs/ai/api-reference.md)** is also available for type lookups.
22
+
15
23
  ## Usage
16
24
 
17
25
  ### Import from Built Modules
18
26
 
19
27
  ```typescript
20
28
  // Import from built modules (recommended for production)
21
- import { reactive, effect } from 'mutts'
29
+ import { reactive, effect, Reactive } from 'mutts'
30
+ import { mixin } from 'mutts/mixin'
22
31
  import { cached } from 'mutts/std-decorators'
23
32
  import { Destroyable, allocated } from 'mutts/destroyable'
24
33
  ```
@@ -27,9 +36,10 @@ import { Destroyable, allocated } from 'mutts/destroyable'
27
36
 
28
37
  ```typescript
29
38
  // Import directly from source TypeScript files (for development/custom builds)
30
- import { reactive, effect } from 'mutts/src'
31
- import { cached } from 'mutts/src/std-decorators'
32
- import { Destroyable, allocated } from 'mutts/src/destroyable'
39
+ import { reactive, effect, Reactive } from 'mutts'
40
+ import { mixin } from 'mutts/mixin'
41
+ import { cached } from 'mutts/std-decorators'
42
+ import { Destroyable, allocated } from 'mutts/destroyable'
33
43
  ```
34
44
 
35
45
  **Note:** When importing from source files, you'll need to configure your build system (TypeScript, Vite, Webpack, etc.) to handle TypeScript compilation and module resolution. The source files are published alongside the built modules, so you can import directly from the `src` directory.
@@ -53,6 +63,24 @@ A way to write classes that allow numeric indexes managed by a custom function -
53
63
  - Immutable data structures
54
64
  - Performance-optimized access patterns
55
65
 
66
+ ## [Mixin](./docs/mixin.md)
67
+
68
+ A powerful mixin system that allows you to create reusable functionality that can be applied to classes either as base classes or as mixin functions. Provides automatic caching and seamless integration with other MutTs features.
69
+
70
+ **Key Features:**
71
+ - **Dual Usage**: Can be used as both base class (`extends MyMixin`) and mixin function (`MyMixin(SomeBase)`)
72
+ - **Automatic Caching**: Same base class always returns the same mixed class for performance
73
+ - **Type Safety**: Full TypeScript support with proper type inference
74
+ - **Proxy-based**: Uses JavaScript Proxies to handle both constructor and function calls
75
+ - **Memory Efficient**: Automatic cleanup when base classes are garbage collected
76
+
77
+ **Use Cases:**
78
+ - Creating reusable functionality across multiple classes
79
+ - Building composable class hierarchies
80
+ - Adding cross-cutting concerns (logging, events, reactivity)
81
+ - Framework development with mixin support
82
+ - Plugin systems and extensible architectures
83
+
56
84
  ## [Standard Decorators](./docs/std-decorators.md)
57
85
 
58
86
  A collection of standard decorators that shouldn't be implemented a 101-th time.
@@ -132,12 +160,14 @@ A comprehensive resource management system that provides automatic cleanup for o
132
160
 
133
161
  ## [Reactive](./docs/reactive.md)
134
162
 
135
- A comprehensive reactivity system that provides fine-grained dependency tracking and automatic re-computation. Built on JavaScript Proxies with support for deep watching, computed values, and effect management.
163
+ A comprehensive reactivity system. See the **[Introduction](./docs/reactive/core.md)** or browse the **[Table of Contents](./docs/reactive.md)**.
136
164
 
137
165
  **Key Features:**
138
- - **Core Reactivity**: Proxy-based property access tracking with `reactive()`, `effect()`, and `computed()`
166
+ - **Core Reactivity**: Proxy-based property access tracking with `reactive()`, `effect()`, and `memoize()`
139
167
  - **Deep Watching**: Automatic tracking of nested object changes with `deepWatch()`
140
168
  - **Reactive Collections**: Specialized reactive versions of Array, Map, Set, WeakMap, and WeakSet
169
+ - **Class Reactivity**: `@reactive` decorator and `ReactiveBase` for class-based reactivity
170
+ - **Reactive Mixin**: Always-reactive classes with mixin support (`Reactive`)
141
171
  - **Back-Reference System**: Efficient change propagation through object hierarchies
142
172
  - **Type Safety**: Full TypeScript support with proper type inference
143
173
  - **Performance Optimized**: Lazy back-reference creation and efficient dependency tracking
@@ -0,0 +1,81 @@
1
+ 'use strict';
2
+
3
+ /******************************************************************************
4
+ Copyright (c) Microsoft Corporation.
5
+
6
+ Permission to use, copy, modify, and/or distribute this software for any
7
+ purpose with or without fee is hereby granted.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
14
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
+ PERFORMANCE OF THIS SOFTWARE.
16
+ ***************************************************************************** */
17
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
18
+
19
+
20
+ function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
21
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
22
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
23
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
24
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
25
+ var _, done = false;
26
+ for (var i = decorators.length - 1; i >= 0; i--) {
27
+ var context = {};
28
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
29
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
30
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
31
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
32
+ if (kind === "accessor") {
33
+ if (result === void 0) continue;
34
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
35
+ if (_ = accept(result.get)) descriptor.get = _;
36
+ if (_ = accept(result.set)) descriptor.set = _;
37
+ if (_ = accept(result.init)) initializers.unshift(_);
38
+ }
39
+ else if (_ = accept(result)) {
40
+ if (kind === "field") initializers.unshift(_);
41
+ else descriptor[key] = _;
42
+ }
43
+ }
44
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
45
+ done = true;
46
+ }
47
+ function __runInitializers(thisArg, initializers, value) {
48
+ var useValue = arguments.length > 2;
49
+ for (var i = 0; i < initializers.length; i++) {
50
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
51
+ }
52
+ return useValue ? value : void 0;
53
+ }
54
+ function __setFunctionName(f, name, prefix) {
55
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
56
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
57
+ }
58
+ function __classPrivateFieldGet(receiver, state, kind, f) {
59
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
60
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
61
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
62
+ }
63
+
64
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
65
+ if (kind === "m") throw new TypeError("Private method is not writable");
66
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
67
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
68
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
69
+ }
70
+
71
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
72
+ var e = new Error(message);
73
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
74
+ };
75
+
76
+ exports.__classPrivateFieldGet = __classPrivateFieldGet;
77
+ exports.__classPrivateFieldSet = __classPrivateFieldSet;
78
+ exports.__esDecorate = __esDecorate;
79
+ exports.__runInitializers = __runInitializers;
80
+ exports.__setFunctionName = __setFunctionName;
81
+ //# sourceMappingURL=_tslib-BgjropY9.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_tslib-BgjropY9.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,75 @@
1
+ /******************************************************************************
2
+ Copyright (c) Microsoft Corporation.
3
+
4
+ Permission to use, copy, modify, and/or distribute this software for any
5
+ purpose with or without fee is hereby granted.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
8
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
9
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
10
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
11
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
12
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
13
+ PERFORMANCE OF THIS SOFTWARE.
14
+ ***************************************************************************** */
15
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
16
+
17
+
18
+ function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
19
+ function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
20
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
21
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
22
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
23
+ var _, done = false;
24
+ for (var i = decorators.length - 1; i >= 0; i--) {
25
+ var context = {};
26
+ for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
27
+ for (var p in contextIn.access) context.access[p] = contextIn.access[p];
28
+ context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
29
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
30
+ if (kind === "accessor") {
31
+ if (result === void 0) continue;
32
+ if (result === null || typeof result !== "object") throw new TypeError("Object expected");
33
+ if (_ = accept(result.get)) descriptor.get = _;
34
+ if (_ = accept(result.set)) descriptor.set = _;
35
+ if (_ = accept(result.init)) initializers.unshift(_);
36
+ }
37
+ else if (_ = accept(result)) {
38
+ if (kind === "field") initializers.unshift(_);
39
+ else descriptor[key] = _;
40
+ }
41
+ }
42
+ if (target) Object.defineProperty(target, contextIn.name, descriptor);
43
+ done = true;
44
+ }
45
+ function __runInitializers(thisArg, initializers, value) {
46
+ var useValue = arguments.length > 2;
47
+ for (var i = 0; i < initializers.length; i++) {
48
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
49
+ }
50
+ return useValue ? value : void 0;
51
+ }
52
+ function __setFunctionName(f, name, prefix) {
53
+ if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
54
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
55
+ }
56
+ function __classPrivateFieldGet(receiver, state, kind, f) {
57
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
58
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
59
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
60
+ }
61
+
62
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
63
+ if (kind === "m") throw new TypeError("Private method is not writable");
64
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
65
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
66
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
67
+ }
68
+
69
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
70
+ var e = new Error(message);
71
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
72
+ };
73
+
74
+ export { __classPrivateFieldGet as _, __setFunctionName as a, __esDecorate as b, __runInitializers as c, __classPrivateFieldSet as d };
75
+ //# sourceMappingURL=_tslib-Mzh1rNsX.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_tslib-Mzh1rNsX.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,5 +1,10 @@
1
1
  'use strict';
2
2
 
3
+ /**
4
+ * Combines multiple arrays into an array of tuples, stopping at the shortest array length
5
+ * @param args - Arrays to zip together
6
+ * @returns Array of tuples containing elements from each input array
7
+ */
3
8
  function zip(...args) {
4
9
  if (!args.length)
5
10
  return [];
@@ -11,6 +16,25 @@ function zip(...args) {
11
16
  }
12
17
  return result;
13
18
  }
19
+ /**
20
+ * Checks if two arrays are strictly equal (shallow comparison)
21
+ * @param a - First value
22
+ * @param b - Second value
23
+ * @returns True if arrays are equal or values are strictly equal
24
+ */
25
+ function arrayEquals(a, b) {
26
+ if (a === b)
27
+ return true;
28
+ if (!Array.isArray(a) || !Array.isArray(b))
29
+ return false;
30
+ if (a.length !== b.length)
31
+ return false;
32
+ for (let i = 0; i < a.length; i++) {
33
+ if (a[i] !== b[i])
34
+ return false;
35
+ }
36
+ return true;
37
+ }
14
38
  const nativeConstructors = new Set([
15
39
  Object,
16
40
  Array,
@@ -35,9 +59,22 @@ const nativeConstructors = new Set([
35
59
  Number,
36
60
  Boolean,
37
61
  ]);
62
+ /**
63
+ * Checks if a function is a constructor (class or constructor function)
64
+ * @param fn - The function to check
65
+ * @returns True if the function is a constructor
66
+ */
38
67
  function isConstructor(fn) {
39
- return fn && (nativeConstructors.has(fn) || fn.toString?.().startsWith('class '));
68
+ return (fn &&
69
+ typeof fn === 'function' &&
70
+ (nativeConstructors.has(fn) || fn.toString?.().startsWith('class ')));
40
71
  }
72
+ /**
73
+ * Renames a function with a new name
74
+ * @param fct - The function to rename
75
+ * @param name - The new name for the function
76
+ * @returns The function with the new name
77
+ */
41
78
  function renamed(fct, name) {
42
79
  return Object.defineProperties(fct, {
43
80
  name: {
@@ -45,22 +82,57 @@ function renamed(fct, name) {
45
82
  },
46
83
  });
47
84
  }
85
+ function ReflectGet(obj, prop, receiver) {
86
+ // Check if Node is available and obj is an instance of Node
87
+ if (typeof Node !== 'undefined' && obj instanceof Node)
88
+ return obj[prop];
89
+ return Reflect.get(obj, prop, receiver);
90
+ }
91
+ function ReflectSet(obj, prop, value, receiver) {
92
+ // Check if Node is available and obj is an instance of Node
93
+ if (typeof Node !== 'undefined' && obj instanceof Node) {
94
+ obj[prop] = value;
95
+ return true;
96
+ }
97
+ if (!(obj instanceof Object) && !Reflect.has(obj, prop)) {
98
+ Object.defineProperty(obj, prop, {
99
+ value,
100
+ configurable: true,
101
+ writable: true,
102
+ enumerable: true,
103
+ });
104
+ return true;
105
+ }
106
+ return Reflect.set(obj, prop, value, receiver);
107
+ }
108
+ function isOwnAccessor(obj, prop) {
109
+ const opd = Object.getOwnPropertyDescriptor(obj, prop);
110
+ return !!(opd?.get || opd?.set);
111
+ }
48
112
 
49
113
  // biome-ignore-all lint/suspicious/noConfusingVoidType: We *love* voids
50
114
  // Standardized decorator system that works with both Legacy and Modern decorators
115
+ /**
116
+ * Error thrown when decorator operations fail
117
+ */
51
118
  class DecoratorError extends Error {
52
119
  constructor(message) {
53
120
  super(message);
54
121
  this.name = 'DecoratorException';
55
122
  }
56
123
  }
124
+ /**
125
+ * Creates a decorator that works with Legacy decorator proposals
126
+ * @param description - The decorator description object
127
+ * @returns A decorator function compatible with Legacy decorators
128
+ */
57
129
  function legacyDecorator(description) {
58
130
  return function (target, propertyKey, descriptor, ...args) {
59
131
  if (propertyKey === undefined) {
60
132
  if (isConstructor(target)) {
61
133
  if (!('class' in description))
62
134
  throw new Error('Decorator cannot be applied to a class');
63
- return description.class?.(target);
135
+ return description.class(target);
64
136
  }
65
137
  }
66
138
  else if (typeof target === 'object' && ['string', 'symbol'].includes(typeof propertyKey)) {
@@ -71,12 +143,12 @@ function legacyDecorator(description) {
71
143
  if (!('getter' in description || 'setter' in description))
72
144
  throw new Error('Decorator cannot be applied to a getter or setter');
73
145
  if ('getter' in description) {
74
- const newGetter = description.getter?.(descriptor.get, propertyKey);
146
+ const newGetter = description.getter(descriptor.get, propertyKey);
75
147
  if (newGetter)
76
148
  descriptor.get = newGetter;
77
149
  }
78
150
  if ('setter' in description) {
79
- const newSetter = description.setter?.(descriptor.set, propertyKey);
151
+ const newSetter = description.setter(descriptor.set, propertyKey);
80
152
  if (newSetter)
81
153
  descriptor.set = newSetter;
82
154
  }
@@ -85,7 +157,7 @@ function legacyDecorator(description) {
85
157
  else if (typeof descriptor.value === 'function') {
86
158
  if (!('method' in description))
87
159
  throw new Error('Decorator cannot be applied to a method');
88
- const newMethod = description.method?.(descriptor.value, propertyKey);
160
+ const newMethod = description.method(descriptor.value, propertyKey);
89
161
  if (newMethod)
90
162
  descriptor.value = newMethod;
91
163
  return descriptor;
@@ -97,7 +169,13 @@ function legacyDecorator(description) {
97
169
  return description.default.call(this, target, propertyKey, descriptor, ...args);
98
170
  };
99
171
  }
172
+ /**
173
+ * Creates a decorator that works with Modern decorator proposals
174
+ * @param description - The decorator description object
175
+ * @returns A decorator function compatible with Modern decorators
176
+ */
100
177
  function modernDecorator(description) {
178
+ /*return function (target: any, context?: DecoratorContext, ...args: any[]) {*/
101
179
  return function (target, context, ...args) {
102
180
  if (!context?.kind || typeof context.kind !== 'string') {
103
181
  if (!('default' in description))
@@ -108,32 +186,32 @@ function modernDecorator(description) {
108
186
  case 'class':
109
187
  if (!('class' in description))
110
188
  throw new Error('Decorator cannot be applied to a class');
111
- return description.class?.(target);
189
+ return description.class(target);
112
190
  case 'field':
113
191
  throw new Error('Decorator cannot be applied to a field');
114
192
  case 'getter':
115
193
  if (!('getter' in description))
116
194
  throw new Error('Decorator cannot be applied to a getter');
117
- return description.getter?.(target, context.name);
195
+ return description.getter(target, context.name);
118
196
  case 'setter':
119
197
  if (!('setter' in description))
120
198
  throw new Error('Decorator cannot be applied to a setter');
121
- return description.setter?.(target, context.name);
199
+ return description.setter(target, context.name);
122
200
  case 'method':
123
201
  if (!('method' in description))
124
202
  throw new Error('Decorator cannot be applied to a method');
125
- return description.method?.(target, context.name);
203
+ return description.method(target, context.name);
126
204
  case 'accessor': {
127
205
  if (!('getter' in description || 'setter' in description))
128
206
  throw new Error('Decorator cannot be applied to a getter or setter');
129
207
  const rv = {};
130
208
  if ('getter' in description) {
131
- const newGetter = description.getter?.(target.get, context.name);
209
+ const newGetter = description.getter(target.get, context.name);
132
210
  if (newGetter)
133
211
  rv.get = newGetter;
134
212
  }
135
213
  if ('setter' in description) {
136
- const newSetter = description.setter?.(target.set, context.name);
214
+ const newSetter = description.setter(target.set, context.name);
137
215
  if (newSetter)
138
216
  rv.set = newSetter;
139
217
  }
@@ -157,20 +235,31 @@ function detectDecoratorMode(_target, contextOrKey, _descriptor) {
157
235
  }
158
236
  return 'legacy';
159
237
  }
238
+ /**
239
+ * Main decorator factory that automatically detects and works with both Legacy and Modern decorator proposals
240
+ * @param description - The decorator description object
241
+ * @returns A decorator that works in both Legacy and Modern environments
242
+ */
160
243
  const decorator = (description) => {
244
+ const modern = modernDecorator(description);
245
+ const legacy = legacyDecorator(description);
161
246
  return ((target, contextOrKey, ...args) => {
162
247
  const mode = detectDecoratorMode(target, contextOrKey, args[0]);
163
248
  return mode === 'modern'
164
- ? modernDecorator(description)(target, contextOrKey, ...args)
165
- : legacyDecorator(description)(target, contextOrKey, ...args);
249
+ ? modern(target, contextOrKey, ...args)
250
+ : legacy(target, contextOrKey, ...args);
166
251
  });
167
252
  };
168
253
 
169
254
  exports.DecoratorError = DecoratorError;
255
+ exports.ReflectGet = ReflectGet;
256
+ exports.ReflectSet = ReflectSet;
257
+ exports.arrayEquals = arrayEquals;
170
258
  exports.decorator = decorator;
171
259
  exports.isConstructor = isConstructor;
260
+ exports.isOwnAccessor = isOwnAccessor;
172
261
  exports.legacyDecorator = legacyDecorator;
173
262
  exports.modernDecorator = modernDecorator;
174
263
  exports.renamed = renamed;
175
264
  exports.zip = zip;
176
- //# sourceMappingURL=decorator-8qjFb7dw.js.map
265
+ //# sourceMappingURL=decorator-DLvrD0UF.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decorator-DLvrD0UF.js","sources":["../../src/utils.ts","../../src/decorator.ts"],"sourcesContent":["type ElementTypes<T extends readonly unknown[]> = {\n\t[K in keyof T]: T[K] extends readonly (infer U)[] ? U : T[K]\n}\n\n/**\n * Combines multiple arrays into an array of tuples, stopping at the shortest array length\n * @param args - Arrays to zip together\n * @returns Array of tuples containing elements from each input array\n */\nexport function zip<T extends (readonly unknown[])[]>(...args: T): ElementTypes<T>[] {\n\tif (!args.length) return []\n\tconst minLength = Math.min(...args.map((arr) => arr.length))\n\tconst result: ElementTypes<T>[] = []\n\n\tfor (let i = 0; i < minLength; i++) {\n\t\tconst tuple = args.map((arr) => arr[i]) as ElementTypes<T>\n\t\tresult.push(tuple)\n\t}\n\n\treturn result\n}\n\n/**\n * Checks if two arrays are strictly equal (shallow comparison)\n * @param a - First value\n * @param b - Second value\n * @returns True if arrays are equal or values are strictly equal\n */\nexport function arrayEquals(a: any, b: any): boolean {\n\tif (a === b) return true\n\tif (!Array.isArray(a) || !Array.isArray(b)) return false\n\tif (a.length !== b.length) return false\n\tfor (let i = 0; i < a.length; i++) {\n\t\tif (a[i] !== b[i]) return false\n\t}\n\treturn true\n}\n\nconst nativeConstructors = new Set<Function>([\n\tObject,\n\tArray,\n\tDate,\n\tFunction,\n\tSet,\n\tMap,\n\tWeakMap,\n\tWeakSet,\n\tPromise,\n\tError,\n\tTypeError,\n\tReferenceError,\n\tSyntaxError,\n\tRangeError,\n\tURIError,\n\tEvalError,\n\tReflect,\n\tProxy,\n\tRegExp,\n\tString,\n\tNumber,\n\tBoolean,\n] as Function[])\n/**\n * Checks if a function is a constructor (class or constructor function)\n * @param fn - The function to check\n * @returns True if the function is a constructor\n */\nexport function isConstructor(fn: Function): boolean {\n\treturn (\n\t\tfn &&\n\t\ttypeof fn === 'function' &&\n\t\t(nativeConstructors.has(fn) || fn.toString?.().startsWith('class '))\n\t)\n}\n\n/**\n * Renames a function with a new name\n * @param fct - The function to rename\n * @param name - The new name for the function\n * @returns The function with the new name\n */\nexport function renamed<F extends Function>(fct: F, name: string): F {\n\treturn Object.defineProperties(fct, {\n\t\tname: {\n\t\t\tvalue: name,\n\t\t},\n\t})\n}\n\nexport function ReflectGet(obj: any, prop: any, receiver: any) {\n\t// Check if Node is available and obj is an instance of Node\n\tif (typeof Node !== 'undefined' && obj instanceof Node) return (obj as any)[prop]\n\treturn Reflect.get(obj, prop, receiver)\n}\n\nexport function ReflectSet(obj: any, prop: any, value: any, receiver: any) {\n\t// Check if Node is available and obj is an instance of Node\n\tif (typeof Node !== 'undefined' && obj instanceof Node) {\n\t\t;(obj as any)[prop] = value\n\t\treturn true\n\t}\n\tif (!(obj instanceof Object) && !Reflect.has(obj, prop)) {\n\t\tObject.defineProperty(obj, prop, {\n\t\t\tvalue,\n\t\t\tconfigurable: true,\n\t\t\twritable: true,\n\t\t\tenumerable: true,\n\t\t})\n\t\treturn true\n\t}\n\treturn Reflect.set(obj, prop, value, receiver)\n}\n\nexport function isOwnAccessor(obj: any, prop: any) {\n\tconst opd = Object.getOwnPropertyDescriptor(obj, prop)\n\treturn !!(opd?.get || opd?.set)\n}\n","// biome-ignore-all lint/suspicious/noConfusingVoidType: We *love* voids\n// Standardized decorator system that works with both Legacy and Modern decorators\n\nimport { isConstructor } from './utils'\n\n/**\n * Error thrown when decorator operations fail\n */\nexport class DecoratorError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message)\n\t\tthis.name = 'DecoratorException'\n\t}\n}\n//#region all decorator types\n\n// Used for get/set and method decorators\n/**\n * Legacy property decorator type for methods, getters, and setters\n */\nexport type LegacyPropertyDecorator<T> = (\n\ttarget: T,\n\tname: string | symbol,\n\tdescriptor: PropertyDescriptor\n) => any\n\n/**\n * Legacy class decorator type\n */\nexport type LegacyClassDecorator<T> = (target: T) => any\n\n/**\n * Modern method decorator type\n */\nexport type ModernMethodDecorator<T> = (target: T, context: ClassMethodDecoratorContext) => any\n\n/**\n * Modern getter decorator type\n */\nexport type ModernGetterDecorator<T> = (target: T, context: ClassGetterDecoratorContext) => any\n\n/**\n * Modern setter decorator type\n */\nexport type ModernSetterDecorator<T> = (target: T, context: ClassSetterDecoratorContext) => any\n\n/**\n * Modern accessor decorator type\n */\nexport type ModernAccessorDecorator<T> = (target: T, context: ClassAccessorDecoratorContext) => any\n\n/**\n * Modern class decorator type\n */\nexport type ModernClassDecorator<T> = (target: T, context: ClassDecoratorContext) => any\n\n//#endregion\n\ntype DDMethod<T> = (\n\toriginal: (this: T, ...args: any[]) => any,\n\tname: PropertyKey\n) => ((this: T, ...args: any[]) => any) | void\n\ntype DDGetter<T> = (original: (this: T) => any, name: PropertyKey) => ((this: T) => any) | void\n\ntype DDSetter<T> = (\n\toriginal: (this: T, value: any) => void,\n\tname: PropertyKey\n) => ((this: T, value: any) => void) | void\n\ntype DDClass<T> = <Ctor extends new (...args: any[]) => T = new (...args: any[]) => T>(\n\ttarget: Ctor\n) => Ctor | void\n/**\n * Description object for creating decorators that work with both Legacy and Modern decorator proposals\n */\nexport interface DecoratorDescription<T> {\n\t/** Handler for method decorators */\n\tmethod?: DDMethod<T>\n\t/** Handler for class decorators */\n\tclass?: DDClass<T>\n\t/** Handler for getter decorators */\n\tgetter?: DDGetter<T>\n\t/** Handler for setter decorators */\n\tsetter?: DDSetter<T>\n\t/** Default handler for any decorator type not explicitly defined */\n\tdefault?: (...args: any[]) => any\n}\n\n/**\n * Type for decorators that work with both Legacy and Modern decorator proposals\n * Automatically infers the correct decorator type based on the description\n */\nexport type Decorator<T, Description extends DecoratorDescription<T>> = (Description extends {\n\tmethod: DDMethod<T>\n}\n\t? LegacyPropertyDecorator<T> & ModernMethodDecorator<T>\n\t: unknown) &\n\t(Description extends { class: DDClass<new (...args: any[]) => T> }\n\t\t? LegacyClassDecorator<new (...args: any[]) => T> &\n\t\t\t\tModernClassDecorator<new (...args: any[]) => T>\n\t\t: unknown) &\n\t(Description extends { getter: DDGetter<T> }\n\t\t? LegacyPropertyDecorator<T> & ModernGetterDecorator<T> & ModernAccessorDecorator<T>\n\t\t: unknown) &\n\t(Description extends { setter: DDSetter<T> }\n\t\t? LegacyPropertyDecorator<T> & ModernSetterDecorator<T> & ModernAccessorDecorator<T>\n\t\t: unknown) &\n\t(Description extends { default: infer Signature } ? Signature : unknown)\n\n/**\n * Factory type for creating decorators that work with both Legacy and Modern decorator proposals\n */\nexport type DecoratorFactory<T> = <Description extends DecoratorDescription<T>>(\n\tdescription: Description\n) => (Description extends { method: DDMethod<T> }\n\t? LegacyPropertyDecorator<T> & ModernMethodDecorator<T>\n\t: unknown) &\n\t(Description extends { class: DDClass<new (...args: any[]) => T> }\n\t\t? LegacyClassDecorator<new (...args: any[]) => T> &\n\t\t\t\tModernClassDecorator<new (...args: any[]) => T>\n\t\t: unknown) &\n\t(Description extends { getter: DDGetter<T> }\n\t\t? LegacyPropertyDecorator<T> & ModernGetterDecorator<T> & ModernAccessorDecorator<T>\n\t\t: unknown) &\n\t(Description extends { setter: DDSetter<T> }\n\t\t? LegacyPropertyDecorator<T> & ModernSetterDecorator<T> & ModernAccessorDecorator<T>\n\t\t: unknown) &\n\t(Description extends { default: infer Signature } ? Signature : unknown)\n\n/**\n * Creates a decorator that works with Legacy decorator proposals\n * @param description - The decorator description object\n * @returns A decorator function compatible with Legacy decorators\n */\nexport function legacyDecorator<T = any>(description: DecoratorDescription<T>): any {\n\treturn function (\n\t\tthis: any,\n\t\ttarget: any,\n\t\tpropertyKey?: PropertyKey,\n\t\tdescriptor?: PropertyDescriptor,\n\t\t...args: any[]\n\t) {\n\t\tif (propertyKey === undefined) {\n\t\t\tif (isConstructor(target)) {\n\t\t\t\tif (!('class' in description)) throw new Error('Decorator cannot be applied to a class')\n\t\t\t\treturn description.class!(target)\n\t\t\t}\n\t\t} else if (typeof target === 'object' && ['string', 'symbol'].includes(typeof propertyKey)) {\n\t\t\tif (!descriptor) throw new Error('Decorator cannot be applied to a field')\n\t\t\telse if (typeof descriptor === 'object' && 'configurable' in descriptor) {\n\t\t\t\tif ('get' in descriptor || 'set' in descriptor) {\n\t\t\t\t\tif (!('getter' in description || 'setter' in description))\n\t\t\t\t\t\tthrow new Error('Decorator cannot be applied to a getter or setter')\n\t\t\t\t\tif ('getter' in description) {\n\t\t\t\t\t\tconst newGetter = description.getter!(descriptor.get as any, propertyKey)\n\t\t\t\t\t\tif (newGetter) descriptor.get = newGetter\n\t\t\t\t\t}\n\t\t\t\t\tif ('setter' in description) {\n\t\t\t\t\t\tconst newSetter = description.setter!(descriptor.set as any, propertyKey)\n\t\t\t\t\t\tif (newSetter) descriptor.set = newSetter\n\t\t\t\t\t}\n\t\t\t\t\treturn descriptor\n\t\t\t\t} else if (typeof descriptor.value === 'function') {\n\t\t\t\t\tif (!('method' in description)) throw new Error('Decorator cannot be applied to a method')\n\t\t\t\t\tconst newMethod = description.method!(descriptor.value, propertyKey)\n\t\t\t\t\tif (newMethod) descriptor.value = newMethod\n\t\t\t\t\treturn descriptor\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (!('default' in description))\n\t\t\tthrow new Error('Decorator do not have a default implementation')\n\t\treturn description.default!.call(this, target, propertyKey, descriptor, ...args)\n\t}\n}\n\n/**\n * Creates a decorator that works with Modern decorator proposals\n * @param description - The decorator description object\n * @returns A decorator function compatible with Modern decorators\n */\nexport function modernDecorator<T = any>(description: DecoratorDescription<T>): any {\n\t/*return function (target: any, context?: DecoratorContext, ...args: any[]) {*/\n\treturn function (this: any, target: any, context?: DecoratorContext, ...args: any[]) {\n\t\tif (!context?.kind || typeof context.kind !== 'string') {\n\t\t\tif (!('default' in description))\n\t\t\t\tthrow new Error('Decorator do not have a default implementation')\n\t\t\treturn description.default!.call(this, target, context, ...args)\n\t\t}\n\t\tswitch (context.kind) {\n\t\t\tcase 'class':\n\t\t\t\tif (!('class' in description)) throw new Error('Decorator cannot be applied to a class')\n\t\t\t\treturn description.class!(target)\n\t\t\tcase 'field':\n\t\t\t\tthrow new Error('Decorator cannot be applied to a field')\n\t\t\tcase 'getter':\n\t\t\t\tif (!('getter' in description)) throw new Error('Decorator cannot be applied to a getter')\n\t\t\t\treturn description.getter!(target, context.name)\n\t\t\tcase 'setter':\n\t\t\t\tif (!('setter' in description)) throw new Error('Decorator cannot be applied to a setter')\n\t\t\t\treturn description.setter!(target, context.name)\n\t\t\tcase 'method':\n\t\t\t\tif (!('method' in description)) throw new Error('Decorator cannot be applied to a method')\n\t\t\t\treturn description.method!(target, context.name)\n\t\t\tcase 'accessor': {\n\t\t\t\tif (!('getter' in description || 'setter' in description))\n\t\t\t\t\tthrow new Error('Decorator cannot be applied to a getter or setter')\n\t\t\t\tconst rv: Partial<ClassAccessorDecoratorResult<any, any>> = {}\n\t\t\t\tif ('getter' in description) {\n\t\t\t\t\tconst newGetter = description.getter!(target.get, context.name)\n\t\t\t\t\tif (newGetter) rv.get = newGetter\n\t\t\t\t}\n\t\t\t\tif ('setter' in description) {\n\t\t\t\t\tconst newSetter = description.setter!(target.set, context.name)\n\t\t\t\t\tif (newSetter) rv.set = newSetter\n\t\t\t\t}\n\t\t\t\treturn rv\n\t\t\t}\n\t\t\t//return description.accessor?.(target, context.name, target)\n\t\t}\n\t}\n}\n\n/**\n * Detects if the decorator is being called in modern (Modern) or legacy (Legacy) mode\n * based on the arguments passed to the decorator function\n */\nfunction detectDecoratorMode(\n\t_target: any,\n\tcontextOrKey?: any,\n\t_descriptor?: any\n): 'modern' | 'legacy' {\n\t// Modern decorators have a context object as the second parameter\n\t// Legacy decorators have a string/symbol key as the second parameter\n\tif (\n\t\ttypeof contextOrKey === 'object' &&\n\t\tcontextOrKey !== null &&\n\t\ttypeof contextOrKey.kind === 'string'\n\t) {\n\t\treturn 'modern'\n\t}\n\treturn 'legacy'\n}\n\n/**\n * Main decorator factory that automatically detects and works with both Legacy and Modern decorator proposals\n * @param description - The decorator description object\n * @returns A decorator that works in both Legacy and Modern environments\n */\nexport const decorator: DecoratorFactory<any> = (description: DecoratorDescription<any>) => {\n\tconst modern = modernDecorator(description)\n\tconst legacy = legacyDecorator(description)\n\treturn ((target: any, contextOrKey?: any, ...args: any[]) => {\n\t\tconst mode = detectDecoratorMode(target, contextOrKey, args[0])\n\t\treturn mode === 'modern'\n\t\t\t? modern(target, contextOrKey, ...args)\n\t\t\t: legacy(target, contextOrKey, ...args)\n\t}) as any\n}\n\n/**\n * Generic class decorator type that works with both Legacy and Modern decorator proposals\n */\nexport type GenericClassDecorator<T> = LegacyClassDecorator<abstract new (...args: any[]) => T> &\n\tModernClassDecorator<abstract new (...args: any[]) => T>\n"],"names":[],"mappings":";;AAIA;;;;AAIG;AACG,SAAU,GAAG,CAAmC,GAAG,IAAO,EAAA;IAC/D,IAAI,CAAC,IAAI,CAAC,MAAM;AAAE,QAAA,OAAO,EAAE;IAC3B,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5D,MAAM,MAAM,GAAsB,EAAE;AAEpC,IAAA,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,EAAE,CAAC,EAAE,EAAE;AACnC,QAAA,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAoB;AAC1D,QAAA,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;IACnB;AAEA,IAAA,OAAO,MAAM;AACd;AAEA;;;;;AAKG;AACG,SAAU,WAAW,CAAC,CAAM,EAAE,CAAM,EAAA;IACzC,IAAI,CAAC,KAAK,CAAC;AAAE,QAAA,OAAO,IAAI;AACxB,IAAA,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,KAA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