@noma.to/qwik-mock 1.0.2 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/lib/lib/qwik-mock.cjs +24 -6
  2. package/lib/lib/qwik-mock.mjs +24 -6
  3. package/lib-types/index.d.ts +2 -1
  4. package/lib-types/lib/qwik-mock.d.ts +21 -19
  5. package/package.json +7 -6
  6. package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.cjs +0 -83
  7. package/lib/node_modules/.pnpm/@jridgewell_sourcemap-codec@1.5.5/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +0 -83
  8. package/lib/node_modules/.pnpm/@vitest_expect@4.0.18/node_modules/@vitest/expect/dist/index.cjs +0 -1785
  9. package/lib/node_modules/.pnpm/@vitest_expect@4.0.18/node_modules/@vitest/expect/dist/index.mjs +0 -1785
  10. package/lib/node_modules/.pnpm/@vitest_pretty-format@4.0.18/node_modules/@vitest/pretty-format/dist/index.cjs +0 -964
  11. package/lib/node_modules/.pnpm/@vitest_pretty-format@4.0.18/node_modules/@vitest/pretty-format/dist/index.mjs +0 -964
  12. package/lib/node_modules/.pnpm/@vitest_runner@4.0.18/node_modules/@vitest/runner/dist/chunk-tasks.cjs +0 -60
  13. package/lib/node_modules/.pnpm/@vitest_runner@4.0.18/node_modules/@vitest/runner/dist/chunk-tasks.mjs +0 -60
  14. package/lib/node_modules/.pnpm/@vitest_runner@4.0.18/node_modules/@vitest/runner/dist/index.cjs +0 -1102
  15. package/lib/node_modules/.pnpm/@vitest_runner@4.0.18/node_modules/@vitest/runner/dist/index.mjs +0 -1102
  16. package/lib/node_modules/.pnpm/@vitest_snapshot@4.0.18/node_modules/@vitest/snapshot/dist/index.cjs +0 -1289
  17. package/lib/node_modules/.pnpm/@vitest_snapshot@4.0.18/node_modules/@vitest/snapshot/dist/index.mjs +0 -1289
  18. package/lib/node_modules/.pnpm/@vitest_spy@4.0.18/node_modules/@vitest/spy/dist/index.cjs +0 -422
  19. package/lib/node_modules/.pnpm/@vitest_spy@4.0.18/node_modules/@vitest/spy/dist/index.mjs +0 -422
  20. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.cjs +0 -6
  21. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/chunk-_commonjsHelpers.mjs +0 -6
  22. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.cjs +0 -98
  23. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/chunk-pathe.M-eThtNZ.mjs +0 -98
  24. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/diff.cjs +0 -1626
  25. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/diff.mjs +0 -1626
  26. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/display.cjs +0 -690
  27. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/display.mjs +0 -690
  28. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/error.cjs +0 -39
  29. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/error.mjs +0 -39
  30. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/helpers.cjs +0 -151
  31. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/helpers.mjs +0 -151
  32. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/serialize.cjs +0 -114
  33. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/serialize.mjs +0 -114
  34. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/source-map.cjs +0 -125
  35. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/source-map.mjs +0 -125
  36. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/timers.cjs +0 -22
  37. package/lib/node_modules/.pnpm/@vitest_utils@4.0.18/node_modules/@vitest/utils/dist/timers.mjs +0 -22
  38. package/lib/node_modules/.pnpm/chai@6.2.2/node_modules/chai/index.cjs +0 -4056
  39. package/lib/node_modules/.pnpm/chai@6.2.2/node_modules/chai/index.mjs +0 -4056
  40. package/lib/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.cjs +0 -994
  41. package/lib/node_modules/.pnpm/magic-string@0.30.21/node_modules/magic-string/dist/magic-string.es.mjs +0 -994
  42. package/lib/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.cjs +0 -101
  43. package/lib/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +0 -101
  44. package/lib/node_modules/.pnpm/tinyrainbow@3.0.3/node_modules/tinyrainbow/dist/index.cjs +0 -84
  45. package/lib/node_modules/.pnpm/tinyrainbow@3.0.3/node_modules/tinyrainbow/dist/index.mjs +0 -84
  46. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.cjs +0 -4
  47. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/_commonjsHelpers.D26ty3Ew.mjs +0 -4
  48. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.cjs +0 -51
  49. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/date.Bq6ZW5rf.mjs +0 -51
  50. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/utils.DvEY5TfP.cjs +0 -45
  51. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/utils.DvEY5TfP.mjs +0 -45
  52. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/vi.2VT5v0um.cjs +0 -2609
  53. package/lib/node_modules/.pnpm/vitest@4.0.18_@types_node@25.1.0_@vitest_ui@4.0.18_happy-dom@20.0.11_jiti@2.4.2_jsdom@26.1.0__pd2l5poczrcnqygjcqiguyknnm/node_modules/vitest/dist/chunks/vi.2VT5v0um.mjs +0 -2609
@@ -1,964 +0,0 @@
1
- import C from "../../../../../tinyrainbow@3.0.3/node_modules/tinyrainbow/dist/index.mjs";
2
- function _mergeNamespaces$1(n, m) {
3
- m.forEach(function(e) {
4
- e && typeof e !== "string" && !Array.isArray(e) && Object.keys(e).forEach(function(k) {
5
- if (k !== "default" && !(k in n)) {
6
- var d = Object.getOwnPropertyDescriptor(e, k);
7
- Object.defineProperty(n, k, d.get ? d : {
8
- enumerable: true,
9
- get: function() {
10
- return e[k];
11
- }
12
- });
13
- }
14
- });
15
- });
16
- return Object.freeze(n);
17
- }
18
- function getKeysOfEnumerableProperties(object, compareKeys) {
19
- const rawKeys = Object.keys(object);
20
- const keys = compareKeys === null ? rawKeys : rawKeys.sort(compareKeys);
21
- if (Object.getOwnPropertySymbols) {
22
- for (const symbol of Object.getOwnPropertySymbols(object)) {
23
- if (Object.getOwnPropertyDescriptor(object, symbol).enumerable) {
24
- keys.push(symbol);
25
- }
26
- }
27
- }
28
- return keys;
29
- }
30
- function printIteratorEntries(iterator, config, indentation, depth, refs, printer2, separator = ": ") {
31
- let result = "";
32
- let width = 0;
33
- let current = iterator.next();
34
- if (!current.done) {
35
- result += config.spacingOuter;
36
- const indentationNext = indentation + config.indent;
37
- while (!current.done) {
38
- result += indentationNext;
39
- if (width++ === config.maxWidth) {
40
- result += "…";
41
- break;
42
- }
43
- const name = printer2(current.value[0], config, indentationNext, depth, refs);
44
- const value = printer2(current.value[1], config, indentationNext, depth, refs);
45
- result += name + separator + value;
46
- current = iterator.next();
47
- if (!current.done) {
48
- result += `,${config.spacingInner}`;
49
- } else if (!config.min) {
50
- result += ",";
51
- }
52
- }
53
- result += config.spacingOuter + indentation;
54
- }
55
- return result;
56
- }
57
- function printIteratorValues(iterator, config, indentation, depth, refs, printer2) {
58
- let result = "";
59
- let width = 0;
60
- let current = iterator.next();
61
- if (!current.done) {
62
- result += config.spacingOuter;
63
- const indentationNext = indentation + config.indent;
64
- while (!current.done) {
65
- result += indentationNext;
66
- if (width++ === config.maxWidth) {
67
- result += "…";
68
- break;
69
- }
70
- result += printer2(current.value, config, indentationNext, depth, refs);
71
- current = iterator.next();
72
- if (!current.done) {
73
- result += `,${config.spacingInner}`;
74
- } else if (!config.min) {
75
- result += ",";
76
- }
77
- }
78
- result += config.spacingOuter + indentation;
79
- }
80
- return result;
81
- }
82
- function printListItems(list, config, indentation, depth, refs, printer2) {
83
- let result = "";
84
- list = list instanceof ArrayBuffer ? new DataView(list) : list;
85
- const isDataView = (l) => l instanceof DataView;
86
- const length = isDataView(list) ? list.byteLength : list.length;
87
- if (length > 0) {
88
- result += config.spacingOuter;
89
- const indentationNext = indentation + config.indent;
90
- for (let i = 0; i < length; i++) {
91
- result += indentationNext;
92
- if (i === config.maxWidth) {
93
- result += "…";
94
- break;
95
- }
96
- if (isDataView(list) || i in list) {
97
- result += printer2(isDataView(list) ? list.getInt8(i) : list[i], config, indentationNext, depth, refs);
98
- }
99
- if (i < length - 1) {
100
- result += `,${config.spacingInner}`;
101
- } else if (!config.min) {
102
- result += ",";
103
- }
104
- }
105
- result += config.spacingOuter + indentation;
106
- }
107
- return result;
108
- }
109
- function printObjectProperties(val, config, indentation, depth, refs, printer2) {
110
- let result = "";
111
- const keys = getKeysOfEnumerableProperties(val, config.compareKeys);
112
- if (keys.length > 0) {
113
- result += config.spacingOuter;
114
- const indentationNext = indentation + config.indent;
115
- for (let i = 0; i < keys.length; i++) {
116
- const key = keys[i];
117
- const name = printer2(key, config, indentationNext, depth, refs);
118
- const value = printer2(val[key], config, indentationNext, depth, refs);
119
- result += `${indentationNext + name}: ${value}`;
120
- if (i < keys.length - 1) {
121
- result += `,${config.spacingInner}`;
122
- } else if (!config.min) {
123
- result += ",";
124
- }
125
- }
126
- result += config.spacingOuter + indentation;
127
- }
128
- return result;
129
- }
130
- const asymmetricMatcher = typeof Symbol === "function" && Symbol.for ? /* @__PURE__ */ Symbol.for("jest.asymmetricMatcher") : 1267621;
131
- const SPACE$2 = " ";
132
- const serialize$5 = (val, config, indentation, depth, refs, printer2) => {
133
- const stringedValue = val.toString();
134
- if (stringedValue === "ArrayContaining" || stringedValue === "ArrayNotContaining") {
135
- if (++depth > config.maxDepth) {
136
- return `[${stringedValue}]`;
137
- }
138
- return `${stringedValue + SPACE$2}[${printListItems(val.sample, config, indentation, depth, refs, printer2)}]`;
139
- }
140
- if (stringedValue === "ObjectContaining" || stringedValue === "ObjectNotContaining") {
141
- if (++depth > config.maxDepth) {
142
- return `[${stringedValue}]`;
143
- }
144
- return `${stringedValue + SPACE$2}{${printObjectProperties(val.sample, config, indentation, depth, refs, printer2)}}`;
145
- }
146
- if (stringedValue === "StringMatching" || stringedValue === "StringNotMatching") {
147
- return stringedValue + SPACE$2 + printer2(val.sample, config, indentation, depth, refs);
148
- }
149
- if (stringedValue === "StringContaining" || stringedValue === "StringNotContaining") {
150
- return stringedValue + SPACE$2 + printer2(val.sample, config, indentation, depth, refs);
151
- }
152
- if (typeof val.toAsymmetricMatcher !== "function") {
153
- throw new TypeError(`Asymmetric matcher ${val.constructor.name} does not implement toAsymmetricMatcher()`);
154
- }
155
- return val.toAsymmetricMatcher();
156
- };
157
- const test$5 = (val) => val && val.$$typeof === asymmetricMatcher;
158
- const plugin$5 = {
159
- serialize: serialize$5,
160
- test: test$5
161
- };
162
- const SPACE$1 = " ";
163
- const OBJECT_NAMES = /* @__PURE__ */ new Set(["DOMStringMap", "NamedNodeMap"]);
164
- const ARRAY_REGEXP = /^(?:HTML\w*Collection|NodeList)$/;
165
- function testName(name) {
166
- return OBJECT_NAMES.has(name) || ARRAY_REGEXP.test(name);
167
- }
168
- const test$4 = (val) => val && val.constructor && !!val.constructor.name && testName(val.constructor.name);
169
- function isNamedNodeMap(collection) {
170
- return collection.constructor.name === "NamedNodeMap";
171
- }
172
- const serialize$4 = (collection, config, indentation, depth, refs, printer2) => {
173
- const name = collection.constructor.name;
174
- if (++depth > config.maxDepth) {
175
- return `[${name}]`;
176
- }
177
- return (config.min ? "" : name + SPACE$1) + (OBJECT_NAMES.has(name) ? `{${printObjectProperties(isNamedNodeMap(collection) ? [...collection].reduce((props, attribute) => {
178
- props[attribute.name] = attribute.value;
179
- return props;
180
- }, {}) : { ...collection }, config, indentation, depth, refs, printer2)}}` : `[${printListItems([...collection], config, indentation, depth, refs, printer2)}]`);
181
- };
182
- const plugin$4 = {
183
- serialize: serialize$4,
184
- test: test$4
185
- };
186
- function escapeHTML(str) {
187
- return str.replaceAll("<", "&lt;").replaceAll(">", "&gt;");
188
- }
189
- function printProps(keys, props, config, indentation, depth, refs, printer2) {
190
- const indentationNext = indentation + config.indent;
191
- const colors = config.colors;
192
- return keys.map((key) => {
193
- const value = props[key];
194
- if (typeof value === "string" && value[0] === "_" && value.startsWith("__vitest_") && value.match(/__vitest_\d+__/)) {
195
- return "";
196
- }
197
- let printed = printer2(value, config, indentationNext, depth, refs);
198
- if (typeof value !== "string") {
199
- if (printed.includes("\n")) {
200
- printed = config.spacingOuter + indentationNext + printed + config.spacingOuter + indentation;
201
- }
202
- printed = `{${printed}}`;
203
- }
204
- return `${config.spacingInner + indentation + colors.prop.open + key + colors.prop.close}=${colors.value.open}${printed}${colors.value.close}`;
205
- }).join("");
206
- }
207
- function printChildren(children, config, indentation, depth, refs, printer2) {
208
- return children.map((child) => config.spacingOuter + indentation + (typeof child === "string" ? printText(child, config) : printer2(child, config, indentation, depth, refs))).join("");
209
- }
210
- function printShadowRoot(children, config, indentation, depth, refs, printer2) {
211
- if (config.printShadowRoot === false) {
212
- return "";
213
- }
214
- return [`${config.spacingOuter + indentation}#shadow-root`, printChildren(children, config, indentation + config.indent, depth, refs, printer2)].join("");
215
- }
216
- function printText(text, config) {
217
- const contentColor = config.colors.content;
218
- return contentColor.open + escapeHTML(text) + contentColor.close;
219
- }
220
- function printComment(comment, config) {
221
- const commentColor = config.colors.comment;
222
- return `${commentColor.open}<!--${escapeHTML(comment)}-->${commentColor.close}`;
223
- }
224
- function printElement(type, printedProps, printedChildren, config, indentation) {
225
- const tagColor = config.colors.tag;
226
- return `${tagColor.open}<${type}${printedProps && tagColor.close + printedProps + config.spacingOuter + indentation + tagColor.open}${printedChildren ? `>${tagColor.close}${printedChildren}${config.spacingOuter}${indentation}${tagColor.open}</${type}` : `${printedProps && !config.min ? "" : " "}/`}>${tagColor.close}`;
227
- }
228
- function printElementAsLeaf(type, config) {
229
- const tagColor = config.colors.tag;
230
- return `${tagColor.open}<${type}${tagColor.close} …${tagColor.open} />${tagColor.close}`;
231
- }
232
- const ELEMENT_NODE = 1;
233
- const TEXT_NODE = 3;
234
- const COMMENT_NODE = 8;
235
- const FRAGMENT_NODE = 11;
236
- const ELEMENT_REGEXP = /^(?:(?:HTML|SVG)\w*)?Element$/;
237
- function testHasAttribute(val) {
238
- try {
239
- return typeof val.hasAttribute === "function" && val.hasAttribute("is");
240
- } catch {
241
- return false;
242
- }
243
- }
244
- function testNode(val) {
245
- const constructorName = val.constructor.name;
246
- const { nodeType, tagName } = val;
247
- const isCustomElement = typeof tagName === "string" && tagName.includes("-") || testHasAttribute(val);
248
- return nodeType === ELEMENT_NODE && (ELEMENT_REGEXP.test(constructorName) || isCustomElement) || nodeType === TEXT_NODE && constructorName === "Text" || nodeType === COMMENT_NODE && constructorName === "Comment" || nodeType === FRAGMENT_NODE && constructorName === "DocumentFragment";
249
- }
250
- const test$3 = (val) => val?.constructor?.name && testNode(val);
251
- function nodeIsText(node) {
252
- return node.nodeType === TEXT_NODE;
253
- }
254
- function nodeIsComment(node) {
255
- return node.nodeType === COMMENT_NODE;
256
- }
257
- function nodeIsFragment(node) {
258
- return node.nodeType === FRAGMENT_NODE;
259
- }
260
- const serialize$3 = (node, config, indentation, depth, refs, printer2) => {
261
- if (nodeIsText(node)) {
262
- return printText(node.data, config);
263
- }
264
- if (nodeIsComment(node)) {
265
- return printComment(node.data, config);
266
- }
267
- const type = nodeIsFragment(node) ? "DocumentFragment" : node.tagName.toLowerCase();
268
- if (++depth > config.maxDepth) {
269
- return printElementAsLeaf(type, config);
270
- }
271
- return printElement(type, printProps(nodeIsFragment(node) ? [] : Array.from(node.attributes, (attr) => attr.name).sort(), nodeIsFragment(node) ? {} : [...node.attributes].reduce((props, attribute) => {
272
- props[attribute.name] = attribute.value;
273
- return props;
274
- }, {}), config, indentation + config.indent, depth, refs, printer2), (nodeIsFragment(node) || !node.shadowRoot ? "" : printShadowRoot(Array.prototype.slice.call(node.shadowRoot.children), config, indentation + config.indent, depth, refs, printer2)) + printChildren(Array.prototype.slice.call(node.childNodes || node.children), config, indentation + config.indent, depth, refs, printer2), config, indentation);
275
- };
276
- const plugin$3 = {
277
- serialize: serialize$3,
278
- test: test$3
279
- };
280
- const IS_ITERABLE_SENTINEL = "@@__IMMUTABLE_ITERABLE__@@";
281
- const IS_LIST_SENTINEL = "@@__IMMUTABLE_LIST__@@";
282
- const IS_KEYED_SENTINEL = "@@__IMMUTABLE_KEYED__@@";
283
- const IS_MAP_SENTINEL = "@@__IMMUTABLE_MAP__@@";
284
- const IS_ORDERED_SENTINEL = "@@__IMMUTABLE_ORDERED__@@";
285
- const IS_RECORD_SENTINEL = "@@__IMMUTABLE_RECORD__@@";
286
- const IS_SEQ_SENTINEL = "@@__IMMUTABLE_SEQ__@@";
287
- const IS_SET_SENTINEL = "@@__IMMUTABLE_SET__@@";
288
- const IS_STACK_SENTINEL = "@@__IMMUTABLE_STACK__@@";
289
- const getImmutableName = (name) => `Immutable.${name}`;
290
- const printAsLeaf = (name) => `[${name}]`;
291
- const SPACE = " ";
292
- const LAZY = "…";
293
- function printImmutableEntries(val, config, indentation, depth, refs, printer2, type) {
294
- return ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : `${getImmutableName(type) + SPACE}{${printIteratorEntries(val.entries(), config, indentation, depth, refs, printer2)}}`;
295
- }
296
- function getRecordEntries(val) {
297
- let i = 0;
298
- return { next() {
299
- if (i < val._keys.length) {
300
- const key = val._keys[i++];
301
- return {
302
- done: false,
303
- value: [key, val.get(key)]
304
- };
305
- }
306
- return {
307
- done: true,
308
- value: void 0
309
- };
310
- } };
311
- }
312
- function printImmutableRecord(val, config, indentation, depth, refs, printer2) {
313
- const name = getImmutableName(val._name || "Record");
314
- return ++depth > config.maxDepth ? printAsLeaf(name) : `${name + SPACE}{${printIteratorEntries(getRecordEntries(val), config, indentation, depth, refs, printer2)}}`;
315
- }
316
- function printImmutableSeq(val, config, indentation, depth, refs, printer2) {
317
- const name = getImmutableName("Seq");
318
- if (++depth > config.maxDepth) {
319
- return printAsLeaf(name);
320
- }
321
- if (val[IS_KEYED_SENTINEL]) {
322
- return `${name + SPACE}{${val._iter || val._object ? printIteratorEntries(val.entries(), config, indentation, depth, refs, printer2) : LAZY}}`;
323
- }
324
- return `${name + SPACE}[${val._iter || val._array || val._collection || val._iterable ? printIteratorValues(val.values(), config, indentation, depth, refs, printer2) : LAZY}]`;
325
- }
326
- function printImmutableValues(val, config, indentation, depth, refs, printer2, type) {
327
- return ++depth > config.maxDepth ? printAsLeaf(getImmutableName(type)) : `${getImmutableName(type) + SPACE}[${printIteratorValues(val.values(), config, indentation, depth, refs, printer2)}]`;
328
- }
329
- const serialize$2 = (val, config, indentation, depth, refs, printer2) => {
330
- if (val[IS_MAP_SENTINEL]) {
331
- return printImmutableEntries(val, config, indentation, depth, refs, printer2, val[IS_ORDERED_SENTINEL] ? "OrderedMap" : "Map");
332
- }
333
- if (val[IS_LIST_SENTINEL]) {
334
- return printImmutableValues(val, config, indentation, depth, refs, printer2, "List");
335
- }
336
- if (val[IS_SET_SENTINEL]) {
337
- return printImmutableValues(val, config, indentation, depth, refs, printer2, val[IS_ORDERED_SENTINEL] ? "OrderedSet" : "Set");
338
- }
339
- if (val[IS_STACK_SENTINEL]) {
340
- return printImmutableValues(val, config, indentation, depth, refs, printer2, "Stack");
341
- }
342
- if (val[IS_SEQ_SENTINEL]) {
343
- return printImmutableSeq(val, config, indentation, depth, refs, printer2);
344
- }
345
- return printImmutableRecord(val, config, indentation, depth, refs, printer2);
346
- };
347
- const test$2 = (val) => val && (val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true);
348
- const plugin$2 = {
349
- serialize: serialize$2,
350
- test: test$2
351
- };
352
- function getDefaultExportFromCjs(x) {
353
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
354
- }
355
- var reactIs$1 = { exports: {} };
356
- var reactIs_production = {};
357
- var hasRequiredReactIs_production;
358
- function requireReactIs_production() {
359
- if (hasRequiredReactIs_production) return reactIs_production;
360
- hasRequiredReactIs_production = 1;
361
- var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = /* @__PURE__ */ Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = /* @__PURE__ */ Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = /* @__PURE__ */ Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = /* @__PURE__ */ Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = /* @__PURE__ */ Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = /* @__PURE__ */ Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = /* @__PURE__ */ Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = /* @__PURE__ */ Symbol.for("react.memo"), REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"), REACT_VIEW_TRANSITION_TYPE = /* @__PURE__ */ Symbol.for("react.view_transition"), REACT_CLIENT_REFERENCE = /* @__PURE__ */ Symbol.for("react.client.reference");
362
- function typeOf(object) {
363
- if ("object" === typeof object && null !== object) {
364
- var $$typeof = object.$$typeof;
365
- switch ($$typeof) {
366
- case REACT_ELEMENT_TYPE:
367
- switch (object = object.type, object) {
368
- case REACT_FRAGMENT_TYPE:
369
- case REACT_PROFILER_TYPE:
370
- case REACT_STRICT_MODE_TYPE:
371
- case REACT_SUSPENSE_TYPE:
372
- case REACT_SUSPENSE_LIST_TYPE:
373
- case REACT_VIEW_TRANSITION_TYPE:
374
- return object;
375
- default:
376
- switch (object = object && object.$$typeof, object) {
377
- case REACT_CONTEXT_TYPE:
378
- case REACT_FORWARD_REF_TYPE:
379
- case REACT_LAZY_TYPE:
380
- case REACT_MEMO_TYPE:
381
- return object;
382
- case REACT_CONSUMER_TYPE:
383
- return object;
384
- default:
385
- return $$typeof;
386
- }
387
- }
388
- case REACT_PORTAL_TYPE:
389
- return $$typeof;
390
- }
391
- }
392
- }
393
- reactIs_production.ContextConsumer = REACT_CONSUMER_TYPE;
394
- reactIs_production.ContextProvider = REACT_CONTEXT_TYPE;
395
- reactIs_production.Element = REACT_ELEMENT_TYPE;
396
- reactIs_production.ForwardRef = REACT_FORWARD_REF_TYPE;
397
- reactIs_production.Fragment = REACT_FRAGMENT_TYPE;
398
- reactIs_production.Lazy = REACT_LAZY_TYPE;
399
- reactIs_production.Memo = REACT_MEMO_TYPE;
400
- reactIs_production.Portal = REACT_PORTAL_TYPE;
401
- reactIs_production.Profiler = REACT_PROFILER_TYPE;
402
- reactIs_production.StrictMode = REACT_STRICT_MODE_TYPE;
403
- reactIs_production.Suspense = REACT_SUSPENSE_TYPE;
404
- reactIs_production.SuspenseList = REACT_SUSPENSE_LIST_TYPE;
405
- reactIs_production.isContextConsumer = function(object) {
406
- return typeOf(object) === REACT_CONSUMER_TYPE;
407
- };
408
- reactIs_production.isContextProvider = function(object) {
409
- return typeOf(object) === REACT_CONTEXT_TYPE;
410
- };
411
- reactIs_production.isElement = function(object) {
412
- return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
413
- };
414
- reactIs_production.isForwardRef = function(object) {
415
- return typeOf(object) === REACT_FORWARD_REF_TYPE;
416
- };
417
- reactIs_production.isFragment = function(object) {
418
- return typeOf(object) === REACT_FRAGMENT_TYPE;
419
- };
420
- reactIs_production.isLazy = function(object) {
421
- return typeOf(object) === REACT_LAZY_TYPE;
422
- };
423
- reactIs_production.isMemo = function(object) {
424
- return typeOf(object) === REACT_MEMO_TYPE;
425
- };
426
- reactIs_production.isPortal = function(object) {
427
- return typeOf(object) === REACT_PORTAL_TYPE;
428
- };
429
- reactIs_production.isProfiler = function(object) {
430
- return typeOf(object) === REACT_PROFILER_TYPE;
431
- };
432
- reactIs_production.isStrictMode = function(object) {
433
- return typeOf(object) === REACT_STRICT_MODE_TYPE;
434
- };
435
- reactIs_production.isSuspense = function(object) {
436
- return typeOf(object) === REACT_SUSPENSE_TYPE;
437
- };
438
- reactIs_production.isSuspenseList = function(object) {
439
- return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
440
- };
441
- reactIs_production.isValidElementType = function(type) {
442
- return "string" === typeof type || "function" === typeof type || type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || "object" === typeof type && null !== type && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_CONSUMER_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_CLIENT_REFERENCE || void 0 !== type.getModuleId) ? true : false;
443
- };
444
- reactIs_production.typeOf = typeOf;
445
- return reactIs_production;
446
- }
447
- var hasRequiredReactIs$1;
448
- function requireReactIs$1() {
449
- if (hasRequiredReactIs$1) return reactIs$1.exports;
450
- hasRequiredReactIs$1 = 1;
451
- {
452
- reactIs$1.exports = requireReactIs_production();
453
- }
454
- return reactIs$1.exports;
455
- }
456
- var reactIsExports$1 = requireReactIs$1();
457
- var index$1 = /* @__PURE__ */ getDefaultExportFromCjs(reactIsExports$1);
458
- var ReactIs19 = /* @__PURE__ */ _mergeNamespaces$1({
459
- __proto__: null,
460
- default: index$1
461
- }, [reactIsExports$1]);
462
- var reactIs = { exports: {} };
463
- var reactIs_production_min = {};
464
- var hasRequiredReactIs_production_min;
465
- function requireReactIs_production_min() {
466
- if (hasRequiredReactIs_production_min) return reactIs_production_min;
467
- hasRequiredReactIs_production_min = 1;
468
- var b = /* @__PURE__ */ Symbol.for("react.element"), c = /* @__PURE__ */ Symbol.for("react.portal"), d = /* @__PURE__ */ Symbol.for("react.fragment"), e = /* @__PURE__ */ Symbol.for("react.strict_mode"), f = /* @__PURE__ */ Symbol.for("react.profiler"), g = /* @__PURE__ */ Symbol.for("react.provider"), h = /* @__PURE__ */ Symbol.for("react.context"), k = /* @__PURE__ */ Symbol.for("react.server_context"), l = /* @__PURE__ */ Symbol.for("react.forward_ref"), m = /* @__PURE__ */ Symbol.for("react.suspense"), n = /* @__PURE__ */ Symbol.for("react.suspense_list"), p = /* @__PURE__ */ Symbol.for("react.memo"), q = /* @__PURE__ */ Symbol.for("react.lazy"), t = /* @__PURE__ */ Symbol.for("react.offscreen"), u;
469
- u = /* @__PURE__ */ Symbol.for("react.module.reference");
470
- function v(a) {
471
- if ("object" === typeof a && null !== a) {
472
- var r = a.$$typeof;
473
- switch (r) {
474
- case b:
475
- switch (a = a.type, a) {
476
- case d:
477
- case f:
478
- case e:
479
- case m:
480
- case n:
481
- return a;
482
- default:
483
- switch (a = a && a.$$typeof, a) {
484
- case k:
485
- case h:
486
- case l:
487
- case q:
488
- case p:
489
- case g:
490
- return a;
491
- default:
492
- return r;
493
- }
494
- }
495
- case c:
496
- return r;
497
- }
498
- }
499
- }
500
- reactIs_production_min.ContextConsumer = h;
501
- reactIs_production_min.ContextProvider = g;
502
- reactIs_production_min.Element = b;
503
- reactIs_production_min.ForwardRef = l;
504
- reactIs_production_min.Fragment = d;
505
- reactIs_production_min.Lazy = q;
506
- reactIs_production_min.Memo = p;
507
- reactIs_production_min.Portal = c;
508
- reactIs_production_min.Profiler = f;
509
- reactIs_production_min.StrictMode = e;
510
- reactIs_production_min.Suspense = m;
511
- reactIs_production_min.SuspenseList = n;
512
- reactIs_production_min.isAsyncMode = function() {
513
- return false;
514
- };
515
- reactIs_production_min.isConcurrentMode = function() {
516
- return false;
517
- };
518
- reactIs_production_min.isContextConsumer = function(a) {
519
- return v(a) === h;
520
- };
521
- reactIs_production_min.isContextProvider = function(a) {
522
- return v(a) === g;
523
- };
524
- reactIs_production_min.isElement = function(a) {
525
- return "object" === typeof a && null !== a && a.$$typeof === b;
526
- };
527
- reactIs_production_min.isForwardRef = function(a) {
528
- return v(a) === l;
529
- };
530
- reactIs_production_min.isFragment = function(a) {
531
- return v(a) === d;
532
- };
533
- reactIs_production_min.isLazy = function(a) {
534
- return v(a) === q;
535
- };
536
- reactIs_production_min.isMemo = function(a) {
537
- return v(a) === p;
538
- };
539
- reactIs_production_min.isPortal = function(a) {
540
- return v(a) === c;
541
- };
542
- reactIs_production_min.isProfiler = function(a) {
543
- return v(a) === f;
544
- };
545
- reactIs_production_min.isStrictMode = function(a) {
546
- return v(a) === e;
547
- };
548
- reactIs_production_min.isSuspense = function(a) {
549
- return v(a) === m;
550
- };
551
- reactIs_production_min.isSuspenseList = function(a) {
552
- return v(a) === n;
553
- };
554
- reactIs_production_min.isValidElementType = function(a) {
555
- return "string" === typeof a || "function" === typeof a || a === d || a === f || a === e || a === m || a === n || a === t || "object" === typeof a && null !== a && (a.$$typeof === q || a.$$typeof === p || a.$$typeof === g || a.$$typeof === h || a.$$typeof === l || a.$$typeof === u || void 0 !== a.getModuleId) ? true : false;
556
- };
557
- reactIs_production_min.typeOf = v;
558
- return reactIs_production_min;
559
- }
560
- var hasRequiredReactIs;
561
- function requireReactIs() {
562
- if (hasRequiredReactIs) return reactIs.exports;
563
- hasRequiredReactIs = 1;
564
- {
565
- reactIs.exports = requireReactIs_production_min();
566
- }
567
- return reactIs.exports;
568
- }
569
- var reactIsExports = requireReactIs();
570
- var index = /* @__PURE__ */ getDefaultExportFromCjs(reactIsExports);
571
- var ReactIs18 = /* @__PURE__ */ _mergeNamespaces$1({
572
- __proto__: null,
573
- default: index
574
- }, [reactIsExports]);
575
- const reactIsMethods = [
576
- "isAsyncMode",
577
- "isConcurrentMode",
578
- "isContextConsumer",
579
- "isContextProvider",
580
- "isElement",
581
- "isForwardRef",
582
- "isFragment",
583
- "isLazy",
584
- "isMemo",
585
- "isPortal",
586
- "isProfiler",
587
- "isStrictMode",
588
- "isSuspense",
589
- "isSuspenseList",
590
- "isValidElementType"
591
- ];
592
- const ReactIs = Object.fromEntries(reactIsMethods.map((m) => [m, (v) => ReactIs18[m](v) || ReactIs19[m](v)]));
593
- function getChildren(arg, children = []) {
594
- if (Array.isArray(arg)) {
595
- for (const item of arg) {
596
- getChildren(item, children);
597
- }
598
- } else if (arg != null && arg !== false && arg !== "") {
599
- children.push(arg);
600
- }
601
- return children;
602
- }
603
- function getType(element) {
604
- const type = element.type;
605
- if (typeof type === "string") {
606
- return type;
607
- }
608
- if (typeof type === "function") {
609
- return type.displayName || type.name || "Unknown";
610
- }
611
- if (ReactIs.isFragment(element)) {
612
- return "React.Fragment";
613
- }
614
- if (ReactIs.isSuspense(element)) {
615
- return "React.Suspense";
616
- }
617
- if (typeof type === "object" && type !== null) {
618
- if (ReactIs.isContextProvider(element)) {
619
- return "Context.Provider";
620
- }
621
- if (ReactIs.isContextConsumer(element)) {
622
- return "Context.Consumer";
623
- }
624
- if (ReactIs.isForwardRef(element)) {
625
- if (type.displayName) {
626
- return type.displayName;
627
- }
628
- const functionName = type.render.displayName || type.render.name || "";
629
- return functionName === "" ? "ForwardRef" : `ForwardRef(${functionName})`;
630
- }
631
- if (ReactIs.isMemo(element)) {
632
- const functionName = type.displayName || type.type.displayName || type.type.name || "";
633
- return functionName === "" ? "Memo" : `Memo(${functionName})`;
634
- }
635
- }
636
- return "UNDEFINED";
637
- }
638
- function getPropKeys$1(element) {
639
- const { props } = element;
640
- return Object.keys(props).filter((key) => key !== "children" && props[key] !== void 0).sort();
641
- }
642
- const serialize$1 = (element, config, indentation, depth, refs, printer2) => ++depth > config.maxDepth ? printElementAsLeaf(getType(element), config) : printElement(getType(element), printProps(getPropKeys$1(element), element.props, config, indentation + config.indent, depth, refs, printer2), printChildren(getChildren(element.props.children), config, indentation + config.indent, depth, refs, printer2), config, indentation);
643
- const test$1 = (val) => val != null && ReactIs.isElement(val);
644
- const plugin$1 = {
645
- serialize: serialize$1,
646
- test: test$1
647
- };
648
- const testSymbol = typeof Symbol === "function" && Symbol.for ? /* @__PURE__ */ Symbol.for("react.test.json") : 245830487;
649
- function getPropKeys(object) {
650
- const { props } = object;
651
- return props ? Object.keys(props).filter((key) => props[key] !== void 0).sort() : [];
652
- }
653
- const serialize = (object, config, indentation, depth, refs, printer2) => ++depth > config.maxDepth ? printElementAsLeaf(object.type, config) : printElement(object.type, object.props ? printProps(getPropKeys(object), object.props, config, indentation + config.indent, depth, refs, printer2) : "", object.children ? printChildren(object.children, config, indentation + config.indent, depth, refs, printer2) : "", config, indentation);
654
- const test = (val) => val && val.$$typeof === testSymbol;
655
- const plugin = {
656
- serialize,
657
- test
658
- };
659
- const toString = Object.prototype.toString;
660
- const toISOString = Date.prototype.toISOString;
661
- const errorToString = Error.prototype.toString;
662
- const regExpToString = RegExp.prototype.toString;
663
- function getConstructorName(val) {
664
- return typeof val.constructor === "function" && val.constructor.name || "Object";
665
- }
666
- function isWindow(val) {
667
- return typeof window !== "undefined" && val === window;
668
- }
669
- const SYMBOL_REGEXP = /^Symbol\((.*)\)(.*)$/;
670
- const NEWLINE_REGEXP = /\n/g;
671
- class PrettyFormatPluginError extends Error {
672
- constructor(message, stack) {
673
- super(message);
674
- this.stack = stack;
675
- this.name = this.constructor.name;
676
- }
677
- }
678
- function isToStringedArrayType(toStringed) {
679
- return toStringed === "[object Array]" || toStringed === "[object ArrayBuffer]" || toStringed === "[object DataView]" || toStringed === "[object Float32Array]" || toStringed === "[object Float64Array]" || toStringed === "[object Int8Array]" || toStringed === "[object Int16Array]" || toStringed === "[object Int32Array]" || toStringed === "[object Uint8Array]" || toStringed === "[object Uint8ClampedArray]" || toStringed === "[object Uint16Array]" || toStringed === "[object Uint32Array]";
680
- }
681
- function printNumber(val) {
682
- return Object.is(val, -0) ? "-0" : String(val);
683
- }
684
- function printBigInt(val) {
685
- return String(`${val}n`);
686
- }
687
- function printFunction(val, printFunctionName) {
688
- if (!printFunctionName) {
689
- return "[Function]";
690
- }
691
- return `[Function ${val.name || "anonymous"}]`;
692
- }
693
- function printSymbol(val) {
694
- return String(val).replace(SYMBOL_REGEXP, "Symbol($1)");
695
- }
696
- function printError(val) {
697
- return `[${errorToString.call(val)}]`;
698
- }
699
- function printBasicValue(val, printFunctionName, escapeRegex, escapeString) {
700
- if (val === true || val === false) {
701
- return `${val}`;
702
- }
703
- if (val === void 0) {
704
- return "undefined";
705
- }
706
- if (val === null) {
707
- return "null";
708
- }
709
- const typeOf = typeof val;
710
- if (typeOf === "number") {
711
- return printNumber(val);
712
- }
713
- if (typeOf === "bigint") {
714
- return printBigInt(val);
715
- }
716
- if (typeOf === "string") {
717
- if (escapeString) {
718
- return `"${val.replaceAll(/"|\\/g, "\\$&")}"`;
719
- }
720
- return `"${val}"`;
721
- }
722
- if (typeOf === "function") {
723
- return printFunction(val, printFunctionName);
724
- }
725
- if (typeOf === "symbol") {
726
- return printSymbol(val);
727
- }
728
- const toStringed = toString.call(val);
729
- if (toStringed === "[object WeakMap]") {
730
- return "WeakMap {}";
731
- }
732
- if (toStringed === "[object WeakSet]") {
733
- return "WeakSet {}";
734
- }
735
- if (toStringed === "[object Function]" || toStringed === "[object GeneratorFunction]") {
736
- return printFunction(val, printFunctionName);
737
- }
738
- if (toStringed === "[object Symbol]") {
739
- return printSymbol(val);
740
- }
741
- if (toStringed === "[object Date]") {
742
- return Number.isNaN(+val) ? "Date { NaN }" : toISOString.call(val);
743
- }
744
- if (toStringed === "[object Error]") {
745
- return printError(val);
746
- }
747
- if (toStringed === "[object RegExp]") {
748
- if (escapeRegex) {
749
- return regExpToString.call(val).replaceAll(/[$()*+.?[\\\]^{|}]/g, "\\$&");
750
- }
751
- return regExpToString.call(val);
752
- }
753
- if (val instanceof Error) {
754
- return printError(val);
755
- }
756
- return null;
757
- }
758
- function printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON) {
759
- if (refs.includes(val)) {
760
- return "[Circular]";
761
- }
762
- refs = [...refs];
763
- refs.push(val);
764
- const hitMaxDepth = ++depth > config.maxDepth;
765
- const min = config.min;
766
- if (config.callToJSON && !hitMaxDepth && val.toJSON && typeof val.toJSON === "function" && !hasCalledToJSON) {
767
- return printer(val.toJSON(), config, indentation, depth, refs, true);
768
- }
769
- const toStringed = toString.call(val);
770
- if (toStringed === "[object Arguments]") {
771
- return hitMaxDepth ? "[Arguments]" : `${min ? "" : "Arguments "}[${printListItems(val, config, indentation, depth, refs, printer)}]`;
772
- }
773
- if (isToStringedArrayType(toStringed)) {
774
- return hitMaxDepth ? `[${val.constructor.name}]` : `${min ? "" : !config.printBasicPrototype && val.constructor.name === "Array" ? "" : `${val.constructor.name} `}[${printListItems(val, config, indentation, depth, refs, printer)}]`;
775
- }
776
- if (toStringed === "[object Map]") {
777
- return hitMaxDepth ? "[Map]" : `Map {${printIteratorEntries(val.entries(), config, indentation, depth, refs, printer, " => ")}}`;
778
- }
779
- if (toStringed === "[object Set]") {
780
- return hitMaxDepth ? "[Set]" : `Set {${printIteratorValues(val.values(), config, indentation, depth, refs, printer)}}`;
781
- }
782
- return hitMaxDepth || isWindow(val) ? `[${getConstructorName(val)}]` : `${min ? "" : !config.printBasicPrototype && getConstructorName(val) === "Object" ? "" : `${getConstructorName(val)} `}{${printObjectProperties(val, config, indentation, depth, refs, printer)}}`;
783
- }
784
- const ErrorPlugin = {
785
- test: (val) => val && val instanceof Error,
786
- serialize(val, config, indentation, depth, refs, printer2) {
787
- if (refs.includes(val)) {
788
- return "[Circular]";
789
- }
790
- refs = [...refs, val];
791
- const hitMaxDepth = ++depth > config.maxDepth;
792
- const { message, cause, ...rest } = val;
793
- const entries = {
794
- message,
795
- ...typeof cause !== "undefined" ? { cause } : {},
796
- ...val instanceof AggregateError ? { errors: val.errors } : {},
797
- ...rest
798
- };
799
- const name = val.name !== "Error" ? val.name : getConstructorName(val);
800
- return hitMaxDepth ? `[${name}]` : `${name} {${printIteratorEntries(Object.entries(entries).values(), config, indentation, depth, refs, printer2)}}`;
801
- }
802
- };
803
- function isNewPlugin(plugin2) {
804
- return plugin2.serialize != null;
805
- }
806
- function printPlugin(plugin2, val, config, indentation, depth, refs) {
807
- let printed;
808
- try {
809
- printed = isNewPlugin(plugin2) ? plugin2.serialize(val, config, indentation, depth, refs, printer) : plugin2.print(val, (valChild) => printer(valChild, config, indentation, depth, refs), (str) => {
810
- const indentationNext = indentation + config.indent;
811
- return indentationNext + str.replaceAll(NEWLINE_REGEXP, `
812
- ${indentationNext}`);
813
- }, {
814
- edgeSpacing: config.spacingOuter,
815
- min: config.min,
816
- spacing: config.spacingInner
817
- }, config.colors);
818
- } catch (error) {
819
- throw new PrettyFormatPluginError(error.message, error.stack);
820
- }
821
- if (typeof printed !== "string") {
822
- throw new TypeError(`pretty-format: Plugin must return type "string" but instead returned "${typeof printed}".`);
823
- }
824
- return printed;
825
- }
826
- function findPlugin(plugins2, val) {
827
- for (const plugin2 of plugins2) {
828
- try {
829
- if (plugin2.test(val)) {
830
- return plugin2;
831
- }
832
- } catch (error) {
833
- throw new PrettyFormatPluginError(error.message, error.stack);
834
- }
835
- }
836
- return null;
837
- }
838
- function printer(val, config, indentation, depth, refs, hasCalledToJSON) {
839
- const plugin2 = findPlugin(config.plugins, val);
840
- if (plugin2 !== null) {
841
- return printPlugin(plugin2, val, config, indentation, depth, refs);
842
- }
843
- const basicResult = printBasicValue(val, config.printFunctionName, config.escapeRegex, config.escapeString);
844
- if (basicResult !== null) {
845
- return basicResult;
846
- }
847
- return printComplexValue(val, config, indentation, depth, refs, hasCalledToJSON);
848
- }
849
- const DEFAULT_THEME = {
850
- comment: "gray",
851
- content: "reset",
852
- prop: "yellow",
853
- tag: "cyan",
854
- value: "green"
855
- };
856
- const DEFAULT_THEME_KEYS = Object.keys(DEFAULT_THEME);
857
- const DEFAULT_OPTIONS = {
858
- callToJSON: true,
859
- compareKeys: void 0,
860
- escapeRegex: false,
861
- escapeString: true,
862
- highlight: false,
863
- indent: 2,
864
- maxDepth: Number.POSITIVE_INFINITY,
865
- maxWidth: Number.POSITIVE_INFINITY,
866
- min: false,
867
- plugins: [],
868
- printBasicPrototype: true,
869
- printFunctionName: true,
870
- printShadowRoot: true,
871
- theme: DEFAULT_THEME
872
- };
873
- function validateOptions(options) {
874
- for (const key of Object.keys(options)) {
875
- if (!Object.hasOwn(DEFAULT_OPTIONS, key)) {
876
- throw new Error(`pretty-format: Unknown option "${key}".`);
877
- }
878
- }
879
- if (options.min && options.indent !== void 0 && options.indent !== 0) {
880
- throw new Error('pretty-format: Options "min" and "indent" cannot be used together.');
881
- }
882
- }
883
- function getColorsHighlight() {
884
- return DEFAULT_THEME_KEYS.reduce((colors, key) => {
885
- const value = DEFAULT_THEME[key];
886
- const color = value && C[value];
887
- if (color && typeof color.close === "string" && typeof color.open === "string") {
888
- colors[key] = color;
889
- } else {
890
- throw new Error(`pretty-format: Option "theme" has a key "${key}" whose value "${value}" is undefined in ansi-styles.`);
891
- }
892
- return colors;
893
- }, /* @__PURE__ */ Object.create(null));
894
- }
895
- function getColorsEmpty() {
896
- return DEFAULT_THEME_KEYS.reduce((colors, key) => {
897
- colors[key] = {
898
- close: "",
899
- open: ""
900
- };
901
- return colors;
902
- }, /* @__PURE__ */ Object.create(null));
903
- }
904
- function getPrintFunctionName(options) {
905
- return options?.printFunctionName ?? DEFAULT_OPTIONS.printFunctionName;
906
- }
907
- function getEscapeRegex(options) {
908
- return options?.escapeRegex ?? DEFAULT_OPTIONS.escapeRegex;
909
- }
910
- function getEscapeString(options) {
911
- return options?.escapeString ?? DEFAULT_OPTIONS.escapeString;
912
- }
913
- function getConfig(options) {
914
- return {
915
- callToJSON: options?.callToJSON ?? DEFAULT_OPTIONS.callToJSON,
916
- colors: options?.highlight ? getColorsHighlight() : getColorsEmpty(),
917
- compareKeys: typeof options?.compareKeys === "function" || options?.compareKeys === null ? options.compareKeys : DEFAULT_OPTIONS.compareKeys,
918
- escapeRegex: getEscapeRegex(options),
919
- escapeString: getEscapeString(options),
920
- indent: options?.min ? "" : createIndent(options?.indent ?? DEFAULT_OPTIONS.indent),
921
- maxDepth: options?.maxDepth ?? DEFAULT_OPTIONS.maxDepth,
922
- maxWidth: options?.maxWidth ?? DEFAULT_OPTIONS.maxWidth,
923
- min: options?.min ?? DEFAULT_OPTIONS.min,
924
- plugins: options?.plugins ?? DEFAULT_OPTIONS.plugins,
925
- printBasicPrototype: options?.printBasicPrototype ?? true,
926
- printFunctionName: getPrintFunctionName(options),
927
- printShadowRoot: options?.printShadowRoot ?? true,
928
- spacingInner: options?.min ? " " : "\n",
929
- spacingOuter: options?.min ? "" : "\n"
930
- };
931
- }
932
- function createIndent(indent) {
933
- return Array.from({ length: indent + 1 }).join(" ");
934
- }
935
- function format(val, options) {
936
- if (options) {
937
- validateOptions(options);
938
- if (options.plugins) {
939
- const plugin2 = findPlugin(options.plugins, val);
940
- if (plugin2 !== null) {
941
- return printPlugin(plugin2, val, getConfig(options), "", 0, []);
942
- }
943
- }
944
- }
945
- const basicResult = printBasicValue(val, getPrintFunctionName(options), getEscapeRegex(options), getEscapeString(options));
946
- if (basicResult !== null) {
947
- return basicResult;
948
- }
949
- return printComplexValue(val, getConfig(options), "", 0, []);
950
- }
951
- const plugins = {
952
- AsymmetricMatcher: plugin$5,
953
- DOMCollection: plugin$4,
954
- DOMElement: plugin$3,
955
- Immutable: plugin$2,
956
- ReactElement: plugin$1,
957
- ReactTestComponent: plugin,
958
- Error: ErrorPlugin
959
- };
960
- export {
961
- DEFAULT_OPTIONS,
962
- format,
963
- plugins
964
- };