likec4 1.59.3 → 1.60.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 (99) hide show
  1. package/__app__/codegen/react.mjs +6 -6
  2. package/__app__/codegen/webcomponent.mjs +147 -69
  3. package/__app__/src/aichat/index.mjs +10 -5
  4. package/__app__/src/chunks/AIChat.mjs +1134 -693
  5. package/__app__/src/chunks/LikeC4Styles.mjs +4101 -1737
  6. package/__app__/src/chunks/ProjectsOverview.mjs +624 -334
  7. package/__app__/src/chunks/es.mjs +515 -335
  8. package/__app__/src/chunks/hooks.mjs +578 -366
  9. package/__app__/src/chunks/libs/@floating-ui.mjs +2720 -1966
  10. package/__app__/src/chunks/libs/@mantine.mjs +14067 -9487
  11. package/__app__/src/chunks/libs/@tanstack-ai.mjs +2266 -1146
  12. package/__app__/src/chunks/libs/@tanstack.mjs +3152 -1932
  13. package/__app__/src/chunks/libs/@xstate/react.mjs +2924 -1468
  14. package/__app__/src/chunks/libs/@xyflow/react.mjs +6627 -4067
  15. package/__app__/src/chunks/libs/bezier-js.mjs +1312 -726
  16. package/__app__/src/chunks/libs/d3.mjs +3218 -1509
  17. package/__app__/src/chunks/libs/fast-equals.mjs +437 -201
  18. package/__app__/src/chunks/libs/framer.mjs +9251 -3846
  19. package/__app__/src/chunks/libs/nanostores.mjs +174 -0
  20. package/__app__/src/chunks/libs/zod.mjs +4591 -2363
  21. package/__app__/src/chunks/rolldown-runtime.mjs +39 -23
  22. package/__app__/src/chunks/styled-system.mjs +3538 -756
  23. package/__app__/src/fonts.css +112 -1
  24. package/__app__/src/main.mjs +44398 -24039
  25. package/__app__/src/style.css +18488 -1
  26. package/config/schema.json +136 -97
  27. package/dist/app/render-view-client.css +1 -1
  28. package/dist/app/render-view-client.js +506 -338
  29. package/dist/chunks/enableServer.mjs +1 -1
  30. package/dist/chunks/filenames.mjs +16 -14
  31. package/dist/chunks/generate-likec4.mjs +5 -0
  32. package/dist/chunks/index.d.mts +246 -180
  33. package/dist/chunks/index2.d.mts +2882 -1977
  34. package/dist/chunks/libs/@chevrotain/gast.mjs +27 -1
  35. package/dist/chunks/libs/@chevrotain/regexp-to-ast.mjs +81 -9
  36. package/dist/chunks/libs/@chevrotain/types.d.mts +111 -0
  37. package/dist/chunks/libs/@logtape/logtape.mjs +5 -4
  38. package/dist/chunks/libs/@lume/kiwi.mjs +1 -1
  39. package/dist/chunks/libs/@ts-graphviz/core.mjs +1 -1
  40. package/dist/chunks/libs/birpc.mjs +1 -1
  41. package/dist/chunks/libs/chevrotain-allstar.mjs +2 -2
  42. package/dist/chunks/libs/chevrotain.mjs +87 -35
  43. package/dist/chunks/libs/eventemitter3.mjs +1 -1
  44. package/dist/chunks/libs/json5.mjs +4 -4
  45. package/dist/chunks/libs/langium.d.mts +9903 -5297
  46. package/dist/chunks/libs/langium.mjs +16 -24
  47. package/dist/chunks/libs/merge-error-cause.mjs +1 -1
  48. package/dist/chunks/libs/p-limit.mjs +1 -0
  49. package/dist/chunks/libs/p-queue.mjs +1 -1
  50. package/dist/chunks/libs/package-manager-detector.mjs +1 -1
  51. package/dist/chunks/libs/pako.mjs +2 -2
  52. package/dist/chunks/libs/pretty-ms.mjs +1 -1
  53. package/dist/chunks/libs/remeda.mjs +1 -1
  54. package/dist/chunks/libs/ufo.mjs +1 -1
  55. package/dist/chunks/libs/unstorage.mjs +1 -1
  56. package/dist/chunks/libs/which.mjs +1 -1
  57. package/dist/chunks/node.mjs +60 -60
  58. package/dist/chunks/rolldown-runtime.mjs +1 -1
  59. package/dist/chunks/sequence-view.mjs +1 -1
  60. package/dist/chunks/vite-plugin.mjs +55 -52
  61. package/dist/cli/index.d.mts +1 -1
  62. package/dist/cli/index.mjs +208 -1300
  63. package/dist/config/index.d.mts +2 -2
  64. package/dist/generators/likec4.d.mts +6578 -0
  65. package/dist/generators/likec4.mjs +1 -0
  66. package/dist/index.d.mts +3 -3
  67. package/dist/model/index.d.mts +8 -5
  68. package/dist/vite-plugin/index.d.mts +6 -3
  69. package/dist/vite-plugin/index.mjs +1 -1
  70. package/dist/vite-plugin/internal/chunks/rolldown-runtime.mjs +9 -0
  71. package/dist/vite-plugin/internal/index.d.mts +16 -15
  72. package/dist/vite-plugin/internal/index.mjs +144 -46
  73. package/generators/likec4/package.json +4 -0
  74. package/package.json +117 -110
  75. package/react/index.d.mts +8500 -5399
  76. package/react/index.mjs +534 -58617
  77. package/react/rolldown-runtime-DnkiqaRY.js +1 -0
  78. package/skills/likec4-dsl/SKILL.md +428 -0
  79. package/skills/likec4-dsl/evals/evals-public.json +202 -0
  80. package/skills/likec4-dsl/evals/grading-spec.json +589 -0
  81. package/skills/likec4-dsl/references/bridge-leanix-drawio.md +42 -0
  82. package/skills/likec4-dsl/references/cli.md +139 -0
  83. package/skills/likec4-dsl/references/configuration.md +266 -0
  84. package/skills/likec4-dsl/references/deployment.md +160 -0
  85. package/skills/likec4-dsl/references/dynamic-views.md +455 -0
  86. package/skills/likec4-dsl/references/examples.md +370 -0
  87. package/skills/likec4-dsl/references/identifier-validity.md +90 -0
  88. package/skills/likec4-dsl/references/include-predicates-wildcards.md +179 -0
  89. package/skills/likec4-dsl/references/model.md +151 -0
  90. package/skills/likec4-dsl/references/predicates.md +123 -0
  91. package/skills/likec4-dsl/references/relationships-bidirectional.md +176 -0
  92. package/skills/likec4-dsl/references/specification.md +75 -0
  93. package/skills/likec4-dsl/references/style-tokens-colors.md +150 -0
  94. package/skills/likec4-dsl/references/troubleshooting.md +96 -0
  95. package/skills/likec4-dsl/references/views.md +329 -0
  96. package/vite-plugin-modules.d.ts +4 -2
  97. package/dist/chunks/libs/picomatch.mjs +0 -1
  98. package/dist/chunks/libs/zod.d.mts +0 -2140
  99. package/dist/chunks/libs/zod.mjs +0 -65
@@ -1,269 +1,505 @@
1
1
  import "../rolldown-runtime.mjs";
2
- //#region ../../node_modules/.pnpm/fast-equals@6.0.2/node_modules/fast-equals/dist/es/index.mjs
3
- var { getOwnPropertyNames: e, getOwnPropertySymbols: t } = Object, { hasOwnProperty: n } = Object.prototype;
4
- function combineComparators(e, t) {
5
- return function isEqual(n, r, i) {
6
- return e(n, r, i) && t(n, r, i);
2
+ //#region ../../node_modules/.pnpm/fast-equals@6.1.1/node_modules/fast-equals/dist/es/index.mjs
3
+ var { getOwnPropertyNames, getOwnPropertySymbols } = Object;
4
+ var { hasOwnProperty, toString: toString$1 } = Object.prototype;
5
+ var OBJECT_TAG = "[object Object]";
6
+ /**
7
+ * Combine two comparators into a single comparators.
8
+ */
9
+ function combineComparators(comparatorA, comparatorB) {
10
+ return function isEqual(a, b, state) {
11
+ return comparatorA(a, b, state) && comparatorB(a, b, state);
7
12
  };
8
13
  }
9
- function createIsCircular(e) {
10
- return function isCircular(t, n, r) {
11
- if (!t || !n || typeof t != "object" || typeof n != "object") return e(t, n, r);
12
- let { cache: i } = r, a = i.get(t), o = i.get(n);
13
- if (a && o) return a === n && o === t;
14
- i.set(t, n), i.set(n, t);
15
- let s = e(t, n, r);
16
- return i.delete(t), i.delete(n), s;
14
+ /**
15
+ * Wrap the provided `areItemsEqual` method to manage the circular state, allowing
16
+ * for circular references to be safely included in the comparison without creating
17
+ * stack overflows.
18
+ */
19
+ function createIsCircular(areItemsEqual) {
20
+ return function isCircular(a, b, state) {
21
+ if (!a || !b || typeof a !== "object" || typeof b !== "object") return areItemsEqual(a, b, state);
22
+ const { cache } = state;
23
+ const cachedA = cache.get(a);
24
+ const cachedB = cache.get(b);
25
+ if (cachedA && cachedB) return cachedA === b && cachedB === a;
26
+ cache.set(a, b);
27
+ cache.set(b, a);
28
+ const result = areItemsEqual(a, b, state);
29
+ cache.delete(a);
30
+ cache.delete(b);
31
+ return result;
17
32
  };
18
33
  }
19
- function getStrictProperties(n) {
20
- let r = t(n);
21
- return r.length ? e(n).concat(r) : e(n);
34
+ /**
35
+ * Get the properties to strictly examine, which include both own properties that are
36
+ * not enumerable and symbol properties.
37
+ */
38
+ function getStrictProperties(object) {
39
+ const symbols = getOwnPropertySymbols(object);
40
+ return symbols.length ? getOwnPropertyNames(object).concat(symbols) : getOwnPropertyNames(object);
22
41
  }
23
- var r = Object.hasOwn || ((e, t) => n.call(e, t)), i = "__v", a = "__o", o = "_owner", { getOwnPropertyDescriptor: s, keys: c } = Object, l = Object.is || function sameValueEqual(e, t) {
24
- return e === t ? e !== 0 || 1 / e == 1 / t : e !== e && t !== t;
42
+ /**
43
+ * Whether the object contains the property passed as an own property.
44
+ */
45
+ var hasOwn = Object.hasOwn || ((object, property) => hasOwnProperty.call(object, property));
46
+ /**
47
+ * Whether a null-prototype object is being compared with a plain object. Only one side can be
48
+ * null-prototype when the constructors differ. The other side must be a plain object by
49
+ * constructor, or by tag when it comes from another realm.
50
+ */
51
+ function isNullPrototypeComparable(a, b) {
52
+ const aConstructor = a.constructor;
53
+ const bConstructor = b.constructor;
54
+ if (aConstructor == null) return bConstructor === Object || toString$1.call(b) === OBJECT_TAG;
55
+ if (bConstructor == null) return aConstructor === Object || toString$1.call(a) === OBJECT_TAG;
56
+ return false;
57
+ }
58
+ var PREACT_VNODE = "__v";
59
+ var PREACT_OWNER = "__o";
60
+ var REACT_OWNER = "_owner";
61
+ var { getOwnPropertyDescriptor, keys } = Object;
62
+ /**
63
+ * Identify the element type of TypedArrays across realms and subclasses.
64
+ */
65
+ var getTypedArrayTag = getOwnPropertyDescriptor(Object.getPrototypeOf(Int8Array.prototype), Symbol.toStringTag).get;
66
+ /**
67
+ * Whether the values passed are equal based on a [SameValue](https://262.ecma-international.org/7.0/#sec-samevalue) basis.
68
+ * Simplified, this maps to if the two values are referentially equal to one another (`a === b`) or both are `NaN`.
69
+ *
70
+ * @note
71
+ * When available in the environment, this is just a re-export of the global
72
+ * [`Object.is`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is) method.
73
+ */
74
+ var sameValueEqual = Object.is || function sameValueEqual(a, b) {
75
+ return a === b ? a !== 0 || 1 / a === 1 / b : a !== a && b !== b;
25
76
  };
26
- function strictEqual(e, t) {
27
- return e === t;
77
+ /**
78
+ * Whether the values passed are equal based on a
79
+ * [Strict Equality Comparison](https://262.ecma-international.org/7.0/#sec-strict-equality-comparison) basis.
80
+ * Simplified, this maps to if the two values are referentially equal to one another (`a === b`).
81
+ *
82
+ * @note
83
+ * This is mainly available as a convenience function, such as being a default when a function to determine equality between
84
+ * two objects is used.
85
+ */
86
+ function strictEqual(a, b) {
87
+ return a === b;
28
88
  }
29
- function areArrayBuffersEqual(e, t) {
30
- return e.byteLength === t.byteLength && areTypedArraysEqual(new Uint8Array(e), new Uint8Array(t));
89
+ /**
90
+ * Whether the array buffers are equal in value.
91
+ */
92
+ function areArrayBuffersEqual(a, b) {
93
+ return a.byteLength === b.byteLength && areTypedArraysEqual(new Uint8Array(a), new Uint8Array(b));
31
94
  }
32
- function areArraysEqual(e, t, n) {
33
- let r = e.length;
34
- if (t.length !== r) return !1;
35
- for (; r-- > 0;) if (!n.equals(e[r], t[r], r, r, e, t, n)) return !1;
36
- return !0;
95
+ /**
96
+ * Whether the arrays are equal in value.
97
+ */
98
+ function areArraysEqual(a, b, state) {
99
+ let index = a.length;
100
+ if (b.length !== index) return false;
101
+ while (index-- > 0) if (!state.equals(a[index], b[index], index, index, a, b, state)) return false;
102
+ return true;
37
103
  }
38
- function areDataViewsEqual(e, t) {
39
- return e.byteLength === t.byteLength && areTypedArraysEqual(new Uint8Array(e.buffer, e.byteOffset, e.byteLength), new Uint8Array(t.buffer, t.byteOffset, t.byteLength));
104
+ /**
105
+ * Whether the dataviews are equal in value.
106
+ */
107
+ function areDataViewsEqual(a, b) {
108
+ return a.byteLength === b.byteLength && areTypedArraysEqual(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength));
40
109
  }
41
- function areDatesEqual(e, t) {
42
- return l(e.getTime(), t.getTime());
110
+ /**
111
+ * Whether the dates passed are equal in value.
112
+ */
113
+ function areDatesEqual(a, b) {
114
+ return sameValueEqual(a.getTime(), b.getTime());
43
115
  }
44
- function areErrorsEqual(e, t) {
45
- return e.name === t.name && e.message === t.message && e.cause === t.cause && e.stack === t.stack;
116
+ /**
117
+ * Whether the errors passed are equal in value.
118
+ *
119
+ * @note
120
+ * `name`, `message` and `stack` are own properties but are not enumerable, so they are compared
121
+ * explicitly. `cause` is compared by value rather than by reference, matching how every other
122
+ * nested value in the comparison is treated. Own enumerable properties (which custom `Error`
123
+ * subclasses commonly add) are compared by composing this with the object comparator in the
124
+ * comparator config, so that the strict and circular variants apply to them as well.
125
+ */
126
+ function areErrorsEqual(a, b, state) {
127
+ return a.name === b.name && a.message === b.message && a.stack === b.stack && state.equals(a.cause, b.cause, "cause", "cause", a, b, state);
46
128
  }
47
- function areMapsEqual(e, t, n) {
48
- let r = e.size;
49
- if (r !== t.size) return !1;
50
- if (!r) return !0;
51
- let i = new Uint8Array(r), a = e.entries(), o, s, c = 0;
52
- for (; (o = a.next()) && !o.done;) {
53
- let r = t.entries(), a = 0, l = 0;
54
- for (; (s = r.next()) && !s.done;) {
55
- if (i[l]) {
56
- l++;
129
+ /**
130
+ * Whether the `Map`s are equal in value.
131
+ */
132
+ function areMapsEqual(a, b, state) {
133
+ const size = a.size;
134
+ if (size !== b.size) return false;
135
+ if (!size) return true;
136
+ const matchedIndices = new Uint8Array(size);
137
+ const aIterable = a.entries();
138
+ let aResult;
139
+ let bResult;
140
+ let index = 0;
141
+ while (aResult = aIterable.next()) {
142
+ if (aResult.done) break;
143
+ const bIterable = b.entries();
144
+ let hasMatch = 0;
145
+ let matchIndex = 0;
146
+ while (bResult = bIterable.next()) {
147
+ if (bResult.done) break;
148
+ if (matchedIndices[matchIndex]) {
149
+ matchIndex++;
57
150
  continue;
58
151
  }
59
- let r = o.value, u = s.value;
60
- if (n.equals(r[0], u[0], c, l, e, t, n) && n.equals(r[1], u[1], r[0], u[0], e, t, n)) {
61
- a = i[l] = 1;
152
+ const aEntry = aResult.value;
153
+ const bEntry = bResult.value;
154
+ if (state.equals(aEntry[0], bEntry[0], index, matchIndex, a, b, state) && state.equals(aEntry[1], bEntry[1], aEntry[0], bEntry[0], a, b, state)) {
155
+ hasMatch = matchedIndices[matchIndex] = 1;
62
156
  break;
63
157
  }
64
- l++;
158
+ matchIndex++;
65
159
  }
66
- if (!a) return !1;
67
- c++;
160
+ if (!hasMatch) return false;
161
+ index++;
68
162
  }
69
- return !0;
163
+ return true;
70
164
  }
71
- function areObjectsEqual(e, t, n) {
72
- let r = c(e), i = r.length;
73
- if (c(t).length !== i) return !1;
74
- for (; i-- > 0;) if (!isPropertyEqual(e, t, n, r[i])) return !1;
75
- return !0;
165
+ /**
166
+ * Whether the objects are equal in value.
167
+ */
168
+ function areObjectsEqual(a, b, state) {
169
+ const properties = keys(a);
170
+ let index = properties.length;
171
+ if (keys(b).length !== index) return false;
172
+ while (index-- > 0) if (!isPropertyEqual(a, b, state, properties[index])) return false;
173
+ return true;
76
174
  }
77
- function areObjectsEqualStrict(e, t, n) {
78
- let r = getStrictProperties(e), i = r.length;
79
- if (getStrictProperties(t).length !== i) return !1;
80
- let a, o, c;
81
- for (; i-- > 0;) if (a = r[i], !isPropertyEqual(e, t, n, a) || (o = s(e, a), c = s(t, a), (o || c) && (!o || !c || o.configurable !== c.configurable || o.enumerable !== c.enumerable || o.writable !== c.writable))) return !1;
82
- return !0;
175
+ /**
176
+ * Whether the objects are equal in value with strict property checking.
177
+ */
178
+ function areObjectsEqualStrict(a, b, state) {
179
+ const properties = getStrictProperties(a);
180
+ let index = properties.length;
181
+ if (getStrictProperties(b).length !== index) return false;
182
+ let property;
183
+ let descriptorA;
184
+ let descriptorB;
185
+ while (index-- > 0) {
186
+ property = properties[index];
187
+ if (!isPropertyEqual(a, b, state, property)) return false;
188
+ descriptorA = getOwnPropertyDescriptor(a, property);
189
+ descriptorB = getOwnPropertyDescriptor(b, property);
190
+ if ((descriptorA || descriptorB) && (!descriptorA || !descriptorB || descriptorA.configurable !== descriptorB.configurable || descriptorA.enumerable !== descriptorB.enumerable || descriptorA.writable !== descriptorB.writable)) return false;
191
+ }
192
+ return true;
83
193
  }
84
- function arePrimitiveWrappersEqual(e, t) {
85
- return l(e.valueOf(), t.valueOf());
194
+ /**
195
+ * Whether the primitive wrappers passed are equal in value.
196
+ */
197
+ function arePrimitiveWrappersEqual(a, b) {
198
+ return sameValueEqual(a.valueOf(), b.valueOf());
86
199
  }
87
- function areRegExpsEqual(e, t) {
88
- return e.source === t.source && e.flags === t.flags;
200
+ /**
201
+ * Whether the regexps passed are equal in value.
202
+ */
203
+ function areRegExpsEqual(a, b) {
204
+ return a.source === b.source && a.flags === b.flags;
89
205
  }
90
- function areSetsEqual(e, t, n) {
91
- let r = e.size;
92
- if (r !== t.size) return !1;
93
- if (!r) return !0;
94
- let i = new Uint8Array(r), a = e.values(), o, s;
95
- for (; (o = a.next()) && !o.done;) {
96
- let r = t.values(), a = 0, c = 0;
97
- for (; (s = r.next()) && !s.done;) {
98
- if (!i[c] && n.equals(o.value, s.value, o.value, s.value, e, t, n)) {
99
- a = i[c] = 1;
206
+ /**
207
+ * Whether the `Set`s are equal in value.
208
+ */
209
+ function areSetsEqual(a, b, state) {
210
+ const size = a.size;
211
+ if (size !== b.size) return false;
212
+ if (!size) return true;
213
+ const matchedIndices = new Uint8Array(size);
214
+ const aIterable = a.values();
215
+ let aResult;
216
+ let bResult;
217
+ while (aResult = aIterable.next()) {
218
+ if (aResult.done) break;
219
+ const bIterable = b.values();
220
+ let hasMatch = 0;
221
+ let matchIndex = 0;
222
+ while (bResult = bIterable.next()) {
223
+ if (bResult.done) break;
224
+ if (!matchedIndices[matchIndex] && state.equals(aResult.value, bResult.value, aResult.value, bResult.value, a, b, state)) {
225
+ hasMatch = matchedIndices[matchIndex] = 1;
100
226
  break;
101
227
  }
102
- c++;
228
+ matchIndex++;
103
229
  }
104
- if (!a) return !1;
230
+ if (!hasMatch) return false;
231
+ }
232
+ return true;
233
+ }
234
+ /**
235
+ * Whether the TypedArray instances are equal in value.
236
+ */
237
+ function areTypedArraysEqual(a, b) {
238
+ let index = a.length;
239
+ if (b.length !== index || a.byteOffset !== b.byteOffset) return false;
240
+ const tag = getTypedArrayTag.call(a);
241
+ if (tag === "Float64Array" || tag === "Float32Array" || tag === "Float16Array") {
242
+ while (index-- > 0) if (a[index] !== b[index] && (a[index] === a[index] || b[index] === b[index])) return false;
243
+ return true;
105
244
  }
106
- return !0;
245
+ while (index-- > 0) if (a[index] !== b[index]) return false;
246
+ return true;
247
+ }
248
+ /**
249
+ * Whether the URL instances are equal in value.
250
+ */
251
+ function areUrlsEqual(a, b) {
252
+ if (a.href === b.href) return true;
253
+ return a.protocol === b.protocol && a.username === b.username && a.password === b.password && a.host === b.host && a.pathname === b.pathname && a.hash === b.hash && areSearchParamsEqual(a.searchParams, b.searchParams);
107
254
  }
108
- function areTypedArraysEqual(e, t) {
109
- let n = e.length;
110
- if (t.length !== n || e.byteOffset !== t.byteOffset) return !1;
111
- for (; n-- > 0;) if (e[n] !== t[n]) return !1;
112
- return !0;
255
+ /**
256
+ * Whether the search params passed are equal in value.
257
+ *
258
+ * @note
259
+ * Order is not significant, matching how the other unordered collections in the library are
260
+ * compared. Repeated keys are, so this is a comparison of multisets rather than of sets:
261
+ * `a=1&a=2` is equal to `a=2&a=1`, but not to `a=1&a=1`.
262
+ */
263
+ function areSearchParamsEqual(a, b) {
264
+ const serializedA = a.toString();
265
+ const serializedB = b.toString();
266
+ return serializedA === serializedB || sortSearchParams(serializedA) === sortSearchParams(serializedB);
113
267
  }
114
- function areUrlsEqual(e, t) {
115
- return e.hostname === t.hostname && e.pathname === t.pathname && e.protocol === t.protocol && e.port === t.port && e.hash === t.hash && e.username === t.username && e.password === t.password;
268
+ /**
269
+ * Reorder a serialized query string so that params holding the same pairs compare as equal
270
+ * regardless of the order they appear in.
271
+ *
272
+ * @note
273
+ * The serializer percent-encodes `&` and `=` wherever they appear inside a name or a value, so
274
+ * splitting on `&` recovers exactly the pairs and nothing else.
275
+ */
276
+ function sortSearchParams(serialized) {
277
+ return serialized.split("&").sort().join("&");
116
278
  }
117
- function isPropertyEqual(e, t, n, s) {
118
- return (s === o || s === a || s === i) && (e.$$typeof || t.$$typeof) ? !0 : r(t, s) && n.equals(e[s], t[s], s, s, e, t, n);
279
+ function isPropertyEqual(a, b, state, property) {
280
+ if ((property === REACT_OWNER || property === PREACT_OWNER || property === PREACT_VNODE) && (a.$$typeof || b.$$typeof)) return true;
281
+ return hasOwn(b, property) && state.equals(a[property], b[property], property, property, a, b, state);
119
282
  }
120
- var u = Object.prototype.toString;
121
- function createEqualityComparator(e) {
122
- let t = createSupportedComparatorMap(e), { areArraysEqual: n, areDatesEqual: r, areFunctionsEqual: i, areMapsEqual: a, areNumbersEqual: o, areObjectsEqual: s, areRegExpsEqual: c, areSetsEqual: l, getUnsupportedCustomComparator: d } = e;
123
- return function comparator(e, f, p) {
124
- if (e === f) return !0;
125
- if (e == null || f == null) return !1;
126
- let m = typeof e;
127
- if (m !== typeof f) return !1;
128
- if (m !== "object") return m === "number" || m === "bigint" ? o(e, f, p) : m === "function" && i(e, f, p);
129
- let h = e.constructor;
130
- if (h !== f.constructor) return !1;
131
- if (h === Object) return s(e, f, p);
132
- if (h === Array) return n(e, f, p);
133
- if (h === Date) return r(e, f, p);
134
- if (h === RegExp) return c(e, f, p);
135
- if (h === Map) return a(e, f, p);
136
- if (h === Set) return l(e, f, p);
137
- if (h === Promise) return !1;
138
- if (Array.isArray(e)) return n(e, f, p);
139
- let g = u.call(e), _ = t[g];
140
- if (_) return _(e, f, p);
141
- let v = d && d(e, f, p, g);
142
- return v ? v(e, f, p) : !1;
283
+ var { toString } = Object.prototype;
284
+ /**
285
+ * Create a comparator method based on the type-specific equality comparators passed.
286
+ */
287
+ function createEqualityComparator(config) {
288
+ const supportedComparatorMap = createSupportedComparatorMap(config);
289
+ const { areArraysEqual, areDatesEqual, areFunctionsEqual, areMapsEqual, areNumbersEqual, areObjectsEqual, areRegExpsEqual, areSetsEqual, getUnsupportedCustomComparator, strictNullPrototypeComparison } = config;
290
+ /**
291
+ * Whether the custom objects are equal in value, based on their string tag. If not matching any tags
292
+ * that require a specific type of comparison, then we hard-code false because the only thing remaining
293
+ * is strict equality, which has already been compared. This is for a few reasons:
294
+ * - Certain types that cannot be introspected (e.g., `WeakMap`). For these types, this is the only
295
+ * comparison that can be made.
296
+ * - For types that can be introspected but do not have an objective definition of what
297
+ * equality is (`Error`, etc.), the subjective decision is to be conservative and strictly compare.
298
+ * In all cases, these decisions should be reevaluated based on changes to the language and
299
+ * common development practices.
300
+ *
301
+ * Capturing the tag is reasonably performant in modern environments like v8 and SpiderMonkey. This is
302
+ * kept out of the main comparator so that it stays within the engine's bytecode budget for inlining.
303
+ * See [#207](https://github.com/planttheidea/fast-equals/pull/207) for more details.
304
+ */
305
+ const areTaggedObjectsEqual = getUnsupportedCustomComparator ? function areTaggedObjectsEqual(a, b, state) {
306
+ const tag = toString.call(a);
307
+ const supportedComparator = supportedComparatorMap[tag];
308
+ if (supportedComparator) return supportedComparator(a, b, state);
309
+ const unsupportedCustomComparator = getUnsupportedCustomComparator(a, b, state, tag);
310
+ return unsupportedCustomComparator ? unsupportedCustomComparator(a, b, state) : false;
311
+ } : function areTaggedObjectsEqual(a, b, state) {
312
+ const supportedComparator = supportedComparatorMap[toString.call(a)];
313
+ return supportedComparator ? supportedComparator(a, b, state) : false;
314
+ };
315
+ /**
316
+ * compare the value of the two objects and return true if they are equivalent in values
317
+ */
318
+ return function comparator(a, b, state) {
319
+ if (a === b) return true;
320
+ if (a == null || b == null) return false;
321
+ const type = typeof a;
322
+ if (type !== typeof b) return false;
323
+ if (type !== "object") {
324
+ if (type === "number" || type === "bigint") return areNumbersEqual(a, b, state);
325
+ if (type === "function") return areFunctionsEqual(a, b, state);
326
+ return false;
327
+ }
328
+ const constructor = a.constructor;
329
+ if (constructor !== b.constructor) return strictNullPrototypeComparison ? false : isNullPrototypeComparable(a, b) && areObjectsEqual(a, b, state);
330
+ if (constructor === Object) return areObjectsEqual(a, b, state);
331
+ if (constructor === Array) return areArraysEqual(a, b, state);
332
+ if (constructor === Date) return areDatesEqual(a, b, state);
333
+ if (constructor === RegExp) return areRegExpsEqual(a, b, state);
334
+ if (constructor === Map) return areMapsEqual(a, b, state);
335
+ if (constructor === Set) return areSetsEqual(a, b, state);
336
+ if (constructor == null) return areObjectsEqual(a, b, state);
337
+ if (constructor === Promise) return false;
338
+ if (Array.isArray(a)) return areArraysEqual(a, b, state);
339
+ return areTaggedObjectsEqual(a, b, state);
143
340
  };
144
341
  }
145
- function createEqualityComparatorConfig({ circular: e, createCustomConfig: t, strict: n }) {
146
- let r = {
342
+ /**
343
+ * Create the configuration object used for building comparators.
344
+ */
345
+ function createEqualityComparatorConfig({ circular, createCustomConfig, strict, strictNullPrototypeComparison = true }) {
346
+ let config = {
147
347
  areArrayBuffersEqual,
148
- areArraysEqual: n ? areObjectsEqualStrict : areArraysEqual,
348
+ areArraysEqual: strict ? areObjectsEqualStrict : areArraysEqual,
149
349
  areDataViewsEqual,
150
350
  areDatesEqual,
151
- areErrorsEqual,
351
+ areErrorsEqual: strict ? combineComparators(areErrorsEqual, areObjectsEqualStrict) : combineComparators(areErrorsEqual, areObjectsEqual),
152
352
  areFunctionsEqual: strictEqual,
153
- areMapsEqual: n ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
154
- areNumbersEqual: l,
155
- areObjectsEqual: n ? areObjectsEqualStrict : areObjectsEqual,
353
+ areMapsEqual: strict ? combineComparators(areMapsEqual, areObjectsEqualStrict) : areMapsEqual,
354
+ areNumbersEqual: sameValueEqual,
355
+ areObjectsEqual: strict ? areObjectsEqualStrict : areObjectsEqual,
156
356
  arePrimitiveWrappersEqual,
157
357
  areRegExpsEqual,
158
- areSetsEqual: n ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
159
- areTypedArraysEqual: n ? combineComparators(areTypedArraysEqual, areObjectsEqualStrict) : areTypedArraysEqual,
358
+ areSetsEqual: strict ? combineComparators(areSetsEqual, areObjectsEqualStrict) : areSetsEqual,
359
+ areTypedArraysEqual: strict ? combineComparators(areTypedArraysEqual, areObjectsEqualStrict) : areTypedArraysEqual,
160
360
  areUrlsEqual,
161
- getUnsupportedCustomComparator: void 0
361
+ getUnsupportedCustomComparator: void 0,
362
+ strictNullPrototypeComparison
162
363
  };
163
- if (t && (r = Object.assign({}, r, t(r))), e) {
164
- let e = createIsCircular(r.areArraysEqual), t = createIsCircular(r.areMapsEqual), n = createIsCircular(r.areObjectsEqual), i = createIsCircular(r.areSetsEqual);
165
- r = Object.assign({}, r, {
166
- areArraysEqual: e,
167
- areMapsEqual: t,
168
- areObjectsEqual: n,
169
- areSetsEqual: i
364
+ if (createCustomConfig) config = Object.assign({}, config, createCustomConfig(config));
365
+ if (circular) {
366
+ const areArraysEqual = createIsCircular(config.areArraysEqual);
367
+ const areErrorsEqual = createIsCircular(config.areErrorsEqual);
368
+ const areMapsEqual = createIsCircular(config.areMapsEqual);
369
+ const areObjectsEqual = createIsCircular(config.areObjectsEqual);
370
+ const areSetsEqual = createIsCircular(config.areSetsEqual);
371
+ config = Object.assign({}, config, {
372
+ areArraysEqual,
373
+ areErrorsEqual,
374
+ areMapsEqual,
375
+ areObjectsEqual,
376
+ areSetsEqual
170
377
  });
171
378
  }
172
- return r;
379
+ return config;
173
380
  }
174
- function createInternalEqualityComparator(e) {
175
- return function(t, n, r, i, a, o, s) {
176
- return e(t, n, s);
381
+ /**
382
+ * Default equality comparator pass-through, used as the standard `isEqual` creator for
383
+ * use inside the built comparator.
384
+ */
385
+ function createInternalEqualityComparator(compare) {
386
+ return function(a, b, _indexOrKeyA, _indexOrKeyB, _parentA, _parentB, state) {
387
+ return compare(a, b, state);
177
388
  };
178
389
  }
179
- function createIsEqual({ circular: e, comparator: t, createState: n, equals: r, strict: i }) {
180
- if (n) return function isEqual(a, o) {
181
- let { cache: s = e ? /* @__PURE__ */ new WeakMap() : void 0, meta: c } = n();
182
- return t(a, o, {
183
- cache: s,
184
- equals: r,
185
- meta: c,
186
- strict: i
390
+ /**
391
+ * Create the `isEqual` function used by the consuming application.
392
+ */
393
+ function createIsEqual({ circular, comparator, createState, equals, strict }) {
394
+ if (createState) return function isEqual(a, b) {
395
+ const { cache = circular ? /* @__PURE__ */ new WeakMap() : void 0, meta } = createState();
396
+ return comparator(a, b, {
397
+ cache,
398
+ equals,
399
+ meta,
400
+ strict
187
401
  });
188
402
  };
189
- if (e) return function isEqual(e, n) {
190
- return t(e, n, {
403
+ if (circular) return function isEqual(a, b) {
404
+ return comparator(a, b, {
191
405
  cache: /* @__PURE__ */ new WeakMap(),
192
- equals: r,
406
+ equals,
193
407
  meta: void 0,
194
- strict: i
408
+ strict
195
409
  });
196
410
  };
197
- let a = {
411
+ const state = {
198
412
  cache: void 0,
199
- equals: r,
413
+ equals,
200
414
  meta: void 0,
201
- strict: i
415
+ strict
202
416
  };
203
- return function isEqual(e, n) {
204
- return t(e, n, a);
417
+ return function isEqual(a, b) {
418
+ return comparator(a, b, state);
205
419
  };
206
420
  }
207
- function createSupportedComparatorMap({ areArrayBuffersEqual: e, areArraysEqual: t, areDataViewsEqual: n, areDatesEqual: r, areErrorsEqual: i, areFunctionsEqual: a, areMapsEqual: o, areNumbersEqual: s, areObjectsEqual: c, arePrimitiveWrappersEqual: l, areRegExpsEqual: u, areSetsEqual: d, areTypedArraysEqual: f, areUrlsEqual: p }) {
421
+ /**
422
+ * Create a map of `toString()` values to their respective handlers for `tag`-based lookups.
423
+ */
424
+ function createSupportedComparatorMap({ areArrayBuffersEqual, areArraysEqual, areDataViewsEqual, areDatesEqual, areErrorsEqual, areFunctionsEqual, areMapsEqual, areObjectsEqual, arePrimitiveWrappersEqual, areRegExpsEqual, areSetsEqual, areTypedArraysEqual, areUrlsEqual }) {
208
425
  return {
209
- "[object Arguments]": c,
210
- "[object Array]": t,
211
- "[object ArrayBuffer]": e,
212
- "[object AsyncGeneratorFunction]": a,
213
- "[object BigInt]": s,
214
- "[object BigInt64Array]": f,
215
- "[object BigUint64Array]": f,
216
- "[object Boolean]": l,
217
- "[object DataView]": n,
218
- "[object Date]": r,
219
- "[object Error]": i,
220
- "[object Float16Array]": f,
221
- "[object Float32Array]": f,
222
- "[object Float64Array]": f,
223
- "[object Function]": a,
224
- "[object GeneratorFunction]": a,
225
- "[object Int8Array]": f,
226
- "[object Int16Array]": f,
227
- "[object Int32Array]": f,
228
- "[object Map]": o,
229
- "[object Number]": l,
230
- "[object Object]": (e, t, n) => typeof e.then != "function" && typeof t.then != "function" && c(e, t, n),
231
- "[object RegExp]": u,
232
- "[object Set]": d,
233
- "[object String]": l,
234
- "[object URL]": p,
235
- "[object Uint8Array]": f,
236
- "[object Uint8ClampedArray]": f,
237
- "[object Uint16Array]": f,
238
- "[object Uint32Array]": f
426
+ "[object Arguments]": areObjectsEqual,
427
+ "[object Array]": areArraysEqual,
428
+ "[object ArrayBuffer]": areArrayBuffersEqual,
429
+ "[object AsyncGeneratorFunction]": areFunctionsEqual,
430
+ "[object BigInt]": arePrimitiveWrappersEqual,
431
+ "[object BigInt64Array]": areTypedArraysEqual,
432
+ "[object BigUint64Array]": areTypedArraysEqual,
433
+ "[object Boolean]": arePrimitiveWrappersEqual,
434
+ "[object DataView]": areDataViewsEqual,
435
+ "[object Date]": areDatesEqual,
436
+ "[object Error]": areErrorsEqual,
437
+ "[object Float16Array]": areTypedArraysEqual,
438
+ "[object Float32Array]": areTypedArraysEqual,
439
+ "[object Float64Array]": areTypedArraysEqual,
440
+ "[object Function]": areFunctionsEqual,
441
+ "[object GeneratorFunction]": areFunctionsEqual,
442
+ "[object Int8Array]": areTypedArraysEqual,
443
+ "[object Int16Array]": areTypedArraysEqual,
444
+ "[object Int32Array]": areTypedArraysEqual,
445
+ "[object Map]": areMapsEqual,
446
+ "[object Number]": arePrimitiveWrappersEqual,
447
+ "[object Object]": (a, b, state) => typeof a.then !== "function" && typeof b.then !== "function" && areObjectsEqual(a, b, state),
448
+ "[object RegExp]": areRegExpsEqual,
449
+ "[object Set]": areSetsEqual,
450
+ "[object String]": arePrimitiveWrappersEqual,
451
+ "[object URL]": areUrlsEqual,
452
+ "[object Uint8Array]": areTypedArraysEqual,
453
+ "[object Uint8ClampedArray]": areTypedArraysEqual,
454
+ "[object Uint16Array]": areTypedArraysEqual,
455
+ "[object Uint32Array]": areTypedArraysEqual
239
456
  };
240
457
  }
241
- var d = createCustomEqual();
242
- createCustomEqual({ strict: !0 }), createCustomEqual({ circular: !0 }), createCustomEqual({
243
- circular: !0,
244
- strict: !0
458
+ /**
459
+ * Whether the items passed are deeply-equal in value.
460
+ */
461
+ var deepEqual = createCustomEqual();
462
+ createCustomEqual({ strict: true });
463
+ createCustomEqual({ circular: true });
464
+ createCustomEqual({
465
+ circular: true,
466
+ strict: true
467
+ });
468
+ /**
469
+ * Whether the items passed are shallowly-equal in value.
470
+ */
471
+ var shallowEqual = createCustomEqual({ createInternalComparator: () => sameValueEqual });
472
+ createCustomEqual({
473
+ strict: true,
474
+ createInternalComparator: () => sameValueEqual
475
+ });
476
+ createCustomEqual({
477
+ circular: true,
478
+ createInternalComparator: () => sameValueEqual
245
479
  });
246
- var f = createCustomEqual({ createInternalComparator: () => l });
247
480
  createCustomEqual({
248
- strict: !0,
249
- createInternalComparator: () => l
250
- }), createCustomEqual({
251
- circular: !0,
252
- createInternalComparator: () => l
253
- }), createCustomEqual({
254
- circular: !0,
255
- createInternalComparator: () => l,
256
- strict: !0
481
+ circular: true,
482
+ createInternalComparator: () => sameValueEqual,
483
+ strict: true
257
484
  });
258
- function createCustomEqual(e = {}) {
259
- let { circular: t = !1, createInternalComparator: n, createState: r, strict: i = !1 } = e, a = createEqualityComparator(createEqualityComparatorConfig(e));
485
+ /**
486
+ * Create a custom equality comparison method.
487
+ *
488
+ * This can be done to create very targeted comparisons in extreme hot-path scenarios
489
+ * where the standard methods are not performant enough, but can also be used to provide
490
+ * support for legacy environments that do not support expected features like
491
+ * `RegExp.prototype.flags` out of the box.
492
+ */
493
+ function createCustomEqual(options = {}) {
494
+ const { circular = false, createInternalComparator: createCustomInternalComparator, createState, strict = false } = options;
495
+ const comparator = createEqualityComparator(createEqualityComparatorConfig(options));
260
496
  return createIsEqual({
261
- circular: t,
262
- comparator: a,
263
- createState: r,
264
- equals: n ? n(a) : createInternalEqualityComparator(a),
265
- strict: i
497
+ circular,
498
+ comparator,
499
+ createState,
500
+ equals: createCustomInternalComparator ? createCustomInternalComparator(comparator) : createInternalEqualityComparator(comparator),
501
+ strict
266
502
  });
267
503
  }
268
504
  //#endregion
269
- export { f as n, d as t };
505
+ export { shallowEqual as n, deepEqual as t };